@uptimizr/dashboard 0.1.3 → 0.3.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 (236) hide show
  1. package/README.md +1 -1
  2. package/out/404.html +1 -1
  3. package/out/__next.__PAGE__.txt +4 -4
  4. package/out/__next._full.txt +11 -11
  5. package/out/__next._head.txt +4 -4
  6. package/out/__next._index.txt +4 -4
  7. package/out/__next._tree.txt +2 -2
  8. package/out/_next/static/chunks/002cjeoit6-up.js +1 -0
  9. package/out/_next/static/chunks/02n1uiltexy3w.js +1 -0
  10. package/out/_next/static/chunks/03ab2khhe8-x5.js +1 -0
  11. package/out/_next/static/chunks/04_yytpc2paxy.js +1 -0
  12. package/out/_next/static/chunks/06qot1qvlsqaz.js +1 -0
  13. package/out/_next/static/chunks/07eeopuufsqp-.js +1501 -0
  14. package/out/_next/static/chunks/08a5xek662n8n.js +1 -0
  15. package/out/_next/static/chunks/08wuc9--s8zn_.js +1 -0
  16. package/out/_next/static/chunks/09510356f0lad.js +1 -0
  17. package/out/_next/static/chunks/0_eu72k69lxj7.js +1 -0
  18. package/out/_next/static/chunks/0beajlqy8p8b5.js +1 -0
  19. package/out/_next/static/chunks/0c83pe1mpx456.js +1 -0
  20. package/out/_next/static/chunks/0echnagbkyx79.js +1198 -0
  21. package/out/_next/static/chunks/0eh1ml86u8dh7.js +1 -0
  22. package/out/_next/static/chunks/0fh-9h9ylxskr.js +674 -0
  23. package/out/_next/static/chunks/0fzmc1up21g1i.js +1 -0
  24. package/out/_next/static/chunks/0grlb9lo8e502.js +1 -0
  25. package/out/_next/static/chunks/0h22pg-0xrxnm.js +1 -0
  26. package/out/_next/static/chunks/0j6p1pmc14t96.js +1 -0
  27. package/out/_next/static/chunks/0j_6dx-sttgsy.js +1 -0
  28. package/out/_next/static/chunks/0j__xaq_8_di1.js +1 -0
  29. package/out/_next/static/chunks/0kfd-cvj5fvtz.js +1 -0
  30. package/out/_next/static/chunks/0o_mp98xzqfyf.js +1 -0
  31. package/out/_next/static/chunks/0otsec99kdkt7.js +213 -0
  32. package/out/_next/static/chunks/0ql-s-tsmel_u.js +151 -0
  33. package/out/_next/static/chunks/0r47gs_e93cka.js +1 -0
  34. package/out/_next/static/chunks/0sqys6o2pbe1q.js +1328 -0
  35. package/out/_next/static/chunks/0titqrn1qmcsv.js +1 -0
  36. package/out/_next/static/chunks/0tnlbw78tgaxp.js +4 -0
  37. package/out/_next/static/chunks/0tw4dyl-cp-hd.js +1 -0
  38. package/out/_next/static/chunks/0vbce-8omgurc.js +1 -0
  39. package/out/_next/static/chunks/0vfsg5byzep_0.js +1 -0
  40. package/out/_next/static/chunks/{0gv7mblzv3dl3.js → 0w8_1yjvol1f0.js} +20 -20
  41. package/out/_next/static/chunks/0xh144a5fz58h.js +1 -0
  42. package/out/_next/static/chunks/0xjltg_pph0c8.js +1 -0
  43. package/out/_next/static/chunks/0yeqgh0dnas8d.js +1 -0
  44. package/out/_next/static/chunks/101-7e_7up7rk.js +1 -0
  45. package/out/_next/static/chunks/128e51hj_04r0.js +1 -0
  46. package/out/_next/static/chunks/{10fnxpln_5xfd.js → 12kv810lohbsx.js} +2 -2
  47. package/out/_next/static/chunks/14bws-suyy5zu.js +1 -0
  48. package/out/_next/static/chunks/14ggsmqwej_tt.js +1656 -0
  49. package/out/_next/static/chunks/17genz6pkmty_.js +1 -0
  50. package/out/_next/static/chunks/17xd8hnazzr0g.js +1454 -0
  51. package/out/_next/static/chunks/18dczy9ylt2s_.js +1 -0
  52. package/out/_next/static/chunks/18xs_kvsaolb0.js +1 -0
  53. package/out/_next/static/chunks/19016f8-ry0z6.js +1 -0
  54. package/out/_next/static/chunks/1_6oejyxj39li.js +1 -0
  55. package/out/_next/static/chunks/1_aon8nz9p1fr.js +1 -0
  56. package/out/_next/static/chunks/1_qzlkuxukhpq.js +779 -0
  57. package/out/_next/static/chunks/1akaj5rhgitn3.js +1 -0
  58. package/out/_next/static/chunks/1bvl1ws7b_3gn.js +1 -0
  59. package/out/_next/static/chunks/1cdbk6kxyr1c9.js +1 -0
  60. package/out/_next/static/chunks/1fbjkk55uu4_g.js +1 -0
  61. package/out/_next/static/chunks/1furcfsgrw_3g.js +1 -0
  62. package/out/_next/static/chunks/1g0-f1g3gn_rs.js +1 -0
  63. package/out/_next/static/chunks/1g7emwu85bifo.js +557 -0
  64. package/out/_next/static/chunks/{37vzwr3ciejf1.js → 1gs-5722l4u59.js} +1 -1
  65. package/out/_next/static/chunks/1gt4kh0_xmigy.js +1 -0
  66. package/out/_next/static/chunks/1h8xzuuhhglu9.js +1 -0
  67. package/out/_next/static/chunks/1hatz-jlztrn0.js +1 -0
  68. package/out/_next/static/chunks/1iioifo7i0t0_.js +1 -0
  69. package/out/_next/static/chunks/{0impkpmxx3ttp.js → 1iiz7jqgj20z0.js} +1 -1
  70. package/out/_next/static/chunks/1kujmd5n0j9nk.js +1 -0
  71. package/out/_next/static/chunks/{2kazjq29jeamx.js → 1ltux4lwz7muf.js} +160 -372
  72. package/out/_next/static/chunks/1m_buecgcq67j.js +740 -0
  73. package/out/_next/static/chunks/1n9sy0yt5d2vq.js +1 -0
  74. package/out/_next/static/chunks/1p1gz6dseck--.js +1 -0
  75. package/out/_next/static/chunks/1p1xtsfwvpuqo.js +1 -0
  76. package/out/_next/static/chunks/1p8f6okk2ewbz.js +1 -0
  77. package/out/_next/static/chunks/1qg_etglhvp9h.js +740 -0
  78. package/out/_next/static/chunks/1th_t5ujeqlkf.js +1 -0
  79. package/out/_next/static/chunks/1thr-mdzbu96v.js +1 -0
  80. package/out/_next/static/chunks/1tta1a064979p.js +1 -0
  81. package/out/_next/static/chunks/1u_riwm0nfww7.js +1 -0
  82. package/out/_next/static/chunks/1ua15kzid0_8p.js +2560 -0
  83. package/out/_next/static/chunks/1uu-rt_8p1edp.js +2712 -0
  84. package/out/_next/static/chunks/1uu93wuxigx4k.js +1 -0
  85. package/out/_next/static/chunks/1vuq3dos1406d.css +3 -0
  86. package/out/_next/static/chunks/1ynju1jqfrcv0.js +1 -0
  87. package/out/_next/static/chunks/1zfojlgb15okk.js +1 -0
  88. package/out/_next/static/chunks/1zj8x5wbgnzz-.js +1 -0
  89. package/out/_next/static/chunks/1zl6t15gh34nn.js +1 -0
  90. package/out/_next/static/chunks/2-qo2o1_fmpy-.js +3 -0
  91. package/out/_next/static/chunks/{1thjncpj7u6pq.js → 223vrr_4sfhsj.js} +1 -1
  92. package/out/_next/static/chunks/22cr2b04btguf.js +1 -0
  93. package/out/_next/static/chunks/242xhzxxetctz.js +1 -0
  94. package/out/_next/static/chunks/24essz5mmvx-6.js +1 -0
  95. package/out/_next/static/chunks/256k1jw1m--l7.js +146 -0
  96. package/out/_next/static/chunks/259obyrpxcv6r.js +1 -0
  97. package/out/_next/static/chunks/26v9yqicofqba.js +1 -0
  98. package/out/_next/static/chunks/290d93hmm_e8b.js +1 -0
  99. package/out/_next/static/chunks/2_2fk7iddrs43.js +1 -0
  100. package/out/_next/static/chunks/{00k_j_r7bv_eb.js → 2bjlls8-qe05r.js} +9 -9
  101. package/out/_next/static/chunks/2ckd7f1wbfod-.js +1 -0
  102. package/out/_next/static/chunks/{163fa70v4mgxj.js → 2d6hru4qo23tt.js} +1 -1
  103. package/out/_next/static/chunks/2ejvntxtvf5o9.js +1 -0
  104. package/out/_next/static/chunks/2f7_3tzf7xhps.js +1 -0
  105. package/out/_next/static/chunks/2gxd_o1g89_bv.js +1 -0
  106. package/out/_next/static/chunks/2hd2txb4-m9k1.js +1 -0
  107. package/out/_next/static/chunks/2hpxou_cnp4f_.js +1 -0
  108. package/out/_next/static/chunks/2izioctrfc0s5.js +1 -0
  109. package/out/_next/static/chunks/2jhnk4h4n0udv.js +1 -0
  110. package/out/_next/static/chunks/2jpkhkk9zi8-f.js +1 -0
  111. package/out/_next/static/chunks/2kpet_l1kq2sx.js +1 -0
  112. package/out/_next/static/chunks/2nck5w4c7leb7.js +1 -0
  113. package/out/_next/static/chunks/2qq3uzsbiicw3.js +1194 -0
  114. package/out/_next/static/chunks/2qqqpu0ahfdda.js +1 -0
  115. package/out/_next/static/chunks/2r3ct6se2qn8z.js +1 -0
  116. package/out/_next/static/chunks/2u-f7mmxvk8wj.js +1 -0
  117. package/out/_next/static/chunks/2ue1wo4ryk87z.js +1 -0
  118. package/out/_next/static/chunks/2uk-vwlxe9-xr.js +1 -0
  119. package/out/_next/static/chunks/2ur5-lxdvv1jm.js +1 -0
  120. package/out/_next/static/chunks/2veqsohwfhfqc.js +1 -0
  121. package/out/_next/static/chunks/2vqlv9wnewhu9.js +1 -0
  122. package/out/_next/static/chunks/{1zvc1tv--w8nn.js → 2wzshintp5lf8.js} +1 -1
  123. package/out/_next/static/chunks/2x-00glogc485.js +1 -0
  124. package/out/_next/static/chunks/2yfxy0f5fqs4o.js +1 -0
  125. package/out/_next/static/chunks/2z88mt3ixktu3.js +1 -0
  126. package/out/_next/static/chunks/2z_jn9ud28fk7.js +1 -0
  127. package/out/_next/static/chunks/3-eswqjobiqk1.js +1 -0
  128. package/out/_next/static/chunks/30-tbi7pys6fp.js +4 -0
  129. package/out/_next/static/chunks/30c-nsedy_ce0.js +1 -0
  130. package/out/_next/static/chunks/31u5lbu1vxznh.js +1 -0
  131. package/out/_next/static/chunks/{2feca0xcipcyt.js → 32ahba5ezp467.js} +156 -156
  132. package/out/_next/static/chunks/337hn35kts7ud.js +1 -0
  133. package/out/_next/static/chunks/33dgpebv-tf73.js +1 -0
  134. package/out/_next/static/chunks/36jkdhq6kb-cf.js +1 -0
  135. package/out/_next/static/chunks/37epa8fz59vba.js +1166 -0
  136. package/out/_next/static/chunks/3833xfnz0a-ub.js +1 -0
  137. package/out/_next/static/chunks/38awrh_qxn22k.js +1 -0
  138. package/out/_next/static/chunks/{0wrm9jr-9bw0e.js → 38x3c1ra5slhe.js} +383 -913
  139. package/out/_next/static/chunks/39idqlqlcp5b9.js +1 -0
  140. package/out/_next/static/chunks/{2a3spdq-m8drh.js → 3_gku1pwluoo0.js} +1 -1
  141. package/out/_next/static/chunks/3_mu-4rdjajna.js +1450 -0
  142. package/out/_next/static/chunks/3coacc4-g-g5c.js +1 -0
  143. package/out/_next/static/chunks/3e00fzdfkclzq.js +1 -0
  144. package/out/_next/static/chunks/3e8fmlq0k5wkg.js +1 -0
  145. package/out/_next/static/chunks/3e9tzyrt4_98z.js +1 -0
  146. package/out/_next/static/chunks/3edelqkq92pil.js +1 -0
  147. package/out/_next/static/chunks/3figbil1t4ssj.js +593 -0
  148. package/out/_next/static/chunks/3gimb3z_mteou.js +1 -0
  149. package/out/_next/static/chunks/{2p2vv6cc9i-3q.js → 3idaz_s77e-j_.js} +9 -9
  150. package/out/_next/static/chunks/3j-4wuhs5weba.js +1 -0
  151. package/out/_next/static/chunks/3jjfnwvybayy7.js +1 -0
  152. package/out/_next/static/chunks/3jwm5dfk_78gc.js +1 -0
  153. package/out/_next/static/chunks/3k9d4ylc3li2t.js +1352 -0
  154. package/out/_next/static/chunks/3l3_0ack3gy4k.js +1 -0
  155. package/out/_next/static/chunks/3lwhs5ja7tun3.js +1 -0
  156. package/out/_next/static/chunks/3m6nmp2dca6un.js +1342 -0
  157. package/out/_next/static/chunks/3mbnfpufs2-7e.js +7 -0
  158. package/out/_next/static/chunks/3mcd08gmt038z.js +1 -0
  159. package/out/_next/static/chunks/3mt5th7b1i_u9.js +1 -0
  160. package/out/_next/static/chunks/3ne77mjdz2y7o.js +1 -0
  161. package/out/_next/static/chunks/3puhrqtujktyv.js +1 -0
  162. package/out/_next/static/chunks/3rdifucupcgkg.js +1 -0
  163. package/out/_next/static/chunks/3riekaxl3uxfb.js +1195 -0
  164. package/out/_next/static/chunks/3sdoskq_buttj.js +1 -0
  165. package/out/_next/static/chunks/3tg-ma9tv9xu4.js +1 -0
  166. package/out/_next/static/chunks/3tm-pqpmq_ppw.js +1 -0
  167. package/out/_next/static/chunks/3w9go565cjhq3.js +1636 -0
  168. package/out/_next/static/chunks/3wi9gzq2mtr_q.js +8 -0
  169. package/out/_next/static/chunks/3xagd_2_9zft2.js +1 -0
  170. package/out/_next/static/chunks/3xsq_anpad-fb.js +1 -0
  171. package/out/_next/static/chunks/3ycv2qq7vpbua.js +1 -0
  172. package/out/_next/static/chunks/3z84au-mitjjw.js +1 -0
  173. package/out/_next/static/chunks/4030dhur2h70-.js +1 -0
  174. package/out/_next/static/chunks/40ffffml4h_3r.js +4 -0
  175. package/out/_next/static/chunks/{3-shckrcpvbxu.js → 41wt50z9tx9cx.js} +108 -711
  176. package/out/_next/static/chunks/{1flb8adpj6_2o.js → 42k2-4_2hrg6u.js} +1 -1
  177. package/out/_next/static/chunks/431slrqh0wa0g.js +1 -0
  178. package/out/_next/static/chunks/43s_lbd1i2krj.js +1 -0
  179. package/out/_next/static/chunks/{0-2y-_oomza2l.js → 44nxswtahaq4w.js} +18 -18
  180. package/out/_next/static/chunks/45bwefvdpztfs.js +1 -0
  181. package/out/_next/static/chunks/{turbopack-0sgd6pfbe1fy6.js → turbopack-19105pdhzxp1x.js} +1 -1
  182. package/out/_not-found/__next._full.txt +9 -9
  183. package/out/_not-found/__next._head.txt +4 -4
  184. package/out/_not-found/__next._index.txt +4 -4
  185. package/out/_not-found/__next._not-found.__PAGE__.txt +2 -2
  186. package/out/_not-found/__next._not-found.txt +3 -3
  187. package/out/_not-found/__next._tree.txt +2 -2
  188. package/out/_not-found.html +1 -1
  189. package/out/_not-found.txt +9 -9
  190. package/out/index.html +1 -1
  191. package/out/index.txt +11 -11
  192. package/package.json +5 -4
  193. package/out/_next/static/chunks/068j6934u8j16.js +0 -1
  194. package/out/_next/static/chunks/09e4adtr6w0xe.js +0 -1
  195. package/out/_next/static/chunks/0_rf76jneiwal.js +0 -176
  196. package/out/_next/static/chunks/0aznt7717miff.js +0 -1
  197. package/out/_next/static/chunks/0cu-q5q3a7uf3.js +0 -1
  198. package/out/_next/static/chunks/0fskcfh9vbhtv.js +0 -1
  199. package/out/_next/static/chunks/0o_tpe5tlugtr.js +0 -3
  200. package/out/_next/static/chunks/0pj9pajm2xz97.css +0 -3
  201. package/out/_next/static/chunks/0ufbyo1x3qkmo.js +0 -1
  202. package/out/_next/static/chunks/0wwcfw8i3j_zx.js +0 -1
  203. package/out/_next/static/chunks/0ys9-ozuluawt.js +0 -1
  204. package/out/_next/static/chunks/1-61zh4waha61.js +0 -1
  205. package/out/_next/static/chunks/10r_824wzt8hj.js +0 -1
  206. package/out/_next/static/chunks/11v6j6q59u-f_.js +0 -1
  207. package/out/_next/static/chunks/123xxske5c9na.js +0 -1
  208. package/out/_next/static/chunks/13isnf0--pmx1.js +0 -1
  209. package/out/_next/static/chunks/157d9euci08yu.js +0 -1
  210. package/out/_next/static/chunks/18u58lorfahxi.js +0 -4
  211. package/out/_next/static/chunks/1_aahautsz2v_.js +0 -1
  212. package/out/_next/static/chunks/1o1d0p-v1z8ty.js +0 -1
  213. package/out/_next/static/chunks/1vdjn0pkoyypn.js +0 -1
  214. package/out/_next/static/chunks/1yehxf-fmeicg.js +0 -1
  215. package/out/_next/static/chunks/1zx2q-r32thv1.js +0 -4
  216. package/out/_next/static/chunks/2-sjjedfr0kfq.js +0 -1
  217. package/out/_next/static/chunks/25b9x-li-tvk2.js +0 -1
  218. package/out/_next/static/chunks/2aelw3far6rii.js +0 -1
  219. package/out/_next/static/chunks/2aor7m-wbis85.js +0 -1
  220. package/out/_next/static/chunks/2fh-_9b6tqhvb.js +0 -1
  221. package/out/_next/static/chunks/2g5gecypj0rqe.js +0 -1
  222. package/out/_next/static/chunks/2szdcpl41-kzv.js +0 -1
  223. package/out/_next/static/chunks/2u6shh3oeycm-.js +0 -1
  224. package/out/_next/static/chunks/2unhhuv0arlcv.js +0 -1
  225. package/out/_next/static/chunks/310uz81hnnzsu.js +0 -1
  226. package/out/_next/static/chunks/3i3gbhccmhu7j.js +0 -210
  227. package/out/_next/static/chunks/3mqy-84_ul3t2.js +0 -1
  228. package/out/_next/static/chunks/3nz-dh9d7cehk.js +0 -1
  229. package/out/_next/static/chunks/3pufs8g4ui943.js +0 -1
  230. package/out/_next/static/chunks/3t06schbtqonl.js +0 -1
  231. package/out/_next/static/chunks/3v3-7fio3nw_t.js +0 -1
  232. package/out/_next/static/chunks/3v5ha25nxo43j.js +0 -1
  233. package/out/_next/static/chunks/3zskk1hxu3-_o.js +0 -1
  234. /package/out/_next/static/{yttuijl-0Cn9k8uTCfhIM → 1NTbwHeIsn3AW-SeH9aP0}/_buildManifest.js +0 -0
  235. /package/out/_next/static/{yttuijl-0Cn9k8uTCfhIM → 1NTbwHeIsn3AW-SeH9aP0}/_clientMiddlewareManifest.js +0 -0
  236. /package/out/_next/static/{yttuijl-0Cn9k8uTCfhIM → 1NTbwHeIsn3AW-SeH9aP0}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,97998,e=>{"use strict";var t,s,r=e.i(96265),i=e.i(40408),o=e.i(35407),a=e.i(21249),n=e.i(1773);function h(e,t,s=null){let l=t.pathArray,u=t.closeArray,c=t.closePath,d=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),f=t.instance,p=t.updatable;if(f){let e=r.TmpVectors.Vector3[0].setAll(Number.MAX_VALUE),s=r.TmpVectors.Vector3[1].setAll(-Number.MAX_VALUE),h=f.getVerticesData(o.VertexBuffer.PositionKind);if((t=>{let r=l[0].length,o=0,a=f._originalBuilderSideOrientation===i.Mesh.DOUBLESIDE?2:1;for(let i=1;i<=a;++i)for(let i=0;i<l.length;++i){let a=l[i],n=a.length;r=r<n?r:n;for(let i=0;i<r;++i){let r=a[i];t[o]=r.x,t[o+1]=r.y,t[o+2]=r.z,e.minimizeInPlaceFromFloats(r.x,r.y,r.z),s.maximizeInPlaceFromFloats(r.x,r.y,r.z),o+=3}if(f._creationDataStorage&&f._creationDataStorage.closePath){let e=a[0];t[o]=e.x,t[o+1]=e.y,t[o+2]=e.z,o+=3}}})(h),f.hasBoundingInfo?f.getBoundingInfo().reConstruct(e,s,f._worldMatrix):f.buildBoundingInfo(e,s,f._worldMatrix),f.updateVerticesData(o.VertexBuffer.PositionKind,h,!1,!1),t.colors){let e=f.getVerticesData(o.VertexBuffer.ColorKind);for(let s=0,r=0;s<t.colors.length;s++,r+=4){let i=t.colors[s];e[r]=i.r,e[r+1]=i.g,e[r+2]=i.b,e[r+3]=i.a}f.updateVerticesData(o.VertexBuffer.ColorKind,e,!1,!1)}if(t.uvs){let e=f.getVerticesData(o.VertexBuffer.UVKind);for(let s=0;s<t.uvs.length;s++)e[2*s]=t.uvs[s].x,e[2*s+1]=n.useOpenGLOrientationForUV?1-t.uvs[s].y:t.uvs[s].y;f.updateVerticesData(o.VertexBuffer.UVKind,e,!1,!1)}if(!f.areNormalsFrozen||f.isFacetDataEnabled){let e=f.getIndices(),t=f.getVerticesData(o.VertexBuffer.NormalKind),s=f.isFacetDataEnabled?f.getFacetDataParameters():null;if(a.VertexData.ComputeNormals(h,e,t,s),f._creationDataStorage&&f._creationDataStorage.closePath){let e,s;for(let r=0;r<l.length;r++)e=3*f._creationDataStorage.idx[r],s=r+1<l.length?(f._creationDataStorage.idx[r+1]-1)*3:t.length-3,t[e]=(t[e]+t[s])*.5,t[e+1]=(t[e+1]+t[s+1])*.5,t[e+2]=(t[e+2]+t[s+2])*.5,t[s]=t[e],t[s+1]=t[e+1],t[s+2]=t[e+2]}f.areNormalsFrozen||f.updateVerticesData(o.VertexBuffer.NormalKind,t,!1,!1)}return f}{let r=new i.Mesh(e,s);r._originalBuilderSideOrientation=d,r._creationDataStorage=new i._CreationDataStorage;let h=function(e){let t,s,r,i,h,l,u,c,d,f,p,x,g,_=e.pathArray,m=e.closeArray||!1,M=e.closePath||!1,y=e.invertUV||!1,V=Math.floor(_[0].length/2),O=e.offset||V;O=O>V?V:Math.floor(O);let A=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,v=e.uvs,T=e.colors,b=[],I=[],D=[],w=[],P=[],F=[],B=[],L=[],E=[],C=[];if(_.length<2){let e=[],t=[];for(r=0;r<_[0].length-O;r++)e.push(_[0][r]),t.push(_[0][r+O]);_=[e,t]}let S=0,z=+!!M,R=+!!m;for(s=0,t=_[0].length;s<_.length+R;s++){for(B[s]=0,P[s]=[0],t=t<(l=(h=s===_.length?_[0]:_[s]).length)?t:l,i=0;i<l;)b.push(h[i].x,h[i].y,h[i].z),i>0&&(u=h[i].subtract(h[i-1]).length()+B[s],P[s].push(u),B[s]=u),i++;M&&(i--,b.push(h[0].x,h[0].y,h[0].z),u=h[i].subtract(h[0]).length()+B[s],P[s].push(u),B[s]=u),E[s]=l+z,C[s]=S,S+=l+z}for(r=0;r<t+z;r++)for(s=0,L[r]=0,F[r]=[0];s<_.length-1+R;s++)c=_[s],d=s===_.length-1?_[0]:_[s+1],r===t?(f=c[0],p=d[0]):(f=c[r],p=d[r]),u=p.subtract(f).length()+L[r],F[r].push(u),L[r]=u;if(v)for(s=0;s<v.length;s++)w.push(v[s].x,n.useOpenGLOrientationForUV?1-v[s].y:v[s].y);else for(s=0;s<_.length+R;s++)for(r=0;r<t+z;r++)x=0!=B[s]?P[s][r]/B[s]:0,g=0!=L[r]?F[r][s]/L[r]:0,y?w.push(g,x):w.push(x,n.useOpenGLOrientationForUV?1-g:g);let U=0,N=E[s=0]-1,W=E[s+1]-1,G=N<W?N:W,k=C[1]-C[0],H=E.length-1;for(;U<=G&&s<H;)I.push(U,U+k,U+1),I.push(U+k+1,U+1,U+k),(U+=1)===G&&(k=C[++s+1]-C[s],N=E[s]-1,W=E[s+1]-1,U=C[s],G=N<W?N+U:W+U);if(a.VertexData.ComputeNormals(b,I,D),M){let e,t;for(s=0;s<_.length;s++){e=3*C[s],t=s+1<_.length?(C[s+1]-1)*3:D.length-3,D[e]=(D[e]+D[t])*.5,D[e+1]=(D[e+1]+D[t+1])*.5,D[e+2]=(D[e+2]+D[t+2])*.5;let r=Math.sqrt(D[e]*D[e]+D[e+1]*D[e+1]+D[e+2]*D[e+2]);D[e]/=r,D[e+1]/=r,D[e+2]/=r,D[t]=D[e],D[t+1]=D[e+1],D[t+2]=D[e+2]}}if(m){let e=3*C[0],s=3*C[_.length];for(r=0;r<t+z;r++){D[e]=(D[e]+D[s])*.5,D[e+1]=(D[e+1]+D[s+1])*.5,D[e+2]=(D[e+2]+D[s+2])*.5;let t=Math.sqrt(D[e]*D[e]+D[e+1]*D[e+1]+D[e+2]*D[e+2]);D[e]/=t,D[e+1]/=t,D[e+2]/=t,D[s]=D[e],D[s+1]=D[e+1],D[s+2]=D[e+2],e+=3,s+=3}}a.VertexData._ComputeSides(A,b,I,D,w,e.frontUVs,e.backUVs);let X=null;if(T){X=new Float32Array(4*T.length);for(let e=0;e<T.length;e++)X[4*e]=T[e].r,X[4*e+1]=T[e].g,X[4*e+2]=T[e].b,X[4*e+3]=T[e].a}let Z=new a.VertexData,K=new Float32Array(b),Y=new Float32Array(D),q=new Float32Array(w);return Z.indices=I,Z.positions=K,Z.normals=Y,Z.uvs=q,X&&Z.set(X,o.VertexBuffer.ColorKind),M&&(Z._idx=C),Z}(t);return c&&(r._creationDataStorage.idx=h._idx),r._creationDataStorage.closePath=c,r._creationDataStorage.closeArray=u,h.applyToMesh(r,p),r}}var l=e.i(70653);function u(e){let t=e.pattern||i.Mesh.NO_FLIP,s=e.tileWidth||e.tileSize||1,r=e.tileHeight||e.tileSize||1,o=e.alignHorizontal||0,n=e.alignVertical||0,h=e.width||e.size||1,l=Math.floor(h/s),u=h-l*s,c=e.height||e.size||1,d=Math.floor(c/r),f=c-d*r,p=s*l/2,x=r*d/2,g=0,_=0,m=0,M=0,y=0,V=0;if(u>0||f>0){switch(m=-p,M=-x,y=p,V=x,o){case i.Mesh.CENTER:u/=2,m-=u,y+=u;break;case i.Mesh.LEFT:y+=u,g=-u/2;break;case i.Mesh.RIGHT:m-=u,g=u/2}switch(n){case i.Mesh.CENTER:f/=2,M-=f,V+=f;break;case i.Mesh.BOTTOM:V+=f,_=-f/2;break;case i.Mesh.TOP:M-=f,_=f/2}}let O=[],A=[],v=[];v[0]=[0,0,1,0,1,1,0,1],v[1]=[0,0,1,0,1,1,0,1],(t===i.Mesh.ROTATE_TILE||t===i.Mesh.ROTATE_ROW)&&(v[1]=[1,1,0,1,0,0,1,0]),(t===i.Mesh.FLIP_TILE||t===i.Mesh.FLIP_ROW)&&(v[1]=[1,0,0,0,0,1,1,1]),(t===i.Mesh.FLIP_N_ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_ROW)&&(v[1]=[0,1,1,1,1,0,0,0]);let T=[],b=[],I=[],D=0;for(let e=0;e<d;e++)for(let o=0;o<l;o++)O.push(-p+o*s+g,-x+e*r+_,0),O.push(-p+(o+1)*s+g,-x+e*r+_,0),O.push(-p+(o+1)*s+g,-x+(e+1)*r+_,0),O.push(-p+o*s+g,-x+(e+1)*r+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),T=t===i.Mesh.FLIP_TILE||t===i.Mesh.ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_TILE?T.concat(v[(o%2+e%2)%2]):t===i.Mesh.FLIP_ROW||t===i.Mesh.ROTATE_ROW||t===i.Mesh.FLIP_N_ROTATE_ROW?T.concat(v[e%2]):T.concat(v[0]),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1),D+=4;if(u>0||f>0){let e,a,h,c,v,w=f>0&&(n===i.Mesh.CENTER||n===i.Mesh.TOP),P=f>0&&(n===i.Mesh.CENTER||n===i.Mesh.BOTTOM),F=u>0&&(o===i.Mesh.CENTER||o===i.Mesh.RIGHT),B=u>0&&(o===i.Mesh.CENTER||o===i.Mesh.LEFT);if(w&&F&&(O.push(m+g,M+_,0),O.push(-p+g,M+_,0),O.push(-p+g,M+f+_,0),O.push(m+g,M+f+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,c=1,v=1,e=[a=1-u/s,h=1-f/r,c,h,c,v,a,v],t===i.Mesh.ROTATE_ROW&&(e=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),t===i.Mesh.FLIP_ROW&&(e=[1-a,h,1-c,h,1-c,v,1-a,v]),t===i.Mesh.FLIP_N_ROTATE_ROW&&(e=[a,1-h,c,1-h,c,1-v,a,1-v]),T=T.concat(e),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),w&&B&&(O.push(p+g,M+_,0),O.push(y+g,M+_,0),O.push(y+g,M+f+_,0),O.push(p+g,M+f+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,v=1,e=[a=0,h=1-f/r,c=u/s,h,c,v,a,v],(t===i.Mesh.ROTATE_ROW||t===i.Mesh.ROTATE_TILE&&l%2==0)&&(e=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_ROW||t===i.Mesh.FLIP_TILE&&l%2==0)&&(e=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_ROW||t===i.Mesh.FLIP_N_ROTATE_TILE&&l%2==0)&&(e=[a,1-h,c,1-h,c,1-v,a,1-v]),T=T.concat(e),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),P&&F&&(O.push(m+g,x+_,0),O.push(-p+g,x+_,0),O.push(-p+g,V+_,0),O.push(m+g,V+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,h=0,c=1,e=[a=1-u/s,h,c,h,c,v=f/r,a,v],(t===i.Mesh.ROTATE_ROW&&d%2==1||t===i.Mesh.ROTATE_TILE&&d%1==0)&&(e=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_ROW&&d%2==1||t===i.Mesh.FLIP_TILE&&d%2==0)&&(e=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_ROW&&d%2==1||t===i.Mesh.FLIP_N_ROTATE_TILE&&d%2==0)&&(e=[a,1-h,c,1-h,c,1-v,a,1-v]),T=T.concat(e),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),P&&B&&(O.push(p+g,x+_,0),O.push(y+g,x+_,0),O.push(y+g,V+_,0),O.push(p+g,V+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,e=[a=0,h=0,c=u/s,h,c,v=f/r,a,v],(t===i.Mesh.ROTATE_ROW&&d%2==1||t===i.Mesh.ROTATE_TILE&&(d+l)%2==1)&&(e=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_ROW&&d%2==1||t===i.Mesh.FLIP_TILE&&(d+l)%2==1)&&(e=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_ROW&&d%2==1||t===i.Mesh.FLIP_N_ROTATE_TILE&&(d+l)%2==1)&&(e=[a,1-h,c,1-h,c,1-v,a,1-v]),T=T.concat(e),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),w){let e=[];a=0,h=1-f/r,c=1,v=1,e[0]=[a,h,c,h,c,v,a,v],e[1]=[a,h,c,h,c,v,a,v],(t===i.Mesh.ROTATE_TILE||t===i.Mesh.ROTATE_ROW)&&(e[1]=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_TILE||t===i.Mesh.FLIP_ROW)&&(e[1]=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_ROW)&&(e[1]=[a,1-h,c,1-h,c,1-v,a,1-v]);for(let r=0;r<l;r++)O.push(-p+r*s+g,M+_,0),O.push(-p+(r+1)*s+g,M+_,0),O.push(-p+(r+1)*s+g,M+f+_,0),O.push(-p+r*s+g,M+f+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,T=t===i.Mesh.FLIP_TILE||t===i.Mesh.ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_TILE?T.concat(e[(r+1)%2]):t===i.Mesh.FLIP_ROW||t===i.Mesh.ROTATE_ROW||t===i.Mesh.FLIP_N_ROTATE_ROW?T.concat(e[1]):T.concat(e[0]),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)}if(P){let e=[];a=0,h=0,c=1,v=f/r,e[0]=[a,h,c,h,c,v,a,v],e[1]=[a,h,c,h,c,v,a,v],(t===i.Mesh.ROTATE_TILE||t===i.Mesh.ROTATE_ROW)&&(e[1]=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_TILE||t===i.Mesh.FLIP_ROW)&&(e[1]=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_ROW)&&(e[1]=[a,1-h,c,1-h,c,1-v,a,1-v]);for(let r=0;r<l;r++)O.push(-p+r*s+g,V-f+_,0),O.push(-p+(r+1)*s+g,V-f+_,0),O.push(-p+(r+1)*s+g,V+_,0),O.push(-p+r*s+g,V+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,T=t===i.Mesh.FLIP_TILE||t===i.Mesh.ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_TILE?T.concat(e[(r+d)%2]):t===i.Mesh.FLIP_ROW||t===i.Mesh.ROTATE_ROW||t===i.Mesh.FLIP_N_ROTATE_ROW?T.concat(e[d%2]):T.concat(e[0]),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)}if(F){let e=[];a=1-u/s,h=0,c=1,v=1,e[0]=[a,h,c,h,c,v,a,v],e[1]=[a,h,c,h,c,v,a,v],(t===i.Mesh.ROTATE_TILE||t===i.Mesh.ROTATE_ROW)&&(e[1]=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_TILE||t===i.Mesh.FLIP_ROW)&&(e[1]=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_ROW)&&(e[1]=[a,1-h,c,1-h,c,1-v,a,1-v]);for(let s=0;s<d;s++)O.push(m+g,-x+s*r+_,0),O.push(m+u+g,-x+s*r+_,0),O.push(m+u+g,-x+(s+1)*r+_,0),O.push(m+g,-x+(s+1)*r+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,T=t===i.Mesh.FLIP_TILE||t===i.Mesh.ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_TILE?T.concat(e[(s+1)%2]):t===i.Mesh.FLIP_ROW||t===i.Mesh.ROTATE_ROW||t===i.Mesh.FLIP_N_ROTATE_ROW?T.concat(e[s%2]):T.concat(e[0]),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)}if(B){let e=[];a=0,h=0,c=u/r,v=1,e[0]=[a,h,c,h,c,v,a,v],e[1]=[a,h,c,h,c,v,a,v],(t===i.Mesh.ROTATE_TILE||t===i.Mesh.ROTATE_ROW)&&(e[1]=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_TILE||t===i.Mesh.FLIP_ROW)&&(e[1]=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_ROW)&&(e[1]=[a,1-h,c,1-h,c,1-v,a,1-v]);for(let s=0;s<d;s++)O.push(y-u+g,-x+s*r+_,0),O.push(y+g,-x+s*r+_,0),O.push(y+g,-x+(s+1)*r+_,0),O.push(y-u+g,-x+(s+1)*r+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,T=t===i.Mesh.FLIP_TILE||t===i.Mesh.ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_TILE?T.concat(e[(s+l)%2]):t===i.Mesh.FLIP_ROW||t===i.Mesh.ROTATE_ROW||t===i.Mesh.FLIP_N_ROTATE_ROW?T.concat(e[s%2]):T.concat(e[0]),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)}}let w=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE;a.VertexData._ComputeSides(w,O,I,A,T,e.frontUVs,e.backUVs);let P=new a.VertexData;return P.indices=I,P.positions=O,P.normals=A,P.uvs=T,P.colors=w===a.VertexData.DOUBLESIDE?b.concat(b):b,P}function c(e){let t,s=e.faceUV||Array(6),o=e.faceColors,h=e.pattern||i.Mesh.NO_FLIP,c=e.width||e.size||1,d=e.height||e.size||1,f=e.depth||e.size||1,p=e.tileWidth||e.tileSize||1,x=e.tileHeight||e.tileSize||1,g=e.alignHorizontal||0,_=e.alignVertical||0,m=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE;for(let e=0;e<6;e++)void 0===s[e]&&(s[e]=new r.Vector4(0,0,1,1)),o&&void 0===o[e]&&(o[e]=new l.Color4(1,1,1,1));let M=c/2,y=d/2,V=f/2,O=[];for(let e=0;e<2;e++)O[e]=u({pattern:h,tileWidth:p,tileHeight:x,width:c,height:d,alignVertical:_,alignHorizontal:g,sideOrientation:m});for(let e=2;e<4;e++)O[e]=u({pattern:h,tileWidth:p,tileHeight:x,width:f,height:d,alignVertical:_,alignHorizontal:g,sideOrientation:m});let A=_;_===i.Mesh.BOTTOM?A=i.Mesh.TOP:_===i.Mesh.TOP&&(A=i.Mesh.BOTTOM);for(let e=4;e<6;e++)O[e]=u({pattern:h,tileWidth:p,tileHeight:x,width:c,height:f,alignVertical:A,alignHorizontal:g,sideOrientation:m});let v=[],T=[],b=[],I=[],D=[],w=[],P=[],F=[],B=0;for(let e=0;e<6;e++){let i=O[e].positions.length;w[e]=[],P[e]=[];for(let t=0;t<i/3;t++)w[e].push(new r.Vector3(O[e].positions[3*t],O[e].positions[3*t+1],O[e].positions[3*t+2])),P[e].push(new r.Vector3(O[e].normals[3*t],O[e].normals[3*t+1],O[e].normals[3*t+2]));t=O[e].uvs.length,F[e]=[];for(let r=0;r<t;r+=2)F[e][r]=s[e].x+(s[e].z-s[e].x)*O[e].uvs[r],F[e][r+1]=s[e].y+(s[e].w-s[e].y)*O[e].uvs[r+1],n.useOpenGLOrientationForUV&&(F[e][r+1]=1-F[e][r+1]);if(b=b.concat(F[e]),I=I.concat(O[e].indices.map(e=>e+B)),B+=w[e].length,o){let t=o[e];for(let s=0;s<w[e].length;s++)D.push(t.r,t.g,t.b,t.a)}}let L=[{m:r.Matrix.RotationY(Math.PI),t:new r.Vector3(0,0,V),op:1},{m:r.Matrix.Identity(),t:new r.Vector3(0,0,V),op:-1},{m:r.Matrix.RotationY(-Math.PI/2),t:new r.Vector3(M,0,0),op:1},{m:r.Matrix.RotationY(Math.PI/2),t:new r.Vector3(M,0,0),op:-1},{m:r.Matrix.RotationX(Math.PI/2),t:new r.Vector3(0,y,0),op:1},{m:r.Matrix.RotationX(-Math.PI/2),t:new r.Vector3(0,y,0),op:-1}];for(let e=0;e<6;e++){let{m:t,t:s,op:i}=L[e];for(let o of w[e]){let e=r.Vector3.TransformCoordinates(o,t),a=1===i?e.add(s):e.subtract(s);v.push(a.x,a.y,a.z)}for(let s of P[e]){let e=r.Vector3.TransformNormal(s,t);T.push(e.x,e.y,e.z)}}let E=new a.VertexData;return E.indices=I,E.positions=v,E.normals=T,E.uvs=b,o&&(E.colors=m===a.VertexData.DOUBLESIDE?D.concat(D):D),E}a.VertexData.CreateTiledPlane=u,a.VertexData.CreateTiledBox=c;var d=e.i(70247),f=i,p=e.i(13379),x=e.i(12638),g=e.i(71265),_=e.i(24632);class m extends x.AbstractMesh{constructor(e,t){for(const s of(super(e,t.getScene()),this._indexInSourceMeshInstanceArray=-1,this._distanceToCamera=0,t.addInstance(this),this._sourceMesh=t,this._unIndexed=t._unIndexed,this.position.copyFrom(t.position),this.rotation.copyFrom(t.rotation),this.scaling.copyFrom(t.scaling),t.rotationQuaternion&&(this.rotationQuaternion=t.rotationQuaternion.clone()),this.animations=t.animations.slice(),t.getAnimationRanges()))null!=s&&this.createAnimationRange(s.name,s.from,s.to);if(this.infiniteDistance=t.infiniteDistance,this.setPivotMatrix(t.getPivotMatrix()),t.skeleton||t.morphTargetManager||!t.hasBoundingInfo)this.refreshBoundingInfo(!0,!0);else{const e=t.getBoundingInfo();this.buildBoundingInfo(e.minimum,e.maximum)}this._syncSubMeshes()}getClassName(){return"InstancedMesh"}get lightSources(){return this._sourceMesh._lightSources}_resyncLightSources(){}_resyncLightSource(){}_removeLightSource(){}get receiveShadows(){return this._sourceMesh.receiveShadows}set receiveShadows(e){this._sourceMesh?.receiveShadows!==e&&p.Logger.Warn("Setting receiveShadows on an instanced mesh has no effect")}get material(){return this._sourceMesh.material}set material(e){this._sourceMesh?.material!==e&&p.Logger.Warn("Setting material on an instanced mesh has no effect")}get visibility(){return this._sourceMesh.visibility}set visibility(e){this._sourceMesh?.visibility!==e&&p.Logger.Warn("Setting visibility on an instanced mesh has no effect")}get skeleton(){return this._sourceMesh.skeleton}set skeleton(e){this._sourceMesh?.skeleton!==e&&p.Logger.Warn("Setting skeleton on an instanced mesh has no effect")}get renderingGroupId(){return this._sourceMesh.renderingGroupId}set renderingGroupId(e){this._sourceMesh&&e!==this._sourceMesh.renderingGroupId&&p.Logger.Warn("Note - setting renderingGroupId of an instanced mesh has no effect on the scene")}getTotalVertices(){return this._sourceMesh?this._sourceMesh.getTotalVertices():0}getTotalIndices(){return this._sourceMesh.getTotalIndices()}get sourceMesh(){return this._sourceMesh}get geometry(){return this._sourceMesh._geometry}createInstance(e){return this._sourceMesh.createInstance(e)}isReady(e=!1){return this._sourceMesh.isReady(e,!0)}getVerticesData(e,t,s){return this._sourceMesh.getVerticesData(e,t,s)}copyVerticesData(e,t){this._sourceMesh.copyVerticesData(e,t)}getVertexBuffer(e,t){return this._sourceMesh.getVertexBuffer(e,t)}setVerticesData(e,t,s,r){return this.sourceMesh&&this.sourceMesh.setVerticesData(e,t,s,r),this.sourceMesh}updateVerticesData(e,t,s,r){return this.sourceMesh&&this.sourceMesh.updateVerticesData(e,t,s,r),this.sourceMesh}setIndices(e,t=null){return this.sourceMesh&&this.sourceMesh.setIndices(e,t),this.sourceMesh}isVerticesDataPresent(e){return this._sourceMesh.isVerticesDataPresent(e)}getIndices(){return this._sourceMesh.getIndices()}get _positions(){return this._sourceMesh._positions}refreshBoundingInfo(e=!1,t=!1){if(this.hasBoundingInfo&&this.getBoundingInfo().isLocked)return this;let s=this._sourceMesh.geometry?this._sourceMesh.geometry.boundingBias:null;return this._refreshBoundingInfo(this._sourceMesh._getData("object"==typeof e?e:{applySkeleton:e,applyMorph:t},null,o.VertexBuffer.PositionKind),s),this}_preActivate(){return this._currentLOD&&this._currentLOD._preActivate(),this}_activate(e,t){if(super._activate(e,t),this._sourceMesh.subMeshes||p.Logger.Warn("Instances should only be created for meshes with geometry."),this._currentLOD){if(this._currentLOD._getWorldMatrixDeterminant()>=0!=this._getWorldMatrixDeterminant()>=0)return this._internalAbstractMeshDataInfo._actAsRegularMesh=!0,!0;if(this._internalAbstractMeshDataInfo._actAsRegularMesh=!1,this._currentLOD._registerInstanceForRenderId(this,e),t){if(!this._currentLOD._internalAbstractMeshDataInfo._isActiveIntermediate)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstancesIntermediate=!0,!0}else if(!this._currentLOD._internalAbstractMeshDataInfo._isActive)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances=!0,!0}return!1}_postActivate(){this._sourceMesh.edgesShareWithInstances&&this._sourceMesh._edgesRenderer&&this._sourceMesh._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup?(this._sourceMesh._renderingGroup._edgesRenderers.pushNoDuplicate(this._sourceMesh._edgesRenderer),this._sourceMesh._edgesRenderer.customInstances.push(this.getWorldMatrix())):this._edgesRenderer&&this._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup&&this._sourceMesh._renderingGroup._edgesRenderers.push(this._edgesRenderer)}getWorldMatrix(){if(this._currentLOD&&this._currentLOD!==this._sourceMesh&&this._currentLOD.billboardMode!==_.TransformNode.BILLBOARDMODE_NONE&&this._currentLOD._masterMesh!==this){this._billboardWorldMatrix||(this._billboardWorldMatrix=new r.Matrix);let e=this._currentLOD._masterMesh;return this._currentLOD._masterMesh=this,r.TmpVectors.Vector3[7].copyFrom(this._currentLOD.position),this._currentLOD.position.set(0,0,0),this._billboardWorldMatrix.copyFrom(this._currentLOD.computeWorldMatrix(!0)),this._currentLOD.position.copyFrom(r.TmpVectors.Vector3[7]),this._currentLOD._masterMesh=e,this._billboardWorldMatrix}return super.getWorldMatrix()}get isAnInstance(){return!0}getLOD(e){if(!e)return this;let t=this.sourceMesh.getLODLevels();if(t&&0!==t.length){let t=this.getBoundingInfo();this._currentLOD=this.sourceMesh.getLOD(e,t.boundingSphere)}else this._currentLOD=this.sourceMesh;return this._currentLOD}_preActivateForIntermediateRendering(e){return this.sourceMesh._preActivateForIntermediateRendering(e)}_syncSubMeshes(){if(this.releaseSubMeshes(),this._sourceMesh.subMeshes)for(let e=0;e<this._sourceMesh.subMeshes.length;e++)this._sourceMesh.subMeshes[e].clone(this,this._sourceMesh);return this}_generatePointsArray(){return this._sourceMesh._generatePointsArray()}_updateBoundingInfo(){return this.hasBoundingInfo?this.getBoundingInfo().update(this.worldMatrixFromCache):this.buildBoundingInfo(this.absolutePosition,this.absolutePosition,this.worldMatrixFromCache),this._updateSubMeshesBoundingInfo(this.worldMatrixFromCache),this}clone(e,t=null,s,r){let i=(r||this._sourceMesh).createInstance(e);if(g.DeepCopier.DeepCopy(this,i,["name","subMeshes","uniqueId","parent","lightSources","receiveShadows","material","visibility","skeleton","sourceMesh","isAnInstance","facetNb","isFacetDataEnabled","isBlocked","useBones","hasInstances","collider","edgesRenderer","forward","up","right","absolutePosition","absoluteScaling","absoluteRotationQuaternion","isWorldMatrixFrozen","nonUniformScaling","behaviors","worldMatrixFromCache","hasThinInstances","hasBoundingInfo","geometry"],[]),t&&(i.parent=t),!s)for(let e=0;e<this.getScene().meshes.length;e++){let t=this.getScene().meshes[e];t.parent===this&&t.clone(t.name,i)}return i.computeWorldMatrix(!0),this.onClonedObservable.notifyObservers(i),i}dispose(e,t=!1){this._sourceMesh.removeInstance(this),super.dispose(e,t)}_serializeAsParent(e){super._serializeAsParent(e),e.parentId=this._sourceMesh.uniqueId,e.parentInstanceIndex=this._indexInSourceMeshInstanceArray}instantiateHierarchy(e=null,t,s){let r=this.clone("Clone of "+(this.name||this.id),e||this.parent,!0,t&&t.newSourcedMesh);for(let e of(r&&s&&s(this,r),this.getChildTransformNodes(!0)))e.instantiateHierarchy(r,t,s);return r}}var M=e.i(23507),y=e.i(80871),V=e.i(66749);e.i(58720);var O=e.i(31278);e.i(65295);var A=e.i(22369),v=e.i(81623),T=e.i(92040),b=e.i(97001),I=e.i(12033);let D={effect:null,subMesh:null};class w extends A.PushMaterial{constructor(e,t,s,i={},o=!0){super(e,t,o),this._textures={},this._internalTextures={},this._textureArrays={},this._externalTextures={},this._floats={},this._ints={},this._uints={},this._floatsArrays={},this._colors3={},this._colors3Arrays={},this._colors4={},this._colors4Arrays={},this._vectors2={},this._vectors3={},this._vectors4={},this._quaternions={},this._quaternionsArrays={},this._matrices={},this._matrixArrays={},this._matrices3x3={},this._matrices2x2={},this._vectors2Arrays={},this._vectors3Arrays={},this._vectors4Arrays={},this._uniformBuffers={},this._textureSamplers={},this._storageBuffers={},this._cachedWorldViewMatrix=new r.Matrix,this._cachedWorldViewProjectionMatrix=new r.Matrix,this._multiview=!1,this._vertexPullingMetadata=null,this._materialHelperNeedsPreviousMatrices=!1,this._shaderPath=s,this._options={needAlphaBlending:!1,needAlphaTesting:!1,attributes:["position","normal","uv"],uniforms:["worldViewProjection"],uniformBuffers:[],samplers:[],externalTextures:[],samplerObjects:[],storageBuffers:[],defines:[],useClipPlane:!1,...i}}get shaderPath(){return this._shaderPath}set shaderPath(e){this._shaderPath=e}get options(){return this._options}get isMultiview(){return this._multiview}getClassName(){return"ShaderMaterial"}needAlphaBlending(){return this.alpha<1||this._options.needAlphaBlending}needAlphaTesting(){return this._options.needAlphaTesting}_checkUniform(e){-1===this._options.uniforms.indexOf(e)&&this._options.uniforms.push(e)}setTexture(e,t){return -1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._textures[e]=t,this}setInternalTexture(e,t){return -1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._internalTextures[e]=t,this}removeTexture(e){delete this._textures[e]}setTextureArray(e,t){return -1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._checkUniform(e),this._textureArrays[e]=t,this}setExternalTexture(e,t){return -1===this._options.externalTextures.indexOf(e)&&this._options.externalTextures.push(e),this._externalTextures[e]=t,this}setFloat(e,t){return this._checkUniform(e),this._floats[e]=t,this}setInt(e,t){return this._checkUniform(e),this._ints[e]=t,this}setUInt(e,t){return this._checkUniform(e),this._uints[e]=t,this}setFloats(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this}setColor3(e,t){return this._checkUniform(e),this._colors3[e]=t,this}setColor3Array(e,t){return this._checkUniform(e),this._colors3Arrays[e]=t.reduce((e,t)=>(e.push(t.r,t.g,t.b),e),[]),this}setColor4(e,t){return this._checkUniform(e),this._colors4[e]=t,this}setColor4Array(e,t){return this._checkUniform(e),this._colors4Arrays[e]=t.reduce((e,t)=>(e.push(t.r,t.g,t.b,t.a),e),[]),this}setVector2(e,t){return this._checkUniform(e),this._vectors2[e]=t,this}setVector3(e,t){return this._checkUniform(e),this._vectors3[e]=t,this}setVector4(e,t){return this._checkUniform(e),this._vectors4[e]=t,this}setQuaternion(e,t){return this._checkUniform(e),this._quaternions[e]=t,this}setQuaternionArray(e,t){return this._checkUniform(e),this._quaternionsArrays[e]=t.reduce((e,t)=>(t.toArray(e,e.length),e),[]),this}setMatrix(e,t){return this._checkUniform(e),this._matrices[e]=t,this}setMatrices(e,t){this._checkUniform(e);let s=new Float32Array(16*t.length);for(let e=0;e<t.length;e++)t[e].copyToArray(s,16*e);return this._matrixArrays[e]=s,this}setMatrix3x3(e,t){return this._checkUniform(e),this._matrices3x3[e]=t,this}setMatrix2x2(e,t){return this._checkUniform(e),this._matrices2x2[e]=t,this}setArray2(e,t){return this._checkUniform(e),this._vectors2Arrays[e]=t,this}setArray3(e,t){return this._checkUniform(e),this._vectors3Arrays[e]=t,this}setArray4(e,t){return this._checkUniform(e),this._vectors4Arrays[e]=t,this}setUniformBuffer(e,t){return -1===this._options.uniformBuffers.indexOf(e)&&this._options.uniformBuffers.push(e),this._uniformBuffers[e]=t,this}setTextureSampler(e,t){return -1===this._options.samplerObjects.indexOf(e)&&this._options.samplerObjects.push(e),this._textureSamplers[e]=t,this}setStorageBuffer(e,t){return -1===this._options.storageBuffers.indexOf(e)&&this._options.storageBuffers.push(e),this._storageBuffers[e]=t,this}setDefine(e,t){let s=e.trimEnd()+" ",r=this.options.defines.findIndex(t=>t===e||t.startsWith(s));return r>=0&&this.options.defines.splice(r,1),("boolean"!=typeof t||t)&&this.options.defines.push(s+t),this}isReadyForSubMesh(e,t,s){return this.isReady(e,s,t)}isReady(e,t,s){let r=s&&this._storeEffectOnSubMeshes;if(this.isFrozen){let e=r?s._drawWrapper:this._drawWrapper;if(e.effect&&e._wasPreviouslyReady&&e._wasPreviouslyUsingInstances===t)return!0}let i=this.getScene(),a=i.getEngine(),n=[],h=[],l=null,u=this._shaderPath,c=this._options.uniforms,d=this._options.uniformBuffers,f=this._options.samplers;a.getCaps().multiview&&i.activeCamera&&i.activeCamera.outputRenderTarget&&i.activeCamera.outputRenderTarget.getViewCount()>1&&(this._multiview=!0,n.push("#define MULTIVIEW"),-1!==c.indexOf("viewProjection")&&-1===c.indexOf("viewProjectionR")&&c.push("viewProjectionR"));for(let e=0;e<this._options.defines.length;e++){let t=0===this._options.defines[e].indexOf("#define")?this._options.defines[e]:`#define ${this._options.defines[e]}`;n.push(t)}for(let e=0;e<this._options.attributes.length;e++)h.push(this._options.attributes[e]);if(e&&e.isVerticesDataPresent(o.VertexBuffer.ColorKind)&&(-1===h.indexOf(o.VertexBuffer.ColorKind)&&h.push(o.VertexBuffer.ColorKind),n.push("#define VERTEXCOLOR")),t&&(n.push("#define INSTANCES"),(0,b.PushAttributesForInstances)(h,this._materialHelperNeedsPreviousMatrices),e?.hasThinInstances&&(n.push("#define THIN_INSTANCES"),e&&e.isVerticesDataPresent(o.VertexBuffer.ColorInstanceKind)&&(h.push(o.VertexBuffer.ColorInstanceKind),n.push("#define INSTANCESCOLOR")))),e&&e.useBones&&e.computeBonesUsingShaders&&e.skeleton){h.push(o.VertexBuffer.MatricesIndicesKind),h.push(o.VertexBuffer.MatricesWeightsKind),e.numBoneInfluencers>4&&(h.push(o.VertexBuffer.MatricesIndicesExtraKind),h.push(o.VertexBuffer.MatricesWeightsExtraKind));let t=e.skeleton;n.push("#define NUM_BONE_INFLUENCERS "+e.numBoneInfluencers),(l=new O.EffectFallbacks).addCPUSkinningFallback(0,e),t.isUsingTextureForMatrices?(n.push("#define BONETEXTURE"),-1===c.indexOf("boneTextureInfo")&&c.push("boneTextureInfo"),-1===this._options.samplers.indexOf("boneSampler")&&this._options.samplers.push("boneSampler")):(n.push("#define BonesPerMesh "+(t.bones.length+1)),-1===c.indexOf("mBones")&&c.push("mBones"))}else n.push("#define NUM_BONE_INFLUENCERS 0");let p=0,x=e?e.morphTargetManager:null;if(x){let t=-1!==n.indexOf("#define UV1"),s=-1!==n.indexOf("#define UV2"),r=-1!==n.indexOf("#define TANGENT"),i=-1!==n.indexOf("#define NORMAL"),o=-1!==n.indexOf("#define VERTEXCOLOR");p=(0,b.PrepareDefinesAndAttributesForMorphTargets)(x,n,h,e,!0,i,r,t,s,o),x.isUsingTextureForTargets&&(-1===c.indexOf("morphTargetTextureIndices")&&c.push("morphTargetTextureIndices"),-1===this._options.samplers.indexOf("morphTargets")&&this._options.samplers.push("morphTargets")),p>0&&((c=c.slice()).push("morphTargetInfluences"),c.push("morphTargetCount"),c.push("morphTargetTextureInfo"),c.push("morphTargetTextureIndices"))}else n.push("#define NUM_MORPH_INFLUENCERS 0");if(e){let s=e.bakedVertexAnimationManager;s&&s.isEnabled&&(n.push("#define BAKED_VERTEX_ANIMATION_TEXTURE"),-1===c.indexOf("bakedVertexAnimationSettings")&&c.push("bakedVertexAnimationSettings"),-1===c.indexOf("bakedVertexAnimationTextureSizeInverted")&&c.push("bakedVertexAnimationTextureSizeInverted"),-1===c.indexOf("bakedVertexAnimationTime")&&c.push("bakedVertexAnimationTime"),-1===this._options.samplers.indexOf("bakedVertexAnimationTexture")&&this._options.samplers.push("bakedVertexAnimationTexture"),t&&h.push("bakedVertexAnimationSettingsInstanced"))}for(let e in this._textures)if(!this._textures[e].isReady())return!1;for(let e in this._internalTextures)if(!this._internalTextures[e].isReady)return!1;e&&this.needAlphaTestingForMesh(e)&&n.push("#define ALPHATEST"),!1!==this._options.useClipPlane&&((0,T.AddClipPlaneUniforms)(c),(0,T.PrepareStringDefinesForClipPlanes)(this,i,n)),i.fogEnabled&&e?.applyFog&&i.fogMode!==V.Scene.FOGMODE_NONE&&(n.push("#define FOG"),-1===c.indexOf("view")&&c.push("view"),-1===c.indexOf("vFogInfos")&&c.push("vFogInfos"),-1===c.indexOf("vFogColor")&&c.push("vFogColor")),this._useLogarithmicDepth&&(n.push("#define LOGARITHMICDEPTH"),-1===c.indexOf("logarithmicDepthConstant")&&c.push("logarithmicDepthConstant"));let g=s?s.getRenderingMesh():e;if(g&&this.useVertexPulling){let e=g.geometry;e&&(this._vertexPullingMetadata=(0,I.PrepareVertexPullingUniforms)(e),this._vertexPullingMetadata&&this._vertexPullingMetadata.forEach((e,t)=>{c.push(`vp_${t}_info`)})),n.push("#define USE_VERTEX_PULLING");let t=g.geometry?.getIndexBuffer();t&&!g.isUnIndexed&&(n.push("#define VERTEX_PULLING_USE_INDEX_BUFFER"),t.is32Bits&&n.push("#define VERTEX_PULLING_INDEX_BUFFER_32BITS"))}this.customShaderNameResolve&&(c=c.slice(),d=d.slice(),f=f.slice(),u=this.customShaderNameResolve(this.name,c,d,f,n,h));let _=r?s._getDrawWrapper(void 0,!0):this._drawWrapper,m=_?.effect??null,M=_?.defines??null,y=n.join("\n"),A=m;return M!==y&&(A=a.createEffect(u,{attributes:h,uniformsNames:c,uniformBuffersNames:d,samplers:f,defines:y,fallbacks:l,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousMorphTargets:p},shaderLanguage:this._options.shaderLanguage,extraInitializationsAsync:this._options.extraInitializationsAsync},a),r?s.setEffect(A,y,this._materialContext):_&&_.setEffect(A,y),this._onEffectCreatedObservable&&(D.effect=A,D.subMesh=s??e?.subMeshes[0]??null,this._onEffectCreatedObservable.notifyObservers(D))),_._wasPreviouslyUsingInstances=!!t,!!A?.isReady()&&(m!==A&&i.resetCachedMaterial(),_._wasPreviouslyReady=!0,!0)}bindOnlyWorldMatrix(e,t){let s=t??this.getEffect();if(!s)return;let r=this._options.uniforms;-1!==r.indexOf("world")&&s.setMatrix("world",e);let i=this.getScene();-1!==r.indexOf("worldView")&&(e.multiplyToRef(i.getViewMatrix(),this._cachedWorldViewMatrix),s.setMatrix("worldView",this._cachedWorldViewMatrix)),-1!==r.indexOf("worldViewProjection")&&(e.multiplyToRef(i.getTransformMatrix(),this._cachedWorldViewProjectionMatrix),s.setMatrix("worldViewProjection",this._cachedWorldViewProjectionMatrix)),-1!==r.indexOf("view")&&s.setMatrix("view",i.getViewMatrix())}bindForSubMesh(e,t,s){this.bind(e,t,s._drawWrapperOverride?.effect,s)}bind(e,t,s,r){let i=r&&this._storeEffectOnSubMeshes,o=s??(i?r.effect:this.getEffect());if(!o)return;let a=this.getScene();this._activeEffect=o,this.bindOnlyWorldMatrix(e,s);let n=this._options.uniformBuffers,h=!1;if(o&&n&&n.length>0&&a.getEngine().supportsUniformBuffers)for(let s=0;s<n.length;++s)switch(n[s]){case"Mesh":t&&(t.getMeshUniformBuffer().bindToEffect(o,"Mesh"),t.transferToEffect(e));break;case"Scene":(0,b.BindSceneUniformBuffer)(o,a.getSceneUniformBuffer()),a.finalizeSceneUbo(),h=!0}let l=t&&i?this._mustRebind(a,o,r,t.visibility):a.getCachedMaterial()!==this;if(o&&l){let e;for(e in h||-1===this._options.uniforms.indexOf("view")||o.setMatrix("view",a.getViewMatrix()),h||-1===this._options.uniforms.indexOf("projection")||o.setMatrix("projection",a.getProjectionMatrix()),!h&&-1!==this._options.uniforms.indexOf("viewProjection")&&(o.setMatrix("viewProjection",a.getTransformMatrix()),this._multiview&&o.setMatrix("viewProjectionR",a._transformMatrixR)),a.activeCamera&&-1!==this._options.uniforms.indexOf("cameraPosition")&&o.setVector3("cameraPosition",a.activeCamera.globalPosition),(0,b.BindBonesParameters)(t,o),(0,T.BindClipPlane)(o,this,a),this._vertexPullingMetadata&&(0,I.BindVertexPullingUniforms)(o,this._vertexPullingMetadata),this._useLogarithmicDepth&&(0,b.BindLogDepth)(i?r.materialDefines:o.defines,o,a),t&&(0,b.BindFogParameters)(a,t,o),this._textures)o.setTexture(e,this._textures[e]);for(e in this._internalTextures)o._bindTexture(e,this._internalTextures[e]);for(e in this._textureArrays)o.setTextureArray(e,this._textureArrays[e]);for(e in this._ints)o.setInt(e,this._ints[e]);for(e in this._uints)o.setUInt(e,this._uints[e]);for(e in this._floats)o.setFloat(e,this._floats[e]);for(e in this._floatsArrays)o.setArray(e,this._floatsArrays[e]);for(e in this._colors3)o.setColor3(e,this._colors3[e]);for(e in this._colors3Arrays)o.setArray3(e,this._colors3Arrays[e]);for(e in this._colors4){let t=this._colors4[e];o.setFloat4(e,t.r,t.g,t.b,t.a)}for(e in this._colors4Arrays)o.setArray4(e,this._colors4Arrays[e]);for(e in this._vectors2)o.setVector2(e,this._vectors2[e]);for(e in this._vectors3)o.setVector3(e,this._vectors3[e]);for(e in this._vectors4)o.setVector4(e,this._vectors4[e]);for(e in this._quaternions)o.setQuaternion(e,this._quaternions[e]);for(e in this._matrices)o.setMatrix(e,this._matrices[e]);for(e in this._matrixArrays)o.setMatrices(e,this._matrixArrays[e]);for(e in this._matrices3x3)o.setMatrix3x3(e,this._matrices3x3[e]);for(e in this._matrices2x2)o.setMatrix2x2(e,this._matrices2x2[e]);for(e in this._vectors2Arrays)o.setArray2(e,this._vectors2Arrays[e]);for(e in this._vectors3Arrays)o.setArray3(e,this._vectors3Arrays[e]);for(e in this._vectors4Arrays)o.setArray4(e,this._vectors4Arrays[e]);for(e in this._quaternionsArrays)o.setArray4(e,this._quaternionsArrays[e]);for(e in this._uniformBuffers){let t=this._uniformBuffers[e].getBuffer();t&&o.bindUniformBuffer(t,e)}let s=a.getEngine(),n=s.setExternalTexture;if(n)for(e in this._externalTextures)n.call(s,e,this._externalTextures[e]);let l=s.setTextureSampler;if(l)for(e in this._textureSamplers)l.call(s,e,this._textureSamplers[e]);let u=s.setStorageBuffer;if(u)for(e in this._storageBuffers)u.call(s,e,this._storageBuffers[e])}if(o&&t&&(l||!this.isFrozen)){(0,b.BindMorphTargetParameters)(t,o),t.morphTargetManager&&t.morphTargetManager.isUsingTextureForTargets&&t.morphTargetManager._bind(o);let e=t.bakedVertexAnimationManager;if(e&&e.isEnabled){let e=i?r._drawWrapper:this._drawWrapper;t.bakedVertexAnimationManager?.bind(o,!!e._wasPreviouslyUsingInstances)}}this._afterBind(t,o,r)}getActiveTextures(){let e=super.getActiveTextures();for(let t in this._textures)e.push(this._textures[t]);for(let t in this._textureArrays){let s=this._textureArrays[t];for(let t=0;t<s.length;t++)e.push(s[t])}return e}hasTexture(e){if(super.hasTexture(e))return!0;for(let t in this._textures)if(this._textures[t]===e)return!0;let t=e.getInternalTexture();for(let e in this._internalTextures)if(this._internalTextures[e]===t)return!0;for(let t in this._textureArrays){let s=this._textureArrays[t];for(let t=0;t<s.length;t++)if(s[t]===e)return!0}return!1}clone(e){let t=y.SerializationHelper.Clone(()=>new w(e,this.getScene(),this._shaderPath,this._options,this._storeEffectOnSubMeshes),this);for(let s of(t.name=e,t.id=e,"object"==typeof t._shaderPath&&(t._shaderPath={...t._shaderPath}),this._options={...this._options},Object.keys(this._options))){let e=this._options[s];Array.isArray(e)&&(this._options[s]=e.slice(0))}for(let e in this.stencil.copyTo(t.stencil),this._textures)t.setTexture(e,this._textures[e]);for(let e in this._internalTextures)t.setInternalTexture(e,this._internalTextures[e]);for(let e in this._textureArrays)t.setTextureArray(e,this._textureArrays[e]);for(let e in this._externalTextures)t.setExternalTexture(e,this._externalTextures[e]);for(let e in this._ints)t.setInt(e,this._ints[e]);for(let e in this._uints)t.setUInt(e,this._uints[e]);for(let e in this._floats)t.setFloat(e,this._floats[e]);for(let e in this._floatsArrays)t.setFloats(e,this._floatsArrays[e]);for(let e in this._colors3)t.setColor3(e,this._colors3[e]);for(let e in this._colors3Arrays)t._colors3Arrays[e]=this._colors3Arrays[e];for(let e in this._colors4)t.setColor4(e,this._colors4[e]);for(let e in this._colors4Arrays)t._colors4Arrays[e]=this._colors4Arrays[e];for(let e in this._vectors2)t.setVector2(e,this._vectors2[e]);for(let e in this._vectors3)t.setVector3(e,this._vectors3[e]);for(let e in this._vectors4)t.setVector4(e,this._vectors4[e]);for(let e in this._quaternions)t.setQuaternion(e,this._quaternions[e]);for(let e in this._quaternionsArrays)t._quaternionsArrays[e]=this._quaternionsArrays[e];for(let e in this._matrices)t.setMatrix(e,this._matrices[e]);for(let e in this._matrixArrays)t._matrixArrays[e]=this._matrixArrays[e].slice();for(let e in this._matrices3x3)t.setMatrix3x3(e,this._matrices3x3[e]);for(let e in this._matrices2x2)t.setMatrix2x2(e,this._matrices2x2[e]);for(let e in this._vectors2Arrays)t.setArray2(e,this._vectors2Arrays[e]);for(let e in this._vectors3Arrays)t.setArray3(e,this._vectors3Arrays[e]);for(let e in this._vectors4Arrays)t.setArray4(e,this._vectors4Arrays[e]);for(let e in this._uniformBuffers)t.setUniformBuffer(e,this._uniformBuffers[e]);for(let e in this._textureSamplers)t.setTextureSampler(e,this._textureSamplers[e]);for(let e in this._storageBuffers)t.setStorageBuffer(e,this._storageBuffers[e]);return t}dispose(e,t,s){if(t){let e;for(e in this._textures)this._textures[e].dispose();for(e in this._internalTextures)this._internalTextures[e].dispose();for(e in this._textureArrays){let t=this._textureArrays[e];for(let e=0;e<t.length;e++)t[e].dispose()}}this._textures={},this._internalTextures={},super.dispose(e,t,s)}serialize(){let e,t=y.SerializationHelper.Serialize(this);for(e in t.customType="BABYLON.ShaderMaterial",t.uniqueId=this.uniqueId,t.options=this._options,t.shaderPath=this._shaderPath,t.storeEffectOnSubMeshes=this._storeEffectOnSubMeshes,t.stencil=this.stencil.serialize(),t.textures={},this._textures)t.textures[e]=this._textures[e].serialize();for(e in t.textureArrays={},this._textureArrays){t.textureArrays[e]=[];let s=this._textureArrays[e];for(let r=0;r<s.length;r++)t.textureArrays[e].push(s[r].serialize())}for(e in t.ints={},this._ints)t.ints[e]=this._ints[e];for(e in t.uints={},this._uints)t.uints[e]=this._uints[e];for(e in t.floats={},this._floats)t.floats[e]=this._floats[e];for(e in t.floatsArrays={},this._floatsArrays)t.floatsArrays[e]=this._floatsArrays[e];for(e in t.colors3={},this._colors3){let s=this._colors3[e];t.colors3[e]=[s.r,s.g,s.b]}for(e in t.colors3Arrays={},this._colors3Arrays)t.colors3Arrays[e]=this._colors3Arrays[e];for(e in t.colors4={},this._colors4){let s=this._colors4[e];t.colors4[e]=[s.r,s.g,s.b,s.a]}for(e in t.colors4Arrays={},this._colors4Arrays)t.colors4Arrays[e]=this._colors4Arrays[e];for(e in t.vectors2={},this._vectors2){let s=this._vectors2[e];t.vectors2[e]=[s.x,s.y]}for(e in t.vectors3={},this._vectors3){let s=this._vectors3[e];t.vectors3[e]=[s.x,s.y,s.z]}for(e in t.vectors4={},this._vectors4){let s=this._vectors4[e];t.vectors4[e]=[s.x,s.y,s.z,s.w]}for(e in t.quaternions={},this._quaternions)t.quaternions[e]=this._quaternions[e].asArray();for(e in t.matrices={},this._matrices)t.matrices[e]=this._matrices[e].asArray();for(e in t.matrixArray={},this._matrixArrays)t.matrixArray[e]=this._matrixArrays[e];for(e in t.matrices3x3={},this._matrices3x3)t.matrices3x3[e]=this._matrices3x3[e];for(e in t.matrices2x2={},this._matrices2x2)t.matrices2x2[e]=this._matrices2x2[e];for(e in t.vectors2Arrays={},this._vectors2Arrays)t.vectors2Arrays[e]=this._vectors2Arrays[e];for(e in t.vectors3Arrays={},this._vectors3Arrays)t.vectors3Arrays[e]=this._vectors3Arrays[e];for(e in t.vectors4Arrays={},this._vectors4Arrays)t.vectors4Arrays[e]=this._vectors4Arrays[e];for(e in t.quaternionsArrays={},this._quaternionsArrays)t.quaternionsArrays[e]=this._quaternionsArrays[e];return t}}w.SnippetUrl="https://snippet.babylonjs.com";var P=e.i(75405);class F extends f.Mesh{_isShaderMaterial(e){return!!e&&"ShaderMaterial"===e.getClassName()}constructor(t,s=null,r=null,i=null,a,n,h,u){super(t,s,r,i,a),this.useVertexColor=n,this.useVertexAlpha=h,this.color=new l.Color3(1,1,1),this.alpha=1,this._shaderLanguage=0,this._ownsMaterial=!1,i&&(this.color=i.color.clone(),this.alpha=i.alpha,this.useVertexColor=i.useVertexColor,this.useVertexAlpha=i.useVertexAlpha),this.intersectionThreshold=.1;const c={attributes:[o.VertexBuffer.PositionKind],uniforms:["world","viewProjection"],needAlphaBlending:!0,defines:[],useClipPlane:null,shaderLanguage:0};if(this.useVertexAlpha?c.defines.push("#define VERTEXALPHA"):c.needAlphaBlending=!1,this.useVertexColor?(c.defines.push("#define VERTEXCOLOR"),c.attributes.push(o.VertexBuffer.ColorKind)):(c.uniforms.push("color"),this._color4=new l.Color4),u)this.material=u;else{this.getScene().getEngine().isWebGPU&&!F.ForceGLSL&&(this._shaderLanguage=1),c.shaderLanguage=this._shaderLanguage,c.extraInitializationsAsync=async()=>{1===this._shaderLanguage?await Promise.all([e.A(20169),e.A(57284)]):await Promise.all([e.A(76121),e.A(83228)])};const t=new w("colorShader",this.getScene(),"color",c,!1);t.doNotSerialize=!0,this._ownsMaterial=!0,this._setInternalMaterial(t)}}getClassName(){return"LinesMesh"}get material(){return this._internalAbstractMeshDataInfo._material}set material(e){let t=this.material;if(t===e)return;let s=t&&this._ownsMaterial;this._ownsMaterial=!1,this._setInternalMaterial(e),s&&t?.dispose()}_setInternalMaterial(e){this._setMaterial(e),this.material&&(this.material.fillMode=M.Material.LineListDrawMode,this.material.disableLighting=!0)}get checkCollisions(){return!1}set checkCollisions(e){}_bind(e,t){if(!this._geometry)return this;let s=this.isUnIndexed?null:this._geometry.getIndexBuffer();if(!this._userInstancedBuffersStorage||this.hasThinInstances?this._geometry._bind(t,s):this._geometry._bind(t,s,this._userInstancedBuffersStorage.vertexBuffers,this._userInstancedBuffersStorage.vertexArrayObjects),!this.useVertexColor&&this._isShaderMaterial(this.material)){let{r:e,g:t,b:s}=this.color;this._color4.set(e,t,s,this.alpha),this.material.setColor4("color",this._color4)}return this}_draw(e,t,s){if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;let r=this.getScene().getEngine();return this._unIndexed?r.drawArraysType(M.Material.LineListDrawMode,e.verticesStart,e.verticesCount,s):r.drawElementsType(M.Material.LineListDrawMode,e.indexStart,e.indexCount,s),this}dispose(e,t=!1,s){!s&&(this._ownsMaterial?this.material?.dispose(!1,!1,!0):t&&this.material?.dispose(!1,!1,!0)),super.dispose(e)}clone(e,t=null,s){return t&&void 0===t._addToSceneRootNodes?(t.source=this,new F(e,this.getScene(),t.parent,t.source,t.doNotCloneChildren)):new F(e,this.getScene(),t,this,s)}createInstance(e){let t=new B(e,this);if(this.instancedBuffers)for(let e in t.instancedBuffers={},this.instancedBuffers)t.instancedBuffers[e]=this.instancedBuffers[e];return t}serialize(e){super.serialize(e),e.color=this.color.asArray(),e.alpha=this.alpha}static Parse(e,t){let s=new F(e.name,t);return s.color=l.Color3.FromArray(e.color),s.alpha=e.alpha,s}}F.ForceGLSL=!1;class B extends m{constructor(e,t){super(e,t),this.intersectionThreshold=t.intersectionThreshold}getClassName(){return"InstancedLinesMesh"}}function L(e,t,s=null){let r=t.instance,i=t.lines,n=t.colors;if(r){let e,t,s=r.getVerticesData(o.VertexBuffer.PositionKind);n&&(e=r.getVerticesData(o.VertexBuffer.ColorKind));let a=0,h=0;for(let r=0;r<i.length;r++){let o=i[r];for(let i=0;i<o.length;i++)s[a]=o[i].x,s[a+1]=o[i].y,s[a+2]=o[i].z,n&&e&&(t=n[r],e[h]=t[i].r,e[h+1]=t[i].g,e[h+2]=t[i].b,e[h+3]=t[i].a,h+=4),a+=3}return r.updateVerticesData(o.VertexBuffer.PositionKind,s,!1,!1),n&&e&&r.updateVerticesData(o.VertexBuffer.ColorKind,e,!1,!1),r.refreshBoundingInfo(),r}let h=new F(e,s,null,void 0,void 0,!!n,t.useVertexAlpha,t.material);return(function(e){let t=[],s=[],r=e.lines,i=e.colors,o=[],n=0;for(let e=0;e<r.length;e++){let a=r[e];for(let r=0;r<a.length;r++){let{x:h,y:l,z:u}=a[r];if(s.push(h,l,u),i){let{r:t,g:s,b:a,a:n}=i[e][r];o.push(t,s,a,n)}r>0&&(t.push(n-1),t.push(n)),n++}}let h=new a.VertexData;return h.indices=t,h.positions=s,i&&(h.colors=o),h})(t).applyToMesh(h,t.updatable),h}(t=F.prototype).enableEdgesRendering??(t.enableEdgesRendering=(0,P._MissingSideEffect)("LinesMesh","enableEdgesRendering")),(s=B.prototype).enableEdgesRendering??(s.enableEdgesRendering=(0,P._MissingSideEffect)("InstancedLinesMesh","enableEdgesRendering"));var E=r,C=e.i(75991),S=e.i(89030);class z extends E.Vector2{constructor(e,t){super(e.x,e.y),this.index=t}}class R{constructor(){this.elements=[]}add(e){let t=[];for(let s of e){let e=new z(s,this.elements.length);t.push(e),this.elements.push(e)}return t}computeBounds(){let e=new E.Vector2(this.elements[0].x,this.elements[0].y),t=new E.Vector2(this.elements[0].x,this.elements[0].y);for(let s of this.elements)s.x<e.x?e.x=s.x:s.x>t.x&&(t.x=s.x),s.y<e.y?e.y=s.y:s.y>t.y&&(t.y=s.y);return{min:e,max:t,width:t.x-e.x,height:t.y-e.y}}}class U{_addToepoint(e){for(let t of e)this._epoints.push(t.x,t.y)}constructor(e,t,s,r=earcut){let i;this._points=new R,this._outlinepoints=new R,this._holes=[],this._epoints=[],this._eholes=[],this.bjsEarcut=r,this._name=e,this._scene=s||v.EngineStore.LastCreatedScene,i=t instanceof C.Path2?t.getPoints():t,this._addToepoint(i),this._points.add(i),this._outlinepoints.add(i),void 0===this.bjsEarcut&&p.Logger.Warn("Earcut was not found, the polygon will not be built.")}addHole(e){this._points.add(e);let t=new R;return t.add(e),this._holes.push(t),this._eholes.push(this._epoints.length/2),this._addToepoint(e),this}build(e=!1,t=0,s=2){let r=new i.Mesh(this._name,this._scene),a=this.buildVertexData(t,s);return r.setVerticesData(o.VertexBuffer.PositionKind,a.positions,e),r.setVerticesData(o.VertexBuffer.NormalKind,a.normals,e),r.setVerticesData(o.VertexBuffer.UVKind,a.uvs,e),r.setIndices(a.indices),r}buildVertexData(e=0,t=2){let s=new a.VertexData,r=[],i=[],o=[],n=this._points.computeBounds();for(let e of this._points.elements)r.push(0,1,0),i.push(e.x,0,e.y),o.push((e.x-n.min.x)/n.width,(e.y-n.min.y)/n.height);let h=[],l=this.bjsEarcut(this._epoints,this._eholes,2);for(let e=0;e<l.length;e++)h.push(l[e]);if(e>0){let s=i.length/3;for(let t of this._points.elements)r.push(0,-1,0),i.push(t.x,-e,t.y),o.push(1-(t.x-n.min.x)/n.width,1-(t.y-n.min.y)/n.height);let a=h.length;for(let e=0;e<a;e+=3){let t=h[e+0],r=h[e+1],i=h[e+2];h.push(i+s),h.push(r+s),h.push(t+s)}for(let s of(this._addSide(i,r,o,h,n,this._outlinepoints,e,!1,t),this._holes))this._addSide(i,r,o,h,n,s,e,!0,t)}return s.indices=h,s.positions=i,s.normals=r,s.uvs=o,s}_addSide(e,t,s,r,i,o,a,n,h){let l=e.length/3,u=0;for(let c=0;c<o.elements.length;c++){let d,f=o.elements[c],p=o.elements[(c+1)%o.elements.length];e.push(f.x,0,f.y),e.push(f.x,-a,f.y),e.push(p.x,0,p.y),e.push(p.x,-a,p.y);let x=o.elements[(c+o.elements.length-1)%o.elements.length],g=o.elements[(c+2)%o.elements.length],_=new E.Vector3(-(p.y-f.y),0,p.x-f.x),m=new E.Vector3(-(f.y-x.y),0,f.x-x.x),M=new E.Vector3(-(g.y-p.y),0,g.x-p.x);n||(_=_.scale(-1),m=m.scale(-1),M=M.scale(-1));let y=_.normalizeToNew(),V=m.normalizeToNew(),O=E.Vector3.Dot(V,y);V=O>h?O<S.Epsilon-1?new E.Vector3(f.x,0,f.y).subtract(new E.Vector3(p.x,0,p.y)).normalize():m.add(_).normalize():y;let A=E.Vector3.Dot(M,_);d=A>h?A<S.Epsilon-1?new E.Vector3(p.x,0,p.y).subtract(new E.Vector3(f.x,0,f.y)).normalize():M.add(_).normalize():y,s.push(u/i.width,0),s.push(u/i.width,1),u+=_.length(),s.push(u/i.width,0),s.push(u/i.width,1),t.push(V.x,V.y,V.z),t.push(V.x,V.y,V.z),t.push(d.x,d.y,d.z),t.push(d.x,d.y,d.z),n?(r.push(l),r.push(l+2),r.push(l+1),r.push(l+1),r.push(l+2),r.push(l+3)):(r.push(l),r.push(l+1),r.push(l+2),r.push(l+1),r.push(l+3),r.push(l+2)),l+=4}}}function N(e,t,s=null,h=earcut){let u;t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation);let c=t.shape,d=t.holes||[],f=t.depth||0,p=t.smoothingThreshold||2,x=[];for(let e=0;e<c.length;e++)x[e]=new r.Vector2(c[e].x,c[e].z);x[0].equalsWithEpsilon(x[x.length-1],1e-8)&&x.pop();let g=new U(e,x,s||v.EngineStore.LastCreatedScene,h);for(let e=0;e<d.length;e++){u=[];for(let t=0;t<d[e].length;t++)u.push(new r.Vector2(d[e][t].x,d[e][t].z));g.addHole(u)}let _=g.build(!1,f,p);return _._originalBuilderSideOrientation=t.sideOrientation,(function(e,t,s,i,h,u,c){let d,f,p,x,g=s||[,,,],_=[],m=c||!1;for(let e=0;e<3;e++)void 0===g[e]&&(g[e]=new r.Vector4(0,0,1,1)),i&&void 0===i[e]&&(i[e]=new l.Color4(1,1,1,1));let M=e.getVerticesData(o.VertexBuffer.PositionKind),y=e.getVerticesData(o.VertexBuffer.NormalKind),V=e.getVerticesData(o.VertexBuffer.UVKind),O=e.getIndices(),A=M.length/9,v=0,T=[0];if(m)for(let e=A;e<M.length/3;e+=4)T.push(v+=Math.sqrt((f=M[3*(e+2)]-M[3*e])*f+(p=M[3*(e+2)+2]-M[3*e+2])*p));let b=0;for(let e=0;e<y.length;e+=3).001>Math.abs(y[e+1])&&(b=1),.001>Math.abs(y[e+1]-1)&&(b=0),.001>Math.abs(y[e+1]+1)&&(b=2),x=e/3,1===b?((d=x-A)%4<1.5?m?V[2*x]=g[b].x+(g[b].z-g[b].x)*T[Math.floor(d/4)]/v:V[2*x]=g[b].x:m?V[2*x]=g[b].x+(g[b].z-g[b].x)*T[Math.floor(d/4)+1]/v:V[2*x]=g[b].z,d%2==0?V[2*x+1]=n.useOpenGLOrientationForUV?1-g[b].w:g[b].w:V[2*x+1]=n.useOpenGLOrientationForUV?1-g[b].y:g[b].y):(V[2*x]=(1-V[2*x])*g[b].x+V[2*x]*g[b].z,V[2*x+1]=(1-V[2*x+1])*g[b].y+V[2*x+1]*g[b].w,n.useOpenGLOrientationForUV&&(V[2*x+1]=1-V[2*x+1])),i&&_.push(i[b].r,i[b].g,i[b].b,i[b].a);a.VertexData._ComputeSides(t,M,O,y,V,h,u);let I=new a.VertexData;return I.indices=O,I.positions=M,I.normals=y,I.uvs=V,i&&(I.colors=t===a.VertexData.DOUBLESIDE?_.concat(_):_),I})(_,t.sideOrientation,t.faceUV,t.faceColors,t.frontUVs,t.backUVs,t.wrap).applyToMesh(_,t.updatable),_}function W(e,t,s=null,r=earcut){return N(e,t,s,r)}function G(e,t,s,o,a,n,l,u,c,d,f,p,x,g,_,m,M,y,V,O,A){let v,T=(e,t,s,o,a,n,h,l,u,c,d)=>{let f=s.getTangents(),p=s.getNormals(),x=s.getBinormals(),g=s.getDistances();if(d){for(let e=0;e<f.length;e++)if(0==f[e].x&&0==f[e].y&&0==f[e].z&&f[e].copyFrom(f[e-1]),0==p[e].x&&0==p[e].y&&0==p[e].z&&p[e].copyFrom(p[e-1]),0==x[e].x&&0==x[e].y&&0==x[e].z&&x[e].copyFrom(x[e-1]),e>0){let t=f[e-1];0>r.Vector3.Dot(t,f[e])&&f[e].scaleInPlace(-1),t=p[e-1],0>r.Vector3.Dot(t,p[e])&&p[e].scaleInPlace(-1),t=x[e-1],0>r.Vector3.Dot(t,x[e])&&x[e].scaleInPlace(-1)}}let _=0,m=c&&l?l:()=>null!==n?n:0,M=c&&h?h:()=>null!==a?a:r.Vector3.OneReadOnly,y=2*(u!==i.Mesh.NO_CAP&&u!==i.Mesh.CAP_END),V=r.TmpVectors.Matrix[0];for(let s=0;s<t.length;s++){let i=[],a=m(s,g[s]),n=M(s,g[s]);r.Matrix.RotationAxisToRef(f[s],_,V);for(let o=0;o<e.length;o++){let a=f[s].scale(e[o].z).add(p[s].scale(e[o].x)).add(x[s].scale(e[o].y)),h=r.Vector3.Zero();r.Vector3.TransformCoordinatesToRef(a,V,h),h.multiplyInPlace(n).addInPlace(t[s]),i[o]=h}o[y]=i,_+=a,y++}let O=A||(e=>{let t,s=[],i=r.Vector3.Zero();for(t=0;t<e.length;t++)i.addInPlace(e[t]);for(i.scaleInPlace(1/e.length),t=0;t<e.length;t++)s.push(i);return s});switch(u){case i.Mesh.NO_CAP:break;case i.Mesh.CAP_START:o[0]=O(o[2]),o[1]=o[2];break;case i.Mesh.CAP_END:o[y]=o[y-1],o[y+1]=O(o[y-1]);break;case i.Mesh.CAP_ALL:o[0]=O(o[2]),o[1]=o[2],o[y]=o[y-1],o[y+1]=O(o[y-1])}return o},b=null!==o?new r.Vector3(o,o,o):null;if(_){let e=_._creationDataStorage;return V?e.path3D.update(s,V):e.path3D.update(s),_=h("",{pathArray:v=T(t,s,e.path3D,e.pathArray,b,a,n,l,e.cap,f,O),closeArray:!1,closePath:!1,offset:0,updatable:!1,sideOrientation:0,instance:_},p||void 0)}let I=V?new C.Path3D(s,V):new C.Path3D(s),D=h(e,{pathArray:v=T(t,s,I,[],b,a,n,l,d=d<0||d>3?0:d,f,O),closeArray:u,closePath:c,updatable:x,sideOrientation:g,invertUV:m,frontUVs:M||void 0,backUVs:y||void 0},p);return D._creationDataStorage.pathArray=v,D._creationDataStorage.path3D=I,D._creationDataStorage.cap=d,D}var k=i;class H extends k.Mesh{constructor(e,t){super(e,t),this.generateOctree=!1}getClassName(){return"GroundMesh"}get subdivisions(){return Math.min(this._subdivisionsX,this._subdivisionsY)}get subdivisionsX(){return this._subdivisionsX}get subdivisionsY(){return this._subdivisionsY}optimize(e,t=32){this._subdivisionsX=e,this._subdivisionsY=e,this.subdivide(e),(0,P._IsSideEffectImplemented)(this.createOrUpdateSubmeshesOctree)&&this.createOrUpdateSubmeshesOctree(t)}getHeightAtCoordinates(e,t){let s=this.getWorldMatrix(),i=r.TmpVectors.Matrix[5];s.invertToRef(i);let o=r.TmpVectors.Vector3[8];if(r.Vector3.TransformCoordinatesFromFloatsToRef(e,0,t,i,o),e=o.x,t=o.z,e<this._minX||e>=this._maxX||t<=this._minZ||t>this._maxZ)return this.position.y;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());let a=this._getFacetAt(e,t),n=-(a.x*e+a.z*t+a.w)/a.y;return r.Vector3.TransformCoordinatesFromFloatsToRef(0,n,0,s,o),o.y}getNormalAtCoordinates(e,t){let s=new r.Vector3(0,1,0);return this.getNormalAtCoordinatesToRef(e,t,s),s}getNormalAtCoordinatesToRef(e,t,s){let i=this.getWorldMatrix(),o=r.TmpVectors.Matrix[5];i.invertToRef(o);let a=r.TmpVectors.Vector3[8];if(r.Vector3.TransformCoordinatesFromFloatsToRef(e,0,t,o,a),e=a.x,t=a.z,e<this._minX||e>this._maxX||t<this._minZ||t>this._maxZ)return this;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());let n=this._getFacetAt(e,t);return r.Vector3.TransformNormalFromFloatsToRef(n.x,n.y,n.z,i,s),this}updateCoordinateHeights(){return this._heightQuads&&0!=this._heightQuads.length||this._initHeightQuads(),this._computeHeightQuads(),this}_getFacetAt(e,t){let s=Math.floor((e+this._maxX)*this._subdivisionsX/this._width),r=Math.floor(-(t+this._maxZ)*this._subdivisionsY/this._height+this._subdivisionsY),i=this._heightQuads[r*this._subdivisionsX+s];return t<i.slope.x*e+i.slope.y?i.facet1:i.facet2}_initHeightQuads(){let e=this._subdivisionsX,t=this._subdivisionsY;this._heightQuads=[];for(let s=0;s<t;s++)for(let t=0;t<e;t++){let i={slope:r.Vector2.Zero(),facet1:new r.Vector4(0,0,0,0),facet2:new r.Vector4(0,0,0,0)};this._heightQuads[s*e+t]=i}return this}_computeHeightQuads(){let e,t,s,i,a,n,h,l=this.getVerticesData(o.VertexBuffer.PositionKind);if(!l)return this;let u=r.TmpVectors.Vector3[3],c=r.TmpVectors.Vector3[2],d=r.TmpVectors.Vector3[1],f=r.TmpVectors.Vector3[0],p=r.TmpVectors.Vector3[4],x=r.TmpVectors.Vector3[5],g=r.TmpVectors.Vector3[6],_=r.TmpVectors.Vector3[7],m=r.TmpVectors.Vector3[8],M=this._subdivisionsX,y=this._subdivisionsY;for(let o=0;o<y;o++)for(let y=0;y<M;y++){e=3*y,t=o*(M+1)*3,s=(o+1)*(M+1)*3,u.x=l[t+e],u.y=l[t+e+1],u.z=l[t+e+2],c.x=l[t+e+3],c.y=l[t+e+4],c.z=l[t+e+5],d.x=l[s+e],d.y=l[s+e+1],d.z=l[s+e+2],f.x=l[s+e+3],f.y=l[s+e+4],f.z=l[s+e+5],i=(f.z-u.z)/(f.x-u.x),a=u.z-i*u.x,c.subtractToRef(u,p),d.subtractToRef(u,x),f.subtractToRef(u,g),r.Vector3.CrossToRef(g,x,_),r.Vector3.CrossToRef(p,g,m),_.normalize(),m.normalize(),n=-(_.x*u.x+_.y*u.y+_.z*u.z),h=-(m.x*c.x+m.y*c.y+m.z*c.z);let V=this._heightQuads[o*M+y];V.slope.copyFromFloats(i,a),V.facet1.copyFromFloats(_.x,_.y,_.z,n),V.facet2.copyFromFloats(m.x,m.y,m.z,h)}return this}serialize(e){super.serialize(e),e.subdivisionsX=this._subdivisionsX,e.subdivisionsY=this._subdivisionsY,e.minX=this._minX,e.maxX=this._maxX,e.minZ=this._minZ,e.maxZ=this._maxZ,e.width=this._width,e.height=this._height}static Parse(e,t){let s=new H(e.name,t);return s._subdivisionsX=e.subdivisionsX||1,s._subdivisionsY=e.subdivisionsY||1,s._minX=e.minX,s._maxX=e.maxX,s._minZ=e.minZ,s._maxZ=e.maxZ,s._width=e.width,s._height=e.height,s}}var X=e.i(65740);function Z(e,t={},s=null){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t,s,i,o,h,u,c,d,f=[];f[0]={vertex:[[0,0,1.732051],[1.632993,0,-.5773503],[-.8164966,1.414214,-.5773503],[-.8164966,-1.414214,-.5773503]],face:[[0,1,2],[0,2,3],[0,3,1],[1,3,2]]},f[1]={vertex:[[0,0,1.414214],[1.414214,0,0],[0,1.414214,0],[-1.414214,0,0],[0,-1.414214,0],[0,0,-1.414214]],face:[[0,1,2],[0,2,3],[0,3,4],[0,4,1],[1,4,5],[1,5,2],[2,5,3],[3,5,4]]},f[2]={vertex:[[0,0,1.070466],[.7136442,0,.7978784],[-.3568221,.618034,.7978784],[-.3568221,-.618034,.7978784],[.7978784,.618034,.3568221],[.7978784,-.618034,.3568221],[-.9341724,.381966,.3568221],[.1362939,1,.3568221],[.1362939,-1,.3568221],[-.9341724,-.381966,.3568221],[.9341724,.381966,-.3568221],[.9341724,-.381966,-.3568221],[-.7978784,.618034,-.3568221],[-.1362939,1,-.3568221],[-.1362939,-1,-.3568221],[-.7978784,-.618034,-.3568221],[.3568221,.618034,-.7978784],[.3568221,-.618034,-.7978784],[-.7136442,0,-.7978784],[0,0,-1.070466]],face:[[0,1,4,7,2],[0,2,6,9,3],[0,3,8,5,1],[1,5,11,10,4],[2,7,13,12,6],[3,9,15,14,8],[4,10,16,13,7],[5,8,14,17,11],[6,12,18,15,9],[10,11,17,19,16],[12,13,16,19,18],[14,15,18,19,17]]},f[3]={vertex:[[0,0,1.175571],[1.051462,0,.5257311],[.3249197,1,.5257311],[-.8506508,.618034,.5257311],[-.8506508,-.618034,.5257311],[.3249197,-1,.5257311],[.8506508,.618034,-.5257311],[.8506508,-.618034,-.5257311],[-.3249197,1,-.5257311],[-1.051462,0,-.5257311],[-.3249197,-1,-.5257311],[0,0,-1.175571]],face:[[0,1,2],[0,2,3],[0,3,4],[0,4,5],[0,5,1],[1,5,7],[1,7,6],[1,6,2],[2,6,8],[2,8,3],[3,8,9],[3,9,4],[4,9,10],[4,10,5],[5,10,7],[6,7,11],[6,11,8],[7,10,11],[8,11,9],[9,11,10]]},f[4]={vertex:[[0,0,1.070722],[.7148135,0,.7971752],[-.104682,.7071068,.7971752],[-.6841528,.2071068,.7971752],[-.104682,-.7071068,.7971752],[.6101315,.7071068,.5236279],[1.04156,.2071068,.1367736],[.6101315,-.7071068,.5236279],[-.3574067,1,.1367736],[-.7888348,-.5,.5236279],[-.9368776,.5,.1367736],[-.3574067,-1,.1367736],[.3574067,1,-.1367736],[.9368776,-.5,-.1367736],[.7888348,.5,-.5236279],[.3574067,-1,-.1367736],[-.6101315,.7071068,-.5236279],[-1.04156,-.2071068,-.1367736],[-.6101315,-.7071068,-.5236279],[.104682,.7071068,-.7971752],[.6841528,-.2071068,-.7971752],[.104682,-.7071068,-.7971752],[-.7148135,0,-.7971752],[0,0,-1.070722]],face:[[0,2,3],[1,6,5],[4,9,11],[7,15,13],[8,16,10],[12,14,19],[17,22,18],[20,21,23],[0,1,5,2],[0,3,9,4],[0,4,7,1],[1,7,13,6],[2,5,12,8],[2,8,10,3],[3,10,17,9],[4,11,15,7],[5,6,14,12],[6,13,20,14],[8,12,19,16],[9,17,18,11],[10,16,22,17],[11,18,21,15],[13,15,21,20],[14,20,23,19],[16,19,23,22],[18,22,23,21]]},f[5]={vertex:[[0,0,1.322876],[1.309307,0,.1889822],[-.9819805,.8660254,.1889822],[.1636634,-1.299038,.1889822],[.3273268,.8660254,-.9449112],[-.8183171,-.4330127,-.9449112]],face:[[0,3,1],[2,4,5],[0,1,4,2],[0,2,5,3],[1,3,5,4]]},f[6]={vertex:[[0,0,1.159953],[1.013464,0,.5642542],[-.3501431,.9510565,.5642542],[-.7715208,-.6571639,.5642542],[.6633206,.9510565,-.03144481],[.8682979,-.6571639,-.3996071],[-1.121664,.2938926,-.03144481],[-.2348831,-1.063314,-.3996071],[.5181548,.2938926,-.9953061],[-.5850262,-.112257,-.9953061]],face:[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,9,7],[5,7,9,8],[0,3,7,5,1],[2,4,8,9,6]]},f[7]={vertex:[[0,0,1.118034],[.8944272,0,.6708204],[-.2236068,.8660254,.6708204],[-.7826238,-.4330127,.6708204],[.6708204,.8660254,.2236068],[1.006231,-.4330127,-.2236068],[-1.006231,.4330127,.2236068],[-.6708204,-.8660254,-.2236068],[.7826238,.4330127,-.6708204],[.2236068,-.8660254,-.6708204],[-.8944272,0,-.6708204],[0,0,-1.118034]],face:[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,10,7],[5,9,11,8],[7,10,11,9],[0,3,7,9,5,1],[2,4,8,11,10,6]]},f[8]={vertex:[[-.729665,.670121,.319155],[-.655235,-.29213,-.754096],[-.093922,-.607123,.537818],[.702196,.595691,.485187],[.776626,-.36656,-.588064]],face:[[1,4,2],[0,1,2],[3,0,2],[4,3,2],[4,1,0,3]]},f[9]={vertex:[[-.868849,-.100041,.61257],[-.329458,.976099,.28078],[-.26629,-.013796,-.477654],[-.13392,-1.034115,.229829],[.738834,.707117,-.307018],[.859683,-.535264,-.338508]],face:[[3,0,2],[5,3,2],[4,5,2],[1,4,2],[0,1,2],[0,3,5,4,1]]},f[10]={vertex:[[-.610389,.243975,.531213],[-.187812,-.48795,-.664016],[-.187812,.9759,-.664016],[.187812,-.9759,.664016],[.798201,.243975,.132803]],face:[[1,3,0],[3,4,0],[3,1,4],[0,2,1],[0,4,2],[2,4,1]]},f[11]={vertex:[[-1.028778,.392027,-.048786],[-.640503,-.646161,.621837],[-.125162,-.395663,-.540059],[.004683,.888447,-.651988],[.125161,.395663,.540059],[.632925,-.791376,.433102],[1.031672,.157063,-.354165]],face:[[3,2,0],[2,1,0],[2,5,1],[0,4,3],[0,1,4],[4,1,5],[2,3,6],[3,4,6],[5,2,6],[4,5,6]]},f[12]={vertex:[[-.669867,.334933,-.529576],[-.669867,.334933,.529577],[-.4043,1.212901,0],[-.334933,-.669867,-.529576],[-.334933,-.669867,.529577],[.334933,.669867,-.529576],[.334933,.669867,.529577],[.4043,-1.212901,0],[.669867,-.334933,-.529576],[.669867,-.334933,.529577]],face:[[8,9,7],[6,5,2],[3,8,7],[5,0,2],[4,3,7],[0,1,2],[9,4,7],[1,6,2],[9,8,5,6],[8,3,0,5],[3,4,1,0],[4,9,6,1]]},f[13]={vertex:[[-.931836,.219976,-.264632],[-.636706,.318353,.692816],[-.613483,-.735083,-.264632],[-.326545,.979634,0],[-.318353,-.636706,.692816],[-.159176,.477529,-.856368],[.159176,-.477529,-.856368],[.318353,.636706,.692816],[.326545,-.979634,0],[.613482,.735082,-.264632],[.636706,-.318353,.692816],[.931835,-.219977,-.264632]],face:[[11,10,8],[7,9,3],[6,11,8],[9,5,3],[2,6,8],[5,0,3],[4,2,8],[0,1,3],[10,4,8],[1,7,3],[10,11,9,7],[11,6,5,9],[6,2,0,5],[2,4,1,0],[4,10,7,1]]},f[14]={vertex:[[-.93465,.300459,-.271185],[-.838689,-.260219,-.516017],[-.711319,.717591,.128359],[-.710334,-.156922,.080946],[-.599799,.556003,-.725148],[-.503838,-.004675,-.969981],[-.487004,.26021,.48049],[-.460089,-.750282,-.512622],[-.376468,.973135,-.325605],[-.331735,-.646985,.084342],[-.254001,.831847,.530001],[-.125239,-.494738,-.966586],[.029622,.027949,.730817],[.056536,-.982543,-.262295],[.08085,1.087391,.076037],[.125583,-.532729,.485984],[.262625,.599586,.780328],[.391387,-.726999,-.716259],[.513854,-.868287,.139347],[.597475,.85513,.326364],[.641224,.109523,.783723],[.737185,-.451155,.538891],[.848705,-.612742,-.314616],[.976075,.365067,.32976],[1.072036,-.19561,.084927]],face:[[15,18,21],[12,20,16],[6,10,2],[3,0,1],[9,7,13],[2,8,4,0],[0,4,5,1],[1,5,11,7],[7,11,17,13],[13,17,22,18],[18,22,24,21],[21,24,23,20],[20,23,19,16],[16,19,14,10],[10,14,8,2],[15,9,13,18],[12,15,21,20],[6,12,16,10],[3,6,2,0],[9,3,1,7],[9,15,12,6,3],[22,17,11,5,4,8,14,19,23,24]]};let p=e.type&&(e.type<0||e.type>=f.length)?0:e.type||0,x=e.size,g=e.sizeX||x||1,_=e.sizeY||x||1,m=e.sizeZ||x||1,M=e.custom||f[p],y=M.face.length,V=e.faceUV||Array(y),O=e.faceColors,A=void 0===e.flat||e.flat,v=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,T=[],b=[],I=[],D=[],w=[],P=0,F=0,B=[];if(A)for(s=0;s<y;s++)O&&void 0===O[s]&&(O[s]=new l.Color4(1,1,1,1)),V&&void 0===V[s]&&(V[s]=new r.Vector4(0,0,1,1));if(A)for(s=0;s<y;s++){let e=M.face[s].length;for(t=0,u=.5*Math.tan((h=2*Math.PI/e)/2),c=.5;t<e;t++)T.push(M.vertex[M.face[s][t]][0]*g,M.vertex[M.face[s][t]][1]*_,M.vertex[M.face[s][t]][2]*m),B.push(P),P++,i=V[s].x+(V[s].z-V[s].x)*(.5+u),o=V[s].y+(V[s].w-V[s].y)*(c-.5),D.push(i,n.useOpenGLOrientationForUV?1-o:o),d=u*Math.cos(h)-c*Math.sin(h),c=u*Math.sin(h)+c*Math.cos(h),u=d,O&&w.push(O[s].r,O[s].g,O[s].b,O[s].a);for(t=0;t<e-2;t++)b.push(B[0+F],B[t+2+F],B[t+1+F]);F+=e}else{for(t=0;t<M.vertex.length;t++)T.push(M.vertex[t][0]*g,M.vertex[t][1]*_,M.vertex[t][2]*m),D.push(0,+!!n.useOpenGLOrientationForUV);for(s=0;s<y;s++)for(t=0;t<M.face[s].length-2;t++)b.push(M.face[s][0],M.face[s][t+2],M.face[s][t+1])}a.VertexData.ComputeNormals(T,b,I),a.VertexData._ComputeSides(v,T,b,I,D,e.frontUVs,e.backUVs);let L=new a.VertexData;return L.positions=T,L.indices=b,L.normals=I,L.uvs=D,O&&A&&(L.colors=w),L})(t).applyToMesh(o,t.updatable),o}var K=e.i(46703);let Y=new r.Vector3(1,0,0),q=new r.Vector3(-1,0,0),j=new r.Vector3(0,1,0),Q=new r.Vector3(0,-1,0),$=new r.Vector3(0,0,1),J=new r.Vector3(0,0,-1);class ee{constructor(e=r.Vector3.Zero(),t=r.Vector3.Up(),s=r.Vector2.Zero(),i=0,o=0,a=null,n=null,h=null,l=null){this.position=e,this.normal=t,this.uv=s,this.vertexIdx=i,this.vertexIdxForBones=o,this.localPositionOverride=a,this.localNormalOverride=n,this.matrixIndicesOverride=h,this.matrixWeightsOverride=l}clone(){return new ee(this.position.clone(),this.normal.clone(),this.uv.clone(),this.vertexIdx,this.vertexIdxForBones,this.localPositionOverride?.slice(),this.localNormalOverride?.slice(),this.matrixIndicesOverride?.slice(),this.matrixWeightsOverride?.slice())}}class et{constructor(e=0,t=0){this.x=e,this.y=t,e!==Math.floor(e)&&(e=Math.floor(e),p.Logger.Warn("x is not an integer, floor(x) used")),t!==Math.floor(t)&&(t=Math.floor(t),p.Logger.Warn("y is not an integer, floor(y) used"))}clone(){return new et(this.x,this.y)}rotate60About(e){let t=this.x;return this.x=e.x+e.y-this.y,this.y=t+this.y-e.x,this}rotateNeg60About(e){let t=this.x;return this.x=t+this.y-e.y,this.y=e.x+e.y-t,this}rotate120(e,t){e!==Math.floor(e)&&(e=Math.floor(e),p.Logger.Warn("m not an integer only floor(m) used")),t!==Math.floor(t)&&(t=Math.floor(t),p.Logger.Warn("n not an integer only floor(n) used"));let s=this.x;return this.x=e-s-this.y,this.y=t+s,this}rotateNeg120(e,t){e!==Math.floor(e)&&(e=Math.floor(e),p.Logger.Warn("m is not an integer, floor(m) used")),t!==Math.floor(t)&&(t=Math.floor(t),p.Logger.Warn("n is not an integer, floor(n) used"));let s=this.x;return this.x=this.y-t,this.y=e+t-s-this.y,this}toCartesianOrigin(e,t){let s=r.Vector3.Zero();return s.x=e.x+2*this.x*t+this.y*t,s.y=e.y+Math.sqrt(3)*this.y*t,s}static Zero(){return new et(0,0)}}class es{constructor(){this.cartesian=[],this.vertices=[],this.max=[],this.min=[],this.closestTo=[],this.innerFacets=[],this.isoVecsABOB=[],this.isoVecsOBOA=[],this.isoVecsBAOA=[],this.vertexTypes=[],this.IDATA=new er("icosahedron","Regular",[[0,S.PHI,-1],[-S.PHI,1,0],[-1,0,-S.PHI],[1,0,-S.PHI],[S.PHI,1,0],[0,S.PHI,1],[-1,0,S.PHI],[-S.PHI,-1,0],[0,-S.PHI,-1],[S.PHI,-1,0],[1,0,S.PHI],[0,-S.PHI,1]],[[0,2,1],[0,3,2],[0,4,3],[0,5,4],[0,1,5],[7,6,1],[8,7,2],[9,8,3],[10,9,4],[6,10,5],[2,7,1],[3,8,2],[4,9,3],[5,10,4],[1,6,5],[11,6,7],[11,7,8],[11,8,9],[11,9,10],[11,10,6]])}setIndices(){let e,t,s,r,i,o,a,n,h=12,l={},u=this.m,c=this.n,d=u;0!==c&&(d=(0,K.HighestCommonFactor)(u,c));let f=u/d,p=c/d,x=et.Zero(),g=new et(u,c),_=new et(-c,u+c),m=et.Zero(),M=et.Zero(),y=et.Zero(),V=[],O=[],A=this.vertByDist,v=(e,t,s,r)=>{o=e+"|"+s,a=t+"|"+r,o in l||a in l?o in l&&!(a in l)?l[a]=l[o]:a in l&&!(o in l)&&(l[o]=l[a]):(l[o]=h,l[a]=h,h++),A[s][0]>2?O[l[o]]=[-A[s][0],A[s][1],l[o]]:O[l[o]]=[V[A[s][0]],A[s][1],l[o]]};this.IDATA.edgematch=[[1,"B"],[2,"B"],[3,"B"],[4,"B"],[0,"B"],[10,"O",14,"A"],[11,"O",10,"A"],[12,"O",11,"A"],[13,"O",12,"A"],[14,"O",13,"A"],[0,"O"],[1,"O"],[2,"O"],[3,"O"],[4,"O"],[19,"B",5,"A"],[15,"B",6,"A"],[16,"B",7,"A"],[17,"B",8,"A"],[18,"B",9,"A"]];for(let a=0;a<20;a++){if(s=(V=this.IDATA.face[a])[2],r=V[1],i=V[0],(o=a+"|"+(n=x.x+"|"+x.y))in l||(l[o]=s,O[s]=[V[A[n][0]],A[n][1]]),(o=a+"|"+(n=g.x+"|"+g.y))in l||(l[o]=r,O[r]=[V[A[n][0]],A[n][1]]),(o=a+"|"+(n=_.x+"|"+_.y))in l||(l[o]=i,O[i]=[V[A[n][0]],A[n][1]]),e=this.IDATA.edgematch[a][0],"B"===(t=this.IDATA.edgematch[a][1]))for(let t=1;t<d;t++)M.x=u-t*(f+p),M.y=c+t*f,y.x=-t*p,y.y=t*(f+p),v(a,e,n=M.x+"|"+M.y,y.x+"|"+y.y);if("O"===t)for(let t=1;t<d;t++)y.x=-t*p,y.y=t*(f+p),m.x=t*f,m.y=t*p,v(a,e,n=y.x+"|"+y.y,m.x+"|"+m.y);if(e=this.IDATA.edgematch[a][2],(t=this.IDATA.edgematch[a][3])&&"A"===t)for(let t=1;t<d;t++)m.x=t*f,m.y=t*p,M.x=u-(d-t)*(f+p),M.y=c+(d-t)*f,v(a,e,n=m.x+"|"+m.y,M.x+"|"+M.y);for(let e=0;e<this.vertices.length;e++)(o=a+"|"+(n=this.vertices[e].x+"|"+this.vertices[e].y))in l||(l[o]=h++,A[n][0]>2?O[l[o]]=[-A[n][0],A[n][1],l[o]]:O[l[o]]=[V[A[n][0]],A[n][1],l[o]])}this.closestTo=O,this.vecToidx=l}calcCoeffs(){let e=this.m,t=this.n,s=Math.sqrt(3)/3,r=e*e+t*t+e*t;this.coau=(e+t)/r,this.cobu=-t/r,this.coav=-s*(e-t)/r,this.cobv=s*(2*e+t)/r}createInnerFacets(){let e=this.m,t=this.n;for(let s=0;s<t+e+1;s++)for(let e=this.min[s];e<this.max[s]+1;e++)e<this.max[s]&&e<this.max[s+1]+1&&this.innerFacets.push(["|"+e+"|"+s,"|"+e+"|"+(s+1),"|"+(e+1)+"|"+s]),s>0&&e<this.max[s-1]&&e+1<this.max[s]+1&&this.innerFacets.push(["|"+e+"|"+s,"|"+(e+1)+"|"+s,"|"+(e+1)+"|"+(s-1)])}edgeVecsABOB(){let e=this.m,t=this.n,s=new et(-t,e+t);for(let r=1;r<e+t;r++){let e=new et(this.min[r],r),t=new et(this.min[r-1],r-1),i=new et(this.min[r+1],r+1),o=e.clone(),a=t.clone(),n=i.clone();o.rotate60About(s),a.rotate60About(s),n.rotate60About(s);let h=new et(this.max[o.y],o.y),l=new et(this.max[o.y-1],o.y-1),u=new et(this.max[o.y-1]-1,o.y-1);(o.x!==h.x||o.y!==h.y)&&(o.x!==l.x?(this.vertexTypes.push([1,0,0]),this.isoVecsABOB.push([e,l,u]),this.vertexTypes.push([1,0,0]),this.isoVecsABOB.push([e,u,h])):o.y===n.y?(this.vertexTypes.push([1,1,0]),this.isoVecsABOB.push([e,t,l]),this.vertexTypes.push([1,0,1]),this.isoVecsABOB.push([e,l,i])):(this.vertexTypes.push([1,1,0]),this.isoVecsABOB.push([e,t,l]),this.vertexTypes.push([1,0,0]),this.isoVecsABOB.push([e,l,h])))}}mapABOBtoOBOA(){let e=new et(0,0);for(let t=0;t<this.isoVecsABOB.length;t++){let s=[];for(let r=0;r<3;r++)e.x=this.isoVecsABOB[t][r].x,e.y=this.isoVecsABOB[t][r].y,0===this.vertexTypes[t][r]&&e.rotateNeg120(this.m,this.n),s.push(e.clone());this.isoVecsOBOA.push(s)}}mapABOBtoBAOA(){let e=new et(0,0);for(let t=0;t<this.isoVecsABOB.length;t++){let s=[];for(let r=0;r<3;r++)e.x=this.isoVecsABOB[t][r].x,e.y=this.isoVecsABOB[t][r].y,1===this.vertexTypes[t][r]&&e.rotate120(this.m,this.n),s.push(e.clone());this.isoVecsBAOA.push(s)}}MapToFace(e,t){let s,i,o=this.IDATA.face[e],a=o[2],n=o[1],h=o[0],l=r.Vector3.FromArray(this.IDATA.vertex[a]),u=r.Vector3.FromArray(this.IDATA.vertex[n]),c=r.Vector3.FromArray(this.IDATA.vertex[h]),d=u.subtract(l),f=c.subtract(l),p=d.scale(this.coau).add(f.scale(this.cobu)),x=d.scale(this.coav).add(f.scale(this.cobv)),g=[];for(let r=0;r<this.cartesian.length;r++)i=p.scale(this.cartesian[r].x).add(x.scale(this.cartesian[r].y)).add(l),g[r]=[i.x,i.y,i.z],s=e+"|"+this.vertices[r].x+"|"+this.vertices[r].y,t.vertex[this.vecToidx[s]]=[i.x,i.y,i.z]}build(e,t){let s,r,i=[],o=et.Zero(),a=new et(e,t),n=new et(-t,e+t);i.push(o,a,n);for(let s=t;s<e+1;s++)for(let t=0;t<e+1-s;t++)i.push(new et(t,s));if(t>0){let s=(0,K.HighestCommonFactor)(e,t),r=e/s,o=t/s;for(let a=1;a<s;a++)i.push(new et(a*r,a*o)),i.push(new et(-a*o,a*(r+o))),i.push(new et(e-a*(r+o),t+a*r));let a=e/t;for(let s=1;s<t;s++)for(let r=0;r<s*a;r++)i.push(new et(r,s)),i.push(new et(r,s).rotate120(e,t)),i.push(new et(r,s).rotateNeg120(e,t))}i.sort((e,t)=>e.x-t.x),i.sort((e,t)=>e.y-t.y);let h=Array(e+t+1),l=Array(e+t+1);for(let e=0;e<h.length;e++)h[e]=1/0,l[e]=-1/0;let u=i.length;for(let e=0;e<u;e++)r=i[e].x,h[s=i[e].y]=Math.min(r,h[s]),l[s]=Math.max(r,l[s]);let c=(s,r)=>{let i=s.clone();return("A"===r&&i.rotateNeg120(e,t),"B"===r&&i.rotate120(e,t),i.x<0)?i.y:i.x+i.y},d=[],f=[],p=[],x=[],g={},_=[],m=-1,M=-1;for(let e=0;e<u;e++)d[e]=i[e].toCartesianOrigin(new et(0,0),.5),f[e]=c(i[e],"O"),p[e]=c(i[e],"A"),x[e]=c(i[e],"B"),f[e]===p[e]&&p[e]===x[e]?(m=3,M=f[e]):f[e]===p[e]?(m=4,M=f[e]):p[e]===x[e]?(m=5,M=p[e]):x[e]===f[e]&&(m=6,M=f[e]),f[e]<p[e]&&f[e]<x[e]&&(m=2,M=f[e]),p[e]<f[e]&&p[e]<x[e]&&(m=1,M=p[e]),x[e]<p[e]&&x[e]<f[e]&&(m=0,M=x[e]),_.push([m,M,i[e].x,i[e].y]);_.sort((e,t)=>e[2]-t[2]),_.sort((e,t)=>e[3]-t[3]),_.sort((e,t)=>e[1]-t[1]),_.sort((e,t)=>e[0]-t[0]);for(let e=0;e<_.length;e++)g[_[e][2]+"|"+_[e][3]]=[_[e][0],_[e][1],e];return this.m=e,this.n=t,this.vertices=i,this.vertByDist=g,this.cartesian=d,this.min=h,this.max=l,this}}class er{constructor(e,t,s,r){this.name=e,this.category=t,this.vertex=s,this.face=r}}class ei extends er{innerToData(e,t){for(let s=0;s<t.innerFacets.length;s++)this.face.push(t.innerFacets[s].map(s=>t.vecToidx[e+s]))}mapABOBtoDATA(e,t){let s=t.IDATA.edgematch[e][0];for(let r=0;r<t.isoVecsABOB.length;r++){let i=[];for(let o=0;o<3;o++)0===t.vertexTypes[r][o]?i.push(e+"|"+t.isoVecsABOB[r][o].x+"|"+t.isoVecsABOB[r][o].y):i.push(s+"|"+t.isoVecsABOB[r][o].x+"|"+t.isoVecsABOB[r][o].y);this.face.push([t.vecToidx[i[0]],t.vecToidx[i[1]],t.vecToidx[i[2]]])}}mapOBOAtoDATA(e,t){let s=t.IDATA.edgematch[e][0];for(let r=0;r<t.isoVecsOBOA.length;r++){let i=[];for(let o=0;o<3;o++)1===t.vertexTypes[r][o]?i.push(e+"|"+t.isoVecsOBOA[r][o].x+"|"+t.isoVecsOBOA[r][o].y):i.push(s+"|"+t.isoVecsOBOA[r][o].x+"|"+t.isoVecsOBOA[r][o].y);this.face.push([t.vecToidx[i[0]],t.vecToidx[i[1]],t.vecToidx[i[2]]])}}mapBAOAtoDATA(e,t){let s=t.IDATA.edgematch[e][2];for(let r=0;r<t.isoVecsBAOA.length;r++){let i=[];for(let o=0;o<3;o++)1===t.vertexTypes[r][o]?i.push(e+"|"+t.isoVecsBAOA[r][o].x+"|"+t.isoVecsBAOA[r][o].y):i.push(s+"|"+t.isoVecsBAOA[r][o].x+"|"+t.isoVecsBAOA[r][o].y);this.face.push([t.vecToidx[i[0]],t.vecToidx[i[1]],t.vecToidx[i[2]]])}}orderData(e){let t=[];for(let e=0;e<13;e++)t[e]=[];let s=e.closestTo;for(let e=0;e<s.length;e++)s[e][0]>-1?s[e][1]>0&&t[s[e][0]].push([e,s[e][1]]):t[12].push([e,s[e][0]]);let r=[];for(let e=0;e<12;e++)r[e]=e;let i=12;for(let e=0;e<12;e++){t[e].sort((e,t)=>e[1]-t[1]);for(let s=0;s<t[e].length;s++)r[t[e][s][0]]=i++}for(let e=0;e<t[12].length;e++)r[t[12][e][0]]=i++;for(let e=0;e<this.vertex.length;e++)this.vertex[e].push(r[e]);this.vertex.sort((e,t)=>e[3]-t[3]);for(let e=0;e<this.vertex.length;e++)this.vertex[e].pop();for(let e=0;e<this.face.length;e++)for(let t=0;t<this.face[e].length;t++)this.face[e][t]=r[this.face[e][t]];this.sharedNodes=t[12].length,this.poleNodes=this.vertex.length-this.sharedNodes}setOrder(e,t){let s=[],r=[],i=t.pop();r.push(i);let o=this.face[i].indexOf(e);o=(o+2)%3;let a=this.face[i][o];s.push(a);let n=0;for(;t.length>0;)i=t[n],this.face[i].indexOf(a)>-1?(o=(this.face[i].indexOf(a)+1)%3,a=this.face[i][o],s.push(a),r.push(i),t.splice(n,1),n=0):n++;return this.adjacentFaces.push(s),r}toGoldbergPolyhedronData(){let e,t,s,r,i,o=new er("GeoDual","Goldberg",[],[]);o.name="GD dual";let a=this.vertex.length,n=Array(a);for(let e=0;e<a;e++)n[e]=[];for(let e=0;e<this.face.length;e++)for(let t=0;t<3;t++)n[this.face[e][t]].push(e);this.adjacentFaces=[];for(let a=0;a<n.length;a++)for(let h of(o.face[a]=this.setOrder(a,n[a].concat([])),n[a])){e=0,t=0,s=0,r=this.face[h];for(let o=0;o<3;o++)e+=(i=this.vertex[r[o]])[0],t+=i[1],s+=i[2];o.vertex[h]=[e/3,t/3,s/3]}return o}static BuildGeodesicData(e){let t=new ei("Geodesic-m-n","Geodesic",[[0,S.PHI,-1],[-S.PHI,1,0],[-1,0,-S.PHI],[1,0,-S.PHI],[S.PHI,1,0],[0,S.PHI,1],[-1,0,S.PHI],[-S.PHI,-1,0],[0,-S.PHI,-1],[S.PHI,-1,0],[1,0,S.PHI],[0,-S.PHI,1]],[]);e.setIndices(),e.calcCoeffs(),e.createInnerFacets(),e.edgeVecsABOB(),e.mapABOBtoOBOA(),e.mapABOBtoBAOA();for(let s=0;s<e.IDATA.face.length;s++)e.MapToFace(s,t),t.innerToData(s,e),"B"===e.IDATA.edgematch[s][1]&&t.mapABOBtoDATA(s,e),"O"===e.IDATA.edgematch[s][1]&&t.mapOBOAtoDATA(s,e),"A"===e.IDATA.edgematch[s][3]&&t.mapBAOAtoDATA(s,e);return t.orderData(e),t.vertex=t.vertex.map(function(e){let t=e[0],s=e[1],r=e[2],i=Math.sqrt(t*t+s*s+r*r);return e[0]*=1/i,e[1]*=1/i,e[2]*=1/i,e}),t}}var eo=i;class ea extends eo.Mesh{constructor(){super(...arguments),this.goldbergData={faceColors:[],faceCenters:[],faceZaxis:[],faceXaxis:[],faceYaxis:[],nbSharedFaces:0,nbUnsharedFaces:0,nbFaces:0,nbFacesAtPole:0,adjacentFaces:[]}}relatedGoldbergFace(e,t){return void 0===t?(e>this.goldbergData.nbUnsharedFaces-1&&(p.Logger.Warn("Maximum number of unshared faces used"),e=this.goldbergData.nbUnsharedFaces-1),this.goldbergData.nbUnsharedFaces+e):(e>11&&(p.Logger.Warn("Last pole used"),e=11),t>this.goldbergData.nbFacesAtPole-1&&(p.Logger.Warn("Maximum number of faces at a pole used"),t=this.goldbergData.nbFacesAtPole-1),12+e*this.goldbergData.nbFacesAtPole+t)}_changeGoldbergFaceColors(e){for(let t=0;t<e.length;t++){let s=e[t][0],r=e[t][1],i=e[t][2];for(let e=s;e<r+1;e++)this.goldbergData.faceColors[e]=i}let t=[];for(let e=0;e<12;e++)for(let s=0;s<5;s++)t.push(this.goldbergData.faceColors[e].r,this.goldbergData.faceColors[e].g,this.goldbergData.faceColors[e].b,this.goldbergData.faceColors[e].a);for(let e=12;e<this.goldbergData.faceColors.length;e++)for(let s=0;s<6;s++)t.push(this.goldbergData.faceColors[e].r,this.goldbergData.faceColors[e].g,this.goldbergData.faceColors[e].b,this.goldbergData.faceColors[e].a);return t}setGoldbergFaceColors(e){let t=this._changeGoldbergFaceColors(e);this.setVerticesData(o.VertexBuffer.ColorKind,t)}updateGoldbergFaceColors(e){let t=this._changeGoldbergFaceColors(e);this.updateVerticesData(o.VertexBuffer.ColorKind,t)}_changeGoldbergFaceUVs(e){let t=this.getVerticesData(o.VertexBuffer.UVKind);for(let s=0;s<e.length;s++){let r,i,o=e[s][0],a=e[s][1],n=e[s][2],h=e[s][3],l=e[s][4],u=[],c=[];for(let e=0;e<5;e++)r=n.x+h*Math.cos(l+e*Math.PI/2.5),i=n.y+h*Math.sin(l+e*Math.PI/2.5),r<0&&(r=0),r>1&&(r=1),u.push(r,i);for(let e=0;e<6;e++)r=n.x+h*Math.cos(l+e*Math.PI/3),i=n.y+h*Math.sin(l+e*Math.PI/3),r<0&&(r=0),r>1&&(r=1),c.push(r,i);for(let e=o;e<Math.min(12,a+1);e++)for(let s=0;s<5;s++)t[10*e+2*s]=u[2*s],t[10*e+2*s+1]=u[2*s+1];for(let e=Math.max(12,o);e<a+1;e++)for(let s=0;s<6;s++)t[12*e-24+2*s]=c[2*s],t[12*e-23+2*s]=c[2*s+1]}return t}setGoldbergFaceUVs(e){let t=this._changeGoldbergFaceUVs(e);this.setVerticesData(o.VertexBuffer.UVKind,t)}updateGoldbergFaceUVs(e){let t=this._changeGoldbergFaceUVs(e);this.updateVerticesData(o.VertexBuffer.UVKind,t)}placeOnGoldbergFaceAt(e,t,s){e.rotation=r.Vector3.RotationFromAxis(this.goldbergData.faceXaxis[t],this.goldbergData.faceYaxis[t],this.goldbergData.faceZaxis[t]),e.position=this.goldbergData.faceCenters[t].add(this.goldbergData.faceXaxis[t].scale(s.x)).add(this.goldbergData.faceYaxis[t].scale(s.y)).add(this.goldbergData.faceZaxis[t].scale(s.z))}serialize(e){super.serialize(e),e.type="GoldbergMesh";let t={};if(t.adjacentFaces=this.goldbergData.adjacentFaces,t.nbSharedFaces=this.goldbergData.nbSharedFaces,t.nbUnsharedFaces=this.goldbergData.nbUnsharedFaces,t.nbFaces=this.goldbergData.nbFaces,t.nbFacesAtPole=this.goldbergData.nbFacesAtPole,this.goldbergData.faceColors)for(let e of(t.faceColors=[],this.goldbergData.faceColors))t.faceColors.push(e.asArray());if(this.goldbergData.faceCenters)for(let e of(t.faceCenters=[],this.goldbergData.faceCenters))t.faceCenters.push(e.asArray());if(this.goldbergData.faceZaxis)for(let e of(t.faceZaxis=[],this.goldbergData.faceZaxis))t.faceZaxis.push(e.asArray());if(this.goldbergData.faceYaxis)for(let e of(t.faceYaxis=[],this.goldbergData.faceYaxis))t.faceYaxis.push(e.asArray());if(this.goldbergData.faceXaxis)for(let e of(t.faceXaxis=[],this.goldbergData.faceXaxis))t.faceXaxis.push(e.asArray());e.goldbergData=t}static Parse(e,t){let s=e.goldbergData;s.faceColors=s.faceColors.map(e=>l.Color4.FromArray(e)),s.faceCenters=s.faceCenters.map(e=>r.Vector3.FromArray(e)),s.faceZaxis=s.faceZaxis.map(e=>r.Vector3.FromArray(e)),s.faceXaxis=s.faceXaxis.map(e=>r.Vector3.FromArray(e)),s.faceYaxis=s.faceYaxis.map(e=>r.Vector3.FromArray(e));let i=new ea(e.name,t);return i.goldbergData=s,i}}class en{constructor(e){this._paths=[],this._tempPaths=[],this._holes=[],this._resolution=e}moveTo(e,t){this._currentPath=new C.Path2(e,t),this._tempPaths.push(this._currentPath)}lineTo(e,t){this._currentPath.addLineTo(e,t)}quadraticCurveTo(e,t,s,r){this._currentPath.addQuadraticCurveTo(e,t,s,r,this._resolution)}bezierCurveTo(e,t,s,r,i,o){this._currentPath.addBezierCurveTo(e,t,s,r,i,o,this._resolution)}extractHoles(){for(let e of this._tempPaths)e.area()>0?this._holes.push(e):this._paths.push(e);if(!this._paths.length&&this._holes.length){let e=this._holes;this._holes=this._paths,this._paths=e}this._tempPaths.length=0}get paths(){return this._paths}get holes(){return this._holes}}e.s(["MeshBuilder",0,{CreateBox:function(e,t={},s=null){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23],s=[0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0],i=[],o=e.width||e.size||1,h=e.height||e.size||1,u=e.depth||e.size||1,c=e.wrap||!1,d=void 0===e.topBaseAt?1:e.topBaseAt,f=void 0===e.bottomBaseAt?0:e.bottomBaseAt;d=(d+4)%4,f=(f+4)%4;let p=[2,0,3,1][d],x=[2,0,1,3][f],g=[1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,1];if(c){t=[2,3,0,2,0,1,4,5,6,4,6,7,9,10,11,9,11,8,12,14,15,12,13,14],g=[-1,1,1,1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,-1];let e=[[1,1,1],[-1,1,1],[-1,1,-1],[1,1,-1]],s=[[-1,-1,1],[1,-1,1],[1,-1,-1],[-1,-1,-1]],r=[17,18,19,16],i=[22,23,20,21];for(;p>0;)e.unshift(e.pop()),r.unshift(r.pop()),p--;for(;x>0;)s.unshift(s.pop()),i.unshift(i.pop()),x--;e=e.flat(),s=s.flat(),g=g.concat(e).concat(s),t.push(r[0],r[2],r[3],r[0],r[1],r[2]),t.push(i[0],i[2],i[3],i[0],i[1],i[2])}let _=[o/2,h/2,u/2],m=g.reduce((e,t,s)=>e.concat(t*_[s%3]),[]),M=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,y=e.faceUV||Array(6),V=e.faceColors,O=[];for(let e=0;e<6;e++)void 0===y[e]&&(y[e]=new r.Vector4(0,0,1,1)),V&&void 0===V[e]&&(V[e]=new l.Color4(1,1,1,1));for(let e=0;e<6;e++)if(i.push(y[e].z,n.useOpenGLOrientationForUV?1-y[e].w:y[e].w),i.push(y[e].x,n.useOpenGLOrientationForUV?1-y[e].w:y[e].w),i.push(y[e].x,n.useOpenGLOrientationForUV?1-y[e].y:y[e].y),i.push(y[e].z,n.useOpenGLOrientationForUV?1-y[e].y:y[e].y),V)for(let t=0;t<4;t++)O.push(V[e].r,V[e].g,V[e].b,V[e].a);a.VertexData._ComputeSides(M,m,t,s,i,e.frontUVs,e.backUVs);let A=new a.VertexData;return A.indices=t,A.positions=m,A.normals=s,A.uvs=i,V&&(A.colors=M===a.VertexData.DOUBLESIDE?O.concat(O):O),A})(t).applyToMesh(o,t.updatable),o},CreateTiledBox:function(e,t,s=null){let r=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,c(t).applyToMesh(r,t.updatable),r},CreateSphere:function(e,t={},s=null){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t=0|(e.segments||32),s=e.diameterX||e.diameter||1,i=e.diameterY||e.diameter||1,o=e.diameterZ||e.diameter||1,h=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,l=e.slice&&e.slice<=0?1:e.slice||1,u=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,c=!!e.dedupTopBottomIndices,d=new r.Vector3(s/2,i/2,o/2),f=2+t,p=2*f,x=[],g=[],_=[],m=[];for(let e=0;e<=f;e++){let t=e/f,s=t*Math.PI*l;for(let e=0;e<=p;e++){let i=e/p,o=i*Math.PI*2*h,a=r.Matrix.RotationZ(-s),l=r.Matrix.RotationY(o),u=r.Vector3.TransformCoordinates(r.Vector3.Up(),a),c=r.Vector3.TransformCoordinates(u,l),f=c.multiply(d),x=c.divide(d).normalize();g.push(f.x,f.y,f.z),_.push(x.x,x.y,x.z),m.push(i,n.useOpenGLOrientationForUV?1-t:t)}if(e>0){let t=g.length/3;for(let s=t-2*(p+1);s+p+2<t;s++)c?(e>1&&(x.push(s),x.push(s+1),x.push(s+p+1)),(e<f||l<1)&&(x.push(s+p+1),x.push(s+1),x.push(s+p+2))):(x.push(s),x.push(s+1),x.push(s+p+1),x.push(s+p+1),x.push(s+1),x.push(s+p+2))}}a.VertexData._ComputeSides(u,g,x,_,m,e.frontUVs,e.backUVs);let M=new a.VertexData;return M.indices=x,M.positions=g,M.normals=_,M.uvs=m,M})(t).applyToMesh(o,t.updatable),o},CreateDisc:function(e,t={},s=null){let r=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t=[],s=[],r=[],i=[],o=e.radius||.5,h=e.tessellation||64,l=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,u=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE;t.push(0,0,0),i.push(.5,.5);let c=2*Math.PI*l,d=1===l?c/h:c/(h-1),f=0;for(let e=0;e<h;e++){let e=Math.cos(f),s=Math.sin(f),r=(e+1)/2,a=(1-s)/2;t.push(o*e,o*s,0),i.push(r,n.useOpenGLOrientationForUV?1-a:a),f+=d}1===l&&(t.push(t[3],t[4],t[5]),i.push(i[2],n.useOpenGLOrientationForUV?1-i[3]:i[3]));let p=t.length/3;for(let e=1;e<p-1;e++)s.push(e+1,0,e);a.VertexData.ComputeNormals(t,s,r),a.VertexData._ComputeSides(u,t,s,r,i,e.frontUVs,e.backUVs);let x=new a.VertexData;return x.indices=s,x.positions=t,x.normals=r,x.uvs=i,x})(t).applyToMesh(r,t.updatable),r},CreateIcoSphere:function(e,t={},s=null){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t,s=e.sideOrientation||a.VertexData.DEFAULTSIDE,i=e.radius||1,o=void 0===e.flat||e.flat,h=0|(e.subdivisions||4),l=e.radiusX||i,u=e.radiusY||i,c=e.radiusZ||i,d=(1+Math.sqrt(5))/2,f=[-1,d,-0,1,d,0,-1,-d,0,1,-d,0,0,-1,-d,0,1,-d,0,-1,d,0,1,d,d,0,1,d,0,-1,-d,0,1,-d,0,-1],p=[0,11,5,0,5,1,0,1,7,0,7,10,12,22,23,1,5,20,5,11,4,23,22,13,22,18,6,7,1,8,14,21,4,14,4,2,16,13,6,15,6,19,3,8,9,4,21,5,13,17,23,6,13,22,19,6,18,9,8,1],x=[0,1,2,3,4,5,6,7,8,9,10,11,0,2,3,3,3,4,7,8,9,9,10,11],g=[5,1,3,1,6,4,0,0,5,3,4,2,2,2,4,0,2,0,1,1,6,0,6,2,0,4,3,3,4,4,3,1,4,2,4,4,0,2,1,1,2,2,3,3,1,3,2,4],_=138/1024,m=239/1024,M=60/1024,y=26/1024,V=-40/1024,O=20/1024,A=[0,0,0,0,1,0,0,1,1,0,0,0,1,1,0,0,1,1,1,0],v=[],T=[],b=[],I=[],D=0,w=[,,,],P=[,,,];for(t=0;t<3;t++)w[t]=r.Vector3.Zero(),P[t]=r.Vector2.Zero();for(let e=0;e<20;e++){for(t=0;t<3;t++){let s=p[3*e+t];w[t].copyFromFloats(f[3*x[s]],f[3*x[s]+1],f[3*x[s]+2]),w[t].normalize(),P[t].copyFromFloats(g[2*s]*_+M+A[e]*V,g[2*s+1]*m+y+A[e]*O)}let s=(e,t,s,i)=>{let a,d=r.Vector3.Lerp(w[0],w[2],t/h),f=r.Vector3.Lerp(w[1],w[2],t/h),p=h===t?w[2]:r.Vector3.Lerp(d,f,e/(h-t));if(p.normalize(),o){let e=r.Vector3.Lerp(w[0],w[2],i/h),t=r.Vector3.Lerp(w[1],w[2],i/h);a=r.Vector3.Lerp(e,t,s/(h-i))}else a=new r.Vector3(p.x,p.y,p.z);a.x/=l,a.y/=u,a.z/=c,a.normalize();let x=r.Vector2.Lerp(P[0],P[2],t/h),g=r.Vector2.Lerp(P[1],P[2],t/h),_=h===t?P[2]:r.Vector2.Lerp(x,g,e/(h-t));T.push(p.x*l,p.y*u,p.z*c),b.push(a.x,a.y,a.z),I.push(_.x,n.useOpenGLOrientationForUV?1-_.y:_.y),v.push(D),D++};for(let e=0;e<h;e++)for(let t=0;t+e<h;t++)s(t,e,t+1/3,e+1/3),s(t+1,e,t+1/3,e+1/3),s(t,e+1,t+1/3,e+1/3),t+e+1<h&&(s(t+1,e,t+2/3,e+2/3),s(t+1,e+1,t+2/3,e+2/3),s(t,e+1,t+2/3,e+2/3))}a.VertexData._ComputeSides(s,T,v,b,I,e.frontUVs,e.backUVs);let F=new a.VertexData;return F.indices=v,F.positions=T,F.normals=b,F.uvs=I,F})(t).applyToMesh(o,t.updatable),o},CreateRibbon:h,CreateCylinder:function(e,t={},s){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t,s,o,h,u,c,f,p,x,g=e.height||2,_=0===e.diameterTop?0:e.diameterTop||e.diameter||1,m=0===e.diameterBottom?0:e.diameterBottom||e.diameter||1;_=_||1e-5,m=m||1e-5;let M=0|(e.tessellation||24),y=0|(e.subdivisions||1),V=!!e.hasRings,O=!!e.enclose,A=0===e.cap?0:e.cap||i.Mesh.CAP_ALL,v=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,T=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,b=e.faceUV||[,,,],I=e.faceColors,D=2+(1+(1!==v&&O?2:0))*(V?y:1);for(t=0;t<D;t++)I&&void 0===I[t]&&(I[t]=new l.Color4(1,1,1,1));for(t=0;t<D;t++)b&&void 0===b[t]&&(b[t]=new r.Vector4(0,0,1,1));let w=[],P=[],F=[],B=[],L=[],E=2*Math.PI*v/M,C=(m-_)/2/g,S=r.Vector3.Zero(),z=r.Vector3.Zero(),R=r.Vector3.Zero(),U=r.Vector3.Zero(),N=r.Vector3.Zero(),W=d.Axis.Y,G=1,k=0;for(u=0;u<=y;u++)for(f=0,h=((o=u/y)*(_-m)+m)/2,p=V&&0!==u&&u!==y?2:1;f<p;f++){for(V&&(G+=f),O&&(G+=2*f),c=0;c<=M;c++)S.x=Math.cos(-(s=c*E))*h,S.y=-g/2+o*g,S.z=Math.sin(-s)*h,0===_&&u===y?(z.x=F[F.length-(M+1)*3],z.y=F[F.length-(M+1)*3+1],z.z=F[F.length-(M+1)*3+2]):(z.x=S.x,z.z=S.z,z.y=Math.sqrt(z.x*z.x+z.z*z.z)*C,z.normalize()),0===c&&(R.copyFrom(S),U.copyFrom(z)),P.push(S.x,S.y,S.z),F.push(z.x,z.y,z.z),x=V?k!==G?b[G].y:b[G].w:b[G].y+(b[G].w-b[G].y)*o,B.push(b[G].x+(b[G].z-b[G].x)*c/M,n.useOpenGLOrientationForUV?1-x:x),I&&L.push(I[G].r,I[G].g,I[G].b,I[G].a);1!==v&&O&&(P.push(S.x,S.y,S.z),P.push(0,S.y,0),P.push(0,S.y,0),P.push(R.x,R.y,R.z),r.Vector3.CrossToRef(W,z,N),N.normalize(),F.push(N.x,N.y,N.z,N.x,N.y,N.z),r.Vector3.CrossToRef(U,W,N),N.normalize(),F.push(N.x,N.y,N.z,N.x,N.y,N.z),x=V?k!==G?b[G+1].y:b[G+1].w:b[G+1].y+(b[G+1].w-b[G+1].y)*o,B.push(b[G+1].x,n.useOpenGLOrientationForUV?1-x:x),B.push(b[G+1].z,n.useOpenGLOrientationForUV?1-x:x),x=V?k!==G?b[G+2].y:b[G+2].w:b[G+2].y+(b[G+2].w-b[G+2].y)*o,B.push(b[G+2].x,n.useOpenGLOrientationForUV?1-x:x),B.push(b[G+2].z,n.useOpenGLOrientationForUV?1-x:x),I&&(L.push(I[G+1].r,I[G+1].g,I[G+1].b,I[G+1].a),L.push(I[G+1].r,I[G+1].g,I[G+1].b,I[G+1].a),L.push(I[G+2].r,I[G+2].g,I[G+2].b,I[G+2].a),L.push(I[G+2].r,I[G+2].g,I[G+2].b,I[G+2].a))),k!==G&&(k=G)}let H=1!==v&&O?M+4:M;for(G=0,u=0;G<y;G++){let e=0,t=0,s=0,r=0;for(c=0;c<M;c++)e=u*(H+1)+c,t=(u+1)*(H+1)+c,s=u*(H+1)+(c+1),r=(u+1)*(H+1)+(c+1),w.push(e,t,s),w.push(r,s,t);1!==v&&O&&(w.push(e+2,t+2,s+2),w.push(r+2,s+2,t+2),w.push(e+4,t+4,s+4),w.push(r+4,s+4,t+4)),u=V?u+2:u+1}let X=e=>{let t,s,i,o=e?_/2:m/2;if(0===o)return;let a=e?b[D-1]:b[0],h=null;I&&(h=e?I[D-1]:I[0]);let l=P.length/3,u=e?g/2:-g/2,c=new r.Vector3(0,u,0);P.push(c.x,c.y,c.z),F.push(0,e?1:-1,0);let d=a.y+(a.w-a.y)*.5;B.push(a.x+(a.z-a.x)*.5,n.useOpenGLOrientationForUV?1-d:d),h&&L.push(h.r,h.g,h.b,h.a);let f=new r.Vector2(.5,.5);for(i=0;i<=M;i++){let l=Math.cos(-(t=2*Math.PI*i*v/M)),c=Math.sin(-t);s=new r.Vector3(l*o,u,c*o);let d=new r.Vector2(l*f.x+.5,c*f.y+.5);P.push(s.x,s.y,s.z),F.push(0,e?1:-1,0);let p=a.y+(a.w-a.y)*d.y;B.push(a.x+(a.z-a.x)*d.x,n.useOpenGLOrientationForUV?1-p:p),h&&L.push(h.r,h.g,h.b,h.a)}for(i=0;i<M;i++)e?(w.push(l),w.push(l+(i+2)),w.push(l+(i+1))):(w.push(l),w.push(l+(i+1)),w.push(l+(i+2)))};(A===i.Mesh.CAP_START||A===i.Mesh.CAP_ALL)&&X(!1),(A===i.Mesh.CAP_END||A===i.Mesh.CAP_ALL)&&X(!0),a.VertexData._ComputeSides(T,P,w,F,B,e.frontUVs,e.backUVs);let Z=new a.VertexData;return Z.indices=w,Z.positions=P,Z.normals=F,Z.uvs=B,I&&(Z.colors=L),Z})(t).applyToMesh(o,t.updatable),o},CreateTorus:function(e,t={},s){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t=[],s=[],i=[],o=[],h=e.diameter||1,l=e.thickness||.5,u=0|(e.tessellation||16),c=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,d=u+1;for(let e=0;e<=u;e++){let a=e/u,c=e*Math.PI*2/u-Math.PI/2,f=r.Matrix.Translation(h/2,0,0).multiply(r.Matrix.RotationY(c));for(let h=0;h<=u;h++){let c=1-h/u,p=h*Math.PI*2/u+Math.PI,x=Math.cos(p),g=Math.sin(p),_=new r.Vector3(x,g,0),m=_.scale(l/2),M=new r.Vector2(a,c);m=r.Vector3.TransformCoordinates(m,f),_=r.Vector3.TransformNormal(_,f),s.push(m.x,m.y,m.z),i.push(_.x,_.y,_.z),o.push(M.x,n.useOpenGLOrientationForUV?1-M.y:M.y);let y=(e+1)%d,V=(h+1)%d;t.push(e*d+h),t.push(e*d+V),t.push(y*d+h),t.push(e*d+V),t.push(y*d+V),t.push(y*d+h)}}a.VertexData._ComputeSides(c,s,t,i,o,e.frontUVs,e.backUVs);let f=new a.VertexData;return f.indices=t,f.positions=s,f.normals=i,f.uvs=o,f})(t).applyToMesh(o,t.updatable),o},CreateTorusKnot:function(e,t={},s){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t,s,i=[],o=[],h=[],l=[],u=e.radius||2,c=e.tube||.5,d=e.radialSegments||32,f=e.tubularSegments||32,p=e.p||2,x=e.q||3,g=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,_=e=>{let t=Math.cos(e),s=Math.sin(e),i=x/p*e,o=Math.cos(i),a=u*Math.sin(i)*.5;return new r.Vector3(u*(2+o)*.5*t,u*(2+o)*s*.5,a)};for(t=0;t<=d;t++){let e=t%d/d*2*p*Math.PI,i=_(e),a=_(e+.01),h=a.subtract(i),u=a.add(i),x=r.Vector3.Cross(h,u);for(u=r.Vector3.Cross(x,h),x.normalize(),u.normalize(),s=0;s<f;s++){let e=s%f/f*2*Math.PI,r=-c*Math.cos(e),a=c*Math.sin(e);o.push(i.x+r*u.x+a*x.x),o.push(i.y+r*u.y+a*x.y),o.push(i.z+r*u.z+a*x.z),l.push(t/d),l.push(n.useOpenGLOrientationForUV?1-s/f:s/f)}}for(t=0;t<d;t++)for(s=0;s<f;s++){let e=(s+1)%f,r=t*f+s,o=(t+1)*f+s,a=(t+1)*f+e,n=t*f+e;i.push(n),i.push(o),i.push(r),i.push(n),i.push(a),i.push(o)}a.VertexData.ComputeNormals(o,i,h),a.VertexData._ComputeSides(g,o,i,h,l,e.frontUVs,e.backUVs);let m=new a.VertexData;return m.indices=i,m.positions=o,m.normals=h,m.uvs=l,m})(t).applyToMesh(o,t.updatable),o},CreateLineSystem:L,CreateLines:function(e,t,s=null){let r=t.colors?[t.colors]:null;return L(e,{lines:[t.points],updatable:t.updatable,instance:t.instance,colors:r,useVertexAlpha:t.useVertexAlpha,material:t.material},s)},CreateDashedLines:function(e,t,s=null){let o=t.points,n=t.instance,h=t.gapSize||1,l=t.dashSize||3;if(n)return(t.dashNb||t.dashSize||t.gapSize||t.useVertexAlpha||t.material)&&p.Logger.Warn("You have used an option other than points with the instance option. Please be aware that these other options will be ignored."),n.updateMeshPositions(e=>{let t,s,i,a,h=r.Vector3.Zero(),l=e.length/6,u=0,c=0;for(i=0;i<o.length-1;i++)o[i+1].subtractToRef(o[i],h),u+=h.length();let d=u/l,f=n._creationDataStorage.dashSize,p=f*d/(f+n._creationDataStorage.gapSize);for(i=0;i<o.length-1;i++)for(o[i+1].subtractToRef(o[i],h),t=Math.floor(h.length()/d),h.normalize(),a=0;a<t&&c<e.length;)s=d*a,e[c]=o[i].x+s*h.x,e[c+1]=o[i].y+s*h.y,e[c+2]=o[i].z+s*h.z,e[c+3]=o[i].x+(s+p)*h.x,e[c+4]=o[i].y+(s+p)*h.y,e[c+5]=o[i].z+(s+p)*h.z,c+=6,a++;for(;c<e.length;)e[c]=o[i].x,e[c+1]=o[i].y,e[c+2]=o[i].z,c+=3},!1),n;let u=new F(e,s,null,void 0,void 0,void 0,t.useVertexAlpha,t.material);return(function(e){let t,s,i,o=e.dashSize||3,n=e.gapSize||1,h=e.dashNb||200,l=e.points,u=[],c=[],d=r.Vector3.Zero(),f=0,p=0;for(i=0;i<l.length-1;i++)l[i+1].subtractToRef(l[i],d),f+=d.length();let x=f/h,g=o*x/(o+n);for(i=0;i<l.length-1;i++){l[i+1].subtractToRef(l[i],d),t=Math.floor(d.length()/x),d.normalize();for(let e=0;e<t;e++)s=x*e,u.push(l[i].x+s*d.x,l[i].y+s*d.y,l[i].z+s*d.z),u.push(l[i].x+(s+g)*d.x,l[i].y+(s+g)*d.y,l[i].z+(s+g)*d.z),c.push(p,p+1),p+=2}let _=new a.VertexData;return _.positions=u,_.indices=c,_})(t).applyToMesh(u,t.updatable),u._creationDataStorage=new i._CreationDataStorage,u._creationDataStorage.dashSize=l,u._creationDataStorage.gapSize=h,u},ExtrudeShape:function(e,t,s=null){let r=t.path,o=t.shape,a=t.scale||1,n=t.rotation||0,h=0===t.cap?0:t.cap||i.Mesh.NO_CAP,l=t.updatable,u=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),c=t.instance||null,d=t.invertUV||!1,f=t.closeShape||!1,p=t.closePath||!1,x=t.capFunction||null;return G(e,o,r,a,n,null,null,p,f,h,!1,s,!!l,u,c,d,t.frontUVs||null,t.backUVs||null,t.firstNormal||null,!!t.adjustFrame,x)},ExtrudeShapeCustom:function(e,t,s=null){let o=t.path,a=t.shape,n=r.Vector3.Zero(),h=t.rotationFunction||(()=>0),l=t.closePath||t.ribbonCloseArray||!1,u=t.closeShape||t.ribbonClosePath||!1,c=0===t.cap?0:t.cap||i.Mesh.NO_CAP,d=t.updatable,f=t.firstNormal||null,p=t.adjustFrame||!1,x=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),g=t.instance,_=t.invertUV||!1,m=t.capFunction||null;return G(e,a,o,null,null,t.scaleVectorFunction??((e,s)=>{let r=t.scaleFunction?.(e,s)??1;return n.copyFromFloats(r,r,r)}),h,l,u,c,!0,s,!!d,x,g||null,_,t.frontUVs||null,t.backUVs||null,f,p,m||null)},CreateLathe:function(e,t,s=null){let o,a,n,l,u=t.arc?t.arc<=0||t.arc>1?1:t.arc:1,c=void 0===t.closed||t.closed,d=t.shape,f=t.radius||1,p=t.tessellation||64,x=t.clip||0,g=t.updatable,_=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),m=t.cap||i.Mesh.NO_CAP,M=2*Math.PI,y=[],V=t.invertUV||!1,O=M/p*u;for(o=0;o<=p-x;o++){for(l=[],(m==i.Mesh.CAP_START||m==i.Mesh.CAP_ALL)&&(l.push(new r.Vector3(0,d[0].y,0)),l.push(new r.Vector3(Math.cos(o*O)*d[0].x*f,d[0].y,Math.sin(o*O)*d[0].x*f))),a=0;a<d.length;a++)n=new r.Vector3(Math.cos(o*O)*d[a].x*f,d[a].y,Math.sin(o*O)*d[a].x*f),l.push(n);(m==i.Mesh.CAP_END||m==i.Mesh.CAP_ALL)&&(l.push(new r.Vector3(Math.cos(o*O)*d[d.length-1].x*f,d[d.length-1].y,Math.sin(o*O)*d[d.length-1].x*f)),l.push(new r.Vector3(0,d[d.length-1].y,0))),y.push(l)}return h(e,{pathArray:y,closeArray:c,sideOrientation:_,updatable:g,invertUV:V,frontUVs:t.frontUVs,backUVs:t.backUVs},s)},CreateTiledPlane:function(e,t,s=null){let r=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,u(t).applyToMesh(r,t.updatable),r},CreatePlane:function(e,t={},s=null){let r,o,h,l,u,c,d,f,p,x,g=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),g._originalBuilderSideOrientation=t.sideOrientation,(r=[],o=[],h=[],l=[],u=void 0!==t.width?t.width:void 0!==t.size?t.size:1,c=void 0!==t.height?t.height:void 0!==t.size?t.size:1,d=0===t.sideOrientation?0:t.sideOrientation||a.VertexData.DEFAULTSIDE,f=u/2,p=c/2,o.push(-f,-p,0),h.push(0,0,-1),l.push(0,+!!n.useOpenGLOrientationForUV),o.push(f,-p,0),h.push(0,0,-1),l.push(1,+!!n.useOpenGLOrientationForUV),o.push(f,p,0),h.push(0,0,-1),l.push(1,+!n.useOpenGLOrientationForUV),o.push(-f,p,0),h.push(0,0,-1),l.push(0,+!n.useOpenGLOrientationForUV),r.push(0),r.push(1),r.push(2),r.push(0),r.push(2),r.push(3),a.VertexData._ComputeSides(d,o,r,h,l,t.frontUVs,t.backUVs),(x=new a.VertexData).indices=r,x.positions=o,x.normals=h,x.uvs=l,x).applyToMesh(g,t.updatable),t.sourcePlane&&(g.translate(t.sourcePlane.normal,-t.sourcePlane.d),g.setDirection(t.sourcePlane.normal.scale(-1))),g},CreateGround:function(e,t={},s){let i=new H(e,s);return i._setReady(!1),i._subdivisionsX=t.subdivisionsX||t.subdivisions||1,i._subdivisionsY=t.subdivisionsY||t.subdivisions||1,i._width=t.width||1,i._height=t.height||1,i._maxX=i._width/2,i._maxZ=i._height/2,i._minX=-i._maxX,i._minZ=-i._maxZ,(function(e){let t,s,i=[],o=[],h=[],l=[],u=e.width||e.size||1,c=e.height||e.size||1,d=0|(e.subdivisionsX||e.subdivisions||1),f=0|(e.subdivisionsY||e.subdivisions||1);for(t=0;t<=f;t++)for(s=0;s<=d;s++){let e=new r.Vector3(s*u/d-u/2,0,(f-t)*c/f-c/2),i=new r.Vector3(0,1,0);o.push(e.x,e.y,e.z),h.push(i.x,i.y,i.z),l.push(s/d,n.useOpenGLOrientationForUV?t/f:1-t/f)}for(t=0;t<f;t++)for(s=0;s<d;s++)i.push(s+1+(t+1)*(d+1)),i.push(s+1+t*(d+1)),i.push(s+t*(d+1)),i.push(s+(t+1)*(d+1)),i.push(s+1+(t+1)*(d+1)),i.push(s+t*(d+1));let p=new a.VertexData;return p.indices=i,p.positions=o,p.normals=h,p.uvs=l,p})(t).applyToMesh(i,t.updatable),i._setReady(!0),i},CreateTiledGround:function(e,t,s=null){let o=new i.Mesh(e,s);return(function(e){let t,s,i,o,n=void 0!==e.xmin&&null!==e.xmin?e.xmin:-1,h=void 0!==e.zmin&&null!==e.zmin?e.zmin:-1,l=void 0!==e.xmax&&null!==e.xmax?e.xmax:1,u=void 0!==e.zmax&&null!==e.zmax?e.zmax:1,c=e.subdivisions||{w:1,h:1},d=e.precision||{w:1,h:1},f=[],p=[],x=[],g=[];c.h=c.h<1?1:c.h,c.w=c.w<1?1:c.w,d.w=d.w<1?1:d.w,d.h=d.h<1?1:d.h;let _={w:(l-n)/c.w,h:(u-h)/c.h};for(i=0;i<c.h;i++)for(o=0;o<c.w;o++)!function(e,i,o,a){let n=p.length/3,h=d.w+1;for(t=0;t<d.h;t++)for(s=0;s<d.w;s++){let e=[n+s+t*h,n+(s+1)+t*h,n+(s+1)+(t+1)*h,n+s+(t+1)*h];f.push(e[1]),f.push(e[2]),f.push(e[3]),f.push(e[0]),f.push(e[1]),f.push(e[3])}let l=r.Vector3.Zero(),u=new r.Vector3(0,1,0);for(t=0;t<=d.h;t++)for(s=0,l.z=t*(a-i)/d.h+i;s<=d.w;s++)l.x=s*(o-e)/d.w+e,l.y=0,p.push(l.x,l.y,l.z),x.push(u.x,u.y,u.z),g.push(s/d.w,t/d.h)}(n+o*_.w,h+i*_.h,n+(o+1)*_.w,h+(i+1)*_.h);let m=new a.VertexData;return m.indices=f,m.positions=p,m.normals=x,m.uvs=g,m})(t).applyToMesh(o,t.updatable),o},CreateGroundFromHeightMap:function(e,t,s={},i=null){let o,n=s.width||10,h=s.height||10,u=s.subdivisions||1,c=s.minHeight||0,d=s.maxHeight||1,f=s.colorFilter||new l.Color3(.3,.59,.11),p=s.alphaFilter||0,x=s.updatable,g=s.onReady,_=new H(e,i=i||v.EngineStore.LastCreatedScene);_._subdivisionsX=u,_._subdivisionsY=u,_._width=n,_._height=h,_._maxX=_._width/2,_._maxZ=_._height/2,_._minX=-_._maxX,_._minZ=-_._maxZ,_._setReady(!1),s.passHeightBufferInCallback&&(o=new Float32Array((u+1)*(u+1)));let m=(e,t,s)=>{(function(e){let t,s,i=[],o=[],n=[],h=[],u=e.colorFilter||new l.Color3(.3,.59,.11),c=e.alphaFilter||0,d=!1;if(e.minHeight>e.maxHeight){d=!0;let t=e.maxHeight;e.maxHeight=e.minHeight,e.minHeight=t}for(t=0;t<=e.subdivisions;t++)for(s=0;s<=e.subdivisions;s++){let i=new r.Vector3(s*e.width/e.subdivisions-e.width/2,0,(e.subdivisions-t)*e.height/e.subdivisions-e.height/2),a=(((i.x+e.width/2)/e.width*(e.bufferWidth-1)|0)+((1-(i.z+e.height/2)/e.height)*(e.bufferHeight-1)|0)*e.bufferWidth)*4,l=e.buffer[a]/255,f=e.buffer[a+1]/255,p=e.buffer[a+2]/255,x=e.buffer[a+3]/255;d&&(l=1-l,f=1-f,p=1-p);let g=l*u.r+f*u.g+p*u.b;x>=c?i.y=e.minHeight+(e.maxHeight-e.minHeight)*g:i.y=e.minHeight-S.Epsilon,e.heightBuffer&&(e.heightBuffer[t*(e.subdivisions+1)+s]=i.y),o.push(i.x,i.y,i.z),n.push(0,0,0),h.push(s/e.subdivisions,1-t/e.subdivisions)}for(t=0;t<e.subdivisions;t++)for(s=0;s<e.subdivisions;s++){let r=s+1+(t+1)*(e.subdivisions+1),a=s+1+t*(e.subdivisions+1),n=s+t*(e.subdivisions+1),h=s+(t+1)*(e.subdivisions+1),l=o[3*r+1]>=e.minHeight,u=o[3*a+1]>=e.minHeight,c=o[3*n+1]>=e.minHeight;l&&u&&c&&(i.push(r),i.push(a),i.push(n)),o[3*h+1]>=e.minHeight&&l&&c&&(i.push(h),i.push(r),i.push(n))}a.VertexData.ComputeNormals(o,i,n);let f=new a.VertexData;return f.indices=i,f.positions=o,f.normals=n,f.uvs=h,f})({width:n,height:h,subdivisions:u,minHeight:c,maxHeight:d,colorFilter:f,buffer:e,bufferWidth:t,bufferHeight:s,alphaFilter:p,heightBuffer:o}).applyToMesh(_,x),g&&g(_,o),_._setReady(!0)};return"string"==typeof t?(i.addPendingData(_),X.Tools.LoadImage(t,e=>{let t=e.width,s=e.height;i.isDisposed||m(i?.getEngine().resizeImageBitmap(e,t,s),t,s),i.removePendingData(_)},(e,t)=>{i.removePendingData(_),s.onError&&s.onError(e,t)},i.offlineProvider)):m(t.data,t.width,t.height),_},CreatePolygon:N,ExtrudePolygon:W,CreateTube:function(e,t,s=null){let o,a,n=t.path,l=t.instance,u=1;void 0!==t.radius?u=t.radius:l&&(u=l._creationDataStorage.radius);let c=t.tessellation||64,d=t.radiusFunction||null,f=t.cap||i.Mesh.NO_CAP,p=t.invertUV||!1,x=t.updatable,g=i.Mesh._GetDefaultSideOrientation(t.sideOrientation);t.arc=t.arc&&(t.arc<=0||t.arc>1)?1:t.arc||1;let _=(e,t,s,o,a,n,h,l)=>{let u,c,d,f,p=t.getTangents(),x=t.getNormals(),g=t.getDistances(),_=2*Math.PI/a*l,m=n||(()=>o),M=r.TmpVectors.Matrix[0],y=2*(h!==i.Mesh.NO_CAP&&h!==i.Mesh.CAP_END);for(let t=0;t<e.length;t++){c=m(t,g[t]),u=[],d=x[t];for(let s=0;s<a;s++)r.Matrix.RotationAxisToRef(p[t],_*s,M),f=u[s]?u[s]:r.Vector3.Zero(),r.Vector3.TransformCoordinatesToRef(d,M,f),f.scaleInPlace(c).addInPlace(e[t]),u[s]=f;s[y]=u,y++}let V=(t,s)=>{let r=[];for(let i=0;i<t;i++)r.push(e[s]);return r};switch(h){case i.Mesh.NO_CAP:break;case i.Mesh.CAP_START:s[0]=V(a,0),s[1]=s[2].slice(0);break;case i.Mesh.CAP_END:s[y]=s[y-1].slice(0),s[y+1]=V(a,e.length-1);break;case i.Mesh.CAP_ALL:s[0]=V(a,0),s[1]=s[2].slice(0),s[y]=s[y-1].slice(0),s[y+1]=V(a,e.length-1)}return s};if(l){let e=l._creationDataStorage,s=t.arc||e.arc;return o=e.path3D.update(n),l=h("",{pathArray:a=_(n,o,e.pathArray,u,e.tessellation,d,e.cap,s),instance:l}),e.path3D=o,e.pathArray=a,e.arc=s,e.radius=u,l}o=new C.Path3D(n);let m=h(e,{pathArray:a=_(n,o,[],u,c,d,f=f<0||f>3?0:f,t.arc),closePath:!0,closeArray:!1,updatable:x,sideOrientation:g,invertUV:p,frontUVs:t.frontUVs,backUVs:t.backUVs},s);return m._creationDataStorage.pathArray=a,m._creationDataStorage.path3D=o,m._creationDataStorage.tessellation=c,m._creationDataStorage.cap=f,m._creationDataStorage.arc=t.arc,m._creationDataStorage.radius=u,m},CreatePolyhedron:Z,CreateGeodesic:function(e,t,s=null){let r=t.m||1;r!==Math.floor(r)&&(r=Math.floor(r),p.Logger.Warn("m not an integer only floor(m) used"));let i=t.n||0;if(i!==Math.floor(i)&&(i=Math.floor(i),p.Logger.Warn("n not an integer only floor(n) used")),i>r){let e=i;i=r,r=e,p.Logger.Warn("n > m therefore m and n swapped")}let o=new es;return o.build(r,i),Z(e,{custom:ei.BuildGeodesicData(o),size:t.size,sizeX:t.sizeX,sizeY:t.sizeY,sizeZ:t.sizeZ,faceUV:t.faceUV,faceColors:t.faceColors,flat:t.flat,updatable:t.updatable,sideOrientation:t.sideOrientation,frontUVs:t.frontUVs,backUVs:t.backUVs},s)},CreateGoldberg:function(e,t,s=null){let o=t.size,h=t.sizeX||o||1,u=t.sizeY||o||1,c=t.sizeZ||o||1,d=t.m||1;d!==Math.floor(d)&&(d=Math.floor(d),p.Logger.Warn("m not an integer only floor(m) used"));let f=t.n||0;if(f!==Math.floor(f)&&(f=Math.floor(f),p.Logger.Warn("n not an integer only floor(n) used")),f>d){let e=f;f=d,d=e,p.Logger.Warn("n > m therefore m and n swapped")}let x=new es;x.build(d,f);let g=ei.BuildGeodesicData(x),_=g.toGoldbergPolyhedronData(),m=new ea(e,s);t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),m._originalBuilderSideOrientation=t.sideOrientation,(function(e,t){let s=e.size,i=e.sizeX||s||1,o=e.sizeY||s||1,h=e.sizeZ||s||1,l=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,u=[],c=[],d=[],f=[],p=1/0,x=-1/0,g=1/0,_=-1/0;for(let e=0;e<t.vertex.length;e++)p=Math.min(p,t.vertex[e][0]*i),x=Math.max(x,t.vertex[e][0]*i),g=Math.min(g,t.vertex[e][1]*o),_=Math.max(_,t.vertex[e][1]*o);let m=0;for(let e=0;e<t.face.length;e++){let s=t.face[e],a=r.Vector3.FromArray(t.vertex[s[0]]),l=r.Vector3.FromArray(t.vertex[s[2]]),M=r.Vector3.FromArray(t.vertex[s[1]]),y=l.subtract(a),V=M.subtract(a),O=r.Vector3.Cross(V,y).normalize();for(let e=0;e<s.length;e++){d.push(O.x,O.y,O.z);let r=t.vertex[s[e]];u.push(r[0]*i,r[1]*o,r[2]*h);let a=(r[1]*o-g)/(_-g);f.push((r[0]*i-p)/(x-p),n.useOpenGLOrientationForUV?1-a:a)}for(let e=0;e<s.length-2;e++)c.push(m,m+e+2,m+e+1);m+=s.length}a.VertexData._ComputeSides(l,u,c,d,f);let M=new a.VertexData;return M.positions=u,M.indices=c,M.normals=d,M.uvs=f,M})(t,_).applyToMesh(m,t.updatable),m.goldbergData.nbSharedFaces=g.sharedNodes,m.goldbergData.nbUnsharedFaces=g.poleNodes,m.goldbergData.adjacentFaces=g.adjacentFaces,m.goldbergData.nbFaces=m.goldbergData.nbSharedFaces+m.goldbergData.nbUnsharedFaces,m.goldbergData.nbFacesAtPole=(m.goldbergData.nbUnsharedFaces-12)/12;for(let e=0;e<g.vertex.length;e++)m.goldbergData.faceCenters.push(r.Vector3.FromArray(g.vertex[e])),m.goldbergData.faceCenters[e].x*=h,m.goldbergData.faceCenters[e].y*=u,m.goldbergData.faceCenters[e].z*=c,m.goldbergData.faceColors.push(new l.Color4(1,1,1,1));for(let e=0;e<_.face.length;e++){let t=_.face[e],s=r.Vector3.FromArray(_.vertex[t[0]]),i=r.Vector3.FromArray(_.vertex[t[2]]),o=r.Vector3.FromArray(_.vertex[t[1]]),a=i.subtract(s),n=o.subtract(s),h=r.Vector3.Cross(n,a).normalize(),l=r.Vector3.Cross(n,h).normalize();m.goldbergData.faceXaxis.push(n.normalize()),m.goldbergData.faceYaxis.push(h),m.goldbergData.faceZaxis.push(l)}return m},CreateDecal:function(e,t,s){let h=!!t.skeleton,l=!!t.morphTargetManager?.numTargets,u=s.localMode||h,c=t.getIndices(),d=h||l?t.getPositionData(!0,!0):t.getVerticesData(o.VertexBuffer.PositionKind),f=h||l?t.getNormalsData(!0,!0):t.getVerticesData(o.VertexBuffer.NormalKind),p=u?h?t.getVerticesData(o.VertexBuffer.PositionKind):d:null,x=u?h?t.getVerticesData(o.VertexBuffer.NormalKind):f:null,g=t.getVerticesData(o.VertexBuffer.UVKind),_=h?t.getVerticesData(o.VertexBuffer.MatricesIndicesKind):null,m=h?t.getVerticesData(o.VertexBuffer.MatricesWeightsKind):null,M=h?t.getVerticesData(o.VertexBuffer.MatricesIndicesExtraKind):null,y=h?t.getVerticesData(o.VertexBuffer.MatricesWeightsExtraKind):null,V=s.position||r.Vector3.Zero(),O=s.normal||r.Vector3.Up(),A=s.size||r.Vector3.One(),v=s.angle||0;if(!O){let e=new r.Vector3(0,0,1),s=t.getScene().activeCamera,i=r.Vector3.TransformCoordinates(e,s.getWorldMatrix());O=s.globalPosition.subtract(i)}let T=-Math.atan2(O.z,O.x)-Math.PI/2,b=Math.sqrt(O.x*O.x+O.z*O.z),I=Math.atan2(O.y,b),D=new a.VertexData;D.indices=[],D.positions=[],D.normals=[],D.uvs=[],D.matricesIndices=h?[]:null,D.matricesWeights=h?[]:null,D.matricesIndicesExtra=M?[]:null,D.matricesWeightsExtra=y?[]:null;let w=0,P=(e,t)=>{let i=new ee;if(!c||!d||!f)return i;let o=c[e];if(i.vertexIdx=3*o,i.vertexIdxForBones=4*o,i.position=new r.Vector3(d[3*o],d[3*o+1],d[3*o+2]),r.Vector3.TransformCoordinatesToRef(i.position,t,i.position),i.normal=new r.Vector3(f[3*o],f[3*o+1],f[3*o+2]),r.Vector3.TransformNormalToRef(i.normal,t,i.normal),s.captureUVS&&g){let e=g[2*o+1];i.uv=new r.Vector2(g[2*o],n.useOpenGLOrientationForUV?1-e:e)}return i},F=[0,0,0,0],B=(e,t)=>{if(0===e.length)return e;let s=.5*Math.abs(r.Vector3.Dot(A,t)),i=(e,t,s,r)=>{for(let i=0;i<r;++i)if(e[s+i]===t)return s+i;return -1},o=(e,o)=>{let a=r.Vector3.GetClipFactor(e.position,o.position,t,s),n=F,h=F;if(_&&m){let t=e.matrixIndicesOverride?0:e.vertexIdxForBones,s=e.matrixIndicesOverride??_,r=e.matrixWeightsOverride??m,l=o.matrixIndicesOverride?0:o.vertexIdxForBones,u=o.matrixIndicesOverride??_,c=o.matrixWeightsOverride??m;n=[0,0,0,0],h=[0,0,0,0];let d=0;for(let e=0;e<4;++e)if(r[t+e]>0){let o=i(u,s[t+e],l,4);n[d]=s[t+e],h[d]=(0,K.Lerp)(r[t+e],o>=0?c[o]:0,a),d++}for(let e=0;e<4&&d<4;++e){let r=u[l+e];-1===i(s,r,t,4)&&(n[d]=r,h[d]=(0,K.Lerp)(0,c[l+e],a),d++)}let f=h[0]+h[1]+h[2]+h[3];h[0]/=f,h[1]/=f,h[2]/=f,h[3]/=f}let l=e.localPositionOverride?e.localPositionOverride[0]:p?.[e.vertexIdx]??0,u=e.localPositionOverride?e.localPositionOverride[1]:p?.[e.vertexIdx+1]??0,c=e.localPositionOverride?e.localPositionOverride[2]:p?.[e.vertexIdx+2]??0,d=o.localPositionOverride?o.localPositionOverride[0]:p?.[o.vertexIdx]??0,f=o.localPositionOverride?o.localPositionOverride[1]:p?.[o.vertexIdx+1]??0,g=o.localPositionOverride?o.localPositionOverride[2]:p?.[o.vertexIdx+2]??0,M=e.localNormalOverride?e.localNormalOverride[0]:x?.[e.vertexIdx]??0,y=e.localNormalOverride?e.localNormalOverride[1]:x?.[e.vertexIdx+1]??0,V=e.localNormalOverride?e.localNormalOverride[2]:x?.[e.vertexIdx+2]??0,O=o.localNormalOverride?o.localNormalOverride[0]:x?.[o.vertexIdx]??0,A=o.localNormalOverride?o.localNormalOverride[1]:x?.[o.vertexIdx+1]??0,v=o.localNormalOverride?o.localNormalOverride[2]:x?.[o.vertexIdx+2]??0,T=M+(O-M)*a,b=y+(A-y)*a,I=V+(v-V)*a,D=Math.sqrt(T*T+b*b+I*I);return new ee(r.Vector3.Lerp(e.position,o.position,a),r.Vector3.Lerp(e.normal,o.normal,a).normalize(),r.Vector2.Lerp(e.uv,o.uv,a),-1,-1,p?[l+(d-l)*a,u+(f-u)*a,c+(g-c)*a]:null,x?[T/D,b/D,I/D]:null,n,h)},a=null;e.length>3&&(a=[]);for(let i=0;i<e.length;i+=3){let n=null,h=null,l=null,u=null,c=r.Vector3.Dot(e[i].position,t)-s,d=r.Vector3.Dot(e[i+1].position,t)-s,f=r.Vector3.Dot(e[i+2].position,t)-s,p=c>0,x=d>0,g=f>0;switch(+!!p+ +!!x+ +!!g){case 0:e.length>3?(a.push(e[i]),a.push(e[i+1]),a.push(e[i+2])):a=e;break;case 1:if(a=a??[],p&&(n=e[i+1],h=e[i+2],l=o(e[i],n),u=o(e[i],h)),x){n=e[i],h=e[i+2],l=o(e[i+1],n),u=o(e[i+1],h),a.push(l),a.push(h.clone()),a.push(n.clone()),a.push(h.clone()),a.push(l.clone()),a.push(u);break}g&&(n=e[i],h=e[i+1],l=o(e[i+2],n),u=o(e[i+2],h)),n&&h&&l&&u&&(a.push(n.clone()),a.push(h.clone()),a.push(l),a.push(u),a.push(l.clone()),a.push(h.clone()));break;case 2:a=a??[],p||(h=o(n=e[i].clone(),e[i+1]),l=o(n,e[i+2]),a.push(n),a.push(h),a.push(l)),x||(h=o(n=e[i+1].clone(),e[i+2]),l=o(n,e[i]),a.push(n),a.push(h),a.push(l)),g||(h=o(n=e[i+2].clone(),e[i]),l=o(n,e[i+1]),a.push(n),a.push(h),a.push(l))}}return a},L=t instanceof i.Mesh?t:null,E=L?._thinInstanceDataStorage.matrixData,C=L?.thinInstanceCount||1,S=r.TmpVectors.Matrix[0];S.copyFrom(r.Matrix.IdentityReadOnly);for(let e=0;e<C;++e){if(L?.hasThinInstances&&E){let t=16*e;S.setRowFromFloats(0,E[t+0],E[t+1],E[t+2],E[t+3]),S.setRowFromFloats(1,E[t+4],E[t+5],E[t+6],E[t+7]),S.setRowFromFloats(2,E[t+8],E[t+9],E[t+10],E[t+11]),S.setRowFromFloats(3,E[t+12],E[t+13],E[t+14],E[t+15])}let i=r.Matrix.RotationYawPitchRoll(T,I,v).multiply(r.Matrix.Translation(V.x,V.y,V.z)),o=r.Matrix.Invert(i),a=t.getWorldMatrix(),h=S.multiply(a).multiply(o),l=[,,,];for(let e=0;e<c.length;e+=3){let t=l;if((t[0]=P(e,h),t[1]=P(e+1,h),t[2]=P(e+2,h),!(s.cullBackFaces&&0>=-t[0].normal.z&&0>=-t[1].normal.z&&0>=-t[2].normal.z)&&(t=B(t,Y))&&(t=B(t,q))&&(t=B(t,j))&&(t=B(t,Q))&&(t=B(t,$)))&&(t=B(t,J)))for(let e=0;e<t.length;e++){let r=t[e];if(D.indices.push(w),u?(r.localPositionOverride?(D.positions[3*w]=r.localPositionOverride[0],D.positions[3*w+1]=r.localPositionOverride[1],D.positions[3*w+2]=r.localPositionOverride[2]):p&&(D.positions[3*w]=p[r.vertexIdx],D.positions[3*w+1]=p[r.vertexIdx+1],D.positions[3*w+2]=p[r.vertexIdx+2]),r.localNormalOverride?(D.normals[3*w]=r.localNormalOverride[0],D.normals[3*w+1]=r.localNormalOverride[1],D.normals[3*w+2]=r.localNormalOverride[2]):x&&(D.normals[3*w]=x[r.vertexIdx],D.normals[3*w+1]=x[r.vertexIdx+1],D.normals[3*w+2]=x[r.vertexIdx+2])):(r.position.toArray(D.positions,3*w),r.normal.toArray(D.normals,3*w)),D.matricesIndices&&D.matricesWeights&&(r.matrixIndicesOverride?(D.matricesIndices[4*w]=r.matrixIndicesOverride[0],D.matricesIndices[4*w+1]=r.matrixIndicesOverride[1],D.matricesIndices[4*w+2]=r.matrixIndicesOverride[2],D.matricesIndices[4*w+3]=r.matrixIndicesOverride[3]):(_&&(D.matricesIndices[4*w]=_[r.vertexIdxForBones],D.matricesIndices[4*w+1]=_[r.vertexIdxForBones+1],D.matricesIndices[4*w+2]=_[r.vertexIdxForBones+2],D.matricesIndices[4*w+3]=_[r.vertexIdxForBones+3]),M&&D.matricesIndicesExtra&&(D.matricesIndicesExtra[4*w]=M[r.vertexIdxForBones],D.matricesIndicesExtra[4*w+1]=M[r.vertexIdxForBones+1],D.matricesIndicesExtra[4*w+2]=M[r.vertexIdxForBones+2],D.matricesIndicesExtra[4*w+3]=M[r.vertexIdxForBones+3])),r.matrixWeightsOverride?(D.matricesWeights[4*w]=r.matrixWeightsOverride[0],D.matricesWeights[4*w+1]=r.matrixWeightsOverride[1],D.matricesWeights[4*w+2]=r.matrixWeightsOverride[2],D.matricesWeights[4*w+3]=r.matrixWeightsOverride[3]):(m&&(D.matricesWeights[4*w]=m[r.vertexIdxForBones],D.matricesWeights[4*w+1]=m[r.vertexIdxForBones+1],D.matricesWeights[4*w+2]=m[r.vertexIdxForBones+2],D.matricesWeights[4*w+3]=m[r.vertexIdxForBones+3]),y&&D.matricesWeightsExtra&&(D.matricesWeightsExtra[4*w]=y[r.vertexIdxForBones],D.matricesWeightsExtra[4*w+1]=y[r.vertexIdxForBones+1],D.matricesWeightsExtra[4*w+2]=y[r.vertexIdxForBones+2],D.matricesWeightsExtra[4*w+3]=y[r.vertexIdxForBones+3]))),s.captureUVS)r.uv.toArray(D.uvs,2*w);else{D.uvs.push(.5+r.position.x/A.x);let e=.5+r.position.y/A.y;D.uvs.push(n.useOpenGLOrientationForUV?1-e:e)}w++}}}0===D.indices.length&&(D.indices=null),0===D.positions.length&&(D.positions=null),0===D.normals.length&&(D.normals=null),0===D.uvs.length&&(D.uvs=null),D.matricesIndices?.length===0&&(D.matricesIndices=null),D.matricesWeights?.length===0&&(D.matricesWeights=null),D.matricesIndicesExtra?.length===0&&(D.matricesIndicesExtra=null),D.matricesWeightsExtra?.length===0&&(D.matricesWeightsExtra=null);let z=new i.Mesh(e,t.getScene());return D.applyToMesh(z),u?(z.skeleton=t.skeleton,z.parent=t):(z.position=V.clone(),z.rotation=new r.Vector3(I,T,v)),z.computeWorldMatrix(!0),z.refreshBoundingInfo(!0,!0),z},CreateCapsule:function(e,t={orientation:r.Vector3.Up(),subdivisions:2,tessellation:16,height:1,radius:.25,capSubdivisions:6,updatable:!1},s=null){let o=new i.Mesh(e,s);return(function(e={subdivisions:2,tessellation:16,height:1,radius:.25,capSubdivisions:6}){let t,s,i=0|Math.max(e.subdivisions?e.subdivisions:2,1),o=0|Math.max(e.tessellation?e.tessellation:16,3),h=Math.max(e.height?e.height:1,0),l=Math.max(e.radius?e.radius:.25,0),u=0|Math.max(e.capSubdivisions?e.capSubdivisions:6,1),c=Math.max(e.radiusTop?e.radiusTop:l,0),d=Math.max(e.radiusBottom?e.radiusBottom:l,0),f=2*Math.PI,p=Math.max(e.topCapSubdivisions?e.topCapSubdivisions:u,1),x=Math.max(e.bottomCapSubdivisions?e.bottomCapSubdivisions:u,1),g=Math.acos((d-c)/h),_=[],m=[],M=[],y=[],V=0,O=[],A=.5*(h-(c+d)),v=.5*Math.PI,T=r.Vector3.Zero(),b=r.Vector3.Zero(),I=Math.cos(g),D=Math.sin(g),w=new r.Vector2(c*D,A+c*I).subtract(new r.Vector2(d*D,-A+d*I)).length(),P=c*g+w+d*(v-g),F=0;for(s=0;s<=p;s++){let e=[],r=v-s/p*g;F+=c*g/p;let i=Math.cos(r),a=Math.sin(r),h=i*c;for(t=0;t<=o;t++){let s=t/o,r=s*f+0,l=Math.sin(r),u=Math.cos(r);b.x=h*l,b.y=A+a*c,b.z=h*u,m.push(b.x,b.y,b.z),T.set(i*l,a,i*u),M.push(T.x,T.y,T.z),y.push(s,n.useOpenGLOrientationForUV?F/P:1-F/P),e.push(V),V++}O.push(e)}let B=h-c-d+I*c-I*d,L=D*(d-c)/B;for(s=1;s<=i;s++){let e=[];F+=w/i;let r=D*(s*(d-c)/i+c);for(t=0;t<=o;t++){let a=t/o,h=a*f+0,l=Math.sin(h),u=Math.cos(h);b.x=r*l,b.y=A+I*c-s*B/i,b.z=r*u,m.push(b.x,b.y,b.z),T.set(l,L,u).normalize(),M.push(T.x,T.y,T.z),y.push(a,n.useOpenGLOrientationForUV?F/P:1-F/P),e.push(V),V++}O.push(e)}for(s=1;s<=x;s++){let e=[],r=v-g-s/x*(Math.PI-g);F+=d*g/x;let i=Math.cos(r),a=Math.sin(r),h=i*d;for(t=0;t<=o;t++){let s=t/o,r=s*f+0,l=Math.sin(r),u=Math.cos(r);b.x=h*l,b.y=-A+a*d,b.z=h*u,m.push(b.x,b.y,b.z),T.set(i*l,a,i*u),M.push(T.x,T.y,T.z),y.push(s,n.useOpenGLOrientationForUV?F/P:1-F/P),e.push(V),V++}O.push(e)}for(t=0;t<o;t++)for(s=0;s<p+i+x;s++){let e=O[s][t],r=O[s+1][t],i=O[s+1][t+1],o=O[s][t+1];_.push(e),_.push(r),_.push(o),_.push(r),_.push(i),_.push(o)}if(_=_.reverse(),e.orientation&&!e.orientation.equals(r.Vector3.Up())){let t=new r.Matrix;e.orientation.clone().scale(.5*Math.PI).cross(r.Vector3.Up()).toQuaternion().toRotationMatrix(t);let s=r.Vector3.Zero();for(let e=0;e<m.length;e+=3)s.set(m[e],m[e+1],m[e+2]),r.Vector3.TransformCoordinatesToRef(s.clone(),t,s),m[e]=s.x,m[e+1]=s.y,m[e+2]=s.z}let E=new a.VertexData;return E.positions=m,E.normals=M,E.uvs=y,E.indices=_,E})(t).applyToMesh(o,t.updatable),o},CreateText:function(e,t,s,o={size:50,resolution:8,depth:1},a=null,n=earcut){let h=function(e,t,s,r){let i=Array.from(e),o=t/r.resolution,a=(r.boundingBox.yMax-r.boundingBox.yMin+r.underlineThickness)*o,n=[],h=0,l=0;for(let e=0;e<i.length;e++){let t=i[e];if("\n"===t)h=0,l-=a;else{let e=function(e,t,s,r,i,o){let a=o.glyphs[e]||o.glyphs["?"];if(!a)return null;let n=new en(i);if(a.o){let e=a.o.split(" ");for(let i=0,o=e.length;i<o;)switch(e[i++]){case"m":{let o=parseInt(e[i++])*t+s,a=parseInt(e[i++])*t+r;n.moveTo(o,a);break}case"l":{let o=parseInt(e[i++])*t+s,a=parseInt(e[i++])*t+r;n.lineTo(o,a);break}case"q":{let o=parseInt(e[i++])*t+s,a=parseInt(e[i++])*t+r,h=parseInt(e[i++])*t+s,l=parseInt(e[i++])*t+r;n.quadraticCurveTo(h,l,o,a);break}case"b":{let o=parseInt(e[i++])*t+s,a=parseInt(e[i++])*t+r,h=parseInt(e[i++])*t+s,l=parseInt(e[i++])*t+r,u=parseInt(e[i++])*t+s,c=parseInt(e[i++])*t+r;n.bezierCurveTo(h,l,u,c,o,a)}}}return n.extractHoles(),{offsetX:a.ha*t,shapePath:n}}(t,o,h,l,s,r);e&&(h+=e.offsetX,n.push(e.shapePath))}}return n}(t,o.size||50,o.resolution||8,s),l=[],u=0;for(let t of h){if(!t.paths.length)continue;let s=t.holes.slice();for(let h of t.paths){let t=[],c=[];for(let e of h.getPoints())c.push(new r.Vector3(e.x,0,e.y));for(let e of s.slice()){let i=e.getPoints(),o=!1;for(let e of i)if(h.isPointInside(e)){o=!0;break}if(!o)continue;let a=[];for(let e of i)a.push(new r.Vector3(e.x,0,e.y));t.push(a),s.splice(s.indexOf(e),1)}if(!t.length&&s.length)for(let e of s){let s=e.getPoints(),i=[];for(let e of s)i.push(new r.Vector3(e.x,0,e.y));t.push(i)}let d=W(e,{shape:c,holes:t.length?t:void 0,depth:o.depth||1,faceUV:o.faceUV||o.perLetterFaceUV?.(u),faceColors:o.faceColors||o.perLetterFaceColors?.(u),sideOrientation:i.Mesh._GetDefaultSideOrientation(o.sideOrientation||i.Mesh.DOUBLESIDE)},a,n);l.push(d),u++}}let c=i.Mesh.MergeMeshes(l,!0,!0);if(c){let t=c.getBoundingInfo().boundingBox;c.position.x+=-(t.minimumWorld.x+t.maximumWorld.x)/2,c.position.y+=-(t.minimumWorld.y+t.maximumWorld.y)/2,c.position.z+=-(t.minimumWorld.z+t.maximumWorld.z)/2+t.extendSize.z,c.name=e;let s=new _.TransformNode("pivot",a);s.rotation.x=-Math.PI/2,c.parent=s,c.bakeCurrentTransformIntoVertices(),c.parent=null,s.dispose()}return c}}],97998)}]);
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,12423,e=>{"use strict";class t{static GetShadersRepository(e=0){return 0===e?t.ShadersRepository:t.ShadersRepositoryWGSL}static GetShadersStore(e=0){return 0===e?t.ShadersStore:t.ShadersStoreWGSL}static GetIncludesShadersStore(e=0){return 0===e?t.IncludesShadersStore:t.IncludesShadersStoreWGSL}}t.ShadersRepository="src/Shaders/",t.ShadersStore={},t.IncludesShadersStore={},t.ShadersRepositoryWGSL="src/ShadersWGSL/",t.ShadersStoreWGSL={},t.IncludesShadersStoreWGSL={},e.s(["ShaderStore",0,t])},69938,e=>{"use strict";var t=e.i(76535);let s=!1;e.s(["RegisterAbstractEngineRenderPass",0,function(){s||(s=!0,t.AbstractEngine.prototype.getRenderPassNames=function(){return this._renderPassNames},t.AbstractEngine.prototype.getCurrentRenderPassName=function(){return this._renderPassNames[this.currentRenderPassId]},t.AbstractEngine.prototype.createRenderPassId=function(e){let s=++t.AbstractEngine._RenderPassIdCounter;return this._renderPassNames[s]=e??"NONAME",s},t.AbstractEngine.prototype.releaseRenderPassId=function(e){this._renderPassNames[e]=void 0;for(let t=0;t<this.scenes.length;++t){let s=this.scenes[t];for(let t=0;t<s.meshes.length;++t){let i=s.meshes[t];if(i._releaseRenderPassId(e),i.subMeshes)for(let t=0;t<i.subMeshes.length;++t)i.subMeshes[t]._removeDrawWrapper(e)}}})}])},84201,e=>{"use strict";var t,s,i=e.i(99267);class r{get wrapU(){return this._cachedWrapU}set wrapU(e){this._cachedWrapU=e}get wrapV(){return this._cachedWrapV}set wrapV(e){this._cachedWrapV=e}get wrapR(){return this._cachedWrapR}set wrapR(e){this._cachedWrapR=e}get anisotropicFilteringLevel(){return this._cachedAnisotropicFilteringLevel}set anisotropicFilteringLevel(e){this._cachedAnisotropicFilteringLevel=e}get comparisonFunction(){return this._comparisonFunction}set comparisonFunction(e){this._comparisonFunction=e}get useMipMaps(){return this._useMipMaps}set useMipMaps(e){this._useMipMaps=e}constructor(){this.samplingMode=-1,this._useMipMaps=!0,this._cachedWrapU=null,this._cachedWrapV=null,this._cachedWrapR=null,this._cachedAnisotropicFilteringLevel=null,this._comparisonFunction=0}setParameters(e=1,t=1,s=1,i=1,r=2,a=0){return this._cachedWrapU=e,this._cachedWrapV=t,this._cachedWrapR=s,this._cachedAnisotropicFilteringLevel=i,this.samplingMode=r,this._comparisonFunction=a,this}compareSampler(e){return this._cachedWrapU===e._cachedWrapU&&this._cachedWrapV===e._cachedWrapV&&this._cachedWrapR===e._cachedWrapR&&this._cachedAnisotropicFilteringLevel===e._cachedAnisotropicFilteringLevel&&this.samplingMode===e.samplingMode&&this._comparisonFunction===e._comparisonFunction&&this._useMipMaps===e._useMipMaps}}(t=s||(s={}))[t.Unknown=0]="Unknown",t[t.Url=1]="Url",t[t.Temp=2]="Temp",t[t.Raw=3]="Raw",t[t.Dynamic=4]="Dynamic",t[t.RenderTarget=5]="RenderTarget",t[t.MultiRenderTarget=6]="MultiRenderTarget",t[t.Cube=7]="Cube",t[t.CubeRaw=8]="CubeRaw",t[t.CubePrefiltered=9]="CubePrefiltered",t[t.Raw3D=10]="Raw3D",t[t.Raw2DArray=11]="Raw2DArray",t[t.DepthStencil=12]="DepthStencil",t[t.CubeRawRGBD=13]="CubeRawRGBD",t[t.Depth=14]="Depth",t[t.External=15]="External";class a extends r{get useMipMaps(){return null===this._useMipMaps?this.generateMipMaps:this._useMipMaps}set useMipMaps(e){this._useMipMaps=e}get uniqueId(){return this._uniqueId}_setUniqueId(e){this._uniqueId=e}getEngine(){return this._engine}get source(){return this._source}constructor(e,t,s=!1){super(),this.isReady=!1,this.isCube=!1,this.is3D=!1,this.is2DArray=!1,this.isMultiview=!1,this.url="",this.generateMipMaps=!1,this._useMipMaps=null,this.mipLevelCount=1,this.samples=0,this.type=-1,this.format=-1,this.onLoadedObservable=new i.Observable,this.onErrorObservable=new i.Observable,this.onRebuildCallback=null,this.width=0,this.height=0,this.depth=0,this.baseWidth=0,this.baseHeight=0,this.baseDepth=0,this.invertY=!1,this._invertVScale=!1,this._associatedChannel=-1,this._source=0,this._buffer=null,this._bufferView=null,this._bufferViewArray=null,this._bufferViewArrayArray=null,this._size=0,this._extension="",this._files=null,this._workingCanvas=null,this._workingContext=null,this._cachedCoordinatesMode=null,this._isDisabled=!1,this._compression=null,this._sphericalPolynomial=null,this._sphericalPolynomialPromise=null,this._sphericalPolynomialComputed=!1,this._lodGenerationScale=0,this._lodGenerationOffset=0,this._useSRGBBuffer=!1,this._creationFlags=0,this._lodTextureHigh=null,this._lodTextureMid=null,this._lodTextureLow=null,this._isRGBD=!1,this._linearSpecularLOD=!1,this._irradianceTexture=null,this._hardwareTexture=null,this._maxLodLevel=null,this._references=1,this._gammaSpace=null,this._premulAlpha=!1,this._dynamicTextureSource=null,this._autoMSAAManagement=!1,this._engine=e,this._source=t,this._uniqueId=a._Counter++,s||(this._hardwareTexture=e._createHardwareTexture())}incrementReferences(){this._references++}updateSize(e,t,s=1){this._engine.updateTextureDimensions(this,e,t,s),this.width=e,this.height=t,this.depth=s,this.baseWidth=e,this.baseHeight=t,this.baseDepth=s,this._size=e*t*s}_rebuild(){let e;if(this.isReady=!1,this._cachedCoordinatesMode=null,this._cachedWrapU=null,this._cachedWrapV=null,this._cachedWrapR=null,this._cachedAnisotropicFilteringLevel=null,this.onRebuildCallback){let e=this.onRebuildCallback(this),t=t=>{t._swapAndDie(this,!1),this.isReady=e.isReady};e.isAsync?e.proxy.then(t):t(e.proxy);return}switch(this.source){case 2:case 12:case 14:break;case 1:e=this._engine.createTexture(this._originalUrl??this.url,!this.generateMipMaps,this.invertY,null,this.samplingMode,e=>{e._swapAndDie(this,!1),this.isReady=!0},null,this._buffer,void 0,this.format,this._extension,void 0,void 0,void 0,this._useSRGBBuffer);return;case 3:if((e=this._engine.createRawTexture(this._bufferView,this.baseWidth,this.baseHeight,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type,this._creationFlags,this._useSRGBBuffer,this.mipLevelCount))._swapAndDie(this,!1),this._bufferViewArray)for(let e=0;e<this._bufferViewArray.length;e++){let t=this._bufferViewArray[e];t&&this._engine.updateRawTexture(this,t,this.format,this.invertY,this._compression,this.type,this._useSRGBBuffer,e)}this.isReady=!0;break;case 10:(e=this._engine.createRawTexture3D(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type))._swapAndDie(this,!1),this.isReady=!0;break;case 11:if((e=this._engine.createRawTexture2DArray(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type,this._creationFlags,this.mipLevelCount))._swapAndDie(this,!1),this._bufferViewArray)for(let e=0;e<this._bufferViewArray.length;e++){let t=this._bufferViewArray[e];t&&this._engine.updateRawTexture2DArray(this,t,this.format,this.invertY,this._compression,this.type,e)}this.isReady=!0;break;case 4:(e=this._engine.createDynamicTexture(this.baseWidth,this.baseHeight,this.generateMipMaps,this.samplingMode))._swapAndDie(this,!1),this._dynamicTextureSource&&this._engine.updateDynamicTexture(this,this._dynamicTextureSource,this.invertY,this._premulAlpha,this.format,!0);break;case 7:e=this._engine.createCubeTexture(this.url,null,this._files,!this.generateMipMaps,()=>{e._swapAndDie(this,!1),this.isReady=!0},null,this.format,this._extension,!1,0,0,null,void 0,this._useSRGBBuffer,ArrayBuffer.isView(this._buffer)?this._buffer:null);return;case 8:(e=this._engine.createRawCubeTexture(this._bufferViewArray,this.width,this._originalFormat??this.format,this.type,this.generateMipMaps,this.invertY,this.samplingMode,this._compression))._swapAndDie(this,!1),this.isReady=!0;break;case 13:return;case 9:(e=this._engine.createPrefilteredCubeTexture(this.url,null,this._lodGenerationScale,this._lodGenerationOffset,e=>{e&&e._swapAndDie(this,!1),this.isReady=!0},null,this.format,this._extension))._sphericalPolynomial=this._sphericalPolynomial;return}}_swapAndDie(e,t=!0){this._hardwareTexture?.setUsage(e._source,this.generateMipMaps,this.is2DArray,this.isCube,this.is3D,this.width,this.height,this.depth),e._hardwareTexture=this._hardwareTexture,e._setUniqueId(a._Counter++),t&&(e._isRGBD=this._isRGBD),this._lodTextureHigh&&(e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureHigh=this._lodTextureHigh),this._lodTextureMid&&(e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureMid=this._lodTextureMid),this._lodTextureLow&&(e._lodTextureLow&&e._lodTextureLow.dispose(),e._lodTextureLow=this._lodTextureLow),this._irradianceTexture&&(e._irradianceTexture&&e._irradianceTexture.dispose(),e._irradianceTexture=this._irradianceTexture);let s=this._engine.getLoadedTexturesCache(),i=s.indexOf(this);-1!==i&&s.splice(i,1),-1===(i=s.indexOf(e))&&s.push(e)}dispose(){this._references--,0===this._references&&(this.onLoadedObservable.clear(),this.onErrorObservable.clear(),this._engine._releaseTexture(this),this._hardwareTexture=null,this._dynamicTextureSource=null)}}a._Counter=0,e.s(["InternalTexture",0,a],84201)},80871,76312,e=>{"use strict";var t=e.i(75405);class s{static Eval(e,t){return"true"===(e=e.match(/\([^()]*\)/g)?e.replace(/\([^()]*\)/g,e=>(e=e.slice(1,e.length-1),s._HandleParenthesisContent(e,t))):s._HandleParenthesisContent(e,t))||"false"!==e&&s.Eval(e,t)}static _HandleParenthesisContent(e,t){let i;t=t||(e=>"true"===e);let r=e.split("||");for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e)){let a=s._SimplifyNegation(r[e].trim()),h=a.split("&&");if(h.length>1)for(let e=0;e<h.length;++e){let r=s._SimplifyNegation(h[e].trim());if(!(i="true"!==r&&"false"!==r?"!"===r[0]?!t(r.substring(1)):t(r):"true"===r)){a="false";break}}if(i||"true"===a){i=!0;break}i="true"!==a&&"false"!==a?"!"===a[0]?!t(a.substring(1)):t(a):"true"===a}return i?"true":"false"}static _SimplifyNegation(e){return"!true"===(e=(e=e.replace(/^[\s!]+/,e=>(e=e.replace(/[\s]/g,()=>"")).length%2?"!":"")).trim())?e="false":"!false"===e&&(e="true"),e}}class i{static EnableFor(e){e._tags=e._tags||{},e.hasTags=()=>i.HasTags(e),e.addTags=t=>i.AddTagsTo(e,t),e.removeTags=t=>i.RemoveTagsFrom(e,t),e.matchesTagsQuery=t=>i.MatchesQuery(e,t)}static DisableFor(e){delete e._tags,delete e.hasTags,delete e.addTags,delete e.removeTags,delete e.matchesTagsQuery}static HasTags(e){if(!e._tags)return!1;let t=e._tags;for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!0;return!1}static GetTags(e,t=!0){if(!e._tags)return null;if(!t)return e._tags;{let t=[];for(let s in e._tags)Object.prototype.hasOwnProperty.call(e._tags,s)&&!0===e._tags[s]&&t.push(s);return t.join(" ")}}static AddTagsTo(e,t){if(t&&"string"==typeof t)for(let s of t.split(" "))i._AddTagTo(e,s)}static _AddTagTo(e,t){""===(t=t.trim())||"true"===t||"false"===t||t.match(/[\s]/)||t.match(/^([!]|([|]|[&]){2})/)||(i.EnableFor(e),e._tags[t]=!0)}static RemoveTagsFrom(e,t){if(!i.HasTags(e))return;let s=t.split(" ");for(let t in s)i._RemoveTagFrom(e,s[t])}static _RemoveTagFrom(e,t){delete e._tags[t]}static MatchesQuery(e,t){return void 0===t||(""===t?i.HasTags(e):s.Eval(t,t=>i.HasTags(e)&&e._tags[t]))}}e.s(["Tags",0,i],76312);var r=e.i(70653),a=e.i(96265),h=e.i(94047);let n=function(e,t,s,r={}){let a=e();i&&i.HasTags(t)&&i.AddTagsTo(a,i.GetTags(t,!0));let n=(0,h.GetMergedStore)(a),o={};for(let e in n){let i=n[e],h=t[e],c=i.type;if(null!=h&&("uniqueId"!==e||l.AllowLoadingUniqueId))switch(c){case 0:case 6:case 9:case 11:"function"==typeof h.slice?a[e]=h.slice():a[e]=h;break;case 1:r.cloneTexturesOnlyOnce&&o[h.uniqueId]?a[e]=o[h.uniqueId]:(a[e]=s||h.isRenderTarget?h:h.clone(),o[h.uniqueId]=a[e]);break;case 2:case 3:case 4:case 5:case 7:case 8:case 10:case 12:a[e]=s?h:h.clone()}}return a};class l{static AppendSerializedAnimations(e,t){if(e.animations){t.animations=[];for(let s=0;s<e.animations.length;s++){let i=e.animations[s];t.animations.push(i.serialize())}}}static Serialize(e,t){t||(t={}),i&&(t.tags=i.GetTags(e));let s=(0,h.GetMergedStore)(e);for(let i in s){let r=s[i],a=r.sourceName||i,h=r.type,n=e[i];if(null!=n&&("uniqueId"!==i||l.AllowLoadingUniqueId))switch(h){case 0:Array.isArray(n)?t[a]=n.slice():t[a]=n;break;case 1:case 3:case 7:case 9:t[a]=n.serialize();break;case 2:case 4:case 5:case 8:case 10:case 12:t[a]=n.asArray();break;case 6:case 11:t[a]=n.id}}return t}static ParseProperties(e,t,s,i){i||(i="");let n=(0,h.GetMergedStore)(t);for(let h in n){let o=n[h],c=e[o.sourceName||h],u=o.type;if(null!=c&&("uniqueId"!==h||l.AllowLoadingUniqueId))switch(u){case 0:t[h]=c;break;case 1:s&&(t[h]=l._TextureParser(c,s,i));break;case 2:t[h]=r.Color3.FromArray(c);break;case 3:t[h]=l._FresnelParametersParser(c);break;case 4:t[h]=a.Vector2.FromArray(c);break;case 5:t[h]=a.Vector3.FromArray(c);break;case 6:s&&(t[h]=s.getLastMeshById(c));break;case 7:t[h]=l._ColorCurvesParser(c);break;case 8:t[h]=r.Color4.FromArray(c);break;case 9:t[h]=l._ImageProcessingConfigurationParser(c);break;case 10:t[h]=a.Quaternion.FromArray(c);break;case 11:s&&(t[h]=s.getCameraById(c));break;case 12:t[h]=a.Matrix.FromArray(c)}}}static Parse(e,t,s,r=null){let a=e();return i&&i.AddTagsTo(a,t.tags),l.ParseProperties(t,a,s,r),a}static Clone(e,t,s={}){return n(e,t,!1,s)}static Instanciate(e,t){return n(e,t,!0)}}l.AllowLoadingUniqueId=!1,l._ImageProcessingConfigurationParser=e=>{throw(0,t._WarnImport)("ImageProcessingConfiguration")},l._FresnelParametersParser=e=>{throw(0,t._WarnImport)("FresnelParameters")},l._ColorCurvesParser=e=>{throw(0,t._WarnImport)("ColorCurves")},l._TextureParser=(e,s,i)=>{throw(0,t._WarnImport)("Texture")},e.s(["SerializationHelper",0,l],80871)},55069,e=>{"use strict";var t=e.i(71379);let s=!1;e.s(["RegisterEngineDynamicBuffer",0,function(){s||(s=!0,t.ThinEngine.prototype.updateDynamicIndexBuffer=function(e,t,s=0){let i;this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER]=null,this.bindIndexBuffer(e),i=e.is32Bits?t instanceof Uint32Array?t:new Uint32Array(t):t instanceof Uint16Array?t:new Uint16Array(t),this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,i,this._gl.DYNAMIC_DRAW),this._resetIndexBufferBinding()},t.ThinEngine.prototype.updateDynamicVertexBuffer=function(e,t,s,i){this.bindArrayBuffer(e),void 0===s&&(s=0);let r=t.byteLength||t.length;void 0===i||i>=r&&0===s?t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,s,new Float32Array(t)):this._gl.bufferSubData(this._gl.ARRAY_BUFFER,s,t):t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,s,new Float32Array(t).subarray(0,i/4)):(t=ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,i):new Uint8Array(t,0,i),this._gl.bufferSubData(this._gl.ARRAY_BUFFER,s,t)),this._resetVertexBufferBinding()})}])},67359,e=>{"use strict";var t=e.i(36395);class s{get min(){return this._min}get max(){return this._max}get average(){return this._average}get lastSecAverage(){return this._lastSecAverage}get current(){return this._current}get total(){return this._totalAccumulated}get count(){return this._totalValueCount}constructor(){this._startMonitoringTime=0,this._min=0,this._max=0,this._average=0,this._lastSecAverage=0,this._current=0,this._totalValueCount=0,this._totalAccumulated=0,this._lastSecAccumulated=0,this._lastSecTime=0,this._lastSecValueCount=0}fetchNewFrame(){this._totalValueCount++,this._current=0,this._lastSecValueCount++}addCount(e,t){s.Enabled&&(this._current+=e,t&&this._fetchResult())}beginMonitoring(){s.Enabled&&(this._startMonitoringTime=t.PrecisionDate.Now)}endMonitoring(e=!0){if(!s.Enabled)return;e&&this.fetchNewFrame();let i=t.PrecisionDate.Now;this._current=i-this._startMonitoringTime,e&&this._fetchResult()}endFrame(){this._fetchResult()}_fetchResult(){this._totalAccumulated+=this._current,this._lastSecAccumulated+=this._current,this._min=Math.min(this._min,this._current),this._max=Math.max(this._max,this._current),this._average=this._totalAccumulated/this._totalValueCount;let e=t.PrecisionDate.Now;e-this._lastSecTime>1e3&&(this._lastSecAverage=this._lastSecAccumulated/this._lastSecValueCount,this._lastSecTime=e,this._lastSecAccumulated=0,this._lastSecValueCount=0)}}s.Enabled=!0,e.s(["PerfCounter",0,s])},54361,e=>{"use strict";class t{constructor(e,t){this.width=e,this.height=t}toString(){return`{W: ${this.width}, H: ${this.height}}`}getClassName(){return"Size"}getHashCode(){let e=0|this.width;return 397*e^this.height}copyFrom(e){this.width=e.width,this.height=e.height}copyFromFloats(e,t){return this.width=e,this.height=t,this}set(e,t){return this.copyFromFloats(e,t)}multiplyByFloats(e,s){return new t(this.width*e,this.height*s)}clone(){return new t(this.width,this.height)}equals(e){return!!e&&this.width===e.width&&this.height===e.height}get surface(){return this.width*this.height}static Zero(){return new t(0,0)}add(e){return new t(this.width+e.width,this.height+e.height)}subtract(e){return new t(this.width-e.width,this.height-e.height)}scale(e){return new t(this.width*e,this.height*e)}static Lerp(e,s,i){return new t(e.width+(s.width-e.width)*i,e.height+(s.height-e.height)*i)}}e.s(["Size",0,t])},52153,e=>{"use strict";var t,s=e.i(10272),i=e.i(37143),r=e.i(99267),a=e.i(96265),h=e.i(81623),n=e.i(84768),l=e.i(54361);class o{get wrapU(){return this._wrapU}set wrapU(e){this._wrapU=e}get wrapV(){return this._wrapV}set wrapV(e){this._wrapV=e}get coordinatesMode(){return 0}get isCube(){return!!this._texture&&this._texture.isCube}set isCube(e){this._texture&&(this._texture.isCube=e)}get is3D(){return!!this._texture&&this._texture.is3D}set is3D(e){this._texture&&(this._texture.is3D=e)}get is2DArray(){return!!this._texture&&this._texture.is2DArray}set is2DArray(e){this._texture&&(this._texture.is2DArray=e)}getClassName(){return"ThinTexture"}static _IsRenderTargetWrapper(e){return e?.shareDepth!==void 0}constructor(e){this._wrapU=1,this._wrapV=1,this.wrapR=1,this.anisotropicFilteringLevel=4,this.delayLoadState=0,this._texture=null,this._engine=null,this._cachedSize=l.Size.Zero(),this._cachedBaseSize=l.Size.Zero(),this._initialSamplingMode=2,this._texture=o._IsRenderTargetWrapper(e)?e.texture:e,this._texture&&(this._engine=this._texture.getEngine(),this.wrapU=this._texture._cachedWrapU??this.wrapU,this.wrapV=this._texture._cachedWrapV??this.wrapV,this.wrapR=this._texture._cachedWrapR??this.wrapR)}isReady(){return 4===this.delayLoadState?(this.delayLoad(),!1):!!this._texture&&this._texture.isReady}delayLoad(){}getInternalTexture(){return this._texture}getSize(){if(this._texture){if(this._texture.width)return this._cachedSize.width=this._texture.width,this._cachedSize.height=this._texture.height,this._cachedSize;this._texture._size&&(this._cachedSize.width=this._texture._size,this._cachedSize.height=this._texture._size)}return this._cachedSize}getBaseSize(){return this.isReady()&&this._texture?this._texture._size?(this._cachedBaseSize.width=this._texture._size,this._cachedBaseSize.height=this._texture._size):(this._cachedBaseSize.width=this._texture.baseWidth,this._cachedBaseSize.height=this._texture.baseHeight):(this._cachedBaseSize.width=0,this._cachedBaseSize.height=0),this._cachedBaseSize}get samplingMode(){return this._texture?this._texture.samplingMode:this._initialSamplingMode}updateSamplingMode(e,t=!1){this._texture&&this._engine&&this._engine.updateTextureSamplingMode(e,this._texture,this._texture.generateMipMaps&&t)}releaseInternalTexture(){this._texture&&(this._texture.dispose(),this._texture=null)}dispose(){this._texture&&(this.releaseInternalTexture(),this._engine=null)}}var c=e.i(80871),u=e.i(75405);class _ extends o{set hasAlpha(e){this._hasAlpha!==e&&(this._hasAlpha=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)))}get hasAlpha(){return this._hasAlpha}set getAlphaFromRGB(e){this._getAlphaFromRGB!==e&&(this._getAlphaFromRGB=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)))}get getAlphaFromRGB(){return this._getAlphaFromRGB}set coordinatesIndex(e){this._coordinatesIndex!==e&&(this._coordinatesIndex=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)))}get coordinatesIndex(){return this._coordinatesIndex}set coordinatesMode(e){this._coordinatesMode!==e&&(this._coordinatesMode=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)))}get coordinatesMode(){return this._coordinatesMode}get wrapU(){return this._wrapU}set wrapU(e){this._wrapU=e}get wrapV(){return this._wrapV}set wrapV(e){this._wrapV=e}get isCube(){return this._texture?this._texture.isCube:this._isCube}set isCube(e){this._texture?this._texture.isCube=e:this._isCube=e}get is3D(){return!!this._texture&&this._texture.is3D}set is3D(e){this._texture&&(this._texture.is3D=e)}get is2DArray(){return!!this._texture&&this._texture.is2DArray}set is2DArray(e){this._texture&&(this._texture.is2DArray=e)}get gammaSpace(){return this._texture?(null===this._texture._gammaSpace&&(this._texture._gammaSpace=this._gammaSpace),this._texture._gammaSpace&&!this._texture._useSRGBBuffer):this._gammaSpace}set gammaSpace(e){if(this._texture){if(this._texture._gammaSpace===e)return;this._texture._gammaSpace=e}else{if(this._gammaSpace===e)return;this._gammaSpace=e}this.getScene()?.markAllMaterialsAsDirty(1,e=>e.hasTexture(this))}get isRGBD(){return null!=this._texture&&this._texture._isRGBD}set isRGBD(e){e!==this.isRGBD&&(this._texture&&(this._texture._isRGBD=e),this.getScene()?.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)))}get noMipmap(){return!1}get lodGenerationOffset(){return this._texture?this._texture._lodGenerationOffset:0}set lodGenerationOffset(e){this._texture&&(this._texture._lodGenerationOffset=e)}get lodGenerationScale(){return this._texture?this._texture._lodGenerationScale:0}set lodGenerationScale(e){this._texture&&(this._texture._lodGenerationScale=e)}get linearSpecularLOD(){return!!this._texture&&this._texture._linearSpecularLOD}set linearSpecularLOD(e){this._texture&&(this._texture._linearSpecularLOD=e)}get irradianceTexture(){return this._texture?this._texture._irradianceTexture:null}set irradianceTexture(e){this._texture&&(this._texture._irradianceTexture=e)}get uid(){return this._uid||(this._uid=(0,n.RandomGUID)()),this._uid}toString(){return this.name}getClassName(){return"BaseTexture"}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}get isBlocking(){return!0}get loadingError(){return this._loadingError}get errorObject(){return this._errorObject}constructor(e,t=null){super(null),this.metadata=null,this.reservedDataStore=null,this._hasAlpha=!1,this._getAlphaFromRGB=!1,this.level=1,this._coordinatesIndex=0,this.optimizeUVAllocation=!0,this._coordinatesMode=0,this.wrapR=1,this.anisotropicFilteringLevel=_.DEFAULT_ANISOTROPIC_FILTERING_LEVEL,this._isCube=!1,this._gammaSpace=!0,this.invertZ=!1,this.lodLevelInAlpha=!1,this._dominantDirection=null,this.isRenderTarget=!1,this._prefiltered=!1,this._forceSerialize=!1,this.animations=[],this.onDisposeObservable=new r.Observable,this._onDisposeObserver=null,this._scene=null,this._uid=null,this._parentContainer=null,this._loadingError=!1,e?_._IsScene(e)?this._scene=e:this._engine=e:this._scene=h.EngineStore.LastCreatedScene,this._scene&&(this.uniqueId=this._scene.getUniqueId(),this._scene.addTexture(this),this._engine=this._scene.getEngine()),this._texture=t,this._uid=null}getScene(){return this._scene}_getEngine(){return this._engine}getTextureMatrix(){return a.Matrix.IdentityReadOnly}getReflectionTextureMatrix(){return a.Matrix.IdentityReadOnly}getRefractionTextureMatrix(){return this.getReflectionTextureMatrix()}isReadyOrNotBlocking(){return!this.isBlocking||this.isReady()||this.loadingError}scale(e){}get canRescale(){return!1}_getFromCache(e,t,s,i,r,a){let h=this._getEngine();if(!h)return null;let n=h._getUseSRGBBuffer(!!r,t),l=h.getLoadedTexturesCache();for(let h=0;h<l.length;h++){let o=l[h];if((void 0===r||n===o._useSRGBBuffer)&&(void 0===i||i===o.invertY)&&o.url===e&&!t===o.generateMipMaps&&(!s||s===o.samplingMode)&&(void 0===a||a===o.isCube))return o.incrementReferences(),o}return null}_rebuild(e=!1){}clone(){return null}get textureType(){return this._texture&&void 0!==this._texture.type?this._texture.type:0}get textureFormat(){return this._texture&&void 0!==this._texture.format?this._texture.format:5}_markAllSubMeshesAsTexturesDirty(){let e=this.getScene();e&&e.markAllMaterialsAsDirty(1)}readPixels(e=0,t=0,s=null,i=!0,r=!1,a=0,h=0,n=Number.MAX_VALUE,l=Number.MAX_VALUE){if(!this._texture)return null;let o=this._getEngine();if(!o)return null;let c=this.getSize(),u=c.width,_=c.height;0!==t&&(u/=Math.pow(2,t),_/=Math.pow(2,t),u=Math.round(u),_=Math.round(_)),n=Math.min(u,n),l=Math.min(_,l);try{if(this._texture.isCube||this._texture.is2DArray)return o._readTexturePixels(this._texture,n,l,e,t,s,i,r,a,h);return o._readTexturePixels(this._texture,n,l,-1,t,s,i,r,a,h)}catch(e){return null}}_readPixelsSync(e=0,t=0,s=null,i=!0,r=!1){if(!this._texture)return null;let a=this.getSize(),h=a.width,n=a.height,l=this._getEngine();if(!l)return null;0!=t&&(h/=Math.pow(2,t),n/=Math.pow(2,t),h=Math.round(h),n=Math.round(n));try{if(this._texture.isCube)return l._readTexturePixelsSync(this._texture,h,n,e,t,s,i,r);return l._readTexturePixelsSync(this._texture,h,n,-1,t,s,i,r)}catch(e){return null}}get _lodTextureHigh(){return this._texture?this._texture._lodTextureHigh:null}get _lodTextureMid(){return this._texture?this._texture._lodTextureMid:null}get _lodTextureLow(){return this._texture?this._texture._lodTextureLow:null}dispose(){if(this._scene){this._scene.stopAnimation&&this._scene.stopAnimation(this),this._scene.removePendingData(this);let e=this._scene.textures.indexOf(this);if(e>=0&&this._scene.textures.splice(e,1),this._scene.onTextureRemovedObservable.notifyObservers(this),this._scene=null,this._parentContainer){let e=this._parentContainer.textures.indexOf(this);e>-1&&this._parentContainer.textures.splice(e,1),this._parentContainer=null}}this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.metadata=null,super.dispose()}serialize(e=!1){if(!this.name&&!e)return null;let t=c.SerializationHelper.Serialize(this);return c.SerializationHelper.AppendSerializedAnimations(this,t),t}static WhenAllReady(e,t){let s=e.length;if(0===s)return void t();for(let i=0;i<e.length;i++){let r=e[i];if(r.isReady())0==--s&&t();else{let e=r.onLoadObservable;e?e.addOnce(()=>{0==--s&&t()}):0==--s&&t()}}}static _IsScene(e){return"Scene"===e.getClassName()}}_.DEFAULT_ANISOTROPIC_FILTERING_LEVEL=4,(0,s.__decorate)([(0,i.serialize)()],_.prototype,"uniqueId",void 0),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"name",void 0),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"displayName",void 0),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"metadata",void 0),(0,s.__decorate)([(0,i.serialize)("hasAlpha")],_.prototype,"_hasAlpha",void 0),(0,s.__decorate)([(0,i.serialize)("getAlphaFromRGB")],_.prototype,"_getAlphaFromRGB",void 0),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"level",void 0),(0,s.__decorate)([(0,i.serialize)("coordinatesIndex")],_.prototype,"_coordinatesIndex",void 0),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"optimizeUVAllocation",void 0),(0,s.__decorate)([(0,i.serialize)("coordinatesMode")],_.prototype,"_coordinatesMode",void 0),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"wrapU",null),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"wrapV",null),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"wrapR",void 0),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"anisotropicFilteringLevel",void 0),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"isCube",null),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"is3D",null),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"is2DArray",null),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"gammaSpace",null),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"invertZ",void 0),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"lodLevelInAlpha",void 0),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"lodGenerationOffset",null),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"lodGenerationScale",null),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"linearSpecularLOD",null),(0,s.__decorate)([(0,i.serializeAsTexture)()],_.prototype,"irradianceTexture",null),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"isRenderTarget",void 0),(t=_.prototype).forceSphericalPolynomialsRecompute??(t.forceSphericalPolynomialsRecompute=(0,u._MissingSideEffect)("BaseTexture","forceSphericalPolynomialsRecompute")),Object.getOwnPropertyDescriptor(_.prototype,"sphericalPolynomial")||Object.defineProperty(_.prototype,"sphericalPolynomial",(0,u._MissingSideEffectProperty)("BaseTexture","sphericalPolynomial")),e.s(["BaseTexture",0,_],52153)},14953,e=>{"use strict";var t=e.i(96265);let s=[Math.sqrt(1/(4*Math.PI)),-Math.sqrt(3/(4*Math.PI)),Math.sqrt(3/(4*Math.PI)),-Math.sqrt(3/(4*Math.PI)),Math.sqrt(15/(4*Math.PI)),-Math.sqrt(15/(4*Math.PI)),Math.sqrt(5/(16*Math.PI)),-Math.sqrt(15/(4*Math.PI)),Math.sqrt(15/(16*Math.PI))],i=[()=>1,e=>e.y,e=>e.z,e=>e.x,e=>e.x*e.y,e=>e.y*e.z,e=>3*e.z*e.z-1,e=>e.x*e.z,e=>e.x*e.x-e.y*e.y],r=(e,t)=>s[e]*i[e](t),a=[Math.PI,2*Math.PI/3,2*Math.PI/3,2*Math.PI/3,Math.PI/4,Math.PI/4,Math.PI/4,Math.PI/4,Math.PI/4];class h{constructor(){this.preScaled=!1,this.l00=t.Vector3.Zero(),this.l1_1=t.Vector3.Zero(),this.l10=t.Vector3.Zero(),this.l11=t.Vector3.Zero(),this.l2_2=t.Vector3.Zero(),this.l2_1=t.Vector3.Zero(),this.l20=t.Vector3.Zero(),this.l21=t.Vector3.Zero(),this.l22=t.Vector3.Zero()}addLight(e,s,i){t.TmpVectors.Vector3[0].set(s.r,s.g,s.b);let a=t.TmpVectors.Vector3[0],h=t.TmpVectors.Vector3[1];a.scaleToRef(i,h),h.scaleToRef(r(0,e),t.TmpVectors.Vector3[2]),this.l00.addInPlace(t.TmpVectors.Vector3[2]),h.scaleToRef(r(1,e),t.TmpVectors.Vector3[2]),this.l1_1.addInPlace(t.TmpVectors.Vector3[2]),h.scaleToRef(r(2,e),t.TmpVectors.Vector3[2]),this.l10.addInPlace(t.TmpVectors.Vector3[2]),h.scaleToRef(r(3,e),t.TmpVectors.Vector3[2]),this.l11.addInPlace(t.TmpVectors.Vector3[2]),h.scaleToRef(r(4,e),t.TmpVectors.Vector3[2]),this.l2_2.addInPlace(t.TmpVectors.Vector3[2]),h.scaleToRef(r(5,e),t.TmpVectors.Vector3[2]),this.l2_1.addInPlace(t.TmpVectors.Vector3[2]),h.scaleToRef(r(6,e),t.TmpVectors.Vector3[2]),this.l20.addInPlace(t.TmpVectors.Vector3[2]),h.scaleToRef(r(7,e),t.TmpVectors.Vector3[2]),this.l21.addInPlace(t.TmpVectors.Vector3[2]),h.scaleToRef(r(8,e),t.TmpVectors.Vector3[2]),this.l22.addInPlace(t.TmpVectors.Vector3[2])}scaleInPlace(e){this.l00.scaleInPlace(e),this.l1_1.scaleInPlace(e),this.l10.scaleInPlace(e),this.l11.scaleInPlace(e),this.l2_2.scaleInPlace(e),this.l2_1.scaleInPlace(e),this.l20.scaleInPlace(e),this.l21.scaleInPlace(e),this.l22.scaleInPlace(e)}convertIncidentRadianceToIrradiance(){this.l00.scaleInPlace(a[0]),this.l1_1.scaleInPlace(a[1]),this.l10.scaleInPlace(a[2]),this.l11.scaleInPlace(a[3]),this.l2_2.scaleInPlace(a[4]),this.l2_1.scaleInPlace(a[5]),this.l20.scaleInPlace(a[6]),this.l21.scaleInPlace(a[7]),this.l22.scaleInPlace(a[8])}convertIrradianceToLambertianRadiance(){this.scaleInPlace(1/Math.PI)}preScaleForRendering(){this.preScaled=!0,this.l00.scaleInPlace(s[0]),this.l1_1.scaleInPlace(s[1]),this.l10.scaleInPlace(s[2]),this.l11.scaleInPlace(s[3]),this.l2_2.scaleInPlace(s[4]),this.l2_1.scaleInPlace(s[5]),this.l20.scaleInPlace(s[6]),this.l21.scaleInPlace(s[7]),this.l22.scaleInPlace(s[8])}updateFromArray(e){return t.Vector3.FromArrayToRef(e[0],0,this.l00),t.Vector3.FromArrayToRef(e[1],0,this.l1_1),t.Vector3.FromArrayToRef(e[2],0,this.l10),t.Vector3.FromArrayToRef(e[3],0,this.l11),t.Vector3.FromArrayToRef(e[4],0,this.l2_2),t.Vector3.FromArrayToRef(e[5],0,this.l2_1),t.Vector3.FromArrayToRef(e[6],0,this.l20),t.Vector3.FromArrayToRef(e[7],0,this.l21),t.Vector3.FromArrayToRef(e[8],0,this.l22),this}updateFromFloatsArray(e){return t.Vector3.FromFloatsToRef(e[0],e[1],e[2],this.l00),t.Vector3.FromFloatsToRef(e[3],e[4],e[5],this.l1_1),t.Vector3.FromFloatsToRef(e[6],e[7],e[8],this.l10),t.Vector3.FromFloatsToRef(e[9],e[10],e[11],this.l11),t.Vector3.FromFloatsToRef(e[12],e[13],e[14],this.l2_2),t.Vector3.FromFloatsToRef(e[15],e[16],e[17],this.l2_1),t.Vector3.FromFloatsToRef(e[18],e[19],e[20],this.l20),t.Vector3.FromFloatsToRef(e[21],e[22],e[23],this.l21),t.Vector3.FromFloatsToRef(e[24],e[25],e[26],this.l22),this}static FromArray(e){return new h().updateFromArray(e)}static FromPolynomial(e){let t=new h;return t.l00=e.xx.scale(.376127).add(e.yy.scale(.376127)).add(e.zz.scale(.376126)),t.l1_1=e.y.scale(.977204),t.l10=e.z.scale(.977204),t.l11=e.x.scale(.977204),t.l2_2=e.xy.scale(1.16538),t.l2_1=e.yz.scale(1.16538),t.l20=e.zz.scale(1.34567).subtract(e.xx.scale(.672834)).subtract(e.yy.scale(.672834)),t.l21=e.zx.scale(1.16538),t.l22=e.xx.scale(1.16538).subtract(e.yy.scale(1.16538)),t.l1_1.scaleInPlace(-1),t.l11.scaleInPlace(-1),t.l2_1.scaleInPlace(-1),t.l21.scaleInPlace(-1),t.scaleInPlace(Math.PI),t}}class n{constructor(){this.x=t.Vector3.Zero(),this.y=t.Vector3.Zero(),this.z=t.Vector3.Zero(),this.xx=t.Vector3.Zero(),this.yy=t.Vector3.Zero(),this.zz=t.Vector3.Zero(),this.xy=t.Vector3.Zero(),this.yz=t.Vector3.Zero(),this.zx=t.Vector3.Zero()}get preScaledHarmonics(){return this._harmonics||(this._harmonics=h.FromPolynomial(this)),this._harmonics.preScaled||this._harmonics.preScaleForRendering(),this._harmonics}addAmbient(e){t.TmpVectors.Vector3[0].copyFromFloats(e.r,e.g,e.b);let s=t.TmpVectors.Vector3[0];this.xx.addInPlace(s),this.yy.addInPlace(s),this.zz.addInPlace(s)}scaleInPlace(e){this.x.scaleInPlace(e),this.y.scaleInPlace(e),this.z.scaleInPlace(e),this.xx.scaleInPlace(e),this.yy.scaleInPlace(e),this.zz.scaleInPlace(e),this.yz.scaleInPlace(e),this.zx.scaleInPlace(e),this.xy.scaleInPlace(e)}updateFromHarmonics(e){return this._harmonics=e,this.x.copyFrom(e.l11),this.x.scaleInPlace(1.02333).scaleInPlace(-1),this.y.copyFrom(e.l1_1),this.y.scaleInPlace(1.02333).scaleInPlace(-1),this.z.copyFrom(e.l10),this.z.scaleInPlace(1.02333),this.xx.copyFrom(e.l00),t.TmpVectors.Vector3[0].copyFrom(e.l20).scaleInPlace(.247708),t.TmpVectors.Vector3[1].copyFrom(e.l22).scaleInPlace(.429043),this.xx.scaleInPlace(.886277).subtractInPlace(t.TmpVectors.Vector3[0]).addInPlace(t.TmpVectors.Vector3[1]),this.yy.copyFrom(e.l00),this.yy.scaleInPlace(.886277).subtractInPlace(t.TmpVectors.Vector3[0]).subtractInPlace(t.TmpVectors.Vector3[1]),this.zz.copyFrom(e.l00),t.TmpVectors.Vector3[0].copyFrom(e.l20).scaleInPlace(.495417),this.zz.scaleInPlace(.886277).addInPlace(t.TmpVectors.Vector3[0]),this.yz.copyFrom(e.l2_1),this.yz.scaleInPlace(.858086).scaleInPlace(-1),this.zx.copyFrom(e.l21),this.zx.scaleInPlace(.858086).scaleInPlace(-1),this.xy.copyFrom(e.l2_2),this.xy.scaleInPlace(.858086),this.scaleInPlace(1/Math.PI),this}static FromHarmonics(e){return new n().updateFromHarmonics(e)}static FromArray(e){let s=new n;return t.Vector3.FromArrayToRef(e[0],0,s.x),t.Vector3.FromArrayToRef(e[1],0,s.y),t.Vector3.FromArrayToRef(e[2],0,s.z),t.Vector3.FromArrayToRef(e[3],0,s.xx),t.Vector3.FromArrayToRef(e[4],0,s.yy),t.Vector3.FromArrayToRef(e[5],0,s.zz),t.Vector3.FromArrayToRef(e[6],0,s.yz),t.Vector3.FromArrayToRef(e[7],0,s.zx),t.Vector3.FromArrayToRef(e[8],0,s.xy),s}}e.s(["SphericalHarmonics",0,h,"SphericalPolynomial",0,n])},53730,e=>{"use strict";var t=e.i(13379);let s=new Map;function i(e,i){var r;r=e,s.delete(r)&&t.Logger.Warn(`Extension with the name '${e}' already exists`),s.set(e,i)}e.s(["_GetCompatibleTextureLoader",0,function(t,r){("image/ktx"===r||"image/ktx2"===r)&&(t=".ktx"),!s.has(t)&&(t.endsWith(".ies")&&i(".ies",async()=>await e.A(99491).then(e=>new e._IESTextureLoader)),t.endsWith(".dds")&&i(".dds",async()=>await e.A(74577).then(e=>new e._DDSTextureLoader)),t.endsWith(".basis")&&i(".basis",async()=>await e.A(90083).then(e=>new e._BasisTextureLoader)),t.endsWith(".env")&&i(".env",async()=>await e.A(30057).then(e=>new e._ENVTextureLoader)),t.endsWith(".hdr")&&i(".hdr",async()=>await e.A(31746).then(e=>new e._HDRTextureLoader)),(t.endsWith(".ktx")||t.endsWith(".ktx2"))&&(i(".ktx",async()=>await e.A(18798).then(e=>new e._KTXTextureLoader)),i(".ktx2",async()=>await e.A(18798).then(e=>new e._KTXTextureLoader))),t.endsWith(".tga")&&i(".tga",async()=>await e.A(28368).then(e=>new e._TGATextureLoader)),t.endsWith(".exr")&&i(".exr",async()=>await e.A(1671).then(e=>new e._ExrTextureLoader)));let a=s.get(t);return a?Promise.resolve(a(r)):null}])},98673,e=>{e.v(t=>Promise.all(["static/chunks/3218lp8l0a5g_.js"].map(t=>e.l(t))).then(()=>t(27054)))},99491,e=>{e.v(t=>Promise.all(["static/chunks/0o6ayai0s01js.js"].map(t=>e.l(t))).then(()=>t(14849)))},74577,e=>{e.v(t=>Promise.all(["static/chunks/2yph6f7khgqii.js"].map(t=>e.l(t))).then(()=>t(97991)))},90083,e=>{e.v(t=>Promise.all(["static/chunks/0cu-q5q3a7uf3.js","static/chunks/1zvc1tv--w8nn.js"].map(t=>e.l(t))).then(()=>t(26660)))},30057,e=>{e.v(t=>Promise.all(["static/chunks/0cu-q5q3a7uf3.js","static/chunks/2g5gecypj0rqe.js","static/chunks/123xxske5c9na.js","static/chunks/3nz-dh9d7cehk.js","static/chunks/3zskk1hxu3-_o.js"].map(t=>e.l(t))).then(()=>t(41342)))},31746,e=>{e.v(t=>Promise.all(["static/chunks/3be6s4_kn9q-o.js"].map(t=>e.l(t))).then(()=>t(85821)))},18798,e=>{e.v(t=>Promise.all(["static/chunks/0fskcfh9vbhtv.js","static/chunks/0cu-q5q3a7uf3.js"].map(t=>e.l(t))).then(()=>t(58046)))},28368,e=>{e.v(t=>Promise.all(["static/chunks/023axeoslq39i.js"].map(t=>e.l(t))).then(()=>t(75174)))},1671,e=>{e.v(t=>Promise.all(["static/chunks/1pdep2_c530sg.js","static/chunks/0cu-q5q3a7uf3.js"].map(t=>e.l(t))).then(()=>t(35851)))}]);
@@ -1,4 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,32550,e=>{"use strict";var t,i,r=e.i(10272),s=e.i(37143),a=e.i(45707),n=e.i(66749),o=e.i(70653),l=e.i(35407);class u{constructor(){this.previousWorldMatrices={},this.previousBones={}}static AddUniforms(e){e.push("previousWorld","previousViewProjection","mPreviousBones")}static AddSamplers(e){}bindForSubMesh(e,t,i,r,s){if(t.prePassRenderer&&t.prePassRenderer.enabled&&t.prePassRenderer.currentRTisSceneRT&&(-1!==t.prePassRenderer.getIndex(2)||-1!==t.prePassRenderer.getIndex(11))){this.previousWorldMatrices[i.uniqueId]||(this.previousWorldMatrices[i.uniqueId]=r.clone()),this.previousViewProjection||(this.previousViewProjection=t.getTransformMatrix().clone(),this.currentViewProjection=t.getTransformMatrix().clone());let s=t.getEngine();this.currentViewProjection.updateFlag!==t.getTransformMatrix().updateFlag?(this._lastUpdateFrameId=s.frameId,this.previousViewProjection.copyFrom(this.currentViewProjection),this.currentViewProjection.copyFrom(t.getTransformMatrix())):this._lastUpdateFrameId!==s.frameId&&(this._lastUpdateFrameId=s.frameId,this.previousViewProjection.copyFrom(this.currentViewProjection)),e.setMatrix("previousWorld",this.previousWorldMatrices[i.uniqueId]),e.setMatrix("previousViewProjection",this.previousViewProjection),this.previousWorldMatrices[i.uniqueId]=r.clone()}}}class h{constructor(e){if(this.VERTEXOUTPUT_INVARIANT=!1,this._keys=[],this._isDirty=!0,this._areLightsDirty=!0,this._areLightsDisposed=!1,this._areAttributesDirty=!0,this._areTexturesDirty=!0,this._areFresnelDirty=!0,this._areMiscDirty=!0,this._arePrePassDirty=!0,this._areImageProcessingDirty=!0,this._normals=!1,this._uvs=!1,this._needNormals=!1,this._needUVs=!1,this._externalProperties=e,e)for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&this._setDefaultValue(t)}get isDirty(){return this._isDirty}markAsProcessed(){this._isDirty=!1,this._areAttributesDirty=!1,this._areTexturesDirty=!1,this._areFresnelDirty=!1,this._areLightsDirty=!1,this._areLightsDisposed=!1,this._areMiscDirty=!1,this._arePrePassDirty=!1,this._areImageProcessingDirty=!1}markAsUnprocessed(){this._isDirty=!0}markAllAsDirty(){this._areTexturesDirty=!0,this._areAttributesDirty=!0,this._areLightsDirty=!0,this._areFresnelDirty=!0,this._areMiscDirty=!0,this._arePrePassDirty=!0,this._areImageProcessingDirty=!0,this._isDirty=!0}markAsImageProcessingDirty(){this._areImageProcessingDirty=!0,this._isDirty=!0}markAsLightDirty(e=!1){this._areLightsDirty=!0,this._areLightsDisposed=this._areLightsDisposed||e,this._isDirty=!0}markAsAttributesDirty(){this._areAttributesDirty=!0,this._isDirty=!0}markAsTexturesDirty(){this._areTexturesDirty=!0,this._isDirty=!0}markAsFresnelDirty(){this._areFresnelDirty=!0,this._isDirty=!0}markAsMiscDirty(){this._areMiscDirty=!0,this._isDirty=!0}markAsPrePassDirty(){this._arePrePassDirty=!0,this._isDirty=!0}rebuild(){for(let e of(this._keys.length=0,Object.keys(this)))"_"!==e[0]&&this._keys.push(e);if(this._externalProperties)for(let e in this._externalProperties)-1===this._keys.indexOf(e)&&this._keys.push(e)}isEqual(e){if(this._keys.length!==e._keys.length)return!1;for(let t=0;t<this._keys.length;t++){let i=this._keys[t];if(this[i]!==e[i])return!1}return!0}cloneTo(e){this._keys.length!==e._keys.length&&(e._keys=this._keys.slice(0));for(let t=0;t<this._keys.length;t++){let i=this._keys[t];e[i]=this[i]}}reset(){for(let e of this._keys)this._setDefaultValue(e)}_setDefaultValue(e){let t=this._externalProperties?.[e]?.type??typeof this[e],i=this._externalProperties?.[e]?.default;switch(t){case"number":this[e]=i??0;break;case"string":this[e]=i??"";break;default:this[e]=i??!1}}toString(){let e="";for(let t=0;t<this._keys.length;t++){let i=this._keys[t],r=this[i];switch(typeof r){case"number":case"string":e+="#define "+i+" "+r+"\n";break;default:r&&(e+="#define "+i+"\n")}}return e}}function d(e){return class extends e{constructor(){super(...arguments),this.IMAGEPROCESSING=!1,this.VIGNETTE=!1,this.VIGNETTEBLENDMODEMULTIPLY=!1,this.VIGNETTEBLENDMODEOPAQUE=!1,this.TONEMAPPING=0,this.CONTRAST=!1,this.COLORCURVES=!1,this.COLORGRADING=!1,this.COLORGRADING3D=!1,this.SAMPLER3DGREENDEPTH=!1,this.SAMPLER3DBGRMAP=!1,this.DITHER=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.EXPOSURE=!1}}}var _=e.i(46862),p=e.i(23507),c=e.i(22369),f=e.i(33457),T=e.i(31278),m=e.i(74596),E=e.i(12423);let g=RegExp("^([gimus]+)!");class P{constructor(e){this._plugins=[],this._activePlugins=[],this._activePluginsForExtraEvents=[],this._material=e,this._scene=e.getScene(),this._engine=this._scene.getEngine()}_addPlugin(e){for(let t=0;t<this._plugins.length;++t)if(this._plugins[t].name===e.name)return!1;if(this._material._uniformBufferLayoutBuilt&&(this._material.resetDrawCache(),this._material._createUniformBuffer()),!e.isCompatible(this._material.shaderLanguage))throw`The plugin "${e.name}" can't be added to the material "${this._material.name}" because the plugin is not compatible with the shader language of the material.`;let t=e.getClassName();P._MaterialPluginClassToMainDefine[t]||(P._MaterialPluginClassToMainDefine[t]="MATERIALPLUGIN_"+ ++P._MaterialPluginCounter),this._material._callbackPluginEventGeneric=(e,t)=>this._handlePluginEvent(e,t),this._plugins.push(e),this._plugins.sort((e,t)=>e.priority-t.priority),this._codeInjectionPoints={};let i={};for(let e of(i[P._MaterialPluginClassToMainDefine[t]]={type:"boolean",default:!0},this._plugins))e.collectDefines(i),this._collectPointNames("vertex",e.getCustomCode("vertex",this._material.shaderLanguage)),this._collectPointNames("fragment",e.getCustomCode("fragment",this._material.shaderLanguage));return this._defineNamesFromPlugins=i,!0}_activatePlugin(e){-1===this._activePlugins.indexOf(e)&&(this._activePlugins.push(e),this._activePlugins.sort((e,t)=>e.priority-t.priority),this._material._callbackPluginEventIsReadyForSubMesh=this._handlePluginEventIsReadyForSubMesh.bind(this),this._material._callbackPluginEventPrepareDefinesBeforeAttributes=this._handlePluginEventPrepareDefinesBeforeAttributes.bind(this),this._material._callbackPluginEventPrepareDefines=this._handlePluginEventPrepareDefines.bind(this),this._material._callbackPluginEventBindForSubMesh=this._handlePluginEventBindForSubMesh.bind(this),e.registerForExtraEvents&&(this._activePluginsForExtraEvents.push(e),this._activePluginsForExtraEvents.sort((e,t)=>e.priority-t.priority),this._material._callbackPluginEventHasRenderTargetTextures=this._handlePluginEventHasRenderTargetTextures.bind(this),this._material._callbackPluginEventFillRenderTargetTextures=this._handlePluginEventFillRenderTargetTextures.bind(this),this._material._callbackPluginEventHardBindForSubMesh=this._handlePluginEventHardBindForSubMesh.bind(this)))}getPlugin(e){for(let t=0;t<this._plugins.length;++t)if(this._plugins[t].name===e)return this._plugins[t];return null}_handlePluginEventIsReadyForSubMesh(e){let t=!0;for(let i of this._activePlugins)t=t&&i.isReadyForSubMesh(e.defines,this._scene,this._engine,e.subMesh);e.isReadyForSubMesh=t}_handlePluginEventPrepareDefinesBeforeAttributes(e){for(let t of this._activePlugins)t.prepareDefinesBeforeAttributes(e.defines,this._scene,e.mesh)}_handlePluginEventPrepareDefines(e){for(let t of this._activePlugins)t.prepareDefines(e.defines,this._scene,e.mesh)}_handlePluginEventHardBindForSubMesh(e){for(let t of this._activePluginsForExtraEvents)t.hardBindForSubMesh(this._material._uniformBuffer,this._scene,this._engine,e.subMesh)}_handlePluginEventBindForSubMesh(e){for(let t of this._activePlugins)t.bindForSubMesh(this._material._uniformBuffer,this._scene,this._engine,e.subMesh)}_handlePluginEventHasRenderTargetTextures(e){let t=!1;for(let e of this._activePluginsForExtraEvents)if(t=e.hasRenderTargetTextures())break;e.hasRenderTargetTextures=t}_handlePluginEventFillRenderTargetTextures(e){for(let t of this._activePluginsForExtraEvents)t.fillRenderTargetTextures(e.renderTargets)}_handlePluginEvent(e,t){switch(e){case 512:for(let e of this._activePlugins)e.getActiveTextures(t.activeTextures);break;case 256:for(let e of this._activePlugins)e.getAnimatables(t.animatables);break;case 1024:{let e=!1;for(let i of this._activePlugins)if(e=i.hasTexture(t.texture))break;t.hasTexture=e;break}case 2:for(let e of this._plugins)e.dispose(t.forceDisposeTextures);break;case 4:t.defineNames=this._defineNamesFromPlugins;break;case 128:for(let e of this._activePlugins)t.fallbackRank=e.addFallbacks(t.defines,t.fallbacks,t.fallbackRank),e.getAttributes(t.attributes,this._scene,t.mesh);this._uniformList.length>0&&t.uniforms.push(...this._uniformList),this._samplerList.length>0&&t.samplers.push(...this._samplerList),this._uboList.length>0&&t.uniformBuffersNames.push(...this._uboList),t.customCode=this._injectCustomCode(t,t.customCode);break;case 8:{this._uboDeclaration="",this._vertexDeclaration="",this._fragmentDeclaration="",this._uniformList=[],this._samplerList=[],this._uboList=[];let e=1===this._material.shaderLanguage;for(let i of this._plugins){let r=i.getUniforms(this._material.shaderLanguage);if(r){if(r.ubo)for(let i of r.ubo){if(i.size&&i.type){let r=i.arraySize??0;if(t.ubo.addUniform(i.name,i.size,r),e){let e;switch(i.type){case"mat4":e="mat4x4f";break;case"float":e="f32";break;default:e=`${i.type}f`}r>0?this._uboDeclaration+=`uniform ${i.name}: array<${e}, ${r}>;
2
- `:this._uboDeclaration+=`uniform ${i.name}: ${e};
3
- `}else this._uboDeclaration+=`${i.type} ${i.name}${r>0?`[${r}]`:""};
4
- `}this._uniformList.push(i.name)}r.vertex&&(this._vertexDeclaration+=r.vertex+"\n"),r.fragment&&(this._fragmentDeclaration+=r.fragment+"\n"),r.externalUniforms&&this._uniformList.push(...r.externalUniforms)}i.getSamplers(this._samplerList),i.getUniformBuffersNames(this._uboList)}}}}_collectPointNames(e,t){if(t)for(let i in t)this._codeInjectionPoints[e]||(this._codeInjectionPoints[e]={}),this._codeInjectionPoints[e][i]=!0}_injectCustomCode(e,t){return(i,r)=>{t&&(r=t(i,r)),this._uboDeclaration&&(r=r.replace("#define ADDITIONAL_UBO_DECLARATION",this._uboDeclaration)),this._vertexDeclaration&&(r=r.replace("#define ADDITIONAL_VERTEX_DECLARATION",this._vertexDeclaration)),this._fragmentDeclaration&&(r=r.replace("#define ADDITIONAL_FRAGMENT_DECLARATION",this._fragmentDeclaration));let s=this._codeInjectionPoints?.[i];if(!s)return r;let a=null;for(let t in s){let s="";for(let r of this._activePlugins){let n=this._material.shaderLanguage,o=r.getCustomCode(i,n)?.[t];o&&(r.resolveIncludes&&(null===a&&(a={defines:[],indexParameters:e.indexParameters,isFragment:!1,shouldUseHighPrecisionShader:this._engine._shouldUseHighPrecisionShader,processor:void 0,supportsUniformBuffers:this._engine.supportsUniformBuffers,shadersRepository:E.ShaderStore.GetShadersRepository(n),includesShadersStore:E.ShaderStore.GetIncludesShadersStore(n),version:void 0,platformName:this._engine.shaderPlatformName,processingContext:void 0,isNDCHalfZRange:this._engine.isNDCHalfZRange,useReverseDepthBuffer:this._engine.useReverseDepthBuffer,processCodeAfterIncludes:void 0}),a.isFragment="fragment"===i,(0,m.ProcessIncludes)(o,a,e=>o=e)),s+=o+"\n")}if(s.length>0)if("!"===t.charAt(0)){t=t.substring(1);let e="g";if("!"===t.charAt(0))e="",t=t.substring(1);else{let i=g.exec(t);i&&i.length>=2&&(e=i[1],t=t.substring(e.length+1))}0>e.indexOf("g")&&(e+="g");let i=r,a=new RegExp(t,e),n=a.exec(i);for(;null!==n;){let e=s;for(let t=0;t<n.length;++t)e=e.replace("$"+t,n[t]);r=r.replace(n[0],e),n=a.exec(i)}}else{let e="#define "+t;r=r.replace(e,"\n"+s+"\n"+e)}}return r}}}P._MaterialPluginClassToMainDefine={},P._MaterialPluginCounter=0;var A=e.i(80871);class x{isCompatible(e){return 0===e}_enable(e){e&&this._pluginManager._activatePlugin(this)}constructor(e,t,i,r,s=!0,a=!1,n=!1){this.priority=500,this.resolveIncludes=!1,this.registerForExtraEvents=!1,this.doNotSerialize=!1,this._material=e,this.name=t,this.priority=i,this.resolveIncludes=n,e.pluginManager||(e.pluginManager=new P(e),e.onDisposeObservable.add(()=>{e.pluginManager=void 0})),this._pluginDefineNames=r,this._pluginManager=e.pluginManager,s&&this._pluginManager._addPlugin(this),a&&this._enable(!0),this.markAllDefinesAsDirty=e._dirtyCallbacks[127]}getClassName(){return"MaterialPluginBase"}isReadyForSubMesh(e,t,i,r){return!0}hardBindForSubMesh(e,t,i,r){}bindForSubMesh(e,t,i,r){}dispose(e){}getCustomCode(e,t=0){return null}collectDefines(e){if(this._pluginDefineNames)for(let t of Object.keys(this._pluginDefineNames)){if("_"===t[0])continue;let i=typeof this._pluginDefineNames[t];e[t]={type:"number"===i?"number":"string"===i?"string":"boolean"===i?"boolean":"object",default:this._pluginDefineNames[t]}}}prepareDefinesBeforeAttributes(e,t,i){}prepareDefines(e,t,i){}hasTexture(e){return!1}hasRenderTargetTextures(){return!1}fillRenderTargetTextures(e){}getActiveTextures(e){}getAnimatables(e){}addFallbacks(e,t,i){return i}getSamplers(e){}getAttributes(e,t,i){}getUniformBuffersNames(e){}getUniforms(e=0){return{}}copyTo(e){A.SerializationHelper.Clone(()=>e,this)}serialize(){return A.SerializationHelper.Serialize(this)}parse(e,t,i){A.SerializationHelper.Parse(()=>this,e,t,i)}}(0,r.__decorate)([(0,s.serialize)()],x.prototype,"name",void 0),(0,r.__decorate)([(0,s.serialize)()],x.prototype,"priority",void 0),(0,r.__decorate)([(0,s.serialize)()],x.prototype,"resolveIncludes",void 0),(0,r.__decorate)([(0,s.serialize)()],x.prototype,"registerForExtraEvents",void 0);var S=e.i(97001);class R extends h{constructor(){super(...arguments),this.DETAIL=!1,this.DETAILDIRECTUV=0,this.DETAIL_NORMALBLENDMETHOD=0}}class I extends x{_markAllSubMeshesAsTexturesDirty(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()}isCompatible(){return!0}constructor(e,t=!0){super(e,"DetailMap",140,new R,t),this._texture=null,this.diffuseBlendLevel=1,this.roughnessBlendLevel=1,this.bumpLevel=1,this._normalBlendMethod=p.Material.MATERIAL_NORMALBLENDMETHOD_WHITEOUT,this._isEnabled=!1,this.isEnabled=!1,this._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[1]}isReadyForSubMesh(e,t,i){return!this._isEnabled||!e._areTexturesDirty||!t.texturesEnabled||!i.getCaps().standardDerivatives||!this._texture||!f.MaterialFlags.DetailTextureEnabled||!!this._texture.isReady()}prepareDefines(e,t){if(this._isEnabled){e.DETAIL_NORMALBLENDMETHOD=this._normalBlendMethod;let i=t.getEngine();e._areTexturesDirty&&(i.getCaps().standardDerivatives&&this._texture&&f.MaterialFlags.DetailTextureEnabled&&this._isEnabled?((0,S.PrepareDefinesForMergedUV)(this._texture,e,"DETAIL"),e.DETAIL_NORMALBLENDMETHOD=this._normalBlendMethod):e.DETAIL=!1)}else e.DETAIL=!1}bindForSubMesh(e,t){if(!this._isEnabled)return;let i=this._material.isFrozen;e.useUbo&&i&&e.isSync||!this._texture||!f.MaterialFlags.DetailTextureEnabled||(e.updateFloat4("vDetailInfos",this._texture.coordinatesIndex,this.diffuseBlendLevel,this.bumpLevel,this.roughnessBlendLevel),(0,S.BindTextureMatrix)(this._texture,e,"detail")),t.texturesEnabled&&this._texture&&f.MaterialFlags.DetailTextureEnabled&&e.setTexture("detailSampler",this._texture)}hasTexture(e){return this._texture===e}getActiveTextures(e){this._texture&&e.push(this._texture)}getAnimatables(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture)}dispose(e){e&&this._texture?.dispose()}getClassName(){return"DetailMapConfiguration"}getSamplers(e){e.push("detailSampler")}getUniforms(){return{ubo:[{name:"vDetailInfos",size:4,type:"vec4"},{name:"detailMatrix",size:16,type:"mat4"}]}}}(0,r.__decorate)([(0,s.serializeAsTexture)("detailTexture"),(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],I.prototype,"texture",void 0),(0,r.__decorate)([(0,s.serialize)()],I.prototype,"diffuseBlendLevel",void 0),(0,r.__decorate)([(0,s.serialize)()],I.prototype,"roughnessBlendLevel",void 0),(0,r.__decorate)([(0,s.serialize)()],I.prototype,"bumpLevel",void 0),(0,r.__decorate)([(0,s.serialize)(),(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],I.prototype,"normalBlendMethod",void 0),(0,r.__decorate)([(0,s.serialize)(),(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],I.prototype,"isEnabled",void 0);var b=e.i(92040),v=e.i(12033),C=e.i(96265);(t=i||(i={}))[t.Zero=0]="Zero",t[t.One=1]="One",t[t.MaxViewZ=2]="MaxViewZ",t[t.NoClear=3]="NoClear";class M{static CreateConfiguration(e){return M._Configurations[e]={defines:{},previousWorldMatrices:{},previousViewProjection:C.Matrix.Zero(),currentViewProjection:C.Matrix.Zero(),previousBones:{},lastUpdateFrameId:-1,excludedSkinnedMesh:[],reverseCulling:!1},M._Configurations[e]}static DeleteConfiguration(e){delete M._Configurations[e]}static GetConfiguration(e){return M._Configurations[e]}static AddUniformsAndSamplers(e,t){e.push("previousWorld","previousViewProjection","mPreviousBones")}static MarkAsDirty(e,t){for(let i of t)if(i.subMeshes)for(let t of i.subMeshes)t._removeDrawWrapper(e)}static PrepareDefines(e,t,i){if(!i._arePrePassDirty)return;let r=M._Configurations[e];if(!r)return;i.PREPASS=!0;let s=0;for(let e=0;e<M.GeometryTextureDescriptions.length;e++){let t=M.GeometryTextureDescriptions[e],a=t.define,n=t.defineIndex,o=r.defines[n];void 0!==o?(i[a]=!0,i[n]=o,s++):(i[a]=!1,delete i[n])}i.SCENE_MRT_COUNT=s,i.BONES_VELOCITY_ENABLED=t.useBones&&t.computeBonesUsingShaders&&t.skeleton&&!t.skeleton.isUsingTextureForMatrices&&-1===r.excludedSkinnedMesh.indexOf(t)}static Bind(e,t,i,r,s){let a=M._Configurations[e];if(!a)return;let n=i.getScene(),o=n.getEngine();if(a.reverseCulling&&o.setStateCullFaceType(n._mirroredCameraPosition?s.cullBackFaces:!s.cullBackFaces),(void 0!==a.defines.PREPASS_VELOCITY_INDEX||void 0!==a.defines.PREPASS_VELOCITY_LINEAR_INDEX)&&(a.previousWorldMatrices[i.uniqueId]||(a.previousWorldMatrices[i.uniqueId]=r.clone()),a.previousViewProjection||(a.previousViewProjection=n.getTransformMatrix().clone(),a.currentViewProjection=n.getTransformMatrix().clone()),a.currentViewProjection.updateFlag!==n.getTransformMatrix().updateFlag?(a.lastUpdateFrameId=o.frameId,a.previousViewProjection.copyFrom(a.currentViewProjection),a.currentViewProjection.copyFrom(n.getTransformMatrix())):a.lastUpdateFrameId!==o.frameId&&(a.lastUpdateFrameId=o.frameId,a.previousViewProjection.copyFrom(a.currentViewProjection)),t.setMatrix("previousWorld",a.previousWorldMatrices[i.uniqueId]),t.setMatrix("previousViewProjection",a.previousViewProjection),a.previousWorldMatrices[i.uniqueId]=r.clone(),i.useBones&&i.computeBonesUsingShaders&&i.skeleton)){let e=i.skeleton;if(!e.isUsingTextureForMatrices||-1===t.getUniformIndex("boneTextureInfo")){let r=e.getTransformMatrices(i);r&&(a.previousBones[i.uniqueId]||(a.previousBones[i.uniqueId]=r.slice()),t.setMatrices("mPreviousBones",a.previousBones[i.uniqueId]),a.previousBones[i.uniqueId].set(r))}}}}function L(e){return class extends e{constructor(){super(...arguments),this.MAINUV1=!1,this.MAINUV2=!1,this.MAINUV3=!1,this.MAINUV4=!1,this.MAINUV5=!1,this.MAINUV6=!1,this.UV1=!1,this.UV2=!1,this.UV3=!1,this.UV4=!1,this.UV5=!1,this.UV6=!1}}}function y(e){return class extends e{constructor(){super(...arguments),this.PREPASS=!1,this.PREPASS_COLOR=!1,this.PREPASS_COLOR_INDEX=-1,this.PREPASS_IRRADIANCE_LEGACY=!1,this.PREPASS_IRRADIANCE_LEGACY_INDEX=-1,this.PREPASS_IRRADIANCE=!1,this.PREPASS_IRRADIANCE_INDEX=-1,this.PREPASS_ALBEDO=!1,this.PREPASS_ALBEDO_INDEX=-1,this.PREPASS_ALBEDO_SQRT=!1,this.PREPASS_ALBEDO_SQRT_INDEX=-1,this.PREPASS_DEPTH=!1,this.PREPASS_DEPTH_INDEX=-1,this.PREPASS_SCREENSPACE_DEPTH=!1,this.PREPASS_SCREENSPACE_DEPTH_INDEX=-1,this.PREPASS_NORMALIZED_VIEW_DEPTH=!1,this.PREPASS_NORMALIZED_VIEW_DEPTH_INDEX=-1,this.PREPASS_NORMAL=!1,this.PREPASS_NORMAL_INDEX=-1,this.PREPASS_NORMAL_WORLDSPACE=!1,this.PREPASS_WORLD_NORMAL=!1,this.PREPASS_WORLD_NORMAL_INDEX=-1,this.PREPASS_POSITION=!1,this.PREPASS_POSITION_INDEX=-1,this.PREPASS_LOCAL_POSITION=!1,this.PREPASS_LOCAL_POSITION_INDEX=-1,this.PREPASS_VELOCITY=!1,this.PREPASS_VELOCITY_INDEX=-1,this.PREPASS_VELOCITY_LINEAR=!1,this.PREPASS_VELOCITY_LINEAR_INDEX=-1,this.PREPASS_REFLECTIVITY=!1,this.PREPASS_REFLECTIVITY_INDEX=-1,this.SCENE_MRT_COUNT=0}}}function D(e){return class extends e{constructor(...e){super(...e),(0,s.serializeAsImageProcessingConfiguration)()(this,"_imageProcessingConfiguration")}get imageProcessingConfiguration(){return this._imageProcessingConfiguration}set imageProcessingConfiguration(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsImageProcessingDirty&&this._markAllSubMeshesAsImageProcessingDirty()}_attachImageProcessingConfiguration(e){e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),!e&&this.getScene?this._imageProcessingConfiguration=this.getScene().imageProcessingConfiguration:e&&(this._imageProcessingConfiguration=e),this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add(()=>{this._markAllSubMeshesAsImageProcessingDirty&&this._markAllSubMeshesAsImageProcessingDirty()})))}get cameraColorCurvesEnabled(){return this.imageProcessingConfiguration.colorCurvesEnabled}set cameraColorCurvesEnabled(e){this.imageProcessingConfiguration.colorCurvesEnabled=e}get cameraColorGradingEnabled(){return this.imageProcessingConfiguration.colorGradingEnabled}set cameraColorGradingEnabled(e){this.imageProcessingConfiguration.colorGradingEnabled=e}get cameraToneMappingEnabled(){return this._imageProcessingConfiguration.toneMappingEnabled}set cameraToneMappingEnabled(e){this._imageProcessingConfiguration.toneMappingEnabled=e}get cameraExposure(){return this._imageProcessingConfiguration.exposure}set cameraExposure(e){this._imageProcessingConfiguration.exposure=e}get cameraContrast(){return this._imageProcessingConfiguration.contrast}set cameraContrast(e){this._imageProcessingConfiguration.contrast=e}get cameraColorGradingTexture(){return this._imageProcessingConfiguration.colorGradingTexture}set cameraColorGradingTexture(e){this._imageProcessingConfiguration.colorGradingTexture=e}get cameraColorCurves(){return this._imageProcessingConfiguration.colorCurves}set cameraColorCurves(e){this._imageProcessingConfiguration.colorCurves=e}}}M.GeometryTextureDescriptions=[{type:0,name:"IrradianceLegacy",clearType:0,define:"PREPASS_IRRADIANCE_LEGACY",defineIndex:"PREPASS_IRRADIANCE_LEGACY_INDEX"},{type:1,name:"WorldPosition",clearType:0,define:"PREPASS_POSITION",defineIndex:"PREPASS_POSITION_INDEX"},{type:2,name:"Velocity",clearType:0,define:"PREPASS_VELOCITY",defineIndex:"PREPASS_VELOCITY_INDEX"},{type:3,name:"Reflectivity",clearType:0,define:"PREPASS_REFLECTIVITY",defineIndex:"PREPASS_REFLECTIVITY_INDEX"},{type:5,name:"ViewDepth",clearType:2,define:"PREPASS_DEPTH",defineIndex:"PREPASS_DEPTH_INDEX"},{type:6,name:"ViewNormal",clearType:0,define:"PREPASS_NORMAL",defineIndex:"PREPASS_NORMAL_INDEX"},{type:7,name:"AlbedoSqrt",clearType:0,define:"PREPASS_ALBEDO_SQRT",defineIndex:"PREPASS_ALBEDO_SQRT_INDEX"},{type:8,name:"WorldNormal",clearType:0,define:"PREPASS_WORLD_NORMAL",defineIndex:"PREPASS_WORLD_NORMAL_INDEX"},{type:9,name:"LocalPosition",clearType:0,define:"PREPASS_LOCAL_POSITION",defineIndex:"PREPASS_LOCAL_POSITION_INDEX"},{type:10,name:"ScreenDepth",clearType:1,define:"PREPASS_SCREENSPACE_DEPTH",defineIndex:"PREPASS_SCREENSPACE_DEPTH_INDEX"},{type:11,name:"LinearVelocity",clearType:0,define:"PREPASS_VELOCITY_LINEAR",defineIndex:"PREPASS_VELOCITY_LINEAR_INDEX"},{type:12,name:"Albedo",clearType:0,define:"PREPASS_ALBEDO",defineIndex:"PREPASS_ALBEDO_INDEX"},{type:13,name:"NormalizedViewDepth",clearType:1,define:"PREPASS_NORMALIZED_VIEW_DEPTH",defineIndex:"PREPASS_NORMALIZED_VIEW_DEPTH_INDEX"},{type:4,name:"Color",clearType:3,define:"PREPASS_COLOR",defineIndex:"PREPASS_COLOR_INDEX"},{type:14,name:"Irradiance",clearType:0,define:"PREPASS_IRRADIANCE",defineIndex:"PREPASS_IRRADIANCE_INDEX"}],M._Configurations={};var F=e.i(77052),N=e.i(75405);let O={effect:null,subMesh:null};class U extends y(L(h)){}class B extends d(U){constructor(e){super(e),this.DIFFUSE=!1,this.DIFFUSEDIRECTUV=0,this.BAKED_VERTEX_ANIMATION_TEXTURE=!1,this.AMBIENT=!1,this.AMBIENTDIRECTUV=0,this.OPACITY=!1,this.OPACITYDIRECTUV=0,this.OPACITYRGB=!1,this.REFLECTION=!1,this.EMISSIVE=!1,this.EMISSIVEDIRECTUV=0,this.SPECULAR=!1,this.SPECULARDIRECTUV=0,this.BUMP=!1,this.BUMPDIRECTUV=0,this.PARALLAX=!1,this.PARALLAX_RHS=!1,this.PARALLAXOCCLUSION=!1,this.SPECULAROVERALPHA=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.ALPHAFROMDIFFUSE=!1,this.POINTSIZE=!1,this.FOG=!1,this.SPECULARTERM=!1,this.DIFFUSEFRESNEL=!1,this.OPACITYFRESNEL=!1,this.REFLECTIONFRESNEL=!1,this.REFRACTIONFRESNEL=!1,this.EMISSIVEFRESNEL=!1,this.FRESNEL=!1,this.NORMAL=!1,this.TANGENT=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.BONETEXTURE=!1,this.BONES_VELOCITY_ENABLED=!1,this.INSTANCES=!1,this.THIN_INSTANCES=!1,this.INSTANCESCOLOR=!1,this.GLOSSINESS=!1,this.ROUGHNESS=!1,this.EMISSIVEASILLUMINATION=!1,this.LINKEMISSIVEWITHDIFFUSE=!1,this.REFLECTIONFRESNELFROMSPECULAR=!1,this.LIGHTMAP=!1,this.LIGHTMAPDIRECTUV=0,this.OBJECTSPACE_NORMALMAP=!1,this.USELIGHTMAPASSHADOWMAP=!1,this.REFLECTIONMAP_3D=!1,this.REFLECTIONMAP_SPHERICAL=!1,this.REFLECTIONMAP_PLANAR=!1,this.REFLECTIONMAP_CUBIC=!1,this.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,this.USE_LOCAL_REFRACTIONMAP_CUBIC=!1,this.REFLECTIONMAP_PROJECTION=!1,this.REFLECTIONMAP_SKYBOX=!1,this.REFLECTIONMAP_EXPLICIT=!1,this.REFLECTIONMAP_EQUIRECTANGULAR=!1,this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,this.REFLECTIONMAP_OPPOSITEZ=!1,this.INVERTCUBICMAP=!1,this.LOGARITHMICDEPTH=!1,this.REFRACTION=!1,this.REFRACTIONMAP_3D=!1,this.REFLECTIONOVERALPHA=!1,this.TWOSIDEDLIGHTING=!1,this.SHADOWFLOAT=!1,this.MORPHTARGETS=!1,this.MORPHTARGETS_POSITION=!1,this.MORPHTARGETS_NORMAL=!1,this.MORPHTARGETS_TANGENT=!1,this.MORPHTARGETS_UV=!1,this.MORPHTARGETS_UV2=!1,this.MORPHTARGETS_COLOR=!1,this.MORPHTARGETTEXTURE_HASPOSITIONS=!1,this.MORPHTARGETTEXTURE_HASNORMALS=!1,this.MORPHTARGETTEXTURE_HASTANGENTS=!1,this.MORPHTARGETTEXTURE_HASUVS=!1,this.MORPHTARGETTEXTURE_HASUV2S=!1,this.MORPHTARGETTEXTURE_HASCOLORS=!1,this.NUM_MORPH_INFLUENCERS=0,this.MORPHTARGETS_TEXTURE=!1,this.NONUNIFORMSCALING=!1,this.PREMULTIPLYALPHA=!1,this.ALPHATEST_AFTERALLALPHACOMPUTATIONS=!1,this.ALPHABLEND=!0,this.RGBDLIGHTMAP=!1,this.RGBDREFLECTION=!1,this.RGBDREFRACTION=!1,this.MULTIVIEW=!1,this.ORDER_INDEPENDENT_TRANSPARENCY=!1,this.ORDER_INDEPENDENT_TRANSPARENCY_16BITS=!1,this.CAMERA_ORTHOGRAPHIC=!1,this.CAMERA_PERSPECTIVE=!1,this.AREALIGHTSUPPORTED=!0,this.USE_VERTEX_PULLING=!1,this.VERTEX_PULLING_USE_INDEX_BUFFER=!1,this.VERTEX_PULLING_INDEX_BUFFER_32BITS=!1,this.RIGHT_HANDED=!1,this.CLUSTLIGHT_SLICES=0,this.CLUSTLIGHT_BATCH=0,this.IS_REFLECTION_LINEAR=!1,this.IS_REFRACTION_LINEAR=!1,this.DECAL_AFTER_DETAIL=!1,this.TEXTURE_REPETITION_MODE=0,this.rebuild()}}class k extends D(c.PushMaterial){}class V extends k{get isPrePassCapable(){return!this.disableDepthWrite}get canRenderToMRT(){return!0}constructor(e,t,i=!1){super(e,t,void 0,i||V.ForceGLSL),this._diffuseTexture=null,this._ambientTexture=null,this._opacityTexture=null,this._reflectionTexture=null,this._emissiveTexture=null,this._specularTexture=null,this._bumpTexture=null,this._lightmapTexture=null,this._refractionTexture=null,this.ambientColor=new o.Color3(0,0,0),this.diffuseColor=new o.Color3(1,1,1),this.specularColor=new o.Color3(1,1,1),this.emissiveColor=new o.Color3(0,0,0),this.specularPower=64,this._useAlphaFromDiffuseTexture=!1,this._useEmissiveAsIllumination=!1,this._linkEmissiveWithDiffuse=!1,this._useSpecularOverAlpha=!1,this._useReflectionOverAlpha=!1,this._disableLighting=!1,this._useObjectSpaceNormalMap=!1,this._useParallax=!1,this._useParallaxOcclusion=!1,this.parallaxScaleBias=.05,this._roughness=0,this.indexOfRefraction=.98,this.invertRefractionY=!0,this.alphaCutOff=.4,this._useLightmapAsShadowmap=!1,this._useReflectionFresnelFromSpecular=!1,this._useGlossinessFromSpecularMapAlpha=!1,this._maxSimultaneousLights=4,this._invertNormalMapX=!1,this._invertNormalMapY=!1,this._twoSidedLighting=!1,this._applyDecalMapAfterDetailMap=!1,this._shadersLoaded=!1,this._vertexPullingMetadata=null,this._renderTargets=new a.SmartArray(16),this._globalAmbientColor=new o.Color3(0,0,0),this._cacheHasRenderTargetTextures=!1,this.detailMap=new I(this),this._attachImageProcessingConfiguration(null),this.prePassConfiguration=new u,this.getRenderTargetTextures=()=>(this._renderTargets.reset(),V.ReflectionTextureEnabled&&this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&this._renderTargets.push(this._reflectionTexture),V.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget&&this._renderTargets.push(this._refractionTexture),this._eventInfo.renderTargets=this._renderTargets,this._callbackPluginEventFillRenderTargetTextures(this._eventInfo),this._renderTargets)}get hasRenderTargetTextures(){return!!V.ReflectionTextureEnabled&&!!this._reflectionTexture&&!!this._reflectionTexture.isRenderTarget||!!V.RefractionTextureEnabled&&!!this._refractionTexture&&!!this._refractionTexture.isRenderTarget||this._cacheHasRenderTargetTextures}getClassName(){return"StandardMaterial"}needAlphaBlending(){return this._hasTransparencyMode?this._transparencyModeIsBlend:!this._disableAlphaBlending&&(this.alpha<1||null!=this._opacityTexture||this._shouldUseAlphaFromDiffuseTexture()||this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled)}needAlphaTesting(){return this._hasTransparencyMode?this._transparencyModeIsTest:this._hasAlphaChannel()&&(null==this._transparencyMode||this._transparencyMode===p.Material.MATERIAL_ALPHATEST)}_shouldUseAlphaFromDiffuseTexture(){return null!=this._diffuseTexture&&this._diffuseTexture.hasAlpha&&this._useAlphaFromDiffuseTexture&&this._transparencyMode!==p.Material.MATERIAL_OPAQUE}_hasAlphaChannel(){return null!=this._diffuseTexture&&this._diffuseTexture.hasAlpha||null!=this._opacityTexture}getAlphaTestTexture(){return this._diffuseTexture}isReadyForSubMesh(t,i,r=!1){this._uniformBufferLayoutBuilt||this.buildUniformLayout();let s=i._drawWrapper;if(s.effect&&this.isFrozen&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===r)return!0;i.materialDefines||(this._callbackPluginEventGeneric(4,this._eventInfo),i.materialDefines=new B(this._eventInfo.defineNames));let a=this.getScene(),n=i.materialDefines;if(this._isReadyForSubMesh(i))return!0;let o=a.getEngine();if(n._needNormals=(0,S.PrepareDefinesForLights)(a,t,n,!0,this._maxSimultaneousLights,this._disableLighting),!(0,S.AreLightsTexturesReady)(a,t,this._maxSimultaneousLights,this._disableLighting))return!1;(0,S.PrepareDefinesForMultiview)(a,n);let h=this.needAlphaBlendingForMesh(t)&&this.getScene().useOrderIndependentTransparency;if((0,S.PrepareDefinesForPrePass)(a,n,this.canRenderToMRT&&!h),(0,S.PrepareDefinesForOIT)(a,n,h),M.PrepareDefines(o.currentRenderPassId,t,n),n._areTexturesDirty){this._eventInfo.hasRenderTargetTextures=!1,this._callbackPluginEventHasRenderTargetTextures(this._eventInfo),this._cacheHasRenderTargetTextures=this._eventInfo.hasRenderTargetTextures,n._needUVs=!1;for(let e=1;e<=6;++e)n["MAINUV"+e]=!1;if(a.texturesEnabled){if(n.DIFFUSEDIRECTUV=0,n.BUMPDIRECTUV=0,n.AMBIENTDIRECTUV=0,n.OPACITYDIRECTUV=0,n.EMISSIVEDIRECTUV=0,n.SPECULARDIRECTUV=0,n.LIGHTMAPDIRECTUV=0,this._diffuseTexture&&V.DiffuseTextureEnabled)if(!this._diffuseTexture.isReadyOrNotBlocking())return!1;else(0,S.PrepareDefinesForMergedUV)(this._diffuseTexture,n,"DIFFUSE");else n.DIFFUSE=!1;if(this._ambientTexture&&V.AmbientTextureEnabled)if(!this._ambientTexture.isReadyOrNotBlocking())return!1;else(0,S.PrepareDefinesForMergedUV)(this._ambientTexture,n,"AMBIENT");else n.AMBIENT=!1;if(this._opacityTexture&&V.OpacityTextureEnabled)if(!this._opacityTexture.isReadyOrNotBlocking())return!1;else(0,S.PrepareDefinesForMergedUV)(this._opacityTexture,n,"OPACITY"),n.OPACITYRGB=this._opacityTexture.getAlphaFromRGB;else n.OPACITY=!1;if(this._reflectionTexture&&V.ReflectionTextureEnabled?(n.ROUGHNESS=this._roughness>0,n.REFLECTIONOVERALPHA=this._useReflectionOverAlpha):(n.ROUGHNESS=!1,n.REFLECTIONOVERALPHA=!1),!(0,S.PrepareDefinesForIBL)(a,this._reflectionTexture,n))return!1;if(this._emissiveTexture&&V.EmissiveTextureEnabled)if(!this._emissiveTexture.isReadyOrNotBlocking())return!1;else(0,S.PrepareDefinesForMergedUV)(this._emissiveTexture,n,"EMISSIVE");else n.EMISSIVE=!1;if(this._lightmapTexture&&V.LightmapTextureEnabled)if(!this._lightmapTexture.isReadyOrNotBlocking())return!1;else(0,S.PrepareDefinesForMergedUV)(this._lightmapTexture,n,"LIGHTMAP"),n.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,n.RGBDLIGHTMAP=this._lightmapTexture.isRGBD;else n.LIGHTMAP=!1;if(this._specularTexture&&V.SpecularTextureEnabled)if(!this._specularTexture.isReadyOrNotBlocking())return!1;else(0,S.PrepareDefinesForMergedUV)(this._specularTexture,n,"SPECULAR"),n.GLOSSINESS=this._useGlossinessFromSpecularMapAlpha;else n.SPECULAR=!1;if(a.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&V.BumpTextureEnabled){if(!this._bumpTexture.isReady())return!1;(0,S.PrepareDefinesForMergedUV)(this._bumpTexture,n,"BUMP"),n.PARALLAX=this._useParallax,n.PARALLAX_RHS=a.useRightHandedSystem,n.PARALLAXOCCLUSION=this._useParallaxOcclusion,n.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap}else n.BUMP=!1,n.PARALLAX=!1,n.PARALLAX_RHS=!1,n.PARALLAXOCCLUSION=!1;if(this._refractionTexture&&V.RefractionTextureEnabled)if(!this._refractionTexture.isReadyOrNotBlocking())return!1;else n._needUVs=!0,n.REFRACTION=!0,n.REFRACTIONMAP_3D=this._refractionTexture.isCube,n.RGBDREFRACTION=this._refractionTexture.isRGBD,n.USE_LOCAL_REFRACTIONMAP_CUBIC=!!this._refractionTexture.boundingBoxSize;else n.REFRACTION=!1;n.TWOSIDEDLIGHTING=!this._backFaceCulling&&this._twoSidedLighting}else n.DIFFUSE=!1,n.AMBIENT=!1,n.OPACITY=!1,n.REFLECTION=!1,n.EMISSIVE=!1,n.LIGHTMAP=!1,n.BUMP=!1,n.REFRACTION=!1;n.ALPHAFROMDIFFUSE=this._shouldUseAlphaFromDiffuseTexture(),n.EMISSIVEASILLUMINATION=this._useEmissiveAsIllumination,n.LINKEMISSIVEWITHDIFFUSE=this._linkEmissiveWithDiffuse,n.SPECULAROVERALPHA=this._useSpecularOverAlpha,n.PREMULTIPLYALPHA=7===this.alphaMode||8===this.alphaMode,n.ALPHATEST_AFTERALLALPHACOMPUTATIONS=null!==this.transparencyMode,n.ALPHABLEND=null===this.transparencyMode||this.needAlphaBlendingForMesh(t),n.TEXTURE_REPETITION_MODE=o.version>1||o.isWebGPU?this.textureRepetitionMode:0}if(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=n,this._eventInfo.subMesh=i,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),!this._eventInfo.isReadyForSubMesh)return!1;if(n._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(n),n.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,n.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(n._areFresnelDirty&&(V.FresnelEnabled?(this._diffuseFresnelParameters||this._opacityFresnelParameters||this._emissiveFresnelParameters||this._refractionFresnelParameters||this._reflectionFresnelParameters)&&(n.DIFFUSEFRESNEL=this._diffuseFresnelParameters&&this._diffuseFresnelParameters.isEnabled,n.OPACITYFRESNEL=this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled,n.REFLECTIONFRESNEL=this._reflectionFresnelParameters&&this._reflectionFresnelParameters.isEnabled,n.REFLECTIONFRESNELFROMSPECULAR=this._useReflectionFresnelFromSpecular,n.REFRACTIONFRESNEL=this._refractionFresnelParameters&&this._refractionFresnelParameters.isEnabled,n.EMISSIVEFRESNEL=this._emissiveFresnelParameters&&this._emissiveFresnelParameters.isEnabled,n._needNormals=!0,n.FRESNEL=!0):n.FRESNEL=!1),n.AREALIGHTUSED||n.CLUSTLIGHT_BATCH){for(let e=0;e<t.lightSources.length;e++)if(!t.lightSources[e]._isReady())return!1}(0,S.PrepareDefinesForMisc)(t,a,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(t),n,this._applyDecalMapAfterDetailMap,this._useVertexPulling,i.getRenderingMesh(),this._isVertexOutputInvariant),(0,S.PrepareDefinesForFrameBoundValues)(a,o,this,n,r,null,i.getRenderingMesh().hasThinInstances),this._eventInfo.defines=n,this._eventInfo.mesh=t,this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo),(0,S.PrepareDefinesForAttributes)(t,n,!0,!0,!0),this._callbackPluginEventPrepareDefines(this._eventInfo);let d=!1;if(n.isDirty){let r=n._areLightsDisposed;n.markAsProcessed();let s=new T.EffectFallbacks;n.REFLECTION&&s.addFallback(0,"REFLECTION"),n.SPECULAR&&s.addFallback(0,"SPECULAR"),n.BUMP&&s.addFallback(0,"BUMP"),n.PARALLAX&&s.addFallback(1,"PARALLAX"),n.PARALLAX_RHS&&s.addFallback(1,"PARALLAX_RHS"),n.PARALLAXOCCLUSION&&s.addFallback(0,"PARALLAXOCCLUSION"),n.SPECULAROVERALPHA&&s.addFallback(0,"SPECULAROVERALPHA"),n.FOG&&s.addFallback(1,"FOG"),n.POINTSIZE&&s.addFallback(0,"POINTSIZE"),n.LOGARITHMICDEPTH&&s.addFallback(0,"LOGARITHMICDEPTH"),(0,S.HandleFallbacksForShadows)(n,s,this._maxSimultaneousLights),n.SPECULARTERM&&s.addFallback(0,"SPECULARTERM"),n.DIFFUSEFRESNEL&&s.addFallback(1,"DIFFUSEFRESNEL"),n.OPACITYFRESNEL&&s.addFallback(2,"OPACITYFRESNEL"),n.REFLECTIONFRESNEL&&s.addFallback(3,"REFLECTIONFRESNEL"),n.EMISSIVEFRESNEL&&s.addFallback(4,"EMISSIVEFRESNEL"),n.FRESNEL&&s.addFallback(4,"FRESNEL"),n.MULTIVIEW&&s.addFallback(0,"MULTIVIEW");let h=[l.VertexBuffer.PositionKind];n.NORMAL&&h.push(l.VertexBuffer.NormalKind),n.TANGENT&&h.push(l.VertexBuffer.TangentKind);for(let e=1;e<=6;++e)n["UV"+e]&&h.push(`uv${1===e?"":e}`);n.VERTEXCOLOR&&h.push(l.VertexBuffer.ColorKind),(0,S.PrepareAttributesForBones)(h,t,n,s),(0,S.PrepareAttributesForInstances)(h,n),(0,S.PrepareAttributesForMorphTargets)(h,t,n),(0,S.PrepareAttributesForBakedVertexAnimation)(h,t,n);let p="default",c=["world","view","viewProjection","vEyePosition","vLightsType","vAmbientColor","vDiffuseColor","vSpecularColor","vEmissiveColor","visibility","vFogInfos","vFogColor","pointSize","vDiffuseInfos","vAmbientInfos","vOpacityInfos","vEmissiveInfos","vSpecularInfos","vBumpInfos","vLightmapInfos","vRefractionInfos","mBones","diffuseMatrix","ambientMatrix","opacityMatrix","emissiveMatrix","specularMatrix","bumpMatrix","normalMatrix","lightmapMatrix","refractionMatrix","diffuseLeftColor","diffuseRightColor","opacityParts","reflectionLeftColor","reflectionRightColor","emissiveLeftColor","emissiveRightColor","refractionLeftColor","refractionRightColor","vRefractionPosition","vRefractionSize","logarithmicDepthConstant","vTangentSpaceParams","alphaCutOff","boneTextureInfo","morphTargetTextureInfo","morphTargetTextureIndices","cameraInfo","vTextureRepetitionHexTilingParams"],f=["diffuseSampler","ambientSampler","opacitySampler","reflectionCubeSampler","reflection2DSampler","emissiveSampler","specularSampler","bumpSampler","lightmapSampler","refractionCubeSampler","refraction2DSampler","boneSampler","morphTargets","oitDepthSampler","oitFrontColorSampler","areaLightsLTC1Sampler","areaLightsLTC2Sampler"];(0,S.PrepareUniformsAndSamplersForIBL)(c,f,!1);let m=["Material","Scene","Mesh"],E={maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:n.NUM_MORPH_INFLUENCERS};if(this._eventInfo.fallbacks=s,this._eventInfo.fallbackRank=0,this._eventInfo.defines=n,this._eventInfo.uniforms=c,this._eventInfo.attributes=h,this._eventInfo.samplers=f,this._eventInfo.uniformBuffersNames=m,this._eventInfo.customCode=void 0,this._eventInfo.mesh=t,this._eventInfo.indexParameters=E,this._callbackPluginEventGeneric(128,this._eventInfo),M.AddUniformsAndSamplers(c,f),u.AddUniforms(c),u.AddSamplers(f),_.ImageProcessingConfiguration&&(_.ImageProcessingConfiguration.PrepareUniforms(c,n),_.ImageProcessingConfiguration.PrepareSamplers(f,n)),(0,S.PrepareUniformsAndSamplersList)({uniformsNames:c,uniformBuffersNames:m,samplers:f,defines:n,maxSimultaneousLights:this._maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),(0,b.AddClipPlaneUniforms)(c),this._useVertexPulling){let e=i.getRenderingMesh(),t=e?.geometry;t&&(this._vertexPullingMetadata=(0,v.PrepareVertexPullingUniforms)(t),this._vertexPullingMetadata&&this._vertexPullingMetadata.forEach((e,t)=>{c.push(`vp_${t}_info`)}))}else this._vertexPullingMetadata=null;let g={};this.customShaderNameResolve&&(p=this.customShaderNameResolve(p,c,m,f,n,h,g));let P=n.toString(),A=i.effect,x=a.getEngine().createEffect(p,{attributes:h,uniformsNames:c,uniformBuffersNames:m,samplers:f,defines:P,fallbacks:s,onCompiled:this.onCompiled,onError:this.onError,indexParameters:E,processFinalCode:g.processFinalCode,processCodeAfterIncludes:this._eventInfo.customCode,multiTarget:n.PREPASS,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:async()=>{1===this._shaderLanguage?await Promise.all([e.A(22649),e.A(39487)]):await Promise.all([e.A(60020),e.A(66183)]),this._shadersLoaded=!0}},o);if(this._eventInfo.customCode=void 0,x)if(this._onEffectCreatedObservable&&(O.effect=x,O.subMesh=i,this._onEffectCreatedObservable.notifyObservers(O)),this.allowShaderHotSwapping&&A&&!x.isReady()){if(n.markAsUnprocessed(),d=this.isFrozen,r)return n._areLightsDisposed=!0,!1}else a.resetCachedMaterial(),i.setEffect(x,n,this._materialContext)}return!!i.effect&&!!i.effect.isReady()&&(n._renderId=a.getRenderId(),s._wasPreviouslyReady=!d,s._wasPreviouslyUsingInstances=r,this._checkScenePerformancePriority(),!0)}buildUniformLayout(){let e=this._uniformBuffer;e.addUniform("diffuseLeftColor",4),e.addUniform("diffuseRightColor",4),e.addUniform("opacityParts",4),e.addUniform("reflectionLeftColor",4),e.addUniform("reflectionRightColor",4),e.addUniform("refractionLeftColor",4),e.addUniform("refractionRightColor",4),e.addUniform("emissiveLeftColor",4),e.addUniform("emissiveRightColor",4),e.addUniform("vDiffuseInfos",2),e.addUniform("vAmbientInfos",2),e.addUniform("vOpacityInfos",2),e.addUniform("vEmissiveInfos",2),e.addUniform("vLightmapInfos",2),e.addUniform("vSpecularInfos",2),e.addUniform("vBumpInfos",3),e.addUniform("diffuseMatrix",16),e.addUniform("ambientMatrix",16),e.addUniform("opacityMatrix",16),e.addUniform("emissiveMatrix",16),e.addUniform("lightmapMatrix",16),e.addUniform("specularMatrix",16),e.addUniform("bumpMatrix",16),e.addUniform("vTangentSpaceParams",2),e.addUniform("pointSize",1),e.addUniform("alphaCutOff",1),e.addUniform("refractionMatrix",16),e.addUniform("vRefractionInfos",4),e.addUniform("vRefractionPosition",3),e.addUniform("vRefractionSize",3),e.addUniform("vSpecularColor",4),e.addUniform("vEmissiveColor",3),e.addUniform("vDiffuseColor",4),e.addUniform("vAmbientColor",3),e.addUniform("cameraInfo",4),e.addUniform("vTextureRepetitionHexTilingParams",4),(0,S.PrepareUniformLayoutForIBL)(e,!1,!0),super.buildUniformLayout()}bindForSubMesh(e,t,i){let r=this.getScene(),s=i.materialDefines;if(!s)return;let a=i.effect;if(!a)return;this._activeEffect=a,t.getMeshUniformBuffer().bindToEffect(a,"Mesh"),t.transferToEffect(e),this._uniformBuffer.bindToEffect(a,"Material"),this.prePassConfiguration.bindForSubMesh(this._activeEffect,r,t,e,this.isFrozen),M.Bind(r.getEngine().currentRenderPassId,this._activeEffect,t,e,this);let l=r.activeCamera;l?this._uniformBuffer.updateFloat4("cameraInfo",l.minZ,l.maxZ,0,0):this._uniformBuffer.updateFloat4("cameraInfo",0,0,0,0);let u=this.textureRepetitionHexTilingParams;this._uniformBuffer.updateFloat4("vTextureRepetitionHexTilingParams",u[0],u[1],u[2],u[3]),this._eventInfo.subMesh=i,this._callbackPluginEventHardBindForSubMesh(this._eventInfo),s.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));let h=this._mustRebind(r,a,i,t.visibility),d=r.getEngine()._features.needToAlwaysBindUniformBuffers;(0,S.BindBonesParameters)(t,a),this._vertexPullingMetadata&&(0,v.BindVertexPullingUniforms)(a,this._vertexPullingMetadata);let _=this._uniformBuffer;if(h){if(this.bindViewProjection(a),!_.useUbo||!this.isFrozen||!_.isSync||i._drawWrapper._forceRebindOnNextCall){if(V.FresnelEnabled&&s.FRESNEL){if(this.diffuseFresnelParameters&&this.diffuseFresnelParameters.isEnabled&&(_.updateColor4("diffuseLeftColor",this.diffuseFresnelParameters.leftColor,this.diffuseFresnelParameters.power),_.updateColor4("diffuseRightColor",this.diffuseFresnelParameters.rightColor,this.diffuseFresnelParameters.bias)),this.opacityFresnelParameters&&this.opacityFresnelParameters.isEnabled){let e=o.TmpColors.Color3[0];e.set(this.opacityFresnelParameters.leftColor.toLuminance(),this.opacityFresnelParameters.rightColor.toLuminance(),this.opacityFresnelParameters.bias),_.updateColor4("opacityParts",e,this.opacityFresnelParameters.power)}this.reflectionFresnelParameters&&this.reflectionFresnelParameters.isEnabled&&(_.updateColor4("reflectionLeftColor",this.reflectionFresnelParameters.leftColor,this.reflectionFresnelParameters.power),_.updateColor4("reflectionRightColor",this.reflectionFresnelParameters.rightColor,this.reflectionFresnelParameters.bias)),this.refractionFresnelParameters&&this.refractionFresnelParameters.isEnabled&&(_.updateColor4("refractionLeftColor",this.refractionFresnelParameters.leftColor,this.refractionFresnelParameters.power),_.updateColor4("refractionRightColor",this.refractionFresnelParameters.rightColor,this.refractionFresnelParameters.bias)),this.emissiveFresnelParameters&&this.emissiveFresnelParameters.isEnabled&&(_.updateColor4("emissiveLeftColor",this.emissiveFresnelParameters.leftColor,this.emissiveFresnelParameters.power),_.updateColor4("emissiveRightColor",this.emissiveFresnelParameters.rightColor,this.emissiveFresnelParameters.bias))}if(r.texturesEnabled&&(this._diffuseTexture&&V.DiffuseTextureEnabled&&(_.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),(0,S.BindTextureMatrix)(this._diffuseTexture,_,"diffuse")),this._ambientTexture&&V.AmbientTextureEnabled&&(_.updateFloat2("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level),(0,S.BindTextureMatrix)(this._ambientTexture,_,"ambient")),this._opacityTexture&&V.OpacityTextureEnabled&&(_.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),(0,S.BindTextureMatrix)(this._opacityTexture,_,"opacity")),this._hasAlphaChannel()&&_.updateFloat("alphaCutOff",this.alphaCutOff),(0,S.BindIBLParameters)(r,s,_,o.Color3.White(),this._reflectionTexture,!1,!1,!0,!1,!1,!1,this.roughness),this._reflectionTexture&&V.ReflectionTextureEnabled||_.updateFloat2("vReflectionInfos",0,this.roughness),this._emissiveTexture&&V.EmissiveTextureEnabled&&(_.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),(0,S.BindTextureMatrix)(this._emissiveTexture,_,"emissive")),this._lightmapTexture&&V.LightmapTextureEnabled&&(_.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),(0,S.BindTextureMatrix)(this._lightmapTexture,_,"lightmap")),this._specularTexture&&V.SpecularTextureEnabled&&(_.updateFloat2("vSpecularInfos",this._specularTexture.coordinatesIndex,this._specularTexture.level),(0,S.BindTextureMatrix)(this._specularTexture,_,"specular")),this._bumpTexture&&r.getEngine().getCaps().standardDerivatives&&V.BumpTextureEnabled&&(_.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,1/this._bumpTexture.level,this.parallaxScaleBias),(0,S.BindTextureMatrix)(this._bumpTexture,_,"bump"),r._mirroredCameraPosition?_.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):_.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1)),this._refractionTexture&&V.RefractionTextureEnabled)){let e=1;if(!this._refractionTexture.isCube&&(_.updateMatrix("refractionMatrix",this._refractionTexture.getReflectionTextureMatrix()),this._refractionTexture.depth&&(e=this._refractionTexture.depth)),_.updateFloat4("vRefractionInfos",this._refractionTexture.level,this.indexOfRefraction,e,this.invertRefractionY?-1:1),this._refractionTexture.boundingBoxSize){let e=this._refractionTexture;_.updateVector3("vRefractionPosition",e.boundingBoxPosition),_.updateVector3("vRefractionSize",e.boundingBoxSize)}}this.pointsCloud&&_.updateFloat("pointSize",this.pointSize),_.updateColor4("vSpecularColor",this.specularColor,this.specularPower),_.updateColor3("vEmissiveColor",V.EmissiveTextureEnabled?this.emissiveColor:o.Color3.BlackReadOnly),_.updateColor4("vDiffuseColor",this.diffuseColor,this.alpha),r.ambientColor.multiplyToRef(this.ambientColor,this._globalAmbientColor),_.updateColor3("vAmbientColor",this._globalAmbientColor)}r.texturesEnabled&&(this._diffuseTexture&&V.DiffuseTextureEnabled&&a.setTexture("diffuseSampler",this._diffuseTexture),this._ambientTexture&&V.AmbientTextureEnabled&&a.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&V.OpacityTextureEnabled&&a.setTexture("opacitySampler",this._opacityTexture),this._reflectionTexture&&V.ReflectionTextureEnabled&&(this._reflectionTexture.isCube?a.setTexture("reflectionCubeSampler",this._reflectionTexture):a.setTexture("reflection2DSampler",this._reflectionTexture)),this._emissiveTexture&&V.EmissiveTextureEnabled&&a.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&V.LightmapTextureEnabled&&a.setTexture("lightmapSampler",this._lightmapTexture),this._specularTexture&&V.SpecularTextureEnabled&&a.setTexture("specularSampler",this._specularTexture),this._bumpTexture&&r.getEngine().getCaps().standardDerivatives&&V.BumpTextureEnabled&&a.setTexture("bumpSampler",this._bumpTexture),this._refractionTexture&&V.RefractionTextureEnabled&&(this._refractionTexture.isCube?a.setTexture("refractionCubeSampler",this._refractionTexture):a.setTexture("refraction2DSampler",this._refractionTexture))),this.getScene().useOrderIndependentTransparency&&this.needAlphaBlendingForMesh(t)&&this.getScene().depthPeelingRenderer.bind(a),this._eventInfo.subMesh=i,this._callbackPluginEventBindForSubMesh(this._eventInfo),(0,b.BindClipPlane)(a,this,r),this.bindEyePosition(a)}else d&&(this._needToBindSceneUbo=!0);(h||!this.isFrozen||d)&&r.lightsEnabled&&!this._disableLighting&&(0,S.BindLights)(r,t,a,s,this._maxSimultaneousLights),(h||!this.isFrozen)&&((r.fogEnabled&&t.applyFog&&r.fogMode!==n.Scene.FOGMODE_NONE||this._reflectionTexture||this._refractionTexture||t.receiveShadows||s.PREPASS||s.CLUSTLIGHT_BATCH)&&this.bindView(a),(0,S.BindFogParameters)(r,t,a),s.NUM_MORPH_INFLUENCERS&&(0,S.BindMorphTargetParameters)(t,a),s.BAKED_VERTEX_ANIMATION_TEXTURE&&t.bakedVertexAnimationManager?.bind(a,s.INSTANCES),this.useLogarithmicDepth&&(0,S.BindLogDepth)(s,a,r),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect)),this._afterBind(t,this._activeEffect,i),_.update()}getAnimatables(){let e=super.getAnimatables();return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),this._ambientTexture&&this._ambientTexture.animations&&this._ambientTexture.animations.length>0&&e.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&this._opacityTexture.animations.length>0&&e.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&this._reflectionTexture.animations.length>0&&e.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&this._emissiveTexture.animations.length>0&&e.push(this._emissiveTexture),this._specularTexture&&this._specularTexture.animations&&this._specularTexture.animations.length>0&&e.push(this._specularTexture),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&e.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&this._lightmapTexture.animations.length>0&&e.push(this._lightmapTexture),this._refractionTexture&&this._refractionTexture.animations&&this._refractionTexture.animations.length>0&&e.push(this._refractionTexture),e}getActiveTextures(){let e=super.getActiveTextures();return this._diffuseTexture&&e.push(this._diffuseTexture),this._ambientTexture&&e.push(this._ambientTexture),this._opacityTexture&&e.push(this._opacityTexture),this._reflectionTexture&&e.push(this._reflectionTexture),this._emissiveTexture&&e.push(this._emissiveTexture),this._specularTexture&&e.push(this._specularTexture),this._bumpTexture&&e.push(this._bumpTexture),this._lightmapTexture&&e.push(this._lightmapTexture),this._refractionTexture&&e.push(this._refractionTexture),e}hasTexture(e){return!!super.hasTexture(e)||this._diffuseTexture===e||this._ambientTexture===e||this._opacityTexture===e||this._reflectionTexture===e||this._emissiveTexture===e||this._specularTexture===e||this._bumpTexture===e||this._lightmapTexture===e||this._refractionTexture===e||!1}dispose(e,t){t&&(this._diffuseTexture?.dispose(),this._ambientTexture?.dispose(),this._opacityTexture?.dispose(),this._reflectionTexture?.dispose(),this._emissiveTexture?.dispose(),this._specularTexture?.dispose(),this._bumpTexture?.dispose(),this._lightmapTexture?.dispose(),this._refractionTexture?.dispose()),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),super.dispose(e,t)}clone(e,t=!0,i=""){let r=A.SerializationHelper.Clone(()=>new V(e,this.getScene()),this,{cloneTexturesOnlyOnce:t});return r.name=e,r.id=e,this.stencil.copyTo(r.stencil),this._clonePlugins(r,i),r}static Parse(e,t,i){let r=A.SerializationHelper.Parse(()=>new V(e.name,t),e,t,i);return e.stencil&&r.stencil.parse(e.stencil,t,i),p.Material._ParsePlugins(e,r,t,i),r}static get DiffuseTextureEnabled(){return f.MaterialFlags.DiffuseTextureEnabled}static set DiffuseTextureEnabled(e){f.MaterialFlags.DiffuseTextureEnabled=e}static get DetailTextureEnabled(){return f.MaterialFlags.DetailTextureEnabled}static set DetailTextureEnabled(e){f.MaterialFlags.DetailTextureEnabled=e}static get AmbientTextureEnabled(){return f.MaterialFlags.AmbientTextureEnabled}static set AmbientTextureEnabled(e){f.MaterialFlags.AmbientTextureEnabled=e}static get OpacityTextureEnabled(){return f.MaterialFlags.OpacityTextureEnabled}static set OpacityTextureEnabled(e){f.MaterialFlags.OpacityTextureEnabled=e}static get ReflectionTextureEnabled(){return f.MaterialFlags.ReflectionTextureEnabled}static set ReflectionTextureEnabled(e){f.MaterialFlags.ReflectionTextureEnabled=e}static get EmissiveTextureEnabled(){return f.MaterialFlags.EmissiveTextureEnabled}static set EmissiveTextureEnabled(e){f.MaterialFlags.EmissiveTextureEnabled=e}static get SpecularTextureEnabled(){return f.MaterialFlags.SpecularTextureEnabled}static set SpecularTextureEnabled(e){f.MaterialFlags.SpecularTextureEnabled=e}static get BumpTextureEnabled(){return f.MaterialFlags.BumpTextureEnabled}static set BumpTextureEnabled(e){f.MaterialFlags.BumpTextureEnabled=e}static get LightmapTextureEnabled(){return f.MaterialFlags.LightmapTextureEnabled}static set LightmapTextureEnabled(e){f.MaterialFlags.LightmapTextureEnabled=e}static get RefractionTextureEnabled(){return f.MaterialFlags.RefractionTextureEnabled}static set RefractionTextureEnabled(e){f.MaterialFlags.RefractionTextureEnabled=e}static get ColorGradingTextureEnabled(){return f.MaterialFlags.ColorGradingTextureEnabled}static set ColorGradingTextureEnabled(e){f.MaterialFlags.ColorGradingTextureEnabled=e}static get FresnelEnabled(){return f.MaterialFlags.FresnelEnabled}static set FresnelEnabled(e){f.MaterialFlags.FresnelEnabled=e}}V.ForceGLSL=!1,(0,r.__decorate)([(0,s.serializeAsTexture)("diffuseTexture")],V.prototype,"_diffuseTexture",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesAndMiscDirty")],V.prototype,"diffuseTexture",void 0),(0,r.__decorate)([(0,s.serializeAsTexture)("ambientTexture")],V.prototype,"_ambientTexture",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],V.prototype,"ambientTexture",void 0),(0,r.__decorate)([(0,s.serializeAsTexture)("opacityTexture")],V.prototype,"_opacityTexture",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesAndMiscDirty")],V.prototype,"opacityTexture",void 0),(0,r.__decorate)([(0,s.serializeAsTexture)("reflectionTexture")],V.prototype,"_reflectionTexture",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],V.prototype,"reflectionTexture",void 0),(0,r.__decorate)([(0,s.serializeAsTexture)("emissiveTexture")],V.prototype,"_emissiveTexture",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],V.prototype,"emissiveTexture",void 0),(0,r.__decorate)([(0,s.serializeAsTexture)("specularTexture")],V.prototype,"_specularTexture",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],V.prototype,"specularTexture",void 0),(0,r.__decorate)([(0,s.serializeAsTexture)("bumpTexture")],V.prototype,"_bumpTexture",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],V.prototype,"bumpTexture",void 0),(0,r.__decorate)([(0,s.serializeAsTexture)("lightmapTexture")],V.prototype,"_lightmapTexture",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],V.prototype,"lightmapTexture",void 0),(0,r.__decorate)([(0,s.serializeAsTexture)("refractionTexture")],V.prototype,"_refractionTexture",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],V.prototype,"refractionTexture",void 0),(0,r.__decorate)([(0,s.serializeAsColor3)("ambient")],V.prototype,"ambientColor",void 0),(0,r.__decorate)([(0,s.serializeAsColor3)("diffuse")],V.prototype,"diffuseColor",void 0),(0,r.__decorate)([(0,s.serializeAsColor3)("specular")],V.prototype,"specularColor",void 0),(0,r.__decorate)([(0,s.serializeAsColor3)("emissive")],V.prototype,"emissiveColor",void 0),(0,r.__decorate)([(0,s.serialize)()],V.prototype,"specularPower",void 0),(0,r.__decorate)([(0,s.serialize)("useAlphaFromDiffuseTexture")],V.prototype,"_useAlphaFromDiffuseTexture",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesAndMiscDirty")],V.prototype,"useAlphaFromDiffuseTexture",void 0),(0,r.__decorate)([(0,s.serialize)("useEmissiveAsIllumination")],V.prototype,"_useEmissiveAsIllumination",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],V.prototype,"useEmissiveAsIllumination",void 0),(0,r.__decorate)([(0,s.serialize)("linkEmissiveWithDiffuse")],V.prototype,"_linkEmissiveWithDiffuse",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],V.prototype,"linkEmissiveWithDiffuse",void 0),(0,r.__decorate)([(0,s.serialize)("useSpecularOverAlpha")],V.prototype,"_useSpecularOverAlpha",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],V.prototype,"useSpecularOverAlpha",void 0),(0,r.__decorate)([(0,s.serialize)("useReflectionOverAlpha")],V.prototype,"_useReflectionOverAlpha",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],V.prototype,"useReflectionOverAlpha",void 0),(0,r.__decorate)([(0,s.serialize)("disableLighting")],V.prototype,"_disableLighting",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsLightsDirty")],V.prototype,"disableLighting",void 0),(0,r.__decorate)([(0,s.serialize)("useObjectSpaceNormalMap")],V.prototype,"_useObjectSpaceNormalMap",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],V.prototype,"useObjectSpaceNormalMap",void 0),(0,r.__decorate)([(0,s.serialize)("useParallax")],V.prototype,"_useParallax",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],V.prototype,"useParallax",void 0),(0,r.__decorate)([(0,s.serialize)("useParallaxOcclusion")],V.prototype,"_useParallaxOcclusion",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],V.prototype,"useParallaxOcclusion",void 0),(0,r.__decorate)([(0,s.serialize)()],V.prototype,"parallaxScaleBias",void 0),(0,r.__decorate)([(0,s.serialize)("roughness")],V.prototype,"_roughness",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],V.prototype,"roughness",void 0),(0,r.__decorate)([(0,s.serialize)()],V.prototype,"indexOfRefraction",void 0),(0,r.__decorate)([(0,s.serialize)()],V.prototype,"invertRefractionY",void 0),(0,r.__decorate)([(0,s.serialize)()],V.prototype,"alphaCutOff",void 0),(0,r.__decorate)([(0,s.serialize)("useLightmapAsShadowmap")],V.prototype,"_useLightmapAsShadowmap",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],V.prototype,"useLightmapAsShadowmap",void 0),(0,r.__decorate)([(0,s.serializeAsFresnelParameters)("diffuseFresnelParameters")],V.prototype,"_diffuseFresnelParameters",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsFresnelDirty")],V.prototype,"diffuseFresnelParameters",void 0),(0,r.__decorate)([(0,s.serializeAsFresnelParameters)("opacityFresnelParameters")],V.prototype,"_opacityFresnelParameters",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsFresnelAndMiscDirty")],V.prototype,"opacityFresnelParameters",void 0),(0,r.__decorate)([(0,s.serializeAsFresnelParameters)("reflectionFresnelParameters")],V.prototype,"_reflectionFresnelParameters",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsFresnelDirty")],V.prototype,"reflectionFresnelParameters",void 0),(0,r.__decorate)([(0,s.serializeAsFresnelParameters)("refractionFresnelParameters")],V.prototype,"_refractionFresnelParameters",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsFresnelDirty")],V.prototype,"refractionFresnelParameters",void 0),(0,r.__decorate)([(0,s.serializeAsFresnelParameters)("emissiveFresnelParameters")],V.prototype,"_emissiveFresnelParameters",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsFresnelDirty")],V.prototype,"emissiveFresnelParameters",void 0),(0,r.__decorate)([(0,s.serialize)("useReflectionFresnelFromSpecular")],V.prototype,"_useReflectionFresnelFromSpecular",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsFresnelDirty")],V.prototype,"useReflectionFresnelFromSpecular",void 0),(0,r.__decorate)([(0,s.serialize)("useGlossinessFromSpecularMapAlpha")],V.prototype,"_useGlossinessFromSpecularMapAlpha",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],V.prototype,"useGlossinessFromSpecularMapAlpha",void 0),(0,r.__decorate)([(0,s.serialize)("maxSimultaneousLights")],V.prototype,"_maxSimultaneousLights",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsLightsDirty")],V.prototype,"maxSimultaneousLights",void 0),(0,r.__decorate)([(0,s.serialize)("invertNormalMapX")],V.prototype,"_invertNormalMapX",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],V.prototype,"invertNormalMapX",void 0),(0,r.__decorate)([(0,s.serialize)("invertNormalMapY")],V.prototype,"_invertNormalMapY",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],V.prototype,"invertNormalMapY",void 0),(0,r.__decorate)([(0,s.serialize)("twoSidedLighting")],V.prototype,"_twoSidedLighting",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],V.prototype,"twoSidedLighting",void 0),(0,r.__decorate)([(0,s.serialize)("applyDecalMapAfterDetailMap")],V.prototype,"_applyDecalMapAfterDetailMap",void 0),(0,r.__decorate)([(0,s.expandToProperty)("_markAllSubMeshesAsMiscDirty")],V.prototype,"applyDecalMapAfterDetailMap",void 0);let H=!1;function G(){H||(H=!0,(0,F.RegisterClass)("BABYLON.StandardMaterial",V),n.Scene.DefaultMaterialFactory=e=>new V("default material",e))}Object.getOwnPropertyDescriptor(V.prototype,"decalMap")||Object.defineProperty(V.prototype,"decalMap",(0,N._MissingSideEffectProperty)("StandardMaterial","decalMap")),e.s(["RegisterStandardMaterial",0,G,"StandardMaterial",0,V,"StandardMaterialDefines",0,B],23015),G(),e.s([],9866),e.i(9866),e.i(23015),e.s(["RegisterStandardMaterial",0,G,"StandardMaterial",0,V,"StandardMaterialDefines",0,B],32550)}]);