@galacean/engine-shaderlab 1.5.14 → 1.6.0-alpha.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.
- package/dist/browser.js +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/browser.verbose.js +1 -1
- package/dist/browser.verbose.js.map +1 -1
- package/dist/browser.verbose.min.js +1 -1
- package/dist/browser.verbose.min.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/main.verbose.js +1 -1
- package/dist/main.verbose.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.verbose.js +1 -1
- package/dist/module.verbose.js.map +1 -1
- package/package.json +4 -4
|
@@ -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.5.14";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,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.0";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})});
|
|
2
2
|
//# sourceMappingURL=browser.verbose.min.js.map
|