@needle-tools/engine 4.8.4 → 4.8.5

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 (58) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +5 -0
  3. package/dist/{gltf-progressive-PB_58h1b.umd.cjs → gltf-progressive-C-U_onhf.umd.cjs} +1 -1
  4. package/dist/{gltf-progressive-DorC035H.min.js → gltf-progressive-DViD_J_l.min.js} +1 -1
  5. package/dist/{gltf-progressive-B3JW4cAu.js → gltf-progressive-DXRy9EQz.js} +35 -35
  6. package/dist/loader.worker-CiTwpNPW.js +27 -0
  7. package/dist/{needle-engine.bundle-BWvmuHDE.umd.cjs → needle-engine.bundle-C-qzYkeq.umd.cjs} +134 -135
  8. package/dist/{needle-engine.bundle-F7Kw2jq3.min.js → needle-engine.bundle-CKG2fLvO.min.js} +138 -139
  9. package/dist/{needle-engine.bundle-DnjGFnfL.js → needle-engine.bundle-fEU9eTH-.js} +6363 -6394
  10. package/dist/needle-engine.js +4 -4
  11. package/dist/needle-engine.min.js +1 -1
  12. package/dist/needle-engine.umd.cjs +1 -1
  13. package/dist/{postprocessing-BgC7XZwK.umd.cjs → postprocessing-61aXdqNz.umd.cjs} +1 -1
  14. package/dist/{postprocessing-ChsrvDkI.min.js → postprocessing-Be9Ds4NK.min.js} +1 -1
  15. package/dist/{postprocessing-DddlM3CK.js → postprocessing-D9jDHD0U.js} +2 -2
  16. package/dist/{three-DrqIzZTH.js → three-BRSLmpyi.js} +2966 -2958
  17. package/dist/{three-DuDKwKB8.min.js → three-CsmWHVn7.min.js} +172 -172
  18. package/dist/{three-B_hneGZr.umd.cjs → three-Dceyffus.umd.cjs} +176 -176
  19. package/dist/{three-examples-BIuXQPSf.js → three-examples-BihZ_R96.js} +2761 -2623
  20. package/dist/{three-examples-CNRuT27G.umd.cjs → three-examples-Ce6Th3bv.umd.cjs} +17 -17
  21. package/dist/three-examples-DKY9Nfge.min.js +501 -0
  22. package/dist/{three-mesh-ui-DWcMuyQ_.min.js → three-mesh-ui-Bwy12Qvg.min.js} +1 -1
  23. package/dist/{three-mesh-ui-tt0buEDC.umd.cjs → three-mesh-ui-Cdh2iW8b.umd.cjs} +1 -1
  24. package/dist/{three-mesh-ui-D6Mz5Yl7.js → three-mesh-ui-gqAXlGNB.js} +1 -1
  25. package/dist/{vendor-C31T0mYm.min.js → vendor-BRpzuoJE.min.js} +1 -1
  26. package/dist/{vendor-D51IT5ns.umd.cjs → vendor-Ja-vKV-a.umd.cjs} +1 -1
  27. package/dist/{vendor-B_ytQUuR.js → vendor-p_xp9KuJ.js} +1 -1
  28. package/lib/engine/debug/debug_console.js +3 -33
  29. package/lib/engine/debug/debug_console.js.map +1 -1
  30. package/lib/engine/engine_pmrem.d.ts +2 -0
  31. package/lib/engine/engine_pmrem.js +100 -0
  32. package/lib/engine/engine_pmrem.js.map +1 -0
  33. package/lib/engine-components/Camera.js +1 -1
  34. package/lib/engine-components/Camera.js.map +1 -1
  35. package/lib/engine-components/CameraUtils.js +0 -5
  36. package/lib/engine-components/CameraUtils.js.map +1 -1
  37. package/lib/engine-components/DragControls.js +0 -1
  38. package/lib/engine-components/DragControls.js.map +1 -1
  39. package/lib/engine-components/Duplicatable.js +5 -2
  40. package/lib/engine-components/Duplicatable.js.map +1 -1
  41. package/lib/engine-components/Skybox.d.ts +0 -2
  42. package/lib/engine-components/Skybox.js +26 -110
  43. package/lib/engine-components/Skybox.js.map +1 -1
  44. package/lib/engine-components/TransformGizmo.js +10 -2
  45. package/lib/engine-components/TransformGizmo.js.map +1 -1
  46. package/package.json +3 -3
  47. package/src/engine/debug/debug_console.ts +3 -33
  48. package/src/engine/engine_pmrem.ts +118 -0
  49. package/src/engine-components/Camera.ts +1 -1
  50. package/src/engine-components/CameraUtils.ts +0 -5
  51. package/src/engine-components/DragControls.ts +0 -1
  52. package/src/engine-components/Duplicatable.ts +3 -2
  53. package/src/engine-components/Skybox.ts +30 -102
  54. package/src/engine-components/TransformGizmo.ts +11 -2
  55. package/src/include/ktx2/basis_transcoder.js +8 -10
  56. package/src/include/ktx2/basis_transcoder.wasm +0 -0
  57. package/dist/loader.worker-CrU5fNbR.js +0 -27
  58. package/dist/three-examples-D2zemuAM.min.js +0 -501
