@uptimizr/dashboard 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +76 -0
  3. package/out/404.html +1 -0
  4. package/out/__next.__PAGE__.txt +9 -0
  5. package/out/__next._full.txt +20 -0
  6. package/out/__next._head.txt +6 -0
  7. package/out/__next._index.txt +5 -0
  8. package/out/__next._tree.txt +4 -0
  9. package/out/_next/static/93W3szqylNKDg-afLRmVW/_buildManifest.js +11 -0
  10. package/out/_next/static/93W3szqylNKDg-afLRmVW/_clientMiddlewareManifest.js +1 -0
  11. package/out/_next/static/93W3szqylNKDg-afLRmVW/_ssgManifest.js +1 -0
  12. package/out/_next/static/chunks/0-2y-_oomza2l.js +87 -0
  13. package/out/_next/static/chunks/00k_j_r7bv_eb.js +266 -0
  14. package/out/_next/static/chunks/00zdau6mcqeae.js +1 -0
  15. package/out/_next/static/chunks/023axeoslq39i.js +1 -0
  16. package/out/_next/static/chunks/068j6934u8j16.js +1 -0
  17. package/out/_next/static/chunks/0_rf76jneiwal.js +176 -0
  18. package/out/_next/static/chunks/0aznt7717miff.js +1 -0
  19. package/out/_next/static/chunks/0cu-q5q3a7uf3.js +1 -0
  20. package/out/_next/static/chunks/0cz1d0mv5g_q7.js +1 -0
  21. package/out/_next/static/chunks/0dm32-jq30tg8.js +1 -0
  22. package/out/_next/static/chunks/0dn0yx0rn6mpf.js +1 -0
  23. package/out/_next/static/chunks/0flc7nppbmsl1.js +3 -0
  24. package/out/_next/static/chunks/0fskcfh9vbhtv.js +1 -0
  25. package/out/_next/static/chunks/0gv7mblzv3dl3.js +87 -0
  26. package/out/_next/static/chunks/0impkpmxx3ttp.js +1 -0
  27. package/out/_next/static/chunks/0jmn7u31w95ly.js +91 -0
  28. package/out/_next/static/chunks/0n8n481szj90g.js +1 -0
  29. package/out/_next/static/chunks/0o6ayai0s01js.js +1 -0
  30. package/out/_next/static/chunks/0rys92_73hdb0.js +22 -0
  31. package/out/_next/static/chunks/0tl_moiyi2txt.js +1 -0
  32. package/out/_next/static/chunks/0tx1j_ghpz7rc.css +3 -0
  33. package/out/_next/static/chunks/0ufbyo1x3qkmo.js +1 -0
  34. package/out/_next/static/chunks/0v82oqyoy9zol.js +1 -0
  35. package/out/_next/static/chunks/0wrm9jr-9bw0e.js +1893 -0
  36. package/out/_next/static/chunks/0wwcfw8i3j_zx.js +1 -0
  37. package/out/_next/static/chunks/0ys9-ozuluawt.js +1 -0
  38. package/out/_next/static/chunks/1-61zh4waha61.js +1 -0
  39. package/out/_next/static/chunks/10r_824wzt8hj.js +1 -0
  40. package/out/_next/static/chunks/112hws17nz665.js +7 -0
  41. package/out/_next/static/chunks/123xxske5c9na.js +1 -0
  42. package/out/_next/static/chunks/13isnf0--pmx1.js +1 -0
  43. package/out/_next/static/chunks/157d9euci08yu.js +1 -0
  44. package/out/_next/static/chunks/15s7425ffrec9.js +3 -0
  45. package/out/_next/static/chunks/163fa70v4mgxj.js +1 -0
  46. package/out/_next/static/chunks/17q0c2h5ui10r.js +4 -0
  47. package/out/_next/static/chunks/18u58lorfahxi.js +4 -0
  48. package/out/_next/static/chunks/1_aahautsz2v_.js +1 -0
  49. package/out/_next/static/chunks/1a9l89j7e6mqu.js +23 -0
  50. package/out/_next/static/chunks/1dsy2ngmfflis.js +123 -0
  51. package/out/_next/static/chunks/1flb8adpj6_2o.js +62 -0
  52. package/out/_next/static/chunks/1lsg-22yob8dx.js +1 -0
  53. package/out/_next/static/chunks/1nj82er7msdto.js +2 -0
  54. package/out/_next/static/chunks/1o1d0p-v1z8ty.js +1 -0
  55. package/out/_next/static/chunks/1pdep2_c530sg.js +1 -0
  56. package/out/_next/static/chunks/1thjncpj7u6pq.js +1 -0
  57. package/out/_next/static/chunks/1vdjn0pkoyypn.js +1 -0
  58. package/out/_next/static/chunks/1yehxf-fmeicg.js +1 -0
  59. package/out/_next/static/chunks/1zvc1tv--w8nn.js +1 -0
  60. package/out/_next/static/chunks/1zx2q-r32thv1.js +4 -0
  61. package/out/_next/static/chunks/2-sjjedfr0kfq.js +1 -0
  62. package/out/_next/static/chunks/21o42k82w4llc.js +1 -0
  63. package/out/_next/static/chunks/25b9x-li-tvk2.js +1 -0
  64. package/out/_next/static/chunks/2712627rfsmwn.js +1 -0
  65. package/out/_next/static/chunks/296w2ke-v5tbm.js +9 -0
  66. package/out/_next/static/chunks/29tfeb6amdkjb.js +23 -0
  67. package/out/_next/static/chunks/2a3spdq-m8drh.js +3 -0
  68. package/out/_next/static/chunks/2aelw3far6rii.js +1 -0
  69. package/out/_next/static/chunks/2aor7m-wbis85.js +1 -0
  70. package/out/_next/static/chunks/2cbmf9m7lqv6k.js +4 -0
  71. package/out/_next/static/chunks/2d09v5u7dfq0q.js +1 -0
  72. package/out/_next/static/chunks/2feca0xcipcyt.js +850 -0
  73. package/out/_next/static/chunks/2fh-_9b6tqhvb.js +1 -0
  74. package/out/_next/static/chunks/2g5gecypj0rqe.js +1 -0
  75. package/out/_next/static/chunks/2kazjq29jeamx.js +1109 -0
  76. package/out/_next/static/chunks/2p2vv6cc9i-3q.js +255 -0
  77. package/out/_next/static/chunks/2szdcpl41-kzv.js +1 -0
  78. package/out/_next/static/chunks/2tws5udjdcmh3.js +1 -0
  79. package/out/_next/static/chunks/2u6shh3oeycm-.js +1 -0
  80. package/out/_next/static/chunks/2unhhuv0arlcv.js +1 -0
  81. package/out/_next/static/chunks/2xwy0-qfho1iz.js +91 -0
  82. package/out/_next/static/chunks/2ycvtdd68gub7.js +1 -0
  83. package/out/_next/static/chunks/2yiy_l8bwiw2_.js +3 -0
  84. package/out/_next/static/chunks/2yph6f7khgqii.js +1 -0
  85. package/out/_next/static/chunks/3-shckrcpvbxu.js +1681 -0
  86. package/out/_next/static/chunks/30fq_t9e2_fv-.js +1 -0
  87. package/out/_next/static/chunks/30yzu213bqtq0.js +5 -0
  88. package/out/_next/static/chunks/310uz81hnnzsu.js +1 -0
  89. package/out/_next/static/chunks/3218lp8l0a5g_.js +1 -0
  90. package/out/_next/static/chunks/35h5n42wxwgzk.js +123 -0
  91. package/out/_next/static/chunks/37vzwr3ciejf1.js +1 -0
  92. package/out/_next/static/chunks/38fhw7fatsyvd.js +3 -0
  93. package/out/_next/static/chunks/3be6s4_kn9q-o.js +1 -0
  94. package/out/_next/static/chunks/3i3gbhccmhu7j.js +210 -0
  95. package/out/_next/static/chunks/3l1dr_qm_x5kp.js +1 -0
  96. package/out/_next/static/chunks/3mqy-84_ul3t2.js +1 -0
  97. package/out/_next/static/chunks/3nz-dh9d7cehk.js +1 -0
  98. package/out/_next/static/chunks/3pufs8g4ui943.js +1 -0
  99. package/out/_next/static/chunks/3sjq_xoi4rbyg.js +31 -0
  100. package/out/_next/static/chunks/3t06schbtqonl.js +1 -0
  101. package/out/_next/static/chunks/3v3-7fio3nw_t.js +1 -0
  102. package/out/_next/static/chunks/3v5ha25nxo43j.js +1 -0
  103. package/out/_next/static/chunks/3yfrsm8lfi6ls.js +22 -0
  104. package/out/_next/static/chunks/3zskk1hxu3-_o.js +1 -0
  105. package/out/_next/static/chunks/turbopack-2ropzf0axp1x9.js +1 -0
  106. package/out/_next/static/media/0c89a48fa5027cee-s.p.2cyn07wtgehh0.woff2 +0 -0
  107. package/out/_next/static/media/13bf9871fe164e7f-s.2f7nqdagzwx2-.woff2 +0 -0
  108. package/out/_next/static/media/28868e710e86be81-s.2eksvhm1z0jwa.woff2 +0 -0
  109. package/out/_next/static/media/32687112bd2dd8db-s.1gepa_7fcx9fm.woff2 +0 -0
  110. package/out/_next/static/media/3fe682a82f50d426-s.0vfdmo25voy_0.woff2 +0 -0
  111. package/out/_next/static/media/70bc3e132a0a741e-s.p.3t6q91iet4nsy.woff2 +0 -0
  112. package/out/_next/static/media/71b036adf157cdcf-s.0bp8oijd_gu96.woff2 +0 -0
  113. package/out/_next/static/media/89b21bb081cb7469-s.1fby2rem9ngyr.woff2 +0 -0
  114. package/out/_next/static/media/cc545e633e20c56d-s.176arc174-8zp.woff2 +0 -0
  115. package/out/_next/static/media/icon.08h29dad3pcxg.svg +4 -0
  116. package/out/_not-found/__next._full.txt +16 -0
  117. package/out/_not-found/__next._head.txt +6 -0
  118. package/out/_not-found/__next._index.txt +5 -0
  119. package/out/_not-found/__next._not-found.__PAGE__.txt +5 -0
  120. package/out/_not-found/__next._not-found.txt +5 -0
  121. package/out/_not-found/__next._tree.txt +2 -0
  122. package/out/_not-found.html +1 -0
  123. package/out/_not-found.txt +16 -0
  124. package/out/api/projects +1 -0
  125. package/out/icon.svg +4 -0
  126. package/out/index.html +1 -0
  127. package/out/index.txt +20 -0
  128. package/out/logo.svg +46 -0
  129. package/package.json +67 -0
  130. package/server/standalone.mjs +182 -0
