@selvajs/selva 4.6.9 → 4.6.10

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 (232) hide show
  1. package/build/client/_app/immutable/chunks/{Gd_kdLxB.js → 7w20m49Y.js} +1 -1
  2. package/build/client/_app/immutable/chunks/7w20m49Y.js.br +0 -0
  3. package/build/client/_app/immutable/chunks/7w20m49Y.js.gz +0 -0
  4. package/build/client/_app/immutable/chunks/{BUuo8-qC.js → C0aBHGDt.js} +1 -1
  5. package/build/client/_app/immutable/chunks/C0aBHGDt.js.br +0 -0
  6. package/build/client/_app/immutable/chunks/C0aBHGDt.js.gz +0 -0
  7. package/build/client/_app/immutable/chunks/{ZYeygTkz.js → CWoH8aIC.js} +1 -1
  8. package/build/client/_app/immutable/chunks/CWoH8aIC.js.br +0 -0
  9. package/build/client/_app/immutable/chunks/CWoH8aIC.js.gz +0 -0
  10. package/build/client/_app/immutable/chunks/{CQ8eGRBm.js → DCEuWrCg.js} +1 -1
  11. package/build/client/_app/immutable/chunks/DCEuWrCg.js.br +0 -0
  12. package/build/client/_app/immutable/chunks/DCEuWrCg.js.gz +0 -0
  13. package/build/client/_app/immutable/chunks/{BoRTl1dl.js → DQwEQLx9.js} +1 -1
  14. package/build/client/_app/immutable/chunks/DQwEQLx9.js.br +0 -0
  15. package/build/client/_app/immutable/chunks/DQwEQLx9.js.gz +0 -0
  16. package/build/client/_app/immutable/chunks/Rw0KKMY0.js +3 -0
  17. package/build/client/_app/immutable/chunks/Rw0KKMY0.js.br +0 -0
  18. package/build/client/_app/immutable/chunks/Rw0KKMY0.js.gz +0 -0
  19. package/build/client/_app/immutable/chunks/{6dXW0uFp.js → Tuzbj3g9.js} +1 -1
  20. package/build/client/_app/immutable/chunks/Tuzbj3g9.js.br +0 -0
  21. package/build/client/_app/immutable/chunks/Tuzbj3g9.js.gz +0 -0
  22. package/build/client/_app/immutable/entry/{app.CDEkLS2f.js → app.euyfrDSN.js} +2 -2
  23. package/build/client/_app/immutable/entry/app.euyfrDSN.js.br +0 -0
  24. package/build/client/_app/immutable/entry/app.euyfrDSN.js.gz +0 -0
  25. package/build/client/_app/immutable/entry/start.LskfscK4.js +1 -0
  26. package/build/client/_app/immutable/entry/start.LskfscK4.js.br +2 -0
  27. package/build/client/_app/immutable/entry/start.LskfscK4.js.gz +0 -0
  28. package/build/client/_app/immutable/nodes/{1.BK108MFt.js → 1.BrA43GNs.js} +1 -1
  29. package/build/client/_app/immutable/nodes/1.BrA43GNs.js.br +0 -0
  30. package/build/client/_app/immutable/nodes/1.BrA43GNs.js.gz +0 -0
  31. package/build/client/_app/immutable/nodes/{11.D3ISaEUV.js → 11.CJcQ9xwF.js} +1 -1
  32. package/build/client/_app/immutable/nodes/11.CJcQ9xwF.js.br +0 -0
  33. package/build/client/_app/immutable/nodes/11.CJcQ9xwF.js.gz +0 -0
  34. package/build/client/_app/immutable/nodes/{13.C0cBCfJw.js → 13.DooaQEce.js} +1 -1
  35. package/build/client/_app/immutable/nodes/13.DooaQEce.js.br +0 -0
  36. package/build/client/_app/immutable/nodes/13.DooaQEce.js.gz +0 -0
  37. package/build/client/_app/immutable/nodes/{14.DmKgEinA.js → 14.3rdtzYcf.js} +1 -1
  38. package/build/client/_app/immutable/nodes/14.3rdtzYcf.js.br +0 -0
  39. package/build/client/_app/immutable/nodes/14.3rdtzYcf.js.gz +0 -0
  40. package/build/client/_app/immutable/nodes/{15.C3NZYZAf.js → 15.C_JceeqE.js} +1 -1
  41. package/build/client/_app/immutable/nodes/15.C_JceeqE.js.br +0 -0
  42. package/build/client/_app/immutable/nodes/15.C_JceeqE.js.gz +0 -0
  43. package/build/client/_app/immutable/nodes/{16.qX2xW2nT.js → 16.ck12FD3n.js} +1 -1
  44. package/build/client/_app/immutable/nodes/16.ck12FD3n.js.br +0 -0
  45. package/build/client/_app/immutable/nodes/16.ck12FD3n.js.gz +0 -0
  46. package/build/client/_app/immutable/nodes/{17.DE08uU78.js → 17.rGO46C_3.js} +1 -1
  47. package/build/client/_app/immutable/nodes/17.rGO46C_3.js.br +0 -0
  48. package/build/client/_app/immutable/nodes/17.rGO46C_3.js.gz +0 -0
  49. package/build/client/_app/immutable/nodes/{19.BCBsD6Hy.js → 19.Wmg9gsCi.js} +1 -1
  50. package/build/client/_app/immutable/nodes/19.Wmg9gsCi.js.br +0 -0
  51. package/build/client/_app/immutable/nodes/19.Wmg9gsCi.js.gz +0 -0
  52. package/build/client/_app/immutable/nodes/{2.xrOHE4Zo.js → 2.DzBUy_PX.js} +1 -1
  53. package/build/client/_app/immutable/nodes/2.DzBUy_PX.js.br +0 -0
  54. package/build/client/_app/immutable/nodes/2.DzBUy_PX.js.gz +0 -0
  55. package/build/client/_app/immutable/nodes/{20.LGtPWLTM.js → 20.DmSxDb_k.js} +2 -2
  56. package/build/client/_app/immutable/nodes/20.DmSxDb_k.js.br +0 -0
  57. package/build/client/_app/immutable/nodes/20.DmSxDb_k.js.gz +0 -0
  58. package/build/client/_app/immutable/nodes/{21.DJjVsf3-.js → 21.YhzKQSBf.js} +1 -1
  59. package/build/client/_app/immutable/nodes/21.YhzKQSBf.js.br +0 -0
  60. package/build/client/_app/immutable/nodes/21.YhzKQSBf.js.gz +0 -0
  61. package/build/client/_app/immutable/nodes/{23.BtmEO5aD.js → 23.BuBVJwIE.js} +1 -1
  62. package/build/client/_app/immutable/nodes/23.BuBVJwIE.js.br +0 -0
  63. package/build/client/_app/immutable/nodes/{23.BtmEO5aD.js.gz → 23.BuBVJwIE.js.gz} +0 -0
  64. package/build/client/_app/immutable/nodes/{24.D-rBZJ1b.js → 24.BcwEtG_D.js} +1 -1
  65. package/build/client/_app/immutable/nodes/24.BcwEtG_D.js.br +0 -0
  66. package/build/client/_app/immutable/nodes/24.BcwEtG_D.js.gz +0 -0
  67. package/build/client/_app/immutable/nodes/{27.BPH4GZ_b.js → 27.Ev1ttWNS.js} +1 -1
  68. package/build/client/_app/immutable/nodes/27.Ev1ttWNS.js.br +0 -0
  69. package/build/client/_app/immutable/nodes/{27.BPH4GZ_b.js.gz → 27.Ev1ttWNS.js.gz} +0 -0
  70. package/build/client/_app/immutable/nodes/{28.B76Z-pIA.js → 28.BbNEnYuk.js} +1 -1
  71. package/build/client/_app/immutable/nodes/28.BbNEnYuk.js.br +0 -0
  72. package/build/client/_app/immutable/nodes/28.BbNEnYuk.js.gz +0 -0
  73. package/build/client/_app/immutable/nodes/{29.lxKzSpY7.js → 29.q7ujiDu_.js} +1 -1
  74. package/build/client/_app/immutable/nodes/29.q7ujiDu_.js.br +0 -0
  75. package/build/client/_app/immutable/nodes/29.q7ujiDu_.js.gz +0 -0
  76. package/build/client/_app/immutable/nodes/{3.DaGoIROJ.js → 3.xXwRU5xG.js} +1 -1
  77. package/build/client/_app/immutable/nodes/3.xXwRU5xG.js.br +0 -0
  78. package/build/client/_app/immutable/nodes/3.xXwRU5xG.js.gz +0 -0
  79. package/build/client/_app/immutable/nodes/{30.2f1y3W7o.js → 30.BcDvE_0u.js} +1 -1
  80. package/build/client/_app/immutable/nodes/30.BcDvE_0u.js.br +0 -0
  81. package/build/client/_app/immutable/nodes/30.BcDvE_0u.js.gz +0 -0
  82. package/build/client/_app/immutable/nodes/{5.D2cJhNMi.js → 5.CGj8B-ia.js} +1 -1
  83. package/build/client/_app/immutable/nodes/5.CGj8B-ia.js.br +0 -0
  84. package/build/client/_app/immutable/nodes/5.CGj8B-ia.js.gz +0 -0
  85. package/build/client/_app/immutable/nodes/{6.gYoJJu2S.js → 6.FX7G6Qqo.js} +1 -1
  86. package/build/client/_app/immutable/nodes/6.FX7G6Qqo.js.br +0 -0
  87. package/build/client/_app/immutable/nodes/6.FX7G6Qqo.js.gz +0 -0
  88. package/build/client/_app/immutable/nodes/{7.C_0_MNpG.js → 7.BbUaG1it.js} +1 -1
  89. package/build/client/_app/immutable/nodes/7.BbUaG1it.js.br +0 -0
  90. package/build/client/_app/immutable/nodes/7.BbUaG1it.js.gz +0 -0
  91. package/build/client/_app/immutable/nodes/{8.DOe_6GAv.js → 8.DsbOarBp.js} +1 -1
  92. package/build/client/_app/immutable/nodes/8.DsbOarBp.js.br +0 -0
  93. package/build/client/_app/immutable/nodes/8.DsbOarBp.js.gz +0 -0
  94. package/build/client/_app/immutable/nodes/{9.Dq-dtKQr.js → 9.DWJJUHqf.js} +1 -1
  95. package/build/client/_app/immutable/nodes/9.DWJJUHqf.js.br +0 -0
  96. package/build/client/_app/immutable/nodes/9.DWJJUHqf.js.gz +0 -0
  97. package/build/client/_app/version.json +1 -1
  98. package/build/client/_app/version.json.br +0 -0
  99. package/build/client/_app/version.json.gz +0 -0
  100. package/build/handler.js +4 -4
  101. package/build/index.js +4 -4
  102. package/build/server/chunks/chunks/{internal.js-BltDBgTB.js → internal.js-BkFAQgIj.js} +2 -2
  103. package/build/server/chunks/chunks/{internal.js-BltDBgTB.js.map → internal.js-BkFAQgIj.js.map} +1 -1
  104. package/build/server/chunks/chunks/{package.js-BN1spRaE.js → package.js-CzPC5FUN.js} +2 -2
  105. package/build/server/chunks/chunks/package.js-CzPC5FUN.js.map +1 -0
  106. package/build/server/chunks/entries/endpoints/api/compute/{_server.ts.js-CSllLUvr.js → _server.ts.js-DDZ5gvES.js} +9 -18
  107. package/build/server/chunks/entries/endpoints/api/compute/_server.ts.js-DDZ5gvES.js.map +1 -0
  108. package/build/server/chunks/entries/pages/admin/{_page.server.ts.js-Baye9H7_.js → _page.server.ts.js-B3A5qHoV.js} +2 -2
  109. package/build/server/chunks/entries/pages/admin/{_page.server.ts.js-Baye9H7_.js.map → _page.server.ts.js-B3A5qHoV.js.map} +1 -1
  110. package/build/server/chunks/entries/pages/admin/system/{_page.server.ts.js-DlfJoLVw.js → _page.server.ts.js-C8VOJ5Sv.js} +2 -2
  111. package/build/server/chunks/entries/pages/admin/system/{_page.server.ts.js-DlfJoLVw.js.map → _page.server.ts.js-C8VOJ5Sv.js.map} +1 -1
  112. package/build/server/chunks/entries/pages/library/_guid_/{_page.svelte.js-mAWyxbdX.js → _page.svelte.js-CXs9URej.js} +2 -2
  113. package/build/server/chunks/entries/pages/library/_guid_/{_page.svelte.js-mAWyxbdX.js.map → _page.svelte.js-CXs9URej.js.map} +1 -1
  114. package/build/server/chunks/{handler-CN57LzQB.js → handler-DbanCiUX.js} +3 -3
  115. package/build/server/chunks/{handler-CN57LzQB.js.map → handler-DbanCiUX.js.map} +1 -1
  116. package/build/server/chunks/{index.js-C6MBdTri.js → index.js-B3LyvDEJ.js} +2 -2
  117. package/build/server/chunks/{index.js-C6MBdTri.js.map → index.js-B3LyvDEJ.js.map} +1 -1
  118. package/build/server/chunks/{manifest.js-Bf66gOXi.js → manifest.js-CfRu0pj3.js} +26 -26
  119. package/build/server/chunks/{manifest.js-Bf66gOXi.js.map → manifest.js-CfRu0pj3.js.map} +1 -1
  120. package/build/server/chunks/nodes/{1.js-B7lbjRX9.js → 1.js-cGWLz4JB.js} +2 -2
  121. package/build/server/chunks/nodes/{1.js-B7lbjRX9.js.map → 1.js-cGWLz4JB.js.map} +1 -1
  122. package/build/server/chunks/nodes/{11.js-Dh56_A7N.js → 11.js-G6picW2S.js} +2 -2
  123. package/build/server/chunks/nodes/{11.js-Dh56_A7N.js.map → 11.js-G6picW2S.js.map} +1 -1
  124. package/build/server/chunks/nodes/{13.js-CUfgfKX8.js → 13.js-BxQtDbrm.js} +2 -2
  125. package/build/server/chunks/nodes/{13.js-CUfgfKX8.js.map → 13.js-BxQtDbrm.js.map} +1 -1
  126. package/build/server/chunks/nodes/{14.js-CpmR68gW.js → 14.js-C3QMbTgy.js} +2 -2
  127. package/build/server/chunks/nodes/{14.js-CpmR68gW.js.map → 14.js-C3QMbTgy.js.map} +1 -1
  128. package/build/server/chunks/nodes/{15.js-BW0gtKnq.js → 15.js-CsBs94ZY.js} +4 -4
  129. package/build/server/chunks/nodes/{15.js-BW0gtKnq.js.map → 15.js-CsBs94ZY.js.map} +1 -1
  130. package/build/server/chunks/nodes/{16.js-B5g2nE2h.js → 16.js-CWZV-PsJ.js} +2 -2
  131. package/build/server/chunks/nodes/{16.js-B5g2nE2h.js.map → 16.js-CWZV-PsJ.js.map} +1 -1
  132. package/build/server/chunks/nodes/{17.js-DtH9vroG.js → 17.js-DvSEwCHI.js} +2 -2
  133. package/build/server/chunks/nodes/{17.js-DtH9vroG.js.map → 17.js-DvSEwCHI.js.map} +1 -1
  134. package/build/server/chunks/nodes/{19.js-Cxa44A2U.js → 19.js-D9o5W1qh.js} +2 -2
  135. package/build/server/chunks/nodes/{19.js-Cxa44A2U.js.map → 19.js-D9o5W1qh.js.map} +1 -1
  136. package/build/server/chunks/nodes/{2.js-kWw2Ylyt.js → 2.js-Dh8FVFjP.js} +2 -2
  137. package/build/server/chunks/nodes/{2.js-kWw2Ylyt.js.map → 2.js-Dh8FVFjP.js.map} +1 -1
  138. package/build/server/chunks/nodes/{20.js-iRXcDwHd.js → 20.js-D6CAMaN-.js} +3 -3
  139. package/build/server/chunks/nodes/{20.js-iRXcDwHd.js.map → 20.js-D6CAMaN-.js.map} +1 -1
  140. package/build/server/chunks/nodes/{21.js-AeiENkX2.js → 21.js-BeyaEoDB.js} +2 -2
  141. package/build/server/chunks/nodes/{21.js-AeiENkX2.js.map → 21.js-BeyaEoDB.js.map} +1 -1
  142. package/build/server/chunks/nodes/{23.js-BmNtZypX.js → 23.js-C33DCuEG.js} +2 -2
  143. package/build/server/chunks/nodes/{23.js-BmNtZypX.js.map → 23.js-C33DCuEG.js.map} +1 -1
  144. package/build/server/chunks/nodes/{24.js-DWFtu5bk.js → 24.js-BAbwQ-Ra.js} +2 -2
  145. package/build/server/chunks/nodes/{24.js-DWFtu5bk.js.map → 24.js-BAbwQ-Ra.js.map} +1 -1
  146. package/build/server/chunks/nodes/{27.js-Pe8lXCKy.js → 27.js-DggOkycU.js} +2 -2
  147. package/build/server/chunks/nodes/{27.js-Pe8lXCKy.js.map → 27.js-DggOkycU.js.map} +1 -1
  148. package/build/server/chunks/nodes/{28.js-lpMEH3gA.js → 28.js-DUyj5KEh.js} +2 -2
  149. package/build/server/chunks/nodes/{28.js-lpMEH3gA.js.map → 28.js-DUyj5KEh.js.map} +1 -1
  150. package/build/server/chunks/nodes/{29.js-Cy4AIGv7.js → 29.js-C0r_Mai4.js} +2 -2
  151. package/build/server/chunks/nodes/{29.js-Cy4AIGv7.js.map → 29.js-C0r_Mai4.js.map} +1 -1
  152. package/build/server/chunks/nodes/{3.js-BxPLpygU.js → 3.js-BNAo_yae.js} +2 -2
  153. package/build/server/chunks/nodes/{3.js-BxPLpygU.js.map → 3.js-BNAo_yae.js.map} +1 -1
  154. package/build/server/chunks/nodes/{30.js-DWd0DQ2G.js → 30.js-DavNG_Ux.js} +2 -2
  155. package/build/server/chunks/nodes/{30.js-DWd0DQ2G.js.map → 30.js-DavNG_Ux.js.map} +1 -1
  156. package/build/server/chunks/nodes/{5.js-By-fdq9u.js → 5.js-CFh7KqyH.js} +2 -2
  157. package/build/server/chunks/nodes/{5.js-By-fdq9u.js.map → 5.js-CFh7KqyH.js.map} +1 -1
  158. package/build/server/chunks/nodes/{6.js-DY2PHAZ9.js → 6.js-Dur0sOKW.js} +2 -2
  159. package/build/server/chunks/nodes/{6.js-DY2PHAZ9.js.map → 6.js-Dur0sOKW.js.map} +1 -1
  160. package/build/server/chunks/nodes/{7.js-MI0lFz6R.js → 7.js-CK1cPGUa.js} +2 -2
  161. package/build/server/chunks/nodes/{7.js-MI0lFz6R.js.map → 7.js-CK1cPGUa.js.map} +1 -1
  162. package/build/server/chunks/nodes/{8.js-FoOsxYb8.js → 8.js-Be64SW1s.js} +2 -2
  163. package/build/server/chunks/nodes/{8.js-FoOsxYb8.js.map → 8.js-Be64SW1s.js.map} +1 -1
  164. package/build/server/chunks/nodes/{9.js-CCdUwKJ8.js → 9.js-BAOPS598.js} +4 -4
  165. package/build/server/chunks/nodes/{9.js-CCdUwKJ8.js.map → 9.js-BAOPS598.js.map} +1 -1
  166. package/package.json +1 -1
  167. package/build/client/_app/immutable/chunks/6dXW0uFp.js.br +0 -0
  168. package/build/client/_app/immutable/chunks/6dXW0uFp.js.gz +0 -0
  169. package/build/client/_app/immutable/chunks/BUuo8-qC.js.br +0 -0
  170. package/build/client/_app/immutable/chunks/BUuo8-qC.js.gz +0 -0
  171. package/build/client/_app/immutable/chunks/BoRTl1dl.js.br +0 -0
  172. package/build/client/_app/immutable/chunks/BoRTl1dl.js.gz +0 -0
  173. package/build/client/_app/immutable/chunks/CQ8eGRBm.js.br +0 -0
  174. package/build/client/_app/immutable/chunks/CQ8eGRBm.js.gz +0 -0
  175. package/build/client/_app/immutable/chunks/E9Z_KaV3.js +0 -3
  176. package/build/client/_app/immutable/chunks/E9Z_KaV3.js.br +0 -0
  177. package/build/client/_app/immutable/chunks/E9Z_KaV3.js.gz +0 -0
  178. package/build/client/_app/immutable/chunks/Gd_kdLxB.js.br +0 -0
  179. package/build/client/_app/immutable/chunks/Gd_kdLxB.js.gz +0 -0
  180. package/build/client/_app/immutable/chunks/ZYeygTkz.js.br +0 -0
  181. package/build/client/_app/immutable/chunks/ZYeygTkz.js.gz +0 -0
  182. package/build/client/_app/immutable/entry/app.CDEkLS2f.js.br +0 -0
  183. package/build/client/_app/immutable/entry/app.CDEkLS2f.js.gz +0 -0
  184. package/build/client/_app/immutable/entry/start.DC_JsWmZ.js +0 -1
  185. package/build/client/_app/immutable/entry/start.DC_JsWmZ.js.br +0 -2
  186. package/build/client/_app/immutable/entry/start.DC_JsWmZ.js.gz +0 -0
  187. package/build/client/_app/immutable/nodes/1.BK108MFt.js.br +0 -0
  188. package/build/client/_app/immutable/nodes/1.BK108MFt.js.gz +0 -0
  189. package/build/client/_app/immutable/nodes/11.D3ISaEUV.js.br +0 -0
  190. package/build/client/_app/immutable/nodes/11.D3ISaEUV.js.gz +0 -0
  191. package/build/client/_app/immutable/nodes/13.C0cBCfJw.js.br +0 -0
  192. package/build/client/_app/immutable/nodes/13.C0cBCfJw.js.gz +0 -0
  193. package/build/client/_app/immutable/nodes/14.DmKgEinA.js.br +0 -0
  194. package/build/client/_app/immutable/nodes/14.DmKgEinA.js.gz +0 -0
  195. package/build/client/_app/immutable/nodes/15.C3NZYZAf.js.br +0 -0
  196. package/build/client/_app/immutable/nodes/15.C3NZYZAf.js.gz +0 -0
  197. package/build/client/_app/immutable/nodes/16.qX2xW2nT.js.br +0 -0
  198. package/build/client/_app/immutable/nodes/16.qX2xW2nT.js.gz +0 -0
  199. package/build/client/_app/immutable/nodes/17.DE08uU78.js.br +0 -0
  200. package/build/client/_app/immutable/nodes/17.DE08uU78.js.gz +0 -0
  201. package/build/client/_app/immutable/nodes/19.BCBsD6Hy.js.br +0 -0
  202. package/build/client/_app/immutable/nodes/19.BCBsD6Hy.js.gz +0 -0
  203. package/build/client/_app/immutable/nodes/2.xrOHE4Zo.js.br +0 -0
  204. package/build/client/_app/immutable/nodes/2.xrOHE4Zo.js.gz +0 -0
  205. package/build/client/_app/immutable/nodes/20.LGtPWLTM.js.br +0 -0
  206. package/build/client/_app/immutable/nodes/20.LGtPWLTM.js.gz +0 -0
  207. package/build/client/_app/immutable/nodes/21.DJjVsf3-.js.br +0 -0
  208. package/build/client/_app/immutable/nodes/21.DJjVsf3-.js.gz +0 -0
  209. package/build/client/_app/immutable/nodes/23.BtmEO5aD.js.br +0 -0
  210. package/build/client/_app/immutable/nodes/24.D-rBZJ1b.js.br +0 -0
  211. package/build/client/_app/immutable/nodes/24.D-rBZJ1b.js.gz +0 -0
  212. package/build/client/_app/immutable/nodes/27.BPH4GZ_b.js.br +0 -0
  213. package/build/client/_app/immutable/nodes/28.B76Z-pIA.js.br +0 -0
  214. package/build/client/_app/immutable/nodes/28.B76Z-pIA.js.gz +0 -0
  215. package/build/client/_app/immutable/nodes/29.lxKzSpY7.js.br +0 -0
  216. package/build/client/_app/immutable/nodes/29.lxKzSpY7.js.gz +0 -0
  217. package/build/client/_app/immutable/nodes/3.DaGoIROJ.js.br +0 -1
  218. package/build/client/_app/immutable/nodes/3.DaGoIROJ.js.gz +0 -0
  219. package/build/client/_app/immutable/nodes/30.2f1y3W7o.js.br +0 -0
  220. package/build/client/_app/immutable/nodes/30.2f1y3W7o.js.gz +0 -0
  221. package/build/client/_app/immutable/nodes/5.D2cJhNMi.js.br +0 -1
  222. package/build/client/_app/immutable/nodes/5.D2cJhNMi.js.gz +0 -0
  223. package/build/client/_app/immutable/nodes/6.gYoJJu2S.js.br +0 -0
  224. package/build/client/_app/immutable/nodes/6.gYoJJu2S.js.gz +0 -0
  225. package/build/client/_app/immutable/nodes/7.C_0_MNpG.js.br +0 -0
  226. package/build/client/_app/immutable/nodes/7.C_0_MNpG.js.gz +0 -0
  227. package/build/client/_app/immutable/nodes/8.DOe_6GAv.js.br +0 -0
  228. package/build/client/_app/immutable/nodes/8.DOe_6GAv.js.gz +0 -0
  229. package/build/client/_app/immutable/nodes/9.Dq-dtKQr.js.br +0 -0
  230. package/build/client/_app/immutable/nodes/9.Dq-dtKQr.js.gz +0 -0
  231. package/build/server/chunks/chunks/package.js-BN1spRaE.js.map +0 -1
  232. package/build/server/chunks/entries/endpoints/api/compute/_server.ts.js-CSllLUvr.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import{_ as gp}from"../chunks/BapAUJpM.js";import"../chunks/DsnmJJEf.js";import{b1 as Fg,bc as Og,bm as zg,P as Bg,O as Ms,Q as Cu,g as u,h as W,s as Oe,u as z,j as Pt,J as wn,p as st,f as ee,a as at,d as ae,c as $,i as wt,r as q,aB as kg,t as Me,aj as Mr,n as yt,b as Ps,K as Vg,bn as vp,e as Hg,ax as th,bo as nh}from"../chunks/BtOVeLcI.js";import{o as dn,s as Ae,a as Xt,d as zi,k as Gg,e as Wg}from"../chunks/BNpXeuQ_.js";import{c as we,a as P,p as Tn,f as Z,t as Et,d as Xg}from"../chunks/BoLtD6vo.js";import{i as xe}from"../chunks/DAQN5y4A.js";import{d as ma,u as Pu,o as jg,p as Nt,L as qg,l as Yg,a as us,D as mc,i as No,M as Kg,b as gc,f as _l,g as xl,A as Zg,U as $g}from"../chunks/Gd_kdLxB.js";import{S as Jg}from"../chunks/BRHPfB44.js";import{M as Qg,l as ev,m as tv,q as _p,r as nv,s as iv,t as rv,v as sv,w as av,x as ov,A as lv,o as cv,f as xp,u as uv,g as dv,y as hv,a as fv,k as pv}from"../chunks/SM988pE-.js";import{f as Ft,r as Ru,e as Zt,a as Qt,c as Dt,d as Uo,k as bp,l as bl,j as Ii,s as mv}from"../chunks/22C0ZkpD.js";import{s as mt,r as ut,p as le,c as Ne,b as ui}from"../chunks/ChEZL1UP.js";import{p as ih}from"../chunks/ZYeygTkz.js";import{a as tl,o as yp}from"../chunks/C4cbQnXC.js";import{w as bo,F as rh}from"../chunks/aGXM-hZQ.js";import{b as Sp}from"../chunks/Bfsx6G_D.js";import{S as na}from"../chunks/CkeXmJE0.js";import{S as Fo}from"../chunks/BdIvVr5K.js";import{S as sh}from"../chunks/CitY1SZ1.js";import{C as Du}from"../chunks/Bj6y_fSA.js";import{I as fn,c as ci}from"../chunks/BuC_QZkR.js";import{X as gv}from"../chunks/Ca8xAcDY.js";import{R as wr,D as Er,b as dr,a as ms,c as gs}from"../chunks/jiMRToiE.js";import{s as pt}from"../chunks/8uBOzWQA.js";import{a as bi,e as Pr,h as Oo,x as vv,c as Lu,b as Vn,d as Qe,m as jt,s as vc,r as Iu,S as _v,y as xv}from"../chunks/Bf2Kb0d4.js";import{C as pr,w as fr,E as bv,S as yv,h as Mp,n as Un,d as wp,e as Ep,a as Tp,A as Ap,H as Cp,c as Pp,j as Rp}from"../chunks/MGblXd4C.js";import{i as Sv,H as Mv,F as Dp,P as Lp,c as Ip,g as zo,d as Np,o as Up,R as wv,S as Ev,a as Tv,b as Av}from"../chunks/DNdxyuBP.js";import{C as ia}from"../chunks/LZnjyP_x.js";import{B as Bn}from"../chunks/mlApEF2J.js";import{P as Cv,F as ah,D as yl,U as oh}from"../chunks/CFq1UfS7.js";import{h as Pv}from"../chunks/ClDgNAKE.js";import{T as Rv,a as Dv,b as Lv,d as Iv,c as Nv}from"../chunks/BVUbFuzT.js";import{C as Fp,a as vs}from"../chunks/BawNisij.js";import{C as Op}from"../chunks/Mn4D08zE.js";import{T as yo}from"../chunks/DllGpGf3.js";import{C as Uv,a as Fv}from"../chunks/CY6l1SkO.js";import{C as Ov}from"../chunks/C2PlvXZq.js";import{C as zv}from"../chunks/C0Xb3vka.js";import{L as or}from"../chunks/wegQDfR0.js";import{a as Bv}from"../chunks/6dXW0uFp.js";import{I as _s}from"../chunks/CJvX1bCR.js";import{M as kv,C as Vv,I as Hv}from"../chunks/C38beKZN.js";import{t as Gv}from"../chunks/ADO9qhNc.js";import{F as Wv}from"../chunks/k1GnUs7f.js";import{r as Xv}from"../chunks/Cbu9Tg11.js";import{C as jv}from"../chunks/3w4Rd2x8.js";import{inflateSync as qv}from"../chunks/BzBbrBKd.js";const Yv=[];function Nu(n,e=!1,t=!1){return So(n,new Map,"",Yv,null,t)}function So(n,e,t,i,r=null,s=!1){if(typeof n=="object"&&n!==null){var a=e.get(n);if(a!==void 0)return a;if(n instanceof Map)return new Map(n);if(n instanceof Set)return new Set(n);if(Fg(n)){var o=Array(n.length);e.set(n,o),r!==null&&e.set(r,o);for(var l=0;l<n.length;l+=1){var c=n[l];l in n&&(o[l]=So(c,e,t,i,null,s))}return o}if(Og(n)===zg){o={},e.set(n,o),r!==null&&e.set(r,o);for(var d of Object.keys(n))o[d]=So(n[d],e,t,i,null,s);return o}if(n instanceof Date)return structuredClone(n);if(typeof n.toJSON=="function"&&!s)return So(n.toJSON(),e,t,i,n)}if(n instanceof EventTarget)return n;try{return structuredClone(n)}catch{return n}}class Kv{#e;#t;constructor(e){this.#e=e,this.#t=Symbol(e)}get key(){return this.#t}exists(){return Bg(this.#t)}get(){const e=Ms(this.#t);if(e===void 0)throw new Error(`Context "${this.#e}" not found`);return e}getOr(e){const t=Ms(this.#t);return t===void 0?e:t}set(e){return Cu(this.#t,e)}}function lh(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}],["path",{d:"m3.3 7 8.7 5 8.7-5"}],["path",{d:"M12 22V12"}]];fn(n,mt({name:"box"},()=>t,{get iconNode(){return i}}))}function Zv(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"}],["circle",{cx:"12",cy:"13",r:"3"}]];fn(n,mt({name:"camera"},()=>t,{get iconNode(){return i}}))}function $v(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335"}],["path",{d:"m9 11 3 3L22 4"}]];fn(n,mt({name:"circle-check-big"},()=>t,{get iconNode(){return i}}))}function ch(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}],["path",{d:"M12 17h.01"}]];fn(n,mt({name:"circle-question-mark"},()=>t,{get iconNode(){return i}}))}function zp(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M12 15V3"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}],["path",{d:"m7 10 5 5 5-5"}]];fn(n,mt({name:"download"},()=>t,{get iconNode(){return i}}))}function Sl(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}],["path",{d:"m2 2 20 20"}]];fn(n,mt({name:"eye-off"},()=>t,{get iconNode(){return i}}))}function Ml(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}],["circle",{cx:"12",cy:"12",r:"3"}]];fn(n,mt({name:"eye"},()=>t,{get iconNode(){return i}}))}function Jv(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}]];fn(n,mt({name:"file"},()=>t,{get iconNode(){return i}}))}function Qv(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}]];fn(n,mt({name:"folder"},()=>t,{get iconNode(){return i}}))}function e0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["line",{x1:"22",x2:"2",y1:"6",y2:"6"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22"}]];fn(n,mt({name:"frame"},()=>t,{get iconNode(){return i}}))}function t0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M3 9h18"}],["path",{d:"M3 15h18"}],["path",{d:"M9 3v18"}],["path",{d:"M15 3v18"}]];fn(n,mt({name:"grid-3x3"},()=>t,{get iconNode(){return i}}))}function n0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}]];fn(n,mt({name:"inbox"},()=>t,{get iconNode(){return i}}))}function i0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"}]];fn(n,mt({name:"layers"},()=>t,{get iconNode(){return i}}))}function r0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"}]];fn(n,mt({name:"link"},()=>t,{get iconNode(){return i}}))}function Uu(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M12 2v4"}],["path",{d:"m16.2 7.8 2.9-2.9"}],["path",{d:"M18 12h4"}],["path",{d:"m16.2 16.2 2.9 2.9"}],["path",{d:"M12 18v4"}],["path",{d:"m4.9 19.1 2.9-2.9"}],["path",{d:"M2 12h4"}],["path",{d:"m4.9 4.9 2.9 2.9"}]];fn(n,mt({name:"loader"},()=>t,{get iconNode(){return i}}))}function Fu(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"}]];fn(n,mt({name:"maximize"},()=>t,{get iconNode(){return i}}))}function Ou(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"}]];fn(n,mt({name:"minimize"},()=>t,{get iconNode(){return i}}))}function s0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z"}],["path",{d:"m14.5 12.5 2-2"}],["path",{d:"m11.5 9.5 2-2"}],["path",{d:"m8.5 6.5 2-2"}],["path",{d:"m17.5 15.5 2-2"}]];fn(n,mt({name:"ruler"},()=>t,{get iconNode(){return i}}))}function a0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M14 17H5"}],["path",{d:"M19 7h-9"}],["circle",{cx:"17",cy:"17",r:"3"}],["circle",{cx:"7",cy:"7",r:"3"}]];fn(n,mt({name:"settings-2"},()=>t,{get iconNode(){return i}}))}function o0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}]];fn(n,mt({name:"square"},()=>t,{get iconNode(){return i}}))}function l0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"}]];fn(n,mt({name:"zap"},()=>t,{get iconNode(){return i}}))}function c0(n,e){if(Sv(n)){const i=n();return i===void 0?e:i}return n===void 0?e:n}function nl(n,e){let t=Oe(null);const i=z(()=>c0(e,250));function r(...s){if(u(t))u(t).timeout&&clearTimeout(u(t).timeout);else{let a,o;const l=new Promise((c,d)=>{a=c,o=d});W(t,{timeout:null,runner:null,promise:l,resolve:a,reject:o},!0)}return u(t).runner=async()=>{if(!u(t))return;const a=u(t);W(t,null);try{a.resolve(await n.apply(this,s))}catch(o){a.reject(o)}},u(t).timeout=setTimeout(u(t).runner,u(i)),u(t).promise}return r.cancel=async()=>{(!u(t)||u(t).timeout===null)&&(await new Promise(s=>setTimeout(s,0)),!u(t)||u(t).timeout===null)||(clearTimeout(u(t).timeout),u(t).reject("Cancelled"),W(t,null))},r.runScheduledNow=async()=>{(!u(t)||!u(t).timeout)&&(await new Promise(s=>setTimeout(s,0)),!u(t)||!u(t).timeout)||(clearTimeout(u(t).timeout),u(t).timeout=null,await u(t).runner?.())},Object.defineProperty(r,"pending",{enumerable:!0,get(){return!!u(t)?.timeout}}),r}class zu{#e=Oe(!1);constructor(){Pt(()=>(wn(()=>W(this.#e,!0)),()=>{W(this.#e,!1)}))}get current(){return u(this.#e)}}const u0=Lu({component:"checkbox",parts:["root","group","group-label","input"]}),d0=new pr("Checkbox.Group"),Bp=new pr("Checkbox.Root");class Bu{static create(e,t=null){return Bp.set(new Bu(e,t))}opts;group;#e=z(()=>this.group&&this.group.opts.name.current?this.group.opts.name.current:this.opts.name.current);get trueName(){return u(this.#e)}set trueName(e){W(this.#e,e)}#t=z(()=>this.group&&this.group.opts.required.current?!0:this.opts.required.current);get trueRequired(){return u(this.#t)}set trueRequired(e){W(this.#t,e)}#n=z(()=>this.group&&this.group.opts.disabled.current?!0:this.opts.disabled.current);get trueDisabled(){return u(this.#n)}set trueDisabled(e){W(this.#n,e)}#i=z(()=>this.group&&this.group.opts.readonly.current?!0:this.opts.readonly.current);get trueReadonly(){return u(this.#i)}set trueReadonly(e){W(this.#i,e)}attachment;constructor(e,t){this.opts=e,this.group=t,this.attachment=bi(this.opts.ref),this.onkeydown=this.onkeydown.bind(this),this.onclick=this.onclick.bind(this),fr.pre([()=>Nu(this.group?.opts.value.current),()=>this.opts.value.current],([i,r])=>{!i||!r||(this.opts.checked.current=i.includes(r))}),fr.pre(()=>this.opts.checked.current,i=>{this.group&&(i?this.group?.addValue(this.opts.value.current):this.group?.removeValue(this.opts.value.current))})}onkeydown(e){if(!(this.trueDisabled||this.trueReadonly)){if(e.key===bv){e.preventDefault(),this.opts.type.current==="submit"&&e.currentTarget.closest("form")?.requestSubmit();return}e.key===yv&&(e.preventDefault(),this.#r())}}#r(){this.opts.indeterminate.current?(this.opts.indeterminate.current=!1,this.opts.checked.current=!0):this.opts.checked.current=!this.opts.checked.current}onclick(e){if(!(this.trueDisabled||this.trueReadonly)){if(this.opts.type.current==="submit"){this.#r();return}e.preventDefault(),this.#r()}}#s=z(()=>({checked:this.opts.checked.current,indeterminate:this.opts.indeterminate.current}));get snippetProps(){return u(this.#s)}set snippetProps(e){W(this.#s,e)}#a=z(()=>({id:this.opts.id.current,role:"checkbox",type:this.opts.type.current,disabled:this.trueDisabled,"aria-checked":vv(this.opts.checked.current,this.opts.indeterminate.current),"aria-required":Oo(this.trueRequired),"aria-readonly":Oo(this.trueReadonly),"data-disabled":Pr(this.trueDisabled),"data-readonly":Pr(this.trueReadonly),"data-state":h0(this.opts.checked.current,this.opts.indeterminate.current),[u0.root]:"",onclick:this.onclick,onkeydown:this.onkeydown,...this.attachment}));get props(){return u(this.#a)}set props(e){W(this.#a,e)}}class ku{static create(){return new ku(Bp.get())}root;#e=z(()=>this.root.group?!!(this.root.opts.value.current!==void 0&&this.root.group.opts.value.current.includes(this.root.opts.value.current)):this.root.opts.checked.current);get trueChecked(){return u(this.#e)}set trueChecked(e){W(this.#e,e)}#t=z(()=>!!this.root.trueName);get shouldRender(){return u(this.#t)}set shouldRender(e){W(this.#t,e)}constructor(e){this.root=e,this.onfocus=this.onfocus.bind(this)}onfocus(e){Mp(this.root.opts.ref.current)&&this.root.opts.ref.current.focus()}#n=z(()=>({type:"checkbox",checked:this.root.opts.checked.current===!0,disabled:this.root.trueDisabled,required:this.root.trueRequired,name:this.root.trueName,value:this.root.opts.value.current,readonly:this.root.trueReadonly,onfocus:this.onfocus}));get props(){return u(this.#n)}set props(e){W(this.#n,e)}}function h0(n,e){return e?"indeterminate":n?"checked":"unchecked"}function f0(n,e){st(e,!0);const t=ku.create();var i=we(),r=ee(i);{var s=a=>{Mv(a,mt(()=>t.props))};xe(r,a=>{t.shouldRender&&a(s)})}P(n,i),at()}var p0=Z("<button><!></button>"),m0=Z("<!> <!>",1);function g0(n,e){const t=Tn();st(e,!0);let i=le(e,"checked",15,!1),r=le(e,"ref",15,null),s=le(e,"disabled",3,!1),a=le(e,"required",3,!1),o=le(e,"name",3,void 0),l=le(e,"value",3,"on"),c=le(e,"id",19,()=>Vn(t)),d=le(e,"indeterminate",15,!1),f=le(e,"type",3,"button"),h=ut(e,["$$slots","$$events","$$legacy","checked","ref","onCheckedChange","children","disabled","required","name","value","id","indeterminate","onIndeterminateChange","child","type","readonly"]);const p=d0.getOr(null);p&&l()&&(p.opts.value.current.includes(l())?i(!0):i(!1)),fr.pre(()=>l(),()=>{p&&l()&&(p.opts.value.current.includes(l())?i(!0):i(!1))});const m=Bu.create({checked:Qe(()=>i(),E=>{i(E),e.onCheckedChange?.(E)}),disabled:Qe(()=>s()??!1),required:Qe(()=>a()),name:Qe(()=>o()),value:Qe(()=>l()),id:Qe(()=>c()),ref:Qe(()=>r(),E=>r(E)),indeterminate:Qe(()=>d(),E=>{d(E),e.onIndeterminateChange?.(E)}),type:Qe(()=>f()),readonly:Qe(()=>!!e.readonly)},p),x=z(()=>jt({...h},m.props));var v=m0(),g=ee(v);{var y=E=>{var S=we(),A=ee(S);{let _=z(()=>({props:u(x),...m.snippetProps}));pt(A,()=>e.child,()=>u(_))}P(E,S)},w=E=>{var S=p0();Ft(S,()=>({...u(x)}));var A=$(S);pt(A,()=>e.children??wt,()=>m.snippetProps),q(S),P(E,S)};xe(g,E=>{e.child?E(y):E(w,-1)})}var b=ae(g,2);f0(b,{}),P(n,v),at()}function v0(n,e){st(e,!0);let t=le(e,"open",15,!1),i=le(e,"onOpenChange",3,Un),r=le(e,"onOpenChangeComplete",3,Un);Qg.create({open:Qe(()=>t(),s=>{t(s),i()?.(s)}),onOpenChangeComplete:Qe(()=>r())}),Dp(n,{children:(s,a)=>{var o=we(),l=ee(o);pt(l,()=>e.children??wt),P(s,o)},$$slots:{default:!0}}),at()}var _0=Z("<div><!></div>");function Ji(n,e){const t=Tn();st(e,!0);let i=le(e,"ref",15,null),r=le(e,"id",19,()=>Vn(t)),s=le(e,"disabled",3,!1),a=le(e,"onSelect",3,Un),o=le(e,"closeOnSelect",3,!0),l=ut(e,["$$slots","$$events","$$legacy","child","children","ref","id","disabled","onSelect","closeOnSelect"]);const c=ev.create({id:Qe(()=>r()),disabled:Qe(()=>s()),onSelect:Qe(()=>a()),ref:Qe(()=>i(),x=>i(x)),closeOnSelect:Qe(()=>o())}),d=z(()=>jt(l,c.props));var f=we(),h=ee(f);{var p=x=>{var v=we(),g=ee(v);pt(g,()=>e.child,()=>({props:u(d)})),P(x,v)},m=x=>{var v=_0();Ft(v,()=>({...u(d)}));var g=$(v);pt(g,()=>e.children??wt),q(v),P(x,v)};xe(h,x=>{e.child?x(p):x(m,-1)})}P(n,f),at()}var x0=Z("<div><!></div>");function b0(n,e){const t=Tn();st(e,!0);let i=le(e,"ref",15,null),r=le(e,"id",19,()=>Vn(t)),s=ut(e,["$$slots","$$events","$$legacy","ref","id","child","children"]);const a=tv.create({id:Qe(()=>r()),ref:Qe(()=>i(),h=>i(h))}),o=z(()=>jt(s,a.props));var l=we(),c=ee(l);{var d=h=>{var p=we(),m=ee(p);pt(m,()=>e.child,()=>({props:u(o)})),P(h,p)},f=h=>{var p=x0();Ft(p,()=>({...u(o)}));var m=$(p);pt(m,()=>e.children??wt),q(p),P(h,p)};xe(c,h=>{e.child?h(d):h(f,-1)})}P(n,l),at()}var y0=Z("<div><div><!></div></div>"),S0=Z("<div><div><!></div></div>");function M0(n,e){const t=Tn();st(e,!0);let i=le(e,"id",19,()=>Vn(t)),r=le(e,"ref",15,null),s=le(e,"loop",3,!0),a=le(e,"onInteractOutside",3,Un),o=le(e,"forceMount",3,!1),l=le(e,"onEscapeKeydown",3,Un),c=le(e,"interactOutsideBehavior",3,"defer-otherwise-close"),d=le(e,"escapeKeydownBehavior",3,"defer-otherwise-close"),f=le(e,"onOpenAutoFocus",3,Un),h=le(e,"onCloseAutoFocus",3,Un),p=le(e,"onFocusOutside",3,Un),m=le(e,"side",3,"right"),x=le(e,"trapFocus",3,!1),v=ut(e,["$$slots","$$events","$$legacy","id","ref","children","child","loop","onInteractOutside","forceMount","onEscapeKeydown","interactOutsideBehavior","escapeKeydownBehavior","onOpenAutoFocus","onCloseAutoFocus","onFocusOutside","side","trapFocus","style"]);const g=_p.create({id:Qe(()=>i()),loop:Qe(()=>s()),ref:Qe(()=>r(),U=>r(U)),isSub:!0,onCloseAutoFocus:Qe(()=>S)});function y(U){const N=U.currentTarget.contains(U.target),R=iv[g.parentMenu.root.opts.dir.current].includes(U.key);N&&R&&(g.parentMenu.onClose(),g.parentMenu.triggerNode?.focus(),U.preventDefault())}const w=z(()=>g.parentMenu.root.getBitsAttr("sub-content")),b=z(()=>jt(v,g.props,{side:m(),onkeydown:y,[u(w)]:""}));function E(U){f()(U),!U.defaultPrevented&&(U.preventDefault(),g.parentMenu.root.isUsingKeyboard&&g.parentMenu.contentNode&&nv.dispatch(g.parentMenu.contentNode))}function S(U){h()(U),!U.defaultPrevented&&U.preventDefault()}function A(U){a()(U),!U.defaultPrevented&&g.parentMenu.onClose()}function _(U){l()(U),!U.defaultPrevented&&g.parentMenu.onClose()}function T(U){if(p()(U),U.defaultPrevented||!Mp(U.target)||U.target.id===g.parentMenu.triggerNode?.id)return;if(g.parentMenu.parentMenu?.contentNode?.contains(U.target)){g.parentMenu.onClose(),U.preventDefault();return}const R=`[${g.parentMenu.root.getBitsAttr("sub-content")}]`;if(U.target.closest(R)){U.preventDefault();return}g.parentMenu.onClose()}var D=we(),L=ee(D);{var F=U=>{Lp(U,mt(()=>u(b),{get ref(){return g.opts.ref},get interactOutsideBehavior(){return c()},get escapeKeydownBehavior(){return d()},onOpenAutoFocus:E,get enabled(){return g.parentMenu.opts.open.current},onInteractOutside:A,onEscapeKeydown:_,onFocusOutside:T,preventScroll:!1,get loop(){return s()},get trapFocus(){return x()},get shouldRender(){return g.shouldRender},popper:(R,O)=>{let Y=()=>(O?.()).props,K=()=>(O?.()).wrapperProps;const ne=z(()=>jt(Y(),u(b),{style:zo("menu")},{style:e.style}));var ce=we(),k=ee(ce);{var te=me=>{var G=we(),Q=ee(G);{let j=z(()=>({props:u(ne),wrapperProps:K(),...g.snippetProps}));pt(Q,()=>e.child,()=>u(j))}P(me,G)},fe=me=>{var G=y0();Ft(G,()=>({...K()}));var Q=$(G);Ft(Q,()=>({...u(ne)}));var j=$(Q);pt(j,()=>e.children??wt),q(Q),q(G),P(me,G)};xe(k,me=>{e.child?me(te):me(fe,-1)})}P(R,ce)},$$slots:{popper:!0}}))},B=U=>{Ip(U,mt(()=>u(b),{get ref(){return g.opts.ref},get interactOutsideBehavior(){return c()},get escapeKeydownBehavior(){return d()},onCloseAutoFocus:S,onOpenAutoFocus:E,get open(){return g.parentMenu.opts.open.current},onInteractOutside:A,onEscapeKeydown:_,onFocusOutside:T,preventScroll:!1,get loop(){return s()},get trapFocus(){return x()},get shouldRender(){return g.shouldRender},popper:(R,O)=>{let Y=()=>(O?.()).props,K=()=>(O?.()).wrapperProps;const ne=z(()=>jt(Y(),u(b),{style:zo("menu")},{style:e.style}));var ce=we(),k=ee(ce);{var te=me=>{var G=we(),Q=ee(G);{let j=z(()=>({props:u(ne),wrapperProps:K(),...g.snippetProps}));pt(Q,()=>e.child,()=>u(j))}P(me,G)},fe=me=>{var G=S0();Ft(G,()=>({...K()}));var Q=$(G);Ft(Q,()=>({...u(ne)}));var j=$(Q);pt(j,()=>e.children??wt),q(Q),q(G),P(me,G)};xe(k,me=>{e.child?me(te):me(fe,-1)})}P(R,ce)},$$slots:{popper:!0}}))};xe(L,U=>{o()?U(F):o()||U(B,1)})}P(n,D),at()}var w0=Z("<div><!></div>");function E0(n,e){const t=Tn();st(e,!0);let i=le(e,"id",19,()=>Vn(t)),r=le(e,"disabled",3,!1),s=le(e,"ref",15,null),a=le(e,"onSelect",3,Un),o=le(e,"openDelay",3,0),l=ut(e,["$$slots","$$events","$$legacy","id","disabled","ref","children","child","onSelect","openDelay"]);const c=rv.create({disabled:Qe(()=>r()),onSelect:Qe(()=>a()),id:Qe(()=>i()),ref:Qe(()=>s(),f=>s(f)),openDelay:Qe(()=>o())}),d=z(()=>jt(l,c.props));Np(n,{get id(){return i()},get ref(){return c.opts.ref},children:(f,h)=>{var p=we(),m=ee(p);{var x=g=>{var y=we(),w=ee(y);pt(w,()=>e.child,()=>({props:u(d)})),P(g,y)},v=g=>{var y=w0();Ft(y,()=>({...u(d)}));var w=$(y);pt(w,()=>e.children??wt),q(y),P(g,y)};xe(m,g=>{e.child?g(x):g(v,-1)})}P(f,p)},$$slots:{default:!0}}),at()}function T0(n,e){st(e,!0);let t=le(e,"open",15,!1),i=le(e,"dir",3,"ltr"),r=le(e,"onOpenChange",3,Un),s=le(e,"onOpenChangeComplete",3,Un),a=le(e,"_internal_variant",3,"dropdown-menu"),o=le(e,"_internal_should_skip_exit_animation",3,void 0);const l=sv.create({variant:Qe(()=>a()),dir:Qe(()=>i()),onClose:()=>{t(!1),r()(!1)},shouldSkipExitAnimation:()=>o()?.()??!1});av.create({open:Qe(()=>t(),c=>{t(c),r()(c)}),onOpenChangeComplete:Qe(()=>s())},l),Dp(n,{children:(c,d)=>{var f=we(),h=ee(f);pt(h,()=>e.children??wt),P(c,f)},$$slots:{default:!0}}),at()}var A0=Z("<div><div><!></div></div>"),C0=Z("<div><div><!></div></div>");function P0(n,e){const t=Tn();st(e,!0);let i=le(e,"id",19,()=>Vn(t)),r=le(e,"ref",15,null),s=le(e,"loop",3,!0),a=le(e,"onInteractOutside",3,Un),o=le(e,"onEscapeKeydown",3,Un),l=le(e,"onCloseAutoFocus",3,Un),c=le(e,"forceMount",3,!1),d=le(e,"trapFocus",3,!1),f=ut(e,["$$slots","$$events","$$legacy","id","child","children","ref","loop","onInteractOutside","onEscapeKeydown","onCloseAutoFocus","forceMount","trapFocus","style"]);const h=_p.create({id:Qe(()=>i()),loop:Qe(()=>s()),ref:Qe(()=>r(),b=>r(b)),onCloseAutoFocus:Qe(()=>l())}),p=z(()=>jt(f,h.props));function m(b){if(h.handleInteractOutside(b),!b.defaultPrevented&&(a()(b),!b.defaultPrevented)){if(b.target&&b.target instanceof Element){const E=`[${h.parentMenu.root.getBitsAttr("sub-content")}]`;if(b.target.closest(E))return}h.parentMenu.onClose()}}function x(b){o()(b),!b.defaultPrevented&&h.parentMenu.onClose()}var v=we(),g=ee(v);{var y=b=>{Lp(b,mt(()=>u(p),()=>h.popperProps,{get ref(){return h.opts.ref},get enabled(){return h.parentMenu.opts.open.current},onInteractOutside:m,onEscapeKeydown:x,get trapFocus(){return d()},get loop(){return s()},forceMount:!0,get id(){return i()},get shouldRender(){return h.shouldRender},popper:(S,A)=>{let _=()=>(A?.()).props,T=()=>(A?.()).wrapperProps;const D=z(()=>jt(_(),{style:zo("dropdown-menu")},{style:e.style}));var L=we(),F=ee(L);{var B=N=>{var R=we(),O=ee(R);{let Y=z(()=>({props:u(D),wrapperProps:T(),...h.snippetProps}));pt(O,()=>e.child,()=>u(Y))}P(N,R)},U=N=>{var R=A0();Ft(R,()=>({...T()}));var O=$(R);Ft(O,()=>({...u(D)}));var Y=$(O);pt(Y,()=>e.children??wt),q(O),q(R),P(N,R)};xe(F,N=>{e.child?N(B):N(U,-1)})}P(S,L)},$$slots:{popper:!0}}))},w=b=>{Ip(b,mt(()=>u(p),()=>h.popperProps,{get ref(){return h.opts.ref},get open(){return h.parentMenu.opts.open.current},onInteractOutside:m,onEscapeKeydown:x,get trapFocus(){return d()},get loop(){return s()},forceMount:!1,get id(){return i()},get shouldRender(){return h.shouldRender},popper:(S,A)=>{let _=()=>(A?.()).props,T=()=>(A?.()).wrapperProps;const D=z(()=>jt(_(),{style:zo("dropdown-menu")},{style:e.style}));var L=we(),F=ee(L);{var B=N=>{var R=we(),O=ee(R);{let Y=z(()=>({props:u(D),wrapperProps:T(),...h.snippetProps}));pt(O,()=>e.child,()=>u(Y))}P(N,R)},U=N=>{var R=C0();Ft(R,()=>({...T()}));var O=$(R);Ft(O,()=>({...u(D)}));var Y=$(O);pt(Y,()=>e.children??wt),q(O),q(R),P(N,R)};xe(F,N=>{e.child?N(B):N(U,-1)})}P(S,L)},$$slots:{popper:!0}}))};xe(g,b=>{c()?b(y):c()||b(w,1)})}P(n,v),at()}var R0=Z("<button><!></button>");function D0(n,e){const t=Tn();st(e,!0);let i=le(e,"id",19,()=>Vn(t)),r=le(e,"ref",15,null),s=le(e,"disabled",3,!1),a=le(e,"type",3,"button"),o=ut(e,["$$slots","$$events","$$legacy","id","ref","child","children","disabled","type"]);const l=ov.create({id:Qe(()=>i()),disabled:Qe(()=>s()??!1),ref:Qe(()=>r(),d=>r(d))}),c=z(()=>jt(o,l.props,{type:a()}));Np(n,{get id(){return i()},get ref(){return l.opts.ref},children:(d,f)=>{var h=we(),p=ee(h);{var m=v=>{var g=we(),y=ee(g);pt(y,()=>e.child,()=>({props:u(c)})),P(v,g)},x=v=>{var g=R0();Ft(g,()=>({...u(c)}));var y=$(g);pt(y,()=>e.children??wt),q(g),P(v,g)};xe(p,v=>{e.child?v(m):v(x,-1)})}P(d,h)},$$slots:{default:!0}}),at()}class Rr{#e;#t;constructor(e,t){this.#e=e,this.#t=t,this.handler=this.handler.bind(this),Pt(this.handler)}handler(){let e=0;const t=this.#e();if(!t)return;const i=new ResizeObserver(()=>{cancelAnimationFrame(e),e=window.requestAnimationFrame(this.#t)});return i.observe(t),()=>{window.cancelAnimationFrame(e),i.unobserve(t)}}}class L0{opts;present;#e;#t=Oe(!1);#n=!1;#i=Oe(void 0);#r=null;constructor(e){this.opts=e,this.present=this.opts.open,W(this.#t,e.open.current,!0),this.#e=new lv({ref:this.opts.ref,afterTick:this.opts.open}),cv(()=>this.#a()),fr(()=>this.present.current,t=>{if(!this.#n){this.#n=!0;return}this.#a(),t&&W(this.#t,!0),W(this.#i,t?"starting":"ending",!0),t&&(this.#r=window.requestAnimationFrame(()=>{this.#r=null,this.present.current&&W(this.#i,void 0)})),this.#e.run(()=>{t===this.present.current&&(t||W(this.#t,!1),W(this.#i,void 0))})})}#s=z(()=>u(this.#t));get isPresent(){return u(this.#s)}set isPresent(e){W(this.#s,e)}get transitionStatus(){return u(this.#i)}#a(){this.#r!==null&&(window.cancelAnimationFrame(this.#r),this.#r=null)}}function il(n,e){st(e,!0);const t=new L0({open:Qe(()=>e.open),ref:e.ref});var i=we(),r=ee(i);{var s=a=>{var o=we(),l=ee(o);pt(l,()=>e.presence??wt,()=>({present:t.isPresent,transitionStatus:t.transitionStatus})),P(a,o)};xe(r,a=>{(e.forceMount||e.open||t.isPresent)&&a(s)})}P(n,i),at()}function I0(n,e,t){return Math.min(t,Math.max(e,n))}class N0{state;#e;constructor(e,t){this.state=vc(e),this.#e=t,this.dispatch=this.dispatch.bind(this)}#t(e){return this.#e[this.state.current][e]??this.state.current}dispatch(e){this.state.current=this.#t(e)}}const ga=Lu({component:"scroll-area",parts:["root","viewport","corner","thumb","scrollbar"]}),va=new pr("ScrollArea.Root"),_a=new pr("ScrollArea.Scrollbar"),rl=new pr("ScrollArea.ScrollbarVisible"),Vu=new pr("ScrollArea.ScrollbarAxis"),kp=new pr("ScrollArea.ScrollbarShared");class Hu{static create(e){return va.set(new Hu(e))}opts;attachment;#e=Oe(null);get scrollAreaNode(){return u(this.#e)}set scrollAreaNode(e){W(this.#e,e,!0)}#t=Oe(null);get viewportNode(){return u(this.#t)}set viewportNode(e){W(this.#t,e,!0)}#n=Oe(null);get contentNode(){return u(this.#n)}set contentNode(e){W(this.#n,e,!0)}#i=Oe(null);get scrollbarXNode(){return u(this.#i)}set scrollbarXNode(e){W(this.#i,e,!0)}#r=Oe(null);get scrollbarYNode(){return u(this.#r)}set scrollbarYNode(e){W(this.#r,e,!0)}#s=Oe(0);get cornerWidth(){return u(this.#s)}set cornerWidth(e){W(this.#s,e,!0)}#a=Oe(0);get cornerHeight(){return u(this.#a)}set cornerHeight(e){W(this.#a,e,!0)}#o=Oe(!1);get scrollbarXEnabled(){return u(this.#o)}set scrollbarXEnabled(e){W(this.#o,e,!0)}#l=Oe(!1);get scrollbarYEnabled(){return u(this.#l)}set scrollbarYEnabled(e){W(this.#l,e,!0)}domContext;constructor(e){this.opts=e,this.attachment=bi(e.ref,t=>this.scrollAreaNode=t),this.domContext=new xp(e.ref)}#c=z(()=>({id:this.opts.id.current,dir:this.opts.dir.current,style:{position:"relative","--bits-scroll-area-corner-height":`${this.cornerHeight}px`,"--bits-scroll-area-corner-width":`${this.cornerWidth}px`},[ga.root]:"",...this.attachment}));get props(){return u(this.#c)}set props(e){W(this.#c,e)}}class Gu{static create(e){return new Gu(e,va.get())}opts;root;attachment;#e=vc(uv());#t=vc(null);contentAttachment=bi(this.#t,e=>this.root.contentNode=e);constructor(e,t){this.opts=e,this.root=t,this.attachment=bi(e.ref,i=>this.root.viewportNode=i)}#n=z(()=>({id:this.opts.id.current,style:{overflowX:this.root.scrollbarXEnabled?"scroll":"hidden",overflowY:this.root.scrollbarYEnabled?"scroll":"hidden"},[ga.viewport]:"",...this.attachment}));get props(){return u(this.#n)}set props(e){W(this.#n,e)}#i=z(()=>({id:this.#e.current,"data-scroll-area-content":"",style:{minWidth:this.root.scrollbarXEnabled?"fit-content":void 0},...this.contentAttachment}));get contentProps(){return u(this.#i)}set contentProps(e){W(this.#i,e)}}class Wu{static create(e){return _a.set(new Wu(e,va.get()))}opts;root;#e=z(()=>this.opts.orientation.current==="horizontal");get isHorizontal(){return u(this.#e)}set isHorizontal(e){W(this.#e,e)}#t=Oe(!1);get hasThumb(){return u(this.#t)}set hasThumb(e){W(this.#t,e,!0)}constructor(e,t){this.opts=e,this.root=t,fr(()=>this.isHorizontal,i=>i?(this.root.scrollbarXEnabled=!0,()=>{this.root.scrollbarXEnabled=!1}):(this.root.scrollbarYEnabled=!0,()=>{this.root.scrollbarYEnabled=!1}))}}class Xu{static create(){return new Xu(_a.get())}scrollbar;root;#e=Oe(!1);get isVisible(){return u(this.#e)}set isVisible(e){W(this.#e,e,!0)}constructor(e){this.scrollbar=e,this.root=e.root,Pt(()=>{const t=this.root.scrollAreaNode,i=this.root.opts.scrollHideDelay.current;let r=0;if(!t)return;const s=()=>{this.root.domContext.clearTimeout(r),wn(()=>this.isVisible=!0)},a=()=>{r&&this.root.domContext.clearTimeout(r),r=this.root.domContext.setTimeout(()=>{wn(()=>{this.scrollbar.hasThumb=!1,this.isVisible=!1})},i)},o=Iu(dn(t,"pointerenter",s),dn(t,"pointerleave",a));return()=>{this.root.domContext.getWindow().clearTimeout(r),o()}})}#t=z(()=>({"data-state":this.isVisible?"visible":"hidden"}));get props(){return u(this.#t)}set props(e){W(this.#t,e)}}class ju{static create(){return new ju(_a.get())}scrollbar;root;machine=new N0("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});#e=z(()=>this.machine.state.current==="hidden");get isHidden(){return u(this.#e)}set isHidden(e){W(this.#e,e)}constructor(e){this.scrollbar=e,this.root=e.root;const t=nl(()=>this.machine.dispatch("SCROLL_END"),100);Pt(()=>{const i=this.machine.state.current,r=this.root.opts.scrollHideDelay.current;if(i==="idle"){const s=this.root.domContext.setTimeout(()=>this.machine.dispatch("HIDE"),r);return()=>this.root.domContext.clearTimeout(s)}}),Pt(()=>{const i=this.root.viewportNode;if(!i)return;const r=this.scrollbar.isHorizontal?"scrollLeft":"scrollTop";let s=i[r];return dn(i,"scroll",()=>{const l=i[r];s!==l&&(this.machine.dispatch("SCROLL"),t()),s=l})}),this.onpointerenter=this.onpointerenter.bind(this),this.onpointerleave=this.onpointerleave.bind(this)}onpointerenter(e){this.machine.dispatch("POINTER_ENTER")}onpointerleave(e){this.machine.dispatch("POINTER_LEAVE")}#t=z(()=>({"data-state":this.machine.state.current==="hidden"?"hidden":"visible",onpointerenter:this.onpointerenter,onpointerleave:this.onpointerleave}));get props(){return u(this.#t)}set props(e){W(this.#t,e)}}class sl{static create(){return new sl(_a.get())}scrollbar;root;#e=Oe(!1);get isVisible(){return u(this.#e)}set isVisible(e){W(this.#e,e,!0)}constructor(e){this.scrollbar=e,this.root=e.root;const t=nl(()=>{const i=this.root.viewportNode;if(!i)return;const r=i.offsetWidth<i.scrollWidth,s=i.offsetHeight<i.scrollHeight;this.isVisible=this.scrollbar.isHorizontal?r:s},10);new Rr(()=>this.root.viewportNode,t),new Rr(()=>this.root.contentNode,t)}#t=z(()=>({"data-state":this.isVisible?"visible":"hidden"}));get props(){return u(this.#t)}set props(e){W(this.#t,e)}}class qu{static create(){return rl.set(new qu(_a.get()))}scrollbar;root;#e=Oe(null);get thumbNode(){return u(this.#e)}set thumbNode(e){W(this.#e,e,!0)}#t=Oe(0);get pointerOffset(){return u(this.#t)}set pointerOffset(e){W(this.#t,e,!0)}#n=Oe({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}});get sizes(){return u(this.#n)}set sizes(e){W(this.#n,e)}#i=z(()=>Vp(this.sizes.viewport,this.sizes.content));get thumbRatio(){return u(this.#i)}set thumbRatio(e){W(this.#i,e)}#r=z(()=>this.thumbRatio>0&&this.thumbRatio<1);get hasThumb(){return u(this.#r)}set hasThumb(e){W(this.#r,e)}#s=Oe("");get prevTransformStyle(){return u(this.#s)}set prevTransformStyle(e){W(this.#s,e,!0)}constructor(e){this.scrollbar=e,this.root=e.root,Pt(()=>{this.scrollbar.hasThumb=this.hasThumb}),Pt(()=>{!this.scrollbar.hasThumb&&this.thumbNode&&(this.prevTransformStyle=this.thumbNode.style.transform)})}setSizes(e){this.sizes=e}getScrollPosition(e,t){return U0({pointerPos:e,pointerOffset:this.pointerOffset,sizes:this.sizes,dir:t})}onThumbPointerUp(){this.pointerOffset=0}onThumbPointerDown(e){this.pointerOffset=e}xOnThumbPositionChange(){if(!(this.root.viewportNode&&this.thumbNode))return;const e=this.root.viewportNode.scrollLeft,i=`translate3d(${uh({scrollPos:e,sizes:this.sizes,dir:this.root.opts.dir.current})}px, 0, 0)`;this.thumbNode.style.transform=i,this.prevTransformStyle=i}xOnWheelScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollLeft=e)}xOnDragScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollLeft=this.getScrollPosition(e,this.root.opts.dir.current))}yOnThumbPositionChange(){if(!(this.root.viewportNode&&this.thumbNode))return;const e=this.root.viewportNode.scrollTop,i=`translate3d(0, ${uh({scrollPos:e,sizes:this.sizes})}px, 0)`;this.thumbNode.style.transform=i,this.prevTransformStyle=i}yOnWheelScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollTop=e)}yOnDragScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollTop=this.getScrollPosition(e,this.root.opts.dir.current))}}class Yu{static create(e){return Vu.set(new Yu(e,rl.get()))}opts;scrollbarVis;root;scrollbar;attachment;#e=Oe();get computedStyle(){return u(this.#e)}set computedStyle(e){W(this.#e,e,!0)}constructor(e,t){this.opts=e,this.scrollbarVis=t,this.root=t.root,this.scrollbar=t.scrollbar,this.attachment=bi(this.scrollbar.opts.ref,i=>this.root.scrollbarXNode=i),Pt(()=>{this.scrollbar.opts.ref.current&&this.opts.mounted.current&&(this.computedStyle=getComputedStyle(this.scrollbar.opts.ref.current))}),Pt(()=>{this.onResize()})}onThumbPointerDown=e=>{this.scrollbarVis.onThumbPointerDown(e.x)};onDragScroll=e=>{this.scrollbarVis.xOnDragScroll(e.x)};onThumbPointerUp=()=>{this.scrollbarVis.onThumbPointerUp()};onThumbPositionChange=()=>{this.scrollbarVis.xOnThumbPositionChange()};onWheelScroll=(e,t)=>{if(!this.root.viewportNode)return;const i=this.root.viewportNode.scrollLeft+e.deltaX;this.scrollbarVis.xOnWheelScroll(i),Gp(i,t)&&e.preventDefault()};onResize=()=>{this.scrollbar.opts.ref.current&&this.root.viewportNode&&this.computedStyle&&this.scrollbarVis.setSizes({content:this.root.viewportNode.scrollWidth,viewport:this.root.viewportNode.offsetWidth,scrollbar:{size:this.scrollbar.opts.ref.current.clientWidth,paddingStart:Bo(this.computedStyle.paddingLeft),paddingEnd:Bo(this.computedStyle.paddingRight)}})};#t=z(()=>al(this.scrollbarVis.sizes));get thumbSize(){return u(this.#t)}set thumbSize(e){W(this.#t,e)}#n=z(()=>({id:this.scrollbar.opts.id.current,"data-orientation":"horizontal",style:{bottom:0,left:this.root.opts.dir.current==="rtl"?"var(--bits-scroll-area-corner-width)":0,right:this.root.opts.dir.current==="ltr"?"var(--bits-scroll-area-corner-width)":0,"--bits-scroll-area-thumb-width":`${this.thumbSize}px`},...this.attachment}));get props(){return u(this.#n)}set props(e){W(this.#n,e)}}class Ku{static create(e){return Vu.set(new Ku(e,rl.get()))}opts;scrollbarVis;root;scrollbar;attachment;#e=Oe();get computedStyle(){return u(this.#e)}set computedStyle(e){W(this.#e,e,!0)}constructor(e,t){this.opts=e,this.scrollbarVis=t,this.root=t.root,this.scrollbar=t.scrollbar,this.attachment=bi(this.scrollbar.opts.ref,i=>this.root.scrollbarYNode=i),Pt(()=>{this.scrollbar.opts.ref.current&&this.opts.mounted.current&&(this.computedStyle=getComputedStyle(this.scrollbar.opts.ref.current))}),Pt(()=>{this.onResize()}),this.onThumbPointerDown=this.onThumbPointerDown.bind(this),this.onDragScroll=this.onDragScroll.bind(this),this.onThumbPointerUp=this.onThumbPointerUp.bind(this),this.onThumbPositionChange=this.onThumbPositionChange.bind(this),this.onWheelScroll=this.onWheelScroll.bind(this),this.onResize=this.onResize.bind(this)}onThumbPointerDown(e){this.scrollbarVis.onThumbPointerDown(e.y)}onDragScroll(e){this.scrollbarVis.yOnDragScroll(e.y)}onThumbPointerUp(){this.scrollbarVis.onThumbPointerUp()}onThumbPositionChange(){this.scrollbarVis.yOnThumbPositionChange()}onWheelScroll(e,t){if(!this.root.viewportNode)return;const i=this.root.viewportNode.scrollTop+e.deltaY;this.scrollbarVis.yOnWheelScroll(i),Gp(i,t)&&e.preventDefault()}onResize(){this.scrollbar.opts.ref.current&&this.root.viewportNode&&this.computedStyle&&this.scrollbarVis.setSizes({content:this.root.viewportNode.scrollHeight,viewport:this.root.viewportNode.offsetHeight,scrollbar:{size:this.scrollbar.opts.ref.current.clientHeight,paddingStart:Bo(this.computedStyle.paddingTop),paddingEnd:Bo(this.computedStyle.paddingBottom)}})}#t=z(()=>al(this.scrollbarVis.sizes));get thumbSize(){return u(this.#t)}set thumbSize(e){W(this.#t,e)}#n=z(()=>({id:this.scrollbar.opts.id.current,"data-orientation":"vertical",style:{top:0,right:this.root.opts.dir.current==="ltr"?0:void 0,left:this.root.opts.dir.current==="rtl"?0:void 0,bottom:"var(--bits-scroll-area-corner-height)","--bits-scroll-area-thumb-height":`${this.thumbSize}px`},...this.attachment}));get props(){return u(this.#n)}set props(e){W(this.#n,e)}}class Zu{static create(){return kp.set(new Zu(Vu.get()))}scrollbarState;root;scrollbarVis;scrollbar;#e=Oe(null);get rect(){return u(this.#e)}set rect(e){W(this.#e,e)}#t=Oe("");get prevWebkitUserSelect(){return u(this.#t)}set prevWebkitUserSelect(e){W(this.#t,e,!0)}handleResize;handleThumbPositionChange;handleWheelScroll;handleThumbPointerDown;handleThumbPointerUp;#n=z(()=>this.scrollbarVis.sizes.content-this.scrollbarVis.sizes.viewport);get maxScrollPos(){return u(this.#n)}set maxScrollPos(e){W(this.#n,e)}constructor(e){this.scrollbarState=e,this.root=e.root,this.scrollbarVis=e.scrollbarVis,this.scrollbar=e.scrollbarVis.scrollbar,this.handleResize=nl(()=>this.scrollbarState.onResize(),10),this.handleThumbPositionChange=this.scrollbarState.onThumbPositionChange,this.handleWheelScroll=this.scrollbarState.onWheelScroll,this.handleThumbPointerDown=this.scrollbarState.onThumbPointerDown,this.handleThumbPointerUp=this.scrollbarState.onThumbPointerUp,Pt(()=>{const t=this.maxScrollPos,i=this.scrollbar.opts.ref.current;this.root.viewportNode;const r=a=>{const o=a.target;i?.contains(o)&&this.handleWheelScroll(a,t)};return dn(this.root.domContext.getDocument(),"wheel",r,{passive:!1})}),kg(()=>{this.scrollbarVis.sizes,wn(()=>this.handleThumbPositionChange())}),new Rr(()=>this.scrollbar.opts.ref.current,this.handleResize),new Rr(()=>this.root.contentNode,this.handleResize),this.onpointerdown=this.onpointerdown.bind(this),this.onpointermove=this.onpointermove.bind(this),this.onpointerup=this.onpointerup.bind(this),this.onlostpointercapture=this.onlostpointercapture.bind(this)}handleDragScroll(e){if(!this.rect)return;const t=e.clientX-this.rect.left,i=e.clientY-this.rect.top;this.scrollbarState.onDragScroll({x:t,y:i})}#i(){this.rect!==null&&(this.root.domContext.getDocument().body.style.webkitUserSelect=this.prevWebkitUserSelect,this.root.viewportNode&&(this.root.viewportNode.style.scrollBehavior=""),this.rect=null)}onpointerdown(e){if(e.button!==0)return;e.target.setPointerCapture(e.pointerId),this.rect=this.scrollbar.opts.ref.current?.getBoundingClientRect()??null,this.prevWebkitUserSelect=this.root.domContext.getDocument().body.style.webkitUserSelect,this.root.domContext.getDocument().body.style.webkitUserSelect="none",this.root.viewportNode&&(this.root.viewportNode.style.scrollBehavior="auto"),this.handleDragScroll(e)}onpointermove(e){this.handleDragScroll(e)}onpointerup(e){const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),this.#i()}onlostpointercapture(e){this.#i()}#r=z(()=>jt({...this.scrollbarState.props,style:{position:"absolute",...this.scrollbarState.props.style},[ga.scrollbar]:"",onpointerdown:this.onpointerdown,onpointermove:this.onpointermove,onpointerup:this.onpointerup,onlostpointercapture:this.onlostpointercapture}));get props(){return u(this.#r)}set props(e){W(this.#r,e)}}class $u{static create(e){return new $u(e,kp.get())}opts;scrollbarState;attachment;#e;#t=Oe();#n=nl(()=>{u(this.#t)&&(u(this.#t)(),W(this.#t,void 0))},100);constructor(e,t){this.opts=e,this.scrollbarState=t,this.#e=t.root,this.attachment=bi(this.opts.ref,i=>this.scrollbarState.scrollbarVis.thumbNode=i),Pt(()=>{const i=this.#e.viewportNode;if(!i)return;const r=()=>{if(this.#n(),!u(this.#t)){const a=F0(i,this.scrollbarState.handleThumbPositionChange);W(this.#t,a,!0),this.scrollbarState.handleThumbPositionChange()}};return wn(()=>this.scrollbarState.handleThumbPositionChange()),dn(i,"scroll",r)}),this.onpointerdowncapture=this.onpointerdowncapture.bind(this),this.onpointerup=this.onpointerup.bind(this)}onpointerdowncapture(e){const t=e.target;if(!t)return;const i=t.getBoundingClientRect(),r=e.clientX-i.left,s=e.clientY-i.top;this.scrollbarState.handleThumbPointerDown({x:r,y:s})}onpointerup(e){this.scrollbarState.handleThumbPointerUp()}#i=z(()=>({id:this.opts.id.current,"data-state":this.scrollbarState.scrollbarVis.hasThumb?"visible":"hidden",style:{width:"var(--bits-scroll-area-thumb-width)",height:"var(--bits-scroll-area-thumb-height)",transform:this.scrollbarState.scrollbarVis.prevTransformStyle},onpointerdowncapture:this.onpointerdowncapture,onpointerup:this.onpointerup,[ga.thumb]:"",...this.attachment}));get props(){return u(this.#i)}set props(e){W(this.#i,e)}}class Ju{static create(e){return new Ju(e,va.get())}opts;root;attachment;#e=Oe(0);#t=Oe(0);#n=z(()=>!!(u(this.#e)&&u(this.#t)));get hasSize(){return u(this.#n)}set hasSize(e){W(this.#n,e)}constructor(e,t){this.opts=e,this.root=t,this.attachment=bi(this.opts.ref),new Rr(()=>this.root.scrollbarXNode,()=>{const i=this.root.scrollbarXNode?.offsetHeight||0;this.root.cornerHeight=i,W(this.#t,i,!0)}),new Rr(()=>this.root.scrollbarYNode,()=>{const i=this.root.scrollbarYNode?.offsetWidth||0;this.root.cornerWidth=i,W(this.#e,i,!0)})}#i=z(()=>({id:this.opts.id.current,style:{width:u(this.#e),height:u(this.#t),position:"absolute",right:this.root.opts.dir.current==="ltr"?0:void 0,left:this.root.opts.dir.current==="rtl"?0:void 0,bottom:0},[ga.corner]:"",...this.attachment}));get props(){return u(this.#i)}set props(e){W(this.#i,e)}}function Bo(n){return n?Number.parseInt(n,10):0}function Vp(n,e){const t=n/e;return Number.isNaN(t)?0:t}function al(n){const e=Vp(n.viewport,n.content),t=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,i=(n.scrollbar.size-t)*e;return Math.max(i,18)}function U0({pointerPos:n,pointerOffset:e,sizes:t,dir:i="ltr"}){const r=al(t),s=r/2,a=e||s,o=r-a,l=t.scrollbar.paddingStart+a,c=t.scrollbar.size-t.scrollbar.paddingEnd-o,d=t.content-t.viewport,f=i==="ltr"?[0,d]:[d*-1,0];return Hp([l,c],f)(n)}function uh({scrollPos:n,sizes:e,dir:t="ltr"}){const i=al(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-r,a=e.content-e.viewport,o=s-i,l=t==="ltr"?[0,a]:[a*-1,0],c=I0(n,l[0],l[1]);return Hp([0,a],[0,o])(c)}function Hp(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const i=(e[1]-e[0])/(n[1]-n[0]);return e[0]+i*(t-n[0])}}function Gp(n,e){return n>0&&n<e}function F0(n,e){let t={left:n.scrollLeft,top:n.scrollTop},i=0;const r=dv(n);return(function s(){const a={left:n.scrollLeft,top:n.scrollTop},o=t.left!==a.left,l=t.top!==a.top;(o||l)&&e(),t=a,i=r.requestAnimationFrame(s)})(),()=>r.cancelAnimationFrame(i)}var O0=Z("<div><!></div>");function z0(n,e){const t=Tn();st(e,!0);let i=le(e,"ref",15,null),r=le(e,"id",19,()=>Vn(t)),s=le(e,"type",3,"hover"),a=le(e,"dir",3,"ltr"),o=le(e,"scrollHideDelay",3,600),l=ut(e,["$$slots","$$events","$$legacy","ref","id","type","dir","scrollHideDelay","children","child"]);const c=Hu.create({type:Qe(()=>s()),dir:Qe(()=>a()),scrollHideDelay:Qe(()=>o()),id:Qe(()=>r()),ref:Qe(()=>i(),x=>i(x))}),d=z(()=>jt(l,c.props));var f=we(),h=ee(f);{var p=x=>{var v=we(),g=ee(v);pt(g,()=>e.child,()=>({props:u(d)})),P(x,v)},m=x=>{var v=O0();Ft(v,()=>({...u(d)}));var g=$(v);pt(g,()=>e.children??wt),q(v),P(x,v)};xe(h,x=>{e.child?x(p):x(m,-1)})}P(n,f),at()}var B0=Z("<div><div><!></div></div>");function k0(n,e){const t=Tn();st(e,!0);let i=le(e,"ref",15,null),r=le(e,"id",19,()=>Vn(t)),s=ut(e,["$$slots","$$events","$$legacy","ref","id","children"]);const a=Gu.create({id:Qe(()=>r()),ref:Qe(()=>i(),h=>i(h))}),o=z(()=>jt(s,a.props)),l=z(()=>jt({},a.contentProps));var c=B0();Ft(c,()=>({...u(o)}));var d=$(c);Ft(d,()=>({...u(l)}));var f=$(d);pt(f,()=>e.children??wt),q(d),q(c),P(n,c),at()}var V0=Z("<div><!></div>");function Wp(n,e){st(e,!0);let t=ut(e,["$$slots","$$events","$$legacy","child","children"]);const i=Zu.create(),r=z(()=>jt(t,i.props));var s=we(),a=ee(s);{var o=c=>{var d=we(),f=ee(d);pt(f,()=>e.child,()=>({props:u(r)})),P(c,d)},l=c=>{var d=V0();Ft(d,()=>({...u(r)}));var f=$(d);pt(f,()=>e.children??wt),q(d),P(c,d)};xe(a,c=>{e.child?c(o):c(l,-1)})}P(n,s),at()}function H0(n,e){st(e,!0);let t=ut(e,["$$slots","$$events","$$legacy"]);const i=new zu,r=Yu.create({mounted:Qe(()=>i.current)}),s=z(()=>jt(t,r.props));Wp(n,mt(()=>u(s))),at()}function G0(n,e){st(e,!0);let t=ut(e,["$$slots","$$events","$$legacy"]);const i=new zu,r=Ku.create({mounted:Qe(()=>i.current)}),s=z(()=>jt(t,r.props));Wp(n,mt(()=>u(s))),at()}function ol(n,e){st(e,!0);let t=ut(e,["$$slots","$$events","$$legacy"]);const i=qu.create();var r=we(),s=ee(r);{var a=l=>{H0(l,mt(()=>t))},o=l=>{G0(l,mt(()=>t))};xe(s,l=>{i.scrollbar.opts.orientation.current==="horizontal"?l(a):l(o,-1)})}P(n,r),at()}function W0(n,e){st(e,!0);let t=le(e,"forceMount",3,!1),i=ut(e,["$$slots","$$events","$$legacy","forceMount"]);const r=sl.create(),s=z(()=>jt(i,r.props));{const a=l=>{ol(l,mt(()=>u(s)))};let o=z(()=>t()||r.isVisible);il(n,{get open(){return u(o)},get ref(){return r.scrollbar.opts.ref},presence:a,$$slots:{presence:!0}})}at()}function X0(n,e){st(e,!0);let t=le(e,"forceMount",3,!1),i=ut(e,["$$slots","$$events","$$legacy","forceMount"]);const r=ju.create(),s=z(()=>jt(i,r.props));{const a=l=>{ol(l,mt(()=>u(s)))};let o=z(()=>t()||!r.isHidden);il(n,mt(()=>u(s),{get open(){return u(o)},get ref(){return r.scrollbar.opts.ref},presence:a,$$slots:{presence:!0}}))}at()}function j0(n,e){st(e,!0);let t=le(e,"forceMount",3,!1),i=ut(e,["$$slots","$$events","$$legacy","forceMount"]);const r=Xu.create(),s=sl.create(),a=z(()=>jt(i,r.props,s.props,{"data-state":r.isVisible?"visible":"hidden"})),o=z(()=>t()||r.isVisible&&s.isVisible);il(n,{get open(){return u(o)},get ref(){return s.scrollbar.opts.ref},presence:c=>{ol(c,mt(()=>u(a)))},$$slots:{presence:!0}}),at()}function q0(n,e){const t=Tn();st(e,!0);let i=le(e,"ref",15,null),r=le(e,"id",19,()=>Vn(t)),s=ut(e,["$$slots","$$events","$$legacy","ref","id","orientation"]);const a=Wu.create({orientation:Qe(()=>e.orientation),id:Qe(()=>r()),ref:Qe(()=>i(),m=>i(m))}),o=z(()=>a.root.opts.type.current);var l=we(),c=ee(l);{var d=m=>{j0(m,mt(()=>s,{get id(){return r()}}))},f=m=>{X0(m,mt(()=>s,{get id(){return r()}}))},h=m=>{W0(m,mt(()=>s,{get id(){return r()}}))},p=m=>{ol(m,mt(()=>s,{get id(){return r()}}))};xe(c,m=>{u(o)==="hover"?m(d):u(o)==="scroll"?m(f,1):u(o)==="auto"?m(h,2):u(o)==="always"&&m(p,3)})}P(n,l),at()}var Y0=Z("<div><!></div>");function K0(n,e){st(e,!0);let t=le(e,"ref",15,null),i=ut(e,["$$slots","$$events","$$legacy","ref","id","child","children","present"]);const r=new zu,s=$u.create({id:Qe(()=>e.id),ref:Qe(()=>t(),f=>t(f)),mounted:Qe(()=>r.current)}),a=z(()=>jt(i,s.props,{style:{hidden:!e.present}}));var o=we(),l=ee(o);{var c=f=>{var h=we(),p=ee(h);pt(p,()=>e.child,()=>({props:u(a)})),P(f,h)},d=f=>{var h=Y0();Ft(h,()=>({...u(a)}));var p=$(h);pt(p,()=>e.children??wt),q(h),P(f,h)};xe(l,f=>{e.child?f(c):f(d,-1)})}P(n,o),at()}function Z0(n,e){const t=Tn();st(e,!0);let i=le(e,"id",19,()=>Vn(t)),r=le(e,"ref",15,null),s=le(e,"forceMount",3,!1),a=ut(e,["$$slots","$$events","$$legacy","id","ref","forceMount"]);const o=rl.get();{const l=(d,f)=>{let h=()=>(f?.()).present;K0(d,mt(()=>a,{get id(){return i()},get present(){return h()},get ref(){return r()},set ref(p){r(p)}}))};let c=z(()=>s()||o.hasThumb);il(n,{get open(){return u(c)},get ref(){return o.scrollbar.opts.ref},presence:l,$$slots:{presence:!0}})}at()}var $0=Z("<div><!></div>");function J0(n,e){st(e,!0);let t=le(e,"ref",15,null),i=ut(e,["$$slots","$$events","$$legacy","ref","id","children","child"]);const r=Ju.create({id:Qe(()=>e.id),ref:Qe(()=>t(),d=>t(d))}),s=z(()=>jt(i,r.props));var a=we(),o=ee(a);{var l=d=>{var f=we(),h=ee(f);pt(h,()=>e.child,()=>({props:u(s)})),P(d,f)},c=d=>{var f=$0();Ft(f,()=>({...u(s)}));var h=$(f);pt(h,()=>e.children??wt),q(f),P(d,f)};xe(o,d=>{e.child?d(l):d(c,-1)})}P(n,a),at()}function Q0(n,e){const t=Tn();st(e,!0);let i=le(e,"ref",15,null),r=le(e,"id",19,()=>Vn(t)),s=ut(e,["$$slots","$$events","$$legacy","ref","id"]);const a=va.get(),o=z(()=>!!(a.scrollbarXNode&&a.scrollbarYNode)),l=z(()=>a.opts.type.current!=="scroll"&&u(o));var c=we(),d=ee(c);{var f=h=>{J0(h,mt(()=>s,{get id(){return r()},get ref(){return i()},set ref(p){i(p)}}))};xe(d,h=>{u(l)&&h(f)})}P(n,c),at()}function dh(n,e,t){const i={position:"absolute"};return n==="lr"?(i.left=`${e}%`,i.right=`${t}%`):n==="rl"?(i.right=`${e}%`,i.left=`${t}%`):n==="bt"?(i.bottom=`${e}%`,i.top=`${t}%`):(i.top=`${e}%`,i.bottom=`${t}%`),i}function Xp(n,e){const t={position:"absolute"};return n==="lr"?(t.left=`${e}%`,t.translate="-50% 0"):n==="rl"?(t.right=`${e}%`,t.translate="50% 0"):n==="bt"?(t.bottom=`${e}%`,t.translate="0 50%"):(t.top=`${e}%`,t.translate="0 -50%"),t}function jp(n,e,t){const i={position:"absolute"};return n==="lr"?(i.left=`${e}%`,i.translate=`${t}% 0`):n==="rl"?(i.right=`${e}%`,i.translate=`${-t}% 0`):n==="bt"?(i.bottom=`${e}%`,i.translate=`0 ${-t}%`):(i.top=`${e}%`,i.translate=`0 ${t}%`),i}function e_(n){if(Math.floor(n)===n)return 0;const e=n.toString();if(e.indexOf(".")!==-1&&e.indexOf("e-")===-1)return e.split(".")[1].length;if(e.indexOf("e-")!==-1){const t=e.split("e-");return parseInt(t[1],10)}return 0}function t_(n,e){const t=Math.pow(10,e);return Math.round(n*t)/t}function Qu(n,e,t){if(typeof n=="number"){const i=t-e;let r=Math.ceil(i/n);const s=e_(n),a=Math.pow(10,s),o=Math.round(i*a),l=Math.round(n*a);o%l===0&&r++;const c=[];for(let d=0;d<r;d++){const f=e+d*n,h=t_(f,s);c.push(h)}return c}return[...new Set(n)].filter(i=>i>=e&&i<=t).sort((i,r)=>i-r)}function Tr(n,e){if(e.length===0)return n;let t=e[0],i=Math.abs(n-t);for(const r of e){const s=Math.abs(n-r);s<i&&(i=s,t=r)}return t}function Aa(n,e,t){const i=e.indexOf(n);return i===-1?Tr(n,e):t==="next"?i<e.length-1?e[i+1]:n:i>0?e[i-1]:n}function n_(n,e,t=!0){const[i,r]=n,[s,a]=e,o=(a-s)/(r-i);return l=>{const c=s+o*(l-i);return t?c>Math.max(s,a)?Math.max(s,a):c<Math.min(s,a)?Math.min(s,a):c:c}}const hr=Lu({component:"slider",parts:["root","thumb","range","tick","tick-label","thumb-label"]}),ed=new pr("Slider.Root");class qp{opts;attachment;#e=Oe(!1);get isActive(){return u(this.#e)}set isActive(e){W(this.#e,e,!0)}#t=Oe(0);#n=z(()=>this.opts.orientation.current==="horizontal"?this.opts.dir.current==="rtl"?"rl":"lr":this.opts.dir.current==="rtl"?"tb":"bt");get direction(){return u(this.#n)}set direction(e){W(this.#n,e)}#i=z(()=>Qu(this.opts.step.current,this.opts.min.current,this.opts.max.current));get normalizedSteps(){return u(this.#i)}set normalizedSteps(e){W(this.#i,e)}domContext;constructor(e){this.opts=e,this.attachment=bi(e.ref),this.domContext=new xp(this.opts.ref),new Rr(()=>this.opts.ref.current,this.#r)}#r=()=>{W(this.#t,u(this.#t)+1)};isThumbActive(e){return this.isActive}#s=z(()=>{if(!this.opts.disabled.current)return this.opts.orientation.current==="horizontal"?"pan-y":"pan-x"});getAllThumbs=()=>{const e=this.opts.ref.current;return e?Array.from(e.querySelectorAll(hr.selector("thumb"))):[]};getThumbScale=()=>{u(this.#t);const e=this.opts.trackPadding?.current;if(e!==void 0&&e>0)return[e,100-e];if(this.opts.thumbPositioning.current==="exact")return[0,100];const t=this.opts.orientation.current==="vertical",i=this.getAllThumbs()[0],r=t?i?.offsetHeight:i?.offsetWidth;if(r===void 0||Number.isNaN(r)||r===0)return[0,100];const s=t?this.opts.ref.current?.offsetHeight:this.opts.ref.current?.offsetWidth;if(s===void 0||Number.isNaN(s)||s===0)return[0,100];const a=r/2/s*100,o=a,l=100-a;return[o,l]};getPositionFromValue=e=>{const t=this.getThumbScale();return n_([this.opts.min.current,this.opts.max.current],t)(e)};#a=z(()=>({id:this.opts.id.current,"data-orientation":this.opts.orientation.current,"data-disabled":Pr(this.opts.disabled.current),style:{touchAction:u(this.#s)},[hr.root]:"",...this.attachment}));get props(){return u(this.#a)}set props(e){W(this.#a,e)}}class i_ extends qp{opts;isMulti=!1;constructor(e){super(e),this.opts=e,Up(()=>Iu(dn(this.domContext.getDocument(),"pointerdown",this.handlePointerDown),dn(this.domContext.getDocument(),"pointerup",this.handlePointerUp),dn(this.domContext.getDocument(),"pointermove",this.handlePointerMove),dn(this.domContext.getDocument(),"pointerleave",this.handlePointerUp))),fr([()=>this.opts.step.current,()=>this.opts.min.current,()=>this.opts.max.current,()=>this.opts.value.current],([t,i,r,s])=>{const a=Qu(t,i,r),o=c=>a.includes(c),l=c=>Tr(c,a);o(s)||(this.opts.value.current=l(s))})}isTickValueSelected=e=>this.opts.value.current===e;applyPosition({clientXY:e,start:t,end:i}){const r=this.opts.min.current,s=this.opts.max.current,o=(e-t)/(i-t)*(s-r)+r;if(o<r)this.updateValue(r);else if(o>s)this.updateValue(s);else{const l=this.normalizedSteps,c=Tr(o,l);this.updateValue(c)}}updateValue=e=>{this.opts.value.current=Tr(e,this.normalizedSteps)};handlePointerMove=e=>{if(!this.isActive||this.opts.disabled.current)return;e.preventDefault(),e.stopPropagation();const t=this.opts.ref.current,i=this.getAllThumbs()[0];if(!t||!i)return;i.focus();const{left:r,right:s,top:a,bottom:o}=t.getBoundingClientRect();this.direction==="lr"?this.applyPosition({clientXY:e.clientX,start:r,end:s}):this.direction==="rl"?this.applyPosition({clientXY:e.clientX,start:s,end:r}):this.direction==="bt"?this.applyPosition({clientXY:e.clientY,start:o,end:a}):this.direction==="tb"&&this.applyPosition({clientXY:e.clientY,start:a,end:o})};handlePointerDown=e=>{if(e.button!==0||this.opts.disabled.current)return;const t=this.opts.ref.current,i=this.getAllThumbs()[0];if(!i||!t)return;const r=e.composedPath()[0]??e.target;!Rp(r)||!t.contains(r)||(e.preventDefault(),i.focus(),this.isActive=!0,this.handlePointerMove(e))};handlePointerUp=()=>{this.opts.disabled.current||(this.isActive&&this.opts.onValueCommit.current(wn(()=>this.opts.value.current)),this.isActive=!1)};#e=z(()=>{const e=this.opts.value.current;return Array.from({length:1},()=>{const t=e,i=this.getPositionFromValue(t),r=Xp(this.direction,i);return{role:"slider","aria-valuemin":this.opts.min.current,"aria-valuemax":this.opts.max.current,"aria-valuenow":t,"aria-disabled":Oo(this.opts.disabled.current),"aria-orientation":this.opts.orientation.current,"data-value":t,"data-orientation":this.opts.orientation.current,style:r,[hr.thumb]:""}})});get thumbsPropsArr(){return u(this.#e)}set thumbsPropsArr(e){W(this.#e,e)}#t=z(()=>this.thumbsPropsArr.map((e,t)=>t));get thumbsRenderArr(){return u(this.#t)}set thumbsRenderArr(e){W(this.#t,e)}#n=z(()=>{const e=this.normalizedSteps,t=this.opts.value.current;return e.map((i,r)=>{const s=this.getPositionFromValue(i),a=r===0,o=r===e.length-1,l=a?0:o?-100:-50,c=jp(this.direction,s,l),d=i<=t;return{"data-disabled":Pr(this.opts.disabled.current),"data-orientation":this.opts.orientation.current,"data-bounded":d?"":void 0,"data-value":i,"data-selected":this.isTickValueSelected(i)?"":void 0,style:c,[hr.tick]:""}})});get ticksPropsArr(){return u(this.#n)}set ticksPropsArr(e){W(this.#n,e)}#i=z(()=>this.ticksPropsArr.map((e,t)=>t));get ticksRenderArr(){return u(this.#i)}set ticksRenderArr(e){W(this.#i,e)}#r=z(()=>this.ticksPropsArr.map((e,t)=>({value:e["data-value"],index:t})));get tickItemsArr(){return u(this.#r)}set tickItemsArr(e){W(this.#r,e)}#s=z(()=>[{value:this.opts.value.current,index:0}]);get thumbItemsArr(){return u(this.#s)}set thumbItemsArr(e){W(this.#s,e)}#a=z(()=>({ticks:this.ticksRenderArr,thumbs:this.thumbsRenderArr,tickItems:this.tickItemsArr,thumbItems:this.thumbItemsArr}));get snippetProps(){return u(this.#a)}set snippetProps(e){W(this.#a,e)}}class r_ extends qp{opts;isMulti=!0;#e=Oe(null);get activeThumb(){return u(this.#e)}set activeThumb(e){W(this.#e,e,!0)}#t=Oe(0);get currentThumbIdx(){return u(this.#t)}set currentThumbIdx(e){W(this.#t,e,!0)}constructor(e){super(e),this.opts=e,Up(()=>Iu(dn(this.domContext.getDocument(),"pointerdown",this.handlePointerDown),dn(this.domContext.getDocument(),"pointerup",this.handlePointerUp),dn(this.domContext.getDocument(),"pointermove",this.handlePointerMove),dn(this.domContext.getDocument(),"pointerleave",this.handlePointerUp))),fr([()=>this.opts.step.current,()=>this.opts.min.current,()=>this.opts.max.current,()=>this.opts.value.current],([t,i,r,s])=>{const a=Qu(t,i,r),o=c=>a.includes(c),l=c=>Tr(c,a);s.some(c=>!o(c))&&(this.opts.value.current=s.map(l))})}isTickValueSelected=e=>this.opts.value.current.includes(e);isThumbActive(e){return this.isActive&&this.activeThumb?.idx===e}applyPosition({clientXY:e,activeThumbIdx:t,start:i,end:r}){const s=this.opts.min.current,a=this.opts.max.current,l=(e-i)/(r-i)*(a-s)+s;if(l<s)this.updateValue(s,t);else if(l>a)this.updateValue(a,t);else{const c=this.normalizedSteps,d=Tr(l,c);this.updateValue(d,t)}}#n=e=>{const t=this.getAllThumbs();if(!t.length)return;for(const a of t)a.blur();const i=t.map(a=>{if(this.opts.orientation.current==="horizontal"){const{left:o,right:l}=a.getBoundingClientRect();return Math.abs(e.clientX-(o+l)/2)}else{const{top:o,bottom:l}=a.getBoundingClientRect();return Math.abs(e.clientY-(o+l)/2)}}),r=t[i.indexOf(Math.min(...i))],s=t.indexOf(r);return{node:r,idx:s}};handlePointerMove=e=>{if(!this.isActive||this.opts.disabled.current)return;e.preventDefault(),e.stopPropagation();const t=this.opts.ref.current,i=this.activeThumb;if(!t||!i)return;i.node.focus();const{left:r,right:s,top:a,bottom:o}=t.getBoundingClientRect(),l=this.direction;l==="lr"?this.applyPosition({clientXY:e.clientX,activeThumbIdx:i.idx,start:r,end:s}):l==="rl"?this.applyPosition({clientXY:e.clientX,activeThumbIdx:i.idx,start:s,end:r}):l==="bt"?this.applyPosition({clientXY:e.clientY,activeThumbIdx:i.idx,start:o,end:a}):l==="tb"&&this.applyPosition({clientXY:e.clientY,activeThumbIdx:i.idx,start:a,end:o})};handlePointerDown=e=>{if(e.button!==0||this.opts.disabled.current)return;const t=this.opts.ref.current,i=this.#n(e);if(!i||!t)return;const r=e.composedPath()[0]??e.target;!Rp(r)||!t.contains(r)||(e.preventDefault(),this.activeThumb=i,i.node.focus(),this.isActive=!0,this.handlePointerMove(e))};handlePointerUp=()=>{this.opts.disabled.current||(this.isActive&&this.opts.onValueCommit.current(wn(()=>this.opts.value.current)),this.isActive=!1)};getAllThumbs=()=>{const e=this.opts.ref.current;return e?Array.from(e.querySelectorAll(hr.selector("thumb"))):[]};updateValue=(e,t)=>{const i=this.opts.value.current;if(!i.length){this.opts.value.current.push(e);return}if(i[t]===e)return;const s=[...i];if(!hv(t,s))return;const a=s[t]>e?-1:1,o=()=>{const c=t+a;s[t]=s[c],s[c]=e;const d=this.getAllThumbs();d.length&&(d[c]?.focus(),this.activeThumb={node:d[c],idx:c})};if(this.opts.autoSort.current&&(a===-1&&e<s[t-1]||a===1&&e>s[t+1])){o(),this.opts.value.current=s;return}const l=this.normalizedSteps;s[t]=Tr(e,l),this.opts.value.current=s};#i=z(()=>{const e=this.opts.value.current;return Array.from({length:e.length||1},(t,i)=>{const r=wn(()=>this.currentThumbIdx);r<e.length&&wn(()=>{this.currentThumbIdx=r+1});const s=e[i],a=this.getPositionFromValue(s??0),o=Xp(this.direction,a);return{role:"slider","aria-valuemin":this.opts.min.current,"aria-valuemax":this.opts.max.current,"aria-valuenow":s,"aria-disabled":Oo(this.opts.disabled.current),"aria-orientation":this.opts.orientation.current,"data-value":s,"data-orientation":this.opts.orientation.current,style:o,[hr.thumb]:""}})});get thumbsPropsArr(){return u(this.#i)}set thumbsPropsArr(e){W(this.#i,e)}#r=z(()=>this.thumbsPropsArr.map((e,t)=>t));get thumbsRenderArr(){return u(this.#r)}set thumbsRenderArr(e){W(this.#r,e)}#s=z(()=>{const e=this.normalizedSteps,t=this.opts.value.current;return e.map((i,r)=>{const s=this.getPositionFromValue(i),a=r===0,o=r===e.length-1,l=a?0:o?-100:-50,c=jp(this.direction,s,l),d=t.length===1?i<=t[0]:t[0]<=i&&i<=t[t.length-1];return{"data-disabled":Pr(this.opts.disabled.current),"data-orientation":this.opts.orientation.current,"data-bounded":d?"":void 0,"data-value":i,style:c,[hr.tick]:""}})});get ticksPropsArr(){return u(this.#s)}set ticksPropsArr(e){W(this.#s,e)}#a=z(()=>this.ticksPropsArr.map((e,t)=>t));get ticksRenderArr(){return u(this.#a)}set ticksRenderArr(e){W(this.#a,e)}#o=z(()=>this.ticksPropsArr.map((e,t)=>({value:e["data-value"],index:t})));get tickItemsArr(){return u(this.#o)}set tickItemsArr(e){W(this.#o,e)}#l=z(()=>this.opts.value.current.map((t,i)=>({value:t,index:i})));get thumbItemsArr(){return u(this.#l)}set thumbItemsArr(e){W(this.#l,e)}#c=z(()=>({ticks:this.ticksRenderArr,thumbs:this.thumbsRenderArr,tickItems:this.tickItemsArr,thumbItems:this.thumbItemsArr}));get snippetProps(){return u(this.#c)}set snippetProps(e){W(this.#c,e)}}class s_{static create(e){const{type:t,...i}=e,r=t==="single"?new i_(i):new r_(i);return ed.set(r)}}const a_=[wp,Ep,Tp,Ap,Cp,Pp];class td{static create(e){return new td(e,ed.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=bi(e.ref)}#e=z(()=>{if(Array.isArray(this.root.opts.value.current)){const e=this.root.opts.value.current.length>1?this.root.getPositionFromValue(Math.min(...this.root.opts.value.current)??0):0,t=100-this.root.getPositionFromValue(Math.max(...this.root.opts.value.current)??0);return{position:"absolute",...dh(this.root.direction,e,t)}}else{const e=this.root.opts.trackPadding?.current,t=this.root.opts.value.current,i=this.root.opts.max.current,r=0,s=e!==void 0&&e>0&&t===i?0:100-this.root.getPositionFromValue(t);return{position:"absolute",...dh(this.root.direction,r,s)}}});get rangeStyles(){return u(this.#e)}set rangeStyles(e){W(this.#e,e)}#t=z(()=>({id:this.opts.id.current,"data-orientation":this.root.opts.orientation.current,"data-disabled":Pr(this.root.opts.disabled.current),style:this.rangeStyles,[hr.range]:"",...this.attachment}));get props(){return u(this.#t)}set props(e){W(this.#t,e)}}class nd{static create(e){return new nd(e,ed.get())}opts;root;attachment;#e=z(()=>this.root.opts.disabled.current||this.opts.disabled.current);constructor(e,t){this.opts=e,this.root=t,this.attachment=bi(e.ref),this.onkeydown=this.onkeydown.bind(this)}#t(e){this.root.isMulti?this.root.updateValue(e,this.opts.index.current):this.root.updateValue(e)}onkeydown(e){if(u(this.#e))return;const t=this.opts.ref.current;if(!t)return;const i=this.root.getAllThumbs();if(!i.length)return;const r=i.indexOf(t);if(this.root.isMulti&&(this.root.currentThumbIdx=r),!a_.includes(e.key))return;e.preventDefault();const s=this.root.opts.min.current,a=this.root.opts.max.current,o=this.root.opts.value.current,l=Array.isArray(o)?o[r]:o,c=this.root.opts.orientation.current,d=this.root.direction,f=this.root.normalizedSteps;switch(e.key){case Cp:this.#t(s);break;case Pp:this.#t(a);break;case wp:if(c!=="horizontal")break;if(e.metaKey){const h=d==="rl"?a:s;this.#t(h)}else{const p=Aa(l,f,d==="rl"?"next":"prev");this.#t(p)}break;case Ep:if(c!=="horizontal")break;if(e.metaKey){const h=d==="rl"?s:a;this.#t(h)}else{const p=Aa(l,f,d==="rl"?"prev":"next");this.#t(p)}break;case Tp:if(e.metaKey){const h=d==="tb"?s:a;this.#t(h)}else{const p=Aa(l,f,d==="tb"?"prev":"next");this.#t(p)}break;case Ap:if(e.metaKey){const h=d==="tb"?a:s;this.#t(h)}else{const p=Aa(l,f,d==="tb"?"next":"prev");this.#t(p)}break}this.root.opts.onValueCommit.current(this.root.opts.value.current)}#n=z(()=>({...this.root.thumbsPropsArr[this.opts.index.current],id:this.opts.id.current,onkeydown:this.onkeydown,"data-active":this.root.isThumbActive(this.opts.index.current)?"":void 0,"data-disabled":Pr(this.opts.disabled.current||this.root.opts.disabled.current),tabindex:this.opts.disabled.current||this.root.opts.disabled.current?-1:0,...this.attachment}));get props(){return u(this.#n)}set props(e){W(this.#n,e)}}var o_=Z("<span><!></span>");function l_(n,e){const t=Tn();st(e,!0);let i=le(e,"id",19,()=>Vn(t)),r=le(e,"ref",15,null),s=le(e,"value",15),a=le(e,"onValueChange",3,Un),o=le(e,"onValueCommit",3,Un),l=le(e,"disabled",3,!1),c=le(e,"step",3,1),d=le(e,"dir",3,"ltr"),f=le(e,"autoSort",3,!0),h=le(e,"orientation",3,"horizontal"),p=le(e,"thumbPositioning",3,"contain"),m=ut(e,["$$slots","$$events","$$legacy","children","child","id","ref","value","type","onValueChange","onValueCommit","disabled","min","max","step","dir","autoSort","orientation","thumbPositioning","trackPadding"]);const x=z(()=>e.min!==void 0?e.min:Array.isArray(c())?Math.min(...c()):0),v=z(()=>e.max!==void 0?e.max:Array.isArray(c())?Math.max(...c()):100);function g(){if(s()===void 0)return e.type==="single"?u(x):[]}g(),fr.pre(()=>s(),()=>{g()});const y=s_.create({id:Qe(()=>i()),ref:Qe(()=>r(),_=>r(_)),value:Qe(()=>s(),_=>{s(_),a()(_)}),onValueCommit:Qe(()=>o()),disabled:Qe(()=>l()),min:Qe(()=>u(x)),max:Qe(()=>u(v)),step:Qe(()=>c()),dir:Qe(()=>d()),autoSort:Qe(()=>f()),orientation:Qe(()=>h()),thumbPositioning:Qe(()=>p()),type:e.type,trackPadding:Qe(()=>e.trackPadding)}),w=z(()=>jt(m,y.props));var b=we(),E=ee(b);{var S=_=>{var T=we(),D=ee(T);{let L=z(()=>({props:u(w),...y.snippetProps}));pt(D,()=>e.child,()=>u(L))}P(_,T)},A=_=>{var T=o_();Ft(T,()=>({...u(w)}));var D=$(T);pt(D,()=>e.children??wt,()=>y.snippetProps),q(T),P(_,T)};xe(E,_=>{e.child?_(S):_(A,-1)})}P(n,b),at()}var c_=Z("<span><!></span>");function u_(n,e){const t=Tn();st(e,!0);let i=le(e,"ref",15,null),r=le(e,"id",19,()=>Vn(t)),s=ut(e,["$$slots","$$events","$$legacy","children","child","ref","id"]);const a=td.create({id:Qe(()=>r()),ref:Qe(()=>i(),h=>i(h))}),o=z(()=>jt(s,a.props));var l=we(),c=ee(l);{var d=h=>{var p=we(),m=ee(p);pt(m,()=>e.child,()=>({props:u(o)})),P(h,p)},f=h=>{var p=c_();Ft(p,()=>({...u(o)}));var m=$(p);pt(m,()=>e.children??wt),q(p),P(h,p)};xe(c,h=>{e.child?h(d):h(f,-1)})}P(n,l),at()}var d_=Z("<span><!></span>");function h_(n,e){const t=Tn();st(e,!0);let i=le(e,"ref",15,null),r=le(e,"id",19,()=>Vn(t)),s=le(e,"disabled",3,!1),a=ut(e,["$$slots","$$events","$$legacy","children","child","ref","id","index","disabled"]);const o=nd.create({id:Qe(()=>r()),ref:Qe(()=>i(),p=>i(p)),index:Qe(()=>e.index),disabled:Qe(()=>s())}),l=z(()=>jt(a,o.props));var c=we(),d=ee(c);{var f=p=>{var m=we(),x=ee(m);{let v=z(()=>({active:o.root.isThumbActive(o.opts.index.current),props:u(l)}));pt(x,()=>e.child,()=>u(v))}P(p,m)},h=p=>{var m=d_();Ft(m,()=>({...u(l)}));var x=$(m);{let v=z(()=>({active:o.root.isThumbActive(o.opts.index.current)}));pt(x,()=>e.children??wt,()=>u(v))}q(m),P(p,m)};xe(d,p=>{e.child?p(f):p(h,-1)})}P(n,c),at()}var Mo=new Map;function Yp(n,e){Mo.set(n,e)}Yp("Rhino.Geometry.Point3d",(n,e)=>{let t=e;return!t||typeof t.X!="number"?null:new n.Point([t.X,t.Y,t.Z])});Yp("Rhino.Geometry.Line",(n,e)=>{let t=e;return!t||!t.From||!t.To?null:new n.Line([t.From.X,t.From.Y,t.From.Z],[t.To.X,t.To.Y,t.To.Z])});function f_(n){if(Mo.has(n))return Mo.get(n);for(let[e,t]of Mo)if(n.startsWith(e))return t}function p_(n){return!n||typeof n!="object"?null:n.data??n.value??null}function m_(n,e,t){let i=f_(e);if(i)try{return i(t,n)}catch(r){Nt().warn(`Failed to decode Rhino type ${e}:`,r)}try{let r=p_(n);if(r)return t.CommonObject.decode(r)}catch(r){return Nt().warn(`Failed to decode ${e} with CommonObject:`,r),{__decodeError:!0,type:e,raw:n}}return n}var ds={STRING:"System.String",INT:"System.Int32",DOUBLE:"System.Double",BOOL:"System.Boolean"},g_="Rhino.Geometry.",v_=["WebDisplay"],__="FileData";function Kp(n){return v_.some(e=>n.includes(e))}function Zp(n){if(typeof n!="string")return n;let e=n.trim();if(!(e.startsWith("{")||e.startsWith("[")||e.startsWith('"')))return n;try{let t=JSON.parse(e);if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t}catch{return n}}function x_(n,e,t){switch(e){case ds.STRING:return typeof n!="string"?n:n.replace(/^"(.*)"$/,"$1");case ds.INT:return Number.parseInt(n,10);case ds.DOUBLE:return Number.parseFloat(n);case ds.BOOL:return String(n).toLowerCase()==="true";default:return t&&e.startsWith(g_)?m_(n,e,t):n}}function $p(n,e,t,i){if(typeof n!="string")return n;let r=t?Zp(n):n;return x_(r,e,i)}function b_(n){if(!n||typeof n!="object")return!1;let e=n;return typeof e.fileName=="string"&&typeof e.fileType=="string"&&"data"in e&&typeof e.isBase64Encoded=="boolean"&&typeof e.subFolder=="string"}function ko(n,e){for(let t of Object.values(n))if(Array.isArray(t))for(let i of t)e(i)}function y_(n,e=!1,t={}){let{parseValues:i=!0,rhino:r,stringOnly:s=!1}=t,a={},o=new Set;for(let l of n.values)ko(l.InnerTree,c=>{if(Kp(c.type)||s&&c.type!==ds.STRING)return;let d=e?c.id:l.ParamName;if(!d)return;let f=$p(c.data,c.type,i,r);d in a?o.has(d)?a[d].push(f):(a[d]=[a[d],f],o.add(d)):a[d]=f});return{values:a}}function S_(n){let e=[];for(let t of n.values)ko(t.InnerTree,i=>{if(!i.type.includes(__))return;let r=Zp(i.data);b_(r)&&e.push(r)});return e}function M_(n,e,t={}){let{parseValues:i=!0,rhino:r,stringOnly:s=!1}=t,a;if("byName"in e?a=n.values.find(l=>l.ParamName===e.byName):a=n.values.find(l=>{let c=!1;return ko(l.InnerTree,d=>{d.id===e.byId&&(c=!0)}),c}),!a)return;let o=[];if(ko(a.InnerTree,l=>{if("byId"in e&&l.id!==e.byId||Kp(l.type)||s&&l.type!==ds.STRING)return;let c=$p(l.data,l.type,i,r);o.push(c)}),o.length!==0)return o.length===1?o[0]:o}var w_=class{constructor(n,e=!1){this.response=n,this.debug=e}getValues(n=!1,e={}){return y_(this.response,n,e)}getValue(n,e){return M_(this.response,n,e)}async extractMeshesFromResponse(n){let e={debug:this.debug,...n},t;try{({getThreeMeshesFromComputeResponse:t}=await gp(()=>Promise.resolve().then(()=>UD),void 0,import.meta.url))}catch(i){throw new ma("Failed to load three.js visualization module. Ensure three.js is installed as a peer dependency.",Pu.INVALID_STATE,{context:{originalError:i instanceof Error?i.message:String(i)}})}return t(this.response,e)}getFileData(){return S_(this.response)}async getAndDownloadFiles(n,e){let t=this.getFileData();await jg(t,n,e)}},E_=/^\{(\d+(?:;\d+)*)?\}$/;function T_(n){if(typeof n!="object"||n===null||Array.isArray(n))return!1;let e=Object.entries(n);return e.length>0&&e.every(([t,i])=>E_.test(t)&&Array.isArray(i))}function Rs(n,e,t){if(n==null)return n;if(Array.isArray(n)){let r=n.map(e).filter(s=>s!==null);return r.length>0?r:void 0}let i=e(n);return i!==null?i:t?void 0:n}var A_=n=>{if(typeof n=="number")return n;if(typeof n=="string"){let e=n.trim();if(e==="")return null;let t=Number(e);return Number.isNaN(t)?null:t}return null},C_=n=>{if(typeof n=="boolean")return n;if(typeof n=="string"){let e=n.toLowerCase();if(e==="true")return!0;if(e==="false")return!1;throw new Error(`Invalid boolean string: "${n}"`)}return null},P_=n=>typeof n=="string"?n.length>=2&&n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1):n.startsWith('"')?n.slice(1):n:null,R_=n=>{if(typeof n=="string"){let e=n.trim();return e.startsWith('"')&&e.endsWith('"')&&(e=e.slice(1,-1).trim()),e}return null};function Jp(n){return e=>{if(typeof e=="object"&&e!==null)return e;if(typeof e=="string"&&e.trim()!=="")try{let t=JSON.parse(e);return typeof t=="object"&&t!==null?t:(Nt().warn(`Parsed value for input ${n} is not an object`),null)}catch(t){return Nt().warn(`Failed to parse object value "${e}" for input ${n}`,t),null}return null}}function hh(n,e,t){let i=Number(n.toFixed(e));return Math.abs(n-i)<t?i:n}function D_(n,e){if(!Number.isFinite(n)||n===0)return .1;let t=Math.abs(n);if(t>=1){let d=String(n).split(".")[1];if(d&&d.length>0){let f=Math.min(d.length,12),h=Math.pow(10,-f),p=Number(h.toFixed(f));return Math.abs(p-h)<e?p:h}return 1}let i=String(n),r=i.toLowerCase().match(/e(-?\d+)/);if(r){let d=Number(r[1]);if(d<0||i.toLowerCase().includes("e-")){let f=Math.abs(d),h=Math.pow(10,-f),p=Number(h.toFixed(f));return Math.abs(p-h)<e?p:h}return .1}let s=12,a=t.toFixed(s).replace(/0+$/,""),o=Math.min((a.split(".")[1]||"").length,s);if(o===0)return .1;let l=Math.pow(10,-o),c=Number(l.toFixed(o));return Math.abs(c-l)<e?c:l}function L_(n,e=1e-8){let t=n.paramType==="Integer";if(T_(n.default))return{default:n.default,stepSize:t?1:.1};let i=Rs(n.default,A_,!0);if(t)return Array.isArray(i)?i=i.map(d=>typeof d=="number"?Math.round(d):d):typeof i=="number"&&(i=Math.round(i)),{default:i,stepSize:1};let r=Array.isArray(i)?i[0]:i,s;typeof r=="number"&&Number.isFinite(r)&&r!==0?s=r:typeof n.minimum=="number"&&Number.isFinite(n.minimum)&&n.minimum!==0?s=n.minimum:typeof n.maximum=="number"&&Number.isFinite(n.maximum)&&n.maximum!==0&&(s=n.maximum);let a=s!==void 0?D_(s,e):.1,o=0,l=String(a),c=l.toLowerCase().match(/e(-?\d+)/);if(c?o=Math.abs(Number(c[1])):o=l.split(".")[1]?.length??0,o===0&&typeof r=="number"&&r!==0&&Math.abs(r)<1){let d=Math.ceil(-Math.log10(Math.abs(r)));Number.isFinite(d)&&d>0&&(o=d)}return o=Math.min(Math.max(o,0),12),Array.isArray(i)?i=i.map(d=>typeof d=="number"?hh(d,o,e):d):typeof i=="number"&&(i=hh(i,o,e)),{default:i,stepSize:a}}var I_={types:["Number","Integer"],parse(n,e){let{default:t,stepSize:i}=L_(n);return{...e,paramType:n.paramType,minimum:n.minimum,maximum:n.maximum,atLeast:n.atLeast,atMost:n.atMost,stepSize:i,default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:n.paramType,minimum:n.minimum,maximum:n.maximum,atLeast:n.atLeast,atMost:n.atMost,default:t?[0]:0}}},N_={types:["Boolean"],parse(n,e){let t;try{t=Rs(n.default,C_,!1)}catch(i){throw i instanceof Error?new ma(i.message):i}return{...e,paramType:"Boolean",default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"Boolean",default:t?[!1]:!1}}},U_={types:["Text"],parse(n,e){let t=Rs(n.default,P_,!1);return{...e,paramType:"Text",default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"Text",default:t?[""]:""}}},F_={types:["ValueList"],parse(n,e){if(!n.values||typeof n.values!="object"||Object.keys(n.values).length===0)throw ma.missingValues(n.nickname||"unnamed","ValueList");if(n.default!==void 0&&n.default!==null){let t=String(n.default).toLowerCase();Object.keys(n.values).some(i=>i.toLowerCase()===t)||Nt().warn(`ValueList input "${n.nickname||"unnamed"}" default value "${n.default}" is not in available values`)}return{...e,paramType:"ValueList",values:n.values,default:n.default}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"ValueList",values:n.values??{},default:t?[n.default]:n.default}}},O_={types:["Geometry"],parse(n,e){let t=Rs(n.default,Jp(n.nickname||"unnamed"),!0);return{...e,paramType:"Geometry",default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"Geometry",default:t?[null]:null}}},z_={types:["File"],parse(n,e){let t=Rs(n.default,Jp(n.nickname||"unnamed"),!0);return{...e,paramType:"File",acceptedFormats:n.acceptedFormats,default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"File",default:t?[null]:null}}},B_={types:["Color"],parse(n,e){let t=Rs(n.default,R_,!1);return{...e,paramType:"Color",default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"Color",default:t?["0, 0, 0"]:"0, 0, 0"}}},k_=[I_,N_,U_,F_,O_,z_,B_],V_=new Map(k_.flatMap(n=>n.types.map(e=>[e,n])));new Map([...V_.keys()].map(n=>[n.toLowerCase(),n]));const id="184",xs={ROTATE:0,DOLLY:1,PAN:2},hs={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},H_=0,fh=1,G_=2,wo=1,W_=2,fs=3,Kn=0,Yn=1,Qn=2,Mn=0,bs=1,ph=2,mh=3,gh=4,Qp=5,gi=100,X_=101,j_=102,q_=103,Y_=104,Js=200,K_=201,Z_=202,$_=203,_c=204,xc=205,bc=206,J_=207,yc=208,Q_=209,ex=210,tx=211,nx=212,ix=213,rx=214,Sc=0,Mc=1,wc=2,ws=3,Ec=4,Tc=5,Ac=6,Cc=7,em=0,sx=1,ax=2,Fi=0,rd=1,sd=2,ad=3,od=4,ld=5,cd=6,xa=7,tm=300,Dr=301,Es=302,Eo=303,wl=304,ll=306,Lr=1e3,_i=1001,Pc=1002,xn=1003,ox=1004,Ca=1005,hn=1006,El=1007,lr=1008,qn=1009,nm=1010,im=1011,aa=1012,ud=1013,Oi=1014,ti=1015,Fn=1016,dd=1017,hd=1018,Ts=1020,rm=35902,sm=35899,am=1021,om=1022,li=1023,Yi=1026,cr=1027,lm=1028,fd=1029,Ir=1030,pd=1031,md=1033,To=33776,Ao=33777,Co=33778,Po=33779,Rc=35840,Dc=35841,Lc=35842,Ic=35843,Nc=36196,Uc=37492,Fc=37496,Oc=37488,zc=37489,Vo=37490,Bc=37491,kc=37808,Vc=37809,Hc=37810,Gc=37811,Wc=37812,Xc=37813,jc=37814,qc=37815,Yc=37816,Kc=37817,Zc=37818,$c=37819,Jc=37820,Qc=37821,eu=36492,tu=36494,nu=36495,iu=36283,ru=36284,Ho=36285,su=36286,lx=3200,Go=0,cx=1,ar="",Wn="srgb",oa="srgb-linear",Wo="linear",Ut="srgb",kr=7680,vh=519,ux=512,dx=513,hx=514,gd=515,fx=516,px=517,vd=518,mx=519,au=35044,_h="300 es",Ni=2e3,la=2001;function gx(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Xo(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function vx(){const n=Xo("canvas");return n.style.display="block",n}const xh={};function jo(...n){const e="THREE."+n.shift();console.log(e,...n)}function cm(n){const e=n[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=n[1];t&&t.isStackTrace?n[0]+=" "+t.getLocation():n[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return n}function ft(...n){n=cm(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...n)}}function Tt(...n){n=cm(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...n)}}function ou(...n){const e=n.join(" ");e in xh||(xh[e]=!0,ft(...n))}function _x(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}const xx={[Sc]:Mc,[wc]:Ac,[Ec]:Cc,[ws]:Tc,[Mc]:Sc,[Ac]:wc,[Cc]:Ec,[Tc]:ws};class mr{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners;if(i===void 0)return;const r=i[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const i=t[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const In=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let bh=1234567;const ys=Math.PI/180,ca=180/Math.PI;function ji(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(In[n&255]+In[n>>8&255]+In[n>>16&255]+In[n>>24&255]+"-"+In[e&255]+In[e>>8&255]+"-"+In[e>>16&15|64]+In[e>>24&255]+"-"+In[t&63|128]+In[t>>8&255]+"-"+In[t>>16&255]+In[t>>24&255]+In[i&255]+In[i>>8&255]+In[i>>16&255]+In[i>>24&255]).toLowerCase()}function gt(n,e,t){return Math.max(e,Math.min(t,n))}function _d(n,e){return(n%e+e)%e}function bx(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function yx(n,e,t){return n!==e?(t-n)/(e-n):0}function ra(n,e,t){return(1-t)*n+t*e}function Sx(n,e,t,i){return ra(n,e,1-Math.exp(-t*i))}function Mx(n,e=1){return e-Math.abs(_d(n,e*2)-e)}function wx(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Ex(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function Tx(n,e){return n+Math.floor(Math.random()*(e-n+1))}function Ax(n,e){return n+Math.random()*(e-n)}function Cx(n){return n*(.5-Math.random())}function Px(n){n!==void 0&&(bh=n);let e=bh+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Rx(n){return n*ys}function Dx(n){return n*ca}function Lx(n){return(n&n-1)===0&&n!==0}function Ix(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Nx(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Ux(n,e,t,i,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+i)/2),d=a((e+i)/2),f=s((e-i)/2),h=a((e-i)/2),p=s((i-e)/2),m=a((i-e)/2);switch(r){case"XYX":n.set(o*d,l*f,l*h,o*c);break;case"YZY":n.set(l*h,o*d,l*f,o*c);break;case"ZXZ":n.set(l*f,l*h,o*d,o*c);break;case"XZX":n.set(o*d,l*m,l*p,o*c);break;case"YXY":n.set(l*p,o*d,l*m,o*c);break;case"ZYZ":n.set(l*m,l*p,o*d,o*c);break;default:ft("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function vi(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Ot(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const um={DEG2RAD:ys,RAD2DEG:ca,generateUUID:ji,clamp:gt,euclideanModulo:_d,mapLinear:bx,inverseLerp:yx,lerp:ra,damp:Sx,pingpong:Mx,smoothstep:wx,smootherstep:Ex,randInt:Tx,randFloat:Ax,randFloatSpread:Cx,seededRandom:Px,degToRad:Rx,radToDeg:Dx,isPowerOfTwo:Lx,ceilPowerOfTwo:Ix,floorPowerOfTwo:Nx,setQuaternionFromProperEuler:Ux,normalize:Ot,denormalize:vi},Kd=class Kd{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(gt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(gt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*i-a*r+e.x,this.y=s*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};Kd.prototype.isVector2=!0;let it=Kd;class xi{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,a,o){let l=i[r+0],c=i[r+1],d=i[r+2],f=i[r+3],h=s[a+0],p=s[a+1],m=s[a+2],x=s[a+3];if(f!==x||l!==h||c!==p||d!==m){let v=l*h+c*p+d*m+f*x;v<0&&(h=-h,p=-p,m=-m,x=-x,v=-v);let g=1-o;if(v<.9995){const y=Math.acos(v),w=Math.sin(y);g=Math.sin(g*y)/w,o=Math.sin(o*y)/w,l=l*g+h*o,c=c*g+p*o,d=d*g+m*o,f=f*g+x*o}else{l=l*g+h*o,c=c*g+p*o,d=d*g+m*o,f=f*g+x*o;const y=1/Math.sqrt(l*l+c*c+d*d+f*f);l*=y,c*=y,d*=y,f*=y}}e[t]=l,e[t+1]=c,e[t+2]=d,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,r,s,a){const o=i[r],l=i[r+1],c=i[r+2],d=i[r+3],f=s[a],h=s[a+1],p=s[a+2],m=s[a+3];return e[t]=o*m+d*f+l*p-c*h,e[t+1]=l*m+d*h+c*f-o*p,e[t+2]=c*m+d*p+o*h-l*f,e[t+3]=d*m-o*f-l*h-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(i/2),d=o(r/2),f=o(s/2),h=l(i/2),p=l(r/2),m=l(s/2);switch(a){case"XYZ":this._x=h*d*f+c*p*m,this._y=c*p*f-h*d*m,this._z=c*d*m+h*p*f,this._w=c*d*f-h*p*m;break;case"YXZ":this._x=h*d*f+c*p*m,this._y=c*p*f-h*d*m,this._z=c*d*m-h*p*f,this._w=c*d*f+h*p*m;break;case"ZXY":this._x=h*d*f-c*p*m,this._y=c*p*f+h*d*m,this._z=c*d*m+h*p*f,this._w=c*d*f-h*p*m;break;case"ZYX":this._x=h*d*f-c*p*m,this._y=c*p*f+h*d*m,this._z=c*d*m-h*p*f,this._w=c*d*f+h*p*m;break;case"YZX":this._x=h*d*f+c*p*m,this._y=c*p*f+h*d*m,this._z=c*d*m-h*p*f,this._w=c*d*f-h*p*m;break;case"XZY":this._x=h*d*f-c*p*m,this._y=c*p*f-h*d*m,this._z=c*d*m+h*p*f,this._w=c*d*f+h*p*m;break;default:ft("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],d=t[6],f=t[10],h=i+o+f;if(h>0){const p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(d-l)*p,this._y=(s-c)*p,this._z=(a-r)*p}else if(i>o&&i>f){const p=2*Math.sqrt(1+i-o-f);this._w=(d-l)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(s+c)/p}else if(o>f){const p=2*Math.sqrt(1+o-i-f);this._w=(s-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(l+d)/p}else{const p=2*Math.sqrt(1+f-i-o);this._w=(a-r)/p,this._x=(s+c)/p,this._y=(l+d)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(gt(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,d=t._w;return this._x=i*d+a*o+r*c-s*l,this._y=r*d+a*l+s*o-i*c,this._z=s*d+a*c+i*l-r*o,this._w=a*d-i*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let i=e._x,r=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(i=-i,r=-r,s=-s,a=-a,o=-o);let l=1-t;if(o<.9995){const c=Math.acos(o),d=Math.sin(c);l=Math.sin(l*c)/d,t=Math.sin(t*c)/d,this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this._onChangeCallback()}else this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const Zd=class Zd{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(yh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(yh.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*i),d=2*(o*t-s*r),f=2*(s*i-a*t);return this.x=t+l*c+a*f-o*d,this.y=i+l*d+o*c-s*f,this.z=r+l*f+s*d-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this.z=gt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this.z=gt(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(gt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-i*l,this.z=i*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Tl.copy(this).projectOnVector(e),this.sub(Tl)}reflect(e){return this.sub(Tl.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(gt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Zd.prototype.isVector3=!0;let X=Zd;const Tl=new X,yh=new xi,$d=class $d{constructor(e,t,i,r,s,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c)}set(e,t,i,r,s,a,o,l,c){const d=this.elements;return d[0]=e,d[1]=r,d[2]=o,d[3]=t,d[4]=s,d[5]=l,d[6]=i,d[7]=a,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],d=i[4],f=i[7],h=i[2],p=i[5],m=i[8],x=r[0],v=r[3],g=r[6],y=r[1],w=r[4],b=r[7],E=r[2],S=r[5],A=r[8];return s[0]=a*x+o*y+l*E,s[3]=a*v+o*w+l*S,s[6]=a*g+o*b+l*A,s[1]=c*x+d*y+f*E,s[4]=c*v+d*w+f*S,s[7]=c*g+d*b+f*A,s[2]=h*x+p*y+m*E,s[5]=h*v+p*w+m*S,s[8]=h*g+p*b+m*A,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8];return t*a*d-t*o*c-i*s*d+i*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],f=d*a-o*c,h=o*l-d*s,p=c*s-a*l,m=t*f+i*h+r*p;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/m;return e[0]=f*x,e[1]=(r*c-d*i)*x,e[2]=(o*i-r*a)*x,e[3]=h*x,e[4]=(d*t-r*l)*x,e[5]=(r*s-o*t)*x,e[6]=p*x,e[7]=(i*l-c*t)*x,e[8]=(a*t-i*s)*x,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Al.makeScale(e,t)),this}rotate(e){return this.premultiply(Al.makeRotation(-e)),this}translate(e,t){return this.premultiply(Al.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}};$d.prototype.isMatrix3=!0;let xt=$d;const Al=new xt,Sh=new xt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Mh=new xt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Fx(){const n={enabled:!0,workingColorSpace:oa,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===Ut&&(r.r=qi(r.r),r.g=qi(r.g),r.b=qi(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Ut&&(r.r=Ss(r.r),r.g=Ss(r.g),r.b=Ss(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===ar?Wo:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return ou("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return ou("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return n.define({[oa]:{primaries:e,whitePoint:i,transfer:Wo,toXYZ:Sh,fromXYZ:Mh,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Wn},outputColorSpaceConfig:{drawingBufferColorSpace:Wn}},[Wn]:{primaries:e,whitePoint:i,transfer:Ut,toXYZ:Sh,fromXYZ:Mh,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Wn}}}),n}const At=Fx();function qi(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Ss(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Vr;class Ox{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{Vr===void 0&&(Vr=Xo("canvas")),Vr.width=e.width,Vr.height=e.height;const r=Vr.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=Vr}return i.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Xo("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=qi(s[a]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(qi(t[i]/255)*255):t[i]=qi(t[i]);return{data:t,width:e.width,height:e.height}}else return ft("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let zx=0;class xd{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:zx++}),this.uuid=ji(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(Cl(r[a].image)):s.push(Cl(r[a]))}else s=Cl(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function Cl(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?Ox.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(ft("Texture: Unable to serialize Texture."),{})}let Bx=0;const Pl=new X;class En extends mr{constructor(e=En.DEFAULT_IMAGE,t=En.DEFAULT_MAPPING,i=_i,r=_i,s=hn,a=lr,o=li,l=qn,c=En.DEFAULT_ANISOTROPY,d=ar){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Bx++}),this.uuid=ji(),this.name="",this.source=new xd(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new it(0,0),this.repeat=new it(1,1),this.center=new it(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new xt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Pl).x}get height(){return this.source.getSize(Pl).y}get depth(){return this.source.getSize(Pl).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const i=e[t];if(i===void 0){ft(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){ft(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==tm)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Lr:e.x=e.x-Math.floor(e.x);break;case _i:e.x=e.x<0?0:1;break;case Pc:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Lr:e.y=e.y-Math.floor(e.y);break;case _i:e.y=e.y<0?0:1;break;case Pc:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}En.DEFAULT_IMAGE=null;En.DEFAULT_MAPPING=tm;En.DEFAULT_ANISOTROPY=1;const Jd=class Jd{constructor(e=0,t=0,i=0,r=1){this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],d=l[4],f=l[8],h=l[1],p=l[5],m=l[9],x=l[2],v=l[6],g=l[10];if(Math.abs(d-h)<.01&&Math.abs(f-x)<.01&&Math.abs(m-v)<.01){if(Math.abs(d+h)<.1&&Math.abs(f+x)<.1&&Math.abs(m+v)<.1&&Math.abs(c+p+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(c+1)/2,b=(p+1)/2,E=(g+1)/2,S=(d+h)/4,A=(f+x)/4,_=(m+v)/4;return w>b&&w>E?w<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(w),r=S/i,s=A/i):b>E?b<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(b),i=S/r,s=_/r):E<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(E),i=A/s,r=_/s),this.set(i,r,s,t),this}let y=Math.sqrt((v-m)*(v-m)+(f-x)*(f-x)+(h-d)*(h-d));return Math.abs(y)<.001&&(y=1),this.x=(v-m)/y,this.y=(f-x)/y,this.z=(h-d)/y,this.w=Math.acos((c+p+g-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this.z=gt(this.z,e.z,t.z),this.w=gt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this.z=gt(this.z,e,t),this.w=gt(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(gt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};Jd.prototype.isVector4=!0;let kt=Jd;class kx extends mr{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:hn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new kt(0,0,e,t),this.scissorTest=!1,this.viewport=new kt(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:i.depth},s=new En(r),a=i.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){const t={minFilter:hn,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,i=e.textures.length;t<i;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new xd(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ni extends kx{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class dm extends En{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=xn,this.minFilter=xn,this.wrapR=_i,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Vx extends En{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=xn,this.minFilter=xn,this.wrapR=_i,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const el=class el{constructor(e,t,i,r,s,a,o,l,c,d,f,h,p,m,x,v){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c,d,f,h,p,m,x,v)}set(e,t,i,r,s,a,o,l,c,d,f,h,p,m,x,v){const g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=r,g[1]=s,g[5]=a,g[9]=o,g[13]=l,g[2]=c,g[6]=d,g[10]=f,g[14]=h,g[3]=p,g[7]=m,g[11]=x,g[15]=v,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new el().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,i=e.elements,r=1/Hr.setFromMatrixColumn(e,0).length(),s=1/Hr.setFromMatrixColumn(e,1).length(),a=1/Hr.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),d=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const h=a*d,p=a*f,m=o*d,x=o*f;t[0]=l*d,t[4]=-l*f,t[8]=c,t[1]=p+m*c,t[5]=h-x*c,t[9]=-o*l,t[2]=x-h*c,t[6]=m+p*c,t[10]=a*l}else if(e.order==="YXZ"){const h=l*d,p=l*f,m=c*d,x=c*f;t[0]=h+x*o,t[4]=m*o-p,t[8]=a*c,t[1]=a*f,t[5]=a*d,t[9]=-o,t[2]=p*o-m,t[6]=x+h*o,t[10]=a*l}else if(e.order==="ZXY"){const h=l*d,p=l*f,m=c*d,x=c*f;t[0]=h-x*o,t[4]=-a*f,t[8]=m+p*o,t[1]=p+m*o,t[5]=a*d,t[9]=x-h*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const h=a*d,p=a*f,m=o*d,x=o*f;t[0]=l*d,t[4]=m*c-p,t[8]=h*c+x,t[1]=l*f,t[5]=x*c+h,t[9]=p*c-m,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const h=a*l,p=a*c,m=o*l,x=o*c;t[0]=l*d,t[4]=x-h*f,t[8]=m*f+p,t[1]=f,t[5]=a*d,t[9]=-o*d,t[2]=-c*d,t[6]=p*f+m,t[10]=h-x*f}else if(e.order==="XZY"){const h=a*l,p=a*c,m=o*l,x=o*c;t[0]=l*d,t[4]=-f,t[8]=c*d,t[1]=h*f+x,t[5]=a*d,t[9]=p*f-m,t[2]=m*f-p,t[6]=o*d,t[10]=x*f+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Hx,e,Gx)}lookAt(e,t,i){const r=this.elements;return $n.subVectors(e,t),$n.lengthSq()===0&&($n.z=1),$n.normalize(),Qi.crossVectors(i,$n),Qi.lengthSq()===0&&(Math.abs(i.z)===1?$n.x+=1e-4:$n.z+=1e-4,$n.normalize(),Qi.crossVectors(i,$n)),Qi.normalize(),Pa.crossVectors($n,Qi),r[0]=Qi.x,r[4]=Pa.x,r[8]=$n.x,r[1]=Qi.y,r[5]=Pa.y,r[9]=$n.y,r[2]=Qi.z,r[6]=Pa.z,r[10]=$n.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],d=i[1],f=i[5],h=i[9],p=i[13],m=i[2],x=i[6],v=i[10],g=i[14],y=i[3],w=i[7],b=i[11],E=i[15],S=r[0],A=r[4],_=r[8],T=r[12],D=r[1],L=r[5],F=r[9],B=r[13],U=r[2],N=r[6],R=r[10],O=r[14],Y=r[3],K=r[7],ne=r[11],ce=r[15];return s[0]=a*S+o*D+l*U+c*Y,s[4]=a*A+o*L+l*N+c*K,s[8]=a*_+o*F+l*R+c*ne,s[12]=a*T+o*B+l*O+c*ce,s[1]=d*S+f*D+h*U+p*Y,s[5]=d*A+f*L+h*N+p*K,s[9]=d*_+f*F+h*R+p*ne,s[13]=d*T+f*B+h*O+p*ce,s[2]=m*S+x*D+v*U+g*Y,s[6]=m*A+x*L+v*N+g*K,s[10]=m*_+x*F+v*R+g*ne,s[14]=m*T+x*B+v*O+g*ce,s[3]=y*S+w*D+b*U+E*Y,s[7]=y*A+w*L+b*N+E*K,s[11]=y*_+w*F+b*R+E*ne,s[15]=y*T+w*B+b*O+E*ce,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],d=e[2],f=e[6],h=e[10],p=e[14],m=e[3],x=e[7],v=e[11],g=e[15],y=l*p-c*h,w=o*p-c*f,b=o*h-l*f,E=a*p-c*d,S=a*h-l*d,A=a*f-o*d;return t*(x*y-v*w+g*b)-i*(m*y-v*E+g*S)+r*(m*w-x*E+g*A)-s*(m*b-x*S+v*A)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],f=e[9],h=e[10],p=e[11],m=e[12],x=e[13],v=e[14],g=e[15],y=t*o-i*a,w=t*l-r*a,b=t*c-s*a,E=i*l-r*o,S=i*c-s*o,A=r*c-s*l,_=d*x-f*m,T=d*v-h*m,D=d*g-p*m,L=f*v-h*x,F=f*g-p*x,B=h*g-p*v,U=y*B-w*F+b*L+E*D-S*T+A*_;if(U===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const N=1/U;return e[0]=(o*B-l*F+c*L)*N,e[1]=(r*F-i*B-s*L)*N,e[2]=(x*A-v*S+g*E)*N,e[3]=(h*S-f*A-p*E)*N,e[4]=(l*D-a*B-c*T)*N,e[5]=(t*B-r*D+s*T)*N,e[6]=(v*b-m*A-g*w)*N,e[7]=(d*A-h*b+p*w)*N,e[8]=(a*F-o*D+c*_)*N,e[9]=(i*D-t*F-s*_)*N,e[10]=(m*S-x*b+g*y)*N,e[11]=(f*b-d*S-p*y)*N,e[12]=(o*T-a*L-l*_)*N,e[13]=(t*L-i*T+r*_)*N,e[14]=(x*w-m*E-v*y)*N,e[15]=(d*E-f*w+h*y)*N,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,a=e.x,o=e.y,l=e.z,c=s*a,d=s*o;return this.set(c*a+i,c*o-r*l,c*l+r*o,0,c*o+r*l,d*o+i,d*l-r*a,0,c*l-r*o,d*l+r*a,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,d=a+a,f=o+o,h=s*c,p=s*d,m=s*f,x=a*d,v=a*f,g=o*f,y=l*c,w=l*d,b=l*f,E=i.x,S=i.y,A=i.z;return r[0]=(1-(x+g))*E,r[1]=(p+b)*E,r[2]=(m-w)*E,r[3]=0,r[4]=(p-b)*S,r[5]=(1-(h+g))*S,r[6]=(v+y)*S,r[7]=0,r[8]=(m+w)*A,r[9]=(v-y)*A,r[10]=(1-(h+x))*A,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];const s=this.determinant();if(s===0)return i.set(1,1,1),t.identity(),this;let a=Hr.set(r[0],r[1],r[2]).length();const o=Hr.set(r[4],r[5],r[6]).length(),l=Hr.set(r[8],r[9],r[10]).length();s<0&&(a=-a),hi.copy(this);const c=1/a,d=1/o,f=1/l;return hi.elements[0]*=c,hi.elements[1]*=c,hi.elements[2]*=c,hi.elements[4]*=d,hi.elements[5]*=d,hi.elements[6]*=d,hi.elements[8]*=f,hi.elements[9]*=f,hi.elements[10]*=f,t.setFromRotationMatrix(hi),i.x=a,i.y=o,i.z=l,this}makePerspective(e,t,i,r,s,a,o=Ni,l=!1){const c=this.elements,d=2*s/(t-e),f=2*s/(i-r),h=(t+e)/(t-e),p=(i+r)/(i-r);let m,x;if(l)m=s/(a-s),x=a*s/(a-s);else if(o===Ni)m=-(a+s)/(a-s),x=-2*a*s/(a-s);else if(o===la)m=-a/(a-s),x=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=h,c[12]=0,c[1]=0,c[5]=f,c[9]=p,c[13]=0,c[2]=0,c[6]=0,c[10]=m,c[14]=x,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,i,r,s,a,o=Ni,l=!1){const c=this.elements,d=2/(t-e),f=2/(i-r),h=-(t+e)/(t-e),p=-(i+r)/(i-r);let m,x;if(l)m=1/(a-s),x=a/(a-s);else if(o===Ni)m=-2/(a-s),x=-(a+s)/(a-s);else if(o===la)m=-1/(a-s),x=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=0,c[12]=h,c[1]=0,c[5]=f,c[9]=0,c[13]=p,c[2]=0,c[6]=0,c[10]=m,c[14]=x,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}};el.prototype.isMatrix4=!0;let Lt=el;const Hr=new X,hi=new Lt,Hx=new X(0,0,0),Gx=new X(1,1,1),Qi=new X,Pa=new X,$n=new X,wh=new Lt,Eh=new xi;class Xn{constructor(e=0,t=0,i=0,r=Xn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],d=r[9],f=r[2],h=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(gt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-gt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(gt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-gt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(gt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-gt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-d,p),this._y=0);break;default:ft("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return wh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(wh,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Eh.setFromEuler(this),this.setFromQuaternion(Eh,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Xn.DEFAULT_ORDER="XYZ";class bd{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Wx=0;const Th=new X,Gr=new xi,Bi=new Lt,Ra=new X,Fs=new X,Xx=new X,jx=new xi,Ah=new X(1,0,0),Ch=new X(0,1,0),Ph=new X(0,0,1),Rh={type:"added"},qx={type:"removed"},Wr={type:"childadded",child:null},Rl={type:"childremoved",child:null};class rn extends mr{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Wx++}),this.uuid=ji(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=rn.DEFAULT_UP.clone();const e=new X,t=new Xn,i=new xi,r=new X(1,1,1);function s(){i.setFromEuler(t,!1)}function a(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Lt},normalMatrix:{value:new xt}}),this.matrix=new Lt,this.matrixWorld=new Lt,this.matrixAutoUpdate=rn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=rn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new bd,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Gr.setFromAxisAngle(e,t),this.quaternion.multiply(Gr),this}rotateOnWorldAxis(e,t){return Gr.setFromAxisAngle(e,t),this.quaternion.premultiply(Gr),this}rotateX(e){return this.rotateOnAxis(Ah,e)}rotateY(e){return this.rotateOnAxis(Ch,e)}rotateZ(e){return this.rotateOnAxis(Ph,e)}translateOnAxis(e,t){return Th.copy(e).applyQuaternion(this.quaternion),this.position.add(Th.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Ah,e)}translateY(e){return this.translateOnAxis(Ch,e)}translateZ(e){return this.translateOnAxis(Ph,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Bi.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?Ra.copy(e):Ra.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),Fs.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Bi.lookAt(Fs,Ra,this.up):Bi.lookAt(Ra,Fs,this.up),this.quaternion.setFromRotationMatrix(Bi),r&&(Bi.extractRotation(r.matrixWorld),Gr.setFromRotationMatrix(Bi),this.quaternion.premultiply(Gr.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Tt("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Rh),Wr.child=e,this.dispatchEvent(Wr),Wr.child=null):Tt("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(qx),Rl.child=e,this.dispatchEvent(Rl),Rl.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Bi.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Bi.multiply(e.parent.matrixWorld)),e.applyMatrix4(Bi),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Rh),Wr.child=e,this.dispatchEvent(Wr),Wr.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){const a=this.children[i].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Fs,e,Xx),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Fs,jx,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,i=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*i-s[8]*r,s[13]+=i-s[1]*t-s[5]*i-s[9]*r,s[14]+=r-s[2]*t-s[6]*i-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c<d;c++){const f=l[c];s(e.shapes,f)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),d=a(e.images),f=a(e.shapes),h=a(e.skeletons),p=a(e.animations),m=a(e.nodes);o.length>0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),d.length>0&&(i.images=d),f.length>0&&(i.shapes=f),h.length>0&&(i.skeletons=h),p.length>0&&(i.animations=p),m.length>0&&(i.nodes=m)}return i.object=r,i;function a(o){const l=[];for(const c in o){const d=o[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}rn.DEFAULT_UP=new X(0,1,0);rn.DEFAULT_MATRIX_AUTO_UPDATE=!0;rn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let Qs=class extends rn{constructor(){super(),this.isGroup=!0,this.type="Group"}};const Yx={type:"move"};class Dl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Qs,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Qs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new X,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new X),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Qs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new X,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new X,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const x of e.hand.values()){const v=t.getJointPose(x,i),g=this._getHandJoint(c,x);v!==null&&(g.matrix.fromArray(v.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.matrixWorldNeedsUpdate=!0,g.jointRadius=v.radius),g.visible=v!==null}const d=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],h=d.position.distanceTo(f.position),p=.02,m=.005;c.inputState.pinching&&h>p+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=p-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Yx)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Qs;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const hm={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},er={h:0,s:0,l:0},Da={h:0,s:0,l:0};function Ll(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class tt{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Wn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,At.colorSpaceToWorking(this,t),this}setRGB(e,t,i,r=At.workingColorSpace){return this.r=e,this.g=t,this.b=i,At.colorSpaceToWorking(this,r),this}setHSL(e,t,i,r=At.workingColorSpace){if(e=_d(e,1),t=gt(t,0,1),i=gt(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=Ll(a,s,e+1/3),this.g=Ll(a,s,e),this.b=Ll(a,s,e-1/3)}return At.colorSpaceToWorking(this,r),this}setStyle(e,t=Wn){function i(s){s!==void 0&&parseFloat(s)<1&&ft("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:ft("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);ft("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Wn){const i=hm[e.toLowerCase()];return i!==void 0?this.setHex(i,t):ft("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=qi(e.r),this.g=qi(e.g),this.b=qi(e.b),this}copyLinearToSRGB(e){return this.r=Ss(e.r),this.g=Ss(e.g),this.b=Ss(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Wn){return At.workingToColorSpace(Nn.copy(this),e),Math.round(gt(Nn.r*255,0,255))*65536+Math.round(gt(Nn.g*255,0,255))*256+Math.round(gt(Nn.b*255,0,255))}getHexString(e=Wn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=At.workingColorSpace){At.workingToColorSpace(Nn.copy(this),t);const i=Nn.r,r=Nn.g,s=Nn.b,a=Math.max(i,r,s),o=Math.min(i,r,s);let l,c;const d=(o+a)/2;if(o===a)l=0,c=0;else{const f=a-o;switch(c=d<=.5?f/(a+o):f/(2-a-o),a){case i:l=(r-s)/f+(r<s?6:0);break;case r:l=(s-i)/f+2;break;case s:l=(i-r)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=d,e}getRGB(e,t=At.workingColorSpace){return At.workingToColorSpace(Nn.copy(this),t),e.r=Nn.r,e.g=Nn.g,e.b=Nn.b,e}getStyle(e=Wn){At.workingToColorSpace(Nn.copy(this),e);const t=Nn.r,i=Nn.g,r=Nn.b;return e!==Wn?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(er),this.setHSL(er.h+e,er.s+t,er.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(er),e.getHSL(Da);const i=ra(er.h,Da.h,t),r=ra(er.s,Da.s,t),s=ra(er.l,Da.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Nn=new tt;tt.NAMES=hm;class Kx extends rn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Xn,this.environmentIntensity=1,this.environmentRotation=new Xn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const fi=new X,ki=new X,Il=new X,Vi=new X,Xr=new X,jr=new X,Dh=new X,Nl=new X,Ul=new X,Fl=new X,Ol=new kt,zl=new kt,Bl=new kt;class ei{constructor(e=new X,t=new X,i=new X){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),fi.subVectors(e,t),r.cross(fi);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){fi.subVectors(r,t),ki.subVectors(i,t),Il.subVectors(e,t);const a=fi.dot(fi),o=fi.dot(ki),l=fi.dot(Il),c=ki.dot(ki),d=ki.dot(Il),f=a*c-o*o;if(f===0)return s.set(0,0,0),null;const h=1/f,p=(c*l-o*d)*h,m=(a*d-o*l)*h;return s.set(1-p-m,m,p)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,Vi)===null?!1:Vi.x>=0&&Vi.y>=0&&Vi.x+Vi.y<=1}static getInterpolation(e,t,i,r,s,a,o,l){return this.getBarycoord(e,t,i,r,Vi)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Vi.x),l.addScaledVector(a,Vi.y),l.addScaledVector(o,Vi.z),l)}static getInterpolatedAttribute(e,t,i,r,s,a){return Ol.setScalar(0),zl.setScalar(0),Bl.setScalar(0),Ol.fromBufferAttribute(e,t),zl.fromBufferAttribute(e,i),Bl.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Ol,s.x),a.addScaledVector(zl,s.y),a.addScaledVector(Bl,s.z),a}static isFrontFacing(e,t,i,r){return fi.subVectors(i,t),ki.subVectors(e,t),fi.cross(ki).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return fi.subVectors(this.c,this.b),ki.subVectors(this.a,this.b),fi.cross(ki).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ei.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ei.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return ei.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return ei.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ei.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let a,o;Xr.subVectors(r,i),jr.subVectors(s,i),Nl.subVectors(e,i);const l=Xr.dot(Nl),c=jr.dot(Nl);if(l<=0&&c<=0)return t.copy(i);Ul.subVectors(e,r);const d=Xr.dot(Ul),f=jr.dot(Ul);if(d>=0&&f<=d)return t.copy(r);const h=l*f-d*c;if(h<=0&&l>=0&&d<=0)return a=l/(l-d),t.copy(i).addScaledVector(Xr,a);Fl.subVectors(e,s);const p=Xr.dot(Fl),m=jr.dot(Fl);if(m>=0&&p<=m)return t.copy(s);const x=p*c-l*m;if(x<=0&&c>=0&&m<=0)return o=c/(c-m),t.copy(i).addScaledVector(jr,o);const v=d*m-p*f;if(v<=0&&f-d>=0&&p-m>=0)return Dh.subVectors(s,r),o=(f-d)/(f-d+(p-m)),t.copy(r).addScaledVector(Dh,o);const g=1/(v+x+h);return a=x*g,o=h*g,t.copy(i).addScaledVector(Xr,a).addScaledVector(jr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class di{constructor(e=new X(1/0,1/0,1/0),t=new X(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(pi.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(pi.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=pi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,pi):pi.fromBufferAttribute(s,a),pi.applyMatrix4(e.matrixWorld),this.expandByPoint(pi);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),La.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),La.copy(i.boundingBox)),La.applyMatrix4(e.matrixWorld),this.union(La)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,pi),pi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Os),Ia.subVectors(this.max,Os),qr.subVectors(e.a,Os),Yr.subVectors(e.b,Os),Kr.subVectors(e.c,Os),tr.subVectors(Yr,qr),nr.subVectors(Kr,Yr),vr.subVectors(qr,Kr);let t=[0,-tr.z,tr.y,0,-nr.z,nr.y,0,-vr.z,vr.y,tr.z,0,-tr.x,nr.z,0,-nr.x,vr.z,0,-vr.x,-tr.y,tr.x,0,-nr.y,nr.x,0,-vr.y,vr.x,0];return!kl(t,qr,Yr,Kr,Ia)||(t=[1,0,0,0,1,0,0,0,1],!kl(t,qr,Yr,Kr,Ia))?!1:(Na.crossVectors(tr,nr),t=[Na.x,Na.y,Na.z],kl(t,qr,Yr,Kr,Ia))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,pi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(pi).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Hi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Hi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Hi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Hi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Hi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Hi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Hi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Hi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Hi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Hi=[new X,new X,new X,new X,new X,new X,new X,new X],pi=new X,La=new di,qr=new X,Yr=new X,Kr=new X,tr=new X,nr=new X,vr=new X,Os=new X,Ia=new X,Na=new X,_r=new X;function kl(n,e,t,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){_r.fromArray(n,s);const o=r.x*Math.abs(_r.x)+r.y*Math.abs(_r.y)+r.z*Math.abs(_r.z),l=e.dot(_r),c=t.dot(_r),d=i.dot(_r);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const Xi=Zx();function Zx(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,d=0;for(;(c&8388608)===0;)c<<=1,d-=8388608;c&=-8388609,d+=947912704,s[l]=c|d}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}function $x(n){Math.abs(n)>65504&&ft("DataUtils.toHalfFloat(): Value out of range."),n=gt(n,-65504,65504),Xi.floatView[0]=n;const e=Xi.uint32View[0],t=e>>23&511;return Xi.baseTable[t]+((e&8388607)>>Xi.shiftTable[t])}function Jx(n){const e=n>>10;return Xi.uint32View[0]=Xi.mantissaTable[Xi.offsetTable[e]+(n&1023)]+Xi.exponentTable[e],Xi.floatView[0]}class Ua{static toHalfFloat(e){return $x(e)}static fromHalfFloat(e){return Jx(e)}}const mn=new X,Fa=new it;let Qx=0;class kn extends mr{constructor(e,t,i=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Qx++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=au,this.updateRanges=[],this.gpuType=ti,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Fa.fromBufferAttribute(this,t),Fa.applyMatrix3(e),this.setXY(t,Fa.x,Fa.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)mn.fromBufferAttribute(this,t),mn.applyMatrix3(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)mn.fromBufferAttribute(this,t),mn.applyMatrix4(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)mn.fromBufferAttribute(this,t),mn.applyNormalMatrix(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)mn.fromBufferAttribute(this,t),mn.transformDirection(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=vi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Ot(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=vi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=vi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=vi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=vi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array),r=Ot(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array),r=Ot(r,this.array),s=Ot(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==au&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class fm extends kn{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class pm extends kn{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class sn extends kn{constructor(e,t,i){super(new Float32Array(e),t,i)}}const eb=new di,zs=new X,Vl=new X;class Ur{constructor(e=new X,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):eb.setFromPoints(e).getCenter(i);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;zs.subVectors(e,this.center);const t=zs.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(zs,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Vl.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(zs.copy(e.center).add(Vl)),this.expandByPoint(zs.copy(e.center).sub(Vl))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let tb=0;const ai=new Lt,Hl=new rn,Zr=new X,Jn=new di,Bs=new di,Sn=new X;class on extends mr{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:tb++}),this.uuid=ji(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(gx(e)?pm:fm)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new xt().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return ai.makeRotationFromQuaternion(e),this.applyMatrix4(ai),this}rotateX(e){return ai.makeRotationX(e),this.applyMatrix4(ai),this}rotateY(e){return ai.makeRotationY(e),this.applyMatrix4(ai),this}rotateZ(e){return ai.makeRotationZ(e),this.applyMatrix4(ai),this}translate(e,t,i){return ai.makeTranslation(e,t,i),this.applyMatrix4(ai),this}scale(e,t,i){return ai.makeScale(e,t,i),this.applyMatrix4(ai),this}lookAt(e){return Hl.lookAt(e),Hl.updateMatrix(),this.applyMatrix4(Hl.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Zr).negate(),this.translate(Zr.x,Zr.y,Zr.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const i=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];i.push(a.x,a.y,a.z||0)}this.setAttribute("position",new sn(i,3))}else{const i=Math.min(e.length,t.count);for(let r=0;r<i;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&ft("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new di);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Tt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new X(-1/0,-1/0,-1/0),new X(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];Jn.setFromBufferAttribute(s),this.morphTargetsRelative?(Sn.addVectors(this.boundingBox.min,Jn.min),this.boundingBox.expandByPoint(Sn),Sn.addVectors(this.boundingBox.max,Jn.max),this.boundingBox.expandByPoint(Sn)):(this.boundingBox.expandByPoint(Jn.min),this.boundingBox.expandByPoint(Jn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Tt('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ur);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Tt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new X,1/0);return}if(e){const i=this.boundingSphere.center;if(Jn.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Bs.setFromBufferAttribute(o),this.morphTargetsRelative?(Sn.addVectors(Jn.min,Bs.min),Jn.expandByPoint(Sn),Sn.addVectors(Jn.max,Bs.max),Jn.expandByPoint(Sn)):(Jn.expandByPoint(Bs.min),Jn.expandByPoint(Bs.max))}Jn.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;s++)Sn.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(Sn));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,d=o.count;c<d;c++)Sn.fromBufferAttribute(o,c),l&&(Zr.fromBufferAttribute(e,c),Sn.add(Zr)),r=Math.max(r,i.distanceToSquared(Sn))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Tt('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Tt("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new kn(new Float32Array(4*i.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let _=0;_<i.count;_++)o[_]=new X,l[_]=new X;const c=new X,d=new X,f=new X,h=new it,p=new it,m=new it,x=new X,v=new X;function g(_,T,D){c.fromBufferAttribute(i,_),d.fromBufferAttribute(i,T),f.fromBufferAttribute(i,D),h.fromBufferAttribute(s,_),p.fromBufferAttribute(s,T),m.fromBufferAttribute(s,D),d.sub(c),f.sub(c),p.sub(h),m.sub(h);const L=1/(p.x*m.y-m.x*p.y);isFinite(L)&&(x.copy(d).multiplyScalar(m.y).addScaledVector(f,-p.y).multiplyScalar(L),v.copy(f).multiplyScalar(p.x).addScaledVector(d,-m.x).multiplyScalar(L),o[_].add(x),o[T].add(x),o[D].add(x),l[_].add(v),l[T].add(v),l[D].add(v))}let y=this.groups;y.length===0&&(y=[{start:0,count:e.count}]);for(let _=0,T=y.length;_<T;++_){const D=y[_],L=D.start,F=D.count;for(let B=L,U=L+F;B<U;B+=3)g(e.getX(B+0),e.getX(B+1),e.getX(B+2))}const w=new X,b=new X,E=new X,S=new X;function A(_){E.fromBufferAttribute(r,_),S.copy(E);const T=o[_];w.copy(T),w.sub(E.multiplyScalar(E.dot(T))).normalize(),b.crossVectors(S,T);const L=b.dot(l[_])<0?-1:1;a.setXYZW(_,w.x,w.y,w.z,L)}for(let _=0,T=y.length;_<T;++_){const D=y[_],L=D.start,F=D.count;for(let B=L,U=L+F;B<U;B+=3)A(e.getX(B+0)),A(e.getX(B+1)),A(e.getX(B+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new kn(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let h=0,p=i.count;h<p;h++)i.setXYZ(h,0,0,0);const r=new X,s=new X,a=new X,o=new X,l=new X,c=new X,d=new X,f=new X;if(e)for(let h=0,p=e.count;h<p;h+=3){const m=e.getX(h+0),x=e.getX(h+1),v=e.getX(h+2);r.fromBufferAttribute(t,m),s.fromBufferAttribute(t,x),a.fromBufferAttribute(t,v),d.subVectors(a,s),f.subVectors(r,s),d.cross(f),o.fromBufferAttribute(i,m),l.fromBufferAttribute(i,x),c.fromBufferAttribute(i,v),o.add(d),l.add(d),c.add(d),i.setXYZ(m,o.x,o.y,o.z),i.setXYZ(x,l.x,l.y,l.z),i.setXYZ(v,c.x,c.y,c.z)}else for(let h=0,p=t.count;h<p;h+=3)r.fromBufferAttribute(t,h+0),s.fromBufferAttribute(t,h+1),a.fromBufferAttribute(t,h+2),d.subVectors(a,s),f.subVectors(r,s),d.cross(f),i.setXYZ(h+0,d.x,d.y,d.z),i.setXYZ(h+1,d.x,d.y,d.z),i.setXYZ(h+2,d.x,d.y,d.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Sn.fromBufferAttribute(e,t),Sn.normalize(),e.setXYZ(t,Sn.x,Sn.y,Sn.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,f=o.normalized,h=new c.constructor(l.length*d);let p=0,m=0;for(let x=0,v=l.length;x<v;x++){o.isInterleavedBufferAttribute?p=l[x]*o.data.stride+o.offset:p=l[x]*d;for(let g=0;g<d;g++)h[m++]=c[p++]}return new kn(h,d,f)}if(this.index===null)return ft("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new on,i=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,i);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let d=0,f=c.length;d<f;d++){const h=c[d],p=e(h,i);l.push(p)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let f=0,h=c.length;f<h;f++){const p=c[f];d.push(p.toJSON(e.data))}d.length>0&&(r[l]=d,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone());const r=e.attributes;for(const c in r){const d=r[c];this.setAttribute(c,d.clone(t))}const s=e.morphAttributes;for(const c in s){const d=[],f=s[c];for(let h=0,p=f.length;h<p;h++)d.push(f[h].clone(t));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,d=a.length;c<d;c++){const f=a[c];this.addGroup(f.start,f.count,f.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class mm{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=au,this.updateRanges=[],this.version=0,this.uuid=ji()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=ji()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=ji()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const On=new X;class Ui{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)On.fromBufferAttribute(this,t),On.applyMatrix4(e),this.setXYZ(t,On.x,On.y,On.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)On.fromBufferAttribute(this,t),On.applyNormalMatrix(e),this.setXYZ(t,On.x,On.y,On.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)On.fromBufferAttribute(this,t),On.transformDirection(e),this.setXYZ(t,On.x,On.y,On.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=vi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Ot(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=vi(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=vi(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=vi(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=vi(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array),r=Ot(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array),r=Ot(r,this.array),s=Ot(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){jo("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new kn(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Ui(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){jo("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}let nb=0;class yi extends mr{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:nb++}),this.uuid=ji(),this.name="",this.type="Material",this.blending=bs,this.side=Kn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=_c,this.blendDst=xc,this.blendEquation=gi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new tt(0,0,0),this.blendAlpha=0,this.depthFunc=ws,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=vh,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=kr,this.stencilZFail=kr,this.stencilZPass=kr,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){ft(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){ft(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==bs&&(i.blending=this.blending),this.side!==Kn&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==_c&&(i.blendSrc=this.blendSrc),this.blendDst!==xc&&(i.blendDst=this.blendDst),this.blendEquation!==gi&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==ws&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==vh&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==kr&&(i.stencilFail=this.stencilFail),this.stencilZFail!==kr&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==kr&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.allowOverride===!1&&(i.allowOverride=!1),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class gm extends yi{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new tt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let $r;const ks=new X,Jr=new X,Qr=new X,es=new it,Vs=new it,vm=new Lt,Oa=new X,Hs=new X,za=new X,Lh=new it,Gl=new it,Ih=new it;class ts extends rn{constructor(e=new gm){if(super(),this.isSprite=!0,this.type="Sprite",$r===void 0){$r=new on;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new mm(t,5);$r.setIndex([0,1,2,0,2,3]),$r.setAttribute("position",new Ui(i,3,0,!1)),$r.setAttribute("uv",new Ui(i,2,3,!1))}this.geometry=$r,this.material=e,this.center=new it(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Tt('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Jr.setFromMatrixScale(this.matrixWorld),vm.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Qr.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Jr.multiplyScalar(-Qr.z);const i=this.material.rotation;let r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));const a=this.center;Ba(Oa.set(-.5,-.5,0),Qr,a,Jr,r,s),Ba(Hs.set(.5,-.5,0),Qr,a,Jr,r,s),Ba(za.set(.5,.5,0),Qr,a,Jr,r,s),Lh.set(0,0),Gl.set(1,0),Ih.set(1,1);let o=e.ray.intersectTriangle(Oa,Hs,za,!1,ks);if(o===null&&(Ba(Hs.set(-.5,.5,0),Qr,a,Jr,r,s),Gl.set(0,1),o=e.ray.intersectTriangle(Oa,za,Hs,!1,ks),o===null))return;const l=e.ray.origin.distanceTo(ks);l<e.near||l>e.far||t.push({distance:l,point:ks.clone(),uv:ei.getInterpolation(ks,Oa,Hs,za,Lh,Gl,Ih,new it),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Ba(n,e,t,i,r,s){es.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(Vs.x=s*es.x-r*es.y,Vs.y=r*es.x+s*es.y):Vs.copy(es),n.copy(e),n.x+=Vs.x,n.y+=Vs.y,n.applyMatrix4(vm)}const Gi=new X,Wl=new X,ka=new X,ir=new X,Xl=new X,Va=new X,jl=new X;class ba{constructor(e=new X,t=new X(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Gi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Gi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Gi.copy(this.origin).addScaledVector(this.direction,t),Gi.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Wl.copy(e).add(t).multiplyScalar(.5),ka.copy(t).sub(e).normalize(),ir.copy(this.origin).sub(Wl);const s=e.distanceTo(t)*.5,a=-this.direction.dot(ka),o=ir.dot(this.direction),l=-ir.dot(ka),c=ir.lengthSq(),d=Math.abs(1-a*a);let f,h,p,m;if(d>0)if(f=a*l-o,h=a*o-l,m=s*d,f>=0)if(h>=-m)if(h<=m){const x=1/d;f*=x,h*=x,p=f*(f+a*h+2*o)+h*(a*f+h+2*l)+c}else h=s,f=Math.max(0,-(a*h+o)),p=-f*f+h*(h+2*l)+c;else h=-s,f=Math.max(0,-(a*h+o)),p=-f*f+h*(h+2*l)+c;else h<=-m?(f=Math.max(0,-(-a*s+o)),h=f>0?-s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c):h<=m?(f=0,h=Math.min(Math.max(-s,-l),s),p=h*(h+2*l)+c):(f=Math.max(0,-(a*s+o)),h=f>0?s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c);else h=a>0?-s:s,f=Math.max(0,-(a*h+o)),p=-f*f+h*(h+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(Wl).addScaledVector(ka,h),p}intersectSphere(e,t){Gi.subVectors(e.center,this.origin);const i=Gi.dot(this.direction),r=Gi.dot(Gi)-i*i,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=i-a,l=i+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,o,l;const c=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,h=this.origin;return c>=0?(i=(e.min.x-h.x)*c,r=(e.max.x-h.x)*c):(i=(e.max.x-h.x)*c,r=(e.min.x-h.x)*c),d>=0?(s=(e.min.y-h.y)*d,a=(e.max.y-h.y)*d):(s=(e.max.y-h.y)*d,a=(e.min.y-h.y)*d),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),f>=0?(o=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(o=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),i>l||o>r)||((o>i||i!==i)&&(i=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Gi)!==null}intersectTriangle(e,t,i,r,s){Xl.subVectors(t,e),Va.subVectors(i,e),jl.crossVectors(Xl,Va);let a=this.direction.dot(jl),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;ir.subVectors(this.origin,e);const l=o*this.direction.dot(Va.crossVectors(ir,Va));if(l<0)return null;const c=o*this.direction.dot(Xl.cross(ir));if(c<0||l+c>a)return null;const d=-o*ir.dot(jl);return d<0?null:this.at(d/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class yd extends yi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new tt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Xn,this.combine=em,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Nh=new Lt,xr=new ba,Ha=new Ur,Uh=new X,Ga=new X,Wa=new X,Xa=new X,ql=new X,ja=new X,Fh=new X,qa=new X;class an extends rn{constructor(e=new on,t=new yd){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){ja.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const d=o[l],f=s[l];d!==0&&(ql.fromBufferAttribute(f,e),a?ja.addScaledVector(ql,d):ja.addScaledVector(ql.sub(t),d))}t.add(ja)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Ha.copy(i.boundingSphere),Ha.applyMatrix4(s),xr.copy(e.ray).recast(e.near),!(Ha.containsPoint(xr.origin)===!1&&(xr.intersectSphere(Ha,Uh)===null||xr.origin.distanceToSquared(Uh)>(e.far-e.near)**2))&&(Nh.copy(s).invert(),xr.copy(e.ray).applyMatrix4(Nh),!(i.boundingBox!==null&&xr.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,xr)))}_computeIntersections(e,t,i){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,f=s.attributes.normal,h=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let m=0,x=h.length;m<x;m++){const v=h[m],g=a[v.materialIndex],y=Math.max(v.start,p.start),w=Math.min(o.count,Math.min(v.start+v.count,p.start+p.count));for(let b=y,E=w;b<E;b+=3){const S=o.getX(b),A=o.getX(b+1),_=o.getX(b+2);r=Ya(this,g,e,i,c,d,f,S,A,_),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=v.materialIndex,t.push(r))}}else{const m=Math.max(0,p.start),x=Math.min(o.count,p.start+p.count);for(let v=m,g=x;v<g;v+=3){const y=o.getX(v),w=o.getX(v+1),b=o.getX(v+2);r=Ya(this,a,e,i,c,d,f,y,w,b),r&&(r.faceIndex=Math.floor(v/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let m=0,x=h.length;m<x;m++){const v=h[m],g=a[v.materialIndex],y=Math.max(v.start,p.start),w=Math.min(l.count,Math.min(v.start+v.count,p.start+p.count));for(let b=y,E=w;b<E;b+=3){const S=b,A=b+1,_=b+2;r=Ya(this,g,e,i,c,d,f,S,A,_),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=v.materialIndex,t.push(r))}}else{const m=Math.max(0,p.start),x=Math.min(l.count,p.start+p.count);for(let v=m,g=x;v<g;v+=3){const y=v,w=v+1,b=v+2;r=Ya(this,a,e,i,c,d,f,y,w,b),r&&(r.faceIndex=Math.floor(v/3),t.push(r))}}}}function ib(n,e,t,i,r,s,a,o){let l;if(e.side===Yn?l=i.intersectTriangle(a,s,r,!0,o):l=i.intersectTriangle(r,s,a,e.side===Kn,o),l===null)return null;qa.copy(o),qa.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(qa);return c<t.near||c>t.far?null:{distance:c,point:qa.clone(),object:n}}function Ya(n,e,t,i,r,s,a,o,l,c){n.getVertexPosition(o,Ga),n.getVertexPosition(l,Wa),n.getVertexPosition(c,Xa);const d=ib(n,e,t,i,Ga,Wa,Xa,Fh);if(d){const f=new X;ei.getBarycoord(Fh,Ga,Wa,Xa,f),r&&(d.uv=ei.getInterpolatedAttribute(r,o,l,c,f,new it)),s&&(d.uv1=ei.getInterpolatedAttribute(s,o,l,c,f,new it)),a&&(d.normal=ei.getInterpolatedAttribute(a,o,l,c,f,new X),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));const h={a:o,b:l,c,normal:new X,materialIndex:0};ei.getNormal(Ga,Wa,Xa,h.normal),d.face=h,d.barycoord=f}return d}class cl extends En{constructor(e=null,t=1,i=1,r,s,a,o,l,c=xn,d=xn,f,h){super(null,a,o,l,c,d,r,s,f,h),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Yl=new X,rb=new X,sb=new xt;class sr{constructor(e=new X(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=Yl.subVectors(i,t).cross(rb.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,i=!0){const r=e.delta(Yl),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/s;return i===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||sb.getNormalMatrix(e),r=this.coplanarPoint(Yl).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const br=new Ur,ab=new it(.5,.5),Ka=new X;class Sd{constructor(e=new sr,t=new sr,i=new sr,r=new sr,s=new sr,a=new sr){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Ni,i=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],d=s[4],f=s[5],h=s[6],p=s[7],m=s[8],x=s[9],v=s[10],g=s[11],y=s[12],w=s[13],b=s[14],E=s[15];if(r[0].setComponents(c-a,p-d,g-m,E-y).normalize(),r[1].setComponents(c+a,p+d,g+m,E+y).normalize(),r[2].setComponents(c+o,p+f,g+x,E+w).normalize(),r[3].setComponents(c-o,p-f,g-x,E-w).normalize(),i)r[4].setComponents(l,h,v,b).normalize(),r[5].setComponents(c-l,p-h,g-v,E-b).normalize();else if(r[4].setComponents(c-l,p-h,g-v,E-b).normalize(),t===Ni)r[5].setComponents(c+l,p+h,g+v,E+b).normalize();else if(t===la)r[5].setComponents(l,h,v,b).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),br.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),br.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(br)}intersectsSprite(e){br.center.set(0,0,0);const t=ab.distanceTo(e.center);return br.radius=.7071067811865476+t,br.applyMatrix4(e.matrixWorld),this.intersectsSphere(br)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(Ka.x=r.normal.x>0?e.max.x:e.min.x,Ka.y=r.normal.y>0?e.max.y:e.min.y,Ka.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Ka)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class ob extends yi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new tt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const qo=new X,Yo=new X,Oh=new Lt,Gs=new ba,Za=new Ur,Kl=new X,zh=new X;class lb extends rn{constructor(e=new on,t=new ob){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)qo.fromBufferAttribute(t,r-1),Yo.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=qo.distanceTo(Yo);e.setAttribute("lineDistance",new sn(i,1))}else ft("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Za.copy(i.boundingSphere),Za.applyMatrix4(r),Za.radius+=s,e.ray.intersectsSphere(Za)===!1)return;Oh.copy(r).invert(),Gs.copy(e.ray).applyMatrix4(Oh);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,d=i.index,h=i.attributes.position;if(d!==null){const p=Math.max(0,a.start),m=Math.min(d.count,a.start+a.count);for(let x=p,v=m-1;x<v;x+=c){const g=d.getX(x),y=d.getX(x+1),w=$a(this,e,Gs,l,g,y,x);w&&t.push(w)}if(this.isLineLoop){const x=d.getX(m-1),v=d.getX(p),g=$a(this,e,Gs,l,x,v,m-1);g&&t.push(g)}}else{const p=Math.max(0,a.start),m=Math.min(h.count,a.start+a.count);for(let x=p,v=m-1;x<v;x+=c){const g=$a(this,e,Gs,l,x,x+1,x);g&&t.push(g)}if(this.isLineLoop){const x=$a(this,e,Gs,l,m-1,p,m-1);x&&t.push(x)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function $a(n,e,t,i,r,s,a){const o=n.geometry.attributes.position;if(qo.fromBufferAttribute(o,r),Yo.fromBufferAttribute(o,s),t.distanceSqToSegment(qo,Yo,Kl,zh)>i)return;Kl.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(Kl);if(!(c<e.near||c>e.far))return{distance:c,point:zh.clone().applyMatrix4(n.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:n}}class Ko extends yi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new tt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Bh=new Lt,lu=new ba,Ja=new Ur,Qa=new X;class Zo extends rn{constructor(e=new on,t=new Ko){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Ja.copy(i.boundingSphere),Ja.applyMatrix4(r),Ja.radius+=s,e.ray.intersectsSphere(Ja)===!1)return;Bh.copy(r).invert(),lu.copy(e.ray).applyMatrix4(Bh);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=i.index,f=i.attributes.position;if(c!==null){const h=Math.max(0,a.start),p=Math.min(c.count,a.start+a.count);for(let m=h,x=p;m<x;m++){const v=c.getX(m);Qa.fromBufferAttribute(f,v),kh(Qa,v,l,r,e,t,this)}}else{const h=Math.max(0,a.start),p=Math.min(f.count,a.start+a.count);for(let m=h,x=p;m<x;m++)Qa.fromBufferAttribute(f,m),kh(Qa,m,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function kh(n,e,t,i,r,s,a){const o=lu.distanceSqToPoint(n);if(o<t){const l=new X;lu.closestPointToPoint(n,l),l.applyMatrix4(i);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class _m extends En{constructor(e=[],t=Dr,i,r,s,a,o,l,c,d){super(e,t,i,r,s,a,o,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class cb extends En{constructor(e,t,i,r,s,a,o,l,c){super(e,t,i,r,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Nr extends En{constructor(e,t,i=Oi,r,s,a,o=xn,l=xn,c,d=Yi,f=1){if(d!==Yi&&d!==cr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const h={width:e,height:t,depth:f};super(h,r,s,a,o,l,d,i,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new xd(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class ub extends Nr{constructor(e,t=Oi,i=Dr,r,s,a=xn,o=xn,l,c=Yi){const d={width:e,height:e,depth:1},f=[d,d,d,d,d,d];super(e,e,t,i,r,s,a,o,l,c),this.image=f,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class xm extends En{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class ya extends on{constructor(e=1,t=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],d=[],f=[];let h=0,p=0;m("z","y","x",-1,-1,i,t,e,a,s,0),m("z","y","x",1,-1,i,t,-e,a,s,1),m("x","z","y",1,1,e,i,t,r,a,2),m("x","z","y",1,-1,e,i,-t,r,a,3),m("x","y","z",1,-1,e,t,i,r,s,4),m("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new sn(c,3)),this.setAttribute("normal",new sn(d,3)),this.setAttribute("uv",new sn(f,2));function m(x,v,g,y,w,b,E,S,A,_,T){const D=b/A,L=E/_,F=b/2,B=E/2,U=S/2,N=A+1,R=_+1;let O=0,Y=0;const K=new X;for(let ne=0;ne<R;ne++){const ce=ne*L-B;for(let k=0;k<N;k++){const te=k*D-F;K[x]=te*y,K[v]=ce*w,K[g]=U,c.push(K.x,K.y,K.z),K[x]=0,K[v]=0,K[g]=S>0?1:-1,d.push(K.x,K.y,K.z),f.push(k/A),f.push(1-ne/_),O+=1}}for(let ne=0;ne<_;ne++)for(let ce=0;ce<A;ce++){const k=h+ce+N*ne,te=h+ce+N*(ne+1),fe=h+(ce+1)+N*(ne+1),me=h+(ce+1)+N*ne;l.push(k,te,me),l.push(te,fe,me),Y+=6}o.addGroup(p,Y,T),p+=Y,h+=O}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ya(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Md extends on{constructor(e=1,t=1,i=1,r=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const d=[],f=[],h=[],p=[];let m=0;const x=[],v=i/2;let g=0;y(),a===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(d),this.setAttribute("position",new sn(f,3)),this.setAttribute("normal",new sn(h,3)),this.setAttribute("uv",new sn(p,2));function y(){const b=new X,E=new X;let S=0;const A=(t-e)/i;for(let _=0;_<=s;_++){const T=[],D=_/s,L=D*(t-e)+e;for(let F=0;F<=r;F++){const B=F/r,U=B*l+o,N=Math.sin(U),R=Math.cos(U);E.x=L*N,E.y=-D*i+v,E.z=L*R,f.push(E.x,E.y,E.z),b.set(N,A,R).normalize(),h.push(b.x,b.y,b.z),p.push(B,1-D),T.push(m++)}x.push(T)}for(let _=0;_<r;_++)for(let T=0;T<s;T++){const D=x[T][_],L=x[T+1][_],F=x[T+1][_+1],B=x[T][_+1];(e>0||T!==0)&&(d.push(D,L,B),S+=3),(t>0||T!==s-1)&&(d.push(L,F,B),S+=3)}c.addGroup(g,S,0),g+=S}function w(b){const E=m,S=new it,A=new X;let _=0;const T=b===!0?e:t,D=b===!0?1:-1;for(let F=1;F<=r;F++)f.push(0,v*D,0),h.push(0,D,0),p.push(.5,.5),m++;const L=m;for(let F=0;F<=r;F++){const U=F/r*l+o,N=Math.cos(U),R=Math.sin(U);A.x=T*R,A.y=v*D,A.z=T*N,f.push(A.x,A.y,A.z),h.push(0,D,0),S.x=N*.5+.5,S.y=R*.5*D+.5,p.push(S.x,S.y),m++}for(let F=0;F<r;F++){const B=E+F,U=L+F;b===!0?d.push(U,U+1,B):d.push(U+1,U,B),_+=3}c.addGroup(g,_,b===!0?1:2),g+=_}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Md(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}const eo=new X,to=new X,Zl=new X,no=new ei;class db extends on{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(ys*t),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],d=["a","b","c"],f=new Array(3),h={},p=[];for(let m=0;m<l;m+=3){a?(c[0]=a.getX(m),c[1]=a.getX(m+1),c[2]=a.getX(m+2)):(c[0]=m,c[1]=m+1,c[2]=m+2);const{a:x,b:v,c:g}=no;if(x.fromBufferAttribute(o,c[0]),v.fromBufferAttribute(o,c[1]),g.fromBufferAttribute(o,c[2]),no.getNormal(Zl),f[0]=`${Math.round(x.x*r)},${Math.round(x.y*r)},${Math.round(x.z*r)}`,f[1]=`${Math.round(v.x*r)},${Math.round(v.y*r)},${Math.round(v.z*r)}`,f[2]=`${Math.round(g.x*r)},${Math.round(g.y*r)},${Math.round(g.z*r)}`,!(f[0]===f[1]||f[1]===f[2]||f[2]===f[0]))for(let y=0;y<3;y++){const w=(y+1)%3,b=f[y],E=f[w],S=no[d[y]],A=no[d[w]],_=`${b}_${E}`,T=`${E}_${b}`;T in h&&h[T]?(Zl.dot(h[T].normal)<=s&&(p.push(S.x,S.y,S.z),p.push(A.x,A.y,A.z)),h[T]=null):_ in h||(h[_]={index0:c[y],index1:c[w],normal:Zl.clone()})}}for(const m in h)if(h[m]){const{index0:x,index1:v}=h[m];eo.fromBufferAttribute(o,x),to.fromBufferAttribute(o,v),p.push(eo.x,eo.y,eo.z),p.push(to.x,to.y,to.z)}this.setAttribute("position",new sn(p,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Ds extends on{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(i),l=Math.floor(r),c=o+1,d=l+1,f=e/o,h=t/l,p=[],m=[],x=[],v=[];for(let g=0;g<d;g++){const y=g*h-a;for(let w=0;w<c;w++){const b=w*f-s;m.push(b,-y,0),x.push(0,0,1),v.push(w/o),v.push(1-g/l)}}for(let g=0;g<l;g++)for(let y=0;y<o;y++){const w=y+c*g,b=y+c*(g+1),E=y+1+c*(g+1),S=y+1+c*g;p.push(w,b,S),p.push(b,E,S)}this.setIndex(p),this.setAttribute("position",new sn(m,3)),this.setAttribute("normal",new sn(x,3)),this.setAttribute("uv",new sn(v,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ds(e.width,e.height,e.widthSegments,e.heightSegments)}}class hb extends on{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new X,s=new X;if(e.index!==null){const a=e.attributes.position,o=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,d=l.length;c<d;++c){const f=l[c],h=f.start,p=f.count;for(let m=h,x=h+p;m<x;m+=3)for(let v=0;v<3;v++){const g=o.getX(m+v),y=o.getX(m+(v+1)%3);r.fromBufferAttribute(a,g),s.fromBufferAttribute(a,y),Vh(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const d=3*o+c,f=3*o+(c+1)%3;r.fromBufferAttribute(a,d),s.fromBufferAttribute(a,f),Vh(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new sn(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Vh(n,e,t){const i=`${n.x},${n.y},${n.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${n.x},${n.y},${n.z}`;return t.has(i)===!0||t.has(r)===!0?!1:(t.add(i),t.add(r),!0)}function As(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];if(Hh(r))r.isRenderTargetTexture?(ft("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone();else if(Array.isArray(r))if(Hh(r[0])){const s=[];for(let a=0,o=r.length;a<o;a++)s[a]=r[a].clone();e[t][i]=s}else e[t][i]=r.slice();else e[t][i]=r}}return e}function zn(n){const e={};for(let t=0;t<n.length;t++){const i=As(n[t]);for(const r in i)e[r]=i[r]}return e}function Hh(n){return n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)}function fb(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function bm(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:At.workingColorSpace}const Di={clone:As,merge:zn};var pb=`void main() {
1
+ import{_ as gp}from"../chunks/BapAUJpM.js";import"../chunks/DsnmJJEf.js";import{b1 as Fg,bc as Og,bm as zg,P as Bg,O as Ms,Q as Cu,g as u,h as W,s as Oe,u as z,j as Pt,J as wn,p as st,f as ee,a as at,d as ae,c as $,i as wt,r as q,aB as kg,t as Me,aj as Mr,n as yt,b as Ps,K as Vg,bn as vp,e as Hg,ax as th,bo as nh}from"../chunks/BtOVeLcI.js";import{o as dn,s as Ae,a as Xt,d as zi,k as Gg,e as Wg}from"../chunks/BNpXeuQ_.js";import{c as we,a as P,p as Tn,f as Z,t as Et,d as Xg}from"../chunks/BoLtD6vo.js";import{i as xe}from"../chunks/DAQN5y4A.js";import{d as ma,u as Pu,o as jg,p as Nt,L as qg,l as Yg,a as us,D as mc,i as No,M as Kg,b as gc,f as _l,g as xl,A as Zg,U as $g}from"../chunks/7w20m49Y.js";import{S as Jg}from"../chunks/BRHPfB44.js";import{M as Qg,l as ev,m as tv,q as _p,r as nv,s as iv,t as rv,v as sv,w as av,x as ov,A as lv,o as cv,f as xp,u as uv,g as dv,y as hv,a as fv,k as pv}from"../chunks/SM988pE-.js";import{f as Ft,r as Ru,e as Zt,a as Qt,c as Dt,d as Uo,k as bp,l as bl,j as Ii,s as mv}from"../chunks/22C0ZkpD.js";import{s as mt,r as ut,p as le,c as Ne,b as ui}from"../chunks/ChEZL1UP.js";import{p as ih}from"../chunks/CWoH8aIC.js";import{a as tl,o as yp}from"../chunks/C4cbQnXC.js";import{w as bo,F as rh}from"../chunks/aGXM-hZQ.js";import{b as Sp}from"../chunks/Bfsx6G_D.js";import{S as na}from"../chunks/CkeXmJE0.js";import{S as Fo}from"../chunks/BdIvVr5K.js";import{S as sh}from"../chunks/CitY1SZ1.js";import{C as Du}from"../chunks/Bj6y_fSA.js";import{I as fn,c as ci}from"../chunks/BuC_QZkR.js";import{X as gv}from"../chunks/Ca8xAcDY.js";import{R as wr,D as Er,b as dr,a as ms,c as gs}from"../chunks/jiMRToiE.js";import{s as pt}from"../chunks/8uBOzWQA.js";import{a as bi,e as Pr,h as Oo,x as vv,c as Lu,b as Vn,d as Qe,m as jt,s as vc,r as Iu,S as _v,y as xv}from"../chunks/Bf2Kb0d4.js";import{C as pr,w as fr,E as bv,S as yv,h as Mp,n as Un,d as wp,e as Ep,a as Tp,A as Ap,H as Cp,c as Pp,j as Rp}from"../chunks/MGblXd4C.js";import{i as Sv,H as Mv,F as Dp,P as Lp,c as Ip,g as zo,d as Np,o as Up,R as wv,S as Ev,a as Tv,b as Av}from"../chunks/DNdxyuBP.js";import{C as ia}from"../chunks/LZnjyP_x.js";import{B as Bn}from"../chunks/mlApEF2J.js";import{P as Cv,F as ah,D as yl,U as oh}from"../chunks/CFq1UfS7.js";import{h as Pv}from"../chunks/ClDgNAKE.js";import{T as Rv,a as Dv,b as Lv,d as Iv,c as Nv}from"../chunks/BVUbFuzT.js";import{C as Fp,a as vs}from"../chunks/BawNisij.js";import{C as Op}from"../chunks/Mn4D08zE.js";import{T as yo}from"../chunks/DllGpGf3.js";import{C as Uv,a as Fv}from"../chunks/CY6l1SkO.js";import{C as Ov}from"../chunks/C2PlvXZq.js";import{C as zv}from"../chunks/C0Xb3vka.js";import{L as or}from"../chunks/wegQDfR0.js";import{a as Bv}from"../chunks/Tuzbj3g9.js";import{I as _s}from"../chunks/CJvX1bCR.js";import{M as kv,C as Vv,I as Hv}from"../chunks/C38beKZN.js";import{t as Gv}from"../chunks/ADO9qhNc.js";import{F as Wv}from"../chunks/k1GnUs7f.js";import{r as Xv}from"../chunks/Cbu9Tg11.js";import{C as jv}from"../chunks/3w4Rd2x8.js";import{inflateSync as qv}from"../chunks/BzBbrBKd.js";const Yv=[];function Nu(n,e=!1,t=!1){return So(n,new Map,"",Yv,null,t)}function So(n,e,t,i,r=null,s=!1){if(typeof n=="object"&&n!==null){var a=e.get(n);if(a!==void 0)return a;if(n instanceof Map)return new Map(n);if(n instanceof Set)return new Set(n);if(Fg(n)){var o=Array(n.length);e.set(n,o),r!==null&&e.set(r,o);for(var l=0;l<n.length;l+=1){var c=n[l];l in n&&(o[l]=So(c,e,t,i,null,s))}return o}if(Og(n)===zg){o={},e.set(n,o),r!==null&&e.set(r,o);for(var d of Object.keys(n))o[d]=So(n[d],e,t,i,null,s);return o}if(n instanceof Date)return structuredClone(n);if(typeof n.toJSON=="function"&&!s)return So(n.toJSON(),e,t,i,n)}if(n instanceof EventTarget)return n;try{return structuredClone(n)}catch{return n}}class Kv{#e;#t;constructor(e){this.#e=e,this.#t=Symbol(e)}get key(){return this.#t}exists(){return Bg(this.#t)}get(){const e=Ms(this.#t);if(e===void 0)throw new Error(`Context "${this.#e}" not found`);return e}getOr(e){const t=Ms(this.#t);return t===void 0?e:t}set(e){return Cu(this.#t,e)}}function lh(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}],["path",{d:"m3.3 7 8.7 5 8.7-5"}],["path",{d:"M12 22V12"}]];fn(n,mt({name:"box"},()=>t,{get iconNode(){return i}}))}function Zv(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"}],["circle",{cx:"12",cy:"13",r:"3"}]];fn(n,mt({name:"camera"},()=>t,{get iconNode(){return i}}))}function $v(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335"}],["path",{d:"m9 11 3 3L22 4"}]];fn(n,mt({name:"circle-check-big"},()=>t,{get iconNode(){return i}}))}function ch(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}],["path",{d:"M12 17h.01"}]];fn(n,mt({name:"circle-question-mark"},()=>t,{get iconNode(){return i}}))}function zp(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M12 15V3"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}],["path",{d:"m7 10 5 5 5-5"}]];fn(n,mt({name:"download"},()=>t,{get iconNode(){return i}}))}function Sl(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}],["path",{d:"m2 2 20 20"}]];fn(n,mt({name:"eye-off"},()=>t,{get iconNode(){return i}}))}function Ml(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}],["circle",{cx:"12",cy:"12",r:"3"}]];fn(n,mt({name:"eye"},()=>t,{get iconNode(){return i}}))}function Jv(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}]];fn(n,mt({name:"file"},()=>t,{get iconNode(){return i}}))}function Qv(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}]];fn(n,mt({name:"folder"},()=>t,{get iconNode(){return i}}))}function e0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["line",{x1:"22",x2:"2",y1:"6",y2:"6"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22"}]];fn(n,mt({name:"frame"},()=>t,{get iconNode(){return i}}))}function t0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M3 9h18"}],["path",{d:"M3 15h18"}],["path",{d:"M9 3v18"}],["path",{d:"M15 3v18"}]];fn(n,mt({name:"grid-3x3"},()=>t,{get iconNode(){return i}}))}function n0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}]];fn(n,mt({name:"inbox"},()=>t,{get iconNode(){return i}}))}function i0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"}]];fn(n,mt({name:"layers"},()=>t,{get iconNode(){return i}}))}function r0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"}]];fn(n,mt({name:"link"},()=>t,{get iconNode(){return i}}))}function Uu(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M12 2v4"}],["path",{d:"m16.2 7.8 2.9-2.9"}],["path",{d:"M18 12h4"}],["path",{d:"m16.2 16.2 2.9 2.9"}],["path",{d:"M12 18v4"}],["path",{d:"m4.9 19.1 2.9-2.9"}],["path",{d:"M2 12h4"}],["path",{d:"m4.9 4.9 2.9 2.9"}]];fn(n,mt({name:"loader"},()=>t,{get iconNode(){return i}}))}function Fu(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"}]];fn(n,mt({name:"maximize"},()=>t,{get iconNode(){return i}}))}function Ou(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"}]];fn(n,mt({name:"minimize"},()=>t,{get iconNode(){return i}}))}function s0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z"}],["path",{d:"m14.5 12.5 2-2"}],["path",{d:"m11.5 9.5 2-2"}],["path",{d:"m8.5 6.5 2-2"}],["path",{d:"m17.5 15.5 2-2"}]];fn(n,mt({name:"ruler"},()=>t,{get iconNode(){return i}}))}function a0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M14 17H5"}],["path",{d:"M19 7h-9"}],["circle",{cx:"17",cy:"17",r:"3"}],["circle",{cx:"7",cy:"7",r:"3"}]];fn(n,mt({name:"settings-2"},()=>t,{get iconNode(){return i}}))}function o0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}]];fn(n,mt({name:"square"},()=>t,{get iconNode(){return i}}))}function l0(n,e){let t=ut(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"}]];fn(n,mt({name:"zap"},()=>t,{get iconNode(){return i}}))}function c0(n,e){if(Sv(n)){const i=n();return i===void 0?e:i}return n===void 0?e:n}function nl(n,e){let t=Oe(null);const i=z(()=>c0(e,250));function r(...s){if(u(t))u(t).timeout&&clearTimeout(u(t).timeout);else{let a,o;const l=new Promise((c,d)=>{a=c,o=d});W(t,{timeout:null,runner:null,promise:l,resolve:a,reject:o},!0)}return u(t).runner=async()=>{if(!u(t))return;const a=u(t);W(t,null);try{a.resolve(await n.apply(this,s))}catch(o){a.reject(o)}},u(t).timeout=setTimeout(u(t).runner,u(i)),u(t).promise}return r.cancel=async()=>{(!u(t)||u(t).timeout===null)&&(await new Promise(s=>setTimeout(s,0)),!u(t)||u(t).timeout===null)||(clearTimeout(u(t).timeout),u(t).reject("Cancelled"),W(t,null))},r.runScheduledNow=async()=>{(!u(t)||!u(t).timeout)&&(await new Promise(s=>setTimeout(s,0)),!u(t)||!u(t).timeout)||(clearTimeout(u(t).timeout),u(t).timeout=null,await u(t).runner?.())},Object.defineProperty(r,"pending",{enumerable:!0,get(){return!!u(t)?.timeout}}),r}class zu{#e=Oe(!1);constructor(){Pt(()=>(wn(()=>W(this.#e,!0)),()=>{W(this.#e,!1)}))}get current(){return u(this.#e)}}const u0=Lu({component:"checkbox",parts:["root","group","group-label","input"]}),d0=new pr("Checkbox.Group"),Bp=new pr("Checkbox.Root");class Bu{static create(e,t=null){return Bp.set(new Bu(e,t))}opts;group;#e=z(()=>this.group&&this.group.opts.name.current?this.group.opts.name.current:this.opts.name.current);get trueName(){return u(this.#e)}set trueName(e){W(this.#e,e)}#t=z(()=>this.group&&this.group.opts.required.current?!0:this.opts.required.current);get trueRequired(){return u(this.#t)}set trueRequired(e){W(this.#t,e)}#n=z(()=>this.group&&this.group.opts.disabled.current?!0:this.opts.disabled.current);get trueDisabled(){return u(this.#n)}set trueDisabled(e){W(this.#n,e)}#i=z(()=>this.group&&this.group.opts.readonly.current?!0:this.opts.readonly.current);get trueReadonly(){return u(this.#i)}set trueReadonly(e){W(this.#i,e)}attachment;constructor(e,t){this.opts=e,this.group=t,this.attachment=bi(this.opts.ref),this.onkeydown=this.onkeydown.bind(this),this.onclick=this.onclick.bind(this),fr.pre([()=>Nu(this.group?.opts.value.current),()=>this.opts.value.current],([i,r])=>{!i||!r||(this.opts.checked.current=i.includes(r))}),fr.pre(()=>this.opts.checked.current,i=>{this.group&&(i?this.group?.addValue(this.opts.value.current):this.group?.removeValue(this.opts.value.current))})}onkeydown(e){if(!(this.trueDisabled||this.trueReadonly)){if(e.key===bv){e.preventDefault(),this.opts.type.current==="submit"&&e.currentTarget.closest("form")?.requestSubmit();return}e.key===yv&&(e.preventDefault(),this.#r())}}#r(){this.opts.indeterminate.current?(this.opts.indeterminate.current=!1,this.opts.checked.current=!0):this.opts.checked.current=!this.opts.checked.current}onclick(e){if(!(this.trueDisabled||this.trueReadonly)){if(this.opts.type.current==="submit"){this.#r();return}e.preventDefault(),this.#r()}}#s=z(()=>({checked:this.opts.checked.current,indeterminate:this.opts.indeterminate.current}));get snippetProps(){return u(this.#s)}set snippetProps(e){W(this.#s,e)}#a=z(()=>({id:this.opts.id.current,role:"checkbox",type:this.opts.type.current,disabled:this.trueDisabled,"aria-checked":vv(this.opts.checked.current,this.opts.indeterminate.current),"aria-required":Oo(this.trueRequired),"aria-readonly":Oo(this.trueReadonly),"data-disabled":Pr(this.trueDisabled),"data-readonly":Pr(this.trueReadonly),"data-state":h0(this.opts.checked.current,this.opts.indeterminate.current),[u0.root]:"",onclick:this.onclick,onkeydown:this.onkeydown,...this.attachment}));get props(){return u(this.#a)}set props(e){W(this.#a,e)}}class ku{static create(){return new ku(Bp.get())}root;#e=z(()=>this.root.group?!!(this.root.opts.value.current!==void 0&&this.root.group.opts.value.current.includes(this.root.opts.value.current)):this.root.opts.checked.current);get trueChecked(){return u(this.#e)}set trueChecked(e){W(this.#e,e)}#t=z(()=>!!this.root.trueName);get shouldRender(){return u(this.#t)}set shouldRender(e){W(this.#t,e)}constructor(e){this.root=e,this.onfocus=this.onfocus.bind(this)}onfocus(e){Mp(this.root.opts.ref.current)&&this.root.opts.ref.current.focus()}#n=z(()=>({type:"checkbox",checked:this.root.opts.checked.current===!0,disabled:this.root.trueDisabled,required:this.root.trueRequired,name:this.root.trueName,value:this.root.opts.value.current,readonly:this.root.trueReadonly,onfocus:this.onfocus}));get props(){return u(this.#n)}set props(e){W(this.#n,e)}}function h0(n,e){return e?"indeterminate":n?"checked":"unchecked"}function f0(n,e){st(e,!0);const t=ku.create();var i=we(),r=ee(i);{var s=a=>{Mv(a,mt(()=>t.props))};xe(r,a=>{t.shouldRender&&a(s)})}P(n,i),at()}var p0=Z("<button><!></button>"),m0=Z("<!> <!>",1);function g0(n,e){const t=Tn();st(e,!0);let i=le(e,"checked",15,!1),r=le(e,"ref",15,null),s=le(e,"disabled",3,!1),a=le(e,"required",3,!1),o=le(e,"name",3,void 0),l=le(e,"value",3,"on"),c=le(e,"id",19,()=>Vn(t)),d=le(e,"indeterminate",15,!1),f=le(e,"type",3,"button"),h=ut(e,["$$slots","$$events","$$legacy","checked","ref","onCheckedChange","children","disabled","required","name","value","id","indeterminate","onIndeterminateChange","child","type","readonly"]);const p=d0.getOr(null);p&&l()&&(p.opts.value.current.includes(l())?i(!0):i(!1)),fr.pre(()=>l(),()=>{p&&l()&&(p.opts.value.current.includes(l())?i(!0):i(!1))});const m=Bu.create({checked:Qe(()=>i(),E=>{i(E),e.onCheckedChange?.(E)}),disabled:Qe(()=>s()??!1),required:Qe(()=>a()),name:Qe(()=>o()),value:Qe(()=>l()),id:Qe(()=>c()),ref:Qe(()=>r(),E=>r(E)),indeterminate:Qe(()=>d(),E=>{d(E),e.onIndeterminateChange?.(E)}),type:Qe(()=>f()),readonly:Qe(()=>!!e.readonly)},p),x=z(()=>jt({...h},m.props));var v=m0(),g=ee(v);{var y=E=>{var S=we(),A=ee(S);{let _=z(()=>({props:u(x),...m.snippetProps}));pt(A,()=>e.child,()=>u(_))}P(E,S)},w=E=>{var S=p0();Ft(S,()=>({...u(x)}));var A=$(S);pt(A,()=>e.children??wt,()=>m.snippetProps),q(S),P(E,S)};xe(g,E=>{e.child?E(y):E(w,-1)})}var b=ae(g,2);f0(b,{}),P(n,v),at()}function v0(n,e){st(e,!0);let t=le(e,"open",15,!1),i=le(e,"onOpenChange",3,Un),r=le(e,"onOpenChangeComplete",3,Un);Qg.create({open:Qe(()=>t(),s=>{t(s),i()?.(s)}),onOpenChangeComplete:Qe(()=>r())}),Dp(n,{children:(s,a)=>{var o=we(),l=ee(o);pt(l,()=>e.children??wt),P(s,o)},$$slots:{default:!0}}),at()}var _0=Z("<div><!></div>");function Ji(n,e){const t=Tn();st(e,!0);let i=le(e,"ref",15,null),r=le(e,"id",19,()=>Vn(t)),s=le(e,"disabled",3,!1),a=le(e,"onSelect",3,Un),o=le(e,"closeOnSelect",3,!0),l=ut(e,["$$slots","$$events","$$legacy","child","children","ref","id","disabled","onSelect","closeOnSelect"]);const c=ev.create({id:Qe(()=>r()),disabled:Qe(()=>s()),onSelect:Qe(()=>a()),ref:Qe(()=>i(),x=>i(x)),closeOnSelect:Qe(()=>o())}),d=z(()=>jt(l,c.props));var f=we(),h=ee(f);{var p=x=>{var v=we(),g=ee(v);pt(g,()=>e.child,()=>({props:u(d)})),P(x,v)},m=x=>{var v=_0();Ft(v,()=>({...u(d)}));var g=$(v);pt(g,()=>e.children??wt),q(v),P(x,v)};xe(h,x=>{e.child?x(p):x(m,-1)})}P(n,f),at()}var x0=Z("<div><!></div>");function b0(n,e){const t=Tn();st(e,!0);let i=le(e,"ref",15,null),r=le(e,"id",19,()=>Vn(t)),s=ut(e,["$$slots","$$events","$$legacy","ref","id","child","children"]);const a=tv.create({id:Qe(()=>r()),ref:Qe(()=>i(),h=>i(h))}),o=z(()=>jt(s,a.props));var l=we(),c=ee(l);{var d=h=>{var p=we(),m=ee(p);pt(m,()=>e.child,()=>({props:u(o)})),P(h,p)},f=h=>{var p=x0();Ft(p,()=>({...u(o)}));var m=$(p);pt(m,()=>e.children??wt),q(p),P(h,p)};xe(c,h=>{e.child?h(d):h(f,-1)})}P(n,l),at()}var y0=Z("<div><div><!></div></div>"),S0=Z("<div><div><!></div></div>");function M0(n,e){const t=Tn();st(e,!0);let i=le(e,"id",19,()=>Vn(t)),r=le(e,"ref",15,null),s=le(e,"loop",3,!0),a=le(e,"onInteractOutside",3,Un),o=le(e,"forceMount",3,!1),l=le(e,"onEscapeKeydown",3,Un),c=le(e,"interactOutsideBehavior",3,"defer-otherwise-close"),d=le(e,"escapeKeydownBehavior",3,"defer-otherwise-close"),f=le(e,"onOpenAutoFocus",3,Un),h=le(e,"onCloseAutoFocus",3,Un),p=le(e,"onFocusOutside",3,Un),m=le(e,"side",3,"right"),x=le(e,"trapFocus",3,!1),v=ut(e,["$$slots","$$events","$$legacy","id","ref","children","child","loop","onInteractOutside","forceMount","onEscapeKeydown","interactOutsideBehavior","escapeKeydownBehavior","onOpenAutoFocus","onCloseAutoFocus","onFocusOutside","side","trapFocus","style"]);const g=_p.create({id:Qe(()=>i()),loop:Qe(()=>s()),ref:Qe(()=>r(),U=>r(U)),isSub:!0,onCloseAutoFocus:Qe(()=>S)});function y(U){const N=U.currentTarget.contains(U.target),R=iv[g.parentMenu.root.opts.dir.current].includes(U.key);N&&R&&(g.parentMenu.onClose(),g.parentMenu.triggerNode?.focus(),U.preventDefault())}const w=z(()=>g.parentMenu.root.getBitsAttr("sub-content")),b=z(()=>jt(v,g.props,{side:m(),onkeydown:y,[u(w)]:""}));function E(U){f()(U),!U.defaultPrevented&&(U.preventDefault(),g.parentMenu.root.isUsingKeyboard&&g.parentMenu.contentNode&&nv.dispatch(g.parentMenu.contentNode))}function S(U){h()(U),!U.defaultPrevented&&U.preventDefault()}function A(U){a()(U),!U.defaultPrevented&&g.parentMenu.onClose()}function _(U){l()(U),!U.defaultPrevented&&g.parentMenu.onClose()}function T(U){if(p()(U),U.defaultPrevented||!Mp(U.target)||U.target.id===g.parentMenu.triggerNode?.id)return;if(g.parentMenu.parentMenu?.contentNode?.contains(U.target)){g.parentMenu.onClose(),U.preventDefault();return}const R=`[${g.parentMenu.root.getBitsAttr("sub-content")}]`;if(U.target.closest(R)){U.preventDefault();return}g.parentMenu.onClose()}var D=we(),L=ee(D);{var F=U=>{Lp(U,mt(()=>u(b),{get ref(){return g.opts.ref},get interactOutsideBehavior(){return c()},get escapeKeydownBehavior(){return d()},onOpenAutoFocus:E,get enabled(){return g.parentMenu.opts.open.current},onInteractOutside:A,onEscapeKeydown:_,onFocusOutside:T,preventScroll:!1,get loop(){return s()},get trapFocus(){return x()},get shouldRender(){return g.shouldRender},popper:(R,O)=>{let Y=()=>(O?.()).props,K=()=>(O?.()).wrapperProps;const ne=z(()=>jt(Y(),u(b),{style:zo("menu")},{style:e.style}));var ce=we(),k=ee(ce);{var te=me=>{var G=we(),Q=ee(G);{let j=z(()=>({props:u(ne),wrapperProps:K(),...g.snippetProps}));pt(Q,()=>e.child,()=>u(j))}P(me,G)},fe=me=>{var G=y0();Ft(G,()=>({...K()}));var Q=$(G);Ft(Q,()=>({...u(ne)}));var j=$(Q);pt(j,()=>e.children??wt),q(Q),q(G),P(me,G)};xe(k,me=>{e.child?me(te):me(fe,-1)})}P(R,ce)},$$slots:{popper:!0}}))},B=U=>{Ip(U,mt(()=>u(b),{get ref(){return g.opts.ref},get interactOutsideBehavior(){return c()},get escapeKeydownBehavior(){return d()},onCloseAutoFocus:S,onOpenAutoFocus:E,get open(){return g.parentMenu.opts.open.current},onInteractOutside:A,onEscapeKeydown:_,onFocusOutside:T,preventScroll:!1,get loop(){return s()},get trapFocus(){return x()},get shouldRender(){return g.shouldRender},popper:(R,O)=>{let Y=()=>(O?.()).props,K=()=>(O?.()).wrapperProps;const ne=z(()=>jt(Y(),u(b),{style:zo("menu")},{style:e.style}));var ce=we(),k=ee(ce);{var te=me=>{var G=we(),Q=ee(G);{let j=z(()=>({props:u(ne),wrapperProps:K(),...g.snippetProps}));pt(Q,()=>e.child,()=>u(j))}P(me,G)},fe=me=>{var G=S0();Ft(G,()=>({...K()}));var Q=$(G);Ft(Q,()=>({...u(ne)}));var j=$(Q);pt(j,()=>e.children??wt),q(Q),q(G),P(me,G)};xe(k,me=>{e.child?me(te):me(fe,-1)})}P(R,ce)},$$slots:{popper:!0}}))};xe(L,U=>{o()?U(F):o()||U(B,1)})}P(n,D),at()}var w0=Z("<div><!></div>");function E0(n,e){const t=Tn();st(e,!0);let i=le(e,"id",19,()=>Vn(t)),r=le(e,"disabled",3,!1),s=le(e,"ref",15,null),a=le(e,"onSelect",3,Un),o=le(e,"openDelay",3,0),l=ut(e,["$$slots","$$events","$$legacy","id","disabled","ref","children","child","onSelect","openDelay"]);const c=rv.create({disabled:Qe(()=>r()),onSelect:Qe(()=>a()),id:Qe(()=>i()),ref:Qe(()=>s(),f=>s(f)),openDelay:Qe(()=>o())}),d=z(()=>jt(l,c.props));Np(n,{get id(){return i()},get ref(){return c.opts.ref},children:(f,h)=>{var p=we(),m=ee(p);{var x=g=>{var y=we(),w=ee(y);pt(w,()=>e.child,()=>({props:u(d)})),P(g,y)},v=g=>{var y=w0();Ft(y,()=>({...u(d)}));var w=$(y);pt(w,()=>e.children??wt),q(y),P(g,y)};xe(m,g=>{e.child?g(x):g(v,-1)})}P(f,p)},$$slots:{default:!0}}),at()}function T0(n,e){st(e,!0);let t=le(e,"open",15,!1),i=le(e,"dir",3,"ltr"),r=le(e,"onOpenChange",3,Un),s=le(e,"onOpenChangeComplete",3,Un),a=le(e,"_internal_variant",3,"dropdown-menu"),o=le(e,"_internal_should_skip_exit_animation",3,void 0);const l=sv.create({variant:Qe(()=>a()),dir:Qe(()=>i()),onClose:()=>{t(!1),r()(!1)},shouldSkipExitAnimation:()=>o()?.()??!1});av.create({open:Qe(()=>t(),c=>{t(c),r()(c)}),onOpenChangeComplete:Qe(()=>s())},l),Dp(n,{children:(c,d)=>{var f=we(),h=ee(f);pt(h,()=>e.children??wt),P(c,f)},$$slots:{default:!0}}),at()}var A0=Z("<div><div><!></div></div>"),C0=Z("<div><div><!></div></div>");function P0(n,e){const t=Tn();st(e,!0);let i=le(e,"id",19,()=>Vn(t)),r=le(e,"ref",15,null),s=le(e,"loop",3,!0),a=le(e,"onInteractOutside",3,Un),o=le(e,"onEscapeKeydown",3,Un),l=le(e,"onCloseAutoFocus",3,Un),c=le(e,"forceMount",3,!1),d=le(e,"trapFocus",3,!1),f=ut(e,["$$slots","$$events","$$legacy","id","child","children","ref","loop","onInteractOutside","onEscapeKeydown","onCloseAutoFocus","forceMount","trapFocus","style"]);const h=_p.create({id:Qe(()=>i()),loop:Qe(()=>s()),ref:Qe(()=>r(),b=>r(b)),onCloseAutoFocus:Qe(()=>l())}),p=z(()=>jt(f,h.props));function m(b){if(h.handleInteractOutside(b),!b.defaultPrevented&&(a()(b),!b.defaultPrevented)){if(b.target&&b.target instanceof Element){const E=`[${h.parentMenu.root.getBitsAttr("sub-content")}]`;if(b.target.closest(E))return}h.parentMenu.onClose()}}function x(b){o()(b),!b.defaultPrevented&&h.parentMenu.onClose()}var v=we(),g=ee(v);{var y=b=>{Lp(b,mt(()=>u(p),()=>h.popperProps,{get ref(){return h.opts.ref},get enabled(){return h.parentMenu.opts.open.current},onInteractOutside:m,onEscapeKeydown:x,get trapFocus(){return d()},get loop(){return s()},forceMount:!0,get id(){return i()},get shouldRender(){return h.shouldRender},popper:(S,A)=>{let _=()=>(A?.()).props,T=()=>(A?.()).wrapperProps;const D=z(()=>jt(_(),{style:zo("dropdown-menu")},{style:e.style}));var L=we(),F=ee(L);{var B=N=>{var R=we(),O=ee(R);{let Y=z(()=>({props:u(D),wrapperProps:T(),...h.snippetProps}));pt(O,()=>e.child,()=>u(Y))}P(N,R)},U=N=>{var R=A0();Ft(R,()=>({...T()}));var O=$(R);Ft(O,()=>({...u(D)}));var Y=$(O);pt(Y,()=>e.children??wt),q(O),q(R),P(N,R)};xe(F,N=>{e.child?N(B):N(U,-1)})}P(S,L)},$$slots:{popper:!0}}))},w=b=>{Ip(b,mt(()=>u(p),()=>h.popperProps,{get ref(){return h.opts.ref},get open(){return h.parentMenu.opts.open.current},onInteractOutside:m,onEscapeKeydown:x,get trapFocus(){return d()},get loop(){return s()},forceMount:!1,get id(){return i()},get shouldRender(){return h.shouldRender},popper:(S,A)=>{let _=()=>(A?.()).props,T=()=>(A?.()).wrapperProps;const D=z(()=>jt(_(),{style:zo("dropdown-menu")},{style:e.style}));var L=we(),F=ee(L);{var B=N=>{var R=we(),O=ee(R);{let Y=z(()=>({props:u(D),wrapperProps:T(),...h.snippetProps}));pt(O,()=>e.child,()=>u(Y))}P(N,R)},U=N=>{var R=C0();Ft(R,()=>({...T()}));var O=$(R);Ft(O,()=>({...u(D)}));var Y=$(O);pt(Y,()=>e.children??wt),q(O),q(R),P(N,R)};xe(F,N=>{e.child?N(B):N(U,-1)})}P(S,L)},$$slots:{popper:!0}}))};xe(g,b=>{c()?b(y):c()||b(w,1)})}P(n,v),at()}var R0=Z("<button><!></button>");function D0(n,e){const t=Tn();st(e,!0);let i=le(e,"id",19,()=>Vn(t)),r=le(e,"ref",15,null),s=le(e,"disabled",3,!1),a=le(e,"type",3,"button"),o=ut(e,["$$slots","$$events","$$legacy","id","ref","child","children","disabled","type"]);const l=ov.create({id:Qe(()=>i()),disabled:Qe(()=>s()??!1),ref:Qe(()=>r(),d=>r(d))}),c=z(()=>jt(o,l.props,{type:a()}));Np(n,{get id(){return i()},get ref(){return l.opts.ref},children:(d,f)=>{var h=we(),p=ee(h);{var m=v=>{var g=we(),y=ee(g);pt(y,()=>e.child,()=>({props:u(c)})),P(v,g)},x=v=>{var g=R0();Ft(g,()=>({...u(c)}));var y=$(g);pt(y,()=>e.children??wt),q(g),P(v,g)};xe(p,v=>{e.child?v(m):v(x,-1)})}P(d,h)},$$slots:{default:!0}}),at()}class Rr{#e;#t;constructor(e,t){this.#e=e,this.#t=t,this.handler=this.handler.bind(this),Pt(this.handler)}handler(){let e=0;const t=this.#e();if(!t)return;const i=new ResizeObserver(()=>{cancelAnimationFrame(e),e=window.requestAnimationFrame(this.#t)});return i.observe(t),()=>{window.cancelAnimationFrame(e),i.unobserve(t)}}}class L0{opts;present;#e;#t=Oe(!1);#n=!1;#i=Oe(void 0);#r=null;constructor(e){this.opts=e,this.present=this.opts.open,W(this.#t,e.open.current,!0),this.#e=new lv({ref:this.opts.ref,afterTick:this.opts.open}),cv(()=>this.#a()),fr(()=>this.present.current,t=>{if(!this.#n){this.#n=!0;return}this.#a(),t&&W(this.#t,!0),W(this.#i,t?"starting":"ending",!0),t&&(this.#r=window.requestAnimationFrame(()=>{this.#r=null,this.present.current&&W(this.#i,void 0)})),this.#e.run(()=>{t===this.present.current&&(t||W(this.#t,!1),W(this.#i,void 0))})})}#s=z(()=>u(this.#t));get isPresent(){return u(this.#s)}set isPresent(e){W(this.#s,e)}get transitionStatus(){return u(this.#i)}#a(){this.#r!==null&&(window.cancelAnimationFrame(this.#r),this.#r=null)}}function il(n,e){st(e,!0);const t=new L0({open:Qe(()=>e.open),ref:e.ref});var i=we(),r=ee(i);{var s=a=>{var o=we(),l=ee(o);pt(l,()=>e.presence??wt,()=>({present:t.isPresent,transitionStatus:t.transitionStatus})),P(a,o)};xe(r,a=>{(e.forceMount||e.open||t.isPresent)&&a(s)})}P(n,i),at()}function I0(n,e,t){return Math.min(t,Math.max(e,n))}class N0{state;#e;constructor(e,t){this.state=vc(e),this.#e=t,this.dispatch=this.dispatch.bind(this)}#t(e){return this.#e[this.state.current][e]??this.state.current}dispatch(e){this.state.current=this.#t(e)}}const ga=Lu({component:"scroll-area",parts:["root","viewport","corner","thumb","scrollbar"]}),va=new pr("ScrollArea.Root"),_a=new pr("ScrollArea.Scrollbar"),rl=new pr("ScrollArea.ScrollbarVisible"),Vu=new pr("ScrollArea.ScrollbarAxis"),kp=new pr("ScrollArea.ScrollbarShared");class Hu{static create(e){return va.set(new Hu(e))}opts;attachment;#e=Oe(null);get scrollAreaNode(){return u(this.#e)}set scrollAreaNode(e){W(this.#e,e,!0)}#t=Oe(null);get viewportNode(){return u(this.#t)}set viewportNode(e){W(this.#t,e,!0)}#n=Oe(null);get contentNode(){return u(this.#n)}set contentNode(e){W(this.#n,e,!0)}#i=Oe(null);get scrollbarXNode(){return u(this.#i)}set scrollbarXNode(e){W(this.#i,e,!0)}#r=Oe(null);get scrollbarYNode(){return u(this.#r)}set scrollbarYNode(e){W(this.#r,e,!0)}#s=Oe(0);get cornerWidth(){return u(this.#s)}set cornerWidth(e){W(this.#s,e,!0)}#a=Oe(0);get cornerHeight(){return u(this.#a)}set cornerHeight(e){W(this.#a,e,!0)}#o=Oe(!1);get scrollbarXEnabled(){return u(this.#o)}set scrollbarXEnabled(e){W(this.#o,e,!0)}#l=Oe(!1);get scrollbarYEnabled(){return u(this.#l)}set scrollbarYEnabled(e){W(this.#l,e,!0)}domContext;constructor(e){this.opts=e,this.attachment=bi(e.ref,t=>this.scrollAreaNode=t),this.domContext=new xp(e.ref)}#c=z(()=>({id:this.opts.id.current,dir:this.opts.dir.current,style:{position:"relative","--bits-scroll-area-corner-height":`${this.cornerHeight}px`,"--bits-scroll-area-corner-width":`${this.cornerWidth}px`},[ga.root]:"",...this.attachment}));get props(){return u(this.#c)}set props(e){W(this.#c,e)}}class Gu{static create(e){return new Gu(e,va.get())}opts;root;attachment;#e=vc(uv());#t=vc(null);contentAttachment=bi(this.#t,e=>this.root.contentNode=e);constructor(e,t){this.opts=e,this.root=t,this.attachment=bi(e.ref,i=>this.root.viewportNode=i)}#n=z(()=>({id:this.opts.id.current,style:{overflowX:this.root.scrollbarXEnabled?"scroll":"hidden",overflowY:this.root.scrollbarYEnabled?"scroll":"hidden"},[ga.viewport]:"",...this.attachment}));get props(){return u(this.#n)}set props(e){W(this.#n,e)}#i=z(()=>({id:this.#e.current,"data-scroll-area-content":"",style:{minWidth:this.root.scrollbarXEnabled?"fit-content":void 0},...this.contentAttachment}));get contentProps(){return u(this.#i)}set contentProps(e){W(this.#i,e)}}class Wu{static create(e){return _a.set(new Wu(e,va.get()))}opts;root;#e=z(()=>this.opts.orientation.current==="horizontal");get isHorizontal(){return u(this.#e)}set isHorizontal(e){W(this.#e,e)}#t=Oe(!1);get hasThumb(){return u(this.#t)}set hasThumb(e){W(this.#t,e,!0)}constructor(e,t){this.opts=e,this.root=t,fr(()=>this.isHorizontal,i=>i?(this.root.scrollbarXEnabled=!0,()=>{this.root.scrollbarXEnabled=!1}):(this.root.scrollbarYEnabled=!0,()=>{this.root.scrollbarYEnabled=!1}))}}class Xu{static create(){return new Xu(_a.get())}scrollbar;root;#e=Oe(!1);get isVisible(){return u(this.#e)}set isVisible(e){W(this.#e,e,!0)}constructor(e){this.scrollbar=e,this.root=e.root,Pt(()=>{const t=this.root.scrollAreaNode,i=this.root.opts.scrollHideDelay.current;let r=0;if(!t)return;const s=()=>{this.root.domContext.clearTimeout(r),wn(()=>this.isVisible=!0)},a=()=>{r&&this.root.domContext.clearTimeout(r),r=this.root.domContext.setTimeout(()=>{wn(()=>{this.scrollbar.hasThumb=!1,this.isVisible=!1})},i)},o=Iu(dn(t,"pointerenter",s),dn(t,"pointerleave",a));return()=>{this.root.domContext.getWindow().clearTimeout(r),o()}})}#t=z(()=>({"data-state":this.isVisible?"visible":"hidden"}));get props(){return u(this.#t)}set props(e){W(this.#t,e)}}class ju{static create(){return new ju(_a.get())}scrollbar;root;machine=new N0("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});#e=z(()=>this.machine.state.current==="hidden");get isHidden(){return u(this.#e)}set isHidden(e){W(this.#e,e)}constructor(e){this.scrollbar=e,this.root=e.root;const t=nl(()=>this.machine.dispatch("SCROLL_END"),100);Pt(()=>{const i=this.machine.state.current,r=this.root.opts.scrollHideDelay.current;if(i==="idle"){const s=this.root.domContext.setTimeout(()=>this.machine.dispatch("HIDE"),r);return()=>this.root.domContext.clearTimeout(s)}}),Pt(()=>{const i=this.root.viewportNode;if(!i)return;const r=this.scrollbar.isHorizontal?"scrollLeft":"scrollTop";let s=i[r];return dn(i,"scroll",()=>{const l=i[r];s!==l&&(this.machine.dispatch("SCROLL"),t()),s=l})}),this.onpointerenter=this.onpointerenter.bind(this),this.onpointerleave=this.onpointerleave.bind(this)}onpointerenter(e){this.machine.dispatch("POINTER_ENTER")}onpointerleave(e){this.machine.dispatch("POINTER_LEAVE")}#t=z(()=>({"data-state":this.machine.state.current==="hidden"?"hidden":"visible",onpointerenter:this.onpointerenter,onpointerleave:this.onpointerleave}));get props(){return u(this.#t)}set props(e){W(this.#t,e)}}class sl{static create(){return new sl(_a.get())}scrollbar;root;#e=Oe(!1);get isVisible(){return u(this.#e)}set isVisible(e){W(this.#e,e,!0)}constructor(e){this.scrollbar=e,this.root=e.root;const t=nl(()=>{const i=this.root.viewportNode;if(!i)return;const r=i.offsetWidth<i.scrollWidth,s=i.offsetHeight<i.scrollHeight;this.isVisible=this.scrollbar.isHorizontal?r:s},10);new Rr(()=>this.root.viewportNode,t),new Rr(()=>this.root.contentNode,t)}#t=z(()=>({"data-state":this.isVisible?"visible":"hidden"}));get props(){return u(this.#t)}set props(e){W(this.#t,e)}}class qu{static create(){return rl.set(new qu(_a.get()))}scrollbar;root;#e=Oe(null);get thumbNode(){return u(this.#e)}set thumbNode(e){W(this.#e,e,!0)}#t=Oe(0);get pointerOffset(){return u(this.#t)}set pointerOffset(e){W(this.#t,e,!0)}#n=Oe({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}});get sizes(){return u(this.#n)}set sizes(e){W(this.#n,e)}#i=z(()=>Vp(this.sizes.viewport,this.sizes.content));get thumbRatio(){return u(this.#i)}set thumbRatio(e){W(this.#i,e)}#r=z(()=>this.thumbRatio>0&&this.thumbRatio<1);get hasThumb(){return u(this.#r)}set hasThumb(e){W(this.#r,e)}#s=Oe("");get prevTransformStyle(){return u(this.#s)}set prevTransformStyle(e){W(this.#s,e,!0)}constructor(e){this.scrollbar=e,this.root=e.root,Pt(()=>{this.scrollbar.hasThumb=this.hasThumb}),Pt(()=>{!this.scrollbar.hasThumb&&this.thumbNode&&(this.prevTransformStyle=this.thumbNode.style.transform)})}setSizes(e){this.sizes=e}getScrollPosition(e,t){return U0({pointerPos:e,pointerOffset:this.pointerOffset,sizes:this.sizes,dir:t})}onThumbPointerUp(){this.pointerOffset=0}onThumbPointerDown(e){this.pointerOffset=e}xOnThumbPositionChange(){if(!(this.root.viewportNode&&this.thumbNode))return;const e=this.root.viewportNode.scrollLeft,i=`translate3d(${uh({scrollPos:e,sizes:this.sizes,dir:this.root.opts.dir.current})}px, 0, 0)`;this.thumbNode.style.transform=i,this.prevTransformStyle=i}xOnWheelScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollLeft=e)}xOnDragScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollLeft=this.getScrollPosition(e,this.root.opts.dir.current))}yOnThumbPositionChange(){if(!(this.root.viewportNode&&this.thumbNode))return;const e=this.root.viewportNode.scrollTop,i=`translate3d(0, ${uh({scrollPos:e,sizes:this.sizes})}px, 0)`;this.thumbNode.style.transform=i,this.prevTransformStyle=i}yOnWheelScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollTop=e)}yOnDragScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollTop=this.getScrollPosition(e,this.root.opts.dir.current))}}class Yu{static create(e){return Vu.set(new Yu(e,rl.get()))}opts;scrollbarVis;root;scrollbar;attachment;#e=Oe();get computedStyle(){return u(this.#e)}set computedStyle(e){W(this.#e,e,!0)}constructor(e,t){this.opts=e,this.scrollbarVis=t,this.root=t.root,this.scrollbar=t.scrollbar,this.attachment=bi(this.scrollbar.opts.ref,i=>this.root.scrollbarXNode=i),Pt(()=>{this.scrollbar.opts.ref.current&&this.opts.mounted.current&&(this.computedStyle=getComputedStyle(this.scrollbar.opts.ref.current))}),Pt(()=>{this.onResize()})}onThumbPointerDown=e=>{this.scrollbarVis.onThumbPointerDown(e.x)};onDragScroll=e=>{this.scrollbarVis.xOnDragScroll(e.x)};onThumbPointerUp=()=>{this.scrollbarVis.onThumbPointerUp()};onThumbPositionChange=()=>{this.scrollbarVis.xOnThumbPositionChange()};onWheelScroll=(e,t)=>{if(!this.root.viewportNode)return;const i=this.root.viewportNode.scrollLeft+e.deltaX;this.scrollbarVis.xOnWheelScroll(i),Gp(i,t)&&e.preventDefault()};onResize=()=>{this.scrollbar.opts.ref.current&&this.root.viewportNode&&this.computedStyle&&this.scrollbarVis.setSizes({content:this.root.viewportNode.scrollWidth,viewport:this.root.viewportNode.offsetWidth,scrollbar:{size:this.scrollbar.opts.ref.current.clientWidth,paddingStart:Bo(this.computedStyle.paddingLeft),paddingEnd:Bo(this.computedStyle.paddingRight)}})};#t=z(()=>al(this.scrollbarVis.sizes));get thumbSize(){return u(this.#t)}set thumbSize(e){W(this.#t,e)}#n=z(()=>({id:this.scrollbar.opts.id.current,"data-orientation":"horizontal",style:{bottom:0,left:this.root.opts.dir.current==="rtl"?"var(--bits-scroll-area-corner-width)":0,right:this.root.opts.dir.current==="ltr"?"var(--bits-scroll-area-corner-width)":0,"--bits-scroll-area-thumb-width":`${this.thumbSize}px`},...this.attachment}));get props(){return u(this.#n)}set props(e){W(this.#n,e)}}class Ku{static create(e){return Vu.set(new Ku(e,rl.get()))}opts;scrollbarVis;root;scrollbar;attachment;#e=Oe();get computedStyle(){return u(this.#e)}set computedStyle(e){W(this.#e,e,!0)}constructor(e,t){this.opts=e,this.scrollbarVis=t,this.root=t.root,this.scrollbar=t.scrollbar,this.attachment=bi(this.scrollbar.opts.ref,i=>this.root.scrollbarYNode=i),Pt(()=>{this.scrollbar.opts.ref.current&&this.opts.mounted.current&&(this.computedStyle=getComputedStyle(this.scrollbar.opts.ref.current))}),Pt(()=>{this.onResize()}),this.onThumbPointerDown=this.onThumbPointerDown.bind(this),this.onDragScroll=this.onDragScroll.bind(this),this.onThumbPointerUp=this.onThumbPointerUp.bind(this),this.onThumbPositionChange=this.onThumbPositionChange.bind(this),this.onWheelScroll=this.onWheelScroll.bind(this),this.onResize=this.onResize.bind(this)}onThumbPointerDown(e){this.scrollbarVis.onThumbPointerDown(e.y)}onDragScroll(e){this.scrollbarVis.yOnDragScroll(e.y)}onThumbPointerUp(){this.scrollbarVis.onThumbPointerUp()}onThumbPositionChange(){this.scrollbarVis.yOnThumbPositionChange()}onWheelScroll(e,t){if(!this.root.viewportNode)return;const i=this.root.viewportNode.scrollTop+e.deltaY;this.scrollbarVis.yOnWheelScroll(i),Gp(i,t)&&e.preventDefault()}onResize(){this.scrollbar.opts.ref.current&&this.root.viewportNode&&this.computedStyle&&this.scrollbarVis.setSizes({content:this.root.viewportNode.scrollHeight,viewport:this.root.viewportNode.offsetHeight,scrollbar:{size:this.scrollbar.opts.ref.current.clientHeight,paddingStart:Bo(this.computedStyle.paddingTop),paddingEnd:Bo(this.computedStyle.paddingBottom)}})}#t=z(()=>al(this.scrollbarVis.sizes));get thumbSize(){return u(this.#t)}set thumbSize(e){W(this.#t,e)}#n=z(()=>({id:this.scrollbar.opts.id.current,"data-orientation":"vertical",style:{top:0,right:this.root.opts.dir.current==="ltr"?0:void 0,left:this.root.opts.dir.current==="rtl"?0:void 0,bottom:"var(--bits-scroll-area-corner-height)","--bits-scroll-area-thumb-height":`${this.thumbSize}px`},...this.attachment}));get props(){return u(this.#n)}set props(e){W(this.#n,e)}}class Zu{static create(){return kp.set(new Zu(Vu.get()))}scrollbarState;root;scrollbarVis;scrollbar;#e=Oe(null);get rect(){return u(this.#e)}set rect(e){W(this.#e,e)}#t=Oe("");get prevWebkitUserSelect(){return u(this.#t)}set prevWebkitUserSelect(e){W(this.#t,e,!0)}handleResize;handleThumbPositionChange;handleWheelScroll;handleThumbPointerDown;handleThumbPointerUp;#n=z(()=>this.scrollbarVis.sizes.content-this.scrollbarVis.sizes.viewport);get maxScrollPos(){return u(this.#n)}set maxScrollPos(e){W(this.#n,e)}constructor(e){this.scrollbarState=e,this.root=e.root,this.scrollbarVis=e.scrollbarVis,this.scrollbar=e.scrollbarVis.scrollbar,this.handleResize=nl(()=>this.scrollbarState.onResize(),10),this.handleThumbPositionChange=this.scrollbarState.onThumbPositionChange,this.handleWheelScroll=this.scrollbarState.onWheelScroll,this.handleThumbPointerDown=this.scrollbarState.onThumbPointerDown,this.handleThumbPointerUp=this.scrollbarState.onThumbPointerUp,Pt(()=>{const t=this.maxScrollPos,i=this.scrollbar.opts.ref.current;this.root.viewportNode;const r=a=>{const o=a.target;i?.contains(o)&&this.handleWheelScroll(a,t)};return dn(this.root.domContext.getDocument(),"wheel",r,{passive:!1})}),kg(()=>{this.scrollbarVis.sizes,wn(()=>this.handleThumbPositionChange())}),new Rr(()=>this.scrollbar.opts.ref.current,this.handleResize),new Rr(()=>this.root.contentNode,this.handleResize),this.onpointerdown=this.onpointerdown.bind(this),this.onpointermove=this.onpointermove.bind(this),this.onpointerup=this.onpointerup.bind(this),this.onlostpointercapture=this.onlostpointercapture.bind(this)}handleDragScroll(e){if(!this.rect)return;const t=e.clientX-this.rect.left,i=e.clientY-this.rect.top;this.scrollbarState.onDragScroll({x:t,y:i})}#i(){this.rect!==null&&(this.root.domContext.getDocument().body.style.webkitUserSelect=this.prevWebkitUserSelect,this.root.viewportNode&&(this.root.viewportNode.style.scrollBehavior=""),this.rect=null)}onpointerdown(e){if(e.button!==0)return;e.target.setPointerCapture(e.pointerId),this.rect=this.scrollbar.opts.ref.current?.getBoundingClientRect()??null,this.prevWebkitUserSelect=this.root.domContext.getDocument().body.style.webkitUserSelect,this.root.domContext.getDocument().body.style.webkitUserSelect="none",this.root.viewportNode&&(this.root.viewportNode.style.scrollBehavior="auto"),this.handleDragScroll(e)}onpointermove(e){this.handleDragScroll(e)}onpointerup(e){const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),this.#i()}onlostpointercapture(e){this.#i()}#r=z(()=>jt({...this.scrollbarState.props,style:{position:"absolute",...this.scrollbarState.props.style},[ga.scrollbar]:"",onpointerdown:this.onpointerdown,onpointermove:this.onpointermove,onpointerup:this.onpointerup,onlostpointercapture:this.onlostpointercapture}));get props(){return u(this.#r)}set props(e){W(this.#r,e)}}class $u{static create(e){return new $u(e,kp.get())}opts;scrollbarState;attachment;#e;#t=Oe();#n=nl(()=>{u(this.#t)&&(u(this.#t)(),W(this.#t,void 0))},100);constructor(e,t){this.opts=e,this.scrollbarState=t,this.#e=t.root,this.attachment=bi(this.opts.ref,i=>this.scrollbarState.scrollbarVis.thumbNode=i),Pt(()=>{const i=this.#e.viewportNode;if(!i)return;const r=()=>{if(this.#n(),!u(this.#t)){const a=F0(i,this.scrollbarState.handleThumbPositionChange);W(this.#t,a,!0),this.scrollbarState.handleThumbPositionChange()}};return wn(()=>this.scrollbarState.handleThumbPositionChange()),dn(i,"scroll",r)}),this.onpointerdowncapture=this.onpointerdowncapture.bind(this),this.onpointerup=this.onpointerup.bind(this)}onpointerdowncapture(e){const t=e.target;if(!t)return;const i=t.getBoundingClientRect(),r=e.clientX-i.left,s=e.clientY-i.top;this.scrollbarState.handleThumbPointerDown({x:r,y:s})}onpointerup(e){this.scrollbarState.handleThumbPointerUp()}#i=z(()=>({id:this.opts.id.current,"data-state":this.scrollbarState.scrollbarVis.hasThumb?"visible":"hidden",style:{width:"var(--bits-scroll-area-thumb-width)",height:"var(--bits-scroll-area-thumb-height)",transform:this.scrollbarState.scrollbarVis.prevTransformStyle},onpointerdowncapture:this.onpointerdowncapture,onpointerup:this.onpointerup,[ga.thumb]:"",...this.attachment}));get props(){return u(this.#i)}set props(e){W(this.#i,e)}}class Ju{static create(e){return new Ju(e,va.get())}opts;root;attachment;#e=Oe(0);#t=Oe(0);#n=z(()=>!!(u(this.#e)&&u(this.#t)));get hasSize(){return u(this.#n)}set hasSize(e){W(this.#n,e)}constructor(e,t){this.opts=e,this.root=t,this.attachment=bi(this.opts.ref),new Rr(()=>this.root.scrollbarXNode,()=>{const i=this.root.scrollbarXNode?.offsetHeight||0;this.root.cornerHeight=i,W(this.#t,i,!0)}),new Rr(()=>this.root.scrollbarYNode,()=>{const i=this.root.scrollbarYNode?.offsetWidth||0;this.root.cornerWidth=i,W(this.#e,i,!0)})}#i=z(()=>({id:this.opts.id.current,style:{width:u(this.#e),height:u(this.#t),position:"absolute",right:this.root.opts.dir.current==="ltr"?0:void 0,left:this.root.opts.dir.current==="rtl"?0:void 0,bottom:0},[ga.corner]:"",...this.attachment}));get props(){return u(this.#i)}set props(e){W(this.#i,e)}}function Bo(n){return n?Number.parseInt(n,10):0}function Vp(n,e){const t=n/e;return Number.isNaN(t)?0:t}function al(n){const e=Vp(n.viewport,n.content),t=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,i=(n.scrollbar.size-t)*e;return Math.max(i,18)}function U0({pointerPos:n,pointerOffset:e,sizes:t,dir:i="ltr"}){const r=al(t),s=r/2,a=e||s,o=r-a,l=t.scrollbar.paddingStart+a,c=t.scrollbar.size-t.scrollbar.paddingEnd-o,d=t.content-t.viewport,f=i==="ltr"?[0,d]:[d*-1,0];return Hp([l,c],f)(n)}function uh({scrollPos:n,sizes:e,dir:t="ltr"}){const i=al(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-r,a=e.content-e.viewport,o=s-i,l=t==="ltr"?[0,a]:[a*-1,0],c=I0(n,l[0],l[1]);return Hp([0,a],[0,o])(c)}function Hp(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const i=(e[1]-e[0])/(n[1]-n[0]);return e[0]+i*(t-n[0])}}function Gp(n,e){return n>0&&n<e}function F0(n,e){let t={left:n.scrollLeft,top:n.scrollTop},i=0;const r=dv(n);return(function s(){const a={left:n.scrollLeft,top:n.scrollTop},o=t.left!==a.left,l=t.top!==a.top;(o||l)&&e(),t=a,i=r.requestAnimationFrame(s)})(),()=>r.cancelAnimationFrame(i)}var O0=Z("<div><!></div>");function z0(n,e){const t=Tn();st(e,!0);let i=le(e,"ref",15,null),r=le(e,"id",19,()=>Vn(t)),s=le(e,"type",3,"hover"),a=le(e,"dir",3,"ltr"),o=le(e,"scrollHideDelay",3,600),l=ut(e,["$$slots","$$events","$$legacy","ref","id","type","dir","scrollHideDelay","children","child"]);const c=Hu.create({type:Qe(()=>s()),dir:Qe(()=>a()),scrollHideDelay:Qe(()=>o()),id:Qe(()=>r()),ref:Qe(()=>i(),x=>i(x))}),d=z(()=>jt(l,c.props));var f=we(),h=ee(f);{var p=x=>{var v=we(),g=ee(v);pt(g,()=>e.child,()=>({props:u(d)})),P(x,v)},m=x=>{var v=O0();Ft(v,()=>({...u(d)}));var g=$(v);pt(g,()=>e.children??wt),q(v),P(x,v)};xe(h,x=>{e.child?x(p):x(m,-1)})}P(n,f),at()}var B0=Z("<div><div><!></div></div>");function k0(n,e){const t=Tn();st(e,!0);let i=le(e,"ref",15,null),r=le(e,"id",19,()=>Vn(t)),s=ut(e,["$$slots","$$events","$$legacy","ref","id","children"]);const a=Gu.create({id:Qe(()=>r()),ref:Qe(()=>i(),h=>i(h))}),o=z(()=>jt(s,a.props)),l=z(()=>jt({},a.contentProps));var c=B0();Ft(c,()=>({...u(o)}));var d=$(c);Ft(d,()=>({...u(l)}));var f=$(d);pt(f,()=>e.children??wt),q(d),q(c),P(n,c),at()}var V0=Z("<div><!></div>");function Wp(n,e){st(e,!0);let t=ut(e,["$$slots","$$events","$$legacy","child","children"]);const i=Zu.create(),r=z(()=>jt(t,i.props));var s=we(),a=ee(s);{var o=c=>{var d=we(),f=ee(d);pt(f,()=>e.child,()=>({props:u(r)})),P(c,d)},l=c=>{var d=V0();Ft(d,()=>({...u(r)}));var f=$(d);pt(f,()=>e.children??wt),q(d),P(c,d)};xe(a,c=>{e.child?c(o):c(l,-1)})}P(n,s),at()}function H0(n,e){st(e,!0);let t=ut(e,["$$slots","$$events","$$legacy"]);const i=new zu,r=Yu.create({mounted:Qe(()=>i.current)}),s=z(()=>jt(t,r.props));Wp(n,mt(()=>u(s))),at()}function G0(n,e){st(e,!0);let t=ut(e,["$$slots","$$events","$$legacy"]);const i=new zu,r=Ku.create({mounted:Qe(()=>i.current)}),s=z(()=>jt(t,r.props));Wp(n,mt(()=>u(s))),at()}function ol(n,e){st(e,!0);let t=ut(e,["$$slots","$$events","$$legacy"]);const i=qu.create();var r=we(),s=ee(r);{var a=l=>{H0(l,mt(()=>t))},o=l=>{G0(l,mt(()=>t))};xe(s,l=>{i.scrollbar.opts.orientation.current==="horizontal"?l(a):l(o,-1)})}P(n,r),at()}function W0(n,e){st(e,!0);let t=le(e,"forceMount",3,!1),i=ut(e,["$$slots","$$events","$$legacy","forceMount"]);const r=sl.create(),s=z(()=>jt(i,r.props));{const a=l=>{ol(l,mt(()=>u(s)))};let o=z(()=>t()||r.isVisible);il(n,{get open(){return u(o)},get ref(){return r.scrollbar.opts.ref},presence:a,$$slots:{presence:!0}})}at()}function X0(n,e){st(e,!0);let t=le(e,"forceMount",3,!1),i=ut(e,["$$slots","$$events","$$legacy","forceMount"]);const r=ju.create(),s=z(()=>jt(i,r.props));{const a=l=>{ol(l,mt(()=>u(s)))};let o=z(()=>t()||!r.isHidden);il(n,mt(()=>u(s),{get open(){return u(o)},get ref(){return r.scrollbar.opts.ref},presence:a,$$slots:{presence:!0}}))}at()}function j0(n,e){st(e,!0);let t=le(e,"forceMount",3,!1),i=ut(e,["$$slots","$$events","$$legacy","forceMount"]);const r=Xu.create(),s=sl.create(),a=z(()=>jt(i,r.props,s.props,{"data-state":r.isVisible?"visible":"hidden"})),o=z(()=>t()||r.isVisible&&s.isVisible);il(n,{get open(){return u(o)},get ref(){return s.scrollbar.opts.ref},presence:c=>{ol(c,mt(()=>u(a)))},$$slots:{presence:!0}}),at()}function q0(n,e){const t=Tn();st(e,!0);let i=le(e,"ref",15,null),r=le(e,"id",19,()=>Vn(t)),s=ut(e,["$$slots","$$events","$$legacy","ref","id","orientation"]);const a=Wu.create({orientation:Qe(()=>e.orientation),id:Qe(()=>r()),ref:Qe(()=>i(),m=>i(m))}),o=z(()=>a.root.opts.type.current);var l=we(),c=ee(l);{var d=m=>{j0(m,mt(()=>s,{get id(){return r()}}))},f=m=>{X0(m,mt(()=>s,{get id(){return r()}}))},h=m=>{W0(m,mt(()=>s,{get id(){return r()}}))},p=m=>{ol(m,mt(()=>s,{get id(){return r()}}))};xe(c,m=>{u(o)==="hover"?m(d):u(o)==="scroll"?m(f,1):u(o)==="auto"?m(h,2):u(o)==="always"&&m(p,3)})}P(n,l),at()}var Y0=Z("<div><!></div>");function K0(n,e){st(e,!0);let t=le(e,"ref",15,null),i=ut(e,["$$slots","$$events","$$legacy","ref","id","child","children","present"]);const r=new zu,s=$u.create({id:Qe(()=>e.id),ref:Qe(()=>t(),f=>t(f)),mounted:Qe(()=>r.current)}),a=z(()=>jt(i,s.props,{style:{hidden:!e.present}}));var o=we(),l=ee(o);{var c=f=>{var h=we(),p=ee(h);pt(p,()=>e.child,()=>({props:u(a)})),P(f,h)},d=f=>{var h=Y0();Ft(h,()=>({...u(a)}));var p=$(h);pt(p,()=>e.children??wt),q(h),P(f,h)};xe(l,f=>{e.child?f(c):f(d,-1)})}P(n,o),at()}function Z0(n,e){const t=Tn();st(e,!0);let i=le(e,"id",19,()=>Vn(t)),r=le(e,"ref",15,null),s=le(e,"forceMount",3,!1),a=ut(e,["$$slots","$$events","$$legacy","id","ref","forceMount"]);const o=rl.get();{const l=(d,f)=>{let h=()=>(f?.()).present;K0(d,mt(()=>a,{get id(){return i()},get present(){return h()},get ref(){return r()},set ref(p){r(p)}}))};let c=z(()=>s()||o.hasThumb);il(n,{get open(){return u(c)},get ref(){return o.scrollbar.opts.ref},presence:l,$$slots:{presence:!0}})}at()}var $0=Z("<div><!></div>");function J0(n,e){st(e,!0);let t=le(e,"ref",15,null),i=ut(e,["$$slots","$$events","$$legacy","ref","id","children","child"]);const r=Ju.create({id:Qe(()=>e.id),ref:Qe(()=>t(),d=>t(d))}),s=z(()=>jt(i,r.props));var a=we(),o=ee(a);{var l=d=>{var f=we(),h=ee(f);pt(h,()=>e.child,()=>({props:u(s)})),P(d,f)},c=d=>{var f=$0();Ft(f,()=>({...u(s)}));var h=$(f);pt(h,()=>e.children??wt),q(f),P(d,f)};xe(o,d=>{e.child?d(l):d(c,-1)})}P(n,a),at()}function Q0(n,e){const t=Tn();st(e,!0);let i=le(e,"ref",15,null),r=le(e,"id",19,()=>Vn(t)),s=ut(e,["$$slots","$$events","$$legacy","ref","id"]);const a=va.get(),o=z(()=>!!(a.scrollbarXNode&&a.scrollbarYNode)),l=z(()=>a.opts.type.current!=="scroll"&&u(o));var c=we(),d=ee(c);{var f=h=>{J0(h,mt(()=>s,{get id(){return r()},get ref(){return i()},set ref(p){i(p)}}))};xe(d,h=>{u(l)&&h(f)})}P(n,c),at()}function dh(n,e,t){const i={position:"absolute"};return n==="lr"?(i.left=`${e}%`,i.right=`${t}%`):n==="rl"?(i.right=`${e}%`,i.left=`${t}%`):n==="bt"?(i.bottom=`${e}%`,i.top=`${t}%`):(i.top=`${e}%`,i.bottom=`${t}%`),i}function Xp(n,e){const t={position:"absolute"};return n==="lr"?(t.left=`${e}%`,t.translate="-50% 0"):n==="rl"?(t.right=`${e}%`,t.translate="50% 0"):n==="bt"?(t.bottom=`${e}%`,t.translate="0 50%"):(t.top=`${e}%`,t.translate="0 -50%"),t}function jp(n,e,t){const i={position:"absolute"};return n==="lr"?(i.left=`${e}%`,i.translate=`${t}% 0`):n==="rl"?(i.right=`${e}%`,i.translate=`${-t}% 0`):n==="bt"?(i.bottom=`${e}%`,i.translate=`0 ${-t}%`):(i.top=`${e}%`,i.translate=`0 ${t}%`),i}function e_(n){if(Math.floor(n)===n)return 0;const e=n.toString();if(e.indexOf(".")!==-1&&e.indexOf("e-")===-1)return e.split(".")[1].length;if(e.indexOf("e-")!==-1){const t=e.split("e-");return parseInt(t[1],10)}return 0}function t_(n,e){const t=Math.pow(10,e);return Math.round(n*t)/t}function Qu(n,e,t){if(typeof n=="number"){const i=t-e;let r=Math.ceil(i/n);const s=e_(n),a=Math.pow(10,s),o=Math.round(i*a),l=Math.round(n*a);o%l===0&&r++;const c=[];for(let d=0;d<r;d++){const f=e+d*n,h=t_(f,s);c.push(h)}return c}return[...new Set(n)].filter(i=>i>=e&&i<=t).sort((i,r)=>i-r)}function Tr(n,e){if(e.length===0)return n;let t=e[0],i=Math.abs(n-t);for(const r of e){const s=Math.abs(n-r);s<i&&(i=s,t=r)}return t}function Aa(n,e,t){const i=e.indexOf(n);return i===-1?Tr(n,e):t==="next"?i<e.length-1?e[i+1]:n:i>0?e[i-1]:n}function n_(n,e,t=!0){const[i,r]=n,[s,a]=e,o=(a-s)/(r-i);return l=>{const c=s+o*(l-i);return t?c>Math.max(s,a)?Math.max(s,a):c<Math.min(s,a)?Math.min(s,a):c:c}}const hr=Lu({component:"slider",parts:["root","thumb","range","tick","tick-label","thumb-label"]}),ed=new pr("Slider.Root");class qp{opts;attachment;#e=Oe(!1);get isActive(){return u(this.#e)}set isActive(e){W(this.#e,e,!0)}#t=Oe(0);#n=z(()=>this.opts.orientation.current==="horizontal"?this.opts.dir.current==="rtl"?"rl":"lr":this.opts.dir.current==="rtl"?"tb":"bt");get direction(){return u(this.#n)}set direction(e){W(this.#n,e)}#i=z(()=>Qu(this.opts.step.current,this.opts.min.current,this.opts.max.current));get normalizedSteps(){return u(this.#i)}set normalizedSteps(e){W(this.#i,e)}domContext;constructor(e){this.opts=e,this.attachment=bi(e.ref),this.domContext=new xp(this.opts.ref),new Rr(()=>this.opts.ref.current,this.#r)}#r=()=>{W(this.#t,u(this.#t)+1)};isThumbActive(e){return this.isActive}#s=z(()=>{if(!this.opts.disabled.current)return this.opts.orientation.current==="horizontal"?"pan-y":"pan-x"});getAllThumbs=()=>{const e=this.opts.ref.current;return e?Array.from(e.querySelectorAll(hr.selector("thumb"))):[]};getThumbScale=()=>{u(this.#t);const e=this.opts.trackPadding?.current;if(e!==void 0&&e>0)return[e,100-e];if(this.opts.thumbPositioning.current==="exact")return[0,100];const t=this.opts.orientation.current==="vertical",i=this.getAllThumbs()[0],r=t?i?.offsetHeight:i?.offsetWidth;if(r===void 0||Number.isNaN(r)||r===0)return[0,100];const s=t?this.opts.ref.current?.offsetHeight:this.opts.ref.current?.offsetWidth;if(s===void 0||Number.isNaN(s)||s===0)return[0,100];const a=r/2/s*100,o=a,l=100-a;return[o,l]};getPositionFromValue=e=>{const t=this.getThumbScale();return n_([this.opts.min.current,this.opts.max.current],t)(e)};#a=z(()=>({id:this.opts.id.current,"data-orientation":this.opts.orientation.current,"data-disabled":Pr(this.opts.disabled.current),style:{touchAction:u(this.#s)},[hr.root]:"",...this.attachment}));get props(){return u(this.#a)}set props(e){W(this.#a,e)}}class i_ extends qp{opts;isMulti=!1;constructor(e){super(e),this.opts=e,Up(()=>Iu(dn(this.domContext.getDocument(),"pointerdown",this.handlePointerDown),dn(this.domContext.getDocument(),"pointerup",this.handlePointerUp),dn(this.domContext.getDocument(),"pointermove",this.handlePointerMove),dn(this.domContext.getDocument(),"pointerleave",this.handlePointerUp))),fr([()=>this.opts.step.current,()=>this.opts.min.current,()=>this.opts.max.current,()=>this.opts.value.current],([t,i,r,s])=>{const a=Qu(t,i,r),o=c=>a.includes(c),l=c=>Tr(c,a);o(s)||(this.opts.value.current=l(s))})}isTickValueSelected=e=>this.opts.value.current===e;applyPosition({clientXY:e,start:t,end:i}){const r=this.opts.min.current,s=this.opts.max.current,o=(e-t)/(i-t)*(s-r)+r;if(o<r)this.updateValue(r);else if(o>s)this.updateValue(s);else{const l=this.normalizedSteps,c=Tr(o,l);this.updateValue(c)}}updateValue=e=>{this.opts.value.current=Tr(e,this.normalizedSteps)};handlePointerMove=e=>{if(!this.isActive||this.opts.disabled.current)return;e.preventDefault(),e.stopPropagation();const t=this.opts.ref.current,i=this.getAllThumbs()[0];if(!t||!i)return;i.focus();const{left:r,right:s,top:a,bottom:o}=t.getBoundingClientRect();this.direction==="lr"?this.applyPosition({clientXY:e.clientX,start:r,end:s}):this.direction==="rl"?this.applyPosition({clientXY:e.clientX,start:s,end:r}):this.direction==="bt"?this.applyPosition({clientXY:e.clientY,start:o,end:a}):this.direction==="tb"&&this.applyPosition({clientXY:e.clientY,start:a,end:o})};handlePointerDown=e=>{if(e.button!==0||this.opts.disabled.current)return;const t=this.opts.ref.current,i=this.getAllThumbs()[0];if(!i||!t)return;const r=e.composedPath()[0]??e.target;!Rp(r)||!t.contains(r)||(e.preventDefault(),i.focus(),this.isActive=!0,this.handlePointerMove(e))};handlePointerUp=()=>{this.opts.disabled.current||(this.isActive&&this.opts.onValueCommit.current(wn(()=>this.opts.value.current)),this.isActive=!1)};#e=z(()=>{const e=this.opts.value.current;return Array.from({length:1},()=>{const t=e,i=this.getPositionFromValue(t),r=Xp(this.direction,i);return{role:"slider","aria-valuemin":this.opts.min.current,"aria-valuemax":this.opts.max.current,"aria-valuenow":t,"aria-disabled":Oo(this.opts.disabled.current),"aria-orientation":this.opts.orientation.current,"data-value":t,"data-orientation":this.opts.orientation.current,style:r,[hr.thumb]:""}})});get thumbsPropsArr(){return u(this.#e)}set thumbsPropsArr(e){W(this.#e,e)}#t=z(()=>this.thumbsPropsArr.map((e,t)=>t));get thumbsRenderArr(){return u(this.#t)}set thumbsRenderArr(e){W(this.#t,e)}#n=z(()=>{const e=this.normalizedSteps,t=this.opts.value.current;return e.map((i,r)=>{const s=this.getPositionFromValue(i),a=r===0,o=r===e.length-1,l=a?0:o?-100:-50,c=jp(this.direction,s,l),d=i<=t;return{"data-disabled":Pr(this.opts.disabled.current),"data-orientation":this.opts.orientation.current,"data-bounded":d?"":void 0,"data-value":i,"data-selected":this.isTickValueSelected(i)?"":void 0,style:c,[hr.tick]:""}})});get ticksPropsArr(){return u(this.#n)}set ticksPropsArr(e){W(this.#n,e)}#i=z(()=>this.ticksPropsArr.map((e,t)=>t));get ticksRenderArr(){return u(this.#i)}set ticksRenderArr(e){W(this.#i,e)}#r=z(()=>this.ticksPropsArr.map((e,t)=>({value:e["data-value"],index:t})));get tickItemsArr(){return u(this.#r)}set tickItemsArr(e){W(this.#r,e)}#s=z(()=>[{value:this.opts.value.current,index:0}]);get thumbItemsArr(){return u(this.#s)}set thumbItemsArr(e){W(this.#s,e)}#a=z(()=>({ticks:this.ticksRenderArr,thumbs:this.thumbsRenderArr,tickItems:this.tickItemsArr,thumbItems:this.thumbItemsArr}));get snippetProps(){return u(this.#a)}set snippetProps(e){W(this.#a,e)}}class r_ extends qp{opts;isMulti=!0;#e=Oe(null);get activeThumb(){return u(this.#e)}set activeThumb(e){W(this.#e,e,!0)}#t=Oe(0);get currentThumbIdx(){return u(this.#t)}set currentThumbIdx(e){W(this.#t,e,!0)}constructor(e){super(e),this.opts=e,Up(()=>Iu(dn(this.domContext.getDocument(),"pointerdown",this.handlePointerDown),dn(this.domContext.getDocument(),"pointerup",this.handlePointerUp),dn(this.domContext.getDocument(),"pointermove",this.handlePointerMove),dn(this.domContext.getDocument(),"pointerleave",this.handlePointerUp))),fr([()=>this.opts.step.current,()=>this.opts.min.current,()=>this.opts.max.current,()=>this.opts.value.current],([t,i,r,s])=>{const a=Qu(t,i,r),o=c=>a.includes(c),l=c=>Tr(c,a);s.some(c=>!o(c))&&(this.opts.value.current=s.map(l))})}isTickValueSelected=e=>this.opts.value.current.includes(e);isThumbActive(e){return this.isActive&&this.activeThumb?.idx===e}applyPosition({clientXY:e,activeThumbIdx:t,start:i,end:r}){const s=this.opts.min.current,a=this.opts.max.current,l=(e-i)/(r-i)*(a-s)+s;if(l<s)this.updateValue(s,t);else if(l>a)this.updateValue(a,t);else{const c=this.normalizedSteps,d=Tr(l,c);this.updateValue(d,t)}}#n=e=>{const t=this.getAllThumbs();if(!t.length)return;for(const a of t)a.blur();const i=t.map(a=>{if(this.opts.orientation.current==="horizontal"){const{left:o,right:l}=a.getBoundingClientRect();return Math.abs(e.clientX-(o+l)/2)}else{const{top:o,bottom:l}=a.getBoundingClientRect();return Math.abs(e.clientY-(o+l)/2)}}),r=t[i.indexOf(Math.min(...i))],s=t.indexOf(r);return{node:r,idx:s}};handlePointerMove=e=>{if(!this.isActive||this.opts.disabled.current)return;e.preventDefault(),e.stopPropagation();const t=this.opts.ref.current,i=this.activeThumb;if(!t||!i)return;i.node.focus();const{left:r,right:s,top:a,bottom:o}=t.getBoundingClientRect(),l=this.direction;l==="lr"?this.applyPosition({clientXY:e.clientX,activeThumbIdx:i.idx,start:r,end:s}):l==="rl"?this.applyPosition({clientXY:e.clientX,activeThumbIdx:i.idx,start:s,end:r}):l==="bt"?this.applyPosition({clientXY:e.clientY,activeThumbIdx:i.idx,start:o,end:a}):l==="tb"&&this.applyPosition({clientXY:e.clientY,activeThumbIdx:i.idx,start:a,end:o})};handlePointerDown=e=>{if(e.button!==0||this.opts.disabled.current)return;const t=this.opts.ref.current,i=this.#n(e);if(!i||!t)return;const r=e.composedPath()[0]??e.target;!Rp(r)||!t.contains(r)||(e.preventDefault(),this.activeThumb=i,i.node.focus(),this.isActive=!0,this.handlePointerMove(e))};handlePointerUp=()=>{this.opts.disabled.current||(this.isActive&&this.opts.onValueCommit.current(wn(()=>this.opts.value.current)),this.isActive=!1)};getAllThumbs=()=>{const e=this.opts.ref.current;return e?Array.from(e.querySelectorAll(hr.selector("thumb"))):[]};updateValue=(e,t)=>{const i=this.opts.value.current;if(!i.length){this.opts.value.current.push(e);return}if(i[t]===e)return;const s=[...i];if(!hv(t,s))return;const a=s[t]>e?-1:1,o=()=>{const c=t+a;s[t]=s[c],s[c]=e;const d=this.getAllThumbs();d.length&&(d[c]?.focus(),this.activeThumb={node:d[c],idx:c})};if(this.opts.autoSort.current&&(a===-1&&e<s[t-1]||a===1&&e>s[t+1])){o(),this.opts.value.current=s;return}const l=this.normalizedSteps;s[t]=Tr(e,l),this.opts.value.current=s};#i=z(()=>{const e=this.opts.value.current;return Array.from({length:e.length||1},(t,i)=>{const r=wn(()=>this.currentThumbIdx);r<e.length&&wn(()=>{this.currentThumbIdx=r+1});const s=e[i],a=this.getPositionFromValue(s??0),o=Xp(this.direction,a);return{role:"slider","aria-valuemin":this.opts.min.current,"aria-valuemax":this.opts.max.current,"aria-valuenow":s,"aria-disabled":Oo(this.opts.disabled.current),"aria-orientation":this.opts.orientation.current,"data-value":s,"data-orientation":this.opts.orientation.current,style:o,[hr.thumb]:""}})});get thumbsPropsArr(){return u(this.#i)}set thumbsPropsArr(e){W(this.#i,e)}#r=z(()=>this.thumbsPropsArr.map((e,t)=>t));get thumbsRenderArr(){return u(this.#r)}set thumbsRenderArr(e){W(this.#r,e)}#s=z(()=>{const e=this.normalizedSteps,t=this.opts.value.current;return e.map((i,r)=>{const s=this.getPositionFromValue(i),a=r===0,o=r===e.length-1,l=a?0:o?-100:-50,c=jp(this.direction,s,l),d=t.length===1?i<=t[0]:t[0]<=i&&i<=t[t.length-1];return{"data-disabled":Pr(this.opts.disabled.current),"data-orientation":this.opts.orientation.current,"data-bounded":d?"":void 0,"data-value":i,style:c,[hr.tick]:""}})});get ticksPropsArr(){return u(this.#s)}set ticksPropsArr(e){W(this.#s,e)}#a=z(()=>this.ticksPropsArr.map((e,t)=>t));get ticksRenderArr(){return u(this.#a)}set ticksRenderArr(e){W(this.#a,e)}#o=z(()=>this.ticksPropsArr.map((e,t)=>({value:e["data-value"],index:t})));get tickItemsArr(){return u(this.#o)}set tickItemsArr(e){W(this.#o,e)}#l=z(()=>this.opts.value.current.map((t,i)=>({value:t,index:i})));get thumbItemsArr(){return u(this.#l)}set thumbItemsArr(e){W(this.#l,e)}#c=z(()=>({ticks:this.ticksRenderArr,thumbs:this.thumbsRenderArr,tickItems:this.tickItemsArr,thumbItems:this.thumbItemsArr}));get snippetProps(){return u(this.#c)}set snippetProps(e){W(this.#c,e)}}class s_{static create(e){const{type:t,...i}=e,r=t==="single"?new i_(i):new r_(i);return ed.set(r)}}const a_=[wp,Ep,Tp,Ap,Cp,Pp];class td{static create(e){return new td(e,ed.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=bi(e.ref)}#e=z(()=>{if(Array.isArray(this.root.opts.value.current)){const e=this.root.opts.value.current.length>1?this.root.getPositionFromValue(Math.min(...this.root.opts.value.current)??0):0,t=100-this.root.getPositionFromValue(Math.max(...this.root.opts.value.current)??0);return{position:"absolute",...dh(this.root.direction,e,t)}}else{const e=this.root.opts.trackPadding?.current,t=this.root.opts.value.current,i=this.root.opts.max.current,r=0,s=e!==void 0&&e>0&&t===i?0:100-this.root.getPositionFromValue(t);return{position:"absolute",...dh(this.root.direction,r,s)}}});get rangeStyles(){return u(this.#e)}set rangeStyles(e){W(this.#e,e)}#t=z(()=>({id:this.opts.id.current,"data-orientation":this.root.opts.orientation.current,"data-disabled":Pr(this.root.opts.disabled.current),style:this.rangeStyles,[hr.range]:"",...this.attachment}));get props(){return u(this.#t)}set props(e){W(this.#t,e)}}class nd{static create(e){return new nd(e,ed.get())}opts;root;attachment;#e=z(()=>this.root.opts.disabled.current||this.opts.disabled.current);constructor(e,t){this.opts=e,this.root=t,this.attachment=bi(e.ref),this.onkeydown=this.onkeydown.bind(this)}#t(e){this.root.isMulti?this.root.updateValue(e,this.opts.index.current):this.root.updateValue(e)}onkeydown(e){if(u(this.#e))return;const t=this.opts.ref.current;if(!t)return;const i=this.root.getAllThumbs();if(!i.length)return;const r=i.indexOf(t);if(this.root.isMulti&&(this.root.currentThumbIdx=r),!a_.includes(e.key))return;e.preventDefault();const s=this.root.opts.min.current,a=this.root.opts.max.current,o=this.root.opts.value.current,l=Array.isArray(o)?o[r]:o,c=this.root.opts.orientation.current,d=this.root.direction,f=this.root.normalizedSteps;switch(e.key){case Cp:this.#t(s);break;case Pp:this.#t(a);break;case wp:if(c!=="horizontal")break;if(e.metaKey){const h=d==="rl"?a:s;this.#t(h)}else{const p=Aa(l,f,d==="rl"?"next":"prev");this.#t(p)}break;case Ep:if(c!=="horizontal")break;if(e.metaKey){const h=d==="rl"?s:a;this.#t(h)}else{const p=Aa(l,f,d==="rl"?"prev":"next");this.#t(p)}break;case Tp:if(e.metaKey){const h=d==="tb"?s:a;this.#t(h)}else{const p=Aa(l,f,d==="tb"?"prev":"next");this.#t(p)}break;case Ap:if(e.metaKey){const h=d==="tb"?a:s;this.#t(h)}else{const p=Aa(l,f,d==="tb"?"next":"prev");this.#t(p)}break}this.root.opts.onValueCommit.current(this.root.opts.value.current)}#n=z(()=>({...this.root.thumbsPropsArr[this.opts.index.current],id:this.opts.id.current,onkeydown:this.onkeydown,"data-active":this.root.isThumbActive(this.opts.index.current)?"":void 0,"data-disabled":Pr(this.opts.disabled.current||this.root.opts.disabled.current),tabindex:this.opts.disabled.current||this.root.opts.disabled.current?-1:0,...this.attachment}));get props(){return u(this.#n)}set props(e){W(this.#n,e)}}var o_=Z("<span><!></span>");function l_(n,e){const t=Tn();st(e,!0);let i=le(e,"id",19,()=>Vn(t)),r=le(e,"ref",15,null),s=le(e,"value",15),a=le(e,"onValueChange",3,Un),o=le(e,"onValueCommit",3,Un),l=le(e,"disabled",3,!1),c=le(e,"step",3,1),d=le(e,"dir",3,"ltr"),f=le(e,"autoSort",3,!0),h=le(e,"orientation",3,"horizontal"),p=le(e,"thumbPositioning",3,"contain"),m=ut(e,["$$slots","$$events","$$legacy","children","child","id","ref","value","type","onValueChange","onValueCommit","disabled","min","max","step","dir","autoSort","orientation","thumbPositioning","trackPadding"]);const x=z(()=>e.min!==void 0?e.min:Array.isArray(c())?Math.min(...c()):0),v=z(()=>e.max!==void 0?e.max:Array.isArray(c())?Math.max(...c()):100);function g(){if(s()===void 0)return e.type==="single"?u(x):[]}g(),fr.pre(()=>s(),()=>{g()});const y=s_.create({id:Qe(()=>i()),ref:Qe(()=>r(),_=>r(_)),value:Qe(()=>s(),_=>{s(_),a()(_)}),onValueCommit:Qe(()=>o()),disabled:Qe(()=>l()),min:Qe(()=>u(x)),max:Qe(()=>u(v)),step:Qe(()=>c()),dir:Qe(()=>d()),autoSort:Qe(()=>f()),orientation:Qe(()=>h()),thumbPositioning:Qe(()=>p()),type:e.type,trackPadding:Qe(()=>e.trackPadding)}),w=z(()=>jt(m,y.props));var b=we(),E=ee(b);{var S=_=>{var T=we(),D=ee(T);{let L=z(()=>({props:u(w),...y.snippetProps}));pt(D,()=>e.child,()=>u(L))}P(_,T)},A=_=>{var T=o_();Ft(T,()=>({...u(w)}));var D=$(T);pt(D,()=>e.children??wt,()=>y.snippetProps),q(T),P(_,T)};xe(E,_=>{e.child?_(S):_(A,-1)})}P(n,b),at()}var c_=Z("<span><!></span>");function u_(n,e){const t=Tn();st(e,!0);let i=le(e,"ref",15,null),r=le(e,"id",19,()=>Vn(t)),s=ut(e,["$$slots","$$events","$$legacy","children","child","ref","id"]);const a=td.create({id:Qe(()=>r()),ref:Qe(()=>i(),h=>i(h))}),o=z(()=>jt(s,a.props));var l=we(),c=ee(l);{var d=h=>{var p=we(),m=ee(p);pt(m,()=>e.child,()=>({props:u(o)})),P(h,p)},f=h=>{var p=c_();Ft(p,()=>({...u(o)}));var m=$(p);pt(m,()=>e.children??wt),q(p),P(h,p)};xe(c,h=>{e.child?h(d):h(f,-1)})}P(n,l),at()}var d_=Z("<span><!></span>");function h_(n,e){const t=Tn();st(e,!0);let i=le(e,"ref",15,null),r=le(e,"id",19,()=>Vn(t)),s=le(e,"disabled",3,!1),a=ut(e,["$$slots","$$events","$$legacy","children","child","ref","id","index","disabled"]);const o=nd.create({id:Qe(()=>r()),ref:Qe(()=>i(),p=>i(p)),index:Qe(()=>e.index),disabled:Qe(()=>s())}),l=z(()=>jt(a,o.props));var c=we(),d=ee(c);{var f=p=>{var m=we(),x=ee(m);{let v=z(()=>({active:o.root.isThumbActive(o.opts.index.current),props:u(l)}));pt(x,()=>e.child,()=>u(v))}P(p,m)},h=p=>{var m=d_();Ft(m,()=>({...u(l)}));var x=$(m);{let v=z(()=>({active:o.root.isThumbActive(o.opts.index.current)}));pt(x,()=>e.children??wt,()=>u(v))}q(m),P(p,m)};xe(d,p=>{e.child?p(f):p(h,-1)})}P(n,c),at()}var Mo=new Map;function Yp(n,e){Mo.set(n,e)}Yp("Rhino.Geometry.Point3d",(n,e)=>{let t=e;return!t||typeof t.X!="number"?null:new n.Point([t.X,t.Y,t.Z])});Yp("Rhino.Geometry.Line",(n,e)=>{let t=e;return!t||!t.From||!t.To?null:new n.Line([t.From.X,t.From.Y,t.From.Z],[t.To.X,t.To.Y,t.To.Z])});function f_(n){if(Mo.has(n))return Mo.get(n);for(let[e,t]of Mo)if(n.startsWith(e))return t}function p_(n){return!n||typeof n!="object"?null:n.data??n.value??null}function m_(n,e,t){let i=f_(e);if(i)try{return i(t,n)}catch(r){Nt().warn(`Failed to decode Rhino type ${e}:`,r)}try{let r=p_(n);if(r)return t.CommonObject.decode(r)}catch(r){return Nt().warn(`Failed to decode ${e} with CommonObject:`,r),{__decodeError:!0,type:e,raw:n}}return n}var ds={STRING:"System.String",INT:"System.Int32",DOUBLE:"System.Double",BOOL:"System.Boolean"},g_="Rhino.Geometry.",v_=["WebDisplay"],__="FileData";function Kp(n){return v_.some(e=>n.includes(e))}function Zp(n){if(typeof n!="string")return n;let e=n.trim();if(!(e.startsWith("{")||e.startsWith("[")||e.startsWith('"')))return n;try{let t=JSON.parse(e);if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t}catch{return n}}function x_(n,e,t){switch(e){case ds.STRING:return typeof n!="string"?n:n.replace(/^"(.*)"$/,"$1");case ds.INT:return Number.parseInt(n,10);case ds.DOUBLE:return Number.parseFloat(n);case ds.BOOL:return String(n).toLowerCase()==="true";default:return t&&e.startsWith(g_)?m_(n,e,t):n}}function $p(n,e,t,i){if(typeof n!="string")return n;let r=t?Zp(n):n;return x_(r,e,i)}function b_(n){if(!n||typeof n!="object")return!1;let e=n;return typeof e.fileName=="string"&&typeof e.fileType=="string"&&"data"in e&&typeof e.isBase64Encoded=="boolean"&&typeof e.subFolder=="string"}function ko(n,e){for(let t of Object.values(n))if(Array.isArray(t))for(let i of t)e(i)}function y_(n,e=!1,t={}){let{parseValues:i=!0,rhino:r,stringOnly:s=!1}=t,a={},o=new Set;for(let l of n.values)ko(l.InnerTree,c=>{if(Kp(c.type)||s&&c.type!==ds.STRING)return;let d=e?c.id:l.ParamName;if(!d)return;let f=$p(c.data,c.type,i,r);d in a?o.has(d)?a[d].push(f):(a[d]=[a[d],f],o.add(d)):a[d]=f});return{values:a}}function S_(n){let e=[];for(let t of n.values)ko(t.InnerTree,i=>{if(!i.type.includes(__))return;let r=Zp(i.data);b_(r)&&e.push(r)});return e}function M_(n,e,t={}){let{parseValues:i=!0,rhino:r,stringOnly:s=!1}=t,a;if("byName"in e?a=n.values.find(l=>l.ParamName===e.byName):a=n.values.find(l=>{let c=!1;return ko(l.InnerTree,d=>{d.id===e.byId&&(c=!0)}),c}),!a)return;let o=[];if(ko(a.InnerTree,l=>{if("byId"in e&&l.id!==e.byId||Kp(l.type)||s&&l.type!==ds.STRING)return;let c=$p(l.data,l.type,i,r);o.push(c)}),o.length!==0)return o.length===1?o[0]:o}var w_=class{constructor(n,e=!1){this.response=n,this.debug=e}getValues(n=!1,e={}){return y_(this.response,n,e)}getValue(n,e){return M_(this.response,n,e)}async extractMeshesFromResponse(n){let e={debug:this.debug,...n},t;try{({getThreeMeshesFromComputeResponse:t}=await gp(()=>Promise.resolve().then(()=>UD),void 0,import.meta.url))}catch(i){throw new ma("Failed to load three.js visualization module. Ensure three.js is installed as a peer dependency.",Pu.INVALID_STATE,{context:{originalError:i instanceof Error?i.message:String(i)}})}return t(this.response,e)}getFileData(){return S_(this.response)}async getAndDownloadFiles(n,e){let t=this.getFileData();await jg(t,n,e)}},E_=/^\{(\d+(?:;\d+)*)?\}$/;function T_(n){if(typeof n!="object"||n===null||Array.isArray(n))return!1;let e=Object.entries(n);return e.length>0&&e.every(([t,i])=>E_.test(t)&&Array.isArray(i))}function Rs(n,e,t){if(n==null)return n;if(Array.isArray(n)){let r=n.map(e).filter(s=>s!==null);return r.length>0?r:void 0}let i=e(n);return i!==null?i:t?void 0:n}var A_=n=>{if(typeof n=="number")return n;if(typeof n=="string"){let e=n.trim();if(e==="")return null;let t=Number(e);return Number.isNaN(t)?null:t}return null},C_=n=>{if(typeof n=="boolean")return n;if(typeof n=="string"){let e=n.toLowerCase();if(e==="true")return!0;if(e==="false")return!1;throw new Error(`Invalid boolean string: "${n}"`)}return null},P_=n=>typeof n=="string"?n.length>=2&&n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1):n.startsWith('"')?n.slice(1):n:null,R_=n=>{if(typeof n=="string"){let e=n.trim();return e.startsWith('"')&&e.endsWith('"')&&(e=e.slice(1,-1).trim()),e}return null};function Jp(n){return e=>{if(typeof e=="object"&&e!==null)return e;if(typeof e=="string"&&e.trim()!=="")try{let t=JSON.parse(e);return typeof t=="object"&&t!==null?t:(Nt().warn(`Parsed value for input ${n} is not an object`),null)}catch(t){return Nt().warn(`Failed to parse object value "${e}" for input ${n}`,t),null}return null}}function hh(n,e,t){let i=Number(n.toFixed(e));return Math.abs(n-i)<t?i:n}function D_(n,e){if(!Number.isFinite(n)||n===0)return .1;let t=Math.abs(n);if(t>=1){let d=String(n).split(".")[1];if(d&&d.length>0){let f=Math.min(d.length,12),h=Math.pow(10,-f),p=Number(h.toFixed(f));return Math.abs(p-h)<e?p:h}return 1}let i=String(n),r=i.toLowerCase().match(/e(-?\d+)/);if(r){let d=Number(r[1]);if(d<0||i.toLowerCase().includes("e-")){let f=Math.abs(d),h=Math.pow(10,-f),p=Number(h.toFixed(f));return Math.abs(p-h)<e?p:h}return .1}let s=12,a=t.toFixed(s).replace(/0+$/,""),o=Math.min((a.split(".")[1]||"").length,s);if(o===0)return .1;let l=Math.pow(10,-o),c=Number(l.toFixed(o));return Math.abs(c-l)<e?c:l}function L_(n,e=1e-8){let t=n.paramType==="Integer";if(T_(n.default))return{default:n.default,stepSize:t?1:.1};let i=Rs(n.default,A_,!0);if(t)return Array.isArray(i)?i=i.map(d=>typeof d=="number"?Math.round(d):d):typeof i=="number"&&(i=Math.round(i)),{default:i,stepSize:1};let r=Array.isArray(i)?i[0]:i,s;typeof r=="number"&&Number.isFinite(r)&&r!==0?s=r:typeof n.minimum=="number"&&Number.isFinite(n.minimum)&&n.minimum!==0?s=n.minimum:typeof n.maximum=="number"&&Number.isFinite(n.maximum)&&n.maximum!==0&&(s=n.maximum);let a=s!==void 0?D_(s,e):.1,o=0,l=String(a),c=l.toLowerCase().match(/e(-?\d+)/);if(c?o=Math.abs(Number(c[1])):o=l.split(".")[1]?.length??0,o===0&&typeof r=="number"&&r!==0&&Math.abs(r)<1){let d=Math.ceil(-Math.log10(Math.abs(r)));Number.isFinite(d)&&d>0&&(o=d)}return o=Math.min(Math.max(o,0),12),Array.isArray(i)?i=i.map(d=>typeof d=="number"?hh(d,o,e):d):typeof i=="number"&&(i=hh(i,o,e)),{default:i,stepSize:a}}var I_={types:["Number","Integer"],parse(n,e){let{default:t,stepSize:i}=L_(n);return{...e,paramType:n.paramType,minimum:n.minimum,maximum:n.maximum,atLeast:n.atLeast,atMost:n.atMost,stepSize:i,default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:n.paramType,minimum:n.minimum,maximum:n.maximum,atLeast:n.atLeast,atMost:n.atMost,default:t?[0]:0}}},N_={types:["Boolean"],parse(n,e){let t;try{t=Rs(n.default,C_,!1)}catch(i){throw i instanceof Error?new ma(i.message):i}return{...e,paramType:"Boolean",default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"Boolean",default:t?[!1]:!1}}},U_={types:["Text"],parse(n,e){let t=Rs(n.default,P_,!1);return{...e,paramType:"Text",default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"Text",default:t?[""]:""}}},F_={types:["ValueList"],parse(n,e){if(!n.values||typeof n.values!="object"||Object.keys(n.values).length===0)throw ma.missingValues(n.nickname||"unnamed","ValueList");if(n.default!==void 0&&n.default!==null){let t=String(n.default).toLowerCase();Object.keys(n.values).some(i=>i.toLowerCase()===t)||Nt().warn(`ValueList input "${n.nickname||"unnamed"}" default value "${n.default}" is not in available values`)}return{...e,paramType:"ValueList",values:n.values,default:n.default}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"ValueList",values:n.values??{},default:t?[n.default]:n.default}}},O_={types:["Geometry"],parse(n,e){let t=Rs(n.default,Jp(n.nickname||"unnamed"),!0);return{...e,paramType:"Geometry",default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"Geometry",default:t?[null]:null}}},z_={types:["File"],parse(n,e){let t=Rs(n.default,Jp(n.nickname||"unnamed"),!0);return{...e,paramType:"File",acceptedFormats:n.acceptedFormats,default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"File",default:t?[null]:null}}},B_={types:["Color"],parse(n,e){let t=Rs(n.default,R_,!1);return{...e,paramType:"Color",default:t}},fallback(n,e){let t=(n.atMost??1)>1;return{...e,paramType:"Color",default:t?["0, 0, 0"]:"0, 0, 0"}}},k_=[I_,N_,U_,F_,O_,z_,B_],V_=new Map(k_.flatMap(n=>n.types.map(e=>[e,n])));new Map([...V_.keys()].map(n=>[n.toLowerCase(),n]));const id="184",xs={ROTATE:0,DOLLY:1,PAN:2},hs={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},H_=0,fh=1,G_=2,wo=1,W_=2,fs=3,Kn=0,Yn=1,Qn=2,Mn=0,bs=1,ph=2,mh=3,gh=4,Qp=5,gi=100,X_=101,j_=102,q_=103,Y_=104,Js=200,K_=201,Z_=202,$_=203,_c=204,xc=205,bc=206,J_=207,yc=208,Q_=209,ex=210,tx=211,nx=212,ix=213,rx=214,Sc=0,Mc=1,wc=2,ws=3,Ec=4,Tc=5,Ac=6,Cc=7,em=0,sx=1,ax=2,Fi=0,rd=1,sd=2,ad=3,od=4,ld=5,cd=6,xa=7,tm=300,Dr=301,Es=302,Eo=303,wl=304,ll=306,Lr=1e3,_i=1001,Pc=1002,xn=1003,ox=1004,Ca=1005,hn=1006,El=1007,lr=1008,qn=1009,nm=1010,im=1011,aa=1012,ud=1013,Oi=1014,ti=1015,Fn=1016,dd=1017,hd=1018,Ts=1020,rm=35902,sm=35899,am=1021,om=1022,li=1023,Yi=1026,cr=1027,lm=1028,fd=1029,Ir=1030,pd=1031,md=1033,To=33776,Ao=33777,Co=33778,Po=33779,Rc=35840,Dc=35841,Lc=35842,Ic=35843,Nc=36196,Uc=37492,Fc=37496,Oc=37488,zc=37489,Vo=37490,Bc=37491,kc=37808,Vc=37809,Hc=37810,Gc=37811,Wc=37812,Xc=37813,jc=37814,qc=37815,Yc=37816,Kc=37817,Zc=37818,$c=37819,Jc=37820,Qc=37821,eu=36492,tu=36494,nu=36495,iu=36283,ru=36284,Ho=36285,su=36286,lx=3200,Go=0,cx=1,ar="",Wn="srgb",oa="srgb-linear",Wo="linear",Ut="srgb",kr=7680,vh=519,ux=512,dx=513,hx=514,gd=515,fx=516,px=517,vd=518,mx=519,au=35044,_h="300 es",Ni=2e3,la=2001;function gx(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Xo(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function vx(){const n=Xo("canvas");return n.style.display="block",n}const xh={};function jo(...n){const e="THREE."+n.shift();console.log(e,...n)}function cm(n){const e=n[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=n[1];t&&t.isStackTrace?n[0]+=" "+t.getLocation():n[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return n}function ft(...n){n=cm(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...n)}}function Tt(...n){n=cm(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...n)}}function ou(...n){const e=n.join(" ");e in xh||(xh[e]=!0,ft(...n))}function _x(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}const xx={[Sc]:Mc,[wc]:Ac,[Ec]:Cc,[ws]:Tc,[Mc]:Sc,[Ac]:wc,[Cc]:Ec,[Tc]:ws};class mr{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners;if(i===void 0)return;const r=i[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const i=t[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const In=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let bh=1234567;const ys=Math.PI/180,ca=180/Math.PI;function ji(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(In[n&255]+In[n>>8&255]+In[n>>16&255]+In[n>>24&255]+"-"+In[e&255]+In[e>>8&255]+"-"+In[e>>16&15|64]+In[e>>24&255]+"-"+In[t&63|128]+In[t>>8&255]+"-"+In[t>>16&255]+In[t>>24&255]+In[i&255]+In[i>>8&255]+In[i>>16&255]+In[i>>24&255]).toLowerCase()}function gt(n,e,t){return Math.max(e,Math.min(t,n))}function _d(n,e){return(n%e+e)%e}function bx(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function yx(n,e,t){return n!==e?(t-n)/(e-n):0}function ra(n,e,t){return(1-t)*n+t*e}function Sx(n,e,t,i){return ra(n,e,1-Math.exp(-t*i))}function Mx(n,e=1){return e-Math.abs(_d(n,e*2)-e)}function wx(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Ex(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function Tx(n,e){return n+Math.floor(Math.random()*(e-n+1))}function Ax(n,e){return n+Math.random()*(e-n)}function Cx(n){return n*(.5-Math.random())}function Px(n){n!==void 0&&(bh=n);let e=bh+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Rx(n){return n*ys}function Dx(n){return n*ca}function Lx(n){return(n&n-1)===0&&n!==0}function Ix(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Nx(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Ux(n,e,t,i,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+i)/2),d=a((e+i)/2),f=s((e-i)/2),h=a((e-i)/2),p=s((i-e)/2),m=a((i-e)/2);switch(r){case"XYX":n.set(o*d,l*f,l*h,o*c);break;case"YZY":n.set(l*h,o*d,l*f,o*c);break;case"ZXZ":n.set(l*f,l*h,o*d,o*c);break;case"XZX":n.set(o*d,l*m,l*p,o*c);break;case"YXY":n.set(l*p,o*d,l*m,o*c);break;case"ZYZ":n.set(l*m,l*p,o*d,o*c);break;default:ft("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function vi(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Ot(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const um={DEG2RAD:ys,RAD2DEG:ca,generateUUID:ji,clamp:gt,euclideanModulo:_d,mapLinear:bx,inverseLerp:yx,lerp:ra,damp:Sx,pingpong:Mx,smoothstep:wx,smootherstep:Ex,randInt:Tx,randFloat:Ax,randFloatSpread:Cx,seededRandom:Px,degToRad:Rx,radToDeg:Dx,isPowerOfTwo:Lx,ceilPowerOfTwo:Ix,floorPowerOfTwo:Nx,setQuaternionFromProperEuler:Ux,normalize:Ot,denormalize:vi},Kd=class Kd{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(gt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(gt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*i-a*r+e.x,this.y=s*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};Kd.prototype.isVector2=!0;let it=Kd;class xi{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,a,o){let l=i[r+0],c=i[r+1],d=i[r+2],f=i[r+3],h=s[a+0],p=s[a+1],m=s[a+2],x=s[a+3];if(f!==x||l!==h||c!==p||d!==m){let v=l*h+c*p+d*m+f*x;v<0&&(h=-h,p=-p,m=-m,x=-x,v=-v);let g=1-o;if(v<.9995){const y=Math.acos(v),w=Math.sin(y);g=Math.sin(g*y)/w,o=Math.sin(o*y)/w,l=l*g+h*o,c=c*g+p*o,d=d*g+m*o,f=f*g+x*o}else{l=l*g+h*o,c=c*g+p*o,d=d*g+m*o,f=f*g+x*o;const y=1/Math.sqrt(l*l+c*c+d*d+f*f);l*=y,c*=y,d*=y,f*=y}}e[t]=l,e[t+1]=c,e[t+2]=d,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,r,s,a){const o=i[r],l=i[r+1],c=i[r+2],d=i[r+3],f=s[a],h=s[a+1],p=s[a+2],m=s[a+3];return e[t]=o*m+d*f+l*p-c*h,e[t+1]=l*m+d*h+c*f-o*p,e[t+2]=c*m+d*p+o*h-l*f,e[t+3]=d*m-o*f-l*h-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(i/2),d=o(r/2),f=o(s/2),h=l(i/2),p=l(r/2),m=l(s/2);switch(a){case"XYZ":this._x=h*d*f+c*p*m,this._y=c*p*f-h*d*m,this._z=c*d*m+h*p*f,this._w=c*d*f-h*p*m;break;case"YXZ":this._x=h*d*f+c*p*m,this._y=c*p*f-h*d*m,this._z=c*d*m-h*p*f,this._w=c*d*f+h*p*m;break;case"ZXY":this._x=h*d*f-c*p*m,this._y=c*p*f+h*d*m,this._z=c*d*m+h*p*f,this._w=c*d*f-h*p*m;break;case"ZYX":this._x=h*d*f-c*p*m,this._y=c*p*f+h*d*m,this._z=c*d*m-h*p*f,this._w=c*d*f+h*p*m;break;case"YZX":this._x=h*d*f+c*p*m,this._y=c*p*f+h*d*m,this._z=c*d*m-h*p*f,this._w=c*d*f-h*p*m;break;case"XZY":this._x=h*d*f-c*p*m,this._y=c*p*f-h*d*m,this._z=c*d*m+h*p*f,this._w=c*d*f+h*p*m;break;default:ft("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],d=t[6],f=t[10],h=i+o+f;if(h>0){const p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(d-l)*p,this._y=(s-c)*p,this._z=(a-r)*p}else if(i>o&&i>f){const p=2*Math.sqrt(1+i-o-f);this._w=(d-l)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(s+c)/p}else if(o>f){const p=2*Math.sqrt(1+o-i-f);this._w=(s-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(l+d)/p}else{const p=2*Math.sqrt(1+f-i-o);this._w=(a-r)/p,this._x=(s+c)/p,this._y=(l+d)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(gt(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,d=t._w;return this._x=i*d+a*o+r*c-s*l,this._y=r*d+a*l+s*o-i*c,this._z=s*d+a*c+i*l-r*o,this._w=a*d-i*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let i=e._x,r=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(i=-i,r=-r,s=-s,a=-a,o=-o);let l=1-t;if(o<.9995){const c=Math.acos(o),d=Math.sin(c);l=Math.sin(l*c)/d,t=Math.sin(t*c)/d,this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this._onChangeCallback()}else this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const Zd=class Zd{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(yh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(yh.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*i),d=2*(o*t-s*r),f=2*(s*i-a*t);return this.x=t+l*c+a*f-o*d,this.y=i+l*d+o*c-s*f,this.z=r+l*f+s*d-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this.z=gt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this.z=gt(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(gt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-i*l,this.z=i*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Tl.copy(this).projectOnVector(e),this.sub(Tl)}reflect(e){return this.sub(Tl.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(gt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Zd.prototype.isVector3=!0;let X=Zd;const Tl=new X,yh=new xi,$d=class $d{constructor(e,t,i,r,s,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c)}set(e,t,i,r,s,a,o,l,c){const d=this.elements;return d[0]=e,d[1]=r,d[2]=o,d[3]=t,d[4]=s,d[5]=l,d[6]=i,d[7]=a,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],d=i[4],f=i[7],h=i[2],p=i[5],m=i[8],x=r[0],v=r[3],g=r[6],y=r[1],w=r[4],b=r[7],E=r[2],S=r[5],A=r[8];return s[0]=a*x+o*y+l*E,s[3]=a*v+o*w+l*S,s[6]=a*g+o*b+l*A,s[1]=c*x+d*y+f*E,s[4]=c*v+d*w+f*S,s[7]=c*g+d*b+f*A,s[2]=h*x+p*y+m*E,s[5]=h*v+p*w+m*S,s[8]=h*g+p*b+m*A,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8];return t*a*d-t*o*c-i*s*d+i*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],f=d*a-o*c,h=o*l-d*s,p=c*s-a*l,m=t*f+i*h+r*p;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/m;return e[0]=f*x,e[1]=(r*c-d*i)*x,e[2]=(o*i-r*a)*x,e[3]=h*x,e[4]=(d*t-r*l)*x,e[5]=(r*s-o*t)*x,e[6]=p*x,e[7]=(i*l-c*t)*x,e[8]=(a*t-i*s)*x,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Al.makeScale(e,t)),this}rotate(e){return this.premultiply(Al.makeRotation(-e)),this}translate(e,t){return this.premultiply(Al.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}};$d.prototype.isMatrix3=!0;let xt=$d;const Al=new xt,Sh=new xt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Mh=new xt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Fx(){const n={enabled:!0,workingColorSpace:oa,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===Ut&&(r.r=qi(r.r),r.g=qi(r.g),r.b=qi(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Ut&&(r.r=Ss(r.r),r.g=Ss(r.g),r.b=Ss(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===ar?Wo:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return ou("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return ou("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return n.define({[oa]:{primaries:e,whitePoint:i,transfer:Wo,toXYZ:Sh,fromXYZ:Mh,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Wn},outputColorSpaceConfig:{drawingBufferColorSpace:Wn}},[Wn]:{primaries:e,whitePoint:i,transfer:Ut,toXYZ:Sh,fromXYZ:Mh,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Wn}}}),n}const At=Fx();function qi(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Ss(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Vr;class Ox{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{Vr===void 0&&(Vr=Xo("canvas")),Vr.width=e.width,Vr.height=e.height;const r=Vr.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=Vr}return i.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Xo("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=qi(s[a]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(qi(t[i]/255)*255):t[i]=qi(t[i]);return{data:t,width:e.width,height:e.height}}else return ft("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let zx=0;class xd{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:zx++}),this.uuid=ji(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(Cl(r[a].image)):s.push(Cl(r[a]))}else s=Cl(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function Cl(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?Ox.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(ft("Texture: Unable to serialize Texture."),{})}let Bx=0;const Pl=new X;class En extends mr{constructor(e=En.DEFAULT_IMAGE,t=En.DEFAULT_MAPPING,i=_i,r=_i,s=hn,a=lr,o=li,l=qn,c=En.DEFAULT_ANISOTROPY,d=ar){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Bx++}),this.uuid=ji(),this.name="",this.source=new xd(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new it(0,0),this.repeat=new it(1,1),this.center=new it(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new xt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Pl).x}get height(){return this.source.getSize(Pl).y}get depth(){return this.source.getSize(Pl).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const i=e[t];if(i===void 0){ft(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){ft(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==tm)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Lr:e.x=e.x-Math.floor(e.x);break;case _i:e.x=e.x<0?0:1;break;case Pc:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Lr:e.y=e.y-Math.floor(e.y);break;case _i:e.y=e.y<0?0:1;break;case Pc:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}En.DEFAULT_IMAGE=null;En.DEFAULT_MAPPING=tm;En.DEFAULT_ANISOTROPY=1;const Jd=class Jd{constructor(e=0,t=0,i=0,r=1){this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],d=l[4],f=l[8],h=l[1],p=l[5],m=l[9],x=l[2],v=l[6],g=l[10];if(Math.abs(d-h)<.01&&Math.abs(f-x)<.01&&Math.abs(m-v)<.01){if(Math.abs(d+h)<.1&&Math.abs(f+x)<.1&&Math.abs(m+v)<.1&&Math.abs(c+p+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(c+1)/2,b=(p+1)/2,E=(g+1)/2,S=(d+h)/4,A=(f+x)/4,_=(m+v)/4;return w>b&&w>E?w<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(w),r=S/i,s=A/i):b>E?b<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(b),i=S/r,s=_/r):E<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(E),i=A/s,r=_/s),this.set(i,r,s,t),this}let y=Math.sqrt((v-m)*(v-m)+(f-x)*(f-x)+(h-d)*(h-d));return Math.abs(y)<.001&&(y=1),this.x=(v-m)/y,this.y=(f-x)/y,this.z=(h-d)/y,this.w=Math.acos((c+p+g-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this.z=gt(this.z,e.z,t.z),this.w=gt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this.z=gt(this.z,e,t),this.w=gt(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(gt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};Jd.prototype.isVector4=!0;let kt=Jd;class kx extends mr{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:hn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new kt(0,0,e,t),this.scissorTest=!1,this.viewport=new kt(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:i.depth},s=new En(r),a=i.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){const t={minFilter:hn,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,i=e.textures.length;t<i;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new xd(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ni extends kx{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class dm extends En{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=xn,this.minFilter=xn,this.wrapR=_i,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Vx extends En{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=xn,this.minFilter=xn,this.wrapR=_i,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const el=class el{constructor(e,t,i,r,s,a,o,l,c,d,f,h,p,m,x,v){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c,d,f,h,p,m,x,v)}set(e,t,i,r,s,a,o,l,c,d,f,h,p,m,x,v){const g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=r,g[1]=s,g[5]=a,g[9]=o,g[13]=l,g[2]=c,g[6]=d,g[10]=f,g[14]=h,g[3]=p,g[7]=m,g[11]=x,g[15]=v,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new el().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,i=e.elements,r=1/Hr.setFromMatrixColumn(e,0).length(),s=1/Hr.setFromMatrixColumn(e,1).length(),a=1/Hr.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),d=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const h=a*d,p=a*f,m=o*d,x=o*f;t[0]=l*d,t[4]=-l*f,t[8]=c,t[1]=p+m*c,t[5]=h-x*c,t[9]=-o*l,t[2]=x-h*c,t[6]=m+p*c,t[10]=a*l}else if(e.order==="YXZ"){const h=l*d,p=l*f,m=c*d,x=c*f;t[0]=h+x*o,t[4]=m*o-p,t[8]=a*c,t[1]=a*f,t[5]=a*d,t[9]=-o,t[2]=p*o-m,t[6]=x+h*o,t[10]=a*l}else if(e.order==="ZXY"){const h=l*d,p=l*f,m=c*d,x=c*f;t[0]=h-x*o,t[4]=-a*f,t[8]=m+p*o,t[1]=p+m*o,t[5]=a*d,t[9]=x-h*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const h=a*d,p=a*f,m=o*d,x=o*f;t[0]=l*d,t[4]=m*c-p,t[8]=h*c+x,t[1]=l*f,t[5]=x*c+h,t[9]=p*c-m,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const h=a*l,p=a*c,m=o*l,x=o*c;t[0]=l*d,t[4]=x-h*f,t[8]=m*f+p,t[1]=f,t[5]=a*d,t[9]=-o*d,t[2]=-c*d,t[6]=p*f+m,t[10]=h-x*f}else if(e.order==="XZY"){const h=a*l,p=a*c,m=o*l,x=o*c;t[0]=l*d,t[4]=-f,t[8]=c*d,t[1]=h*f+x,t[5]=a*d,t[9]=p*f-m,t[2]=m*f-p,t[6]=o*d,t[10]=x*f+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Hx,e,Gx)}lookAt(e,t,i){const r=this.elements;return $n.subVectors(e,t),$n.lengthSq()===0&&($n.z=1),$n.normalize(),Qi.crossVectors(i,$n),Qi.lengthSq()===0&&(Math.abs(i.z)===1?$n.x+=1e-4:$n.z+=1e-4,$n.normalize(),Qi.crossVectors(i,$n)),Qi.normalize(),Pa.crossVectors($n,Qi),r[0]=Qi.x,r[4]=Pa.x,r[8]=$n.x,r[1]=Qi.y,r[5]=Pa.y,r[9]=$n.y,r[2]=Qi.z,r[6]=Pa.z,r[10]=$n.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],d=i[1],f=i[5],h=i[9],p=i[13],m=i[2],x=i[6],v=i[10],g=i[14],y=i[3],w=i[7],b=i[11],E=i[15],S=r[0],A=r[4],_=r[8],T=r[12],D=r[1],L=r[5],F=r[9],B=r[13],U=r[2],N=r[6],R=r[10],O=r[14],Y=r[3],K=r[7],ne=r[11],ce=r[15];return s[0]=a*S+o*D+l*U+c*Y,s[4]=a*A+o*L+l*N+c*K,s[8]=a*_+o*F+l*R+c*ne,s[12]=a*T+o*B+l*O+c*ce,s[1]=d*S+f*D+h*U+p*Y,s[5]=d*A+f*L+h*N+p*K,s[9]=d*_+f*F+h*R+p*ne,s[13]=d*T+f*B+h*O+p*ce,s[2]=m*S+x*D+v*U+g*Y,s[6]=m*A+x*L+v*N+g*K,s[10]=m*_+x*F+v*R+g*ne,s[14]=m*T+x*B+v*O+g*ce,s[3]=y*S+w*D+b*U+E*Y,s[7]=y*A+w*L+b*N+E*K,s[11]=y*_+w*F+b*R+E*ne,s[15]=y*T+w*B+b*O+E*ce,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],d=e[2],f=e[6],h=e[10],p=e[14],m=e[3],x=e[7],v=e[11],g=e[15],y=l*p-c*h,w=o*p-c*f,b=o*h-l*f,E=a*p-c*d,S=a*h-l*d,A=a*f-o*d;return t*(x*y-v*w+g*b)-i*(m*y-v*E+g*S)+r*(m*w-x*E+g*A)-s*(m*b-x*S+v*A)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],f=e[9],h=e[10],p=e[11],m=e[12],x=e[13],v=e[14],g=e[15],y=t*o-i*a,w=t*l-r*a,b=t*c-s*a,E=i*l-r*o,S=i*c-s*o,A=r*c-s*l,_=d*x-f*m,T=d*v-h*m,D=d*g-p*m,L=f*v-h*x,F=f*g-p*x,B=h*g-p*v,U=y*B-w*F+b*L+E*D-S*T+A*_;if(U===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const N=1/U;return e[0]=(o*B-l*F+c*L)*N,e[1]=(r*F-i*B-s*L)*N,e[2]=(x*A-v*S+g*E)*N,e[3]=(h*S-f*A-p*E)*N,e[4]=(l*D-a*B-c*T)*N,e[5]=(t*B-r*D+s*T)*N,e[6]=(v*b-m*A-g*w)*N,e[7]=(d*A-h*b+p*w)*N,e[8]=(a*F-o*D+c*_)*N,e[9]=(i*D-t*F-s*_)*N,e[10]=(m*S-x*b+g*y)*N,e[11]=(f*b-d*S-p*y)*N,e[12]=(o*T-a*L-l*_)*N,e[13]=(t*L-i*T+r*_)*N,e[14]=(x*w-m*E-v*y)*N,e[15]=(d*E-f*w+h*y)*N,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,a=e.x,o=e.y,l=e.z,c=s*a,d=s*o;return this.set(c*a+i,c*o-r*l,c*l+r*o,0,c*o+r*l,d*o+i,d*l-r*a,0,c*l-r*o,d*l+r*a,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,d=a+a,f=o+o,h=s*c,p=s*d,m=s*f,x=a*d,v=a*f,g=o*f,y=l*c,w=l*d,b=l*f,E=i.x,S=i.y,A=i.z;return r[0]=(1-(x+g))*E,r[1]=(p+b)*E,r[2]=(m-w)*E,r[3]=0,r[4]=(p-b)*S,r[5]=(1-(h+g))*S,r[6]=(v+y)*S,r[7]=0,r[8]=(m+w)*A,r[9]=(v-y)*A,r[10]=(1-(h+x))*A,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];const s=this.determinant();if(s===0)return i.set(1,1,1),t.identity(),this;let a=Hr.set(r[0],r[1],r[2]).length();const o=Hr.set(r[4],r[5],r[6]).length(),l=Hr.set(r[8],r[9],r[10]).length();s<0&&(a=-a),hi.copy(this);const c=1/a,d=1/o,f=1/l;return hi.elements[0]*=c,hi.elements[1]*=c,hi.elements[2]*=c,hi.elements[4]*=d,hi.elements[5]*=d,hi.elements[6]*=d,hi.elements[8]*=f,hi.elements[9]*=f,hi.elements[10]*=f,t.setFromRotationMatrix(hi),i.x=a,i.y=o,i.z=l,this}makePerspective(e,t,i,r,s,a,o=Ni,l=!1){const c=this.elements,d=2*s/(t-e),f=2*s/(i-r),h=(t+e)/(t-e),p=(i+r)/(i-r);let m,x;if(l)m=s/(a-s),x=a*s/(a-s);else if(o===Ni)m=-(a+s)/(a-s),x=-2*a*s/(a-s);else if(o===la)m=-a/(a-s),x=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=h,c[12]=0,c[1]=0,c[5]=f,c[9]=p,c[13]=0,c[2]=0,c[6]=0,c[10]=m,c[14]=x,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,i,r,s,a,o=Ni,l=!1){const c=this.elements,d=2/(t-e),f=2/(i-r),h=-(t+e)/(t-e),p=-(i+r)/(i-r);let m,x;if(l)m=1/(a-s),x=a/(a-s);else if(o===Ni)m=-2/(a-s),x=-(a+s)/(a-s);else if(o===la)m=-1/(a-s),x=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=0,c[12]=h,c[1]=0,c[5]=f,c[9]=0,c[13]=p,c[2]=0,c[6]=0,c[10]=m,c[14]=x,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}};el.prototype.isMatrix4=!0;let Lt=el;const Hr=new X,hi=new Lt,Hx=new X(0,0,0),Gx=new X(1,1,1),Qi=new X,Pa=new X,$n=new X,wh=new Lt,Eh=new xi;class Xn{constructor(e=0,t=0,i=0,r=Xn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],d=r[9],f=r[2],h=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(gt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-gt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(gt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-gt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(gt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-gt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-d,p),this._y=0);break;default:ft("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return wh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(wh,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Eh.setFromEuler(this),this.setFromQuaternion(Eh,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Xn.DEFAULT_ORDER="XYZ";class bd{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Wx=0;const Th=new X,Gr=new xi,Bi=new Lt,Ra=new X,Fs=new X,Xx=new X,jx=new xi,Ah=new X(1,0,0),Ch=new X(0,1,0),Ph=new X(0,0,1),Rh={type:"added"},qx={type:"removed"},Wr={type:"childadded",child:null},Rl={type:"childremoved",child:null};class rn extends mr{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Wx++}),this.uuid=ji(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=rn.DEFAULT_UP.clone();const e=new X,t=new Xn,i=new xi,r=new X(1,1,1);function s(){i.setFromEuler(t,!1)}function a(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Lt},normalMatrix:{value:new xt}}),this.matrix=new Lt,this.matrixWorld=new Lt,this.matrixAutoUpdate=rn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=rn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new bd,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Gr.setFromAxisAngle(e,t),this.quaternion.multiply(Gr),this}rotateOnWorldAxis(e,t){return Gr.setFromAxisAngle(e,t),this.quaternion.premultiply(Gr),this}rotateX(e){return this.rotateOnAxis(Ah,e)}rotateY(e){return this.rotateOnAxis(Ch,e)}rotateZ(e){return this.rotateOnAxis(Ph,e)}translateOnAxis(e,t){return Th.copy(e).applyQuaternion(this.quaternion),this.position.add(Th.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Ah,e)}translateY(e){return this.translateOnAxis(Ch,e)}translateZ(e){return this.translateOnAxis(Ph,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Bi.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?Ra.copy(e):Ra.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),Fs.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Bi.lookAt(Fs,Ra,this.up):Bi.lookAt(Ra,Fs,this.up),this.quaternion.setFromRotationMatrix(Bi),r&&(Bi.extractRotation(r.matrixWorld),Gr.setFromRotationMatrix(Bi),this.quaternion.premultiply(Gr.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Tt("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Rh),Wr.child=e,this.dispatchEvent(Wr),Wr.child=null):Tt("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(qx),Rl.child=e,this.dispatchEvent(Rl),Rl.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Bi.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Bi.multiply(e.parent.matrixWorld)),e.applyMatrix4(Bi),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Rh),Wr.child=e,this.dispatchEvent(Wr),Wr.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){const a=this.children[i].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Fs,e,Xx),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Fs,jx,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,i=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*i-s[8]*r,s[13]+=i-s[1]*t-s[5]*i-s[9]*r,s[14]+=r-s[2]*t-s[6]*i-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c<d;c++){const f=l[c];s(e.shapes,f)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),d=a(e.images),f=a(e.shapes),h=a(e.skeletons),p=a(e.animations),m=a(e.nodes);o.length>0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),d.length>0&&(i.images=d),f.length>0&&(i.shapes=f),h.length>0&&(i.skeletons=h),p.length>0&&(i.animations=p),m.length>0&&(i.nodes=m)}return i.object=r,i;function a(o){const l=[];for(const c in o){const d=o[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}rn.DEFAULT_UP=new X(0,1,0);rn.DEFAULT_MATRIX_AUTO_UPDATE=!0;rn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let Qs=class extends rn{constructor(){super(),this.isGroup=!0,this.type="Group"}};const Yx={type:"move"};class Dl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Qs,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Qs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new X,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new X),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Qs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new X,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new X,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const x of e.hand.values()){const v=t.getJointPose(x,i),g=this._getHandJoint(c,x);v!==null&&(g.matrix.fromArray(v.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.matrixWorldNeedsUpdate=!0,g.jointRadius=v.radius),g.visible=v!==null}const d=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],h=d.position.distanceTo(f.position),p=.02,m=.005;c.inputState.pinching&&h>p+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=p-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Yx)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Qs;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const hm={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},er={h:0,s:0,l:0},Da={h:0,s:0,l:0};function Ll(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class tt{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Wn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,At.colorSpaceToWorking(this,t),this}setRGB(e,t,i,r=At.workingColorSpace){return this.r=e,this.g=t,this.b=i,At.colorSpaceToWorking(this,r),this}setHSL(e,t,i,r=At.workingColorSpace){if(e=_d(e,1),t=gt(t,0,1),i=gt(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=Ll(a,s,e+1/3),this.g=Ll(a,s,e),this.b=Ll(a,s,e-1/3)}return At.colorSpaceToWorking(this,r),this}setStyle(e,t=Wn){function i(s){s!==void 0&&parseFloat(s)<1&&ft("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:ft("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);ft("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Wn){const i=hm[e.toLowerCase()];return i!==void 0?this.setHex(i,t):ft("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=qi(e.r),this.g=qi(e.g),this.b=qi(e.b),this}copyLinearToSRGB(e){return this.r=Ss(e.r),this.g=Ss(e.g),this.b=Ss(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Wn){return At.workingToColorSpace(Nn.copy(this),e),Math.round(gt(Nn.r*255,0,255))*65536+Math.round(gt(Nn.g*255,0,255))*256+Math.round(gt(Nn.b*255,0,255))}getHexString(e=Wn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=At.workingColorSpace){At.workingToColorSpace(Nn.copy(this),t);const i=Nn.r,r=Nn.g,s=Nn.b,a=Math.max(i,r,s),o=Math.min(i,r,s);let l,c;const d=(o+a)/2;if(o===a)l=0,c=0;else{const f=a-o;switch(c=d<=.5?f/(a+o):f/(2-a-o),a){case i:l=(r-s)/f+(r<s?6:0);break;case r:l=(s-i)/f+2;break;case s:l=(i-r)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=d,e}getRGB(e,t=At.workingColorSpace){return At.workingToColorSpace(Nn.copy(this),t),e.r=Nn.r,e.g=Nn.g,e.b=Nn.b,e}getStyle(e=Wn){At.workingToColorSpace(Nn.copy(this),e);const t=Nn.r,i=Nn.g,r=Nn.b;return e!==Wn?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(er),this.setHSL(er.h+e,er.s+t,er.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(er),e.getHSL(Da);const i=ra(er.h,Da.h,t),r=ra(er.s,Da.s,t),s=ra(er.l,Da.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Nn=new tt;tt.NAMES=hm;class Kx extends rn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Xn,this.environmentIntensity=1,this.environmentRotation=new Xn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const fi=new X,ki=new X,Il=new X,Vi=new X,Xr=new X,jr=new X,Dh=new X,Nl=new X,Ul=new X,Fl=new X,Ol=new kt,zl=new kt,Bl=new kt;class ei{constructor(e=new X,t=new X,i=new X){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),fi.subVectors(e,t),r.cross(fi);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){fi.subVectors(r,t),ki.subVectors(i,t),Il.subVectors(e,t);const a=fi.dot(fi),o=fi.dot(ki),l=fi.dot(Il),c=ki.dot(ki),d=ki.dot(Il),f=a*c-o*o;if(f===0)return s.set(0,0,0),null;const h=1/f,p=(c*l-o*d)*h,m=(a*d-o*l)*h;return s.set(1-p-m,m,p)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,Vi)===null?!1:Vi.x>=0&&Vi.y>=0&&Vi.x+Vi.y<=1}static getInterpolation(e,t,i,r,s,a,o,l){return this.getBarycoord(e,t,i,r,Vi)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Vi.x),l.addScaledVector(a,Vi.y),l.addScaledVector(o,Vi.z),l)}static getInterpolatedAttribute(e,t,i,r,s,a){return Ol.setScalar(0),zl.setScalar(0),Bl.setScalar(0),Ol.fromBufferAttribute(e,t),zl.fromBufferAttribute(e,i),Bl.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Ol,s.x),a.addScaledVector(zl,s.y),a.addScaledVector(Bl,s.z),a}static isFrontFacing(e,t,i,r){return fi.subVectors(i,t),ki.subVectors(e,t),fi.cross(ki).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return fi.subVectors(this.c,this.b),ki.subVectors(this.a,this.b),fi.cross(ki).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ei.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ei.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return ei.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return ei.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ei.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let a,o;Xr.subVectors(r,i),jr.subVectors(s,i),Nl.subVectors(e,i);const l=Xr.dot(Nl),c=jr.dot(Nl);if(l<=0&&c<=0)return t.copy(i);Ul.subVectors(e,r);const d=Xr.dot(Ul),f=jr.dot(Ul);if(d>=0&&f<=d)return t.copy(r);const h=l*f-d*c;if(h<=0&&l>=0&&d<=0)return a=l/(l-d),t.copy(i).addScaledVector(Xr,a);Fl.subVectors(e,s);const p=Xr.dot(Fl),m=jr.dot(Fl);if(m>=0&&p<=m)return t.copy(s);const x=p*c-l*m;if(x<=0&&c>=0&&m<=0)return o=c/(c-m),t.copy(i).addScaledVector(jr,o);const v=d*m-p*f;if(v<=0&&f-d>=0&&p-m>=0)return Dh.subVectors(s,r),o=(f-d)/(f-d+(p-m)),t.copy(r).addScaledVector(Dh,o);const g=1/(v+x+h);return a=x*g,o=h*g,t.copy(i).addScaledVector(Xr,a).addScaledVector(jr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class di{constructor(e=new X(1/0,1/0,1/0),t=new X(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(pi.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(pi.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=pi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,pi):pi.fromBufferAttribute(s,a),pi.applyMatrix4(e.matrixWorld),this.expandByPoint(pi);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),La.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),La.copy(i.boundingBox)),La.applyMatrix4(e.matrixWorld),this.union(La)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,pi),pi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Os),Ia.subVectors(this.max,Os),qr.subVectors(e.a,Os),Yr.subVectors(e.b,Os),Kr.subVectors(e.c,Os),tr.subVectors(Yr,qr),nr.subVectors(Kr,Yr),vr.subVectors(qr,Kr);let t=[0,-tr.z,tr.y,0,-nr.z,nr.y,0,-vr.z,vr.y,tr.z,0,-tr.x,nr.z,0,-nr.x,vr.z,0,-vr.x,-tr.y,tr.x,0,-nr.y,nr.x,0,-vr.y,vr.x,0];return!kl(t,qr,Yr,Kr,Ia)||(t=[1,0,0,0,1,0,0,0,1],!kl(t,qr,Yr,Kr,Ia))?!1:(Na.crossVectors(tr,nr),t=[Na.x,Na.y,Na.z],kl(t,qr,Yr,Kr,Ia))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,pi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(pi).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Hi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Hi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Hi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Hi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Hi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Hi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Hi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Hi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Hi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Hi=[new X,new X,new X,new X,new X,new X,new X,new X],pi=new X,La=new di,qr=new X,Yr=new X,Kr=new X,tr=new X,nr=new X,vr=new X,Os=new X,Ia=new X,Na=new X,_r=new X;function kl(n,e,t,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){_r.fromArray(n,s);const o=r.x*Math.abs(_r.x)+r.y*Math.abs(_r.y)+r.z*Math.abs(_r.z),l=e.dot(_r),c=t.dot(_r),d=i.dot(_r);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const Xi=Zx();function Zx(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,d=0;for(;(c&8388608)===0;)c<<=1,d-=8388608;c&=-8388609,d+=947912704,s[l]=c|d}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}function $x(n){Math.abs(n)>65504&&ft("DataUtils.toHalfFloat(): Value out of range."),n=gt(n,-65504,65504),Xi.floatView[0]=n;const e=Xi.uint32View[0],t=e>>23&511;return Xi.baseTable[t]+((e&8388607)>>Xi.shiftTable[t])}function Jx(n){const e=n>>10;return Xi.uint32View[0]=Xi.mantissaTable[Xi.offsetTable[e]+(n&1023)]+Xi.exponentTable[e],Xi.floatView[0]}class Ua{static toHalfFloat(e){return $x(e)}static fromHalfFloat(e){return Jx(e)}}const mn=new X,Fa=new it;let Qx=0;class kn extends mr{constructor(e,t,i=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Qx++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=au,this.updateRanges=[],this.gpuType=ti,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Fa.fromBufferAttribute(this,t),Fa.applyMatrix3(e),this.setXY(t,Fa.x,Fa.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)mn.fromBufferAttribute(this,t),mn.applyMatrix3(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)mn.fromBufferAttribute(this,t),mn.applyMatrix4(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)mn.fromBufferAttribute(this,t),mn.applyNormalMatrix(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)mn.fromBufferAttribute(this,t),mn.transformDirection(e),this.setXYZ(t,mn.x,mn.y,mn.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=vi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Ot(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=vi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=vi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=vi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=vi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ot(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array),r=Ot(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array),r=Ot(r,this.array),s=Ot(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==au&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class fm extends kn{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class pm extends kn{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class sn extends kn{constructor(e,t,i){super(new Float32Array(e),t,i)}}const eb=new di,zs=new X,Vl=new X;class Ur{constructor(e=new X,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):eb.setFromPoints(e).getCenter(i);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;zs.subVectors(e,this.center);const t=zs.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(zs,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Vl.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(zs.copy(e.center).add(Vl)),this.expandByPoint(zs.copy(e.center).sub(Vl))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let tb=0;const ai=new Lt,Hl=new rn,Zr=new X,Jn=new di,Bs=new di,Sn=new X;class on extends mr{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:tb++}),this.uuid=ji(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(gx(e)?pm:fm)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new xt().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return ai.makeRotationFromQuaternion(e),this.applyMatrix4(ai),this}rotateX(e){return ai.makeRotationX(e),this.applyMatrix4(ai),this}rotateY(e){return ai.makeRotationY(e),this.applyMatrix4(ai),this}rotateZ(e){return ai.makeRotationZ(e),this.applyMatrix4(ai),this}translate(e,t,i){return ai.makeTranslation(e,t,i),this.applyMatrix4(ai),this}scale(e,t,i){return ai.makeScale(e,t,i),this.applyMatrix4(ai),this}lookAt(e){return Hl.lookAt(e),Hl.updateMatrix(),this.applyMatrix4(Hl.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Zr).negate(),this.translate(Zr.x,Zr.y,Zr.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const i=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];i.push(a.x,a.y,a.z||0)}this.setAttribute("position",new sn(i,3))}else{const i=Math.min(e.length,t.count);for(let r=0;r<i;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&ft("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new di);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Tt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new X(-1/0,-1/0,-1/0),new X(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];Jn.setFromBufferAttribute(s),this.morphTargetsRelative?(Sn.addVectors(this.boundingBox.min,Jn.min),this.boundingBox.expandByPoint(Sn),Sn.addVectors(this.boundingBox.max,Jn.max),this.boundingBox.expandByPoint(Sn)):(this.boundingBox.expandByPoint(Jn.min),this.boundingBox.expandByPoint(Jn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Tt('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ur);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Tt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new X,1/0);return}if(e){const i=this.boundingSphere.center;if(Jn.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Bs.setFromBufferAttribute(o),this.morphTargetsRelative?(Sn.addVectors(Jn.min,Bs.min),Jn.expandByPoint(Sn),Sn.addVectors(Jn.max,Bs.max),Jn.expandByPoint(Sn)):(Jn.expandByPoint(Bs.min),Jn.expandByPoint(Bs.max))}Jn.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;s++)Sn.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(Sn));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,d=o.count;c<d;c++)Sn.fromBufferAttribute(o,c),l&&(Zr.fromBufferAttribute(e,c),Sn.add(Zr)),r=Math.max(r,i.distanceToSquared(Sn))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Tt('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Tt("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new kn(new Float32Array(4*i.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let _=0;_<i.count;_++)o[_]=new X,l[_]=new X;const c=new X,d=new X,f=new X,h=new it,p=new it,m=new it,x=new X,v=new X;function g(_,T,D){c.fromBufferAttribute(i,_),d.fromBufferAttribute(i,T),f.fromBufferAttribute(i,D),h.fromBufferAttribute(s,_),p.fromBufferAttribute(s,T),m.fromBufferAttribute(s,D),d.sub(c),f.sub(c),p.sub(h),m.sub(h);const L=1/(p.x*m.y-m.x*p.y);isFinite(L)&&(x.copy(d).multiplyScalar(m.y).addScaledVector(f,-p.y).multiplyScalar(L),v.copy(f).multiplyScalar(p.x).addScaledVector(d,-m.x).multiplyScalar(L),o[_].add(x),o[T].add(x),o[D].add(x),l[_].add(v),l[T].add(v),l[D].add(v))}let y=this.groups;y.length===0&&(y=[{start:0,count:e.count}]);for(let _=0,T=y.length;_<T;++_){const D=y[_],L=D.start,F=D.count;for(let B=L,U=L+F;B<U;B+=3)g(e.getX(B+0),e.getX(B+1),e.getX(B+2))}const w=new X,b=new X,E=new X,S=new X;function A(_){E.fromBufferAttribute(r,_),S.copy(E);const T=o[_];w.copy(T),w.sub(E.multiplyScalar(E.dot(T))).normalize(),b.crossVectors(S,T);const L=b.dot(l[_])<0?-1:1;a.setXYZW(_,w.x,w.y,w.z,L)}for(let _=0,T=y.length;_<T;++_){const D=y[_],L=D.start,F=D.count;for(let B=L,U=L+F;B<U;B+=3)A(e.getX(B+0)),A(e.getX(B+1)),A(e.getX(B+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new kn(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let h=0,p=i.count;h<p;h++)i.setXYZ(h,0,0,0);const r=new X,s=new X,a=new X,o=new X,l=new X,c=new X,d=new X,f=new X;if(e)for(let h=0,p=e.count;h<p;h+=3){const m=e.getX(h+0),x=e.getX(h+1),v=e.getX(h+2);r.fromBufferAttribute(t,m),s.fromBufferAttribute(t,x),a.fromBufferAttribute(t,v),d.subVectors(a,s),f.subVectors(r,s),d.cross(f),o.fromBufferAttribute(i,m),l.fromBufferAttribute(i,x),c.fromBufferAttribute(i,v),o.add(d),l.add(d),c.add(d),i.setXYZ(m,o.x,o.y,o.z),i.setXYZ(x,l.x,l.y,l.z),i.setXYZ(v,c.x,c.y,c.z)}else for(let h=0,p=t.count;h<p;h+=3)r.fromBufferAttribute(t,h+0),s.fromBufferAttribute(t,h+1),a.fromBufferAttribute(t,h+2),d.subVectors(a,s),f.subVectors(r,s),d.cross(f),i.setXYZ(h+0,d.x,d.y,d.z),i.setXYZ(h+1,d.x,d.y,d.z),i.setXYZ(h+2,d.x,d.y,d.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Sn.fromBufferAttribute(e,t),Sn.normalize(),e.setXYZ(t,Sn.x,Sn.y,Sn.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,f=o.normalized,h=new c.constructor(l.length*d);let p=0,m=0;for(let x=0,v=l.length;x<v;x++){o.isInterleavedBufferAttribute?p=l[x]*o.data.stride+o.offset:p=l[x]*d;for(let g=0;g<d;g++)h[m++]=c[p++]}return new kn(h,d,f)}if(this.index===null)return ft("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new on,i=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,i);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let d=0,f=c.length;d<f;d++){const h=c[d],p=e(h,i);l.push(p)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let f=0,h=c.length;f<h;f++){const p=c[f];d.push(p.toJSON(e.data))}d.length>0&&(r[l]=d,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone());const r=e.attributes;for(const c in r){const d=r[c];this.setAttribute(c,d.clone(t))}const s=e.morphAttributes;for(const c in s){const d=[],f=s[c];for(let h=0,p=f.length;h<p;h++)d.push(f[h].clone(t));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,d=a.length;c<d;c++){const f=a[c];this.addGroup(f.start,f.count,f.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class mm{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=au,this.updateRanges=[],this.version=0,this.uuid=ji()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=ji()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=ji()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const On=new X;class Ui{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)On.fromBufferAttribute(this,t),On.applyMatrix4(e),this.setXYZ(t,On.x,On.y,On.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)On.fromBufferAttribute(this,t),On.applyNormalMatrix(e),this.setXYZ(t,On.x,On.y,On.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)On.fromBufferAttribute(this,t),On.transformDirection(e),this.setXYZ(t,On.x,On.y,On.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=vi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Ot(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=vi(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=vi(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=vi(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=vi(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array),r=Ot(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ot(t,this.array),i=Ot(i,this.array),r=Ot(r,this.array),s=Ot(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){jo("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new kn(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Ui(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){jo("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}let nb=0;class yi extends mr{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:nb++}),this.uuid=ji(),this.name="",this.type="Material",this.blending=bs,this.side=Kn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=_c,this.blendDst=xc,this.blendEquation=gi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new tt(0,0,0),this.blendAlpha=0,this.depthFunc=ws,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=vh,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=kr,this.stencilZFail=kr,this.stencilZPass=kr,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){ft(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){ft(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==bs&&(i.blending=this.blending),this.side!==Kn&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==_c&&(i.blendSrc=this.blendSrc),this.blendDst!==xc&&(i.blendDst=this.blendDst),this.blendEquation!==gi&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==ws&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==vh&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==kr&&(i.stencilFail=this.stencilFail),this.stencilZFail!==kr&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==kr&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.allowOverride===!1&&(i.allowOverride=!1),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class gm extends yi{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new tt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let $r;const ks=new X,Jr=new X,Qr=new X,es=new it,Vs=new it,vm=new Lt,Oa=new X,Hs=new X,za=new X,Lh=new it,Gl=new it,Ih=new it;class ts extends rn{constructor(e=new gm){if(super(),this.isSprite=!0,this.type="Sprite",$r===void 0){$r=new on;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new mm(t,5);$r.setIndex([0,1,2,0,2,3]),$r.setAttribute("position",new Ui(i,3,0,!1)),$r.setAttribute("uv",new Ui(i,2,3,!1))}this.geometry=$r,this.material=e,this.center=new it(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Tt('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Jr.setFromMatrixScale(this.matrixWorld),vm.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Qr.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Jr.multiplyScalar(-Qr.z);const i=this.material.rotation;let r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));const a=this.center;Ba(Oa.set(-.5,-.5,0),Qr,a,Jr,r,s),Ba(Hs.set(.5,-.5,0),Qr,a,Jr,r,s),Ba(za.set(.5,.5,0),Qr,a,Jr,r,s),Lh.set(0,0),Gl.set(1,0),Ih.set(1,1);let o=e.ray.intersectTriangle(Oa,Hs,za,!1,ks);if(o===null&&(Ba(Hs.set(-.5,.5,0),Qr,a,Jr,r,s),Gl.set(0,1),o=e.ray.intersectTriangle(Oa,za,Hs,!1,ks),o===null))return;const l=e.ray.origin.distanceTo(ks);l<e.near||l>e.far||t.push({distance:l,point:ks.clone(),uv:ei.getInterpolation(ks,Oa,Hs,za,Lh,Gl,Ih,new it),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Ba(n,e,t,i,r,s){es.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(Vs.x=s*es.x-r*es.y,Vs.y=r*es.x+s*es.y):Vs.copy(es),n.copy(e),n.x+=Vs.x,n.y+=Vs.y,n.applyMatrix4(vm)}const Gi=new X,Wl=new X,ka=new X,ir=new X,Xl=new X,Va=new X,jl=new X;class ba{constructor(e=new X,t=new X(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Gi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Gi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Gi.copy(this.origin).addScaledVector(this.direction,t),Gi.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Wl.copy(e).add(t).multiplyScalar(.5),ka.copy(t).sub(e).normalize(),ir.copy(this.origin).sub(Wl);const s=e.distanceTo(t)*.5,a=-this.direction.dot(ka),o=ir.dot(this.direction),l=-ir.dot(ka),c=ir.lengthSq(),d=Math.abs(1-a*a);let f,h,p,m;if(d>0)if(f=a*l-o,h=a*o-l,m=s*d,f>=0)if(h>=-m)if(h<=m){const x=1/d;f*=x,h*=x,p=f*(f+a*h+2*o)+h*(a*f+h+2*l)+c}else h=s,f=Math.max(0,-(a*h+o)),p=-f*f+h*(h+2*l)+c;else h=-s,f=Math.max(0,-(a*h+o)),p=-f*f+h*(h+2*l)+c;else h<=-m?(f=Math.max(0,-(-a*s+o)),h=f>0?-s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c):h<=m?(f=0,h=Math.min(Math.max(-s,-l),s),p=h*(h+2*l)+c):(f=Math.max(0,-(a*s+o)),h=f>0?s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c);else h=a>0?-s:s,f=Math.max(0,-(a*h+o)),p=-f*f+h*(h+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(Wl).addScaledVector(ka,h),p}intersectSphere(e,t){Gi.subVectors(e.center,this.origin);const i=Gi.dot(this.direction),r=Gi.dot(Gi)-i*i,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=i-a,l=i+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,o,l;const c=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,h=this.origin;return c>=0?(i=(e.min.x-h.x)*c,r=(e.max.x-h.x)*c):(i=(e.max.x-h.x)*c,r=(e.min.x-h.x)*c),d>=0?(s=(e.min.y-h.y)*d,a=(e.max.y-h.y)*d):(s=(e.max.y-h.y)*d,a=(e.min.y-h.y)*d),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),f>=0?(o=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(o=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),i>l||o>r)||((o>i||i!==i)&&(i=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Gi)!==null}intersectTriangle(e,t,i,r,s){Xl.subVectors(t,e),Va.subVectors(i,e),jl.crossVectors(Xl,Va);let a=this.direction.dot(jl),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;ir.subVectors(this.origin,e);const l=o*this.direction.dot(Va.crossVectors(ir,Va));if(l<0)return null;const c=o*this.direction.dot(Xl.cross(ir));if(c<0||l+c>a)return null;const d=-o*ir.dot(jl);return d<0?null:this.at(d/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class yd extends yi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new tt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Xn,this.combine=em,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Nh=new Lt,xr=new ba,Ha=new Ur,Uh=new X,Ga=new X,Wa=new X,Xa=new X,ql=new X,ja=new X,Fh=new X,qa=new X;class an extends rn{constructor(e=new on,t=new yd){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){ja.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const d=o[l],f=s[l];d!==0&&(ql.fromBufferAttribute(f,e),a?ja.addScaledVector(ql,d):ja.addScaledVector(ql.sub(t),d))}t.add(ja)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Ha.copy(i.boundingSphere),Ha.applyMatrix4(s),xr.copy(e.ray).recast(e.near),!(Ha.containsPoint(xr.origin)===!1&&(xr.intersectSphere(Ha,Uh)===null||xr.origin.distanceToSquared(Uh)>(e.far-e.near)**2))&&(Nh.copy(s).invert(),xr.copy(e.ray).applyMatrix4(Nh),!(i.boundingBox!==null&&xr.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,xr)))}_computeIntersections(e,t,i){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,f=s.attributes.normal,h=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let m=0,x=h.length;m<x;m++){const v=h[m],g=a[v.materialIndex],y=Math.max(v.start,p.start),w=Math.min(o.count,Math.min(v.start+v.count,p.start+p.count));for(let b=y,E=w;b<E;b+=3){const S=o.getX(b),A=o.getX(b+1),_=o.getX(b+2);r=Ya(this,g,e,i,c,d,f,S,A,_),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=v.materialIndex,t.push(r))}}else{const m=Math.max(0,p.start),x=Math.min(o.count,p.start+p.count);for(let v=m,g=x;v<g;v+=3){const y=o.getX(v),w=o.getX(v+1),b=o.getX(v+2);r=Ya(this,a,e,i,c,d,f,y,w,b),r&&(r.faceIndex=Math.floor(v/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let m=0,x=h.length;m<x;m++){const v=h[m],g=a[v.materialIndex],y=Math.max(v.start,p.start),w=Math.min(l.count,Math.min(v.start+v.count,p.start+p.count));for(let b=y,E=w;b<E;b+=3){const S=b,A=b+1,_=b+2;r=Ya(this,g,e,i,c,d,f,S,A,_),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=v.materialIndex,t.push(r))}}else{const m=Math.max(0,p.start),x=Math.min(l.count,p.start+p.count);for(let v=m,g=x;v<g;v+=3){const y=v,w=v+1,b=v+2;r=Ya(this,a,e,i,c,d,f,y,w,b),r&&(r.faceIndex=Math.floor(v/3),t.push(r))}}}}function ib(n,e,t,i,r,s,a,o){let l;if(e.side===Yn?l=i.intersectTriangle(a,s,r,!0,o):l=i.intersectTriangle(r,s,a,e.side===Kn,o),l===null)return null;qa.copy(o),qa.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(qa);return c<t.near||c>t.far?null:{distance:c,point:qa.clone(),object:n}}function Ya(n,e,t,i,r,s,a,o,l,c){n.getVertexPosition(o,Ga),n.getVertexPosition(l,Wa),n.getVertexPosition(c,Xa);const d=ib(n,e,t,i,Ga,Wa,Xa,Fh);if(d){const f=new X;ei.getBarycoord(Fh,Ga,Wa,Xa,f),r&&(d.uv=ei.getInterpolatedAttribute(r,o,l,c,f,new it)),s&&(d.uv1=ei.getInterpolatedAttribute(s,o,l,c,f,new it)),a&&(d.normal=ei.getInterpolatedAttribute(a,o,l,c,f,new X),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));const h={a:o,b:l,c,normal:new X,materialIndex:0};ei.getNormal(Ga,Wa,Xa,h.normal),d.face=h,d.barycoord=f}return d}class cl extends En{constructor(e=null,t=1,i=1,r,s,a,o,l,c=xn,d=xn,f,h){super(null,a,o,l,c,d,r,s,f,h),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Yl=new X,rb=new X,sb=new xt;class sr{constructor(e=new X(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=Yl.subVectors(i,t).cross(rb.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,i=!0){const r=e.delta(Yl),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/s;return i===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||sb.getNormalMatrix(e),r=this.coplanarPoint(Yl).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const br=new Ur,ab=new it(.5,.5),Ka=new X;class Sd{constructor(e=new sr,t=new sr,i=new sr,r=new sr,s=new sr,a=new sr){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Ni,i=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],d=s[4],f=s[5],h=s[6],p=s[7],m=s[8],x=s[9],v=s[10],g=s[11],y=s[12],w=s[13],b=s[14],E=s[15];if(r[0].setComponents(c-a,p-d,g-m,E-y).normalize(),r[1].setComponents(c+a,p+d,g+m,E+y).normalize(),r[2].setComponents(c+o,p+f,g+x,E+w).normalize(),r[3].setComponents(c-o,p-f,g-x,E-w).normalize(),i)r[4].setComponents(l,h,v,b).normalize(),r[5].setComponents(c-l,p-h,g-v,E-b).normalize();else if(r[4].setComponents(c-l,p-h,g-v,E-b).normalize(),t===Ni)r[5].setComponents(c+l,p+h,g+v,E+b).normalize();else if(t===la)r[5].setComponents(l,h,v,b).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),br.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),br.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(br)}intersectsSprite(e){br.center.set(0,0,0);const t=ab.distanceTo(e.center);return br.radius=.7071067811865476+t,br.applyMatrix4(e.matrixWorld),this.intersectsSphere(br)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(Ka.x=r.normal.x>0?e.max.x:e.min.x,Ka.y=r.normal.y>0?e.max.y:e.min.y,Ka.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Ka)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class ob extends yi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new tt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const qo=new X,Yo=new X,Oh=new Lt,Gs=new ba,Za=new Ur,Kl=new X,zh=new X;class lb extends rn{constructor(e=new on,t=new ob){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)qo.fromBufferAttribute(t,r-1),Yo.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=qo.distanceTo(Yo);e.setAttribute("lineDistance",new sn(i,1))}else ft("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Za.copy(i.boundingSphere),Za.applyMatrix4(r),Za.radius+=s,e.ray.intersectsSphere(Za)===!1)return;Oh.copy(r).invert(),Gs.copy(e.ray).applyMatrix4(Oh);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,d=i.index,h=i.attributes.position;if(d!==null){const p=Math.max(0,a.start),m=Math.min(d.count,a.start+a.count);for(let x=p,v=m-1;x<v;x+=c){const g=d.getX(x),y=d.getX(x+1),w=$a(this,e,Gs,l,g,y,x);w&&t.push(w)}if(this.isLineLoop){const x=d.getX(m-1),v=d.getX(p),g=$a(this,e,Gs,l,x,v,m-1);g&&t.push(g)}}else{const p=Math.max(0,a.start),m=Math.min(h.count,a.start+a.count);for(let x=p,v=m-1;x<v;x+=c){const g=$a(this,e,Gs,l,x,x+1,x);g&&t.push(g)}if(this.isLineLoop){const x=$a(this,e,Gs,l,m-1,p,m-1);x&&t.push(x)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function $a(n,e,t,i,r,s,a){const o=n.geometry.attributes.position;if(qo.fromBufferAttribute(o,r),Yo.fromBufferAttribute(o,s),t.distanceSqToSegment(qo,Yo,Kl,zh)>i)return;Kl.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(Kl);if(!(c<e.near||c>e.far))return{distance:c,point:zh.clone().applyMatrix4(n.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:n}}class Ko extends yi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new tt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Bh=new Lt,lu=new ba,Ja=new Ur,Qa=new X;class Zo extends rn{constructor(e=new on,t=new Ko){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Ja.copy(i.boundingSphere),Ja.applyMatrix4(r),Ja.radius+=s,e.ray.intersectsSphere(Ja)===!1)return;Bh.copy(r).invert(),lu.copy(e.ray).applyMatrix4(Bh);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=i.index,f=i.attributes.position;if(c!==null){const h=Math.max(0,a.start),p=Math.min(c.count,a.start+a.count);for(let m=h,x=p;m<x;m++){const v=c.getX(m);Qa.fromBufferAttribute(f,v),kh(Qa,v,l,r,e,t,this)}}else{const h=Math.max(0,a.start),p=Math.min(f.count,a.start+a.count);for(let m=h,x=p;m<x;m++)Qa.fromBufferAttribute(f,m),kh(Qa,m,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function kh(n,e,t,i,r,s,a){const o=lu.distanceSqToPoint(n);if(o<t){const l=new X;lu.closestPointToPoint(n,l),l.applyMatrix4(i);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class _m extends En{constructor(e=[],t=Dr,i,r,s,a,o,l,c,d){super(e,t,i,r,s,a,o,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class cb extends En{constructor(e,t,i,r,s,a,o,l,c){super(e,t,i,r,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Nr extends En{constructor(e,t,i=Oi,r,s,a,o=xn,l=xn,c,d=Yi,f=1){if(d!==Yi&&d!==cr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const h={width:e,height:t,depth:f};super(h,r,s,a,o,l,d,i,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new xd(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class ub extends Nr{constructor(e,t=Oi,i=Dr,r,s,a=xn,o=xn,l,c=Yi){const d={width:e,height:e,depth:1},f=[d,d,d,d,d,d];super(e,e,t,i,r,s,a,o,l,c),this.image=f,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class xm extends En{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class ya extends on{constructor(e=1,t=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],d=[],f=[];let h=0,p=0;m("z","y","x",-1,-1,i,t,e,a,s,0),m("z","y","x",1,-1,i,t,-e,a,s,1),m("x","z","y",1,1,e,i,t,r,a,2),m("x","z","y",1,-1,e,i,-t,r,a,3),m("x","y","z",1,-1,e,t,i,r,s,4),m("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new sn(c,3)),this.setAttribute("normal",new sn(d,3)),this.setAttribute("uv",new sn(f,2));function m(x,v,g,y,w,b,E,S,A,_,T){const D=b/A,L=E/_,F=b/2,B=E/2,U=S/2,N=A+1,R=_+1;let O=0,Y=0;const K=new X;for(let ne=0;ne<R;ne++){const ce=ne*L-B;for(let k=0;k<N;k++){const te=k*D-F;K[x]=te*y,K[v]=ce*w,K[g]=U,c.push(K.x,K.y,K.z),K[x]=0,K[v]=0,K[g]=S>0?1:-1,d.push(K.x,K.y,K.z),f.push(k/A),f.push(1-ne/_),O+=1}}for(let ne=0;ne<_;ne++)for(let ce=0;ce<A;ce++){const k=h+ce+N*ne,te=h+ce+N*(ne+1),fe=h+(ce+1)+N*(ne+1),me=h+(ce+1)+N*ne;l.push(k,te,me),l.push(te,fe,me),Y+=6}o.addGroup(p,Y,T),p+=Y,h+=O}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ya(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Md extends on{constructor(e=1,t=1,i=1,r=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const d=[],f=[],h=[],p=[];let m=0;const x=[],v=i/2;let g=0;y(),a===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(d),this.setAttribute("position",new sn(f,3)),this.setAttribute("normal",new sn(h,3)),this.setAttribute("uv",new sn(p,2));function y(){const b=new X,E=new X;let S=0;const A=(t-e)/i;for(let _=0;_<=s;_++){const T=[],D=_/s,L=D*(t-e)+e;for(let F=0;F<=r;F++){const B=F/r,U=B*l+o,N=Math.sin(U),R=Math.cos(U);E.x=L*N,E.y=-D*i+v,E.z=L*R,f.push(E.x,E.y,E.z),b.set(N,A,R).normalize(),h.push(b.x,b.y,b.z),p.push(B,1-D),T.push(m++)}x.push(T)}for(let _=0;_<r;_++)for(let T=0;T<s;T++){const D=x[T][_],L=x[T+1][_],F=x[T+1][_+1],B=x[T][_+1];(e>0||T!==0)&&(d.push(D,L,B),S+=3),(t>0||T!==s-1)&&(d.push(L,F,B),S+=3)}c.addGroup(g,S,0),g+=S}function w(b){const E=m,S=new it,A=new X;let _=0;const T=b===!0?e:t,D=b===!0?1:-1;for(let F=1;F<=r;F++)f.push(0,v*D,0),h.push(0,D,0),p.push(.5,.5),m++;const L=m;for(let F=0;F<=r;F++){const U=F/r*l+o,N=Math.cos(U),R=Math.sin(U);A.x=T*R,A.y=v*D,A.z=T*N,f.push(A.x,A.y,A.z),h.push(0,D,0),S.x=N*.5+.5,S.y=R*.5*D+.5,p.push(S.x,S.y),m++}for(let F=0;F<r;F++){const B=E+F,U=L+F;b===!0?d.push(U,U+1,B):d.push(U+1,U,B),_+=3}c.addGroup(g,_,b===!0?1:2),g+=_}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Md(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}const eo=new X,to=new X,Zl=new X,no=new ei;class db extends on{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(ys*t),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],d=["a","b","c"],f=new Array(3),h={},p=[];for(let m=0;m<l;m+=3){a?(c[0]=a.getX(m),c[1]=a.getX(m+1),c[2]=a.getX(m+2)):(c[0]=m,c[1]=m+1,c[2]=m+2);const{a:x,b:v,c:g}=no;if(x.fromBufferAttribute(o,c[0]),v.fromBufferAttribute(o,c[1]),g.fromBufferAttribute(o,c[2]),no.getNormal(Zl),f[0]=`${Math.round(x.x*r)},${Math.round(x.y*r)},${Math.round(x.z*r)}`,f[1]=`${Math.round(v.x*r)},${Math.round(v.y*r)},${Math.round(v.z*r)}`,f[2]=`${Math.round(g.x*r)},${Math.round(g.y*r)},${Math.round(g.z*r)}`,!(f[0]===f[1]||f[1]===f[2]||f[2]===f[0]))for(let y=0;y<3;y++){const w=(y+1)%3,b=f[y],E=f[w],S=no[d[y]],A=no[d[w]],_=`${b}_${E}`,T=`${E}_${b}`;T in h&&h[T]?(Zl.dot(h[T].normal)<=s&&(p.push(S.x,S.y,S.z),p.push(A.x,A.y,A.z)),h[T]=null):_ in h||(h[_]={index0:c[y],index1:c[w],normal:Zl.clone()})}}for(const m in h)if(h[m]){const{index0:x,index1:v}=h[m];eo.fromBufferAttribute(o,x),to.fromBufferAttribute(o,v),p.push(eo.x,eo.y,eo.z),p.push(to.x,to.y,to.z)}this.setAttribute("position",new sn(p,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Ds extends on{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(i),l=Math.floor(r),c=o+1,d=l+1,f=e/o,h=t/l,p=[],m=[],x=[],v=[];for(let g=0;g<d;g++){const y=g*h-a;for(let w=0;w<c;w++){const b=w*f-s;m.push(b,-y,0),x.push(0,0,1),v.push(w/o),v.push(1-g/l)}}for(let g=0;g<l;g++)for(let y=0;y<o;y++){const w=y+c*g,b=y+c*(g+1),E=y+1+c*(g+1),S=y+1+c*g;p.push(w,b,S),p.push(b,E,S)}this.setIndex(p),this.setAttribute("position",new sn(m,3)),this.setAttribute("normal",new sn(x,3)),this.setAttribute("uv",new sn(v,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ds(e.width,e.height,e.widthSegments,e.heightSegments)}}class hb extends on{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new X,s=new X;if(e.index!==null){const a=e.attributes.position,o=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,d=l.length;c<d;++c){const f=l[c],h=f.start,p=f.count;for(let m=h,x=h+p;m<x;m+=3)for(let v=0;v<3;v++){const g=o.getX(m+v),y=o.getX(m+(v+1)%3);r.fromBufferAttribute(a,g),s.fromBufferAttribute(a,y),Vh(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const d=3*o+c,f=3*o+(c+1)%3;r.fromBufferAttribute(a,d),s.fromBufferAttribute(a,f),Vh(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new sn(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Vh(n,e,t){const i=`${n.x},${n.y},${n.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${n.x},${n.y},${n.z}`;return t.has(i)===!0||t.has(r)===!0?!1:(t.add(i),t.add(r),!0)}function As(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];if(Hh(r))r.isRenderTargetTexture?(ft("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone();else if(Array.isArray(r))if(Hh(r[0])){const s=[];for(let a=0,o=r.length;a<o;a++)s[a]=r[a].clone();e[t][i]=s}else e[t][i]=r.slice();else e[t][i]=r}}return e}function zn(n){const e={};for(let t=0;t<n.length;t++){const i=As(n[t]);for(const r in i)e[r]=i[r]}return e}function Hh(n){return n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)}function fb(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function bm(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:At.workingColorSpace}const Di={clone:As,merge:zn};var pb=`void main() {
2
2
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3
3
  }`,mb=`void main() {
4
4
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
@@ -5018,4 +5018,4 @@ void main() {
5018
5018
  ${u(d)??""}`},children:(f,h)=>{var p=we(),m=ee(p);{var x=w=>{var b=U2(),E=ee(b);Uu(E,{class:"h-4 w-4 animate-spin"});var S=ae(E);Me(()=>Ae(S,` ${u(i).solvingEllipsis??""}`)),P(w,b)},v=w=>{var b=F2(),E=ee(b);Cv(E,{class:"h-4 w-4"});var S=ae(E);Me(()=>Ae(S,` ${u(i).pressToCalculate??""}`)),P(w,b)},g=w=>{var b=O2(),E=ee(b);l0(E,{class:"h-4 w-4"});var S=ae(E);Me(()=>Ae(S,` ${u(i).calculate??""}`)),P(w,b)},y=w=>{var b=z2(),E=ee(b);ia(E,{class:"h-4 w-4"});var S=ae(E);Me(()=>Ae(S,` ${u(i).upToDate??""}`)),P(w,b)};xe(m,w=>{e.isSolving?w(x):r()?w(v,1):e.hasPendingChanges?w(g,2):w(y,-1)})}P(f,p)},$$slots:{default:!0}})}q(s),P(n,s),at()}var k2=Z('<div class="bottom-6 left-6 gap-3 px-5 py-3 shadow-xl fixed z-50 flex animate-[selva-slideInLeft_0.2s_ease-out] items-center rounded-lg border border-primary/20 bg-primary text-primary-foreground svelte-g866ul"><div class="h-5 w-5 relative flex shrink-0 items-center justify-center svelte-g866ul"><div class="animate-ping absolute h-full w-full rounded-full bg-primary-foreground opacity-30 svelte-g866ul"></div> <div class="h-3 w-3 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent svelte-g866ul"></div></div> <div class="leading-tight flex flex-col svelte-g866ul"><span class="text-sm font-semibold svelte-g866ul"> </span> <span class="text-xs opacity-70 svelte-g866ul"> </span></div></div>');function V2(n,e){st(e,!0);const t=Si(),i=z(()=>t.messages);var r=we(),s=ee(r);{var a=o=>{var l=k2(),c=ae($(l),2),d=$(c),f=$(d,!0);q(d);var h=ae(d,2),p=$(h,!0);q(h),q(c),q(l),Me(()=>{Ae(f,u(i).solving),Ae(p,u(i).solvingSubtitle)}),P(o,l)};xe(s,o=>{e.show&&o(a)})}P(n,r),at()}var H2=Z("<div><!></div>");function G2(n,e){st(e,!0);let t=le(e,"ref",15,null),i=ut(e,["$$slots","$$events","$$legacy","ref","class","children"]);var r=H2();Ft(r,a=>({"data-slot":"card-action",class:a,...i}),[()=>ci("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e.class)]);var s=$(r);pt(s,()=>e.children??wt),q(r),ui(r,a=>t(a),()=>t()),P(n,r),at()}var W2=Z("<!> <!>",1);function Kf(n,e){st(e,!0);let t=le(e,"ref",15,null),i=le(e,"orientation",3,"vertical"),r=ut(e,["$$slots","$$events","$$legacy","ref","class","orientation","children"]);var s=we(),a=ee(s);{let o=z(()=>ci("flex touch-none p-px transition-colors select-none",i()==="vertical"&&"w-2.5 h-full border-s border-s-transparent",i()==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e.class));Ne(a,()=>q0,(l,c)=>{c(l,mt({"data-slot":"scroll-area-scrollbar",get orientation(){return i()},get class(){return u(o)}},()=>r,{get ref(){return t()},set ref(d){t(d)},children:(d,f)=>{var h=W2(),p=ee(h);pt(p,()=>e.children??wt);var m=ae(p,2);Ne(m,()=>Z0,(x,v)=>{v(x,{"data-slot":"scroll-area-thumb",class:"relative flex-1 rounded-full bg-border"})}),P(d,h)},$$slots:{default:!0}}))})}P(n,s),at()}var X2=Z("<!> <!> <!> <!>",1);function gg(n,e){st(e,!0);let t=le(e,"ref",15,null),i=le(e,"viewportRef",15,null),r=le(e,"orientation",3,"vertical"),s=le(e,"scrollbarXClasses",3,""),a=le(e,"scrollbarYClasses",3,""),o=ut(e,["$$slots","$$events","$$legacy","ref","viewportRef","class","orientation","scrollbarXClasses","scrollbarYClasses","children"]);var l=we(),c=ee(l);{let d=z(()=>ci("relative",e.class));Ne(c,()=>z0,(f,h)=>{h(f,mt({"data-slot":"scroll-area",get class(){return u(d)}},()=>o,{get ref(){return t()},set ref(p){t(p)},children:(p,m)=>{var x=X2(),v=ee(x);Ne(v,()=>k0,(S,A)=>{A(S,{"data-slot":"scroll-area-viewport",class:"size-full rounded-[inherit] ring-ring/10 outline-ring/50 transition-[color,box-shadow] focus-visible:ring-4 focus-visible:outline-1 dark:ring-ring/20 dark:outline-ring/40",get ref(){return i()},set ref(_){i(_)},children:(_,T)=>{var D=we(),L=ee(D);pt(L,()=>e.children??wt),P(_,D)},$$slots:{default:!0}})});var g=ae(v,2);{var y=S=>{Kf(S,{orientation:"vertical",get class(){return a()}})};xe(g,S=>{(r()==="vertical"||r()==="both")&&S(y)})}var w=ae(g,2);{var b=S=>{Kf(S,{orientation:"horizontal",get class(){return s()}})};xe(w,S=>{(r()==="horizontal"||r()==="both")&&S(b)})}var E=ae(w,2);Ne(E,()=>Q0,(S,A)=>{A(S,{})}),P(p,x)},$$slots:{default:!0}}))})}P(n,l),at()}const vg=/^[a-z0-9]+(-[a-z0-9]+)*$/,ml=(n,e,t,i="")=>{const r=n.split(":");if(n.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;i=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const o=r.pop(),l=r.pop(),c={provider:r.length>0?r[0]:i,prefix:l,name:o};return e&&!Lo(c)?null:c}const s=r[0],a=s.split("-");if(a.length>1){const o={provider:i,prefix:a.shift(),name:a.join("-")};return e&&!Lo(o)?null:o}if(t&&i===""){const o={provider:i,prefix:"",name:s};return e&&!Lo(o,t)?null:o}return null},Lo=(n,e)=>n?!!((e&&n.prefix===""||n.prefix)&&n.name):!1;function j2(n,e){const t=n.icons,i=n.aliases||Object.create(null),r=Object.create(null);function s(a){if(t[a])return r[a]=[];if(!(a in r)){r[a]=null;const o=i[a]&&i[a].parent,l=o&&s(o);l&&(r[a]=[o].concat(l))}return r[a]}return Object.keys(t).concat(Object.keys(i)).forEach(s),r}const _g=Object.freeze({left:0,top:0,width:16,height:16}),Jo=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),gl=Object.freeze({..._g,...Jo}),bu=Object.freeze({...gl,body:"",hidden:!1});function q2(n,e){const t={};!n.hFlip!=!e.hFlip&&(t.hFlip=!0),!n.vFlip!=!e.vFlip&&(t.vFlip=!0);const i=((n.rotate||0)+(e.rotate||0))%4;return i&&(t.rotate=i),t}function Zf(n,e){const t=q2(n,e);for(const i in bu)i in Jo?i in n&&!(i in t)&&(t[i]=Jo[i]):i in e?t[i]=e[i]:i in n&&(t[i]=n[i]);return t}function Y2(n,e,t){const i=n.icons,r=n.aliases||Object.create(null);let s={};function a(o){s=Zf(i[o]||r[o],s)}return a(e),t.forEach(a),Zf(n,s)}function xg(n,e){const t=[];if(typeof n!="object"||typeof n.icons!="object")return t;n.not_found instanceof Array&&n.not_found.forEach(r=>{e(r,null),t.push(r)});const i=j2(n);for(const r in i){const s=i[r];s&&(e(r,Y2(n,r,s)),t.push(r))}return t}const K2={provider:"",aliases:{},not_found:{},..._g};function hc(n,e){for(const t in e)if(t in n&&typeof n[t]!=typeof e[t])return!1;return!0}function bg(n){if(typeof n!="object"||n===null)return null;const e=n;if(typeof e.prefix!="string"||!n.icons||typeof n.icons!="object"||!hc(n,K2))return null;const t=e.icons;for(const r in t){const s=t[r];if(!r||typeof s.body!="string"||!hc(s,bu))return null}const i=e.aliases||Object.create(null);for(const r in i){const s=i[r],a=s.parent;if(!r||typeof a!="string"||!t[a]&&!i[a]||!hc(s,bu))return null}return e}const $f=Object.create(null);function Z2(n,e){return{provider:n,prefix:e,icons:Object.create(null),missing:new Set}}function Cs(n,e){const t=$f[n]||($f[n]=Object.create(null));return t[e]||(t[e]=Z2(n,e))}function yg(n,e){return bg(e)?xg(e,(t,i)=>{i?n.icons[t]=i:n.missing.add(t)}):[]}function $2(n,e,t){try{if(typeof t.body=="string")return n.icons[e]={...t},!0}catch{}return!1}let pa=!1;function Sg(n){return typeof n=="boolean"&&(pa=n),pa}function J2(n){const e=typeof n=="string"?ml(n,!0,pa):n;if(e){const t=Cs(e.provider,e.prefix),i=e.name;return t.icons[i]||(t.missing.has(i)?null:void 0)}}function Q2(n,e){const t=ml(n,!0,pa);if(!t)return!1;const i=Cs(t.provider,t.prefix);return e?$2(i,t.name,e):(i.missing.add(t.name),!0)}function eC(n,e){if(typeof n!="object")return!1;if(typeof e!="string"&&(e=n.provider||""),pa&&!e&&!n.prefix){let i=!1;return bg(n)&&(n.prefix="",xg(n,(r,s)=>{Q2(r,s)&&(i=!0)})),i}const t=n.prefix;return Lo({prefix:t,name:"a"})?!!yg(Cs(e,t),n):!1}const Mg=Object.freeze({width:null,height:null}),wg=Object.freeze({...Mg,...Jo}),tC=/(-?[0-9.]*[0-9]+[0-9.]*)/g,nC=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Jf(n,e,t){if(e===1)return n;if(t=t||100,typeof n=="number")return Math.ceil(n*e*t)/t;if(typeof n!="string")return n;const i=n.split(tC);if(i===null||!i.length)return n;const r=[];let s=i.shift(),a=nC.test(s);for(;;){if(a){const o=parseFloat(s);isNaN(o)?r.push(s):r.push(Math.ceil(o*e*t)/t)}else r.push(s);if(s=i.shift(),s===void 0)return r.join("");a=!a}}function iC(n,e="defs"){let t="";const i=n.indexOf("<"+e);for(;i>=0;){const r=n.indexOf(">",i),s=n.indexOf("</"+e);if(r===-1||s===-1)break;const a=n.indexOf(">",s);if(a===-1)break;t+=n.slice(r+1,s).trim(),n=n.slice(0,i).trim()+n.slice(a+1)}return{defs:t,content:n}}function rC(n,e){return n?"<defs>"+n+"</defs>"+e:e}function sC(n,e,t){const i=iC(n);return rC(i.defs,e+i.content+t)}const aC=n=>n==="unset"||n==="undefined"||n==="none";function oC(n,e){const t={...gl,...n},i={...wg,...e},r={left:t.left,top:t.top,width:t.width,height:t.height};let s=t.body;[t,i].forEach(x=>{const v=[],g=x.hFlip,y=x.vFlip;let w=x.rotate;g?y?w+=2:(v.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),v.push("scale(-1 1)"),r.top=r.left=0):y&&(v.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),v.push("scale(1 -1)"),r.top=r.left=0);let b;switch(w<0&&(w-=Math.floor(w/4)*4),w=w%4,w){case 1:b=r.height/2+r.top,v.unshift("rotate(90 "+b.toString()+" "+b.toString()+")");break;case 2:v.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:b=r.width/2+r.left,v.unshift("rotate(-90 "+b.toString()+" "+b.toString()+")");break}w%2===1&&(r.left!==r.top&&(b=r.left,r.left=r.top,r.top=b),r.width!==r.height&&(b=r.width,r.width=r.height,r.height=b)),v.length&&(s=sC(s,'<g transform="'+v.join(" ")+'">',"</g>"))});const a=i.width,o=i.height,l=r.width,c=r.height;let d,f;a===null?(f=o===null?"1em":o==="auto"?c:o,d=Jf(f,l/c)):(d=a==="auto"?l:a,f=o===null?Jf(d,c/l):o==="auto"?c:o);const h={},p=(x,v)=>{aC(v)||(h[x]=v.toString())};p("width",d),p("height",f);const m=[r.left,r.top,l,c];return h.viewBox=m.join(" "),{attributes:h,viewBox:m,body:s}}const lC=/\sid="(\S+)"/g,Qf=new Map;function cC(n){n=n.replace(/[0-9]+$/,"")||"a";const e=Qf.get(n)||0;return Qf.set(n,e+1),e?`${n}${e}`:n}function uC(n){const e=[];let t;for(;t=lC.exec(n);)e.push(t[1]);if(!e.length)return n;const i="suffix"+(Math.random()*16777216|Date.now()).toString(16);return e.forEach(r=>{const s=cC(r),a=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=n.replace(new RegExp('([#;"])('+a+')([")]|\\.[a-z])',"g"),"$1"+s+i+"$3")}),n=n.replace(new RegExp(i,"g"),""),n}const yu=Object.create(null);function dC(n,e){yu[n]=e}function Su(n){return yu[n]||yu[""]}function jd(n){let e;if(typeof n.resources=="string")e=[n.resources];else if(e=n.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:n.path||"/",maxURL:n.maxURL||500,rotate:n.rotate||750,timeout:n.timeout||5e3,random:n.random===!0,index:n.index||0,dataAfterTimeout:n.dataAfterTimeout!==!1}}const qd=Object.create(null),Ks=["https://api.simplesvg.com","https://api.unisvg.com"],Io=[];for(;Ks.length>0;)Ks.length===1||Math.random()>.5?Io.push(Ks.shift()):Io.push(Ks.pop());qd[""]=jd({resources:["https://api.iconify.design"].concat(Io)});function hC(n,e){const t=jd(e);return t===null?!1:(qd[n]=t,!0)}function Yd(n){return qd[n]}const fC=()=>{let n;try{if(n=fetch,typeof n=="function")return n}catch{}};let ep=fC();function pC(n,e){const t=Yd(n);if(!t)return 0;let i;if(!t.maxURL)i=0;else{let r=0;t.resources.forEach(a=>{r=Math.max(r,a.length)});const s=e+".json?icons=";i=t.maxURL-r-t.path.length-s.length}return i}function mC(n){return n===404}const gC=(n,e,t)=>{const i=[],r=pC(n,e),s="icons";let a={type:s,provider:n,prefix:e,icons:[]},o=0;return t.forEach((l,c)=>{o+=l.length+1,o>=r&&c>0&&(i.push(a),a={type:s,provider:n,prefix:e,icons:[]},o=l.length),a.icons.push(l)}),i.push(a),i};function vC(n){if(typeof n=="string"){const e=Yd(n);if(e)return e.path}return"/"}const _C=(n,e,t)=>{if(!ep){t("abort",424);return}let i=vC(e.provider);switch(e.type){case"icons":{const s=e.prefix,a=e.icons.join(","),o=new URLSearchParams({icons:a});i+=s+".json?"+o.toString();break}case"custom":{const s=e.uri;i+=s.slice(0,1)==="/"?s.slice(1):s;break}default:t("abort",400);return}let r=503;ep(n+i).then(s=>{const a=s.status;if(a!==200){setTimeout(()=>{t(mC(a)?"abort":"next",a)});return}return r=501,s.json()}).then(s=>{if(typeof s!="object"||s===null){setTimeout(()=>{s===404?t("abort",s):t("next",r)});return}setTimeout(()=>{t("success",s)})}).catch(()=>{t("next",r)})},xC={prepare:gC,send:_C};function Eg(n,e){n.forEach(t=>{const i=t.loaderCallbacks;i&&(t.loaderCallbacks=i.filter(r=>r.id!==e))})}function bC(n){n.pendingCallbacksFlag||(n.pendingCallbacksFlag=!0,setTimeout(()=>{n.pendingCallbacksFlag=!1;const e=n.loaderCallbacks?n.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const i=n.provider,r=n.prefix;e.forEach(s=>{const a=s.icons,o=a.pending.length;a.pending=a.pending.filter(l=>{if(l.prefix!==r)return!0;const c=l.name;if(n.icons[c])a.loaded.push({provider:i,prefix:r,name:c});else if(n.missing.has(c))a.missing.push({provider:i,prefix:r,name:c});else return t=!0,!0;return!1}),a.pending.length!==o&&(t||Eg([n],s.id),s.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),s.abort))})}))}let yC=0;function SC(n,e,t){const i=yC++,r=Eg.bind(null,t,i);if(!e.pending.length)return r;const s={id:i,icons:e,callback:n,abort:r};return t.forEach(a=>{(a.loaderCallbacks||(a.loaderCallbacks=[])).push(s)}),r}function MC(n){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);n.sort((r,s)=>r.provider!==s.provider?r.provider.localeCompare(s.provider):r.prefix!==s.prefix?r.prefix.localeCompare(s.prefix):r.name.localeCompare(s.name));let i={provider:"",prefix:"",name:""};return n.forEach(r=>{if(i.name===r.name&&i.prefix===r.prefix&&i.provider===r.provider)return;i=r;const s=r.provider,a=r.prefix,o=r.name,l=t[s]||(t[s]=Object.create(null)),c=l[a]||(l[a]=Cs(s,a));let d;o in c.icons?d=e.loaded:a===""||c.missing.has(o)?d=e.missing:d=e.pending;const f={provider:s,prefix:a,name:o};d.push(f)}),e}function wC(n,e=!0,t=!1){const i=[];return n.forEach(r=>{const s=typeof r=="string"?ml(r,e,t):r;s&&i.push(s)}),i}const EC={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function TC(n,e,t,i){const r=n.resources.length,s=n.random?Math.floor(Math.random()*r):n.index;let a;if(n.random){let S=n.resources.slice(0);for(a=[];S.length>1;){const A=Math.floor(Math.random()*S.length);a.push(S[A]),S=S.slice(0,A).concat(S.slice(A+1))}a=a.concat(S)}else a=n.resources.slice(s).concat(n.resources.slice(0,s));const o=Date.now();let l="pending",c=0,d,f=null,h=[],p=[];typeof i=="function"&&p.push(i);function m(){f&&(clearTimeout(f),f=null)}function x(){l==="pending"&&(l="aborted"),m(),h.forEach(S=>{S.status==="pending"&&(S.status="aborted")}),h=[]}function v(S,A){A&&(p=[]),typeof S=="function"&&p.push(S)}function g(){return{startTime:o,payload:e,status:l,queriesSent:c,queriesPending:h.length,subscribe:v,abort:x}}function y(){l="failed",p.forEach(S=>{S(void 0,d)})}function w(){h.forEach(S=>{S.status==="pending"&&(S.status="aborted")}),h=[]}function b(S,A,_){const T=A!=="success";switch(h=h.filter(D=>D!==S),l){case"pending":break;case"failed":if(T||!n.dataAfterTimeout)return;break;default:return}if(A==="abort"){d=_,y();return}if(T){d=_,h.length||(a.length?E():y());return}if(m(),w(),!n.random){const D=n.resources.indexOf(S.resource);D!==-1&&D!==n.index&&(n.index=D)}l="completed",p.forEach(D=>{D(_)})}function E(){if(l!=="pending")return;m();const S=a.shift();if(S===void 0){if(h.length){f=setTimeout(()=>{m(),l==="pending"&&(w(),y())},n.timeout);return}y();return}const A={status:"pending",resource:S,callback:(_,T)=>{b(A,_,T)}};h.push(A),c++,f=setTimeout(E,n.rotate),t(S,e,A.callback)}return setTimeout(E),g}function Tg(n){const e={...EC,...n};let t=[];function i(){t=t.filter(a=>a().status==="pending")}function r(a,o,l){const c=TC(e,a,o,(d,f)=>{i(),l&&l(d,f)});return t.push(c),c}function s(a){return t.find(o=>a(o))||null}return{query:r,find:s,setIndex:a=>{e.index=a},getIndex:()=>e.index,cleanup:i}}function tp(){}const fc=Object.create(null);function AC(n){if(!fc[n]){const e=Yd(n);if(!e)return;fc[n]={config:e,redundancy:Tg(e)}}return fc[n]}function CC(n,e,t){let i,r;if(typeof n=="string"){const s=Su(n);if(!s)return t(void 0,424),tp;r=s.send;const a=AC(n);a&&(i=a.redundancy)}else{const s=jd(n);if(s){i=Tg(s);const a=Su(n.resources?n.resources[0]:"");a&&(r=a.send)}}return!i||!r?(t(void 0,424),tp):i.query(e,r,t)().abort}function np(){}function PC(n){n.iconsLoaderFlag||(n.iconsLoaderFlag=!0,setTimeout(()=>{n.iconsLoaderFlag=!1,bC(n)}))}function RC(n){const e=[],t=[];return n.forEach(i=>{(i.match(vg)?e:t).push(i)}),{valid:e,invalid:t}}function Zs(n,e,t){function i(){const r=n.pendingIcons;e.forEach(s=>{r&&r.delete(s),n.icons[s]||n.missing.add(s)})}if(t&&typeof t=="object")try{if(!yg(n,t).length){i();return}}catch(r){console.error(r)}i(),PC(n)}function ip(n,e){n instanceof Promise?n.then(t=>{e(t)}).catch(()=>{e(null)}):e(n)}function DC(n,e){n.iconsToLoad?n.iconsToLoad=n.iconsToLoad.concat(e).sort():n.iconsToLoad=e,n.iconsQueueFlag||(n.iconsQueueFlag=!0,setTimeout(()=>{n.iconsQueueFlag=!1;const{provider:t,prefix:i}=n,r=n.iconsToLoad;if(delete n.iconsToLoad,!r||!r.length)return;const s=n.loadIcon;if(n.loadIcons&&(r.length>1||!s)){ip(n.loadIcons(r,i,t),c=>{Zs(n,r,c)});return}if(s){r.forEach(c=>{ip(s(c,i,t),d=>{Zs(n,[c],d?{prefix:i,icons:{[c]:d}}:null)})});return}const{valid:a,invalid:o}=RC(r);if(o.length&&Zs(n,o,null),!a.length)return;const l=i.match(vg)?Su(t):null;if(!l){Zs(n,a,null);return}l.prepare(t,i,a).forEach(c=>{CC(t,c,d=>{Zs(n,c.icons,d)})})}))}const LC=(n,e)=>{const t=MC(wC(n,!0,Sg()));if(!t.pending.length){let o=!0;return e&&setTimeout(()=>{o&&e(t.loaded,t.missing,t.pending,np)}),()=>{o=!1}}const i=Object.create(null),r=[];let s,a;return t.pending.forEach(o=>{const{provider:l,prefix:c}=o;if(c===a&&l===s)return;s=l,a=c,r.push(Cs(l,c));const d=i[l]||(i[l]=Object.create(null));d[c]||(d[c]=[])}),t.pending.forEach(o=>{const{provider:l,prefix:c,name:d}=o,f=Cs(l,c),h=f.pendingIcons||(f.pendingIcons=new Set);h.has(d)||(h.add(d),i[l][c].push(d))}),r.forEach(o=>{const l=i[o.provider][o.prefix];l.length&&DC(o,l)}),e?SC(e,t,r):np};function IC(n,e){const t={...n};for(const i in e){const r=e[i],s=typeof r;i in Mg?(r===null||r&&(s==="string"||s==="number"))&&(t[i]=r):s===typeof t[i]&&(t[i]=i==="rotate"?r%4:r)}return t}const NC=/[\s,]+/;function UC(n,e){e.split(NC).forEach(t=>{switch(t.trim()){case"horizontal":n.hFlip=!0;break;case"vertical":n.vFlip=!0;break}})}function FC(n,e=0){const t=n.replace(/^-?[0-9.]*/,"");function i(r){for(;r<0;)r+=4;return r%4}if(t===""){const r=parseInt(n);return isNaN(r)?0:i(r)}else if(t!==n){let r=0;switch(t){case"%":r=25;break;case"deg":r=90}if(r){let s=parseFloat(n.slice(0,n.length-t.length));return isNaN(s)?0:(s=s/r,s%1===0?i(s):0)}}return e}function OC(n,e){let t=n.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const i in e)t+=" "+i+'="'+e[i]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+t+">"+n+"</svg>"}function zC(n){return n.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function BC(n){return"data:image/svg+xml,"+zC(n)}function kC(n){return'url("'+BC(n)+'")'}const rp={...wg,inline:!1},VC={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},HC={display:"inline-block"},Mu={"background-color":"currentColor"},Ag={"background-color":"transparent"},sp={image:"var(--svg)",repeat:"no-repeat",size:"100% 100%"},ap={"-webkit-mask":Mu,mask:Mu,background:Ag};for(const n in ap){const e=ap[n];for(const t in sp)e[n+"-"+t]=sp[t]}function GC(n){return n+(n.match(/^[-0-9.]+$/)?"px":"")}function WC(n,e){const t=IC(rp,e),i=e.mode||"svg",r=i==="svg"?{...VC}:{};n.body.indexOf("xlink:")===-1&&delete r["xmlns:xlink"];let s=typeof e.style=="string"?e.style:"";for(let g in e){const y=e[g];if(y!==void 0)switch(g){case"icon":case"style":case"onLoad":case"mode":case"ssr":break;case"inline":case"hFlip":case"vFlip":t[g]=y===!0||y==="true"||y===1;break;case"flip":typeof y=="string"&&UC(t,y);break;case"color":s=s+(s.length>0&&s.trim().slice(-1)!==";"?";":"")+"color: "+y+"; ";break;case"rotate":typeof y=="string"?t[g]=FC(y):typeof y=="number"&&(t[g]=y);break;case"ariaHidden":case"aria-hidden":y!==!0&&y!=="true"&&delete r["aria-hidden"];break;default:if(g.slice(0,3)==="on:")break;rp[g]===void 0&&(r[g]=y)}}const a=oC(n,t),o=a.attributes;if(t.inline&&(s="vertical-align: -0.125em; "+s),i==="svg")return Object.assign(r,o),s!==""&&(r.style=s),{svg:!0,attributes:r,body:uC(a.body)};const{body:l,width:c,height:d}=n,f=i==="mask"||(i==="bg"?!1:l.indexOf("currentColor")!==-1),h=OC(l,{...o,width:c+"",height:d+""}),m={"--svg":kC(h)},x=g=>{const y=o[g];y&&(m[g]=GC(y))};x("width"),x("height"),Object.assign(m,HC,f?Mu:Ag);let v="";for(const g in m)v+=g+": "+m[g]+";";return r.style=v+s,{svg:!1,attributes:r}}Sg(!0);dC("",xC);if(typeof document<"u"&&typeof window<"u"){const n=window;if(n.IconifyPreload!==void 0){const e=n.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(i=>{try{(typeof i!="object"||i===null||i instanceof Array||typeof i.icons!="object"||typeof i.prefix!="string"||!eC(i))&&console.error(t)}catch{console.error(t)}})}if(n.IconifyProviders!==void 0){const e=n.IconifyProviders;if(typeof e=="object"&&e!==null)for(let t in e){const i="IconifyProviders["+t+"] is invalid.";try{const r=e[t];if(typeof r!="object"||!r||r.resources===void 0)continue;hC(t,r)||console.error(i)}catch{console.error(i)}}}}function XC(){try{return typeof window!="object"}catch{return!0}}function jC(n,e,t,i){function r(){e.loading&&(e.loading.abort(),e.loading=null)}if(typeof n=="object"&&n!==null&&typeof n.body=="string")return e.name="",r(),{data:{...gl,...n}};let s;if(typeof n!="string"||(s=ml(n,!1,!0))===null)return r(),null;const a=J2(s);if(!a)return!XC()&&(!e.loading||e.loading.name!==n)&&(r(),e.name="",e.loading={name:n,abort:LC([s],t)}),null;r(),e.name!==n&&(e.name=n,i&&!e.destroyed&&setTimeout(()=>{i(n)}));const o=["iconify"];return s.prefix!==""&&o.push("iconify--"+s.prefix),s.provider!==""&&o.push("iconify--"+s.provider),{data:a,classes:o}}function qC(n,e){return n?WC({...gl,...n},e):null}var YC=Xg("<svg></svg>"),KC=Z("<span></span>");function Cg(n,e){st(e,!0);const t={name:"",loading:null,destroyed:!1},i=ut(e,["$$slots","$$events","$$legacy"]);let r=Oe(0),s=z(()=>(u(r),jC(e.icon,t,o,e.onload))),a=z(()=>{const f=u(s)?qC(u(s).data,i):null;return f&&u(s).classes&&i.class===void 0&&(f.attributes.class=(typeof i.class=="string"?i.class+" ":"")+u(s).classes.join(" ")),f});function o(){vp(r)}yp(()=>{t.destroyed=!0,t.loading&&(t.loading.abort(),t.loading=null)});var l=we(),c=ee(l);{var d=f=>{var h=we(),p=ee(h);{var m=v=>{var g=YC();Ft(g,()=>({...u(a).attributes})),Pv(g,()=>u(a).body,!0),q(g),P(v,g)},x=v=>{var g=KC();Ft(g,()=>({...u(a).attributes})),P(v,g)};xe(p,v=>{u(a).svg?v(m):v(x,-1)})}P(f,h)};xe(c,f=>{u(a)&&f(d)})}P(n,l),at()}var ZC=Z("<span> </span>"),$C=Z("<!> ",1);function JC(n,e){st(e,!0);let t=Oe(null);function i(r){!u(t)||Math.abs(r.deltaX)>Math.abs(r.deltaY)||!(u(t).scrollWidth>u(t).clientWidth)||(r.preventDefault(),u(t).scrollLeft+=r.deltaY)}gg(n,{class:"w-full shrink-0 border-b border-border",orientation:"horizontal",onwheel:i,get viewportRef(){return u(t)},set viewportRef(r){W(t,r,!0)},children:(r,s)=>{var a=we(),o=ee(a);Ne(o,()=>Rv,(l,c)=>{c(l,{class:"px-2 py-2 gap-0 inline-flex h-auto w-max justify-start rounded-none bg-transparent",children:(d,f)=>{var h=we(),p=ee(h);Zt(p,17,()=>e.tabs,m=>m.id,(m,x)=>{var v=we(),g=ee(v);Ne(g,()=>Dv,(y,w)=>{w(y,{get value(){return u(x).id},onclick:()=>e.onTabChange(u(x).id),class:"group/tab gap-1.5 px-3 py-1 text-sm font-medium relative h-auto flex-none shrink-0 rounded-none border-0 transition-colors not-last:border-r not-last:border-border hover:bg-accent data-[state=active]:bg-transparent data-[state=active]:text-foreground data-[state=active]:shadow-none data-[state=inactive]:text-muted-foreground dark:data-[state=active]:border-transparent dark:data-[state=active]:bg-transparent",children:(b,E)=>{var S=$C(),A=ee(S);{var _=D=>{var L=we(),F=ee(L);{var B=R=>{Cg(R,{get icon(){return u(x).icon},class:"h-4 w-4"})},U=z(()=>u(x).icon.includes(":")),N=R=>{var O=ZC(),Y=$(O,!0);q(O),Me(()=>Ae(Y,u(x).icon)),P(R,O)};xe(F,R=>{u(U)?R(B):R(N,-1)})}P(D,L)};xe(A,D=>{u(x).icon&&D(_)})}var T=ae(A);Me(()=>Ae(T,` ${u(x).label??""}`)),P(b,S)},$$slots:{default:!0}})}),P(m,v)}),P(d,h)},$$slots:{default:!0}})}),P(r,a)},$$slots:{default:!0}}),at()}var QC=Z("<h3> </h3>"),eP=Z("<p> </p>"),tP=Z("<div><!></div> <!> <!>",1);function wu(n,e){let t=le(e,"message",3,""),i=le(e,"size",3,"medium"),r=le(e,"class",3,"");const s={small:{container:"p-6 gap-3",icon:"w-8 h-8",title:"text-sm font-semibold",message:"text-xs"},medium:{container:"p-12 gap-4",icon:"w-12 h-12",title:"text-lg font-semibold",message:"text-sm"},large:{container:"p-16 gap-6",icon:"w-16 h-16",title:"text-2xl font-bold",message:"text-base"}},a={loading:{icon:"text-primary",title:"text-primary-foreground",message:"text-primary-foreground/80",border:"border-primary",background:"bg-primary/15"},error:{icon:"text-destructive",title:"text-destructive-foreground",message:"text-destructive-foreground/80",border:"border-destructive",background:"bg-destructive/15"},warning:{icon:"text-accent",title:"text-accent-foreground",message:"text-accent-foreground/80",border:"border-accent",background:"bg-accent/15"},empty:{icon:"text-neutral",title:"text-neutral-foreground",message:"text-neutral-foreground/80",border:"border-neutral",background:"bg-neutral/15"}},o=z(()=>s[i()]),l=z(()=>a[e.type]);var c=we(),d=ee(c);Ne(d,()=>vs,(f,h)=>{h(f,{get class(){return`rounded-lg border-2 ${u(l).border??""} ${u(l).background??""} ${r()??""}`},children:(p,m)=>{var x=we(),v=ee(x);Ne(v,()=>Fp,(g,y)=>{y(g,{get class(){return`flex flex-col items-center justify-center text-center ${u(o).container??""}`},children:(w,b)=>{var E=tP(),S=ee(E),A=$(S);{var _=R=>{Uu(R,{class:"animate-spin h-full w-full"})},T=R=>{Op(R,{class:"h-full w-full"})},D=R=>{yo(R,{class:"h-full w-full"})},L=R=>{n0(R,{class:"h-full w-full"})};xe(A,R=>{e.type==="loading"?R(_):e.type==="error"?R(T,1):e.type==="warning"?R(D,2):e.type==="empty"&&R(L,3)})}q(S);var F=ae(S,2);{var B=R=>{var O=QC(),Y=$(O,!0);q(O),Me(()=>{Dt(O,1,`${u(o).title??""} ${u(l).title??""} mt-1`),Ae(Y,e.title)}),P(R,O)};xe(F,R=>{e.title&&R(B)})}var U=ae(F,2);{var N=R=>{var O=eP(),Y=$(O,!0);q(O),Me(()=>{Dt(O,1,`${u(o).message??""} ${u(l).message??""} max-w-md leading-relaxed`),Ae(Y,t())}),P(R,O)};xe(U,R=>{t()&&R(N)})}Me(()=>Dt(S,1,`${u(o).icon??""} ${u(l).icon??""}`)),P(w,E)},$$slots:{default:!0}})}),P(p,x)},$$slots:{default:!0}})}),P(n,c)}const _o=n=>Array.isArray(n)?n.map(String):n==null||n===""?[]:[String(n)],nP={equals:(n,e)=>n===e,notEquals:(n,e)=>n!==e,greaterThan:(n,e)=>Number(n)>Number(e),lessThan:(n,e)=>Number(n)<Number(e),greaterThanOrEqual:(n,e)=>Number(n)>=Number(e),lessThanOrEqual:(n,e)=>Number(n)<=Number(e),between:(n,e,t)=>t?.length===2&&Number(n)>=Number(t[0])&&Number(n)<=Number(t[1]),in:(n,e,t)=>t?.includes(String(n))??!1,notIn:(n,e,t)=>!(t?.includes(String(n))??!1),matches:(n,e)=>{try{return new RegExp(String(e)).test(String(n))}catch{return!1}},contains:(n,e)=>_o(n).includes(String(e)),containsAny:(n,e,t)=>{const i=_o(n);return t?.some(r=>i.includes(String(r)))??!1},isEmpty:n=>_o(n).length===0,isNotEmpty:n=>_o(n).length>0};function iP(n,e){const t=nP[n.operator];return t?t(e[n.paramId],n.value,n.values):!1}function Pg(n,e){const t=n.rules.map(i=>iP(i,e));return n.mode==="any"?t.some(Boolean):t.every(Boolean)}const op={show:n=>({visible:n,disabled:!1}),hide:(n,e)=>({visible:!n,disabled:!1,defaultValue:e}),disable:(n,e)=>({visible:!0,disabled:n,defaultValue:n?e:void 0})};function rP(n,e){if(n.type==="linebreak")return{visible:!0,disabled:!1};if("visible"in n&&n.visible===!1)return{visible:!1,disabled:!1};if(!n.visibilityCondition?.rules)return{visible:!0,disabled:!1};const{action:t="show",defaultValue:i}=n.visibilityCondition,r=Pg(n.visibilityCondition,e);return(op[t]??op.show)(r,i)}function Qo(n){return n.type==="linebreak"?n.id:n.paramId}function Rg(n,e){const t={};for(const i of n)t[Qo(i)]=rP(i,e);return t}function sP(n,e){if(!n.visibilityCondition?.rules)return!0;const{action:t="show"}=n.visibilityCondition,i=Pg(n.visibilityCondition,e);return t==="hide"?!i:i}var aP=Z('<div style="grid-column: 1 / -1" class="h-px bg-border" aria-hidden="true"></div>'),oP=Z("<div><!></div>"),lP=Z("<div><!></div>"),cP=Z('<div class="p-6"><div class="schema-grid gap-6 grid svelte-1mpk06z"></div></div>'),uP=Z("<!> <!> <!>",1),dP=Z('<div class="schema-grid gap-6 grid svelte-1mpk06z"></div>'),hP=Z('<!> <div><div class="content-inner svelte-1mpk06z"><!></div></div>',1);function fP(n,e){st(e,!0);const t=(f,h=wt,p=wt,m=wt)=>{var x=we(),v=ee(x);{var g=w=>{var b=aP();P(w,b)},y=w=>{const b=z(()=>u(s)[Qo(h())]),E=z(()=>Math.min(Math.max(1,h().span??1),p()));var S=we(),A=ee(S);{var _=T=>{var D=we(),L=ee(D);{var F=U=>{var N=oP();let R;var O=$(N);pt(O,()=>e.inputSnippet,h,()=>u(b)),q(N),Me(()=>{R=Dt(N,1,"grid-cell min-w-0 flex items-center svelte-1mpk06z",null,R,{"opacity-50":u(b).disabled,"col-divider":!m()&&p()>1}),Ii(N,`grid-column: span ${u(E)??""} / span ${u(E)??""}`)}),P(U,N)},B=U=>{var N=lP();let R;var O=$(N);pt(O,()=>e.outputSnippet,h),q(N),Me(()=>{R=Dt(N,1,"grid-cell svelte-1mpk06z",null,R,{"col-divider":!m()&&p()>1}),Ii(N,`grid-column: span ${u(E)??""} / span ${u(E)??""}`)}),P(U,N)};xe(L,U=>{h().type==="input"?U(F):h().type==="output"&&U(B,1)})}P(T,D)};xe(A,T=>{u(b).visible&&T(_)})}P(w,S)};xe(v,w=>{h().type==="linebreak"?w(g):w(y,-1)})}P(f,x)};let i=le(e,"flat",3,!1);function r(f){(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),e.onToggle())}const s=z(()=>Rg(e.items,e.values)),a=z(()=>{const f=[];let h=0;for(const p of e.items){if(p.type==="linebreak"){f.push(0),h=0;continue}if(!u(s)[Qo(p)].visible){f.push(0);continue}const x=Math.min(Math.max(1,p.span??1),e.columns);h+x>e.columns&&(h=0),f.push(h),h=(h+x)%e.columns}return f});var o=we(),l=ee(o);{var c=f=>{var h=cP(),p=$(h);Zt(p,23,()=>e.items,m=>m.type==="linebreak"?m.id:m.paramId,(m,x,v)=>{t(m,()=>u(x),()=>e.columns,()=>u(a)[u(v)]===0)}),q(p),q(h),Me(()=>Ii(p,`--schema-cols: ${e.columns??""};`)),P(f,h)},d=f=>{var h=we(),p=ee(h);Ne(p,()=>vs,(m,x)=>{x(m,{class:"gap-0 py-0 pt-0 overflow-hidden",children:(v,g)=>{var y=hP(),w=ee(y);{let _=z(()=>!e.collapsed);Ne(w,()=>Uv,(T,D)=>{D(T,{class:"pt-4 pb-4! cursor-pointer border-b border-border bg-muted transition-colors select-none hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-none",role:"button",tabindex:0,get"aria-expanded"(){return u(_)},get onclick(){return e.onToggle},onkeydown:r,children:(L,F)=>{var B=uP(),U=ee(B);Ne(U,()=>Fv,(Y,K)=>{K(Y,{children:(ne,ce)=>{yt();var k=Et();Me(()=>Ae(k,e.label)),P(ne,k)},$$slots:{default:!0}})});var N=ae(U,2);{var R=Y=>{var K=we(),ne=ee(K);Ne(ne,()=>zv,(ce,k)=>{k(ce,{children:(te,fe)=>{yt();var me=Et();Me(()=>Ae(me,e.description)),P(te,me)},$$slots:{default:!0}})}),P(Y,K)};xe(N,Y=>{e.description&&Y(R)})}var O=ae(N,2);Ne(O,()=>G2,(Y,K)=>{K(Y,{children:(ne,ce)=>{{let k=z(()=>e.collapsed?"":"rotate-180");Ov(ne,{get class(){return`h-4 w-4 text-muted-foreground transition-transform duration-200 ${u(k)??""}`}})}},$$slots:{default:!0}})}),P(L,B)},$$slots:{default:!0}})})}var b=ae(w,2);let E;var S=$(b),A=$(S);Ne(A,()=>Fp,(_,T)=>{T(_,{class:"p-6",children:(D,L)=>{var F=dP();Zt(F,23,()=>e.items,B=>B.type==="linebreak"?B.id:B.paramId,(B,U,N)=>{t(B,()=>u(U),()=>e.columns,()=>u(a)[u(N)]===0)}),q(F),Me(()=>Ii(F,`--schema-cols: ${e.columns??""};`)),P(D,F)},$$slots:{default:!0}})}),q(S),q(b),Me(()=>E=Dt(b,1,"content-wrapper svelte-1mpk06z",null,E,{collapsed:e.collapsed})),P(v,y)},$$slots:{default:!0}})}),P(f,h)};xe(l,f=>{i()?f(c):f(d,-1)})}P(n,o),at()}function pc(n){return n.type==="input"&&n.widgetType==="number"}function pP(n){return n.type==="input"&&n.widgetType==="text"}function mP(n){return n.type==="input"&&n.widgetType==="dropdown"}function xo(n){return n.type==="input"&&n.widgetType==="dynamicValueList"}function gP(n){return n.type==="input"&&n.widgetType==="checkbox"}function vP(n){return n.type==="input"&&n.widgetType==="file"}function _P(n){return n.type==="input"&&n.widgetType==="color"}function Dg(n){return n?.layout?n.layout.type==="tabbed"?n.layout.tabs?.flatMap(e=>e.groups??[])??[]:n.layout.type==="flat"?n.layout.groups??[]:[]:[]}function Lg(n){return Dg(n).flatMap(e=>e.items??[])}function xP(n){return Lg(n).filter(e=>e.type==="input")}const bP=Gv({base:"group/field data-[invalid=true]:text-destructive flex w-full gap-3",variants:{orientation:{vertical:"flex-col [&>*]:w-full [&>.sr-only]:w-auto",horizontal:["flex-row items-center","[&>[data-slot=field-label]]:flex-auto","has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"],responsive:["flex-col @md/field-group:flex-row @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto","@md/field-group:[&>[data-slot=field-label]]:flex-auto","@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"]}},defaultVariants:{orientation:"vertical"}});var yP=Z("<div><!></div>");function Eu(n,e){st(e,!0);let t=le(e,"ref",15,null),i=le(e,"orientation",3,"vertical"),r=ut(e,["$$slots","$$events","$$legacy","ref","class","orientation","children"]);var s=yP();Ft(s,o=>({role:"group","data-slot":"field","data-orientation":i(),class:o,...r}),[()=>ci(bP({orientation:i()}),e.class)]);var a=$(s);pt(a,()=>e.children??wt),q(s),ui(s,o=>t(o),()=>t()),P(n,s),at()}function Tu(n,e){st(e,!0);let t=le(e,"ref",15,null),i=ut(e,["$$slots","$$events","$$legacy","ref","class","children"]);{let r=z(()=>ci("group/field-label peer/field-label gap-2 leading-snug flex w-fit group-data-[disabled=true]/field:opacity-50","[&>*]:data-[slot=field]:p-4 has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border","has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10",e.class));or(n,mt({"data-slot":"field-label",get class(){return u(r)}},()=>i,{get ref(){return t()},set ref(s){t(s)},children:(s,a)=>{var o=we(),l=ee(o);pt(l,()=>e.children??wt),P(s,o)},$$slots:{default:!0}}))}at()}var SP=Z("<li> </li>"),MP=Z('<ul class="ms-4 gap-1 flex list-disc flex-col"></ul>'),wP=Z("<div><!></div>");function Ig(n,e){st(e,!0);let t=le(e,"ref",15,null),i=ut(e,["$$slots","$$events","$$legacy","ref","class","children","errors"]);const r=z(()=>e.children?!0:!(!e.errors||e.errors.length===0||e.errors.length===1&&!e.errors[0]?.message)),s=z(()=>e.errors&&e.errors.length>1),a=z(()=>e.errors&&e.errors.length===1&&e.errors[0]?.message);var o=we(),l=ee(o);{var c=d=>{var f=wP();Ft(f,v=>({role:"alert","data-slot":"field-error",class:v,...i}),[()=>ci("text-sm font-normal text-destructive",e.class)]);var h=$(f);{var p=v=>{var g=we(),y=ee(g);pt(y,()=>e.children),P(v,g)},m=v=>{var g=Et();Me(()=>Ae(g,u(a))),P(v,g)},x=v=>{var g=MP();Zt(g,21,()=>e.errors??[],bp,(y,w)=>{var b=we(),E=ee(b);{var S=A=>{var _=SP(),T=$(_,!0);q(_),Me(()=>Ae(T,u(w).message)),P(A,_)};xe(E,A=>{u(w)?.message&&A(S)})}P(y,b)}),q(g),P(v,g)};xe(h,v=>{e.children?v(p):u(a)?v(m,1):u(s)&&v(x,2)})}q(f),ui(f,v=>t(v),()=>t()),P(d,f)};xe(l,d=>{u(r)&&d(c)})}P(n,o),at()}var EP=Z('<div data-slot="checkbox-indicator" class="text-current transition-none"><!></div>');function Ng(n,e){st(e,!0);let t=le(e,"ref",15,null),i=le(e,"checked",15,!1),r=le(e,"indeterminate",15,!1),s=ut(e,["$$slots","$$events","$$legacy","ref","checked","indeterminate","class"]);var a=we(),o=ee(a);{const l=(d,f)=>{let h=()=>(f?.()).checked,p=()=>(f?.()).indeterminate;var m=EP(),x=$(m);{var v=y=>{ia(y,{class:"size-3.5"})},g=y=>{kv(y,{class:"size-3.5"})};xe(x,y=>{h()?y(v):p()&&y(g,1)})}q(m),P(d,m)};let c=z(()=>ci("peer size-4 shadow-xs flex shrink-0 items-center justify-center rounded-[4px] border border-input transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary",e.class));Ne(o,()=>g0,(d,f)=>{f(d,mt({"data-slot":"checkbox",get class(){return u(c)}},()=>s,{get ref(){return t()},set ref(h){t(h)},get checked(){return i()},set checked(h){i(h)},get indeterminate(){return r()},set indeterminate(h){r(h)},children:l,$$slots:{default:!0}}))})}P(n,a),at()}var TP=Z("<!> <!>",1);function AP(n,e){st(e,!0);let t=le(e,"value",15),i=le(e,"disabled",3,!1);var r=we(),s=ee(r);Ne(s,()=>Eu,(a,o)=>{o(a,{orientation:"horizontal",children:(l,c)=>{var d=TP(),f=ee(d);{let p=z(()=>typeof t()=="boolean"?t():!1);Ng(f,{get id(){return e.inputId},get checked(){return u(p)},onCheckedChange:m=>{t(m===!0),e.onChange(m===!0)},get disabled(){return i()}})}var h=ae(f,2);Ne(h,()=>Tu,(p,m)=>{m(p,{get for(){return e.inputId},class:"font-normal cursor-pointer text-muted-foreground",children:(x,v)=>{yt();var g=Et("Enabled");P(x,g)},$$slots:{default:!0}})}),P(l,d)},$$slots:{default:!0}})}),P(n,r),at()}var CP=Z("<label><!> <span> </span></label>"),PP=Z('<div class="divide-y divide-border/60 overflow-hidden rounded-md border border-input"></div>');function lp(n,e){st(e,!0);let t=le(e,"disabled",3,!1);const i=z(()=>e.config?.options??{}),r=z(()=>new Set(e.value??[]));function s(o,l){const c=new na(u(r));l?c.add(o):c.delete(o),e.onChange([...c])}var a=PP();Zt(a,21,()=>Object.entries(u(i)),([o,l])=>o,(o,l)=>{var c=z(()=>Mr(u(l),2));let d=()=>u(c)[0],f=()=>u(c)[1];const h=z(()=>f()??d()),p=z(()=>`${e.inputId}-${u(h)}`),m=z(()=>u(r).has(u(h)));var x=CP(),v=$(x);Ng(v,{get id(){return u(p)},get checked(){return u(m)},onCheckedChange:b=>s(u(h),b===!0),get disabled(){return t()}});var g=ae(v,2);let y;var w=$(g,!0);q(g),q(x),Me(()=>{Qt(x,"for",u(p)),Dt(x,1,`gap-3 px-3 py-2 text-sm flex items-center transition-colors select-none hover:bg-accent/50 ${u(m)?"bg-accent/30":""} ${t()?"cursor-not-allowed opacity-50":"cursor-pointer"}`),y=Dt(g,1,"flex-1",null,y,{"font-medium":u(m)}),Ae(w,d())}),P(o,x)}),q(a),P(n,a),at()}var RP=Z('<div class="gap-2 flex items-center"><input type="color" class="h-9 w-12 rounded p-1 cursor-pointer border border-input bg-background"/> <span class="font-mono text-sm text-muted-foreground"> </span></div>');function DP(n,e){st(e,!0);let t=le(e,"value",3,"#000000");var i=RP(),r=$(i);Ru(r);var s=ae(r,2),a=$(s,!0);q(s),q(i),Me(()=>{mv(r,t()||"#000000"),Ae(a,t()||"#000000")}),Xt("change",r,o=>{const l=o.currentTarget.value;e.onChange(l)}),P(n,i),at()}zi(["change"]);var LP=Z("<!> <!>",1);function cp(n,e){st(e,!0);let t=le(e,"value",7),i=le(e,"disabled",3,!1);const r=z(()=>e.config?.options||{}),s=z(()=>t()||""),a=z(()=>Object.entries(u(r)).find(([c,d])=>d===u(s))?.[0]??u(s));var o=we(),l=ee(o);Ne(l,()=>wv,(c,d)=>{d(c,{type:"single",get value(){return u(s)},onValueChange:f=>{f&&(t(f),e.onChange(f))},get disabled(){return i()},children:(f,h)=>{var p=LP(),m=ee(p);Ne(m,()=>Ev,(v,g)=>{g(v,{class:"w-full",get disabled(){return i()},children:(y,w)=>{yt();var b=Et();Me(()=>Ae(b,u(a)||"Select an option...")),P(y,b)},$$slots:{default:!0}})});var x=ae(m,2);Ne(x,()=>Tv,(v,g)=>{g(v,{children:(y,w)=>{var b=we(),E=ee(b);Zt(E,17,()=>Object.entries(u(r)),([S,A])=>S,(S,A)=>{var _=z(()=>Mr(u(A),2));let T=()=>u(_)[0],D=()=>u(_)[1];var L=we(),F=ee(L);{let B=z(()=>D()??T());Ne(F,()=>Av,(U,N)=>{N(U,{get value(){return u(B)},get label(){return T()}})})}P(S,L)}),P(y,b)},$$slots:{default:!0}})}),P(f,p)},$$slots:{default:!0}})}),P(n,o),at()}var IP=Z('<button type="button"> </button>'),NP=Z('<div class="rounded text-xs flex overflow-hidden border"></div>'),UP=Z("<!> File URL",1),FP=Z('<div class="gap-1.5 text-xs flex items-center text-success"><!> </div>'),OP=Z('<p class="text-xs leading-snug pl-5 text-muted-foreground"> </p>'),zP=Z('<div class="p-2.5 gap-1.5 flex flex-col rounded-md border border-destructive/40 bg-destructive/5"><div class="gap-1.5 flex items-start"><!> <p class="text-xs leading-snug text-destructive"> </p></div> <!></div>'),BP=Z('<p class="text-xs text-muted-foreground">URL must be publicly accessible (no login required).</p>'),kP=Z('<div class="gap-2 flex flex-col"><!> <div class="gap-2 flex"><!> <!></div> <!> <!> <!></div>'),VP=Z("<!> Upload File",1),HP=Z("<!> ",1),GP=Z('<p class="text-xs text-muted-foreground"> </p>'),WP=Z('<div class="gap-2 flex flex-col"><!> <!> <!></div>'),XP=Z('<div class="gap-4 flex w-full flex-col"><input type="file" class="hidden"/> <!> <!></div>');function jP(n,e){st(e,!0);let t=le(e,"value",15),i=le(e,"acceptedFormats",19,()=>[]),r=le(e,"defaultInputMode",3,"upload"),s=z(()=>e.allowedInputModes&&e.allowedInputModes.length>0?e.allowedInputModes:["upload","url"]),a=z(()=>u(s).length>1),o=Oe("upload");Pt(()=>{const R=r()??"upload";W(o,u(s).includes(R)?R:u(s)[0],!0)});let l=Oe(null),c=Oe(""),d=Oe(""),f=Oe(!1),h=Oe(!1),p=Oe(null),m=Oe("");Pt(()=>{if(t())try{const R=typeof t()=="string"?JSON.parse(t()):t();if(R.type==="base64")if(R._isMetadata&&R._fileSize){const O=(R._fileSize/1024/1024).toFixed(2);W(c,`Uploaded file (${R.fileEnding}, ${O}MB)`)}else W(c,`Uploaded file (${R.fileEnding})`);else R.type==="url"&&W(d,R.file,!0)}catch{}});function x(R){const O=R.split("?")[0];return(O.includes(".")?"."+O.split(".").pop():".tmp").toLowerCase()}function v(R){return i().length===0?!0:i().includes(R.toLowerCase())}function g(R){return R instanceof TypeError&&R.message==="Failed to fetch"}async function y(){if(u(d).trim()){W(h,!0),W(p,null),W(m,""),W(c,"");try{let R;try{R=new URL(u(d))}catch{W(p,{message:"Invalid URL — make sure it starts with https://",isCors:!1},!0);return}if(R.protocol!=="https:"&&R.protocol!=="http:"){W(p,{message:"Only http:// and https:// URLs are supported.",isCors:!1},!0);return}const O=await fetch(u(d));if(!O.ok){W(p,{message:`Server returned ${O.status} ${O.statusText}. Check the URL is correct and publicly accessible.`,isCors:!1},!0);return}const Y=await O.blob(),K=x(u(d));if(!v(K)){W(p,{message:`File format "${K}" is not accepted. Allowed: ${i().join(", ")}`,isCors:!1},!0);return}const ne=us.FILE_UPLOAD.MAX_SIZE_BYTES;if(Y.size>ne){W(p,{message:`File too large: ${(Y.size/1024/1024).toFixed(2)}MB (max ${us.FILE_UPLOAD.MAX_SIZE_MB}MB). Download it and use Upload instead.`,isCors:!1},!0);return}const ce=await new Promise((te,fe)=>{const me=new FileReader;me.onload=G=>{const Q=G.target?.result;te(Q.includes(",")?Q.split(",")[1]:Q)},me.onerror=()=>fe(new Error("Failed to read the downloaded file.")),me.readAsDataURL(Y)}),k=JSON.stringify({file:ce,type:"base64",fileEnding:K});t(k),W(m,`Loaded ${K} (${(Y.size/1024).toFixed(0)} KB)`),e.onChange(k)}catch(R){if(g(R)){const O=(()=>{try{return new URL(u(d)).hostname}catch{return""}})();let Y="Check that the URL is correct and the file is publicly accessible. If the server requires login, download the file and use the Upload option instead.";O.includes("sharepoint.com")||O.includes("onedrive.com")?Y='SharePoint/OneDrive blocks browser access. Open the file in SharePoint, use "Download" to save it locally, then upload it here.':O.includes("drive.google.com")?Y='Google Drive blocks browser access. Use "Download" in Google Drive to save the file locally, then upload it here.':O.includes("dropbox.com")&&(Y='Dropbox links may block browser access. Try changing "?dl=0" to "?dl=1" in the URL, or download and upload instead.'),W(p,{message:`Could not reach "${O}" — the file may not exist, or the server does not allow browser access.`,isCors:!0,hint:Y},!0)}else W(p,{message:R instanceof Error?R.message:"Unknown error",isCors:!1},!0)}finally{W(h,!1)}}}function w(R){const Y=R.target.files?.[0];if(!Y)return;const K=x(Y.name);if(!v(K)){alert(`File format not accepted: ${K}`);return}if(Y.size>us.FILE_UPLOAD.MAX_SIZE_BYTES){alert(`File too large: ${(Y.size/1024/1024).toFixed(2)}MB (max ${us.FILE_UPLOAD.MAX_SIZE_MB}MB).`);return}W(c,Y.name,!0);const ne=new FileReader;ne.onload=ce=>{const k=ce.target?.result,te=k.includes(",")?k.split(",")[1]:k,fe=JSON.stringify({file:te,type:"base64",fileEnding:K});t(fe),e.onChange(fe)},ne.readAsDataURL(Y)}function b(){u(l)?.click()}function E(R){R.preventDefault(),W(f,!0)}function S(){W(f,!1)}function A(R){R.preventDefault(),W(f,!1);const O=R.dataTransfer?.files;if(O?.[0]){const Y=new Event("change");Object.defineProperty(Y,"target",{value:{files:O}}),w(Y)}}const _=z(()=>i().length>0?i().join(","):"*");var T=XP(),D=$(T);ui(D,R=>W(l,R),()=>u(l));var L=ae(D,2);{var F=R=>{var O=NP();Zt(O,20,()=>u(s),Y=>Y,(Y,K)=>{var ne=IP(),ce=$(ne,!0);q(ne),Me(()=>{Dt(ne,1,`px-3 py-1 flex-1 transition-colors ${u(o)===K?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"}`),Ae(ce,K==="upload"?"Upload":"URL")}),Xt("click",ne,()=>W(o,K,!0)),P(Y,ne)}),q(O),P(R,O)};xe(L,R=>{u(a)&&R(F)})}var B=ae(L,2);{var U=R=>{var O=kP(),Y=$(O);or(Y,{for:"url-input",class:"gap-2 flex items-center",children:(j,se)=>{var ue=UP(),be=ee(ue);r0(be,{size:16}),yt(),P(j,ue)},$$slots:{default:!0}});var K=ae(Y,2),ne=$(K);{let j=z(()=>u(p)?"border-destructive focus-visible:ring-destructive":"");_s(ne,{id:"url-input",type:"url",placeholder:"https://example.com/model.3dm",get disabled(){return u(h)},get class(){return u(j)},oninput:()=>{W(p,null),W(m,"")},get value(){return u(d)},set value(se){W(d,se,!0)}})}var ce=ae(ne,2);{let j=z(()=>u(h)||!u(d).trim());Bn(ce,{type:"button",variant:"outline",get disabled(){return u(j)},onclick:y,children:(se,ue)=>{yt();var be=Et();Me(()=>Ae(be,u(h)?"Fetching...":"Fetch")),P(se,be)},$$slots:{default:!0}})}q(K);var k=ae(K,2);{var te=j=>{var se=FP(),ue=$(se);Vv(ue,{size:13});var be=ae(ue);q(se),Me(()=>Ae(be,` ${u(m)??""}`)),P(j,se)};xe(k,j=>{u(m)&&j(te)})}var fe=ae(k,2);{var me=j=>{var se=zP(),ue=$(se),be=$(ue);Op(be,{size:13,class:"mt-0.5 shrink-0 text-destructive"});var Fe=ae(be,2),Ue=$(Fe,!0);q(Fe),q(ue);var Pe=ae(ue,2);{var ke=Ie=>{var We=OP(),ze=$(We,!0);q(We),Me(()=>Ae(ze,u(p).hint)),P(Ie,We)};xe(Pe,Ie=>{u(p).isCors&&u(p).hint&&Ie(ke)})}q(se),Me(()=>Ae(Ue,u(p).message)),P(j,se)};xe(fe,j=>{u(p)&&j(me)})}var G=ae(fe,2);{var Q=j=>{var se=BP();P(j,se)};xe(G,j=>{!u(p)&&!u(m)&&j(Q)})}q(O),P(R,O)},N=R=>{var O=WP(),Y=$(O);or(Y,{for:"file-upload",class:"gap-2 flex items-center",children:(k,te)=>{var fe=VP(),me=ee(fe);ah(me,{size:16}),yt(),P(k,fe)},$$slots:{default:!0}});var K=ae(Y,2);{let k=z(()=>u(f)?"border-primary":"");Bn(K,{type:"button",variant:"outline",get class(){return`gap-2 w-full ${u(k)??""}`},onclick:b,ondragover:E,ondragleave:S,ondrop:A,children:(te,fe)=>{var me=HP(),G=ee(me);ah(G,{size:16});var Q=ae(G);Me(()=>Ae(Q,` ${(u(c)||"Choose File or Drag & Drop")??""}`)),P(te,me)},$$slots:{default:!0}})}var ne=ae(K,2);{var ce=k=>{var te=GP(),fe=$(te);q(te),Me(me=>Ae(fe,`Accepted formats: ${me??""}`),[()=>i().join(", ")]),P(k,te)};xe(ne,k=>{i().length>0&&k(ce)})}q(O),P(R,O)};xe(B,R=>{u(o)==="url"?R(U):R(N,-1)})}q(T),Me(()=>Qt(D,"accept",u(_))),Xt("change",D,w),P(n,T),at()}zi(["change","click"]);function Au(n,e){let t=null;function i(...r){t!==null&&clearTimeout(t),t=setTimeout(()=>{n(...r),t=null},e)}return i.cancel=()=>{t!==null&&(clearTimeout(t),t=null)},i}var qP=Z('<span data-slot="slider-track"><!></span> <!>',1);function YP(n,e){st(e,!0);let t=le(e,"ref",15,null),i=le(e,"value",15),r=le(e,"orientation",3,"horizontal"),s=ut(e,["$$slots","$$events","$$legacy","ref","value","orientation","class"]);var a=we(),o=ee(a);{const l=(d,f)=>{let h=()=>(f?.()).thumbs;var p=qP(),m=ee(p),x=$(m);{let g=z(()=>ci("absolute bg-primary data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"));Ne(x,()=>u_,(y,w)=>{w(y,{"data-slot":"slider-range",get class(){return u(g)}})})}q(m);var v=ae(m,2);Zt(v,16,h,g=>g,(g,y)=>{var w=we(),b=ee(w);Ne(b,()=>h_,(E,S)=>{S(E,{"data-slot":"slider-thumb",get index(){return y},class:"size-4 shadow-sm block shrink-0 rounded-full border border-primary bg-background ring-ring/50 transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"})}),P(g,w)}),Me(g=>{Qt(m,"data-orientation",r()),Dt(m,1,g)},[()=>Uo(ci("bg-neutral-200 data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:w-1.5 relative grow overflow-hidden rounded-full data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full dark:bg-muted"))]),P(d,p)};let c=z(()=>ci("data-[orientation=vertical]:min-h-44 relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",e.class));Ne(o,()=>l_,(d,f)=>{f(d,mt({"data-slot":"slider",get orientation(){return r()},get class(){return u(c)}},()=>s,{get ref(){return t()},set ref(h){t(h)},get value(){return i()},set value(h){i(h)},children:l,$$slots:{default:!0}}))})}P(n,a),at()}var KP=Z('<input type="number" class="min-w-12 w-16 text-sm border-b border-border bg-transparent text-right outline-none focus:border-foreground"/>'),ZP=Z('<span role="button" class="min-w-12 text-sm cursor-text text-right text-muted-foreground select-none" title="Double-click to edit"> </span>'),$P=Z('<div class="gap-4 flex items-center"><!> <!></div>'),JP=Z("<!> <!>",1);function QP(n,e){st(e,!0);let t=le(e,"value",15),i=le(e,"disabled",3,!1),r=Oe(null),s=Oe(!1),a=Oe("");const o=z(()=>e.config?.minimum??0),l=z(()=>e.config?.maximum??100),c=z(()=>e.config?.stepSize??1),d=z(()=>typeof t()=="number"?t():u(o)),f=Au(_=>e.onChange(_),400),h=Au(_=>e.onChange(_),150);function p(_){return e.config?.minimum!==void 0&&_<e.config.minimum?`Minimum value is ${e.config.minimum}`:e.config?.maximum!==void 0&&_>e.config.maximum?`Maximum value is ${e.config.maximum}`:null}function m(_){const T=p(_);W(r,T,!0),T||(t(_),f(_))}function x(_){t(_),h(_)}function v(_){_.focus(),_.select()}function g(_){return Math.max(0,-Math.floor(Math.log10(_)))}var y=JP(),w=ee(y);{var b=_=>{const T=z(()=>g(u(c)));var D=$P(),L=$(D);YP(L,{type:"single",get value(){return u(d)},get min(){return u(o)},get max(){return u(l)},get step(){return u(c)},class:"flex-1",onValueChange:x,get disabled(){return i()}});var F=ae(L,2);{var B=N=>{var R=KP();Ru(R),Bv(R,O=>v?.(O)),Hg(()=>Sp(R,()=>u(a),O=>W(a,O))),Me(()=>Qt(R,"step",u(c))),Wg("blur",R,()=>{const O=parseFloat(u(a));isNaN(O)||x(Math.min(u(l),Math.max(u(o),O))),W(s,!1)}),Xt("keydown",R,O=>{if(O.key==="Enter"){const Y=parseFloat(u(a));isNaN(Y)||x(Math.min(u(l),Math.max(u(o),Y))),W(s,!1)}else O.key==="Escape"&&W(s,!1)}),P(N,R)},U=N=>{var R=ZP();Qt(R,"tabindex",0);var O=$(R,!0);q(R),Me(Y=>Ae(O,Y),[()=>u(d).toFixed(u(T))]),Xt("dblclick",R,()=>{W(a,u(d).toFixed(u(T)),!0),W(s,!0)}),Xt("keydown",R,Y=>{(Y.key==="Enter"||Y.key===" ")&&(W(a,u(d).toFixed(u(T)),!0),W(s,!0))}),P(N,R)};xe(F,N=>{u(s)?N(B):N(U,-1)})}q(D),P(_,D)},E=_=>{{let T=z(()=>e.config?.minimum),D=z(()=>e.config?.maximum),L=z(()=>e.config?.placeholder),F=z(()=>u(r)?!0:void 0),B=z(()=>u(r)?!0:void 0),U=z(()=>u(r)?"border-destructive":"");_s(_,{get id(){return e.inputId},type:"number",get value(){return u(d)},get min(){return u(T)},get max(){return u(D)},get step(){return u(c)},get placeholder(){return u(L)},get"data-invalid"(){return u(F)},get"aria-invalid"(){return u(B)},get class(){return u(U)},get disabled(){return i()},oninput:()=>W(r,null),onchange:N=>{const R=parseFloat(N.currentTarget.value);isNaN(R)||m(R)},onblur:N=>{const R=parseFloat(N.currentTarget.value);if(!isNaN(R)){const O=p(R);W(r,O,!0),O||(t(R),e.onChange(R))}}})}};xe(w,_=>{e.config?.renderAsSlider?_(b):_(E,-1)})}var S=ae(w,2);{var A=_=>{var T=we(),D=ee(T);Ne(D,()=>Ig,(L,F)=>{F(L,{children:(B,U)=>{yt();var N=Et();Me(()=>Ae(N,u(r))),P(B,N)},$$slots:{default:!0}})}),P(_,T)};xe(S,_=>{u(r)&&_(A)})}P(n,y),at()}zi(["keydown","dblclick"]);var eR=Z("<!> <!>",1);function tR(n,e){st(e,!0);let t=le(e,"value",15),i=le(e,"disabled",3,!1),r=Oe(null),s=Oe(Ps(t()||""));const a=Au(p=>e.onChange(p),400);function o(p){if(e.config?.maxLength&&p.length>e.config.maxLength)return`Maximum ${e.config.maxLength} characters allowed`;if(e.config?.pattern)try{if(!new RegExp(e.config.pattern).test(p))return e.config.customErrorMessage||"Invalid format"}catch{return"Invalid validation pattern configured"}return null}function l(){const p=o(u(s));W(r,p,!0),p||(t(u(s)),a(u(s)))}var c=eR(),d=ee(c);{let p=z(()=>e.config?.placeholder),m=z(()=>e.config?.maxLength),x=z(()=>u(r)?!0:void 0),v=z(()=>u(r)?!0:void 0),g=z(()=>u(r)?"border-destructive":"");_s(d,{get id(){return e.inputId},type:"text",get placeholder(){return u(p)},get maxlength(){return u(m)},get"data-invalid"(){return u(x)},get"aria-invalid"(){return u(v)},get class(){return u(g)},get disabled(){return i()},oninput:()=>{W(r,null),l()},onblur:y=>{const w=y.currentTarget.value,b=o(w);W(r,b,!0),b||(W(s,w,!0),t(w),e.onChange(w))},get value(){return u(s)},set value(y){W(s,y,!0)}})}var f=ae(d,2);{var h=p=>{var m=we(),x=ee(m);Ne(x,()=>Ig,(v,g)=>{g(v,{children:(y,w)=>{yt();var b=Et();Me(()=>Ae(b,u(r))),P(y,b)},$$slots:{default:!0}})}),P(p,m)};xe(f,p=>{u(r)&&p(h)})}P(n,c),at()}const Ug=Symbol("client-slot-context");function nR(n){Cu(Ug,n)}function iR(){return Ms(Ug)}var rR=Z("<!> <!>",1),sR=Z("<!> <!>",1),aR=Z(" <!>",1),oR=Z("<!> <!>",1),lR=Z("<!> <!>",1),cR=Z("<!> <!>",1),uR=Z('<span class="text-xs font-normal text-muted-foreground"> </span>'),dR=Z(" <!> <!>",1),hR=Z('<p class="text-sm text-muted-foreground">No options available yet.</p>'),fR=Z("<!> <!>",1);function pR(n,e){st(e,!0);let t=le(e,"value",15,void 0),i=le(e,"disabled",3,!1);const r=z(()=>`input-${e.item.paramId}`),s=z(()=>e.displayName||e.item.displayName||e.item.paramId),a=z(()=>{const b=e.item.source;return b?.kind==="client"&&b.client?.presentation==="slot"}),o=iR(),l=z(()=>{if(!pc(e.item))return null;const b=e.item.config;if(b?.hideRange)return null;const E=typeof b?.minimum=="number",S=typeof b?.maximum=="number";return!E&&!S?null:E&&S?`${b.minimum} to ${b.maximum}`:E?`≥ ${b.minimum}`:`≤ ${b.maximum}`}),c=z(()=>pc(e.item)&&u(l)!==null),d=z(()=>xo(e.item)?e.item.config:void 0),f=z(()=>e.dynamicOptions&&Object.keys(e.dynamicOptions).length>0?e.dynamicOptions:Object.fromEntries(Object.entries(u(d)?.defaultOptions??{}).filter(b=>b[1]!==void 0))),h=z(()=>Object.keys(u(f)).length>0),p=z(()=>({options:u(f),displayAs:u(d)?.displayAs??"dropdown"})),m=z(()=>xo(e.item)&&!u(h)&&(u(d)?.emptyBehavior??"hide")==="hide");Pt(()=>{if(!xo(e.item)||!u(h))return;const b=new Set(Object.values(u(f)));if(Array.isArray(t())){const E=t().filter(S=>typeof S=="string"&&b.has(S));E.length!==t().length&&e.onChange(e.item.paramId,E.length>0?E:[Object.values(u(f))[0]],!0)}else typeof t()=="string"&&t()&&!b.has(t())&&e.onChange(e.item.paramId,Object.values(u(f))[0],!0)});function x(b){t(b),e.onChange(e.item.paramId,b)}var v=we(),g=ee(v);{var y=b=>{var E=we(),S=ee(E);{var A=_=>{var T=we(),D=ee(T);Ne(D,()=>Eu,(L,F)=>{F(L,{children:(B,U)=>{var N=oR(),R=ee(N);Ne(R,()=>Tu,(Y,K)=>{K(Y,{class:"gap-2 flex items-center",children:(ne,ce)=>{yt();var k=aR(),te=ee(k),fe=ae(te);{var me=G=>{var Q=we(),j=ee(Q);Ne(j,()=>wr,(se,ue)=>{ue(se,{children:(be,Fe)=>{var Ue=sR(),Pe=ee(Ue);Ne(Pe,()=>mc,(Ie,We)=>{We(Ie,{class:"p-1 cursor-help opacity-60 transition-opacity hover:opacity-100",children:(ze,He)=>{ch(ze,{size:16})},$$slots:{default:!0}})});var ke=ae(Pe,2);Ne(ke,()=>Er,(Ie,We)=>{We(Ie,{class:"sm:max-w-md",children:(ze,He)=>{var V=we(),je=ee(V);Ne(je,()=>ms,(Ve,Xe)=>{Xe(Ve,{children:(Se,Ce)=>{var C=rR(),M=ee(C);Ne(M,()=>dr,(re,de)=>{de(re,{children:(ye,ve)=>{yt();var oe=Et();Me(()=>Ae(oe,u(s))),P(ye,oe)},$$slots:{default:!0}})});var H=ae(M,2);Ne(H,()=>gs,(re,de)=>{de(re,{children:(ye,ve)=>{yt();var oe=Et();Me(()=>Ae(oe,e.item.description)),P(ye,oe)},$$slots:{default:!0}})}),P(Se,C)},$$slots:{default:!0}})}),P(ze,V)},$$slots:{default:!0}})}),P(be,Ue)},$$slots:{default:!0}})}),P(G,Q)};xe(fe,G=>{e.item.description&&G(me)})}Me(()=>Ae(te,`${u(s)??""} `)),P(ne,k)},$$slots:{default:!0}})});var O=ae(R,2);o(O,()=>({inputId:e.item.paramId,displayName:u(s),value:t(),onValueChange:x})),P(B,N)},$$slots:{default:!0}})}),P(_,T)};xe(S,_=>{o&&_(A)})}P(b,E)},w=b=>{var E=we(),S=ee(E);Ne(S,()=>Eu,(A,_)=>{_(A,{children:(T,D)=>{var L=fR(),F=ee(L);Ne(F,()=>Tu,(j,se)=>{se(j,{get for(){return u(r)},class:"gap-2 flex items-center",children:(ue,be)=>{yt();var Fe=dR(),Ue=ee(Fe),Pe=ae(Ue);{var ke=ze=>{var He=we(),V=ee(He);Ne(V,()=>wr,(je,Ve)=>{Ve(je,{children:(Xe,Se)=>{var Ce=cR(),C=ee(Ce);Ne(C,()=>mc,(H,re)=>{re(H,{class:"p-1 cursor-help opacity-60 transition-opacity hover:opacity-100",children:(de,ye)=>{ch(de,{size:16})},$$slots:{default:!0}})});var M=ae(C,2);Ne(M,()=>Er,(H,re)=>{re(H,{class:"sm:max-w-md",children:(de,ye)=>{var ve=we(),oe=ee(ve);Ne(oe,()=>ms,(pe,Re)=>{Re(pe,{children:(Le,Ee)=>{var De=lR(),et=ee(De);Ne(et,()=>dr,(ht,J)=>{J(ht,{children:(Ge,Te)=>{yt();var Ze=Et();Me(()=>Ae(Ze,u(s))),P(Ge,Ze)},$$slots:{default:!0}})});var Ye=ae(et,2);Ne(Ye,()=>gs,(ht,J)=>{J(ht,{children:(Ge,Te)=>{yt();var Ze=Et();Me(()=>Ae(Ze,e.item.description)),P(Ge,Ze)},$$slots:{default:!0}})}),P(Le,De)},$$slots:{default:!0}})}),P(de,ve)},$$slots:{default:!0}})}),P(Xe,Ce)},$$slots:{default:!0}})}),P(ze,He)};xe(Pe,ze=>{e.item.description&&ze(ke)})}var Ie=ae(Pe,2);{var We=ze=>{var He=uR(),V=$(He,!0);q(He),Me(()=>Ae(V,u(l))),P(ze,He)};xe(Ie,ze=>{u(c)&&ze(We)})}Me(()=>Ae(Ue,`${u(s)??""} `)),P(ue,Fe)},$$slots:{default:!0}})});var B=ae(F,2);{var U=j=>{const se=z(()=>e.item.config);{let ue=z(()=>typeof t()=="number"?t():void 0);QP(j,{get inputId(){return u(r)},get value(){return u(ue)},get config(){return u(se)},onChange:x,get disabled(){return i()}})}},N=z(()=>pc(e.item)),R=j=>{{let se=z(()=>typeof t()=="boolean"?t():void 0);AP(j,{get inputId(){return u(r)},get value(){return u(se)},onChange:x,get disabled(){return i()}})}},O=z(()=>gP(e.item)),Y=j=>{const se=z(()=>e.item.config);{let ue=z(()=>typeof t()=="string"?t():"");tR(j,{get inputId(){return u(r)},get value(){return u(ue)},get config(){return u(se)},onChange:x,get disabled(){return i()}})}},K=z(()=>pP(e.item)),ne=j=>{const se=z(()=>e.item.config);var ue=we(),be=ee(ue);{var Fe=Pe=>{{let ke=z(()=>Array.isArray(t())?t():typeof t()=="string"&&t()?[t()]:[]);lp(Pe,{get inputId(){return u(r)},get value(){return u(ke)},get config(){return u(se)},onChange:x,get disabled(){return i()}})}},Ue=Pe=>{{let ke=z(()=>typeof t()=="string"?t():"");cp(Pe,{get value(){return u(ke)},get config(){return u(se)},onChange:x,get disabled(){return i()}})}};xe(be,Pe=>{u(se).displayAs==="checklist"?Pe(Fe):Pe(Ue,-1)})}P(j,ue)},ce=z(()=>mP(e.item)),k=j=>{var se=we(),ue=ee(se);{var be=Ue=>{var Pe=we(),ke=ee(Pe);{var Ie=ze=>{{let He=z(()=>Array.isArray(t())?t():typeof t()=="string"&&t()?[t()]:[]);lp(ze,{get inputId(){return u(r)},get value(){return u(He)},get config(){return u(p)},onChange:x,get disabled(){return i()}})}},We=ze=>{{let He=z(()=>typeof t()=="string"?t():"");cp(ze,{get value(){return u(He)},get config(){return u(p)},onChange:x,get disabled(){return i()}})}};xe(ke,ze=>{u(p).displayAs==="checklist"?ze(Ie):ze(We,-1)})}P(Ue,Pe)},Fe=Ue=>{var Pe=hR();P(Ue,Pe)};xe(ue,Ue=>{u(h)?Ue(be):Ue(Fe,-1)})}P(j,se)},te=z(()=>xo(e.item)),fe=j=>{const se=z(()=>e.item.config);{let ue=z(()=>typeof t()=="string"?t():""),be=z(()=>u(se)?.acceptedFormats??[]),Fe=z(()=>u(se)?.defaultInputMode),Ue=z(()=>u(se)?.allowedInputModes);jP(j,{get value(){return u(ue)},get acceptedFormats(){return u(be)},onChange:Pe=>x(Pe),get defaultInputMode(){return u(Fe)},get allowedInputModes(){return u(Ue)}})}},me=z(()=>vP(e.item)),G=j=>{{let se=z(()=>typeof t()=="string"?t():"#000000");DP(j,{get value(){return u(se)},onChange:ue=>x(ue)})}},Q=z(()=>_P(e.item));xe(B,j=>{u(N)?j(U):u(O)?j(R,1):u(K)?j(Y,2):u(ce)?j(ne,3):u(te)?j(k,4):u(me)?j(fe,5):u(Q)&&j(G,6)})}P(T,L)},$$slots:{default:!0}})}),P(b,E)};xe(g,b=>{u(a)?b(y):u(m)||b(w,1)})}P(n,v),at()}const $s=new Map;function mR(n,e){if($s.has(n))return $s.get(n);if(document.querySelector(`script[src="${n}"]`)){const i=Promise.resolve();return $s.set(n,i),i}const t=new Promise((i,r)=>{const s=document.createElement("script");s.src=n,e?.crossOrigin&&(s.crossOrigin=e.crossOrigin),e?.async!==void 0&&(s.async=e.async),e?.defer!==void 0&&(s.defer=e.defer),s.onload=()=>i(),s.onerror=()=>{$s.delete(n),r(new Error(`Failed to load script: ${n}`))},document.head.appendChild(s)});return $s.set(n,t),t}var gR=Z('<div class="px-4 py-3 text-sm text-destructive"> </div>'),vR=Z('<div class="px-4 py-8 text-sm text-center text-muted-foreground">Receiving chart data...</div>'),_R=Z('<div class="px-4 py-8 text-sm text-center text-muted-foreground">Waiting for chart data...</div>'),xR=Z('<div class="rounded p-1.5 backdrop-blur-sm flex items-center border border-border bg-background/80 text-muted-foreground"><!></div>'),bR=Z('<div class="w-full"></div> <div><!> <button class="rounded p-1.5 backdrop-blur-sm flex items-center border border-border bg-background/80 text-foreground transition-colors hover:bg-background disabled:cursor-not-allowed disabled:opacity-50"><!></button></div>',1),yR=Z("<div><!></div>");function SR(n,e){st(e,!0);const t=new Set(["scattermap","scattermapbox","choropleth","scattergeo"]),i=z(()=>{if(!e.value)return null;try{return JSON.parse(e.value)}catch{return null}});let r=Oe(null),s=Oe(null),a=Oe(!1),o=Oe(null),l=Oe(!1),c=!1;async function d(){return window.Plotly||await mR("https://cdn.plot.ly/plotly-3.4.0.min.js",{crossOrigin:"anonymous"}),window.Plotly}function f(){u(s)&&(document.fullscreenElement?document.exitFullscreen().catch(E=>{W(o,`Exit fullscreen failed: ${E.message}`)}):u(s).requestFullscreen().catch(E=>{W(o,`Fullscreen unavailable: ${E.message}`)}))}Pt(()=>{function E(){W(l,!!document.fullscreenElement),Promise.resolve().then(()=>{u(r)&&window.Plotly&&window.Plotly.Plots.resize(u(r))})}return document.addEventListener("fullscreenchange",E),()=>document.removeEventListener("fullscreenchange",E)});function h(){if(!u(r))return{textColor:"#333",gridColor:"#eee"};const E=getComputedStyle(u(r)),S=E.getPropertyValue("color").trim()||"#333",A=E.getPropertyValue("--border")?.trim()||E.getPropertyValue("--color-border")?.trim()||"rgba(128,128,128,0.2)";return{textColor:S,gridColor:A}}async function p(){if(!(!u(r)||!u(i))){W(o,null),W(a,!0);try{const E=await d(),{textColor:S,gridColor:A}=h(),_=u(i).data?.some(N=>t.has(N.type)),{title:T,template:D,height:L,width:F,...B}=u(i).layout,U={...B,autosize:!0,margin:{t:24,r:8,b:40,l:60,pad:0},font:{color:S},paper_bgcolor:B.paper_bgcolor??"transparent",plot_bgcolor:B.plot_bgcolor??"transparent",...!_&&B.xaxis?{xaxis:{...B.xaxis,gridcolor:A,color:S}}:{},...!_&&B.yaxis?{yaxis:{...B.yaxis,gridcolor:A,color:S}}:{}};E.react(u(r),u(i).data,U,{responsive:!0,displayModeBar:"hover",displaylogo:!1,modeBarButtonsToRemove:["sendDataToCloud","lasso2d","select2d"],...u(i).config})}catch(E){W(o,E instanceof Error?E.message:"Failed to render chart",!0)}finally{W(a,!1)}}}tl(()=>{c=!0;let E=null;const S=new ResizeObserver(()=>{E&&clearTimeout(E),E=setTimeout(()=>{u(r)&&window.Plotly&&window.Plotly.Plots.resize(u(r)),E=null},150)});return u(s)&&S.observe(u(s)),()=>{S.disconnect(),E&&clearTimeout(E),u(r)&&window.Plotly&&window.Plotly.purge(u(r))}});let m=null;Pt(()=>{if(!(!e.value||!c||!u(r)))return m&&clearTimeout(m),m=setTimeout(()=>{p(),m=null},150),()=>{m&&clearTimeout(m)}});var x=yR(),v=$(x);{var g=E=>{var S=gR(),A=$(S,!0);q(S),Me(()=>Ae(A,u(o))),P(E,S)},y=E=>{var S=vR();P(E,S)},w=E=>{var S=_R();P(E,S)},b=E=>{var S=bR(),A=ee(S);ui(A,N=>W(r,N),()=>u(r));var _=ae(A,2),T=$(_);{var D=N=>{var R=xR(),O=$(R);Uu(O,{size:14,class:"animate-spin"}),q(R),P(N,R)};xe(T,N=>{u(a)&&N(D)})}var L=ae(T,2),F=$(L);{var B=N=>{Ou(N,{size:14})},U=N=>{Fu(N,{size:14})};xe(F,N=>{u(l)?N(B):N(U,-1)})}q(L),q(_),Me(()=>{Ii(A,`height: ${u(l)?"100vh":"380px"};`),Dt(_,1,`gap-1 left-2 top-2 absolute z-10 flex items-center opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 ${u(l)?"opacity-100":""}`),L.disabled=u(a),Qt(L,"title",u(l)?"Exit fullscreen":"Fullscreen")}),Xt("click",L,f),P(E,S)};xe(v,E=>{u(o)?E(g):!u(i)&&e.value?E(y,1):u(i)?E(b,-1):E(w,2)})}q(x),ui(x,E=>W(s,E),()=>u(s)),Me(()=>Dt(x,1,`group rounded relative overflow-hidden border border-border ${u(l)?"bg-background":""}`)),P(n,x),at()}zi(["click"]);var MR=Z('<div class="px-4 py-3 text-sm text-destructive"> </div>'),wR=Z('<div class="px-4 py-8 text-sm text-center text-muted-foreground">Waiting for image...</div>'),ER=Z(`<div class="px-4 py-3 text-sm text-destructive">Unsupported image format: <span class="font-mono"> </span>. Supported:
5019
5019
  .png, .jpg, .jpeg, .webp, .gif, .svg</div>`),TR=Z('<button title="Download image" class="rounded p-1.5 backdrop-blur-sm flex items-center border border-border bg-background/80 text-foreground transition-colors hover:bg-background disabled:cursor-not-allowed disabled:opacity-50"><!></button>'),AR=Z('<button class="rounded p-1.5 backdrop-blur-sm flex items-center border border-border bg-background/80 text-foreground transition-colors hover:bg-background"><!></button>'),CR=Z("<div><!> <!></div>"),PR=Z('<div class="w-full"><img class="h-full w-full object-contain"/></div> <!>',1),RR=Z("<div><!></div>");function DR(n,e){st(e,!0);const t=new Set([".png",".jpg",".jpeg",".webp",".gif",".svg"]),i=z(()=>Array.isArray(e.value)?e.value.find(No)??null:No(e.value)?e.value:null),r=z(()=>u(i)?(u(i).fileType??"").toLowerCase():""),s=z(()=>t.has(u(r))),a=z(()=>{if(!u(i)||!u(s))return null;const A=Kg[u(r)]??"application/octet-stream";return u(i).isBase64Encoded?`data:${A};base64,${u(i).data}`:`data:${A};utf8,${encodeURIComponent(u(i).data)}`}),o=z(()=>e.item.config??{}),l=z(()=>u(o).allowDownload??!0),c=z(()=>u(o).allowFullscreen??!0),d=z(()=>u(o).backgroundColor);let f=Oe(null),h=Oe(!1),p=Oe(!1),m=Oe(null);function x(){u(f)&&(document.fullscreenElement?document.exitFullscreen().catch(A=>{W(m,`Exit fullscreen failed: ${A.message}`)}):u(f).requestFullscreen().catch(A=>{W(m,`Fullscreen unavailable: ${A.message}`)}))}Pt(()=>{function A(){W(h,!!document.fullscreenElement)}return document.addEventListener("fullscreenchange",A),()=>document.removeEventListener("fullscreenchange",A)});async function v(){if(u(i)){W(p,!0),W(m,null);try{await gc(u(i),u(i).fileName)}catch(A){W(m,A instanceof Error?A.message:"Download failed",!0)}finally{W(p,!1)}}}var g=RR(),y=$(g);{var w=A=>{var _=MR(),T=$(_,!0);q(_),Me(()=>Ae(T,u(m))),P(A,_)},b=A=>{var _=wR();P(A,_)},E=A=>{var _=ER(),T=ae($(_)),D=$(T,!0);q(T),yt(),q(_),Me(()=>Ae(D,u(r)||"(unknown)")),P(A,_)},S=A=>{var _=PR(),T=ee(_),D=$(T);q(T);var L=ae(T,2);{var F=B=>{var U=CR(),N=$(U);{var R=K=>{var ne=TR(),ce=$(ne);zp(ce,{size:14}),q(ne),Me(()=>ne.disabled=u(p)),Xt("click",ne,v),P(K,ne)};xe(N,K=>{u(l)&&u(i)&&K(R)})}var O=ae(N,2);{var Y=K=>{var ne=AR(),ce=$(ne);{var k=fe=>{Ou(fe,{size:14})},te=fe=>{Fu(fe,{size:14})};xe(ce,fe=>{u(h)?fe(k):fe(te,-1)})}q(ne),Me(()=>Qt(ne,"title",u(h)?"Exit fullscreen":"Fullscreen")),Xt("click",ne,x),P(K,ne)};xe(O,K=>{u(c)&&K(Y)})}q(U),Me(()=>Dt(U,1,`gap-1 right-2 top-2 absolute z-10 flex items-center opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 ${u(h)?"opacity-100":""}`)),P(B,U)};xe(L,B=>{(u(l)||u(c))&&B(F)})}Me(()=>{Ii(T,`height: ${u(h)?"100vh":"380px"}; ${u(d)?`background-color: ${u(d)};`:""}`),Qt(D,"src",u(a)),Qt(D,"alt",e.item.displayName??u(i).fileName)}),P(A,_)};xe(y,A=>{u(m)?A(w):u(i)?u(s)?A(S,-1):A(E,2):A(b,1)})}q(g),ui(g,A=>W(f,A),()=>u(f)),Me(()=>Dt(g,1,`group rounded relative overflow-hidden border border-border ${u(h)?"bg-background":""}`)),P(n,g),at()}zi(["click"]);const up=n=>{var e=UR();P(n,e)};var LR=Z("<!> <!>",1),IR=Z("<!> <!>",1),NR=Z('<div class="gap-2 flex items-center"><!> <!></div>'),UR=Z('<span class="text-muted-foreground not-italic">Waiting for data...</span>'),FR=Z('<div class="ml-4 pl-2 border-l border-border/50"><!></div>'),OR=Z('<div><button class="gap-1.5 py-0.5 text-xs flex w-full items-center text-muted-foreground transition-colors hover:text-foreground"><!> <!> <span class="font-medium"> </span></button> <!></div>'),zR=Z('<div class="gap-1.5 py-0.5 flex items-center justify-between"><div class="gap-1.5 min-w-0 flex items-center"><!> <span class="text-xs truncate text-foreground"> </span></div> <span class="text-xs shrink-0 text-muted-foreground"> </span></div>'),BR=Z('<div class="rounded px-3 py-3 text-sm border border-border bg-muted text-muted-foreground">Waiting for file data...</div>'),kR=Z('<div class="gap-2 text-xs flex items-center justify-between text-muted-foreground"><span class="min-w-0 truncate"> </span> <span class="shrink-0"> </span></div>'),VR=Z('<div class="gap-1 flex flex-col"></div>'),HR=Z('<div class="mt-2"><!></div>'),GR=Z('<li class="truncate"><span class="font-mono"> </span></li>'),WR=Z('<div class="rounded px-3 py-2 text-sm border border-destructive bg-destructive/10 text-destructive"><div class="font-medium">Duplicate file names detected</div> <div class="mt-1 text-xs"> </div> <ul class="mt-1 ml-4 text-xs list-disc"></ul> <div class="mt-1 text-xs">Rename outputs in your Grasshopper definition so each file has a unique name.</div></div>'),XR=Z('<div class="rounded px-3 py-2 text-sm border border-destructive bg-destructive/10 text-destructive"> </div>'),jR=Z('<div class="gap-2 flex flex-col"><div class="rounded px-3 py-2 border border-border bg-muted"><div class="gap-2 flex items-center justify-between"><span class="min-w-0 text-sm font-medium truncate text-foreground"> </span> <span class="text-xs shrink-0 text-muted-foreground"> </span></div> <!></div> <!> <!> <!></div>'),qR=Z('<span class="font-bold text-primary"> </span>'),YR=Z("<div><!></div>"),KR=Z("<pre> </pre>"),ZR=Z("<div><!></div>"),$R=Z('<div class="group relative"><!> <!></div>'),JR=Z('<div class="gap-2 flex flex-col"><!> <!></div>');function QR(n,e){st(e,!0);const t=U=>{var N=NR(),R=$(N);or(R,{children:(K,ne)=>{yt();var ce=Et();Me(()=>Ae(ce,u(o))),P(K,ce)},$$slots:{default:!0}});var O=ae(R,2);{var Y=K=>{var ne=we(),ce=ee(ne);Ne(ce,()=>wr,(k,te)=>{te(k,{children:(fe,me)=>{var G=IR(),Q=ee(G);Ne(Q,()=>mc,(se,ue)=>{ue(se,{class:"p-1 cursor-help opacity-60 transition-opacity hover:opacity-100",children:(be,Fe)=>{Hv(be,{size:16})},$$slots:{default:!0}})});var j=ae(Q,2);Ne(j,()=>Er,(se,ue)=>{ue(se,{class:"sm:max-w-md",children:(be,Fe)=>{var Ue=we(),Pe=ee(Ue);Ne(Pe,()=>ms,(ke,Ie)=>{Ie(ke,{children:(We,ze)=>{var He=LR(),V=ee(He);Ne(V,()=>dr,(Ve,Xe)=>{Xe(Ve,{children:(Se,Ce)=>{yt();var C=Et();Me(()=>Ae(C,u(o))),P(Se,C)},$$slots:{default:!0}})});var je=ae(V,2);Ne(je,()=>gs,(Ve,Xe)=>{Xe(Ve,{children:(Se,Ce)=>{yt();var C=Et();Me(()=>Ae(C,e.item.description)),P(Se,C)},$$slots:{default:!0}})}),P(We,He)},$$slots:{default:!0}})}),P(be,Ue)},$$slots:{default:!0}})}),P(fe,G)},$$slots:{default:!0}})}),P(K,ne)};xe(O,K=>{e.item.description&&K(Y)})}q(N),P(U,N)},i=(U,N=wt,R=wt)=>{var O=we(),Y=ee(O);Zt(Y,17,N,([K,ne])=>K,(K,ne)=>{var ce=z(()=>Mr(u(ne),2));let k=()=>u(ce)[1];var te=we(),fe=ee(te);{var me=Q=>{const j=z(()=>R()?`${R()}/${k().name}`:k().name),se=z(()=>_.has(u(j)));var ue=OR(),be=$(ue),Fe=$(be);{let V=z(()=>u(se)?"rotate-90":"");Du(Fe,{size:12,get class(){return`shrink-0 transition-transform duration-150 ${u(V)??""}`}})}var Ue=ae(Fe,2);{var Pe=V=>{Wv(V,{size:13,class:"shrink-0 text-primary/70"})},ke=V=>{Qv(V,{size:13,class:"shrink-0 text-primary/70"})};xe(Ue,V=>{u(se)?V(Pe):V(ke,-1)})}var Ie=ae(Ue,2),We=$(Ie,!0);q(Ie),q(be);var ze=ae(be,2);{var He=V=>{var je=FR(),Ve=$(je);i(Ve,()=>k().children,()=>u(j)),q(je),P(V,je)};xe(ze,V=>{u(se)&&V(He)})}q(ue),Me(()=>Ae(We,k().name)),Xt("click",be,()=>T(u(j))),P(Q,ue)},G=Q=>{var j=zR(),se=$(j),ue=$(se);Jv(ue,{size:12,class:"shrink-0 text-muted-foreground"});var be=ae(ue,2),Fe=$(be);q(be),q(se);var Ue=ae(se,2),Pe=$(Ue,!0);q(Ue),q(j),Me(ke=>{Ae(Fe,`${k().file.fileName??""}${k().file.fileType??""}`),Ae(Pe,ke)},[()=>_l(xl(k().file.data))]),P(Q,j)};xe(fe,Q=>{k().type==="folder"?Q(me):Q(G,-1)})}P(K,te)}),P(U,O)},r=U=>{var N=we(),R=ee(N);{var O=K=>{var ne=BR();P(K,ne)},Y=K=>{var ne=jR(),ce=$(ne),k=$(ce),te=$(k),fe=$(te,!0);q(te);var me=ae(te,2),G=$(me,!0);q(me),q(k);var Q=ae(k,2);{var j=Pe=>{var ke=HR(),Ie=$(ke);{var We=He=>{i(He,()=>u(b),()=>"")},ze=He=>{var V=VR();Zt(V,23,()=>u(m),(je,Ve)=>E(je)+"#"+Ve,(je,Ve)=>{var Xe=kR(),Se=$(Xe),Ce=$(Se);q(Se);var C=ae(Se,2),M=$(C,!0);q(C),q(Xe),Me(H=>{Ae(Ce,`${u(Ve).fileName??""}${u(Ve).fileType??""}`),Ae(M,H)},[()=>_l(xl(u(Ve).data))]),P(je,Xe)}),q(V),P(He,V)};xe(Ie,He=>{u(b)?He(We):He(ze,-1)})}q(ke),P(Pe,ke)};xe(Q,Pe=>{u(x)>1&&Pe(j)})}q(ce);var se=ae(ce,2);{var ue=Pe=>{var ke=WR(),Ie=ae($(ke),2),We=$(Ie);q(Ie);var ze=ae(Ie,2);Zt(ze,20,()=>u(S),He=>He,(He,V)=>{var je=GR(),Ve=$(je),Xe=$(Ve,!0);q(Ve),q(je),Me(()=>Ae(Xe,V)),P(He,je)}),q(ze),yt(2),q(ke),Me(()=>Ae(We,`The following ${u(S).length===1?"path appears":"paths appear"} more than once:`)),P(Pe,ke)};xe(se,Pe=>{u(A)&&Pe(ue)})}var be=ae(se,2);{var Fe=Pe=>{var ke=XR(),Ie=$(ke,!0);q(ke),Me(()=>Ae(Ie,u(p))),P(Pe,ke)};xe(be,Pe=>{u(p)&&Pe(Fe)})}var Ue=ae(be,2);{let Pe=z(()=>u(h)||u(A));Bn(Ue,{onclick:D,get disabled(){return u(Pe)},class:"w-full",children:(ke,Ie)=>{yt();var We=Et();Me(()=>Ae(We,u(h)?"Downloading...":`Download ${u(x)===1?"File":`${u(x)} Files`}`)),P(ke,We)},$$slots:{default:!0}})}q(ne),Me(Pe=>{Ae(fe,u(x)===1?`${u(m)[0].fileName}${u(m)[0].fileType}`:`${u(x)} files`),Ae(G,Pe)},[()=>_l(u(v))]),P(K,ne)};xe(R,K=>{u(x)===0?K(O):K(Y,-1)})}P(U,N)};let s=Oe(!1),a;const o=z(()=>e.displayName||e.item.displayName||e.item.paramId),l=z(()=>typeof e.value=="object"&&e.value!==null),c=z(()=>e.value==null?"":u(l)?JSON.stringify(e.value,null,2):String(e.value)),d=z(()=>e.value!=null);async function f(){try{await navigator.clipboard.writeText(u(c)),W(s,!0),clearTimeout(a),a=setTimeout(()=>W(s,!1),2e3)}catch(U){console.error("Failed to copy:",U)}}let h=Oe(!1),p=Oe(null);const m=z(()=>e.value?Array.isArray(e.value)?e.value.filter(No):No(e.value)?[e.value]:[]:[]),x=z(()=>u(m).length),v=z(()=>u(m).reduce((U,N)=>U+xl(N.data),0));function g(U){const N=new Fo;for(let R=0;R<U.length;R++){const O=U[R],Y=(O.subFolder||"").split("/").filter(Boolean);let K=N;for(const k of Y){K.has(k)||K.set(k,{type:"folder",name:k,children:new Fo});const te=K.get(k);te.type==="folder"&&(K=te.children)}const ne=`${O.fileName}${O.fileType??""}`,ce=K.has(ne)?`${ne}#${R}`:ne;K.set(ce,{type:"file",file:O})}return N}function y(U,N=""){const R=[];for(const[O,Y]of U)if(Y.type==="folder"){const K=N?`${N}/${O}`:O;R.push(K),R.push(...y(Y.children,K))}return R}const w=z(()=>u(m).some(U=>U.subFolder&&U.subFolder.length>0)),b=z(()=>u(w)?g(u(m)):null);function E(U){const N=(U.subFolder||"").replace(/^\/+|\/+$/g,""),R=`${U.fileName}${U.fileType??""}`;return N?`${N}/${R}`:R}const S=z(()=>{const U={};for(const N of u(m)){const R=E(N);U[R]=(U[R]??0)+1}return Object.entries(U).filter(([,N])=>N>1).map(([N])=>N)}),A=z(()=>u(S).length>0);let _=new na;Pt(()=>{if(u(b)){_.clear();for(const U of y(u(b)))_.add(U)}});function T(U){_.has(U)?_.delete(U):_.add(U)}async function D(){if(u(x)!==0){W(h,!0),W(p,null);try{if(u(x)===1)await gc(u(m)[0],u(m)[0].fileName);else{const U=e.displayName?e.displayName.replace(/[^a-z0-9]/gi,"_").toLowerCase():"download";await gc(u(m),U)}}catch(U){W(p,U instanceof Error?U.message:"Failed to download files",!0),console.error("[OutputDisplayWidget] Download error:",U)}finally{W(h,!1)}}}var L=we(),F=ee(L);{var B=U=>{var N=JR(),R=$(N);t(R);var O=ae(R,2);{var Y=te=>{{let fe=z(()=>typeof e.value=="string"?e.value:e.value!=null?JSON.stringify(e.value):"");SR(te,{get item(){return e.item},get value(){return u(fe)}})}},K=te=>{DR(te,{get item(){return e.item},get value(){return e.value}})},ne=te=>{r(te)},ce=te=>{var fe=YR();Dt(fe,1,"min-h-12.5 rounded px-3 py-3 font-mono text-sm border border-border flex items-center bg-muted/50 wrap-break-word");var me=$(fe);{var G=j=>{var se=qR(),ue=$(se,!0);q(se),Me(()=>Ae(ue,u(c))),P(j,se)},Q=j=>{up(j)};xe(me,j=>{u(d)?j(G):j(Q,-1)})}q(fe),P(te,fe)},k=te=>{var fe=$R(),me=$(fe);{var G=ue=>{var be=KR();Dt(be,1,"min-h-12.5 rounded px-3 py-3 font-mono text-sm border border-border overflow-wrap-anywhere max-h-96 overflow-auto bg-muted/10 text-foreground");var Fe=$(be,!0);q(be),Me(()=>Ae(Fe,u(c))),P(ue,be)},Q=ue=>{var be=ZR();Dt(be,1,"min-h-12.5 rounded px-3 py-3 font-mono text-sm border border-border overflow-wrap-anywhere bg-muted/10 wrap-break-word whitespace-pre-wrap text-foreground");var Fe=$(be);{var Ue=ke=>{var Ie=Et();Me(()=>Ae(Ie,e.value)),P(ke,Ie)},Pe=ke=>{up(ke)};xe(Fe,ke=>{u(d)?ke(Ue):ke(Pe,-1)})}q(be),P(ue,be)};xe(me,ue=>{u(l)?ue(G):ue(Q,-1)})}var j=ae(me,2);{var se=ue=>{{let be=z(()=>u(s)?"opacity-100":"opacity-0 group-hover:opacity-100");Bn(ue,{onclick:f,get class(){return`right-2 top-2 absolute transition-opacity ${u(be)??""}`},size:"sm",children:(Fe,Ue)=>{yt();var Pe=Et();Me(()=>Ae(Pe,u(s)?"Copied!":"Copy")),P(Fe,Pe)},$$slots:{default:!0}})}};xe(j,ue=>{u(d)&&ue(se)})}q(fe),P(te,fe)};xe(O,te=>{e.item.widgetType==="chart"?te(Y):e.item.widgetType==="image"?te(K,1):e.item.widgetType==="file"?te(ne,2):e.item.widgetType==="number"?te(ce,3):e.item.widgetType==="text"&&te(k,4)})}q(N),P(U,N)};xe(F,U=>{e.item.widgetType!=="dynamicValueList"&&U(B)})}P(n,L),at()}zi(["click"]);var e3=Z('<div class="gap-8 flex flex-col"></div>'),t3=Z('<div class="p-4 tab-content-container svelte-jdukda"><!></div>');function n3(n,e){st(e,!0);const t=(f,h=wt,p=wt)=>{const m=z(()=>o(h().paramId));var x=we(),v=ee(x);{var g=y=>{pR(y,{get item(){return h()},get value(){return e.values[u(m).id]},get displayName(){return h().displayName},get onChange(){return e.onValueChange},get disabled(){return p().disabled},get dynamicOptions(){return a()[u(m).id]}})};xe(v,y=>{u(m)&&y(g)})}P(f,x)},i=(f,h=wt)=>{const p=z(()=>l(h().paramId));var m=we(),x=ee(m);{var v=g=>{QR(g,{get item(){return h()},get value(){return e.values[h().paramId]},get displayName(){return h().displayName}})};xe(x,g=>{u(p)&&g(v)})}P(f,m)},r=Si(),s=z(()=>r.messages);let a=le(e,"dynamicOptions",19,()=>({}));function o(f){return e.inputs.find(h=>h.id===f)}function l(f){return e.outputs.find(h=>h.id===f)}var c=we(),d=ee(c);Ne(d,()=>Lv,(f,h)=>{h(f,{get value(){return e.tab.id},class:"min-h-0 p-0 flex-1",children:(p,m)=>{gg(p,{class:"h-full",orientation:"vertical",children:(x,v)=>{var g=t3(),y=$(g);{var w=E=>{wu(E,{type:"empty",size:"medium",get message(){return u(s).tabNoGroups}})},b=E=>{var S=e3();Zt(S,21,()=>e.tab.groups,A=>A.id,(A,_)=>{var T=we(),D=ee(T);{var L=B=>{{let U=z(()=>u(_).columns??1),N=z(()=>e.collapsedGroups[u(_).id]??!1),R=z(()=>e.tab.groups.length===1);fP(B,{get label(){return u(_).label},get description(){return u(_).description},get items(){return u(_).items},get columns(){return u(U)},get collapsed(){return u(N)},get values(){return e.values},onToggle:()=>e.onToggleGroup(u(_).id),get inputSnippet(){return t},get outputSnippet(){return i},get flat(){return u(R)}})}},F=z(()=>sP(u(_),e.values));xe(D,B=>{u(F)&&B(L)})}P(A,T)}),q(S),P(E,S)};xe(y,E=>{e.tab.groups.length===0?E(w):E(b,-1)})}q(g),P(x,g)},$$slots:{default:!0}})},$$slots:{default:!0}})}),P(n,c),at()}function dp(n){return typeof n=="object"&&n!==null&&("targetInputId"in n||"options"in n)}function i3(n){if(dp(n))return n;let e=n;for(let t=0;t<2&&typeof e=="string";t++){try{e=JSON.parse(e)}catch{return null}if(dp(e))return e}return null}function r3(n){const e=new Map;for(const t of Lg(n)){if(t.type!=="output"||t.widgetType!=="dynamicValueList")continue;const i=t;typeof i.paramId=="string"&&e.set(i.paramId,{id:i.paramId,targetInputId:i.config?.targetInputId})}for(const t of n.outputs??[])t.type==="dynamicValueList"&&e.set(t.id,{id:t.id,targetInputId:t.targetInputId});return[...e.values()]}function s3(n,e){const t={};for(const i of r3(n)){const r=i3(e[i.id]);if(!r)continue;const s=r.targetInputId??i.targetInputId;s&&r.options&&typeof r.options=="object"&&(t[s]=r.options)}return t}var a3=Z("<!> <!>",1);function o3(n,e){st(e,!0);let t=le(e,"requestedTabId",3,null),i=Oe(""),r=Ps({});const s=z(()=>e.schema.layout.type==="tabbed"?e.schema.layout.tabs.filter(h=>e.panelFilter?e.panelFilter==="right"?h.position==="right":h.position!=="right":!0):[]),a=z(()=>u(s).length>1),o=z(()=>s3(e.schema,e.values));Pt(()=>{t()&&u(s).some(h=>h.id===t())?W(i,t()):u(s).length>0&&!u(i)&&W(i,u(s)[0].id,!0)}),Pt(()=>{if(e.schema.layout.type!=="tabbed")return;const h={};e.schema.layout.tabs.forEach(p=>p.groups.forEach(m=>{m.id in r||(h[m.id]=m.collapsed??!1)})),Object.keys(h).length>0&&Object.assign(r,h)}),Pt(()=>{if(e.schema.layout.type!=="tabbed")return;const h={};u(s).forEach(p=>p.groups.forEach(m=>{const x=Rg(m.items,e.values);m.items.forEach(v=>{if(v.type==="linebreak")return;const{visible:g,disabled:y,defaultValue:w}=x[Qo(v)],b=e.schema.inputs.find(E=>E.id===v.paramId);!b||w===void 0||(!g||y)&&e.values[b.id]!==w&&(h[b.id]=w)})})),Object.keys(h).length>0&&Object.assign(e.values,h)});function l(h){r[h]=!r[h]}function c(h){W(i,h,!0)}var d=we(),f=ee(d);Ne(f,()=>vs,(h,p)=>{p(h,{class:"pt-1 min-h-0 mx-1 flex flex-1 flex-col overflow-hidden",children:(m,x)=>{var v=we(),g=ee(v);Ne(g,()=>Iv,(y,w)=>{w(y,{get value(){return u(i)},class:"gap-0 min-h-0 flex flex-1 flex-col",children:(b,E)=>{var S=a3(),A=ee(S);{var _=D=>{JC(D,{get tabs(){return u(s)},onTabChange:c})};xe(A,D=>{u(a)&&D(_)})}var T=ae(A,2);Zt(T,17,()=>u(s),D=>D.id,(D,L)=>{n3(D,{get tab(){return u(L)},get values(){return e.values},get collapsedGroups(){return r},onToggleGroup:l,get onValueChange(){return e.onValueChange},get inputs(){return e.schema.inputs},get outputs(){return e.schema.outputs},get dynamicOptions(){return u(o)}})}),P(b,S)},$$slots:{default:!0}})}),P(m,v)},$$slots:{default:!0}})}),P(n,d),at()}var l3=Z('<span class="text-xs font-semibold"> </span>'),c3=Z('<span class="text-xs font-semibold"> </span>'),u3=Z('<button type="button"><!></button>'),d3=Z('<div role="button" tabindex="0"></div>');function hp(n,e){st(e,!0);const t=Si(),i=z(()=>t.messages),r=z(()=>["gap-1 py-2 lg:py-3 lg:flex-col lg:w-auto px-2 lg:px-0","flex w-full shrink-0 flex-row items-center","backdrop-blur-sm bg-background/90 cursor-pointer"].join(" ")),s="w-8 h-8 rounded cursor-pointer flex shrink-0 items-center justify-center text-muted-foreground transition-colors hover:bg-accent hover:text-foreground";var a=d3();Zt(a,21,()=>e.tabs,o=>o.id,(o,l)=>{var c=u3();Dt(c,1,Uo(s));var d=$(c);{var f=p=>{var m=we(),x=ee(m);{var v=w=>{Cg(w,{get icon(){return u(l).icon},class:"h-4 w-4"})},g=z(()=>u(l).icon.includes(":")),y=w=>{var b=l3(),E=$(b,!0);q(b),Me(()=>Ae(E,u(l).icon)),P(w,b)};xe(x,w=>{u(g)?w(v):w(y,-1)})}P(p,m)},h=p=>{var m=c3(),x=$(m,!0);q(m),Me(v=>Ae(x,v),[()=>u(l).label[0]?.toUpperCase()??"?"]),P(p,m)};xe(d,p=>{u(l).icon?p(f):p(h,-1)})}q(c),Me(()=>{Qt(c,"title",u(l).label),Qt(c,"aria-label",u(l).label)}),Xt("click",c,p=>{p.stopPropagation(),e.onTabClick(u(l).id)}),P(o,c)}),q(a),Me(o=>{Dt(a,1,Uo(u(r)),"svelte-17r9ylq"),Ii(a,`--collapsed-w: ${e.collapsedWidth??""}px;`),Qt(a,"aria-label",o)},[()=>u(i).expandSidePanel.replace("{side}",e.side==="left"?u(i).panelSideLeft:u(i).panelSideRight)]),Xt("click",a,function(...o){e.onExpand?.apply(this,o)}),Xt("keydown",a,o=>(o.key==="Enter"||o.key===" ")&&e.onExpand()),P(n,a),at()}zi(["click","keydown"]);function h3(n,e,t){const i=[];for(const r of Dg(n))for(const s of r.items??[]){if(s.type!=="input")continue;const a=e[s.paramId],o=n.inputs.find(l=>l.id===s.paramId);a!==void 0&&o&&i.push({paramId:s.paramId,nickname:o.nickname,displayName:s.displayName||o.nickname,paramType:o.paramType,value:a,groupName:r.label})}return{id:Xv(),name:t.name,description:t.description,timestamp:new Date().toISOString(),schemaId:n.id,documentId:n.documentId??"",projectFileName:n.projectFileName??"",pluginVersion:n.pluginVersion??"",author:t.author,tags:t.tags??[],parameters:i}}function f3(n,e){const t=[];n.documentId!==(e.documentId??"")&&t.push({paramId:"__document__",severity:"error",message:"Document ID mismatch - this state was saved for a different document",details:{expected:e.documentId??"",actual:n.documentId}}),n.schemaId!==e.id&&t.push({paramId:"__schema__",severity:"warning",message:"Schema has changed since this state was saved",details:{expected:e.id,actual:n.schemaId}});for(const r of n.parameters){const s=e.inputs.find(a=>a.id===r.paramId);if(!s){t.push({paramId:r.paramId,severity:"error",message:`Parameter "${r.nickname}" no longer exists in the schema`});continue}s.nickname!==r.nickname&&t.push({paramId:r.paramId,severity:"warning",message:"Parameter nickname changed",details:{expected:r.nickname,actual:s.nickname}})}const i=t.some(r=>r.severity==="error");return{isValid:t.length===0,issues:t,canLoad:!i}}function p3(n,e){const t={};for(const i of n.parameters)e.inputs.some(s=>s.id===i.paramId)&&(t[i.paramId]=i.value);return t}function m3(n,e){const t=f3(n,e);return{values:p3(n,e),issues:t.issues,isValid:t.isValid,canLoad:t.canLoad}}function g3(n){const e=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),t=n.name.replace(/[^a-z0-9]/gi,"_"),i=n.timestamp.split("T")[0].replace(/-/g,"_"),r=document.createElement("a");r.href=URL.createObjectURL(e),r.download=`${t}_${i}.sps`,r.click(),URL.revokeObjectURL(r.href)}async function v3(n){const e=JSON.parse(await n.text());if(!e.id||!e.name||!e.documentId||!e.parameters)throw new Error("Invalid saved state file format");return e}const _3={saveButton:"Save State",loadButton:"Load State",saveDialogTitle:"Save Parameter State",saveDialogDescription:"Save the current parameter values as a .sps file",saveNameLabel:"State Name *",saveNamePlaceholder:"e.g., Design Option A",saveDescriptionLabel:"Description",saveDescriptionPlaceholder:"Optional description of this state",saveAuthorLabel:"Author",saveAuthorPlaceholder:"Your name or email",saveTagsLabel:"Tags",saveTagsPlaceholder:"facade, option-a, client-approved (comma-separated)",saveNameRequired:"Please enter a name for this state",loadDialogTitle:"Load Parameter State",loadDialogDescription:"Select a .sps state file from your drive to load",loadFromFileButton:"Select .sps File",loadEmptyList:"No saved states found",loadImportError:"Failed to import state: ",validationTitle:"State Validation Report",validationValidatingPrefix:"Validating state: ",validationNoIssuesTitle:"No Issues Found",validationNoIssuesBody:"This state can be loaded safely.",validationWarningsTitle:"Warnings Detected",validationWarningsBody:"{count} warning(s) found, but state can still be loaded.",validationErrorsTitle:"Critical Errors",validationErrorsBody:"Cannot load this state due to critical incompatibilities.",validationIssuesHeading:"Issues:",validationExpected:"Expected:",validationActual:"Actual:",cancelButton:"Cancel",loadAnywayButton:"Load Anyway"};var x3=Z("<!> ",1),b3=Z("<!> ",1),y3=Z("<!> ",1),S3=Z("<!> <!>",1),M3=Z("<!> <!>",1),w3=Z('<!> <div class="gap-4 py-4 grid"><div class="gap-2 grid"><!> <!></div> <div class="gap-2 grid"><!> <!></div> <div class="gap-2 grid"><!> <!></div> <div class="gap-2 grid"><!> <!></div></div> <!>',1),E3=Z("<!> <!>",1),T3=Z('<p class="text-sm py-8 text-center text-muted-foreground">…</p>'),A3=Z('<p class="text-sm py-8 text-center text-destructive"> </p>'),C3=Z('<p class="text-sm py-8 text-center text-muted-foreground"> </p>'),P3=Z('<div class="text-xs mt-0.5 text-muted-foreground"> </div>'),R3=Z('<button type="button" class="p-3 w-full rounded-lg border text-left transition-colors hover:bg-muted"><div class="text-sm font-medium"> </div> <!> <div class="text-xs mt-1 text-muted-foreground"> </div></button>'),D3=Z('<div class="space-y-2"></div>'),L3=Z('<div class="py-4 max-h-[60vh] overflow-y-auto"><!></div>'),I3=Z("<!> ",1),N3=Z('<div class="py-8"><!></div>'),U3=Z("<!> <!> <!>",1),F3=Z("<!> <!>",1),O3=Z('<div class="gap-3 flex items-start"><!> <div><h4 class="text-sm font-semibold text-success-foreground"> </h4> <p class="text-sm mt-1 text-success-foreground/80"> </p></div></div>'),z3=Z('<div class="gap-3 flex items-start"><!> <div><h4 class="text-sm font-semibold text-warning-foreground"> </h4> <p class="text-sm mt-1 text-warning-foreground/80"> </p></div></div>'),B3=Z('<div class="gap-3 flex items-start"><!> <div><h4 class="text-sm font-semibold text-destructive"> </h4> <p class="text-sm mt-1 text-destructive/80"> </p></div></div>'),k3=Z('<p class="text-xs mt-1 text-muted-foreground"> </p>'),V3=Z('<div><div class="gap-2 flex items-start"><!> <div class="flex-1"><p class="text-sm font-medium"> </p> <!></div></div></div>'),H3=Z('<div class="space-y-2"><h4 class="text-sm font-medium"> </h4> <!></div>'),G3=Z('<div class="gap-4 py-4 grid"><!> <!></div>'),W3=Z("<!> <!>",1),X3=Z("<!> <!> <!>",1),j3=Z('<!> <!> <!> <input type="file" accept=".sps" class="hidden"/> <!> <!> <!>',1);function q3(n,e){st(e,!0);let t=le(e,"showSaveButton",3,!0),i=le(e,"showLoadButton",3,!0),r=le(e,"actions",19,()=>[]);const s=z(()=>({..._3,...e.labels}));let a=Oe(!1),o=Oe(""),l=Oe(""),c=Oe(""),d=Oe(""),f=Oe(!1),h=Oe(!1),p=Oe(null),m=Oe(""),x=Oe(null),v=Oe(Ps([])),g=Oe(!1),y=Oe("");function w(){W(o,`State ${new Date().toLocaleDateString()}`),W(l,""),W(c,e.schema.author||"",!0),W(d,""),W(a,!0)}async function b(){if(!u(o).trim()){alert(u(s).saveNameRequired);return}const k=h3(e.schema,e.currentValues,{name:u(o).trim(),description:u(l).trim()||void 0,author:u(c).trim()||void 0,tags:u(d).split(",").map(te=>te.trim()).filter(te=>te.length>0)});e.onSaveState?await e.onSaveState(k):g3(k),W(a,!1)}function E(k){const te=m3(k,e.schema);te.isValid?e.onLoadValues(te.values):(W(p,te,!0),W(m,k.name,!0),W(f,!0))}async function S(k){const te=k.target;if(!(!te.files||te.files.length===0)){try{const fe=await v3(te.files[0]);E(fe)}catch(fe){alert(u(s).loadImportError+fe.message)}te.value=""}}function A(){!u(p)||!u(p).canLoad||(e.onLoadValues(u(p).values),W(f,!1),W(p,null))}function _(){W(f,!1),W(p,null)}async function T(){if(W(h,!0),!!e.onListStates){W(g,!0),W(y,""),W(v,[],!0);try{W(v,await e.onListStates(),!0)}catch(k){W(y,k.message,!0)}finally{W(g,!1)}}}function D(){u(x)?.click(),W(h,!1)}function L(k){E(k),W(h,!1)}var F=j3(),B=ee(F);{var U=k=>{Bn(k,{variant:"default",size:"sm",onclick:w,children:(te,fe)=>{var me=x3(),G=ee(me);zp(G,{class:"mr-2 h-4 w-4"});var Q=ae(G);Me(()=>Ae(Q,` ${u(s).saveButton??""}`)),P(te,me)},$$slots:{default:!0}})};xe(B,k=>{t()&&k(U)})}var N=ae(B,2);{var R=k=>{Bn(k,{variant:"outline",size:"sm",onclick:T,children:(te,fe)=>{var me=b3(),G=ee(me);oh(G,{class:"mr-2 h-4 w-4"});var Q=ae(G);Me(()=>Ae(Q,` ${u(s).loadButton??""}`)),P(te,me)},$$slots:{default:!0}})};xe(N,k=>{i()&&k(R)})}var O=ae(N,2);Zt(O,17,r,k=>k.id,(k,te)=>{{let fe=z(()=>u(te).variant??"outline"),me=z(()=>u(te).size??"sm");Bn(k,{get variant(){return u(fe)},get size(){return u(me)},get onclick(){return u(te).onclick},children:(G,Q)=>{var j=y3(),se=ee(j);{var ue=Fe=>{const Ue=z(()=>u(te).icon);var Pe=we(),ke=ee(Pe);Ne(ke,()=>u(Ue),(Ie,We)=>{We(Ie,{class:"mr-2 h-4 w-4"})}),P(Fe,Pe)};xe(se,Fe=>{u(te).icon&&Fe(ue)})}var be=ae(se);Me(()=>Ae(be,` ${u(te).label??""}`)),P(G,j)},$$slots:{default:!0}})}});var Y=ae(O,2);ui(Y,k=>W(x,k),()=>u(x));var K=ae(Y,2);Ne(K,()=>wr,(k,te)=>{te(k,{get open(){return u(a)},set open(fe){W(a,fe,!0)},children:(fe,me)=>{var G=we(),Q=ee(G);Ne(Q,()=>Er,(j,se)=>{se(j,{children:(ue,be)=>{var Fe=w3(),Ue=ee(Fe);Ne(Ue,()=>ms,(H,re)=>{re(H,{children:(de,ye)=>{var ve=S3(),oe=ee(ve);Ne(oe,()=>dr,(Re,Le)=>{Le(Re,{children:(Ee,De)=>{yt();var et=Et();Me(()=>Ae(et,u(s).saveDialogTitle)),P(Ee,et)},$$slots:{default:!0}})});var pe=ae(oe,2);Ne(pe,()=>gs,(Re,Le)=>{Le(Re,{children:(Ee,De)=>{yt();var et=Et();Me(()=>Ae(et,u(s).saveDialogDescription)),P(Ee,et)},$$slots:{default:!0}})}),P(de,ve)},$$slots:{default:!0}})});var Pe=ae(Ue,2),ke=$(Pe),Ie=$(ke);or(Ie,{for:"export-name",children:(H,re)=>{yt();var de=Et();Me(()=>Ae(de,u(s).saveNameLabel)),P(H,de)},$$slots:{default:!0}});var We=ae(Ie,2);_s(We,{id:"export-name",get placeholder(){return u(s).saveNamePlaceholder},get value(){return u(o)},set value(H){W(o,H,!0)}}),q(ke);var ze=ae(ke,2),He=$(ze);or(He,{for:"export-description",children:(H,re)=>{yt();var de=Et();Me(()=>Ae(de,u(s).saveDescriptionLabel)),P(H,de)},$$slots:{default:!0}});var V=ae(He,2);Nv(V,{id:"export-description",get placeholder(){return u(s).saveDescriptionPlaceholder},rows:3,get value(){return u(l)},set value(H){W(l,H,!0)}}),q(ze);var je=ae(ze,2),Ve=$(je);or(Ve,{for:"export-author",children:(H,re)=>{yt();var de=Et();Me(()=>Ae(de,u(s).saveAuthorLabel)),P(H,de)},$$slots:{default:!0}});var Xe=ae(Ve,2);_s(Xe,{id:"export-author",get placeholder(){return u(s).saveAuthorPlaceholder},get value(){return u(c)},set value(H){W(c,H,!0)}}),q(je);var Se=ae(je,2),Ce=$(Se);or(Ce,{for:"export-tags",children:(H,re)=>{yt();var de=Et();Me(()=>Ae(de,u(s).saveTagsLabel)),P(H,de)},$$slots:{default:!0}});var C=ae(Ce,2);_s(C,{id:"export-tags",get placeholder(){return u(s).saveTagsPlaceholder},get value(){return u(d)},set value(H){W(d,H,!0)}}),q(Se),q(Pe);var M=ae(Pe,2);Ne(M,()=>yl,(H,re)=>{re(H,{children:(de,ye)=>{var ve=M3(),oe=ee(ve);Bn(oe,{variant:"outline",onclick:()=>W(a,!1),children:(Re,Le)=>{yt();var Ee=Et();Me(()=>Ae(Ee,u(s).cancelButton)),P(Re,Ee)},$$slots:{default:!0}});var pe=ae(oe,2);Bn(pe,{onclick:b,children:(Re,Le)=>{yt();var Ee=Et();Me(()=>Ae(Ee,u(s).saveButton)),P(Re,Ee)},$$slots:{default:!0}}),P(de,ve)},$$slots:{default:!0}})}),P(ue,Fe)},$$slots:{default:!0}})}),P(fe,G)},$$slots:{default:!0}})});var ne=ae(K,2);Ne(ne,()=>wr,(k,te)=>{te(k,{get open(){return u(h)},set open(fe){W(h,fe,!0)},children:(fe,me)=>{var G=we(),Q=ee(G);Ne(Q,()=>Er,(j,se)=>{se(j,{children:(ue,be)=>{var Fe=U3(),Ue=ee(Fe);Ne(Ue,()=>ms,(ze,He)=>{He(ze,{children:(V,je)=>{var Ve=E3(),Xe=ee(Ve);Ne(Xe,()=>dr,(Ce,C)=>{C(Ce,{children:(M,H)=>{yt();var re=Et();Me(()=>Ae(re,u(s).loadDialogTitle)),P(M,re)},$$slots:{default:!0}})});var Se=ae(Xe,2);Ne(Se,()=>gs,(Ce,C)=>{C(Ce,{children:(M,H)=>{yt();var re=Et();Me(()=>Ae(re,u(s).loadDialogDescription)),P(M,re)},$$slots:{default:!0}})}),P(V,Ve)},$$slots:{default:!0}})});var Pe=ae(Ue,2);{var ke=ze=>{var He=L3(),V=$(He);{var je=Ce=>{var C=T3();P(Ce,C)},Ve=Ce=>{var C=A3(),M=$(C,!0);q(C),Me(()=>Ae(M,u(y))),P(Ce,C)},Xe=Ce=>{var C=C3(),M=$(C,!0);q(C),Me(()=>Ae(M,u(s).loadEmptyList)),P(Ce,C)},Se=Ce=>{var C=D3();Zt(C,21,()=>u(v),M=>M.id,(M,H)=>{var re=R3(),de=$(re),ye=$(de,!0);q(de);var ve=ae(de,2);{var oe=Le=>{var Ee=P3(),De=$(Ee,!0);q(Ee),Me(()=>Ae(De,u(H).description)),P(Le,Ee)};xe(ve,Le=>{u(H).description&&Le(oe)})}var pe=ae(ve,2),Re=$(pe,!0);q(pe),q(re),Me(Le=>{Ae(ye,u(H).name),Ae(Re,Le)},[()=>new Date(u(H).timestamp).toLocaleString()]),Xt("click",re,()=>L(u(H))),P(M,re)}),q(C),P(Ce,C)};xe(V,Ce=>{u(g)?Ce(je):u(y)?Ce(Ve,1):u(v).length===0?Ce(Xe,2):Ce(Se,-1)})}q(He),P(ze,He)},Ie=ze=>{var He=N3(),V=$(He);Bn(V,{onclick:D,class:"w-full",size:"lg",children:(je,Ve)=>{var Xe=I3(),Se=ee(Xe);oh(Se,{class:"mr-2 h-4 w-4"});var Ce=ae(Se);Me(()=>Ae(Ce,` ${u(s).loadFromFileButton??""}`)),P(je,Xe)},$$slots:{default:!0}}),q(He),P(ze,He)};xe(Pe,ze=>{e.onListStates?ze(ke):ze(Ie,-1)})}var We=ae(Pe,2);Ne(We,()=>yl,(ze,He)=>{He(ze,{children:(V,je)=>{Bn(V,{variant:"outline",onclick:()=>W(h,!1),children:(Ve,Xe)=>{yt();var Se=Et();Me(()=>Ae(Se,u(s).cancelButton)),P(Ve,Se)},$$slots:{default:!0}})},$$slots:{default:!0}})}),P(ue,Fe)},$$slots:{default:!0}})}),P(fe,G)},$$slots:{default:!0}})});var ce=ae(ne,2);Ne(ce,()=>wr,(k,te)=>{te(k,{get open(){return u(f)},set open(fe){W(f,fe,!0)},children:(fe,me)=>{var G=we(),Q=ee(G);Ne(Q,()=>Er,(j,se)=>{se(j,{class:"max-w-2xl max-h-[80vh] overflow-y-auto",children:(ue,be)=>{var Fe=X3(),Ue=ee(Fe);Ne(Ue,()=>ms,(We,ze)=>{ze(We,{children:(He,V)=>{var je=F3(),Ve=ee(je);Ne(Ve,()=>dr,(Se,Ce)=>{Ce(Se,{children:(C,M)=>{yt();var H=Et();Me(()=>Ae(H,u(s).validationTitle)),P(C,H)},$$slots:{default:!0}})});var Xe=ae(Ve,2);Ne(Xe,()=>gs,(Se,Ce)=>{Ce(Se,{children:(C,M)=>{var H=we(),re=ee(H);{var de=ye=>{var ve=Et();Me(()=>Ae(ve,`${u(s).validationValidatingPrefix??""}${u(m)??""}`)),P(ye,ve)};xe(re,ye=>{u(m)&&ye(de)})}P(C,H)},$$slots:{default:!0}})}),P(He,je)},$$slots:{default:!0}})});var Pe=ae(Ue,2);{var ke=We=>{var ze=G3(),He=$(ze);{var V=Ce=>{var C=we(),M=ee(C);Ne(M,()=>vs,(H,re)=>{re(H,{class:"p-4 border-success/30 bg-success/5",children:(de,ye)=>{var ve=O3(),oe=$(ve);$v(oe,{class:"h-5 w-5 text-success"});var pe=ae(oe,2),Re=$(pe),Le=$(Re,!0);q(Re);var Ee=ae(Re,2),De=$(Ee,!0);q(Ee),q(pe),q(ve),Me(()=>{Ae(Le,u(s).validationNoIssuesTitle),Ae(De,u(s).validationNoIssuesBody)}),P(de,ve)},$$slots:{default:!0}})}),P(Ce,C)},je=Ce=>{var C=we(),M=ee(C);Ne(M,()=>vs,(H,re)=>{re(H,{class:"p-4 border-warning/30 bg-warning/5",children:(de,ye)=>{var ve=z3(),oe=$(ve);yo(oe,{class:"h-5 w-5 text-warning"});var pe=ae(oe,2),Re=$(pe),Le=$(Re,!0);q(Re);var Ee=ae(Re,2),De=$(Ee,!0);q(Ee),q(pe),q(ve),Me(et=>{Ae(Le,u(s).validationWarningsTitle),Ae(De,et)},[()=>u(s).validationWarningsBody.replace("{count}",String(u(p).issues.length))]),P(de,ve)},$$slots:{default:!0}})}),P(Ce,C)},Ve=Ce=>{var C=we(),M=ee(C);Ne(M,()=>vs,(H,re)=>{re(H,{class:"p-4 border-destructive/30 bg-destructive/5",children:(de,ye)=>{var ve=B3(),oe=$(ve);yo(oe,{class:"h-5 w-5 text-destructive"});var pe=ae(oe,2),Re=$(pe),Le=$(Re,!0);q(Re);var Ee=ae(Re,2),De=$(Ee,!0);q(Ee),q(pe),q(ve),Me(()=>{Ae(Le,u(s).validationErrorsTitle),Ae(De,u(s).validationErrorsBody)}),P(de,ve)},$$slots:{default:!0}})}),P(Ce,C)};xe(He,Ce=>{u(p).isValid?Ce(V):u(p).canLoad?Ce(je,1):Ce(Ve,-1)})}var Xe=ae(He,2);{var Se=Ce=>{var C=H3(),M=$(C),H=$(M,!0);q(M);var re=ae(M,2);Zt(re,17,()=>u(p).issues,de=>de.message,(de,ye)=>{var ve=V3(),oe=$(ve),pe=$(oe);{let Ye=z(()=>u(ye).severity==="error"?"text-destructive":"text-warning");yo(pe,{get class(){return`h-4 w-4 mt-0.5 ${u(Ye)??""}`}})}var Re=ae(pe,2),Le=$(Re),Ee=$(Le,!0);q(Le);var De=ae(Le,2);{var et=Ye=>{var ht=k3(),J=$(ht);q(ht),Me(()=>Ae(J,`${u(s).validationExpected??""}
5020
5020
  ${u(ye).details.expected??""} → ${u(s).validationActual??""}
5021
- ${u(ye).details.actual??""}`)),P(Ye,ht)};xe(De,Ye=>{u(ye).details&&Ye(et)})}q(Re),q(oe),q(ve),Me(()=>{Dt(ve,1,`p-3 rounded-lg border ${u(ye).severity==="error"?"border-destructive/30 bg-destructive/5":"border-warning/30 bg-warning/5"}`),Ae(Ee,u(ye).message)}),P(de,ve)}),q(C),Me(()=>Ae(H,u(s).validationIssuesHeading)),P(Ce,C)};xe(Xe,Ce=>{u(p).isValid||Ce(Se)})}q(ze),P(We,ze)};xe(Pe,We=>{u(p)&&We(ke)})}var Ie=ae(Pe,2);Ne(Ie,()=>yl,(We,ze)=>{ze(We,{children:(He,V)=>{var je=W3(),Ve=ee(je);Bn(Ve,{variant:"outline",onclick:_,children:(Ce,C)=>{yt();var M=Et();Me(()=>Ae(M,u(s).cancelButton)),P(Ce,M)},$$slots:{default:!0}});var Xe=ae(Ve,2);{var Se=Ce=>{Bn(Ce,{onclick:A,children:(C,M)=>{yt();var H=Et();Me(()=>Ae(H,u(s).loadAnywayButton)),P(C,H)},$$slots:{default:!0}})};xe(Xe,Ce=>{u(p)?.canLoad&&Ce(Se)})}P(He,je)},$$slots:{default:!0}})}),P(ue,Fe)},$$slots:{default:!0}})}),P(fe,G)},$$slots:{default:!0}})}),Xt("change",Y,S),P(n,F),at()}zi(["change","click"]);var Y3=Z("<!> ",1),K3=Z('<div class="panel-footer px-3 svelte-1txzu1i"><div class="gap-2 flex flex-wrap items-center justify-center"><!> <!></div> <!></div>'),Z3=Z('<div class="panel-content-wrapper svelte-1txzu1i"><!> <!></div>'),$3=Z('<div class="my-4 gap-2 flex items-center"><div class="h-px flex-1 bg-border"></div> <span class="text-xs font-medium px-1 text-muted-foreground"> </span> <div class="h-px flex-1 bg-border"></div></div> <!>',1),J3=Z('<div class="drawer-footer svelte-1txzu1i"><!></div>'),Q3=Z('<div class="min-h-0 flex flex-1 flex-col"><!></div> <div style="z-index: 40;"><button class="drawer-handle-bar svelte-1txzu1i"><div class="drawer-pill svelte-1txzu1i"></div> <span class="text-sm font-medium ml-2 text-foreground"> </span> <!></button> <div class="drawer-content svelte-1txzu1i"><div class="px-3 pb-6"><!> <!></div></div> <!></div>',1),eD=Z('<div class="my-4 gap-2 flex items-center"><div class="h-px flex-1 bg-border"></div> <span class="text-xs font-medium px-1 text-muted-foreground"> </span> <div class="h-px flex-1 bg-border"></div></div> <!>',1),tD=Z('<div class="drawer-footer svelte-1txzu1i"><!></div>'),nD=Z('<div class="flex flex-1 flex-col overflow-hidden"><div class="px-3 pt-3 flex-1 overflow-y-auto"><!> <!></div> <!></div>'),iD=Z('<div class="min-h-0 flex h-full flex-1 justify-center"><div class="min-h-0 flex h-full w-4/5 flex-col"><!></div></div>'),rD=Z("<div><!></div>"),sD=Z("<!> <!>",1),aD=Z("<div><!></div>"),oD=Z("<!> <!>",1),lD=Z("<!> <!> <!>",1),cD=Z('<div class="min-h-0 flex h-full flex-1"><!> <!> <!></div>'),uD=Z('<div data-layout-root=""><!></div> <!>',1);function dD(n,e){st(e,!0);const t=(se,ue=wt,be=wt,Fe,Ue)=>{let Pe=th(()=>nh(Fe?.(),!0)),ke=th(()=>nh(Ue?.(),!0));var Ie=Z3(),We=$(Ie);{var ze=je=>{o3(je,{get schema(){return e.schema},get values(){return e.values},get onValueChange(){return e.onValueChange},get panelFilter(){return ue()},get requestedTabId(){return be()}})};xe(We,je=>{e.schema.layout.type==="tabbed"&&je(ze)})}var He=ae(We,2);{var V=je=>{var Ve=K3(),Xe=$(Ve),Se=$(Xe);{var Ce=re=>{q3(re,{get schema(){return e.schema},get currentValues(){return e.values},onLoadValues:O,get showSaveButton(){return p()},get showLoadButton(){return m()},get onSaveState(){return e.onSaveState},get onListStates(){return e.onListStates},get labels(){return e.presetLabels}})};xe(Se,re=>{u(Pe)&&re(Ce)})}var C=ae(Se,2);Zt(C,17,h,re=>re.id,(re,de)=>{{let ye=z(()=>u(de).variant??"outline"),ve=z(()=>u(de).size??"sm");Bn(re,{get variant(){return u(ye)},get size(){return u(ve)},get onclick(){return u(de).onclick},children:(oe,pe)=>{var Re=Y3(),Le=ee(Re);{var Ee=et=>{const Ye=z(()=>u(de).icon);var ht=we(),J=ee(ht);Ne(J,()=>u(Ye),(Ge,Te)=>{Te(Ge,{class:"mr-2 h-4 w-4"})}),P(et,ht)};xe(Le,et=>{u(de).icon&&et(Ee)})}var De=ae(Le);Me(()=>Ae(De,` ${u(de).label??""}`)),P(oe,Re)},$$slots:{default:!0}})}}),q(Xe);var M=ae(Xe,2);{var H=re=>{dc(re,{get hasPendingChanges(){return l()},get hasNeverSolved(){return c()},get isSolving(){return e.isSolving},get oncalculate(){return f()}})};xe(M,re=>{!u(A)&&u(ke)&&e.schema.instanceSolve===!1&&re(H)})}q(Ve),P(je,Ve)};xe(He,je=>{(u(Pe)||!u(A)&&u(ke)&&e.schema.instanceSolve===!1)&&je(V)})}q(Ie),P(se,Ie)},i=Si(),r=z(()=>i.messages),s=48;let a=le(e,"meshes",19,()=>[]),o=le(e,"showSolvingIndicator",3,!1),l=le(e,"hasPendingChanges",3,!1),c=le(e,"hasNeverSolved",3,!1),d=le(e,"isViewerFullscreen",15,!1),f=le(e,"oncalculate",3,()=>{}),h=le(e,"panelActions",19,()=>[]),p=le(e,"showSaveButton",3,!0),m=le(e,"showLoadButton",3,!0),x=le(e,"viewerConfig",19,()=>({}));const v=z(()=>!!(e.schema?.viewerOptions?.enableLocal||e.schema?.viewerOptions?.enableRemote)),g=z(()=>e.schema.layout.type==="tabbed"?e.schema.layout.tabs.filter(se=>se.position!=="right"):[]),y=z(()=>e.schema.layout.type==="tabbed"?e.schema.layout.tabs.filter(se=>se.position==="right"):[]),w=z(()=>u(g).length>0),b=z(()=>u(y).length>0),E=z(()=>u(v)||u(b)),S=z(()=>!u(v)&&u(w)&&u(b));let A=Oe(!1),_=Oe(!1);const T=z(()=>u(g)[0]?.label??u(r).parametersTab);Pt(()=>{const se=window.matchMedia("(max-width: 639px)");function ue(){W(A,se.matches,!0)}return ue(),se.addEventListener("change",ue),()=>se.removeEventListener("change",ue)});let D=Oe(!1),L=Oe(!1),F=Oe(null),B=Oe(null),U=Oe(null),N=Oe(null);const R=z(()=>`${u(w)?"L":""}${u(v)?"V":""}${u(b)?"R":""}`);async function O(se){Object.assign(e.values,se),await e.onLoadValues?.(se)}let Y=0;function K(se){Y=se.touches[0].clientY}function ne(se){const ue=se.changedTouches[0].clientY-Y;Math.abs(ue)>40&&W(_,ue<0)}var ce=uD(),k=ee(ce);let te;var fe=$(k);{var me=se=>{var ue=we(),be=ee(ue);{var Fe=Pe=>{var ke=Q3(),Ie=ee(ke),We=$(Ie);{let ve=z(()=>({...x(),backgroundColor:e.schema?.viewerOptions?.backgroundColor,showSceneManager:!1}));Yf(We,{get meshes(){return a()},get isSolving(){return e.isSolving},get isBlurred(){return u(_)},get drawerOpen(){return u(_)},get logoUrl(){return e.logoUrl},get viewerConfig(){return u(ve)},get isFullscreen(){return d()},set isFullscreen(oe){d(oe)}})}q(Ie);var ze=ae(Ie,2);let He;var V=$(ze),je=ae($(V),2),Ve=$(je,!0);q(je);var Xe=ae(je,2);{let ve=z(()=>u(_)?"":"rotate-180");jv(Xe,{size:16,get class(){return`ml-auto text-muted-foreground transition-transform duration-300 ${u(ve)??""}`}})}q(V);var Se=ae(V,2),Ce=$(Se),C=$(Ce);{var M=ve=>{t(ve,()=>u(b)?"left":void 0,()=>u(U),()=>!u(b),()=>!1)};xe(C,ve=>{u(w)&&ve(M)})}var H=ae(C,2);{var re=ve=>{var oe=$3(),pe=ee(oe),Re=ae($(pe),2),Le=$(Re,!0);q(Re),yt(2),q(pe);var Ee=ae(pe,2);t(Ee,()=>"right",()=>u(N),()=>!0,()=>!1),Me(()=>Ae(Le,u(y)[0]?.label??u(r).moreTab)),P(ve,oe)};xe(H,ve=>{u(b)&&ve(re)})}q(Ce),q(Se);var de=ae(Se,2);{var ye=ve=>{var oe=J3(),pe=$(oe);dc(pe,{get hasPendingChanges(){return l()},get hasNeverSolved(){return c()},get isSolving(){return e.isSolving},get oncalculate(){return f()}}),q(oe),P(ve,oe)};xe(de,ve=>{e.schema.instanceSolve===!1&&ve(ye)})}q(ze),Me(()=>{He=Dt(ze,1,"drawer-container svelte-1txzu1i",null,He,{"drawer-open":u(_),"drawer-closed":!u(_)}),Qt(V,"aria-label",u(_)?u(r).collapsePanel:u(r).expandPanel),Qt(V,"aria-expanded",u(_)),Ae(Ve,u(T))}),Xt("click",V,()=>W(_,!u(_))),Xt("touchstart",V,K),Xt("touchend",V,ne),P(Pe,ke)},Ue=Pe=>{var ke=nD(),Ie=$(ke),We=$(Ie);{var ze=Xe=>{t(Xe,()=>u(b)?"left":void 0,()=>u(U),()=>!u(b),()=>!1)};xe(We,Xe=>{u(w)&&Xe(ze)})}var He=ae(We,2);{var V=Xe=>{var Se=eD(),Ce=ee(Se),C=ae($(Ce),2),M=$(C,!0);q(C),yt(2),q(Ce);var H=ae(Ce,2);t(H,()=>"right",()=>u(N),()=>!0,()=>!1),Me(()=>Ae(M,u(y)[0]?.label??u(r).moreTab)),P(Xe,Se)};xe(He,Xe=>{u(b)&&Xe(V)})}q(Ie);var je=ae(Ie,2);{var Ve=Xe=>{var Se=tD(),Ce=$(Se);dc(Ce,{get hasPendingChanges(){return l()},get hasNeverSolved(){return c()},get isSolving(){return e.isSolving},get oncalculate(){return f()}}),q(Se),P(Xe,Se)};xe(je,Xe=>{e.schema.instanceSolve===!1&&Xe(Ve)})}q(ke),P(Pe,ke)};xe(be,Pe=>{u(v)?Pe(Fe):Pe(Ue,-1)})}P(se,ue)},G=se=>{var ue=iD(),be=$(ue),Fe=$(be);t(Fe,()=>u(b)?"right":void 0,()=>u(b)?u(N):u(U),()=>!u(b),()=>!u(b)),q(be),q(ue),P(se,ue)},Q=se=>{var ue=cD(),be=$(ue);{var Fe=Ie=>{hp(Ie,{side:"left",get tabs(){return u(g)},collapsedWidth:s,onExpand:()=>u(F)?.expand(),onTabClick:We=>{W(U,We,!0),u(F)?.expand()}})};xe(be,Ie=>{u(D)&&u(E)&&u(w)&&Ie(Fe)})}var Ue=ae(be,2);Ne(Ue,()=>mg,(Ie,We)=>{We(Ie,{direction:"horizontal",get autoSaveId(){return`selva-layout-${u(R)??""}`},class:"min-h-0 flex-1",children:(ze,He)=>{var V=lD(),je=ee(V);{var Ve=M=>{var H=sD(),re=ee(H);{let ye=z(()=>u(S)?50:u(v)&&u(b)?22:30);Ne(re,()=>sa,(ve,oe)=>{ui(oe(ve,{order:1,get defaultSize(){return u(ye)},minSize:15,maxSize:45,collapsible:!0,collapsedSize:0,onCollapse:()=>W(D,!0),onExpand:()=>W(D,!1),class:"ml-1",children:(pe,Re)=>{var Le=rD(),Ee=$(Le);t(Ee,()=>u(b)?"left":void 0,()=>u(U)),q(Le),Me(()=>Dt(Le,1,`min-h-0 flex h-full flex-col ${d()||u(D)?"hidden":""}`)),P(pe,Le)},$$slots:{default:!0}}),pe=>W(F,pe,!0),()=>u(F))})}var de=ae(re,2);Ne(de,()=>xu,(ye,ve)=>{ve(ye,{withHandle:!0,class:"bg-transparent",get"data-collapsed"(){return u(D)},onclick:()=>{u(D)&&u(F)?.expand()}})}),P(M,H)};xe(je,M=>{u(w)&&M(Ve)})}var Xe=ae(je,2);{var Se=M=>{var H=we(),re=ee(H);Ne(re,()=>sa,(de,ye)=>{ye(de,{order:2,minSize:20,class:"min-h-0 mx-1 flex flex-col",children:(ve,oe)=>{{let pe=z(()=>({backgroundColor:e.schema?.viewerOptions?.backgroundColor}));Yf(ve,{get meshes(){return a()},get isSolving(){return e.isSolving},get logoUrl(){return e.logoUrl},get viewerConfig(){return u(pe)},get isFullscreen(){return d()},set isFullscreen(Re){d(Re)}})}},$$slots:{default:!0}})}),P(M,H)};xe(Xe,M=>{u(v)&&M(Se)})}var Ce=ae(Xe,2);{var C=M=>{var H=oD(),re=ee(H);Ne(re,()=>xu,(ye,ve)=>{ve(ye,{withHandle:!0,class:"bg-transparent",get"data-collapsed"(){return u(L)},onclick:()=>{u(L)&&u(B)?.expand()}})});var de=ae(re,2);{let ye=z(()=>u(S)?50:25);Ne(de,()=>sa,(ve,oe)=>{ui(oe(ve,{order:3,get defaultSize(){return u(ye)},minSize:15,maxSize:45,collapsible:!0,collapsedSize:0,onCollapse:()=>W(L,!0),onExpand:()=>W(L,!1),class:"mr-1",children:(pe,Re)=>{var Le=aD(),Ee=$(Le);t(Ee,()=>"right",()=>u(N),()=>!u(w),()=>!u(w)),q(Le),Me(()=>Dt(Le,1,`min-h-0 flex h-full flex-col ${d()||u(L)?"hidden":""}`)),P(pe,Le)},$$slots:{default:!0}}),pe=>W(B,pe,!0),()=>u(B))})}P(M,H)};xe(Ce,M=>{u(b)&&M(C)})}P(ze,V)},$$slots:{default:!0}})});var Pe=ae(Ue,2);{var ke=Ie=>{hp(Ie,{side:"right",get tabs(){return u(y)},collapsedWidth:s,onExpand:()=>u(B)?.expand(),onTabClick:We=>{W(N,We,!0),u(B)?.expand()}})};xe(Pe,Ie=>{u(L)&&u(b)&&Ie(ke)})}q(ue),P(se,ue)};xe(fe,se=>{u(A)?se(me):!u(v)&&!u(S)&&u(w)!==u(b)?se(G,1):se(Q,-1)})}q(k);var j=ae(k,2);V2(j,{get show(){return o()}}),Me(()=>te=Dt(k,1,`min-h-0 sm:flex-row sm:py-(--page-py) flex flex-1 flex-col overflow-hidden ${u(D)?"sm:pl-0":"sm:pl-(--page-px)"} ${u(L)?"sm:pr-0":"sm:pr-(--page-px)"}`,"svelte-1txzu1i",te,{"fullscreen-layout":d(),relative:u(A)})),P(n,ce),at()}zi(["click","touchstart","touchend"]);function hD(n){const{FAST_THRESHOLD_MS:e,SLOW_THRESHOLD_MS:t,HISTORY_SIZE:i,ANIMATION_DELAY:r}=us.SOLVING_INDICATOR;let s=Oe(!1),a=null,o=null;const l=[];return Pt(()=>{const c=n();return wn(()=>{if(c){o=performance.now();const d=l.length===0?1/0:l.reduce((h,p)=>h+p,0)/l.length;if(l.length>0&&d<e)return;const f=d===1/0||d>=t?0:(d-e)/(t-e)*r;a||(f===0?W(s,!0):a=setTimeout(()=>{W(s,!0),a=null},f))}else o!==null&&(l.push(performance.now()-o),l.length>i&&l.shift(),o=null),a&&(clearTimeout(a),a=null),W(s,!1)}),()=>{a&&clearTimeout(a)}}),{get show(){return u(s)}}}const fD="external";function pD(n,e){return`${fD}:${n}:${e}`}function fp(n){const{scopeKey:e,inputId:t}=n;if(!e||!t||typeof sessionStorage>"u")return;const i=sessionStorage.getItem(pD(e,t));if(i!==null)try{return JSON.parse(i)}catch{return}}function mD(n){return xP(n).filter(e=>e.source?.kind==="client").map(e=>({paramId:e.paramId,displayName:e.displayName??e.paramId}))}const gD=6e4;function vD(n,e={}){const{timeout:t=gD}=e;let i=Oe(!1),r=Oe(null),s=null;function a(){s?.abort(),s=null}async function o(d){a(),s=new AbortController;const{signal:f}=s,h=setTimeout(()=>s?.abort(),t);W(i,!0);try{await n(d,f)}catch(p){(!(p instanceof Error)||p.name!=="AbortError"&&p.name!=="TimeoutError")&&console.error("[computeThrottle] unhandled error in computeFn:",p)}finally{if(clearTimeout(h),W(i,!1),s=null,u(r)!==null){const p=u(r);W(r,null),o(p)}}}function l(d){u(i)?W(r,d,!0):o(d)}function c(){W(r,null),a()}return{trigger:l,get isComputing(){return u(i)},get hasPending(){return u(r)!==null},cancel:c}}function _D(n){switch(n){case"number":case"integer":return 0;case"boolean":return!1;case"text":return"";default:return null}}function pp(n,e,t){const i=new Set(mD(n).map(s=>s.paramId)),r={};for(const s of n.inputs){if(i.has(s.id)){const a=t({scopeKey:e,inputId:s.id});a!==void 0&&(r[s.id]=a);continue}r[s.id]=s.default??_D(s.paramType)}for(const s of n.outputs)r[s.id]=null;return r}function mp(n){const e=n===!1;return{hasPendingChanges:e,hasNeverSolved:e}}function xD(n,e,t,i){return n.values[e]=t,i===!1?(n.pendingValues[e]=t,n.hasPendingChanges=!0,{state:n,shouldSolve:!1}):{state:n,shouldSolve:!0}}function bD(n,e){return n.error="",n.computeErrors=e.errors??[],n.computeWarnings=e.warnings??[],n.meshes=e.meshes??[],Object.assign(n.values,e.outputs),n.pendingValues={},n.hasPendingChanges=!1,n.hasNeverSolved=!1,n}function yD(n){let e=n.schema;const t=mp(e?.instanceSolve),i=Ps({values:pp(e,n.scopeKey,fp),error:"",computeErrors:[],computeWarnings:[],meshes:[],pendingValues:{},hasPendingChanges:t.hasPendingChanges,hasNeverSolved:t.hasNeverSolved});function r(){n.driver.solve(Nu(i.values))}return{get values(){return i.values},get error(){return i.error},get computeErrors(){return i.computeErrors},get computeWarnings(){return i.computeWarnings},get meshes(){return i.meshes},get hasPendingChanges(){return i.hasPendingChanges},get hasNeverSolved(){return i.hasNeverSolved},get isSolving(){return n.driver.isSolving},setValue(s,a,o=!1){const{shouldSolve:l}=xD(i,s,a,e?.instanceSolve);(l||o)&&(o&&!l&&(i.pendingValues={},i.hasPendingChanges=!1),r())},solve(){r()},loadValues(s){Object.assign(i.values,s),e?.instanceSolve!==!1?r():i.hasPendingChanges=!0},rebuild(s,a){e=s,i.meshes=[],i.error="",i.computeErrors=[],i.computeWarnings=[],i.pendingValues={},i.values=pp(s,a,fp);const o=mp(s?.instanceSolve);i.hasPendingChanges=o.hasPendingChanges,i.hasNeverSolved=o.hasNeverSolved,s&&Object.keys(i.values).length>0&&s.instanceSolve!==!1&&r()},report(s){bD(i,s)},reportError(s){i.error=s}}}function SD(n,e,t={}){const i=vD(async(r,s)=>{try{const a=await n(r,s);if(s.aborted)return;e().report(a)}catch(a){if(s.aborted)return;e().reportError(a instanceof Error?a.message:String(a))}},t);return{solve(r){i.trigger(r)},cancel(){i.cancel()},get isSolving(){return i.isComputing}}}function MD(n){tl(()=>{const e=Ms(rh);!e||!n.component||e.register(n)}),yp(()=>{try{Ms(rh)?.unregister(n.id)}catch{}})}const wD=n=>{if(!n)return"";const e=n.replace(/^#/,"");if(!/^[0-9A-Fa-f]{6}$/.test(e))return n;const t=parseInt(e.slice(0,2),16)/255,i=parseInt(e.slice(2,4),16)/255,r=parseInt(e.slice(4,6),16)/255,s=b=>b<=.04045?b/12.92:Math.pow((b+.055)/1.055,2.4),a=s(t),o=s(i),l=s(r),c=a*.4124564+o*.3575761+l*.1804375,d=a*.2126729+o*.7151522+l*.072175,f=a*.0193339+o*.119192+l*.9503041,h=Math.cbrt(.8189330101*c+.3618667424*d-.1288597137*f),p=Math.cbrt(.0329845436*c+.9293118715*d+.0361456387*f),m=Math.cbrt(.0482003018*c+.2643662691*d+.633851707*f),x=.2104542553*h+.793617785*p-.0040720468*m,v=1.9779984951*h-2.428592205*p+.4505937099*m,g=.0259040371*h+.7827717662*p-.808675766*m,y=Math.sqrt(v*v+g*g);let w=Math.atan2(g,v)*180/Math.PI;return w<0&&(w+=360),`oklch(${x.toFixed(3)} ${y.toFixed(3)} ${w.toFixed(1)})`};var ED=Z('<div class="min-h-100 p-8 flex items-center justify-center"><!></div>'),TD=Z('<div class="min-h-100 flex items-center justify-center"><!></div>'),AD=Z("<div><!></div>");function CD(n,e){st(e,!0);let t=le(e,"definitionKey",3,""),i=le(e,"showModeToggle",3,!1),r=le(e,"panelActions",19,()=>[]),s=le(e,"showSaveButton",3,!0),a=le(e,"showLoadButton",3,!0),o=le(e,"footerItemId",3,"footer-item"),l=le(e,"footerItemPriority",3,0);nR(e.clientSlot);const c=Si();ng(()=>e.lang??c.locale);const d=z(()=>Si().messages),f=z(()=>e.externalScopeKey||t()||e.schema?.id||""),h=SD(e.onSolve,()=>p,{timeout:e.solveTimeoutMs}),p=yD({schema:e.schema,scopeKey:e.externalScopeKey||t()||e.schema?.id||"",driver:h});let m=Oe(!1);const x=hD(()=>p.isSolving);Pt(()=>{e.onReady?.({loadValues:L=>p.loadValues(L)})});let v=Oe(""),g=Oe(!0);Pt(()=>{t(),wn(()=>{u(g)?(W(g,!1),W(v,t()),e.schema?.instanceSolve!==!1&&p.solve()):u(v)!==t()&&(p.rebuild(e.schema,u(f)),W(v,t()))})});function y(L,F,B=!1){p.setValue(L,F,B)}function w(){p.solve()}MD({id:wn(()=>o()),component:wn(()=>e.footerComponent),getProps:()=>e.footerComponentProps?.()??{},position:"left",priority:wn(()=>l())});let b=z(()=>e.isEmbedded??ih.url.searchParams.get("embed")==="true"),E=z(()=>e.primaryColor??ih.url.searchParams.get("primary")),S=z(()=>u(E)?`--primary: ${wD(u(E))}`:""),A=z(()=>e.title??(e.schema?.description||e.schema.name));var _=AD();let T;var D=$(_);{let L=z(()=>!u(b));Zg(D,{mode:"fixed",get showHeader(){return u(L)},showFooter:!0,get title(){return u(A)},get showModeToggle(){return i()},get copyrightName(){return e.copyrightName},get footerText(){return e.footerText},get header(){return e.header},get rightContent(){return e.headerRight},get errors(){return p.computeErrors},get warnings(){return p.computeWarnings},children:(F,B)=>{var U=we(),N=ee(U);{var R=K=>{var ne=ED(),ce=$(ne);wu(ce,{type:"error",size:"medium",get message(){return p.error}}),q(ne),P(K,ne)},O=K=>{var ne=TD(),ce=$(ne);wu(ce,{type:"loading",size:"large",get message(){return u(d).loadingSchema}}),q(ne),P(K,ne)},Y=K=>{var ne=we(),ce=ee(ne);pv(ce,t,k=>{{let te=z(()=>e.schema.instanceSolve!==!1&&x.show);dD(k,{get schema(){return e.schema},get meshes(){return p.meshes},get isSolving(){return p.isSolving},get showSolvingIndicator(){return u(te)},get hasPendingChanges(){return p.hasPendingChanges},get hasNeverSolved(){return p.hasNeverSolved},get values(){return p.values},get logoUrl(){return e.logo},get panelActions(){return r()},get showSaveButton(){return s()},get showLoadButton(){return a()},get onSaveState(){return e.onSaveState},get onListStates(){return e.onListStates},get presetLabels(){return e.presetLabels},onValueChange:y,oncalculate:w,onLoadValues:()=>p.loadValues({}),get isViewerFullscreen(){return u(m)},set isViewerFullscreen(fe){W(m,fe,!0)}})}}),P(K,ne)};xe(N,K=>{p.error?K(R):e.schema?K(Y,-1):K(O,1)})}P(F,U)},$$slots:{default:!0}})}q(_),Me(()=>T=Ii(_,u(S),T,{display:"contents"})),P(n,_),at()}var PD=Z('<div class="text-muted-foreground flex items-center gap-1.5 text-xs"><!> <span> </span></div>');function RD(n,e){var t=we(),i=ee(t);{var r=s=>{var a=PD(),o=$(a);Jg(o,{class:"h-3 w-3"});var l=ae(o,2),c=$(l,!0);q(l),q(a),Me(()=>Ae(c,e.label)),P(s,a)};xe(i,s=>{e.label&&s(r)})}P(n,t)}const DD=""+new URL("../assets/rhino3dm.BI8ESrUA.wasm",import.meta.url).href;var LD=Z('<span class="bg-warning/15 text-warning rounded-full px-2.5 py-1 font-mono text-[11px] font-medium tracking-wide uppercase"> </span>'),ID=Z('<span class="bg-warning/15 text-warning rounded-full px-2.5 py-1 font-mono text-[11px] font-medium tracking-wide uppercase">Draft preview</span>'),ND=Z("<!> <!>",1);function PL(n,e){st(e,!0);let t=null;function i(){return t||(t=gp(()=>import("../chunks/-xEd7dwr.js").then(o=>o.r),[],import.meta.url).then(o=>{const l=o.default;return l({locateFile:()=>DD})})),t}let r=0;function s(o){const l={};if(!o)return l;for(const c of o.split(",")){const[d,...f]=c.split(";").map(m=>m.trim()),h=f.find(m=>m.startsWith("dur="));if(!d||!h)continue;const p=Number(h.slice(4));Number.isFinite(p)&&(l[d]=p)}return l}const a=async(o,l)=>{const c=r-Date.now();if(c>0)throw new Error(`Rate limit reached. Try again in ${Math.ceil(c/1e3)}s.`);const d=performance.now(),f=JSON.stringify({inputs:e.data.schema.inputs,values:o,definitionUrl:e.data.ghDefinition,...e.data.versionId?{versionId:e.data.versionId}:e.data.channel==="draft"&&{channel:"draft"}}),h=JSON.stringify(o).length;let p;try{p=await fetch("/api/compute",{method:"POST",headers:{"Content-Type":"application/json"},body:f,signal:l})}catch(j){if(l.aborted)return{outputs:{}};throw new Error("Request blocked — your session may have expired. Reload the page to sign in again.",{cause:j})}if(l.aborted)return{outputs:{}};if(!p.ok){if(p.status===503)throw new Error("Compute server is offline or unreachable. Please try again later.");if(p.status===429){const se=await p.json().catch(()=>({})),ue=Number(p.headers.get("Retry-After"))||Number(se.retryAfter)||5;throw r=Date.now()+ue*1e3,new Error(se.message||`Rate limit reached. Try again in ${ue}s.`)}const j=await p.json().catch(()=>({}));throw new Error(j.message||"Compute error")}const m=performance.now()-d,x=performance.now(),v=await p.text();if(l.aborted)return{outputs:{}};const g=performance.now()-x,y=v.length,w=performance.now(),b=JSON.parse(v),E=new w_(b,!1),S=performance.now()-w,A=e.data.schema.viewerOptions?.enableLocal||e.data.schema.viewerOptions?.enableRemote,_=performance.now(),T=A?await i():null,D=performance.now()-_,L=performance.now(),F=T?await E.extractMeshesFromResponse({rhino:T}):[],B=performance.now()-L,U=performance.now(),N={};for(const j of e.data.schema.outputs){const se=E.getValue({byId:j.id},{parseValues:!0}),ue=j.nickname;N[j.id]=se??(ue?E.getValue({byName:ue},{parseValues:!0}):void 0)}const R=performance.now()-U,O=s(p.headers.get("Server-Timing")),Y=O.total??0,K=Math.max(0,m-Y),ne=y/(1024*1024),ce=ne>=1?`${ne.toFixed(2)} MB`:`${(y/1024).toFixed(0)} KB`,k=g>0?(ne/(g/1e3)).toFixed(1):"∞",te=m+g+S+D+B+R,fe=f.length/1024,me=fe>=1024?`${(fe/1024).toFixed(2)} MB`:`${fe.toFixed(0)} KB`;if(h>256*1024){const j=ue=>e.data.schema.inputs.find(Fe=>Fe.id===ue)?.name??ue,se=Object.entries(o).map(([ue,be])=>[ue,JSON.stringify(be)?.length??0]).sort((ue,be)=>be[1]-ue[1]).slice(0,3);console.log("[Compute/browser] └─ request whales: "+se.map(([ue,be])=>`${j(ue)}=${(be/1024).toFixed(0)} KB`).join(" | "))}if(console.log(`[Compute/browser] req=${me} (values ${(h/1024).toFixed(0)} KB) | total=${te.toFixed(0)}ms | ttfb=${m.toFixed(0)}ms (network≈${K.toFixed(0)} + server ${Y.toFixed(0)}) | download=${g.toFixed(0)}ms (${ce} @ ${k} MB/s) | json=${S.toFixed(0)}ms | rhinoInit=${D.toFixed(0)}ms | mesh=${B.toFixed(0)}ms (${F.length}) | outputs=${R.toFixed(0)}ms`),O.total!==void 0&&console.log(`[Compute/browser] └─ server: load=${(O.load??0).toFixed(0)}ms tree=${(O.tree??0).toFixed(0)}ms solve=${(O.solve??0).toFixed(0)}ms serialize=${(O.serialize??0).toFixed(0)}ms`),O.selva_cache!==void 0){const j=O.selva_cache?"Selva-cache HIT — served without calling compute":"miss — solved on Rhino.Compute",se=O.def_reupload===void 0?"":O.def_reupload?" | definition RE-UPLOADED (cold/stale pointer)":" | definition reused on server (no upload)";console.log(`[Compute/browser] └─ cache: ${j}${se}`)}const G=Object.entries(O).filter(([j])=>j.startsWith("p_"));G.length>0&&console.log("[Compute/browser] └─ prep: "+G.map(([j,se])=>`${j.slice(2)}=${se.toFixed(0)}ms`).join(" ")),O.rhino_solve!==void 0&&console.log(`[Compute/browser] └─ compute server: decode=${(O.rhino_decode??0).toFixed(0)}ms solve=${(O.rhino_solve??0).toFixed(0)}ms encode=${(O.rhino_encode??0).toFixed(0)}ms | compute↔server traffic+queue=${(O.compute_link??0).toFixed(0)}ms`);const Q=performance.getEntriesByType("resource").filter(j=>j.name.includes("/api/compute")&&j.startTime>=d).at(-1);if(Q&&Q.responseEnd>0){const j=Q.transferSize/1048576,se=Q.encodedBodySize>0&&Q.decodedBodySize>Q.encodedBodySize*1.05;console.log(`[Compute/browser] └─ wire (network-stack): ${j.toFixed(2)} MB on-wire (${se?`compressed ${(Q.decodedBodySize/Q.encodedBodySize).toFixed(1)}×`:"UNCOMPRESSED"}) | headers=${(Q.responseStart-Q.requestStart).toFixed(0)}ms body=${(Q.responseEnd-Q.responseStart).toFixed(0)}ms`)}return{outputs:N,meshes:F,errors:b.errors??[],warnings:b.warnings??[]}};{const o=d=>{var f=ND(),h=ee(f);{var p=v=>{var g=LD(),y=$(g);q(g),Me(()=>Ae(y,`v${e.data.versionNumber??""} preview`)),P(v,g)},m=v=>{var g=ID();P(v,g)};xe(h,v=>{e.data.versionId?v(p):e.data.channel==="draft"&&v(m,1)})}var x=ae(h,2);$g(x,{}),P(d,f)};let l=z(()=>e.data.schema?.description||e.data.schema.name),c=z(()=>e.data.orgLogoUrl??void 0);CD(n,{get schema(){return e.data.schema},onSolve:a,get definitionKey(){return e.data.currentDefinition},get title(){return u(l)},get logo(){return u(c)},showModeToggle:!0,get solveTimeoutMs(){return e.data.solveTimeoutMs},get footerComponent(){return RD},footerComponentProps:()=>({label:e.data.serverLabel}),headerRight:o,$$slots:{headerRight:!0}})}at()}const UD=Object.freeze(Object.defineProperty({__proto__:null,BINARY_MESH_MAGIC:mu,BINARY_MESH_VERSION:gu,EDGE_USERDATA_KIND:ua,FLAG_FLOAT32:Id,Materials:qm,SCALE_FACTORS:Qm,addEdges:km,applyOffset:Fm,computeCombinedBoundingBox:fl,createCameraController:Om,createGrid:zm,createLabelLayer:Gm,createMeasureTool:Xm,createRenderPipeline:Hm,createViewGizmo:Bm,getThreeMeshesFromComputeResponse:DT,initThree:jm,isEdgeOverlay:Vm,parseBinaryMeshBatch:Nd,parseColor:Um,parseDisplayItems:Ym,parseMeshBatch:Zm,parseMeshBatchBlob:MT,parseMeshBatchObject:$m,removeEdges:TE,snapToVertex:Wm,updateScene:Nm},Symbol.toStringTag,{value:"Module"}));export{PL as component};
5021
+ ${u(ye).details.actual??""}`)),P(Ye,ht)};xe(De,Ye=>{u(ye).details&&Ye(et)})}q(Re),q(oe),q(ve),Me(()=>{Dt(ve,1,`p-3 rounded-lg border ${u(ye).severity==="error"?"border-destructive/30 bg-destructive/5":"border-warning/30 bg-warning/5"}`),Ae(Ee,u(ye).message)}),P(de,ve)}),q(C),Me(()=>Ae(H,u(s).validationIssuesHeading)),P(Ce,C)};xe(Xe,Ce=>{u(p).isValid||Ce(Se)})}q(ze),P(We,ze)};xe(Pe,We=>{u(p)&&We(ke)})}var Ie=ae(Pe,2);Ne(Ie,()=>yl,(We,ze)=>{ze(We,{children:(He,V)=>{var je=W3(),Ve=ee(je);Bn(Ve,{variant:"outline",onclick:_,children:(Ce,C)=>{yt();var M=Et();Me(()=>Ae(M,u(s).cancelButton)),P(Ce,M)},$$slots:{default:!0}});var Xe=ae(Ve,2);{var Se=Ce=>{Bn(Ce,{onclick:A,children:(C,M)=>{yt();var H=Et();Me(()=>Ae(H,u(s).loadAnywayButton)),P(C,H)},$$slots:{default:!0}})};xe(Xe,Ce=>{u(p)?.canLoad&&Ce(Se)})}P(He,je)},$$slots:{default:!0}})}),P(ue,Fe)},$$slots:{default:!0}})}),P(fe,G)},$$slots:{default:!0}})}),Xt("change",Y,S),P(n,F),at()}zi(["change","click"]);var Y3=Z("<!> ",1),K3=Z('<div class="panel-footer px-3 svelte-1txzu1i"><div class="gap-2 flex flex-wrap items-center justify-center"><!> <!></div> <!></div>'),Z3=Z('<div class="panel-content-wrapper svelte-1txzu1i"><!> <!></div>'),$3=Z('<div class="my-4 gap-2 flex items-center"><div class="h-px flex-1 bg-border"></div> <span class="text-xs font-medium px-1 text-muted-foreground"> </span> <div class="h-px flex-1 bg-border"></div></div> <!>',1),J3=Z('<div class="drawer-footer svelte-1txzu1i"><!></div>'),Q3=Z('<div class="min-h-0 flex flex-1 flex-col"><!></div> <div style="z-index: 40;"><button class="drawer-handle-bar svelte-1txzu1i"><div class="drawer-pill svelte-1txzu1i"></div> <span class="text-sm font-medium ml-2 text-foreground"> </span> <!></button> <div class="drawer-content svelte-1txzu1i"><div class="px-3 pb-6"><!> <!></div></div> <!></div>',1),eD=Z('<div class="my-4 gap-2 flex items-center"><div class="h-px flex-1 bg-border"></div> <span class="text-xs font-medium px-1 text-muted-foreground"> </span> <div class="h-px flex-1 bg-border"></div></div> <!>',1),tD=Z('<div class="drawer-footer svelte-1txzu1i"><!></div>'),nD=Z('<div class="flex flex-1 flex-col overflow-hidden"><div class="px-3 pt-3 flex-1 overflow-y-auto"><!> <!></div> <!></div>'),iD=Z('<div class="min-h-0 flex h-full flex-1 justify-center"><div class="min-h-0 flex h-full w-4/5 flex-col"><!></div></div>'),rD=Z("<div><!></div>"),sD=Z("<!> <!>",1),aD=Z("<div><!></div>"),oD=Z("<!> <!>",1),lD=Z("<!> <!> <!>",1),cD=Z('<div class="min-h-0 flex h-full flex-1"><!> <!> <!></div>'),uD=Z('<div data-layout-root=""><!></div> <!>',1);function dD(n,e){st(e,!0);const t=(se,ue=wt,be=wt,Fe,Ue)=>{let Pe=th(()=>nh(Fe?.(),!0)),ke=th(()=>nh(Ue?.(),!0));var Ie=Z3(),We=$(Ie);{var ze=je=>{o3(je,{get schema(){return e.schema},get values(){return e.values},get onValueChange(){return e.onValueChange},get panelFilter(){return ue()},get requestedTabId(){return be()}})};xe(We,je=>{e.schema.layout.type==="tabbed"&&je(ze)})}var He=ae(We,2);{var V=je=>{var Ve=K3(),Xe=$(Ve),Se=$(Xe);{var Ce=re=>{q3(re,{get schema(){return e.schema},get currentValues(){return e.values},onLoadValues:O,get showSaveButton(){return p()},get showLoadButton(){return m()},get onSaveState(){return e.onSaveState},get onListStates(){return e.onListStates},get labels(){return e.presetLabels}})};xe(Se,re=>{u(Pe)&&re(Ce)})}var C=ae(Se,2);Zt(C,17,h,re=>re.id,(re,de)=>{{let ye=z(()=>u(de).variant??"outline"),ve=z(()=>u(de).size??"sm");Bn(re,{get variant(){return u(ye)},get size(){return u(ve)},get onclick(){return u(de).onclick},children:(oe,pe)=>{var Re=Y3(),Le=ee(Re);{var Ee=et=>{const Ye=z(()=>u(de).icon);var ht=we(),J=ee(ht);Ne(J,()=>u(Ye),(Ge,Te)=>{Te(Ge,{class:"mr-2 h-4 w-4"})}),P(et,ht)};xe(Le,et=>{u(de).icon&&et(Ee)})}var De=ae(Le);Me(()=>Ae(De,` ${u(de).label??""}`)),P(oe,Re)},$$slots:{default:!0}})}}),q(Xe);var M=ae(Xe,2);{var H=re=>{dc(re,{get hasPendingChanges(){return l()},get hasNeverSolved(){return c()},get isSolving(){return e.isSolving},get oncalculate(){return f()}})};xe(M,re=>{!u(A)&&u(ke)&&e.schema.instanceSolve===!1&&re(H)})}q(Ve),P(je,Ve)};xe(He,je=>{(u(Pe)||!u(A)&&u(ke)&&e.schema.instanceSolve===!1)&&je(V)})}q(Ie),P(se,Ie)},i=Si(),r=z(()=>i.messages),s=48;let a=le(e,"meshes",19,()=>[]),o=le(e,"showSolvingIndicator",3,!1),l=le(e,"hasPendingChanges",3,!1),c=le(e,"hasNeverSolved",3,!1),d=le(e,"isViewerFullscreen",15,!1),f=le(e,"oncalculate",3,()=>{}),h=le(e,"panelActions",19,()=>[]),p=le(e,"showSaveButton",3,!0),m=le(e,"showLoadButton",3,!0),x=le(e,"viewerConfig",19,()=>({}));const v=z(()=>!!(e.schema?.viewerOptions?.enableLocal||e.schema?.viewerOptions?.enableRemote)),g=z(()=>e.schema.layout.type==="tabbed"?e.schema.layout.tabs.filter(se=>se.position!=="right"):[]),y=z(()=>e.schema.layout.type==="tabbed"?e.schema.layout.tabs.filter(se=>se.position==="right"):[]),w=z(()=>u(g).length>0),b=z(()=>u(y).length>0),E=z(()=>u(v)||u(b)),S=z(()=>!u(v)&&u(w)&&u(b));let A=Oe(!1),_=Oe(!1);const T=z(()=>u(g)[0]?.label??u(r).parametersTab);Pt(()=>{const se=window.matchMedia("(max-width: 639px)");function ue(){W(A,se.matches,!0)}return ue(),se.addEventListener("change",ue),()=>se.removeEventListener("change",ue)});let D=Oe(!1),L=Oe(!1),F=Oe(null),B=Oe(null),U=Oe(null),N=Oe(null);const R=z(()=>`${u(w)?"L":""}${u(v)?"V":""}${u(b)?"R":""}`);async function O(se){Object.assign(e.values,se),await e.onLoadValues?.(se)}let Y=0;function K(se){Y=se.touches[0].clientY}function ne(se){const ue=se.changedTouches[0].clientY-Y;Math.abs(ue)>40&&W(_,ue<0)}var ce=uD(),k=ee(ce);let te;var fe=$(k);{var me=se=>{var ue=we(),be=ee(ue);{var Fe=Pe=>{var ke=Q3(),Ie=ee(ke),We=$(Ie);{let ve=z(()=>({...x(),backgroundColor:e.schema?.viewerOptions?.backgroundColor,showSceneManager:!1}));Yf(We,{get meshes(){return a()},get isSolving(){return e.isSolving},get isBlurred(){return u(_)},get drawerOpen(){return u(_)},get logoUrl(){return e.logoUrl},get viewerConfig(){return u(ve)},get isFullscreen(){return d()},set isFullscreen(oe){d(oe)}})}q(Ie);var ze=ae(Ie,2);let He;var V=$(ze),je=ae($(V),2),Ve=$(je,!0);q(je);var Xe=ae(je,2);{let ve=z(()=>u(_)?"":"rotate-180");jv(Xe,{size:16,get class(){return`ml-auto text-muted-foreground transition-transform duration-300 ${u(ve)??""}`}})}q(V);var Se=ae(V,2),Ce=$(Se),C=$(Ce);{var M=ve=>{t(ve,()=>u(b)?"left":void 0,()=>u(U),()=>!u(b),()=>!1)};xe(C,ve=>{u(w)&&ve(M)})}var H=ae(C,2);{var re=ve=>{var oe=$3(),pe=ee(oe),Re=ae($(pe),2),Le=$(Re,!0);q(Re),yt(2),q(pe);var Ee=ae(pe,2);t(Ee,()=>"right",()=>u(N),()=>!0,()=>!1),Me(()=>Ae(Le,u(y)[0]?.label??u(r).moreTab)),P(ve,oe)};xe(H,ve=>{u(b)&&ve(re)})}q(Ce),q(Se);var de=ae(Se,2);{var ye=ve=>{var oe=J3(),pe=$(oe);dc(pe,{get hasPendingChanges(){return l()},get hasNeverSolved(){return c()},get isSolving(){return e.isSolving},get oncalculate(){return f()}}),q(oe),P(ve,oe)};xe(de,ve=>{e.schema.instanceSolve===!1&&ve(ye)})}q(ze),Me(()=>{He=Dt(ze,1,"drawer-container svelte-1txzu1i",null,He,{"drawer-open":u(_),"drawer-closed":!u(_)}),Qt(V,"aria-label",u(_)?u(r).collapsePanel:u(r).expandPanel),Qt(V,"aria-expanded",u(_)),Ae(Ve,u(T))}),Xt("click",V,()=>W(_,!u(_))),Xt("touchstart",V,K),Xt("touchend",V,ne),P(Pe,ke)},Ue=Pe=>{var ke=nD(),Ie=$(ke),We=$(Ie);{var ze=Xe=>{t(Xe,()=>u(b)?"left":void 0,()=>u(U),()=>!u(b),()=>!1)};xe(We,Xe=>{u(w)&&Xe(ze)})}var He=ae(We,2);{var V=Xe=>{var Se=eD(),Ce=ee(Se),C=ae($(Ce),2),M=$(C,!0);q(C),yt(2),q(Ce);var H=ae(Ce,2);t(H,()=>"right",()=>u(N),()=>!0,()=>!1),Me(()=>Ae(M,u(y)[0]?.label??u(r).moreTab)),P(Xe,Se)};xe(He,Xe=>{u(b)&&Xe(V)})}q(Ie);var je=ae(Ie,2);{var Ve=Xe=>{var Se=tD(),Ce=$(Se);dc(Ce,{get hasPendingChanges(){return l()},get hasNeverSolved(){return c()},get isSolving(){return e.isSolving},get oncalculate(){return f()}}),q(Se),P(Xe,Se)};xe(je,Xe=>{e.schema.instanceSolve===!1&&Xe(Ve)})}q(ke),P(Pe,ke)};xe(be,Pe=>{u(v)?Pe(Fe):Pe(Ue,-1)})}P(se,ue)},G=se=>{var ue=iD(),be=$(ue),Fe=$(be);t(Fe,()=>u(b)?"right":void 0,()=>u(b)?u(N):u(U),()=>!u(b),()=>!u(b)),q(be),q(ue),P(se,ue)},Q=se=>{var ue=cD(),be=$(ue);{var Fe=Ie=>{hp(Ie,{side:"left",get tabs(){return u(g)},collapsedWidth:s,onExpand:()=>u(F)?.expand(),onTabClick:We=>{W(U,We,!0),u(F)?.expand()}})};xe(be,Ie=>{u(D)&&u(E)&&u(w)&&Ie(Fe)})}var Ue=ae(be,2);Ne(Ue,()=>mg,(Ie,We)=>{We(Ie,{direction:"horizontal",get autoSaveId(){return`selva-layout-${u(R)??""}`},class:"min-h-0 flex-1",children:(ze,He)=>{var V=lD(),je=ee(V);{var Ve=M=>{var H=sD(),re=ee(H);{let ye=z(()=>u(S)?50:u(v)&&u(b)?22:30);Ne(re,()=>sa,(ve,oe)=>{ui(oe(ve,{order:1,get defaultSize(){return u(ye)},minSize:15,maxSize:45,collapsible:!0,collapsedSize:0,onCollapse:()=>W(D,!0),onExpand:()=>W(D,!1),class:"ml-1",children:(pe,Re)=>{var Le=rD(),Ee=$(Le);t(Ee,()=>u(b)?"left":void 0,()=>u(U)),q(Le),Me(()=>Dt(Le,1,`min-h-0 flex h-full flex-col ${d()||u(D)?"hidden":""}`)),P(pe,Le)},$$slots:{default:!0}}),pe=>W(F,pe,!0),()=>u(F))})}var de=ae(re,2);Ne(de,()=>xu,(ye,ve)=>{ve(ye,{withHandle:!0,class:"bg-transparent",get"data-collapsed"(){return u(D)},onclick:()=>{u(D)&&u(F)?.expand()}})}),P(M,H)};xe(je,M=>{u(w)&&M(Ve)})}var Xe=ae(je,2);{var Se=M=>{var H=we(),re=ee(H);Ne(re,()=>sa,(de,ye)=>{ye(de,{order:2,minSize:20,class:"min-h-0 mx-1 flex flex-col",children:(ve,oe)=>{{let pe=z(()=>({backgroundColor:e.schema?.viewerOptions?.backgroundColor}));Yf(ve,{get meshes(){return a()},get isSolving(){return e.isSolving},get logoUrl(){return e.logoUrl},get viewerConfig(){return u(pe)},get isFullscreen(){return d()},set isFullscreen(Re){d(Re)}})}},$$slots:{default:!0}})}),P(M,H)};xe(Xe,M=>{u(v)&&M(Se)})}var Ce=ae(Xe,2);{var C=M=>{var H=oD(),re=ee(H);Ne(re,()=>xu,(ye,ve)=>{ve(ye,{withHandle:!0,class:"bg-transparent",get"data-collapsed"(){return u(L)},onclick:()=>{u(L)&&u(B)?.expand()}})});var de=ae(re,2);{let ye=z(()=>u(S)?50:25);Ne(de,()=>sa,(ve,oe)=>{ui(oe(ve,{order:3,get defaultSize(){return u(ye)},minSize:15,maxSize:45,collapsible:!0,collapsedSize:0,onCollapse:()=>W(L,!0),onExpand:()=>W(L,!1),class:"mr-1",children:(pe,Re)=>{var Le=aD(),Ee=$(Le);t(Ee,()=>"right",()=>u(N),()=>!u(w),()=>!u(w)),q(Le),Me(()=>Dt(Le,1,`min-h-0 flex h-full flex-col ${d()||u(L)?"hidden":""}`)),P(pe,Le)},$$slots:{default:!0}}),pe=>W(B,pe,!0),()=>u(B))})}P(M,H)};xe(Ce,M=>{u(b)&&M(C)})}P(ze,V)},$$slots:{default:!0}})});var Pe=ae(Ue,2);{var ke=Ie=>{hp(Ie,{side:"right",get tabs(){return u(y)},collapsedWidth:s,onExpand:()=>u(B)?.expand(),onTabClick:We=>{W(N,We,!0),u(B)?.expand()}})};xe(Pe,Ie=>{u(L)&&u(b)&&Ie(ke)})}q(ue),P(se,ue)};xe(fe,se=>{u(A)?se(me):!u(v)&&!u(S)&&u(w)!==u(b)?se(G,1):se(Q,-1)})}q(k);var j=ae(k,2);V2(j,{get show(){return o()}}),Me(()=>te=Dt(k,1,`min-h-0 sm:flex-row sm:py-(--page-py) flex flex-1 flex-col overflow-hidden ${u(D)?"sm:pl-0":"sm:pl-(--page-px)"} ${u(L)?"sm:pr-0":"sm:pr-(--page-px)"}`,"svelte-1txzu1i",te,{"fullscreen-layout":d(),relative:u(A)})),P(n,ce),at()}zi(["click","touchstart","touchend"]);function hD(n){const{FAST_THRESHOLD_MS:e,SLOW_THRESHOLD_MS:t,HISTORY_SIZE:i,ANIMATION_DELAY:r}=us.SOLVING_INDICATOR;let s=Oe(!1),a=null,o=null;const l=[];return Pt(()=>{const c=n();return wn(()=>{if(c){o=performance.now();const d=l.length===0?1/0:l.reduce((h,p)=>h+p,0)/l.length;if(l.length>0&&d<e)return;const f=d===1/0||d>=t?0:(d-e)/(t-e)*r;a||(f===0?W(s,!0):a=setTimeout(()=>{W(s,!0),a=null},f))}else o!==null&&(l.push(performance.now()-o),l.length>i&&l.shift(),o=null),a&&(clearTimeout(a),a=null),W(s,!1)}),()=>{a&&clearTimeout(a)}}),{get show(){return u(s)}}}const fD="external";function pD(n,e){return`${fD}:${n}:${e}`}function fp(n){const{scopeKey:e,inputId:t}=n;if(!e||!t||typeof sessionStorage>"u")return;const i=sessionStorage.getItem(pD(e,t));if(i!==null)try{return JSON.parse(i)}catch{return}}function mD(n){return xP(n).filter(e=>e.source?.kind==="client").map(e=>({paramId:e.paramId,displayName:e.displayName??e.paramId}))}const gD=6e4;function vD(n,e={}){const{timeout:t=gD}=e;let i=Oe(!1),r=Oe(null),s=null;function a(){s?.abort(),s=null}async function o(d){a(),s=new AbortController;const{signal:f}=s,h=setTimeout(()=>s?.abort(),t);W(i,!0);try{await n(d,f)}catch(p){(!(p instanceof Error)||p.name!=="AbortError"&&p.name!=="TimeoutError")&&console.error("[computeThrottle] unhandled error in computeFn:",p)}finally{if(clearTimeout(h),W(i,!1),s=null,u(r)!==null){const p=u(r);W(r,null),o(p)}}}function l(d){u(i)?W(r,d,!0):o(d)}function c(){W(r,null),a()}return{trigger:l,get isComputing(){return u(i)},get hasPending(){return u(r)!==null},cancel:c}}function _D(n){switch(n){case"number":case"integer":return 0;case"boolean":return!1;case"text":return"";default:return null}}function pp(n,e,t){const i=new Set(mD(n).map(s=>s.paramId)),r={};for(const s of n.inputs){if(i.has(s.id)){const a=t({scopeKey:e,inputId:s.id});a!==void 0&&(r[s.id]=a);continue}r[s.id]=s.default??_D(s.paramType)}for(const s of n.outputs)r[s.id]=null;return r}function mp(n){const e=n===!1;return{hasPendingChanges:e,hasNeverSolved:e}}function xD(n,e,t,i){return n.values[e]=t,i===!1?(n.pendingValues[e]=t,n.hasPendingChanges=!0,{state:n,shouldSolve:!1}):{state:n,shouldSolve:!0}}function bD(n,e){return n.error="",n.computeErrors=e.errors??[],n.computeWarnings=e.warnings??[],n.meshes=e.meshes??[],Object.assign(n.values,e.outputs),n.pendingValues={},n.hasPendingChanges=!1,n.hasNeverSolved=!1,n}function yD(n){let e=n.schema;const t=mp(e?.instanceSolve),i=Ps({values:pp(e,n.scopeKey,fp),error:"",computeErrors:[],computeWarnings:[],meshes:[],pendingValues:{},hasPendingChanges:t.hasPendingChanges,hasNeverSolved:t.hasNeverSolved});function r(){n.driver.solve(Nu(i.values))}return{get values(){return i.values},get error(){return i.error},get computeErrors(){return i.computeErrors},get computeWarnings(){return i.computeWarnings},get meshes(){return i.meshes},get hasPendingChanges(){return i.hasPendingChanges},get hasNeverSolved(){return i.hasNeverSolved},get isSolving(){return n.driver.isSolving},setValue(s,a,o=!1){const{shouldSolve:l}=xD(i,s,a,e?.instanceSolve);(l||o)&&(o&&!l&&(i.pendingValues={},i.hasPendingChanges=!1),r())},solve(){r()},loadValues(s){Object.assign(i.values,s),e?.instanceSolve!==!1?r():i.hasPendingChanges=!0},rebuild(s,a){e=s,i.meshes=[],i.error="",i.computeErrors=[],i.computeWarnings=[],i.pendingValues={},i.values=pp(s,a,fp);const o=mp(s?.instanceSolve);i.hasPendingChanges=o.hasPendingChanges,i.hasNeverSolved=o.hasNeverSolved,s&&Object.keys(i.values).length>0&&s.instanceSolve!==!1&&r()},report(s){bD(i,s)},reportError(s){i.error=s}}}function SD(n,e,t={}){const i=vD(async(r,s)=>{try{const a=await n(r,s);if(s.aborted)return;e().report(a)}catch(a){if(s.aborted)return;e().reportError(a instanceof Error?a.message:String(a))}},t);return{solve(r){i.trigger(r)},cancel(){i.cancel()},get isSolving(){return i.isComputing}}}function MD(n){tl(()=>{const e=Ms(rh);!e||!n.component||e.register(n)}),yp(()=>{try{Ms(rh)?.unregister(n.id)}catch{}})}const wD=n=>{if(!n)return"";const e=n.replace(/^#/,"");if(!/^[0-9A-Fa-f]{6}$/.test(e))return n;const t=parseInt(e.slice(0,2),16)/255,i=parseInt(e.slice(2,4),16)/255,r=parseInt(e.slice(4,6),16)/255,s=b=>b<=.04045?b/12.92:Math.pow((b+.055)/1.055,2.4),a=s(t),o=s(i),l=s(r),c=a*.4124564+o*.3575761+l*.1804375,d=a*.2126729+o*.7151522+l*.072175,f=a*.0193339+o*.119192+l*.9503041,h=Math.cbrt(.8189330101*c+.3618667424*d-.1288597137*f),p=Math.cbrt(.0329845436*c+.9293118715*d+.0361456387*f),m=Math.cbrt(.0482003018*c+.2643662691*d+.633851707*f),x=.2104542553*h+.793617785*p-.0040720468*m,v=1.9779984951*h-2.428592205*p+.4505937099*m,g=.0259040371*h+.7827717662*p-.808675766*m,y=Math.sqrt(v*v+g*g);let w=Math.atan2(g,v)*180/Math.PI;return w<0&&(w+=360),`oklch(${x.toFixed(3)} ${y.toFixed(3)} ${w.toFixed(1)})`};var ED=Z('<div class="min-h-100 p-8 flex items-center justify-center"><!></div>'),TD=Z('<div class="min-h-100 flex items-center justify-center"><!></div>'),AD=Z("<div><!></div>");function CD(n,e){st(e,!0);let t=le(e,"definitionKey",3,""),i=le(e,"showModeToggle",3,!1),r=le(e,"panelActions",19,()=>[]),s=le(e,"showSaveButton",3,!0),a=le(e,"showLoadButton",3,!0),o=le(e,"footerItemId",3,"footer-item"),l=le(e,"footerItemPriority",3,0);nR(e.clientSlot);const c=Si();ng(()=>e.lang??c.locale);const d=z(()=>Si().messages),f=z(()=>e.externalScopeKey||t()||e.schema?.id||""),h=SD(e.onSolve,()=>p,{timeout:e.solveTimeoutMs}),p=yD({schema:e.schema,scopeKey:e.externalScopeKey||t()||e.schema?.id||"",driver:h});let m=Oe(!1);const x=hD(()=>p.isSolving);Pt(()=>{e.onReady?.({loadValues:L=>p.loadValues(L)})});let v=Oe(""),g=Oe(!0);Pt(()=>{t(),wn(()=>{u(g)?(W(g,!1),W(v,t()),e.schema?.instanceSolve!==!1&&p.solve()):u(v)!==t()&&(p.rebuild(e.schema,u(f)),W(v,t()))})});function y(L,F,B=!1){p.setValue(L,F,B)}function w(){p.solve()}MD({id:wn(()=>o()),component:wn(()=>e.footerComponent),getProps:()=>e.footerComponentProps?.()??{},position:"left",priority:wn(()=>l())});let b=z(()=>e.isEmbedded??ih.url.searchParams.get("embed")==="true"),E=z(()=>e.primaryColor??ih.url.searchParams.get("primary")),S=z(()=>u(E)?`--primary: ${wD(u(E))}`:""),A=z(()=>e.title??(e.schema?.description||e.schema.name));var _=AD();let T;var D=$(_);{let L=z(()=>!u(b));Zg(D,{mode:"fixed",get showHeader(){return u(L)},showFooter:!0,get title(){return u(A)},get showModeToggle(){return i()},get copyrightName(){return e.copyrightName},get footerText(){return e.footerText},get header(){return e.header},get rightContent(){return e.headerRight},get errors(){return p.computeErrors},get warnings(){return p.computeWarnings},children:(F,B)=>{var U=we(),N=ee(U);{var R=K=>{var ne=ED(),ce=$(ne);wu(ce,{type:"error",size:"medium",get message(){return p.error}}),q(ne),P(K,ne)},O=K=>{var ne=TD(),ce=$(ne);wu(ce,{type:"loading",size:"large",get message(){return u(d).loadingSchema}}),q(ne),P(K,ne)},Y=K=>{var ne=we(),ce=ee(ne);pv(ce,t,k=>{{let te=z(()=>e.schema.instanceSolve!==!1&&x.show);dD(k,{get schema(){return e.schema},get meshes(){return p.meshes},get isSolving(){return p.isSolving},get showSolvingIndicator(){return u(te)},get hasPendingChanges(){return p.hasPendingChanges},get hasNeverSolved(){return p.hasNeverSolved},get values(){return p.values},get logoUrl(){return e.logo},get panelActions(){return r()},get showSaveButton(){return s()},get showLoadButton(){return a()},get onSaveState(){return e.onSaveState},get onListStates(){return e.onListStates},get presetLabels(){return e.presetLabels},onValueChange:y,oncalculate:w,onLoadValues:()=>p.loadValues({}),get isViewerFullscreen(){return u(m)},set isViewerFullscreen(fe){W(m,fe,!0)}})}}),P(K,ne)};xe(N,K=>{p.error?K(R):e.schema?K(Y,-1):K(O,1)})}P(F,U)},$$slots:{default:!0}})}q(_),Me(()=>T=Ii(_,u(S),T,{display:"contents"})),P(n,_),at()}var PD=Z('<div class="text-muted-foreground flex items-center gap-1.5 text-xs"><!> <span> </span></div>');function RD(n,e){var t=we(),i=ee(t);{var r=s=>{var a=PD(),o=$(a);Jg(o,{class:"h-3 w-3"});var l=ae(o,2),c=$(l,!0);q(l),q(a),Me(()=>Ae(c,e.label)),P(s,a)};xe(i,s=>{e.label&&s(r)})}P(n,t)}const DD=""+new URL("../assets/rhino3dm.BI8ESrUA.wasm",import.meta.url).href;var LD=Z('<span class="bg-warning/15 text-warning rounded-full px-2.5 py-1 font-mono text-[11px] font-medium tracking-wide uppercase"> </span>'),ID=Z('<span class="bg-warning/15 text-warning rounded-full px-2.5 py-1 font-mono text-[11px] font-medium tracking-wide uppercase">Draft preview</span>'),ND=Z("<!> <!>",1);function PL(n,e){st(e,!0);let t=null;function i(){return t||(t=gp(()=>import("../chunks/-xEd7dwr.js").then(o=>o.r),[],import.meta.url).then(o=>{const l=o.default;return l({locateFile:()=>DD})})),t}let r=0;function s(o){const l={};if(!o)return l;for(const c of o.split(",")){const[d,...f]=c.split(";").map(m=>m.trim()),h=f.find(m=>m.startsWith("dur="));if(!d||!h)continue;const p=Number(h.slice(4));Number.isFinite(p)&&(l[d]=p)}return l}const a=async(o,l)=>{const c=r-Date.now();if(c>0)throw new Error(`Rate limit reached. Try again in ${Math.ceil(c/1e3)}s.`);const d=performance.now(),f=JSON.stringify({inputs:e.data.schema.inputs,values:o,definitionUrl:e.data.ghDefinition,...e.data.versionId?{versionId:e.data.versionId}:e.data.channel==="draft"&&{channel:"draft"}}),h=JSON.stringify(o).length;let p;try{p=await fetch("/api/compute",{method:"POST",headers:{"Content-Type":"application/json"},body:f,signal:l})}catch(j){if(l.aborted)return{outputs:{}};throw new Error("Request blocked — your session may have expired. Reload the page to sign in again.",{cause:j})}if(l.aborted)return{outputs:{}};if(!p.ok){if(p.status===503)throw new Error("Compute server is offline or unreachable. Please try again later.");if(p.status===429){const se=await p.json().catch(()=>({})),ue=Number(p.headers.get("Retry-After"))||Number(se.retryAfter)||5;throw r=Date.now()+ue*1e3,new Error(se.message||`Rate limit reached. Try again in ${ue}s.`)}const j=await p.json().catch(()=>({}));throw new Error(j.message||"Compute error")}const m=performance.now()-d,x=performance.now(),v=await p.text();if(l.aborted)return{outputs:{}};const g=performance.now()-x,y=v.length,w=performance.now(),b=JSON.parse(v),E=new w_(b,!1),S=performance.now()-w,A=e.data.schema.viewerOptions?.enableLocal||e.data.schema.viewerOptions?.enableRemote,_=performance.now(),T=A?await i():null,D=performance.now()-_,L=performance.now(),F=T?await E.extractMeshesFromResponse({rhino:T}):[],B=performance.now()-L,U=performance.now(),N={};for(const j of e.data.schema.outputs){const se=E.getValue({byId:j.id},{parseValues:!0}),ue=j.nickname;N[j.id]=se??(ue?E.getValue({byName:ue},{parseValues:!0}):void 0)}const R=performance.now()-U,O=s(p.headers.get("Server-Timing")),Y=O.total??0,K=Math.max(0,m-Y),ne=y/(1024*1024),ce=ne>=1?`${ne.toFixed(2)} MB`:`${(y/1024).toFixed(0)} KB`,k=g>0?(ne/(g/1e3)).toFixed(1):"∞",te=m+g+S+D+B+R,fe=f.length/1024,me=fe>=1024?`${(fe/1024).toFixed(2)} MB`:`${fe.toFixed(0)} KB`;if(h>256*1024){const j=ue=>{const be=e.data.schema.inputs.find(Fe=>Fe.id===ue);return be?`${be.nickname} (${be.paramType})`:ue},se=Object.entries(o).map(([ue,be])=>[ue,JSON.stringify(be)?.length??0]).sort((ue,be)=>be[1]-ue[1]).slice(0,3);console.log("[Compute/browser] └─ request whales: "+se.map(([ue,be])=>`${j(ue)}=${(be/1024).toFixed(0)} KB`).join(" | "))}if(console.log(`[Compute/browser] req=${me} (values ${(h/1024).toFixed(0)} KB) | total=${te.toFixed(0)}ms | ttfb=${m.toFixed(0)}ms (network≈${K.toFixed(0)} + server ${Y.toFixed(0)}) | download=${g.toFixed(0)}ms (${ce} @ ${k} MB/s) | json=${S.toFixed(0)}ms | rhinoInit=${D.toFixed(0)}ms | mesh=${B.toFixed(0)}ms (${F.length}) | outputs=${R.toFixed(0)}ms`),O.total!==void 0&&console.log(`[Compute/browser] └─ server: load=${(O.load??0).toFixed(0)}ms tree=${(O.tree??0).toFixed(0)}ms solve=${(O.solve??0).toFixed(0)}ms serialize=${(O.serialize??0).toFixed(0)}ms`),O.selva_cache!==void 0){const j=O.selva_cache?"Selva-cache HIT — served without calling compute":"miss — solved on Rhino.Compute",se=O.def_reupload===void 0?"":O.def_reupload?" | definition RE-UPLOADED (cold/stale pointer)":" | definition reused on server (no upload)";console.log(`[Compute/browser] └─ cache: ${j}${se}`)}const G=Object.entries(O).filter(([j])=>j.startsWith("p_"));G.length>0&&console.log("[Compute/browser] └─ prep: "+G.map(([j,se])=>`${j.slice(2)}=${se.toFixed(0)}ms`).join(" ")),O.rhino_solve!==void 0&&console.log(`[Compute/browser] └─ compute server: decode=${(O.rhino_decode??0).toFixed(0)}ms solve=${(O.rhino_solve??0).toFixed(0)}ms encode=${(O.rhino_encode??0).toFixed(0)}ms | compute↔server traffic+queue=${(O.compute_link??0).toFixed(0)}ms`);const Q=performance.getEntriesByType("resource").filter(j=>j.name.includes("/api/compute")&&j.startTime>=d).at(-1);if(Q&&Q.responseEnd>0){const j=Q.transferSize/1048576,se=Q.encodedBodySize>0&&Q.decodedBodySize>Q.encodedBodySize*1.05;console.log(`[Compute/browser] └─ wire (network-stack): ${j.toFixed(2)} MB on-wire (${se?`compressed ${(Q.decodedBodySize/Q.encodedBodySize).toFixed(1)}×`:"UNCOMPRESSED"}) | headers=${(Q.responseStart-Q.requestStart).toFixed(0)}ms body=${(Q.responseEnd-Q.responseStart).toFixed(0)}ms`)}return{outputs:N,meshes:F,errors:b.errors??[],warnings:b.warnings??[]}};{const o=d=>{var f=ND(),h=ee(f);{var p=v=>{var g=LD(),y=$(g);q(g),Me(()=>Ae(y,`v${e.data.versionNumber??""} preview`)),P(v,g)},m=v=>{var g=ID();P(v,g)};xe(h,v=>{e.data.versionId?v(p):e.data.channel==="draft"&&v(m,1)})}var x=ae(h,2);$g(x,{}),P(d,f)};let l=z(()=>e.data.schema?.description||e.data.schema.name),c=z(()=>e.data.orgLogoUrl??void 0);CD(n,{get schema(){return e.data.schema},onSolve:a,get definitionKey(){return e.data.currentDefinition},get title(){return u(l)},get logo(){return u(c)},showModeToggle:!0,get solveTimeoutMs(){return e.data.solveTimeoutMs},get footerComponent(){return RD},footerComponentProps:()=>({label:e.data.serverLabel}),headerRight:o,$$slots:{headerRight:!0}})}at()}const UD=Object.freeze(Object.defineProperty({__proto__:null,BINARY_MESH_MAGIC:mu,BINARY_MESH_VERSION:gu,EDGE_USERDATA_KIND:ua,FLAG_FLOAT32:Id,Materials:qm,SCALE_FACTORS:Qm,addEdges:km,applyOffset:Fm,computeCombinedBoundingBox:fl,createCameraController:Om,createGrid:zm,createLabelLayer:Gm,createMeasureTool:Xm,createRenderPipeline:Hm,createViewGizmo:Bm,getThreeMeshesFromComputeResponse:DT,initThree:jm,isEdgeOverlay:Vm,parseBinaryMeshBatch:Nd,parseColor:Um,parseDisplayItems:Ym,parseMeshBatch:Zm,parseMeshBatchBlob:MT,parseMeshBatchObject:$m,removeEdges:TE,snapToVertex:Wm,updateScene:Nm},Symbol.toStringTag,{value:"Module"}));export{PL as component};