@@ -1,27 +0,0 @@
1
- (function(){"use strict";var iA=(function(){var a="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",e="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLao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gv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),s=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var i=WebAssembly.validate(t)?e:a,n,r=WebAssembly.instantiate(o(i),{}).then(function(m){n=m.instance,n.exports.__wasm_call_ctors()});function o(m){for(var y=new Uint8Array(m.length),C=0;C<m.length;++C){var E=m.charCodeAt(C);y[C]=E>96?E-97:E>64?E-39:E+4}for(var w=0,C=0;C<m.length;++C)y[w++]=y[C]<60?s[y[C]]:(y[C]-60)*64+y[++C];return y.buffer.slice(0,w)}function A(m,y,C,E,w,S){var M=n.exports.sbrk,R=C+3&-4,D=M(R*E),O=M(w.length),H=new Uint8Array(n.exports.memory.buffer);H.set(w,O);var ae=m(D,C,E,O,w.length);if(ae==0&&S&&S(D,R,E),y.set(H.subarray(D,D+C*E)),M(D-M(0)),ae!=0)throw new Error("Malformed buffer data: "+ae)}var h={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},c={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},l=[],u=0;function d(m){var y={object:new Worker(m),pending:0,requests:{}};return y.object.onmessage=function(C){var E=C.data;y.pending-=E.count,y.requests[E.id][E.action](E.value),delete y.requests[E.id]},y}function g(m){for(var y="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(o(i))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+A.toString()+f.toString(),C=new Blob([y],{type:"text/javascript"}),E=URL.createObjectURL(C),w=0;w<m;++w)l[w]=d(E);URL.revokeObjectURL(E)}function p(m,y,C,E,w){for(var S=l[0],M=1;M<l.length;++M)l[M].pending<S.pending&&(S=l[M]);return new Promise(function(R,D){var O=new Uint8Array(C),H=u++;S.pending+=m,S.requests[H]={resolve:R,reject:D},S.object.postMessage({id:H,count:m,size:y,source:O,mode:E,filter:w},[O.buffer])})}function f(m){r.then(function(){var y=m.data;try{var C=new Uint8Array(y.count*y.size);A(n.exports[y.mode],C,y.count,y.size,y.source,n.exports[y.filter]),self.postMessage({id:y.id,count:y.count,action:"resolve",value:C},[C.buffer])}catch(E){self.postMessage({id:y.id,count:y.count,action:"reject",value:E})}})}return{ready:r,supported:!0,useWorkers:function(m){g(m)},decodeVertexBuffer:function(m,y,C,E,w){A(n.exports.meshopt_decodeVertexBuffer,m,y,C,E,n.exports[h[w]])},decodeIndexBuffer:function(m,y,C,E){A(n.exports.meshopt_decodeIndexBuffer,m,y,C,E)},decodeIndexSequence:function(m,y,C,E){A(n.exports.meshopt_decodeIndexSequence,m,y,C,E)},decodeGltfBuffer:function(m,y,C,E,w,S){A(n.exports[c[w]],m,y,C,E,n.exports[h[S]])},decodeGltfBufferAsync:function(m,y,C,E,w){return l.length>0?p(m,y,C,c[E],h[w]):r.then(function(){var S=new Uint8Array(m*y);return A(n.exports[c[E]],S,m,y,C,n.exports[h[w]]),S})}}})();/**
2
- * @license
3
- * Copyright 2010-2024 Three.js Authors
4
- * SPDX-License-Identifier: MIT
5
- */const js="169",Js=0,Cr=1,nA=2,Br=1,xr=100,Qr=204,wr=205,Tr=3,rA=0,qi=0,Sr="attached",oA="detached",Mr=300,Nr=301,aA=302,us=1e3,mt=1001,Vi=1002,je=1003,AA=1004,hA=1005,Rt=1006,cA=1007,ds=1008,Qe=1009,lA=1013,Rr=1014,It=1015,Ft=1016,uA=1020,nt=1023,ji=1026,Fr=1027,Dt=1028,gs=1030,dA=33777,gA=33779,pA=35840,fA=35842,mA=36196,IA=37492,bA=37496,Dr=37808,kr=37812,yA=36492,ps=2300,fs=2301,Ji=2302,_r=2400,Lr=2401,vr=2402,EA=2500,CA=0,Gr=1,Wi=2,Ki=0,BA=1,kt="",ie="srgb",de="srgb-linear",Or="display-p3",Yi="display-p3-linear",Xi="linear",Ur="srgb",zr="rec709",Pr="p3",_t=7680,Hr=519,Ws=35044,rt=2e3,Ks=2001;class Lt{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const s=this._listeners;s[e]===void 0&&(s[e]=[]),s[e].indexOf(t)===-1&&s[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const s=this._listeners;return s[e]!==void 0&&s[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const n=i.indexOf(t);n!==-1&&i.splice(n,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const s=this._listeners[e.type];if(s!==void 0){e.target=this;const i=s.slice(0);for(let n=0,r=i.length;n<r;n++)i[n].call(this,e);e.target=null}}}const Ae=["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 qr=1234567;const ms=Math.PI/180,Is=180/Math.PI;function Ne(){const a=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return(Ae[a&255]+Ae[a>>8&255]+Ae[a>>16&255]+Ae[a>>24&255]+"-"+Ae[e&255]+Ae[e>>8&255]+"-"+Ae[e>>16&15|64]+Ae[e>>24&255]+"-"+Ae[t&63|128]+Ae[t>>8&255]+"-"+Ae[t>>16&255]+Ae[t>>24&255]+Ae[s&255]+Ae[s>>8&255]+Ae[s>>16&255]+Ae[s>>24&255]).toLowerCase()}function he(a,e,t){return Math.max(e,Math.min(t,a))}function Zi(a,e){return(a%e+e)%e}function xA(a,e,t,s,i){return s+(a-e)*(i-s)/(t-e)}function QA(a,e,t){return a!==e?(t-a)/(e-a):0}function bs(a,e,t){return(1-t)*a+t*e}function wA(a,e,t,s){return bs(a,e,1-Math.exp(-t*s))}function TA(a,e=1){return e-Math.abs(Zi(a,e*2)-e)}function SA(a,e,t){return a<=e?0:a>=t?1:(a=(a-e)/(t-e),a*a*(3-2*a))}function MA(a,e,t){return a<=e?0:a>=t?1:(a=(a-e)/(t-e),a*a*a*(a*(a*6-15)+10))}function NA(a,e){return a+Math.floor(Math.random()*(e-a+1))}function RA(a,e){return a+Math.random()*(e-a)}function FA(a){return a*(.5-Math.random())}function DA(a){a!==void 0&&(qr=a);let e=qr+=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 kA(a){return a*ms}function _A(a){return a*Is}function LA(a){return(a&a-1)===0&&a!==0}function vA(a){return Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))}function GA(a){return Math.pow(2,Math.floor(Math.log(a)/Math.LN2))}function OA(a,e,t,s,i){const n=Math.cos,r=Math.sin,o=n(t/2),A=r(t/2),h=n((e+s)/2),c=r((e+s)/2),l=n((e-s)/2),u=r((e-s)/2),d=n((s-e)/2),g=r((s-e)/2);switch(i){case"XYX":a.set(o*c,A*l,A*u,o*h);break;case"YZY":a.set(A*u,o*c,A*l,o*h);break;case"ZXZ":a.set(A*l,A*u,o*c,o*h);break;case"XZX":a.set(o*c,A*g,A*d,o*h);break;case"YXY":a.set(A*d,o*c,A*g,o*h);break;case"ZYZ":a.set(A*g,A*d,o*c,o*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Re(a,e){switch(e.constructor){case Float32Array:return a;case Uint32Array:return a/4294967295;case Uint16Array:return a/65535;case Uint8Array:return a/255;case Int32Array:return Math.max(a/2147483647,-1);case Int16Array:return Math.max(a/32767,-1);case Int8Array:return Math.max(a/127,-1);default:throw new Error("Invalid component type.")}}function z(a,e){switch(e.constructor){case Float32Array:return a;case Uint32Array:return Math.round(a*4294967295);case Uint16Array:return Math.round(a*65535);case Uint8Array:return Math.round(a*255);case Int32Array:return Math.round(a*2147483647);case Int16Array:return Math.round(a*32767);case Int8Array:return Math.round(a*127);default:throw new Error("Invalid component type.")}}const Vr={DEG2RAD:ms,RAD2DEG:Is,generateUUID:Ne,clamp:he,euclideanModulo:Zi,mapLinear:xA,inverseLerp:QA,lerp:bs,damp:wA,pingpong:TA,smoothstep:SA,smootherstep:MA,randInt:NA,randFloat:RA,randFloatSpread:FA,seededRandom:DA,degToRad:kA,radToDeg:_A,isPowerOfTwo:LA,ceilPowerOfTwo:vA,floorPowerOfTwo:GA,setQuaternionFromProperEuler:OA,normalize:z,denormalize:Re};class q{constructor(e=0,t=0){q.prototype.isVector2=!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,s=this.y,i=e.elements;return this.x=i[0]*t+i[3]*s+i[6],this.y=i[1]*t+i[4]*s+i[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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(e,Math.min(t,s)))}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 s=this.dot(e)/t;return Math.acos(he(s,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,s=this.y-e.y;return t*t+s*s}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,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,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 s=Math.cos(t),i=Math.sin(t),n=this.x-e.x,r=this.y-e.y;return this.x=n*s-r*i+e.x,this.y=n*i+r*s+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Fe{constructor(e,t,s,i,n,r,o,A,h){Fe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,s,i,n,r,o,A,h)}set(e,t,s,i,n,r,o,A,h){const c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=n,c[5]=A,c[6]=s,c[7]=r,c[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,s=e.elements;return t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t[4]=s[4],t[5]=s[5],t[6]=s[6],t[7]=s[7],t[8]=s[8],this}extractBasis(e,t,s){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),s.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 s=e.elements,i=t.elements,n=this.elements,r=s[0],o=s[3],A=s[6],h=s[1],c=s[4],l=s[7],u=s[2],d=s[5],g=s[8],p=i[0],f=i[3],m=i[6],y=i[1],C=i[4],E=i[7],w=i[2],S=i[5],M=i[8];return n[0]=r*p+o*y+A*w,n[3]=r*f+o*C+A*S,n[6]=r*m+o*E+A*M,n[1]=h*p+c*y+l*w,n[4]=h*f+c*C+l*S,n[7]=h*m+c*E+l*M,n[2]=u*p+d*y+g*w,n[5]=u*f+d*C+g*S,n[8]=u*m+d*E+g*M,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],s=e[1],i=e[2],n=e[3],r=e[4],o=e[5],A=e[6],h=e[7],c=e[8];return t*r*c-t*o*h-s*n*c+s*o*A+i*n*h-i*r*A}invert(){const e=this.elements,t=e[0],s=e[1],i=e[2],n=e[3],r=e[4],o=e[5],A=e[6],h=e[7],c=e[8],l=c*r-o*h,u=o*A-c*n,d=h*n-r*A,g=t*l+s*u+i*d;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const p=1/g;return e[0]=l*p,e[1]=(i*h-c*s)*p,e[2]=(o*s-i*r)*p,e[3]=u*p,e[4]=(c*t-i*A)*p,e[5]=(i*n-o*t)*p,e[6]=d*p,e[7]=(s*A-h*t)*p,e[8]=(r*t-s*n)*p,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,s,i,n,r,o){const A=Math.cos(n),h=Math.sin(n);return this.set(s*A,s*h,-s*(A*r+h*o)+r+e,-i*h,i*A,-i*(-h*r+A*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply($i.makeScale(e,t)),this}rotate(e){return this.premultiply($i.makeRotation(-e)),this}translate(e,t){return this.premultiply($i.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),s=Math.sin(e);return this.set(t,-s,0,s,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,s=e.elements;for(let i=0;i<9;i++)if(t[i]!==s[i])return!1;return!0}fromArray(e,t=0){for(let s=0;s<9;s++)this.elements[s]=e[s+t];return this}toArray(e=[],t=0){const s=this.elements;return e[t]=s[0],e[t+1]=s[1],e[t+2]=s[2],e[t+3]=s[3],e[t+4]=s[4],e[t+5]=s[5],e[t+6]=s[6],e[t+7]=s[7],e[t+8]=s[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const $i=new Fe;function UA(a){for(let e=a.length-1;e>=0;--e)if(a[e]>=65535)return!0;return!1}function en(a){return document.createElementNS("http://www.w3.org/1999/xhtml",a)}const jr=new Fe().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Jr=new Fe().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),ys={[de]:{transfer:Xi,primaries:zr,luminanceCoefficients:[.2126,.7152,.0722],toReference:a=>a,fromReference:a=>a},[ie]:{transfer:Ur,primaries:zr,luminanceCoefficients:[.2126,.7152,.0722],toReference:a=>a.convertSRGBToLinear(),fromReference:a=>a.convertLinearToSRGB()},[Yi]:{transfer:Xi,primaries:Pr,luminanceCoefficients:[.2289,.6917,.0793],toReference:a=>a.applyMatrix3(Jr),fromReference:a=>a.applyMatrix3(jr)},[Or]:{transfer:Ur,primaries:Pr,luminanceCoefficients:[.2289,.6917,.0793],toReference:a=>a.convertSRGBToLinear().applyMatrix3(Jr),fromReference:a=>a.applyMatrix3(jr).convertLinearToSRGB()}},zA=new Set([de,Yi]),ce={enabled:!0,_workingColorSpace:de,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(a){if(!zA.has(a))throw new Error(`Unsupported working color space, "${a}".`);this._workingColorSpace=a},convert:function(a,e,t){if(this.enabled===!1||e===t||!e||!t)return a;const s=ys[e].toReference,i=ys[t].fromReference;return i(s(a))},fromWorkingColorSpace:function(a,e){return this.convert(a,this._workingColorSpace,e)},toWorkingColorSpace:function(a,e){return this.convert(a,e,this._workingColorSpace)},getPrimaries:function(a){return ys[a].primaries},getTransfer:function(a){return a===kt?Xi:ys[a].transfer},getLuminanceCoefficients:function(a,e=this._workingColorSpace){return a.fromArray(ys[e].luminanceCoefficients)}};function vt(a){return a<.04045?a*.0773993808:Math.pow(a*.9478672986+.0521327014,2.4)}function tn(a){return a<.0031308?a*12.92:1.055*Math.pow(a,.41666)-.055}let Gt;class PA{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Gt===void 0&&(Gt=en("canvas")),Gt.width=e.width,Gt.height=e.height;const s=Gt.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),t=Gt}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=en("canvas");t.width=e.width,t.height=e.height;const s=t.getContext("2d");s.drawImage(e,0,0,e.width,e.height);const i=s.getImageData(0,0,e.width,e.height),n=i.data;for(let r=0;r<n.length;r++)n[r]=vt(n[r]/255)*255;return s.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let s=0;s<t.length;s++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[s]=Math.floor(vt(t[s]/255)*255):t[s]=vt(t[s]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let HA=0;class Wr{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:HA++}),this.uuid=Ne(),this.data=e,this.dataReady=!0,this.version=0}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 s={uuid:this.uuid,url:""},i=this.data;if(i!==null){let n;if(Array.isArray(i)){n=[];for(let r=0,o=i.length;r<o;r++)i[r].isDataTexture?n.push(sn(i[r].image)):n.push(sn(i[r]))}else n=sn(i);s.url=n}return t||(e.images[this.uuid]=s),s}}function sn(a){return typeof HTMLImageElement<"u"&&a instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&a instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&a instanceof ImageBitmap?PA.getDataURL(a):a.data?{data:Array.from(a.data),width:a.width,height:a.height,type:a.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let qA=0;class le extends Lt{constructor(e=le.DEFAULT_IMAGE,t=le.DEFAULT_MAPPING,s=mt,i=mt,n=Rt,r=ds,o=nt,A=Qe,h=le.DEFAULT_ANISOTROPY,c=kt){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:qA++}),this.uuid=Ne(),this.name="",this.source=new Wr(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=s,this.wrapT=i,this.magFilter=n,this.minFilter=r,this.anisotropy=h,this.format=o,this.internalFormat=null,this.type=A,this.offset=new q(0,0),this.repeat=new q(1,1),this.center=new q(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Fe,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){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)}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.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.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const s={metadata:{version:4.6,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,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&&(s.userData=this.userData),t||(e.textures[this.uuid]=s),s}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Mr)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case us:e.x=e.x-Math.floor(e.x);break;case mt:e.x=e.x<0?0:1;break;case Vi: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 us:e.y=e.y-Math.floor(e.y);break;case mt:e.y=e.y<0?0:1;break;case Vi: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++}}le.DEFAULT_IMAGE=null,le.DEFAULT_MAPPING=Mr,le.DEFAULT_ANISOTROPY=4;class K{constructor(e=0,t=0,s=0,i=1){K.prototype.isVector4=!0,this.x=e,this.y=t,this.z=s,this.w=i}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,s,i){return this.x=e,this.y=t,this.z=s,this.w=i,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,s=this.y,i=this.z,n=this.w,r=e.elements;return this.x=r[0]*t+r[4]*s+r[8]*i+r[12]*n,this.y=r[1]*t+r[5]*s+r[9]*i+r[13]*n,this.z=r[2]*t+r[6]*s+r[10]*i+r[14]*n,this.w=r[3]*t+r[7]*s+r[11]*i+r[15]*n,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,s,i,n;const A=e.elements,h=A[0],c=A[4],l=A[8],u=A[1],d=A[5],g=A[9],p=A[2],f=A[6],m=A[10];if(Math.abs(c-u)<.01&&Math.abs(l-p)<.01&&Math.abs(g-f)<.01){if(Math.abs(c+u)<.1&&Math.abs(l+p)<.1&&Math.abs(g+f)<.1&&Math.abs(h+d+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const C=(h+1)/2,E=(d+1)/2,w=(m+1)/2,S=(c+u)/4,M=(l+p)/4,R=(g+f)/4;return C>E&&C>w?C<.01?(s=0,i=.707106781,n=.707106781):(s=Math.sqrt(C),i=S/s,n=M/s):E>w?E<.01?(s=.707106781,i=0,n=.707106781):(i=Math.sqrt(E),s=S/i,n=R/i):w<.01?(s=.707106781,i=.707106781,n=0):(n=Math.sqrt(w),s=M/n,i=R/n),this.set(s,i,n,t),this}let y=Math.sqrt((f-g)*(f-g)+(l-p)*(l-p)+(u-c)*(u-c));return Math.abs(y)<.001&&(y=1),this.x=(f-g)/y,this.y=(l-p)/y,this.z=(u-c)/y,this.w=Math.acos((h+d+m-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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(e,Math.min(t,s)))}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,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,this.z=e.z+(t.z-e.z)*s,this.w=e.w+(t.w-e.w)*s,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}}class Kr extends Lt{constructor(e=1,t=1,s={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new K(0,0,e,t),this.scissorTest=!1,this.viewport=new K(0,0,e,t);const i={width:e,height:t,depth:1};s=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Rt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},s);const n=new le(i,s.mapping,s.wrapS,s.wrapT,s.magFilter,s.minFilter,s.format,s.type,s.anisotropy,s.colorSpace);n.flipY=!1,n.generateMipmaps=s.generateMipmaps,n.internalFormat=s.internalFormat,this.textures=[];const r=s.count;for(let o=0;o<r;o++)this.textures[o]=n.clone(),this.textures[o].isRenderTargetTexture=!0;this.depthBuffer=s.depthBuffer,this.stencilBuffer=s.stencilBuffer,this.resolveDepthBuffer=s.resolveDepthBuffer,this.resolveStencilBuffer=s.resolveStencilBuffer,this.depthTexture=s.depthTexture,this.samples=s.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,s=1){if(this.width!==e||this.height!==t||this.depth!==s){this.width=e,this.height=t,this.depth=s;for(let i=0,n=this.textures.length;i<n;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=s;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 s=0,i=e.textures.length;s<i;s++)this.textures[s]=e.textures[s].clone(),this.textures[s].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Wr(t),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}dispose(){this.dispatchEvent({type:"dispose"})}}class VA extends le{constructor(e=null,t=1,s=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:s,depth:i},this.magFilter=je,this.minFilter=je,this.wrapR=mt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class ot{constructor(e=0,t=0,s=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=s,this._w=i}static slerpFlat(e,t,s,i,n,r,o){let A=s[i+0],h=s[i+1],c=s[i+2],l=s[i+3];const u=n[r+0],d=n[r+1],g=n[r+2],p=n[r+3];if(o===0){e[t+0]=A,e[t+1]=h,e[t+2]=c,e[t+3]=l;return}if(o===1){e[t+0]=u,e[t+1]=d,e[t+2]=g,e[t+3]=p;return}if(l!==p||A!==u||h!==d||c!==g){let f=1-o;const m=A*u+h*d+c*g+l*p,y=m>=0?1:-1,C=1-m*m;if(C>Number.EPSILON){const w=Math.sqrt(C),S=Math.atan2(w,m*y);f=Math.sin(f*S)/w,o=Math.sin(o*S)/w}const E=o*y;if(A=A*f+u*E,h=h*f+d*E,c=c*f+g*E,l=l*f+p*E,f===1-o){const w=1/Math.sqrt(A*A+h*h+c*c+l*l);A*=w,h*=w,c*=w,l*=w}}e[t]=A,e[t+1]=h,e[t+2]=c,e[t+3]=l}static multiplyQuaternionsFlat(e,t,s,i,n,r){const o=s[i],A=s[i+1],h=s[i+2],c=s[i+3],l=n[r],u=n[r+1],d=n[r+2],g=n[r+3];return e[t]=o*g+c*l+A*d-h*u,e[t+1]=A*g+c*u+h*l-o*d,e[t+2]=h*g+c*d+o*u-A*l,e[t+3]=c*g-o*l-A*u-h*d,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,s,i){return this._x=e,this._y=t,this._z=s,this._w=i,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 s=e._x,i=e._y,n=e._z,r=e._order,o=Math.cos,A=Math.sin,h=o(s/2),c=o(i/2),l=o(n/2),u=A(s/2),d=A(i/2),g=A(n/2);switch(r){case"XYZ":this._x=u*c*l+h*d*g,this._y=h*d*l-u*c*g,this._z=h*c*g+u*d*l,this._w=h*c*l-u*d*g;break;case"YXZ":this._x=u*c*l+h*d*g,this._y=h*d*l-u*c*g,this._z=h*c*g-u*d*l,this._w=h*c*l+u*d*g;break;case"ZXY":this._x=u*c*l-h*d*g,this._y=h*d*l+u*c*g,this._z=h*c*g+u*d*l,this._w=h*c*l-u*d*g;break;case"ZYX":this._x=u*c*l-h*d*g,this._y=h*d*l+u*c*g,this._z=h*c*g-u*d*l,this._w=h*c*l+u*d*g;break;case"YZX":this._x=u*c*l+h*d*g,this._y=h*d*l+u*c*g,this._z=h*c*g-u*d*l,this._w=h*c*l-u*d*g;break;case"XZY":this._x=u*c*l-h*d*g,this._y=h*d*l-u*c*g,this._z=h*c*g+u*d*l,this._w=h*c*l+u*d*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+r)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const s=t/2,i=Math.sin(s);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,s=t[0],i=t[4],n=t[8],r=t[1],o=t[5],A=t[9],h=t[2],c=t[6],l=t[10],u=s+o+l;if(u>0){const d=.5/Math.sqrt(u+1);this._w=.25/d,this._x=(c-A)*d,this._y=(n-h)*d,this._z=(r-i)*d}else if(s>o&&s>l){const d=2*Math.sqrt(1+s-o-l);this._w=(c-A)/d,this._x=.25*d,this._y=(i+r)/d,this._z=(n+h)/d}else if(o>l){const d=2*Math.sqrt(1+o-s-l);this._w=(n-h)/d,this._x=(i+r)/d,this._y=.25*d,this._z=(A+c)/d}else{const d=2*Math.sqrt(1+l-s-o);this._w=(r-i)/d,this._x=(n+h)/d,this._y=(A+c)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let s=e.dot(t)+1;return s<Number.EPSILON?(s=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=s):(this._x=0,this._y=-e.z,this._z=e.y,this._w=s)):(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=s),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(he(this.dot(e),-1,1)))}rotateTowards(e,t){const s=this.angleTo(e);if(s===0)return this;const i=Math.min(1,t/s);return this.slerp(e,i),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 s=e._x,i=e._y,n=e._z,r=e._w,o=t._x,A=t._y,h=t._z,c=t._w;return this._x=s*c+r*o+i*h-n*A,this._y=i*c+r*A+n*o-s*h,this._z=n*c+r*h+s*A-i*o,this._w=r*c-s*o-i*A-n*h,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const s=this._x,i=this._y,n=this._z,r=this._w;let o=r*e._w+s*e._x+i*e._y+n*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=r,this._x=s,this._y=i,this._z=n,this;const A=1-o*o;if(A<=Number.EPSILON){const d=1-t;return this._w=d*r+t*this._w,this._x=d*s+t*this._x,this._y=d*i+t*this._y,this._z=d*n+t*this._z,this.normalize(),this}const h=Math.sqrt(A),c=Math.atan2(h,o),l=Math.sin((1-t)*c)/h,u=Math.sin(t*c)/h;return this._w=r*l+this._w*u,this._x=s*l+this._x*u,this._y=i*l+this._y*u,this._z=n*l+this._z*u,this._onChangeCallback(),this}slerpQuaternions(e,t,s){return this.copy(e).slerp(t,s)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),s=Math.random(),i=Math.sqrt(1-s),n=Math.sqrt(s);return this.set(i*Math.sin(e),i*Math.cos(e),n*Math.sin(t),n*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}}class b{constructor(e=0,t=0,s=0){b.prototype.isVector3=!0,this.x=e,this.y=t,this.z=s}set(e,t,s){return s===void 0&&(s=this.z),this.x=e,this.y=t,this.z=s,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(Yr.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Yr.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,s=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[3]*s+n[6]*i,this.y=n[1]*t+n[4]*s+n[7]*i,this.z=n[2]*t+n[5]*s+n[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,s=this.y,i=this.z,n=e.elements,r=1/(n[3]*t+n[7]*s+n[11]*i+n[15]);return this.x=(n[0]*t+n[4]*s+n[8]*i+n[12])*r,this.y=(n[1]*t+n[5]*s+n[9]*i+n[13])*r,this.z=(n[2]*t+n[6]*s+n[10]*i+n[14])*r,this}applyQuaternion(e){const t=this.x,s=this.y,i=this.z,n=e.x,r=e.y,o=e.z,A=e.w,h=2*(r*i-o*s),c=2*(o*t-n*i),l=2*(n*s-r*t);return this.x=t+A*h+r*l-o*c,this.y=s+A*c+o*h-n*l,this.z=i+A*l+n*c-r*h,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,s=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[4]*s+n[8]*i,this.y=n[1]*t+n[5]*s+n[9]*i,this.z=n[2]*t+n[6]*s+n[10]*i,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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(e,Math.min(t,s)))}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,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,this.z=e.z+(t.z-e.z)*s,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const s=e.x,i=e.y,n=e.z,r=t.x,o=t.y,A=t.z;return this.x=i*A-n*o,this.y=n*r-s*A,this.z=s*o-i*r,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const s=e.dot(this)/t;return this.copy(e).multiplyScalar(s)}projectOnPlane(e){return nn.copy(this).projectOnVector(e),this.sub(nn)}reflect(e){return this.sub(nn.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 s=this.dot(e)/t;return Math.acos(he(s,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,s=this.y-e.y,i=this.z-e.z;return t*t+s*s+i*i}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,s){const i=Math.sin(t)*e;return this.x=i*Math.sin(s),this.y=Math.cos(t)*e,this.z=i*Math.cos(s),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,s){return this.x=e*Math.sin(t),this.y=s,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(),s=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=s,this.z=i,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,s=Math.sqrt(1-t*t);return this.x=s*Math.cos(e),this.y=t,this.z=s*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const nn=new b,Yr=new ot;class Je{constructor(e=new b(1/0,1/0,1/0),t=new b(-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,s=e.length;t<s;t+=3)this.expandByPoint(De.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,s=e.count;t<s;t++)this.expandByPoint(De.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,s=e.length;t<s;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const s=De.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(s),this.max.copy(e).add(s),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 s=e.geometry;if(s!==void 0){const n=s.getAttribute("position");if(t===!0&&n!==void 0&&e.isInstancedMesh!==!0)for(let r=0,o=n.count;r<o;r++)e.isMesh===!0?e.getVertexPosition(r,De):De.fromBufferAttribute(n,r),De.applyMatrix4(e.matrixWorld),this.expandByPoint(De);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Ys.copy(e.boundingBox)):(s.boundingBox===null&&s.computeBoundingBox(),Ys.copy(s.boundingBox)),Ys.applyMatrix4(e.matrixWorld),this.union(Ys)}const i=e.children;for(let n=0,r=i.length;n<r;n++)this.expandByObject(i[n],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,De),De.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,s;return e.normal.x>0?(t=e.normal.x*this.min.x,s=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,s=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,s+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,s+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,s+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,s+=e.normal.z*this.min.z),t<=-e.constant&&s>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Es),Xs.subVectors(this.max,Es),Ot.subVectors(e.a,Es),Ut.subVectors(e.b,Es),zt.subVectors(e.c,Es),at.subVectors(Ut,Ot),At.subVectors(zt,Ut),bt.subVectors(Ot,zt);let t=[0,-at.z,at.y,0,-At.z,At.y,0,-bt.z,bt.y,at.z,0,-at.x,At.z,0,-At.x,bt.z,0,-bt.x,-at.y,at.x,0,-At.y,At.x,0,-bt.y,bt.x,0];return!rn(t,Ot,Ut,zt,Xs)||(t=[1,0,0,0,1,0,0,0,1],!rn(t,Ot,Ut,zt,Xs))?!1:(Zs.crossVectors(at,At),t=[Zs.x,Zs.y,Zs.z],rn(t,Ot,Ut,zt,Xs))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,De).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(De).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:(We[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),We[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),We[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),We[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),We[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),We[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),We[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),We[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(We),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)}}const We=[new b,new b,new b,new b,new b,new b,new b,new b],De=new b,Ys=new Je,Ot=new b,Ut=new b,zt=new b,at=new b,At=new b,bt=new b,Es=new b,Xs=new b,Zs=new b,yt=new b;function rn(a,e,t,s,i){for(let n=0,r=a.length-3;n<=r;n+=3){yt.fromArray(a,n);const o=i.x*Math.abs(yt.x)+i.y*Math.abs(yt.y)+i.z*Math.abs(yt.z),A=e.dot(yt),h=t.dot(yt),c=s.dot(yt);if(Math.max(-Math.max(A,h,c),Math.min(A,h,c))>o)return!1}return!0}const jA=new Je,Cs=new b,on=new b;class Oe{constructor(e=new b,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 s=this.center;t!==void 0?s.copy(t):jA.setFromPoints(e).getCenter(s);let i=0;for(let n=0,r=e.length;n<r;n++)i=Math.max(i,s.distanceToSquared(e[n]));return this.radius=Math.sqrt(i),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 s=this.center.distanceToSquared(e);return t.copy(e),s>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;Cs.subVectors(e,this.center);const t=Cs.lengthSq();if(t>this.radius*this.radius){const s=Math.sqrt(t),i=(s-this.radius)*.5;this.center.addScaledVector(Cs,i/s),this.radius+=i}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):(on.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Cs.copy(e.center).add(on)),this.expandByPoint(Cs.copy(e.center).sub(on))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ke=new b,an=new b,$s=new b,ht=new b,An=new b,ei=new b,hn=new b;class ti{constructor(e=new b,t=new b(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,Ke)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const s=t.dot(this.direction);return s<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,s)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Ke.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ke.copy(this.origin).addScaledVector(this.direction,t),Ke.distanceToSquared(e))}distanceSqToSegment(e,t,s,i){an.copy(e).add(t).multiplyScalar(.5),$s.copy(t).sub(e).normalize(),ht.copy(this.origin).sub(an);const n=e.distanceTo(t)*.5,r=-this.direction.dot($s),o=ht.dot(this.direction),A=-ht.dot($s),h=ht.lengthSq(),c=Math.abs(1-r*r);let l,u,d,g;if(c>0)if(l=r*A-o,u=r*o-A,g=n*c,l>=0)if(u>=-g)if(u<=g){const p=1/c;l*=p,u*=p,d=l*(l+r*u+2*o)+u*(r*l+u+2*A)+h}else u=n,l=Math.max(0,-(r*u+o)),d=-l*l+u*(u+2*A)+h;else u=-n,l=Math.max(0,-(r*u+o)),d=-l*l+u*(u+2*A)+h;else u<=-g?(l=Math.max(0,-(-r*n+o)),u=l>0?-n:Math.min(Math.max(-n,-A),n),d=-l*l+u*(u+2*A)+h):u<=g?(l=0,u=Math.min(Math.max(-n,-A),n),d=u*(u+2*A)+h):(l=Math.max(0,-(r*n+o)),u=l>0?n:Math.min(Math.max(-n,-A),n),d=-l*l+u*(u+2*A)+h);else u=r>0?-n:n,l=Math.max(0,-(r*u+o)),d=-l*l+u*(u+2*A)+h;return s&&s.copy(this.origin).addScaledVector(this.direction,l),i&&i.copy(an).addScaledVector($s,u),d}intersectSphere(e,t){Ke.subVectors(e.center,this.origin);const s=Ke.dot(this.direction),i=Ke.dot(Ke)-s*s,n=e.radius*e.radius;if(i>n)return null;const r=Math.sqrt(n-i),o=s-r,A=s+r;return A<0?null:o<0?this.at(A,t):this.at(o,t)}intersectsSphere(e){return 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 s=-(this.origin.dot(e.normal)+e.constant)/t;return s>=0?s:null}intersectPlane(e,t){const s=this.distanceToPlane(e);return s===null?null:this.at(s,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let s,i,n,r,o,A;const h=1/this.direction.x,c=1/this.direction.y,l=1/this.direction.z,u=this.origin;return h>=0?(s=(e.min.x-u.x)*h,i=(e.max.x-u.x)*h):(s=(e.max.x-u.x)*h,i=(e.min.x-u.x)*h),c>=0?(n=(e.min.y-u.y)*c,r=(e.max.y-u.y)*c):(n=(e.max.y-u.y)*c,r=(e.min.y-u.y)*c),s>r||n>i||((n>s||isNaN(s))&&(s=n),(r<i||isNaN(i))&&(i=r),l>=0?(o=(e.min.z-u.z)*l,A=(e.max.z-u.z)*l):(o=(e.max.z-u.z)*l,A=(e.min.z-u.z)*l),s>A||o>i)||((o>s||s!==s)&&(s=o),(A<i||i!==i)&&(i=A),i<0)?null:this.at(s>=0?s:i,t)}intersectsBox(e){return this.intersectBox(e,Ke)!==null}intersectTriangle(e,t,s,i,n){An.subVectors(t,e),ei.subVectors(s,e),hn.crossVectors(An,ei);let r=this.direction.dot(hn),o;if(r>0){if(i)return null;o=1}else if(r<0)o=-1,r=-r;else return null;ht.subVectors(this.origin,e);const A=o*this.direction.dot(ei.crossVectors(ht,ei));if(A<0)return null;const h=o*this.direction.dot(An.cross(ht));if(h<0||A+h>r)return null;const c=-o*ht.dot(hn);return c<0?null:this.at(c/r,n)}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 _{constructor(e,t,s,i,n,r,o,A,h,c,l,u,d,g,p,f){_.prototype.isMatrix4=!0,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,s,i,n,r,o,A,h,c,l,u,d,g,p,f)}set(e,t,s,i,n,r,o,A,h,c,l,u,d,g,p,f){const m=this.elements;return m[0]=e,m[4]=t,m[8]=s,m[12]=i,m[1]=n,m[5]=r,m[9]=o,m[13]=A,m[2]=h,m[6]=c,m[10]=l,m[14]=u,m[3]=d,m[7]=g,m[11]=p,m[15]=f,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 _().fromArray(this.elements)}copy(e){const t=this.elements,s=e.elements;return t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t[4]=s[4],t[5]=s[5],t[6]=s[6],t[7]=s[7],t[8]=s[8],t[9]=s[9],t[10]=s[10],t[11]=s[11],t[12]=s[12],t[13]=s[13],t[14]=s[14],t[15]=s[15],this}copyPosition(e){const t=this.elements,s=e.elements;return t[12]=s[12],t[13]=s[13],t[14]=s[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,s){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this}makeBasis(e,t,s){return this.set(e.x,t.x,s.x,0,e.y,t.y,s.y,0,e.z,t.z,s.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,s=e.elements,i=1/Pt.setFromMatrixColumn(e,0).length(),n=1/Pt.setFromMatrixColumn(e,1).length(),r=1/Pt.setFromMatrixColumn(e,2).length();return t[0]=s[0]*i,t[1]=s[1]*i,t[2]=s[2]*i,t[3]=0,t[4]=s[4]*n,t[5]=s[5]*n,t[6]=s[6]*n,t[7]=0,t[8]=s[8]*r,t[9]=s[9]*r,t[10]=s[10]*r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,s=e.x,i=e.y,n=e.z,r=Math.cos(s),o=Math.sin(s),A=Math.cos(i),h=Math.sin(i),c=Math.cos(n),l=Math.sin(n);if(e.order==="XYZ"){const u=r*c,d=r*l,g=o*c,p=o*l;t[0]=A*c,t[4]=-A*l,t[8]=h,t[1]=d+g*h,t[5]=u-p*h,t[9]=-o*A,t[2]=p-u*h,t[6]=g+d*h,t[10]=r*A}else if(e.order==="YXZ"){const u=A*c,d=A*l,g=h*c,p=h*l;t[0]=u+p*o,t[4]=g*o-d,t[8]=r*h,t[1]=r*l,t[5]=r*c,t[9]=-o,t[2]=d*o-g,t[6]=p+u*o,t[10]=r*A}else if(e.order==="ZXY"){const u=A*c,d=A*l,g=h*c,p=h*l;t[0]=u-p*o,t[4]=-r*l,t[8]=g+d*o,t[1]=d+g*o,t[5]=r*c,t[9]=p-u*o,t[2]=-r*h,t[6]=o,t[10]=r*A}else if(e.order==="ZYX"){const u=r*c,d=r*l,g=o*c,p=o*l;t[0]=A*c,t[4]=g*h-d,t[8]=u*h+p,t[1]=A*l,t[5]=p*h+u,t[9]=d*h-g,t[2]=-h,t[6]=o*A,t[10]=r*A}else if(e.order==="YZX"){const u=r*A,d=r*h,g=o*A,p=o*h;t[0]=A*c,t[4]=p-u*l,t[8]=g*l+d,t[1]=l,t[5]=r*c,t[9]=-o*c,t[2]=-h*c,t[6]=d*l+g,t[10]=u-p*l}else if(e.order==="XZY"){const u=r*A,d=r*h,g=o*A,p=o*h;t[0]=A*c,t[4]=-l,t[8]=h*c,t[1]=u*l+p,t[5]=r*c,t[9]=d*l-g,t[2]=g*l-d,t[6]=o*c,t[10]=p*l+u}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(JA,e,WA)}lookAt(e,t,s){const i=this.elements;return be.subVectors(e,t),be.lengthSq()===0&&(be.z=1),be.normalize(),ct.crossVectors(s,be),ct.lengthSq()===0&&(Math.abs(s.z)===1?be.x+=1e-4:be.z+=1e-4,be.normalize(),ct.crossVectors(s,be)),ct.normalize(),si.crossVectors(be,ct),i[0]=ct.x,i[4]=si.x,i[8]=be.x,i[1]=ct.y,i[5]=si.y,i[9]=be.y,i[2]=ct.z,i[6]=si.z,i[10]=be.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const s=e.elements,i=t.elements,n=this.elements,r=s[0],o=s[4],A=s[8],h=s[12],c=s[1],l=s[5],u=s[9],d=s[13],g=s[2],p=s[6],f=s[10],m=s[14],y=s[3],C=s[7],E=s[11],w=s[15],S=i[0],M=i[4],R=i[8],D=i[12],O=i[1],H=i[5],ae=i[9],J=i[13],Be=i[2],xe=i[6],it=i[10],W=i[14],oe=i[3],Me=i[7],Ie=i[11],Ge=i[15];return n[0]=r*S+o*O+A*Be+h*oe,n[4]=r*M+o*H+A*xe+h*Me,n[8]=r*R+o*ae+A*it+h*Ie,n[12]=r*D+o*J+A*W+h*Ge,n[1]=c*S+l*O+u*Be+d*oe,n[5]=c*M+l*H+u*xe+d*Me,n[9]=c*R+l*ae+u*it+d*Ie,n[13]=c*D+l*J+u*W+d*Ge,n[2]=g*S+p*O+f*Be+m*oe,n[6]=g*M+p*H+f*xe+m*Me,n[10]=g*R+p*ae+f*it+m*Ie,n[14]=g*D+p*J+f*W+m*Ge,n[3]=y*S+C*O+E*Be+w*oe,n[7]=y*M+C*H+E*xe+w*Me,n[11]=y*R+C*ae+E*it+w*Ie,n[15]=y*D+C*J+E*W+w*Ge,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],s=e[4],i=e[8],n=e[12],r=e[1],o=e[5],A=e[9],h=e[13],c=e[2],l=e[6],u=e[10],d=e[14],g=e[3],p=e[7],f=e[11],m=e[15];return g*(+n*A*l-i*h*l-n*o*u+s*h*u+i*o*d-s*A*d)+p*(+t*A*d-t*h*u+n*r*u-i*r*d+i*h*c-n*A*c)+f*(+t*h*l-t*o*d-n*r*l+s*r*d+n*o*c-s*h*c)+m*(-i*o*c-t*A*l+t*o*u+i*r*l-s*r*u+s*A*c)}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,s){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=s),this}invert(){const e=this.elements,t=e[0],s=e[1],i=e[2],n=e[3],r=e[4],o=e[5],A=e[6],h=e[7],c=e[8],l=e[9],u=e[10],d=e[11],g=e[12],p=e[13],f=e[14],m=e[15],y=l*f*h-p*u*h+p*A*d-o*f*d-l*A*m+o*u*m,C=g*u*h-c*f*h-g*A*d+r*f*d+c*A*m-r*u*m,E=c*p*h-g*l*h+g*o*d-r*p*d-c*o*m+r*l*m,w=g*l*A-c*p*A-g*o*u+r*p*u+c*o*f-r*l*f,S=t*y+s*C+i*E+n*w;if(S===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const M=1/S;return e[0]=y*M,e[1]=(p*u*n-l*f*n-p*i*d+s*f*d+l*i*m-s*u*m)*M,e[2]=(o*f*n-p*A*n+p*i*h-s*f*h-o*i*m+s*A*m)*M,e[3]=(l*A*n-o*u*n-l*i*h+s*u*h+o*i*d-s*A*d)*M,e[4]=C*M,e[5]=(c*f*n-g*u*n+g*i*d-t*f*d-c*i*m+t*u*m)*M,e[6]=(g*A*n-r*f*n-g*i*h+t*f*h+r*i*m-t*A*m)*M,e[7]=(r*u*n-c*A*n+c*i*h-t*u*h-r*i*d+t*A*d)*M,e[8]=E*M,e[9]=(g*l*n-c*p*n-g*s*d+t*p*d+c*s*m-t*l*m)*M,e[10]=(r*p*n-g*o*n+g*s*h-t*p*h-r*s*m+t*o*m)*M,e[11]=(c*o*n-r*l*n-c*s*h+t*l*h+r*s*d-t*o*d)*M,e[12]=w*M,e[13]=(c*p*i-g*l*i+g*s*u-t*p*u-c*s*f+t*l*f)*M,e[14]=(g*o*i-r*p*i-g*s*A+t*p*A+r*s*f-t*o*f)*M,e[15]=(r*l*i-c*o*i+c*s*A-t*l*A-r*s*u+t*o*u)*M,this}scale(e){const t=this.elements,s=e.x,i=e.y,n=e.z;return t[0]*=s,t[4]*=i,t[8]*=n,t[1]*=s,t[5]*=i,t[9]*=n,t[2]*=s,t[6]*=i,t[10]*=n,t[3]*=s,t[7]*=i,t[11]*=n,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],s=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,s,i))}makeTranslation(e,t,s){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,s,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),s=Math.sin(e);return this.set(1,0,0,0,0,t,-s,0,0,s,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,0,s,0,0,1,0,0,-s,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,-s,0,0,s,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const s=Math.cos(t),i=Math.sin(t),n=1-s,r=e.x,o=e.y,A=e.z,h=n*r,c=n*o;return this.set(h*r+s,h*o-i*A,h*A+i*o,0,h*o+i*A,c*o+s,c*A-i*r,0,h*A-i*o,c*A+i*r,n*A*A+s,0,0,0,0,1),this}makeScale(e,t,s){return this.set(e,0,0,0,0,t,0,0,0,0,s,0,0,0,0,1),this}makeShear(e,t,s,i,n,r){return this.set(1,s,n,0,e,1,r,0,t,i,1,0,0,0,0,1),this}compose(e,t,s){const i=this.elements,n=t._x,r=t._y,o=t._z,A=t._w,h=n+n,c=r+r,l=o+o,u=n*h,d=n*c,g=n*l,p=r*c,f=r*l,m=o*l,y=A*h,C=A*c,E=A*l,w=s.x,S=s.y,M=s.z;return i[0]=(1-(p+m))*w,i[1]=(d+E)*w,i[2]=(g-C)*w,i[3]=0,i[4]=(d-E)*S,i[5]=(1-(u+m))*S,i[6]=(f+y)*S,i[7]=0,i[8]=(g+C)*M,i[9]=(f-y)*M,i[10]=(1-(u+p))*M,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,s){const i=this.elements;let n=Pt.set(i[0],i[1],i[2]).length();const r=Pt.set(i[4],i[5],i[6]).length(),o=Pt.set(i[8],i[9],i[10]).length();this.determinant()<0&&(n=-n),e.x=i[12],e.y=i[13],e.z=i[14],ke.copy(this);const h=1/n,c=1/r,l=1/o;return ke.elements[0]*=h,ke.elements[1]*=h,ke.elements[2]*=h,ke.elements[4]*=c,ke.elements[5]*=c,ke.elements[6]*=c,ke.elements[8]*=l,ke.elements[9]*=l,ke.elements[10]*=l,t.setFromRotationMatrix(ke),s.x=n,s.y=r,s.z=o,this}makePerspective(e,t,s,i,n,r,o=rt){const A=this.elements,h=2*n/(t-e),c=2*n/(s-i),l=(t+e)/(t-e),u=(s+i)/(s-i);let d,g;if(o===rt)d=-(r+n)/(r-n),g=-2*r*n/(r-n);else if(o===Ks)d=-r/(r-n),g=-r*n/(r-n);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return A[0]=h,A[4]=0,A[8]=l,A[12]=0,A[1]=0,A[5]=c,A[9]=u,A[13]=0,A[2]=0,A[6]=0,A[10]=d,A[14]=g,A[3]=0,A[7]=0,A[11]=-1,A[15]=0,this}makeOrthographic(e,t,s,i,n,r,o=rt){const A=this.elements,h=1/(t-e),c=1/(s-i),l=1/(r-n),u=(t+e)*h,d=(s+i)*c;let g,p;if(o===rt)g=(r+n)*l,p=-2*l;else if(o===Ks)g=n*l,p=-1*l;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return A[0]=2*h,A[4]=0,A[8]=0,A[12]=-u,A[1]=0,A[5]=2*c,A[9]=0,A[13]=-d,A[2]=0,A[6]=0,A[10]=p,A[14]=-g,A[3]=0,A[7]=0,A[11]=0,A[15]=1,this}equals(e){const t=this.elements,s=e.elements;for(let i=0;i<16;i++)if(t[i]!==s[i])return!1;return!0}fromArray(e,t=0){for(let s=0;s<16;s++)this.elements[s]=e[s+t];return this}toArray(e=[],t=0){const s=this.elements;return e[t]=s[0],e[t+1]=s[1],e[t+2]=s[2],e[t+3]=s[3],e[t+4]=s[4],e[t+5]=s[5],e[t+6]=s[6],e[t+7]=s[7],e[t+8]=s[8],e[t+9]=s[9],e[t+10]=s[10],e[t+11]=s[11],e[t+12]=s[12],e[t+13]=s[13],e[t+14]=s[14],e[t+15]=s[15],e}}const Pt=new b,ke=new _,JA=new b(0,0,0),WA=new b(1,1,1),ct=new b,si=new b,be=new b,Xr=new _,Zr=new ot;class Ht{constructor(e=0,t=0,s=0,i=Ht.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=s,this._order=i}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,s,i=this._order){return this._x=e,this._y=t,this._z=s,this._order=i,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,s=!0){const i=e.elements,n=i[0],r=i[4],o=i[8],A=i[1],h=i[5],c=i[9],l=i[2],u=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(he(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-r,n)):(this._x=Math.atan2(u,h),this._z=0);break;case"YXZ":this._x=Math.asin(-he(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(A,h)):(this._y=Math.atan2(-l,n),this._z=0);break;case"ZXY":this._x=Math.asin(he(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-l,d),this._z=Math.atan2(-r,h)):(this._y=0,this._z=Math.atan2(A,n));break;case"ZYX":this._y=Math.asin(-he(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(A,n)):(this._x=0,this._z=Math.atan2(-r,h));break;case"YZX":this._z=Math.asin(he(A,-1,1)),Math.abs(A)<.9999999?(this._x=Math.atan2(-c,h),this._y=Math.atan2(-l,n)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-he(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(u,h),this._y=Math.atan2(o,n)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,s===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,s){return Xr.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Xr,t,s)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Zr.setFromEuler(this),this.setFromQuaternion(Zr,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}}Ht.DEFAULT_ORDER="XYZ";class KA{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 YA=0;const $r=new b,qt=new ot,Ye=new _,ii=new b,Bs=new b,XA=new b,ZA=new ot,eo=new b(1,0,0),to=new b(0,1,0),so=new b(0,0,1),io={type:"added"},$A={type:"removed"},Vt={type:"childadded",child:null},cn={type:"childremoved",child:null};class Y extends Lt{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:YA++}),this.uuid=Ne(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Y.DEFAULT_UP.clone();const e=new b,t=new Ht,s=new ot,i=new b(1,1,1);function n(){s.setFromEuler(t,!1)}function r(){t.setFromQuaternion(s,void 0,!1)}t._onChange(n),s._onChange(r),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:s},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new _},normalMatrix:{value:new Fe}}),this.matrix=new _,this.matrixWorld=new _,this.matrixAutoUpdate=Y.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Y.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new KA,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}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 qt.setFromAxisAngle(e,t),this.quaternion.multiply(qt),this}rotateOnWorldAxis(e,t){return qt.setFromAxisAngle(e,t),this.quaternion.premultiply(qt),this}rotateX(e){return this.rotateOnAxis(eo,e)}rotateY(e){return this.rotateOnAxis(to,e)}rotateZ(e){return this.rotateOnAxis(so,e)}translateOnAxis(e,t){return $r.copy(e).applyQuaternion(this.quaternion),this.position.add($r.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(eo,e)}translateY(e){return this.translateOnAxis(to,e)}translateZ(e){return this.translateOnAxis(so,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ye.copy(this.matrixWorld).invert())}lookAt(e,t,s){e.isVector3?ii.copy(e):ii.set(e,t,s);const i=this.parent;this.updateWorldMatrix(!0,!1),Bs.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ye.lookAt(Bs,ii,this.up):Ye.lookAt(ii,Bs,this.up),this.quaternion.setFromRotationMatrix(Ye),i&&(Ye.extractRotation(i.matrixWorld),qt.setFromRotationMatrix(Ye),this.quaternion.premultiply(qt.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.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(io),Vt.child=e,this.dispatchEvent(Vt),Vt.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let s=0;s<arguments.length;s++)this.remove(arguments[s]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent($A),cn.child=e,this.dispatchEvent(cn),cn.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),Ye.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Ye.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ye),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(io),Vt.child=e,this.dispatchEvent(Vt),Vt.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 s=0,i=this.children.length;s<i;s++){const r=this.children[s].getObjectByProperty(e,t);if(r!==void 0)return r}}getObjectsByProperty(e,t,s=[]){this[e]===t&&s.push(this);const i=this.children;for(let n=0,r=i.length;n<r;n++)i[n].getObjectsByProperty(e,t,s);return s}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Bs,e,XA),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Bs,ZA,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 s=0,i=t.length;s<i;s++)t[s].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let s=0,i=t.length;s<i;s++)t[s].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),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 s=0,i=t.length;s<i;s++)t[s].updateMatrixWorld(e)}updateWorldMatrix(e,t){const s=this.parent;if(e===!0&&s!==null&&s.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 i=this.children;for(let n=0,r=i.length;n<r;n++)i[n].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",s={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},s.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function n(o,A){return o[A.uuid]===void 0&&(o[A.uuid]=A.toJSON(e)),A.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=n(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const A=o.shapes;if(Array.isArray(A))for(let h=0,c=A.length;h<c;h++){const l=A[h];n(e.shapes,l)}else n(e.shapes,A)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(n(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let A=0,h=this.material.length;A<h;A++)o.push(n(e.materials,this.material[A]));i.material=o}else i.material=n(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const A=this.animations[o];i.animations.push(n(e.animations,A))}}if(t){const o=r(e.geometries),A=r(e.materials),h=r(e.textures),c=r(e.images),l=r(e.shapes),u=r(e.skeletons),d=r(e.animations),g=r(e.nodes);o.length>0&&(s.geometries=o),A.length>0&&(s.materials=A),h.length>0&&(s.textures=h),c.length>0&&(s.images=c),l.length>0&&(s.shapes=l),u.length>0&&(s.skeletons=u),d.length>0&&(s.animations=d),g.length>0&&(s.nodes=g)}return s.object=i,s;function r(o){const A=[];for(const h in o){const c=o[h];delete c.metadata,A.push(c)}return A}}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.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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let s=0;s<e.children.length;s++){const i=e.children[s];this.add(i.clone())}return this}}Y.DEFAULT_UP=new b(0,1,0),Y.DEFAULT_MATRIX_AUTO_UPDATE=!0,Y.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const _e=new b,Xe=new b,ln=new b,Ze=new b,jt=new b,Jt=new b,no=new b,un=new b,dn=new b,gn=new b,pn=new K,fn=new K,mn=new K;class Le{constructor(e=new b,t=new b,s=new b){this.a=e,this.b=t,this.c=s}static getNormal(e,t,s,i){i.subVectors(s,t),_e.subVectors(e,t),i.cross(_e);const n=i.lengthSq();return n>0?i.multiplyScalar(1/Math.sqrt(n)):i.set(0,0,0)}static getBarycoord(e,t,s,i,n){_e.subVectors(i,t),Xe.subVectors(s,t),ln.subVectors(e,t);const r=_e.dot(_e),o=_e.dot(Xe),A=_e.dot(ln),h=Xe.dot(Xe),c=Xe.dot(ln),l=r*h-o*o;if(l===0)return n.set(0,0,0),null;const u=1/l,d=(h*A-o*c)*u,g=(r*c-o*A)*u;return n.set(1-d-g,g,d)}static containsPoint(e,t,s,i){return this.getBarycoord(e,t,s,i,Ze)===null?!1:Ze.x>=0&&Ze.y>=0&&Ze.x+Ze.y<=1}static getInterpolation(e,t,s,i,n,r,o,A){return this.getBarycoord(e,t,s,i,Ze)===null?(A.x=0,A.y=0,"z"in A&&(A.z=0),"w"in A&&(A.w=0),null):(A.setScalar(0),A.addScaledVector(n,Ze.x),A.addScaledVector(r,Ze.y),A.addScaledVector(o,Ze.z),A)}static getInterpolatedAttribute(e,t,s,i,n,r){return pn.setScalar(0),fn.setScalar(0),mn.setScalar(0),pn.fromBufferAttribute(e,t),fn.fromBufferAttribute(e,s),mn.fromBufferAttribute(e,i),r.setScalar(0),r.addScaledVector(pn,n.x),r.addScaledVector(fn,n.y),r.addScaledVector(mn,n.z),r}static isFrontFacing(e,t,s,i){return _e.subVectors(s,t),Xe.subVectors(e,t),_e.cross(Xe).dot(i)<0}set(e,t,s){return this.a.copy(e),this.b.copy(t),this.c.copy(s),this}setFromPointsAndIndices(e,t,s,i){return this.a.copy(e[t]),this.b.copy(e[s]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,s,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,s),this.c.fromBufferAttribute(e,i),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 _e.subVectors(this.c,this.b),Xe.subVectors(this.a,this.b),_e.cross(Xe).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Le.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Le.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,s,i,n){return Le.getInterpolation(e,this.a,this.b,this.c,t,s,i,n)}containsPoint(e){return Le.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Le.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const s=this.a,i=this.b,n=this.c;let r,o;jt.subVectors(i,s),Jt.subVectors(n,s),un.subVectors(e,s);const A=jt.dot(un),h=Jt.dot(un);if(A<=0&&h<=0)return t.copy(s);dn.subVectors(e,i);const c=jt.dot(dn),l=Jt.dot(dn);if(c>=0&&l<=c)return t.copy(i);const u=A*l-c*h;if(u<=0&&A>=0&&c<=0)return r=A/(A-c),t.copy(s).addScaledVector(jt,r);gn.subVectors(e,n);const d=jt.dot(gn),g=Jt.dot(gn);if(g>=0&&d<=g)return t.copy(n);const p=d*h-A*g;if(p<=0&&h>=0&&g<=0)return o=h/(h-g),t.copy(s).addScaledVector(Jt,o);const f=c*g-d*l;if(f<=0&&l-c>=0&&d-g>=0)return no.subVectors(n,i),o=(l-c)/(l-c+(d-g)),t.copy(i).addScaledVector(no,o);const m=1/(f+p+u);return r=p*m,o=u*m,t.copy(s).addScaledVector(jt,r).addScaledVector(Jt,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const ro={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},lt={h:0,s:0,l:0},ni={h:0,s:0,l:0};function In(a,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?a+(e-a)*6*t:t<1/2?e:t<2/3?a+(e-a)*6*(2/3-t):a}class X{constructor(e,t,s){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,s)}set(e,t,s){if(t===void 0&&s===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,s);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=ie){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ce.toWorkingColorSpace(this,t),this}setRGB(e,t,s,i=ce.workingColorSpace){return this.r=e,this.g=t,this.b=s,ce.toWorkingColorSpace(this,i),this}setHSL(e,t,s,i=ce.workingColorSpace){if(e=Zi(e,1),t=he(t,0,1),s=he(s,0,1),t===0)this.r=this.g=this.b=s;else{const n=s<=.5?s*(1+t):s+t-s*t,r=2*s-n;this.r=In(r,n,e+1/3),this.g=In(r,n,e),this.b=In(r,n,e-1/3)}return ce.toWorkingColorSpace(this,i),this}setStyle(e,t=ie){function s(n){n!==void 0&&parseFloat(n)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let n;const r=i[1],o=i[2];switch(r){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return s(n[4]),this.setRGB(Math.min(255,parseInt(n[1],10))/255,Math.min(255,parseInt(n[2],10))/255,Math.min(255,parseInt(n[3],10))/255,t);if(n=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return s(n[4]),this.setRGB(Math.min(100,parseInt(n[1],10))/100,Math.min(100,parseInt(n[2],10))/100,Math.min(100,parseInt(n[3],10))/100,t);break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return s(n[4]),this.setHSL(parseFloat(n[1])/360,parseFloat(n[2])/100,parseFloat(n[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const n=i[1],r=n.length;if(r===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(r===6)return this.setHex(parseInt(n,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=ie){const s=ro[e.toLowerCase()];return s!==void 0?this.setHex(s,t):console.warn("THREE.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=vt(e.r),this.g=vt(e.g),this.b=vt(e.b),this}copyLinearToSRGB(e){return this.r=tn(e.r),this.g=tn(e.g),this.b=tn(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ie){return ce.fromWorkingColorSpace(ue.copy(this),e),Math.round(he(ue.r*255,0,255))*65536+Math.round(he(ue.g*255,0,255))*256+Math.round(he(ue.b*255,0,255))}getHexString(e=ie){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ce.workingColorSpace){ce.fromWorkingColorSpace(ue.copy(this),t);const s=ue.r,i=ue.g,n=ue.b,r=Math.max(s,i,n),o=Math.min(s,i,n);let A,h;const c=(o+r)/2;if(o===r)A=0,h=0;else{const l=r-o;switch(h=c<=.5?l/(r+o):l/(2-r-o),r){case s:A=(i-n)/l+(i<n?6:0);break;case i:A=(n-s)/l+2;break;case n:A=(s-i)/l+4;break}A/=6}return e.h=A,e.s=h,e.l=c,e}getRGB(e,t=ce.workingColorSpace){return ce.fromWorkingColorSpace(ue.copy(this),t),e.r=ue.r,e.g=ue.g,e.b=ue.b,e}getStyle(e=ie){ce.fromWorkingColorSpace(ue.copy(this),e);const t=ue.r,s=ue.g,i=ue.b;return e!==ie?`color(${e} ${t.toFixed(3)} ${s.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(s*255)},${Math.round(i*255)})`}offsetHSL(e,t,s){return this.getHSL(lt),this.setHSL(lt.h+e,lt.s+t,lt.l+s)}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,s){return this.r=e.r+(t.r-e.r)*s,this.g=e.g+(t.g-e.g)*s,this.b=e.b+(t.b-e.b)*s,this}lerpHSL(e,t){this.getHSL(lt),e.getHSL(ni);const s=bs(lt.h,ni.h,t),i=bs(lt.s,ni.s,t),n=bs(lt.l,ni.l,t);return this.setHSL(s,i,n),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,s=this.g,i=this.b,n=e.elements;return this.r=n[0]*t+n[3]*s+n[6]*i,this.g=n[1]*t+n[4]*s+n[7]*i,this.b=n[2]*t+n[5]*s+n[8]*i,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 ue=new X;X.NAMES=ro;let eh=0;class Et extends Lt{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:eh++}),this.uuid=Ne(),this.name="",this.type="Material",this.blending=Br,this.side=Js,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Qr,this.blendDst=wr,this.blendEquation=xr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new X(0,0,0),this.blendAlpha=0,this.depthFunc=Tr,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Hr,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=_t,this.stencilZFail=_t,this.stencilZPass=_t,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.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}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const s=e[t];if(s===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(s):i&&i.isVector3&&s&&s.isVector3?i.copy(s):this[t]=s}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const s={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.color&&this.color.isColor&&(s.color=this.color.getHex()),this.roughness!==void 0&&(s.roughness=this.roughness),this.metalness!==void 0&&(s.metalness=this.metalness),this.sheen!==void 0&&(s.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(s.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(s.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(s.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(s.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(s.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(s.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(s.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(s.shininess=this.shininess),this.clearcoat!==void 0&&(s.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(s.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(s.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(s.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(s.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,s.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(s.dispersion=this.dispersion),this.iridescence!==void 0&&(s.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(s.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(s.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(s.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(s.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(s.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(s.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(s.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(s.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(s.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(s.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(s.lightMap=this.lightMap.toJSON(e).uuid,s.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(s.aoMap=this.aoMap.toJSON(e).uuid,s.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(s.bumpMap=this.bumpMap.toJSON(e).uuid,s.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(s.normalMap=this.normalMap.toJSON(e).uuid,s.normalMapType=this.normalMapType,s.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(s.displacementMap=this.displacementMap.toJSON(e).uuid,s.displacementScale=this.displacementScale,s.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(s.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(s.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(s.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(s.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(s.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(s.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(s.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(s.combine=this.combine)),this.envMapRotation!==void 0&&(s.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(s.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(s.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(s.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(s.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(s.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(s.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(s.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(s.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(s.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(s.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(s.size=this.size),this.shadowSide!==null&&(s.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(s.sizeAttenuation=this.sizeAttenuation),this.blending!==Br&&(s.blending=this.blending),this.side!==Js&&(s.side=this.side),this.vertexColors===!0&&(s.vertexColors=!0),this.opacity<1&&(s.opacity=this.opacity),this.transparent===!0&&(s.transparent=!0),this.blendSrc!==Qr&&(s.blendSrc=this.blendSrc),this.blendDst!==wr&&(s.blendDst=this.blendDst),this.blendEquation!==xr&&(s.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(s.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(s.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(s.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(s.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(s.blendAlpha=this.blendAlpha),this.depthFunc!==Tr&&(s.depthFunc=this.depthFunc),this.depthTest===!1&&(s.depthTest=this.depthTest),this.depthWrite===!1&&(s.depthWrite=this.depthWrite),this.colorWrite===!1&&(s.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(s.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Hr&&(s.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(s.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(s.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==_t&&(s.stencilFail=this.stencilFail),this.stencilZFail!==_t&&(s.stencilZFail=this.stencilZFail),this.stencilZPass!==_t&&(s.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(s.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(s.rotation=this.rotation),this.polygonOffset===!0&&(s.polygonOffset=!0),this.polygonOffsetFactor!==0&&(s.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(s.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(s.linewidth=this.linewidth),this.dashSize!==void 0&&(s.dashSize=this.dashSize),this.gapSize!==void 0&&(s.gapSize=this.gapSize),this.scale!==void 0&&(s.scale=this.scale),this.dithering===!0&&(s.dithering=!0),this.alphaTest>0&&(s.alphaTest=this.alphaTest),this.alphaHash===!0&&(s.alphaHash=!0),this.alphaToCoverage===!0&&(s.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(s.premultipliedAlpha=!0),this.forceSinglePass===!0&&(s.forceSinglePass=!0),this.wireframe===!0&&(s.wireframe=!0),this.wireframeLinewidth>1&&(s.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(s.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(s.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(s.flatShading=!0),this.visible===!1&&(s.visible=!1),this.toneMapped===!1&&(s.toneMapped=!1),this.fog===!1&&(s.fog=!1),Object.keys(this.userData).length>0&&(s.userData=this.userData);function i(n){const r=[];for(const o in n){const A=n[o];delete A.metadata,r.push(A)}return r}if(t){const n=i(e.textures),r=i(e.images);n.length>0&&(s.textures=n),r.length>0&&(s.images=r)}return s}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 s=null;if(t!==null){const i=t.length;s=new Array(i);for(let n=0;n!==i;++n)s[n]=t[n].clone()}return this.clippingPlanes=s,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.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 Wt extends Et{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new X(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 Ht,this.combine=rA,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 Z=new b,ri=new q;class ye{constructor(e,t,s=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=s,this.usage=Ws,this.updateRanges=[],this.gpuType=It,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,s){e*=this.itemSize,s*=t.itemSize;for(let i=0,n=this.itemSize;i<n;i++)this.array[e+i]=t.array[s+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,s=this.count;t<s;t++)ri.fromBufferAttribute(this,t),ri.applyMatrix3(e),this.setXY(t,ri.x,ri.y);else if(this.itemSize===3)for(let t=0,s=this.count;t<s;t++)Z.fromBufferAttribute(this,t),Z.applyMatrix3(e),this.setXYZ(t,Z.x,Z.y,Z.z);return this}applyMatrix4(e){for(let t=0,s=this.count;t<s;t++)Z.fromBufferAttribute(this,t),Z.applyMatrix4(e),this.setXYZ(t,Z.x,Z.y,Z.z);return this}applyNormalMatrix(e){for(let t=0,s=this.count;t<s;t++)Z.fromBufferAttribute(this,t),Z.applyNormalMatrix(e),this.setXYZ(t,Z.x,Z.y,Z.z);return this}transformDirection(e){for(let t=0,s=this.count;t<s;t++)Z.fromBufferAttribute(this,t),Z.transformDirection(e),this.setXYZ(t,Z.x,Z.y,Z.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let s=this.array[e*this.itemSize+t];return this.normalized&&(s=Re(s,this.array)),s}setComponent(e,t,s){return this.normalized&&(s=z(s,this.array)),this.array[e*this.itemSize+t]=s,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Re(t,this.array)),t}setX(e,t){return this.normalized&&(t=z(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Re(t,this.array)),t}setY(e,t){return this.normalized&&(t=z(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=Re(t,this.array)),t}setZ(e,t){return this.normalized&&(t=z(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=Re(t,this.array)),t}setW(e,t){return this.normalized&&(t=z(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,s){return e*=this.itemSize,this.normalized&&(t=z(t,this.array),s=z(s,this.array)),this.array[e+0]=t,this.array[e+1]=s,this}setXYZ(e,t,s,i){return e*=this.itemSize,this.normalized&&(t=z(t,this.array),s=z(s,this.array),i=z(i,this.array)),this.array[e+0]=t,this.array[e+1]=s,this.array[e+2]=i,this}setXYZW(e,t,s,i,n){return e*=this.itemSize,this.normalized&&(t=z(t,this.array),s=z(s,this.array),i=z(i,this.array),n=z(n,this.array)),this.array[e+0]=t,this.array[e+1]=s,this.array[e+2]=i,this.array[e+3]=n,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!==Ws&&(e.usage=this.usage),e}}class th extends ye{constructor(e,t,s){super(new Uint16Array(e),t,s)}}class sh extends ye{constructor(e,t,s){super(new Uint32Array(e),t,s)}}class bn extends ye{constructor(e,t,s){super(new Float32Array(e),t,s)}}let ih=0;const we=new _,yn=new Y,Kt=new b,Ee=new Je,xs=new Je,ne=new b;class Ct extends Lt{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:ih++}),this.uuid=Ne(),this.name="",this.type="BufferGeometry",this.index=null,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(UA(e)?sh:th)(e,1):this.index=e,this}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,s=0){this.groups.push({start:e,count:t,materialIndex:s})}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 s=this.attributes.normal;if(s!==void 0){const n=new Fe().getNormalMatrix(e);s.applyNormalMatrix(n),s.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return we.makeRotationFromQuaternion(e),this.applyMatrix4(we),this}rotateX(e){return we.makeRotationX(e),this.applyMatrix4(we),this}rotateY(e){return we.makeRotationY(e),this.applyMatrix4(we),this}rotateZ(e){return we.makeRotationZ(e),this.applyMatrix4(we),this}translate(e,t,s){return we.makeTranslation(e,t,s),this.applyMatrix4(we),this}scale(e,t,s){return we.makeScale(e,t,s),this.applyMatrix4(we),this}lookAt(e){return yn.lookAt(e),yn.updateMatrix(),this.applyMatrix4(yn.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Kt).negate(),this.translate(Kt.x,Kt.y,Kt.z),this}setFromPoints(e){const t=[];for(let s=0,i=e.length;s<i;s++){const n=e[s];t.push(n.x,n.y,n.z||0)}return this.setAttribute("position",new bn(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Je);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new b(-1/0,-1/0,-1/0),new b(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let s=0,i=t.length;s<i;s++){const n=t[s];Ee.setFromBufferAttribute(n),this.morphTargetsRelative?(ne.addVectors(this.boundingBox.min,Ee.min),this.boundingBox.expandByPoint(ne),ne.addVectors(this.boundingBox.max,Ee.max),this.boundingBox.expandByPoint(ne)):(this.boundingBox.expandByPoint(Ee.min),this.boundingBox.expandByPoint(Ee.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.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 Oe);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new b,1/0);return}if(e){const s=this.boundingSphere.center;if(Ee.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const o=t[n];xs.setFromBufferAttribute(o),this.morphTargetsRelative?(ne.addVectors(Ee.min,xs.min),Ee.expandByPoint(ne),ne.addVectors(Ee.max,xs.max),Ee.expandByPoint(ne)):(Ee.expandByPoint(xs.min),Ee.expandByPoint(xs.max))}Ee.getCenter(s);let i=0;for(let n=0,r=e.count;n<r;n++)ne.fromBufferAttribute(e,n),i=Math.max(i,s.distanceToSquared(ne));if(t)for(let n=0,r=t.length;n<r;n++){const o=t[n],A=this.morphTargetsRelative;for(let h=0,c=o.count;h<c;h++)ne.fromBufferAttribute(o,h),A&&(Kt.fromBufferAttribute(e,h),ne.add(Kt)),i=Math.max(i,s.distanceToSquared(ne))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.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){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const s=t.position,i=t.normal,n=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ye(new Float32Array(4*s.count),4));const r=this.getAttribute("tangent"),o=[],A=[];for(let R=0;R<s.count;R++)o[R]=new b,A[R]=new b;const h=new b,c=new b,l=new b,u=new q,d=new q,g=new q,p=new b,f=new b;function m(R,D,O){h.fromBufferAttribute(s,R),c.fromBufferAttribute(s,D),l.fromBufferAttribute(s,O),u.fromBufferAttribute(n,R),d.fromBufferAttribute(n,D),g.fromBufferAttribute(n,O),c.sub(h),l.sub(h),d.sub(u),g.sub(u);const H=1/(d.x*g.y-g.x*d.y);isFinite(H)&&(p.copy(c).multiplyScalar(g.y).addScaledVector(l,-d.y).multiplyScalar(H),f.copy(l).multiplyScalar(d.x).addScaledVector(c,-g.x).multiplyScalar(H),o[R].add(p),o[D].add(p),o[O].add(p),A[R].add(f),A[D].add(f),A[O].add(f))}let y=this.groups;y.length===0&&(y=[{start:0,count:e.count}]);for(let R=0,D=y.length;R<D;++R){const O=y[R],H=O.start,ae=O.count;for(let J=H,Be=H+ae;J<Be;J+=3)m(e.getX(J+0),e.getX(J+1),e.getX(J+2))}const C=new b,E=new b,w=new b,S=new b;function M(R){w.fromBufferAttribute(i,R),S.copy(w);const D=o[R];C.copy(D),C.sub(w.multiplyScalar(w.dot(D))).normalize(),E.crossVectors(S,D);const H=E.dot(A[R])<0?-1:1;r.setXYZW(R,C.x,C.y,C.z,H)}for(let R=0,D=y.length;R<D;++R){const O=y[R],H=O.start,ae=O.count;for(let J=H,Be=H+ae;J<Be;J+=3)M(e.getX(J+0)),M(e.getX(J+1)),M(e.getX(J+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let s=this.getAttribute("normal");if(s===void 0)s=new ye(new Float32Array(t.count*3),3),this.setAttribute("normal",s);else for(let u=0,d=s.count;u<d;u++)s.setXYZ(u,0,0,0);const i=new b,n=new b,r=new b,o=new b,A=new b,h=new b,c=new b,l=new b;if(e)for(let u=0,d=e.count;u<d;u+=3){const g=e.getX(u+0),p=e.getX(u+1),f=e.getX(u+2);i.fromBufferAttribute(t,g),n.fromBufferAttribute(t,p),r.fromBufferAttribute(t,f),c.subVectors(r,n),l.subVectors(i,n),c.cross(l),o.fromBufferAttribute(s,g),A.fromBufferAttribute(s,p),h.fromBufferAttribute(s,f),o.add(c),A.add(c),h.add(c),s.setXYZ(g,o.x,o.y,o.z),s.setXYZ(p,A.x,A.y,A.z),s.setXYZ(f,h.x,h.y,h.z)}else for(let u=0,d=t.count;u<d;u+=3)i.fromBufferAttribute(t,u+0),n.fromBufferAttribute(t,u+1),r.fromBufferAttribute(t,u+2),c.subVectors(r,n),l.subVectors(i,n),c.cross(l),s.setXYZ(u+0,c.x,c.y,c.z),s.setXYZ(u+1,c.x,c.y,c.z),s.setXYZ(u+2,c.x,c.y,c.z);this.normalizeNormals(),s.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,s=e.count;t<s;t++)ne.fromBufferAttribute(e,t),ne.normalize(),e.setXYZ(t,ne.x,ne.y,ne.z)}toNonIndexed(){function e(o,A){const h=o.array,c=o.itemSize,l=o.normalized,u=new h.constructor(A.length*c);let d=0,g=0;for(let p=0,f=A.length;p<f;p++){o.isInterleavedBufferAttribute?d=A[p]*o.data.stride+o.offset:d=A[p]*c;for(let m=0;m<c;m++)u[g++]=h[d++]}return new ye(u,c,l)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Ct,s=this.index.array,i=this.attributes;for(const o in i){const A=i[o],h=e(A,s);t.setAttribute(o,h)}const n=this.morphAttributes;for(const o in n){const A=[],h=n[o];for(let c=0,l=h.length;c<l;c++){const u=h[c],d=e(u,s);A.push(d)}t.morphAttributes[o]=A}t.morphTargetsRelative=this.morphTargetsRelative;const r=this.groups;for(let o=0,A=r.length;o<A;o++){const h=r[o];t.addGroup(h.start,h.count,h.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,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 A=this.parameters;for(const h in A)A[h]!==void 0&&(e[h]=A[h]);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 s=this.attributes;for(const A in s){const h=s[A];e.data.attributes[A]=h.toJSON(e.data)}const i={};let n=!1;for(const A in this.morphAttributes){const h=this.morphAttributes[A],c=[];for(let l=0,u=h.length;l<u;l++){const d=h[l];c.push(d.toJSON(e.data))}c.length>0&&(i[A]=c,n=!0)}n&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const r=this.groups;r.length>0&&(e.data.groups=JSON.parse(JSON.stringify(r)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),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 s=e.index;s!==null&&this.setIndex(s.clone(t));const i=e.attributes;for(const h in i){const c=i[h];this.setAttribute(h,c.clone(t))}const n=e.morphAttributes;for(const h in n){const c=[],l=n[h];for(let u=0,d=l.length;u<d;u++)c.push(l[u].clone(t));this.morphAttributes[h]=c}this.morphTargetsRelative=e.morphTargetsRelative;const r=e.groups;for(let h=0,c=r.length;h<c;h++){const l=r[h];this.addGroup(l.start,l.count,l.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const A=e.boundingSphere;return A!==null&&(this.boundingSphere=A.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const oo=new _,Bt=new ti,oi=new Oe,ao=new b,ai=new b,Ai=new b,hi=new b,En=new b,ci=new b,Ao=new b,li=new b;class ui extends Y{constructor(e=new Ct,t=new Wt){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,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,s=Object.keys(t);if(s.length>0){const i=t[s[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let n=0,r=i.length;n<r;n++){const o=i[n].name||String(n);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=n}}}}getVertexPosition(e,t){const s=this.geometry,i=s.attributes.position,n=s.morphAttributes.position,r=s.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(n&&o){ci.set(0,0,0);for(let A=0,h=n.length;A<h;A++){const c=o[A],l=n[A];c!==0&&(En.fromBufferAttribute(l,e),r?ci.addScaledVector(En,c):ci.addScaledVector(En.sub(t),c))}t.add(ci)}return t}raycast(e,t){const s=this.geometry,i=this.material,n=this.matrixWorld;i!==void 0&&(s.boundingSphere===null&&s.computeBoundingSphere(),oi.copy(s.boundingSphere),oi.applyMatrix4(n),Bt.copy(e.ray).recast(e.near),!(oi.containsPoint(Bt.origin)===!1&&(Bt.intersectSphere(oi,ao)===null||Bt.origin.distanceToSquared(ao)>(e.far-e.near)**2))&&(oo.copy(n).invert(),Bt.copy(e.ray).applyMatrix4(oo),!(s.boundingBox!==null&&Bt.intersectsBox(s.boundingBox)===!1)&&this._computeIntersections(e,t,Bt)))}_computeIntersections(e,t,s){let i;const n=this.geometry,r=this.material,o=n.index,A=n.attributes.position,h=n.attributes.uv,c=n.attributes.uv1,l=n.attributes.normal,u=n.groups,d=n.drawRange;if(o!==null)if(Array.isArray(r))for(let g=0,p=u.length;g<p;g++){const f=u[g],m=r[f.materialIndex],y=Math.max(f.start,d.start),C=Math.min(o.count,Math.min(f.start+f.count,d.start+d.count));for(let E=y,w=C;E<w;E+=3){const S=o.getX(E),M=o.getX(E+1),R=o.getX(E+2);i=di(this,m,e,s,h,c,l,S,M,R),i&&(i.faceIndex=Math.floor(E/3),i.face.materialIndex=f.materialIndex,t.push(i))}}else{const g=Math.max(0,d.start),p=Math.min(o.count,d.start+d.count);for(let f=g,m=p;f<m;f+=3){const y=o.getX(f),C=o.getX(f+1),E=o.getX(f+2);i=di(this,r,e,s,h,c,l,y,C,E),i&&(i.faceIndex=Math.floor(f/3),t.push(i))}}else if(A!==void 0)if(Array.isArray(r))for(let g=0,p=u.length;g<p;g++){const f=u[g],m=r[f.materialIndex],y=Math.max(f.start,d.start),C=Math.min(A.count,Math.min(f.start+f.count,d.start+d.count));for(let E=y,w=C;E<w;E+=3){const S=E,M=E+1,R=E+2;i=di(this,m,e,s,h,c,l,S,M,R),i&&(i.faceIndex=Math.floor(E/3),i.face.materialIndex=f.materialIndex,t.push(i))}}else{const g=Math.max(0,d.start),p=Math.min(A.count,d.start+d.count);for(let f=g,m=p;f<m;f+=3){const y=f,C=f+1,E=f+2;i=di(this,r,e,s,h,c,l,y,C,E),i&&(i.faceIndex=Math.floor(f/3),t.push(i))}}}}function nh(a,e,t,s,i,n,r,o){let A;if(e.side===Cr?A=s.intersectTriangle(r,n,i,!0,o):A=s.intersectTriangle(i,n,r,e.side===Js,o),A===null)return null;li.copy(o),li.applyMatrix4(a.matrixWorld);const h=t.ray.origin.distanceTo(li);return h<t.near||h>t.far?null:{distance:h,point:li.clone(),object:a}}function di(a,e,t,s,i,n,r,o,A,h){a.getVertexPosition(o,ai),a.getVertexPosition(A,Ai),a.getVertexPosition(h,hi);const c=nh(a,e,t,s,ai,Ai,hi,Ao);if(c){const l=new b;Le.getBarycoord(Ao,ai,Ai,hi,l),i&&(c.uv=Le.getInterpolatedAttribute(i,o,A,h,l,new q)),n&&(c.uv1=Le.getInterpolatedAttribute(n,o,A,h,l,new q)),r&&(c.normal=Le.getInterpolatedAttribute(r,o,A,h,l,new b),c.normal.dot(s.direction)>0&&c.normal.multiplyScalar(-1));const u={a:o,b:A,c:h,normal:new b,materialIndex:0};Le.getNormal(ai,Ai,hi,u.normal),c.face=u,c.barycoord=l}return c}class ho extends Y{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new _,this.projectionMatrix=new _,this.projectionMatrixInverse=new _,this.coordinateSystem=rt}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const ut=new b,co=new q,lo=new q;class Cn extends ho{constructor(e=50,t=1,s=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=s,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Is*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(ms*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Is*2*Math.atan(Math.tan(ms*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,s){ut.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ut.x,ut.y).multiplyScalar(-e/ut.z),ut.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),s.set(ut.x,ut.y).multiplyScalar(-e/ut.z)}getViewSize(e,t){return this.getViewBounds(e,co,lo),t.subVectors(lo,co)}setViewOffset(e,t,s,i,n,r){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=s,this.view.offsetY=i,this.view.width=n,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(ms*.5*this.fov)/this.zoom,s=2*t,i=this.aspect*s,n=-.5*i;const r=this.view;if(this.view!==null&&this.view.enabled){const A=r.fullWidth,h=r.fullHeight;n+=r.offsetX*i/A,t-=r.offsetY*s/h,i*=r.width/A,s*=r.height/h}const o=this.filmOffset;o!==0&&(n+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(n,n+i,t,t-s,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Bn=new b,rh=new b,oh=new Fe;class xt{constructor(e=new b(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,s,i){return this.normal.set(e,t,s),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,s){const i=Bn.subVectors(s,t).cross(rh.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,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){const s=e.delta(Bn),i=this.normal.dot(s);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const n=-(e.start.dot(this.normal)+this.constant)/i;return n<0||n>1?null:t.copy(e.start).addScaledVector(s,n)}intersectsLine(e){const t=this.distanceToPoint(e.start),s=this.distanceToPoint(e.end);return t<0&&s>0||s<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 s=t||oh.getNormalMatrix(e),i=this.coplanarPoint(Bn).applyMatrix4(e),n=this.normal.applyMatrix3(s).normalize();return this.constant=-i.dot(n),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 Qt=new Oe,gi=new b;class ah{constructor(e=new xt,t=new xt,s=new xt,i=new xt,n=new xt,r=new xt){this.planes=[e,t,s,i,n,r]}set(e,t,s,i,n,r){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(s),o[3].copy(i),o[4].copy(n),o[5].copy(r),this}copy(e){const t=this.planes;for(let s=0;s<6;s++)t[s].copy(e.planes[s]);return this}setFromProjectionMatrix(e,t=rt){const s=this.planes,i=e.elements,n=i[0],r=i[1],o=i[2],A=i[3],h=i[4],c=i[5],l=i[6],u=i[7],d=i[8],g=i[9],p=i[10],f=i[11],m=i[12],y=i[13],C=i[14],E=i[15];if(s[0].setComponents(A-n,u-h,f-d,E-m).normalize(),s[1].setComponents(A+n,u+h,f+d,E+m).normalize(),s[2].setComponents(A+r,u+c,f+g,E+y).normalize(),s[3].setComponents(A-r,u-c,f-g,E-y).normalize(),s[4].setComponents(A-o,u-l,f-p,E-C).normalize(),t===rt)s[5].setComponents(A+o,u+l,f+p,E+C).normalize();else if(t===Ks)s[5].setComponents(o,l,p,C).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(),Qt.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Qt.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Qt)}intersectsSprite(e){return Qt.center.set(0,0,0),Qt.radius=.7071067811865476,Qt.applyMatrix4(e.matrixWorld),this.intersectsSphere(Qt)}intersectsSphere(e){const t=this.planes,s=e.center,i=-e.radius;for(let n=0;n<6;n++)if(t[n].distanceToPoint(s)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let s=0;s<6;s++){const i=t[s];if(gi.x=i.normal.x>0?e.max.x:e.min.x,gi.y=i.normal.y>0?e.max.y:e.min.y,gi.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(gi)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let s=0;s<6;s++)if(t[s].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class uo extends ho{constructor(e=-1,t=1,s=1,i=-1,n=.1,r=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=s,this.bottom=i,this.near=n,this.far=r,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,s,i,n,r){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=s,this.view.offsetY=i,this.view.width=n,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),s=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let n=s-e,r=s+e,o=i+t,A=i-t;if(this.view!==null&&this.view.enabled){const h=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;n+=h*this.view.offsetX,r=n+h*this.view.width,o-=c*this.view.offsetY,A=o-c*this.view.height}this.projectionMatrix.makeOrthographic(n,r,o,A,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class go extends le{constructor(e,t,s,i,n,r,o,A,h,c=ji){if(c!==ji&&c!==Fr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");s===void 0&&c===ji&&(s=Rr),s===void 0&&c===Fr&&(s=uA),super(null,i,n,r,o,A,c,s,h),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:je,this.minFilter=A!==void 0?A:je,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class xn extends Y{constructor(){super(),this.isGroup=!0,this.type="Group"}}class po{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Ws,this.updateRanges=[],this.version=0,this.uuid=Ne()}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,s){e*=this.stride,s*=t.stride;for(let i=0,n=this.stride;i<n;i++)this.array[e+i]=t.array[s+i];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=Ne()),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]),s=new this.constructor(t,this.stride);return s.setUsage(this.usage),s}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=Ne()),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 ge=new b;class pi{constructor(e,t,s,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=s,this.normalized=i}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,s=this.data.count;t<s;t++)ge.fromBufferAttribute(this,t),ge.applyMatrix4(e),this.setXYZ(t,ge.x,ge.y,ge.z);return this}applyNormalMatrix(e){for(let t=0,s=this.count;t<s;t++)ge.fromBufferAttribute(this,t),ge.applyNormalMatrix(e),this.setXYZ(t,ge.x,ge.y,ge.z);return this}transformDirection(e){for(let t=0,s=this.count;t<s;t++)ge.fromBufferAttribute(this,t),ge.transformDirection(e),this.setXYZ(t,ge.x,ge.y,ge.z);return this}getComponent(e,t){let s=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(s=Re(s,this.array)),s}setComponent(e,t,s){return this.normalized&&(s=z(s,this.array)),this.data.array[e*this.data.stride+this.offset+t]=s,this}setX(e,t){return this.normalized&&(t=z(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=z(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=z(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=z(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=Re(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Re(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Re(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Re(t,this.array)),t}setXY(e,t,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=z(t,this.array),s=z(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=s,this}setXYZ(e,t,s,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=z(t,this.array),s=z(s,this.array),i=z(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=s,this.data.array[e+2]=i,this}setXYZW(e,t,s,i,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=z(t,this.array),s=z(s,this.array),i=z(i,this.array),n=z(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=s,this.data.array[e+2]=i,this.data.array[e+3]=n,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let s=0;s<this.count;s++){const i=s*this.data.stride+this.offset;for(let n=0;n<this.itemSize;n++)t.push(this.data.array[i+n])}return new ye(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 pi(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let s=0;s<this.count;s++){const i=s*this.data.stride+this.offset;for(let n=0;n<this.itemSize;n++)t.push(this.data.array[i+n])}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}}}const fo=new b,mo=new K,Io=new K,Ah=new b,bo=new _,fi=new b,Qn=new Oe,yo=new _,wn=new ti;class hh extends ui{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Sr,this.bindMatrix=new _,this.bindMatrixInverse=new _,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Je),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let s=0;s<t.count;s++)this.getVertexPosition(s,fi),this.boundingBox.expandByPoint(fi)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Oe),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let s=0;s<t.count;s++)this.getVertexPosition(s,fi),this.boundingSphere.expandByPoint(fi)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const s=this.material,i=this.matrixWorld;s!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Qn.copy(this.boundingSphere),Qn.applyMatrix4(i),e.ray.intersectsSphere(Qn)!==!1&&(yo.copy(i).invert(),wn.copy(e.ray).applyMatrix4(yo),!(this.boundingBox!==null&&wn.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,wn)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new K,t=this.geometry.attributes.skinWeight;for(let s=0,i=t.count;s<i;s++){e.fromBufferAttribute(t,s);const n=1/e.manhattanLength();n!==1/0?e.multiplyScalar(n):e.set(1,0,0,0),t.setXYZW(s,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Sr?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===oA?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const s=this.skeleton,i=this.geometry;mo.fromBufferAttribute(i.attributes.skinIndex,e),Io.fromBufferAttribute(i.attributes.skinWeight,e),fo.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let n=0;n<4;n++){const r=Io.getComponent(n);if(r!==0){const o=mo.getComponent(n);bo.multiplyMatrices(s.bones[o].matrixWorld,s.boneInverses[o]),t.addScaledVector(Ah.copy(fo).applyMatrix4(bo),r)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Eo extends Y{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Tn extends le{constructor(e=null,t=1,s=1,i,n,r,o,A,h=je,c=je,l,u){super(null,r,o,A,h,c,i,n,l,u),this.isDataTexture=!0,this.image={data:e,width:t,height:s},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Co=new _,ch=new _;class Sn{constructor(e=[],t=[]){this.uuid=Ne(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let s=0,i=this.bones.length;s<i;s++)this.boneInverses.push(new _)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const s=new _;this.bones[e]&&s.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(s)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const s=this.bones[e];s&&s.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const s=this.bones[e];s&&(s.parent&&s.parent.isBone?(s.matrix.copy(s.parent.matrixWorld).invert(),s.matrix.multiply(s.matrixWorld)):s.matrix.copy(s.matrixWorld),s.matrix.decompose(s.position,s.quaternion,s.scale))}}update(){const e=this.bones,t=this.boneInverses,s=this.boneMatrices,i=this.boneTexture;for(let n=0,r=e.length;n<r;n++){const o=e[n]?e[n].matrixWorld:ch;Co.multiplyMatrices(o,t[n]),Co.toArray(s,n*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Sn(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const s=new Tn(t,e,e,nt,It);return s.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=s,this}getBoneByName(e){for(let t=0,s=this.bones.length;t<s;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let s=0,i=e.bones.length;s<i;s++){const n=e.bones[s];let r=t[n];r===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",n),r=new Eo),this.bones.push(r),this.boneInverses.push(new _().fromArray(e.boneInverses[s]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,s=this.boneInverses;for(let i=0,n=t.length;i<n;i++){const r=t[i];e.bones.push(r.uuid);const o=s[i];e.boneInverses.push(o.toArray())}return e}}class Mn extends ye{constructor(e,t,s,i=1){super(e,t,s),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Yt=new _,Bo=new _,mi=[],xo=new Je,lh=new _,Qs=new ui,ws=new Oe;class uh extends ui{constructor(e,t,s){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Mn(new Float32Array(s*16),16),this.instanceColor=null,this.morphTexture=null,this.count=s,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<s;i++)this.setMatrixAt(i,lh)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Je),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let s=0;s<t;s++)this.getMatrixAt(s,Yt),xo.copy(e.boundingBox).applyMatrix4(Yt),this.boundingBox.union(xo)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Oe),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let s=0;s<t;s++)this.getMatrixAt(s,Yt),ws.copy(e.boundingSphere).applyMatrix4(Yt),this.boundingSphere.union(ws)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const s=t.morphTargetInfluences,i=this.morphTexture.source.data.data,n=s.length+1,r=e*n+1;for(let o=0;o<s.length;o++)s[o]=i[r+o]}raycast(e,t){const s=this.matrixWorld,i=this.count;if(Qs.geometry=this.geometry,Qs.material=this.material,Qs.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),ws.copy(this.boundingSphere),ws.applyMatrix4(s),e.ray.intersectsSphere(ws)!==!1))for(let n=0;n<i;n++){this.getMatrixAt(n,Yt),Bo.multiplyMatrices(s,Yt),Qs.matrixWorld=Bo,Qs.raycast(e,mi);for(let r=0,o=mi.length;r<o;r++){const A=mi[r];A.instanceId=n,A.object=this,t.push(A)}mi.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Mn(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const s=t.morphTargetInfluences,i=s.length+1;this.morphTexture===null&&(this.morphTexture=new Tn(new Float32Array(i*this.count),i,this.count,Dt,It));const n=this.morphTexture.source.data.data;let r=0;for(let h=0;h<s.length;h++)r+=s[h];const o=this.geometry.morphTargetsRelative?1:1-r,A=i*e;n[A]=o,n.set(s,A+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}class Qo extends Et{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new X(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 Ii=new b,bi=new b,wo=new _,Ts=new ti,yi=new Oe,Nn=new b,To=new b;class Rn extends Y{constructor(e=new Ct,t=new Qo){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,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,s=[0];for(let i=1,n=t.count;i<n;i++)Ii.fromBufferAttribute(t,i-1),bi.fromBufferAttribute(t,i),s[i]=s[i-1],s[i]+=Ii.distanceTo(bi);e.setAttribute("lineDistance",new bn(s,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const s=this.geometry,i=this.matrixWorld,n=e.params.Line.threshold,r=s.drawRange;if(s.boundingSphere===null&&s.computeBoundingSphere(),yi.copy(s.boundingSphere),yi.applyMatrix4(i),yi.radius+=n,e.ray.intersectsSphere(yi)===!1)return;wo.copy(i).invert(),Ts.copy(e.ray).applyMatrix4(wo);const o=n/((this.scale.x+this.scale.y+this.scale.z)/3),A=o*o,h=this.isLineSegments?2:1,c=s.index,u=s.attributes.position;if(c!==null){const d=Math.max(0,r.start),g=Math.min(c.count,r.start+r.count);for(let p=d,f=g-1;p<f;p+=h){const m=c.getX(p),y=c.getX(p+1),C=Ei(this,e,Ts,A,m,y);C&&t.push(C)}if(this.isLineLoop){const p=c.getX(g-1),f=c.getX(d),m=Ei(this,e,Ts,A,p,f);m&&t.push(m)}}else{const d=Math.max(0,r.start),g=Math.min(u.count,r.start+r.count);for(let p=d,f=g-1;p<f;p+=h){const m=Ei(this,e,Ts,A,p,p+1);m&&t.push(m)}if(this.isLineLoop){const p=Ei(this,e,Ts,A,g-1,d);p&&t.push(p)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,s=Object.keys(t);if(s.length>0){const i=t[s[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let n=0,r=i.length;n<r;n++){const o=i[n].name||String(n);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=n}}}}}function Ei(a,e,t,s,i,n){const r=a.geometry.attributes.position;if(Ii.fromBufferAttribute(r,i),bi.fromBufferAttribute(r,n),t.distanceSqToSegment(Ii,bi,Nn,To)>s)return;Nn.applyMatrix4(a.matrixWorld);const A=e.ray.origin.distanceTo(Nn);if(!(A<e.near||A>e.far))return{distance:A,point:To.clone().applyMatrix4(a.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:a}}const So=new b,Mo=new b;class dh extends Rn{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,s=[];for(let i=0,n=t.count;i<n;i+=2)So.fromBufferAttribute(t,i),Mo.fromBufferAttribute(t,i+1),s[i]=i===0?0:s[i-1],s[i+1]=s[i]+So.distanceTo(Mo);e.setAttribute("lineDistance",new bn(s,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class gh extends Rn{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class No extends Et{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new X(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 Ro=new _,Fn=new ti,Ci=new Oe,Bi=new b;class ph extends Y{constructor(e=new Ct,t=new No){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,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 s=this.geometry,i=this.matrixWorld,n=e.params.Points.threshold,r=s.drawRange;if(s.boundingSphere===null&&s.computeBoundingSphere(),Ci.copy(s.boundingSphere),Ci.applyMatrix4(i),Ci.radius+=n,e.ray.intersectsSphere(Ci)===!1)return;Ro.copy(i).invert(),Fn.copy(e.ray).applyMatrix4(Ro);const o=n/((this.scale.x+this.scale.y+this.scale.z)/3),A=o*o,h=s.index,l=s.attributes.position;if(h!==null){const u=Math.max(0,r.start),d=Math.min(h.count,r.start+r.count);for(let g=u,p=d;g<p;g++){const f=h.getX(g);Bi.fromBufferAttribute(l,f),Fo(Bi,f,A,i,e,t,this)}}else{const u=Math.max(0,r.start),d=Math.min(l.count,r.start+r.count);for(let g=u,p=d;g<p;g++)Bi.fromBufferAttribute(l,g),Fo(Bi,g,A,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,s=Object.keys(t);if(s.length>0){const i=t[s[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let n=0,r=i.length;n<r;n++){const o=i[n].name||String(n);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=n}}}}}function Fo(a,e,t,s,i,n,r){const o=Fn.distanceSqToPoint(a);if(o<t){const A=new b;Fn.closestPointToPoint(a,A),A.applyMatrix4(s);const h=i.ray.origin.distanceTo(A);if(h<i.near||h>i.far)return;n.push({distance:h,distanceToRay:Math.sqrt(o),point:A,index:e,face:null,faceIndex:null,barycoord:null,object:r})}}class fh extends le{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=je,this.minFilter=je,this.generateMipmaps=!1,this.needsUpdate=!0}}class xi extends le{constructor(e,t,s,i,n,r,o,A,h,c,l,u){super(null,r,o,A,h,c,i,n,l,u),this.isCompressedTexture=!0,this.image={width:t,height:s},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class mh extends xi{constructor(e,t,s,i,n,r){super(e,t,s,n,r),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=mt,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Ih extends xi{constructor(e,t,s){super(void 0,e[0].width,e[0].height,t,s,Nr),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Dn extends Et{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new X(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ki,this.normalScale=new q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ht,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Ue extends Dn{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new q(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return he(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new X(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new X(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new X(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}function Qi(a,e,t){return!a||!t&&a.constructor===e?a:typeof e.BYTES_PER_ELEMENT=="number"?new e(a):Array.prototype.slice.call(a)}function bh(a){return ArrayBuffer.isView(a)&&!(a instanceof DataView)}function yh(a){function e(i,n){return a[i]-a[n]}const t=a.length,s=new Array(t);for(let i=0;i!==t;++i)s[i]=i;return s.sort(e),s}function Do(a,e,t){const s=a.length,i=new a.constructor(s);for(let n=0,r=0;r!==s;++n){const o=t[n]*e;for(let A=0;A!==e;++A)i[r++]=a[o+A]}return i}function ko(a,e,t,s){let i=1,n=a[0];for(;n!==void 0&&n[s]===void 0;)n=a[i++];if(n===void 0)return;let r=n[s];if(r!==void 0)if(Array.isArray(r))do r=n[s],r!==void 0&&(e.push(n.time),t.push.apply(t,r)),n=a[i++];while(n!==void 0);else if(r.toArray!==void 0)do r=n[s],r!==void 0&&(e.push(n.time),r.toArray(t,t.length)),n=a[i++];while(n!==void 0);else do r=n[s],r!==void 0&&(e.push(n.time),t.push(r)),n=a[i++];while(n!==void 0)}class Ss{constructor(e,t,s,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(s),this.sampleValues=t,this.valueSize=s,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let s=this._cachedIndex,i=t[s],n=t[s-1];s:{e:{let r;t:{i:if(!(e<i)){for(let o=s+2;;){if(i===void 0){if(e<n)break i;return s=t.length,this._cachedIndex=s,this.copySampleValue_(s-1)}if(s===o)break;if(n=i,i=t[++s],e<i)break e}r=t.length;break t}if(!(e>=n)){const o=t[1];e<o&&(s=2,n=o);for(let A=s-2;;){if(n===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===A)break;if(i=n,n=t[--s-1],e>=n)break e}r=s,s=0;break t}break s}for(;s<r;){const o=s+r>>>1;e<t[o]?r=o:s=o+1}if(i=t[s],n=t[s-1],n===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return s=t.length,this._cachedIndex=s,this.copySampleValue_(s-1)}this._cachedIndex=s,this.intervalChanged_(s,n,i)}return this.interpolate_(s,n,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,s=this.sampleValues,i=this.valueSize,n=e*i;for(let r=0;r!==i;++r)t[r]=s[n+r];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Eh extends Ss{constructor(e,t,s,i){super(e,t,s,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:_r,endingEnd:_r}}intervalChanged_(e,t,s){const i=this.parameterPositions;let n=e-2,r=e+1,o=i[n],A=i[r];if(o===void 0)switch(this.getSettings_().endingStart){case Lr:n=e,o=2*t-s;break;case vr:n=i.length-2,o=t+i[n]-i[n+1];break;default:n=e,o=s}if(A===void 0)switch(this.getSettings_().endingEnd){case Lr:r=e,A=2*s-t;break;case vr:r=1,A=s+i[1]-i[0];break;default:r=e-1,A=t}const h=(s-t)*.5,c=this.valueSize;this._weightPrev=h/(t-o),this._weightNext=h/(A-s),this._offsetPrev=n*c,this._offsetNext=r*c}interpolate_(e,t,s,i){const n=this.resultBuffer,r=this.sampleValues,o=this.valueSize,A=e*o,h=A-o,c=this._offsetPrev,l=this._offsetNext,u=this._weightPrev,d=this._weightNext,g=(s-t)/(i-t),p=g*g,f=p*g,m=-u*f+2*u*p-u*g,y=(1+u)*f+(-1.5-2*u)*p+(-.5+u)*g+1,C=(-1-d)*f+(1.5+d)*p+.5*g,E=d*f-d*p;for(let w=0;w!==o;++w)n[w]=m*r[c+w]+y*r[h+w]+C*r[A+w]+E*r[l+w];return n}}class Ch extends Ss{constructor(e,t,s,i){super(e,t,s,i)}interpolate_(e,t,s,i){const n=this.resultBuffer,r=this.sampleValues,o=this.valueSize,A=e*o,h=A-o,c=(s-t)/(i-t),l=1-c;for(let u=0;u!==o;++u)n[u]=r[h+u]*l+r[A+u]*c;return n}}class Bh extends Ss{constructor(e,t,s,i){super(e,t,s,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class ze{constructor(e,t,s,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Qi(t,this.TimeBufferType),this.values=Qi(s,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let s;if(t.toJSON!==this.toJSON)s=t.toJSON(e);else{s={name:e.name,times:Qi(e.times,Array),values:Qi(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(s.interpolation=i)}return s.type=e.ValueTypeName,s}InterpolantFactoryMethodDiscrete(e){return new Bh(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Ch(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Eh(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case ps:t=this.InterpolantFactoryMethodDiscrete;break;case fs:t=this.InterpolantFactoryMethodLinear;break;case Ji:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const s="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(s);return console.warn("THREE.KeyframeTrack:",s),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ps;case this.InterpolantFactoryMethodLinear:return fs;case this.InterpolantFactoryMethodSmooth:return Ji}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let s=0,i=t.length;s!==i;++s)t[s]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let s=0,i=t.length;s!==i;++s)t[s]*=e}return this}trim(e,t){const s=this.times,i=s.length;let n=0,r=i-1;for(;n!==i&&s[n]<e;)++n;for(;r!==-1&&s[r]>t;)--r;if(++r,n!==0||r!==i){n>=r&&(r=Math.max(r,1),n=r-1);const o=this.getValueSize();this.times=s.slice(n,r),this.values=this.values.slice(n*o,r*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const s=this.times,i=this.values,n=s.length;n===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let r=null;for(let o=0;o!==n;o++){const A=s[o];if(typeof A=="number"&&isNaN(A)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,A),e=!1;break}if(r!==null&&r>A){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,A,r),e=!1;break}r=A}if(i!==void 0&&bh(i))for(let o=0,A=i.length;o!==A;++o){const h=i[o];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,h),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),s=this.getValueSize(),i=this.getInterpolation()===Ji,n=e.length-1;let r=1;for(let o=1;o<n;++o){let A=!1;const h=e[o],c=e[o+1];if(h!==c&&(o!==1||h!==e[0]))if(i)A=!0;else{const l=o*s,u=l-s,d=l+s;for(let g=0;g!==s;++g){const p=t[l+g];if(p!==t[u+g]||p!==t[d+g]){A=!0;break}}}if(A){if(o!==r){e[r]=e[o];const l=o*s,u=r*s;for(let d=0;d!==s;++d)t[u+d]=t[l+d]}++r}}if(n>0){e[r]=e[n];for(let o=n*s,A=r*s,h=0;h!==s;++h)t[A+h]=t[o+h];++r}return r!==e.length?(this.times=e.slice(0,r),this.values=t.slice(0,r*s)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),s=this.constructor,i=new s(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}ze.prototype.TimeBufferType=Float32Array,ze.prototype.ValueBufferType=Float32Array,ze.prototype.DefaultInterpolation=fs;class Xt extends ze{constructor(e,t,s){super(e,t,s)}}Xt.prototype.ValueTypeName="bool",Xt.prototype.ValueBufferType=Array,Xt.prototype.DefaultInterpolation=ps,Xt.prototype.InterpolantFactoryMethodLinear=void 0,Xt.prototype.InterpolantFactoryMethodSmooth=void 0;class _o extends ze{}_o.prototype.ValueTypeName="color";class Zt extends ze{}Zt.prototype.ValueTypeName="number";class xh extends Ss{constructor(e,t,s,i){super(e,t,s,i)}interpolate_(e,t,s,i){const n=this.resultBuffer,r=this.sampleValues,o=this.valueSize,A=(s-t)/(i-t);let h=e*o;for(let c=h+o;h!==c;h+=4)ot.slerpFlat(n,0,r,h-o,r,h,A);return n}}class $t extends ze{InterpolantFactoryMethodLinear(e){return new xh(this.times,this.values,this.getValueSize(),e)}}$t.prototype.ValueTypeName="quaternion",$t.prototype.InterpolantFactoryMethodSmooth=void 0;class es extends ze{constructor(e,t,s){super(e,t,s)}}es.prototype.ValueTypeName="string",es.prototype.ValueBufferType=Array,es.prototype.DefaultInterpolation=ps,es.prototype.InterpolantFactoryMethodLinear=void 0,es.prototype.InterpolantFactoryMethodSmooth=void 0;class ts extends ze{}ts.prototype.ValueTypeName="vector";class Qh{constructor(e="",t=-1,s=[],i=EA){this.name=e,this.tracks=s,this.duration=t,this.blendMode=i,this.uuid=Ne(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],s=e.tracks,i=1/(e.fps||1);for(let r=0,o=s.length;r!==o;++r)t.push(Th(s[r]).scale(i));const n=new this(e.name,e.duration,t,e.blendMode);return n.uuid=e.uuid,n}static toJSON(e){const t=[],s=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let n=0,r=s.length;n!==r;++n)t.push(ze.toJSON(s[n]));return i}static CreateFromMorphTargetSequence(e,t,s,i){const n=t.length,r=[];for(let o=0;o<n;o++){let A=[],h=[];A.push((o+n-1)%n,o,(o+1)%n),h.push(0,1,0);const c=yh(A);A=Do(A,1,c),h=Do(h,1,c),!i&&A[0]===0&&(A.push(n),h.push(h[0])),r.push(new Zt(".morphTargetInfluences["+t[o].name+"]",A,h).scale(1/s))}return new this(e,-1,r)}static findByName(e,t){let s=e;if(!Array.isArray(e)){const i=e;s=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<s.length;i++)if(s[i].name===t)return s[i];return null}static CreateClipsFromMorphTargetSequences(e,t,s){const i={},n=/^([\w-]*?)([\d]+)$/;for(let o=0,A=e.length;o<A;o++){const h=e[o],c=h.name.match(n);if(c&&c.length>1){const l=c[1];let u=i[l];u||(i[l]=u=[]),u.push(h)}}const r=[];for(const o in i)r.push(this.CreateFromMorphTargetSequence(o,i[o],t,s));return r}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const s=function(l,u,d,g,p){if(d.length!==0){const f=[],m=[];ko(d,f,m,g),f.length!==0&&p.push(new l(u,f,m))}},i=[],n=e.name||"default",r=e.fps||30,o=e.blendMode;let A=e.length||-1;const h=e.hierarchy||[];for(let l=0;l<h.length;l++){const u=h[l].keys;if(!(!u||u.length===0))if(u[0].morphTargets){const d={};let g;for(g=0;g<u.length;g++)if(u[g].morphTargets)for(let p=0;p<u[g].morphTargets.length;p++)d[u[g].morphTargets[p]]=-1;for(const p in d){const f=[],m=[];for(let y=0;y!==u[g].morphTargets.length;++y){const C=u[g];f.push(C.time),m.push(C.morphTarget===p?1:0)}i.push(new Zt(".morphTargetInfluence["+p+"]",f,m))}A=d.length*r}else{const d=".bones["+t[l].name+"]";s(ts,d+".position",u,"pos",i),s($t,d+".quaternion",u,"rot",i),s(ts,d+".scale",u,"scl",i)}}return i.length===0?null:new this(n,A,i,o)}resetDuration(){const e=this.tracks;let t=0;for(let s=0,i=e.length;s!==i;++s){const n=this.tracks[s];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function wh(a){switch(a.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Zt;case"vector":case"vector2":case"vector3":case"vector4":return ts;case"color":return _o;case"quaternion":return $t;case"bool":case"boolean":return Xt;case"string":return es}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+a)}function Th(a){if(a.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=wh(a.type);if(a.times===void 0){const t=[],s=[];ko(a.keys,t,s,"value"),a.times=t,a.values=s}return e.parse!==void 0?e.parse(a):new e(a.name,a.times,a.values,a.interpolation)}const dt={enabled:!1,files:{},add:function(a,e){this.enabled!==!1&&(this.files[a]=e)},get:function(a){if(this.enabled!==!1)return this.files[a]},remove:function(a){delete this.files[a]},clear:function(){this.files={}}};class Sh{constructor(e,t,s){const i=this;let n=!1,r=0,o=0,A;const h=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=s,this.itemStart=function(c){o++,n===!1&&i.onStart!==void 0&&i.onStart(c,r,o),n=!0},this.itemEnd=function(c){r++,i.onProgress!==void 0&&i.onProgress(c,r,o),r===o&&(n=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(c){i.onError!==void 0&&i.onError(c)},this.resolveURL=function(c){return A?A(c):c},this.setURLModifier=function(c){return A=c,this},this.addHandler=function(c,l){return h.push(c,l),this},this.removeHandler=function(c){const l=h.indexOf(c);return l!==-1&&h.splice(l,2),this},this.getHandler=function(c){for(let l=0,u=h.length;l<u;l+=2){const d=h[l],g=h[l+1];if(d.global&&(d.lastIndex=0),d.test(c))return g}return null}}}const Mh=new Sh;class gt{constructor(e){this.manager=e!==void 0?e:Mh,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const s=this;return new Promise(function(i,n){s.load(e,i,t,n)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}gt.DEFAULT_MATERIAL_NAME="__DEFAULT";const $e={};class Nh extends Error{constructor(e,t){super(e),this.response=t}}class wt extends gt{constructor(e){super(e)}load(e,t,s,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const n=dt.get(e);if(n!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(n),this.manager.itemEnd(e)},0),n;if($e[e]!==void 0){$e[e].push({onLoad:t,onProgress:s,onError:i});return}$e[e]=[],$e[e].push({onLoad:t,onProgress:s,onError:i});const r=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,A=this.responseType;fetch(r).then(h=>{if(h.status===200||h.status===0){if(h.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||h.body===void 0||h.body.getReader===void 0)return h;const c=$e[e],l=h.body.getReader(),u=h.headers.get("X-File-Size")||h.headers.get("Content-Length"),d=u?parseInt(u):0,g=d!==0;let p=0;const f=new ReadableStream({start(m){y();function y(){l.read().then(({done:C,value:E})=>{if(C)m.close();else{p+=E.byteLength;const w=new ProgressEvent("progress",{lengthComputable:g,loaded:p,total:d});for(let S=0,M=c.length;S<M;S++){const R=c[S];R.onProgress&&R.onProgress(w)}m.enqueue(E),y()}},C=>{m.error(C)})}}});return new Response(f)}else throw new Nh(`fetch for "${h.url}" responded with ${h.status}: ${h.statusText}`,h)}).then(h=>{switch(A){case"arraybuffer":return h.arrayBuffer();case"blob":return h.blob();case"document":return h.text().then(c=>new DOMParser().parseFromString(c,o));case"json":return h.json();default:if(o===void 0)return h.text();{const l=/charset="?([^;"\s]*)"?/i.exec(o),u=l&&l[1]?l[1].toLowerCase():void 0,d=new TextDecoder(u);return h.arrayBuffer().then(g=>d.decode(g))}}}).then(h=>{dt.add(e,h);const c=$e[e];delete $e[e];for(let l=0,u=c.length;l<u;l++){const d=c[l];d.onLoad&&d.onLoad(h)}}).catch(h=>{const c=$e[e];if(c===void 0)throw this.manager.itemError(e),h;delete $e[e];for(let l=0,u=c.length;l<u;l++){const d=c[l];d.onError&&d.onError(h)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class Rh extends gt{constructor(e){super(e)}load(e,t,s,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const n=this,r=dt.get(e);if(r!==void 0)return n.manager.itemStart(e),setTimeout(function(){t&&t(r),n.manager.itemEnd(e)},0),r;const o=en("img");function A(){c(),dt.add(e,this),t&&t(this),n.manager.itemEnd(e)}function h(l){c(),i&&i(l),n.manager.itemError(e),n.manager.itemEnd(e)}function c(){o.removeEventListener("load",A,!1),o.removeEventListener("error",h,!1)}return o.addEventListener("load",A,!1),o.addEventListener("error",h,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),n.manager.itemStart(e),o.src=e,o}}class Fh extends gt{constructor(e){super(e)}load(e,t,s,i){const n=new le,r=new Rh(this.manager);return r.setCrossOrigin(this.crossOrigin),r.setPath(this.path),r.load(e,function(o){n.image=o,n.needsUpdate=!0,t!==void 0&&t(n)},s,i),n}}class kn extends Y{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new X(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}const _n=new _,Lo=new b,vo=new b;class Ln{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new q(512,512),this.map=null,this.mapPass=null,this.matrix=new _,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ah,this._frameExtents=new q(1,1),this._viewportCount=1,this._viewports=[new K(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,s=this.matrix;Lo.setFromMatrixPosition(e.matrixWorld),t.position.copy(Lo),vo.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(vo),t.updateMatrixWorld(),_n.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_n),s.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),s.multiply(_n)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class Dh extends Ln{constructor(){super(new Cn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,s=Is*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,n=e.distance||t.far;(s!==t.fov||i!==t.aspect||n!==t.far)&&(t.fov=s,t.aspect=i,t.far=n,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class kh extends kn{constructor(e,t,s=0,i=Math.PI/3,n=0,r=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Y.DEFAULT_UP),this.updateMatrix(),this.target=new Y,this.distance=s,this.angle=i,this.penumbra=n,this.decay=r,this.map=null,this.shadow=new Dh}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const Go=new _,Ms=new b,vn=new b;class _h extends Ln{constructor(){super(new Cn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new q(4,2),this._viewportCount=6,this._viewports=[new K(2,1,1,1),new K(0,1,1,1),new K(3,1,1,1),new K(1,1,1,1),new K(3,0,1,1),new K(1,0,1,1)],this._cubeDirections=[new b(1,0,0),new b(-1,0,0),new b(0,0,1),new b(0,0,-1),new b(0,1,0),new b(0,-1,0)],this._cubeUps=[new b(0,1,0),new b(0,1,0),new b(0,1,0),new b(0,1,0),new b(0,0,1),new b(0,0,-1)]}updateMatrices(e,t=0){const s=this.camera,i=this.matrix,n=e.distance||s.far;n!==s.far&&(s.far=n,s.updateProjectionMatrix()),Ms.setFromMatrixPosition(e.matrixWorld),s.position.copy(Ms),vn.copy(s.position),vn.add(this._cubeDirections[t]),s.up.copy(this._cubeUps[t]),s.lookAt(vn),s.updateMatrixWorld(),i.makeTranslation(-Ms.x,-Ms.y,-Ms.z),Go.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Go)}}class Lh extends kn{constructor(e,t,s=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=s,this.decay=i,this.shadow=new _h}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class vh extends Ln{constructor(){super(new uo(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Gh extends kn{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Y.DEFAULT_UP),this.updateMatrix(),this.target=new Y,this.shadow=new vh}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Ns{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let s=0,i=e.length;s<i;s++)t+=String.fromCharCode(e[s]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Oh extends gt{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,s,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const n=this,r=dt.get(e);if(r!==void 0){if(n.manager.itemStart(e),r.then){r.then(h=>{t&&t(h),n.manager.itemEnd(e)}).catch(h=>{i&&i(h)});return}return setTimeout(function(){t&&t(r),n.manager.itemEnd(e)},0),r}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader;const A=fetch(e,o).then(function(h){return h.blob()}).then(function(h){return createImageBitmap(h,Object.assign(n.options,{colorSpaceConversion:"none"}))}).then(function(h){return dt.add(e,h),t&&t(h),n.manager.itemEnd(e),h}).catch(function(h){i&&i(h),dt.remove(e),n.manager.itemError(e),n.manager.itemEnd(e)});dt.add(e,A),n.manager.itemStart(e)}}const Gn="\\[\\]\\.:\\/",Uh=new RegExp("["+Gn+"]","g"),On="[^"+Gn+"]",zh="[^"+Gn.replace("\\.","")+"]",Ph=/((?:WC+[\/:])*)/.source.replace("WC",On),Hh=/(WCOD+)?/.source.replace("WCOD",zh),qh=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",On),Vh=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",On),jh=new RegExp("^"+Ph+Hh+qh+Vh+"$"),Jh=["material","materials","bones","map"];class Wh{constructor(e,t,s){const i=s||P.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const s=this._targetGroup.nCachedObjects_,i=this._bindings[s];i!==void 0&&i.getValue(e,t)}setValue(e,t){const s=this._bindings;for(let i=this._targetGroup.nCachedObjects_,n=s.length;i!==n;++i)s[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,s=e.length;t!==s;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,s=e.length;t!==s;++t)e[t].unbind()}}class P{constructor(e,t,s){this.path=t,this.parsedPath=s||P.parseTrackName(t),this.node=P.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,s){return e&&e.isAnimationObjectGroup?new P.Composite(e,t,s):new P(e,t,s)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Uh,"")}static parseTrackName(e){const t=jh.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const s={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=s.nodeName&&s.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const n=s.nodeName.substring(i+1);Jh.indexOf(n)!==-1&&(s.nodeName=s.nodeName.substring(0,i),s.objectName=n)}if(s.propertyName===null||s.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return s}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const s=e.skeleton.getBoneByName(t);if(s!==void 0)return s}if(e.children){const s=function(n,r){for(let o=0;o<n.length;o++){const A=n[o];if(!r&&(A.name===t||A.uuid===t))return A;if(r&&A.userData&&A.userData.name===t)return A;const h=s(A.children,r);if(h)return h}return null},i=s(e.children);if(i)return i;{const n=s(e.children,!0);if(n)return n}}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const s=this.resolvedProperty;for(let i=0,n=s.length;i!==n;++i)e[t++]=s[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const s=this.resolvedProperty;for(let i=0,n=s.length;i!==n;++i)s[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const s=this.resolvedProperty;for(let i=0,n=s.length;i!==n;++i)s[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const s=this.resolvedProperty;for(let i=0,n=s.length;i!==n;++i)s[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,s=t.objectName,i=t.propertyName;let n=t.propertyIndex;if(e||(e=P.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(s){let h=t.objectIndex;switch(s){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let c=0;c<e.length;c++)if(e[c].name===h){h=c;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[s]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[s]}if(h!==void 0){if(e[h]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[h]}}const r=e[i];if(r===void 0){const h=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?o=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let A=this.BindingType.Direct;if(n!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[n]!==void 0&&(n=e.morphTargetDictionary[n])}A=this.BindingType.ArrayElement,this.resolvedProperty=r,this.propertyIndex=n}else r.fromArray!==void 0&&r.toArray!==void 0?(A=this.BindingType.HasFromToArray,this.resolvedProperty=r):Array.isArray(r)?(A=this.BindingType.EntireArray,this.resolvedProperty=r):this.propertyName=i;this.getValue=this.GetterByBindingType[A],this.setValue=this.SetterByBindingTypeAndVersioning[A][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}P.Composite=Wh,P.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},P.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},P.prototype.GetterByBindingType=[P.prototype._getValue_direct,P.prototype._getValue_array,P.prototype._getValue_arrayElement,P.prototype._getValue_toArray],P.prototype.SetterByBindingTypeAndVersioning=[[P.prototype._setValue_direct,P.prototype._setValue_direct_setNeedsUpdate,P.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[P.prototype._setValue_array,P.prototype._setValue_array_setNeedsUpdate,P.prototype._setValue_array_setMatrixWorldNeedsUpdate],[P.prototype._setValue_arrayElement,P.prototype._setValue_arrayElement_setNeedsUpdate,P.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[P.prototype._setValue_fromArray,P.prototype._setValue_fromArray_setNeedsUpdate,P.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];function Un(a,e=0){let t=3735928559^e,s=1103547991^e;if(a instanceof Array)for(let i=0,n;i<a.length;i++)n=a[i],t=Math.imul(t^n,2654435761),s=Math.imul(s^n,1597334677);else for(let i=0,n;i<a.length;i++)n=a.charCodeAt(i),t=Math.imul(t^n,2654435761),s=Math.imul(s^n,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(s^s>>>13,3266489909),s=Math.imul(s^s>>>16,2246822507),s^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&s)+(t>>>0)}const Kh=(...a)=>Un(a);function Yh(a,e=!1){const t=[];a.isNode===!0&&(t.push(a.id),a=a.getSelf());for(const{property:s,childNode:i}of zn(a))t.push(t,Un(s.slice(0,-4)),i.getCacheKey(e));return Un(t)}function*zn(a,e=!1){for(const t in a){if(t.startsWith("_")===!0)continue;const s=a[t];if(Array.isArray(s)===!0)for(let i=0;i<s.length;i++){const n=s[i];n&&(n.isNode===!0||e&&typeof n.toJSON=="function")&&(yield{property:t,index:i,childNode:n})}else if(s&&s.isNode===!0)yield{property:t,childNode:s};else if(typeof s=="object")for(const i in s){const n=s[i];n&&(n.isNode===!0||e&&typeof n.toJSON=="function")&&(yield{property:t,index:i,childNode:n})}}}function wi(a){if(a==null)return null;const e=typeof a;return a.isNode===!0?"node":e==="number"?"float":e==="boolean"?"bool":e==="string"?"string":e==="function"?"shader":a.isVector2===!0?"vec2":a.isVector3===!0?"vec3":a.isVector4===!0?"vec4":a.isMatrix3===!0?"mat3":a.isMatrix4===!0?"mat4":a.isColor===!0?"color":a instanceof ArrayBuffer?"ArrayBuffer":null}function Oo(a,...e){const t=a?a.slice(-4):void 0;return e.length===1&&(t==="vec2"?e=[e[0],e[0]]:t==="vec3"?e=[e[0],e[0],e[0]]:t==="vec4"&&(e=[e[0],e[0],e[0],e[0]])),a==="color"?new X(...e):t==="vec2"?new q(...e):t==="vec3"?new b(...e):t==="vec4"?new K(...e):t==="mat3"?new Fe(...e):t==="mat4"?new _(...e):a==="bool"?e[0]||!1:a==="float"||a==="int"||a==="uint"?e[0]||0:a==="string"?e[0]||"":a==="ArrayBuffer"?Zh(e[0]):null}function Xh(a){let e="";const t=new Uint8Array(a);for(let s=0;s<t.length;s++)e+=String.fromCharCode(t[s]);return btoa(e)}function Zh(a){return Uint8Array.from(atob(a),e=>e.charCodeAt(0)).buffer}const Uo={VERTEX:"vertex"},$={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},Rs=["x","y","z","w"];let $h=0;class L extends Lt{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=$.NONE,this.updateBeforeType=$.NONE,this.updateAfterType=$.NONE,this.uuid=Vr.generateUUID(),this.version=0,this._cacheKey=null,this._cacheKeyVersion=0,this.global=!1,this.isNode=!0,Object.defineProperty(this,"id",{value:$h++})}set needsUpdate(e){e===!0&&this.version++}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this.getSelf()),this}onFrameUpdate(e){return this.onUpdate(e,$.FRAME)}onRenderUpdate(e){return this.onUpdate(e,$.RENDER)}onObjectUpdate(e){return this.onUpdate(e,$.OBJECT)}onReference(e){return this.updateReference=e.bind(this.getSelf()),this}getSelf(){return this.self||this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of zn(this))yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(const t of this.getChildren())t.traverse(e)}getCacheKey(e=!1){return e=e||this.version!==this._cacheKeyVersion,(e===!0||this._cacheKey===null)&&(this._cacheKey=Yh(this,e),this._cacheKeyVersion=this.version),this._cacheKey}getScope(){return this}getHash(){return this.uuid}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){const t=this.getNodeType(e);return e.getElementType(t)}getNodeType(e){const t=e.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(e):this.nodeType}getShared(e){const t=this.getHash(e);return e.getNodeFromHash(t)||this}setup(e){const t=e.getNodeProperties(this);let s=0;for(const i of this.getChildren())t["node"+s++]=i;return null}analyze(e){if(e.increaseUsage(this)===1){const s=e.getNodeProperties(this);for(const i of Object.values(s))i&&i.isNode===!0&&i.build(e)}}generate(e,t){const{outputNode:s}=e.getNodeProperties(this);if(s&&s.isNode===!0)return s.build(e,t)}updateBefore(){console.warn("Abstract function.")}updateAfter(){console.warn("Abstract function.")}update(){console.warn("Abstract function.")}build(e,t=null){const s=this.getShared(e);if(this!==s)return s.build(e,t);e.addNode(this),e.addChain(this);let i=null;const n=e.getBuildStage();if(n==="setup"){this.updateReference(e);const r=e.getNodeProperties(this);if(r.initialized!==!0){const o=e.stack.nodes.length;r.initialized=!0,r.outputNode=this.setup(e),r.outputNode!==null&&e.stack.nodes.length;for(const A of Object.values(r))A&&A.isNode===!0&&A.build(e)}}else if(n==="analyze")this.analyze(e);else if(n==="generate")if(this.generate.length===1){const o=this.getNodeType(e),A=e.getDataFromNode(this);i=A.snippet,i===void 0?(i=this.generate(e)||"",A.snippet=i):A.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),i=e.format(i,o,t)}else i=this.generate(e,t)||"";return e.removeChain(this),i}getSerializeChildren(){return zn(this)}serialize(e){const t=this.getSerializeChildren(),s={};for(const{property:i,index:n,childNode:r}of t)n!==void 0?(s[i]===void 0&&(s[i]=Number.isInteger(n)?[]:{}),s[i][n]=r.toJSON(e.meta).uuid):s[i]=r.toJSON(e.meta).uuid;Object.keys(s).length>0&&(e.inputNodes=s)}deserialize(e){if(e.inputNodes!==void 0){const t=e.meta.nodes;for(const s in e.inputNodes)if(Array.isArray(e.inputNodes[s])){const i=[];for(const n of e.inputNodes[s])i.push(t[n]);this[s]=i}else if(typeof e.inputNodes[s]=="object"){const i={};for(const n in e.inputNodes[s]){const r=e.inputNodes[s][n];i[n]=t[r]}this[s]=i}else{const i=e.inputNodes[s];this[s]=t[i]}}}toJSON(e){const{uuid:t,type:s}=this,i=e===void 0||typeof e=="string";i&&(e={textures:{},images:{},nodes:{}});let n=e.nodes[t];n===void 0&&(n={uuid:t,type:s,meta:e,metadata:{version:4.6,type:"Node",generator:"Node.toJSON"}},i!==!0&&(e.nodes[n.uuid]=n),this.serialize(n),delete n.meta);function r(o){const A=[];for(const h in o){const c=o[h];delete c.metadata,A.push(c)}return A}if(i){const o=r(e.textures),A=r(e.images),h=r(e.nodes);o.length>0&&(n.textures=o),A.length>0&&(n.images=A),h.length>0&&(n.nodes=h)}return n}}class Fs extends L{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(e){return this.node.getElementType(e)}generate(e){const t=this.node.build(e),s=this.indexNode.build(e,"uint");return`${t}[ ${s} ]`}}class zo extends L{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(e){const t=this.node.getNodeType(e);let s=null;for(const i of this.convertTo.split("|"))(s===null||e.getTypeLength(t)===e.getTypeLength(i))&&(s=i);return s}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){const s=this.node,i=this.getNodeType(e),n=s.build(e,i);return e.format(n,i,t)}}class fe extends L{static get type(){return"TempNode"}constructor(e){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){const i=e.getVectorType(this.getNodeType(e,t)),n=e.getDataFromNode(this);if(n.propertyName!==void 0)return e.format(n.propertyName,i,t);if(i!=="void"&&t!=="void"&&this.hasDependencies(e)){const r=super.build(e,i),o=e.getVarFromNode(this,null,i),A=e.getPropertyName(o);return e.addLineFlowCode(`${A} = ${r}`,this),n.snippet=r,n.propertyName=A,e.format(n.propertyName,i,t)}}return super.build(e,t)}}class ec extends fe{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}getNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,s)=>t+e.getTypeLength(s.getNodeType(e)),0))}generate(e,t){const s=this.getNodeType(e),i=this.nodes,n=e.getComponentType(s),r=[];for(const A of i){let h=A.build(e);const c=e.getComponentType(A.getNodeType(e));c!==n&&(h=e.format(h,c,n)),r.push(h)}const o=`${e.getType(s)}( ${r.join(", ")} )`;return e.format(o,s,t)}}const tc=Rs.join("");class Po extends L{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(const t of this.components)e=Math.max(Rs.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}getNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}generate(e,t){const s=this.node,i=e.getTypeLength(s.getNodeType(e));let n=null;if(i>1){let r=null;this.getVectorLength()>=i&&(r=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const A=s.build(e,r);this.components.length===i&&this.components===tc.slice(0,this.components.length)?n=e.format(A,r,t):n=e.format(`${A}.${this.components}`,this.getNodeType(e),t)}else n=s.build(e,t);return n}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class sc extends fe{static get type(){return"SetNode"}constructor(e,t,s){super(),this.sourceNode=e,this.components=t,this.targetNode=s}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{sourceNode:t,components:s,targetNode:i}=this,n=this.getNodeType(e),r=e.getTypeFromLength(s.length,i.getNodeType(e)),o=i.build(e,r),A=t.build(e,n),h=e.getTypeLength(n),c=[];for(let l=0;l<h;l++){const u=Rs[l];u===s[0]?(c.push(o),l+=s.length-1):c.push(A+"."+u)}return`${e.getType(n)}( ${c.join(", ")} )`}}class ic extends fe{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{components:t,sourceNode:s}=this,i=this.getNodeType(e),n=s.build(e),r=e.getVarFromNode(this),o=e.getPropertyName(r);e.addLineFlowCode(o+" = "+n,this);const A=e.getTypeLength(i),h=[];let c=0;for(let l=0;l<A;l++){const u=Rs[l];u===t[c]?(h.push("1.0 - "+(o+"."+u)),c++):h.push(o+"."+u)}return`${e.getType(i)}( ${h.join(", ")} )`}}class Pn extends L{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}getNodeType(){return this.nodeType===null?wi(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=wi(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=Xh(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?Oo(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){console.warn("Abstract function.")}}class et extends Pn{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){const s=this.getNodeType(e);return e.format(this.generateConst(e),s,t)}}let Ho=null;const ss=new Map;function x(a,e){if(ss.has(a)){console.warn(`Redefinition of method chaining ${a}`);return}if(typeof e!="function")throw new Error(`Node element ${a} is not a function`);ss.set(a,e)}const qo=a=>a.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),Vo=a=>qo(a).split("").sort().join(""),jo={setup(a,e){const t=e.shift();return a(Mi(t),...e)},get(a,e,t){if(typeof e=="string"&&a[e]===void 0){if(a.isStackNode!==!0&&e==="assign")return(...s)=>(Ho.assign(t,...s),t);if(ss.has(e)){const s=ss.get(e);return a.isStackNode?(...i)=>t.add(s(...i)):(...i)=>s(t,...i)}else{if(e==="self")return a;if(e.endsWith("Assign")&&ss.has(e.slice(0,e.length-6))){const s=ss.get(e.slice(0,e.length-6));return a.isStackNode?(...i)=>t.assign(i[0],s(...i)):(...i)=>t.assign(s(t,...i))}else{if(/^[xyzwrgbastpq]{1,4}$/.test(e)===!0)return e=qo(e),T(new Po(t,e));if(/^set[XYZWRGBASTPQ]{1,4}$/.test(e)===!0)return e=Vo(e.slice(3).toLowerCase()),s=>T(new sc(a,e,s));if(/^flip[XYZWRGBASTPQ]{1,4}$/.test(e)===!0)return e=Vo(e.slice(4).toLowerCase()),()=>T(new ic(T(a),e));if(e==="width"||e==="height"||e==="depth")return e==="width"?e="x":e==="height"?e="y":e==="depth"&&(e="z"),T(new Po(a,e));if(/^\d+$/.test(e)===!0)return T(new Fs(t,new et(Number(e),"uint")))}}}return Reflect.get(a,e,t)},set(a,e,t,s){return typeof e=="string"&&a[e]===void 0&&(/^[xyzwrgbastpq]{1,4}$/.test(e)===!0||e==="width"||e==="height"||e==="depth"||/^\d+$/.test(e)===!0)?(s[e].assign(t),!0):Reflect.set(a,e,t,s)}},Hn=new WeakMap,Jo=new WeakMap,nc=function(a,e=null){const t=wi(a);if(t==="node"){let s=Hn.get(a);return s===void 0&&(s=new Proxy(a,jo),Hn.set(a,s),Hn.set(s,s)),s}else{if(e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string")return T(Jn(a,e));if(t==="shader")return te(a)}return a},rc=function(a,e=null){for(const t in a)a[t]=T(a[t],e);return a},oc=function(a,e=null){const t=a.length;for(let s=0;s<t;s++)a[s]=T(a[s],e);return a},ac=function(a,e=null,t=null,s=null){const i=n=>T(s!==null?Object.assign(n,s):n);return e===null?(...n)=>i(new a(...is(n))):t!==null?(t=T(t),(...n)=>i(new a(e,...is(n),t))):(...n)=>i(new a(e,...is(n)))},Ac=function(a,...e){return T(new a(...is(e)))};class hc extends L{constructor(e,t){super(),this.shaderNode=e,this.inputNodes=t}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}call(e){const{shaderNode:t,inputNodes:s}=this,i=e.getNodeProperties(t);if(i.onceOutput)return i.onceOutput;let n=null;if(t.layout){let r=Jo.get(e.constructor);r===void 0&&(r=new WeakMap,Jo.set(e.constructor,r));let o=r.get(t);o===void 0&&(o=T(e.buildFunctionNode(t)),r.set(t,o)),e.currentFunctionNode!==null&&e.currentFunctionNode.includes.push(o),n=T(o.call(s))}else{const r=t.jsFunc,o=s!==null?r(s,e):r(e);n=T(o)}return t.once&&(i.onceOutput=n),n}getOutputNode(e){const t=e.getNodeProperties(this);return t.outputNode===null&&(t.outputNode=this.setupOutput(e)),t.outputNode}setup(e){return this.getOutputNode(e)}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}generate(e,t){return this.getOutputNode(e).build(e,t)}}class cc extends L{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}call(e=null){return Mi(e),T(new hc(this,e))}setup(){return this.call()}}const lc=[!1,!0],uc=[0,1,2,3],dc=[-1,-2],Wo=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],qn=new Map;for(const a of lc)qn.set(a,new et(a));const Vn=new Map;for(const a of uc)Vn.set(a,new et(a,"uint"));const jn=new Map([...Vn].map(a=>new et(a.value,"int")));for(const a of dc)jn.set(a,new et(a,"int"));const Ti=new Map([...jn].map(a=>new et(a.value)));for(const a of Wo)Ti.set(a,new et(a));for(const a of Wo)Ti.set(-a,new et(-a));const Si={bool:qn,uint:Vn,ints:jn,float:Ti},Ko=new Map([...qn,...Ti]),Jn=(a,e)=>Ko.has(a)?Ko.get(a):a.isNode===!0?a:new et(a,e),gc=a=>{try{return a.getNodeType()}catch{return}},ee=function(a,e=null){return(...t)=>{if((t.length===0||!["bool","float","int","uint"].includes(a)&&t.every(i=>typeof i!="object"))&&(t=[Oo(a,...t)]),t.length===1&&e!==null&&e.has(t[0]))return T(e.get(t[0]));if(t.length===1){const i=Jn(t[0],a);return gc(i)===a?T(i):T(new zo(i,a))}const s=t.map(i=>Jn(i));return T(new ec(s,a))}},pc=a=>a!=null?a.nodeType||a.convertTo||(typeof a=="string"?a:null):null;function fc(a,e){return new Proxy(new cc(a,e),jo)}const T=(a,e=null)=>nc(a,e),Mi=(a,e=null)=>new rc(a,e),is=(a,e=null)=>new oc(a,e),Q=(...a)=>new ac(...a),N=(...a)=>new Ac(...a),te=(a,e)=>{const t=new fc(a,e),s=(...i)=>{let n;return Mi(i),i[0]&&i[0].isNode?n=[...i]:n=i[0],t.call(n)};return s.shaderNode=t,s.setLayout=i=>(t.setLayout(i),s),s.once=()=>(t.once=!0,s),s};x("toGlobal",a=>(a.global=!0,a));const Wn=(...a)=>Ho.If(...a);function mc(a){return a}x("append",mc);const Ic=new ee("color"),U=new ee("float",Si.float),ns=new ee("int",Si.ints),bc=new ee("uint",Si.uint),yc=new ee("bool",Si.bool),F=new ee("vec2"),Ec=new ee("ivec2"),Cc=new ee("uvec2"),Bc=new ee("bvec2"),v=new ee("vec3"),xc=new ee("ivec3"),Qc=new ee("uvec3"),wc=new ee("bvec3"),rs=new ee("vec4"),Tc=new ee("ivec4"),Sc=new ee("uvec4"),Mc=new ee("bvec4"),Yo=new ee("mat2"),Ni=new ee("mat3"),Nc=new ee("mat4");x("toColor",Ic),x("toFloat",U),x("toInt",ns),x("toUint",bc),x("toBool",yc),x("toVec2",F),x("toIVec2",Ec),x("toUVec2",Cc),x("toBVec2",Bc),x("toVec3",v),x("toIVec3",xc),x("toUVec3",Qc),x("toBVec3",wc),x("toVec4",rs),x("toIVec4",Tc),x("toUVec4",Sc),x("toBVec4",Mc),x("toMat2",Yo),x("toMat3",Ni),x("toMat4",Nc);const Rc=Q(Fs),Fc=(a,e)=>T(new zo(T(a),e));x("element",Rc),x("convert",Fc);class Xo extends L{static get type(){return"UniformGroupNode"}constructor(e,t=!1,s=1){super("string"),this.name=e,this.version=0,this.shared=t,this.order=s,this.isUniformGroup=!0}set needsUpdate(e){e===!0&&this.version++}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}}const Dc=a=>new Xo(a),Tt=((a,e=0)=>new Xo(a,!0,e))("render"),kc=Dc("object");class os extends Pn{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=kc}label(e){return this.name=e,this}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){const s=this.getSelf();return e=e.bind(s),super.onUpdate(i=>{const n=e(i,s);n!==void 0&&(this.value=n)},t)}generate(e,t){const s=this.getNodeType(e),i=this.getUniformHash(e);let n=e.getNodeFromHash(i);n===void 0&&(e.setHashNode(this,i),n=this);const r=n.getInputType(e),o=e.getUniformFromNode(n,r,e.shaderStage,this.name||e.context.label),A=e.getPropertyName(o);return e.context.label!==void 0&&delete e.context.label,e.format(A,s,t)}}const Ce=(a,e)=>{const t=pc(e||a),s=a&&a.isNode===!0?a.node&&a.node.value||a.value:a;return T(new os(s,t))};class Zo extends L{static get type(){return"PropertyNode"}constructor(e,t=null,s=!1){super(e),this.name=t,this.varying=s,this.isPropertyNode=!0}getHash(e){return this.name||super.getHash(e)}isGlobal(){return!0}generate(e){let t;return this.varying===!0?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}}const as=(a,e)=>T(new Zo(a,e)),$o=N(Zo,"vec4","DiffuseColor");class _c extends fe{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t}hasDependencies(){return!1}getNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){const{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){const s=e.getTypeLength(t.node.getNodeType(e));return Rs.join("").slice(0,s)!==t.components}return!1}generate(e,t){const{targetNode:s,sourceNode:i}=this,n=this.needsSplitAssign(e),r=s.getNodeType(e),o=s.context({assign:!0}).build(e),A=i.build(e,r),h=i.getNodeType(e),c=e.getDataFromNode(this);let l;if(c.initialized===!0)t!=="void"&&(l=o);else if(n){const u=e.getVarFromNode(this,null,r),d=e.getPropertyName(u);e.addLineFlowCode(`${d} = ${A}`,this);const g=s.node.context({assign:!0}).build(e);for(let p=0;p<s.components.length;p++){const f=s.components[p];e.addLineFlowCode(`${g}.${f} = ${d}[ ${p} ]`,this)}t!=="void"&&(l=o)}else l=`${o} = ${A}`,(t==="void"||h==="void")&&(e.addLineFlowCode(l,this),t!=="void"&&(l=o));return c.initialized=!0,e.format(l,r,t)}}x("assign",Q(_c));class Lc extends fe{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}getNodeType(e){return this.functionNode.getNodeType(e)}generate(e){const t=[],s=this.functionNode,i=s.getInputs(e),n=this.parameters;if(Array.isArray(n))for(let o=0;o<n.length;o++){const A=i[o],h=n[o];t.push(h.build(e,A.type))}else for(const o of i){const A=n[o.name];if(A!==void 0)t.push(A.build(e,o.type));else throw new Error(`FunctionCallNode: Input '${o.name}' not found in FunctionNode.`)}return`${s.build(e,"property")}( ${t.join(", ")} )`}}x("call",(a,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?is(e):Mi(e[0]),T(new Lc(T(a),e))));class j extends fe{static get type(){return"OperatorNode"}constructor(e,t,s,...i){if(super(),i.length>0){let n=new j(e,t,s);for(let r=0;r<i.length-1;r++)n=new j(e,n,i[r]);t=n,s=i[i.length-1]}this.op=e,this.aNode=t,this.bNode=s}getNodeType(e,t){const s=this.op,i=this.aNode,n=this.bNode,r=i.getNodeType(e),o=typeof n<"u"?n.getNodeType(e):null;if(r==="void"||o==="void")return"void";if(s==="%")return r;if(s==="~"||s==="&"||s==="|"||s==="^"||s===">>"||s==="<<")return e.getIntegerType(r);if(s==="!"||s==="=="||s==="&&"||s==="||"||s==="^^")return"bool";if(s==="<"||s===">"||s==="<="||s===">="){const A=t?e.getTypeLength(t):Math.max(e.getTypeLength(r),e.getTypeLength(o));return A>1?`bvec${A}`:"bool"}else return r==="float"&&e.isMatrix(o)?o:e.isMatrix(r)&&e.isVector(o)?e.getVectorFromMatrix(r):e.isVector(r)&&e.isMatrix(o)?e.getVectorFromMatrix(o):e.getTypeLength(o)>e.getTypeLength(r)?o:r}generate(e,t){const s=this.op,i=this.aNode,n=this.bNode,r=this.getNodeType(e,t);let o=null,A=null;r!=="void"?(o=i.getNodeType(e),A=typeof n<"u"?n.getNodeType(e):null,s==="<"||s===">"||s==="<="||s===">="||s==="=="?e.isVector(o)?A=o:o!==A&&(o=A="float"):s===">>"||s==="<<"?(o=r,A=e.changeComponentType(A,"uint")):e.isMatrix(o)&&e.isVector(A)?A=e.getVectorFromMatrix(o):e.isVector(o)&&e.isMatrix(A)?o=e.getVectorFromMatrix(A):o=A=r):o=A=r;const h=i.build(e,o),c=typeof n<"u"?n.build(e,A):null,l=e.getTypeLength(t),u=e.getFunctionOperator(s);if(t!=="void")return s==="<"&&l>1?e.useComparisonMethod?e.format(`${e.getMethod("lessThan",t)}( ${h}, ${c} )`,r,t):e.format(`( ${h} < ${c} )`,r,t):s==="<="&&l>1?e.useComparisonMethod?e.format(`${e.getMethod("lessThanEqual",t)}( ${h}, ${c} )`,r,t):e.format(`( ${h} <= ${c} )`,r,t):s===">"&&l>1?e.useComparisonMethod?e.format(`${e.getMethod("greaterThan",t)}( ${h}, ${c} )`,r,t):e.format(`( ${h} > ${c} )`,r,t):s===">="&&l>1?e.useComparisonMethod?e.format(`${e.getMethod("greaterThanEqual",t)}( ${h}, ${c} )`,r,t):e.format(`( ${h} >= ${c} )`,r,t):s==="!"||s==="~"?e.format(`(${s}${h})`,o,t):u?e.format(`${u}( ${h}, ${c} )`,r,t):e.format(`( ${h} ${s} ${c} )`,r,t);if(o!=="void")return u?e.format(`${u}( ${h}, ${c} )`,r,t):e.format(`${h} ${s} ${c}`,r,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const St=Q(j,"+"),Ri=Q(j,"-"),Fi=Q(j,"*"),ea=Q(j,"/"),ta=Q(j,"%"),vc=Q(j,"=="),Gc=Q(j,"!="),Oc=Q(j,"<"),Uc=Q(j,">"),zc=Q(j,"<="),Pc=Q(j,">="),Hc=Q(j,"&&"),qc=Q(j,"||"),Vc=Q(j,"!"),jc=Q(j,"^^"),Jc=Q(j,"&"),Wc=Q(j,"~"),Kc=Q(j,"|"),Yc=Q(j,"^"),Xc=Q(j,"<<"),Zc=Q(j,">>");x("add",St),x("sub",Ri),x("mul",Fi),x("div",ea),x("modInt",ta),x("equal",vc),x("notEqual",Gc),x("lessThan",Oc),x("greaterThan",Uc),x("lessThanEqual",zc),x("greaterThanEqual",Pc),x("and",Hc),x("or",qc),x("not",Vc),x("xor",jc),x("bitAnd",Jc),x("bitNot",Wc),x("bitOr",Kc),x("bitXor",Yc),x("shiftLeft",Xc),x("shiftRight",Zc),x("remainder",(...a)=>(console.warn("TSL.OperatorNode: .remainder() has been renamed to .modInt()."),ta(...a)));class I extends fe{static get type(){return"MathNode"}constructor(e,t,s=null,i=null){super(),this.method=e,this.aNode=t,this.bNode=s,this.cNode=i}getInputType(e){const t=this.aNode.getNodeType(e),s=this.bNode?this.bNode.getNodeType(e):null,i=this.cNode?this.cNode.getNodeType(e):null,n=e.isMatrix(t)?0:e.getTypeLength(t),r=e.isMatrix(s)?0:e.getTypeLength(s),o=e.isMatrix(i)?0:e.getTypeLength(i);return n>r&&n>o?t:r>o?s:o>n?i:t}getNodeType(e){const t=this.method;return t===I.LENGTH||t===I.DISTANCE||t===I.DOT?"float":t===I.CROSS?"vec3":t===I.ALL?"bool":t===I.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):t===I.MOD?this.aNode.getNodeType(e):this.getInputType(e)}generate(e,t){const s=this.method,i=this.getNodeType(e),n=this.getInputType(e),r=this.aNode,o=this.bNode,A=this.cNode,h=e.renderer.isWebGLRenderer===!0;if(s===I.TRANSFORM_DIRECTION){let c=r,l=o;e.isMatrix(c.getNodeType(e))?l=rs(v(l),0):c=rs(v(c),0);const u=Fi(c,l).xyz;return sa(u).build(e,t)}else{if(s===I.NEGATE)return e.format("( - "+r.build(e,n)+" )",i,t);if(s===I.ONE_MINUS)return Ri(1,r).build(e,t);if(s===I.RECIPROCAL)return ea(1,r).build(e,t);if(s===I.DIFFERENCE)return Xn(Ri(r,o)).build(e,t);{const c=[];return s===I.CROSS||s===I.MOD?c.push(r.build(e,i),o.build(e,i)):h&&s===I.STEP?c.push(r.build(e,e.getTypeLength(r.getNodeType(e))===1?"float":n),o.build(e,n)):h&&(s===I.MIN||s===I.MAX)||s===I.MOD?c.push(r.build(e,n),o.build(e,e.getTypeLength(o.getNodeType(e))===1?"float":n)):s===I.REFRACT?c.push(r.build(e,n),o.build(e,n),A.build(e,"float")):s===I.MIX?c.push(r.build(e,n),o.build(e,n),A.build(e,e.getTypeLength(A.getNodeType(e))===1?"float":n)):(c.push(r.build(e,n)),o!==null&&c.push(o.build(e,n)),A!==null&&c.push(A.build(e,n))),e.format(`${e.getMethod(s,i)}( ${c.join(", ")} )`,i,t)}}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}I.ALL="all",I.ANY="any",I.EQUALS="equals",I.RADIANS="radians",I.DEGREES="degrees",I.EXP="exp",I.EXP2="exp2",I.LOG="log",I.LOG2="log2",I.SQRT="sqrt",I.INVERSE_SQRT="inversesqrt",I.FLOOR="floor",I.CEIL="ceil",I.NORMALIZE="normalize",I.FRACT="fract",I.SIN="sin",I.COS="cos",I.TAN="tan",I.ASIN="asin",I.ACOS="acos",I.ATAN="atan",I.ABS="abs",I.SIGN="sign",I.LENGTH="length",I.NEGATE="negate",I.ONE_MINUS="oneMinus",I.DFDX="dFdx",I.DFDY="dFdy",I.ROUND="round",I.RECIPROCAL="reciprocal",I.TRUNC="trunc",I.FWIDTH="fwidth",I.BITCAST="bitcast",I.TRANSPOSE="transpose",I.ATAN2="atan2",I.MIN="min",I.MAX="max",I.MOD="mod",I.STEP="step",I.REFLECT="reflect",I.DISTANCE="distance",I.DIFFERENCE="difference",I.DOT="dot",I.CROSS="cross",I.POW="pow",I.TRANSFORM_DIRECTION="transformDirection",I.MIX="mix",I.CLAMP="clamp",I.REFRACT="refract",I.SMOOTHSTEP="smoothstep",I.FACEFORWARD="faceforward";const $c=U(Math.PI),el=Q(I,I.ALL),tl=Q(I,I.ANY),sl=Q(I,I.EQUALS),il=Q(I,I.RADIANS),nl=Q(I,I.DEGREES),rl=Q(I,I.EXP),ol=Q(I,I.EXP2),al=Q(I,I.LOG),Al=Q(I,I.LOG2),Kn=Q(I,I.SQRT),hl=Q(I,I.INVERSE_SQRT),cl=Q(I,I.FLOOR),ll=Q(I,I.CEIL),sa=Q(I,I.NORMALIZE),Yn=Q(I,I.FRACT),ia=Q(I,I.SIN),ul=Q(I,I.COS),dl=Q(I,I.TAN),gl=Q(I,I.ASIN),pl=Q(I,I.ACOS),fl=Q(I,I.ATAN),Xn=Q(I,I.ABS),na=Q(I,I.SIGN),ml=Q(I,I.LENGTH),Il=Q(I,I.NEGATE),bl=Q(I,I.ONE_MINUS),yl=Q(I,I.DFDX),El=Q(I,I.DFDY),Cl=Q(I,I.ROUND),Bl=Q(I,I.RECIPROCAL),xl=Q(I,I.TRUNC),Ql=Q(I,I.FWIDTH);I.BITCAST;const wl=Q(I,I.TRANSPOSE),Tl=Q(I,I.ATAN2),Sl=Q(I,I.MIN),Zn=Q(I,I.MAX),ra=Q(I,I.MOD),oa=Q(I,I.STEP),Ml=Q(I,I.REFLECT),Nl=Q(I,I.DISTANCE),Rl=Q(I,I.DIFFERENCE),$n=Q(I,I.DOT),Fl=Q(I,I.CROSS),aa=Q(I,I.POW),Dl=Q(I,I.POW,2),kl=Q(I,I.POW,3),_l=Q(I,I.POW,4),Ll=Q(I,I.TRANSFORM_DIRECTION),vl=a=>Fi(na(a),aa(Xn(a),1/3)),Gl=a=>$n(a,a),pt=Q(I,I.MIX),Di=(a,e=0,t=1)=>T(new I(I.CLAMP,T(a),T(e),T(t))),Ol=a=>Di(a),Ul=Q(I,I.REFRACT),er=Q(I,I.SMOOTHSTEP),zl=Q(I,I.FACEFORWARD),Pl=te(([a])=>{const s=43758.5453,i=$n(a.xy,F(12.9898,78.233)),n=ra(i,$c);return Yn(ia(n).mul(s))}),Hl=(a,e,t)=>pt(e,t,a),ql=(a,e,t)=>er(e,t,a);x("all",el),x("any",tl),x("equals",sl),x("radians",il),x("degrees",nl),x("exp",rl),x("exp2",ol),x("log",al),x("log2",Al),x("sqrt",Kn),x("inverseSqrt",hl),x("floor",cl),x("ceil",ll),x("normalize",sa),x("fract",Yn),x("sin",ia),x("cos",ul),x("tan",dl),x("asin",gl),x("acos",pl),x("atan",fl),x("abs",Xn),x("sign",na),x("length",ml),x("lengthSq",Gl),x("negate",Il),x("oneMinus",bl),x("dFdx",yl),x("dFdy",El),x("round",Cl),x("reciprocal",Bl),x("trunc",xl),x("fwidth",Ql),x("atan2",Tl),x("min",Sl),x("max",Zn),x("mod",ra),x("step",oa),x("reflect",Ml),x("distance",Nl),x("dot",$n),x("cross",Fl),x("pow",aa),x("pow2",Dl),x("pow3",kl),x("pow4",_l),x("transformDirection",Ll),x("mix",Hl),x("clamp",Di),x("refract",Ul),x("smoothstep",ql),x("faceForward",zl),x("difference",Rl),x("saturate",Ol),x("cbrt",vl),x("transpose",wl),x("rand",Pl);class Vl extends L{static get type(){return"ConditionalNode"}constructor(e,t,s=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=s}getNodeType(e){const t=this.ifNode.getNodeType(e);if(this.elseNode!==null){const s=this.elseNode.getNodeType(e);if(e.getTypeLength(s)>e.getTypeLength(t))return s}return t}setup(e){const t=this.condNode.cache(),s=this.ifNode.cache(),i=this.elseNode?this.elseNode.cache():null,n=e.context.nodeBlock;e.getDataFromNode(s).parentNodeBlock=n,i!==null&&(e.getDataFromNode(i).parentNodeBlock=n);const r=e.getNodeProperties(this);r.condNode=t,r.ifNode=s.context({nodeBlock:s}),r.elseNode=i?i.context({nodeBlock:i}):null}generate(e,t){const s=this.getNodeType(e),i=e.getDataFromNode(this);if(i.nodeProperty!==void 0)return i.nodeProperty;const{condNode:n,ifNode:r,elseNode:o}=e.getNodeProperties(this),A=t!=="void",h=A?as(s).build(e):"";i.nodeProperty=h;const c=n.build(e,"bool");e.addFlowCode(`
6
- ${e.tab}if ( ${c} ) {
7
-
8
- `).addFlowTab();let l=r.build(e,s);if(l&&(A?l=h+" = "+l+";":l="return "+l+";"),e.removeFlowTab().addFlowCode(e.tab+" "+l+`
9
-
10
- `+e.tab+"}"),o!==null){e.addFlowCode(` else {
11
-
12
- `).addFlowTab();let u=o.build(e,s);u&&(A?u=h+" = "+u+";":u="return "+u+";"),e.removeFlowTab().addFlowCode(e.tab+" "+u+`
13
-
14
- `+e.tab+`}
15
-
16
- `)}else e.addFlowCode(`
17
-
18
- `);return e.format(h,s,t)}}const tr=Q(Vl);x("select",tr),x("cond",(...a)=>(console.warn("TSL.ConditionalNode: cond() has been renamed to select()."),tr(...a)));class jl extends L{static get type(){return"ContextNode"}constructor(e,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}getNodeType(e){return this.node.getNodeType(e)}analyze(e){this.node.build(e)}setup(e){const t=e.getContext();e.setContext({...e.context,...this.value});const s=this.node.build(e);return e.setContext(t),s}generate(e,t){const s=e.getContext();e.setContext({...e.context,...this.value});const i=this.node.build(e,t);return e.setContext(s),i}}const Aa=Q(jl),Jl=(a,e)=>Aa(a,{label:e});x("context",Aa),x("label",Jl);class Wl extends L{static get type(){return"VarNode"}constructor(e,t=null){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return this.node.getNodeType(e)}generate(e){const{node:t,name:s}=this,i=e.getVarFromNode(this,s,e.getVectorType(this.getNodeType(e))),n=e.getPropertyName(i),r=t.build(e,i.type);return e.addLineFlowCode(`${n} = ${r}`,this),n}}const ha=Q(Wl);x("temp",ha),x("toVar",(...a)=>ha(...a).append());class Kl extends L{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=e,this.name=t,this.isVaryingNode=!0}isGlobal(){return!0}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return this.node.getNodeType(e)}setupVarying(e){const t=e.getNodeProperties(this);let s=t.varying;if(s===void 0){const i=this.name,n=this.getNodeType(e);t.varying=s=e.getVaryingFromNode(this,i,n),t.node=this.node}return s.needsInterpolation||(s.needsInterpolation=e.shaderStage==="fragment"),s}setup(e){this.setupVarying(e)}analyze(e){return this.setupVarying(e),this.node.analyze(e)}generate(e){const t=e.getNodeProperties(this),s=this.setupVarying(e);if(t.propertyName===void 0){const i=this.getNodeType(e),n=e.getPropertyName(s,Uo.VERTEX);e.flowNodeFromShaderStage(Uo.VERTEX,this.node,i,n),t.propertyName=n}return e.getPropertyName(s)}}const As=Q(Kl);x("varying",As);const Ds="WorkingColorSpace",sr="OutputColorSpace";function ca(a){let e=null;return a===de?e="Linear":a===ie&&(e="sRGB"),e}function Yl(a,e){return ca(a)+"To"+ca(e)}class ki extends fe{static get type(){return"ColorSpaceNode"}constructor(e,t,s){super("vec4"),this.colorNode=e,this.source=t,this.target=s}getColorSpace(e,t){return t===Ds?ce.workingColorSpace:t===sr?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){const{renderer:t}=e,{colorNode:s}=this,i=this.getColorSpace(e,this.source),n=this.getColorSpace(e,this.target);if(i===n)return s;const r=Yl(i,n);let o=null;const A=t.nodes.library.getColorSpaceFunction(r);return A!==null?o=rs(A(s.rgb),s.a):(console.error("ColorSpaceNode: Unsupported Color Space configuration.",r),o=s),o}}const Xl=a=>T(new ki(T(a),Ds,sr)),Zl=a=>T(new ki(T(a),sr,Ds)),$l=(a,e)=>T(new ki(T(a),Ds,e)),la=(a,e)=>T(new ki(T(a),e,Ds));x("toOutputColorSpace",Xl),x("toWorkingColorSpace",Zl),x("workingToColorSpace",$l),x("colorSpaceToWorking",la);let eu=class extends Fs{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),s=this.referenceNode.getNodeType(),i=this.getNodeType();return e.format(t,s,i)}};class tu extends L{static get type(){return"ReferenceBaseNode"}constructor(e,t,s=null,i=null){super(),this.property=e,this.uniformType=t,this.object=s,this.count=i,this.properties=e.split("."),this.reference=s,this.node=null,this.group=null,this.updateType=$.OBJECT}setGroup(e){return this.group=e,this}element(e){return T(new eu(this,T(e)))}setNodeType(e){const t=Ce(null,e).getSelf();this.group!==null&&t.setGroup(this.group),this.node=t}getNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let s=e[t[0]];for(let i=1;i<t.length;i++)s=s[t[i]];return s}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);const e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}}class su extends tu{static get type(){return"RendererReferenceNode"}constructor(e,t,s=null){super(e,t,s),this.renderer=s,this.setGroup(Tt)}updateReference(e){return this.reference=this.renderer!==null?this.renderer:e.renderer,this.reference}}const iu=(a,e,t)=>T(new su(a,e,t));class nu extends fe{static get type(){return"ToneMappingNode"}constructor(e,t=ou,s=null){super("vec3"),this.toneMapping=e,this.exposureNode=t,this.colorNode=s}getCacheKey(){return Kh(super.getCacheKey(),this.toneMapping)}setup(e){const t=this.colorNode||e.context.color,s=this.toneMapping;if(s===qi)return t;let i=null;const n=e.renderer.nodes.library.getToneMappingFunction(s);return n!==null?i=rs(n(t.rgb,this.exposureNode),t.a):(console.error("ToneMappingNode: Unsupported Tone Mapping configuration.",s),i=t),i}}const ru=(a,e,t)=>T(new nu(a,T(e),T(t))),ou=iu("toneMappingExposure","float");x("toneMapping",(a,e,t)=>ru(e,t,a));class au extends Pn{static get type(){return"BufferAttributeNode"}constructor(e,t=null,s=0,i=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=s,this.bufferOffset=i,this.usage=Ws,this.instanced=!1,this.attribute=null,this.global=!0,e&&e.isBufferAttribute===!0&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){if(this.bufferStride===0&&this.bufferOffset===0){let t=e.globalCache.getData(this.value);return t===void 0&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getNodeType(e){return this.bufferType===null&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(this.attribute!==null)return;const t=this.getNodeType(e),s=this.value,i=e.getTypeLength(t),n=this.bufferStride||i,r=this.bufferOffset,o=s.isInterleavedBuffer===!0?s:new po(s,n),A=new pi(o,i,r);o.setUsage(this.usage),this.attribute=A,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){const t=this.getNodeType(e),s=e.getBufferAttributeFromNode(this,t),i=e.getPropertyName(s);let n=null;return e.shaderStage==="vertex"||e.shaderStage==="compute"?(this.name=i,n=i):n=As(this).build(e,t),n}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&this.attribute.isBufferAttribute===!0&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}}const Au=(a,e,t,s)=>T(new au(a,e,t,s));x("toAttribute",a=>Au(a.value));class hu extends L{static get type(){return"ComputeNode"}constructor(e,t,s=[64]){super("void"),this.isComputeNode=!0,this.computeNode=e,this.count=t,this.workgroupSize=s,this.dispatchCount=0,this.version=1,this.updateBeforeType=$.OBJECT,this.updateDispatchCount()}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}updateDispatchCount(){const{count:e,workgroupSize:t}=this;let s=t[0];for(let i=1;i<t.length;i++)s*=t[i];this.dispatchCount=Math.ceil(e/s)}onInit(){}updateBefore({renderer:e}){e.compute(this)}generate(e){const{shaderStage:t}=e;if(t==="compute"){const s=this.computeNode.build(e,"void");s!==""&&e.addLineFlowCode(s,this)}}}x("compute",(a,e,t)=>T(new hu(T(a),e,t)));class cu extends L{static get type(){return"CacheNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isCacheNode=!0}getNodeType(e){return this.node.getNodeType(e)}build(e,...t){const s=e.getCache(),i=e.getCacheFromNode(this,this.parent);e.setCache(i);const n=this.node.build(e,...t);return e.setCache(s),n}}x("cache",(a,...e)=>T(new cu(T(a),...e)));class lu extends L{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}getNodeType(e){return this.outputNode.getNodeType(e)}generate(e){const t=this.callNode.build(e,"void");return t!==""&&e.addLineFlowCode(t,this),this.outputNode.build(e)}}x("bypass",Q(lu));class ua extends L{static get type(){return"RemapNode"}constructor(e,t,s,i=U(0),n=U(1)){super(),this.node=e,this.inLowNode=t,this.inHighNode=s,this.outLowNode=i,this.outHighNode=n,this.doClamp=!0}setup(){const{node:e,inLowNode:t,inHighNode:s,outLowNode:i,outHighNode:n,doClamp:r}=this;let o=e.sub(t).div(s.sub(t));return r===!0&&(o=o.clamp()),o.mul(n.sub(i)).add(i)}}const uu=Q(ua,null,null,{doClamp:!1}),du=Q(ua);x("remap",uu),x("remapClamp",du);class gu extends L{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){const s=this.getNodeType(e),i=this.snippet;if(s==="void")e.addLineFlowCode(i,this);else return e.format(`( ${i} )`,s,t)}}const _i=Q(gu);x("discard",a=>(a?tr(a,_i("discard")):_i("discard")).append());class pu extends fe{static get type(){return"RenderOutputNode"}constructor(e,t,s){super("vec4"),this.colorNode=e,this.toneMapping=t,this.outputColorSpace=s,this.isRenderOutput=!0}setup({context:e}){let t=this.colorNode||e.color;const s=(this.toneMapping!==null?this.toneMapping:e.toneMapping)||qi,i=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||kt;return s!==qi&&(t=t.toneMapping(s)),i!==kt&&i!==ce.workingColorSpace&&(t=t.workingToColorSpace(i)),t}}x("renderOutput",(a,e=null,t=null)=>T(new pu(T(a),e,t)));class fu extends L{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}getNodeType(e){let t=this.nodeType;if(t===null){const s=this.getAttributeName(e);if(e.hasGeometryAttribute(s)){const i=e.geometry.getAttribute(s);t=e.getTypeFromAttribute(i)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){const t=this.getAttributeName(e),s=this.getNodeType(e);if(e.hasGeometryAttribute(t)===!0){const n=e.geometry.getAttribute(t),r=e.getTypeFromAttribute(n),o=e.getAttribute(t,r);return e.shaderStage==="vertex"?e.format(o.name,r,s):As(this).build(e,s)}else return console.warn(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(s)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}}const ks=(a,e)=>T(new fu(a,e)),Li=a=>ks("uv"+(a>0?a:""),"vec2");class mu extends L{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){const s=this.textureNode.build(e,"property"),i=this.levelNode===null?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${s}, ${i} )`,this.getNodeType(e),t)}}const da=Q(mu);class Iu extends os{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=$.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){const e=this.texture,t=e.images,s=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(s&&s.width!==void 0){const{width:i,height:n}=s;this.value=Math.log2(Math.max(i,n))}}}const bu=Q(Iu);class vi extends os{static get type(){return"TextureNode"}constructor(e,t=null,s=null,i=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=s,this.biasNode=i,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=$.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this.setUpdateMatrix(t===null)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}getNodeType(){return this.value.isDepthTexture===!0?"float":this.value.type===Rr?"uvec4":this.value.type===lA?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return Li(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=Ce(this.value.matrix)),this._matrixUniform.mul(v(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this.updateType=e?$.FRAME:$.NONE,this}setupUV(e,t){const s=this.value;return e.isFlipY()&&(s.isRenderTargetTexture===!0||s.isFramebufferTexture===!0||s.isDepthTexture===!0)&&(this.sampler?t=t.flipY():t=t.setY(ns(da(this,this.levelNode).y).sub(t.y).sub(1))),t}setup(e){const t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;let s=this.uvNode;(s===null||e.context.forceUVContext===!0)&&e.context.getUV&&(s=e.context.getUV(this)),s||(s=this.getDefaultUV()),this.updateMatrix===!0&&(s=this.getTransformedUV(s)),s=this.setupUV(e,s);let i=this.levelNode;i===null&&e.context.getTextureLevel&&(i=e.context.getTextureLevel(this)),t.uvNode=s,t.levelNode=i,t.biasNode=this.biasNode,t.compareNode=this.compareNode,t.gradNode=this.gradNode,t.depthNode=this.depthNode}generateUV(e,t){return t.build(e,this.sampler===!0?"vec2":"ivec2")}generateSnippet(e,t,s,i,n,r,o,A){const h=this.value;let c;return i?c=e.generateTextureLevel(h,t,s,i,r):n?c=e.generateTextureBias(h,t,s,n,r):A?c=e.generateTextureGrad(h,t,s,A,r):o?c=e.generateTextureCompare(h,t,s,o,r):this.sampler===!1?c=e.generateTextureLoad(h,t,s,r):c=e.generateTexture(h,t,s,r),c}generate(e,t){const s=e.getNodeProperties(this),i=this.value;if(!i||i.isTexture!==!0)throw new Error("TextureNode: Need a three.js texture.");const n=super.generate(e,"property");if(t==="sampler")return n+"_sampler";if(e.isReference(t))return n;{const r=e.getDataFromNode(this);let o=r.propertyName;if(o===void 0){const{uvNode:c,levelNode:l,biasNode:u,compareNode:d,depthNode:g,gradNode:p}=s,f=this.generateUV(e,c),m=l?l.build(e,"float"):null,y=u?u.build(e,"float"):null,C=g?g.build(e,"int"):null,E=d?d.build(e,"float"):null,w=p?[p[0].build(e,"vec2"),p[1].build(e,"vec2")]:null,S=e.getVarFromNode(this);o=e.getPropertyName(S);const M=this.generateSnippet(e,n,f,m,y,C,E,w);e.addLineFlowCode(`${o} = ${M}`,this),r.snippet=M,r.propertyName=o}let A=o;const h=this.getNodeType(e);return e.needsToWorkingColorSpace(i)&&(A=la(_i(A,h),i.colorSpace).setup(e).build(e,h)),e.format(A,h,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}uv(e){const t=this.clone();return t.uvNode=T(e),t.referenceNode=this.getSelf(),T(t)}blur(e){const t=this.clone();return t.biasNode=T(e).mul(bu(t)),t.referenceNode=this.getSelf(),T(t)}level(e){const t=this.clone();return t.levelNode=T(e),t.referenceNode=this.getSelf(),T(t)}size(e){return da(this,e)}bias(e){const t=this.clone();return t.biasNode=T(e),t.referenceNode=this.getSelf(),T(t)}compare(e){const t=this.clone();return t.compareNode=T(e),t.referenceNode=this.getSelf(),T(t)}grad(e,t){const s=this.clone();return s.gradNode=[T(e),T(t)],s.referenceNode=this.getSelf(),T(s)}depth(e){const t=this.clone();return t.depthNode=T(e),t.referenceNode=this.getSelf(),T(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){const e=this.value,t=this._matrixUniform;t!==null&&(t.value=e.matrix),e.matrixAutoUpdate===!0&&e.updateMatrix()}clone(){const e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e}}const _s=Q(vi),Ls=Ce("float").label("cameraNear").setGroup(Tt).onRenderUpdate(({camera:a})=>a.near),vs=Ce("float").label("cameraFar").setGroup(Tt).onRenderUpdate(({camera:a})=>a.far),Gi=Ce("mat4").label("cameraViewMatrix").setGroup(Tt).onRenderUpdate(({camera:a})=>a.matrixWorldInverse);class G extends L{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=$.OBJECT,this._uniformNode=new os(null)}getNodeType(){const e=this.scope;if(e===G.WORLD_MATRIX)return"mat4";if(e===G.POSITION||e===G.VIEW_POSITION||e===G.DIRECTION||e===G.SCALE)return"vec3"}update(e){const t=this.object3d,s=this._uniformNode,i=this.scope;if(i===G.WORLD_MATRIX)s.value=t.matrixWorld;else if(i===G.POSITION)s.value=s.value||new b,s.value.setFromMatrixPosition(t.matrixWorld);else if(i===G.SCALE)s.value=s.value||new b,s.value.setFromMatrixScale(t.matrixWorld);else if(i===G.DIRECTION)s.value=s.value||new b,t.getWorldDirection(s.value);else if(i===G.VIEW_POSITION){const n=e.camera;s.value=s.value||new b,s.value.setFromMatrixPosition(t.matrixWorld),s.value.applyMatrix4(n.matrixWorldInverse)}}generate(e){const t=this.scope;return t===G.WORLD_MATRIX?this._uniformNode.nodeType="mat4":(t===G.POSITION||t===G.VIEW_POSITION||t===G.DIRECTION||t===G.SCALE)&&(this._uniformNode.nodeType="vec3"),this._uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}G.WORLD_MATRIX="worldMatrix",G.POSITION="position",G.SCALE="scale",G.VIEW_POSITION="viewPosition",G.DIRECTION="direction",G.DIRECTION,G.WORLD_MATRIX,G.POSITION,G.SCALE,G.VIEW_POSITION;class Pe extends G{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}}Pe.DIRECTION;const yu=N(Pe,Pe.WORLD_MATRIX);Pe.POSITION,Pe.SCALE,Pe.VIEW_POSITION;const Eu=Ce(new Fe).onObjectUpdate(({object:a},e)=>e.value.getNormalMatrix(a.matrixWorld)),ga=Gi.mul(yu).toVar("modelViewMatrix_2"),Cu=ks("position","vec3").varying("positionLocal"),Te=ga.mul(Cu).xyz.varying("v_positionView"),pa=Te.negate().varying("v_positionViewDirection").normalize().toVar("positionViewDirection");class Bu extends L{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){const{renderer:t,material:s}=e;return t.coordinateSystem===rt&&s.side===Cr?"false":e.getFrontFacing()}}const ir=U(N(Bu)).mul(2).sub(1),xu=ks("normal","vec3"),Qu=te(a=>a.geometry.hasAttribute("normal")===!1?(console.warn('TSL.NormalNode: Vertex attribute "normal" not found on geometry.'),v(0,1,0)):xu,"vec3").once()().toVar("normalLocal"),wu=Te.dFdx().cross(Te.dFdy()).normalize().toVar("normalFlat"),hs=te(a=>{let e;return a.material.flatShading===!0?e=wu:e=As(ma(Qu),"v_normalView").normalize(),e},"vec3").once()().toVar("normalView"),fa=te(a=>a.context.setupNormal(),"vec3").once()().mul(ir).toVar("transformedNormalView"),ma=te(([a],e)=>{const t=e.renderer.nodes.modelNormalViewMatrix;if(t!==null)return t.transformDirection(a);const s=Eu.mul(a);return Gi.transformDirection(s)}),Tu=Ce(0).onReference(({material:a})=>a).onRenderUpdate(({material:a})=>a.refractionRatio),Su=pa.negate().reflect(fa),Mu=pa.negate().refract(fa,Tu),Nu=Su.transformDirection(Gi).toVar("reflectVector"),Ru=Mu.transformDirection(Gi).toVar("reflectVector");class Fu extends vi{static get type(){return"CubeTextureNode"}constructor(e,t=null,s=null,i=null){super(e,t,s,i),this.isCubeTextureNode=!0}getInputType(){return"cubeTexture"}getDefaultUV(){const e=this.value;return e.mapping===Nr?Nu:e.mapping===aA?Ru:(console.error('THREE.CubeTextureNode: Mapping "%s" not supported.',e.mapping),v(0,0,0))}setUpdateMatrix(){}setupUV(e,t){const s=this.value;return e.renderer.coordinateSystem===Ks||!s.isRenderTargetTexture?v(t.x.negate(),t.yz):t}generateUV(e,t){return t.build(e,"vec3")}}const Du=Q(Fu);class Ia extends os{static get type(){return"BufferNode"}constructor(e,t,s=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=s}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}}const ku=(a,e,t)=>T(new Ia(a,e,t));class _u extends Fs{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){const t=super.generate(e),s=this.getNodeType();return e.format(t,"vec4",s)}}class Lu extends Ia{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null,"vec4"),this.array=e,this.elementType=t,this._elementType=null,this._elementLength=0,this.updateType=$.RENDER,this.isArrayBufferNode=!0}getElementType(){return this.elementType||this._elementType}getElementLength(){return this._elementLength}update(){const{array:e,value:t}=this,s=this.getElementLength(),i=this.getElementType();if(s===1)for(let n=0;n<e.length;n++){const r=n*4;t[r]=e[n]}else if(i==="color")for(let n=0;n<e.length;n++){const r=n*4,o=e[n];t[r]=o.r,t[r+1]=o.g,t[r+2]=o.b||0}else for(let n=0;n<e.length;n++){const r=n*4,o=e[n];t[r]=o.x,t[r+1]=o.y,t[r+2]=o.z||0,t[r+3]=o.w||0}}setup(e){const t=this.array.length;this._elementType=this.elementType===null?wi(this.array[0]):this.elementType,this._elementLength=e.getTypeLength(this._elementType);let s=Float32Array;return this._elementType.charAt(0)==="i"?s=Int32Array:this._elementType.charAt(0)==="u"&&(s=Uint32Array),this.value=new s(t*4),this.bufferCount=t,this.bufferType=e.changeComponentType("vec4",e.getComponentType(this._elementType)),super.setup(e)}element(e){return T(new _u(this,T(e)))}}const nr=(a,e)=>T(new Lu(a,e));class vu extends Fs{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),s=this.referenceNode.getNodeType(),i=this.getNodeType();return e.format(t,s,i)}}class ba extends L{static get type(){return"ReferenceNode"}constructor(e,t,s=null,i=null){super(),this.property=e,this.uniformType=t,this.object=s,this.count=i,this.properties=e.split("."),this.reference=s,this.node=null,this.group=null,this.name=null,this.updateType=$.OBJECT}element(e){return T(new vu(this,T(e)))}setGroup(e){return this.group=e,this}label(e){return this.name=e,this}setNodeType(e){let t=null;this.count!==null?t=ku(null,e,this.count):Array.isArray(this.getValueFromReference())?t=nr(null,e):e==="texture"?t=_s(null):e==="cubeTexture"?t=Du(null):t=Ce(null,e),this.group!==null&&t.setGroup(this.group),this.name!==null&&t.label(this.name),this.node=t.getSelf()}getNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let s=e[t[0]];for(let i=1;i<t.length;i++)s=s[t[i]];return s}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);const e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}}const Mt=(a,e,t)=>T(new ba(a,e,t));class Gu extends ba{static get type(){return"MaterialReferenceNode"}constructor(e,t,s=null){super(e,t,s),this.material=s,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=this.material!==null?this.material:e.material,this.reference}}const Ou=(a,e,t)=>T(new Gu(a,e,t)),ya=te(a=>(a.geometry.hasAttribute("tangent")===!1&&a.geometry.computeTangents(),ks("tangent","vec4")))(),Uu=ya.xyz.toVar("tangentLocal"),Ea=ga.mul(rs(Uu,0)).xyz.varying("v_tangentView").normalize().toVar("tangentView"),zu=Ni(Ea,As((a=>a.mul(ya.w).xyz)(hs.cross(Ea)),"v_bitangentView").normalize().toVar("bitangentView"),hs),Pu=te(a=>{const{eye_pos:e,surf_norm:t,mapN:s,uv:i}=a,n=e.dFdx(),r=e.dFdy(),o=i.dFdx(),A=i.dFdy(),h=t,c=r.cross(h),l=h.cross(n),u=c.mul(o.x).add(l.mul(A.x)),d=c.mul(o.y).add(l.mul(A.y)),g=u.dot(u).max(d.dot(d)),p=ir.mul(g.inverseSqrt());return St(u.mul(s.x,p),d.mul(s.y,p),h.mul(s.z)).normalize()});class Hu extends fe{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=Ki}setup(e){const{normalMapType:t,scaleNode:s}=this;let i=this.node.mul(2).sub(1);s!==null&&(i=v(i.xy.mul(s),i.z));let n=null;return t===BA?n=ma(i):t===Ki&&(e.hasGeometryAttribute("tangent")===!0?n=zu.mul(i).normalize():n=Pu({eye_pos:Te,surf_norm:hs,mapN:i,uv:Li()})),n}}const Ca=Q(Hu),qu=te(({textureNode:a,bumpScale:e})=>{const t=i=>a.cache().context({getUV:n=>i(n.uvNode||Li()),forceUVContext:!0}),s=U(t(i=>i));return F(U(t(i=>i.add(i.dFdx()))).sub(s),U(t(i=>i.add(i.dFdy()))).sub(s)).mul(e)}),Vu=te(a=>{const{surf_pos:e,surf_norm:t,dHdxy:s}=a,i=e.dFdx().normalize(),n=e.dFdy().normalize(),r=t,o=n.cross(r),A=r.cross(i),h=i.dot(o).mul(ir),c=h.sign().mul(s.x.mul(o).add(s.y.mul(A)));return h.abs().mul(t).sub(c).normalize()});class ju extends fe{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(){const e=this.scaleNode!==null?this.scaleNode:1,t=qu({textureNode:this.textureNode,bumpScale:e});return Vu({surf_pos:Te,surf_norm:hs,dHdxy:t})}}const Ju=Q(ju),Ba=new Map;class B extends L{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let s=Ba.get(e);return s===void 0&&(s=Ou(e,t),Ba.set(e,s)),s}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache(e==="map"?"map":e+"Map","texture")}setup(e){const t=e.context.material,s=this.scope;let i=null;if(s===B.COLOR){const n=t.color!==void 0?this.getColor(s):v();t.map&&t.map.isTexture===!0?i=n.mul(this.getTexture("map")):i=n}else if(s===B.OPACITY){const n=this.getFloat(s);t.alphaMap&&t.alphaMap.isTexture===!0?i=n.mul(this.getTexture("alpha")):i=n}else if(s===B.SPECULAR_STRENGTH)t.specularMap&&t.specularMap.isTexture===!0?i=this.getTexture("specular").r:i=U(1);else if(s===B.SPECULAR_INTENSITY){const n=this.getFloat(s);t.specularMap?i=n.mul(this.getTexture(s).a):i=n}else if(s===B.SPECULAR_COLOR){const n=this.getColor(s);t.specularColorMap&&t.specularColorMap.isTexture===!0?i=n.mul(this.getTexture(s).rgb):i=n}else if(s===B.ROUGHNESS){const n=this.getFloat(s);t.roughnessMap&&t.roughnessMap.isTexture===!0?i=n.mul(this.getTexture(s).g):i=n}else if(s===B.METALNESS){const n=this.getFloat(s);t.metalnessMap&&t.metalnessMap.isTexture===!0?i=n.mul(this.getTexture(s).b):i=n}else if(s===B.EMISSIVE){const n=this.getFloat("emissiveIntensity"),r=this.getColor(s).mul(n);t.emissiveMap&&t.emissiveMap.isTexture===!0?i=r.mul(this.getTexture(s)):i=r}else if(s===B.NORMAL)t.normalMap?(i=Ca(this.getTexture("normal"),this.getCache("normalScale","vec2")),i.normalMapType=t.normalMapType):t.bumpMap?i=Ju(this.getTexture("bump").r,this.getFloat("bumpScale")):i=hs;else if(s===B.CLEARCOAT){const n=this.getFloat(s);t.clearcoatMap&&t.clearcoatMap.isTexture===!0?i=n.mul(this.getTexture(s).r):i=n}else if(s===B.CLEARCOAT_ROUGHNESS){const n=this.getFloat(s);t.clearcoatRoughnessMap&&t.clearcoatRoughnessMap.isTexture===!0?i=n.mul(this.getTexture(s).r):i=n}else if(s===B.CLEARCOAT_NORMAL)t.clearcoatNormalMap?i=Ca(this.getTexture(s),this.getCache(s+"Scale","vec2")):i=hs;else if(s===B.SHEEN){const n=this.getColor("sheenColor").mul(this.getFloat("sheen"));t.sheenColorMap&&t.sheenColorMap.isTexture===!0?i=n.mul(this.getTexture("sheenColor").rgb):i=n}else if(s===B.SHEEN_ROUGHNESS){const n=this.getFloat(s);t.sheenRoughnessMap&&t.sheenRoughnessMap.isTexture===!0?i=n.mul(this.getTexture(s).a):i=n,i=i.clamp(.07,1)}else if(s===B.ANISOTROPY)if(t.anisotropyMap&&t.anisotropyMap.isTexture===!0){const n=this.getTexture(s);i=Yo(Gs.x,Gs.y,Gs.y.negate(),Gs.x).mul(n.rg.mul(2).sub(F(1)).normalize().mul(n.b))}else i=Gs;else if(s===B.IRIDESCENCE_THICKNESS){const n=Mt("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){const r=Mt("0","float",t.iridescenceThicknessRange);i=n.sub(r).mul(this.getTexture(s).g).add(r)}else i=n}else if(s===B.TRANSMISSION){const n=this.getFloat(s);t.transmissionMap?i=n.mul(this.getTexture(s).r):i=n}else if(s===B.THICKNESS){const n=this.getFloat(s);t.thicknessMap?i=n.mul(this.getTexture(s).g):i=n}else if(s===B.IOR)i=this.getFloat(s);else if(s===B.LIGHT_MAP)i=this.getTexture(s).rgb.mul(this.getFloat("lightMapIntensity"));else if(s===B.AO_MAP)i=this.getTexture(s).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1);else{const n=this.getNodeType(e);i=this.getCache(s,n)}return i}}B.ALPHA_TEST="alphaTest",B.COLOR="color",B.OPACITY="opacity",B.SHININESS="shininess",B.SPECULAR="specular",B.SPECULAR_STRENGTH="specularStrength",B.SPECULAR_INTENSITY="specularIntensity",B.SPECULAR_COLOR="specularColor",B.REFLECTIVITY="reflectivity",B.ROUGHNESS="roughness",B.METALNESS="metalness",B.NORMAL="normal",B.CLEARCOAT="clearcoat",B.CLEARCOAT_ROUGHNESS="clearcoatRoughness",B.CLEARCOAT_NORMAL="clearcoatNormal",B.EMISSIVE="emissive",B.ROTATION="rotation",B.SHEEN="sheen",B.SHEEN_ROUGHNESS="sheenRoughness",B.ANISOTROPY="anisotropy",B.IRIDESCENCE="iridescence",B.IRIDESCENCE_IOR="iridescenceIOR",B.IRIDESCENCE_THICKNESS="iridescenceThickness",B.IOR="ior",B.TRANSMISSION="transmission",B.THICKNESS="thickness",B.ATTENUATION_DISTANCE="attenuationDistance",B.ATTENUATION_COLOR="attenuationColor",B.LINE_SCALE="scale",B.LINE_DASH_SIZE="dashSize",B.LINE_GAP_SIZE="gapSize",B.LINE_WIDTH="linewidth",B.LINE_DASH_OFFSET="dashOffset",B.POINT_WIDTH="pointWidth",B.DISPERSION="dispersion",B.LIGHT_MAP="light",B.AO_MAP="ao",B.ALPHA_TEST,B.COLOR,B.SHININESS,B.EMISSIVE,B.OPACITY,B.SPECULAR,B.SPECULAR_INTENSITY,B.SPECULAR_COLOR,B.SPECULAR_STRENGTH,B.REFLECTIVITY,B.ROUGHNESS,B.METALNESS,B.CLEARCOAT,B.CLEARCOAT_ROUGHNESS,B.ROTATION,B.SHEEN,B.SHEEN_ROUGHNESS,B.ANISOTROPY,B.IRIDESCENCE,B.IRIDESCENCE_IOR,B.IRIDESCENCE_THICKNESS,B.TRANSMISSION,B.THICKNESS,B.IOR,B.ATTENUATION_DISTANCE,B.ATTENUATION_COLOR,B.LINE_SCALE,B.LINE_DASH_SIZE,B.LINE_GAP_SIZE,B.LINE_WIDTH,B.LINE_DASH_OFFSET,B.POINT_WIDTH,B.DISPERSION,B.LIGHT_MAP,B.AO_MAP;const Gs=Ce(new q).onReference(function(a){return a.material}).onRenderUpdate(function({material:a}){this.value.set(a.anisotropy*Math.cos(a.anisotropyRotation),a.anisotropy*Math.sin(a.anisotropyRotation))});class V extends L{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isInstanceIndexNode=!0}generate(e){const t=this.getNodeType(e),s=this.scope;let i;if(s===V.VERTEX)i=e.getVertexIndex();else if(s===V.INSTANCE)i=e.getInstanceIndex();else if(s===V.DRAW)i=e.getDrawIndex();else if(s===V.INVOCATION_LOCAL)i=e.getInvocationLocalIndex();else if(s===V.INVOCATION_SUBGROUP)i=e.getInvocationSubgroupIndex();else if(s===V.SUBGROUP)i=e.getSubgroupIndex();else throw new Error("THREE.IndexNode: Unknown scope: "+s);let n;return e.shaderStage==="vertex"||e.shaderStage==="compute"?n=i:n=As(this).build(e,t),n}}V.VERTEX="vertex",V.INSTANCE="instance",V.SUBGROUP="subgroup",V.INVOCATION_LOCAL="invocationLocal",V.INVOCATION_SUBGROUP="invocationSubgroup",V.DRAW="draw",V.VERTEX,V.INSTANCE,V.SUBGROUP,V.INVOCATION_SUBGROUP,V.INVOCATION_LOCAL,V.DRAW;class Wu extends L{static get type(){return"LoopNode"}constructor(e=[]){super(),this.params=e}getVarName(e){return String.fromCharCode(105+e)}getProperties(e){const t=e.getNodeProperties(this);if(t.stackNode!==void 0)return t;const s={};for(let n=0,r=this.params.length-1;n<r;n++){const o=this.params[n],A=o.isNode!==!0&&o.name||this.getVarName(n),h=o.isNode!==!0&&o.type||"int";s[A]=_i(A,h)}const i=e.addStack();return t.returnsNode=this.params[this.params.length-1](s,i,e),t.stackNode=i,e.removeStack(),t}getNodeType(e){const{returnsNode:t}=this.getProperties(e);return t?t.getNodeType(e):"void"}setup(e){this.getProperties(e)}generate(e){const t=this.getProperties(e),s=this.params,i=t.stackNode;for(let o=0,A=s.length-1;o<A;o++){const h=s[o];let c=null,l=null,u=null,d=null,g=null,p=null;h.isNode?(d="int",u=this.getVarName(o),c="0",l=h.build(e,d),g="<"):(d=h.type||"int",u=h.name||this.getVarName(o),c=h.start,l=h.end,g=h.condition,p=h.update,typeof c=="number"?c=c.toString():c&&c.isNode&&(c=c.build(e,d)),typeof l=="number"?l=l.toString():l&&l.isNode&&(l=l.build(e,d)),c!==void 0&&l===void 0?(c=c+" - 1",l="0",g=">="):l!==void 0&&c===void 0&&(c="0",g="<"),g===void 0&&(Number(c)>Number(l)?g=">=":g="<"));const f={start:c,end:l},m=f.start,y=f.end;let C="",E="",w="";p||(d==="int"||d==="uint"?g.includes("<")?p="++":p="--":g.includes("<")?p="+= 1.":p="-= 1."),C+=e.getVar(d,u)+" = "+m,E+=u+" "+g+" "+y,w+=u+" "+p;const S=`for ( ${C}; ${E}; ${w} )`;e.addFlowCode((o===0?`
19
- `:"")+e.tab+S+` {
20
-
21
- `).addFlowTab()}const n=i.build(e,"void"),r=t.returnsNode?t.returnsNode.build(e):"";e.removeFlowTab().addFlowCode(`
22
- `+e.tab+n);for(let o=0,A=this.params.length-1;o<A;o++)e.addFlowCode((o===0?"":e.tab)+`}
23
-
24
- `).removeFlowTab();return e.addFlowTab(),r}}const cs=(...a)=>T(new Wu(is(a,"int"))).append();let Os,Us;class se extends L{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this.isViewportNode=!0}getNodeType(){return this.scope===se.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=$.NONE;return(this.scope===se.SIZE||this.scope===se.VIEWPORT)&&(e=$.RENDER),this.updateType=e,e}update({renderer:e}){const t=e.getRenderTarget();this.scope===se.VIEWPORT?t!==null?Us.copy(t.viewport):(e.getViewport(Us),Us.multiplyScalar(e.getPixelRatio())):t!==null?(Os.width=t.width,Os.height=t.height):e.getDrawingBufferSize(Os)}setup(){const e=this.scope;let t=null;return e===se.SIZE?t=Ce(Os||(Os=new q)):e===se.VIEWPORT?t=Ce(Us||(Us=new K)):t=F(Oi.div(xa)),t}generate(e){if(this.scope===se.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){const s=e.getNodeProperties(xa).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${s}.y - ${t}.y )`}return t}return super.generate(e)}}se.COORDINATE="coordinate",se.VIEWPORT="viewport",se.SIZE="size",se.UV="uv";const rr=N(se,se.UV),xa=N(se,se.SIZE),Oi=N(se,se.COORDINATE),Qa=N(se,se.VIEWPORT);Qa.zw,Qa.xy;const zs=new q;class Ku extends vi{static get type(){return"ViewportTextureNode"}constructor(e=rr,t=null,s=null){s===null&&(s=new fh,s.minFilter=ds),super(s,e,t),this.generateMipmaps=!1,this.isOutputTextureNode=!0,this.updateBeforeType=$.FRAME}updateBefore(e){const t=e.renderer;t.getDrawingBufferSize(zs);const s=this.value;(s.image.width!==zs.width||s.image.height!==zs.height)&&(s.image.width=zs.width,s.image.height=zs.height,s.needsUpdate=!0);const i=s.generateMipmaps;s.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(s),s.generateMipmaps=i}clone(){const e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}let or=null;class Yu extends Ku{static get type(){return"ViewportDepthTextureNode"}constructor(e=rr,t=null){or===null&&(or=new go),super(e,t,or)}}const Xu=Q(Yu);class me extends L{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){const{scope:t}=this;return t===me.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){const{scope:t}=this,s=this.valueNode;let i=null;if(t===me.DEPTH_BASE)s!==null&&(i=Ta().assign(s));else if(t===me.DEPTH)e.isPerspectiveCamera?i=Zu(Te.z,Ls,vs):i=Ui(Te.z,Ls,vs);else if(t===me.LINEAR_DEPTH)if(s!==null)if(e.isPerspectiveCamera){const n=wa(s,Ls,vs);i=Ui(n,Ls,vs)}else i=s;else i=Ui(Te.z,Ls,vs);return i}}me.DEPTH_BASE="depthBase",me.DEPTH="depth",me.LINEAR_DEPTH="linearDepth";const Ui=(a,e,t)=>a.add(e).div(e.sub(t)),Zu=(a,e,t)=>e.add(a).mul(t).div(t.sub(e).mul(a)),wa=(a,e,t)=>e.mul(t).div(t.sub(e).mul(a).sub(t)),Ta=Q(me,me.DEPTH_BASE),$u=N(me,me.DEPTH),ed=Q(me,me.LINEAR_DEPTH);Xu(),$u.assign=a=>Ta(a);class Ps extends L{static get type(){return"ClippingNode"}constructor(e=Ps.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);const t=e.clippingContext,{localClipIntersection:s,localClippingCount:i,globalClippingCount:n}=t,r=n+i,o=s?r-i:r;return this.scope===Ps.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(t.planes,r,o):this.setupDefault(t.planes,r,o)}setupAlphaToCoverage(e,t,s){return te(()=>{const i=nr(e),n=as("float","distanceToPlane"),r=as("float","distanceToGradient"),o=as("float","clipOpacity");o.assign(1);let A;if(cs(s,({i:h})=>{A=i.element(h),n.assign(Te.dot(A.xyz).negate().add(A.w)),r.assign(n.fwidth().div(2)),o.mulAssign(er(r.negate(),r,n)),o.equal(0).discard()}),s<t){const h=as("float","unionclipOpacity");h.assign(1),cs({start:s,end:t},({i:c})=>{A=i.element(c),n.assign(Te.dot(A.xyz).negate().add(A.w)),r.assign(n.fwidth().div(2)),h.mulAssign(er(r.negate(),r,n).oneMinus())}),o.mulAssign(h.oneMinus())}$o.a.mulAssign(o),$o.a.equal(0).discard()})()}setupDefault(e,t,s){return te(()=>{const i=nr(e);let n;if(cs(s,({i:r})=>{n=i.element(r),Te.dot(n.xyz).greaterThan(n.w).discard()}),s<t){const r=as("bool","clipped");r.assign(!0),cs({start:s,end:t},({i:o})=>{n=i.element(o),r.assign(Te.dot(n.xyz).greaterThan(n.w).and(r))}),r.discard()}})()}}Ps.ALPHA_TO_COVERAGE="alphaToCoverage",Ps.DEFAULT="default",v(.04),U(1);const td=te(([a,e])=>{const t=a.toVar();t.assign(Fi(2,t).sub(1));const s=v(t,1).toVar();return Wn(e.equal(0),()=>{s.assign(s.zyx)}).ElseIf(e.equal(1),()=>{s.assign(s.xzy),s.xz.mulAssign(-1)}).ElseIf(e.equal(2),()=>{s.x.mulAssign(-1)}).ElseIf(e.equal(3),()=>{s.assign(s.zyx),s.xz.mulAssign(-1)}).ElseIf(e.equal(4),()=>{s.assign(s.xzy),s.xy.mulAssign(-1)}).ElseIf(e.equal(5),()=>{s.z.mulAssign(-1)}),s}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]});te(({texture:a,uv:e})=>{const s=v().toVar();return Wn(e.x.lessThan(1e-4),()=>{s.assign(v(1,0,0))}).ElseIf(e.y.lessThan(1e-4),()=>{s.assign(v(0,1,0))}).ElseIf(e.z.lessThan(1e-4),()=>{s.assign(v(0,0,1))}).ElseIf(e.x.greaterThan(1-1e-4),()=>{s.assign(v(-1,0,0))}).ElseIf(e.y.greaterThan(1-1e-4),()=>{s.assign(v(0,-1,0))}).ElseIf(e.z.greaterThan(1-1e-4),()=>{s.assign(v(0,0,-1))}).Else(()=>{const n=a.uv(e.add(v(-.01,0,0))).r.sub(a.uv(e.add(v(.01,0,0))).r),r=a.uv(e.add(v(0,-.01,0))).r.sub(a.uv(e.add(v(0,.01,0))).r),o=a.uv(e.add(v(0,0,-.01))).r.sub(a.uv(e.add(v(0,0,.01))).r);s.assign(v(n,r,o))}),s.normalize()});const ar=td(Li(),ks("faceIndex")).normalize();v(ar.x,ar.y.negate(),ar.z);class ve extends os{static get type(){return"TimerNode"}constructor(e=ve.LOCAL,t=1,s=0){super(s),this.scope=e,this.scale=t,this.updateType=$.FRAME}update(e){const t=this.scope,s=this.scale;t===ve.LOCAL?this.value+=e.deltaTime*s:t===ve.DELTA?this.value=e.deltaTime*s:t===ve.FRAME?this.value=e.frameId:this.value=e.time*s}serialize(e){super.serialize(e),e.scope=this.scope,e.scale=this.scale}deserialize(e){super.deserialize(e),this.scope=e.scope,this.scale=e.scale}}ve.LOCAL="local",ve.GLOBAL="global",ve.DELTA="delta",ve.FRAME="frame";const sd=(a,e=0)=>T(new ve(ve.LOCAL,a,e));class re extends L{static get type(){return"OscNode"}constructor(e=re.SINE,t=sd()){super(),this.method=e,this.timeNode=t}getNodeType(e){return this.timeNode.getNodeType(e)}setup(){const e=this.method,t=T(this.timeNode);let s=null;return e===re.SINE?s=t.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5):e===re.SQUARE?s=t.fract().round():e===re.TRIANGLE?s=t.add(.5).fract().mul(2).sub(1).abs():e===re.SAWTOOTH&&(s=t.fract()),s}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}re.SINE="sine",re.SQUARE="square",re.TRIANGLE="triangle",re.SAWTOOTH="sawtooth",re.SINE,re.SQUARE,re.TRIANGLE,re.SAWTOOTH,new xt,new b,new b,new b,new _,new b(0,0,-1),new K,new b,new b,new K,new q,new Kr,rr.flipX();class He extends L{static get type(){return"SceneNode"}constructor(e=He.BACKGROUND_BLURRINESS,t=null){super(),this.scope=e,this.scene=t}setup(e){const t=this.scope,s=this.scene!==null?this.scene:e.scene;let i;return t===He.BACKGROUND_BLURRINESS?i=Mt("backgroundBlurriness","float",s):t===He.BACKGROUND_INTENSITY?i=Mt("backgroundIntensity","float",s):console.error("THREE.SceneNode: Unknown scope:",t),i}}He.BACKGROUND_BLURRINESS="backgroundBlurriness",He.BACKGROUND_INTENSITY="backgroundIntensity",He.BACKGROUND_BLURRINESS,He.BACKGROUND_INTENSITY;const id=new q;class nd extends vi{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.setUpdateMatrix(!1)}setup(e){return e.object.isQuadMesh&&this.passNode.build(e),super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}}class Sa extends nd{static get type(){return"PassMultipleTextureNode"}constructor(e,t,s=!1){super(e,null),this.textureName=t,this.previousTexture=s}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){return new this.constructor(this.passNode,this.textureName,this.previousTexture)}}class zi extends fe{static get type(){return"PassNode"}constructor(e,t,s,i={}){super("vec4"),this.scope=e,this.scene=t,this.camera=s,this.options=i,this._pixelRatio=1,this._width=1,this._height=1;const n=new go;n.isRenderTargetTexture=!0,n.name="depth";const r=new Kr(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Ft,...i});r.texture.name="output",r.depthTexture=n,this.renderTarget=r,this.updateBeforeType=$.FRAME,this._textures={output:r.texture,depth:n},this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=Ce(0),this._cameraFar=Ce(0),this._mrt=null,this.isPassNode=!0}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}isGlobal(){return!0}getTexture(e){let t=this._textures[e];return t===void 0&&(t=this.renderTarget.texture.clone(),t.isRenderTargetTexture=!0,t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)),t}getPreviousTexture(e){let t=this._previousTextures[e];return t===void 0&&(t=this.getTexture(e).clone(),t.isRenderTargetTexture=!0,this._previousTextures[e]=t),t}toggleTexture(e){const t=this._previousTextures[e];if(t!==void 0){const s=this._textures[e],i=this.renderTarget.textures.indexOf(s);this.renderTarget.textures[i]=t,this._textures[e]=t,this._previousTextures[e]=s,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return t===void 0&&(this._textureNodes[e]=t=T(new Sa(this,e)),this._textureNodes[e].updateTexture()),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return t===void 0&&(this._textureNodes[e]===void 0&&this.getTextureNode(e),this._previousTextureNodes[e]=t=T(new Sa(this,e,!0)),this._previousTextureNodes[e].updateTexture()),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(t===void 0){const s=this._cameraNear,i=this._cameraFar;this._viewZNodes[e]=t=wa(this.getTextureNode(e),s,i)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(t===void 0){const s=this._cameraNear,i=this._cameraFar,n=this.getViewZNode(e);this._linearDepthNodes[e]=t=Ui(n,s,i)}return t}setup({renderer:e}){return this.renderTarget.samples=this.options.samples===void 0?e.samples:this.options.samples,e.backend.isWebGLBackend===!0&&(this.renderTarget.samples=0),this.renderTarget.depthTexture.isMultisampleRenderTargetTexture=this.renderTarget.samples>1,this.scope===zi.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){const{renderer:t}=e,{scene:s,camera:i}=this;this._pixelRatio=t.getPixelRatio();const n=t.getSize(id);this.setSize(n.width,n.height);const r=t.getRenderTarget(),o=t.getMRT();this._cameraNear.value=i.near,this._cameraFar.value=i.far;for(const A in this._previousTextures)this.toggleTexture(A);t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.render(s,i),t.setRenderTarget(r),t.setMRT(o)}setSize(e,t){this._width=e,this._height=t;const s=this._width*this._pixelRatio,i=this._height*this._pixelRatio;this.renderTarget.setSize(s,i)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget.dispose()}}zi.COLOR="color",zi.DEPTH="depth",te(({depthTexture:a,shadowCoord:e})=>_s(a,e.xy).compare(e.z)),te(({depthTexture:a,shadowCoord:e,shadow:t})=>{const s=(p,f)=>_s(a,p).compare(f),i=Mt("mapSize","vec2",t).setGroup(Tt),n=Mt("radius","float",t).setGroup(Tt),r=F(1).div(i),o=r.x.negate().mul(n),A=r.y.negate().mul(n),h=r.x.mul(n),c=r.y.mul(n),l=o.div(2),u=A.div(2),d=h.div(2),g=c.div(2);return St(s(e.xy.add(F(o,A)),e.z),s(e.xy.add(F(0,A)),e.z),s(e.xy.add(F(h,A)),e.z),s(e.xy.add(F(l,u)),e.z),s(e.xy.add(F(0,u)),e.z),s(e.xy.add(F(d,u)),e.z),s(e.xy.add(F(o,0)),e.z),s(e.xy.add(F(l,0)),e.z),s(e.xy,e.z),s(e.xy.add(F(d,0)),e.z),s(e.xy.add(F(h,0)),e.z),s(e.xy.add(F(l,g)),e.z),s(e.xy.add(F(0,g)),e.z),s(e.xy.add(F(d,g)),e.z),s(e.xy.add(F(o,c)),e.z),s(e.xy.add(F(0,c)),e.z),s(e.xy.add(F(h,c)),e.z)).mul(1/17)}),te(({depthTexture:a,shadowCoord:e,shadow:t})=>{const s=(c,l)=>_s(a,c).compare(l),i=Mt("mapSize","vec2",t).setGroup(Tt),n=F(1).div(i),r=n.x,o=n.y,A=e.xy,h=Yn(A.mul(i).add(.5));return A.subAssign(h.mul(n)),St(s(A,e.z),s(A.add(F(r,0)),e.z),s(A.add(F(0,o)),e.z),s(A.add(n),e.z),pt(s(A.add(F(r.negate(),0)),e.z),s(A.add(F(r.mul(2),0)),e.z),h.x),pt(s(A.add(F(r.negate(),o)),e.z),s(A.add(F(r.mul(2),o)),e.z),h.x),pt(s(A.add(F(0,o.negate())),e.z),s(A.add(F(0,o.mul(2))),e.z),h.y),pt(s(A.add(F(r,o.negate())),e.z),s(A.add(F(r,o.mul(2))),e.z),h.y),pt(pt(s(A.add(F(r.negate(),o.negate())),e.z),s(A.add(F(r.mul(2),o.negate())),e.z),h.x),pt(s(A.add(F(r.negate(),o.mul(2))),e.z),s(A.add(F(r.mul(2),o.mul(2))),e.z),h.x),h.y)).mul(1/9)}),te(({depthTexture:a,shadowCoord:e})=>{const t=U(1).toVar(),s=_s(a).uv(e.xy).rg,i=oa(e.z,s.x);return Wn(i.notEqual(U(1)),()=>{const n=e.z.sub(s.x),r=Zn(0,s.y.mul(s.y));let o=r.div(r.add(n.mul(n)));o=Di(Ri(o,.3).div(.95-.3)),t.assign(Di(Zn(i,o)))}),t}),te(({samples:a,radius:e,size:t,shadowPass:s})=>{const i=U(0).toVar(),n=U(0).toVar(),r=a.lessThanEqual(U(1)).select(U(0),U(2).div(a.sub(1))),o=a.lessThanEqual(U(1)).select(U(0),U(-1));cs({start:ns(0),end:ns(a),type:"int",condition:"<"},({i:h})=>{const c=o.add(U(h).mul(r)),l=s.uv(St(Oi.xy,F(0,c).mul(e)).div(t)).x;i.addAssign(l),n.addAssign(l.mul(l))}),i.divAssign(a),n.divAssign(a);const A=Kn(n.sub(i.mul(i)));return F(i,A)}),te(({samples:a,radius:e,size:t,shadowPass:s})=>{const i=U(0).toVar(),n=U(0).toVar(),r=a.lessThanEqual(U(1)).select(U(0),U(2).div(a.sub(1))),o=a.lessThanEqual(U(1)).select(U(0),U(-1));cs({start:ns(0),end:ns(a),type:"int",condition:"<"},({i:h})=>{const c=o.add(U(h).mul(r)),l=s.uv(St(Oi.xy,F(c,0).mul(e)).div(t));i.addAssign(l.x),n.addAssign(St(l.y.mul(l.y),l.x.mul(l.x)))}),i.divAssign(a),n.divAssign(a);const A=Kn(n.sub(i.mul(i)));return F(i,A)}),v(1.6605,-.1246,-.0182),v(-.5876,1.1329,-.1006),v(-.0728,-.0083,1.1187),v(.6274,.0691,.0164),v(.3293,.9195,.088),v(.0433,.0113,.8956);class rd extends L{constructor(e){super(),this.scope=e}generate(e){const{scope:t}=this,{renderer:s}=e;s.backend.isWebGLBackend===!0?e.addFlowCode(` // ${t}Barrier
25
- `):e.addLineFlowCode(`${t}Barrier()`,this)}}Q(rd);class qe extends fe{static get type(){return"AtomicFunctionNode"}constructor(e,t,s,i=null){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=s,this.storeNode=i}getInputType(e){return this.pointerNode.getNodeType(e)}getNodeType(e){return this.getInputType(e)}generate(e){const t=this.method,s=this.getNodeType(e),i=this.getInputType(e),n=this.pointerNode,r=this.valueNode,o=[];o.push(`&${n.build(e,i)}`),o.push(r.build(e,i));const A=`${e.getMethod(t,s)}( ${o.join(", ")} )`;if(this.storeNode!==null){const h=this.storeNode.build(e,i);e.addLineFlowCode(`${h} = ${A}`,this)}else e.addLineFlowCode(A,this)}}if(qe.ATOMIC_LOAD="atomicLoad",qe.ATOMIC_STORE="atomicStore",qe.ATOMIC_ADD="atomicAdd",qe.ATOMIC_SUB="atomicSub",qe.ATOMIC_MAX="atomicMax",qe.ATOMIC_MIN="atomicMin",qe.ATOMIC_AND="atomicAnd",qe.ATOMIC_OR="atomicOr",qe.ATOMIC_XOR="atomicXor",Q(qe),typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:js}})),typeof window<"u"){try{self.location.href,window.__THREE__IMPORTS__||(window.__THREE__IMPORTS__=[]),window.__THREE__IMPORTS__.push({url:self.location.href,revision:js})}catch{}window.__THREE__?(console.warn("WARNING: Multiple instances of Three.js being imported. Existing: "+window.__THREE__+", new: "+js),console.warn(window.__THREE__IMPORTS__)):window.__THREE__=js}const Ar=new WeakMap;class od extends gt{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,s,i){const n=new wt(this.manager);n.setPath(this.path),n.setResponseType("arraybuffer"),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(e,r=>{this.parse(r,t,i)},s,i)}parse(e,t,s=()=>{}){this.decodeDracoFile(e,t,null,null,ie,s).catch(s)}decodeDracoFile(e,t,s,i,n=de,r=()=>{}){const o={attributeIDs:s||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!s,vertexColorSpace:n};return this.decodeGeometry(e,o).then(t).catch(r)}decodeGeometry(e,t){const s=JSON.stringify(t);if(Ar.has(e)){const A=Ar.get(e);if(A.key===s)return A.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const n=this.workerNextTaskID++,r=e.byteLength,o=this._getWorker(n,r).then(A=>(i=A,new Promise((h,c)=>{i._callbacks[n]={resolve:h,reject:c},i.postMessage({type:"decode",id:n,taskConfig:t,buffer:e},[e])}))).then(A=>this._createGeometry(A.geometry));return o.catch(()=>!0).then(()=>{i&&n&&this._releaseTask(i,n)}),Ar.set(e,{key:s,promise:o}),o}_createGeometry(e){const t=new Ct;e.index&&t.setIndex(new ye(e.index.array,1));for(let s=0;s<e.attributes.length;s++){const i=e.attributes[s],n=i.name,r=i.array,o=i.itemSize,A=new ye(r,o);n==="color"&&(this._assignVertexColorSpace(A,i.vertexColorSpace),A.normalized=!(r instanceof Float32Array)),t.setAttribute(n,A)}return t}_assignVertexColorSpace(e,t){if(t!==ie)return;const s=new X;for(let i=0,n=e.count;i<n;i++)s.fromBufferAttribute(e,i),ce.toWorkingColorSpace(s,ie),e.setXYZ(i,s.r,s.g,s.b)}_loadLibrary(e,t){const s=new wt(this.manager);return s.setPath(this.decoderPath),s.setResponseType(t),s.setWithCredentials(this.withCredentials),new Promise((i,n)=>{s.load(e,i,void 0,n)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(s=>{const i=s[0];e||(this.decoderConfig.wasmBinary=s[1]);const n=ad.toString(),r=["/* draco decoder */",i,"","/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join(`
26
- `);this.workerSourceURL=URL.createObjectURL(new Blob([r]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(n){const r=n.data;switch(r.type){case"decode":i._callbacks[r.id].resolve(r);break;case"error":i._callbacks[r.id].reject(r);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+r.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,n){return i._taskLoad>n._taskLoad?-1:1});const s=this.workerPool[this.workerPool.length-1];return s._taskCosts[e]=t,s._taskLoad+=t,s})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function ad(){let a,e;onmessage=function(r){const o=r.data;switch(o.type){case"init":a=o.decoderConfig,e=new Promise(function(c){a.onModuleLoaded=function(l){c({draco:l})},DracoDecoderModule(a)});break;case"decode":const A=o.buffer,h=o.taskConfig;e.then(c=>{const l=c.draco,u=new l.Decoder;try{const d=t(l,u,new Int8Array(A),h),g=d.attributes.map(p=>p.array.buffer);d.index&&g.push(d.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:d},g)}catch(d){console.error(d),self.postMessage({type:"error",id:o.id,error:d.message})}finally{l.destroy(u)}});break}};function t(r,o,A,h){const c=h.attributeIDs,l=h.attributeTypes;let u,d;const g=o.GetEncodedGeometryType(A);if(g===r.TRIANGULAR_MESH)u=new r.Mesh,d=o.DecodeArrayToMesh(A,A.byteLength,u);else if(g===r.POINT_CLOUD)u=new r.PointCloud,d=o.DecodeArrayToPointCloud(A,A.byteLength,u);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!d.ok()||u.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+d.error_msg());const p={index:null,attributes:[]};for(const f in c){const m=self[l[f]];let y,C;if(h.useUniqueIDs)C=c[f],y=o.GetAttributeByUniqueId(u,C);else{if(C=o.GetAttributeId(u,r[c[f]]),C===-1)continue;y=o.GetAttribute(u,C)}const E=i(r,o,u,f,m,y);f==="color"&&(E.vertexColorSpace=h.vertexColorSpace),p.attributes.push(E)}return g===r.TRIANGULAR_MESH&&(p.index=s(r,o,u)),r.destroy(u),p}function s(r,o,A){const c=A.num_faces()*3,l=c*4,u=r._malloc(l);o.GetTrianglesUInt32Array(A,l,u);const d=new Uint32Array(r.HEAPF32.buffer,u,c).slice();return r._free(u),{array:d,itemSize:1}}function i(r,o,A,h,c,l){const u=l.num_components(),g=A.num_points()*u,p=g*c.BYTES_PER_ELEMENT,f=n(r,c),m=r._malloc(p);o.GetAttributeDataArrayForAllPoints(A,l,f,p,m);const y=new c(r.HEAPF32.buffer,m,g).slice();return r._free(m),{name:h,array:y,itemSize:u}}function n(r,o){switch(o){case Float32Array:return r.DT_FLOAT32;case Int8Array:return r.DT_INT8;case Int16Array:return r.DT_INT16;case Int32Array:return r.DT_INT32;case Uint8Array:return r.DT_UINT8;case Uint16Array:return r.DT_UINT16;case Uint32Array:return r.DT_UINT32}}}function Ma(a,e){if(e===CA)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),a;if(e===Wi||e===Gr){let t=a.getIndex();if(t===null){const r=[],o=a.getAttribute("position");if(o!==void 0){for(let A=0;A<o.count;A++)r.push(A);a.setIndex(r),t=a.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),a}const s=t.count-2,i=[];if(e===Wi)for(let r=1;r<=s;r++)i.push(t.getX(0)),i.push(t.getX(r)),i.push(t.getX(r+1));else for(let r=0;r<s;r++)r%2===0?(i.push(t.getX(r)),i.push(t.getX(r+1)),i.push(t.getX(r+2))):(i.push(t.getX(r+2)),i.push(t.getX(r+1)),i.push(t.getX(r)));i.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const n=a.clone();return n.setIndex(i),n.clearGroups(),n}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),a}class Ad extends gt{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new dd(t)}),this.register(function(t){return new gd(t)}),this.register(function(t){return new Bd(t)}),this.register(function(t){return new xd(t)}),this.register(function(t){return new Qd(t)}),this.register(function(t){return new fd(t)}),this.register(function(t){return new md(t)}),this.register(function(t){return new Id(t)}),this.register(function(t){return new bd(t)}),this.register(function(t){return new ud(t)}),this.register(function(t){return new yd(t)}),this.register(function(t){return new pd(t)}),this.register(function(t){return new Cd(t)}),this.register(function(t){return new Ed(t)}),this.register(function(t){return new cd(t)}),this.register(function(t){return new wd(t)}),this.register(function(t){return new Td(t)})}load(e,t,s,i){const n=this;let r;if(this.resourcePath!=="")r=this.resourcePath;else if(this.path!==""){const h=Ns.extractUrlBase(e);r=Ns.resolveURL(h,this.path)}else r=Ns.extractUrlBase(e);this.manager.itemStart(e);const o=function(h){i?i(h):console.error(h),n.manager.itemError(e),n.manager.itemEnd(e)},A=new wt(this.manager);A.setPath(this.path),A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setWithCredentials(this.withCredentials),A.load(e,function(h){try{n.parse(h,r,function(c){t(c),n.manager.itemEnd(e)},o)}catch(c){o(c)}},s,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,s,i){let n,r;const o={},A={},h=new TextDecoder;if(typeof e=="string")try{n=JSON.parse(e)}catch(l){r=e,i&&i(l);return}else if(e instanceof ArrayBuffer)if(h.decode(new Uint8Array(e,0,4))===Na){try{o[k.KHR_BINARY_GLTF]=new Sd(e)}catch(u){i&&i(u);return}try{n=JSON.parse(o[k.KHR_BINARY_GLTF].content)}catch(u){r=o[k.KHR_BINARY_GLTF].content,i&&i(u);return}}else try{n=JSON.parse(h.decode(e))}catch(u){r=h.decode(e),i&&i(u);return}else n=e;if(n.asset===void 0||n.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}this.json=n,this.jsonErrorData=r;const c=new zd(n,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let l=0;l<this.pluginCallbacks.length;l++){const u=this.pluginCallbacks[l](c);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),A[u.name]=u,o[u.name]=!0}if(n.extensionsUsed)for(let l=0;l<n.extensionsUsed.length;++l){const u=n.extensionsUsed[l],d=n.extensionsRequired||[];switch(u){case k.KHR_MATERIALS_UNLIT:o[u]=new ld;break;case k.KHR_DRACO_MESH_COMPRESSION:o[u]=new Md(n,this.dracoLoader);break;case k.KHR_TEXTURE_TRANSFORM:o[u]=new Nd;break;case k.KHR_MESH_QUANTIZATION:o[u]=new Rd;break;default:d.indexOf(u)>=0&&A[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(o),c.setPlugins(A),c.parse(s,i)}parseAsync(e,t){const s=this;return new Promise(function(i,n){s.parse(e,t,i,n)})}}function hd(){let a={};return{get:function(e){return a[e]},add:function(e,t){a[e]=t},remove:function(e){delete a[e]},removeAll:function(){a={}}}}const k={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class cd{constructor(e){this.parser=e,this.name=k.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let s=0,i=t.length;s<i;s++){const n=t[s];n.extensions&&n.extensions[this.name]&&n.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,n.extensions[this.name].light)}}_loadLight(e){const t=this.parser,s="light:"+e;let i=t.cache.get(s);if(i)return i;const n=t.json,A=((n.extensions&&n.extensions[this.name]||{}).lights||[])[e];let h;const c=new X(16777215);A.color!==void 0&&c.setRGB(A.color[0],A.color[1],A.color[2],de);const l=A.range!==void 0?A.range:0;switch(A.type){case"directional":h=new Gh(c),h.target.position.set(0,0,-1),h.add(h.target);break;case"point":h=new Lh(c),h.distance=l;break;case"spot":h=new kh(c),h.distance=l,A.spot=A.spot||{},A.spot.innerConeAngle=A.spot.innerConeAngle!==void 0?A.spot.innerConeAngle:0,A.spot.outerConeAngle=A.spot.outerConeAngle!==void 0?A.spot.outerConeAngle:Math.PI/4,h.angle=A.spot.outerConeAngle,h.penumbra=1-A.spot.innerConeAngle/A.spot.outerConeAngle,h.target.position.set(0,0,-1),h.add(h.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+A.type)}return h.position.set(0,0,0),h.decay=2,tt(h,A),A.intensity!==void 0&&(h.intensity=A.intensity),h.name=t.createUniqueName(A.name||"light_"+e),i=Promise.resolve(h),t.cache.add(s,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,s=this.parser,n=s.json.nodes[e],o=(n.extensions&&n.extensions[this.name]||{}).light;return o===void 0?null:this._loadLight(o).then(function(A){return s._getNodeRef(t.cache,o,A)})}}class ld{constructor(){this.name=k.KHR_MATERIALS_UNLIT}getMaterialType(){return Wt}extendParams(e,t,s){const i=[];e.color=new X(1,1,1),e.opacity=1;const n=t.pbrMetallicRoughness;if(n){if(Array.isArray(n.baseColorFactor)){const r=n.baseColorFactor;e.color.setRGB(r[0],r[1],r[2],de),e.opacity=r[3]}n.baseColorTexture!==void 0&&i.push(s.assignTexture(e,"map",n.baseColorTexture,ie))}return Promise.all(i)}}class ud{constructor(e){this.parser=e,this.name=k.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const n=i.extensions[this.name].emissiveStrength;return n!==void 0&&(t.emissiveIntensity=n),Promise.resolve()}}class dd{constructor(e){this.parser=e,this.name=k.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:Ue}extendMaterialParams(e,t){const s=this.parser,i=s.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const n=[],r=i.extensions[this.name];if(r.clearcoatFactor!==void 0&&(t.clearcoat=r.clearcoatFactor),r.clearcoatTexture!==void 0&&n.push(s.assignTexture(t,"clearcoatMap",r.clearcoatTexture)),r.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=r.clearcoatRoughnessFactor),r.clearcoatRoughnessTexture!==void 0&&n.push(s.assignTexture(t,"clearcoatRoughnessMap",r.clearcoatRoughnessTexture)),r.clearcoatNormalTexture!==void 0&&(n.push(s.assignTexture(t,"clearcoatNormalMap",r.clearcoatNormalTexture)),r.clearcoatNormalTexture.scale!==void 0)){const o=r.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new q(o,o)}return Promise.all(n)}}class gd{constructor(e){this.parser=e,this.name=k.KHR_MATERIALS_DISPERSION}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:Ue}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const n=i.extensions[this.name];return t.dispersion=n.dispersion!==void 0?n.dispersion:0,Promise.resolve()}}class pd{constructor(e){this.parser=e,this.name=k.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:Ue}extendMaterialParams(e,t){const s=this.parser,i=s.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const n=[],r=i.extensions[this.name];return r.iridescenceFactor!==void 0&&(t.iridescence=r.iridescenceFactor),r.iridescenceTexture!==void 0&&n.push(s.assignTexture(t,"iridescenceMap",r.iridescenceTexture)),r.iridescenceIor!==void 0&&(t.iridescenceIOR=r.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),r.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=r.iridescenceThicknessMinimum),r.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=r.iridescenceThicknessMaximum),r.iridescenceThicknessTexture!==void 0&&n.push(s.assignTexture(t,"iridescenceThicknessMap",r.iridescenceThicknessTexture)),Promise.all(n)}}class fd{constructor(e){this.parser=e,this.name=k.KHR_MATERIALS_SHEEN}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:Ue}extendMaterialParams(e,t){const s=this.parser,i=s.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const n=[];t.sheenColor=new X(0,0,0),t.sheenRoughness=0,t.sheen=1;const r=i.extensions[this.name];if(r.sheenColorFactor!==void 0){const o=r.sheenColorFactor;t.sheenColor.setRGB(o[0],o[1],o[2],de)}return r.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=r.sheenRoughnessFactor),r.sheenColorTexture!==void 0&&n.push(s.assignTexture(t,"sheenColorMap",r.sheenColorTexture,ie)),r.sheenRoughnessTexture!==void 0&&n.push(s.assignTexture(t,"sheenRoughnessMap",r.sheenRoughnessTexture)),Promise.all(n)}}class md{constructor(e){this.parser=e,this.name=k.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:Ue}extendMaterialParams(e,t){const s=this.parser,i=s.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const n=[],r=i.extensions[this.name];return r.transmissionFactor!==void 0&&(t.transmission=r.transmissionFactor),r.transmissionTexture!==void 0&&n.push(s.assignTexture(t,"transmissionMap",r.transmissionTexture)),Promise.all(n)}}class Id{constructor(e){this.parser=e,this.name=k.KHR_MATERIALS_VOLUME}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:Ue}extendMaterialParams(e,t){const s=this.parser,i=s.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const n=[],r=i.extensions[this.name];t.thickness=r.thicknessFactor!==void 0?r.thicknessFactor:0,r.thicknessTexture!==void 0&&n.push(s.assignTexture(t,"thicknessMap",r.thicknessTexture)),t.attenuationDistance=r.attenuationDistance||1/0;const o=r.attenuationColor||[1,1,1];return t.attenuationColor=new X().setRGB(o[0],o[1],o[2],de),Promise.all(n)}}class bd{constructor(e){this.parser=e,this.name=k.KHR_MATERIALS_IOR}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:Ue}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const n=i.extensions[this.name];return t.ior=n.ior!==void 0?n.ior:1.5,Promise.resolve()}}class yd{constructor(e){this.parser=e,this.name=k.KHR_MATERIALS_SPECULAR}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:Ue}extendMaterialParams(e,t){const s=this.parser,i=s.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const n=[],r=i.extensions[this.name];t.specularIntensity=r.specularFactor!==void 0?r.specularFactor:1,r.specularTexture!==void 0&&n.push(s.assignTexture(t,"specularIntensityMap",r.specularTexture));const o=r.specularColorFactor||[1,1,1];return t.specularColor=new X().setRGB(o[0],o[1],o[2],de),r.specularColorTexture!==void 0&&n.push(s.assignTexture(t,"specularColorMap",r.specularColorTexture,ie)),Promise.all(n)}}class Ed{constructor(e){this.parser=e,this.name=k.EXT_MATERIALS_BUMP}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:Ue}extendMaterialParams(e,t){const s=this.parser,i=s.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const n=[],r=i.extensions[this.name];return t.bumpScale=r.bumpFactor!==void 0?r.bumpFactor:1,r.bumpTexture!==void 0&&n.push(s.assignTexture(t,"bumpMap",r.bumpTexture)),Promise.all(n)}}class Cd{constructor(e){this.parser=e,this.name=k.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:Ue}extendMaterialParams(e,t){const s=this.parser,i=s.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const n=[],r=i.extensions[this.name];return r.anisotropyStrength!==void 0&&(t.anisotropy=r.anisotropyStrength),r.anisotropyRotation!==void 0&&(t.anisotropyRotation=r.anisotropyRotation),r.anisotropyTexture!==void 0&&n.push(s.assignTexture(t,"anisotropyMap",r.anisotropyTexture)),Promise.all(n)}}class Bd{constructor(e){this.parser=e,this.name=k.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,s=t.json,i=s.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const n=i.extensions[this.name],r=t.options.ktx2Loader;if(!r){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,n.source,r)}}class xd{constructor(e){this.parser=e,this.name=k.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,i=s.json,n=i.textures[e];if(!n.extensions||!n.extensions[t])return null;const r=n.extensions[t],o=i.images[r.source];let A=s.textureLoader;if(o.uri){const h=s.options.manager.getHandler(o.uri);h!==null&&(A=h)}return this.detectSupport().then(function(h){if(h)return s.loadTextureImage(e,r.source,A);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return s.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class Qd{constructor(e){this.parser=e,this.name=k.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,i=s.json,n=i.textures[e];if(!n.extensions||!n.extensions[t])return null;const r=n.extensions[t],o=i.images[r.source];let A=s.textureLoader;if(o.uri){const h=s.options.manager.getHandler(o.uri);h!==null&&(A=h)}return this.detectSupport().then(function(h){if(h)return s.loadTextureImage(e,r.source,A);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return s.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class wd{constructor(e){this.name=k.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,s=t.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const i=s.extensions[this.name],n=this.parser.getDependency("buffer",i.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return n.then(function(o){const A=i.byteOffset||0,h=i.byteLength||0,c=i.count,l=i.byteStride,u=new Uint8Array(o,A,h);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(c,l,u,i.mode,i.filter).then(function(d){return d.buffer}):r.ready.then(function(){const d=new ArrayBuffer(c*l);return r.decodeGltfBuffer(new Uint8Array(d),c,l,u,i.mode,i.filter),d})})}else return null}}class Td{constructor(e){this.name=k.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,s=t.nodes[e];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const i=t.meshes[s.mesh];for(const h of i.primitives)if(h.mode!==Se.TRIANGLES&&h.mode!==Se.TRIANGLE_STRIP&&h.mode!==Se.TRIANGLE_FAN&&h.mode!==void 0)return null;const r=s.extensions[this.name].attributes,o=[],A={};for(const h in r)o.push(this.parser.getDependency("accessor",r[h]).then(c=>(A[h]=c,A[h])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(h=>{const c=h.pop(),l=c.isGroup?c.children:[c],u=h[0].count,d=[];for(const g of l){const p=new _,f=new b,m=new ot,y=new b(1,1,1),C=new uh(g.geometry,g.material,u);for(let E=0;E<u;E++)A.TRANSLATION&&f.fromBufferAttribute(A.TRANSLATION,E),A.ROTATION&&m.fromBufferAttribute(A.ROTATION,E),A.SCALE&&y.fromBufferAttribute(A.SCALE,E),C.setMatrixAt(E,p.compose(f,m,y));for(const E in A)if(E==="_COLOR_0"){const w=A[E];C.instanceColor=new Mn(w.array,w.itemSize,w.normalized)}else E!=="TRANSLATION"&&E!=="ROTATION"&&E!=="SCALE"&&g.geometry.setAttribute(E,A[E]);Y.prototype.copy.call(C,g),this.parser.assignFinalMaterial(C),d.push(C)}return c.isGroup?(c.clear(),c.add(...d),c):d[0]}))}}const Na="glTF",Hs=12,Ra={JSON:1313821514,BIN:5130562};class Sd{constructor(e){this.name=k.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Hs),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Na)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-Hs,n=new DataView(e,Hs);let r=0;for(;r<i;){const o=n.getUint32(r,!0);r+=4;const A=n.getUint32(r,!0);if(r+=4,A===Ra.JSON){const h=new Uint8Array(e,Hs+r,o);this.content=s.decode(h)}else if(A===Ra.BIN){const h=Hs+r;this.body=e.slice(h,h+o)}r+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Md{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=k.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const s=this.json,i=this.dracoLoader,n=e.extensions[this.name].bufferView,r=e.extensions[this.name].attributes,o={},A={},h={};for(const c in r){const l=cr[c]||c.toLowerCase();o[l]=r[c]}for(const c in e.attributes){const l=cr[c]||c.toLowerCase();if(r[c]!==void 0){const u=s.accessors[e.attributes[c]],d=ls[u.componentType];h[l]=d.name,A[l]=u.normalized===!0}}return t.getDependency("bufferView",n).then(function(c){return new Promise(function(l,u){i.decodeDracoFile(c,function(d){for(const g in d.attributes){const p=d.attributes[g],f=A[g];f!==void 0&&(p.normalized=f)}l(d)},o,h,de,u)})})}}class Nd{constructor(){this.name=k.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class Rd{constructor(){this.name=k.KHR_MESH_QUANTIZATION}}class Fa extends Ss{constructor(e,t,s,i){super(e,t,s,i)}copySampleValue_(e){const t=this.resultBuffer,s=this.sampleValues,i=this.valueSize,n=e*i*3+i;for(let r=0;r!==i;r++)t[r]=s[n+r];return t}interpolate_(e,t,s,i){const n=this.resultBuffer,r=this.sampleValues,o=this.valueSize,A=o*2,h=o*3,c=i-t,l=(s-t)/c,u=l*l,d=u*l,g=e*h,p=g-h,f=-2*d+3*u,m=d-u,y=1-f,C=m-u+l;for(let E=0;E!==o;E++){const w=r[p+E+o],S=r[p+E+A]*c,M=r[g+E+o],R=r[g+E]*c;n[E]=y*w+C*S+f*M+m*R}return n}}const Fd=new ot;class Dd extends Fa{interpolate_(e,t,s,i){const n=super.interpolate_(e,t,s,i);return Fd.fromArray(n).normalize().toArray(n),n}}const Se={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},ls={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Da={9728:je,9729:Rt,9984:AA,9985:cA,9986:hA,9987:ds},ka={33071:mt,33648:Vi,10497:us},hr={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},cr={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},ft={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},kd={CUBICSPLINE:void 0,LINEAR:fs,STEP:ps},lr={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function _d(a){return a.DefaultMaterial===void 0&&(a.DefaultMaterial=new Dn({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Js})),a.DefaultMaterial}function Nt(a,e,t){for(const s in t.extensions)a[s]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[s]=t.extensions[s])}function tt(a,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(a.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Ld(a,e,t){let s=!1,i=!1,n=!1;for(let h=0,c=e.length;h<c;h++){const l=e[h];if(l.POSITION!==void 0&&(s=!0),l.NORMAL!==void 0&&(i=!0),l.COLOR_0!==void 0&&(n=!0),s&&i&&n)break}if(!s&&!i&&!n)return Promise.resolve(a);const r=[],o=[],A=[];for(let h=0,c=e.length;h<c;h++){const l=e[h];if(s){const u=l.POSITION!==void 0?t.getDependency("accessor",l.POSITION):a.attributes.position;r.push(u)}if(i){const u=l.NORMAL!==void 0?t.getDependency("accessor",l.NORMAL):a.attributes.normal;o.push(u)}if(n){const u=l.COLOR_0!==void 0?t.getDependency("accessor",l.COLOR_0):a.attributes.color;A.push(u)}}return Promise.all([Promise.all(r),Promise.all(o),Promise.all(A)]).then(function(h){const c=h[0],l=h[1],u=h[2];return s&&(a.morphAttributes.position=c),i&&(a.morphAttributes.normal=l),n&&(a.morphAttributes.color=u),a.morphTargetsRelative=!0,a})}function vd(a,e){if(a.updateMorphTargets(),e.weights!==void 0)for(let t=0,s=e.weights.length;t<s;t++)a.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(a.morphTargetInfluences.length===t.length){a.morphTargetDictionary={};for(let s=0,i=t.length;s<i;s++)a.morphTargetDictionary[t[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Gd(a){let e;const t=a.extensions&&a.extensions[k.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+ur(t.attributes):e=a.indices+":"+ur(a.attributes)+":"+a.mode,a.targets!==void 0)for(let s=0,i=a.targets.length;s<i;s++)e+=":"+ur(a.targets[s]);return e}function ur(a){let e="";const t=Object.keys(a).sort();for(let s=0,i=t.length;s<i;s++)e+=t[s]+":"+a[t[s]]+";";return e}function dr(a){switch(a){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Od(a){return a.search(/\.jpe?g($|\?)/i)>0||a.search(/^data\:image\/jpeg/)===0?"image/jpeg":a.search(/\.webp($|\?)/i)>0||a.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Ud=new _;class zd{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new hd,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,i=-1,n=!1,r=-1;if(typeof navigator<"u"){const o=navigator.userAgent;s=/^((?!chrome|android).)*safari/i.test(o)===!0;const A=o.match(/Version\/(\d+)/);i=s&&A?parseInt(A[1],10):-1,n=o.indexOf("Firefox")>-1,r=n?o.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||s&&i<17||n&&r<98?this.textureLoader=new Fh(this.options.manager):this.textureLoader=new Oh(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new wt(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const s=this,i=this.json,n=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(r){return r._markDefs&&r._markDefs()}),Promise.all(this._invokeAll(function(r){return r.beforeRoot&&r.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(r){const o={scene:r[0][i.scene||0],scenes:r[0],animations:r[1],cameras:r[2],asset:i.asset,parser:s,userData:{}};return Nt(n,o,i),tt(o,i),Promise.all(s._invokeAll(function(A){return A.afterRoot&&A.afterRoot(o)})).then(function(){for(const A of o.scenes)A.updateMatrixWorld();e(o)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],s=this.json.meshes||[];for(let i=0,n=t.length;i<n;i++){const r=t[i].joints;for(let o=0,A=r.length;o<A;o++)e[r[o]].isBone=!0}for(let i=0,n=e.length;i<n;i++){const r=e[i];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(s[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,s){if(e.refs[t]<=1)return s;const i=s.clone(),n=(r,o)=>{const A=this.associations.get(r);A!=null&&this.associations.set(o,A);for(const[h,c]of r.children.entries())n(c,o.children[h])};return n(s,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let s=0;s<t.length;s++){const i=e(t[s]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const s=[];for(let i=0;i<t.length;i++){const n=e(t[i]);n&&s.push(n)}return s}getDependency(e,t){const s=e+":"+t;let i=this.cache.get(s);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(n){return n.loadNode&&n.loadNode(t)});break;case"mesh":i=this._invokeOne(function(n){return n.loadMesh&&n.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(n){return n.loadBufferView&&n.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(n){return n.loadMaterial&&n.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(n){return n.loadTexture&&n.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(n){return n.loadAnimation&&n.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(s,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const s=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(n,r){return s.getDependency(e,r)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],s=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[k.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(n,r){s.load(Ns.resolveURL(t.uri,i.path),n,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(s){const i=t.byteLength||0,n=t.byteOffset||0;return s.slice(n,n+i)})}loadAccessor(e){const t=this,s=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const r=hr[i.type],o=ls[i.componentType],A=i.normalized===!0,h=new o(i.count*r);return Promise.resolve(new ye(h,r,A))}const n=[];return i.bufferView!==void 0?n.push(this.getDependency("bufferView",i.bufferView)):n.push(null),i.sparse!==void 0&&(n.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),n.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(n).then(function(r){const o=r[0],A=hr[i.type],h=ls[i.componentType],c=h.BYTES_PER_ELEMENT,l=c*A,u=i.byteOffset||0,d=i.bufferView!==void 0?s.bufferViews[i.bufferView].byteStride:void 0,g=i.normalized===!0;let p,f;if(d&&d!==l){const m=Math.floor(u/d),y="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+m+":"+i.count;let C=t.cache.get(y);C||(p=new h(o,m*d,i.count*d/c),C=new po(p,d/c),t.cache.add(y,C)),f=new pi(C,A,u%d/c,g)}else o===null?p=new h(i.count*A):p=new h(o,u,i.count*A),f=new ye(p,A,g);if(i.sparse!==void 0){const m=hr.SCALAR,y=ls[i.sparse.indices.componentType],C=i.sparse.indices.byteOffset||0,E=i.sparse.values.byteOffset||0,w=new y(r[1],C,i.sparse.count*m),S=new h(r[2],E,i.sparse.count*A);o!==null&&(f=new ye(f.array.slice(),f.itemSize,f.normalized)),f.normalized=!1;for(let M=0,R=w.length;M<R;M++){const D=w[M];if(f.setX(D,S[M*A]),A>=2&&f.setY(D,S[M*A+1]),A>=3&&f.setZ(D,S[M*A+2]),A>=4&&f.setW(D,S[M*A+3]),A>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}f.normalized=g}return f})}loadTexture(e){const t=this.json,s=this.options,n=t.textures[e].source,r=t.images[n];let o=this.textureLoader;if(r.uri){const A=s.manager.getHandler(r.uri);A!==null&&(o=A)}return this.loadTextureImage(e,n,o)}loadTextureImage(e,t,s){const i=this,n=this.json,r=n.textures[e],o=n.images[t],A=(o.uri||o.bufferView)+":"+r.sampler;if(this.textureCache[A])return this.textureCache[A];const h=this.loadImageSource(t,s).then(function(c){c.flipY=!1,c.name=r.name||o.name||"",c.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(c.name=o.uri);const u=(n.samplers||{})[r.sampler]||{};return c.magFilter=Da[u.magFilter]||Rt,c.minFilter=Da[u.minFilter]||ds,c.wrapS=ka[u.wrapS]||us,c.wrapT=ka[u.wrapT]||us,c.anisotropy=4,i.associations.set(c,{textures:e}),c}).catch(function(){return null});return this.textureCache[A]=h,h}loadImageSource(e,t){const s=this,i=this.json,n=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(l=>l.clone());const r=i.images[e],o=self.URL||self.webkitURL;let A=r.uri||"",h=!1;if(r.bufferView!==void 0)A=s.getDependency("bufferView",r.bufferView).then(function(l){h=!0;const u=new Blob([l],{type:r.mimeType});return A=o.createObjectURL(u),A});else if(r.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const c=Promise.resolve(A).then(function(l){return new Promise(function(u,d){let g=u;t.isImageBitmapLoader===!0&&(g=function(p){const f=new le(p);f.needsUpdate=!0,u(f)}),t.load(Ns.resolveURL(l,n.path),g,void 0,d)})}).then(function(l){return h===!0&&o.revokeObjectURL(A),tt(l,r),l.userData.mimeType=r.mimeType||Od(r.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",A),l});return this.sourceCache[e]=c,c}assignTexture(e,t,s,i){const n=this;return this.getDependency("texture",s.index).then(function(r){if(!r)return null;if(s.texCoord!==void 0&&s.texCoord>0&&(r=r.clone(),r.channel=s.texCoord),n.extensions[k.KHR_TEXTURE_TRANSFORM]){const o=s.extensions!==void 0?s.extensions[k.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const A=n.associations.get(r);r=n.extensions[k.KHR_TEXTURE_TRANSFORM].extendTexture(r,o),n.associations.set(r,A)}}return i!==void 0&&(r.colorSpace=i),e[t]=r,r})}assignFinalMaterial(e){const t=e.geometry;let s=e.material;const i=t.attributes.tangent===void 0,n=t.attributes.color!==void 0,r=t.attributes.normal===void 0;if(e.isPoints){const o="PointsMaterial:"+s.uuid;let A=this.cache.get(o);A||(A=new No,Et.prototype.copy.call(A,s),A.color.copy(s.color),A.map=s.map,A.sizeAttenuation=!1,this.cache.add(o,A)),s=A}else if(e.isLine){const o="LineBasicMaterial:"+s.uuid;let A=this.cache.get(o);A||(A=new Qo,Et.prototype.copy.call(A,s),A.color.copy(s.color),A.map=s.map,this.cache.add(o,A)),s=A}if(i||n||r){let o="ClonedMaterial:"+s.uuid+":";i&&(o+="derivative-tangents:"),n&&(o+="vertex-colors:"),r&&(o+="flat-shading:");let A=this.cache.get(o);A||(A=s.clone(),n&&(A.vertexColors=!0),r&&(A.flatShading=!0),i&&(A.normalScale&&(A.normalScale.y*=-1),A.clearcoatNormalScale&&(A.clearcoatNormalScale.y*=-1)),this.cache.add(o,A),this.associations.set(A,this.associations.get(s))),s=A}e.material=s}getMaterialType(){return Dn}loadMaterial(e){const t=this,s=this.json,i=this.extensions,n=s.materials[e];let r;const o={},A=n.extensions||{},h=[];if(A[k.KHR_MATERIALS_UNLIT]){const l=i[k.KHR_MATERIALS_UNLIT];r=l.getMaterialType(),h.push(l.extendParams(o,n,t))}else{const l=n.pbrMetallicRoughness||{};if(o.color=new X(1,1,1),o.opacity=1,Array.isArray(l.baseColorFactor)){const u=l.baseColorFactor;o.color.setRGB(u[0],u[1],u[2],de),o.opacity=u[3]}l.baseColorTexture!==void 0&&h.push(t.assignTexture(o,"map",l.baseColorTexture,ie)),o.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,o.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(h.push(t.assignTexture(o,"metalnessMap",l.metallicRoughnessTexture)),h.push(t.assignTexture(o,"roughnessMap",l.metallicRoughnessTexture))),r=this._invokeOne(function(u){return u.getMaterialType&&u.getMaterialType(e)}),h.push(Promise.all(this._invokeAll(function(u){return u.extendMaterialParams&&u.extendMaterialParams(e,o)})))}n.doubleSided===!0&&(o.side=nA);const c=n.alphaMode||lr.OPAQUE;if(c===lr.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,c===lr.MASK&&(o.alphaTest=n.alphaCutoff!==void 0?n.alphaCutoff:.5)),n.normalTexture!==void 0&&r!==Wt&&(h.push(t.assignTexture(o,"normalMap",n.normalTexture)),o.normalScale=new q(1,1),n.normalTexture.scale!==void 0)){const l=n.normalTexture.scale;o.normalScale.set(l,l)}if(n.occlusionTexture!==void 0&&r!==Wt&&(h.push(t.assignTexture(o,"aoMap",n.occlusionTexture)),n.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=n.occlusionTexture.strength)),n.emissiveFactor!==void 0&&r!==Wt){const l=n.emissiveFactor;o.emissive=new X().setRGB(l[0],l[1],l[2],de)}return n.emissiveTexture!==void 0&&r!==Wt&&h.push(t.assignTexture(o,"emissiveMap",n.emissiveTexture,ie)),Promise.all(h).then(function(){const l=new r(o);return n.name&&(l.name=n.name),tt(l,n),t.associations.set(l,{materials:e}),n.extensions&&Nt(i,l,n),l})}createUniqueName(e){const t=P.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,s=this.extensions,i=this.primitiveCache;function n(o){return s[k.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(A){return _a(A,o,t)})}const r=[];for(let o=0,A=e.length;o<A;o++){const h=e[o],c=Gd(h),l=i[c];if(l)r.push(l.promise);else{let u;h.extensions&&h.extensions[k.KHR_DRACO_MESH_COMPRESSION]?u=n(h):u=_a(new Ct,h,t),i[c]={primitive:h,promise:u},r.push(u)}}return Promise.all(r)}loadMesh(e){const t=this,s=this.json,i=this.extensions,n=s.meshes[e],r=n.primitives,o=[];for(let A=0,h=r.length;A<h;A++){const c=r[A].material===void 0?_d(this.cache):this.getDependency("material",r[A].material);o.push(c)}return o.push(t.loadGeometries(r)),Promise.all(o).then(function(A){const h=A.slice(0,A.length-1),c=A[A.length-1],l=[];for(let d=0,g=c.length;d<g;d++){const p=c[d],f=r[d];let m;const y=h[d];if(f.mode===Se.TRIANGLES||f.mode===Se.TRIANGLE_STRIP||f.mode===Se.TRIANGLE_FAN||f.mode===void 0)m=n.isSkinnedMesh===!0?new hh(p,y):new ui(p,y),m.isSkinnedMesh===!0&&m.normalizeSkinWeights(),f.mode===Se.TRIANGLE_STRIP?m.geometry=Ma(m.geometry,Gr):f.mode===Se.TRIANGLE_FAN&&(m.geometry=Ma(m.geometry,Wi));else if(f.mode===Se.LINES)m=new dh(p,y);else if(f.mode===Se.LINE_STRIP)m=new Rn(p,y);else if(f.mode===Se.LINE_LOOP)m=new gh(p,y);else if(f.mode===Se.POINTS)m=new ph(p,y);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);Object.keys(m.geometry.morphAttributes).length>0&&vd(m,n),m.name=t.createUniqueName(n.name||"mesh_"+e),tt(m,n),f.extensions&&Nt(i,m,f),t.assignFinalMaterial(m),l.push(m)}for(let d=0,g=l.length;d<g;d++)t.associations.set(l[d],{meshes:e,primitives:d});if(l.length===1)return n.extensions&&Nt(i,l[0],n),l[0];const u=new xn;n.extensions&&Nt(i,u,n),t.associations.set(u,{meshes:e});for(let d=0,g=l.length;d<g;d++)u.add(l[d]);return u})}loadCamera(e){let t;const s=this.json.cameras[e],i=s[s.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?t=new Cn(Vr.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):s.type==="orthographic"&&(t=new uo(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),s.name&&(t.name=this.createUniqueName(s.name)),tt(t,s),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],s=[];for(let i=0,n=t.joints.length;i<n;i++)s.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",t.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(i){const n=i.pop(),r=i,o=[],A=[];for(let h=0,c=r.length;h<c;h++){const l=r[h];if(l){o.push(l);const u=new _;n!==null&&u.fromArray(n.array,h*16),A.push(u)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[h])}return new Sn(o,A)})}loadAnimation(e){const t=this.json,s=this,i=t.animations[e],n=i.name?i.name:"animation_"+e,r=[],o=[],A=[],h=[],c=[];let l=0,u=i.channels.length;for(l=0,u=i.channels.length;l<u;l++){const d=i.channels[l],g=i.samplers[d.sampler],p=d.target,f=p.node,m=i.parameters!==void 0?i.parameters[g.input]:g.input,y=i.parameters!==void 0?i.parameters[g.output]:g.output;p.node!==void 0&&(r.push(this.getDependency("node",f)),o.push(this.getDependency("accessor",m)),A.push(this.getDependency("accessor",y)),h.push(g),c.push(p))}return Promise.all([Promise.all(r),Promise.all(o),Promise.all(A),Promise.all(h),Promise.all(c)]).then(function(d){const g=d[0],p=d[1],f=d[2],m=d[3],y=d[4],C=[];for(l=0,u=g.length;l<u;l++){const E=g[l],w=p[l],S=f[l],M=m[l],R=y[l];if(E===void 0)continue;E.updateMatrix&&E.updateMatrix();const D=s._createAnimationTracks(E,w,S,M,R);if(D)for(let O=0;O<D.length;O++)C.push(D[O])}return new Qh(n,void 0,C)})}createNodeMesh(e){const t=this.json,s=this,i=t.nodes[e];return i.mesh===void 0?null:s.getDependency("mesh",i.mesh).then(function(n){const r=s._getNodeRef(s.meshCache,i.mesh,n);return i.weights!==void 0&&r.traverse(function(o){if(o.isMesh)for(let A=0,h=i.weights.length;A<h;A++)o.morphTargetInfluences[A]=i.weights[A]}),r})}loadNode(e){const t=this.json,s=this,i=t.nodes[e],n=s._loadNodeShallow(e),r=[],o=i.children||[];for(let h=0,c=o.length;h<c;h++)r.push(s.getDependency("node",o[h]));const A=i.skin===void 0?Promise.resolve(null):s.getDependency("skin",i.skin);return Promise.all([n,Promise.all(r),A]).then(function(h){const c=h[0],l=h[1],u=h[2];u!==null&&c.traverse(function(d){d.isSkinnedMesh&&d.bind(u,Ud)});for(let d=0,g=l.length;d<g;d++)c.add(l[d]);return c})}_loadNodeShallow(e){const t=this.json,s=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const n=t.nodes[e],r=n.name?i.createUniqueName(n.name):"",o=[],A=i._invokeOne(function(h){return h.createNodeMesh&&h.createNodeMesh(e)});return A&&o.push(A),n.camera!==void 0&&o.push(i.getDependency("camera",n.camera).then(function(h){return i._getNodeRef(i.cameraCache,n.camera,h)})),i._invokeAll(function(h){return h.createNodeAttachment&&h.createNodeAttachment(e)}).forEach(function(h){o.push(h)}),this.nodeCache[e]=Promise.all(o).then(function(h){let c;if(n.isBone===!0?c=new Eo:h.length>1?c=new xn:h.length===1?c=h[0]:c=new Y,c!==h[0])for(let l=0,u=h.length;l<u;l++)c.add(h[l]);if(n.name&&(c.userData.name=n.name,c.name=r),tt(c,n),n.extensions&&Nt(s,c,n),n.matrix!==void 0){const l=new _;l.fromArray(n.matrix),c.applyMatrix4(l)}else n.translation!==void 0&&c.position.fromArray(n.translation),n.rotation!==void 0&&c.quaternion.fromArray(n.rotation),n.scale!==void 0&&c.scale.fromArray(n.scale);return i.associations.has(c)||i.associations.set(c,{}),i.associations.get(c).nodes=e,c}),this.nodeCache[e]}loadScene(e){const t=this.extensions,s=this.json.scenes[e],i=this,n=new xn;s.name&&(n.name=i.createUniqueName(s.name)),tt(n,s),s.extensions&&Nt(t,n,s);const r=s.nodes||[],o=[];for(let A=0,h=r.length;A<h;A++)o.push(i.getDependency("node",r[A]));return Promise.all(o).then(function(A){for(let c=0,l=A.length;c<l;c++)n.add(A[c]);const h=c=>{const l=new Map;for(const[u,d]of i.associations)(u instanceof Et||u instanceof le)&&l.set(u,d);return c.traverse(u=>{const d=i.associations.get(u);d!=null&&l.set(u,d)}),l};return i.associations=h(n),n})}_createAnimationTracks(e,t,s,i,n){const r=[],o=e.name?e.name:e.uuid,A=[];ft[n.path]===ft.weights?e.traverse(function(u){u.morphTargetInfluences&&A.push(u.name?u.name:u.uuid)}):A.push(o);let h;switch(ft[n.path]){case ft.weights:h=Zt;break;case ft.rotation:h=$t;break;case ft.position:case ft.scale:h=ts;break;default:switch(s.itemSize){case 1:h=Zt;break;case 2:case 3:default:h=ts;break}break}const c=i.interpolation!==void 0?kd[i.interpolation]:fs,l=this._getArrayFromAccessor(s);for(let u=0,d=A.length;u<d;u++){const g=new h(A[u]+"."+ft[n.path],t.array,l,c);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(g),r.push(g)}return r}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const s=dr(t.constructor),i=new Float32Array(t.length);for(let n=0,r=t.length;n<r;n++)i[n]=t[n]*s;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(s){const i=this instanceof $t?Dd:Fa;return new i(this.times,this.values,this.getValueSize()/3,s)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Pd(a,e,t){const s=e.attributes,i=new Je;if(s.POSITION!==void 0){const o=t.json.accessors[s.POSITION],A=o.min,h=o.max;if(A!==void 0&&h!==void 0){if(i.set(new b(A[0],A[1],A[2]),new b(h[0],h[1],h[2])),o.normalized){const c=dr(ls[o.componentType]);i.min.multiplyScalar(c),i.max.multiplyScalar(c)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const n=e.targets;if(n!==void 0){const o=new b,A=new b;for(let h=0,c=n.length;h<c;h++){const l=n[h];if(l.POSITION!==void 0){const u=t.json.accessors[l.POSITION],d=u.min,g=u.max;if(d!==void 0&&g!==void 0){if(A.setX(Math.max(Math.abs(d[0]),Math.abs(g[0]))),A.setY(Math.max(Math.abs(d[1]),Math.abs(g[1]))),A.setZ(Math.max(Math.abs(d[2]),Math.abs(g[2]))),u.normalized){const p=dr(ls[u.componentType]);A.multiplyScalar(p)}o.max(A)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(o)}a.boundingBox=i;const r=new Oe;i.getCenter(r.center),r.radius=i.min.distanceTo(i.max)/2,a.boundingSphere=r}function _a(a,e,t){const s=e.attributes,i=[];function n(r,o){return t.getDependency("accessor",r).then(function(A){a.setAttribute(o,A)})}for(const r in s){const o=cr[r]||r.toLowerCase();o in a.attributes||i.push(n(s[r],o))}if(e.indices!==void 0&&!a.index){const r=t.getDependency("accessor",e.indices).then(function(o){a.setIndex(o)});i.push(r)}return ce.workingColorSpace!==de&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ce.workingColorSpace}" not supported.`),tt(a,e),Pd(a,e,t),Promise.all(i).then(function(){return e.targets!==void 0?Ld(a,e.targets,t):a})}class Hd{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const s=this.workersResolve[e];if(s&&s(t),this.queue.length){const{resolve:i,msg:n,transfer:r}=this.queue.shift();this.workersResolve[e]=i,this.workers[e].postMessage(n,r)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(s=>{const i=this._getIdleWorker();i!==-1?(this._initWorker(i),this.workerStatus|=1<<i,this.workersResolve[i]=s,this.workers[i].postMessage(e,t)):this.queue.push({resolve:s,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const qd=0,La=2,Vd=1,va=2,jd=0,Jd=1,Wd=10,Kd=0,Ga=9,Oa=15,Ua=16,za=22,Pa=37,Ha=43,qa=76,Va=83,ja=97,Ja=100,Wa=103,Ka=109,Ya=165,Xa=166,Za=1000066e3;class Yd{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class qs{constructor(e,t,s,i){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,s),this._littleEndian=i,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+4294967296*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){const t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t){t===void 0&&(t=0);const s=this._offset;let i=0;for(;this._dataView.getUint8(this._offset)!==t&&i<e;)i++,this._offset++;return i<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+s,i)}}const pe=[171,75,84,88,32,50,48,187,13,10,26,10];function $a(a){return new TextDecoder().decode(a)}function Xd(a){const e=new Uint8Array(a.buffer,a.byteOffset,pe.length);if(e[0]!==pe[0]||e[1]!==pe[1]||e[2]!==pe[2]||e[3]!==pe[3]||e[4]!==pe[4]||e[5]!==pe[5]||e[6]!==pe[6]||e[7]!==pe[7]||e[8]!==pe[8]||e[9]!==pe[9]||e[10]!==pe[10]||e[11]!==pe[11])throw new Error("Missing KTX 2.0 identifier.");const t=new Yd,s=17*Uint32Array.BYTES_PER_ELEMENT,i=new qs(a,pe.length,s,!0);t.vkFormat=i._nextUint32(),t.typeSize=i._nextUint32(),t.pixelWidth=i._nextUint32(),t.pixelHeight=i._nextUint32(),t.pixelDepth=i._nextUint32(),t.layerCount=i._nextUint32(),t.faceCount=i._nextUint32();const n=i._nextUint32();t.supercompressionScheme=i._nextUint32();const r=i._nextUint32(),o=i._nextUint32(),A=i._nextUint32(),h=i._nextUint32(),c=i._nextUint64(),l=i._nextUint64(),u=new qs(a,pe.length+s,3*n*8,!0);for(let W=0;W<n;W++)t.levels.push({levelData:new Uint8Array(a.buffer,a.byteOffset+u._nextUint64(),u._nextUint64()),uncompressedByteLength:u._nextUint64()});const d=new qs(a,r,o,!0),g={vendorId:d._skip(4)._nextUint16(),descriptorType:d._nextUint16(),versionNumber:d._nextUint16(),descriptorBlockSize:d._nextUint16(),colorModel:d._nextUint8(),colorPrimaries:d._nextUint8(),transferFunction:d._nextUint8(),flags:d._nextUint8(),texelBlockDimension:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],bytesPlane:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],samples:[]},p=(g.descriptorBlockSize/4-6)/4;for(let W=0;W<p;W++){const oe={bitOffset:d._nextUint16(),bitLength:d._nextUint8(),channelType:d._nextUint8(),samplePosition:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&oe.channelType?(oe.sampleLower=d._nextInt32(),oe.sampleUpper=d._nextInt32()):(oe.sampleLower=d._nextUint32(),oe.sampleUpper=d._nextUint32()),g.samples[W]=oe}t.dataFormatDescriptor.length=0,t.dataFormatDescriptor.push(g);const f=new qs(a,A,h,!0);for(;f._offset<h;){const W=f._nextUint32(),oe=f._scan(W),Me=$a(oe);if(t.keyValue[Me]=f._nextUint8Array(W-oe.byteLength-1),Me.match(/^ktx/i)){const Ie=$a(t.keyValue[Me]);t.keyValue[Me]=Ie.substring(0,Ie.lastIndexOf("\0"))}f._skip(W%4?4-W%4:0)}if(l<=0)return t;const m=new qs(a,c,l,!0),y=m._nextUint16(),C=m._nextUint16(),E=m._nextUint32(),w=m._nextUint32(),S=m._nextUint32(),M=m._nextUint32(),R=[];for(let W=0;W<n;W++)R.push({imageFlags:m._nextUint32(),rgbSliceByteOffset:m._nextUint32(),rgbSliceByteLength:m._nextUint32(),alphaSliceByteOffset:m._nextUint32(),alphaSliceByteLength:m._nextUint32()});const D=c+m._offset,O=D+E,H=O+w,ae=H+S,J=new Uint8Array(a.buffer,a.byteOffset+D,E),Be=new Uint8Array(a.buffer,a.byteOffset+O,w),xe=new Uint8Array(a.buffer,a.byteOffset+H,S),it=new Uint8Array(a.buffer,a.byteOffset+ae,M);return t.globalData={endpointCount:y,selectorCount:C,imageDescs:R,endpointsData:J,selectorsData:Be,tablesData:xe,extendedData:it},t}let gr,st,pr;const fr={env:{emscripten_notify_memory_growth:function(a){pr=new Uint8Array(st.exports.memory.buffer)}}};class Zd{init(){return gr||(gr=typeof fetch<"u"?fetch("data:application/wasm;base64,"+eA).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,fr)).then(this._init):WebAssembly.instantiate(Buffer.from(eA,"base64"),fr).then(this._init),gr)}_init(e){st=e.instance,fr.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!st)throw new Error("ZSTDDecoder: Await .init() before decoding.");const s=e.byteLength,i=st.exports.malloc(s);pr.set(e,i),t=t||Number(st.exports.ZSTD_findDecompressedSize(i,s));const n=st.exports.malloc(t),r=st.exports.ZSTD_decompress(n,t,i,s),o=pr.slice(n,n+r);return st.exports.free(i),st.exports.free(n),o}}const eA="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38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ICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8a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ACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0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oAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGw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AAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",mr=new WeakMap;let Ir=0,br;class Ve extends gt{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new Hd,this.workerSourceURL="",this.workerConfig=null,typeof MSC_TRANSCODER<"u"&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return this.workerConfig={astcSupported:await e.hasFeatureAsync("texture-compression-astc"),etc1Supported:await e.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await e.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await e.hasFeatureAsync("texture-compression-bc"),bptcSupported:await e.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await e.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(e){return e.isWebGPURenderer===!0?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:e.hasFeature("texture-compression-bptc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}init(){if(!this.transcoderPending){const e=new wt(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),s=new wt(this.manager);s.setPath(this.transcoderPath),s.setResponseType("arraybuffer"),s.setWithCredentials(this.withCredentials);const i=s.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,i]).then(([n,r])=>{const o=Ve.BasisWorker.toString(),A=["/* constants */","let _EngineFormat = "+JSON.stringify(Ve.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(Ve.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Ve.BasisFormat),"/* basis_transcoder.js */",n,"/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(`
27
- `);this.workerSourceURL=URL.createObjectURL(new Blob([A])),this.transcoderBinary=r,this.workerPool.setWorkerCreator(()=>{const h=new Worker(this.workerSourceURL),c=this.transcoderBinary.slice(0);return h.postMessage({type:"init",config:this.workerConfig,transcoderBinary:c},[c]),h})}),Ir>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Ir++}return this.transcoderPending}load(e,t,s,i){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const n=new wt(this.manager);n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials),n.load(e,r=>{this.parse(r,t,i)},s,i)}parse(e,t,s){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(mr.has(e))return mr.get(e).promise.then(t).catch(s);this._createTexture(e).then(i=>t?t(i):null).catch(s)}_createTextureFrom(e,t){const{faces:s,width:i,height:n,format:r,type:o,error:A,dfdFlags:h}=e;if(o==="error")return Promise.reject(A);let c;if(t.faceCount===6)c=new Ih(s,r,Qe);else{const l=s[0].mipmaps;c=t.layerCount>1?new mh(l,i,n,t.layerCount,r,Qe):new xi(l,i,n,r,Qe)}return c.minFilter=s[0].mipmaps.length===1?Rt:ds,c.magFilter=Rt,c.generateMipmaps=!1,c.needsUpdate=!0,c.colorSpace=tA(t),c.premultiplyAlpha=!!(h&Vd),c}async _createTexture(e,t={}){const s=Xd(new Uint8Array(e));if(s.vkFormat!==Kd)return eg(s);const i=t,n=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:i},[e])).then(r=>this._createTextureFrom(r.data,s));return mr.set(e,{promise:n}),n}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Ir--,this}}Ve.BasisFormat={ETC1S:0,UASTC_4x4:1},Ve.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},Ve.EngineFormat={RGBAFormat:nt,RGBA_ASTC_4x4_Format:Dr,RGBA_BPTC_Format:yA,RGBA_ETC2_EAC_Format:bA,RGBA_PVRTC_4BPPV1_Format:fA,RGBA_S3TC_DXT5_Format:gA,RGB_ETC1_Format:mA,RGB_ETC2_Format:IA,RGB_PVRTC_4BPPV1_Format:pA,RGBA_S3TC_DXT1_Format:dA},Ve.BasisWorker=function(){let a,e,t;const s=_EngineFormat,i=_TranscoderFormat,n=_BasisFormat;self.addEventListener("message",function(g){const p=g.data;switch(p.type){case"init":a=p.config,r(p.transcoderBinary);break;case"transcode":e.then(()=>{try{const{faces:f,buffers:m,width:y,height:C,hasAlpha:E,format:w,dfdFlags:S}=o(p.buffer);self.postMessage({type:"transcode",id:p.id,faces:f,width:y,height:C,hasAlpha:E,format:w,dfdFlags:S},m)}catch(f){console.error(f),self.postMessage({type:"error",id:p.id,error:f.message})}});break}});function r(g){e=new Promise(p=>{t={wasmBinary:g,onRuntimeInitialized:p},BASIS(t)}).then(()=>{t.initializeBasis(),t.KTX2File===void 0&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")})}function o(g){const p=new t.KTX2File(new Uint8Array(g));function f(){p.close(),p.delete()}if(!p.isValid())throw f(),new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");const m=p.isUASTC()?n.UASTC_4x4:n.ETC1S,y=p.getWidth(),C=p.getHeight(),E=p.getLayers()||1,w=p.getLevels(),S=p.getFaces(),M=p.getHasAlpha(),R=p.getDFDFlags(),{transcoderFormat:D,engineFormat:O}=l(m,y,C,M);if(!y||!C||!w)throw f(),new Error("THREE.KTX2Loader: Invalid texture");if(!p.startTranscoding())throw f(),new Error("THREE.KTX2Loader: .startTranscoding failed");const H=[],ae=[];for(let J=0;J<S;J++){const Be=[];for(let xe=0;xe<w;xe++){const it=[];let W,oe;for(let Ie=0;Ie<E;Ie++){const Ge=p.getImageLevelInfo(xe,Ie,J);J===0&&xe===0&&Ie===0&&(Ge.origWidth%4!==0||Ge.origHeight%4!==0)&&console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),w>1?(W=Ge.origWidth,oe=Ge.origHeight):(W=Ge.width,oe=Ge.height);const sA=new Uint8Array(p.getImageTranscodedSizeInBytes(xe,Ie,0,D));if(!p.transcodeImage(sA,xe,Ie,J,D,0,-1,-1))throw f(),new Error("THREE.KTX2Loader: .transcodeImage failed.");it.push(sA)}const Me=d(it);Be.push({data:Me,width:W,height:oe}),ae.push(Me.buffer)}H.push({mipmaps:Be,width:y,height:C,format:O})}return f(),{faces:H,buffers:ae,width:y,height:C,hasAlpha:M,format:O,dfdFlags:R}}const A=[{if:"astcSupported",basisFormat:[n.UASTC_4x4],transcoderFormat:[i.ASTC_4x4,i.ASTC_4x4],engineFormat:[s.RGBA_ASTC_4x4_Format,s.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[n.ETC1S,n.UASTC_4x4],transcoderFormat:[i.BC7_M5,i.BC7_M5],engineFormat:[s.RGBA_BPTC_Format,s.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[n.ETC1S,n.UASTC_4x4],transcoderFormat:[i.BC1,i.BC3],engineFormat:[s.RGBA_S3TC_DXT1_Format,s.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[n.ETC1S,n.UASTC_4x4],transcoderFormat:[i.ETC1,i.ETC2],engineFormat:[s.RGB_ETC2_Format,s.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[n.ETC1S,n.UASTC_4x4],transcoderFormat:[i.ETC1],engineFormat:[s.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[n.ETC1S,n.UASTC_4x4],transcoderFormat:[i.PVRTC1_4_RGB,i.PVRTC1_4_RGBA],engineFormat:[s.RGB_PVRTC_4BPPV1_Format,s.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],h=A.sort(function(g,p){return g.priorityETC1S-p.priorityETC1S}),c=A.sort(function(g,p){return g.priorityUASTC-p.priorityUASTC});function l(g,p,f,m){let y,C;const E=g===n.ETC1S?h:c;for(let w=0;w<E.length;w++){const S=E[w];if(a[S.if]&&S.basisFormat.includes(g)&&!(m&&S.transcoderFormat.length<2)&&!(S.needsPowerOfTwo&&!(u(p)&&u(f))))return y=S.transcoderFormat[m?1:0],C=S.engineFormat[m?1:0],{transcoderFormat:y,engineFormat:C}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),y=i.RGBA32,C=s.RGBAFormat,{transcoderFormat:y,engineFormat:C}}function u(g){return g<=2?!0:(g&g-1)===0&&g!==0}function d(g){if(g.length===1)return g[0];let p=0;for(let y=0;y<g.length;y++){const C=g[y];p+=C.byteLength}const f=new Uint8Array(p);let m=0;for(let y=0;y<g.length;y++){const C=g[y];f.set(C,m),m+=C.byteLength}return f}};const $d=new Set([nt,gs,Dt]),yr={[Ka]:nt,[ja]:nt,[Pa]:nt,[Ha]:nt,[Wa]:gs,[Va]:gs,[Ua]:gs,[za]:gs,[Ja]:Dt,[qa]:Dt,[Oa]:Dt,[Ga]:Dt,[Za]:Dr,[Xa]:kr,[Ya]:kr},Er={[Ka]:It,[ja]:Ft,[Pa]:Qe,[Ha]:Qe,[Wa]:It,[Va]:Ft,[Ua]:Qe,[za]:Qe,[Ja]:It,[qa]:Ft,[Oa]:Qe,[Ga]:Qe,[Za]:Ft,[Xa]:Qe,[Ya]:Qe};async function eg(a){const{vkFormat:e}=a;if(yr[e]===void 0)throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let t;a.supercompressionScheme===La&&(br||(br=new Promise(async n=>{const r=new Zd;await r.init(),n(r)})),t=await br);const s=[];for(let n=0;n<a.levels.length;n++){const r=Math.max(1,a.pixelWidth>>n),o=Math.max(1,a.pixelHeight>>n),A=a.pixelDepth?Math.max(1,a.pixelDepth>>n):0,h=a.levels[n];let c;if(a.supercompressionScheme===qd)c=h.levelData;else if(a.supercompressionScheme===La)c=t.decode(h.levelData,h.uncompressedByteLength);else throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");let l;Er[e]===It?l=new Float32Array(c.buffer,c.byteOffset,c.byteLength/Float32Array.BYTES_PER_ELEMENT):Er[e]===Ft?l=new Uint16Array(c.buffer,c.byteOffset,c.byteLength/Uint16Array.BYTES_PER_ELEMENT):l=c,s.push({data:l,width:r,height:o,depth:A})}let i;if($d.has(yr[e]))i=a.pixelDepth===0?new Tn(s[0].data,a.pixelWidth,a.pixelHeight):new VA(s[0].data,a.pixelWidth,a.pixelHeight,a.pixelDepth);else{if(a.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");i=new xi(s,a.pixelWidth,a.pixelHeight)}return i.mipmaps=s,i.type=Er[e],i.format=yr[e],i.colorSpace=tA(a),i.needsUpdate=!0,Promise.resolve(i)}function tA(a){const e=a.dataFormatDescriptor[0];return e.colorPrimaries===Jd?e.transferFunction===va?ie:de:e.colorPrimaries===Wd?e.transferFunction===va?Or:Yi:(e.colorPrimaries===jd||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`),kt)}self.onmessage=a=>{const e=a.data;switch(e.type){case"init":break;case"load":sg(e);break;default:console.error("[Worker] Unknown message type:",e.type);break}},self.onerror=a=>{console.error("[Worker] Error:",a)};function tg(a){self.postMessage(a)}let Vs=null,Pi=null,Hi=null;async function sg(a){Vs??=new Ad,Vs.setMeshoptDecoder(iA),Pi??=new od,Pi.setDecoderConfig({type:"js"}),Pi.setDecoderPath(a.dracoDecoderPath),Vs.setDRACOLoader(Pi),Hi??=new Ve,Hi.workerConfig=a.ktx2LoaderConfig,Hi.setTranscoderPath(a.ktx2TranscoderPath),Vs.setKTX2Loader(Hi),Vs.load(a.url,e=>{const t={type:"loaded-gltf",result:{url:a.url,geometries:[],textures:[]}};ig(e,t),tg(t)})}function ig(a,e){const{result:t}=e;for(const s of a.parser.associations.keys()){const i=a.parser.associations.get(s);if(i)if("isTexture"in s&&s.isTexture){const n=s,r=a.parser.json.textures[i.textures??-1];t.textures.push({texture:n,textureIndex:i.textures??-1,extensions:r?.extensions??{}})}else if("isMesh"in s&&s.isMesh){const n=s,r=i.meshes??-1,o=i.primitives??-1,A=a.parser.json.meshes[r];t.geometries.push({geometry:n.geometry,meshIndex:r,primitiveIndex:o,extensions:A?.extensions??{}})}else"isMaterial"in s&&s.isMaterial}}})();