@@ -0,0 +1,255 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,45329,35011,e=>{"use strict";var t=e.i(12423);let r="bonesDeclaration",i=`#if NUM_BONE_INFLUENCERS>0
2
+ #ifndef USE_VERTEX_PULLING
3
+ attribute matricesIndices : vec4f;attribute matricesWeights : vec4f;
4
+ #if NUM_BONE_INFLUENCERS>4
5
+ attribute matricesIndicesExtra : vec4f;attribute matricesWeightsExtra : vec4f;
6
+ #endif
7
+ #endif
8
+ #ifndef BAKED_VERTEX_ANIMATION_TEXTURE
9
+ #ifdef BONETEXTURE
10
+ var boneSampler : texture_2d<f32>;uniform boneTextureInfo : vec2f;
11
+ #else
12
+ uniform mBones : array<mat4x4f,BonesPerMesh>;
13
+ #endif
14
+ #ifdef BONES_VELOCITY_ENABLED
15
+ uniform mPreviousBones : array<mat4x4f,BonesPerMesh>;
16
+ #endif
17
+ #ifdef BONETEXTURE
18
+ fn readMatrixFromRawSampler(smp : texture_2d<f32>,index : f32)->mat4x4f
19
+ {let offset=i32(index)*4;
20
+ let textureWidth=i32(uniforms.boneTextureInfo.x);let y=offset/textureWidth;let x=offset % textureWidth;let m0=textureLoad(smp,vec2<i32>(x+0,y),0);let m1=textureLoad(smp,vec2<i32>(x+1,y),0);let m2=textureLoad(smp,vec2<i32>(x+2,y),0);let m3=textureLoad(smp,vec2<i32>(x+3,y),0);return mat4x4f(m0,m1,m2,m3);}
21
+ #endif
22
+ #endif
23
+ #endif
24
+ `;t.ShaderStore.IncludesShadersStoreWGSL[r]||(t.ShaderStore.IncludesShadersStoreWGSL[r]=i),e.s(["bonesDeclarationWGSL",0,{name:r,shader:i}],45329);let n="bakedVertexAnimationDeclaration",a=`#ifdef BAKED_VERTEX_ANIMATION_TEXTURE
25
+ uniform bakedVertexAnimationTime: f32;uniform bakedVertexAnimationSettings: vec4<f32>;var bakedVertexAnimationTexture : texture_2d<f32>;
26
+ #ifdef INSTANCES
27
+ attribute bakedVertexAnimationSettingsInstanced : vec4<f32>;
28
+ #endif
29
+ fn readMatrixFromRawSamplerVAT(smp : texture_2d<f32>,index : f32,frame : f32)->mat4x4<f32>
30
+ {let offset=i32(index)*4;let frameUV=i32(frame);let m0=textureLoad(smp,vec2<i32>(offset+0,frameUV),0);let m1=textureLoad(smp,vec2<i32>(offset+1,frameUV),0);let m2=textureLoad(smp,vec2<i32>(offset+2,frameUV),0);let m3=textureLoad(smp,vec2<i32>(offset+3,frameUV),0);return mat4x4<f32>(m0,m1,m2,m3);}
31
+ #endif
32
+ `;t.ShaderStore.IncludesShadersStoreWGSL[n]||(t.ShaderStore.IncludesShadersStoreWGSL[n]=a),e.s(["bakedVertexAnimationDeclarationWGSL",0,{name:n,shader:a}],35011)},77785,75234,e=>{"use strict";var t=e.i(12423);let r="clipPlaneVertexDeclaration",i=`#ifdef CLIPPLANE
33
+ uniform vClipPlane: vec4<f32>;varying fClipDistance: f32;
34
+ #endif
35
+ #ifdef CLIPPLANE2
36
+ uniform vClipPlane2: vec4<f32>;varying fClipDistance2: f32;
37
+ #endif
38
+ #ifdef CLIPPLANE3
39
+ uniform vClipPlane3: vec4<f32>;varying fClipDistance3: f32;
40
+ #endif
41
+ #ifdef CLIPPLANE4
42
+ uniform vClipPlane4: vec4<f32>;varying fClipDistance4: f32;
43
+ #endif
44
+ #ifdef CLIPPLANE5
45
+ uniform vClipPlane5: vec4<f32>;varying fClipDistance5: f32;
46
+ #endif
47
+ #ifdef CLIPPLANE6
48
+ uniform vClipPlane6: vec4<f32>;varying fClipDistance6: f32;
49
+ #endif
50
+ `;t.ShaderStore.IncludesShadersStoreWGSL[r]||(t.ShaderStore.IncludesShadersStoreWGSL[r]=i),e.s(["clipPlaneVertexDeclarationWGSL",0,{name:r,shader:i}],77785);let n="fogVertexDeclaration",a=`#ifdef FOG
51
+ varying vFogDistance: vec3f;
52
+ #endif
53
+ `;t.ShaderStore.IncludesShadersStoreWGSL[n]||(t.ShaderStore.IncludesShadersStoreWGSL[n]=a),e.s(["fogVertexDeclarationWGSL",0,{name:n,shader:a}],75234)},18062,e=>{"use strict";var t=e.i(12423);let r="instancesDeclaration",i=`#ifdef INSTANCES
54
+ attribute world0 : vec4<f32>;attribute world1 : vec4<f32>;attribute world2 : vec4<f32>;attribute world3 : vec4<f32>;
55
+ #ifdef INSTANCESCOLOR
56
+ attribute instanceColor : vec4<f32>;
57
+ #endif
58
+ #if defined(THIN_INSTANCES) && !defined(WORLD_UBO)
59
+ uniform world : mat4x4<f32>;
60
+ #endif
61
+ #if defined(VELOCITY) || defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)
62
+ attribute previousWorld0 : vec4<f32>;attribute previousWorld1 : vec4<f32>;attribute previousWorld2 : vec4<f32>;attribute previousWorld3 : vec4<f32>;
63
+ #ifdef THIN_INSTANCES
64
+ uniform previousWorld : mat4x4<f32>;
65
+ #endif
66
+ #endif
67
+ #else
68
+ #if !defined(WORLD_UBO)
69
+ uniform world : mat4x4<f32>;
70
+ #endif
71
+ #if defined(VELOCITY) || defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)
72
+ uniform previousWorld : mat4x4<f32>;
73
+ #endif
74
+ #endif
75
+ `;t.ShaderStore.IncludesShadersStoreWGSL[r]||(t.ShaderStore.IncludesShadersStoreWGSL[r]=i),e.s(["instancesDeclarationWGSL",0,{name:r,shader:i}])},50331,3350,35845,3878,42893,8154,e=>{"use strict";var t=e.i(12423);let r="instancesVertex",i=`#ifdef INSTANCES
76
+ var finalWorld=mat4x4<f32>(vertexInputs.world0,vertexInputs.world1,vertexInputs.world2,vertexInputs.world3);
77
+ #if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)
78
+ var finalPreviousWorld=mat4x4<f32>(
79
+ vertexInputs.previousWorld0,vertexInputs.previousWorld1,
80
+ vertexInputs.previousWorld2,vertexInputs.previousWorld3);
81
+ #endif
82
+ #ifdef THIN_INSTANCES
83
+ #if !defined(WORLD_UBO)
84
+ finalWorld=uniforms.world*finalWorld;
85
+ #else
86
+ finalWorld=mesh.world*finalWorld;
87
+ #endif
88
+ #if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)
89
+ finalPreviousWorld=uniforms.previousWorld*finalPreviousWorld;
90
+ #endif
91
+ #endif
92
+ #else
93
+ #if !defined(WORLD_UBO)
94
+ var finalWorld=uniforms.world;
95
+ #else
96
+ var finalWorld=mesh.world;
97
+ #endif
98
+ #if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)
99
+ var finalPreviousWorld=uniforms.previousWorld;
100
+ #endif
101
+ #endif
102
+ `;t.ShaderStore.IncludesShadersStoreWGSL[r]||(t.ShaderStore.IncludesShadersStoreWGSL[r]=i),e.s(["instancesVertexWGSL",0,{name:r,shader:i}],50331);let n="bonesVertex",a=`#ifndef BAKED_VERTEX_ANIMATION_TEXTURE
103
+ #if NUM_BONE_INFLUENCERS>0
104
+ var influence : mat4x4<f32>;
105
+ #ifdef BONETEXTURE
106
+ influence=readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndices[0])*vertexInputs.matricesWeights[0];
107
+ #if NUM_BONE_INFLUENCERS>1
108
+ influence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndices[1])*vertexInputs.matricesWeights[1];
109
+ #endif
110
+ #if NUM_BONE_INFLUENCERS>2
111
+ influence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndices[2])*vertexInputs.matricesWeights[2];
112
+ #endif
113
+ #if NUM_BONE_INFLUENCERS>3
114
+ influence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndices[3])*vertexInputs.matricesWeights[3];
115
+ #endif
116
+ #if NUM_BONE_INFLUENCERS>4
117
+ influence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndicesExtra[0])*vertexInputs.matricesWeightsExtra[0];
118
+ #endif
119
+ #if NUM_BONE_INFLUENCERS>5
120
+ influence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndicesExtra[1])*vertexInputs.matricesWeightsExtra[1];
121
+ #endif
122
+ #if NUM_BONE_INFLUENCERS>6
123
+ influence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndicesExtra[2])*vertexInputs.matricesWeightsExtra[2];
124
+ #endif
125
+ #if NUM_BONE_INFLUENCERS>7
126
+ influence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndicesExtra[3])*vertexInputs.matricesWeightsExtra[3];
127
+ #endif
128
+ #else
129
+ influence=uniforms.mBones[i32(vertexInputs.matricesIndices[0])]*vertexInputs.matricesWeights[0];
130
+ #if NUM_BONE_INFLUENCERS>1
131
+ influence=influence+uniforms.mBones[i32(vertexInputs.matricesIndices[1])]*vertexInputs.matricesWeights[1];
132
+ #endif
133
+ #if NUM_BONE_INFLUENCERS>2
134
+ influence=influence+uniforms.mBones[i32(vertexInputs.matricesIndices[2])]*vertexInputs.matricesWeights[2];
135
+ #endif
136
+ #if NUM_BONE_INFLUENCERS>3
137
+ influence=influence+uniforms.mBones[i32(vertexInputs.matricesIndices[3])]*vertexInputs.matricesWeights[3];
138
+ #endif
139
+ #if NUM_BONE_INFLUENCERS>4
140
+ influence=influence+uniforms.mBones[i32(vertexInputs.matricesIndicesExtra[0])]*vertexInputs.matricesWeightsExtra[0];
141
+ #endif
142
+ #if NUM_BONE_INFLUENCERS>5
143
+ influence=influence+uniforms.mBones[i32(vertexInputs.matricesIndicesExtra[1])]*vertexInputs.matricesWeightsExtra[1];
144
+ #endif
145
+ #if NUM_BONE_INFLUENCERS>6
146
+ influence=influence+uniforms.mBones[i32(vertexInputs.matricesIndicesExtra[2])]*vertexInputs.matricesWeightsExtra[2];
147
+ #endif
148
+ #if NUM_BONE_INFLUENCERS>7
149
+ influence=influence+uniforms.mBones[i32(vertexInputs.matricesIndicesExtra[3])]*vertexInputs.matricesWeightsExtra[3];
150
+ #endif
151
+ #endif
152
+ finalWorld=finalWorld*influence;
153
+ #endif
154
+ #endif
155
+ `;t.ShaderStore.IncludesShadersStoreWGSL[n]||(t.ShaderStore.IncludesShadersStoreWGSL[n]=a),e.s(["bonesVertexWGSL",0,{name:n,shader:a}],3350);let f="bakedVertexAnimation",d=`#ifdef BAKED_VERTEX_ANIMATION_TEXTURE
156
+ {
157
+ #ifdef INSTANCES
158
+ let VATStartFrame: f32=vertexInputs.bakedVertexAnimationSettingsInstanced.x;let VATEndFrame: f32=vertexInputs.bakedVertexAnimationSettingsInstanced.y;let VATOffsetFrame: f32=vertexInputs.bakedVertexAnimationSettingsInstanced.z;let VATSpeed: f32=vertexInputs.bakedVertexAnimationSettingsInstanced.w;
159
+ #else
160
+ let VATStartFrame: f32=uniforms.bakedVertexAnimationSettings.x;let VATEndFrame: f32=uniforms.bakedVertexAnimationSettings.y;let VATOffsetFrame: f32=uniforms.bakedVertexAnimationSettings.z;let VATSpeed: f32=uniforms.bakedVertexAnimationSettings.w;
161
+ #endif
162
+ let totalFrames: f32=VATEndFrame-VATStartFrame+1.0;let time: f32=uniforms.bakedVertexAnimationTime*VATSpeed/totalFrames;let frameCorrection: f32=select(1.0,0.0,time<1.0);let numOfFrames: f32=totalFrames-frameCorrection;var VATFrameNum: f32=fract(time)*numOfFrames;VATFrameNum=(VATFrameNum+VATOffsetFrame) % numOfFrames;VATFrameNum=floor(VATFrameNum);VATFrameNum=VATFrameNum+VATStartFrame+frameCorrection;var VATInfluence : mat4x4<f32>;VATInfluence=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndices[0],VATFrameNum)*vertexInputs.matricesWeights[0];
163
+ #if NUM_BONE_INFLUENCERS>1
164
+ VATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndices[1],VATFrameNum)*vertexInputs.matricesWeights[1];
165
+ #endif
166
+ #if NUM_BONE_INFLUENCERS>2
167
+ VATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndices[2],VATFrameNum)*vertexInputs.matricesWeights[2];
168
+ #endif
169
+ #if NUM_BONE_INFLUENCERS>3
170
+ VATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndices[3],VATFrameNum)*vertexInputs.matricesWeights[3];
171
+ #endif
172
+ #if NUM_BONE_INFLUENCERS>4
173
+ VATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndicesExtra[0],VATFrameNum)*vertexInputs.matricesWeightsExtra[0];
174
+ #endif
175
+ #if NUM_BONE_INFLUENCERS>5
176
+ VATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndicesExtra[1],VATFrameNum)*vertexInputs.matricesWeightsExtra[1];
177
+ #endif
178
+ #if NUM_BONE_INFLUENCERS>6
179
+ VATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndicesExtra[2],VATFrameNum)*vertexInputs.matricesWeightsExtra[2];
180
+ #endif
181
+ #if NUM_BONE_INFLUENCERS>7
182
+ VATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndicesExtra[3],VATFrameNum)*vertexInputs.matricesWeightsExtra[3];
183
+ #endif
184
+ finalWorld=finalWorld*VATInfluence;}
185
+ #endif
186
+ `;t.ShaderStore.IncludesShadersStoreWGSL[f]||(t.ShaderStore.IncludesShadersStoreWGSL[f]=d),e.s(["bakedVertexAnimationWGSL",0,{name:f,shader:d}],35845);let s="clipPlaneVertex",o=`#ifdef CLIPPLANE
187
+ vertexOutputs.fClipDistance=dot(worldPos,uniforms.vClipPlane);
188
+ #endif
189
+ #ifdef CLIPPLANE2
190
+ vertexOutputs.fClipDistance2=dot(worldPos,uniforms.vClipPlane2);
191
+ #endif
192
+ #ifdef CLIPPLANE3
193
+ vertexOutputs.fClipDistance3=dot(worldPos,uniforms.vClipPlane3);
194
+ #endif
195
+ #ifdef CLIPPLANE4
196
+ vertexOutputs.fClipDistance4=dot(worldPos,uniforms.vClipPlane4);
197
+ #endif
198
+ #ifdef CLIPPLANE5
199
+ vertexOutputs.fClipDistance5=dot(worldPos,uniforms.vClipPlane5);
200
+ #endif
201
+ #ifdef CLIPPLANE6
202
+ vertexOutputs.fClipDistance6=dot(worldPos,uniforms.vClipPlane6);
203
+ #endif
204
+ `;t.ShaderStore.IncludesShadersStoreWGSL[s]||(t.ShaderStore.IncludesShadersStoreWGSL[s]=o),e.s(["clipPlaneVertexWGSL",0,{name:s,shader:o}],3878);let l="fogVertex",u=`#ifdef FOG
205
+ #ifdef SCENE_UBO
206
+ vertexOutputs.vFogDistance=(scene.view*worldPos).xyz;
207
+ #else
208
+ vertexOutputs.vFogDistance=(uniforms.view*worldPos).xyz;
209
+ #endif
210
+ #endif
211
+ `;t.ShaderStore.IncludesShadersStoreWGSL[l]||(t.ShaderStore.IncludesShadersStoreWGSL[l]=u),e.s(["fogVertexWGSL",0,{name:l,shader:u}],42893);let m="vertexColorMixing",c=`#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
212
+ vertexOutputs.vColor=vec4f(1.0);
213
+ #ifdef VERTEXCOLOR
214
+ #ifdef VERTEXALPHA
215
+ vertexOutputs.vColor*=colorUpdated;
216
+ #else
217
+ vertexOutputs.vColor=vec4f(vertexOutputs.vColor.rgb*colorUpdated.rgb,vertexOutputs.vColor.a);
218
+ #endif
219
+ #endif
220
+ #ifdef INSTANCESCOLOR
221
+ vertexOutputs.vColor*=vertexInputs.instanceColor;
222
+ #endif
223
+ #endif
224
+ `;t.ShaderStore.IncludesShadersStoreWGSL[m]||(t.ShaderStore.IncludesShadersStoreWGSL[m]=c),e.s(["vertexColorMixingWGSL",0,{name:m,shader:c}],8154)},65644,e=>{"use strict";var t=e.i(12423),r=e.i(45329),i=e.i(35011),n=e.i(77785),a=e.i(75234),f=e.i(18062),d=e.i(50331),s=e.i(3350),o=e.i(35845),l=e.i(3878),u=e.i(42893),m=e.i(8154);let c="colorVertexShader",S=`attribute position: vec3f;
225
+ #ifdef VERTEXCOLOR
226
+ attribute color: vec4f;
227
+ #endif
228
+ #include<bonesDeclaration>
229
+ #include<bakedVertexAnimationDeclaration>
230
+ #include<clipPlaneVertexDeclaration>
231
+ #include<fogVertexDeclaration>
232
+ #ifdef FOG
233
+ uniform view: mat4x4f;
234
+ #endif
235
+ #include<instancesDeclaration>
236
+ uniform viewProjection: mat4x4f;
237
+ #if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
238
+ varying vColor: vec4f;
239
+ #endif
240
+ #define CUSTOM_VERTEX_DEFINITIONS
241
+ @vertex
242
+ fn main(input : VertexInputs)->FragmentInputs {
243
+ #define CUSTOM_VERTEX_MAIN_BEGIN
244
+ #ifdef VERTEXCOLOR
245
+ var colorUpdated: vec4f=vertexInputs.color;
246
+ #endif
247
+ #include<instancesVertex>
248
+ #include<bonesVertex>
249
+ #include<bakedVertexAnimation>
250
+ var worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;
251
+ #include<clipPlaneVertex>
252
+ #include<fogVertex>
253
+ #include<vertexColorMixing>
254
+ #define CUSTOM_VERTEX_MAIN_END
255
+ }`;for(let e of(t.ShaderStore.ShadersStoreWGSL[c]||(t.ShaderStore.ShadersStoreWGSL[c]=S),[r.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,n.clipPlaneVertexDeclarationWGSL,a.fogVertexDeclarationWGSL,f.instancesDeclarationWGSL,d.instancesVertexWGSL,s.bonesVertexWGSL,o.bakedVertexAnimationWGSL,l.clipPlaneVertexWGSL,u.fogVertexWGSL,m.vertexColorMixingWGSL]))t.ShaderStore.IncludesShadersStoreWGSL[e.name]||(t.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);e.s(["colorVertexShaderWGSL",0,{name:c,shader:S}])}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,12423,t=>{"use strict";class e{static GetShadersRepository(t=0){return 0===t?e.ShadersRepository:e.ShadersRepositoryWGSL}static GetShadersStore(t=0){return 0===t?e.ShadersStore:e.ShadersStoreWGSL}static GetIncludesShadersStore(t=0){return 0===t?e.IncludesShadersStore:e.IncludesShadersStoreWGSL}}e.ShadersRepository="src/Shaders/",e.ShadersStore={},e.IncludesShadersStore={},e.ShadersRepositoryWGSL="src/ShadersWGSL/",e.ShadersStoreWGSL={},e.IncludesShadersStoreWGSL={},t.s(["ShaderStore",0,e])},1773,t=>{"use strict";t.s(["useOpenGLOrientationForUV",()=>!1])},25348,t=>{"use strict";class e{constructor(t,e,n,s){this.x=t,this.y=e,this.width=n,this.height=s}toGlobal(t,n){return new e(this.x*t,this.y*n,this.width*t,this.height*n)}toGlobalToRef(t,e,n){return n.x=this.x*t,n.y=this.y*e,n.width=this.width*t,n.height=this.height*e,this}clone(){return new e(this.x,this.y,this.width,this.height)}}t.s(["Viewport",0,e])},70247,t=>{"use strict";var e,n,s,r,a=t.i(96265);(e=s||(s={}))[e.LOCAL=0]="LOCAL",e[e.WORLD=1]="WORLD",e[e.BONE=2]="BONE";class i{}i.X=new a.Vector3(1,0,0),i.Y=new a.Vector3(0,1,0),i.Z=new a.Vector3(0,0,1),(n=r||(r={}))[n.X=0]="X",n[n.Y=1]="Y",n[n.Z=2]="Z",t.s(["Axis",0,i,"Coordinate",0,r,"Space",0,s])},44939,t=>{"use strict";var e=t.i(23240);t.s(["DrawWrapper",0,class{static GetEffect(t){return void 0===t.getPipelineContext?t.effect:t}constructor(t,e=!0){this._wasPreviouslyReady=!1,this._forceRebindOnNextCall=!0,this._wasPreviouslyUsingInstances=null,this.effect=null,this.defines=null,this.drawContext=t.createDrawContext(),e&&(this.materialContext=t.createMaterialContext())}setEffect(t,e,n=!0){this.effect=t,void 0!==e&&(this.defines=e),n&&this.drawContext?.reset()}dispose(t=!1){if(this.effect){let n=this.effect;t?n.dispose():e.TimingTools.SetImmediate(()=>{n.getEngine().onEndFrameObservable.addOnce(()=>{n.dispose()})}),this.effect=null}this.drawContext?.dispose()}}])},49007,t=>{"use strict";t.s(["IntersectionInfo",0,class{constructor(t,e,n){this.bu=t,this.bv=e,this.distance=n,this.faceId=0,this.subMeshId=0,this._internalSubMeshId=0}}])},26831,t=>{"use strict";t.s([],71911);var e=t.i(96265),n=t.i(13379),s=t.i(70227),r=t.i(40408),a=t.i(35407);let i="bakedVertexAnimationSettingsInstanced";function o(t){let e=t.bakedVertexAnimationManager?.texture?.getInternalTexture()?._bufferView;return e instanceof Float32Array||e instanceof Uint16Array}let h=!1;function f(){h||(h=!0,r.Mesh.prototype.thinInstanceAdd=function(t,e=!0){if(!this.getScene().getEngine().getCaps().instancedArrays)return n.Logger.Error("Thin Instances are not supported on this device as Instanced Array extension not supported"),-1;this._thinInstanceUpdateBufferSize("matrix",Array.isArray(t)?t.length:1);let s=this._thinInstanceDataStorage.instancesCount;if(Array.isArray(t))for(let n=0;n<t.length;++n)this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++,t[n],n===t.length-1&&e);else this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++,t,e);return s},r.Mesh.prototype.thinInstanceAddSelf=function(t=!0){return this.thinInstanceAdd(e.Matrix.IdentityReadOnly,t)},r.Mesh.prototype.thinInstanceRegisterAttribute=function(t,e){t===a.VertexBuffer.ColorKind&&(t=a.VertexBuffer.ColorInstanceKind),this.removeVerticesData(t),this._thinInstanceInitializeUserStorage(),this._userThinInstanceBuffersStorage.strides[t]=e,this._userThinInstanceBuffersStorage.sizes[t]=e*Math.max(32,this._thinInstanceDataStorage.instancesCount),this._userThinInstanceBuffersStorage.data[t]=new Float32Array(this._userThinInstanceBuffersStorage.sizes[t]),this._userThinInstanceBuffersStorage.vertexBuffers[t]=new a.VertexBuffer(this.getEngine(),this._userThinInstanceBuffersStorage.data[t],t,!0,!1,e,!0),this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[t])},r.Mesh.prototype.thinInstanceSetMatrixAt=function(t,e,n=!0){if(!this._thinInstanceDataStorage.matrixData||t>=this._thinInstanceDataStorage.instancesCount)return!1;let s=this._thinInstanceDataStorage.matrixData;return e.copyToArray(s,16*t),this._thinInstanceDataStorage.worldMatrices&&(this._thinInstanceDataStorage.worldMatrices[t]=e),n&&(this.thinInstanceBufferUpdated("matrix"),this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1)),!0},r.Mesh.prototype.thinInstanceSetAttributeAt=function(t,e,n,s=!0){return t===a.VertexBuffer.ColorKind&&(t=a.VertexBuffer.ColorInstanceKind),!!this._userThinInstanceBuffersStorage&&!!this._userThinInstanceBuffersStorage.data[t]&&!(e>=this._thinInstanceDataStorage.instancesCount)&&(this._thinInstanceUpdateBufferSize(t,0),this._userThinInstanceBuffersStorage.data[t].set(n,e*this._userThinInstanceBuffersStorage.strides[t]),s&&this.thinInstanceBufferUpdated(t),!0)},Object.defineProperty(r.Mesh.prototype,"thinInstanceCount",{get:function(){return this._thinInstanceDataStorage.instancesCount},set:function(t){let e=this._thinInstanceDataStorage.matrixData??this.source?._thinInstanceDataStorage.matrixData;t<=(e?e.length/16:0)&&(this._thinInstanceDataStorage.instancesCount=t)},enumerable:!0,configurable:!0}),r.Mesh.prototype._thinInstanceCreateMatrixBuffer=function(t,e,n=!0){let s=new a.Buffer(this.getEngine(),e,!n,16,!1,!0);for(let e=0;e<4;e++)this.setVerticesBuffer(s.createVertexBuffer(t+e,4*e,4));return s},r.Mesh.prototype.thinInstanceSetBuffer=function(t,e,n=0,s=!0){if(n=n||16,"matrix"===t)this._thinInstanceDataStorage.matrixBuffer?.dispose(),this._thinInstanceDataStorage.matrixBuffer=null,this._thinInstanceDataStorage.matrixBufferSize=e?e.length:32*n,this._thinInstanceDataStorage.matrixData=e,this._thinInstanceDataStorage.worldMatrices=null,null!==e?(this._thinInstanceDataStorage.instancesCount=e.length/n,this._thinInstanceDataStorage.matrixBuffer=this._thinInstanceCreateMatrixBuffer("world",e,s),this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1)):(this._thinInstanceDataStorage.instancesCount=0,this.doNotSyncBoundingInfo||this.refreshBoundingInfo());else if("previousMatrix"===t)this._thinInstanceDataStorage.previousMatrixBuffer?.dispose(),this._thinInstanceDataStorage.previousMatrixBuffer=null,this._thinInstanceDataStorage.previousMatrixData=e,null!==e&&(this._thinInstanceDataStorage.previousMatrixBuffer=this._thinInstanceCreateMatrixBuffer("previousWorld",e,s));else if("splatIndex"===t&&e){this._thinInstanceInitializeUserStorage(),this._thinInstanceDataStorage.instancesCount=e.length/n,this._userThinInstanceBuffersStorage.data[t]=e,this._userThinInstanceBuffersStorage.strides[t]=n,this._userThinInstanceBuffersStorage.sizes[t]=e.length;let s=new a.Buffer(this.getEngine(),e,!0,16,!1,!0);this._thinInstanceDataStorage.matrixBuffer=s;for(let e=0;e<4;e++)this.setVerticesBuffer(s.createVertexBuffer(t+e,4*e,4))}else t===a.VertexBuffer.ColorKind&&(t=a.VertexBuffer.ColorInstanceKind),null===e?this._userThinInstanceBuffersStorage?.data[t]&&(this.removeVerticesData(t),delete this._userThinInstanceBuffersStorage.data[t],delete this._userThinInstanceBuffersStorage.strides[t],delete this._userThinInstanceBuffersStorage.sizes[t],delete this._userThinInstanceBuffersStorage.vertexBuffers[t]):(this._thinInstanceInitializeUserStorage(),this._userThinInstanceBuffersStorage.data[t]=e,this._userThinInstanceBuffersStorage.strides[t]=n,this._userThinInstanceBuffersStorage.sizes[t]=e.length,this._userThinInstanceBuffersStorage.vertexBuffers[t]=new a.VertexBuffer(this.getEngine(),e,t,!s,!1,n,!0),this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[t]))},r.Mesh.prototype.thinInstanceBufferUpdated=function(t){"matrix"===t?(this.thinInstanceAllowAutomaticStaticBufferRecreation&&this._thinInstanceDataStorage.matrixBuffer&&!this._thinInstanceDataStorage.matrixBuffer.isUpdatable()&&this._thinInstanceRecreateBuffer(t),this._thinInstanceDataStorage.matrixBuffer?.updateDirectly(this._thinInstanceDataStorage.matrixData,0,this._thinInstanceDataStorage.instancesCount)):"previousMatrix"===t?(this.thinInstanceAllowAutomaticStaticBufferRecreation&&this._thinInstanceDataStorage.previousMatrixBuffer&&!this._thinInstanceDataStorage.previousMatrixBuffer.isUpdatable()&&this._thinInstanceRecreateBuffer(t),this._thinInstanceDataStorage.previousMatrixBuffer?.updateDirectly(this._thinInstanceDataStorage.previousMatrixData,0,this._thinInstanceDataStorage.instancesCount)):"splatIndex"===t?this._thinInstanceDataStorage.matrixBuffer?.updateDirectly(this._userThinInstanceBuffersStorage.data[t],0,this._thinInstanceDataStorage.instancesCount):(t===a.VertexBuffer.ColorKind&&(t=a.VertexBuffer.ColorInstanceKind),this._userThinInstanceBuffersStorage?.vertexBuffers[t]&&(this.thinInstanceAllowAutomaticStaticBufferRecreation&&!this._userThinInstanceBuffersStorage.vertexBuffers[t].isUpdatable()&&this._thinInstanceRecreateBuffer(t),this._userThinInstanceBuffersStorage.vertexBuffers[t].updateDirectly(this._userThinInstanceBuffersStorage.data[t],0)))},r.Mesh.prototype.thinInstancePartialBufferUpdate=function(t,e,n){if("matrix"===t)this._thinInstanceDataStorage.matrixBuffer&&("number"==typeof e?this._thinInstanceDataStorage.matrixBuffer.updateDirectly(new Float32Array(this._thinInstanceDataStorage.matrixData.buffer,this._thinInstanceDataStorage.matrixData.byteOffset+16*n*Float32Array.BYTES_PER_ELEMENT,16*e),16*n):this._thinInstanceDataStorage.matrixBuffer.updateDirectly(e,n));else if(t===a.VertexBuffer.ColorKind&&(t=a.VertexBuffer.ColorInstanceKind),this._userThinInstanceBuffersStorage?.vertexBuffers[t]){let s=this._userThinInstanceBuffersStorage.vertexBuffers[t];if("number"==typeof e){let s=new Float32Array(this._userThinInstanceBuffersStorage.data[t].buffer,this._userThinInstanceBuffersStorage.data[t].byteOffset+n*this._userThinInstanceBuffersStorage.strides[t]*Float32Array.BYTES_PER_ELEMENT,e*this._userThinInstanceBuffersStorage.strides[t]);this._userThinInstanceBuffersStorage.vertexBuffers[t].updateDirectly(s,n*this._userThinInstanceBuffersStorage.strides[t])}else s.updateDirectly(e,n)}},r.Mesh.prototype.thinInstanceGetWorldMatrices=function(){if(!this._thinInstanceDataStorage.matrixData||!this._thinInstanceDataStorage.matrixBuffer)return[];let t=this._thinInstanceDataStorage.matrixData;if(!this._thinInstanceDataStorage.worldMatrices){this._thinInstanceDataStorage.worldMatrices=[];for(let n=0;n<this._thinInstanceDataStorage.instancesCount;++n)this._thinInstanceDataStorage.worldMatrices[n]=e.Matrix.FromArray(t,16*n)}return this._thinInstanceDataStorage.worldMatrices},r.Mesh.prototype.thinInstanceRefreshBoundingInfo=function(t=!1,n=!1,r=!1,h=!1){if(!this._thinInstanceDataStorage.matrixData||!this._thinInstanceDataStorage.matrixBuffer)return;let f=this._thinInstanceDataStorage.boundingVectors;if(t||!this.rawBoundingInfo){if(f.length=0,h&&function(t,n,r){let h=t._userThinInstanceBuffersStorage,f=h?.data[i],u=h?.strides[i];if(!f||!u||u<4||!o(t))return!1;let c=t._thinInstanceDataStorage.matrixData;if(!c)return!1;let I={},g=e.TmpVectors.Vector4[0],l=e.TmpVectors.Vector3[1],d=e.TmpVectors.Vector3[2],S=e.TmpVectors.Vector3[3],B=e.TmpVectors.Vector3[4],x=e.TmpVectors.Vector3[5],_=e.TmpVectors.Vector3[6],p=e.TmpVectors.Matrix[2],m=t.geometry?t.geometry.boundingBias:null,D=t.getTotalVertices();l.setAll(1/0),d.setAll(-1/0),S.setAll(1/0),B.setAll(-1/0);for(let n=0;n<t._thinInstanceDataStorage.instancesCount;++n){let s=n*u;g.set(f[s],f[s+1],f[s+2],f[s+3]);let i=t._getData({applyMorph:r,applyBakedVertexAnimation:!0,bakedVertexAnimationSettings:g,updatePositionsArray:!1,cache:I},null,a.VertexBuffer.PositionKind);if(!i)return!1;x.setAll(1/0),_.setAll(-1/0);for(let t=0;t<3*D;t+=3){let e=i[t],n=i[t+1],s=i[t+2];e<x.x&&(x.x=e),n<x.y&&(x.y=n),s<x.z&&(x.z=s),e>_.x&&(_.x=e),n>_.y&&(_.y=n),s>_.z&&(_.z=s)}m&&(x.x-=x.x*m.x+m.y,x.y-=x.y*m.x+m.y,x.z-=x.z*m.x+m.y,_.x+=_.x*m.x+m.y,_.y+=_.y*m.x+m.y,_.z+=_.z*m.x+m.y),l.minimizeInPlace(x),d.maximizeInPlace(_),e.Matrix.FromArrayToRef(c,16*n,p),m?function(t,n,s,r,a){let i=e.TmpVectors.Vector3[7],o=e.TmpVectors.Vector3[8];for(let h=0;h<2;++h)for(let f=0;f<2;++f)for(let u=0;u<2;++u)i.set(h?n.x:t.x,f?n.y:t.y,u?n.z:t.z),e.Vector3.TransformCoordinatesToRef(i,s,o),r.minimizeInPlace(o),a.maximizeInPlace(o)}(x,_,p,S,B):function(t,n,s,r,a){let i=e.TmpVectors.Vector3[7];for(let o=0;o<3*n;o+=3)e.Vector3.TransformCoordinatesFromFloatsToRef(t[o],t[o+1],t[o+2],s,i),r.minimizeInPlace(i),a.maximizeInPlace(i)}(i,D,p,S,B)}if(!isFinite(l.x)||!isFinite(S.x))return!1;t.getBoundingInfo().reConstruct(S,B),t.rawBoundingInfo=new s.BoundingInfo(l,d);var T=t.rawBoundingInfo;n.length=0;for(let t=0;t<T.boundingBox.vectors.length;++t)n.push(T.boundingBox.vectors[t].clone());return t._updateBoundingInfo(),!0}(this,f,r))return;h&&this.bakedVertexAnimationManager?.isEnabled&&o(this)?this.refreshBoundingInfo({applySkeleton:n,applyMorph:r,applyBakedVertexAnimation:!0,updatePositionsArray:!1}):this.refreshBoundingInfo(n,r);let t=this.getBoundingInfo();this.rawBoundingInfo=new s.BoundingInfo(t.minimum,t.maximum)}let u=this.getBoundingInfo(),c=this._thinInstanceDataStorage.matrixData;if(0===f.length)for(let t=0;t<u.boundingBox.vectors.length;++t)f.push(u.boundingBox.vectors[t].clone());e.TmpVectors.Vector3[0].setAll(1/0),e.TmpVectors.Vector3[1].setAll(-1/0);for(let t=0;t<this._thinInstanceDataStorage.instancesCount;++t){e.Matrix.FromArrayToRef(c,16*t,e.TmpVectors.Matrix[0]);for(let t=0;t<f.length;++t)e.Vector3.TransformCoordinatesToRef(f[t],e.TmpVectors.Matrix[0],e.TmpVectors.Vector3[2]),e.TmpVectors.Vector3[0].minimizeInPlace(e.TmpVectors.Vector3[2]),e.TmpVectors.Vector3[1].maximizeInPlace(e.TmpVectors.Vector3[2])}u.reConstruct(e.TmpVectors.Vector3[0],e.TmpVectors.Vector3[1]),this._updateBoundingInfo()},r.Mesh.prototype._thinInstanceRecreateBuffer=function(t,e=!0){"matrix"===t?(this._thinInstanceDataStorage.matrixBuffer?.dispose(),this._thinInstanceDataStorage.matrixBuffer=this._thinInstanceCreateMatrixBuffer("world",this._thinInstanceDataStorage.matrixData,e)):"previousMatrix"===t?this._scene.needsPreviousWorldMatrices&&(this._thinInstanceDataStorage.previousMatrixBuffer?.dispose(),this._thinInstanceDataStorage.previousMatrixBuffer=this._thinInstanceCreateMatrixBuffer("previousWorld",this._thinInstanceDataStorage.previousMatrixData??this._thinInstanceDataStorage.matrixData,e)):(t===a.VertexBuffer.ColorKind&&(t=a.VertexBuffer.ColorInstanceKind),this._userThinInstanceBuffersStorage.vertexBuffers[t]?.dispose(),this._userThinInstanceBuffersStorage.vertexBuffers[t]=new a.VertexBuffer(this.getEngine(),this._userThinInstanceBuffersStorage.data[t],t,!e,!1,this._userThinInstanceBuffersStorage.strides[t],!0),this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[t]))},r.Mesh.prototype._thinInstanceUpdateBufferSize=function(t,e=1){t===a.VertexBuffer.ColorKind&&(t=a.VertexBuffer.ColorInstanceKind);let n="matrix"===t;if(!n&&(!this._userThinInstanceBuffersStorage||!this._userThinInstanceBuffersStorage.strides[t]))return;let s=n?16:this._userThinInstanceBuffersStorage.strides[t],r=n?this._thinInstanceDataStorage.matrixBufferSize:this._userThinInstanceBuffersStorage.sizes[t],i=n?this._thinInstanceDataStorage.matrixData:this._userThinInstanceBuffersStorage.data[t],o=(this._thinInstanceDataStorage.instancesCount+e)*s,h=r;for(;h<o;)h*=2;if(!i||r!=h){if(i){let t=new Float32Array(h);t.set(i,0),i=t}else i=new Float32Array(h);n?(this._thinInstanceDataStorage.matrixBuffer?.dispose(),this._thinInstanceDataStorage.matrixBuffer=this._thinInstanceCreateMatrixBuffer("world",i,!1),this._thinInstanceDataStorage.matrixData=i,this._thinInstanceDataStorage.matrixBufferSize=h,this._scene.needsPreviousWorldMatrices&&!this._thinInstanceDataStorage.previousMatrixData&&(this._thinInstanceDataStorage.previousMatrixBuffer?.dispose(),this._thinInstanceDataStorage.previousMatrixBuffer=this._thinInstanceCreateMatrixBuffer("previousWorld",i,!1))):(this._userThinInstanceBuffersStorage.vertexBuffers[t]?.dispose(),this._userThinInstanceBuffersStorage.data[t]=i,this._userThinInstanceBuffersStorage.sizes[t]=h,this._userThinInstanceBuffersStorage.vertexBuffers[t]=new a.VertexBuffer(this.getEngine(),i,t,!0,!1,s,!0),this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[t]))}},r.Mesh.prototype._thinInstanceInitializeUserStorage=function(){this._userThinInstanceBuffersStorage||(this._userThinInstanceBuffersStorage={data:{},sizes:{},vertexBuffers:{},strides:{}})},r.Mesh.prototype._disposeThinInstanceSpecificData=function(){this._thinInstanceDataStorage?.matrixBuffer&&(this._thinInstanceDataStorage.matrixBuffer.dispose(),this._thinInstanceDataStorage.matrixBuffer=null),this._thinInstanceDataStorage?.previousMatrixBuffer&&(this._thinInstanceDataStorage.previousMatrixBuffer.dispose(),this._thinInstanceDataStorage.previousMatrixBuffer=null)})}t.s(["RegisterThinInstanceMesh",0,f],3246),f(),t.s([],7549),t.i(7549),t.i(71911),t.i(3246),t.s(["RegisterThinInstanceMesh",0,f],26831)},42829,t=>{t.v(e=>Promise.all(["static/chunks/3l1dr_qm_x5kp.js"].map(e=>t.l(e))).then(()=>e(47786)))}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,62238,42279,e=>{"use strict";let t=1/1.2;e.s(["ZOOM_IN_FACTOR",0,t,"ZOOM_OUT_FACTOR",0,1.2,"disableWheelZoom",0,function(e){e.inputs.removeByType("ArcRotateCameraMouseWheelInput")},"stepZoom",0,function(e,t){let s=e.lowerRadiusLimit??.01,n=e.upperRadiusLimit??1/0;e.radius=Math.min(n,Math.max(s,e.radius*t))}],62238);var s=e.i(29212);e.s(["ZoomButtons",0,function({onZoom:e}){let n="grid h-8 w-8 place-items-center rounded-md border border-edge bg-ink/80 text-lg leading-none text-fg backdrop-blur transition hover:bg-ink hover:text-white";return(0,s.jsxs)("div",{className:"absolute right-3 top-3 flex flex-col gap-1",children:[(0,s.jsx)("button",{type:"button","aria-label":"Zoom in",className:n,onClick:()=>e(t),children:"+"}),(0,s.jsx)("button",{type:"button","aria-label":"Zoom out",className:n,onClick:()=>e(1.2),children:"−"})]})}],42279)},59683,37660,e=>{"use strict";e.s(["attachMeshHover",0,function(e,t,s){let n=0,a=null,i=t=>{let i=t.offsetX,l=t.offsetY;n||(n=requestAnimationFrame(()=>{var t,c;let o;n=0;let r=e.pick(i,l,e=>e.isPickable&&e.isEnabled()),h=r?.pickedMesh?(t=r.pickedMesh,c=r.thinInstanceIndex??-1,(o=t.metadata)?c>=0&&o.hoverLabels?o.hoverLabels[c]??null:o.hoverLabel??null:null):null;h?s({label:h,x:i,y:l}):null!==a&&s(null),a=h}))},l=()=>{n&&(cancelAnimationFrame(n),n=0),null!==a&&(a=null,s(null))};return t.addEventListener("pointermove",i),t.addEventListener("pointerleave",l),()=>{t.removeEventListener("pointermove",i),t.removeEventListener("pointerleave",l),n&&cancelAnimationFrame(n)}}],59683);var t=e.i(29212),s=e.i(56054);e.s(["HeatLegend",0,function({title:e,lowLabel:n="low",highLabel:a="high",note:i}){return(0,t.jsxs)("div",{className:"pointer-events-none absolute bottom-3 left-3 rounded-md border border-edge bg-ink/80 px-3 py-2 text-fg backdrop-blur-sm",children:[(0,t.jsx)("div",{className:"mb-1 text-xs font-medium text-fg",children:e}),(0,t.jsx)("div",{className:"h-2 w-36 rounded-sm",style:{background:s.HEAT_GRADIENT}}),(0,t.jsxs)("div",{className:"mt-1 flex w-36 justify-between text-[10px] text-fg-muted",children:[(0,t.jsx)("span",{children:n}),(0,t.jsx)("span",{children:a})]}),i?(0,t.jsx)("div",{className:"mt-1 max-w-44 text-[10px] leading-tight text-fg-muted",children:i}):null]})}],37660)},71028,e=>{"use strict";var t=e.i(29212),s=e.i(94179),n=e.i(56054),a=e.i(62238),i=e.i(59683),l=e.i(37660),c=e.i(93425),o=e.i(42279);let r="__all__";function h(e){return`${e[0]},${e[1]},${e[2]}`}function u({label:e,value:s,onChange:n,allLabel:a,options:i}){return(0,t.jsxs)("label",{className:"flex items-center gap-1.5 rounded-md border border-edge bg-ink/80 px-2 py-1 text-xs text-fg backdrop-blur",children:[(0,t.jsx)("span",{className:"font-medium text-fg-muted",children:e}),(0,t.jsxs)("select",{className:"max-w-[12rem] bg-transparent text-white outline-none",value:s,onChange:e=>n(e.target.value),children:[(0,t.jsx)("option",{value:r,children:a}),i.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))]})]})}e.s(["ClickRays3D",0,function({rays:m,cellSize:d,proxyMeshes:j=[]}){let k=(0,s.useRef)(null),f=(0,s.useRef)(null),[v,p]=(0,s.useState)("loading"),[x,b]=(0,s.useState)(null),[g,y]=(0,s.useState)(r),[w,z]=(0,s.useState)(r),[q,_]=(0,s.useState)(null),A=(0,s.useMemo)(()=>{let e=new Map;for(let t of m){let s=h(t.camVoxel),n=e.get(s);n?n.count+=t.count:e.set(s,{key:s,voxel:t.camVoxel,count:t.count})}return[...e.values()].sort((e,t)=>t.count-e.count)},[m]),L=(0,s.useMemo)(()=>{let e=new Map;for(let t of m)""!==t.mesh&&e.set(t.mesh,(e.get(t.mesh)??0)+t.count);return[...e.entries()].map(([e,t])=>({name:e,count:t})).sort((e,t)=>t.count-e.count)},[m]);return(0,s.useEffect)(()=>{g!==r&&(A.some(e=>e.key===g)||y(r))},[g,A]),(0,s.useEffect)(()=>{w!==r&&(L.some(e=>e.name===w)||z(r))},[w,L]),(0,s.useEffect)(()=>{let t=k.current;if(!t)return;if(0===m.length)return void p("empty");let s=!1,l=null;return p("loading"),b(null),(async()=>{try{let[{Engine:c},{Scene:o},{ArcRotateCamera:u},{HemisphericLight:k},{Vector3:v,Color3:x,Color4:b,Matrix:y},{MeshBuilder:z},{StandardMaterial:q}]=await Promise.all([e.A(66022),e.A(48505),e.A(53976),e.A(42436),e.A(89370),e.A(67141),e.A(20693),e.A(9607),e.A(96664)]);if(s)return;let A=g===r?m:m.filter(e=>h(e.camVoxel)===g);if(0===A.length)return void p("empty");let L=A.reduce((e,t)=>Math.max(e,t.count),1),M=0,C=0,P=0,N=0,E=(e,t,s)=>{M+=e,C+=t,P+=s,N++};for(let e of A)E(e.origin[0],e.origin[1],e.origin[2]),E(e.hit[0],e.hit[1],e.hit[2]);let R=N>0?new v(M/N,C/N,P/N):v.Zero(),T=4*d;for(let e of A)for(let t of[e.origin,e.hit]){let e=t[0]-R.x,s=t[1]-R.y,n=t[2]-R.z;T=Math.max(T,Math.sqrt(e*e+s*s+n*n))}let S=new c(t,!0,{preserveDrawingBuffer:!1}),Z=new o(S);Z.clearColor=new b(.04,.05,.07,1);let I=new u("rays-cam",Math.PI/4,Math.PI/3,2.4*T,R,Z);if(I.attachControl(t,!0),(0,a.disableWheelZoom)(I),f.current=I,new k("rays-light",new v(.4,1,.3),Z),j.length>0){let e=z.CreateBox("scene-proxy",{size:1},Z),t=new q("scene-proxy-mat",Z);t.wireframe=!0,t.disableLighting=!0,t.emissiveColor=new x(.32,.4,.52),t.alpha=.35,e.material=t,e.isPickable=!0,e.thinInstanceEnablePicking=!0,e.metadata={hoverLabels:j.map(e=>e.name)};let s=j.length,n=new Float32Array(16*s);for(let e=0;e<s;e++){let t=j[e].aabb,s=Math.max(t[3]-t[0],.001),a=Math.max(t[4]-t[1],.001),i=Math.max(t[5]-t[2],.001);y.Scaling(s,a,i).multiply(y.Translation((t[0]+t[3])/2,(t[1]+t[4])/2,(t[2]+t[5])/2)).copyToArray(n,16*e)}e.thinInstanceSetBuffer("matrix",n,16,!0)}let B=[],F=[];for(let e of A){let t=e.count/L,[s,a,i]=(0,n.heatRgb)(t),l=new b(s,a,i,.35+.65*t);B.push([new v(e.origin[0],e.origin[1],e.origin[2]),new v(e.hit[0],e.hit[1],e.hit[2])]),F.push([l,l])}B.length>0&&(z.CreateLineSystem("click-rays",{lines:B,colors:F,useVertexAlpha:!0},Z).isPickable=!1);let O=new Map;for(let e of A)O.set(h(e.camVoxel),e.camVoxel);if(O.size>0){let e=z.CreateSphere("rays-eye",{diameter:.6*d,segments:6},Z),t=new q("rays-eye-mat",Z);t.disableLighting=!0,t.emissiveColor=new x(.9,.95,1),e.material=t;let s=[...O.values()],n=new Float32Array(16*s.length);for(let e=0;e<s.length;e++){let t=s[e];y.Translation((t[0]+.5)*d,(t[1]+.5)*d,(t[2]+.5)*d).copyToArray(n,16*e)}e.thinInstanceSetBuffer("matrix",n,16,!0)}if(w!==r){let e=m.filter(e=>e.mesh===w);if(e.length>0){let t,s=j.find(e=>e.name===w);if(s){let e=s.aabb;t=new v((e[0]+e[3])/2,(e[1]+e[4])/2,(e[2]+e[5])/2)}else{let s=0,n=0,a=0;for(let t of e)s+=t.hit[0],n+=t.hit[1],a+=t.hit[2];t=new v(s/e.length,n/e.length,a/e.length)}let a=Math.max(3*d,.18*T),i=e.reduce((e,t)=>Math.max(e,t.count),1),l=[],c=[];for(let s of e){let e=s.origin[0]-s.hit[0],o=s.origin[1]-s.hit[1],r=s.origin[2]-s.hit[2],h=Math.sqrt(e*e+o*o+r*r)||1,u=s.count/i,m=a*(.4+.6*u),d=new v(t.x+e/h*m,t.y+o/h*m,t.z+r/h*m),[j,k,f]=(0,n.heatRgb)(u),p=new b(j,k,f,1);l.push([t.clone(),d]),c.push([new b(j,k,f,.25),p])}z.CreateLineSystem("mesh-rose",{lines:l,colors:c,useVertexAlpha:!0},Z).isPickable=!1;let o=z.CreateSphere("mesh-rose-hub",{diameter:.8*d,segments:8},Z),r=new q("mesh-rose-hub-mat",Z);r.disableLighting=!0,r.emissiveColor=new x(1,.85,.4),o.material=r,o.position=t,o.isPickable=!0,o.metadata={hoverLabel:w}}}S.runRenderLoop(()=>Z.render());let V=()=>S.resize();window.addEventListener("resize",V);let $=(0,i.attachMeshHover)(Z,t,_);p("ready"),l=()=>{window.removeEventListener("resize",V),$(),_(null),f.current=null,Z.dispose(),S.dispose()}}catch(e){if(s)return;p("error"),b(e instanceof Error?e.message:"Failed to render click rays.")}})(),()=>{s=!0,l?.()}},[m,d,j,g,w]),(0,t.jsx)(c.Panel,{title:"Click rays (3D)",subtitle:"Each click joined to the view it was made from — gate by viewpoint or focus a mesh",children:(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("canvas",{ref:k,className:"aspect-video w-full rounded-lg border border-edge bg-ink"}),q?(0,t.jsx)("div",{className:"pointer-events-none absolute z-10 max-w-[16rem] truncate rounded border border-edge bg-ink/90 px-1.5 py-0.5 text-xs text-white shadow backdrop-blur",style:{left:q.x+12,top:q.y+12},children:q.label}):null,"ready"===v?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"absolute left-3 top-3 flex gap-2",children:[(0,t.jsx)(u,{label:"Viewpoint",value:g,onChange:y,allLabel:"All viewpoints",options:A.map(e=>({value:e.key,label:`(${e.voxel.join(", ")}) \xb7 ${e.count}`}))}),(0,t.jsx)(u,{label:"Mesh rose",value:w,onChange:z,allLabel:"No mesh focus",options:L.map(e=>({value:e.name,label:`${e.name} \xb7 ${e.count}`}))})]}),(0,t.jsx)(o.ZoomButtons,{onZoom:e=>f.current&&(0,a.stepZoom)(f.current,e)}),(0,t.jsx)(l.HeatLegend,{title:"Click volume",lowLabel:"few clicks",highLabel:"most clicks",note:"Lines run from the camera position (bright eye) to where the click landed. Pick a viewpoint to see only clicks made from there; pick a mesh to see which directions its clicks came from."})]}):(0,t.jsx)("div",{className:"pointer-events-none absolute inset-0 grid place-items-center text-sm text-fg-muted",children:"loading"===v?"Rendering…":"empty"===v?"No correlated clicks in range.":"error"===v?x??"Click rays unavailable.":null})]})})}])},61518,e=>{e.n(e.i(71028))},66022,e=>{e.v(t=>Promise.all(["static/chunks/0ys9-ozuluawt.js","static/chunks/2ycvtdd68gub7.js","static/chunks/0v82oqyoy9zol.js","static/chunks/18u58lorfahxi.js","static/chunks/1nj82er7msdto.js","static/chunks/0ufbyo1x3qkmo.js","static/chunks/1yehxf-fmeicg.js"].map(t=>e.l(t))).then(()=>t(94080)))},48505,e=>{e.v(t=>Promise.all(["static/chunks/3v5ha25nxo43j.js","static/chunks/3v3-7fio3nw_t.js","static/chunks/0v82oqyoy9zol.js","static/chunks/3t06schbtqonl.js","static/chunks/1nj82er7msdto.js","static/chunks/3nz-dh9d7cehk.js","static/chunks/2-sjjedfr0kfq.js","static/chunks/18u58lorfahxi.js","static/chunks/2u6shh3oeycm-.js"].map(t=>e.l(t))).then(()=>t(73073)))},53976,e=>{e.v(t=>Promise.all(["static/chunks/3v3-7fio3nw_t.js","static/chunks/10r_824wzt8hj.js","static/chunks/2aor7m-wbis85.js","static/chunks/2-sjjedfr0kfq.js","static/chunks/0v82oqyoy9zol.js","static/chunks/25b9x-li-tvk2.js","static/chunks/2aelw3far6rii.js","static/chunks/0aznt7717miff.js","static/chunks/1_aahautsz2v_.js","static/chunks/1nj82er7msdto.js","static/chunks/3t06schbtqonl.js","static/chunks/18u58lorfahxi.js"].map(t=>e.l(t))).then(()=>t(18662)))},42436,e=>{e.v(t=>Promise.all(["static/chunks/37vzwr3ciejf1.js","static/chunks/157d9euci08yu.js","static/chunks/2-sjjedfr0kfq.js","static/chunks/18u58lorfahxi.js","static/chunks/0v82oqyoy9zol.js"].map(t=>e.l(t))).then(()=>t(12847)))},89370,e=>{e.v(t=>Promise.all(["static/chunks/0dm32-jq30tg8.js","static/chunks/18u58lorfahxi.js","static/chunks/0v82oqyoy9zol.js"].map(t=>e.l(t))).then(()=>t(62566)))},67141,e=>{e.v(t=>Promise.all(["static/chunks/3v3-7fio3nw_t.js","static/chunks/0v82oqyoy9zol.js","static/chunks/3mqy-84_ul3t2.js","static/chunks/1_aahautsz2v_.js","static/chunks/3t06schbtqonl.js","static/chunks/1thjncpj7u6pq.js","static/chunks/10r_824wzt8hj.js","static/chunks/1vdjn0pkoyypn.js","static/chunks/1nj82er7msdto.js","static/chunks/0aznt7717miff.js","static/chunks/2-sjjedfr0kfq.js","static/chunks/18u58lorfahxi.js","static/chunks/2aelw3far6rii.js","static/chunks/3nz-dh9d7cehk.js"].map(t=>e.l(t))).then(()=>t(97998)))},20693,e=>{e.v(t=>Promise.all(["static/chunks/1-61zh4waha61.js","static/chunks/3v3-7fio3nw_t.js","static/chunks/1zx2q-r32thv1.js","static/chunks/2-sjjedfr0kfq.js","static/chunks/0v82oqyoy9zol.js","static/chunks/3nz-dh9d7cehk.js","static/chunks/2u6shh3oeycm-.js","static/chunks/18u58lorfahxi.js","static/chunks/1_aahautsz2v_.js","static/chunks/1nj82er7msdto.js","static/chunks/3t06schbtqonl.js"].map(t=>e.l(t))).then(()=>t(32550)))},9607,e=>{e.v(t=>Promise.all(["static/chunks/2szdcpl41-kzv.js","static/chunks/3v3-7fio3nw_t.js","static/chunks/2-sjjedfr0kfq.js","static/chunks/3t06schbtqonl.js","static/chunks/10r_824wzt8hj.js","static/chunks/0aznt7717miff.js","static/chunks/1_aahautsz2v_.js","static/chunks/1nj82er7msdto.js","static/chunks/2aelw3far6rii.js","static/chunks/18u58lorfahxi.js","static/chunks/0v82oqyoy9zol.js"].map(t=>e.l(t))).then(()=>t(26831)))},96664,e=>{e.v(t=>Promise.all(["static/chunks/1o1d0p-v1z8ty.js","static/chunks/3v3-7fio3nw_t.js","static/chunks/0v82oqyoy9zol.js","static/chunks/3t06schbtqonl.js","static/chunks/3pufs8g4ui943.js","static/chunks/1nj82er7msdto.js","static/chunks/2-sjjedfr0kfq.js","static/chunks/18u58lorfahxi.js","static/chunks/2u6shh3oeycm-.js","static/chunks/3nz-dh9d7cehk.js"].map(t=>e.l(t))).then(()=>t(44981)))}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,68179,e=>{"use strict";function t(e){let t=r(e),s=i(e);return t-e>e-s?s:t}function r(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e}function i(e){return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,(e|=e>>16)-(e>>1)}e.s(["FloorPOT",0,i,"GetExponentOfTwo",0,function(e,s,a=2){let n;switch(a){case 1:n=i(e);break;case 2:n=t(e);break;default:n=r(e)}return Math.min(n,s)},"IsExponentOfTwo",0,function(e){let t=1;do t*=2;while(t<e)return t===e},"Mix",0,function(e,t,r){return e*(1-r)+t*r},"NearestPOT",0,t])},24574,e=>{"use strict";class t{get underlyingResource(){return null}constructor(){this.references=0,this.capacity=0,this.is32Bits=!1,this.uniqueId=t._Counter++}}t._Counter=0,e.s(["DataBuffer",0,t])},18064,30419,29485,e=>{"use strict";e.s(["IsWrapper",0,function(e){return void 0===e.getPipelineContext}],18064),e.s(["WebGLShaderProcessor",0,class{constructor(){this.shaderLanguage=0}postProcessor(e,t,r,i,s){return s.drawBuffersExtensionDisabled&&(e=e.replace(/#extension.+GL_EXT_draw_buffers.+(enable|require)/g,"")),e}}],30419);let t=/(flat\s)?\s*varying\s*.*/;e.s(["WebGL2ShaderProcessor",0,class{constructor(){this.shaderLanguage=0}attributeProcessor(e){return e.replace("attribute","in")}varyingCheck(e,r){return t.test(e)}varyingProcessor(e,t){return e.replace("varying",t?"in":"out")}postProcessor(e,t,r){let i=-1!==e.search(/#extension.+GL_EXT_draw_buffers.+require/);if(e=(e=e.replace(/#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,"")).replace(/texture2D\s*\(/g,"texture("),r){let r=-1!==e.search(/layout *\(location *= *0\) *out/g),s=-1!==t.indexOf("#define DUAL_SOURCE_BLENDING");s&&(e="#extension GL_EXT_blend_func_extended : require\n"+e),e=(e=(e=(e=(e=(e=(e=e.replace(/texture2DLodEXT\s*\(/g,"textureLod(")).replace(/textureCubeLodEXT\s*\(/g,"textureLod(")).replace(/textureCube\s*\(/g,"texture(")).replace(/gl_FragDepthEXT/g,"gl_FragDepth")).replace(/gl_FragColor/g,"glFragColor")).replace(/gl_FragData/g,"glFragData")).replace(/void\s+?main\s*\(/g,(i||r?"":s?"layout(location = 0, index = 0) out vec4 glFragColor;\nlayout(location = 0, index = 1) out vec4 glFragColor2;\n":"layout(location = 0) out vec4 glFragColor;\n")+"void main(")}else if(t.indexOf("#define VERTEXOUTPUT_INVARIANT")>=0&&(e="invariant gl_Position;\n"+e),-1!==t.indexOf("#define MULTIVIEW"))return"#extension GL_OVR_multiview2 : require\nlayout (num_views = 2) in;\n"+e;return e}}],29485)},20483,e=>{"use strict";var t=e.i(24574);class r extends t.DataBuffer{constructor(e){super(),this._buffer=e}get underlyingResource(){return this._buffer}}e.s(["WebGLDataBuffer",0,r])},71379,40462,79814,e=>{"use strict";var t,r,i,s,a,n,_,l,h=e.i(99904),u=e.i(8881),o=e.i(76535),c=e.i(18064),g=e.i(13379),f=e.i(64545),d=e.i(30419),E=e.i(29485),T=e.i(20483),R=e.i(68179);class p{get underlyingResource(){return this._webGLTexture}constructor(e=null,t){if(this._MSAARenderBuffers=null,this._context=t,!e&&!(e=t.createTexture()))throw Error("Unable to create webGL texture");this.set(e)}setUsage(){}set(e){this._webGLTexture=e}reset(){this._webGLTexture=null,this._MSAARenderBuffers=null}addMSAARenderBuffer(e){this._MSAARenderBuffers||(this._MSAARenderBuffers=[]),this._MSAARenderBuffers.push(e)}releaseMSAARenderBuffers(){if(this._MSAARenderBuffers){for(let e of this._MSAARenderBuffers)this._context.deleteRenderbuffer(e);this._MSAARenderBuffers=null}}getMSAARenderBuffer(e=0){return this._MSAARenderBuffers?.[e]??null}release(){this.releaseMSAARenderBuffers(),this._webGLTexture&&this._context.deleteTexture(this._webGLTexture),this.reset()}}e.s(["WebGLHardwareTexture",0,p],40462);var A=e.i(84201),x=e.i(75017),S=e.i(28799);function b(e){return 13===e||14===e||15===e||16===e||17===e||18===e||19===e}function m(e){return 13===e||17===e||18===e||19===e}e.s(["HasStencilAspect",0,m,"IsDepthTexture",0,b],79814);var B=e.i(41520),C=e.i(75405);class P{}class L extends o.AbstractEngine{get name(){return this._name}set name(e){this._name=e}get version(){return this._webGLVersion}static get ShadersRepository(){return h.Effect.ShadersRepository}static set ShadersRepository(e){h.Effect.ShadersRepository=e}get supportsUniformBuffers(){return this.webGLVersion>1&&!this.disableUniformBuffers}get needPOTTextures(){return this._webGLVersion<2||this.forcePOTTextures}get _supportsHardwareTextureRescaling(){return!1}set framebufferDimensionsObject(e){this._framebufferDimensionsObject=e}snapshotRenderingReset(){this.snapshotRendering=!1}constructor(e,t,r,i){let s;if(r=r||{},super(t??r.antialias,r,i),this._name="WebGL",this.forcePOTTextures=!1,this.validateShaderPrograms=!1,this.disableUniformBuffers=!1,this._webGLVersion=1,this._vertexAttribArraysEnabled=[],this._uintIndicesCurrentlySet=!1,this._currentBoundBuffer=[],this._currentFramebuffer=null,this._dummyFramebuffer=null,this._currentBufferPointers=[],this._currentInstanceLocations=[],this._currentInstanceBuffers=[],this._vaoRecordInProgress=!1,this._mustWipeVertexAttributes=!1,this._nextFreeTextureSlots=[],this._maxSimultaneousTextures=0,this._maxMSAASamplesOverride=null,this._unpackFlipYCached=null,this.enableUnpackFlipYCached=!0,this._boundUniforms={},!e)return;if(e.getContext){if(s=e,void 0===r.preserveDrawingBuffer&&(r.preserveDrawingBuffer=!1),void 0===r.xrCompatible&&(r.xrCompatible=!1),navigator&&navigator.userAgent){this._setupMobileChecks();const e=navigator.userAgent;for(const t of L.ExceptionList){const i=t.key,s=t.targets;if(new RegExp(i).test(e)){if(t.capture&&t.captureConstraint){const r=t.capture,i=t.captureConstraint,s=new RegExp(r).exec(e);if(s&&s.length>0&&parseInt(s[s.length-1])>=i)continue}for(const e of s)switch(e){case"uniformBuffer":this.disableUniformBuffers=!0;break;case"vao":this.disableVertexArrayObjects=!0;break;case"antialias":r.antialias=!1;break;case"maxMSAASamples":this._maxMSAASamplesOverride=1}}}}if(this._doNotHandleContextLost?this._onContextLost=()=>{(0,u.deleteStateObject)(this._gl)}:(this._onContextLost=e=>{e.preventDefault(),this._contextWasLost=!0,(0,u.deleteStateObject)(this._gl),g.Logger.Warn("WebGL context lost."),this.onContextLostObservable.notifyObservers(this)},this._onContextRestored=()=>{this._restoreEngineAfterContextLost(()=>this._initGLContext())},s.addEventListener("webglcontextrestored",this._onContextRestored,!1),r.powerPreference=r.powerPreference||"high-performance"),s.addEventListener("webglcontextlost",this._onContextLost,!1),this._badDesktopOS&&(r.xrCompatible=!1),!r.disableWebGL2Support)try{this._gl=s.getContext("webgl2",r)||s.getContext("experimental-webgl2",r),this._gl&&(this._webGLVersion=2,this._shaderPlatformName="WEBGL2",this._gl.deleteQuery||(this._webGLVersion=1,this._shaderPlatformName="WEBGL1"))}catch(e){}if(!this._gl){if(!s)throw Error("The provided canvas is null or undefined.");try{this._gl=s.getContext("webgl",r)||s.getContext("experimental-webgl",r)}catch(e){throw Error("WebGL not supported",{cause:e})}}if(!this._gl)throw Error("WebGL not supported")}else{this._gl=e,s=this._gl.canvas,this._gl.renderbufferStorageMultisample?(this._webGLVersion=2,this._shaderPlatformName="WEBGL2"):this._shaderPlatformName="WEBGL1";const t=this._gl.getContextAttributes();t&&(r.stencil=t.stencil)}this._sharedInit(s),this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,this._gl.NONE),void 0!==r.useHighPrecisionFloats&&(this._highPrecisionShadersAllowed=r.useHighPrecisionFloats),this.resize(),this._initGLContext(),this._initFeatures();for(let e=0;e<this._caps.maxVertexAttribs;e++)this._currentBufferPointers[e]=new P;this._shaderProcessor=this.webGLVersion>1?new E.WebGL2ShaderProcessor:new d.WebGLShaderProcessor;const a=`Babylon.js v${L.Version}`;g.Logger.Log(a+` - ${this.description}`),this._renderingCanvas&&this._renderingCanvas.setAttribute&&this._renderingCanvas.setAttribute("data-engine",a);const n=(0,u.getStateObject)(this._gl);n.validateShaderPrograms=this.validateShaderPrograms,n.parallelShaderCompile=this._caps.parallelShaderCompile}_clearEmptyResources(){this._dummyFramebuffer=null,super._clearEmptyResources()}_getShaderProcessingContext(e){return null}areAllEffectsReady(){for(let e in this._compiledEffects)if(!this._compiledEffects[e].isReady())return!1;return!0}_initGLContext(){this._caps={maxTexturesImageUnits:this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS),maxCombinedTexturesImageUnits:this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),maxVertexTextureImageUnits:this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),maxSamples:this._webGLVersion>1?this._gl.getParameter(this._gl.MAX_SAMPLES):1,maxCubemapTextureSize:this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE),maxRenderTextureSize:this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE),maxVertexAttribs:this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS),maxVaryingVectors:this._gl.getParameter(this._gl.MAX_VARYING_VECTORS),maxFragmentUniformVectors:this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS),maxVertexUniformVectors:this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS),shaderFloatPrecision:0,parallelShaderCompile:this._gl.getExtension("KHR_parallel_shader_compile")||void 0,standardDerivatives:this._webGLVersion>1||null!==this._gl.getExtension("OES_standard_derivatives"),maxAnisotropy:1,astc:this._gl.getExtension("WEBGL_compressed_texture_astc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_astc"),bptc:this._gl.getExtension("EXT_texture_compression_bptc")||this._gl.getExtension("WEBKIT_EXT_texture_compression_bptc"),s3tc:this._gl.getExtension("WEBGL_compressed_texture_s3tc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"),s3tc_srgb:this._gl.getExtension("WEBGL_compressed_texture_s3tc_srgb")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc_srgb"),pvrtc:this._gl.getExtension("WEBGL_compressed_texture_pvrtc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:this._gl.getExtension("WEBGL_compressed_texture_etc1")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc1"),etc2:this._gl.getExtension("WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBGL_compressed_texture_es3_0"),textureAnisotropicFilterExtension:this._gl.getExtension("EXT_texture_filter_anisotropic")||this._gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||this._gl.getExtension("MOZ_EXT_texture_filter_anisotropic"),uintIndices:this._webGLVersion>1||null!==this._gl.getExtension("OES_element_index_uint"),fragmentDepthSupported:this._webGLVersion>1||null!==this._gl.getExtension("EXT_frag_depth"),highPrecisionShaderSupported:!1,timerQuery:this._gl.getExtension("EXT_disjoint_timer_query_webgl2")||this._gl.getExtension("EXT_disjoint_timer_query"),supportOcclusionQuery:this._webGLVersion>1,canUseTimestampForTimerQuery:!1,drawBuffersExtension:!1,maxMSAASamples:1,colorBufferFloat:!!(this._webGLVersion>1&&this._gl.getExtension("EXT_color_buffer_float")),blendFloat:null!==this._gl.getExtension("EXT_float_blend"),supportFloatTexturesResolve:!1,rg11b10ufColorRenderable:!1,colorBufferHalfFloat:!!(this._webGLVersion>1&&this._gl.getExtension("EXT_color_buffer_half_float")),textureFloat:!!(this._webGLVersion>1||this._gl.getExtension("OES_texture_float")),textureHalfFloat:!!(this._webGLVersion>1||this._gl.getExtension("OES_texture_half_float")),textureHalfFloatRender:!1,textureFloatLinearFiltering:!1,textureFloatRender:!1,textureHalfFloatLinearFiltering:!1,vertexArrayObject:!1,instancedArrays:!1,textureLOD:!!(this._webGLVersion>1||this._gl.getExtension("EXT_shader_texture_lod")),texelFetch:1!==this._webGLVersion,blendMinMax:!1,multiview:this._gl.getExtension("OVR_multiview2"),oculusMultiview:this._gl.getExtension("OCULUS_multiview"),depthTextureExtension:!1,canUseGLInstanceID:this._webGLVersion>1,canUseGLVertexID:this._webGLVersion>1,supportComputeShaders:!1,supportSRGBBuffers:!1,supportTransformFeedbacks:this._webGLVersion>1,textureMaxLevel:this._webGLVersion>1,texture2DArrayMaxLayerCount:this._webGLVersion>1?this._gl.getParameter(this._gl.MAX_ARRAY_TEXTURE_LAYERS):128,disableMorphTargetTexture:!1,textureNorm16:!!this._gl.getExtension("EXT_texture_norm16"),blendParametersPerTarget:!1,dualSourceBlending:!1,supportReadWriteStorageTextures:!1},this._caps.supportFloatTexturesResolve=this._caps.colorBufferFloat,this._caps.rg11b10ufColorRenderable=this._caps.colorBufferFloat,this._glVersion=this._gl.getParameter(this._gl.VERSION);let e=this._gl.getExtension("WEBGL_debug_renderer_info");null!=e&&(this._glRenderer=this._gl.getParameter(e.UNMASKED_RENDERER_WEBGL),this._glVendor=this._gl.getParameter(e.UNMASKED_VENDOR_WEBGL)),this._glVendor||(this._glVendor=this._gl.getParameter(this._gl.VENDOR)||"Unknown vendor"),this._glRenderer||(this._glRenderer=this._gl.getParameter(this._gl.RENDERER)||"Unknown renderer"),36193!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=36193),34842!==this._gl.RGBA16F&&(this._gl.RGBA16F=34842),34836!==this._gl.RGBA32F&&(this._gl.RGBA32F=34836),35056!==this._gl.DEPTH24_STENCIL8&&(this._gl.DEPTH24_STENCIL8=35056),this._caps.timerQuery&&(1===this._webGLVersion&&(this._gl.getQuery=this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery)),this._caps.canUseTimestampForTimerQuery=(this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT,this._caps.timerQuery.QUERY_COUNTER_BITS_EXT)??0)>0),this._caps.maxAnisotropy=this._caps.textureAnisotropicFilterExtension?this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,this._caps.textureFloatLinearFiltering=!!(this._caps.textureFloat&&this._gl.getExtension("OES_texture_float_linear")),this._caps.textureFloatRender=!!(this._caps.textureFloat&&this._canRenderToFloatFramebuffer()),this._caps.textureHalfFloatLinearFiltering=!!(this._webGLVersion>1||this._caps.textureHalfFloat&&this._gl.getExtension("OES_texture_half_float_linear")),this._caps.textureNorm16&&(this._gl.R16_EXT=33322,this._gl.RG16_EXT=33324,this._gl.RGB16_EXT=32852,this._gl.RGBA16_EXT=32859,this._gl.R16_SNORM_EXT=36760,this._gl.RG16_SNORM_EXT=36761,this._gl.RGB16_SNORM_EXT=36762,this._gl.RGBA16_SNORM_EXT=36763);let t=this._gl.getExtension("OES_draw_buffers_indexed");if(this._caps.blendParametersPerTarget=!!t,this._alphaState=new B.AlphaState(this._caps.blendParametersPerTarget),t&&(this._gl.blendEquationSeparateIndexed=t.blendEquationSeparateiOES.bind(t),this._gl.blendEquationIndexed=t.blendEquationiOES.bind(t),this._gl.blendFuncSeparateIndexed=t.blendFuncSeparateiOES.bind(t),this._gl.blendFuncIndexed=t.blendFunciOES.bind(t),this._gl.colorMaskIndexed=t.colorMaskiOES.bind(t),this._gl.disableIndexed=t.disableiOES.bind(t),this._gl.enableIndexed=t.enableiOES.bind(t)),this._caps.dualSourceBlending=!!this._gl.getExtension("WEBGL_blend_func_extended"),this._caps.astc&&(this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR),this._caps.bptc&&(this._gl.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=this._caps.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT),this._caps.s3tc_srgb&&(this._gl.COMPRESSED_SRGB_S3TC_DXT1_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_S3TC_DXT1_EXT,this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT),this._caps.etc2&&(this._gl.COMPRESSED_SRGB8_ETC2=this._caps.etc2.COMPRESSED_SRGB8_ETC2,this._gl.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=this._caps.etc2.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC),this._webGLVersion>1&&5131!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=5131),this._caps.textureHalfFloatRender=this._caps.textureHalfFloat&&this._canRenderToHalfFloatFramebuffer(),this._webGLVersion>1)this._caps.drawBuffersExtension=!0,this._caps.maxMSAASamples=null!==this._maxMSAASamplesOverride?this._maxMSAASamplesOverride:this._gl.getParameter(this._gl.MAX_SAMPLES),this._caps.maxDrawBuffers=this._gl.getParameter(this._gl.MAX_DRAW_BUFFERS);else{let e=this._gl.getExtension("WEBGL_draw_buffers");if(null!==e){this._caps.drawBuffersExtension=!0,this._gl.drawBuffers=e.drawBuffersWEBGL.bind(e),this._caps.maxDrawBuffers=this._gl.getParameter(e.MAX_DRAW_BUFFERS_WEBGL),this._gl.DRAW_FRAMEBUFFER=this._gl.FRAMEBUFFER;for(let t=0;t<16;t++)this._gl["COLOR_ATTACHMENT"+t+"_WEBGL"]=e["COLOR_ATTACHMENT"+t+"_WEBGL"]}}if(this._webGLVersion>1)this._caps.depthTextureExtension=!0;else{let e=this._gl.getExtension("WEBGL_depth_texture");null!=e&&(this._caps.depthTextureExtension=!0,this._gl.UNSIGNED_INT_24_8=e.UNSIGNED_INT_24_8_WEBGL)}if(this.disableVertexArrayObjects)this._caps.vertexArrayObject=!1;else if(this._webGLVersion>1)this._caps.vertexArrayObject=!0;else{let e=this._gl.getExtension("OES_vertex_array_object");null!=e&&(this._caps.vertexArrayObject=!0,this._gl.createVertexArray=e.createVertexArrayOES.bind(e),this._gl.bindVertexArray=e.bindVertexArrayOES.bind(e),this._gl.deleteVertexArray=e.deleteVertexArrayOES.bind(e))}if(this._webGLVersion>1)this._caps.instancedArrays=!0;else{let e=this._gl.getExtension("ANGLE_instanced_arrays");null!=e?(this._caps.instancedArrays=!0,this._gl.drawArraysInstanced=e.drawArraysInstancedANGLE.bind(e),this._gl.drawElementsInstanced=e.drawElementsInstancedANGLE.bind(e),this._gl.vertexAttribDivisor=e.vertexAttribDivisorANGLE.bind(e)):this._caps.instancedArrays=!1}if(this._gl.getShaderPrecisionFormat){let e=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.HIGH_FLOAT),t=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.HIGH_FLOAT);if(e&&t&&(this._caps.highPrecisionShaderSupported=0!==e.precision&&0!==t.precision,this._caps.shaderFloatPrecision=Math.min(e.precision,t.precision)),!this._shouldUseHighPrecisionShader){let e=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.MEDIUM_FLOAT),t=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.MEDIUM_FLOAT);e&&t&&(this._caps.shaderFloatPrecision=Math.min(e.precision,t.precision))}this._caps.shaderFloatPrecision<10&&(this._caps.shaderFloatPrecision=10)}if(this._webGLVersion>1)this._caps.blendMinMax=!0;else{let e=this._gl.getExtension("EXT_blend_minmax");null!=e&&(this._caps.blendMinMax=!0,this._gl.MAX=e.MAX_EXT,this._gl.MIN=e.MIN_EXT)}if(!this._caps.supportSRGBBuffers){if(this._webGLVersion>1)this._caps.supportSRGBBuffers=!0,this._glSRGBExtensionValues={SRGB:WebGL2RenderingContext.SRGB,SRGB8:WebGL2RenderingContext.SRGB8,SRGB8_ALPHA8:WebGL2RenderingContext.SRGB8_ALPHA8};else{let e=this._gl.getExtension("EXT_sRGB");null!=e&&(this._caps.supportSRGBBuffers=!0,this._glSRGBExtensionValues={SRGB:e.SRGB_EXT,SRGB8:e.SRGB_ALPHA_EXT,SRGB8_ALPHA8:e.SRGB_ALPHA_EXT})}if(this._creationOptions){let e=this._creationOptions.forceSRGBBufferSupportState;void 0!==e&&(this._caps.supportSRGBBuffers=this._caps.supportSRGBBuffers&&e)}}this._depthCullingState.depthTest=!0,this._depthCullingState.depthFunc=this._gl.LEQUAL,this._depthCullingState.depthMask=!0,this._maxSimultaneousTextures=this._caps.maxCombinedTexturesImageUnits;for(let e=0;e<this._maxSimultaneousTextures;e++)this._nextFreeTextureSlots.push(e);"Mali-G72"===this._glRenderer&&(this._caps.disableMorphTargetTexture=!0)}_initFeatures(){this._features={forceBitmapOverHTMLImageElement:"u"<typeof HTMLImageElement,supportRenderAndCopyToLodForFloatTextures:1!==this._webGLVersion,supportDepthStencilTexture:1!==this._webGLVersion,supportShadowSamplers:1!==this._webGLVersion,uniformBufferHardCheckMatrix:!1,allowTexturePrefiltering:1!==this._webGLVersion,trackUbosInFrame:!1,checkUbosContentBeforeUpload:!1,supportCSM:1!==this._webGLVersion,basisNeedsPOT:1===this._webGLVersion,support3DTextures:1!==this._webGLVersion,needTypeSuffixInShaderConstants:1!==this._webGLVersion,supportMSAA:1!==this._webGLVersion,supportSSAO2:1!==this._webGLVersion,supportIBLShadows:1!==this._webGLVersion,supportExtendedTextureFormats:1!==this._webGLVersion,supportSwitchCaseInShader:1!==this._webGLVersion,supportSyncTextureRead:!0,needsInvertingBitmap:!0,useUBOBindingCache:!0,needShaderCodeInlining:!1,needToAlwaysBindUniformBuffers:!1,supportRenderPasses:!1,supportSpriteInstancing:!0,forceVertexBufferStrideAndOffsetMultiple4Bytes:!1,_checkNonFloatVertexBuffersDontRecreatePipelineContext:!1}}get webGLVersion(){return this._webGLVersion}getClassName(){return"ThinEngine"}_prepareWorkingCanvas(){if(this._workingCanvas)return;this._workingCanvas=this.createCanvas(1,1);let e=this._workingCanvas.getContext("2d");e&&(this._workingContext=e)}getInfo(){return this.getGlInfo()}getGlInfo(){return{vendor:this._glVendor,renderer:this._glRenderer,version:this._glVersion}}extractDriverInfo(){let e=this.getGlInfo();return e&&e.renderer?e.renderer:""}getRenderWidth(e=!1){return!e&&this._currentRenderTarget?this._currentRenderTarget.width:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferWidth:this._gl.drawingBufferWidth}getRenderHeight(e=!1){return!e&&this._currentRenderTarget?this._currentRenderTarget.height:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferHeight:this._gl.drawingBufferHeight}clear(e,t,r,i=!1,s=0){let a=this.stencilStateComposer.useStencilGlobalOnly;this.stencilStateComposer.useStencilGlobalOnly=!0,this.applyStates(),this.stencilStateComposer.useStencilGlobalOnly=a;let n=0;if(t&&e){let t=!0;if(this._currentRenderTarget){let r=this._currentRenderTarget.texture?.format;if(8===r||9===r||10===r||11===r){let r=this._currentRenderTarget.texture?.type;7===r||5===r?(L._TempClearColorUint32[0]=255*e.r,L._TempClearColorUint32[1]=255*e.g,L._TempClearColorUint32[2]=255*e.b,L._TempClearColorUint32[3]=255*e.a,this._gl.clearBufferuiv(this._gl.COLOR,0,L._TempClearColorUint32)):(L._TempClearColorInt32[0]=255*e.r,L._TempClearColorInt32[1]=255*e.g,L._TempClearColorInt32[2]=255*e.b,L._TempClearColorInt32[3]=255*e.a,this._gl.clearBufferiv(this._gl.COLOR,0,L._TempClearColorInt32)),t=!1}}t&&(this._gl.clearColor(e.r,e.g,e.b,void 0!==e.a?e.a:1),n|=this._gl.COLOR_BUFFER_BIT)}r&&(this.useReverseDepthBuffer?(this._depthCullingState.depthFunc=this._gl.GEQUAL,this._gl.clearDepth(0)):this._gl.clearDepth(1),n|=this._gl.DEPTH_BUFFER_BIT),i&&(this._gl.clearStencil(s),n|=this._gl.STENCIL_BUFFER_BIT),this._gl.clear(n)}_viewport(e,t,r,i){(e!==this._viewportCached.x||t!==this._viewportCached.y||r!==this._viewportCached.z||i!==this._viewportCached.w)&&(this._viewportCached.x=e,this._viewportCached.y=t,this._viewportCached.z=r,this._viewportCached.w=i,this._gl.viewport(e,t,r,i))}endFrame(){super.endFrame(),this._badOS&&this.flushFramebuffer()}get performanceMonitor(){throw Error("Not Supported by ThinEngine")}bindFramebuffer(e,t=0,r,i,s,a=0,n=0){this._currentRenderTarget&&this._resolveAndGenerateMipMapsFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,this._bindUnboundFramebuffer(e._framebuffer);let _=this._gl;e.isMulti||(e.is2DArray||e.is3D?(_.framebufferTextureLayer(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,e.texture._hardwareTexture?.underlyingResource,a,n),e._currentLOD=a):e.isCube?_.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_CUBE_MAP_POSITIVE_X+t,e.texture._hardwareTexture?.underlyingResource,a):e._currentLOD!==a&&(_.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_2D,e.texture._hardwareTexture?.underlyingResource,a),e._currentLOD=a));let l=e._depthStencilTexture;if(l){e.is3D&&(e.texture.width!==l.width||e.texture.height!==l.height||e.texture.depth!==l.depth)&&g.Logger.Warn("Depth/Stencil attachment for 3D target must have same dimensions as color attachment");let r=e._depthStencilTextureWithStencil?_.DEPTH_STENCIL_ATTACHMENT:_.DEPTH_ATTACHMENT;e.is2DArray||e.is3D?_.framebufferTextureLayer(_.FRAMEBUFFER,r,l._hardwareTexture?.underlyingResource,a,n):e.isCube?_.framebufferTexture2D(_.FRAMEBUFFER,r,_.TEXTURE_CUBE_MAP_POSITIVE_X+t,l._hardwareTexture?.underlyingResource,a):_.framebufferTexture2D(_.FRAMEBUFFER,r,_.TEXTURE_2D,l._hardwareTexture?.underlyingResource,a)}e._MSAAFramebuffer&&this._bindUnboundFramebuffer(e._MSAAFramebuffer),this._cachedViewport&&!s?this.setViewport(this._cachedViewport,r,i):(!r&&(r=e.width,a&&(r/=Math.pow(2,a))),!i&&(i=e.height,a&&(i/=Math.pow(2,a))),this._viewport(0,0,r,i)),this.wipeCaches()}setStateCullFaceType(e,t){let r=this.cullBackFaces??e??!0?this._gl.BACK:this._gl.FRONT;(this._depthCullingState.cullFace!==r||t)&&(this._depthCullingState.cullFace=r)}setState(e,t=0,r,i=!1,s,a,n=0){(this._depthCullingState.cull!==e||r)&&(this._depthCullingState.cull=e),this.setStateCullFaceType(s,r),this.setZOffset(t),this.setZOffsetUnits(n);let _=i?this._gl.CW:this._gl.CCW;(this._depthCullingState.frontFace!==_||r)&&(this._depthCullingState.frontFace=_),this._stencilStateComposer.stencilMaterial=a}_resolveAndGenerateMipMapsFramebuffer(e,t=!1){e.disableAutomaticMSAAResolve||(e.isMulti?this.resolveMultiFramebuffer(e):this.resolveFramebuffer(e)),t||(e.isMulti?this.generateMipMapsMultiFramebuffer(e):this.generateMipMapsFramebuffer(e))}_bindUnboundFramebuffer(e){this._currentFramebuffer!==e&&(this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,e),this._currentFramebuffer=e)}_currentFrameBufferIsDefaultFrameBuffer(){return null===this._currentFramebuffer}generateMipmaps(e){let t=this._getTextureTarget(e);this._bindTextureDirectly(t,e,!0),this._gl.generateMipmap(t),this._bindTextureDirectly(t,null)}unBindFramebuffer(e,t,r){this._currentRenderTarget=null,this._resolveAndGenerateMipMapsFramebuffer(e,t),r&&(e._MSAAFramebuffer&&this._bindUnboundFramebuffer(e._framebuffer),r()),this._bindUnboundFramebuffer(null)}generateMipMapsFramebuffer(e){!e.isMulti&&e.texture?.generateMipMaps&&!e.isCube&&this.generateMipmaps(e.texture)}resolveFramebuffer(e){let t=this._gl;if(!e._MSAAFramebuffer||e.isMulti)return;let r=e.resolveMSAAColors?t.COLOR_BUFFER_BIT:0;r|=e._generateDepthBuffer&&e.resolveMSAADepth?t.DEPTH_BUFFER_BIT:0,r|=e._generateStencilBuffer&&e.resolveMSAAStencil?t.STENCIL_BUFFER_BIT:0,t.bindFramebuffer(t.READ_FRAMEBUFFER,e._MSAAFramebuffer),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,e._framebuffer),t.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,r,t.NEAREST)}flushFramebuffer(){this._gl.flush()}restoreDefaultFramebuffer(){this._currentRenderTarget?this.unBindFramebuffer(this._currentRenderTarget):this._bindUnboundFramebuffer(null),this._cachedViewport&&this.setViewport(this._cachedViewport),this.wipeCaches()}_resetVertexBufferBinding(){this.bindArrayBuffer(null),this._cachedVertexBuffers=null}createVertexBuffer(e,t,r){return this._createVertexBuffer(e,this._gl.STATIC_DRAW)}_createVertexBuffer(e,t){let r=this._gl.createBuffer();if(!r)throw Error("Unable to create vertex buffer");let i=new T.WebGLDataBuffer(r);return this.bindArrayBuffer(i),"number"!=typeof e?e instanceof Array?(this._gl.bufferData(this._gl.ARRAY_BUFFER,new Float32Array(e),t),i.capacity=4*e.length):(this._gl.bufferData(this._gl.ARRAY_BUFFER,e,t),i.capacity=e.byteLength):(this._gl.bufferData(this._gl.ARRAY_BUFFER,new Uint8Array(e),t),i.capacity=e),this._resetVertexBufferBinding(),i.references=1,i}createDynamicVertexBuffer(e,t){return this._createVertexBuffer(e,this._gl.DYNAMIC_DRAW)}_resetIndexBufferBinding(){this.bindIndexBuffer(null),this._cachedIndexBuffer=null}createIndexBuffer(e,t,r){let i=this._gl.createBuffer(),s=new T.WebGLDataBuffer(i);if(!i)throw Error("Unable to create index buffer");this.bindIndexBuffer(s);let a=this._normalizeIndexData(e);return this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,a,t?this._gl.DYNAMIC_DRAW:this._gl.STATIC_DRAW),this._resetIndexBufferBinding(),s.references=1,s.is32Bits=4===a.BYTES_PER_ELEMENT,s}_normalizeIndexData(e){if(2===e.BYTES_PER_ELEMENT)return e;if(this._caps.uintIndices){if(e instanceof Uint32Array)return e;else for(let t=0;t<e.length;t++)if(e[t]>=65535)return new Uint32Array(e)}return new Uint16Array(e)}bindArrayBuffer(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this._bindBuffer(e,this._gl.ARRAY_BUFFER)}bindUniformBlock(e,t,r){let i=e.program,s=this._gl.getUniformBlockIndex(i,t);this._gl.uniformBlockBinding(i,s,r)}bindIndexBuffer(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this._bindBuffer(e,this._gl.ELEMENT_ARRAY_BUFFER)}_bindBuffer(e,t){(this._vaoRecordInProgress||this._currentBoundBuffer[t]!==e)&&(this._gl.bindBuffer(t,e?e.underlyingResource:null),this._currentBoundBuffer[t]=e)}updateArrayBuffer(e){this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,e)}_vertexAttribPointer(e,t,r,i,s,a,n){let _=this._currentBufferPointers[t];if(!_)return;let l=!1;_.active?(_.buffer!==e&&(_.buffer=e,l=!0),_.size!==r&&(_.size=r,l=!0),_.type!==i&&(_.type=i,l=!0),_.normalized!==s&&(_.normalized=s,l=!0),_.stride!==a&&(_.stride=a,l=!0),_.offset!==n&&(_.offset=n,l=!0)):(l=!0,_.active=!0,_.index=t,_.size=r,_.type=i,_.normalized=s,_.stride=a,_.offset=n,_.buffer=e),(l||this._vaoRecordInProgress)&&(this.bindArrayBuffer(e),i===this._gl.UNSIGNED_INT||i===this._gl.INT?this._gl.vertexAttribIPointer(t,r,i,a,n):this._gl.vertexAttribPointer(t,r,i,s,a,n))}_bindIndexBufferWithCache(e){null!=e&&this._cachedIndexBuffer!==e&&(this._cachedIndexBuffer=e,this.bindIndexBuffer(e),this._uintIndicesCurrentlySet=e.is32Bits)}_bindVertexBuffersAttributes(e,t,r){let i=t.getAttributesNames();this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.unbindAllAttributes();for(let s=0;s<i.length;s++){let a=t.getAttributeLocation(s);if(a>=0){let t=i[s],n=null;if(r&&(n=r[t]),n||(n=e[t]),!n)continue;this._gl.enableVertexAttribArray(a),this._vaoRecordInProgress||(this._vertexAttribArraysEnabled[a]=!0);let _=n.getBuffer();_&&(this._vertexAttribPointer(_,a,n.getSize(),n.type,n.normalized,n.byteStride,n.byteOffset),n.getIsInstanced()&&(this._gl.vertexAttribDivisor(a,n.getInstanceDivisor()),this._vaoRecordInProgress||(this._currentInstanceLocations.push(a),this._currentInstanceBuffers.push(_))))}}}recordVertexArrayObject(e,t,r,i){let s=this._gl.createVertexArray();if(!s)throw Error("Unable to create VAO");return this._vaoRecordInProgress=!0,this._gl.bindVertexArray(s),this._mustWipeVertexAttributes=!0,this._bindVertexBuffersAttributes(e,r,i),this.bindIndexBuffer(t),this._vaoRecordInProgress=!1,this._gl.bindVertexArray(null),s}bindVertexArrayObject(e,t){this._cachedVertexArrayObject!==e&&(this._cachedVertexArrayObject=e,this._gl.bindVertexArray(e),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._uintIndicesCurrentlySet=null!=t&&t.is32Bits,this._mustWipeVertexAttributes=!0)}bindBuffersDirectly(e,t,r,i,s){if(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==s){this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=s;let t=s.getAttributesCount();this._unbindVertexArrayObject(),this.unbindAllAttributes();let a=0;for(let n=0;n<t;n++)if(n<r.length){let t=s.getAttributeLocation(n);t>=0&&(this._gl.enableVertexAttribArray(t),this._vertexAttribArraysEnabled[t]=!0,this._vertexAttribPointer(e,t,r[n],this._gl.FLOAT,!1,i,a)),a+=4*r[n]}}this._bindIndexBufferWithCache(t)}_unbindVertexArrayObject(){this._cachedVertexArrayObject&&(this._cachedVertexArrayObject=null,this._gl.bindVertexArray(null))}bindBuffers(e,t,r,i){(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==r)&&(this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=r,this._bindVertexBuffersAttributes(e,r,i)),this._bindIndexBufferWithCache(t)}unbindInstanceAttributes(){let e;for(let t=0,r=this._currentInstanceLocations.length;t<r;t++){let r=this._currentInstanceBuffers[t];e!=r&&r.references&&(e=r,this.bindArrayBuffer(r));let i=this._currentInstanceLocations[t];this._gl.vertexAttribDivisor(i,0)}this._currentInstanceBuffers.length=0,this._currentInstanceLocations.length=0}releaseVertexArrayObject(e){this._gl.deleteVertexArray(e)}_releaseBuffer(e){return e.references--,0===e.references&&(this._deleteBuffer(e),!0)}_deleteBuffer(e){this._gl.deleteBuffer(e.underlyingResource)}updateAndBindInstancesBuffer(e,t,r){if(this.bindArrayBuffer(e),t&&this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,t),void 0!==r[0].index)this.bindInstancesBuffer(e,r,!0);else for(let t=0;t<4;t++){let i=r[t];this._vertexAttribArraysEnabled[i]||(this._gl.enableVertexAttribArray(i),this._vertexAttribArraysEnabled[i]=!0),this._vertexAttribPointer(e,i,4,this._gl.FLOAT,!1,64,16*t),this._gl.vertexAttribDivisor(i,1),this._currentInstanceLocations.push(i),this._currentInstanceBuffers.push(e)}}bindInstancesBuffer(e,t,r=!0){this.bindArrayBuffer(e);let i=0;if(r)for(let e=0;e<t.length;e++)i+=4*t[e].attributeSize;for(let r=0;r<t.length;r++){let s=t[r];void 0===s.index&&(s.index=this._currentEffect.getAttributeLocationByName(s.attributeName)),s.index<0||(this._vertexAttribArraysEnabled[s.index]||(this._gl.enableVertexAttribArray(s.index),this._vertexAttribArraysEnabled[s.index]=!0),this._vertexAttribPointer(e,s.index,s.attributeSize,s.attributeType||this._gl.FLOAT,s.normalized||!1,i,s.offset),this._gl.vertexAttribDivisor(s.index,void 0===s.divisor?1:s.divisor),this._currentInstanceLocations.push(s.index),this._currentInstanceBuffers.push(e))}}disableInstanceAttributeByName(e){if(!this._currentEffect)return;let t=this._currentEffect.getAttributeLocationByName(e);this.disableInstanceAttribute(t)}disableInstanceAttribute(e){let t,r=!1;for(;-1!==(t=this._currentInstanceLocations.indexOf(e));)this._currentInstanceLocations.splice(t,1),this._currentInstanceBuffers.splice(t,1),r=!0;r&&(this._gl.vertexAttribDivisor(e,0),this.disableAttributeByIndex(e))}disableAttributeByIndex(e){this._gl.disableVertexAttribArray(e),this._vertexAttribArraysEnabled[e]=!1,this._currentBufferPointers[e].active=!1}draw(e,t,r,i){this.drawElementsType(+!e,t,r,i)}drawPointClouds(e,t,r){this.drawArraysType(2,e,t,r)}drawUnIndexed(e,t,r,i){this.drawArraysType(+!e,t,r,i)}drawElementsType(e,t,r,i){this.applyStates(),this._reportDrawCall();let s=this._drawMode(e),a=this._uintIndicesCurrentlySet?this._gl.UNSIGNED_INT:this._gl.UNSIGNED_SHORT,n=this._uintIndicesCurrentlySet?4:2;i?this._gl.drawElementsInstanced(s,r,a,t*n,i):this._gl.drawElements(s,r,a,t*n)}drawArraysType(e,t,r,i){this.applyStates(),this._reportDrawCall();let s=this._drawMode(e);i?this._gl.drawArraysInstanced(s,t,r,i):this._gl.drawArrays(s,t,r)}_drawMode(e){switch(e){case 0:default:return this._gl.TRIANGLES;case 2:case 3:return this._gl.POINTS;case 1:case 4:return this._gl.LINES;case 5:return this._gl.LINE_LOOP;case 6:return this._gl.LINE_STRIP;case 7:return this._gl.TRIANGLE_STRIP;case 8:return this._gl.TRIANGLE_FAN}}_releaseEffect(e){this._compiledEffects[e._key]&&delete this._compiledEffects[e._key];let t=e.getPipelineContext();t&&this._deletePipelineContext(t)}_deletePipelineContext(e){e&&e.program&&(e.program.__SPECTOR_rebuildProgram=null,(0,S.resetCachedPipeline)(e),this._gl&&(this._currentProgram===e.program&&this._setProgram(null),this._gl.deleteProgram(e.program)))}_getGlobalDefines(e){return(0,x._GetGlobalDefines)(e,this.isNDCHalfZRange,this.useReverseDepthBuffer,this.useExactSrgbConversions)}createEffect(e,t,r,i,s,a,n,_,l,o=0,c){let g="string"==typeof e?e:e.vertexToken||e.vertexSource||e.vertexElement||e.vertex,f="string"==typeof e?e:e.fragmentToken||e.fragmentSource||e.fragmentElement||e.fragment,d=this._getGlobalDefines(),E=void 0!==t.attributes,T=s??t.defines??"";d&&(T+=d);let R=g+"+"+f+"@"+T;if(this._compiledEffects[R]){let e=this._compiledEffects[R];return n&&e.isReady()&&n(e),e._refCount++,e}this._gl&&(0,u.getStateObject)(this._gl);let p=new h.Effect(e,t,E?this:r,i,this,s,a,n,_,l,R,t.shaderLanguage??o,t.extraInitializationsAsync??c);return this._compiledEffects[R]=p,p}_getShaderSource(e){return this._gl.getShaderSource(e)}createRawShaderProgram(e,t,r,i,s=null){let a=(0,u.getStateObject)(this._gl);return a._contextWasLost=this._contextWasLost,a.validateShaderPrograms=this.validateShaderPrograms,(0,u.createRawShaderProgram)(e,t,r,i||this._gl,s)}createShaderProgram(e,t,r,i,s,a=null){let n=(0,u.getStateObject)(this._gl);return n._contextWasLost=this._contextWasLost,n.validateShaderPrograms=this.validateShaderPrograms,(0,u.createShaderProgram)(e,t,r,i,s||this._gl,a)}inlineShaderCode(e){return e}createPipelineContext(e){this._gl&&((0,u.getStateObject)(this._gl).parallelShaderCompile=this._caps.parallelShaderCompile);let t=(0,u.createPipelineContext)(this._gl,e);return t.engine=this,t}createMaterialContext(){}createDrawContext(){}_finalizePipelineContext(e){return(0,u._finalizePipelineContext)(e,this._gl,this.validateShaderPrograms)}_preparePipelineContextAsync(e,t,r,i,s,a,n,_,l,h,o){let c=(0,u.getStateObject)(this._gl);return c._contextWasLost=this._contextWasLost,c.validateShaderPrograms=this.validateShaderPrograms,c._createShaderProgramInjection=this._createShaderProgram.bind(this),c.createRawShaderProgramInjection=this.createRawShaderProgram.bind(this),c.createShaderProgramInjection=this.createShaderProgram.bind(this),c.loadFileInjection=this._loadFile.bind(this),(0,u._preparePipelineContext)(e,t,r,i,s,a,n,_,l,h,o)}_createShaderProgram(e,t,r,i,s=null){return(0,u._createShaderProgram)(e,t,r,i,s)}_isRenderingStateCompiled(e){return!this._isDisposed&&(0,u._isRenderingStateCompiled)(e,this._gl,this.validateShaderPrograms)}_executeWhenRenderingStateIsCompiled(e,t){(0,u._executeWhenRenderingStateIsCompiled)(e,t)}getUniforms(e,t){let r=[];for(let i=0;i<t.length;i++)r.push(this._gl.getUniformLocation(e.program,t[i]));return r}getAttributes(e,t){let r=[];for(let i=0;i<t.length;i++)try{r.push(this._gl.getAttribLocation(e.program,t[i]))}catch(e){r.push(-1)}return r}enableEffect(e){(e=null!==e&&(0,c.IsWrapper)(e)?e.effect:e)&&e!==this._currentEffect&&(this._stencilStateComposer.stencilMaterial=void 0,this.bindSamplers(e),this._currentEffect=e,e.onBind&&e.onBind(e),e._onBindObservable&&e._onBindObservable.notifyObservers(e))}setInt(e,t){return!!e&&(this._gl.uniform1i(e,t),!0)}setInt2(e,t,r){return!!e&&(this._gl.uniform2i(e,t,r),!0)}setInt3(e,t,r,i){return!!e&&(this._gl.uniform3i(e,t,r,i),!0)}setInt4(e,t,r,i,s){return!!e&&(this._gl.uniform4i(e,t,r,i,s),!0)}setIntArray(e,t){return!!e&&(this._gl.uniform1iv(e,t),!0)}setIntArray2(e,t){return!!e&&t.length%2==0&&(this._gl.uniform2iv(e,t),!0)}setIntArray3(e,t){return!!e&&t.length%3==0&&(this._gl.uniform3iv(e,t),!0)}setIntArray4(e,t){return!!e&&t.length%4==0&&(this._gl.uniform4iv(e,t),!0)}setUInt(e,t){return!!e&&(this._gl.uniform1ui(e,t),!0)}setUInt2(e,t,r){return!!e&&(this._gl.uniform2ui(e,t,r),!0)}setUInt3(e,t,r,i){return!!e&&(this._gl.uniform3ui(e,t,r,i),!0)}setUInt4(e,t,r,i,s){return!!e&&(this._gl.uniform4ui(e,t,r,i,s),!0)}setUIntArray(e,t){return!!e&&(this._gl.uniform1uiv(e,t),!0)}setUIntArray2(e,t){return!!e&&t.length%2==0&&(this._gl.uniform2uiv(e,t),!0)}setUIntArray3(e,t){return!!e&&t.length%3==0&&(this._gl.uniform3uiv(e,t),!0)}setUIntArray4(e,t){return!!e&&t.length%4==0&&(this._gl.uniform4uiv(e,t),!0)}setArray(e,t){return!!e&&!(t.length<1)&&(this._gl.uniform1fv(e,t),!0)}setArray2(e,t){return!!e&&t.length%2==0&&(this._gl.uniform2fv(e,t),!0)}setArray3(e,t){return!!e&&t.length%3==0&&(this._gl.uniform3fv(e,t),!0)}setArray4(e,t){return!!e&&t.length%4==0&&(this._gl.uniform4fv(e,t),!0)}setMatrices(e,t){return!!e&&(this._gl.uniformMatrix4fv(e,!1,t),!0)}setMatrix3x3(e,t){return!!e&&(this._gl.uniformMatrix3fv(e,!1,t),!0)}setMatrix2x2(e,t){return!!e&&(this._gl.uniformMatrix2fv(e,!1,t),!0)}setFloat(e,t){return!!e&&(this._gl.uniform1f(e,t),!0)}setFloat2(e,t,r){return!!e&&(this._gl.uniform2f(e,t,r),!0)}setFloat3(e,t,r,i){return!!e&&(this._gl.uniform3f(e,t,r,i),!0)}setFloat4(e,t,r,i,s){return!!e&&(this._gl.uniform4f(e,t,r,i,s),!0)}applyStates(){if(this._depthCullingState.apply(this._gl),this._stencilStateComposer.apply(this._gl),this._alphaState.apply(this._gl,this._currentRenderTarget&&this._currentRenderTarget.textures?this._currentRenderTarget.textures.length:1),this._colorWriteChanged){this._colorWriteChanged=!1;let e=this._colorWrite;this._gl.colorMask(e,e,e,e)}}wipeCaches(e){(!this.preventCacheWipeBetweenFrames||e)&&(this._currentEffect=null,this._viewportCached.x=0,this._viewportCached.y=0,this._viewportCached.z=0,this._viewportCached.w=0,this._unbindVertexArrayObject(),e&&(this._currentProgram=null,this.resetTextureCache(),this._stencilStateComposer.reset(),this._depthCullingState.reset(),this._depthCullingState.depthFunc=this._gl.LEQUAL,this._alphaState.reset(),this._resetAlphaMode(),this._colorWrite=!0,this._colorWriteChanged=!0,this._unpackFlipYCached=null,this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,this._gl.NONE),this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),this._mustWipeVertexAttributes=!0,this.unbindAllAttributes()),this._resetVertexBufferBinding(),this._cachedIndexBuffer=null,this._cachedEffectForVertexBuffers=null,this.bindIndexBuffer(null))}_getSamplingParameters(e,t){let r=this._gl,i=r.NEAREST,s=r.NEAREST,a=!1;switch(e){case 11:i=r.LINEAR,s=t?r.LINEAR_MIPMAP_NEAREST:r.LINEAR;break;case 3:i=r.LINEAR,a=!0,s=t?r.LINEAR_MIPMAP_LINEAR:r.LINEAR;break;case 8:a=!0,i=r.NEAREST,s=t?r.NEAREST_MIPMAP_LINEAR:r.NEAREST;break;case 4:i=r.NEAREST,s=t?r.NEAREST_MIPMAP_NEAREST:r.NEAREST;break;case 5:i=r.NEAREST,s=t?r.LINEAR_MIPMAP_NEAREST:r.LINEAR;break;case 6:a=!0,i=r.NEAREST,s=t?r.LINEAR_MIPMAP_LINEAR:r.LINEAR;break;case 7:i=r.NEAREST,s=r.LINEAR;break;case 1:i=r.NEAREST,s=r.NEAREST;break;case 9:i=r.LINEAR,s=t?r.NEAREST_MIPMAP_NEAREST:r.NEAREST;break;case 10:a=!0,i=r.LINEAR,s=t?r.NEAREST_MIPMAP_LINEAR:r.NEAREST;break;case 2:i=r.LINEAR,s=r.LINEAR;break;case 12:i=r.LINEAR,s=r.NEAREST}return{min:s,mag:i,hasMipMaps:a}}_createTexture(){let e=this._gl.createTexture();if(!e)throw Error("Unable to create texture");return e}_createHardwareTexture(){return new p(this._createTexture(),this._gl)}_createInternalTexture(e,t,r=!0,i=0){let s,a,n=!1,_=0,l=3,h=5,u=!1,o=1,c=!1,f=0,d=!1;void 0!==t&&"object"==typeof t?(s=!!t.generateMipMaps,n=!!t.createMipMaps,_=void 0===t.type?0:t.type,l=void 0===t.samplingMode?3:t.samplingMode,h=void 0===t.format?5:t.format,u=void 0!==t.useSRGBBuffer&&t.useSRGBBuffer,o=t.samples??1,a=t.label,c=!!t.createMSAATexture,f=t.comparisonFunction||0,d=!!t.isCube):s=!!t,u&&(u=this._caps.supportSRGBBuffers&&(this.webGLVersion>1||this.isWebGPU)),(1!==_||this._caps.textureFloatLinearFiltering)&&(2!==_||this._caps.textureHalfFloatLinearFiltering)||(l=1),1!==_||this._caps.textureFloat||(_=0,g.Logger.Warn("Float textures are not supported. Type forced to TEXTURETYPE_UNSIGNED_BYTE"));let E=b(h),T=m(h),R=this._gl,p=new A.InternalTexture(this,i),x=e.width||e,S=e.height||e,B=e.depth||0,C=e.layers||0,P=this._getSamplingParameters(l,(s||n)&&!E),L=0!==C?R.TEXTURE_2D_ARRAY:0!==B?R.TEXTURE_3D:d?R.TEXTURE_CUBE_MAP:R.TEXTURE_2D,M=E?this._getInternalFormatFromDepthTextureFormat(h,!0,T):this._getRGBABufferInternalSizedFormat(_,h,u),G=E?T?R.DEPTH_STENCIL:R.DEPTH_COMPONENT:this._getInternalFormat(h),I=E?this._getWebGLTextureTypeFromDepthTextureFormat(h):this._getWebGLTextureType(_);if(this._bindTextureDirectly(L,p),0!==C)p.is2DArray=!0,R.texImage3D(L,0,M,x,S,C,0,G,I,null);else if(0!==B)p.is3D=!0,R.texImage3D(L,0,M,x,S,B,0,G,I,null);else if(d){p.isCube=!0;for(let e=0;e<6;e++)R.texImage2D(R.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,M,x,S,0,G,I,null)}else R.texImage2D(L,0,M,x,S,0,G,I,null);if(R.texParameteri(L,R.TEXTURE_MAG_FILTER,P.mag),R.texParameteri(L,R.TEXTURE_MIN_FILTER,P.min),R.texParameteri(L,R.TEXTURE_WRAP_S,R.CLAMP_TO_EDGE),R.texParameteri(L,R.TEXTURE_WRAP_T,R.CLAMP_TO_EDGE),E&&this.webGLVersion>1&&(0===f?(R.texParameteri(L,R.TEXTURE_COMPARE_FUNC,515),R.texParameteri(L,R.TEXTURE_COMPARE_MODE,R.NONE)):(R.texParameteri(L,R.TEXTURE_COMPARE_FUNC,f),R.texParameteri(L,R.TEXTURE_COMPARE_MODE,R.COMPARE_REF_TO_TEXTURE))),(s||n)&&this._gl.generateMipmap(L),this._bindTextureDirectly(L,null),p._useSRGBBuffer=u,p.baseWidth=x,p.baseHeight=S,p.width=x,p.height=S,p.depth=C||B,p.isReady=!0,p.samples=o,p.generateMipMaps=s,p.samplingMode=l,p.type=_,p.format=h,p.label=a,p.comparisonFunction=f,this._internalTexturesCache.push(p),c){let e;if(!(e=b(p.format)?this._setupFramebufferDepthAttachments(m(p.format),19!==p.format,p.width,p.height,o,p.format,!0):this._createRenderBuffer(p.width,p.height,o,-1,this._getRGBABufferInternalSizedFormat(p.type,p.format,p._useSRGBBuffer),-1)))throw Error("Unable to create render buffer");p._autoMSAAManagement=!0;let t=p._hardwareTexture;t||(t=p._hardwareTexture=this._createHardwareTexture()),t.addMSAARenderBuffer(e)}return p}_getUseSRGBBuffer(e,t){return e&&this._caps.supportSRGBBuffers&&(this.webGLVersion>1||t)}createTexture(e,t,r,i,s=3,a=null,n=null,_=null,l=null,h=null,u=null,o,c,g,f){return this._createTextureBase(e,t,r,i,s,a,n,(...e)=>this._prepareWebGLTexture(...e,h),(e,t,r,s,a,n)=>{let _=this._gl,l=r.width===e&&r.height===t;a._creationFlags=g??0;let h=this._getTexImageParametersForCreateTexture(a.format,a._useSRGBBuffer);if(l)return _.texImage2D(_.TEXTURE_2D,0,h.internalFormat,h.format,h.type,r),!1;let u=this._caps.maxTextureSize;if(r.width>u||r.height>u||!this._supportsHardwareTextureRescaling)return this._prepareWorkingCanvas(),!!this._workingCanvas&&!!this._workingContext&&(this._workingCanvas.width=e,this._workingCanvas.height=t,this._workingContext.drawImage(r,0,0,r.width,r.height,0,0,e,t),_.texImage2D(_.TEXTURE_2D,0,h.internalFormat,h.format,h.type,this._workingCanvas),a.width=e,a.height=t,!1);{let e=new A.InternalTexture(this,2);this._bindTextureDirectly(_.TEXTURE_2D,e,!0),_.texImage2D(_.TEXTURE_2D,0,h.internalFormat,h.format,h.type,r),this._rescaleTexture(e,a,i,h.format,()=>{this._releaseTexture(e),this._bindTextureDirectly(_.TEXTURE_2D,a,!0),n()})}return!0},_,l,h,u,o,c,f)}_getTexImageParametersForCreateTexture(e,t){let r,i;return 1===this.webGLVersion?i=r=this._getInternalFormat(e,t):(r=this._getInternalFormat(e,!1),i=this._getRGBABufferInternalSizedFormat(0,e,t)),{internalFormat:i,format:r,type:this._gl.UNSIGNED_BYTE}}_rescaleTexture(e,t,r,i,s){}_unpackFlipY(e){this._unpackFlipYCached!==e&&(this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL,+!!e),this.enableUnpackFlipYCached&&(this._unpackFlipYCached=e))}_getUnpackAlignement(){return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT)}_getTextureTarget(e){return e.isCube?this._gl.TEXTURE_CUBE_MAP:e.is3D?this._gl.TEXTURE_3D:e.is2DArray||e.isMultiview?this._gl.TEXTURE_2D_ARRAY:this._gl.TEXTURE_2D}updateTextureSamplingMode(e,t,r=!1){let i=this._getTextureTarget(t),s=this._getSamplingParameters(e,t.useMipMaps||r);this._setTextureParameterInteger(i,this._gl.TEXTURE_MAG_FILTER,s.mag,t),this._setTextureParameterInteger(i,this._gl.TEXTURE_MIN_FILTER,s.min),r&&s.hasMipMaps&&(t.generateMipMaps=!0,this._gl.generateMipmap(i)),this._bindTextureDirectly(i,null),t.samplingMode=e}updateTextureDimensions(e,t,r,i=1){}updateTextureWrappingMode(e,t,r=null,i=null){let s=this._getTextureTarget(e);null!==t&&(this._setTextureParameterInteger(s,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t),e),e._cachedWrapU=t),null!==r&&(this._setTextureParameterInteger(s,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(r),e),e._cachedWrapV=r),(e.is2DArray||e.is3D)&&null!==i&&(this._setTextureParameterInteger(s,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(i),e),e._cachedWrapR=i),this._bindTextureDirectly(s,null)}_uploadCompressedDataToTextureDirectly(e,t,r,i,s,a=0,n=0){let _=this._gl,l=_.TEXTURE_2D;if(e.isCube&&(l=_.TEXTURE_CUBE_MAP_POSITIVE_X+a),e._useSRGBBuffer)switch(t){case 37492:case 36196:this._caps.etc2?t=_.COMPRESSED_SRGB8_ETC2:e._useSRGBBuffer=!1;break;case 37496:this._caps.etc2?t=_.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:e._useSRGBBuffer=!1;break;case 36492:t=_.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT;break;case 37808:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;break;case 37809:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;break;case 37810:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;break;case 37811:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;break;case 37812:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;break;case 37813:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;break;case 37814:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;break;case 37815:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;break;case 37816:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;break;case 37817:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;break;case 37818:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;break;case 37819:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;break;case 37820:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;break;case 37821:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;break;case 33776:this._caps.s3tc_srgb?t=_.COMPRESSED_SRGB_S3TC_DXT1_EXT:e._useSRGBBuffer=!1;break;case 33777:this._caps.s3tc_srgb?t=_.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:e._useSRGBBuffer=!1;break;case 33779:this._caps.s3tc_srgb?t=_.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:e._useSRGBBuffer=!1;break;default:e._useSRGBBuffer=!1}if(e.generateMipMaps){let a=e._hardwareTexture;a.memoryAllocated||(_.texStorage2D(e.isCube?_.TEXTURE_CUBE_MAP:_.TEXTURE_2D,Math.floor(Math.log2(Math.max(r,i)))+1,t,e.width,e.height),a.memoryAllocated=!0),this._gl.compressedTexSubImage2D(l,n,0,0,r,i,t,s)}else this._gl.compressedTexImage2D(l,n,t,r,i,0,s)}_uploadDataToTextureDirectly(e,t,r=0,i=0,s,a=!1){let n=this._gl,_=this._getWebGLTextureType(e.type),l=this._getInternalFormat(e.format),h=void 0===s?this._getRGBABufferInternalSizedFormat(e.type,e.format,e._useSRGBBuffer):this._getInternalFormat(s,e._useSRGBBuffer);this._unpackFlipY(e.invertY);let u=n.TEXTURE_2D;e.isCube&&(u=n.TEXTURE_CUBE_MAP_POSITIVE_X+r);let o=Math.round(Math.log(e.width)*Math.LOG2E),c=Math.round(Math.log(e.height)*Math.LOG2E),g=a?e.width:Math.pow(2,Math.max(o-i,0)),f=a?e.height:Math.pow(2,Math.max(c-i,0));n.texImage2D(u,i,h,g,f,0,l,_,t)}updateTextureData(e,t,r,i,s,a,n=0,_=0,l=!1){let h=this._gl,u=this._getWebGLTextureType(e.type),o=this._getInternalFormat(e.format);this._unpackFlipY(e.invertY);let c=h.TEXTURE_2D,g=h.TEXTURE_2D;e.isCube&&(g=h.TEXTURE_CUBE_MAP_POSITIVE_X+n,c=h.TEXTURE_CUBE_MAP),this._bindTextureDirectly(c,e,!0),h.texSubImage2D(g,_,r,i,s,a,o,u,t),l&&this._gl.generateMipmap(g),this._bindTextureDirectly(c,null)}_uploadArrayBufferViewToTexture(e,t,r=0,i=0){let s=this._gl,a=e.isCube?s.TEXTURE_CUBE_MAP:s.TEXTURE_2D;this._bindTextureDirectly(a,e,!0),this._uploadDataToTextureDirectly(e,t,r,i),this._bindTextureDirectly(a,null,!0)}_prepareWebGLTextureContinuation(e,t,r,i,s){let a=this._gl;if(!a)return;let n=this._getSamplingParameters(s,!r);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,n.mag),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,n.min),r||i||a.generateMipmap(a.TEXTURE_2D),this._bindTextureDirectly(a.TEXTURE_2D,null),t&&t.removePendingData(e),e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear()}_prepareWebGLTexture(e,t,r,i,s,a,n,_,l,h){let u=this.getCaps().maxTextureSize,o=Math.min(u,this.needPOTTextures?(0,R.GetExponentOfTwo)(i.width,u):i.width),c=Math.min(u,this.needPOTTextures?(0,R.GetExponentOfTwo)(i.height,u):i.height),g=this._gl;if(g){if(!e._hardwareTexture){r&&r.removePendingData(e);return}this._bindTextureDirectly(g.TEXTURE_2D,e,!0),this._unpackFlipY(void 0===s||!!s),e.baseWidth=i.width,e.baseHeight=i.height,e.width=o,e.height=c,e.isReady=!0,e.type=-1!==e.type?e.type:0,e.format=-1!==e.format?e.format:h??(".jpg"!==t||e._useSRGBBuffer?5:4),_(o,c,i,t,e,()=>{this._prepareWebGLTextureContinuation(e,r,a,n,l)})||this._prepareWebGLTextureContinuation(e,r,a,n,l)}}_getInternalFormatFromDepthTextureFormat(e,t,r){let i=this._gl;if(!t)return i.STENCIL_INDEX8;let s=r?i.DEPTH_STENCIL:i.DEPTH_COMPONENT;return this.webGLVersion>1?15===e?s=i.DEPTH_COMPONENT16:16===e?s=i.DEPTH_COMPONENT24:17===e||13===e?s=r?i.DEPTH24_STENCIL8:i.DEPTH_COMPONENT24:14===e?s=i.DEPTH_COMPONENT32F:18===e&&(s=r?i.DEPTH32F_STENCIL8:i.DEPTH_COMPONENT32F):s=i.DEPTH_COMPONENT16,s}_getWebGLTextureTypeFromDepthTextureFormat(e){let t=this._gl,r=t.UNSIGNED_INT;return 15===e?r=t.UNSIGNED_SHORT:17===e||13===e?r=t.UNSIGNED_INT_24_8:14===e?r=t.FLOAT:18===e?r=t.FLOAT_32_UNSIGNED_INT_24_8_REV:19===e&&(r=t.UNSIGNED_BYTE),r}_setupFramebufferDepthAttachments(e,t,r,i,s=1,a,n=!1){let _=this._gl;a=a??(e?13:14);let l=this._getInternalFormatFromDepthTextureFormat(a,t,e);return e&&t?this._createRenderBuffer(r,i,s,_.DEPTH_STENCIL,l,n?-1:_.DEPTH_STENCIL_ATTACHMENT):t?this._createRenderBuffer(r,i,s,l,l,n?-1:_.DEPTH_ATTACHMENT):e?this._createRenderBuffer(r,i,s,l,l,n?-1:_.STENCIL_ATTACHMENT):null}_createRenderBuffer(e,t,r,i,s,a,n=!0){let _=this._gl.createRenderbuffer();return this._updateRenderBuffer(_,e,t,r,i,s,a,n)}_updateRenderBuffer(e,t,r,i,s,a,n,_=!0){let l=this._gl;return l.bindRenderbuffer(l.RENDERBUFFER,e),i>1&&l.renderbufferStorageMultisample?l.renderbufferStorageMultisample(l.RENDERBUFFER,i,a,t,r):l.renderbufferStorage(l.RENDERBUFFER,s,t,r),-1!==n&&l.framebufferRenderbuffer(l.FRAMEBUFFER,n,l.RENDERBUFFER,e),_&&l.bindRenderbuffer(l.RENDERBUFFER,null),e}_releaseTexture(e){this._deleteTexture(e._hardwareTexture),this.unbindAllTextures();let t=this._internalTexturesCache.indexOf(e);-1!==t&&this._internalTexturesCache.splice(t,1),e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureLow&&e._lodTextureLow.dispose(),e._irradianceTexture&&e._irradianceTexture.dispose()}_deleteTexture(e){e?.release()}_setProgram(e){this._currentProgram!==e&&((0,u._setProgram)(e,this._gl),this._currentProgram=e)}bindSamplers(e){let t=e.getPipelineContext();this._setProgram(t.program);let r=e.getSamplers();for(let t=0;t<r.length;t++){let i=e.getUniform(r[t]);i&&(this._boundUniforms[t]=i)}this._currentEffect=null}_activateCurrentTexture(){this._currentTextureChannel!==this._activeChannel&&(this._gl.activeTexture(this._gl.TEXTURE0+this._activeChannel),this._currentTextureChannel=this._activeChannel)}_bindTextureDirectly(e,t,r=!1,i=!1){let s=!1,a=t&&t._associatedChannel>-1;if(r&&a&&(this._activeChannel=t._associatedChannel),this._boundTexturesCache[this._activeChannel]!==t||i){if(this._activateCurrentTexture(),t&&t.isMultiview)throw g.Logger.Error(["_bindTextureDirectly called with a multiview texture!",e,t]),"_bindTextureDirectly called with a multiview texture!";this._gl.bindTexture(e,t?._hardwareTexture?.underlyingResource??null),this._boundTexturesCache[this._activeChannel]=t,t&&(t._associatedChannel=this._activeChannel)}else r&&(s=!0,this._activateCurrentTexture());return a&&!r&&this._bindSamplerUniformToChannel(t._associatedChannel,this._activeChannel),s}_bindTexture(e,t,r){if(void 0===e)return;t&&(t._associatedChannel=e),this._activeChannel=e;let i=t?this._getTextureTarget(t):this._gl.TEXTURE_2D;this._bindTextureDirectly(i,t)}unbindAllTextures(){for(let e=0;e<this._maxSimultaneousTextures;e++)this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),this.webGLVersion>1&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))}setTexture(e,t,r,i){void 0!==e&&(t&&(this._boundUniforms[e]=t),this._setTexture(e,r))}_bindSamplerUniformToChannel(e,t){let r=this._boundUniforms[e];r&&r._currentState!==t&&(this._gl.uniform1i(r,t),r._currentState=t)}_getTextureWrapMode(e){switch(e){case 1:break;case 0:return this._gl.CLAMP_TO_EDGE;case 2:return this._gl.MIRRORED_REPEAT}return this._gl.REPEAT}_setTexture(e,t,r=!1,i=!1,s=""){let a;if(!t)return null!=this._boundTexturesCache[e]&&(this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),this.webGLVersion>1&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))),!1;if(t.video){this._activeChannel=e;let r=t.getInternalTexture();r&&(r._associatedChannel=e),t.update()}else if(4===t.delayLoadState)return t.delayLoad(),!1;a=i?t.depthStencilTexture:t.isReady()?t.getInternalTexture():t.isCube?this.emptyCubeTexture:t.is3D?this.emptyTexture3D:t.is2DArray?this.emptyTexture2DArray:this.emptyTexture,!r&&a&&(a._associatedChannel=e);let n=!0;this._boundTexturesCache[e]===a&&(r||this._bindSamplerUniformToChannel(a._associatedChannel,e),n=!1),this._activeChannel=e;let _=this._getTextureTarget(a);if(n&&this._bindTextureDirectly(_,a,r),a&&!a.isMultiview){if(a.isCube&&a._cachedCoordinatesMode!==t.coordinatesMode){a._cachedCoordinatesMode=t.coordinatesMode;let e=+(3!==t.coordinatesMode&&5!==t.coordinatesMode);t.wrapU=e,t.wrapV=e}a._cachedWrapU!==t.wrapU&&(a._cachedWrapU=t.wrapU,this._setTextureParameterInteger(_,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t.wrapU),a)),a._cachedWrapV!==t.wrapV&&(a._cachedWrapV=t.wrapV,this._setTextureParameterInteger(_,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(t.wrapV),a)),a.is3D&&a._cachedWrapR!==t.wrapR&&(a._cachedWrapR=t.wrapR,this._setTextureParameterInteger(_,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(t.wrapR),a)),this._setAnisotropicLevel(_,a,t.anisotropicFilteringLevel)}return!0}setTextureArray(e,t,r,i){if(void 0!==e&&t){this._textureUnits&&this._textureUnits.length===r.length||(this._textureUnits=new Int32Array(r.length));for(let t=0;t<r.length;t++){let i=r[t].getInternalTexture();i?(this._textureUnits[t]=e+t,i._associatedChannel=e+t):this._textureUnits[t]=-1}this._gl.uniform1iv(t,this._textureUnits);for(let e=0;e<r.length;e++)this._setTexture(this._textureUnits[e],r[e],!0)}}_setAnisotropicLevel(e,t,r){let i=this._caps.textureAnisotropicFilterExtension;11!==t.samplingMode&&3!==t.samplingMode&&2!==t.samplingMode&&(r=1),i&&t._cachedAnisotropicFilteringLevel!==r&&(this._setTextureParameterFloat(e,i.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(r,this._caps.maxAnisotropy),t),t._cachedAnisotropicFilteringLevel=r)}_setTextureParameterFloat(e,t,r,i){this._bindTextureDirectly(e,i,!0,!0),this._gl.texParameterf(e,t,r)}_setTextureParameterInteger(e,t,r,i){i&&this._bindTextureDirectly(e,i,!0,!0),this._gl.texParameteri(e,t,r)}unbindAllAttributes(){if(this._mustWipeVertexAttributes){this._mustWipeVertexAttributes=!1;for(let e=0;e<this._caps.maxVertexAttribs;e++)this.disableAttributeByIndex(e);return}for(let e=0,t=this._vertexAttribArraysEnabled.length;e<t;e++)!(e>=this._caps.maxVertexAttribs)&&this._vertexAttribArraysEnabled[e]&&this.disableAttributeByIndex(e)}releaseEffects(){this._compiledEffects={},this.onReleaseEffectsObservable.notifyObservers(this)}dispose(){(0,f.IsWindowObjectExist)()&&this._renderingCanvas&&(this._renderingCanvas.removeEventListener("webglcontextlost",this._onContextLost),this._onContextRestored&&this._renderingCanvas.removeEventListener("webglcontextrestored",this._onContextRestored)),super.dispose(),this._dummyFramebuffer&&this._gl.deleteFramebuffer(this._dummyFramebuffer),this.unbindAllAttributes(),this._boundUniforms={},this._workingCanvas=null,this._workingContext=null,this._currentBufferPointers.length=0,this._currentProgram=null,this._creationOptions.loseContextOnDispose&&this._gl.getExtension("WEBGL_lose_context")?.loseContext(),(0,u.deleteStateObject)(this._gl)}attachContextLostEvent(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextlost",e,!1)}attachContextRestoredEvent(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextrestored",e,!1)}getError(){return this._gl.getError()}_canRenderToFloatFramebuffer(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(1)}_canRenderToHalfFloatFramebuffer(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(2)}_canRenderToFramebuffer(e){let t=this._gl;for(;t.getError()!==t.NO_ERROR;);let r=!0,i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(e),1,1,0,t.RGBA,this._getWebGLTextureType(e),null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0);let a=t.checkFramebufferStatus(t.FRAMEBUFFER);if((r=(r=r&&a===t.FRAMEBUFFER_COMPLETE)&&t.getError()===t.NO_ERROR)&&(t.clear(t.COLOR_BUFFER_BIT),r=r&&t.getError()===t.NO_ERROR),r){t.bindFramebuffer(t.FRAMEBUFFER,null);let e=t.RGBA,i=t.UNSIGNED_BYTE,s=new Uint8Array(4);t.readPixels(0,0,1,1,e,i,s),r=r&&t.getError()===t.NO_ERROR}for(t.deleteTexture(i),t.deleteFramebuffer(s),t.bindFramebuffer(t.FRAMEBUFFER,null);!r&&t.getError()!==t.NO_ERROR;);return r}_getWebGLTextureType(e){if(1===this._webGLVersion){switch(e){case 1:return this._gl.FLOAT;case 2:return this._gl.HALF_FLOAT_OES;case 0:break;case 8:return this._gl.UNSIGNED_SHORT_4_4_4_4;case 9:return this._gl.UNSIGNED_SHORT_5_5_5_1;case 10:return this._gl.UNSIGNED_SHORT_5_6_5}return this._gl.UNSIGNED_BYTE}switch(e){case 3:return this._gl.BYTE;case 0:break;case 4:return this._gl.SHORT;case 5:return this._gl.UNSIGNED_SHORT;case 6:return this._gl.INT;case 7:return this._gl.UNSIGNED_INT;case 1:return this._gl.FLOAT;case 2:return this._gl.HALF_FLOAT;case 8:return this._gl.UNSIGNED_SHORT_4_4_4_4;case 9:return this._gl.UNSIGNED_SHORT_5_5_5_1;case 10:return this._gl.UNSIGNED_SHORT_5_6_5;case 11:return this._gl.UNSIGNED_INT_2_10_10_10_REV;case 12:return this._gl.UNSIGNED_INT_24_8;case 13:return this._gl.UNSIGNED_INT_10F_11F_11F_REV;case 14:return this._gl.UNSIGNED_INT_5_9_9_9_REV;case 15:return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV}return this._gl.UNSIGNED_BYTE}_getInternalFormat(e,t=!1){let r=t?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA;switch(e){case 0:r=this._gl.ALPHA;break;case 1:r=this._gl.LUMINANCE;break;case 2:r=this._gl.LUMINANCE_ALPHA;break;case 6:case 33322:case 36760:r=this._gl.RED;break;case 7:case 33324:case 36761:r=this._gl.RG;break;case 4:case 32852:case 36762:r=t?this._glSRGBExtensionValues.SRGB:this._gl.RGB;break;case 5:case 32859:case 36763:r=t?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA}if(this._webGLVersion>1)switch(e){case 8:r=this._gl.RED_INTEGER;break;case 9:r=this._gl.RG_INTEGER;break;case 10:r=this._gl.RGB_INTEGER;break;case 11:r=this._gl.RGBA_INTEGER}return r}_getRGBABufferInternalSizedFormat(e,t,r=!1){if(1===this._webGLVersion){if(void 0!==t)switch(t){case 0:return this._gl.ALPHA;case 1:return this._gl.LUMINANCE;case 2:return this._gl.LUMINANCE_ALPHA;case 4:return r?this._glSRGBExtensionValues.SRGB:this._gl.RGB}return this._gl.RGBA}switch(e){case 3:switch(t){case 6:return this._gl.R8_SNORM;case 7:return this._gl.RG8_SNORM;case 4:return this._gl.RGB8_SNORM;case 8:return this._gl.R8I;case 9:return this._gl.RG8I;case 10:return this._gl.RGB8I;case 11:return this._gl.RGBA8I;default:return this._gl.RGBA8_SNORM}case 0:switch(t){case 6:return this._gl.R8;case 7:return this._gl.RG8;case 4:return r?this._glSRGBExtensionValues.SRGB8:this._gl.RGB8;case 5:return r?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA8;case 8:return this._gl.R8UI;case 9:return this._gl.RG8UI;case 10:return this._gl.RGB8UI;case 11:return this._gl.RGBA8UI;case 0:return this._gl.ALPHA;case 1:return this._gl.LUMINANCE;case 2:return this._gl.LUMINANCE_ALPHA;default:return this._gl.RGBA8}case 4:switch(t){case 8:return this._gl.R16I;case 36760:return this._gl.R16_SNORM_EXT;case 36761:return this._gl.RG16_SNORM_EXT;case 36762:return this._gl.RGB16_SNORM_EXT;case 36763:return this._gl.RGBA16_SNORM_EXT;case 9:return this._gl.RG16I;case 10:return this._gl.RGB16I;default:return this._gl.RGBA16I}case 5:switch(t){case 8:return this._gl.R16UI;case 33322:return this._gl.R16_EXT;case 33324:return this._gl.RG16_EXT;case 32852:return this._gl.RGB16_EXT;case 32859:return this._gl.RGBA16_EXT;case 9:return this._gl.RG16UI;case 10:return this._gl.RGB16UI;default:return this._gl.RGBA16UI}case 6:switch(t){case 8:return this._gl.R32I;case 9:return this._gl.RG32I;case 10:return this._gl.RGB32I;default:return this._gl.RGBA32I}case 7:switch(t){case 8:return this._gl.R32UI;case 9:return this._gl.RG32UI;case 10:return this._gl.RGB32UI;default:return this._gl.RGBA32UI}case 1:switch(t){case 6:return this._gl.R32F;case 7:return this._gl.RG32F;case 4:return this._gl.RGB32F;default:return this._gl.RGBA32F}case 2:switch(t){case 6:return this._gl.R16F;case 7:return this._gl.RG16F;case 4:return this._gl.RGB16F;default:return this._gl.RGBA16F}case 10:return this._gl.RGB565;case 13:return this._gl.R11F_G11F_B10F;case 14:return this._gl.RGB9_E5;case 8:return this._gl.RGBA4;case 9:return this._gl.RGB5_A1;case 11:switch(t){case 5:default:return this._gl.RGB10_A2;case 11:return this._gl.RGB10_A2UI}}return r?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA8}readPixels(e,t,r,i,s=!0,a=!0,n=null){let _=s?this._gl.RGBA:this._gl.RGB,l=r*i*(s?4:3);if(n){if(n.length<l)return g.Logger.Error(`Data buffer is too small to store the read pixels (${n.length} should be more than ${l})`),Promise.resolve(n)}else n=new Uint8Array(l);return a&&this.flushFramebuffer(),this._gl.readPixels(e,t,r,i,_,this._gl.UNSIGNED_BYTE,n),Promise.resolve(n)}static get IsSupportedAsync(){return Promise.resolve(this.isSupported())}static get IsSupported(){return this.isSupported()}static isSupported(){if(null!==this._HasMajorPerformanceCaveat)return!this._HasMajorPerformanceCaveat;if(null===this._IsSupported)try{let e=o.AbstractEngine._CreateCanvas(1,1),t=e.getContext("webgl")||e.getContext("experimental-webgl");this._IsSupported=null!=t&&!!globalThis.WebGLRenderingContext}catch(e){this._IsSupported=!1}return this._IsSupported}static get HasMajorPerformanceCaveat(){if(null===this._HasMajorPerformanceCaveat)try{let e=o.AbstractEngine._CreateCanvas(1,1),t=e.getContext("webgl",{failIfMajorPerformanceCaveat:!0})||e.getContext("experimental-webgl",{failIfMajorPerformanceCaveat:!0});this._HasMajorPerformanceCaveat=!t}catch(e){this._HasMajorPerformanceCaveat=!1}return this._HasMajorPerformanceCaveat}}L._TempClearColorUint32=new Uint32Array(4),L._TempClearColorInt32=new Int32Array(4),L.ExceptionList=[{key:"Chrome/63.0",capture:"63\\.0\\.3239\\.(\\d+)",captureConstraint:108,targets:["uniformBuffer"]},{key:"Firefox/58",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Firefox/59",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Chrome/72.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Chrome/73.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Chrome/74.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome/71",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome/72",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Chrome/12\\d\\..+?Mobile",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:".*AppleWebKit.*(15.4).*Safari",capture:null,captureConstraint:null,targets:["antialias","maxMSAASamples"]},{key:".*(15.4).*AppleWebKit.*Safari",capture:null,captureConstraint:null,targets:["antialias","maxMSAASamples"]}],L._ConcatenateShader=x._ConcatenateShader,L._IsSupported=null,L._HasMajorPerformanceCaveat=null,(t=L.prototype).startTimeQuery??(t.startTimeQuery=(0,C._MissingSideEffect)("ThinEngine","startTimeQuery")),(r=L.prototype).endTimeQuery??(r.endTimeQuery=(0,C._MissingSideEffect)("ThinEngine","endTimeQuery")),(i=L.prototype).createUniformBuffer??(i.createUniformBuffer=(0,C._MissingSideEffect)("ThinEngine","createUniformBuffer")),(s=L.prototype).createDynamicUniformBuffer??(s.createDynamicUniformBuffer=(0,C._MissingSideEffect)("ThinEngine","createDynamicUniformBuffer")),(a=L.prototype).updateUniformBuffer??(a.updateUniformBuffer=(0,C._MissingSideEffect)("ThinEngine","updateUniformBuffer")),(n=L.prototype).bindUniformBuffer??(n.bindUniformBuffer=(0,C._MissingSideEffect)("ThinEngine","bindUniformBuffer")),(_=L.prototype).bindUniformBufferBase??(_.bindUniformBufferBase=(0,C._MissingSideEffect)("ThinEngine","bindUniformBufferBase")),(l=L.prototype).bindUniformBlock??(l.bindUniformBlock=(0,C._MissingSideEffect)("ThinEngine","bindUniformBlock")),e.s(["ThinEngine",0,L],71379)}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,13379,e=>{"use strict";class t{static _CheckLimit(e,r){let a=t._LogLimitOutputs[e];return a?a.current++:(a={limit:r,current:1},t._LogLimitOutputs[e]=a),a.current<=a.limit}static _GenerateLimitMessage(e,r=1){let a=t._LogLimitOutputs[e];if(!a||!t.MessageLimitReached)return;let o=this._Levels[r];a.current===a.limit&&t[o.name](t.MessageLimitReached.replace(/%LIMIT%/g,""+a.limit).replace(/%TYPE%/g,o.name??""))}static _AddLogEntry(e){t._LogCache=e+t._LogCache,t.OnNewCacheEntry&&t.OnNewCacheEntry(e)}static _FormatMessage(e){let t=e=>e<10?"0"+e:""+e,r=new Date;return"["+t(r.getHours())+":"+t(r.getMinutes())+":"+t(r.getSeconds())+"]: "+e}static _LogDisabled(e,t){}static _LogEnabled(e=1,r,a){let o=Array.isArray(r)?r[0]:r;if(void 0!==a&&!t._CheckLimit(o,a))return;let s=t._FormatMessage(o),n=this._Levels[e],i=Array.isArray(r)?r.slice(1):[];n.logFunc&&n.logFunc("BJS - "+s,...i);let l=`<div style='color:${n.color}'>${s}</div><br>`;t._AddLogEntry(l),t._GenerateLimitMessage(o,e)}static get LogCache(){return t._LogCache}static ClearLogCache(){t._LogCache="",t._LogLimitOutputs={},t.errorsCount=0}static set LogLevels(e){for(let r of(t.Log=t._LogDisabled,t.Warn=t._LogDisabled,t.Error=t._LogDisabled,[t.MessageLogLevel,t.WarningLogLevel,t.ErrorLogLevel]))(e&r)===r&&(t[this._Levels[r].name]=t._LogEnabled.bind(t,r))}}t.NoneLogLevel=0,t.MessageLogLevel=1,t.WarningLogLevel=2,t.ErrorLogLevel=4,t.AllLogLevel=7,t.MessageLimitReached="Too many %TYPE%s (%LIMIT%), no more %TYPE%s will be reported for this message.",t._LogCache="",t._LogLimitOutputs={},t._Levels=[{},{color:"white",logFunc:console.log,name:"Log"},{color:"orange",logFunc:console.warn,name:"Warn"},{},{color:"red",logFunc:console.error,name:"Error"}],t.errorsCount=0,t.Log=t._LogEnabled.bind(t,t.MessageLogLevel),t.Warn=t._LogEnabled.bind(t,t.WarningLogLevel),t.Error=t._LogEnabled.bind(t,t.ErrorLogLevel),e.s(["Logger",0,t])},96704,e=>{"use strict";let t=null;function r(){if(t)return t;let e=new ArrayBuffer(4),r=new Float32Array(e),a=new Uint32Array(e),o=new Uint32Array(512),s=new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-24?(o[e]=0,o[256|e]=32768,s[e]=24,s[256|e]=24):t<-14?(o[e]=1024>>-t-14,o[256|e]=1024>>-t-14|32768,s[e]=-t-1,s[256|e]=-t-1):t<=15?(o[e]=t+15<<10,o[256|e]=t+15<<10|32768,s[e]=13,s[256|e]=13):t<128?(o[e]=31744,o[256|e]=64512,s[e]=24,s[256|e]=24):(o[e]=31744,o[256|e]=64512,s[e]=13,s[256|e]=13)}let n=new Uint32Array(2048),i=new Uint32Array(64),l=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,r=0;for(;(8388608&t)==0;)t<<=1,r-=8388608;t&=-8388609,r+=0x38800000,n[e]=t|r}for(let e=1024;e<2048;++e)n[e]=0x38000000+(e-1024<<13);for(let e=1;e<31;++e)i[e]=e<<23;i[31]=0x47800000,i[32]=0x80000000;for(let e=33;e<63;++e)i[e]=0x80000000+(e-32<<23);i[63]=0xc7800000;for(let e=1;e<64;++e)32!==e&&(l[e]=1024);return t={floatView:r,uint32View:a,baseTable:o,shiftTable:s,mantissaTable:n,exponentTable:i,offsetTable:l}}e.s(["FromHalfFloat",0,function(e){let t=r();return t.uint32View[0]=t.mantissaTable[t.offsetTable[e>>10]+(1023&e)]+t.exponentTable[e>>10],t.floatView[0]},"MaxHalfFloat",0,65504,"ToHalfFloat",0,function(e){let t=r();t.floatView[0]=e;let a=t.uint32View[0],o=a>>23&511;return t.baseTable[o]+((8388607&a)>>t.shiftTable[o])}])},64545,e=>{"use strict";e.s(["GetDOMTextContent",0,function(e){let t="",r=e.firstChild;for(;r;)3===r.nodeType&&(t+=r.textContent),r=r.nextSibling;return t},"IsDocumentAvailable",0,function(){return"u">typeof document},"IsNavigatorAvailable",0,function(){return"u">typeof navigator},"IsWindowObjectExist",0,function(){return"u">typeof window}])},65295,e=>{"use strict";class t{constructor(){this._xhr="u">typeof _native&&_native.XMLHttpRequest?new _native.XMLHttpRequest:new XMLHttpRequest,this._requestURL=""}static get IsCustomRequestAvailable(){return Object.keys(t.CustomRequestHeaders).length>0||t.CustomRequestModifiers.length>0}static _CleanUrl(e){return e=(e=e.replace("file:http:","http:")).replace("file:https:","https:")}static _ShouldSkipRequestModifications(e){return t.SkipRequestModificationForBabylonCDN&&(e.includes("preview.babylonjs.com")||e.includes("cdn.babylonjs.com"))}static _CollectCustomizations(e,r={}){let a={...r};if(t._ShouldSkipRequestModifications(e))return{url:e,headers:a};for(let e in t.CustomRequestHeaders){let r=t.CustomRequestHeaders[e];r&&(a[e]=r)}let o={setRequestHeader:(e,t)=>{a[e]=t}};for(let r of t.CustomRequestModifiers){if(t._ShouldSkipRequestModifications(e))break;let a=r(o,e);"string"==typeof a&&(e=a)}return{url:e,headers:a}}static async FetchAsync(e,r={}){let a=r.method??"GET";if("u">typeof fetch){let{url:o,headers:s}=t._CollectCustomizations(t._CleanUrl(e),r.headers??{});return await fetch(o,{method:a,headers:s,body:r.body??void 0})}return await new Promise((o,s)=>{let n=new t;n.responseType="arraybuffer",n.addEventListener("readystatechange",()=>{if(4===n.readyState)if(n.status>=200&&n.status<300){let e="u">typeof Headers?new Headers:void 0,t=n.getResponseHeader("Content-Type");t&&e&&e.set("Content-Type",t),"u">typeof Response?o(new Response(n.response,{status:n.status,statusText:n.statusText,headers:e})):o({ok:!0,status:n.status,statusText:n.statusText,headers:{get:e=>n.getResponseHeader(e)},arrayBuffer:async()=>await Promise.resolve(n.response)})}else s(Error(`HTTP ${n.status} loading '${n.requestURL}': ${n.statusText}`))}),n.open(a,e,r.headers),n.send(r.body??null)})}get requestURL(){return this._requestURL}get onprogress(){return this._xhr.onprogress}set onprogress(e){this._xhr.onprogress=e}get readyState(){return this._xhr.readyState}get status(){return this._xhr.status}get statusText(){return this._xhr.statusText}get response(){return this._xhr.response}get responseURL(){return this._xhr.responseURL}get responseText(){return this._xhr.responseText}get responseType(){return this._xhr.responseType}set responseType(e){this._xhr.responseType=e}get timeout(){return this._xhr.timeout}set timeout(e){this._xhr.timeout=e}addEventListener(e,t,r){this._xhr.addEventListener(e,t,r)}removeEventListener(e,t,r){this._xhr.removeEventListener(e,t,r)}abort(){this._xhr.abort()}send(e){this._xhr.send(e)}open(e,r,a){let{url:o,headers:s}=t._CollectCustomizations(r,a);for(let r in this._requestURL=t._CleanUrl(o),this._xhr.open(e,this._requestURL,!0),s)this._xhr.setRequestHeader(r,s[r])}setRequestHeader(e,t){this._xhr.setRequestHeader(e,t)}getResponseHeader(e){return this._xhr.getResponseHeader(e)}}t.CustomRequestHeaders={},t.CustomRequestModifiers=[],t.SkipRequestModificationForBabylonCDN=!0,e.s(["WebRequest",0,t])},29822,6805,92605,49311,23240,e=>{"use strict";class t{}t.FilesToLoad={},e.s(["FilesInputStore",0,t],29822),e.s(["RetryStrategy",0,class{static ExponentialBackoff(e=3,t=500){return(r,a,o)=>0!==a.status||o>=e||-1!==r.indexOf("file:")?-1:Math.pow(2,o)*t}}],6805);class r extends Error{}r._setPrototypeOf=Object.setPrototypeOf||((e,t)=>(e.__proto__=t,e));class a extends r{constructor(e,t,o){super(e),this.errorCode=t,this.innerError=o,this.name="RuntimeError",r._setPrototypeOf(this,a.prototype)}}e.s(["BaseError",0,r,"ErrorCodes",0,{MeshInvalidPositionsError:0,UnsupportedTextureError:1e3,GLTFLoaderUnexpectedMagicError:2e3,SceneLoaderError:3e3,LoadFileError:4e3,RequestFileError:4001,ReadFileError:4002},"RuntimeError",0,a],92605);let o=e=>atob(e);e.s(["DecodeBase64ToBinary",0,e=>"function"==typeof Uint8Array.fromBase64?Uint8Array.fromBase64(e).buffer:function(e){let t=o(e),r=t.length,a=new Uint8Array(new ArrayBuffer(r));for(let e=0;e<r;e++)a[e]=t.charCodeAt(e);return a.buffer}(e),"DecodeBase64ToString",0,o,"EncodeArrayBufferToBase64",0,e=>{let t=ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e);return"function"==typeof t.toBase64?t.toBase64():function(e){let t,r,a,o,s,n,i,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="",u=0;for(;u<e.length;)t=e[u++],r=u<e.length?e[u++]:NaN,a=u<e.length?e[u++]:NaN,o=t>>2,s=(3&t)<<4|r>>4,n=(15&r)<<2|a>>6,i=63&a,isNaN(r)?n=i=64:isNaN(a)&&(i=64),c+=l.charAt(o)+l.charAt(s)+l.charAt(n)+l.charAt(i);return c}(t)}],49311);let s=[];function n(e,t,r){try{if(e())return t(),!0}catch(e){return r?.(e),!0}return!1}e.s(["TimingTools",0,class{static SetImmediate(e){0===s.length&&setTimeout(()=>{let e=s;for(let t of(s=[],e))t()},1),s.push(e)}},"_RetryWithInterval",0,(e,t,r,a=16,o=3e4,s=!0,i)=>{if(s&&n(e,t,r))return null;let l=setInterval(()=>{n(e,t,r)?clearInterval(l):(o-=a)<0&&(clearInterval(l),r?.(Error("Operation timed out after maximum retries. "+(i||"")),!0))},a);return()=>clearInterval(l)}],23240)},38118,e=>{"use strict";var t=e.i(13379),r=e.i(96704);function a(e){switch(e){case 5120:case 5121:return 1;case 5122:case 5123:case 5131:return 2;case 5124:case 5125:case 5126:return 4;default:throw Error(`Invalid type '${e}'`)}}function o(e,t,o,s,n,i,l,c){let u=Array(s),f=Array(s);if(e instanceof Array){let r=t/4,a=o/4;for(let t=0;t<i;t+=s){for(let t=0;t<s;t++)u[t]=f[t]=e[r+t];c(f,t);for(let t=0;t<s;t++)u[t]!==f[t]&&(e[r+t]=f[t]);r+=a}}else{let d=ArrayBuffer.isView(e)?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e),g=a(n);for(let e=0;e<i;e+=s){for(let e=0,a=t;e<s;e++,a+=g)u[e]=f[e]=function(e,t,a,o){switch(t){case 5120:{let t=e.getInt8(a);return o&&(t=Math.max(t/127,-1)),t}case 5121:{let t=e.getUint8(a);return o&&(t/=255),t}case 5122:{let t=e.getInt16(a,!0);return o&&(t=Math.max(t/32767,-1)),t}case 5123:{let t=e.getUint16(a,!0);return o&&(t/=65535),t}case 5131:return(0,r.FromHalfFloat)(e.getUint16(a,!0));case 5124:return e.getInt32(a,!0);case 5125:return e.getUint32(a,!0);case 5126:return e.getFloat32(a,!0);default:throw Error(`Invalid component type ${t}`)}}(d,n,a,l);c(f,e);for(let e=0,a=t;e<s;e++,a+=g)u[e]!==f[e]&&function(e,t,a,o,s){switch(t){case 5120:o&&(s=Math.round(127*s)),e.setInt8(a,s);break;case 5121:o&&(s=Math.round(255*s)),e.setUint8(a,s);break;case 5122:o&&(s=Math.round(32767*s)),e.setInt16(a,s,!0);break;case 5123:o&&(s=Math.round(65535*s)),e.setUint16(a,s,!0);break;case 5131:e.setUint16(a,(0,r.ToHalfFloat)(s),!0);break;case 5124:e.setInt32(a,s,!0);break;case 5125:e.setUint32(a,s,!0);break;case 5126:e.setFloat32(a,s,!0);break;default:throw Error(`Invalid component type ${t}`)}}(d,n,a,l,f[e]);t+=o}}}e.s(["CopyFloatData",0,function(e,r,s,n,i,l,c,u){let f=r*a(s),d=c*r;if(u.length!==d)throw Error("Output length is not valid");if(5126!==s||i!==f)return void o(e,n,i,r,s,d,l,(e,t)=>{for(let a=0;a<r;a++)u[t+a]=e[a]});if(e instanceof Array){let t=n/4;u.set(e,t)}else if(ArrayBuffer.isView(e)){let r=e.byteOffset+n;if((3&r)!=0){t.Logger.Warn("Float array must be aligned to 4-bytes border"),u.set(new Float32Array(e.buffer.slice(r,r+d*Float32Array.BYTES_PER_ELEMENT)));return}let a=new Float32Array(e.buffer,r,d);u.set(a)}else{let t=new Float32Array(e,n,d);u.set(t)}},"EnumerateFloatValues",0,o,"GetBlobBufferSource",0,function(e){let t=e.buffer;if(t instanceof ArrayBuffer)return e;let r=new ArrayBuffer(e.byteLength);return new Uint8Array(r).set(new Uint8Array(t,e.byteOffset,e.byteLength)),r},"GetFloatData",0,function(e,r,s,n,i,l,c,u){let f=r*a(s),d=c*r;if(5126!==s||i!==f){let t=new Float32Array(d);return o(e,n,i,r,s,d,l,(e,a)=>{for(let o=0;o<r;o++)t[a+o]=e[o]}),t}if(!(e instanceof Array||e instanceof Float32Array)||0!==n||e.length!==d)if(e instanceof Array){let t=n/4;return e.slice(t,t+d)}else{if(!ArrayBuffer.isView(e))return new Float32Array(e,n,d);let r=e.byteOffset+n;return((3&r)!=0&&(t.Logger.Warn("Float array must be aligned to 4-bytes border"),u=!0),u)?new Float32Array(e.buffer.slice(r,r+d*Float32Array.BYTES_PER_ELEMENT)):new Float32Array(e.buffer,r,d)}return u?e.slice():e},"GetTypeByteLength",0,a,"GetTypedArrayData",0,function(e,r,s,n,i,l,c){let u,f=a(s),d=function(e){switch(e){case 5120:return Int8Array;case 5121:return Uint8Array;case 5122:return Int16Array;case 5123:case 5131:return Uint16Array;case 5124:return Int32Array;case 5125:return Uint32Array;case 5126:return Float32Array;default:throw Error(`Invalid component type '${e}'`)}}(s),g=l*r;if(Array.isArray(e)){if((3&n)!=0||(3&i)!=0)throw Error("byteOffset and byteStride must be a multiple of 4 for number[] data.");let t=n/4,a=i/4;if(t+(l-1)*a+r>e.length)throw Error("Last accessed index is out of bounds.");if(a<r)throw Error("Data stride cannot be smaller than the component size.");if(a!==r){let t=new d(g);return o(e,n,i,r,s,g,!1,(e,a)=>{for(let o=0;o<r;o++)t[a+o]=e[o]}),t}return new d(e.slice(t,t+g))}let p=n;if(ArrayBuffer.isView(e)?(u=e.buffer,p+=e.byteOffset):u=e,p+(l-1)*i+r*f>u.byteLength)throw Error("Last accessed byte is out of bounds.");let m=r*f;if(i<m)throw Error("Byte stride cannot be smaller than the component's byte size.");if(i!==m){let e=new d(g),t=new Uint8Array(u,p),a=new Uint8Array(e.buffer),o=r*f;for(let e=0,r=0,s=0;e<l;e++,r+=i,s+=o)a.set(t.subarray(r,r+o),s);return e}return(1!==f&&(p&f-1)!=0&&(t.Logger.Warn("Array must be aligned to border of element size. Data will be copied."),c=!0),c)?new d(u.slice(p,p+g*f)):new d(u,p,g)}])},46712,e=>{"use strict";var t=e.i(65295),r=e.i(64545),a=e.i(99267),o=e.i(29822),s=e.i(6805),n=e.i(92605),i=e.i(49311),l=e.i(81623),c=e.i(13379),u=e.i(23240),f=e.i(38118);let d=new RegExp(/^data:([^,]+\/[^,]+)?;base64,/i);class g extends n.RuntimeError{constructor(e,r){super(e,n.ErrorCodes.LoadFileError),this.name="LoadFileError",n.BaseError._setPrototypeOf(this,g.prototype),r instanceof t.WebRequest?this.request=r:this.file=r}}class p extends n.RuntimeError{constructor(e,t){super(e,n.ErrorCodes.RequestFileError),this.request=t,this.name="RequestFileError",n.BaseError._setPrototypeOf(this,p.prototype)}}class m extends n.RuntimeError{constructor(e,t){super(e,n.ErrorCodes.ReadFileError),this.file=t,this.name="ReadFileError",n.BaseError._setPrototypeOf(this,m.prototype)}}let h={DefaultRetryStrategy:s.RetryStrategy.ExponentialBackoff(),BaseUrl:"",CorsBehavior:"anonymous",PreprocessUrl:e=>e,ScriptBaseUrl:"",ScriptPreprocessUrl:e=>e,CleanUrl:e=>e=e.replace(/#/gm,"%23")},y=(e,t)=>{if((!e||0!==e.indexOf("data:"))&&h.CorsBehavior)if("string"==typeof h.CorsBehavior||h.CorsBehavior instanceof String)t.crossOrigin=h.CorsBehavior;else{let r=h.CorsBehavior(e);r&&(t.crossOrigin=r)}},b=(e,t,r,o,s)=>{let n=new FileReader,i={onCompleteObservable:new a.Observable,abort:()=>n.abort()};return n.onloadend=()=>i.onCompleteObservable.notifyObservers(i),s&&(n.onerror=()=>{s(new m(`Unable to read ${e.name}`,e))}),n.onload=e=>{t(e.target.result)},r&&(n.onprogress=r),o?n.readAsArrayBuffer(e):n.readAsText(e),i},L=(e,t,r,s,n,i,l)=>{if(e.name)return b(e,t,r,n,i?e=>{i(void 0,e)}:void 0);if(-1!==e.indexOf("file:")){let a=decodeURIComponent(e.substring(5).toLowerCase());0===a.indexOf("./")&&(a=a.substring(2));let s=o.FilesInputStore.FilesToLoad[a];if(s)return b(s,t,r,n,i?e=>i(void 0,new g(e.message,e.file)):void 0)}let{match:f,type:d}=U(e);if(f){let r={onCompleteObservable:new a.Observable,abort:()=>()=>{}};try{let r=n?w(e):_(e);t(r,void 0,d)}catch(e){i?i(void 0,e):c.Logger.Error(e.message||"Failed to parse the Data URL")}return u.TimingTools.SetImmediate(()=>{r.onCompleteObservable.notifyObservers(r)}),r}return v(e,(e,r)=>{t(e,r?.responseURL,r?.getResponseHeader("content-type"))},r,s,n,i?e=>{i(e.request,new g(e.message,e.request))}:void 0,l)},v=(e,o,s,n,i,u,f)=>{null!==n&&(n??(n=l.EngineStore.LastCreatedScene?.offlineProvider)),e=h.CleanUrl(e),e=h.PreprocessUrl(e);let d=h.BaseUrl+e,g=!1,m={onCompleteObservable:new a.Observable,abort:()=>g=!0},y=()=>{let e,a=new t.WebRequest,n=null,l=()=>{a&&(s&&a.removeEventListener("progress",s),e&&a.removeEventListener("readystatechange",e),a.removeEventListener("loadend",y))},y=()=>{l(),m.onCompleteObservable.notifyObservers(m),m.onCompleteObservable.clear(),s=void 0,e=null,y=null,u=void 0,f=void 0,o=void 0};m.abort=()=>{g=!0,y&&y(),a&&a.readyState!==(XMLHttpRequest.DONE||4)&&a.abort(),null!==n&&(clearTimeout(n),n=null),a=null};let b=e=>{let t=e.message||"Unknown error";u&&a?u(new p(t,a)):c.Logger.Error(t)},L=c=>{if(a){if(a.open("GET",d),f)try{f(a)}catch(e){b(e);return}i&&(a.responseType="arraybuffer"),s&&a.addEventListener("progress",s),y&&a.addEventListener("loadend",y),e=()=>{if(!g&&a&&a.readyState===(XMLHttpRequest.DONE||4)){if(e&&a.removeEventListener("readystatechange",e),a.status>=200&&a.status<300||0===a.status&&(!(0,r.IsWindowObjectExist)()||C())){let e=i?a.response:a.responseText;if(null!==e){try{o&&o(e,a)}catch(e){b(e)}return}}let s=h.DefaultRetryStrategy;if(s){let e=s(d,a,c);if(-1!==e){l(),a=new t.WebRequest,n=setTimeout(()=>L(c+1),e);return}}let f=new p("Error status: "+a.status+" "+a.statusText+" - Unable to load "+d,a);u&&u(f)}},a.addEventListener("readystatechange",e),a.send()}};L(0)};if(n&&n.enableSceneOffline&&!e.startsWith("blob:")){let t=e=>{e&&e.status>400?u&&u(e):y()};n.open(()=>{n&&n.loadFile(h.BaseUrl+e,e=>{!g&&o&&o(e),m.onCompleteObservable.notifyObservers(m)},s?e=>{!g&&s&&s(e)}:void 0,t,i)},t)}else y();return m},C=()=>"u">typeof location&&"file:"===location.protocol,U=e=>{let t=d.exec(e);return null===t||0===t.length?{match:!1,type:""}:{match:!0,type:t[0].replace("data:","").replace(";base64,","")}};function w(e){return(0,i.DecodeBase64ToBinary)(e.split(",")[1])}let _=e=>(0,i.DecodeBase64ToString)(e.split(",")[1]);e.s(["DecodeBase64UrlToBinary",0,w,"FileToolsOptions",0,h,"IsBase64DataUrl",0,e=>d.test(e),"LoadFile",0,L,"LoadImage",0,(e,r,a,s,n="",c,u=l.EngineStore.LastCreatedEngine)=>{let d;if("u"<typeof HTMLImageElement&&!u?._features.forceBitmapOverHTMLImageElement)return a("LoadImage is only supported in web or BabylonNative environments."),null;let g=!1;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))if("u">typeof Blob&&"u">typeof URL){let t;t=e instanceof ArrayBuffer?e:(0,f.GetBlobBufferSource)(e),d=URL.createObjectURL(new Blob([t],{type:n})),g=!0}else d=`data:${n};base64,`+(0,i.EncodeArrayBufferToBase64)(e);else e instanceof Blob?(d=URL.createObjectURL(e),g=!0):(d=h.CleanUrl(e),d=h.PreprocessUrl(d));let p=t=>{if(a){let r=d||e.toString();a(`Error while trying to load image: ${0===r.indexOf("http")||r.length<=128?r:r.slice(0,128)+"..."}`,t)}};if(u?._features.forceBitmapOverHTMLImageElement)return L(d,t=>{u.createImageBitmap(new Blob([t],{type:n}),{premultiplyAlpha:"none",colorSpaceConversion:"none",...c}).then(e=>{r(e),g&&URL.revokeObjectURL(d)}).catch(t=>{a&&a("Error while trying to load image: "+e,t)})},void 0,s||void 0,!0,(e,t)=>{p(t)}),null;let m=new Image;!1;y(d,m);let b=[],v=()=>{for(let e of b)e.target.removeEventListener(e.name,e.handler);b.length=0};for(let e of(b.push({target:m,name:"load",handler:()=>{v(),r(m),g&&m.src&&URL.revokeObjectURL(m.src)}}),b.push({target:m,name:"error",handler:e=>{v(),p(e),g&&m.src&&URL.revokeObjectURL(m.src)}}),b.push({target:document,name:"securitypolicyviolation",handler:e=>{if(e.blockedURI!==m.src||"report"===e.disposition)return;v();let t=Error(`CSP violation of policy ${e.effectiveDirective} ${e.blockedURI}. Current policy is ${e.originalPolicy}`);l.EngineStore.UseFallbackTexture=!1,p(t),g&&m.src&&URL.revokeObjectURL(m.src),m.src=""}}),b))e.target.addEventListener(e.name,e.handler);let C="blob:"===d.substring(0,5),U="data:"===d.substring(0,5),w=()=>{C||U||!t.WebRequest.IsCustomRequestAvailable?m.src=d:L(d,(e,t,r)=>{let a=new Blob([e],{type:!n&&r?r:n}),o=URL.createObjectURL(a);g=!0,m.src=o},void 0,s||void 0,!0,(e,t)=>{p(t)})};if(!C&&!U&&s&&s.enableTexturesOffline)s.open(()=>{s&&s.loadImage(d,m)},w);else{if(-1!==d.indexOf("file:")){let e=decodeURIComponent(d.substring(5).toLowerCase());if(o.FilesInputStore.FilesToLoad[e]&&"u">typeof URL){try{let t;try{t=URL.createObjectURL(o.FilesInputStore.FilesToLoad[e])}catch(r){t=URL.createObjectURL(o.FilesInputStore.FilesToLoad[e])}m.src=t,g=!0}catch(e){m.src=""}return m}}w()}return m},"ReadFile",0,b,"RequestFile",0,v,"SetCorsBehavior",0,y])},36395,e=>{"use strict";var t=e.i(64545);e.s(["PrecisionDate",0,class{static get Now(){return(0,t.IsWindowObjectExist)()&&window.performance&&window.performance.now?window.performance.now():Date.now()}}])},84768,e=>{"use strict";e.s(["RandomGUID",0,function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}])},98105,e=>{"use strict";var t=e.i(13379),r=e.i(77052);class a{static Instantiate(e){if(this.RegisteredExternalClasses&&this.RegisteredExternalClasses[e])return this.RegisteredExternalClasses[e];let a=(0,r.GetClass)(e);if(a)return a;t.Logger.Warn(e+" not found, you may have missed an import.");let o=e.split("."),s="u">typeof window?window:"u">typeof globalThis?globalThis:this;for(let e=0,t=o.length;e<t;e++)s=s[o[e]];return"function"!=typeof s?null:s}}a.RegisteredExternalClasses={},e.s(["InstantiationTools",0,a])},65740,71265,e=>{"use strict";var t,r=e.i(99267),a=e.i(64545),o=e.i(13379);let s=(e,t,r)=>!e||e.getClassName&&"Mesh"===e.getClassName()?null:e.getClassName&&("SubMesh"===e.getClassName()||"PhysicsBody"===e.getClassName())?e.clone(t):e.clone?e.clone():Array.isArray(e)?e.slice():r&&"object"==typeof e?{...e}:null;class n{static DeepCopy(e,t,r,a,n=!1){for(let i of function(e){let t=[];do for(let r of Object.getOwnPropertyNames(e))-1===t.indexOf(r)&&t.push(r);while(e=Object.getPrototypeOf(e))return t}(e)){if("_"===i[0]&&(!a||-1===a.indexOf(i))||i.endsWith("Observable")||r&&-1!==r.indexOf(i))continue;let l=e[i],c=typeof l;if("function"!==c)try{if("object"===c)if(l instanceof Uint8Array)t[i]=Uint8Array.from(l);else if(l instanceof Array){if(t[i]=[],l.length>0)if("object"==typeof l[0])for(let e=0;e<l.length;e++){let r=s(l[e],t,n);-1===t[i].indexOf(r)&&t[i].push(r)}else t[i]=l.slice(0)}else t[i]=s(l,t,n);else t[i]=l}catch(e){o.Logger.Warn(e.message)}}}}e.s(["DeepCopier",0,n],71265);var i=e.i(36395),l=e.i(75405),c=e.i(65295),u=e.i(81623),f=e.i(46712),d=e.i(23240),g=e.i(98105),p=e.i(84768);class m{static get BaseUrl(){return f.FileToolsOptions.BaseUrl}static set BaseUrl(e){f.FileToolsOptions.BaseUrl=e}static get CleanUrl(){return f.FileToolsOptions.CleanUrl}static set CleanUrl(e){f.FileToolsOptions.CleanUrl=e}static IsAbsoluteUrl(e){return 0===e.indexOf("//")||!(-1===e.indexOf("://")||-1===e.indexOf(".")||-1===e.indexOf("/")||e.indexOf(":")>e.indexOf("/"))&&(!!(e.indexOf("://")<e.indexOf("."))||0===e.indexOf("data:")||0===e.indexOf("blob:"))}static set ScriptBaseUrl(e){f.FileToolsOptions.ScriptBaseUrl=e}static get ScriptBaseUrl(){return f.FileToolsOptions.ScriptBaseUrl}static set CDNBaseUrl(e){t.ScriptBaseUrl=e,t.AssetBaseUrl=e}static set ScriptPreprocessUrl(e){f.FileToolsOptions.ScriptPreprocessUrl=e}static get ScriptPreprocessUrl(){return f.FileToolsOptions.ScriptPreprocessUrl}static get DefaultRetryStrategy(){return f.FileToolsOptions.DefaultRetryStrategy}static set DefaultRetryStrategy(e){f.FileToolsOptions.DefaultRetryStrategy=e}static get CorsBehavior(){return f.FileToolsOptions.CorsBehavior}static set CorsBehavior(e){f.FileToolsOptions.CorsBehavior=e}static get UseFallbackTexture(){return u.EngineStore.UseFallbackTexture}static set UseFallbackTexture(e){u.EngineStore.UseFallbackTexture=e}static get RegisteredExternalClasses(){return g.InstantiationTools.RegisteredExternalClasses}static set RegisteredExternalClasses(e){g.InstantiationTools.RegisteredExternalClasses=e}static get fallbackTexture(){return u.EngineStore.FallbackTexture}static set fallbackTexture(e){u.EngineStore.FallbackTexture=e}static FetchToRef(e,t,r,a,o,s){let n=((Math.abs(e)*r%r|0)+(Math.abs(t)*a%a|0)*r)*4;s.r=o[n]/255,s.g=o[n+1]/255,s.b=o[n+2]/255,s.a=o[n+3]/255}static Mix(e,t,r){return 0}static Instantiate(e){return g.InstantiationTools.Instantiate(e)}static SetImmediate(e){d.TimingTools.SetImmediate(e)}static IsExponentOfTwo(e){return!0}static FloatRound(e){return Math.fround(e)}static GetFilename(e){let t=e.lastIndexOf("/");return t<0?e:e.substring(t+1)}static GetFolderPath(e,t=!1){let r=e.lastIndexOf("/");return r<0?t?e:"":e.substring(0,r+1)}static ToDegrees(e){return 180*e/Math.PI}static ToRadians(e){return e*Math.PI/180}static SmoothAngleChange(e,t,r=.9){let a=this.ToRadians(e),o=this.ToRadians(t);return this.ToDegrees(Math.atan2((1-r)*Math.sin(o)+r*Math.sin(a),(1-r)*Math.cos(o)+r*Math.cos(a)))}static MakeArray(e,t){return!0!==t&&(void 0===e||null==e)?null:Array.isArray(e)?e:[e]}static GetPointerPrefix(e){return(0,a.IsWindowObjectExist)()&&!window.PointerEvent?"mouse":"pointer"}static SetCorsBehavior(e,t){(0,f.SetCorsBehavior)(e,t)}static SetReferrerPolicyBehavior(e,t){t.referrerPolicy=e}static get PreprocessUrl(){return f.FileToolsOptions.PreprocessUrl}static set PreprocessUrl(e){f.FileToolsOptions.PreprocessUrl=e}static LoadImage(e,t,r,a,o,s){return(0,f.LoadImage)(e,t,r,a,o,s)}static LoadFile(e,t,r,a,o,s){return(0,f.LoadFile)(e,t,r,a,o,s)}static async LoadFileAsync(e,t=!0){return await new Promise((r,a)=>{(0,f.LoadFile)(e,e=>{r(e)},void 0,void 0,t,(e,t)=>{a(t)})})}static GetAssetUrl(e){if(!e)return"";if(t.AssetBaseUrl&&e.startsWith(t._DefaultAssetsUrl)){let r=t.AssetBaseUrl.endsWith("/")?t.AssetBaseUrl.slice(0,-1):t.AssetBaseUrl;return e.replace(t._DefaultAssetsUrl,r)}return e}static GetBabylonScriptURL(e,r){if(!e)return"";if(e.startsWith(t._DefaultCdnUrl)){if(t.ScriptBaseUrl){let r=t.ScriptBaseUrl.endsWith("/")?t.ScriptBaseUrl.slice(0,-1):t.ScriptBaseUrl;e=e.replace(t._DefaultCdnUrl,r)}else if(t._CdnVersion){let r=`${t._DefaultCdnUrl}/v${t._CdnVersion}`;e.startsWith(r)||(e=e.replace(t._DefaultCdnUrl,r))}}return e=t.ScriptPreprocessUrl(e),r&&!t.IsAbsoluteUrl(e)&&(e=t.GetAbsoluteUrl(e)),e}static LoadBabylonScript(e,r,a,o){e=t.GetBabylonScriptURL(e),t.LoadScript(e,r,a)}static async LoadBabylonScriptAsync(e){return e=t.GetBabylonScriptURL(e),await t.LoadScriptAsync(e)}static _LoadScriptNative(e,r,a){_native&&t.LoadFile(e,e=>{try{Function(e).apply(null),r&&r()}catch(e){a&&a("LoadScript Error",e)}},void 0,void 0,!1,(e,t)=>{a&&a("LoadScript Error",t)})}static _LoadScriptWeb(e,t,r,o,s=!1){if("function"==typeof importScripts){try{importScripts(e),t&&t()}catch(t){r?.(`Unable to load script '${e}' in worker`,t)}return}if(!(0,a.IsWindowObjectExist)())return void r?.(`Cannot load script '${e}' outside of a window or a worker`);let n=document.getElementsByTagName("head")[0],i=document.createElement("script");s?(i.setAttribute("type","module"),i.innerText=e):(i.setAttribute("type","text/javascript"),i.setAttribute("src",e)),o&&(i.id=o),i.onload=()=>{t&&t()},i.onerror=t=>{r&&r(`Unable to load script '${e}'`,t)},n.appendChild(i)}static async LoadScriptAsync(e,t){return await new Promise((r,a)=>{this.LoadScript(e,()=>{r()},(e,t)=>{a(t||Error(e))},t)})}static ReadFileAsDataURL(e,t,a){let o=new FileReader,s={onCompleteObservable:new r.Observable,abort:()=>o.abort()};return o.onloadend=()=>{s.onCompleteObservable.notifyObservers(s)},o.onload=e=>{t(e.target.result)},o.onprogress=a,o.readAsDataURL(e),s}static ReadFile(e,t,r,a,o){return(0,f.ReadFile)(e,t,r,a,o)}static FileAsURL(e){let t=new Blob([e]);return window.URL.createObjectURL(t)}static Format(e,t=2){return e.toFixed(t)}static DeepCopy(e,t,r,a){n.DeepCopy(e,t,r,a)}static IsEmpty(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}static RegisterTopRootEvents(e,t){for(let r=0;r<t.length;r++){let a=t[r];e.addEventListener(a.name,a.handler,!1);try{window.parent&&window.parent.addEventListener(a.name,a.handler,!1)}catch(e){}}}static UnregisterTopRootEvents(e,t){for(let r=0;r<t.length;r++){let a=t[r];e.removeEventListener(a.name,a.handler);try{e.parent&&e.parent.removeEventListener(a.name,a.handler)}catch(e){}}}static async DumpFramebuffer(e,t,r,a,o="image/png",s,n){throw(0,l._WarnImport)("DumpTools")}static DumpData(e,t,r,a,o="image/png",s,n=!1,i=!1,c){throw(0,l._WarnImport)("DumpTools")}static async DumpDataAsync(e,t,r,a="image/png",o,s=!1,n=!1,i){throw(0,l._WarnImport)("DumpTools")}static _IsOffScreenCanvas(e){return void 0!==e.convertToBlob}static ToBlob(e,r,a="image/png",o){t._IsOffScreenCanvas(e)||e.toBlob||(e.toBlob=function(e,t,r){setTimeout(()=>{let a=atob(this.toDataURL(t,r).split(",")[1]),o=a.length,s=new Uint8Array(o);for(let e=0;e<o;e++)s[e]=a.charCodeAt(e);e(new Blob([s]))})}),t._IsOffScreenCanvas(e)?e.convertToBlob({type:a,quality:o}).then(e=>r(e)):e.toBlob(function(e){r(e)},a,o)}static DownloadBlob(e,r){if("download"in document.createElement("a")){if(!r){let e=new Date;r="screenshot_"+((e.getFullYear()+"-"+(e.getMonth()+1)).slice(2)+"-"+e.getDate()+"_"+e.getHours()+"-")+("0"+e.getMinutes()).slice(-2)+".png"}t.Download(e,r)}else if(e&&"u">typeof URL){let t=URL.createObjectURL(e),r=window.open("");if(!r)return;let a=r.document.createElement("img");a.onload=function(){URL.revokeObjectURL(t)},a.src=t,r.document.body.appendChild(a)}}static EncodeScreenshotCanvasData(e,r,a="image/png",o,s){if("string"!=typeof o&&r){if(r){if(t._IsOffScreenCanvas(e))return void e.convertToBlob({type:a,quality:s}).then(e=>{let t=new FileReader;t.readAsDataURL(e),t.onloadend=()=>{r(t.result)}});r(e.toDataURL(a,s))}}else this.ToBlob(e,function(e){e&&t.DownloadBlob(e,o),r&&r("")},a,s)}static Download(e,t){if("u"<typeof URL)return;let r=window.URL.createObjectURL(e),a=document.createElement("a");document.body.appendChild(a),a.style.display="none",a.href=r,a.download=t,a.addEventListener("click",()=>{a.parentElement&&a.parentElement.removeChild(a)}),a.click(),window.URL.revokeObjectURL(r)}static BackCompatCameraNoPreventDefault(e){return"boolean"==typeof e[0]?e[0]:"boolean"==typeof e[1]&&e[1]}static CreateScreenshot(e,t,r,a,o="image/png",s=!1,n){throw(0,l._WarnImport)("ScreenshotTools")}static async CreateScreenshotAsync(e,t,r,a="image/png",o){throw(0,l._WarnImport)("ScreenshotTools")}static CreateScreenshotUsingRenderTarget(e,t,r,a,o="image/png",s=1,n=!1,i,c=!1,u=!1,f=!0,d,g){throw(0,l._WarnImport)("ScreenshotTools")}static async CreateScreenshotUsingRenderTargetAsync(e,t,r,a="image/png",o=1,s=!1,n,i=!1,c=!1,u=!0,f,d){throw(0,l._WarnImport)("ScreenshotTools")}static RandomId(){return(0,p.RandomGUID)()}static IsBase64(e){return(0,f.IsBase64DataUrl)(e)}static DecodeBase64(e){return(0,f.DecodeBase64UrlToBinary)(e)}static get errorsCount(){return o.Logger.errorsCount}static Log(e){o.Logger.Log(e)}static Warn(e){o.Logger.Warn(e)}static Error(e){o.Logger.Error(e)}static get LogCache(){return o.Logger.LogCache}static ClearLogCache(){o.Logger.ClearLogCache()}static set LogLevels(e){o.Logger.LogLevels=e}static set PerformanceLogLevel(e){(e&t.PerformanceUserMarkLogLevel)===t.PerformanceUserMarkLogLevel?_native?.enablePerformanceLogging?(_native.enablePerformanceLogging(1),t.StartPerformanceCounter=t._StartMarkNative,t.EndPerformanceCounter=t._EndMarkNative):(t.StartPerformanceCounter=t._StartUserMark,t.EndPerformanceCounter=t._EndUserMark):(e&t.PerformanceConsoleLogLevel)===t.PerformanceConsoleLogLevel?_native?.enablePerformanceLogging?(_native.enablePerformanceLogging(2),t.StartPerformanceCounter=t._StartMarkNative,t.EndPerformanceCounter=t._EndMarkNative):(t.StartPerformanceCounter=t._StartPerformanceConsole,t.EndPerformanceCounter=t._EndPerformanceConsole):(t.StartPerformanceCounter=t._StartPerformanceCounterDisabled,t.EndPerformanceCounter=t._EndPerformanceCounterDisabled,_native?.disablePerformanceLogging?.())}static _StartPerformanceCounterDisabled(e,t){}static _EndPerformanceCounterDisabled(e,t){}static _StartUserMark(e,r=!0){if(!t._Performance){if(!(0,a.IsWindowObjectExist)())return;t._Performance=window.performance}r&&t._Performance.mark&&t._Performance.mark(e+"-Begin")}static _EndUserMark(e,r=!0){r&&t._Performance.mark&&(t._Performance.mark(e+"-End"),t._Performance.measure(e,e+"-Begin",e+"-End"))}static _StartPerformanceConsole(e,r=!0){r&&(t._StartUserMark(e,r),console.time&&console.time(e))}static _EndPerformanceConsole(e,r=!0){r&&(t._EndUserMark(e,r),console.timeEnd(e))}static _StartMarkNative(e,r=!0){if(r&&_native?.startPerformanceCounter)if(t._NativePerformanceCounterHandles.has(e))t.Warn(`Performance counter with name ${e} is already started.`);else{let r=_native.startPerformanceCounter(e);t._NativePerformanceCounterHandles.set(e,r)}}static _EndMarkNative(e,r=!0){if(r&&_native?.endPerformanceCounter){let r=t._NativePerformanceCounterHandles.get(e);r?(_native.endPerformanceCounter(r),t._NativePerformanceCounterHandles.delete(e)):t.Warn(`Performance counter with name ${e} was not started.`)}}static get Now(){return i.PrecisionDate.Now}static GetClassName(e,t=!1){let r=null;return!t&&e.getClassName?r=e.getClassName():(e instanceof Object&&(r=(t?e:Object.getPrototypeOf(e)).constructor.__bjsclassName__),r||(r=typeof e)),r}static First(e,t){for(let r of e)if(t(r))return r;return null}static getFullClassName(e,t=!1){let r=null,a=null;if(!t&&e.getClassName)r=e.getClassName();else{if(e instanceof Object){let o=t?e:Object.getPrototypeOf(e);r=o.constructor.__bjsclassName__,a=o.constructor.__bjsmoduleName__}r||(r=typeof e)}return r?(null!=a?a+".":"")+r:null}static async DelayAsync(e){await new Promise(t=>{setTimeout(()=>{t()},e)})}static IsSafari(){return!!(0,a.IsNavigatorAvailable)()&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}}t=m,m.AssetBaseUrl="",m.UseCustomRequestHeaders=!1,m.CustomRequestHeaders=c.WebRequest.CustomRequestHeaders,m.GetDOMTextContent=a.GetDOMTextContent,m._DefaultCdnUrl="https://cdn.babylonjs.com",m._CdnVersion="9.13.0",m._DefaultAssetsUrl="https://assets.babylonjs.com/core",m.LoadScript="u"<typeof _native?t._LoadScriptWeb:t._LoadScriptNative,m.GetAbsoluteUrl="object"==typeof document?e=>{let t=document.createElement("a");return t.href=e,t.href}:"function"==typeof URL&&"object"==typeof location?e=>new URL(e,location.origin).href:()=>{throw Error("Unable to get absolute URL. Override BABYLON.Tools.GetAbsoluteUrl to a custom implementation for the current context.")},m.NoneLogLevel=o.Logger.NoneLogLevel,m.MessageLogLevel=o.Logger.MessageLogLevel,m.WarningLogLevel=o.Logger.WarningLogLevel,m.ErrorLogLevel=o.Logger.ErrorLogLevel,m.AllLogLevel=o.Logger.AllLogLevel,m.IsWindowObjectExist=a.IsWindowObjectExist,m.PerformanceNoneLogLevel=0,m.PerformanceUserMarkLogLevel=1,m.PerformanceConsoleLogLevel=2,m._NativePerformanceCounterHandles=new Map,m.StartPerformanceCounter=t._StartPerformanceCounterDisabled,m.EndPerformanceCounter=t._EndPerformanceCounterDisabled;class h{constructor(e,t,r,a=0){this.iterations=e,this.index=a-1,this._done=!1,this._fn=t,this._successCallback=r}executeNext(){this._done||(this.index+1<this.iterations?(++this.index,this._fn(this)):this.breakLoop())}breakLoop(){this._done=!0,this._successCallback()}static Run(e,t,r,a=0){let o=new h(e,t,r,a);return o.executeNext(),o}static SyncAsyncForLoop(e,t,r,a,o,s=0){return h.Run(Math.ceil(e/t),a=>{o&&o()?a.breakLoop():setTimeout(()=>{for(let s=0;s<t;++s){let n=a.index*t+s;if(n>=e)break;if(r(n),o&&o()){a.breakLoop();break}}a.executeNext()},s)},a)}}e.s(["AsyncLoop",0,h,"Tools",0,m],65740)}]);