@galacean/engine-shaderlab 1.6.0-alpha.1 → 1.6.0-beta.0

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.
Files changed (70) hide show
  1. package/dist/browser.js +6325 -4885
  2. package/dist/browser.js.map +1 -1
  3. package/dist/browser.min.js +1 -1
  4. package/dist/browser.min.js.map +1 -1
  5. package/dist/browser.verbose.js +5956 -4985
  6. package/dist/browser.verbose.js.map +1 -1
  7. package/dist/browser.verbose.min.js +1 -1
  8. package/dist/browser.verbose.min.js.map +1 -1
  9. package/dist/main.js +6325 -4885
  10. package/dist/main.js.map +1 -1
  11. package/dist/main.verbose.js +5956 -4985
  12. package/dist/main.verbose.js.map +1 -1
  13. package/dist/module.js +6325 -4887
  14. package/dist/module.js.map +1 -1
  15. package/dist/module.verbose.js +5958 -4986
  16. package/dist/module.verbose.js.map +1 -1
  17. package/package.json +4 -4
  18. package/types/GSError.d.ts +2 -1
  19. package/types/ParserUtils.d.ts +1 -1
  20. package/types/Preprocessor.d.ts +31 -0
  21. package/types/ShaderLab.d.ts +15 -1
  22. package/types/codeGen/CodeGenVisitor.d.ts +1 -2
  23. package/types/codeGen/GLES100.d.ts +4 -8
  24. package/types/codeGen/GLES300.d.ts +9 -6
  25. package/types/codeGen/types.d.ts +2 -2
  26. package/types/common/BaseLexer.d.ts +2 -0
  27. package/types/common/IBaseSymbol.d.ts +5 -0
  28. package/types/common/SymbolTable.d.ts +7 -0
  29. package/types/common/SymbolTableStack.d.ts +13 -0
  30. package/types/common/enums/Keyword.d.ts +108 -0
  31. package/types/common/index.d.ts +1 -1
  32. package/types/common/types.d.ts +4 -5
  33. package/types/index.d.ts +0 -1
  34. package/types/lalr/CFG.d.ts +1 -1
  35. package/types/lexer/Lexer.d.ts +10 -5
  36. package/types/{preprocessor → macroProcessor}/MacroDefine.d.ts +2 -2
  37. package/types/macroProcessor/MacroParserLexer.d.ts +32 -0
  38. package/types/macroProcessor/Utils.d.ts +5 -0
  39. package/types/{preprocessor → macroProcessor}/constants.d.ts +4 -6
  40. package/types/macroProcessor/index.d.ts +1 -0
  41. package/types/parser/AST.d.ts +124 -23
  42. package/types/parser/GrammarSymbol.d.ts +21 -1
  43. package/types/parser/ShaderInfo.d.ts +4 -2
  44. package/types/parser/ShaderTargetParser.d.ts +3 -2
  45. package/types/parser/builtin/functions.d.ts +2 -1
  46. package/types/parser/builtin/variables.d.ts +1 -1
  47. package/types/parser/symbolTable/SymbolInfo.d.ts +12 -8
  48. package/types/parser/symbolTable/index.d.ts +1 -1
  49. package/types/parser/types.d.ts +7 -6
  50. package/types/sourceParser/ShaderSourceFactory.d.ts +8 -0
  51. package/types/sourceParser/ShaderSourceSymbol.d.ts +10 -0
  52. package/types/sourceParser/SourceLexer.d.ts +19 -0
  53. package/types/sourceParser/index.d.ts +1 -0
  54. package/types/common/BaseScanner.d.ts +0 -2
  55. package/types/common/BaseSymbolTable.d.ts +0 -18
  56. package/types/common/Keywords.d.ts +0 -99
  57. package/types/contentParser/ContentSymbolTable.d.ts +0 -10
  58. package/types/contentParser/KeywordMap.d.ts +0 -2
  59. package/types/contentParser/Scanner.d.ts +0 -10
  60. package/types/contentParser/index.d.ts +0 -1
  61. package/types/lexer/Utils.d.ts +0 -7
  62. package/types/parser/symbolTable/TargetSymbolTable.d.ts +0 -13
  63. package/types/preprocessor/PpScanner.d.ts +0 -51
  64. package/types/preprocessor/Preprocessor.d.ts +0 -1
  65. package/types/preprocessor/Utils.d.ts +0 -10
  66. package/types/preprocessor/index.d.ts +0 -1
  67. /package/types/common/{Enums.d.ts → enums/ShaderStage.d.ts} +0 -0
  68. /package/types/{preprocessor/PpParser.d.ts → macroProcessor/MacroParser.d.ts} +0 -0
  69. /package/types/{preprocessor → macroProcessor}/sourceMap/index.d.ts +0 -0
  70. /package/types/{contentParser/ShaderContentParser.d.ts → sourceParser/ShaderSourceParser.d.ts} +0 -0
