@galacean/engine-shaderlab 2.0.0-alpha.26 → 2.0.0-alpha.28
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 +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.verbose.js +1 -1
- package/dist/browser.verbose.min.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.verbose.js +1 -1
- package/dist/module.js +1 -1
- package/dist/module.verbose.js +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 null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(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&&n(e,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,f,d,m,S,v,g,y,E,C,x,A,T,b,O,I,L,R,P,M,N,D,V,G,F,k,B,W,U,w,H,j,z,q,X,Q,Y,K,J,Z,$,ee,et,er,en,ei,ea,eo,es,ec,el,eu,ep,e_,eh,ef,ed,em,eS,ev,eg,ey,eE,eC,ex,eA,eT,eb,eO,eI,eL,eR,eP,eM=/*#__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}(),eN=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e){this.index=e},t.dispose=function(){this.index=0},e}(),eD=((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),eV=((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.BitwiseOr=74]="BitwiseOr",p[p.GSRenderQueueType=75]="GSRenderQueueType",p[p.GSBlendState=76]="GSBlendState",p[p.GSDepthState=77]="GSDepthState",p[p.GSStencilState=78]="GSStencilState",p[p.GSRasterState=79]="GSRasterState",p[p.GSEditorProperties=80]="GSEditorProperties",p[p.GSEditorMacros=81]="GSEditorMacros",p[p.GSEditor=82]="GSEditor",p[p.GSTags=83]="GSTags",p[p.GSVertexShader=84]="GSVertexShader",p[p.GSFragmentShader=85]="GSFragmentShader",p[p.GSSubShader=86]="GSSubShader",p[p.GSPass=87]="GSPass",p[p.GSBlendFactor=88]="GSBlendFactor",p[p.GSBlendOperation=89]="GSBlendOperation",p[p.GSBool=90]="GSBool",p[p.GSNumber=91]="GSNumber",p[p.GSColor=92]="GSColor",p[p.GSCompareFunction=93]="GSCompareFunction",p[p.GSStencilOperation=94]="GSStencilOperation",p[p.GSCullMode=95]="GSCullMode",p[p.GSColorWriteMask=96]="GSColorWriteMask",p[p.GSUsePass=97]="GSUsePass",p[p.MACRO_IF=98]="MACRO_IF",p[p.MACRO_IFDEF=99]="MACRO_IFDEF",p[p.MACRO_IFNDEF=100]="MACRO_IFNDEF",p[p.MACRO_ELSE=101]="MACRO_ELSE",p[p.MACRO_ELIF=102]="MACRO_ELIF",p[p.MACRO_ENDIF=103]="MACRO_ENDIF",p[p.MACRO_UNDEF=104]="MACRO_UNDEF",p[p.MACRO_DEFINE_EXPRESSION=105]="MACRO_DEFINE_EXPRESSION",p[p.MACRO_CONDITIONAL_EXPRESSION=106]="MACRO_CONDITIONAL_EXPRESSION",p[p.MACRO_CALL=107]="MACRO_CALL",p),eG=/*#__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}();eG._shaderLabObjectPoolSet=[];var eF=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t,n){if(this.type=e,this.lexeme=t,n){if(r(n,eM))this.location=n;else{var i=tR.createPosition(n.index+t.length);this.location=tR.createRange(n,i)}}},t.dispose=function(){},e}();eF.pool=eG.createObjectPool(eF);var ek=new eF;ek.set(eD.EOF,"/EOF");var eB=/*#__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 _=this._funcCallReg.exec(l);_&&(u=2,p=_[1])}var h={isFunction:s,name:n,value:l,valueType:u,params:c,functionCallName:p},f=t[n];f?this._isExist(f,h)||f.push(h):t[n]=[h]}},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 eW(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eW=function(){return!!e})()}function eU(e,t,r){return(eU=eW()?Reflect.construct:function(e,t,r){var i=[null];i.push.apply(i,t);var a=new(Function.bind.apply(e,i));return r&&n(a,r.prototype),a}).apply(null,arguments)}eB._includeReg=/^[ \t]*#include +"([\w\d./]+)"/gm,eB._macroRegex=/^\s*#define\s+(\w+)[ ]*(\(([^)]*)\))?[ ]+(\(?\w+\)?.*?)(?:\/\/.*|\/\*.*?\*\/)?\s*$/gm,eB._symbolReg=/^[a-zA-Z_][a-zA-Z0-9_]*$/,eB._funcCallReg=/^([a-zA-Z_][a-zA-Z0-9_]*)\s*\((.*)\)$/,eB._macroDefineIncludeMap=new Map,eB._repeatIncludeSet=new Set;var ew=((_={})[_.VERTEX=0]="VERTEX",_[_.FRAGMENT=1]="FRAGMENT",_[_.ALL=2]="ALL",_);function eH(e){return e>=200&&e<=213}var ej=new Map,ez=/*#__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 eH(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=eU(e,[].concat([t,r,ew.ALL],a)),c=null!=(n=ej.get(t))?n:[];c.push(s),ej.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=eU(e,[].concat([t,r,n],o)),l=null!=(i=ej.get(t))?i:[];l.push(c),ej.set(t,l)},e.getFn=function(e,t){var r=ej.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(eH(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!!ej.get(e)},o(e,[{key:"realReturnType",get:function(){return this._realReturnType}}]),e}();ez._create("radians",200,200),ez._create("degrees",200,200),ez._create("sin",200,200),ez._create("cos",200,200),ez._create("tan",200,200),ez._create("asin",200,200),ez._create("acos",200,200),ez._create("atan",200,200,200),ez._create("atan",200,200),ez._create("sinh",200,200),ez._create("cosh",200,200),ez._create("tanh",200,200),ez._create("asinh",200,200),ez._create("acosh",200,200),ez._create("atanh",200,200),ez._create("pow",200,200,200),ez._create("exp",200,200),ez._create("log",200,200),ez._create("exp2",200,200),ez._create("log2",200,200),ez._create("sqrt",200,200),ez._create("inversesqrt",200,200),ez._create("abs",200,200),ez._create("abs",201,201),ez._create("sign",200,200),ez._create("sign",201,201),ez._create("floor",200,200),ez._create("trunc",200,200),ez._create("round",200,200),ez._create("roundEven",200,200),ez._create("ceil",200,200),ez._create("fract",200,200),ez._create("mod",200,200,eV.FLOAT),ez._create("mod",200,200,200),ez._create("min",200,200,200),ez._create("min",200,200,eV.FLOAT),ez._create("min",201,201,201),ez._create("min",201,201,eV.INT),ez._create("min",202,202,202),ez._create("min",202,202,eV.UINT),ez._create("max",200,200,200),ez._create("max",200,200,eV.FLOAT),ez._create("max",201,201,201),ez._create("max",201,201,eV.INT),ez._create("clamp",200,200,200,200),ez._create("clamp",200,200,eV.FLOAT,eV.FLOAT),ez._create("clamp",201,201,201,201),ez._create("clamp",201,201,eV.INT,eV.INT),ez._create("clamp",202,202,202,202),ez._create("clamp",202,202,eV.UINT,eV.UINT),ez._create("mix",200,200,200,200),ez._create("mix",200,200,200,eV.FLOAT),ez._create("mix",200,200,200,203),ez._create("step",200,200,200),ez._create("step",200,eV.FLOAT,200),ez._create("smoothstep",200,200,200,200),ez._create("smoothstep",200,eV.FLOAT,eV.FLOAT,200),ez._create("isnan",203,200),ez._create("isinf",203,200),ez._create("floatBitsToInt",200,200),ez._create("floatBitsToUint",202,200),ez._create("intBitsToFloat",200,201),ez._create("uintBitsToFloat",200,202),ez._create("packSnorm2x16",eV.UINT,eV.VEC2),ez._create("unpackSnorm2x16",eV.VEC2,eV.UINT),ez._create("packUnorm2x16",eV.UINT,eV.VEC2),ez._create("unpackUnorm2x16",eV.VEC2,eV.UINT),ez._create("packHalf2x16",eV.UINT,eV.VEC2),ez._create("unpackHalf2x16",eV.VEC2,eV.UINT),ez._create("length",eV.FLOAT,200),ez._create("distance",eV.FLOAT,200,200),ez._create("dot",eV.FLOAT,200,200),ez._create("cross",eV.VEC3,eV.VEC3,eV.VEC3),ez._create("normalize",200,200),ez._create("faceforward",200,200,200,200),ez._create("reflect",200,200,200),ez._create("refract",200,200,200,eV.FLOAT),ez._create("matrixCompMult",204,204,204),ez._create("outerProduct",eV.MAT2,eV.VEC2,eV.VEC2),ez._create("outerProduct",eV.MAT3,eV.VEC3,eV.VEC3),ez._create("outerProduct",eV.MAT4,eV.VEC4,eV.VEC4),ez._create("outerProduct",eV.MAT2X3,eV.VEC3,eV.VEC2),ez._create("outerProduct",eV.MAT3X2,eV.VEC2,eV.VEC3),ez._create("outerProduct",eV.MAT2X4,eV.VEC4,eV.VEC2),ez._create("outerProduct",eV.MAT4X2,eV.VEC2,eV.VEC4),ez._create("outerProduct",eV.MAT3X4,eV.VEC4,eV.VEC3),ez._create("outerProduct",eV.MAT4X3,eV.VEC3,eV.VEC4),ez._create("transpose",eV.MAT2,eV.MAT2),ez._create("transpose",eV.MAT3,eV.MAT3),ez._create("transpose",eV.MAT4,eV.MAT4),ez._create("transpose",eV.MAT2X3,eV.MAT3X2),ez._create("transpose",eV.MAT3X2,eV.MAT2X3),ez._create("transpose",eV.MAT4X2,eV.MAT2X4),ez._create("transpose",eV.MAT2X4,eV.MAT4X2),ez._create("transpose",eV.MAT3X4,eV.MAT4X3),ez._create("transpose",eV.MAT4X3,eV.MAT3X4),ez._create("determinant",eV.FLOAT,eV.MAT2),ez._create("determinant",eV.FLOAT,eV.MAT3),ez._create("determinant",eV.FLOAT,eV.MAT4),ez._create("inverse",eV.MAT2,eV.MAT2),ez._create("inverse",eV.MAT3,eV.MAT3),ez._create("inverse",eV.MAT4,eV.MAT4),ez._create("lessThan",205,208,208),ez._create("lessThan",205,206,206),ez._create("lessThan",205,207,207),ez._create("lessThanEqual",205,208,208),ez._create("lessThanEqual",205,206,206),ez._create("lessThanEqual",205,207,207),ez._create("greaterThan",205,208,208),ez._create("greaterThan",205,206,206),ez._create("greaterThan",205,207,207),ez._create("greaterThanEqual",205,208,208),ez._create("greaterThanEqual",205,206,206),ez._create("greaterThanEqual",205,207,207),ez._create("equal",205,208,208),ez._create("equal",205,206,206),ez._create("equal",205,207,207),ez._create("equal",205,205,205),ez._create("notEqual",205,208,208),ez._create("notEqual",205,206,206),ez._create("notEqual",205,207,207),ez._create("notEqual",205,205,205),ez._create("any",eV.BOOL,205),ez._create("all",eV.BOOL,205),ez._create("not",205,205),ez._create("textureSize",eV.IVEC2,210,eV.INT),ez._create("textureSize",eV.IVEC3,211,eV.INT),ez._create("textureSize",eV.IVEC2,212,eV.INT),ez._create("textureSize",eV.IVEC2,eV.SAMPLER2D_SHADOW,eV.INT),ez._create("textureSize",eV.IVEC2,eV.SAMPLER_CUBE_SHADOW,eV.INT),ez._create("textureSize",eV.IVEC3,213,eV.INT),ez._create("textureSize",eV.IVEC3,eV.SAMPLER2D_ARRAY_SHADOW,eV.INT),ez._create("texture2D",eV.VEC4,eV.SAMPLER2D,eV.VEC2),ez._create("texture2D",eV.VEC4,eV.SAMPLER2D,eV.VEC2,eV.FLOAT),ez._create("texture",209,210,eV.VEC2,eV.FLOAT),ez._create("texture",209,210,eV.VEC2),ez._create("texture",209,211,eV.VEC3,eV.FLOAT),ez._create("texture",209,211,eV.VEC3),ez._create("texture",209,212,eV.VEC3,eV.FLOAT),ez._create("texture",209,212,eV.VEC3),ez._create("texture",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC3,eV.FLOAT),ez._create("texture",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC3),ez._create("texture",eV.FLOAT,eV.SAMPLER_CUBE_SHADOW,eV.VEC4,eV.FLOAT),ez._create("texture",eV.FLOAT,eV.SAMPLER_CUBE_SHADOW,eV.VEC4),ez._create("texture",209,eV.SAMPLER2D_ARRAY,eV.VEC3,eV.FLOAT),ez._create("texture",209,eV.SAMPLER2D_ARRAY,eV.VEC3),ez._create("texture",eV.FLOAT,eV.SAMPLER2D_ARRAY_SHADOW,eV.VEC4),ez._create("textureProj",209,210,eV.VEC3,eV.FLOAT),ez._create("textureProj",209,210,eV.VEC3),ez._create("textureProj",209,210,eV.VEC4,eV.FLOAT),ez._create("textureProj",209,210,eV.VEC4),ez._create("textureProj",209,211,eV.VEC4,eV.FLOAT),ez._create("textureProj",209,211,eV.VEC4),ez._create("textureProj",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC4,eV.FLOAT),ez._create("textureProj",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC4),ez._create("textureLod",209,210,eV.VEC2,eV.FLOAT),ez._create("textureLod",209,211,eV.VEC3,eV.FLOAT),ez._create("textureLod",209,212,eV.VEC3,eV.FLOAT),ez._create("textureLod",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC3,eV.FLOAT),ez._create("textureLod",209,213,eV.VEC3,eV.FLOAT),ez._create("texture2DLodEXT",209,210,eV.VEC2,eV.FLOAT),ez._create("texture2DLodEXT",209,211,eV.VEC3,eV.FLOAT),ez._create("textureCube",eV.SAMPLER_CUBE,eV.VEC3),ez._create("textureCube",eV.SAMPLER_CUBE,eV.VEC3,eV.FLOAT),ez._create("textureCube",209,212,eV.VEC3,eV.FLOAT),ez._create("textureCubeLod",eV.SAMPLER_CUBE,eV.VEC3,eV.FLOAT),ez._create("textureCubeLodEXT",209,212,eV.VEC3,eV.FLOAT),ez._create("textureOffset",209,210,eV.VEC2,eV.IVEC2,eV.FLOAT),ez._create("textureOffset",209,210,eV.VEC2,eV.IVEC2),ez._create("textureOffset",209,211,eV.VEC3,eV.IVEC3,eV.FLOAT),ez._create("textureOffset",209,211,eV.VEC3,eV.IVEC3),ez._create("textureOffset",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC3,eV.IVEC2,eV.FLOAT),ez._create("textureOffset",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC3,eV.IVEC2),ez._create("textureOffset",209,213,eV.VEC3,eV.IVEC2,eV.FLOAT),ez._create("textureOffset",209,213,eV.VEC3,eV.IVEC2),ez._create("texelFetch",209,210,eV.IVEC2,eV.INT),ez._create("texelFetch",209,211,eV.IVEC3,eV.INT),ez._create("texelFetch",209,213,eV.IVEC3,eV.INT),ez._create("texelFetchOffset",209,210,eV.IVEC2,eV.INT,eV.IVEC2),ez._create("texelFetchOffset",209,211,eV.IVEC3,eV.INT,eV.IVEC3),ez._create("texelFetchOffset",209,213,eV.IVEC3,eV.INT,eV.IVEC2),ez._create("textureProjOffset",209,210,eV.VEC3,eV.IVEC2,eV.FLOAT),ez._create("textureProjOffset",209,210,eV.VEC3,eV.IVEC2),ez._create("textureProjOffset",209,210,eV.VEC4,eV.IVEC2,eV.FLOAT),ez._create("textureProjOffset",209,210,eV.VEC4,eV.IVEC2),ez._create("textureProjOffset",209,211,eV.VEC4,eV.IVEC3,eV.FLOAT),ez._create("textureProjOffset",209,211,eV.VEC4,eV.IVEC3),ez._create("textureProjOffset",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC4,eV.IVEC2,eV.FLOAT),ez._create("textureProjOffset",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC4,eV.IVEC2),ez._create("textureLodOffset",209,210,eV.VEC2,eV.FLOAT,eV.IVEC2),ez._create("textureLodOffset",209,211,eV.VEC3,eV.FLOAT,eV.IVEC3),ez._create("textureLodOffset",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC3,eV.FLOAT,eV.IVEC2),ez._create("textureLodOffset",209,213,eV.VEC3,eV.FLOAT,eV.IVEC2),ez._create("textureProjLod",209,210,eV.VEC3,eV.FLOAT),ez._create("textureProjLod",209,210,eV.VEC4,eV.FLOAT),ez._create("textureProjLod",209,211,eV.VEC4,eV.FLOAT),ez._create("textureProjLod",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC4,eV.FLOAT),ez._create("textureProjLodOffset",209,210,eV.VEC3,eV.FLOAT,eV.IVEC2),ez._create("textureProjLodOffset",209,210,eV.VEC4,eV.FLOAT,eV.IVEC2),ez._create("textureProjLodOffset",209,211,eV.VEC4,eV.FLOAT,eV.IVEC3),ez._create("textureProjLodOffset",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC4,eV.FLOAT,eV.IVEC2),ez._create("textureGrad",209,210,eV.VEC2,eV.VEC2,eV.VEC2),ez._create("textureGrad",209,211,eV.VEC3,eV.VEC3,eV.VEC3),ez._create("textureGrad",209,212,eV.VEC3,eV.VEC3,eV.VEC3),ez._create("textureGrad",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC3,eV.VEC2,eV.VEC2),ez._create("textureGrad",eV.FLOAT,eV.SAMPLER_CUBE_SHADOW,eV.VEC4,eV.VEC3,eV.VEC3),ez._create("textureGrad",209,213,eV.VEC3,eV.VEC2,eV.VEC2),ez._create("textureGrad",eV.FLOAT,eV.SAMPLER2D_ARRAY_SHADOW,eV.VEC4,eV.VEC2,eV.VEC2),ez._create("textureGradOffset",209,210,eV.VEC2,eV.VEC2,eV.VEC2,eV.IVEC2),ez._create("textureGradOffset",209,211,eV.VEC3,eV.VEC3,eV.VEC3,eV.IVEC3),ez._create("textureGradOffset",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC3,eV.VEC2,eV.VEC2,eV.IVEC2),ez._create("textureGradOffset",209,213,eV.VEC3,eV.VEC2,eV.VEC2,eV.IVEC2),ez._create("textureGradOffset",eV.FLOAT,eV.SAMPLER2D_ARRAY_SHADOW,eV.VEC3,eV.VEC2,eV.VEC2,eV.IVEC2),ez._create("textureProjGrad",209,210,eV.VEC3,eV.VEC2,eV.VEC2),ez._create("textureProjGrad",209,210,eV.VEC4,eV.VEC2,eV.VEC2),ez._create("textureProjGrad",209,211,eV.VEC4,eV.VEC3,eV.VEC3),ez._create("textureProjGrad",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC4,eV.VEC2,eV.VEC2),ez._create("textureProjGradOffset",209,210,eV.VEC3,eV.VEC2,eV.VEC2,eV.IVEC2),ez._create("textureProjGradOffset",209,210,eV.VEC4,eV.VEC2,eV.VEC2,eV.IVEC2),ez._create("textureProjGradOffset",209,211,eV.VEC4,eV.VEC3,eV.VEC3,eV.IVEC3),ez._create("textureProjGradOffset",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC4,eV.VEC2,eV.VEC2,eV.IVEC2),ez._createWithScop("dFdx",200,ew.FRAGMENT,200),ez._createWithScop("dFdy",200,ew.FRAGMENT,200),ez._createWithScop("fwidth",200,ew.FRAGMENT,200);var eq=new Map,eX=/*#__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=ew.ALL);var i=new e(r,t,n);eq.set(t,i)},e.getVar=function(e){return eq.get(e)},e}();eX.createVariable("gl_VertexID",eV.INT,ew.VERTEX),eX.createVariable("gl_InstanceID",eV.INT,ew.VERTEX),eX.createVariable("gl_Position",eV.VEC4,ew.VERTEX),eX.createVariable("gl_PointSize",eV.FLOAT,ew.VERTEX),eX.createVariable("gl_FragCoord",eV.VEC4,ew.FRAGMENT),eX.createVariable("gl_FrontFacing",eV.BOOL,ew.FRAGMENT),eX.createVariable("gl_FragDepth",eV.FLOAT,ew.FRAGMENT),eX.createVariable("gl_PointCoord",eV.VEC2,ew.FRAGMENT),eX.createVariable("gl_FragColor",eV.VEC4,ew.FRAGMENT),eX.createVariable("gl_FragData",eV.VEC4_ARRAY,ew.FRAGMENT),eX.createVariable("gl_MaxVertexAttribs",eV.INT),eX.createVariable("gl_MaxVertexUniformVectors",eV.INT),eX.createVariable("gl_MaxVertexOutputVectors",eV.INT),eX.createVariable("gl_MaxFragmentInputVectors",eV.INT),eX.createVariable("gl_MaxVertexTextureImageUnits",eV.INT),eX.createVariable("gl_MaxCombinedTextureImageUnits",eV.INT),eX.createVariable("gl_MaxTextureImageUnits",eV.INT),eX.createVariable("gl_MaxFragmentUniformVectors",eV.INT),eX.createVariable("gl_MaxDrawBuffers",eV.INT),eX.createVariable("gl_MinProgramTexelOffset",eV.INT),eX.createVariable("gl_MaxProgramTexelOffset",eV.INT);var eQ=((h={})[h.START=2e3]="START",h[h.gs_shader_program=2001]="gs_shader_program",h[h.global_declaration=2002]="global_declaration",h[h.variable_declaration=2003]="variable_declaration",h[h.variable_declaration_list=2004]="variable_declaration_list",h[h.variable_declaration_statement=2005]="variable_declaration_statement",h[h.array_specifier_list=2006]="array_specifier_list",h[h.array_specifier=2007]="array_specifier",h[h.ext_builtin_type_specifier_nonarray=2008]="ext_builtin_type_specifier_nonarray",h[h.precision_specifier=2009]="precision_specifier",h[h.variable_identifier=2010]="variable_identifier",h[h.variable_identifier_node=2011]="variable_identifier_node",h[h.primary_expression=2012]="primary_expression",h[h.postfix_expression=2013]="postfix_expression",h[h.integer_expression=2014]="integer_expression",h[h.function_call=2015]="function_call",h[h.function_call_generic=2016]="function_call_generic",h[h.function_call_header_no_parameters=2017]="function_call_header_no_parameters",h[h.function_call_header_with_parameters=2018]="function_call_header_with_parameters",h[h.function_call_parameter_list=2019]="function_call_parameter_list",h[h.function_call_header=2020]="function_call_header",h[h.function_identifier=2021]="function_identifier",h[h.constructor_identifier=2022]="constructor_identifier",h[h.unary_expression=2023]="unary_expression",h[h.unary_operator=2024]="unary_operator",h[h.multiplicative_expression=2025]="multiplicative_expression",h[h.additive_expression=2026]="additive_expression",h[h.shift_expression=2027]="shift_expression",h[h.relational_expression=2028]="relational_expression",h[h.equality_expression=2029]="equality_expression",h[h.and_expression=2030]="and_expression",h[h.inclusive_or_expression=2031]="inclusive_or_expression",h[h.exclusive_or_expression=2032]="exclusive_or_expression",h[h.logical_and_expression=2033]="logical_and_expression",h[h.logical_xor_expression=2034]="logical_xor_expression",h[h.logical_or_expression=2035]="logical_or_expression",h[h.conditional_expression=2036]="conditional_expression",h[h.assignment_expression=2037]="assignment_expression",h[h.assignment_operator=2038]="assignment_operator",h[h.expression=2039]="expression",h[h.integer_constant_expression=2040]="integer_constant_expression",h[h.integer_constant_expression_operator=2041]="integer_constant_expression_operator",h[h.declaration=2042]="declaration",h[h.function_prototype=2043]="function_prototype",h[h.function_declarator=2044]="function_declarator",h[h.function_header_with_parameters=2045]="function_header_with_parameters",h[h.function_header=2046]="function_header",h[h.function_parameter_list=2047]="function_parameter_list",h[h.parameter_declarator=2048]="parameter_declarator",h[h.parameter_declaration=2049]="parameter_declaration",h[h.parameter_qualifier=2050]="parameter_qualifier",h[h.parameter_type_specifier=2051]="parameter_type_specifier",h[h.init_declarator_list=2052]="init_declarator_list",h[h.single_declaration=2053]="single_declaration",h[h.fully_specified_type=2054]="fully_specified_type",h[h.type_qualifier=2055]="type_qualifier",h[h.single_type_qualifier=2056]="single_type_qualifier",h[h.storage_qualifier=2057]="storage_qualifier",h[h.precision_qualifier=2058]="precision_qualifier",h[h.interpolation_qualifier=2059]="interpolation_qualifier",h[h.invariant_qualifier=2060]="invariant_qualifier",h[h.type_specifier=2061]="type_specifier",h[h.type_specifier_nonarray=2062]="type_specifier_nonarray",h[h.type_specifier_no_prec=2063]="type_specifier_no_prec",h[h.basic_type=2064]="basic_type",h[h.struct_specifier=2065]="struct_specifier",h[h.struct_declaration_list=2066]="struct_declaration_list",h[h.struct_declaration=2067]="struct_declaration",h[h.layout_qualifier=2068]="layout_qualifier",h[h.struct_declarator_list=2069]="struct_declarator_list",h[h.struct_declarator=2070]="struct_declarator",h[h.identifier_list=2071]="identifier_list",h[h.decl_identifier=2072]="decl_identifier",h[h.initializer=2073]="initializer",h[h.initializer_list=2074]="initializer_list",h[h.declaration_statement=2075]="declaration_statement",h[h.simple_statement=2076]="simple_statement",h[h.compound_statement_no_scope=2077]="compound_statement_no_scope",h[h.statement_with_scope=2078]="statement_with_scope",h[h.compound_statement=2079]="compound_statement",h[h.statement=2080]="statement",h[h.statement_list=2081]="statement_list",h[h.iteration_statement_no_new_scope=2082]="iteration_statement_no_new_scope",h[h.expression_statement=2083]="expression_statement",h[h.selection_statement=2084]="selection_statement",h[h.selection_rest_statement=2085]="selection_rest_statement",h[h.condition=2086]="condition",h[h.conditionopt=2087]="conditionopt",h[h.iteration_statement=2088]="iteration_statement",h[h.for_init_statement=2089]="for_init_statement",h[h.for_rest_statement=2090]="for_rest_statement",h[h.jump_statement=2091]="jump_statement",h[h.external_declaration=2092]="external_declaration",h[h.function_definition=2093]="function_definition",h[h.field_selection=2094]="field_selection",h[h.bool_constant=2095]="bool_constant",h[h.function_identifier_node=2096]="function_identifier_node",h[h.typename_identifier_node=2097]="typename_identifier_node",h[h.scope_brace=2098]="scope_brace",h[h.scope_end_brace=2099]="scope_end_brace",h[h.macro_undef=2100]="macro_undef",h[h.macro_push_context=2101]="macro_push_context",h[h.macro_pop_context=2102]="macro_pop_context",h[h.macro_elif_expression=2103]="macro_elif_expression",h[h.macro_else_expression=2104]="macro_else_expression",h[h.global_macro_if_statement=2105]="global_macro_if_statement",h[h.global_macro_declaration=2106]="global_macro_declaration",h[h.global_macro_branch=2107]="global_macro_branch",h[h.macro_struct_declaration=2108]="macro_struct_declaration",h[h.macro_struct_branch=2109]="macro_struct_branch",h[h.macro_if_statement=2110]="macro_if_statement",h[h.macro_branch=2111]="macro_branch",h[h.macro_param_case_list=2112]="macro_param_case_list",h[h.macro_param_block=2113]="macro_param_block",h[h.macro_parameter_branch=2114]="macro_parameter_branch",h[h.macro_call_arg_case_list=2115]="macro_call_arg_case_list",h[h.macro_call_arg_block=2116]="macro_call_arg_block",h[h.macro_call_arg_branch=2117]="macro_call_arg_branch",h[h.macro_call_symbol=2118]="macro_call_symbol",h[h.macro_call_function=2119]="macro_call_function",h[h._ignore=2120]="_ignore",h),eY=/*#__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}(),eK=/*#__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 eJ(e){return(eJ=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eZ(e){var t="function"==typeof Map?new Map:void 0;return(eZ=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,r)}function r(){return eU(e,arguments,eJ(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),n(r,e)})(e)}var e$=/*#__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 i(t,e),t.prototype.toString=function(){var e=this.message,t=this.location,n=this.source;return n?(r(t,eN)||(t.start,t.end),n.split("\n"),this.name+": "+e+"\n\n"):e},t}(eZ(Error));e$.wrappingLineCount=2;var e0=((f={}).PreprocessorError="PreprocessorError",f.CompilationError="CompilationError",f.ScannerError="ScannerError",f.CompilationWarn="CompilationWarning",f),e2=function(e,t,r){this.type=e,this.typeLexeme=t,this.arraySpecifier=r},e1=((d={})[d.VAR=0]="VAR",d[d.FN=1]="FN",d[d.STRUCT=2]="STRUCT",d[d.Any=3]="Any",d),e3=/*#__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}(),e4=/*#__PURE__*/function(e){function t(t,r){var n=new e2(r.protoType.returnType.type,r.protoType.returnType.typeSpecifier.lexeme);return e.call(this,t,e1.FN,r,n)||this}return i(t,e),t}(e3),e9=/*#__PURE__*/function(e){function t(t,r){return e.call(this,t,e1.STRUCT,r)||this}return i(t,e),t}(e3),e5=/*#__PURE__*/function(e){function t(t,r,n,i){var a;return(a=e.call(this,t,e1.VAR,i,r)||this).isGlobalVariable=n,a}return i(t,e),t}(e3),e6=/*#__PURE__*/function(){function e(){this.globalPrecisions=[],this.globalMacroDeclarations=[]}return e.prototype.getOuterGlobalMacroDeclarations=function(){return this.globalMacroDeclarations.filter(function(e){return r(e.parent,eP.GLShaderProgram)})},e}(),e7=/*#__PURE__*/function(){function e(){this.semanticStack=[],this.acceptRule=void 0,this.symbolTableStack=new eK,this.curFunctionInfo={},this._shaderData=new e6,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 e6,this.symbolTableStack.clear(),this.pushScope()},r.pushScope=function(){this.symbolTableStack.pushScope(new eY)},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 e$(e0.CompilationWarn,r,e,tR._processingPassText).toString())},o(e,[{key:"shaderData",get:function(){return this._shaderData}},{key:"macroDefineList",get:function(){return this._macroDefineList}}]),e}();e7._lookupSymbol=new e3("",null);var e8=function(e,t,r){this.type=e,this.typeLexeme=t,this.arraySpecifier=r},te=function(e,t,r,n){void 0===n&&(n=!1),this.typeInfo=e,this.ident=t,this.mrtIndex=r,this.isInMacroBranch=n};function tt(e){return function(t){t.prototype.nt=e,t.pool=eG.createObjectPool(t)}}var tr=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(t,n){this._location=t,this._children=n;for(var i,a=c(n);!(i=a()).done;){var o=i.value;r(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=eP||(eP={}))._unwrapToken=function(e){if(r(e,eF))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 i(t,e),t}(tr),m.TrivialNode=S,S=l([tt(eQ._ignore)],S),v=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.semanticAnalyze=function(e){e.pushScope()},t}(tr),m.ScopeBrace=v,v=l([tt(eQ.scope_brace)],v),g=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.semanticAnalyze=function(e){e.popScope()},t}(tr),m.ScopeEndBrace=g,g=l([tt(eQ.scope_end_brace)],g),y=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var r=t.prototype;return r.init=function(){this.isFragReturnStatement=!1},r.semanticAnalyze=function(e){m._unwrapToken(this.children[0]).type===eV.RETURN&&(e.curFunctionInfo.returnStatement=this)},r.codeGen=function(e){return this.setCache(e.visitJumpStatement(this))},t}(tr),m.JumpStatement=y,y=l([tt(eQ.jump_statement)],y),E=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(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}(tr),m.ExpressionAstNode=E,C=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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 e8(i.type,a.lexeme,this.arraySpecifier),c=r[3];t=new e5(o.lexeme,s,!1,c)}else{var l=r[2];this.arraySpecifier=l;var u=new e8(i.type,a.lexeme,this.arraySpecifier),p=r[4];t=new e5(o.lexeme,u,!1,p)}e.symbolTableStack.insert(t)},r.codeGen=function(e){return this.setCache(e.visitSingleDeclaration(this))},t}(tr),m.SingleDeclaration=C,C=l([tt(eQ.single_declaration)],C),x=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(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}(tr),m.FullySpecifiedType=x,x=l([tt(eQ.fully_specified_type)],x),A=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(tr),m.TypeQualifier=A,A=l([tt(eQ.type_qualifier)],A),T=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];r(t,eF)?this.qualifier=t.type:this.qualifier=t.qualifier,this.lexeme=t.lexeme},t}(tr),m.SingleTypeQualifier=T,T=l([tt(eQ.single_type_qualifier)],T),b=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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}(tr),m.TypeSpecifier=b,b=l([tt(eQ.type_specifier)],b),O=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[1];this.size=t.value},t}(tr),m.ArraySpecifier=O,O=l([tt(eQ.array_specifier)],O),I=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];switch(this.lexeme=t.lexeme,t.type){case eD.PLUS:this.compute=function(e,t){return e+t};break;case eD.DASH:this.compute=function(e,t){return e-t};break;case eD.STAR:this.compute=function(e,t){return e*t};break;case eD.SLASH:this.compute=function(e,t){return e/t};break;case eD.PERCENT:this.compute=function(e,t){return e%t};break;default:e.reportError(t.location,"not implemented operator "+t.lexeme)}},t}(tr),m.IntegerConstantExpressionOperator=I,I=l([tt(eQ.integer_constant_expression_operator)],I),L=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.init=function(){this.value=void 0},n.semanticAnalyze=function(e){if(1===this.children.length){var t=this.children[0];r(t,eF)&&(this.value=Number(t.lexeme))}},t}(tr),m.IntegerConstantExpression=L,L=l([tt(eQ.integer_constant_expression)],L),R=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.init=function(){var e=this.children[0];r(e,eF)?this.type=e.lexeme:this.type=e.type,this.lexeme=e.lexeme},t}(tr),m.TypeSpecifierNonArray=R,R=l([tt(eQ.type_specifier_nonarray)],R),P=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.init=function(){var e=this.children[0];this.type=e.type,this.lexeme=e.lexeme},t}(tr),m.ExtBuiltinTypeSpecifierNonArray=P,P=l([tt(eQ.ext_builtin_type_specifier_nonarray)],P),M=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(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 e8(a.type,a.lexeme,o)}else{var s=r[0];this.typeInfo=s.typeInfo}if(3===n||5===n)t=new e5(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 e5(r[2].lexeme,c,!1,this),e.symbolTableStack.insert(t)}},t}(tr),m.InitDeclaratorList=M,M=l([tt(eQ.init_declarator_list)],M),N=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.idList=[],t}i(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}(tr),m.IdentifierList=N,N=l([tt(eQ.identifier_list)],N),D=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.codeGen=function(e){return this.setCache(e.visitDeclaration(this))},t}(tr),m.Declaration=D,D=l([tt(eQ.declaration)],D),V=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(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}(tr),m.FunctionProtoType=V,V=l([tt(eQ.function_prototype)],V),G=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(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}(tr),m.FunctionDeclarator=G,G=l([tt(eQ.function_declarator)],G),F=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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}(tr),m.FunctionHeader=F,F=l([tt(eQ.function_header)],F),k=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.parameterInfoList=[],t.paramSig=[],t}i(t,e);var n=t.prototype;return n.init=function(){this.parameterInfoList.length=0,this.paramSig.length=0},n.semanticAnalyze=function(e){var n=this.children,i=this.parameterInfoList,a=this.paramSig;if(r(n[0],w)){var o,s,c=n[0];i.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(r(n[2],w)){var l,u,p=n[0],_=n[2];i.push.apply(i,[].concat(p.parameterInfoList,[{ident:_.ident,typeInfo:_.typeInfo,astNode:_}])),a.push.apply(a,[].concat(p.paramSig,[null!=(u=null==(l=_.typeInfo)?void 0:l.type)?u:3e3]))}else r(n[0],t)&&r(n[1],W)?(i.push.apply(i,[].concat(n[0].parameterInfoList,[{astNode:n[1]}])),a.push.apply(a,[].concat(n[0].paramSig,[3e3]))):r(n[0],W)&&(i.push({astNode:n[0]}),a.push(3e3))},n.codeGen=function(e){return this.setCache(e.visitFunctionParameterList(this))},t}(tr),m.FunctionParameterList=k,k=l([tt(eQ.function_parameter_list)],k),B=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(tr),m.MacroParamCaseList=B,B=l([tt(eQ.macro_param_case_list)],B),W=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(tr),m.MacroParamBlock=W,W=l([tt(eQ.macro_param_block)],W),U=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(tr),m.MacroParameterBranch=U,U=l([tt(eQ.macro_parameter_branch)],U),w=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.init=function(){this.typeInfo=void 0,this.ident=void 0},n.semanticAnalyze=function(e){var t,n=this.children;if(r(n[0],H)?t=n[0]:r(n[1],H)&&(t=n[1]),t){this.typeInfo=t.typeInfo,this.ident=t.ident;var i=new e5(t.ident.lexeme,t.typeInfo,!1,t);e.symbolTableStack.insert(i)}},t}(tr),m.ParameterDeclaration=w,w=l([tt(eQ.parameter_declaration)],w),H=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(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 e8(r.type,r.lexeme,n)},t}(tr),m.ParameterDeclarator=H,H=l([tt(eQ.parameter_declarator)],H),j=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(tr),m.CompoundStatementNoScope=j,j=l([tt(eQ.compound_statement_no_scope)],j),z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.codeGen=function(e){return this.setCache(e.visitStatementList(this))},t}(tr),m.StatementList=z,z=l([tt(eQ.statement_list)],z),q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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 e4(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===eV.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}(tr),m.FunctionDefinition=q,q=l([tt(eQ.function_definition)],q),X=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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([tt(eQ.function_call)],X),Q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.init=function(){e.prototype.init.call(this),this.fnSymbol=void 0},n.semanticAnalyze=function(e){var t=this.children[0];if(t.isBuiltin)this.type=t.ident;else{var n,i,a=t.ident;if(4===this.children.length){var o=this.children[2];r(o,Y)&&(i=o.paramSig)}var s=e7._lookupSymbol;s.set(a,e1.FN,void 0,void 0,i);var c=e.symbolTableStack.lookup(s,!0);if(!c)return;this.type=null==c?void 0:null==(n=c.dataType)?void 0:n.type,this.fnSymbol=c}},t}(E),m.FunctionCallGeneric=Q,Q=l([tt(eQ.function_call_generic)],Q),Y=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.paramSig=[],t.paramNodes=[],t}i(t,e);var n=t.prototype;return n.init=function(){this.paramSig.length=0,this.paramNodes.length=0},n.semanticAnalyze=function(e){var n=this.children,i=this.paramSig,a=this.paramNodes;if(r(n[0],et)){var o=n[0];i.push(o.type),a.push(o)}else if(r(n[2],et)){var s=n[0],c=n[2];i.push.apply(i,[].concat(s.paramSig,[c.type])),a.push.apply(a,[].concat(s.paramNodes,[c]))}else r(n[0],t)&&r(n[1],J)?(i.push.apply(i,[].concat(n[0].paramSig,[3e3])),a.push.apply(a,[].concat(n[0].paramNodes,[n[1]]))):r(n[0],J)&&(i.push(3e3),a.push(n[0]))},t}(tr),m.FunctionCallParameterList=Y,Y=l([tt(eQ.function_call_parameter_list)],Y),K=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(tr),m.MacroCallArgCaseList=K,K=l([tt(eQ.macro_call_arg_case_list)],K),J=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(tr),m.MacroCallArgBlock=J,J=l([tt(eQ.macro_call_arg_block)],J),Z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(tr),m.MacroCallArgBranch=Z,Z=l([tt(eQ.macro_call_arg_branch)],Z),$=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.semanticAnalyze=function(e){e.symbolTableStack.isInMacroBranch||e.shaderData.globalPrecisions.push(this)},t}(tr),m.PrecisionSpecifier=$,$=l([tt(eQ.precision_specifier)],$),ee=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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}(tr),m.FunctionIdentifier=ee,ee=l([tt(eQ.function_identifier)],ee),et=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(E),m.AssignmentExpression=et,et=l([tt(eQ.assignment_expression)],et),er=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(E),m.Expression=er,er=l([tt(eQ.expression)],er),en=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t,n=this.children[0];if(r(n,ed))this.type=null!=(t=n.typeInfo)?t:3e3;else switch(n.type){case eD.INT_CONSTANT:this._type=eV.INT;break;case eD.FLOAT_CONSTANT:this.type=eV.FLOAT;break;case eV.True:case eV.False:this.type=eV.BOOL}}else{var i=this.children[1];this.type=i.type}},t}(E),m.PrimaryExpression=en,en=l([tt(eQ.primary_expression)],en),ei=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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([tt(eQ.postfix_expression)],ei),ea=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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 e9(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}(tr),m.StructSpecifier=ea,ea=l([tt(eQ.struct_specifier)],ea),eo=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.propList=[],t.macroExpressions=[],t}i(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}(tr),m.StructDeclarationList=eo,eo=l([tt(eQ.struct_declaration_list)],eo),es=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}i(t,e);var n=t.prototype;return n.init=function(){this._typeSpecifier=void 0,this._declaratorList=void 0,this.props.length=0,this.macroExpressions.length=0},n.semanticAnalyze=function(e){var t=this.children,n=this.props,i=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,n.push(o[s]);i.push.apply(i,[].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,_=u.lexeme,h=e.symbolTableStack.isInMacroBranch;if(r(l,eu)){var f=t[2],d=new te(new e8(p,_),f.ident,l.index,h);n.push(d)}else{var m=this._declaratorList.declaratorList,S=m.length;n.length=S;for(var v=0;v<S;v++){var g=m[v],y=new te(new e8(p,_,g.arraySpecifier),g.ident,void 0,h);n[v]=y}}},t}(tr),m.StructDeclaration=es,es=l([tt(eQ.struct_declaration)],es),ec=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}i(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}(tr),m.MacroStructDeclaration=ec,ec=l([tt(eQ.macro_struct_declaration)],ec),el=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}i(t,e);var n=t.prototype;return n.init=function(){this.props.length=0,this.macroExpressions.length=0},n.semanticAnalyze=function(){var e,n,i,a,o=this.children,s=o[o.length-1];this.macroExpressions.push(o[0]),r(o[1],eo)&&((e=this.props).push.apply(e,[].concat(o[1].propList)),(n=this.macroExpressions).push.apply(n,[].concat(o[1].macroExpressions))),r(s,t)&&((i=this.props).push.apply(i,[].concat(s.props)),(a=this.macroExpressions).push.apply(a,[].concat(s.macroExpressions))),o.length>1&&r(s,ey)&&this.macroExpressions.push(s)},t}(tr),m.MacroStructBranch=el,el=l([tt(eQ.macro_struct_branch)],el),eu=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.semanticAnalyze=function(e){this.index=Number(this.children[4].lexeme)},t}(tr),m.LayoutQualifier=eu,eu=l([tt(eQ.layout_qualifier)],eu),ep=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.declaratorList=[],t}i(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}(tr),m.StructDeclaratorList=ep,ep=l([tt(eQ.struct_declarator_list)],ep),e_=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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}(tr),m.StructDeclarator=e_,e_=l([tt(eQ.struct_declarator)],e_),eh=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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 e5(n.lexeme,new e8(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}(tr),m.VariableDeclaration=eh,eh=l([tt(eQ.variable_declaration)],eh),ef=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.variableDeclarations=[],t}i(t,e);var n=t.prototype;return n.init=function(){this.variableDeclarations.length=0},n.semanticAnalyze=function(e){var t=this.children,n=t.length,i=t[0],a=i.type;if(this.type=a,r(i,eh))this.variableDeclarations.push(i);else{(o=this.variableDeclarations).push.apply(o,[].concat(i.variableDeclarations));var o,s=t[2],c=eh.pool.get();3===n?c.set(s.location,[a,s]):c.set(s.location,[a,s,t[3]]),c.semanticAnalyze(e),this.variableDeclarations.push(c)}},t}(tr),m.VariableDeclarationList=ef,ef=l([tt(eQ.variable_declaration_list)],ef),ed=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.referenceGlobalSymbolNames=[],t._symbols=[],t}i(t,e);var n=t.prototype;return n.init=function(){this.typeInfo=3e3,this.referenceGlobalSymbolNames.length=0,this._symbols.length=0},n.semanticAnalyze=function(e){var t=this.children[0],n=this.referenceGlobalSymbolNames,i=this._symbols,a=e7._lookupSymbol;l=r(t,eF)?[t.lexeme]:t.referenceSymbolNames;for(var o=0;o<l.length;o++){var s=l[o];if(!(e.macroDefineList[s]||!r(t,eF)&&ez.isExist(s))){var c=eX.getVar(s);if(c){this.typeInfo=c.type;continue}if(a.set(s,e1.Any),e.symbolTableStack.lookupAll(a,!0,i),i.length){this.typeInfo=null==(u=i[0].dataType)?void 0:u.type;var l,u,p=e.symbolTableStack.scope.getSymbol(a,!0);p?(r(p,e4)||p.isGlobalVariable)&&-1===n.indexOf(s)&&n.push(s):i.some(function(e){return r(e,e4)||e.isGlobalVariable})&&-1===n.indexOf(s)&&n.push(s)}}}},n.codeGen=function(e){return this.setCache(e.visitVariableIdentifier(this))},n.getLexeme=function(e){var t=this.children[0];return r(t,eF)?t.lexeme:t.codeGen(e)},t}(tr),m.VariableIdentifier=ed,ed=l([tt(eQ.variable_identifier)],ed),em=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.semanticAnalyze=function(e){this.shaderData=e.shaderData,this.shaderData.symbolTable=e.symbolTableStack.scope},t}(tr),m.GLShaderProgram=em,em=l([tt(eQ.gs_shader_program)],em),eS=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}i(t,e);var n=t.prototype;return n.init=function(){this.macroExpressions.length=0},n.semanticAnalyze=function(e){var t,n=this.children[0];(r(n,ev)||r(n,eA)||r(n,eF))&&(e.shaderData.globalMacroDeclarations.push(this),r(n,eA)?(t=this.macroExpressions).push.apply(t,[].concat(n.macroExpressions)):this.macroExpressions.push(n))},t}(tr),m.GlobalDeclaration=eS,eS=l([tt(eQ.global_declaration)],eS),ev=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.codeGen=function(t){return this.setCache(e.prototype.codeGen.call(this,t)+"\n")},t}(tr),m.MacroUndef=ev,ev=l([tt(eQ.macro_undef)],ev),eg=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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}(tr),m.MacroPushContext=eg,eg=l([tt(eQ.macro_push_context)],eg),ey=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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}(tr),m.MacroPopContext=ey,ey=l([tt(eQ.macro_pop_context)],ey),eE=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tr),m.MacroElifExpression=eE,eE=l([tt(eQ.macro_elif_expression)],eE),eC=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tr),m.MacroElseExpression=eC,eC=l([tt(eQ.macro_else_expression)],eC),ex=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}i(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}(tr),m.GlobalMacroDeclaration=ex,ex=l([tt(eQ.global_macro_declaration)],ex),eA=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}i(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}(tr),m.GlobalMacroIfStatement=eA,eA=l([tt(eQ.global_macro_if_statement)],eA),eT=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}i(t,e);var n=t.prototype;return n.init=function(){this.macroExpressions.length=0},n.semanticAnalyze=function(e){var n=this.children,i=n[n.length-1],a=this.macroExpressions;a.push(n[0]),r(n[1],ex)&&a.push.apply(a,[].concat(n[1].macroExpressions)),r(i,t)&&a.push.apply(a,[].concat(i.macroExpressions)),n.length>1&&r(i,ey)&&a.push(i)},t}(tr),m.GlobalMacroBranch=eT,eT=l([tt(eQ.global_macro_branch)],eT),eb=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(tr),m.MacroIfStatement=eb,eb=l([tt(eQ.macro_if_statement)],eb),eO=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(tr),m.MacroBranch=eO,eO=l([tt(eQ.macro_branch)],eO),eI=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.referenceSymbolNames=[],t}i(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,eB.getReferenceSymbolNames(e.macroDefineList,t,this.referenceSymbolNames)},t}(tr),m.MacroCallSymbol=eI,eI=l([tt(eQ.macro_call_symbol)],eI),eL=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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}(tr),m.MacroCallFunction=eL,l([tt(eQ.macro_call_function)],eL);var tn=/*#__PURE__*/function(){function e(){}return e.unwrapNodeByType=function(t,n){var i=t.children[0];if(!r(i,eF))return i.nt===n?i:e.unwrapNodeByType(i,n)},e.isTerminal=function(e){return e<eQ.START},e}(),ti=/*#__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 eG.createGSError("referenced attribute not found: "+t,e0.CompilationError,tR._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 eG.createGSError("referenced varying not found: "+t,e0.CompilationError,tR._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 eG.createGSError("referenced mrt not found: "+t,e0.CompilationError,tR._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}();ti._lookupSymbol=new e3("",null);var ta=/*#__PURE__*/function(){function e(){this.array=[]}return e.prototype.dispose=function(){this.array.length=0},e}(),to=/*#__PURE__*/function(){function e(){}var n=e.prototype;return n.defaultCodeGen=function(t){var n=e._tmpArrayPool,i=n.get();i.dispose();for(var a,o=c(t);!(a=o()).done;){var s=a.value;r(s,eF)?i.array.push(s.lexeme):i.array.push(s.codeGen(this))}return n.return(i),i.array.join(" ")},n.visitPostfixExpression=function(e){var t=e.children,n=t.length,i=ti.context;if(3===n){var a=t[0],o=t[2];return r(o,eF)?i.isAttributeStruct(a.type)?(i.referenceAttribute(o),o.lexeme):i.isVaryingStruct(a.type)?(i.referenceVarying(o),o.lexeme):i.isMRTStruct(a.type)?(i.referenceMRTProp(o),o.lexeme):a.codeGen(this)+"."+o.lexeme:a.codeGen(this)+"."+o.codeGen(this)}if(4===n){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)},n.visitVariableIdentifier=function(e){for(var t,r=c(e.referenceGlobalSymbolNames);!(t=r()).done;){var n=t.value;ti.context.referenceGlobal(n,e1.Any)}return e.getLexeme(this)},n.visitFunctionCall=function(e){var t=e.children[0];if(r(t.fnSymbol,e4)){ti.context.referenceGlobal(t.fnSymbol.ident,e1.FN);var n=t.children[2];if(r(n,eP.FunctionCallParameterList)){for(var i=n.paramNodes,a=t.fnSymbol.astNode.protoType.parameterList,o=i.filter(function(e,t){var r,n=null==a?void 0:null==(r=a[t])?void 0:r.typeInfo;return!n||!ti.context.isAttributeStruct(n.typeLexeme)&&!ti.context.isVaryingStruct(n.typeLexeme)&&!ti.context.isMRTStruct(n.typeLexeme)}),s="",c=0,l=o.length;c<l;c++){var u=o[c],p=u.codeGen(this);r(u,eP.MacroCallArgBlock)||0===c?s+=p:s+=", "+p}return t.fnSymbol.ident+"("+s+")"}}return this.defaultCodeGen(e.children)},n.visitMacroCallFunction=function(e){var t=e.children[2];if(!r(t,eP.FunctionCallParameterList))return this.defaultCodeGen(e.children);for(var n=t.paramNodes.filter(function(e){if(r(e,eP.AssignmentExpression)){var t=tn.unwrapNodeByType(e,eQ.variable_identifier);if(t&&"string"==typeof t.typeInfo&&(ti.context.isAttributeStruct(t.typeInfo)||ti.context.isVaryingStruct(t.typeInfo)||ti.context.isMRTStruct(t.typeInfo)))return!1}return!0}),i="",a=0,o=n.length;a<o;a++){var s=n[a],c=s.codeGen(this);r(s,eP.MacroCallArgBlock)||0===a?i+=c:i+=", "+c}return e.macroName+"("+i+")"},n.visitStatementList=function(e){var t=e.children;return 1===t.length?t[0].codeGen(this):t[0].codeGen(this)+"\n"+t[1].codeGen(this)},n.visitSingleDeclaration=function(e){var t=e.typeSpecifier.type;return"string"==typeof t&&ti.context.referenceGlobal(t,e1.STRUCT),this.defaultCodeGen(e.children)},n.visitGlobalVariableDeclaration=function(e){var t=e.children,n=t[0];return r(n,eP.FullySpecifiedType)&&n.typeSpecifier.isCustom&&ti.context.referenceGlobal(n.type,e1.STRUCT),"uniform "+this.defaultCodeGen(t)},n.visitDeclaration=function(e){var t=ti.context,n=e.children,i=n[0];if(r(i,eP.InitDeclaratorList)){var a=i.typeInfo.typeLexeme;if(t.isVaryingStruct(a)||t.isMRTStruct(a))return""}return this.defaultCodeGen(n)},n.visitFunctionParameterList=function(e){for(var t=e.parameterInfoList.filter(function(e){return!e.typeInfo||!ti.context.isAttributeStruct(e.typeInfo.typeLexeme)&&!ti.context.isVaryingStruct(e.typeInfo.typeLexeme)&&!ti.context.isMRTStruct(e.typeInfo.typeLexeme)}),n="",i=0,a=t.length;i<a;i++){var o=t[i].astNode,s=o.codeGen(this);r(o,eP.MacroParamBlock)||0===i?n+=s:n+=", "+s}return n},n.visitFunctionHeader=function(e){var t=e.returnType.typeSpecifier.lexeme;return ti.context.isVaryingStruct(t)?"void "+e.ident.lexeme+"(":this.defaultCodeGen(e.children)},n.visitJumpStatement=function(e){var t=e.children;if(t[0].type===eV.RETURN){var n=t[1];if(r(n,eP.Expression)){var i=tn.unwrapNodeByType(n,eQ.variable_identifier);if(ti.context.isVaryingStruct(null==i?void 0:i.typeInfo))return"";var a=tn.unwrapNodeByType(n,eQ.function_call);if(ti.context.isVaryingStruct(null==a?void 0:a.type))return""+n.codeGen(this)+";"}}return this.defaultCodeGen(t)},n.visitFunctionIdentifier=function(e){return this.defaultCodeGen(e.children)},n.visitStructSpecifier=function(e){var t=this,n=ti.context,i=n.varyingStructs,a=n.attributeStructs,o=n.mrtStructs,s=-1!==i.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:r(e,eF)?e.lexeme:e.codeGen(t),index:e.location.start.index}})));for(var _,h=c(e.propList);!(_=h()).done;){var f,d,m,S=_.value,v=S.ident.lexeme;s&&(null==(f=n._referencedVaryingList[v])?void 0:f.indexOf(S))>=0?p.push({text:""+this.getVaryingProp(S)+"\n",index:S.ident.location.start.index}):l&&(null==(d=n._referencedAttributeList[v])?void 0:d.indexOf(S))>=0?p.push({text:""+this.getAttributeProp(S)+"\n",index:S.ident.location.start.index}):u&&(null==(m=n._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("")},n.visitFunctionDefinition=function(e){return e.protoType.ident.lexeme==ti.context.stageEntry?"void main() "+e.statements.codeGen(this):this.defaultCodeGen(e.children)},n._reportError=function(e,r){t.Logger.error(r)},e}();to._tmpArrayPool=new t.ReturnableObjectPool(ta,10);var ts=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._globalCodeArray=[],t}i(t,e);var n=t.prototype;return n.reset=function(){this._globalCodeArray.length=0,t._serializedGlobalKey.clear()},n.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})}},n.visitShaderProgram=function(e,t,r){ti.reset(),this.reset();var n=e.shaderData;ti.context._passSymbolTable=n.symbolTable;var i=n.getOuterGlobalMacroDeclarations();return{vertex:this._vertexMain(t,n,i),fragment:this._fragmentMain(r,n,i)}},n._vertexMain=function(e,r,n){var i=this,a=ti.context;a.stage=ew.VERTEX,a.stageEntry=e;var o=t._lookupSymbol,s=r.symbolTable;o.set(e,e1.FN);var l=s.getSymbols(o,!0,[]);if(!l.length)throw"no entry function found: "+e;var u=a.attributeStructs,p=a.attributeList,_=a.varyingStructs,h=a.varyingList;l.forEach(function(e){var t=e.astNode,r=t.protoType.returnType;if("string"==typeof r.type){o.set(r.type,e1.STRUCT);var n=s.getSymbols(o,!0,[]);if(n.length)for(var a=0;a<n.length;a++){var l=n[a].astNode;_.push(l);for(var f,d=c(l.propList);!(f=d()).done;){var m=f.value;h.push(m)}}else i._reportError(r.location,'invalid varying struct: "'+r.type+'".')}else r.type!==eV.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,e1.STRUCT);var y=s.getSymbols(o,!0,[]);if(y.length)for(var E=0;E<y.length;E++){var C=y[E].astNode;u.push(C);for(var x,A=c(C.propList);!(x=A()).done;){var T=x.value;p.push(T)}}else i._reportError(v.astNode.location,'invalid attribute struct: "'+g+'".')}}});var f=this._globalCodeArray;ti.context.referenceGlobal(e,e1.FN),this._getGlobalSymbol(f),this._getCustomStruct(a.attributeStructs,f),this._getCustomStruct(a.varyingStructs,f),this._getGlobalMacroDeclarations(n,f),this.getOtherGlobal(r,f);var d=f.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return ti.context.reset(!1),this.reset(),d},n._fragmentMain=function(e,r,n){var i=this,a=ti.context;a.stage=ew.FRAGMENT,a.stageEntry=e;var o=t._lookupSymbol,s=r.symbolTable;o.set(e,e1.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,e1.STRUCT);var p=s.getSymbols(o,!0,[]);if(p.length)for(var _=0;_<p.length;_++){var h=p[_].astNode;a.mrtStructs.push(h);for(var f,d=c(h.propList);!(f=d()).done;){var m=f.value;a.mrtList.push(m)}}else i._reportError(u,"invalid mrt struct: "+l)}else l!==eV.VOID&&l!==eV.VEC4&&i._reportError(u,"fragment main entry can only return struct or vec4.")});var u=this._globalCodeArray;ti.context.referenceGlobal(e,e1.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},n._getGlobalSymbol=function(e){var r=ti.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===e1.VAR?";":"");s.isInMacroBranch||e.push({text:c,index:s.astNode.location.start.index})}}Object.keys(r).length!==n&&this._getGlobalSymbol(e)}},n._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})}},n._getGlobalMacroDeclarations=function(e,t){var n=this,i=ti.context,a=i._referencedGlobals,o=i._referencedGlobalMacroASTs;o.length=0;for(var s,l=c(Object.values(a));!(s=l()).done;)for(var u,p=s.value,_=c(p);!(u=_()).done;){var h=u.value;h.isInMacroBranch&&o.push(h.astNode)}for(var f,d=c(e);!(f=d()).done;){var m=f.value,S=void 0,v=m.children[0];if(r(v,eP.GlobalMacroIfStatement)){var g=[];g.push.apply(g,[].concat(m.macroExpressions.map(function(e){return{text:r(e,eF)?e.lexeme:e.codeGen(n),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})}},n._visitGlobalMacroIfStatement=function(e,t){for(var n=e.children,i=0;i<n.length;i++){var a=n[i];if(r(a,eP.PrecisionSpecifier))t.push({text:a.codeGen(this),index:a.location.start.index});else if(r(a,eP.FunctionDefinition))-1!==ti.context._referencedGlobalMacroASTs.indexOf(a)&&t.push({text:a.getCache(),index:a.location.start.index});else if(r(a,eP.StructSpecifier)){var o,s,c,l,u=ti.context,p=u.stage;(-1!==ti.context._referencedGlobalMacroASTs.indexOf(a)||(p===ew.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(r(a,eP.VariableDeclarationList))for(var _=a.variableDeclarations,h=0;h<_.length;h++){var f=_[h];-1!==ti.context._referencedGlobalMacroASTs.indexOf(f)&&t.push({text:f.getCache()+";",index:f.location.start.index})}r(a,tr)&&this._visitGlobalMacroIfStatement(a,t)}},t}(to);ts._lookupSymbol=new e3("",null),ts._serializedGlobalKey=new Set;var tc=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.getAttributeProp=function(e){return"attribute "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},n.getVaryingProp=function(e){return"varying "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},n.getMRTProp=function(){return null},n.visitPostfixExpression=function(t){var n=t.children,i=n[0],a=ti.context;if(r(i,eP.PostfixExpression)&&a.isMRTStruct(i.type)){var o=n[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)},n.visitJumpStatement=function(t){return t.isFragReturnStatement?ti.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}(ts),tl="GS_glFragColor",tu=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._otherCodeArray=[],t._fragColorVariableRegistered=!1,t}i(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(ti.context.stage===ew.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=ti.context;if(r.stage===ew.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(),tl}return e.prototype.visitVariableIdentifier.call(this,t)},r.visitJumpStatement=function(t){return t.isFragReturnStatement?ti.context.mrtStructs.length?"":(this._registerFragColorVariable(),tl+" = "+t.children[1].codeGen(this)+";"):e.prototype.visitJumpStatement.call(this,t)},r._registerFragColorVariable=function(){this._fragColorVariableRegistered||(this._otherCodeArray.push({text:"out vec4 "+tl+";",index:0}),this._fragColorVariableRegistered=!0)},t.getVisitor=function(){return this._singleton||(this._singleton=new t),this._singleton},t}(ts),tp=/*#__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),tR.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 eG.createGSError(r.join(" "),e0.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}(),t_=/*#__PURE__*/function(e){function t(t,r){var n;return(n=e.call(this,t)||this).macroDefineList=r,n._needScanMacroConditionExpression=!1,n}i(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,ek]}})},r.scanToken=function(){if(this.skipCommentsAndSpace(),this.isEnd())return ek;if(this._needScanMacroConditionExpression)return this._needScanMacroConditionExpression=!1,this._scanMacroConditionExpression();var e,t=this.getCurCharCode();if(tp.isPreprocessorStartChar(t))return this._scanDirectives();if(tp.isAlpha(t))return this._scanWord();if(tp.isDigit(t))return this._scanNum();var r=this.getShaderPosition(),n=eF.pool.get();switch(this.getCurChar()){case"<":if(this.advance(1),"<"===(e=this.getCurChar())){if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eD.LEFT_ASSIGN,"<<=",r);break}n.set(eD.LEFT_OP,"<<",r);break}if("="===e){this.advance(1),n.set(eD.LE_OP,"<=",r);break}n.set(eD.LEFT_ANGLE,"<",r);break;case">":if(this.advance(1),">"===(e=this.getCurChar())){if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eD.RIGHT_ASSIGN,">>=",r);break}n.set(eD.RIGHT_OP,">>",r);break}if("="===e){this.advance(1),n.set(eD.GE_OP,">=",r);break}n.set(eD.RIGHT_ANGLE,">",r);break;case"+":if(this.advance(1),"+"===(e=this.getCurChar())){this.advance(1),n.set(eD.INC_OP,"++",r);break}if("="===e){this.advance(1),n.set(eD.ADD_ASSIGN,"+=",r);break}n.set(eD.PLUS,"+",r);break;case"-":if(this.advance(1),"-"===(e=this.getCurChar())){this.advance(1),n.set(eD.DEC_OP,"--",r);break}if("="===e){this.advance(1),n.set(eD.SUB_ASSIGN,"-=",r);break}n.set(eD.DASH,"-",r);break;case"=":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eD.EQ_OP,"==",r);break}n.set(eD.EQUAL,"=",r);break;case"!":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eD.NE_OP,"!=",r);break}n.set(eD.BANG,"!",r);break;case"&":if(this.advance(1),"&"===(e=this.getCurChar())){this.advance(1),n.set(eD.AND_OP,"&&",r);break}if("="===e){this.advance(1),n.set(eD.ADD_ASSIGN,"&=",r);break}n.set(eD.AMPERSAND,"&",r);break;case"|":if(this.advance(1),"|"===(e=this.getCurChar())){this.advance(1),n.set(eD.OR_OP,"||",r);break}if("="===e){this.advance(1),n.set(eD.OR_ASSIGN,"|=",r);break}n.set(eD.VERTICAL_BAR,"|",r);break;case"^":if(this.advance(1),"^"===(e=this.getCurChar())){this.advance(1),n.set(eD.XOR_OP,"^^",r);break}if("="===e){this.advance(1),n.set(eD.XOR_ASSIGN,"^=",r);break}n.set(eD.CARET,"^",r);break;case"*":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eD.MUL_ASSIGN,"*=",r);break}n.set(eD.STAR,"*",r);break;case"/":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eD.DIV_ASSIGN,"/=",r);break}n.set(eD.SLASH,"/",r);break;case"%":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eD.MOD_ASSIGN,"%=",r);break}n.set(eD.PERCENT,"%",r);break;case"(":this.advance(1),n.set(eD.LEFT_PAREN,"(",r);break;case")":this.advance(1),n.set(eD.RIGHT_PAREN,")",r);break;case"{":this.advance(1),n.set(eD.LEFT_BRACE,"{",r);break;case"}":this.advance(1),n.set(eD.RIGHT_BRACE,"}",r);break;case"[":this.advance(1),n.set(eD.LEFT_BRACKET,"[",r);break;case"]":this.advance(1),n.set(eD.RIGHT_BRACKET,"]",r);break;case".":if(this.advance(1),tp.isDigit(this.getCurCharCode()))return this._scanNumAfterDot();n.set(eD.DOT,".",r);break;case",":this.advance(1),n.set(eD.COMMA,",",r);break;case":":this.advance(1),n.set(eD.COLON,":",r);break;case";":this.advance(1),n.set(eD.SEMICOLON,";",r);break;case"~":this.advance(1),n.set(eD.TILDE,"~",r);break;case"?":this.advance(1),n.set(eD.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=tR.createRange(e,this.getShaderPosition()),n=eF.pool.get();return n.set(eD.STRING_CONST,t.join(""),r),n},r._scanNumAfterDot=function(){for(var e=["."];tp.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(e);var t=eF.pool.get();return t.set(eD.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);tp.isAlpha(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=eF.pool.get(),i=e.join("");if("#define"===i){this._scanUtilBreakLine(e);var a=e.join("")+"\n";n.set(eV.MACRO_DEFINE_EXPRESSION,a,r)}else{var o=t._lexemeTable[i];n.set(null!=o?o:eD.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=eF.pool.get();return n.set(eV.MACRO_CONDITIONAL_EXPRESSION,r,t),n},r._scanWord=function(){var e=[this.getCurChar()],r=this.getShaderPosition();for(this.advance(1);tp.isAlnum(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=eF.pool.get(),i=e.join(""),a=t._lexemeTable[i];return this.macroDefineList[i]?n.set(eV.MACRO_CALL,i,r):n.set(null!=a?a:eD.ID,i,r),n},r._scanNum=function(){for(var e=[];tp.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var t=this.getCurChar();if("."===t){for(e.push(t),this.advance(1);tp.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(e);var r=eF.pool.get();return r.set(eD.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),r}if("e"===t||"E"===t){this._scanFloatSuffix(e);var n=eF.pool.get();return n.set(eD.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),n}this._scanIntegerSuffix(e);var i=eF.pool.get();return i.set(eD.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()),tp.isDigit(this.getCurCharCode())||this.throwError(this.getShaderPosition(0),"lexing error, invalid exponent suffix.");do e.push(t),this.advance(1),t=this.getCurChar();while(tp.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}(tp);t_._lexemeTable={const:eV.CONST,bool:eV.BOOL,float:eV.FLOAT,double:eV.DOUBLE,int:eV.INT,uint:eV.UINT,break:eV.BREAK,continue:eV.CONTINUE,do:eV.DO,else:eV.ELSE,for:eV.FOR,if:eV.IF,while:eV.WHILE,discard:eV.DISCARD,return:eV.RETURN,bvec2:eV.BVEC2,bvec3:eV.BVEC3,bvec4:eV.BVEC4,ivec2:eV.IVEC2,ivec3:eV.IVEC3,ivec4:eV.IVEC4,uvec2:eV.UVEC2,uvec3:eV.UVEC3,uvec4:eV.UVEC4,vec2:eV.VEC2,vec3:eV.VEC3,vec4:eV.VEC4,mat2:eV.MAT2,mat3:eV.MAT3,mat4:eV.MAT4,in:eV.IN,out:eV.OUT,inout:eV.INOUT,sampler2D:eV.SAMPLER2D,samplerCube:eV.SAMPLER_CUBE,sampler3D:eV.SAMPLER3D,sampler2DShadow:eV.SAMPLER2D_SHADOW,samplerCubeShadow:eV.SAMPLER_CUBE_SHADOW,sampler2DArray:eV.SAMPLER2D_ARRAY,sampler2DArrayShadow:eV.SAMPLER2D_ARRAY_SHADOW,isampler2D:eV.I_SAMPLER2D,isampler3D:eV.I_SAMPLER3D,isamplerCube:eV.I_SAMPLER_CUBE,isampler2DArray:eV.I_SAMPLER2D_ARRAY,usampler2D:eV.U_SAMPLER2D,usampler3D:eV.U_SAMPLER3D,usamplerCube:eV.U_SAMPLER_CUBE,usampler2DArray:eV.U_SAMPLER2D_ARRAY,struct:eV.STRUCT,void:eV.VOID,true:eV.True,false:eV.False,precision:eV.PRECISION,precise:eV.PRECISE,highp:eV.HIGHP,mediump:eV.MEDIUMP,lowp:eV.LOWP,invariant:eV.INVARIANT,flat:eV.FLAT,smooth:eV.SMOOTH,noperspective:eV.NOPERSPECTIVE,centroid:eV.CENTROID,layout:eV.LAYOUT,location:eV.LOCATION,"#if":eV.MACRO_IF,"#ifdef":eV.MACRO_IFDEF,"#ifndef":eV.MACRO_IFNDEF,"#else":eV.MACRO_ELSE,"#elif":eV.MACRO_ELIF,"#endif":eV.MACRO_ENDIF,"#undef":eV.MACRO_UNDEF};var th={Text:0,IfDef:1,IfNdef:2,IfCmp:3,IfExpr:4,Else:5,Endif:6,Define:7,DefineVal:8,DefineFunc:9,Undef:10},tf=/*#__PURE__*/function(){function e(){}return e.parse=function(t){for(var r=[],n=t.length,i=0,a=[];i<n;){var o=e._findDirectiveStart(t,i,n);if(-1===o){e._pushText(r,t,i,n);break}o>i&&e._pushText(r,t,i,o);var s=t.indexOf("\n",o);-1===s&&(s=n);var c=t.substring(o,s);i=s<n?s+1:n;var l=e._DIRECTIVE_RE.exec(c);if(!l){var u=r.length>0?r[r.length-1]:null,p=s<n?c+"\n":c;u&&u[0]===th.Text?u[1]+=p:r.push([th.Text,p]);continue}var _=l[1],h=l[2].trim();switch(_){case"ifdef":var f=r.length;r.push([th.IfDef,h,-1]),a.push([f]);break;case"ifndef":var d=r.length;r.push([th.IfNdef,h,-1]),a.push([d]);break;case"if":var m=e._parseCondition(h),S=r.length;e._pushConditionInstruction(r,m),a.push([S]);break;case"elif":var v=a[a.length-1],g=v[v.length-1],y=r.length;r.push([th.Else,-1]),v.push(y),e._backfillJump(r[g],r.length);var E=e._parseCondition(h),C=r.length;e._pushConditionInstruction(r,E),v.push(C);break;case"else":var x=a[a.length-1],A=x[x.length-1],T=r.length;r.push([th.Else,-1]),x.push(T),e._backfillJump(r[A],r.length);break;case"endif":var b=r.length;r.push([th.Endif]);var O=a.pop();if(O)for(var I=b+1,L=0;L<O.length;L++){var R=r[O[L]];R[0]===th.Else?R[1]=I:e._backfillJump(R,I,!0)}break;case"define":var P=e._FUNC_MACRO_RE.exec(h);if(P){var M=P[2].split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0});r.push([th.DefineFunc,P[1],M,e._stripLineComment(P[3].trim())])}else{var N=h.indexOf(" ");-1===N?r.push([th.Define,h]):r.push([th.DefineVal,h.substring(0,N),e._stripLineComment(h.substring(N+1).trim())])}break;case"undef":r.push([th.Undef,h])}}return r},e._pushConditionInstruction=function(e,t){"def"===t.t?e.push([th.IfDef,t.m,-1]):"ndef"===t.t?e.push([th.IfNdef,t.m,-1]):"cmp"===t.t?e.push([th.IfCmp,t.m,t.op,t.v,-1]):e.push([th.IfExpr,t,-1])},e._findDirectiveStart=function(e,t,r){for(var n=t;n<r;){for(var i=n;i<r;){var a=e.charCodeAt(i);if(32===a||9===a)i++;else break}if(i<r&&35===e.charCodeAt(i))return n;var o=e.indexOf("\n",n);if(-1===o)break;n=o+1}return -1},e._pushText=function(e,t,r,n){if(!(r>=n)){var i=e.length>0?e[e.length-1]:null;i&&i[0]===th.Text?i[1]+=t.substring(r,n):e.push([th.Text,t.substring(r,n)])}},e._backfillJump=function(e,t,r){void 0===r&&(r=!1);var n=e[0];n===th.IfDef||n===th.IfNdef?r&&-1!==e[2]||(e[2]=t):n===th.IfCmp?r&&-1!==e[4]||(e[4]=t):n!==th.IfExpr||r&&-1!==e[2]||(e[2]=t)},e._stripLineComment=function(e){var t=e.indexOf("//");return t>=0?e.substring(0,t).trimEnd():e},e._parseCondition=function(t){var r={s:t.trim(),i:0};return e._parseOr(r)},e._skipWs=function(e){for(;e.i<e.s.length&&(32===e.s.charCodeAt(e.i)||9===e.s.charCodeAt(e.i));)e.i++},e._parseOr=function(t){var r=e._parseAnd(t);for(e._skipWs(t);t.i<t.s.length-1&&124===t.s.charCodeAt(t.i)&&124===t.s.charCodeAt(t.i+1);)t.i+=2,e._skipWs(t),r={t:"or",l:r,r:e._parseAnd(t)},e._skipWs(t);return r},e._parseAnd=function(t){var r=e._parseUnary(t);for(e._skipWs(t);t.i<t.s.length-1&&38===t.s.charCodeAt(t.i)&&38===t.s.charCodeAt(t.i+1);)t.i+=2,e._skipWs(t),r={t:"and",l:r,r:e._parseUnary(t)},e._skipWs(t);return r},e._parseUnary=function(t){return(e._skipWs(t),33===t.s.charCodeAt(t.i))?(t.i++,e._skipWs(t),{t:"not",c:e._parsePrimary(t)}):e._parsePrimary(t)},e._parsePrimary=function(t){e._skipWs(t);var r=t.s;if(40===r.charCodeAt(t.i)){t.i++,e._skipWs(t);var n=e._parseOr(t);return e._skipWs(t),41===r.charCodeAt(t.i)&&t.i++,n}if("defined"===r.substring(t.i,t.i+7)){t.i+=7,e._skipWs(t);var i=40===r.charCodeAt(t.i);i&&t.i++,e._skipWs(t);var a=e._scanIdentifier(t);return e._skipWs(t),i&&41===r.charCodeAt(t.i)&&t.i++,{t:"def",m:a}}if(t.i<r.length&&e._isDigit(r.charCodeAt(t.i))){var o=e._scanNumber(t);e._skipWs(t);var s=e._scanOp(t);return s?(e._skipWs(t),{t:"bool",v:e._evalNumOp(o,s,e._scanNumber(t))}):{t:"bool",v:0!==o}}var c=e._scanIdentifier(t);if(!c)return{t:"bool",v:!1};e._skipWs(t);var l=e._scanOp(t);return l?(e._skipWs(t),{t:"cmp",m:c,op:l,v:e._scanNumber(t)}):{t:"def",m:c}},e._isDigit=function(e){return e>=48&&e<=57},e._isAlnum=function(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||95===e},e._scanIdentifier=function(t){for(var r=t.i;t.i<t.s.length&&e._isAlnum(t.s.charCodeAt(t.i));)t.i++;return t.s.substring(r,t.i)},e._scanNumber=function(t){var r=t.i;for(45===t.s.charCodeAt(t.i)&&t.i++;t.i<t.s.length&&(e._isDigit(t.s.charCodeAt(t.i))||46===t.s.charCodeAt(t.i));)t.i++;return Number(t.s.substring(r,t.i))||0},e._scanOp=function(e){var t=e.s.charCodeAt(e.i),r=e.i+1<e.s.length?e.s.charCodeAt(e.i+1):0;return 61===t&&61===r?(e.i+=2,"=="):33===t&&61===r?(e.i+=2,"!="):62===t&&61===r?(e.i+=2,">="):60===t&&61===r?(e.i+=2,"<="):62===t?(e.i++,">"):60===t?(e.i++,"<"):""},e._evalNumOp=function(e,t,r){switch(t){case"==":return e===r;case"!=":return e!==r;case">":return e>r;case"<":return e<r;case">=":return e>=r;case"<=":return e<=r;default:return!1}},e}();tf._DIRECTIVE_RE=/^[ \t]*#[ \t]*(if|ifdef|ifndef|elif|else|endif|define|undef)\b(.*)/,tf._FUNC_MACRO_RE=/^(\w+)\(([^)]*)\)\s*(.*)/;var td=/*#__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]!==eD.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}();td._id=0;var tm=/*#__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 td(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}();tm.closureMap=new Map,tm.pool=new Map,tm._id=0;var tS=/*#__PURE__*/function(){function e(){}return e.isTerminal=function(e){return e<eQ.START},e.toString=function(e){if(this.isTerminal(e)){var t;return null!=(t=eD[e])?t:eV[e]}return eQ[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=tR.createRange(a,o);eP.get(null!=r?r:eP.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}(),tv=((eR={})[eR.Shift=0]="Shift",eR[eR.Reduce=1]="Reduce",eR[eR.Accept=2]="Accept",eR),tg=/*#__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 td(this.grammar.productions[0],0,[eD.EOF])],t=tm.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(!tS.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(tS.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(eD.EPSILON))break}if(!i&&(null==s?void 0:s.has(eD.EPSILON)))for(var _,h=c(t.lookaheadSet);!(_=h()).done;){var f=_.value;n.add(f)}for(var d,m=c(r);!(d=m()).done;){var S=d.value,v=e.createStateItem(S,0);e.items.has(v)&&tS.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,C=e.createStateItem(E,0);e.items.has(C)&&tS.isSubSet(t.lookaheadSet,C.lookaheadSet)||(e.items.add(C),C.addLookahead(t.lookaheadSet),this._extendStateItem(e,C))}}},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!==eQ.START?{action:tv.Reduce,target:l.production.id}:{action:tv.Accept};for(var p,_=c(l.lookaheadSet);!(p=_()).done;){var h=p.value;this._addAction(r,h,u)}}else{var f=l.advance();tS.addMapSetItem(t,l.curSymbol,f)}l.needReInfer=!1}for(var d,m=new Set,S=c(t.entries());!(d=S()).done;){var v=d.value,g=v[0],y=v[1],E=tm.create(Array.from(y));tS.isTerminal(g)?this._addAction(r,g,{action:tv.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||tS.isActionEqual(n,r)||t!==eV.ELSE||n.action!==tv.Shift||r.action!==tv.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(eD.EPSILON);for(var l,u=c(o);!(l=u()).done;){for(var p=l.value,_=0;_<p.derivation.length;_++){var h=p.derivation[_];if(tS.isTerminal(h)){s.add(h);break}for(var f,d=this._computeFirstSetForNT(h),m=c(d);!(f=m()).done;){var S=f.value;S!==eD.EPSILON&&s.add(S)}if(!this.grammar.isNullableNT(h))break}_===p.derivation.length&&s.add(eD.EPSILON)}return this._firstSetNTStack.pop(),s},e}(),ty=function e(t,r){this.goal=t,this.derivation=r,this.id=e._id++,e.pool.set(this.id,this)};ty._id=0,ty.pool=new Map;var tE=/*#__PURE__*/function(){function e(e,t){this.startSymbol=e,t.unshift(new ty(eQ.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]===eD.EPSILON})},t.getProductionByID=function(e){return ty.pool.get(e)},e.create=function(t,r){return new e(t,r.map(function(e){return new ty(e[0],e.slice(1))}))},e}(),tC=[].concat(tS.createProductionWithOptions(eQ.gs_shader_program,[[eQ.global_declaration],[eQ.gs_shader_program,eQ.global_declaration]],eP.GLShaderProgram.pool),tS.createProductionWithOptions(eQ.global_declaration,[[eQ.precision_specifier],[eQ.variable_declaration_statement],[eQ.struct_specifier],[eQ.function_definition],[eQ.global_macro_if_statement],[eQ.macro_undef],[eV.MACRO_DEFINE_EXPRESSION]],eP.GlobalDeclaration.pool),tS.createProductionWithOptions(eQ.macro_call_symbol,[[eV.MACRO_CALL]],eP.MacroCallSymbol.pool),tS.createProductionWithOptions(eQ.macro_call_function,[[eQ.macro_call_symbol,eD.LEFT_PAREN,eD.RIGHT_PAREN],[eQ.macro_call_symbol,eD.LEFT_PAREN,eQ.function_call_parameter_list,eD.RIGHT_PAREN]],eP.MacroCallFunction.pool),tS.createProductionWithOptions(eQ.macro_undef,[[eV.MACRO_UNDEF,eD.ID],[eV.MACRO_UNDEF,eV.MACRO_CALL]],eP.MacroUndef.pool),tS.createProductionWithOptions(eQ.macro_push_context,[[eV.MACRO_IF,eV.MACRO_CONDITIONAL_EXPRESSION],[eV.MACRO_IFDEF,eD.ID],[eV.MACRO_IFNDEF,eD.ID],[eV.MACRO_IFDEF,eQ.macro_call_symbol],[eV.MACRO_IFNDEF,eQ.macro_call_symbol]],eP.MacroPushContext.pool),tS.createProductionWithOptions(eQ.macro_pop_context,[[eV.MACRO_ENDIF]],eP.MacroPopContext.pool),tS.createProductionWithOptions(eQ.macro_elif_expression,[[eV.MACRO_ELIF,eV.MACRO_CONDITIONAL_EXPRESSION]],eP.MacroElifExpression.pool),tS.createProductionWithOptions(eQ.macro_else_expression,[[eV.MACRO_ELSE]],eP.MacroElseExpression.pool),tS.createProductionWithOptions(eQ.global_macro_declaration,[[eQ.global_declaration],[eQ.global_macro_declaration,eQ.global_declaration]],eP.GlobalMacroDeclaration.pool),tS.createProductionWithOptions(eQ.global_macro_if_statement,[[eQ.macro_push_context,eQ.global_macro_declaration,eQ.global_macro_branch],[eQ.macro_push_context,eQ.global_macro_branch]],eP.GlobalMacroIfStatement.pool),tS.createProductionWithOptions(eQ.global_macro_branch,[[eQ.macro_pop_context],[eQ.macro_elif_expression,eQ.global_macro_declaration,eQ.global_macro_branch],[eQ.macro_else_expression,eQ.global_macro_declaration,eQ.macro_pop_context],[eQ.macro_elif_expression,eQ.global_macro_branch],[eQ.macro_else_expression,eQ.macro_pop_context]],eP.GlobalMacroBranch.pool),tS.createProductionWithOptions(eQ.variable_declaration,[[eQ.fully_specified_type,eD.ID],[eQ.fully_specified_type,eD.ID,eQ.array_specifier],[eQ.fully_specified_type,eD.ID,eD.EQUAL,eQ.initializer]],eP.VariableDeclaration.pool),tS.createProductionWithOptions(eQ.variable_declaration_list,[[eQ.variable_declaration],[eQ.variable_declaration_list,eD.COMMA,eD.ID],[eQ.variable_declaration_list,eD.COMMA,eD.ID,eQ.array_specifier]],eP.VariableDeclarationList.pool),tS.createProductionWithOptions(eQ.variable_declaration_statement,[[eQ.variable_declaration_list,eD.SEMICOLON]]),tS.createProductionWithOptions(eQ.ext_builtin_type_specifier_nonarray,[[eV.VOID],[eV.FLOAT],[eV.BOOL],[eV.INT],[eV.UINT],[eV.VEC2],[eV.VEC3],[eV.VEC4],[eV.BVEC2],[eV.BVEC3],[eV.BVEC4],[eV.IVEC2],[eV.IVEC3],[eV.IVEC4],[eV.UVEC2],[eV.UVEC3],[eV.UVEC4],[eV.MAT2],[eV.MAT3],[eV.MAT4],[eV.MAT2X3],[eV.MAT2X4],[eV.MAT3X2],[eV.MAT3X4],[eV.MAT4X2],[eV.MAT4X3],[eV.SAMPLER2D],[eV.SAMPLER3D],[eV.SAMPLER_CUBE],[eV.SAMPLER2D_SHADOW],[eV.SAMPLER_CUBE_SHADOW],[eV.SAMPLER2D_ARRAY],[eV.SAMPLER2D_ARRAY_SHADOW],[eV.I_SAMPLER2D],[eV.I_SAMPLER3D],[eV.I_SAMPLER_CUBE],[eV.I_SAMPLER2D_ARRAY],[eV.U_SAMPLER2D],[eV.U_SAMPLER3D],[eV.U_SAMPLER_CUBE],[eV.U_SAMPLER2D_ARRAY]],eP.ExtBuiltinTypeSpecifierNonArray.pool),tS.createProductionWithOptions(eQ.type_specifier_nonarray,[[eD.ID],[eQ.ext_builtin_type_specifier_nonarray]],eP.TypeSpecifierNonArray.pool),tS.createProductionWithOptions(eQ.fully_specified_type,[[eQ.type_specifier],[eQ.type_qualifier,eQ.type_specifier]],eP.FullySpecifiedType.pool),tS.createProductionWithOptions(eQ.type_specifier,[[eQ.type_specifier_nonarray],[eQ.ext_builtin_type_specifier_nonarray,eQ.array_specifier]],eP.TypeSpecifier.pool),tS.createProductionWithOptions(eQ.type_qualifier,[[eQ.single_type_qualifier],[eQ.type_qualifier,eQ.single_type_qualifier]],eP.TypeQualifier.pool),tS.createProductionWithOptions(eQ.single_type_qualifier,[[eQ.storage_qualifier],[eQ.precision_qualifier],[eQ.interpolation_qualifier],[eQ.invariant_qualifier],[eV.PRECISE]],eP.SingleTypeQualifier.pool),tS.createProductionWithOptions(eQ.storage_qualifier,[[eV.CONST],[eV.IN],[eV.INOUT],[eV.OUT],[eV.CENTROID]]),tS.createProductionWithOptions(eQ.interpolation_qualifier,[[eV.SMOOTH],[eV.FLAT]]),tS.createProductionWithOptions(eQ.invariant_qualifier,[[eV.INVARIANT]]),tS.createProductionWithOptions(eQ.precision_qualifier,[[eV.HIGHP],[eV.MEDIUMP],[eV.LOWP]]),tS.createProductionWithOptions(eQ.struct_specifier,[[eV.STRUCT,eD.ID,eD.LEFT_BRACE,eQ.struct_declaration_list,eD.RIGHT_BRACE,eD.SEMICOLON],[eV.STRUCT,eD.LEFT_BRACE,eQ.struct_declaration_list,eD.RIGHT_BRACE,eD.SEMICOLON]],eP.StructSpecifier.pool),tS.createProductionWithOptions(eQ.struct_declaration_list,[[eQ.struct_declaration],[eQ.struct_declaration_list,eQ.struct_declaration]],eP.StructDeclarationList.pool),tS.createProductionWithOptions(eQ.struct_declaration,[[eQ.type_specifier,eQ.struct_declarator_list,eD.SEMICOLON],[eQ.type_qualifier,eQ.type_specifier,eQ.struct_declarator_list,eD.SEMICOLON],[eQ.layout_qualifier,eQ.type_specifier,eQ.struct_declarator,eD.SEMICOLON],[eQ.macro_struct_declaration]],eP.StructDeclaration.pool),tS.createProductionWithOptions(eQ.macro_struct_declaration,[[eQ.macro_push_context,eQ.struct_declaration_list,eQ.macro_struct_branch],[eQ.macro_push_context,eQ.macro_struct_branch]],eP.MacroStructDeclaration.pool),tS.createProductionWithOptions(eQ.macro_struct_branch,[[eQ.macro_pop_context],[eQ.macro_elif_expression,eQ.struct_declaration_list,eQ.macro_struct_branch],[eQ.macro_else_expression,eQ.struct_declaration_list,eQ.macro_pop_context],[eQ.macro_elif_expression,eQ.macro_struct_branch],[eQ.macro_else_expression,eQ.macro_pop_context]],eP.MacroStructBranch.pool),tS.createProductionWithOptions(eQ.layout_qualifier,[[eV.LAYOUT,eD.LEFT_PAREN,eV.LOCATION,eD.EQUAL,eD.INT_CONSTANT,eD.RIGHT_PAREN]],eP.LayoutQualifier.pool),tS.createProductionWithOptions(eQ.struct_declarator_list,[[eQ.struct_declarator],[eQ.struct_declarator_list,eD.COMMA,eQ.struct_declarator]],eP.StructDeclaratorList.pool),tS.createProductionWithOptions(eQ.struct_declarator,[[eD.ID],[eD.ID,eQ.array_specifier]],eP.StructDeclarator.pool),tS.createProductionWithOptions(eQ.array_specifier,[[eD.LEFT_BRACKET,eD.RIGHT_BRACKET],[eD.LEFT_BRACKET,eQ.integer_constant_expression,eD.RIGHT_BRACKET]],eP.ArraySpecifier.pool),tS.createProductionWithOptions(eQ.integer_constant_expression_operator,[[eD.PLUS],[eD.DASH],[eD.STAR],[eD.SLASH],[eD.PERCENT]],eP.IntegerConstantExpressionOperator.pool),tS.createProductionWithOptions(eQ.integer_constant_expression,[[eQ.variable_identifier],[eD.INT_CONSTANT],[eQ.integer_constant_expression,eQ.integer_constant_expression_operator,eD.INT_CONSTANT],[eQ.integer_constant_expression,eQ.integer_constant_expression_operator,eQ.variable_identifier]],eP.IntegerConstantExpression.pool),tS.createProductionWithOptions(eQ.conditional_expression,[[eQ.logical_or_expression],[eQ.logical_or_expression,eD.QUESTION,eQ.expression,eD.COLON,eQ.assignment_expression]]),tS.createProductionWithOptions(eQ.logical_or_expression,[[eQ.logical_xor_expression],[eQ.logical_or_expression,eD.OR_OP,eQ.logical_xor_expression]]),tS.createProductionWithOptions(eQ.logical_xor_expression,[[eQ.logical_and_expression],[eQ.logical_xor_expression,eD.XOR_OP,eQ.logical_and_expression]]),tS.createProductionWithOptions(eQ.logical_and_expression,[[eQ.inclusive_or_expression],[eQ.logical_and_expression,eD.AND_OP,eQ.inclusive_or_expression]]),tS.createProductionWithOptions(eQ.inclusive_or_expression,[[eQ.exclusive_or_expression],[eQ.inclusive_or_expression,eD.VERTICAL_BAR,eQ.exclusive_or_expression]]),tS.createProductionWithOptions(eQ.exclusive_or_expression,[[eQ.and_expression],[eQ.exclusive_or_expression,eD.CARET,eQ.and_expression]]),tS.createProductionWithOptions(eQ.and_expression,[[eQ.equality_expression],[eQ.and_expression,eD.AMPERSAND,eQ.equality_expression]]),tS.createProductionWithOptions(eQ.equality_expression,[[eQ.relational_expression],[eQ.equality_expression,eD.EQ_OP,eQ.relational_expression],[eQ.equality_expression,eD.NE_OP,eQ.relational_expression]]),tS.createProductionWithOptions(eQ.relational_expression,[[eQ.shift_expression],[eQ.relational_expression,eD.LEFT_ANGLE,eQ.shift_expression],[eQ.relational_expression,eD.RIGHT_ANGLE,eQ.shift_expression],[eQ.relational_expression,eD.LE_OP,eQ.shift_expression],[eQ.relational_expression,eD.GE_OP,eQ.shift_expression]]),tS.createProductionWithOptions(eQ.shift_expression,[[eQ.additive_expression],[eQ.shift_expression,eD.LEFT_OP,eQ.additive_expression],[eQ.shift_expression,eD.RIGHT_OP,eQ.additive_expression]]),tS.createProductionWithOptions(eQ.additive_expression,[[eQ.multiplicative_expression],[eQ.additive_expression,eD.PLUS,eQ.multiplicative_expression],[eQ.additive_expression,eD.DASH,eQ.multiplicative_expression]]),tS.createProductionWithOptions(eQ.multiplicative_expression,[[eQ.unary_expression],[eQ.multiplicative_expression,eD.STAR,eQ.unary_expression],[eQ.multiplicative_expression,eD.SLASH,eQ.unary_expression],[eQ.multiplicative_expression,eD.PERCENT,eQ.unary_expression]]),tS.createProductionWithOptions(eQ.unary_expression,[[eQ.postfix_expression],[eD.INC_OP,eQ.unary_expression],[eD.DEC_OP,eQ.unary_expression],[eQ.unary_operator,eQ.unary_expression]]),tS.createProductionWithOptions(eQ.unary_operator,[[eD.PLUS],[eD.DASH],[eD.BANG],[eD.TILDE]]),tS.createProductionWithOptions(eQ.postfix_expression,[[eQ.primary_expression],[eQ.postfix_expression,eD.LEFT_BRACKET,eQ.expression,eD.RIGHT_BRACKET],[eQ.function_call],[eQ.postfix_expression,eD.DOT,eD.ID],[eQ.postfix_expression,eD.DOT,eQ.function_call],[eQ.postfix_expression,eD.INC_OP],[eQ.postfix_expression,eD.DEC_OP]],eP.PostfixExpression.pool),tS.createProductionWithOptions(eQ.primary_expression,[[eQ.variable_identifier],[eD.INT_CONSTANT],[eD.FLOAT_CONSTANT],[eV.True],[eV.False],[eD.LEFT_PAREN,eQ.expression,eD.RIGHT_PAREN]],eP.PrimaryExpression.pool),tS.createProductionWithOptions(eQ.expression,[[eQ.assignment_expression],[eQ.expression,eD.COMMA,eQ.assignment_expression]],eP.Expression.pool),tS.createProductionWithOptions(eQ.assignment_expression,[[eQ.conditional_expression],[eQ.unary_expression,eQ.assignment_operator,eQ.assignment_expression]],eP.AssignmentExpression.pool),tS.createProductionWithOptions(eQ.assignment_operator,[[eD.EQUAL],[eD.MUL_ASSIGN],[eD.DIV_ASSIGN],[eD.MOD_ASSIGN],[eD.ADD_ASSIGN],[eD.SUB_ASSIGN],[eD.LEFT_ASSIGN],[eD.RIGHT_ASSIGN],[eD.AND_ASSIGN],[eD.XOR_ASSIGN],[eD.OR_ASSIGN]]),tS.createProductionWithOptions(eQ.function_call,[[eQ.function_call_generic]],eP.FunctionCall.pool),tS.createProductionWithOptions(eQ.function_call_generic,[[eQ.function_identifier,eD.LEFT_PAREN,eQ.function_call_parameter_list,eD.RIGHT_PAREN],[eQ.function_identifier,eD.LEFT_PAREN,eD.RIGHT_PAREN],[eQ.function_identifier,eV.VOID,eD.RIGHT_PAREN]],eP.FunctionCallGeneric.pool),tS.createProductionWithOptions(eQ.function_call_parameter_list,[[eQ.assignment_expression],[eQ.function_call_parameter_list,eD.COMMA,eQ.assignment_expression],[eQ.macro_call_arg_block],[eQ.function_call_parameter_list,eQ.macro_call_arg_block]],eP.FunctionCallParameterList.pool),tS.createProductionWithOptions(eQ.macro_call_arg_case_list,[[eQ.assignment_expression],[eD.COMMA,eQ.assignment_expression],[eQ.macro_call_arg_block],[eQ.macro_call_arg_case_list,eQ.macro_call_arg_block],[eQ.macro_call_arg_case_list,eD.COMMA,eQ.assignment_expression]],eP.MacroCallArgCaseList.pool),tS.createProductionWithOptions(eQ.macro_call_arg_block,[[eQ.macro_push_context,eQ.macro_call_arg_branch],[eQ.macro_push_context,eQ.macro_call_arg_case_list,eQ.macro_call_arg_branch]],eP.MacroCallArgBlock.pool),tS.createProductionWithOptions(eQ.macro_call_arg_branch,[[eQ.macro_pop_context],[eQ.macro_elif_expression,eQ.macro_call_arg_case_list,eQ.macro_call_arg_branch],[eQ.macro_else_expression,eQ.macro_call_arg_case_list,eQ.macro_pop_context],[eQ.macro_elif_expression,eQ.macro_call_arg_branch],[eQ.macro_else_expression,eQ.macro_pop_context]],eP.MacroCallArgBranch.pool),tS.createProductionWithOptions(eQ.function_identifier,[[eQ.type_specifier]],eP.FunctionIdentifier.pool),tS.createProductionWithOptions(eQ.function_definition,[[eQ.function_prototype,eQ.compound_statement_no_scope]],eP.FunctionDefinition.pool),tS.createProductionWithOptions(eQ.function_prototype,[[eQ.function_declarator,eD.RIGHT_PAREN]],eP.FunctionProtoType.pool),tS.createProductionWithOptions(eQ.function_declarator,[[eQ.function_header],[eQ.function_header,eQ.function_parameter_list]],eP.FunctionDeclarator.pool),tS.createProductionWithOptions(eQ.function_header,[[eQ.fully_specified_type,eD.ID,eD.LEFT_PAREN]],eP.FunctionHeader.pool),tS.createProductionWithOptions(eQ.function_parameter_list,[[eQ.parameter_declaration],[eQ.function_parameter_list,eD.COMMA,eQ.parameter_declaration],[eQ.macro_param_block],[eQ.function_parameter_list,eQ.macro_param_block]],eP.FunctionParameterList.pool),tS.createProductionWithOptions(eQ.macro_param_case_list,[[eQ.parameter_declaration],[eD.COMMA,eQ.parameter_declaration],[eQ.macro_param_block],[eQ.macro_param_case_list,eQ.macro_param_block],[eQ.macro_param_case_list,eD.COMMA,eQ.parameter_declaration]],eP.MacroParamCaseList.pool),tS.createProductionWithOptions(eQ.macro_param_block,[[eQ.macro_push_context,eQ.macro_parameter_branch],[eQ.macro_push_context,eQ.macro_param_case_list,eQ.macro_parameter_branch]],eP.MacroParamBlock.pool),tS.createProductionWithOptions(eQ.macro_parameter_branch,[[eQ.macro_pop_context],[eQ.macro_elif_expression,eQ.macro_param_case_list,eQ.macro_parameter_branch],[eQ.macro_else_expression,eQ.macro_param_case_list,eQ.macro_pop_context],[eQ.macro_elif_expression,eQ.macro_parameter_branch],[eQ.macro_else_expression,eQ.macro_pop_context]],eP.MacroParameterBranch.pool),tS.createProductionWithOptions(eQ.parameter_declaration,[[eQ.type_qualifier,eQ.parameter_declarator],[eQ.parameter_declarator],[eQ.macro_call_symbol],[eQ.macro_call_function]],eP.ParameterDeclaration.pool),tS.createProductionWithOptions(eQ.parameter_declarator,[[eQ.type_specifier,eD.ID],[eQ.type_specifier,eD.ID,eQ.array_specifier]],eP.ParameterDeclarator.pool),tS.createProductionWithOptions(eQ.statement_list,[[eQ.statement],[eQ.statement_list,eQ.statement]],eP.StatementList.pool),tS.createProductionWithOptions(eQ.statement,[[eQ.compound_statement],[eQ.simple_statement]]),tS.createProductionWithOptions(eQ.compound_statement_no_scope,[[eD.LEFT_BRACE,eD.RIGHT_BRACE],[eD.LEFT_BRACE,eQ.statement_list,eD.RIGHT_BRACE]],eP.CompoundStatementNoScope.pool),tS.createProductionWithOptions(eQ.compound_statement,[[eD.LEFT_BRACE,eD.RIGHT_BRACE],[eQ.scope_brace,eQ.statement_list,eQ.scope_end_brace]]),tS.createProductionWithOptions(eQ.simple_statement,[[eQ.declaration],[eQ.expression_statement],[eQ.selection_statement],[eQ.iteration_statement],[eQ.jump_statement],[eQ.macro_if_statement],[eQ.macro_undef],[eV.MACRO_DEFINE_EXPRESSION]]),tS.createProductionWithOptions(eQ.declaration,[[eQ.function_prototype,eD.SEMICOLON],[eQ.init_declarator_list,eD.SEMICOLON],[eV.PRECISION,eQ.precision_qualifier,eQ.ext_builtin_type_specifier_nonarray,eD.SEMICOLON],[eQ.type_qualifier,eD.ID,eD.SEMICOLON],[eQ.type_qualifier,eD.ID,eQ.identifier_list,eD.SEMICOLON]],eP.Declaration.pool),tS.createProductionWithOptions(eQ.identifier_list,[[eD.COMMA,eD.ID],[eQ.identifier_list,eD.COMMA,eD.ID]],eP.IdentifierList.pool),tS.createProductionWithOptions(eQ.init_declarator_list,[[eQ.single_declaration],[eQ.init_declarator_list,eD.COMMA,eD.ID],[eQ.init_declarator_list,eD.COMMA,eD.ID,eQ.array_specifier],[eQ.init_declarator_list,eD.COMMA,eD.ID,eQ.array_specifier,eD.EQUAL,eQ.initializer],[eQ.init_declarator_list,eD.COMMA,eD.ID,eD.EQUAL,eQ.initializer]],eP.InitDeclaratorList.pool),tS.createProductionWithOptions(eQ.single_declaration,[[eQ.fully_specified_type,eD.ID],[eQ.fully_specified_type,eD.ID,eQ.array_specifier],[eQ.fully_specified_type,eD.ID,eQ.array_specifier,eD.EQUAL,eQ.initializer],[eQ.fully_specified_type,eD.ID,eD.EQUAL,eQ.initializer]],eP.SingleDeclaration.pool),tS.createProductionWithOptions(eQ.initializer,[[eQ.assignment_expression],[eD.LEFT_BRACE,eQ.initializer_list,eD.RIGHT_BRACE]]),tS.createProductionWithOptions(eQ.initializer_list,[[eQ.initializer],[eQ.initializer_list,eD.COMMA,eQ.initializer]]),tS.createProductionWithOptions(eQ.expression_statement,[[eD.SEMICOLON],[eQ.expression,eD.SEMICOLON]]),tS.createProductionWithOptions(eQ.selection_statement,[[eV.IF,eD.LEFT_PAREN,eQ.expression,eD.RIGHT_PAREN,eQ.statement],[eV.IF,eD.LEFT_PAREN,eQ.expression,eD.RIGHT_PAREN,eQ.statement,eV.ELSE,eQ.statement]]),tS.createProductionWithOptions(eQ.iteration_statement,[[eV.WHILE,eD.LEFT_PAREN,eQ.condition,eD.RIGHT_PAREN,eQ.statement],[eV.FOR,eD.LEFT_PAREN,eQ.for_init_statement,eQ.for_rest_statement,eD.RIGHT_PAREN,eQ.statement]]),tS.createProductionWithOptions(eQ.precision_specifier,[[eV.PRECISION,eQ.precision_qualifier,eQ.ext_builtin_type_specifier_nonarray,eD.SEMICOLON]],eP.PrecisionSpecifier.pool),tS.createProductionWithOptions(eQ.for_init_statement,[[eQ.expression_statement],[eQ.declaration]]),tS.createProductionWithOptions(eQ.condition,[[eQ.expression],[eQ.fully_specified_type,eD.ID,eD.EQUAL,eQ.initializer]]),tS.createProductionWithOptions(eQ.for_rest_statement,[[eQ.conditionopt,eD.SEMICOLON],[eQ.conditionopt,eD.SEMICOLON,eQ.expression]]),tS.createProductionWithOptions(eQ.conditionopt,[[eD.EPSILON],[eQ.condition]]),tS.createProductionWithOptions(eQ.jump_statement,[[eV.CONTINUE,eD.SEMICOLON],[eV.BREAK,eD.SEMICOLON],[eV.RETURN,eD.SEMICOLON],[eV.RETURN,eQ.expression,eD.SEMICOLON],[eV.DISCARD,eD.SEMICOLON]],eP.JumpStatement.pool),tS.createProductionWithOptions(eQ.scope_brace,[[eD.LEFT_BRACE]],eP.ScopeBrace.pool),tS.createProductionWithOptions(eQ.scope_end_brace,[[eD.RIGHT_BRACE]],eP.ScopeEndBrace.pool),tS.createProductionWithOptions(eQ.variable_identifier,[[eD.ID],[eQ.macro_call_symbol],[eQ.macro_call_function]],eP.VariableIdentifier.pool),tS.createProductionWithOptions(eQ.macro_if_statement,[[eQ.macro_push_context,eQ.statement_list,eQ.macro_branch],[eQ.macro_push_context,eQ.macro_branch]],eP.MacroIfStatement.pool),tS.createProductionWithOptions(eQ.macro_branch,[[eQ.macro_pop_context],[eQ.macro_elif_expression,eQ.statement_list,eQ.macro_branch],[eQ.macro_else_expression,eQ.statement_list,eQ.macro_pop_context],[eQ.macro_elif_expression,eQ.macro_branch],[eQ.macro_else_expression,eQ.macro_pop_context]],eP.MacroBranch.pool)),tx=function(e){for(var t=0;t<tC.length;t++){var r=tC[t][1];r&&e.addTranslationRule(t,r)}},tA=/*#__PURE__*/function(){function e(e,t,r){this._traceBackStack=[],this.actionTable=e,this.gotoTable=t,this.grammar=r,this.sematicAnalyzer=new e7}return e.prototype.parse=function(e,n){this.sematicAnalyzer.reset(n);var i=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)===tv.Shift)a.push(l,u.target),s=e.next();else{if((null==u?void 0:u.action)===tv.Accept)return t.Logger.info("[Task - AST compilation] Accept! State automata run "+c+" times! cost time "+(performance.now()-i)+"ms"),null==o.acceptRule||o.acceptRule.call(o,o),o.semanticStack.pop();if((null==u?void 0:u.action)!==tv.Reduce)return eG.createGSError("Unexpected token "+l.lexeme,e0.CompilationError,tR._processingPassText,l.location),null;for(var p=u.target,_=this.grammar.getProductionByID(p),h=o.getTranslationRule(_.id),f=[],d=_.derivation.length-1;d>=0;d--)if(_.derivation[d]!==eD.EPSILON){a.pop();var m=a.pop();if(r(m,eF))f.unshift(m);else{var S=o.semanticStack.pop();f.unshift(S)}}null==h||h.apply(void 0,[].concat([o],f));var v=this.stateGotoTable;a.push(_.goal);var g=null==v?void 0:v.get(_.goal);a.push(g);continue}}},e.create=function(){if(!this._singleton){var t=tE.create(eQ.gs_shader_program,tC.map(function(e){return e[0]})),r=new tg(t);r.generate(),this._singleton=new e(r.actionTable,r.gotoTable,t),tx(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 tT(){return(tT=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 tb=/*#__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}(),tO=/*#__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}(),tI=/*#__PURE__*/function(e){function r(){var t;return t=e.apply(this,arguments)||this,t.hasPendingContent=!1,t}i(r,e);var n=r.prototype;return n.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))},n.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)},n.scanToken=function(){for(;;){if(this.skipCommentsAndSpace(),this.isEnd())return;var e=this.getShaderPosition(0);if(tp.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=eF.pool.get();return a.set(i,n,e),a}this.advance(1)}},n.createCompileError=function(e,t){return eG.createGSError(e,e0.CompilationError,this.source,null!=t?t:this.getShaderPosition(0))},n._scanWord=function(e){for(;tp.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:eD.ID,o=tR.createRange(e,n),s=eF.pool.get();return s.set(a,i,o),s},n._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},n._isValidWordBoundary=function(e){return tp.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||124===e},r._scanDigits=function(e,t){for(var r=t;r<e.length;){var n=e.charCodeAt(r);if(tp.isDigit(n))r++;else break}return r},r}(tp);tI._keywordLexemeTable={RenderQueueType:eV.GSRenderQueueType,BlendState:eV.GSBlendState,DepthState:eV.GSDepthState,StencilState:eV.GSStencilState,RasterState:eV.GSRasterState,EditorProperties:eV.GSEditorProperties,EditorMacros:eV.GSEditorMacros,Editor:eV.GSEditor,Tags:eV.GSTags,VertexShader:eV.GSVertexShader,FragmentShader:eV.GSFragmentShader,SubShader:eV.GSSubShader,Pass:eV.GSPass,BlendFactor:eV.GSBlendFactor,BlendOperation:eV.GSBlendOperation,Bool:eV.GSBool,Number:eV.GSNumber,Color:eV.GSColor,CompareFunction:eV.GSCompareFunction,StencilOperation:eV.GSStencilOperation,CullMode:eV.GSCullMode,ColorWriteMask:eV.GSColorWriteMask,UsePass:eV.GSUsePass,true:eV.True,false:eV.False},tI._symbolLexemeTable={"{":eV.LeftBrace,"}":eV.RightBrace,"=":eV.Equal,"|":eV.BitwiseOr};var tL=/*#__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:tT({},o.constantMap),variableMap:tT({},o.variableMap)};this._mergeRenderStates(p,l.renderStates);for(var _=0,h=l.passes.length;_<h;_++){var f=l.passes[_],d={constantMap:tT({},p.constantMap),variableMap:tT({},p.variableMap)};if(this._mergeRenderStates(d,f.renderStates),f.renderStates=d,!f.isUsePass){var m=u.concat(f.pendingContents);f.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=tb.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 eV.GSSubShader:this._addPendingContents(i,o.lexeme.length,a);var s=this._parseSubShader();r.subShaders.push(s),i=e.getShaderPosition(0);break;case eV.GSEditorProperties:case eV.GSEditorMacros:case eV.GSEditor:this._addPendingContents(i,o.lexeme.length,a),e.scanPairedChar("{","}",!0,!1),i=e.getShaderPosition(0);break;case eV.LeftBrace:++n;break;case eV.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===eD.ID){r.scanLexeme("{");var i=this._parseRenderStateProperties(t.lexeme),a=new tO(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 tO(t.lexeme,t.type);this._symbolTableStack.insert(r)},e._pushScope=function(){var e=new eY;this._symbolTableStack.pushScope(e)},e._popScope=function(){this._symbolTableStack.popScope()},e._parseRenderStateProperties=function(e){for(var t=this._lexer,r=tb.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._scanEnumConstValue=function(e){var t,r=this._lexer;r.advance(1);var n=r.scanToken(),i=null==(t=this._renderStateConstMap[e])?void 0:t[n.lexeme];return void 0==i&&this._createCompileError("Invalid engine constant: "+e+"."+n.lexeme,n.location),i},e._parseRenderStateProperty=function(e,r){var n,i=this._lexer,a=i.scanToken().lexeme,o=a;if("BlendState"===e&&"BlendColor"!==a&&"AlphaToCoverage"!==a){var s=0,c=i.scanTwoExpectedLexemes("[","=");"["===c?(s=i.scanNumber(),i.scanLexeme("]"),i.scanLexeme("=")):"="!==c&&this._createCompileError("Invalid syntax, expect '[' or '=', but got unexpected token"),o+=s}else i.scanLexeme("=");var l=t.RenderStateElementKey[e+o];void 0===l&&this._createCompileError("Invalid render state property "+a),i.skipCommentsAndSpace();var u=i.getCurCharCode();if(tp.isDigit(u)||46===u)n=i.scanNumber();else{var p=i.scanToken(),_=p.type;if(_===eV.True)n=!0;else if(_===eV.False)n=!1;else if(_===eV.GSColor)n=i.scanColor();else if("."===i.getCurChar()){if(void 0==(n=this._scanEnumConstValue(p.lexeme)))return;if(i.skipCommentsAndSpace(),"|"===i.getCurChar()){if("ColorWriteMask"!==p.lexeme){this._createCompileError("Bitwise OR '|' is not supported for '"+p.lexeme+"', only bitmask enums like 'ColorWriteMask' support this",p.location);return}for(;"|"===i.getCurChar();){i.advance(1);var h=i.scanToken();if(void 0==h||"."!==i.getCurChar()){this._createCompileError("Invalid syntax after '|', expect 'EnumType.Value'",null==h?void 0:h.location);return}if(h.lexeme!==p.lexeme){this._createCompileError("Cannot mix enum types in bitwise OR: expected '"+p.lexeme+"' but got '"+h.lexeme+"'",h.location);return}var f=this._scanEnumConstValue(h.lexeme);if(void 0==f)return;n|=f,i.skipCommentsAndSpace()}}}else{n=p.lexeme;var d=this._lookupSymbol;d.set(p.lexeme,eD.ID),this._symbolTableStack.lookup(d)||this._createCompileError("Invalid "+e+" variable: "+p.lexeme,p.location)}}i.scanLexeme(";"),"string"==typeof n?r.variableMap[l]=n:r.constantMap[l]=n},e._parseRenderQueueDeclarationOrAssignment=function(e){var r=this._lexer,n=r.scanToken();if(n.type===eD.ID){r.scanLexeme(";");var i=new tO(n.lexeme,eV.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,eV.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:tT({},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=tb.createSubShaderSource(r);e.scanLexeme("{"),e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0);;){var a=e.scanToken();switch(a.type){case eV.GSPass:this._addPendingContents(i,a.lexeme.length,n.pendingContents);var o=this._parsePass();n.passes.push(o),i=e.getShaderPosition(0);break;case eV.GSUsePass:this._addPendingContents(i,a.lexeme.length,n.pendingContents);var s=e.scanPairedChar('"','"',!1,!1);n.passes.push(tb.createUsePass(s)),i=e.getShaderPosition(0);break;case eV.LeftBrace:++t;break;case eV.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=tb.createShaderPassSource(t);e.scanLexeme("{");var n=1;e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0);;){var a=e.scanToken();switch(a.type){case eV.GSVertexShader:case eV.GSFragmentShader:this._addPendingContents(i,a.lexeme.length,r.pendingContents),e.scanLexeme("=");var o=e.scanToken();r[a.lexeme]&&eG.createGSError("Reassign main entry",e0.CompilationError,e.source,e.getShaderPosition(0)),r[a.type===eV.GSVertexShader?"vertexEntry":"fragmentEntry"]=o.lexeme,e.scanLexeme(";"),i=e.getShaderPosition(0);break;case eV.LeftBrace:++n;break;case eV.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===eV.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 eV.GSBlendState:case eV.GSDepthState:case eV.GSRasterState:case eV.GSStencilState:this._addPendingContents(t,e.lexeme.length,r),this._parseRenderStateDeclarationOrAssignment(n,e),t=this._lexer.getShaderPosition(0);break;case eV.GSBlendFactor:case eV.GSBlendOperation:case eV.GSBool:case eV.GSNumber:case eV.GSColor:case eV.GSCompareFunction:case eV.GSStencilOperation:case eV.GSCullMode:case eV.GSColorWriteMask:this._addPendingContents(t,e.lexeme.length,r),this._parseVariableDeclaration(),t=this._lexer.getShaderPosition(0);break;case eV.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}();tL.errors=[],tL._renderStateConstMap={RenderQueueType:t.RenderQueueType,CompareFunction:t.CompareFunction,StencilOperation:t.StencilOperation,BlendOperation:t.BlendOperation,BlendFactor:t.BlendFactor,CullMode:t.CullMode,ColorWriteMask:t.ColorWriteMask},tL._symbolTableStack=new eK,tL._lexer=new tI,tL._lookupSymbol=new tO("",null);var tR=/*#__PURE__*/function(){function e(){}var n=e.prototype;return n._parseShaderSource=function(e){return eG.clearAllShaderLabObjectPool(),tL.parse(e)},n._parseShaderPass=function(r,n,i,a,o){var s=performance.now(),c={};eB._repeatIncludeSet.clear();var l=eB.parse(r,o,c);t.Logger.info("[Task - Pre processor] cost time "+(performance.now()-s)+"ms");var u=new t_(l,c).tokenize(),p=e._parser;e._processingPassText=l;var _=p.parse(u,c);if(_){var h=a===t.ShaderLanguage.GLSLES100?tc.getVisitor():tu.getVisitor(),f=performance.now(),d=h.visitShaderProgram(_,n,i);return t.Logger.info("[Task - CodeGen] cost time: "+(performance.now()-f)+"ms"),t.Logger.info("[Task - Total compilation] cost time: "+(performance.now()-s)+"ms"),e._processingPassText=void 0,d&&(d.vertexShaderInstructions=tf.parse(d.vertex),d.fragmentShaderInstructions=tf.parse(d.fragment)),d}},n._precompile=function(e,t,r){var n=this,i=this._parseShaderSource(e),a=i.subShaders.map(function(e){return{name:e.name,tags:e.tags,passes:e.passes.map(function(a){if(a.isUsePass)return{name:a.name,isUsePass:!0,tags:a.tags,renderStates:n._serializeRenderStates(a.renderStates)};var o=n._parseShaderPass(a.contents,a.vertexEntry,a.fragmentEntry,t,r);if(!o)throw Error('Shader pass "'+i.name+"."+e.name+"."+a.name+'" precompile failed, please check the shader source code.');return{name:a.name,isUsePass:!1,tags:a.tags,renderStates:n._serializeRenderStates(a.renderStates),vertexShaderInstructions:o.vertexShaderInstructions,fragmentShaderInstructions:o.fragmentShaderInstructions}})}});return{name:i.name,platformTarget:t,subShaders:a}},n._serializeRenderStates=function(e){var n={};for(var i in e.constantMap){var a=e.constantMap[i];r(a,t.Color)?n[i]=[a.r,a.g,a.b,a.a]:n[i]=a}return{constantMap:n,variableMap:e.variableMap}},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}();tR._parser=tA.create(),tR._shaderPositionPool=eG.createObjectPool(eN),tR._shaderRangePool=eG.createObjectPool(eM);var tP="2.0.0-alpha.26";console.log("Galacean Engine ShaderLab Version: "+tP+" | Mode: Release"),e.GSError=e$,e.GSErrorName=e0,e.ShaderLab=tR,e.version=tP,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 null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(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&&n(e,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,f,d,m,S,v,g,y,E,C,x,A,T,b,O,I,L,R,P,M,N,D,V,G,F,k,B,W,U,w,H,j,z,q,X,Q,Y,K,J,Z,$,ee,et,er,en,ei,ea,eo,es,ec,el,eu,ep,e_,eh,ef,ed,em,eS,ev,eg,ey,eE,eC,ex,eA,eT,eb,eO,eI,eL,eR,eP,eM=/*#__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}(),eN=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e){this.index=e},t.dispose=function(){this.index=0},e}(),eD=((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),eV=((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.BitwiseOr=74]="BitwiseOr",p[p.GSRenderQueueType=75]="GSRenderQueueType",p[p.GSBlendState=76]="GSBlendState",p[p.GSDepthState=77]="GSDepthState",p[p.GSStencilState=78]="GSStencilState",p[p.GSRasterState=79]="GSRasterState",p[p.GSEditorProperties=80]="GSEditorProperties",p[p.GSEditorMacros=81]="GSEditorMacros",p[p.GSEditor=82]="GSEditor",p[p.GSTags=83]="GSTags",p[p.GSVertexShader=84]="GSVertexShader",p[p.GSFragmentShader=85]="GSFragmentShader",p[p.GSSubShader=86]="GSSubShader",p[p.GSPass=87]="GSPass",p[p.GSBlendFactor=88]="GSBlendFactor",p[p.GSBlendOperation=89]="GSBlendOperation",p[p.GSBool=90]="GSBool",p[p.GSNumber=91]="GSNumber",p[p.GSColor=92]="GSColor",p[p.GSCompareFunction=93]="GSCompareFunction",p[p.GSStencilOperation=94]="GSStencilOperation",p[p.GSCullMode=95]="GSCullMode",p[p.GSColorWriteMask=96]="GSColorWriteMask",p[p.GSUsePass=97]="GSUsePass",p[p.MACRO_IF=98]="MACRO_IF",p[p.MACRO_IFDEF=99]="MACRO_IFDEF",p[p.MACRO_IFNDEF=100]="MACRO_IFNDEF",p[p.MACRO_ELSE=101]="MACRO_ELSE",p[p.MACRO_ELIF=102]="MACRO_ELIF",p[p.MACRO_ENDIF=103]="MACRO_ENDIF",p[p.MACRO_UNDEF=104]="MACRO_UNDEF",p[p.MACRO_DEFINE_EXPRESSION=105]="MACRO_DEFINE_EXPRESSION",p[p.MACRO_CONDITIONAL_EXPRESSION=106]="MACRO_CONDITIONAL_EXPRESSION",p[p.MACRO_CALL=107]="MACRO_CALL",p),eG=/*#__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}();eG._shaderLabObjectPoolSet=[];var eF=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t,n){if(this.type=e,this.lexeme=t,n){if(r(n,eM))this.location=n;else{var i=tR.createPosition(n.index+t.length);this.location=tR.createRange(n,i)}}},t.dispose=function(){},e}();eF.pool=eG.createObjectPool(eF);var ek=new eF;ek.set(eD.EOF,"/EOF");var eB=/*#__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 _=this._funcCallReg.exec(l);_&&(u=2,p=_[1])}var h={isFunction:s,name:n,value:l,valueType:u,params:c,functionCallName:p},f=t[n];f?this._isExist(f,h)||f.push(h):t[n]=[h]}},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 eW(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eW=function(){return!!e})()}function eU(e,t,r){return(eU=eW()?Reflect.construct:function(e,t,r){var i=[null];i.push.apply(i,t);var a=new(Function.bind.apply(e,i));return r&&n(a,r.prototype),a}).apply(null,arguments)}eB._includeReg=/^[ \t]*#include +"([\w\d./]+)"/gm,eB._macroRegex=/^\s*#define\s+(\w+)[ ]*(\(([^)]*)\))?[ ]+(\(?\w+\)?.*?)(?:\/\/.*|\/\*.*?\*\/)?\s*$/gm,eB._symbolReg=/^[a-zA-Z_][a-zA-Z0-9_]*$/,eB._funcCallReg=/^([a-zA-Z_][a-zA-Z0-9_]*)\s*\((.*)\)$/,eB._macroDefineIncludeMap=new Map,eB._repeatIncludeSet=new Set;var ew=((_={})[_.VERTEX=0]="VERTEX",_[_.FRAGMENT=1]="FRAGMENT",_[_.ALL=2]="ALL",_);function eH(e){return e>=200&&e<=213}var ej=new Map,ez=/*#__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 eH(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=eU(e,[].concat([t,r,ew.ALL],a)),c=null!=(n=ej.get(t))?n:[];c.push(s),ej.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=eU(e,[].concat([t,r,n],o)),l=null!=(i=ej.get(t))?i:[];l.push(c),ej.set(t,l)},e.getFn=function(e,t){var r=ej.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(eH(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!!ej.get(e)},o(e,[{key:"realReturnType",get:function(){return this._realReturnType}}]),e}();ez._create("radians",200,200),ez._create("degrees",200,200),ez._create("sin",200,200),ez._create("cos",200,200),ez._create("tan",200,200),ez._create("asin",200,200),ez._create("acos",200,200),ez._create("atan",200,200,200),ez._create("atan",200,200),ez._create("sinh",200,200),ez._create("cosh",200,200),ez._create("tanh",200,200),ez._create("asinh",200,200),ez._create("acosh",200,200),ez._create("atanh",200,200),ez._create("pow",200,200,200),ez._create("exp",200,200),ez._create("log",200,200),ez._create("exp2",200,200),ez._create("log2",200,200),ez._create("sqrt",200,200),ez._create("inversesqrt",200,200),ez._create("abs",200,200),ez._create("abs",201,201),ez._create("sign",200,200),ez._create("sign",201,201),ez._create("floor",200,200),ez._create("trunc",200,200),ez._create("round",200,200),ez._create("roundEven",200,200),ez._create("ceil",200,200),ez._create("fract",200,200),ez._create("mod",200,200,eV.FLOAT),ez._create("mod",200,200,200),ez._create("min",200,200,200),ez._create("min",200,200,eV.FLOAT),ez._create("min",201,201,201),ez._create("min",201,201,eV.INT),ez._create("min",202,202,202),ez._create("min",202,202,eV.UINT),ez._create("max",200,200,200),ez._create("max",200,200,eV.FLOAT),ez._create("max",201,201,201),ez._create("max",201,201,eV.INT),ez._create("clamp",200,200,200,200),ez._create("clamp",200,200,eV.FLOAT,eV.FLOAT),ez._create("clamp",201,201,201,201),ez._create("clamp",201,201,eV.INT,eV.INT),ez._create("clamp",202,202,202,202),ez._create("clamp",202,202,eV.UINT,eV.UINT),ez._create("mix",200,200,200,200),ez._create("mix",200,200,200,eV.FLOAT),ez._create("mix",200,200,200,203),ez._create("step",200,200,200),ez._create("step",200,eV.FLOAT,200),ez._create("smoothstep",200,200,200,200),ez._create("smoothstep",200,eV.FLOAT,eV.FLOAT,200),ez._create("isnan",203,200),ez._create("isinf",203,200),ez._create("floatBitsToInt",200,200),ez._create("floatBitsToUint",202,200),ez._create("intBitsToFloat",200,201),ez._create("uintBitsToFloat",200,202),ez._create("packSnorm2x16",eV.UINT,eV.VEC2),ez._create("unpackSnorm2x16",eV.VEC2,eV.UINT),ez._create("packUnorm2x16",eV.UINT,eV.VEC2),ez._create("unpackUnorm2x16",eV.VEC2,eV.UINT),ez._create("packHalf2x16",eV.UINT,eV.VEC2),ez._create("unpackHalf2x16",eV.VEC2,eV.UINT),ez._create("length",eV.FLOAT,200),ez._create("distance",eV.FLOAT,200,200),ez._create("dot",eV.FLOAT,200,200),ez._create("cross",eV.VEC3,eV.VEC3,eV.VEC3),ez._create("normalize",200,200),ez._create("faceforward",200,200,200,200),ez._create("reflect",200,200,200),ez._create("refract",200,200,200,eV.FLOAT),ez._create("matrixCompMult",204,204,204),ez._create("outerProduct",eV.MAT2,eV.VEC2,eV.VEC2),ez._create("outerProduct",eV.MAT3,eV.VEC3,eV.VEC3),ez._create("outerProduct",eV.MAT4,eV.VEC4,eV.VEC4),ez._create("outerProduct",eV.MAT2X3,eV.VEC3,eV.VEC2),ez._create("outerProduct",eV.MAT3X2,eV.VEC2,eV.VEC3),ez._create("outerProduct",eV.MAT2X4,eV.VEC4,eV.VEC2),ez._create("outerProduct",eV.MAT4X2,eV.VEC2,eV.VEC4),ez._create("outerProduct",eV.MAT3X4,eV.VEC4,eV.VEC3),ez._create("outerProduct",eV.MAT4X3,eV.VEC3,eV.VEC4),ez._create("transpose",eV.MAT2,eV.MAT2),ez._create("transpose",eV.MAT3,eV.MAT3),ez._create("transpose",eV.MAT4,eV.MAT4),ez._create("transpose",eV.MAT2X3,eV.MAT3X2),ez._create("transpose",eV.MAT3X2,eV.MAT2X3),ez._create("transpose",eV.MAT4X2,eV.MAT2X4),ez._create("transpose",eV.MAT2X4,eV.MAT4X2),ez._create("transpose",eV.MAT3X4,eV.MAT4X3),ez._create("transpose",eV.MAT4X3,eV.MAT3X4),ez._create("determinant",eV.FLOAT,eV.MAT2),ez._create("determinant",eV.FLOAT,eV.MAT3),ez._create("determinant",eV.FLOAT,eV.MAT4),ez._create("inverse",eV.MAT2,eV.MAT2),ez._create("inverse",eV.MAT3,eV.MAT3),ez._create("inverse",eV.MAT4,eV.MAT4),ez._create("lessThan",205,208,208),ez._create("lessThan",205,206,206),ez._create("lessThan",205,207,207),ez._create("lessThanEqual",205,208,208),ez._create("lessThanEqual",205,206,206),ez._create("lessThanEqual",205,207,207),ez._create("greaterThan",205,208,208),ez._create("greaterThan",205,206,206),ez._create("greaterThan",205,207,207),ez._create("greaterThanEqual",205,208,208),ez._create("greaterThanEqual",205,206,206),ez._create("greaterThanEqual",205,207,207),ez._create("equal",205,208,208),ez._create("equal",205,206,206),ez._create("equal",205,207,207),ez._create("equal",205,205,205),ez._create("notEqual",205,208,208),ez._create("notEqual",205,206,206),ez._create("notEqual",205,207,207),ez._create("notEqual",205,205,205),ez._create("any",eV.BOOL,205),ez._create("all",eV.BOOL,205),ez._create("not",205,205),ez._create("textureSize",eV.IVEC2,210,eV.INT),ez._create("textureSize",eV.IVEC3,211,eV.INT),ez._create("textureSize",eV.IVEC2,212,eV.INT),ez._create("textureSize",eV.IVEC2,eV.SAMPLER2D_SHADOW,eV.INT),ez._create("textureSize",eV.IVEC2,eV.SAMPLER_CUBE_SHADOW,eV.INT),ez._create("textureSize",eV.IVEC3,213,eV.INT),ez._create("textureSize",eV.IVEC3,eV.SAMPLER2D_ARRAY_SHADOW,eV.INT),ez._create("texture2D",eV.VEC4,eV.SAMPLER2D,eV.VEC2),ez._create("texture2D",eV.VEC4,eV.SAMPLER2D,eV.VEC2,eV.FLOAT),ez._create("texture",209,210,eV.VEC2,eV.FLOAT),ez._create("texture",209,210,eV.VEC2),ez._create("texture",209,211,eV.VEC3,eV.FLOAT),ez._create("texture",209,211,eV.VEC3),ez._create("texture",209,212,eV.VEC3,eV.FLOAT),ez._create("texture",209,212,eV.VEC3),ez._create("texture",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC3,eV.FLOAT),ez._create("texture",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC3),ez._create("texture",eV.FLOAT,eV.SAMPLER_CUBE_SHADOW,eV.VEC4,eV.FLOAT),ez._create("texture",eV.FLOAT,eV.SAMPLER_CUBE_SHADOW,eV.VEC4),ez._create("texture",209,eV.SAMPLER2D_ARRAY,eV.VEC3,eV.FLOAT),ez._create("texture",209,eV.SAMPLER2D_ARRAY,eV.VEC3),ez._create("texture",eV.FLOAT,eV.SAMPLER2D_ARRAY_SHADOW,eV.VEC4),ez._create("textureProj",209,210,eV.VEC3,eV.FLOAT),ez._create("textureProj",209,210,eV.VEC3),ez._create("textureProj",209,210,eV.VEC4,eV.FLOAT),ez._create("textureProj",209,210,eV.VEC4),ez._create("textureProj",209,211,eV.VEC4,eV.FLOAT),ez._create("textureProj",209,211,eV.VEC4),ez._create("textureProj",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC4,eV.FLOAT),ez._create("textureProj",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC4),ez._create("textureLod",209,210,eV.VEC2,eV.FLOAT),ez._create("textureLod",209,211,eV.VEC3,eV.FLOAT),ez._create("textureLod",209,212,eV.VEC3,eV.FLOAT),ez._create("textureLod",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC3,eV.FLOAT),ez._create("textureLod",209,213,eV.VEC3,eV.FLOAT),ez._create("texture2DLodEXT",209,210,eV.VEC2,eV.FLOAT),ez._create("texture2DLodEXT",209,211,eV.VEC3,eV.FLOAT),ez._create("textureCube",eV.SAMPLER_CUBE,eV.VEC3),ez._create("textureCube",eV.SAMPLER_CUBE,eV.VEC3,eV.FLOAT),ez._create("textureCube",209,212,eV.VEC3,eV.FLOAT),ez._create("textureCubeLod",eV.SAMPLER_CUBE,eV.VEC3,eV.FLOAT),ez._create("textureCubeLodEXT",209,212,eV.VEC3,eV.FLOAT),ez._create("textureOffset",209,210,eV.VEC2,eV.IVEC2,eV.FLOAT),ez._create("textureOffset",209,210,eV.VEC2,eV.IVEC2),ez._create("textureOffset",209,211,eV.VEC3,eV.IVEC3,eV.FLOAT),ez._create("textureOffset",209,211,eV.VEC3,eV.IVEC3),ez._create("textureOffset",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC3,eV.IVEC2,eV.FLOAT),ez._create("textureOffset",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC3,eV.IVEC2),ez._create("textureOffset",209,213,eV.VEC3,eV.IVEC2,eV.FLOAT),ez._create("textureOffset",209,213,eV.VEC3,eV.IVEC2),ez._create("texelFetch",209,210,eV.IVEC2,eV.INT),ez._create("texelFetch",209,211,eV.IVEC3,eV.INT),ez._create("texelFetch",209,213,eV.IVEC3,eV.INT),ez._create("texelFetchOffset",209,210,eV.IVEC2,eV.INT,eV.IVEC2),ez._create("texelFetchOffset",209,211,eV.IVEC3,eV.INT,eV.IVEC3),ez._create("texelFetchOffset",209,213,eV.IVEC3,eV.INT,eV.IVEC2),ez._create("textureProjOffset",209,210,eV.VEC3,eV.IVEC2,eV.FLOAT),ez._create("textureProjOffset",209,210,eV.VEC3,eV.IVEC2),ez._create("textureProjOffset",209,210,eV.VEC4,eV.IVEC2,eV.FLOAT),ez._create("textureProjOffset",209,210,eV.VEC4,eV.IVEC2),ez._create("textureProjOffset",209,211,eV.VEC4,eV.IVEC3,eV.FLOAT),ez._create("textureProjOffset",209,211,eV.VEC4,eV.IVEC3),ez._create("textureProjOffset",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC4,eV.IVEC2,eV.FLOAT),ez._create("textureProjOffset",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC4,eV.IVEC2),ez._create("textureLodOffset",209,210,eV.VEC2,eV.FLOAT,eV.IVEC2),ez._create("textureLodOffset",209,211,eV.VEC3,eV.FLOAT,eV.IVEC3),ez._create("textureLodOffset",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC3,eV.FLOAT,eV.IVEC2),ez._create("textureLodOffset",209,213,eV.VEC3,eV.FLOAT,eV.IVEC2),ez._create("textureProjLod",209,210,eV.VEC3,eV.FLOAT),ez._create("textureProjLod",209,210,eV.VEC4,eV.FLOAT),ez._create("textureProjLod",209,211,eV.VEC4,eV.FLOAT),ez._create("textureProjLod",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC4,eV.FLOAT),ez._create("textureProjLodOffset",209,210,eV.VEC3,eV.FLOAT,eV.IVEC2),ez._create("textureProjLodOffset",209,210,eV.VEC4,eV.FLOAT,eV.IVEC2),ez._create("textureProjLodOffset",209,211,eV.VEC4,eV.FLOAT,eV.IVEC3),ez._create("textureProjLodOffset",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC4,eV.FLOAT,eV.IVEC2),ez._create("textureGrad",209,210,eV.VEC2,eV.VEC2,eV.VEC2),ez._create("textureGrad",209,211,eV.VEC3,eV.VEC3,eV.VEC3),ez._create("textureGrad",209,212,eV.VEC3,eV.VEC3,eV.VEC3),ez._create("textureGrad",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC3,eV.VEC2,eV.VEC2),ez._create("textureGrad",eV.FLOAT,eV.SAMPLER_CUBE_SHADOW,eV.VEC4,eV.VEC3,eV.VEC3),ez._create("textureGrad",209,213,eV.VEC3,eV.VEC2,eV.VEC2),ez._create("textureGrad",eV.FLOAT,eV.SAMPLER2D_ARRAY_SHADOW,eV.VEC4,eV.VEC2,eV.VEC2),ez._create("textureGradOffset",209,210,eV.VEC2,eV.VEC2,eV.VEC2,eV.IVEC2),ez._create("textureGradOffset",209,211,eV.VEC3,eV.VEC3,eV.VEC3,eV.IVEC3),ez._create("textureGradOffset",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC3,eV.VEC2,eV.VEC2,eV.IVEC2),ez._create("textureGradOffset",209,213,eV.VEC3,eV.VEC2,eV.VEC2,eV.IVEC2),ez._create("textureGradOffset",eV.FLOAT,eV.SAMPLER2D_ARRAY_SHADOW,eV.VEC3,eV.VEC2,eV.VEC2,eV.IVEC2),ez._create("textureProjGrad",209,210,eV.VEC3,eV.VEC2,eV.VEC2),ez._create("textureProjGrad",209,210,eV.VEC4,eV.VEC2,eV.VEC2),ez._create("textureProjGrad",209,211,eV.VEC4,eV.VEC3,eV.VEC3),ez._create("textureProjGrad",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC4,eV.VEC2,eV.VEC2),ez._create("textureProjGradOffset",209,210,eV.VEC3,eV.VEC2,eV.VEC2,eV.IVEC2),ez._create("textureProjGradOffset",209,210,eV.VEC4,eV.VEC2,eV.VEC2,eV.IVEC2),ez._create("textureProjGradOffset",209,211,eV.VEC4,eV.VEC3,eV.VEC3,eV.IVEC3),ez._create("textureProjGradOffset",eV.FLOAT,eV.SAMPLER2D_SHADOW,eV.VEC4,eV.VEC2,eV.VEC2,eV.IVEC2),ez._createWithScop("dFdx",200,ew.FRAGMENT,200),ez._createWithScop("dFdy",200,ew.FRAGMENT,200),ez._createWithScop("fwidth",200,ew.FRAGMENT,200);var eq=new Map,eX=/*#__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=ew.ALL);var i=new e(r,t,n);eq.set(t,i)},e.getVar=function(e){return eq.get(e)},e}();eX.createVariable("gl_VertexID",eV.INT,ew.VERTEX),eX.createVariable("gl_InstanceID",eV.INT,ew.VERTEX),eX.createVariable("gl_Position",eV.VEC4,ew.VERTEX),eX.createVariable("gl_PointSize",eV.FLOAT,ew.VERTEX),eX.createVariable("gl_FragCoord",eV.VEC4,ew.FRAGMENT),eX.createVariable("gl_FrontFacing",eV.BOOL,ew.FRAGMENT),eX.createVariable("gl_FragDepth",eV.FLOAT,ew.FRAGMENT),eX.createVariable("gl_PointCoord",eV.VEC2,ew.FRAGMENT),eX.createVariable("gl_FragColor",eV.VEC4,ew.FRAGMENT),eX.createVariable("gl_FragData",eV.VEC4_ARRAY,ew.FRAGMENT),eX.createVariable("gl_MaxVertexAttribs",eV.INT),eX.createVariable("gl_MaxVertexUniformVectors",eV.INT),eX.createVariable("gl_MaxVertexOutputVectors",eV.INT),eX.createVariable("gl_MaxFragmentInputVectors",eV.INT),eX.createVariable("gl_MaxVertexTextureImageUnits",eV.INT),eX.createVariable("gl_MaxCombinedTextureImageUnits",eV.INT),eX.createVariable("gl_MaxTextureImageUnits",eV.INT),eX.createVariable("gl_MaxFragmentUniformVectors",eV.INT),eX.createVariable("gl_MaxDrawBuffers",eV.INT),eX.createVariable("gl_MinProgramTexelOffset",eV.INT),eX.createVariable("gl_MaxProgramTexelOffset",eV.INT);var eQ=((h={})[h.START=2e3]="START",h[h.gs_shader_program=2001]="gs_shader_program",h[h.global_declaration=2002]="global_declaration",h[h.variable_declaration=2003]="variable_declaration",h[h.variable_declaration_list=2004]="variable_declaration_list",h[h.variable_declaration_statement=2005]="variable_declaration_statement",h[h.array_specifier_list=2006]="array_specifier_list",h[h.array_specifier=2007]="array_specifier",h[h.ext_builtin_type_specifier_nonarray=2008]="ext_builtin_type_specifier_nonarray",h[h.precision_specifier=2009]="precision_specifier",h[h.variable_identifier=2010]="variable_identifier",h[h.variable_identifier_node=2011]="variable_identifier_node",h[h.primary_expression=2012]="primary_expression",h[h.postfix_expression=2013]="postfix_expression",h[h.integer_expression=2014]="integer_expression",h[h.function_call=2015]="function_call",h[h.function_call_generic=2016]="function_call_generic",h[h.function_call_header_no_parameters=2017]="function_call_header_no_parameters",h[h.function_call_header_with_parameters=2018]="function_call_header_with_parameters",h[h.function_call_parameter_list=2019]="function_call_parameter_list",h[h.function_call_header=2020]="function_call_header",h[h.function_identifier=2021]="function_identifier",h[h.constructor_identifier=2022]="constructor_identifier",h[h.unary_expression=2023]="unary_expression",h[h.unary_operator=2024]="unary_operator",h[h.multiplicative_expression=2025]="multiplicative_expression",h[h.additive_expression=2026]="additive_expression",h[h.shift_expression=2027]="shift_expression",h[h.relational_expression=2028]="relational_expression",h[h.equality_expression=2029]="equality_expression",h[h.and_expression=2030]="and_expression",h[h.inclusive_or_expression=2031]="inclusive_or_expression",h[h.exclusive_or_expression=2032]="exclusive_or_expression",h[h.logical_and_expression=2033]="logical_and_expression",h[h.logical_xor_expression=2034]="logical_xor_expression",h[h.logical_or_expression=2035]="logical_or_expression",h[h.conditional_expression=2036]="conditional_expression",h[h.assignment_expression=2037]="assignment_expression",h[h.assignment_operator=2038]="assignment_operator",h[h.expression=2039]="expression",h[h.integer_constant_expression=2040]="integer_constant_expression",h[h.integer_constant_expression_operator=2041]="integer_constant_expression_operator",h[h.declaration=2042]="declaration",h[h.function_prototype=2043]="function_prototype",h[h.function_declarator=2044]="function_declarator",h[h.function_header_with_parameters=2045]="function_header_with_parameters",h[h.function_header=2046]="function_header",h[h.function_parameter_list=2047]="function_parameter_list",h[h.parameter_declarator=2048]="parameter_declarator",h[h.parameter_declaration=2049]="parameter_declaration",h[h.parameter_qualifier=2050]="parameter_qualifier",h[h.parameter_type_specifier=2051]="parameter_type_specifier",h[h.init_declarator_list=2052]="init_declarator_list",h[h.single_declaration=2053]="single_declaration",h[h.fully_specified_type=2054]="fully_specified_type",h[h.type_qualifier=2055]="type_qualifier",h[h.single_type_qualifier=2056]="single_type_qualifier",h[h.storage_qualifier=2057]="storage_qualifier",h[h.precision_qualifier=2058]="precision_qualifier",h[h.interpolation_qualifier=2059]="interpolation_qualifier",h[h.invariant_qualifier=2060]="invariant_qualifier",h[h.type_specifier=2061]="type_specifier",h[h.type_specifier_nonarray=2062]="type_specifier_nonarray",h[h.type_specifier_no_prec=2063]="type_specifier_no_prec",h[h.basic_type=2064]="basic_type",h[h.struct_specifier=2065]="struct_specifier",h[h.struct_declaration_list=2066]="struct_declaration_list",h[h.struct_declaration=2067]="struct_declaration",h[h.layout_qualifier=2068]="layout_qualifier",h[h.struct_declarator_list=2069]="struct_declarator_list",h[h.struct_declarator=2070]="struct_declarator",h[h.identifier_list=2071]="identifier_list",h[h.decl_identifier=2072]="decl_identifier",h[h.initializer=2073]="initializer",h[h.initializer_list=2074]="initializer_list",h[h.declaration_statement=2075]="declaration_statement",h[h.simple_statement=2076]="simple_statement",h[h.compound_statement_no_scope=2077]="compound_statement_no_scope",h[h.statement_with_scope=2078]="statement_with_scope",h[h.compound_statement=2079]="compound_statement",h[h.statement=2080]="statement",h[h.statement_list=2081]="statement_list",h[h.iteration_statement_no_new_scope=2082]="iteration_statement_no_new_scope",h[h.expression_statement=2083]="expression_statement",h[h.selection_statement=2084]="selection_statement",h[h.selection_rest_statement=2085]="selection_rest_statement",h[h.condition=2086]="condition",h[h.conditionopt=2087]="conditionopt",h[h.iteration_statement=2088]="iteration_statement",h[h.for_init_statement=2089]="for_init_statement",h[h.for_rest_statement=2090]="for_rest_statement",h[h.jump_statement=2091]="jump_statement",h[h.external_declaration=2092]="external_declaration",h[h.function_definition=2093]="function_definition",h[h.field_selection=2094]="field_selection",h[h.bool_constant=2095]="bool_constant",h[h.function_identifier_node=2096]="function_identifier_node",h[h.typename_identifier_node=2097]="typename_identifier_node",h[h.scope_brace=2098]="scope_brace",h[h.scope_end_brace=2099]="scope_end_brace",h[h.macro_undef=2100]="macro_undef",h[h.macro_push_context=2101]="macro_push_context",h[h.macro_pop_context=2102]="macro_pop_context",h[h.macro_elif_expression=2103]="macro_elif_expression",h[h.macro_else_expression=2104]="macro_else_expression",h[h.global_macro_if_statement=2105]="global_macro_if_statement",h[h.global_macro_declaration=2106]="global_macro_declaration",h[h.global_macro_branch=2107]="global_macro_branch",h[h.macro_struct_declaration=2108]="macro_struct_declaration",h[h.macro_struct_branch=2109]="macro_struct_branch",h[h.macro_if_statement=2110]="macro_if_statement",h[h.macro_branch=2111]="macro_branch",h[h.macro_param_case_list=2112]="macro_param_case_list",h[h.macro_param_block=2113]="macro_param_block",h[h.macro_parameter_branch=2114]="macro_parameter_branch",h[h.macro_call_arg_case_list=2115]="macro_call_arg_case_list",h[h.macro_call_arg_block=2116]="macro_call_arg_block",h[h.macro_call_arg_branch=2117]="macro_call_arg_branch",h[h.macro_call_symbol=2118]="macro_call_symbol",h[h.macro_call_function=2119]="macro_call_function",h[h._ignore=2120]="_ignore",h),eY=/*#__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}(),eK=/*#__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 eJ(e){return(eJ=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eZ(e){var t="function"==typeof Map?new Map:void 0;return(eZ=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,r)}function r(){return eU(e,arguments,eJ(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),n(r,e)})(e)}var e$=/*#__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 i(t,e),t.prototype.toString=function(){var e=this.message,t=this.location,n=this.source;return n?(r(t,eN)||(t.start,t.end),n.split("\n"),this.name+": "+e+"\n\n"):e},t}(eZ(Error));e$.wrappingLineCount=2;var e0=((f={}).PreprocessorError="PreprocessorError",f.CompilationError="CompilationError",f.ScannerError="ScannerError",f.CompilationWarn="CompilationWarning",f),e2=function(e,t,r){this.type=e,this.typeLexeme=t,this.arraySpecifier=r},e1=((d={})[d.VAR=0]="VAR",d[d.FN=1]="FN",d[d.STRUCT=2]="STRUCT",d[d.Any=3]="Any",d),e3=/*#__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}(),e4=/*#__PURE__*/function(e){function t(t,r){var n=new e2(r.protoType.returnType.type,r.protoType.returnType.typeSpecifier.lexeme);return e.call(this,t,e1.FN,r,n)||this}return i(t,e),t}(e3),e9=/*#__PURE__*/function(e){function t(t,r){return e.call(this,t,e1.STRUCT,r)||this}return i(t,e),t}(e3),e5=/*#__PURE__*/function(e){function t(t,r,n,i){var a;return(a=e.call(this,t,e1.VAR,i,r)||this).isGlobalVariable=n,a}return i(t,e),t}(e3),e6=/*#__PURE__*/function(){function e(){this.globalPrecisions=[],this.globalMacroDeclarations=[]}return e.prototype.getOuterGlobalMacroDeclarations=function(){return this.globalMacroDeclarations.filter(function(e){return r(e.parent,eP.GLShaderProgram)})},e}(),e7=/*#__PURE__*/function(){function e(){this.semanticStack=[],this.acceptRule=void 0,this.symbolTableStack=new eK,this.curFunctionInfo={},this._shaderData=new e6,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 e6,this.symbolTableStack.clear(),this.pushScope()},r.pushScope=function(){this.symbolTableStack.pushScope(new eY)},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 e$(e0.CompilationWarn,r,e,tR._processingPassText).toString())},o(e,[{key:"shaderData",get:function(){return this._shaderData}},{key:"macroDefineList",get:function(){return this._macroDefineList}}]),e}();e7._lookupSymbol=new e3("",null);var e8=function(e,t,r){this.type=e,this.typeLexeme=t,this.arraySpecifier=r},te=function(e,t,r,n){void 0===n&&(n=!1),this.typeInfo=e,this.ident=t,this.mrtIndex=r,this.isInMacroBranch=n};function tt(e){return function(t){t.prototype.nt=e,t.pool=eG.createObjectPool(t)}}var tr=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(t,n){this._location=t,this._children=n;for(var i,a=c(n);!(i=a()).done;){var o=i.value;r(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=eP||(eP={}))._unwrapToken=function(e){if(r(e,eF))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 i(t,e),t}(tr),m.TrivialNode=S,S=l([tt(eQ._ignore)],S),v=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.semanticAnalyze=function(e){e.pushScope()},t}(tr),m.ScopeBrace=v,v=l([tt(eQ.scope_brace)],v),g=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.semanticAnalyze=function(e){e.popScope()},t}(tr),m.ScopeEndBrace=g,g=l([tt(eQ.scope_end_brace)],g),y=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var r=t.prototype;return r.init=function(){this.isFragReturnStatement=!1},r.semanticAnalyze=function(e){m._unwrapToken(this.children[0]).type===eV.RETURN&&(e.curFunctionInfo.returnStatement=this)},r.codeGen=function(e){return this.setCache(e.visitJumpStatement(this))},t}(tr),m.JumpStatement=y,y=l([tt(eQ.jump_statement)],y),E=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(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}(tr),m.ExpressionAstNode=E,C=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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 e8(i.type,a.lexeme,this.arraySpecifier),c=r[3];t=new e5(o.lexeme,s,!1,c)}else{var l=r[2];this.arraySpecifier=l;var u=new e8(i.type,a.lexeme,this.arraySpecifier),p=r[4];t=new e5(o.lexeme,u,!1,p)}e.symbolTableStack.insert(t)},r.codeGen=function(e){return this.setCache(e.visitSingleDeclaration(this))},t}(tr),m.SingleDeclaration=C,C=l([tt(eQ.single_declaration)],C),x=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(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}(tr),m.FullySpecifiedType=x,x=l([tt(eQ.fully_specified_type)],x),A=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(tr),m.TypeQualifier=A,A=l([tt(eQ.type_qualifier)],A),T=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];r(t,eF)?this.qualifier=t.type:this.qualifier=t.qualifier,this.lexeme=t.lexeme},t}(tr),m.SingleTypeQualifier=T,T=l([tt(eQ.single_type_qualifier)],T),b=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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}(tr),m.TypeSpecifier=b,b=l([tt(eQ.type_specifier)],b),O=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[1];this.size=t.value},t}(tr),m.ArraySpecifier=O,O=l([tt(eQ.array_specifier)],O),I=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];switch(this.lexeme=t.lexeme,t.type){case eD.PLUS:this.compute=function(e,t){return e+t};break;case eD.DASH:this.compute=function(e,t){return e-t};break;case eD.STAR:this.compute=function(e,t){return e*t};break;case eD.SLASH:this.compute=function(e,t){return e/t};break;case eD.PERCENT:this.compute=function(e,t){return e%t};break;default:e.reportError(t.location,"not implemented operator "+t.lexeme)}},t}(tr),m.IntegerConstantExpressionOperator=I,I=l([tt(eQ.integer_constant_expression_operator)],I),L=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.init=function(){this.value=void 0},n.semanticAnalyze=function(e){if(1===this.children.length){var t=this.children[0];r(t,eF)&&(this.value=Number(t.lexeme))}},t}(tr),m.IntegerConstantExpression=L,L=l([tt(eQ.integer_constant_expression)],L),R=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.init=function(){var e=this.children[0];r(e,eF)?this.type=e.lexeme:this.type=e.type,this.lexeme=e.lexeme},t}(tr),m.TypeSpecifierNonArray=R,R=l([tt(eQ.type_specifier_nonarray)],R),P=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.init=function(){var e=this.children[0];this.type=e.type,this.lexeme=e.lexeme},t}(tr),m.ExtBuiltinTypeSpecifierNonArray=P,P=l([tt(eQ.ext_builtin_type_specifier_nonarray)],P),M=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(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 e8(a.type,a.lexeme,o)}else{var s=r[0];this.typeInfo=s.typeInfo}if(3===n||5===n)t=new e5(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 e5(r[2].lexeme,c,!1,this),e.symbolTableStack.insert(t)}},t}(tr),m.InitDeclaratorList=M,M=l([tt(eQ.init_declarator_list)],M),N=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.idList=[],t}i(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}(tr),m.IdentifierList=N,N=l([tt(eQ.identifier_list)],N),D=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.codeGen=function(e){return this.setCache(e.visitDeclaration(this))},t}(tr),m.Declaration=D,D=l([tt(eQ.declaration)],D),V=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(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}(tr),m.FunctionProtoType=V,V=l([tt(eQ.function_prototype)],V),G=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(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}(tr),m.FunctionDeclarator=G,G=l([tt(eQ.function_declarator)],G),F=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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}(tr),m.FunctionHeader=F,F=l([tt(eQ.function_header)],F),k=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.parameterInfoList=[],t.paramSig=[],t}i(t,e);var n=t.prototype;return n.init=function(){this.parameterInfoList.length=0,this.paramSig.length=0},n.semanticAnalyze=function(e){var n=this.children,i=this.parameterInfoList,a=this.paramSig;if(r(n[0],w)){var o,s,c=n[0];i.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(r(n[2],w)){var l,u,p=n[0],_=n[2];i.push.apply(i,[].concat(p.parameterInfoList,[{ident:_.ident,typeInfo:_.typeInfo,astNode:_}])),a.push.apply(a,[].concat(p.paramSig,[null!=(u=null==(l=_.typeInfo)?void 0:l.type)?u:3e3]))}else r(n[0],t)&&r(n[1],W)?(i.push.apply(i,[].concat(n[0].parameterInfoList,[{astNode:n[1]}])),a.push.apply(a,[].concat(n[0].paramSig,[3e3]))):r(n[0],W)&&(i.push({astNode:n[0]}),a.push(3e3))},n.codeGen=function(e){return this.setCache(e.visitFunctionParameterList(this))},t}(tr),m.FunctionParameterList=k,k=l([tt(eQ.function_parameter_list)],k),B=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(tr),m.MacroParamCaseList=B,B=l([tt(eQ.macro_param_case_list)],B),W=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(tr),m.MacroParamBlock=W,W=l([tt(eQ.macro_param_block)],W),U=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(tr),m.MacroParameterBranch=U,U=l([tt(eQ.macro_parameter_branch)],U),w=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.init=function(){this.typeInfo=void 0,this.ident=void 0},n.semanticAnalyze=function(e){var t,n=this.children;if(r(n[0],H)?t=n[0]:r(n[1],H)&&(t=n[1]),t){this.typeInfo=t.typeInfo,this.ident=t.ident;var i=new e5(t.ident.lexeme,t.typeInfo,!1,t);e.symbolTableStack.insert(i)}},t}(tr),m.ParameterDeclaration=w,w=l([tt(eQ.parameter_declaration)],w),H=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(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 e8(r.type,r.lexeme,n)},t}(tr),m.ParameterDeclarator=H,H=l([tt(eQ.parameter_declarator)],H),j=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(tr),m.CompoundStatementNoScope=j,j=l([tt(eQ.compound_statement_no_scope)],j),z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.codeGen=function(e){return this.setCache(e.visitStatementList(this))},t}(tr),m.StatementList=z,z=l([tt(eQ.statement_list)],z),q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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 e4(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===eV.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}(tr),m.FunctionDefinition=q,q=l([tt(eQ.function_definition)],q),X=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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([tt(eQ.function_call)],X),Q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.init=function(){e.prototype.init.call(this),this.fnSymbol=void 0},n.semanticAnalyze=function(e){var t=this.children[0];if(t.isBuiltin)this.type=t.ident;else{var n,i,a=t.ident;if(4===this.children.length){var o=this.children[2];r(o,Y)&&(i=o.paramSig)}var s=e7._lookupSymbol;s.set(a,e1.FN,void 0,void 0,i);var c=e.symbolTableStack.lookup(s,!0);if(!c)return;this.type=null==c?void 0:null==(n=c.dataType)?void 0:n.type,this.fnSymbol=c}},t}(E),m.FunctionCallGeneric=Q,Q=l([tt(eQ.function_call_generic)],Q),Y=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.paramSig=[],t.paramNodes=[],t}i(t,e);var n=t.prototype;return n.init=function(){this.paramSig.length=0,this.paramNodes.length=0},n.semanticAnalyze=function(e){var n=this.children,i=this.paramSig,a=this.paramNodes;if(r(n[0],et)){var o=n[0];i.push(o.type),a.push(o)}else if(r(n[2],et)){var s=n[0],c=n[2];i.push.apply(i,[].concat(s.paramSig,[c.type])),a.push.apply(a,[].concat(s.paramNodes,[c]))}else r(n[0],t)&&r(n[1],J)?(i.push.apply(i,[].concat(n[0].paramSig,[3e3])),a.push.apply(a,[].concat(n[0].paramNodes,[n[1]]))):r(n[0],J)&&(i.push(3e3),a.push(n[0]))},t}(tr),m.FunctionCallParameterList=Y,Y=l([tt(eQ.function_call_parameter_list)],Y),K=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(tr),m.MacroCallArgCaseList=K,K=l([tt(eQ.macro_call_arg_case_list)],K),J=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(tr),m.MacroCallArgBlock=J,J=l([tt(eQ.macro_call_arg_block)],J),Z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(tr),m.MacroCallArgBranch=Z,Z=l([tt(eQ.macro_call_arg_branch)],Z),$=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.semanticAnalyze=function(e){e.symbolTableStack.isInMacroBranch||e.shaderData.globalPrecisions.push(this)},t}(tr),m.PrecisionSpecifier=$,$=l([tt(eQ.precision_specifier)],$),ee=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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}(tr),m.FunctionIdentifier=ee,ee=l([tt(eQ.function_identifier)],ee),et=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(E),m.AssignmentExpression=et,et=l([tt(eQ.assignment_expression)],et),er=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(E),m.Expression=er,er=l([tt(eQ.expression)],er),en=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t,n=this.children[0];if(r(n,ed))this.type=null!=(t=n.typeInfo)?t:3e3;else switch(n.type){case eD.INT_CONSTANT:this._type=eV.INT;break;case eD.FLOAT_CONSTANT:this.type=eV.FLOAT;break;case eV.True:case eV.False:this.type=eV.BOOL}}else{var i=this.children[1];this.type=i.type}},t}(E),m.PrimaryExpression=en,en=l([tt(eQ.primary_expression)],en),ei=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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([tt(eQ.postfix_expression)],ei),ea=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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 e9(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}(tr),m.StructSpecifier=ea,ea=l([tt(eQ.struct_specifier)],ea),eo=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.propList=[],t.macroExpressions=[],t}i(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}(tr),m.StructDeclarationList=eo,eo=l([tt(eQ.struct_declaration_list)],eo),es=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}i(t,e);var n=t.prototype;return n.init=function(){this._typeSpecifier=void 0,this._declaratorList=void 0,this.props.length=0,this.macroExpressions.length=0},n.semanticAnalyze=function(e){var t=this.children,n=this.props,i=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,n.push(o[s]);i.push.apply(i,[].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,_=u.lexeme,h=e.symbolTableStack.isInMacroBranch;if(r(l,eu)){var f=t[2],d=new te(new e8(p,_),f.ident,l.index,h);n.push(d)}else{var m=this._declaratorList.declaratorList,S=m.length;n.length=S;for(var v=0;v<S;v++){var g=m[v],y=new te(new e8(p,_,g.arraySpecifier),g.ident,void 0,h);n[v]=y}}},t}(tr),m.StructDeclaration=es,es=l([tt(eQ.struct_declaration)],es),ec=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}i(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}(tr),m.MacroStructDeclaration=ec,ec=l([tt(eQ.macro_struct_declaration)],ec),el=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}i(t,e);var n=t.prototype;return n.init=function(){this.props.length=0,this.macroExpressions.length=0},n.semanticAnalyze=function(){var e,n,i,a,o=this.children,s=o[o.length-1];this.macroExpressions.push(o[0]),r(o[1],eo)&&((e=this.props).push.apply(e,[].concat(o[1].propList)),(n=this.macroExpressions).push.apply(n,[].concat(o[1].macroExpressions))),r(s,t)&&((i=this.props).push.apply(i,[].concat(s.props)),(a=this.macroExpressions).push.apply(a,[].concat(s.macroExpressions))),o.length>1&&r(s,ey)&&this.macroExpressions.push(s)},t}(tr),m.MacroStructBranch=el,el=l([tt(eQ.macro_struct_branch)],el),eu=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.semanticAnalyze=function(e){this.index=Number(this.children[4].lexeme)},t}(tr),m.LayoutQualifier=eu,eu=l([tt(eQ.layout_qualifier)],eu),ep=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.declaratorList=[],t}i(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}(tr),m.StructDeclaratorList=ep,ep=l([tt(eQ.struct_declarator_list)],ep),e_=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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}(tr),m.StructDeclarator=e_,e_=l([tt(eQ.struct_declarator)],e_),eh=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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 e5(n.lexeme,new e8(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}(tr),m.VariableDeclaration=eh,eh=l([tt(eQ.variable_declaration)],eh),ef=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.variableDeclarations=[],t}i(t,e);var n=t.prototype;return n.init=function(){this.variableDeclarations.length=0},n.semanticAnalyze=function(e){var t=this.children,n=t.length,i=t[0],a=i.type;if(this.type=a,r(i,eh))this.variableDeclarations.push(i);else{(o=this.variableDeclarations).push.apply(o,[].concat(i.variableDeclarations));var o,s=t[2],c=eh.pool.get();3===n?c.set(s.location,[a,s]):c.set(s.location,[a,s,t[3]]),c.semanticAnalyze(e),this.variableDeclarations.push(c)}},t}(tr),m.VariableDeclarationList=ef,ef=l([tt(eQ.variable_declaration_list)],ef),ed=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.referenceGlobalSymbolNames=[],t._symbols=[],t}i(t,e);var n=t.prototype;return n.init=function(){this.typeInfo=3e3,this.referenceGlobalSymbolNames.length=0,this._symbols.length=0},n.semanticAnalyze=function(e){var t=this.children[0],n=this.referenceGlobalSymbolNames,i=this._symbols,a=e7._lookupSymbol;l=r(t,eF)?[t.lexeme]:t.referenceSymbolNames;for(var o=0;o<l.length;o++){var s=l[o];if(!(e.macroDefineList[s]||!r(t,eF)&&ez.isExist(s))){var c=eX.getVar(s);if(c){this.typeInfo=c.type;continue}if(a.set(s,e1.Any),e.symbolTableStack.lookupAll(a,!0,i),i.length){this.typeInfo=null==(u=i[0].dataType)?void 0:u.type;var l,u,p=e.symbolTableStack.scope.getSymbol(a,!0);p?(r(p,e4)||p.isGlobalVariable)&&-1===n.indexOf(s)&&n.push(s):i.some(function(e){return r(e,e4)||e.isGlobalVariable})&&-1===n.indexOf(s)&&n.push(s)}}}},n.codeGen=function(e){return this.setCache(e.visitVariableIdentifier(this))},n.getLexeme=function(e){var t=this.children[0];return r(t,eF)?t.lexeme:t.codeGen(e)},t}(tr),m.VariableIdentifier=ed,ed=l([tt(eQ.variable_identifier)],ed),em=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.semanticAnalyze=function(e){this.shaderData=e.shaderData,this.shaderData.symbolTable=e.symbolTableStack.scope},t}(tr),m.GLShaderProgram=em,em=l([tt(eQ.gs_shader_program)],em),eS=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}i(t,e);var n=t.prototype;return n.init=function(){this.macroExpressions.length=0},n.semanticAnalyze=function(e){var t,n=this.children[0];(r(n,ev)||r(n,eA)||r(n,eF))&&(e.shaderData.globalMacroDeclarations.push(this),r(n,eA)?(t=this.macroExpressions).push.apply(t,[].concat(n.macroExpressions)):this.macroExpressions.push(n))},t}(tr),m.GlobalDeclaration=eS,eS=l([tt(eQ.global_declaration)],eS),ev=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.codeGen=function(t){return this.setCache(e.prototype.codeGen.call(this,t)+"\n")},t}(tr),m.MacroUndef=ev,ev=l([tt(eQ.macro_undef)],ev),eg=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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}(tr),m.MacroPushContext=eg,eg=l([tt(eQ.macro_push_context)],eg),ey=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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}(tr),m.MacroPopContext=ey,ey=l([tt(eQ.macro_pop_context)],ey),eE=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tr),m.MacroElifExpression=eE,eE=l([tt(eQ.macro_elif_expression)],eE),eC=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tr),m.MacroElseExpression=eC,eC=l([tt(eQ.macro_else_expression)],eC),ex=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}i(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}(tr),m.GlobalMacroDeclaration=ex,ex=l([tt(eQ.global_macro_declaration)],ex),eA=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}i(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}(tr),m.GlobalMacroIfStatement=eA,eA=l([tt(eQ.global_macro_if_statement)],eA),eT=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}i(t,e);var n=t.prototype;return n.init=function(){this.macroExpressions.length=0},n.semanticAnalyze=function(e){var n=this.children,i=n[n.length-1],a=this.macroExpressions;a.push(n[0]),r(n[1],ex)&&a.push.apply(a,[].concat(n[1].macroExpressions)),r(i,t)&&a.push.apply(a,[].concat(i.macroExpressions)),n.length>1&&r(i,ey)&&a.push(i)},t}(tr),m.GlobalMacroBranch=eT,eT=l([tt(eQ.global_macro_branch)],eT),eb=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(tr),m.MacroIfStatement=eb,eb=l([tt(eQ.macro_if_statement)],eb),eO=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(tr),m.MacroBranch=eO,eO=l([tt(eQ.macro_branch)],eO),eI=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.referenceSymbolNames=[],t}i(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,eB.getReferenceSymbolNames(e.macroDefineList,t,this.referenceSymbolNames)},t}(tr),m.MacroCallSymbol=eI,eI=l([tt(eQ.macro_call_symbol)],eI),eL=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(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}(tr),m.MacroCallFunction=eL,l([tt(eQ.macro_call_function)],eL);var tn=/*#__PURE__*/function(){function e(){}return e.unwrapNodeByType=function(t,n){var i=t.children[0];if(!r(i,eF))return i.nt===n?i:e.unwrapNodeByType(i,n)},e.isTerminal=function(e){return e<eQ.START},e}(),ti=/*#__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 eG.createGSError("referenced attribute not found: "+t,e0.CompilationError,tR._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 eG.createGSError("referenced varying not found: "+t,e0.CompilationError,tR._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 eG.createGSError("referenced mrt not found: "+t,e0.CompilationError,tR._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}();ti._lookupSymbol=new e3("",null);var ta=/*#__PURE__*/function(){function e(){this.array=[]}return e.prototype.dispose=function(){this.array.length=0},e}(),to=/*#__PURE__*/function(){function e(){}var n=e.prototype;return n.defaultCodeGen=function(t){var n=e._tmpArrayPool,i=n.get();i.dispose();for(var a,o=c(t);!(a=o()).done;){var s=a.value;r(s,eF)?i.array.push(s.lexeme):i.array.push(s.codeGen(this))}return n.return(i),i.array.join(" ")},n.visitPostfixExpression=function(e){var t=e.children,n=t.length,i=ti.context;if(3===n){var a=t[0],o=t[2];return r(o,eF)?i.isAttributeStruct(a.type)?(i.referenceAttribute(o),o.lexeme):i.isVaryingStruct(a.type)?(i.referenceVarying(o),o.lexeme):i.isMRTStruct(a.type)?(i.referenceMRTProp(o),o.lexeme):a.codeGen(this)+"."+o.lexeme:a.codeGen(this)+"."+o.codeGen(this)}if(4===n){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)},n.visitVariableIdentifier=function(e){for(var t,r=c(e.referenceGlobalSymbolNames);!(t=r()).done;){var n=t.value;ti.context.referenceGlobal(n,e1.Any)}return e.getLexeme(this)},n.visitFunctionCall=function(e){var t=e.children[0];if(r(t.fnSymbol,e4)){ti.context.referenceGlobal(t.fnSymbol.ident,e1.FN);var n=t.children[2];if(r(n,eP.FunctionCallParameterList)){for(var i=n.paramNodes,a=t.fnSymbol.astNode.protoType.parameterList,o=i.filter(function(e,t){var r,n=null==a?void 0:null==(r=a[t])?void 0:r.typeInfo;return!n||!ti.context.isAttributeStruct(n.typeLexeme)&&!ti.context.isVaryingStruct(n.typeLexeme)&&!ti.context.isMRTStruct(n.typeLexeme)}),s="",c=0,l=o.length;c<l;c++){var u=o[c],p=u.codeGen(this);r(u,eP.MacroCallArgBlock)||0===c?s+=p:s+=", "+p}return t.fnSymbol.ident+"("+s+")"}}return this.defaultCodeGen(e.children)},n.visitMacroCallFunction=function(e){var t=e.children[2];if(!r(t,eP.FunctionCallParameterList))return this.defaultCodeGen(e.children);for(var n=t.paramNodes.filter(function(e){if(r(e,eP.AssignmentExpression)){var t=tn.unwrapNodeByType(e,eQ.variable_identifier);if(t&&"string"==typeof t.typeInfo&&(ti.context.isAttributeStruct(t.typeInfo)||ti.context.isVaryingStruct(t.typeInfo)||ti.context.isMRTStruct(t.typeInfo)))return!1}return!0}),i="",a=0,o=n.length;a<o;a++){var s=n[a],c=s.codeGen(this);r(s,eP.MacroCallArgBlock)||0===a?i+=c:i+=", "+c}return e.macroName+"("+i+")"},n.visitStatementList=function(e){var t=e.children;return 1===t.length?t[0].codeGen(this):t[0].codeGen(this)+"\n"+t[1].codeGen(this)},n.visitSingleDeclaration=function(e){var t=e.typeSpecifier.type;return"string"==typeof t&&ti.context.referenceGlobal(t,e1.STRUCT),this.defaultCodeGen(e.children)},n.visitGlobalVariableDeclaration=function(e){var t=e.children,n=t[0];return r(n,eP.FullySpecifiedType)&&n.typeSpecifier.isCustom&&ti.context.referenceGlobal(n.type,e1.STRUCT),"uniform "+this.defaultCodeGen(t)},n.visitDeclaration=function(e){var t=ti.context,n=e.children,i=n[0];if(r(i,eP.InitDeclaratorList)){var a=i.typeInfo.typeLexeme;if(t.isVaryingStruct(a)||t.isMRTStruct(a))return""}return this.defaultCodeGen(n)},n.visitFunctionParameterList=function(e){for(var t=e.parameterInfoList.filter(function(e){return!e.typeInfo||!ti.context.isAttributeStruct(e.typeInfo.typeLexeme)&&!ti.context.isVaryingStruct(e.typeInfo.typeLexeme)&&!ti.context.isMRTStruct(e.typeInfo.typeLexeme)}),n="",i=0,a=t.length;i<a;i++){var o=t[i].astNode,s=o.codeGen(this);r(o,eP.MacroParamBlock)||0===i?n+=s:n+=", "+s}return n},n.visitFunctionHeader=function(e){var t=e.returnType.typeSpecifier.lexeme;return ti.context.isVaryingStruct(t)?"void "+e.ident.lexeme+"(":this.defaultCodeGen(e.children)},n.visitJumpStatement=function(e){var t=e.children;if(t[0].type===eV.RETURN){var n=t[1];if(r(n,eP.Expression)){var i=tn.unwrapNodeByType(n,eQ.variable_identifier);if(ti.context.isVaryingStruct(null==i?void 0:i.typeInfo))return"";var a=tn.unwrapNodeByType(n,eQ.function_call);if(ti.context.isVaryingStruct(null==a?void 0:a.type))return""+n.codeGen(this)+";"}}return this.defaultCodeGen(t)},n.visitFunctionIdentifier=function(e){return this.defaultCodeGen(e.children)},n.visitStructSpecifier=function(e){var t=this,n=ti.context,i=n.varyingStructs,a=n.attributeStructs,o=n.mrtStructs,s=-1!==i.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:r(e,eF)?e.lexeme:e.codeGen(t),index:e.location.start.index}})));for(var _,h=c(e.propList);!(_=h()).done;){var f,d,m,S=_.value,v=S.ident.lexeme;s&&(null==(f=n._referencedVaryingList[v])?void 0:f.indexOf(S))>=0?p.push({text:""+this.getVaryingProp(S)+"\n",index:S.ident.location.start.index}):l&&(null==(d=n._referencedAttributeList[v])?void 0:d.indexOf(S))>=0?p.push({text:""+this.getAttributeProp(S)+"\n",index:S.ident.location.start.index}):u&&(null==(m=n._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("")},n.visitFunctionDefinition=function(e){return e.protoType.ident.lexeme==ti.context.stageEntry?"void main() "+e.statements.codeGen(this):this.defaultCodeGen(e.children)},n._reportError=function(e,r){t.Logger.error(r)},e}();to._tmpArrayPool=new t.ReturnableObjectPool(ta,10);var ts=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._globalCodeArray=[],t}i(t,e);var n=t.prototype;return n.reset=function(){this._globalCodeArray.length=0,t._serializedGlobalKey.clear()},n.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})}},n.visitShaderProgram=function(e,t,r){ti.reset(),this.reset();var n=e.shaderData;ti.context._passSymbolTable=n.symbolTable;var i=n.getOuterGlobalMacroDeclarations();return{vertex:this._vertexMain(t,n,i),fragment:this._fragmentMain(r,n,i)}},n._vertexMain=function(e,r,n){var i=this,a=ti.context;a.stage=ew.VERTEX,a.stageEntry=e;var o=t._lookupSymbol,s=r.symbolTable;o.set(e,e1.FN);var l=s.getSymbols(o,!0,[]);if(!l.length)throw"no entry function found: "+e;var u=a.attributeStructs,p=a.attributeList,_=a.varyingStructs,h=a.varyingList;l.forEach(function(e){var t=e.astNode,r=t.protoType.returnType;if("string"==typeof r.type){o.set(r.type,e1.STRUCT);var n=s.getSymbols(o,!0,[]);if(n.length)for(var a=0;a<n.length;a++){var l=n[a].astNode;_.push(l);for(var f,d=c(l.propList);!(f=d()).done;){var m=f.value;h.push(m)}}else i._reportError(r.location,'invalid varying struct: "'+r.type+'".')}else r.type!==eV.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,e1.STRUCT);var y=s.getSymbols(o,!0,[]);if(y.length)for(var E=0;E<y.length;E++){var C=y[E].astNode;u.push(C);for(var x,A=c(C.propList);!(x=A()).done;){var T=x.value;p.push(T)}}else i._reportError(v.astNode.location,'invalid attribute struct: "'+g+'".')}}});var f=this._globalCodeArray;ti.context.referenceGlobal(e,e1.FN),this._getGlobalSymbol(f),this._getCustomStruct(a.attributeStructs,f),this._getCustomStruct(a.varyingStructs,f),this._getGlobalMacroDeclarations(n,f),this.getOtherGlobal(r,f);var d=f.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return ti.context.reset(!1),this.reset(),d},n._fragmentMain=function(e,r,n){var i=this,a=ti.context;a.stage=ew.FRAGMENT,a.stageEntry=e;var o=t._lookupSymbol,s=r.symbolTable;o.set(e,e1.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,e1.STRUCT);var p=s.getSymbols(o,!0,[]);if(p.length)for(var _=0;_<p.length;_++){var h=p[_].astNode;a.mrtStructs.push(h);for(var f,d=c(h.propList);!(f=d()).done;){var m=f.value;a.mrtList.push(m)}}else i._reportError(u,"invalid mrt struct: "+l)}else l!==eV.VOID&&l!==eV.VEC4&&i._reportError(u,"fragment main entry can only return struct or vec4.")});var u=this._globalCodeArray;ti.context.referenceGlobal(e,e1.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},n._getGlobalSymbol=function(e){var r=ti.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===e1.VAR?";":"");s.isInMacroBranch||e.push({text:c,index:s.astNode.location.start.index})}}Object.keys(r).length!==n&&this._getGlobalSymbol(e)}},n._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})}},n._getGlobalMacroDeclarations=function(e,t){var n=this,i=ti.context,a=i._referencedGlobals,o=i._referencedGlobalMacroASTs;o.length=0;for(var s,l=c(Object.values(a));!(s=l()).done;)for(var u,p=s.value,_=c(p);!(u=_()).done;){var h=u.value;h.isInMacroBranch&&o.push(h.astNode)}for(var f,d=c(e);!(f=d()).done;){var m=f.value,S=void 0,v=m.children[0];if(r(v,eP.GlobalMacroIfStatement)){var g=[];g.push.apply(g,[].concat(m.macroExpressions.map(function(e){return{text:r(e,eF)?e.lexeme:e.codeGen(n),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})}},n._visitGlobalMacroIfStatement=function(e,t){for(var n=e.children,i=0;i<n.length;i++){var a=n[i];if(r(a,eP.PrecisionSpecifier))t.push({text:a.codeGen(this),index:a.location.start.index});else if(r(a,eP.FunctionDefinition))-1!==ti.context._referencedGlobalMacroASTs.indexOf(a)&&t.push({text:a.getCache(),index:a.location.start.index});else if(r(a,eP.StructSpecifier)){var o,s,c,l,u=ti.context,p=u.stage;(-1!==ti.context._referencedGlobalMacroASTs.indexOf(a)||(p===ew.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(r(a,eP.VariableDeclarationList))for(var _=a.variableDeclarations,h=0;h<_.length;h++){var f=_[h];-1!==ti.context._referencedGlobalMacroASTs.indexOf(f)&&t.push({text:f.getCache()+";",index:f.location.start.index})}r(a,tr)&&this._visitGlobalMacroIfStatement(a,t)}},t}(to);ts._lookupSymbol=new e3("",null),ts._serializedGlobalKey=new Set;var tc=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.getAttributeProp=function(e){return"attribute "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},n.getVaryingProp=function(e){return"varying "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},n.getMRTProp=function(){return null},n.visitPostfixExpression=function(t){var n=t.children,i=n[0],a=ti.context;if(r(i,eP.PostfixExpression)&&a.isMRTStruct(i.type)){var o=n[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)},n.visitJumpStatement=function(t){return t.isFragReturnStatement?ti.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}(ts),tl="GS_glFragColor",tu=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._otherCodeArray=[],t._fragColorVariableRegistered=!1,t}i(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(ti.context.stage===ew.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=ti.context;if(r.stage===ew.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(),tl}return e.prototype.visitVariableIdentifier.call(this,t)},r.visitJumpStatement=function(t){return t.isFragReturnStatement?ti.context.mrtStructs.length?"":(this._registerFragColorVariable(),tl+" = "+t.children[1].codeGen(this)+";"):e.prototype.visitJumpStatement.call(this,t)},r._registerFragColorVariable=function(){this._fragColorVariableRegistered||(this._otherCodeArray.push({text:"out vec4 "+tl+";",index:0}),this._fragColorVariableRegistered=!0)},t.getVisitor=function(){return this._singleton||(this._singleton=new t),this._singleton},t}(ts),tp=/*#__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),tR.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 eG.createGSError(r.join(" "),e0.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}(),t_=/*#__PURE__*/function(e){function t(t,r){var n;return(n=e.call(this,t)||this).macroDefineList=r,n._needScanMacroConditionExpression=!1,n}i(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,ek]}})},r.scanToken=function(){if(this.skipCommentsAndSpace(),this.isEnd())return ek;if(this._needScanMacroConditionExpression)return this._needScanMacroConditionExpression=!1,this._scanMacroConditionExpression();var e,t=this.getCurCharCode();if(tp.isPreprocessorStartChar(t))return this._scanDirectives();if(tp.isAlpha(t))return this._scanWord();if(tp.isDigit(t))return this._scanNum();var r=this.getShaderPosition(),n=eF.pool.get();switch(this.getCurChar()){case"<":if(this.advance(1),"<"===(e=this.getCurChar())){if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eD.LEFT_ASSIGN,"<<=",r);break}n.set(eD.LEFT_OP,"<<",r);break}if("="===e){this.advance(1),n.set(eD.LE_OP,"<=",r);break}n.set(eD.LEFT_ANGLE,"<",r);break;case">":if(this.advance(1),">"===(e=this.getCurChar())){if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eD.RIGHT_ASSIGN,">>=",r);break}n.set(eD.RIGHT_OP,">>",r);break}if("="===e){this.advance(1),n.set(eD.GE_OP,">=",r);break}n.set(eD.RIGHT_ANGLE,">",r);break;case"+":if(this.advance(1),"+"===(e=this.getCurChar())){this.advance(1),n.set(eD.INC_OP,"++",r);break}if("="===e){this.advance(1),n.set(eD.ADD_ASSIGN,"+=",r);break}n.set(eD.PLUS,"+",r);break;case"-":if(this.advance(1),"-"===(e=this.getCurChar())){this.advance(1),n.set(eD.DEC_OP,"--",r);break}if("="===e){this.advance(1),n.set(eD.SUB_ASSIGN,"-=",r);break}n.set(eD.DASH,"-",r);break;case"=":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eD.EQ_OP,"==",r);break}n.set(eD.EQUAL,"=",r);break;case"!":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eD.NE_OP,"!=",r);break}n.set(eD.BANG,"!",r);break;case"&":if(this.advance(1),"&"===(e=this.getCurChar())){this.advance(1),n.set(eD.AND_OP,"&&",r);break}if("="===e){this.advance(1),n.set(eD.ADD_ASSIGN,"&=",r);break}n.set(eD.AMPERSAND,"&",r);break;case"|":if(this.advance(1),"|"===(e=this.getCurChar())){this.advance(1),n.set(eD.OR_OP,"||",r);break}if("="===e){this.advance(1),n.set(eD.OR_ASSIGN,"|=",r);break}n.set(eD.VERTICAL_BAR,"|",r);break;case"^":if(this.advance(1),"^"===(e=this.getCurChar())){this.advance(1),n.set(eD.XOR_OP,"^^",r);break}if("="===e){this.advance(1),n.set(eD.XOR_ASSIGN,"^=",r);break}n.set(eD.CARET,"^",r);break;case"*":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eD.MUL_ASSIGN,"*=",r);break}n.set(eD.STAR,"*",r);break;case"/":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eD.DIV_ASSIGN,"/=",r);break}n.set(eD.SLASH,"/",r);break;case"%":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eD.MOD_ASSIGN,"%=",r);break}n.set(eD.PERCENT,"%",r);break;case"(":this.advance(1),n.set(eD.LEFT_PAREN,"(",r);break;case")":this.advance(1),n.set(eD.RIGHT_PAREN,")",r);break;case"{":this.advance(1),n.set(eD.LEFT_BRACE,"{",r);break;case"}":this.advance(1),n.set(eD.RIGHT_BRACE,"}",r);break;case"[":this.advance(1),n.set(eD.LEFT_BRACKET,"[",r);break;case"]":this.advance(1),n.set(eD.RIGHT_BRACKET,"]",r);break;case".":if(this.advance(1),tp.isDigit(this.getCurCharCode()))return this._scanNumAfterDot();n.set(eD.DOT,".",r);break;case",":this.advance(1),n.set(eD.COMMA,",",r);break;case":":this.advance(1),n.set(eD.COLON,":",r);break;case";":this.advance(1),n.set(eD.SEMICOLON,";",r);break;case"~":this.advance(1),n.set(eD.TILDE,"~",r);break;case"?":this.advance(1),n.set(eD.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=tR.createRange(e,this.getShaderPosition()),n=eF.pool.get();return n.set(eD.STRING_CONST,t.join(""),r),n},r._scanNumAfterDot=function(){for(var e=["."];tp.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(e);var t=eF.pool.get();return t.set(eD.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);tp.isAlpha(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=eF.pool.get(),i=e.join("");if("#define"===i){this._scanUtilBreakLine(e);var a=e.join("")+"\n";n.set(eV.MACRO_DEFINE_EXPRESSION,a,r)}else{var o=t._lexemeTable[i];n.set(null!=o?o:eD.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=eF.pool.get();return n.set(eV.MACRO_CONDITIONAL_EXPRESSION,r,t),n},r._scanWord=function(){var e=[this.getCurChar()],r=this.getShaderPosition();for(this.advance(1);tp.isAlnum(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=eF.pool.get(),i=e.join(""),a=t._lexemeTable[i];return this.macroDefineList[i]?n.set(eV.MACRO_CALL,i,r):n.set(null!=a?a:eD.ID,i,r),n},r._scanNum=function(){for(var e=[];tp.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var t=this.getCurChar();if("."===t){for(e.push(t),this.advance(1);tp.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(e);var r=eF.pool.get();return r.set(eD.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),r}if("e"===t||"E"===t){this._scanFloatSuffix(e);var n=eF.pool.get();return n.set(eD.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),n}this._scanIntegerSuffix(e);var i=eF.pool.get();return i.set(eD.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()),tp.isDigit(this.getCurCharCode())||this.throwError(this.getShaderPosition(0),"lexing error, invalid exponent suffix.");do e.push(t),this.advance(1),t=this.getCurChar();while(tp.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}(tp);t_._lexemeTable={const:eV.CONST,bool:eV.BOOL,float:eV.FLOAT,double:eV.DOUBLE,int:eV.INT,uint:eV.UINT,break:eV.BREAK,continue:eV.CONTINUE,do:eV.DO,else:eV.ELSE,for:eV.FOR,if:eV.IF,while:eV.WHILE,discard:eV.DISCARD,return:eV.RETURN,bvec2:eV.BVEC2,bvec3:eV.BVEC3,bvec4:eV.BVEC4,ivec2:eV.IVEC2,ivec3:eV.IVEC3,ivec4:eV.IVEC4,uvec2:eV.UVEC2,uvec3:eV.UVEC3,uvec4:eV.UVEC4,vec2:eV.VEC2,vec3:eV.VEC3,vec4:eV.VEC4,mat2:eV.MAT2,mat3:eV.MAT3,mat4:eV.MAT4,in:eV.IN,out:eV.OUT,inout:eV.INOUT,sampler2D:eV.SAMPLER2D,samplerCube:eV.SAMPLER_CUBE,sampler3D:eV.SAMPLER3D,sampler2DShadow:eV.SAMPLER2D_SHADOW,samplerCubeShadow:eV.SAMPLER_CUBE_SHADOW,sampler2DArray:eV.SAMPLER2D_ARRAY,sampler2DArrayShadow:eV.SAMPLER2D_ARRAY_SHADOW,isampler2D:eV.I_SAMPLER2D,isampler3D:eV.I_SAMPLER3D,isamplerCube:eV.I_SAMPLER_CUBE,isampler2DArray:eV.I_SAMPLER2D_ARRAY,usampler2D:eV.U_SAMPLER2D,usampler3D:eV.U_SAMPLER3D,usamplerCube:eV.U_SAMPLER_CUBE,usampler2DArray:eV.U_SAMPLER2D_ARRAY,struct:eV.STRUCT,void:eV.VOID,true:eV.True,false:eV.False,precision:eV.PRECISION,precise:eV.PRECISE,highp:eV.HIGHP,mediump:eV.MEDIUMP,lowp:eV.LOWP,invariant:eV.INVARIANT,flat:eV.FLAT,smooth:eV.SMOOTH,noperspective:eV.NOPERSPECTIVE,centroid:eV.CENTROID,layout:eV.LAYOUT,location:eV.LOCATION,"#if":eV.MACRO_IF,"#ifdef":eV.MACRO_IFDEF,"#ifndef":eV.MACRO_IFNDEF,"#else":eV.MACRO_ELSE,"#elif":eV.MACRO_ELIF,"#endif":eV.MACRO_ENDIF,"#undef":eV.MACRO_UNDEF};var th={Text:0,IfDef:1,IfNdef:2,IfCmp:3,IfExpr:4,Else:5,Endif:6,Define:7,DefineVal:8,DefineFunc:9,Undef:10},tf=/*#__PURE__*/function(){function e(){}return e.parse=function(t){for(var r=[],n=t.length,i=0,a=[];i<n;){var o=e._findDirectiveStart(t,i,n);if(-1===o){e._pushText(r,t,i,n);break}o>i&&e._pushText(r,t,i,o);var s=t.indexOf("\n",o);-1===s&&(s=n);var c=t.substring(o,s);i=s<n?s+1:n;var l=e._DIRECTIVE_RE.exec(c);if(!l){var u=r.length>0?r[r.length-1]:null,p=s<n?c+"\n":c;u&&u[0]===th.Text?u[1]+=p:r.push([th.Text,p]);continue}var _=l[1],h=l[2].trim();switch(_){case"ifdef":var f=r.length;r.push([th.IfDef,h,-1]),a.push([f]);break;case"ifndef":var d=r.length;r.push([th.IfNdef,h,-1]),a.push([d]);break;case"if":var m=e._parseCondition(h),S=r.length;e._pushConditionInstruction(r,m),a.push([S]);break;case"elif":var v=a[a.length-1],g=v[v.length-1],y=r.length;r.push([th.Else,-1]),v.push(y),e._backfillJump(r[g],r.length);var E=e._parseCondition(h),C=r.length;e._pushConditionInstruction(r,E),v.push(C);break;case"else":var x=a[a.length-1],A=x[x.length-1],T=r.length;r.push([th.Else,-1]),x.push(T),e._backfillJump(r[A],r.length);break;case"endif":var b=r.length;r.push([th.Endif]);var O=a.pop();if(O)for(var I=b+1,L=0;L<O.length;L++){var R=r[O[L]];R[0]===th.Else?R[1]=I:e._backfillJump(R,I,!0)}break;case"define":var P=e._FUNC_MACRO_RE.exec(h);if(P){var M=P[2].split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0});r.push([th.DefineFunc,P[1],M,e._stripLineComment(P[3].trim())])}else{var N=h.indexOf(" ");-1===N?r.push([th.Define,h]):r.push([th.DefineVal,h.substring(0,N),e._stripLineComment(h.substring(N+1).trim())])}break;case"undef":r.push([th.Undef,h])}}return r},e._pushConditionInstruction=function(e,t){"def"===t.t?e.push([th.IfDef,t.m,-1]):"ndef"===t.t?e.push([th.IfNdef,t.m,-1]):"cmp"===t.t?e.push([th.IfCmp,t.m,t.op,t.v,-1]):e.push([th.IfExpr,t,-1])},e._findDirectiveStart=function(e,t,r){for(var n=t;n<r;){for(var i=n;i<r;){var a=e.charCodeAt(i);if(32===a||9===a)i++;else break}if(i<r&&35===e.charCodeAt(i))return n;var o=e.indexOf("\n",n);if(-1===o)break;n=o+1}return -1},e._pushText=function(e,t,r,n){if(!(r>=n)){var i=e.length>0?e[e.length-1]:null;i&&i[0]===th.Text?i[1]+=t.substring(r,n):e.push([th.Text,t.substring(r,n)])}},e._backfillJump=function(e,t,r){void 0===r&&(r=!1);var n=e[0];n===th.IfDef||n===th.IfNdef?r&&-1!==e[2]||(e[2]=t):n===th.IfCmp?r&&-1!==e[4]||(e[4]=t):n!==th.IfExpr||r&&-1!==e[2]||(e[2]=t)},e._stripLineComment=function(e){var t=e.indexOf("//");return t>=0?e.substring(0,t).trimEnd():e},e._parseCondition=function(t){var r={s:t.trim(),i:0};return e._parseOr(r)},e._skipWs=function(e){for(;e.i<e.s.length&&(32===e.s.charCodeAt(e.i)||9===e.s.charCodeAt(e.i));)e.i++},e._parseOr=function(t){var r=e._parseAnd(t);for(e._skipWs(t);t.i<t.s.length-1&&124===t.s.charCodeAt(t.i)&&124===t.s.charCodeAt(t.i+1);)t.i+=2,e._skipWs(t),r={t:"or",l:r,r:e._parseAnd(t)},e._skipWs(t);return r},e._parseAnd=function(t){var r=e._parseUnary(t);for(e._skipWs(t);t.i<t.s.length-1&&38===t.s.charCodeAt(t.i)&&38===t.s.charCodeAt(t.i+1);)t.i+=2,e._skipWs(t),r={t:"and",l:r,r:e._parseUnary(t)},e._skipWs(t);return r},e._parseUnary=function(t){return(e._skipWs(t),33===t.s.charCodeAt(t.i))?(t.i++,e._skipWs(t),{t:"not",c:e._parsePrimary(t)}):e._parsePrimary(t)},e._parsePrimary=function(t){e._skipWs(t);var r=t.s;if(40===r.charCodeAt(t.i)){t.i++,e._skipWs(t);var n=e._parseOr(t);return e._skipWs(t),41===r.charCodeAt(t.i)&&t.i++,n}if("defined"===r.substring(t.i,t.i+7)){t.i+=7,e._skipWs(t);var i=40===r.charCodeAt(t.i);i&&t.i++,e._skipWs(t);var a=e._scanIdentifier(t);return e._skipWs(t),i&&41===r.charCodeAt(t.i)&&t.i++,{t:"def",m:a}}if(t.i<r.length&&e._isDigit(r.charCodeAt(t.i))){var o=e._scanNumber(t);e._skipWs(t);var s=e._scanOp(t);return s?(e._skipWs(t),{t:"bool",v:e._evalNumOp(o,s,e._scanNumber(t))}):{t:"bool",v:0!==o}}var c=e._scanIdentifier(t);if(!c)return{t:"bool",v:!1};e._skipWs(t);var l=e._scanOp(t);return l?(e._skipWs(t),{t:"cmp",m:c,op:l,v:e._scanNumber(t)}):{t:"def",m:c}},e._isDigit=function(e){return e>=48&&e<=57},e._isAlnum=function(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||95===e},e._scanIdentifier=function(t){for(var r=t.i;t.i<t.s.length&&e._isAlnum(t.s.charCodeAt(t.i));)t.i++;return t.s.substring(r,t.i)},e._scanNumber=function(t){var r=t.i;for(45===t.s.charCodeAt(t.i)&&t.i++;t.i<t.s.length&&(e._isDigit(t.s.charCodeAt(t.i))||46===t.s.charCodeAt(t.i));)t.i++;return Number(t.s.substring(r,t.i))||0},e._scanOp=function(e){var t=e.s.charCodeAt(e.i),r=e.i+1<e.s.length?e.s.charCodeAt(e.i+1):0;return 61===t&&61===r?(e.i+=2,"=="):33===t&&61===r?(e.i+=2,"!="):62===t&&61===r?(e.i+=2,">="):60===t&&61===r?(e.i+=2,"<="):62===t?(e.i++,">"):60===t?(e.i++,"<"):""},e._evalNumOp=function(e,t,r){switch(t){case"==":return e===r;case"!=":return e!==r;case">":return e>r;case"<":return e<r;case">=":return e>=r;case"<=":return e<=r;default:return!1}},e}();tf._DIRECTIVE_RE=/^[ \t]*#[ \t]*(if|ifdef|ifndef|elif|else|endif|define|undef)\b(.*)/,tf._FUNC_MACRO_RE=/^(\w+)\(([^)]*)\)\s*(.*)/;var td=/*#__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]!==eD.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}();td._id=0;var tm=/*#__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 td(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}();tm.closureMap=new Map,tm.pool=new Map,tm._id=0;var tS=/*#__PURE__*/function(){function e(){}return e.isTerminal=function(e){return e<eQ.START},e.toString=function(e){if(this.isTerminal(e)){var t;return null!=(t=eD[e])?t:eV[e]}return eQ[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=tR.createRange(a,o);eP.get(null!=r?r:eP.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}(),tv=((eR={})[eR.Shift=0]="Shift",eR[eR.Reduce=1]="Reduce",eR[eR.Accept=2]="Accept",eR),tg=/*#__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 td(this.grammar.productions[0],0,[eD.EOF])],t=tm.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(!tS.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(tS.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(eD.EPSILON))break}if(!i&&(null==s?void 0:s.has(eD.EPSILON)))for(var _,h=c(t.lookaheadSet);!(_=h()).done;){var f=_.value;n.add(f)}for(var d,m=c(r);!(d=m()).done;){var S=d.value,v=e.createStateItem(S,0);e.items.has(v)&&tS.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,C=e.createStateItem(E,0);e.items.has(C)&&tS.isSubSet(t.lookaheadSet,C.lookaheadSet)||(e.items.add(C),C.addLookahead(t.lookaheadSet),this._extendStateItem(e,C))}}},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!==eQ.START?{action:tv.Reduce,target:l.production.id}:{action:tv.Accept};for(var p,_=c(l.lookaheadSet);!(p=_()).done;){var h=p.value;this._addAction(r,h,u)}}else{var f=l.advance();tS.addMapSetItem(t,l.curSymbol,f)}l.needReInfer=!1}for(var d,m=new Set,S=c(t.entries());!(d=S()).done;){var v=d.value,g=v[0],y=v[1],E=tm.create(Array.from(y));tS.isTerminal(g)?this._addAction(r,g,{action:tv.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||tS.isActionEqual(n,r)||t!==eV.ELSE||n.action!==tv.Shift||r.action!==tv.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(eD.EPSILON);for(var l,u=c(o);!(l=u()).done;){for(var p=l.value,_=0;_<p.derivation.length;_++){var h=p.derivation[_];if(tS.isTerminal(h)){s.add(h);break}for(var f,d=this._computeFirstSetForNT(h),m=c(d);!(f=m()).done;){var S=f.value;S!==eD.EPSILON&&s.add(S)}if(!this.grammar.isNullableNT(h))break}_===p.derivation.length&&s.add(eD.EPSILON)}return this._firstSetNTStack.pop(),s},e}(),ty=function e(t,r){this.goal=t,this.derivation=r,this.id=e._id++,e.pool.set(this.id,this)};ty._id=0,ty.pool=new Map;var tE=/*#__PURE__*/function(){function e(e,t){this.startSymbol=e,t.unshift(new ty(eQ.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]===eD.EPSILON})},t.getProductionByID=function(e){return ty.pool.get(e)},e.create=function(t,r){return new e(t,r.map(function(e){return new ty(e[0],e.slice(1))}))},e}(),tC=[].concat(tS.createProductionWithOptions(eQ.gs_shader_program,[[eQ.global_declaration],[eQ.gs_shader_program,eQ.global_declaration]],eP.GLShaderProgram.pool),tS.createProductionWithOptions(eQ.global_declaration,[[eQ.precision_specifier],[eQ.variable_declaration_statement],[eQ.struct_specifier],[eQ.function_definition],[eQ.global_macro_if_statement],[eQ.macro_undef],[eV.MACRO_DEFINE_EXPRESSION]],eP.GlobalDeclaration.pool),tS.createProductionWithOptions(eQ.macro_call_symbol,[[eV.MACRO_CALL]],eP.MacroCallSymbol.pool),tS.createProductionWithOptions(eQ.macro_call_function,[[eQ.macro_call_symbol,eD.LEFT_PAREN,eD.RIGHT_PAREN],[eQ.macro_call_symbol,eD.LEFT_PAREN,eQ.function_call_parameter_list,eD.RIGHT_PAREN]],eP.MacroCallFunction.pool),tS.createProductionWithOptions(eQ.macro_undef,[[eV.MACRO_UNDEF,eD.ID],[eV.MACRO_UNDEF,eV.MACRO_CALL]],eP.MacroUndef.pool),tS.createProductionWithOptions(eQ.macro_push_context,[[eV.MACRO_IF,eV.MACRO_CONDITIONAL_EXPRESSION],[eV.MACRO_IFDEF,eD.ID],[eV.MACRO_IFNDEF,eD.ID],[eV.MACRO_IFDEF,eQ.macro_call_symbol],[eV.MACRO_IFNDEF,eQ.macro_call_symbol]],eP.MacroPushContext.pool),tS.createProductionWithOptions(eQ.macro_pop_context,[[eV.MACRO_ENDIF]],eP.MacroPopContext.pool),tS.createProductionWithOptions(eQ.macro_elif_expression,[[eV.MACRO_ELIF,eV.MACRO_CONDITIONAL_EXPRESSION]],eP.MacroElifExpression.pool),tS.createProductionWithOptions(eQ.macro_else_expression,[[eV.MACRO_ELSE]],eP.MacroElseExpression.pool),tS.createProductionWithOptions(eQ.global_macro_declaration,[[eQ.global_declaration],[eQ.global_macro_declaration,eQ.global_declaration]],eP.GlobalMacroDeclaration.pool),tS.createProductionWithOptions(eQ.global_macro_if_statement,[[eQ.macro_push_context,eQ.global_macro_declaration,eQ.global_macro_branch],[eQ.macro_push_context,eQ.global_macro_branch]],eP.GlobalMacroIfStatement.pool),tS.createProductionWithOptions(eQ.global_macro_branch,[[eQ.macro_pop_context],[eQ.macro_elif_expression,eQ.global_macro_declaration,eQ.global_macro_branch],[eQ.macro_else_expression,eQ.global_macro_declaration,eQ.macro_pop_context],[eQ.macro_elif_expression,eQ.global_macro_branch],[eQ.macro_else_expression,eQ.macro_pop_context]],eP.GlobalMacroBranch.pool),tS.createProductionWithOptions(eQ.variable_declaration,[[eQ.fully_specified_type,eD.ID],[eQ.fully_specified_type,eD.ID,eQ.array_specifier],[eQ.fully_specified_type,eD.ID,eD.EQUAL,eQ.initializer]],eP.VariableDeclaration.pool),tS.createProductionWithOptions(eQ.variable_declaration_list,[[eQ.variable_declaration],[eQ.variable_declaration_list,eD.COMMA,eD.ID],[eQ.variable_declaration_list,eD.COMMA,eD.ID,eQ.array_specifier]],eP.VariableDeclarationList.pool),tS.createProductionWithOptions(eQ.variable_declaration_statement,[[eQ.variable_declaration_list,eD.SEMICOLON]]),tS.createProductionWithOptions(eQ.ext_builtin_type_specifier_nonarray,[[eV.VOID],[eV.FLOAT],[eV.BOOL],[eV.INT],[eV.UINT],[eV.VEC2],[eV.VEC3],[eV.VEC4],[eV.BVEC2],[eV.BVEC3],[eV.BVEC4],[eV.IVEC2],[eV.IVEC3],[eV.IVEC4],[eV.UVEC2],[eV.UVEC3],[eV.UVEC4],[eV.MAT2],[eV.MAT3],[eV.MAT4],[eV.MAT2X3],[eV.MAT2X4],[eV.MAT3X2],[eV.MAT3X4],[eV.MAT4X2],[eV.MAT4X3],[eV.SAMPLER2D],[eV.SAMPLER3D],[eV.SAMPLER_CUBE],[eV.SAMPLER2D_SHADOW],[eV.SAMPLER_CUBE_SHADOW],[eV.SAMPLER2D_ARRAY],[eV.SAMPLER2D_ARRAY_SHADOW],[eV.I_SAMPLER2D],[eV.I_SAMPLER3D],[eV.I_SAMPLER_CUBE],[eV.I_SAMPLER2D_ARRAY],[eV.U_SAMPLER2D],[eV.U_SAMPLER3D],[eV.U_SAMPLER_CUBE],[eV.U_SAMPLER2D_ARRAY]],eP.ExtBuiltinTypeSpecifierNonArray.pool),tS.createProductionWithOptions(eQ.type_specifier_nonarray,[[eD.ID],[eQ.ext_builtin_type_specifier_nonarray]],eP.TypeSpecifierNonArray.pool),tS.createProductionWithOptions(eQ.fully_specified_type,[[eQ.type_specifier],[eQ.type_qualifier,eQ.type_specifier]],eP.FullySpecifiedType.pool),tS.createProductionWithOptions(eQ.type_specifier,[[eQ.type_specifier_nonarray],[eQ.ext_builtin_type_specifier_nonarray,eQ.array_specifier]],eP.TypeSpecifier.pool),tS.createProductionWithOptions(eQ.type_qualifier,[[eQ.single_type_qualifier],[eQ.type_qualifier,eQ.single_type_qualifier]],eP.TypeQualifier.pool),tS.createProductionWithOptions(eQ.single_type_qualifier,[[eQ.storage_qualifier],[eQ.precision_qualifier],[eQ.interpolation_qualifier],[eQ.invariant_qualifier],[eV.PRECISE]],eP.SingleTypeQualifier.pool),tS.createProductionWithOptions(eQ.storage_qualifier,[[eV.CONST],[eV.IN],[eV.INOUT],[eV.OUT],[eV.CENTROID]]),tS.createProductionWithOptions(eQ.interpolation_qualifier,[[eV.SMOOTH],[eV.FLAT]]),tS.createProductionWithOptions(eQ.invariant_qualifier,[[eV.INVARIANT]]),tS.createProductionWithOptions(eQ.precision_qualifier,[[eV.HIGHP],[eV.MEDIUMP],[eV.LOWP]]),tS.createProductionWithOptions(eQ.struct_specifier,[[eV.STRUCT,eD.ID,eD.LEFT_BRACE,eQ.struct_declaration_list,eD.RIGHT_BRACE,eD.SEMICOLON],[eV.STRUCT,eD.LEFT_BRACE,eQ.struct_declaration_list,eD.RIGHT_BRACE,eD.SEMICOLON]],eP.StructSpecifier.pool),tS.createProductionWithOptions(eQ.struct_declaration_list,[[eQ.struct_declaration],[eQ.struct_declaration_list,eQ.struct_declaration]],eP.StructDeclarationList.pool),tS.createProductionWithOptions(eQ.struct_declaration,[[eQ.type_specifier,eQ.struct_declarator_list,eD.SEMICOLON],[eQ.type_qualifier,eQ.type_specifier,eQ.struct_declarator_list,eD.SEMICOLON],[eQ.layout_qualifier,eQ.type_specifier,eQ.struct_declarator,eD.SEMICOLON],[eQ.macro_struct_declaration]],eP.StructDeclaration.pool),tS.createProductionWithOptions(eQ.macro_struct_declaration,[[eQ.macro_push_context,eQ.struct_declaration_list,eQ.macro_struct_branch],[eQ.macro_push_context,eQ.macro_struct_branch]],eP.MacroStructDeclaration.pool),tS.createProductionWithOptions(eQ.macro_struct_branch,[[eQ.macro_pop_context],[eQ.macro_elif_expression,eQ.struct_declaration_list,eQ.macro_struct_branch],[eQ.macro_else_expression,eQ.struct_declaration_list,eQ.macro_pop_context],[eQ.macro_elif_expression,eQ.macro_struct_branch],[eQ.macro_else_expression,eQ.macro_pop_context]],eP.MacroStructBranch.pool),tS.createProductionWithOptions(eQ.layout_qualifier,[[eV.LAYOUT,eD.LEFT_PAREN,eV.LOCATION,eD.EQUAL,eD.INT_CONSTANT,eD.RIGHT_PAREN]],eP.LayoutQualifier.pool),tS.createProductionWithOptions(eQ.struct_declarator_list,[[eQ.struct_declarator],[eQ.struct_declarator_list,eD.COMMA,eQ.struct_declarator]],eP.StructDeclaratorList.pool),tS.createProductionWithOptions(eQ.struct_declarator,[[eD.ID],[eD.ID,eQ.array_specifier]],eP.StructDeclarator.pool),tS.createProductionWithOptions(eQ.array_specifier,[[eD.LEFT_BRACKET,eD.RIGHT_BRACKET],[eD.LEFT_BRACKET,eQ.integer_constant_expression,eD.RIGHT_BRACKET]],eP.ArraySpecifier.pool),tS.createProductionWithOptions(eQ.integer_constant_expression_operator,[[eD.PLUS],[eD.DASH],[eD.STAR],[eD.SLASH],[eD.PERCENT]],eP.IntegerConstantExpressionOperator.pool),tS.createProductionWithOptions(eQ.integer_constant_expression,[[eQ.variable_identifier],[eD.INT_CONSTANT],[eQ.integer_constant_expression,eQ.integer_constant_expression_operator,eD.INT_CONSTANT],[eQ.integer_constant_expression,eQ.integer_constant_expression_operator,eQ.variable_identifier]],eP.IntegerConstantExpression.pool),tS.createProductionWithOptions(eQ.conditional_expression,[[eQ.logical_or_expression],[eQ.logical_or_expression,eD.QUESTION,eQ.expression,eD.COLON,eQ.assignment_expression]]),tS.createProductionWithOptions(eQ.logical_or_expression,[[eQ.logical_xor_expression],[eQ.logical_or_expression,eD.OR_OP,eQ.logical_xor_expression]]),tS.createProductionWithOptions(eQ.logical_xor_expression,[[eQ.logical_and_expression],[eQ.logical_xor_expression,eD.XOR_OP,eQ.logical_and_expression]]),tS.createProductionWithOptions(eQ.logical_and_expression,[[eQ.inclusive_or_expression],[eQ.logical_and_expression,eD.AND_OP,eQ.inclusive_or_expression]]),tS.createProductionWithOptions(eQ.inclusive_or_expression,[[eQ.exclusive_or_expression],[eQ.inclusive_or_expression,eD.VERTICAL_BAR,eQ.exclusive_or_expression]]),tS.createProductionWithOptions(eQ.exclusive_or_expression,[[eQ.and_expression],[eQ.exclusive_or_expression,eD.CARET,eQ.and_expression]]),tS.createProductionWithOptions(eQ.and_expression,[[eQ.equality_expression],[eQ.and_expression,eD.AMPERSAND,eQ.equality_expression]]),tS.createProductionWithOptions(eQ.equality_expression,[[eQ.relational_expression],[eQ.equality_expression,eD.EQ_OP,eQ.relational_expression],[eQ.equality_expression,eD.NE_OP,eQ.relational_expression]]),tS.createProductionWithOptions(eQ.relational_expression,[[eQ.shift_expression],[eQ.relational_expression,eD.LEFT_ANGLE,eQ.shift_expression],[eQ.relational_expression,eD.RIGHT_ANGLE,eQ.shift_expression],[eQ.relational_expression,eD.LE_OP,eQ.shift_expression],[eQ.relational_expression,eD.GE_OP,eQ.shift_expression]]),tS.createProductionWithOptions(eQ.shift_expression,[[eQ.additive_expression],[eQ.shift_expression,eD.LEFT_OP,eQ.additive_expression],[eQ.shift_expression,eD.RIGHT_OP,eQ.additive_expression]]),tS.createProductionWithOptions(eQ.additive_expression,[[eQ.multiplicative_expression],[eQ.additive_expression,eD.PLUS,eQ.multiplicative_expression],[eQ.additive_expression,eD.DASH,eQ.multiplicative_expression]]),tS.createProductionWithOptions(eQ.multiplicative_expression,[[eQ.unary_expression],[eQ.multiplicative_expression,eD.STAR,eQ.unary_expression],[eQ.multiplicative_expression,eD.SLASH,eQ.unary_expression],[eQ.multiplicative_expression,eD.PERCENT,eQ.unary_expression]]),tS.createProductionWithOptions(eQ.unary_expression,[[eQ.postfix_expression],[eD.INC_OP,eQ.unary_expression],[eD.DEC_OP,eQ.unary_expression],[eQ.unary_operator,eQ.unary_expression]]),tS.createProductionWithOptions(eQ.unary_operator,[[eD.PLUS],[eD.DASH],[eD.BANG],[eD.TILDE]]),tS.createProductionWithOptions(eQ.postfix_expression,[[eQ.primary_expression],[eQ.postfix_expression,eD.LEFT_BRACKET,eQ.expression,eD.RIGHT_BRACKET],[eQ.function_call],[eQ.postfix_expression,eD.DOT,eD.ID],[eQ.postfix_expression,eD.DOT,eQ.function_call],[eQ.postfix_expression,eD.INC_OP],[eQ.postfix_expression,eD.DEC_OP]],eP.PostfixExpression.pool),tS.createProductionWithOptions(eQ.primary_expression,[[eQ.variable_identifier],[eD.INT_CONSTANT],[eD.FLOAT_CONSTANT],[eV.True],[eV.False],[eD.LEFT_PAREN,eQ.expression,eD.RIGHT_PAREN]],eP.PrimaryExpression.pool),tS.createProductionWithOptions(eQ.expression,[[eQ.assignment_expression],[eQ.expression,eD.COMMA,eQ.assignment_expression]],eP.Expression.pool),tS.createProductionWithOptions(eQ.assignment_expression,[[eQ.conditional_expression],[eQ.unary_expression,eQ.assignment_operator,eQ.assignment_expression]],eP.AssignmentExpression.pool),tS.createProductionWithOptions(eQ.assignment_operator,[[eD.EQUAL],[eD.MUL_ASSIGN],[eD.DIV_ASSIGN],[eD.MOD_ASSIGN],[eD.ADD_ASSIGN],[eD.SUB_ASSIGN],[eD.LEFT_ASSIGN],[eD.RIGHT_ASSIGN],[eD.AND_ASSIGN],[eD.XOR_ASSIGN],[eD.OR_ASSIGN]]),tS.createProductionWithOptions(eQ.function_call,[[eQ.function_call_generic]],eP.FunctionCall.pool),tS.createProductionWithOptions(eQ.function_call_generic,[[eQ.function_identifier,eD.LEFT_PAREN,eQ.function_call_parameter_list,eD.RIGHT_PAREN],[eQ.function_identifier,eD.LEFT_PAREN,eD.RIGHT_PAREN],[eQ.function_identifier,eV.VOID,eD.RIGHT_PAREN]],eP.FunctionCallGeneric.pool),tS.createProductionWithOptions(eQ.function_call_parameter_list,[[eQ.assignment_expression],[eQ.function_call_parameter_list,eD.COMMA,eQ.assignment_expression],[eQ.macro_call_arg_block],[eQ.function_call_parameter_list,eQ.macro_call_arg_block]],eP.FunctionCallParameterList.pool),tS.createProductionWithOptions(eQ.macro_call_arg_case_list,[[eQ.assignment_expression],[eD.COMMA,eQ.assignment_expression],[eQ.macro_call_arg_block],[eQ.macro_call_arg_case_list,eQ.macro_call_arg_block],[eQ.macro_call_arg_case_list,eD.COMMA,eQ.assignment_expression]],eP.MacroCallArgCaseList.pool),tS.createProductionWithOptions(eQ.macro_call_arg_block,[[eQ.macro_push_context,eQ.macro_call_arg_branch],[eQ.macro_push_context,eQ.macro_call_arg_case_list,eQ.macro_call_arg_branch]],eP.MacroCallArgBlock.pool),tS.createProductionWithOptions(eQ.macro_call_arg_branch,[[eQ.macro_pop_context],[eQ.macro_elif_expression,eQ.macro_call_arg_case_list,eQ.macro_call_arg_branch],[eQ.macro_else_expression,eQ.macro_call_arg_case_list,eQ.macro_pop_context],[eQ.macro_elif_expression,eQ.macro_call_arg_branch],[eQ.macro_else_expression,eQ.macro_pop_context]],eP.MacroCallArgBranch.pool),tS.createProductionWithOptions(eQ.function_identifier,[[eQ.type_specifier]],eP.FunctionIdentifier.pool),tS.createProductionWithOptions(eQ.function_definition,[[eQ.function_prototype,eQ.compound_statement_no_scope]],eP.FunctionDefinition.pool),tS.createProductionWithOptions(eQ.function_prototype,[[eQ.function_declarator,eD.RIGHT_PAREN]],eP.FunctionProtoType.pool),tS.createProductionWithOptions(eQ.function_declarator,[[eQ.function_header],[eQ.function_header,eQ.function_parameter_list]],eP.FunctionDeclarator.pool),tS.createProductionWithOptions(eQ.function_header,[[eQ.fully_specified_type,eD.ID,eD.LEFT_PAREN]],eP.FunctionHeader.pool),tS.createProductionWithOptions(eQ.function_parameter_list,[[eQ.parameter_declaration],[eQ.function_parameter_list,eD.COMMA,eQ.parameter_declaration],[eQ.macro_param_block],[eQ.function_parameter_list,eQ.macro_param_block]],eP.FunctionParameterList.pool),tS.createProductionWithOptions(eQ.macro_param_case_list,[[eQ.parameter_declaration],[eD.COMMA,eQ.parameter_declaration],[eQ.macro_param_block],[eQ.macro_param_case_list,eQ.macro_param_block],[eQ.macro_param_case_list,eD.COMMA,eQ.parameter_declaration]],eP.MacroParamCaseList.pool),tS.createProductionWithOptions(eQ.macro_param_block,[[eQ.macro_push_context,eQ.macro_parameter_branch],[eQ.macro_push_context,eQ.macro_param_case_list,eQ.macro_parameter_branch]],eP.MacroParamBlock.pool),tS.createProductionWithOptions(eQ.macro_parameter_branch,[[eQ.macro_pop_context],[eQ.macro_elif_expression,eQ.macro_param_case_list,eQ.macro_parameter_branch],[eQ.macro_else_expression,eQ.macro_param_case_list,eQ.macro_pop_context],[eQ.macro_elif_expression,eQ.macro_parameter_branch],[eQ.macro_else_expression,eQ.macro_pop_context]],eP.MacroParameterBranch.pool),tS.createProductionWithOptions(eQ.parameter_declaration,[[eQ.type_qualifier,eQ.parameter_declarator],[eQ.parameter_declarator],[eQ.macro_call_symbol],[eQ.macro_call_function]],eP.ParameterDeclaration.pool),tS.createProductionWithOptions(eQ.parameter_declarator,[[eQ.type_specifier,eD.ID],[eQ.type_specifier,eD.ID,eQ.array_specifier]],eP.ParameterDeclarator.pool),tS.createProductionWithOptions(eQ.statement_list,[[eQ.statement],[eQ.statement_list,eQ.statement]],eP.StatementList.pool),tS.createProductionWithOptions(eQ.statement,[[eQ.compound_statement],[eQ.simple_statement]]),tS.createProductionWithOptions(eQ.compound_statement_no_scope,[[eD.LEFT_BRACE,eD.RIGHT_BRACE],[eD.LEFT_BRACE,eQ.statement_list,eD.RIGHT_BRACE]],eP.CompoundStatementNoScope.pool),tS.createProductionWithOptions(eQ.compound_statement,[[eD.LEFT_BRACE,eD.RIGHT_BRACE],[eQ.scope_brace,eQ.statement_list,eQ.scope_end_brace]]),tS.createProductionWithOptions(eQ.simple_statement,[[eQ.declaration],[eQ.expression_statement],[eQ.selection_statement],[eQ.iteration_statement],[eQ.jump_statement],[eQ.macro_if_statement],[eQ.macro_undef],[eV.MACRO_DEFINE_EXPRESSION]]),tS.createProductionWithOptions(eQ.declaration,[[eQ.function_prototype,eD.SEMICOLON],[eQ.init_declarator_list,eD.SEMICOLON],[eV.PRECISION,eQ.precision_qualifier,eQ.ext_builtin_type_specifier_nonarray,eD.SEMICOLON],[eQ.type_qualifier,eD.ID,eD.SEMICOLON],[eQ.type_qualifier,eD.ID,eQ.identifier_list,eD.SEMICOLON]],eP.Declaration.pool),tS.createProductionWithOptions(eQ.identifier_list,[[eD.COMMA,eD.ID],[eQ.identifier_list,eD.COMMA,eD.ID]],eP.IdentifierList.pool),tS.createProductionWithOptions(eQ.init_declarator_list,[[eQ.single_declaration],[eQ.init_declarator_list,eD.COMMA,eD.ID],[eQ.init_declarator_list,eD.COMMA,eD.ID,eQ.array_specifier],[eQ.init_declarator_list,eD.COMMA,eD.ID,eQ.array_specifier,eD.EQUAL,eQ.initializer],[eQ.init_declarator_list,eD.COMMA,eD.ID,eD.EQUAL,eQ.initializer]],eP.InitDeclaratorList.pool),tS.createProductionWithOptions(eQ.single_declaration,[[eQ.fully_specified_type,eD.ID],[eQ.fully_specified_type,eD.ID,eQ.array_specifier],[eQ.fully_specified_type,eD.ID,eQ.array_specifier,eD.EQUAL,eQ.initializer],[eQ.fully_specified_type,eD.ID,eD.EQUAL,eQ.initializer]],eP.SingleDeclaration.pool),tS.createProductionWithOptions(eQ.initializer,[[eQ.assignment_expression],[eD.LEFT_BRACE,eQ.initializer_list,eD.RIGHT_BRACE]]),tS.createProductionWithOptions(eQ.initializer_list,[[eQ.initializer],[eQ.initializer_list,eD.COMMA,eQ.initializer]]),tS.createProductionWithOptions(eQ.expression_statement,[[eD.SEMICOLON],[eQ.expression,eD.SEMICOLON]]),tS.createProductionWithOptions(eQ.selection_statement,[[eV.IF,eD.LEFT_PAREN,eQ.expression,eD.RIGHT_PAREN,eQ.statement],[eV.IF,eD.LEFT_PAREN,eQ.expression,eD.RIGHT_PAREN,eQ.statement,eV.ELSE,eQ.statement]]),tS.createProductionWithOptions(eQ.iteration_statement,[[eV.WHILE,eD.LEFT_PAREN,eQ.condition,eD.RIGHT_PAREN,eQ.statement],[eV.FOR,eD.LEFT_PAREN,eQ.for_init_statement,eQ.for_rest_statement,eD.RIGHT_PAREN,eQ.statement]]),tS.createProductionWithOptions(eQ.precision_specifier,[[eV.PRECISION,eQ.precision_qualifier,eQ.ext_builtin_type_specifier_nonarray,eD.SEMICOLON]],eP.PrecisionSpecifier.pool),tS.createProductionWithOptions(eQ.for_init_statement,[[eQ.expression_statement],[eQ.declaration]]),tS.createProductionWithOptions(eQ.condition,[[eQ.expression],[eQ.fully_specified_type,eD.ID,eD.EQUAL,eQ.initializer]]),tS.createProductionWithOptions(eQ.for_rest_statement,[[eQ.conditionopt,eD.SEMICOLON],[eQ.conditionopt,eD.SEMICOLON,eQ.expression]]),tS.createProductionWithOptions(eQ.conditionopt,[[eD.EPSILON],[eQ.condition]]),tS.createProductionWithOptions(eQ.jump_statement,[[eV.CONTINUE,eD.SEMICOLON],[eV.BREAK,eD.SEMICOLON],[eV.RETURN,eD.SEMICOLON],[eV.RETURN,eQ.expression,eD.SEMICOLON],[eV.DISCARD,eD.SEMICOLON]],eP.JumpStatement.pool),tS.createProductionWithOptions(eQ.scope_brace,[[eD.LEFT_BRACE]],eP.ScopeBrace.pool),tS.createProductionWithOptions(eQ.scope_end_brace,[[eD.RIGHT_BRACE]],eP.ScopeEndBrace.pool),tS.createProductionWithOptions(eQ.variable_identifier,[[eD.ID],[eQ.macro_call_symbol],[eQ.macro_call_function]],eP.VariableIdentifier.pool),tS.createProductionWithOptions(eQ.macro_if_statement,[[eQ.macro_push_context,eQ.statement_list,eQ.macro_branch],[eQ.macro_push_context,eQ.macro_branch]],eP.MacroIfStatement.pool),tS.createProductionWithOptions(eQ.macro_branch,[[eQ.macro_pop_context],[eQ.macro_elif_expression,eQ.statement_list,eQ.macro_branch],[eQ.macro_else_expression,eQ.statement_list,eQ.macro_pop_context],[eQ.macro_elif_expression,eQ.macro_branch],[eQ.macro_else_expression,eQ.macro_pop_context]],eP.MacroBranch.pool)),tx=function(e){for(var t=0;t<tC.length;t++){var r=tC[t][1];r&&e.addTranslationRule(t,r)}},tA=/*#__PURE__*/function(){function e(e,t,r){this._traceBackStack=[],this.actionTable=e,this.gotoTable=t,this.grammar=r,this.sematicAnalyzer=new e7}return e.prototype.parse=function(e,n){this.sematicAnalyzer.reset(n);var i=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)===tv.Shift)a.push(l,u.target),s=e.next();else{if((null==u?void 0:u.action)===tv.Accept)return t.Logger.info("[Task - AST compilation] Accept! State automata run "+c+" times! cost time "+(performance.now()-i)+"ms"),null==o.acceptRule||o.acceptRule.call(o,o),o.semanticStack.pop();if((null==u?void 0:u.action)!==tv.Reduce)return eG.createGSError("Unexpected token "+l.lexeme,e0.CompilationError,tR._processingPassText,l.location),null;for(var p=u.target,_=this.grammar.getProductionByID(p),h=o.getTranslationRule(_.id),f=[],d=_.derivation.length-1;d>=0;d--)if(_.derivation[d]!==eD.EPSILON){a.pop();var m=a.pop();if(r(m,eF))f.unshift(m);else{var S=o.semanticStack.pop();f.unshift(S)}}null==h||h.apply(void 0,[].concat([o],f));var v=this.stateGotoTable;a.push(_.goal);var g=null==v?void 0:v.get(_.goal);a.push(g);continue}}},e.create=function(){if(!this._singleton){var t=tE.create(eQ.gs_shader_program,tC.map(function(e){return e[0]})),r=new tg(t);r.generate(),this._singleton=new e(r.actionTable,r.gotoTable,t),tx(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 tT(){return(tT=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 tb=/*#__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}(),tO=/*#__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}(),tI=/*#__PURE__*/function(e){function r(){var t;return t=e.apply(this,arguments)||this,t.hasPendingContent=!1,t}i(r,e);var n=r.prototype;return n.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))},n.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)},n.scanToken=function(){for(;;){if(this.skipCommentsAndSpace(),this.isEnd())return;var e=this.getShaderPosition(0);if(tp.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=eF.pool.get();return a.set(i,n,e),a}this.advance(1)}},n.createCompileError=function(e,t){return eG.createGSError(e,e0.CompilationError,this.source,null!=t?t:this.getShaderPosition(0))},n._scanWord=function(e){for(;tp.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:eD.ID,o=tR.createRange(e,n),s=eF.pool.get();return s.set(a,i,o),s},n._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},n._isValidWordBoundary=function(e){return tp.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||124===e},r._scanDigits=function(e,t){for(var r=t;r<e.length;){var n=e.charCodeAt(r);if(tp.isDigit(n))r++;else break}return r},r}(tp);tI._keywordLexemeTable={RenderQueueType:eV.GSRenderQueueType,BlendState:eV.GSBlendState,DepthState:eV.GSDepthState,StencilState:eV.GSStencilState,RasterState:eV.GSRasterState,EditorProperties:eV.GSEditorProperties,EditorMacros:eV.GSEditorMacros,Editor:eV.GSEditor,Tags:eV.GSTags,VertexShader:eV.GSVertexShader,FragmentShader:eV.GSFragmentShader,SubShader:eV.GSSubShader,Pass:eV.GSPass,BlendFactor:eV.GSBlendFactor,BlendOperation:eV.GSBlendOperation,Bool:eV.GSBool,Number:eV.GSNumber,Color:eV.GSColor,CompareFunction:eV.GSCompareFunction,StencilOperation:eV.GSStencilOperation,CullMode:eV.GSCullMode,ColorWriteMask:eV.GSColorWriteMask,UsePass:eV.GSUsePass,true:eV.True,false:eV.False},tI._symbolLexemeTable={"{":eV.LeftBrace,"}":eV.RightBrace,"=":eV.Equal,"|":eV.BitwiseOr};var tL=/*#__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:tT({},o.constantMap),variableMap:tT({},o.variableMap)};this._mergeRenderStates(p,l.renderStates);for(var _=0,h=l.passes.length;_<h;_++){var f=l.passes[_],d={constantMap:tT({},p.constantMap),variableMap:tT({},p.variableMap)};if(this._mergeRenderStates(d,f.renderStates),f.renderStates=d,!f.isUsePass){var m=u.concat(f.pendingContents);f.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=tb.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 eV.GSSubShader:this._addPendingContents(i,o.lexeme.length,a);var s=this._parseSubShader();r.subShaders.push(s),i=e.getShaderPosition(0);break;case eV.GSEditorProperties:case eV.GSEditorMacros:case eV.GSEditor:this._addPendingContents(i,o.lexeme.length,a),e.scanPairedChar("{","}",!0,!1),i=e.getShaderPosition(0);break;case eV.LeftBrace:++n;break;case eV.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===eD.ID){r.scanLexeme("{");var i=this._parseRenderStateProperties(t.lexeme),a=new tO(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 tO(t.lexeme,t.type);this._symbolTableStack.insert(r)},e._pushScope=function(){var e=new eY;this._symbolTableStack.pushScope(e)},e._popScope=function(){this._symbolTableStack.popScope()},e._parseRenderStateProperties=function(e){for(var t=this._lexer,r=tb.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._scanEnumConstValue=function(e){var t,r=this._lexer;r.advance(1);var n=r.scanToken(),i=null==(t=this._renderStateConstMap[e])?void 0:t[n.lexeme];return void 0==i&&this._createCompileError("Invalid engine constant: "+e+"."+n.lexeme,n.location),i},e._parseRenderStateProperty=function(e,r){var n,i=this._lexer,a=i.scanToken().lexeme,o=a;if("BlendState"===e&&"BlendColor"!==a&&"AlphaToCoverage"!==a){var s=0,c=i.scanTwoExpectedLexemes("[","=");"["===c?(s=i.scanNumber(),i.scanLexeme("]"),i.scanLexeme("=")):"="!==c&&this._createCompileError("Invalid syntax, expect '[' or '=', but got unexpected token"),o+=s}else i.scanLexeme("=");var l=t.RenderStateElementKey[e+o];void 0===l&&this._createCompileError("Invalid render state property "+a),i.skipCommentsAndSpace();var u=i.getCurCharCode();if(tp.isDigit(u)||46===u)n=i.scanNumber();else{var p=i.scanToken(),_=p.type;if(_===eV.True)n=!0;else if(_===eV.False)n=!1;else if(_===eV.GSColor)n=i.scanColor();else if("."===i.getCurChar()){if(void 0==(n=this._scanEnumConstValue(p.lexeme)))return;if(i.skipCommentsAndSpace(),"|"===i.getCurChar()){if("ColorWriteMask"!==p.lexeme){this._createCompileError("Bitwise OR '|' is not supported for '"+p.lexeme+"', only bitmask enums like 'ColorWriteMask' support this",p.location);return}for(;"|"===i.getCurChar();){i.advance(1);var h=i.scanToken();if(void 0==h||"."!==i.getCurChar()){this._createCompileError("Invalid syntax after '|', expect 'EnumType.Value'",null==h?void 0:h.location);return}if(h.lexeme!==p.lexeme){this._createCompileError("Cannot mix enum types in bitwise OR: expected '"+p.lexeme+"' but got '"+h.lexeme+"'",h.location);return}var f=this._scanEnumConstValue(h.lexeme);if(void 0==f)return;n|=f,i.skipCommentsAndSpace()}}}else{n=p.lexeme;var d=this._lookupSymbol;d.set(p.lexeme,eD.ID),this._symbolTableStack.lookup(d)||this._createCompileError("Invalid "+e+" variable: "+p.lexeme,p.location)}}i.scanLexeme(";"),"string"==typeof n?r.variableMap[l]=n:r.constantMap[l]=n},e._parseRenderQueueDeclarationOrAssignment=function(e){var r=this._lexer,n=r.scanToken();if(n.type===eD.ID){r.scanLexeme(";");var i=new tO(n.lexeme,eV.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,eV.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:tT({},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=tb.createSubShaderSource(r);e.scanLexeme("{"),e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0);;){var a=e.scanToken();switch(a.type){case eV.GSPass:this._addPendingContents(i,a.lexeme.length,n.pendingContents);var o=this._parsePass();n.passes.push(o),i=e.getShaderPosition(0);break;case eV.GSUsePass:this._addPendingContents(i,a.lexeme.length,n.pendingContents);var s=e.scanPairedChar('"','"',!1,!1);n.passes.push(tb.createUsePass(s)),i=e.getShaderPosition(0);break;case eV.LeftBrace:++t;break;case eV.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=tb.createShaderPassSource(t);e.scanLexeme("{");var n=1;e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0);;){var a=e.scanToken();switch(a.type){case eV.GSVertexShader:case eV.GSFragmentShader:this._addPendingContents(i,a.lexeme.length,r.pendingContents),e.scanLexeme("=");var o=e.scanToken();r[a.lexeme]&&eG.createGSError("Reassign main entry",e0.CompilationError,e.source,e.getShaderPosition(0)),r[a.type===eV.GSVertexShader?"vertexEntry":"fragmentEntry"]=o.lexeme,e.scanLexeme(";"),i=e.getShaderPosition(0);break;case eV.LeftBrace:++n;break;case eV.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===eV.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 eV.GSBlendState:case eV.GSDepthState:case eV.GSRasterState:case eV.GSStencilState:this._addPendingContents(t,e.lexeme.length,r),this._parseRenderStateDeclarationOrAssignment(n,e),t=this._lexer.getShaderPosition(0);break;case eV.GSBlendFactor:case eV.GSBlendOperation:case eV.GSBool:case eV.GSNumber:case eV.GSColor:case eV.GSCompareFunction:case eV.GSStencilOperation:case eV.GSCullMode:case eV.GSColorWriteMask:this._addPendingContents(t,e.lexeme.length,r),this._parseVariableDeclaration(),t=this._lexer.getShaderPosition(0);break;case eV.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}();tL.errors=[],tL._renderStateConstMap={RenderQueueType:t.RenderQueueType,CompareFunction:t.CompareFunction,StencilOperation:t.StencilOperation,BlendOperation:t.BlendOperation,BlendFactor:t.BlendFactor,CullMode:t.CullMode,ColorWriteMask:t.ColorWriteMask},tL._symbolTableStack=new eK,tL._lexer=new tI,tL._lookupSymbol=new tO("",null);var tR=/*#__PURE__*/function(){function e(){}var n=e.prototype;return n._parseShaderSource=function(e){return eG.clearAllShaderLabObjectPool(),tL.parse(e)},n._parseShaderPass=function(r,n,i,a,o){var s=performance.now(),c={};eB._repeatIncludeSet.clear();var l=eB.parse(r,o,c);t.Logger.info("[Task - Pre processor] cost time "+(performance.now()-s)+"ms");var u=new t_(l,c).tokenize(),p=e._parser;e._processingPassText=l;var _=p.parse(u,c);if(_){var h=a===t.ShaderLanguage.GLSLES100?tc.getVisitor():tu.getVisitor(),f=performance.now(),d=h.visitShaderProgram(_,n,i);return t.Logger.info("[Task - CodeGen] cost time: "+(performance.now()-f)+"ms"),t.Logger.info("[Task - Total compilation] cost time: "+(performance.now()-s)+"ms"),e._processingPassText=void 0,d&&(d.vertexShaderInstructions=tf.parse(d.vertex),d.fragmentShaderInstructions=tf.parse(d.fragment)),d}},n._precompile=function(e,t,r){var n=this,i=this._parseShaderSource(e),a=i.subShaders.map(function(e){return{name:e.name,tags:e.tags,passes:e.passes.map(function(a){if(a.isUsePass)return{name:a.name,isUsePass:!0,tags:a.tags,renderStates:n._serializeRenderStates(a.renderStates)};var o=n._parseShaderPass(a.contents,a.vertexEntry,a.fragmentEntry,t,r);if(!o)throw Error('Shader pass "'+i.name+"."+e.name+"."+a.name+'" precompile failed, please check the shader source code.');return{name:a.name,isUsePass:!1,tags:a.tags,renderStates:n._serializeRenderStates(a.renderStates),vertexShaderInstructions:o.vertexShaderInstructions,fragmentShaderInstructions:o.fragmentShaderInstructions}})}});return{name:i.name,platformTarget:t,subShaders:a}},n._serializeRenderStates=function(e){var n={};for(var i in e.constantMap){var a=e.constantMap[i];r(a,t.Color)?n[i]=[a.r,a.g,a.b,a.a]:n[i]=a}return{constantMap:n,variableMap:e.variableMap}},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}();tR._parser=tA.create(),tR._shaderPositionPool=eG.createObjectPool(eN),tR._shaderRangePool=eG.createObjectPool(eM);var tP="2.0.0-alpha.28";console.log("Galacean Engine ShaderLab Version: "+tP+" | Mode: Release"),e.GSError=e$,e.GSErrorName=e0,e.ShaderLab=tR,e.version=tP,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
2
2
|
//# sourceMappingURL=browser.min.js.map
|