@galacean/cli 2.0.0-alpha.26 → 2.0.0-alpha.27
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/cli.bundle.cjs +671 -777
- package/dist/preview-client/_static/{Accordion-2cd014f1.js → Accordion-4afac60c.js} +1 -1
- package/dist/preview-client/_static/{AmbientLightAsset-be9e872c.js → AmbientLightAsset-3825f3bf.js} +2 -2
- package/dist/preview-client/_static/{AnimationClipAsset-d7b37af0.js → AnimationClipAsset-660ecb36.js} +1 -1
- package/dist/preview-client/_static/{AnimatorControllerAsset-2716497a.js → AnimatorControllerAsset-dcf11a9d.js} +1 -1
- package/dist/preview-client/_static/{AnimatorStore-883a28ad.js → AnimatorStore-aa58d85c.js} +1 -1
- package/dist/preview-client/_static/{AssetViewer-3847c058.js → AssetViewer-8338dfe1.js} +1 -1
- package/dist/preview-client/_static/{AudioAsset-c28f33ab.js → AudioAsset-6e607154.js} +1 -1
- package/dist/preview-client/_static/{AudioComponent-3d6c73ce.js → AudioComponent-b70cc31e.js} +1 -1
- package/dist/preview-client/_static/{Callout-e2a89f6f.js → Callout-155c30df.js} +1 -1
- package/dist/preview-client/_static/{CameraComponent-3dc63451.js → CameraComponent-76bc9102.js} +1 -1
- package/dist/preview-client/_static/{Component-0f881fc1.js → Component-398551a0.js} +1 -1
- package/dist/preview-client/_static/{DirectLight-96dbba47.js → DirectLight-50653e81.js} +1 -1
- package/dist/preview-client/_static/{FontAsset-d34b5378.js → FontAsset-dc385d41.js} +1 -1
- package/dist/preview-client/_static/{FormItemArray-b8cda1d2.js → FormItemArray-9ca61884.js} +1 -1
- package/dist/preview-client/_static/{GlTFAsset-5970e707.js → GlTFAsset-d2ee4f95.js} +1 -1
- package/dist/preview-client/_static/{IconPlus-def01e2b.js → IconPlus-b3ed4c04.js} +1 -1
- package/dist/preview-client/_static/{IconPointFilled-62d3c3b2.js → IconPointFilled-3ba6d082.js} +1 -1
- package/dist/preview-client/_static/{LightBaseComponent-d651a276.js → LightBaseComponent-4cfc9f48.js} +1 -1
- package/dist/preview-client/_static/{LottieAnimationComponent-f10dc558.js → LottieAnimationComponent-aeb555ea.js} +1 -1
- package/dist/preview-client/_static/{MarkdownAsset-b2a3fad5.js → MarkdownAsset-02477e7c.js} +1 -1
- package/dist/preview-client/_static/{MaterialAsset-5353c4cb.js → MaterialAsset-8f3b3302.js} +1 -1
- package/dist/preview-client/_static/{MaterialInspector-8d466d59.js → MaterialInspector-3fb471d9.js} +1 -1
- package/dist/preview-client/_static/{Menu-c8e6194b.js → Menu-36c201c0.js} +1 -1
- package/dist/preview-client/_static/{MeshAsset-c2bf60c5.js → MeshAsset-3ddf1ac6.js} +1 -1
- package/dist/preview-client/_static/{MeshRendererBaseComponent-fde6b6a5.js → MeshRendererBaseComponent-cd8b743b.js} +1 -1
- package/dist/preview-client/_static/{MeshRendererComponent-430774ef.js → MeshRendererComponent-17a7fc72.js} +1 -1
- package/dist/preview-client/_static/{MeshThumbnail-07ffa076.js → MeshThumbnail-8c20ee92.js} +1 -1
- package/dist/preview-client/_static/{ParticleRendererComponent-e106bd8c.js → ParticleRendererComponent-1834a159.js} +3 -3
- package/dist/preview-client/_static/{PhysicsMaterialAsset-a2f73b5c.js → PhysicsMaterialAsset-e0491877.js} +1 -1
- package/dist/preview-client/_static/{PhysicsStore-818c2f61.js → PhysicsStore-ab32886e.js} +1 -1
- package/dist/preview-client/_static/{PointLight-add790ea.js → PointLight-97975350.js} +1 -1
- package/dist/preview-client/_static/{PostProcessComponent-af270a77.js → PostProcessComponent-9590ec29.js} +1 -1
- package/dist/preview-client/_static/PrefabAsset-2f94de73.js +1 -0
- package/dist/preview-client/_static/{PrimitiveMesh-075dda8a.js → PrimitiveMesh-0492d482.js} +1 -1
- package/dist/preview-client/_static/{ReferencedMaterial-d11151b5.js → ReferencedMaterial-49a7cbcc.js} +1 -1
- package/dist/preview-client/_static/{RenderTargetAsset-b3cd1c49.js → RenderTargetAsset-dc1f9494.js} +1 -1
- package/dist/preview-client/_static/{SceneAsset-08752701.js → SceneAsset-c3bb667f.js} +1 -1
- package/dist/preview-client/_static/{ShaderAsset-a9d667f5.js → ShaderAsset-f4eead79.js} +12 -12
- package/dist/preview-client/_static/{ShaderChunkAsset-e43dde8a.js → ShaderChunkAsset-4bea2733.js} +2 -2
- package/dist/preview-client/_static/{ShaderUIScriptAsset-e1cd0b8b.js → ShaderUIScriptAsset-3c731f3b.js} +2 -2
- package/dist/preview-client/_static/{SkinnedMeshRendererComponent-9756bd5f.js → SkinnedMeshRendererComponent-e0f9b133.js} +1 -1
- package/dist/preview-client/_static/{SpineAnimationComponent-f3e0ff44.js → SpineAnimationComponent-1e1655fd.js} +1 -1
- package/dist/preview-client/_static/{SpineSkeletonDataAsset-43b731f1.js → SpineSkeletonDataAsset-afb4afae.js} +1 -1
- package/dist/preview-client/_static/{SpotLight-649b0e21.js → SpotLight-69f361c9.js} +1 -1
- package/dist/preview-client/_static/{SpriteBaseComponent-d2a7ab4c.js → SpriteBaseComponent-2c2454ea.js} +1 -1
- package/dist/preview-client/_static/{SpriteMaskComponent-2c1cef5e.js → SpriteMaskComponent-a7ebcc50.js} +1 -1
- package/dist/preview-client/_static/{SpriteRendererComponent-33b71997.js → SpriteRendererComponent-f7604c68.js} +1 -1
- package/dist/preview-client/_static/{TextBaseComponent-9310e0c6.js → TextBaseComponent-cd7ad9f7.js} +1 -1
- package/dist/preview-client/_static/{TextRendererComponent-8dc0d7fb.js → TextRendererComponent-a5357d52.js} +1 -1
- package/dist/preview-client/_static/{TextureAsset-a7ff39b1.js → TextureAsset-ff089b5a.js} +1 -1
- package/dist/preview-client/_static/{Tooltip-b5be390f.js → Tooltip-1bcb87b5.js} +1 -1
- package/dist/preview-client/_static/{TrailRendererComponent-c4635fab.js → TrailRendererComponent-cdefa368.js} +1 -1
- package/dist/preview-client/_static/{TransformBaseComponent-1473deaa.js → TransformBaseComponent-d26ff236.js} +1 -1
- package/dist/preview-client/_static/{TransformComponent-e544f7ac.js → TransformComponent-4ec4b7b5.js} +1 -1
- package/dist/preview-client/_static/{XRReferenceImageAsset-96f516ba.js → XRReferenceImageAsset-ff82ab30.js} +1 -1
- package/dist/preview-client/_static/{audio-b5fbde34.js → audio-0a013eb6.js} +1 -1
- package/dist/preview-client/_static/{createOnModelChange-370b83da.js → createOnModelChange-89f572a6.js} +1 -1
- package/dist/preview-client/_static/{createReactComponent-58d9f0dd.js → createReactComponent-baa41397.js} +1 -1
- package/dist/preview-client/_static/index-0086cabc.js +1 -0
- package/dist/preview-client/_static/index-253f9e13.js +1 -0
- package/dist/preview-client/_static/{index-da16047f.js → index-29916a80.js} +1 -1
- package/dist/preview-client/_static/{index-ab8556cb.js → index-4845b67c.js} +3 -3
- package/dist/preview-client/_static/{index-dd0763bf.js → index-5e4dedda.js} +1 -1
- package/dist/preview-client/_static/{index-0dd5bb36.js → index-70967035.js} +1 -1
- package/dist/preview-client/_static/index-8234e4e2.js +1 -0
- package/dist/preview-client/_static/{index-88650db7.js → index-8784a43a.js} +1 -1
- package/dist/preview-client/_static/index-94594d06.js +1 -0
- package/dist/preview-client/_static/{index-74bcfad9.js → index-a0afef01.js} +1 -1
- package/dist/preview-client/_static/index-ad57c6c8.js +1 -0
- package/dist/preview-client/_static/{index-c3dec278.js → index-b126bb6b.js} +72 -72
- package/dist/preview-client/_static/{index-cdbb2f4d.js → index-c8ed2a45.js} +1 -1
- package/dist/preview-client/_static/{index-05b76766.js → index-cd09e78a.js} +1 -1
- package/dist/preview-client/_static/index-d1484803.js +1 -0
- package/dist/preview-client/_static/index-f7fcda86.js +1 -0
- package/dist/preview-client/_static/{ktx2-encoder-db93524f.js → ktx2-encoder-8498815e.js} +1 -1
- package/dist/preview-client/_static/{module-ada3dced.js → module-113ac03a.js} +1 -1
- package/dist/preview-client/_static/{module-ec094ef6.js → module-83a57161.js} +1 -1
- package/dist/preview-client/_static/{module-de7ee724.js → module-8efda49c.js} +1 -1
- package/dist/preview-client/_static/{postmen-2853c0e6.js → postmen-3b48c572.js} +2 -2
- package/dist/preview-client/_static/{shader-data-utils-f0e4f5a3.js → shader-data-utils-c90e48b8.js} +1 -1
- package/dist/preview-client/index.html +1 -1
- package/package.json +29 -24
- package/dist/preview-client/_static/PrefabAsset-59743dbb.js +0 -1
- package/dist/preview-client/_static/index-29c59aff.js +0 -1
- package/dist/preview-client/_static/index-3680d0e0.js +0 -1
- package/dist/preview-client/_static/index-42aa3a49.js +0 -1
- package/dist/preview-client/_static/index-496f331d.js +0 -1
- package/dist/preview-client/_static/index-9f0122f0.js +0 -1
- package/dist/preview-client/_static/index-c6b7045c.js +0 -1
- package/dist/preview-client/_static/index-dddcae01.js +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function B(e,c,i,t){var r=arguments.length,n=r<3?c:t===null?t=Object.getOwnPropertyDescriptor(c,i):t,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(e,c,i,t);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(c,i,n):s(c,i))||n);return r>3&&n&&Object.defineProperty(c,i,n),n}function mi(e,c){var i={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},t,r,n,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=l(0),s.throw=l(1),s.return=l(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(_){return function(S){return u([_,S])}}function u(_){if(t)throw new TypeError("Generator is already executing.");for(;s&&(s=0,_[0]&&(i=0)),i;)try{if(t=1,r&&(n=_[0]&2?r.return:_[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,_[1])).done)return n;switch(r=0,n&&(_=[_[0]&2,n.value]),_[0]){case 0:case 1:n=_;break;case 4:return i.label++,{value:_[1],done:!1};case 5:i.label++,r=_[1],_=[0];continue;case 7:_=i.ops.pop(),i.trys.pop();continue;default:if(n=i.trys,!(n=n.length>0&&n[n.length-1])&&(_[0]===6||_[0]===2)){i=0;continue}if(_[0]===3&&(!n||_[1]>n[0]&&_[1]<n[3])){i.label=_[1];break}if(_[0]===6&&i.label<n[1]){i.label=n[1],n=_;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(_);break}n[2]&&i.ops.pop(),i.trys.pop();continue}_=c.call(e,i)}catch(S){_=[6,S],r=0}finally{t=n=0}if(_[0]&5)throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}}var mr=function(){function e(){}var c=e.prototype;return c.set=function(t,r){this.start=t,this.end=r},c.dispose=function(){this.start.dispose(),this.end.dispose()},e}(),Sr=function(){function e(){}var c=e.prototype;return c.set=function(t){this.index=t},c.dispose=function(){this.index=0},e}(),h=function(e){return e[e.ID=1e3]="ID",e[e.FLOAT_CONSTANT=1001]="FLOAT_CONSTANT",e[e.INT_CONSTANT=1002]="INT_CONSTANT",e[e.STRING_CONST=1003]="STRING_CONST",e[e.LEFT_OP=1004]="LEFT_OP",e[e.RIGHT_OP=1005]="RIGHT_OP",e[e.INC_OP=1006]="INC_OP",e[e.DEC_OP=1007]="DEC_OP",e[e.LE_OP=1008]="LE_OP",e[e.GE_OP=1009]="GE_OP",e[e.EQ_OP=1010]="EQ_OP",e[e.NE_OP=1011]="NE_OP",e[e.AND_OP=1012]="AND_OP",e[e.OR_OP=1013]="OR_OP",e[e.XOR_OP=1014]="XOR_OP",e[e.MUL_ASSIGN=1015]="MUL_ASSIGN",e[e.DIV_ASSIGN=1016]="DIV_ASSIGN",e[e.ADD_ASSIGN=1017]="ADD_ASSIGN",e[e.SUB_ASSIGN=1018]="SUB_ASSIGN",e[e.MOD_ASSIGN=1019]="MOD_ASSIGN",e[e.LEFT_ASSIGN=1020]="LEFT_ASSIGN",e[e.RIGHT_ASSIGN=1021]="RIGHT_ASSIGN",e[e.AND_ASSIGN=1022]="AND_ASSIGN",e[e.XOR_ASSIGN=1023]="XOR_ASSIGN",e[e.OR_ASSIGN=1024]="OR_ASSIGN",e[e.LEFT_PAREN=1025]="LEFT_PAREN",e[e.RIGHT_PAREN=1026]="RIGHT_PAREN",e[e.LEFT_BRACKET=1027]="LEFT_BRACKET",e[e.RIGHT_BRACKET=1028]="RIGHT_BRACKET",e[e.LEFT_BRACE=1029]="LEFT_BRACE",e[e.RIGHT_BRACE=1030]="RIGHT_BRACE",e[e.DOT=1031]="DOT",e[e.COMMA=1032]="COMMA",e[e.COLON=1033]="COLON",e[e.EQUAL=1034]="EQUAL",e[e.SEMICOLON=1035]="SEMICOLON",e[e.BANG=1036]="BANG",e[e.DASH=1037]="DASH",e[e.TILDE=1038]="TILDE",e[e.PLUS=1039]="PLUS",e[e.STAR=1040]="STAR",e[e.SLASH=1041]="SLASH",e[e.PERCENT=1042]="PERCENT",e[e.LEFT_ANGLE=1043]="LEFT_ANGLE",e[e.RIGHT_ANGLE=1044]="RIGHT_ANGLE",e[e.VERTICAL_BAR=1045]="VERTICAL_BAR",e[e.CARET=1046]="CARET",e[e.AMPERSAND=1047]="AMPERSAND",e[e.QUESTION=1048]="QUESTION",e[e.NotWord=1049]="NotWord",e[e.EPSILON=1998]="EPSILON",e[e.EOF=1999]="EOF",e}({}),_e=3e3,a=function(e){return e[e.CONST=0]="CONST",e[e.BOOL=1]="BOOL",e[e.FLOAT=2]="FLOAT",e[e.DOUBLE=3]="DOUBLE",e[e.INT=4]="INT",e[e.UINT=5]="UINT",e[e.BREAK=6]="BREAK",e[e.CONTINUE=7]="CONTINUE",e[e.DO=8]="DO",e[e.ELSE=9]="ELSE",e[e.FOR=10]="FOR",e[e.IF=11]="IF",e[e.WHILE=12]="WHILE",e[e.DISCARD=13]="DISCARD",e[e.RETURN=14]="RETURN",e[e.BVEC2=15]="BVEC2",e[e.BVEC3=16]="BVEC3",e[e.BVEC4=17]="BVEC4",e[e.IVEC2=18]="IVEC2",e[e.IVEC3=19]="IVEC3",e[e.IVEC4=20]="IVEC4",e[e.UVEC2=21]="UVEC2",e[e.UVEC3=22]="UVEC3",e[e.UVEC4=23]="UVEC4",e[e.VEC2=24]="VEC2",e[e.VEC3=25]="VEC3",e[e.VEC4=26]="VEC4",e[e.VEC4_ARRAY=27]="VEC4_ARRAY",e[e.MAT2=28]="MAT2",e[e.MAT3=29]="MAT3",e[e.MAT4=30]="MAT4",e[e.MAT2X3=31]="MAT2X3",e[e.MAT2X4=32]="MAT2X4",e[e.MAT3X2=33]="MAT3X2",e[e.MAT3X4=34]="MAT3X4",e[e.MAT4X2=35]="MAT4X2",e[e.MAT4X3=36]="MAT4X3",e[e.IN=37]="IN",e[e.OUT=38]="OUT",e[e.INOUT=39]="INOUT",e[e.CENTROID=40]="CENTROID",e[e.SAMPLER2D=41]="SAMPLER2D",e[e.SAMPLER3D=42]="SAMPLER3D",e[e.SAMPLER_CUBE=43]="SAMPLER_CUBE",e[e.SAMPLER2D_SHADOW=44]="SAMPLER2D_SHADOW",e[e.SAMPLER_CUBE_SHADOW=45]="SAMPLER_CUBE_SHADOW",e[e.SAMPLER2D_ARRAY=46]="SAMPLER2D_ARRAY",e[e.SAMPLER2D_ARRAY_SHADOW=47]="SAMPLER2D_ARRAY_SHADOW",e[e.I_SAMPLER2D=48]="I_SAMPLER2D",e[e.I_SAMPLER3D=49]="I_SAMPLER3D",e[e.I_SAMPLER_CUBE=50]="I_SAMPLER_CUBE",e[e.I_SAMPLER2D_ARRAY=51]="I_SAMPLER2D_ARRAY",e[e.U_SAMPLER2D=52]="U_SAMPLER2D",e[e.U_SAMPLER3D=53]="U_SAMPLER3D",e[e.U_SAMPLER_CUBE=54]="U_SAMPLER_CUBE",e[e.U_SAMPLER2D_ARRAY=55]="U_SAMPLER2D_ARRAY",e[e.STRUCT=56]="STRUCT",e[e.LAYOUT=57]="LAYOUT",e[e.LOCATION=58]="LOCATION",e[e.VOID=59]="VOID",e[e.PRECISION=60]="PRECISION",e[e.PRECISE=61]="PRECISE",e[e.HIGHP=62]="HIGHP",e[e.MEDIUMP=63]="MEDIUMP",e[e.LOWP=64]="LOWP",e[e.INVARIANT=65]="INVARIANT",e[e.SMOOTH=66]="SMOOTH",e[e.FLAT=67]="FLAT",e[e.NOPERSPECTIVE=68]="NOPERSPECTIVE",e[e.True=69]="True",e[e.False=70]="False",e[e.LeftBrace=71]="LeftBrace",e[e.RightBrace=72]="RightBrace",e[e.Equal=73]="Equal",e[e.BitwiseOr=74]="BitwiseOr",e[e.GSRenderQueueType=75]="GSRenderQueueType",e[e.GSBlendState=76]="GSBlendState",e[e.GSDepthState=77]="GSDepthState",e[e.GSStencilState=78]="GSStencilState",e[e.GSRasterState=79]="GSRasterState",e[e.GSEditorProperties=80]="GSEditorProperties",e[e.GSEditorMacros=81]="GSEditorMacros",e[e.GSEditor=82]="GSEditor",e[e.GSTags=83]="GSTags",e[e.GSVertexShader=84]="GSVertexShader",e[e.GSFragmentShader=85]="GSFragmentShader",e[e.GSSubShader=86]="GSSubShader",e[e.GSPass=87]="GSPass",e[e.GSBlendFactor=88]="GSBlendFactor",e[e.GSBlendOperation=89]="GSBlendOperation",e[e.GSBool=90]="GSBool",e[e.GSNumber=91]="GSNumber",e[e.GSColor=92]="GSColor",e[e.GSCompareFunction=93]="GSCompareFunction",e[e.GSStencilOperation=94]="GSStencilOperation",e[e.GSCullMode=95]="GSCullMode",e[e.GSColorWriteMask=96]="GSColorWriteMask",e[e.GSUsePass=97]="GSUsePass",e[e.MACRO_IF=98]="MACRO_IF",e[e.MACRO_IFDEF=99]="MACRO_IFDEF",e[e.MACRO_IFNDEF=100]="MACRO_IFNDEF",e[e.MACRO_ELSE=101]="MACRO_ELSE",e[e.MACRO_ELIF=102]="MACRO_ELIF",e[e.MACRO_ENDIF=103]="MACRO_ENDIF",e[e.MACRO_UNDEF=104]="MACRO_UNDEF",e[e.MACRO_DEFINE_EXPRESSION=105]="MACRO_DEFINE_EXPRESSION",e[e.MACRO_CONDITIONAL_EXPRESSION=106]="MACRO_CONDITIONAL_EXPRESSION",e[e.MACRO_CALL=107]="MACRO_CALL",e[e.MACRO_DEFINE=108]="MACRO_DEFINE",e[e.MACRO_DEFINE_END=109]="MACRO_DEFINE_END",e[e.MACRO_DEFINE_PARAMS=110]="MACRO_DEFINE_PARAMS",e}({}),xe=function(){function e(){}return e.createObjectPool=function(i){var t=new Gr(i);return e._shaderCompilerObjectPoolSet.push(t),t},e.clearAllShaderCompilerObjectPool=function(){for(var i=0,t=e._shaderCompilerObjectPoolSet.length;i<t;i++)e._shaderCompilerObjectPoolSet[i].clear()},e.createGSError=function(i,t,r,n,s){console.error(i);var l=new Error(i);return l.name=t,l},e}();xe._shaderCompilerObjectPoolSet=[];var Xt=[],w=function(){function e(){this.branch=Xt}var c=e.prototype;return c.set=function(t,r,n){if(this.type=t,this.lexeme=r,this.branch=Xt,n)if(R(n,mr))this.location=n;else{var s=Ce.createPosition(n.index+r.length);this.location=Ce.createRange(n,s)}},c.dispose=function(){},e}();w.pool=xe.createObjectPool(w);var wt=new w;wt.set(h.EOF,"/EOF");var o=function(e){return e[e.START=2e3]="START",e[e.gs_shader_program=2001]="gs_shader_program",e[e.global_declaration=2002]="global_declaration",e[e.variable_declaration=2003]="variable_declaration",e[e.variable_declaration_list=2004]="variable_declaration_list",e[e.variable_declaration_statement=2005]="variable_declaration_statement",e[e.array_specifier_list=2006]="array_specifier_list",e[e.array_specifier=2007]="array_specifier",e[e.ext_builtin_type_specifier_nonarray=2008]="ext_builtin_type_specifier_nonarray",e[e.precision_specifier=2009]="precision_specifier",e[e.variable_identifier=2010]="variable_identifier",e[e.variable_identifier_node=2011]="variable_identifier_node",e[e.primary_expression=2012]="primary_expression",e[e.postfix_expression=2013]="postfix_expression",e[e.integer_expression=2014]="integer_expression",e[e.function_call=2015]="function_call",e[e.function_call_generic=2016]="function_call_generic",e[e.function_call_header_no_parameters=2017]="function_call_header_no_parameters",e[e.function_call_header_with_parameters=2018]="function_call_header_with_parameters",e[e.function_call_parameter_list=2019]="function_call_parameter_list",e[e.function_call_header=2020]="function_call_header",e[e.function_identifier=2021]="function_identifier",e[e.constructor_identifier=2022]="constructor_identifier",e[e.unary_expression=2023]="unary_expression",e[e.unary_operator=2024]="unary_operator",e[e.multiplicative_expression=2025]="multiplicative_expression",e[e.additive_expression=2026]="additive_expression",e[e.shift_expression=2027]="shift_expression",e[e.relational_expression=2028]="relational_expression",e[e.equality_expression=2029]="equality_expression",e[e.and_expression=2030]="and_expression",e[e.inclusive_or_expression=2031]="inclusive_or_expression",e[e.exclusive_or_expression=2032]="exclusive_or_expression",e[e.logical_and_expression=2033]="logical_and_expression",e[e.logical_xor_expression=2034]="logical_xor_expression",e[e.logical_or_expression=2035]="logical_or_expression",e[e.conditional_expression=2036]="conditional_expression",e[e.assignment_expression=2037]="assignment_expression",e[e.assignment_operator=2038]="assignment_operator",e[e.expression=2039]="expression",e[e.integer_constant_expression=2040]="integer_constant_expression",e[e.integer_constant_expression_operator=2041]="integer_constant_expression_operator",e[e.declaration=2042]="declaration",e[e.function_prototype=2043]="function_prototype",e[e.function_declarator=2044]="function_declarator",e[e.function_header_with_parameters=2045]="function_header_with_parameters",e[e.function_header=2046]="function_header",e[e.function_parameter_list=2047]="function_parameter_list",e[e.parameter_declarator=2048]="parameter_declarator",e[e.parameter_declaration=2049]="parameter_declaration",e[e.parameter_qualifier=2050]="parameter_qualifier",e[e.parameter_type_specifier=2051]="parameter_type_specifier",e[e.init_declarator_list=2052]="init_declarator_list",e[e.single_declaration=2053]="single_declaration",e[e.fully_specified_type=2054]="fully_specified_type",e[e.type_qualifier=2055]="type_qualifier",e[e.single_type_qualifier=2056]="single_type_qualifier",e[e.storage_qualifier=2057]="storage_qualifier",e[e.precision_qualifier=2058]="precision_qualifier",e[e.interpolation_qualifier=2059]="interpolation_qualifier",e[e.invariant_qualifier=2060]="invariant_qualifier",e[e.type_specifier=2061]="type_specifier",e[e.type_specifier_nonarray=2062]="type_specifier_nonarray",e[e.type_specifier_no_prec=2063]="type_specifier_no_prec",e[e.basic_type=2064]="basic_type",e[e.struct_specifier=2065]="struct_specifier",e[e.struct_declaration_list=2066]="struct_declaration_list",e[e.struct_declaration=2067]="struct_declaration",e[e.layout_qualifier=2068]="layout_qualifier",e[e.struct_declarator_list=2069]="struct_declarator_list",e[e.struct_declarator=2070]="struct_declarator",e[e.identifier_list=2071]="identifier_list",e[e.decl_identifier=2072]="decl_identifier",e[e.initializer=2073]="initializer",e[e.initializer_list=2074]="initializer_list",e[e.declaration_statement=2075]="declaration_statement",e[e.simple_statement=2076]="simple_statement",e[e.compound_statement_no_scope=2077]="compound_statement_no_scope",e[e.statement_with_scope=2078]="statement_with_scope",e[e.compound_statement=2079]="compound_statement",e[e.statement=2080]="statement",e[e.statement_list=2081]="statement_list",e[e.iteration_statement_no_new_scope=2082]="iteration_statement_no_new_scope",e[e.expression_statement=2083]="expression_statement",e[e.selection_statement=2084]="selection_statement",e[e.selection_rest_statement=2085]="selection_rest_statement",e[e.condition=2086]="condition",e[e.conditionopt=2087]="conditionopt",e[e.iteration_statement=2088]="iteration_statement",e[e.for_init_statement=2089]="for_init_statement",e[e.for_rest_statement=2090]="for_rest_statement",e[e.jump_statement=2091]="jump_statement",e[e.external_declaration=2092]="external_declaration",e[e.function_definition=2093]="function_definition",e[e.field_selection=2094]="field_selection",e[e.bool_constant=2095]="bool_constant",e[e.function_identifier_node=2096]="function_identifier_node",e[e.typename_identifier_node=2097]="typename_identifier_node",e[e.scope_brace=2098]="scope_brace",e[e.scope_end_brace=2099]="scope_end_brace",e[e.macro_undef=2100]="macro_undef",e[e.macro_push_context=2101]="macro_push_context",e[e.macro_pop_context=2102]="macro_pop_context",e[e.macro_elif_expression=2103]="macro_elif_expression",e[e.macro_else_expression=2104]="macro_else_expression",e[e.global_macro_if_statement=2105]="global_macro_if_statement",e[e.global_macro_declaration=2106]="global_macro_declaration",e[e.global_macro_branch=2107]="global_macro_branch",e[e.macro_struct_declaration=2108]="macro_struct_declaration",e[e.macro_struct_branch=2109]="macro_struct_branch",e[e.macro_if_statement=2110]="macro_if_statement",e[e.macro_branch=2111]="macro_branch",e[e.macro_param_case_list=2112]="macro_param_case_list",e[e.macro_param_block=2113]="macro_param_block",e[e.macro_parameter_branch=2114]="macro_parameter_branch",e[e.macro_call_arg_case_list=2115]="macro_call_arg_case_list",e[e.macro_call_arg_block=2116]="macro_call_arg_block",e[e.macro_call_arg_branch=2117]="macro_call_arg_branch",e[e.macro_call_symbol=2118]="macro_call_symbol",e[e.macro_call_function=2119]="macro_call_function",e[e.macro_define=2120]="macro_define",e[e._ignore=2121]="_ignore",e}({}),Be=function(){function e(){}return e.unwrapNodeByType=function(i,t){var r=i.children[0];if(!R(r,w))return r.nt===t?r:e.unwrapNodeByType(r,t)},e.parseMacroParamList=function(i){var t=i.replace(/^\s*\(\s*|\s*\)\s*$/g,"");return t?t.split(",").map(function(r){return r.trim()}).filter(Boolean):[]},e.unwrapBareIdentifier=function(i,t){for(var r=i;;){if(R(r,P.VariableIdentifier))return r;if(t.allowParens&&R(r,P.PrimaryExpression)&&r.children.length===3){var n=r.children[1];if(!R(n,G))return;r=n;continue}if(R(r,P.ExpressionAstNode)&&r.children.length===1){var s=r.children[0];if(!R(s,G))return;r=s;continue}return}},e.extractDirectIdentLexeme=function(i){var t=e.unwrapBareIdentifier(i,{allowParens:!0});if(!t)return null;var r=t.children[0];return R(r,w)?r.lexeme:null},e.isTerminal=function(i){return i<o.START},e}();function gr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(gr=function(){return!!e})()}function Ne(e,c,i){return gr()?Ne=Reflect.construct:Ne=function(r,n,s){var l=[null];l.push.apply(l,n);var u=Function.bind.apply(r,l),_=new u;return s&&tt(_,s.prototype),_},Ne.apply(null,arguments)}function Qt(e){return Qt=Object.setPrototypeOf?Object.getPrototypeOf:function(i){return i.__proto__||Object.getPrototypeOf(i)},Qt(e)}function Si(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function Yt(e){var c=typeof Map=="function"?new Map:void 0;return Yt=function(i){if(i===null||!Si(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof c<"u"){if(c.has(i))return c.get(i);c.set(i,t)}function t(){return Ne(i,arguments,Qt(this).constructor)}return t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),tt(t,i)},Yt(e)}var Cr=function(e){D(c,e);function c(t,r,n,s,l){var u;return u=e.call(this,r)||this,u.location=n,u.source=s,u.file=l,u.name=t,u}var i=c.prototype;return i.toString=function(){var r=this,n=r.message,s=r.location,l=r.source;if(!l)return n;R(s,Sr)||(s.start,s.end),l.split(`
|
|
1
|
+
var Vr=Object.defineProperty;var Fr=(e,c,i)=>c in e?Vr(e,c,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[c]=i;var Ae=(e,c,i)=>(Fr(e,typeof c!="symbol"?c+"":c,i),i);import{dN as Gr,b3 as Ke,dO as Br,dP as Tr,ag as kr,dQ as Ur,dR as Wr,a2 as Nr,a1 as zr,af as Hr,dS as jr,dT as rr,dU as dr,dV as qr,aH as Xr,aJ as wr,av as Je,e as ht,C as ue,dW as Qr,aO as Yr,b1 as vr,b2 as ir,j as $r,u as Jr,ae as Nt,dX as Zr,F as ar,ai as nr,V as sr,bX as Kr,aT as ei,x as ti,c2 as ri,n as ii,o as ai,dY as ni,dZ as si,d_ as oi}from"./index-b126bb6b.js";import"./index-c8ed2a45.js";import"./postmen-3b48c572.js";import"./meshopt_simplifier.module-cd99529d.js";import{c as Re,t as ci,g as li,i as ui,E as or,b as pi,l as hi}from"./ShaderUIScriptAsset-3c731f3b.js";import{E as de,s as fi}from"./shader-data-utils-c90e48b8.js";import{I as _i}from"./IconPointFilled-3ba6d082.js";import{F as di}from"./index-cd09e78a.js";function vi(e,c){const{precompile:i,platformTarget:t=0,basePathForIncludeKey:r}=c,n=i(e,t,r);return JSON.stringify(n)}function R(e,c){return c!=null&&typeof Symbol<"u"&&c[Symbol.hasInstance]?!!c[Symbol.hasInstance](e):e instanceof c}function tt(e,c){return tt=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t},tt(e,c)}function D(e,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(c&&c.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),c&&tt(e,c)}function cr(e,c){for(var i=0;i<c.length;i++){var t=c[i];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}function be(e,c,i){return c&&cr(e.prototype,c),i&&cr(e,i),e}function lr(e,c){(c==null||c>e.length)&&(c=e.length);for(var i=0,t=new Array(c);i<c;i++)t[i]=e[i];return t}function mi(e,c){if(e){if(typeof e=="string")return lr(e,c);var i=Object.prototype.toString.call(e).slice(8,-1);if(i==="Object"&&e.constructor&&(i=e.constructor.name),i==="Map"||i==="Set")return Array.from(i);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return lr(e,c)}}function Y(e,c){var i=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=mi(e))||c&&e&&typeof e.length=="number"){i&&(e=i);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function B(e,c,i,t){var r=arguments.length,n=r<3?c:t===null?t=Object.getOwnPropertyDescriptor(c,i):t,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(e,c,i,t);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(c,i,n):s(c,i))||n);return r>3&&n&&Object.defineProperty(c,i,n),n}function Si(e,c){var i={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},t,r,n,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=l(0),s.throw=l(1),s.return=l(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(_){return function(S){return u([_,S])}}function u(_){if(t)throw new TypeError("Generator is already executing.");for(;s&&(s=0,_[0]&&(i=0)),i;)try{if(t=1,r&&(n=_[0]&2?r.return:_[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,_[1])).done)return n;switch(r=0,n&&(_=[_[0]&2,n.value]),_[0]){case 0:case 1:n=_;break;case 4:return i.label++,{value:_[1],done:!1};case 5:i.label++,r=_[1],_=[0];continue;case 7:_=i.ops.pop(),i.trys.pop();continue;default:if(n=i.trys,!(n=n.length>0&&n[n.length-1])&&(_[0]===6||_[0]===2)){i=0;continue}if(_[0]===3&&(!n||_[1]>n[0]&&_[1]<n[3])){i.label=_[1];break}if(_[0]===6&&i.label<n[1]){i.label=n[1],n=_;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(_);break}n[2]&&i.ops.pop(),i.trys.pop();continue}_=c.call(e,i)}catch(S){_=[6,S],r=0}finally{t=n=0}if(_[0]&5)throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}}var mr=function(){function e(){}var c=e.prototype;return c.set=function(t,r){this.start=t,this.end=r},c.dispose=function(){this.start.dispose(),this.end.dispose()},e}(),Sr=function(){function e(){}var c=e.prototype;return c.set=function(t){this.index=t},c.dispose=function(){this.index=0},e}(),h=function(e){return e[e.ID=1e3]="ID",e[e.FLOAT_CONSTANT=1001]="FLOAT_CONSTANT",e[e.INT_CONSTANT=1002]="INT_CONSTANT",e[e.STRING_CONST=1003]="STRING_CONST",e[e.LEFT_OP=1004]="LEFT_OP",e[e.RIGHT_OP=1005]="RIGHT_OP",e[e.INC_OP=1006]="INC_OP",e[e.DEC_OP=1007]="DEC_OP",e[e.LE_OP=1008]="LE_OP",e[e.GE_OP=1009]="GE_OP",e[e.EQ_OP=1010]="EQ_OP",e[e.NE_OP=1011]="NE_OP",e[e.AND_OP=1012]="AND_OP",e[e.OR_OP=1013]="OR_OP",e[e.XOR_OP=1014]="XOR_OP",e[e.MUL_ASSIGN=1015]="MUL_ASSIGN",e[e.DIV_ASSIGN=1016]="DIV_ASSIGN",e[e.ADD_ASSIGN=1017]="ADD_ASSIGN",e[e.SUB_ASSIGN=1018]="SUB_ASSIGN",e[e.MOD_ASSIGN=1019]="MOD_ASSIGN",e[e.LEFT_ASSIGN=1020]="LEFT_ASSIGN",e[e.RIGHT_ASSIGN=1021]="RIGHT_ASSIGN",e[e.AND_ASSIGN=1022]="AND_ASSIGN",e[e.XOR_ASSIGN=1023]="XOR_ASSIGN",e[e.OR_ASSIGN=1024]="OR_ASSIGN",e[e.LEFT_PAREN=1025]="LEFT_PAREN",e[e.RIGHT_PAREN=1026]="RIGHT_PAREN",e[e.LEFT_BRACKET=1027]="LEFT_BRACKET",e[e.RIGHT_BRACKET=1028]="RIGHT_BRACKET",e[e.LEFT_BRACE=1029]="LEFT_BRACE",e[e.RIGHT_BRACE=1030]="RIGHT_BRACE",e[e.DOT=1031]="DOT",e[e.COMMA=1032]="COMMA",e[e.COLON=1033]="COLON",e[e.EQUAL=1034]="EQUAL",e[e.SEMICOLON=1035]="SEMICOLON",e[e.BANG=1036]="BANG",e[e.DASH=1037]="DASH",e[e.TILDE=1038]="TILDE",e[e.PLUS=1039]="PLUS",e[e.STAR=1040]="STAR",e[e.SLASH=1041]="SLASH",e[e.PERCENT=1042]="PERCENT",e[e.LEFT_ANGLE=1043]="LEFT_ANGLE",e[e.RIGHT_ANGLE=1044]="RIGHT_ANGLE",e[e.VERTICAL_BAR=1045]="VERTICAL_BAR",e[e.CARET=1046]="CARET",e[e.AMPERSAND=1047]="AMPERSAND",e[e.QUESTION=1048]="QUESTION",e[e.NotWord=1049]="NotWord",e[e.EPSILON=1998]="EPSILON",e[e.EOF=1999]="EOF",e}({}),_e=3e3,a=function(e){return e[e.CONST=0]="CONST",e[e.BOOL=1]="BOOL",e[e.FLOAT=2]="FLOAT",e[e.DOUBLE=3]="DOUBLE",e[e.INT=4]="INT",e[e.UINT=5]="UINT",e[e.BREAK=6]="BREAK",e[e.CONTINUE=7]="CONTINUE",e[e.DO=8]="DO",e[e.ELSE=9]="ELSE",e[e.FOR=10]="FOR",e[e.IF=11]="IF",e[e.WHILE=12]="WHILE",e[e.DISCARD=13]="DISCARD",e[e.RETURN=14]="RETURN",e[e.BVEC2=15]="BVEC2",e[e.BVEC3=16]="BVEC3",e[e.BVEC4=17]="BVEC4",e[e.IVEC2=18]="IVEC2",e[e.IVEC3=19]="IVEC3",e[e.IVEC4=20]="IVEC4",e[e.UVEC2=21]="UVEC2",e[e.UVEC3=22]="UVEC3",e[e.UVEC4=23]="UVEC4",e[e.VEC2=24]="VEC2",e[e.VEC3=25]="VEC3",e[e.VEC4=26]="VEC4",e[e.VEC4_ARRAY=27]="VEC4_ARRAY",e[e.MAT2=28]="MAT2",e[e.MAT3=29]="MAT3",e[e.MAT4=30]="MAT4",e[e.MAT2X3=31]="MAT2X3",e[e.MAT2X4=32]="MAT2X4",e[e.MAT3X2=33]="MAT3X2",e[e.MAT3X4=34]="MAT3X4",e[e.MAT4X2=35]="MAT4X2",e[e.MAT4X3=36]="MAT4X3",e[e.IN=37]="IN",e[e.OUT=38]="OUT",e[e.INOUT=39]="INOUT",e[e.CENTROID=40]="CENTROID",e[e.SAMPLER2D=41]="SAMPLER2D",e[e.SAMPLER3D=42]="SAMPLER3D",e[e.SAMPLER_CUBE=43]="SAMPLER_CUBE",e[e.SAMPLER2D_SHADOW=44]="SAMPLER2D_SHADOW",e[e.SAMPLER_CUBE_SHADOW=45]="SAMPLER_CUBE_SHADOW",e[e.SAMPLER2D_ARRAY=46]="SAMPLER2D_ARRAY",e[e.SAMPLER2D_ARRAY_SHADOW=47]="SAMPLER2D_ARRAY_SHADOW",e[e.I_SAMPLER2D=48]="I_SAMPLER2D",e[e.I_SAMPLER3D=49]="I_SAMPLER3D",e[e.I_SAMPLER_CUBE=50]="I_SAMPLER_CUBE",e[e.I_SAMPLER2D_ARRAY=51]="I_SAMPLER2D_ARRAY",e[e.U_SAMPLER2D=52]="U_SAMPLER2D",e[e.U_SAMPLER3D=53]="U_SAMPLER3D",e[e.U_SAMPLER_CUBE=54]="U_SAMPLER_CUBE",e[e.U_SAMPLER2D_ARRAY=55]="U_SAMPLER2D_ARRAY",e[e.STRUCT=56]="STRUCT",e[e.LAYOUT=57]="LAYOUT",e[e.LOCATION=58]="LOCATION",e[e.VOID=59]="VOID",e[e.PRECISION=60]="PRECISION",e[e.PRECISE=61]="PRECISE",e[e.HIGHP=62]="HIGHP",e[e.MEDIUMP=63]="MEDIUMP",e[e.LOWP=64]="LOWP",e[e.INVARIANT=65]="INVARIANT",e[e.SMOOTH=66]="SMOOTH",e[e.FLAT=67]="FLAT",e[e.NOPERSPECTIVE=68]="NOPERSPECTIVE",e[e.True=69]="True",e[e.False=70]="False",e[e.LeftBrace=71]="LeftBrace",e[e.RightBrace=72]="RightBrace",e[e.Equal=73]="Equal",e[e.BitwiseOr=74]="BitwiseOr",e[e.GSRenderQueueType=75]="GSRenderQueueType",e[e.GSBlendState=76]="GSBlendState",e[e.GSDepthState=77]="GSDepthState",e[e.GSStencilState=78]="GSStencilState",e[e.GSRasterState=79]="GSRasterState",e[e.GSEditorProperties=80]="GSEditorProperties",e[e.GSEditorMacros=81]="GSEditorMacros",e[e.GSEditor=82]="GSEditor",e[e.GSTags=83]="GSTags",e[e.GSVertexShader=84]="GSVertexShader",e[e.GSFragmentShader=85]="GSFragmentShader",e[e.GSSubShader=86]="GSSubShader",e[e.GSPass=87]="GSPass",e[e.GSBlendFactor=88]="GSBlendFactor",e[e.GSBlendOperation=89]="GSBlendOperation",e[e.GSBool=90]="GSBool",e[e.GSNumber=91]="GSNumber",e[e.GSColor=92]="GSColor",e[e.GSCompareFunction=93]="GSCompareFunction",e[e.GSStencilOperation=94]="GSStencilOperation",e[e.GSCullMode=95]="GSCullMode",e[e.GSColorWriteMask=96]="GSColorWriteMask",e[e.GSUsePass=97]="GSUsePass",e[e.MACRO_IF=98]="MACRO_IF",e[e.MACRO_IFDEF=99]="MACRO_IFDEF",e[e.MACRO_IFNDEF=100]="MACRO_IFNDEF",e[e.MACRO_ELSE=101]="MACRO_ELSE",e[e.MACRO_ELIF=102]="MACRO_ELIF",e[e.MACRO_ENDIF=103]="MACRO_ENDIF",e[e.MACRO_UNDEF=104]="MACRO_UNDEF",e[e.MACRO_DEFINE_EXPRESSION=105]="MACRO_DEFINE_EXPRESSION",e[e.MACRO_CONDITIONAL_EXPRESSION=106]="MACRO_CONDITIONAL_EXPRESSION",e[e.MACRO_CALL=107]="MACRO_CALL",e[e.MACRO_DEFINE=108]="MACRO_DEFINE",e[e.MACRO_DEFINE_END=109]="MACRO_DEFINE_END",e[e.MACRO_DEFINE_PARAMS=110]="MACRO_DEFINE_PARAMS",e}({}),xe=function(){function e(){}return e.createObjectPool=function(i){var t=new Br(i);return e._shaderCompilerObjectPoolSet.push(t),t},e.clearAllShaderCompilerObjectPool=function(){for(var i=0,t=e._shaderCompilerObjectPoolSet.length;i<t;i++)e._shaderCompilerObjectPoolSet[i].clear()},e.createGSError=function(i,t,r,n,s){console.error(i);var l=new Error(i);return l.name=t,l},e}();xe._shaderCompilerObjectPoolSet=[];var Xt=[],w=function(){function e(){this.branch=Xt}var c=e.prototype;return c.set=function(t,r,n){if(this.type=t,this.lexeme=r,this.branch=Xt,n)if(R(n,mr))this.location=n;else{var s=Ce.createPosition(n.index+r.length);this.location=Ce.createRange(n,s)}},c.dispose=function(){},e}();w.pool=xe.createObjectPool(w);var wt=new w;wt.set(h.EOF,"/EOF");var o=function(e){return e[e.START=2e3]="START",e[e.gs_shader_program=2001]="gs_shader_program",e[e.global_declaration=2002]="global_declaration",e[e.variable_declaration=2003]="variable_declaration",e[e.variable_declaration_list=2004]="variable_declaration_list",e[e.variable_declaration_statement=2005]="variable_declaration_statement",e[e.array_specifier_list=2006]="array_specifier_list",e[e.array_specifier=2007]="array_specifier",e[e.ext_builtin_type_specifier_nonarray=2008]="ext_builtin_type_specifier_nonarray",e[e.precision_specifier=2009]="precision_specifier",e[e.variable_identifier=2010]="variable_identifier",e[e.variable_identifier_node=2011]="variable_identifier_node",e[e.primary_expression=2012]="primary_expression",e[e.postfix_expression=2013]="postfix_expression",e[e.integer_expression=2014]="integer_expression",e[e.function_call=2015]="function_call",e[e.function_call_generic=2016]="function_call_generic",e[e.function_call_header_no_parameters=2017]="function_call_header_no_parameters",e[e.function_call_header_with_parameters=2018]="function_call_header_with_parameters",e[e.function_call_parameter_list=2019]="function_call_parameter_list",e[e.function_call_header=2020]="function_call_header",e[e.function_identifier=2021]="function_identifier",e[e.constructor_identifier=2022]="constructor_identifier",e[e.unary_expression=2023]="unary_expression",e[e.unary_operator=2024]="unary_operator",e[e.multiplicative_expression=2025]="multiplicative_expression",e[e.additive_expression=2026]="additive_expression",e[e.shift_expression=2027]="shift_expression",e[e.relational_expression=2028]="relational_expression",e[e.equality_expression=2029]="equality_expression",e[e.and_expression=2030]="and_expression",e[e.inclusive_or_expression=2031]="inclusive_or_expression",e[e.exclusive_or_expression=2032]="exclusive_or_expression",e[e.logical_and_expression=2033]="logical_and_expression",e[e.logical_xor_expression=2034]="logical_xor_expression",e[e.logical_or_expression=2035]="logical_or_expression",e[e.conditional_expression=2036]="conditional_expression",e[e.assignment_expression=2037]="assignment_expression",e[e.assignment_operator=2038]="assignment_operator",e[e.expression=2039]="expression",e[e.integer_constant_expression=2040]="integer_constant_expression",e[e.integer_constant_expression_operator=2041]="integer_constant_expression_operator",e[e.declaration=2042]="declaration",e[e.function_prototype=2043]="function_prototype",e[e.function_declarator=2044]="function_declarator",e[e.function_header_with_parameters=2045]="function_header_with_parameters",e[e.function_header=2046]="function_header",e[e.function_parameter_list=2047]="function_parameter_list",e[e.parameter_declarator=2048]="parameter_declarator",e[e.parameter_declaration=2049]="parameter_declaration",e[e.parameter_qualifier=2050]="parameter_qualifier",e[e.parameter_type_specifier=2051]="parameter_type_specifier",e[e.init_declarator_list=2052]="init_declarator_list",e[e.single_declaration=2053]="single_declaration",e[e.fully_specified_type=2054]="fully_specified_type",e[e.type_qualifier=2055]="type_qualifier",e[e.single_type_qualifier=2056]="single_type_qualifier",e[e.storage_qualifier=2057]="storage_qualifier",e[e.precision_qualifier=2058]="precision_qualifier",e[e.interpolation_qualifier=2059]="interpolation_qualifier",e[e.invariant_qualifier=2060]="invariant_qualifier",e[e.type_specifier=2061]="type_specifier",e[e.type_specifier_nonarray=2062]="type_specifier_nonarray",e[e.type_specifier_no_prec=2063]="type_specifier_no_prec",e[e.basic_type=2064]="basic_type",e[e.struct_specifier=2065]="struct_specifier",e[e.struct_declaration_list=2066]="struct_declaration_list",e[e.struct_declaration=2067]="struct_declaration",e[e.layout_qualifier=2068]="layout_qualifier",e[e.struct_declarator_list=2069]="struct_declarator_list",e[e.struct_declarator=2070]="struct_declarator",e[e.identifier_list=2071]="identifier_list",e[e.decl_identifier=2072]="decl_identifier",e[e.initializer=2073]="initializer",e[e.initializer_list=2074]="initializer_list",e[e.declaration_statement=2075]="declaration_statement",e[e.simple_statement=2076]="simple_statement",e[e.compound_statement_no_scope=2077]="compound_statement_no_scope",e[e.statement_with_scope=2078]="statement_with_scope",e[e.compound_statement=2079]="compound_statement",e[e.statement=2080]="statement",e[e.statement_list=2081]="statement_list",e[e.iteration_statement_no_new_scope=2082]="iteration_statement_no_new_scope",e[e.expression_statement=2083]="expression_statement",e[e.selection_statement=2084]="selection_statement",e[e.selection_rest_statement=2085]="selection_rest_statement",e[e.condition=2086]="condition",e[e.conditionopt=2087]="conditionopt",e[e.iteration_statement=2088]="iteration_statement",e[e.for_init_statement=2089]="for_init_statement",e[e.for_rest_statement=2090]="for_rest_statement",e[e.jump_statement=2091]="jump_statement",e[e.external_declaration=2092]="external_declaration",e[e.function_definition=2093]="function_definition",e[e.field_selection=2094]="field_selection",e[e.bool_constant=2095]="bool_constant",e[e.function_identifier_node=2096]="function_identifier_node",e[e.typename_identifier_node=2097]="typename_identifier_node",e[e.scope_brace=2098]="scope_brace",e[e.scope_end_brace=2099]="scope_end_brace",e[e.macro_undef=2100]="macro_undef",e[e.macro_push_context=2101]="macro_push_context",e[e.macro_pop_context=2102]="macro_pop_context",e[e.macro_elif_expression=2103]="macro_elif_expression",e[e.macro_else_expression=2104]="macro_else_expression",e[e.global_macro_if_statement=2105]="global_macro_if_statement",e[e.global_macro_declaration=2106]="global_macro_declaration",e[e.global_macro_branch=2107]="global_macro_branch",e[e.macro_struct_declaration=2108]="macro_struct_declaration",e[e.macro_struct_branch=2109]="macro_struct_branch",e[e.macro_if_statement=2110]="macro_if_statement",e[e.macro_branch=2111]="macro_branch",e[e.macro_param_case_list=2112]="macro_param_case_list",e[e.macro_param_block=2113]="macro_param_block",e[e.macro_parameter_branch=2114]="macro_parameter_branch",e[e.macro_call_arg_case_list=2115]="macro_call_arg_case_list",e[e.macro_call_arg_block=2116]="macro_call_arg_block",e[e.macro_call_arg_branch=2117]="macro_call_arg_branch",e[e.macro_call_symbol=2118]="macro_call_symbol",e[e.macro_call_function=2119]="macro_call_function",e[e.macro_define=2120]="macro_define",e[e._ignore=2121]="_ignore",e}({}),Be=function(){function e(){}return e.unwrapNodeByType=function(i,t){var r=i.children[0];if(!R(r,w))return r.nt===t?r:e.unwrapNodeByType(r,t)},e.parseMacroParamList=function(i){var t=i.replace(/^\s*\(\s*|\s*\)\s*$/g,"");return t?t.split(",").map(function(r){return r.trim()}).filter(Boolean):[]},e.unwrapBareIdentifier=function(i,t){for(var r=i;;){if(R(r,P.VariableIdentifier))return r;if(t.allowParens&&R(r,P.PrimaryExpression)&&r.children.length===3){var n=r.children[1];if(!R(n,G))return;r=n;continue}if(R(r,P.ExpressionAstNode)&&r.children.length===1){var s=r.children[0];if(!R(s,G))return;r=s;continue}return}},e.extractDirectIdentLexeme=function(i){var t=e.unwrapBareIdentifier(i,{allowParens:!0});if(!t)return null;var r=t.children[0];return R(r,w)?r.lexeme:null},e.isTerminal=function(i){return i<o.START},e}();function gr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(gr=function(){return!!e})()}function Ne(e,c,i){return gr()?Ne=Reflect.construct:Ne=function(r,n,s){var l=[null];l.push.apply(l,n);var u=Function.bind.apply(r,l),_=new u;return s&&tt(_,s.prototype),_},Ne.apply(null,arguments)}function Qt(e){return Qt=Object.setPrototypeOf?Object.getPrototypeOf:function(i){return i.__proto__||Object.getPrototypeOf(i)},Qt(e)}function gi(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function Yt(e){var c=typeof Map=="function"?new Map:void 0;return Yt=function(i){if(i===null||!gi(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof c<"u"){if(c.has(i))return c.get(i);c.set(i,t)}function t(){return Ne(i,arguments,Qt(this).constructor)}return t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),tt(t,i)},Yt(e)}var Cr=function(e){D(c,e);function c(t,r,n,s,l){var u;return u=e.call(this,r)||this,u.location=n,u.source=s,u.file=l,u.name=t,u}var i=c.prototype;return i.toString=function(){var r=this,n=r.message,s=r.location,l=r.source;if(!l)return n;R(s,Sr)||(s.start,s.end),l.split(`
|
|
3
3
|
`);var u=this.name+": "+n+`
|
|
4
4
|
|
|
5
|
-
`;return u},c}(Yt(Error));Cr.wrappingLineCount=2;var He=function(e){return e.PreprocessorError="PreprocessorError",e.CompilationError="CompilationError",e.ScannerError="ScannerError",e.CompilationWarn="CompilationWarning",e}({}),ee=function(){function e(i){this._currentIndex=0,this._source=i}var c=e.prototype;return c.setSource=function(t){this._source=t,this._currentIndex=0},c.getShaderPosition=function(t){return t===void 0&&(t=0),Ce.createPosition(this._currentIndex-t)},c.isEnd=function(){return this._currentIndex>=this._source.length},c.getCurChar=function(){return this._source[this._currentIndex]},c.getCurCharCode=function(){return this._source.charCodeAt(this._currentIndex)},c.advance=function(t){this._currentIndex+=t},c.skipSpace=function(t){for(;e.isWhiteSpaceChar(this.getCurCharCode(),t);)this.advance(1)},c.skipCommentsAndSpace=function(){for(var t=this._source,r=t.length,n=this._currentIndex;n<r;){for(;n<r&&e.isWhiteSpaceChar(t.charCodeAt(n),!0);)n++;var s=e._skipBlockComment(t,n,r);if(s!==n){n=s;continue}var l=e._skipLineComment(t,n,r);if(l!==n){n=l;continue}break}this.advance(n-this._currentIndex)},c.peek=function(t){var r=this._currentIndex;return this._source.substring(r,r+t)},c.scanLexeme=function(t){this.skipCommentsAndSpace();var r=t.length,n=this.peek(r);n!==t&&this.throwError(this.getShaderPosition(0),'Expect lexeme "'+t+'", but got "'+n+'"'),this.advance(r)},c.scanTwoExpectedLexemes=function(t,r){return this.skipCommentsAndSpace(),this.peek(t.length)===t?(this.advance(t.length),t):this.peek(r.length)===r?(this.advance(r.length),r):null},c.throwError=function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];var l=xe.createGSError(n.join(" "),He.ScannerError,this._source,t);throw l},c.scanPairedChar=function(t,r,n,s){s||this.scanLexeme(t);var l=this._currentIndex,u=this._source,_=u.length,S=this._currentIndex;if(n)for(var E=1;S<_;){var O=u[S];if(O===r&&--E===0)break;O===t&&E++,S++}else for(;S<_&&u[S]!==r;)S++;return this.advance(S+1-this._currentIndex),u.substring(l,S)},e.isDigit=function(t){return t>=48&&t<=57},e.isHexDigit=function(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102},e.isAlpha=function(t){return t===95||t>=65&&t<=90||t>=97&&t<=122},e.isAlnum=function(t){return e.isAlpha(t)||e.isDigit(t)},e.isPreprocessorStartChar=function(t){return t===35},e._skipBlockComment=function(t,r,n){if(t.charCodeAt(r)!==47||r+1>=n||t.charCodeAt(r+1)!==42)return r;for(var s=r+2;s+1<n;){if(t.charCodeAt(s)===42&&t.charCodeAt(s+1)===47)return s+2;s++}return n},e._skipLineComment=function(t,r,n){if(t.charCodeAt(r)!==47||r+1>=n||t.charCodeAt(r+1)!==47)return r;for(var s=r+2;s<n;){var l=t.charCodeAt(s);if(l===10||l===13)break;s++}return s},e.isWhiteSpaceChar=function(t,r){return t===32||t===9?!0:r&&(t===10||t===13)},be(e,[{key:"currentIndex",get:function(){return this._currentIndex}},{key:"source",get:function(){return this._source}}]),e}(),rt=function(e){D(c,e);function c(t,r){var n;return n=e.call(this,t)||this,n.macroDefineList=r,n._needScanMacroConditionExpression=!1,n._inMacroDefineValue=!1,n._macroDefineExpectsNameToken=!1,n._macroDefineExpectsParamsToken=!1,n._currentMacroName="",n._currentMacroParamsLexeme=void 0,n._currentMacroValueStart=-1,n._branchStack=[],n._pendingBranchPushDefined=null,n}var i=c.prototype;return i.tokenize=function(){var r,n;return
|
|
5
|
+
`;return u},c}(Yt(Error));Cr.wrappingLineCount=2;var He=function(e){return e.PreprocessorError="PreprocessorError",e.CompilationError="CompilationError",e.ScannerError="ScannerError",e.CompilationWarn="CompilationWarning",e}({}),ee=function(){function e(i){this._currentIndex=0,this._source=i}var c=e.prototype;return c.setSource=function(t){this._source=t,this._currentIndex=0},c.getShaderPosition=function(t){return t===void 0&&(t=0),Ce.createPosition(this._currentIndex-t)},c.isEnd=function(){return this._currentIndex>=this._source.length},c.getCurChar=function(){return this._source[this._currentIndex]},c.getCurCharCode=function(){return this._source.charCodeAt(this._currentIndex)},c.advance=function(t){this._currentIndex+=t},c.skipSpace=function(t){for(;e.isWhiteSpaceChar(this.getCurCharCode(),t);)this.advance(1)},c.skipCommentsAndSpace=function(){for(var t=this._source,r=t.length,n=this._currentIndex;n<r;){for(;n<r&&e.isWhiteSpaceChar(t.charCodeAt(n),!0);)n++;var s=e._skipBlockComment(t,n,r);if(s!==n){n=s;continue}var l=e._skipLineComment(t,n,r);if(l!==n){n=l;continue}break}this.advance(n-this._currentIndex)},c.peek=function(t){var r=this._currentIndex;return this._source.substring(r,r+t)},c.scanLexeme=function(t){this.skipCommentsAndSpace();var r=t.length,n=this.peek(r);n!==t&&this.throwError(this.getShaderPosition(0),'Expect lexeme "'+t+'", but got "'+n+'"'),this.advance(r)},c.scanTwoExpectedLexemes=function(t,r){return this.skipCommentsAndSpace(),this.peek(t.length)===t?(this.advance(t.length),t):this.peek(r.length)===r?(this.advance(r.length),r):null},c.throwError=function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];var l=xe.createGSError(n.join(" "),He.ScannerError,this._source,t);throw l},c.scanPairedChar=function(t,r,n,s){s||this.scanLexeme(t);var l=this._currentIndex,u=this._source,_=u.length,S=this._currentIndex;if(n)for(var E=1;S<_;){var O=u[S];if(O===r&&--E===0)break;O===t&&E++,S++}else for(;S<_&&u[S]!==r;)S++;return this.advance(S+1-this._currentIndex),u.substring(l,S)},e.isDigit=function(t){return t>=48&&t<=57},e.isHexDigit=function(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102},e.isAlpha=function(t){return t===95||t>=65&&t<=90||t>=97&&t<=122},e.isAlnum=function(t){return e.isAlpha(t)||e.isDigit(t)},e.isPreprocessorStartChar=function(t){return t===35},e._skipBlockComment=function(t,r,n){if(t.charCodeAt(r)!==47||r+1>=n||t.charCodeAt(r+1)!==42)return r;for(var s=r+2;s+1<n;){if(t.charCodeAt(s)===42&&t.charCodeAt(s+1)===47)return s+2;s++}return n},e._skipLineComment=function(t,r,n){if(t.charCodeAt(r)!==47||r+1>=n||t.charCodeAt(r+1)!==47)return r;for(var s=r+2;s<n;){var l=t.charCodeAt(s);if(l===10||l===13)break;s++}return s},e.isWhiteSpaceChar=function(t,r){return t===32||t===9?!0:r&&(t===10||t===13)},be(e,[{key:"currentIndex",get:function(){return this._currentIndex}},{key:"source",get:function(){return this._source}}]),e}(),rt=function(e){D(c,e);function c(t,r){var n;return n=e.call(this,t)||this,n.macroDefineList=r,n._needScanMacroConditionExpression=!1,n._inMacroDefineValue=!1,n._macroDefineExpectsNameToken=!1,n._macroDefineExpectsParamsToken=!1,n._currentMacroName="",n._currentMacroParamsLexeme=void 0,n._currentMacroValueStart=-1,n._branchStack=[],n._pendingBranchPushDefined=null,n}var i=c.prototype;return i.tokenize=function(){var r,n;return Si(this,function(s){switch(s.label){case 0:if(this.isEnd())return[3,2];switch(r=this.scanToken(),this._pendingBranchPushDefined!==null&&(r.type===h.ID||r.type===a.MACRO_CALL)&&(this._branchStack.push({name:r.lexeme,defined:this._pendingBranchPushDefined}),this._pendingBranchPushDefined=null),this._branchStack.length>0&&(r.branch=this._branchStack.slice()),r.type){case a.MACRO_IFDEF:this._pendingBranchPushDefined=!0;break;case a.MACRO_IFNDEF:this._pendingBranchPushDefined=!1;break;case a.MACRO_IF:this._branchStack.push({name:"__if_"+ ++c._ifCounter,defined:!0});break;case a.MACRO_ELIF:this._branchStack.length>0&&(this._branchStack[this._branchStack.length-1]={name:"__if_"+ ++c._ifCounter,defined:!0});break;case a.MACRO_ELSE:{n=this._branchStack[this._branchStack.length-1],n&&(this._branchStack[this._branchStack.length-1]={name:n.name,defined:!n.defined});break}case a.MACRO_ENDIF:this._branchStack.pop();break}return[4,r];case 1:return s.sent(),[3,0];case 2:return[2,wt]}})},i.scanToken=function(){if(this._inMacroDefineValue){if(this._skipInlineSpaceAndComments(),this.isEnd()||this._isAtLineBreak())return this._emitMacroDefineEnd();if(this._macroDefineExpectsParamsToken&&(this._macroDefineExpectsParamsToken=!1,this.getCurChar()==="("))return this._scanMacroDefineParams()}else if(this.skipCommentsAndSpace(),this.isEnd())return wt;if(this._needScanMacroConditionExpression)return this._needScanMacroConditionExpression=!1,this._scanMacroConditionExpression();var r=this.getCurCharCode();if(ee.isPreprocessorStartChar(r))return this._scanDirectives();if(ee.isAlpha(r))return this._scanWord();if(ee.isDigit(r))return this._scanNum();var n=this.getShaderPosition(),s=w.pool.get(),l;switch(this.getCurChar()){case"<":if(this.advance(1),l=this.getCurChar(),l==="<"){if(this.advance(1),this.getCurChar()==="="){this.advance(1),s.set(h.LEFT_ASSIGN,"<<=",n);break}s.set(h.LEFT_OP,"<<",n);break}else if(l==="="){this.advance(1),s.set(h.LE_OP,"<=",n);break}s.set(h.LEFT_ANGLE,"<",n);break;case">":if(this.advance(1),l=this.getCurChar(),l===">"){if(this.advance(1),this.getCurChar()==="="){this.advance(1),s.set(h.RIGHT_ASSIGN,">>=",n);break}s.set(h.RIGHT_OP,">>",n);break}else if(l==="="){this.advance(1),s.set(h.GE_OP,">=",n);break}s.set(h.RIGHT_ANGLE,">",n);break;case"+":if(this.advance(1),l=this.getCurChar(),l==="+"){this.advance(1),s.set(h.INC_OP,"++",n);break}else if(l==="="){this.advance(1),s.set(h.ADD_ASSIGN,"+=",n);break}s.set(h.PLUS,"+",n);break;case"-":if(this.advance(1),l=this.getCurChar(),l==="-"){this.advance(1),s.set(h.DEC_OP,"--",n);break}else if(l==="="){this.advance(1),s.set(h.SUB_ASSIGN,"-=",n);break}s.set(h.DASH,"-",n);break;case"=":if(this.advance(1),this.getCurChar()==="="){this.advance(1),s.set(h.EQ_OP,"==",n);break}s.set(h.EQUAL,"=",n);break;case"!":if(this.advance(1),this.getCurChar()==="="){this.advance(1),s.set(h.NE_OP,"!=",n);break}s.set(h.BANG,"!",n);break;case"&":if(this.advance(1),l=this.getCurChar(),l==="&"){this.advance(1),s.set(h.AND_OP,"&&",n);break}else if(l==="="){this.advance(1),s.set(h.AND_ASSIGN,"&=",n);break}s.set(h.AMPERSAND,"&",n);break;case"|":if(this.advance(1),l=this.getCurChar(),l==="|"){this.advance(1),s.set(h.OR_OP,"||",n);break}else if(l==="="){this.advance(1),s.set(h.OR_ASSIGN,"|=",n);break}s.set(h.VERTICAL_BAR,"|",n);break;case"^":if(this.advance(1),l=this.getCurChar(),l==="^"){this.advance(1),s.set(h.XOR_OP,"^^",n);break}else if(l==="="){this.advance(1),s.set(h.XOR_ASSIGN,"^=",n);break}s.set(h.CARET,"^",n);break;case"*":if(this.advance(1),this.getCurChar()==="="){this.advance(1),s.set(h.MUL_ASSIGN,"*=",n);break}s.set(h.STAR,"*",n);break;case"/":if(this.advance(1),this.getCurChar()==="="){this.advance(1),s.set(h.DIV_ASSIGN,"/=",n);break}s.set(h.SLASH,"/",n);break;case"%":if(this.advance(1),this.getCurChar()==="="){this.advance(1),s.set(h.MOD_ASSIGN,"%=",n);break}s.set(h.PERCENT,"%",n);break;case"(":this.advance(1),s.set(h.LEFT_PAREN,"(",n);break;case")":this.advance(1),s.set(h.RIGHT_PAREN,")",n);break;case"{":this.advance(1),s.set(h.LEFT_BRACE,"{",n);break;case"}":this.advance(1),s.set(h.RIGHT_BRACE,"}",n);break;case"[":this.advance(1),s.set(h.LEFT_BRACKET,"[",n);break;case"]":this.advance(1),s.set(h.RIGHT_BRACKET,"]",n);break;case".":if(this.advance(1),ee.isDigit(this.getCurCharCode()))return this._scanNumAfterDot();s.set(h.DOT,".",n);break;case",":this.advance(1),s.set(h.COMMA,",",n);break;case":":return this.advance(1),s.set(h.COLON,":",n),s;case";":this.advance(1),s.set(h.SEMICOLON,";",n);break;case"~":this.advance(1),s.set(h.TILDE,"~",n);break;case"?":this.advance(1),s.set(h.QUESTION,"?",n);break;case'"':return this.advance(1),this._scanStringConst();default:this.throwError(this.getShaderPosition(0),"Unexpected character "+this.getCurChar())}return s},i._scanStringConst=function(){for(var r=this.getShaderPosition(),n=[];this.getCurChar()!=='"';)n.push(this.getCurChar()),this.advance(1);this.advance(1);var s=Ce.createRange(r,this.getShaderPosition()),l=w.pool.get();return l.set(h.STRING_CONST,n.join(""),s),l},i._scanNumAfterDot=function(){for(var r=["."];ee.isDigit(this.getCurCharCode());)r.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(r);var n=w.pool.get();return n.set(h.FLOAT_CONSTANT,r.join(""),this.getShaderPosition(r.length)),n},i._scanUtilBreakLine=function(r){for(var n=this._source,s=n.length;!this.isEnd();){var l=c._skipLineContinuation(n,this._currentIndex,s);if(l!==this._currentIndex){this.advance(l-this._currentIndex);continue}var u=n.charCodeAt(this._currentIndex);if(u===10)break;r.push(n[this._currentIndex]),this.advance(1)}},i._scanDirectives=function(){var r=[this.getCurChar()],n=this.getShaderPosition();for(this.advance(1);ee.isAlpha(this.getCurCharCode());)r.push(this.getCurChar()),this.advance(1);var s=w.pool.get(),l=r.join("");if(l==="#define"){var u=this._peekMacroDefine();if(u&&u.isExpression)this._inMacroDefineValue=!0,this._macroDefineExpectsNameToken=!0,s.set(a.MACRO_DEFINE,"#define",n);else{this._scanUtilBreakLine(r);var _=`
|
|
6
6
|
`+r.join("")+`
|
|
7
7
|
`;u&&this._registerMacroDefine(u.name,u.paramsLexeme,u.valueStart,u.valueEnd),s.set(a.MACRO_DEFINE_EXPRESSION,_,n)}}else{var S=c._lexemeTable[l];s.set(S??h.ID,l,n),(l==="#if"||l==="#elif")&&(this._needScanMacroConditionExpression=!0)}return s},i._isAtLineBreak=function(){var r=this.getCurChar();return r===`
|
|
8
8
|
`||r==="\r"},i._peekMacroDefine=function(){var r=this._source,n=r.length,s=c._skipNonSemantic(r,this._currentIndex,n);if(!(s<n&&ee.isAlpha(r.charCodeAt(s))))return null;for(var l=s;s<n&&ee.isAlnum(r.charCodeAt(s));)s++;var u=r.slice(l,s),_;if(s<n&&r.charCodeAt(s)===40){var S=s,E=1;for(s++;s<n&&E>0&&(s=c._skipNonSemantic(r,s,n),!(s>=n));){var O=r.charCodeAt(s);if(O===10||O===13)return{name:u,paramsLexeme:void 0,valueStart:s,valueEnd:s,cursor:s,isExpression:!1};O===40?E++:O===41&&E--,s++}_=r.slice(S,s)}for(var M=s,y=0,I=0,V=-1,k=-1,N=!1,W=-1;s<n;){var U=c._skipNonSemantic(r,s,n);if(U!==s){s=U;continue}var j=r.charCodeAt(s);if(j===10||j===13)break;if(V===-1&&(V=s,ee.isAlpha(j))){for(;s<n&&ee.isAlnum(r.charCodeAt(s));)s++;k=s;var X=c._skipNonSemantic(r,s,n);N=X<n&&r.charCodeAt(X)===40,W=k-1;continue}j===40?y++:j===41?y--:j===91?I++:j===93&&I--,y===0&&I===0&&(W=s),s++}var q={name:u,paramsLexeme:_,valueStart:M,valueEnd:s,cursor:s,isExpression:!1};if(V===-1||k!==-1&&!N&&c._isNonExpressionLeadingKeyword(r.slice(V,k)))return q;var Q=r.charCodeAt(V),Z=W>=0?r.charCodeAt(W):0,te=!ee.isAlnum(Q)&&Q!==40&&Q!==46&&Q!==45&&Q!==43&&Q!==33&&Q!==126,ve=!ee.isAlnum(Z)&&Z!==41&&Z!==93;if(y!==0||I!==0||te||ve){var se=r.slice(V,s).replace(/\s+/g," ").trim();this.throwError(this.getShaderPosition(0),"#define "+u+': invalid replacement list — not a valid GLSL expression ("'+se+'")')}return q.isExpression=!0,q},i._skipInlineSpaceAndComments=function(){var r=c._skipNonSemantic(this._source,this._currentIndex,this._source.length);r>this._currentIndex&&this.advance(r-this._currentIndex)},i._scanMacroDefineParams=function(){for(var r=this.getShaderPosition(),n=this._source,s=n.length,l=[],u=0;this._currentIndex<s;){var _=c._skipLineContinuation(n,this._currentIndex,s);if(_!==this._currentIndex){this.advance(_-this._currentIndex);continue}var S=n[this._currentIndex];if(l.push(S),S==="(")u++;else if(S===")"){if(u--,this.advance(1),u===0)break;continue}this.advance(1)}var E=w.pool.get(),O=l.join("");return this._currentMacroParamsLexeme=O,this._currentMacroValueStart=this._currentIndex,E.set(a.MACRO_DEFINE_PARAMS,O,r),E},i._emitMacroDefineEnd=function(){var r=this.getShaderPosition(),n=this._currentIndex,s=this._source;if(this._currentIndex<s.length){var l=s.charCodeAt(this._currentIndex);l===13&&s.charCodeAt(this._currentIndex+1)===10?this.advance(2):(l===10||l===13)&&this.advance(1)}this._registerMacroDefine(this._currentMacroName,this._currentMacroParamsLexeme,this._currentMacroValueStart,n),this._inMacroDefineValue=!1;var u=w.pool.get();return u.set(a.MACRO_DEFINE_END,`
|
|
9
|
-
`,r),u},i._registerMacroDefine=function(r,n,s,l){var u=n?n.slice(1,-1).split(",").map(function(I){return I.trim()}).filter(Boolean):[],_=(n??"")+"="+c._normalizeValueText(this._source,s,l),S={isFunction:n!==void 0,params:u,dedupKey:_,branch:this._branchStack.length===0?Xt:this._branchStack.slice()},E=this.macroDefineList[r];if(!E){this.macroDefineList[r]=[S];return}for(var O=0,M=E.length;O<M;O++){var y=E[O];if(y.dedupKey===_&&c.sameBranch(y.branch,S.branch))return}E.push(S)},i._scanMacroConditionExpression=function(){var r=new Array,n=this.getShaderPosition();this._scanUtilBreakLine(r);var s=r.join(""),l=w.pool.get();return l.set(a.MACRO_CONDITIONAL_EXPRESSION,s,n),l},i._scanWord=function(){var r=[this.getCurChar()],n=this.getShaderPosition();for(this.advance(1);ee.isAlnum(this.getCurCharCode());)r.push(this.getCurChar()),this.advance(1);var s=w.pool.get(),l=r.join(""),u=c._lexemeTable[l];return this._macroDefineExpectsNameToken?(this._macroDefineExpectsNameToken=!1,this._currentMacroName=l,this._currentMacroParamsLexeme=void 0,this._inMacroDefineValue&&(this._macroDefineExpectsParamsToken=this.getCurChar()==="(",this._currentMacroValueStart=this._currentIndex),s.set(h.ID,l,n)):this._isVisibleMacro(l)?s.set(a.MACRO_CALL,l,n):s.set(u??h.ID,l,n),s},i._isVisibleMacro=function(r){var n=this.macroDefineList[r];if(!n||n.length===0)return!1;for(var s=this._branchStack,l=0,u=n.length;l<u;l++)if(c.isVisibleFrom(n[l].branch,s))return!0;return!1},i._scanNum=function(){var r=[];if(this.getCurChar()==="0"){var n=this._source.charCodeAt(this._currentIndex+1);if(n===120||n===88){for(r.push(this.getCurChar()),this.advance(1),r.push(this.getCurChar()),this.advance(1);ee.isHexDigit(this.getCurCharCode());)r.push(this.getCurChar()),this.advance(1);r.length===2&&this.throwError(this.getShaderPosition(0),"lexing error, hex literal needs at least one digit."),this._scanIntegerSuffix(r);var s=w.pool.get();return s.set(h.INT_CONSTANT,r.join(""),this.getShaderPosition(r.length)),s}}for(;ee.isDigit(this.getCurCharCode());)r.push(this.getCurChar()),this.advance(1);var l=this.getCurChar();if(l==="."){for(r.push(l),this.advance(1);ee.isDigit(this.getCurCharCode());)r.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(r);var u=w.pool.get();return u.set(h.FLOAT_CONSTANT,r.join(""),this.getShaderPosition(r.length)),u}else if(l==="e"||l==="E"){this._scanFloatSuffix(r);var _=w.pool.get();return _.set(h.FLOAT_CONSTANT,r.join(""),this.getShaderPosition(r.length)),_}else if(l==="f"||l==="F"){r.push(l),this.advance(1);var S=w.pool.get();return S.set(h.FLOAT_CONSTANT,r.join(""),this.getShaderPosition(r.length)),S}else{this._scanIntegerSuffix(r);var E=w.pool.get();return E.set(h.INT_CONSTANT,r.join(""),this.getShaderPosition(r.length)),E}},i._scanFloatSuffix=function(r){var n=this.getCurChar();if(n==="e"||n==="E"){r.push(n),this.advance(1),n=this.getCurChar(),(n==="+"||n==="-")&&(r.push(n),this.advance(1),n=this.getCurChar()),ee.isDigit(this.getCurCharCode())||this.throwError(this.getShaderPosition(0),"lexing error, invalid exponent suffix.");do r.push(n),this.advance(1),n=this.getCurChar();while(ee.isDigit(this.getCurCharCode()))}(n==="f"||n==="F")&&(r.push(n),this.advance(1))},i._scanIntegerSuffix=function(r){var n=this.getCurChar();(n==="u"||n==="U")&&(r.push(n),this.advance(1))},c.sameBranch=function(r,n){if(r.length!==n.length)return!1;for(var s=0,l=r.length;s<l;s++)if(r[s].name!==n[s].name||r[s].defined!==n[s].defined)return!1;return!0},c.isVisibleFrom=function(r,n){for(var s=0,l=r.length;s<l;s++)for(var u=r[s],_=0,S=n.length;_<S;_++){var E=n[_];if(u.name===E.name&&u.defined!==E.defined)return!1}return!0},c._isNonExpressionLeadingKeyword=function(r){var n=c._lexemeTable[r];return n!==void 0&&n!==a.True&&n!==a.False&&!r.startsWith("#")},c._skipLineContinuation=function(r,n,s){if(r.charCodeAt(n)!==92||n+1>=s)return n;var l=r.charCodeAt(n+1);return l===10?n+2:l===13?n+2<s&&r.charCodeAt(n+2)===10?n+3:n+2:n},c._skipNonSemantic=function(r,n,s){for(var l=n;l<s;){var u=r.charCodeAt(l);if(u===32||u===9){l++;continue}var _=c._skipLineContinuation(r,l,s);if(_!==l){l=_;continue}var S=c._skipBlockComment(r,l,s);if(S!==l){l=S;continue}var E=c._skipLineComment(r,l,s);if(E!==l){l=E;continue}break}return l},c._normalizeValueText=function(r,n,s){for(var l="",u=n,_=!1;u<s;){var S=c._skipNonSemantic(r,u,s);if(S!==u){_=l.length>0,u=S;continue}var E=r.charCodeAt(u);if(E===32||E===9){_=l.length>0,u++;continue}_&&(l+=" ",_=!1),l+=r[u],u++}return l},c}(ee);rt._lexemeTable={const:a.CONST,bool:a.BOOL,float:a.FLOAT,double:a.DOUBLE,int:a.INT,uint:a.UINT,break:a.BREAK,continue:a.CONTINUE,do:a.DO,else:a.ELSE,for:a.FOR,if:a.IF,while:a.WHILE,discard:a.DISCARD,return:a.RETURN,bvec2:a.BVEC2,bvec3:a.BVEC3,bvec4:a.BVEC4,ivec2:a.IVEC2,ivec3:a.IVEC3,ivec4:a.IVEC4,uvec2:a.UVEC2,uvec3:a.UVEC3,uvec4:a.UVEC4,vec2:a.VEC2,vec3:a.VEC3,vec4:a.VEC4,mat2:a.MAT2,mat3:a.MAT3,mat4:a.MAT4,in:a.IN,out:a.OUT,inout:a.INOUT,sampler2D:a.SAMPLER2D,samplerCube:a.SAMPLER_CUBE,sampler3D:a.SAMPLER3D,sampler2DShadow:a.SAMPLER2D_SHADOW,samplerCubeShadow:a.SAMPLER_CUBE_SHADOW,sampler2DArray:a.SAMPLER2D_ARRAY,sampler2DArrayShadow:a.SAMPLER2D_ARRAY_SHADOW,isampler2D:a.I_SAMPLER2D,isampler3D:a.I_SAMPLER3D,isamplerCube:a.I_SAMPLER_CUBE,isampler2DArray:a.I_SAMPLER2D_ARRAY,usampler2D:a.U_SAMPLER2D,usampler3D:a.U_SAMPLER3D,usamplerCube:a.U_SAMPLER_CUBE,usampler2DArray:a.U_SAMPLER2D_ARRAY,struct:a.STRUCT,void:a.VOID,true:a.True,false:a.False,precision:a.PRECISION,precise:a.PRECISE,highp:a.HIGHP,mediump:a.MEDIUMP,lowp:a.LOWP,invariant:a.INVARIANT,flat:a.FLAT,smooth:a.SMOOTH,noperspective:a.NOPERSPECTIVE,centroid:a.CENTROID,layout:a.LAYOUT,location:a.LOCATION,"#if":a.MACRO_IF,"#ifdef":a.MACRO_IFDEF,"#ifndef":a.MACRO_IFNDEF,"#else":a.MACRO_ELSE,"#elif":a.MACRO_ELIF,"#endif":a.MACRO_ENDIF,"#undef":a.MACRO_UNDEF};rt._ifCounter=0;var ce=function(e){return e[e.VERTEX=0]="VERTEX",e[e.FRAGMENT=1]="FRAGMENT",e[e.ALL=2]="ALL",e}({}),fe,ur=(fe={},fe[200]={dimension:0,members:[a.FLOAT,a.VEC2,a.VEC3,a.VEC4]},fe[201]={dimension:0,members:[a.INT,a.IVEC2,a.IVEC3,a.IVEC4]},fe[202]={dimension:0,members:[a.UINT,a.UVEC2,a.UVEC3,a.UVEC4]},fe[203]={dimension:0,members:[a.BOOL,a.BVEC2,a.BVEC3,a.BVEC4]},fe[208]={dimension:0,members:[a.VEC2,a.VEC3,a.VEC4]},fe[206]={dimension:0,members:[a.IVEC2,a.IVEC3,a.IVEC4]},fe[207]={dimension:0,members:[a.UVEC2,a.UVEC3,a.UVEC4]},fe[205]={dimension:0,members:[a.BVEC2,a.BVEC3,a.BVEC4]},fe[204]={dimension:0,members:[a.MAT2,a.MAT3,a.MAT4]},fe[210]={dimension:1,members:[a.SAMPLER2D,a.I_SAMPLER2D,a.U_SAMPLER2D]},fe[211]={dimension:1,members:[a.SAMPLER3D,a.I_SAMPLER3D,a.U_SAMPLER3D]},fe[212]={dimension:1,members:[a.SAMPLER_CUBE,a.I_SAMPLER_CUBE,a.U_SAMPLER_CUBE]},fe[213]={dimension:1,members:[a.SAMPLER2D_ARRAY,a.I_SAMPLER2D_ARRAY,a.U_SAMPLER2D_ARRAY]},fe[209]={dimension:1,members:[a.VEC4,a.IVEC4,a.UVEC4]},fe),Ue=new Map,f=function(){function e(c,i,t){for(var r=arguments.length,n=new Array(r>3?r-3:0),s=3;s<r;s++)n[s-3]=arguments[s];this.ident=c,this._returnType=i,this.args=n,this.scope=t}return e._create=function(i,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];var l=Ne(e,[].concat([i,t,ce.ALL],n)),u,_=(u=Ue.get(i))!=null?u:[];_.push(l),Ue.set(i,_)},e._createWithScope=function(i,t,r){for(var n=arguments.length,s=new Array(n>3?n-3:0),l=3;l<n;l++)s[l-3]=arguments[l];var u=Ne(e,[].concat([i,t,r],s)),_,S=(_=Ue.get(i))!=null?_:[];S.push(u),Ue.set(i,S)},e.resolveOverload=function(i,t){var r=Ue.get(i);if(r)for(var n,s=(n=t==null?void 0:t.length)!=null?n:0,l=0,u=r.length;l<u;l++){var _=r[l],S=_.args;if(S.length===s){for(var E=-1,O=-1,M=!0,y=0;y<s;y++){var I=S[y],V=t[y];if(V!==_e){var k=ur[I];if(k){var N=k.members.indexOf(V);if(N===-1){M=!1;break}if(k.dimension===0){if(E===-1)E=N;else if(E!==N){M=!1;break}}else if(O===-1)O=N;else if(O!==N){M=!1;break}}else if(I!==V){M=!1;break}}}if(M){var W=ur[_._returnType];if(!W)return _._realReturnType=_._returnType,_;var U=W.dimension===0?E:O;return _._realReturnType=U===-1?_e:W.members[U],_}}}},e.isExist=function(i){return Ue.has(i)},be(e,[{key:"realReturnType",get:function(){return this._realReturnType}}]),e}();f._create("radians",200,200);f._create("degrees",200,200);f._create("sin",200,200);f._create("cos",200,200);f._create("tan",200,200);f._create("asin",200,200);f._create("acos",200,200);f._create("atan",200,200,200);f._create("atan",200,200);f._create("sinh",200,200);f._create("cosh",200,200);f._create("tanh",200,200);f._create("asinh",200,200);f._create("acosh",200,200);f._create("atanh",200,200);f._create("pow",200,200,200);f._create("exp",200,200);f._create("log",200,200);f._create("exp2",200,200);f._create("log2",200,200);f._create("sqrt",200,200);f._create("inversesqrt",200,200);f._create("abs",200,200);f._create("abs",201,201);f._create("sign",200,200);f._create("sign",201,201);f._create("floor",200,200);f._create("trunc",200,200);f._create("round",200,200);f._create("roundEven",200,200);f._create("ceil",200,200);f._create("fract",200,200);f._create("mod",200,200,a.FLOAT);f._create("mod",200,200,200);f._create("min",200,200,200);f._create("min",200,200,a.FLOAT);f._create("min",201,201,201);f._create("min",201,201,a.INT);f._create("min",202,202,202);f._create("min",202,202,a.UINT);f._create("max",200,200,200);f._create("max",200,200,a.FLOAT);f._create("max",201,201,201);f._create("max",201,201,a.INT);f._create("clamp",200,200,200,200);f._create("clamp",200,200,a.FLOAT,a.FLOAT);f._create("clamp",201,201,201,201);f._create("clamp",201,201,a.INT,a.INT);f._create("clamp",202,202,202,202);f._create("clamp",202,202,a.UINT,a.UINT);f._create("mix",200,200,200,200);f._create("mix",200,200,200,a.FLOAT);f._create("mix",200,200,200,203);f._create("step",200,200,200);f._create("step",200,a.FLOAT,200);f._create("smoothstep",200,200,200,200);f._create("smoothstep",200,a.FLOAT,a.FLOAT,200);f._create("isnan",203,200);f._create("isinf",203,200);f._create("floatBitsToInt",200,200);f._create("floatBitsToUint",202,200);f._create("intBitsToFloat",200,201);f._create("uintBitsToFloat",200,202);f._create("packSnorm2x16",a.UINT,a.VEC2);f._create("unpackSnorm2x16",a.VEC2,a.UINT);f._create("packUnorm2x16",a.UINT,a.VEC2);f._create("unpackUnorm2x16",a.VEC2,a.UINT);f._create("packHalf2x16",a.UINT,a.VEC2);f._create("unpackHalf2x16",a.VEC2,a.UINT);f._create("length",a.FLOAT,200);f._create("distance",a.FLOAT,200,200);f._create("dot",a.FLOAT,200,200);f._create("cross",a.VEC3,a.VEC3,a.VEC3);f._create("normalize",200,200);f._create("faceforward",200,200,200,200);f._create("reflect",200,200,200);f._create("refract",200,200,200,a.FLOAT);f._create("matrixCompMult",204,204,204);f._create("outerProduct",a.MAT2,a.VEC2,a.VEC2);f._create("outerProduct",a.MAT3,a.VEC3,a.VEC3);f._create("outerProduct",a.MAT4,a.VEC4,a.VEC4);f._create("outerProduct",a.MAT2X3,a.VEC3,a.VEC2);f._create("outerProduct",a.MAT3X2,a.VEC2,a.VEC3);f._create("outerProduct",a.MAT2X4,a.VEC4,a.VEC2);f._create("outerProduct",a.MAT4X2,a.VEC2,a.VEC4);f._create("outerProduct",a.MAT3X4,a.VEC4,a.VEC3);f._create("outerProduct",a.MAT4X3,a.VEC3,a.VEC4);f._create("transpose",a.MAT2,a.MAT2);f._create("transpose",a.MAT3,a.MAT3);f._create("transpose",a.MAT4,a.MAT4);f._create("transpose",a.MAT2X3,a.MAT3X2);f._create("transpose",a.MAT3X2,a.MAT2X3);f._create("transpose",a.MAT4X2,a.MAT2X4);f._create("transpose",a.MAT2X4,a.MAT4X2);f._create("transpose",a.MAT3X4,a.MAT4X3);f._create("transpose",a.MAT4X3,a.MAT3X4);f._create("determinant",a.FLOAT,a.MAT2);f._create("determinant",a.FLOAT,a.MAT3);f._create("determinant",a.FLOAT,a.MAT4);f._create("inverse",a.MAT2,a.MAT2);f._create("inverse",a.MAT3,a.MAT3);f._create("inverse",a.MAT4,a.MAT4);f._create("lessThan",205,208,208);f._create("lessThan",205,206,206);f._create("lessThan",205,207,207);f._create("lessThanEqual",205,208,208);f._create("lessThanEqual",205,206,206);f._create("lessThanEqual",205,207,207);f._create("greaterThan",205,208,208);f._create("greaterThan",205,206,206);f._create("greaterThan",205,207,207);f._create("greaterThanEqual",205,208,208);f._create("greaterThanEqual",205,206,206);f._create("greaterThanEqual",205,207,207);f._create("equal",205,208,208);f._create("equal",205,206,206);f._create("equal",205,207,207);f._create("equal",205,205,205);f._create("notEqual",205,208,208);f._create("notEqual",205,206,206);f._create("notEqual",205,207,207);f._create("notEqual",205,205,205);f._create("any",a.BOOL,205);f._create("all",a.BOOL,205);f._create("not",205,205);f._create("textureSize",a.IVEC2,210,a.INT);f._create("textureSize",a.IVEC3,211,a.INT);f._create("textureSize",a.IVEC2,212,a.INT);f._create("textureSize",a.IVEC2,a.SAMPLER2D_SHADOW,a.INT);f._create("textureSize",a.IVEC2,a.SAMPLER_CUBE_SHADOW,a.INT);f._create("textureSize",a.IVEC3,213,a.INT);f._create("textureSize",a.IVEC3,a.SAMPLER2D_ARRAY_SHADOW,a.INT);f._create("texture2D",209,210,a.VEC2);f._create("texture2D",209,210,a.VEC2,a.FLOAT);f._create("texture",209,210,a.VEC2,a.FLOAT);f._create("texture",209,210,a.VEC2);f._create("texture",209,211,a.VEC3,a.FLOAT);f._create("texture",209,211,a.VEC3);f._create("texture",209,212,a.VEC3,a.FLOAT);f._create("texture",209,212,a.VEC3);f._create("texture",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC3,a.FLOAT);f._create("texture",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC3);f._create("texture",a.FLOAT,a.SAMPLER_CUBE_SHADOW,a.VEC4,a.FLOAT);f._create("texture",a.FLOAT,a.SAMPLER_CUBE_SHADOW,a.VEC4);f._create("texture",209,a.SAMPLER2D_ARRAY,a.VEC3,a.FLOAT);f._create("texture",209,a.SAMPLER2D_ARRAY,a.VEC3);f._create("texture",a.FLOAT,a.SAMPLER2D_ARRAY_SHADOW,a.VEC4);f._create("textureProj",209,210,a.VEC3,a.FLOAT);f._create("textureProj",209,210,a.VEC3);f._create("textureProj",209,210,a.VEC4,a.FLOAT);f._create("textureProj",209,210,a.VEC4);f._create("textureProj",209,211,a.VEC4,a.FLOAT);f._create("textureProj",209,211,a.VEC4);f._create("textureProj",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC4,a.FLOAT);f._create("textureProj",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC4);f._create("textureLod",209,210,a.VEC2,a.FLOAT);f._create("textureLod",209,211,a.VEC3,a.FLOAT);f._create("textureLod",209,212,a.VEC3,a.FLOAT);f._create("textureLod",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC3,a.FLOAT);f._create("textureLod",209,213,a.VEC3,a.FLOAT);f._create("texture2DLod",209,210,a.VEC2,a.FLOAT);f._create("texture2DLodEXT",209,210,a.VEC2,a.FLOAT);f._create("texture2DLodEXT",209,211,a.VEC3,a.FLOAT);f._create("textureCube",209,212,a.VEC3);f._create("textureCube",209,212,a.VEC3,a.FLOAT);f._create("textureCubeLod",209,212,a.VEC3,a.FLOAT);f._create("textureCubeLodEXT",209,212,a.VEC3,a.FLOAT);f._create("textureOffset",209,210,a.VEC2,a.IVEC2,a.FLOAT);f._create("textureOffset",209,210,a.VEC2,a.IVEC2);f._create("textureOffset",209,211,a.VEC3,a.IVEC3,a.FLOAT);f._create("textureOffset",209,211,a.VEC3,a.IVEC3);f._create("textureOffset",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC3,a.IVEC2,a.FLOAT);f._create("textureOffset",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC3,a.IVEC2);f._create("textureOffset",209,213,a.VEC3,a.IVEC2,a.FLOAT);f._create("textureOffset",209,213,a.VEC3,a.IVEC2);f._create("texelFetch",209,210,a.IVEC2,a.INT);f._create("texelFetch",209,211,a.IVEC3,a.INT);f._create("texelFetch",209,213,a.IVEC3,a.INT);f._create("texelFetchOffset",209,210,a.IVEC2,a.INT,a.IVEC2);f._create("texelFetchOffset",209,211,a.IVEC3,a.INT,a.IVEC3);f._create("texelFetchOffset",209,213,a.IVEC3,a.INT,a.IVEC2);f._create("textureProjOffset",209,210,a.VEC3,a.IVEC2,a.FLOAT);f._create("textureProjOffset",209,210,a.VEC3,a.IVEC2);f._create("textureProjOffset",209,210,a.VEC4,a.IVEC2,a.FLOAT);f._create("textureProjOffset",209,210,a.VEC4,a.IVEC2);f._create("textureProjOffset",209,211,a.VEC4,a.IVEC3,a.FLOAT);f._create("textureProjOffset",209,211,a.VEC4,a.IVEC3);f._create("textureProjOffset",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC4,a.IVEC2,a.FLOAT);f._create("textureProjOffset",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC4,a.IVEC2);f._create("textureLodOffset",209,210,a.VEC2,a.FLOAT,a.IVEC2);f._create("textureLodOffset",209,211,a.VEC3,a.FLOAT,a.IVEC3);f._create("textureLodOffset",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC3,a.FLOAT,a.IVEC2);f._create("textureLodOffset",209,213,a.VEC3,a.FLOAT,a.IVEC2);f._create("textureProjLod",209,210,a.VEC3,a.FLOAT);f._create("textureProjLod",209,210,a.VEC4,a.FLOAT);f._create("textureProjLod",209,211,a.VEC4,a.FLOAT);f._create("textureProjLod",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC4,a.FLOAT);f._create("textureProjLodOffset",209,210,a.VEC3,a.FLOAT,a.IVEC2);f._create("textureProjLodOffset",209,210,a.VEC4,a.FLOAT,a.IVEC2);f._create("textureProjLodOffset",209,211,a.VEC4,a.FLOAT,a.IVEC3);f._create("textureProjLodOffset",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC4,a.FLOAT,a.IVEC2);f._create("textureGrad",209,210,a.VEC2,a.VEC2,a.VEC2);f._create("textureGrad",209,211,a.VEC3,a.VEC3,a.VEC3);f._create("textureGrad",209,212,a.VEC3,a.VEC3,a.VEC3);f._create("textureGrad",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC3,a.VEC2,a.VEC2);f._create("textureGrad",a.FLOAT,a.SAMPLER_CUBE_SHADOW,a.VEC4,a.VEC3,a.VEC3);f._create("textureGrad",209,213,a.VEC3,a.VEC2,a.VEC2);f._create("textureGrad",a.FLOAT,a.SAMPLER2D_ARRAY_SHADOW,a.VEC4,a.VEC2,a.VEC2);f._create("textureGradOffset",209,210,a.VEC2,a.VEC2,a.VEC2,a.IVEC2);f._create("textureGradOffset",209,211,a.VEC3,a.VEC3,a.VEC3,a.IVEC3);f._create("textureGradOffset",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC3,a.VEC2,a.VEC2,a.IVEC2);f._create("textureGradOffset",209,213,a.VEC3,a.VEC2,a.VEC2,a.IVEC2);f._create("textureGradOffset",a.FLOAT,a.SAMPLER2D_ARRAY_SHADOW,a.VEC3,a.VEC2,a.VEC2,a.IVEC2);f._create("textureProjGrad",209,210,a.VEC3,a.VEC2,a.VEC2);f._create("textureProjGrad",209,210,a.VEC4,a.VEC2,a.VEC2);f._create("textureProjGrad",209,211,a.VEC4,a.VEC3,a.VEC3);f._create("textureProjGrad",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC4,a.VEC2,a.VEC2);f._create("textureProjGradOffset",209,210,a.VEC3,a.VEC2,a.VEC2,a.IVEC2);f._create("textureProjGradOffset",209,210,a.VEC4,a.VEC2,a.VEC2,a.IVEC2);f._create("textureProjGradOffset",209,211,a.VEC4,a.VEC3,a.VEC3,a.IVEC3);f._create("textureProjGradOffset",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC4,a.VEC2,a.VEC2,a.IVEC2);f._createWithScope("dFdx",200,ce.FRAGMENT,200);f._createWithScope("dFdy",200,ce.FRAGMENT,200);f._createWithScope("fwidth",200,ce.FRAGMENT,200);var pr=new Map,re=function(){function e(c,i,t){this.type=c,this.lexeme=i,this.scope=t}return e.createVariable=function(i,t,r){r===void 0&&(r=ce.ALL);var n=new e(t,i,r);pr.set(i,n)},e.getVar=function(i){return pr.get(i)},e}();re.createVariable("gl_VertexID",a.INT,ce.VERTEX);re.createVariable("gl_InstanceID",a.INT,ce.VERTEX);re.createVariable("gl_Position",a.VEC4,ce.VERTEX);re.createVariable("gl_PointSize",a.FLOAT,ce.VERTEX);re.createVariable("gl_FragCoord",a.VEC4,ce.FRAGMENT);re.createVariable("gl_FrontFacing",a.BOOL,ce.FRAGMENT);re.createVariable("gl_FragDepth",a.FLOAT,ce.FRAGMENT);re.createVariable("gl_PointCoord",a.VEC2,ce.FRAGMENT);re.createVariable("gl_FragColor",a.VEC4,ce.FRAGMENT);re.createVariable("gl_FragData",a.VEC4_ARRAY,ce.FRAGMENT);re.createVariable("gl_MaxVertexAttribs",a.INT);re.createVariable("gl_MaxVertexUniformVectors",a.INT);re.createVariable("gl_MaxVertexOutputVectors",a.INT);re.createVariable("gl_MaxFragmentInputVectors",a.INT);re.createVariable("gl_MaxVertexTextureImageUnits",a.INT);re.createVariable("gl_MaxCombinedTextureImageUnits",a.INT);re.createVariable("gl_MaxTextureImageUnits",a.INT);re.createVariable("gl_MaxFragmentUniformVectors",a.INT);re.createVariable("gl_MaxDrawBuffers",a.INT);re.createVariable("gl_MinProgramTexelOffset",a.INT);re.createVariable("gl_MaxProgramTexelOffset",a.INT);var Ar=function(){function e(){this._table=new Map}var c=e.prototype;return c.insert=function(t,r){r===void 0&&(r=!1),t.isInMacroBranch=r;for(var n,s=(n=this._table.get(t.ident))!=null?n:[],l=0,u=s.length;l<u;l++)if(!s[l].isInMacroBranch&&s[l].equal(t)){console.warn("Replace symbol:",t.ident),s[l]=t;return}s.push(t),this._table.set(t.ident,s)},c.getSymbol=function(t,r){r===void 0&&(r=!1);var n=this._table.get(t.ident);if(n)for(var s=n.length-1;s>=0;s--){var l=n[s];if(!(!r&&l.isInMacroBranch)&&l.equal(t))return l}},c.getSymbols=function(t,r,n){return r===void 0&&(r=!1),n.length=0,this._getSymbols(t,r,n),n},c._getSymbols=function(t,r,n){r===void 0&&(r=!1);var s=this._table.get(t.ident);if(s)for(var l=s.length-1;l>=0;l--){var u=s[l];!r&&u.isInMacroBranch||u.equal(t)&&n.push(u)}return n},c.forEach=function(t){for(var r=Y(this._table.values()),n;!(n=r()).done;)for(var s=n.value,l=0,u=s.length;l<u;l++)t(s[l])},e}(),Er=function(){function e(){this.stack=[],this._macroLevel=0}var c=e.prototype;return c.pushScope=function(t){this.stack.push(t)},c.clear=function(){this.stack.length=0},c.popScope=function(){return this.stack.pop()},c.insert=function(t){this.scope.insert(t,this.isInMacroBranch)},c.lookup=function(t,r){r===void 0&&(r=!1);for(var n=this.stack.length-1;n>=0;n--){var s=this.stack[n],l=s.getSymbol(t,r);if(l)return l}},c.lookupAll=function(t,r,n){r===void 0&&(r=!1),n.length=0;for(var s=this.stack.length-1;s>=0;s--){var l=this.stack[s];l._getSymbols(t,r,n)}return n},be(e,[{key:"scope",get:function(){return this.stack[this.stack.length-1]}},{key:"isInMacroBranch",get:function(){return this._macroLevel>0}}]),e}(),gi=function(c,i,t){this.type=c,this.typeLexeme=i,this.arraySpecifier=t},oe=function(e){return e[e.VAR=0]="VAR",e[e.FN=1]="FN",e[e.STRUCT=2]="STRUCT",e[e.Any=3]="Any",e}({}),Te=function(){function e(i,t,r,n,s,l){l===void 0&&(l=!1),this.ident=i,this.type=t,this.astNode=r,this.dataType=n,this.paramSignature=s,this.isInMacroBranch=l}var c=e.prototype;return c.set=function(t,r,n,s,l){this.ident=t,this.type=r,this.astNode=n,this.dataType=s,this.paramSignature=l},c.equal=function(t){if(t.type!==3&&this.type!==t.type)return!1;if(this.type===1){if(!t.astNode&&!t.paramSignature)return!0;var r=this.astNode.protoType.paramSig,n,s=(n=t.paramSignature)!=null?n:t.astNode.protoType.paramSig,l=r==null?void 0:r.length;if(l!==(s==null?void 0:s.length))return!1;for(var u=0;u<l;u++){var _=r[u],S=s[u];if(!(_===_e||S===_e)&&_!==S)return!1}return!0}return!0},e}(),ft=function(e){D(c,e);function c(i,t){var r=new gi(t.protoType.returnType.type,t.protoType.returnType.typeSpecifier.lexeme);return e.call(this,i,oe.FN,t,r)||this}return c}(Te),Ci=function(e){D(c,e);function c(i,t){return e.call(this,i,oe.STRUCT,t)||this}return c}(Te),We=function(e){D(c,e);function c(i,t,r,n){var s;return s=e.call(this,i,oe.VAR,n,t)||this,s.isGlobalVariable=r,s}return c}(Te),hr=function(){function e(){this.globalPrecisions=[],this.globalMacroDeclarations=[]}var c=e.prototype;return c.getOuterGlobalMacroDeclarations=function(){return this.globalMacroDeclarations.filter(function(t){return R(t.parent,P.GLShaderProgram)})},e}(),dt=function(){function e(){this.semanticStack=[],this.acceptRule=void 0,this.symbolTableStack=new Er,this.curFunctionInfo={},this._shaderData=new hr,this._translationRuleTable=new Map,this.pushScope()}var c=e.prototype;return c.reset=function(t){this._macroDefineList=t,this.semanticStack.length=0,this._shaderData=new hr,this.symbolTableStack.clear(),this.pushScope()},c.pushScope=function(){this.symbolTableStack.pushScope(new Ar)},c.popScope=function(){return this.symbolTableStack.popScope()},c.addTranslationRule=function(t,r){this._translationRuleTable.set(t,r)},c.getTranslationRule=function(t){return this._translationRuleTable.get(t)},c.reportError=function(t,r){console.error(r)},c.reportWarning=function(t,r){console.warn(new Cr(He.CompilationWarn,r,t,Ce._processingPassText).toString())},be(e,[{key:"shaderData",get:function(){return this._shaderData}},{key:"macroDefineList",get:function(){return this._macroDefineList}}]),e}();dt._lookupSymbol=new Te("",null);var Ve=function(c,i,t){this.type=c,this.typeLexeme=i,this.arraySpecifier=t},fr=function(c,i,t,r){r===void 0&&(r=!1),this.typeInfo=c,this.ident=i,this.mrtIndex=t,this.isInMacroBranch=r};function T(e){return function(c){c.prototype.nt=e,c.pool=xe.createObjectPool(c)}}var G=function(){function e(){}var c=e.prototype;return c.set=function(t,r){this._location=t,this._children=r;for(var n=Y(r),s;!(s=n()).done;){var l=s.value;R(l,e)&&(l._parent=this)}this.init()},c.init=function(){},c.dispose=function(){},c.setCache=function(t){return this._codeCache=t,t},c.getCache=function(){return this._codeCache},c.codeGen=function(t){var r=t.defaultCodeGen(this.children);return this.setCache(r),r},c.semanticAnalyze=function(t){},be(e,[{key:"parent",get:function(){return this._parent}},{key:"children",get:function(){return this._children}},{key:"location",get:function(){return this._location}}]),e}();(function(e){function c(d){if(R(d,w))return d;throw"not token"}e._unwrapToken=c;function i(d,p,C,m){var g=d.get();g.set(C,m),g.semanticAnalyze(p),p.semanticStack.push(g)}e.get=i;var t=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.TrivialNode=t,t=B([T(o._ignore)],t);var r=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){g.pushScope()},p}(G);e.ScopeBrace=r,r=B([T(o.scope_brace)],r);var n=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){g.popScope()},p}(G);e.ScopeEndBrace=n,n=B([T(o.scope_end_brace)],n);var s=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this.isFragReturnStatement=!1},C.semanticAnalyze=function(g){e._unwrapToken(this.children[0]).type===a.RETURN&&(g.curFunctionInfo.returnStatement=this)},C.codeGen=function(g){return this.setCache(g.visitJumpStatement(this))},p}(G);e.JumpStatement=s,s=B([T(o.jump_statement)],s);var l=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this._type=void 0},be(p,[{key:"type",get:function(){var g;return(g=this._type)!=null?g:_e},set:function(g){this._type=g}}]),p}(G);e.ExpressionAstNode=l;var u=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this.typeSpecifier=void 0,this.arraySpecifier=void 0},C.semanticAnalyze=function(g){var v=this.children,A=v.length,b=v[0],L=b.typeSpecifier;this.typeSpecifier=L,this.arraySpecifier=L.arraySpecifier;var F=v[1],z;if(A===2||A===4){var H=new Ve(b.type,L.lexeme,this.arraySpecifier),J=v[3];z=new We(F.lexeme,H,!1,J)}else{var K=v[2];this.arraySpecifier=K;var ie=new Ve(b.type,L.lexeme,this.arraySpecifier),ae=v[4];z=new We(F.lexeme,ie,!1,ae)}g.symbolTableStack.insert(z)},C.codeGen=function(g){return this.setCache(g.visitSingleDeclaration(this))},p}(G);e.SingleDeclaration=u,u=B([T(o.single_declaration)],u);var _=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){var v=this.children;this.typeSpecifier=v.length===1?v[0]:v[1],this.type=this.typeSpecifier.type},p}(G);e.FullySpecifiedType=_,_=B([T(o.fully_specified_type)],_);var S=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.TypeQualifier=S,S=B([T(o.type_qualifier)],S);var E=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){var v=this.children[0];R(v,w)?(this.qualifier=v.type,this.lexeme=v.lexeme):(this.qualifier=v.qualifier,this.lexeme=v.lexeme)},p}(G);e.SingleTypeQualifier=E,E=B([T(o.single_type_qualifier)],E);var O=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this.arraySize=void 0},C.semanticAnalyze=function(g){var v,A=this.children,b=A[0];this.type=b.type,this.lexeme=b.lexeme,this.arraySize=A==null||(v=A[1])==null?void 0:v.size,this.isCustom=typeof this.type=="string"},be(p,[{key:"arraySpecifier",get:function(){return this.children[1]}}]),p}(G);e.TypeSpecifier=O,O=B([T(o.type_specifier)],O);var M=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){var v=this.children[1];this.size=v.value},p}(G);e.ArraySpecifier=M,M=B([T(o.array_specifier)],M);var y=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){var v=this.children[0];switch(this.lexeme=v.lexeme,v.type){case h.PLUS:this.compute=function(A,b){return A+b};break;case h.DASH:this.compute=function(A,b){return A-b};break;case h.STAR:this.compute=function(A,b){return A*b};break;case h.SLASH:this.compute=function(A,b){return A/b};break;case h.PERCENT:this.compute=function(A,b){return A%b};break;default:g.reportError(v.location,"not implemented operator "+v.lexeme)}},p}(G);e.IntegerConstantExpressionOperator=y,y=B([T(o.integer_constant_expression_operator)],y);var I=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this.value=void 0},C.semanticAnalyze=function(g){if(this.children.length===1){var v=this.children[0];R(v,w)&&(this.value=Number(v.lexeme))}},p}(G);e.IntegerConstantExpression=I,I=B([T(o.integer_constant_expression)],I);var V=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){var g=this.children[0];R(g,w)?(this.type=g.lexeme,this.lexeme=g.lexeme):R(g,lt)?(this.type=_e,this.lexeme=g.macroName):(this.type=g.type,this.lexeme=g.lexeme)},p}(G);e.TypeSpecifierNonArray=V,V=B([T(o.type_specifier_nonarray)],V);var k=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){var g=this.children[0];this.type=g.type,this.lexeme=g.lexeme},p}(G);e.ExtBuiltinTypeSpecifierNonArray=k,k=B([T(o.ext_builtin_type_specifier_nonarray)],k);var N=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){var v,A=this.children,b=A.length;if(b===1){var L=A[0],F=L.typeSpecifier,z=L.arraySpecifier;this.typeInfo=new Ve(F.type,F.lexeme,z)}else{var H=A[0];this.typeInfo=H.typeInfo}if(b===3||b===5){var J=A[2];v=new We(J.lexeme,this.typeInfo,!1,this),g.symbolTableStack.insert(v)}else if(b===4||b===6){var K=this.typeInfo,ie=this.children[3];K.arraySpecifier=ie;var ae=A[2];v=new We(ae.lexeme,K,!1,this),g.symbolTableStack.insert(v)}},p}(G);e.InitDeclaratorList=N,N=B([T(o.init_declarator_list)],N);var W=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.idList=[],m}var C=p.prototype;return C.init=function(){this.idList.length=0},C.semanticAnalyze=function(g){var v=this,A=v.children,b=v.idList;if(A.length===2)b.push(A[1]);else{var L=A[0],F=A[2],z=L.idList.length;b.length=z+1;for(var H=0;H<z;H++)b[H]=L.idList[H];b[z]=F}},p}(G);e.IdentifierList=W,W=B([T(o.identifier_list)],W);var U=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.codeGen=function(g){return this.setCache(g.visitDeclaration(this))},p}(G);e.Declaration=U,U=B([T(o.declaration)],U);var j=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){var v=this.children[0];this.ident=v.ident,this.returnType=v.returnType,this.parameterList=v.parameterInfoList,this.paramSig=v.paramSig},p}(G);e.FunctionProtoType=j,j=B([T(o.function_prototype)],j);var X=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){g.curFunctionInfo.returnStatement=null,g.curFunctionInfo.header=this;var v=this.children,A=v[0],b=v[1];this.ident=A.ident,this.returnType=A.returnType,this.parameterInfoList=b==null?void 0:b.parameterInfoList,this.paramSig=b==null?void 0:b.paramSig},p}(G);e.FunctionDeclarator=X,X=B([T(o.function_declarator)],X);var q=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){g.pushScope();var v=this.children;this.ident=v[1],this.returnType=v[0]},C.codeGen=function(g){return this.setCache(g.visitFunctionHeader(this))},p}(G);e.FunctionHeader=q,q=B([T(o.function_header)],q);var Q=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.parameterInfoList=[],m.paramSig=[],m}var C=p.prototype;return C.init=function(){this.parameterInfoList.length=0,this.paramSig.length=0},C.semanticAnalyze=function(g){var v=this.children,A=this,b=A.parameterInfoList,L=A.paramSig;if(R(v[0],se)){var F,z=v[0];b.push({ident:z.ident,typeInfo:z.typeInfo,astNode:z});var H;L.push((H=(F=z.typeInfo)==null?void 0:F.type)!=null?H:_e)}else if(R(v[2],se)){var J,K,ie,ae=v[0],le=v[2];(J=b).push.apply(J,[].concat(ae.parameterInfoList,[{ident:le.ident,typeInfo:le.typeInfo,astNode:le}]));var Oe;(K=L).push.apply(K,[].concat(ae.paramSig,[(Oe=(ie=le.typeInfo)==null?void 0:ie.type)!=null?Oe:_e]))}else if(R(v[0],p)&&R(v[1],te)){var Me,De;(Me=b).push.apply(Me,[].concat(v[0].parameterInfoList,[{astNode:v[1]}])),(De=L).push.apply(De,[].concat(v[0].paramSig,[_e]))}else R(v[0],te)&&(b.push({astNode:v[0]}),L.push(_e))},C.codeGen=function(g){return this.setCache(g.visitFunctionParameterList(this))},p}(G);e.FunctionParameterList=Q,Q=B([T(o.function_parameter_list)],Q);var Z=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.MacroParamCaseList=Z,Z=B([T(o.macro_param_case_list)],Z);var te=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.MacroParamBlock=te,te=B([T(o.macro_param_block)],te);var ve=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.MacroParameterBranch=ve,ve=B([T(o.macro_parameter_branch)],ve);var se=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this.typeInfo=void 0,this.ident=void 0},C.semanticAnalyze=function(g){var v=this.children,A;if(R(v[0],me)?A=v[0]:R(v[1],me)&&(A=v[1]),A){this.typeInfo=A.typeInfo,this.ident=A.ident;var b=new We(A.ident.lexeme,A.typeInfo,!1,A);g.symbolTableStack.insert(b)}},p}(G);e.ParameterDeclaration=se,se=B([T(o.parameter_declaration)],se);var me=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){var v=this.children;this.ident=v[1];var A=v[0],b=v[2];this.typeInfo=new Ve(A.type,A.lexeme,b)},p}(G);e.ParameterDeclarator=me,me=B([T(o.parameter_declarator)],me);var Se=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.CompoundStatementNoScope=Se,Se=B([T(o.compound_statement_no_scope)],Se);var ge=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.codeGen=function(g){return this.setCache(g.visitStatementList(this))},p}(G);e.StatementList=ge,ge=B([T(o.statement_list)],ge);var he=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this.returnStatement=void 0},C.semanticAnalyze=function(g){var v=this.children;this.protoType=v[0],this.statements=v[1],g.popScope();var A=new ft(this.protoType.ident.lexeme,this);g.symbolTableStack.insert(A),this.isInMacroBranch=g.symbolTableStack.isInMacroBranch;var b=g.curFunctionInfo,L=b.header,F=b.returnStatement;L.returnType.type===a.VOID?F&&g.reportError(L.returnType.location,"Return in void function."):F?this.returnStatement=F:g.reportError(L.returnType.location,"No return statement found."),b.header=void 0,b.returnStatement=void 0},C.codeGen=function(g){return this.setCache(g.visitFunctionDefinition(this))},p}(G);e.FunctionDefinition=he,he=B([T(o.function_definition)],he);var Ee=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){this.type=this.children[0].type},C.codeGen=function(g){return this.setCache(g.visitFunctionCall(this))},p}(l);e.FunctionCall=Ee,Ee=B([T(o.function_call)],Ee);var ye=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){d.prototype.init.call(this),this.fnSymbol=void 0},C.semanticAnalyze=function(g){var v=this.children[0];if(v.isBuiltin)this.type=v.ident;else{var A,b=v.ident,L;if(this.children.length===4){var F=this.children[2];R(F,Ie)&&(L=F.paramSig)}var z=dt._lookupSymbol;z.set(b,oe.FN,void 0,void 0,L);var H=g.symbolTableStack.lookup(z,!0);if(!H)return;this.type=H==null||(A=H.dataType)==null?void 0:A.type,this.fnSymbol=H}},p}(l);e.FunctionCallGeneric=ye,ye=B([T(o.function_call_generic)],ye);var Ie=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.paramSig=[],m.paramNodes=[],m}var C=p.prototype;return C.init=function(){this.paramSig.length=0,this.paramNodes.length=0},C.semanticAnalyze=function(g){var v=this,A=v.children,b=v.paramSig,L=v.paramNodes;if(R(A[0],Xe)){var F=A[0];b.push(F.type),L.push(F)}else if(R(A[2],Xe)){var z,H,J=A[0],K=A[2];(z=b).push.apply(z,[].concat(J.paramSig,[K.type])),(H=L).push.apply(H,[].concat(J.paramNodes,[K]))}else if(R(A[0],p)&&R(A[1],Le)){var ie,ae;(ie=b).push.apply(ie,[].concat(A[0].paramSig,[_e])),(ae=L).push.apply(ae,[].concat(A[0].paramNodes,[A[1]]))}else R(A[0],Le)&&(b.push(_e),L.push(A[0]))},p}(G);e.FunctionCallParameterList=Ie,Ie=B([T(o.function_call_parameter_list)],Ie);var ke=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.MacroCallArgCaseList=ke,ke=B([T(o.macro_call_arg_case_list)],ke);var Le=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.MacroCallArgBlock=Le,Le=B([T(o.macro_call_arg_block)],Le);var Ct=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.MacroCallArgBranch=Ct,Ct=B([T(o.macro_call_arg_branch)],Ct);var At=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){g.symbolTableStack.isInMacroBranch||g.shaderData.globalPrecisions.push(this)},p}(G);e.PrecisionSpecifier=At,At=B([T(o.precision_specifier)],At);var Et=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){var v=this.children[0];this.ident=v.type,this.lexeme=v.lexeme,this.isBuiltin=typeof this.ident!="string"},C.codeGen=function(g){return this.setCache(g.visitFunctionIdentifier(this))},p}(G);e.FunctionIdentifier=Et,Et=B([T(o.function_identifier)],Et);var Xe=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){if(this.children.length===1){var v=this.children[0],A;this.type=(A=v.type)!=null?A:_e}else{var b=this.children[2],L;this.type=(L=b.type)!=null?L:_e}},p}(l);e.AssignmentExpression=Xe,Xe=B([T(o.assignment_expression)],Xe);var at=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){if(this.children.length===1){var v=this.children[0];this.type=v.type}else{var A=this.children[2];this.type=A.type}},p}(l);e.Expression=at,at=B([T(o.expression)],at);var bt=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){if(this.children.length===1){var v=this.children[0];if(R(v,Qe)){var A;this.type=(A=v.typeInfo)!=null?A:_e}else switch(v.type){case h.INT_CONSTANT:this._type=a.INT;break;case h.FLOAT_CONSTANT:this.type=a.FLOAT;break;case a.True:case a.False:this.type=a.BOOL;break}}else{var b=this.children[1];this.type=b.type}},p}(l);e.PrimaryExpression=bt,bt=B([T(o.primary_expression)],bt);var xt=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){if(d.prototype.init.call(this),this.children.length===1){var g=this.children[0];this.type=g.type}},C.codeGen=function(g){return this.setCache(g.visitPostfixExpression(this))},p}(l);e.PostfixExpression=xt,xt=B([T(o.postfix_expression)],xt);var yt=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this.ident=void 0},C.semanticAnalyze=function(g){var v=this.children;this.isInMacroBranch=g.symbolTableStack.isInMacroBranch,v.length===6?(this.ident=v[1],g.symbolTableStack.insert(new Ci(this.ident.lexeme,this)),this.propList=v[3].propList,this.macroExpressions=v[3].macroExpressions):(this.propList=v[2].propList,this.macroExpressions=v[2].macroExpressions)},C.codeGen=function(g){return this.setCache(g.visitStructSpecifier(this))},p}(G);e.StructSpecifier=yt,yt=B([T(o.struct_specifier)],yt);var nt=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.propList=[],m.macroExpressions=[],m}var C=p.prototype;return C.init=function(){this.propList.length=0,this.macroExpressions.length=0},C.semanticAnalyze=function(g){var v=this,A=v.children,b=v.propList,L=v.macroExpressions;if(A.length===1){var F,z;(F=b).push.apply(F,[].concat(A[0].props)),(z=L).push.apply(z,[].concat(A[0].macroExpressions))}else{var H,J,K,ie;(H=b).push.apply(H,[].concat(A[0].propList)),(J=b).push.apply(J,[].concat(A[1].props)),(K=L).push.apply(K,[].concat(A[0].macroExpressions)),(ie=L).push.apply(ie,[].concat(A[1].macroExpressions))}},p}(G);e.StructDeclarationList=nt,nt=B([T(o.struct_declaration_list)],nt);var It=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.props=[],m.macroExpressions=[],m}var C=p.prototype;return C.init=function(){this._typeSpecifier=void 0,this._declaratorList=void 0,this.props.length=0,this.macroExpressions.length=0},C.semanticAnalyze=function(g){var v=this,A=v.children,b=v.props,L=v.macroExpressions;if(A.length===1){for(var F,z=A[0],H=z.props,J=0,K=H.length;J<K;J++)H[J].isInMacroBranch=!0,b.push(H[J]);(F=L).push.apply(F,[].concat(z.macroExpressions));return}A.length===3?(this._typeSpecifier=A[0],this._declaratorList=A[1]):(this._typeSpecifier=A[1],this._declaratorList=A[2]);var ie=A[0],ae=this._typeSpecifier,le=ae.type,Oe=ae.lexeme,Me=g.symbolTableStack.isInMacroBranch;if(R(ie,st)){var De=A[2],Pr=new Ve(le,Oe),Mr=new fr(Pr,De.ident,ie.index,Me);b.push(Mr)}else{var Kt=this._declaratorList.declaratorList,er=Kt.length;b.length=er;for(var pt=0;pt<er;pt++){var tr=Kt[pt],Rr=new Ve(le,Oe,tr.arraySpecifier),Lr=new fr(Rr,tr.ident,void 0,Me);b[pt]=Lr}}},p}(G);e.StructDeclaration=It,It=B([T(o.struct_declaration)],It);var Ot=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.props=[],m.macroExpressions=[],m}var C=p.prototype;return C.init=function(){this.props.length=0,this.macroExpressions.length=0},C.semanticAnalyze=function(){var g=this.children;if(this.macroExpressions.push(g[0]),g.length===3){var v,A,b,L;(v=this.props).push.apply(v,[].concat(g[1].propList)),(A=this.props).push.apply(A,[].concat(g[2].props)),(b=this.macroExpressions).push.apply(b,[].concat(g[1].macroExpressions)),(L=this.macroExpressions).push.apply(L,[].concat(g[2].macroExpressions))}else{var F,z;(F=this.props).push.apply(F,[].concat(g[1].props)),(z=this.macroExpressions).push.apply(z,[].concat(g[1].macroExpressions))}},p}(G);e.MacroStructDeclaration=Ot,Ot=B([T(o.macro_struct_declaration)],Ot);var Pt=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.props=[],m.macroExpressions=[],m}var C=p.prototype;return C.init=function(){this.props.length=0,this.macroExpressions.length=0},C.semanticAnalyze=function(){var g=this.children,v=g[g.length-1];if(this.macroExpressions.push(g[0]),R(g[1],nt)){var A,b;(A=this.props).push.apply(A,[].concat(g[1].propList)),(b=this.macroExpressions).push.apply(b,[].concat(g[1].macroExpressions))}if(R(v,p)){var L,F;(L=this.props).push.apply(L,[].concat(v.props)),(F=this.macroExpressions).push.apply(F,[].concat(v.macroExpressions))}g.length>1&&R(v,Ye)&&this.macroExpressions.push(v)},p}(G);e.MacroStructBranch=Pt,Pt=B([T(o.macro_struct_branch)],Pt);var st=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){this.index=Number(this.children[4].lexeme)},p}(G);e.LayoutQualifier=st,st=B([T(o.layout_qualifier)],st);var Mt=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.declaratorList=[],m}var C=p.prototype;return C.init=function(){this.declaratorList.length=0},C.semanticAnalyze=function(g){var v=this,A=v.children,b=v.declaratorList;if(A.length===1)b.push(A[0]);else{var L=A[0],F=A[1],z=L.declaratorList.length;b.length=z+1;for(var H=0;H<z;H++)b[H]=L.declaratorList[H];b[z]=F}},p}(G);e.StructDeclaratorList=Mt,Mt=B([T(o.struct_declarator_list)],Mt);var Rt=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this.arraySpecifier=void 0},C.semanticAnalyze=function(g){var v=this.children;this.ident=v[0],this.arraySpecifier=v[1]},p}(G);e.StructDeclarator=Rt,Rt=B([T(o.struct_declarator)],Rt);var we=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this.isStatic=!1},C.semanticAnalyze=function(g){var v=this.children,A=v[0],b=v[1];this.type=A;var L=new We(b.lexeme,new Ve(A.type,A.typeSpecifier.lexeme),!0,this);g.symbolTableStack.insert(L),v.length===4&&(this.isStatic=!0)},C.codeGen=function(g){return this.isStatic?d.prototype.codeGen.call(this,g):this.setCache(g.visitGlobalVariableDeclaration(this))},p}(G);e.VariableDeclaration=we,we=B([T(o.variable_declaration)],we);var Lt=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.variableDeclarations=[],m}var C=p.prototype;return C.init=function(){this.variableDeclarations.length=0},C.semanticAnalyze=function(g){var v=this.children,A=v.length,b=v[0],L=b.type;if(this.type=L,R(b,we))this.variableDeclarations.push(b);else{var F;(F=this.variableDeclarations).push.apply(F,[].concat(b.variableDeclarations));var z=v[2],H=we.pool.get();A===3?H.set(z.location,[L,z]):H.set(z.location,[L,z,v[3]]),H.semanticAnalyze(g),this.variableDeclarations.push(H)}},p}(G);e.VariableDeclarationList=Lt,Lt=B([T(o.variable_declaration_list)],Lt);var Qe=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.referenceGlobalSymbolNames=[],m._symbols=[],m}var C=p.prototype;return C.init=function(){this.typeInfo=_e,this.referenceGlobalSymbolNames.length=0,this._symbols.length=0},C.semanticAnalyze=function(g){for(var v=this.children[0],A=this.referenceGlobalSymbolNames,b=this._symbols,L=R(v,w)?[v.lexeme]:v.referenceSymbolNames,F=0;F<L.length;F++){var z=L[F];if(!g.macroDefineList[z]&&!(!R(v,w)&&f.isExist(z))){var H=re.getVar(z);if(H){this.typeInfo=H.type;continue}var J=p._lookupAndMarkGlobalReference(g,z,b,A,this.location);if(J&&(R(v,w)||!v.hasAstValue)){var K;this.typeInfo=(K=b[0].dataType)==null?void 0:K.type}}}R(v,w)||p._probeCrossArmShadowing(g,v,L,b,A)},C.codeGen=function(g){return this.setCache(g.visitVariableIdentifier(this))},C.getLexeme=function(g){var v=this.children[0];return R(v,w)?v.lexeme:v.codeGen(g)},p._probeCrossArmShadowing=function(g,v,A,b,L){var F=v.macroName;F&&A.indexOf(F)===-1&&(f.isExist(F)||re.getVar(F)||p._lookupAndMarkGlobalReference(g,F,b,L,null))},p._lookupAndMarkGlobalReference=function(g,v,A,b,L){var F=dt._lookupSymbol;if(F.set(v,oe.Any),g.symbolTableStack.lookupAll(F,!0,A),!A.length)return!1;var z=g.symbolTableStack.scope.getSymbol(F,!0),H=z?R(z,ft)||z.isGlobalVariable:A.some(function(J){return R(J,ft)||J.isGlobalVariable});return H&&b.indexOf(v)===-1&&b.push(v),!0},p}(G);e.VariableIdentifier=Qe,Qe=B([T(o.variable_identifier)],Qe);var Dt=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){this.shaderData=g.shaderData,this.shaderData.symbolTable=g.symbolTableStack.scope},p}(G);e.GLShaderProgram=Dt,Dt=B([T(o.gs_shader_program)],Dt);var Vt=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.macroExpressions=[],m}var C=p.prototype;return C.init=function(){this.macroExpressions.length=0},C.semanticAnalyze=function(g){var v=this.children[0];if(R(v,ot)||R(v,$e)||R(v,ut)||R(v,w))if(g.shaderData.globalMacroDeclarations.push(this),R(v,$e)){var A;(A=this.macroExpressions).push.apply(A,[].concat(v.macroExpressions))}else this.macroExpressions.push(v)},p}(G);e.GlobalDeclaration=Vt,Vt=B([T(o.global_declaration)],Vt);var ot=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.codeGen=function(g){return this.setCache(d.prototype.codeGen.call(this,g)+`
|
|
9
|
+
`,r),u},i._registerMacroDefine=function(r,n,s,l){var u=n?n.slice(1,-1).split(",").map(function(I){return I.trim()}).filter(Boolean):[],_=(n??"")+"="+c._normalizeValueText(this._source,s,l),S={isFunction:n!==void 0,params:u,dedupKey:_,branch:this._branchStack.length===0?Xt:this._branchStack.slice()},E=this.macroDefineList[r];if(!E){this.macroDefineList[r]=[S];return}for(var O=0,M=E.length;O<M;O++){var y=E[O];if(y.dedupKey===_&&c.sameBranch(y.branch,S.branch))return}E.push(S)},i._scanMacroConditionExpression=function(){var r=new Array,n=this.getShaderPosition();this._scanUtilBreakLine(r);var s=r.join(""),l=w.pool.get();return l.set(a.MACRO_CONDITIONAL_EXPRESSION,s,n),l},i._scanWord=function(){var r=[this.getCurChar()],n=this.getShaderPosition();for(this.advance(1);ee.isAlnum(this.getCurCharCode());)r.push(this.getCurChar()),this.advance(1);var s=w.pool.get(),l=r.join(""),u=c._lexemeTable[l];return this._macroDefineExpectsNameToken?(this._macroDefineExpectsNameToken=!1,this._currentMacroName=l,this._currentMacroParamsLexeme=void 0,this._inMacroDefineValue&&(this._macroDefineExpectsParamsToken=this.getCurChar()==="(",this._currentMacroValueStart=this._currentIndex),s.set(h.ID,l,n)):this._isVisibleMacro(l)?s.set(a.MACRO_CALL,l,n):s.set(u??h.ID,l,n),s},i._isVisibleMacro=function(r){var n=this.macroDefineList[r];if(!n||n.length===0)return!1;for(var s=this._branchStack,l=0,u=n.length;l<u;l++)if(c.isVisibleFrom(n[l].branch,s))return!0;return!1},i._scanNum=function(){var r=[];if(this.getCurChar()==="0"){var n=this._source.charCodeAt(this._currentIndex+1);if(n===120||n===88){for(r.push(this.getCurChar()),this.advance(1),r.push(this.getCurChar()),this.advance(1);ee.isHexDigit(this.getCurCharCode());)r.push(this.getCurChar()),this.advance(1);r.length===2&&this.throwError(this.getShaderPosition(0),"lexing error, hex literal needs at least one digit."),this._scanIntegerSuffix(r);var s=w.pool.get();return s.set(h.INT_CONSTANT,r.join(""),this.getShaderPosition(r.length)),s}}for(;ee.isDigit(this.getCurCharCode());)r.push(this.getCurChar()),this.advance(1);var l=this.getCurChar();if(l==="."){for(r.push(l),this.advance(1);ee.isDigit(this.getCurCharCode());)r.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(r);var u=w.pool.get();return u.set(h.FLOAT_CONSTANT,r.join(""),this.getShaderPosition(r.length)),u}else if(l==="e"||l==="E"){this._scanFloatSuffix(r);var _=w.pool.get();return _.set(h.FLOAT_CONSTANT,r.join(""),this.getShaderPosition(r.length)),_}else if(l==="f"||l==="F"){r.push(l),this.advance(1);var S=w.pool.get();return S.set(h.FLOAT_CONSTANT,r.join(""),this.getShaderPosition(r.length)),S}else{this._scanIntegerSuffix(r);var E=w.pool.get();return E.set(h.INT_CONSTANT,r.join(""),this.getShaderPosition(r.length)),E}},i._scanFloatSuffix=function(r){var n=this.getCurChar();if(n==="e"||n==="E"){r.push(n),this.advance(1),n=this.getCurChar(),(n==="+"||n==="-")&&(r.push(n),this.advance(1),n=this.getCurChar()),ee.isDigit(this.getCurCharCode())||this.throwError(this.getShaderPosition(0),"lexing error, invalid exponent suffix.");do r.push(n),this.advance(1),n=this.getCurChar();while(ee.isDigit(this.getCurCharCode()))}(n==="f"||n==="F")&&(r.push(n),this.advance(1))},i._scanIntegerSuffix=function(r){var n=this.getCurChar();(n==="u"||n==="U")&&(r.push(n),this.advance(1))},c.sameBranch=function(r,n){if(r.length!==n.length)return!1;for(var s=0,l=r.length;s<l;s++)if(r[s].name!==n[s].name||r[s].defined!==n[s].defined)return!1;return!0},c.isVisibleFrom=function(r,n){for(var s=0,l=r.length;s<l;s++)for(var u=r[s],_=0,S=n.length;_<S;_++){var E=n[_];if(u.name===E.name&&u.defined!==E.defined)return!1}return!0},c._isNonExpressionLeadingKeyword=function(r){var n=c._lexemeTable[r];return n!==void 0&&n!==a.True&&n!==a.False&&!r.startsWith("#")},c._skipLineContinuation=function(r,n,s){if(r.charCodeAt(n)!==92||n+1>=s)return n;var l=r.charCodeAt(n+1);return l===10?n+2:l===13?n+2<s&&r.charCodeAt(n+2)===10?n+3:n+2:n},c._skipNonSemantic=function(r,n,s){for(var l=n;l<s;){var u=r.charCodeAt(l);if(u===32||u===9){l++;continue}var _=c._skipLineContinuation(r,l,s);if(_!==l){l=_;continue}var S=c._skipBlockComment(r,l,s);if(S!==l){l=S;continue}var E=c._skipLineComment(r,l,s);if(E!==l){l=E;continue}break}return l},c._normalizeValueText=function(r,n,s){for(var l="",u=n,_=!1;u<s;){var S=c._skipNonSemantic(r,u,s);if(S!==u){_=l.length>0,u=S;continue}var E=r.charCodeAt(u);if(E===32||E===9){_=l.length>0,u++;continue}_&&(l+=" ",_=!1),l+=r[u],u++}return l},c}(ee);rt._lexemeTable={const:a.CONST,bool:a.BOOL,float:a.FLOAT,double:a.DOUBLE,int:a.INT,uint:a.UINT,break:a.BREAK,continue:a.CONTINUE,do:a.DO,else:a.ELSE,for:a.FOR,if:a.IF,while:a.WHILE,discard:a.DISCARD,return:a.RETURN,bvec2:a.BVEC2,bvec3:a.BVEC3,bvec4:a.BVEC4,ivec2:a.IVEC2,ivec3:a.IVEC3,ivec4:a.IVEC4,uvec2:a.UVEC2,uvec3:a.UVEC3,uvec4:a.UVEC4,vec2:a.VEC2,vec3:a.VEC3,vec4:a.VEC4,mat2:a.MAT2,mat3:a.MAT3,mat4:a.MAT4,in:a.IN,out:a.OUT,inout:a.INOUT,sampler2D:a.SAMPLER2D,samplerCube:a.SAMPLER_CUBE,sampler3D:a.SAMPLER3D,sampler2DShadow:a.SAMPLER2D_SHADOW,samplerCubeShadow:a.SAMPLER_CUBE_SHADOW,sampler2DArray:a.SAMPLER2D_ARRAY,sampler2DArrayShadow:a.SAMPLER2D_ARRAY_SHADOW,isampler2D:a.I_SAMPLER2D,isampler3D:a.I_SAMPLER3D,isamplerCube:a.I_SAMPLER_CUBE,isampler2DArray:a.I_SAMPLER2D_ARRAY,usampler2D:a.U_SAMPLER2D,usampler3D:a.U_SAMPLER3D,usamplerCube:a.U_SAMPLER_CUBE,usampler2DArray:a.U_SAMPLER2D_ARRAY,struct:a.STRUCT,void:a.VOID,true:a.True,false:a.False,precision:a.PRECISION,precise:a.PRECISE,highp:a.HIGHP,mediump:a.MEDIUMP,lowp:a.LOWP,invariant:a.INVARIANT,flat:a.FLAT,smooth:a.SMOOTH,noperspective:a.NOPERSPECTIVE,centroid:a.CENTROID,layout:a.LAYOUT,location:a.LOCATION,"#if":a.MACRO_IF,"#ifdef":a.MACRO_IFDEF,"#ifndef":a.MACRO_IFNDEF,"#else":a.MACRO_ELSE,"#elif":a.MACRO_ELIF,"#endif":a.MACRO_ENDIF,"#undef":a.MACRO_UNDEF};rt._ifCounter=0;var ce=function(e){return e[e.VERTEX=0]="VERTEX",e[e.FRAGMENT=1]="FRAGMENT",e[e.ALL=2]="ALL",e}({}),fe,ur=(fe={},fe[200]={dimension:0,members:[a.FLOAT,a.VEC2,a.VEC3,a.VEC4]},fe[201]={dimension:0,members:[a.INT,a.IVEC2,a.IVEC3,a.IVEC4]},fe[202]={dimension:0,members:[a.UINT,a.UVEC2,a.UVEC3,a.UVEC4]},fe[203]={dimension:0,members:[a.BOOL,a.BVEC2,a.BVEC3,a.BVEC4]},fe[208]={dimension:0,members:[a.VEC2,a.VEC3,a.VEC4]},fe[206]={dimension:0,members:[a.IVEC2,a.IVEC3,a.IVEC4]},fe[207]={dimension:0,members:[a.UVEC2,a.UVEC3,a.UVEC4]},fe[205]={dimension:0,members:[a.BVEC2,a.BVEC3,a.BVEC4]},fe[204]={dimension:0,members:[a.MAT2,a.MAT3,a.MAT4]},fe[210]={dimension:1,members:[a.SAMPLER2D,a.I_SAMPLER2D,a.U_SAMPLER2D]},fe[211]={dimension:1,members:[a.SAMPLER3D,a.I_SAMPLER3D,a.U_SAMPLER3D]},fe[212]={dimension:1,members:[a.SAMPLER_CUBE,a.I_SAMPLER_CUBE,a.U_SAMPLER_CUBE]},fe[213]={dimension:1,members:[a.SAMPLER2D_ARRAY,a.I_SAMPLER2D_ARRAY,a.U_SAMPLER2D_ARRAY]},fe[209]={dimension:1,members:[a.VEC4,a.IVEC4,a.UVEC4]},fe),Ue=new Map,f=function(){function e(c,i,t){for(var r=arguments.length,n=new Array(r>3?r-3:0),s=3;s<r;s++)n[s-3]=arguments[s];this.ident=c,this._returnType=i,this.args=n,this.scope=t}return e._create=function(i,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];var l=Ne(e,[].concat([i,t,ce.ALL],n)),u,_=(u=Ue.get(i))!=null?u:[];_.push(l),Ue.set(i,_)},e._createWithScope=function(i,t,r){for(var n=arguments.length,s=new Array(n>3?n-3:0),l=3;l<n;l++)s[l-3]=arguments[l];var u=Ne(e,[].concat([i,t,r],s)),_,S=(_=Ue.get(i))!=null?_:[];S.push(u),Ue.set(i,S)},e.resolveOverload=function(i,t){var r=Ue.get(i);if(r)for(var n,s=(n=t==null?void 0:t.length)!=null?n:0,l=0,u=r.length;l<u;l++){var _=r[l],S=_.args;if(S.length===s){for(var E=-1,O=-1,M=!0,y=0;y<s;y++){var I=S[y],V=t[y];if(V!==_e){var k=ur[I];if(k){var N=k.members.indexOf(V);if(N===-1){M=!1;break}if(k.dimension===0){if(E===-1)E=N;else if(E!==N){M=!1;break}}else if(O===-1)O=N;else if(O!==N){M=!1;break}}else if(I!==V){M=!1;break}}}if(M){var W=ur[_._returnType];if(!W)return _._realReturnType=_._returnType,_;var U=W.dimension===0?E:O;return _._realReturnType=U===-1?_e:W.members[U],_}}}},e.isExist=function(i){return Ue.has(i)},be(e,[{key:"realReturnType",get:function(){return this._realReturnType}}]),e}();f._create("radians",200,200);f._create("degrees",200,200);f._create("sin",200,200);f._create("cos",200,200);f._create("tan",200,200);f._create("asin",200,200);f._create("acos",200,200);f._create("atan",200,200,200);f._create("atan",200,200);f._create("sinh",200,200);f._create("cosh",200,200);f._create("tanh",200,200);f._create("asinh",200,200);f._create("acosh",200,200);f._create("atanh",200,200);f._create("pow",200,200,200);f._create("exp",200,200);f._create("log",200,200);f._create("exp2",200,200);f._create("log2",200,200);f._create("sqrt",200,200);f._create("inversesqrt",200,200);f._create("abs",200,200);f._create("abs",201,201);f._create("sign",200,200);f._create("sign",201,201);f._create("floor",200,200);f._create("trunc",200,200);f._create("round",200,200);f._create("roundEven",200,200);f._create("ceil",200,200);f._create("fract",200,200);f._create("mod",200,200,a.FLOAT);f._create("mod",200,200,200);f._create("min",200,200,200);f._create("min",200,200,a.FLOAT);f._create("min",201,201,201);f._create("min",201,201,a.INT);f._create("min",202,202,202);f._create("min",202,202,a.UINT);f._create("max",200,200,200);f._create("max",200,200,a.FLOAT);f._create("max",201,201,201);f._create("max",201,201,a.INT);f._create("clamp",200,200,200,200);f._create("clamp",200,200,a.FLOAT,a.FLOAT);f._create("clamp",201,201,201,201);f._create("clamp",201,201,a.INT,a.INT);f._create("clamp",202,202,202,202);f._create("clamp",202,202,a.UINT,a.UINT);f._create("mix",200,200,200,200);f._create("mix",200,200,200,a.FLOAT);f._create("mix",200,200,200,203);f._create("step",200,200,200);f._create("step",200,a.FLOAT,200);f._create("smoothstep",200,200,200,200);f._create("smoothstep",200,a.FLOAT,a.FLOAT,200);f._create("isnan",203,200);f._create("isinf",203,200);f._create("floatBitsToInt",200,200);f._create("floatBitsToUint",202,200);f._create("intBitsToFloat",200,201);f._create("uintBitsToFloat",200,202);f._create("packSnorm2x16",a.UINT,a.VEC2);f._create("unpackSnorm2x16",a.VEC2,a.UINT);f._create("packUnorm2x16",a.UINT,a.VEC2);f._create("unpackUnorm2x16",a.VEC2,a.UINT);f._create("packHalf2x16",a.UINT,a.VEC2);f._create("unpackHalf2x16",a.VEC2,a.UINT);f._create("length",a.FLOAT,200);f._create("distance",a.FLOAT,200,200);f._create("dot",a.FLOAT,200,200);f._create("cross",a.VEC3,a.VEC3,a.VEC3);f._create("normalize",200,200);f._create("faceforward",200,200,200,200);f._create("reflect",200,200,200);f._create("refract",200,200,200,a.FLOAT);f._create("matrixCompMult",204,204,204);f._create("outerProduct",a.MAT2,a.VEC2,a.VEC2);f._create("outerProduct",a.MAT3,a.VEC3,a.VEC3);f._create("outerProduct",a.MAT4,a.VEC4,a.VEC4);f._create("outerProduct",a.MAT2X3,a.VEC3,a.VEC2);f._create("outerProduct",a.MAT3X2,a.VEC2,a.VEC3);f._create("outerProduct",a.MAT2X4,a.VEC4,a.VEC2);f._create("outerProduct",a.MAT4X2,a.VEC2,a.VEC4);f._create("outerProduct",a.MAT3X4,a.VEC4,a.VEC3);f._create("outerProduct",a.MAT4X3,a.VEC3,a.VEC4);f._create("transpose",a.MAT2,a.MAT2);f._create("transpose",a.MAT3,a.MAT3);f._create("transpose",a.MAT4,a.MAT4);f._create("transpose",a.MAT2X3,a.MAT3X2);f._create("transpose",a.MAT3X2,a.MAT2X3);f._create("transpose",a.MAT4X2,a.MAT2X4);f._create("transpose",a.MAT2X4,a.MAT4X2);f._create("transpose",a.MAT3X4,a.MAT4X3);f._create("transpose",a.MAT4X3,a.MAT3X4);f._create("determinant",a.FLOAT,a.MAT2);f._create("determinant",a.FLOAT,a.MAT3);f._create("determinant",a.FLOAT,a.MAT4);f._create("inverse",a.MAT2,a.MAT2);f._create("inverse",a.MAT3,a.MAT3);f._create("inverse",a.MAT4,a.MAT4);f._create("lessThan",205,208,208);f._create("lessThan",205,206,206);f._create("lessThan",205,207,207);f._create("lessThanEqual",205,208,208);f._create("lessThanEqual",205,206,206);f._create("lessThanEqual",205,207,207);f._create("greaterThan",205,208,208);f._create("greaterThan",205,206,206);f._create("greaterThan",205,207,207);f._create("greaterThanEqual",205,208,208);f._create("greaterThanEqual",205,206,206);f._create("greaterThanEqual",205,207,207);f._create("equal",205,208,208);f._create("equal",205,206,206);f._create("equal",205,207,207);f._create("equal",205,205,205);f._create("notEqual",205,208,208);f._create("notEqual",205,206,206);f._create("notEqual",205,207,207);f._create("notEqual",205,205,205);f._create("any",a.BOOL,205);f._create("all",a.BOOL,205);f._create("not",205,205);f._create("textureSize",a.IVEC2,210,a.INT);f._create("textureSize",a.IVEC3,211,a.INT);f._create("textureSize",a.IVEC2,212,a.INT);f._create("textureSize",a.IVEC2,a.SAMPLER2D_SHADOW,a.INT);f._create("textureSize",a.IVEC2,a.SAMPLER_CUBE_SHADOW,a.INT);f._create("textureSize",a.IVEC3,213,a.INT);f._create("textureSize",a.IVEC3,a.SAMPLER2D_ARRAY_SHADOW,a.INT);f._create("texture2D",209,210,a.VEC2);f._create("texture2D",209,210,a.VEC2,a.FLOAT);f._create("texture",209,210,a.VEC2,a.FLOAT);f._create("texture",209,210,a.VEC2);f._create("texture",209,211,a.VEC3,a.FLOAT);f._create("texture",209,211,a.VEC3);f._create("texture",209,212,a.VEC3,a.FLOAT);f._create("texture",209,212,a.VEC3);f._create("texture",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC3,a.FLOAT);f._create("texture",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC3);f._create("texture",a.FLOAT,a.SAMPLER_CUBE_SHADOW,a.VEC4,a.FLOAT);f._create("texture",a.FLOAT,a.SAMPLER_CUBE_SHADOW,a.VEC4);f._create("texture",209,a.SAMPLER2D_ARRAY,a.VEC3,a.FLOAT);f._create("texture",209,a.SAMPLER2D_ARRAY,a.VEC3);f._create("texture",a.FLOAT,a.SAMPLER2D_ARRAY_SHADOW,a.VEC4);f._create("textureProj",209,210,a.VEC3,a.FLOAT);f._create("textureProj",209,210,a.VEC3);f._create("textureProj",209,210,a.VEC4,a.FLOAT);f._create("textureProj",209,210,a.VEC4);f._create("textureProj",209,211,a.VEC4,a.FLOAT);f._create("textureProj",209,211,a.VEC4);f._create("textureProj",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC4,a.FLOAT);f._create("textureProj",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC4);f._create("textureLod",209,210,a.VEC2,a.FLOAT);f._create("textureLod",209,211,a.VEC3,a.FLOAT);f._create("textureLod",209,212,a.VEC3,a.FLOAT);f._create("textureLod",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC3,a.FLOAT);f._create("textureLod",209,213,a.VEC3,a.FLOAT);f._create("texture2DLod",209,210,a.VEC2,a.FLOAT);f._create("texture2DLodEXT",209,210,a.VEC2,a.FLOAT);f._create("texture2DLodEXT",209,211,a.VEC3,a.FLOAT);f._create("textureCube",209,212,a.VEC3);f._create("textureCube",209,212,a.VEC3,a.FLOAT);f._create("textureCubeLod",209,212,a.VEC3,a.FLOAT);f._create("textureCubeLodEXT",209,212,a.VEC3,a.FLOAT);f._create("textureOffset",209,210,a.VEC2,a.IVEC2,a.FLOAT);f._create("textureOffset",209,210,a.VEC2,a.IVEC2);f._create("textureOffset",209,211,a.VEC3,a.IVEC3,a.FLOAT);f._create("textureOffset",209,211,a.VEC3,a.IVEC3);f._create("textureOffset",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC3,a.IVEC2,a.FLOAT);f._create("textureOffset",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC3,a.IVEC2);f._create("textureOffset",209,213,a.VEC3,a.IVEC2,a.FLOAT);f._create("textureOffset",209,213,a.VEC3,a.IVEC2);f._create("texelFetch",209,210,a.IVEC2,a.INT);f._create("texelFetch",209,211,a.IVEC3,a.INT);f._create("texelFetch",209,213,a.IVEC3,a.INT);f._create("texelFetchOffset",209,210,a.IVEC2,a.INT,a.IVEC2);f._create("texelFetchOffset",209,211,a.IVEC3,a.INT,a.IVEC3);f._create("texelFetchOffset",209,213,a.IVEC3,a.INT,a.IVEC2);f._create("textureProjOffset",209,210,a.VEC3,a.IVEC2,a.FLOAT);f._create("textureProjOffset",209,210,a.VEC3,a.IVEC2);f._create("textureProjOffset",209,210,a.VEC4,a.IVEC2,a.FLOAT);f._create("textureProjOffset",209,210,a.VEC4,a.IVEC2);f._create("textureProjOffset",209,211,a.VEC4,a.IVEC3,a.FLOAT);f._create("textureProjOffset",209,211,a.VEC4,a.IVEC3);f._create("textureProjOffset",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC4,a.IVEC2,a.FLOAT);f._create("textureProjOffset",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC4,a.IVEC2);f._create("textureLodOffset",209,210,a.VEC2,a.FLOAT,a.IVEC2);f._create("textureLodOffset",209,211,a.VEC3,a.FLOAT,a.IVEC3);f._create("textureLodOffset",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC3,a.FLOAT,a.IVEC2);f._create("textureLodOffset",209,213,a.VEC3,a.FLOAT,a.IVEC2);f._create("textureProjLod",209,210,a.VEC3,a.FLOAT);f._create("textureProjLod",209,210,a.VEC4,a.FLOAT);f._create("textureProjLod",209,211,a.VEC4,a.FLOAT);f._create("textureProjLod",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC4,a.FLOAT);f._create("textureProjLodOffset",209,210,a.VEC3,a.FLOAT,a.IVEC2);f._create("textureProjLodOffset",209,210,a.VEC4,a.FLOAT,a.IVEC2);f._create("textureProjLodOffset",209,211,a.VEC4,a.FLOAT,a.IVEC3);f._create("textureProjLodOffset",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC4,a.FLOAT,a.IVEC2);f._create("textureGrad",209,210,a.VEC2,a.VEC2,a.VEC2);f._create("textureGrad",209,211,a.VEC3,a.VEC3,a.VEC3);f._create("textureGrad",209,212,a.VEC3,a.VEC3,a.VEC3);f._create("textureGrad",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC3,a.VEC2,a.VEC2);f._create("textureGrad",a.FLOAT,a.SAMPLER_CUBE_SHADOW,a.VEC4,a.VEC3,a.VEC3);f._create("textureGrad",209,213,a.VEC3,a.VEC2,a.VEC2);f._create("textureGrad",a.FLOAT,a.SAMPLER2D_ARRAY_SHADOW,a.VEC4,a.VEC2,a.VEC2);f._create("textureGradOffset",209,210,a.VEC2,a.VEC2,a.VEC2,a.IVEC2);f._create("textureGradOffset",209,211,a.VEC3,a.VEC3,a.VEC3,a.IVEC3);f._create("textureGradOffset",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC3,a.VEC2,a.VEC2,a.IVEC2);f._create("textureGradOffset",209,213,a.VEC3,a.VEC2,a.VEC2,a.IVEC2);f._create("textureGradOffset",a.FLOAT,a.SAMPLER2D_ARRAY_SHADOW,a.VEC3,a.VEC2,a.VEC2,a.IVEC2);f._create("textureProjGrad",209,210,a.VEC3,a.VEC2,a.VEC2);f._create("textureProjGrad",209,210,a.VEC4,a.VEC2,a.VEC2);f._create("textureProjGrad",209,211,a.VEC4,a.VEC3,a.VEC3);f._create("textureProjGrad",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC4,a.VEC2,a.VEC2);f._create("textureProjGradOffset",209,210,a.VEC3,a.VEC2,a.VEC2,a.IVEC2);f._create("textureProjGradOffset",209,210,a.VEC4,a.VEC2,a.VEC2,a.IVEC2);f._create("textureProjGradOffset",209,211,a.VEC4,a.VEC3,a.VEC3,a.IVEC3);f._create("textureProjGradOffset",a.FLOAT,a.SAMPLER2D_SHADOW,a.VEC4,a.VEC2,a.VEC2,a.IVEC2);f._createWithScope("dFdx",200,ce.FRAGMENT,200);f._createWithScope("dFdy",200,ce.FRAGMENT,200);f._createWithScope("fwidth",200,ce.FRAGMENT,200);var pr=new Map,re=function(){function e(c,i,t){this.type=c,this.lexeme=i,this.scope=t}return e.createVariable=function(i,t,r){r===void 0&&(r=ce.ALL);var n=new e(t,i,r);pr.set(i,n)},e.getVar=function(i){return pr.get(i)},e}();re.createVariable("gl_VertexID",a.INT,ce.VERTEX);re.createVariable("gl_InstanceID",a.INT,ce.VERTEX);re.createVariable("gl_Position",a.VEC4,ce.VERTEX);re.createVariable("gl_PointSize",a.FLOAT,ce.VERTEX);re.createVariable("gl_FragCoord",a.VEC4,ce.FRAGMENT);re.createVariable("gl_FrontFacing",a.BOOL,ce.FRAGMENT);re.createVariable("gl_FragDepth",a.FLOAT,ce.FRAGMENT);re.createVariable("gl_PointCoord",a.VEC2,ce.FRAGMENT);re.createVariable("gl_FragColor",a.VEC4,ce.FRAGMENT);re.createVariable("gl_FragData",a.VEC4_ARRAY,ce.FRAGMENT);re.createVariable("gl_MaxVertexAttribs",a.INT);re.createVariable("gl_MaxVertexUniformVectors",a.INT);re.createVariable("gl_MaxVertexOutputVectors",a.INT);re.createVariable("gl_MaxFragmentInputVectors",a.INT);re.createVariable("gl_MaxVertexTextureImageUnits",a.INT);re.createVariable("gl_MaxCombinedTextureImageUnits",a.INT);re.createVariable("gl_MaxTextureImageUnits",a.INT);re.createVariable("gl_MaxFragmentUniformVectors",a.INT);re.createVariable("gl_MaxDrawBuffers",a.INT);re.createVariable("gl_MinProgramTexelOffset",a.INT);re.createVariable("gl_MaxProgramTexelOffset",a.INT);var Ar=function(){function e(){this._table=new Map}var c=e.prototype;return c.insert=function(t,r){r===void 0&&(r=!1),t.isInMacroBranch=r;for(var n,s=(n=this._table.get(t.ident))!=null?n:[],l=0,u=s.length;l<u;l++)if(!s[l].isInMacroBranch&&s[l].equal(t)){console.warn("Replace symbol:",t.ident),s[l]=t;return}s.push(t),this._table.set(t.ident,s)},c.getSymbol=function(t,r){r===void 0&&(r=!1);var n=this._table.get(t.ident);if(n)for(var s=n.length-1;s>=0;s--){var l=n[s];if(!(!r&&l.isInMacroBranch)&&l.equal(t))return l}},c.getSymbols=function(t,r,n){return r===void 0&&(r=!1),n.length=0,this._getSymbols(t,r,n),n},c._getSymbols=function(t,r,n){r===void 0&&(r=!1);var s=this._table.get(t.ident);if(s)for(var l=s.length-1;l>=0;l--){var u=s[l];!r&&u.isInMacroBranch||u.equal(t)&&n.push(u)}return n},c.forEach=function(t){for(var r=Y(this._table.values()),n;!(n=r()).done;)for(var s=n.value,l=0,u=s.length;l<u;l++)t(s[l])},e}(),Er=function(){function e(){this.stack=[],this._macroLevel=0}var c=e.prototype;return c.pushScope=function(t){this.stack.push(t)},c.clear=function(){this.stack.length=0},c.popScope=function(){return this.stack.pop()},c.insert=function(t){this.scope.insert(t,this.isInMacroBranch)},c.lookup=function(t,r){r===void 0&&(r=!1);for(var n=this.stack.length-1;n>=0;n--){var s=this.stack[n],l=s.getSymbol(t,r);if(l)return l}},c.lookupAll=function(t,r,n){r===void 0&&(r=!1),n.length=0;for(var s=this.stack.length-1;s>=0;s--){var l=this.stack[s];l._getSymbols(t,r,n)}return n},be(e,[{key:"scope",get:function(){return this.stack[this.stack.length-1]}},{key:"isInMacroBranch",get:function(){return this._macroLevel>0}}]),e}(),Ci=function(c,i,t){this.type=c,this.typeLexeme=i,this.arraySpecifier=t},oe=function(e){return e[e.VAR=0]="VAR",e[e.FN=1]="FN",e[e.STRUCT=2]="STRUCT",e[e.Any=3]="Any",e}({}),Te=function(){function e(i,t,r,n,s,l){l===void 0&&(l=!1),this.ident=i,this.type=t,this.astNode=r,this.dataType=n,this.paramSignature=s,this.isInMacroBranch=l}var c=e.prototype;return c.set=function(t,r,n,s,l){this.ident=t,this.type=r,this.astNode=n,this.dataType=s,this.paramSignature=l},c.equal=function(t){if(t.type!==3&&this.type!==t.type)return!1;if(this.type===1){if(!t.astNode&&!t.paramSignature)return!0;var r=this.astNode.protoType.paramSig,n,s=(n=t.paramSignature)!=null?n:t.astNode.protoType.paramSig,l=r==null?void 0:r.length;if(l!==(s==null?void 0:s.length))return!1;for(var u=0;u<l;u++){var _=r[u],S=s[u];if(!(_===_e||S===_e)&&_!==S)return!1}return!0}return!0},e}(),ft=function(e){D(c,e);function c(i,t){var r=new Ci(t.protoType.returnType.type,t.protoType.returnType.typeSpecifier.lexeme);return e.call(this,i,oe.FN,t,r)||this}return c}(Te),Ai=function(e){D(c,e);function c(i,t){return e.call(this,i,oe.STRUCT,t)||this}return c}(Te),We=function(e){D(c,e);function c(i,t,r,n){var s;return s=e.call(this,i,oe.VAR,n,t)||this,s.isGlobalVariable=r,s}return c}(Te),hr=function(){function e(){this.globalPrecisions=[],this.globalMacroDeclarations=[]}var c=e.prototype;return c.getOuterGlobalMacroDeclarations=function(){return this.globalMacroDeclarations.filter(function(t){return R(t.parent,P.GLShaderProgram)})},e}(),dt=function(){function e(){this.semanticStack=[],this.acceptRule=void 0,this.symbolTableStack=new Er,this.curFunctionInfo={},this._shaderData=new hr,this._translationRuleTable=new Map,this.pushScope()}var c=e.prototype;return c.reset=function(t){this._macroDefineList=t,this.semanticStack.length=0,this._shaderData=new hr,this.symbolTableStack.clear(),this.pushScope()},c.pushScope=function(){this.symbolTableStack.pushScope(new Ar)},c.popScope=function(){return this.symbolTableStack.popScope()},c.addTranslationRule=function(t,r){this._translationRuleTable.set(t,r)},c.getTranslationRule=function(t){return this._translationRuleTable.get(t)},c.reportError=function(t,r){console.error(r)},c.reportWarning=function(t,r){console.warn(new Cr(He.CompilationWarn,r,t,Ce._processingPassText).toString())},be(e,[{key:"shaderData",get:function(){return this._shaderData}},{key:"macroDefineList",get:function(){return this._macroDefineList}}]),e}();dt._lookupSymbol=new Te("",null);var Ve=function(c,i,t){this.type=c,this.typeLexeme=i,this.arraySpecifier=t},fr=function(c,i,t,r){r===void 0&&(r=!1),this.typeInfo=c,this.ident=i,this.mrtIndex=t,this.isInMacroBranch=r};function T(e){return function(c){c.prototype.nt=e,c.pool=xe.createObjectPool(c)}}var G=function(){function e(){}var c=e.prototype;return c.set=function(t,r){this._location=t,this._children=r;for(var n=Y(r),s;!(s=n()).done;){var l=s.value;R(l,e)&&(l._parent=this)}this.init()},c.init=function(){},c.dispose=function(){},c.setCache=function(t){return this._codeCache=t,t},c.getCache=function(){return this._codeCache},c.codeGen=function(t){var r=t.defaultCodeGen(this.children);return this.setCache(r),r},c.semanticAnalyze=function(t){},be(e,[{key:"parent",get:function(){return this._parent}},{key:"children",get:function(){return this._children}},{key:"location",get:function(){return this._location}}]),e}();(function(e){function c(d){if(R(d,w))return d;throw"not token"}e._unwrapToken=c;function i(d,p,C,m){var g=d.get();g.set(C,m),g.semanticAnalyze(p),p.semanticStack.push(g)}e.get=i;var t=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.TrivialNode=t,t=B([T(o._ignore)],t);var r=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){g.pushScope()},p}(G);e.ScopeBrace=r,r=B([T(o.scope_brace)],r);var n=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){g.popScope()},p}(G);e.ScopeEndBrace=n,n=B([T(o.scope_end_brace)],n);var s=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this.isFragReturnStatement=!1},C.semanticAnalyze=function(g){e._unwrapToken(this.children[0]).type===a.RETURN&&(g.curFunctionInfo.returnStatement=this)},C.codeGen=function(g){return this.setCache(g.visitJumpStatement(this))},p}(G);e.JumpStatement=s,s=B([T(o.jump_statement)],s);var l=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this._type=void 0},be(p,[{key:"type",get:function(){var g;return(g=this._type)!=null?g:_e},set:function(g){this._type=g}}]),p}(G);e.ExpressionAstNode=l;var u=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this.typeSpecifier=void 0,this.arraySpecifier=void 0},C.semanticAnalyze=function(g){var v=this.children,A=v.length,b=v[0],L=b.typeSpecifier;this.typeSpecifier=L,this.arraySpecifier=L.arraySpecifier;var F=v[1],z;if(A===2||A===4){var H=new Ve(b.type,L.lexeme,this.arraySpecifier),J=v[3];z=new We(F.lexeme,H,!1,J)}else{var K=v[2];this.arraySpecifier=K;var ie=new Ve(b.type,L.lexeme,this.arraySpecifier),ae=v[4];z=new We(F.lexeme,ie,!1,ae)}g.symbolTableStack.insert(z)},C.codeGen=function(g){return this.setCache(g.visitSingleDeclaration(this))},p}(G);e.SingleDeclaration=u,u=B([T(o.single_declaration)],u);var _=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){var v=this.children;this.typeSpecifier=v.length===1?v[0]:v[1],this.type=this.typeSpecifier.type},p}(G);e.FullySpecifiedType=_,_=B([T(o.fully_specified_type)],_);var S=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.TypeQualifier=S,S=B([T(o.type_qualifier)],S);var E=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){var v=this.children[0];R(v,w)?(this.qualifier=v.type,this.lexeme=v.lexeme):(this.qualifier=v.qualifier,this.lexeme=v.lexeme)},p}(G);e.SingleTypeQualifier=E,E=B([T(o.single_type_qualifier)],E);var O=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this.arraySize=void 0},C.semanticAnalyze=function(g){var v,A=this.children,b=A[0];this.type=b.type,this.lexeme=b.lexeme,this.arraySize=A==null||(v=A[1])==null?void 0:v.size,this.isCustom=typeof this.type=="string"},be(p,[{key:"arraySpecifier",get:function(){return this.children[1]}}]),p}(G);e.TypeSpecifier=O,O=B([T(o.type_specifier)],O);var M=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){var v=this.children[1];this.size=v.value},p}(G);e.ArraySpecifier=M,M=B([T(o.array_specifier)],M);var y=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){var v=this.children[0];switch(this.lexeme=v.lexeme,v.type){case h.PLUS:this.compute=function(A,b){return A+b};break;case h.DASH:this.compute=function(A,b){return A-b};break;case h.STAR:this.compute=function(A,b){return A*b};break;case h.SLASH:this.compute=function(A,b){return A/b};break;case h.PERCENT:this.compute=function(A,b){return A%b};break;default:g.reportError(v.location,"not implemented operator "+v.lexeme)}},p}(G);e.IntegerConstantExpressionOperator=y,y=B([T(o.integer_constant_expression_operator)],y);var I=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this.value=void 0},C.semanticAnalyze=function(g){if(this.children.length===1){var v=this.children[0];R(v,w)&&(this.value=Number(v.lexeme))}},p}(G);e.IntegerConstantExpression=I,I=B([T(o.integer_constant_expression)],I);var V=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){var g=this.children[0];R(g,w)?(this.type=g.lexeme,this.lexeme=g.lexeme):R(g,lt)?(this.type=_e,this.lexeme=g.macroName):(this.type=g.type,this.lexeme=g.lexeme)},p}(G);e.TypeSpecifierNonArray=V,V=B([T(o.type_specifier_nonarray)],V);var k=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){var g=this.children[0];this.type=g.type,this.lexeme=g.lexeme},p}(G);e.ExtBuiltinTypeSpecifierNonArray=k,k=B([T(o.ext_builtin_type_specifier_nonarray)],k);var N=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){var v,A=this.children,b=A.length;if(b===1){var L=A[0],F=L.typeSpecifier,z=L.arraySpecifier;this.typeInfo=new Ve(F.type,F.lexeme,z)}else{var H=A[0];this.typeInfo=H.typeInfo}if(b===3||b===5){var J=A[2];v=new We(J.lexeme,this.typeInfo,!1,this),g.symbolTableStack.insert(v)}else if(b===4||b===6){var K=this.typeInfo,ie=this.children[3];K.arraySpecifier=ie;var ae=A[2];v=new We(ae.lexeme,K,!1,this),g.symbolTableStack.insert(v)}},p}(G);e.InitDeclaratorList=N,N=B([T(o.init_declarator_list)],N);var W=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.idList=[],m}var C=p.prototype;return C.init=function(){this.idList.length=0},C.semanticAnalyze=function(g){var v=this,A=v.children,b=v.idList;if(A.length===2)b.push(A[1]);else{var L=A[0],F=A[2],z=L.idList.length;b.length=z+1;for(var H=0;H<z;H++)b[H]=L.idList[H];b[z]=F}},p}(G);e.IdentifierList=W,W=B([T(o.identifier_list)],W);var U=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.codeGen=function(g){return this.setCache(g.visitDeclaration(this))},p}(G);e.Declaration=U,U=B([T(o.declaration)],U);var j=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){var v=this.children[0];this.ident=v.ident,this.returnType=v.returnType,this.parameterList=v.parameterInfoList,this.paramSig=v.paramSig},p}(G);e.FunctionProtoType=j,j=B([T(o.function_prototype)],j);var X=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){g.curFunctionInfo.returnStatement=null,g.curFunctionInfo.header=this;var v=this.children,A=v[0],b=v[1];this.ident=A.ident,this.returnType=A.returnType,this.parameterInfoList=b==null?void 0:b.parameterInfoList,this.paramSig=b==null?void 0:b.paramSig},p}(G);e.FunctionDeclarator=X,X=B([T(o.function_declarator)],X);var q=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){g.pushScope();var v=this.children;this.ident=v[1],this.returnType=v[0]},C.codeGen=function(g){return this.setCache(g.visitFunctionHeader(this))},p}(G);e.FunctionHeader=q,q=B([T(o.function_header)],q);var Q=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.parameterInfoList=[],m.paramSig=[],m}var C=p.prototype;return C.init=function(){this.parameterInfoList.length=0,this.paramSig.length=0},C.semanticAnalyze=function(g){var v=this.children,A=this,b=A.parameterInfoList,L=A.paramSig;if(R(v[0],se)){var F,z=v[0];b.push({ident:z.ident,typeInfo:z.typeInfo,astNode:z});var H;L.push((H=(F=z.typeInfo)==null?void 0:F.type)!=null?H:_e)}else if(R(v[2],se)){var J,K,ie,ae=v[0],le=v[2];(J=b).push.apply(J,[].concat(ae.parameterInfoList,[{ident:le.ident,typeInfo:le.typeInfo,astNode:le}]));var Oe;(K=L).push.apply(K,[].concat(ae.paramSig,[(Oe=(ie=le.typeInfo)==null?void 0:ie.type)!=null?Oe:_e]))}else if(R(v[0],p)&&R(v[1],te)){var Me,De;(Me=b).push.apply(Me,[].concat(v[0].parameterInfoList,[{astNode:v[1]}])),(De=L).push.apply(De,[].concat(v[0].paramSig,[_e]))}else R(v[0],te)&&(b.push({astNode:v[0]}),L.push(_e))},C.codeGen=function(g){return this.setCache(g.visitFunctionParameterList(this))},p}(G);e.FunctionParameterList=Q,Q=B([T(o.function_parameter_list)],Q);var Z=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.MacroParamCaseList=Z,Z=B([T(o.macro_param_case_list)],Z);var te=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.MacroParamBlock=te,te=B([T(o.macro_param_block)],te);var ve=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.MacroParameterBranch=ve,ve=B([T(o.macro_parameter_branch)],ve);var se=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this.typeInfo=void 0,this.ident=void 0},C.semanticAnalyze=function(g){var v=this.children,A;if(R(v[0],me)?A=v[0]:R(v[1],me)&&(A=v[1]),A){this.typeInfo=A.typeInfo,this.ident=A.ident;var b=new We(A.ident.lexeme,A.typeInfo,!1,A);g.symbolTableStack.insert(b)}},p}(G);e.ParameterDeclaration=se,se=B([T(o.parameter_declaration)],se);var me=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){var v=this.children;this.ident=v[1];var A=v[0],b=v[2];this.typeInfo=new Ve(A.type,A.lexeme,b)},p}(G);e.ParameterDeclarator=me,me=B([T(o.parameter_declarator)],me);var Se=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.CompoundStatementNoScope=Se,Se=B([T(o.compound_statement_no_scope)],Se);var ge=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.codeGen=function(g){return this.setCache(g.visitStatementList(this))},p}(G);e.StatementList=ge,ge=B([T(o.statement_list)],ge);var he=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this.returnStatement=void 0},C.semanticAnalyze=function(g){var v=this.children;this.protoType=v[0],this.statements=v[1],g.popScope();var A=new ft(this.protoType.ident.lexeme,this);g.symbolTableStack.insert(A),this.isInMacroBranch=g.symbolTableStack.isInMacroBranch;var b=g.curFunctionInfo,L=b.header,F=b.returnStatement;L.returnType.type===a.VOID?F&&g.reportError(L.returnType.location,"Return in void function."):F?this.returnStatement=F:g.reportError(L.returnType.location,"No return statement found."),b.header=void 0,b.returnStatement=void 0},C.codeGen=function(g){return this.setCache(g.visitFunctionDefinition(this))},p}(G);e.FunctionDefinition=he,he=B([T(o.function_definition)],he);var Ee=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){this.type=this.children[0].type},C.codeGen=function(g){return this.setCache(g.visitFunctionCall(this))},p}(l);e.FunctionCall=Ee,Ee=B([T(o.function_call)],Ee);var ye=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){d.prototype.init.call(this),this.fnSymbol=void 0},C.semanticAnalyze=function(g){var v=this.children[0];if(v.isBuiltin)this.type=v.ident;else{var A,b=v.ident,L;if(this.children.length===4){var F=this.children[2];R(F,Ie)&&(L=F.paramSig)}var z=dt._lookupSymbol;z.set(b,oe.FN,void 0,void 0,L);var H=g.symbolTableStack.lookup(z,!0);if(!H)return;this.type=H==null||(A=H.dataType)==null?void 0:A.type,this.fnSymbol=H}},p}(l);e.FunctionCallGeneric=ye,ye=B([T(o.function_call_generic)],ye);var Ie=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.paramSig=[],m.paramNodes=[],m}var C=p.prototype;return C.init=function(){this.paramSig.length=0,this.paramNodes.length=0},C.semanticAnalyze=function(g){var v=this,A=v.children,b=v.paramSig,L=v.paramNodes;if(R(A[0],Xe)){var F=A[0];b.push(F.type),L.push(F)}else if(R(A[2],Xe)){var z,H,J=A[0],K=A[2];(z=b).push.apply(z,[].concat(J.paramSig,[K.type])),(H=L).push.apply(H,[].concat(J.paramNodes,[K]))}else if(R(A[0],p)&&R(A[1],Le)){var ie,ae;(ie=b).push.apply(ie,[].concat(A[0].paramSig,[_e])),(ae=L).push.apply(ae,[].concat(A[0].paramNodes,[A[1]]))}else R(A[0],Le)&&(b.push(_e),L.push(A[0]))},p}(G);e.FunctionCallParameterList=Ie,Ie=B([T(o.function_call_parameter_list)],Ie);var ke=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.MacroCallArgCaseList=ke,ke=B([T(o.macro_call_arg_case_list)],ke);var Le=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.MacroCallArgBlock=Le,Le=B([T(o.macro_call_arg_block)],Le);var Ct=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.MacroCallArgBranch=Ct,Ct=B([T(o.macro_call_arg_branch)],Ct);var At=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){g.symbolTableStack.isInMacroBranch||g.shaderData.globalPrecisions.push(this)},p}(G);e.PrecisionSpecifier=At,At=B([T(o.precision_specifier)],At);var Et=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){var v=this.children[0];this.ident=v.type,this.lexeme=v.lexeme,this.isBuiltin=typeof this.ident!="string"},C.codeGen=function(g){return this.setCache(g.visitFunctionIdentifier(this))},p}(G);e.FunctionIdentifier=Et,Et=B([T(o.function_identifier)],Et);var Xe=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){if(this.children.length===1){var v=this.children[0],A;this.type=(A=v.type)!=null?A:_e}else{var b=this.children[2],L;this.type=(L=b.type)!=null?L:_e}},p}(l);e.AssignmentExpression=Xe,Xe=B([T(o.assignment_expression)],Xe);var at=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){if(this.children.length===1){var v=this.children[0];this.type=v.type}else{var A=this.children[2];this.type=A.type}},p}(l);e.Expression=at,at=B([T(o.expression)],at);var bt=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){if(this.children.length===1){var v=this.children[0];if(R(v,Qe)){var A;this.type=(A=v.typeInfo)!=null?A:_e}else switch(v.type){case h.INT_CONSTANT:this._type=a.INT;break;case h.FLOAT_CONSTANT:this.type=a.FLOAT;break;case a.True:case a.False:this.type=a.BOOL;break}}else{var b=this.children[1];this.type=b.type}},p}(l);e.PrimaryExpression=bt,bt=B([T(o.primary_expression)],bt);var xt=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){if(d.prototype.init.call(this),this.children.length===1){var g=this.children[0];this.type=g.type}},C.codeGen=function(g){return this.setCache(g.visitPostfixExpression(this))},p}(l);e.PostfixExpression=xt,xt=B([T(o.postfix_expression)],xt);var yt=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this.ident=void 0},C.semanticAnalyze=function(g){var v=this.children;this.isInMacroBranch=g.symbolTableStack.isInMacroBranch,v.length===6?(this.ident=v[1],g.symbolTableStack.insert(new Ai(this.ident.lexeme,this)),this.propList=v[3].propList,this.macroExpressions=v[3].macroExpressions):(this.propList=v[2].propList,this.macroExpressions=v[2].macroExpressions)},C.codeGen=function(g){return this.setCache(g.visitStructSpecifier(this))},p}(G);e.StructSpecifier=yt,yt=B([T(o.struct_specifier)],yt);var nt=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.propList=[],m.macroExpressions=[],m}var C=p.prototype;return C.init=function(){this.propList.length=0,this.macroExpressions.length=0},C.semanticAnalyze=function(g){var v=this,A=v.children,b=v.propList,L=v.macroExpressions;if(A.length===1){var F,z;(F=b).push.apply(F,[].concat(A[0].props)),(z=L).push.apply(z,[].concat(A[0].macroExpressions))}else{var H,J,K,ie;(H=b).push.apply(H,[].concat(A[0].propList)),(J=b).push.apply(J,[].concat(A[1].props)),(K=L).push.apply(K,[].concat(A[0].macroExpressions)),(ie=L).push.apply(ie,[].concat(A[1].macroExpressions))}},p}(G);e.StructDeclarationList=nt,nt=B([T(o.struct_declaration_list)],nt);var It=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.props=[],m.macroExpressions=[],m}var C=p.prototype;return C.init=function(){this._typeSpecifier=void 0,this._declaratorList=void 0,this.props.length=0,this.macroExpressions.length=0},C.semanticAnalyze=function(g){var v=this,A=v.children,b=v.props,L=v.macroExpressions;if(A.length===1){for(var F,z=A[0],H=z.props,J=0,K=H.length;J<K;J++)H[J].isInMacroBranch=!0,b.push(H[J]);(F=L).push.apply(F,[].concat(z.macroExpressions));return}A.length===3?(this._typeSpecifier=A[0],this._declaratorList=A[1]):(this._typeSpecifier=A[1],this._declaratorList=A[2]);var ie=A[0],ae=this._typeSpecifier,le=ae.type,Oe=ae.lexeme,Me=g.symbolTableStack.isInMacroBranch;if(R(ie,st)){var De=A[2],Mr=new Ve(le,Oe),Rr=new fr(Mr,De.ident,ie.index,Me);b.push(Rr)}else{var Kt=this._declaratorList.declaratorList,er=Kt.length;b.length=er;for(var pt=0;pt<er;pt++){var tr=Kt[pt],Lr=new Ve(le,Oe,tr.arraySpecifier),Dr=new fr(Lr,tr.ident,void 0,Me);b[pt]=Dr}}},p}(G);e.StructDeclaration=It,It=B([T(o.struct_declaration)],It);var Ot=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.props=[],m.macroExpressions=[],m}var C=p.prototype;return C.init=function(){this.props.length=0,this.macroExpressions.length=0},C.semanticAnalyze=function(){var g=this.children;if(this.macroExpressions.push(g[0]),g.length===3){var v,A,b,L;(v=this.props).push.apply(v,[].concat(g[1].propList)),(A=this.props).push.apply(A,[].concat(g[2].props)),(b=this.macroExpressions).push.apply(b,[].concat(g[1].macroExpressions)),(L=this.macroExpressions).push.apply(L,[].concat(g[2].macroExpressions))}else{var F,z;(F=this.props).push.apply(F,[].concat(g[1].props)),(z=this.macroExpressions).push.apply(z,[].concat(g[1].macroExpressions))}},p}(G);e.MacroStructDeclaration=Ot,Ot=B([T(o.macro_struct_declaration)],Ot);var Pt=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.props=[],m.macroExpressions=[],m}var C=p.prototype;return C.init=function(){this.props.length=0,this.macroExpressions.length=0},C.semanticAnalyze=function(){var g=this.children,v=g[g.length-1];if(this.macroExpressions.push(g[0]),R(g[1],nt)){var A,b;(A=this.props).push.apply(A,[].concat(g[1].propList)),(b=this.macroExpressions).push.apply(b,[].concat(g[1].macroExpressions))}if(R(v,p)){var L,F;(L=this.props).push.apply(L,[].concat(v.props)),(F=this.macroExpressions).push.apply(F,[].concat(v.macroExpressions))}g.length>1&&R(v,Ye)&&this.macroExpressions.push(v)},p}(G);e.MacroStructBranch=Pt,Pt=B([T(o.macro_struct_branch)],Pt);var st=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){this.index=Number(this.children[4].lexeme)},p}(G);e.LayoutQualifier=st,st=B([T(o.layout_qualifier)],st);var Mt=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.declaratorList=[],m}var C=p.prototype;return C.init=function(){this.declaratorList.length=0},C.semanticAnalyze=function(g){var v=this,A=v.children,b=v.declaratorList;if(A.length===1)b.push(A[0]);else{var L=A[0],F=A[1],z=L.declaratorList.length;b.length=z+1;for(var H=0;H<z;H++)b[H]=L.declaratorList[H];b[z]=F}},p}(G);e.StructDeclaratorList=Mt,Mt=B([T(o.struct_declarator_list)],Mt);var Rt=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this.arraySpecifier=void 0},C.semanticAnalyze=function(g){var v=this.children;this.ident=v[0],this.arraySpecifier=v[1]},p}(G);e.StructDeclarator=Rt,Rt=B([T(o.struct_declarator)],Rt);var we=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this.isStatic=!1},C.semanticAnalyze=function(g){var v=this.children,A=v[0],b=v[1];this.type=A;var L=new We(b.lexeme,new Ve(A.type,A.typeSpecifier.lexeme),!0,this);g.symbolTableStack.insert(L),v.length===4&&(this.isStatic=!0)},C.codeGen=function(g){return this.isStatic?d.prototype.codeGen.call(this,g):this.setCache(g.visitGlobalVariableDeclaration(this))},p}(G);e.VariableDeclaration=we,we=B([T(o.variable_declaration)],we);var Lt=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.variableDeclarations=[],m}var C=p.prototype;return C.init=function(){this.variableDeclarations.length=0},C.semanticAnalyze=function(g){var v=this.children,A=v.length,b=v[0],L=b.type;if(this.type=L,R(b,we))this.variableDeclarations.push(b);else{var F;(F=this.variableDeclarations).push.apply(F,[].concat(b.variableDeclarations));var z=v[2],H=we.pool.get();A===3?H.set(z.location,[L,z]):H.set(z.location,[L,z,v[3]]),H.semanticAnalyze(g),this.variableDeclarations.push(H)}},p}(G);e.VariableDeclarationList=Lt,Lt=B([T(o.variable_declaration_list)],Lt);var Qe=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.referenceGlobalSymbolNames=[],m._symbols=[],m}var C=p.prototype;return C.init=function(){this.typeInfo=_e,this.referenceGlobalSymbolNames.length=0,this._symbols.length=0},C.semanticAnalyze=function(g){for(var v=this.children[0],A=this.referenceGlobalSymbolNames,b=this._symbols,L=R(v,w)?[v.lexeme]:v.referenceSymbolNames,F=0;F<L.length;F++){var z=L[F];if(!g.macroDefineList[z]&&!(!R(v,w)&&f.isExist(z))){var H=re.getVar(z);if(H){this.typeInfo=H.type;continue}var J=p._lookupAndMarkGlobalReference(g,z,b,A,this.location);if(J&&(R(v,w)||!v.hasAstValue)){var K;this.typeInfo=(K=b[0].dataType)==null?void 0:K.type}}}R(v,w)||p._probeCrossArmShadowing(g,v,L,b,A)},C.codeGen=function(g){return this.setCache(g.visitVariableIdentifier(this))},C.getLexeme=function(g){var v=this.children[0];return R(v,w)?v.lexeme:v.codeGen(g)},p._probeCrossArmShadowing=function(g,v,A,b,L){var F=v.macroName;F&&A.indexOf(F)===-1&&(f.isExist(F)||re.getVar(F)||p._lookupAndMarkGlobalReference(g,F,b,L,null))},p._lookupAndMarkGlobalReference=function(g,v,A,b,L){var F=dt._lookupSymbol;if(F.set(v,oe.Any),g.symbolTableStack.lookupAll(F,!0,A),!A.length)return!1;var z=g.symbolTableStack.scope.getSymbol(F,!0),H=z?R(z,ft)||z.isGlobalVariable:A.some(function(J){return R(J,ft)||J.isGlobalVariable});return H&&b.indexOf(v)===-1&&b.push(v),!0},p}(G);e.VariableIdentifier=Qe,Qe=B([T(o.variable_identifier)],Qe);var Dt=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){this.shaderData=g.shaderData,this.shaderData.symbolTable=g.symbolTableStack.scope},p}(G);e.GLShaderProgram=Dt,Dt=B([T(o.gs_shader_program)],Dt);var Vt=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.macroExpressions=[],m}var C=p.prototype;return C.init=function(){this.macroExpressions.length=0},C.semanticAnalyze=function(g){var v=this.children[0];if(R(v,ot)||R(v,$e)||R(v,ut)||R(v,w))if(g.shaderData.globalMacroDeclarations.push(this),R(v,$e)){var A;(A=this.macroExpressions).push.apply(A,[].concat(v.macroExpressions))}else this.macroExpressions.push(v)},p}(G);e.GlobalDeclaration=Vt,Vt=B([T(o.global_declaration)],Vt);var ot=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.codeGen=function(g){return this.setCache(d.prototype.codeGen.call(this,g)+`
|
|
10
10
|
`)},p}(G);e.MacroUndef=ot,ot=B([T(o.macro_undef)],ot);var Ft=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){g.symbolTableStack._macroLevel++},C.codeGen=function(g){return this.setCache(`
|
|
11
11
|
`+d.prototype.codeGen.call(this,g)+`
|
|
12
12
|
`)},p}(G);e.MacroPushContext=Ft,Ft=B([T(o.macro_push_context)],Ft);var Ye=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.semanticAnalyze=function(g){g.symbolTableStack._macroLevel--},C.codeGen=function(g){return this.setCache(`
|
|
@@ -16,29 +16,29 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
16
16
|
`)},p}(G);e.MacroElifExpression=Gt,Gt=B([T(o.macro_elif_expression)],Gt);var Bt=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.codeGen=function(g){return this.setCache(`
|
|
17
17
|
`+d.prototype.codeGen.call(this,g)+`
|
|
18
18
|
`)},p}(G);e.MacroElseExpression=Bt,Bt=B([T(o.macro_else_expression)],Bt);var ct=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.macroExpressions=[],m}var C=p.prototype;return C.init=function(){this.macroExpressions.length=0},C.semanticAnalyze=function(g){var v=this.children,A=this.macroExpressions;if(v.length===1){var b;(b=A).push.apply(b,[].concat(v[0].macroExpressions))}else{var L,F;(L=A).push.apply(L,[].concat(v[0].macroExpressions)),(F=A).push.apply(F,[].concat(v[1].macroExpressions))}},C.codeGen=function(g){var v=this.children;return v.length===1?this.setCache(v[0].codeGen(g)):this.setCache(v[0].codeGen(g)+`
|
|
19
|
-
`+v[1].codeGen(g))},p}(G);e.GlobalMacroDeclaration=ct,ct=B([T(o.global_macro_declaration)],ct);var $e=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.macroExpressions=[],m}var C=p.prototype;return C.init=function(){this.macroExpressions.length=0},C.semanticAnalyze=function(g){var v=this.children,A=this.macroExpressions;if(v.length===3){var b,L;A.push(v[0]),(b=A).push.apply(b,[].concat(v[1].macroExpressions)),(L=A).push.apply(L,[].concat(v[2].macroExpressions))}else{var F;A.push(v[0]),(F=A).push.apply(F,[].concat(v[1].macroExpressions))}},p}(G);e.GlobalMacroIfStatement=$e,$e=B([T(o.global_macro_if_statement)],$e);var Tt=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.macroExpressions=[],m}var C=p.prototype;return C.init=function(){this.macroExpressions.length=0},C.semanticAnalyze=function(g){var v=this.children,A=v[v.length-1],b=this.macroExpressions;if(b.push(v[0]),R(v[1],ct)){var L;(L=b).push.apply(L,[].concat(v[1].macroExpressions))}if(R(A,p)){var F;(F=b).push.apply(F,[].concat(A.macroExpressions))}v.length>1&&R(A,Ye)&&b.push(A)},p}(G);e.GlobalMacroBranch=Tt,Tt=B([T(o.global_macro_branch)],Tt);var kt=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.MacroIfStatement=kt,kt=B([T(o.macro_if_statement)],kt);var Ut=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.MacroBranch=Ut,Ut=B([T(o.macro_branch)],Ut);var lt=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.referenceSymbolNames=[],m.hasAstValue=!1,m.isFunctionLikeMacro=!1,m.aliasesNonBuiltinIdent=!1,m}var C=p.prototype;return C.init=function(){this.referenceSymbolNames.length=0,this.hasAstValue=!1,this.isFunctionLikeMacro=!1,this.aliasesNonBuiltinIdent=!1},C.semanticAnalyze=function(g){var v=this.children[0],A=v.lexeme;this.macroName=A;var b=v.branch,L=g.macroDefineList[A],F=this.referenceSymbolNames;F.length=0;var z=0,H=!0,J=!1,K=!0;if(L)for(var ie=0,ae=L.length;ie<ae;ie++){var le=L[ie];if(rt.isVisibleFrom(le.branch,b))if(z++,le.valueAst==null&&(H=!1),le.isFunction&&(J=!0),le.valueAst&&p._collectIdentifierRefs(le.valueAst,le.params,F),le.isFunction||!le.valueAst)K=!1;else{var Oe=Be.unwrapBareIdentifier(le.valueAst,{allowParens:!1}),Me=Oe==null?void 0:Oe.children[0],De=R(Me,w)?Me.lexeme:void 0;(!De||f.isExist(De))&&(K=!1)}}this.hasAstValue=z>0&&H,this.isFunctionLikeMacro=J,this.aliasesNonBuiltinIdent=z>0&&K},p._collectIdentifierRefs=function(g,v,A){if(R(g,Qe)){var b=g.children[0];if(R(b,w)){var L=b.lexeme;v.indexOf(L)===-1&&A.indexOf(L)===-1&&A.push(L)}return}var F=g.children;if(F)for(var z=0,H=F.length;z<H;z++){var J=F[z];R(J,G)&&p._collectIdentifierRefs(J,v,A)}},p}(G);e.MacroCallSymbol=lt,lt=B([T(o.macro_call_symbol)],lt);var Wt=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.referenceSymbolNames=[],m.macroName="",m.hasAstValue=!1,m.isFunctionLikeMacro=!1,m.aliasesNonBuiltinIdent=!1,m}var C=p.prototype;return C.init=function(){this.referenceSymbolNames=[],this.macroName="",this.hasAstValue=!1,this.isFunctionLikeMacro=!1,this.aliasesNonBuiltinIdent=!1},C.semanticAnalyze=function(g){var v=this.children[0];this.referenceSymbolNames=v.referenceSymbolNames,this.macroName=v.macroName,this.hasAstValue=v.hasAstValue,this.isFunctionLikeMacro=v.isFunctionLikeMacro,this.aliasesNonBuiltinIdent=v.aliasesNonBuiltinIdent},C.codeGen=function(g){return this.setCache(g.visitMacroCallFunction(this))},p}(G);e.MacroCallFunction=Wt,Wt=B([T(o.macro_call_function)],Wt);var ut=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this.macroName="",this.isFunction=!1,this.valueExpression=void 0},C.semanticAnalyze=function(g){var v=this,A=this.children;this.macroName=A[1].lexeme;var b=[],L=2;R(A[2],w)&&A[2].type===a.MACRO_DEFINE_PARAMS&&(this.isFunction=!0,b=Be.parseMacroParamList(A[2].lexeme),L=3),R(A[L],at)&&(this.valueExpression=A[L]);var F=A[1].branch,z=g.macroDefineList,H=z[this.macroName],J=function(ae){return ae.isFunction===v.isFunction&&ae.params.length===b.length&&ae.params.every(function(le,Oe){return le===b[Oe]})},K=H==null?void 0:H.find(function(ae){return!ae.valueAst&&J(ae)&&rt.sameBranch(ae.branch,F)});if(K)K.valueAst=this.valueExpression;else{var ie={isFunction:this.isFunction,params:b,valueAst:this.valueExpression,dedupKey:this.macroName+"#ast/"+(this.isFunction?b.join(","):""),branch:F};H?H.push(ie):z[this.macroName]=[ie]}this.isFunction&&g.popScope()},C.codeGen=function(g){return this.setCache(g.visitMacroDefine(this))},p}(G);e.MacroDefine=ut,ut=B([T(o.macro_define)],ut)})(P||(P={}));var P,$=function(){function e(){this.attributeStructs=[],this.attributeList=[],this.varyingStructs=[],this.varyingList=[],this.mrtStructs=[],this.mrtList=[],this._referencedGlobalMacroASTs=[]}var c=e.prototype;return c.reset=function(t){t===void 0&&(t=!0),t&&(this.attributeStructs.length=0,this.attributeList.length=0,this.varyingStructs.length=0,this.varyingList.length=0,this.mrtStructs.length=0,this.mrtList.length=0),this._referencedAttributeList=Object.create(null),this._referencedVaryingList=Object.create(null),this._referencedMRTList=Object.create(null),this._referencedGlobals=Object.create(null),this._referencedGlobalMacroASTs.length=0,t&&(this._structVarMap=Object.create(null))},c.isAttributeStruct=function(t){return this.attributeStructs.findIndex(function(r){return r.ident.lexeme===t})!==-1},c.isVaryingStruct=function(t){return this.varyingStructs.findIndex(function(r){return r.ident.lexeme===t})!==-1},c.isMRTStruct=function(t){return this.mrtStructs.findIndex(function(r){return r.ident.lexeme===t})!==-1},c.getStructRole=function(t){if(this.isAttributeStruct(t))return"attribute";if(this.isVaryingStruct(t))return"varying";if(this.isMRTStruct(t))return"mrt"},c.registerStructVar=function(t,r){this._structVarMap[t]=r},c.referenceAttribute=function(t){return this._referenceProp("attribute",t.lexeme,this.attributeList,this._referencedAttributeList,t.location)},c.referenceVarying=function(t){return this._referenceProp("varying",t.lexeme,this.varyingList,this._referencedVaryingList,t.location)},c.referenceMRTProp=function(t){return this._referenceProp("mrt",t.lexeme,this.mrtList,this._referencedMRTList,t.location)},c.referenceGlobal=function(t,r){if(!this._referencedGlobals[t]){this._referencedGlobals[t]=[];var n=e._lookupSymbol;n.set(t,r),this._passSymbolTable.getSymbols(n,!0,this._referencedGlobals[t])}},c._referenceProp=function(t,r,n,s,l){if(!s[r]){var u=n.filter(function(_){return _.ident.lexeme===r});if(!u.length)return xe.createGSError("referenced "+t+" not found: "+r,He.CompilationError,Ce._processingPassText,l);s[r]=u}},e.reset=function(){this._singleton||(this._singleton=new e),this._singleton.reset()},be(e,null,[{key:"context",get:function(){return this._singleton}}]),e}();$._lookupSymbol=new Te("",null);var
|
|
19
|
+
`+v[1].codeGen(g))},p}(G);e.GlobalMacroDeclaration=ct,ct=B([T(o.global_macro_declaration)],ct);var $e=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.macroExpressions=[],m}var C=p.prototype;return C.init=function(){this.macroExpressions.length=0},C.semanticAnalyze=function(g){var v=this.children,A=this.macroExpressions;if(v.length===3){var b,L;A.push(v[0]),(b=A).push.apply(b,[].concat(v[1].macroExpressions)),(L=A).push.apply(L,[].concat(v[2].macroExpressions))}else{var F;A.push(v[0]),(F=A).push.apply(F,[].concat(v[1].macroExpressions))}},p}(G);e.GlobalMacroIfStatement=$e,$e=B([T(o.global_macro_if_statement)],$e);var Tt=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.macroExpressions=[],m}var C=p.prototype;return C.init=function(){this.macroExpressions.length=0},C.semanticAnalyze=function(g){var v=this.children,A=v[v.length-1],b=this.macroExpressions;if(b.push(v[0]),R(v[1],ct)){var L;(L=b).push.apply(L,[].concat(v[1].macroExpressions))}if(R(A,p)){var F;(F=b).push.apply(F,[].concat(A.macroExpressions))}v.length>1&&R(A,Ye)&&b.push(A)},p}(G);e.GlobalMacroBranch=Tt,Tt=B([T(o.global_macro_branch)],Tt);var kt=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.MacroIfStatement=kt,kt=B([T(o.macro_if_statement)],kt);var Ut=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}return p}(G);e.MacroBranch=Ut,Ut=B([T(o.macro_branch)],Ut);var lt=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.referenceSymbolNames=[],m.hasAstValue=!1,m.isFunctionLikeMacro=!1,m.aliasesNonBuiltinIdent=!1,m}var C=p.prototype;return C.init=function(){this.referenceSymbolNames.length=0,this.hasAstValue=!1,this.isFunctionLikeMacro=!1,this.aliasesNonBuiltinIdent=!1},C.semanticAnalyze=function(g){var v=this.children[0],A=v.lexeme;this.macroName=A;var b=v.branch,L=g.macroDefineList[A],F=this.referenceSymbolNames;F.length=0;var z=0,H=!0,J=!1,K=!0;if(L)for(var ie=0,ae=L.length;ie<ae;ie++){var le=L[ie];if(rt.isVisibleFrom(le.branch,b))if(z++,le.valueAst==null&&(H=!1),le.isFunction&&(J=!0),le.valueAst&&p._collectIdentifierRefs(le.valueAst,le.params,F),le.isFunction||!le.valueAst)K=!1;else{var Oe=Be.unwrapBareIdentifier(le.valueAst,{allowParens:!1}),Me=Oe==null?void 0:Oe.children[0],De=R(Me,w)?Me.lexeme:void 0;(!De||f.isExist(De))&&(K=!1)}}this.hasAstValue=z>0&&H,this.isFunctionLikeMacro=J,this.aliasesNonBuiltinIdent=z>0&&K},p._collectIdentifierRefs=function(g,v,A){if(R(g,Qe)){var b=g.children[0];if(R(b,w)){var L=b.lexeme;v.indexOf(L)===-1&&A.indexOf(L)===-1&&A.push(L)}return}var F=g.children;if(F)for(var z=0,H=F.length;z<H;z++){var J=F[z];R(J,G)&&p._collectIdentifierRefs(J,v,A)}},p}(G);e.MacroCallSymbol=lt,lt=B([T(o.macro_call_symbol)],lt);var Wt=function(d){D(p,d);function p(){var m;return m=d.apply(this,arguments)||this,m.referenceSymbolNames=[],m.macroName="",m.hasAstValue=!1,m.isFunctionLikeMacro=!1,m.aliasesNonBuiltinIdent=!1,m}var C=p.prototype;return C.init=function(){this.referenceSymbolNames=[],this.macroName="",this.hasAstValue=!1,this.isFunctionLikeMacro=!1,this.aliasesNonBuiltinIdent=!1},C.semanticAnalyze=function(g){var v=this.children[0];this.referenceSymbolNames=v.referenceSymbolNames,this.macroName=v.macroName,this.hasAstValue=v.hasAstValue,this.isFunctionLikeMacro=v.isFunctionLikeMacro,this.aliasesNonBuiltinIdent=v.aliasesNonBuiltinIdent},C.codeGen=function(g){return this.setCache(g.visitMacroCallFunction(this))},p}(G);e.MacroCallFunction=Wt,Wt=B([T(o.macro_call_function)],Wt);var ut=function(d){D(p,d);function p(){return d.apply(this,arguments)||this}var C=p.prototype;return C.init=function(){this.macroName="",this.isFunction=!1,this.valueExpression=void 0},C.semanticAnalyze=function(g){var v=this,A=this.children;this.macroName=A[1].lexeme;var b=[],L=2;R(A[2],w)&&A[2].type===a.MACRO_DEFINE_PARAMS&&(this.isFunction=!0,b=Be.parseMacroParamList(A[2].lexeme),L=3),R(A[L],at)&&(this.valueExpression=A[L]);var F=A[1].branch,z=g.macroDefineList,H=z[this.macroName],J=function(ae){return ae.isFunction===v.isFunction&&ae.params.length===b.length&&ae.params.every(function(le,Oe){return le===b[Oe]})},K=H==null?void 0:H.find(function(ae){return!ae.valueAst&&J(ae)&&rt.sameBranch(ae.branch,F)});if(K)K.valueAst=this.valueExpression;else{var ie={isFunction:this.isFunction,params:b,valueAst:this.valueExpression,dedupKey:this.macroName+"#ast/"+(this.isFunction?b.join(","):""),branch:F};H?H.push(ie):z[this.macroName]=[ie]}this.isFunction&&g.popScope()},C.codeGen=function(g){return this.setCache(g.visitMacroDefine(this))},p}(G);e.MacroDefine=ut,ut=B([T(o.macro_define)],ut)})(P||(P={}));var P,$=function(){function e(){this.attributeStructs=[],this.attributeList=[],this.varyingStructs=[],this.varyingList=[],this.mrtStructs=[],this.mrtList=[],this._referencedGlobalMacroASTs=[]}var c=e.prototype;return c.reset=function(t){t===void 0&&(t=!0),t&&(this.attributeStructs.length=0,this.attributeList.length=0,this.varyingStructs.length=0,this.varyingList.length=0,this.mrtStructs.length=0,this.mrtList.length=0),this._referencedAttributeList=Object.create(null),this._referencedVaryingList=Object.create(null),this._referencedMRTList=Object.create(null),this._referencedGlobals=Object.create(null),this._referencedGlobalMacroASTs.length=0,t&&(this._structVarMap=Object.create(null))},c.isAttributeStruct=function(t){return this.attributeStructs.findIndex(function(r){return r.ident.lexeme===t})!==-1},c.isVaryingStruct=function(t){return this.varyingStructs.findIndex(function(r){return r.ident.lexeme===t})!==-1},c.isMRTStruct=function(t){return this.mrtStructs.findIndex(function(r){return r.ident.lexeme===t})!==-1},c.getStructRole=function(t){if(this.isAttributeStruct(t))return"attribute";if(this.isVaryingStruct(t))return"varying";if(this.isMRTStruct(t))return"mrt"},c.registerStructVar=function(t,r){this._structVarMap[t]=r},c.referenceAttribute=function(t){return this._referenceProp("attribute",t.lexeme,this.attributeList,this._referencedAttributeList,t.location)},c.referenceVarying=function(t){return this._referenceProp("varying",t.lexeme,this.varyingList,this._referencedVaryingList,t.location)},c.referenceMRTProp=function(t){return this._referenceProp("mrt",t.lexeme,this.mrtList,this._referencedMRTList,t.location)},c.referenceGlobal=function(t,r){if(!this._referencedGlobals[t]){this._referencedGlobals[t]=[];var n=e._lookupSymbol;n.set(t,r),this._passSymbolTable.getSymbols(n,!0,this._referencedGlobals[t])}},c._referenceProp=function(t,r,n,s,l){if(!s[r]){var u=n.filter(function(_){return _.ident.lexeme===r});if(!u.length)return xe.createGSError("referenced "+t+" not found: "+r,He.CompilationError,Ce._processingPassText,l);s[r]=u}},e.reset=function(){this._singleton||(this._singleton=new e),this._singleton.reset()},be(e,null,[{key:"context",get:function(){return this._singleton}}]),e}();$._lookupSymbol=new Te("",null);var Ei=function(){function e(){this.array=new Array}var c=e.prototype;return c.dispose=function(){this.array.length=0},e}(),br=function(){function e(){}var c=e.prototype;return c.defaultCodeGen=function(t){var r=e._tmpArrayPool,n=r.get();n.dispose();for(var s=Y(t),l;!(l=s()).done;){var u=l.value;R(u,w)?n.array.push(u.lexeme):n.array.push(u.codeGen(this))}return r.return(n),n.array.join(" ")},c.visitPostfixExpression=function(t){var r=t.children,n=r.length,s=$.context;if(n===3){var l=r[0],u=r[2];if(R(u,w)){var _,S=Be.extractDirectIdentLexeme(l);return S&&(_=s._structVarMap[S]),_||(_=s.getStructRole(l.type)),_?(_==="attribute"?s.referenceAttribute(u):_==="varying"?s.referenceVarying(u):s.referenceMRTProp(u),u.lexeme):l.codeGen(this)+"."+u.lexeme}else return l.codeGen(this)+"."+u.codeGen(this)}else if(n===4){var E=r[0],O=r[2],M=E.codeGen(this),y=O.codeGen(this);return M==="gl_FragData"&&this._reportError(E.location,"Please use MRT struct instead of gl_FragData."),M+"["+y+"]"}return this.defaultCodeGen(t.children)},c.visitVariableIdentifier=function(t){for(var r=Y(t.referenceGlobalSymbolNames),n;!(n=r()).done;){var s=n.value;$.context.referenceGlobal(s,oe.Any)}return t.getLexeme(this)},c.visitFunctionCall=function(t){var r=t.children[0];if(R(r.fnSymbol,ft)){$.context.referenceGlobal(r.fnSymbol.ident,oe.FN);var n=r.children[2];if(R(n,P.FunctionCallParameterList)){for(var s=n.paramNodes,l=r.fnSymbol.astNode.protoType.parameterList,u=$.context,_=s.filter(function(I,V){var k,N=l==null||(k=l[V])==null?void 0:k.typeInfo;return!N||!u.getStructRole(N.typeLexeme)}),S="",E=0,O=_.length;E<O;E++){var M=_[E],y=M.codeGen(this);R(M,P.MacroCallArgBlock)||E===0?S+=y:S+=", "+y}return r.fnSymbol.ident+"("+S+")"}}return this.defaultCodeGen(t.children)},c.visitMacroCallFunction=function(t){var r=t.children,n=r[2];if(R(n,P.FunctionCallParameterList)){var s=n.paramNodes,l=$.context,u;t.isFunctionLikeMacro||!t.aliasesNonBuiltinIdent?u=s:u=s.filter(function(y){if(R(y,P.AssignmentExpression)){var I=Be.unwrapBareIdentifier(y,{allowParens:!1});if(I&&typeof I.typeInfo=="string"&&l.getStructRole(I.typeInfo))return!1}return!0});for(var _="",S=0,E=u.length;S<E;S++){var O=u[S],M=O.codeGen(this);R(O,P.MacroCallArgBlock)||S===0?_+=M:_+=", "+M}return t.macroName+"("+_+")"}else return this.defaultCodeGen(t.children)},c.visitStatementList=function(t){var r=t.children;return r.length===1?r[0].codeGen(this):r[0].codeGen(this)+`
|
|
20
20
|
`+r[1].codeGen(this)},c.visitMacroDefine=function(t){var r="";if(t.isFunction){var n=t.children[2];R(n,w)&&(r=n.lexeme)}var s=t.valueExpression?t.valueExpression.codeGen(this):"";return`
|
|
21
21
|
#define `+t.macroName+r+(s?" "+s:"")+`
|
|
22
22
|
`},c.visitSingleDeclaration=function(t){var r=t.typeSpecifier.type;return typeof r=="string"&&$.context.referenceGlobal(r,oe.STRUCT),this.defaultCodeGen(t.children)},c.visitGlobalVariableDeclaration=function(t){var r=t.children,n=r[0];if(R(n,P.FullySpecifiedType)&&n.typeSpecifier.isCustom){var s=$.context;if(s.getStructRole(n.typeSpecifier.lexeme))return"";s.referenceGlobal(n.type,oe.STRUCT)}return"uniform "+this.defaultCodeGen(r)},c.visitDeclaration=function(t){var r=$.context,n=t.children,s=n[0];if(R(s,P.InitDeclaratorList)){var l=s.typeInfo.typeLexeme;if(r.isVaryingStruct(l)||r.isMRTStruct(l))return""}return this.defaultCodeGen(n)},c.visitFunctionParameterList=function(t){for(var r=$.context,n=t.parameterInfoList.filter(function(O){return!O.typeInfo||!r.getStructRole(O.typeInfo.typeLexeme)}),s="",l=0,u=n.length;l<u;l++){var _=n[l],S=_.astNode,E=S.codeGen(this);R(S,P.MacroParamBlock)||l===0?s+=E:s+=", "+E}return s},c.visitFunctionHeader=function(t){var r=t.returnType.typeSpecifier.lexeme;return $.context.isVaryingStruct(r)?"void "+t.ident.lexeme+"(":this.defaultCodeGen(t.children)},c.visitJumpStatement=function(t){var r=t.children,n=r[0];if(n.type===a.RETURN){var s=r[1];if(R(s,P.Expression)){var l=Be.unwrapNodeByType(s,o.variable_identifier);if($.context.isVaryingStruct(l==null?void 0:l.typeInfo))return"";var u=Be.unwrapNodeByType(s,o.function_call);if($.context.isVaryingStruct(u==null?void 0:u.type))return""+s.codeGen(this)+";"}}return this.defaultCodeGen(r)},c.visitFunctionIdentifier=function(t){return this.defaultCodeGen(t.children)},c.visitStructSpecifier=function(t){var r=this,n=$.context,s=n.varyingStructs,l=n.attributeStructs,u=n.mrtStructs,_=s.indexOf(t)!==-1,S=l.indexOf(t)!==-1,E=u.indexOf(t)!==-1;if(_&&S&&this._reportError(t.location,"cannot use same struct as Varying and Attribute"),_&&E&&this._reportError(t.location,"cannot use same struct as Varying and MRT"),S&&E&&this._reportError(t.location,"cannot use same struct as Attribute and MRT"),_||S||E){var O,M=[];(O=M).push.apply(O,[].concat(t.macroExpressions.map(function(X){return{text:R(X,w)?X.lexeme:X.codeGen(r),index:X.location.start.index}})));for(var y=Y(t.propList),I;!(I=y()).done;){var V=I.value,k,N,W,U=V.ident.lexeme;_&&((k=n._referencedVaryingList[U])==null?void 0:k.indexOf(V))>=0?M.push({text:""+this.getVaryingProp(V)+`
|
|
23
23
|
`,index:V.ident.location.start.index}):S&&((N=n._referencedAttributeList[U])==null?void 0:N.indexOf(V))>=0?M.push({text:""+this.getAttributeProp(V)+`
|
|
24
24
|
`,index:V.ident.location.start.index}):E&&((W=n._referencedMRTList[U])==null?void 0:W.indexOf(V))>=0&&M.push({text:""+this.getMRTProp(V)+`
|
|
25
|
-
`,index:V.ident.location.start.index})}var j=M.sort(function(X,q){return X.index-q.index}).map(function(X){return X.text}).join("");return j}else return this.defaultCodeGen(t.children)},c.visitFunctionDefinition=function(t){var r=t.protoType.ident.lexeme,n=$.context;if(r==n.stageEntry){var s=t.statements.codeGen(this);return"void main() "+s}else return this.defaultCodeGen(t.children)},c._reportError=function(t,r){console.error(r)},e}();br._tmpArrayPool=new
|
|
25
|
+
`,index:V.ident.location.start.index})}var j=M.sort(function(X,q){return X.index-q.index}).map(function(X){return X.text}).join("");return j}else return this.defaultCodeGen(t.children)},c.visitFunctionDefinition=function(t){var r=t.protoType.ident.lexeme,n=$.context;if(r==n.stageEntry){var s=t.statements.codeGen(this);return"void main() "+s}else return this.defaultCodeGen(t.children)},c._reportError=function(t,r){console.error(r)},e}();br._tmpArrayPool=new Gr(Ei,10);var St=function(e){D(c,e);function c(){var t;return t=e.apply(this,arguments)||this,t._globalCodeArray=[],t}var i=c.prototype;return i.reset=function(){var r=this,n=r._globalCodeArray;n.length=0,c._serializedGlobalKey.clear()},i.getOtherGlobal=function(r,n){for(var s=Y(r.globalPrecisions),l;!(l=s()).done;){var u=l.value;n.push({text:u.codeGen(this),index:u.location.start.index})}},i.visitShaderProgram=function(r,n,s){$.reset(),this.reset();var l=r.shaderData,u=$.context;u._passSymbolTable=l.symbolTable;var _=l.getOuterGlobalMacroDeclarations();return this._collectAllStructVars(n,s),{vertex:this._vertexMain(n,l,_),fragment:this._fragmentMain(s,l,_)}},i._collectAllStructVars=function(r,n){for(var s=this,l=$.context,u=c._lookupSymbol,_=l._passSymbolTable,S=Object.create(null),E=function(q,Q,Z){u.set(q,oe.FN);for(var te=_.getSymbols(u,!0,[]),ve=Y(te),se;!(se=ve()).done;){var me=se.value,Se,ge,he=me.astNode.protoType,Ee=(Se=he.parameterList)==null?void 0:Se[0];Ee&&typeof((ge=Ee.typeInfo)==null?void 0:ge.type)=="string"&&(S[Ee.typeInfo.typeLexeme]=Q),typeof he.returnType.type=="string"&&(S[he.returnType.type]=Z)}return te},O=E(r,"attribute","varying").concat(E(n,"varying","mrt")),M=function(q,Q){if(q){var Z=S[q];Z&&l.registerStructVar(Q,Z)}},y=function(q){for(var Q=Y(q.children),Z;!(Z=Q()).done;){var te=Z.value;if(R(te,P.InitDeclaratorList)){var ve,se=(ve=te.typeInfo)==null?void 0:ve.typeLexeme;se&&S[se]&&s._extractLocalVarNames(te,l,S[se])}else R(te,G)&&y(te)}},I=Y(O),V;!(V=I()).done;){var k=V.value,N=k.astNode.protoType;if(N.parameterList)for(var W=Y(N.parameterList),U;!(U=W()).done;){var j=U.value,X;j.ident&&typeof((X=j.typeInfo)==null?void 0:X.type)=="string"&&M(j.typeInfo.typeLexeme,j.ident.lexeme)}y(k.astNode.statements)}_.forEach(function(q){var Q;q.type===oe.VAR&&M((Q=q.dataType)==null?void 0:Q.typeLexeme,q.ident)})},i._vertexMain=function(r,n,s){var l=this,u=$.context;u.stage=ce.VERTEX,u.stageEntry=r;var _=c._lookupSymbol,S=n.symbolTable;_.set(r,oe.FN);var E=S.getSymbols(_,!0,[]);if(!E.length)throw"no entry function found: "+r;var O=u.attributeStructs,M=u.attributeList,y=u.varyingStructs,I=u.varyingList;E.forEach(function(N){var W=N.astNode,U=W.protoType.returnType;if(typeof U.type=="string"){_.set(U.type,oe.STRUCT);var j=S.getSymbols(_,!0,[]);if(!j.length)l._reportError(U.location,'invalid varying struct: "'+U.type+'".');else for(var X=0;X<j.length;X++){var q=j[X],Q=q.astNode;y.push(Q);for(var Z=Y(Q.propList),te;!(te=Z()).done;){var ve=te.value;I.push(ve)}}}else U.type!==a.VOID&&l._reportError(U.location,"vertex main entry can only return struct or void.");var se=W.protoType.parameterList,me=se==null?void 0:se[0];if(me){var Se=me.typeInfo.type;if(typeof Se=="string"){_.set(Se,oe.STRUCT);var ge=S.getSymbols(_,!0,[]);if(!ge.length)l._reportError(me.astNode.location,'invalid attribute struct: "'+Se+'".');else for(var he=0;he<ge.length;he++){var Ee=ge[he],ye=Ee.astNode;O.push(ye);for(var Ie=Y(ye.propList),ke;!(ke=Ie()).done;){var Le=ke.value;M.push(Le)}}}}}),this._preRegisterGlobalMacroRefs(s);var V=this._globalCodeArray;$.context.referenceGlobal(r,oe.FN),this._getGlobalSymbol(V),this._getCustomStruct(u.attributeStructs,V),this._getCustomStruct(u.varyingStructs,V),this._getGlobalMacroDeclarations(s,V),this.getOtherGlobal(n,V);var k=V.sort(function(N,W){return N.index-W.index}).map(function(N){return N.text}).join(`
|
|
26
26
|
`);return $.context.reset(!1),this.reset(),k},i._fragmentMain=function(r,n,s){var l=this,u=$.context;u.stage=ce.FRAGMENT,u.stageEntry=r;var _=c._lookupSymbol,S=n.symbolTable;_.set(r,oe.FN);var E=S.getSymbols(_,!0,[]);if(!(E!=null&&E.length))throw"no entry function found: "+r;E.forEach(function(y){var I=y.astNode,V=I.returnStatement;V&&(V.isFragReturnStatement=!0);var k=I.protoType.returnType,N=k.type,W=k.location;if(typeof N=="string"){_.set(N,oe.STRUCT);var U=S.getSymbols(_,!0,[]);if(!U.length)l._reportError(W,"invalid mrt struct: "+N);else for(var j=0;j<U.length;j++){var X=U[j],q=X.astNode;u.mrtStructs.push(q);for(var Q=Y(q.propList),Z;!(Z=Q()).done;){var te=Z.value;u.mrtList.push(te)}}}else N!==a.VOID&&N!==a.VEC4&&l._reportError(W,"fragment main entry can only return struct or vec4.")}),this._preRegisterGlobalMacroRefs(s);var O=this._globalCodeArray;$.context.referenceGlobal(r,oe.FN),this._getGlobalSymbol(O),this._getCustomStruct(u.varyingStructs,O),this._getCustomStruct(u.mrtStructs,O),this._getGlobalMacroDeclarations(s,O),this.getOtherGlobal(n,O);var M=O.sort(function(y,I){return y.index-I.index}).map(function(y){return y.text}).join(`
|
|
27
27
|
`);return u.reset(),this.reset(),M},i._extractLocalVarNames=function(r,n,s){var l=r.children;if(l.length===1){var u=l[0],_=u.children;_.length>=2&&R(_[1],w)&&n.registerStructVar(_[1].lexeme,s)}else if(l.length>=3){var S=l[0];R(S,P.InitDeclaratorList)&&this._extractLocalVarNames(S,n,s),R(l[2],w)&&n.registerStructVar(l[2].lexeme,s)}},i._preRegisterGlobalMacroRefs=function(r){for(var n=Y(r),s;!(s=n()).done;){var l=s.value;this._walkMacroDefineTokens(l.children)}},i._walkMacroDefineTokens=function(r){for(var n=Y(r),s;!(s=n()).done;){var l=s.value;R(l,P.MacroDefine)?l.valueExpression&&l.valueExpression.codeGen(this):R(l,G)&&this._walkMacroDefineTokens(l.children)}},i._getGlobalSymbol=function(r){var n=$.context,s=n._referencedGlobals,l=Object.keys(s).length;if(l!==0){for(var u in s)if(!c._serializedGlobalKey.has(u)){c._serializedGlobalKey.add(u);for(var _=s[u],S=0,E=_.length;S<E;S++){var O=_[S],M=O.astNode.codeGen(this);if(M){var y=M+(O.type===oe.VAR?";":"");O.isInMacroBranch||r.push({text:y,index:O.astNode.location.start.index})}}}Object.keys(s).length!==l&&this._getGlobalSymbol(r)}},i._getCustomStruct=function(r,n){for(var s=Y(r),l;!(l=s()).done;){var u=l.value,_=u.codeGen(this);u.isInMacroBranch||n.push({text:_,index:u.location.start.index})}},i._getGlobalMacroDeclarations=function(r,n){var s=this,l=$.context,u=l._referencedGlobals,_=l._referencedGlobalMacroASTs;_.length=0;for(var S=Y(Object.values(u)),E;!(E=S()).done;)for(var O=E.value,M=Y(O),y;!(y=M()).done;){var I=y.value;I.isInMacroBranch&&_.push(I.astNode)}for(var V=Y(r),k;!(k=V()).done;){var N=k.value,W=void 0,U=N.children[0];if(R(U,P.GlobalMacroIfStatement)){var j,X=[];(j=X).push.apply(j,[].concat(N.macroExpressions.map(function(q){return{text:R(q,w)?q.lexeme:q.codeGen(s),index:q.location.start.index}}))),this._visitGlobalMacroIfStatement(U,X),W=X.sort(function(q,Q){return q.index-Q.index}).map(function(q){return q.text}).join(`
|
|
28
|
-
`)}else R(U,w)&&U.type===a.MACRO_DEFINE_EXPRESSION?W=U.lexeme:W=N.codeGen(this);n.push({text:W,index:N.location.start.index})}},i._visitGlobalMacroIfStatement=function(r,n){for(var s=r.children,l=0;l<s.length;l++){var u=s[l];if(R(u,P.PrecisionSpecifier))n.push({text:u.codeGen(this),index:u.location.start.index});else if(R(u,P.FunctionDefinition))$.context._referencedGlobalMacroASTs.indexOf(u)!==-1&&n.push({text:u.getCache(),index:u.location.start.index});else if(R(u,P.StructSpecifier)){var _,S,E,O,M=$.context,y=M.stage;($.context._referencedGlobalMacroASTs.indexOf(u)!==-1||(y===ce.VERTEX?M.isAttributeStruct((_=u.ident)==null?void 0:_.lexeme)||M.isVaryingStruct((S=u.ident)==null?void 0:S.lexeme):M.isVaryingStruct((E=u.ident)==null?void 0:E.lexeme)||M.isMRTStruct((O=u.ident)==null?void 0:O.lexeme)))&&n.push({text:u.getCache(),index:u.location.start.index})}else if(R(u,P.VariableDeclarationList))for(var I=u.variableDeclarations,V=0;V<I.length;V++){var k=I[V];$.context._referencedGlobalMacroASTs.indexOf(k)!==-1&&n.push({text:k.getCache()+";",index:k.location.start.index})}R(u,G)&&this._visitGlobalMacroIfStatement(u,n)}},c}(br);St._lookupSymbol=new Te("",null);St._serializedGlobalKey=new Set;var
|
|
28
|
+
`)}else R(U,w)&&U.type===a.MACRO_DEFINE_EXPRESSION?W=U.lexeme:W=N.codeGen(this);n.push({text:W,index:N.location.start.index})}},i._visitGlobalMacroIfStatement=function(r,n){for(var s=r.children,l=0;l<s.length;l++){var u=s[l];if(R(u,P.PrecisionSpecifier))n.push({text:u.codeGen(this),index:u.location.start.index});else if(R(u,P.FunctionDefinition))$.context._referencedGlobalMacroASTs.indexOf(u)!==-1&&n.push({text:u.getCache(),index:u.location.start.index});else if(R(u,P.StructSpecifier)){var _,S,E,O,M=$.context,y=M.stage;($.context._referencedGlobalMacroASTs.indexOf(u)!==-1||(y===ce.VERTEX?M.isAttributeStruct((_=u.ident)==null?void 0:_.lexeme)||M.isVaryingStruct((S=u.ident)==null?void 0:S.lexeme):M.isVaryingStruct((E=u.ident)==null?void 0:E.lexeme)||M.isMRTStruct((O=u.ident)==null?void 0:O.lexeme)))&&n.push({text:u.getCache(),index:u.location.start.index})}else if(R(u,P.VariableDeclarationList))for(var I=u.variableDeclarations,V=0;V<I.length;V++){var k=I[V];$.context._referencedGlobalMacroASTs.indexOf(k)!==-1&&n.push({text:k.getCache()+";",index:k.location.start.index})}R(u,G)&&this._visitGlobalMacroIfStatement(u,n)}},c}(br);St._lookupSymbol=new Te("",null);St._serializedGlobalKey=new Set;var bi=function(e){D(c,e);function c(){return e.apply(this,arguments)||this}var i=c.prototype;return i.getAttributeProp=function(r){return"attribute "+r.typeInfo.typeLexeme+" "+r.ident.lexeme+";"},i.getVaryingProp=function(r){return"varying "+r.typeInfo.typeLexeme+" "+r.ident.lexeme+";"},i.getMRTProp=function(){return null},i.visitPostfixExpression=function(r){var n=r.children,s=n[0],l=$.context;if(R(s,P.PostfixExpression)&&l.isMRTStruct(s.type)){var u=n[2],_=l.mrtList.find(function(S){return S.ident.lexeme===u.lexeme});return _?"gl_FragData["+_.mrtIndex+"]":(this._reportError(u.location,"not found mrt property: "+u.lexeme),"")}return e.prototype.visitPostfixExpression.call(this,r)},i.visitJumpStatement=function(r){if(r.isFragReturnStatement){if($.context.mrtStructs.length)return"";var n=r.children[1];return"gl_FragColor = "+n.codeGen(this)+";"}return e.prototype.visitJumpStatement.call(this,r)},c.getVisitor=function(){return this._singleton||(this._singleton=new c),this._singleton},c}(St),zt="GS_glFragColor",xi=function(e){D(c,e);function c(){var t;return t=e.apply(this,arguments)||this,t._otherCodeArray=[],t._fragColorVariableRegistered=!1,t}var i=c.prototype;return i.reset=function(){e.prototype.reset.call(this),this._otherCodeArray.length=0,this._fragColorVariableRegistered=!1},i.getOtherGlobal=function(r,n){e.prototype.getOtherGlobal.call(this,r,n);for(var s=0,l=this._otherCodeArray.length;s<l;s++)n.push(this._otherCodeArray[s])},i.getAttributeProp=function(r){return"in "+r.typeInfo.typeLexeme+" "+r.ident.lexeme+";"},i.getVaryingProp=function(r){var n=$.context.stage===ce.FRAGMENT?"in":"out";return n+" "+r.typeInfo.typeLexeme+" "+r.ident.lexeme+";"},i.getMRTProp=function(r){return"layout(location = "+r.mrtIndex+") out vec4 "+r.ident.lexeme+";"},i.visitFunctionIdentifier=function(r){var n=r.children,s=n[0];if(s.children.length!==1)return this.defaultCodeGen(n);var l=r.lexeme;switch(r.ident){case"texture2D":case"textureCube":l="texture";break;case"texture2DProj":l="textureProj";break;case"texture2DLodEXT":case"textureCubeLodEXT":l="textureLod";break;case"texture2DGradEXT":case"textureCubeGradEXT":l="textureGrad";break;case"texture2DProjLodEXT":l="textureProjLod";break;case"texture2DProjGradEXT":l="textureProjGrad";break;case"gl_FragDepthEXT":l="gl_FragDepth";break}return l},i.visitVariableIdentifier=function(r){var n=$.context;if(n.stage===ce.FRAGMENT&&r.getLexeme(this)==="gl_FragColor"){if(n.mrtStructs.length){this._reportError(r.location,"gl_FragColor cannot be used with MRT (Multiple Render Targets).");return}return this._registerFragColorVariable(),zt}return e.prototype.visitVariableIdentifier.call(this,r)},i.visitJumpStatement=function(r){if(r.isFragReturnStatement){if($.context.mrtStructs.length)return"";this._registerFragColorVariable();var n=r.children[1];return zt+" = "+n.codeGen(this)+";"}return e.prototype.visitJumpStatement.call(this,r)},i._registerFragColorVariable=function(){this._fragColorVariableRegistered||(this._otherCodeArray.push({text:"out vec4 "+zt+";",index:0}),this._fragColorVariableRegistered=!0)},c.getVisitor=function(){return this._singleton||(this._singleton=new c),this._singleton},c}(St),ne={Text:0,IfDef:1,IfNdef:2,IfCmp:3,IfExpr:4,Else:5,Endif:6,Define:7,DefineVal:8,DefineFunc:9,Undef:10},vt=function(){function e(){}return e.parse=function(i){for(var t=[],r=i.length,n=0,s=[];n<r;){var l=e._findDirectiveStart(i,n,r);if(l===-1){e._pushText(t,i,n,r);break}l>n&&e._pushText(t,i,n,l);var u=i.indexOf(`
|
|
29
29
|
`,l);u===-1&&(u=r);var _=i.substring(l,u);n=u<r?u+1:r;var S=e._DIRECTIVE_RE.exec(_);if(!S){var E=t.length>0?t[t.length-1]:null,O=u<r?_+`
|
|
30
30
|
`:_;E&&E[0]===ne.Text?E[1]+=O:t.push([ne.Text,O]);continue}var M=S[1],y=S[2].trim();switch(M){case"ifdef":{var I=t.length;t.push([ne.IfDef,y,-1]),s.push([I]);break}case"ifndef":{var V=t.length;t.push([ne.IfNdef,y,-1]),s.push([V]);break}case"if":{var k=e._parseCondition(y),N=t.length;e._pushConditionInstruction(t,k),s.push([N]);break}case"elif":{var W=s[s.length-1],U=W[W.length-1],j=t.length;t.push([ne.Else,-1]),W.push(j),e._backfillJump(t[U],t.length);var X=e._parseCondition(y),q=t.length;e._pushConditionInstruction(t,X),W.push(q);break}case"else":{var Q=s[s.length-1],Z=Q[Q.length-1],te=t.length;t.push([ne.Else,-1]),Q.push(te),e._backfillJump(t[Z],t.length);break}case"endif":{var ve=t.length;t.push([ne.Endif]);var se=s.pop();if(se)for(var me=ve+1,Se=0;Se<se.length;Se++){var ge=t[se[Se]];ge[0]===ne.Else?ge[1]=me:e._backfillJump(ge,me,!0)}break}case"define":{var he=e._FUNC_MACRO_RE.exec(y);if(he){var Ee=he[2].split(",").map(function(Ie){return Ie.trim()}).filter(function(Ie){return Ie.length>0});t.push([ne.DefineFunc,he[1],Ee,e._stripLineComment(he[3].trim())])}else{var ye=y.indexOf(" ");ye===-1?t.push([ne.Define,y]):t.push([ne.DefineVal,y.substring(0,ye),e._stripLineComment(y.substring(ye+1).trim())])}break}case"undef":{t.push([ne.Undef,y]);break}}}return t},e._pushConditionInstruction=function(i,t){t.t==="def"?i.push([ne.IfDef,t.m,-1]):t.t==="ndef"?i.push([ne.IfNdef,t.m,-1]):t.t==="cmp"?i.push([ne.IfCmp,t.m,t.op,t.v,-1]):i.push([ne.IfExpr,t,-1])},e._findDirectiveStart=function(i,t,r){for(var n=t;n<r;){for(var s=n;s<r;){var l=i.charCodeAt(s);if(l===32||l===9)s++;else break}if(s<r&&i.charCodeAt(s)===35)return n;var u=i.indexOf(`
|
|
31
|
-
`,n);if(u===-1)break;n=u+1}return-1},e._pushText=function(i,t,r,n){if(!(r>=n)){var s=i.length>0?i[i.length-1]:null;s&&s[0]===ne.Text?s[1]+=t.substring(r,n):i.push([ne.Text,t.substring(r,n)])}},e._backfillJump=function(i,t,r){r===void 0&&(r=!1);var n=i[0];n===ne.IfDef||n===ne.IfNdef?(!r||i[2]===-1)&&(i[2]=t):n===ne.IfCmp?(!r||i[4]===-1)&&(i[4]=t):n===ne.IfExpr&&(!r||i[2]===-1)&&(i[2]=t)},e._stripLineComment=function(i){var t=i.indexOf("//");return t>=0?i.substring(0,t).trimEnd():i},e._parseCondition=function(i){var t={s:i.trim(),i:0};return e._parseOr(t)},e._skipWs=function(i){for(;i.i<i.s.length&&(i.s.charCodeAt(i.i)===32||i.s.charCodeAt(i.i)===9);)i.i++},e._parseOr=function(i){var t=e._parseAnd(i);for(e._skipWs(i);i.i<i.s.length-1&&i.s.charCodeAt(i.i)===124&&i.s.charCodeAt(i.i+1)===124;)i.i+=2,e._skipWs(i),t={t:"or",l:t,r:e._parseAnd(i)},e._skipWs(i);return t},e._parseAnd=function(i){var t=e._parseUnary(i);for(e._skipWs(i);i.i<i.s.length-1&&i.s.charCodeAt(i.i)===38&&i.s.charCodeAt(i.i+1)===38;)i.i+=2,e._skipWs(i),t={t:"and",l:t,r:e._parseUnary(i)},e._skipWs(i);return t},e._parseUnary=function(i){return e._skipWs(i),i.s.charCodeAt(i.i)===33?(i.i++,e._skipWs(i),{t:"not",c:e._parsePrimary(i)}):e._parsePrimary(i)},e._parsePrimary=function(i){e._skipWs(i);var t=i.s;if(t.charCodeAt(i.i)===40){i.i++,e._skipWs(i);var r=e._parseOr(i);return e._skipWs(i),t.charCodeAt(i.i)===41&&i.i++,r}if(t.substring(i.i,i.i+7)==="defined"){i.i+=7,e._skipWs(i);var n=t.charCodeAt(i.i)===40;n&&i.i++,e._skipWs(i);var s=e._scanIdentifier(i);return e._skipWs(i),n&&t.charCodeAt(i.i)===41&&i.i++,{t:"def",m:s}}if(i.i<t.length&&e._isDigit(t.charCodeAt(i.i))){var l=e._scanNumber(i);e._skipWs(i);var u=e._scanOp(i);return u?(e._skipWs(i),{t:"bool",v:e._evalNumOp(l,u,e._scanNumber(i))}):{t:"bool",v:l!==0}}var _=e._scanIdentifier(i);if(!_)return{t:"bool",v:!1};e._skipWs(i);var S=e._scanOp(i);return S?(e._skipWs(i),{t:"cmp",m:_,op:S,v:e._scanNumber(i)}):{t:"def",m:_}},e._isDigit=function(i){return i>=48&&i<=57},e._isAlnum=function(i){return i>=65&&i<=90||i>=97&&i<=122||i>=48&&i<=57||i===95},e._scanIdentifier=function(i){for(var t=i.i;i.i<i.s.length&&e._isAlnum(i.s.charCodeAt(i.i));)i.i++;return i.s.substring(t,i.i)},e._scanNumber=function(i){var t=i.i;for(i.s.charCodeAt(i.i)===45&&i.i++;i.i<i.s.length&&(e._isDigit(i.s.charCodeAt(i.i))||i.s.charCodeAt(i.i)===46);)i.i++;return Number(i.s.substring(t,i.i))||0},e._scanOp=function(i){var t=i.s.charCodeAt(i.i),r=i.i+1<i.s.length?i.s.charCodeAt(i.i+1):0;return t===61&&r===61?(i.i+=2,"=="):t===33&&r===61?(i.i+=2,"!="):t===62&&r===61?(i.i+=2,">="):t===60&&r===61?(i.i+=2,"<="):t===62?(i.i++,">"):t===60?(i.i++,"<"):""},e._evalNumOp=function(i,t,r){switch(t){case"==":return i===r;case"!=":return i!==r;case">":return i>r;case"<":return i<r;case">=":return i>=r;case"<=":return i<=r;default:return!1}},e}();vt._DIRECTIVE_RE=/^[ \t]*#[ \t]*(if|ifdef|ifndef|elif|else|endif|define|undef)\b(.*)/;vt._FUNC_MACRO_RE=/^(\w+)\(([^)]*)\)\s*(.*)/;var ze=function e(c,i){this.goal=c,this.derivation=i,this.id=e._id++,e.pool.set(this.id,this)};ze._id=0;ze.pool=new Map;var Jt=function(){function e(i,t,r){this._needReInfer=!0,this.production=i,this.position=t,this.lookaheadSet=new Set;for(var n=Y(r),s;!(s=n()).done;){var l=s.value;this.lookaheadSet.add(l)}this.id=e._id++}var c=e.prototype;return c.addLookahead=function(t){for(var r=Y(t),n;!(n=r()).done;){var s=n.value;this.lookaheadSet.has(s)||(this.lookaheadSet.add(s),this.needReInfer=!0)}},c.symbolByOffset=function(t){return this.production.derivation[this.position+t]},c.canReduce=function(){if(this.position>this.production.derivation.length-1)return!0;for(var t=this.position;t<this.production.derivation.length;t++)if(this.production.derivation[t]!==h.EPSILON)return!1;return!0},c.advance=function(){return new e(this.production,this.position+1,this.lookaheadSet)},be(e,[{key:"needReInfer",get:function(){return this._needReInfer},set:function(t){this._needReInfer=t}},{key:"curSymbol",get:function(){return this.production.derivation[this.position]}},{key:"nextSymbol",get:function(){return this.production.derivation[this.position+1]}}]),e}();Jt._id=0;var it=function(){function e(i){this.closured=!1,this._stateItemPool=new Map,this.id=e._id++,this._items=new Set([].concat(i)),this.cores=new Set([].concat(i));for(var t=Y(i),r;!(r=t()).done;){var n=r.value,s=this.getStateItemMapKey(n.production,n.position);this._stateItemPool.set(s,n)}e.pool.set(this.id,this)}var c=e.prototype;return c.getStateItemMapKey=function(t,r){return t.id+","+r},c.createStateItem=function(t,r,n){n===void 0&&(n=new Set);var s=this.getStateItemMapKey(t,r),l=this._stateItemPool.get(s);if(l){for(var u=Y(n),_;!(_=u()).done;){var S=_.value;l.lookaheadSet.has(S)||(l.lookaheadSet.add(S),l.needReInfer=!0)}return l}var E=new Jt(t,r,n);return this._stateItemPool.set(s,E),E},e.create=function(t){var r=this.getMapKey(t),n=this.closureMap.get(r);if(n){for(var s=Y(t),l;!(l=s()).done;){var u=l.value;n.createStateItem(u.production,u.position,u.lookaheadSet)}return n}var _=new e(t);return this.closureMap.set(r,_),_},e.getMapKey=function(t){return t.map(function(r){return r.production.id+","+r.position}).join(";")},be(e,[{key:"items",get:function(){return this._items}},{key:"needReInfer",get:function(){for(var t=Y(this.cores),r;!(r=t()).done;){var n=r.value;if(n.needReInfer)return!0}return!1}}]),e}();it.closureMap=new Map;it.pool=new Map;it._id=0;var x=function(){function e(){}return e.isTerminal=function(i){return i<o.START},e.toString=function(i){if(this.isTerminal(i)){var t;return(t=h[i])!=null?t:a[i]}return o[i]},e.createProductionWithOptions=function(i,t,r){for(var n=function(){var S=_.value,E=!r&&S.length===1&&!e.isTerminal(S[0]);l.push([[].concat([i],S),function(O){for(var M=arguments.length,y=new Array(M>1?M-1:0),I=1;I<M;I++)y[I-1]=arguments[I];if(y[0])if(E)O.semanticStack.push(y[0]);else{var V=y[0].location.start,k=y[y.length-1].location.end,N=Ce.createRange(V,k);P.get(s,O,N,y)}}])},s=r??P.TrivialNode.pool,l=[],u=Y(t),_;!(_=u()).done;)n();return l},e.addMapSetItem=function(i,t,r){var n,s=(n=i.get(t))!=null?n:new Set;s.add(r),i.set(t,s)},e.isSubSet=function(i,t){for(var r=Y(i),n;!(n=r()).done;){var s=n.value;if(!t.has(s))return!1}return!0},e.isActionEqual=function(i,t){return i.action===t.action&&i.target===t.target},e}(),Pe=function(e){return e[e.Shift=0]="Shift",e[e.Reduce=1]="Reduce",e[e.Accept=2]="Accept",e}({}),xi=function(){function e(i){this.firstSetMap=new Map,this.followSetMap=new Map,this.actionTable=new Map,this.gotoTable=new Map,this._firstSetNTStack=[],this.grammar=i}var c=e.prototype;return c.generate=function(){this.computeFirstSet(),this.buildStateTable()},c.buildStateTable=function(){var t=[new Jt(this.grammar.productions[0],0,[h.EOF])],r=it.create(t);this._extendState(r)},c._extendState=function(t){if(t.needReInfer){this._closure(t);for(var r=this._inferNextState(t),n=Y(r),s;!(s=n()).done;){var l=s.value;this._extendState(l)}}},c._closure=function(t){for(var r=Y(t.cores),n;!(n=r()).done;){var s=n.value;s.canReduce()||this._extendStateItem(t,s)}return t.closured=!0,t},c._extendStateItem=function(t,r){if(!x.isTerminal(r.curSymbol)){var n=this.grammar.getProductionList(r.curSymbol);if(r.nextSymbol){for(var s=new Set,l,u=!1,_=1,S=r.symbolByOffset(1);S;S=r.symbolByOffset(++_)){if(x.isTerminal(S)){s.add(S),u=!0;break}l=this.firstSetMap.get(S);for(var E=Y(l),O;!(O=E()).done;){var M=O.value;s.add(M)}if(!l.has(h.EPSILON))break}if(!u&&(l!=null&&l.has(h.EPSILON)))for(var y=Y(r.lookaheadSet),I;!(I=y()).done;){var V=I.value;s.add(V)}for(var k=Y(n),N;!(N=k()).done;){var W=N.value,U=t.createStateItem(W,0);(!t.items.has(U)||!x.isSubSet(s,U.lookaheadSet))&&(t.items.add(U),U.addLookahead(s),this._extendStateItem(t,U))}}else for(var j=Y(n),X;!(X=j()).done;){var q=X.value,Q=t.createStateItem(q,0);(!t.items.has(Q)||!x.isSubSet(r.lookaheadSet,Q.lookaheadSet))&&(t.items.add(Q),Q.addLookahead(r.lookaheadSet),this._extendStateItem(t,Q))}}},c._inferNextState=function(t){var r=new Map,n,s=(n=this.actionTable.get(t.id))!=null?n:new Map,l,u=(l=this.gotoTable.get(t.id))!=null?l:new Map;this.actionTable.set(t.id,s),this.gotoTable.set(t.id,u);for(var _=Y(t.items),S;!(S=_()).done;){var E=S.value;if(E.canReduce()){var O=void 0;E.production.goal!==o.START?O={action:Pe.Reduce,target:E.production.id}:O={action:Pe.Accept};for(var M=Y(E.lookaheadSet),y;!(y=M()).done;){var I=y.value;this._addAction(s,I,O)}}else{var V=E.advance();x.addMapSetItem(r,E.curSymbol,V)}E.needReInfer=!1}for(var k=new Set,N=Y(r.entries()),W;!(W=N()).done;){var U=W.value,j=U[0],X=U[1],q=it.create(Array.from(X));x.isTerminal(j)?this._addAction(s,j,{action:Pe.Shift,target:q.id}):u.set(j,q.id),k.add(q)}return k},c._addAction=function(t,r,n){var s=t.get(r);s&&!x.isActionEqual(s,n)&&e._isKnownShiftPreferred(r,s,n)&&s.action===Pe.Shift&&n.action===Pe.Reduce||t.set(r,n)},c.computeFirstSet=function(){for(var t=Y(this.grammar.productions.slice(1)),r;!(r=t()).done;){var n=r.value;this._computeFirstSetForNT(n.goal)}},c._computeFirstSetForNT=function(t){var r=this._firstSetNTStack.findIndex(function(U){return U===t});if(r!==-1){for(var n=this.firstSetMap.get(t),s=this._firstSetNTStack.length,l=s-1;l>r;l--){var u=this._firstSetNTStack[l];this.firstSetMap.set(u,n)}return n}this._firstSetNTStack.push(t);var _=this.grammar.getProductionList(t),S=new Set;this.firstSetMap.set(t,S),this.grammar.isNullableNT(t)&&S.add(h.EPSILON);for(var E=Y(_),O;!(O=E()).done;){for(var M=O.value,y=0;y<M.derivation.length;y++){var I=M.derivation[y];if(x.isTerminal(I)){S.add(I);break}for(var V=this._computeFirstSetForNT(I),k=Y(V),N;!(N=k()).done;){var W=N.value;W!==h.EPSILON&&S.add(W)}if(!this.grammar.isNullableNT(I))break}y===M.derivation.length&&S.add(h.EPSILON)}return this._firstSetNTStack.pop(),S},e._isKnownShiftPreferred=function(t,r,n){if(t===a.ELSE)return!0;if(t!==h.LEFT_PAREN)return!1;var s=r.action===Pe.Reduce?r:n.action===Pe.Reduce?n:null;if(!s)return!1;var l=ze.pool.get(s.target);return!!l&&l.goal===o.type_specifier_nonarray&&l.derivation.length===1&&l.derivation[0]===o.macro_call_symbol},e}(),yi=function(){function e(i,t){this.startSymbol=i,t.unshift(new ze(o.START,[i])),this.productions=t}var c=e.prototype;return c.getProductionList=function(t){return this.productions.filter(function(r){return r.goal===t})},c.isNullableNT=function(t){return this.productions.find(function(r){return r.goal===t&&r.derivation[0]===h.EPSILON})},c.getProductionByID=function(t){return ze.pool.get(t)},e.create=function(t,r){var n=r.map(function(s){return new ze(s[0],s.slice(1))});return new e(t,n)},e}(),$t=[].concat(x.createProductionWithOptions(o.gs_shader_program,[[o.global_declaration],[o.gs_shader_program,o.global_declaration]],P.GLShaderProgram.pool),x.createProductionWithOptions(o.global_declaration,[[o.precision_specifier],[o.variable_declaration_statement],[o.struct_specifier],[o.function_definition],[o.global_macro_if_statement],[o.macro_undef],[o.macro_define],[a.MACRO_DEFINE_EXPRESSION]],P.GlobalDeclaration.pool),x.createProductionWithOptions(o.macro_define,[[a.MACRO_DEFINE,h.ID,o.expression,a.MACRO_DEFINE_END],[a.MACRO_DEFINE,h.ID,a.MACRO_DEFINE_PARAMS,o.expression,a.MACRO_DEFINE_END]],P.MacroDefine.pool),x.createProductionWithOptions(o.macro_call_symbol,[[a.MACRO_CALL]],P.MacroCallSymbol.pool),x.createProductionWithOptions(o.macro_call_function,[[o.macro_call_symbol,h.LEFT_PAREN,h.RIGHT_PAREN],[o.macro_call_symbol,h.LEFT_PAREN,o.function_call_parameter_list,h.RIGHT_PAREN]],P.MacroCallFunction.pool),x.createProductionWithOptions(o.macro_undef,[[a.MACRO_UNDEF,h.ID],[a.MACRO_UNDEF,a.MACRO_CALL]],P.MacroUndef.pool),x.createProductionWithOptions(o.macro_push_context,[[a.MACRO_IF,a.MACRO_CONDITIONAL_EXPRESSION],[a.MACRO_IFDEF,h.ID],[a.MACRO_IFNDEF,h.ID],[a.MACRO_IFDEF,o.macro_call_symbol],[a.MACRO_IFNDEF,o.macro_call_symbol]],P.MacroPushContext.pool),x.createProductionWithOptions(o.macro_pop_context,[[a.MACRO_ENDIF]],P.MacroPopContext.pool),x.createProductionWithOptions(o.macro_elif_expression,[[a.MACRO_ELIF,a.MACRO_CONDITIONAL_EXPRESSION]],P.MacroElifExpression.pool),x.createProductionWithOptions(o.macro_else_expression,[[a.MACRO_ELSE]],P.MacroElseExpression.pool),x.createProductionWithOptions(o.global_macro_declaration,[[o.global_declaration],[o.global_macro_declaration,o.global_declaration]],P.GlobalMacroDeclaration.pool),x.createProductionWithOptions(o.global_macro_if_statement,[[o.macro_push_context,o.global_macro_declaration,o.global_macro_branch],[o.macro_push_context,o.global_macro_branch]],P.GlobalMacroIfStatement.pool),x.createProductionWithOptions(o.global_macro_branch,[[o.macro_pop_context],[o.macro_elif_expression,o.global_macro_declaration,o.global_macro_branch],[o.macro_else_expression,o.global_macro_declaration,o.macro_pop_context],[o.macro_elif_expression,o.global_macro_branch],[o.macro_else_expression,o.macro_pop_context]],P.GlobalMacroBranch.pool),x.createProductionWithOptions(o.variable_declaration,[[o.fully_specified_type,h.ID],[o.fully_specified_type,h.ID,o.array_specifier],[o.fully_specified_type,h.ID,h.EQUAL,o.initializer]],P.VariableDeclaration.pool),x.createProductionWithOptions(o.variable_declaration_list,[[o.variable_declaration],[o.variable_declaration_list,h.COMMA,h.ID],[o.variable_declaration_list,h.COMMA,h.ID,o.array_specifier]],P.VariableDeclarationList.pool),x.createProductionWithOptions(o.variable_declaration_statement,[[o.variable_declaration_list,h.SEMICOLON]]),x.createProductionWithOptions(o.ext_builtin_type_specifier_nonarray,[[a.VOID],[a.FLOAT],[a.BOOL],[a.INT],[a.UINT],[a.VEC2],[a.VEC3],[a.VEC4],[a.BVEC2],[a.BVEC3],[a.BVEC4],[a.IVEC2],[a.IVEC3],[a.IVEC4],[a.UVEC2],[a.UVEC3],[a.UVEC4],[a.MAT2],[a.MAT3],[a.MAT4],[a.MAT2X3],[a.MAT2X4],[a.MAT3X2],[a.MAT3X4],[a.MAT4X2],[a.MAT4X3],[a.SAMPLER2D],[a.SAMPLER3D],[a.SAMPLER_CUBE],[a.SAMPLER2D_SHADOW],[a.SAMPLER_CUBE_SHADOW],[a.SAMPLER2D_ARRAY],[a.SAMPLER2D_ARRAY_SHADOW],[a.I_SAMPLER2D],[a.I_SAMPLER3D],[a.I_SAMPLER_CUBE],[a.I_SAMPLER2D_ARRAY],[a.U_SAMPLER2D],[a.U_SAMPLER3D],[a.U_SAMPLER_CUBE],[a.U_SAMPLER2D_ARRAY]],P.ExtBuiltinTypeSpecifierNonArray.pool),x.createProductionWithOptions(o.type_specifier_nonarray,[[h.ID],[o.ext_builtin_type_specifier_nonarray],[o.macro_call_symbol]],P.TypeSpecifierNonArray.pool),x.createProductionWithOptions(o.fully_specified_type,[[o.type_specifier],[o.type_qualifier,o.type_specifier]],P.FullySpecifiedType.pool),x.createProductionWithOptions(o.type_specifier,[[o.type_specifier_nonarray],[o.ext_builtin_type_specifier_nonarray,o.array_specifier]],P.TypeSpecifier.pool),x.createProductionWithOptions(o.type_qualifier,[[o.single_type_qualifier],[o.type_qualifier,o.single_type_qualifier]],P.TypeQualifier.pool),x.createProductionWithOptions(o.single_type_qualifier,[[o.storage_qualifier],[o.precision_qualifier],[o.interpolation_qualifier],[o.invariant_qualifier],[a.PRECISE]],P.SingleTypeQualifier.pool),x.createProductionWithOptions(o.storage_qualifier,[[a.CONST],[a.IN],[a.INOUT],[a.OUT],[a.CENTROID]]),x.createProductionWithOptions(o.interpolation_qualifier,[[a.SMOOTH],[a.FLAT]]),x.createProductionWithOptions(o.invariant_qualifier,[[a.INVARIANT]]),x.createProductionWithOptions(o.precision_qualifier,[[a.HIGHP],[a.MEDIUMP],[a.LOWP]]),x.createProductionWithOptions(o.struct_specifier,[[a.STRUCT,h.ID,h.LEFT_BRACE,o.struct_declaration_list,h.RIGHT_BRACE,h.SEMICOLON],[a.STRUCT,h.LEFT_BRACE,o.struct_declaration_list,h.RIGHT_BRACE,h.SEMICOLON]],P.StructSpecifier.pool),x.createProductionWithOptions(o.struct_declaration_list,[[o.struct_declaration],[o.struct_declaration_list,o.struct_declaration]],P.StructDeclarationList.pool),x.createProductionWithOptions(o.struct_declaration,[[o.type_specifier,o.struct_declarator_list,h.SEMICOLON],[o.type_qualifier,o.type_specifier,o.struct_declarator_list,h.SEMICOLON],[o.layout_qualifier,o.type_specifier,o.struct_declarator,h.SEMICOLON],[o.macro_struct_declaration]],P.StructDeclaration.pool),x.createProductionWithOptions(o.macro_struct_declaration,[[o.macro_push_context,o.struct_declaration_list,o.macro_struct_branch],[o.macro_push_context,o.macro_struct_branch]],P.MacroStructDeclaration.pool),x.createProductionWithOptions(o.macro_struct_branch,[[o.macro_pop_context],[o.macro_elif_expression,o.struct_declaration_list,o.macro_struct_branch],[o.macro_else_expression,o.struct_declaration_list,o.macro_pop_context],[o.macro_elif_expression,o.macro_struct_branch],[o.macro_else_expression,o.macro_pop_context]],P.MacroStructBranch.pool),x.createProductionWithOptions(o.layout_qualifier,[[a.LAYOUT,h.LEFT_PAREN,a.LOCATION,h.EQUAL,h.INT_CONSTANT,h.RIGHT_PAREN]],P.LayoutQualifier.pool),x.createProductionWithOptions(o.struct_declarator_list,[[o.struct_declarator],[o.struct_declarator_list,h.COMMA,o.struct_declarator]],P.StructDeclaratorList.pool),x.createProductionWithOptions(o.struct_declarator,[[h.ID],[h.ID,o.array_specifier]],P.StructDeclarator.pool),x.createProductionWithOptions(o.array_specifier,[[h.LEFT_BRACKET,h.RIGHT_BRACKET],[h.LEFT_BRACKET,o.integer_constant_expression,h.RIGHT_BRACKET]],P.ArraySpecifier.pool),x.createProductionWithOptions(o.integer_constant_expression_operator,[[h.PLUS],[h.DASH],[h.STAR],[h.SLASH],[h.PERCENT]],P.IntegerConstantExpressionOperator.pool),x.createProductionWithOptions(o.integer_constant_expression,[[o.variable_identifier],[h.INT_CONSTANT],[o.integer_constant_expression,o.integer_constant_expression_operator,h.INT_CONSTANT],[o.integer_constant_expression,o.integer_constant_expression_operator,o.variable_identifier]],P.IntegerConstantExpression.pool),x.createProductionWithOptions(o.conditional_expression,[[o.logical_or_expression],[o.logical_or_expression,h.QUESTION,o.expression,h.COLON,o.assignment_expression]]),x.createProductionWithOptions(o.logical_or_expression,[[o.logical_xor_expression],[o.logical_or_expression,h.OR_OP,o.logical_xor_expression]]),x.createProductionWithOptions(o.logical_xor_expression,[[o.logical_and_expression],[o.logical_xor_expression,h.XOR_OP,o.logical_and_expression]]),x.createProductionWithOptions(o.logical_and_expression,[[o.inclusive_or_expression],[o.logical_and_expression,h.AND_OP,o.inclusive_or_expression]]),x.createProductionWithOptions(o.inclusive_or_expression,[[o.exclusive_or_expression],[o.inclusive_or_expression,h.VERTICAL_BAR,o.exclusive_or_expression]]),x.createProductionWithOptions(o.exclusive_or_expression,[[o.and_expression],[o.exclusive_or_expression,h.CARET,o.and_expression]]),x.createProductionWithOptions(o.and_expression,[[o.equality_expression],[o.and_expression,h.AMPERSAND,o.equality_expression]]),x.createProductionWithOptions(o.equality_expression,[[o.relational_expression],[o.equality_expression,h.EQ_OP,o.relational_expression],[o.equality_expression,h.NE_OP,o.relational_expression]]),x.createProductionWithOptions(o.relational_expression,[[o.shift_expression],[o.relational_expression,h.LEFT_ANGLE,o.shift_expression],[o.relational_expression,h.RIGHT_ANGLE,o.shift_expression],[o.relational_expression,h.LE_OP,o.shift_expression],[o.relational_expression,h.GE_OP,o.shift_expression]]),x.createProductionWithOptions(o.shift_expression,[[o.additive_expression],[o.shift_expression,h.LEFT_OP,o.additive_expression],[o.shift_expression,h.RIGHT_OP,o.additive_expression]]),x.createProductionWithOptions(o.additive_expression,[[o.multiplicative_expression],[o.additive_expression,h.PLUS,o.multiplicative_expression],[o.additive_expression,h.DASH,o.multiplicative_expression]]),x.createProductionWithOptions(o.multiplicative_expression,[[o.unary_expression],[o.multiplicative_expression,h.STAR,o.unary_expression],[o.multiplicative_expression,h.SLASH,o.unary_expression],[o.multiplicative_expression,h.PERCENT,o.unary_expression]]),x.createProductionWithOptions(o.unary_expression,[[o.postfix_expression],[h.INC_OP,o.unary_expression],[h.DEC_OP,o.unary_expression],[o.unary_operator,o.unary_expression]]),x.createProductionWithOptions(o.unary_operator,[[h.PLUS],[h.DASH],[h.BANG],[h.TILDE]]),x.createProductionWithOptions(o.postfix_expression,[[o.primary_expression],[o.postfix_expression,h.LEFT_BRACKET,o.expression,h.RIGHT_BRACKET],[o.function_call],[o.postfix_expression,h.DOT,h.ID],[o.postfix_expression,h.DOT,o.function_call],[o.postfix_expression,h.INC_OP],[o.postfix_expression,h.DEC_OP]],P.PostfixExpression.pool),x.createProductionWithOptions(o.primary_expression,[[o.variable_identifier],[h.INT_CONSTANT],[h.FLOAT_CONSTANT],[a.True],[a.False],[h.LEFT_PAREN,o.expression,h.RIGHT_PAREN]],P.PrimaryExpression.pool),x.createProductionWithOptions(o.expression,[[o.assignment_expression],[o.expression,h.COMMA,o.assignment_expression]],P.Expression.pool),x.createProductionWithOptions(o.assignment_expression,[[o.conditional_expression],[o.unary_expression,o.assignment_operator,o.assignment_expression]],P.AssignmentExpression.pool),x.createProductionWithOptions(o.assignment_operator,[[h.EQUAL],[h.MUL_ASSIGN],[h.DIV_ASSIGN],[h.MOD_ASSIGN],[h.ADD_ASSIGN],[h.SUB_ASSIGN],[h.LEFT_ASSIGN],[h.RIGHT_ASSIGN],[h.AND_ASSIGN],[h.XOR_ASSIGN],[h.OR_ASSIGN]]),x.createProductionWithOptions(o.function_call,[[o.function_call_generic]],P.FunctionCall.pool),x.createProductionWithOptions(o.function_call_generic,[[o.function_identifier,h.LEFT_PAREN,o.function_call_parameter_list,h.RIGHT_PAREN],[o.function_identifier,h.LEFT_PAREN,h.RIGHT_PAREN],[o.function_identifier,a.VOID,h.RIGHT_PAREN]],P.FunctionCallGeneric.pool),x.createProductionWithOptions(o.function_call_parameter_list,[[o.assignment_expression],[o.function_call_parameter_list,h.COMMA,o.assignment_expression],[o.macro_call_arg_block],[o.function_call_parameter_list,o.macro_call_arg_block]],P.FunctionCallParameterList.pool),x.createProductionWithOptions(o.macro_call_arg_case_list,[[o.assignment_expression],[h.COMMA,o.assignment_expression],[o.macro_call_arg_block],[o.macro_call_arg_case_list,o.macro_call_arg_block],[o.macro_call_arg_case_list,h.COMMA,o.assignment_expression]],P.MacroCallArgCaseList.pool),x.createProductionWithOptions(o.macro_call_arg_block,[[o.macro_push_context,o.macro_call_arg_branch],[o.macro_push_context,o.macro_call_arg_case_list,o.macro_call_arg_branch]],P.MacroCallArgBlock.pool),x.createProductionWithOptions(o.macro_call_arg_branch,[[o.macro_pop_context],[o.macro_elif_expression,o.macro_call_arg_case_list,o.macro_call_arg_branch],[o.macro_else_expression,o.macro_call_arg_case_list,o.macro_pop_context],[o.macro_elif_expression,o.macro_call_arg_branch],[o.macro_else_expression,o.macro_pop_context]],P.MacroCallArgBranch.pool),x.createProductionWithOptions(o.function_identifier,[[o.type_specifier]],P.FunctionIdentifier.pool),x.createProductionWithOptions(o.function_definition,[[o.function_prototype,o.compound_statement_no_scope]],P.FunctionDefinition.pool),x.createProductionWithOptions(o.function_prototype,[[o.function_declarator,h.RIGHT_PAREN]],P.FunctionProtoType.pool),x.createProductionWithOptions(o.function_declarator,[[o.function_header],[o.function_header,o.function_parameter_list]],P.FunctionDeclarator.pool),x.createProductionWithOptions(o.function_header,[[o.fully_specified_type,h.ID,h.LEFT_PAREN]],P.FunctionHeader.pool),x.createProductionWithOptions(o.function_parameter_list,[[o.parameter_declaration],[o.function_parameter_list,h.COMMA,o.parameter_declaration],[o.macro_param_block],[o.function_parameter_list,o.macro_param_block]],P.FunctionParameterList.pool),x.createProductionWithOptions(o.macro_param_case_list,[[o.parameter_declaration],[h.COMMA,o.parameter_declaration],[o.macro_param_block],[o.macro_param_case_list,o.macro_param_block],[o.macro_param_case_list,h.COMMA,o.parameter_declaration]],P.MacroParamCaseList.pool),x.createProductionWithOptions(o.macro_param_block,[[o.macro_push_context,o.macro_parameter_branch],[o.macro_push_context,o.macro_param_case_list,o.macro_parameter_branch]],P.MacroParamBlock.pool),x.createProductionWithOptions(o.macro_parameter_branch,[[o.macro_pop_context],[o.macro_elif_expression,o.macro_param_case_list,o.macro_parameter_branch],[o.macro_else_expression,o.macro_param_case_list,o.macro_pop_context],[o.macro_elif_expression,o.macro_parameter_branch],[o.macro_else_expression,o.macro_pop_context]],P.MacroParameterBranch.pool),x.createProductionWithOptions(o.parameter_declaration,[[o.type_qualifier,o.parameter_declarator],[o.parameter_declarator],[o.macro_call_symbol],[o.macro_call_function]],P.ParameterDeclaration.pool),x.createProductionWithOptions(o.parameter_declarator,[[o.type_specifier,h.ID],[o.type_specifier,h.ID,o.array_specifier]],P.ParameterDeclarator.pool),x.createProductionWithOptions(o.statement_list,[[o.statement],[o.statement_list,o.statement]],P.StatementList.pool),x.createProductionWithOptions(o.statement,[[o.compound_statement],[o.simple_statement]]),x.createProductionWithOptions(o.compound_statement_no_scope,[[h.LEFT_BRACE,h.RIGHT_BRACE],[h.LEFT_BRACE,o.statement_list,h.RIGHT_BRACE]],P.CompoundStatementNoScope.pool),x.createProductionWithOptions(o.compound_statement,[[h.LEFT_BRACE,h.RIGHT_BRACE],[o.scope_brace,o.statement_list,o.scope_end_brace]]),x.createProductionWithOptions(o.simple_statement,[[o.declaration],[o.expression_statement],[o.selection_statement],[o.iteration_statement],[o.jump_statement],[o.macro_if_statement],[o.macro_undef],[o.macro_define],[a.MACRO_DEFINE_EXPRESSION]]),x.createProductionWithOptions(o.declaration,[[o.function_prototype,h.SEMICOLON],[o.init_declarator_list,h.SEMICOLON],[a.PRECISION,o.precision_qualifier,o.ext_builtin_type_specifier_nonarray,h.SEMICOLON],[o.type_qualifier,h.ID,h.SEMICOLON],[o.type_qualifier,h.ID,o.identifier_list,h.SEMICOLON]],P.Declaration.pool),x.createProductionWithOptions(o.identifier_list,[[h.COMMA,h.ID],[o.identifier_list,h.COMMA,h.ID]],P.IdentifierList.pool),x.createProductionWithOptions(o.init_declarator_list,[[o.single_declaration],[o.init_declarator_list,h.COMMA,h.ID],[o.init_declarator_list,h.COMMA,h.ID,o.array_specifier],[o.init_declarator_list,h.COMMA,h.ID,o.array_specifier,h.EQUAL,o.initializer],[o.init_declarator_list,h.COMMA,h.ID,h.EQUAL,o.initializer]],P.InitDeclaratorList.pool),x.createProductionWithOptions(o.single_declaration,[[o.fully_specified_type,h.ID],[o.fully_specified_type,h.ID,o.array_specifier],[o.fully_specified_type,h.ID,o.array_specifier,h.EQUAL,o.initializer],[o.fully_specified_type,h.ID,h.EQUAL,o.initializer],[o.fully_specified_type,a.MACRO_CALL],[o.fully_specified_type,a.MACRO_CALL,h.EQUAL,o.initializer]],P.SingleDeclaration.pool),x.createProductionWithOptions(o.initializer,[[o.assignment_expression],[h.LEFT_BRACE,o.initializer_list,h.RIGHT_BRACE]]),x.createProductionWithOptions(o.initializer_list,[[o.initializer],[o.initializer_list,h.COMMA,o.initializer]]),x.createProductionWithOptions(o.expression_statement,[[h.SEMICOLON],[o.expression,h.SEMICOLON]]),x.createProductionWithOptions(o.selection_statement,[[a.IF,h.LEFT_PAREN,o.expression,h.RIGHT_PAREN,o.statement],[a.IF,h.LEFT_PAREN,o.expression,h.RIGHT_PAREN,o.statement,a.ELSE,o.statement]]),x.createProductionWithOptions(o.iteration_statement,[[a.WHILE,h.LEFT_PAREN,o.condition,h.RIGHT_PAREN,o.statement],[a.FOR,h.LEFT_PAREN,o.for_init_statement,o.for_rest_statement,h.RIGHT_PAREN,o.statement]]),x.createProductionWithOptions(o.precision_specifier,[[a.PRECISION,o.precision_qualifier,o.ext_builtin_type_specifier_nonarray,h.SEMICOLON]],P.PrecisionSpecifier.pool),x.createProductionWithOptions(o.for_init_statement,[[o.expression_statement],[o.declaration]]),x.createProductionWithOptions(o.condition,[[o.expression],[o.fully_specified_type,h.ID,h.EQUAL,o.initializer]]),x.createProductionWithOptions(o.for_rest_statement,[[o.conditionopt,h.SEMICOLON],[o.conditionopt,h.SEMICOLON,o.expression]]),x.createProductionWithOptions(o.conditionopt,[[h.EPSILON],[o.condition]]),x.createProductionWithOptions(o.jump_statement,[[a.CONTINUE,h.SEMICOLON],[a.BREAK,h.SEMICOLON],[a.RETURN,h.SEMICOLON],[a.RETURN,o.expression,h.SEMICOLON],[a.DISCARD,h.SEMICOLON]],P.JumpStatement.pool),x.createProductionWithOptions(o.scope_brace,[[h.LEFT_BRACE]],P.ScopeBrace.pool),x.createProductionWithOptions(o.scope_end_brace,[[h.RIGHT_BRACE]],P.ScopeEndBrace.pool),x.createProductionWithOptions(o.variable_identifier,[[h.ID],[o.macro_call_symbol],[o.macro_call_function]],P.VariableIdentifier.pool),x.createProductionWithOptions(o.macro_if_statement,[[o.macro_push_context,o.statement_list,o.macro_branch],[o.macro_push_context,o.macro_branch]],P.MacroIfStatement.pool),x.createProductionWithOptions(o.macro_branch,[[o.macro_pop_context],[o.macro_elif_expression,o.statement_list,o.macro_branch],[o.macro_else_expression,o.statement_list,o.macro_pop_context],[o.macro_elif_expression,o.macro_branch],[o.macro_else_expression,o.macro_pop_context]],P.MacroBranch.pool)),Ii=function(){return yi.create(o.gs_shader_program,$t.map(function(e){return e[0]}))},Oi=function(e){for(var c=0;c<$t.length;c++){var i=$t[c][1];i&&e.addTranslationRule(c,i)}},Pi=function(){function e(i,t,r){this._traceBackStack=[],this.actionTable=i,this.gotoTable=t,this.grammar=r,this.sematicAnalyzer=new dt}var c=e.prototype;return c.parse=function(t,r){this.sematicAnalyzer.reset(r);var n=this,s=n._traceBackStack,l=n.sematicAnalyzer;s.push(0);for(var u=t.next();;){var _=u.value,S=this.stateActionTable.get(_.type);if((S==null?void 0:S.action)===Pe.Shift){if(s.push(_,S.target),_.type===a.MACRO_DEFINE_PARAMS){l.pushScope();for(var E=Y(Be.parseMacroParamList(_.lexeme)),O;!(O=E()).done;){var M=O.value;l.symbolTableStack.insert(new Te(M,oe.VAR))}}u=t.next()}else{if((S==null?void 0:S.action)===Pe.Accept)return l.acceptRule==null||l.acceptRule.call(l,l),l.semanticStack.pop();if((S==null?void 0:S.action)===Pe.Reduce){for(var y=S.target,I=this.grammar.getProductionByID(y),V=l.getTranslationRule(I.id),k=[],N=I.derivation.length-1;N>=0;N--)if(I.derivation[N]!==h.EPSILON){s.pop();var W=s.pop();if(R(W,w))k.unshift(W);else{var U=l.semanticStack.pop();k.unshift(U)}}V==null||V.apply(void 0,[].concat([l],k));var j=this.stateGotoTable;s.push(I.goal);var X=j==null?void 0:j.get(I.goal);s.push(X);continue}else return xe.createGSError("Unexpected token "+_.lexeme,He.CompilationError,Ce._processingPassText,_.location),null}}},e.create=function(){if(!this._singleton){var t=Ii(),r=new xi(t);r.generate(),this._singleton=new e(r.actionTable,r.gotoTable,t),Oi(this._singleton.sematicAnalyzer)}return this._singleton},be(e,[{key:"curState",get:function(){return this._traceBackStack[this._traceBackStack.length-1]}},{key:"stateActionTable",get:function(){return this.actionTable.get(this.curState)}},{key:"stateGotoTable",get:function(){return this.gotoTable.get(this.curState)}}]),e}(),Mi="shaders://root/",xr=function(){function e(){}return e.parse=function(i,t,r,n){var s=this;return i.replace(this._includeReg,function(l,u){return u?s._replace(u,t,r,n):l})},e._replace=function(i,t,r,n){var s;i[0]==="."?s=new URL(i,t).href.substring(Mi.length):s=i;var l=r[s];if(!l)return console.error('Shader slice "'+s+'" not founded.'),"";var u=n.get(s);return u===void 0&&(u=this.parse(l,t,r,n),n.set(s,u)),u},e}();xr._includeReg=/\/\*[\s\S]*?\*\/|^[ \t]*#include +"([\w\d./]+)"/gm;function Ge(){return Ge=Object.assign||function(c){for(var i=1;i<arguments.length;i++){var t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(c[r]=t[r])}return c},Ge.apply(this,arguments)}var Ze=function(){function e(){}return e.createRenderStates=function(){return{constantMap:{},variableMap:{}}},e.createShaderSource=function(i){return{name:i,subShaders:[],pendingContents:[],renderStates:this.createRenderStates()}},e.createSubShaderSource=function(i){return{name:i,passes:[],pendingContents:[],tags:{},renderStates:this.createRenderStates()}},e.createShaderPassSource=function(i){return{name:i,pendingContents:[],tags:{},renderStates:this.createRenderStates()}},e.createUsePass=function(i){return{name:i,pendingContents:[],isUsePass:!0,tags:{},renderStates:this.createRenderStates()}},e}(),_t=function(){function e(i,t,r){this.ident=i,this.type=t,this.value=r,this.isInMacroBranch=!1}var c=e.prototype;return c.set=function(t,r,n){this.ident=t,this.type=r,this.value=n},c.equal=function(t){return this.type===t.type},e}(),Zt=function(e){D(c,e);function c(){var t;return t=e.apply(this,arguments)||this,t.hasPendingContent=!1,t}var i=c.prototype;return i.scanNumber=function(){this.skipCommentsAndSpace();var r=this._currentIndex,n=this._source,s=this._currentIndex;return s=c._scanDigits(n,s),n[s]==="."&&(s=c._scanDigits(n,s+1)),this.advance(s-this._currentIndex),Number(n.substring(r,s))},i.scanColor=function(){this.scanLexeme("(");var r=0,n=0,s=0,l=1;return r=this.scanNumber(),this.skipCommentsAndSpace(),this.peek(1)!==")"&&(this.scanLexeme(","),n=this.scanNumber(),this.skipCommentsAndSpace(),this.peek(1)!==")"&&(this.scanLexeme(","),s=this.scanNumber(),this.skipCommentsAndSpace(),this.peek(1)!==")"&&(this.scanLexeme(","),l=this.scanNumber(),this.skipCommentsAndSpace()))),this.scanLexeme(")"),new Ke(r,n,s,l)},i.scanToken=function(){for(;;){if(this.skipCommentsAndSpace(),this.isEnd())return;var r=this.getShaderPosition(0);if(ee.isAlpha(this.getCurCharCode())){var n=this._scanWord(r);if(n!==null)return n;this.hasPendingContent=!0;continue}var s=this.getCurChar(),l=c._symbolLexemeTable[s];if(l!==void 0){this.advance(1);var u=w.pool.get();return u.set(l,s,r),u}this.advance(1)}},i.createCompileError=function(r,n){return xe.createGSError(r,He.CompilationError,this.source,n??this.getShaderPosition(0))},i._scanWord=function(r){for(;ee.isAlnum(this.getCurCharCode())&&!this.isEnd();)this.advance(1);var n=this.getShaderPosition(0);if(!this._validateWordBoundaries(r.index,n.index))return null;var s=this._source.substring(r.index,n.index),l,u=(l=c._keywordLexemeTable[s])!=null?l:h.ID,_=Ce.createRange(r,n),S=w.pool.get();return S.set(u,s,_),S},i._validateWordBoundaries=function(r,n){var s=this._source;if(r>0){var l=s.charCodeAt(r-1);if(!this._isValidWordBoundary(l))return!1}if(n<s.length){var u=s.charCodeAt(n);if(!this._isValidWordBoundary(u))return!1}return!0},i._isValidWordBoundary=function(r){return ee.isWhiteSpaceChar(r,!0)||c._isWordSeparatorChar(r)},c._isWordSeparatorChar=function(r){return r===123||r===125||r===61||r===59||r===46||r===91||r===40||r===124},c._scanDigits=function(r,n){for(var s=n;s<r.length;){var l=r.charCodeAt(s);if(ee.isDigit(l))s++;else break}return s},c}(ee);Zt._keywordLexemeTable={RenderQueueType:a.GSRenderQueueType,BlendState:a.GSBlendState,DepthState:a.GSDepthState,StencilState:a.GSStencilState,RasterState:a.GSRasterState,EditorProperties:a.GSEditorProperties,EditorMacros:a.GSEditorMacros,Editor:a.GSEditor,Tags:a.GSTags,VertexShader:a.GSVertexShader,FragmentShader:a.GSFragmentShader,SubShader:a.GSSubShader,Pass:a.GSPass,BlendFactor:a.GSBlendFactor,BlendOperation:a.GSBlendOperation,Bool:a.GSBool,Number:a.GSNumber,Color:a.GSColor,CompareFunction:a.GSCompareFunction,StencilOperation:a.GSStencilOperation,CullMode:a.GSCullMode,ColorWriteMask:a.GSColorWriteMask,UsePass:a.GSUsePass,true:a.True,false:a.False};Zt._symbolLexemeTable={"{":a.LeftBrace,"}":a.RightBrace,"=":a.Equal,"|":a.BitwiseOr};var je=function(){function e(){}return e.parse=function(i){this.errors.length=0,this._symbolTableStack.clear(),this._pushScope();var t=this._lexer;t.setSource(i);for(var r=this._parseShader(t),n=r.pendingContents,s=r.renderStates,l=0,u=r.subShaders.length;l<u;l++){var _=r.subShaders[l],S=n.concat(_.pendingContents),E={constantMap:Ge({},s.constantMap),variableMap:Ge({},s.variableMap)};this._mergeRenderStates(E,_.renderStates);for(var O=0,M=_.passes.length;O<M;O++){var y=_.passes[O],I={constantMap:Ge({},E.constantMap),variableMap:Ge({},E.variableMap)};if(this._mergeRenderStates(I,y.renderStates),y.renderStates=I,!y.isUsePass){var V=S.concat(y.pendingContents);y.contents=V.map(function(k){return k.content}).join(`
|
|
32
|
-
`)}}}return r},e._parseShader=function(i){i.scanLexeme("Shader");var t=i.scanPairedChar('"','"',!1,!1),r=Ze.createShaderSource(t);i.scanLexeme("{");var n=1;i.skipCommentsAndSpace();for(var s=i.getShaderPosition(0),l=r.pendingContents;;){var u=i.scanToken();switch(u.type){case a.GSSubShader:this._addPendingContents(s,u.lexeme.length,l);var _=this._parseSubShader();r.subShaders.push(_),s=i.getShaderPosition(0);break;case a.GSEditorProperties:case a.GSEditorMacros:case a.GSEditor:this._addPendingContents(s,u.lexeme.length,l),i.scanPairedChar("{","}",!0,!1),s=i.getShaderPosition(0);break;case a.LeftBrace:++n;break;case a.RightBrace:if(--n===0)return this._addPendingContents(s,u.lexeme.length,l),this._popScope(),r;break;default:s=this._parseRenderState(u,s,l,r.renderStates)}}},e._parseRenderStateDeclarationOrAssignment=function(i,t){var r=this._lexer,n=r.scanToken();if(n.type===h.ID){r.scanLexeme("{");var s=this._parseRenderStateProperties(t.lexeme),l=new _t(n.lexeme,t.type,s);this._symbolTableStack.insert(l)}else if(n.lexeme==="="){var u=r.scanToken(),_;if(u.lexeme==="{")_=this._parseRenderStateProperties(t.lexeme);else{r.scanLexeme(";");var S=this._lookupSymbol;S.set(u.lexeme,t.type);var E=this._symbolTableStack.lookup(S);E!=null&&E.value||this._createCompileError('Invalid "'+t.lexeme+'" variable: '+u.lexeme,u.location),_=E.value}this._mergeRenderStates(i,_)}},e._mergeRenderStates=function(i,t){var r=i.constantMap,n=i.variableMap,s=t.constantMap,l=t.variableMap;for(var u in s)delete n[u],r[u]=s[u];for(var _ in l)delete r[_],n[_]=l[_]},e._parseVariableDeclaration=function(){var i=this._lexer,t=i.scanToken();i.scanLexeme(";");var r=new _t(t.lexeme,t.type);this._symbolTableStack.insert(r)},e._pushScope=function(){var i=new Ar;this._symbolTableStack.pushScope(i)},e._popScope=function(){this._symbolTableStack.popScope()},e._parseRenderStateProperties=function(i){for(var t=this._lexer,r=Ze.createRenderStates();t.getCurChar()!=="}";)this._parseRenderStateProperty(i,r),t.skipCommentsAndSpace();return t.advance(1),r},e._createCompileError=function(i,t){this._lexer.createCompileError(i,t)},e._scanEnumConstValue=function(i){var t,r=this._lexer;r.advance(1);var n=r.scanToken(),s=(t=this._renderStateConstMap[i])==null?void 0:t[n.lexeme];return s==null&&this._createCompileError("Invalid engine constant: "+i+"."+n.lexeme,n.location),s},e._parseRenderStateProperty=function(i,t){var r=this._lexer,n=r.scanToken(),s=n.lexeme,l=s;if(i==="BlendState"&&s!=="BlendColor"&&s!=="AlphaToCoverage"){var u=0,_=r.scanTwoExpectedLexemes("[","=");_==="["?(u=r.scanNumber(),r.scanLexeme("]"),r.scanLexeme("=")):_!=="="&&this._createCompileError("Invalid syntax, expect '[' or '=', but got unexpected token"),l+=u}else r.scanLexeme("=");var S=rr[i+l];S===void 0&&this._createCompileError("Invalid render state property "+s),r.skipCommentsAndSpace();var E,O=r.getCurCharCode();if(ee.isDigit(O)||O===46)E=r.scanNumber();else{var M=r.scanToken(),y=M.type;if(y===a.True)E=!0;else if(y===a.False)E=!1;else if(y===a.GSColor)E=r.scanColor();else if(r.getCurChar()==="."){if(E=this._scanEnumConstValue(M.lexeme),E==null)return;if(r.skipCommentsAndSpace(),r.getCurChar()==="|"){if(M.lexeme!=="ColorWriteMask"){this._createCompileError("Bitwise OR '|' is not supported for '"+M.lexeme+"', only bitmask enums like 'ColorWriteMask' support this",M.location);return}for(;r.getCurChar()==="|";){r.advance(1);var I=r.scanToken();if(I==null||r.getCurChar()!=="."){this._createCompileError("Invalid syntax after '|', expect 'EnumType.Value'",I==null?void 0:I.location);return}if(I.lexeme!==M.lexeme){this._createCompileError("Cannot mix enum types in bitwise OR: expected '"+M.lexeme+"' but got '"+I.lexeme+"'",I.location);return}var V=this._scanEnumConstValue(I.lexeme);if(V==null)return;E=E|V,r.skipCommentsAndSpace()}}}else{E=M.lexeme;var k=this._lookupSymbol;k.set(M.lexeme,h.ID),this._symbolTableStack.lookup(k)||this._createCompileError("Invalid "+i+" variable: "+M.lexeme,M.location)}}r.scanLexeme(";"),typeof E=="string"?t.variableMap[S]=E:t.constantMap[S]=E},e._parseRenderQueueDeclarationOrAssignment=function(i){var t=this._lexer,r=t.scanToken();if(r.type===h.ID){t.scanLexeme(";");var n=new _t(r.lexeme,a.GSRenderQueueType);this._symbolTableStack.insert(n);return}r.lexeme!=="="&&this._createCompileError("Invalid syntax, expect character '=', but got "+r.lexeme,r.location);var s=t.scanToken();t.scanLexeme(";");var l=this._renderStateConstMap.RenderQueueType[s.lexeme],u=rr.RenderQueueType;if(l==null){i.variableMap[u]=s.lexeme;var _=this._lookupSymbol;_.set(s.lexeme,a.GSRenderQueueType);var S=this._symbolTableStack.lookup(_);S||this._createCompileError("Invalid RenderQueueType variable: "+s.lexeme,s.location)}else i.constantMap[u]=l},e._addPendingContents=function(i,t,r){var n=this._lexer;if(n.hasPendingContent){var s=n.currentIndex-t;r.push({range:{start:i,end:Ge({},n.getShaderPosition(0),{index:s-1})},content:n.source.substring(i.index,s-1)}),n.hasPendingContent=!1}},e._parseSubShader=function(){var i=this._lexer;this._pushScope();var t=1,r=i.scanPairedChar('"','"',!1,!1),n=Ze.createSubShaderSource(r);i.scanLexeme("{"),i.skipCommentsAndSpace();for(var s=i.getShaderPosition(0);;){var l=i.scanToken();switch(l.type){case a.GSPass:this._addPendingContents(s,l.lexeme.length,n.pendingContents);var u=this._parsePass();n.passes.push(u),s=i.getShaderPosition(0);break;case a.GSUsePass:this._addPendingContents(s,l.lexeme.length,n.pendingContents);var _=i.scanPairedChar('"','"',!1,!1);n.passes.push(Ze.createUsePass(_)),s=i.getShaderPosition(0);break;case a.LeftBrace:++t;break;case a.RightBrace:if(--t===0)return this._addPendingContents(s,l.lexeme.length,n.pendingContents),this._popScope(),n;break;default:s=this._parseRenderStateAndTags(l,s,n.pendingContents,n.renderStates,n.tags)}}},e._parseTags=function(i){var t=this._lexer;for(t.scanLexeme("{");;){var r=t.scanToken();t.scanLexeme("=");var n=t.scanPairedChar('"','"',!1,!1);if(t.skipCommentsAndSpace(),i[r.lexeme]=n,t.peek(1)==="}"){t.advance(1);return}t.scanLexeme(",")}},e._parsePass=function(){this._pushScope();var i=this._lexer,t=i.scanPairedChar('"','"',!1,!1),r=Ze.createShaderPassSource(t);i.scanLexeme("{");var n=1;i.skipCommentsAndSpace();for(var s=i.getShaderPosition(0);;){var l=i.scanToken();switch(l.type){case a.GSVertexShader:case a.GSFragmentShader:this._addPendingContents(s,l.lexeme.length,r.pendingContents),i.scanLexeme("=");var u=i.scanToken();r[l.lexeme]&&xe.createGSError("Reassign main entry",He.CompilationError,i.source,i.getShaderPosition(0));var _=l.type===a.GSVertexShader?"vertexEntry":"fragmentEntry";r[_]=u.lexeme,i.scanLexeme(";"),s=i.getShaderPosition(0);break;case a.LeftBrace:++n;break;case a.RightBrace:if(--n===0)return this._addPendingContents(s,l.lexeme.length,r.pendingContents),this._popScope(),r;break;default:s=this._parseRenderStateAndTags(l,s,r.pendingContents,r.renderStates,r.tags)}}},e._parseRenderStateAndTags=function(i,t,r,n,s){switch(i.type){case a.GSTags:this._addPendingContents(t,i.lexeme.length,r),this._parseTags(s),t=this._lexer.getShaderPosition(0);break;default:t=this._parseRenderState(i,t,r,n)}return t},e._parseRenderState=function(i,t,r,n){switch(i.type){case a.GSBlendState:case a.GSDepthState:case a.GSRasterState:case a.GSStencilState:this._addPendingContents(t,i.lexeme.length,r),this._parseRenderStateDeclarationOrAssignment(n,i),t=this._lexer.getShaderPosition(0);break;case a.GSBlendFactor:case a.GSBlendOperation:case a.GSBool:case a.GSNumber:case a.GSColor:case a.GSCompareFunction:case a.GSStencilOperation:case a.GSCullMode:case a.GSColorWriteMask:this._addPendingContents(t,i.lexeme.length,r),this._parseVariableDeclaration(),t=this._lexer.getShaderPosition(0);break;case a.GSRenderQueueType:this._addPendingContents(t,i.lexeme.length,r),this._parseRenderQueueDeclarationOrAssignment(n),t=this._lexer.getShaderPosition(0);break;default:this._lexer.hasPendingContent=!0}return t},e}();je.errors=new Array;je._renderStateConstMap={RenderQueueType:Tr,CompareFunction:kr,StencilOperation:Ur,BlendOperation:Wr,BlendFactor:Nr,CullMode:zr,ColorWriteMask:Hr};je._symbolTableStack=new Er;je._lexer=new Zt;je._lookupSymbol=new _t("",null);var Ce=function(){function e(){this._includeMap={},this._chunkOutputCache=new Map}var c=e.prototype;return c._setIncludeMap=function(t){this._includeMap=t,this._chunkOutputCache.clear()},c._parseShaderSource=function(t){xe.clearAllShaderCompilerObjectPool();var r=je.parse(t);return r},c._parseShaderPass=function(t,r,n,s,l){var u={},_=xr.parse(t,l,this._includeMap,this._chunkOutputCache),S=new rt(_,u),E=S.tokenize(),O=e._parser;e._processingPassText=_;var M=O.parse(E,u);if(M){var y=s===Br.GLSLES100?Ei.getVisitor():bi.getVisitor(),I=y.visitShaderProgram(M,r,n);return e._processingPassText=void 0,I&&(I.vertexShaderInstructions=vt.parse(I.vertex),I.fragmentShaderInstructions=vt.parse(I.fragment)),I}},c._precompile=function(t,r,n){var s=this,l=this._parseShaderSource(t),u=l.subShaders.map(function(_){return{name:_.name,tags:_.tags,passes:_.passes.map(function(S){if(S.isUsePass)return{name:S.name,isUsePass:!0,tags:S.tags,renderStates:s._serializeRenderStates(S.renderStates)};var E=s._parseShaderPass(S.contents,S.vertexEntry,S.fragmentEntry,r,n);if(!E)throw new Error('Shader pass "'+l.name+"."+_.name+"."+S.name+'" precompile failed, please check the shader source code.');return{name:S.name,isUsePass:!1,tags:S.tags,renderStates:s._serializeRenderStates(S.renderStates),vertexShaderInstructions:E.vertexShaderInstructions,fragmentShaderInstructions:E.fragmentShaderInstructions}})}});return{name:l.name,platformTarget:r,subShaders:u}},c._serializeRenderStates=function(t){var r={};for(var n in t.constantMap){var s=t.constantMap[n];R(s,Ke)?r[n]=[s.r,s.g,s.b,s.a]:r[n]=s}return{constantMap:r,variableMap:t.variableMap}},e.createPosition=function(t,r,n){var s=this._shaderPositionPool.get();return s.set(t),s},e.createRange=function(t,r){var n=this._shaderRangePool.get();return n.set(t,r),n},e}();Ce._parser=Pi.create();Ce._shaderPositionPool=xe.createObjectPool(Sr);Ce._shaderRangePool=xe.createObjectPool(mr);var Ri="2.0.0-alpha.33",Li="Release";console.log("Galacean Engine Shader Compiler Version: "+Ri+" | Mode: "+Li);function Di(e){return(e.split(":")[1]??"").includes(".")?de.Float:de.Integer}const Fe=e=>{var c;return((c=dr.find(i=>i.path===e))==null?void 0:c.source)??""},Vi={PBR:Fe("Shaders/PBR.shader"),Unlit:Fe("Shaders/Unlit.shader"),BlinnPhong:Fe("Shaders/BlinnPhong.shader"),"Effect/Particle":Fe("Shaders/Effect/Particle.shader"),"Effect/Trail":Fe("Shaders/Effect/Trail.shader"),"Sky/Skybox":Fe("Shaders/Sky/Skybox.shader"),"Sky/SkyProcedural":Fe("Shaders/Sky/SkyProcedural.shader")},yr={PBR:Re.PbrUIScript,Unlit:Re.UnlitUIScript,BlinnPhong:Re.BlinnPhongUIScript,"Effect/Particle":Re.ParticleTrailUIScript,"Effect/Trail":Re.ParticleTrailUIScript,"Sky/SkyProcedural":Re.SkyProceduralUIScript},Ir=new Map;let Ht=null;async function Fi(e){const c=oi[e],t=(await jr.build({stdin:{contents:c,loader:"ts"},bundle:!0,format:"esm",write:!1,plugins:[ci({"@galacean/engine":{varName:"Galacean",type:"cjs"}})]})).outputFiles[0],r=await li(t.contents);return new r.default}async function Gi(){const e=new Set(Object.values(yr));await Promise.all(Array.from(e).map(async c=>{try{const i=await Fi(c);Ir.set(c,i)}catch(i){console.error(`Failed to compile builtin UIScript: ${c}`,i)}}))}async function Bi(e){Ht||(Ht=e.then(()=>Gi())),await Ht}function Ti(e){const c=yr[e];if(c)return Ir.get(c)}qr(fi,{variants:{checked:{true:{color:"$green10"}}}});const ki=Xr(e=>{const{asset:c}=e;if(c.compileError)return Je.jsx(_i,{label:ht("shader.inspector.compile-error"),value:c.compileError});const i=[],t={};for(const r of c.properties??[]){const{uiInfo:n}=r;if(!n||n.hide)continue;const s=n.assetType??n.type,l={label:n.label,type:ue.PureDisplay,disabled:!0,value:r.bundleType==="macro"?"MACRO":s,property:r.prop};if(n.group){const u=t[r.uiInfo.group]??{children:[],type:ue.Group,property:n.group};u.children.push(l),t[n.group]=u}else i.push(l)}for(const r in t)i.push(t[r]);return Je.jsxs(Je.Fragment,{children:[Je.jsx(wr,{inspectorConfig:{property:ht("shader.inspector.properties"),type:ue.Group,children:i},onModelChange:null,model:c},"Properties"),c.shaderScriptRefId&&Je.jsx(Qr.Item,{model:c,inspectorConfig:{label:ht("shader.inspector.included-ui-script"),type:ue.Display,disabled:!0,property:"uiScript",value:c.root.assetStore.assets[c.shaderScriptRefId.refId].getRouteString()},onModelChange:null})]})}),jt=e=>{var c;return((c=dr.find(i=>i.path===e))==null?void 0:c.source)??""},Ui={Unlit:{filename:"UnlitShader.shader",uiScriptTemplateType:Re.UnlitUIScript,uiScriptFileName:"UnlitScript.ts"},PBR:{filename:"PBRShader.shader",uiScriptTemplateType:Re.PbrUIScript,uiScriptFileName:"PBRScript.ts"},"2D/Sprite":{filename:"SpriteShader.shader"}};function _r(e,c){const i=`UIScript "${c}";`;if(/^\s*UIScript\s+"/m.test(e))return e.replace(/^(\s*)UIScript\s+"[^"]*"\s*;?\s*$/m,`$1${i}`);const t=e.match(/\bEditor\s*\{/);if(t){let n=0;for(let s=t.index;s<e.length;s++)if(e[s]==="{")n++;else if(e[s]==="}"&&(n--,n===0)){const l=e.lastIndexOf(`
|
|
31
|
+
`,n);if(u===-1)break;n=u+1}return-1},e._pushText=function(i,t,r,n){if(!(r>=n)){var s=i.length>0?i[i.length-1]:null;s&&s[0]===ne.Text?s[1]+=t.substring(r,n):i.push([ne.Text,t.substring(r,n)])}},e._backfillJump=function(i,t,r){r===void 0&&(r=!1);var n=i[0];n===ne.IfDef||n===ne.IfNdef?(!r||i[2]===-1)&&(i[2]=t):n===ne.IfCmp?(!r||i[4]===-1)&&(i[4]=t):n===ne.IfExpr&&(!r||i[2]===-1)&&(i[2]=t)},e._stripLineComment=function(i){var t=i.indexOf("//");return t>=0?i.substring(0,t).trimEnd():i},e._parseCondition=function(i){var t={s:i.trim(),i:0};return e._parseOr(t)},e._skipWs=function(i){for(;i.i<i.s.length&&(i.s.charCodeAt(i.i)===32||i.s.charCodeAt(i.i)===9);)i.i++},e._parseOr=function(i){var t=e._parseAnd(i);for(e._skipWs(i);i.i<i.s.length-1&&i.s.charCodeAt(i.i)===124&&i.s.charCodeAt(i.i+1)===124;)i.i+=2,e._skipWs(i),t={t:"or",l:t,r:e._parseAnd(i)},e._skipWs(i);return t},e._parseAnd=function(i){var t=e._parseUnary(i);for(e._skipWs(i);i.i<i.s.length-1&&i.s.charCodeAt(i.i)===38&&i.s.charCodeAt(i.i+1)===38;)i.i+=2,e._skipWs(i),t={t:"and",l:t,r:e._parseUnary(i)},e._skipWs(i);return t},e._parseUnary=function(i){return e._skipWs(i),i.s.charCodeAt(i.i)===33?(i.i++,e._skipWs(i),{t:"not",c:e._parsePrimary(i)}):e._parsePrimary(i)},e._parsePrimary=function(i){e._skipWs(i);var t=i.s;if(t.charCodeAt(i.i)===40){i.i++,e._skipWs(i);var r=e._parseOr(i);return e._skipWs(i),t.charCodeAt(i.i)===41&&i.i++,r}if(t.substring(i.i,i.i+7)==="defined"){i.i+=7,e._skipWs(i);var n=t.charCodeAt(i.i)===40;n&&i.i++,e._skipWs(i);var s=e._scanIdentifier(i);return e._skipWs(i),n&&t.charCodeAt(i.i)===41&&i.i++,{t:"def",m:s}}if(i.i<t.length&&e._isDigit(t.charCodeAt(i.i))){var l=e._scanNumber(i);e._skipWs(i);var u=e._scanOp(i);return u?(e._skipWs(i),{t:"bool",v:e._evalNumOp(l,u,e._scanNumber(i))}):{t:"bool",v:l!==0}}var _=e._scanIdentifier(i);if(!_)return{t:"bool",v:!1};e._skipWs(i);var S=e._scanOp(i);return S?(e._skipWs(i),{t:"cmp",m:_,op:S,v:e._scanNumber(i)}):{t:"def",m:_}},e._isDigit=function(i){return i>=48&&i<=57},e._isAlnum=function(i){return i>=65&&i<=90||i>=97&&i<=122||i>=48&&i<=57||i===95},e._scanIdentifier=function(i){for(var t=i.i;i.i<i.s.length&&e._isAlnum(i.s.charCodeAt(i.i));)i.i++;return i.s.substring(t,i.i)},e._scanNumber=function(i){var t=i.i;for(i.s.charCodeAt(i.i)===45&&i.i++;i.i<i.s.length&&(e._isDigit(i.s.charCodeAt(i.i))||i.s.charCodeAt(i.i)===46);)i.i++;return Number(i.s.substring(t,i.i))||0},e._scanOp=function(i){var t=i.s.charCodeAt(i.i),r=i.i+1<i.s.length?i.s.charCodeAt(i.i+1):0;return t===61&&r===61?(i.i+=2,"=="):t===33&&r===61?(i.i+=2,"!="):t===62&&r===61?(i.i+=2,">="):t===60&&r===61?(i.i+=2,"<="):t===62?(i.i++,">"):t===60?(i.i++,"<"):""},e._evalNumOp=function(i,t,r){switch(t){case"==":return i===r;case"!=":return i!==r;case">":return i>r;case"<":return i<r;case">=":return i>=r;case"<=":return i<=r;default:return!1}},e}();vt._DIRECTIVE_RE=/^[ \t]*#[ \t]*(if|ifdef|ifndef|elif|else|endif|define|undef)\b(.*)/;vt._FUNC_MACRO_RE=/^(\w+)\(([^)]*)\)\s*(.*)/;var ze=function e(c,i){this.goal=c,this.derivation=i,this.id=e._id++,e.pool.set(this.id,this)};ze._id=0;ze.pool=new Map;var Jt=function(){function e(i,t,r){this._needReInfer=!0,this.production=i,this.position=t,this.lookaheadSet=new Set;for(var n=Y(r),s;!(s=n()).done;){var l=s.value;this.lookaheadSet.add(l)}this.id=e._id++}var c=e.prototype;return c.addLookahead=function(t){for(var r=Y(t),n;!(n=r()).done;){var s=n.value;this.lookaheadSet.has(s)||(this.lookaheadSet.add(s),this.needReInfer=!0)}},c.symbolByOffset=function(t){return this.production.derivation[this.position+t]},c.canReduce=function(){if(this.position>this.production.derivation.length-1)return!0;for(var t=this.position;t<this.production.derivation.length;t++)if(this.production.derivation[t]!==h.EPSILON)return!1;return!0},c.advance=function(){return new e(this.production,this.position+1,this.lookaheadSet)},be(e,[{key:"needReInfer",get:function(){return this._needReInfer},set:function(t){this._needReInfer=t}},{key:"curSymbol",get:function(){return this.production.derivation[this.position]}},{key:"nextSymbol",get:function(){return this.production.derivation[this.position+1]}}]),e}();Jt._id=0;var it=function(){function e(i){this.closured=!1,this._stateItemPool=new Map,this.id=e._id++,this._items=new Set([].concat(i)),this.cores=new Set([].concat(i));for(var t=Y(i),r;!(r=t()).done;){var n=r.value,s=this.getStateItemMapKey(n.production,n.position);this._stateItemPool.set(s,n)}e.pool.set(this.id,this)}var c=e.prototype;return c.getStateItemMapKey=function(t,r){return t.id+","+r},c.createStateItem=function(t,r,n){n===void 0&&(n=new Set);var s=this.getStateItemMapKey(t,r),l=this._stateItemPool.get(s);if(l){for(var u=Y(n),_;!(_=u()).done;){var S=_.value;l.lookaheadSet.has(S)||(l.lookaheadSet.add(S),l.needReInfer=!0)}return l}var E=new Jt(t,r,n);return this._stateItemPool.set(s,E),E},e.create=function(t){var r=this.getMapKey(t),n=this.closureMap.get(r);if(n){for(var s=Y(t),l;!(l=s()).done;){var u=l.value;n.createStateItem(u.production,u.position,u.lookaheadSet)}return n}var _=new e(t);return this.closureMap.set(r,_),_},e.getMapKey=function(t){return t.map(function(r){return r.production.id+","+r.position}).join(";")},be(e,[{key:"items",get:function(){return this._items}},{key:"needReInfer",get:function(){for(var t=Y(this.cores),r;!(r=t()).done;){var n=r.value;if(n.needReInfer)return!0}return!1}}]),e}();it.closureMap=new Map;it.pool=new Map;it._id=0;var x=function(){function e(){}return e.isTerminal=function(i){return i<o.START},e.toString=function(i){if(this.isTerminal(i)){var t;return(t=h[i])!=null?t:a[i]}return o[i]},e.createProductionWithOptions=function(i,t,r){for(var n=function(){var S=_.value,E=!r&&S.length===1&&!e.isTerminal(S[0]);l.push([[].concat([i],S),function(O){for(var M=arguments.length,y=new Array(M>1?M-1:0),I=1;I<M;I++)y[I-1]=arguments[I];if(y[0])if(E)O.semanticStack.push(y[0]);else{var V=y[0].location.start,k=y[y.length-1].location.end,N=Ce.createRange(V,k);P.get(s,O,N,y)}}])},s=r??P.TrivialNode.pool,l=[],u=Y(t),_;!(_=u()).done;)n();return l},e.addMapSetItem=function(i,t,r){var n,s=(n=i.get(t))!=null?n:new Set;s.add(r),i.set(t,s)},e.isSubSet=function(i,t){for(var r=Y(i),n;!(n=r()).done;){var s=n.value;if(!t.has(s))return!1}return!0},e.isActionEqual=function(i,t){return i.action===t.action&&i.target===t.target},e}(),Pe=function(e){return e[e.Shift=0]="Shift",e[e.Reduce=1]="Reduce",e[e.Accept=2]="Accept",e}({}),yi=function(){function e(i){this.firstSetMap=new Map,this.followSetMap=new Map,this.actionTable=new Map,this.gotoTable=new Map,this._firstSetNTStack=[],this.grammar=i}var c=e.prototype;return c.generate=function(){this.computeFirstSet(),this.buildStateTable()},c.buildStateTable=function(){var t=[new Jt(this.grammar.productions[0],0,[h.EOF])],r=it.create(t);this._extendState(r)},c._extendState=function(t){if(t.needReInfer){this._closure(t);for(var r=this._inferNextState(t),n=Y(r),s;!(s=n()).done;){var l=s.value;this._extendState(l)}}},c._closure=function(t){for(var r=Y(t.cores),n;!(n=r()).done;){var s=n.value;s.canReduce()||this._extendStateItem(t,s)}return t.closured=!0,t},c._extendStateItem=function(t,r){if(!x.isTerminal(r.curSymbol)){var n=this.grammar.getProductionList(r.curSymbol);if(r.nextSymbol){for(var s=new Set,l,u=!1,_=1,S=r.symbolByOffset(1);S;S=r.symbolByOffset(++_)){if(x.isTerminal(S)){s.add(S),u=!0;break}l=this.firstSetMap.get(S);for(var E=Y(l),O;!(O=E()).done;){var M=O.value;s.add(M)}if(!l.has(h.EPSILON))break}if(!u&&(l!=null&&l.has(h.EPSILON)))for(var y=Y(r.lookaheadSet),I;!(I=y()).done;){var V=I.value;s.add(V)}for(var k=Y(n),N;!(N=k()).done;){var W=N.value,U=t.createStateItem(W,0);(!t.items.has(U)||!x.isSubSet(s,U.lookaheadSet))&&(t.items.add(U),U.addLookahead(s),this._extendStateItem(t,U))}}else for(var j=Y(n),X;!(X=j()).done;){var q=X.value,Q=t.createStateItem(q,0);(!t.items.has(Q)||!x.isSubSet(r.lookaheadSet,Q.lookaheadSet))&&(t.items.add(Q),Q.addLookahead(r.lookaheadSet),this._extendStateItem(t,Q))}}},c._inferNextState=function(t){var r=new Map,n,s=(n=this.actionTable.get(t.id))!=null?n:new Map,l,u=(l=this.gotoTable.get(t.id))!=null?l:new Map;this.actionTable.set(t.id,s),this.gotoTable.set(t.id,u);for(var _=Y(t.items),S;!(S=_()).done;){var E=S.value;if(E.canReduce()){var O=void 0;E.production.goal!==o.START?O={action:Pe.Reduce,target:E.production.id}:O={action:Pe.Accept};for(var M=Y(E.lookaheadSet),y;!(y=M()).done;){var I=y.value;this._addAction(s,I,O)}}else{var V=E.advance();x.addMapSetItem(r,E.curSymbol,V)}E.needReInfer=!1}for(var k=new Set,N=Y(r.entries()),W;!(W=N()).done;){var U=W.value,j=U[0],X=U[1],q=it.create(Array.from(X));x.isTerminal(j)?this._addAction(s,j,{action:Pe.Shift,target:q.id}):u.set(j,q.id),k.add(q)}return k},c._addAction=function(t,r,n){var s=t.get(r);s&&!x.isActionEqual(s,n)&&e._isKnownShiftPreferred(r,s,n)&&s.action===Pe.Shift&&n.action===Pe.Reduce||t.set(r,n)},c.computeFirstSet=function(){for(var t=Y(this.grammar.productions.slice(1)),r;!(r=t()).done;){var n=r.value;this._computeFirstSetForNT(n.goal)}},c._computeFirstSetForNT=function(t){var r=this._firstSetNTStack.findIndex(function(U){return U===t});if(r!==-1){for(var n=this.firstSetMap.get(t),s=this._firstSetNTStack.length,l=s-1;l>r;l--){var u=this._firstSetNTStack[l];this.firstSetMap.set(u,n)}return n}this._firstSetNTStack.push(t);var _=this.grammar.getProductionList(t),S=new Set;this.firstSetMap.set(t,S),this.grammar.isNullableNT(t)&&S.add(h.EPSILON);for(var E=Y(_),O;!(O=E()).done;){for(var M=O.value,y=0;y<M.derivation.length;y++){var I=M.derivation[y];if(x.isTerminal(I)){S.add(I);break}for(var V=this._computeFirstSetForNT(I),k=Y(V),N;!(N=k()).done;){var W=N.value;W!==h.EPSILON&&S.add(W)}if(!this.grammar.isNullableNT(I))break}y===M.derivation.length&&S.add(h.EPSILON)}return this._firstSetNTStack.pop(),S},e._isKnownShiftPreferred=function(t,r,n){if(t===a.ELSE)return!0;if(t!==h.LEFT_PAREN)return!1;var s=r.action===Pe.Reduce?r:n.action===Pe.Reduce?n:null;if(!s)return!1;var l=ze.pool.get(s.target);return!!l&&l.goal===o.type_specifier_nonarray&&l.derivation.length===1&&l.derivation[0]===o.macro_call_symbol},e}(),Ii=function(){function e(i,t){this.startSymbol=i,t.unshift(new ze(o.START,[i])),this.productions=t}var c=e.prototype;return c.getProductionList=function(t){return this.productions.filter(function(r){return r.goal===t})},c.isNullableNT=function(t){return this.productions.find(function(r){return r.goal===t&&r.derivation[0]===h.EPSILON})},c.getProductionByID=function(t){return ze.pool.get(t)},e.create=function(t,r){var n=r.map(function(s){return new ze(s[0],s.slice(1))});return new e(t,n)},e}(),$t=[].concat(x.createProductionWithOptions(o.gs_shader_program,[[o.global_declaration],[o.gs_shader_program,o.global_declaration]],P.GLShaderProgram.pool),x.createProductionWithOptions(o.global_declaration,[[o.precision_specifier],[o.variable_declaration_statement],[o.struct_specifier],[o.function_definition],[o.global_macro_if_statement],[o.macro_undef],[o.macro_define],[a.MACRO_DEFINE_EXPRESSION]],P.GlobalDeclaration.pool),x.createProductionWithOptions(o.macro_define,[[a.MACRO_DEFINE,h.ID,o.expression,a.MACRO_DEFINE_END],[a.MACRO_DEFINE,h.ID,a.MACRO_DEFINE_PARAMS,o.expression,a.MACRO_DEFINE_END]],P.MacroDefine.pool),x.createProductionWithOptions(o.macro_call_symbol,[[a.MACRO_CALL]],P.MacroCallSymbol.pool),x.createProductionWithOptions(o.macro_call_function,[[o.macro_call_symbol,h.LEFT_PAREN,h.RIGHT_PAREN],[o.macro_call_symbol,h.LEFT_PAREN,o.function_call_parameter_list,h.RIGHT_PAREN]],P.MacroCallFunction.pool),x.createProductionWithOptions(o.macro_undef,[[a.MACRO_UNDEF,h.ID],[a.MACRO_UNDEF,a.MACRO_CALL]],P.MacroUndef.pool),x.createProductionWithOptions(o.macro_push_context,[[a.MACRO_IF,a.MACRO_CONDITIONAL_EXPRESSION],[a.MACRO_IFDEF,h.ID],[a.MACRO_IFNDEF,h.ID],[a.MACRO_IFDEF,o.macro_call_symbol],[a.MACRO_IFNDEF,o.macro_call_symbol]],P.MacroPushContext.pool),x.createProductionWithOptions(o.macro_pop_context,[[a.MACRO_ENDIF]],P.MacroPopContext.pool),x.createProductionWithOptions(o.macro_elif_expression,[[a.MACRO_ELIF,a.MACRO_CONDITIONAL_EXPRESSION]],P.MacroElifExpression.pool),x.createProductionWithOptions(o.macro_else_expression,[[a.MACRO_ELSE]],P.MacroElseExpression.pool),x.createProductionWithOptions(o.global_macro_declaration,[[o.global_declaration],[o.global_macro_declaration,o.global_declaration]],P.GlobalMacroDeclaration.pool),x.createProductionWithOptions(o.global_macro_if_statement,[[o.macro_push_context,o.global_macro_declaration,o.global_macro_branch],[o.macro_push_context,o.global_macro_branch]],P.GlobalMacroIfStatement.pool),x.createProductionWithOptions(o.global_macro_branch,[[o.macro_pop_context],[o.macro_elif_expression,o.global_macro_declaration,o.global_macro_branch],[o.macro_else_expression,o.global_macro_declaration,o.macro_pop_context],[o.macro_elif_expression,o.global_macro_branch],[o.macro_else_expression,o.macro_pop_context]],P.GlobalMacroBranch.pool),x.createProductionWithOptions(o.variable_declaration,[[o.fully_specified_type,h.ID],[o.fully_specified_type,h.ID,o.array_specifier],[o.fully_specified_type,h.ID,h.EQUAL,o.initializer]],P.VariableDeclaration.pool),x.createProductionWithOptions(o.variable_declaration_list,[[o.variable_declaration],[o.variable_declaration_list,h.COMMA,h.ID],[o.variable_declaration_list,h.COMMA,h.ID,o.array_specifier]],P.VariableDeclarationList.pool),x.createProductionWithOptions(o.variable_declaration_statement,[[o.variable_declaration_list,h.SEMICOLON]]),x.createProductionWithOptions(o.ext_builtin_type_specifier_nonarray,[[a.VOID],[a.FLOAT],[a.BOOL],[a.INT],[a.UINT],[a.VEC2],[a.VEC3],[a.VEC4],[a.BVEC2],[a.BVEC3],[a.BVEC4],[a.IVEC2],[a.IVEC3],[a.IVEC4],[a.UVEC2],[a.UVEC3],[a.UVEC4],[a.MAT2],[a.MAT3],[a.MAT4],[a.MAT2X3],[a.MAT2X4],[a.MAT3X2],[a.MAT3X4],[a.MAT4X2],[a.MAT4X3],[a.SAMPLER2D],[a.SAMPLER3D],[a.SAMPLER_CUBE],[a.SAMPLER2D_SHADOW],[a.SAMPLER_CUBE_SHADOW],[a.SAMPLER2D_ARRAY],[a.SAMPLER2D_ARRAY_SHADOW],[a.I_SAMPLER2D],[a.I_SAMPLER3D],[a.I_SAMPLER_CUBE],[a.I_SAMPLER2D_ARRAY],[a.U_SAMPLER2D],[a.U_SAMPLER3D],[a.U_SAMPLER_CUBE],[a.U_SAMPLER2D_ARRAY]],P.ExtBuiltinTypeSpecifierNonArray.pool),x.createProductionWithOptions(o.type_specifier_nonarray,[[h.ID],[o.ext_builtin_type_specifier_nonarray],[o.macro_call_symbol]],P.TypeSpecifierNonArray.pool),x.createProductionWithOptions(o.fully_specified_type,[[o.type_specifier],[o.type_qualifier,o.type_specifier]],P.FullySpecifiedType.pool),x.createProductionWithOptions(o.type_specifier,[[o.type_specifier_nonarray],[o.ext_builtin_type_specifier_nonarray,o.array_specifier]],P.TypeSpecifier.pool),x.createProductionWithOptions(o.type_qualifier,[[o.single_type_qualifier],[o.type_qualifier,o.single_type_qualifier]],P.TypeQualifier.pool),x.createProductionWithOptions(o.single_type_qualifier,[[o.storage_qualifier],[o.precision_qualifier],[o.interpolation_qualifier],[o.invariant_qualifier],[a.PRECISE]],P.SingleTypeQualifier.pool),x.createProductionWithOptions(o.storage_qualifier,[[a.CONST],[a.IN],[a.INOUT],[a.OUT],[a.CENTROID]]),x.createProductionWithOptions(o.interpolation_qualifier,[[a.SMOOTH],[a.FLAT]]),x.createProductionWithOptions(o.invariant_qualifier,[[a.INVARIANT]]),x.createProductionWithOptions(o.precision_qualifier,[[a.HIGHP],[a.MEDIUMP],[a.LOWP]]),x.createProductionWithOptions(o.struct_specifier,[[a.STRUCT,h.ID,h.LEFT_BRACE,o.struct_declaration_list,h.RIGHT_BRACE,h.SEMICOLON],[a.STRUCT,h.LEFT_BRACE,o.struct_declaration_list,h.RIGHT_BRACE,h.SEMICOLON]],P.StructSpecifier.pool),x.createProductionWithOptions(o.struct_declaration_list,[[o.struct_declaration],[o.struct_declaration_list,o.struct_declaration]],P.StructDeclarationList.pool),x.createProductionWithOptions(o.struct_declaration,[[o.type_specifier,o.struct_declarator_list,h.SEMICOLON],[o.type_qualifier,o.type_specifier,o.struct_declarator_list,h.SEMICOLON],[o.layout_qualifier,o.type_specifier,o.struct_declarator,h.SEMICOLON],[o.macro_struct_declaration]],P.StructDeclaration.pool),x.createProductionWithOptions(o.macro_struct_declaration,[[o.macro_push_context,o.struct_declaration_list,o.macro_struct_branch],[o.macro_push_context,o.macro_struct_branch]],P.MacroStructDeclaration.pool),x.createProductionWithOptions(o.macro_struct_branch,[[o.macro_pop_context],[o.macro_elif_expression,o.struct_declaration_list,o.macro_struct_branch],[o.macro_else_expression,o.struct_declaration_list,o.macro_pop_context],[o.macro_elif_expression,o.macro_struct_branch],[o.macro_else_expression,o.macro_pop_context]],P.MacroStructBranch.pool),x.createProductionWithOptions(o.layout_qualifier,[[a.LAYOUT,h.LEFT_PAREN,a.LOCATION,h.EQUAL,h.INT_CONSTANT,h.RIGHT_PAREN]],P.LayoutQualifier.pool),x.createProductionWithOptions(o.struct_declarator_list,[[o.struct_declarator],[o.struct_declarator_list,h.COMMA,o.struct_declarator]],P.StructDeclaratorList.pool),x.createProductionWithOptions(o.struct_declarator,[[h.ID],[h.ID,o.array_specifier]],P.StructDeclarator.pool),x.createProductionWithOptions(o.array_specifier,[[h.LEFT_BRACKET,h.RIGHT_BRACKET],[h.LEFT_BRACKET,o.integer_constant_expression,h.RIGHT_BRACKET]],P.ArraySpecifier.pool),x.createProductionWithOptions(o.integer_constant_expression_operator,[[h.PLUS],[h.DASH],[h.STAR],[h.SLASH],[h.PERCENT]],P.IntegerConstantExpressionOperator.pool),x.createProductionWithOptions(o.integer_constant_expression,[[o.variable_identifier],[h.INT_CONSTANT],[o.integer_constant_expression,o.integer_constant_expression_operator,h.INT_CONSTANT],[o.integer_constant_expression,o.integer_constant_expression_operator,o.variable_identifier]],P.IntegerConstantExpression.pool),x.createProductionWithOptions(o.conditional_expression,[[o.logical_or_expression],[o.logical_or_expression,h.QUESTION,o.expression,h.COLON,o.assignment_expression]]),x.createProductionWithOptions(o.logical_or_expression,[[o.logical_xor_expression],[o.logical_or_expression,h.OR_OP,o.logical_xor_expression]]),x.createProductionWithOptions(o.logical_xor_expression,[[o.logical_and_expression],[o.logical_xor_expression,h.XOR_OP,o.logical_and_expression]]),x.createProductionWithOptions(o.logical_and_expression,[[o.inclusive_or_expression],[o.logical_and_expression,h.AND_OP,o.inclusive_or_expression]]),x.createProductionWithOptions(o.inclusive_or_expression,[[o.exclusive_or_expression],[o.inclusive_or_expression,h.VERTICAL_BAR,o.exclusive_or_expression]]),x.createProductionWithOptions(o.exclusive_or_expression,[[o.and_expression],[o.exclusive_or_expression,h.CARET,o.and_expression]]),x.createProductionWithOptions(o.and_expression,[[o.equality_expression],[o.and_expression,h.AMPERSAND,o.equality_expression]]),x.createProductionWithOptions(o.equality_expression,[[o.relational_expression],[o.equality_expression,h.EQ_OP,o.relational_expression],[o.equality_expression,h.NE_OP,o.relational_expression]]),x.createProductionWithOptions(o.relational_expression,[[o.shift_expression],[o.relational_expression,h.LEFT_ANGLE,o.shift_expression],[o.relational_expression,h.RIGHT_ANGLE,o.shift_expression],[o.relational_expression,h.LE_OP,o.shift_expression],[o.relational_expression,h.GE_OP,o.shift_expression]]),x.createProductionWithOptions(o.shift_expression,[[o.additive_expression],[o.shift_expression,h.LEFT_OP,o.additive_expression],[o.shift_expression,h.RIGHT_OP,o.additive_expression]]),x.createProductionWithOptions(o.additive_expression,[[o.multiplicative_expression],[o.additive_expression,h.PLUS,o.multiplicative_expression],[o.additive_expression,h.DASH,o.multiplicative_expression]]),x.createProductionWithOptions(o.multiplicative_expression,[[o.unary_expression],[o.multiplicative_expression,h.STAR,o.unary_expression],[o.multiplicative_expression,h.SLASH,o.unary_expression],[o.multiplicative_expression,h.PERCENT,o.unary_expression]]),x.createProductionWithOptions(o.unary_expression,[[o.postfix_expression],[h.INC_OP,o.unary_expression],[h.DEC_OP,o.unary_expression],[o.unary_operator,o.unary_expression]]),x.createProductionWithOptions(o.unary_operator,[[h.PLUS],[h.DASH],[h.BANG],[h.TILDE]]),x.createProductionWithOptions(o.postfix_expression,[[o.primary_expression],[o.postfix_expression,h.LEFT_BRACKET,o.expression,h.RIGHT_BRACKET],[o.function_call],[o.postfix_expression,h.DOT,h.ID],[o.postfix_expression,h.DOT,o.function_call],[o.postfix_expression,h.INC_OP],[o.postfix_expression,h.DEC_OP]],P.PostfixExpression.pool),x.createProductionWithOptions(o.primary_expression,[[o.variable_identifier],[h.INT_CONSTANT],[h.FLOAT_CONSTANT],[a.True],[a.False],[h.LEFT_PAREN,o.expression,h.RIGHT_PAREN]],P.PrimaryExpression.pool),x.createProductionWithOptions(o.expression,[[o.assignment_expression],[o.expression,h.COMMA,o.assignment_expression]],P.Expression.pool),x.createProductionWithOptions(o.assignment_expression,[[o.conditional_expression],[o.unary_expression,o.assignment_operator,o.assignment_expression]],P.AssignmentExpression.pool),x.createProductionWithOptions(o.assignment_operator,[[h.EQUAL],[h.MUL_ASSIGN],[h.DIV_ASSIGN],[h.MOD_ASSIGN],[h.ADD_ASSIGN],[h.SUB_ASSIGN],[h.LEFT_ASSIGN],[h.RIGHT_ASSIGN],[h.AND_ASSIGN],[h.XOR_ASSIGN],[h.OR_ASSIGN]]),x.createProductionWithOptions(o.function_call,[[o.function_call_generic]],P.FunctionCall.pool),x.createProductionWithOptions(o.function_call_generic,[[o.function_identifier,h.LEFT_PAREN,o.function_call_parameter_list,h.RIGHT_PAREN],[o.function_identifier,h.LEFT_PAREN,h.RIGHT_PAREN],[o.function_identifier,a.VOID,h.RIGHT_PAREN]],P.FunctionCallGeneric.pool),x.createProductionWithOptions(o.function_call_parameter_list,[[o.assignment_expression],[o.function_call_parameter_list,h.COMMA,o.assignment_expression],[o.macro_call_arg_block],[o.function_call_parameter_list,o.macro_call_arg_block]],P.FunctionCallParameterList.pool),x.createProductionWithOptions(o.macro_call_arg_case_list,[[o.assignment_expression],[h.COMMA,o.assignment_expression],[o.macro_call_arg_block],[o.macro_call_arg_case_list,o.macro_call_arg_block],[o.macro_call_arg_case_list,h.COMMA,o.assignment_expression]],P.MacroCallArgCaseList.pool),x.createProductionWithOptions(o.macro_call_arg_block,[[o.macro_push_context,o.macro_call_arg_branch],[o.macro_push_context,o.macro_call_arg_case_list,o.macro_call_arg_branch]],P.MacroCallArgBlock.pool),x.createProductionWithOptions(o.macro_call_arg_branch,[[o.macro_pop_context],[o.macro_elif_expression,o.macro_call_arg_case_list,o.macro_call_arg_branch],[o.macro_else_expression,o.macro_call_arg_case_list,o.macro_pop_context],[o.macro_elif_expression,o.macro_call_arg_branch],[o.macro_else_expression,o.macro_pop_context]],P.MacroCallArgBranch.pool),x.createProductionWithOptions(o.function_identifier,[[o.type_specifier]],P.FunctionIdentifier.pool),x.createProductionWithOptions(o.function_definition,[[o.function_prototype,o.compound_statement_no_scope]],P.FunctionDefinition.pool),x.createProductionWithOptions(o.function_prototype,[[o.function_declarator,h.RIGHT_PAREN]],P.FunctionProtoType.pool),x.createProductionWithOptions(o.function_declarator,[[o.function_header],[o.function_header,o.function_parameter_list]],P.FunctionDeclarator.pool),x.createProductionWithOptions(o.function_header,[[o.fully_specified_type,h.ID,h.LEFT_PAREN]],P.FunctionHeader.pool),x.createProductionWithOptions(o.function_parameter_list,[[o.parameter_declaration],[o.function_parameter_list,h.COMMA,o.parameter_declaration],[o.macro_param_block],[o.function_parameter_list,o.macro_param_block]],P.FunctionParameterList.pool),x.createProductionWithOptions(o.macro_param_case_list,[[o.parameter_declaration],[h.COMMA,o.parameter_declaration],[o.macro_param_block],[o.macro_param_case_list,o.macro_param_block],[o.macro_param_case_list,h.COMMA,o.parameter_declaration]],P.MacroParamCaseList.pool),x.createProductionWithOptions(o.macro_param_block,[[o.macro_push_context,o.macro_parameter_branch],[o.macro_push_context,o.macro_param_case_list,o.macro_parameter_branch]],P.MacroParamBlock.pool),x.createProductionWithOptions(o.macro_parameter_branch,[[o.macro_pop_context],[o.macro_elif_expression,o.macro_param_case_list,o.macro_parameter_branch],[o.macro_else_expression,o.macro_param_case_list,o.macro_pop_context],[o.macro_elif_expression,o.macro_parameter_branch],[o.macro_else_expression,o.macro_pop_context]],P.MacroParameterBranch.pool),x.createProductionWithOptions(o.parameter_declaration,[[o.type_qualifier,o.parameter_declarator],[o.parameter_declarator],[o.macro_call_symbol],[o.macro_call_function]],P.ParameterDeclaration.pool),x.createProductionWithOptions(o.parameter_declarator,[[o.type_specifier,h.ID],[o.type_specifier,h.ID,o.array_specifier]],P.ParameterDeclarator.pool),x.createProductionWithOptions(o.statement_list,[[o.statement],[o.statement_list,o.statement]],P.StatementList.pool),x.createProductionWithOptions(o.statement,[[o.compound_statement],[o.simple_statement]]),x.createProductionWithOptions(o.compound_statement_no_scope,[[h.LEFT_BRACE,h.RIGHT_BRACE],[h.LEFT_BRACE,o.statement_list,h.RIGHT_BRACE]],P.CompoundStatementNoScope.pool),x.createProductionWithOptions(o.compound_statement,[[h.LEFT_BRACE,h.RIGHT_BRACE],[o.scope_brace,o.statement_list,o.scope_end_brace]]),x.createProductionWithOptions(o.simple_statement,[[o.declaration],[o.expression_statement],[o.selection_statement],[o.iteration_statement],[o.jump_statement],[o.macro_if_statement],[o.macro_undef],[o.macro_define],[a.MACRO_DEFINE_EXPRESSION]]),x.createProductionWithOptions(o.declaration,[[o.function_prototype,h.SEMICOLON],[o.init_declarator_list,h.SEMICOLON],[a.PRECISION,o.precision_qualifier,o.ext_builtin_type_specifier_nonarray,h.SEMICOLON],[o.type_qualifier,h.ID,h.SEMICOLON],[o.type_qualifier,h.ID,o.identifier_list,h.SEMICOLON]],P.Declaration.pool),x.createProductionWithOptions(o.identifier_list,[[h.COMMA,h.ID],[o.identifier_list,h.COMMA,h.ID]],P.IdentifierList.pool),x.createProductionWithOptions(o.init_declarator_list,[[o.single_declaration],[o.init_declarator_list,h.COMMA,h.ID],[o.init_declarator_list,h.COMMA,h.ID,o.array_specifier],[o.init_declarator_list,h.COMMA,h.ID,o.array_specifier,h.EQUAL,o.initializer],[o.init_declarator_list,h.COMMA,h.ID,h.EQUAL,o.initializer]],P.InitDeclaratorList.pool),x.createProductionWithOptions(o.single_declaration,[[o.fully_specified_type,h.ID],[o.fully_specified_type,h.ID,o.array_specifier],[o.fully_specified_type,h.ID,o.array_specifier,h.EQUAL,o.initializer],[o.fully_specified_type,h.ID,h.EQUAL,o.initializer],[o.fully_specified_type,a.MACRO_CALL],[o.fully_specified_type,a.MACRO_CALL,h.EQUAL,o.initializer]],P.SingleDeclaration.pool),x.createProductionWithOptions(o.initializer,[[o.assignment_expression],[h.LEFT_BRACE,o.initializer_list,h.RIGHT_BRACE]]),x.createProductionWithOptions(o.initializer_list,[[o.initializer],[o.initializer_list,h.COMMA,o.initializer]]),x.createProductionWithOptions(o.expression_statement,[[h.SEMICOLON],[o.expression,h.SEMICOLON]]),x.createProductionWithOptions(o.selection_statement,[[a.IF,h.LEFT_PAREN,o.expression,h.RIGHT_PAREN,o.statement],[a.IF,h.LEFT_PAREN,o.expression,h.RIGHT_PAREN,o.statement,a.ELSE,o.statement]]),x.createProductionWithOptions(o.iteration_statement,[[a.WHILE,h.LEFT_PAREN,o.condition,h.RIGHT_PAREN,o.statement],[a.FOR,h.LEFT_PAREN,o.for_init_statement,o.for_rest_statement,h.RIGHT_PAREN,o.statement]]),x.createProductionWithOptions(o.precision_specifier,[[a.PRECISION,o.precision_qualifier,o.ext_builtin_type_specifier_nonarray,h.SEMICOLON]],P.PrecisionSpecifier.pool),x.createProductionWithOptions(o.for_init_statement,[[o.expression_statement],[o.declaration]]),x.createProductionWithOptions(o.condition,[[o.expression],[o.fully_specified_type,h.ID,h.EQUAL,o.initializer]]),x.createProductionWithOptions(o.for_rest_statement,[[o.conditionopt,h.SEMICOLON],[o.conditionopt,h.SEMICOLON,o.expression]]),x.createProductionWithOptions(o.conditionopt,[[h.EPSILON],[o.condition]]),x.createProductionWithOptions(o.jump_statement,[[a.CONTINUE,h.SEMICOLON],[a.BREAK,h.SEMICOLON],[a.RETURN,h.SEMICOLON],[a.RETURN,o.expression,h.SEMICOLON],[a.DISCARD,h.SEMICOLON]],P.JumpStatement.pool),x.createProductionWithOptions(o.scope_brace,[[h.LEFT_BRACE]],P.ScopeBrace.pool),x.createProductionWithOptions(o.scope_end_brace,[[h.RIGHT_BRACE]],P.ScopeEndBrace.pool),x.createProductionWithOptions(o.variable_identifier,[[h.ID],[o.macro_call_symbol],[o.macro_call_function]],P.VariableIdentifier.pool),x.createProductionWithOptions(o.macro_if_statement,[[o.macro_push_context,o.statement_list,o.macro_branch],[o.macro_push_context,o.macro_branch]],P.MacroIfStatement.pool),x.createProductionWithOptions(o.macro_branch,[[o.macro_pop_context],[o.macro_elif_expression,o.statement_list,o.macro_branch],[o.macro_else_expression,o.statement_list,o.macro_pop_context],[o.macro_elif_expression,o.macro_branch],[o.macro_else_expression,o.macro_pop_context]],P.MacroBranch.pool)),Oi=function(){return Ii.create(o.gs_shader_program,$t.map(function(e){return e[0]}))},Pi=function(e){for(var c=0;c<$t.length;c++){var i=$t[c][1];i&&e.addTranslationRule(c,i)}},Mi=function(){function e(i,t,r){this._traceBackStack=[],this.actionTable=i,this.gotoTable=t,this.grammar=r,this.sematicAnalyzer=new dt}var c=e.prototype;return c.parse=function(t,r){this.sematicAnalyzer.reset(r);var n=this,s=n._traceBackStack,l=n.sematicAnalyzer;s.push(0);for(var u=t.next();;){var _=u.value,S=this.stateActionTable.get(_.type);if((S==null?void 0:S.action)===Pe.Shift){if(s.push(_,S.target),_.type===a.MACRO_DEFINE_PARAMS){l.pushScope();for(var E=Y(Be.parseMacroParamList(_.lexeme)),O;!(O=E()).done;){var M=O.value;l.symbolTableStack.insert(new Te(M,oe.VAR))}}u=t.next()}else{if((S==null?void 0:S.action)===Pe.Accept)return l.acceptRule==null||l.acceptRule.call(l,l),l.semanticStack.pop();if((S==null?void 0:S.action)===Pe.Reduce){for(var y=S.target,I=this.grammar.getProductionByID(y),V=l.getTranslationRule(I.id),k=[],N=I.derivation.length-1;N>=0;N--)if(I.derivation[N]!==h.EPSILON){s.pop();var W=s.pop();if(R(W,w))k.unshift(W);else{var U=l.semanticStack.pop();k.unshift(U)}}V==null||V.apply(void 0,[].concat([l],k));var j=this.stateGotoTable;s.push(I.goal);var X=j==null?void 0:j.get(I.goal);s.push(X);continue}else return xe.createGSError("Unexpected token "+_.lexeme,He.CompilationError,Ce._processingPassText,_.location),null}}},e.create=function(){if(!this._singleton){var t=Oi(),r=new yi(t);r.generate(),this._singleton=new e(r.actionTable,r.gotoTable,t),Pi(this._singleton.sematicAnalyzer)}return this._singleton},be(e,[{key:"curState",get:function(){return this._traceBackStack[this._traceBackStack.length-1]}},{key:"stateActionTable",get:function(){return this.actionTable.get(this.curState)}},{key:"stateGotoTable",get:function(){return this.gotoTable.get(this.curState)}}]),e}(),Ri="shaders://root/",xr=function(){function e(){}return e.parse=function(i,t,r,n){var s=this;return i.replace(this._includeReg,function(l,u){return u?s._replace(u,t,r,n):l})},e._replace=function(i,t,r,n){var s;i[0]==="."?s=new URL(i,t).href.substring(Ri.length):s=i;var l=r[s];if(!l)return console.error('Shader slice "'+s+'" not founded.'),"";var u=n.get(s);return u===void 0&&(u=this.parse(l,t,r,n),n.set(s,u)),u},e}();xr._includeReg=/\/\*[\s\S]*?\*\/|^[ \t]*#include +"([\w\d./]+)"/gm;function Ge(){return Ge=Object.assign||function(c){for(var i=1;i<arguments.length;i++){var t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(c[r]=t[r])}return c},Ge.apply(this,arguments)}var Ze=function(){function e(){}return e.createRenderStates=function(){return{constantMap:{},variableMap:{}}},e.createShaderSource=function(i){return{name:i,subShaders:[],pendingContents:[],renderStates:this.createRenderStates()}},e.createSubShaderSource=function(i){return{name:i,passes:[],pendingContents:[],tags:{},renderStates:this.createRenderStates()}},e.createShaderPassSource=function(i){return{name:i,pendingContents:[],tags:{},renderStates:this.createRenderStates()}},e.createUsePass=function(i){return{name:i,pendingContents:[],isUsePass:!0,tags:{},renderStates:this.createRenderStates()}},e}(),_t=function(){function e(i,t,r){this.ident=i,this.type=t,this.value=r,this.isInMacroBranch=!1}var c=e.prototype;return c.set=function(t,r,n){this.ident=t,this.type=r,this.value=n},c.equal=function(t){return this.type===t.type},e}(),Zt=function(e){D(c,e);function c(){var t;return t=e.apply(this,arguments)||this,t.hasPendingContent=!1,t}var i=c.prototype;return i.scanNumber=function(){this.skipCommentsAndSpace();var r=this._currentIndex,n=this._source,s=this._currentIndex;return s=c._scanDigits(n,s),n[s]==="."&&(s=c._scanDigits(n,s+1)),this.advance(s-this._currentIndex),Number(n.substring(r,s))},i.scanColor=function(){this.scanLexeme("(");var r=0,n=0,s=0,l=1;return r=this.scanNumber(),this.skipCommentsAndSpace(),this.peek(1)!==")"&&(this.scanLexeme(","),n=this.scanNumber(),this.skipCommentsAndSpace(),this.peek(1)!==")"&&(this.scanLexeme(","),s=this.scanNumber(),this.skipCommentsAndSpace(),this.peek(1)!==")"&&(this.scanLexeme(","),l=this.scanNumber(),this.skipCommentsAndSpace()))),this.scanLexeme(")"),new Ke(r,n,s,l)},i.scanToken=function(){for(;;){if(this.skipCommentsAndSpace(),this.isEnd())return;var r=this.getShaderPosition(0);if(ee.isAlpha(this.getCurCharCode())){var n=this._scanWord(r);if(n!==null)return n;this.hasPendingContent=!0;continue}var s=this.getCurChar(),l=c._symbolLexemeTable[s];if(l!==void 0){this.advance(1);var u=w.pool.get();return u.set(l,s,r),u}this.advance(1)}},i.createCompileError=function(r,n){return xe.createGSError(r,He.CompilationError,this.source,n??this.getShaderPosition(0))},i._scanWord=function(r){for(;ee.isAlnum(this.getCurCharCode())&&!this.isEnd();)this.advance(1);var n=this.getShaderPosition(0);if(!this._validateWordBoundaries(r.index,n.index))return null;var s=this._source.substring(r.index,n.index),l,u=(l=c._keywordLexemeTable[s])!=null?l:h.ID,_=Ce.createRange(r,n),S=w.pool.get();return S.set(u,s,_),S},i._validateWordBoundaries=function(r,n){var s=this._source;if(r>0){var l=s.charCodeAt(r-1);if(!this._isValidWordBoundary(l))return!1}if(n<s.length){var u=s.charCodeAt(n);if(!this._isValidWordBoundary(u))return!1}return!0},i._isValidWordBoundary=function(r){return ee.isWhiteSpaceChar(r,!0)||c._isWordSeparatorChar(r)},c._isWordSeparatorChar=function(r){return r===123||r===125||r===61||r===59||r===46||r===91||r===40||r===124},c._scanDigits=function(r,n){for(var s=n;s<r.length;){var l=r.charCodeAt(s);if(ee.isDigit(l))s++;else break}return s},c}(ee);Zt._keywordLexemeTable={RenderQueueType:a.GSRenderQueueType,BlendState:a.GSBlendState,DepthState:a.GSDepthState,StencilState:a.GSStencilState,RasterState:a.GSRasterState,EditorProperties:a.GSEditorProperties,EditorMacros:a.GSEditorMacros,Editor:a.GSEditor,Tags:a.GSTags,VertexShader:a.GSVertexShader,FragmentShader:a.GSFragmentShader,SubShader:a.GSSubShader,Pass:a.GSPass,BlendFactor:a.GSBlendFactor,BlendOperation:a.GSBlendOperation,Bool:a.GSBool,Number:a.GSNumber,Color:a.GSColor,CompareFunction:a.GSCompareFunction,StencilOperation:a.GSStencilOperation,CullMode:a.GSCullMode,ColorWriteMask:a.GSColorWriteMask,UsePass:a.GSUsePass,true:a.True,false:a.False};Zt._symbolLexemeTable={"{":a.LeftBrace,"}":a.RightBrace,"=":a.Equal,"|":a.BitwiseOr};var je=function(){function e(){}return e.parse=function(i){this.errors.length=0,this._symbolTableStack.clear(),this._pushScope();var t=this._lexer;t.setSource(i);for(var r=this._parseShader(t),n=r.pendingContents,s=r.renderStates,l=0,u=r.subShaders.length;l<u;l++){var _=r.subShaders[l],S=n.concat(_.pendingContents),E={constantMap:Ge({},s.constantMap),variableMap:Ge({},s.variableMap)};this._mergeRenderStates(E,_.renderStates);for(var O=0,M=_.passes.length;O<M;O++){var y=_.passes[O],I={constantMap:Ge({},E.constantMap),variableMap:Ge({},E.variableMap)};if(this._mergeRenderStates(I,y.renderStates),y.renderStates=I,!y.isUsePass){var V=S.concat(y.pendingContents);y.contents=V.map(function(k){return k.content}).join(`
|
|
32
|
+
`)}}}return r},e._parseShader=function(i){i.scanLexeme("Shader");var t=i.scanPairedChar('"','"',!1,!1),r=Ze.createShaderSource(t);i.scanLexeme("{");var n=1;i.skipCommentsAndSpace();for(var s=i.getShaderPosition(0),l=r.pendingContents;;){var u=i.scanToken();switch(u.type){case a.GSSubShader:this._addPendingContents(s,u.lexeme.length,l);var _=this._parseSubShader();r.subShaders.push(_),s=i.getShaderPosition(0);break;case a.GSEditorProperties:case a.GSEditorMacros:case a.GSEditor:this._addPendingContents(s,u.lexeme.length,l),i.scanPairedChar("{","}",!0,!1),s=i.getShaderPosition(0);break;case a.LeftBrace:++n;break;case a.RightBrace:if(--n===0)return this._addPendingContents(s,u.lexeme.length,l),this._popScope(),r;break;default:s=this._parseRenderState(u,s,l,r.renderStates)}}},e._parseRenderStateDeclarationOrAssignment=function(i,t){var r=this._lexer,n=r.scanToken();if(n.type===h.ID){r.scanLexeme("{");var s=this._parseRenderStateProperties(t.lexeme),l=new _t(n.lexeme,t.type,s);this._symbolTableStack.insert(l)}else if(n.lexeme==="="){var u=r.scanToken(),_;if(u.lexeme==="{")_=this._parseRenderStateProperties(t.lexeme);else{r.scanLexeme(";");var S=this._lookupSymbol;S.set(u.lexeme,t.type);var E=this._symbolTableStack.lookup(S);E!=null&&E.value||this._createCompileError('Invalid "'+t.lexeme+'" variable: '+u.lexeme,u.location),_=E.value}this._mergeRenderStates(i,_)}},e._mergeRenderStates=function(i,t){var r=i.constantMap,n=i.variableMap,s=t.constantMap,l=t.variableMap;for(var u in s)delete n[u],r[u]=s[u];for(var _ in l)delete r[_],n[_]=l[_]},e._parseVariableDeclaration=function(){var i=this._lexer,t=i.scanToken();i.scanLexeme(";");var r=new _t(t.lexeme,t.type);this._symbolTableStack.insert(r)},e._pushScope=function(){var i=new Ar;this._symbolTableStack.pushScope(i)},e._popScope=function(){this._symbolTableStack.popScope()},e._parseRenderStateProperties=function(i){for(var t=this._lexer,r=Ze.createRenderStates();t.getCurChar()!=="}";)this._parseRenderStateProperty(i,r),t.skipCommentsAndSpace();return t.advance(1),r},e._createCompileError=function(i,t){this._lexer.createCompileError(i,t)},e._scanEnumConstValue=function(i){var t,r=this._lexer;r.advance(1);var n=r.scanToken(),s=(t=this._renderStateConstMap[i])==null?void 0:t[n.lexeme];return s==null&&this._createCompileError("Invalid engine constant: "+i+"."+n.lexeme,n.location),s},e._parseRenderStateProperty=function(i,t){var r=this._lexer,n=r.scanToken(),s=n.lexeme,l=s;if(i==="BlendState"&&s!=="BlendColor"&&s!=="AlphaToCoverage"){var u=0,_=r.scanTwoExpectedLexemes("[","=");_==="["?(u=r.scanNumber(),r.scanLexeme("]"),r.scanLexeme("=")):_!=="="&&this._createCompileError("Invalid syntax, expect '[' or '=', but got unexpected token"),l+=u}else r.scanLexeme("=");var S=rr[i+l];S===void 0&&this._createCompileError("Invalid render state property "+s),r.skipCommentsAndSpace();var E,O=r.getCurCharCode();if(ee.isDigit(O)||O===46)E=r.scanNumber();else{var M=r.scanToken(),y=M.type;if(y===a.True)E=!0;else if(y===a.False)E=!1;else if(y===a.GSColor)E=r.scanColor();else if(r.getCurChar()==="."){if(E=this._scanEnumConstValue(M.lexeme),E==null)return;if(r.skipCommentsAndSpace(),r.getCurChar()==="|"){if(M.lexeme!=="ColorWriteMask"){this._createCompileError("Bitwise OR '|' is not supported for '"+M.lexeme+"', only bitmask enums like 'ColorWriteMask' support this",M.location);return}for(;r.getCurChar()==="|";){r.advance(1);var I=r.scanToken();if(I==null||r.getCurChar()!=="."){this._createCompileError("Invalid syntax after '|', expect 'EnumType.Value'",I==null?void 0:I.location);return}if(I.lexeme!==M.lexeme){this._createCompileError("Cannot mix enum types in bitwise OR: expected '"+M.lexeme+"' but got '"+I.lexeme+"'",I.location);return}var V=this._scanEnumConstValue(I.lexeme);if(V==null)return;E=E|V,r.skipCommentsAndSpace()}}}else{E=M.lexeme;var k=this._lookupSymbol;k.set(M.lexeme,h.ID),this._symbolTableStack.lookup(k)||this._createCompileError("Invalid "+i+" variable: "+M.lexeme,M.location)}}r.scanLexeme(";"),typeof E=="string"?t.variableMap[S]=E:t.constantMap[S]=E},e._parseRenderQueueDeclarationOrAssignment=function(i){var t=this._lexer,r=t.scanToken();if(r.type===h.ID){t.scanLexeme(";");var n=new _t(r.lexeme,a.GSRenderQueueType);this._symbolTableStack.insert(n);return}r.lexeme!=="="&&this._createCompileError("Invalid syntax, expect character '=', but got "+r.lexeme,r.location);var s=t.scanToken();t.scanLexeme(";");var l=this._renderStateConstMap.RenderQueueType[s.lexeme],u=rr.RenderQueueType;if(l==null){i.variableMap[u]=s.lexeme;var _=this._lookupSymbol;_.set(s.lexeme,a.GSRenderQueueType);var S=this._symbolTableStack.lookup(_);S||this._createCompileError("Invalid RenderQueueType variable: "+s.lexeme,s.location)}else i.constantMap[u]=l},e._addPendingContents=function(i,t,r){var n=this._lexer;if(n.hasPendingContent){var s=n.currentIndex-t;r.push({range:{start:i,end:Ge({},n.getShaderPosition(0),{index:s-1})},content:n.source.substring(i.index,s-1)}),n.hasPendingContent=!1}},e._parseSubShader=function(){var i=this._lexer;this._pushScope();var t=1,r=i.scanPairedChar('"','"',!1,!1),n=Ze.createSubShaderSource(r);i.scanLexeme("{"),i.skipCommentsAndSpace();for(var s=i.getShaderPosition(0);;){var l=i.scanToken();switch(l.type){case a.GSPass:this._addPendingContents(s,l.lexeme.length,n.pendingContents);var u=this._parsePass();n.passes.push(u),s=i.getShaderPosition(0);break;case a.GSUsePass:this._addPendingContents(s,l.lexeme.length,n.pendingContents);var _=i.scanPairedChar('"','"',!1,!1);n.passes.push(Ze.createUsePass(_)),s=i.getShaderPosition(0);break;case a.LeftBrace:++t;break;case a.RightBrace:if(--t===0)return this._addPendingContents(s,l.lexeme.length,n.pendingContents),this._popScope(),n;break;default:s=this._parseRenderStateAndTags(l,s,n.pendingContents,n.renderStates,n.tags)}}},e._parseTags=function(i){var t=this._lexer;for(t.scanLexeme("{");;){var r=t.scanToken();t.scanLexeme("=");var n=t.scanPairedChar('"','"',!1,!1);if(t.skipCommentsAndSpace(),i[r.lexeme]=n,t.peek(1)==="}"){t.advance(1);return}t.scanLexeme(",")}},e._parsePass=function(){this._pushScope();var i=this._lexer,t=i.scanPairedChar('"','"',!1,!1),r=Ze.createShaderPassSource(t);i.scanLexeme("{");var n=1;i.skipCommentsAndSpace();for(var s=i.getShaderPosition(0);;){var l=i.scanToken();switch(l.type){case a.GSVertexShader:case a.GSFragmentShader:this._addPendingContents(s,l.lexeme.length,r.pendingContents),i.scanLexeme("=");var u=i.scanToken();r[l.lexeme]&&xe.createGSError("Reassign main entry",He.CompilationError,i.source,i.getShaderPosition(0));var _=l.type===a.GSVertexShader?"vertexEntry":"fragmentEntry";r[_]=u.lexeme,i.scanLexeme(";"),s=i.getShaderPosition(0);break;case a.LeftBrace:++n;break;case a.RightBrace:if(--n===0)return this._addPendingContents(s,l.lexeme.length,r.pendingContents),this._popScope(),r;break;default:s=this._parseRenderStateAndTags(l,s,r.pendingContents,r.renderStates,r.tags)}}},e._parseRenderStateAndTags=function(i,t,r,n,s){switch(i.type){case a.GSTags:this._addPendingContents(t,i.lexeme.length,r),this._parseTags(s),t=this._lexer.getShaderPosition(0);break;default:t=this._parseRenderState(i,t,r,n)}return t},e._parseRenderState=function(i,t,r,n){switch(i.type){case a.GSBlendState:case a.GSDepthState:case a.GSRasterState:case a.GSStencilState:this._addPendingContents(t,i.lexeme.length,r),this._parseRenderStateDeclarationOrAssignment(n,i),t=this._lexer.getShaderPosition(0);break;case a.GSBlendFactor:case a.GSBlendOperation:case a.GSBool:case a.GSNumber:case a.GSColor:case a.GSCompareFunction:case a.GSStencilOperation:case a.GSCullMode:case a.GSColorWriteMask:this._addPendingContents(t,i.lexeme.length,r),this._parseVariableDeclaration(),t=this._lexer.getShaderPosition(0);break;case a.GSRenderQueueType:this._addPendingContents(t,i.lexeme.length,r),this._parseRenderQueueDeclarationOrAssignment(n),t=this._lexer.getShaderPosition(0);break;default:this._lexer.hasPendingContent=!0}return t},e}();je.errors=new Array;je._renderStateConstMap={RenderQueueType:kr,CompareFunction:Ur,StencilOperation:Wr,BlendOperation:Nr,BlendFactor:zr,CullMode:Hr,ColorWriteMask:jr};je._symbolTableStack=new Er;je._lexer=new Zt;je._lookupSymbol=new _t("",null);var Ce=function(){function e(){this._includeMap={},this._chunkOutputCache=new Map}var c=e.prototype;return c._setIncludeMap=function(t){this._includeMap=t,this._chunkOutputCache.clear()},c._parseShaderSource=function(t){xe.clearAllShaderCompilerObjectPool();var r=je.parse(t);return r},c._parseShaderPass=function(t,r,n,s,l){var u={},_=xr.parse(t,l,this._includeMap,this._chunkOutputCache),S=new rt(_,u),E=S.tokenize(),O=e._parser;e._processingPassText=_;var M=O.parse(E,u);if(M){var y=s===Tr.GLSLES100?bi.getVisitor():xi.getVisitor(),I=y.visitShaderProgram(M,r,n);return e._processingPassText=void 0,I&&(I.vertexShaderInstructions=vt.parse(I.vertex),I.fragmentShaderInstructions=vt.parse(I.fragment)),I}},c._precompile=function(t,r,n){var s=this,l=this._parseShaderSource(t),u=l.subShaders.map(function(_){return{name:_.name,tags:_.tags,passes:_.passes.map(function(S){if(S.isUsePass)return{name:S.name,isUsePass:!0,tags:S.tags,renderStates:s._serializeRenderStates(S.renderStates)};var E=s._parseShaderPass(S.contents,S.vertexEntry,S.fragmentEntry,r,n);if(!E)throw new Error('Shader pass "'+l.name+"."+_.name+"."+S.name+'" precompile failed, please check the shader source code.');return{name:S.name,isUsePass:!1,tags:S.tags,renderStates:s._serializeRenderStates(S.renderStates),vertexShaderInstructions:E.vertexShaderInstructions,fragmentShaderInstructions:E.fragmentShaderInstructions}})}});return{name:l.name,platformTarget:r,subShaders:u}},c._serializeRenderStates=function(t){var r={};for(var n in t.constantMap){var s=t.constantMap[n];R(s,Ke)?r[n]=[s.r,s.g,s.b,s.a]:r[n]=s}return{constantMap:r,variableMap:t.variableMap}},e.createPosition=function(t,r,n){var s=this._shaderPositionPool.get();return s.set(t),s},e.createRange=function(t,r){var n=this._shaderRangePool.get();return n.set(t,r),n},e}();Ce._parser=Mi.create();Ce._shaderPositionPool=xe.createObjectPool(Sr);Ce._shaderRangePool=xe.createObjectPool(mr);var Li="2.0.0-alpha.33",Di="Release";console.log("Galacean Engine Shader Compiler Version: "+Li+" | Mode: "+Di);const yr=new Set(["material_OcclusionTextureCoord"]);function Vi(e){return yr.has(e)}function Fi(e,c){return c&&yr.has(c)?de.Float:(e.split(":")[1]??"").includes(".")?de.Float:de.Integer}const Fe=e=>{var c;return((c=dr.find(i=>i.path===e))==null?void 0:c.source)??""},Gi={PBR:Fe("Shaders/PBR.shader"),Unlit:Fe("Shaders/Unlit.shader"),BlinnPhong:Fe("Shaders/BlinnPhong.shader"),"Effect/Particle":Fe("Shaders/Effect/Particle.shader"),"Effect/Trail":Fe("Shaders/Effect/Trail.shader"),"Sky/Skybox":Fe("Shaders/Sky/Skybox.shader"),"Sky/SkyProcedural":Fe("Shaders/Sky/SkyProcedural.shader")},Ir={PBR:Re.PbrUIScript,Unlit:Re.UnlitUIScript,BlinnPhong:Re.BlinnPhongUIScript,"Effect/Particle":Re.ParticleTrailUIScript,"Effect/Trail":Re.ParticleTrailUIScript,"Sky/SkyProcedural":Re.SkyProceduralUIScript},Or=new Map;let Ht=null;async function Bi(e){const c=ci[e],t=(await qr.build({stdin:{contents:c,loader:"ts"},bundle:!0,format:"esm",write:!1,plugins:[li({"@galacean/engine":{varName:"Galacean",type:"cjs"}})]})).outputFiles[0],r=await ui(t.contents);return new r.default}async function Ti(){const e=new Set(Object.values(Ir));await Promise.all(Array.from(e).map(async c=>{try{const i=await Bi(c);Or.set(c,i)}catch(i){console.error(`Failed to compile builtin UIScript: ${c}`,i)}}))}async function ki(e){Ht||(Ht=e.then(()=>Ti())),await Ht}function Ui(e){const c=Ir[e];if(c)return Or.get(c)}Xr(_i,{variants:{checked:{true:{color:"$green10"}}}});const Wi=wr(e=>{const{asset:c}=e;if(c.compileError)return Je.jsx(di,{label:ht("shader.inspector.compile-error"),value:c.compileError});const i=[],t={};for(const r of c.properties??[]){const{uiInfo:n}=r;if(!n||n.hide)continue;const s=n.assetType??n.type,l={label:n.label,type:ue.PureDisplay,disabled:!0,value:r.bundleType==="macro"?"MACRO":s,property:r.prop};if(n.group){const u=t[r.uiInfo.group]??{children:[],type:ue.Group,property:n.group};u.children.push(l),t[n.group]=u}else i.push(l)}for(const r in t)i.push(t[r]);return Je.jsxs(Je.Fragment,{children:[Je.jsx(Qr,{inspectorConfig:{property:ht("shader.inspector.properties"),type:ue.Group,children:i},onModelChange:null,model:c},"Properties"),c.shaderScriptRefId&&Je.jsx(Yr.Item,{model:c,inspectorConfig:{label:ht("shader.inspector.included-ui-script"),type:ue.Display,disabled:!0,property:"uiScript",value:c.root.assetStore.assets[c.shaderScriptRefId.refId].getRouteString()},onModelChange:null})]})}),jt=e=>{var c;return((c=dr.find(i=>i.path===e))==null?void 0:c.source)??""},Ni={Unlit:{filename:"UnlitShader.shader",uiScriptTemplateType:Re.UnlitUIScript,uiScriptFileName:"UnlitScript.ts"},PBR:{filename:"PBRShader.shader",uiScriptTemplateType:Re.PbrUIScript,uiScriptFileName:"PBRScript.ts"},"2D/Sprite":{filename:"SpriteShader.shader"}};function _r(e,c){const i=`UIScript "${c}";`;if(/^\s*UIScript\s+"/m.test(e))return e.replace(/^(\s*)UIScript\s+"[^"]*"\s*;?\s*$/m,`$1${i}`);const t=e.match(/\bEditor\s*\{/);if(t){let n=0;for(let s=t.index;s<e.length;s++)if(e[s]==="{")n++;else if(e[s]==="}"&&(n--,n===0)){const l=e.lastIndexOf(`
|
|
33
33
|
`,t.index)+1,u=e.slice(l,t.index);return e.slice(0,s)+`
|
|
34
34
|
${u} ${i}
|
|
35
35
|
${u}`+e.slice(s)}}const r=e.match(/Shader\s+"[^"]*"\s*\{/);if(r){const n=r.index+r[0].length;return e.slice(0,n)+`
|
|
36
36
|
Editor {
|
|
37
37
|
${i}
|
|
38
38
|
}
|
|
39
|
-
`+e.slice(n)}return e}function qt(e,c,i){return e.replace(`Shader "${c}"`,`Shader "${i}"`)}function
|
|
39
|
+
`+e.slice(n)}return e}function qt(e,c,i){return e.replace(`Shader "${c}"`,`Shader "${i}"`)}function zi(e,c){switch(c.template){case"PBR":{const i=qt(jt("Shaders/PBR.shader"),"PBR",e);return _r(i,c.uiScriptPath)}case"Unlit":{const i=qt(jt("Shaders/Unlit.shader"),"Unlit",e);return _r(i,c.uiScriptPath)}case"2D/Sprite":return qt(jt("Shaders/2D/Sprite.shader"),"2D/Sprite",e)}}var Pr=Object.defineProperty,Hi=Object.getOwnPropertyDescriptor,ji=(e,c,i)=>c in e?Pr(e,c,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[c]=i,gt=(e,c,i,t)=>{for(var r=t>1?void 0:t?Hi(c,i):c,n=e.length-1,s;n>=0;n--)(s=e[n])&&(r=(t?s(c,i,r):s(r))||r);return t&&r&&Pr(c,i,r),r},qe=(e,c,i)=>(ji(e,typeof c!="symbol"?c+"":c,i),i),qi=(e=>(e.Color="Color",e.Vector4="Vector4",e.Vector3="Vector3",e.Vector2="Vector2",e.Int="Int",e.Float="Float",e.Range="Range",e.Texture2D="Texture2D",e.TextureCube="TextureCube",e.Boolean="Boolean",e.Null="Null",e.HDRColor="HDRColor",e))(qi||{});class et{constructor(c,i,t){Ae(this,"min");Ae(this,"max");Ae(this,"dragStep");this.min=c,this.max=i,this.dragStep=t}static create(c){const i=/Range\(\s*(.+?)\)/,t=c.match(i);if(!t)throw`invalid range type ${c}`;const r=t[1].split(",").map(Number);return new et(...r)}}class mt{constructor(c,i){this.data=c,this.type=i}static create(c,i){const r=c.slice(5,-1).split(",");let n=Fi(r[0],i);if(i&&!Vi(i)){const l=vr.getByName(i).type;l===ir.Int?n=de.Integer:l===ir.Float&&(n=de.Float)}const s=r.map(l=>{const[u,_]=l.split(":");return{label:u.trim(),value:Number(_)}});return new mt(s,n)}}let pe=class extends $r{constructor(c){super(c);Ae(this,"_shaderSource");Ae(this,"_shaderScriptRefId");Ae(this,"_builtinUIScript");Ae(this,"includePath");Ae(this,"builtinShaderName");Ae(this,"_compileError");Ae(this,"properties",[]);Ae(this,"_referencedMaterialList",[]);Jr(this)}get compileError(){return this._compileError}get shaderSource(){return this._shaderSource}get shaderScriptRefId(){return this._shaderScriptRefId}get builtinUIScript(){return this._builtinUIScript}async initByMeta(c){c.builtinShaderName&&(this.builtinShaderName=c.builtinShaderName,this.bindEngineObject(Nt.find(c.builtinShaderName))),await super.initByMeta(c),this.builtinShaderName&&(await ki(this.root.esbuildInstancePromise),this.updateCode(""))}addReferencedMaterial(c){this._referencedMaterialList.findIndex(i=>i.id===c.id)===-1&&this._referencedMaterialList.push(c)}removeReferencedMaterial(c){if(!this._referencedMaterialList)return;const i=this._referencedMaterialList.findIndex(t=>t.id===c.id);i!==-1&&this._referencedMaterialList.splice(i,1)}updateShaderSourceName(){this.includePath=this.getRouteString(),this._shaderSource=this._shaderSource.replace(/Shader\s+"[^"]*"\s*{/,`Shader "${this.includePath}" {`),this.updateCode(this._shaderSource),this.saveMainAndMeta()}async rename(c){await super.rename(c),this.updateShaderSourceName();for(const i of this._referencedMaterialList)this.root.assetFacade.persistAssetMain(i.id)}async moveTo(c){await this.moveViaFacade(c),this.updateShaderSourceName();for(const i of this._referencedMaterialList)this.root.assetFacade.persistAssetMain(i.id)}async initByMain(c,i){const t=await c.text();this.includePath=this.getRouteString();const r=Object.values(this.root.assetStore.assets).filter(n=>n.meta.type==="ShaderChunk"||n.meta.subType===or.ShaderUI);await Promise.all(r.map(n=>n.loadMainFilePromise?n.loadMainFilePromise:n.loadMainFile())),t&&this.updateCode(t)}canLoadWithoutMainFile(){return!!this.builtinShaderName}async initWithoutMainFile(){if(!this.builtinShaderName)return super.initWithoutMainFile();this.updateCode("")}async initByCreation(c,i,t){const r=t==null?void 0:t.template,n=Ni[r];n&&this.setNameByIncrease(n.filename);const{uiScriptTemplateType:s,uiScriptFileName:l}=n;let u;s&&(u=`./${(await this.root.assetFacade.createAssetByAdd({assetType:"script",params:{template:s,subType:or.ShaderUI},name:l,parentFolderId:this.parentFolderId})).name}`,window.Tracert.click("c351688.d418024",{type:"ShaderUIScript",source:"Shader"}));const _=this.getRouteString().replace(/^\//,"").replace(/\.shader$/,"");return this._shaderSource=zi(_,{template:t.template,uiScriptPath:u}),Promise.resolve(this.getMainData())}getMainData(){return this._shaderSource}isBuiltinShader(){return this.builtinShaderName}parseEditorModule(){if(pe._editorModuleRegex.test(this._shaderSource)){const c=this.extractPropertyContent("Editor");this.parseShaderScript(c);const i=this.extractPropertyContent("Properties",c);this.parseProperties(i);const t=this.extractPropertyContent("Macros",c);this.parseMacros(t)}else{const c=this.extractPropertyContent("EditorProperties");this.parseProperties(c);const i=this.extractPropertyContent("EditorMacros");this.parseMacros(i)}}parseProperties(c){if(!c)return;const i=c.split(`
|
|
40
40
|
`);let t,r;for(let n=0;n<i.length;n++){const s=i[n],l=s.trim();if(l.startsWith("/**")){r=r??{};let _="",S="default";const E=M=>{const y=M.match(pe._commentsLineRegex);if(y!=null&&y[1]){const I=y[1].match(pe._langSpecification);I!=null&&I[1]?S=I[1]:_+=y[1]+`
|
|
41
41
|
`}else _+=y?"":M+`
|
|
42
42
|
`};let O=l.substring(2);for(;!O.startsWith("*/");)E(O),O=i[++n].trim();r[S]=_;continue}const u=l.match(pe._groupRegex);u?t={type:u[1],title:u[2]}:s&&(this.parsePropertyItem(s,r,t),r=void 0),l.endsWith("}")&&(t=void 0)}}parseMacros(c){if(!c)return;const i=c.split(`
|
|
43
|
-
`);let t;for(const r of i){const n=r.trim(),s=n.match(pe._groupRegex);s?t={type:s[1],title:s[2]}:this.parseMacroItem(r,t),n.endsWith("}")&&(t=void 0)}}parseShaderScript(c){const i=c.match(pe._scriptRegex),t=i==null?void 0:i[1];if(t){const r=this.getRouteString(!1),n=
|
|
44
|
-
Not found shader script in ${t}`;return}this._shaderScriptRefId={refId:s.id}}else{const r=this._shaderScriptRefId;if(r){const n=this.root.assetStore.getAsset(r.refId);n==null||n.removeReferencedShader(this)}this._shaderScriptRefId=void 0}}extractPropertyContent(c,i){let t=0,r=-1,n=-1;const s=i??this._shaderSource;for(let l=0;l<s.length;l++)if(/\W/.test(s[l-1])&&s.substring(l,l+c.length)===c&&(r=l+c.length),!(r<0)){if(s[l]==="{")t++;else if(s[l]==="}"&&--t===0){n=l+1;break}}if(r>=0)return s.substring(r,n+1)}parseMacroItem(c,i){const t=/^\s*?(\[(On|Off)\])?\s*?(\w+)\(\s*?"([\u4e00-\u9fa5_a-zA-Z0-9\s]+)"\s*?(,\s*?(Range\(.+?\)|\w+))?\s*\)(\s*=\s*([^;]+))?/,r=c.match(t);if(r){const[n,s,l,u,_,S,E,O,M]=r;let y;E!=null&&E.trim().startsWith("Range(")?y=et.create(E):y=E??"Null";const I=this._shaderScriptRefId?this.root.assetStore.getAsset(this._shaderScriptRefId.refId):void 0,V=this._builtinUIScript,k=this.parsePropertyValueAndUIType(y,!0,M);if(k){const N={prop:u,defaultValue:k.defaultValue,bundleType:"macro",engineType:k.engineType,uiInfo:{label:_,group:i==null?void 0:i.title,...k.uiInfo},macroInfo:{checked:l?l==="On":void 0,switchable:!0,onSwitch:(W,U)=>{var Z;const j=U.engineObject.shaderData,X=((Z=U.extraData)==null?void 0:Z.disabledMacros)??[],q=X.indexOf(u)??-1;W?(j.enableMacro(u),q!==-1&&(X.splice(q,1),this.root.assetFacade.persistAssetMeta(U.id))):(j.disableMacro(u),q===-1&&(X.push(u),U.extraData.disabledMacros=X,this.root.assetFacade.persistAssetMeta(U.id)));const Q=(I==null?void 0:I.getMacroCallback(u))??(V==null?void 0:V._macroCallBacks.get(u));Q&&(Q(U.engineObject,W,void 0),U.refreshFormConfig(this.properties,U._getMainData()))}},onChange:async(W,U,j)=>{const X=(I==null?void 0:I.getMacroCallback(u))??(V==null?void 0:V._macroCallBacks.get(u));X&&(X(W.engineObject,j,j),W.refreshFormConfig(this.properties,W._getMainData())),W.engineObject.shaderData.enableMacro(u,j)}};this.properties.push(N)}}}parsePropertyItem(c,i,t){const r=/^\s*?(\w+)\(\s*?"([\u4e00-\u9fa5_a-zA-Z0-9\s]+)"\s*?,\s*?(\w+|Range\(.+?\)|Enum\([^()]+\))\s*\)(\s*=\s*([^;]+))?/,s=c.replace(/\/\/.*\n/,"").trim().match(r);if(s){const[l,u,_,S,E,O]=s;let M;S.startsWith("Range(")?M=et.create(S):S.startsWith("Enum(")?M=mt.create(S,u):M=S;const y=this._shaderScriptRefId?this.root.assetStore.getAsset(this._shaderScriptRefId.refId):void 0,I=this._builtinUIScript,V=this.parsePropertyValueAndUIType(M,!1,O);V&&this.properties.push({prop:u,defaultValue:V.defaultValue,onChange:async(k,N,W)=>{const U=(y==null?void 0:y.getPropertyCallback(N))??(I==null?void 0:I._propertyCallBacks.get(N));if(U){let j=W;W!=null&&W.refId&&(j=(await this.root.assetStore.getAssetByRef(W)).engineObject),U(k.engineObject,j),k.refreshFormConfig(this.properties,k._getMainData())}},uiInfo:{label:_,group:t==null?void 0:t.title,collapsible:(t==null?void 0:t.type)==="Collapsible",comments:i,...V.uiInfo},engineType:V.engineType})}}parsePropertyValueAndUIType(c,i,t){if(c instanceof et)return{defaultValue:t?Number(t):void 0,uiInfo:{type:ue.Slider,...c},engineType:de.Float};if(c instanceof mt)return{defaultValue:t?Number(t):void 0,uiInfo:{type:ue.Select,options:c.data},engineType:c.type};const r=n=>{var s;return(s=n.match(/\((.*?)\)/))==null?void 0:s[1]};switch(c){case"Color":return{defaultValue:t?new Ke(...r(t).split(",").map(Number)):new Ke,uiInfo:{type:ue.Color},engineType:de.Color};case"HDRColor":{const n=r(t).split(",").map(Number);return{defaultValue:t?{r:n[0],g:n[1],b:n[2],a:n[3],intensity:n[4]??Math.max(n[0],n[1],n[2],1)}:{r:0,g:0,b:0,a:1,intensity:1},uiInfo:{type:ue.Color,mode:"hdr"},engineType:de.Color}}case"Vector4":return{defaultValue:t?new sr(...r(t).split(",").map(Number)):new sr,uiInfo:{type:ue.Vector4},engineType:de.Vector4};case"Vector3":return{defaultValue:t?new nr(...r(t).split(",").map(Number)):new nr,uiInfo:{type:ue.Vector3},engineType:de.Vector3};case"Vector2":return{defaultValue:t?new ar(...r(t).split(",").map(Number)):new ar,uiInfo:{type:ue.Vector2},engineType:de.Vector2};case"Int":return{defaultValue:t?Number(t):0,uiInfo:{type:ue.Number},engineType:de.Integer};case"Float":return{defaultValue:t?Number(t):0,uiInfo:{type:ue.Number},engineType:de.Float};case"Texture2D":return{defaultValue:t,uiInfo:{type:ue.AssetPicker,assetType:"Texture",customFilter:n=>n.shape!=="Cube"},engineType:de.Texture};case"TextureCube":return{defaultValue:t,uiInfo:{type:ue.AssetPicker,assetType:"Texture",customFilter:n=>n.shape==="Cube"},engineType:de.Texture};case"Boolean":return{defaultValue:t==="true",uiInfo:{type:ue.Boolean},engineType:de.Boolean};case"Null":return{defaultValue:null,uiInfo:{type:ue.Null}};default:throw`not support type ${c}`}}onDoubleClick(){if(this.locked){
|
|
43
|
+
`);let t;for(const r of i){const n=r.trim(),s=n.match(pe._groupRegex);s?t={type:s[1],title:s[2]}:this.parseMacroItem(r,t),n.endsWith("}")&&(t=void 0)}}parseShaderScript(c){const i=c.match(pe._scriptRegex),t=i==null?void 0:i[1];if(t){const r=this.getRouteString(!1),n=Zr(r,t),s=pi.assetsMap.get(n);if(s){if(s.addReferencedShader(this),this._shaderScriptRefId){const l=this.root.assetStore.getAsset(this._shaderScriptRefId.refId);l==null||l.removeReferencedShader(this)}}else{this._compileError+=`
|
|
44
|
+
Not found shader script in ${t}`;return}this._shaderScriptRefId={refId:s.id}}else{const r=this._shaderScriptRefId;if(r){const n=this.root.assetStore.getAsset(r.refId);n==null||n.removeReferencedShader(this)}this._shaderScriptRefId=void 0}}extractPropertyContent(c,i){let t=0,r=-1,n=-1;const s=i??this._shaderSource;for(let l=0;l<s.length;l++)if(/\W/.test(s[l-1])&&s.substring(l,l+c.length)===c&&(r=l+c.length),!(r<0)){if(s[l]==="{")t++;else if(s[l]==="}"&&--t===0){n=l+1;break}}if(r>=0)return s.substring(r,n+1)}parseMacroItem(c,i){const t=/^\s*?(\[(On|Off)\])?\s*?(\w+)\(\s*?"([\u4e00-\u9fa5_a-zA-Z0-9\s]+)"\s*?(,\s*?(Range\(.+?\)|\w+))?\s*\)(\s*=\s*([^;]+))?/,r=c.match(t);if(r){const[n,s,l,u,_,S,E,O,M]=r;let y;E!=null&&E.trim().startsWith("Range(")?y=et.create(E):y=E??"Null";const I=this._shaderScriptRefId?this.root.assetStore.getAsset(this._shaderScriptRefId.refId):void 0,V=this._builtinUIScript,k=this.parsePropertyValueAndUIType(y,!0,M);if(k){const N={prop:u,defaultValue:k.defaultValue,bundleType:"macro",engineType:k.engineType,uiInfo:{label:_,group:i==null?void 0:i.title,...k.uiInfo},macroInfo:{checked:l?l==="On":void 0,switchable:!0,onSwitch:(W,U)=>{var Z;const j=U.engineObject.shaderData,X=((Z=U.extraData)==null?void 0:Z.disabledMacros)??[],q=X.indexOf(u)??-1;W?(j.enableMacro(u),q!==-1&&(X.splice(q,1),this.root.assetFacade.persistAssetMeta(U.id))):(j.disableMacro(u),q===-1&&(X.push(u),U.extraData.disabledMacros=X,this.root.assetFacade.persistAssetMeta(U.id)));const Q=(I==null?void 0:I.getMacroCallback(u))??(V==null?void 0:V._macroCallBacks.get(u));Q&&(Q(U.engineObject,W,void 0),U.refreshFormConfig(this.properties,U._getMainData()))}},onChange:async(W,U,j)=>{const X=(I==null?void 0:I.getMacroCallback(u))??(V==null?void 0:V._macroCallBacks.get(u));X&&(X(W.engineObject,j,j),W.refreshFormConfig(this.properties,W._getMainData())),W.engineObject.shaderData.enableMacro(u,j)}};this.properties.push(N)}}}parsePropertyItem(c,i,t){const r=/^\s*?(\w+)\(\s*?"([\u4e00-\u9fa5_a-zA-Z0-9\s]+)"\s*?,\s*?(\w+|Range\(.+?\)|Enum\([^()]+\))\s*\)(\s*=\s*([^;]+))?/,s=c.replace(/\/\/.*\n/,"").trim().match(r);if(s){const[l,u,_,S,E,O]=s;let M;S.startsWith("Range(")?M=et.create(S):S.startsWith("Enum(")?M=mt.create(S,u):M=S;const y=this._shaderScriptRefId?this.root.assetStore.getAsset(this._shaderScriptRefId.refId):void 0,I=this._builtinUIScript,V=this.parsePropertyValueAndUIType(M,!1,O);V&&this.properties.push({prop:u,defaultValue:V.defaultValue,onChange:async(k,N,W)=>{const U=(y==null?void 0:y.getPropertyCallback(N))??(I==null?void 0:I._propertyCallBacks.get(N));if(U){let j=W;W!=null&&W.refId&&(j=(await this.root.assetStore.getAssetByRef(W)).engineObject),U(k.engineObject,j),k.refreshFormConfig(this.properties,k._getMainData())}},uiInfo:{label:_,group:t==null?void 0:t.title,collapsible:(t==null?void 0:t.type)==="Collapsible",comments:i,...V.uiInfo},engineType:V.engineType})}}parsePropertyValueAndUIType(c,i,t){if(c instanceof et)return{defaultValue:t?Number(t):void 0,uiInfo:{type:ue.Slider,...c},engineType:de.Float};if(c instanceof mt)return{defaultValue:t?Number(t):void 0,uiInfo:{type:ue.Select,options:c.data},engineType:c.type};const r=n=>{var s;return(s=n.match(/\((.*?)\)/))==null?void 0:s[1]};switch(c){case"Color":return{defaultValue:t?new Ke(...r(t).split(",").map(Number)):new Ke,uiInfo:{type:ue.Color},engineType:de.Color};case"HDRColor":{const n=r(t).split(",").map(Number);return{defaultValue:t?{r:n[0],g:n[1],b:n[2],a:n[3],intensity:n[4]??Math.max(n[0],n[1],n[2],1)}:{r:0,g:0,b:0,a:1,intensity:1},uiInfo:{type:ue.Color,mode:"hdr"},engineType:de.Color}}case"Vector4":return{defaultValue:t?new sr(...r(t).split(",").map(Number)):new sr,uiInfo:{type:ue.Vector4},engineType:de.Vector4};case"Vector3":return{defaultValue:t?new nr(...r(t).split(",").map(Number)):new nr,uiInfo:{type:ue.Vector3},engineType:de.Vector3};case"Vector2":return{defaultValue:t?new ar(...r(t).split(",").map(Number)):new ar,uiInfo:{type:ue.Vector2},engineType:de.Vector2};case"Int":return{defaultValue:t?Number(t):0,uiInfo:{type:ue.Number},engineType:de.Integer};case"Float":return{defaultValue:t?Number(t):0,uiInfo:{type:ue.Number},engineType:de.Float};case"Texture2D":return{defaultValue:t,uiInfo:{type:ue.AssetPicker,assetType:"Texture",customFilter:n=>n.shape!=="Cube"},engineType:de.Texture};case"TextureCube":return{defaultValue:t,uiInfo:{type:ue.AssetPicker,assetType:"Texture",customFilter:n=>n.shape==="Cube"},engineType:de.Texture};case"Boolean":return{defaultValue:t==="true",uiInfo:{type:ue.Boolean},engineType:de.Boolean};case"Null":return{defaultValue:null,uiInfo:{type:ue.Null}};default:throw`not support type ${c}`}}onDoubleClick(){if(this.locked){Kr.error("Cannot edit internal Shader");return}hi(this,this.root,()=>{si(this.root.projectStore.id,this.id),oi()})}reCompile(){this.updateCode(this._shaderSource)}updateCode(c){var s;this._shaderSource=c,this._originMainFile=new File([c],this._name);const i=this.isBuiltinShader(),{properties:t}=this;let r;t?(r=Array.from(this.properties),this.properties.length=0):r=[];let n=[];if(i){this.bindEngineObject(Nt.find(i));const l=Gi[i];l&&(this._shaderSource=l,this._builtinUIScript=Ui(i),this.parseEditorModule())}else{(s=this.engineObject)==null||s.destroy(!0);const l=Nt.create(this._shaderSource,void 0,this.path);this.bindEngineObject(l),this._builtinUIScript=void 0,this.parseEditorModule();const u=this.properties;if(!u)n=r;else for(const _ of r)u.findIndex(E=>E.prop===_.prop)===-1&&n.push(_)}this.refreshMaterial(n)}destroy(){const c=this.root.assetStore.getAsset(pe.ErrorShaderRefId);for(const i of this._referencedMaterialList)i.bindShaderAsset(c),i.engineObject.shaderData.setColor("material_BaseColor",new Ke(1,0,1.01,1)),this.root.assetFacade.persistAssetMain(i.id);if(this.properties=null,this._referencedMaterialList=null,this.engineObject&&!this.isBuiltinShader()&&this.engineObject.destroy(!0),this._shaderScriptRefId){const i=this.root.assetStore.getAsset(this._shaderScriptRefId.refId);if(i){const t=i.referencedShaderList,r=t.findIndex(n=>n.id===this.id);r!==-1&&t.splice(r,1)}}super.destroy()}refreshMaterial(c){for(const i of this._referencedMaterialList)if(!i.engineObject.destroyed){if(c)for(const t of c){const{shaderData:r}=i.engineObject;if(t.bundleType==="macro")r.disableMacro(t.prop);else{const n=vr.getByName(t.prop);t==null||t.onChange(i,t.prop,void 0),fi(i,t.prop,void 0,t.engineType),delete r._propertyValueMap[n._uniqueId]}}i.applyBoundPathChange("shader",ue.AssetPicker,this.getCurrentRef()),i.bindShaderAsset(this,i._getMainData()).then(()=>{if(c)for(const t of c)for(const r of this._referencedMaterialList)r[t.prop]=void 0})}}};qe(pe,"ErrorShaderRefId","0000508");qe(pe,"_groupRegex",/\b(Header|Collapsible)\s*\(\s*"([\w\s]+)"\s*\)/);qe(pe,"_scriptRegex",/^\s*UIScript\s+"([\w./]+)"/m);qe(pe,"_editorModuleRegex",/\bEditor\s*{/);qe(pe,"_commentsLineRegex",/^\s*\*\s*(.*)?$/);qe(pe,"_langSpecification",/@language\s+(\w+)/);gt([ei()],pe.prototype,"builtinShaderName",2);gt([ti],pe.prototype,"_compileError",2);gt([ri],pe.prototype,"compileError",1);pe=gt([ii({type:"Shader",label:ht("asset.shader.title"),defaultName:"Shader.shader",icon:"shader",extname:"shader",importMenuConfig:{type:ai.Add},bundle({content:e,path:c},i,t){var u;const r=((u=t==null?void 0:t.getSharedShaderCompiler)==null?void 0:u.call(t))??new Ce;r._setIncludeMap(ni.includeMap);const n=new URL(c,"shaders://root/").href,s=vi(e,{basePathForIncludeKey:n,precompile:(_,S,E)=>r._precompile(_,S,E)}),l=c.split("/").pop().replace(/\.shader$/,".shaderc");return{content:new Blob([s],{type:"application/json"}),name:l}},customInspector:Wi})],pe);export{qi as E,Ni as S,et as a,mt as b,pe as c};
|