@@ -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){(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 n(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,void 0)}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(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&&i(e,t)}function o(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 s,c,u,l,p,h,_,d,f,S,g,v,m,y,E,x,C,T,A,b,O,I,P,L,R,M,N,k,V,G,D,F,w,B,U,W,j,H,z,q,X,Q,Y,K,J,$,Z,ee,et,er,en,ei,ea,eo,es,ec,eu,el,ep,eh,e_,ed,ef,eS,eg,ev,em,ey,eE,ex,eC,eT,eA,eb,eO,eI,eP,eL,eR,eM,eN,ek,eV,eG,eD,eF,ew,eB,eU,eW=/*#__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}(),ej=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t,r){this.index=e,this.line=t,this.column=r},t.dispose=function(){this.index=0,this.line=0,this.column=0},e}(),eH=((s={})[s.ATTRIBUTE=0]="ATTRIBUTE",s[s.CONST=1]="CONST",s[s.BOOL=2]="BOOL",s[s.FLOAT=3]="FLOAT",s[s.DOUBLE=4]="DOUBLE",s[s.INT=5]="INT",s[s.UINT=6]="UINT",s[s.BREAK=7]="BREAK",s[s.CONTINUE=8]="CONTINUE",s[s.DO=9]="DO",s[s.ELSE=10]="ELSE",s[s.FOR=11]="FOR",s[s.IF=12]="IF",s[s.WHILE=13]="WHILE",s[s.DISCARD=14]="DISCARD",s[s.RETURN=15]="RETURN",s[s.BVEC2=16]="BVEC2",s[s.BVEC3=17]="BVEC3",s[s.BVEC4=18]="BVEC4",s[s.IVEC2=19]="IVEC2",s[s.IVEC3=20]="IVEC3",s[s.IVEC4=21]="IVEC4",s[s.UVEC2=22]="UVEC2",s[s.UVEC3=23]="UVEC3",s[s.UVEC4=24]="UVEC4",s[s.VEC2=25]="VEC2",s[s.VEC3=26]="VEC3",s[s.VEC4=27]="VEC4",s[s.VEC4_ARRAY=28]="VEC4_ARRAY",s[s.MAT2=29]="MAT2",s[s.MAT3=30]="MAT3",s[s.MAT4=31]="MAT4",s[s.MAT2X3=32]="MAT2X3",s[s.MAT2X4=33]="MAT2X4",s[s.MAT3X2=34]="MAT3X2",s[s.MAT3X4=35]="MAT3X4",s[s.MAT4X2=36]="MAT4X2",s[s.MAT4X3=37]="MAT4X3",s[s.IN=38]="IN",s[s.OUT=39]="OUT",s[s.INOUT=40]="INOUT",s[s.CENTROID=41]="CENTROID",s[s.SAMPLER2D=42]="SAMPLER2D",s[s.SAMPLER3D=43]="SAMPLER3D",s[s.SAMPLER_CUBE=44]="SAMPLER_CUBE",s[s.SAMPLER2D_SHADOW=45]="SAMPLER2D_SHADOW",s[s.SAMPLER_CUBE_SHADOW=46]="SAMPLER_CUBE_SHADOW",s[s.SAMPLER2D_ARRAY=47]="SAMPLER2D_ARRAY",s[s.SAMPLER2D_ARRAY_SHADOW=48]="SAMPLER2D_ARRAY_SHADOW",s[s.I_SAMPLER2D=49]="I_SAMPLER2D",s[s.I_SAMPLER3D=50]="I_SAMPLER3D",s[s.I_SAMPLER_CUBE=51]="I_SAMPLER_CUBE",s[s.I_SAMPLER2D_ARRAY=52]="I_SAMPLER2D_ARRAY",s[s.U_SAMPLER2D=53]="U_SAMPLER2D",s[s.U_SAMPLER3D=54]="U_SAMPLER3D",s[s.U_SAMPLER_CUBE=55]="U_SAMPLER_CUBE",s[s.U_SAMPLER2D_ARRAY=56]="U_SAMPLER2D_ARRAY",s[s.STRUCT=57]="STRUCT",s[s.LAYOUT=58]="LAYOUT",s[s.LOCATION=59]="LOCATION",s[s.VOID=60]="VOID",s[s.TRUE=61]="TRUE",s[s.FALSE=62]="FALSE",s[s.PRECISION=63]="PRECISION",s[s.PRECISE=64]="PRECISE",s[s.HIGHP=65]="HIGHP",s[s.MEDIUMP=66]="MEDIUMP",s[s.LOWP=67]="LOWP",s[s.INVARIANT=68]="INVARIANT",s[s.SMOOTH=69]="SMOOTH",s[s.FLAT=70]="FLAT",s[s.NOPERSPECTIVE=71]="NOPERSPECTIVE",s[s.GS_RenderQueueType=72]="GS_RenderQueueType",s[s.GS_BlendState=73]="GS_BlendState",s[s.GS_DepthState=74]="GS_DepthState",s[s.GS_StencilState=75]="GS_StencilState",s[s.GS_RasterState=76]="GS_RasterState",s[s.GS_EditorProperties=77]="GS_EditorProperties",s[s.GS_EditorMacros=78]="GS_EditorMacros",s[s.GS_Editor=79]="GS_Editor",s[s.GS_Tags=80]="GS_Tags",s[s.GS_ReplacementTag=81]="GS_ReplacementTag",s[s.GS_LightMode=82]="GS_LightMode",s[s.GS_PipelineStage=83]="GS_PipelineStage",s[s.GS_VertexShader=84]="GS_VertexShader",s[s.GS_FragmentShader=85]="GS_FragmentShader",s[s.GS_SubShader=86]="GS_SubShader",s[s.GS_Pass=87]="GS_Pass",s[s.GS_BlendFactor=88]="GS_BlendFactor",s[s.GS_BlendOperation=89]="GS_BlendOperation",s[s.GS_Bool=90]="GS_Bool",s[s.GS_Number=91]="GS_Number",s[s.GS_Color=92]="GS_Color",s[s.GS_CompareFunction=93]="GS_CompareFunction",s[s.GS_StencilOperation=94]="GS_StencilOperation",s[s.GS_CullMode=95]="GS_CullMode",s[s.GS_UsePass=96]="GS_UsePass",s),ez=new Map([["attribute",eH.ATTRIBUTE],["const",eH.CONST],["bool",eH.BOOL],["float",eH.FLOAT],["double",eH.DOUBLE],["int",eH.INT],["uint",eH.UINT],["break",eH.BREAK],["continue",eH.CONTINUE],["do",eH.DO],["else",eH.ELSE],["for",eH.FOR],["if",eH.IF],["while",eH.WHILE],["discard",eH.DISCARD],["return",eH.RETURN],["bvec2",eH.BVEC2],["bvec3",eH.BVEC3],["bvec4",eH.BVEC4],["ivec2",eH.IVEC2],["ivec3",eH.IVEC3],["ivec4",eH.IVEC4],["uvec2",eH.UVEC2],["uvec3",eH.UVEC3],["uvec4",eH.UVEC4],["vec2",eH.VEC2],["vec3",eH.VEC3],["vec4",eH.VEC4],["mat2",eH.MAT2],["mat3",eH.MAT3],["mat4",eH.MAT4],["in",eH.IN],["out",eH.OUT],["inout",eH.INOUT],["sampler2D",eH.SAMPLER2D],["samplerCube",eH.SAMPLER_CUBE],["sampler3D",eH.SAMPLER3D],["sampler2DShadow",eH.SAMPLER2D_SHADOW],["samplerCubeShadow",eH.SAMPLER_CUBE_SHADOW],["sampler2DArray",eH.SAMPLER2D_ARRAY],["sampler2DArrayShadow",eH.SAMPLER2D_ARRAY_SHADOW],["isampler2D",eH.I_SAMPLER2D],["isampler3D",eH.I_SAMPLER3D],["isamplerCube",eH.I_SAMPLER_CUBE],["isampler2DArray",eH.I_SAMPLER2D_ARRAY],["usampler2D",eH.U_SAMPLER2D],["usampler3D",eH.U_SAMPLER3D],["usamplerCube",eH.U_SAMPLER_CUBE],["usampler2DArray",eH.U_SAMPLER2D_ARRAY],["struct",eH.STRUCT],["void",eH.VOID],["true",eH.TRUE],["false",eH.FALSE],["precision",eH.PRECISION],["precise",eH.PRECISE],["highp",eH.HIGHP],["mediump",eH.MEDIUMP],["lowp",eH.LOWP],["invariant",eH.INVARIANT],["flat",eH.FLAT],["smooth",eH.SMOOTH],["noperspective",eH.NOPERSPECTIVE],["centroid",eH.CENTROID],["layout",eH.LAYOUT],["location",eH.LOCATION]]),eq=((c={})[c.ID=1e3]="ID",c[c.FLOAT_CONSTANT=1001]="FLOAT_CONSTANT",c[c.INT_CONSTANT=1002]="INT_CONSTANT",c[c.STRING_CONST=1003]="STRING_CONST",c[c.LEFT_OP=1004]="LEFT_OP",c[c.RIGHT_OP=1005]="RIGHT_OP",c[c.INC_OP=1006]="INC_OP",c[c.DEC_OP=1007]="DEC_OP",c[c.LE_OP=1008]="LE_OP",c[c.GE_OP=1009]="GE_OP",c[c.EQ_OP=1010]="EQ_OP",c[c.NE_OP=1011]="NE_OP",c[c.AND_OP=1012]="AND_OP",c[c.OR_OP=1013]="OR_OP",c[c.XOR_OP=1014]="XOR_OP",c[c.MUL_ASSIGN=1015]="MUL_ASSIGN",c[c.DIV_ASSIGN=1016]="DIV_ASSIGN",c[c.ADD_ASSIGN=1017]="ADD_ASSIGN",c[c.SUB_ASSIGN=1018]="SUB_ASSIGN",c[c.MOD_ASSIGN=1019]="MOD_ASSIGN",c[c.LEFT_ASSIGN=1020]="LEFT_ASSIGN",c[c.RIGHT_ASSIGN=1021]="RIGHT_ASSIGN",c[c.AND_ASSIGN=1022]="AND_ASSIGN",c[c.XOR_ASSIGN=1023]="XOR_ASSIGN",c[c.OR_ASSIGN=1024]="OR_ASSIGN",c[c.LEFT_PAREN=1025]="LEFT_PAREN",c[c.RIGHT_PAREN=1026]="RIGHT_PAREN",c[c.LEFT_BRACKET=1027]="LEFT_BRACKET",c[c.RIGHT_BRACKET=1028]="RIGHT_BRACKET",c[c.LEFT_BRACE=1029]="LEFT_BRACE",c[c.RIGHT_BRACE=1030]="RIGHT_BRACE",c[c.DOT=1031]="DOT",c[c.COMMA=1032]="COMMA",c[c.COLON=1033]="COLON",c[c.EQUAL=1034]="EQUAL",c[c.SEMICOLON=1035]="SEMICOLON",c[c.BANG=1036]="BANG",c[c.DASH=1037]="DASH",c[c.TILDE=1038]="TILDE",c[c.PLUS=1039]="PLUS",c[c.STAR=1040]="STAR",c[c.SLASH=1041]="SLASH",c[c.PERCENT=1042]="PERCENT",c[c.LEFT_ANGLE=1043]="LEFT_ANGLE",c[c.RIGHT_ANGLE=1044]="RIGHT_ANGLE",c[c.VERTICAL_BAR=1045]="VERTICAL_BAR",c[c.CARET=1046]="CARET",c[c.AMPERSAND=1047]="AMPERSAND",c[c.QUESTION=1048]="QUESTION",c[c.NOT_WORD=1049]="NOT_WORD",c[c.EPSILON=1998]="EPSILON",c[c.EOF=1999]="EOF",c);function eX(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function eQ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eQ=function(){return!!e})()}function eY(e,t,r){return(eY=eQ()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var a=new(Function.bind.apply(e,n));return r&&i(a,r.prototype),a}).apply(null,arguments)}function eK(e){return(eK=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eJ(e){var t="function"==typeof Map?new Map:void 0;return(eJ=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 eY(e,arguments,eK(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(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 a(t,e),t.prototype.toString=function(){var e,r,n=this.message,i=this.location,a=this.source;if(!a)return n;eX(i,ej)?e=r=i:(e=i.start,r=i.end);for(var o=a.split("\n"),s=this.name+": "+n+"\n\n",c="|\xb7\xb7\xb7",u=t.wrappingLineCount,l=e.line-u,p=r.line+u;l<=p;l++){var h=o[l];if(s+=c+""+h+"\n",!(l<e.line)&&!(l>r.line)){var _=0,d=h.length,f=c.length;l===e.line&&(_=e.column,f+=e.column),l===r.line&&(d=r.column);var S=Math.max(d-_,1);s+=" ".repeat(f)+"^".repeat(S)+"\n"}}return s},t}(eJ(Error));e$.wrappingLineCount=2;var eZ=((u={}).PreprocessorError="PreprocessorError",u.CompilationError="CompilationError",u.ScannerError="ScannerError",u),e0=/*#__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,t,r,n,i){return new e$(t,e,n,r,i)},e}();e0._shaderLabObjectPoolSet=[];var e2=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t,r){if(this.type=e,this.lexeme=t,r){if(eX(r,eW))this.location=r;else{var n=t3.createPosition(r.index+t.length,r.line,r.column+t.length);this.location=t3.createRange(r,n)}}},t.dispose=function(){},e}();e2.pool=e0.createObjectPool(e2);var e1=new e2;e1.set(eq.EOF,"/EOF");var e3=/*#__PURE__*/function(){function e(){}return e.isNum=function(e){return e>=48&&e<=57},e.isLetter=function(e){return 95===e||e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122},e.isAlpha=function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122},e.isPpCharacters=function(e){return 35===e||95===e||e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122},e.isSpace=function(e){return 9===e||10===e||13===e||32===e},e}();function e4(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 e9(e,t,r){return t&&e4(e.prototype,t),r&&e4(e,r),e}var e5=/*#__PURE__*/function(){function e(e,t){void 0===t&&(t=new Map),this._currentIndex=0,this._column=0,this._line=0,this._source=e,this._keywordsMap=t}var r=e.prototype;return r.getCurPosition=function(){return t3.createPosition(this._currentIndex,this._line,this._column)},r.isEnd=function(){return this._currentIndex>=this._source.length},r.getCurChar=function(){return this._source[this._currentIndex]},r.getCurCharCode=function(){return this._source.charCodeAt(this._currentIndex)},r.advance=function(e){void 0===e&&(e=1);for(var t=0;t<e;t++)this._advance()},r._advance=function(){"\n"===this.getCurChar()?(this._line+=1,this._column=0):this._column+=1,this._currentIndex++},r.skipSpace=function(t){for(var r=t?e._spaceCharsWithBreak:e._spaceChars,n=this.getCurChar();e._checkIsIn(n,r);)this._advance(),n=this.getCurChar()},r.skipCommentsAndSpace=function(){if(this.skipSpace(!0),"//"===this.peek(2)){var e=this.getCurPosition();this.advance(2);for(var t=this.getCurChar();"\n"!==t&&"\r"!==t&&!this.isEnd();)this._advance(),t=this.getCurChar();return this.skipCommentsAndSpace(),t3.createRange(e,this.getCurPosition())}if("/*"===this.peek(2)){var r=this.getCurPosition();for(this.advance(2);"*/"!==this.peek(2)&&!this.isEnd();)this._advance();return this.advance(2),this.skipCommentsAndSpace(),t3.createRange(r,this.getCurPosition())}},r.peek=function(e){var t=this._currentIndex;return this._source.substring(t,t+e)},r.scanText=function(e){this.skipCommentsAndSpace();var t=this.peek(e.length);t!==e&&this.throwError(this.getCurPosition(),'Expect text "'+e+'", but got "'+t+'"'),this.advance(e.length)},r.throwError=function(e){for(var r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var a=e0.createGSError(n.join(" "),eZ.ScannerError,this._source,e);throw t.Logger.error(a.toString()),a},r.scanPairedText=function(e,t,r,n){void 0===r&&(r=!1),void 0===n&&(n=!1),n||this.scanText(e);for(var i=this._currentIndex,a=r?1:0;this.peek(t.length)!==t||0!==a;){if(this.isEnd())return;if(r){if(this.peek(e.length)===e){a+=1,this.advance(e.length);continue}if(this.peek(t.length)===t){if(0==(a-=1))break;this.advance(t.length);continue}}this.advance(t.length)}return this.advance(t.length),this._source.substring(i,this._currentIndex-t.length)},r.scanToken=function(e,t){void 0===t&&(t=/\w/),this.skipCommentsAndSpace();var r,n=this.getCurPosition();if(!this.isEnd()){for(;t.test(this.getCurChar())&&!this.isEnd();)this._advance();var i=this.getCurPosition();if(n.index===i.index){this._advance();var a=e2.pool.get();return a.set(eq.NOT_WORD,this._source[n.index],n),null==e||e(a,this),a}var o=this._source.substring(n.index,i.index),s=null!=(r=this._keywordsMap.get(o))?r:eq.ID,c=t3.createRange(n,i),u=e2.pool.get();return u.set(s,o,c),null==e||e(u,this),u}},e._checkIsIn=function(e,t){for(var r=0;r<t.length;r++)if(e===t[r])return!0;return!1},e9(e,[{key:"current",get:function(){return this._currentIndex}},{key:"source",get:function(){return this._source}},{key:"line",get:function(){return this._line}},{key:"column",get:function(){return this._column}}]),e}();e5._spaceCharsWithBreak=[" "," ","\n","\r"],e5._spaceChars=[" "," "];var e6=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.reset=function(e){this._source=e,this._currentIndex=0,this._line=this._column=0},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,e1]}})},r.skipSpace=function(){for(;e3.isSpace(this.getCurCharCode());)this._advance()},r.scanToken=function(){if(this.skipCommentsAndSpace(),this.isEnd())return e1;if(e3.isAlpha(this.getCurCharCode()))return this._scanWord();if(e3.isNum(this.getCurCharCode()))return this._scanNum();var e,t=this._getPosition(),r=e2.pool.get();switch(this.getCurChar()){case"<":if(this._advance(),"<"===(e=this.getCurChar())){if(this._advance(),"="===this.getCurChar()){this._advance(),r.set(eq.LEFT_ASSIGN,"<<=",t);break}r.set(eq.LEFT_OP,"<<",t);break}if("="===e){this._advance(),r.set(eq.LE_OP,"<=",t);break}r.set(eq.LEFT_ANGLE,"<",t);break;case">":if(this._advance(),">"===(e=this.getCurChar())){if(this._advance(),"="===this.getCurChar()){this._advance(),r.set(eq.RIGHT_ASSIGN,">>=",t);break}r.set(eq.RIGHT_OP,">>",t);break}if("="===e){this._advance(),r.set(eq.GE_OP,">=",t);break}r.set(eq.RIGHT_ANGLE,">",t);break;case"+":if(this._advance(),"+"===(e=this.getCurChar())){this._advance(),r.set(eq.INC_OP,"++",t);break}if("="===e){this._advance(),r.set(eq.ADD_ASSIGN,"+=",t);break}r.set(eq.PLUS,"+",t);break;case"-":if(this._advance(),"-"===(e=this.getCurChar())){this._advance(),r.set(eq.DEC_OP,"--",t);break}if("="===e){this._advance(),r.set(eq.SUB_ASSIGN,"-=",t);break}r.set(eq.DASH,"-",t);break;case"=":if(this._advance(),"="===this.getCurChar()){this._advance(),r.set(eq.EQ_OP,"==",t);break}r.set(eq.EQUAL,"=",t);break;case"!":if(this._advance(),"="===this.getCurChar()){this._advance(),r.set(eq.NE_OP,"!=",t);break}r.set(eq.BANG,"!",t);break;case"&":if(this._advance(),"&"===(e=this.getCurChar())){this._advance(),r.set(eq.AND_OP,"&&",t);break}if("="===e){this._advance(),r.set(eq.ADD_ASSIGN,"&=",t);break}r.set(eq.AMPERSAND,"&",t);break;case"|":if(this._advance(),"|"===(e=this.getCurChar())){this._advance(),r.set(eq.OR_OP,"||",t);break}if("="===e){this._advance(),r.set(eq.OR_ASSIGN,"|=",t);break}r.set(eq.VERTICAL_BAR,"|",t);break;case"^":if(this._advance(),"^"===(e=this.getCurChar())){this._advance(),r.set(eq.XOR_OP,"^^",t);break}if("="===e){this._advance(),r.set(eq.XOR_ASSIGN,"^=",t);break}r.set(eq.CARET,"^",t);break;case"*":if(this._advance(),"="===this.getCurChar()){this._advance(),r.set(eq.MUL_ASSIGN,"*=",t);break}r.set(eq.STAR,"*",t);break;case"/":if(this._advance(),"="===this.getCurChar()){this._advance(),r.set(eq.DIV_ASSIGN,"/=",t);break}r.set(eq.SLASH,"/",t);break;case"%":if(this._advance(),"="===this.getCurChar()){this._advance(),r.set(eq.MOD_ASSIGN,"%=",t);break}r.set(eq.PERCENT,"%",t);break;case"(":this._advance(),r.set(eq.LEFT_PAREN,"(",t);break;case")":this._advance(),r.set(eq.RIGHT_PAREN,")",t);break;case"{":this._advance(),r.set(eq.LEFT_BRACE,"{",t);break;case"}":this._advance(),r.set(eq.RIGHT_BRACE,"}",t);break;case"[":this._advance(),r.set(eq.LEFT_BRACKET,"[",t);break;case"]":this._advance(),r.set(eq.RIGHT_BRACKET,"]",t);break;case".":if(this._advance(),e3.isNum(this.getCurCharCode()))return this._scanNumAfterDot();r.set(eq.DOT,".",t);break;case",":this._advance(),r.set(eq.COMMA,",",t);break;case":":this._advance(),r.set(eq.COLON,":",t);break;case";":this._advance(),r.set(eq.SEMICOLON,";",t);break;case"~":this._advance(),r.set(eq.TILDE,"~",t);break;case"?":this._advance(),r.set(eq.QUESTION,"?",t);break;case'"':return this._advance(),this._scanStringConst();default:this.throwError(this.getCurPosition(),"Unexpected character "+this.getCurChar())}return r},r._scanStringConst=function(){for(var e=this._getPosition(),t=[];'"'!==this.getCurChar();)t.push(this.getCurChar()),this._advance();this._advance();var r=t3.createRange(e,this._getPosition()),n=e2.pool.get();return n.set(eq.STRING_CONST,t.join(""),r),n},r._scanNumAfterDot=function(){for(var e=["."];e3.isNum(this.getCurCharCode());)e.push(this.getCurChar()),this._advance();var t=e2.pool.get();return t.set(eq.FLOAT_CONSTANT,e.join(""),this._getPosition(1)),t},r._getPosition=function(e){return void 0===e&&(e=0),t3.createPosition(this.current-e,this._line,this._column-e)},r._scanWord=function(){var e=[this.getCurChar()],t=this._getPosition();for(this._advance();e3.isLetter(this.getCurCharCode());)e.push(this.getCurChar()),this._advance();var r=e.join(""),n=ez.get(r);if(n){var i=e2.pool.get();return i.set(n,r,t),i}var a=e2.pool.get();return a.set(eq.ID,r,t),a},r._scanNum=function(){for(var e=[];e3.isNum(this.getCurCharCode());)e.push(this.getCurChar()),this._advance();if("."===this.getCurChar()){for(e.push(this.getCurChar()),this._advance();e3.isNum(this.getCurCharCode());)e.push(this.getCurChar()),this._advance();this._scanFloatSuffix(e);var t=e2.pool.get();return t.set(eq.FLOAT_CONSTANT,e.join(""),this._getPosition(e.length)),t}if("e"===this.getCurChar()||"E"===this.getCurChar()){this._scanFloatSuffix(e);var r=e2.pool.get();return r.set(eq.FLOAT_CONSTANT,e.join(""),this._getPosition(e.length)),r}this._scanIntegerSuffix(e);var n=e2.pool.get();return n.set(eq.INT_CONSTANT,e.join(""),this._getPosition(e.length)),n},r._scanFloatSuffix=function(e){if("e"===this.getCurChar()||"E"===this.getCurChar())for(e.push(this.getCurChar()),this._advance(),("+"===this.getCurChar()||"-"===this.getCurChar())&&(e.push(this.getCurChar()),this._advance()),e3.isNum(this.getCurCharCode())||this.throwError(this.getCurPosition(),"lexing error, invalid exponent suffix.");e3.isNum(this.getCurCharCode());)e.push(this.getCurChar()),this._advance();("f"===this.getCurChar()||"F"===this.getCurChar())&&(e.push(this.getCurChar()),this._advance())},r._scanIntegerSuffix=function(e){("u"===this.getCurChar()||"U"===this.getCurChar())&&(e.push(this.getCurChar()),this._advance())},t}(e5),e7=((l={})[l.Shift=0]="Shift",l[l.Reduce=1]="Reduce",l[l.Accept=2]="Accept",l),e8=function(){this.globalPrecisions=[]},te=function(e,t,r){this.type=e,this.typeLexeme=t,this.arraySpecifier=r},tt=((p={})[p.VAR=0]="VAR",p[p.FN=1]="FN",p[p.STRUCT=2]="STRUCT",p),tr=function(e,t,r,n,i){this.ident=e,this.symbolType=t,this.astNode=r,this.dataType=n,this.signature=i},tn=/*#__PURE__*/function(e){function t(t,r){var n=new te(r.protoType.returnType.type,r.protoType.returnType.typeSpecifier.lexeme);return e.call(this,t,tt.FN,r,n)||this}return a(t,e),t}(tr),ti=/*#__PURE__*/function(e){function t(t,r){return e.call(this,t,tt.STRUCT,r)||this}return a(t,e),t}(tr),ta=function(){this._table=new Map},to=/*#__PURE__*/function(){function e(){this.stack=[]}var t=e.prototype;return t.newScope=function(e){this.stack.push(e)},t.clear=function(){this.stack.length=0},t.dropScope=function(){this.stack.pop()},t.insert=function(e){this._scope.insert(e)},e9(e,[{key:"_scope",get:function(){return this.stack[this.stack.length-1]}}]),e}(),ts=/*#__PURE__*/function(e){function r(){return e.apply(this,arguments)||this}a(r,e);var n=r.prototype;return n.insert=function(e){for(var r,n=null!=(r=this._table.get(e.ident))?r:[],i=0;i<n.length;i++)if(this._compareWith(n[i],e.symbolType,e.signature,e.astNode)){t.Logger.warn("replace symbol:",e.ident),n[i]=e;return}n.push(e),this._table.set(e.ident,n)},n.lookup=function(e,t,r,n){var i=this._table.get(e);if(i)for(var a=i.length,o=0;o<a;o++){var s=i[o];if(this._compareWith(s,t,r,n))return s}},n.getAllFnSymbols=function(e){var t;return(null!=(t=this._table.get(e))?t:[]).filter(function(e){return e.symbolType===tt.FN})},n._compareWith=function(e,t,r,n){if(e.symbolType!==t)return!1;if(e.symbolType===tt.FN){if(!n&&!r)return!0;var i=e.astNode.protoType.paramSig,a=null!=r?r:n.protoType.paramSig,o=i.length;if(o!==a.length)return!1;for(var s=0;s<o;s++){var c=i[s],u=a[s];if(3e3!==c&&3e3!==u&&c!==u)return!1}}return!0},r}(ta),tc=/*#__PURE__*/function(e){function t(t,r,n,i){var a;return(a=e.call(this,t,tt.VAR,i,r)||this).isGlobalVariable=n,a}return a(t,e),t}(tr),tu=/*#__PURE__*/function(){function e(){this.semanticStack=[],this.acceptRule=void 0,this.symbolTableStack=new to,this.curFunctionInfo={},this._shaderData=new e8,this._translationRuleTable=new Map,this.errors=[],this.newScope()}var t=e.prototype;return t.reset=function(){this.semanticStack.length=0,this._shaderData=new e8,this.symbolTableStack.clear(),this.newScope(),this.errors.length=0},t.newScope=function(){var e=new ts;this.symbolTableStack.newScope(e)},t.dropScope=function(){return this.symbolTableStack.dropScope()},t.addTranslationRule=function(e,t){this._translationRuleTable.set(e,t)},t.getTranslationRule=function(e){return this._translationRuleTable.get(e)},t.lookupSymbolBy=function(e,t,r,n){for(var i=this.symbolTableStack.stack,a=i.length,o=a-1;o>=0;o--){var s=i[o].lookup(e,t,r,n);if(s)return s}},t.reportError=function(e,t){this.errors.push(new e$(eZ.CompilationError,t,e,t3._processingPassText))},e9(e,[{key:"shaderData",get:function(){return this._shaderData}}]),e}(),tl=((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._ignore=2100]="_ignore",h),tp=function e(t,r){this.goal=t,this.derivation=r,this.id=e._id++,e.pool.set(this.id,this)};tp._id=0,tp.pool=new Map;var th=/*#__PURE__*/function(){function e(e,t){this.startSymbol=e,t.unshift(new tp(tl.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]===eq.EPSILON})},t.getProductionByID=function(e){return tp.pool.get(e)},e.create=function(t,r){return new e(t,r.map(function(e){return new tp(e[0],e.slice(1))}))},e}(),t_=((_={})[_.VERTEX=0]="VERTEX",_[_.FRAGMENT=1]="FRAGMENT",_[_.ALL=2]="ALL",_);function td(e){return e>=200&&e<=213}var tf=new Map,tS=/*#__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 td(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=eY(e,[].concat([t,r,t_.ALL],a)),c=null!=(n=tf.get(t))?n:[];c.push(s),tf.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=eY(e,[].concat([t,r,n],o)),u=null!=(i=tf.get(t))?i:[];u.push(c),tf.set(t,u)},e.getFn=function(e,t){var r=tf.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,u=!0,l=0;l<s;l++){var p=o[l];if(td(p))3e3===c&&(c=t[l]);else if(p!==t[l]&&3e3!==t[l]){u=!1;break}}if(u)return a._realReturnType=c,a}}},e9(e,[{key:"realReturnType",get:function(){return this._realReturnType}}]),e}();tS._create("radians",200,200),tS._create("degrees",200,200),tS._create("sin",200,200),tS._create("cos",200,200),tS._create("tan",200,200),tS._create("asin",200,200),tS._create("acos",200,200),tS._create("atan",200,200,200),tS._create("atan",200,200),tS._create("sinh",200,200),tS._create("cosh",200,200),tS._create("tanh",200,200),tS._create("asinh",200,200),tS._create("acosh",200,200),tS._create("atanh",200,200),tS._create("pow",200,200,200),tS._create("exp",200,200),tS._create("log",200,200),tS._create("exp2",200,200),tS._create("log2",200,200),tS._create("sqrt",200,200),tS._create("inversesqrt",200,200),tS._create("abs",200,200),tS._create("abs",201,201),tS._create("sign",200,200),tS._create("sign",201,201),tS._create("floor",200,200),tS._create("trunc",200,200),tS._create("round",200,200),tS._create("roundEven",200,200),tS._create("ceil",200,200),tS._create("fract",200,200),tS._create("mod",200,200,eH.FLOAT),tS._create("mod",200,200,200),tS._create("min",200,200,200),tS._create("min",200,200,eH.FLOAT),tS._create("min",201,201,201),tS._create("min",201,201,eH.INT),tS._create("min",202,202,202),tS._create("min",202,202,eH.UINT),tS._create("max",200,200,200),tS._create("max",200,200,eH.FLOAT),tS._create("max",201,201,201),tS._create("max",201,201,eH.INT),tS._create("clamp",200,200,200,200),tS._create("clamp",200,200,eH.FLOAT,eH.FLOAT),tS._create("clamp",201,201,201,201),tS._create("clamp",201,201,eH.INT,eH.INT),tS._create("clamp",202,202,202,202),tS._create("clamp",202,202,eH.UINT,eH.UINT),tS._create("mix",200,200,200,200),tS._create("mix",200,200,200,eH.FLOAT),tS._create("mix",200,200,200,203),tS._create("step",200,200,200),tS._create("step",200,eH.FLOAT,200),tS._create("smoothstep",200,200,200,200),tS._create("smoothstep",200,eH.FLOAT,eH.FLOAT,200),tS._create("isnan",203,200),tS._create("isinf",203,200),tS._create("floatBitsToInt",200,200),tS._create("floatBitsToUint",202,200),tS._create("intBitsToFloat",200,201),tS._create("uintBitsToFloat",200,202),tS._create("packSnorm2x16",eH.UINT,eH.VEC2),tS._create("unpackSnorm2x16",eH.VEC2,eH.UINT),tS._create("packUnorm2x16",eH.UINT,eH.VEC2),tS._create("unpackUnorm2x16",eH.VEC2,eH.UINT),tS._create("packHalf2x16",eH.UINT,eH.VEC2),tS._create("unpackHalf2x16",eH.VEC2,eH.UINT),tS._create("length",eH.FLOAT,200),tS._create("distance",eH.FLOAT,200,200),tS._create("dot",eH.FLOAT,200,200),tS._create("cross",eH.VEC3,eH.VEC3,eH.VEC3),tS._create("normalize",200,200),tS._create("faceforward",200,200,200,200),tS._create("reflect",200,200,200),tS._create("refract",200,200,200,eH.FLOAT),tS._create("matrixCompMult",204,204,204),tS._create("outerProduct",eH.MAT2,eH.VEC2,eH.VEC2),tS._create("outerProduct",eH.MAT3,eH.VEC3,eH.VEC3),tS._create("outerProduct",eH.MAT4,eH.VEC4,eH.VEC4),tS._create("outerProduct",eH.MAT2X3,eH.VEC3,eH.VEC2),tS._create("outerProduct",eH.MAT3X2,eH.VEC2,eH.VEC3),tS._create("outerProduct",eH.MAT2X4,eH.VEC4,eH.VEC2),tS._create("outerProduct",eH.MAT4X2,eH.VEC2,eH.VEC4),tS._create("outerProduct",eH.MAT3X4,eH.VEC4,eH.VEC3),tS._create("outerProduct",eH.MAT4X3,eH.VEC3,eH.VEC4),tS._create("transpose",eH.MAT2,eH.MAT2),tS._create("transpose",eH.MAT3,eH.MAT3),tS._create("transpose",eH.MAT4,eH.MAT4),tS._create("transpose",eH.MAT2X3,eH.MAT3X2),tS._create("transpose",eH.MAT3X2,eH.MAT2X3),tS._create("transpose",eH.MAT4X2,eH.MAT2X4),tS._create("transpose",eH.MAT2X4,eH.MAT4X2),tS._create("transpose",eH.MAT3X4,eH.MAT4X3),tS._create("transpose",eH.MAT4X3,eH.MAT3X4),tS._create("determinant",eH.FLOAT,eH.MAT2),tS._create("determinant",eH.FLOAT,eH.MAT3),tS._create("determinant",eH.FLOAT,eH.MAT4),tS._create("inverse",eH.MAT2,eH.MAT2),tS._create("inverse",eH.MAT3,eH.MAT3),tS._create("inverse",eH.MAT4,eH.MAT4),tS._create("lessThan",205,208,208),tS._create("lessThan",205,206,206),tS._create("lessThan",205,207,207),tS._create("lessThanEqual",205,208,208),tS._create("lessThanEqual",205,206,206),tS._create("lessThanEqual",205,207,207),tS._create("greaterThan",205,208,208),tS._create("greaterThan",205,206,206),tS._create("greaterThan",205,207,207),tS._create("greaterThanEqual",205,208,208),tS._create("greaterThanEqual",205,206,206),tS._create("greaterThanEqual",205,207,207),tS._create("equal",205,208,208),tS._create("equal",205,206,206),tS._create("equal",205,207,207),tS._create("equal",205,205,205),tS._create("notEqual",205,208,208),tS._create("notEqual",205,206,206),tS._create("notEqual",205,207,207),tS._create("notEqual",205,205,205),tS._create("any",eH.BOOL,205),tS._create("all",eH.BOOL,205),tS._create("not",205,205),tS._create("textureSize",eH.IVEC2,210,eH.INT),tS._create("textureSize",eH.IVEC3,211,eH.INT),tS._create("textureSize",eH.IVEC2,212,eH.INT),tS._create("textureSize",eH.IVEC2,eH.SAMPLER2D_SHADOW,eH.INT),tS._create("textureSize",eH.IVEC2,eH.SAMPLER_CUBE_SHADOW,eH.INT),tS._create("textureSize",eH.IVEC3,213,eH.INT),tS._create("textureSize",eH.IVEC3,eH.SAMPLER2D_ARRAY_SHADOW,eH.INT),tS._create("texture2D",eH.VEC4,eH.SAMPLER2D,eH.VEC2),tS._create("texture2D",eH.VEC4,eH.SAMPLER2D,eH.VEC2,eH.FLOAT),tS._create("texture",209,210,eH.VEC2,eH.FLOAT),tS._create("texture",209,210,eH.VEC2),tS._create("texture",209,211,eH.VEC3,eH.FLOAT),tS._create("texture",209,211,eH.VEC3),tS._create("texture",209,212,eH.VEC3,eH.FLOAT),tS._create("texture",209,212,eH.VEC3),tS._create("texture",eH.FLOAT,eH.SAMPLER2D_SHADOW,eH.VEC3,eH.FLOAT),tS._create("texture",eH.FLOAT,eH.SAMPLER2D_SHADOW,eH.VEC3),tS._create("texture",eH.FLOAT,eH.SAMPLER_CUBE_SHADOW,eH.VEC4,eH.FLOAT),tS._create("texture",eH.FLOAT,eH.SAMPLER_CUBE_SHADOW,eH.VEC4),tS._create("texture",209,eH.SAMPLER2D_ARRAY,eH.VEC3,eH.FLOAT),tS._create("texture",209,eH.SAMPLER2D_ARRAY,eH.VEC3),tS._create("texture",eH.FLOAT,eH.SAMPLER2D_ARRAY_SHADOW,eH.VEC4),tS._create("textureProj",209,210,eH.VEC3,eH.FLOAT),tS._create("textureProj",209,210,eH.VEC3),tS._create("textureProj",209,210,eH.VEC4,eH.FLOAT),tS._create("textureProj",209,210,eH.VEC4),tS._create("textureProj",209,211,eH.VEC4,eH.FLOAT),tS._create("textureProj",209,211,eH.VEC4),tS._create("textureProj",eH.FLOAT,eH.SAMPLER2D_SHADOW,eH.VEC4,eH.FLOAT),tS._create("textureProj",eH.FLOAT,eH.SAMPLER2D_SHADOW,eH.VEC4),tS._create("textureLod",209,210,eH.VEC2,eH.FLOAT),tS._create("textureLod",209,211,eH.VEC3,eH.FLOAT),tS._create("textureLod",209,212,eH.VEC3,eH.FLOAT),tS._create("textureLod",eH.FLOAT,eH.SAMPLER2D_SHADOW,eH.VEC3,eH.FLOAT),tS._create("textureLod",209,213,eH.VEC3,eH.FLOAT),tS._create("texture2DLodEXT",209,210,eH.VEC2,eH.FLOAT),tS._create("texture2DLodEXT",209,211,eH.VEC3,eH.FLOAT),tS._create("textureCube",eH.SAMPLER_CUBE,eH.VEC3),tS._create("textureCube",eH.SAMPLER_CUBE,eH.VEC3,eH.FLOAT),tS._create("textureCubeLod",eH.SAMPLER_CUBE,eH.VEC3,eH.FLOAT),tS._create("textureCubeLodEXT",209,212,eH.VEC3,eH.FLOAT),tS._create("textureOffset",209,210,eH.VEC2,eH.IVEC2,eH.FLOAT),tS._create("textureOffset",209,210,eH.VEC2,eH.IVEC2),tS._create("textureOffset",209,211,eH.VEC3,eH.IVEC3,eH.FLOAT),tS._create("textureOffset",209,211,eH.VEC3,eH.IVEC3),tS._create("textureOffset",eH.FLOAT,eH.SAMPLER2D_SHADOW,eH.VEC3,eH.IVEC2,eH.FLOAT),tS._create("textureOffset",eH.FLOAT,eH.SAMPLER2D_SHADOW,eH.VEC3,eH.IVEC2),tS._create("textureOffset",209,213,eH.VEC3,eH.IVEC2,eH.FLOAT),tS._create("textureOffset",209,213,eH.VEC3,eH.IVEC2),tS._create("texelFetch",209,210,eH.IVEC2,eH.INT),tS._create("texelFetch",209,211,eH.IVEC3,eH.INT),tS._create("texelFetch",209,213,eH.IVEC3,eH.INT),tS._create("texelFetchOffset",209,210,eH.IVEC2,eH.INT,eH.IVEC2),tS._create("texelFetchOffset",209,211,eH.IVEC3,eH.INT,eH.IVEC3),tS._create("texelFetchOffset",209,213,eH.IVEC3,eH.INT,eH.IVEC2),tS._create("textureProjOffset",209,210,eH.VEC3,eH.IVEC2,eH.FLOAT),tS._create("textureProjOffset",209,210,eH.VEC3,eH.IVEC2),tS._create("textureProjOffset",209,210,eH.VEC4,eH.IVEC2,eH.FLOAT),tS._create("textureProjOffset",209,210,eH.VEC4,eH.IVEC2),tS._create("textureProjOffset",209,211,eH.VEC4,eH.IVEC3,eH.FLOAT),tS._create("textureProjOffset",209,211,eH.VEC4,eH.IVEC3),tS._create("textureProjOffset",eH.FLOAT,eH.SAMPLER2D_SHADOW,eH.VEC4,eH.IVEC2,eH.FLOAT),tS._create("textureProjOffset",eH.FLOAT,eH.SAMPLER2D_SHADOW,eH.VEC4,eH.IVEC2),tS._create("textureLodOffset",209,210,eH.VEC2,eH.FLOAT,eH.IVEC2),tS._create("textureLodOffset",209,211,eH.VEC3,eH.FLOAT,eH.IVEC3),tS._create("textureLodOffset",eH.FLOAT,eH.SAMPLER2D_SHADOW,eH.VEC3,eH.FLOAT,eH.IVEC2),tS._create("textureLodOffset",209,213,eH.VEC3,eH.FLOAT,eH.IVEC2),tS._create("textureProjLod",209,210,eH.VEC3,eH.FLOAT),tS._create("textureProjLod",209,210,eH.VEC4,eH.FLOAT),tS._create("textureProjLod",209,211,eH.VEC4,eH.FLOAT),tS._create("textureProjLod",eH.FLOAT,eH.SAMPLER2D_SHADOW,eH.VEC4,eH.FLOAT),tS._create("textureProjLodOffset",209,210,eH.VEC3,eH.FLOAT,eH.IVEC2),tS._create("textureProjLodOffset",209,210,eH.VEC4,eH.FLOAT,eH.IVEC2),tS._create("textureProjLodOffset",209,211,eH.VEC4,eH.FLOAT,eH.IVEC3),tS._create("textureProjLodOffset",eH.FLOAT,eH.SAMPLER2D_SHADOW,eH.VEC4,eH.FLOAT,eH.IVEC2),tS._create("textureGrad",209,210,eH.VEC2,eH.VEC2,eH.VEC2),tS._create("textureGrad",209,211,eH.VEC3,eH.VEC3,eH.VEC3),tS._create("textureGrad",209,212,eH.VEC3,eH.VEC3,eH.VEC3),tS._create("textureGrad",eH.FLOAT,eH.SAMPLER2D_SHADOW,eH.VEC3,eH.VEC2,eH.VEC2),tS._create("textureGrad",eH.FLOAT,eH.SAMPLER_CUBE_SHADOW,eH.VEC4,eH.VEC3,eH.VEC3),tS._create("textureGrad",209,213,eH.VEC3,eH.VEC2,eH.VEC2),tS._create("textureGrad",eH.FLOAT,eH.SAMPLER2D_ARRAY_SHADOW,eH.VEC4,eH.VEC2,eH.VEC2),tS._create("textureGradOffset",209,210,eH.VEC2,eH.VEC2,eH.VEC2,eH.IVEC2),tS._create("textureGradOffset",209,211,eH.VEC3,eH.VEC3,eH.VEC3,eH.IVEC3),tS._create("textureGradOffset",eH.FLOAT,eH.SAMPLER2D_SHADOW,eH.VEC3,eH.VEC2,eH.VEC2,eH.IVEC2),tS._create("textureGradOffset",209,213,eH.VEC3,eH.VEC2,eH.VEC2,eH.IVEC2),tS._create("textureGradOffset",eH.FLOAT,eH.SAMPLER2D_ARRAY_SHADOW,eH.VEC3,eH.VEC2,eH.VEC2,eH.IVEC2),tS._create("textureProjGrad",209,210,eH.VEC3,eH.VEC2,eH.VEC2),tS._create("textureProjGrad",209,210,eH.VEC4,eH.VEC2,eH.VEC2),tS._create("textureProjGrad",209,211,eH.VEC4,eH.VEC3,eH.VEC3),tS._create("textureProjGrad",eH.FLOAT,eH.SAMPLER2D_SHADOW,eH.VEC4,eH.VEC2,eH.VEC2),tS._create("textureProjGradOffset",209,210,eH.VEC3,eH.VEC2,eH.VEC2,eH.IVEC2),tS._create("textureProjGradOffset",209,210,eH.VEC4,eH.VEC2,eH.VEC2,eH.IVEC2),tS._create("textureProjGradOffset",209,211,eH.VEC4,eH.VEC3,eH.VEC3,eH.IVEC3),tS._create("textureProjGradOffset",eH.FLOAT,eH.SAMPLER2D_SHADOW,eH.VEC4,eH.VEC2,eH.VEC2,eH.IVEC2),tS._createWithScop("dFdx",200,t_.FRAGMENT,200),tS._createWithScop("dFdy",200,t_.FRAGMENT,200),tS._createWithScop("fwidth",200,t_.FRAGMENT,200);var tg=new Map,tv=/*#__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=t_.ALL);var i=new e(r,t,n);tg.set(t,i)},e.getVar=function(e){return tg.get(e)},e}();tv.createVariable("gl_VertexID",eH.INT,t_.VERTEX),tv.createVariable("gl_InstanceID",eH.INT,t_.VERTEX),tv.createVariable("gl_Position",eH.VEC4,t_.VERTEX),tv.createVariable("gl_PointSize",eH.FLOAT,t_.VERTEX),tv.createVariable("gl_FragCoord",eH.VEC4,t_.FRAGMENT),tv.createVariable("gl_FrontFacing",eH.BOOL,t_.FRAGMENT),tv.createVariable("gl_FragDepth",eH.FLOAT,t_.FRAGMENT),tv.createVariable("gl_PointCoord",eH.VEC2,t_.FRAGMENT),tv.createVariable("gl_FragColor",eH.VEC4,t_.FRAGMENT),tv.createVariable("gl_FragData",eH.VEC4_ARRAY,t_.FRAGMENT),tv.createVariable("gl_MaxVertexAttribs",eH.INT),tv.createVariable("gl_MaxVertexUniformVectors",eH.INT),tv.createVariable("gl_MaxVertexOutputVectors",eH.INT),tv.createVariable("gl_MaxFragmentInputVectors",eH.INT),tv.createVariable("gl_MaxVertexTextureImageUnits",eH.INT),tv.createVariable("gl_MaxCombinedTextureImageUnits",eH.INT),tv.createVariable("gl_MaxTextureImageUnits",eH.INT),tv.createVariable("gl_MaxFragmentUniformVectors",eH.INT),tv.createVariable("gl_MaxDrawBuffers",eH.INT),tv.createVariable("gl_MinProgramTexelOffset",eH.INT),tv.createVariable("gl_MaxProgramTexelOffset",eH.INT);var tm=/*#__PURE__*/function(){function e(t,r,i){this._needReInfer=!0,this.production=t,this.position=r,this.lookaheadSet=new Set;for(var a,o=n(i);!(a=o()).done;){var s=a.value;this.lookaheadSet.add(s)}this.id=e._id++}var t=e.prototype;return t.addLookahead=function(e){for(var t,r=n(e);!(t=r()).done;){var i=t.value;this.lookaheadSet.has(i)||(this.lookaheadSet.add(i),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]!==eq.EPSILON)return!1;return!0},t.advance=function(){if(this.canReduce())throw"Error: advance reduce-able parsing state item";return new e(this.production,this.position+1,this.lookaheadSet)},t.toString=function(){var e,t=this.production.derivation.map(function(e){return tb.toString(e)});return t[this.position]="."+(null!=(e=t[this.position])?e:""),tl[this.production.goal]+" :=> "+t.join("|")+" ;"+Array.from(this.lookaheadSet).map(function(e){return tb.toString(e)}).join("/")},e9(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}();tm._id=0;var ty=/*#__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,i=n(t);!(r=i()).done;){var a=r.value,o=this.getStateItemMapKey(a.production,a.position);this._stateItemPool.set(o,a)}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 i=this.getStateItemMapKey(e,t),a=this._stateItemPool.get(i);if(a){for(var o,s=n(r);!(o=s()).done;){var c=o.value;a.lookaheadSet.has(c)||(a.lookaheadSet.add(c),a.needReInfer=!0)}return a}var u=new tm(e,t,r);return this._stateItemPool.set(i,u),u},e.create=function(t){var r=this.getMapKey(t),i=this.closureMap.get(r);if(i){for(var a,o=n(t);!(a=o()).done;){var s=a.value;i.createStateItem(s.production,s.position,s.lookaheadSet)}return i}var c=new e(t);return this.closureMap.set(r,c),c},e.getMapKey=function(e){return e.map(function(e){return e.production.id+","+e.position}).join(";")},e9(e,[{key:"items",get:function(){return this._items}},{key:"needReInfer",get:function(){for(var e,t=n(this.cores);!(e=t()).done;)if(e.value.needReInfer)return!0;return!1}}]),e}();ty.closureMap=new Map,ty.pool=new Map,ty._id=0;var tE=/*#__PURE__*/function(){function e(){}return e.unwrapNodeByType=function(t,r){var n=t.children[0];if(!eX(n,e2))return n.nt===r?n:e.unwrapNodeByType(n,r)},e.typeCompatible=function(e,t){return void 0==t||(e===eH.INT?e===t||t===eH.UINT:e===t)},e.toString=function(e){if(this.isTerminal(e)){var t;return null!=(t=eq[e])?t:eH[e]}return tl[e]},e.isTerminal=function(e){return e<tl.START},e.printStatePool=function(e){var t="";console.log("========== Parser Pool ==========");for(var r,i=0,a=n(ty.pool.values());!(r=a()).done;){var o=r.value;i++;var s="";s+=(""+o.id+": \n").padEnd(4);for(var c,u=n(o.items);!(c=u()).done;)s+=" "+c.value.toString()+"\n";t+=s}console.log("state count:",i),console.log(t)},e}(),tx=function(e,t,r){this.type=e,this.typeLexeme=t,this.arraySpecifier=r},tC=function(e,t,r){this.typeInfo=e,this.ident=t,this.mrtIndex=r};function tT(e){return function(t){t.prototype.nt=e,t.pool=e0.createObjectPool(t)}}var tA=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t){this._location=e,this._children=t,this.init()},t.init=function(){},t.dispose=function(){},t.codeGen=function(e){return e.defaultCodeGen(this.children)},t.semanticAnalyze=function(e){},e9(e,[{key:"children",get:function(){return this._children}},{key:"location",get:function(){return this._location}}]),e}();(d=eU||(eU={}))._unwrapToken=function(e){if(eX(e,e2))return e;throw"not token"},d.get=function(e,t,r,n){var i=e.get();i.set(r,n),i.semanticAnalyze(t),t.semanticStack.push(i)},f=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tA),d.TrivialNode=f,f=o([tT(tl._ignore)],f),S=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.newScope()},t}(tA),d.ScopeBrace=S,S=o([tT(tl.scope_brace)],S),g=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.dropScope()},t}(tA),d.ScopeEndBrace=g,g=o([tT(tl.scope_end_brace)],g),v=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.isFragReturnStatement=!1},r.semanticAnalyze=function(e){d._unwrapToken(this.children[0]).type===eH.RETURN&&(e.curFunctionInfo.returnStatement=this)},r.codeGen=function(e){return e.visitJumpStatement(this)},t}(tA),d.JumpStatement=v,v=o([tT(tl.jump_statement)],v),m=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tA),d.ConditionOpt=m,m=o([tT(tl.conditionopt)],m),y=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tA),d.ForRestStatement=y,y=o([tT(tl.for_rest_statement)],y),E=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tA),d.Condition=E,E=o([tT(tl.condition)],E),x=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tA),d.ForInitStatement=x,x=o([tT(tl.for_init_statement)],x),C=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tA),d.IterationStatement=C,C=o([tT(tl.iteration_statement)],C),T=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tA),d.SelectionStatement=T,T=o([tT(tl.selection_statement)],T),A=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tA),d.ExpressionStatement=A,A=o([tT(tl.expression_statement)],A),b=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){this._type=void 0},e9(t,[{key:"type",get:function(){var e;return null!=(e=this._type)?e:3e3},set:function(e){this._type=e}}]),t}(tA),d.ExpressionAstNode=b,O=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];this.type=t.type},t}(b),d.InitializerList=O,O=o([tT(tl.initializer_list)],O),I=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=this.children[1].type},t}(b),d.Initializer=I,I=o([tT(tl.initializer)],I),P=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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 tx(i.type,a.lexeme,this.arraySpecifier),c=r[3];t=new tc(o.lexeme,s,!1,c)}else{var u=r[2];u&&this.arraySpecifier&&e.reportError(u.location,"Array of array is not supported."),this.arraySpecifier=u;var l=new tx(i.type,a.lexeme,this.arraySpecifier),p=r[4];t=new tc(o.lexeme,l,!1,p)}e.symbolTableStack.insert(t)},r.codeGen=function(e){return e.visitSingleDeclaration(this)},t}(tA),d.SingleDeclaration=P,P=o([tT(tl.single_declaration)],P),L=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(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}(tA),d.FullySpecifiedType=L,L=o([tT(tl.fully_specified_type)],L),R=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tA),d.TypeQualifier=R,R=o([tT(tl.type_qualifier)],R),M=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];eX(t,e2)?this.qualifier=t.type:this.qualifier=t.qualifier,this.lexeme=t.lexeme},t}(tA),d.SingleTypeQualifier=M,M=o([tT(tl.single_type_qualifier)],M),k=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(N=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];this.qualifier=t.type,this.lexeme=t.lexeme},t}(tA)),d.StorageQualifier=k,k=o([tT(tl.storage_qualifier)],k),V=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(N),d.PrecisionQualifier=V,V=o([tT(tl.precision_qualifier)],V),G=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(N),d.InterpolationQualifier=G,G=o([tT(tl.interpolation_qualifier)],G),D=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(N),d.InvariantQualifier=D,D=o([tT(tl.invariant_qualifier)],D),F=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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},e9(t,[{key:"arraySpecifier",get:function(){return this.children[1]}}]),t}(tA),d.TypeSpecifier=F,F=o([tT(tl.type_specifier)],F),w=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[1];this.size=t.value},t}(tA),d.ArraySpecifier=w,w=o([tT(tl.array_specifier)],w),B=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];switch(this.lexeme=t.lexeme,t.type){case eq.PLUS:this.compute=function(e,t){return e+t};break;case eq.DASH:this.compute=function(e,t){return e-t};break;case eq.STAR:this.compute=function(e,t){return e*t};break;case eq.SLASH:this.compute=function(e,t){return e/t};break;case eq.PERCENT:this.compute=function(e,t){return e%t};break;default:e.reportError(t.location,"not implemented operator "+t.lexeme)}},t}(tA),d.IntegerConstantExpressionOperator=B,B=o([tT(tl.integer_constant_expression_operator)],B),U=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.value=void 0},r.semanticAnalyze=function(e){if(1===this.children.length){var t=this.children[0];if(eX(t,e2))this.value=Number(t.lexeme);else if(t.symbolInfo||e.reportError(t.location,"Undeclared symbol: "+t.lexeme),!tE.typeCompatible(eH.INT,t.typeInfo)){e.reportError(t.location,"Invalid integer.");return}}},t}(tA),d.IntegerConstantExpression=U,U=o([tT(tl.integer_constant_expression)],U),W=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){var e=this.children[0];eX(e,e2)?this.type=e.lexeme:this.type=e.type,this.lexeme=e.lexeme},t}(tA),d.TypeSpecifierNonArray=W,W=o([tT(tl.type_specifier_nonarray)],W),j=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){var e=this.children[0];this.type=e.type,this.lexeme=e.lexeme},t}(tA),d.ExtBuiltinTypeSpecifierNonArray=j,j=o([tT(tl.ext_builtin_type_specifier_nonarray)],j),H=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(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 tx(a.type,a.lexeme,o)}else{var s=r[0];this.typeInfo=s.typeInfo}if(3===n||5===n)t=new tc(r[2].lexeme,this.typeInfo,!1,this),e.symbolTableStack.insert(t);else if(4===n||6===n){var c=this.typeInfo,u=this.children[3];c.arraySpecifier&&u&&e.reportError(u.location,"Array of array is not supported."),c.arraySpecifier=u,t=new tc(r[2].lexeme,c,!1,this),e.symbolTableStack.insert(t)}},t}(tA),d.InitDeclaratorList=H,H=o([tT(tl.init_declarator_list)],H),z=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.idList=[],t}a(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}(tA),d.IdentifierList=z,z=o([tT(tl.identifier_list)],z),q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(e){return e.visitDeclaration(this)},t}(tA),d.Declaration=q,q=o([tT(tl.declaration)],q),X=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){var t=this.children[0];this.ident=t.ident,this.returnType=t.returnType,this.parameterList=t.parameterInfoList,this.paramSig=t.paramSig},r.codeGen=function(e){return e.visitFunctionProtoType(this)},t}(tA),d.FunctionProtoType=X,X=o([tT(tl.function_prototype)],X),Q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(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}(tA),d.FunctionDeclarator=Q,Q=o([tT(tl.function_declarator)],Q),Y=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){e.newScope();var t=this.children;this.ident=t[1],this.returnType=t[0]},r.codeGen=function(e){return e.visitFunctionHeader(this)},t}(tA),d.FunctionHeader=Y,Y=o([tT(tl.function_header)],Y),K=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.parameterInfoList=[],t.paramSig=[],t}a(t,e);var r=t.prototype;return r.init=function(){this.parameterInfoList.length=0,this.paramSig.length=0},r.semanticAnalyze=function(e){var t=this.children,r=t.length,n=this.parameterInfoList,i=this.paramSig;if(1===r){var a=t[0];n.push({ident:a.ident,typeInfo:a.typeInfo,astNode:a}),i.push(a.typeInfo.type)}else{var o=t[0],s=t[2],c=o.parameterInfoList.length;n.length=c+1,i.length=c+1;for(var u=0;u<c;u++)n[u]=o.parameterInfoList[u],i[u]=o.paramSig[u];n[c]={ident:s.ident,typeInfo:s.typeInfo,astNode:s},i[c]=s.typeInfo.type}},r.codeGen=function(e){return e.visitFunctionParameterList(this)},t}(tA),d.FunctionParameterList=K,K=o([tT(tl.function_parameter_list)],K),J=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.typeQualifier=void 0},r.semanticAnalyze=function(e){var t,r=this.children,n=r.length;t=1===n?r[0]:r[1],2===n&&(this.typeQualifier=r[0]),this.typeInfo=t.typeInfo,this.ident=t.ident;var i=new tc(t.ident.lexeme,t.typeInfo,!1,this);e.symbolTableStack.insert(i)},t}(tA),d.ParameterDeclaration=J,J=o([tT(tl.parameter_declaration)],J),$=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(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 tx(r.type,r.lexeme,n)},t}(tA),d.ParameterDeclarator=$,$=o([tT(tl.parameter_declarator)],$),Z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tA),d.SimpleStatement=Z,Z=o([tT(tl.simple_statement)],Z),ee=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tA),d.CompoundStatement=ee,ee=o([tT(tl.compound_statement)],ee),et=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tA),d.CompoundStatementNoScope=et,et=o([tT(tl.compound_statement_no_scope)],et),er=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tA),d.Statement=er,er=o([tT(tl.statement)],er),en=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(e){return e.visitStatementList(this)},t}(tA),d.StatementList=en,en=o([tT(tl.statement_list)],en),ei=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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.dropScope();var r=new tn(this.protoType.ident.lexeme,this);e.symbolTableStack.insert(r);var n=e.curFunctionInfo,i=n.header,a=n.returnStatement;i.returnType.type===eH.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 e.visitFunctionDefinition(this)},t}(tA),d.FunctionDefinition=ei,ei=o([tT(tl.function_definition)],ei),ea=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){this.type=this.children[0].type},r.codeGen=function(e){return e.visitFunctionCall(this)},t}(b),d.FunctionCall=ea,ea=o([tT(tl.function_call)],ea),eo=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){e.prototype.init.call(this),this.fnSymbol=void 0},r.semanticAnalyze=function(e){var t=this.children[0];if(t.isBuiltin)this.type=t.ident;else{var r,n,i=t.ident;if(4===this.children.length){var a=this.children[2];eX(a,es)&&(n=a.paramSig)}var o=tS.getFn(i,n);if(o){this.type=o.realReturnType;return}var s=e.lookupSymbolBy(i,tt.FN,n);if(!s){e.reportError(this.location,"No overload function type found: "+t.ident);return}this.type=null==s?void 0:null==(r=s.dataType)?void 0:r.type,this.fnSymbol=s}},t}(b),d.FunctionCallGeneric=eo,eo=o([tT(tl.function_call_generic)],eo),es=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.paramSig=[],t.paramNodes=[],t}a(t,e);var r=t.prototype;return r.init=function(){this.paramSig.length=0,this.paramNodes.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.paramSig,n=this.paramNodes;if(1===t.length){var i=t[0];void 0==i.type?r.push(3e3):r.push(i.type),this.paramNodes.push(i)}else{var a=t[0],o=t[2];if(0===a.paramSig.length||void 0==o.type)this.paramSig.push(3e3);else{var s=a.paramSig.length;r.length=s+1,n.length=s+1;for(var c=0;c<s;c++)r[c]=a.paramSig[c],n[c]=a.paramNodes[c];r[s]=o.type,n[s]=o}}},t}(tA),d.FunctionCallParameterList=es,es=o([tT(tl.function_call_parameter_list)],es),ec=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.shaderData.globalPrecisions.push(this)},t}(tA),d.PrecisionSpecifier=ec,ec=o([tT(tl.precision_specifier)],ec),eu=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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 e.visitFunctionIdentifier(this)},t}(tA),d.FunctionIdentifier=eu,eu=o([tT(tl.function_identifier)],eu),el=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t,r=this.children[0];this.type=null!=(t=r.type)?t:3e3}else{var n,i=this.children[2];this.type=null!=(n=i.type)?n:3e3}},t}(b),d.AssignmentExpression=el,el=o([tT(tl.assignment_expression)],el),ep=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tA),d.AssignmentOperator=ep,ep=o([tT(tl.assignment_operator)],ep),eh=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t=this.children[0];this.type=t.type}else{var r=this.children[2];this.type=r.type}},t}(b),d.Expression=eh,eh=o([tT(tl.expression)],eh),e_=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t,r=this.children[0];if(eX(r,eD))this.type=null!=(t=r.typeInfo)?t:3e3;else switch(r.type){case eq.INT_CONSTANT:this._type=eH.INT;break;case eq.FLOAT_CONSTANT:this.type=eH.FLOAT;break;case eH.TRUE:case eH.FALSE:this.type=eH.BOOL}}else{var n=this.children[1];this.type=n.type}},t}(b),d.PrimaryExpression=e_,e_=o([tT(tl.primary_expression)],e_),ed=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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 e.visitPostfixExpression(this)},t}(b),d.PostfixExpression=ed,ed=o([tT(tl.postfix_expression)],ed),ef=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tA),d.UnaryOperator=ef,ef=o([tT(tl.unary_operator)],ef),eS=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){this.type=this.children[0].type},t}(b),d.UnaryExpression=eS,eS=o([tT(tl.unary_expression)],eS),eg=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){e.prototype.init.call(this),1===this.children.length&&(this.type=this.children[0].type)},t}(b),d.MultiplicativeExpression=eg,eg=o([tT(tl.multiplicative_expression)],eg),ev=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){e.prototype.init.call(this),1===this.children.length&&(this.type=this.children[0].type)},t}(b),d.AdditiveExpression=ev,ev=o([tT(tl.additive_expression)],ev),em=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];this.type=t.type},t}(b),d.ShiftExpression=em,em=o([tT(tl.shift_expression)],em),ey=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=eH.BOOL},t}(b),d.RelationalExpression=ey,ey=o([tT(tl.relational_expression)],ey),eE=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=eH.BOOL},t}(b),d.EqualityExpression=eE,eE=o([tT(tl.equality_expression)],eE),ex=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=eH.UINT},t}(b),d.AndExpression=ex,ex=o([tT(tl.and_expression)],ex),eC=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=eH.UINT},t}(b),d.ExclusiveOrExpression=eC,eC=o([tT(tl.exclusive_or_expression)],eC),eT=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=eH.UINT},t}(b),d.InclusiveOrExpression=eT,eT=o([tT(tl.inclusive_or_expression)],eT),eA=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=eH.BOOL},t}(b),d.LogicalAndExpression=eA,eA=o([tT(tl.logical_and_expression)],eA),eb=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=eH.BOOL},t}(b),d.LogicalXorExpression=eb,eb=o([tT(tl.logical_xor_expression)],eb),eO=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=eH.BOOL},t}(b),d.LogicalOrExpression=eO,eO=o([tT(tl.logical_or_expression)],eO),eI=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length&&(this.type=this.children[0].type)},t}(b),d.ConditionalExpression=eI,eI=o([tT(tl.conditional_expression)],eI),eP=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.ident=void 0},r.semanticAnalyze=function(e){var t=this.children;6===t.length?(this.ident=t[1],e.symbolTableStack.insert(new ti(this.ident.lexeme,this)),this.propList=t[3].propList):this.propList=t[2].propList},t}(tA),d.StructSpecifier=eP,eP=o([tT(tl.struct_specifier)],eP),eL=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.propList=[],t}a(t,e);var r=t.prototype;return r.init=function(){this.propList.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.propList;if(1===t.length){var n=t[0].props,i=n.length;r.length=i;for(var a=0;a<i;a++)r[a]=n[a]}else{var o=t[0].propList,s=t[1].props,c=o.length,u=s.length;r.length=c+u;for(var l=0;l<c;l++)r[l]=o[l];for(var p=0;p<u;p++)r[p+c]=s[p]}},t}(tA),d.StructDeclarationList=eL,eL=o([tT(tl.struct_declaration_list)],eL),eR=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t}a(t,e);var r=t.prototype;return r.init=function(){this.typeSpecifier=void 0,this.declaratorList=void 0,this.props.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.props;3===t.length?(this.typeSpecifier=t[0],this.declaratorList=t[1]):(this.typeSpecifier=t[1],this.declaratorList=t[2]);var n=t[0],i=this.typeSpecifier,a=i.type,o=i.lexeme;if(eX(n,eM)){var s=t[2],c=new tC(new tx(a,o),s.ident,n.index);r.push(c)}else{var u=this.declaratorList.declaratorList,l=u.length;r.length=l;for(var p=0;p<l;p++){var h=u[p],_=new tC(new tx(a,o,h.arraySpecifier),h.ident);r[p]=_}}},t}(tA),d.StructDeclaration=eR,eR=o([tT(tl.struct_declaration)],eR),eM=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){this.index=Number(this.children[4].lexeme)},t}(tA),d.LayoutQualifier=eM,eM=o([tT(tl.layout_qualifier)],eM),eN=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.declaratorList=[],t}a(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}(tA),d.StructDeclaratorList=eN,eN=o([tT(tl.struct_declarator_list)],eN),ek=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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}(tA),d.StructDeclarator=ek,ek=o([tT(tl.struct_declarator)],ek),eV=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){var t=this.children,r=t[0],n=t[1];this.type=r;var i=new tc(n.lexeme,new tx(r.type,r.typeSpecifier.lexeme),!0,this);e.symbolTableStack.insert(i)},r.codeGen=function(e){return e.visitGlobalVariableDeclaration(this)+";"},t}(tA),d.VariableDeclaration=eV,eV=o([tT(tl.variable_declaration)],eV),eG=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children,r=t.length,n=t[0].type;if(this.type=n,1!==r){var i=t[2],a=eV.pool.get();3===r?a.set(i.location,[n,i]):a.set(i.location,[n,i,t[3]]),a.semanticAnalyze(e)}},t}(tA),d.VariableDeclarationList=eG,eG=o([tT(tl.variable_declaration_list)],eG),eD=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){var t,r,n=this.children[0];this.lexeme=n.lexeme;var i=tv.getVar(n.lexeme);if(i){this.symbolInfo=i,this.typeInfo=i.type;return}this.symbolInfo=e.lookupSymbolBy(n.lexeme,tt.VAR),this.symbolInfo||e.reportError(this.location,"undeclared identifier: "+n.lexeme),this.typeInfo=null==(r=this.symbolInfo)?void 0:null==(t=r.dataType)?void 0:t.type},r.codeGen=function(e){return e.visitVariableIdentifier(this)},t}(tA),d.VariableIdentifier=eD,eD=o([tT(tl.variable_identifier)],eD),eF=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){this.shaderData=e.shaderData,this.shaderData.symbolTable=e.symbolTableStack._scope},t}(tA),d.GLShaderProgram=eF,o([tT(tl.gs_shader_program)],eF);var tb=/*#__PURE__*/function(){function e(){}return e.isTerminal=function(e){return e<tl.START},e.toString=function(e){if(this.isTerminal(e)){var t;return null!=(t=eq[e])?t:eH[e]}return tl[e]},e.createProductionWithOptions=function(e,t,r){for(var i,a=[],o=n(t);!(i=o()).done;){var s=i.value;a.push([[].concat([e],s),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=t3.createRange(a,o);eU.get(null!=r?r:eU.TrivialNode.pool,e,s,n)}}])}return a},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,i=n(e);!(r=i()).done;){var a=r.value;if(!t.has(a))return!1}return!0},e.isActionEqual=function(e,t){return e.action===t.action&&e.target===t.target},e.printAction=function(e){return"<Action: "+e7[e.action]+" -> "+(e.action===e7.Reduce?tp.pool.get(e.target):"State "+e.target)+">"},e.printProduction=function(t){var r=t.derivation.map(function(t){return e.toString(t)}).join("|");return tl[t.goal]+" :=> "+r},e}(),tO=[].concat(tb.createProductionWithOptions(tl.gs_shader_program,[[tl.global_declaration],[tl.gs_shader_program,tl.global_declaration]],eU.GLShaderProgram.pool),tb.createProductionWithOptions(tl.global_declaration,[[tl.precision_specifier],[tl.variable_declaration_statement],[tl.struct_specifier],[tl.function_definition]]),tb.createProductionWithOptions(tl.variable_declaration,[[tl.fully_specified_type,eq.ID],[tl.fully_specified_type,eq.ID,tl.array_specifier]],eU.VariableDeclaration.pool),tb.createProductionWithOptions(tl.variable_declaration_list,[[tl.variable_declaration],[tl.variable_declaration_list,eq.COMMA,eq.ID],[tl.variable_declaration_list,eq.COMMA,eq.ID,tl.array_specifier]],eU.VariableDeclarationList.pool),tb.createProductionWithOptions(tl.variable_declaration_statement,[[tl.variable_declaration_list,eq.SEMICOLON]]),tb.createProductionWithOptions(tl.ext_builtin_type_specifier_nonarray,[[eH.VOID],[eH.FLOAT],[eH.BOOL],[eH.INT],[eH.UINT],[eH.VEC2],[eH.VEC3],[eH.VEC4],[eH.BVEC2],[eH.BVEC3],[eH.BVEC4],[eH.IVEC2],[eH.IVEC3],[eH.IVEC4],[eH.UVEC2],[eH.UVEC3],[eH.UVEC4],[eH.MAT2],[eH.MAT3],[eH.MAT4],[eH.MAT2X3],[eH.MAT2X4],[eH.MAT3X2],[eH.MAT3X4],[eH.MAT4X2],[eH.MAT4X3],[eH.SAMPLER2D],[eH.SAMPLER3D],[eH.SAMPLER_CUBE],[eH.SAMPLER2D_SHADOW],[eH.SAMPLER_CUBE_SHADOW],[eH.SAMPLER2D_ARRAY],[eH.SAMPLER2D_ARRAY_SHADOW],[eH.I_SAMPLER2D],[eH.I_SAMPLER3D],[eH.I_SAMPLER_CUBE],[eH.I_SAMPLER2D_ARRAY],[eH.U_SAMPLER2D],[eH.U_SAMPLER3D],[eH.U_SAMPLER_CUBE],[eH.U_SAMPLER2D_ARRAY]],eU.ExtBuiltinTypeSpecifierNonArray.pool),tb.createProductionWithOptions(tl.type_specifier_nonarray,[[eq.ID],[tl.ext_builtin_type_specifier_nonarray]],eU.TypeSpecifierNonArray.pool),tb.createProductionWithOptions(tl.fully_specified_type,[[tl.type_specifier],[tl.type_qualifier,tl.type_specifier]],eU.FullySpecifiedType.pool),tb.createProductionWithOptions(tl.type_specifier,[[tl.type_specifier_nonarray],[tl.ext_builtin_type_specifier_nonarray,tl.array_specifier]],eU.TypeSpecifier.pool),tb.createProductionWithOptions(tl.type_qualifier,[[tl.single_type_qualifier],[tl.type_qualifier,tl.single_type_qualifier]],eU.TypeQualifier.pool),tb.createProductionWithOptions(tl.single_type_qualifier,[[tl.storage_qualifier],[tl.precision_qualifier],[tl.interpolation_qualifier],[tl.invariant_qualifier],[eH.PRECISE]],eU.SingleTypeQualifier.pool),tb.createProductionWithOptions(tl.storage_qualifier,[[eH.CONST],[eH.IN],[eH.INOUT],[eH.OUT],[eH.CENTROID]],eU.StorageQualifier.pool),tb.createProductionWithOptions(tl.interpolation_qualifier,[[eH.SMOOTH],[eH.FLAT]],eU.InterpolationQualifier.pool),tb.createProductionWithOptions(tl.invariant_qualifier,[[eH.INVARIANT]],eU.InvariantQualifier.pool),tb.createProductionWithOptions(tl.precision_qualifier,[[eH.HIGHP],[eH.MEDIUMP],[eH.LOWP]],eU.PrecisionQualifier.pool),tb.createProductionWithOptions(tl.struct_specifier,[[eH.STRUCT,eq.ID,eq.LEFT_BRACE,tl.struct_declaration_list,eq.RIGHT_BRACE,eq.SEMICOLON],[eH.STRUCT,eq.LEFT_BRACE,tl.struct_declaration_list,eq.RIGHT_BRACE,eq.SEMICOLON]],eU.StructSpecifier.pool),tb.createProductionWithOptions(tl.struct_declaration_list,[[tl.struct_declaration],[tl.struct_declaration_list,tl.struct_declaration]],eU.StructDeclarationList.pool),tb.createProductionWithOptions(tl.struct_declaration,[[tl.type_specifier,tl.struct_declarator_list,eq.SEMICOLON],[tl.type_qualifier,tl.type_specifier,tl.struct_declarator_list,eq.SEMICOLON],[tl.layout_qualifier,tl.type_specifier,tl.struct_declarator,eq.SEMICOLON]],eU.StructDeclaration.pool),tb.createProductionWithOptions(tl.layout_qualifier,[[eH.LAYOUT,eq.LEFT_PAREN,eH.LOCATION,eq.EQUAL,eq.INT_CONSTANT,eq.RIGHT_PAREN]],eU.LayoutQualifier.pool),tb.createProductionWithOptions(tl.struct_declarator_list,[[tl.struct_declarator],[tl.struct_declarator_list,eq.COMMA,tl.struct_declarator]],eU.StructDeclaratorList.pool),tb.createProductionWithOptions(tl.struct_declarator,[[eq.ID],[eq.ID,tl.array_specifier]],eU.StructDeclarator.pool),tb.createProductionWithOptions(tl.array_specifier,[[eq.LEFT_BRACKET,eq.RIGHT_BRACKET],[eq.LEFT_BRACKET,tl.integer_constant_expression,eq.RIGHT_BRACKET]],eU.ArraySpecifier.pool),tb.createProductionWithOptions(tl.integer_constant_expression_operator,[[eq.PLUS],[eq.DASH],[eq.STAR],[eq.SLASH],[eq.PERCENT]],eU.IntegerConstantExpressionOperator.pool),tb.createProductionWithOptions(tl.integer_constant_expression,[[tl.variable_identifier],[eq.INT_CONSTANT],[tl.integer_constant_expression,tl.integer_constant_expression_operator,eq.INT_CONSTANT],[tl.integer_constant_expression,tl.integer_constant_expression_operator,tl.variable_identifier]],eU.IntegerConstantExpression.pool),tb.createProductionWithOptions(tl.conditional_expression,[[tl.logical_or_expression],[tl.logical_or_expression,eq.QUESTION,tl.expression,eq.COLON,tl.assignment_expression]],eU.ConditionalExpression.pool),tb.createProductionWithOptions(tl.logical_or_expression,[[tl.logical_xor_expression],[tl.logical_or_expression,eq.OR_OP,tl.logical_xor_expression]],eU.LogicalOrExpression.pool),tb.createProductionWithOptions(tl.logical_xor_expression,[[tl.logical_and_expression],[tl.logical_xor_expression,eq.XOR_OP,tl.logical_and_expression]],eU.LogicalXorExpression.pool),tb.createProductionWithOptions(tl.logical_and_expression,[[tl.inclusive_or_expression],[tl.logical_and_expression,eq.AND_OP,tl.inclusive_or_expression]],eU.LogicalAndExpression.pool),tb.createProductionWithOptions(tl.inclusive_or_expression,[[tl.exclusive_or_expression],[tl.inclusive_or_expression,eq.VERTICAL_BAR,tl.exclusive_or_expression]],eU.InclusiveOrExpression.pool),tb.createProductionWithOptions(tl.exclusive_or_expression,[[tl.and_expression],[tl.exclusive_or_expression,eq.CARET,tl.and_expression]],eU.ExclusiveOrExpression.pool),tb.createProductionWithOptions(tl.and_expression,[[tl.equality_expression],[tl.and_expression,eq.AMPERSAND,tl.equality_expression]],eU.AndExpression.pool),tb.createProductionWithOptions(tl.equality_expression,[[tl.relational_expression],[tl.equality_expression,eq.EQ_OP,tl.relational_expression],[tl.equality_expression,eq.NE_OP,tl.relational_expression]],eU.EqualityExpression.pool),tb.createProductionWithOptions(tl.relational_expression,[[tl.shift_expression],[tl.relational_expression,eq.LEFT_ANGLE,tl.shift_expression],[tl.relational_expression,eq.RIGHT_ANGLE,tl.shift_expression],[tl.relational_expression,eq.LE_OP,tl.shift_expression],[tl.relational_expression,eq.GE_OP,tl.shift_expression]],eU.RelationalExpression.pool),tb.createProductionWithOptions(tl.shift_expression,[[tl.additive_expression],[tl.shift_expression,eq.LEFT_OP,tl.additive_expression],[tl.shift_expression,eq.RIGHT_OP,tl.additive_expression]],eU.ShiftExpression.pool),tb.createProductionWithOptions(tl.additive_expression,[[tl.multiplicative_expression],[tl.additive_expression,eq.PLUS,tl.multiplicative_expression],[tl.additive_expression,eq.DASH,tl.multiplicative_expression]],eU.AdditiveExpression.pool),tb.createProductionWithOptions(tl.multiplicative_expression,[[tl.unary_expression],[tl.multiplicative_expression,eq.STAR,tl.unary_expression],[tl.multiplicative_expression,eq.SLASH,tl.unary_expression],[tl.multiplicative_expression,eq.PERCENT,tl.unary_expression]],eU.MultiplicativeExpression.pool),tb.createProductionWithOptions(tl.unary_expression,[[tl.postfix_expression],[eq.INC_OP,tl.unary_expression],[eq.DEC_OP,tl.unary_expression],[tl.unary_operator,tl.unary_expression]],eU.UnaryExpression.pool),tb.createProductionWithOptions(tl.unary_operator,[[eq.PLUS],[eq.DASH],[eq.BANG],[eq.TILDE]],eU.UnaryOperator.pool),tb.createProductionWithOptions(tl.postfix_expression,[[tl.primary_expression],[tl.postfix_expression,eq.LEFT_BRACKET,tl.expression,eq.RIGHT_BRACKET],[tl.function_call],[tl.postfix_expression,eq.DOT,eq.ID],[tl.postfix_expression,eq.DOT,tl.function_call],[tl.postfix_expression,eq.INC_OP],[tl.postfix_expression,eq.DEC_OP]],eU.PostfixExpression.pool),tb.createProductionWithOptions(tl.primary_expression,[[tl.variable_identifier],[eq.INT_CONSTANT],[eq.FLOAT_CONSTANT],[eH.TRUE],[eH.FALSE],[eq.LEFT_PAREN,tl.expression,eq.RIGHT_PAREN]],eU.PrimaryExpression.pool),tb.createProductionWithOptions(tl.expression,[[tl.assignment_expression],[tl.expression,eq.COMMA,tl.assignment_expression]],eU.Expression.pool),tb.createProductionWithOptions(tl.assignment_expression,[[tl.conditional_expression],[tl.unary_expression,tl.assignment_operator,tl.assignment_expression]],eU.AssignmentExpression.pool),tb.createProductionWithOptions(tl.assignment_operator,[[eq.EQUAL],[eq.MUL_ASSIGN],[eq.DIV_ASSIGN],[eq.MOD_ASSIGN],[eq.ADD_ASSIGN],[eq.SUB_ASSIGN],[eq.LEFT_ASSIGN],[eq.RIGHT_ASSIGN],[eq.AND_ASSIGN],[eq.XOR_ASSIGN],[eq.OR_ASSIGN]],eU.AssignmentOperator.pool),tb.createProductionWithOptions(tl.function_call,[[tl.function_call_generic]],eU.FunctionCall.pool),tb.createProductionWithOptions(tl.function_call_generic,[[tl.function_identifier,eq.LEFT_PAREN,tl.function_call_parameter_list,eq.RIGHT_PAREN],[tl.function_identifier,eq.LEFT_PAREN,eq.RIGHT_PAREN],[tl.function_identifier,eH.VOID,eq.RIGHT_PAREN]],eU.FunctionCallGeneric.pool),tb.createProductionWithOptions(tl.function_call_parameter_list,[[tl.assignment_expression],[tl.function_call_parameter_list,eq.COMMA,tl.assignment_expression]],eU.FunctionCallParameterList.pool),tb.createProductionWithOptions(tl.function_identifier,[[tl.type_specifier]],eU.FunctionIdentifier.pool),tb.createProductionWithOptions(tl.function_definition,[[tl.function_prototype,tl.compound_statement_no_scope]],eU.FunctionDefinition.pool),tb.createProductionWithOptions(tl.function_prototype,[[tl.function_declarator,eq.RIGHT_PAREN]],eU.FunctionProtoType.pool),tb.createProductionWithOptions(tl.function_declarator,[[tl.function_header],[tl.function_header,tl.function_parameter_list]],eU.FunctionDeclarator.pool),tb.createProductionWithOptions(tl.function_header,[[tl.fully_specified_type,eq.ID,eq.LEFT_PAREN]],eU.FunctionHeader.pool),tb.createProductionWithOptions(tl.function_parameter_list,[[tl.parameter_declaration],[tl.function_parameter_list,eq.COMMA,tl.parameter_declaration]],eU.FunctionParameterList.pool),tb.createProductionWithOptions(tl.parameter_declaration,[[tl.type_qualifier,tl.parameter_declarator],[tl.parameter_declarator]],eU.ParameterDeclaration.pool),tb.createProductionWithOptions(tl.parameter_declarator,[[tl.type_specifier,eq.ID],[tl.type_specifier,eq.ID,tl.array_specifier]],eU.ParameterDeclarator.pool),tb.createProductionWithOptions(tl.statement_list,[[tl.statement],[tl.statement_list,tl.statement]],eU.StatementList.pool),tb.createProductionWithOptions(tl.statement,[[tl.compound_statement],[tl.simple_statement]],eU.Statement.pool),tb.createProductionWithOptions(tl.compound_statement_no_scope,[[eq.LEFT_BRACE,eq.RIGHT_BRACE],[eq.LEFT_BRACE,tl.statement_list,eq.RIGHT_BRACE]],eU.CompoundStatementNoScope.pool),tb.createProductionWithOptions(tl.compound_statement,[[eq.LEFT_BRACE,eq.RIGHT_BRACE],[tl.scope_brace,tl.statement_list,tl.scope_end_brace]],eU.CompoundStatement.pool),tb.createProductionWithOptions(tl.simple_statement,[[tl.declaration],[tl.expression_statement],[tl.selection_statement],[tl.iteration_statement],[tl.jump_statement]],eU.SimpleStatement.pool),tb.createProductionWithOptions(tl.declaration,[[tl.function_prototype,eq.SEMICOLON],[tl.init_declarator_list,eq.SEMICOLON],[eH.PRECISION,tl.precision_qualifier,tl.ext_builtin_type_specifier_nonarray,eq.SEMICOLON],[tl.type_qualifier,eq.ID,eq.SEMICOLON],[tl.type_qualifier,eq.ID,tl.identifier_list,eq.SEMICOLON]],eU.Declaration.pool),tb.createProductionWithOptions(tl.identifier_list,[[eq.COMMA,eq.ID],[tl.identifier_list,eq.COMMA,eq.ID]],eU.IdentifierList.pool),tb.createProductionWithOptions(tl.init_declarator_list,[[tl.single_declaration],[tl.init_declarator_list,eq.COMMA,eq.ID],[tl.init_declarator_list,eq.COMMA,eq.ID,tl.array_specifier],[tl.init_declarator_list,eq.COMMA,eq.ID,tl.array_specifier,eq.EQUAL,tl.initializer],[tl.init_declarator_list,eq.COMMA,eq.ID,eq.EQUAL,tl.initializer]],eU.InitDeclaratorList.pool),tb.createProductionWithOptions(tl.single_declaration,[[tl.fully_specified_type,eq.ID],[tl.fully_specified_type,eq.ID,tl.array_specifier],[tl.fully_specified_type,eq.ID,tl.array_specifier,eq.EQUAL,tl.initializer],[tl.fully_specified_type,eq.ID,eq.EQUAL,tl.initializer]],eU.SingleDeclaration.pool),tb.createProductionWithOptions(tl.initializer,[[tl.assignment_expression],[eq.LEFT_BRACE,tl.initializer_list,eq.RIGHT_BRACE]],eU.Initializer.pool),tb.createProductionWithOptions(tl.initializer_list,[[tl.initializer],[tl.initializer_list,eq.COMMA,tl.initializer]],eU.InitializerList.pool),tb.createProductionWithOptions(tl.expression_statement,[[eq.SEMICOLON],[tl.expression,eq.SEMICOLON]],eU.ExpressionStatement.pool),tb.createProductionWithOptions(tl.selection_statement,[[eH.IF,eq.LEFT_PAREN,tl.expression,eq.RIGHT_PAREN,tl.statement],[eH.IF,eq.LEFT_PAREN,tl.expression,eq.RIGHT_PAREN,tl.statement,eH.ELSE,tl.statement]],eU.SelectionStatement.pool),tb.createProductionWithOptions(tl.iteration_statement,[[eH.WHILE,eq.LEFT_PAREN,tl.condition,eq.RIGHT_PAREN,tl.statement],[eH.FOR,eq.LEFT_PAREN,tl.for_init_statement,tl.for_rest_statement,eq.RIGHT_PAREN,tl.statement]],eU.IterationStatement.pool),tb.createProductionWithOptions(tl.precision_specifier,[[eH.PRECISION,tl.precision_qualifier,tl.ext_builtin_type_specifier_nonarray,eq.SEMICOLON]],eU.PrecisionSpecifier.pool),tb.createProductionWithOptions(tl.for_init_statement,[[tl.expression_statement],[tl.declaration]],eU.ForInitStatement.pool),tb.createProductionWithOptions(tl.condition,[[tl.expression],[tl.fully_specified_type,eq.ID,eq.EQUAL,tl.initializer]],eU.Condition.pool),tb.createProductionWithOptions(tl.for_rest_statement,[[tl.conditionopt,eq.SEMICOLON],[tl.conditionopt,eq.SEMICOLON,tl.expression]],eU.ForRestStatement.pool),tb.createProductionWithOptions(tl.conditionopt,[[eq.EPSILON],[tl.condition]],eU.ConditionOpt.pool),tb.createProductionWithOptions(tl.jump_statement,[[eH.CONTINUE,eq.SEMICOLON],[eH.BREAK,eq.SEMICOLON],[eH.RETURN,eq.SEMICOLON],[eH.RETURN,tl.expression,eq.SEMICOLON],[eH.DISCARD,eq.SEMICOLON]],eU.JumpStatement.pool),tb.createProductionWithOptions(tl.scope_brace,[[eq.LEFT_BRACE]],eU.ScopeBrace.pool),tb.createProductionWithOptions(tl.scope_end_brace,[[eq.RIGHT_BRACE]],eU.ScopeEndBrace.pool),tb.createProductionWithOptions(tl.variable_identifier,[[eq.ID]],eU.VariableIdentifier.pool)),tI=function(e){for(var t=0;t<tO.length;t++){var r=tO[t][1];r&&e.addTranslationRule(t,r)}},tP=/*#__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 tm(this.grammar.productions[0],0,[eq.EOF])],t=ty.create(e);this._extendState(t)},t._extendState=function(e){if(e.needReInfer){this._closure(e);for(var t,r=this._inferNextState(e),i=n(r);!(t=i()).done;){var a=t.value;this._extendState(a)}}},t._closure=function(e){for(var t,r=n(e.cores);!(t=r()).done;){var i=t.value;i.canReduce()||this._extendStateItem(e,i)}return e.closured=!0,e},t._extendStateItem=function(e,t){if(!tb.isTerminal(t.curSymbol)){var r=this.grammar.getProductionList(t.curSymbol);if(t.nextSymbol){for(var i=new Set,a=!1,o=1,s=t.symbolByOffset(1);s;s=t.symbolByOffset(++o)){if(tb.isTerminal(s)){i.add(s),a=!0;break}c=this.firstSetMap.get(s);for(var c,u,l=n(c);!(u=l()).done;){var p=u.value;i.add(p)}if(!c.has(eq.EPSILON))break}if(!a&&(null==c?void 0:c.has(eq.EPSILON)))for(var h,_=n(t.lookaheadSet);!(h=_()).done;){var d=h.value;i.add(d)}for(var f,S=n(r);!(f=S()).done;){var g=f.value,v=e.createStateItem(g,0);e.items.has(v)&&tb.isSubSet(i,v.lookaheadSet)||(e.items.add(v),v.addLookahead(i),this._extendStateItem(e,v))}}else for(var m,y=n(r);!(m=y()).done;){var E=m.value,x=e.createStateItem(E,0);e.items.has(x)&&tb.isSubSet(t.lookaheadSet,x.lookaheadSet)||(e.items.add(x),x.addLookahead(t.lookaheadSet),this._extendStateItem(e,x))}}},t._inferNextState=function(e){var t=new Map,r=null!=(a=this.actionTable.get(e.id))?a:new Map,i=null!=(o=this.gotoTable.get(e.id))?o:new Map;this.actionTable.set(e.id,r),this.gotoTable.set(e.id,i);for(var a,o,s,c=n(e.items);!(s=c()).done;){var u=s.value;if(u.canReduce()){var l=void 0;l=u.production.goal!==tl.START?{action:e7.Reduce,target:u.production.id}:{action:e7.Accept};for(var p,h=n(u.lookaheadSet);!(p=h()).done;){var _=p.value;this._addAction(r,_,l)}}else{var d=u.advance();tb.addMapSetItem(t,u.curSymbol,d)}u.needReInfer=!1}for(var f,S=new Set,g=n(t.entries());!(f=g()).done;){var v=f.value,m=v[0],y=v[1],E=ty.create(Array.from(y));tb.isTerminal(m)?this._addAction(r,m,{action:e7.Shift,target:E.id}):i.set(m,E.id),S.add(E)}return S},t._addAction=function(e,t,r){var n=e.get(t);if(n&&!tb.isActionEqual(n,r)){if(t===eH.ELSE&&n.action===e7.Shift&&r.action===e7.Reduce)return;console.warn("conflict detect: <Terminal "+tb.toString(t)+">",tb.printAction(n)," -> ",tb.printAction(r))}e.set(t,r)},t.computeFirstSet=function(){for(var e,t=n(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),i=this._firstSetNTStack.length,a=i-1;a>t;a--){var o=this._firstSetNTStack[a];this.firstSetMap.set(o,r)}return r}this._firstSetNTStack.push(e);var s=this.grammar.getProductionList(e),c=new Set;this.firstSetMap.set(e,c),this.grammar.isNullableNT(e)&&c.add(eq.EPSILON);for(var u,l=n(s);!(u=l()).done;){for(var p=u.value,h=0;h<p.derivation.length;h++){var _=p.derivation[h];if(tb.isTerminal(_)){c.add(_);break}for(var d,f=this._computeFirstSetForNT(_),S=n(f);!(d=S()).done;){var g=d.value;g!==eq.EPSILON&&c.add(g)}if(!this.grammar.isNullableNT(_))break}h===p.derivation.length&&c.add(eq.EPSILON)}return this._firstSetNTStack.pop(),c},e}(),tL=/*#__PURE__*/function(){function e(e,t,r){this._traceBackStack=[],this.actionTable=e,this.gotoTable=t,this.grammar=r,this.sematicAnalyzer=new tu}var r=e.prototype;return r.parse=function(e){this.sematicAnalyzer.reset();var r=performance.now(),n=this._traceBackStack,i=this.sematicAnalyzer;n.push(0);for(var a=e.next(),o=0;;){o+=1;var s=a.value,c=this.stateActionTable.get(s.type);if((null==c?void 0:c.action)===e7.Shift)n.push(s,c.target),a=e.next();else if((null==c?void 0:c.action)===e7.Accept)return t.Logger.info("[pass compilation - parser] Accept! State automata run "+o+" times! cost time "+(performance.now()-r)+"ms"),null==i.acceptRule||i.acceptRule.call(i,i),i.semanticStack.pop();else if((null==c?void 0:c.action)===e7.Reduce){for(var u=c.target,l=this.grammar.getProductionByID(u),p=i.getTranslationRule(l.id),h=[],_=l.derivation.length-1;_>=0;_--)if(l.derivation[_]!==eq.EPSILON){n.pop();var d=n.pop();if(eX(d,e2))h.unshift(d);else{var f=i.semanticStack.pop();h.unshift(f)}}null==p||p.apply(void 0,[].concat([i],h));var S=this.stateGotoTable;n.push(l.goal);var g=null==S?void 0:S.get(l.goal);n.push(g);continue}else{var v=e0.createGSError("Unexpected token "+s.lexeme,eZ.CompilationError,t3._processingPassText,s.location);return this.sematicAnalyzer.errors.push(v),null}}},r._printStack=function(e){for(var r="",n=0;n<this._traceBackStack.length-1;n++){var i,a=this._traceBackStack[n++],o=this._traceBackStack[n];r+="State"+a+" - "+(null!=(i=o.lexeme)?i:tE.toString(o))+"; "}r+="State"+this._traceBackStack[this._traceBackStack.length-1]+" --- "+e.lexeme,t.Logger.info(r)},e.create=function(){if(!this._singleton){var t=th.create(tl.gs_shader_program,tO.map(function(e){return e[0]})),r=new tP(t);r.generate(),this._singleton=new e(r.actionTable,r.gotoTable,t),tI(this._singleton.sematicAnalyzer)}return this._singleton},e9(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)}},{key:"errors",get:function(){return this.sematicAnalyzer.errors}}]),e}();function tR(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var tM=/*#__PURE__*/function(){function e(e,t,r,n){this.macro=e,this.body=t,this.location=r,this.args=n,n&&(this._argsLexemes=this.args.map(function(e){return e.lexeme}),this._replaceRegex=RegExp("\\b("+this._argsLexemes.join("|")+")\\b","g"))}return e.prototype.expandFunctionBody=function(e){var t,r=this;if(e.length!==(null==(t=this.args)?void 0:t.length))throw e0.createGSError("mismatched function macro",eZ.PreprocessorError,"",this.location);return this.body.lexeme.replace(this._replaceRegex,function(t){return e[r._argsLexemes.indexOf(t)]})},e9(e,[{key:"isFunction",get:function(){var e;return!!(null==(e=this.args)?void 0:e.length)}}]),e}(),tN=((ew={})[ew.id=0]="id",ew[ew.line_remain=1]="line_remain",ew[ew.chunk=2]="chunk",ew[ew.int_constant=3]="int_constant",ew[ew.string_const=4]="string_const",ew[ew.right_op=5]="right_op",ew[ew.left_op=6]="left_op",ew[ew.left_paren=7]="left_paren",ew[ew.right_paren=8]="right_paren",ew[ew.ge=9]="ge",ew[ew.le=10]="le",ew[ew.eq=11]="eq",ew[ew.neq=12]="neq",ew[ew.and=13]="and",ew[ew.or=14]="or",ew[ew.left_angle=15]="left_angle",ew[ew.right_angle=16]="right_angle",ew[ew.star=17]="star",ew[ew.plus=18]="plus",ew[ew.dash=19]="dash",ew[ew.bang=20]="bang",ew[ew.slash=21]="slash",ew[ew.percent=22]="percent",ew[ew.EOF=100]="EOF",ew),tk=((eB={})[eB.define=101]="define",eB[eB.undef=102]="undef",eB[eB.if=103]="if",eB[eB.ifdef=104]="ifdef",eB[eB.ifndef=105]="ifndef",eB[eB.else=106]="else",eB[eB.elif=107]="elif",eB[eB.endif=108]="endif",eB[eB.include=109]="include",eB[eB.defined=110]="defined",eB),tV=new Map([["#define",101],["#undef",102],["#if",103],["#ifdef",104],["#ifndef",105],["#else",106],["#elif",107],["#endif",108],["#include",109],["defined",110]]),tG=function(e,t,r){this.sourceFile=null!=e?e:"__main__",this.rangeInFile=t,this.sourceMap=r},tD=/*#__PURE__*/function(){function e(e,t,r){this.sourceLoc={block:e,rangeInBlock:t},this.generatedLoc=r}return e.prototype.getSourceIndex=function(e){var t,r,n,i,a=this.sourceLoc,o=a.block,s=a.rangeInBlock;if(o.sourceMap){if("__main__"!==o.sourceFile)return o.sourceMap.map(e-this.generatedLoc.start);if(s)return{sourceFile:o.sourceFile,index:(null!=(n=null==(r=o.rangeInFile)?void 0:r.start.index)?n:0)+s.start.index}}return{index:e-this.generatedLoc.start+s.start.index+(null!=(i=null==(t=o.rangeInFile)?void 0:t.start.index)?i:0),sourceFile:this.sourceLoc.block.sourceFile}},e}(),tF=/*#__PURE__*/function(){function e(){this.mapRanges=[]}var t=e.prototype;return t.addMapRange=function(e){this.mapRanges.push(e)},t.map=function(t){for(var r,i,a=n(this.mapRanges);!(i=a()).done;){var o=i.value,s=o.generatedLoc;if(e.rangeContains(s,t))return o.getSourceIndex(t);if(o.generatedLoc.start<t){r=o;continue}break}return r?{index:t-r.generatedLoc.end+r.sourceLoc.rangeInBlock.end.index,sourceFile:r.sourceLoc.block.sourceFile}:{sourceFile:"__main__",index:t}},e.rangeContains=function(e,t){return e.start<=t&&e.end>t},e}(),tw=/*#__PURE__*/function(){function e(){}return e.expand=function(e,t,r){for(var i,a=[],o=0,s=0,c=n(e);!(i=c()).done;){var u=i.value,l=t.slice(o,u.rangeInBlock.start.index);a.push(l,u.replace);var p=s+l.length+u.replace.length,h=new tD(u.block,u.rangeInBlock,{start:s+l.length,end:p});null==r||r.addMapRange(h),o=u.rangeInBlock.end.index,s=p}return a.push(t.slice(o)),a.join("")},e.assembleSegments=function(e,t){for(var r,i=[],a=0,o=n(e);!(r=o()).done;){var s=r.value,c=t.slice(a,s.range.start.index);i.push(c,s.replace),a=s.range.end.index}return i.push(t.slice(a)),i.join("")},e}(),tB=/*#__PURE__*/function(e){function t(t,r,n){var i;return void 0===r&&(r="__main__"),(i=e.call(this,t)||this).macroLvl=0,i.sourceMap=new tF,i.file=r,i.blockRange=n,i}a(t,e);var r=t.prototype;return r.scanDirective=function(e){var t=this._advanceToDirective(e);return[tk.if,tk.ifdef,tk.ifndef].includes(null==t?void 0:t.type)?this.macroLvl+=1:(null==t?void 0:t.type)===tk.endif&&(this.macroLvl-=1),t},r.scanWordsUntilChar=function(e){for(var t=[];;)if(this.skipSpace(!0),e3.isLetter(this.getCurCharCode()))t.push(this.scanWord());else{if(this.getCurChar()===e)return this._advance(),t;this._advance()}},r.scanWord=function(e){if(void 0===e&&(e=!1),e)for(;!e3.isLetter(this.getCurCharCode())&&!this.isEnd();)this._advance();else this.skipSpace(!0);if(this.isEnd())return e1;for(var t=this._currentIndex;e3.isLetter(this.getCurCharCode())&&!this.isEnd();)this._advance();var r=this._currentIndex,n=this._source.slice(t,r);r===t&&this.throwError(this.getShaderPosition(0),"no word found.");var i=tV.get(n);if(i){var a=e2.pool.get();return a.set(i,n,this.getShaderPosition(0)),a}var o=e2.pool.get();return o.set(tN.id,n,this.getShaderPosition(n.length)),o},r.getShaderPosition=function(e){return t3.createPosition(this._currentIndex-e,this.line,this.column-e)},r.scanToken=function(e){if(this.skipCommentsAndSpace(),!this.isEnd()){for(var t=this._source,r=this._currentIndex,n=!1,i=t.length;this._currentIndex<i;)if(e3.isPpCharacters(t.charCodeAt(this._currentIndex)))this._advance(),n=!0;else{if(n)break;this._advance(),this.skipCommentsAndSpace(),r=this._currentIndex}var a=t.slice(r,this._currentIndex),o=e2.pool.get(),s=tV.get(a);return o.set(null!=s?s:tN.id,a,this.getShaderPosition(this._currentIndex-r)),null==e||e(o,this),o}},r.scanQuotedString=function(){this.skipSpace(!0),'"'!==this.getCurChar()&&this.throwError(this.getShaderPosition(0),"unexpected char, expected '\"'");var e=this.getShaderPosition(0);this._advance();for(var t=this._currentIndex;'"'!==this.getCurChar()&&!this.isEnd();)this._advance();this.isEnd()&&this.throwError(this.getShaderPosition(0),"unexpected char, expected '\"'");var r=this._source.slice(t,this._currentIndex),n=e2.pool.get();return n.set(tN.string_const,r,e),n},r.scanToChar=function(e){for(var t=this._source;t[this._currentIndex]!==e&&!this.isEnd();)this._advance()},r.scanMacroBranchChunk=function(){for(var e=this._currentIndex,t=this.getShaderPosition(0),r=this.macroLvl,n=this.scanDirective();(n.type!==tk.endif||r-1!==this.macroLvl)&&(![tk.elif,tk.else].includes(n.type)||r!==this.macroLvl);)n=this.scanDirective();var i=this._source.slice(e,this._currentIndex-n.lexeme.length-1),a=e2.pool.get();return a.set(tN.chunk,i,t),{token:a,nextDirective:n}},r.scanPairedBlock=function(e,t){this.scanToChar(e);var r=0,n=this._source;do{var i=n[this._currentIndex];i===e?r++:i===t&&r--,this._advance()}while(r>0)},r.scanRemainMacro=function(){for(var e=this.macroLvl,t=this.scanDirective();!this.isEnd()&&(t.type!==tk.endif||e-1!==this.macroLvl);)t=this.scanDirective();return this.getShaderPosition(0)},r.peekNonSpace=function(){for(var e=this._currentIndex;/\s/.test(this._source[e]);)e+=1;return this._source[e]},r.scanInteger=function(){for(var e=this._currentIndex;e3.isNum(this.getCurCharCode());)this._advance();this._currentIndex===e&&this.throwError(this.getShaderPosition(0),"no integer found");var t=this._source.slice(e,this._currentIndex),r=e2.pool.get();return r.set(tN.int_constant,t,this.getShaderPosition(0)),r},r.scanLineRemain=function(){this.skipSpace(!1);for(var e=this._currentIndex,t=[];"\n"!==this.getCurChar();){if(this.isEnd()){var r=this._source.slice(e,this._currentIndex),n=e2.pool.get();return n.set(tN.line_remain,r,this.getShaderPosition(r.length)),n}this._advance();var i=this._skipComments();i&&(i.start.index-=e,i.end.index-=e,t.push(i))}var a=this._source.slice(e,this._currentIndex);t.length&&(a=tw.assembleSegments(t.map(function(e){return{range:e,replace:""}}),a));var o=e2.pool.get();return o.set(tN.line_remain,a,this.getShaderPosition(a.length)),o},r._advanceToDirective=function(e){for(;;){var t=this.scanToken(e);if(null==t?void 0:t.lexeme.startsWith("#"))return t;if(this.isEnd())return}},r._skipComments=function(){if("//"===this.peek(2)){for(var e=this.getShaderPosition(0);"\n"!==this.getCurChar()&&!this.isEnd();)this._advance();return t3.createRange(e,this.getCurPosition())}if("/*"===this.peek(2)){var t=this.getShaderPosition(0);for(this.advance(2);"*/"!==this.peek(2)&&!this.isEnd();)this._advance();return this.advance(2),t3.createRange(t,this.getShaderPosition(0))}},t}(e5),tU=/*#__PURE__*/function(){function e(){}return e.reset=function(e,t){this._definedMacros.clear(),this._expandSegmentsStack.length=0,this._expandSegmentsStack.push([]),this._branchMacros.clear(),this.addPredefinedMacro("GL_ES"),this._includeMap=e,this._basePathForIncludeKey=t,this._errors.length=0},e.addPredefinedMacro=function(e,t){var r,n=e2.pool.get();n.set(tN.id,e),t&&(r=e2.pool.get()).set(tN.id,t),this._definedMacros.set(e,new tM(n,r))},e.parse=function(e){for(;!e.isEnd();){var t=e.scanDirective(this._onToken.bind(this));if(e.isEnd())break;switch(t.type){case tk.define:this._parseDefine(e);break;case tk.undef:this._parseUndef(e);break;case tk.if:this._parseIf(e);break;case tk.ifndef:this._parseIfNdef(e);break;case tk.ifdef:this._parseIfDef(e);break;case tk.include:this._parseInclude(e)}}return this._errors.length>0?null:tw.expand(this.expandSegments,e.source,e.sourceMap)},e.reportError=function(e,t,r,n){var i=e0.createGSError(t,eZ.PreprocessorError,r,e,n);this._errors.push(i)},e._parseInclude=function(e){var r,n=e.getShaderPosition(8);e.skipSpace(!0);var i=e.scanQuotedString();r="."!==i.lexeme[0]?i.lexeme:new URL(i.lexeme,this._basePathForIncludeKey).href.substring(t.ShaderPass._shaderRootPath.length),e.scanToChar("\n");var a=e.getShaderPosition(0),o=this._includeMap[r];if(!o){this.reportError(i.location,'Shader slice "'+r+'" not founded.',e.source,e.file);return}var s=t3.createRange(n,a),c=this._expandMacroChunk(o,s,i.lexeme),u=new tG(i.lexeme,void 0,c.sourceMap);this.expandSegments.push({block:u,rangeInBlock:s,replace:c.content})},e._parseIfDef=function(e){var t=e.current-6,r=e.scanWord();this._addEmptyReplace(e,t),this._branchMacros.add(r.lexeme);var n=this._definedMacros.get(r.lexeme);e.skipSpace(!0);var i=e.scanMacroBranchChunk(),a=i.token,o=i.nextDirective;if(n){var s=o.type===tk.endif?e.getShaderPosition(0):e.scanRemainMacro(),c=this._expandMacroChunk(a.lexeme,a.location,e),u=new tG(e.file,e.blockRange,c.sourceMap),l=t3.createRange(a.location.start,s);this.expandSegments.push({block:u,rangeInBlock:l,replace:c.content});return}this.expandSegments.pop(),this._addEmptyReplace(e,t),this._parseMacroBranch(o.type,e)},e._parseMacroBranch=function(e,t){if(e!==tk.endif){var r=t.current;if(e===tk.else){var n=t.scanMacroBranchChunk().token,i=this._expandMacroChunk(n.lexeme,n.location,t),a=new tG(t.file,t.blockRange,i.sourceMap),o=t3.createPosition(r),s=t3.createRange(o,t.getShaderPosition(0));this.expandSegments.push({block:a,rangeInBlock:s,replace:i.content})}else if(e===tk.elif){var c=this._parseConstantExpression(t),u=t.scanMacroBranchChunk(),l=u.token,p=u.nextDirective;if(c){var h=p.type===tk.endif?t.current:t.scanRemainMacro().index,_=this._expandMacroChunk(l.lexeme,l.location,t),d=new tG(t.file,t.blockRange,_.sourceMap),f=t3.createPosition(r),S=t3.createPosition(h),g=t3.createRange(f,S);this.expandSegments.push({block:d,rangeInBlock:g,replace:_.content})}else{var v=new tG(t.file,t.blockRange),m=t3.createPosition(r),y=t3.createPosition(t.current),E=t3.createRange(m,y);this.expandSegments.push({block:v,rangeInBlock:E,replace:""}),this._parseMacroBranch(p.type,t)}}}},e._parseConstantExpression=function(e){return e.skipSpace(!0),this._parseLogicalOrExpression(e)},e._parseLogicalOrExpression=function(e){var t=this._parseLogicalAndExpression(e),r=e.peek(2);if(r&&"||"===r){e.advance(2),e.skipSpace(!1);var n=this._parseLogicalOrExpression(e);return t||n}return t},e._parseLogicalAndExpression=function(e){var t=this._parseEqualityExpression(e),r=e.peek(2);if(r&&"&&"===r){e.advance(2),e.skipSpace(!1);var n=this._parseLogicalAndExpression(e);return t&&n}return t},e._parseEqualityExpression=function(e){var t=this._parseRelationalExpression(e),r=e.peek(2);if(r&&["==","!="].includes(r)){e.advance(2),e.skipSpace(!1);var n=this._parseEqualityExpression(e);switch(r){case"==":return t===n;case"!=":return t!==n}}return t},e._parseRelationalExpression=function(e){var t=this._parseShiftExpression(e),r=e.peek(2);if("="!==r[1]&&(r=r[0]),r&&[">","<",">=","<="].includes(r)){var n=e.getShaderPosition(0);e.advance(r.length),e.skipSpace(!1);var i=this._parseRelationalExpression(e);if((void 0===t?"undefined":tR(t))!==(void 0===i?"undefined":tR(i))&&"number"!=typeof t){this.reportError(n,"invalid operator in relation expression.",e.source,e.file);return}switch(r){case">":return t>i;case"<":return t<i;case">=":return t>=i;case"<=":return t<=i}}return t},e._parseShiftExpression=function(e){var t=this._parseAdditiveExpression(e),r=e.peek(2);if(r&&[">>","<<"].includes(r)){var n=e.getShaderPosition(0);e.advance(2),e.skipSpace(!1);var i=this._parseShiftExpression(e);if((void 0===t?"undefined":tR(t))!==(void 0===i?"undefined":tR(i))&&"number"!=typeof t){this.reportError(n,"invalid operator in shift expression.",e.source,e.file);return}switch(r){case">>":return t>>i;case"<<":return t<<i}}return t},e._parseAdditiveExpression=function(e){var t=this._parseMulticativeExpression(e);if([">","<"].includes(e.getCurChar())){var r=e.getShaderPosition(0);e.advance();var n=e.getCurChar();e.skipSpace(!1);var i=this._parseAdditiveExpression(e);if((void 0===t?"undefined":tR(t))!==(void 0===i?"undefined":tR(i))&&"number"!=typeof t)return this.reportError(r,"invalid operator.",e.source,e.file),!1;switch(n){case"+":return t+i;case"-":return t-i}}return t},e._parseMulticativeExpression=function(e){var t=this._parseUnaryExpression(e);if(e.skipSpace(!1),["*","/","%"].includes(e.getCurChar())){var r=e.getShaderPosition(0),n=e.getCurChar();e.skipSpace(!1);var i=this._parseMulticativeExpression(e);if((void 0===t?"undefined":tR(t))!==(void 0===i?"undefined":tR(i))&&"number"!=typeof t){this.reportError(r,"invalid operator.",e.source,e.file);return}switch(n){case"*":return t*i;case"/":return t/i;case"%":return t%i}}return t},e._parseUnaryExpression=function(e){var t=e.getCurChar();if(["+","-","!"].includes(t)){e.advance();var r=e.getShaderPosition(0),n=this._parseParenthesisExpression(e);switch(("!"===t&&"boolean"!=typeof n||"!"!==t&&"number"!=typeof n)&&this.reportError(r,"invalid operator.",e.source,e.file),t){case"+":return n;case"-":return-n;case"!":return!n}}return this._parseParenthesisExpression(e)},e._parseParenthesisExpression=function(e){if("("===e.getCurChar()){e._advance(),e.skipSpace(!1);var t=this._parseConstantExpression(e);return e.scanToChar(")"),e._advance(),t}return this._parseConstant(e)},e._parseConstant=function(e){if(e3.isAlpha(e.getCurCharCode())){var t=e.scanWord();if(t.type===tk.defined){var r="("===e.peekNonSpace(),n=e.scanWord(!0);return r&&(e.scanToChar(")"),e._advance()),this._branchMacros.add(n.lexeme),!!this._definedMacros.get(n.lexeme)}var i=this._definedMacros.get(t.lexeme);if(!i||!i.body)return!1;i.isFunction&&this.reportError(t.location,"invalid function macro usage",e.source,e.file);var a=Number(i.body.lexeme);return Number.isInteger(a)||this.reportError(t.location,"invalid const macro: "+t.lexeme,e.source,e.file),this._branchMacros.add(t.lexeme),a}if(e3.isNum(e.getCurCharCode()))return Number(e.scanInteger().lexeme);this.reportError(e.getShaderPosition(0),"invalid token: "+e.getCurChar(),e.source,e.file)},e._expandMacroChunk=function(e,t,r){this._expandSegmentsStack.push([]),n="string"==typeof r?new tB(e,r):new tB(e,r.file,t);var n,i=this.parse(n);return this._expandSegmentsStack.pop(),{content:i,sourceMap:n.sourceMap}},e._parseIfNdef=function(e){var t=e.current-7,r=e.scanWord();this._addEmptyReplace(e,t),this._branchMacros.add(r.lexeme);var n=this._definedMacros.get(r.lexeme),i=e.scanMacroBranchChunk(),a=i.token,o=i.nextDirective;if(!n){var s=o.type===tk.endif?e.getShaderPosition(0):e.scanRemainMacro(),c=this._expandMacroChunk(a.lexeme,a.location,e),u=new tG(e.file,e.blockRange,c.sourceMap),l=t3.createRange(a.location.start,s);this.expandSegments.push({block:u,rangeInBlock:l,replace:c.content});return}this.expandSegments.pop(),this._addEmptyReplace(e,t),this._parseMacroBranch(o.type,e)},e._addEmptyReplace=function(e,t){var r=new tG(e.file,e.blockRange),n=t3.createPosition(t),i=e.getCurPosition(),a=t3.createRange(n,i);this.expandSegments.push({block:r,rangeInBlock:a,replace:""})},e._parseIf=function(e){var t=e.current-3,r=this._parseConstantExpression(e);this._addEmptyReplace(e,t);var n=e.scanMacroBranchChunk(),i=n.token,a=n.nextDirective;if(r){var o=a.type===tk.endif?e.getShaderPosition(0):e.scanRemainMacro(),s=this._expandMacroChunk(i.lexeme,i.location,e),c=new tG(e.file,e.blockRange,s.sourceMap),u=t3.createRange(i.location.start,o);this.expandSegments.push({block:c,rangeInBlock:u,replace:s.content});return}this.expandSegments.pop(),this._addEmptyReplace(e,t),this._parseMacroBranch(a.type,e)},e._parseDefine=function(e){var t,r=e.getShaderPosition(7),n=e.scanWord(),i=n.location.end;this._definedMacros.get(n.lexeme)&&n.lexeme.startsWith("GL_")&&this.reportError(n.location,"redefined macro: "+n.lexeme,e.source,e.file),"("===e.getCurChar()&&(t=e.scanWordsUntilChar(")"),i=e.getShaderPosition(0));var a=new tM(n,e.scanLineRemain(),t3.createRange(r,i),t);this._definedMacros.set(n.lexeme,a);var o=new tG(e.file,e.blockRange);this.expandSegments.push({block:o,rangeInBlock:t3.createRange(r,e.getCurPosition()),replace:""})},e._parseUndef=function(e){var t=e.current-6,r=e.scanWord(),n=new tG(e.file,e.blockRange),i=t3.createPosition(t),a=t3.createRange(i,e.getCurPosition());this.expandSegments.push({block:n,rangeInBlock:a,replace:""}),this._definedMacros.delete(r.lexeme)},e._onToken=function(e,t){var r=this._definedMacros.get(e.lexeme);if(r){var n=r.body.lexeme;if(r.isFunction){t.scanToChar("("),t._advance();for(var i=[],a=1,o=t.current;;){if("("===t.getCurChar())a+=1;else if(")"===t.getCurChar()){if(0==(a-=1))break}else","===t.getCurChar()&&1===a&&(i.push(t.source.slice(o,t.current)),o=t.current+1);t._advance()}i.push(t.source.slice(o,t.current)),t._advance();var s=t3.createRange(e.location.start,t.getCurPosition());n=r.expandFunctionBody(i);var c=this._expandMacroChunk(n,s,t),u=new tG(t.file,t.blockRange,c.sourceMap),l=t3.createRange(e.location.start,t.getCurPosition());this.expandSegments.push({block:u,rangeInBlock:l,replace:c.content})}else{var p=this._expandMacroChunk(n,e.location,t),h=new tG(t.file,t.blockRange,p.sourceMap),_=t3.createRange(e.location.start,e.location.end);this.expandSegments.push({block:h,rangeInBlock:_,replace:p.content})}}},e9(e,null,[{key:"expandSegments",get:function(){return this._expandSegmentsStack[this._expandSegmentsStack.length-1]}}]),e}();tU._definedMacros=new Map,tU._expandSegmentsStack=[[]],tU._branchMacros=new Set,tU._errors=[];var tW=/*#__PURE__*/function(){function e(){}return e.reset=function(e,t){tU.reset(e,t)},e.process=function(e){return this.baseScanner=new tB(e),tU.parse(this.baseScanner)},e.addPredefinedMacro=function(e,t){tU.addPredefinedMacro(e,t)},e.convertSourceIndex=function(e){return this.baseScanner.sourceMap.map(e)},e}(),tj=/*#__PURE__*/function(){function e(){this.attributeList=[],this.attributeStructs=[],this._referencedAttributeList=Object.create(null),this._referencedGlobals=Object.create(null),this._referencedVaryingList=Object.create(null),this._referencedMRTList=Object.create(null)}var t=e.prototype;return t.reset=function(){this.attributeList.length=0,this.attributeStructs.length=0,this._referencedAttributeList=Object.create(null),this._referencedGlobals=Object.create(null),this._referencedVaryingList=Object.create(null),this._referencedMRTList=Object.create(null),this.mrtStruct=void 0},t.isAttributeStruct=function(e){return -1!==this.attributeStructs.findIndex(function(t){return t.ident.lexeme===e})},t.isVaryingStruct=function(e){var t,r;return(null==(r=this.varyingStruct)?void 0:null==(t=r.ident)?void 0:t.lexeme)===e},t.isMRTStruct=function(e){var t,r;return(null==(r=this.mrtStruct)?void 0:null==(t=r.ident)?void 0:t.lexeme)===e},t.referenceAttribute=function(e){if(!this._referencedAttributeList[e.lexeme]){var t=this.attributeList.find(function(t){return t.ident.lexeme===e.lexeme});if(!t)return e0.createGSError("referenced attribute not found: "+e.lexeme,eZ.CompilationError,t3._processingPassText,e.location);this._referencedAttributeList[e.lexeme]=t}},t.referenceVarying=function(e){if(!this._referencedVaryingList[e.lexeme]){var t,r=null==(t=this.varyingStruct)?void 0:t.propList.find(function(t){return t.ident.lexeme===e.lexeme});if(!r)return e0.createGSError("referenced varying not found: "+e.lexeme,eZ.CompilationError,t3._processingPassText,e.location);this._referencedVaryingList[e.lexeme]=r}},t.referenceMRTProp=function(e){if(!this._referencedMRTList[e.lexeme]){var t,r=null==(t=this.mrtStruct)?void 0:t.propList.find(function(t){return t.ident.lexeme===e.lexeme});if(!r)return e0.createGSError("referenced mrt not found: "+e.lexeme,eZ.CompilationError,t3._processingPassText,e.location);this._referencedMRTList[e.lexeme]=r}},t.referenceGlobal=function(e,t){if(!this._referencedGlobals[e]){if(t===tt.FN){for(var r=this._passSymbolTable.getAllFnSymbols(e),n=0;n<r.length;n++){var i=0===n?e:e+n;this._referencedGlobals[i]=r[n]}return}var a=this._passSymbolTable.lookup(e,t);a&&(this._referencedGlobals[e]=a)}},e.reset=function(){this._singleton||(this._singleton=new e),this._singleton.reset()},e9(e,[{key:"passSymbolTable",get:function(){return this._passSymbolTable}}],[{key:"context",get:function(){return this._singleton}}]),e}(),tH=/*#__PURE__*/function(){function e(){this.array=[]}return e.prototype.dispose=function(){this.array.length=0},e}(),tz="GS_glFragColor",tq=/*#__PURE__*/function(){function e(){this.errors=[]}var t=e.prototype;return t.defaultCodeGen=function(t){var r=e._tmpArrayPool,i=r.get();i.dispose();for(var a,o=n(t);!(a=o()).done;){var s=a.value;eX(s,e2)?i.array.push(s.lexeme):i.array.push(s.codeGen(this))}return r.return(i),i.array.join(" ")},t.visitPostfixExpression=function(e){var t=e.children,r=t.length,n=tj.context;if(3===r){var i=t[0],a=t[2];if(!eX(a,e2))return i.codeGen(this)+"."+a.codeGen(this);if(n.isAttributeStruct(i.type)){var o=n.referenceAttribute(a);return o&&this.errors.push(o),a.lexeme}if(n.isVaryingStruct(i.type)){var s=n.referenceVarying(a);return s&&this.errors.push(s),a.lexeme}if(n.isMRTStruct(i.type)){var c=n.referenceMRTProp(a);return c&&this.errors.push(c),a.lexeme}return i.codeGen(this)+"."+a.lexeme}if(4===r){var u=t[0],l=t[2],p=u.codeGen(this),h=l.codeGen(this);if("gl_FragData"===p){n._referencedVaryingList[tz]&&this._reportError(u.location,"cannot use both gl_FragData and gl_FragColor");var _=this.getFragDataCodeGen(h);return n._referencedMRTList[_]=this.getReferencedMRTPropText(h,_),_}return p+"["+h+"]"}return this.defaultCodeGen(e.children)},t.visitVariableIdentifier=function(e){return eX(e.symbolInfo,tc)&&e.symbolInfo.isGlobalVariable&&tj.context.referenceGlobal(e.lexeme,tt.VAR),e.lexeme},t.visitFunctionCall=function(e){var t=e.children[0];if(eX(t.fnSymbol,tn)){tj.context.referenceGlobal(t.fnSymbol.ident,tt.FN);var r=t.children[2],n=t.fnSymbol.astNode.protoType.parameterList;if(eX(r,eU.FunctionCallParameterList)){for(var i=[],a=r.paramNodes,o=0;o<a.length;o++)tj.context.isAttributeStruct(n[o].typeInfo.typeLexeme)||tj.context.isVaryingStruct(n[o].typeInfo.typeLexeme)||i.push(a[o].codeGen(this));return t.fnSymbol.ident+"("+i.join(", ")+")"}}return this.defaultCodeGen(e.children)},t.visitStatementList=function(e){var t=e.children;return 1===t.length?t[0].codeGen(this):t[0].codeGen(this)+"\n"+t[1].codeGen(this)},t.visitSingleDeclaration=function(e){var t=e.typeSpecifier.type;return"string"==typeof t&&tj.context.referenceGlobal(t,tt.STRUCT),this.defaultCodeGen(e.children)},t.visitGlobalVariableDeclaration=function(e){var t=e.children,r=t[0];return eX(r,eU.FullySpecifiedType)&&r.typeSpecifier.isCustom&&tj.context.referenceGlobal(r.type,tt.STRUCT),this.defaultCodeGen(t)},t.visitDeclaration=function(e){var t=tj.context,r=e.children,n=r[0];if(eX(n,eU.InitDeclaratorList)){var i=n.typeInfo.typeLexeme;if(t.isVaryingStruct(i)||t.isMRTStruct(i))return""}return this.defaultCodeGen(r)},t.visitFunctionProtoType=function(e){return tj.context._curFn=e,this.defaultCodeGen(e.children)},t.visitFunctionDefinition=function(e){return tj.context._curFn=void 0,this.defaultCodeGen(e.children)},t.visitFunctionParameterList=function(e){var t=this;return e.parameterInfoList.filter(function(e){return!tj.context.isAttributeStruct(e.typeInfo.typeLexeme)&&!tj.context.isVaryingStruct(e.typeInfo.typeLexeme)}).map(function(e){return e.astNode.codeGen(t)}).join(", ")},t.visitFunctionHeader=function(e){var t=e.returnType.typeSpecifier.lexeme;return tj.context.isAttributeStruct(t)||tj.context.isVaryingStruct(t)?"void "+e.ident.lexeme+"(":this.defaultCodeGen(e.children)},t.visitJumpStatement=function(e){var t=e.children;if(t[0].type===eH.RETURN){var r=t[1];if(eX(r,eU.Expression)){var n,i,a,o,s=tE.unwrapNodeByType(r,tl.variable_identifier);if((null==s?void 0:s.typeInfo)===(null==(i=tj.context.varyingStruct)?void 0:null==(n=i.ident)?void 0:n.lexeme))return"";var c=tE.unwrapNodeByType(r,tl.function_call);if((null==c?void 0:c.type)===(null==(o=tj.context.varyingStruct)?void 0:null==(a=o.ident)?void 0:a.lexeme))return""+r.codeGen(this)+";"}}return this.defaultCodeGen(t)},t.visitFunctionIdentifier=function(e){return this.defaultCodeGen(e.children)},t._reportError=function(e,t){this.errors.push(new e$(eZ.CompilationError,t,e,t3._processingPassText))},e}();tq._tmpArrayPool=new t.ReturnableObjectPool(tH,10);var tX=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._versionText="",t._extensions="",t._globalCodeArray=[],t}a(t,e);var r=t.prototype;return r.visitShaderProgram=function(e,t,r){return this.errors.length=0,tj.reset(),tj.context._passSymbolTable=e.shaderData.symbolTable,{vertex:this.vertexMain(t,e.shaderData),fragment:this._fragmentMain(r,e.shaderData)}},r.vertexMain=function(e,t){var r=t.symbolTable,i=r.lookup(e,tt.FN);if(!(null==i?void 0:i.astNode))throw"no entry function found: "+e;var a=i.astNode;tj.context.stage=t_.VERTEX;var o=a.protoType.returnType;if("string"==typeof o.type){var s=r.lookup(o.type,tt.STRUCT);s?tj.context.varyingStruct=s.astNode:this._reportError(o.location,"invalid varying struct: "+o.type)}else o.type!==eH.VOID&&this._reportError(o.location,"vertex main entry can only return struct or void.");var c=a.protoType.parameterList;if(null==c?void 0:c.length)for(var u,l=n(c);!(u=l()).done;){var p=u.value;if("string"==typeof p.typeInfo.type){var h=r.lookup(p.typeInfo.type,tt.STRUCT);if(!h){this._reportError(p.astNode.location,'Not found attribute struct "'+p.typeInfo.type+'".');continue}tj.context.attributeStructs.push(h.astNode);for(var _,d=n(h.astNode.propList);!(_=d()).done;){var f=_.value;tj.context.attributeList.push(f)}}else tj.context.attributeList.push(p)}var S=a.statements.codeGen(this),g=this._globalCodeArray;g.length=0,this._getGlobalText(t,g),this.getAttributeDeclare(g),this.getVaryingDeclare(g);var v=g.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return tj.context.reset(),this._versionText+"\n"+v+"\n\nvoid main() "+S},r._fragmentMain=function(e,t){var r=t.symbolTable,n=r.lookup(e,tt.FN);if(!(null==n?void 0:n.astNode))throw"no entry function found: "+e;var i=n.astNode,a=i.returnStatement;a&&(a.isFragReturnStatement=!0);var o=tj.context;o.stage=t_.FRAGMENT;var s=i.protoType.returnType,c=s.type,u=s.location;if("string"==typeof c){var l=r.lookup(c,tt.STRUCT);l?o.mrtStruct=l.astNode:this._reportError(u,"invalid mrt struct: "+c)}else c!==eH.VOID&&c!==eH.VEC4&&this._reportError(u,"fragment main entry can only return struct or vec4.");var p=i.statements.codeGen(this),h=this._globalCodeArray;h.length=0,this._getGlobalText(t,h),this.getVaryingDeclare(h),this.getMRTDeclare(h);var _=h.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return o.reset(),this._versionText+"\n"+this._extensions+"\n\n#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp int;\n#else\n precision mediump float;\n precision mediump int;\n#endif\n\n"+_+"\n\nvoid main() "+p},r._getGlobalText=function(e,t,r,i){void 0===r&&(r=0),void 0===i&&(i=new Set);var a=tj.context._referencedGlobals;if(r===Object.keys(a).length){for(var o,s=n(e.globalPrecisions);!(o=s()).done;){var c=o.value;t.push({text:c.codeGen(this),index:c.location.start.index})}return t}for(var u in r=Object.keys(a).length,a){var l=a[u];i.has(u)||(i.add(u),eX(l,tr)?l.symbolType===tt.VAR?t.push({text:"uniform "+l.astNode.codeGen(this),index:l.astNode.location.start.index}):t.push({text:l.astNode.codeGen(this),index:l.astNode.location.start.index}):t.push({text:l.codeGen(this),index:l.location.start.index}))}return this._getGlobalText(e,t,r,i)},t}(tq),tQ=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._versionText="#version 100",t._extensions=["GL_EXT_shader_texture_lod","GL_OES_standard_derivatives","GL_EXT_draw_buffers","GL_EXT_frag_depth"].map(function(e){return"#extension "+e+" : enable\n"}).join(""),t}a(t,e);var r=t.prototype;return r.getFragDataCodeGen=function(e){return"gl_FragData["+e+"]"},r.getReferencedMRTPropText=function(e,t){return""},r.getAttributeDeclare=function(e){for(var t,r=n(Object.values(tj.context._referencedAttributeList));!(t=r()).done;){var i=t.value;e.push({text:"attribute "+i.typeInfo.typeLexeme+" "+i.ident.lexeme+";",index:i.ident.location.start.index})}},r.getVaryingDeclare=function(e){for(var t,r=n(Object.values(tj.context._referencedVaryingList));!(t=r()).done;){var i=t.value;e.push({text:"varying "+i.typeInfo.typeLexeme+" "+i.ident.lexeme+";",index:i.ident.location.start.index})}},r.getMRTDeclare=function(e){},r.visitPostfixExpression=function(t){var r=t.children,n=r[0],i=tj.context;if(eX(n,eU.PostfixExpression)&&i.isMRTStruct(n.type)){var a=r[2],o=i.mrtStruct.propList.find(function(e){return e.ident.lexeme===a.lexeme});return o?"gl_FragData["+o.mrtIndex+"]":(this._reportError(a.location,"not found mrt property: "+a.lexeme),"")}return e.prototype.visitPostfixExpression.call(this,t)},r.visitJumpStatement=function(t){return t.isFragReturnStatement?"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}(tX),tY=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._versionText="#version 300 es",t}a(t,e);var r=t.prototype;return r.getFragDataCodeGen=function(e){return"GS_glFragData_"+e},r.getReferencedMRTPropText=function(e,t){return"layout(location = "+e+") out vec4 "+t+";"},r.getAttributeDeclare=function(e){for(var t,r=n(Object.values(tj.context._referencedAttributeList));!(t=r()).done;){var i=t.value;e.push({text:"in "+i.typeInfo.typeLexeme+" "+i.ident.lexeme+";",index:i.ident.location.start.index})}},r.getVaryingDeclare=function(e){for(var t=tj.context.stage===t_.FRAGMENT?"in":"out",r=Object.values(tj.context._referencedVaryingList),n=0;n<r.length;n++){var i,a=r[n];e.push({text:(null!=(i=a.qualifier)?i:t)+" "+a.typeInfo.typeLexeme+" "+a.ident.lexeme+";",index:a.ident.location.start.index})}},r.getMRTDeclare=function(e){var t=tj.context._referencedMRTList;for(var r in t){var n=t[r];"string"==typeof n?e.push({text:n,index:Number.MAX_SAFE_INTEGER}):e.push({text:this.getReferencedMRTPropText(n.mrtIndex,r),index:n.ident.location.start.index})}},r.visitFunctionIdentifier=function(e){var t=e.children;if(1!==t[0].children.length)return this.defaultCodeGen(t);var r=e.lexeme;if("texture2D"===e.ident||"textureCube"===e.ident)r="texture";else if("texture2DProj"===e.ident)r="textureProj";else if(tj.context.stage===t_.FRAGMENT)switch(e.ident){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=tj.context;return r.stage===t_.FRAGMENT&&"gl_FragColor"===t.lexeme?(r._referencedMRTList.gl_FragData&&this._reportError(t.location,"cannot use both gl_FragData and gl_FragColor"),r.mrtStruct&&this._reportError(t.location,"gl_FragColor cannot be used with MRT (Multiple Render Targets)."),this._registerFragColorVariable(t),tz):e.prototype.visitVariableIdentifier.call(this,t)},r.visitJumpStatement=function(t){return t.isFragReturnStatement?tj.context.mrtStruct?"":(this._registerFragColorVariable(t),tz+" = "+t.children[1].codeGen(this)+";"):e.prototype.visitJumpStatement.call(this,t)},r._registerFragColorVariable=function(e){var t=tj.context._referencedVaryingList;if(!t[tz]){var r=e2.pool.get();r.set(eq.ID,tz,t3.createPosition(0,0,0)),t[tz]={ident:r,typeInfo:new tx(eH.VEC4,"vec4"),qualifier:"out",astNode:e}}},t.getVisitor=function(){return this._singleton||(this._singleton=new t),this._singleton},t}(tX);function tK(){return(tK=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 tJ=new Map([["RenderQueueType",eH.GS_RenderQueueType],["BlendState",eH.GS_BlendState],["DepthState",eH.GS_DepthState],["StencilState",eH.GS_StencilState],["RasterState",eH.GS_RasterState],["EditorProperties",eH.GS_EditorProperties],["EditorMacros",eH.GS_EditorMacros],["Editor",eH.GS_Editor],["Tags",eH.GS_Tags],["VertexShader",eH.GS_VertexShader],["FragmentShader",eH.GS_FragmentShader],["SubShader",eH.GS_SubShader],["Pass",eH.GS_Pass],["BlendFactor",eH.GS_BlendFactor],["BlendOperation",eH.GS_BlendOperation],["Bool",eH.GS_Bool],["Number",eH.GS_Number],["CompareFunction",eH.GS_CompareFunction],["StencilOperation",eH.GS_StencilOperation],["CullMode",eH.GS_CullMode],["true",eH.TRUE],["false",eH.FALSE],["UsePass",eH.GS_UsePass],["Color",eH.GS_Color]]),t$=/*#__PURE__*/function(e){function t(t,r){return void 0===r&&(r=new Map),e.call(this,t,r)||this}a(t,e);var r=t.prototype;return r.scanWord=function(){this.skipCommentsAndSpace();for(var e=this._currentIndex;/\S/.test(this.getCurChar())&&!this.isEnd();)this._advance();return this._source.substring(e,this._currentIndex)},r.scanNumber=function(){this.skipCommentsAndSpace();for(var e=this._currentIndex;/[0-9]/.test(this.getCurChar());)this._advance();if("."===this.getCurChar())for(this._advance();/[0-9]/.test(this.getCurChar());)this._advance();return Number(this._source.substring(e,this._currentIndex))},r.scanToCharacter=function(e){for(;this.getCurChar()!==e&&!this.isEnd();)this._advance();this._advance()},t}(e5),tZ=/*#__PURE__*/function(e){function r(){return e.apply(this,arguments)||this}a(r,e);var n=r.prototype;return n.insert=function(e){for(var r,n=null!=(r=this._table.get(e.ident))?r:[],i=0;i<n.length;i++)if(n[i].type===e.type){t.Logger.warn("replace symbol:",e.ident),n[i]=e;return}n.push(e),this._table.set(e.ident,n)},n.lookup=function(e,t){var r=this._table.get(e);if(r)for(var n=r.length,i=0;i<n;i++){var a=r[i];if(a.type===t)return a}},r}(ta),t0=[eH.GS_RenderQueueType,eH.GS_BlendFactor,eH.GS_BlendOperation,eH.GS_Bool,eH.GS_Number,eH.GS_Color,eH.GS_CompareFunction,eH.GS_StencilOperation,eH.GS_CullMode],t2=[eH.GS_BlendState,eH.GS_DepthState,eH.GS_RasterState,eH.GS_StencilState],t1=/*#__PURE__*/function(){function e(){}return e.reset=function(){this._errors.length=0,this._symbolTableStack.clear(),this._newScope()},e.parse=function(e){var r=performance.now(),n=new t$(e,tJ),i={subShaders:[],globalContents:[],renderStates:{constantMap:{},variableMap:{}}};n.scanText("Shader"),i.name=n.scanPairedText('"','"'),n.scanText("{"),n.skipCommentsAndSpace(),this._parseShaderStatements(i,n);for(var a=i.globalContents,o=i.renderStates,s=0;s<i.subShaders.length;s++)for(var c=i.subShaders[s],u=a.concat(c.globalContents),l=tK({},o.constantMap,c.renderStates.constantMap),p=tK({},o.variableMap,c.renderStates.variableMap),h=0;h<c.passes.length;h++){var _=c.passes[h];if(Object.assign(_.renderStates.constantMap,l),Object.assign(_.renderStates.variableMap,p),!_.isUsePass){var d=u.concat(_.globalContents);_.contents=d.map(function(e){return e.content}).join("\n")}}return t.Logger.info("[content compilation] cost time "+(performance.now()-r)+"ms"),i},e._isRenderStateDeclarator=function(e){return t2.includes(e.type)},e._isEngineType=function(e){return t0.includes(e.type)},e._lookupSymbolByType=function(t,r){for(var n=e._symbolTableStack.stack,i=n.length,a=i-1;a>=0;a--){var o=n[a].lookup(t,r);if(o)return o}},e._parseShaderStatements=function(t,r){for(var n=1,i=r.getCurPosition();;){var a=r.scanToken();switch(a.type){case eH.GS_SubShader:this._addGlobalStatement(t,r,i,a.lexeme.length);var o=this._parseSubShader(r);t.subShaders.push(o),i=r.getCurPosition();break;case eH.GS_EditorProperties:case eH.GS_EditorMacros:case eH.GS_Editor:this._addGlobalStatement(t,r,i,a.lexeme.length),r.scanPairedText("{","}",!0),i=r.getCurPosition();break;case eH.GS_RenderQueueType:this._addGlobalStatement(t,r,i,a.lexeme.length),this._parseRenderQueueAssignment(t,r),i=r.getCurPosition();break;case eq.NOT_WORD:if("{"===a.lexeme)n+=1;else if("}"===a.lexeme&&0==(n-=1)){this._addGlobalStatement(t,r,i,a.lexeme.length),this._symbolTableStack.dropScope();return}default:if(e._isRenderStateDeclarator(a)){this._addGlobalStatement(t,r,i,a.lexeme.length),this._parseRenderStateDeclarationOrAssignment(t,a,r),i=r.getCurPosition();break}e._isEngineType(a)&&(this._addGlobalStatement(t,r,i,a.lexeme.length),this._parseVariableDeclaration(a.type,r),i=r.getCurPosition())}}},e._parseRenderStateDeclarationOrAssignment=function(t,r,n){var i,a=n.scanToken();if(a.type===eq.ID)i=!0,n.scanText("{");else if("{"===a.lexeme)i=!1;else if("="===a.lexeme){var o=n.scanToken();n.scanText(";");var s=e._lookupSymbolByType(o.lexeme,r.type);if(!(null==s?void 0:s.value)){var c=e0.createGSError('Invalid "'+r.lexeme+'" variable: '+o.lexeme,eZ.CompilationError,n.source,o.location);this._errors.push(c);return}var u=s.value;Object.assign(t.renderStates.constantMap,u.constantMap),Object.assign(t.renderStates.variableMap,u.variableMap);return}var l=this._parseRenderStatePropList(r.lexeme,n);i?this._symbolTableStack.insert({ident:a.lexeme,type:r.type,value:l}):(Object.assign(t.renderStates.constantMap,l.constantMap),Object.assign(t.renderStates.variableMap,l.variableMap))},e._parseVariableDeclaration=function(e,t){var r=t.scanToken();t.scanText(";"),this._symbolTableStack.insert({type:r.type,ident:r.lexeme})},e._newScope=function(){var e=new tZ;this._symbolTableStack.newScope(e)},e._dropScope=function(){this._symbolTableStack.dropScope()},e._parseRenderStatePropList=function(e,t){for(var r={constantMap:{},variableMap:{}};"}"!==t.getCurChar();)this._parseRenderStatePropItem(r,e,t),t.skipCommentsAndSpace();return t._advance(),r},e._parseRenderStatePropItem=function(r,n,i){var a=i.scanToken().lexeme,o=i.scanToken();if("BlendState"===n&&"BlendColor"!==a&&"AlphaToCoverage"!==a){var s=0;if("["===o.lexeme)s=i.scanNumber(),i.scanText("]"),i.scanText("=");else if("="!==o.lexeme){var c=e0.createGSError("Invalid syntax, expect character '=', but got "+o.lexeme,eZ.CompilationError,i.source,i.getCurPosition());this._errors.push(c),i.scanToCharacter(";");return}a+=s}a=n+a;var u=t.RenderStateDataKey[a];if(void 0==u){var l=e0.createGSError("Invalid render state element "+a,eZ.CompilationError,i.source,i.getCurPosition());this._errors.push(l),i.scanToCharacter(";");return}if(i.skipCommentsAndSpace(),/[0-9.]/.test(i.getCurChar()))_=i.scanNumber();else{var p=i.scanToken();if(p.type===eH.TRUE)_=!0;else if(p.type===eH.FALSE)_=!1;else if(p.type===eH.GS_Color){i.scanText("(");for(var h=[];;){if(h.push(i.scanNumber()),i.skipCommentsAndSpace(),")"===i.peek(1)){i._advance();break}i.scanText(",")}_=eY(t.Color,[].concat(h))}else if("."===i.getCurChar()){i._advance();var _,d,f=i.scanToken();if(void 0==(_=null==(d=e._engineType[p.lexeme])?void 0:d[f.lexeme])){var S=e0.createGSError("Invalid engine constant: "+p.lexeme+"."+f.lexeme,eZ.CompilationError,i.source,f.location);this._errors.push(S),i.scanToCharacter(";");return}}else _=p.lexeme}i.scanText(";"),"string"==typeof _?r.variableMap[u]=_:r.constantMap[u]=_},e._parseRenderQueueAssignment=function(r,n){n.scanText("=");var i=n.scanToken();n.scanText(";");var a=e._engineType.RenderQueueType[i.lexeme],o=t.RenderStateDataKey.RenderQueueType;void 0==a?r.renderStates.variableMap[o]=i.lexeme:r.renderStates.constantMap[o]=a},e._addGlobalStatement=function(e,t,r,n){t.current>r.index+n&&e.globalContents.push({range:{start:r,end:tK({},t.getCurPosition(),{index:t.current-n-1})},content:t.source.substring(r.index,t.current-n-1)})},e._parseSubShader=function(t){this._newScope();var r={passes:[],globalContents:[],renderStates:{constantMap:{},variableMap:{}},tags:{}},n=1;r.name=t.scanPairedText('"','"'),t.scanText("{"),t.skipCommentsAndSpace();for(var i=t.getCurPosition();;){var a=t.scanToken();switch(a.type){case eH.GS_Pass:this._addGlobalStatement(r,t,i,a.lexeme.length);var o=this._parsePass(t);r.passes.push(o),i=t.getCurPosition();break;case eH.GS_RenderQueueType:this._addGlobalStatement(r,t,i,a.lexeme.length),this._parseRenderQueueAssignment(r,t),i=t.getCurPosition();break;case eH.GS_UsePass:this._addGlobalStatement(r,t,i,a.lexeme.length);var s=t.scanPairedText('"','"');r.passes.push({name:s,isUsePass:!0,renderStates:{constantMap:{},variableMap:{}},tags:{}}),i=t.getCurPosition();break;case eH.GS_Tags:this._addGlobalStatement(r,t,i,a.lexeme.length),this._parseTags(r,t),i=t.getCurPosition();break;case eq.NOT_WORD:if("{"===a.lexeme)n+=1;else if("}"===a.lexeme&&0==(n-=1))return this._addGlobalStatement(r,t,i,a.lexeme.length),this._dropScope(),r;default:if(e._isRenderStateDeclarator(a)){this._addGlobalStatement(r,t,i,a.lexeme.length),this._parseRenderStateDeclarationOrAssignment(r,a,t),i=t.getCurPosition();break}e._isEngineType(a)&&(this._addGlobalStatement(r,t,i,a.lexeme.length),this._parseVariableDeclaration(a.type,t),i=t.getCurPosition())}}},e._parseTags=function(e,t){for(t.scanText("{");;){var r=t.scanToken();t.scanText("=");var n=t.scanPairedText('"','"');if(t.skipCommentsAndSpace(),e.tags[r.lexeme]=n,"}"===t.peek(1)){t._advance();return}t.scanText(",")}},e._parsePass=function(r){this._newScope();var n={globalContents:[],renderStates:{constantMap:{},variableMap:{}},tags:{}};n.name=r.scanPairedText('"','"'),r.scanText("{");var i=1;r.skipCommentsAndSpace();for(var a=r.getCurPosition();;){var o=r.scanToken();switch(o.type){case eH.GS_RenderQueueType:this._addGlobalStatement(n,r,a,o.lexeme.length),this._parseRenderQueueAssignment(n,r),a=r.getCurPosition();break;case eH.GS_Tags:this._addGlobalStatement(n,r,a,o.lexeme.length),this._parseTags(n,r),a=r.getCurPosition();break;case eH.GS_VertexShader:case eH.GS_FragmentShader:this._addGlobalStatement(n,r,a,o.lexeme.length),r.scanText("=");var s=r.scanToken();if(n[o.lexeme]){var c=e0.createGSError("reassign main entry",eZ.CompilationError,r.source,r.getCurPosition());throw t.Logger.error(c.toString()),c}n[o.type===eH.GS_VertexShader?"vertexEntry":"fragmentEntry"]=s.lexeme,r.scanText(";"),a=r.getCurPosition();break;case eq.NOT_WORD:if("{"===o.lexeme)i+=1;else if("}"===o.lexeme&&0==(i-=1))return this._addGlobalStatement(n,r,a,o.lexeme.length),this._dropScope(),n;default:if(e._isRenderStateDeclarator(o)){this._addGlobalStatement(n,r,a,o.lexeme.length),this._parseRenderStateDeclarationOrAssignment(n,o,r),a=r.getCurPosition();break}e._isEngineType(o)&&(this._addGlobalStatement(n,r,a,o.lexeme.length),this._parseVariableDeclaration(o.type,r),a=r.getCurPosition())}}},e}();t1._engineType={RenderQueueType:t.RenderQueueType,CompareFunction:t.CompareFunction,StencilOperation:t.StencilOperation,BlendOperation:t.BlendOperation,BlendFactor:t.BlendFactor,CullMode:t.CullMode},t1._errors=[],t1._symbolTableStack=new to;var t3=/*#__PURE__*/function(){function e(){this.errors=[]}var r=e.prototype;return r._parseShaderPass=function(r,i,a,o,s,c,u){tW.reset(t.ShaderLib,u);for(var l,p=n(o);!(l=p()).done;){var h=l.value;tW.addPredefinedMacro(h.name,h.value)}for(var _=0;_<c.length;_++)tW.addPredefinedMacro(c[_]);var d=performance.now(),f=tW.process(r);if(tU._errors.length>0){for(var S,g=n(tU._errors);!(S=g()).done;){var v=S.value;this.errors.push(v)}this._logErrors();return}t.Logger.info("[pass compilation - preprocessor] cost time "+(performance.now()-d)+"ms");var m=new e6(f).tokenize(),y=e._parser;e._processingPassText=f;for(var E,x=y.parse(m),C=n(y.errors);!(E=C()).done;){var T=E.value;this.errors.push(T)}if(!x){this._logErrors();return}var A=s===t.ShaderPlatformTarget.GLES100?tQ.getVisitor():tY.getVisitor(),b=performance.now(),O=A.visitShaderProgram(x,i,a);t.Logger.info("[CodeGen] cost time: "+(performance.now()-b)+"ms"),e._processingPassText=void 0;for(var I,P=n(A.errors);!(I=P()).done;){var L=I.value;this.errors.push(L)}return this._logErrors(),O},r._parseShaderContent=function(e){e0.clearAllShaderLabObjectPool(),t1.reset();var t=t1.parse(e);this.errors.length=0;for(var r,i=n(t1._errors);!(r=i()).done;){var a=r.value;this.errors.push(a)}return t},r._logErrors=function(){var e=this.errors;if(0!==e.length&&t.Logger.isEnabled){t.Logger.error(""+e.length+" errors occur!");for(var r,i=n(e);!(r=i()).done;){var a=r.value;t.Logger.error(a.toString())}}},e.createPosition=function(e,t,r){var n=this._shaderPositionPool.get();return n.set(e,t,r),n},e.createRange=function(e,t){var r=this._shaderRangePool.get();return r.set(e,t),r},e}();t3._parser=tL.create(),t3._shaderPositionPool=e0.createObjectPool(ej),t3._shaderRangePool=e0.createObjectPool(eW);var t4="1.6.0-alpha.1";console.log("Galacean Engine ShaderLab Version: "+t4+" | Mode: Verbose"),e.GSError=e$,e.GSErrorName=eZ,e.Preprocessor=tW,e.ShaderLab=t3,e.version=t4,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){(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 n(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,void 0)}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(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&&i(e,t)}function o(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function s(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 c(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),e}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,g,y,v,x,E,C,A,T,b,O,I,L,P,R,M,N,D,G,k,V,F,B,w,U,W,z,H,j,q,X,Q,Y,K,J,Z,$,ee,et,er,en,ei,ea,eo,es,ec,el,eu,ep,eh,e_,ef,ed,em,eS,eg,ey,ev,ex,eE,eC,eA,eT,eb,eO,eI,eL,eP,eR,eM,eN,eD,eG,ek,eV,eF,eB,ew,eU,eW,ez,eH,ej,eq,eX,eQ,eY,eK,eJ,eZ,e$,e0,e2,e1,e3,e4,e9,e5,e6,e7,e8,te,tt,tr=/*#__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}(),tn=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t,r){this.index=e,this.line=t,this.column=r},t.dispose=function(){this.index=0,this.line=0,this.column=0},e}(),ti=((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),ta=((p={})[p.CONST=0]="CONST",p[p.BOOL=1]="BOOL",p[p.FLOAT=2]="FLOAT",p[p.DOUBLE=3]="DOUBLE",p[p.INT=4]="INT",p[p.UINT=5]="UINT",p[p.BREAK=6]="BREAK",p[p.CONTINUE=7]="CONTINUE",p[p.DO=8]="DO",p[p.ELSE=9]="ELSE",p[p.FOR=10]="FOR",p[p.IF=11]="IF",p[p.WHILE=12]="WHILE",p[p.DISCARD=13]="DISCARD",p[p.RETURN=14]="RETURN",p[p.BVEC2=15]="BVEC2",p[p.BVEC3=16]="BVEC3",p[p.BVEC4=17]="BVEC4",p[p.IVEC2=18]="IVEC2",p[p.IVEC3=19]="IVEC3",p[p.IVEC4=20]="IVEC4",p[p.UVEC2=21]="UVEC2",p[p.UVEC3=22]="UVEC3",p[p.UVEC4=23]="UVEC4",p[p.VEC2=24]="VEC2",p[p.VEC3=25]="VEC3",p[p.VEC4=26]="VEC4",p[p.VEC4_ARRAY=27]="VEC4_ARRAY",p[p.MAT2=28]="MAT2",p[p.MAT3=29]="MAT3",p[p.MAT4=30]="MAT4",p[p.MAT2X3=31]="MAT2X3",p[p.MAT2X4=32]="MAT2X4",p[p.MAT3X2=33]="MAT3X2",p[p.MAT3X4=34]="MAT3X4",p[p.MAT4X2=35]="MAT4X2",p[p.MAT4X3=36]="MAT4X3",p[p.IN=37]="IN",p[p.OUT=38]="OUT",p[p.INOUT=39]="INOUT",p[p.CENTROID=40]="CENTROID",p[p.SAMPLER2D=41]="SAMPLER2D",p[p.SAMPLER3D=42]="SAMPLER3D",p[p.SAMPLER_CUBE=43]="SAMPLER_CUBE",p[p.SAMPLER2D_SHADOW=44]="SAMPLER2D_SHADOW",p[p.SAMPLER_CUBE_SHADOW=45]="SAMPLER_CUBE_SHADOW",p[p.SAMPLER2D_ARRAY=46]="SAMPLER2D_ARRAY",p[p.SAMPLER2D_ARRAY_SHADOW=47]="SAMPLER2D_ARRAY_SHADOW",p[p.I_SAMPLER2D=48]="I_SAMPLER2D",p[p.I_SAMPLER3D=49]="I_SAMPLER3D",p[p.I_SAMPLER_CUBE=50]="I_SAMPLER_CUBE",p[p.I_SAMPLER2D_ARRAY=51]="I_SAMPLER2D_ARRAY",p[p.U_SAMPLER2D=52]="U_SAMPLER2D",p[p.U_SAMPLER3D=53]="U_SAMPLER3D",p[p.U_SAMPLER_CUBE=54]="U_SAMPLER_CUBE",p[p.U_SAMPLER2D_ARRAY=55]="U_SAMPLER2D_ARRAY",p[p.STRUCT=56]="STRUCT",p[p.LAYOUT=57]="LAYOUT",p[p.LOCATION=58]="LOCATION",p[p.VOID=59]="VOID",p[p.PRECISION=60]="PRECISION",p[p.PRECISE=61]="PRECISE",p[p.HIGHP=62]="HIGHP",p[p.MEDIUMP=63]="MEDIUMP",p[p.LOWP=64]="LOWP",p[p.INVARIANT=65]="INVARIANT",p[p.SMOOTH=66]="SMOOTH",p[p.FLAT=67]="FLAT",p[p.NOPERSPECTIVE=68]="NOPERSPECTIVE",p[p.True=69]="True",p[p.False=70]="False",p[p.LeftBrace=71]="LeftBrace",p[p.RightBrace=72]="RightBrace",p[p.Equal=73]="Equal",p[p.GSRenderQueueType=74]="GSRenderQueueType",p[p.GSBlendState=75]="GSBlendState",p[p.GSDepthState=76]="GSDepthState",p[p.GSStencilState=77]="GSStencilState",p[p.GSRasterState=78]="GSRasterState",p[p.GSEditorProperties=79]="GSEditorProperties",p[p.GSEditorMacros=80]="GSEditorMacros",p[p.GSEditor=81]="GSEditor",p[p.GSTags=82]="GSTags",p[p.GSVertexShader=83]="GSVertexShader",p[p.GSFragmentShader=84]="GSFragmentShader",p[p.GSSubShader=85]="GSSubShader",p[p.GSPass=86]="GSPass",p[p.GSBlendFactor=87]="GSBlendFactor",p[p.GSBlendOperation=88]="GSBlendOperation",p[p.GSBool=89]="GSBool",p[p.GSNumber=90]="GSNumber",p[p.GSColor=91]="GSColor",p[p.GSCompareFunction=92]="GSCompareFunction",p[p.GSStencilOperation=93]="GSStencilOperation",p[p.GSCullMode=94]="GSCullMode",p[p.GSUsePass=95]="GSUsePass",p[p.MACRO_IF=96]="MACRO_IF",p[p.MACRO_IFDEF=97]="MACRO_IFDEF",p[p.MACRO_IFNDEF=98]="MACRO_IFNDEF",p[p.MACRO_ELSE=99]="MACRO_ELSE",p[p.MACRO_ELIF=100]="MACRO_ELIF",p[p.MACRO_ENDIF=101]="MACRO_ENDIF",p[p.MACRO_UNDEF=102]="MACRO_UNDEF",p[p.MACRO_DEFINE_EXPRESSION=103]="MACRO_DEFINE_EXPRESSION",p[p.MACRO_CONDITIONAL_EXPRESSION=104]="MACRO_CONDITIONAL_EXPRESSION",p[p.MACRO_CALL=105]="MACRO_CALL",p);function to(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(to=function(){return!!e})()}function ts(e,t,r){return(ts=to()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var a=new(Function.bind.apply(e,n));return r&&i(a,r.prototype),a}).apply(null,arguments)}function tc(e){return(tc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tl(e){var t="function"==typeof Map?new Map:void 0;return(tl=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 ts(e,arguments,tc(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(r,e)})(e)}var tu=/*#__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 a(t,e),t.prototype.toString=function(){var e,r,n=this.message,i=this.location,a=this.source;if(!a)return n;o(i,tn)?e=r=i:(e=i.start,r=i.end);for(var s=a.split("\n"),c=this.name+": "+n+"\n\n",l="|\xb7\xb7\xb7",u=t.wrappingLineCount,p=e.line-u,h=r.line+u;p<=h;p++){var _=s[p];if(c+=l+""+_+"\n",!(p<e.line)&&!(p>r.line)){var f=0,d=_.length,m=l.length;p===e.line&&(f=e.column,m+=e.column),p===r.line&&(d=r.column);var S=Math.max(d-f,1);c+=" ".repeat(m)+"^".repeat(S)+"\n"}}return c},t}(tl(Error));tu.wrappingLineCount=2;var tp=((h={}).PreprocessorError="PreprocessorError",h.CompilationError="CompilationError",h.ScannerError="ScannerError",h.CompilationWarn="CompilationWarning",h),th=/*#__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,t,r,n,i){return new tu(t,e,n,r,i)},e}();th._shaderLabObjectPoolSet=[];var t_=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t,r){if(this.type=e,this.lexeme=t,r){if(o(r,tr))this.location=r;else{var n=rc.createPosition(r.index+t.length,r.line,r.column+t.length);this.location=rc.createRange(r,n)}}},t.dispose=function(){},e}();t_.pool=th.createObjectPool(t_);var tf=new t_;tf.set(ti.EOF,"/EOF");var td=((_={})[_.START=2e3]="START",_[_.gs_shader_program=2001]="gs_shader_program",_[_.global_declaration=2002]="global_declaration",_[_.variable_declaration=2003]="variable_declaration",_[_.variable_declaration_list=2004]="variable_declaration_list",_[_.variable_declaration_statement=2005]="variable_declaration_statement",_[_.array_specifier_list=2006]="array_specifier_list",_[_.array_specifier=2007]="array_specifier",_[_.ext_builtin_type_specifier_nonarray=2008]="ext_builtin_type_specifier_nonarray",_[_.precision_specifier=2009]="precision_specifier",_[_.variable_identifier=2010]="variable_identifier",_[_.variable_identifier_node=2011]="variable_identifier_node",_[_.primary_expression=2012]="primary_expression",_[_.postfix_expression=2013]="postfix_expression",_[_.integer_expression=2014]="integer_expression",_[_.function_call=2015]="function_call",_[_.function_call_generic=2016]="function_call_generic",_[_.function_call_header_no_parameters=2017]="function_call_header_no_parameters",_[_.function_call_header_with_parameters=2018]="function_call_header_with_parameters",_[_.function_call_parameter_list=2019]="function_call_parameter_list",_[_.function_call_header=2020]="function_call_header",_[_.function_identifier=2021]="function_identifier",_[_.constructor_identifier=2022]="constructor_identifier",_[_.unary_expression=2023]="unary_expression",_[_.unary_operator=2024]="unary_operator",_[_.multiplicative_expression=2025]="multiplicative_expression",_[_.additive_expression=2026]="additive_expression",_[_.shift_expression=2027]="shift_expression",_[_.relational_expression=2028]="relational_expression",_[_.equality_expression=2029]="equality_expression",_[_.and_expression=2030]="and_expression",_[_.inclusive_or_expression=2031]="inclusive_or_expression",_[_.exclusive_or_expression=2032]="exclusive_or_expression",_[_.logical_and_expression=2033]="logical_and_expression",_[_.logical_xor_expression=2034]="logical_xor_expression",_[_.logical_or_expression=2035]="logical_or_expression",_[_.conditional_expression=2036]="conditional_expression",_[_.assignment_expression=2037]="assignment_expression",_[_.assignment_operator=2038]="assignment_operator",_[_.expression=2039]="expression",_[_.integer_constant_expression=2040]="integer_constant_expression",_[_.integer_constant_expression_operator=2041]="integer_constant_expression_operator",_[_.declaration=2042]="declaration",_[_.function_prototype=2043]="function_prototype",_[_.function_declarator=2044]="function_declarator",_[_.function_header_with_parameters=2045]="function_header_with_parameters",_[_.function_header=2046]="function_header",_[_.function_parameter_list=2047]="function_parameter_list",_[_.parameter_declarator=2048]="parameter_declarator",_[_.parameter_declaration=2049]="parameter_declaration",_[_.parameter_qualifier=2050]="parameter_qualifier",_[_.parameter_type_specifier=2051]="parameter_type_specifier",_[_.init_declarator_list=2052]="init_declarator_list",_[_.single_declaration=2053]="single_declaration",_[_.fully_specified_type=2054]="fully_specified_type",_[_.type_qualifier=2055]="type_qualifier",_[_.single_type_qualifier=2056]="single_type_qualifier",_[_.storage_qualifier=2057]="storage_qualifier",_[_.precision_qualifier=2058]="precision_qualifier",_[_.interpolation_qualifier=2059]="interpolation_qualifier",_[_.invariant_qualifier=2060]="invariant_qualifier",_[_.type_specifier=2061]="type_specifier",_[_.type_specifier_nonarray=2062]="type_specifier_nonarray",_[_.type_specifier_no_prec=2063]="type_specifier_no_prec",_[_.basic_type=2064]="basic_type",_[_.struct_specifier=2065]="struct_specifier",_[_.struct_declaration_list=2066]="struct_declaration_list",_[_.struct_declaration=2067]="struct_declaration",_[_.layout_qualifier=2068]="layout_qualifier",_[_.struct_declarator_list=2069]="struct_declarator_list",_[_.struct_declarator=2070]="struct_declarator",_[_.identifier_list=2071]="identifier_list",_[_.decl_identifier=2072]="decl_identifier",_[_.initializer=2073]="initializer",_[_.initializer_list=2074]="initializer_list",_[_.declaration_statement=2075]="declaration_statement",_[_.simple_statement=2076]="simple_statement",_[_.compound_statement_no_scope=2077]="compound_statement_no_scope",_[_.statement_with_scope=2078]="statement_with_scope",_[_.compound_statement=2079]="compound_statement",_[_.statement=2080]="statement",_[_.statement_list=2081]="statement_list",_[_.iteration_statement_no_new_scope=2082]="iteration_statement_no_new_scope",_[_.expression_statement=2083]="expression_statement",_[_.selection_statement=2084]="selection_statement",_[_.selection_rest_statement=2085]="selection_rest_statement",_[_.condition=2086]="condition",_[_.conditionopt=2087]="conditionopt",_[_.iteration_statement=2088]="iteration_statement",_[_.for_init_statement=2089]="for_init_statement",_[_.for_rest_statement=2090]="for_rest_statement",_[_.jump_statement=2091]="jump_statement",_[_.external_declaration=2092]="external_declaration",_[_.function_definition=2093]="function_definition",_[_.field_selection=2094]="field_selection",_[_.bool_constant=2095]="bool_constant",_[_.function_identifier_node=2096]="function_identifier_node",_[_.typename_identifier_node=2097]="typename_identifier_node",_[_.scope_brace=2098]="scope_brace",_[_.scope_end_brace=2099]="scope_end_brace",_[_.macro_undef=2100]="macro_undef",_[_.macro_push_context=2101]="macro_push_context",_[_.macro_pop_context=2102]="macro_pop_context",_[_.macro_elif_expression=2103]="macro_elif_expression",_[_.macro_else_expression=2104]="macro_else_expression",_[_.global_macro_if_statement=2105]="global_macro_if_statement",_[_.global_macro_declaration=2106]="global_macro_declaration",_[_.global_macro_branch=2107]="global_macro_branch",_[_.macro_struct_declaration=2108]="macro_struct_declaration",_[_.macro_struct_branch=2109]="macro_struct_branch",_[_.macro_if_statement=2110]="macro_if_statement",_[_.macro_branch=2111]="macro_branch",_[_.macro_param_case_list=2112]="macro_param_case_list",_[_.macro_param_block=2113]="macro_param_block",_[_.macro_parameter_branch=2114]="macro_parameter_branch",_[_.macro_call_arg_case_list=2115]="macro_call_arg_case_list",_[_.macro_call_arg_block=2116]="macro_call_arg_block",_[_.macro_call_arg_branch=2117]="macro_call_arg_branch",_[_.macro_call_symbol=2118]="macro_call_symbol",_[_.macro_call_function=2119]="macro_call_function",_[_._ignore=2120]="_ignore",_),tm=function e(t,r){this.goal=t,this.derivation=r,this.id=e._id++,e.pool.set(this.id,this)};tm._id=0,tm.pool=new Map;var tS=((f={})[f.Shift=0]="Shift",f[f.Reduce=1]="Reduce",f[f.Accept=2]="Accept",f),tg=/*#__PURE__*/function(){function e(){}return e.isTerminal=function(e){return e<td.START},e.toString=function(e){if(this.isTerminal(e)){var t;return null!=(t=ti[e])?t:ta[e]}return td[e]},e.createProductionWithOptions=function(e,t,r){for(var i,a=[],o=n(t);!(i=o()).done;){var s=i.value;a.push([[].concat([e],s),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=rc.createRange(a,o);tt.get(null!=r?r:tt.TrivialNode.pool,e,s,n)}}])}return a},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,i=n(e);!(r=i()).done;){var a=r.value;if(!t.has(a))return!1}return!0},e.isActionEqual=function(e,t){return e.action===t.action&&e.target===t.target},e.printAction=function(e){var t=tm.pool.get(e.target);return"<Action: "+tS[e.action]+" -> "+this.printProduction(t)+">"},e.printProduction=function(t){var r=t.derivation.map(function(t){return e.toString(t)}).join("|");return td[t.goal]+" :=> "+r},e}(),ty=/*#__PURE__*/function(){function e(t,r,i){this._needReInfer=!0,this.production=t,this.position=r,this.lookaheadSet=new Set;for(var a,o=n(i);!(a=o()).done;){var s=a.value;this.lookaheadSet.add(s)}this.id=e._id++}var t=e.prototype;return t.addLookahead=function(e){for(var t,r=n(e);!(t=r()).done;){var i=t.value;this.lookaheadSet.has(i)||(this.lookaheadSet.add(i),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]!==ti.EPSILON)return!1;return!0},t.advance=function(){if(this.canReduce())throw"Error: advance reduce-able parsing state item";return new e(this.production,this.position+1,this.lookaheadSet)},t.toString=function(){var e,t=this.production.derivation.map(function(e){return tg.toString(e)});return t[this.position]="."+(null!=(e=t[this.position])?e:""),td[this.production.goal]+" :=> "+t.join("|")+" ;"+Array.from(this.lookaheadSet).map(function(e){return tg.toString(e)}).join("/")},c(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}();ty._id=0;var tv=/*#__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,i=n(t);!(r=i()).done;){var a=r.value,o=this.getStateItemMapKey(a.production,a.position);this._stateItemPool.set(o,a)}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 i=this.getStateItemMapKey(e,t),a=this._stateItemPool.get(i);if(a){for(var o,s=n(r);!(o=s()).done;){var c=o.value;a.lookaheadSet.has(c)||(a.lookaheadSet.add(c),a.needReInfer=!0)}return a}var l=new ty(e,t,r);return this._stateItemPool.set(i,l),l},e.create=function(t){var r=this.getMapKey(t),i=this.closureMap.get(r);if(i){for(var a,o=n(t);!(a=o()).done;){var s=a.value;i.createStateItem(s.production,s.position,s.lookaheadSet)}return i}var c=new e(t);return this.closureMap.set(r,c),c},e.getMapKey=function(e){return e.map(function(e){return e.production.id+","+e.position}).join(";")},c(e,[{key:"items",get:function(){return this._items}},{key:"needReInfer",get:function(){for(var e,t=n(this.cores);!(e=t()).done;)if(e.value.needReInfer)return!0;return!1}}]),e}();tv.closureMap=new Map,tv.pool=new Map,tv._id=0;var tx=/*#__PURE__*/function(){function e(){}return e.unwrapNodeByType=function(t,r){var n=t.children[0];if(!o(n,t_))return n.nt===r?n:e.unwrapNodeByType(n,r)},e.typeCompatible=function(e,t){return void 0==t||3e3===t||(e===ta.INT?e===t||t===ta.UINT:e===t)},e.toString=function(e){if(this.isTerminal(e)){var t;return null!=(t=ti[e])?t:ta[e]}return td[e]},e.isTerminal=function(e){return e<td.START},e.printStatePool=function(e){var t="";console.log("========== Parser Pool ==========");for(var r,i=0,a=n(tv.pool.values());!(r=a()).done;){var o=r.value;i++;var s="";s+=(""+o.id+": \n").padEnd(4);for(var c,l=n(o.items);!(c=l()).done;)s+=" "+c.value.toString()+"\n";t+=s}console.log("state count:",i),console.log(t)},e}(),tE=/*#__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,r,n){n.length=0;var i=e[r];if(i)for(var a=0;a<i.length;a++){var o=i[a],s=o.valueType;if(2===s||1===s){var c=2===s?o.functionCallName:o.value;if(-1!==o.params.indexOf(c))continue;-1===n.indexOf(c)&&n.push(c)}else 3===s&&t.Logger.warn('Warning: Macro "'+o.name+'" has an unrecognized value "'+o.value+'". ShaderLab does not validate this type.')}},e._isNumber=function(e){return!isNaN(Number(e))},e._isExist=function(e,t){return e.some(function(e){return e.valueType===t.valueType&&e.value===t.value&&e.isFunction===t.isFunction&&e.functionCallName===t.functionCallName&&e.params.length===t.params.length&&e.params.every(function(e,r){return e===t.params[r]})})},e._parseMacroDefines=function(e,t){var r;for(this._macroRegex.lastIndex=0;null!==(r=this._macroRegex.exec(e));){var n=r[1],i=r[2],a=r[3],o=r[4],s=!!i&&!!o,c=s&&a?a.split(",").map(function(e){return e.trim()}).filter(Boolean):[],l=o?o.trim():"",u=3,p="";if(this._isNumber(l))u=0;else if(this._symbolReg.test(l))u=1;else{var h=this._funcCallReg.exec(l);h&&(u=2,p=h[1])}var _={isFunction:s,name:n,value:l,valueType:u,params:c,functionCallName:p},f=t[n];f?this._isExist(f,_)||f.push(_):t[n]=[_]}},e._mergeMacroDefineLists=function(e,t){for(var r in e)if(t[r])for(var n=t[r],i=e[r],a=0;a<i.length;a++){var o=i[a];this._isExist(n,o)||n.push(o)}else t[r]=e[r]},e._replace=function(e,r,n){i="."===e[0]?new URL(e,r).href.substring(t.ShaderPass._shaderRootPath.length):e;var i,a=t.ShaderLib[i];if(!a)return t.Logger.error('Shader slice "'+i+'" not founded.'),"";if(this._repeatIncludeSet.has(i)&&t.Logger.warn('Shader slice "'+i+'" is included multiple times.'),this._repeatIncludeSet.add(i),this._macroDefineIncludeMap.has(i))this._mergeMacroDefineLists(this._macroDefineIncludeMap.get(i),n);else{var o={};this._parseMacroDefines(a,o),this._macroDefineIncludeMap.set(i,o),this._mergeMacroDefineLists(o,n)}return this.parse(a,r,n,!1)},e}();tE._includeReg=/^[ \t]*#include +"([\w\d./]+)"/gm,tE._macroRegex=/^\s*#define\s+(\w+)[ ]*(\(([^)]*)\))?[ ]+(\(?\w+\)?.*?)(?:\/\/.*|\/\*.*?\*\/)?\s*$/gm,tE._symbolReg=/^[a-zA-Z_][a-zA-Z0-9_]*$/,tE._funcCallReg=/^([a-zA-Z_][a-zA-Z0-9_]*)\s*\((.*)\)$/,tE._macroDefineIncludeMap=new Map,tE._repeatIncludeSet=new Set;var tC=((d={})[d.VERTEX=0]="VERTEX",d[d.FRAGMENT=1]="FRAGMENT",d[d.ALL=2]="ALL",d);function tA(e){return e>=200&&e<=213}var tT=new Map,tb=/*#__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 tA(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=ts(e,[].concat([t,r,tC.ALL],a)),c=null!=(n=tT.get(t))?n:[];c.push(s),tT.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=ts(e,[].concat([t,r,n],o)),l=null!=(i=tT.get(t))?i:[];l.push(c),tT.set(t,l)},e.getFn=function(e,t){var r=tT.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(tA(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!!tT.get(e)},c(e,[{key:"realReturnType",get:function(){return this._realReturnType}}]),e}();tb._create("radians",200,200),tb._create("degrees",200,200),tb._create("sin",200,200),tb._create("cos",200,200),tb._create("tan",200,200),tb._create("asin",200,200),tb._create("acos",200,200),tb._create("atan",200,200,200),tb._create("atan",200,200),tb._create("sinh",200,200),tb._create("cosh",200,200),tb._create("tanh",200,200),tb._create("asinh",200,200),tb._create("acosh",200,200),tb._create("atanh",200,200),tb._create("pow",200,200,200),tb._create("exp",200,200),tb._create("log",200,200),tb._create("exp2",200,200),tb._create("log2",200,200),tb._create("sqrt",200,200),tb._create("inversesqrt",200,200),tb._create("abs",200,200),tb._create("abs",201,201),tb._create("sign",200,200),tb._create("sign",201,201),tb._create("floor",200,200),tb._create("trunc",200,200),tb._create("round",200,200),tb._create("roundEven",200,200),tb._create("ceil",200,200),tb._create("fract",200,200),tb._create("mod",200,200,ta.FLOAT),tb._create("mod",200,200,200),tb._create("min",200,200,200),tb._create("min",200,200,ta.FLOAT),tb._create("min",201,201,201),tb._create("min",201,201,ta.INT),tb._create("min",202,202,202),tb._create("min",202,202,ta.UINT),tb._create("max",200,200,200),tb._create("max",200,200,ta.FLOAT),tb._create("max",201,201,201),tb._create("max",201,201,ta.INT),tb._create("clamp",200,200,200,200),tb._create("clamp",200,200,ta.FLOAT,ta.FLOAT),tb._create("clamp",201,201,201,201),tb._create("clamp",201,201,ta.INT,ta.INT),tb._create("clamp",202,202,202,202),tb._create("clamp",202,202,ta.UINT,ta.UINT),tb._create("mix",200,200,200,200),tb._create("mix",200,200,200,ta.FLOAT),tb._create("mix",200,200,200,203),tb._create("step",200,200,200),tb._create("step",200,ta.FLOAT,200),tb._create("smoothstep",200,200,200,200),tb._create("smoothstep",200,ta.FLOAT,ta.FLOAT,200),tb._create("isnan",203,200),tb._create("isinf",203,200),tb._create("floatBitsToInt",200,200),tb._create("floatBitsToUint",202,200),tb._create("intBitsToFloat",200,201),tb._create("uintBitsToFloat",200,202),tb._create("packSnorm2x16",ta.UINT,ta.VEC2),tb._create("unpackSnorm2x16",ta.VEC2,ta.UINT),tb._create("packUnorm2x16",ta.UINT,ta.VEC2),tb._create("unpackUnorm2x16",ta.VEC2,ta.UINT),tb._create("packHalf2x16",ta.UINT,ta.VEC2),tb._create("unpackHalf2x16",ta.VEC2,ta.UINT),tb._create("length",ta.FLOAT,200),tb._create("distance",ta.FLOAT,200,200),tb._create("dot",ta.FLOAT,200,200),tb._create("cross",ta.VEC3,ta.VEC3,ta.VEC3),tb._create("normalize",200,200),tb._create("faceforward",200,200,200,200),tb._create("reflect",200,200,200),tb._create("refract",200,200,200,ta.FLOAT),tb._create("matrixCompMult",204,204,204),tb._create("outerProduct",ta.MAT2,ta.VEC2,ta.VEC2),tb._create("outerProduct",ta.MAT3,ta.VEC3,ta.VEC3),tb._create("outerProduct",ta.MAT4,ta.VEC4,ta.VEC4),tb._create("outerProduct",ta.MAT2X3,ta.VEC3,ta.VEC2),tb._create("outerProduct",ta.MAT3X2,ta.VEC2,ta.VEC3),tb._create("outerProduct",ta.MAT2X4,ta.VEC4,ta.VEC2),tb._create("outerProduct",ta.MAT4X2,ta.VEC2,ta.VEC4),tb._create("outerProduct",ta.MAT3X4,ta.VEC4,ta.VEC3),tb._create("outerProduct",ta.MAT4X3,ta.VEC3,ta.VEC4),tb._create("transpose",ta.MAT2,ta.MAT2),tb._create("transpose",ta.MAT3,ta.MAT3),tb._create("transpose",ta.MAT4,ta.MAT4),tb._create("transpose",ta.MAT2X3,ta.MAT3X2),tb._create("transpose",ta.MAT3X2,ta.MAT2X3),tb._create("transpose",ta.MAT4X2,ta.MAT2X4),tb._create("transpose",ta.MAT2X4,ta.MAT4X2),tb._create("transpose",ta.MAT3X4,ta.MAT4X3),tb._create("transpose",ta.MAT4X3,ta.MAT3X4),tb._create("determinant",ta.FLOAT,ta.MAT2),tb._create("determinant",ta.FLOAT,ta.MAT3),tb._create("determinant",ta.FLOAT,ta.MAT4),tb._create("inverse",ta.MAT2,ta.MAT2),tb._create("inverse",ta.MAT3,ta.MAT3),tb._create("inverse",ta.MAT4,ta.MAT4),tb._create("lessThan",205,208,208),tb._create("lessThan",205,206,206),tb._create("lessThan",205,207,207),tb._create("lessThanEqual",205,208,208),tb._create("lessThanEqual",205,206,206),tb._create("lessThanEqual",205,207,207),tb._create("greaterThan",205,208,208),tb._create("greaterThan",205,206,206),tb._create("greaterThan",205,207,207),tb._create("greaterThanEqual",205,208,208),tb._create("greaterThanEqual",205,206,206),tb._create("greaterThanEqual",205,207,207),tb._create("equal",205,208,208),tb._create("equal",205,206,206),tb._create("equal",205,207,207),tb._create("equal",205,205,205),tb._create("notEqual",205,208,208),tb._create("notEqual",205,206,206),tb._create("notEqual",205,207,207),tb._create("notEqual",205,205,205),tb._create("any",ta.BOOL,205),tb._create("all",ta.BOOL,205),tb._create("not",205,205),tb._create("textureSize",ta.IVEC2,210,ta.INT),tb._create("textureSize",ta.IVEC3,211,ta.INT),tb._create("textureSize",ta.IVEC2,212,ta.INT),tb._create("textureSize",ta.IVEC2,ta.SAMPLER2D_SHADOW,ta.INT),tb._create("textureSize",ta.IVEC2,ta.SAMPLER_CUBE_SHADOW,ta.INT),tb._create("textureSize",ta.IVEC3,213,ta.INT),tb._create("textureSize",ta.IVEC3,ta.SAMPLER2D_ARRAY_SHADOW,ta.INT),tb._create("texture2D",ta.VEC4,ta.SAMPLER2D,ta.VEC2),tb._create("texture2D",ta.VEC4,ta.SAMPLER2D,ta.VEC2,ta.FLOAT),tb._create("texture",209,210,ta.VEC2,ta.FLOAT),tb._create("texture",209,210,ta.VEC2),tb._create("texture",209,211,ta.VEC3,ta.FLOAT),tb._create("texture",209,211,ta.VEC3),tb._create("texture",209,212,ta.VEC3,ta.FLOAT),tb._create("texture",209,212,ta.VEC3),tb._create("texture",ta.FLOAT,ta.SAMPLER2D_SHADOW,ta.VEC3,ta.FLOAT),tb._create("texture",ta.FLOAT,ta.SAMPLER2D_SHADOW,ta.VEC3),tb._create("texture",ta.FLOAT,ta.SAMPLER_CUBE_SHADOW,ta.VEC4,ta.FLOAT),tb._create("texture",ta.FLOAT,ta.SAMPLER_CUBE_SHADOW,ta.VEC4),tb._create("texture",209,ta.SAMPLER2D_ARRAY,ta.VEC3,ta.FLOAT),tb._create("texture",209,ta.SAMPLER2D_ARRAY,ta.VEC3),tb._create("texture",ta.FLOAT,ta.SAMPLER2D_ARRAY_SHADOW,ta.VEC4),tb._create("textureProj",209,210,ta.VEC3,ta.FLOAT),tb._create("textureProj",209,210,ta.VEC3),tb._create("textureProj",209,210,ta.VEC4,ta.FLOAT),tb._create("textureProj",209,210,ta.VEC4),tb._create("textureProj",209,211,ta.VEC4,ta.FLOAT),tb._create("textureProj",209,211,ta.VEC4),tb._create("textureProj",ta.FLOAT,ta.SAMPLER2D_SHADOW,ta.VEC4,ta.FLOAT),tb._create("textureProj",ta.FLOAT,ta.SAMPLER2D_SHADOW,ta.VEC4),tb._create("textureLod",209,210,ta.VEC2,ta.FLOAT),tb._create("textureLod",209,211,ta.VEC3,ta.FLOAT),tb._create("textureLod",209,212,ta.VEC3,ta.FLOAT),tb._create("textureLod",ta.FLOAT,ta.SAMPLER2D_SHADOW,ta.VEC3,ta.FLOAT),tb._create("textureLod",209,213,ta.VEC3,ta.FLOAT),tb._create("texture2DLodEXT",209,210,ta.VEC2,ta.FLOAT),tb._create("texture2DLodEXT",209,211,ta.VEC3,ta.FLOAT),tb._create("textureCube",ta.SAMPLER_CUBE,ta.VEC3),tb._create("textureCube",ta.SAMPLER_CUBE,ta.VEC3,ta.FLOAT),tb._create("textureCube",209,212,ta.VEC3,ta.FLOAT),tb._create("textureCubeLod",ta.SAMPLER_CUBE,ta.VEC3,ta.FLOAT),tb._create("textureCubeLodEXT",209,212,ta.VEC3,ta.FLOAT),tb._create("textureOffset",209,210,ta.VEC2,ta.IVEC2,ta.FLOAT),tb._create("textureOffset",209,210,ta.VEC2,ta.IVEC2),tb._create("textureOffset",209,211,ta.VEC3,ta.IVEC3,ta.FLOAT),tb._create("textureOffset",209,211,ta.VEC3,ta.IVEC3),tb._create("textureOffset",ta.FLOAT,ta.SAMPLER2D_SHADOW,ta.VEC3,ta.IVEC2,ta.FLOAT),tb._create("textureOffset",ta.FLOAT,ta.SAMPLER2D_SHADOW,ta.VEC3,ta.IVEC2),tb._create("textureOffset",209,213,ta.VEC3,ta.IVEC2,ta.FLOAT),tb._create("textureOffset",209,213,ta.VEC3,ta.IVEC2),tb._create("texelFetch",209,210,ta.IVEC2,ta.INT),tb._create("texelFetch",209,211,ta.IVEC3,ta.INT),tb._create("texelFetch",209,213,ta.IVEC3,ta.INT),tb._create("texelFetchOffset",209,210,ta.IVEC2,ta.INT,ta.IVEC2),tb._create("texelFetchOffset",209,211,ta.IVEC3,ta.INT,ta.IVEC3),tb._create("texelFetchOffset",209,213,ta.IVEC3,ta.INT,ta.IVEC2),tb._create("textureProjOffset",209,210,ta.VEC3,ta.IVEC2,ta.FLOAT),tb._create("textureProjOffset",209,210,ta.VEC3,ta.IVEC2),tb._create("textureProjOffset",209,210,ta.VEC4,ta.IVEC2,ta.FLOAT),tb._create("textureProjOffset",209,210,ta.VEC4,ta.IVEC2),tb._create("textureProjOffset",209,211,ta.VEC4,ta.IVEC3,ta.FLOAT),tb._create("textureProjOffset",209,211,ta.VEC4,ta.IVEC3),tb._create("textureProjOffset",ta.FLOAT,ta.SAMPLER2D_SHADOW,ta.VEC4,ta.IVEC2,ta.FLOAT),tb._create("textureProjOffset",ta.FLOAT,ta.SAMPLER2D_SHADOW,ta.VEC4,ta.IVEC2),tb._create("textureLodOffset",209,210,ta.VEC2,ta.FLOAT,ta.IVEC2),tb._create("textureLodOffset",209,211,ta.VEC3,ta.FLOAT,ta.IVEC3),tb._create("textureLodOffset",ta.FLOAT,ta.SAMPLER2D_SHADOW,ta.VEC3,ta.FLOAT,ta.IVEC2),tb._create("textureLodOffset",209,213,ta.VEC3,ta.FLOAT,ta.IVEC2),tb._create("textureProjLod",209,210,ta.VEC3,ta.FLOAT),tb._create("textureProjLod",209,210,ta.VEC4,ta.FLOAT),tb._create("textureProjLod",209,211,ta.VEC4,ta.FLOAT),tb._create("textureProjLod",ta.FLOAT,ta.SAMPLER2D_SHADOW,ta.VEC4,ta.FLOAT),tb._create("textureProjLodOffset",209,210,ta.VEC3,ta.FLOAT,ta.IVEC2),tb._create("textureProjLodOffset",209,210,ta.VEC4,ta.FLOAT,ta.IVEC2),tb._create("textureProjLodOffset",209,211,ta.VEC4,ta.FLOAT,ta.IVEC3),tb._create("textureProjLodOffset",ta.FLOAT,ta.SAMPLER2D_SHADOW,ta.VEC4,ta.FLOAT,ta.IVEC2),tb._create("textureGrad",209,210,ta.VEC2,ta.VEC2,ta.VEC2),tb._create("textureGrad",209,211,ta.VEC3,ta.VEC3,ta.VEC3),tb._create("textureGrad",209,212,ta.VEC3,ta.VEC3,ta.VEC3),tb._create("textureGrad",ta.FLOAT,ta.SAMPLER2D_SHADOW,ta.VEC3,ta.VEC2,ta.VEC2),tb._create("textureGrad",ta.FLOAT,ta.SAMPLER_CUBE_SHADOW,ta.VEC4,ta.VEC3,ta.VEC3),tb._create("textureGrad",209,213,ta.VEC3,ta.VEC2,ta.VEC2),tb._create("textureGrad",ta.FLOAT,ta.SAMPLER2D_ARRAY_SHADOW,ta.VEC4,ta.VEC2,ta.VEC2),tb._create("textureGradOffset",209,210,ta.VEC2,ta.VEC2,ta.VEC2,ta.IVEC2),tb._create("textureGradOffset",209,211,ta.VEC3,ta.VEC3,ta.VEC3,ta.IVEC3),tb._create("textureGradOffset",ta.FLOAT,ta.SAMPLER2D_SHADOW,ta.VEC3,ta.VEC2,ta.VEC2,ta.IVEC2),tb._create("textureGradOffset",209,213,ta.VEC3,ta.VEC2,ta.VEC2,ta.IVEC2),tb._create("textureGradOffset",ta.FLOAT,ta.SAMPLER2D_ARRAY_SHADOW,ta.VEC3,ta.VEC2,ta.VEC2,ta.IVEC2),tb._create("textureProjGrad",209,210,ta.VEC3,ta.VEC2,ta.VEC2),tb._create("textureProjGrad",209,210,ta.VEC4,ta.VEC2,ta.VEC2),tb._create("textureProjGrad",209,211,ta.VEC4,ta.VEC3,ta.VEC3),tb._create("textureProjGrad",ta.FLOAT,ta.SAMPLER2D_SHADOW,ta.VEC4,ta.VEC2,ta.VEC2),tb._create("textureProjGradOffset",209,210,ta.VEC3,ta.VEC2,ta.VEC2,ta.IVEC2),tb._create("textureProjGradOffset",209,210,ta.VEC4,ta.VEC2,ta.VEC2,ta.IVEC2),tb._create("textureProjGradOffset",209,211,ta.VEC4,ta.VEC3,ta.VEC3,ta.IVEC3),tb._create("textureProjGradOffset",ta.FLOAT,ta.SAMPLER2D_SHADOW,ta.VEC4,ta.VEC2,ta.VEC2,ta.IVEC2),tb._createWithScop("dFdx",200,tC.FRAGMENT,200),tb._createWithScop("dFdy",200,tC.FRAGMENT,200),tb._createWithScop("fwidth",200,tC.FRAGMENT,200);var tO=new Map,tI=/*#__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=tC.ALL);var i=new e(r,t,n);tO.set(t,i)},e.getVar=function(e){return tO.get(e)},e}();tI.createVariable("gl_VertexID",ta.INT,tC.VERTEX),tI.createVariable("gl_InstanceID",ta.INT,tC.VERTEX),tI.createVariable("gl_Position",ta.VEC4,tC.VERTEX),tI.createVariable("gl_PointSize",ta.FLOAT,tC.VERTEX),tI.createVariable("gl_FragCoord",ta.VEC4,tC.FRAGMENT),tI.createVariable("gl_FrontFacing",ta.BOOL,tC.FRAGMENT),tI.createVariable("gl_FragDepth",ta.FLOAT,tC.FRAGMENT),tI.createVariable("gl_PointCoord",ta.VEC2,tC.FRAGMENT),tI.createVariable("gl_FragColor",ta.VEC4,tC.FRAGMENT),tI.createVariable("gl_FragData",ta.VEC4_ARRAY,tC.FRAGMENT),tI.createVariable("gl_MaxVertexAttribs",ta.INT),tI.createVariable("gl_MaxVertexUniformVectors",ta.INT),tI.createVariable("gl_MaxVertexOutputVectors",ta.INT),tI.createVariable("gl_MaxFragmentInputVectors",ta.INT),tI.createVariable("gl_MaxVertexTextureImageUnits",ta.INT),tI.createVariable("gl_MaxCombinedTextureImageUnits",ta.INT),tI.createVariable("gl_MaxTextureImageUnits",ta.INT),tI.createVariable("gl_MaxFragmentUniformVectors",ta.INT),tI.createVariable("gl_MaxDrawBuffers",ta.INT),tI.createVariable("gl_MinProgramTexelOffset",ta.INT),tI.createVariable("gl_MaxProgramTexelOffset",ta.INT);var tL=/*#__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}(),tP=/*#__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},c(e,[{key:"scope",get:function(){return this.stack[this.stack.length-1]}},{key:"isInMacroBranch",get:function(){return this._macroLevel>0}}]),e}(),tR=function(e,t,r){this.type=e,this.typeLexeme=t,this.arraySpecifier=r},tM=((m={})[m.VAR=0]="VAR",m[m.FN=1]="FN",m[m.STRUCT=2]="STRUCT",m[m.Any=3]="Any",m),tN=/*#__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}(),tD=/*#__PURE__*/function(e){function t(t,r){var n=new tR(r.protoType.returnType.type,r.protoType.returnType.typeSpecifier.lexeme);return e.call(this,t,tM.FN,r,n)||this}return a(t,e),t}(tN),tG=/*#__PURE__*/function(e){function t(t,r){return e.call(this,t,tM.STRUCT,r)||this}return a(t,e),t}(tN),tk=/*#__PURE__*/function(e){function t(t,r,n,i){var a;return(a=e.call(this,t,tM.VAR,i,r)||this).isGlobalVariable=n,a}return a(t,e),t}(tN),tV=/*#__PURE__*/function(){function e(){this.globalPrecisions=[],this.globalMacroDeclarations=[]}return e.prototype.getOuterGlobalMacroDeclarations=function(){return this.globalMacroDeclarations.filter(function(e){return o(e.parent,tt.GLShaderProgram)})},e}(),tF=/*#__PURE__*/function(){function e(){this.semanticStack=[],this.acceptRule=void 0,this.symbolTableStack=new tP,this.curFunctionInfo={},this._shaderData=new tV,this._translationRuleTable=new Map,this.errors=[],this.pushScope()}var r=e.prototype;return r.reset=function(e){this._macroDefineList=e,this.semanticStack.length=0,this._shaderData=new tV,this.symbolTableStack.clear(),this.pushScope(),this.errors.length=0},r.pushScope=function(){this.symbolTableStack.pushScope(new tL)},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,t){this.errors.push(new tu(tp.CompilationError,t,e,rc._processingPassText))},r.reportWarning=function(e,r){t.Logger.warn(new tu(tp.CompilationWarn,r,e,rc._processingPassText).toString())},c(e,[{key:"shaderData",get:function(){return this._shaderData}},{key:"macroDefineList",get:function(){return this._macroDefineList}}]),e}();tF._lookupSymbol=new tN("",null);var tB=function(e,t,r){this.type=e,this.typeLexeme=t,this.arraySpecifier=r},tw=function(e,t,r,n){void 0===n&&(n=!1),this.typeInfo=e,this.ident=t,this.mrtIndex=r,this.isInMacroBranch=n};function tU(e){return function(t){t.prototype.nt=e,t.pool=th.createObjectPool(t)}}var tW=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(t,r){this._location=t,this._children=r;for(var i,a=n(r);!(i=a()).done;){var s=i.value;o(s,e)&&(s._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){},c(e,[{key:"parent",get:function(){return this._parent}},{key:"children",get:function(){return this._children}},{key:"location",get:function(){return this._location}}]),e}();(S=tt||(tt={}))._unwrapToken=function(e){if(o(e,t_))return e;throw"not token"},S.get=function(e,t,r,n){var i=e.get();i.set(r,n),i.semanticAnalyze(t),t.semanticStack.push(i)},g=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.TrivialNode=g,g=l([tU(td._ignore)],g),y=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.pushScope()},t}(tW),S.ScopeBrace=y,y=l([tU(td.scope_brace)],y),v=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.popScope()},t}(tW),S.ScopeEndBrace=v,v=l([tU(td.scope_end_brace)],v),x=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.isFragReturnStatement=!1},r.semanticAnalyze=function(e){S._unwrapToken(this.children[0]).type===ta.RETURN&&(e.curFunctionInfo.returnStatement=this)},r.codeGen=function(e){return this.setCache(e.visitJumpStatement(this))},t}(tW),S.JumpStatement=x,x=l([tU(td.jump_statement)],x),E=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.ConditionOpt=E,E=l([tU(td.conditionopt)],E),C=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.ForRestStatement=C,C=l([tU(td.for_rest_statement)],C),A=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.Condition=A,A=l([tU(td.condition)],A),T=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.ForInitStatement=T,T=l([tU(td.for_init_statement)],T),b=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.IterationStatement=b,b=l([tU(td.iteration_statement)],b),O=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.SelectionStatement=O,O=l([tU(td.selection_statement)],O),I=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.ExpressionStatement=I,I=l([tU(td.expression_statement)],I),L=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){this._type=void 0},c(t,[{key:"type",get:function(){var e;return null!=(e=this._type)?e:3e3},set:function(e){this._type=e}}]),t}(tW),S.ExpressionAstNode=L,P=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];this.type=t.type},t}(L),S.InitializerList=P,P=l([tU(td.initializer_list)],P),R=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=this.children[1].type},t}(L),S.Initializer=R,R=l([tU(td.initializer)],R),M=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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 tB(i.type,a.lexeme,this.arraySpecifier),c=r[3];t=new tk(o.lexeme,s,!1,c)}else{var l=r[2];l&&this.arraySpecifier&&e.reportError(l.location,"Array of array is not supported."),this.arraySpecifier=l;var u=new tB(i.type,a.lexeme,this.arraySpecifier),p=r[4];t=new tk(o.lexeme,u,!1,p)}e.symbolTableStack.insert(t)},r.codeGen=function(e){return this.setCache(e.visitSingleDeclaration(this))},t}(tW),S.SingleDeclaration=M,M=l([tU(td.single_declaration)],M),N=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(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}(tW),S.FullySpecifiedType=N,N=l([tU(td.fully_specified_type)],N),D=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.TypeQualifier=D,D=l([tU(td.type_qualifier)],D),G=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];o(t,t_)?this.qualifier=t.type:this.qualifier=t.qualifier,this.lexeme=t.lexeme},t}(tW),S.SingleTypeQualifier=G,G=l([tU(td.single_type_qualifier)],G),V=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(k=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];this.qualifier=t.type,this.lexeme=t.lexeme},t}(tW)),S.StorageQualifier=V,V=l([tU(td.storage_qualifier)],V),F=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(k),S.PrecisionQualifier=F,F=l([tU(td.precision_qualifier)],F),B=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(k),S.InterpolationQualifier=B,B=l([tU(td.interpolation_qualifier)],B),w=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(k),S.InvariantQualifier=w,w=l([tU(td.invariant_qualifier)],w),U=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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},c(t,[{key:"arraySpecifier",get:function(){return this.children[1]}}]),t}(tW),S.TypeSpecifier=U,U=l([tU(td.type_specifier)],U),W=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[1];this.size=t.value},t}(tW),S.ArraySpecifier=W,W=l([tU(td.array_specifier)],W),z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];switch(this.lexeme=t.lexeme,t.type){case ti.PLUS:this.compute=function(e,t){return e+t};break;case ti.DASH:this.compute=function(e,t){return e-t};break;case ti.STAR:this.compute=function(e,t){return e*t};break;case ti.SLASH:this.compute=function(e,t){return e/t};break;case ti.PERCENT:this.compute=function(e,t){return e%t};break;default:e.reportError(t.location,"not implemented operator "+t.lexeme)}},t}(tW),S.IntegerConstantExpressionOperator=z,z=l([tU(td.integer_constant_expression_operator)],z),H=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.value=void 0},r.semanticAnalyze=function(e){if(1===this.children.length){var t=this.children[0];if(o(t,t_))this.value=Number(t.lexeme);else if(!tx.typeCompatible(ta.INT,t.typeInfo)){e.reportError(t.location,"Invalid integer.");return}}},t}(tW),S.IntegerConstantExpression=H,H=l([tU(td.integer_constant_expression)],H),j=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){var e=this.children[0];o(e,t_)?this.type=e.lexeme:this.type=e.type,this.lexeme=e.lexeme},t}(tW),S.TypeSpecifierNonArray=j,j=l([tU(td.type_specifier_nonarray)],j),q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){var e=this.children[0];this.type=e.type,this.lexeme=e.lexeme},t}(tW),S.ExtBuiltinTypeSpecifierNonArray=q,q=l([tU(td.ext_builtin_type_specifier_nonarray)],q),X=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(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 tB(a.type,a.lexeme,o)}else{var s=r[0];this.typeInfo=s.typeInfo}if(3===n||5===n)t=new tk(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&&e.reportError(l.location,"Array of array is not supported."),c.arraySpecifier=l,t=new tk(r[2].lexeme,c,!1,this),e.symbolTableStack.insert(t)}},t}(tW),S.InitDeclaratorList=X,X=l([tU(td.init_declarator_list)],X),Q=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.idList=[],t}a(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}(tW),S.IdentifierList=Q,Q=l([tU(td.identifier_list)],Q),Y=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(e){return this.setCache(e.visitDeclaration(this))},t}(tW),S.Declaration=Y,Y=l([tU(td.declaration)],Y),K=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(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}(tW),S.FunctionProtoType=K,K=l([tU(td.function_prototype)],K),J=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(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}(tW),S.FunctionDeclarator=J,J=l([tU(td.function_declarator)],J),Z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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}(tW),S.FunctionHeader=Z,Z=l([tU(td.function_header)],Z),$=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.parameterInfoList=[],t.paramSig=[],t}a(t,e);var r=t.prototype;return r.init=function(){this.parameterInfoList.length=0,this.paramSig.length=0},r.semanticAnalyze=function(e){var r=this.children,n=this.parameterInfoList,i=this.paramSig;if(o(r[0],en)){var a,s,c=r[0];n.push({ident:c.ident,typeInfo:c.typeInfo,astNode:c}),i.push(null!=(s=null==(a=c.typeInfo)?void 0:a.type)?s:3e3)}else if(o(r[2],en)){var l,u,p=r[0],h=r[2];n.push.apply(n,[].concat(p.parameterInfoList,[{ident:h.ident,typeInfo:h.typeInfo,astNode:h}])),i.push.apply(i,[].concat(p.paramSig,[null!=(u=null==(l=h.typeInfo)?void 0:l.type)?u:3e3]))}else o(r[0],t)&&o(r[1],et)?(n.push.apply(n,[].concat(r[0].parameterInfoList,[{astNode:r[1]}])),i.push.apply(i,[].concat(r[0].paramSig,[3e3]))):o(r[0],et)&&(n.push({astNode:r[0]}),i.push(3e3))},r.codeGen=function(e){return this.setCache(e.visitFunctionParameterList(this))},t}(tW),S.FunctionParameterList=$,$=l([tU(td.function_parameter_list)],$),ee=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.MacroParamCaseList=ee,ee=l([tU(td.macro_param_case_list)],ee),et=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.MacroParamBlock=et,et=l([tU(td.macro_param_block)],et),er=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.MacroParameterBranch=er,er=l([tU(td.macro_parameter_branch)],er),en=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.typeInfo=void 0,this.ident=void 0},r.semanticAnalyze=function(e){var t,r=this.children;if(o(r[0],ei)?t=r[0]:o(r[1],ei)&&(t=r[1]),t){this.typeInfo=t.typeInfo,this.ident=t.ident;var n=new tk(t.ident.lexeme,t.typeInfo,!1,t);e.symbolTableStack.insert(n)}},t}(tW),S.ParameterDeclaration=en,en=l([tU(td.parameter_declaration)],en),ei=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(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 tB(r.type,r.lexeme,n)},t}(tW),S.ParameterDeclarator=ei,ei=l([tU(td.parameter_declarator)],ei),ea=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.SimpleStatement=ea,ea=l([tU(td.simple_statement)],ea),eo=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.CompoundStatement=eo,eo=l([tU(td.compound_statement)],eo),es=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.CompoundStatementNoScope=es,es=l([tU(td.compound_statement_no_scope)],es),ec=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.Statement=ec,ec=l([tU(td.statement)],ec),el=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(e){return this.setCache(e.visitStatementList(this))},t}(tW),S.StatementList=el,el=l([tU(td.statement_list)],el),eu=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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 tD(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===ta.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}(tW),S.FunctionDefinition=eu,eu=l([tU(td.function_definition)],eu),ep=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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}(L),S.FunctionCall=ep,ep=l([tU(td.function_call)],ep),eh=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){e.prototype.init.call(this),this.fnSymbol=void 0},r.semanticAnalyze=function(e){var t=this.children[0];if(t.isBuiltin)this.type=t.ident;else{var r,n,i=t.ident;if(4===this.children.length){var a=this.children[2];o(a,e_)&&(n=a.paramSig)}var s=tb.getFn(i,n);if(s){this.type=s.realReturnType;return}var c=tF._lookupSymbol;c.set(i,tM.FN,void 0,void 0,n);var l=e.symbolTableStack.lookup(c,!0);if(!l){e.reportError(this.location,"No overload function type found: "+t.ident);return}this.type=null==l?void 0:null==(r=l.dataType)?void 0:r.type,this.fnSymbol=l}},t}(L),S.FunctionCallGeneric=eh,eh=l([tU(td.function_call_generic)],eh),e_=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.paramSig=[],t.paramNodes=[],t}a(t,e);var r=t.prototype;return r.init=function(){this.paramSig.length=0,this.paramNodes.length=0},r.semanticAnalyze=function(e){var r=this.children,n=this.paramSig,i=this.paramNodes;if(o(r[0],ey)){var a=r[0];n.push(a.type),i.push(a)}else if(o(r[2],ey)){var s=r[0],c=r[2];n.push.apply(n,[].concat(s.paramSig,[c.type])),i.push.apply(i,[].concat(s.paramNodes,[c]))}else o(r[0],t)&&o(r[1],ed)?(n.push.apply(n,[].concat(r[0].paramSig,[3e3])),i.push.apply(i,[].concat(r[0].paramNodes,[r[1]]))):o(r[0],ed)&&(n.push(3e3),i.push(r[0]))},t}(tW),S.FunctionCallParameterList=e_,e_=l([tU(td.function_call_parameter_list)],e_),ef=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.MacroCallArgCaseList=ef,ef=l([tU(td.macro_call_arg_case_list)],ef),ed=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.MacroCallArgBlock=ed,ed=l([tU(td.macro_call_arg_block)],ed),em=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.MacroCallArgBranch=em,em=l([tU(td.macro_call_arg_branch)],em),eS=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.symbolTableStack.isInMacroBranch||e.shaderData.globalPrecisions.push(this)},t}(tW),S.PrecisionSpecifier=eS,eS=l([tU(td.precision_specifier)],eS),eg=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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}(tW),S.FunctionIdentifier=eg,eg=l([tU(td.function_identifier)],eg),ey=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t,r=this.children[0];this.type=null!=(t=r.type)?t:3e3}else{var n,i=this.children[2];this.type=null!=(n=i.type)?n:3e3}},t}(L),S.AssignmentExpression=ey,ey=l([tU(td.assignment_expression)],ey),ev=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.AssignmentOperator=ev,ev=l([tU(td.assignment_operator)],ev),ex=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t=this.children[0];this.type=t.type}else{var r=this.children[2];this.type=r.type}},t}(L),S.Expression=ex,ex=l([tU(td.expression)],ex),eE=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t,r=this.children[0];if(o(r,eQ))this.type=null!=(t=r.typeInfo)?t:3e3;else switch(r.type){case ti.INT_CONSTANT:this._type=ta.INT;break;case ti.FLOAT_CONSTANT:this.type=ta.FLOAT;break;case ta.True:case ta.False:this.type=ta.BOOL}}else{var n=this.children[1];this.type=n.type}},t}(L),S.PrimaryExpression=eE,eE=l([tU(td.primary_expression)],eE),eC=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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}(L),S.PostfixExpression=eC,eC=l([tU(td.postfix_expression)],eC),eA=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.UnaryOperator=eA,eA=l([tU(td.unary_operator)],eA),eT=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){this.type=this.children[0].type},t}(L),S.UnaryExpression=eT,eT=l([tU(td.unary_expression)],eT),eb=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){e.prototype.init.call(this),1===this.children.length&&(this.type=this.children[0].type)},t}(L),S.MultiplicativeExpression=eb,eb=l([tU(td.multiplicative_expression)],eb),eO=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){e.prototype.init.call(this),1===this.children.length&&(this.type=this.children[0].type)},t}(L),S.AdditiveExpression=eO,eO=l([tU(td.additive_expression)],eO),eI=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];this.type=t.type},t}(L),S.ShiftExpression=eI,eI=l([tU(td.shift_expression)],eI),eL=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=ta.BOOL},t}(L),S.RelationalExpression=eL,eL=l([tU(td.relational_expression)],eL),eP=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=ta.BOOL},t}(L),S.EqualityExpression=eP,eP=l([tU(td.equality_expression)],eP),eR=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=ta.UINT},t}(L),S.AndExpression=eR,eR=l([tU(td.and_expression)],eR),eM=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=ta.UINT},t}(L),S.ExclusiveOrExpression=eM,eM=l([tU(td.exclusive_or_expression)],eM),eN=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=ta.UINT},t}(L),S.InclusiveOrExpression=eN,eN=l([tU(td.inclusive_or_expression)],eN),eD=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=ta.BOOL},t}(L),S.LogicalAndExpression=eD,eD=l([tU(td.logical_and_expression)],eD),eG=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=ta.BOOL},t}(L),S.LogicalXorExpression=eG,eG=l([tU(td.logical_xor_expression)],eG),ek=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=ta.BOOL},t}(L),S.LogicalOrExpression=ek,ek=l([tU(td.logical_or_expression)],ek),eV=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length&&(this.type=this.children[0].type)},t}(L),S.ConditionalExpression=eV,eV=l([tU(td.conditional_expression)],eV),eF=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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 tG(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}(tW),S.StructSpecifier=eF,eF=l([tU(td.struct_specifier)],eF),eB=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.propList=[],t.macroExpressions=[],t}a(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}(tW),S.StructDeclarationList=eB,eB=l([tU(td.struct_declaration_list)],eB),ew=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}a(t,e);var r=t.prototype;return r.init=function(){this._typeSpecifier=void 0,this._declaratorList=void 0,this.props.length=0,this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.props,n=this.macroExpressions;if(1===t.length){for(var i=t[0],a=i.props,s=0,c=a.length;s<c;s++)a[s].isInMacroBranch=!0,r.push(a[s]);n.push.apply(n,[].concat(i.macroExpressions));return}3===t.length?(this._typeSpecifier=t[0],this._declaratorList=t[1]):(this._typeSpecifier=t[1],this._declaratorList=t[2]);var l=t[0],u=this._typeSpecifier,p=u.type,h=u.lexeme,_=e.symbolTableStack.isInMacroBranch;if(o(l,ez)){var f=t[2],d=new tw(new tB(p,h),f.ident,l.index,_);r.push(d)}else{var m=this._declaratorList.declaratorList,S=m.length;r.length=S;for(var g=0;g<S;g++){var y=m[g],v=new tw(new tB(p,h,y.arraySpecifier),y.ident,void 0,_);r[g]=v}}},t}(tW),S.StructDeclaration=ew,ew=l([tU(td.struct_declaration)],ew),eU=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}a(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}(tW),S.MacroStructDeclaration=eU,eU=l([tU(td.macro_struct_declaration)],eU),eW=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}a(t,e);var r=t.prototype;return r.init=function(){this.props.length=0,this.macroExpressions.length=0},r.semanticAnalyze=function(){var e,r,n,i,a=this.children,s=a[a.length-1];this.macroExpressions.push(a[0]),o(a[1],eB)&&((e=this.props).push.apply(e,[].concat(a[1].propList)),(r=this.macroExpressions).push.apply(r,[].concat(a[1].macroExpressions))),o(s,t)&&((n=this.props).push.apply(n,[].concat(s.props)),(i=this.macroExpressions).push.apply(i,[].concat(s.macroExpressions))),a.length>1&&o(s,e$)&&this.macroExpressions.push(s)},t}(tW),S.MacroStructBranch=eW,eW=l([tU(td.macro_struct_branch)],eW),ez=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){this.index=Number(this.children[4].lexeme)},t}(tW),S.LayoutQualifier=ez,ez=l([tU(td.layout_qualifier)],ez),eH=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.declaratorList=[],t}a(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}(tW),S.StructDeclaratorList=eH,eH=l([tU(td.struct_declarator_list)],eH),ej=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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}(tW),S.StructDeclarator=ej,ej=l([tU(td.struct_declarator)],ej),eq=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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 tk(n.lexeme,new tB(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}(tW),S.VariableDeclaration=eq,eq=l([tU(td.variable_declaration)],eq),eX=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.variableDeclarations=[],t}a(t,e);var r=t.prototype;return r.init=function(){this.variableDeclarations.length=0},r.semanticAnalyze=function(e){var t=this.children,r=t.length,n=t[0],i=n.type;if(this.type=i,o(n,eq))this.variableDeclarations.push(n);else{(a=this.variableDeclarations).push.apply(a,[].concat(n.variableDeclarations));var a,s=t[2],c=eq.pool.get();3===r?c.set(s.location,[i,s]):c.set(s.location,[i,s,t[3]]),c.semanticAnalyze(e),this.variableDeclarations.push(c)}},t}(tW),S.VariableDeclarationList=eX,eX=l([tU(td.variable_declaration_list)],eX),eQ=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.referenceGlobalSymbolNames=[],t._symbols=[],t}a(t,e);var r=t.prototype;return r.init=function(){this.typeInfo=3e3,this.referenceGlobalSymbolNames.length=0,this._symbols.length=0},r.semanticAnalyze=function(e){var t=this.children[0],r=this.referenceGlobalSymbolNames,n=this._symbols,i=tF._lookupSymbol;l=o(t,t_)?[t.lexeme]:t.referenceSymbolNames;for(var a=0;a<l.length;a++){var s=l[a];if(!(e.macroDefineList[s]||!o(t,t_)&&tb.isExist(s))){var c=tI.getVar(s);if(c){this.typeInfo=c.type;continue}if(i.set(s,tM.Any),e.symbolTableStack.lookupAll(i,!0,n),n.length){this.typeInfo=null==(u=n[0].dataType)?void 0:u.type;var l,u,p=e.symbolTableStack.scope.getSymbol(i,!0);p?(o(p,tD)||p.isGlobalVariable)&&-1===r.indexOf(s)&&r.push(s):n.some(function(e){return o(e,tD)||e.isGlobalVariable})&&-1===r.indexOf(s)&&r.push(s)}else e.reportWarning(this.location,'Please sure the identifier "'+s+'" will be declared before used.')}}},r.codeGen=function(e){return this.setCache(e.visitVariableIdentifier(this))},r.getLexeme=function(e){var t=this.children[0];return o(t,t_)?t.lexeme:t.codeGen(e)},t}(tW),S.VariableIdentifier=eQ,eQ=l([tU(td.variable_identifier)],eQ),eY=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){this.shaderData=e.shaderData,this.shaderData.symbolTable=e.symbolTableStack.scope},t}(tW),S.GLShaderProgram=eY,eY=l([tU(td.gs_shader_program)],eY),eK=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}a(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t,r=this.children[0];(o(r,eJ)||o(r,e3)||o(r,t_))&&(e.shaderData.globalMacroDeclarations.push(this),o(r,e3)?(t=this.macroExpressions).push.apply(t,[].concat(r.macroExpressions)):this.macroExpressions.push(r))},t}(tW),S.GlobalDeclaration=eK,eK=l([tU(td.global_declaration)],eK),eJ=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(t){return this.setCache(e.prototype.codeGen.call(this,t)+"\n")},t}(tW),S.MacroUndef=eJ,eJ=l([tU(td.macro_undef)],eJ),eZ=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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}(tW),S.MacroPushContext=eZ,eZ=l([tU(td.macro_push_context)],eZ),e$=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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}(tW),S.MacroPopContext=e$,e$=l([tU(td.macro_pop_context)],e$),e0=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tW),S.MacroElifExpression=e0,e0=l([tU(td.macro_elif_expression)],e0),e2=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tW),S.MacroElseExpression=e2,e2=l([tU(td.macro_else_expression)],e2),e1=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}a(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}(tW),S.GlobalMacroDeclaration=e1,e1=l([tU(td.global_macro_declaration)],e1),e3=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}a(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}(tW),S.GlobalMacroIfStatement=e3,e3=l([tU(td.global_macro_if_statement)],e3),e4=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}a(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var r=this.children,n=r[r.length-1],i=this.macroExpressions;i.push(r[0]),o(r[1],e1)&&i.push.apply(i,[].concat(r[1].macroExpressions)),o(n,t)&&i.push.apply(i,[].concat(n.macroExpressions)),r.length>1&&o(n,e$)&&i.push(n)},t}(tW),S.GlobalMacroBranch=e4,e4=l([tU(td.global_macro_branch)],e4),e9=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.MacroIfStatement=e9,e9=l([tU(td.macro_if_statement)],e9),e5=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tW),S.MacroBranch=e5,e5=l([tU(td.macro_branch)],e5),e6=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.referenceSymbolNames=[],t}a(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,tE.getReferenceSymbolNames(e.macroDefineList,t,this.referenceSymbolNames)},t}(tW),S.MacroCallSymbol=e6,e6=l([tU(td.macro_call_symbol)],e6),e7=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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}(tW),S.MacroCallFunction=e7,l([tU(td.macro_call_function)],e7);var tz=/*#__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 th.createGSError("referenced attribute not found: "+t,tp.CompilationError,rc._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 th.createGSError("referenced varying not found: "+t,tp.CompilationError,rc._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 th.createGSError("referenced mrt not found: "+t,tp.CompilationError,rc._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()},c(e,null,[{key:"context",get:function(){return this._singleton}}]),e}();tz._lookupSymbol=new tN("",null);var tH=/*#__PURE__*/function(){function e(){this.array=[]}return e.prototype.dispose=function(){this.array.length=0},e}(),tj=/*#__PURE__*/function(){function e(){this.errors=[]}var t=e.prototype;return t.defaultCodeGen=function(t){var r=e._tmpArrayPool,i=r.get();i.dispose();for(var a,s=n(t);!(a=s()).done;){var c=a.value;o(c,t_)?i.array.push(c.lexeme):i.array.push(c.codeGen(this))}return r.return(i),i.array.join(" ")},t.visitPostfixExpression=function(e){var t=e.children,r=t.length,n=tz.context;if(3===r){var i=t[0],a=t[2];if(!o(a,t_))return i.codeGen(this)+"."+a.codeGen(this);if(n.isAttributeStruct(i.type)){var s=n.referenceAttribute(a);return s&&this.errors.push(s),a.lexeme}if(n.isVaryingStruct(i.type)){var c=n.referenceVarying(a);return c&&this.errors.push(c),a.lexeme}if(n.isMRTStruct(i.type)){var l=n.referenceMRTProp(a);return l&&this.errors.push(l),a.lexeme}return i.codeGen(this)+"."+a.lexeme}if(4===r){var u=t[0],p=t[2],h=u.codeGen(this),_=p.codeGen(this);return"gl_FragData"===h&&this._reportError(u.location,"Please use MRT struct instead of gl_FragData."),h+"["+_+"]"}return this.defaultCodeGen(e.children)},t.visitVariableIdentifier=function(e){for(var t,r=n(e.referenceGlobalSymbolNames);!(t=r()).done;){var i=t.value;tz.context.referenceGlobal(i,tM.Any)}return e.getLexeme(this)},t.visitFunctionCall=function(e){var t=e.children[0];if(o(t.fnSymbol,tD)){tz.context.referenceGlobal(t.fnSymbol.ident,tM.FN);var r=t.children[2];if(o(r,tt.FunctionCallParameterList)){for(var n=r.paramNodes,i=t.fnSymbol.astNode.protoType.parameterList,a=n.filter(function(e,t){var r,n=null==i?void 0:null==(r=i[t])?void 0:r.typeInfo;return!n||!tz.context.isAttributeStruct(n.typeLexeme)&&!tz.context.isVaryingStruct(n.typeLexeme)&&!tz.context.isMRTStruct(n.typeLexeme)}),s="",c=0,l=a.length;c<l;c++){var u=a[c],p=u.codeGen(this);o(u,tt.MacroCallArgBlock)||0===c?s+=p:s+=", "+p}return t.fnSymbol.ident+"("+s+")"}}return this.defaultCodeGen(e.children)},t.visitMacroCallFunction=function(e){var t=e.children[2];if(!o(t,tt.FunctionCallParameterList))return this.defaultCodeGen(e.children);for(var r=t.paramNodes.filter(function(e){if(o(e,tt.AssignmentExpression)){var t=tx.unwrapNodeByType(e,td.variable_identifier);if(t&&"string"==typeof t.typeInfo&&(tz.context.isAttributeStruct(t.typeInfo)||tz.context.isVaryingStruct(t.typeInfo)||tz.context.isMRTStruct(t.typeInfo)))return!1}return!0}),n="",i=0,a=r.length;i<a;i++){var s=r[i],c=s.codeGen(this);o(s,tt.MacroCallArgBlock)||0===i?n+=c:n+=", "+c}return e.macroName+"("+n+")"},t.visitStatementList=function(e){var t=e.children;return 1===t.length?t[0].codeGen(this):t[0].codeGen(this)+"\n"+t[1].codeGen(this)},t.visitSingleDeclaration=function(e){var t=e.typeSpecifier.type;return"string"==typeof t&&tz.context.referenceGlobal(t,tM.STRUCT),this.defaultCodeGen(e.children)},t.visitGlobalVariableDeclaration=function(e){var t=e.children,r=t[0];return o(r,tt.FullySpecifiedType)&&r.typeSpecifier.isCustom&&tz.context.referenceGlobal(r.type,tM.STRUCT),"uniform "+this.defaultCodeGen(t)},t.visitDeclaration=function(e){var t=tz.context,r=e.children,n=r[0];if(o(n,tt.InitDeclaratorList)){var i=n.typeInfo.typeLexeme;if(t.isVaryingStruct(i)||t.isMRTStruct(i))return""}return this.defaultCodeGen(r)},t.visitFunctionParameterList=function(e){for(var t=e.parameterInfoList.filter(function(e){return!e.typeInfo||!tz.context.isAttributeStruct(e.typeInfo.typeLexeme)&&!tz.context.isVaryingStruct(e.typeInfo.typeLexeme)&&!tz.context.isMRTStruct(e.typeInfo.typeLexeme)}),r="",n=0,i=t.length;n<i;n++){var a=t[n].astNode,s=a.codeGen(this);o(a,tt.MacroParamBlock)||0===n?r+=s:r+=", "+s}return r},t.visitFunctionHeader=function(e){var t=e.returnType.typeSpecifier.lexeme;return tz.context.isVaryingStruct(t)?"void "+e.ident.lexeme+"(":this.defaultCodeGen(e.children)},t.visitJumpStatement=function(e){var t=e.children;if(t[0].type===ta.RETURN){var r=t[1];if(o(r,tt.Expression)){var n=tx.unwrapNodeByType(r,td.variable_identifier);if(tz.context.isVaryingStruct(null==n?void 0:n.typeInfo))return"";var i=tx.unwrapNodeByType(r,td.function_call);if(tz.context.isVaryingStruct(null==i?void 0:i.type))return""+r.codeGen(this)+";"}}return this.defaultCodeGen(t)},t.visitFunctionIdentifier=function(e){return this.defaultCodeGen(e.children)},t.visitStructSpecifier=function(e){var t=this,r=tz.context,i=r.varyingStructs,a=r.attributeStructs,s=r.mrtStructs,c=-1!==i.indexOf(e),l=-1!==a.indexOf(e),u=-1!==s.indexOf(e);if(c&&l&&this._reportError(e.location,"cannot use same struct as Varying and Attribute"),c&&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"),!c&&!l&&!u)return this.defaultCodeGen(e.children);var p=[];p.push.apply(p,[].concat(e.macroExpressions.map(function(e){return{text:o(e,t_)?e.lexeme:e.codeGen(t),index:e.location.start.index}})));for(var h,_=n(e.propList);!(h=_()).done;){var f,d,m,S=h.value,g=S.ident.lexeme;c&&(null==(f=r._referencedVaryingList[g])?void 0:f.indexOf(S))>=0?p.push({text:""+this.getVaryingProp(S)+"\n",index:S.ident.location.start.index}):l&&(null==(d=r._referencedAttributeList[g])?void 0:d.indexOf(S))>=0?p.push({text:""+this.getAttributeProp(S)+"\n",index:S.ident.location.start.index}):u&&(null==(m=r._referencedMRTList[g])?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("")},t.visitFunctionDefinition=function(e){return e.protoType.ident.lexeme==tz.context.stageEntry?"void main() "+e.statements.codeGen(this):this.defaultCodeGen(e.children)},t._reportError=function(e,t){this.errors.push(new tu(tp.CompilationError,t,e,rc._processingPassText))},e}();tj._tmpArrayPool=new t.ReturnableObjectPool(tH,10);var tq=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._globalCodeArray=[],t}a(t,e);var r=t.prototype;return r.reset=function(){this._globalCodeArray.length=0,t._serializedGlobalKey.clear()},r.getOtherGlobal=function(e,t){for(var r,i=n(e.globalPrecisions);!(r=i()).done;){var a=r.value;t.push({text:a.codeGen(this),index:a.location.start.index})}},r.visitShaderProgram=function(e,t,r){this.errors.length=0,tz.reset(),this.reset();var n=e.shaderData;tz.context._passSymbolTable=n.symbolTable;var i=n.getOuterGlobalMacroDeclarations();return{vertex:this._vertexMain(t,n,i),fragment:this._fragmentMain(r,n,i)}},r._vertexMain=function(e,r,i){var a=this,o=tz.context;o.stage=tC.VERTEX,o.stageEntry=e;var s=t._lookupSymbol,c=r.symbolTable;s.set(e,tM.FN);var l=c.getSymbols(s,!0,[]);if(!l.length)throw"no entry function found: "+e;var u=o.attributeStructs,p=o.attributeList,h=o.varyingStructs,_=o.varyingList;l.forEach(function(e){var t=e.astNode,r=t.protoType.returnType;if("string"==typeof r.type){s.set(r.type,tM.STRUCT);var i=c.getSymbols(s,!0,[]);if(i.length)for(var o=0;o<i.length;o++){var l=i[o].astNode;h.push(l);for(var f,d=n(l.propList);!(f=d()).done;){var m=f.value;_.push(m)}}else a._reportError(r.location,'invalid varying struct: "'+r.type+'".')}else r.type!==ta.VOID&&a._reportError(r.location,"vertex main entry can only return struct or void.");var S=t.protoType.parameterList,g=null==S?void 0:S[0];if(g){var y=g.typeInfo.type;if("string"==typeof y){s.set(y,tM.STRUCT);var v=c.getSymbols(s,!0,[]);if(v.length)for(var x=0;x<v.length;x++){var E=v[x].astNode;u.push(E);for(var C,A=n(E.propList);!(C=A()).done;){var T=C.value;p.push(T)}}else a._reportError(g.astNode.location,'invalid attribute struct: "'+y+'".')}}});var f=this._globalCodeArray;tz.context.referenceGlobal(e,tM.FN),this._getGlobalSymbol(f),this._getCustomStruct(o.attributeStructs,f),this._getCustomStruct(o.varyingStructs,f),this._getGlobalMacroDeclarations(i,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 tz.context.reset(!1),this.reset(),d},r._fragmentMain=function(e,r,i){var a=this,o=tz.context;o.stage=tC.FRAGMENT,o.stageEntry=e;var s=t._lookupSymbol,c=r.symbolTable;s.set(e,tM.FN);var l=c.getSymbols(s,!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 i=t.protoType.returnType,l=i.type,u=i.location;if("string"==typeof l){s.set(l,tM.STRUCT);var p=c.getSymbols(s,!0,[]);if(p.length)for(var h=0;h<p.length;h++){var _=p[h].astNode;o.mrtStructs.push(_);for(var f,d=n(_.propList);!(f=d()).done;){var m=f.value;o.mrtList.push(m)}}else a._reportError(u,"invalid mrt struct: "+l)}else l!==ta.VOID&&l!==ta.VEC4&&a._reportError(u,"fragment main entry can only return struct or vec4.")});var u=this._globalCodeArray;tz.context.referenceGlobal(e,tM.FN),this._getGlobalSymbol(u),this._getCustomStruct(o.varyingStructs,u),this._getCustomStruct(o.mrtStructs,u),this._getGlobalMacroDeclarations(i,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 o.reset(),this.reset(),p},r._getGlobalSymbol=function(e){var r=tz.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===tM.VAR?";":"");s.isInMacroBranch||e.push({text:c,index:s.astNode.location.start.index})}}Object.keys(r).length!==n&&this._getGlobalSymbol(e)}},r._getCustomStruct=function(e,t){for(var r,i=n(e);!(r=i()).done;){var a=r.value,o=a.codeGen(this);a.isInMacroBranch||t.push({text:o,index:a.location.start.index})}},r._getGlobalMacroDeclarations=function(e,t){var r=this,i=tz.context,a=i._referencedGlobals,s=i._referencedGlobalMacroASTs;s.length=0;for(var c,l=n(Object.values(a));!(c=l()).done;)for(var u,p=c.value,h=n(p);!(u=h()).done;){var _=u.value;_.isInMacroBranch&&s.push(_.astNode)}for(var f,d=n(e);!(f=d()).done;){var m=f.value,S=void 0,g=m.children[0];if(o(g,tt.GlobalMacroIfStatement)){var y=[];y.push.apply(y,[].concat(m.macroExpressions.map(function(e){return{text:o(e,t_)?e.lexeme:e.codeGen(r),index:e.location.start.index}}))),this._visitGlobalMacroIfStatement(g,y),S=y.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n")}else S=m.codeGen(this);t.push({text:S,index:m.location.start.index})}},r._visitGlobalMacroIfStatement=function(e,t){for(var r=e.children,n=0;n<r.length;n++){var i=r[n];if(o(i,tt.PrecisionSpecifier))t.push({text:i.codeGen(this),index:i.location.start.index});else if(o(i,tt.FunctionDefinition))-1!==tz.context._referencedGlobalMacroASTs.indexOf(i)&&t.push({text:i.getCache(),index:i.location.start.index});else if(o(i,tt.StructSpecifier)){var a,s,c,l,u=tz.context,p=u.stage;(-1!==tz.context._referencedGlobalMacroASTs.indexOf(i)||(p===tC.VERTEX?u.isAttributeStruct(null==(a=i.ident)?void 0:a.lexeme)||u.isVaryingStruct(null==(s=i.ident)?void 0:s.lexeme):u.isVaryingStruct(null==(c=i.ident)?void 0:c.lexeme)||u.isMRTStruct(null==(l=i.ident)?void 0:l.lexeme)))&&t.push({text:i.getCache(),index:i.location.start.index})}else if(o(i,tt.VariableDeclarationList))for(var h=i.variableDeclarations,_=0;_<h.length;_++){var f=h[_];-1!==tz.context._referencedGlobalMacroASTs.indexOf(f)&&t.push({text:f.getCache()+";",index:f.location.start.index})}o(i,tW)&&this._visitGlobalMacroIfStatement(i,t)}},t}(tj);tq._lookupSymbol=new tN("",null),tq._serializedGlobalKey=new Set;var tX=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.getAttributeProp=function(e){return"attribute "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},r.getVaryingProp=function(e){return"varying "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},r.getMRTProp=function(){return null},r.visitPostfixExpression=function(t){var r=t.children,n=r[0],i=tz.context;if(o(n,tt.PostfixExpression)&&i.isMRTStruct(n.type)){var a=r[2],s=i.mrtList.find(function(e){return e.ident.lexeme===a.lexeme});return s?"gl_FragData["+s.mrtIndex+"]":(this._reportError(a.location,"not found mrt property: "+a.lexeme),"")}return e.prototype.visitPostfixExpression.call(this,t)},r.visitJumpStatement=function(t){return t.isFragReturnStatement?tz.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}(tq),tQ="GS_glFragColor",tY=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._otherCodeArray=[],t._fragColorVariableRegistered=!1,t}a(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(tz.context.stage===tC.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=tz.context;if(r.stage===tC.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(),tQ}return e.prototype.visitVariableIdentifier.call(this,t)},r.visitJumpStatement=function(t){return t.isFragReturnStatement?tz.context.mrtStructs.length?"":(this._registerFragColorVariable(),tQ+" = "+t.children[1].codeGen(this)+";"):e.prototype.visitJumpStatement.call(this,t)},r._registerFragColorVariable=function(){this._fragColorVariableRegistered||(this._otherCodeArray.push({text:"out vec4 "+tQ+";",index:0}),this._fragColorVariableRegistered=!0)},t.getVisitor=function(){return this._singleton||(this._singleton=new t),this._singleton},t}(tq),tK=/*#__PURE__*/function(){function e(e){this._currentIndex=0,this._column=0,this._line=0,this._source=e}var r=e.prototype;return r.setSource=function(e){this._source=e,this._currentIndex=0,this._line=this._column=0},r.getShaderPosition=function(e){return void 0===e&&(e=0),rc.createPosition(this._currentIndex-e,this._line,this._column-e)},r.isEnd=function(){return this._currentIndex>=this._source.length},r.getCurChar=function(){return this._source[this._currentIndex]},r.getCurCharCode=function(){return this._source.charCodeAt(this._currentIndex)},r.advance=function(e){for(var t=this._source,r=this._currentIndex,n=0;n<e;n++)"\n"===t[r+n]?(this._line+=1,this._column=0):this._column+=1;this._currentIndex+=e},r.skipSpace=function(t){for(;e.isWhiteSpaceChar(this.getCurCharCode(),t);)this.advance(1)},r.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)},r.peek=function(e){var t=this._currentIndex;return this._source.substring(t,t+e)},r.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)},r.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},r.throwError=function(e){for(var r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var a=th.createGSError(n.join(" "),tp.ScannerError,this._source,e);throw t.Logger.error(a.toString()),a},r.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)},c(e,[{key:"currentIndex",get:function(){return this._currentIndex}},{key:"source",get:function(){return this._source}},{key:"line",get:function(){return this._line}},{key:"column",get:function(){return this._column}}]),e}(),tJ=/*#__PURE__*/function(e){function t(t,r){var n;return(n=e.call(this,t)||this).macroDefineList=r,n._needScanMacroConditionExpression=!1,n}a(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,tf]}})},r.scanToken=function(){if(this.skipCommentsAndSpace(),this.isEnd())return tf;if(this._needScanMacroConditionExpression)return this._needScanMacroConditionExpression=!1,this._scanMacroConditionExpression();var e,t=this.getCurCharCode();if(tK.isPreprocessorStartChar(t))return this._scanDirectives();if(tK.isAlpha(t))return this._scanWord();if(tK.isDigit(t))return this._scanNum();var r=this.getShaderPosition(),n=t_.pool.get();switch(this.getCurChar()){case"<":if(this.advance(1),"<"===(e=this.getCurChar())){if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(ti.LEFT_ASSIGN,"<<=",r);break}n.set(ti.LEFT_OP,"<<",r);break}if("="===e){this.advance(1),n.set(ti.LE_OP,"<=",r);break}n.set(ti.LEFT_ANGLE,"<",r);break;case">":if(this.advance(1),">"===(e=this.getCurChar())){if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(ti.RIGHT_ASSIGN,">>=",r);break}n.set(ti.RIGHT_OP,">>",r);break}if("="===e){this.advance(1),n.set(ti.GE_OP,">=",r);break}n.set(ti.RIGHT_ANGLE,">",r);break;case"+":if(this.advance(1),"+"===(e=this.getCurChar())){this.advance(1),n.set(ti.INC_OP,"++",r);break}if("="===e){this.advance(1),n.set(ti.ADD_ASSIGN,"+=",r);break}n.set(ti.PLUS,"+",r);break;case"-":if(this.advance(1),"-"===(e=this.getCurChar())){this.advance(1),n.set(ti.DEC_OP,"--",r);break}if("="===e){this.advance(1),n.set(ti.SUB_ASSIGN,"-=",r);break}n.set(ti.DASH,"-",r);break;case"=":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(ti.EQ_OP,"==",r);break}n.set(ti.EQUAL,"=",r);break;case"!":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(ti.NE_OP,"!=",r);break}n.set(ti.BANG,"!",r);break;case"&":if(this.advance(1),"&"===(e=this.getCurChar())){this.advance(1),n.set(ti.AND_OP,"&&",r);break}if("="===e){this.advance(1),n.set(ti.ADD_ASSIGN,"&=",r);break}n.set(ti.AMPERSAND,"&",r);break;case"|":if(this.advance(1),"|"===(e=this.getCurChar())){this.advance(1),n.set(ti.OR_OP,"||",r);break}if("="===e){this.advance(1),n.set(ti.OR_ASSIGN,"|=",r);break}n.set(ti.VERTICAL_BAR,"|",r);break;case"^":if(this.advance(1),"^"===(e=this.getCurChar())){this.advance(1),n.set(ti.XOR_OP,"^^",r);break}if("="===e){this.advance(1),n.set(ti.XOR_ASSIGN,"^=",r);break}n.set(ti.CARET,"^",r);break;case"*":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(ti.MUL_ASSIGN,"*=",r);break}n.set(ti.STAR,"*",r);break;case"/":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(ti.DIV_ASSIGN,"/=",r);break}n.set(ti.SLASH,"/",r);break;case"%":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(ti.MOD_ASSIGN,"%=",r);break}n.set(ti.PERCENT,"%",r);break;case"(":this.advance(1),n.set(ti.LEFT_PAREN,"(",r);break;case")":this.advance(1),n.set(ti.RIGHT_PAREN,")",r);break;case"{":this.advance(1),n.set(ti.LEFT_BRACE,"{",r);break;case"}":this.advance(1),n.set(ti.RIGHT_BRACE,"}",r);break;case"[":this.advance(1),n.set(ti.LEFT_BRACKET,"[",r);break;case"]":this.advance(1),n.set(ti.RIGHT_BRACKET,"]",r);break;case".":if(this.advance(1),tK.isDigit(this.getCurCharCode()))return this._scanNumAfterDot();n.set(ti.DOT,".",r);break;case",":this.advance(1),n.set(ti.COMMA,",",r);break;case":":this.advance(1),n.set(ti.COLON,":",r);break;case";":this.advance(1),n.set(ti.SEMICOLON,";",r);break;case"~":this.advance(1),n.set(ti.TILDE,"~",r);break;case"?":this.advance(1),n.set(ti.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=rc.createRange(e,this.getShaderPosition()),n=t_.pool.get();return n.set(ti.STRING_CONST,t.join(""),r),n},r._scanNumAfterDot=function(){for(var e=["."];tK.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(e);var t=t_.pool.get();return t.set(ti.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);tK.isAlpha(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=t_.pool.get(),i=e.join("");if("#define"===i){this._scanUtilBreakLine(e);var a=e.join("")+"\n";n.set(ta.MACRO_DEFINE_EXPRESSION,a,r)}else{var o=t._lexemeTable[i];n.set(null!=o?o:ti.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=t_.pool.get();return n.set(ta.MACRO_CONDITIONAL_EXPRESSION,r,t),n},r._scanWord=function(){var e=[this.getCurChar()],r=this.getShaderPosition();for(this.advance(1);tK.isAlnum(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=t_.pool.get(),i=e.join(""),a=t._lexemeTable[i];return this.macroDefineList[i]?n.set(ta.MACRO_CALL,i,r):n.set(null!=a?a:ti.ID,i,r),n},r._scanNum=function(){for(var e=[];tK.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var t=this.getCurChar();if("."===t){for(e.push(t),this.advance(1);tK.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(e);var r=t_.pool.get();return r.set(ti.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),r}if("e"===t||"E"===t){this._scanFloatSuffix(e);var n=t_.pool.get();return n.set(ti.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),n}this._scanIntegerSuffix(e);var i=t_.pool.get();return i.set(ti.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()),tK.isDigit(this.getCurCharCode())||this.throwError(this.getShaderPosition(0),"lexing error, invalid exponent suffix.");do e.push(t),this.advance(1),t=this.getCurChar();while(tK.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}(tK);function tZ(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}tJ._lexemeTable={const:ta.CONST,bool:ta.BOOL,float:ta.FLOAT,double:ta.DOUBLE,int:ta.INT,uint:ta.UINT,break:ta.BREAK,continue:ta.CONTINUE,do:ta.DO,else:ta.ELSE,for:ta.FOR,if:ta.IF,while:ta.WHILE,discard:ta.DISCARD,return:ta.RETURN,bvec2:ta.BVEC2,bvec3:ta.BVEC3,bvec4:ta.BVEC4,ivec2:ta.IVEC2,ivec3:ta.IVEC3,ivec4:ta.IVEC4,uvec2:ta.UVEC2,uvec3:ta.UVEC3,uvec4:ta.UVEC4,vec2:ta.VEC2,vec3:ta.VEC3,vec4:ta.VEC4,mat2:ta.MAT2,mat3:ta.MAT3,mat4:ta.MAT4,in:ta.IN,out:ta.OUT,inout:ta.INOUT,sampler2D:ta.SAMPLER2D,samplerCube:ta.SAMPLER_CUBE,sampler3D:ta.SAMPLER3D,sampler2DShadow:ta.SAMPLER2D_SHADOW,samplerCubeShadow:ta.SAMPLER_CUBE_SHADOW,sampler2DArray:ta.SAMPLER2D_ARRAY,sampler2DArrayShadow:ta.SAMPLER2D_ARRAY_SHADOW,isampler2D:ta.I_SAMPLER2D,isampler3D:ta.I_SAMPLER3D,isamplerCube:ta.I_SAMPLER_CUBE,isampler2DArray:ta.I_SAMPLER2D_ARRAY,usampler2D:ta.U_SAMPLER2D,usampler3D:ta.U_SAMPLER3D,usamplerCube:ta.U_SAMPLER_CUBE,usampler2DArray:ta.U_SAMPLER2D_ARRAY,struct:ta.STRUCT,void:ta.VOID,true:ta.True,false:ta.False,precision:ta.PRECISION,precise:ta.PRECISE,highp:ta.HIGHP,mediump:ta.MEDIUMP,lowp:ta.LOWP,invariant:ta.INVARIANT,flat:ta.FLAT,smooth:ta.SMOOTH,noperspective:ta.NOPERSPECTIVE,centroid:ta.CENTROID,layout:ta.LAYOUT,location:ta.LOCATION,"#if":ta.MACRO_IF,"#ifdef":ta.MACRO_IFDEF,"#ifndef":ta.MACRO_IFNDEF,"#else":ta.MACRO_ELSE,"#elif":ta.MACRO_ELIF,"#endif":ta.MACRO_ENDIF,"#undef":ta.MACRO_UNDEF};var t$=((e8={})[e8.id=0]="id",e8[e8.line_remain=1]="line_remain",e8[e8.chunk=2]="chunk",e8[e8.int_constant=3]="int_constant",e8[e8.string_const=4]="string_const",e8[e8.right_op=5]="right_op",e8[e8.left_op=6]="left_op",e8[e8.left_paren=7]="left_paren",e8[e8.right_paren=8]="right_paren",e8[e8.ge=9]="ge",e8[e8.le=10]="le",e8[e8.eq=11]="eq",e8[e8.neq=12]="neq",e8[e8.and=13]="and",e8[e8.or=14]="or",e8[e8.left_angle=15]="left_angle",e8[e8.right_angle=16]="right_angle",e8[e8.star=17]="star",e8[e8.plus=18]="plus",e8[e8.dash=19]="dash",e8[e8.bang=20]="bang",e8[e8.slash=21]="slash",e8[e8.percent=22]="percent",e8[e8.EOF=100]="EOF",e8),t0=((te={})[te.define=101]="define",te[te.undef=102]="undef",te[te.if=103]="if",te[te.ifdef=104]="ifdef",te[te.ifndef=105]="ifndef",te[te.else=106]="else",te[te.elif=107]="elif",te[te.endif=108]="endif",te[te.defined=109]="defined",te),t2=/*#__PURE__*/function(){function e(e,t,r,n){this.macro=e,this.body=t,this.location=r,this.args=n,(null==n?void 0:n.length)>0&&(this._argsLexemes=this.args.map(function(e){return e.lexeme}),this._replaceRegex=RegExp("\\b("+this._argsLexemes.join("|")+")\\b","g"))}return e.prototype.expandFunctionBody=function(e){var t,r=this;if(e.length!==(null==(t=this.args)?void 0:t.length))throw th.createGSError("mismatched function macro",tp.PreprocessorError,"",this.location);return 0===e.length?this.body.lexeme:this.body.lexeme.replace(this._replaceRegex,function(t){return e[r._argsLexemes.indexOf(t)]})},c(e,[{key:"isFunction",get:function(){return!!this.args}}]),e}(),t1=function(e,t,r){this.sourceFile=null!=e?e:"__main__",this.rangeInFile=t,this.sourceMap=r},t3=/*#__PURE__*/function(){function e(e,t,r){this.sourceLoc={block:e,rangeInBlock:t},this.generatedLoc=r}return e.prototype.getSourceIndex=function(e){var t,r,n,i,a=this.sourceLoc,o=a.block,s=a.rangeInBlock;if(o.sourceMap){if("__main__"!==o.sourceFile)return o.sourceMap.map(e-this.generatedLoc.start);if(s)return{sourceFile:o.sourceFile,index:(null!=(n=null==(r=o.rangeInFile)?void 0:r.start.index)?n:0)+s.start.index}}return{index:e-this.generatedLoc.start+s.start.index+(null!=(i=null==(t=o.rangeInFile)?void 0:t.start.index)?i:0),sourceFile:this.sourceLoc.block.sourceFile}},e}(),t4=/*#__PURE__*/function(){function e(){this.mapRanges=[]}var t=e.prototype;return t.addMapRange=function(e){this.mapRanges.push(e)},t.map=function(t){for(var r,i,a=n(this.mapRanges);!(i=a()).done;){var o=i.value,s=o.generatedLoc;if(e.rangeContains(s,t))return o.getSourceIndex(t);if(o.generatedLoc.start<t){r=o;continue}break}return r?{index:t-r.generatedLoc.end+r.sourceLoc.rangeInBlock.end.index,sourceFile:r.sourceLoc.block.sourceFile}:{sourceFile:"__main__",index:t}},e.rangeContains=function(e,t){return e.start<=t&&e.end>t},e}(),t9=/*#__PURE__*/function(e){function t(t,r,n){var i;return void 0===r&&(r="__main__"),(i=e.call(this,t)||this).macroLvl=0,i.sourceMap=new t4,i.file=r,i.blockRange=n,i}a(t,e);var r=t.prototype;return r.scanWordsUntilTerminator=function(e){for(var t=[];;)if(this.skipSpace(!0),tK.isAlpha(this.getCurCharCode()))t.push(this.scanWord());else{if(this.getCurChar()===e)return this.advance(1),t;this.advance(1)}},r.scanWord=function(){for(;!tK.isAlpha(this.getCurCharCode())&&!this.isEnd();)this.advance(1);if(this.isEnd())return tf;for(var e,r=this._currentIndex;tK.isAlnum(this.getCurCharCode())&&!this.isEnd();)this.advance(1);var n=this._currentIndex,i=this._source.slice(r,n);n===r&&this.throwError(this.getShaderPosition(0),"no word found.");var a=t_.pool.get(),o=null!=(e=t._lexemeTable[i])?e:t$.id;return a.set(o,i,this.getShaderPosition(i.length)),a},r.scanToken=function(){if(this.skipCommentsAndSpace(),!this.isEnd()){for(var e,r=this._source,n=this._currentIndex,i=!1,a=r.length;this._currentIndex<a;)if(t._isPpCharacters(r.charCodeAt(this._currentIndex)))this.advance(1),i=!0;else{if(i)break;this.advance(1),this.skipCommentsAndSpace(),n=this._currentIndex}var o=r.slice(n,this._currentIndex),s=t_.pool.get(),c=null!=(e=t._lexemeTable[o])?e:t$.id;return s.set(c,o,this.getShaderPosition(this._currentIndex-n)),c===t0.if||c===t0.ifdef||c===t0.ifndef?this.macroLvl++:c===t0.endif&&this.macroLvl--,s}},r.scanQuotedString=function(){this.skipSpace(!0);var e=this._source,t=e.length,r=this.getShaderPosition(0),n=this._currentIndex;34!==e.charCodeAt(n)&&this.throwError(r,"Unexpected char, expected '\"'");for(var i=++n;n<t&&34!==e.charCodeAt(n);)n++;n>=t&&this.throwError(this.getShaderPosition(0),"Unexpected char, expected '\"'");var a=e.slice(i,n);this.advance(n+1-this._currentIndex);var o=t_.pool.get();return o.set(t$.string_const,a,r),o},r.scanToChar=function(e){for(var t=this._source;t[this._currentIndex]!==e&&!this.isEnd();)this.advance(1)},r.scanMacroBranchBody=function(){for(var e=this.getShaderPosition(0),t=this.macroLvl,r=this.scanToken();;){var n=r.type;if(n===t0.endif&&t-1===this.macroLvl||(n===t0.elif||n===t0.else)&&t===this.macroLvl)break;r=this.scanToken()}var i=this._source.slice(e.index,this._currentIndex-r.lexeme.length-1),a=t_.pool.get();return a.set(t$.chunk,i,e),{body:a,nextDirective:r}},r.scanPairedBlock=function(e,t){this.scanToChar(e);var r=0,n=this._source;do{var i=n[this._currentIndex];i===e?r++:i===t&&r--,this.advance(1)}while(r>0)},r.scanRemainMacro=function(){for(var e=this.macroLvl,t=this.scanToken();!this.isEnd()&&(t.type!==t0.endif||e-1!==this.macroLvl);)t=this.scanToken();return this.getShaderPosition(0)},r.peekNonSpace=function(){for(var e=this._currentIndex;/\s/.test(this._source[e]);)e+=1;return this._source[e]},r.scanInteger=function(){for(var e=this._currentIndex;tK.isDigit(this.getCurCharCode());)this.advance(1);this._currentIndex===e&&this.throwError(this.getShaderPosition(0),"no integer found");var t=this._source.slice(e,this._currentIndex),r=t_.pool.get();return r.set(t$.int_constant,t,this.getShaderPosition(0)),r},r.scanMacroBody=function(){this.skipSpace(!1);for(var e="",t=this._source,r=t.length,n=this.getShaderPosition(0);this._currentIndex<r;){var i=t.charCodeAt(this._currentIndex);if(10===i)break;if(47===i){var a=this._currentIndex+1;if(a<r){var o=t.charCodeAt(a);if(47===o)break;if(42===o){for(this.advance(2);this._currentIndex+1<r;){var s=this._currentIndex;if(42===t.charCodeAt(s)&&47===t.charCodeAt(s+1)){this.advance(2);break}this.advance(1)}e+=" ";continue}}}e+=t[this._currentIndex],this.advance(1)}if(""===e)return null;var c=t_.pool.get();return c.set(t$.line_remain,e,rc.createRange(n,this.getShaderPosition(0))),c},t._isPpCharacters=function(e){return 35===e||tK.isAlnum(e)},t}(tK);t9._lexemeTable={"#define":t0.define,"#undef":t0.undef,"#if":t0.if,"#ifdef":t0.ifdef,"#ifndef":t0.ifndef,"#else":t0.else,"#elif":t0.elif,"#endif":t0.endif,defined:t0.defined};var t5=/*#__PURE__*/function(){function e(){}return e.expand=function(e,t,r){for(var i,a=[],o=0,s=0,c=n(e);!(i=c()).done;){var l=i.value,u=t.slice(o,l.rangeInBlock.start.index);a.push(u,l.replace);var p=s+u.length+l.replace.length,h=new t3(l.block,l.rangeInBlock,{start:s+u.length,end:p});null==r||r.addMapRange(h),o=l.rangeInBlock.end.index,s=p}return a.push(t.slice(o)),a.join("")},e}(),t6=/*#__PURE__*/function(){function e(){}return e.parse=function(t,r){e._reset();for(var i,a=n(r);!(i=a()).done;){var o=i.value;e._addPredefinedMacro(o.name,o.value)}return this.lexer=new t9(t),e._parseDirectives(this.lexer)},e._reset=function(){this._expandSegmentsStack.length=0,this._expandSegmentsStack.push([]),this._definedMacros.clear(),this._addPredefinedMacro("GL_ES"),this._errors.length=0},e._addPredefinedMacro=function(e,t){var r,n=t_.pool.get();n.set(t$.id,e),void 0!=t&&(r=t_.pool.get()).set(t$.id,t),this._definedMacros.set(e,new t2(n,r))},e._parseDirectives=function(e){for(var t;t=e.scanToken();)switch(t.type){case t$.id:this._parseMacro(e,t);break;case t0.define:this._parseDefine(e);break;case t0.undef:this._parseUndef(e);break;case t0.if:this._parseIfDirective(e,t0.if);break;case t0.ifndef:this._parseIfDirective(e,t0.ifndef);break;case t0.ifdef:this._parseIfDirective(e,t0.ifdef)}return this._errors.length>0?null:t5.expand(this._getExpandSegments(),e.source,e.sourceMap)},e._getExpandSegments=function(){return this._expandSegmentsStack[this._expandSegmentsStack.length-1]},e._reportError=function(e,t,r,n){var i=th.createGSError(t,tp.PreprocessorError,r,e,n);this._errors.push(i)},e._parseIfDirective=function(e,t){var r,n=t===t0.if?3:t===t0.ifdef?6:7,i=e.currentIndex-n,a=!1;if(t===t0.if)r=this._parseConstantExpression(e);else{var o=e.scanWord().lexeme;if(o.startsWith("GL_"))a=!0;else{var s=this._definedMacros.get(o);r=t===t0.ifdef?!!s:!s}}e.skipSpace(!0);var c=e.scanMacroBranchBody(),l=c.body,u=c.nextDirective;if(!a){if(r){var p=u.type===t0.endif?e.getShaderPosition(0):e.scanRemainMacro(),h=this._expandMacroChunk(l.lexeme,l.location,e);this._addContentReplace(e.file,rc.createPosition(i),p,h.content,e.blockRange,h.sourceMap)}else this._addEmptyReplace(e,i),this._processConditionalDirective(u.type,e)}},e._processConditionalDirective=function(e,t){if(e!==t0.endif){var r=t.currentIndex;if(e===t0.else){var n=t.scanMacroBranchBody().body,i=this._expandMacroChunk(n.lexeme,n.location,t);this._addContentReplace(t.file,rc.createPosition(r),t.getShaderPosition(0),i.content,t.blockRange,i.sourceMap)}else if(e===t0.elif){var a=this._parseConstantExpression(t),o=t.scanMacroBranchBody(),s=o.body,c=o.nextDirective;if(a){var l=c.type===t0.endif?t.currentIndex:t.scanRemainMacro().index,u=this._expandMacroChunk(s.lexeme,s.location,t);this._addContentReplace(t.file,rc.createPosition(r),rc.createPosition(l),u.content,t.blockRange,u.sourceMap)}else this._addContentReplace(t.file,rc.createPosition(r),rc.createPosition(t.currentIndex),"",t.blockRange),this._processConditionalDirective(c.type,t)}}},e._parseConstantExpression=function(e){return e.skipSpace(!0),this._parseLogicalOrExpression(e)},e._parseLogicalOrExpression=function(e){var t=this._parseLogicalAndExpression(e),r=e.peek(2);if(r&&"||"===r){e.advance(2),e.skipSpace(!1);var n=this._parseLogicalOrExpression(e);return t||n}return t},e._parseLogicalAndExpression=function(e){var t=this._parseEqualityExpression(e),r=e.peek(2);if(r&&"&&"===r){e.advance(2),e.skipSpace(!1);var n=this._parseLogicalAndExpression(e);return t&&n}return t},e._parseEqualityExpression=function(e){var t=this._parseRelationalExpression(e),r=e.peek(2);if(r&&["==","!="].includes(r)){e.advance(2),e.skipSpace(!1);var n=this._parseEqualityExpression(e);switch(r){case"==":return t===n;case"!=":return t!==n}}return t},e._parseRelationalExpression=function(e){var t=this._parseShiftExpression(e),r=e.peek(2);if("="!==r[1]&&(r=r[0]),r&&[">","<",">=","<="].includes(r)){var n=e.getShaderPosition(0);e.advance(r.length),e.skipSpace(!1);var i=this._parseRelationalExpression(e);if((void 0===t?"undefined":tZ(t))!==(void 0===i?"undefined":tZ(i))&&"number"!=typeof t){this._reportError(n,"invalid operator in relation expression.",e.source,e.file);return}switch(r){case">":return t>i;case"<":return t<i;case">=":return t>=i;case"<=":return t<=i}}return t},e._parseShiftExpression=function(e){var t=this._parseAdditiveExpression(e),r=e.peek(2);if(r&&[">>","<<"].includes(r)){var n=e.getShaderPosition(0);e.advance(2),e.skipSpace(!1);var i=this._parseShiftExpression(e);if((void 0===t?"undefined":tZ(t))!==(void 0===i?"undefined":tZ(i))&&"number"!=typeof t){this._reportError(n,"invalid operator in shift expression.",e.source,e.file);return}switch(r){case">>":return t>>i;case"<<":return t<<i}}return t},e._parseAdditiveExpression=function(e){var t=this._parseMulticativeExpression(e);if([">","<"].includes(e.getCurChar())){var r=e.getShaderPosition(0);e.advance(1);var n=e.getCurChar();e.skipSpace(!1);var i=this._parseAdditiveExpression(e);if((void 0===t?"undefined":tZ(t))!==(void 0===i?"undefined":tZ(i))&&"number"!=typeof t)return this._reportError(r,"invalid operator.",e.source,e.file),!1;switch(n){case"+":return t+i;case"-":return t-i}}return t},e._parseMulticativeExpression=function(e){var t=this._parseUnaryExpression(e);if(e.skipSpace(!1),["*","/","%"].includes(e.getCurChar())){var r=e.getShaderPosition(0),n=e.getCurChar();e.skipSpace(!1);var i=this._parseMulticativeExpression(e);if((void 0===t?"undefined":tZ(t))!==(void 0===i?"undefined":tZ(i))&&"number"!=typeof t){this._reportError(r,"invalid operator.",e.source,e.file);return}switch(n){case"*":return t*i;case"/":return t/i;case"%":return t%i}}return t},e._parseUnaryExpression=function(e){var t=e.getCurChar();if(["+","-","!"].includes(t)){var r=e.getShaderPosition(0);e.advance(1),e.skipSpace(!1);var n=this._parseParenthesisExpression(e);switch(("!"===t&&"boolean"!=typeof n||"!"!==t&&"number"!=typeof n)&&this._reportError(r,"invalid operator.",e.source,e.file),t){case"+":return n;case"-":return-n;case"!":return!n}}return this._parseParenthesisExpression(e)},e._parseParenthesisExpression=function(e){if("("===e.getCurChar()){e.advance(1),e.skipSpace(!1);var t=this._parseConstantExpression(e);return e.scanToChar(")"),e.advance(1),t}return this._parseConstant(e)},e._parseConstant=function(e){if(tK.isAlpha(e.getCurCharCode())){var t=e.scanWord();if(t.type===t0.defined){var r="("===e.peekNonSpace(),n=e.scanWord();return r&&(e.scanToChar(")"),e.advance(1)),!!this._definedMacros.get(n.lexeme)}var i=this._definedMacros.get(t.lexeme);if(!i)return!1;if(!i.body)return!0;i.isFunction&&this._reportError(t.location,"invalid function macro usage",e.source,e.file);var a=Number(i.body.lexeme);return Number.isInteger(a)||this._reportError(t.location,"invalid const macro: "+t.lexeme,e.source,e.file),a}if(tK.isDigit(e.getCurCharCode()))return Number(e.scanInteger().lexeme);this._reportError(e.getShaderPosition(0),"invalid token: "+e.getCurChar(),e.source,e.file)},e._parseMacroFunctionArgs=function(e,t,r){for(var n=e.length,i=t+r.length;i<n&&40!==e.charCodeAt(i);)i++;for(var a=[],o=1,s=i+1,c=s;c<n&&o>0;){var l=e.charCodeAt(c);if(40===l)o++;else if(41===l){if(0==--o){var u=e.substring(s,c).trim();u.length>0&&a.push(u);break}}else if(44===l&&1===o){var p=e.substring(s,c).trim();p.length>0&&a.push(p),s=c+1}c++}return{args:a,endIndex:c+1}},e._expandMacroBody=function(e){for(var t=this._expandVisitedMacros,r=++this._expandVersionId,n=e,i=!0;i;){i=!1;for(var a=n.length,o=0;o<a;){var s,c,l=n.charCodeAt(o);if(!tK.isAlpha(l)){o++;continue}for(var u=o;o<a&&tK.isAlnum(n.charCodeAt(o));)o++;var p=n.substring(u,o),h=this._definedMacros.get(p);if(h&&t[p]!==r){t[p]=r;var _=void 0,f=void 0;if(h.isFunction){var d=this._parseMacroFunctionArgs(n,u,p),m=d.args,S=d.endIndex;_=h.expandFunctionBody(m),f=S}else _=null!=(c=null==(s=h.body)?void 0:s.lexeme)?c:"",f=o;n=n.substring(0,u)+_+n.substring(f),i=!0;break}}}return n},e._expandMacroChunk=function(e,t,r){this._expandSegmentsStack.push([]),n="string"==typeof r?new t9(e,r):new t9(e,r.file,t);var n,i=this._parseDirectives(n);return this._expandSegmentsStack.pop(),{content:i,sourceMap:n.sourceMap}},e._addEmptyReplace=function(e,t){this._addContentReplace(e.file,rc.createPosition(t),e.getShaderPosition(0),"",e.blockRange)},e._addContentReplace=function(e,t,r,n,i,a){var o=new t1(e,i,a),s=rc.createRange(t,r);this._getExpandSegments().push({block:o,rangeInBlock:s,replace:n})},e._parseDefine=function(e){var t,r=e.getShaderPosition(7),n=e.scanWord(),i=n.lexeme,a=n.location,o=a.end;this._definedMacros.get(i)&&i.startsWith("GL_")&&this._reportError(a,"Redefined macro: "+i,e.source,e.file),"("===e.getCurChar()&&(t=e.scanWordsUntilTerminator(")"),o=e.getShaderPosition(0));var s=new t2(n,e.scanMacroBody(),rc.createRange(r,o),t);this._definedMacros.set(i,s),this._addContentReplace(e.file,r,e.getShaderPosition(0),"",e.blockRange)},e._parseUndef=function(e){var t=e.getShaderPosition(6),r=e.scanWord();this._definedMacros.delete(r.lexeme),this._addContentReplace(e.file,t,e.getShaderPosition(0),"",e.blockRange)},e._parseMacro=function(e,t){var r=this._definedMacros.get(t.lexeme);if(r){var n=t.location;if(r.isFunction){var i=this._parseMacroFunctionArgs(e.source,n.start.index,t.lexeme),a=i.args,o=i.endIndex,s=r.expandFunctionBody(a),c=this._expandMacroBody(s),l=o-n.end.index;e.advance(l),this._addContentReplace(e.file,n.start,e.getShaderPosition(0),c,e.blockRange)}else{var u,p,h=null!=(p=null==(u=r.body)?void 0:u.lexeme)?p:"",_=this._expandMacroBody(h);this._addContentReplace(e.file,n.start,n.end,_,e.blockRange)}}},e.convertSourceIndex=function(e){return this.lexer.sourceMap.map(e)},e}();t6._definedMacros=new Map,t6._expandSegmentsStack=[[]],t6._expandVisitedMacros={},t6._expandVersionId=1,t6._errors=[];var t7=/*#__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 r=e.prototype;return r.generate=function(){this.computeFirstSet(),this.buildStateTable()},r.buildStateTable=function(){var e=[new ty(this.grammar.productions[0],0,[ti.EOF])],t=tv.create(e);this._extendState(t)},r._extendState=function(e){if(e.needReInfer){this._closure(e);for(var t,r=this._inferNextState(e),i=n(r);!(t=i()).done;){var a=t.value;this._extendState(a)}}},r._closure=function(e){for(var t,r=n(e.cores);!(t=r()).done;){var i=t.value;i.canReduce()||this._extendStateItem(e,i)}return e.closured=!0,e},r._extendStateItem=function(e,t){if(!tg.isTerminal(t.curSymbol)){var r=this.grammar.getProductionList(t.curSymbol);if(t.nextSymbol){for(var i=new Set,a=!1,o=1,s=t.symbolByOffset(1);s;s=t.symbolByOffset(++o)){if(tg.isTerminal(s)){i.add(s),a=!0;break}c=this.firstSetMap.get(s);for(var c,l,u=n(c);!(l=u()).done;){var p=l.value;i.add(p)}if(!c.has(ti.EPSILON))break}if(!a&&(null==c?void 0:c.has(ti.EPSILON)))for(var h,_=n(t.lookaheadSet);!(h=_()).done;){var f=h.value;i.add(f)}for(var d,m=n(r);!(d=m()).done;){var S=d.value,g=e.createStateItem(S,0);e.items.has(g)&&tg.isSubSet(i,g.lookaheadSet)||(e.items.add(g),g.addLookahead(i),this._extendStateItem(e,g))}}else for(var y,v=n(r);!(y=v()).done;){var x=y.value,E=e.createStateItem(x,0);e.items.has(E)&&tg.isSubSet(t.lookaheadSet,E.lookaheadSet)||(e.items.add(E),E.addLookahead(t.lookaheadSet),this._extendStateItem(e,E))}}},r._inferNextState=function(e){var t=new Map,r=null!=(a=this.actionTable.get(e.id))?a:new Map,i=null!=(o=this.gotoTable.get(e.id))?o:new Map;this.actionTable.set(e.id,r),this.gotoTable.set(e.id,i);for(var a,o,s,c=n(e.items);!(s=c()).done;){var l=s.value;if(l.canReduce()){var u=void 0;u=l.production.goal!==td.START?{action:tS.Reduce,target:l.production.id}:{action:tS.Accept};for(var p,h=n(l.lookaheadSet);!(p=h()).done;){var _=p.value;this._addAction(r,_,u)}}else{var f=l.advance();tg.addMapSetItem(t,l.curSymbol,f)}l.needReInfer=!1}for(var d,m=new Set,S=n(t.entries());!(d=S()).done;){var g=d.value,y=g[0],v=g[1],x=tv.create(Array.from(v));tg.isTerminal(y)?this._addAction(r,y,{action:tS.Shift,target:x.id}):i.set(y,x.id),m.add(x)}return m},r._addAction=function(e,r,n){var i=e.get(r);if(i&&!tg.isActionEqual(i,n)){if(r===ta.ELSE&&i.action===tS.Shift&&n.action===tS.Reduce)return;t.Logger.warn("conflict detect: <Terminal "+tg.toString(r)+"> \n",tg.printAction(i),"\n",tg.printAction(n))}e.set(r,n)},r.computeFirstSet=function(){for(var e,t=n(this.grammar.productions.slice(1));!(e=t()).done;){var r=e.value;this._computeFirstSetForNT(r.goal)}},r._computeFirstSetForNT=function(e){var t=this._firstSetNTStack.findIndex(function(t){return t===e});if(-1!==t){for(var r=this.firstSetMap.get(e),i=this._firstSetNTStack.length,a=i-1;a>t;a--){var o=this._firstSetNTStack[a];this.firstSetMap.set(o,r)}return r}this._firstSetNTStack.push(e);var s=this.grammar.getProductionList(e),c=new Set;this.firstSetMap.set(e,c),this.grammar.isNullableNT(e)&&c.add(ti.EPSILON);for(var l,u=n(s);!(l=u()).done;){for(var p=l.value,h=0;h<p.derivation.length;h++){var _=p.derivation[h];if(tg.isTerminal(_)){c.add(_);break}for(var f,d=this._computeFirstSetForNT(_),m=n(d);!(f=m()).done;){var S=f.value;S!==ti.EPSILON&&c.add(S)}if(!this.grammar.isNullableNT(_))break}h===p.derivation.length&&c.add(ti.EPSILON)}return this._firstSetNTStack.pop(),c},e}(),t8=/*#__PURE__*/function(){function e(e,t){this.startSymbol=e,t.unshift(new tm(td.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]===ti.EPSILON})},t.getProductionByID=function(e){return tm.pool.get(e)},e.create=function(t,r){return new e(t,r.map(function(e){return new tm(e[0],e.slice(1))}))},e}(),re=[].concat(tg.createProductionWithOptions(td.gs_shader_program,[[td.global_declaration],[td.gs_shader_program,td.global_declaration]],tt.GLShaderProgram.pool),tg.createProductionWithOptions(td.global_declaration,[[td.precision_specifier],[td.variable_declaration_statement],[td.struct_specifier],[td.function_definition],[td.global_macro_if_statement],[td.macro_undef],[ta.MACRO_DEFINE_EXPRESSION]],tt.GlobalDeclaration.pool),tg.createProductionWithOptions(td.macro_call_symbol,[[ta.MACRO_CALL]],tt.MacroCallSymbol.pool),tg.createProductionWithOptions(td.macro_call_function,[[td.macro_call_symbol,ti.LEFT_PAREN,ti.RIGHT_PAREN],[td.macro_call_symbol,ti.LEFT_PAREN,td.function_call_parameter_list,ti.RIGHT_PAREN]],tt.MacroCallFunction.pool),tg.createProductionWithOptions(td.macro_undef,[[ta.MACRO_UNDEF,ti.ID],[ta.MACRO_UNDEF,ta.MACRO_CALL]],tt.MacroUndef.pool),tg.createProductionWithOptions(td.macro_push_context,[[ta.MACRO_IF,ta.MACRO_CONDITIONAL_EXPRESSION],[ta.MACRO_IFDEF,ti.ID],[ta.MACRO_IFNDEF,ti.ID],[ta.MACRO_IFDEF,td.macro_call_symbol],[ta.MACRO_IFNDEF,td.macro_call_symbol]],tt.MacroPushContext.pool),tg.createProductionWithOptions(td.macro_pop_context,[[ta.MACRO_ENDIF]],tt.MacroPopContext.pool),tg.createProductionWithOptions(td.macro_elif_expression,[[ta.MACRO_ELIF,ta.MACRO_CONDITIONAL_EXPRESSION]],tt.MacroElifExpression.pool),tg.createProductionWithOptions(td.macro_else_expression,[[ta.MACRO_ELSE]],tt.MacroElseExpression.pool),tg.createProductionWithOptions(td.global_macro_declaration,[[td.global_declaration],[td.global_macro_declaration,td.global_declaration]],tt.GlobalMacroDeclaration.pool),tg.createProductionWithOptions(td.global_macro_if_statement,[[td.macro_push_context,td.global_macro_declaration,td.global_macro_branch],[td.macro_push_context,td.global_macro_branch]],tt.GlobalMacroIfStatement.pool),tg.createProductionWithOptions(td.global_macro_branch,[[td.macro_pop_context],[td.macro_elif_expression,td.global_macro_declaration,td.global_macro_branch],[td.macro_else_expression,td.global_macro_declaration,td.macro_pop_context],[td.macro_elif_expression,td.global_macro_branch],[td.macro_else_expression,td.macro_pop_context]],tt.GlobalMacroBranch.pool),tg.createProductionWithOptions(td.variable_declaration,[[td.fully_specified_type,ti.ID],[td.fully_specified_type,ti.ID,td.array_specifier],[td.fully_specified_type,ti.ID,ti.EQUAL,td.initializer]],tt.VariableDeclaration.pool),tg.createProductionWithOptions(td.variable_declaration_list,[[td.variable_declaration],[td.variable_declaration_list,ti.COMMA,ti.ID],[td.variable_declaration_list,ti.COMMA,ti.ID,td.array_specifier]],tt.VariableDeclarationList.pool),tg.createProductionWithOptions(td.variable_declaration_statement,[[td.variable_declaration_list,ti.SEMICOLON]]),tg.createProductionWithOptions(td.ext_builtin_type_specifier_nonarray,[[ta.VOID],[ta.FLOAT],[ta.BOOL],[ta.INT],[ta.UINT],[ta.VEC2],[ta.VEC3],[ta.VEC4],[ta.BVEC2],[ta.BVEC3],[ta.BVEC4],[ta.IVEC2],[ta.IVEC3],[ta.IVEC4],[ta.UVEC2],[ta.UVEC3],[ta.UVEC4],[ta.MAT2],[ta.MAT3],[ta.MAT4],[ta.MAT2X3],[ta.MAT2X4],[ta.MAT3X2],[ta.MAT3X4],[ta.MAT4X2],[ta.MAT4X3],[ta.SAMPLER2D],[ta.SAMPLER3D],[ta.SAMPLER_CUBE],[ta.SAMPLER2D_SHADOW],[ta.SAMPLER_CUBE_SHADOW],[ta.SAMPLER2D_ARRAY],[ta.SAMPLER2D_ARRAY_SHADOW],[ta.I_SAMPLER2D],[ta.I_SAMPLER3D],[ta.I_SAMPLER_CUBE],[ta.I_SAMPLER2D_ARRAY],[ta.U_SAMPLER2D],[ta.U_SAMPLER3D],[ta.U_SAMPLER_CUBE],[ta.U_SAMPLER2D_ARRAY]],tt.ExtBuiltinTypeSpecifierNonArray.pool),tg.createProductionWithOptions(td.type_specifier_nonarray,[[ti.ID],[td.ext_builtin_type_specifier_nonarray]],tt.TypeSpecifierNonArray.pool),tg.createProductionWithOptions(td.fully_specified_type,[[td.type_specifier],[td.type_qualifier,td.type_specifier]],tt.FullySpecifiedType.pool),tg.createProductionWithOptions(td.type_specifier,[[td.type_specifier_nonarray],[td.ext_builtin_type_specifier_nonarray,td.array_specifier]],tt.TypeSpecifier.pool),tg.createProductionWithOptions(td.type_qualifier,[[td.single_type_qualifier],[td.type_qualifier,td.single_type_qualifier]],tt.TypeQualifier.pool),tg.createProductionWithOptions(td.single_type_qualifier,[[td.storage_qualifier],[td.precision_qualifier],[td.interpolation_qualifier],[td.invariant_qualifier],[ta.PRECISE]],tt.SingleTypeQualifier.pool),tg.createProductionWithOptions(td.storage_qualifier,[[ta.CONST],[ta.IN],[ta.INOUT],[ta.OUT],[ta.CENTROID]],tt.StorageQualifier.pool),tg.createProductionWithOptions(td.interpolation_qualifier,[[ta.SMOOTH],[ta.FLAT]],tt.InterpolationQualifier.pool),tg.createProductionWithOptions(td.invariant_qualifier,[[ta.INVARIANT]],tt.InvariantQualifier.pool),tg.createProductionWithOptions(td.precision_qualifier,[[ta.HIGHP],[ta.MEDIUMP],[ta.LOWP]],tt.PrecisionQualifier.pool),tg.createProductionWithOptions(td.struct_specifier,[[ta.STRUCT,ti.ID,ti.LEFT_BRACE,td.struct_declaration_list,ti.RIGHT_BRACE,ti.SEMICOLON],[ta.STRUCT,ti.LEFT_BRACE,td.struct_declaration_list,ti.RIGHT_BRACE,ti.SEMICOLON]],tt.StructSpecifier.pool),tg.createProductionWithOptions(td.struct_declaration_list,[[td.struct_declaration],[td.struct_declaration_list,td.struct_declaration]],tt.StructDeclarationList.pool),tg.createProductionWithOptions(td.struct_declaration,[[td.type_specifier,td.struct_declarator_list,ti.SEMICOLON],[td.type_qualifier,td.type_specifier,td.struct_declarator_list,ti.SEMICOLON],[td.layout_qualifier,td.type_specifier,td.struct_declarator,ti.SEMICOLON],[td.macro_struct_declaration]],tt.StructDeclaration.pool),tg.createProductionWithOptions(td.macro_struct_declaration,[[td.macro_push_context,td.struct_declaration_list,td.macro_struct_branch],[td.macro_push_context,td.macro_struct_branch]],tt.MacroStructDeclaration.pool),tg.createProductionWithOptions(td.macro_struct_branch,[[td.macro_pop_context],[td.macro_elif_expression,td.struct_declaration_list,td.macro_struct_branch],[td.macro_else_expression,td.struct_declaration_list,td.macro_pop_context],[td.macro_elif_expression,td.macro_struct_branch],[td.macro_else_expression,td.macro_pop_context]],tt.MacroStructBranch.pool),tg.createProductionWithOptions(td.layout_qualifier,[[ta.LAYOUT,ti.LEFT_PAREN,ta.LOCATION,ti.EQUAL,ti.INT_CONSTANT,ti.RIGHT_PAREN]],tt.LayoutQualifier.pool),tg.createProductionWithOptions(td.struct_declarator_list,[[td.struct_declarator],[td.struct_declarator_list,ti.COMMA,td.struct_declarator]],tt.StructDeclaratorList.pool),tg.createProductionWithOptions(td.struct_declarator,[[ti.ID],[ti.ID,td.array_specifier]],tt.StructDeclarator.pool),tg.createProductionWithOptions(td.array_specifier,[[ti.LEFT_BRACKET,ti.RIGHT_BRACKET],[ti.LEFT_BRACKET,td.integer_constant_expression,ti.RIGHT_BRACKET]],tt.ArraySpecifier.pool),tg.createProductionWithOptions(td.integer_constant_expression_operator,[[ti.PLUS],[ti.DASH],[ti.STAR],[ti.SLASH],[ti.PERCENT]],tt.IntegerConstantExpressionOperator.pool),tg.createProductionWithOptions(td.integer_constant_expression,[[td.variable_identifier],[ti.INT_CONSTANT],[td.integer_constant_expression,td.integer_constant_expression_operator,ti.INT_CONSTANT],[td.integer_constant_expression,td.integer_constant_expression_operator,td.variable_identifier]],tt.IntegerConstantExpression.pool),tg.createProductionWithOptions(td.conditional_expression,[[td.logical_or_expression],[td.logical_or_expression,ti.QUESTION,td.expression,ti.COLON,td.assignment_expression]],tt.ConditionalExpression.pool),tg.createProductionWithOptions(td.logical_or_expression,[[td.logical_xor_expression],[td.logical_or_expression,ti.OR_OP,td.logical_xor_expression]],tt.LogicalOrExpression.pool),tg.createProductionWithOptions(td.logical_xor_expression,[[td.logical_and_expression],[td.logical_xor_expression,ti.XOR_OP,td.logical_and_expression]],tt.LogicalXorExpression.pool),tg.createProductionWithOptions(td.logical_and_expression,[[td.inclusive_or_expression],[td.logical_and_expression,ti.AND_OP,td.inclusive_or_expression]],tt.LogicalAndExpression.pool),tg.createProductionWithOptions(td.inclusive_or_expression,[[td.exclusive_or_expression],[td.inclusive_or_expression,ti.VERTICAL_BAR,td.exclusive_or_expression]],tt.InclusiveOrExpression.pool),tg.createProductionWithOptions(td.exclusive_or_expression,[[td.and_expression],[td.exclusive_or_expression,ti.CARET,td.and_expression]],tt.ExclusiveOrExpression.pool),tg.createProductionWithOptions(td.and_expression,[[td.equality_expression],[td.and_expression,ti.AMPERSAND,td.equality_expression]],tt.AndExpression.pool),tg.createProductionWithOptions(td.equality_expression,[[td.relational_expression],[td.equality_expression,ti.EQ_OP,td.relational_expression],[td.equality_expression,ti.NE_OP,td.relational_expression]],tt.EqualityExpression.pool),tg.createProductionWithOptions(td.relational_expression,[[td.shift_expression],[td.relational_expression,ti.LEFT_ANGLE,td.shift_expression],[td.relational_expression,ti.RIGHT_ANGLE,td.shift_expression],[td.relational_expression,ti.LE_OP,td.shift_expression],[td.relational_expression,ti.GE_OP,td.shift_expression]],tt.RelationalExpression.pool),tg.createProductionWithOptions(td.shift_expression,[[td.additive_expression],[td.shift_expression,ti.LEFT_OP,td.additive_expression],[td.shift_expression,ti.RIGHT_OP,td.additive_expression]],tt.ShiftExpression.pool),tg.createProductionWithOptions(td.additive_expression,[[td.multiplicative_expression],[td.additive_expression,ti.PLUS,td.multiplicative_expression],[td.additive_expression,ti.DASH,td.multiplicative_expression]],tt.AdditiveExpression.pool),tg.createProductionWithOptions(td.multiplicative_expression,[[td.unary_expression],[td.multiplicative_expression,ti.STAR,td.unary_expression],[td.multiplicative_expression,ti.SLASH,td.unary_expression],[td.multiplicative_expression,ti.PERCENT,td.unary_expression]],tt.MultiplicativeExpression.pool),tg.createProductionWithOptions(td.unary_expression,[[td.postfix_expression],[ti.INC_OP,td.unary_expression],[ti.DEC_OP,td.unary_expression],[td.unary_operator,td.unary_expression]],tt.UnaryExpression.pool),tg.createProductionWithOptions(td.unary_operator,[[ti.PLUS],[ti.DASH],[ti.BANG],[ti.TILDE]],tt.UnaryOperator.pool),tg.createProductionWithOptions(td.postfix_expression,[[td.primary_expression],[td.postfix_expression,ti.LEFT_BRACKET,td.expression,ti.RIGHT_BRACKET],[td.function_call],[td.postfix_expression,ti.DOT,ti.ID],[td.postfix_expression,ti.DOT,td.function_call],[td.postfix_expression,ti.INC_OP],[td.postfix_expression,ti.DEC_OP]],tt.PostfixExpression.pool),tg.createProductionWithOptions(td.primary_expression,[[td.variable_identifier],[ti.INT_CONSTANT],[ti.FLOAT_CONSTANT],[ta.True],[ta.False],[ti.LEFT_PAREN,td.expression,ti.RIGHT_PAREN]],tt.PrimaryExpression.pool),tg.createProductionWithOptions(td.expression,[[td.assignment_expression],[td.expression,ti.COMMA,td.assignment_expression]],tt.Expression.pool),tg.createProductionWithOptions(td.assignment_expression,[[td.conditional_expression],[td.unary_expression,td.assignment_operator,td.assignment_expression]],tt.AssignmentExpression.pool),tg.createProductionWithOptions(td.assignment_operator,[[ti.EQUAL],[ti.MUL_ASSIGN],[ti.DIV_ASSIGN],[ti.MOD_ASSIGN],[ti.ADD_ASSIGN],[ti.SUB_ASSIGN],[ti.LEFT_ASSIGN],[ti.RIGHT_ASSIGN],[ti.AND_ASSIGN],[ti.XOR_ASSIGN],[ti.OR_ASSIGN]],tt.AssignmentOperator.pool),tg.createProductionWithOptions(td.function_call,[[td.function_call_generic]],tt.FunctionCall.pool),tg.createProductionWithOptions(td.function_call_generic,[[td.function_identifier,ti.LEFT_PAREN,td.function_call_parameter_list,ti.RIGHT_PAREN],[td.function_identifier,ti.LEFT_PAREN,ti.RIGHT_PAREN],[td.function_identifier,ta.VOID,ti.RIGHT_PAREN]],tt.FunctionCallGeneric.pool),tg.createProductionWithOptions(td.function_call_parameter_list,[[td.assignment_expression],[td.function_call_parameter_list,ti.COMMA,td.assignment_expression],[td.macro_call_arg_block],[td.function_call_parameter_list,td.macro_call_arg_block]],tt.FunctionCallParameterList.pool),tg.createProductionWithOptions(td.macro_call_arg_case_list,[[td.assignment_expression],[ti.COMMA,td.assignment_expression],[td.macro_call_arg_block],[td.macro_call_arg_case_list,td.macro_call_arg_block],[td.macro_call_arg_case_list,ti.COMMA,td.assignment_expression]],tt.MacroCallArgCaseList.pool),tg.createProductionWithOptions(td.macro_call_arg_block,[[td.macro_push_context,td.macro_call_arg_branch],[td.macro_push_context,td.macro_call_arg_case_list,td.macro_call_arg_branch]],tt.MacroCallArgBlock.pool),tg.createProductionWithOptions(td.macro_call_arg_branch,[[td.macro_pop_context],[td.macro_elif_expression,td.macro_call_arg_case_list,td.macro_call_arg_branch],[td.macro_else_expression,td.macro_call_arg_case_list,td.macro_pop_context],[td.macro_elif_expression,td.macro_call_arg_branch],[td.macro_else_expression,td.macro_pop_context]],tt.MacroCallArgBranch.pool),tg.createProductionWithOptions(td.function_identifier,[[td.type_specifier]],tt.FunctionIdentifier.pool),tg.createProductionWithOptions(td.function_definition,[[td.function_prototype,td.compound_statement_no_scope]],tt.FunctionDefinition.pool),tg.createProductionWithOptions(td.function_prototype,[[td.function_declarator,ti.RIGHT_PAREN]],tt.FunctionProtoType.pool),tg.createProductionWithOptions(td.function_declarator,[[td.function_header],[td.function_header,td.function_parameter_list]],tt.FunctionDeclarator.pool),tg.createProductionWithOptions(td.function_header,[[td.fully_specified_type,ti.ID,ti.LEFT_PAREN]],tt.FunctionHeader.pool),tg.createProductionWithOptions(td.function_parameter_list,[[td.parameter_declaration],[td.function_parameter_list,ti.COMMA,td.parameter_declaration],[td.macro_param_block],[td.function_parameter_list,td.macro_param_block]],tt.FunctionParameterList.pool),tg.createProductionWithOptions(td.macro_param_case_list,[[td.parameter_declaration],[ti.COMMA,td.parameter_declaration],[td.macro_param_block],[td.macro_param_case_list,td.macro_param_block],[td.macro_param_case_list,ti.COMMA,td.parameter_declaration]],tt.MacroParamCaseList.pool),tg.createProductionWithOptions(td.macro_param_block,[[td.macro_push_context,td.macro_parameter_branch],[td.macro_push_context,td.macro_param_case_list,td.macro_parameter_branch]],tt.MacroParamBlock.pool),tg.createProductionWithOptions(td.macro_parameter_branch,[[td.macro_pop_context],[td.macro_elif_expression,td.macro_param_case_list,td.macro_parameter_branch],[td.macro_else_expression,td.macro_param_case_list,td.macro_pop_context],[td.macro_elif_expression,td.macro_parameter_branch],[td.macro_else_expression,td.macro_pop_context]],tt.MacroParameterBranch.pool),tg.createProductionWithOptions(td.parameter_declaration,[[td.type_qualifier,td.parameter_declarator],[td.parameter_declarator],[td.macro_call_symbol],[td.macro_call_function]],tt.ParameterDeclaration.pool),tg.createProductionWithOptions(td.parameter_declarator,[[td.type_specifier,ti.ID],[td.type_specifier,ti.ID,td.array_specifier]],tt.ParameterDeclarator.pool),tg.createProductionWithOptions(td.statement_list,[[td.statement],[td.statement_list,td.statement]],tt.StatementList.pool),tg.createProductionWithOptions(td.statement,[[td.compound_statement],[td.simple_statement]],tt.Statement.pool),tg.createProductionWithOptions(td.compound_statement_no_scope,[[ti.LEFT_BRACE,ti.RIGHT_BRACE],[ti.LEFT_BRACE,td.statement_list,ti.RIGHT_BRACE]],tt.CompoundStatementNoScope.pool),tg.createProductionWithOptions(td.compound_statement,[[ti.LEFT_BRACE,ti.RIGHT_BRACE],[td.scope_brace,td.statement_list,td.scope_end_brace]],tt.CompoundStatement.pool),tg.createProductionWithOptions(td.simple_statement,[[td.declaration],[td.expression_statement],[td.selection_statement],[td.iteration_statement],[td.jump_statement],[td.macro_if_statement],[td.macro_undef],[ta.MACRO_DEFINE_EXPRESSION]],tt.SimpleStatement.pool),tg.createProductionWithOptions(td.declaration,[[td.function_prototype,ti.SEMICOLON],[td.init_declarator_list,ti.SEMICOLON],[ta.PRECISION,td.precision_qualifier,td.ext_builtin_type_specifier_nonarray,ti.SEMICOLON],[td.type_qualifier,ti.ID,ti.SEMICOLON],[td.type_qualifier,ti.ID,td.identifier_list,ti.SEMICOLON]],tt.Declaration.pool),tg.createProductionWithOptions(td.identifier_list,[[ti.COMMA,ti.ID],[td.identifier_list,ti.COMMA,ti.ID]],tt.IdentifierList.pool),tg.createProductionWithOptions(td.init_declarator_list,[[td.single_declaration],[td.init_declarator_list,ti.COMMA,ti.ID],[td.init_declarator_list,ti.COMMA,ti.ID,td.array_specifier],[td.init_declarator_list,ti.COMMA,ti.ID,td.array_specifier,ti.EQUAL,td.initializer],[td.init_declarator_list,ti.COMMA,ti.ID,ti.EQUAL,td.initializer]],tt.InitDeclaratorList.pool),tg.createProductionWithOptions(td.single_declaration,[[td.fully_specified_type,ti.ID],[td.fully_specified_type,ti.ID,td.array_specifier],[td.fully_specified_type,ti.ID,td.array_specifier,ti.EQUAL,td.initializer],[td.fully_specified_type,ti.ID,ti.EQUAL,td.initializer]],tt.SingleDeclaration.pool),tg.createProductionWithOptions(td.initializer,[[td.assignment_expression],[ti.LEFT_BRACE,td.initializer_list,ti.RIGHT_BRACE]],tt.Initializer.pool),tg.createProductionWithOptions(td.initializer_list,[[td.initializer],[td.initializer_list,ti.COMMA,td.initializer]],tt.InitializerList.pool),tg.createProductionWithOptions(td.expression_statement,[[ti.SEMICOLON],[td.expression,ti.SEMICOLON]],tt.ExpressionStatement.pool),tg.createProductionWithOptions(td.selection_statement,[[ta.IF,ti.LEFT_PAREN,td.expression,ti.RIGHT_PAREN,td.statement],[ta.IF,ti.LEFT_PAREN,td.expression,ti.RIGHT_PAREN,td.statement,ta.ELSE,td.statement]],tt.SelectionStatement.pool),tg.createProductionWithOptions(td.iteration_statement,[[ta.WHILE,ti.LEFT_PAREN,td.condition,ti.RIGHT_PAREN,td.statement],[ta.FOR,ti.LEFT_PAREN,td.for_init_statement,td.for_rest_statement,ti.RIGHT_PAREN,td.statement]],tt.IterationStatement.pool),tg.createProductionWithOptions(td.precision_specifier,[[ta.PRECISION,td.precision_qualifier,td.ext_builtin_type_specifier_nonarray,ti.SEMICOLON]],tt.PrecisionSpecifier.pool),tg.createProductionWithOptions(td.for_init_statement,[[td.expression_statement],[td.declaration]],tt.ForInitStatement.pool),tg.createProductionWithOptions(td.condition,[[td.expression],[td.fully_specified_type,ti.ID,ti.EQUAL,td.initializer]],tt.Condition.pool),tg.createProductionWithOptions(td.for_rest_statement,[[td.conditionopt,ti.SEMICOLON],[td.conditionopt,ti.SEMICOLON,td.expression]],tt.ForRestStatement.pool),tg.createProductionWithOptions(td.conditionopt,[[ti.EPSILON],[td.condition]],tt.ConditionOpt.pool),tg.createProductionWithOptions(td.jump_statement,[[ta.CONTINUE,ti.SEMICOLON],[ta.BREAK,ti.SEMICOLON],[ta.RETURN,ti.SEMICOLON],[ta.RETURN,td.expression,ti.SEMICOLON],[ta.DISCARD,ti.SEMICOLON]],tt.JumpStatement.pool),tg.createProductionWithOptions(td.scope_brace,[[ti.LEFT_BRACE]],tt.ScopeBrace.pool),tg.createProductionWithOptions(td.scope_end_brace,[[ti.RIGHT_BRACE]],tt.ScopeEndBrace.pool),tg.createProductionWithOptions(td.variable_identifier,[[ti.ID],[td.macro_call_symbol],[td.macro_call_function]],tt.VariableIdentifier.pool),tg.createProductionWithOptions(td.macro_if_statement,[[td.macro_push_context,td.statement_list,td.macro_branch],[td.macro_push_context,td.macro_branch]],tt.MacroIfStatement.pool),tg.createProductionWithOptions(td.macro_branch,[[td.macro_pop_context],[td.macro_elif_expression,td.statement_list,td.macro_branch],[td.macro_else_expression,td.statement_list,td.macro_pop_context],[td.macro_elif_expression,td.macro_branch],[td.macro_else_expression,td.macro_pop_context]],tt.MacroBranch.pool)),rt=function(e){for(var t=0;t<re.length;t++){var r=re[t][1];r&&e.addTranslationRule(t,r)}},rr=/*#__PURE__*/function(){function e(e,t,r){this._traceBackStack=[],this.actionTable=e,this.gotoTable=t,this.grammar=r,this.sematicAnalyzer=new tF}var r=e.prototype;return r.parse=function(e,r){this.sematicAnalyzer.reset(r);var n=performance.now(),i=this._traceBackStack,a=this.sematicAnalyzer;i.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)===tS.Shift)i.push(l,u.target),s=e.next();else if((null==u?void 0:u.action)===tS.Accept)return t.Logger.info("[Task - AST compilation] Accept! State automata run "+c+" times! cost time "+(performance.now()-n)+"ms"),null==a.acceptRule||a.acceptRule.call(a,a),a.semanticStack.pop();else if((null==u?void 0:u.action)===tS.Reduce){for(var p=u.target,h=this.grammar.getProductionByID(p),_=a.getTranslationRule(h.id),f=[],d=h.derivation.length-1;d>=0;d--)if(h.derivation[d]!==ti.EPSILON){i.pop();var m=i.pop();if(o(m,t_))f.unshift(m);else{var S=a.semanticStack.pop();f.unshift(S)}}null==_||_.apply(void 0,[].concat([a],f));var g=this.stateGotoTable;i.push(h.goal);var y=null==g?void 0:g.get(h.goal);i.push(y);continue}else{var v=th.createGSError("Unexpected token "+l.lexeme,tp.CompilationError,rc._processingPassText,l.location);return this.sematicAnalyzer.errors.push(v),null}}},r._printStack=function(e){for(var r="",n=0;n<this._traceBackStack.length-1;n++){var i,a=this._traceBackStack[n++],o=this._traceBackStack[n];r+="State"+a+" - "+(null!=(i=o.lexeme)?i:tx.toString(o))+"; "}r+="State"+this._traceBackStack[this._traceBackStack.length-1]+" --- "+e.lexeme,t.Logger.info(r)},e.create=function(){if(!this._singleton){var t=t8.create(td.gs_shader_program,re.map(function(e){return e[0]})),r=new t7(t);r.generate(),this._singleton=new e(r.actionTable,r.gotoTable,t),rt(this._singleton.sematicAnalyzer)}return this._singleton},c(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)}},{key:"errors",get:function(){return this.sematicAnalyzer.errors}}]),e}();function rn(){return(rn=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 ri=/*#__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}(),ra=/*#__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}(),ro=/*#__PURE__*/function(e){function r(){var t;return t=e.apply(this,arguments)||this,t.hasPendingContent=!1,t}a(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(tK.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=t_.pool.get();return a.set(i,n,e),a}this.advance(1)}},n.scanToCharacter=function(e){for(;this.getCurChar()!==e&&!this.isEnd();)this.advance(1);this.advance(1)},n.createCompileError=function(e,t){return th.createGSError(e,tp.CompilationError,this.source,null!=t?t:this.getShaderPosition(0))},n._scanWord=function(e){for(;tK.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:ti.ID,o=rc.createRange(e,n),s=t_.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 tK.isWhiteSpaceChar(e,!0)||r._isWordSeparatorChar(e)},r._isWordSeparatorChar=function(e){return 123===e||125===e||61===e||59===e||46===e||91===e||40===e},r._scanDigits=function(e,t){for(var r=t;r<e.length;){var n=e.charCodeAt(r);if(tK.isDigit(n))r++;else break}return r},r}(tK);ro._keywordLexemeTable={RenderQueueType:ta.GSRenderQueueType,BlendState:ta.GSBlendState,DepthState:ta.GSDepthState,StencilState:ta.GSStencilState,RasterState:ta.GSRasterState,EditorProperties:ta.GSEditorProperties,EditorMacros:ta.GSEditorMacros,Editor:ta.GSEditor,Tags:ta.GSTags,VertexShader:ta.GSVertexShader,FragmentShader:ta.GSFragmentShader,SubShader:ta.GSSubShader,Pass:ta.GSPass,BlendFactor:ta.GSBlendFactor,BlendOperation:ta.GSBlendOperation,Bool:ta.GSBool,Number:ta.GSNumber,Color:ta.GSColor,CompareFunction:ta.GSCompareFunction,StencilOperation:ta.GSStencilOperation,CullMode:ta.GSCullMode,UsePass:ta.GSUsePass,true:ta.True,false:ta.False},ro._symbolLexemeTable={"{":ta.LeftBrace,"}":ta.RightBrace,"=":ta.Equal};var rs=/*#__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++)for(var l=i.subShaders[s],u=a.concat(l.pendingContents),p=rn({},o.constantMap,l.renderStates.constantMap),h=rn({},o.variableMap,l.renderStates.variableMap),_=0,f=l.passes.length;_<f;_++){var d=l.passes[_];if(Object.assign(d.renderStates.constantMap,p),Object.assign(d.renderStates.variableMap,h),!d.isUsePass){var m=u.concat(d.pendingContents);d.contents=m.map(function(e){return e.content}).join("\n")}}return t.Logger.info("[Task - Source compilation] cost time "+(performance.now()-r)+"ms"),i},e._parseShader=function(e){e.scanLexeme("Shader");var t=e.scanPairedChar('"','"',!1,!1),r=ri.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 ta.GSSubShader:this._addPendingContents(i,o.lexeme.length,a);var s=this._parseSubShader();r.subShaders.push(s),i=e.getShaderPosition(0);break;case ta.GSEditorProperties:case ta.GSEditorMacros:case ta.GSEditor:this._addPendingContents(i,o.lexeme.length,a),e.scanPairedChar("{","}",!0,!1),i=e.getShaderPosition(0);break;case ta.LeftBrace:++n;break;case ta.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===ti.ID){r.scanLexeme("{");var i=this._parseRenderStateProperties(t.lexeme),a=new ra(n.lexeme,t.type,i);this._symbolTableStack.insert(a)}else if("="===n.lexeme){var o=r.scanToken();r.scanLexeme(";");var s=this._lookupSymbol;s.set(o.lexeme,t.type);var c=this._symbolTableStack.lookup(s);if(!(null==c?void 0:c.value)){this._createCompileError('Invalid "'+t.lexeme+'" variable: '+o.lexeme,o.location);return}var l=c.value;Object.assign(e.constantMap,l.constantMap),Object.assign(e.variableMap,l.variableMap);return}},e._parseVariableDeclaration=function(){var e=this._lexer,t=e.scanToken();e.scanLexeme(";");var r=new ra(t.lexeme,t.type);this._symbolTableStack.insert(r)},e._pushScope=function(){var e=new tL;this._symbolTableStack.pushScope(e)},e._popScope=function(){this._symbolTableStack.popScope()},e._parseRenderStateProperties=function(e){for(var t=this._lexer,r=ri.createRenderStates();"}"!==t.getCurChar();)this._parseRenderStateProperty(e,r),t.skipCommentsAndSpace();return t.advance(1),r},e._createCompileError=function(e,t){var r=this._lexer.createCompileError(e,t);this.errors.push(r)},e._parseRenderStateProperty=function(e,r){var n=this._lexer,i=n.scanToken().lexeme,a=i;if("BlendState"===e&&"BlendColor"!==i&&"AlphaToCoverage"!==i){var o=0,s=n.scanTwoExpectedLexemes("[","=");if("["===s)o=n.scanNumber(),n.scanLexeme("]"),n.scanLexeme("=");else if("="!==s){this._createCompileError("Invalid syntax, expect '[' or '=', but got unexpected token"),n.scanToCharacter(";");return}a+=o}else n.scanLexeme("=");var c=t.RenderStateElementKey[e+a];if(void 0===c){this._createCompileError("Invalid render state property "+i),n.scanToCharacter(";");return}n.skipCommentsAndSpace();var l=n.getCurCharCode();if(tK.isDigit(l)||46===l)h=n.scanNumber();else{var u=n.scanToken(),p=u.type;if(p===ta.True)h=!0;else if(p===ta.False)h=!1;else if(p===ta.GSColor)h=n.scanColor();else if("."===n.getCurChar()){n.advance(1);var h,_,f=n.scanToken();if(void 0==(h=null==(_=this._renderStateConstMap[u.lexeme])?void 0:_[f.lexeme])){this._createCompileError("Invalid engine constant: "+u.lexeme+"."+f.lexeme,f.location),n.scanToCharacter(";");return}}else{h=u.lexeme;var d=this._lookupSymbol;if(d.set(u.lexeme,ti.ID),!this._symbolTableStack.lookup(d)){this._createCompileError("Invalid "+e+" variable: "+u.lexeme,u.location),n.scanToCharacter(";");return}}}n.scanLexeme(";"),"string"==typeof h?r.variableMap[c]=h:r.constantMap[c]=h},e._parseRenderQueueDeclarationOrAssignment=function(e){var r=this._lexer,n=r.scanToken();if(n.type===ti.ID){r.scanLexeme(";");var i=new ra(n.lexeme,ta.GSRenderQueueType);this._symbolTableStack.insert(i);return}if("="!==n.lexeme){this._createCompileError("Invalid syntax, expect character '=', but got "+n.lexeme,n.location);return}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;if(c.set(a.lexeme,ta.GSRenderQueueType),!this._symbolTableStack.lookup(c)){this._createCompileError("Invalid RenderQueueType variable: "+a.lexeme,a.location);return}}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:rn({},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=ri.createSubShaderSource(r);e.scanLexeme("{"),e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0);;){var a=e.scanToken();switch(a.type){case ta.GSPass:this._addPendingContents(i,a.lexeme.length,n.pendingContents);var o=this._parsePass();n.passes.push(o),i=e.getShaderPosition(0);break;case ta.GSUsePass:this._addPendingContents(i,a.lexeme.length,n.pendingContents);var s=e.scanPairedChar('"','"',!1,!1);n.passes.push(ri.createUsePass(s)),i=e.getShaderPosition(0);break;case ta.LeftBrace:++t;break;case ta.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,r=e.scanPairedChar('"','"',!1,!1),n=ri.createShaderPassSource(r);e.scanLexeme("{");var i=1;e.skipCommentsAndSpace();for(var a=e.getShaderPosition(0);;){var o=e.scanToken();switch(o.type){case ta.GSVertexShader:case ta.GSFragmentShader:this._addPendingContents(a,o.lexeme.length,n.pendingContents),e.scanLexeme("=");var s=e.scanToken();if(n[o.lexeme]){var c=th.createGSError("Reassign main entry",tp.CompilationError,e.source,e.getShaderPosition(0));throw t.Logger.error(c.toString()),c}n[o.type===ta.GSVertexShader?"vertexEntry":"fragmentEntry"]=s.lexeme,e.scanLexeme(";"),a=e.getShaderPosition(0);break;case ta.LeftBrace:++i;break;case ta.RightBrace:if(0==--i)return this._addPendingContents(a,o.lexeme.length,n.pendingContents),this._popScope(),n;break;default:a=this._parseRenderStateAndTags(o,a,n.pendingContents,n.renderStates,n.tags)}}},e._parseRenderStateAndTags=function(e,t,r,n,i){return e.type===ta.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 ta.GSBlendState:case ta.GSDepthState:case ta.GSRasterState:case ta.GSStencilState:this._addPendingContents(t,e.lexeme.length,r),this._parseRenderStateDeclarationOrAssignment(n,e),t=this._lexer.getShaderPosition(0);break;case ta.GSBlendFactor:case ta.GSBlendOperation:case ta.GSBool:case ta.GSNumber:case ta.GSColor:case ta.GSCompareFunction:case ta.GSStencilOperation:case ta.GSCullMode:this._addPendingContents(t,e.lexeme.length,r),this._parseVariableDeclaration(),t=this._lexer.getShaderPosition(0);break;case ta.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}();rs.errors=[],rs._renderStateConstMap={RenderQueueType:t.RenderQueueType,CompareFunction:t.CompareFunction,StencilOperation:t.StencilOperation,BlendOperation:t.BlendOperation,BlendFactor:t.BlendFactor,CullMode:t.CullMode},rs._symbolTableStack=new tP,rs._lexer=new ro,rs._lookupSymbol=new ra("",null);var rc=/*#__PURE__*/function(){function e(){}var r=e.prototype;return r._parseShaderSource=function(e){th.clearAllShaderLabObjectPool();var t=rs.parse(e);return this._logErrors(rs.errors),t},r._parseShaderPass=function(r,n,i,a,o){var s=performance.now(),c={};tE._repeatIncludeSet.clear();var l=tE.parse(r,o,c);t.Logger.info("[Task - Pre processor] cost time "+(performance.now()-s)+"ms");var u=new tJ(l,c).tokenize(),p=e._parser;e._processingPassText=l;var h=p.parse(u,c);if(this._logErrors(p.errors),h){var _=a===t.ShaderLanguage.GLSLES100?tX.getVisitor():tY.getVisitor(),f=performance.now(),d=_.visitShaderProgram(h,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,this._logErrors(_.errors),d}},r._parseMacros=function(e,r){var n=performance.now(),i=t6.parse(e,r);return t.Logger.info("[Task - parse macros] cost time: "+(performance.now()-n)+"ms"),this._logErrors(t6._errors),i},r._logErrors=function(e){if(0!==e.length&&t.Logger.isEnabled){t.Logger.error(""+e.length+" errors occur!");for(var r,i=n(e);!(r=i()).done;){var a=r.value;t.Logger.error(a.toString())}}},e.createPosition=function(e,t,r){var n=this._shaderPositionPool.get();return n.set(e,t,r),n},e.createRange=function(e,t){var r=this._shaderRangePool.get();return r.set(e,t),r},e}();rc._parser=rr.create(),rc._shaderPositionPool=th.createObjectPool(tn),rc._shaderRangePool=th.createObjectPool(tr);var rl="1.6.0-beta.0";console.log("Galacean Engine ShaderLab Version: "+rl+" | Mode: Verbose"),e.GSError=tu,e.GSErrorName=tp,e.ShaderLab=rc,e.version=rl,Object.defineProperty(e,"__esModule",{value:!0})});
2
2
  //# sourceMappingURL=browser.verbose.min.js.map