@realsee/five 6.8.0-alpha.27 → 6.8.0-alpha.28

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 (38) hide show
  1. package/ai_guides/features/load-external-model.md +1 -0
  2. package/ai_guides/release_notes/6.8.md +1 -1
  3. package/docs/documents/features_load-external-model.html +1 -0
  4. package/docs/documents/release_notes_6.8.html +1 -1
  5. package/five/index.js +47 -47
  6. package/five/index.mjs +1552 -1514
  7. package/five/model/loaders/glTF-helpers/extensions/KHR_gaussian_splatting.d.ts +19 -0
  8. package/five/model/loaders/glTF-helpers/extensions/KHR_gaussian_splatting_compression_spz.d.ts +3 -1
  9. package/five/model/loaders/glTF-helpers/extensions/KHR_gaussian_splatting_compression_spz_2.d.ts +11 -0
  10. package/five/model/loaders/glTF-helpers/index.d.ts +2 -0
  11. package/gltf-loader/index.js +2 -2
  12. package/gltf-loader/index.mjs +2 -2
  13. package/line/index.js +2 -2
  14. package/line/index.mjs +2 -2
  15. package/package.json +1 -1
  16. package/plugins/index.js +1 -1
  17. package/plugins/index.mjs +1 -1
  18. package/react/index.js +1 -1
  19. package/react/index.mjs +1 -1
  20. package/shader-lib/index.js +1 -1
  21. package/shader-lib/index.mjs +1 -1
  22. package/sticker/index.js +2 -2
  23. package/sticker/index.mjs +2 -2
  24. package/umd/five-gltf-loader.js +2 -2
  25. package/umd/five-line.js +2 -2
  26. package/umd/five-plugins.js +1 -1
  27. package/umd/five-react.js +1 -1
  28. package/umd/five-shader-lib.js +1 -1
  29. package/umd/five-sticker.js +2 -2
  30. package/umd/five-vfx.js +1 -1
  31. package/umd/five-vue.js +1 -1
  32. package/umd/five.js +9 -9
  33. package/vfx/index.js +1 -1
  34. package/vfx/index.mjs +1 -1
  35. package/vue/index.js +1 -1
  36. package/vue/index.mjs +1 -1
  37. package/work-downloader/index.js +1 -1
  38. package/work-downloader/index.mjs +1 -1
package/five/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * @license
3
3
  * @realsee/five
4
4
  * Generated: 4/1/2026
5
- * Version: 6.8.0-alpha.27
5
+ * Version: 6.8.0-alpha.28
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -827,13 +827,13 @@ self.onmessage = function(event) {
827
827
  return ( value & ( value - 1 ) ) === 0 && value !== 0;
828
828
 
829
829
  }
830
- `,vo=`KHR_texture_basisu`,yo=class extends Qa{loadTexture(e,t){let n=t.json.textures[e];if(!n.extensions||!n.extensions[vo])return null;let r=n.extensions[vo],i=t.json.images[r.source],a=null;if(i.bufferView!==void 0)a=t.loadBufferView(i.bufferView).then(e=>po.parse(e));else if(i.uri)a=t.options.fetcher.ajax(t.resolveResouce(i.uri),{responseType:`arraybuffer`}).then(e=>po.parse(e.body));else throw Error(`glTF: Invalid image defs.`);let o=(t.json.samplers||{})[n.sampler]||{};return a=a.then(e=>(e.magFilter=c.LinearFilter,e.minFilter=c.LinearFilter,e.wrapS=za[o.wrapS]||c.RepeatWrapping,e.wrapT=za[o.wrapT]||c.RepeatWrapping,e)),a}},bo=`KHR_texture_transform`,xo=class extends Qa{extendTexture(e,t,n){let r=t.extensions===void 0?void 0:t.extensions[bo];return r?(r.texCoord!==void 0&&console.warn(`glTF: Custom UV sets in "`+bo+`" extension not yet supported.`),r.offset===void 0&&r.rotation===void 0&&r.scale===void 0?e:(e=e.clone(),e.needsUpdate=!0,r.offset!==void 0&&e.offset.fromArray(r.offset),r.rotation!==void 0&&(e.rotation=r.rotation),r.scale!==void 0&&e.repeat.fromArray(r.scale),e)):null}},So=class extends Qa{},Co=`KHR_materials_unlit`,wo=class extends Qa{extendMaterial(e,t,n){var r;return t.material!==void 0&&e instanceof yn&&((r=n.json.materials[t.material].extensions)==null?{}:r)[Co]&&(e.shaderType=`basic`),Promise.all([]).then(K)}},To=`KHR_node_visibility`,Eo=class extends Qa{extendNode(e,t,n){var r;let i=[],a=(r=t.extensions)==null?{}:r;if(a[To]){let t=a[To];typeof t.visible==`boolean`&&(e.visible=t.visible)}return Promise.all(i).then(K)}},Do=class extends Qa{},Oo=`KHR_materials_clearcoat`,ko=class extends Qa{extendMaterial(e,t,n){var r;let i=[];if(t.material!==void 0&&(e instanceof yn||e instanceof c.MeshPhysicalMaterial)){let a=(r=n.json.materials[t.material].extensions)==null?{}:r;if(a[Oo]){let t=a[Oo];if(t.clearcoatFactor!==void 0&&(e.clearcoat=t.clearcoatFactor),t.clearcoatTexture!==void 0&&i.push(n.createMaterialTexture(t.clearcoatTexture).then(t=>{t.format=c.RGBFormat,e.clearcoatMap=t,n.disposeSet.add(t)})),t.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=t.clearcoatRoughnessFactor),t.clearcoatRoughnessTexture!==void 0&&i.push(n.createMaterialTexture(t.clearcoatRoughnessTexture).then(t=>{t.format=c.RGBFormat,e.clearcoatRoughnessMap=t,n.disposeSet.add(t)})),t.clearcoatNormalTexture!==void 0&&(i.push(n.createMaterialTexture(t.clearcoatNormalTexture).then(t=>{t.format=c.RGBFormat,e.clearcoatNormalMap=t,n.disposeSet.add(t)})),t.clearcoatNormalTexture.scale!==void 0)){let n=t.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new c.Vector2(n,n)}}}return Promise.all(i).then(K)}},Ao=`KHR_materials_sheen`,jo=class extends Qa{extendMaterial(e,t,n){var r;let i=[];if(t.material!==void 0&&(e instanceof yn||e instanceof c.MeshPhysicalMaterial)){let i=(r=n.json.materials[t.material].extensions)==null?{}:r;if(i[Ao]){let t=i[Ao];if(t.sheenColorFactor!==void 0){let n=t.sheenColorFactor;e.sheen=new c.Color().setRGB(n[0],n[1],n[2])}t.sheenRoughnessFactor!==void 0&&console.warn(`glTF: ${Ao} sheenRoughnessFactor unsupported`),t.sheenColorTexture!==void 0&&console.warn(`glTF: ${Ao} sheenColorTexture unsupported`),t.sheenRoughnessTexture!==void 0&&console.warn(`glTF: ${Ao} sheenRoughnessTexture unsupported`)}}return Promise.all(i).then(K)}},Mo=`KHR_materials_transmission`,No=class extends Qa{extendMaterial(e,t,n){var r;let i=[];if(t.material!==void 0&&(e instanceof yn||e instanceof c.MeshPhysicalMaterial)){let i=(r=n.json.materials[t.material].extensions)==null?{}:r;if(i[Mo]){let t=i.KHR_materials_transmission;t.transmissionFactor!==void 0&&(e.transparency=t.transmissionFactor,e.transparency>0&&(e.transparent=!0)),t.transmissionTexture!==void 0&&console.warn(`glTF: ${Mo} transmissionTexture unsupported`)}}return Promise.all(i).then(K)}},Po=`KHR_materials_emissive_strength`,Fo=class extends Qa{extendMaterial(e,t,n){var r;let i=[];if(t.material!==void 0&&(e instanceof yn||e instanceof c.MeshStandardMaterial)){let i=(r=n.json.materials[t.material].extensions)==null?{}:r;if(i[Po]){let t=i[Po];t.emissiveStrength!==void 0&&(e.emissiveIntensity=t.emissiveStrength)}}return Promise.all(i).then(K)}},Io=(function(){"use strict";var e=`b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:78Yqdbk:qzezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhlaicefhodnadTmbalc;WFbGglcjdalcjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfglcl4cifcd4hxdndndndnalc9WGgmTmbcbhPcehsawcjdfhzaohHinaraH9Rax6midnaraHaxfgo9RcK6mbczhlinalgic9Wfglawcj;cbffhOdndndndndnaHalco4fRbbalci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOaoRblaoRbbgAco4glalciSgCE86bbawcj;cbfaifglcGfaoclfaCfgORbbaAcl4ciGgCaCciSgCE86bbalcVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbalc7faOaCfgORbbaAciGgAaAciSgAE86bbalctfaOaAfgARbbaoRbegOco4gCaCciSgCE86bbalc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc93faAaCfgARbbaOciGgOaOciSgOE86bbalc94faAaOfgARbbaoRbdgOco4gCaCciSgCE86bbalc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc97faAaCfgARbbaOciGgOaOciSgOE86bbalc98faAaOfgORbbaoRbigoco4gAaAciSgAE86bbalc99faOaAfgORbbaocl4ciGgAaAciSgAE86bbalc9:faOaAfgORbbaocd4ciGgAaAciSgAE86bbalcufaOaAfglRbbaociGgoaociSgoE86bbalaofhoxdkaOaoRbwaoRbbgAcl4glalcsSgCE86bbawcj;cbfaifglcGfaocwfaCfgORbbaAcsGgAaAcsSgAE86bbalcVfaOaAfgORbbaoRbegAcl4gCaCcsSgCE86bbalc7faOaCfgORbbaAcsGgAaAcsSgAE86bbalctfaOaAfgORbbaoRbdgAcl4gCaCcsSgCE86bbalc91faOaCfgORbbaAcsGgAaAcsSgAE86bbalc4faOaAfgORbbaoRbigAcl4gCaCcsSgCE86bbalc93faOaCfgORbbaAcsGgAaAcsSgAE86bbalc94faOaAfgORbbaoRblgAcl4gCaCcsSgCE86bbalc95faOaCfgORbbaAcsGgAaAcsSgAE86bbalc96faOaAfgORbbaoRbvgAcl4gCaCcsSgCE86bbalc97faOaCfgORbbaAcsGgAaAcsSgAE86bbalc98faOaAfgORbbaoRbogAcl4gCaCcsSgCE86bbalc99faOaCfgORbbaAcsGgAaAcsSgAE86bbalc9:faOaAfgORbbaoRbrgocl4gAaAcsSgAE86bbalcufaOaAfglRbbaocsGgoaocsSgoE86bbalaofhoxekaOao8Pbb83bbaOcwfaocwf8Pbb83bbaoczfhokdnaiam9pmbaiczfhlarao9RcL0mekkaiam6miaoTmidnakTmbawaPfRbbhOawcj;cbfhlazhiakhHinaialRbbgAce4cbaAceG9R7aOfgO86bbaiadfhialcefhlaHcufgHmbkkazcefhzaPcefgPad6hsaohHaPad9hmexvkkcbhoasceGmdxikaoaxad2fhPdnakTmbcbhmcehsawcjdfhCinarao9Rax6miaoTmdaoaxfhoawamfRbbhOawcj;cbfhlaChiakhHinaialRbbgAce4cbaAceG9R7aOfgO86bbaiadfhialcefhlaHcufgHmbkaCcefhCamcefgmad6hsamad9hmbkaPhoxikcbhlcehsinarao9Rax6mdaoTmeaoaxfhoalcefglad6hsadal9hmbkaPhoxdkcbhoasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqaombkc9:hoxekcbc99arao9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;xzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok: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:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj;8ifcjjj98G::NUdbabclfhbadcufgdmbkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb`,t=`b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;a9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;d8JlHud97euo978Jjjjjbcj;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:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgAclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;tzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:wPliuo97eue978Jjjjjbca9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp: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:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskdnalTmbcbhvabhdinadczfgxaxpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;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;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabalcitfglad;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;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbadczfhdaeclfgeav6mbkkdnaval9pmbaialciGgecdtgdVcbc;abad9R;8kbaiabavcdtfgvad;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiad;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb`,n=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]),r=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(n)?t:e,a,o=WebAssembly.instantiate(s(i),{}).then(function(e){a=e.instance,a.exports.__wasm_call_ctors()});function s(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;++n){var i=e.charCodeAt(n);t[n]=i>96?i-97:i>64?i-39:i+4}for(var a=0,n=0;n<e.length;++n)t[a++]=t[n]<60?r[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,a)}function c(e,t,n,r,i,o){var s=a.exports.sbrk,c=n+3&-4,l=s(c*r),u=s(i.length),d=new Uint8Array(a.exports.memory.buffer);d.set(i,u);var f=e(l,n,r,u,i.length);if(f==0&&o&&o(l,c,r),t.set(d.subarray(l,l+n*r)),s(l-s(0)),f!=0)throw Error(`Malformed buffer data: `+f)}var l={NONE:``,OCTAHEDRAL:`meshopt_decodeFilterOct`,QUATERNION:`meshopt_decodeFilterQuat`,EXPONENTIAL:`meshopt_decodeFilterExp`},u={ATTRIBUTES:`meshopt_decodeVertexBuffer`,TRIANGLES:`meshopt_decodeIndexBuffer`,INDICES:`meshopt_decodeIndexSequence`},d=[],f=0;function p(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){var n=e.data;t.pending-=n.count,t.requests[n.id][n.action](n.value),delete t.requests[n.id]},t}function m(e){for(var t=`var instance; var ready = WebAssembly.instantiate(new Uint8Array([`+new Uint8Array(s(i))+`]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;`+c.toString()+g.toString(),n=new Blob([t],{type:`text/javascript`}),r=URL.createObjectURL(n),a=0;a<e;++a)d[a]=p(r);URL.revokeObjectURL(r)}function h(e,t,n,r,i){for(var a=d[0],o=1;o<d.length;++o)d[o].pending<a.pending&&(a=d[o]);return new Promise(function(o,s){var c=new Uint8Array(n),l=f++;a.pending+=e,a.requests[l]={resolve:o,reject:s},a.object.postMessage({id:l,count:e,size:t,source:c,mode:r,filter:i},[c.buffer])})}function g(e){o.then(function(){var t=e.data;try{var n=new Uint8Array(t.count*t.size);c(a.exports[t.mode],n,t.count,t.size,t.source,a.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:`resolve`,value:n},[n.buffer])}catch(e){self.postMessage({id:t.id,count:t.count,action:`reject`,value:e})}})}return{ready:o,supported:!0,useWorkers:function(e){m(e)},decodeVertexBuffer:function(e,t,n,r,i){c(a.exports.meshopt_decodeVertexBuffer,e,t,n,r,a.exports[l[i]])},decodeIndexBuffer:function(e,t,n,r){c(a.exports.meshopt_decodeIndexBuffer,e,t,n,r)},decodeIndexSequence:function(e,t,n,r){c(a.exports.meshopt_decodeIndexSequence,e,t,n,r)},decodeGltfBuffer:function(e,t,n,r,i,o){c(a.exports[u[i]],e,t,n,r,a.exports[l[o]])},decodeGltfBufferAsync:function(e,t,n,r,i){return d.length>0?h(e,t,n,u[r],l[i]):o.then(function(){var o=new Uint8Array(e*t);return c(a.exports[u[r]],o,e,t,n,a.exports[l[i]]),o})}}})(),Lo=`EXT_meshopt_compression`,Ro=class extends Qa{loadBufferView(e,t){let n=t.json,r=n.bufferViews[e];if(r.extensions&&r.extensions[Lo]){let e=r.extensions[Lo],i=t.loadBuffer(e.buffer);if(!Io.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(Lo)>=0)throw Error(`THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files`);return null}return Promise.all([i,Io.ready]).then(([t])=>{let n=e.byteOffset||0,r=e.byteLength||0,i=e.count,a=e.byteStride,o=new ArrayBuffer(i*a),s=new Uint8Array(t,n,r);return Io.decodeGltfBuffer(new Uint8Array(o),i,a,s,e.mode,e.filter),o})}else return null}},zo=`EXT_texture_webp`,Bo=class extends Qa{constructor(){super(...arguments),this.supportsWep=!1}prepare(e){return Nr().then(e=>{this.supportsWep=e.webp})}loadTexture(e,t){let n=t.json.textures[e];if(!n.extensions||!n.extensions[zo]||!this.supportsWep)return null;let r=n.extensions[zo];return t.loadImage(r.source).then(e=>{let r=new c.Texture(e);r.needsUpdate=!0,r.flipY=!1,n.name&&(r.name=n.name);let i=(t.json.samplers||{})[n.sampler]||{};return r.magFilter=Ra[i.magFilter]||c.LinearFilter,r.minFilter=Ra[i.minFilter]||c.LinearMipmapLinearFilter,r.wrapS=za[i.wrapS]||c.RepeatWrapping,r.wrapT=za[i.wrapT]||c.RepeatWrapping,r.onUpdate=function(){e.close()},r})}},Vo=`CESIUM_RTC`,Ho=class extends Qa{emitResult(e,t){if(t.json.extensions[Vo]&&t.json.extensions[Vo].center){let n=t.json.extensions[Vo].center;e.CESIUM_RTC={center:new c.Vector3().fromArray(n)}}}},Uo=`REALSEE_materials_lightmap`,Wo=class extends Qa{extendMaterial(e,t,n){let r=[];if(n.json.materials&&t.material!==void 0){let i=n.json.materials[t.material].extensions[Uo];i&&(i.lightMapTexture!==void 0&&r.push(n.createMaterialTexture(i.lightMapTexture).then(t=>{e.lightMap=t})),i.lightMapIntensity!==void 0&&(e.lightMapIntensity=i.lightMapIntensity))}return Promise.all(r).then(()=>{})}};function Go(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}var Ko=`KHR_gaussian_splatting`,qo=class extends Qa{loadMeshPrimitive(e,t,n){let r=t.extensions[Ko];return r?this.loadGaussianSplating(r,n):null}loadGaussianSplating(e,t){return Go(this,void 0,void 0,function*(){if(e.compression.extension===`KHR_gaussian_splatting_compression_spz`){let n=t.extensions.KHR_gaussian_splatting_compression_spz;if(n)return n.load(e.bufferView,t)}return Promise.resolve(new c.Points)})}},Jo=new Float32Array(1),Yo=new Uint32Array(Jo.buffer),Xo=typeof Float16Array<`u`,Zo=Xo?new Float16Array(1):null,Qo=Xo?new Uint16Array(Zo.buffer):new Uint16Array(1);function $o(e){if(Xo&&Zo)return Qo[0]=e,Zo[0];let t=e>>15&1,n=e>>10&31,r=e&1023,i;if(n===0)if(r===0)i=t<<31;else{let e=r,n=-14;for(;!(e&1024);)e<<=1,n--;e&=1023;let a=n+127,o=e<<13;i=t<<31|a<<23|o}else if(n===31)i=r===0?t<<31|2139095040:t<<31|2143289344;else{let e=n-15+127,a=r<<13;i=t<<31|e<<23|a}return Yo[0]=i,Jo[0]}var es=class{constructor({fileBytes:e}){this.fileBytes=e,this.chunks=[],this.totalBytes=0;let t=new DecompressionStream(`gzip`);this.reader=new Blob([e]).stream().pipeThrough(t).getReader()}read(e){return Go(this,void 0,void 0,function*(){for(;this.totalBytes<e;){let{value:e,done:t}=yield this.reader.read();if(t)break;this.chunks.push(e),this.totalBytes+=e.length}if(this.totalBytes<e)throw Error(`Unexpected EOF: needed ${e}, got ${this.totalBytes}`);let t=new Uint8Array(this.totalBytes),n=0;for(let e of this.chunks)t.set(e,n),n+=e.length;let r=t.subarray(0,e);return this.chunks=[t.subarray(e)],this.totalBytes-=e,r})}},ts=.28209479177387814,ns=class{constructor({fileBytes:e}){this.version=-1,this.numSplats=0,this.shDegree=0,this.fractionalBits=0,this.flags=0,this.flagAntiAlias=!1,this.reserved=0,this.headerParsed=!1,this.parsed=!1,this.fileBytes=e instanceof ArrayBuffer?new Uint8Array(e):e,this.reader=new es({fileBytes:this.fileBytes})}parseHeader(){return Go(this,void 0,void 0,function*(){if(this.headerParsed)throw Error(`SPZ file header already parsed`);let e=new DataView((yield this.reader.read(16)).buffer);if(e.getUint32(0,!0)!==1347635022)throw Error(`Invalid SPZ file`);if(this.version=e.getUint32(4,!0),this.version<1||this.version>3)throw Error(`Unsupported SPZ version: ${this.version}`);this.numSplats=e.getUint32(8,!0),this.shDegree=e.getUint8(12),this.fractionalBits=e.getUint8(13),this.flags=e.getUint8(14),this.flagAntiAlias=(this.flags&1)!=0,this.reserved=e.getUint8(15),this.headerParsed=!0,this.parsed=!1})}parseSplats(e,t,n,r,i,a){return Go(this,void 0,void 0,function*(){if(!this.headerParsed)throw Error(`SPZ file header must be parsed first`);if(this.parsed)throw Error(`SPZ file already parsed`);if(this.parsed=!0,this.version===1){let t=yield this.reader.read(this.numSplats*3*2),n=new Uint16Array(t.buffer);for(let t=0;t<this.numSplats;t++){let r=t*3,i=$o(n[r]),a=$o(n[r+1]),o=$o(n[r+2]);e==null||e(t,i,a,o)}}else if(this.version===2||this.version===3){let t=1<<this.fractionalBits,n=yield this.reader.read(this.numSplats*3*3);for(let r=0;r<this.numSplats;r++){let i=r*9,a=((n[i+2]<<24|n[i+1]<<16|n[i]<<8)>>8)/t,o=((n[i+5]<<24|n[i+4]<<16|n[i+3]<<8)>>8)/t,s=((n[i+8]<<24|n[i+7]<<16|n[i+6]<<8)>>8)/t;e==null||e(r,a,o,s)}}{let e=yield this.reader.read(this.numSplats);for(let n=0;n<this.numSplats;n++)t==null||t(n,e[n]/255)}{let e=yield this.reader.read(this.numSplats*3),t=ts/.15;for(let r=0;r<this.numSplats;r++){let i=r*3,a=(e[i]/255-.5)*t+.5,o=(e[i+1]/255-.5)*t+.5,s=(e[i+2]/255-.5)*t+.5;n==null||n(r,a,o,s)}}{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3,i=Math.exp(e[n]/16-10),a=Math.exp(e[n+1]/16-10),o=Math.exp(e[n+2]/16-10);r==null||r(t,i,a,o)}}if(this.version===3){let e=1/Math.sqrt(2),t=yield this.reader.read(this.numSplats*4);for(let n=0;n<this.numSplats;n++){let r=n*4,a=[0,0,0,0],o=[t[r],t[r+1],t[r+2],t[r+3]],s=o[0]+(o[1]<<8)+(o[2]<<16)+(o[3]<<24),c=s>>>30,l=s,u=0;for(let t=3;t>=0;--t)if(t!==c){let n=l&511,r=l>>>9&1;l>>>=10,a[t]=n/511*e,a[t]=r===0?a[t]:-a[t],u+=a[t]*a[t]}let d=1-u;a[c]=Math.sqrt(Math.max(d,0)),i==null||i(n,a[0],a[1],a[2],a[3])}}else{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3,r=e[n]/127.5-1,a=e[n+1]/127.5-1,o=e[n+2]/127.5-1,s=Math.sqrt(Math.max(0,1-r*r-a*a-o*o));i==null||i(t,r,a,o,s)}}if(a&&this.shDegree>=1){let e={1:3,2:8,3:15}[this.shDegree]||0,t=yield this.reader.read(this.numSplats*e*3),n=new Float32Array(9),r=this.shDegree>=2?new Float32Array(15):void 0,i=this.shDegree>=3?new Float32Array(21):void 0,o=0;for(let e=0;e<this.numSplats;e++){for(let e=0;e<9;++e)n[e]=(t[o+e]-128)/128;if(o+=9,r){for(let e=0;e<15;++e)r[e]=(t[o+e]-128)/128;o+=15}if(i){for(let e=0;e<21;++e)i[e]=(t[o+e]-128)/128;o+=21}a==null||a(e,new Float32Array(n),r?new Float32Array(r):void 0,i?new Float32Array(i):void 0)}}})}};function rs(e){return Go(this,void 0,void 0,function*(){let t=new ns({fileBytes:e});yield t.parseHeader();let n=t.numSplats,r=new Float32Array(n*3),i=new Uint8Array(n*4),a=new Float32Array(n*3),o=new Float32Array(n*4),s,c,l;return t.shDegree>=1&&(s=new Float32Array(n*9)),t.shDegree>=2&&(c=new Float32Array(n*15)),t.shDegree>=3&&(l=new Float32Array(n*21)),yield t.parseSplats((e,t,n,i)=>{r[e*3]=t,r[e*3+1]=n,r[e*3+2]=i},(e,t)=>{i[e*4+3]=Math.round(t*255)},(e,t,n,r)=>{i[e*4]=Math.round(Math.max(0,Math.min(1,t))*255),i[e*4+1]=Math.round(Math.max(0,Math.min(1,n))*255),i[e*4+2]=Math.round(Math.max(0,Math.min(1,r))*255)},(e,t,n,r)=>{a[e*3]=t,a[e*3+1]=n,a[e*3+2]=r},(e,t,n,r,i)=>{o[e*4]=i,o[e*4+1]=t,o[e*4+2]=n,o[e*4+3]=r},(e,t,n,r)=>{s&&t&&s.set(t,e*9),c&&n&&c.set(n,e*15),l&&r&&l.set(r,e*21)}),new $n({numPoints:n,positions:r,colors:i,scales:a,rotations:o,sh1:s,sh2:c,sh3:l,shDegree:t.shDegree})})}function is(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Y`:n,s=(r=t.upAxis)==null?`Z`:r,c=(i=t.fetcher)==null?_r:i,l=(a=t.onDownloadProgress)==null?K:a,u=0;return Promise.resolve().then(()=>c.ajax(e,{responseType:`arraybuffer`},void 0,void 0,l)).then(e=>(u=e.body.byteLength,e.body)).then(e=>rs(new Uint8Array(e))).then(t=>(o===`Z`&&(t.applyMatrix4(tr),t.updateMatrix(),t.updateMatrixWorld(!0),t.transformChanged=!0),{type:`spz`,modelUpAxis:o,upAxis:s,uri:e,byteLength:u,memoryUsage:Pi(t),scene:t,textures:[],animations:[],dispose:()=>t.dispose()}))}var as=new c.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),os=new c.Matrix4().getInverse(as),ss={KHR_binary_glTF:eo,KHR_draco_mesh_compression:so,KHR_texture_basisu:yo,KHR_texture_transform:xo,KHR_mesh_quantization:So,KHR_materials_unlit:wo,KHR_node_visibility:Eo,KHR_animation_pointer:Do,KHR_materials_clearcoat:ko,KHR_materials_sheen:jo,KHR_materials_transmission:No,KHR_materials_emissive_strength:Fo,EXT_meshopt_compression:Ro,EXT_texture_webp:Bo,CESIUM_RTC:Ho,REALSEE_materials_lightmap:Wo,KHR_gaussian_splatting:qo,KHR_gaussian_splatting_compression_spz:class extends Qa{load(e,t){return Go(this,void 0,void 0,function*(){return t.loadBufferView(e).then(e=>this.loadSpz(new Uint8Array(e)))})}loadSpz(e){return Go(this,void 0,void 0,function*(){return Promise.resolve().then(()=>rs(e)).then(e=>(e.applyMatrix4(os),e.updateMatrix(),e.updateMatrixWorld(!0),e.transformChanged=!0,e))})}}};function cs(e,t){var n,r,i;let a={},o,s;if(typeof e==`string`)s=e;else if(ss.KHR_binary_glTF.getMagic(e)===ss.KHR_binary_glTF.HEADER_MAGIC){o=new ss.KHR_binary_glTF;try{o.loadGlbBinary(e)}catch(e){return Promise.reject(e)}a.KHR_binary_glTF=o,s=o.content}else s=Fa(new Uint8Array(e));let c=JSON.parse(s);if(t.jsonModify&&(c=t.jsonModify(c)),c.asset===void 0||Number(c.asset.version[0])<2)return Promise.reject(Error(`glTF: Unsupported asset. glTF versions >=2.0 are supported.`));if(c.extensionsUsed){let e=c.extensionsRequired||[];for(var l=0;l<c.extensionsUsed.length;l++){let t=c.extensionsUsed[l];a[t]||(ss[t]?a[t]=new ss[t]:e.indexOf(t)>=0&&console.warn(`glTF: Unknown extension "`+t+`".`))}}return new qa(c,a,{copyUV2:(n=t.copyUV2)==null?!1:n,resourcePath:(r=t.resourcePath)==null?``:r,search:(i=t.search)==null?``:i,fetcher:t.fetcher}).parse().then(e=>(o&&o.clear(),e))}function ls(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Y`:n,s=(r=t.upAxis)==null?`Z`:r,l=(i=t.fetcher)==null?_r:i,u=(a=t.onDownloadProgress)==null?K:a,d={uri:e,gltfUpAxis:o};return Promise.resolve().then(()=>l.ajax(e,{responseType:`arraybuffer`},void 0,void 0,u).then(e=>e.body)).then(e=>Promise.resolve(0).then(t=>_a(d,e,t)).then(t=>ka(d,e,t)).then(t=>Pa(d,e,t))).then(()=>{var n;return cs(d.gltfArrayBuffer,{copyUV2:!1,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(n=e.split(`?`)[1])==null?``:n,jsonModify(e){var n,r;if(t.light===!1){let t=`KHR_materials_unlit`;if(e.extensionsUsed=(n=e.extensionsUsed)==null?[]:n,e.extensionsUsed.indexOf(t)===-1&&e.extensionsUsed.push(t),e.materials)for(let n of e.materials)n.extensions=(r=n.extensions)==null?{}:r,n.extensions[t]={}}return e},fetcher:l}).then(e=>{let t=new c.Matrix4;o===`Y`&&t.premultiply(er);let n;if(d.rtcCenter?n=new c.Vector3().fromArray(d.rtcCenter):e.CESIUM_RTC&&(n=new c.Vector3().copy(e.CESIUM_RTC.center)),n){let e=new c.Matrix4().setPosition(n);t.premultiply(e)}return s===`Y`&&t.premultiply(tr),e.scene.applyMatrix4(t),d.featureTableBinary=void 0,d.batchTableBinary=void 0,d.gltfArrayBuffer=void 0,{type:`b3dm`,modelUpAxis:o,upAxis:`Z`,uri:d.uri,byteLength:d.byteLength,memoryUsage:Pi(e.scene),scene:e.scene,textures:e.textures,animations:[],rtcCenter:n,dispose:()=>e.dispose()}})})}var us="(function(){function e(e){onmessage=t=>{Promise.resolve(t.data).then(t=>e(t)).then(({output:e,transfer:t})=>postMessage(e,t)).catch(e=>postMessage({$$error:e}))}}var t;(function(e){e[e.BYTE=5120]=`BYTE`,e[e.UNSIGNED_BYTE=5121]=`UNSIGNED_BYTE`,e[e.SHORT=5122]=`SHORT`,e[e.UNSIGNED_SHORT=5123]=`UNSIGNED_SHORT`,e[e.INT=5124]=`INT`,e[e.UNSIGNED_INT=5125]=`UNSIGNED_INT`,e[e.FLOAT=5126]=`FLOAT`,e[e.DOUBLE=5130]=`DOUBLE`})(t||={});let n={[t.DOUBLE]:Float64Array,[t.FLOAT]:Float32Array,[t.UNSIGNED_SHORT]:Uint16Array,[t.UNSIGNED_INT]:Uint32Array,[t.UNSIGNED_BYTE]:Uint8Array,[t.BYTE]:Int8Array,[t.SHORT]:Int16Array,[t.INT]:Int32Array},r={DOUBLE:t.DOUBLE,FLOAT:t.FLOAT,UNSIGNED_SHORT:t.UNSIGNED_SHORT,UNSIGNED_INT:t.UNSIGNED_INT,UNSIGNED_BYTE:t.UNSIGNED_BYTE,BYTE:t.BYTE,SHORT:t.SHORT,INT:t.INT};function i(e){let t=n[e];if(!t)throw Error(`Failed to convert GL type`);return t}function a(e){return i(e).BYTES_PER_ELEMENT}function o(e,t,n=0,r){let o=i(e);return n%a(e)===0?new o(t,n,r??(t.byteLength-n)/a(e)):new o(r?t.slice(n,n+r*a(e)):t.slice(n))}function s(e){let t=r[e];if(!t)throw Error(`Failed to convert GL type`);return t}var c=class{constructor(e,n){this.featuresLength=0,this.cachedTypedArrays={},this.json=e,this.buffer=n;let r=this.getGlobalProperty(`POINTS_LENGTH`,t.UNSIGNED_INT,1);r&&r.length&&(this.featuresLength=r[0])}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return!!this.json[e]}getGlobalProperty(e,t,n){let r=this.json[e];return typeof r==`number`?new(i(t))([r]):Array.isArray(r)?new(i(t))(r):r&&Number.isFinite(r.byteOffset)?this.getTypedArrayFromBinary(e,t,n,1,r.byteOffset):null}getPropertyArray(e,t,n){let r=this.json[e];return r&&Number.isFinite(r.byteOffset)?(`componentType`in r&&(t=s(r.componentType)),this.getTypedArrayFromBinary(e,t,n,this.featuresLength,r.byteOffset)):this.getTypedArrayFromArray(e,t,r)}getProperty(e,t,n,r,i){if(!this.json[e])return null;let a=this.getPropertyArray(e,t,n);if(n===1)return i[0]=a[r],i;for(let e=0;e<n;++e)i[e]=a[n*r+e];return i}getTypedArrayFromBinary(e,t,n,r,i){let a=this.cachedTypedArrays,s=a[e];return s||(s=o(t,this.buffer.buffer,this.buffer.byteOffset+i,r*n),a[e]=s),s}getTypedArrayFromArray(e,t,n){let r=this.cachedTypedArrays,i=r[e];return i||(i=o(t,n),r[e]=i),i}};e(e=>Promise.resolve(e).then(e=>{let t=new c(e.featureTableJson,e.featureTableBinary),n=u(t),r=d(t),i=p(t),a=[];return n&&a.push(n.array.buffer),r&&a.push(r.array.buffer),i&&a.push(i.array.buffer),{output:{position:n,color:r,normal:i},transfer:a}}));let l=65535;function u(e){if(e.hasProperty(`POSITION`))return{array:e.getPropertyArray(`POSITION`,t.FLOAT,3),itemSize:3,normalized:!1};if(e.hasProperty(`POSITION_QUANTIZED`)){let n=e.getPropertyArray(`POSITION_QUANTIZED`,t.UNSIGNED_SHORT,3),r=e.getGlobalProperty(`QUANTIZED_VOLUME_SCALE`,t.FLOAT,3),i=e.getGlobalProperty(`QUANTIZED_VOLUME_OFFSET`,t.FLOAT,3);if(!r||!i)throw Error(`QUANTIZED_VOLUME_SCALE or QUANTIZED_VOLUME_OFFSET never found.`);let a=new Float32Array(n.length),o=n.length/3,s=r[0]/l,c=r[1]/l,u=r[2]/l,d=i[0],f=i[1],p=i[2];for(let e=0,t;e<o;e++)t=e*3,a[t]=n[t]*s+d,a[++t]=n[t]*c+f,a[++t]=n[t]*u+p;return{array:a,itemSize:3,normalized:!1}}return null}function d(e){if(e.hasProperty(`RGB`)){let n=e.getPropertyArray(`RGB`,t.UNSIGNED_BYTE,3),r=n.length/3,i=new Uint8Array(r*4);for(let e=0,t,a;e<r;e++)a=e*4,t=e*3,i[a]=n[t],i[++a]=n[++t],i[++a]=n[++t];return{array:i,itemSize:4,normalized:!0}}else if(e.hasProperty(`RGBA`))return{array:e.getPropertyArray(`RGBA`,t.UNSIGNED_BYTE,4),itemSize:4,normalized:!0};else if(e.hasProperty(`RGB565`)){let n=e.getPropertyArray(`RGB565`,t.UNSIGNED_SHORT,1),r=n.length,i=new Uint8Array(r*4);for(let e=0,t,a;e<r;e++)a=n[e],t=e*4,i[t]=(a>>11&31)<<3,i[++t]=(a>>5&63)<<2,i[++t]=(a&31)<<3;return{array:i,itemSize:4,normalized:!0}}return null}let f=2/255;function p(e){if(e.hasProperty(`NORMAL`)){let n=e.getPropertyArray(`NORMAL`,t.FLOAT,3),r=n.length/3,i=new Int8Array(r*4);for(let e=0,t,a;e<r;e++)a=e*4,t=e*3,i[a]=n[t]*127,i[++a]=n[++t]*127,i[++a]=n[++t]*127;return{array:i,itemSize:4,normalized:!0}}else if(e.hasProperty(`NORMAL_OCT16P`)){let n=e.getPropertyArray(`NORMAL_OCT16P`,t.UNSIGNED_BYTE,2),r=n.length/2,i=new Int8Array(r*4);for(let e=0,t,a,o,s,c,l,u;e<r;e++)t=e*2,a=n[t]*f-1,o=n[++t]*f-1,c=a<0?-a:a,l=o<0?-o:o,s=1-(c+l),s<0&&(a=(1-l)*(a<0?-1:1),o=(1-c)*(o<0?-1:1)),u=Math.sqrt(a*a+o*o+s*s),t=e*4,i[t]=a/u*127,i[++t]=o/u*127,i[++t]=s/u*127;return{array:i,itemSize:4,normalized:!0}}return null}})();",ds=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,us],{type:`text/javascript;charset=utf-8`});function fs(e){let t;try{if(t=ds&&(self.URL||self.webkitURL).createObjectURL(ds),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(us),{name:e==null?void 0:e.name})}}var ps=new co(()=>new fs,2);function ms(e,t,n){let r=new Ta(e.featureTableJson,e.featureTableBinary);return Promise.resolve().then(()=>{let e=r.getExtension(`3DTILES_draco_point_compression`);return e?hs(e,r):ps.postMessage({featureTableBinary:r.buffer,featureTableJson:r.json},[r.buffer.buffer])}).then(t=>(e.attributes=t,n))}function hs(e,t){return Go(this,void 0,void 0,function*(){let n=e.properties||{},r=e.byteOffset,i=e.byteLength;if(!n||!Number.isFinite(r)||!i)throw Error(`Draco properties, byteOffset, and byteLength must be defined`);let a=t.buffer.slice(r,r+i),o=e.properties;return io.decodeGeometry(a.buffer,{attributeIDs:o,attributeTypes:{POSITION:`Float32Array`,NORMAL:`Float32Array`,RGB:`Uint8Array`,RGBA:`Uint8Array`},useUniqueIDs:!0}).then(e=>{let t=e.getAttribute(`POSITION`),n=e.getAttribute(`RGB`),r=e.getAttribute(`RGBA`),i=e.getAttribute(`NORMAL`),a;if(r)a=r;else if(n){let e=n.count,t=n.array,r=new Uint8Array(e*4);for(let n=0,i,a;n<e;n++)a=n*4,i=n*3,r[a]=t[i],r[++a]=t[++i],r[++a]=t[++i];a=new c.BufferAttribute(r,4,n.normalized)}return{position:t?{array:t.array,itemSize:t.itemSize,normalized:t.normalized}:null,color:a?{array:a.array,itemSize:a.itemSize,normalized:a.normalized}:null,normal:i?{array:i.array,itemSize:i.itemSize,normalized:i.normalized}:null}})})}function gs(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?_r:r,s=(i=t.onDownloadProgress)==null?K:i,l={uri:e};return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s).then(e=>e.body)).then(e=>Promise.resolve(0).then(t=>_a(l,e,t)).then(t=>ka(l,e,t)).then(t=>ms(l,e,t))).then(()=>{var e;return _s(l.attributes,{computeBoundingBox:(e=t.computeBoundingBox)==null?!0:e})}).then(e=>{let t=new c.Matrix4,n;if(l.rtcCenter&&(n=new c.Vector3().fromArray(l.rtcCenter)),n){let e=new c.Matrix4().setPosition(n);t.premultiply(e)}return a===`Y`&&t.premultiply(tr),e.object.applyMatrix4(t),l.gltfArrayBuffer=void 0,l.featureTableBinary=void 0,l.batchTableBinary=void 0,{type:`pnts`,modelUpAxis:`Z`,upAxis:a,uri:l.uri,byteLength:l.byteLength,memoryUsage:Pi(e.object),scene:e.object,textures:[],animations:[],rtcCenter:n,dispose:()=>e.dispose()}})}function _s(e,t){let n=new Set,r=new c.BufferGeometry;n.add(r);let i=new kn;n.add(i),e.position&&r.setAttribute(`position`,new c.BufferAttribute(e.position.array,e.position.itemSize,e.position.normalized)),e.color&&r.setAttribute(`color`,new c.BufferAttribute(e.color.array,e.color.itemSize,e.color.normalized)),e.normal?r.setAttribute(`normal`,new c.BufferAttribute(e.normal.array,e.normal.itemSize,e.normal.normalized)):i.flatShading=!0,t.computeBoundingBox&&r.computeBoundingBox();let a=new An(r,i);return a.matrix.compose(a.position,a.quaternion,a.scale),a.matrixAutoUpdate=!1,a.frustumCulled=!1,Promise.resolve({object:a,dispose:()=>{n.forEach(e=>{e.dispose()}),n.clear()}})}function vs(e,t={}){var n,r,i,a,o;let s=(n=t.modelUpAxis)==null?`Y`:n,l=(r=t.upAxis)==null?`Z`:r,u=(i=t.fetcher)==null?_r:i,d=(a=t.onDownloadProgress)==null?K:a,f=(o=t.jsonModify)==null?K:o,p=0;return Promise.resolve().then(()=>u.ajax(e,{responseType:`arraybuffer`},void 0,void 0,d).then(e=>(p=e.body.byteLength,e.body))).then(n=>{var r;return cs(n,{copyUV2:!1,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(r=e.split(`?`)[1])==null?``:r,jsonModify(e){var n,r,i;if(t.light===!1){let t=`KHR_materials_unlit`;if(e.extensionsUsed=(n=e.extensionsUsed)==null?[]:n,e.extensionsUsed.indexOf(t)===-1&&e.extensionsUsed.push(t),e.materials)for(let n of e.materials)n.extensions=(r=n.extensions)==null?{}:r,n.extensions[t]={}}return(i=f(e))==null?e:i},fetcher:u})}).then(t=>{var n;let r=new c.Matrix4;if(s===`Y`&&r.premultiply(er),t.CESIUM_RTC){let e=new c.Matrix4().setPosition(t.CESIUM_RTC.center);r.premultiply(e)}return l===`Y`&&r.premultiply(tr),t.scene.applyMatrix4(r),{type:`gltf`,modelUpAxis:s,upAxis:l,uri:e,byteLength:p,memoryUsage:Pi(t.scene),scene:t.scene,textures:t.textures,animations:t.animations,rtcCenter:(n=t.CESIUM_RTC)==null?void 0:n.center,dispose:()=>t.dispose()}})}var ys=new c.Color;function bs(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Z`:n,s=(r=t.upAxis)==null?`Z`:r,l=(i=t.fetcher)==null?_r:i,u=(a=t.onDownloadProgress)==null?K:a,d=0;return Promise.resolve().then(()=>l.ajax(e,{responseType:`arraybuffer`},void 0,void 0,u).then(e=>(d=e.body.byteLength,e.body))).then(e=>{var n,r;return xs(e,{propertyNameMapping:(n=t.propertyNameMapping)==null?{}:n,customPropertyMapping:(r=t.customPropertyMapping)==null?{}:r})}).then(({geometry:n})=>{switch(t.type){case`geometry`:{let t=n;return o===`Y`&&t.applyMatrix4(er),s===`Y`&&t.applyMatrix4(tr),{type:`ply`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:Ti(t),scene:t,textures:[],animations:[],dispose:()=>{n.dispose()}}}case`line`:{let t=`color`in n.attributes,r=new c.LineBasicMaterial({vertexColors:t}),i=new c.Line(n,r);return i.computeLineDistances(),o===`Y`&&i.applyMatrix4(er),s===`Y`&&i.applyMatrix4(tr),{type:`ply`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:Pi(i),scene:i,textures:[],animations:[],dispose:()=>{n.dispose(),r.dispose()}}}case`pbmMesh`:{let r=new yn(t.light?`phong`:`basic`);r.vertexColors=`color`in n.attributes;let i=new c.Mesh(n,r);return o===`Y`&&i.applyMatrix4(er),s===`Y`&&i.applyMatrix4(tr),{type:`ply`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:Pi(i),scene:i,textures:[],animations:[],dispose:()=>{n.dispose(),r.dispose()}}}case`pbmPointCloud`:{let t=new kn,r=new An(n,t);return o===`Y`&&r.applyMatrix4(er),s===`Y`&&r.applyMatrix4(tr),{type:`ply`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:Pi(r),scene:r,textures:[],animations:[],dispose:()=>{n.dispose(),t.dispose()}}}default:break}throw Error(`Invalid Type: ${t.type}`)})}function xs(e,t){let n=new Uint8Array(e),{headerText:r,headerLength:i}=Ps(n),a=Cs(r,i,t);return a.format===`ascii`?{header:a,geometry:Os(new TextDecoder().decode(n),a,t)}:{header:a,geometry:Ns(e,a,t)}}function Ss(e,t){let n={name:``,type:e[0]};return n.type===`list`?(n.name=e[3],n.countType=e[1],n.itemType=e[2]):n.name=e[1],n.name in t.propertyNameMapping&&(n.name=t.propertyNameMapping[n.name]),n}function Cs(e,t=0,n){let r=/^ply([\s\S]*)end_header(\r\n|\r|\n)/,i=``,a=r.exec(e);a!==null&&(i=a[1]);let o={format:``,version:``,comments:[],elements:[],headerLength:t,objInfo:``},s=i.split(/\r\n|\r|\n/),c=null;for(let e=0;e<s.length;e++){let t=s[e];if(t=t.trim(),t===``)continue;let r=t.split(/\s+/),i=r.shift();switch(t=r.join(` `),i){case`format`:o.format=r[0],o.version=r[1];break;case`comment`:o.comments.push(t);break;case`element`:c&&o.elements.push(c),c={name:r[0],count:parseInt(r[1]),properties:[]};break;case`property`:c&&c.properties.push(Ss(r,n));break;case`obj_info`:o.objInfo=t;break;default:console.log(`unhandled`,i,r)}}return c&&o.elements.push(c),o}function ws(e,t){switch(t){case`char`:case`uchar`:case`short`:case`ushort`:case`int`:case`uint`:case`int8`:case`uint8`:case`int16`:case`uint16`:case`int32`:case`uint32`:return parseInt(e);case`float`:case`double`:case`float32`:case`float64`:return parseFloat(e);default:throw Error(`unspport type: `+t)}}function Ts(e,t){let n={};for(let r=0;r<e.length;r++){if(t.empty())return null;if(e[r].type===`list`){let i=[],a=ws(t.next(),e[r].countType);for(let n=0;n<a;n++){if(t.empty())return null;i.push(ws(t.next(),e[r].itemType))}n[e[r].name]=i}else n[e[r].name]=ws(t.next(),e[r].type)}return n}function Es(e){let t={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[],faceVertexColors:[]};for(let n of Object.keys(e.customPropertyMapping))t[n]=[];return t}function Ds(e){let t=e.map(e=>e.name);function n(e){for(let n=0,r=e.length;n<r;n++){let r=e[n];if(t.includes(r))return r}return null}return{attrX:n([`x`,`px`,`posx`])||`x`,attrY:n([`y`,`py`,`posy`])||`y`,attrZ:n([`z`,`pz`,`posz`])||`z`,attrNX:n([`nx`,`normalx`]),attrNY:n([`ny`,`normaly`]),attrNZ:n([`nz`,`normalz`]),attrS:n([`s`,`u`,`texture_u`,`tx`]),attrT:n([`t`,`v`,`texture_v`,`ty`]),attrR:n([`red`,`diffuse_red`,`r`,`diffuse_r`]),attrG:n([`green`,`diffuse_green`,`g`,`diffuse_g`]),attrB:n([`blue`,`diffuse_blue`,`b`,`diffuse_b`])}}function Os(e,t,n){let r=Es(n),i=/end_header\s+(\S[\s\S]*\S|\S)\s*$/,a,o=null;a=(o=i.exec(e))===null?[]:o[1].split(/\s+/);let s=new Fs(a);loop:for(let e=0;e<t.elements.length;e++){let i=t.elements[e],a=Ds(i.properties);for(let e=0;e<i.count;e++){let e=Ts(i.properties,s);if(!e)break loop;As(r,i.name,e,a,n)}}return ks(r,n)}function ks(e,t){let n=new c.BufferGeometry;e.indices.length>0&&n.setIndex(e.indices),n.setAttribute(`position`,new c.Float32BufferAttribute(e.vertices,3)),e.normals.length>0&&n.setAttribute(`normal`,new c.Float32BufferAttribute(e.normals,3)),e.uvs.length>0&&n.setAttribute(`uv`,new c.Float32BufferAttribute(e.uvs,2)),e.colors.length>0&&n.setAttribute(`color`,new c.Float32BufferAttribute(e.colors,3)),(e.faceVertexUvs.length>0||e.faceVertexColors.length>0)&&(n=n.toNonIndexed(),e.faceVertexUvs.length>0&&n.setAttribute(`uv`,new c.Float32BufferAttribute(e.faceVertexUvs,2)),e.faceVertexColors.length>0&&n.setAttribute(`color`,new c.Float32BufferAttribute(e.faceVertexColors,3)));for(let r of Object.keys(t.customPropertyMapping))if(e[r].length>0){let{itemType:i,itemNames:a,normalized:o}=t.customPropertyMapping[r],s=a.length,l;switch(i){case`float32`:l=new c.Float32BufferAttribute(e[r],s,o);break;case`uint32`:l=new c.Uint32BufferAttribute(e[r],s,o);break;case`int32`:l=new c.Int32BufferAttribute(e[r],s,o);break;case`uint16`:l=new c.Uint16BufferAttribute(e[r],s,o);break;case`int16`:l=new c.Int16BufferAttribute(e[r],s,o);break;case`uint8`:l=new c.Uint8BufferAttribute(e[r],s,o);break;case`int8`:l=new c.Int8BufferAttribute(e[r],s,o);break;default:l=new c.Float32BufferAttribute(e[r],s,o);break}n.setAttribute(r,l)}return n.computeBoundingSphere(),n}function As(e,t,n,r,i){if(t===`vertex`){r.attrX!==null&&r.attrY!==null&&r.attrZ!==null&&e.vertices.push(n[r.attrX],n[r.attrY],n[r.attrZ]),r.attrNX!==null&&r.attrNY!==null&&r.attrNZ!==null&&e.normals.push(n[r.attrNX],n[r.attrNY],n[r.attrNZ]),r.attrS!==null&&r.attrT!==null&&e.uvs.push(n[r.attrS],n[r.attrT]),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(ys.setRGB(n[r.attrR]/255,n[r.attrG]/255,n[r.attrB]/255),e.colors.push(ys.r,ys.g,ys.b));for(let t of Object.keys(i.customPropertyMapping))for(let r of i.customPropertyMapping[t].itemNames)e[t].push(n[r])}else if(t===`face`){let t=n.vertex_indices||n.vertex_index,i=n.texcoord;t.length===3?(e.indices.push(t[0],t[1],t[2]),i&&i.length===6&&(e.faceVertexUvs.push(i[0],i[1]),e.faceVertexUvs.push(i[2],i[3]),e.faceVertexUvs.push(i[4],i[5]))):t.length===4&&(e.indices.push(t[0],t[1],t[3]),e.indices.push(t[1],t[2],t[3])),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(ys.setRGB(n[r.attrR]/255,n[r.attrG]/255,n[r.attrB]/255),e.faceVertexColors.push(ys.r,ys.g,ys.b),e.faceVertexColors.push(ys.r,ys.g,ys.b),e.faceVertexColors.push(ys.r,ys.g,ys.b))}}function js(e,t){let n={},r=0;for(let i=0;i<t.length;i++){let a=t[i],o=a.valueReader;if(a.type===`list`){let t=[],i=a.countReader.read(e+r);r+=a.countReader.size;for(let n=0;n<i;n++)t.push(o.read(e+r)),r+=o.size;n[a.name]=t}else n[a.name]=o.read(e+r),r+=o.size}return[n,r]}function Ms(e,t,n){function r(e,t,n){switch(t){case`int8`:case`char`:return{read:t=>e.getInt8(t),size:1};case`uint8`:case`uchar`:return{read:t=>e.getUint8(t),size:1};case`int16`:case`short`:return{read:t=>e.getInt16(t,n),size:2};case`uint16`:case`ushort`:return{read:t=>e.getUint16(t,n),size:2};case`int32`:case`int`:return{read:t=>e.getInt32(t,n),size:4};case`uint32`:case`uint`:return{read:t=>e.getUint32(t,n),size:4};case`float32`:case`float`:return{read:t=>e.getFloat32(t,n),size:4};case`float64`:case`double`:return{read:t=>e.getFloat64(t,n),size:8};default:throw Error(`not support type: `+t)}}for(let i=0,a=e.length;i<a;i++){let a=e[i];a.type===`list`?(a.countReader=r(t,a.countType,n),a.valueReader=r(t,a.itemType,n)):a.valueReader=r(t,a.type,n)}}function Ns(e,t,n){let r=Es(n),i=t.format===`binary_little_endian`,a=new DataView(e,t.headerLength),o,s=0;for(let e=0;e<t.elements.length;e++){let c=t.elements[e],l=c.properties,u=Ds(l);Ms(l,a,i);for(let e=0;e<c.count;e++){o=js(s,l),s+=o[1];let e=o[0];As(r,c.name,e,u,n)}}return ks(r,n)}function Ps(e){let t=0,n=!0,r=``,i=[],a=new TextDecoder().decode(e.subarray(0,5)),o=/^ply\r\n/.test(a);do{let a=String.fromCharCode(e[t++]);a!==`
831
- `&&a!==`\r`?r+=a:(r===`end_header`&&(n=!1),r!==``&&(i.push(r),r=``))}while(n&&t<e.length);return o===!0&&t++,{headerText:i.join(`\r`)+`\r`,headerLength:t}}var Fs=class{constructor(e){this.arr=e,this.i=0}empty(){return this.i>=this.arr.length}next(){return this.arr[this.i++]}},Is=Uint8Array,Ls=Uint16Array,Rs=Int32Array,zs=new Is([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Bs=new Is([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Vs=new Is([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Hs=function(e,t){for(var n=new Ls(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new Rs(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},Us=Hs(zs,2),Ws=Us.b,Gs=Us.r;Ws[28]=258,Gs[258]=28;var Ks=Hs(Bs,0),qs=Ks.b;Ks.r;for(var Js=new Ls(32768),Ys=0;Ys<32768;++Ys){var Xs=(Ys&43690)>>1|(Ys&21845)<<1;Xs=(Xs&52428)>>2|(Xs&13107)<<2,Xs=(Xs&61680)>>4|(Xs&3855)<<4,Js[Ys]=((Xs&65280)>>8|(Xs&255)<<8)>>1}for(var Zs=(function(e,t,n){for(var r=e.length,i=0,a=new Ls(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new Ls(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new Ls(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[Js[d]>>c]=l}else for(s=new Ls(r),i=0;i<r;++i)e[i]&&(s[i]=Js[o[e[i]-1]++]>>15-e[i]);return s}),Qs=new Is(288),Ys=0;Ys<144;++Ys)Qs[Ys]=8;for(var Ys=144;Ys<256;++Ys)Qs[Ys]=9;for(var Ys=256;Ys<280;++Ys)Qs[Ys]=7;for(var Ys=280;Ys<288;++Ys)Qs[Ys]=8;for(var $s=new Is(32),Ys=0;Ys<32;++Ys)$s[Ys]=5;var ec=Zs(Qs,9,1),tc=Zs($s,5,1),nc=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},rc=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},ic=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},ac=function(e){return(e+7)/8|0},oc=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Is(e.subarray(t,n))},sc=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],cc=function(e,t,n){var r=Error(t||sc[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,cc),!n)throw r;return r},lc=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new Is(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new Is(i*3));var l=function(e){var t=n.length;if(e>t){var r=new Is(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=rc(e,d,1);var v=rc(e,d+1,3);if(d+=3,!v){var y=ac(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&cc(0);break}s&&l(f+b),n.set(e.subarray(y,x),f),t.b=f+=b,t.p=d=x*8,t.f=u;continue}else if(v==1)p=ec,m=tc,h=9,g=5;else if(v==2){var S=rc(e,d,31)+257,C=rc(e,d+10,15)+4,w=S+rc(e,d+5,31)+1;d+=14;for(var T=new Is(w),E=new Is(19),D=0;D<C;++D)E[Vs[D]]=rc(e,d+D*3,7);d+=C*3;for(var O=nc(E),k=(1<<O)-1,A=Zs(E,O,1),D=0;D<w;){var j=A[rc(e,d,k)];d+=j&15;var y=j>>4;if(y<16)T[D++]=y;else{var M=0,N=0;for(y==16?(N=3+rc(e,d,3),d+=2,M=T[D-1]):y==17?(N=3+rc(e,d,7),d+=3):y==18&&(N=11+rc(e,d,127),d+=7);N--;)T[D++]=M}}var ee=T.subarray(0,S),P=T.subarray(S);h=nc(ee),g=nc(P),p=Zs(ee,h,1),m=Zs(P,g,1)}else cc(1);if(d>_){c&&cc(0);break}}s&&l(f+131072);for(var te=(1<<h)-1,ne=(1<<g)-1,re=d;;re=d){var M=p[ic(e,d)&te],ie=M>>4;if(d+=M&15,d>_){c&&cc(0);break}if(M||cc(2),ie<256)n[f++]=ie;else if(ie==256){re=d,p=null;break}else{var ae=ie-254;if(ie>264){var D=ie-257,oe=zs[D];ae=rc(e,d,(1<<oe)-1)+Ws[D],d+=oe}var se=m[ic(e,d)&ne],ce=se>>4;se||cc(3),d+=se&15;var P=qs[ce];if(ce>3){var oe=Bs[ce];P+=ic(e,d)&(1<<oe)-1,d+=oe}if(d>_){c&&cc(0);break}s&&l(f+131072);var F=f+ae;if(f<P){var le=a-P,ue=Math.min(P,F);for(le+f<0&&cc(3);f<ue;++f)n[f]=r[le+f]}for(;f<F;++f)n[f]=n[f-P]}}t.l=p,t.p=re,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?oc(n,0,f):n.subarray(0,f)},uc=new Is(0),dc=function(e,t){return e[t]|e[t+1]<<8},fc=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},pc=function(e,t){return fc(e,t)+fc(e,t+4)*4294967296},mc=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&cc(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&cc(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function hc(e,t){return lc(e,{i:2},t&&t.out,t&&t.dictionary)}function gc(e,t){return lc(e.subarray(mc(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var _c=typeof TextDecoder<`u`&&new TextDecoder;try{_c.decode(uc,{stream:!0})}catch(e){}var vc=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:oc(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function yc(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}else if(_c)return _c.decode(e);else{var i=vc(e),a=i.s,n=i.r;return n.length&&cc(8),a}}var bc=function(e,t){return t+30+dc(e,t+26)+dc(e,t+28)},xc=function(e,t,n){var r=dc(e,t+28),i=yc(e.subarray(t+46,t+46+r),!(dc(e,t+8)&2048)),a=t+46+r,o=fc(e,t+20),s=n&&o==4294967295?Sc(e,a):[o,fc(e,t+24),fc(e,t+42)],c=s[0],l=s[1],u=s[2];return[dc(e,t+10),c,l,i,a+dc(e,t+30)+dc(e,t+32),u]},Sc=function(e,t){for(;dc(e,t)!=1;t+=4+dc(e,t+2));return[pc(e,t+12),pc(e,t+4),pc(e,t+20)]};function Cc(e,t){for(var n={},r=e.length-22;fc(e,r)!=101010256;--r)(!r||e.length-r>65558)&&cc(13);var i=dc(e,r+8);if(!i)return{};var a=fc(e,r+16),o=a==4294967295||i==65535;if(o){var s=fc(e,r-12);o=fc(e,s)==101075792,o&&(i=fc(e,s+32),a=fc(e,s+48))}for(var c=t&&t.filter,l=0;l<i;++l){var u=xc(e,a,o),d=u[0],f=u[1],p=u[2],m=u[3],h=u[4],g=u[5],_=bc(e,g);a=h,(!c||c({name:m,size:f,originalSize:p,compression:d}))&&(d?d==8?n[m]=hc(e.subarray(_,_+f),{out:new Is(p)}):cc(14,`unknown compression type `+d):n[m]=oc(e,_,_+f))}return n}function wc(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?_r:r,s=(i=t.onDownloadProgress)==null?K:i,l=0;return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s).then(e=>(l=e.body.byteLength,e.body))).then(n=>{var r;return Tc(n,{light:t.light,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(r=e.split(`?`)[1])==null?``:r,fetcher:o})}).then(t=>{let n=t.scene,r=t.unitScale/100,i=new c.Matrix4;if(i.makeScale(r,r,r),t.upAxis===`X`)throw Error(`Cannot load fbx x upAxis`);return t.upAxis===`Y`&&i.premultiply(er),a===`Y`&&i.premultiply(tr),n.applyMatrix4(i),{type:`fbx`,modelUpAxis:t.upAxis,upAxis:a,uri:e,byteLength:l,memoryUsage:Pi(n),scene:n,textures:t.textures,animations:t.animations,dispose:()=>t.dispose()}})}function Tc(e,t){let n;if(Nc(e))n=new Ac().parse(e);else{let t=Wc(e);if(!Pc(t))throw Error(`THREE.FBXLoader: Unknown format.`);if(Fc(t)<7e3)throw Error(`THREE.FBXLoader: FBX version not supported, FileVersion: `+Fc(t));n=new kc().parse(t)}return new Ec(t).parse(n)}var Ec=class{constructor(e){var t,n,r;this.light=(t=e.light)==null?!0:t,this.resourcePath=(n=e.resourcePath)==null?``:n,this.search=(r=e.search)==null?``:r,this.fetcher=e.fetcher}parse(e){var t,n,r,i,a,o;let s=this.parseConnections(e),l=Object.assign(new c.Group,{animations:[]}),u=[],d=this.parseImages(e),f=this.parseTextures(e,d,s,u),p=this.parseMaterials(e,f,s),m=this.parseDeformers(e,s),h=new Dc().parse(e,m,s);this.parseScene(e,m,h,p,s,l);let g=(n=(t=e.GlobalSettings.UpAxis)==null?void 0:t.value)==null?1:n,_=(i=(r=e.GlobalSettings.FrontAxis)==null?void 0:r.value)==null?2:i,v=(o=(a=e.GlobalSettings.UnitScaleFactor)==null?void 0:a.value)==null?1:o,y;if(e.GlobalSettings.AmbientColor){let t=e.GlobalSettings.AmbientColor.value,n=t[0],r=t[1],i=t[2];if(n!==0||r!==0||i!==0){let e=new c.Color().setRGB(n,r,i);y=new c.AmbientLight(e,1)}}return Promise.all(u).then(e=>{var t;return{scene:l,textures:e,ambientLight:y,upAxis:[`X`,`Y`,`Z`][g],frontAxis:[`X`,`Y`,`Z`][_],unitScale:v,animations:(t=l.animations)==null?[]:t,dispose:()=>{e.forEach(e=>e.dispose()),p.forEach(e=>e.dispose()),h.forEach(e=>e.dispose())}}})}parseConnections(e){let t=new Map;return`Connections`in e&&e.Connections.connections.forEach(function(e){let n=e[0],r=e[1],i=e[2];t.has(n)||t.set(n,{parents:[],children:[]});let a={ID:r,relationship:i};t.get(n).parents.push(a),t.has(r)||t.set(r,{parents:[],children:[]});let o={ID:n,relationship:i};t.get(r).children.push(o)}),t}parseImages(e){let t={},n={};if(`Video`in e.Objects){let r=e.Objects.Video;for(let e in r){let i=r[e],a=parseInt(e);if(t[a]=i.RelativeFilename||i.Filename,`Content`in i){let t=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,a=typeof i.Content==`string`&&i.Content!==``;if(t||a){let t=this.parseImage(r[e]);n[i.RelativeFilename||i.Filename]=t}}}}for(let e in t){let r=t[e];n[r]===void 0?t[e]=t[e].split(`\\`).pop():t[e]=n[r]}return t}parseImage(e){let t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(`.`)+1).toLowerCase(),i;switch(r){case`bmp`:i=`image/bmp`;break;case`jpg`:case`jpeg`:i=`image/jpeg`;break;case`png`:i=`image/png`;break;case`tif`:i=`image/tiff`;break;case`tga`:i=`image/tga`;break;default:return}if(typeof t==`string`)return`data:`+i+`;base64,`+t;{let e=new Uint8Array(t);return window.URL.createObjectURL(new Blob([e],{type:i}))}}parseTextures(e,t,n,r){let i=new Map;if(`Texture`in e.Objects){let a=e.Objects.Texture;for(let e in a){let o=this.parseTexture(a[e],t,n,r);i.set(parseInt(e),o)}}return i}parseTexture(e,t,n,r){let i=this.loadTexture(e,t,n,r);i.ID=e.id,i.name=e.attrName;let a=e.WrapModeU,o=e.WrapModeV,s=a===void 0?0:a.value,l=o===void 0?0:o.value;if(i.wrapS=s===0?c.RepeatWrapping:c.ClampToEdgeWrapping,i.wrapT=l===0?c.RepeatWrapping:c.ClampToEdgeWrapping,e.Scaling){let t=e.Scaling.value;i.repeat.x=t[0],i.repeat.y=t[1]}if(e.Translation){let t=e.Translation.value;i.offset.x=t[0],i.offset.y=t[1]}return i}loadTexture(e,t,n,r){let i=n.get(e.id).children,a=``;i!==void 0&&i.length>0&&t[i[0].ID]!==void 0&&(a=t[i[0].ID]),a=wr(this.resourcePath,Tr(a,this.search));let o=Object.assign(new c.Texture,{ID:0}),s;s=di()?this.fetcher.ajax(a,{responseType:`blob`}).then(e=>{let t=e.body;return pi(t)}):this.fetcher.loadImage(a,{},void 0,void 0,void 0,fi()).then(e=>e.body);let l=s.then(e=>(o.image=e,o.needsUpdate=!0,o)).catch(e=>(console.warn(e),o));return r.push(l),o}parseMaterials(e,t,n){let r=new Map;if(`Material`in e.Objects){let i=e.Objects.Material;for(let a in i){let o=this.parseMaterial(e,i[a],t,n);o!==null&&r.set(parseInt(a),o)}}return r}parseMaterial(e,t,n,r){let i=t.id,a=t.attrName,o=t.ShadingModel;if(typeof o==`object`&&(o=o.value),o=o.toLowerCase(),!r.has(i))return null;let s=new yn(this.light?`phong`:`basic`);s.name=a,t.BumpFactor&&(s.bumpScale=t.BumpFactor.value),t.Diffuse?s.color=new c.Color().fromArray(t.Diffuse.value):t.DiffuseColor&&(t.DiffuseColor.type===`Color`||t.DiffuseColor.type===`ColorRGB`)&&(s.color=new c.Color().fromArray(t.DiffuseColor.value)),t.DisplacementFactor&&(s.displacementScale=t.DisplacementFactor.value),t.Emissive?s.emissive=new c.Color().fromArray(t.Emissive.value):t.EmissiveColor&&(t.EmissiveColor.type===`Color`||t.EmissiveColor.type===`ColorRGB`)&&(s.emissive=new c.Color().fromArray(t.EmissiveColor.value)),t.EmissiveFactor&&(s.emissiveIntensity=parseFloat(t.EmissiveFactor.value));let l=1-(t.TransparencyFactor?parseFloat(t.TransparencyFactor.value):0);(l===1||l===0)&&(l=t.Opacity?parseFloat(t.Opacity.value):null,l===null&&(l=1-(t.TransparentColor?parseFloat(t.TransparentColor.value[0]):0))),s.opacity=l,s.opacity<1&&(s.transparent=!0),t.ReflectionFactor&&(s.reflectivity=t.ReflectionFactor.value),t.Shininess&&(s.shininess=t.Shininess.value),t.Specular?s.specular=new c.Color().fromArray(t.Specular.value):t.SpecularColor&&t.SpecularColor.type===`Color`&&(s.specular=new c.Color().fromArray(t.SpecularColor.value));let u=this;return r.get(i).children.forEach(function(t){let i=t.relationship;switch(i){case`Bump`:s.bumpMap=u.getTexture(e,n,t.ID,r);break;case`Maya|TEX_ao_map`:s.aoMap=u.getTexture(e,n,t.ID,r);break;case`DiffuseColor`:case`Maya|TEX_color_map`:s.map=u.getTexture(e,n,t.ID,r),s.map!==void 0&&(s.map.encoding=c.sRGBEncoding);break;case`DisplacementColor`:s.displacementMap=u.getTexture(e,n,t.ID,r);break;case`EmissiveColor`:s.emissiveMap=u.getTexture(e,n,t.ID,r),s.emissiveMap!==void 0&&(s.emissiveMap.encoding=c.sRGBEncoding);break;case`NormalMap`:case`Maya|TEX_normal_map`:s.normalMap=u.getTexture(e,n,t.ID,r);break;case`ReflectionColor`:s.envMap=u.getTexture(e,n,t.ID,r),s.envMap!==void 0&&(s.envMap.mapping=c.EquirectangularReflectionMapping,s.envMap.encoding=c.sRGBEncoding);break;case`SpecularColor`:s.specularMap=u.getTexture(e,n,t.ID,r),s.specularMap!==void 0&&(s.specularMap.encoding=c.sRGBEncoding);break;case`TransparentColor`:case`TransparencyFactor`:s.alphaMap=u.getTexture(e,n,t.ID,r),s.transparent=!0;break;default:console.warn(`THREE.FBXLoader: %s map is not supported in three.js, skipping texture.`,i);break}}),s}getTexture(e,t,n,r){return e.Objects.LayeredTexture&&n in e.Objects.LayeredTexture&&(console.warn(`THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer.`),n=r.get(n).children[0].ID),t.get(n)}parseDeformers(e,t){let n={},r={};if(`Deformer`in e.Objects){let i=e.Objects.Deformer;for(let e in i){let a=i[e],o=t.get(parseInt(e));if(a.attrType===`Skin`){let t=this.parseSkeleton(o,i);t.ID=e,o.parents.length>1&&console.warn(`THREE.FBXLoader: skeleton attached to more than one geometry is not supported.`),t.geometryID=o.parents[0].ID,n[e]=t}else if(a.attrType===`BlendShape`){let n={id:e};n.rawTargets=this.parseMorphTargets(o,i,t),n.id=e,o.parents.length>1&&console.warn(`THREE.FBXLoader: morph target attached to more than one geometry is not supported.`),r[e]=n}}}return{skeletons:n,morphTargets:r}}parseSkeleton(e,t){let n=[];return e.children.forEach(function(e){let r=t[e.ID];if(r.attrType!==`Cluster`)return;let i={ID:e.ID,indices:[],weights:[],transformLink:new c.Matrix4().fromArray(r.TransformLink.a)};r.Indexes&&(i.indices=r.Indexes.a,i.weights=r.Weights.a),n.push(i)}),{ID:``,geometryID:0,rawBones:n,bones:[]}}parseMorphTargets(e,t,n){let r=[];for(let i=0;i<e.children.length;i++){let a=e.children[i],o=t[a.ID],s={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a,geoID:0};if(o.attrType!==`BlendShapeChannel`)return;s.geoID=n.get(parseInt(a.ID)).children.filter(function(e){return e.relationship===void 0})[0].ID,r.push(s)}return r}parseScene(e,t,n,r,i,a){let o=this.parseModels(e,t.skeletons,n,r,i),s=e.Objects.Model,l=this;o.forEach(function(t){let n=s[t.ID];l.setLookAtProperties(e,t,n,i,a),i.get(t.ID).parents.forEach(function(e){let n=o.get(e.ID);n!==void 0&&n.add(t)}),t.parent===null&&a.add(t)}),this.bindSkeleton(e,t.skeletons,n,o,i),a.traverse(function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld);let t=Vc(e.userData.transformData);e.applyMatrix4(t),e.updateWorldMatrix(!0,!0)}});let u=new Oc().parse(e,i,a);a.children.length===1&&a.children[0]instanceof c.Group&&(a=a.children[0]),a.animations=u}parseModels(e,t,n,r,i){let a=new Map,o=e.Objects.Model;for(let s in o){let l=parseInt(s),u=o[s],d=i.get(l),f=this.buildSkeleton(d,t,l,u.attrName);if(!f){switch(u.attrType){case`Camera`:f=this.createCamera(e,d);break;case`Light`:f=this.createLight(e,d);break;case`Mesh`:f=this.createMesh(d,n,r);break;case`NurbsCurve`:case`LimbNode`:case`Root`:f=new c.Bone;break;default:f=new c.Group;break}f.name=u.attrName?c.PropertyBinding.sanitizeNodeName(u.attrName):``,f.userData.originalName=u.attrName,f.ID=l}this.getTransformData(f,u),a.set(l,f)}return a}buildSkeleton(e,t,n,r){let i=null;return e.parents.forEach(function(e){for(let a in t){let o=t[a];o.rawBones.forEach(function(t,a){if(t.ID===e.ID){let e=i;i=new c.Bone,i.matrixWorld.copy(t.transformLink),i.name=r?c.PropertyBinding.sanitizeNodeName(r):``,i.userData.originalName=r,i.ID=n,o.bones[a]=i,e!==null&&i.add(e)}})}}),i}createCamera(e,t){let n,r;if(t.children.forEach(function(t){let n=e.Objects.NodeAttribute[t.ID];n!==void 0&&(r=n)}),r===void 0)n=new c.Object3D;else{let e=0;r.CameraProjectionType!==void 0&&r.CameraProjectionType.value===1&&(e=1);let t=1;r.NearPlane!==void 0&&(t=r.NearPlane.value/1e3);let i=1e3;r.FarPlane!==void 0&&(i=r.FarPlane.value/1e3);let a=window.innerWidth,o=window.innerHeight;r.AspectWidth!==void 0&&r.AspectHeight!==void 0&&(a=r.AspectWidth.value,o=r.AspectHeight.value);let s=a/o,l=45;r.FieldOfView!==void 0&&(l=r.FieldOfView.value);let u=r.FocalLength?r.FocalLength.value:null;switch(e){case 0:n=new c.PerspectiveCamera(l,s,t,i),u!==null&&n.setFocalLength(u);break;case 1:console.warn(`THREE.FBXLoader: Orthographic cameras not supported yet.`),n=new c.Object3D;break;default:console.warn(`THREE.FBXLoader: Unknown camera type `+e+`.`),n=new c.Object3D;break}}return n}createLight(e,t){let n,r;if(t.children.forEach(function(t){let n=e.Objects.NodeAttribute[t.ID];n!==void 0&&(r=n)}),r===void 0)n=new c.Object3D;else{let e;e=r.LightType===void 0?0:r.LightType.value;let t=new c.Color(16777215);r.Color!==void 0&&(t=new c.Color().fromArray(r.Color.value));let i=r.Intensity===void 0?1:r.Intensity.value/100;r.CastLightOnObject!==void 0&&r.CastLightOnObject.value===0&&(i=0);let a=0;switch(r.FarAttenuationEnd!==void 0&&(a=r.EnableFarAttenuation!==void 0&&r.EnableFarAttenuation.value===0?0:r.FarAttenuationEnd.value),e){case 0:n=new c.PointLight(t,i,a,1);break;case 1:n=new c.DirectionalLight(t,i);break;case 2:let e=Math.PI/3;r.InnerAngle!==void 0&&(e=c.MathUtils.degToRad(r.InnerAngle.value));let o=0;r.OuterAngle!==void 0&&(o=c.MathUtils.degToRad(r.OuterAngle.value),o=Math.max(o,1)),n=new c.SpotLight(t,i,a,e,o,1);break;default:console.warn(`THREE.FBXLoader: Unknown light type `+r.LightType.value+`, defaulting to a PointLight.`),n=new c.PointLight(t,i);break}r.CastShadows!==void 0&&r.CastShadows.value===1&&(n.castShadow=!0)}return n}createMesh(e,t,n){let r,i=null,a=[];if(e.children.forEach(function(e){t.has(e.ID)&&(i=t.get(e.ID)),n.has(e.ID)&&a.push(n.get(e.ID))}),a.length===0){let e=new yn(this.light?`phong`:`basic`);e.color=new c.Color(13421772),a.push(e)}return`color`in i.attributes&&a.forEach(function(e){e.vertexColors=!0}),(!i.groups||i.groups.length===0)&&i.addGroup(0,i.index?i.index.count:i.attributes.position.count,0),i.FBX_Deformer?(a.forEach(function(e){e.skinning=!0}),r=new xn(i,a),r.normalizeSkinWeights()):r=new bn(i,a),r}createCurve(e,t){let n=e.children.reduce(function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e},null),r=new c.LineBasicMaterial({name:``,color:3342591,linewidth:1});return new c.Line(n,r)}getTransformData(e,t){let n={};t.InheritType&&(n.inheritType=parseInt(t.InheritType.value)),t.RotationOrder?n.eulerOrder=Hc(t.RotationOrder.value):n.eulerOrder=Hc(0),t.Lcl_Translation&&(n.translation=t.Lcl_Translation.value),t.PreRotation&&(n.preRotation=t.PreRotation.value),t.Lcl_Rotation&&(n.rotation=t.Lcl_Rotation.value),t.PostRotation&&(n.postRotation=t.PostRotation.value),t.Lcl_Scaling&&(n.scale=t.Lcl_Scaling.value),t.ScalingOffset&&(n.scalingOffset=t.ScalingOffset.value),t.ScalingPivot&&(n.scalingPivot=t.ScalingPivot.value),t.RotationOffset&&(n.rotationOffset=t.RotationOffset.value),t.RotationPivot&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t,n,r,i){`LookAtProperty`in n&&r.get(t.ID).children.forEach(function(n){if(n.relationship===`LookAtProperty`){let r=e.Objects.Model[n.ID];if(r.Lcl_Translation){let e=r.Lcl_Translation.value;`target`in t&&t.target instanceof c.Object3D?(t.target.position.fromArray(e),i.add(t.target)):t.lookAt(new c.Vector3().fromArray(e))}}})}bindSkeleton(e,t,n,r,i){let a=this.parsePoseNodes(e);for(let e in t){let o=t[e];i.get(parseInt(o.ID)).parents.forEach(function(e){if(n.has(e.ID)){let t=e.ID;i.get(t).parents.forEach(function(e){if(r.has(e.ID)){let t=r.get(e.ID);t instanceof c.SkinnedMesh&&t.bind(new c.Skeleton(o.bones),a[e.ID])}})}})}}parsePoseNodes(e){let t={};if(e.Objects.Pose){let n=e.Objects.Pose;for(let e in n)if(n[e].attrType===`BindPose`&&n[e].NbPoseNodes>0){let r=n[e].PoseNode;Array.isArray(r)?r.forEach(function(e){t[e.Node]=new c.Matrix4().fromArray(e.Matrix.a)}):t[r.Node]=new c.Matrix4().fromArray(r.Matrix.a)}}return t}},Dc=class{constructor(){this.negativeMaterialIndices=!1}parse(e,t,n){let r=new Map;if(`Geometry`in e.Objects){let i=e.Objects.Geometry;for(let a in i){let o=n.get(parseInt(a)),s=this.parseGeometry(e,o,i[a],t);r.set(parseInt(a),s)}}return this.negativeMaterialIndices===!0&&console.warn(`THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected.`),r}parseGeometry(e,t,n,r){switch(n.attrType){case`Mesh`:return this.parseMeshGeometry(e,t,n,r);case`NurbsCurve`:return this.parseNurbsGeometry(n)}}parseMeshGeometry(e,t,n,r){let i=r.skeletons,a=[],o=t.parents.map(function(t){return e.Objects.Model[t.ID]});if(o.length===0)return;let s=t.children.reduce(function(e,t){return i[t.ID]!==void 0&&(e=i[t.ID]),e},null);t.children.forEach(function(e){r.morphTargets[e.ID]!==void 0&&a.push(r.morphTargets[e.ID])});let c=o[0],l={};c.RotationOrder&&(l.eulerOrder=Hc(c.RotationOrder.value)),c.InheritType&&(l.inheritType=parseInt(c.InheritType.value)),c.GeometricTranslation&&(l.translation=c.GeometricTranslation.value),c.GeometricRotation&&(l.rotation=c.GeometricRotation.value),c.GeometricScaling&&(l.scale=c.GeometricScaling.value);let u=Vc(l);return this.genGeometry(e,n,s,a,u)}genGeometry(e,t,n,r,i){let a=new c.BufferGeometry;t.attrName&&(a.name=t.attrName);let o=this.parseGeoNode(t,n),s=this.genBuffers(o),l=new c.Float32BufferAttribute(s.vertex,3);if(l.applyMatrix4(i),a.setAttribute(`position`,l),s.colors.length>0&&a.setAttribute(`color`,new c.Float32BufferAttribute(s.colors,3)),n&&(a.setAttribute(`skinIndex`,new c.Uint16BufferAttribute(s.weightsIndices,4)),a.setAttribute(`skinWeight`,new c.Float32BufferAttribute(s.vertexWeights,4)),a.FBX_Deformer=n),s.normal.length>0){let e=new c.Matrix3().getNormalMatrix(i),t=new c.Float32BufferAttribute(s.normal,3);t.applyNormalMatrix(e),a.setAttribute(`normal`,t)}if(s.uvs.forEach(function(e,t){let n=t===0?`uv`:`uv${t+1}`;a.setAttribute(n,new c.Float32BufferAttribute(s.uvs[t],2))}),o.material&&o.material.mappingType!==`AllSame`){let e=s.materialIndex[0],t=0;if(s.materialIndex.forEach(function(n,r){n!==e&&(a.addGroup(t,r-t,e),e=n,t=r)}),a.groups.length>0){let t=a.groups[a.groups.length-1],n=t.start+t.count;n!==s.materialIndex.length&&a.addGroup(n,s.materialIndex.length-n,e)}a.groups.length===0&&a.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(e,a,t,r,i),a}parseGeoNode(e,t){let n={};if(n.vertexPositions=e.Vertices===void 0?[]:e.Vertices.a,n.vertexIndices=e.PolygonVertexIndex===void 0?[]:e.PolygonVertexIndex.a,e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let t=0;for(;e.LayerElementUV[t];)e.LayerElementUV[t].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[t])),t++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(e,t){e.indices.forEach(function(r,i){n.weightTable[r]===void 0&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})})})),n}genBuffers(e){let t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,i=!1,a=[],o=[],s=[],c=[],l=[],u=[],d=this;return e.vertexIndices.forEach(function(f,p){let m=0,h=!1;f<0&&(f^=-1,h=!0);let g=[],_=[];if(a.push(f*3,f*3+1,f*3+2),e.color){let t=Rc(p,n,f,e.color);s.push(t[0],t[1],t[2])}if(e.skeleton){if(e.weightTable[f]!==void 0&&e.weightTable[f].forEach(function(e){_.push(e.weight),g.push(e.id)}),_.length>4){i||(console.warn(`THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights.`),i=!0);let e=[0,0,0,0],t=[0,0,0,0];_.forEach(function(n,r){let i=n,a=g[r];t.forEach(function(t,n,r){if(i>t){r[n]=i,i=t;let o=e[n];e[n]=a,a=o}})}),g=e,_=t}for(;_.length<4;)_.push(0),g.push(0);for(let e=0;e<4;++e)l.push(_[e]),u.push(g[e])}if(e.normal){let t=Rc(p,n,f,e.normal);o.push(t[0],t[1],t[2])}e.material&&e.material.mappingType!==`AllSame`&&(m=Rc(p,n,f,e.material)[0],m<0&&(d.negativeMaterialIndices=!0,m=0)),e.uv&&e.uv.forEach(function(e,t){let r=Rc(p,n,f,e);c[t]===void 0&&(c[t]=[]),c[t].push(r[0]),c[t].push(r[1])}),r++,h&&(d.genFace(t,e,a,m,o,s,c,l,u,r),n++,r=0,a=[],o=[],s=[],c=[],l=[],u=[])}),t}getNormalNewell(e){let t=new c.Vector3(0,0,0);for(let n=0;n<e.length;n++){let r=e[n],i=e[(n+1)%e.length];t.x+=(r.y-i.y)*(r.z+i.z),t.y+=(r.z-i.z)*(r.x+i.x),t.z+=(r.x-i.x)*(r.y+i.y)}return t.normalize(),t}getNormalTangentAndBitangent(e){let t=this.getNormalNewell(e),n=(Math.abs(t.z)>.5?new c.Vector3(0,1,0):new c.Vector3(0,0,1)).cross(t).normalize();return{normal:t,tangent:n,bitangent:t.clone().cross(n).normalize()}}flattenVertex(e,t,n){return new c.Vector2(e.dot(t),e.dot(n))}genFace(e,t,n,r,i,a,o,s,l,u){let d;if(u>3){let e=[],r=t.baseVertexPositions||t.vertexPositions;for(let t=0;t<n.length;t+=3)e.push(new c.Vector3(r[n[t]],r[n[t+1]],r[n[t+2]]));let{tangent:i,bitangent:a}=this.getNormalTangentAndBitangent(e),o=[];for(let t of e)o.push(this.flattenVertex(t,i,a));d=c.ShapeUtils.triangulateShape(o,[])}else d=[[0,1,2]];for(let[c,u,f]of d)e.vertex.push(t.vertexPositions[n[c*3]]),e.vertex.push(t.vertexPositions[n[c*3+1]]),e.vertex.push(t.vertexPositions[n[c*3+2]]),e.vertex.push(t.vertexPositions[n[u*3]]),e.vertex.push(t.vertexPositions[n[u*3+1]]),e.vertex.push(t.vertexPositions[n[u*3+2]]),e.vertex.push(t.vertexPositions[n[f*3]]),e.vertex.push(t.vertexPositions[n[f*3+1]]),e.vertex.push(t.vertexPositions[n[f*3+2]]),t.skeleton&&(e.vertexWeights.push(s[c*4]),e.vertexWeights.push(s[c*4+1]),e.vertexWeights.push(s[c*4+2]),e.vertexWeights.push(s[c*4+3]),e.vertexWeights.push(s[u*4]),e.vertexWeights.push(s[u*4+1]),e.vertexWeights.push(s[u*4+2]),e.vertexWeights.push(s[u*4+3]),e.vertexWeights.push(s[f*4]),e.vertexWeights.push(s[f*4+1]),e.vertexWeights.push(s[f*4+2]),e.vertexWeights.push(s[f*4+3]),e.weightsIndices.push(l[c*4]),e.weightsIndices.push(l[c*4+1]),e.weightsIndices.push(l[c*4+2]),e.weightsIndices.push(l[c*4+3]),e.weightsIndices.push(l[u*4]),e.weightsIndices.push(l[u*4+1]),e.weightsIndices.push(l[u*4+2]),e.weightsIndices.push(l[u*4+3]),e.weightsIndices.push(l[f*4]),e.weightsIndices.push(l[f*4+1]),e.weightsIndices.push(l[f*4+2]),e.weightsIndices.push(l[f*4+3])),t.color&&(e.colors.push(a[c*3]),e.colors.push(a[c*3+1]),e.colors.push(a[c*3+2]),e.colors.push(a[u*3]),e.colors.push(a[u*3+1]),e.colors.push(a[u*3+2]),e.colors.push(a[f*3]),e.colors.push(a[f*3+1]),e.colors.push(a[f*3+2])),t.material&&t.material.mappingType!==`AllSame`&&(e.materialIndex.push(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(i[c*3]),e.normal.push(i[c*3+1]),e.normal.push(i[c*3+2]),e.normal.push(i[u*3]),e.normal.push(i[u*3+1]),e.normal.push(i[u*3+2]),e.normal.push(i[f*3]),e.normal.push(i[f*3+1]),e.normal.push(i[f*3+2])),t.uv&&t.uv.forEach(function(t,n){e.uvs[n]===void 0&&(e.uvs[n]=[]),e.uvs[n].push(o[n][c*2]),e.uvs[n].push(o[n][c*2+1]),e.uvs[n].push(o[n][u*2]),e.uvs[n].push(o[n][u*2+1]),e.uvs[n].push(o[n][f*2]),e.uvs[n].push(o[n][f*2+1])})}addMorphTargets(e,t,n,r,i){if(r.length===0)return;t.morphTargetsRelative=!0,t.morphAttributes.position=[];let a=this;r.forEach(function(r){r.rawTargets.forEach(function(r){let o=e.Objects.Geometry[r.geoID];o!==void 0&&a.genMorphGeometry(t,n,o,i,r.name)})})}genMorphGeometry(e,t,n,r,i){let a=t.Vertices===void 0?[]:t.Vertices.a,o=t.PolygonVertexIndex===void 0?[]:t.PolygonVertexIndex.a,s=n.Vertices===void 0?[]:n.Vertices.a,l=n.Indexes?n.Indexes.a:[],u=e.attributes.position.count*3,d=new Float32Array(u);for(let e=0;e<l.length;e++){let t=l[e]*3;d[t]=s[e*3],d[t+1]=s[e*3+1],d[t+2]=s[e*3+2]}let f={vertexIndices:o,vertexPositions:d,baseVertexPositions:a},p=this.genBuffers(f),m=new c.Float32BufferAttribute(p.vertex,3);m.name=i||n.attrName,m.applyMatrix4(r),e.morphAttributes.position.push(m)}parseNormals(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a,i=[];return n===`IndexToDirect`&&(e.NormalIndex?i=e.NormalIndex.a:e.NormalsIndex&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:t,referenceType:n}}parseUVs(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.UV.a,i=[];return n===`IndexToDirect`&&(i=e.UVIndex.a),{dataSize:2,buffer:r,indices:i,mappingType:t,referenceType:n}}parseVertexColors(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Colors.a,i=[];n===`IndexToDirect`&&(i=e.ColorIndex.a);for(let e=0,t=new c.Color;e<r.length;e+=4)t.fromArray(r,e),t.toArray(r,e);return{dataSize:4,buffer:r,indices:i,mappingType:t,referenceType:n}}parseMaterialIndices(e){let t=e.MappingInformationType,n=e.ReferenceInformationType;if(t===`NoMappingInformation`)return{dataSize:1,buffer:[0],indices:[0],mappingType:`AllSame`,referenceType:n};let r=e.Materials.a,i=[];for(let e=0;e<r.length;++e)i.push(e);return{dataSize:1,buffer:r,indices:i,mappingType:t,referenceType:n}}parseNurbsGeometry(e){let t=parseInt(e.Order);if(isNaN(t))return console.error(`THREE.FBXLoader: Invalid Order %s given for geometry ID: %s`,e.Order,e.id),new c.BufferGeometry;let n=t-1,r=e.KnotVector.a,i=[],a=e.Points.a;for(let e=0,t=a.length;e<t;e+=4)i.push(new c.Vector4().fromArray(a,e));let o,s;if(e.Form===`Closed`)i.push(i[0]);else if(e.Form===`Periodic`){o=n,s=r.length-1-o;for(let e=0;e<n;++e)i.push(i[e])}let l=new qc(n,r,i,o,s).getPoints(i.length*12);return new c.BufferGeometry().setFromPoints(l)}},Oc=class{parse(e,t,n){let r=[],i=this.parseClips(e,t,n);if(i!==void 0)for(let e in i){let t=i[e],a=this.addClip(t,n);r.push(a)}return r}parseClips(e,t,n){if(e.Objects.AnimationCurve===void 0)return;let r=this.parseAnimationCurveNodes(e);this.parseAnimationCurves(e,r,t);let i=this.parseAnimationLayers(e,r,t,n);return this.parseAnimStacks(e,i,t)}parseAnimationCurveNodes(e){let t=e.Objects.AnimationCurveNode,n=new Map;for(let e in t){let r=t[e];if(r.attrName.match(/S|R|T|DeformPercent/)!==null){let e={id:r.id,attr:r.attrName,curves:{}};n.set(e.id,e)}}return n}parseAnimationCurves(e,t,n){let r=e.Objects.AnimationCurve;for(let e in r){let i={id:r[e].id,times:r[e].KeyTime.a.map(Ic),values:r[e].KeyValueFloat.a},a=n.get(i.id);if(a!==void 0){let e=a.parents[0].ID,n=a.parents[0].relationship,r=t.get(e);r&&(n.match(/X/)?r.curves.x=i:n.match(/Y/)?r.curves.y=i:n.match(/Z/)?r.curves.z=i:n.match(/DeformPercent/)&&t.has(e)&&(r.curves.morph=i))}}}parseAnimationLayers(e,t,n,r){let i=e.Objects.AnimationLayer,a=new Map;for(let o in i){let i=[],s=n.get(parseInt(o));s!==void 0&&(s.children.forEach((a,o)=>{if(t.has(a.ID)){let s=t.get(a.ID);if(s.curves.x!==void 0||s.curves.y!==void 0||s.curves.z!==void 0){if(i[o]===void 0){let t=n.get(a.ID).parents.filter(function(e){return e.relationship!==void 0})[0].ID;if(t!==void 0){let n=e.Objects.Model[t.toString()];if(n===void 0){console.warn(`THREE.FBXLoader: Encountered a unused curve.`,a);return}let s={modelName:n.attrName?c.PropertyBinding.sanitizeNodeName(n.attrName):``,ID:n.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1],transform:new c.Matrix4,eulerOrder:``,preRotation:[0,0,0],postRotation:[0,0,0]};r.traverse(function(e){e.ID===n.id&&(s.transform=e.matrix,e.userData.transformData&&(s.eulerOrder=e.userData.transformData.eulerOrder))}),s.transform||(s.transform=new c.Matrix4),n.PreRotation&&(s.preRotation=n.PreRotation.value),n.PostRotation&&(s.postRotation=n.PostRotation.value),i[o]=s}}i[o]&&(i[o][s.attr]=s)}else if(s.curves.morph!==void 0){if(i[o]===void 0){let t=n.get(a.ID).parents.filter(function(e){return e.relationship!==void 0})[0].ID,r=n.get(t).parents[0].ID,s=n.get(r).parents[0].ID,l=n.get(s).parents[0].ID,u=e.Objects.Model[l];i[o]={modelName:u.attrName?c.PropertyBinding.sanitizeNodeName(u.attrName):``,morphName:e.Objects.Deformer[t].attrName}}i[o][s.attr]=s}}}),a.set(parseInt(o),i))}return a}parseAnimStacks(e,t,n){let r=e.Objects.AnimationStack,i={};for(let e in r){let a=n.get(parseInt(e)).children;a.length>1&&console.warn(`THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.`);let o=t.get(a[0].ID);i[e]={name:r[e].attrName,layer:o}}return i}addClip(e,t){let n=[],r=this;return e.layer.forEach(function(e){n=n.concat(r.generateTracks(e,t))}),new c.AnimationClip(e.name,-1,n)}generateTracks(e,t){let n=[],r=new c.Vector3,i=new c.Vector3;e.transform&&e.transform.decompose(r,new c.Quaternion,i);let a=r.toArray(),o=i.toArray();if(e.T!==void 0&&Object.keys(e.T.curves).length>0){let t=this.generateVectorTrack(e.modelName,e.T.curves,a,`position`);t!==void 0&&n.push(t)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){let t=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);t!==void 0&&n.push(t)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){let t=this.generateVectorTrack(e.modelName,e.S.curves,o,`scale`);t!==void 0&&n.push(t)}if(e.DeformPercent!==void 0){let r=this.generateMorphTrack(e,t);r!==void 0&&n.push(r)}return n}generateVectorTrack(e,t,n,r){let i=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(i,t,n);return new c.VectorKeyframeTrack(e+`.`+r,i,a)}generateRotationTrack(e,t,n,r,i){let a,o;if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){let e=this.interpolateRotations(t.x,t.y,t.z,i);a=e[0],o=e[1]}let s=Hc(0),l=new c.Quaternion,u=new c.Quaternion;n!==void 0&&(n=n.map(c.MathUtils.degToRad),n.push(s),l.setFromEuler(new c.Euler().fromArray(n))),r!==void 0&&(r=r.map(c.MathUtils.degToRad),r.push(s),u.setFromEuler(new c.Euler().fromArray(r)),u.inverse());let d=new c.Quaternion,f=new c.Euler,p=[];if(!o||!a)return new c.QuaternionKeyframeTrack(e+`.quaternion`,[0],[0]);for(let e=0;e<o.length;e+=3)f.set(o[e],o[e+1],o[e+2],i),d.setFromEuler(f),d.premultiply(l),d.multiply(u),e>2&&new c.Quaternion().fromArray(p,(e-3)/3*4).dot(d)<0&&d.set(-d.x,-d.y,-d.z,-d.w),d.toArray(p,e/3*4);return new c.QuaternionKeyframeTrack(e+`.quaternion`,a,p)}generateMorphTrack(e,t){let n=e.DeformPercent.curves.morph,r=n.values.map(function(e){return e/100}),i=t.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new c.NumberKeyframeTrack(e.modelName+`.morphTargetInfluences[`+i+`]`,n.times,r)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(e,t){return e-t}),t.length>1){let e=1,n=t[0];for(let r=1;r<t.length;r++){let i=t[r];i!==n&&(t[e]=i,n=i,e++)}t=t.slice(0,e)}return t}getKeyframeTrackValues(e,t,n){let r=n,i=[],a=-1,o=-1,s=-1;return e.forEach(function(e){if(t.x&&(a=t.x.times.indexOf(e)),t.y&&(o=t.y.times.indexOf(e)),t.z&&(s=t.z.times.indexOf(e)),a!==-1){let e=t.x.values[a];i.push(e),r[0]=e}else i.push(r[0]);if(o!==-1){let e=t.y.values[o];i.push(e),r[1]=e}else i.push(r[1]);if(s!==-1){let e=t.z.values[s];i.push(e),r[2]=e}else i.push(r[2])}),i}interpolateRotations(e,t,n,r){let i=[],a=[];i.push(e.times[0]),a.push(c.MathUtils.degToRad(e.values[0])),a.push(c.MathUtils.degToRad(t.values[0])),a.push(c.MathUtils.degToRad(n.values[0]));for(let o=1;o<e.values.length;o++){let s=[e.values[o-1],t.values[o-1],n.values[o-1]];if(isNaN(s[0])||isNaN(s[1])||isNaN(s[2]))continue;let l=s.map(c.MathUtils.degToRad),u=[e.values[o],t.values[o],n.values[o]];if(isNaN(u[0])||isNaN(u[1])||isNaN(u[2]))continue;u.map(c.MathUtils.degToRad);let d=[u[0]-s[0],u[1]-s[1],u[2]-s[2]],f=[Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2])];if(f[0]>=180||f[1]>=180||f[2]>=180){let t=Math.max(...f)/180,n=new c.Euler(l[0],l[1],l[2],r),s=new c.Euler(l[0],l[1],l[2],r),u=new c.Quaternion().setFromEuler(n),d=new c.Quaternion().setFromEuler(s);u.dot(d)&&d.set(-d.x,-d.y,-d.z,-d.w);let p=e.times[o-1],m=e.times[o]-p,h=new c.Quaternion,g=new c.Euler;for(let e=0;e<1;e+=1/t)h.copy(u.clone().slerp(d.clone(),e)),i.push(p+e*m),g.setFromQuaternion(h,r),a.push(g.x),a.push(g.y),a.push(g.z)}else i.push(e.times[o]),a.push(c.MathUtils.degToRad(e.values[o])),a.push(c.MathUtils.degToRad(t.values[o])),a.push(c.MathUtils.degToRad(n.values[o]))}return[i,a]}},kc=class{constructor(){this.allNodes=new Mc,this.nodeStack=[],this.currentIndent=0,this.currentPropName=``}getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),--this.currentIndent}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new Mc,this.nodeStack=[],this.currentProp=[],this.currentPropName=``;let t=this,n=e.split(/[\r\n]+/);return n.forEach(function(e,r){let i=e.match(/^[\s\t]*;/),a=e.match(/^[\s\t]*$/);if(i||a)return;let o=e.match(`^\\t{`+t.currentIndent+`}(\\w+):(.*){`),s=e.match(`^\\t{`+t.currentIndent+`}(\\w+):[\\s\\t\\r\\n](.*)`),c=e.match(`^\\t{`+(t.currentIndent-1)+`}}`);o?t.parseNodeBegin(e,o):s?t.parseNodeProperty(e,s,n[++r]):c?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)}),this.allNodes}parseNodeBegin(e,t){let n=t[1].trim().replace(/^"/,``).replace(/"$/,``),r=t[2].split(`,`).map(function(e){return e.trim().replace(/^"/,``).replace(/"$/,``)}),i={name:n},a=this.parseNodeAttr(r),o=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,i):n in o?(n===`PoseNode`?o.PoseNode.push(i):o[n].id!==void 0&&(o[n]={},o[n][o[n].id]=o[n]),a.id!==``&&(o[n][a.id]=i)):typeof a.id==`number`?(o[n]={},o[n][a.id]=i):n!==`Properties70`&&(n===`PoseNode`?o[n]=[i]:o[n]=i),typeof a.id==`number`&&(i.id=a.id),a.name!==``&&(i.attrName=a.name),a.type!==``&&(i.attrType=a.type),this.pushStack(i)}parseNodeAttr(e){let t=e[0];e[0]!==``&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n=``,r=``;return e.length>1&&(n=e[1].replace(/^(\w+)::/,``),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,``).replace(/"$/,``).trim(),i=t[2].replace(/^"/,``).replace(/"$/,``).trim();r===`Content`&&i===`,`&&(i=n.replace(/"/g,``).replace(/,$/,``).trim());let a=this.getCurrentNode();if(a.name===`Properties70`){this.parseNodeSpecialProperty(e,r,i);return}if(r===`C`){let e=i.split(`,`).slice(1),t=parseInt(e[0]),n=parseInt(e[1]),o=i.split(`,`).slice(3);o=o.map(function(e){return e.trim().replace(/^"/,``)}),r=`connections`,i=[t,n],Gc(i,o),a[r]===void 0&&(a[r]=[])}r===`Node`&&(a.id=i),r in a&&Array.isArray(a[r])?a[r].push(i):r===`a`?a.a=i:a[r]=i,this.setCurrentProp(a,r),r===`a`&&i.slice(-1)!==`,`&&(a.a=Uc(i))}parseNodePropertyContinued(e){let t=this.getCurrentNode();t.a+=e,e.slice(-1)!==`,`&&(t.a=Uc(t.a))}parseNodeSpecialProperty(e,t,n){let r=n.split(`",`).map(function(e){return e.trim().replace(/^\"/,``).replace(/\s/,`_`)}),i=r[0],a=r[1],o=r[2],s=r[3],c=r[4];switch(a){case`int`:case`enum`:case`bool`:case`ULongLong`:case`double`:case`Number`:case`FieldOfView`:c=parseFloat(c);break;case`Color`:case`ColorRGB`:case`Vector3D`:case`Lcl_Translation`:case`Lcl_Rotation`:case`Lcl_Scaling`:c=Uc(c);break}this.getPrevNode()[i]={type:a,type2:o,flag:s,value:c},this.setCurrentProp(this.getPrevNode(),i)}},Ac=class{parse(e){let t=new jc(e);t.skip(23);let n=t.getUint32();if(n<6400)throw Error(`THREE.FBXLoader: FBX version not supported, FileVersion: `+n);let r=new Mc;for(;!this.endOfContent(t);){let e=this.parseNode(t,n);e!==null&&r.add(e.name,e)}return r}endOfContent(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){let n={},r=t>=7500?e.getUint64():e.getUint32(),i=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();let a=e.getUint8(),o=e.getString(a);if(r===0)return null;let s=[];for(let t=0;t<i;t++)s.push(this.parseProperty(e));let c=s.length>0?s[0]:``,l=s.length>1?s[1]:``,u=s.length>2?s[2]:``;for(n.singleProperty=i===1&&e.getOffset()===r;r>e.getOffset();){let r=this.parseNode(e,t);r!==null&&this.parseSubNode(o,n,r)}return n.propertyList=s,typeof c==`number`&&(n.id=c),l!==``&&(n.attrName=l),u!==``&&(n.attrType=u),o!==``&&(n.name=o),n}parseSubNode(e,t,n){if(n.singleProperty===!0){let e=n.propertyList[0];Array.isArray(e)?(t[n.name]=n,n.a=e):t[n.name]=e}else if(e===`Connections`&&n.name===`C`){let e=[];n.propertyList.forEach(function(t,n){n!==0&&e.push(t)}),t.connections===void 0&&(t.connections=[]),t.connections.push(e)}else if(n.name===`Properties70`)Object.keys(n).forEach(function(e){t[e]=n[e]});else if(e===`Properties70`&&n.name===`P`){let e=n.propertyList[0],r=n.propertyList[1],i=n.propertyList[2],a=n.propertyList[3],o;e.indexOf(`Lcl `)===0&&(e=e.replace(`Lcl `,`Lcl_`)),r.indexOf(`Lcl `)===0&&(r=r.replace(`Lcl `,`Lcl_`)),o=r===`Color`||r===`ColorRGB`||r===`Vector`||r===`Vector3D`||r.indexOf(`Lcl_`)===0?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[e]={type:r,type2:i,flag:a,value:o}}else t[n.name]===void 0?typeof n.id==`number`?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name===`PoseNode`?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){let t=e.getString(1),n;switch(t){case`C`:return e.getBoolean();case`D`:return e.getFloat64();case`F`:return e.getFloat32();case`I`:return e.getInt32();case`L`:return e.getInt64();case`R`:return n=e.getUint32(),e.getArrayBuffer(n);case`S`:return n=e.getUint32(),e.getString(n);case`Y`:return e.getInt16();case`b`:case`c`:case`d`:case`f`:case`i`:case`l`:let r=e.getUint32(),i=e.getUint32(),a=e.getUint32();if(i===0)switch(t){case`b`:case`c`:return e.getBooleanArray(r);case`d`:return e.getFloat64Array(r);case`f`:return e.getFloat32Array(r);case`i`:return e.getInt32Array(r);case`l`:return e.getInt64Array(r)}let o=new jc(gc(new Uint8Array(e.getArrayBuffer(a))).buffer);switch(t){case`b`:case`c`:return o.getBooleanArray(r);case`d`:return o.getFloat64Array(r);case`f`:return o.getFloat32Array(r);case`i`:return o.getInt32Array(r);case`l`:return o.getInt64Array(r)}break;default:throw Error(`THREE.FBXLoader: Unknown property type `+t)}}},jc=class{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t===void 0?!0:t,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)==1}getBooleanArray(e){let t=[];for(let n=0;n<e;n++)t.push(this.getBoolean());return t}getUint8(){let e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){let e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){let e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getInt32());return t}getUint32(){let e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){let e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getFloat32());return t}getFloat64(){let e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getFloat64());return t}getArrayBuffer(e){let t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){let t=this.offset,n=new Uint8Array(this.dv.buffer,t,e);this.skip(e);let r=n.indexOf(0);return r>=0&&(n=new Uint8Array(this.dv.buffer,t,r)),this._textDecoder.decode(n)}},Mc=class{constructor(){this.Connections={connections:[]},this.Objects={Model:{},NodeAttribute:{},Geometry:{}},this.GlobalSettings={}}add(e,t){this[e]=t}};function Nc(e){return e.byteLength>=21&&Wc(e,0,21)===`Kaydara FBX Binary \0`}function Pc(e){let t=[`K`,`a`,`y`,`d`,`a`,`r`,`a`,`\\`,`F`,`B`,`X`,`\\`,`B`,`i`,`n`,`a`,`r`,`y`,`\\`,`\\`],n=0;function r(t){let r=e[t-1];return e=e.slice(n+t),n++,r}for(let e=0;e<t.length;++e)if(r(1)===t[e])return!1;return!0}function Fc(e){let t=e.match(/FBXVersion: (\d+)/);if(t)return parseInt(t[1]);throw Error(`THREE.FBXLoader: Cannot find the version number for the file given.`)}function Ic(e){return e/46186158e3}var Lc=[];function Rc(e,t,n,r){let i;switch(r.mappingType){case`ByPolygonVertex`:i=e;break;case`ByPolygon`:i=t;break;case`ByVertice`:i=n;break;case`AllSame`:i=r.indices[0];break;default:console.warn(`THREE.FBXLoader: unknown attribute mapping type `+r.mappingType),i=0}r.referenceType===`IndexToDirect`&&(i=r.indices[i]);let a=i*r.dataSize,o=a+r.dataSize;return Kc(Lc,r.buffer,a,o)}var zc=new c.Euler,Bc=new c.Vector3;function Vc(e){let t=new c.Matrix4,n=new c.Matrix4,r=new c.Matrix4,i=new c.Matrix4,a=new c.Matrix4,o=new c.Matrix4,s=new c.Matrix4,l=new c.Matrix4,u=new c.Matrix4,d=new c.Matrix4,f=new c.Matrix4,p=new c.Matrix4,m=e.inheritType?e.inheritType:0;e.translation&&t.setPosition(Bc.fromArray(e.translation));let h=Hc(0);if(e.preRotation){let t=e.preRotation.map(c.MathUtils.degToRad);t.push(h),n.makeRotationFromEuler(zc.fromArray(t))}if(e.rotation){let t=e.rotation.map(c.MathUtils.degToRad);t.push(e.eulerOrder||h),r.makeRotationFromEuler(zc.fromArray(t))}if(e.postRotation){let t=e.postRotation.map(c.MathUtils.degToRad);t.push(h),i.makeRotationFromEuler(zc.fromArray(t)),i.copy(new c.Matrix4().getInverse(i))}e.scale&&a.scale(Bc.fromArray(e.scale)),e.scalingOffset&&s.setPosition(Bc.fromArray(e.scalingOffset)),e.scalingPivot&&o.setPosition(Bc.fromArray(e.scalingPivot)),e.rotationOffset&&l.setPosition(Bc.fromArray(e.rotationOffset)),e.rotationPivot&&u.setPosition(Bc.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(f.copy(e.parentMatrix),d.copy(e.parentMatrixWorld));let g=n.clone().multiply(r).multiply(i),_=new c.Matrix4;_.extractRotation(d);let v=new c.Matrix4;v.copyPosition(d);let y=new c.Matrix4().getInverse(v).multiply(d),b=new c.Matrix4().getInverse(_).multiply(y),x=a,S=new c.Matrix4;if(m===0)S.copy(_).multiply(g).multiply(b).multiply(x);else if(m===1)S.copy(_).multiply(b).multiply(g).multiply(x);else{let e=new c.Matrix4().scale(new c.Vector3().setFromMatrixScale(f)),t=new c.Matrix4().getInverse(e),n=b.clone().multiply(t);S.copy(_).multiply(g).multiply(n).multiply(x)}let C=new c.Matrix4().getInverse(u),w=new c.Matrix4().getInverse(o),T=t.clone().multiply(l).multiply(u).multiply(n).multiply(r).multiply(i).multiply(C).multiply(s).multiply(o).multiply(a).multiply(w),E=new c.Matrix4().copyPosition(T),D=d.clone().multiply(E);return p.copyPosition(D),T=p.clone().multiply(S),T.premultiply(new c.Matrix4().getInverse(d)),T}function Hc(e){e=e||0;let t=[`ZYX`,`YZX`,`XZY`,`ZXY`,`YXZ`,`XYZ`];return e===6?(console.warn(`THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect.`),t[0]):t[e]}function Uc(e){return e.split(`,`).map(function(e){return parseFloat(e)})}function Wc(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=e.byteLength),new TextDecoder().decode(new Uint8Array(e,t,n))}function Gc(e,t){for(let n=0,r=e.length,i=t.length;n<i;n++,r++)e[r]=t[n]}function Kc(e,t,n,r){for(let i=n,a=0;i<r;i++,a++)e[a]=t[i];return e}var qc=class extends c.Curve{constructor(e,t,n,r,i){super();let a=t?t.length-1:0,o=n?n.length:0;this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=r||0,this.endKnot=i||a;for(let e=0;e<o;++e){let t=n[e];this.controlPoints[e]=new c.Vector4(t.x,t.y,t.z,t.w)}}getPoint(e,t=new c.Vector3){let n=t,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=Xc(this.degree,this.knots,this.controlPoints,r);return i.w!==1&&i.divideScalar(i.w),n.set(i.x,i.y,i.z)}getTangent(e,t=new c.Vector3){let n=t,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),i=tl(this.degree,this.knots,this.controlPoints,r,1);return n.copy(i[1]).normalize(),n}toJSON(){let e=super.toJSON();return e.degree=this.degree,e.knots=[...this.knots],e.controlPoints=this.controlPoints.map(e=>e.toArray()),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e}fromJSON(e){return super.fromJSON(e),this.degree=e.degree,this.knots=[...e.knots],this.controlPoints=e.controlPoints.map(e=>new c.Vector4(e[0],e[1],e[2],e[3])),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this}};function Jc(e,t,n){let r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;let i=e,a=r,o=Math.floor((i+a)/2);for(;t<n[o]||t>=n[o+1];)t<n[o]?a=o:i=o,o=Math.floor((i+a)/2);return o}function Yc(e,t,n,r){let i=[],a=[],o=[];i[0]=1;for(let s=1;s<=n;++s){a[s]=t-r[e+1-s],o[s]=r[e+s]-t;let n=0;for(let e=0;e<s;++e){let t=o[e+1],r=a[s-e],c=i[e]/(t+r);i[e]=n+t*c,n=r*c}i[s]=n}return i}function Xc(e,t,n,r){let i=Jc(e,r,t),a=Yc(i,r,e,t),o=new c.Vector4(0,0,0,0);for(let t=0;t<=e;++t){let r=n[i-e+t],s=a[t],c=r.w*s;o.x+=r.x*c,o.y+=r.y*c,o.z+=r.z*c,o.w+=r.w*s}return o}function Zc(e,t,n,r,i){let a=[];for(let e=0;e<=n;++e)a[e]=0;let o=[];for(let e=0;e<=r;++e)o[e]=a.slice(0);let s=[];for(let e=0;e<=n;++e)s[e]=a.slice(0);s[0][0]=1;let c=a.slice(0),l=a.slice(0);for(let r=1;r<=n;++r){c[r]=t-i[e+1-r],l[r]=i[e+r]-t;let n=0;for(let e=0;e<r;++e){let t=l[e+1],i=c[r-e];s[r][e]=t+i;let a=s[e][r-1]/s[r][e];s[e][r]=n+t*a,n=i*a}s[r][r]=n}for(let e=0;e<=n;++e)o[0][e]=s[e][n];for(let e=0;e<=n;++e){let t=0,i=1,c=[];for(let e=0;e<=n;++e)c[e]=a.slice(0);c[0][0]=1;for(let a=1;a<=r;++a){let r=0,l=e-a,u=n-a;e>=a&&(c[i][0]=c[t][0]/s[u+1][l],r=c[i][0]*s[l][u]);let d=l>=-1?1:-l,f=e-1<=u?a-1:n-e;for(let e=d;e<=f;++e)c[i][e]=(c[t][e]-c[t][e-1])/s[u+1][l+e],r+=c[i][e]*s[l+e][u];e<=u&&(c[i][a]=-c[t][a-1]/s[u+1][e],r+=c[i][a]*s[e][u]),o[a][e]=r;let p=t;t=i,i=p}}let u=n;for(let e=1;e<=r;++e){for(let t=0;t<=n;++t)o[e][t]*=u;u*=n-e}return o}function Qc(e,t,n,r,i){let a=i<e?i:e,o=[],s=Jc(e,r,t),l=Zc(s,r,e,a,t),u=[];for(let e=0;e<n.length;++e){let t=n[e].clone(),r=t.w;t.x*=r,t.y*=r,t.z*=r,u[e]=t}for(let t=0;t<=a;++t){let n=u[s-e].clone().multiplyScalar(l[t][0]);for(let r=1;r<=e;++r)n.add(u[s-e+r].clone().multiplyScalar(l[t][r]));o[t]=n}for(let e=a+1;e<=i+1;++e)o[e]=new c.Vector4(0,0,0);return o}function $c(e,t){let n=1;for(let t=2;t<=e;++t)n*=t;let r=1;for(let e=2;e<=t;++e)r*=e;for(let n=2;n<=e-t;++n)r*=n;return n/r}function el(e){let t=e.length,n=[],r=[];for(let i=0;i<t;++i){let t=e[i];n[i]=new c.Vector3(t.x,t.y,t.z),r[i]=t.w}let i=[];for(let e=0;e<t;++e){let t=n[e].clone();for(let n=1;n<=e;++n)t.sub(i[e-n].clone().multiplyScalar($c(e,n)*r[n]));i[e]=t.divideScalar(r[0])}return i}function tl(e,t,n,r,i){return el(Qc(e,t,n,r,i))}var nl=new c.Vector3;function rl(e,t){switch(t){case`D`:return new Float64Array(e);case`F`:return new Float32Array(e);case`L`:return new Int32Array(e);case`I`:return new Int16Array(e);default:return new Uint8Array(e)}}function il(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?_r:r,s=(i=t.onDownloadProgress)==null?K:i,l={byteLength:0};return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s)).then(n=>{var r,i;return l.byteLength=n.body.byteLength,al(new Uint8Array(n.body),{light:(r=t.light)==null?!0:r,color:t.color,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(i=e.split(`?`)[1])==null?``:i,fetcher:o})}).then(t=>{let n=new c.Group;return n.name=e,n.add(t.object),a===`Y`&&n.applyMatrix4(tr),{type:`x3p`,modelUpAxis:`Z`,upAxis:a,uri:e,byteLength:l.byteLength,memoryUsage:Pi(n),scene:n,textures:[],animations:[],dispose:()=>t.dispose()}})}function al(e,t){var n,r,i,a,o,s,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,N,ee,P,te,ne,re,ie,ae,oe,se,ce,F,le,ue,de,fe,pe,me,he,ge,_e,ve,ye,be;let xe=Cc(e),Se=``,Ce=null;for(let e of Object.keys(xe))/(^|\/)main\.xml$/i.test(e)&&(Ce=xe[e],Se=e.slice(0,e.lastIndexOf(`/`)+1));if(!Ce)throw Error(`X3p: main.xml not found.`);if(typeof DOMParser>`u`)throw Error(`X3p: DOMParser not found.`);let we=(n=t.color)==null?new c.Color(10066329):n,Te=new DOMParser,Ee=Fa(Ce),De=Te.parseFromString(Ee,`text/xml`),I=De.querySelector(`Record1 Axes`),Oe={x:{type:(a=(i=(r=I==null?void 0:I.querySelector(`CX AxisType`))==null?void 0:r.textContent)==null?void 0:i.toUpperCase())==null?`I`:a,dataType:(l=(s=(o=I==null?void 0:I.querySelector(`CX DataType`))==null?void 0:o.textContent)==null?void 0:s.toUpperCase())==null?`D`:l,increment:Number((d=(u=I==null?void 0:I.querySelector(`CX Increment`))==null?void 0:u.textContent)==null?`1`:d),offset:Number((p=(f=I==null?void 0:I.querySelector(`CX Offset`))==null?void 0:f.textContent)==null?`0`:p)},y:{type:(g=(h=(m=I==null?void 0:I.querySelector(`CY AxisType`))==null?void 0:m.textContent)==null?void 0:h.toUpperCase())==null?`I`:g,dataType:(y=(v=(_=I==null?void 0:I.querySelector(`CY DataType`))==null?void 0:_.textContent)==null?void 0:v.toUpperCase())==null?`D`:y,increment:Number((x=(b=I==null?void 0:I.querySelector(`CY Increment`))==null?void 0:b.textContent)==null?`1`:x),offset:Number((C=(S=I==null?void 0:I.querySelector(`CY Offset`))==null?void 0:S.textContent)==null?`0`:C)},z:{type:(E=(T=(w=I==null?void 0:I.querySelector(`CZ AxisType`))==null?void 0:w.textContent)==null?void 0:T.toUpperCase())==null?`A`:E,dataType:(k=(O=(D=I==null?void 0:I.querySelector(`CZ DataType`))==null?void 0:D.textContent)==null?void 0:O.toUpperCase())==null?`D`:k,increment:Number((j=(A=I==null?void 0:I.querySelector(`CZ Increment`))==null?void 0:A.textContent)==null?`1`:j),offset:Number((N=(M=I==null?void 0:I.querySelector(`CZ Offset`))==null?void 0:M.textContent)==null?`0`:N)}},ke=null,Ae=De.querySelector(`Record1 Axes Rotation`);Ae&&(ke=new c.Matrix3,ke.set(Number((P=(ee=Ae.querySelector(`r11`))==null?void 0:ee.textContent)==null?0:P),Number((ne=(te=Ae.querySelector(`r12`))==null?void 0:te.textContent)==null?0:ne),Number((ie=(re=Ae.querySelector(`r13`))==null?void 0:re.textContent)==null?0:ie),Number((oe=(ae=Ae.querySelector(`r21`))==null?void 0:ae.textContent)==null?0:oe),Number((ce=(se=Ae.querySelector(`r22`))==null?void 0:se.textContent)==null?0:ce),Number((le=(F=Ae.querySelector(`r23`))==null?void 0:F.textContent)==null?0:le),Number((de=(ue=Ae.querySelector(`r31`))==null?void 0:ue.textContent)==null?0:de),Number((pe=(fe=Ae.querySelector(`r32`))==null?void 0:fe.textContent)==null?0:pe),Number((he=(me=Ae.querySelector(`r33`))==null?void 0:me.textContent)==null?0:he)));let je=(ge=De.querySelector(`Record3 DataLink PointDataLink`))==null?void 0:ge.textContent;if(typeof je!=`string`)throw Error(`X3p: PointDataLink not found.`);je=wr(Se,je);let Me=xe[je];if(!Me)throw Error(`X3p: ${Me} not found.`);let Ne=rl(Me.buffer,Oe.z.dataType),Pe=Number((ve=(_e=De.querySelector(`Record3 MatrixDimension SizeX`))==null?void 0:_e.textContent)==null?`0`:ve),Fe=Number((be=(ye=De.querySelector(`Record3 MatrixDimension SizeY`))==null?void 0:ye.textContent)==null?`0`:be),Ie=Math.floor(Pe-1),Le=Math.floor(Fe-1),L=Ie+1,Re=Le+1,ze=new Float32Array(L*Re*3),Be=new Float32Array(L*Re*2),Ve=new Uint32Array(Ie*Le*6),He=new c.Box3;for(let e=0;e<Re;e++){let t=e*Oe.y.increment+Oe.y.offset;for(let n=0;n<L;n++){let r=e*L+n,i=n*Oe.x.increment+Oe.x.offset,a=Ne[r],o=!isNaN(a),s=o?a:NaN;nl.set(i,-t,s),ke&&nl.applyMatrix3(ke),o&&He.expandByPoint(nl),ze[r*3+0]=nl.x,ze[r*3+1]=nl.y,ze[r*3+2]=nl.z,Be[r*2+0]=n/Ie,Be[r*2+1]=1-e/Le}}for(let e=0;e<Le;e++)for(let t=0;t<Ie;t++){let n=t+L*e,r=t+L*(e+1),i=t+1+L*(e+1),a=t+1+L*e,o=(e*Ie+t)*6;Ve[o+0]=n,Ve[o+1]=r,Ve[o+2]=a,Ve[o+3]=r,Ve[o+4]=i,Ve[o+5]=a}let Ue=new c.BufferGeometry;Ue.setAttribute(`position`,new c.BufferAttribute(ze,3)),Ue.setAttribute(`uv`,new c.BufferAttribute(Be,2)),Ue.setIndex(new c.BufferAttribute(Ve,1)),(!Ue.groups||Ue.groups.length===0)&&Ue.addGroup(0,Ue.index?Ue.index.count:Ue.attributes.position.count,0),Ue.boundingBox=He;let We=new yn(t.light?`phong`:`basic`);return We.flatShading=!0,We.color.copy(we),{object:new bn(Ue,[We]),dispose:()=>{Ue.dispose(),We.dispose()}}}function ol(e){let t=e.length/32;if(e.length%32!=0)throw Error(`Invalid splat file: data length ${e.length} is not a multiple of 32`);let n=new Float32Array(3*t),r=new Float32Array(4*t),i=new Float32Array(3*t),a=new Uint8Array(4*t),o=new Float32Array(e.buffer),s=new Uint8Array(e.buffer);for(let e=0;e<t;e++)n[3*e+0]=o[8*e+0],n[3*e+1]=o[8*e+1],n[3*e+2]=o[8*e+2],i[3*e+0]=o[8*e+3+0],i[3*e+1]=o[8*e+3+1],i[3*e+2]=o[8*e+3+2],a[4*e+0]=s[32*e+24+0],a[4*e+1]=s[32*e+24+1],a[4*e+2]=s[32*e+24+2],a[4*e+3]=s[32*e+24+3],r[4*e+0]=(s[32*e+28+0]-128)/128,r[4*e+1]=(s[32*e+28+1]-128)/128,r[4*e+2]=(s[32*e+28+2]-128)/128,r[4*e+3]=(s[32*e+28+3]-128)/128;return{numPoints:t,positions:n,scales:i,rotations:r,colors:a}}function sl(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Y`:n,s=(r=t.upAxis)==null?`Z`:r,c=(i=t.fetcher)==null?_r:i,l=(a=t.onDownloadProgress)==null?K:a,u=0;return Promise.resolve().then(()=>c.ajax(e,{responseType:`arraybuffer`},void 0,void 0,l)).then(e=>(u=e.body.byteLength,e.body)).then(e=>ol(new Uint8Array(e))).then(t=>{let n=new $n({positions:t.positions,scales:t.scales,rotations:t.rotations,colors:t.colors,numPoints:t.numPoints});return o===`Y`&&n.applyMatrix4(er),{type:`splat`,modelUpAxis:o,upAxis:s,uri:e,byteLength:u,memoryUsage:Pi(n),scene:n,textures:[],animations:[],dispose:()=>n.dispose()}})}var cl;(function(e){e[e.Outside=-1]=`Outside`,e[e.Intersecting=0]=`Intersecting`,e[e.Inside=1]=`Inside`})(cl||(cl={}));var ll=1e-6,ul=new c.Matrix4().identity(),Y=new c.Vector3,dl=new c.Matrix4,fl=new c.Vector3,pl=new c.Vector3,ml=new c.Vector3,hl=new c.Vector3,gl=new c.Box3,_l=new c.Sphere,vl=new c.Matrix4,yl=new c.Ray,bl=new c.Object3D,xl=new c.Frustum;function Sl(e,t){let n=e.elements;return t.setFromRotationMatrix(dl.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1)),t}var Cl=class e{static get MASK_OUTSIDE(){return 4294967295}static get MASK_INSIDE(){return 0}static get MASK_INDETERMINATE(){return 2147483647}constructor(e=[]){this.planes=e}setFromFrustum(e){return this.planes=e.planes.map(e=>e.clone()),this}setFromCamera(e){return dl.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),xl.setFromProjectionMatrix(dl),this.setFromFrustum(xl),this}applyMatrix4(e){for(let t of this.planes)t.applyMatrix4(e)}copy(e){return this.planes=e.planes.map(e=>e.clone()),this}clone(){return new e().copy(this)}computeVisibility(e){let t=cl.Inside;for(let n of this.planes)switch(e.intersectPlane(n)){case cl.Outside:return cl.Outside;case cl.Intersecting:t=cl.Intersecting;break;default:}return t}computeVisibilityWithPlaneMask(t,n){if(n===e.MASK_OUTSIDE||n===e.MASK_INSIDE)return n;let r=e.MASK_INSIDE,i=Math.min(32,this.planes.length);for(let a=0;a<i;++a){let i=1<<a;if((n&i)===0)continue;let o=this.planes[a],s=t.intersectPlane(o);if(s===cl.Outside)return e.MASK_OUTSIDE;s===cl.Intersecting&&(r|=i)}return r}},wl=class e{constructor(){this.type=`box`,this.center=new c.Vector3,this.halfSize=new c.Vector3,this.rotation=new c.Matrix3}fromJson({box:e}){this.center.set(e[0],e[1],e[2]);let t=e[3],n=e[4],r=e[5],i=e[6],a=e[7],o=e[8],s=e[9],c=e[10],l=e[11],u=Math.max(Math.sqrt(t*t+n*n+r*r),.001),d=Math.max(Math.sqrt(i*i+a*a+o*o),.001),f=Math.max(Math.sqrt(s*s+c*c+l*l),.001);this.halfSize.set(u,d,f);let p=this.halfSize.toArray().reduce((e,t)=>e+t,0);return(isNaN(p)||p<=0)&&this.halfSize.setScalar(ll),this.rotation.fromArray([t/u,n/u,r/u,i/d,a/d,o/d,s/f,c/f,l/f]),isNaN(this.rotation.toArray().reduce((e,t)=>e+t,0))&&this.rotation.identity(),this}toJson(){return this.rotation.extractBasis(fl,pl,ml),{box:[...this.center.toArray(),...fl.multiplyScalar(this.halfSize.x).toArray(),...pl.multiplyScalar(this.halfSize.y).toArray(),...ml.multiplyScalar(this.halfSize.z).toArray()]}}copy(e){return this.center.copy(e.center),this.halfSize.copy(e.halfSize),this.rotation.copy(e.rotation),this}clone(){return new e().copy(this)}applyMatrix4(e){return e.equals(ul)?this:(bl.position.copy(this.center),Sl(this.rotation,bl.quaternion),bl.scale.copy(this.halfSize),bl.matrix.compose(bl.position,bl.quaternion,bl.scale),bl.matrix.premultiply(e),bl.matrix.decompose(bl.position,bl.quaternion,bl.scale),this.center.copy(bl.position),this.rotation.setFromMatrix4(dl.makeRotationFromQuaternion(bl.quaternion)),this.halfSize.copy(bl.scale),this)}getCenter(e){return e.copy(this.center)}distanceSquaredToPoint(e){let t=this.rotation.elements,n=e.x-this.center.x,r=e.y-this.center.y,i=e.z-this.center.z,a=0,o;return o=n*t[0]+r*t[1]+i*t[2],o<0&&(o=-o),o-=this.halfSize.x,o>0&&(a+=o*o),o=n*t[3]+r*t[4]+i*t[5],o<0&&(o=-o),o-=this.halfSize.y,o>0&&(a+=o*o),o=n*t[6]+r*t[7]+i*t[8],o<0&&(o=-o),o-=this.halfSize.z,o>0&&(a+=o*o),a}distanceToPoint(e){return Math.sqrt(this.distanceSquaredToPoint(e))}distanceToPlane(e){let t=e.projectPoint(this.center,new c.Vector3);return this.distanceToPoint(t)}getBoundingBox(e){return e.makeEmpty(),this.rotation.extractBasis(fl,pl,ml),fl.setLength(this.halfSize.x),pl.setLength(this.halfSize.y),ml.setLength(this.halfSize.z),e.expandByPoint(Y.copy(this.center).add(fl)),e.expandByPoint(Y.copy(this.center).sub(fl)),e.expandByPoint(Y.copy(this.center).add(pl)),e.expandByPoint(Y.copy(this.center).sub(pl)),e.expandByPoint(Y.copy(this.center).add(ml)),e.expandByPoint(Y.copy(this.center).sub(ml)),e}toGeometry(){let e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(24);Y.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,0),Y.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,3),Y.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,6),Y.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,9),Y.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,12),Y.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,15),Y.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,18),Y.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,21);let n=new c.BufferGeometry;return n.setIndex(new c.BufferAttribute(e,1)),n.setAttribute(`position`,new c.BufferAttribute(t,3)),n.computeBoundingBox(),n.computeBoundingSphere(),n}intersectPlane(e){let t=this.center,n=e.normal,r=this.rotation.elements,i=this.halfSize,a=n.x,o=n.y,s=n.z,c=Math.abs(a*r[0]*i.x+o*r[1]*i.x+s*r[2]*i.x)+Math.abs(a*r[3]*i.y+o*r[4]*i.y+s*r[5]*i.y)+Math.abs(a*r[6]*i.z+o*r[7]*i.z+s*r[8]*i.z),l=n.dot(t)+e.constant;return l<=-c?cl.Outside:l>=c?cl.Inside:cl.Intersecting}intersectRay(e,t=0,n){if(hl.copy(this.halfSize).multiplyScalar(2),gl.setFromCenterAndSize(Y.set(0,0,0),hl),gl.expandByScalar(t),this.rotation.extractBasis(fl,pl,ml),dl.makeBasis(fl,pl,ml),dl.setPosition(this.center),vl.getInverse(dl),yl.copy(e).applyMatrix4(vl),gl.containsPoint(yl.origin))return!0;let r=yl.intersectBox(gl,Y);return r?n===void 0?!0:(n+=t,r.distanceToSquared(yl.origin)<=n*n):!1}},Tl=class e{constructor(){this.type=`sphere`,this.center=new c.Vector3,this.radius=-1}fromJson({sphere:e}){return this.center.set(e[0],e[1],e[2]),this.radius=Math.max(e[3],ll),this}toJson(){return{sphere:[...this.center.toArray(),this.radius]}}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}clone(){return new e().copy(this)}getBoundingBox(e){return e.setFromCenterAndSize(this.center,hl.set(1,1,1).multiplyScalar(this.radius*2)),e}toGeometry(){let e=new Float32Array(384);for(let t=0;t<=32;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=this.center.x+Math.cos(n)*this.radius,e[t*6+1]=this.center.y+Math.sin(n)*this.radius,e[t*6+2]=this.center.z+0,n=(t+1)/32*Math.PI*2,e[t*6+3]=this.center.x+Math.cos(n)*this.radius,e[t*6+4]=this.center.y+Math.sin(n)*this.radius,e[t*6+5]=this.center.z+0}for(let t=32;t<=64;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=this.center.x+Math.cos(n)*this.radius,e[t*6+1]=this.center.y+0,e[t*6+2]=this.center.z+Math.sin(n)*this.radius,n=(t+1)/32*Math.PI*2,e[t*6+3]=this.center.x+Math.cos(n)*this.radius,e[t*6+4]=this.center.y+0,e[t*6+5]=this.center.z+Math.sin(n)*this.radius}let t=new c.BufferGeometry;return t.setAttribute(`position`,new c.BufferAttribute(e,3)),t.computeBoundingBox(),t.computeBoundingSphere(),t}applyMatrix4(e){return e.equals(ul)?this:(this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this)}getCenter(e){return e.copy(this.center)}distanceSquaredToPoint(e){let t=this.distanceToPoint(e);return t*t}distanceToPoint(e){let t=this.center.distanceTo(e)-this.radius;return t<=0?0:t}distanceToPlane(e){let t=Math.abs(e.distanceToPoint(this.center));return Math.max(0,t-this.radius)}intersectPlane(e){let t=this.center,n=this.radius,r=e.normal.dot(t)+e.constant;return r<-n?cl.Outside:r<n?cl.Intersecting:cl.Inside}intersectRay(e,t=0,n){if(_l.set(this.center,this.radius+t),_l.containsPoint(e.origin))return!0;let r=e.intersectSphere(_l,Y);return r?n===void 0?!0:(n+=t,e.origin.distanceToSquared(r)<=n*n):!1}},El=class e{constructor(){throw this.type=`regin`,this.west=0,this.south=0,this.east=0,this.north=0,this.minHeight=0,this.maxHeight=0,Error(`Region bounding volume not supported.`)}fromJson({region:e}){return this.west=e[0],this.south=e[1],this.east=e[2],this.north=e[3],this.minHeight=e[4],this.maxHeight=e[5],this}toJson(){return{region:[this.west,this.south,this.east,this.north,this.minHeight,this.maxHeight]}}copy(e){return this.west=e.west,this.south=e.south,this.east=e.east,this.north=e.north,this.minHeight=e.minHeight,this.maxHeight=e.maxHeight,this}clone(){return new e().copy(this)}getBoundingBox(e){throw Error(`not implemented`)}toGeometry(){throw Error(`not implemented`)}applyMatrix4(e){throw Error(`not implemented`)}getCenter(e){throw Error(`not implemented`)}distanceToPoint(e){throw Error(`not implemented`)}distanceSquaredToPoint(e){throw Error(`not implemented`)}distanceToPlane(e){throw Error(`not implemented`)}intersectPlane(e){throw Error(`not implemented`)}intersectRay(e,t=0,n){throw Error(`not implemented`)}};function Dl(e){return e instanceof wl||e instanceof Tl||e instanceof El}function Ol(e){if(Dl(e))return e;if(`box`in e)return new wl().fromJson(e);if(`sphere`in e)return new Tl().fromJson(e);if(`region`in e)return new El().fromJson(e);throw Error(`BoundingVolume ${JSON.stringify(e)} never suppored.`)}var kl=[4821759,8191922,16637280,16739958,5822969,376977,16747077,9259235,14514687].map(e=>new c.LineBasicMaterial({color:e,depthWrite:!1,depthTest:!0,transparent:!0,opacity:.5})),Al=(()=>{let e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(24);Y.set(1,1,1).toArray(t,0),Y.set(-1,1,1).toArray(t,3),Y.set(-1,-1,1).toArray(t,6),Y.set(1,-1,1).toArray(t,9),Y.set(1,1,-1).toArray(t,12),Y.set(-1,1,-1).toArray(t,15),Y.set(-1,-1,-1).toArray(t,18),Y.set(1,-1,-1).toArray(t,21);let n=new c.BufferGeometry;return n.setIndex(new c.BufferAttribute(e,1)),n.setAttribute(`position`,new c.BufferAttribute(t,3)),n.computeBoundingBox(),n.computeBoundingSphere(),n})(),jl=(()=>{let e=new Float32Array(384);for(let t=0;t<=32;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=Math.cos(n),e[t*6+1]=Math.sin(n),e[t*6+2]=0,n=(t+1)/32*Math.PI*2,e[t*6+3]=Math.cos(n),e[t*6+4]=Math.sin(n),e[t*6+5]=0}for(let t=32;t<=64;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=Math.cos(n),e[t*6+1]=0,e[t*6+2]=Math.sin(n),n=(t+1)/32*Math.PI*2,e[t*6+3]=Math.cos(n),e[t*6+4]=0,e[t*6+5]=Math.sin(n)}let t=new c.BufferGeometry;return t.setAttribute(`position`,new c.BufferAttribute(e,3)),t.computeBoundingBox(),t.computeBoundingSphere(),t})();function Ml(e,t=0){if(e instanceof wl){let n=new c.LineSegments(Al,kl[Math.min(t,kl.length-1)]);return n.position.copy(e.center),Sl(e.rotation,n.quaternion),n.scale.set(e.halfSize.x,e.halfSize.y,e.halfSize.z),n.matrix.compose(n.position,n.quaternion,n.scale),n}else if(e instanceof Tl){let n=new c.LineSegments(jl,kl[Math.min(t,kl.length-1)]);return n.position.copy(e.center),n.scale.set(e.radius,e.radius,e.radius),n.matrix.compose(n.position,n.quaternion,n.scale),n}return null}var Nl=new c.Vector3,Pl=new c.Plane,Fl=new Tl,Il=new wl,Ll=class e{constructor(t,n,r,i){var a,o,s,l;this.parent=null,this.contentParent=null,this.floor=0,this.id=t,this.state={visible:!1,frameNumber:0,selectedFrameNumber:0,requestedFrameNumber:0,touchedFrameNumber:0,distanceToCamera:0,centerZDepth:0,centerScreenY:0,screenSpaceError:0,visibilityPlaneMask:0,inRequestVolume:!1,shouldRefine:!1,stackLength:0,finalResolution:!0,selectionDepth:0,shouldSelect:!1,lastSelect:!1,ancestorWithContent:null,ancestorWithContentAvailable:null},this.parent=i==null?null:i,this.contentParent=i?i.hasRenderContent?i:i.contentParent:null,this.level=this.parent?this.parent.level+1:0,this.tileset=r,this.refine=(a=n.refine)==null?this.parent?this.parent.refine:`REPLACE`:a,this.transform=new c.Matrix4,n.transform&&this.transform.fromArray(n.transform),this.parent&&this.transform.premultiply(this.parent.transform),typeof n.geometricError==`number`?this.geometricError=n.geometricError*this.transform.getMaxScaleOnAxis():this.geometricError=(s=(o=this.parent)==null?void 0:o.geometricError)==null?0:s,n.content&&n.content.uri?(this.content={uri:n.content.uri,loadState:`UNLOADED`,loadProgress:0,loadStateUpdateTime:H(),loadfailRetryDelay:0,byteLength:0,memoryUsage:0},n.content.group!==void 0&&(this.content.group=n.content.group),/\.json$/.test(this.content.uri)?this.type=`TILESET`:this.type=`SCENEGRAPH`):(this.content=null,this.type=`EMPTY`),this.levelOfContent=this.parent?this.parent.levelOfContent:-1,this.type===`SCENEGRAPH`&&(this.levelOfContent+=1),n.boundingVolume&&(this.boundingVolume=Ol(n.boundingVolume).applyMatrix4(this.transform)),n.viewerRequestVolume&&(this.viewerRequestVolume=Ol(n.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=(l=n.extras)==null?{}:l,typeof this.extras.floor!=`number`&&i&&typeof i.extras.floor==`number`&&(this.extras.floor=i.extras.floor),typeof this.extras.floor==`number`&&(this.floor=this.extras.floor,this.tileset.floorLength=Math.max(this.tileset.floorLength,this.floor+1)),n.children?this.children=n.children.map((t,n)=>new e(`${this.id}.${n}`,t,r,this)):this.children=[]}traverse(e){e(this);for(let t of this.children)t.traverse(e)}updateState(e){this.state.frameNumber=e.frameNumber;let t=this.tileset.transform;if(this.boundingVolume){let n;n=this.boundingVolume instanceof wl?Il.copy(this.boundingVolume):this.boundingVolume instanceof Tl?Fl.copy(this.boundingVolume):this.boundingVolume.clone(),n.applyMatrix4(t),e.camera.type===`OrthographicCamera`?(Pl.setFromNormalAndCoplanarPoint(e.camera.direction,e.camera.position),this.state.distanceToCamera=n.distanceToPlane(Pl)):this.state.distanceToCamera=n.distanceToPoint(e.camera.position);let r=n.getCenter(Nl).sub(e.camera.position);this.state.centerZDepth=e.camera.direction.dot(r),this.state.centerScreenY=e.camera.up.dot(r);let i=this.parent?this.parent.state.visibilityPlaneMask:Cl.MASK_INDETERMINATE;this.state.visibilityPlaneMask=e.cullingVolume.computeVisibilityWithPlaneMask(n,i),this.state.visible=this.state.visibilityPlaneMask!==Cl.MASK_OUTSIDE,e.cameraCulling||(this.state.visible=!0)}else this.state.distanceToCamera=0,this.state.centerZDepth=0,this.state.visibilityPlaneMask=Cl.MASK_INDETERMINATE,this.state.visible=!0;if((this.levelOfContent<=e.minLevelOfDetail||this.geometricError>=e.maxGeometricError)&&(this.state.visible=!0),this.viewerRequestVolume){let n;n=this.viewerRequestVolume instanceof wl?Il.copy(this.viewerRequestVolume):this.viewerRequestVolume instanceof Tl?Fl.copy(this.viewerRequestVolume):this.viewerRequestVolume.clone(),n.applyMatrix4(t),this.state.inRequestVolume=n.distanceSquaredToPoint(e.camera.position)<=0}else this.state.inRequestVolume=!0;this.state.screenSpaceError=this.getScreenSpaceError(e,this.state.distanceToCamera,!1)}get selected(){return this.state.selectedFrameNumber===this.tileset.frameNumber}get hasChildren(){return this.children.length>0}get siblingIndex(){var e,t;return(t=(e=this.parent)==null?void 0:e.children.indexOf(this))==null?0:t}get hasTilesetContent(){return this.children.length>0&&this.type===`TILESET`}get hasRenderContent(){return this.type===`SCENEGRAPH`}get contentAvailable(){var e;return this.hasRenderContent&&((e=this.content)==null?void 0:e.loadState)===`READY`}get hasUnloadedContent(){var e;return((e=this.content)==null?void 0:e.loadState)===`UNLOADED`}get hasEmptyContent(){return this.type===`EMPTY`}get contentReady(){var e;return((e=this.content)==null?void 0:e.loadState)===`READY`||this.hasEmptyContent}get contentByteLength(){return this.content?this.content.byteLength:0}get contentMemoryUsage(){return this.content?this.content.memoryUsage:0}getScreenSpaceError(e,t,n){let r=this.tileset.transform.getMaxScaleOnAxis(),i=this.parent?this.parent.geometricError:this.tileset.geometricError,a=r*(n?i:this.geometricError);if(a===0)return 0;let o=e.height,s=e.sseDenominator;return e.camera.type===`OrthographicCamera`?a/(1/(e.camera.projectionMatrix.elements[5]/2)/o*.9):a/(Math.max(t,.001)*s/o)}getPriority(e){let t=this.refine===`ADD`||e.skipLevelOfDetail;if(t&&!this.state.visible||e.frameNumber-this.state.touchedFrameNumber>=1)return-1;let n=this.parent,r=n&&(!t||this.state.screenSpaceError===0)?n.state.screenSpaceError:this.state.screenSpaceError,i=this.tileset.root?this.tileset.root.state.screenSpaceError:0;return Math.max(i-r,0)}},Rl=e=>Number(e);function zl(e,t=Rl,n=!1){let r,i=1/0;for(let n of e){let e=t(n);e<=i&&(r=n,i=e)}return isFinite(i)||(i=0),n?[r,i]:r}function Bl(e,t,n=(e,t)=>e===t){let r=e.length;if(r!==t.length)return!1;for(let i=0;i<r;i++)if(n(e[i],t[i])===!1)return!1;return!0}var Vl=new Set;function Hl(e){Vl.clear();let t=[],n=e.length;for(let r=0;r<n;r++){let n=e[r];Vl.has(n)||(t.push(n),Vl.add(n))}return Vl.clear(),t}var Ul=e=>e.distance,Wl=(e,t)=>e.distance-t.distance;function Gl(e,t=!0,n=!1){if(n&&e.length>1){let t=zl(e,Ul);t?(e[0]=t,e.length=1):e.length=0}return t&&e.length>1&&e.sort(Wl),e}var Kl=class{constructor(e,t){this.position=e,this.indices=t}getPositionCount(){var e,t;let n=this.indices,r=this.position;return n?n.array.length/((e=n.stride)==null?1:e):r.array.length/((t=r.stride)==null?3:t)}getPositionByIndex(e,t){var n,r,i,a;let o=this.indices,s=this.position,c=e;if(o){let t=o.array,i=(n=o.stride)==null?1:n,a=(r=o.offset)==null?0:r;c=t[e*i+a]}let l=s.array,u=(i=s.stride)==null?3:i,d=(a=s.offset)==null?0:a;return c=c*u+d,t.x=l[c],t.y=l[c+1],t.z=l[c+2],t}createTree(e,t,n){throw Error(`not implemented`)}trianglesInSphere(e,t){throw Error(`not implemented`)}intersectRay(e,t,n=0,r=!1,i){throw Error(`not implemented`)}},ql=class{constructor(e,t,n,r,i){this.id=e,this.extents=t,this.startIndex=n,this.endIndex=r,this.deepth=i}};function Jl(e,t){let n=new ArrayBuffer(t*36),r=new Float32Array(n),i=new Uint32Array(n),a=new Uint16Array(n),o=[e],s,c;for(;s=o.pop();)c=s.id*36/4,r[c]=s.extents[0],r[c+1]=s.extents[1],r[c+2]=s.extents[2],r[c+3]=s.extents[3],r[c+4]=s.extents[4],r[c+5]=s.extents[5],i[c+6]=s.startIndex,i[c+7]=s.endIndex,c=s.id*36/2,s.node0&&(a[c+16]=s.node0.id,o.push(s.node0)),s.node1&&(a[c+17]=s.node1.id,o.push(s.node1));return n}function Yl(e,t,n,r=0){let i=n.min.x-r,a=n.min.y-r,o=n.min.z-r,s=n.max.x+r,c=n.max.y+r,l=n.max.z+r,u=0,d=0,f=0,p=0,m=0,h=0;return t.x>=0?(u=(i-e.x)*t.x,d=(s-e.x)*t.x):(u=(s-e.x)*t.x,d=(i-e.x)*t.x),t.y>=0?(f=(a-e.y)*t.y,p=(c-e.y)*t.y):(f=(c-e.y)*t.y,p=(a-e.y)*t.y),u>p||f>d||((f>u||u!==u)&&(u=f),(p<d||d!==d)&&(d=p),t.z>=0?(m=(o-e.z)*t.z,h=(l-e.z)*t.z):(m=(l-e.z)*t.z,h=(o-e.z)*t.z),u>h||m>d)||((m>u||u!==u)&&(u=m),(h<d||d!==d)&&(d=h),d<0)?null:u>=0?u:0}var Xl=class e{constructor(e,t,n){this.x=e,this.y=t,this.z=n}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,n){return this.x=e,this.y=t,this.z=n,this}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}add(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}subVectors(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}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){let t=this.x,n=this.y,r=this.z;return this.x=n*e.z-r*e.y,this.y=r*e.x-t*e.z,this.z=t*e.y-n*e.x,this}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}clone(){return new e(this.x,this.y,this.z)}},Zl=class{constructor(e,t,n,r,i){this.pointA=e,this.pointB=t,this.pointC=n,this.index=r,this.intersectionPoint=i}},Ql=class{constructor(e,t){this.min=e,this.max=t}},$l=1e-6,eu=new Xl(0,0,0),tu=new Xl(0,0,0),nu=new Xl(0,0,0),ru=new Xl(0,0,0),iu=class extends Kl{createTree(e,t,n){t=Math.min(t,16);let r=this.getPositionCount()/3,i=r>65535?new Uint32Array(r):new Uint16Array(r),a=new Float32Array(r*6),o=[],s=0,c=-1;if(n)for(let e=0;e<r;e+=1){let t=e*3,n=e*6,r,o,s,c,l,u,d;i[e]=e,this.getPositionByIndex(t,tu),this.getPositionByIndex(t+1,nu),this.getPositionByIndex(t+2,ru),r=c=tu.x,d=nu.x,d<r&&(r=d),d>c&&(c=d),d=ru.x,d<r&&(r=d),d>c&&(c=d),o=l=tu.y,d=nu.y,d<o&&(o=d),d>l&&(l=d),d=ru.y,d<o&&(o=d),d>l&&(l=d),s=u=tu.z,d=nu.z,d<s&&(s=d),d>u&&(u=d),d=ru.z,d<s&&(s=d),d>u&&(u=d),a[n]=r,a[n+1]=o,a[n+2]=s,a[n+3]=c,a[n+4]=l,a[n+5]=u}else{let e=1/0,t=1/0,o=1/0,s=-1/0,c=-1/0,l=-1/0;for(let n=0;n<r;n+=1){let r=n*3,u=n*6,d,f,p,m,h,g,_;i[n]=n,this.getPositionByIndex(r,tu),this.getPositionByIndex(r+1,nu),this.getPositionByIndex(r+2,ru),d=m=tu.x,_=nu.x,_<d&&(d=_),_>m&&(m=_),_=ru.x,_<d&&(d=_),_>m&&(m=_),f=h=tu.y,_=nu.y,_<f&&(f=_),_>h&&(h=_),_=ru.y,_<f&&(f=_),_>h&&(h=_),p=g=tu.z,_=nu.z,_<p&&(p=_),_>g&&(g=_),_=ru.z,_<p&&(p=_),_>g&&(g=_),a[u]=d,a[u+1]=f,a[u+2]=p,a[u+3]=m,a[u+4]=h,a[u+5]=g,d<e&&(e=d),m>s&&(s=m),f<t&&(t=f),h>c&&(c=h),p<o&&(o=p),g>l&&(l=g)}n=[e,t,o,s,c,l]}let l=new ql(++c,n,0,r,0);o[s++]=l;let u=[],d=[0,1,2],f=function(e,t){return u[t]-u[e]};function p(n){let r=n.startIndex,l=n.endIndex,p=n.extents;u[0]=p[3]-p[0],u[1]=p[4]-p[1],u[2]=p[5]-p[2],d.sort(f);for(let u=0;u<3;u++){let f=d[u],m=p[f]+p[f+3],h=r,g=l-1,_=-1,v;for(;h<=g;)_===-1?(v=i[h],a[v*6+f]+a[v*6+f+3]<m?h++:_=v):(v=i[g],a[v*6+f]+a[v*6+f+3]>=m?g--:(i[h]=v,i[g]=_,_=-1,h++,g--));if(h>r&&h<l){let u=new ql(++c,ou(i,a,r,h,$l),r,h,n.deepth+1);u.deepth<t&&u.endIndex-u.startIndex>e&&(o[s++]=u);let d=new ql(++c,ou(i,a,h,l,$l),h,l,n.deepth+1);d.deepth<t&&d.endIndex-d.startIndex>e&&(o[s++]=d),n.node0=u,n.node1=d,n.startIndex=0,n.endIndex=0;break}}}for(;s;)p(o[--s]);return this.offsetArray=i,this.rootNodePacked=Jl(l,c+1),o.length=0,this}trianglesInSphere(e,t){let n=this.offsetArray,r=this.rootNodePacked,i=new Float32Array(r),a=new Uint32Array(r),o=new Uint16Array(r),s=[0],c=[],l;for(;(l=s.pop())!==void 0;){let r=l*36/4,u=au(e.x,i[r],i[r+3])-e.x,d=au(e.y,i[r+1],i[r+4])-e.y,f=au(e.z,i[r+2],i[r+5])-e.z;if(u*u+d*d+f*f<=t*t){let e=a[r+6],t=a[r+7];for(let r=e;r<t;r++){let e=n[r];c.push(e)}let i=l*36/2,u=o[i+16],d=o[i+17];u&&s.push(u),d&&s.push(d)}}let u=c.length,d=new Float32Array(u*9);for(let e=0;e<u;e++){let t=c[e]*3;this.getPositionByIndex(t,eu),d[e*9]=eu.x,d[e*9+1]=eu.y,d[e*9+2]=eu.z,this.getPositionByIndex(t+1,eu),d[e*9+3]=eu.x,d[e*9+4]=eu.y,d[e*9+5]=eu.z,this.getPositionByIndex(t+2,eu),d[e*9+6]=eu.x,d[e*9+7]=eu.y,d[e*9+8]=eu.z}return d}intersectRay(e,t,n=0,r=!1,i){let a=[],o=this.offsetArray,s=this.rootNodePacked,c=new Float32Array(s),l=new Uint32Array(s),u=new Uint16Array(s),d=new Xl(1/t.x,1/t.y,1/t.z),f=[0],p,m=1/0,h=new Ql(new Xl(0,0,0),new Xl(0,0,0)),g=new Xl(0,0,0),_=new Xl(0,0,0),v=new Xl(0,0,0);for(;(p=f.pop())!==void 0;){let s=p*36/4;h.min.x=c[s],h.min.y=c[s+1],h.min.z=c[s+2],h.max.x=c[s+3],h.max.y=c[s+4],h.max.z=c[s+5];let y=Yl(e,d,h,n);if(y===null||r&&y>m)continue;let b=e.x,x=e.y,S=e.z,C=t.x,w=t.y,T=t.z,E=l[s+6],D=l[s+7];for(let e=E;e<D;e++){let t=o[e],n=t*3;this.getPositionByIndex(n,g);let s=g.x,c=g.y,l=g.z;this.getPositionByIndex(n+1,_);let u=_.x,d=_.y,f=_.z;this.getPositionByIndex(n+2,v);let p=v.x,h=v.y,y=v.z,E=u-s,D=d-c,O=f-l,k=p-s,A=h-c,j=y-l,M=D*j-O*A,N=O*k-E*j,ee=E*A-D*k,P=C*M+w*N+T*ee,te;if(P>0)te=1;else if(P<0)te=-1,P=-P;else continue;let ne=b-s,re=x-c,ie=S-l,ae=te*(C*(re*j-ie*A)+w*(ie*k-ne*j)+T*(ne*A-re*k));if(ae<0)continue;let oe=te*(C*(D*ie-O*re)+w*(O*ne-E*ie)+T*(E*re-D*ne));if(oe<0||ae+oe>P)continue;let se=-te*(ne*M+re*N+ie*ee);if(se<0)continue;let ce=se/P,F=new Zl(g,_,v,t,new Xl(b+C*ce,x+w*ce,S+T*ce));(!i||i(F))&&(r?ce<m&&(m=ce,a.length>0&&(a.length=0),a.push(F)):a.push(F))}let O=p*36/2,k=u[O+16],A=u[O+17];k&&f.push(k),A&&f.push(A)}return a}};function au(e,t,n){return e<t?t:e>n?n:e}function ou(e,t,n,r,i){if(n>=r)return[0,0,0,0,0,0];let a=1/0,o=1/0,s=1/0,c=-1/0,l=-1/0,u=-1/0;for(let i=n;i<r;i++){let n=e[i]*6,r=t[n];r<a&&(a=r),r=t[n+1],r<o&&(o=r),r=t[n+2],r<s&&(s=r),r=t[n+3],r>c&&(c=r),r=t[n+4],r>l&&(l=r),r=t[n+5],r>u&&(u=r)}return[a-i,o-i,s-i,c+i,l+i,u+i]}(function(){let e=new Xl(0,0,0),t=new Xl(0,0,0),n=new Xl(0,0,0),r=new Xl(0,0,0);return function(i,a,o,s,c){t.subVectors(a,i),n.subVectors(o,i),r.crossVectors(t,n);let l=c.dot(r),u;if(l>0)u=1;else if(l<0)u=-1,l=-l;else return null;e.subVectors(s,i);let d=u*c.dot(n.crossVectors(e,n));if(d<0)return null;let f=u*c.dot(t.cross(e));if(f<0||d+f>l)return null;let p=-u*e.dot(r);if(p<0)return null;let m=p/l;return new Xl(0,0,0).copy(c).multiplyScalar(m).add(s)}})();var su=1e-6,cu=[`x`,`y`,`z`],lu=new Xl(0,0,0),uu=class extends Kl{createTree(e,t,n){t=Math.min(t,16);let r=this.getPositionByIndex.bind(this),i=this.getPositionCount(),a=i>65535?new Uint32Array(i):new Uint16Array(i),o=[],s=0,c=-1;if(n)for(let e=0;e<i;e+=1)a[e]=e;else{r(0,lu);let e=lu.x,t=lu.y,o=lu.z,s=e,c=t,l=o;for(let n=0;n<i;n+=1){a[n]=n,r(n,lu);let i=lu.x,u=lu.y,d=lu.z;i<e?e=i:i>s&&(s=i),u<t?t=u:u>c&&(c=u),d<o?o=d:d>l&&(l=d)}n=[e,t,o,s,c,l]}let l=new ql(++c,n,0,i,0);o[s++]=l;let u=[],d=[0,1,2],f=function(e,t){return u[t]-u[e]};function p(n){let i=n.startIndex,l=n.endIndex,p=n.extents;u[0]=p[3]-p[0],u[1]=p[4]-p[1],u[2]=p[5]-p[2];let m=d.sort(f)[0],h=cu[m],g=(p[m]+p[m+3])/2,_=i,v=l-1,y=-1,b;for(;_<=v;)y===-1?(b=a[_],r(b,lu),lu[h]<g?_++:y=b):(b=a[v],r(b,lu),lu[h]>=g?v--:(a[_]=b,a[v]=y,y=-1,_++,v--));if(_>i){let r=p.slice();r[m+3]=g+su;let a=new ql(++c,r,i,_,n.deepth+1);a.deepth<t&&a.endIndex-a.startIndex>e&&(o[s++]=a),n.node0=a}if(l>_){let r=p.slice();r[m]=g-su;let i=new ql(++c,r,_,l,n.deepth+1);i.deepth<t&&i.endIndex-i.startIndex>e&&(o[s++]=i),n.node1=i}n.startIndex=0,n.endIndex=0}for(;s;)p(o[--s]);return this.offsetArray=a,this.rootNodePacked=Jl(l,c+1),o.length=0,this}intersectRay(e,t,n=0,r=!1,i){let a=[],o=this.offsetArray,s=this.rootNodePacked,c=new Float32Array(s),l=new Uint32Array(s),u=new Uint16Array(s),d=n*n,f=new Xl(1/t.x,1/t.y,1/t.z),p=[0],m,h=1/0,g=new Ql(new Xl(0,0,0),new Xl(0,0,0)),_=new Xl(0,0,0);for(;(m=p.pop())!==void 0;){let s=m*36/4;g.min.x=c[s],g.min.y=c[s+1],g.min.z=c[s+2],g.max.x=c[s+3],g.max.y=c[s+4],g.max.z=c[s+5];let v=Yl(e,f,g,n);if(v===null||r&&v>h)continue;let y=l[s+6],b=l[s+7];for(let n=y;n<b;n++){let s=o[n];this.getPositionByIndex(s,_);let c=_.x,l=_.y,u=_.z,f=e.x,p=e.y,m=e.z,g=t.x,v=t.y,y=t.z,b=g*(c-f)+v*(l-p)+y*(u-m);if(b>0?(f+=g*b,p+=v*b,m+=y*b):b<0&&(b=0),g=c-f,v=l-p,y=u-m,g*g+v*v+y*y<=d){let e=new Zl(_,_,_,s,new Xl(f,p,m));(!i||i(e))&&(r?b<h&&(h=b,a.length>0&&(a.length=0),a.push(e)):a.push(e))}}let x=m*36/2,S=u[x+16],C=u[x+17];S&&p.push(S),C&&p.push(C)}return a}},du="(function(){var e=class{constructor(e,t){this.position=e,this.indices=t}getPositionCount(){let e=this.indices,t=this.position;return e?e.array.length/(e.stride??1):t.array.length/(t.stride??3)}getPositionByIndex(e,t){let n=this.indices,r=this.position,i=e;if(n){let t=n.array,r=n.stride??1,a=n.offset??0;i=t[e*r+a]}let a=r.array,o=r.stride??3,s=r.offset??0;return i=i*o+s,t.x=a[i],t.y=a[i+1],t.z=a[i+2],t}createTree(e,t,n){throw Error(`not implemented`)}trianglesInSphere(e,t){throw Error(`not implemented`)}intersectRay(e,t,n=0,r=!1,i){throw Error(`not implemented`)}},t=class{constructor(e,t,n,r,i){this.id=e,this.extents=t,this.startIndex=n,this.endIndex=r,this.deepth=i}};function n(e,t){let n=new ArrayBuffer(t*36),r=new Float32Array(n),i=new Uint32Array(n),a=new Uint16Array(n),o=[e],s,c;for(;s=o.pop();)c=s.id*36/4,r[c]=s.extents[0],r[c+1]=s.extents[1],r[c+2]=s.extents[2],r[c+3]=s.extents[3],r[c+4]=s.extents[4],r[c+5]=s.extents[5],i[c+6]=s.startIndex,i[c+7]=s.endIndex,c=s.id*36/2,s.node0&&(a[c+16]=s.node0.id,o.push(s.node0)),s.node1&&(a[c+17]=s.node1.id,o.push(s.node1));return n}function r(e,t,n,r=0){let i=n.min.x-r,a=n.min.y-r,o=n.min.z-r,s=n.max.x+r,c=n.max.y+r,l=n.max.z+r,u=0,d=0,f=0,p=0,m=0,h=0;return t.x>=0?(u=(i-e.x)*t.x,d=(s-e.x)*t.x):(u=(s-e.x)*t.x,d=(i-e.x)*t.x),t.y>=0?(f=(a-e.y)*t.y,p=(c-e.y)*t.y):(f=(c-e.y)*t.y,p=(a-e.y)*t.y),u>p||f>d||((f>u||u!==u)&&(u=f),(p<d||d!==d)&&(d=p),t.z>=0?(m=(o-e.z)*t.z,h=(l-e.z)*t.z):(m=(l-e.z)*t.z,h=(o-e.z)*t.z),u>h||m>d)||((m>u||u!==u)&&(u=m),(h<d||d!==d)&&(d=h),d<0)?null:u>=0?u:0}var i=class e{constructor(e,t,n){this.x=e,this.y=t,this.z=n}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,n){return this.x=e,this.y=t,this.z=n,this}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}add(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}subVectors(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}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){let t=this.x,n=this.y,r=this.z;return this.x=n*e.z-r*e.y,this.y=r*e.x-t*e.z,this.z=t*e.y-n*e.x,this}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}clone(){return new e(this.x,this.y,this.z)}},a=class{constructor(e,t,n,r,i){this.pointA=e,this.pointB=t,this.pointC=n,this.index=r,this.intersectionPoint=i}},o=class{constructor(e,t){this.min=e,this.max=t}};let s=1e-6,c=new i(0,0,0),l=new i(0,0,0),u=new i(0,0,0),d=new i(0,0,0);var f=class extends e{createTree(e,r,i){r=Math.min(r,16);let a=this.getPositionCount()/3,o=a>65535?new Uint32Array(a):new Uint16Array(a),c=new Float32Array(a*6),f=[],p=0,h=-1;if(i)for(let e=0;e<a;e+=1){let t=e*3,n=e*6,r,i,a,s,f,p,m;o[e]=e,this.getPositionByIndex(t,l),this.getPositionByIndex(t+1,u),this.getPositionByIndex(t+2,d),r=s=l.x,m=u.x,m<r&&(r=m),m>s&&(s=m),m=d.x,m<r&&(r=m),m>s&&(s=m),i=f=l.y,m=u.y,m<i&&(i=m),m>f&&(f=m),m=d.y,m<i&&(i=m),m>f&&(f=m),a=p=l.z,m=u.z,m<a&&(a=m),m>p&&(p=m),m=d.z,m<a&&(a=m),m>p&&(p=m),c[n]=r,c[n+1]=i,c[n+2]=a,c[n+3]=s,c[n+4]=f,c[n+5]=p}else{let e=1/0,t=1/0,n=1/0,r=-1/0,s=-1/0,f=-1/0;for(let i=0;i<a;i+=1){let a=i*3,p=i*6,m,h,g,_,v,y,b;o[i]=i,this.getPositionByIndex(a,l),this.getPositionByIndex(a+1,u),this.getPositionByIndex(a+2,d),m=_=l.x,b=u.x,b<m&&(m=b),b>_&&(_=b),b=d.x,b<m&&(m=b),b>_&&(_=b),h=v=l.y,b=u.y,b<h&&(h=b),b>v&&(v=b),b=d.y,b<h&&(h=b),b>v&&(v=b),g=y=l.z,b=u.z,b<g&&(g=b),b>y&&(y=b),b=d.z,b<g&&(g=b),b>y&&(y=b),c[p]=m,c[p+1]=h,c[p+2]=g,c[p+3]=_,c[p+4]=v,c[p+5]=y,m<e&&(e=m),_>r&&(r=_),h<t&&(t=h),v>s&&(s=v),g<n&&(n=g),y>f&&(f=y)}i=[e,t,n,r,s,f]}let g=new t(++h,i,0,a,0);f[p++]=g;let _=[],v=[0,1,2],y=function(e,t){return _[t]-_[e]};function b(n){let i=n.startIndex,a=n.endIndex,l=n.extents;_[0]=l[3]-l[0],_[1]=l[4]-l[1],_[2]=l[5]-l[2],v.sort(y);for(let u=0;u<3;u++){let d=v[u],g=l[d]+l[d+3],_=i,y=a-1,b=-1,x;for(;_<=y;)b===-1?(x=o[_],c[x*6+d]+c[x*6+d+3]<g?_++:b=x):(x=o[y],c[x*6+d]+c[x*6+d+3]>=g?y--:(o[_]=x,o[y]=b,b=-1,_++,y--));if(_>i&&_<a){let l=new t(++h,m(o,c,i,_,s),i,_,n.deepth+1);l.deepth<r&&l.endIndex-l.startIndex>e&&(f[p++]=l);let u=new t(++h,m(o,c,_,a,s),_,a,n.deepth+1);u.deepth<r&&u.endIndex-u.startIndex>e&&(f[p++]=u),n.node0=l,n.node1=u,n.startIndex=0,n.endIndex=0;break}}}for(;p;)b(f[--p]);return this.offsetArray=o,this.rootNodePacked=n(g,h+1),f.length=0,this}trianglesInSphere(e,t){let n=this.offsetArray,r=this.rootNodePacked,i=new Float32Array(r),a=new Uint32Array(r),o=new Uint16Array(r),s=[0],l=[],u;for(;(u=s.pop())!==void 0;){let r=u*36/4,c=p(e.x,i[r],i[r+3])-e.x,d=p(e.y,i[r+1],i[r+4])-e.y,f=p(e.z,i[r+2],i[r+5])-e.z;if(c*c+d*d+f*f<=t*t){let e=a[r+6],t=a[r+7];for(let r=e;r<t;r++){let e=n[r];l.push(e)}let i=u*36/2,c=o[i+16],d=o[i+17];c&&s.push(c),d&&s.push(d)}}let d=l.length,f=new Float32Array(d*9);for(let e=0;e<d;e++){let t=l[e]*3;this.getPositionByIndex(t,c),f[e*9]=c.x,f[e*9+1]=c.y,f[e*9+2]=c.z,this.getPositionByIndex(t+1,c),f[e*9+3]=c.x,f[e*9+4]=c.y,f[e*9+5]=c.z,this.getPositionByIndex(t+2,c),f[e*9+6]=c.x,f[e*9+7]=c.y,f[e*9+8]=c.z}return f}intersectRay(e,t,n=0,s=!1,c){let l=[],u=this.offsetArray,d=this.rootNodePacked,f=new Float32Array(d),p=new Uint32Array(d),m=new Uint16Array(d),h=new i(1/t.x,1/t.y,1/t.z),g=[0],_,v=1/0,y=new o(new i(0,0,0),new i(0,0,0)),b=new i(0,0,0),x=new i(0,0,0),S=new i(0,0,0);for(;(_=g.pop())!==void 0;){let o=_*36/4;y.min.x=f[o],y.min.y=f[o+1],y.min.z=f[o+2],y.max.x=f[o+3],y.max.y=f[o+4],y.max.z=f[o+5];let d=r(e,h,y,n);if(d===null||s&&d>v)continue;let C=e.x,w=e.y,T=e.z,E=t.x,D=t.y,O=t.z,k=p[o+6],A=p[o+7];for(let e=k;e<A;e++){let t=u[e],n=t*3;this.getPositionByIndex(n,b);let r=b.x,o=b.y,d=b.z;this.getPositionByIndex(n+1,x);let f=x.x,p=x.y,m=x.z;this.getPositionByIndex(n+2,S);let h=S.x,g=S.y,_=S.z,y=f-r,k=p-o,A=m-d,j=h-r,M=g-o,N=_-d,P=k*N-A*M,F=A*j-y*N,I=y*M-k*j,L=E*P+D*F+O*I,R;if(L>0)R=1;else if(L<0)R=-1,L=-L;else continue;let z=C-r,B=w-o,V=T-d,H=R*(E*(B*N-V*M)+D*(V*j-z*N)+O*(z*M-B*j));if(H<0)continue;let U=R*(E*(k*V-A*B)+D*(A*z-y*V)+O*(y*B-k*z));if(U<0||H+U>L)continue;let W=-R*(z*P+B*F+V*I);if(W<0)continue;let G=W/L,K=new a(b,x,S,t,new i(C+E*G,w+D*G,T+O*G));(!c||c(K))&&(s?G<v&&(v=G,l.length>0&&(l.length=0),l.push(K)):l.push(K))}let j=_*36/2,M=m[j+16],N=m[j+17];M&&g.push(M),N&&g.push(N)}return l}};function p(e,t,n){return e<t?t:e>n?n:e}function m(e,t,n,r,i){if(n>=r)return[0,0,0,0,0,0];let a=1/0,o=1/0,s=1/0,c=-1/0,l=-1/0,u=-1/0;for(let i=n;i<r;i++){let n=e[i]*6,r=t[n];r<a&&(a=r),r=t[n+1],r<o&&(o=r),r=t[n+2],r<s&&(s=r),r=t[n+3],r>c&&(c=r),r=t[n+4],r>l&&(l=r),r=t[n+5],r>u&&(u=r)}return[a-i,o-i,s-i,c+i,l+i,u+i]}(function(){let e=new i(0,0,0),t=new i(0,0,0),n=new i(0,0,0),r=new i(0,0,0);return function(a,o,s,c,l){t.subVectors(o,a),n.subVectors(s,a),r.crossVectors(t,n);let u=l.dot(r),d;if(u>0)d=1;else if(u<0)d=-1,u=-u;else return null;e.subVectors(c,a);let f=d*l.dot(n.crossVectors(e,n));if(f<0)return null;let p=d*l.dot(t.cross(e));if(p<0||f+p>u)return null;let m=-d*e.dot(r);if(m<0)return null;let h=m/u;return new i(0,0,0).copy(l).multiplyScalar(h).add(c)}})();let h=1e-6,g=[`x`,`y`,`z`],_=new i(0,0,0);var v=class extends e{createTree(e,r,i){r=Math.min(r,16);let a=this.getPositionByIndex.bind(this),o=this.getPositionCount(),s=o>65535?new Uint32Array(o):new Uint16Array(o),c=[],l=0,u=-1;if(i)for(let e=0;e<o;e+=1)s[e]=e;else{a(0,_);let e=_.x,t=_.y,n=_.z,r=e,c=t,l=n;for(let i=0;i<o;i+=1){s[i]=i,a(i,_);let o=_.x,u=_.y,d=_.z;o<e?e=o:o>r&&(r=o),u<t?t=u:u>c&&(c=u),d<n?n=d:d>l&&(l=d)}i=[e,t,n,r,c,l]}let d=new t(++u,i,0,o,0);c[l++]=d;let f=[],p=[0,1,2],m=function(e,t){return f[t]-f[e]};function v(n){let i=n.startIndex,o=n.endIndex,d=n.extents;f[0]=d[3]-d[0],f[1]=d[4]-d[1],f[2]=d[5]-d[2];let v=p.sort(m)[0],y=g[v],b=(d[v]+d[v+3])/2,x=i,S=o-1,C=-1,w;for(;x<=S;)C===-1?(w=s[x],a(w,_),_[y]<b?x++:C=w):(w=s[S],a(w,_),_[y]>=b?S--:(s[x]=w,s[S]=C,C=-1,x++,S--));if(x>i){let a=d.slice();a[v+3]=b+h;let o=new t(++u,a,i,x,n.deepth+1);o.deepth<r&&o.endIndex-o.startIndex>e&&(c[l++]=o),n.node0=o}if(o>x){let i=d.slice();i[v]=b-h;let a=new t(++u,i,x,o,n.deepth+1);a.deepth<r&&a.endIndex-a.startIndex>e&&(c[l++]=a),n.node1=a}n.startIndex=0,n.endIndex=0}for(;l;)v(c[--l]);return this.offsetArray=s,this.rootNodePacked=n(d,u+1),c.length=0,this}intersectRay(e,t,n=0,s=!1,c){let l=[],u=this.offsetArray,d=this.rootNodePacked,f=new Float32Array(d),p=new Uint32Array(d),m=new Uint16Array(d),h=n*n,g=new i(1/t.x,1/t.y,1/t.z),_=[0],v,y=1/0,b=new o(new i(0,0,0),new i(0,0,0)),x=new i(0,0,0);for(;(v=_.pop())!==void 0;){let o=v*36/4;b.min.x=f[o],b.min.y=f[o+1],b.min.z=f[o+2],b.max.x=f[o+3],b.max.y=f[o+4],b.max.z=f[o+5];let d=r(e,g,b,n);if(d===null||s&&d>y)continue;let S=p[o+6],C=p[o+7];for(let n=S;n<C;n++){let r=u[n];this.getPositionByIndex(r,x);let o=x.x,d=x.y,f=x.z,p=e.x,m=e.y,g=e.z,_=t.x,v=t.y,b=t.z,S=_*(o-p)+v*(d-m)+b*(f-g);if(S>0?(p+=_*S,m+=v*S,g+=b*S):S<0&&(S=0),_=o-p,v=d-m,b=f-g,_*_+v*v+b*b<=h){let e=new a(x,x,x,r,new i(p,m,g));(!c||c(e))&&(s?S<y&&(y=S,l.length>0&&(l.length=0),l.push(e)):l.push(e))}}let w=v*36/2,T=m[w+16],E=m[w+17];T&&_.push(T),E&&_.push(E)}return l}};function y(e){onmessage=t=>{Promise.resolve(t.data).then(t=>e(t)).then(({output:e,transfer:t})=>postMessage(e,t)).catch(e=>postMessage({$$error:e}))}}y(e=>Promise.resolve(e).then(e=>{let t=[],n=new Set;for(let r of e){let e;if(r.type===`mesh`)e=new f(r.attributes.position,r.indices);else if(r.type===`points`)e=new v(r.attributes.position,r.indices);else throw Error(`Invalid Type`);e.createTree(r.maxItemPerNode,r.maxTreeDepth,r.extents);let i={type:r.type,attributes:r.attributes,indices:r.indices,offsetArray:e.offsetArray,rootNodePacked:e.rootNodePacked};t.push(i);let a;for(let e in i.attributes){let t=i.attributes[e];t&&t.buffer instanceof ArrayBuffer&&n.add(t.buffer)}a=i.indices,a&&a.buffer instanceof ArrayBuffer&&n.add(a.buffer),a=i.offsetArray,a&&a.buffer instanceof ArrayBuffer&&n.add(a.buffer),n.add(i.rootNodePacked)}return{output:t,transfer:Array.from(n)}}))})();",fu=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,du],{type:`text/javascript;charset=utf-8`});function pu(e){let t;try{if(t=fu&&(self.URL||self.webkitURL).createObjectURL(fu),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(du),{name:e==null?void 0:e.name})}}var mu=new co(()=>new pu,4),hu=()=>!0,gu=new c.Ray,_u=new c.Matrix3,vu=new c.Matrix4,yu=new c.Vector3,bu=new c.Vector3,xu=new c.Vector3,Su=new WeakMap;function Cu(e,t,n,r){var i,a;let o=e.matrixWorld;vu.getInverse(o),gu.copy(n.ray).applyMatrix4(vu);let s=(i=n.hitFilter)==null?hu:i,l=(a=n.firstHitOnly)==null?!1:a,u=e.geometry,d=e.material,f=u.groups,p=u.index,m=t.intersectRay(gu.origin,gu.direction,0,l,t=>{var r;let i=t.index,a=i*3,l;if(Array.isArray(d)){if(f){for(let e of f)if(a>=e.start&&a-e.start<e.count){l=d[(r=e.materialIndex)==null?0:r];break}}}else l=d;if(!l)return!1;let u=t.intersectionPoint,m=new c.Vector3(u.x,u.y,u.z).applyMatrix4(o),h=n.ray.origin.distanceTo(m);if(h<n.near||h>n.far)return!1;let g=t.pointA,_=t.pointB,v=t.pointC,y=c.Triangle.getNormal(yu.set(g.x,g.y,g.z).applyMatrix4(o),bu.set(_.x,_.y,_.z).applyMatrix4(o),xu.set(v.x,v.y,v.z).applyMatrix4(o),new c.Vector3),b=n.ray.direction.dot(y);if(l.side===c.FrontSide&&b>=0||l.side===c.BackSide&&b<=0)return!1;let x={distance:h,object:e,face:new c.Face3(p?p.array[a]:a,p?p.array[a+1]:a+1,p?p.array[a+2]:a+2,y),point:m,distanceToRay:0,faceIndex:i};return Su.set(t,x),s(x)}),h=m.length;for(let e=0;e<h;e++){let t=Su.get(m[e]);t&&r.push(t)}m.length=0}function wu(e,t,n,r){var i,a,o,s;let l=e.matrixWorld;_u.getNormalMatrix(l),vu.getInverse(l),gu.copy(n.ray).applyMatrix4(vu);let u=((a=(i=n.params.Points)==null?void 0:i.threshold)==null?1:a)*vu.getMaxScaleOnAxis(),d=(o=n.hitFilter)==null?hu:o,f=(s=n.firstHitOnly)==null?!1:s,p=e.geometry,m=p.index,h=p.getAttribute(`normal`),g=h instanceof c.BufferAttribute,_=t.intersectRay(gu.origin,gu.direction,u,f,t=>{let r=t.intersectionPoint,i=new c.Vector3(r.x,r.y,r.z).applyMatrix4(l),a=n.ray.origin.distanceTo(i);if(a<n.near||a>n.far)return!1;let o=t.pointA,s=yu.set(o.x,o.y,o.z).applyMatrix4(l),u=i.distanceTo(s);if(u/a>.07)return!1;let f=t.index,_=m?m.array[f]:f,v;if(g){let e=new c.Vector3().fromBufferAttribute(h,_).applyNormalMatrix(_u);v=new c.Face3(_,_,_,e)}else{let e=p.getAttribute(`scale`),t=p.getAttribute(`rotation`);if(e instanceof c.BufferAttribute&&t instanceof c.BufferAttribute){let r=new c.Vector3().fromBufferAttribute(e,_).toArray(),i=new c.Vector4().fromBufferAttribute(t,_).toArray(),a=new c.Quaternion(i[1],i[2],i[3],i[0]),[{axis:o}]=[{axis:`x`,scale:r[0]},{axis:`y`,scale:r[1]},{axis:`z`,scale:r[2]}].sort((e,t)=>e.scale-t.scale),s=new c.Vector3(0,0,0);s[o]=1,s.applyQuaternion(a).applyNormalMatrix(_u),n.ray.direction.dot(s)>0&&s.negate(),v=new c.Face3(_,_,_,s)}}let y={distance:a,object:e,face:v,point:i,distanceToRay:u,index:f};return Su.set(t,y),d(y)}),v=_.length;for(let e=0;e<v;e++){let t=Su.get(_[e]);t&&r.push(t)}_.length=0}var Tu=`__bvh_mesh__`,Eu=c.Mesh.prototype.raycast;function Du(e,t){let n=Ou(this);n?Cu(this,n,e,t):Eu.call(this,e,t)}function Ou(e){let t=e[Tu];return t instanceof iu,t}function ku(e,t){Object.assign(e,{[Tu]:t,raycast:Du})}var Au=`__bvh_points__`,ju=c.Points.prototype.raycast;function Mu(e,t){let n=Nu(this);n?wu(this,n,e,t):ju.call(this,e,t)}function Nu(e){let t=e[Au];return t instanceof uu,t}function Pu(e,t){Object.assign(e,{[Au]:t,raycast:Mu})}function Fu(e,t=!0,n=100,r=10){let i=[];return e.traverse(e=>{(e instanceof c.Mesh||e instanceof c.Points)&&e.geometry instanceof c.BufferGeometry&&i.push(e)}),t?Promise.resolve().then(()=>{let e=[],t=new Set,a=null;for(let o=0;o<i.length;o++){let s=i[o],l=s.geometry;if(!(l instanceof c.BufferGeometry))continue;let u;if(s instanceof c.Mesh?u=`mesh`:s instanceof c.Points&&(u=`points`),!u)continue;let d=l.boundingBox,f=d?[d.min.x,d.min.y,d.min.z,d.max.x,d.max.y,d.max.z]:void 0,p={};for(let e in l.attributes){let n=l.attributes[e];n instanceof c.InterleavedBufferAttribute?(p[e]={array:n.data.array,stride:n.data.stride,offset:n.offset},a=n.data.array,a&&a.buffer instanceof ArrayBuffer&&t.add(a.buffer)):(p[e]={array:n.array},a=n.array,a&&a.buffer instanceof ArrayBuffer&&t.add(a.buffer))}let m,h=l.getIndex();h&&(h instanceof c.InterleavedBufferAttribute?(m={array:h.data.array,stride:h.data.stride,offset:h.offset},a=h.data.array,a&&a.buffer instanceof ArrayBuffer&&t.add(a.buffer)):(m={array:h.array},a=h.array,a&&a.buffer instanceof ArrayBuffer&&t.add(a.buffer)));let g={type:u,attributes:p,indices:m,maxItemPerNode:n,maxTreeDepth:r,extents:f};e.push(g)}return mu.postMessage(e,Array.from(t))}).then(t=>{for(let e=0;e<i.length;e++){let n=i[e],r=n.geometry,a=t[e];if(!(r instanceof c.BufferGeometry))continue;for(let e in a.attributes){let t=a.attributes[e].array,n=r.attributes[e];n instanceof c.InterleavedBufferAttribute?n.data.array=t:n.array=t}let o=r.getIndex();if(o&&a.indices){let e=a.indices.array;o instanceof c.InterleavedBufferAttribute?o.data.array=e:o.array=e}if(n instanceof c.Mesh){let e=new iu(a.attributes.position,a.indices);e.offsetArray=a.offsetArray,e.rootNodePacked=a.rootNodePacked,ku(n,e)}else if(n instanceof c.Points){let e=new uu(a.attributes.position,a.indices);e.offsetArray=a.offsetArray,e.rootNodePacked=a.rootNodePacked,Pu(n,e)}}return e}):Promise.resolve().then(()=>{for(let e of i)if(e instanceof c.Mesh){let t=e.geometry,i=t.boundingBox,a=i?[i.min.x,i.min.y,i.min.z,i.max.x,i.max.y,i.max.z]:void 0;if(t instanceof c.BufferGeometry){let i,o,s=t.attributes.position;i=s instanceof c.InterleavedBufferAttribute?{array:s.data.array,stride:s.data.stride,offset:s.offset}:{array:s.array};let l=t.getIndex();l&&(o=l instanceof c.InterleavedBufferAttribute?{array:l.data.array,stride:l.data.stride,offset:l.offset}:{array:l.array});let u=new iu(i,o);u.createTree(n,r,a),ku(e,u)}}else if(e instanceof c.Points){let t=e.geometry,i=t.boundingBox,a=i?[i.min.x,i.min.y,i.min.z,i.max.x,i.max.y,i.max.z]:void 0;if(t instanceof c.BufferGeometry){let i,o,s=t.attributes.position;i=s instanceof c.InterleavedBufferAttribute?{array:s.data.array,stride:s.data.stride,offset:s.offset}:{array:s.array};let l=t.getIndex();l&&(o=l instanceof c.InterleavedBufferAttribute?{array:l.data.array,stride:l.data.stride,offset:l.offset}:{array:l.array});let u=new uu(i,o);u.createTree(n,r,a),Pu(e,u)}}return e})}function Iu(e,t,n){return e+(t-e)*n}function Lu(e,t,n,r){let i=(t*n+2*e)/Math.pow(n,3),a=-(2*t*n+3*e)/Math.pow(n,2),o=t,s=e;return i*Math.pow(r,3)+a*Math.pow(r,2)+o*r+s}function Ru(e,t,n,r){let i=(t*n+2*e)/Math.pow(n,3),a=-(2*t*n+3*e)/Math.pow(n,2),o=t;return 3*i*Math.pow(r,2)+2*a*r+o}function zu(e,t,n,r){let i=r[1]-r[0];return e=Bu(e,r),t=Bu(t,r),t-e>i/2?Iu(e+i,t,n):e-t>i/2?Iu(e-i,t,n):Iu(e,t,n)}function Bu(e,t){let n=t[1]-t[0];return e<t[0]?Bu(e+n,t):e>=t[1]?Bu(e-n,t):e}function Vu(e,t,n,r){return r?zu(e,t,n,r):Iu(e,t,n)}function Hu(e){let t=Number(e);return isNaN(t)||!isFinite(t)?0:t}var X=class{constructor(e){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=H(),this.startVelocity=0,this.duration=0,this.keyframes=[];for(let t in e){let n=e[t];typeof n==`object`?(this.value[t]=Hu(n.value),this.config[t]={circle:n.circle}):(this.value[t]=Hu(n),this.config[t]={circle:!1})}this.keyframes=[{progress:0,value:Object.assign({},this.value)},{progress:1,value:Object.assign({},this.value)}]}getProgress(e){let t=e-this.startTime;return t<0?0:t>=this.duration?1:1-Lu(1,this.startVelocity,this.duration,t)}getValue(e){for(let t=1;t<this.keyframes.length;t++)if(this.keyframes[t].progress>e){let n=this.keyframes[t-1],r=this.keyframes[t],i={};for(let t in this.config){let a=(e-n.progress)/(r.progress-n.progress);i[t]=Vu(n.value[t],r.value[t],a,this.config[t].circle)}return i}return Object.assign({},this.keyframes[this.keyframes.length-1].value)}getProgressVelocity(e){let t=e-this.startTime;return t>=this.duration?0:Ru(1,this.startVelocity,this.duration,t)}update(e){return this.ended?!0:(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(e))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)}getKeyFrameSegment(e){let t=this.getProgress(e);for(let e=1;e<this.keyframes.length;e++)if(this.keyframes[e].progress>t)return[this.keyframes[e-1],this.keyframes[e]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]}getTargetKeyframe(){return this.keyframes[this.keyframes.length-1]}set(e,t,n=0,r){var i;isNaN(t)&&(t=0),isNaN(n)&&(n=0),r=r==null?H():r;let a=this.getProgress(r),o=this.getValue(a),s={};for(let t in this.config)s[t]=(i=e[t])==null?o[t]:i;let c=[{progress:0,value:o},{progress:1,value:s}];return this.setKeyframes(c,t,n,r)}setKeyframes(e,t,n=0,r){if(e.length<2)throw Error(`keyframes invalid.`);return isNaN(t)&&(t=0),isNaN(n)&&(n=0),this.callbacks&&(this.callbacks[1](Error(`motion aborted.`)),this.callbacks=void 0),new Promise((i,a)=>{r=r==null?H():r,this.progress=0,this.ended=!1,this.startTime=r,this.startVelocity=n,this.keyframes=e,this.duration=t,t===0?(this.progress=1,this.value=Object.assign({},e[e.length-1].value)):this.value=Object.assign({},e[0].value),this.callbacks=[i,a]})}dispose(){this.callbacks&&(this.callbacks[1](Error(`motion dispose.`)),this.callbacks=void 0)}},Uu=Math.PI,Wu=1.70158;Wu*1.525,Wu+1,2*Uu/3,2*Uu/4.5;var Gu=function(e){return e},Ku=function(e){return e*e*e},qu=function(e){return e*e*e*e},Ju=500,Yu=new WeakMap,Xu=new c.Vector3,Zu=new c.Matrix4,Qu=class e extends c.Object3D{constructor(e,t,n,r=K){super(),this.name=e,this.materials=[],this.pbmObjects=[],this.contentObject=t,this.animations=n,this.appearMotion=new X({appear:0}),this.disposers=[r],this.add(t),t.traverse(e=>{if(e instanceof c.Mesh||e instanceof c.Points){let t=e.material;if(Array.isArray(t))for(let e=0;e<t.length;e++)this.materials.push(t[e]);else this.materials.push(t)}(e instanceof bn||e instanceof xn||e instanceof An||e instanceof $n)&&this.pbmObjects.push(e)})}generateBvhTree(){return Fu(this,!0,200,20)}intersectRaycaster(e,t){let n=t==null?[]:t,r=e.hitFilter;e.hitFilter=t=>{if(t.object instanceof An&&t.object.material.pointBack===`HIDDEN`&&t.face&&t.face.normal.angleTo(e.ray.direction)<Math.PI/2)return!1;let n=0,i=-1;if((t.object instanceof bn||t.object instanceof xn||t.object instanceof An)&&t.face){let e=Array.isArray(t.object.material)?t.object.material[t.face.materialIndex]:t.object.material;if(e){n=e.floorIndex,i=e.shownFloorIndex;for(let r of e.clippers)if(!(typeof r.floorIndex==`number`&&r.floorIndex!==n)&&(Zu.getInverse(r.clippingBoxMatrix),Xu.copy(t.point).applyMatrix4(Zu),Math.abs(Xu.x)<.5&&Math.abs(Xu.y)<.5&&Math.abs(Xu.z)<.5))return!1}}let a=i;return e.floorIndex===void 0?e.floor!==void 0&&(a=e.floor===null?-1:e.floor):a=e.floorIndex,a>=0&&n!==a?!1:(Object.assign(t,{floorIndex:n,floor:n}),r?r.call(e,t):!0)};let i=this.children.slice(),a;for(;a=i.pop();)if(a.visible){a.raycast(e,n);for(let e=0,t=a.children.length;e<t;e++)i.push(a.children[e])}return e.hitFilter=r,Gl(n,e.sortByDistance,e.firstHitOnly),n}update(e,t,n,r,i,a){let o=!1;r.visible&&i.state.selectedFrameNumber===i.tileset.frameNumber?this.appearMotion.getTargetKeyframe().value.appear!==1&&this.appearMotion.set({appear:1},Ju).catch(K):this.appearMotion.getTargetKeyframe().value.appear!==0&&this.appearMotion.set({appear:0},0).catch(K),this.appearMotion.ended!==!0&&this.appearMotion.update(t.time);for(let s of this.pbmObjects)s instanceof bn||s instanceof xn?$u(s,this.appearMotion,e,t,n,i,a)===!0&&(o=!0):s instanceof An?ed(s,this.appearMotion,e,t,n,i,a)===!0&&(o=!0):s instanceof $n&&td(s,this.appearMotion,e,t,n,r,i,a)===!0&&(o=!0);return o}dispose(){for(let e of this.disposers)e();this.disposers.length=0,this.pbmObjects.length=0}clone(){return new e(this.name,this.contentObject.clone(),this.animations)}};function $u(e,t,n,r,i,a,o){var s,l;let u=!1;if(Yu.get(e)!==o.versionNumber){Yu.set(e,o.versionNumber),u=!0,e.castShadow=o.castShadow,e.receiveShadow=o.receiveShadow;let t=e.material;for(let e of t)e.customShaders=o.customShaders,e.pano0=o.pano0,e.pano1=o.pano1,e.pano0Depth=o.pano0Depth,e.pano1Depth=o.pano1Depth,e.panoFilter=(l=(s=o.panoFilter)==null?void 0:s.toValue())==null?null:l,e.refinedScreen=o.refinedScreen,e.modelAlpha=o.modelAlpha,e.progress=o.progress,e.transition=o.transition,e.opacity=o.opacity,e.floorStyle=o.floorStyle,e.constantColor=o.constantColor,e.shownFloorIndex=o.shownFloorIndex,e.clippers=o.clippers,e.brightness=o.brightness,e.useHQWeight=o.useHQWeight,e.useHQDepth=o.useHQDepth,e.colorSaturation=o.colorSaturation,e.colorBrightness=o.colorBrightness,e.gradientTexture=o.gradientTexture,e.vertexMarks=o.vertexMarks,e.modelBoundingMax.copy(o.boundingBox.max),e.modelBoundingMin.copy(o.boundingBox.min),e.shaderType===`none`?(e.transparent=!0,e.blending=c.NormalBlending,e.blendDst=c.OneMinusSrcAlphaFactor,e.blendEquation=c.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthWrite=!1,e.depthTest=!0):(e.transparent=e.alphaMode===`BLEND`,e.blending=c.NormalBlending,e.blendDst=c.OneMinusSrcAlphaFactor,e.blendEquation=c.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthWrite=!0,e.depthTest=!0,o.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=c.AdditiveBlending),e.shownFloorIndex>-1&&e.shownFloorIndex!==e.floorIndex&&(e.transparent=!0),e.opacity<1&&(e.transparent=!0),e.alphaMap&&(e.transparent=!0),e.brightness<1&&(e.transparent=!0),e.modelAlpha<=0&&(e.transparent=!1),e.depthWrite=!e.transparent,o.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=c.AdditiveBlending))}return u}function ed(e,t,n,r,i,a,o){var s,l;let u=!1;if(o.pointAppearAnimation===!0&&a.refine===`ADD`&&a.tileset.rootMeta.pntsOrder===`RANDOM`){let n=e.geometry,r=a.tileset.currentMaxScreenSpaceError,i=a.state.screenSpaceError,o=(l=(s=a.parent)==null?void 0:s.state.screenSpaceError)==null?i:l,c=1;o!==i&&(c=(o-r)/(o-i)),c=U(c,0,1),c=Ku(c);let d=n.index?n.index.count:n.attributes.position?n.attributes.position.count:1/0,f=Math.floor(d*c*t.value.appear);n.drawRange.count!==f&&(n.setDrawRange(0,f),u=!0)}if(Yu.get(e)!==o.versionNumber){Yu.set(e,o.versionNumber),u=!0,e.castShadow=o.castShadow,e.receiveShadow=o.receiveShadow;let t=[e.material];for(let e of t)e.customShaders=o.customShaders,e.pointScale=o.pointScale,e.pointMinPixel=o.pointMinPixel,e.pointMaxPixel=o.pointMaxPixel,e.pointSize=o.pointSize,e.pointShape=o.pointShape,e.pointBack=o.pointBack,e.modelAlpha=o.modelAlpha,e.opacity=o.opacity,e.floorStyle=o.floorStyle,e.constantColor=o.constantColor,e.shownFloorIndex=o.shownFloorIndex,e.clippers=o.clippers,e.brightness=o.brightness,e.useHQWeight=o.useHQWeight,e.useHQDepth=o.useHQDepth,e.colorSaturation=o.colorSaturation,e.colorBrightness=o.colorBrightness,e.outlineGain=o.outlineGain,e.distanceGain=o.distanceGain,e.gradientTexture=o.gradientTexture,e.transparent=!1,e.blending=c.NormalBlending,e.blendDst=c.OneMinusSrcAlphaFactor,e.blendEquation=c.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.colorWrite=!0,e.depthWrite=!0,e.depthTest=!0,e.modelBoundingMax.copy(o.boundingBox.max),e.modelBoundingMin.copy(o.boundingBox.min),e.shownFloorIndex>-1&&(e.transparent=e.shownFloorIndex!==e.floorIndex),e.modelAlpha<1&&(e.transparent=!0),e.opacity<1&&(e.transparent=!0),e.brightness<1&&(e.transparent=!0),o.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=c.AdditiveBlending),e.useHQWeight&&(e.depthWrite=!1,e.blending=c.CustomBlending,e.blendSrc=c.SrcAlphaFactor,e.blendSrcAlpha=c.SrcAlphaFactor,e.blendDst=c.OneFactor,e.blendDstAlpha=c.OneFactor),e.useHQDepth&&(e.colorWrite=!1)}return u}function td(e,t,n,r,i,a,o,s){let l=!1,u=a.uuid;return e.gsViewLayerKey!==u&&(e.gsViewLayerKey=u,l=!0),e.gsClippers!==s.clippers&&(e.gsClippers=s.clippers,l=!0),e.updateMatrix(),e.updateMatrixWorld(),e.usedSHDegree=s.gaussianSplattingSHDegree,e.lastMatrixWorld?e.transformChanged=!e.lastMatrixWorld.equals(e.matrixWorld):(e.lastMatrixWorld=new c.Matrix4,e.transformChanged=!0,l=!0),e.lastMatrixWorld.copy(e.matrixWorld),e.transformChanged&&(l=!0),l}var nd=class{constructor(e,t,n){this.id=e,this.name=t.name,this.visible=!1,this.tileset=n,this.transform=new c.Matrix4,t.transform&&this.transform.fromArray(t.transform),this.transform.premultiply(this.tileset.root.transform),this.content={uri:t.file,byteLength:0,memoryUsage:0,loadState:`UNLOADED`,loadProgress:0,loadStateUpdateTime:H(),loadfailRetryDelay:0,data:void 0}}},rd=class e extends c.Object3D{constructor(e,t,n=K){super(),this.name=e,this.contentObject=t,this.name=e,this.add(t),this.disposers=[n]}update(e,t,n,r,i,a){let o=this.contentObject.material[2];return o.uniforms.dashOffset.value=(o.uniforms.dashOffset.value-.003)%(o.uniforms.dashSize.value.x+o.uniforms.dashSize.value.y),!0}dispose(){for(let e of this.disposers)e();this.disposers.length=0}clone(){return new e(this.name,this.contentObject.clone())}},id=new Map;function ad(e,t,n){if(n&&n.has(t))return n.get(t);let r=t.refine===`ADD`||e.skipLevelOfDetail,i=t.parent,a=i&&(!r||t.state.screenSpaceError===0)?i.state.screenSpaceError:t.state.screenSpaceError,o=t.tileset.root?t.tileset.root.state.screenSpaceError:0,s=Math.max(o-a,0);return n&&n.set(t,s),s}var od=class{constructor(e,t){this.tileset=e,this.options=t,this.activeRequests=0,this.requestQueue=[]}reset(){for(let e of this.requestQueue)this.options.onTileSkip&&(e.tile.content&&this.tileset.options.tileUnloader(e.tile),this.options.onTileSkip(e.tile));this.requestQueue.length=0}update(e,t,n){let r=n.time,i=this.requestQueue,a=new Set(e);for(let e=0;e<i.length;e++){let t=i[e];if(a.has(t.tile)){a.delete(t.tile);continue}t.status===`WAITING`&&(i.splice(e,1),e--,this.options.onTileSkip&&this.options.onTileSkip(t.tile))}a.size>0&&(a.forEach(e=>{i.push({tile:e,status:`WAITING`,time:r,error:null})}),a.clear());let o=n.maxRequests;for(let e=0;e<i.length&&o>0;e++){let t=i[e];if(t.status===`DONE`)t.error===null?(o--,t.tile.content&&(t.tile.content.loadState=`READY`),this.options.onTileLoad&&this.options.onTileLoad(t.tile)):this.options.onTileError&&this.options.onTileError(t.tile,t.error),i.splice(e,1),e--;else if(t.status===`PENDING`&&r-t.time<1e3)break}switch(id.clear(),t){case`SCREEN_SPACE_ERROR`:i.sort((e,t)=>e.tile.state.requestedFrameNumber===t.tile.state.requestedFrameNumber?e.tile.state.requestedFrameNumber===n.frameNumber?ad(n,e.tile,id)-ad(n,t.tile,id):e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:t.tile.state.requestedFrameNumber-e.tile.state.requestedFrameNumber);break;case`SCREEN_VERTICAL`:i.sort((e,t)=>e.tile.state.requestedFrameNumber===t.tile.state.requestedFrameNumber?e.tile.state.requestedFrameNumber===n.frameNumber?e.tile.state.centerScreenY===t.tile.state.centerScreenY?e.tile.state.centerZDepth===t.tile.state.centerZDepth?e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:e.tile.state.centerZDepth-t.tile.state.centerZDepth:e.tile.state.centerScreenY-t.tile.state.centerScreenY:e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:t.tile.state.requestedFrameNumber-e.tile.state.requestedFrameNumber);break;case`SCREEN_LEVEL_VERTICAL`:i.sort((e,t)=>e.tile.state.requestedFrameNumber===t.tile.state.requestedFrameNumber?e.tile.state.requestedFrameNumber===n.frameNumber?e.tile.level===t.tile.level?e.tile.state.centerScreenY===t.tile.state.centerScreenY?e.tile.state.centerZDepth===t.tile.state.centerZDepth?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.state.centerZDepth-t.tile.state.centerZDepth:e.tile.state.centerScreenY-t.tile.state.centerScreenY:e.tile.level-t.tile.level:e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:t.tile.state.requestedFrameNumber-e.tile.state.requestedFrameNumber);break;default:break}if(o=Math.max(n.maxRequests-this.activeRequests,0),!n.skipLevelOfDetail){let e=0,t=i.length;for(let r=0;r<t;r++){let t=i[r].tile;if(t.hasTilesetContent||t.contentParent===null||t.contentParent.state.selectedFrameNumber===n.frameNumber){let t=i.splice(r,1);i.splice(e++,0,...t)}}}for(let e=0;e<i.length&&o>0;e++){let t=i[e];t.status===`WAITING`&&(o--,t.status=`PENDING`,t.time=r,this.activeRequests++,this.tileset.options.tileLoader(t.tile).catch(e=>{t.error=e}).then(()=>{t.status=`DONE`,t.tile.content&&t.tile.content.loadState===`READY`&&(t.tile.content.loadState=`LOADING`),this.activeRequests--}))}}},sd=class{constructor(e,t,n){this.item=e,this.previous=t,this.next=n}},cd=class{constructor(){this.head=null,this.tail=null,this._length=0}get length(){return this._length}add(e){let t=new sd(e,this.tail,null);return this.tail?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),this._length++,t}remove(e){e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,this._length--}splice(e,t){e!==t&&(this.remove(t),this.insert(e,t))}insert(e,t){let n=e.next;e.next=t,this.tail===e?this.tail=t:n.previous=t,t.next=n,t.previous=e,this._length++}toArray(){let e=[],t=this.head;for(;t;)e.push(t),t=t.next;return e}},ld=class{constructor(e={}){this.options=e,this.cacheNodeMap=new WeakMap,this.list=new cd,this.sentinel=this.list.add(`sentinel`)}reset(){this.list.tail&&this.list.splice(this.list.tail,this.sentinel)}touchTile(e){let t=this.cacheNodeMap.get(e);t&&this.list.splice(this.sentinel,t)}loadTile(e){if(!this.cacheNodeMap.has(e)){let t=this.list.add(e);this.cacheNodeMap.set(e,t),this.options.onTileLoad&&this.options.onTileLoad(e)}}unloadTile(e){let t=this.cacheNodeMap.get(e);t&&(this.list.remove(t),this.cacheNodeMap.delete(e),this.options.onTileUnload&&this.options.onTileUnload(e))}unloadTiles(e){let t=this.list.head;for(;t!==this.sentinel&&e();){let e=t.item;t=t.next,this.unloadTile(e)}}toArray(){let e=[];for(let t of this.list.toArray())t.item!==`sentinel`&&e.push(t.item);return e}},ud=class{constructor(){this.map=new Map,this.array=[],this._length=0}get length(){return this._length}get(e){return this.array[e]}set(e,t){e>=this.length&&(this._length=e+1),this.map.has(this.array[e])&&this.map.delete(this.array[e]),this.array[e]=t,this.map.set(t,e)}delete(e){let t=this.map.get(e);t!==void 0&&t>=0&&(this.array.splice(t,1),this.map.delete(e),this._length--)}push(e){if(!this.map.has(e)){let t=this._length++;this.array[t]=e,this.map.set(e,t)}}pop(){let e=this.array[--this._length];return this.map.delete(e),this.array[this._length]=void 0,e}reset(){this.array=[],this.map=new Map,this._length=0}find(e){return this.map.has(e)}peek(){return this.array[this._length-1]}},dd=class{constructor(e){this.tileset=e,this._canSelectTile=!0,this._loadAllTilesTraversalStack=new ud}traverse(e,t,n=[]){this.reset()}reset(){this._loadAllTilesTraversalStack.reset(),this.tileset.hasMixedContent=!1,this.tileset.needsRefinedTiles.clear(),this.tileset.requestedTiles.length=0,this.tileset.selectedTiles.length=0}updateTile(e,t){this.updateTileVisibility(e,t),e.state.shouldSelect=!1,e.state.finalResolution=!0}selectTile(e,t){this._canSelectTile&&e.contentAvailable&&e.state.selectedFrameNumber<t.frameNumber&&(e.state.selectedFrameNumber=t.frameNumber,this.tileset.selectedTiles.push(e),this.tileset.needsRefinedTiles.add(e))}loadTile(e,t){this._canSelectTile&&(e.state.requestedFrameNumber<t.frameNumber&&(e.state.requestedFrameNumber=t.frameNumber,e.content&&(e.content.loadState===`FAILED`&&t.time-e.content.loadStateUpdateTime>e.content.loadfailRetryDelay&&(e.content.loadState=`UNLOADED`,e.content.loadProgress=0,e.content.loadStateUpdateTime=t.time),e.content.loadState===`UNLOADED`&&this.tileset.requestedTiles.push(e))),this.tileset.needsRefinedTiles.add(e))}touchTile(e,t){this._canSelectTile&&(this.tileset.cache.touchTile(e),e.state.touchedFrameNumber=t.frameNumber)}canTraverse(e,t){return!e.state.inRequestVolume||e.hasRenderContent&&(e.levelOfContent>=t.maxLevelOfDetail||e.levelOfContent>=0&&e.geometricError<=t.minGeometricError)||e.children.length===0?!1:e.levelOfContent<t.minLevelOfDetail||e.geometricError>=t.maxGeometricError||e.hasTilesetContent?!0:e.state.screenSpaceError>this.tileset.currentMaxScreenSpaceError}updateTileVisibility(e,t){if(e.updateState(t),!e.state.visible||!e.state.inRequestVolume)return;let n=e.children.length>0;if(e.hasTilesetContent&&n){let n=e.children[0];this.updateTileVisibility(n,t),e.state.visible=n.state.visible;return}if(this.meetsScreenSpaceErrorEarly(e,t)){e.state.visible=!1;return}if(e.refine===`REPLACE`&&n&&!this.anyChildrenVisible(e,t)){e.state.visible=!1;return}}anyChildrenVisible(e,t){let n=!1,r=e.children;for(let e of r)e.updateState(t),n=n||e.state.visible;return n}meetsScreenSpaceErrorEarly(e,t){let{parent:n}=e;return!n||n.refine!==`ADD`||n.levelOfContent<t.minLevelOfDetail||n.geometricError>t.maxGeometricError?!1:n.levelOfContent>t.maxLevelOfDetail||n.levelOfContent>=0&&n.geometricError<t.minGeometricError?!0:e.getScreenSpaceError(t,e.state.distanceToCamera,!0)<this.tileset.currentMaxScreenSpaceError}sortTilesByDistanceToCamera(e){e.sort((e,t)=>t.state.distanceToCamera===0&&e.state.distanceToCamera===0?t.state.centerZDepth-e.state.centerZDepth:t.state.distanceToCamera-e.state.distanceToCamera)}},fd=class extends dd{constructor(e){super(e),this._traversalStack=new ud,this._emptyTraversalStack=new ud}traverse(e,t,n=[]){super.traverse(e,t,n);for(let t of n)this._traversalStack.reset(),this._emptyTraversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t));this._traversalStack.reset(),this._emptyTraversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t))}reset(){super.reset(),this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(e,t){let n=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&n.push(e);n.length>0;){let e=n.pop(),r=e.parent,i=!r||r.state.shouldRefine,a=!1;this.canTraverse(e,t)&&(a=this.updateAndPushChildren(e,t,n)&&i);let o=!a&&i;e.hasRenderContent?e.refine===`ADD`?(this.loadTile(e,t),this.selectDesiredTile(e,t)):e.refine===`REPLACE`&&(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)):(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)),this.touchTile(e,t),e.state.shouldRefine=a}}updateAndPushChildren(e,t,n){let r=e.children;for(let e of r)this.updateTile(e,t);this.sortTilesByDistanceToCamera(r);let i=e.refine===`REPLACE`&&e.hasRenderContent,a=!1,o=!0;for(let e of r)if(e.levelOfContent<=t.minLevelOfDetail||e.geometricError>=t.maxGeometricError||e.state.visible&&e.state.inRequestVolume?(n.find(e)&&n.delete(e),n.push(e),a===!1&&(a=!0)):(i||t.loadSiblings)&&(this.loadTile(e,t),this.touchTile(e,t)),i){let n;n=e.state.inRequestVolume?e.hasRenderContent?e.contentAvailable:this.executeEmptyTraversal(e,t):!1,o=o&&n}return a||(o=!1),o}selectDesiredTile(e,t){e.contentAvailable&&super.selectTile(e,t)}executeEmptyTraversal(e,t){let n=!0,r=this._emptyTraversalStack;for(r.push(e);r.length>0&&n;){let e=r.pop(),i=!e.hasRenderContent&&this.canTraverse(e,t);if(!i&&!e.contentAvailable&&(n=!1),this.updateTile(e,t),e.state.visible||(this.loadTile(e,t),this.touchTile(e,t)),i){let t=e.children;for(let e of t)r.find(e)&&r.delete(e),r.push(e)}}return n}},pd=class extends dd{constructor(e){super(e),this.baseScreenSpaceError=1024,this.skipScreenSpaceErrorFactor=16,this.skipLevels=1,this._traversalStack=new ud,this._descendantTraversalStack=new ud,this._selectionTraversalStack=new ud,this._selectionTraversalancestorStack=new ud}traverse(e,t,n=[]){super.traverse(e,t,n);for(let t of n)this._traversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t),this.traverseAndSelect(e,t));this.tileset.hasMixedContent=!1,this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t),this.traverseAndSelect(e,t))}reset(){super.reset(),this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset()}executeTraversal(e,t){let n=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&n.push(e);n.length>0;){let e=n.pop();this.updateTileAncestorContentLinks(e,t);let r=e.parent,i=!r||r.state.shouldRefine,a=!1;this.canTraverse(e,t)&&(a=this.updateAndPushChildren(e,t,n)&&i);let o=!a&&i;e.hasRenderContent?e.refine===`ADD`?(this.loadTile(e,t),this.selectDesiredTile(e,t)):e.refine===`REPLACE`&&(this.inBaseTraversal(e,this.baseScreenSpaceError)?(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)):o?(this.loadTile(e,t),this.selectDesiredTile(e,t)):this.reachedSkippingThreshold(e)&&this.loadTile(e,t)):(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)),this.touchTile(e,t),e.state.shouldRefine=a}}updateAndPushChildren(e,t,n){let r=e.children;for(let e of r)this.updateTile(e,t);this.sortTilesByDistanceToCamera(r);let i=!1;for(let e of r)e.levelOfContent<=t.minLevelOfDetail||e.geometricError>=t.maxGeometricError||e.state.visible&&e.state.inRequestVolume?(n.push(e),i===!1&&(i=!0)):t.loadSiblings&&(this.loadTile(e,t),this.touchTile(e,t));return i}selectDesiredTile(e,t){let n=e.contentAvailable?e:e.state.ancestorWithContentAvailable;n&&(n.state.shouldSelect=!0),e.contentAvailable||this.selectDescendants(e,t)}selectDescendants(e,t){let n=this._descendantTraversalStack;for(n.push(e);n.length>0;){let e=n.pop().children;for(let r of e)r.state.visible&&(r.contentAvailable?(this.updateTile(r,t),this.touchTile(r,t),this.selectTile(r,t)):n.push(r))}}reachedSkippingThreshold(e){let t=e.state.ancestorWithContent;return t!==null&&e.state.screenSpaceError<t.state.screenSpaceError/this.skipScreenSpaceErrorFactor&&e.levelOfContent>t.levelOfContent+this.skipLevels}updateTileAncestorContentLinks(e,t){e.state.ancestorWithContent=null,e.state.ancestorWithContentAvailable=null;let{parent:n}=e;if(!n)return;let r=!(n.hasRenderContent&&n.hasUnloadedContent)||n.state.requestedFrameNumber===t.frameNumber;e.state.ancestorWithContent=r?n:n.state.ancestorWithContent,e.state.ancestorWithContentAvailable=n.contentAvailable?n:n.state.ancestorWithContentAvailable}inBaseTraversal(e,t){return e.state.ancestorWithContent?e.parent&&e.state.screenSpaceError===0?e.parent.state.screenSpaceError>t:e.state.screenSpaceError>t:!0}traverseAndSelect(e,t){let n=this._selectionTraversalStack,r=this._selectionTraversalancestorStack,i;for(n.push(e);n.length>0||r.length>0;){if(r.length>0){let e=r.peek();if(e.state.stackLength===n.length){r.pop(),e!==i&&(e.state.finalResolution=!1),this.selectTile(e,t);continue}}let e=n.pop();if(!e)continue;let a=this.canTraverse(e,t);if(e.state.shouldSelect)if(e.refine===`ADD`)this.selectTile(e,t);else{if(e.state.selectionDepth=r.length,e.state.selectionDepth>0&&(e.tileset.hasMixedContent=!0),i=e,!a){this.selectTile(e,t);continue}r.push(e),e.state.stackLength=n.length}if(a)for(let t of e.children)t.state.visible&&n.push(t)}}},md=class extends dd{constructor(e){super(e),this._traversalStack=new ud}canTraverse(e,t){return!(!e.state.inRequestVolume||e.levelOfContent>=t.maxLevelOfDetail||e.levelOfContent>=0&&e.geometricError<=t.minGeometricError||e.children.length===0)}traverse(e,t,n){super.traverse(e,t,[]),this._traversalStack.reset(),e.updateState(t);for(let t of n)this._traversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,e.updateState(t),this.executeTraversal(e,t));this._traversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,e.updateState(t),this.executeTraversal(e,t))}reset(){super.reset(),this._traversalStack.reset()}executeTraversal(e,t){let n=this._traversalStack;for(n.push(e);n.length>0;){let e=n.pop(),r=e.refine===`ADD`,i=e.refine===`REPLACE`,a=this.canTraverse(e,t);a&&this.updateAndPushChildren(e,t,n),(r||i&&!a)&&(this.loadTile(e,t),this.touchTile(e,t),this.selectDesiredTile(e,t))}}updateAndPushChildren(e,t,n){let{children:r}=e;for(let e=0;e<r.length;++e){let i=r[e];i.updateState(t),i.state.visible&&n.push(i)}}selectDesiredTile(e,t){e.contentAvailable&&super.selectTile(e,t)}},hd=class{constructor(e,t){var n,r,i,a,o,s,l;if(this.id=e.tilesetUrl,this.transform=new c.Matrix4,this.hasMixedContent=!1,this.frameNumber=0,this.asset={version:e.asset.version,tilesetVersion:e.asset.tilesetVersion||``,gltfUpAxis:(n=e.asset.gltfUpAxis)==null?`Y`:n,overview:e.asset.overview,trajectories:(i=(r=e.asset.trajectories)==null?void 0:r.list)==null?[]:i,extras:e.asset.extras},this.rootMeta=(a=e.rootMeta)==null?{}:a,this.pointLength=(o=this.rootMeta.numTotalPoints)==null?1/0:o,this.floorLength=(s=this.rootMeta.numFloors)==null?1:s,this.properties=(l=e.properties)==null?{}:l,this.options=t,this.requestedTiles=[],this.selectedTiles=[],this.unloadTiles=[],this.needsRefinedTiles=new Set,this.selectedTrajectories=[],this.normalTraverser=new fd(this),this.skipTraverser=new pd(this),this.mostDetailTraverser=new md(this),this.cache=new ld({onTileLoad:e=>{this.cacheMemoryUsageInBytes+=e.contentMemoryUsage},onTileUnload:e=>{this.cacheMemoryUsageInBytes-=e.contentMemoryUsage,this.unloadTiles.push(e)}}),this.requestScheduler=new od(this,{onTileSkip:e=>{},onTileLoad:e=>{var t;(t=e.content)!=null&&t.data&&(this.loadedTiles.add(e),this.cache.loadTile(e)),this.options.onTileLoad(e)},onTileError:(e,t)=>{this.options.onTileError(e,t)}}),this.loadedTiles=new Set,this.cacheMemoryUsageInBytes=0,this.currentMaxScreenSpaceError=NaN,this.root=new Ll(`${this.id}#tile:0`,e.root,this),this.geometricError=e.geometricError,this.trajectories=[],this.asset.trajectories)for(let e=0;e<this.asset.trajectories.length;e++){let t=new nd(`${this.id}#trajectory:${e}`,this.asset.trajectories[e],this);this.trajectories.push(t)}}adjustScreenSpaceError(e){if((isNaN(this.currentMaxScreenSpaceError)||!isFinite(this.currentMaxScreenSpaceError))&&(this.currentMaxScreenSpaceError=e.maxScreenSpaceError),e.memoryAdjustedScreenSpaceError){let t=0,n=0,r=0;if(this.needsRefinedTiles.forEach(e=>{e.content&&(n++,t+=e.content.memoryUsage,e.content.loadState===`READY`&&r++)}),r<2||n<2)this.currentMaxScreenSpaceError=e.maxScreenSpaceError;else{let i=1024*1024,a=t/r*n,o=e.maxMemoryUsage*i,s=o-U(o*.1,8*i,64*i),c=this.currentMaxScreenSpaceError;if(a<s){let e=.5*(1-a/s);c-=e}else a>o&&(c+=.3);c=U(c,1,e.maxScreenSpaceError),Math.abs(c-this.currentMaxScreenSpaceError)>=.1&&(this.currentMaxScreenSpaceError=c)}}else this.currentMaxScreenSpaceError=e.maxScreenSpaceError}getTraverser(e){return e.mostDetail?this.mostDetailTraverser:e.skipLevelOfDetail?this.skipTraverser:this.normalTraverser}reset(){this.cache.reset(),this.skipTraverser.reset(),this.normalTraverser.reset(),this.mostDetailTraverser.reset(),this.requestScheduler.reset();let e=[this.root],t;for(;t=e.pop();){for(let n=0,r=t.children.length;n<r;n++)e.push(t.children[n]);this.cache.unloadTile(t)}for(;this.unloadTiles.length;){let e=this.unloadTiles.pop();e&&(this.loadedTiles.delete(e),this.cacheMemoryUsageInBytes-=e.contentMemoryUsage,this.options.tileUnloader(e).catch(()=>{}).then(()=>{this.options.onTileUnload&&this.options.onTileUnload(e)}))}for(this.loadedTiles.clear();this.trajectories.length;){let e=this.trajectories.pop();e&&this.options.trajectoryUnloader(e).catch(()=>{}).then(()=>{this.options.onTrajectoryUnload&&this.options.onTrajectoryUnload(e)})}}update(e,t=[]){var n;for(this.frameNumber=e.frameNumber,this.adjustScreenSpaceError(e),this.cache.reset(),this.getTraverser(e).traverse(this.root,e,t),this.cache.unloadTiles(()=>this.cacheMemoryUsageInBytes>e.maxMemoryUsage*1024*1024),this.requestScheduler.update(this.requestedTiles,e.requestOrder,e);this.unloadTiles.length;){let e=this.unloadTiles.pop();e&&(this.loadedTiles.delete(e),this.options.tileUnloader(e).catch(()=>{}).then(()=>{this.options.onTileUnload&&this.options.onTileUnload(e)}))}this.selectedTrajectories.length=0;for(let t of this.trajectories)t.visible===!0&&t.content.loadState===`READY`&&(n=t.content.data)!=null&&n.object?this.selectedTrajectories.push(t):t.visible===!0&&(t.content.loadState===`FAILED`&&e.time-t.content.loadStateUpdateTime>t.content.loadfailRetryDelay&&(t.content.loadState=`UNLOADED`,t.content.loadStateUpdateTime=e.time),t.content.loadState===`UNLOADED`&&this.options.trajectoryLoader(t).then(()=>{this.options.onTrajectoryLoad(t)}).catch(e=>{this.options.onTrajectoryError(t,e)}))}};function gd(e,t){var n;if(e.content){let r=(n=e.content.uri)==null?e.content.url:n;typeof r==`string`&&!Sr(r)&&(e.content.uri=Er(wr(t,r)))}if(e.transform){let t=!1;for(let n=0;n<16;n++){let r=e.transform[n];if(typeof r!=`number`||isNaN(r)||!isFinite(r)){t=!0;break}}if(e.transform[15]===0&&(t=!0),t)throw Error(`Invalid Tile Transform: `+JSON.stringify(e.transform))}if(e.children)for(let n of e.children)gd(n,t);return e}function _d(e,t){e.tilesetUrl=t;let n=/^blob\:/.test(t)?``:t.slice(0,t.lastIndexOf(`/`)+1);if(e.asset||(e.asset={}),e.rootMeta||(e.rootMeta={}),e.rootMeta.taskParameters||(e.rootMeta.taskParameters={}),e.asset.overview){let t=e.asset.overview;Sr(t.imageFile)||(t.imageFile=Er(wr(n,t.imageFile))),Sr(t.worldFile)||(t.worldFile=Er(wr(n,t.worldFile)))}if(e.asset.trajectories)for(let t=0;t<e.asset.trajectories.list.length;t++){let r=e.asset.trajectories.list[t];r.file=Er(wr(n,r.file))}return gd(e.root,n),e}function vd(e){return new Promise(t=>setTimeout(t,e))}var yd=new class{constructor(e){this.queue=[],this.concurrency=e,this.dequeuing=0}add(e,t=1e3){let n,r,i=new Promise((e,t)=>{n=e,r=t});return this.queue.unshift(()=>{let i=Promise.resolve().then(e);i.then(n,r);let a=vd(t);return Promise.race([i,a]).then(K,K)}),this.dequeue(),i}dequeue(){for(;this.dequeuing<this.concurrency&&this.queue.length>0;){let e=this.queue.pop();this.dequeuing++,e().catch(K).then(()=>{this.dequeuing--,this.dequeue()})}}}(1),bd=256;function xd(e){return typeof e.image==`object`&&e.image.width>0&&e.image.height>0}function Sd(e,t){if(!xd(e))return Promise.resolve(e);if(e.image.width<bd&&e.image.width<bd)return t.initTexture(e),Promise.resolve(e);let n=!1,r=()=>{n=!0,e.removeEventListener(`dispose`,r)};return e.addEventListener(`dispose`,r),yd.add(()=>new Promise(i=>{si.shared.add(()=>{xd(e)&&n===!1&&t.initTexture(e),e.removeEventListener(`dispose`,r),i(e)},!0)}))}function Cd(e,t){return Promise.all(e.map(e=>Sd(e,t)))}var wd=/^[og]\s*(.+)?/,Td=/^mtllib /,Ed=/^usemtl /,Dd=/^usemap /,Od=/\s+/,kd=new c.Color,Ad=class{constructor(){this.objects=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.materials={},this.materialLibraries=[],this.startObject(``,!1)}startObject(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}let n=this.object&&typeof this.object.currentMaterial==`function`?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0),this.object={name:e||``,fromDeclaration:t!==!1,geometry:{vertices:[],hasNormal:!0,normals:[],hasColor:!0,colors:[],hasUV:!0,uvs:[],index:[],indexMap:{}},materials:[],smooth:!0,startMaterial:function(e,t){var n,r;let i=this._finalize(!1);i&&(i.inherited||((n=i.groupCount)==null?0:n)<=0)&&this.materials.splice((r=i.index)==null?0:r,1);let a={index:this.materials.length,name:e||``,mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:``,smooth:i===void 0?this.smooth:i.smooth,groupStart:i===void 0?0:i.groupEnd,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){let t={index:typeof e==`number`?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1,clone(){return this}};return t.clone=this.clone.bind(t),t}};return this.materials.push(a),a},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){var t,n;let r=this.currentMaterial();if(r&&r.groupEnd===-1&&(r.groupEnd=this.geometry.index.length,r.groupCount=r.groupEnd-((t=r.groupStart)==null?0:t),r.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)((n=this.materials[e].groupCount)==null?0:n)<=0&&this.materials.splice(e,1);return e&&this.materials.length===0&&this.materials.push({name:``,smooth:this.smooth}),r}},n&&n.name&&typeof n.clone==`function`){let e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)}finalize(){this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0)}parseVertexIndex(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3}parseNormalIndex(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3}parseUVIndex(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2}addFace(e,t,n,r,i,a,o,s,c){let l=this.object.geometry,u=this.vertices.length,d=this.normals.length,f=this.uvs.length,p=this.parseVertexIndex(e,u),m=this.parseVertexIndex(t,u),h=this.parseVertexIndex(n,u),g=o===void 0?void 0:this.parseNormalIndex(o,d),_=s===void 0?void 0:this.parseNormalIndex(s,d),v=c===void 0?void 0:this.parseNormalIndex(c,d),y=r===void 0?void 0:this.parseUVIndex(r,f),b=i===void 0?void 0:this.parseUVIndex(i,f),x=a===void 0?void 0:this.parseUVIndex(a,f);(l.hasNormal===!0&&g===void 0||_===void 0||v===void 0)&&(l.hasNormal=!1),(l.hasUV===!0&&y===void 0||b===void 0||x===void 0)&&(l.hasUV=!1);let S=[p,y,g].join(`:`),C=l.indexMap[S];C===void 0&&(C=l.vertices.length/3,l.indexMap[S]=C,l.vertices.push(this.vertices[p+0],this.vertices[p+1],this.vertices[p+2]),l.hasColor&&(this.colors[p]===void 0?l.hasColor=!1:l.colors.push(this.colors[p+0],this.colors[p+1],this.colors[p+2])),l.hasNormal&&l.normals.push(this.normals[p+0],this.normals[p+1],this.normals[p+2]),l.hasUV&&l.uvs.push(this.uvs[y+0],this.uvs[y+1])),l.index.push(C);let w=[m,b,_].join(`:`),T=l.indexMap[w];T===void 0&&(T=l.vertices.length/3,l.indexMap[w]=T,l.vertices.push(this.vertices[m+0],this.vertices[m+1],this.vertices[m+2]),l.hasColor&&(this.colors[m]===void 0?l.hasColor=!1:l.colors.push(this.colors[m+0],this.colors[m+1],this.colors[m+2])),l.hasNormal&&l.normals.push(this.normals[m+0],this.normals[m+1],this.normals[m+2]),l.hasUV&&l.uvs.push(this.uvs[b+0],this.uvs[b+1])),l.index.push(T);let E=[h,x,v].join(`:`),D=l.indexMap[E];D===void 0&&(D=l.vertices.length/3,l.indexMap[E]=D,l.vertices.push(this.vertices[h+0],this.vertices[h+1],this.vertices[h+2]),l.hasColor&&(this.colors[h]===void 0?l.hasColor=!1:l.colors.push(this.colors[h+0],this.colors[h+1],this.colors[h+2])),l.hasNormal&&l.normals.push(this.normals[h+0],this.normals[h+1],this.normals[h+2]),l.hasUV&&l.uvs.push(this.uvs[x+0],this.uvs[x+1])),l.index.push(D)}};function jd(e){let t=new Ad;e.indexOf(`\r
830
+ `,vo=`KHR_texture_basisu`,yo=class extends Qa{loadTexture(e,t){let n=t.json.textures[e];if(!n.extensions||!n.extensions[vo])return null;let r=n.extensions[vo],i=t.json.images[r.source],a=null;if(i.bufferView!==void 0)a=t.loadBufferView(i.bufferView).then(e=>po.parse(e));else if(i.uri)a=t.options.fetcher.ajax(t.resolveResouce(i.uri),{responseType:`arraybuffer`}).then(e=>po.parse(e.body));else throw Error(`glTF: Invalid image defs.`);let o=(t.json.samplers||{})[n.sampler]||{};return a=a.then(e=>(e.magFilter=c.LinearFilter,e.minFilter=c.LinearFilter,e.wrapS=za[o.wrapS]||c.RepeatWrapping,e.wrapT=za[o.wrapT]||c.RepeatWrapping,e)),a}},bo=`KHR_texture_transform`,xo=class extends Qa{extendTexture(e,t,n){let r=t.extensions===void 0?void 0:t.extensions[bo];return r?(r.texCoord!==void 0&&console.warn(`glTF: Custom UV sets in "`+bo+`" extension not yet supported.`),r.offset===void 0&&r.rotation===void 0&&r.scale===void 0?e:(e=e.clone(),e.needsUpdate=!0,r.offset!==void 0&&e.offset.fromArray(r.offset),r.rotation!==void 0&&(e.rotation=r.rotation),r.scale!==void 0&&e.repeat.fromArray(r.scale),e)):null}},So=class extends Qa{},Co=`KHR_materials_unlit`,wo=class extends Qa{extendMaterial(e,t,n){var r;return t.material!==void 0&&e instanceof yn&&((r=n.json.materials[t.material].extensions)==null?{}:r)[Co]&&(e.shaderType=`basic`),Promise.all([]).then(K)}},To=`KHR_node_visibility`,Eo=class extends Qa{extendNode(e,t,n){var r;let i=[],a=(r=t.extensions)==null?{}:r;if(a[To]){let t=a[To];typeof t.visible==`boolean`&&(e.visible=t.visible)}return Promise.all(i).then(K)}},Do=class extends Qa{},Oo=`KHR_materials_clearcoat`,ko=class extends Qa{extendMaterial(e,t,n){var r;let i=[];if(t.material!==void 0&&(e instanceof yn||e instanceof c.MeshPhysicalMaterial)){let a=(r=n.json.materials[t.material].extensions)==null?{}:r;if(a[Oo]){let t=a[Oo];if(t.clearcoatFactor!==void 0&&(e.clearcoat=t.clearcoatFactor),t.clearcoatTexture!==void 0&&i.push(n.createMaterialTexture(t.clearcoatTexture).then(t=>{t.format=c.RGBFormat,e.clearcoatMap=t,n.disposeSet.add(t)})),t.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=t.clearcoatRoughnessFactor),t.clearcoatRoughnessTexture!==void 0&&i.push(n.createMaterialTexture(t.clearcoatRoughnessTexture).then(t=>{t.format=c.RGBFormat,e.clearcoatRoughnessMap=t,n.disposeSet.add(t)})),t.clearcoatNormalTexture!==void 0&&(i.push(n.createMaterialTexture(t.clearcoatNormalTexture).then(t=>{t.format=c.RGBFormat,e.clearcoatNormalMap=t,n.disposeSet.add(t)})),t.clearcoatNormalTexture.scale!==void 0)){let n=t.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new c.Vector2(n,n)}}}return Promise.all(i).then(K)}},Ao=`KHR_materials_sheen`,jo=class extends Qa{extendMaterial(e,t,n){var r;let i=[];if(t.material!==void 0&&(e instanceof yn||e instanceof c.MeshPhysicalMaterial)){let i=(r=n.json.materials[t.material].extensions)==null?{}:r;if(i[Ao]){let t=i[Ao];if(t.sheenColorFactor!==void 0){let n=t.sheenColorFactor;e.sheen=new c.Color().setRGB(n[0],n[1],n[2])}t.sheenRoughnessFactor!==void 0&&console.warn(`glTF: ${Ao} sheenRoughnessFactor unsupported`),t.sheenColorTexture!==void 0&&console.warn(`glTF: ${Ao} sheenColorTexture unsupported`),t.sheenRoughnessTexture!==void 0&&console.warn(`glTF: ${Ao} sheenRoughnessTexture unsupported`)}}return Promise.all(i).then(K)}},Mo=`KHR_materials_transmission`,No=class extends Qa{extendMaterial(e,t,n){var r;let i=[];if(t.material!==void 0&&(e instanceof yn||e instanceof c.MeshPhysicalMaterial)){let i=(r=n.json.materials[t.material].extensions)==null?{}:r;if(i[Mo]){let t=i.KHR_materials_transmission;t.transmissionFactor!==void 0&&(e.transparency=t.transmissionFactor,e.transparency>0&&(e.transparent=!0)),t.transmissionTexture!==void 0&&console.warn(`glTF: ${Mo} transmissionTexture unsupported`)}}return Promise.all(i).then(K)}},Po=`KHR_materials_emissive_strength`,Fo=class extends Qa{extendMaterial(e,t,n){var r;let i=[];if(t.material!==void 0&&(e instanceof yn||e instanceof c.MeshStandardMaterial)){let i=(r=n.json.materials[t.material].extensions)==null?{}:r;if(i[Po]){let t=i[Po];t.emissiveStrength!==void 0&&(e.emissiveIntensity=t.emissiveStrength)}}return Promise.all(i).then(K)}},Io=(function(){"use strict";var e=`b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:78Yqdbk:qzezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhlaicefhodnadTmbalc;WFbGglcjdalcjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfglcl4cifcd4hxdndndndnalc9WGgmTmbcbhPcehsawcjdfhzaohHinaraH9Rax6midnaraHaxfgo9RcK6mbczhlinalgic9Wfglawcj;cbffhOdndndndndnaHalco4fRbbalci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOaoRblaoRbbgAco4glalciSgCE86bbawcj;cbfaifglcGfaoclfaCfgORbbaAcl4ciGgCaCciSgCE86bbalcVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbalc7faOaCfgORbbaAciGgAaAciSgAE86bbalctfaOaAfgARbbaoRbegOco4gCaCciSgCE86bbalc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc93faAaCfgARbbaOciGgOaOciSgOE86bbalc94faAaOfgARbbaoRbdgOco4gCaCciSgCE86bbalc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc97faAaCfgARbbaOciGgOaOciSgOE86bbalc98faAaOfgORbbaoRbigoco4gAaAciSgAE86bbalc99faOaAfgORbbaocl4ciGgAaAciSgAE86bbalc9:faOaAfgORbbaocd4ciGgAaAciSgAE86bbalcufaOaAfglRbbaociGgoaociSgoE86bbalaofhoxdkaOaoRbwaoRbbgAcl4glalcsSgCE86bbawcj;cbfaifglcGfaocwfaCfgORbbaAcsGgAaAcsSgAE86bbalcVfaOaAfgORbbaoRbegAcl4gCaCcsSgCE86bbalc7faOaCfgORbbaAcsGgAaAcsSgAE86bbalctfaOaAfgORbbaoRbdgAcl4gCaCcsSgCE86bbalc91faOaCfgORbbaAcsGgAaAcsSgAE86bbalc4faOaAfgORbbaoRbigAcl4gCaCcsSgCE86bbalc93faOaCfgORbbaAcsGgAaAcsSgAE86bbalc94faOaAfgORbbaoRblgAcl4gCaCcsSgCE86bbalc95faOaCfgORbbaAcsGgAaAcsSgAE86bbalc96faOaAfgORbbaoRbvgAcl4gCaCcsSgCE86bbalc97faOaCfgORbbaAcsGgAaAcsSgAE86bbalc98faOaAfgORbbaoRbogAcl4gCaCcsSgCE86bbalc99faOaCfgORbbaAcsGgAaAcsSgAE86bbalc9:faOaAfgORbbaoRbrgocl4gAaAcsSgAE86bbalcufaOaAfglRbbaocsGgoaocsSgoE86bbalaofhoxekaOao8Pbb83bbaOcwfaocwf8Pbb83bbaoczfhokdnaiam9pmbaiczfhlarao9RcL0mekkaiam6miaoTmidnakTmbawaPfRbbhOawcj;cbfhlazhiakhHinaialRbbgAce4cbaAceG9R7aOfgO86bbaiadfhialcefhlaHcufgHmbkkazcefhzaPcefgPad6hsaohHaPad9hmexvkkcbhoasceGmdxikaoaxad2fhPdnakTmbcbhmcehsawcjdfhCinarao9Rax6miaoTmdaoaxfhoawamfRbbhOawcj;cbfhlaChiakhHinaialRbbgAce4cbaAceG9R7aOfgO86bbaiadfhialcefhlaHcufgHmbkaCcefhCamcefgmad6hsamad9hmbkaPhoxikcbhlcehsinarao9Rax6mdaoTmeaoaxfhoalcefglad6hsadal9hmbkaPhoxdkcbhoasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqaombkc9:hoxekcbc99arao9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;xzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok: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:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj;8ifcjjj98G::NUdbabclfhbadcufgdmbkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb`,t=`b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;a9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;d8JlHud97euo978Jjjjjbcj;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:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgAclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;tzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:wPliuo97eue978Jjjjjbca9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp: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:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskdnalTmbcbhvabhdinadczfgxaxpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;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;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabalcitfglad;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;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbadczfhdaeclfgeav6mbkkdnaval9pmbaialciGgecdtgdVcbc;abad9R;8kbaiabavcdtfgvad;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiad;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb`,n=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]),r=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(n)?t:e,a,o=WebAssembly.instantiate(s(i),{}).then(function(e){a=e.instance,a.exports.__wasm_call_ctors()});function s(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;++n){var i=e.charCodeAt(n);t[n]=i>96?i-97:i>64?i-39:i+4}for(var a=0,n=0;n<e.length;++n)t[a++]=t[n]<60?r[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,a)}function c(e,t,n,r,i,o){var s=a.exports.sbrk,c=n+3&-4,l=s(c*r),u=s(i.length),d=new Uint8Array(a.exports.memory.buffer);d.set(i,u);var f=e(l,n,r,u,i.length);if(f==0&&o&&o(l,c,r),t.set(d.subarray(l,l+n*r)),s(l-s(0)),f!=0)throw Error(`Malformed buffer data: `+f)}var l={NONE:``,OCTAHEDRAL:`meshopt_decodeFilterOct`,QUATERNION:`meshopt_decodeFilterQuat`,EXPONENTIAL:`meshopt_decodeFilterExp`},u={ATTRIBUTES:`meshopt_decodeVertexBuffer`,TRIANGLES:`meshopt_decodeIndexBuffer`,INDICES:`meshopt_decodeIndexSequence`},d=[],f=0;function p(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){var n=e.data;t.pending-=n.count,t.requests[n.id][n.action](n.value),delete t.requests[n.id]},t}function m(e){for(var t=`var instance; var ready = WebAssembly.instantiate(new Uint8Array([`+new Uint8Array(s(i))+`]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;`+c.toString()+g.toString(),n=new Blob([t],{type:`text/javascript`}),r=URL.createObjectURL(n),a=0;a<e;++a)d[a]=p(r);URL.revokeObjectURL(r)}function h(e,t,n,r,i){for(var a=d[0],o=1;o<d.length;++o)d[o].pending<a.pending&&(a=d[o]);return new Promise(function(o,s){var c=new Uint8Array(n),l=f++;a.pending+=e,a.requests[l]={resolve:o,reject:s},a.object.postMessage({id:l,count:e,size:t,source:c,mode:r,filter:i},[c.buffer])})}function g(e){o.then(function(){var t=e.data;try{var n=new Uint8Array(t.count*t.size);c(a.exports[t.mode],n,t.count,t.size,t.source,a.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:`resolve`,value:n},[n.buffer])}catch(e){self.postMessage({id:t.id,count:t.count,action:`reject`,value:e})}})}return{ready:o,supported:!0,useWorkers:function(e){m(e)},decodeVertexBuffer:function(e,t,n,r,i){c(a.exports.meshopt_decodeVertexBuffer,e,t,n,r,a.exports[l[i]])},decodeIndexBuffer:function(e,t,n,r){c(a.exports.meshopt_decodeIndexBuffer,e,t,n,r)},decodeIndexSequence:function(e,t,n,r){c(a.exports.meshopt_decodeIndexSequence,e,t,n,r)},decodeGltfBuffer:function(e,t,n,r,i,o){c(a.exports[u[i]],e,t,n,r,a.exports[l[o]])},decodeGltfBufferAsync:function(e,t,n,r,i){return d.length>0?h(e,t,n,u[r],l[i]):o.then(function(){var o=new Uint8Array(e*t);return c(a.exports[u[r]],o,e,t,n,a.exports[l[i]]),o})}}})(),Lo=`EXT_meshopt_compression`,Ro=class extends Qa{loadBufferView(e,t){let n=t.json,r=n.bufferViews[e];if(r.extensions&&r.extensions[Lo]){let e=r.extensions[Lo],i=t.loadBuffer(e.buffer);if(!Io.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(Lo)>=0)throw Error(`THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files`);return null}return Promise.all([i,Io.ready]).then(([t])=>{let n=e.byteOffset||0,r=e.byteLength||0,i=e.count,a=e.byteStride,o=new ArrayBuffer(i*a),s=new Uint8Array(t,n,r);return Io.decodeGltfBuffer(new Uint8Array(o),i,a,s,e.mode,e.filter),o})}else return null}},zo=`EXT_texture_webp`,Bo=class extends Qa{constructor(){super(...arguments),this.supportsWep=!1}prepare(e){return Nr().then(e=>{this.supportsWep=e.webp})}loadTexture(e,t){let n=t.json.textures[e];if(!n.extensions||!n.extensions[zo]||!this.supportsWep)return null;let r=n.extensions[zo];return t.loadImage(r.source).then(e=>{let r=new c.Texture(e);r.needsUpdate=!0,r.flipY=!1,n.name&&(r.name=n.name);let i=(t.json.samplers||{})[n.sampler]||{};return r.magFilter=Ra[i.magFilter]||c.LinearFilter,r.minFilter=Ra[i.minFilter]||c.LinearMipmapLinearFilter,r.wrapS=za[i.wrapS]||c.RepeatWrapping,r.wrapT=za[i.wrapT]||c.RepeatWrapping,r.onUpdate=function(){e.close()},r})}},Vo=`CESIUM_RTC`,Ho=class extends Qa{emitResult(e,t){if(t.json.extensions[Vo]&&t.json.extensions[Vo].center){let n=t.json.extensions[Vo].center;e.CESIUM_RTC={center:new c.Vector3().fromArray(n)}}}},Uo=`REALSEE_materials_lightmap`,Wo=class extends Qa{extendMaterial(e,t,n){let r=[];if(n.json.materials&&t.material!==void 0){let i=n.json.materials[t.material].extensions[Uo];i&&(i.lightMapTexture!==void 0&&r.push(n.createMaterialTexture(i.lightMapTexture).then(t=>{e.lightMap=t})),i.lightMapIntensity!==void 0&&(e.lightMapIntensity=i.lightMapIntensity))}return Promise.all(r).then(()=>{})}};function Go(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}var Ko=`KHR_gaussian_splatting`,qo=class extends Qa{loadMeshPrimitive(e,t,n){let r=t.extensions[Ko];return r?this.loadGaussianSplating(r,n):null}loadGaussianSplating(e,t){return Go(this,void 0,void 0,function*(){if(`extensions`in e&&e.extensions.KHR_gaussian_splatting_compression_spz_2){let n=t.extensions.KHR_gaussian_splatting_compression_spz_2;if(n)return n.load(e.extensions.KHR_gaussian_splatting_compression_spz_2,t)}if(`compression`in e&&e.compression.extension===`KHR_gaussian_splatting_compression_spz`){let n=t.extensions.KHR_gaussian_splatting_compression_spz;if(n)return n.load({bufferView:e.bufferView},t)}return Promise.resolve(new c.Points)})}},Jo=new Float32Array(1),Yo=new Uint32Array(Jo.buffer),Xo=typeof Float16Array<`u`,Zo=Xo?new Float16Array(1):null,Qo=Xo?new Uint16Array(Zo.buffer):new Uint16Array(1);function $o(e){if(Xo&&Zo)return Qo[0]=e,Zo[0];let t=e>>15&1,n=e>>10&31,r=e&1023,i;if(n===0)if(r===0)i=t<<31;else{let e=r,n=-14;for(;!(e&1024);)e<<=1,n--;e&=1023;let a=n+127,o=e<<13;i=t<<31|a<<23|o}else if(n===31)i=r===0?t<<31|2139095040:t<<31|2143289344;else{let e=n-15+127,a=r<<13;i=t<<31|e<<23|a}return Yo[0]=i,Jo[0]}var es=class{constructor({fileBytes:e}){this.fileBytes=e,this.chunks=[],this.totalBytes=0;let t=new DecompressionStream(`gzip`);this.reader=new Blob([e]).stream().pipeThrough(t).getReader()}read(e){return Go(this,void 0,void 0,function*(){for(;this.totalBytes<e;){let{value:e,done:t}=yield this.reader.read();if(t)break;this.chunks.push(e),this.totalBytes+=e.length}if(this.totalBytes<e)throw Error(`Unexpected EOF: needed ${e}, got ${this.totalBytes}`);let t=new Uint8Array(this.totalBytes),n=0;for(let e of this.chunks)t.set(e,n),n+=e.length;let r=t.subarray(0,e);return this.chunks=[t.subarray(e)],this.totalBytes-=e,r})}},ts=.28209479177387814,ns=class{constructor({fileBytes:e}){this.version=-1,this.numSplats=0,this.shDegree=0,this.fractionalBits=0,this.flags=0,this.flagAntiAlias=!1,this.reserved=0,this.headerParsed=!1,this.parsed=!1,this.fileBytes=e instanceof ArrayBuffer?new Uint8Array(e):e,this.reader=new es({fileBytes:this.fileBytes})}parseHeader(){return Go(this,void 0,void 0,function*(){if(this.headerParsed)throw Error(`SPZ file header already parsed`);let e=new DataView((yield this.reader.read(16)).buffer);if(e.getUint32(0,!0)!==1347635022)throw Error(`Invalid SPZ file`);if(this.version=e.getUint32(4,!0),this.version<1||this.version>3)throw Error(`Unsupported SPZ version: ${this.version}`);this.numSplats=e.getUint32(8,!0),this.shDegree=e.getUint8(12),this.fractionalBits=e.getUint8(13),this.flags=e.getUint8(14),this.flagAntiAlias=(this.flags&1)!=0,this.reserved=e.getUint8(15),this.headerParsed=!0,this.parsed=!1})}parseSplats(e,t,n,r,i,a){return Go(this,void 0,void 0,function*(){if(!this.headerParsed)throw Error(`SPZ file header must be parsed first`);if(this.parsed)throw Error(`SPZ file already parsed`);if(this.parsed=!0,this.version===1){let t=yield this.reader.read(this.numSplats*3*2),n=new Uint16Array(t.buffer);for(let t=0;t<this.numSplats;t++){let r=t*3,i=$o(n[r]),a=$o(n[r+1]),o=$o(n[r+2]);e==null||e(t,i,a,o)}}else if(this.version===2||this.version===3){let t=1<<this.fractionalBits,n=yield this.reader.read(this.numSplats*3*3);for(let r=0;r<this.numSplats;r++){let i=r*9,a=((n[i+2]<<24|n[i+1]<<16|n[i]<<8)>>8)/t,o=((n[i+5]<<24|n[i+4]<<16|n[i+3]<<8)>>8)/t,s=((n[i+8]<<24|n[i+7]<<16|n[i+6]<<8)>>8)/t;e==null||e(r,a,o,s)}}{let e=yield this.reader.read(this.numSplats);for(let n=0;n<this.numSplats;n++)t==null||t(n,e[n]/255)}{let e=yield this.reader.read(this.numSplats*3),t=ts/.15;for(let r=0;r<this.numSplats;r++){let i=r*3,a=(e[i]/255-.5)*t+.5,o=(e[i+1]/255-.5)*t+.5,s=(e[i+2]/255-.5)*t+.5;n==null||n(r,a,o,s)}}{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3,i=Math.exp(e[n]/16-10),a=Math.exp(e[n+1]/16-10),o=Math.exp(e[n+2]/16-10);r==null||r(t,i,a,o)}}if(this.version===3){let e=1/Math.sqrt(2),t=yield this.reader.read(this.numSplats*4);for(let n=0;n<this.numSplats;n++){let r=n*4,a=[0,0,0,0],o=[t[r],t[r+1],t[r+2],t[r+3]],s=o[0]+(o[1]<<8)+(o[2]<<16)+(o[3]<<24),c=s>>>30,l=s,u=0;for(let t=3;t>=0;--t)if(t!==c){let n=l&511,r=l>>>9&1;l>>>=10,a[t]=n/511*e,a[t]=r===0?a[t]:-a[t],u+=a[t]*a[t]}let d=1-u;a[c]=Math.sqrt(Math.max(d,0)),i==null||i(n,a[0],a[1],a[2],a[3])}}else{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3,r=e[n]/127.5-1,a=e[n+1]/127.5-1,o=e[n+2]/127.5-1,s=Math.sqrt(Math.max(0,1-r*r-a*a-o*o));i==null||i(t,r,a,o,s)}}if(a&&this.shDegree>=1){let e={1:3,2:8,3:15}[this.shDegree]||0,t=yield this.reader.read(this.numSplats*e*3),n=new Float32Array(9),r=this.shDegree>=2?new Float32Array(15):void 0,i=this.shDegree>=3?new Float32Array(21):void 0,o=0;for(let e=0;e<this.numSplats;e++){for(let e=0;e<9;++e)n[e]=(t[o+e]-128)/128;if(o+=9,r){for(let e=0;e<15;++e)r[e]=(t[o+e]-128)/128;o+=15}if(i){for(let e=0;e<21;++e)i[e]=(t[o+e]-128)/128;o+=21}a==null||a(e,new Float32Array(n),r?new Float32Array(r):void 0,i?new Float32Array(i):void 0)}}})}};function rs(e){return Go(this,void 0,void 0,function*(){let t=new ns({fileBytes:e});yield t.parseHeader();let n=t.numSplats,r=new Float32Array(n*3),i=new Uint8Array(n*4),a=new Float32Array(n*3),o=new Float32Array(n*4),s,c,l;return t.shDegree>=1&&(s=new Float32Array(n*9)),t.shDegree>=2&&(c=new Float32Array(n*15)),t.shDegree>=3&&(l=new Float32Array(n*21)),yield t.parseSplats((e,t,n,i)=>{r[e*3]=t,r[e*3+1]=n,r[e*3+2]=i},(e,t)=>{i[e*4+3]=Math.round(t*255)},(e,t,n,r)=>{i[e*4]=Math.round(Math.max(0,Math.min(1,t))*255),i[e*4+1]=Math.round(Math.max(0,Math.min(1,n))*255),i[e*4+2]=Math.round(Math.max(0,Math.min(1,r))*255)},(e,t,n,r)=>{a[e*3]=t,a[e*3+1]=n,a[e*3+2]=r},(e,t,n,r,i)=>{o[e*4]=i,o[e*4+1]=t,o[e*4+2]=n,o[e*4+3]=r},(e,t,n,r)=>{s&&t&&s.set(t,e*9),c&&n&&c.set(n,e*15),l&&r&&l.set(r,e*21)}),new $n({numPoints:n,positions:r,colors:i,scales:a,rotations:o,sh1:s,sh2:c,sh3:l,shDegree:t.shDegree})})}function is(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Y`:n,s=(r=t.upAxis)==null?`Z`:r,c=(i=t.fetcher)==null?_r:i,l=(a=t.onDownloadProgress)==null?K:a,u=0;return Promise.resolve().then(()=>c.ajax(e,{responseType:`arraybuffer`},void 0,void 0,l)).then(e=>(u=e.body.byteLength,e.body)).then(e=>rs(new Uint8Array(e))).then(t=>(o===`Z`&&(t.applyMatrix4(tr),t.updateMatrix(),t.updateMatrixWorld(!0),t.transformChanged=!0),{type:`spz`,modelUpAxis:o,upAxis:s,uri:e,byteLength:u,memoryUsage:Pi(t),scene:t,textures:[],animations:[],dispose:()=>t.dispose()}))}var as=new c.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),os=new c.Matrix4().getInverse(as),ss=class extends Qa{load(e,t){return Go(this,void 0,void 0,function*(){let{bufferView:n}=e;return t.loadBufferView(n).then(e=>this.loadSpz(new Uint8Array(e)))})}loadSpz(e){return Go(this,void 0,void 0,function*(){return Promise.resolve().then(()=>rs(e)).then(e=>(e.applyMatrix4(os),e.updateMatrix(),e.updateMatrixWorld(!0),e.transformChanged=!0,e))})}},cs=new c.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),ls=new c.Matrix4().getInverse(cs),us={KHR_binary_glTF:eo,KHR_draco_mesh_compression:so,KHR_texture_basisu:yo,KHR_texture_transform:xo,KHR_mesh_quantization:So,KHR_materials_unlit:wo,KHR_node_visibility:Eo,KHR_animation_pointer:Do,KHR_materials_clearcoat:ko,KHR_materials_sheen:jo,KHR_materials_transmission:No,KHR_materials_emissive_strength:Fo,EXT_meshopt_compression:Ro,EXT_texture_webp:Bo,CESIUM_RTC:Ho,REALSEE_materials_lightmap:Wo,KHR_gaussian_splatting:qo,KHR_gaussian_splatting_compression_spz:ss,KHR_gaussian_splatting_compression_spz_2:class extends Qa{constructor(){super()}load(e,t){return Go(this,void 0,void 0,function*(){let{bufferView:n}=e;return t.loadBufferView(n).then(e=>this.loadSpz(new Uint8Array(e)))})}loadSpz(e){return Go(this,void 0,void 0,function*(){return Promise.resolve().then(()=>rs(e)).then(e=>(e.applyMatrix4(ls),e.updateMatrix(),e.updateMatrixWorld(!0),e.transformChanged=!0,e))})}}};function ds(e,t){var n,r,i;let a={},o,s;if(typeof e==`string`)s=e;else if(us.KHR_binary_glTF.getMagic(e)===us.KHR_binary_glTF.HEADER_MAGIC){o=new us.KHR_binary_glTF;try{o.loadGlbBinary(e)}catch(e){return Promise.reject(e)}a.KHR_binary_glTF=o,s=o.content}else s=Fa(new Uint8Array(e));let c=JSON.parse(s);if(t.jsonModify&&(c=t.jsonModify(c)),c.asset===void 0||Number(c.asset.version[0])<2)return Promise.reject(Error(`glTF: Unsupported asset. glTF versions >=2.0 are supported.`));if(c.extensionsUsed){let e=c.extensionsRequired||[];for(var l=0;l<c.extensionsUsed.length;l++){let t=c.extensionsUsed[l];a[t]||(us[t]?a[t]=new us[t]:e.indexOf(t)>=0&&console.warn(`glTF: Unknown extension "`+t+`".`))}}return new qa(c,a,{copyUV2:(n=t.copyUV2)==null?!1:n,resourcePath:(r=t.resourcePath)==null?``:r,search:(i=t.search)==null?``:i,fetcher:t.fetcher}).parse().then(e=>(o&&o.clear(),e))}function fs(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Y`:n,s=(r=t.upAxis)==null?`Z`:r,l=(i=t.fetcher)==null?_r:i,u=(a=t.onDownloadProgress)==null?K:a,d={uri:e,gltfUpAxis:o};return Promise.resolve().then(()=>l.ajax(e,{responseType:`arraybuffer`},void 0,void 0,u).then(e=>e.body)).then(e=>Promise.resolve(0).then(t=>_a(d,e,t)).then(t=>ka(d,e,t)).then(t=>Pa(d,e,t))).then(()=>{var n;return ds(d.gltfArrayBuffer,{copyUV2:!1,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(n=e.split(`?`)[1])==null?``:n,jsonModify(e){var n,r;if(t.light===!1){let t=`KHR_materials_unlit`;if(e.extensionsUsed=(n=e.extensionsUsed)==null?[]:n,e.extensionsUsed.indexOf(t)===-1&&e.extensionsUsed.push(t),e.materials)for(let n of e.materials)n.extensions=(r=n.extensions)==null?{}:r,n.extensions[t]={}}return e},fetcher:l}).then(e=>{let t=new c.Matrix4;o===`Y`&&t.premultiply(er);let n;if(d.rtcCenter?n=new c.Vector3().fromArray(d.rtcCenter):e.CESIUM_RTC&&(n=new c.Vector3().copy(e.CESIUM_RTC.center)),n){let e=new c.Matrix4().setPosition(n);t.premultiply(e)}return s===`Y`&&t.premultiply(tr),e.scene.applyMatrix4(t),d.featureTableBinary=void 0,d.batchTableBinary=void 0,d.gltfArrayBuffer=void 0,{type:`b3dm`,modelUpAxis:o,upAxis:`Z`,uri:d.uri,byteLength:d.byteLength,memoryUsage:Pi(e.scene),scene:e.scene,textures:e.textures,animations:[],rtcCenter:n,dispose:()=>e.dispose()}})})}var ps="(function(){function e(e){onmessage=t=>{Promise.resolve(t.data).then(t=>e(t)).then(({output:e,transfer:t})=>postMessage(e,t)).catch(e=>postMessage({$$error:e}))}}var t;(function(e){e[e.BYTE=5120]=`BYTE`,e[e.UNSIGNED_BYTE=5121]=`UNSIGNED_BYTE`,e[e.SHORT=5122]=`SHORT`,e[e.UNSIGNED_SHORT=5123]=`UNSIGNED_SHORT`,e[e.INT=5124]=`INT`,e[e.UNSIGNED_INT=5125]=`UNSIGNED_INT`,e[e.FLOAT=5126]=`FLOAT`,e[e.DOUBLE=5130]=`DOUBLE`})(t||={});let n={[t.DOUBLE]:Float64Array,[t.FLOAT]:Float32Array,[t.UNSIGNED_SHORT]:Uint16Array,[t.UNSIGNED_INT]:Uint32Array,[t.UNSIGNED_BYTE]:Uint8Array,[t.BYTE]:Int8Array,[t.SHORT]:Int16Array,[t.INT]:Int32Array},r={DOUBLE:t.DOUBLE,FLOAT:t.FLOAT,UNSIGNED_SHORT:t.UNSIGNED_SHORT,UNSIGNED_INT:t.UNSIGNED_INT,UNSIGNED_BYTE:t.UNSIGNED_BYTE,BYTE:t.BYTE,SHORT:t.SHORT,INT:t.INT};function i(e){let t=n[e];if(!t)throw Error(`Failed to convert GL type`);return t}function a(e){return i(e).BYTES_PER_ELEMENT}function o(e,t,n=0,r){let o=i(e);return n%a(e)===0?new o(t,n,r??(t.byteLength-n)/a(e)):new o(r?t.slice(n,n+r*a(e)):t.slice(n))}function s(e){let t=r[e];if(!t)throw Error(`Failed to convert GL type`);return t}var c=class{constructor(e,n){this.featuresLength=0,this.cachedTypedArrays={},this.json=e,this.buffer=n;let r=this.getGlobalProperty(`POINTS_LENGTH`,t.UNSIGNED_INT,1);r&&r.length&&(this.featuresLength=r[0])}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return!!this.json[e]}getGlobalProperty(e,t,n){let r=this.json[e];return typeof r==`number`?new(i(t))([r]):Array.isArray(r)?new(i(t))(r):r&&Number.isFinite(r.byteOffset)?this.getTypedArrayFromBinary(e,t,n,1,r.byteOffset):null}getPropertyArray(e,t,n){let r=this.json[e];return r&&Number.isFinite(r.byteOffset)?(`componentType`in r&&(t=s(r.componentType)),this.getTypedArrayFromBinary(e,t,n,this.featuresLength,r.byteOffset)):this.getTypedArrayFromArray(e,t,r)}getProperty(e,t,n,r,i){if(!this.json[e])return null;let a=this.getPropertyArray(e,t,n);if(n===1)return i[0]=a[r],i;for(let e=0;e<n;++e)i[e]=a[n*r+e];return i}getTypedArrayFromBinary(e,t,n,r,i){let a=this.cachedTypedArrays,s=a[e];return s||(s=o(t,this.buffer.buffer,this.buffer.byteOffset+i,r*n),a[e]=s),s}getTypedArrayFromArray(e,t,n){let r=this.cachedTypedArrays,i=r[e];return i||(i=o(t,n),r[e]=i),i}};e(e=>Promise.resolve(e).then(e=>{let t=new c(e.featureTableJson,e.featureTableBinary),n=u(t),r=d(t),i=p(t),a=[];return n&&a.push(n.array.buffer),r&&a.push(r.array.buffer),i&&a.push(i.array.buffer),{output:{position:n,color:r,normal:i},transfer:a}}));let l=65535;function u(e){if(e.hasProperty(`POSITION`))return{array:e.getPropertyArray(`POSITION`,t.FLOAT,3),itemSize:3,normalized:!1};if(e.hasProperty(`POSITION_QUANTIZED`)){let n=e.getPropertyArray(`POSITION_QUANTIZED`,t.UNSIGNED_SHORT,3),r=e.getGlobalProperty(`QUANTIZED_VOLUME_SCALE`,t.FLOAT,3),i=e.getGlobalProperty(`QUANTIZED_VOLUME_OFFSET`,t.FLOAT,3);if(!r||!i)throw Error(`QUANTIZED_VOLUME_SCALE or QUANTIZED_VOLUME_OFFSET never found.`);let a=new Float32Array(n.length),o=n.length/3,s=r[0]/l,c=r[1]/l,u=r[2]/l,d=i[0],f=i[1],p=i[2];for(let e=0,t;e<o;e++)t=e*3,a[t]=n[t]*s+d,a[++t]=n[t]*c+f,a[++t]=n[t]*u+p;return{array:a,itemSize:3,normalized:!1}}return null}function d(e){if(e.hasProperty(`RGB`)){let n=e.getPropertyArray(`RGB`,t.UNSIGNED_BYTE,3),r=n.length/3,i=new Uint8Array(r*4);for(let e=0,t,a;e<r;e++)a=e*4,t=e*3,i[a]=n[t],i[++a]=n[++t],i[++a]=n[++t];return{array:i,itemSize:4,normalized:!0}}else if(e.hasProperty(`RGBA`))return{array:e.getPropertyArray(`RGBA`,t.UNSIGNED_BYTE,4),itemSize:4,normalized:!0};else if(e.hasProperty(`RGB565`)){let n=e.getPropertyArray(`RGB565`,t.UNSIGNED_SHORT,1),r=n.length,i=new Uint8Array(r*4);for(let e=0,t,a;e<r;e++)a=n[e],t=e*4,i[t]=(a>>11&31)<<3,i[++t]=(a>>5&63)<<2,i[++t]=(a&31)<<3;return{array:i,itemSize:4,normalized:!0}}return null}let f=2/255;function p(e){if(e.hasProperty(`NORMAL`)){let n=e.getPropertyArray(`NORMAL`,t.FLOAT,3),r=n.length/3,i=new Int8Array(r*4);for(let e=0,t,a;e<r;e++)a=e*4,t=e*3,i[a]=n[t]*127,i[++a]=n[++t]*127,i[++a]=n[++t]*127;return{array:i,itemSize:4,normalized:!0}}else if(e.hasProperty(`NORMAL_OCT16P`)){let n=e.getPropertyArray(`NORMAL_OCT16P`,t.UNSIGNED_BYTE,2),r=n.length/2,i=new Int8Array(r*4);for(let e=0,t,a,o,s,c,l,u;e<r;e++)t=e*2,a=n[t]*f-1,o=n[++t]*f-1,c=a<0?-a:a,l=o<0?-o:o,s=1-(c+l),s<0&&(a=(1-l)*(a<0?-1:1),o=(1-c)*(o<0?-1:1)),u=Math.sqrt(a*a+o*o+s*s),t=e*4,i[t]=a/u*127,i[++t]=o/u*127,i[++t]=s/u*127;return{array:i,itemSize:4,normalized:!0}}return null}})();",ms=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,ps],{type:`text/javascript;charset=utf-8`});function hs(e){let t;try{if(t=ms&&(self.URL||self.webkitURL).createObjectURL(ms),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(ps),{name:e==null?void 0:e.name})}}var gs=new co(()=>new hs,2);function _s(e,t,n){let r=new Ta(e.featureTableJson,e.featureTableBinary);return Promise.resolve().then(()=>{let e=r.getExtension(`3DTILES_draco_point_compression`);return e?vs(e,r):gs.postMessage({featureTableBinary:r.buffer,featureTableJson:r.json},[r.buffer.buffer])}).then(t=>(e.attributes=t,n))}function vs(e,t){return Go(this,void 0,void 0,function*(){let n=e.properties||{},r=e.byteOffset,i=e.byteLength;if(!n||!Number.isFinite(r)||!i)throw Error(`Draco properties, byteOffset, and byteLength must be defined`);let a=t.buffer.slice(r,r+i),o=e.properties;return io.decodeGeometry(a.buffer,{attributeIDs:o,attributeTypes:{POSITION:`Float32Array`,NORMAL:`Float32Array`,RGB:`Uint8Array`,RGBA:`Uint8Array`},useUniqueIDs:!0}).then(e=>{let t=e.getAttribute(`POSITION`),n=e.getAttribute(`RGB`),r=e.getAttribute(`RGBA`),i=e.getAttribute(`NORMAL`),a;if(r)a=r;else if(n){let e=n.count,t=n.array,r=new Uint8Array(e*4);for(let n=0,i,a;n<e;n++)a=n*4,i=n*3,r[a]=t[i],r[++a]=t[++i],r[++a]=t[++i];a=new c.BufferAttribute(r,4,n.normalized)}return{position:t?{array:t.array,itemSize:t.itemSize,normalized:t.normalized}:null,color:a?{array:a.array,itemSize:a.itemSize,normalized:a.normalized}:null,normal:i?{array:i.array,itemSize:i.itemSize,normalized:i.normalized}:null}})})}function ys(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?_r:r,s=(i=t.onDownloadProgress)==null?K:i,l={uri:e};return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s).then(e=>e.body)).then(e=>Promise.resolve(0).then(t=>_a(l,e,t)).then(t=>ka(l,e,t)).then(t=>_s(l,e,t))).then(()=>{var e;return bs(l.attributes,{computeBoundingBox:(e=t.computeBoundingBox)==null?!0:e})}).then(e=>{let t=new c.Matrix4,n;if(l.rtcCenter&&(n=new c.Vector3().fromArray(l.rtcCenter)),n){let e=new c.Matrix4().setPosition(n);t.premultiply(e)}return a===`Y`&&t.premultiply(tr),e.object.applyMatrix4(t),l.gltfArrayBuffer=void 0,l.featureTableBinary=void 0,l.batchTableBinary=void 0,{type:`pnts`,modelUpAxis:`Z`,upAxis:a,uri:l.uri,byteLength:l.byteLength,memoryUsage:Pi(e.object),scene:e.object,textures:[],animations:[],rtcCenter:n,dispose:()=>e.dispose()}})}function bs(e,t){let n=new Set,r=new c.BufferGeometry;n.add(r);let i=new kn;n.add(i),e.position&&r.setAttribute(`position`,new c.BufferAttribute(e.position.array,e.position.itemSize,e.position.normalized)),e.color&&r.setAttribute(`color`,new c.BufferAttribute(e.color.array,e.color.itemSize,e.color.normalized)),e.normal?r.setAttribute(`normal`,new c.BufferAttribute(e.normal.array,e.normal.itemSize,e.normal.normalized)):i.flatShading=!0,t.computeBoundingBox&&r.computeBoundingBox();let a=new An(r,i);return a.matrix.compose(a.position,a.quaternion,a.scale),a.matrixAutoUpdate=!1,a.frustumCulled=!1,Promise.resolve({object:a,dispose:()=>{n.forEach(e=>{e.dispose()}),n.clear()}})}function xs(e,t={}){var n,r,i,a,o;let s=(n=t.modelUpAxis)==null?`Y`:n,l=(r=t.upAxis)==null?`Z`:r,u=(i=t.fetcher)==null?_r:i,d=(a=t.onDownloadProgress)==null?K:a,f=(o=t.jsonModify)==null?K:o,p=0;return Promise.resolve().then(()=>u.ajax(e,{responseType:`arraybuffer`},void 0,void 0,d).then(e=>(p=e.body.byteLength,e.body))).then(n=>{var r;return ds(n,{copyUV2:!1,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(r=e.split(`?`)[1])==null?``:r,jsonModify(e){var n,r,i;if(t.light===!1){let t=`KHR_materials_unlit`;if(e.extensionsUsed=(n=e.extensionsUsed)==null?[]:n,e.extensionsUsed.indexOf(t)===-1&&e.extensionsUsed.push(t),e.materials)for(let n of e.materials)n.extensions=(r=n.extensions)==null?{}:r,n.extensions[t]={}}return(i=f(e))==null?e:i},fetcher:u})}).then(t=>{var n;let r=new c.Matrix4;if(s===`Y`&&r.premultiply(er),t.CESIUM_RTC){let e=new c.Matrix4().setPosition(t.CESIUM_RTC.center);r.premultiply(e)}return l===`Y`&&r.premultiply(tr),t.scene.applyMatrix4(r),{type:`gltf`,modelUpAxis:s,upAxis:l,uri:e,byteLength:p,memoryUsage:Pi(t.scene),scene:t.scene,textures:t.textures,animations:t.animations,rtcCenter:(n=t.CESIUM_RTC)==null?void 0:n.center,dispose:()=>t.dispose()}})}var Ss=new c.Color;function Cs(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Z`:n,s=(r=t.upAxis)==null?`Z`:r,l=(i=t.fetcher)==null?_r:i,u=(a=t.onDownloadProgress)==null?K:a,d=0;return Promise.resolve().then(()=>l.ajax(e,{responseType:`arraybuffer`},void 0,void 0,u).then(e=>(d=e.body.byteLength,e.body))).then(e=>{var n,r;return ws(e,{propertyNameMapping:(n=t.propertyNameMapping)==null?{}:n,customPropertyMapping:(r=t.customPropertyMapping)==null?{}:r})}).then(({geometry:n})=>{switch(t.type){case`geometry`:{let t=n;return o===`Y`&&t.applyMatrix4(er),s===`Y`&&t.applyMatrix4(tr),{type:`ply`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:Ti(t),scene:t,textures:[],animations:[],dispose:()=>{n.dispose()}}}case`line`:{let t=`color`in n.attributes,r=new c.LineBasicMaterial({vertexColors:t}),i=new c.Line(n,r);return i.computeLineDistances(),o===`Y`&&i.applyMatrix4(er),s===`Y`&&i.applyMatrix4(tr),{type:`ply`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:Pi(i),scene:i,textures:[],animations:[],dispose:()=>{n.dispose(),r.dispose()}}}case`pbmMesh`:{let r=new yn(t.light?`phong`:`basic`);r.vertexColors=`color`in n.attributes;let i=new c.Mesh(n,r);return o===`Y`&&i.applyMatrix4(er),s===`Y`&&i.applyMatrix4(tr),{type:`ply`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:Pi(i),scene:i,textures:[],animations:[],dispose:()=>{n.dispose(),r.dispose()}}}case`pbmPointCloud`:{let t=new kn,r=new An(n,t);return o===`Y`&&r.applyMatrix4(er),s===`Y`&&r.applyMatrix4(tr),{type:`ply`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:Pi(r),scene:r,textures:[],animations:[],dispose:()=>{n.dispose(),t.dispose()}}}default:break}throw Error(`Invalid Type: ${t.type}`)})}function ws(e,t){let n=new Uint8Array(e),{headerText:r,headerLength:i}=Ls(n),a=Es(r,i,t);return a.format===`ascii`?{header:a,geometry:js(new TextDecoder().decode(n),a,t)}:{header:a,geometry:Is(e,a,t)}}function Ts(e,t){let n={name:``,type:e[0]};return n.type===`list`?(n.name=e[3],n.countType=e[1],n.itemType=e[2]):n.name=e[1],n.name in t.propertyNameMapping&&(n.name=t.propertyNameMapping[n.name]),n}function Es(e,t=0,n){let r=/^ply([\s\S]*)end_header(\r\n|\r|\n)/,i=``,a=r.exec(e);a!==null&&(i=a[1]);let o={format:``,version:``,comments:[],elements:[],headerLength:t,objInfo:``},s=i.split(/\r\n|\r|\n/),c=null;for(let e=0;e<s.length;e++){let t=s[e];if(t=t.trim(),t===``)continue;let r=t.split(/\s+/),i=r.shift();switch(t=r.join(` `),i){case`format`:o.format=r[0],o.version=r[1];break;case`comment`:o.comments.push(t);break;case`element`:c&&o.elements.push(c),c={name:r[0],count:parseInt(r[1]),properties:[]};break;case`property`:c&&c.properties.push(Ts(r,n));break;case`obj_info`:o.objInfo=t;break;default:console.log(`unhandled`,i,r)}}return c&&o.elements.push(c),o}function Ds(e,t){switch(t){case`char`:case`uchar`:case`short`:case`ushort`:case`int`:case`uint`:case`int8`:case`uint8`:case`int16`:case`uint16`:case`int32`:case`uint32`:return parseInt(e);case`float`:case`double`:case`float32`:case`float64`:return parseFloat(e);default:throw Error(`unspport type: `+t)}}function Os(e,t){let n={};for(let r=0;r<e.length;r++){if(t.empty())return null;if(e[r].type===`list`){let i=[],a=Ds(t.next(),e[r].countType);for(let n=0;n<a;n++){if(t.empty())return null;i.push(Ds(t.next(),e[r].itemType))}n[e[r].name]=i}else n[e[r].name]=Ds(t.next(),e[r].type)}return n}function ks(e){let t={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[],faceVertexColors:[]};for(let n of Object.keys(e.customPropertyMapping))t[n]=[];return t}function As(e){let t=e.map(e=>e.name);function n(e){for(let n=0,r=e.length;n<r;n++){let r=e[n];if(t.includes(r))return r}return null}return{attrX:n([`x`,`px`,`posx`])||`x`,attrY:n([`y`,`py`,`posy`])||`y`,attrZ:n([`z`,`pz`,`posz`])||`z`,attrNX:n([`nx`,`normalx`]),attrNY:n([`ny`,`normaly`]),attrNZ:n([`nz`,`normalz`]),attrS:n([`s`,`u`,`texture_u`,`tx`]),attrT:n([`t`,`v`,`texture_v`,`ty`]),attrR:n([`red`,`diffuse_red`,`r`,`diffuse_r`]),attrG:n([`green`,`diffuse_green`,`g`,`diffuse_g`]),attrB:n([`blue`,`diffuse_blue`,`b`,`diffuse_b`])}}function js(e,t,n){let r=ks(n),i=/end_header\s+(\S[\s\S]*\S|\S)\s*$/,a,o=null;a=(o=i.exec(e))===null?[]:o[1].split(/\s+/);let s=new Rs(a);loop:for(let e=0;e<t.elements.length;e++){let i=t.elements[e],a=As(i.properties);for(let e=0;e<i.count;e++){let e=Os(i.properties,s);if(!e)break loop;Ns(r,i.name,e,a,n)}}return Ms(r,n)}function Ms(e,t){let n=new c.BufferGeometry;e.indices.length>0&&n.setIndex(e.indices),n.setAttribute(`position`,new c.Float32BufferAttribute(e.vertices,3)),e.normals.length>0&&n.setAttribute(`normal`,new c.Float32BufferAttribute(e.normals,3)),e.uvs.length>0&&n.setAttribute(`uv`,new c.Float32BufferAttribute(e.uvs,2)),e.colors.length>0&&n.setAttribute(`color`,new c.Float32BufferAttribute(e.colors,3)),(e.faceVertexUvs.length>0||e.faceVertexColors.length>0)&&(n=n.toNonIndexed(),e.faceVertexUvs.length>0&&n.setAttribute(`uv`,new c.Float32BufferAttribute(e.faceVertexUvs,2)),e.faceVertexColors.length>0&&n.setAttribute(`color`,new c.Float32BufferAttribute(e.faceVertexColors,3)));for(let r of Object.keys(t.customPropertyMapping))if(e[r].length>0){let{itemType:i,itemNames:a,normalized:o}=t.customPropertyMapping[r],s=a.length,l;switch(i){case`float32`:l=new c.Float32BufferAttribute(e[r],s,o);break;case`uint32`:l=new c.Uint32BufferAttribute(e[r],s,o);break;case`int32`:l=new c.Int32BufferAttribute(e[r],s,o);break;case`uint16`:l=new c.Uint16BufferAttribute(e[r],s,o);break;case`int16`:l=new c.Int16BufferAttribute(e[r],s,o);break;case`uint8`:l=new c.Uint8BufferAttribute(e[r],s,o);break;case`int8`:l=new c.Int8BufferAttribute(e[r],s,o);break;default:l=new c.Float32BufferAttribute(e[r],s,o);break}n.setAttribute(r,l)}return n.computeBoundingSphere(),n}function Ns(e,t,n,r,i){if(t===`vertex`){r.attrX!==null&&r.attrY!==null&&r.attrZ!==null&&e.vertices.push(n[r.attrX],n[r.attrY],n[r.attrZ]),r.attrNX!==null&&r.attrNY!==null&&r.attrNZ!==null&&e.normals.push(n[r.attrNX],n[r.attrNY],n[r.attrNZ]),r.attrS!==null&&r.attrT!==null&&e.uvs.push(n[r.attrS],n[r.attrT]),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(Ss.setRGB(n[r.attrR]/255,n[r.attrG]/255,n[r.attrB]/255),e.colors.push(Ss.r,Ss.g,Ss.b));for(let t of Object.keys(i.customPropertyMapping))for(let r of i.customPropertyMapping[t].itemNames)e[t].push(n[r])}else if(t===`face`){let t=n.vertex_indices||n.vertex_index,i=n.texcoord;t.length===3?(e.indices.push(t[0],t[1],t[2]),i&&i.length===6&&(e.faceVertexUvs.push(i[0],i[1]),e.faceVertexUvs.push(i[2],i[3]),e.faceVertexUvs.push(i[4],i[5]))):t.length===4&&(e.indices.push(t[0],t[1],t[3]),e.indices.push(t[1],t[2],t[3])),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(Ss.setRGB(n[r.attrR]/255,n[r.attrG]/255,n[r.attrB]/255),e.faceVertexColors.push(Ss.r,Ss.g,Ss.b),e.faceVertexColors.push(Ss.r,Ss.g,Ss.b),e.faceVertexColors.push(Ss.r,Ss.g,Ss.b))}}function Ps(e,t){let n={},r=0;for(let i=0;i<t.length;i++){let a=t[i],o=a.valueReader;if(a.type===`list`){let t=[],i=a.countReader.read(e+r);r+=a.countReader.size;for(let n=0;n<i;n++)t.push(o.read(e+r)),r+=o.size;n[a.name]=t}else n[a.name]=o.read(e+r),r+=o.size}return[n,r]}function Fs(e,t,n){function r(e,t,n){switch(t){case`int8`:case`char`:return{read:t=>e.getInt8(t),size:1};case`uint8`:case`uchar`:return{read:t=>e.getUint8(t),size:1};case`int16`:case`short`:return{read:t=>e.getInt16(t,n),size:2};case`uint16`:case`ushort`:return{read:t=>e.getUint16(t,n),size:2};case`int32`:case`int`:return{read:t=>e.getInt32(t,n),size:4};case`uint32`:case`uint`:return{read:t=>e.getUint32(t,n),size:4};case`float32`:case`float`:return{read:t=>e.getFloat32(t,n),size:4};case`float64`:case`double`:return{read:t=>e.getFloat64(t,n),size:8};default:throw Error(`not support type: `+t)}}for(let i=0,a=e.length;i<a;i++){let a=e[i];a.type===`list`?(a.countReader=r(t,a.countType,n),a.valueReader=r(t,a.itemType,n)):a.valueReader=r(t,a.type,n)}}function Is(e,t,n){let r=ks(n),i=t.format===`binary_little_endian`,a=new DataView(e,t.headerLength),o,s=0;for(let e=0;e<t.elements.length;e++){let c=t.elements[e],l=c.properties,u=As(l);Fs(l,a,i);for(let e=0;e<c.count;e++){o=Ps(s,l),s+=o[1];let e=o[0];Ns(r,c.name,e,u,n)}}return Ms(r,n)}function Ls(e){let t=0,n=!0,r=``,i=[],a=new TextDecoder().decode(e.subarray(0,5)),o=/^ply\r\n/.test(a);do{let a=String.fromCharCode(e[t++]);a!==`
831
+ `&&a!==`\r`?r+=a:(r===`end_header`&&(n=!1),r!==``&&(i.push(r),r=``))}while(n&&t<e.length);return o===!0&&t++,{headerText:i.join(`\r`)+`\r`,headerLength:t}}var Rs=class{constructor(e){this.arr=e,this.i=0}empty(){return this.i>=this.arr.length}next(){return this.arr[this.i++]}},zs=Uint8Array,Bs=Uint16Array,Vs=Int32Array,Hs=new zs([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Us=new zs([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ws=new zs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Gs=function(e,t){for(var n=new Bs(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new Vs(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},Ks=Gs(Hs,2),qs=Ks.b,Js=Ks.r;qs[28]=258,Js[258]=28;var Ys=Gs(Us,0),Xs=Ys.b;Ys.r;for(var Zs=new Bs(32768),Qs=0;Qs<32768;++Qs){var $s=(Qs&43690)>>1|(Qs&21845)<<1;$s=($s&52428)>>2|($s&13107)<<2,$s=($s&61680)>>4|($s&3855)<<4,Zs[Qs]=(($s&65280)>>8|($s&255)<<8)>>1}for(var ec=(function(e,t,n){for(var r=e.length,i=0,a=new Bs(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new Bs(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new Bs(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[Zs[d]>>c]=l}else for(s=new Bs(r),i=0;i<r;++i)e[i]&&(s[i]=Zs[o[e[i]-1]++]>>15-e[i]);return s}),tc=new zs(288),Qs=0;Qs<144;++Qs)tc[Qs]=8;for(var Qs=144;Qs<256;++Qs)tc[Qs]=9;for(var Qs=256;Qs<280;++Qs)tc[Qs]=7;for(var Qs=280;Qs<288;++Qs)tc[Qs]=8;for(var nc=new zs(32),Qs=0;Qs<32;++Qs)nc[Qs]=5;var rc=ec(tc,9,1),ic=ec(nc,5,1),ac=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},oc=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},sc=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},cc=function(e){return(e+7)/8|0},lc=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new zs(e.subarray(t,n))},uc=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],dc=function(e,t,n){var r=Error(t||uc[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,dc),!n)throw r;return r},fc=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new zs(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new zs(i*3));var l=function(e){var t=n.length;if(e>t){var r=new zs(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=oc(e,d,1);var v=oc(e,d+1,3);if(d+=3,!v){var y=cc(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&dc(0);break}s&&l(f+b),n.set(e.subarray(y,x),f),t.b=f+=b,t.p=d=x*8,t.f=u;continue}else if(v==1)p=rc,m=ic,h=9,g=5;else if(v==2){var S=oc(e,d,31)+257,C=oc(e,d+10,15)+4,w=S+oc(e,d+5,31)+1;d+=14;for(var T=new zs(w),E=new zs(19),D=0;D<C;++D)E[Ws[D]]=oc(e,d+D*3,7);d+=C*3;for(var O=ac(E),k=(1<<O)-1,A=ec(E,O,1),D=0;D<w;){var j=A[oc(e,d,k)];d+=j&15;var y=j>>4;if(y<16)T[D++]=y;else{var M=0,N=0;for(y==16?(N=3+oc(e,d,3),d+=2,M=T[D-1]):y==17?(N=3+oc(e,d,7),d+=3):y==18&&(N=11+oc(e,d,127),d+=7);N--;)T[D++]=M}}var ee=T.subarray(0,S),P=T.subarray(S);h=ac(ee),g=ac(P),p=ec(ee,h,1),m=ec(P,g,1)}else dc(1);if(d>_){c&&dc(0);break}}s&&l(f+131072);for(var te=(1<<h)-1,ne=(1<<g)-1,re=d;;re=d){var M=p[sc(e,d)&te],ie=M>>4;if(d+=M&15,d>_){c&&dc(0);break}if(M||dc(2),ie<256)n[f++]=ie;else if(ie==256){re=d,p=null;break}else{var ae=ie-254;if(ie>264){var D=ie-257,oe=Hs[D];ae=oc(e,d,(1<<oe)-1)+qs[D],d+=oe}var se=m[sc(e,d)&ne],ce=se>>4;se||dc(3),d+=se&15;var P=Xs[ce];if(ce>3){var oe=Us[ce];P+=sc(e,d)&(1<<oe)-1,d+=oe}if(d>_){c&&dc(0);break}s&&l(f+131072);var F=f+ae;if(f<P){var le=a-P,ue=Math.min(P,F);for(le+f<0&&dc(3);f<ue;++f)n[f]=r[le+f]}for(;f<F;++f)n[f]=n[f-P]}}t.l=p,t.p=re,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?lc(n,0,f):n.subarray(0,f)},pc=new zs(0),mc=function(e,t){return e[t]|e[t+1]<<8},hc=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},gc=function(e,t){return hc(e,t)+hc(e,t+4)*4294967296},_c=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&dc(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&dc(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function vc(e,t){return fc(e,{i:2},t&&t.out,t&&t.dictionary)}function yc(e,t){return fc(e.subarray(_c(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var bc=typeof TextDecoder<`u`&&new TextDecoder;try{bc.decode(pc,{stream:!0})}catch(e){}var xc=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:lc(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function Sc(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}else if(bc)return bc.decode(e);else{var i=xc(e),a=i.s,n=i.r;return n.length&&dc(8),a}}var Cc=function(e,t){return t+30+mc(e,t+26)+mc(e,t+28)},wc=function(e,t,n){var r=mc(e,t+28),i=Sc(e.subarray(t+46,t+46+r),!(mc(e,t+8)&2048)),a=t+46+r,o=hc(e,t+20),s=n&&o==4294967295?Tc(e,a):[o,hc(e,t+24),hc(e,t+42)],c=s[0],l=s[1],u=s[2];return[mc(e,t+10),c,l,i,a+mc(e,t+30)+mc(e,t+32),u]},Tc=function(e,t){for(;mc(e,t)!=1;t+=4+mc(e,t+2));return[gc(e,t+12),gc(e,t+4),gc(e,t+20)]};function Ec(e,t){for(var n={},r=e.length-22;hc(e,r)!=101010256;--r)(!r||e.length-r>65558)&&dc(13);var i=mc(e,r+8);if(!i)return{};var a=hc(e,r+16),o=a==4294967295||i==65535;if(o){var s=hc(e,r-12);o=hc(e,s)==101075792,o&&(i=hc(e,s+32),a=hc(e,s+48))}for(var c=t&&t.filter,l=0;l<i;++l){var u=wc(e,a,o),d=u[0],f=u[1],p=u[2],m=u[3],h=u[4],g=u[5],_=Cc(e,g);a=h,(!c||c({name:m,size:f,originalSize:p,compression:d}))&&(d?d==8?n[m]=vc(e.subarray(_,_+f),{out:new zs(p)}):dc(14,`unknown compression type `+d):n[m]=lc(e,_,_+f))}return n}function Dc(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?_r:r,s=(i=t.onDownloadProgress)==null?K:i,l=0;return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s).then(e=>(l=e.body.byteLength,e.body))).then(n=>{var r;return Oc(n,{light:t.light,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(r=e.split(`?`)[1])==null?``:r,fetcher:o})}).then(t=>{let n=t.scene,r=t.unitScale/100,i=new c.Matrix4;if(i.makeScale(r,r,r),t.upAxis===`X`)throw Error(`Cannot load fbx x upAxis`);return t.upAxis===`Y`&&i.premultiply(er),a===`Y`&&i.premultiply(tr),n.applyMatrix4(i),{type:`fbx`,modelUpAxis:t.upAxis,upAxis:a,uri:e,byteLength:l,memoryUsage:Pi(n),scene:n,textures:t.textures,animations:t.animations,dispose:()=>t.dispose()}})}function Oc(e,t){let n;if(Ic(e))n=new Nc().parse(e);else{let t=qc(e);if(!Lc(t))throw Error(`THREE.FBXLoader: Unknown format.`);if(Rc(t)<7e3)throw Error(`THREE.FBXLoader: FBX version not supported, FileVersion: `+Rc(t));n=new Mc().parse(t)}return new kc(t).parse(n)}var kc=class{constructor(e){var t,n,r;this.light=(t=e.light)==null?!0:t,this.resourcePath=(n=e.resourcePath)==null?``:n,this.search=(r=e.search)==null?``:r,this.fetcher=e.fetcher}parse(e){var t,n,r,i,a,o;let s=this.parseConnections(e),l=Object.assign(new c.Group,{animations:[]}),u=[],d=this.parseImages(e),f=this.parseTextures(e,d,s,u),p=this.parseMaterials(e,f,s),m=this.parseDeformers(e,s),h=new Ac().parse(e,m,s);this.parseScene(e,m,h,p,s,l);let g=(n=(t=e.GlobalSettings.UpAxis)==null?void 0:t.value)==null?1:n,_=(i=(r=e.GlobalSettings.FrontAxis)==null?void 0:r.value)==null?2:i,v=(o=(a=e.GlobalSettings.UnitScaleFactor)==null?void 0:a.value)==null?1:o,y;if(e.GlobalSettings.AmbientColor){let t=e.GlobalSettings.AmbientColor.value,n=t[0],r=t[1],i=t[2];if(n!==0||r!==0||i!==0){let e=new c.Color().setRGB(n,r,i);y=new c.AmbientLight(e,1)}}return Promise.all(u).then(e=>{var t;return{scene:l,textures:e,ambientLight:y,upAxis:[`X`,`Y`,`Z`][g],frontAxis:[`X`,`Y`,`Z`][_],unitScale:v,animations:(t=l.animations)==null?[]:t,dispose:()=>{e.forEach(e=>e.dispose()),p.forEach(e=>e.dispose()),h.forEach(e=>e.dispose())}}})}parseConnections(e){let t=new Map;return`Connections`in e&&e.Connections.connections.forEach(function(e){let n=e[0],r=e[1],i=e[2];t.has(n)||t.set(n,{parents:[],children:[]});let a={ID:r,relationship:i};t.get(n).parents.push(a),t.has(r)||t.set(r,{parents:[],children:[]});let o={ID:n,relationship:i};t.get(r).children.push(o)}),t}parseImages(e){let t={},n={};if(`Video`in e.Objects){let r=e.Objects.Video;for(let e in r){let i=r[e],a=parseInt(e);if(t[a]=i.RelativeFilename||i.Filename,`Content`in i){let t=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,a=typeof i.Content==`string`&&i.Content!==``;if(t||a){let t=this.parseImage(r[e]);n[i.RelativeFilename||i.Filename]=t}}}}for(let e in t){let r=t[e];n[r]===void 0?t[e]=t[e].split(`\\`).pop():t[e]=n[r]}return t}parseImage(e){let t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(`.`)+1).toLowerCase(),i;switch(r){case`bmp`:i=`image/bmp`;break;case`jpg`:case`jpeg`:i=`image/jpeg`;break;case`png`:i=`image/png`;break;case`tif`:i=`image/tiff`;break;case`tga`:i=`image/tga`;break;default:return}if(typeof t==`string`)return`data:`+i+`;base64,`+t;{let e=new Uint8Array(t);return window.URL.createObjectURL(new Blob([e],{type:i}))}}parseTextures(e,t,n,r){let i=new Map;if(`Texture`in e.Objects){let a=e.Objects.Texture;for(let e in a){let o=this.parseTexture(a[e],t,n,r);i.set(parseInt(e),o)}}return i}parseTexture(e,t,n,r){let i=this.loadTexture(e,t,n,r);i.ID=e.id,i.name=e.attrName;let a=e.WrapModeU,o=e.WrapModeV,s=a===void 0?0:a.value,l=o===void 0?0:o.value;if(i.wrapS=s===0?c.RepeatWrapping:c.ClampToEdgeWrapping,i.wrapT=l===0?c.RepeatWrapping:c.ClampToEdgeWrapping,e.Scaling){let t=e.Scaling.value;i.repeat.x=t[0],i.repeat.y=t[1]}if(e.Translation){let t=e.Translation.value;i.offset.x=t[0],i.offset.y=t[1]}return i}loadTexture(e,t,n,r){let i=n.get(e.id).children,a=``;i!==void 0&&i.length>0&&t[i[0].ID]!==void 0&&(a=t[i[0].ID]),a=wr(this.resourcePath,Tr(a,this.search));let o=Object.assign(new c.Texture,{ID:0}),s;s=di()?this.fetcher.ajax(a,{responseType:`blob`}).then(e=>{let t=e.body;return pi(t)}):this.fetcher.loadImage(a,{},void 0,void 0,void 0,fi()).then(e=>e.body);let l=s.then(e=>(o.image=e,o.needsUpdate=!0,o)).catch(e=>(console.warn(e),o));return r.push(l),o}parseMaterials(e,t,n){let r=new Map;if(`Material`in e.Objects){let i=e.Objects.Material;for(let a in i){let o=this.parseMaterial(e,i[a],t,n);o!==null&&r.set(parseInt(a),o)}}return r}parseMaterial(e,t,n,r){let i=t.id,a=t.attrName,o=t.ShadingModel;if(typeof o==`object`&&(o=o.value),o=o.toLowerCase(),!r.has(i))return null;let s=new yn(this.light?`phong`:`basic`);s.name=a,t.BumpFactor&&(s.bumpScale=t.BumpFactor.value),t.Diffuse?s.color=new c.Color().fromArray(t.Diffuse.value):t.DiffuseColor&&(t.DiffuseColor.type===`Color`||t.DiffuseColor.type===`ColorRGB`)&&(s.color=new c.Color().fromArray(t.DiffuseColor.value)),t.DisplacementFactor&&(s.displacementScale=t.DisplacementFactor.value),t.Emissive?s.emissive=new c.Color().fromArray(t.Emissive.value):t.EmissiveColor&&(t.EmissiveColor.type===`Color`||t.EmissiveColor.type===`ColorRGB`)&&(s.emissive=new c.Color().fromArray(t.EmissiveColor.value)),t.EmissiveFactor&&(s.emissiveIntensity=parseFloat(t.EmissiveFactor.value));let l=1-(t.TransparencyFactor?parseFloat(t.TransparencyFactor.value):0);(l===1||l===0)&&(l=t.Opacity?parseFloat(t.Opacity.value):null,l===null&&(l=1-(t.TransparentColor?parseFloat(t.TransparentColor.value[0]):0))),s.opacity=l,s.opacity<1&&(s.transparent=!0),t.ReflectionFactor&&(s.reflectivity=t.ReflectionFactor.value),t.Shininess&&(s.shininess=t.Shininess.value),t.Specular?s.specular=new c.Color().fromArray(t.Specular.value):t.SpecularColor&&t.SpecularColor.type===`Color`&&(s.specular=new c.Color().fromArray(t.SpecularColor.value));let u=this;return r.get(i).children.forEach(function(t){let i=t.relationship;switch(i){case`Bump`:s.bumpMap=u.getTexture(e,n,t.ID,r);break;case`Maya|TEX_ao_map`:s.aoMap=u.getTexture(e,n,t.ID,r);break;case`DiffuseColor`:case`Maya|TEX_color_map`:s.map=u.getTexture(e,n,t.ID,r),s.map!==void 0&&(s.map.encoding=c.sRGBEncoding);break;case`DisplacementColor`:s.displacementMap=u.getTexture(e,n,t.ID,r);break;case`EmissiveColor`:s.emissiveMap=u.getTexture(e,n,t.ID,r),s.emissiveMap!==void 0&&(s.emissiveMap.encoding=c.sRGBEncoding);break;case`NormalMap`:case`Maya|TEX_normal_map`:s.normalMap=u.getTexture(e,n,t.ID,r);break;case`ReflectionColor`:s.envMap=u.getTexture(e,n,t.ID,r),s.envMap!==void 0&&(s.envMap.mapping=c.EquirectangularReflectionMapping,s.envMap.encoding=c.sRGBEncoding);break;case`SpecularColor`:s.specularMap=u.getTexture(e,n,t.ID,r),s.specularMap!==void 0&&(s.specularMap.encoding=c.sRGBEncoding);break;case`TransparentColor`:case`TransparencyFactor`:s.alphaMap=u.getTexture(e,n,t.ID,r),s.transparent=!0;break;default:console.warn(`THREE.FBXLoader: %s map is not supported in three.js, skipping texture.`,i);break}}),s}getTexture(e,t,n,r){return e.Objects.LayeredTexture&&n in e.Objects.LayeredTexture&&(console.warn(`THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer.`),n=r.get(n).children[0].ID),t.get(n)}parseDeformers(e,t){let n={},r={};if(`Deformer`in e.Objects){let i=e.Objects.Deformer;for(let e in i){let a=i[e],o=t.get(parseInt(e));if(a.attrType===`Skin`){let t=this.parseSkeleton(o,i);t.ID=e,o.parents.length>1&&console.warn(`THREE.FBXLoader: skeleton attached to more than one geometry is not supported.`),t.geometryID=o.parents[0].ID,n[e]=t}else if(a.attrType===`BlendShape`){let n={id:e};n.rawTargets=this.parseMorphTargets(o,i,t),n.id=e,o.parents.length>1&&console.warn(`THREE.FBXLoader: morph target attached to more than one geometry is not supported.`),r[e]=n}}}return{skeletons:n,morphTargets:r}}parseSkeleton(e,t){let n=[];return e.children.forEach(function(e){let r=t[e.ID];if(r.attrType!==`Cluster`)return;let i={ID:e.ID,indices:[],weights:[],transformLink:new c.Matrix4().fromArray(r.TransformLink.a)};r.Indexes&&(i.indices=r.Indexes.a,i.weights=r.Weights.a),n.push(i)}),{ID:``,geometryID:0,rawBones:n,bones:[]}}parseMorphTargets(e,t,n){let r=[];for(let i=0;i<e.children.length;i++){let a=e.children[i],o=t[a.ID],s={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a,geoID:0};if(o.attrType!==`BlendShapeChannel`)return;s.geoID=n.get(parseInt(a.ID)).children.filter(function(e){return e.relationship===void 0})[0].ID,r.push(s)}return r}parseScene(e,t,n,r,i,a){let o=this.parseModels(e,t.skeletons,n,r,i),s=e.Objects.Model,l=this;o.forEach(function(t){let n=s[t.ID];l.setLookAtProperties(e,t,n,i,a),i.get(t.ID).parents.forEach(function(e){let n=o.get(e.ID);n!==void 0&&n.add(t)}),t.parent===null&&a.add(t)}),this.bindSkeleton(e,t.skeletons,n,o,i),a.traverse(function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld);let t=Wc(e.userData.transformData);e.applyMatrix4(t),e.updateWorldMatrix(!0,!0)}});let u=new jc().parse(e,i,a);a.children.length===1&&a.children[0]instanceof c.Group&&(a=a.children[0]),a.animations=u}parseModels(e,t,n,r,i){let a=new Map,o=e.Objects.Model;for(let s in o){let l=parseInt(s),u=o[s],d=i.get(l),f=this.buildSkeleton(d,t,l,u.attrName);if(!f){switch(u.attrType){case`Camera`:f=this.createCamera(e,d);break;case`Light`:f=this.createLight(e,d);break;case`Mesh`:f=this.createMesh(d,n,r);break;case`NurbsCurve`:case`LimbNode`:case`Root`:f=new c.Bone;break;default:f=new c.Group;break}f.name=u.attrName?c.PropertyBinding.sanitizeNodeName(u.attrName):``,f.userData.originalName=u.attrName,f.ID=l}this.getTransformData(f,u),a.set(l,f)}return a}buildSkeleton(e,t,n,r){let i=null;return e.parents.forEach(function(e){for(let a in t){let o=t[a];o.rawBones.forEach(function(t,a){if(t.ID===e.ID){let e=i;i=new c.Bone,i.matrixWorld.copy(t.transformLink),i.name=r?c.PropertyBinding.sanitizeNodeName(r):``,i.userData.originalName=r,i.ID=n,o.bones[a]=i,e!==null&&i.add(e)}})}}),i}createCamera(e,t){let n,r;if(t.children.forEach(function(t){let n=e.Objects.NodeAttribute[t.ID];n!==void 0&&(r=n)}),r===void 0)n=new c.Object3D;else{let e=0;r.CameraProjectionType!==void 0&&r.CameraProjectionType.value===1&&(e=1);let t=1;r.NearPlane!==void 0&&(t=r.NearPlane.value/1e3);let i=1e3;r.FarPlane!==void 0&&(i=r.FarPlane.value/1e3);let a=window.innerWidth,o=window.innerHeight;r.AspectWidth!==void 0&&r.AspectHeight!==void 0&&(a=r.AspectWidth.value,o=r.AspectHeight.value);let s=a/o,l=45;r.FieldOfView!==void 0&&(l=r.FieldOfView.value);let u=r.FocalLength?r.FocalLength.value:null;switch(e){case 0:n=new c.PerspectiveCamera(l,s,t,i),u!==null&&n.setFocalLength(u);break;case 1:console.warn(`THREE.FBXLoader: Orthographic cameras not supported yet.`),n=new c.Object3D;break;default:console.warn(`THREE.FBXLoader: Unknown camera type `+e+`.`),n=new c.Object3D;break}}return n}createLight(e,t){let n,r;if(t.children.forEach(function(t){let n=e.Objects.NodeAttribute[t.ID];n!==void 0&&(r=n)}),r===void 0)n=new c.Object3D;else{let e;e=r.LightType===void 0?0:r.LightType.value;let t=new c.Color(16777215);r.Color!==void 0&&(t=new c.Color().fromArray(r.Color.value));let i=r.Intensity===void 0?1:r.Intensity.value/100;r.CastLightOnObject!==void 0&&r.CastLightOnObject.value===0&&(i=0);let a=0;switch(r.FarAttenuationEnd!==void 0&&(a=r.EnableFarAttenuation!==void 0&&r.EnableFarAttenuation.value===0?0:r.FarAttenuationEnd.value),e){case 0:n=new c.PointLight(t,i,a,1);break;case 1:n=new c.DirectionalLight(t,i);break;case 2:let e=Math.PI/3;r.InnerAngle!==void 0&&(e=c.MathUtils.degToRad(r.InnerAngle.value));let o=0;r.OuterAngle!==void 0&&(o=c.MathUtils.degToRad(r.OuterAngle.value),o=Math.max(o,1)),n=new c.SpotLight(t,i,a,e,o,1);break;default:console.warn(`THREE.FBXLoader: Unknown light type `+r.LightType.value+`, defaulting to a PointLight.`),n=new c.PointLight(t,i);break}r.CastShadows!==void 0&&r.CastShadows.value===1&&(n.castShadow=!0)}return n}createMesh(e,t,n){let r,i=null,a=[];if(e.children.forEach(function(e){t.has(e.ID)&&(i=t.get(e.ID)),n.has(e.ID)&&a.push(n.get(e.ID))}),a.length===0){let e=new yn(this.light?`phong`:`basic`);e.color=new c.Color(13421772),a.push(e)}return`color`in i.attributes&&a.forEach(function(e){e.vertexColors=!0}),(!i.groups||i.groups.length===0)&&i.addGroup(0,i.index?i.index.count:i.attributes.position.count,0),i.FBX_Deformer?(a.forEach(function(e){e.skinning=!0}),r=new xn(i,a),r.normalizeSkinWeights()):r=new bn(i,a),r}createCurve(e,t){let n=e.children.reduce(function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e},null),r=new c.LineBasicMaterial({name:``,color:3342591,linewidth:1});return new c.Line(n,r)}getTransformData(e,t){let n={};t.InheritType&&(n.inheritType=parseInt(t.InheritType.value)),t.RotationOrder?n.eulerOrder=Gc(t.RotationOrder.value):n.eulerOrder=Gc(0),t.Lcl_Translation&&(n.translation=t.Lcl_Translation.value),t.PreRotation&&(n.preRotation=t.PreRotation.value),t.Lcl_Rotation&&(n.rotation=t.Lcl_Rotation.value),t.PostRotation&&(n.postRotation=t.PostRotation.value),t.Lcl_Scaling&&(n.scale=t.Lcl_Scaling.value),t.ScalingOffset&&(n.scalingOffset=t.ScalingOffset.value),t.ScalingPivot&&(n.scalingPivot=t.ScalingPivot.value),t.RotationOffset&&(n.rotationOffset=t.RotationOffset.value),t.RotationPivot&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t,n,r,i){`LookAtProperty`in n&&r.get(t.ID).children.forEach(function(n){if(n.relationship===`LookAtProperty`){let r=e.Objects.Model[n.ID];if(r.Lcl_Translation){let e=r.Lcl_Translation.value;`target`in t&&t.target instanceof c.Object3D?(t.target.position.fromArray(e),i.add(t.target)):t.lookAt(new c.Vector3().fromArray(e))}}})}bindSkeleton(e,t,n,r,i){let a=this.parsePoseNodes(e);for(let e in t){let o=t[e];i.get(parseInt(o.ID)).parents.forEach(function(e){if(n.has(e.ID)){let t=e.ID;i.get(t).parents.forEach(function(e){if(r.has(e.ID)){let t=r.get(e.ID);t instanceof c.SkinnedMesh&&t.bind(new c.Skeleton(o.bones),a[e.ID])}})}})}}parsePoseNodes(e){let t={};if(e.Objects.Pose){let n=e.Objects.Pose;for(let e in n)if(n[e].attrType===`BindPose`&&n[e].NbPoseNodes>0){let r=n[e].PoseNode;Array.isArray(r)?r.forEach(function(e){t[e.Node]=new c.Matrix4().fromArray(e.Matrix.a)}):t[r.Node]=new c.Matrix4().fromArray(r.Matrix.a)}}return t}},Ac=class{constructor(){this.negativeMaterialIndices=!1}parse(e,t,n){let r=new Map;if(`Geometry`in e.Objects){let i=e.Objects.Geometry;for(let a in i){let o=n.get(parseInt(a)),s=this.parseGeometry(e,o,i[a],t);r.set(parseInt(a),s)}}return this.negativeMaterialIndices===!0&&console.warn(`THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected.`),r}parseGeometry(e,t,n,r){switch(n.attrType){case`Mesh`:return this.parseMeshGeometry(e,t,n,r);case`NurbsCurve`:return this.parseNurbsGeometry(n)}}parseMeshGeometry(e,t,n,r){let i=r.skeletons,a=[],o=t.parents.map(function(t){return e.Objects.Model[t.ID]});if(o.length===0)return;let s=t.children.reduce(function(e,t){return i[t.ID]!==void 0&&(e=i[t.ID]),e},null);t.children.forEach(function(e){r.morphTargets[e.ID]!==void 0&&a.push(r.morphTargets[e.ID])});let c=o[0],l={};c.RotationOrder&&(l.eulerOrder=Gc(c.RotationOrder.value)),c.InheritType&&(l.inheritType=parseInt(c.InheritType.value)),c.GeometricTranslation&&(l.translation=c.GeometricTranslation.value),c.GeometricRotation&&(l.rotation=c.GeometricRotation.value),c.GeometricScaling&&(l.scale=c.GeometricScaling.value);let u=Wc(l);return this.genGeometry(e,n,s,a,u)}genGeometry(e,t,n,r,i){let a=new c.BufferGeometry;t.attrName&&(a.name=t.attrName);let o=this.parseGeoNode(t,n),s=this.genBuffers(o),l=new c.Float32BufferAttribute(s.vertex,3);if(l.applyMatrix4(i),a.setAttribute(`position`,l),s.colors.length>0&&a.setAttribute(`color`,new c.Float32BufferAttribute(s.colors,3)),n&&(a.setAttribute(`skinIndex`,new c.Uint16BufferAttribute(s.weightsIndices,4)),a.setAttribute(`skinWeight`,new c.Float32BufferAttribute(s.vertexWeights,4)),a.FBX_Deformer=n),s.normal.length>0){let e=new c.Matrix3().getNormalMatrix(i),t=new c.Float32BufferAttribute(s.normal,3);t.applyNormalMatrix(e),a.setAttribute(`normal`,t)}if(s.uvs.forEach(function(e,t){let n=t===0?`uv`:`uv${t+1}`;a.setAttribute(n,new c.Float32BufferAttribute(s.uvs[t],2))}),o.material&&o.material.mappingType!==`AllSame`){let e=s.materialIndex[0],t=0;if(s.materialIndex.forEach(function(n,r){n!==e&&(a.addGroup(t,r-t,e),e=n,t=r)}),a.groups.length>0){let t=a.groups[a.groups.length-1],n=t.start+t.count;n!==s.materialIndex.length&&a.addGroup(n,s.materialIndex.length-n,e)}a.groups.length===0&&a.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(e,a,t,r,i),a}parseGeoNode(e,t){let n={};if(n.vertexPositions=e.Vertices===void 0?[]:e.Vertices.a,n.vertexIndices=e.PolygonVertexIndex===void 0?[]:e.PolygonVertexIndex.a,e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let t=0;for(;e.LayerElementUV[t];)e.LayerElementUV[t].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[t])),t++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(e,t){e.indices.forEach(function(r,i){n.weightTable[r]===void 0&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})})})),n}genBuffers(e){let t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,i=!1,a=[],o=[],s=[],c=[],l=[],u=[],d=this;return e.vertexIndices.forEach(function(f,p){let m=0,h=!1;f<0&&(f^=-1,h=!0);let g=[],_=[];if(a.push(f*3,f*3+1,f*3+2),e.color){let t=Vc(p,n,f,e.color);s.push(t[0],t[1],t[2])}if(e.skeleton){if(e.weightTable[f]!==void 0&&e.weightTable[f].forEach(function(e){_.push(e.weight),g.push(e.id)}),_.length>4){i||(console.warn(`THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights.`),i=!0);let e=[0,0,0,0],t=[0,0,0,0];_.forEach(function(n,r){let i=n,a=g[r];t.forEach(function(t,n,r){if(i>t){r[n]=i,i=t;let o=e[n];e[n]=a,a=o}})}),g=e,_=t}for(;_.length<4;)_.push(0),g.push(0);for(let e=0;e<4;++e)l.push(_[e]),u.push(g[e])}if(e.normal){let t=Vc(p,n,f,e.normal);o.push(t[0],t[1],t[2])}e.material&&e.material.mappingType!==`AllSame`&&(m=Vc(p,n,f,e.material)[0],m<0&&(d.negativeMaterialIndices=!0,m=0)),e.uv&&e.uv.forEach(function(e,t){let r=Vc(p,n,f,e);c[t]===void 0&&(c[t]=[]),c[t].push(r[0]),c[t].push(r[1])}),r++,h&&(d.genFace(t,e,a,m,o,s,c,l,u,r),n++,r=0,a=[],o=[],s=[],c=[],l=[],u=[])}),t}getNormalNewell(e){let t=new c.Vector3(0,0,0);for(let n=0;n<e.length;n++){let r=e[n],i=e[(n+1)%e.length];t.x+=(r.y-i.y)*(r.z+i.z),t.y+=(r.z-i.z)*(r.x+i.x),t.z+=(r.x-i.x)*(r.y+i.y)}return t.normalize(),t}getNormalTangentAndBitangent(e){let t=this.getNormalNewell(e),n=(Math.abs(t.z)>.5?new c.Vector3(0,1,0):new c.Vector3(0,0,1)).cross(t).normalize();return{normal:t,tangent:n,bitangent:t.clone().cross(n).normalize()}}flattenVertex(e,t,n){return new c.Vector2(e.dot(t),e.dot(n))}genFace(e,t,n,r,i,a,o,s,l,u){let d;if(u>3){let e=[],r=t.baseVertexPositions||t.vertexPositions;for(let t=0;t<n.length;t+=3)e.push(new c.Vector3(r[n[t]],r[n[t+1]],r[n[t+2]]));let{tangent:i,bitangent:a}=this.getNormalTangentAndBitangent(e),o=[];for(let t of e)o.push(this.flattenVertex(t,i,a));d=c.ShapeUtils.triangulateShape(o,[])}else d=[[0,1,2]];for(let[c,u,f]of d)e.vertex.push(t.vertexPositions[n[c*3]]),e.vertex.push(t.vertexPositions[n[c*3+1]]),e.vertex.push(t.vertexPositions[n[c*3+2]]),e.vertex.push(t.vertexPositions[n[u*3]]),e.vertex.push(t.vertexPositions[n[u*3+1]]),e.vertex.push(t.vertexPositions[n[u*3+2]]),e.vertex.push(t.vertexPositions[n[f*3]]),e.vertex.push(t.vertexPositions[n[f*3+1]]),e.vertex.push(t.vertexPositions[n[f*3+2]]),t.skeleton&&(e.vertexWeights.push(s[c*4]),e.vertexWeights.push(s[c*4+1]),e.vertexWeights.push(s[c*4+2]),e.vertexWeights.push(s[c*4+3]),e.vertexWeights.push(s[u*4]),e.vertexWeights.push(s[u*4+1]),e.vertexWeights.push(s[u*4+2]),e.vertexWeights.push(s[u*4+3]),e.vertexWeights.push(s[f*4]),e.vertexWeights.push(s[f*4+1]),e.vertexWeights.push(s[f*4+2]),e.vertexWeights.push(s[f*4+3]),e.weightsIndices.push(l[c*4]),e.weightsIndices.push(l[c*4+1]),e.weightsIndices.push(l[c*4+2]),e.weightsIndices.push(l[c*4+3]),e.weightsIndices.push(l[u*4]),e.weightsIndices.push(l[u*4+1]),e.weightsIndices.push(l[u*4+2]),e.weightsIndices.push(l[u*4+3]),e.weightsIndices.push(l[f*4]),e.weightsIndices.push(l[f*4+1]),e.weightsIndices.push(l[f*4+2]),e.weightsIndices.push(l[f*4+3])),t.color&&(e.colors.push(a[c*3]),e.colors.push(a[c*3+1]),e.colors.push(a[c*3+2]),e.colors.push(a[u*3]),e.colors.push(a[u*3+1]),e.colors.push(a[u*3+2]),e.colors.push(a[f*3]),e.colors.push(a[f*3+1]),e.colors.push(a[f*3+2])),t.material&&t.material.mappingType!==`AllSame`&&(e.materialIndex.push(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(i[c*3]),e.normal.push(i[c*3+1]),e.normal.push(i[c*3+2]),e.normal.push(i[u*3]),e.normal.push(i[u*3+1]),e.normal.push(i[u*3+2]),e.normal.push(i[f*3]),e.normal.push(i[f*3+1]),e.normal.push(i[f*3+2])),t.uv&&t.uv.forEach(function(t,n){e.uvs[n]===void 0&&(e.uvs[n]=[]),e.uvs[n].push(o[n][c*2]),e.uvs[n].push(o[n][c*2+1]),e.uvs[n].push(o[n][u*2]),e.uvs[n].push(o[n][u*2+1]),e.uvs[n].push(o[n][f*2]),e.uvs[n].push(o[n][f*2+1])})}addMorphTargets(e,t,n,r,i){if(r.length===0)return;t.morphTargetsRelative=!0,t.morphAttributes.position=[];let a=this;r.forEach(function(r){r.rawTargets.forEach(function(r){let o=e.Objects.Geometry[r.geoID];o!==void 0&&a.genMorphGeometry(t,n,o,i,r.name)})})}genMorphGeometry(e,t,n,r,i){let a=t.Vertices===void 0?[]:t.Vertices.a,o=t.PolygonVertexIndex===void 0?[]:t.PolygonVertexIndex.a,s=n.Vertices===void 0?[]:n.Vertices.a,l=n.Indexes?n.Indexes.a:[],u=e.attributes.position.count*3,d=new Float32Array(u);for(let e=0;e<l.length;e++){let t=l[e]*3;d[t]=s[e*3],d[t+1]=s[e*3+1],d[t+2]=s[e*3+2]}let f={vertexIndices:o,vertexPositions:d,baseVertexPositions:a},p=this.genBuffers(f),m=new c.Float32BufferAttribute(p.vertex,3);m.name=i||n.attrName,m.applyMatrix4(r),e.morphAttributes.position.push(m)}parseNormals(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a,i=[];return n===`IndexToDirect`&&(e.NormalIndex?i=e.NormalIndex.a:e.NormalsIndex&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:t,referenceType:n}}parseUVs(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.UV.a,i=[];return n===`IndexToDirect`&&(i=e.UVIndex.a),{dataSize:2,buffer:r,indices:i,mappingType:t,referenceType:n}}parseVertexColors(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Colors.a,i=[];n===`IndexToDirect`&&(i=e.ColorIndex.a);for(let e=0,t=new c.Color;e<r.length;e+=4)t.fromArray(r,e),t.toArray(r,e);return{dataSize:4,buffer:r,indices:i,mappingType:t,referenceType:n}}parseMaterialIndices(e){let t=e.MappingInformationType,n=e.ReferenceInformationType;if(t===`NoMappingInformation`)return{dataSize:1,buffer:[0],indices:[0],mappingType:`AllSame`,referenceType:n};let r=e.Materials.a,i=[];for(let e=0;e<r.length;++e)i.push(e);return{dataSize:1,buffer:r,indices:i,mappingType:t,referenceType:n}}parseNurbsGeometry(e){let t=parseInt(e.Order);if(isNaN(t))return console.error(`THREE.FBXLoader: Invalid Order %s given for geometry ID: %s`,e.Order,e.id),new c.BufferGeometry;let n=t-1,r=e.KnotVector.a,i=[],a=e.Points.a;for(let e=0,t=a.length;e<t;e+=4)i.push(new c.Vector4().fromArray(a,e));let o,s;if(e.Form===`Closed`)i.push(i[0]);else if(e.Form===`Periodic`){o=n,s=r.length-1-o;for(let e=0;e<n;++e)i.push(i[e])}let l=new Xc(n,r,i,o,s).getPoints(i.length*12);return new c.BufferGeometry().setFromPoints(l)}},jc=class{parse(e,t,n){let r=[],i=this.parseClips(e,t,n);if(i!==void 0)for(let e in i){let t=i[e],a=this.addClip(t,n);r.push(a)}return r}parseClips(e,t,n){if(e.Objects.AnimationCurve===void 0)return;let r=this.parseAnimationCurveNodes(e);this.parseAnimationCurves(e,r,t);let i=this.parseAnimationLayers(e,r,t,n);return this.parseAnimStacks(e,i,t)}parseAnimationCurveNodes(e){let t=e.Objects.AnimationCurveNode,n=new Map;for(let e in t){let r=t[e];if(r.attrName.match(/S|R|T|DeformPercent/)!==null){let e={id:r.id,attr:r.attrName,curves:{}};n.set(e.id,e)}}return n}parseAnimationCurves(e,t,n){let r=e.Objects.AnimationCurve;for(let e in r){let i={id:r[e].id,times:r[e].KeyTime.a.map(zc),values:r[e].KeyValueFloat.a},a=n.get(i.id);if(a!==void 0){let e=a.parents[0].ID,n=a.parents[0].relationship,r=t.get(e);r&&(n.match(/X/)?r.curves.x=i:n.match(/Y/)?r.curves.y=i:n.match(/Z/)?r.curves.z=i:n.match(/DeformPercent/)&&t.has(e)&&(r.curves.morph=i))}}}parseAnimationLayers(e,t,n,r){let i=e.Objects.AnimationLayer,a=new Map;for(let o in i){let i=[],s=n.get(parseInt(o));s!==void 0&&(s.children.forEach((a,o)=>{if(t.has(a.ID)){let s=t.get(a.ID);if(s.curves.x!==void 0||s.curves.y!==void 0||s.curves.z!==void 0){if(i[o]===void 0){let t=n.get(a.ID).parents.filter(function(e){return e.relationship!==void 0})[0].ID;if(t!==void 0){let n=e.Objects.Model[t.toString()];if(n===void 0){console.warn(`THREE.FBXLoader: Encountered a unused curve.`,a);return}let s={modelName:n.attrName?c.PropertyBinding.sanitizeNodeName(n.attrName):``,ID:n.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1],transform:new c.Matrix4,eulerOrder:``,preRotation:[0,0,0],postRotation:[0,0,0]};r.traverse(function(e){e.ID===n.id&&(s.transform=e.matrix,e.userData.transformData&&(s.eulerOrder=e.userData.transformData.eulerOrder))}),s.transform||(s.transform=new c.Matrix4),n.PreRotation&&(s.preRotation=n.PreRotation.value),n.PostRotation&&(s.postRotation=n.PostRotation.value),i[o]=s}}i[o]&&(i[o][s.attr]=s)}else if(s.curves.morph!==void 0){if(i[o]===void 0){let t=n.get(a.ID).parents.filter(function(e){return e.relationship!==void 0})[0].ID,r=n.get(t).parents[0].ID,s=n.get(r).parents[0].ID,l=n.get(s).parents[0].ID,u=e.Objects.Model[l];i[o]={modelName:u.attrName?c.PropertyBinding.sanitizeNodeName(u.attrName):``,morphName:e.Objects.Deformer[t].attrName}}i[o][s.attr]=s}}}),a.set(parseInt(o),i))}return a}parseAnimStacks(e,t,n){let r=e.Objects.AnimationStack,i={};for(let e in r){let a=n.get(parseInt(e)).children;a.length>1&&console.warn(`THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.`);let o=t.get(a[0].ID);i[e]={name:r[e].attrName,layer:o}}return i}addClip(e,t){let n=[],r=this;return e.layer.forEach(function(e){n=n.concat(r.generateTracks(e,t))}),new c.AnimationClip(e.name,-1,n)}generateTracks(e,t){let n=[],r=new c.Vector3,i=new c.Vector3;e.transform&&e.transform.decompose(r,new c.Quaternion,i);let a=r.toArray(),o=i.toArray();if(e.T!==void 0&&Object.keys(e.T.curves).length>0){let t=this.generateVectorTrack(e.modelName,e.T.curves,a,`position`);t!==void 0&&n.push(t)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){let t=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);t!==void 0&&n.push(t)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){let t=this.generateVectorTrack(e.modelName,e.S.curves,o,`scale`);t!==void 0&&n.push(t)}if(e.DeformPercent!==void 0){let r=this.generateMorphTrack(e,t);r!==void 0&&n.push(r)}return n}generateVectorTrack(e,t,n,r){let i=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(i,t,n);return new c.VectorKeyframeTrack(e+`.`+r,i,a)}generateRotationTrack(e,t,n,r,i){let a,o;if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){let e=this.interpolateRotations(t.x,t.y,t.z,i);a=e[0],o=e[1]}let s=Gc(0),l=new c.Quaternion,u=new c.Quaternion;n!==void 0&&(n=n.map(c.MathUtils.degToRad),n.push(s),l.setFromEuler(new c.Euler().fromArray(n))),r!==void 0&&(r=r.map(c.MathUtils.degToRad),r.push(s),u.setFromEuler(new c.Euler().fromArray(r)),u.inverse());let d=new c.Quaternion,f=new c.Euler,p=[];if(!o||!a)return new c.QuaternionKeyframeTrack(e+`.quaternion`,[0],[0]);for(let e=0;e<o.length;e+=3)f.set(o[e],o[e+1],o[e+2],i),d.setFromEuler(f),d.premultiply(l),d.multiply(u),e>2&&new c.Quaternion().fromArray(p,(e-3)/3*4).dot(d)<0&&d.set(-d.x,-d.y,-d.z,-d.w),d.toArray(p,e/3*4);return new c.QuaternionKeyframeTrack(e+`.quaternion`,a,p)}generateMorphTrack(e,t){let n=e.DeformPercent.curves.morph,r=n.values.map(function(e){return e/100}),i=t.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new c.NumberKeyframeTrack(e.modelName+`.morphTargetInfluences[`+i+`]`,n.times,r)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(e,t){return e-t}),t.length>1){let e=1,n=t[0];for(let r=1;r<t.length;r++){let i=t[r];i!==n&&(t[e]=i,n=i,e++)}t=t.slice(0,e)}return t}getKeyframeTrackValues(e,t,n){let r=n,i=[],a=-1,o=-1,s=-1;return e.forEach(function(e){if(t.x&&(a=t.x.times.indexOf(e)),t.y&&(o=t.y.times.indexOf(e)),t.z&&(s=t.z.times.indexOf(e)),a!==-1){let e=t.x.values[a];i.push(e),r[0]=e}else i.push(r[0]);if(o!==-1){let e=t.y.values[o];i.push(e),r[1]=e}else i.push(r[1]);if(s!==-1){let e=t.z.values[s];i.push(e),r[2]=e}else i.push(r[2])}),i}interpolateRotations(e,t,n,r){let i=[],a=[];i.push(e.times[0]),a.push(c.MathUtils.degToRad(e.values[0])),a.push(c.MathUtils.degToRad(t.values[0])),a.push(c.MathUtils.degToRad(n.values[0]));for(let o=1;o<e.values.length;o++){let s=[e.values[o-1],t.values[o-1],n.values[o-1]];if(isNaN(s[0])||isNaN(s[1])||isNaN(s[2]))continue;let l=s.map(c.MathUtils.degToRad),u=[e.values[o],t.values[o],n.values[o]];if(isNaN(u[0])||isNaN(u[1])||isNaN(u[2]))continue;u.map(c.MathUtils.degToRad);let d=[u[0]-s[0],u[1]-s[1],u[2]-s[2]],f=[Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2])];if(f[0]>=180||f[1]>=180||f[2]>=180){let t=Math.max(...f)/180,n=new c.Euler(l[0],l[1],l[2],r),s=new c.Euler(l[0],l[1],l[2],r),u=new c.Quaternion().setFromEuler(n),d=new c.Quaternion().setFromEuler(s);u.dot(d)&&d.set(-d.x,-d.y,-d.z,-d.w);let p=e.times[o-1],m=e.times[o]-p,h=new c.Quaternion,g=new c.Euler;for(let e=0;e<1;e+=1/t)h.copy(u.clone().slerp(d.clone(),e)),i.push(p+e*m),g.setFromQuaternion(h,r),a.push(g.x),a.push(g.y),a.push(g.z)}else i.push(e.times[o]),a.push(c.MathUtils.degToRad(e.values[o])),a.push(c.MathUtils.degToRad(t.values[o])),a.push(c.MathUtils.degToRad(n.values[o]))}return[i,a]}},Mc=class{constructor(){this.allNodes=new Fc,this.nodeStack=[],this.currentIndent=0,this.currentPropName=``}getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),--this.currentIndent}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new Fc,this.nodeStack=[],this.currentProp=[],this.currentPropName=``;let t=this,n=e.split(/[\r\n]+/);return n.forEach(function(e,r){let i=e.match(/^[\s\t]*;/),a=e.match(/^[\s\t]*$/);if(i||a)return;let o=e.match(`^\\t{`+t.currentIndent+`}(\\w+):(.*){`),s=e.match(`^\\t{`+t.currentIndent+`}(\\w+):[\\s\\t\\r\\n](.*)`),c=e.match(`^\\t{`+(t.currentIndent-1)+`}}`);o?t.parseNodeBegin(e,o):s?t.parseNodeProperty(e,s,n[++r]):c?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)}),this.allNodes}parseNodeBegin(e,t){let n=t[1].trim().replace(/^"/,``).replace(/"$/,``),r=t[2].split(`,`).map(function(e){return e.trim().replace(/^"/,``).replace(/"$/,``)}),i={name:n},a=this.parseNodeAttr(r),o=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,i):n in o?(n===`PoseNode`?o.PoseNode.push(i):o[n].id!==void 0&&(o[n]={},o[n][o[n].id]=o[n]),a.id!==``&&(o[n][a.id]=i)):typeof a.id==`number`?(o[n]={},o[n][a.id]=i):n!==`Properties70`&&(n===`PoseNode`?o[n]=[i]:o[n]=i),typeof a.id==`number`&&(i.id=a.id),a.name!==``&&(i.attrName=a.name),a.type!==``&&(i.attrType=a.type),this.pushStack(i)}parseNodeAttr(e){let t=e[0];e[0]!==``&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n=``,r=``;return e.length>1&&(n=e[1].replace(/^(\w+)::/,``),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,``).replace(/"$/,``).trim(),i=t[2].replace(/^"/,``).replace(/"$/,``).trim();r===`Content`&&i===`,`&&(i=n.replace(/"/g,``).replace(/,$/,``).trim());let a=this.getCurrentNode();if(a.name===`Properties70`){this.parseNodeSpecialProperty(e,r,i);return}if(r===`C`){let e=i.split(`,`).slice(1),t=parseInt(e[0]),n=parseInt(e[1]),o=i.split(`,`).slice(3);o=o.map(function(e){return e.trim().replace(/^"/,``)}),r=`connections`,i=[t,n],Jc(i,o),a[r]===void 0&&(a[r]=[])}r===`Node`&&(a.id=i),r in a&&Array.isArray(a[r])?a[r].push(i):r===`a`?a.a=i:a[r]=i,this.setCurrentProp(a,r),r===`a`&&i.slice(-1)!==`,`&&(a.a=Kc(i))}parseNodePropertyContinued(e){let t=this.getCurrentNode();t.a+=e,e.slice(-1)!==`,`&&(t.a=Kc(t.a))}parseNodeSpecialProperty(e,t,n){let r=n.split(`",`).map(function(e){return e.trim().replace(/^\"/,``).replace(/\s/,`_`)}),i=r[0],a=r[1],o=r[2],s=r[3],c=r[4];switch(a){case`int`:case`enum`:case`bool`:case`ULongLong`:case`double`:case`Number`:case`FieldOfView`:c=parseFloat(c);break;case`Color`:case`ColorRGB`:case`Vector3D`:case`Lcl_Translation`:case`Lcl_Rotation`:case`Lcl_Scaling`:c=Kc(c);break}this.getPrevNode()[i]={type:a,type2:o,flag:s,value:c},this.setCurrentProp(this.getPrevNode(),i)}},Nc=class{parse(e){let t=new Pc(e);t.skip(23);let n=t.getUint32();if(n<6400)throw Error(`THREE.FBXLoader: FBX version not supported, FileVersion: `+n);let r=new Fc;for(;!this.endOfContent(t);){let e=this.parseNode(t,n);e!==null&&r.add(e.name,e)}return r}endOfContent(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){let n={},r=t>=7500?e.getUint64():e.getUint32(),i=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();let a=e.getUint8(),o=e.getString(a);if(r===0)return null;let s=[];for(let t=0;t<i;t++)s.push(this.parseProperty(e));let c=s.length>0?s[0]:``,l=s.length>1?s[1]:``,u=s.length>2?s[2]:``;for(n.singleProperty=i===1&&e.getOffset()===r;r>e.getOffset();){let r=this.parseNode(e,t);r!==null&&this.parseSubNode(o,n,r)}return n.propertyList=s,typeof c==`number`&&(n.id=c),l!==``&&(n.attrName=l),u!==``&&(n.attrType=u),o!==``&&(n.name=o),n}parseSubNode(e,t,n){if(n.singleProperty===!0){let e=n.propertyList[0];Array.isArray(e)?(t[n.name]=n,n.a=e):t[n.name]=e}else if(e===`Connections`&&n.name===`C`){let e=[];n.propertyList.forEach(function(t,n){n!==0&&e.push(t)}),t.connections===void 0&&(t.connections=[]),t.connections.push(e)}else if(n.name===`Properties70`)Object.keys(n).forEach(function(e){t[e]=n[e]});else if(e===`Properties70`&&n.name===`P`){let e=n.propertyList[0],r=n.propertyList[1],i=n.propertyList[2],a=n.propertyList[3],o;e.indexOf(`Lcl `)===0&&(e=e.replace(`Lcl `,`Lcl_`)),r.indexOf(`Lcl `)===0&&(r=r.replace(`Lcl `,`Lcl_`)),o=r===`Color`||r===`ColorRGB`||r===`Vector`||r===`Vector3D`||r.indexOf(`Lcl_`)===0?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[e]={type:r,type2:i,flag:a,value:o}}else t[n.name]===void 0?typeof n.id==`number`?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name===`PoseNode`?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){let t=e.getString(1),n;switch(t){case`C`:return e.getBoolean();case`D`:return e.getFloat64();case`F`:return e.getFloat32();case`I`:return e.getInt32();case`L`:return e.getInt64();case`R`:return n=e.getUint32(),e.getArrayBuffer(n);case`S`:return n=e.getUint32(),e.getString(n);case`Y`:return e.getInt16();case`b`:case`c`:case`d`:case`f`:case`i`:case`l`:let r=e.getUint32(),i=e.getUint32(),a=e.getUint32();if(i===0)switch(t){case`b`:case`c`:return e.getBooleanArray(r);case`d`:return e.getFloat64Array(r);case`f`:return e.getFloat32Array(r);case`i`:return e.getInt32Array(r);case`l`:return e.getInt64Array(r)}let o=new Pc(yc(new Uint8Array(e.getArrayBuffer(a))).buffer);switch(t){case`b`:case`c`:return o.getBooleanArray(r);case`d`:return o.getFloat64Array(r);case`f`:return o.getFloat32Array(r);case`i`:return o.getInt32Array(r);case`l`:return o.getInt64Array(r)}break;default:throw Error(`THREE.FBXLoader: Unknown property type `+t)}}},Pc=class{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t===void 0?!0:t,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)==1}getBooleanArray(e){let t=[];for(let n=0;n<e;n++)t.push(this.getBoolean());return t}getUint8(){let e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){let e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){let e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getInt32());return t}getUint32(){let e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){let e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getFloat32());return t}getFloat64(){let e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getFloat64());return t}getArrayBuffer(e){let t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){let t=this.offset,n=new Uint8Array(this.dv.buffer,t,e);this.skip(e);let r=n.indexOf(0);return r>=0&&(n=new Uint8Array(this.dv.buffer,t,r)),this._textDecoder.decode(n)}},Fc=class{constructor(){this.Connections={connections:[]},this.Objects={Model:{},NodeAttribute:{},Geometry:{}},this.GlobalSettings={}}add(e,t){this[e]=t}};function Ic(e){return e.byteLength>=21&&qc(e,0,21)===`Kaydara FBX Binary \0`}function Lc(e){let t=[`K`,`a`,`y`,`d`,`a`,`r`,`a`,`\\`,`F`,`B`,`X`,`\\`,`B`,`i`,`n`,`a`,`r`,`y`,`\\`,`\\`],n=0;function r(t){let r=e[t-1];return e=e.slice(n+t),n++,r}for(let e=0;e<t.length;++e)if(r(1)===t[e])return!1;return!0}function Rc(e){let t=e.match(/FBXVersion: (\d+)/);if(t)return parseInt(t[1]);throw Error(`THREE.FBXLoader: Cannot find the version number for the file given.`)}function zc(e){return e/46186158e3}var Bc=[];function Vc(e,t,n,r){let i;switch(r.mappingType){case`ByPolygonVertex`:i=e;break;case`ByPolygon`:i=t;break;case`ByVertice`:i=n;break;case`AllSame`:i=r.indices[0];break;default:console.warn(`THREE.FBXLoader: unknown attribute mapping type `+r.mappingType),i=0}r.referenceType===`IndexToDirect`&&(i=r.indices[i]);let a=i*r.dataSize,o=a+r.dataSize;return Yc(Bc,r.buffer,a,o)}var Hc=new c.Euler,Uc=new c.Vector3;function Wc(e){let t=new c.Matrix4,n=new c.Matrix4,r=new c.Matrix4,i=new c.Matrix4,a=new c.Matrix4,o=new c.Matrix4,s=new c.Matrix4,l=new c.Matrix4,u=new c.Matrix4,d=new c.Matrix4,f=new c.Matrix4,p=new c.Matrix4,m=e.inheritType?e.inheritType:0;e.translation&&t.setPosition(Uc.fromArray(e.translation));let h=Gc(0);if(e.preRotation){let t=e.preRotation.map(c.MathUtils.degToRad);t.push(h),n.makeRotationFromEuler(Hc.fromArray(t))}if(e.rotation){let t=e.rotation.map(c.MathUtils.degToRad);t.push(e.eulerOrder||h),r.makeRotationFromEuler(Hc.fromArray(t))}if(e.postRotation){let t=e.postRotation.map(c.MathUtils.degToRad);t.push(h),i.makeRotationFromEuler(Hc.fromArray(t)),i.copy(new c.Matrix4().getInverse(i))}e.scale&&a.scale(Uc.fromArray(e.scale)),e.scalingOffset&&s.setPosition(Uc.fromArray(e.scalingOffset)),e.scalingPivot&&o.setPosition(Uc.fromArray(e.scalingPivot)),e.rotationOffset&&l.setPosition(Uc.fromArray(e.rotationOffset)),e.rotationPivot&&u.setPosition(Uc.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(f.copy(e.parentMatrix),d.copy(e.parentMatrixWorld));let g=n.clone().multiply(r).multiply(i),_=new c.Matrix4;_.extractRotation(d);let v=new c.Matrix4;v.copyPosition(d);let y=new c.Matrix4().getInverse(v).multiply(d),b=new c.Matrix4().getInverse(_).multiply(y),x=a,S=new c.Matrix4;if(m===0)S.copy(_).multiply(g).multiply(b).multiply(x);else if(m===1)S.copy(_).multiply(b).multiply(g).multiply(x);else{let e=new c.Matrix4().scale(new c.Vector3().setFromMatrixScale(f)),t=new c.Matrix4().getInverse(e),n=b.clone().multiply(t);S.copy(_).multiply(g).multiply(n).multiply(x)}let C=new c.Matrix4().getInverse(u),w=new c.Matrix4().getInverse(o),T=t.clone().multiply(l).multiply(u).multiply(n).multiply(r).multiply(i).multiply(C).multiply(s).multiply(o).multiply(a).multiply(w),E=new c.Matrix4().copyPosition(T),D=d.clone().multiply(E);return p.copyPosition(D),T=p.clone().multiply(S),T.premultiply(new c.Matrix4().getInverse(d)),T}function Gc(e){e=e||0;let t=[`ZYX`,`YZX`,`XZY`,`ZXY`,`YXZ`,`XYZ`];return e===6?(console.warn(`THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect.`),t[0]):t[e]}function Kc(e){return e.split(`,`).map(function(e){return parseFloat(e)})}function qc(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=e.byteLength),new TextDecoder().decode(new Uint8Array(e,t,n))}function Jc(e,t){for(let n=0,r=e.length,i=t.length;n<i;n++,r++)e[r]=t[n]}function Yc(e,t,n,r){for(let i=n,a=0;i<r;i++,a++)e[a]=t[i];return e}var Xc=class extends c.Curve{constructor(e,t,n,r,i){super();let a=t?t.length-1:0,o=n?n.length:0;this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=r||0,this.endKnot=i||a;for(let e=0;e<o;++e){let t=n[e];this.controlPoints[e]=new c.Vector4(t.x,t.y,t.z,t.w)}}getPoint(e,t=new c.Vector3){let n=t,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=$c(this.degree,this.knots,this.controlPoints,r);return i.w!==1&&i.divideScalar(i.w),n.set(i.x,i.y,i.z)}getTangent(e,t=new c.Vector3){let n=t,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),i=il(this.degree,this.knots,this.controlPoints,r,1);return n.copy(i[1]).normalize(),n}toJSON(){let e=super.toJSON();return e.degree=this.degree,e.knots=[...this.knots],e.controlPoints=this.controlPoints.map(e=>e.toArray()),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e}fromJSON(e){return super.fromJSON(e),this.degree=e.degree,this.knots=[...e.knots],this.controlPoints=e.controlPoints.map(e=>new c.Vector4(e[0],e[1],e[2],e[3])),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this}};function Zc(e,t,n){let r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;let i=e,a=r,o=Math.floor((i+a)/2);for(;t<n[o]||t>=n[o+1];)t<n[o]?a=o:i=o,o=Math.floor((i+a)/2);return o}function Qc(e,t,n,r){let i=[],a=[],o=[];i[0]=1;for(let s=1;s<=n;++s){a[s]=t-r[e+1-s],o[s]=r[e+s]-t;let n=0;for(let e=0;e<s;++e){let t=o[e+1],r=a[s-e],c=i[e]/(t+r);i[e]=n+t*c,n=r*c}i[s]=n}return i}function $c(e,t,n,r){let i=Zc(e,r,t),a=Qc(i,r,e,t),o=new c.Vector4(0,0,0,0);for(let t=0;t<=e;++t){let r=n[i-e+t],s=a[t],c=r.w*s;o.x+=r.x*c,o.y+=r.y*c,o.z+=r.z*c,o.w+=r.w*s}return o}function el(e,t,n,r,i){let a=[];for(let e=0;e<=n;++e)a[e]=0;let o=[];for(let e=0;e<=r;++e)o[e]=a.slice(0);let s=[];for(let e=0;e<=n;++e)s[e]=a.slice(0);s[0][0]=1;let c=a.slice(0),l=a.slice(0);for(let r=1;r<=n;++r){c[r]=t-i[e+1-r],l[r]=i[e+r]-t;let n=0;for(let e=0;e<r;++e){let t=l[e+1],i=c[r-e];s[r][e]=t+i;let a=s[e][r-1]/s[r][e];s[e][r]=n+t*a,n=i*a}s[r][r]=n}for(let e=0;e<=n;++e)o[0][e]=s[e][n];for(let e=0;e<=n;++e){let t=0,i=1,c=[];for(let e=0;e<=n;++e)c[e]=a.slice(0);c[0][0]=1;for(let a=1;a<=r;++a){let r=0,l=e-a,u=n-a;e>=a&&(c[i][0]=c[t][0]/s[u+1][l],r=c[i][0]*s[l][u]);let d=l>=-1?1:-l,f=e-1<=u?a-1:n-e;for(let e=d;e<=f;++e)c[i][e]=(c[t][e]-c[t][e-1])/s[u+1][l+e],r+=c[i][e]*s[l+e][u];e<=u&&(c[i][a]=-c[t][a-1]/s[u+1][e],r+=c[i][a]*s[e][u]),o[a][e]=r;let p=t;t=i,i=p}}let u=n;for(let e=1;e<=r;++e){for(let t=0;t<=n;++t)o[e][t]*=u;u*=n-e}return o}function tl(e,t,n,r,i){let a=i<e?i:e,o=[],s=Zc(e,r,t),l=el(s,r,e,a,t),u=[];for(let e=0;e<n.length;++e){let t=n[e].clone(),r=t.w;t.x*=r,t.y*=r,t.z*=r,u[e]=t}for(let t=0;t<=a;++t){let n=u[s-e].clone().multiplyScalar(l[t][0]);for(let r=1;r<=e;++r)n.add(u[s-e+r].clone().multiplyScalar(l[t][r]));o[t]=n}for(let e=a+1;e<=i+1;++e)o[e]=new c.Vector4(0,0,0);return o}function nl(e,t){let n=1;for(let t=2;t<=e;++t)n*=t;let r=1;for(let e=2;e<=t;++e)r*=e;for(let n=2;n<=e-t;++n)r*=n;return n/r}function rl(e){let t=e.length,n=[],r=[];for(let i=0;i<t;++i){let t=e[i];n[i]=new c.Vector3(t.x,t.y,t.z),r[i]=t.w}let i=[];for(let e=0;e<t;++e){let t=n[e].clone();for(let n=1;n<=e;++n)t.sub(i[e-n].clone().multiplyScalar(nl(e,n)*r[n]));i[e]=t.divideScalar(r[0])}return i}function il(e,t,n,r,i){return rl(tl(e,t,n,r,i))}var al=new c.Vector3;function ol(e,t){switch(t){case`D`:return new Float64Array(e);case`F`:return new Float32Array(e);case`L`:return new Int32Array(e);case`I`:return new Int16Array(e);default:return new Uint8Array(e)}}function sl(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?_r:r,s=(i=t.onDownloadProgress)==null?K:i,l={byteLength:0};return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s)).then(n=>{var r,i;return l.byteLength=n.body.byteLength,cl(new Uint8Array(n.body),{light:(r=t.light)==null?!0:r,color:t.color,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(i=e.split(`?`)[1])==null?``:i,fetcher:o})}).then(t=>{let n=new c.Group;return n.name=e,n.add(t.object),a===`Y`&&n.applyMatrix4(tr),{type:`x3p`,modelUpAxis:`Z`,upAxis:a,uri:e,byteLength:l.byteLength,memoryUsage:Pi(n),scene:n,textures:[],animations:[],dispose:()=>t.dispose()}})}function cl(e,t){var n,r,i,a,o,s,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,N,ee,P,te,ne,re,ie,ae,oe,se,ce,F,le,ue,de,fe,pe,me,he,ge,_e,ve,ye,be;let xe=Ec(e),Se=``,Ce=null;for(let e of Object.keys(xe))/(^|\/)main\.xml$/i.test(e)&&(Ce=xe[e],Se=e.slice(0,e.lastIndexOf(`/`)+1));if(!Ce)throw Error(`X3p: main.xml not found.`);if(typeof DOMParser>`u`)throw Error(`X3p: DOMParser not found.`);let we=(n=t.color)==null?new c.Color(10066329):n,Te=new DOMParser,Ee=Fa(Ce),De=Te.parseFromString(Ee,`text/xml`),I=De.querySelector(`Record1 Axes`),Oe={x:{type:(a=(i=(r=I==null?void 0:I.querySelector(`CX AxisType`))==null?void 0:r.textContent)==null?void 0:i.toUpperCase())==null?`I`:a,dataType:(l=(s=(o=I==null?void 0:I.querySelector(`CX DataType`))==null?void 0:o.textContent)==null?void 0:s.toUpperCase())==null?`D`:l,increment:Number((d=(u=I==null?void 0:I.querySelector(`CX Increment`))==null?void 0:u.textContent)==null?`1`:d),offset:Number((p=(f=I==null?void 0:I.querySelector(`CX Offset`))==null?void 0:f.textContent)==null?`0`:p)},y:{type:(g=(h=(m=I==null?void 0:I.querySelector(`CY AxisType`))==null?void 0:m.textContent)==null?void 0:h.toUpperCase())==null?`I`:g,dataType:(y=(v=(_=I==null?void 0:I.querySelector(`CY DataType`))==null?void 0:_.textContent)==null?void 0:v.toUpperCase())==null?`D`:y,increment:Number((x=(b=I==null?void 0:I.querySelector(`CY Increment`))==null?void 0:b.textContent)==null?`1`:x),offset:Number((C=(S=I==null?void 0:I.querySelector(`CY Offset`))==null?void 0:S.textContent)==null?`0`:C)},z:{type:(E=(T=(w=I==null?void 0:I.querySelector(`CZ AxisType`))==null?void 0:w.textContent)==null?void 0:T.toUpperCase())==null?`A`:E,dataType:(k=(O=(D=I==null?void 0:I.querySelector(`CZ DataType`))==null?void 0:D.textContent)==null?void 0:O.toUpperCase())==null?`D`:k,increment:Number((j=(A=I==null?void 0:I.querySelector(`CZ Increment`))==null?void 0:A.textContent)==null?`1`:j),offset:Number((N=(M=I==null?void 0:I.querySelector(`CZ Offset`))==null?void 0:M.textContent)==null?`0`:N)}},ke=null,Ae=De.querySelector(`Record1 Axes Rotation`);Ae&&(ke=new c.Matrix3,ke.set(Number((P=(ee=Ae.querySelector(`r11`))==null?void 0:ee.textContent)==null?0:P),Number((ne=(te=Ae.querySelector(`r12`))==null?void 0:te.textContent)==null?0:ne),Number((ie=(re=Ae.querySelector(`r13`))==null?void 0:re.textContent)==null?0:ie),Number((oe=(ae=Ae.querySelector(`r21`))==null?void 0:ae.textContent)==null?0:oe),Number((ce=(se=Ae.querySelector(`r22`))==null?void 0:se.textContent)==null?0:ce),Number((le=(F=Ae.querySelector(`r23`))==null?void 0:F.textContent)==null?0:le),Number((de=(ue=Ae.querySelector(`r31`))==null?void 0:ue.textContent)==null?0:de),Number((pe=(fe=Ae.querySelector(`r32`))==null?void 0:fe.textContent)==null?0:pe),Number((he=(me=Ae.querySelector(`r33`))==null?void 0:me.textContent)==null?0:he)));let je=(ge=De.querySelector(`Record3 DataLink PointDataLink`))==null?void 0:ge.textContent;if(typeof je!=`string`)throw Error(`X3p: PointDataLink not found.`);je=wr(Se,je);let Me=xe[je];if(!Me)throw Error(`X3p: ${Me} not found.`);let Ne=ol(Me.buffer,Oe.z.dataType),Pe=Number((ve=(_e=De.querySelector(`Record3 MatrixDimension SizeX`))==null?void 0:_e.textContent)==null?`0`:ve),Fe=Number((be=(ye=De.querySelector(`Record3 MatrixDimension SizeY`))==null?void 0:ye.textContent)==null?`0`:be),Ie=Math.floor(Pe-1),Le=Math.floor(Fe-1),L=Ie+1,Re=Le+1,ze=new Float32Array(L*Re*3),Be=new Float32Array(L*Re*2),Ve=new Uint32Array(Ie*Le*6),He=new c.Box3;for(let e=0;e<Re;e++){let t=e*Oe.y.increment+Oe.y.offset;for(let n=0;n<L;n++){let r=e*L+n,i=n*Oe.x.increment+Oe.x.offset,a=Ne[r],o=!isNaN(a),s=o?a:NaN;al.set(i,-t,s),ke&&al.applyMatrix3(ke),o&&He.expandByPoint(al),ze[r*3+0]=al.x,ze[r*3+1]=al.y,ze[r*3+2]=al.z,Be[r*2+0]=n/Ie,Be[r*2+1]=1-e/Le}}for(let e=0;e<Le;e++)for(let t=0;t<Ie;t++){let n=t+L*e,r=t+L*(e+1),i=t+1+L*(e+1),a=t+1+L*e,o=(e*Ie+t)*6;Ve[o+0]=n,Ve[o+1]=r,Ve[o+2]=a,Ve[o+3]=r,Ve[o+4]=i,Ve[o+5]=a}let Ue=new c.BufferGeometry;Ue.setAttribute(`position`,new c.BufferAttribute(ze,3)),Ue.setAttribute(`uv`,new c.BufferAttribute(Be,2)),Ue.setIndex(new c.BufferAttribute(Ve,1)),(!Ue.groups||Ue.groups.length===0)&&Ue.addGroup(0,Ue.index?Ue.index.count:Ue.attributes.position.count,0),Ue.boundingBox=He;let We=new yn(t.light?`phong`:`basic`);return We.flatShading=!0,We.color.copy(we),{object:new bn(Ue,[We]),dispose:()=>{Ue.dispose(),We.dispose()}}}function ll(e){let t=e.length/32;if(e.length%32!=0)throw Error(`Invalid splat file: data length ${e.length} is not a multiple of 32`);let n=new Float32Array(3*t),r=new Float32Array(4*t),i=new Float32Array(3*t),a=new Uint8Array(4*t),o=new Float32Array(e.buffer),s=new Uint8Array(e.buffer);for(let e=0;e<t;e++)n[3*e+0]=o[8*e+0],n[3*e+1]=o[8*e+1],n[3*e+2]=o[8*e+2],i[3*e+0]=o[8*e+3+0],i[3*e+1]=o[8*e+3+1],i[3*e+2]=o[8*e+3+2],a[4*e+0]=s[32*e+24+0],a[4*e+1]=s[32*e+24+1],a[4*e+2]=s[32*e+24+2],a[4*e+3]=s[32*e+24+3],r[4*e+0]=(s[32*e+28+0]-128)/128,r[4*e+1]=(s[32*e+28+1]-128)/128,r[4*e+2]=(s[32*e+28+2]-128)/128,r[4*e+3]=(s[32*e+28+3]-128)/128;return{numPoints:t,positions:n,scales:i,rotations:r,colors:a}}function ul(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Y`:n,s=(r=t.upAxis)==null?`Z`:r,c=(i=t.fetcher)==null?_r:i,l=(a=t.onDownloadProgress)==null?K:a,u=0;return Promise.resolve().then(()=>c.ajax(e,{responseType:`arraybuffer`},void 0,void 0,l)).then(e=>(u=e.body.byteLength,e.body)).then(e=>ll(new Uint8Array(e))).then(t=>{let n=new $n({positions:t.positions,scales:t.scales,rotations:t.rotations,colors:t.colors,numPoints:t.numPoints});return o===`Y`&&n.applyMatrix4(er),{type:`splat`,modelUpAxis:o,upAxis:s,uri:e,byteLength:u,memoryUsage:Pi(n),scene:n,textures:[],animations:[],dispose:()=>n.dispose()}})}var dl;(function(e){e[e.Outside=-1]=`Outside`,e[e.Intersecting=0]=`Intersecting`,e[e.Inside=1]=`Inside`})(dl||(dl={}));var fl=1e-6,pl=new c.Matrix4().identity(),Y=new c.Vector3,ml=new c.Matrix4,hl=new c.Vector3,gl=new c.Vector3,_l=new c.Vector3,vl=new c.Vector3,yl=new c.Box3,bl=new c.Sphere,xl=new c.Matrix4,Sl=new c.Ray,Cl=new c.Object3D,wl=new c.Frustum;function Tl(e,t){let n=e.elements;return t.setFromRotationMatrix(ml.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1)),t}var El=class e{static get MASK_OUTSIDE(){return 4294967295}static get MASK_INSIDE(){return 0}static get MASK_INDETERMINATE(){return 2147483647}constructor(e=[]){this.planes=e}setFromFrustum(e){return this.planes=e.planes.map(e=>e.clone()),this}setFromCamera(e){return ml.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),wl.setFromProjectionMatrix(ml),this.setFromFrustum(wl),this}applyMatrix4(e){for(let t of this.planes)t.applyMatrix4(e)}copy(e){return this.planes=e.planes.map(e=>e.clone()),this}clone(){return new e().copy(this)}computeVisibility(e){let t=dl.Inside;for(let n of this.planes)switch(e.intersectPlane(n)){case dl.Outside:return dl.Outside;case dl.Intersecting:t=dl.Intersecting;break;default:}return t}computeVisibilityWithPlaneMask(t,n){if(n===e.MASK_OUTSIDE||n===e.MASK_INSIDE)return n;let r=e.MASK_INSIDE,i=Math.min(32,this.planes.length);for(let a=0;a<i;++a){let i=1<<a;if((n&i)===0)continue;let o=this.planes[a],s=t.intersectPlane(o);if(s===dl.Outside)return e.MASK_OUTSIDE;s===dl.Intersecting&&(r|=i)}return r}},Dl=class e{constructor(){this.type=`box`,this.center=new c.Vector3,this.halfSize=new c.Vector3,this.rotation=new c.Matrix3}fromJson({box:e}){this.center.set(e[0],e[1],e[2]);let t=e[3],n=e[4],r=e[5],i=e[6],a=e[7],o=e[8],s=e[9],c=e[10],l=e[11],u=Math.max(Math.sqrt(t*t+n*n+r*r),.001),d=Math.max(Math.sqrt(i*i+a*a+o*o),.001),f=Math.max(Math.sqrt(s*s+c*c+l*l),.001);this.halfSize.set(u,d,f);let p=this.halfSize.toArray().reduce((e,t)=>e+t,0);return(isNaN(p)||p<=0)&&this.halfSize.setScalar(fl),this.rotation.fromArray([t/u,n/u,r/u,i/d,a/d,o/d,s/f,c/f,l/f]),isNaN(this.rotation.toArray().reduce((e,t)=>e+t,0))&&this.rotation.identity(),this}toJson(){return this.rotation.extractBasis(hl,gl,_l),{box:[...this.center.toArray(),...hl.multiplyScalar(this.halfSize.x).toArray(),...gl.multiplyScalar(this.halfSize.y).toArray(),..._l.multiplyScalar(this.halfSize.z).toArray()]}}copy(e){return this.center.copy(e.center),this.halfSize.copy(e.halfSize),this.rotation.copy(e.rotation),this}clone(){return new e().copy(this)}applyMatrix4(e){return e.equals(pl)?this:(Cl.position.copy(this.center),Tl(this.rotation,Cl.quaternion),Cl.scale.copy(this.halfSize),Cl.matrix.compose(Cl.position,Cl.quaternion,Cl.scale),Cl.matrix.premultiply(e),Cl.matrix.decompose(Cl.position,Cl.quaternion,Cl.scale),this.center.copy(Cl.position),this.rotation.setFromMatrix4(ml.makeRotationFromQuaternion(Cl.quaternion)),this.halfSize.copy(Cl.scale),this)}getCenter(e){return e.copy(this.center)}distanceSquaredToPoint(e){let t=this.rotation.elements,n=e.x-this.center.x,r=e.y-this.center.y,i=e.z-this.center.z,a=0,o;return o=n*t[0]+r*t[1]+i*t[2],o<0&&(o=-o),o-=this.halfSize.x,o>0&&(a+=o*o),o=n*t[3]+r*t[4]+i*t[5],o<0&&(o=-o),o-=this.halfSize.y,o>0&&(a+=o*o),o=n*t[6]+r*t[7]+i*t[8],o<0&&(o=-o),o-=this.halfSize.z,o>0&&(a+=o*o),a}distanceToPoint(e){return Math.sqrt(this.distanceSquaredToPoint(e))}distanceToPlane(e){let t=e.projectPoint(this.center,new c.Vector3);return this.distanceToPoint(t)}getBoundingBox(e){return e.makeEmpty(),this.rotation.extractBasis(hl,gl,_l),hl.setLength(this.halfSize.x),gl.setLength(this.halfSize.y),_l.setLength(this.halfSize.z),e.expandByPoint(Y.copy(this.center).add(hl)),e.expandByPoint(Y.copy(this.center).sub(hl)),e.expandByPoint(Y.copy(this.center).add(gl)),e.expandByPoint(Y.copy(this.center).sub(gl)),e.expandByPoint(Y.copy(this.center).add(_l)),e.expandByPoint(Y.copy(this.center).sub(_l)),e}toGeometry(){let e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(24);Y.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,0),Y.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,3),Y.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,6),Y.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,9),Y.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,12),Y.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,15),Y.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,18),Y.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,21);let n=new c.BufferGeometry;return n.setIndex(new c.BufferAttribute(e,1)),n.setAttribute(`position`,new c.BufferAttribute(t,3)),n.computeBoundingBox(),n.computeBoundingSphere(),n}intersectPlane(e){let t=this.center,n=e.normal,r=this.rotation.elements,i=this.halfSize,a=n.x,o=n.y,s=n.z,c=Math.abs(a*r[0]*i.x+o*r[1]*i.x+s*r[2]*i.x)+Math.abs(a*r[3]*i.y+o*r[4]*i.y+s*r[5]*i.y)+Math.abs(a*r[6]*i.z+o*r[7]*i.z+s*r[8]*i.z),l=n.dot(t)+e.constant;return l<=-c?dl.Outside:l>=c?dl.Inside:dl.Intersecting}intersectRay(e,t=0,n){if(vl.copy(this.halfSize).multiplyScalar(2),yl.setFromCenterAndSize(Y.set(0,0,0),vl),yl.expandByScalar(t),this.rotation.extractBasis(hl,gl,_l),ml.makeBasis(hl,gl,_l),ml.setPosition(this.center),xl.getInverse(ml),Sl.copy(e).applyMatrix4(xl),yl.containsPoint(Sl.origin))return!0;let r=Sl.intersectBox(yl,Y);return r?n===void 0?!0:(n+=t,r.distanceToSquared(Sl.origin)<=n*n):!1}},Ol=class e{constructor(){this.type=`sphere`,this.center=new c.Vector3,this.radius=-1}fromJson({sphere:e}){return this.center.set(e[0],e[1],e[2]),this.radius=Math.max(e[3],fl),this}toJson(){return{sphere:[...this.center.toArray(),this.radius]}}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}clone(){return new e().copy(this)}getBoundingBox(e){return e.setFromCenterAndSize(this.center,vl.set(1,1,1).multiplyScalar(this.radius*2)),e}toGeometry(){let e=new Float32Array(384);for(let t=0;t<=32;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=this.center.x+Math.cos(n)*this.radius,e[t*6+1]=this.center.y+Math.sin(n)*this.radius,e[t*6+2]=this.center.z+0,n=(t+1)/32*Math.PI*2,e[t*6+3]=this.center.x+Math.cos(n)*this.radius,e[t*6+4]=this.center.y+Math.sin(n)*this.radius,e[t*6+5]=this.center.z+0}for(let t=32;t<=64;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=this.center.x+Math.cos(n)*this.radius,e[t*6+1]=this.center.y+0,e[t*6+2]=this.center.z+Math.sin(n)*this.radius,n=(t+1)/32*Math.PI*2,e[t*6+3]=this.center.x+Math.cos(n)*this.radius,e[t*6+4]=this.center.y+0,e[t*6+5]=this.center.z+Math.sin(n)*this.radius}let t=new c.BufferGeometry;return t.setAttribute(`position`,new c.BufferAttribute(e,3)),t.computeBoundingBox(),t.computeBoundingSphere(),t}applyMatrix4(e){return e.equals(pl)?this:(this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this)}getCenter(e){return e.copy(this.center)}distanceSquaredToPoint(e){let t=this.distanceToPoint(e);return t*t}distanceToPoint(e){let t=this.center.distanceTo(e)-this.radius;return t<=0?0:t}distanceToPlane(e){let t=Math.abs(e.distanceToPoint(this.center));return Math.max(0,t-this.radius)}intersectPlane(e){let t=this.center,n=this.radius,r=e.normal.dot(t)+e.constant;return r<-n?dl.Outside:r<n?dl.Intersecting:dl.Inside}intersectRay(e,t=0,n){if(bl.set(this.center,this.radius+t),bl.containsPoint(e.origin))return!0;let r=e.intersectSphere(bl,Y);return r?n===void 0?!0:(n+=t,e.origin.distanceToSquared(r)<=n*n):!1}},kl=class e{constructor(){throw this.type=`regin`,this.west=0,this.south=0,this.east=0,this.north=0,this.minHeight=0,this.maxHeight=0,Error(`Region bounding volume not supported.`)}fromJson({region:e}){return this.west=e[0],this.south=e[1],this.east=e[2],this.north=e[3],this.minHeight=e[4],this.maxHeight=e[5],this}toJson(){return{region:[this.west,this.south,this.east,this.north,this.minHeight,this.maxHeight]}}copy(e){return this.west=e.west,this.south=e.south,this.east=e.east,this.north=e.north,this.minHeight=e.minHeight,this.maxHeight=e.maxHeight,this}clone(){return new e().copy(this)}getBoundingBox(e){throw Error(`not implemented`)}toGeometry(){throw Error(`not implemented`)}applyMatrix4(e){throw Error(`not implemented`)}getCenter(e){throw Error(`not implemented`)}distanceToPoint(e){throw Error(`not implemented`)}distanceSquaredToPoint(e){throw Error(`not implemented`)}distanceToPlane(e){throw Error(`not implemented`)}intersectPlane(e){throw Error(`not implemented`)}intersectRay(e,t=0,n){throw Error(`not implemented`)}};function Al(e){return e instanceof Dl||e instanceof Ol||e instanceof kl}function jl(e){if(Al(e))return e;if(`box`in e)return new Dl().fromJson(e);if(`sphere`in e)return new Ol().fromJson(e);if(`region`in e)return new kl().fromJson(e);throw Error(`BoundingVolume ${JSON.stringify(e)} never suppored.`)}var Ml=[4821759,8191922,16637280,16739958,5822969,376977,16747077,9259235,14514687].map(e=>new c.LineBasicMaterial({color:e,depthWrite:!1,depthTest:!0,transparent:!0,opacity:.5})),Nl=(()=>{let e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(24);Y.set(1,1,1).toArray(t,0),Y.set(-1,1,1).toArray(t,3),Y.set(-1,-1,1).toArray(t,6),Y.set(1,-1,1).toArray(t,9),Y.set(1,1,-1).toArray(t,12),Y.set(-1,1,-1).toArray(t,15),Y.set(-1,-1,-1).toArray(t,18),Y.set(1,-1,-1).toArray(t,21);let n=new c.BufferGeometry;return n.setIndex(new c.BufferAttribute(e,1)),n.setAttribute(`position`,new c.BufferAttribute(t,3)),n.computeBoundingBox(),n.computeBoundingSphere(),n})(),Pl=(()=>{let e=new Float32Array(384);for(let t=0;t<=32;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=Math.cos(n),e[t*6+1]=Math.sin(n),e[t*6+2]=0,n=(t+1)/32*Math.PI*2,e[t*6+3]=Math.cos(n),e[t*6+4]=Math.sin(n),e[t*6+5]=0}for(let t=32;t<=64;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=Math.cos(n),e[t*6+1]=0,e[t*6+2]=Math.sin(n),n=(t+1)/32*Math.PI*2,e[t*6+3]=Math.cos(n),e[t*6+4]=0,e[t*6+5]=Math.sin(n)}let t=new c.BufferGeometry;return t.setAttribute(`position`,new c.BufferAttribute(e,3)),t.computeBoundingBox(),t.computeBoundingSphere(),t})();function Fl(e,t=0){if(e instanceof Dl){let n=new c.LineSegments(Nl,Ml[Math.min(t,Ml.length-1)]);return n.position.copy(e.center),Tl(e.rotation,n.quaternion),n.scale.set(e.halfSize.x,e.halfSize.y,e.halfSize.z),n.matrix.compose(n.position,n.quaternion,n.scale),n}else if(e instanceof Ol){let n=new c.LineSegments(Pl,Ml[Math.min(t,Ml.length-1)]);return n.position.copy(e.center),n.scale.set(e.radius,e.radius,e.radius),n.matrix.compose(n.position,n.quaternion,n.scale),n}return null}var Il=new c.Vector3,Ll=new c.Plane,Rl=new Ol,zl=new Dl,Bl=class e{constructor(t,n,r,i){var a,o,s,l;this.parent=null,this.contentParent=null,this.floor=0,this.id=t,this.state={visible:!1,frameNumber:0,selectedFrameNumber:0,requestedFrameNumber:0,touchedFrameNumber:0,distanceToCamera:0,centerZDepth:0,centerScreenY:0,screenSpaceError:0,visibilityPlaneMask:0,inRequestVolume:!1,shouldRefine:!1,stackLength:0,finalResolution:!0,selectionDepth:0,shouldSelect:!1,lastSelect:!1,ancestorWithContent:null,ancestorWithContentAvailable:null},this.parent=i==null?null:i,this.contentParent=i?i.hasRenderContent?i:i.contentParent:null,this.level=this.parent?this.parent.level+1:0,this.tileset=r,this.refine=(a=n.refine)==null?this.parent?this.parent.refine:`REPLACE`:a,this.transform=new c.Matrix4,n.transform&&this.transform.fromArray(n.transform),this.parent&&this.transform.premultiply(this.parent.transform),typeof n.geometricError==`number`?this.geometricError=n.geometricError*this.transform.getMaxScaleOnAxis():this.geometricError=(s=(o=this.parent)==null?void 0:o.geometricError)==null?0:s,n.content&&n.content.uri?(this.content={uri:n.content.uri,loadState:`UNLOADED`,loadProgress:0,loadStateUpdateTime:H(),loadfailRetryDelay:0,byteLength:0,memoryUsage:0},n.content.group!==void 0&&(this.content.group=n.content.group),/\.json$/.test(this.content.uri)?this.type=`TILESET`:this.type=`SCENEGRAPH`):(this.content=null,this.type=`EMPTY`),this.levelOfContent=this.parent?this.parent.levelOfContent:-1,this.type===`SCENEGRAPH`&&(this.levelOfContent+=1),n.boundingVolume&&(this.boundingVolume=jl(n.boundingVolume).applyMatrix4(this.transform)),n.viewerRequestVolume&&(this.viewerRequestVolume=jl(n.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=(l=n.extras)==null?{}:l,typeof this.extras.floor!=`number`&&i&&typeof i.extras.floor==`number`&&(this.extras.floor=i.extras.floor),typeof this.extras.floor==`number`&&(this.floor=this.extras.floor,this.tileset.floorLength=Math.max(this.tileset.floorLength,this.floor+1)),n.children?this.children=n.children.map((t,n)=>new e(`${this.id}.${n}`,t,r,this)):this.children=[]}traverse(e){e(this);for(let t of this.children)t.traverse(e)}updateState(e){this.state.frameNumber=e.frameNumber;let t=this.tileset.transform;if(this.boundingVolume){let n;n=this.boundingVolume instanceof Dl?zl.copy(this.boundingVolume):this.boundingVolume instanceof Ol?Rl.copy(this.boundingVolume):this.boundingVolume.clone(),n.applyMatrix4(t),e.camera.type===`OrthographicCamera`?(Ll.setFromNormalAndCoplanarPoint(e.camera.direction,e.camera.position),this.state.distanceToCamera=n.distanceToPlane(Ll)):this.state.distanceToCamera=n.distanceToPoint(e.camera.position);let r=n.getCenter(Il).sub(e.camera.position);this.state.centerZDepth=e.camera.direction.dot(r),this.state.centerScreenY=e.camera.up.dot(r);let i=this.parent?this.parent.state.visibilityPlaneMask:El.MASK_INDETERMINATE;this.state.visibilityPlaneMask=e.cullingVolume.computeVisibilityWithPlaneMask(n,i),this.state.visible=this.state.visibilityPlaneMask!==El.MASK_OUTSIDE,e.cameraCulling||(this.state.visible=!0)}else this.state.distanceToCamera=0,this.state.centerZDepth=0,this.state.visibilityPlaneMask=El.MASK_INDETERMINATE,this.state.visible=!0;if((this.levelOfContent<=e.minLevelOfDetail||this.geometricError>=e.maxGeometricError)&&(this.state.visible=!0),this.viewerRequestVolume){let n;n=this.viewerRequestVolume instanceof Dl?zl.copy(this.viewerRequestVolume):this.viewerRequestVolume instanceof Ol?Rl.copy(this.viewerRequestVolume):this.viewerRequestVolume.clone(),n.applyMatrix4(t),this.state.inRequestVolume=n.distanceSquaredToPoint(e.camera.position)<=0}else this.state.inRequestVolume=!0;this.state.screenSpaceError=this.getScreenSpaceError(e,this.state.distanceToCamera,!1)}get selected(){return this.state.selectedFrameNumber===this.tileset.frameNumber}get hasChildren(){return this.children.length>0}get siblingIndex(){var e,t;return(t=(e=this.parent)==null?void 0:e.children.indexOf(this))==null?0:t}get hasTilesetContent(){return this.children.length>0&&this.type===`TILESET`}get hasRenderContent(){return this.type===`SCENEGRAPH`}get contentAvailable(){var e;return this.hasRenderContent&&((e=this.content)==null?void 0:e.loadState)===`READY`}get hasUnloadedContent(){var e;return((e=this.content)==null?void 0:e.loadState)===`UNLOADED`}get hasEmptyContent(){return this.type===`EMPTY`}get contentReady(){var e;return((e=this.content)==null?void 0:e.loadState)===`READY`||this.hasEmptyContent}get contentByteLength(){return this.content?this.content.byteLength:0}get contentMemoryUsage(){return this.content?this.content.memoryUsage:0}getScreenSpaceError(e,t,n){let r=this.tileset.transform.getMaxScaleOnAxis(),i=this.parent?this.parent.geometricError:this.tileset.geometricError,a=r*(n?i:this.geometricError);if(a===0)return 0;let o=e.height,s=e.sseDenominator;return e.camera.type===`OrthographicCamera`?a/(1/(e.camera.projectionMatrix.elements[5]/2)/o*.9):a/(Math.max(t,.001)*s/o)}getPriority(e){let t=this.refine===`ADD`||e.skipLevelOfDetail;if(t&&!this.state.visible||e.frameNumber-this.state.touchedFrameNumber>=1)return-1;let n=this.parent,r=n&&(!t||this.state.screenSpaceError===0)?n.state.screenSpaceError:this.state.screenSpaceError,i=this.tileset.root?this.tileset.root.state.screenSpaceError:0;return Math.max(i-r,0)}},Vl=e=>Number(e);function Hl(e,t=Vl,n=!1){let r,i=1/0;for(let n of e){let e=t(n);e<=i&&(r=n,i=e)}return isFinite(i)||(i=0),n?[r,i]:r}function Ul(e,t,n=(e,t)=>e===t){let r=e.length;if(r!==t.length)return!1;for(let i=0;i<r;i++)if(n(e[i],t[i])===!1)return!1;return!0}var Wl=new Set;function Gl(e){Wl.clear();let t=[],n=e.length;for(let r=0;r<n;r++){let n=e[r];Wl.has(n)||(t.push(n),Wl.add(n))}return Wl.clear(),t}var Kl=e=>e.distance,ql=(e,t)=>e.distance-t.distance;function Jl(e,t=!0,n=!1){if(n&&e.length>1){let t=Hl(e,Kl);t?(e[0]=t,e.length=1):e.length=0}return t&&e.length>1&&e.sort(ql),e}var Yl=class{constructor(e,t){this.position=e,this.indices=t}getPositionCount(){var e,t;let n=this.indices,r=this.position;return n?n.array.length/((e=n.stride)==null?1:e):r.array.length/((t=r.stride)==null?3:t)}getPositionByIndex(e,t){var n,r,i,a;let o=this.indices,s=this.position,c=e;if(o){let t=o.array,i=(n=o.stride)==null?1:n,a=(r=o.offset)==null?0:r;c=t[e*i+a]}let l=s.array,u=(i=s.stride)==null?3:i,d=(a=s.offset)==null?0:a;return c=c*u+d,t.x=l[c],t.y=l[c+1],t.z=l[c+2],t}createTree(e,t,n){throw Error(`not implemented`)}trianglesInSphere(e,t){throw Error(`not implemented`)}intersectRay(e,t,n=0,r=!1,i){throw Error(`not implemented`)}},Xl=class{constructor(e,t,n,r,i){this.id=e,this.extents=t,this.startIndex=n,this.endIndex=r,this.deepth=i}};function Zl(e,t){let n=new ArrayBuffer(t*36),r=new Float32Array(n),i=new Uint32Array(n),a=new Uint16Array(n),o=[e],s,c;for(;s=o.pop();)c=s.id*36/4,r[c]=s.extents[0],r[c+1]=s.extents[1],r[c+2]=s.extents[2],r[c+3]=s.extents[3],r[c+4]=s.extents[4],r[c+5]=s.extents[5],i[c+6]=s.startIndex,i[c+7]=s.endIndex,c=s.id*36/2,s.node0&&(a[c+16]=s.node0.id,o.push(s.node0)),s.node1&&(a[c+17]=s.node1.id,o.push(s.node1));return n}function Ql(e,t,n,r=0){let i=n.min.x-r,a=n.min.y-r,o=n.min.z-r,s=n.max.x+r,c=n.max.y+r,l=n.max.z+r,u=0,d=0,f=0,p=0,m=0,h=0;return t.x>=0?(u=(i-e.x)*t.x,d=(s-e.x)*t.x):(u=(s-e.x)*t.x,d=(i-e.x)*t.x),t.y>=0?(f=(a-e.y)*t.y,p=(c-e.y)*t.y):(f=(c-e.y)*t.y,p=(a-e.y)*t.y),u>p||f>d||((f>u||u!==u)&&(u=f),(p<d||d!==d)&&(d=p),t.z>=0?(m=(o-e.z)*t.z,h=(l-e.z)*t.z):(m=(l-e.z)*t.z,h=(o-e.z)*t.z),u>h||m>d)||((m>u||u!==u)&&(u=m),(h<d||d!==d)&&(d=h),d<0)?null:u>=0?u:0}var $l=class e{constructor(e,t,n){this.x=e,this.y=t,this.z=n}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,n){return this.x=e,this.y=t,this.z=n,this}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}add(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}subVectors(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}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){let t=this.x,n=this.y,r=this.z;return this.x=n*e.z-r*e.y,this.y=r*e.x-t*e.z,this.z=t*e.y-n*e.x,this}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}clone(){return new e(this.x,this.y,this.z)}},eu=class{constructor(e,t,n,r,i){this.pointA=e,this.pointB=t,this.pointC=n,this.index=r,this.intersectionPoint=i}},tu=class{constructor(e,t){this.min=e,this.max=t}},nu=1e-6,ru=new $l(0,0,0),iu=new $l(0,0,0),au=new $l(0,0,0),ou=new $l(0,0,0),su=class extends Yl{createTree(e,t,n){t=Math.min(t,16);let r=this.getPositionCount()/3,i=r>65535?new Uint32Array(r):new Uint16Array(r),a=new Float32Array(r*6),o=[],s=0,c=-1;if(n)for(let e=0;e<r;e+=1){let t=e*3,n=e*6,r,o,s,c,l,u,d;i[e]=e,this.getPositionByIndex(t,iu),this.getPositionByIndex(t+1,au),this.getPositionByIndex(t+2,ou),r=c=iu.x,d=au.x,d<r&&(r=d),d>c&&(c=d),d=ou.x,d<r&&(r=d),d>c&&(c=d),o=l=iu.y,d=au.y,d<o&&(o=d),d>l&&(l=d),d=ou.y,d<o&&(o=d),d>l&&(l=d),s=u=iu.z,d=au.z,d<s&&(s=d),d>u&&(u=d),d=ou.z,d<s&&(s=d),d>u&&(u=d),a[n]=r,a[n+1]=o,a[n+2]=s,a[n+3]=c,a[n+4]=l,a[n+5]=u}else{let e=1/0,t=1/0,o=1/0,s=-1/0,c=-1/0,l=-1/0;for(let n=0;n<r;n+=1){let r=n*3,u=n*6,d,f,p,m,h,g,_;i[n]=n,this.getPositionByIndex(r,iu),this.getPositionByIndex(r+1,au),this.getPositionByIndex(r+2,ou),d=m=iu.x,_=au.x,_<d&&(d=_),_>m&&(m=_),_=ou.x,_<d&&(d=_),_>m&&(m=_),f=h=iu.y,_=au.y,_<f&&(f=_),_>h&&(h=_),_=ou.y,_<f&&(f=_),_>h&&(h=_),p=g=iu.z,_=au.z,_<p&&(p=_),_>g&&(g=_),_=ou.z,_<p&&(p=_),_>g&&(g=_),a[u]=d,a[u+1]=f,a[u+2]=p,a[u+3]=m,a[u+4]=h,a[u+5]=g,d<e&&(e=d),m>s&&(s=m),f<t&&(t=f),h>c&&(c=h),p<o&&(o=p),g>l&&(l=g)}n=[e,t,o,s,c,l]}let l=new Xl(++c,n,0,r,0);o[s++]=l;let u=[],d=[0,1,2],f=function(e,t){return u[t]-u[e]};function p(n){let r=n.startIndex,l=n.endIndex,p=n.extents;u[0]=p[3]-p[0],u[1]=p[4]-p[1],u[2]=p[5]-p[2],d.sort(f);for(let u=0;u<3;u++){let f=d[u],m=p[f]+p[f+3],h=r,g=l-1,_=-1,v;for(;h<=g;)_===-1?(v=i[h],a[v*6+f]+a[v*6+f+3]<m?h++:_=v):(v=i[g],a[v*6+f]+a[v*6+f+3]>=m?g--:(i[h]=v,i[g]=_,_=-1,h++,g--));if(h>r&&h<l){let u=new Xl(++c,lu(i,a,r,h,nu),r,h,n.deepth+1);u.deepth<t&&u.endIndex-u.startIndex>e&&(o[s++]=u);let d=new Xl(++c,lu(i,a,h,l,nu),h,l,n.deepth+1);d.deepth<t&&d.endIndex-d.startIndex>e&&(o[s++]=d),n.node0=u,n.node1=d,n.startIndex=0,n.endIndex=0;break}}}for(;s;)p(o[--s]);return this.offsetArray=i,this.rootNodePacked=Zl(l,c+1),o.length=0,this}trianglesInSphere(e,t){let n=this.offsetArray,r=this.rootNodePacked,i=new Float32Array(r),a=new Uint32Array(r),o=new Uint16Array(r),s=[0],c=[],l;for(;(l=s.pop())!==void 0;){let r=l*36/4,u=cu(e.x,i[r],i[r+3])-e.x,d=cu(e.y,i[r+1],i[r+4])-e.y,f=cu(e.z,i[r+2],i[r+5])-e.z;if(u*u+d*d+f*f<=t*t){let e=a[r+6],t=a[r+7];for(let r=e;r<t;r++){let e=n[r];c.push(e)}let i=l*36/2,u=o[i+16],d=o[i+17];u&&s.push(u),d&&s.push(d)}}let u=c.length,d=new Float32Array(u*9);for(let e=0;e<u;e++){let t=c[e]*3;this.getPositionByIndex(t,ru),d[e*9]=ru.x,d[e*9+1]=ru.y,d[e*9+2]=ru.z,this.getPositionByIndex(t+1,ru),d[e*9+3]=ru.x,d[e*9+4]=ru.y,d[e*9+5]=ru.z,this.getPositionByIndex(t+2,ru),d[e*9+6]=ru.x,d[e*9+7]=ru.y,d[e*9+8]=ru.z}return d}intersectRay(e,t,n=0,r=!1,i){let a=[],o=this.offsetArray,s=this.rootNodePacked,c=new Float32Array(s),l=new Uint32Array(s),u=new Uint16Array(s),d=new $l(1/t.x,1/t.y,1/t.z),f=[0],p,m=1/0,h=new tu(new $l(0,0,0),new $l(0,0,0)),g=new $l(0,0,0),_=new $l(0,0,0),v=new $l(0,0,0);for(;(p=f.pop())!==void 0;){let s=p*36/4;h.min.x=c[s],h.min.y=c[s+1],h.min.z=c[s+2],h.max.x=c[s+3],h.max.y=c[s+4],h.max.z=c[s+5];let y=Ql(e,d,h,n);if(y===null||r&&y>m)continue;let b=e.x,x=e.y,S=e.z,C=t.x,w=t.y,T=t.z,E=l[s+6],D=l[s+7];for(let e=E;e<D;e++){let t=o[e],n=t*3;this.getPositionByIndex(n,g);let s=g.x,c=g.y,l=g.z;this.getPositionByIndex(n+1,_);let u=_.x,d=_.y,f=_.z;this.getPositionByIndex(n+2,v);let p=v.x,h=v.y,y=v.z,E=u-s,D=d-c,O=f-l,k=p-s,A=h-c,j=y-l,M=D*j-O*A,N=O*k-E*j,ee=E*A-D*k,P=C*M+w*N+T*ee,te;if(P>0)te=1;else if(P<0)te=-1,P=-P;else continue;let ne=b-s,re=x-c,ie=S-l,ae=te*(C*(re*j-ie*A)+w*(ie*k-ne*j)+T*(ne*A-re*k));if(ae<0)continue;let oe=te*(C*(D*ie-O*re)+w*(O*ne-E*ie)+T*(E*re-D*ne));if(oe<0||ae+oe>P)continue;let se=-te*(ne*M+re*N+ie*ee);if(se<0)continue;let ce=se/P,F=new eu(g,_,v,t,new $l(b+C*ce,x+w*ce,S+T*ce));(!i||i(F))&&(r?ce<m&&(m=ce,a.length>0&&(a.length=0),a.push(F)):a.push(F))}let O=p*36/2,k=u[O+16],A=u[O+17];k&&f.push(k),A&&f.push(A)}return a}};function cu(e,t,n){return e<t?t:e>n?n:e}function lu(e,t,n,r,i){if(n>=r)return[0,0,0,0,0,0];let a=1/0,o=1/0,s=1/0,c=-1/0,l=-1/0,u=-1/0;for(let i=n;i<r;i++){let n=e[i]*6,r=t[n];r<a&&(a=r),r=t[n+1],r<o&&(o=r),r=t[n+2],r<s&&(s=r),r=t[n+3],r>c&&(c=r),r=t[n+4],r>l&&(l=r),r=t[n+5],r>u&&(u=r)}return[a-i,o-i,s-i,c+i,l+i,u+i]}(function(){let e=new $l(0,0,0),t=new $l(0,0,0),n=new $l(0,0,0),r=new $l(0,0,0);return function(i,a,o,s,c){t.subVectors(a,i),n.subVectors(o,i),r.crossVectors(t,n);let l=c.dot(r),u;if(l>0)u=1;else if(l<0)u=-1,l=-l;else return null;e.subVectors(s,i);let d=u*c.dot(n.crossVectors(e,n));if(d<0)return null;let f=u*c.dot(t.cross(e));if(f<0||d+f>l)return null;let p=-u*e.dot(r);if(p<0)return null;let m=p/l;return new $l(0,0,0).copy(c).multiplyScalar(m).add(s)}})();var uu=1e-6,du=[`x`,`y`,`z`],fu=new $l(0,0,0),pu=class extends Yl{createTree(e,t,n){t=Math.min(t,16);let r=this.getPositionByIndex.bind(this),i=this.getPositionCount(),a=i>65535?new Uint32Array(i):new Uint16Array(i),o=[],s=0,c=-1;if(n)for(let e=0;e<i;e+=1)a[e]=e;else{r(0,fu);let e=fu.x,t=fu.y,o=fu.z,s=e,c=t,l=o;for(let n=0;n<i;n+=1){a[n]=n,r(n,fu);let i=fu.x,u=fu.y,d=fu.z;i<e?e=i:i>s&&(s=i),u<t?t=u:u>c&&(c=u),d<o?o=d:d>l&&(l=d)}n=[e,t,o,s,c,l]}let l=new Xl(++c,n,0,i,0);o[s++]=l;let u=[],d=[0,1,2],f=function(e,t){return u[t]-u[e]};function p(n){let i=n.startIndex,l=n.endIndex,p=n.extents;u[0]=p[3]-p[0],u[1]=p[4]-p[1],u[2]=p[5]-p[2];let m=d.sort(f)[0],h=du[m],g=(p[m]+p[m+3])/2,_=i,v=l-1,y=-1,b;for(;_<=v;)y===-1?(b=a[_],r(b,fu),fu[h]<g?_++:y=b):(b=a[v],r(b,fu),fu[h]>=g?v--:(a[_]=b,a[v]=y,y=-1,_++,v--));if(_>i){let r=p.slice();r[m+3]=g+uu;let a=new Xl(++c,r,i,_,n.deepth+1);a.deepth<t&&a.endIndex-a.startIndex>e&&(o[s++]=a),n.node0=a}if(l>_){let r=p.slice();r[m]=g-uu;let i=new Xl(++c,r,_,l,n.deepth+1);i.deepth<t&&i.endIndex-i.startIndex>e&&(o[s++]=i),n.node1=i}n.startIndex=0,n.endIndex=0}for(;s;)p(o[--s]);return this.offsetArray=a,this.rootNodePacked=Zl(l,c+1),o.length=0,this}intersectRay(e,t,n=0,r=!1,i){let a=[],o=this.offsetArray,s=this.rootNodePacked,c=new Float32Array(s),l=new Uint32Array(s),u=new Uint16Array(s),d=n*n,f=new $l(1/t.x,1/t.y,1/t.z),p=[0],m,h=1/0,g=new tu(new $l(0,0,0),new $l(0,0,0)),_=new $l(0,0,0);for(;(m=p.pop())!==void 0;){let s=m*36/4;g.min.x=c[s],g.min.y=c[s+1],g.min.z=c[s+2],g.max.x=c[s+3],g.max.y=c[s+4],g.max.z=c[s+5];let v=Ql(e,f,g,n);if(v===null||r&&v>h)continue;let y=l[s+6],b=l[s+7];for(let n=y;n<b;n++){let s=o[n];this.getPositionByIndex(s,_);let c=_.x,l=_.y,u=_.z,f=e.x,p=e.y,m=e.z,g=t.x,v=t.y,y=t.z,b=g*(c-f)+v*(l-p)+y*(u-m);if(b>0?(f+=g*b,p+=v*b,m+=y*b):b<0&&(b=0),g=c-f,v=l-p,y=u-m,g*g+v*v+y*y<=d){let e=new eu(_,_,_,s,new $l(f,p,m));(!i||i(e))&&(r?b<h&&(h=b,a.length>0&&(a.length=0),a.push(e)):a.push(e))}}let x=m*36/2,S=u[x+16],C=u[x+17];S&&p.push(S),C&&p.push(C)}return a}},mu="(function(){var e=class{constructor(e,t){this.position=e,this.indices=t}getPositionCount(){let e=this.indices,t=this.position;return e?e.array.length/(e.stride??1):t.array.length/(t.stride??3)}getPositionByIndex(e,t){let n=this.indices,r=this.position,i=e;if(n){let t=n.array,r=n.stride??1,a=n.offset??0;i=t[e*r+a]}let a=r.array,o=r.stride??3,s=r.offset??0;return i=i*o+s,t.x=a[i],t.y=a[i+1],t.z=a[i+2],t}createTree(e,t,n){throw Error(`not implemented`)}trianglesInSphere(e,t){throw Error(`not implemented`)}intersectRay(e,t,n=0,r=!1,i){throw Error(`not implemented`)}},t=class{constructor(e,t,n,r,i){this.id=e,this.extents=t,this.startIndex=n,this.endIndex=r,this.deepth=i}};function n(e,t){let n=new ArrayBuffer(t*36),r=new Float32Array(n),i=new Uint32Array(n),a=new Uint16Array(n),o=[e],s,c;for(;s=o.pop();)c=s.id*36/4,r[c]=s.extents[0],r[c+1]=s.extents[1],r[c+2]=s.extents[2],r[c+3]=s.extents[3],r[c+4]=s.extents[4],r[c+5]=s.extents[5],i[c+6]=s.startIndex,i[c+7]=s.endIndex,c=s.id*36/2,s.node0&&(a[c+16]=s.node0.id,o.push(s.node0)),s.node1&&(a[c+17]=s.node1.id,o.push(s.node1));return n}function r(e,t,n,r=0){let i=n.min.x-r,a=n.min.y-r,o=n.min.z-r,s=n.max.x+r,c=n.max.y+r,l=n.max.z+r,u=0,d=0,f=0,p=0,m=0,h=0;return t.x>=0?(u=(i-e.x)*t.x,d=(s-e.x)*t.x):(u=(s-e.x)*t.x,d=(i-e.x)*t.x),t.y>=0?(f=(a-e.y)*t.y,p=(c-e.y)*t.y):(f=(c-e.y)*t.y,p=(a-e.y)*t.y),u>p||f>d||((f>u||u!==u)&&(u=f),(p<d||d!==d)&&(d=p),t.z>=0?(m=(o-e.z)*t.z,h=(l-e.z)*t.z):(m=(l-e.z)*t.z,h=(o-e.z)*t.z),u>h||m>d)||((m>u||u!==u)&&(u=m),(h<d||d!==d)&&(d=h),d<0)?null:u>=0?u:0}var i=class e{constructor(e,t,n){this.x=e,this.y=t,this.z=n}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,n){return this.x=e,this.y=t,this.z=n,this}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}add(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}subVectors(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}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){let t=this.x,n=this.y,r=this.z;return this.x=n*e.z-r*e.y,this.y=r*e.x-t*e.z,this.z=t*e.y-n*e.x,this}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}clone(){return new e(this.x,this.y,this.z)}},a=class{constructor(e,t,n,r,i){this.pointA=e,this.pointB=t,this.pointC=n,this.index=r,this.intersectionPoint=i}},o=class{constructor(e,t){this.min=e,this.max=t}};let s=1e-6,c=new i(0,0,0),l=new i(0,0,0),u=new i(0,0,0),d=new i(0,0,0);var f=class extends e{createTree(e,r,i){r=Math.min(r,16);let a=this.getPositionCount()/3,o=a>65535?new Uint32Array(a):new Uint16Array(a),c=new Float32Array(a*6),f=[],p=0,h=-1;if(i)for(let e=0;e<a;e+=1){let t=e*3,n=e*6,r,i,a,s,f,p,m;o[e]=e,this.getPositionByIndex(t,l),this.getPositionByIndex(t+1,u),this.getPositionByIndex(t+2,d),r=s=l.x,m=u.x,m<r&&(r=m),m>s&&(s=m),m=d.x,m<r&&(r=m),m>s&&(s=m),i=f=l.y,m=u.y,m<i&&(i=m),m>f&&(f=m),m=d.y,m<i&&(i=m),m>f&&(f=m),a=p=l.z,m=u.z,m<a&&(a=m),m>p&&(p=m),m=d.z,m<a&&(a=m),m>p&&(p=m),c[n]=r,c[n+1]=i,c[n+2]=a,c[n+3]=s,c[n+4]=f,c[n+5]=p}else{let e=1/0,t=1/0,n=1/0,r=-1/0,s=-1/0,f=-1/0;for(let i=0;i<a;i+=1){let a=i*3,p=i*6,m,h,g,_,v,y,b;o[i]=i,this.getPositionByIndex(a,l),this.getPositionByIndex(a+1,u),this.getPositionByIndex(a+2,d),m=_=l.x,b=u.x,b<m&&(m=b),b>_&&(_=b),b=d.x,b<m&&(m=b),b>_&&(_=b),h=v=l.y,b=u.y,b<h&&(h=b),b>v&&(v=b),b=d.y,b<h&&(h=b),b>v&&(v=b),g=y=l.z,b=u.z,b<g&&(g=b),b>y&&(y=b),b=d.z,b<g&&(g=b),b>y&&(y=b),c[p]=m,c[p+1]=h,c[p+2]=g,c[p+3]=_,c[p+4]=v,c[p+5]=y,m<e&&(e=m),_>r&&(r=_),h<t&&(t=h),v>s&&(s=v),g<n&&(n=g),y>f&&(f=y)}i=[e,t,n,r,s,f]}let g=new t(++h,i,0,a,0);f[p++]=g;let _=[],v=[0,1,2],y=function(e,t){return _[t]-_[e]};function b(n){let i=n.startIndex,a=n.endIndex,l=n.extents;_[0]=l[3]-l[0],_[1]=l[4]-l[1],_[2]=l[5]-l[2],v.sort(y);for(let u=0;u<3;u++){let d=v[u],g=l[d]+l[d+3],_=i,y=a-1,b=-1,x;for(;_<=y;)b===-1?(x=o[_],c[x*6+d]+c[x*6+d+3]<g?_++:b=x):(x=o[y],c[x*6+d]+c[x*6+d+3]>=g?y--:(o[_]=x,o[y]=b,b=-1,_++,y--));if(_>i&&_<a){let l=new t(++h,m(o,c,i,_,s),i,_,n.deepth+1);l.deepth<r&&l.endIndex-l.startIndex>e&&(f[p++]=l);let u=new t(++h,m(o,c,_,a,s),_,a,n.deepth+1);u.deepth<r&&u.endIndex-u.startIndex>e&&(f[p++]=u),n.node0=l,n.node1=u,n.startIndex=0,n.endIndex=0;break}}}for(;p;)b(f[--p]);return this.offsetArray=o,this.rootNodePacked=n(g,h+1),f.length=0,this}trianglesInSphere(e,t){let n=this.offsetArray,r=this.rootNodePacked,i=new Float32Array(r),a=new Uint32Array(r),o=new Uint16Array(r),s=[0],l=[],u;for(;(u=s.pop())!==void 0;){let r=u*36/4,c=p(e.x,i[r],i[r+3])-e.x,d=p(e.y,i[r+1],i[r+4])-e.y,f=p(e.z,i[r+2],i[r+5])-e.z;if(c*c+d*d+f*f<=t*t){let e=a[r+6],t=a[r+7];for(let r=e;r<t;r++){let e=n[r];l.push(e)}let i=u*36/2,c=o[i+16],d=o[i+17];c&&s.push(c),d&&s.push(d)}}let d=l.length,f=new Float32Array(d*9);for(let e=0;e<d;e++){let t=l[e]*3;this.getPositionByIndex(t,c),f[e*9]=c.x,f[e*9+1]=c.y,f[e*9+2]=c.z,this.getPositionByIndex(t+1,c),f[e*9+3]=c.x,f[e*9+4]=c.y,f[e*9+5]=c.z,this.getPositionByIndex(t+2,c),f[e*9+6]=c.x,f[e*9+7]=c.y,f[e*9+8]=c.z}return f}intersectRay(e,t,n=0,s=!1,c){let l=[],u=this.offsetArray,d=this.rootNodePacked,f=new Float32Array(d),p=new Uint32Array(d),m=new Uint16Array(d),h=new i(1/t.x,1/t.y,1/t.z),g=[0],_,v=1/0,y=new o(new i(0,0,0),new i(0,0,0)),b=new i(0,0,0),x=new i(0,0,0),S=new i(0,0,0);for(;(_=g.pop())!==void 0;){let o=_*36/4;y.min.x=f[o],y.min.y=f[o+1],y.min.z=f[o+2],y.max.x=f[o+3],y.max.y=f[o+4],y.max.z=f[o+5];let d=r(e,h,y,n);if(d===null||s&&d>v)continue;let C=e.x,w=e.y,T=e.z,E=t.x,D=t.y,O=t.z,k=p[o+6],A=p[o+7];for(let e=k;e<A;e++){let t=u[e],n=t*3;this.getPositionByIndex(n,b);let r=b.x,o=b.y,d=b.z;this.getPositionByIndex(n+1,x);let f=x.x,p=x.y,m=x.z;this.getPositionByIndex(n+2,S);let h=S.x,g=S.y,_=S.z,y=f-r,k=p-o,A=m-d,j=h-r,M=g-o,N=_-d,P=k*N-A*M,F=A*j-y*N,I=y*M-k*j,L=E*P+D*F+O*I,R;if(L>0)R=1;else if(L<0)R=-1,L=-L;else continue;let z=C-r,B=w-o,V=T-d,H=R*(E*(B*N-V*M)+D*(V*j-z*N)+O*(z*M-B*j));if(H<0)continue;let U=R*(E*(k*V-A*B)+D*(A*z-y*V)+O*(y*B-k*z));if(U<0||H+U>L)continue;let W=-R*(z*P+B*F+V*I);if(W<0)continue;let G=W/L,K=new a(b,x,S,t,new i(C+E*G,w+D*G,T+O*G));(!c||c(K))&&(s?G<v&&(v=G,l.length>0&&(l.length=0),l.push(K)):l.push(K))}let j=_*36/2,M=m[j+16],N=m[j+17];M&&g.push(M),N&&g.push(N)}return l}};function p(e,t,n){return e<t?t:e>n?n:e}function m(e,t,n,r,i){if(n>=r)return[0,0,0,0,0,0];let a=1/0,o=1/0,s=1/0,c=-1/0,l=-1/0,u=-1/0;for(let i=n;i<r;i++){let n=e[i]*6,r=t[n];r<a&&(a=r),r=t[n+1],r<o&&(o=r),r=t[n+2],r<s&&(s=r),r=t[n+3],r>c&&(c=r),r=t[n+4],r>l&&(l=r),r=t[n+5],r>u&&(u=r)}return[a-i,o-i,s-i,c+i,l+i,u+i]}(function(){let e=new i(0,0,0),t=new i(0,0,0),n=new i(0,0,0),r=new i(0,0,0);return function(a,o,s,c,l){t.subVectors(o,a),n.subVectors(s,a),r.crossVectors(t,n);let u=l.dot(r),d;if(u>0)d=1;else if(u<0)d=-1,u=-u;else return null;e.subVectors(c,a);let f=d*l.dot(n.crossVectors(e,n));if(f<0)return null;let p=d*l.dot(t.cross(e));if(p<0||f+p>u)return null;let m=-d*e.dot(r);if(m<0)return null;let h=m/u;return new i(0,0,0).copy(l).multiplyScalar(h).add(c)}})();let h=1e-6,g=[`x`,`y`,`z`],_=new i(0,0,0);var v=class extends e{createTree(e,r,i){r=Math.min(r,16);let a=this.getPositionByIndex.bind(this),o=this.getPositionCount(),s=o>65535?new Uint32Array(o):new Uint16Array(o),c=[],l=0,u=-1;if(i)for(let e=0;e<o;e+=1)s[e]=e;else{a(0,_);let e=_.x,t=_.y,n=_.z,r=e,c=t,l=n;for(let i=0;i<o;i+=1){s[i]=i,a(i,_);let o=_.x,u=_.y,d=_.z;o<e?e=o:o>r&&(r=o),u<t?t=u:u>c&&(c=u),d<n?n=d:d>l&&(l=d)}i=[e,t,n,r,c,l]}let d=new t(++u,i,0,o,0);c[l++]=d;let f=[],p=[0,1,2],m=function(e,t){return f[t]-f[e]};function v(n){let i=n.startIndex,o=n.endIndex,d=n.extents;f[0]=d[3]-d[0],f[1]=d[4]-d[1],f[2]=d[5]-d[2];let v=p.sort(m)[0],y=g[v],b=(d[v]+d[v+3])/2,x=i,S=o-1,C=-1,w;for(;x<=S;)C===-1?(w=s[x],a(w,_),_[y]<b?x++:C=w):(w=s[S],a(w,_),_[y]>=b?S--:(s[x]=w,s[S]=C,C=-1,x++,S--));if(x>i){let a=d.slice();a[v+3]=b+h;let o=new t(++u,a,i,x,n.deepth+1);o.deepth<r&&o.endIndex-o.startIndex>e&&(c[l++]=o),n.node0=o}if(o>x){let i=d.slice();i[v]=b-h;let a=new t(++u,i,x,o,n.deepth+1);a.deepth<r&&a.endIndex-a.startIndex>e&&(c[l++]=a),n.node1=a}n.startIndex=0,n.endIndex=0}for(;l;)v(c[--l]);return this.offsetArray=s,this.rootNodePacked=n(d,u+1),c.length=0,this}intersectRay(e,t,n=0,s=!1,c){let l=[],u=this.offsetArray,d=this.rootNodePacked,f=new Float32Array(d),p=new Uint32Array(d),m=new Uint16Array(d),h=n*n,g=new i(1/t.x,1/t.y,1/t.z),_=[0],v,y=1/0,b=new o(new i(0,0,0),new i(0,0,0)),x=new i(0,0,0);for(;(v=_.pop())!==void 0;){let o=v*36/4;b.min.x=f[o],b.min.y=f[o+1],b.min.z=f[o+2],b.max.x=f[o+3],b.max.y=f[o+4],b.max.z=f[o+5];let d=r(e,g,b,n);if(d===null||s&&d>y)continue;let S=p[o+6],C=p[o+7];for(let n=S;n<C;n++){let r=u[n];this.getPositionByIndex(r,x);let o=x.x,d=x.y,f=x.z,p=e.x,m=e.y,g=e.z,_=t.x,v=t.y,b=t.z,S=_*(o-p)+v*(d-m)+b*(f-g);if(S>0?(p+=_*S,m+=v*S,g+=b*S):S<0&&(S=0),_=o-p,v=d-m,b=f-g,_*_+v*v+b*b<=h){let e=new a(x,x,x,r,new i(p,m,g));(!c||c(e))&&(s?S<y&&(y=S,l.length>0&&(l.length=0),l.push(e)):l.push(e))}}let w=v*36/2,T=m[w+16],E=m[w+17];T&&_.push(T),E&&_.push(E)}return l}};function y(e){onmessage=t=>{Promise.resolve(t.data).then(t=>e(t)).then(({output:e,transfer:t})=>postMessage(e,t)).catch(e=>postMessage({$$error:e}))}}y(e=>Promise.resolve(e).then(e=>{let t=[],n=new Set;for(let r of e){let e;if(r.type===`mesh`)e=new f(r.attributes.position,r.indices);else if(r.type===`points`)e=new v(r.attributes.position,r.indices);else throw Error(`Invalid Type`);e.createTree(r.maxItemPerNode,r.maxTreeDepth,r.extents);let i={type:r.type,attributes:r.attributes,indices:r.indices,offsetArray:e.offsetArray,rootNodePacked:e.rootNodePacked};t.push(i);let a;for(let e in i.attributes){let t=i.attributes[e];t&&t.buffer instanceof ArrayBuffer&&n.add(t.buffer)}a=i.indices,a&&a.buffer instanceof ArrayBuffer&&n.add(a.buffer),a=i.offsetArray,a&&a.buffer instanceof ArrayBuffer&&n.add(a.buffer),n.add(i.rootNodePacked)}return{output:t,transfer:Array.from(n)}}))})();",hu=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,mu],{type:`text/javascript;charset=utf-8`});function gu(e){let t;try{if(t=hu&&(self.URL||self.webkitURL).createObjectURL(hu),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(mu),{name:e==null?void 0:e.name})}}var _u=new co(()=>new gu,4),vu=()=>!0,yu=new c.Ray,bu=new c.Matrix3,xu=new c.Matrix4,Su=new c.Vector3,Cu=new c.Vector3,wu=new c.Vector3,Tu=new WeakMap;function Eu(e,t,n,r){var i,a;let o=e.matrixWorld;xu.getInverse(o),yu.copy(n.ray).applyMatrix4(xu);let s=(i=n.hitFilter)==null?vu:i,l=(a=n.firstHitOnly)==null?!1:a,u=e.geometry,d=e.material,f=u.groups,p=u.index,m=t.intersectRay(yu.origin,yu.direction,0,l,t=>{var r;let i=t.index,a=i*3,l;if(Array.isArray(d)){if(f){for(let e of f)if(a>=e.start&&a-e.start<e.count){l=d[(r=e.materialIndex)==null?0:r];break}}}else l=d;if(!l)return!1;let u=t.intersectionPoint,m=new c.Vector3(u.x,u.y,u.z).applyMatrix4(o),h=n.ray.origin.distanceTo(m);if(h<n.near||h>n.far)return!1;let g=t.pointA,_=t.pointB,v=t.pointC,y=c.Triangle.getNormal(Su.set(g.x,g.y,g.z).applyMatrix4(o),Cu.set(_.x,_.y,_.z).applyMatrix4(o),wu.set(v.x,v.y,v.z).applyMatrix4(o),new c.Vector3),b=n.ray.direction.dot(y);if(l.side===c.FrontSide&&b>=0||l.side===c.BackSide&&b<=0)return!1;let x={distance:h,object:e,face:new c.Face3(p?p.array[a]:a,p?p.array[a+1]:a+1,p?p.array[a+2]:a+2,y),point:m,distanceToRay:0,faceIndex:i};return Tu.set(t,x),s(x)}),h=m.length;for(let e=0;e<h;e++){let t=Tu.get(m[e]);t&&r.push(t)}m.length=0}function Du(e,t,n,r){var i,a,o,s;let l=e.matrixWorld;bu.getNormalMatrix(l),xu.getInverse(l),yu.copy(n.ray).applyMatrix4(xu);let u=((a=(i=n.params.Points)==null?void 0:i.threshold)==null?1:a)*xu.getMaxScaleOnAxis(),d=(o=n.hitFilter)==null?vu:o,f=(s=n.firstHitOnly)==null?!1:s,p=e.geometry,m=p.index,h=p.getAttribute(`normal`),g=h instanceof c.BufferAttribute,_=t.intersectRay(yu.origin,yu.direction,u,f,t=>{let r=t.intersectionPoint,i=new c.Vector3(r.x,r.y,r.z).applyMatrix4(l),a=n.ray.origin.distanceTo(i);if(a<n.near||a>n.far)return!1;let o=t.pointA,s=Su.set(o.x,o.y,o.z).applyMatrix4(l),u=i.distanceTo(s);if(u/a>.07)return!1;let f=t.index,_=m?m.array[f]:f,v;if(g){let e=new c.Vector3().fromBufferAttribute(h,_).applyNormalMatrix(bu);v=new c.Face3(_,_,_,e)}else{let e=p.getAttribute(`scale`),t=p.getAttribute(`rotation`);if(e instanceof c.BufferAttribute&&t instanceof c.BufferAttribute){let r=new c.Vector3().fromBufferAttribute(e,_).toArray(),i=new c.Vector4().fromBufferAttribute(t,_).toArray(),a=new c.Quaternion(i[1],i[2],i[3],i[0]),[{axis:o}]=[{axis:`x`,scale:r[0]},{axis:`y`,scale:r[1]},{axis:`z`,scale:r[2]}].sort((e,t)=>e.scale-t.scale),s=new c.Vector3(0,0,0);s[o]=1,s.applyQuaternion(a).applyNormalMatrix(bu),n.ray.direction.dot(s)>0&&s.negate(),v=new c.Face3(_,_,_,s)}}let y={distance:a,object:e,face:v,point:i,distanceToRay:u,index:f};return Tu.set(t,y),d(y)}),v=_.length;for(let e=0;e<v;e++){let t=Tu.get(_[e]);t&&r.push(t)}_.length=0}var Ou=`__bvh_mesh__`,ku=c.Mesh.prototype.raycast;function Au(e,t){let n=ju(this);n?Eu(this,n,e,t):ku.call(this,e,t)}function ju(e){let t=e[Ou];return t instanceof su,t}function Mu(e,t){Object.assign(e,{[Ou]:t,raycast:Au})}var Nu=`__bvh_points__`,Pu=c.Points.prototype.raycast;function Fu(e,t){let n=Iu(this);n?Du(this,n,e,t):Pu.call(this,e,t)}function Iu(e){let t=e[Nu];return t instanceof pu,t}function Lu(e,t){Object.assign(e,{[Nu]:t,raycast:Fu})}function Ru(e,t=!0,n=100,r=10){let i=[];return e.traverse(e=>{(e instanceof c.Mesh||e instanceof c.Points)&&e.geometry instanceof c.BufferGeometry&&i.push(e)}),t?Promise.resolve().then(()=>{let e=[],t=new Set,a=null;for(let o=0;o<i.length;o++){let s=i[o],l=s.geometry;if(!(l instanceof c.BufferGeometry))continue;let u;if(s instanceof c.Mesh?u=`mesh`:s instanceof c.Points&&(u=`points`),!u)continue;let d=l.boundingBox,f=d?[d.min.x,d.min.y,d.min.z,d.max.x,d.max.y,d.max.z]:void 0,p={};for(let e in l.attributes){let n=l.attributes[e];n instanceof c.InterleavedBufferAttribute?(p[e]={array:n.data.array,stride:n.data.stride,offset:n.offset},a=n.data.array,a&&a.buffer instanceof ArrayBuffer&&t.add(a.buffer)):(p[e]={array:n.array},a=n.array,a&&a.buffer instanceof ArrayBuffer&&t.add(a.buffer))}let m,h=l.getIndex();h&&(h instanceof c.InterleavedBufferAttribute?(m={array:h.data.array,stride:h.data.stride,offset:h.offset},a=h.data.array,a&&a.buffer instanceof ArrayBuffer&&t.add(a.buffer)):(m={array:h.array},a=h.array,a&&a.buffer instanceof ArrayBuffer&&t.add(a.buffer)));let g={type:u,attributes:p,indices:m,maxItemPerNode:n,maxTreeDepth:r,extents:f};e.push(g)}return _u.postMessage(e,Array.from(t))}).then(t=>{for(let e=0;e<i.length;e++){let n=i[e],r=n.geometry,a=t[e];if(!(r instanceof c.BufferGeometry))continue;for(let e in a.attributes){let t=a.attributes[e].array,n=r.attributes[e];n instanceof c.InterleavedBufferAttribute?n.data.array=t:n.array=t}let o=r.getIndex();if(o&&a.indices){let e=a.indices.array;o instanceof c.InterleavedBufferAttribute?o.data.array=e:o.array=e}if(n instanceof c.Mesh){let e=new su(a.attributes.position,a.indices);e.offsetArray=a.offsetArray,e.rootNodePacked=a.rootNodePacked,Mu(n,e)}else if(n instanceof c.Points){let e=new pu(a.attributes.position,a.indices);e.offsetArray=a.offsetArray,e.rootNodePacked=a.rootNodePacked,Lu(n,e)}}return e}):Promise.resolve().then(()=>{for(let e of i)if(e instanceof c.Mesh){let t=e.geometry,i=t.boundingBox,a=i?[i.min.x,i.min.y,i.min.z,i.max.x,i.max.y,i.max.z]:void 0;if(t instanceof c.BufferGeometry){let i,o,s=t.attributes.position;i=s instanceof c.InterleavedBufferAttribute?{array:s.data.array,stride:s.data.stride,offset:s.offset}:{array:s.array};let l=t.getIndex();l&&(o=l instanceof c.InterleavedBufferAttribute?{array:l.data.array,stride:l.data.stride,offset:l.offset}:{array:l.array});let u=new su(i,o);u.createTree(n,r,a),Mu(e,u)}}else if(e instanceof c.Points){let t=e.geometry,i=t.boundingBox,a=i?[i.min.x,i.min.y,i.min.z,i.max.x,i.max.y,i.max.z]:void 0;if(t instanceof c.BufferGeometry){let i,o,s=t.attributes.position;i=s instanceof c.InterleavedBufferAttribute?{array:s.data.array,stride:s.data.stride,offset:s.offset}:{array:s.array};let l=t.getIndex();l&&(o=l instanceof c.InterleavedBufferAttribute?{array:l.data.array,stride:l.data.stride,offset:l.offset}:{array:l.array});let u=new pu(i,o);u.createTree(n,r,a),Lu(e,u)}}return e})}function zu(e,t,n){return e+(t-e)*n}function Bu(e,t,n,r){let i=(t*n+2*e)/Math.pow(n,3),a=-(2*t*n+3*e)/Math.pow(n,2),o=t,s=e;return i*Math.pow(r,3)+a*Math.pow(r,2)+o*r+s}function Vu(e,t,n,r){let i=(t*n+2*e)/Math.pow(n,3),a=-(2*t*n+3*e)/Math.pow(n,2),o=t;return 3*i*Math.pow(r,2)+2*a*r+o}function Hu(e,t,n,r){let i=r[1]-r[0];return e=Uu(e,r),t=Uu(t,r),t-e>i/2?zu(e+i,t,n):e-t>i/2?zu(e-i,t,n):zu(e,t,n)}function Uu(e,t){let n=t[1]-t[0];return e<t[0]?Uu(e+n,t):e>=t[1]?Uu(e-n,t):e}function Wu(e,t,n,r){return r?Hu(e,t,n,r):zu(e,t,n)}function Gu(e){let t=Number(e);return isNaN(t)||!isFinite(t)?0:t}var X=class{constructor(e){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=H(),this.startVelocity=0,this.duration=0,this.keyframes=[];for(let t in e){let n=e[t];typeof n==`object`?(this.value[t]=Gu(n.value),this.config[t]={circle:n.circle}):(this.value[t]=Gu(n),this.config[t]={circle:!1})}this.keyframes=[{progress:0,value:Object.assign({},this.value)},{progress:1,value:Object.assign({},this.value)}]}getProgress(e){let t=e-this.startTime;return t<0?0:t>=this.duration?1:1-Bu(1,this.startVelocity,this.duration,t)}getValue(e){for(let t=1;t<this.keyframes.length;t++)if(this.keyframes[t].progress>e){let n=this.keyframes[t-1],r=this.keyframes[t],i={};for(let t in this.config){let a=(e-n.progress)/(r.progress-n.progress);i[t]=Wu(n.value[t],r.value[t],a,this.config[t].circle)}return i}return Object.assign({},this.keyframes[this.keyframes.length-1].value)}getProgressVelocity(e){let t=e-this.startTime;return t>=this.duration?0:Vu(1,this.startVelocity,this.duration,t)}update(e){return this.ended?!0:(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(e))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)}getKeyFrameSegment(e){let t=this.getProgress(e);for(let e=1;e<this.keyframes.length;e++)if(this.keyframes[e].progress>t)return[this.keyframes[e-1],this.keyframes[e]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]}getTargetKeyframe(){return this.keyframes[this.keyframes.length-1]}set(e,t,n=0,r){var i;isNaN(t)&&(t=0),isNaN(n)&&(n=0),r=r==null?H():r;let a=this.getProgress(r),o=this.getValue(a),s={};for(let t in this.config)s[t]=(i=e[t])==null?o[t]:i;let c=[{progress:0,value:o},{progress:1,value:s}];return this.setKeyframes(c,t,n,r)}setKeyframes(e,t,n=0,r){if(e.length<2)throw Error(`keyframes invalid.`);return isNaN(t)&&(t=0),isNaN(n)&&(n=0),this.callbacks&&(this.callbacks[1](Error(`motion aborted.`)),this.callbacks=void 0),new Promise((i,a)=>{r=r==null?H():r,this.progress=0,this.ended=!1,this.startTime=r,this.startVelocity=n,this.keyframes=e,this.duration=t,t===0?(this.progress=1,this.value=Object.assign({},e[e.length-1].value)):this.value=Object.assign({},e[0].value),this.callbacks=[i,a]})}dispose(){this.callbacks&&(this.callbacks[1](Error(`motion dispose.`)),this.callbacks=void 0)}},Ku=Math.PI,qu=1.70158;qu*1.525,qu+1,2*Ku/3,2*Ku/4.5;var Ju=function(e){return e},Yu=function(e){return e*e*e},Xu=function(e){return e*e*e*e},Zu=500,Qu=new WeakMap,$u=new c.Vector3,ed=new c.Matrix4,td=class e extends c.Object3D{constructor(e,t,n,r=K){super(),this.name=e,this.materials=[],this.pbmObjects=[],this.contentObject=t,this.animations=n,this.appearMotion=new X({appear:0}),this.disposers=[r],this.add(t),t.traverse(e=>{if(e instanceof c.Mesh||e instanceof c.Points){let t=e.material;if(Array.isArray(t))for(let e=0;e<t.length;e++)this.materials.push(t[e]);else this.materials.push(t)}(e instanceof bn||e instanceof xn||e instanceof An||e instanceof $n)&&this.pbmObjects.push(e)})}generateBvhTree(){return Ru(this,!0,200,20)}intersectRaycaster(e,t){let n=t==null?[]:t,r=e.hitFilter;e.hitFilter=t=>{if(t.object instanceof An&&t.object.material.pointBack===`HIDDEN`&&t.face&&t.face.normal.angleTo(e.ray.direction)<Math.PI/2)return!1;let n=0,i=-1;if((t.object instanceof bn||t.object instanceof xn||t.object instanceof An)&&t.face){let e=Array.isArray(t.object.material)?t.object.material[t.face.materialIndex]:t.object.material;if(e){n=e.floorIndex,i=e.shownFloorIndex;for(let r of e.clippers)if(!(typeof r.floorIndex==`number`&&r.floorIndex!==n)&&(ed.getInverse(r.clippingBoxMatrix),$u.copy(t.point).applyMatrix4(ed),Math.abs($u.x)<.5&&Math.abs($u.y)<.5&&Math.abs($u.z)<.5))return!1}}let a=i;return e.floorIndex===void 0?e.floor!==void 0&&(a=e.floor===null?-1:e.floor):a=e.floorIndex,a>=0&&n!==a?!1:(Object.assign(t,{floorIndex:n,floor:n}),r?r.call(e,t):!0)};let i=this.children.slice(),a;for(;a=i.pop();)if(a.visible){a.raycast(e,n);for(let e=0,t=a.children.length;e<t;e++)i.push(a.children[e])}return e.hitFilter=r,Jl(n,e.sortByDistance,e.firstHitOnly),n}update(e,t,n,r,i,a){let o=!1;r.visible&&i.state.selectedFrameNumber===i.tileset.frameNumber?this.appearMotion.getTargetKeyframe().value.appear!==1&&this.appearMotion.set({appear:1},Zu).catch(K):this.appearMotion.getTargetKeyframe().value.appear!==0&&this.appearMotion.set({appear:0},0).catch(K),this.appearMotion.ended!==!0&&this.appearMotion.update(t.time);for(let s of this.pbmObjects)s instanceof bn||s instanceof xn?nd(s,this.appearMotion,e,t,n,i,a)===!0&&(o=!0):s instanceof An?rd(s,this.appearMotion,e,t,n,i,a)===!0&&(o=!0):s instanceof $n&&id(s,this.appearMotion,e,t,n,r,i,a)===!0&&(o=!0);return o}dispose(){for(let e of this.disposers)e();this.disposers.length=0,this.pbmObjects.length=0}clone(){return new e(this.name,this.contentObject.clone(),this.animations)}};function nd(e,t,n,r,i,a,o){var s,l;let u=!1;if(Qu.get(e)!==o.versionNumber){Qu.set(e,o.versionNumber),u=!0,e.castShadow=o.castShadow,e.receiveShadow=o.receiveShadow;let t=e.material;for(let e of t)e.customShaders=o.customShaders,e.pano0=o.pano0,e.pano1=o.pano1,e.pano0Depth=o.pano0Depth,e.pano1Depth=o.pano1Depth,e.panoFilter=(l=(s=o.panoFilter)==null?void 0:s.toValue())==null?null:l,e.refinedScreen=o.refinedScreen,e.modelAlpha=o.modelAlpha,e.progress=o.progress,e.transition=o.transition,e.opacity=o.opacity,e.floorStyle=o.floorStyle,e.constantColor=o.constantColor,e.shownFloorIndex=o.shownFloorIndex,e.clippers=o.clippers,e.brightness=o.brightness,e.useHQWeight=o.useHQWeight,e.useHQDepth=o.useHQDepth,e.colorSaturation=o.colorSaturation,e.colorBrightness=o.colorBrightness,e.gradientTexture=o.gradientTexture,e.vertexMarks=o.vertexMarks,e.modelBoundingMax.copy(o.boundingBox.max),e.modelBoundingMin.copy(o.boundingBox.min),e.shaderType===`none`?(e.transparent=!0,e.blending=c.NormalBlending,e.blendDst=c.OneMinusSrcAlphaFactor,e.blendEquation=c.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthWrite=!1,e.depthTest=!0):(e.transparent=e.alphaMode===`BLEND`,e.blending=c.NormalBlending,e.blendDst=c.OneMinusSrcAlphaFactor,e.blendEquation=c.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthWrite=!0,e.depthTest=!0,o.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=c.AdditiveBlending),e.shownFloorIndex>-1&&e.shownFloorIndex!==e.floorIndex&&(e.transparent=!0),e.opacity<1&&(e.transparent=!0),e.alphaMap&&(e.transparent=!0),e.brightness<1&&(e.transparent=!0),e.modelAlpha<=0&&(e.transparent=!1),e.depthWrite=!e.transparent,o.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=c.AdditiveBlending))}return u}function rd(e,t,n,r,i,a,o){var s,l;let u=!1;if(o.pointAppearAnimation===!0&&a.refine===`ADD`&&a.tileset.rootMeta.pntsOrder===`RANDOM`){let n=e.geometry,r=a.tileset.currentMaxScreenSpaceError,i=a.state.screenSpaceError,o=(l=(s=a.parent)==null?void 0:s.state.screenSpaceError)==null?i:l,c=1;o!==i&&(c=(o-r)/(o-i)),c=U(c,0,1),c=Yu(c);let d=n.index?n.index.count:n.attributes.position?n.attributes.position.count:1/0,f=Math.floor(d*c*t.value.appear);n.drawRange.count!==f&&(n.setDrawRange(0,f),u=!0)}if(Qu.get(e)!==o.versionNumber){Qu.set(e,o.versionNumber),u=!0,e.castShadow=o.castShadow,e.receiveShadow=o.receiveShadow;let t=[e.material];for(let e of t)e.customShaders=o.customShaders,e.pointScale=o.pointScale,e.pointMinPixel=o.pointMinPixel,e.pointMaxPixel=o.pointMaxPixel,e.pointSize=o.pointSize,e.pointShape=o.pointShape,e.pointBack=o.pointBack,e.modelAlpha=o.modelAlpha,e.opacity=o.opacity,e.floorStyle=o.floorStyle,e.constantColor=o.constantColor,e.shownFloorIndex=o.shownFloorIndex,e.clippers=o.clippers,e.brightness=o.brightness,e.useHQWeight=o.useHQWeight,e.useHQDepth=o.useHQDepth,e.colorSaturation=o.colorSaturation,e.colorBrightness=o.colorBrightness,e.outlineGain=o.outlineGain,e.distanceGain=o.distanceGain,e.gradientTexture=o.gradientTexture,e.transparent=!1,e.blending=c.NormalBlending,e.blendDst=c.OneMinusSrcAlphaFactor,e.blendEquation=c.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.colorWrite=!0,e.depthWrite=!0,e.depthTest=!0,e.modelBoundingMax.copy(o.boundingBox.max),e.modelBoundingMin.copy(o.boundingBox.min),e.shownFloorIndex>-1&&(e.transparent=e.shownFloorIndex!==e.floorIndex),e.modelAlpha<1&&(e.transparent=!0),e.opacity<1&&(e.transparent=!0),e.brightness<1&&(e.transparent=!0),o.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=c.AdditiveBlending),e.useHQWeight&&(e.depthWrite=!1,e.blending=c.CustomBlending,e.blendSrc=c.SrcAlphaFactor,e.blendSrcAlpha=c.SrcAlphaFactor,e.blendDst=c.OneFactor,e.blendDstAlpha=c.OneFactor),e.useHQDepth&&(e.colorWrite=!1)}return u}function id(e,t,n,r,i,a,o,s){let l=!1,u=a.uuid;return e.gsViewLayerKey!==u&&(e.gsViewLayerKey=u,l=!0),e.gsClippers!==s.clippers&&(e.gsClippers=s.clippers,l=!0),e.updateMatrix(),e.updateMatrixWorld(),e.usedSHDegree=s.gaussianSplattingSHDegree,e.lastMatrixWorld?e.transformChanged=!e.lastMatrixWorld.equals(e.matrixWorld):(e.lastMatrixWorld=new c.Matrix4,e.transformChanged=!0,l=!0),e.lastMatrixWorld.copy(e.matrixWorld),e.transformChanged&&(l=!0),l}var ad=class{constructor(e,t,n){this.id=e,this.name=t.name,this.visible=!1,this.tileset=n,this.transform=new c.Matrix4,t.transform&&this.transform.fromArray(t.transform),this.transform.premultiply(this.tileset.root.transform),this.content={uri:t.file,byteLength:0,memoryUsage:0,loadState:`UNLOADED`,loadProgress:0,loadStateUpdateTime:H(),loadfailRetryDelay:0,data:void 0}}},od=class e extends c.Object3D{constructor(e,t,n=K){super(),this.name=e,this.contentObject=t,this.name=e,this.add(t),this.disposers=[n]}update(e,t,n,r,i,a){let o=this.contentObject.material[2];return o.uniforms.dashOffset.value=(o.uniforms.dashOffset.value-.003)%(o.uniforms.dashSize.value.x+o.uniforms.dashSize.value.y),!0}dispose(){for(let e of this.disposers)e();this.disposers.length=0}clone(){return new e(this.name,this.contentObject.clone())}},sd=new Map;function cd(e,t,n){if(n&&n.has(t))return n.get(t);let r=t.refine===`ADD`||e.skipLevelOfDetail,i=t.parent,a=i&&(!r||t.state.screenSpaceError===0)?i.state.screenSpaceError:t.state.screenSpaceError,o=t.tileset.root?t.tileset.root.state.screenSpaceError:0,s=Math.max(o-a,0);return n&&n.set(t,s),s}var ld=class{constructor(e,t){this.tileset=e,this.options=t,this.activeRequests=0,this.requestQueue=[]}reset(){for(let e of this.requestQueue)this.options.onTileSkip&&(e.tile.content&&this.tileset.options.tileUnloader(e.tile),this.options.onTileSkip(e.tile));this.requestQueue.length=0}update(e,t,n){let r=n.time,i=this.requestQueue,a=new Set(e);for(let e=0;e<i.length;e++){let t=i[e];if(a.has(t.tile)){a.delete(t.tile);continue}t.status===`WAITING`&&(i.splice(e,1),e--,this.options.onTileSkip&&this.options.onTileSkip(t.tile))}a.size>0&&(a.forEach(e=>{i.push({tile:e,status:`WAITING`,time:r,error:null})}),a.clear());let o=n.maxRequests;for(let e=0;e<i.length&&o>0;e++){let t=i[e];if(t.status===`DONE`)t.error===null?(o--,t.tile.content&&(t.tile.content.loadState=`READY`),this.options.onTileLoad&&this.options.onTileLoad(t.tile)):this.options.onTileError&&this.options.onTileError(t.tile,t.error),i.splice(e,1),e--;else if(t.status===`PENDING`&&r-t.time<1e3)break}switch(sd.clear(),t){case`SCREEN_SPACE_ERROR`:i.sort((e,t)=>e.tile.state.requestedFrameNumber===t.tile.state.requestedFrameNumber?e.tile.state.requestedFrameNumber===n.frameNumber?cd(n,e.tile,sd)-cd(n,t.tile,sd):e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:t.tile.state.requestedFrameNumber-e.tile.state.requestedFrameNumber);break;case`SCREEN_VERTICAL`:i.sort((e,t)=>e.tile.state.requestedFrameNumber===t.tile.state.requestedFrameNumber?e.tile.state.requestedFrameNumber===n.frameNumber?e.tile.state.centerScreenY===t.tile.state.centerScreenY?e.tile.state.centerZDepth===t.tile.state.centerZDepth?e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:e.tile.state.centerZDepth-t.tile.state.centerZDepth:e.tile.state.centerScreenY-t.tile.state.centerScreenY:e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:t.tile.state.requestedFrameNumber-e.tile.state.requestedFrameNumber);break;case`SCREEN_LEVEL_VERTICAL`:i.sort((e,t)=>e.tile.state.requestedFrameNumber===t.tile.state.requestedFrameNumber?e.tile.state.requestedFrameNumber===n.frameNumber?e.tile.level===t.tile.level?e.tile.state.centerScreenY===t.tile.state.centerScreenY?e.tile.state.centerZDepth===t.tile.state.centerZDepth?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.state.centerZDepth-t.tile.state.centerZDepth:e.tile.state.centerScreenY-t.tile.state.centerScreenY:e.tile.level-t.tile.level:e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:t.tile.state.requestedFrameNumber-e.tile.state.requestedFrameNumber);break;default:break}if(o=Math.max(n.maxRequests-this.activeRequests,0),!n.skipLevelOfDetail){let e=0,t=i.length;for(let r=0;r<t;r++){let t=i[r].tile;if(t.hasTilesetContent||t.contentParent===null||t.contentParent.state.selectedFrameNumber===n.frameNumber){let t=i.splice(r,1);i.splice(e++,0,...t)}}}for(let e=0;e<i.length&&o>0;e++){let t=i[e];t.status===`WAITING`&&(o--,t.status=`PENDING`,t.time=r,this.activeRequests++,this.tileset.options.tileLoader(t.tile).catch(e=>{t.error=e}).then(()=>{t.status=`DONE`,t.tile.content&&t.tile.content.loadState===`READY`&&(t.tile.content.loadState=`LOADING`),this.activeRequests--}))}}},ud=class{constructor(e,t,n){this.item=e,this.previous=t,this.next=n}},dd=class{constructor(){this.head=null,this.tail=null,this._length=0}get length(){return this._length}add(e){let t=new ud(e,this.tail,null);return this.tail?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),this._length++,t}remove(e){e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,this._length--}splice(e,t){e!==t&&(this.remove(t),this.insert(e,t))}insert(e,t){let n=e.next;e.next=t,this.tail===e?this.tail=t:n.previous=t,t.next=n,t.previous=e,this._length++}toArray(){let e=[],t=this.head;for(;t;)e.push(t),t=t.next;return e}},fd=class{constructor(e={}){this.options=e,this.cacheNodeMap=new WeakMap,this.list=new dd,this.sentinel=this.list.add(`sentinel`)}reset(){this.list.tail&&this.list.splice(this.list.tail,this.sentinel)}touchTile(e){let t=this.cacheNodeMap.get(e);t&&this.list.splice(this.sentinel,t)}loadTile(e){if(!this.cacheNodeMap.has(e)){let t=this.list.add(e);this.cacheNodeMap.set(e,t),this.options.onTileLoad&&this.options.onTileLoad(e)}}unloadTile(e){let t=this.cacheNodeMap.get(e);t&&(this.list.remove(t),this.cacheNodeMap.delete(e),this.options.onTileUnload&&this.options.onTileUnload(e))}unloadTiles(e){let t=this.list.head;for(;t!==this.sentinel&&e();){let e=t.item;t=t.next,this.unloadTile(e)}}toArray(){let e=[];for(let t of this.list.toArray())t.item!==`sentinel`&&e.push(t.item);return e}},pd=class{constructor(){this.map=new Map,this.array=[],this._length=0}get length(){return this._length}get(e){return this.array[e]}set(e,t){e>=this.length&&(this._length=e+1),this.map.has(this.array[e])&&this.map.delete(this.array[e]),this.array[e]=t,this.map.set(t,e)}delete(e){let t=this.map.get(e);t!==void 0&&t>=0&&(this.array.splice(t,1),this.map.delete(e),this._length--)}push(e){if(!this.map.has(e)){let t=this._length++;this.array[t]=e,this.map.set(e,t)}}pop(){let e=this.array[--this._length];return this.map.delete(e),this.array[this._length]=void 0,e}reset(){this.array=[],this.map=new Map,this._length=0}find(e){return this.map.has(e)}peek(){return this.array[this._length-1]}},md=class{constructor(e){this.tileset=e,this._canSelectTile=!0,this._loadAllTilesTraversalStack=new pd}traverse(e,t,n=[]){this.reset()}reset(){this._loadAllTilesTraversalStack.reset(),this.tileset.hasMixedContent=!1,this.tileset.needsRefinedTiles.clear(),this.tileset.requestedTiles.length=0,this.tileset.selectedTiles.length=0}updateTile(e,t){this.updateTileVisibility(e,t),e.state.shouldSelect=!1,e.state.finalResolution=!0}selectTile(e,t){this._canSelectTile&&e.contentAvailable&&e.state.selectedFrameNumber<t.frameNumber&&(e.state.selectedFrameNumber=t.frameNumber,this.tileset.selectedTiles.push(e),this.tileset.needsRefinedTiles.add(e))}loadTile(e,t){this._canSelectTile&&(e.state.requestedFrameNumber<t.frameNumber&&(e.state.requestedFrameNumber=t.frameNumber,e.content&&(e.content.loadState===`FAILED`&&t.time-e.content.loadStateUpdateTime>e.content.loadfailRetryDelay&&(e.content.loadState=`UNLOADED`,e.content.loadProgress=0,e.content.loadStateUpdateTime=t.time),e.content.loadState===`UNLOADED`&&this.tileset.requestedTiles.push(e))),this.tileset.needsRefinedTiles.add(e))}touchTile(e,t){this._canSelectTile&&(this.tileset.cache.touchTile(e),e.state.touchedFrameNumber=t.frameNumber)}canTraverse(e,t){return!e.state.inRequestVolume||e.hasRenderContent&&(e.levelOfContent>=t.maxLevelOfDetail||e.levelOfContent>=0&&e.geometricError<=t.minGeometricError)||e.children.length===0?!1:e.levelOfContent<t.minLevelOfDetail||e.geometricError>=t.maxGeometricError||e.hasTilesetContent?!0:e.state.screenSpaceError>this.tileset.currentMaxScreenSpaceError}updateTileVisibility(e,t){if(e.updateState(t),!e.state.visible||!e.state.inRequestVolume)return;let n=e.children.length>0;if(e.hasTilesetContent&&n){let n=e.children[0];this.updateTileVisibility(n,t),e.state.visible=n.state.visible;return}if(this.meetsScreenSpaceErrorEarly(e,t)){e.state.visible=!1;return}if(e.refine===`REPLACE`&&n&&!this.anyChildrenVisible(e,t)){e.state.visible=!1;return}}anyChildrenVisible(e,t){let n=!1,r=e.children;for(let e of r)e.updateState(t),n=n||e.state.visible;return n}meetsScreenSpaceErrorEarly(e,t){let{parent:n}=e;return!n||n.refine!==`ADD`||n.levelOfContent<t.minLevelOfDetail||n.geometricError>t.maxGeometricError?!1:n.levelOfContent>t.maxLevelOfDetail||n.levelOfContent>=0&&n.geometricError<t.minGeometricError?!0:e.getScreenSpaceError(t,e.state.distanceToCamera,!0)<this.tileset.currentMaxScreenSpaceError}sortTilesByDistanceToCamera(e){e.sort((e,t)=>t.state.distanceToCamera===0&&e.state.distanceToCamera===0?t.state.centerZDepth-e.state.centerZDepth:t.state.distanceToCamera-e.state.distanceToCamera)}},hd=class extends md{constructor(e){super(e),this._traversalStack=new pd,this._emptyTraversalStack=new pd}traverse(e,t,n=[]){super.traverse(e,t,n);for(let t of n)this._traversalStack.reset(),this._emptyTraversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t));this._traversalStack.reset(),this._emptyTraversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t))}reset(){super.reset(),this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(e,t){let n=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&n.push(e);n.length>0;){let e=n.pop(),r=e.parent,i=!r||r.state.shouldRefine,a=!1;this.canTraverse(e,t)&&(a=this.updateAndPushChildren(e,t,n)&&i);let o=!a&&i;e.hasRenderContent?e.refine===`ADD`?(this.loadTile(e,t),this.selectDesiredTile(e,t)):e.refine===`REPLACE`&&(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)):(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)),this.touchTile(e,t),e.state.shouldRefine=a}}updateAndPushChildren(e,t,n){let r=e.children;for(let e of r)this.updateTile(e,t);this.sortTilesByDistanceToCamera(r);let i=e.refine===`REPLACE`&&e.hasRenderContent,a=!1,o=!0;for(let e of r)if(e.levelOfContent<=t.minLevelOfDetail||e.geometricError>=t.maxGeometricError||e.state.visible&&e.state.inRequestVolume?(n.find(e)&&n.delete(e),n.push(e),a===!1&&(a=!0)):(i||t.loadSiblings)&&(this.loadTile(e,t),this.touchTile(e,t)),i){let n;n=e.state.inRequestVolume?e.hasRenderContent?e.contentAvailable:this.executeEmptyTraversal(e,t):!1,o=o&&n}return a||(o=!1),o}selectDesiredTile(e,t){e.contentAvailable&&super.selectTile(e,t)}executeEmptyTraversal(e,t){let n=!0,r=this._emptyTraversalStack;for(r.push(e);r.length>0&&n;){let e=r.pop(),i=!e.hasRenderContent&&this.canTraverse(e,t);if(!i&&!e.contentAvailable&&(n=!1),this.updateTile(e,t),e.state.visible||(this.loadTile(e,t),this.touchTile(e,t)),i){let t=e.children;for(let e of t)r.find(e)&&r.delete(e),r.push(e)}}return n}},gd=class extends md{constructor(e){super(e),this.baseScreenSpaceError=1024,this.skipScreenSpaceErrorFactor=16,this.skipLevels=1,this._traversalStack=new pd,this._descendantTraversalStack=new pd,this._selectionTraversalStack=new pd,this._selectionTraversalancestorStack=new pd}traverse(e,t,n=[]){super.traverse(e,t,n);for(let t of n)this._traversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t),this.traverseAndSelect(e,t));this.tileset.hasMixedContent=!1,this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t),this.traverseAndSelect(e,t))}reset(){super.reset(),this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset()}executeTraversal(e,t){let n=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&n.push(e);n.length>0;){let e=n.pop();this.updateTileAncestorContentLinks(e,t);let r=e.parent,i=!r||r.state.shouldRefine,a=!1;this.canTraverse(e,t)&&(a=this.updateAndPushChildren(e,t,n)&&i);let o=!a&&i;e.hasRenderContent?e.refine===`ADD`?(this.loadTile(e,t),this.selectDesiredTile(e,t)):e.refine===`REPLACE`&&(this.inBaseTraversal(e,this.baseScreenSpaceError)?(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)):o?(this.loadTile(e,t),this.selectDesiredTile(e,t)):this.reachedSkippingThreshold(e)&&this.loadTile(e,t)):(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)),this.touchTile(e,t),e.state.shouldRefine=a}}updateAndPushChildren(e,t,n){let r=e.children;for(let e of r)this.updateTile(e,t);this.sortTilesByDistanceToCamera(r);let i=!1;for(let e of r)e.levelOfContent<=t.minLevelOfDetail||e.geometricError>=t.maxGeometricError||e.state.visible&&e.state.inRequestVolume?(n.push(e),i===!1&&(i=!0)):t.loadSiblings&&(this.loadTile(e,t),this.touchTile(e,t));return i}selectDesiredTile(e,t){let n=e.contentAvailable?e:e.state.ancestorWithContentAvailable;n&&(n.state.shouldSelect=!0),e.contentAvailable||this.selectDescendants(e,t)}selectDescendants(e,t){let n=this._descendantTraversalStack;for(n.push(e);n.length>0;){let e=n.pop().children;for(let r of e)r.state.visible&&(r.contentAvailable?(this.updateTile(r,t),this.touchTile(r,t),this.selectTile(r,t)):n.push(r))}}reachedSkippingThreshold(e){let t=e.state.ancestorWithContent;return t!==null&&e.state.screenSpaceError<t.state.screenSpaceError/this.skipScreenSpaceErrorFactor&&e.levelOfContent>t.levelOfContent+this.skipLevels}updateTileAncestorContentLinks(e,t){e.state.ancestorWithContent=null,e.state.ancestorWithContentAvailable=null;let{parent:n}=e;if(!n)return;let r=!(n.hasRenderContent&&n.hasUnloadedContent)||n.state.requestedFrameNumber===t.frameNumber;e.state.ancestorWithContent=r?n:n.state.ancestorWithContent,e.state.ancestorWithContentAvailable=n.contentAvailable?n:n.state.ancestorWithContentAvailable}inBaseTraversal(e,t){return e.state.ancestorWithContent?e.parent&&e.state.screenSpaceError===0?e.parent.state.screenSpaceError>t:e.state.screenSpaceError>t:!0}traverseAndSelect(e,t){let n=this._selectionTraversalStack,r=this._selectionTraversalancestorStack,i;for(n.push(e);n.length>0||r.length>0;){if(r.length>0){let e=r.peek();if(e.state.stackLength===n.length){r.pop(),e!==i&&(e.state.finalResolution=!1),this.selectTile(e,t);continue}}let e=n.pop();if(!e)continue;let a=this.canTraverse(e,t);if(e.state.shouldSelect)if(e.refine===`ADD`)this.selectTile(e,t);else{if(e.state.selectionDepth=r.length,e.state.selectionDepth>0&&(e.tileset.hasMixedContent=!0),i=e,!a){this.selectTile(e,t);continue}r.push(e),e.state.stackLength=n.length}if(a)for(let t of e.children)t.state.visible&&n.push(t)}}},_d=class extends md{constructor(e){super(e),this._traversalStack=new pd}canTraverse(e,t){return!(!e.state.inRequestVolume||e.levelOfContent>=t.maxLevelOfDetail||e.levelOfContent>=0&&e.geometricError<=t.minGeometricError||e.children.length===0)}traverse(e,t,n){super.traverse(e,t,[]),this._traversalStack.reset(),e.updateState(t);for(let t of n)this._traversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,e.updateState(t),this.executeTraversal(e,t));this._traversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,e.updateState(t),this.executeTraversal(e,t))}reset(){super.reset(),this._traversalStack.reset()}executeTraversal(e,t){let n=this._traversalStack;for(n.push(e);n.length>0;){let e=n.pop(),r=e.refine===`ADD`,i=e.refine===`REPLACE`,a=this.canTraverse(e,t);a&&this.updateAndPushChildren(e,t,n),(r||i&&!a)&&(this.loadTile(e,t),this.touchTile(e,t),this.selectDesiredTile(e,t))}}updateAndPushChildren(e,t,n){let{children:r}=e;for(let e=0;e<r.length;++e){let i=r[e];i.updateState(t),i.state.visible&&n.push(i)}}selectDesiredTile(e,t){e.contentAvailable&&super.selectTile(e,t)}},vd=class{constructor(e,t){var n,r,i,a,o,s,l;if(this.id=e.tilesetUrl,this.transform=new c.Matrix4,this.hasMixedContent=!1,this.frameNumber=0,this.asset={version:e.asset.version,tilesetVersion:e.asset.tilesetVersion||``,gltfUpAxis:(n=e.asset.gltfUpAxis)==null?`Y`:n,overview:e.asset.overview,trajectories:(i=(r=e.asset.trajectories)==null?void 0:r.list)==null?[]:i,extras:e.asset.extras},this.rootMeta=(a=e.rootMeta)==null?{}:a,this.pointLength=(o=this.rootMeta.numTotalPoints)==null?1/0:o,this.floorLength=(s=this.rootMeta.numFloors)==null?1:s,this.properties=(l=e.properties)==null?{}:l,this.options=t,this.requestedTiles=[],this.selectedTiles=[],this.unloadTiles=[],this.needsRefinedTiles=new Set,this.selectedTrajectories=[],this.normalTraverser=new hd(this),this.skipTraverser=new gd(this),this.mostDetailTraverser=new _d(this),this.cache=new fd({onTileLoad:e=>{this.cacheMemoryUsageInBytes+=e.contentMemoryUsage},onTileUnload:e=>{this.cacheMemoryUsageInBytes-=e.contentMemoryUsage,this.unloadTiles.push(e)}}),this.requestScheduler=new ld(this,{onTileSkip:e=>{},onTileLoad:e=>{var t;(t=e.content)!=null&&t.data&&(this.loadedTiles.add(e),this.cache.loadTile(e)),this.options.onTileLoad(e)},onTileError:(e,t)=>{this.options.onTileError(e,t)}}),this.loadedTiles=new Set,this.cacheMemoryUsageInBytes=0,this.currentMaxScreenSpaceError=NaN,this.root=new Bl(`${this.id}#tile:0`,e.root,this),this.geometricError=e.geometricError,this.trajectories=[],this.asset.trajectories)for(let e=0;e<this.asset.trajectories.length;e++){let t=new ad(`${this.id}#trajectory:${e}`,this.asset.trajectories[e],this);this.trajectories.push(t)}}adjustScreenSpaceError(e){if((isNaN(this.currentMaxScreenSpaceError)||!isFinite(this.currentMaxScreenSpaceError))&&(this.currentMaxScreenSpaceError=e.maxScreenSpaceError),e.memoryAdjustedScreenSpaceError){let t=0,n=0,r=0;if(this.needsRefinedTiles.forEach(e=>{e.content&&(n++,t+=e.content.memoryUsage,e.content.loadState===`READY`&&r++)}),r<2||n<2)this.currentMaxScreenSpaceError=e.maxScreenSpaceError;else{let i=1024*1024,a=t/r*n,o=e.maxMemoryUsage*i,s=o-U(o*.1,8*i,64*i),c=this.currentMaxScreenSpaceError;if(a<s){let e=.5*(1-a/s);c-=e}else a>o&&(c+=.3);c=U(c,1,e.maxScreenSpaceError),Math.abs(c-this.currentMaxScreenSpaceError)>=.1&&(this.currentMaxScreenSpaceError=c)}}else this.currentMaxScreenSpaceError=e.maxScreenSpaceError}getTraverser(e){return e.mostDetail?this.mostDetailTraverser:e.skipLevelOfDetail?this.skipTraverser:this.normalTraverser}reset(){this.cache.reset(),this.skipTraverser.reset(),this.normalTraverser.reset(),this.mostDetailTraverser.reset(),this.requestScheduler.reset();let e=[this.root],t;for(;t=e.pop();){for(let n=0,r=t.children.length;n<r;n++)e.push(t.children[n]);this.cache.unloadTile(t)}for(;this.unloadTiles.length;){let e=this.unloadTiles.pop();e&&(this.loadedTiles.delete(e),this.cacheMemoryUsageInBytes-=e.contentMemoryUsage,this.options.tileUnloader(e).catch(()=>{}).then(()=>{this.options.onTileUnload&&this.options.onTileUnload(e)}))}for(this.loadedTiles.clear();this.trajectories.length;){let e=this.trajectories.pop();e&&this.options.trajectoryUnloader(e).catch(()=>{}).then(()=>{this.options.onTrajectoryUnload&&this.options.onTrajectoryUnload(e)})}}update(e,t=[]){var n;for(this.frameNumber=e.frameNumber,this.adjustScreenSpaceError(e),this.cache.reset(),this.getTraverser(e).traverse(this.root,e,t),this.cache.unloadTiles(()=>this.cacheMemoryUsageInBytes>e.maxMemoryUsage*1024*1024),this.requestScheduler.update(this.requestedTiles,e.requestOrder,e);this.unloadTiles.length;){let e=this.unloadTiles.pop();e&&(this.loadedTiles.delete(e),this.options.tileUnloader(e).catch(()=>{}).then(()=>{this.options.onTileUnload&&this.options.onTileUnload(e)}))}this.selectedTrajectories.length=0;for(let t of this.trajectories)t.visible===!0&&t.content.loadState===`READY`&&(n=t.content.data)!=null&&n.object?this.selectedTrajectories.push(t):t.visible===!0&&(t.content.loadState===`FAILED`&&e.time-t.content.loadStateUpdateTime>t.content.loadfailRetryDelay&&(t.content.loadState=`UNLOADED`,t.content.loadStateUpdateTime=e.time),t.content.loadState===`UNLOADED`&&this.options.trajectoryLoader(t).then(()=>{this.options.onTrajectoryLoad(t)}).catch(e=>{this.options.onTrajectoryError(t,e)}))}};function yd(e,t){var n;if(e.content){let r=(n=e.content.uri)==null?e.content.url:n;typeof r==`string`&&!Sr(r)&&(e.content.uri=Er(wr(t,r)))}if(e.transform){let t=!1;for(let n=0;n<16;n++){let r=e.transform[n];if(typeof r!=`number`||isNaN(r)||!isFinite(r)){t=!0;break}}if(e.transform[15]===0&&(t=!0),t)throw Error(`Invalid Tile Transform: `+JSON.stringify(e.transform))}if(e.children)for(let n of e.children)yd(n,t);return e}function bd(e,t){e.tilesetUrl=t;let n=/^blob\:/.test(t)?``:t.slice(0,t.lastIndexOf(`/`)+1);if(e.asset||(e.asset={}),e.rootMeta||(e.rootMeta={}),e.rootMeta.taskParameters||(e.rootMeta.taskParameters={}),e.asset.overview){let t=e.asset.overview;Sr(t.imageFile)||(t.imageFile=Er(wr(n,t.imageFile))),Sr(t.worldFile)||(t.worldFile=Er(wr(n,t.worldFile)))}if(e.asset.trajectories)for(let t=0;t<e.asset.trajectories.list.length;t++){let r=e.asset.trajectories.list[t];r.file=Er(wr(n,r.file))}return yd(e.root,n),e}function xd(e){return new Promise(t=>setTimeout(t,e))}var Sd=new class{constructor(e){this.queue=[],this.concurrency=e,this.dequeuing=0}add(e,t=1e3){let n,r,i=new Promise((e,t)=>{n=e,r=t});return this.queue.unshift(()=>{let i=Promise.resolve().then(e);i.then(n,r);let a=xd(t);return Promise.race([i,a]).then(K,K)}),this.dequeue(),i}dequeue(){for(;this.dequeuing<this.concurrency&&this.queue.length>0;){let e=this.queue.pop();this.dequeuing++,e().catch(K).then(()=>{this.dequeuing--,this.dequeue()})}}}(1),Cd=256;function wd(e){return typeof e.image==`object`&&e.image.width>0&&e.image.height>0}function Td(e,t){if(!wd(e))return Promise.resolve(e);if(e.image.width<Cd&&e.image.width<Cd)return t.initTexture(e),Promise.resolve(e);let n=!1,r=()=>{n=!0,e.removeEventListener(`dispose`,r)};return e.addEventListener(`dispose`,r),Sd.add(()=>new Promise(i=>{si.shared.add(()=>{wd(e)&&n===!1&&t.initTexture(e),e.removeEventListener(`dispose`,r),i(e)},!0)}))}function Ed(e,t){return Promise.all(e.map(e=>Td(e,t)))}var Dd=/^[og]\s*(.+)?/,Od=/^mtllib /,kd=/^usemtl /,Ad=/^usemap /,jd=/\s+/,Md=new c.Color,Nd=class{constructor(){this.objects=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.materials={},this.materialLibraries=[],this.startObject(``,!1)}startObject(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}let n=this.object&&typeof this.object.currentMaterial==`function`?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0),this.object={name:e||``,fromDeclaration:t!==!1,geometry:{vertices:[],hasNormal:!0,normals:[],hasColor:!0,colors:[],hasUV:!0,uvs:[],index:[],indexMap:{}},materials:[],smooth:!0,startMaterial:function(e,t){var n,r;let i=this._finalize(!1);i&&(i.inherited||((n=i.groupCount)==null?0:n)<=0)&&this.materials.splice((r=i.index)==null?0:r,1);let a={index:this.materials.length,name:e||``,mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:``,smooth:i===void 0?this.smooth:i.smooth,groupStart:i===void 0?0:i.groupEnd,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){let t={index:typeof e==`number`?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1,clone(){return this}};return t.clone=this.clone.bind(t),t}};return this.materials.push(a),a},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){var t,n;let r=this.currentMaterial();if(r&&r.groupEnd===-1&&(r.groupEnd=this.geometry.index.length,r.groupCount=r.groupEnd-((t=r.groupStart)==null?0:t),r.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)((n=this.materials[e].groupCount)==null?0:n)<=0&&this.materials.splice(e,1);return e&&this.materials.length===0&&this.materials.push({name:``,smooth:this.smooth}),r}},n&&n.name&&typeof n.clone==`function`){let e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)}finalize(){this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0)}parseVertexIndex(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3}parseNormalIndex(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3}parseUVIndex(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2}addFace(e,t,n,r,i,a,o,s,c){let l=this.object.geometry,u=this.vertices.length,d=this.normals.length,f=this.uvs.length,p=this.parseVertexIndex(e,u),m=this.parseVertexIndex(t,u),h=this.parseVertexIndex(n,u),g=o===void 0?void 0:this.parseNormalIndex(o,d),_=s===void 0?void 0:this.parseNormalIndex(s,d),v=c===void 0?void 0:this.parseNormalIndex(c,d),y=r===void 0?void 0:this.parseUVIndex(r,f),b=i===void 0?void 0:this.parseUVIndex(i,f),x=a===void 0?void 0:this.parseUVIndex(a,f);(l.hasNormal===!0&&g===void 0||_===void 0||v===void 0)&&(l.hasNormal=!1),(l.hasUV===!0&&y===void 0||b===void 0||x===void 0)&&(l.hasUV=!1);let S=[p,y,g].join(`:`),C=l.indexMap[S];C===void 0&&(C=l.vertices.length/3,l.indexMap[S]=C,l.vertices.push(this.vertices[p+0],this.vertices[p+1],this.vertices[p+2]),l.hasColor&&(this.colors[p]===void 0?l.hasColor=!1:l.colors.push(this.colors[p+0],this.colors[p+1],this.colors[p+2])),l.hasNormal&&l.normals.push(this.normals[p+0],this.normals[p+1],this.normals[p+2]),l.hasUV&&l.uvs.push(this.uvs[y+0],this.uvs[y+1])),l.index.push(C);let w=[m,b,_].join(`:`),T=l.indexMap[w];T===void 0&&(T=l.vertices.length/3,l.indexMap[w]=T,l.vertices.push(this.vertices[m+0],this.vertices[m+1],this.vertices[m+2]),l.hasColor&&(this.colors[m]===void 0?l.hasColor=!1:l.colors.push(this.colors[m+0],this.colors[m+1],this.colors[m+2])),l.hasNormal&&l.normals.push(this.normals[m+0],this.normals[m+1],this.normals[m+2]),l.hasUV&&l.uvs.push(this.uvs[b+0],this.uvs[b+1])),l.index.push(T);let E=[h,x,v].join(`:`),D=l.indexMap[E];D===void 0&&(D=l.vertices.length/3,l.indexMap[E]=D,l.vertices.push(this.vertices[h+0],this.vertices[h+1],this.vertices[h+2]),l.hasColor&&(this.colors[h]===void 0?l.hasColor=!1:l.colors.push(this.colors[h+0],this.colors[h+1],this.colors[h+2])),l.hasNormal&&l.normals.push(this.normals[h+0],this.normals[h+1],this.normals[h+2]),l.hasUV&&l.uvs.push(this.uvs[x+0],this.uvs[x+1])),l.index.push(D)}};function Pd(e){let t=new Nd;e.indexOf(`\r
832
832
  `)!==-1&&(e=e.replace(/\r\n/g,`
833
833
  `)),e.indexOf(`\\
834
834
  `)!==-1&&(e=e.replace(/\\\n/g,``));let n=e.split(`
835
- `),r=[];for(let e=0,i=n.length;e<i;e++){let i=n[e].trimStart();if(i.length===0)continue;let a=i.charAt(0);if(a!==`#`){if(a===`v`){let e=i.split(Od);switch(e[0]){case`v`:t.vertices.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])),e.length>=7?(kd.setRGB(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6])),kd.convertSRGBToLinear(),t.colors.push(kd.r,kd.g,kd.b)):t.colors.push(void 0,void 0,void 0);break;case`vn`:t.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case`vt`:t.uvs.push(parseFloat(e[1]),parseFloat(e[2]));break}}else if(a===`f`){let e=i.slice(1).trim().split(Od),n=[];for(let t=0,r=e.length;t<r;t++){let r=e[t];if(r.length>0){let e=r.split(`/`);n.push(e)}}let r=n[0];for(let e=1,i=n.length-1;e<i;e++){let i=n[e],a=n[e+1];t.addFace(r[0],i[0],a[0],r[1],i[1],a[1],r[2],i[2],a[2])}}else if(a!==`l`&&a!==`p`)if((r=wd.exec(i))!==null){let e=(` `+r[0].slice(1).trim()).slice(1);t.startObject(e)}else if(Ed.test(i))t.object.startMaterial(i.substring(7).trim(),t.materialLibraries);else if(Td.test(i))t.materialLibraries.push(i.substring(7).trim());else if(Dd.test(i))console.warn(`THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.`);else if(a===`s`){if(r=i.split(` `),r.length>1){let e=r[1].trim().toLowerCase();t.object.smooth=e!==`0`&&e!==`off`}else t.object.smooth=!0;let e=t.object.currentMaterial();e&&(e.smooth=t.object.smooth)}else{if(i===`\0`)continue;console.warn(`THREE.OBJLoader: Unexpected line: "`+i+`"`)}}}return t.finalize(),t}function Md(e,t,n){let r=new yi,i=t.split(`
836
- `),a={name:``},o=/\s+/,s={};for(let e=0;e<i.length;e++){let t=i[e];if(t=t.trim(),t.length===0||t.charAt(0)===`#`)continue;let n=t.indexOf(` `),r=n>=0?t.substring(0,n):t;r=r.toLowerCase();let c=n>=0?t.substring(n+1):``;if(c=c.trim(),r===`newmtl`)a={name:c},s[c]=a;else if(r===`ka`||r===`kd`||r===`ks`||r===`ke`){let e=c.split(o,3);a[r]=[parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2])]}else (r===`map_kd`||r===`map_ks`||r===`map_ke`||r===`norm`||r===`map_bump`||r===`bump`||r===`map_d`||r===`ns`||r===`d`||r===`tr`)&&(a[r]=c)}function l(e){let t={url:``,scale:new c.Vector2(1,1),offset:new c.Vector2(0,0),bumpScale:1},n=e.split(/\s+/),r;return r=n.indexOf(`-bm`),r>=0&&(t.bumpScale=parseFloat(n[r+1]),n.splice(r,2)),r=n.indexOf(`-s`),r>=0&&(t.scale.set(parseFloat(n[r+1]),parseFloat(n[r+2])),n.splice(r,4)),r=n.indexOf(`-o`),r>=0&&(t.offset.set(parseFloat(n[r+1]),parseFloat(n[r+2])),n.splice(r,4)),t.url=n.join(` `).trim(),t}function u(e,t,i){let a=l(i),o=wr(n.path,a.url);return r.loadTexture(o,{fetcher:n.fetcher,encoding:t===`map`||t===`emissiveMap`?c.sRGBEncoding:c.LinearEncoding,minFilter:c.LinearFilter,magFilter:c.LinearFilter,wrapS:c.RepeatWrapping,wrapT:c.RepeatWrapping}).then(n=>{let r=n.body;return r.repeat.copy(a.scale),r.offset.copy(a.offset),e.bumpScale=a.bumpScale,e[t]=r,r})}return{name:e,create:e=>{let t=new yn(n.light?`phong`:`basic`),r=[],i=s[e];if(i){if(i.kd!==void 0&&t.color.fromArray(i.kd),i.ks!==void 0&&t.specular.fromArray(i.ks),i.ke!==void 0&&t.emissive.fromArray(i.ke),i.map_kd!==void 0&&r.push(u(t,`map`,i.map_kd)),i.map_ks!==void 0&&r.push(u(t,`specularMap`,i.map_ks)),i.map_ke!==void 0&&r.push(u(t,`emissiveMap`,i.map_ke)),i.norm!==void 0&&r.push(u(t,`normalMap`,i.norm)),i.map_bump!==void 0&&r.push(u(t,`bumpMap`,i.map_bump)),i.bump!==void 0&&r.push(u(t,`bumpMap`,i.bump)),i.map_d!==void 0&&r.push(u(t,`alphaMap`,i.map_d)),i.ns!==void 0&&(t.shininess=parseFloat(i.ns)),i.d!==void 0){let e=parseFloat(i.d);e<1&&(t.opacity=e,t.transparent=!0)}if(i.tr!==void 0){let e=parseFloat(i.tr);e>0&&(t.opacity=1-e,t.transparent=!0)}}return[t,Promise.all(r).then(e=>e)]}}}function Nd(e,t){var n;let r=[],i=[],a=new c.Group;for(let o=0,s=e.objects.length;o<s;o++){let s=e.objects[o],l=s.geometry,u=s.materials,d=!1;if(l.vertices.length===0)continue;let f=new c.BufferGeometry;i.push(()=>f.dispose()),f.setAttribute(`position`,new c.BufferAttribute(new Float32Array(l.vertices),3)),l.normals.length>0&&f.setAttribute(`normal`,new c.BufferAttribute(new Float32Array(l.normals),3)),l.colors.length>0&&(d=!0,f.setAttribute(`color`,new c.BufferAttribute(new Float32Array(l.colors),3))),l.uvs.length>0&&f.setAttribute(`uv`,new c.BufferAttribute(new Float32Array(l.uvs),2)),l.index.length>0&&f.setIndex(new c.BufferAttribute(new Uint32Array(l.index),1)),f.computeBoundingBox(),f.computeBoundingSphere();let p=[];for(let n=0,a=u.length;n<a;n++){let a=u[n],o=a.name+`_`+a.smooth+`_`+d,s=e.materials[o];if(!s){let n=null;for(let{name:e,create:r}of t)e===a.mtllib&&(n=r(a.name));n||(n=[new yn,Promise.resolve([])]),s=n[0],s.name=a.name,s.flatShading=!(a.smooth||f.attributes.normal),s.vertexColors=d,e.materials[o]=s;let c=n[1];r.push(c),i.push(()=>s.dispose())}p.push(s)}f.clearGroups();for(let e=0,t=u.length;e<t;e++){let t=u[e];t.groupCount&&f.addGroup((n=t.groupStart)==null?0:n,t.groupCount,e)}(!f.groups||f.groups.length===0)&&f.addGroup(0,f.index?f.index.count:f.attributes.position.count,0);let m=new bn(f,p);m.name=s.name,a.add(m)}return Promise.all(r).then(e=>{let t=[];for(let n of e)t=t.concat(n);return{scene:a,textures:t,dispose:()=>i.forEach(e=>e())}})}function Pd(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Z`:n,s=(r=t.upAxis)==null?`Z`:r,c=(i=t.fetcher)==null?_r:i,l=(a=t.onDownloadProgress)==null?K:a,u=e.slice(0,e.lastIndexOf(`/`)+1),d=0,f;return Promise.resolve().then(()=>c.ajax(e,{responseType:`arraybuffer`},void 0,void 0,l)).then(e=>(d=e.body.byteLength,new TextDecoder().decode(e.body))).then(e=>(f=jd(e),Promise.all(f.materialLibraries.map(e=>{let n=wr(u,e),r=n.slice(0,n.lastIndexOf(`/`)+1);return c.ajax(n,{responseType:`text`}).then(n=>{var i;return Md(e,n.body,{path:r,light:(i=t.light)==null?!1:i,fetcher:c})})})))).then(e=>Nd(f,e)).then(t=>(o===`Y`&&t.scene.applyMatrix4(er),s===`Y`&&t.scene.applyMatrix4(tr),{type:`obj`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:Pi(t.scene),scene:t.scene,textures:t.textures,animations:[],dispose:()=>t.dispose()}))}var Fd=new c.Matrix4,Id=5e3,Ld=1e3;function Rd(e,t){e.name=t.id;let n=t.tileset.properties.floorInfo;e.traverse(e=>{if(`floor`in t.extras){if(e instanceof c.Mesh||e instanceof c.Points){let n=Array.isArray(e.material)?e.material:e.material?[e.material]:[];for(let e of n)(e instanceof yn||e instanceof kn)&&(e.floorIndex=t.extras.floor)}}else if(!(e instanceof An)&&(e instanceof bn||e instanceof xn)&&n){let r=new c.Box3().expandByObject(e).getCenter(new c.Vector3),i=0;for(let e=0;e<n.length;e++){let{ground:t,height:a}=n[e];if(r.y<t+a){i=e;break}}t.floor=i,t.tileset.floorLength=Math.max(t.tileset.floorLength,t.floor+1),e.material.forEach(e=>e.floorIndex=i)}})}function zd(e,t){if(!e.content)return Promise.resolve(e);let n=e.content,r=Tr(n.uri,t.search);if(e.type===`TILESET`){let i=Xr(r,{key:`model.${e.siblingIndex}`});return n.loadState=`LOADING`,n.loadStateUpdateTime=H(),t.fetcher.ajax(i,{responseType:`text`},void 0,void 0,(e,t,r)=>{(n.loadState=`LOADING`)&&(n.loadProgress=e)}).then(e=>e.body).then(e=>{let t=r.slice(0,r.lastIndexOf(`/`)+1);return _d(JSON.parse(e),t)}).then(t=>{n.loadState=`READY`,n.loadStateUpdateTime=H(),n.loadfailRetryDelay=0,e.children.length===0&&(e.children=[new Ll(`${e.id}.0`,t.root,e.tileset,e)])}).then(()=>e).catch(e=>(n.loadState=`FAILED`,n.loadStateUpdateTime=H(),n.loadfailRetryDelay=Math.min(n.loadfailRetryDelay+1e3,5e3),Promise.reject(e)))}if(e.type===`SCENEGRAPH`){n.loadState=`LOADING`,n.loadStateUpdateTime=H();let i=(e,t,r)=>{(n.loadState=`LOADING`)&&(n.loadProgress=e,r&&(n.byteLength=r))};return Promise.resolve().then(()=>{var n,a,o,s,l,u,d,f,p,m,h,g;let _=``,[v,y]=r.split(`#`),b=(y||v).split(`?`)[0].match(/\.([0-9a-zA-Z]+)$/);if(b&&(_=b[1]),_===`b3dm`)return ls(Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:e.tileset.asset.gltfUpAxis,light:t.light,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,Rd(t.scene,e),t));if(_===`pnts`)return gs(Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,computeBoundingBox:!1,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>{if(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,e.boundingVolume){let n=e.boundingVolume;t.scene.traverse(e=>{if(e instanceof An){Fd.getInverse(e.matrixWorld);let t=new c.Box3;n.getBoundingBox(t),t.applyMatrix4(Fd),e.geometry.boundingBox=t}})}return Rd(t.scene,e),t});if(_===`glb`||_===`gltf`)return vs(Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:e.tileset.asset.gltfUpAxis,light:t.light,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,Rd(t.scene,e),t));if(_===`at3d`)return ia(e.extras.at3d?r:Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,textureBaseUri:(n=e.extras.at3d)==null?void 0:n.textureBaseUri,textureArray:(a=e.extras.at3d)==null?void 0:a.textureArray,textureOptions:(o=e.extras.at3d)==null?void 0:o.textureOptions,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`pbm`)return Ii(e.extras.pbm?r:Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,textureBaseUri:(s=e.extras.pbm)==null?void 0:s.textureBaseUri,textureArray:(l=e.extras.pbm)==null?void 0:l.textureArray,textureOptions:(u=e.extras.pbm)==null?void 0:u.textureOptions,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`dome`)return ca(e.extras.dome?r:Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,textureBaseUri:(d=e.extras.dome)==null?void 0:d.textureBaseUri,textureOptions:(f=e.extras.dome)==null?void 0:f.textureOptions,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`domez`)return ha(e.extras.domez?r:Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,textureBaseUri:(p=e.extras.domez)==null?void 0:p.textureBaseUri,textureOptions:(m=e.extras.domez)==null?void 0:m.textureOptions,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`ply`)return bs(e.extras.ply?r:Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:(h=e.extras.ply)==null?void 0:h.upAxis,type:`pbmPointCloud`,light:t.light,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`obj`)return Pd(e.extras.obj?r:Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:(g=e.extras.obj)==null?void 0:g.upAxis,light:t.light,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`fbx`)return wc(e.extras.fbx?r:Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`x3p`)return il(e.extras.x3p?r:Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`spz`)return is(Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:`Z`,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t.scene.transformChanged=!0,t));if(_===`splat`)return sl(Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));throw Error(`Invalid Tile content: ${r}`)}).then(r=>{let i={type:r.type,uri:r.uri,byteLength:r.byteLength,memoryUsage:r.memoryUsage,object:new Qu(e.id,r.scene,r.animations,r.dispose)};return Promise.resolve().then(()=>{i.object.traverse(e=>{e.matrix.compose(e.position,e.quaternion,e.scale),e.matrixAutoUpdate=!1})}).then(()=>Promise.all([i.object.generateBvhTree(),t.renderer?Cd(r.textures,t.renderer):null])).then(()=>(n.loadState=`READY`,n.loadStateUpdateTime=H(),n.loadfailRetryDelay=0,n.byteLength=i.byteLength,n.memoryUsage=i.memoryUsage,n.data=i,e)).catch(t=>(Bd(e),Promise.reject(t)))}).catch(e=>(n.loadState=`FAILED`,n.loadStateUpdateTime=H(),e instanceof or&&e.httpStatus===0||e instanceof sr||e instanceof ar?n.loadfailRetryDelay=U(n.loadfailRetryDelay+Ld,Ld,Id):n.loadfailRetryDelay=1/0,Promise.reject(e)))}throw Error(`Invalid Tile type: ${e.type}`)}function Bd(e){e.content&&(e.content.data&&e.content.data.object.dispose(),e.content.data=void 0,e.content.loadState=`UNLOADED`,e.content.loadStateUpdateTime=H(),e.content.byteLength=0,e.content.memoryUsage=0)}var Vd=5e3,Hd=1e3,Ud={vertexShader:`
835
+ `),r=[];for(let e=0,i=n.length;e<i;e++){let i=n[e].trimStart();if(i.length===0)continue;let a=i.charAt(0);if(a!==`#`){if(a===`v`){let e=i.split(jd);switch(e[0]){case`v`:t.vertices.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])),e.length>=7?(Md.setRGB(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6])),Md.convertSRGBToLinear(),t.colors.push(Md.r,Md.g,Md.b)):t.colors.push(void 0,void 0,void 0);break;case`vn`:t.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case`vt`:t.uvs.push(parseFloat(e[1]),parseFloat(e[2]));break}}else if(a===`f`){let e=i.slice(1).trim().split(jd),n=[];for(let t=0,r=e.length;t<r;t++){let r=e[t];if(r.length>0){let e=r.split(`/`);n.push(e)}}let r=n[0];for(let e=1,i=n.length-1;e<i;e++){let i=n[e],a=n[e+1];t.addFace(r[0],i[0],a[0],r[1],i[1],a[1],r[2],i[2],a[2])}}else if(a!==`l`&&a!==`p`)if((r=Dd.exec(i))!==null){let e=(` `+r[0].slice(1).trim()).slice(1);t.startObject(e)}else if(kd.test(i))t.object.startMaterial(i.substring(7).trim(),t.materialLibraries);else if(Od.test(i))t.materialLibraries.push(i.substring(7).trim());else if(Ad.test(i))console.warn(`THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.`);else if(a===`s`){if(r=i.split(` `),r.length>1){let e=r[1].trim().toLowerCase();t.object.smooth=e!==`0`&&e!==`off`}else t.object.smooth=!0;let e=t.object.currentMaterial();e&&(e.smooth=t.object.smooth)}else{if(i===`\0`)continue;console.warn(`THREE.OBJLoader: Unexpected line: "`+i+`"`)}}}return t.finalize(),t}function Fd(e,t,n){let r=new yi,i=t.split(`
836
+ `),a={name:``},o=/\s+/,s={};for(let e=0;e<i.length;e++){let t=i[e];if(t=t.trim(),t.length===0||t.charAt(0)===`#`)continue;let n=t.indexOf(` `),r=n>=0?t.substring(0,n):t;r=r.toLowerCase();let c=n>=0?t.substring(n+1):``;if(c=c.trim(),r===`newmtl`)a={name:c},s[c]=a;else if(r===`ka`||r===`kd`||r===`ks`||r===`ke`){let e=c.split(o,3);a[r]=[parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2])]}else (r===`map_kd`||r===`map_ks`||r===`map_ke`||r===`norm`||r===`map_bump`||r===`bump`||r===`map_d`||r===`ns`||r===`d`||r===`tr`)&&(a[r]=c)}function l(e){let t={url:``,scale:new c.Vector2(1,1),offset:new c.Vector2(0,0),bumpScale:1},n=e.split(/\s+/),r;return r=n.indexOf(`-bm`),r>=0&&(t.bumpScale=parseFloat(n[r+1]),n.splice(r,2)),r=n.indexOf(`-s`),r>=0&&(t.scale.set(parseFloat(n[r+1]),parseFloat(n[r+2])),n.splice(r,4)),r=n.indexOf(`-o`),r>=0&&(t.offset.set(parseFloat(n[r+1]),parseFloat(n[r+2])),n.splice(r,4)),t.url=n.join(` `).trim(),t}function u(e,t,i){let a=l(i),o=wr(n.path,a.url);return r.loadTexture(o,{fetcher:n.fetcher,encoding:t===`map`||t===`emissiveMap`?c.sRGBEncoding:c.LinearEncoding,minFilter:c.LinearFilter,magFilter:c.LinearFilter,wrapS:c.RepeatWrapping,wrapT:c.RepeatWrapping}).then(n=>{let r=n.body;return r.repeat.copy(a.scale),r.offset.copy(a.offset),e.bumpScale=a.bumpScale,e[t]=r,r})}return{name:e,create:e=>{let t=new yn(n.light?`phong`:`basic`),r=[],i=s[e];if(i){if(i.kd!==void 0&&t.color.fromArray(i.kd),i.ks!==void 0&&t.specular.fromArray(i.ks),i.ke!==void 0&&t.emissive.fromArray(i.ke),i.map_kd!==void 0&&r.push(u(t,`map`,i.map_kd)),i.map_ks!==void 0&&r.push(u(t,`specularMap`,i.map_ks)),i.map_ke!==void 0&&r.push(u(t,`emissiveMap`,i.map_ke)),i.norm!==void 0&&r.push(u(t,`normalMap`,i.norm)),i.map_bump!==void 0&&r.push(u(t,`bumpMap`,i.map_bump)),i.bump!==void 0&&r.push(u(t,`bumpMap`,i.bump)),i.map_d!==void 0&&r.push(u(t,`alphaMap`,i.map_d)),i.ns!==void 0&&(t.shininess=parseFloat(i.ns)),i.d!==void 0){let e=parseFloat(i.d);e<1&&(t.opacity=e,t.transparent=!0)}if(i.tr!==void 0){let e=parseFloat(i.tr);e>0&&(t.opacity=1-e,t.transparent=!0)}}return[t,Promise.all(r).then(e=>e)]}}}function Id(e,t){var n;let r=[],i=[],a=new c.Group;for(let o=0,s=e.objects.length;o<s;o++){let s=e.objects[o],l=s.geometry,u=s.materials,d=!1;if(l.vertices.length===0)continue;let f=new c.BufferGeometry;i.push(()=>f.dispose()),f.setAttribute(`position`,new c.BufferAttribute(new Float32Array(l.vertices),3)),l.normals.length>0&&f.setAttribute(`normal`,new c.BufferAttribute(new Float32Array(l.normals),3)),l.colors.length>0&&(d=!0,f.setAttribute(`color`,new c.BufferAttribute(new Float32Array(l.colors),3))),l.uvs.length>0&&f.setAttribute(`uv`,new c.BufferAttribute(new Float32Array(l.uvs),2)),l.index.length>0&&f.setIndex(new c.BufferAttribute(new Uint32Array(l.index),1)),f.computeBoundingBox(),f.computeBoundingSphere();let p=[];for(let n=0,a=u.length;n<a;n++){let a=u[n],o=a.name+`_`+a.smooth+`_`+d,s=e.materials[o];if(!s){let n=null;for(let{name:e,create:r}of t)e===a.mtllib&&(n=r(a.name));n||(n=[new yn,Promise.resolve([])]),s=n[0],s.name=a.name,s.flatShading=!(a.smooth||f.attributes.normal),s.vertexColors=d,e.materials[o]=s;let c=n[1];r.push(c),i.push(()=>s.dispose())}p.push(s)}f.clearGroups();for(let e=0,t=u.length;e<t;e++){let t=u[e];t.groupCount&&f.addGroup((n=t.groupStart)==null?0:n,t.groupCount,e)}(!f.groups||f.groups.length===0)&&f.addGroup(0,f.index?f.index.count:f.attributes.position.count,0);let m=new bn(f,p);m.name=s.name,a.add(m)}return Promise.all(r).then(e=>{let t=[];for(let n of e)t=t.concat(n);return{scene:a,textures:t,dispose:()=>i.forEach(e=>e())}})}function Ld(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Z`:n,s=(r=t.upAxis)==null?`Z`:r,c=(i=t.fetcher)==null?_r:i,l=(a=t.onDownloadProgress)==null?K:a,u=e.slice(0,e.lastIndexOf(`/`)+1),d=0,f;return Promise.resolve().then(()=>c.ajax(e,{responseType:`arraybuffer`},void 0,void 0,l)).then(e=>(d=e.body.byteLength,new TextDecoder().decode(e.body))).then(e=>(f=Pd(e),Promise.all(f.materialLibraries.map(e=>{let n=wr(u,e),r=n.slice(0,n.lastIndexOf(`/`)+1);return c.ajax(n,{responseType:`text`}).then(n=>{var i;return Fd(e,n.body,{path:r,light:(i=t.light)==null?!1:i,fetcher:c})})})))).then(e=>Id(f,e)).then(t=>(o===`Y`&&t.scene.applyMatrix4(er),s===`Y`&&t.scene.applyMatrix4(tr),{type:`obj`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:Pi(t.scene),scene:t.scene,textures:t.textures,animations:[],dispose:()=>t.dispose()}))}var Rd=new c.Matrix4,zd=5e3,Bd=1e3;function Vd(e,t){e.name=t.id;let n=t.tileset.properties.floorInfo;e.traverse(e=>{if(`floor`in t.extras){if(e instanceof c.Mesh||e instanceof c.Points){let n=Array.isArray(e.material)?e.material:e.material?[e.material]:[];for(let e of n)(e instanceof yn||e instanceof kn)&&(e.floorIndex=t.extras.floor)}}else if(!(e instanceof An)&&(e instanceof bn||e instanceof xn)&&n){let r=new c.Box3().expandByObject(e).getCenter(new c.Vector3),i=0;for(let e=0;e<n.length;e++){let{ground:t,height:a}=n[e];if(r.y<t+a){i=e;break}}t.floor=i,t.tileset.floorLength=Math.max(t.tileset.floorLength,t.floor+1),e.material.forEach(e=>e.floorIndex=i)}})}function Hd(e,t){if(!e.content)return Promise.resolve(e);let n=e.content,r=Tr(n.uri,t.search);if(e.type===`TILESET`){let i=Xr(r,{key:`model.${e.siblingIndex}`});return n.loadState=`LOADING`,n.loadStateUpdateTime=H(),t.fetcher.ajax(i,{responseType:`text`},void 0,void 0,(e,t,r)=>{(n.loadState=`LOADING`)&&(n.loadProgress=e)}).then(e=>e.body).then(e=>{let t=r.slice(0,r.lastIndexOf(`/`)+1);return bd(JSON.parse(e),t)}).then(t=>{n.loadState=`READY`,n.loadStateUpdateTime=H(),n.loadfailRetryDelay=0,e.children.length===0&&(e.children=[new Bl(`${e.id}.0`,t.root,e.tileset,e)])}).then(()=>e).catch(e=>(n.loadState=`FAILED`,n.loadStateUpdateTime=H(),n.loadfailRetryDelay=Math.min(n.loadfailRetryDelay+1e3,5e3),Promise.reject(e)))}if(e.type===`SCENEGRAPH`){n.loadState=`LOADING`,n.loadStateUpdateTime=H();let i=(e,t,r)=>{(n.loadState=`LOADING`)&&(n.loadProgress=e,r&&(n.byteLength=r))};return Promise.resolve().then(()=>{var n,a,o,s,l,u,d,f,p,m,h,g;let _=``,[v,y]=r.split(`#`),b=(y||v).split(`?`)[0].match(/\.([0-9a-zA-Z]+)$/);if(b&&(_=b[1]),_===`b3dm`)return fs(Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:e.tileset.asset.gltfUpAxis,light:t.light,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,Vd(t.scene,e),t));if(_===`pnts`)return ys(Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,computeBoundingBox:!1,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>{if(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,e.boundingVolume){let n=e.boundingVolume;t.scene.traverse(e=>{if(e instanceof An){Rd.getInverse(e.matrixWorld);let t=new c.Box3;n.getBoundingBox(t),t.applyMatrix4(Rd),e.geometry.boundingBox=t}})}return Vd(t.scene,e),t});if(_===`glb`||_===`gltf`)return xs(Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:e.tileset.asset.gltfUpAxis,light:t.light,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,Vd(t.scene,e),t));if(_===`at3d`)return ia(e.extras.at3d?r:Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,textureBaseUri:(n=e.extras.at3d)==null?void 0:n.textureBaseUri,textureArray:(a=e.extras.at3d)==null?void 0:a.textureArray,textureOptions:(o=e.extras.at3d)==null?void 0:o.textureOptions,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`pbm`)return Ii(e.extras.pbm?r:Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,textureBaseUri:(s=e.extras.pbm)==null?void 0:s.textureBaseUri,textureArray:(l=e.extras.pbm)==null?void 0:l.textureArray,textureOptions:(u=e.extras.pbm)==null?void 0:u.textureOptions,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`dome`)return ca(e.extras.dome?r:Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,textureBaseUri:(d=e.extras.dome)==null?void 0:d.textureBaseUri,textureOptions:(f=e.extras.dome)==null?void 0:f.textureOptions,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`domez`)return ha(e.extras.domez?r:Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,textureBaseUri:(p=e.extras.domez)==null?void 0:p.textureBaseUri,textureOptions:(m=e.extras.domez)==null?void 0:m.textureOptions,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`ply`)return Cs(e.extras.ply?r:Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:(h=e.extras.ply)==null?void 0:h.upAxis,type:`pbmPointCloud`,light:t.light,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`obj`)return Ld(e.extras.obj?r:Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:(g=e.extras.obj)==null?void 0:g.upAxis,light:t.light,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`fbx`)return Dc(e.extras.fbx?r:Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`x3p`)return sl(e.extras.x3p?r:Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`spz`)return is(Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:`Z`,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t.scene.transformChanged=!0,t));if(_===`splat`)return ul(Xr(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));throw Error(`Invalid Tile content: ${r}`)}).then(r=>{let i={type:r.type,uri:r.uri,byteLength:r.byteLength,memoryUsage:r.memoryUsage,object:new td(e.id,r.scene,r.animations,r.dispose)};return Promise.resolve().then(()=>{i.object.traverse(e=>{e.matrix.compose(e.position,e.quaternion,e.scale),e.matrixAutoUpdate=!1})}).then(()=>Promise.all([i.object.generateBvhTree(),t.renderer?Ed(r.textures,t.renderer):null])).then(()=>(n.loadState=`READY`,n.loadStateUpdateTime=H(),n.loadfailRetryDelay=0,n.byteLength=i.byteLength,n.memoryUsage=i.memoryUsage,n.data=i,e)).catch(t=>(Ud(e),Promise.reject(t)))}).catch(e=>(n.loadState=`FAILED`,n.loadStateUpdateTime=H(),e instanceof or&&e.httpStatus===0||e instanceof sr||e instanceof ar?n.loadfailRetryDelay=U(n.loadfailRetryDelay+Bd,Bd,zd):n.loadfailRetryDelay=1/0,Promise.reject(e)))}throw Error(`Invalid Tile type: ${e.type}`)}function Ud(e){e.content&&(e.content.data&&e.content.data.object.dispose(),e.content.data=void 0,e.content.loadState=`UNLOADED`,e.content.loadStateUpdateTime=H(),e.content.byteLength=0,e.content.memoryUsage=0)}var Wd=5e3,Gd=1e3,Kd={vertexShader:`
837
837
  varying vec2 vUv;
838
838
  uniform float displacementScalar;
839
839
  #include <common>
@@ -889,7 +889,7 @@ void main() {
889
889
  #include <fog_fragment>
890
890
  #include <premultiplied_alpha_fragment>
891
891
  }
892
- `,uniforms:{diffuse:{value:new c.Color},diffuse2:{value:new c.Color},opacity:{value:1},displacementScalar:{value:0},totalLength:{value:1},dashSize:{value:new c.Vector3},dashOffset:{value:0}}},Wd={vertexShader:`
892
+ `,uniforms:{diffuse:{value:new c.Color},diffuse2:{value:new c.Color},opacity:{value:1},displacementScalar:{value:0},totalLength:{value:1},dashSize:{value:new c.Vector3},dashOffset:{value:0}}},qd={vertexShader:`
893
893
  uniform float displacementScalar;
894
894
  #include <common>
895
895
  #include <color_pars_vertex>
@@ -935,11 +935,11 @@ void main() {
935
935
  #include <fog_fragment>
936
936
  #include <premultiplied_alpha_fragment>
937
937
  }
938
- `,uniforms:{diffuse:{value:new c.Color},opacity:{value:1},displacementScalar:{value:0}}};function Gd(e,t,n,r){let i=new Float32Array((n+1)*(r+1)*3),a=new Float32Array((n+1)*(r+1)*3),o=new Float32Array((n+1)*(r+1)*2),s=new Uint32Array(n*r*6),l=e.computeFrenetFrames(n),u=new c.Vector3,d=new c.Vector3,f=new c.Vector2,p=new c.Vector3;for(let s=0;s<=n;s++){p=e.getPointAt(s/n,p);let c=l.normals[s],m=l.binormals[s];for(let e=0;e<=r;e++){let l=s*(r+1)+e,h=e/r*Math.PI*2,g=Math.sin(h),_=-Math.cos(h);d.x=_*c.x+g*m.x,d.y=_*c.y+g*m.y,d.z=_*c.z+g*m.z,d.normalize(),d.toArray(a,l*3),u.x=p.x+t*d.x,u.y=p.y+t*d.y,u.z=p.z+t*d.z,u.toArray(i,l*3),f.x=s/n,f.y=e/r,f.toArray(o,l*2)}}for(let e=0;e<n;e++)for(let t=0;t<r;t++){let n=(e*r+t)*6,i=(r+1)*e+t,a=(r+1)*(e+1)+t,o=(r+1)*(e+1)+(t+1),c=(r+1)*e+(t+1);s[n]=i,s[n+1]=a,s[n+2]=c,s[n+3]=a,s[n+4]=o,s[n+5]=c}let m=new c.BufferGeometry;return m.setIndex(new c.BufferAttribute(s,1)),m.setAttribute(`position`,new c.BufferAttribute(i,3)),m.setAttribute(`normal`,new c.BufferAttribute(a,3)),m.setAttribute(`uv`,new c.BufferAttribute(o,2)),m}function Kd(e,t){let n=new c.Color(0).convertSRGBToLinear(),r=new c.Color(52949).convertSRGBToLinear(),i=new c.Color(3370495).convertSRGBToLinear(),a=new c.Color(16777215).convertSRGBToLinear(),o=0,s=new c.CurvePath,l=e.length;for(let t=3;t<l;t+=3){let n=new c.Vector3().fromArray(e,t-3),r=new c.Vector3().fromArray(e,t);o+=n.distanceTo(r);let i=new c.LineCurve3(n,r);s.add(i)}let u=Gd(s,.03,Math.ceil(o*100),6);u.clearGroups(),u.addGroup(0,u.index?u.index.count:u.attributes.position.count,0),u.addGroup(0,u.index?u.index.count:u.attributes.position.count,1),u.addGroup(0,u.index?u.index.count:u.attributes.position.count,2);let d=new c.ShaderMaterial({vertexShader:Ud.vertexShader,fragmentShader:Ud.fragmentShader,uniforms:c.UniformsUtils.clone(Ud.uniforms),side:c.BackSide});d.uniforms.totalLength.value=o,d.uniforms.diffuse.value=n,d.uniforms.diffuse2.value=n,d.uniforms.opacity.value=.5,d.transparent=!0;let f=new c.ShaderMaterial({vertexShader:Ud.vertexShader,fragmentShader:Ud.fragmentShader,uniforms:c.UniformsUtils.clone(Ud.uniforms),side:c.BackSide});f.uniforms.totalLength.value=o,f.uniforms.displacementScalar.value=-.01,f.uniforms.diffuse.value=r,f.uniforms.diffuse2.value=i;let p=new c.ShaderMaterial({vertexShader:Ud.vertexShader,fragmentShader:Ud.fragmentShader,uniforms:c.UniformsUtils.clone(Ud.uniforms),side:c.DoubleSide});p.uniforms.totalLength.value=o,p.uniforms.displacementScalar.value=-.026,p.uniforms.dashSize.value=new c.Vector2(.06,.09),p.uniforms.diffuse.value=a,p.uniforms.diffuse2.value=a;let m=new c.Mesh(u,[d,f,p]),h=new c.SphereBufferGeometry(.08,24,24);h.clearGroups(),h.addGroup(0,u.index?u.index.count:u.attributes.position.count,0),h.addGroup(0,u.index?u.index.count:u.attributes.position.count,1);let g=new c.ShaderMaterial({vertexShader:Wd.vertexShader,fragmentShader:Wd.fragmentShader,uniforms:c.UniformsUtils.clone(Wd.uniforms),side:c.BackSide});g.uniforms.diffuse.value=n,g.uniforms.opacity.value=.5,g.transparent=!0;let _=new c.ShaderMaterial({vertexShader:Wd.vertexShader,fragmentShader:Wd.fragmentShader,uniforms:c.UniformsUtils.clone(Wd.uniforms),side:c.FrontSide});_.uniforms.displacementScalar.value=-.01,_.uniforms.diffuse.value=r;let v=new c.Mesh(h,[g,_]);v.position.fromArray(e,0),m.add(v);let y=new c.ShaderMaterial({vertexShader:Wd.vertexShader,fragmentShader:Wd.fragmentShader,uniforms:c.UniformsUtils.clone(Wd.uniforms),side:c.FrontSide});y.uniforms.displacementScalar.value=-.01,y.uniforms.diffuse.value=i;let b=new c.Mesh(h,[g,y]);return b.position.fromArray(e,e.length-3),m.add(b),{scene:m,dispose:()=>{u.dispose(),d.dispose(),f.dispose(),p.dispose(),h.dispose(),g.dispose(),_.dispose(),y.dispose()}}}function qd(e,t){let n=e.name,r=Xr(Tr(e.content.uri,t.search),{key:`model.0`});return e.content.loadState=`LOADING`,e.content.loadStateUpdateTime=H(),bs(r,{type:`geometry`,customPropertyMapping:{time:{itemType:`uint32`,itemNames:[`time_milisec`]}},fetcher:t.fetcher}).then(t=>{var i,a,o,s;let c=(a=(i=t.scene.attributes)==null?void 0:i.time.array)==null?[]:a,l=(s=(o=t.scene.attributes)==null?void 0:o.position.array)==null?[]:s,u=t.byteLength,d=t.memoryUsage,f=Kd(l,c);f.scene.applyMatrix4(e.transform),f.scene.updateWorldMatrix(!1,!0),f.scene.matrixAutoUpdate=!1;let p=new rd(n,f.scene);return e.content.data={uri:r,byteLength:u,memoryUsage:d,positionArray:l,timeArray:c,object:p},e.content.byteLength=u,e.content.memoryUsage=d,e.content.loadState=`READY`,e.content.loadStateUpdateTime=H(),e}).catch(t=>(e.content.data=void 0,e.content.loadState=`FAILED`,e.content.loadStateUpdateTime=H(),t instanceof or&&t.httpStatus===0||t instanceof sr||t instanceof ar?e.content.loadfailRetryDelay=U(e.content.loadfailRetryDelay+Hd,Hd,Vd):e.content.loadfailRetryDelay=1/0,Promise.reject(t)))}function Jd(e){e.content&&(e.content.data&&e.content.data.object.dispose(),e.content.data=void 0,e.content.loadState=`UNLOADED`,e.content.loadProgress=0,e.content.loadStateUpdateTime=H(),e.content.byteLength=0,e.content.memoryUsage=0)}var Yd=new c.Vector3,Xd=new c.Matrix3,Zd=new c.Matrix4,Qd=6378137,$d=298.257223563;function ef(e){let t=Qd-Qd/$d,n=(Qd*Qd-t*t)/(Qd*Qd),r=Math.sqrt(e.x*e.x+e.y*e.y),i=0,a=Math.atan2(e.z,r),o=0;for(;i++<1e3;){let t=Math.sin(a),i=Qd/Math.sqrt(1-n*t*t);o=r/Math.cos(a)-i;let s=Math.atan2(e.z/(i*(1-n)+o),r/(i+o));if(isNaN(s)||Math.abs(s-a)<1e-12)break;a=s}return e.set(a,Math.atan2(e.y,e.x),o)}function tf(e){let{x:t,y:n,z:r}=e,i=Qd-Qd/$d,a=(Qd*Qd-i*i)/(Qd*Qd),o=Math.sin(t),s=Math.cos(t),c=Math.sin(n),l=Math.cos(n),u=Qd/Math.sqrt(1-a*o*o),d=(u+r)*s*l,f=(u+r)*s*c,p=(i*i/(Qd*Qd)*u+r)*o;return e.set(d,f,p)}function nf(e,t){let{x:n,y:r,z:i}=ef(Yd.copy(e)),a=Math.sin(n),o=Math.sin(r),s=Math.cos(n),c=Math.cos(r);t.fromArray([-o,-a*c,s*c,0,+c,-a*o,s*o,0,0,s,a,0,0,0,0,1]);let l=Xd.setFromMatrix4(t),u=Yd.copy(e).applyMatrix3(l).multiplyScalar(-1);t.setPosition(u);let d=Zd.fromArray([1,0,0,0,0,1,0,0,0,0,1,0,0,0,i,1]);return t.premultiply(d),t}var rf=new c.Matrix4().fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),af=new c.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),of=new c.Matrix4().copy(rf),sf=new c.Matrix4().copy(af);function cf(e,t={}){var n,r,i;let a,o,s;if(typeof e.tileset.rootMeta.creationTime==`string`)if(typeof e.tileset.rootMeta.numTotalPoints==`number`&&e.tileset.rootMeta.numTotalPoints>0){s=4,t.powerPreference===`high`&&(s=2),a=s/1.6;let c=0;if(((n=e.tileset.rootMeta.taskParameters)==null?void 0:n.point_homogenization)===`1`&&(r=e.tileset.rootMeta.taskParameters)!=null&&r.homo_point_density){let t=Number((i=e.tileset.rootMeta.taskParameters)==null?void 0:i.homo_point_density);isFinite(t)&&!isNaN(t)&&(c=t)}c<=0&&(c=.02),o=c*1.4}else s=5,t.powerPreference===`high`&&(s=4),a=0,o=.03;else s=6,a=0,o=.03,e.name===`aerophoto`?(s=12,t.powerPreference===`high`&&(s=10)):e.tileset.asset.extras&&typeof e.tileset.asset.extras.name==`string`&&/^matterport\b/i.test(e.tileset.asset.extras.name)&&(s=5,t.powerPreference===`high`&&(s=4));return{pointScale:o,pointMinPixel:a,maxScreenSpaceError:s}}var lf=new c.Vector3,uf=new Tl,df=new wl,ff=new WeakMap,pf=new WeakMap,mf=new WeakMap,hf={TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15},gf=(()=>{let e=new c.MeshBasicMaterial;return e.side=c.BackSide,e.color.setHex(16711935),e.colorWrite=!1,e.stencilWrite=!0,e.polygonOffset=!0,e.polygonOffsetFactor=2,e.polygonOffsetUnits=2,e.stencilRef=hf.TILE_MASK,e.stencilFunc=c.AlwaysStencilFunc,e.stencilFuncMask=hf.TILE_MASK,e.stencilZPass=c.ReplaceStencilOp,e.stencilWriteMask=hf.TILE_MASK,e})(),_f=(()=>{let e=new c.MeshBasicMaterial;return e.visible=!1,e})(),vf=new c.BufferGeometry,yf=new c.MeshBasicMaterial;function bf(e){let t;t=e instanceof c.Mesh?new c.Mesh(e.geometry,Array.isArray(e.material)?e.material.map(e=>e.transparent?_f:gf):e.material&&e.material.transparent?_f:gf):e instanceof c.Group?new c.Group:new c.Object3D,t.position.copy(e.position),t.quaternion.copy(e.quaternion),t.scale.copy(e.scale),t.matrix.compose(e.position,e.quaternion,e.scale),t.matrixAutoUpdate=!1,t.frustumCulled=e.frustumCulled,t.visible=e.visible;for(let n of e.children)t.add(bf(n));return t}var xf=class extends c.Object3D{constructor(e,t){var n,r;super(),this.parameter=new G,this.renderObjects=[],this.backfaceObjects=[],this.tileObjects=[],this.frameNumber=0,this.error=(n=t.error)==null?null:n,this.name=t.name,this.type=t.type,this.upAxis=t.upAxis,this.light=t.light,this.fetcher=t.fetcher,this.search=(r=t.search)==null?``:r,this.groundHeight=t.groundHeight,this.coordinateSystem=t.coordinateSystem,this.boundingBox=new c.Box3,this.autoRefine=!0,this.refined=!1,this.refineProgress=[0,0],this.loaded=!1,this.disposed=!1,this.clearStencilObject=new c.Mesh(vf,yf),this.clearStencilObject.frustumCulled=!1,this.clearStencilObject.onAfterRender=e=>e.clearStencil(),this.tileset=new hd(e,{tileLoader:e=>this.loadContent(e),tileUnloader:e=>this.unloadContent(e),onTileLoad:e=>{this.onTileLoad&&this.onTileLoad(e)},onTileUnload:e=>{this.onTileUnload&&this.onTileUnload(e)},onTileError:(e,t)=>{this.onError&&this.onError(Object.assign(t,{tile:e})),console.error(`Tile error`,e.id,t)},trajectoryLoader:e=>this.loadTrajectory(e),trajectoryUnloader:e=>this.unloadTrajectory(e),onTrajectoryLoad:()=>{},onTrajectoryUnload:e=>{},onTrajectoryError:(e,t)=>{this.onError&&this.onError(Object.assign(t,{error:t})),console.error(`Trajectory error`,e,t)}}),this.tileset.root.boundingVolume&&this.tileset.root.boundingVolume.getBoundingBox(this.boundingBox),this.currentResolvedParameterValue=G.resolveValueTo({},this.parameter)}get viewerRequestVolume(){return this.tileset.root.viewerRequestVolume}set viewerRequestVolume(e){this.tileset.root.viewerRequestVolume=e}get tiles(){return this.tileset.selectedTiles}get trajectories(){return this.tileset.trajectories}getRecommendProps(e={}){return cf(this,e)}loadContent(e){return zd(e,{light:this.light,fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(t=>{if(e.type===`SCENEGRAPH`){if(this.disposed||!e.content)Bd(e);else if(e.content.data)if(e.content.data.type===`spz`){let t=e.content.data.object.children[0].boundingBox;this.boundingBox.union(t)}else this.boundingBox.expandByObject(e.content.data.object)}})}unloadContent(e){return Bd(e),Promise.resolve()}loadAllTilesets(){let e=t=>{let n=[];return this.tileset.root.traverse(e=>{var t;e.type===`TILESET`&&((t=e.content)==null?void 0:t.loadState)!==`READY`&&n.push(e)}),Promise.all(n.map(t=>this.loadContent(t).then(()=>e(t)))).then(()=>{})};return e(this.tileset.root)}loadTrajectory(e){return qd(e,{fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(e=>{this.disposed&&Jd(e)})}unloadTrajectory(e){return Jd(e),Promise.resolve()}intersectRaycaster(e,t){var n,r;let i=t==null?[]:t,a=[this.tileset.root],o=this.tileset.transform,s=(r=(n=e.params.Points)==null?void 0:n.threshold)==null?0:r,c=e.sortByDistance;e.sortByDistance=!1;let l,u=1/0;for(;l=a.pop();){let t;if(l.boundingVolume){let n;n=l.boundingVolume instanceof wl?df.copy(l.boundingVolume):l.boundingVolume instanceof Tl?uf.copy(l.boundingVolume):l.boundingVolume.clone(),n.applyMatrix4(o),t=n.intersectRay(e.ray,s,u)}else t=!0;if(t){for(let e=0,t=l.children.length;e<t;e++)a.push(l.children[e]);if(l.selected&&l.content&&l.content.data&&l.content.data.object.visible){let t=e.hitFilter;if(e.hitFilter=n=>{var r;return Object.assign(n,{model:(r=this.parent)==null?void 0:r,viewLayer:this,tile:l}),t?t.call(e,n):!0},l.content.data.object.intersectRaycaster(e,i),e.hitFilter=t,e.firstHitOnly){let e=i[0];e&&u>e.distance&&(u=e.distance)}}}}return e.sortByDistance=c,Gl(i,e.sortByDistance,e.firstHitOnly),i}update(e,t,n,r){var i,a,o,s,l,u,d;this.renderer=e,this.frameNumber++;let f=!1,p=G.resolveValueTo(this.currentResolvedParameterValue,n.parameter,r.parameter,this.parameter);ff.get(this)!==p.versionNumber&&(ff.set(this,p.versionNumber),f=!0);let m=(s=this.visible&&((i=this.parent)==null?void 0:i.visible)&&((o=(a=this.parent)==null?void 0:a.parent)==null?void 0:o.visible))==null?!1:s,h=p.maxLevelOfDetail;h=Math.max(h,0);let g=Math.min(p.minLevelOfDetail,h);(!m||!this.loaded||!n.loaded)&&(h=Math.max(g,0));let _=p.maxMemoryUsage;m||(_=Math.min(0,_));let v=p.minGeometricError,y=p.maxRequests,b=p.memoryAdjustedScreenSpaceError;m||(b=!1);let x=t.controllerMode;(x===`Panorama`||x===`VRPanorama`||x===`XRPanorama`)&&(p.modelAlpha<.1&&(v=p.panoramaMinGeometricError,b=!1),p.progress>=.01&&p.progress<=.99&&(y=0));let S=p.maxGeometricError;S=Math.max(v,S);let C={time:t.time,camera:{type:t.type,position:new c.Vector3().copy(t.position),direction:t.getDirection(new c.Vector3),up:new c.Vector3().copy(t.up).applyQuaternion(t.quaternion),projectionMatrix:t.projectionMatrix.clone(),visible:m&&t.visible,refine:t.refineModel},height:t.resolution.height,pixelRatio:t.pixelRatio,frameNumber:this.frameNumber,sseDenominator:2*Math.tan(.5*t.fov/180*Math.PI),cullingVolume:new Cl().setFromCamera(t),minLevelOfDetail:g,maxLevelOfDetail:h,minGeometricError:v,maxGeometricError:S,skipLevelOfDetail:p.skipLevelOfDetail,mostDetail:p.mostDetail,loadSiblings:p.loadSiblings,cameraCulling:p.cameraCulling,maxMemoryUsage:_,maxRequests:y,requestOrder:p.requestOrder,maxScreenSpaceError:p.maxScreenSpaceError,memoryAdjustedScreenSpaceError:b},w=p.cacheCameras.map(e=>(e.updateProjectionMatrix(),Object.assign(Object.assign({},C),{camera:{type:t.type,position:new c.Vector3().copy(e.position),direction:e.getWorldDirection(new c.Vector3),up:new c.Vector3().copy(e.up),projectionMatrix:e.projectionMatrix.clone(),visible:e.visible,refine:!0},cullingVolume:new Cl().setFromCamera(e)})));this.updateWorldMatrix(!0,!1),this.tileset.transform.equals(this.matrixWorld)||(this.tileset.transform.copy(this.matrixWorld),f=!0);let T=!this.autoRefine;if(T===!1&&p.progress>=.01&&p.progress<=.99){let e=new c.Vector3;p.pano0&&e.setFromMatrixPosition(p.pano0.matrix);let t=e.clone();p.pano1&&t.setFromMatrixPosition(p.pano1.matrix),e.distanceTo(t)<10&&(T=!0)}if(T||this.tileset.update(C,w),this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.tileset.needsRefinedTiles.forEach(e=>{if(this.refineProgress[1]++,e.content){let t=e.content.loadState;if(t===`UNLOADED`||t===`LOADING`){this.refined=!1;return}}this.refineProgress[0]++}),this.loaded===!1&&this.autoRefine){this.loaded=!0;let e=!1;this.tileset.needsRefinedTiles.forEach(t=>{if(this.loaded!==!1&&t.content&&(t.state.visible&&(e=!0),p.minLevelOfDetail>=0)){if(C.skipLevelOfDetail){if(t.state.finalResolution){let e=t.state.ancestorWithContentAvailable,n=(e&&e.content?e.content:t.content).loadState;(n===`UNLOADED`||n===`LOADING`)&&(this.loaded=!1)}}else if(t.state.visible&&t.levelOfContent<=0){let e=t.content.loadState;(e===`UNLOADED`||e===`LOADING`)&&(this.loaded=!1)}}}),e&&this.tileset.selectedTiles.length===0&&this.tileset.frameNumber<500&&(this.loaded=!1),this.loaded===!0&&(this.refined=!1,this.refineProgress[1]++)}this.renderObjects.length=0,this.backfaceObjects.length=0,this.tileObjects.length=0;for(let e=this.children.length-1;e>=0;e--)this.remove(this.children[e]);C.skipLevelOfDetail||this.tileset.selectedTiles.sort((e,t)=>e.floor===t.floor?e.levelOfContent===t.levelOfContent?e.state.distanceToCamera===t.state.distanceToCamera?e.state.centerZDepth-t.state.centerZDepth:e.state.distanceToCamera-t.state.distanceToCamera:t.levelOfContent-e.levelOfContent:e.floor-t.floor);let E=[];for(let r of this.tileset.selectedTiles){let i=(u=(l=r.content)==null?void 0:l.data)==null?void 0:u.object;if(!i)continue;let a=i.update(e,t,n,this,r,p);if(E.push(r.id),a&&(f=!0),this.tileset.hasMixedContent&&C.skipLevelOfDetail){if(!r.state.finalResolution){let e=bf(i);e.name=`skipBackface:`+i.name,this.backfaceObjects.push(e)}let e=r.state.selectionDepth,t=hf.TILE_MASK|e<<hf.SKIP_LOD_BIT_SHIFT,n=c.GreaterEqualStencilFunc,a=hf.SKIP_LOD_MASK,o=c.ReplaceStencilOp,s=hf.TILE_MASK|hf.SKIP_LOD_MASK;for(let e of i.materials)e.stencilWrite=!0,e.stencilRef=t,e.stencilFunc=n,e.stencilFuncMask=a,e.stencilZPass=o,e.stencilWriteMask=s}else for(let e of i.materials)e.stencilWrite=!1,e.stencilRef=hf.TILE_MASK,e.stencilFunc=c.AlwaysStencilFunc,e.stencilFuncMask=hf.TILE_MASK,e.stencilZPass=c.ReplaceStencilOp,e.stencilWriteMask=hf.TILE_MASK;this.tileObjects.push(i)}let D=E.toString();if(pf.get(this)!==D&&(pf.set(this,D),f=!0),C.skipLevelOfDetail&&this.backfaceObjects.length)for(let e=0;e<this.backfaceObjects.length;e++)this.renderObjects.push(this.backfaceObjects[e]);if(this.tileObjects.length)for(let e=0;e<this.tileObjects.length;e++)this.renderObjects.push(this.tileObjects[e]);C.skipLevelOfDetail&&this.renderObjects.push(this.clearStencilObject);let O=[];for(let r of this.tileset.selectedTrajectories){let i=(d=r.content.data)==null?void 0:d.object;if(!i)continue;let a=i.update(e,t,n,this,r,p);O.push(r.id),a&&(f=!0),this.renderObjects.push(i)}let k=O.toString();if(mf.get(this)!==k&&(mf.set(this,k),f=!0),this.parent){let e=this.parent.children.length+1,t=(Math.min(0,this.parent.children.indexOf(this))-e)*1e4+1;for(let e=0;e<this.renderObjects.length;e++){let n=this.renderObjects[e],r=e+t;n.traverse(e=>{(e instanceof c.Mesh||e instanceof c.Line||e instanceof c.Points)&&(e.renderOrder=r)})}}if(this.loaded)for(let e=0;e<this.renderObjects.length;e++)this.add(this.renderObjects[e]);return f}dispose(){this.disposed=!0,this.tileset.reset(),this.tileset.root.children.length=0,/^blob\:/.test(this.tileset.id)&&URL.revokeObjectURL(this.tileset.id);for(let e=this.children.length-1;e>=0;e--)this.remove(this.children[e]);this.refined=!1,this.loaded=!1,this.refineProgress[0]=this.refineProgress[1]=0,this.error=null,this.onError=void 0,this.renderer=void 0}get model(){return this.parent}get scene(){return this}get viewLayer(){return this}localToEnu(e){return e.applyMatrix4(sf)}enuToLocal(e){return e.applyMatrix4(of)}enuToEcef(e){return e.applyMatrix4(this.coordinateSystem.enuToEcefMatrix)}ecefToEnu(e){return e.applyMatrix4(this.coordinateSystem.ecefToEnuMatrix)}localToEcef(e){return this.enuToEcef(this.localToEnu(e))}ecefToLocal(e){return this.enuToLocal(this.ecefToEnu(e))}localToLla(e){return ef(this.enuToEcef(this.localToEnu(e)))}llaToLocal(e){return this.enuToLocal(this.ecefToEnu(tf(e)))}worldToEnu(e){return this.localToEnu(this.worldToLocal(e))}enuToWorld(e){return this.localToWorld(this.enuToLocal(e))}worldToEcef(e){return this.localToEcef(this.worldToLocal(e))}ecefToWorld(e){return this.localToWorld(this.ecefToLocal(e))}worldToLla(e){return this.localToLla(this.worldToLocal(e))}llaToWorld(e){return this.localToWorld(this.llaToLocal(e))}get coordinates(){lf.setScalar(0);let{x:e,y:t}=this.localToLla(lf);return[e,t].map(e=>(e/Math.PI*180).toFixed(6)).join(`,`)}getTransformMatrix4(e=new c.Matrix4){return e.copy(this.coordinateSystem.ecefToEnuMatrix),e.premultiply(of),e.premultiply(this.matrixWorld),e}coordinatesToWorldPoint(e){let t=new c.Vector3(e.latitude,e.longitude,e.altitude);return this.llaToWorld(t)}worldPointToCoordinates(e){return lf.copy(e),this.worldToLla(lf),{latitude:lf.x,longitude:lf.y,altitude:lf.z}}resetBrightness(){this.parameter.reset(`brightness`)}get minLevelOfDetail(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`minLevelOfDetail`,...e)}set minLevelOfDetail(e){this.parameter.set(`minLevelOfDetail`,e)}get maxLevelOfDetail(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxLevelOfDetail`,...e)}set maxLevelOfDetail(e){this.parameter.set(`maxLevelOfDetail`,e)}get minGeometricError(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`minGeometricError`,...e)}set minGeometricError(e){this.parameter.set(`minGeometricError`,e)}get maxGeometricError(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxGeometricError`,...e)}set maxGeometricError(e){this.parameter.set(`maxGeometricError`,e)}get panoramaMinGeometricError(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`panoramaMinGeometricError`,...e)}set panoramaMinGeometricError(e){this.parameter.set(`panoramaMinGeometricError`,e)}get skipLevelOfDetail(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`skipLevelOfDetail`,...e)}set skipLevelOfDetail(e){this.parameter.set(`skipLevelOfDetail`,e)}get mostDetail(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`mostDetail`,...e)}set mostDetail(e){this.parameter.set(`mostDetail`,e)}get loadSiblings(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`loadSiblings`,...e)}set loadSiblings(e){this.parameter.set(`loadSiblings`,e)}get maxMemoryUsage(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxMemoryUsage`,...e)}set maxMemoryUsage(e){this.parameter.set(`maxMemoryUsage`,e)}get maxRequests(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxRequests`,...e)}set maxRequests(e){this.parameter.set(`maxRequests`,e)}get requestOrder(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`requestOrder`,...e)}set requestOrder(e){this.parameter.set(`requestOrder`,e)}get maxScreenSpaceError(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxScreenSpaceError`,...e)}set maxScreenSpaceError(e){this.parameter.set(`maxScreenSpaceError`,e)}},Sf={};function Cf(e,t){let n=Sf[e];if(n){let e=n.get(t);if(e)return e}throw Error(`fetcher workCode:${t.workCode} never registered.`)}function wf(e,t,n){let r=Sf[e];r||(r=Sf[e]=new WeakMap),r.has(t)||r.set(t,n)}var Tf=new c.Matrix4,Ef=new c.Vector3,Df=new c.Matrix4;function Of(e,t,n){switch(e){case`Z`:n.identity();break;case`WGS84`:case`GCJ02`:case`BD09`:nf(t,n);break;default:n.identity();break}return n}function kf(e){var t;let[n,r]=e.tilesetUrl.split(`#`),i=(t=(r||n).split(`?`)[1])==null?``:t;return e.fetcher.ajax(e.tilesetUrl,{responseType:`text`}).catch(e=>({error:e,body:JSON.stringify({asset:{version:`0.0`},geometricError:0,root:{geometricError:0}})})).then(t=>{var n;let r=`error`in t?t.error:null,a=_d(JSON.parse(t.body),e.tilesetUrl),{root:o,rootMeta:s={}}=a,l=e.upAxis;s.upAxis&&s.upAxis!==l&&(l=s.upAxis),`lodVersion`in a&&(l=`-Y`,`floorInfo`in a&&(a.properties=a.properties||{},a.properties.floorInfo=a.floorInfo.map(e=>({ground:-e.ground,height:e.height})),a.floorInfo=void 0),a.asset.tilesetVersion=String(a.lodVersion),a.lodVersion=void 0);let u=l,d=new c.Matrix4;u===`Y`?(u=`Z`,d.fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1])):u===`-Y`&&(u=`Z`,d.fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]));let f=o.boundingVolume?Ol(o.boundingVolume):void 0;f&&o.transform&&f.applyMatrix4(Df.fromArray(o.transform));let p=null,m=new c.Matrix4,h=new c.Matrix4;return s.coordinate?(p=s.coordinate.ground_height,m.fromArray(s.coordinate.pose_ecef_to_enu),h.fromArray(s.coordinate.pose_enu_to_ecef)):(f?f.getCenter(Ef):Ef.setScalar(0),Ef.applyMatrix4(d),Of(u,Ef,m),h.getInverse(m)),a.root={refine:(n=o.refine)==null?`REPLACE`:n,geometricError:o.geometricError,transform:Df.copy(d).premultiply(u===`Z`?Tf:m).premultiply(of).toArray(),boundingVolume:f?f.toJson():void 0,children:[o]},new xf(a,{name:e.name,type:e.type,upAxis:l,light:e.light,fetcher:e.fetcher,search:i,groundHeight:p,coordinateSystem:{enuToEcefMatrix:h,ecefToEnuMatrix:m},error:r})})}function Af(e,t){var n;let r=e.layers.map(e=>({tilesetUrl:e.work.getURL(e.tileset),name:e.name,type:e.type,upAxis:e.upAxis,light:t.light,fetcher:t.fetcher}));if(e.file){let i=!1;for(let e of r)if(e.type===`mesh`){i=!0;break}if(i===!1){let i=Dr(e.file)||`.at3d`,a=JSON.stringify({tilesetUrl:``,asset:{version:`0.0`},geometricError:0,root:{refine:`REPLACE`,geometricError:0,transform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],content:{uri:e.work.getURL(e.file)},extras:{[i.slice(1)]:{upAxis:e.upAxis,textureBaseUri:typeof e.textureBase==`string`?e.work.getURL(e.textureBase):void 0,textureArray:e.textures,textureOptions:(n=t.textureOptions)==null?{}:n}}},rootMeta:{coordinate:e.coordinate}});r.push({name:`fallback`,type:`mesh`,upAxis:`Z`,tilesetUrl:URL.createObjectURL(new Blob([a],{type:`application/json`})),fetcher:t.fetcher,light:t.light})}}let i=r.map(e=>kf(e).then(e=>e));return Promise.all(i)}function jf(e=1,t=1,n=1){let r=e/2,i=t/2,a=n/2,o=new Float32Array([-r,+i,+a,+r,+i,+a,+r,+i,-a,-r,+i,-a,-r,-i,+a,+r,-i,+a,+r,-i,-a,-r,-i,-a]),s=new Uint32Array([0,4,1,1,4,5,1,5,2,2,5,6,2,6,3,3,6,7,3,7,0,0,7,4,3,0,2,2,0,1,4,7,5,5,7,6]),l=new c.BufferGeometry;return l.setAttribute(`position`,new c.BufferAttribute(o,3)),l.setIndex(new c.BufferAttribute(s,1)),l.addGroup(0,l.index.count,0),l.computeBoundingBox(),l.computeBoundingSphere(),l}function Mf(e,t){for(var n=e[0].index!==null,r=new Set(Object.keys(e[0].attributes)),i=new Set(Object.keys(e[0].morphAttributes)),a={},o={},s=new c.BufferGeometry,l=0,u=0;u<e.length;++u){var d=e[u];if(n!==(d.index!==null))return null;for(var f in d.attributes){if(!r.has(f))return null;a[f]===void 0&&(a[f]=[]),a[f].push(d.attributes[f])}for(var f in d.morphAttributes){if(!i.has(f))return null;o[f]===void 0&&(o[f]=[]),o[f].push(d.morphAttributes[f])}if(s.userData.mergedUserData=s.userData.mergedUserData||[],s.userData.mergedUserData.push(d.userData),t){var p;if(n)p=d.index.count;else if(d.attributes.position!==void 0)p=d.attributes.position.count;else return null;s.addGroup(l,p,u),l+=p}}if(n){for(var m=0,h=[],u=0;u<e.length;++u){for(var g=e[u].index,_=0;_<g.count;++_)h.push(g.getX(_)+m);m+=e[u].attributes.position.count}s.setIndex(h)}for(var f in a){var v=Nf(a[f]);if(!v)return null;s.setAttribute(f,v)}for(var f in o){var y=o[f][0].length;if(y===0)break;s.morphAttributes=s.morphAttributes||{},s.morphAttributes[f]=[];for(var u=0;u<y;++u){for(var b=[],_=0;_<o[f].length;++_)b.push(o[f][_][u]);var x=Nf(b);if(!x)return null;s.morphAttributes[f].push(x)}}return s}function Nf(e){for(var t,n,r,i=0,a=0;a<e.length;++a){var o=e[a];if(o.isInterleavedBufferAttribute||(t===void 0&&(t=o.array.constructor),t!==o.array.constructor)||(n===void 0&&(n=o.itemSize),n!==o.itemSize)||(r===void 0&&(r=o.normalized),r!==o.normalized))return null;i+=o.array.length}for(var s=new t(i),l=0,a=0;a<e.length;++a)s.set(e[a].array,l),l+=e[a].array.length;return new c.BufferAttribute(s,n,r)}function Pf(e,t=1e-4){t=Math.max(t,Number.EPSILON);for(var n={},r=e.getIndex(),i=e.getAttribute(`position`),a=r?r.count:i.count,o=0,s=Object.keys(e.attributes),l={},u={},d=[],f=[`getX`,`getY`,`getZ`,`getW`],p=0,m=s.length;p<m;p++){var h=s[p];l[h]=[];var g=e.morphAttributes[h];g&&(u[h]=Array(g.length).fill().map(()=>[]))}for(var _=Math.log10(1/t),v=Math.pow(10,_),p=0;p<a;p++){for(var y=r?r.getX(p):p,b=``,x=0,m=s.length;x<m;x++)for(var h=s[x],S=e.getAttribute(h),C=S.itemSize,w=0;w<C;w++)b+=`${~~(S[f[w]](y)*v)},`;if(b in n)d.push(n[b]);else{for(var x=0,m=s.length;x<m;x++)for(var h=s[x],S=e.getAttribute(h),g=e.morphAttributes[h],C=S.itemSize,T=l[h],E=u[h],w=0;w<C;w++){var D=f[w];if(T.push(S[D](y)),g)for(var O=0,k=g.length;O<k;O++)E[O].push(g[O][D](y))}n[b]=o,d.push(o),o++}}let A=e.clone();for(var p=0,m=s.length;p<m;p++){var h=s[p],j=e.getAttribute(h),M=new j.array.constructor(l[h]),S=new c.BufferAttribute(M,j.itemSize,j.normalized);if(A.setAttribute(h,S),h in u)for(var x=0;x<u[h].length;x++){var N=e.morphAttributes[h][x],M=new N.array.constructor(u[h][x]),ee=new c.BufferAttribute(M,N.itemSize,N.normalized);A.morphAttributes[h][x]=ee}}return A.setIndex(d),A}var Ff=new c.Sphere,If=new c.Matrix4,Lf=new c.Matrix4;function Rf(e,t,n=30/180*Math.PI){let r=Math.cos(n),i=[];for(let n of e.children)n instanceof xf&&n.tileset.selectedTiles.forEach(e=>{var n,a,o;let s=(a=(n=e.content)==null?void 0:n.data)==null?void 0:a.object;if(s&&s.visible){let e=[];if(s.traverseVisible(n=>{if(n instanceof c.Mesh){let r=Ou(n);if(r){If.copy(n.matrixWorld),Lf.getInverse(If),Ff.copy(t).applyMatrix4(Lf);let i=r.trianglesInSphere(Ff.center,Ff.radius),a=new c.BufferGeometry;a.setAttribute(`position`,new c.BufferAttribute(i,3)),a.applyMatrix4(n.matrixWorld),a=Pf(a,.01),e.push(a)}}}),e.length===0)return;let n=[`a`,`b`,`c`],a=Mf(e,!1),l=a.getAttribute(`position`).array,u=((o=a.getIndex())==null?void 0:o.array)||[],d=[],f=[];for(let e=0,t=l.length;e<t;e+=3){let t=new c.Vector3(l[e],l[e+1],l[e+2]);d.push(t)}for(let e=0,t=u.length;e<t;e+=3){let t=u[e],n=u[e+1],r=u[e+2],i=new c.Vector3().crossVectors(d[n].clone().sub(d[t]),d[r].clone().sub(d[t])).normalize();f.push({a:t,b:n,c:r,normal:i})}let p={};for(let e=0,t=f.length;e<t;e++){let t=f[e];for(let r=0;r<3;r++){let i=t[n[r]],a=t[n[(r+1)%3]],o=[Math.min(i,a),Math.max(i,a)],s=o[0]+`-`+o[1];p[s]===void 0?p[s]={index1:o[0],index2:o[1],face1:e}:p[s].face2=e}}for(let e in p){let t=p[e];if(t.face2===void 0||f[t.face1].normal.dot(f[t.face2].normal)<=r){let e=d[t.index1],n=d[t.index2];i.push(new c.Line3(e,n))}}d.length=0,f.length=0}});return i}var zf=new c.Box3,Bf=new c.Box3,Vf=new c.Box3,Hf=class extends c.Object3D{constructor(e,t,n={}){var r;super(),this.disposed=!1,this.parameter=new G,this.outdated=!1,this.autoRefine=!0,this.metaPending=!1,this.loaded=!1,this.refined=!1,this.refineProgress=[0,0],this.boundingBox=new c.Box3,this.fiveId=e,this.needsRender=!1,this.work=t,this.name=t.workCode;let i=0;for(let e of t.observers)i=Math.max(i,e.floorIndex);if(this.floorLength=i+1,t.model){this.metaPending=!0;let e=Af(t.model,{fetcher:Cf(this.fiveId,t),light:(r=n.light)==null?!1:r,textureOptions:n.textureOptions}),i=e=>this.dispatchEvent({type:`error`,error:e}),a=e=>this.dispatchEvent({type:`tileLoad`,tile:e}),o=e=>this.dispatchEvent({type:`tileUnload`,tile:e});this.initReady=e.then(e=>{var t;this.metaPending=!1;let n=null,r=null,s=null;for(let t of e){if(t.visible=!1,t.onError=i,t.onTileLoad=a,t.onTileUnload=o,t.error){i(t.error);continue}t.type===`mesh`?n===null&&(n=t):t.type===`point_cloud`?r===null&&(r=t):s===null&&(s=t)}let c=(t=n==null?r:n)==null?s:t;if(c&&(c.visible=!0),e.length)if(this.disposed)for(let t of e)t.dispose();else this.add(...e);return this}),this.loadedReady=new Promise(e=>{let t=()=>{e(this),this.removeEventListener(`load`,t),this.removeEventListener(`dispose`,t)};this.addEventListener(`load`,t),this.addEventListener(`dispose`,t)})}else this.refined=!0,this.loaded=!0,this.initReady=Promise.resolve(this),this.loadedReady=Promise.resolve(this);this.parameter.set(`boundingBox`,this.boundingBox.clone())}dispose(){this.disposed=!0;let e;for(;e=this.children[0];)typeof e.dispose==`function`&&e.dispose(),e.onError=void 0,e.onTileLoad=void 0,e.onTileUnload=void 0,this.remove(e);this.dispatchEvent({type:`dispose`})}get empty(){return this.children.length===0}get viewLayers(){return this.children}getEdgesBySphere(e,t=30/180*Math.PI){return Rf(this,e,t)}intersectRaycaster(e,t){let n=t==null?[]:t,r=e.sortByDistance;e.sortByDistance=!1;for(let t=0,r=this.children.length;t<r;t++){let r=this.children[t];r.visible&&typeof r.intersectRaycaster==`function`&&r.intersectRaycaster(e,n)}return e.sortByDistance=r,Gl(n,e.sortByDistance,e.firstHitOnly),n}update(e,t,n){let r=!1;this.needsRender===!0&&(this.needsRender=!1,r=!0);let i=this.loaded;this.refined=!this.metaPending,this.loaded=!this.metaPending,this.refineProgress[0]=this.refineProgress[1]=0,this.work.transform.equals(this.matrix)||(this.matrix.copy(this.work.transform),this.matrix.decompose(this.position,this.quaternion,this.scale),this.matrixAutoUpdate=!1,r=!0);for(let i of this.children)i.autoRefine=this.autoRefine,i.update(e,t,n,this)&&(r=!0),i.refined===!1&&(this.refined=!1),i.loaded===!1&&(this.loaded=!1),this.refineProgress[0]+=i.refineProgress[0],this.refineProgress[1]+=i.refineProgress[1];zf.makeEmpty(),Vf.copy(this.work.observerBox),Vf.isEmpty()||(Vf.max.x+=1,Vf.max.z+=1,Vf.max.y+=1,--Vf.min.x,--Vf.min.z,zf.union(Vf));for(let e of this.viewLayers)e.boundingBox.isEmpty()||(Bf.copy(e.boundingBox),zf.union(Bf));return zf.applyMatrix4(this.matrix),zf.equals(this.boundingBox)||(this.boundingBox.copy(zf),this.parameter.set(`boundingBox`,zf.clone())),i===!1&&this.loaded===!0&&this.dispatchEvent({type:`load`}),r}localToEnu(e){return e.applyMatrix4(sf)}enuToLocal(e){return e.applyMatrix4(of)}worldToEnu(e){return this.localToEnu(this.worldToLocal(e))}enuToWorld(e){return this.localToWorld(this.enuToLocal(e))}get shownFloor(){return this.shownFloorIndex===-1?null:this.shownFloorIndex}set shownFloor(e){this.shownFloorIndex=e===null?-1:e}show(e){this.shownFloor=e==null?null:e,this.dispatchEvent({type:`changeShownFloor`,floorIndex:e==null?null:e})}get bounding(){return this.boundingBox}setMaterial(e){this.parameter.set(e)}getMaterial(){let e=[];return this.parent&&this.parent.parameter instanceof G&&e.unshift(this.parent.parameter),this.parameter.resolveValue(...e)}get shownFloorIndex(){let e=[];return this.parent&&this.parent.parameter instanceof G&&e.unshift(this.parent.parameter),this.parameter.resolveValue(`shownFloorIndex`,...e)}set shownFloorIndex(e){this.parameter.set(`shownFloorIndex`,e)}get brightness(){let e=[];return this.parent&&this.parent.parameter instanceof G&&e.unshift(this.parent.parameter),this.parameter.resolveValue(`brightness`,...e)}set brightness(e){this.parameter.set(`brightness`,e)}get clippers(){let e=[];return this.parent&&this.parent.parameter instanceof G&&e.unshift(this.parent.parameter),this.parameter.resolveValue(`clippers`,...e)}set clippers(e){this.parameter.set(`clippers`,e)}get customShaders(){let e=[];return this.parent&&this.parent.parameter instanceof G&&e.unshift(this.parent.parameter),this.parameter.resolveValue(`customShaders`,...e)}set customShaders(e){this.parameter.set(`customShaders`,e)}resetBrightness(){this.parameter.reset(`brightness`);for(let e of this.viewLayers)e.resetBrightness()}},Uf=jf(1,1,1);Uf.applyMatrix4(new c.Matrix4().makeScale(-1,1,1));var Wf=new WeakMap,Gf=new c.Vector3(1,1,1),Kf=new c.Box3,qf=new c.Vector3,Jf=new c.Box3,Yf=new c.Vector3,Xf=new c.Vector3,Zf=class extends bn{constructor(e={}){var t;let n=new yn(`none`);n.flatShading=!0,n.depthWrite=!1,n.transparent=!1,n.blending=c.CustomBlending,n.blendSrc=c.SrcAlphaFactor,n.blendDst=c.OneMinusSrcAlphaFactor,n.blendSrcAlpha=c.OneFactor,n.blendDstAlpha=c.OneMinusSrcAlphaFactor,n.floorIndex=-1,super(Uf,[n]),this.name=(t=e.name)==null?``:t,this.frustumCulled=!1,this.renderOrder=-999999,this.currentResolvedParameterValue=G.resolveValueTo({})}update(e,t,n){var r,i;let a=!1,o=G.resolveValueTo(this.currentResolvedParameterValue,n.parameter);Kf.copy(o.boundingBox),Kf.getSize(qf);let s=Math.min(qf.x/2,500);Kf.min.x-=s,Kf.max.x+=s;let c=Math.min(qf.y/2,500);Kf.min.z-=c,Kf.max.z+=c;let l=qf.length()/2;if(Kf.max.y=Math.max(Kf.max.y,l),Kf.union(Jf.setFromCenterAndSize(t.position,Gf)),Kf.expandByScalar(1),Kf.getCenter(Yf),Kf.getSize(Xf),Yf.equals(this.position)||(this.position.copy(Yf),a=!0),Xf.equals(this.scale)||(this.scale.copy(Xf),a=!0),Wf.get(this)!==o.versionNumber){Wf.set(this,o.versionNumber),a=!0;let e=this.material;for(let t of e)t.customShaders=o.customShaders,t.pano0=o.pano0,t.pano1=o.pano1,t.panoFilter=(i=(r=o.panoFilter)==null?void 0:r.toValue())==null?null:i,t.refinedScreen=o.refinedScreen,t.modelAlpha=o.modelAlpha,t.progress=o.progress,t.transition=o.transition,t.opacity=o.opacity,t.floorStyle=o.floorStyle,t.constantColor=o.constantColor,t.shownFloorIndex=o.shownFloorIndex,t.clippers=o.clippers,t.brightness=o.brightness,t.useHQWeight=o.useHQWeight,t.useHQDepth=o.useHQDepth,t.colorSaturation=o.colorSaturation,t.colorBrightness=o.colorBrightness,t.gradientTexture=o.gradientTexture,t.transparent=!1,t.modelBoundingMax.copy(o.boundingBox.max),t.modelBoundingMin.copy(o.boundingBox.min),o.useAddBlend&&(t.opacity=0),t.opacity===0&&(t.visible=!1)}return a}dispose(){for(let e of this.material)e.dispose(),e.pano0=null,e.pano1=null}},Qf=new c.Box3,$f=class extends c.Scene{constructor(e){super(),this.needsRender=!0,this.autoRefine=!0,this.boundingBox=new c.Box3,this.loaded=!1,this.refined=!1,this.refineProgress=[0,0],this.parameter=new G,this.fiveId=e.fiveId,this.boundingMesh=new Zf({name:`bounding`}),this.add(this.boundingMesh);let t=this.models=[];this.shownModels=[],this.updateModelMap=new Map,this.parameter.set(`boundingBox`,this.boundingBox.clone());let n=this;V(t,`autoUpdate`,{get(){return n.autoRefine},set(e){n.autoRefine=e}}),V(t,`bounding`,{get(){return n.boundingBox}}),V(t,`loaded`,{get(){return n.loaded}}),V(t,`refined`,{get(){return n.refined}}),V(t,`refineProgress`,{get(){return n.refineProgress}}),V(t,`cacheCameras`,{get(){return n.parameter.resolveValue(`cacheCameras`)},set(e){n.parameter.set(`cacheCameras`,e)}}),V(t,`intersectRaycaster`,{value:e=>n.intersectRaycaster(e)}),V(t,`setMaterial`,{value:e=>n.setMaterial(e)}),V(t,`getMaterial`,{value:()=>n.getMaterial()}),V(t,`resetBrightness`,{value:()=>n.resetBrightness()})}setModels(e,t){let n=e.map(e=>{let n=this.shownModels.filter(t=>t.work.workCode===e.workCode)[0];if(n||(n=this.models.filter(t=>t.work.workCode===e.workCode)[0],n))return n.work=e,n;n=new Hf(this.fiveId,e,{light:t.light,textureOptions:t.textureOptions});let r=t[`3d-tiles`];return n.initReady.then(()=>{if(r)if(typeof r==`function`)for(let e of n.viewLayers){let t=r(e,n);t&&(t.viewerRequestVolume&&(e.viewerRequestVolume=Ol(t.viewerRequestVolume)),e.parameter.set(yr(t,[`showLayers`])),t.showLayers===!1?e.visible=!1:Array.isArray(t.showLayers)&&(e.visible=t.showLayers.includes(e.name)))}else for(let e of n.viewLayers)r.viewerRequestVolume&&(e.viewerRequestVolume=Ol(r.viewerRequestVolume)),e.parameter.set(yr(r,[`showLayers`])),r.showLayers===!1?e.visible=!1:Array.isArray(r.showLayers)&&(e.visible=r.showLayers.includes(e.name))}),this.dispatchEvent({type:`model.create`,model:n}),n});for(let e=0;e<this.models.length;e++){let t=this.models[e];n.indexOf(t)===-1&&this.shownModels.indexOf(t)===-1&&(t.dispose(),this.dispatchEvent({type:`model.dispose`,model:t}))}this.models.length=0;for(let e=0;e<n.length;e++){let t=n[e];this.models.push(t)}if(t.forceReplaceImmediately&&!Bl(this.models,this.shownModels)){for(let e=0;e<this.shownModels.length;e++){let t=this.shownModels[e];this.models.indexOf(t)===-1&&(t.dispose(),this.dispatchEvent({type:`model.dispose`,model:t}))}this.shownModels.length=0;for(let e=0;e<this.models.length;e++)this.shownModels.push(this.models[e])}return this.loaded=!1,this.refined=!1,this.models}get empty(){return this.boundingBox.isEmpty()}intersectRaycaster(e,t){let n=t==null?[]:t,r=this.shownModels.filter(e=>e.visible);if(r.length===1)r[0].intersectRaycaster(e,n);else{let t=e.sortByDistance;e.sortByDistance=!1;for(let t of r)t.intersectRaycaster(e,n);e.sortByDistance=t,Gl(n,e.sortByDistance,e.firstHitOnly)}return n}update(e,t){let n=!1;Qf.makeEmpty(),this.loaded=this.models.length>0,this.refined=this.models.length>0,this.refineProgress[0]=this.refineProgress[1]=0,this.updateModelMap.clear();for(let n=0;n<this.models.length;n++){let r=this.models[n];if(!this.updateModelMap.has(r)){let n=r.autoRefine;this.autoRefine===!1&&(r.autoRefine=!1);let i=r.update(e,t,this);r.autoRefine=n,this.updateModelMap.set(r,i)}r.loaded===!1&&(this.loaded=!1),r.refined===!1&&(this.refined=!1),this.refineProgress[0]+=r.refineProgress[0],this.refineProgress[1]+=r.refineProgress[1]}if((this.loaded===!0||this.models.length===0)&&!Bl(this.models,this.shownModels)){for(let e=0;e<this.shownModels.length;e++){let t=this.shownModels[e];this.models.indexOf(t)===-1&&(t.dispose(),this.dispatchEvent({type:`model.dispose`,model:t}))}this.shownModels.length=0;for(let e=0;e<this.models.length;e++)this.shownModels.push(this.models[e]);n=!0}for(let n=0;n<this.shownModels.length;n++){let r=this.shownModels[n];if(!this.updateModelMap.has(r)){let n=r.autoRefine;(this.autoRefine===!1||this.models.indexOf(r)<0)&&(r.autoRefine=!1);let i=r.update(e,t,this);r.autoRefine=n,this.updateModelMap.set(r,i)}}for(let e=this.children.length-1;e>=0;e--){let t=this.children[e];t instanceof Hf&&this.remove(t)}for(let e=0;e<this.shownModels.length;e++){let t=this.shownModels[e];this.updateModelMap.get(t)===!0&&(n=!0),Qf.union(t.boundingBox),this.add(t)}for(let e=0;e<this.models.length;e++){let t=this.models[e];this.shownModels.indexOf(t)===-1&&Qf.union(t.boundingBox)}return Qf.equals(this.boundingBox)||(this.boundingBox.copy(Qf),this.parameter.set(`boundingBox`,this.boundingBox.clone()),n=!0),this.boundingMesh.update(e,t,this)&&(n=!0),this.updateModelMap.clear(),this.needsRender=n,n}get bounding(){return this.boundingBox}setMaterial(e){this.parameter.set(e)}getMaterial(){return this.parameter.resolveValue()}resetBrightness(){this.parameter.reset(`brightness`);for(let e of this.models)e.resetBrightness()}dispose(){this.remove(this.boundingMesh),this.boundingMesh.dispose();for(let e=this.children.length-1;e>=0;e--){let t=this.children[e];t instanceof Hf&&this.remove(t)}let e=Hl(this.models.concat(this.shownModels));for(let t=0;t<this.shownModels.length;t++)e[t].dispose();this.models.length=0,this.shownModels.length=0,super.dispose()}};function ep(e){let t={};return e.mode!==void 0&&(t.mode=e.mode),e.panoIndex!==void 0&&(t.pano_index=e.panoIndex),e.longitude!==void 0&&(t.longitude=e.longitude),e.latitude!==void 0&&(t.latitude=e.latitude),e.fov!==void 0&&(t.fov=e.fov),e.distance!==void 0&&(t.distance=e.distance),e.offset!==void 0&&(t.offset=e.offset.toArray()),t}function tp(e){var t;if(e)return{file_url:e.file,material_base_url:e.textureBase,material_textures:(t=e.textures)==null?void 0:t.slice(),up_axis:e.upAxis,layers:e.layers.map(e=>({tileset_url:e.tileset,up_axis:e.upAxis,name:e.name,type:e.type}))}}function np(e){return{index:e.index,derived_id:e.derivedId,derived_id_str:e.derivedIdStr,floor_index:e.floorIndex,position:e.position.toArray(),standing_position:e.standingPosition.toArray(),quaternion:{x:e.quaternion.x,y:e.quaternion.y,z:e.quaternion.z,w:e.quaternion.w},visible_nodes:e.accessibleNodes.slice(),accessible_nodes:e.accessibleNodes.slice()}}function rp(e){return{index:e.index,active:e.active,loadable:e.loadable,derived_id:e.derivedId,derived_id_str:e.derivedIdStr,size_list:e.images.sizeList.slice(),up:e.images.up,down:e.images.down,right:e.images.right,left:e.images.left,front:e.images.front,back:e.images.back,video:e.images.video?{matrix:e.images.video.matrix.toArray(),size:e.images.video.size.toArray(),source:e.images.video.source}:void 0}}function ip(e){return{allow_hosts:e.allowHosts.slice(),expire_at:e.expire.getTime().toString(),project_id:e.projectId,code:e.workCode,name:e.name,base_url:e.baseURL,initial:ep(e.initial),model:tp(e.model),observers:e.observers.map(e=>np(e)),panorama:{count:e.observers.length,list:e.observers.map(e=>rp(e))}}}function ap(e){let t=(e.x*2+1)*Math.PI,n=(.5-e.y)*Math.PI,r=Math.sin(n),i=Math.cos(n),a=Math.sin(t),o=Math.cos(t),s=i*a,l=r,u=i*o,d=Math.abs(s),f=Math.abs(l),p=Math.abs(u),m,h;if(d>=f&&d>=p){let e=1/d;s>0?(m=`right`,h=new c.Vector2(-u*e,l*e)):(m=`left`,h=new c.Vector2(u*e,l*e))}else if(f>=d&&f>=p){let e=1/f;l>0?(m=`up`,h=new c.Vector2(s*e,-u*e)):(m=`down`,h=new c.Vector2(s*e,u*e))}else{let e=1/p;u>0?(m=`front`,h=new c.Vector2(s*e,l*e)):(m=`back`,h=new c.Vector2(-s*e,l*e))}return h.x=(h.x+1)/2,h.y=1-(h.y+1)/2,[m,h]}function op(e,t){let n=t.x*2-1,r=(1-t.y)*2-1,i=0,a=0,o=0;switch(e){case`right`:i=1,a=r,o=-n;break;case`left`:i=-1,a=r,o=n;break;case`up`:i=n,a=1,o=-r;break;case`down`:i=n,a=-1,o=r;break;case`front`:i=n,a=r,o=1;break;case`back`:i=-n,a=r,o=-1;break;default:throw Error(`Invalid cubFace: ${e}`)}let s=Math.sqrt(i*i+a*a+o*o);if(s===0)return new c.Vector2(.5,.5);i/=s,a/=s,o/=s;let l=Math.atan2(i,o),u=Math.asin(Math.max(-1,Math.min(1,a))),d=(l+Math.PI)/(2*Math.PI),f=(Math.PI/2-u)/Math.PI;return d%=1,d=d<0?d+1:d,f=Math.max(0,Math.min(1,f)),new c.Vector2(d,f)}var sp={vectorToEquirectangularUv(e,t=`top-left`){let n=new c.Quaternion().setFromRotationMatrix(this.work.transform).inverse(),r=new c.Quaternion().copy(this.quaternion).inverse(),i=new c.Quaternion(0,1,0,0).inverse(),a=new c.Vector3().copy(e).normalize().applyQuaternion(n).applyQuaternion(r).applyQuaternion(i),o=Math.atan2(a.x,-a.z),s=Math.asin(-a.y);if(t===`top-left`)return new c.Vector2(o/(Math.PI*2)+.5,s/Math.PI+.5);if(t===`bottom-left`)return new c.Vector2(o/(Math.PI*2)+.5,.5-s/Math.PI);throw Error(`Invalid uvOrigin ${t}`)},vectorToCubemapUv(e,t=`top-left`){let n=ap(this.vectorToEquirectangularUv(e,`top-left`));if(t===`top-left`)return n;if(t===`bottom-left`){let[e,t]=n;return t.y=1-t.y,n}else throw Error(`Invalid uvOrigin ${t}`)},equirectangularUvToVector(e,t=`top-left`){let n=0;if(t===`top-left`)n=1;else if(t===`bottom-left`)n=-1;else throw Error(`Invalid uvOrigin ${t}`);let r=new c.Quaternion().setFromRotationMatrix(this.work.transform),i=new c.Quaternion().copy(this.quaternion),a=new c.Quaternion(0,1,0,0),o=Math.PI*2*(e.x+.5),s=Math.PI*(e.y-.5),l=Math.abs(Math.cos(s)),u=Math.sin(o)*l,d=-Math.sin(s)*n,f=-Math.cos(o)*l;return new c.Vector3(u,d,f).applyQuaternion(a).applyQuaternion(i).applyQuaternion(r)},cubemapUvToVector(e,t,n=`top-left`){let r;if(n===`top-left`)r=t;else if(n===`bottom-left`)r=new c.Vector2().copy(t),r.y=1-r.y;else throw Error(`Invalid uvOrigin ${n}`);let i=op(e,r);return this.equirectangularUvToVector(i)},getWorldPosition(){return new c.Vector3().copy(this.position).applyMatrix4(this.work.transform)},getWorldStandingPosition(){return new c.Vector3().copy(this.standingPosition).applyMatrix4(this.work.transform)}};function cp(e){return typeof e==`number`}function lp(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>typeof e!=`object`||!e?e:lp(e));{let t={};for(let n in e){let r=e[n];t[n]=typeof r!=`object`||!r?r:lp(r)}return t}}function up(e){return e==null?`null`:Array.isArray(e)?`array`:typeof e==`object`?`dict`:`value`}function dp(e,t){let n=up(e),r=up(t);if(r===`null`)return e;if(r===`value`)return t;if(r!==n)return lp(t);if(r===`array`)for(let n=0;n<t.length;n++)e[n]=dp(e[n],t[n]);else if(r===`dict`)for(let n in t)e[n]=dp(e[n],t[n]);return e}function fp(e,t=!1){let n=typeof e;if(n===`string`)return JSON.stringify(e);if(e===!0)return`true`;if(e===!1)return`false`;if(e===null)return`null`;if(e instanceof Array){let t=`[`,n=e.length-1,r=0;for(;r<n;r++)t+=fp(e[r],!1)+`,`;return n>-1&&(t+=fp(e[r],!1)),t+`]`}if(e instanceof Object){if(typeof e.toJSON==`function`)return fp(e.toJSON(),t);let n=Object.keys(e).sort(),r=n.length,i=``,a=0;for(;a<r;){let t=n[a],r=fp(e[t],!0);r!==void 0&&(a&&i!==``&&(i+=`,`),i+=JSON.stringify(t)+`:`+r),a++}return`{`+i+`}`}switch(n){case`function`:return JSON.stringify(e.toString());case`undefined`:return t?void 0:null;case`number`:return e;default:return isFinite(e)?e:null}}function pp(e){return fp(e,!1)}function mp(e){return`hash::${_t(pp(e))}`}var hp=/^(.*)\[(\d+)\]$/;function Z(e){if(!isNaN(e.panoIndex)&&isFinite(e.panoIndex))return`${e.workCode}[${e.panoIndex}]`;throw Error(`Invalid Pano`)}function gp(e){let t=e.match(hp);if(t){let[e,n,r]=t,i=Math.floor(Number(r));if(!isNaN(i)&&isFinite(i))return{workCode:n,panoIndex:i}}throw Error(`Invalid PanoId`)}function _p(e,t){return Z(e)===Z(t)}function vp(e){return typeof e==`string`&&hp.test(e)}var yp=`\\{([^\\}]+)\\}`;function bp(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function xp(e){return RegExp(`^`+e.map(e=>bp(e)).join(`(.+)`)+`$`)}var Sp=class{constructor(e){this.strings=[],this.keys=[];let t=new RegExp(yp,`g`),n,r=0;for(;(n=t.exec(e))!==null;)this.strings.push(e.slice(r,n.index)),this.keys.push(n[1]),r=n.index+n[0].length;this.strings.push(e.slice(r))}stringify(e){let t=[this.strings[0]];for(let n=0;n<this.keys.length;n++){let r=e[this.keys[n]];t.push(String(r),this.strings[n+1])}return t.join(``)}match(e){var t;this.matchRegexp=(t=this.matchRegexp)==null?xp(this.strings):t;let n=e.match(this.matchRegexp);if(!n)return null;let r={};for(let e=0;e<this.keys.length;e++){let t=this.keys[e],i=n[e+1];if(r[t]!==i){if(r[t]!==void 0)return null;r[t]=i}}return r}};function Cp(e){Object.freeze(e);let t=typeof e==`function`,n=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(e).forEach(function(r){n.call(e,r)&&(!t||r!==`caller`&&r!==`callee`&&r!==`arguments`)&&e[r]!==null&&(typeof e[r]==`object`||typeof e[r]==`function`)&&!Object.isFrozen(e[r])&&Cp(e[r])}),e}var wp=/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/i,Tp=Cp(JSON.parse(function(...e){return arguments[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}(`h/y|pnyu|/9/xr;p|z/9/yvn{wvn;p|z/9/rnyrr;p|z/9/rnyrr;p{/9/rnyrr;w}/9/uv;p|z/9/uv;p{/9/rnyrr;p{/9/rnyrr;p|z/9/ywpq{;p|z/9/rnyrr:pq{;p|z/9/rnyrr:pq{;p{/9/rnyrr;nv/9/;p{/9/pq{;p{/9/pnyp{|qr;vr/j`))),Ep=/^([^.]+)(\.([^.]+))*$/,Dp=typeof location<`u`?location.hostname:`localhost`;function Op(e){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(e)}function kp(e,t){if(!Ep.test(e)||!Ep.test(t))return!1;if(e===`*`)return!0;let n=e.split(`.`).reverse(),r=t.split(`.`).reverse();if(n.length<=1)return e===t;for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0}function Ap(e){if(/^blob\:/i.test(e)||/^data\:/i.test(e))return Dp;let t=e.match(wp);return t?t[2]:Dp}var jp=()=>Error(`Invalid input.`),Mp=()=>Error(`Invalid certificate.`),Np=()=>Error(`Invalid signature.`),Pp=e=>Error(`Date(${e.toString()}) expired.`),Fp=e=>Error(`Host(${JSON.stringify(e)}) is not allowed.`);function Ip(e,t){let n={};for(let r of Object.keys(e))t.indexOf(r)===-1&&(n[r]=e[r]);return n}function Lp(e,t=!1){let n=typeof e;if(n===`string`)return JSON.stringify(e);if(e===!0)return`true`;if(e===!1)return`false`;if(e===null)return`null`;if(e instanceof Array){let t=`[`,n=e.length-1,r=0;for(;r<n;r++)t+=Lp(e[r],!1)+`,`;return n>-1&&(t+=Lp(e[r],!1)),t+`]`}if(e instanceof Object){if(typeof e.toJSON==`function`)return Lp(e.toJSON(),t);let n=Object.keys(e).sort(),r=n.length,i=``,a=0;for(;a<r;){let t=n[a],r=Lp(e[t],!0);r!==void 0&&(a&&i!==``&&(i+=`,`),i+=JSON.stringify(t)+`:`+r),a++}return`{`+i+`}`}switch(n){case`function`:case`undefined`:return t?void 0:null;case`number`:return 0;default:return isFinite(e)?e:null}}function Rp(e){return String(Lp(e,!1))}function zp(e){var t,n,r;let i={};try{i=typeof e==`string`?JSON.parse(e):e}catch(e){return jp()}if(typeof i!=`object`)return jp();let a=Dp,o=Date.now(),s=new Date(typeof i.expire_at==`string`&&/^\d+$/.test(i.expire_at)?Number(i.expire_at):i.expire_at),c=Array.isArray(i.allow_hosts)?i.allow_hosts:[];if(a.length===0||Op(a)||Tp.filter(e=>kp(e,a)).length>0){let e=String((t=i.certificate)==null?``:t);if(e)try{let t=new z;return t.readCertPEM(e),Cp({issuer:t.getSubjectString(),expire:s,allowHosts:c})}catch(e){let t=e instanceof Error?e.message:String(e);console.warn(`[PARSE Error]: Invalid Certificate. `+t)}return Cp({issuer:`none`,expire:s,allowHosts:c})}let l=String((n=i.certificate)==null?``:n);if(!l)return Mp();let u=new z;u.readCertPEM(l);let d=String((r=i._signature)==null?``:r);return!d||Ct(Rp(Ip(i,[`_signature`])),d,u)===!1?Np():o<s.getTime()?Tp.concat(c).filter(e=>kp(e,a)).length===0?Fp(a):Cp({issuer:u.getSubjectString(),expire:s,allowHosts:c}):Pp(s)}function Bp(e,t){let n=Ap(e);return Dp.length!==0&&!Op(Dp)&&Tp.filter(e=>kp(e,Dp)).length===0&&!Op(n)&&Tp.concat(t).filter(e=>kp(e,n)).length===0?Fp(n):e}var Vp=new Set,Hp=new c.Vector3(1,1,1),Up=[`right`,`left`,`up`,`down`,`front`,`back`];function Wp(e,t){if(!Sr(e))return e;if(e.indexOf(t)===0)return e.slice(t.length);let n=t.replace(/^https\:/,`http:`);if(e.indexOf(n)===0)return e.slice(n.length);let r=t.replace(/^http\:/,`https:`);return e.indexOf(r)===0?e.slice(r.length):(console.warn(`${e} is not start with base_url(${t}).`),e)}function Gp(e,t,n){return!Sr(e)&&typeof t==`string`&&t.length>0&&(e=wr(t,String(n),e)),e}function Kp(e){for(let t=10;t>=0;t--)if(512*Math.pow(2,t)<=e)return t;return null}function qp(e){e=e.slice().sort((e,t)=>e.level-t.level);let t=[];for(let n of e){if(t.length===0){t.push(n);continue}let e=t[t.length-1];if(n.level>e.level){t.push(n);continue}if(n.size>e.size){t[t.length-1]=n;continue}}return t}function Jp(e,t){var n,r,i,a,o,s,l,u,d,f,p,m,h,g,_,v,y,b,x;let S=[],C=null;for(let t of[].concat(e))if(`getURL`in t)C={allowHosts:t.allowHosts,expire:t.expire,issuer:t.issuer},S.push(ip(t));else{let e=typeof t==`string`?JSON.parse(t):lp(t),n=zp(e);if(n instanceof Error)return n;C===null&&(C=n),S.push(e)}if(C===null)return Error(`Empty`);V(t,`issuer`,{enumerable:!0,configurable:!1,writable:!1,value:C.issuer}),V(t,`expire`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(C.expire)}),V(t,`allowHosts`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(C.allowHosts)});let w=S.reduce((e,t)=>dp(e,t));V(t,`name`,{enumerable:!0,configurable:!1,writable:!1,value:String((n=w.name)==null?`Unknown`:n)}),V(t,`workCode`,{enumerable:!0,writable:!0,value:String(w.resource_code||w.basic_code||w.vr_code||w.code||w.project_id||w.work_code||w.workCode||rn())}),V(t,`projectId`,{enumerable:!0,writable:!0,value:w.project_id}),V(t,`baseURL`,{enumerable:!0,writable:!0,value:(()=>{var e;let t=(e=w.base_url)==null?``:e;return t&&t[t.length-1]!==`/`&&(t+=`/`),t})()});let T;typeof w.model==`object`&&(T={},V(T,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),V(T,`file`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e=w.model.file_url;if(e)return Wp(e,t.baseURL)})()}),V(T,`textureBase`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e=w.model.material_base_url;return e&&(e=Wp(e,t.baseURL)),e})()}),V(T,`textures`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e;return Array.isArray(w.model.material_textures)&&(e=w.model.material_textures.slice(),Object.freeze(e)),e})()}),V(T,`upAxis`,{enumerable:!0,configurable:!1,writable:!1,value:w.model.up_axis}),V(T,`coordinate`,{enumerable:!0,configurable:!1,writable:!1,value:lp(w.model.coordinate)}),V(T,`layers`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{var e,n,r;let i=[];if(Array.isArray(w.model.layers)){for(let a of w.model.layers)if(a&&a.tileset_url){let o={};V(o,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),V(o,`name`,{enumerable:!0,configurable:!1,writable:!1,value:(e=a.name)==null?``:e}),V(o,`type`,{enumerable:!0,configurable:!1,writable:!1,value:(n=a.type)==null?`mesh`:n}),V(o,`upAxis`,{enumerable:!0,configurable:!1,writable:!1,value:(r=a.up_axis)==null?`Z`:r}),V(o,`tileset`,{enumerable:!0,configurable:!1,writable:!1,value:Wp(a.tileset_url,t.baseURL)}),i.push(o)}}if(typeof w.model.tiles==`object`){let e=w.model.tiles;if(e&&e.tileset_url){let n={};V(n,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),V(n,`name`,{enumerable:!0,configurable:!1,writable:!1,value:`lod`}),V(n,`type`,{enumerable:!0,configurable:!1,writable:!1,value:`mesh`}),V(n,`upAxis`,{enumerable:!0,configurable:!1,writable:!1,value:`-Y`}),V(n,`tileset`,{enumerable:!0,configurable:!1,writable:!1,value:Wp(e.tileset_url,t.baseURL)}),i.push(n)}}return Object.freeze(i)})()})),V(t,`model`,{enumerable:!0,configurable:!1,writable:!1,value:T});let E=[];if(Array.isArray(w.observers)&&w.panorama&&Array.isArray(w.panorama.list||w.panorama.info)){let e=w.observers,n=(r=w.panorama.list||w.panorama.info)==null?[]:r,S=(u=(s=(a=(i=w.panorama)==null?void 0:i.pano_high_cube_base_url)==null?(o=w.panorama)==null?void 0:o.pano_cube_base_url:a)==null?(l=w.panorama)==null?void 0:l.base_url:s)==null?``:u,C=Math.min(e.length,n.length),T={};for(let e of Object.keys((d=w.panorama.pattern)==null?{}:d)){let t=e,n=w.panorama.pattern[t];if(typeof n==`string`){let e=new Sp(n);T[t]=t=>e.stringify(t)}else T[t]=()=>n}let D=(e,t)=>{var n;let r=T[t];return(n=e[t])==null?r?r(e):void 0:n};for(let r=0;r<C;r++){let i=e[r],a=n[r],o=Object.create(sp);V(o,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),V(o,`index`,{enumerable:!0,configurable:!1,writable:!1,value:r}),V(o,`panoIndex`,{enumerable:!0,configurable:!1,writable:!1,value:r}),V(o,`panoId`,{enumerable:!0,configurable:!1,writable:!1,value:Z({workCode:t.workCode,panoIndex:r})}),V(o,`floorIndex`,{enumerable:!0,configurable:!1,writable:!1,value:(f=i.floor_index)==null?i.floor:f}),V(o,`derivedId`,{enumerable:!0,configurable:!1,writable:!1,value:(m=(p=i.derived_id)==null?D(a,`derived_id`):p)==null?0:m}),V(o,`derivedIdStr`,{enumerable:!0,configurable:!1,writable:!1,value:(g=(h=i.derived_id_str)==null?D(a,`derived_id_str`):h)==null?String(o.derivedId):g}),V(o,`active`,{enumerable:!0,configurable:!1,writable:!1,value:i.active!==!1&&D(a,`active`)!==!1}),V(o,`loadable`,{enumerable:!0,configurable:!1,writable:!1,value:(v=(_=i.loadable)==null?D(a,`loadable`):_)==null?!1:v}),V(o,`position`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new c.Vector3().fromArray((y=i.position)==null?[0,0,0]:y))}),V(o,`standingPosition`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new c.Vector3().fromArray((x=(b=i.standing_position)==null?i.standingPosition:b)==null?[0,0,0]:x))}),V(o,`quaternion`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new c.Quaternion().fromArray(i.quaternion?[i.quaternion.x,i.quaternion.y,i.quaternion.z,i.quaternion.w]:[0,0,0,1]))}),V(o,`matrix`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new c.Matrix4().compose(o.position,o.quaternion,Hp))}),V(o,`accessibleNodes`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{if(Vp.clear(),i.accessible_nodes&&Array.isArray(i.accessible_nodes))for(let e of i.accessible_nodes)e>=C||e===r||Vp.add(e);else if(i.accessibleNodes&&Array.isArray(i.accessibleNodes))for(let e of i.accessibleNodes)e>=C||e===r||Vp.add(e);else if(i.visible_nodes&&Array.isArray(i.visible_nodes))for(let e of i.visible_nodes)e>=C||e===r||Vp.add(e);else if(i.visibleNodes&&Array.isArray(i.visibleNodes))for(let e of i.visibleNodes)e>=C||e===r||Vp.add(e);if(Vp.size===0)for(let e=0;e<C;e++)e!==r&&Vp.add(e);let e=Array.from(Vp);return Vp.clear(),Object.freeze(e)})()}),V(o,`visibleNodes`,{enumerable:!0,configurable:!1,writable:!1,value:o.accessibleNodes}),V(o,`images`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e={};V(e,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t});for(let n of Up)V(e,n,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{var e;return Wp(Gp((e=D(a,n))==null?``:e,S,r),t.baseURL)})()});return V(e,`sizeList`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let t=$r(e[Up[0]]),n=D(a,`size_list`),r=D(a,`tiles`);if(t){if(n){let e=n.slice().sort((e,t)=>e-t);return Object.freeze(e)}else if(r){let e=[t],n=r.slice().sort((e,t)=>e-t);for(let r of n){let n=512*Math.pow(2,r);n>t&&e.push(n)}return Object.freeze(e)}return Object.freeze([t])}return Object.freeze([])})()}),V(e,`tiles`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let n=$r(e.front);if(!n)return;let r=e.sizeList.slice();if(r[0]){let e=Kp(r[0]);if(e)for(let t=e-1;t>=0;t--)r.unshift(512*Math.pow(2,t))}if(r.length<=0)return;let i=[];for(let a of r){let r=Kp(a);if(typeof r!=`number`)continue;let o={};if(V(o,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),V(o,`level`,{enumerable:!0,configurable:!1,writable:!1,value:r}),a>n){V(o,`size`,{enumerable:!0,configurable:!1,writable:!1,value:a}),V(o,`scale`,{enumerable:!0,configurable:!1,writable:!1,value:1});for(let t of Up)V(o,t,{enumerable:!0,configurable:!1,writable:!1,value:ei(e[t],a)})}else{V(o,`size`,{enumerable:!0,configurable:!1,writable:!1,value:n}),V(o,`scale`,{enumerable:!0,configurable:!1,writable:!1,value:a/n});for(let t of Up)V(o,t,{enumerable:!0,configurable:!1,writable:!1,value:e[t]})}i.push(o)}return i=qp(i),Object.freeze(i)})()}),V(e,`video`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e=D(a,`video`),n;return e&&(n={},V(n,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),V(n,`source`,{enumerable:!0,configurable:!1,writable:!1,value:e.source}),V(n,`matrix`,{enumerable:!0,configurable:!1,writable:!1,value:new c.Matrix4().fromArray(e.matrix)}),V(n,`size`,{enumerable:!0,configurable:!1,writable:!1,value:new c.Vector2().fromArray(e.size)})),n})()}),e})()}),E.push(o)}}V(t,`observers`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(E)});let D={};if(V(D,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),w.initial){if(t.observers.length>0){let e;cp(w.initial.panoIndex)?e=w.initial.panoIndex:cp(w.initial.pano_index)?e=w.initial.pano_index:cp(w.initial.pano)&&(e=w.initial.pano),typeof e==`number`&&(e=U(e,0,t.observers.length-1),V(D,`panoIndex`,{enumerable:!0,writable:!0,value:e}))}if(w.initial.mode===`Panorama`&&t.observers.length===0||w.initial.mode===`Floorplan`||w.initial.mode===`Topview`||w.initial.mode===`Model`||w.initial.mode===`Mapview`?V(D,`mode`,{enumerable:!0,writable:!0,value:w.initial.mode}):typeof D.panoIndex==`number`?V(D,`mode`,{enumerable:!0,writable:!0,value:`Panorama`}):V(D,`mode`,{enumerable:!0,writable:!0,value:`Mapview`}),cp(w.initial.latitude)&&V(D,`latitude`,{enumerable:!0,writable:!0,value:w.initial.latitude}),cp(w.initial.longitude)?V(D,`longitude`,{enumerable:!0,writable:!0,value:w.initial.longitude}):cp(w.initial.heading)&&V(D,`longitude`,{enumerable:!0,writable:!0,value:Gt(w.initial.heading)}),cp(w.initial.fov)&&V(D,`fov`,{enumerable:!0,writable:!0,value:w.initial.fov}),cp(w.initial.distance)&&V(D,`distance`,{enumerable:!0,writable:!0,value:w.initial.distance}),Array.isArray(w.initial.offset)){let e=w.initial.offset,t=[0,0,0].map((t,n)=>{let r=Number(e[n]);return isNaN(r)||!isFinite(r)?0:r});V(D,`offset`,{enumerable:!0,writable:!0,value:new c.Vector3().fromArray(t)})}else typeof w.initial.offset==`object`&&typeof w.initial.offset.x==`number`&&typeof w.initial.offset.y==`number`&&typeof w.initial.offset.z==`number`&&V(D,`offset`,{enumerable:!0,writable:!0,value:new c.Vector3().fromArray([w.initial.offset.x,w.initial.offset.y,w.initial.offset.z])})}return V(t,`initial`,{enumerable:!0,configurable:!1,writable:!1,value:D}),t}function Yp(e,t){return V(t,`issuer`,{enumerable:!0,configurable:!1,writable:!1,value:`null`}),V(t,`expire`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new Date)}),V(t,`allowHosts`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([`*`])}),V(t,`name`,{enumerable:!0,configurable:!1,writable:!1,value:`Null`}),V(t,`workCode`,{enumerable:!0,value:`null-`+rn()}),V(t,`baseURL`,{enumerable:!0,value:`/`}),V(t,`model`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),V(t,`observers`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([])}),V(t,`initial`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e={};return V(e,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),V(e,`mode`,{enumerable:!0,writable:!0,value:`Mapview`}),e})()}),t}function Xp(e,t){var n,r;return V(t,`issuer`,{enumerable:!0,configurable:!1,writable:!1,value:`null`}),V(t,`expire`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new Date)}),V(t,`allowHosts`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([`*`])}),V(t,`name`,{enumerable:!0,configurable:!1,writable:!1,value:String((n=e.name)==null?`Unknown`:n)}),V(t,`workCode`,{enumerable:!0,writable:!0,value:(r=e.code)==null?rn():r}),V(t,`baseURL`,{enumerable:!0,writable:!0,value:`/`}),V(t,`model`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),V(t,`observers`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let n={};return V(n,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),V(n,`index`,{enumerable:!0,configurable:!1,writable:!1,value:0}),V(n,`panoIndex`,{enumerable:!0,configurable:!1,writable:!1,value:0}),V(n,`panoId`,{enumerable:!0,configurable:!1,writable:!1,value:Z({workCode:t.workCode,panoIndex:0})}),V(n,`floorIndex`,{enumerable:!0,configurable:!1,writable:!1,value:0}),V(n,`derivedId`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),V(n,`derivedIdStr`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),V(n,`active`,{enumerable:!0,configurable:!1,writable:!1,value:!0}),V(n,`loadable`,{enumerable:!0,configurable:!1,writable:!1,value:!1}),V(n,`position`,{enumerable:!0,configurable:!1,writable:!1,value:new c.Vector3(0,1.5,0)}),V(n,`standingPosition`,{enumerable:!0,configurable:!1,writable:!1,value:new c.Vector3(0,0,0)}),V(n,`quaternion`,{enumerable:!0,configurable:!1,writable:!1,value:new c.Quaternion(0,1,0,0)}),V(n,`matrix`,{enumerable:!0,configurable:!1,writable:!1,value:new c.Matrix4().compose(n.position,n.quaternion,Hp)}),V(n,`accessibleNodes`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([])}),V(n,`visibleNodes`,{enumerable:!0,configurable:!1,writable:!1,value:n.accessibleNodes}),V(n,`images`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let n={};V(n,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t});for(let t of Up)V(n,t,{enumerable:!0,configurable:!1,writable:!1,value:e[t]});return V(n,`sizeList`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([e.size])}),V(n,`tiles`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e=$r(n.front);if(!e)return;let r=n.sizeList.slice();if(r[0]){let e=Kp(r[0]);if(e)for(let t=e-1;t>=0;t--)r.unshift(512*Math.pow(2,t))}if(r.length<=0)return;let i=[];for(let a of r){let r=Kp(a);if(typeof r!=`number`)continue;let o={};if(V(o,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),V(o,`level`,{enumerable:!0,configurable:!1,writable:!1,value:r}),a>e){V(o,`size`,{enumerable:!0,configurable:!1,writable:!1,value:a}),V(o,`scale`,{enumerable:!0,configurable:!1,writable:!1,value:1});for(let e of Up)V(o,e,{enumerable:!0,configurable:!1,writable:!1,value:ei(n[e],a)})}else{V(o,`size`,{enumerable:!0,configurable:!1,writable:!1,value:e}),V(o,`scale`,{enumerable:!0,configurable:!1,writable:!1,value:a/e});for(let e of Up)V(o,e,{enumerable:!0,configurable:!1,writable:!1,value:n[e]})}i.push(o)}return i=qp(i),Object.freeze(i)})()}),V(n,`video`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),n})()}),Object.freeze([n])})()}),V(t,`initial`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e={};return V(e,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),V(e,`mode`,{enumerable:!0,writable:!0,value:`Panorama`}),V(e,`panoIndex`,{enumerable:!0,writable:!0,value:0}),e})()}),t}var Zp=new WeakSet,Qp=class{constructor(e,t){this.observerBox=new c.Box3,this.observerBox=new c.Box3,this.transform=new c.Matrix4,this.shortPath=!1,this.jsonp=!1;let n;if(n=e===null?Yp(e,this):typeof e==`object`&&typeof e.size==`number`&&typeof e.up==`string`&&typeof e.down==`string`&&typeof e.right==`string`&&typeof e.left==`string`&&typeof e.front==`string`&&typeof e.back==`string`?Xp(e,this):Jp(e,this),n instanceof Error)throw Error(`[PARSE FAILED]: `+n.message+`
938
+ `,uniforms:{diffuse:{value:new c.Color},opacity:{value:1},displacementScalar:{value:0}}};function Jd(e,t,n,r){let i=new Float32Array((n+1)*(r+1)*3),a=new Float32Array((n+1)*(r+1)*3),o=new Float32Array((n+1)*(r+1)*2),s=new Uint32Array(n*r*6),l=e.computeFrenetFrames(n),u=new c.Vector3,d=new c.Vector3,f=new c.Vector2,p=new c.Vector3;for(let s=0;s<=n;s++){p=e.getPointAt(s/n,p);let c=l.normals[s],m=l.binormals[s];for(let e=0;e<=r;e++){let l=s*(r+1)+e,h=e/r*Math.PI*2,g=Math.sin(h),_=-Math.cos(h);d.x=_*c.x+g*m.x,d.y=_*c.y+g*m.y,d.z=_*c.z+g*m.z,d.normalize(),d.toArray(a,l*3),u.x=p.x+t*d.x,u.y=p.y+t*d.y,u.z=p.z+t*d.z,u.toArray(i,l*3),f.x=s/n,f.y=e/r,f.toArray(o,l*2)}}for(let e=0;e<n;e++)for(let t=0;t<r;t++){let n=(e*r+t)*6,i=(r+1)*e+t,a=(r+1)*(e+1)+t,o=(r+1)*(e+1)+(t+1),c=(r+1)*e+(t+1);s[n]=i,s[n+1]=a,s[n+2]=c,s[n+3]=a,s[n+4]=o,s[n+5]=c}let m=new c.BufferGeometry;return m.setIndex(new c.BufferAttribute(s,1)),m.setAttribute(`position`,new c.BufferAttribute(i,3)),m.setAttribute(`normal`,new c.BufferAttribute(a,3)),m.setAttribute(`uv`,new c.BufferAttribute(o,2)),m}function Yd(e,t){let n=new c.Color(0).convertSRGBToLinear(),r=new c.Color(52949).convertSRGBToLinear(),i=new c.Color(3370495).convertSRGBToLinear(),a=new c.Color(16777215).convertSRGBToLinear(),o=0,s=new c.CurvePath,l=e.length;for(let t=3;t<l;t+=3){let n=new c.Vector3().fromArray(e,t-3),r=new c.Vector3().fromArray(e,t);o+=n.distanceTo(r);let i=new c.LineCurve3(n,r);s.add(i)}let u=Jd(s,.03,Math.ceil(o*100),6);u.clearGroups(),u.addGroup(0,u.index?u.index.count:u.attributes.position.count,0),u.addGroup(0,u.index?u.index.count:u.attributes.position.count,1),u.addGroup(0,u.index?u.index.count:u.attributes.position.count,2);let d=new c.ShaderMaterial({vertexShader:Kd.vertexShader,fragmentShader:Kd.fragmentShader,uniforms:c.UniformsUtils.clone(Kd.uniforms),side:c.BackSide});d.uniforms.totalLength.value=o,d.uniforms.diffuse.value=n,d.uniforms.diffuse2.value=n,d.uniforms.opacity.value=.5,d.transparent=!0;let f=new c.ShaderMaterial({vertexShader:Kd.vertexShader,fragmentShader:Kd.fragmentShader,uniforms:c.UniformsUtils.clone(Kd.uniforms),side:c.BackSide});f.uniforms.totalLength.value=o,f.uniforms.displacementScalar.value=-.01,f.uniforms.diffuse.value=r,f.uniforms.diffuse2.value=i;let p=new c.ShaderMaterial({vertexShader:Kd.vertexShader,fragmentShader:Kd.fragmentShader,uniforms:c.UniformsUtils.clone(Kd.uniforms),side:c.DoubleSide});p.uniforms.totalLength.value=o,p.uniforms.displacementScalar.value=-.026,p.uniforms.dashSize.value=new c.Vector2(.06,.09),p.uniforms.diffuse.value=a,p.uniforms.diffuse2.value=a;let m=new c.Mesh(u,[d,f,p]),h=new c.SphereBufferGeometry(.08,24,24);h.clearGroups(),h.addGroup(0,u.index?u.index.count:u.attributes.position.count,0),h.addGroup(0,u.index?u.index.count:u.attributes.position.count,1);let g=new c.ShaderMaterial({vertexShader:qd.vertexShader,fragmentShader:qd.fragmentShader,uniforms:c.UniformsUtils.clone(qd.uniforms),side:c.BackSide});g.uniforms.diffuse.value=n,g.uniforms.opacity.value=.5,g.transparent=!0;let _=new c.ShaderMaterial({vertexShader:qd.vertexShader,fragmentShader:qd.fragmentShader,uniforms:c.UniformsUtils.clone(qd.uniforms),side:c.FrontSide});_.uniforms.displacementScalar.value=-.01,_.uniforms.diffuse.value=r;let v=new c.Mesh(h,[g,_]);v.position.fromArray(e,0),m.add(v);let y=new c.ShaderMaterial({vertexShader:qd.vertexShader,fragmentShader:qd.fragmentShader,uniforms:c.UniformsUtils.clone(qd.uniforms),side:c.FrontSide});y.uniforms.displacementScalar.value=-.01,y.uniforms.diffuse.value=i;let b=new c.Mesh(h,[g,y]);return b.position.fromArray(e,e.length-3),m.add(b),{scene:m,dispose:()=>{u.dispose(),d.dispose(),f.dispose(),p.dispose(),h.dispose(),g.dispose(),_.dispose(),y.dispose()}}}function Xd(e,t){let n=e.name,r=Xr(Tr(e.content.uri,t.search),{key:`model.0`});return e.content.loadState=`LOADING`,e.content.loadStateUpdateTime=H(),Cs(r,{type:`geometry`,customPropertyMapping:{time:{itemType:`uint32`,itemNames:[`time_milisec`]}},fetcher:t.fetcher}).then(t=>{var i,a,o,s;let c=(a=(i=t.scene.attributes)==null?void 0:i.time.array)==null?[]:a,l=(s=(o=t.scene.attributes)==null?void 0:o.position.array)==null?[]:s,u=t.byteLength,d=t.memoryUsage,f=Yd(l,c);f.scene.applyMatrix4(e.transform),f.scene.updateWorldMatrix(!1,!0),f.scene.matrixAutoUpdate=!1;let p=new od(n,f.scene);return e.content.data={uri:r,byteLength:u,memoryUsage:d,positionArray:l,timeArray:c,object:p},e.content.byteLength=u,e.content.memoryUsage=d,e.content.loadState=`READY`,e.content.loadStateUpdateTime=H(),e}).catch(t=>(e.content.data=void 0,e.content.loadState=`FAILED`,e.content.loadStateUpdateTime=H(),t instanceof or&&t.httpStatus===0||t instanceof sr||t instanceof ar?e.content.loadfailRetryDelay=U(e.content.loadfailRetryDelay+Gd,Gd,Wd):e.content.loadfailRetryDelay=1/0,Promise.reject(t)))}function Zd(e){e.content&&(e.content.data&&e.content.data.object.dispose(),e.content.data=void 0,e.content.loadState=`UNLOADED`,e.content.loadProgress=0,e.content.loadStateUpdateTime=H(),e.content.byteLength=0,e.content.memoryUsage=0)}var Qd=new c.Vector3,$d=new c.Matrix3,ef=new c.Matrix4,tf=6378137,nf=298.257223563;function rf(e){let t=tf-tf/nf,n=(tf*tf-t*t)/(tf*tf),r=Math.sqrt(e.x*e.x+e.y*e.y),i=0,a=Math.atan2(e.z,r),o=0;for(;i++<1e3;){let t=Math.sin(a),i=tf/Math.sqrt(1-n*t*t);o=r/Math.cos(a)-i;let s=Math.atan2(e.z/(i*(1-n)+o),r/(i+o));if(isNaN(s)||Math.abs(s-a)<1e-12)break;a=s}return e.set(a,Math.atan2(e.y,e.x),o)}function af(e){let{x:t,y:n,z:r}=e,i=tf-tf/nf,a=(tf*tf-i*i)/(tf*tf),o=Math.sin(t),s=Math.cos(t),c=Math.sin(n),l=Math.cos(n),u=tf/Math.sqrt(1-a*o*o),d=(u+r)*s*l,f=(u+r)*s*c,p=(i*i/(tf*tf)*u+r)*o;return e.set(d,f,p)}function of(e,t){let{x:n,y:r,z:i}=rf(Qd.copy(e)),a=Math.sin(n),o=Math.sin(r),s=Math.cos(n),c=Math.cos(r);t.fromArray([-o,-a*c,s*c,0,+c,-a*o,s*o,0,0,s,a,0,0,0,0,1]);let l=$d.setFromMatrix4(t),u=Qd.copy(e).applyMatrix3(l).multiplyScalar(-1);t.setPosition(u);let d=ef.fromArray([1,0,0,0,0,1,0,0,0,0,1,0,0,0,i,1]);return t.premultiply(d),t}var sf=new c.Matrix4().fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),cf=new c.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),lf=new c.Matrix4().copy(sf),uf=new c.Matrix4().copy(cf);function df(e,t={}){var n,r,i;let a,o,s;if(typeof e.tileset.rootMeta.creationTime==`string`)if(typeof e.tileset.rootMeta.numTotalPoints==`number`&&e.tileset.rootMeta.numTotalPoints>0){s=4,t.powerPreference===`high`&&(s=2),a=s/1.6;let c=0;if(((n=e.tileset.rootMeta.taskParameters)==null?void 0:n.point_homogenization)===`1`&&(r=e.tileset.rootMeta.taskParameters)!=null&&r.homo_point_density){let t=Number((i=e.tileset.rootMeta.taskParameters)==null?void 0:i.homo_point_density);isFinite(t)&&!isNaN(t)&&(c=t)}c<=0&&(c=.02),o=c*1.4}else s=5,t.powerPreference===`high`&&(s=4),a=0,o=.03;else s=6,a=0,o=.03,e.name===`aerophoto`?(s=12,t.powerPreference===`high`&&(s=10)):e.tileset.asset.extras&&typeof e.tileset.asset.extras.name==`string`&&/^matterport\b/i.test(e.tileset.asset.extras.name)&&(s=5,t.powerPreference===`high`&&(s=4));return{pointScale:o,pointMinPixel:a,maxScreenSpaceError:s}}var ff=new c.Vector3,pf=new Ol,mf=new Dl,hf=new WeakMap,gf=new WeakMap,_f=new WeakMap,vf={TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15},yf=(()=>{let e=new c.MeshBasicMaterial;return e.side=c.BackSide,e.color.setHex(16711935),e.colorWrite=!1,e.stencilWrite=!0,e.polygonOffset=!0,e.polygonOffsetFactor=2,e.polygonOffsetUnits=2,e.stencilRef=vf.TILE_MASK,e.stencilFunc=c.AlwaysStencilFunc,e.stencilFuncMask=vf.TILE_MASK,e.stencilZPass=c.ReplaceStencilOp,e.stencilWriteMask=vf.TILE_MASK,e})(),bf=(()=>{let e=new c.MeshBasicMaterial;return e.visible=!1,e})(),xf=new c.BufferGeometry,Sf=new c.MeshBasicMaterial;function Cf(e){let t;t=e instanceof c.Mesh?new c.Mesh(e.geometry,Array.isArray(e.material)?e.material.map(e=>e.transparent?bf:yf):e.material&&e.material.transparent?bf:yf):e instanceof c.Group?new c.Group:new c.Object3D,t.position.copy(e.position),t.quaternion.copy(e.quaternion),t.scale.copy(e.scale),t.matrix.compose(e.position,e.quaternion,e.scale),t.matrixAutoUpdate=!1,t.frustumCulled=e.frustumCulled,t.visible=e.visible;for(let n of e.children)t.add(Cf(n));return t}var wf=class extends c.Object3D{constructor(e,t){var n,r;super(),this.parameter=new G,this.renderObjects=[],this.backfaceObjects=[],this.tileObjects=[],this.frameNumber=0,this.error=(n=t.error)==null?null:n,this.name=t.name,this.type=t.type,this.upAxis=t.upAxis,this.light=t.light,this.fetcher=t.fetcher,this.search=(r=t.search)==null?``:r,this.groundHeight=t.groundHeight,this.coordinateSystem=t.coordinateSystem,this.boundingBox=new c.Box3,this.autoRefine=!0,this.refined=!1,this.refineProgress=[0,0],this.loaded=!1,this.disposed=!1,this.clearStencilObject=new c.Mesh(xf,Sf),this.clearStencilObject.frustumCulled=!1,this.clearStencilObject.onAfterRender=e=>e.clearStencil(),this.tileset=new vd(e,{tileLoader:e=>this.loadContent(e),tileUnloader:e=>this.unloadContent(e),onTileLoad:e=>{this.onTileLoad&&this.onTileLoad(e)},onTileUnload:e=>{this.onTileUnload&&this.onTileUnload(e)},onTileError:(e,t)=>{this.onError&&this.onError(Object.assign(t,{tile:e})),console.error(`Tile error`,e.id,t)},trajectoryLoader:e=>this.loadTrajectory(e),trajectoryUnloader:e=>this.unloadTrajectory(e),onTrajectoryLoad:()=>{},onTrajectoryUnload:e=>{},onTrajectoryError:(e,t)=>{this.onError&&this.onError(Object.assign(t,{error:t})),console.error(`Trajectory error`,e,t)}}),this.tileset.root.boundingVolume&&this.tileset.root.boundingVolume.getBoundingBox(this.boundingBox),this.currentResolvedParameterValue=G.resolveValueTo({},this.parameter)}get viewerRequestVolume(){return this.tileset.root.viewerRequestVolume}set viewerRequestVolume(e){this.tileset.root.viewerRequestVolume=e}get tiles(){return this.tileset.selectedTiles}get trajectories(){return this.tileset.trajectories}getRecommendProps(e={}){return df(this,e)}loadContent(e){return Hd(e,{light:this.light,fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(t=>{if(e.type===`SCENEGRAPH`){if(this.disposed||!e.content)Ud(e);else if(e.content.data)if(e.content.data.type===`spz`){let t=e.content.data.object.children[0].boundingBox;this.boundingBox.union(t)}else this.boundingBox.expandByObject(e.content.data.object)}})}unloadContent(e){return Ud(e),Promise.resolve()}loadAllTilesets(){let e=t=>{let n=[];return this.tileset.root.traverse(e=>{var t;e.type===`TILESET`&&((t=e.content)==null?void 0:t.loadState)!==`READY`&&n.push(e)}),Promise.all(n.map(t=>this.loadContent(t).then(()=>e(t)))).then(()=>{})};return e(this.tileset.root)}loadTrajectory(e){return Xd(e,{fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(e=>{this.disposed&&Zd(e)})}unloadTrajectory(e){return Zd(e),Promise.resolve()}intersectRaycaster(e,t){var n,r;let i=t==null?[]:t,a=[this.tileset.root],o=this.tileset.transform,s=(r=(n=e.params.Points)==null?void 0:n.threshold)==null?0:r,c=e.sortByDistance;e.sortByDistance=!1;let l,u=1/0;for(;l=a.pop();){let t;if(l.boundingVolume){let n;n=l.boundingVolume instanceof Dl?mf.copy(l.boundingVolume):l.boundingVolume instanceof Ol?pf.copy(l.boundingVolume):l.boundingVolume.clone(),n.applyMatrix4(o),t=n.intersectRay(e.ray,s,u)}else t=!0;if(t){for(let e=0,t=l.children.length;e<t;e++)a.push(l.children[e]);if(l.selected&&l.content&&l.content.data&&l.content.data.object.visible){let t=e.hitFilter;if(e.hitFilter=n=>{var r;return Object.assign(n,{model:(r=this.parent)==null?void 0:r,viewLayer:this,tile:l}),t?t.call(e,n):!0},l.content.data.object.intersectRaycaster(e,i),e.hitFilter=t,e.firstHitOnly){let e=i[0];e&&u>e.distance&&(u=e.distance)}}}}return e.sortByDistance=c,Jl(i,e.sortByDistance,e.firstHitOnly),i}update(e,t,n,r){var i,a,o,s,l,u,d;this.renderer=e,this.frameNumber++;let f=!1,p=G.resolveValueTo(this.currentResolvedParameterValue,n.parameter,r.parameter,this.parameter);hf.get(this)!==p.versionNumber&&(hf.set(this,p.versionNumber),f=!0);let m=(s=this.visible&&((i=this.parent)==null?void 0:i.visible)&&((o=(a=this.parent)==null?void 0:a.parent)==null?void 0:o.visible))==null?!1:s,h=p.maxLevelOfDetail;h=Math.max(h,0);let g=Math.min(p.minLevelOfDetail,h);(!m||!this.loaded||!n.loaded)&&(h=Math.max(g,0));let _=p.maxMemoryUsage;m||(_=Math.min(0,_));let v=p.minGeometricError,y=p.maxRequests,b=p.memoryAdjustedScreenSpaceError;m||(b=!1);let x=t.controllerMode;(x===`Panorama`||x===`VRPanorama`||x===`XRPanorama`)&&(p.modelAlpha<.1&&(v=p.panoramaMinGeometricError,b=!1),p.progress>=.01&&p.progress<=.99&&(y=0));let S=p.maxGeometricError;S=Math.max(v,S);let C={time:t.time,camera:{type:t.type,position:new c.Vector3().copy(t.position),direction:t.getDirection(new c.Vector3),up:new c.Vector3().copy(t.up).applyQuaternion(t.quaternion),projectionMatrix:t.projectionMatrix.clone(),visible:m&&t.visible,refine:t.refineModel},height:t.resolution.height,pixelRatio:t.pixelRatio,frameNumber:this.frameNumber,sseDenominator:2*Math.tan(.5*t.fov/180*Math.PI),cullingVolume:new El().setFromCamera(t),minLevelOfDetail:g,maxLevelOfDetail:h,minGeometricError:v,maxGeometricError:S,skipLevelOfDetail:p.skipLevelOfDetail,mostDetail:p.mostDetail,loadSiblings:p.loadSiblings,cameraCulling:p.cameraCulling,maxMemoryUsage:_,maxRequests:y,requestOrder:p.requestOrder,maxScreenSpaceError:p.maxScreenSpaceError,memoryAdjustedScreenSpaceError:b},w=p.cacheCameras.map(e=>(e.updateProjectionMatrix(),Object.assign(Object.assign({},C),{camera:{type:t.type,position:new c.Vector3().copy(e.position),direction:e.getWorldDirection(new c.Vector3),up:new c.Vector3().copy(e.up),projectionMatrix:e.projectionMatrix.clone(),visible:e.visible,refine:!0},cullingVolume:new El().setFromCamera(e)})));this.updateWorldMatrix(!0,!1),this.tileset.transform.equals(this.matrixWorld)||(this.tileset.transform.copy(this.matrixWorld),f=!0);let T=!this.autoRefine;if(T===!1&&p.progress>=.01&&p.progress<=.99){let e=new c.Vector3;p.pano0&&e.setFromMatrixPosition(p.pano0.matrix);let t=e.clone();p.pano1&&t.setFromMatrixPosition(p.pano1.matrix),e.distanceTo(t)<10&&(T=!0)}if(T||this.tileset.update(C,w),this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.tileset.needsRefinedTiles.forEach(e=>{if(this.refineProgress[1]++,e.content){let t=e.content.loadState;if(t===`UNLOADED`||t===`LOADING`){this.refined=!1;return}}this.refineProgress[0]++}),this.loaded===!1&&this.autoRefine){this.loaded=!0;let e=!1;this.tileset.needsRefinedTiles.forEach(t=>{if(this.loaded!==!1&&t.content&&(t.state.visible&&(e=!0),p.minLevelOfDetail>=0)){if(C.skipLevelOfDetail){if(t.state.finalResolution){let e=t.state.ancestorWithContentAvailable,n=(e&&e.content?e.content:t.content).loadState;(n===`UNLOADED`||n===`LOADING`)&&(this.loaded=!1)}}else if(t.state.visible&&t.levelOfContent<=0){let e=t.content.loadState;(e===`UNLOADED`||e===`LOADING`)&&(this.loaded=!1)}}}),e&&this.tileset.selectedTiles.length===0&&this.tileset.frameNumber<500&&(this.loaded=!1),this.loaded===!0&&(this.refined=!1,this.refineProgress[1]++)}this.renderObjects.length=0,this.backfaceObjects.length=0,this.tileObjects.length=0;for(let e=this.children.length-1;e>=0;e--)this.remove(this.children[e]);C.skipLevelOfDetail||this.tileset.selectedTiles.sort((e,t)=>e.floor===t.floor?e.levelOfContent===t.levelOfContent?e.state.distanceToCamera===t.state.distanceToCamera?e.state.centerZDepth-t.state.centerZDepth:e.state.distanceToCamera-t.state.distanceToCamera:t.levelOfContent-e.levelOfContent:e.floor-t.floor);let E=[];for(let r of this.tileset.selectedTiles){let i=(u=(l=r.content)==null?void 0:l.data)==null?void 0:u.object;if(!i)continue;let a=i.update(e,t,n,this,r,p);if(E.push(r.id),a&&(f=!0),this.tileset.hasMixedContent&&C.skipLevelOfDetail){if(!r.state.finalResolution){let e=Cf(i);e.name=`skipBackface:`+i.name,this.backfaceObjects.push(e)}let e=r.state.selectionDepth,t=vf.TILE_MASK|e<<vf.SKIP_LOD_BIT_SHIFT,n=c.GreaterEqualStencilFunc,a=vf.SKIP_LOD_MASK,o=c.ReplaceStencilOp,s=vf.TILE_MASK|vf.SKIP_LOD_MASK;for(let e of i.materials)e.stencilWrite=!0,e.stencilRef=t,e.stencilFunc=n,e.stencilFuncMask=a,e.stencilZPass=o,e.stencilWriteMask=s}else for(let e of i.materials)e.stencilWrite=!1,e.stencilRef=vf.TILE_MASK,e.stencilFunc=c.AlwaysStencilFunc,e.stencilFuncMask=vf.TILE_MASK,e.stencilZPass=c.ReplaceStencilOp,e.stencilWriteMask=vf.TILE_MASK;this.tileObjects.push(i)}let D=E.toString();if(gf.get(this)!==D&&(gf.set(this,D),f=!0),C.skipLevelOfDetail&&this.backfaceObjects.length)for(let e=0;e<this.backfaceObjects.length;e++)this.renderObjects.push(this.backfaceObjects[e]);if(this.tileObjects.length)for(let e=0;e<this.tileObjects.length;e++)this.renderObjects.push(this.tileObjects[e]);C.skipLevelOfDetail&&this.renderObjects.push(this.clearStencilObject);let O=[];for(let r of this.tileset.selectedTrajectories){let i=(d=r.content.data)==null?void 0:d.object;if(!i)continue;let a=i.update(e,t,n,this,r,p);O.push(r.id),a&&(f=!0),this.renderObjects.push(i)}let k=O.toString();if(_f.get(this)!==k&&(_f.set(this,k),f=!0),this.parent){let e=this.parent.children.length+1,t=(Math.min(0,this.parent.children.indexOf(this))-e)*1e4+1;for(let e=0;e<this.renderObjects.length;e++){let n=this.renderObjects[e],r=e+t;n.traverse(e=>{(e instanceof c.Mesh||e instanceof c.Line||e instanceof c.Points)&&(e.renderOrder=r)})}}if(this.loaded)for(let e=0;e<this.renderObjects.length;e++)this.add(this.renderObjects[e]);return f}dispose(){this.disposed=!0,this.tileset.reset(),this.tileset.root.children.length=0,/^blob\:/.test(this.tileset.id)&&URL.revokeObjectURL(this.tileset.id);for(let e=this.children.length-1;e>=0;e--)this.remove(this.children[e]);this.refined=!1,this.loaded=!1,this.refineProgress[0]=this.refineProgress[1]=0,this.error=null,this.onError=void 0,this.renderer=void 0}get model(){return this.parent}get scene(){return this}get viewLayer(){return this}localToEnu(e){return e.applyMatrix4(uf)}enuToLocal(e){return e.applyMatrix4(lf)}enuToEcef(e){return e.applyMatrix4(this.coordinateSystem.enuToEcefMatrix)}ecefToEnu(e){return e.applyMatrix4(this.coordinateSystem.ecefToEnuMatrix)}localToEcef(e){return this.enuToEcef(this.localToEnu(e))}ecefToLocal(e){return this.enuToLocal(this.ecefToEnu(e))}localToLla(e){return rf(this.enuToEcef(this.localToEnu(e)))}llaToLocal(e){return this.enuToLocal(this.ecefToEnu(af(e)))}worldToEnu(e){return this.localToEnu(this.worldToLocal(e))}enuToWorld(e){return this.localToWorld(this.enuToLocal(e))}worldToEcef(e){return this.localToEcef(this.worldToLocal(e))}ecefToWorld(e){return this.localToWorld(this.ecefToLocal(e))}worldToLla(e){return this.localToLla(this.worldToLocal(e))}llaToWorld(e){return this.localToWorld(this.llaToLocal(e))}get coordinates(){ff.setScalar(0);let{x:e,y:t}=this.localToLla(ff);return[e,t].map(e=>(e/Math.PI*180).toFixed(6)).join(`,`)}getTransformMatrix4(e=new c.Matrix4){return e.copy(this.coordinateSystem.ecefToEnuMatrix),e.premultiply(lf),e.premultiply(this.matrixWorld),e}coordinatesToWorldPoint(e){let t=new c.Vector3(e.latitude,e.longitude,e.altitude);return this.llaToWorld(t)}worldPointToCoordinates(e){return ff.copy(e),this.worldToLla(ff),{latitude:ff.x,longitude:ff.y,altitude:ff.z}}resetBrightness(){this.parameter.reset(`brightness`)}get minLevelOfDetail(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`minLevelOfDetail`,...e)}set minLevelOfDetail(e){this.parameter.set(`minLevelOfDetail`,e)}get maxLevelOfDetail(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxLevelOfDetail`,...e)}set maxLevelOfDetail(e){this.parameter.set(`maxLevelOfDetail`,e)}get minGeometricError(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`minGeometricError`,...e)}set minGeometricError(e){this.parameter.set(`minGeometricError`,e)}get maxGeometricError(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxGeometricError`,...e)}set maxGeometricError(e){this.parameter.set(`maxGeometricError`,e)}get panoramaMinGeometricError(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`panoramaMinGeometricError`,...e)}set panoramaMinGeometricError(e){this.parameter.set(`panoramaMinGeometricError`,e)}get skipLevelOfDetail(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`skipLevelOfDetail`,...e)}set skipLevelOfDetail(e){this.parameter.set(`skipLevelOfDetail`,e)}get mostDetail(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`mostDetail`,...e)}set mostDetail(e){this.parameter.set(`mostDetail`,e)}get loadSiblings(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`loadSiblings`,...e)}set loadSiblings(e){this.parameter.set(`loadSiblings`,e)}get maxMemoryUsage(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxMemoryUsage`,...e)}set maxMemoryUsage(e){this.parameter.set(`maxMemoryUsage`,e)}get maxRequests(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxRequests`,...e)}set maxRequests(e){this.parameter.set(`maxRequests`,e)}get requestOrder(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`requestOrder`,...e)}set requestOrder(e){this.parameter.set(`requestOrder`,e)}get maxScreenSpaceError(){let e=[];return this.parent&&this.parent.parameter instanceof G&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof G&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxScreenSpaceError`,...e)}set maxScreenSpaceError(e){this.parameter.set(`maxScreenSpaceError`,e)}},Tf={};function Ef(e,t){let n=Tf[e];if(n){let e=n.get(t);if(e)return e}throw Error(`fetcher workCode:${t.workCode} never registered.`)}function Df(e,t,n){let r=Tf[e];r||(r=Tf[e]=new WeakMap),r.has(t)||r.set(t,n)}var Of=new c.Matrix4,kf=new c.Vector3,Af=new c.Matrix4;function jf(e,t,n){switch(e){case`Z`:n.identity();break;case`WGS84`:case`GCJ02`:case`BD09`:of(t,n);break;default:n.identity();break}return n}function Mf(e){var t;let[n,r]=e.tilesetUrl.split(`#`),i=(t=(r||n).split(`?`)[1])==null?``:t;return e.fetcher.ajax(e.tilesetUrl,{responseType:`text`}).catch(e=>({error:e,body:JSON.stringify({asset:{version:`0.0`},geometricError:0,root:{geometricError:0}})})).then(t=>{var n;let r=`error`in t?t.error:null,a=bd(JSON.parse(t.body),e.tilesetUrl),{root:o,rootMeta:s={}}=a,l=e.upAxis;s.upAxis&&s.upAxis!==l&&(l=s.upAxis),`lodVersion`in a&&(l=`-Y`,`floorInfo`in a&&(a.properties=a.properties||{},a.properties.floorInfo=a.floorInfo.map(e=>({ground:-e.ground,height:e.height})),a.floorInfo=void 0),a.asset.tilesetVersion=String(a.lodVersion),a.lodVersion=void 0);let u=l,d=new c.Matrix4;u===`Y`?(u=`Z`,d.fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1])):u===`-Y`&&(u=`Z`,d.fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]));let f=o.boundingVolume?jl(o.boundingVolume):void 0;f&&o.transform&&f.applyMatrix4(Af.fromArray(o.transform));let p=null,m=new c.Matrix4,h=new c.Matrix4;return s.coordinate?(p=s.coordinate.ground_height,m.fromArray(s.coordinate.pose_ecef_to_enu),h.fromArray(s.coordinate.pose_enu_to_ecef)):(f?f.getCenter(kf):kf.setScalar(0),kf.applyMatrix4(d),jf(u,kf,m),h.getInverse(m)),a.root={refine:(n=o.refine)==null?`REPLACE`:n,geometricError:o.geometricError,transform:Af.copy(d).premultiply(u===`Z`?Of:m).premultiply(lf).toArray(),boundingVolume:f?f.toJson():void 0,children:[o]},new wf(a,{name:e.name,type:e.type,upAxis:l,light:e.light,fetcher:e.fetcher,search:i,groundHeight:p,coordinateSystem:{enuToEcefMatrix:h,ecefToEnuMatrix:m},error:r})})}function Nf(e,t){var n;let r=e.layers.map(e=>({tilesetUrl:e.work.getURL(e.tileset),name:e.name,type:e.type,upAxis:e.upAxis,light:t.light,fetcher:t.fetcher}));if(e.file){let i=!1;for(let e of r)if(e.type===`mesh`){i=!0;break}if(i===!1){let i=Dr(e.file)||`.at3d`,a=JSON.stringify({tilesetUrl:``,asset:{version:`0.0`},geometricError:0,root:{refine:`REPLACE`,geometricError:0,transform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],content:{uri:e.work.getURL(e.file)},extras:{[i.slice(1)]:{upAxis:e.upAxis,textureBaseUri:typeof e.textureBase==`string`?e.work.getURL(e.textureBase):void 0,textureArray:e.textures,textureOptions:(n=t.textureOptions)==null?{}:n}}},rootMeta:{coordinate:e.coordinate}});r.push({name:`fallback`,type:`mesh`,upAxis:`Z`,tilesetUrl:URL.createObjectURL(new Blob([a],{type:`application/json`})),fetcher:t.fetcher,light:t.light})}}let i=r.map(e=>Mf(e).then(e=>e));return Promise.all(i)}function Pf(e=1,t=1,n=1){let r=e/2,i=t/2,a=n/2,o=new Float32Array([-r,+i,+a,+r,+i,+a,+r,+i,-a,-r,+i,-a,-r,-i,+a,+r,-i,+a,+r,-i,-a,-r,-i,-a]),s=new Uint32Array([0,4,1,1,4,5,1,5,2,2,5,6,2,6,3,3,6,7,3,7,0,0,7,4,3,0,2,2,0,1,4,7,5,5,7,6]),l=new c.BufferGeometry;return l.setAttribute(`position`,new c.BufferAttribute(o,3)),l.setIndex(new c.BufferAttribute(s,1)),l.addGroup(0,l.index.count,0),l.computeBoundingBox(),l.computeBoundingSphere(),l}function Ff(e,t){for(var n=e[0].index!==null,r=new Set(Object.keys(e[0].attributes)),i=new Set(Object.keys(e[0].morphAttributes)),a={},o={},s=new c.BufferGeometry,l=0,u=0;u<e.length;++u){var d=e[u];if(n!==(d.index!==null))return null;for(var f in d.attributes){if(!r.has(f))return null;a[f]===void 0&&(a[f]=[]),a[f].push(d.attributes[f])}for(var f in d.morphAttributes){if(!i.has(f))return null;o[f]===void 0&&(o[f]=[]),o[f].push(d.morphAttributes[f])}if(s.userData.mergedUserData=s.userData.mergedUserData||[],s.userData.mergedUserData.push(d.userData),t){var p;if(n)p=d.index.count;else if(d.attributes.position!==void 0)p=d.attributes.position.count;else return null;s.addGroup(l,p,u),l+=p}}if(n){for(var m=0,h=[],u=0;u<e.length;++u){for(var g=e[u].index,_=0;_<g.count;++_)h.push(g.getX(_)+m);m+=e[u].attributes.position.count}s.setIndex(h)}for(var f in a){var v=If(a[f]);if(!v)return null;s.setAttribute(f,v)}for(var f in o){var y=o[f][0].length;if(y===0)break;s.morphAttributes=s.morphAttributes||{},s.morphAttributes[f]=[];for(var u=0;u<y;++u){for(var b=[],_=0;_<o[f].length;++_)b.push(o[f][_][u]);var x=If(b);if(!x)return null;s.morphAttributes[f].push(x)}}return s}function If(e){for(var t,n,r,i=0,a=0;a<e.length;++a){var o=e[a];if(o.isInterleavedBufferAttribute||(t===void 0&&(t=o.array.constructor),t!==o.array.constructor)||(n===void 0&&(n=o.itemSize),n!==o.itemSize)||(r===void 0&&(r=o.normalized),r!==o.normalized))return null;i+=o.array.length}for(var s=new t(i),l=0,a=0;a<e.length;++a)s.set(e[a].array,l),l+=e[a].array.length;return new c.BufferAttribute(s,n,r)}function Lf(e,t=1e-4){t=Math.max(t,Number.EPSILON);for(var n={},r=e.getIndex(),i=e.getAttribute(`position`),a=r?r.count:i.count,o=0,s=Object.keys(e.attributes),l={},u={},d=[],f=[`getX`,`getY`,`getZ`,`getW`],p=0,m=s.length;p<m;p++){var h=s[p];l[h]=[];var g=e.morphAttributes[h];g&&(u[h]=Array(g.length).fill().map(()=>[]))}for(var _=Math.log10(1/t),v=Math.pow(10,_),p=0;p<a;p++){for(var y=r?r.getX(p):p,b=``,x=0,m=s.length;x<m;x++)for(var h=s[x],S=e.getAttribute(h),C=S.itemSize,w=0;w<C;w++)b+=`${~~(S[f[w]](y)*v)},`;if(b in n)d.push(n[b]);else{for(var x=0,m=s.length;x<m;x++)for(var h=s[x],S=e.getAttribute(h),g=e.morphAttributes[h],C=S.itemSize,T=l[h],E=u[h],w=0;w<C;w++){var D=f[w];if(T.push(S[D](y)),g)for(var O=0,k=g.length;O<k;O++)E[O].push(g[O][D](y))}n[b]=o,d.push(o),o++}}let A=e.clone();for(var p=0,m=s.length;p<m;p++){var h=s[p],j=e.getAttribute(h),M=new j.array.constructor(l[h]),S=new c.BufferAttribute(M,j.itemSize,j.normalized);if(A.setAttribute(h,S),h in u)for(var x=0;x<u[h].length;x++){var N=e.morphAttributes[h][x],M=new N.array.constructor(u[h][x]),ee=new c.BufferAttribute(M,N.itemSize,N.normalized);A.morphAttributes[h][x]=ee}}return A.setIndex(d),A}var Rf=new c.Sphere,zf=new c.Matrix4,Bf=new c.Matrix4;function Vf(e,t,n=30/180*Math.PI){let r=Math.cos(n),i=[];for(let n of e.children)n instanceof wf&&n.tileset.selectedTiles.forEach(e=>{var n,a,o;let s=(a=(n=e.content)==null?void 0:n.data)==null?void 0:a.object;if(s&&s.visible){let e=[];if(s.traverseVisible(n=>{if(n instanceof c.Mesh){let r=ju(n);if(r){zf.copy(n.matrixWorld),Bf.getInverse(zf),Rf.copy(t).applyMatrix4(Bf);let i=r.trianglesInSphere(Rf.center,Rf.radius),a=new c.BufferGeometry;a.setAttribute(`position`,new c.BufferAttribute(i,3)),a.applyMatrix4(n.matrixWorld),a=Lf(a,.01),e.push(a)}}}),e.length===0)return;let n=[`a`,`b`,`c`],a=Ff(e,!1),l=a.getAttribute(`position`).array,u=((o=a.getIndex())==null?void 0:o.array)||[],d=[],f=[];for(let e=0,t=l.length;e<t;e+=3){let t=new c.Vector3(l[e],l[e+1],l[e+2]);d.push(t)}for(let e=0,t=u.length;e<t;e+=3){let t=u[e],n=u[e+1],r=u[e+2],i=new c.Vector3().crossVectors(d[n].clone().sub(d[t]),d[r].clone().sub(d[t])).normalize();f.push({a:t,b:n,c:r,normal:i})}let p={};for(let e=0,t=f.length;e<t;e++){let t=f[e];for(let r=0;r<3;r++){let i=t[n[r]],a=t[n[(r+1)%3]],o=[Math.min(i,a),Math.max(i,a)],s=o[0]+`-`+o[1];p[s]===void 0?p[s]={index1:o[0],index2:o[1],face1:e}:p[s].face2=e}}for(let e in p){let t=p[e];if(t.face2===void 0||f[t.face1].normal.dot(f[t.face2].normal)<=r){let e=d[t.index1],n=d[t.index2];i.push(new c.Line3(e,n))}}d.length=0,f.length=0}});return i}var Hf=new c.Box3,Uf=new c.Box3,Wf=new c.Box3,Gf=class extends c.Object3D{constructor(e,t,n={}){var r;super(),this.disposed=!1,this.parameter=new G,this.outdated=!1,this.autoRefine=!0,this.metaPending=!1,this.loaded=!1,this.refined=!1,this.refineProgress=[0,0],this.boundingBox=new c.Box3,this.fiveId=e,this.needsRender=!1,this.work=t,this.name=t.workCode;let i=0;for(let e of t.observers)i=Math.max(i,e.floorIndex);if(this.floorLength=i+1,t.model){this.metaPending=!0;let e=Nf(t.model,{fetcher:Ef(this.fiveId,t),light:(r=n.light)==null?!1:r,textureOptions:n.textureOptions}),i=e=>this.dispatchEvent({type:`error`,error:e}),a=e=>this.dispatchEvent({type:`tileLoad`,tile:e}),o=e=>this.dispatchEvent({type:`tileUnload`,tile:e});this.initReady=e.then(e=>{var t;this.metaPending=!1;let n=null,r=null,s=null;for(let t of e){if(t.visible=!1,t.onError=i,t.onTileLoad=a,t.onTileUnload=o,t.error){i(t.error);continue}t.type===`mesh`?n===null&&(n=t):t.type===`point_cloud`?r===null&&(r=t):s===null&&(s=t)}let c=(t=n==null?r:n)==null?s:t;if(c&&(c.visible=!0),e.length)if(this.disposed)for(let t of e)t.dispose();else this.add(...e);return this}),this.loadedReady=new Promise(e=>{let t=()=>{e(this),this.removeEventListener(`load`,t),this.removeEventListener(`dispose`,t)};this.addEventListener(`load`,t),this.addEventListener(`dispose`,t)})}else this.refined=!0,this.loaded=!0,this.initReady=Promise.resolve(this),this.loadedReady=Promise.resolve(this);this.parameter.set(`boundingBox`,this.boundingBox.clone())}dispose(){this.disposed=!0;let e;for(;e=this.children[0];)typeof e.dispose==`function`&&e.dispose(),e.onError=void 0,e.onTileLoad=void 0,e.onTileUnload=void 0,this.remove(e);this.dispatchEvent({type:`dispose`})}get empty(){return this.children.length===0}get viewLayers(){return this.children}getEdgesBySphere(e,t=30/180*Math.PI){return Vf(this,e,t)}intersectRaycaster(e,t){let n=t==null?[]:t,r=e.sortByDistance;e.sortByDistance=!1;for(let t=0,r=this.children.length;t<r;t++){let r=this.children[t];r.visible&&typeof r.intersectRaycaster==`function`&&r.intersectRaycaster(e,n)}return e.sortByDistance=r,Jl(n,e.sortByDistance,e.firstHitOnly),n}update(e,t,n){let r=!1;this.needsRender===!0&&(this.needsRender=!1,r=!0);let i=this.loaded;this.refined=!this.metaPending,this.loaded=!this.metaPending,this.refineProgress[0]=this.refineProgress[1]=0,this.work.transform.equals(this.matrix)||(this.matrix.copy(this.work.transform),this.matrix.decompose(this.position,this.quaternion,this.scale),this.matrixAutoUpdate=!1,r=!0);for(let i of this.children)i.autoRefine=this.autoRefine,i.update(e,t,n,this)&&(r=!0),i.refined===!1&&(this.refined=!1),i.loaded===!1&&(this.loaded=!1),this.refineProgress[0]+=i.refineProgress[0],this.refineProgress[1]+=i.refineProgress[1];Hf.makeEmpty(),Wf.copy(this.work.observerBox),Wf.isEmpty()||(Wf.max.x+=1,Wf.max.z+=1,Wf.max.y+=1,--Wf.min.x,--Wf.min.z,Hf.union(Wf));for(let e of this.viewLayers)e.boundingBox.isEmpty()||(Uf.copy(e.boundingBox),Hf.union(Uf));return Hf.applyMatrix4(this.matrix),Hf.equals(this.boundingBox)||(this.boundingBox.copy(Hf),this.parameter.set(`boundingBox`,Hf.clone())),i===!1&&this.loaded===!0&&this.dispatchEvent({type:`load`}),r}localToEnu(e){return e.applyMatrix4(uf)}enuToLocal(e){return e.applyMatrix4(lf)}worldToEnu(e){return this.localToEnu(this.worldToLocal(e))}enuToWorld(e){return this.localToWorld(this.enuToLocal(e))}get shownFloor(){return this.shownFloorIndex===-1?null:this.shownFloorIndex}set shownFloor(e){this.shownFloorIndex=e===null?-1:e}show(e){this.shownFloor=e==null?null:e,this.dispatchEvent({type:`changeShownFloor`,floorIndex:e==null?null:e})}get bounding(){return this.boundingBox}setMaterial(e){this.parameter.set(e)}getMaterial(){let e=[];return this.parent&&this.parent.parameter instanceof G&&e.unshift(this.parent.parameter),this.parameter.resolveValue(...e)}get shownFloorIndex(){let e=[];return this.parent&&this.parent.parameter instanceof G&&e.unshift(this.parent.parameter),this.parameter.resolveValue(`shownFloorIndex`,...e)}set shownFloorIndex(e){this.parameter.set(`shownFloorIndex`,e)}get brightness(){let e=[];return this.parent&&this.parent.parameter instanceof G&&e.unshift(this.parent.parameter),this.parameter.resolveValue(`brightness`,...e)}set brightness(e){this.parameter.set(`brightness`,e)}get clippers(){let e=[];return this.parent&&this.parent.parameter instanceof G&&e.unshift(this.parent.parameter),this.parameter.resolveValue(`clippers`,...e)}set clippers(e){this.parameter.set(`clippers`,e)}get customShaders(){let e=[];return this.parent&&this.parent.parameter instanceof G&&e.unshift(this.parent.parameter),this.parameter.resolveValue(`customShaders`,...e)}set customShaders(e){this.parameter.set(`customShaders`,e)}resetBrightness(){this.parameter.reset(`brightness`);for(let e of this.viewLayers)e.resetBrightness()}},Kf=Pf(1,1,1);Kf.applyMatrix4(new c.Matrix4().makeScale(-1,1,1));var qf=new WeakMap,Jf=new c.Vector3(1,1,1),Yf=new c.Box3,Xf=new c.Vector3,Zf=new c.Box3,Qf=new c.Vector3,$f=new c.Vector3,ep=class extends bn{constructor(e={}){var t;let n=new yn(`none`);n.flatShading=!0,n.depthWrite=!1,n.transparent=!1,n.blending=c.CustomBlending,n.blendSrc=c.SrcAlphaFactor,n.blendDst=c.OneMinusSrcAlphaFactor,n.blendSrcAlpha=c.OneFactor,n.blendDstAlpha=c.OneMinusSrcAlphaFactor,n.floorIndex=-1,super(Kf,[n]),this.name=(t=e.name)==null?``:t,this.frustumCulled=!1,this.renderOrder=-999999,this.currentResolvedParameterValue=G.resolveValueTo({})}update(e,t,n){var r,i;let a=!1,o=G.resolveValueTo(this.currentResolvedParameterValue,n.parameter);Yf.copy(o.boundingBox),Yf.getSize(Xf);let s=Math.min(Xf.x/2,500);Yf.min.x-=s,Yf.max.x+=s;let c=Math.min(Xf.y/2,500);Yf.min.z-=c,Yf.max.z+=c;let l=Xf.length()/2;if(Yf.max.y=Math.max(Yf.max.y,l),Yf.union(Zf.setFromCenterAndSize(t.position,Jf)),Yf.expandByScalar(1),Yf.getCenter(Qf),Yf.getSize($f),Qf.equals(this.position)||(this.position.copy(Qf),a=!0),$f.equals(this.scale)||(this.scale.copy($f),a=!0),qf.get(this)!==o.versionNumber){qf.set(this,o.versionNumber),a=!0;let e=this.material;for(let t of e)t.customShaders=o.customShaders,t.pano0=o.pano0,t.pano1=o.pano1,t.panoFilter=(i=(r=o.panoFilter)==null?void 0:r.toValue())==null?null:i,t.refinedScreen=o.refinedScreen,t.modelAlpha=o.modelAlpha,t.progress=o.progress,t.transition=o.transition,t.opacity=o.opacity,t.floorStyle=o.floorStyle,t.constantColor=o.constantColor,t.shownFloorIndex=o.shownFloorIndex,t.clippers=o.clippers,t.brightness=o.brightness,t.useHQWeight=o.useHQWeight,t.useHQDepth=o.useHQDepth,t.colorSaturation=o.colorSaturation,t.colorBrightness=o.colorBrightness,t.gradientTexture=o.gradientTexture,t.transparent=!1,t.modelBoundingMax.copy(o.boundingBox.max),t.modelBoundingMin.copy(o.boundingBox.min),o.useAddBlend&&(t.opacity=0),t.opacity===0&&(t.visible=!1)}return a}dispose(){for(let e of this.material)e.dispose(),e.pano0=null,e.pano1=null}},tp=new c.Box3,np=class extends c.Scene{constructor(e){super(),this.needsRender=!0,this.autoRefine=!0,this.boundingBox=new c.Box3,this.loaded=!1,this.refined=!1,this.refineProgress=[0,0],this.parameter=new G,this.fiveId=e.fiveId,this.boundingMesh=new ep({name:`bounding`}),this.add(this.boundingMesh);let t=this.models=[];this.shownModels=[],this.updateModelMap=new Map,this.parameter.set(`boundingBox`,this.boundingBox.clone());let n=this;V(t,`autoUpdate`,{get(){return n.autoRefine},set(e){n.autoRefine=e}}),V(t,`bounding`,{get(){return n.boundingBox}}),V(t,`loaded`,{get(){return n.loaded}}),V(t,`refined`,{get(){return n.refined}}),V(t,`refineProgress`,{get(){return n.refineProgress}}),V(t,`cacheCameras`,{get(){return n.parameter.resolveValue(`cacheCameras`)},set(e){n.parameter.set(`cacheCameras`,e)}}),V(t,`intersectRaycaster`,{value:e=>n.intersectRaycaster(e)}),V(t,`setMaterial`,{value:e=>n.setMaterial(e)}),V(t,`getMaterial`,{value:()=>n.getMaterial()}),V(t,`resetBrightness`,{value:()=>n.resetBrightness()})}setModels(e,t){let n=e.map(e=>{let n=this.shownModels.filter(t=>t.work.workCode===e.workCode)[0];if(n||(n=this.models.filter(t=>t.work.workCode===e.workCode)[0],n))return n.work=e,n;n=new Gf(this.fiveId,e,{light:t.light,textureOptions:t.textureOptions});let r=t[`3d-tiles`];return n.initReady.then(()=>{if(r)if(typeof r==`function`)for(let e of n.viewLayers){let t=r(e,n);t&&(t.viewerRequestVolume&&(e.viewerRequestVolume=jl(t.viewerRequestVolume)),e.parameter.set(yr(t,[`showLayers`])),t.showLayers===!1?e.visible=!1:Array.isArray(t.showLayers)&&(e.visible=t.showLayers.includes(e.name)))}else for(let e of n.viewLayers)r.viewerRequestVolume&&(e.viewerRequestVolume=jl(r.viewerRequestVolume)),e.parameter.set(yr(r,[`showLayers`])),r.showLayers===!1?e.visible=!1:Array.isArray(r.showLayers)&&(e.visible=r.showLayers.includes(e.name))}),this.dispatchEvent({type:`model.create`,model:n}),n});for(let e=0;e<this.models.length;e++){let t=this.models[e];n.indexOf(t)===-1&&this.shownModels.indexOf(t)===-1&&(t.dispose(),this.dispatchEvent({type:`model.dispose`,model:t}))}this.models.length=0;for(let e=0;e<n.length;e++){let t=n[e];this.models.push(t)}if(t.forceReplaceImmediately&&!Ul(this.models,this.shownModels)){for(let e=0;e<this.shownModels.length;e++){let t=this.shownModels[e];this.models.indexOf(t)===-1&&(t.dispose(),this.dispatchEvent({type:`model.dispose`,model:t}))}this.shownModels.length=0;for(let e=0;e<this.models.length;e++)this.shownModels.push(this.models[e])}return this.loaded=!1,this.refined=!1,this.models}get empty(){return this.boundingBox.isEmpty()}intersectRaycaster(e,t){let n=t==null?[]:t,r=this.shownModels.filter(e=>e.visible);if(r.length===1)r[0].intersectRaycaster(e,n);else{let t=e.sortByDistance;e.sortByDistance=!1;for(let t of r)t.intersectRaycaster(e,n);e.sortByDistance=t,Jl(n,e.sortByDistance,e.firstHitOnly)}return n}update(e,t){let n=!1;tp.makeEmpty(),this.loaded=this.models.length>0,this.refined=this.models.length>0,this.refineProgress[0]=this.refineProgress[1]=0,this.updateModelMap.clear();for(let n=0;n<this.models.length;n++){let r=this.models[n];if(!this.updateModelMap.has(r)){let n=r.autoRefine;this.autoRefine===!1&&(r.autoRefine=!1);let i=r.update(e,t,this);r.autoRefine=n,this.updateModelMap.set(r,i)}r.loaded===!1&&(this.loaded=!1),r.refined===!1&&(this.refined=!1),this.refineProgress[0]+=r.refineProgress[0],this.refineProgress[1]+=r.refineProgress[1]}if((this.loaded===!0||this.models.length===0)&&!Ul(this.models,this.shownModels)){for(let e=0;e<this.shownModels.length;e++){let t=this.shownModels[e];this.models.indexOf(t)===-1&&(t.dispose(),this.dispatchEvent({type:`model.dispose`,model:t}))}this.shownModels.length=0;for(let e=0;e<this.models.length;e++)this.shownModels.push(this.models[e]);n=!0}for(let n=0;n<this.shownModels.length;n++){let r=this.shownModels[n];if(!this.updateModelMap.has(r)){let n=r.autoRefine;(this.autoRefine===!1||this.models.indexOf(r)<0)&&(r.autoRefine=!1);let i=r.update(e,t,this);r.autoRefine=n,this.updateModelMap.set(r,i)}}for(let e=this.children.length-1;e>=0;e--){let t=this.children[e];t instanceof Gf&&this.remove(t)}for(let e=0;e<this.shownModels.length;e++){let t=this.shownModels[e];this.updateModelMap.get(t)===!0&&(n=!0),tp.union(t.boundingBox),this.add(t)}for(let e=0;e<this.models.length;e++){let t=this.models[e];this.shownModels.indexOf(t)===-1&&tp.union(t.boundingBox)}return tp.equals(this.boundingBox)||(this.boundingBox.copy(tp),this.parameter.set(`boundingBox`,this.boundingBox.clone()),n=!0),this.boundingMesh.update(e,t,this)&&(n=!0),this.updateModelMap.clear(),this.needsRender=n,n}get bounding(){return this.boundingBox}setMaterial(e){this.parameter.set(e)}getMaterial(){return this.parameter.resolveValue()}resetBrightness(){this.parameter.reset(`brightness`);for(let e of this.models)e.resetBrightness()}dispose(){this.remove(this.boundingMesh),this.boundingMesh.dispose();for(let e=this.children.length-1;e>=0;e--){let t=this.children[e];t instanceof Gf&&this.remove(t)}let e=Gl(this.models.concat(this.shownModels));for(let t=0;t<this.shownModels.length;t++)e[t].dispose();this.models.length=0,this.shownModels.length=0,super.dispose()}};function rp(e){let t={};return e.mode!==void 0&&(t.mode=e.mode),e.panoIndex!==void 0&&(t.pano_index=e.panoIndex),e.longitude!==void 0&&(t.longitude=e.longitude),e.latitude!==void 0&&(t.latitude=e.latitude),e.fov!==void 0&&(t.fov=e.fov),e.distance!==void 0&&(t.distance=e.distance),e.offset!==void 0&&(t.offset=e.offset.toArray()),t}function ip(e){var t;if(e)return{file_url:e.file,material_base_url:e.textureBase,material_textures:(t=e.textures)==null?void 0:t.slice(),up_axis:e.upAxis,layers:e.layers.map(e=>({tileset_url:e.tileset,up_axis:e.upAxis,name:e.name,type:e.type}))}}function ap(e){return{index:e.index,derived_id:e.derivedId,derived_id_str:e.derivedIdStr,floor_index:e.floorIndex,position:e.position.toArray(),standing_position:e.standingPosition.toArray(),quaternion:{x:e.quaternion.x,y:e.quaternion.y,z:e.quaternion.z,w:e.quaternion.w},visible_nodes:e.accessibleNodes.slice(),accessible_nodes:e.accessibleNodes.slice()}}function op(e){return{index:e.index,active:e.active,loadable:e.loadable,derived_id:e.derivedId,derived_id_str:e.derivedIdStr,size_list:e.images.sizeList.slice(),up:e.images.up,down:e.images.down,right:e.images.right,left:e.images.left,front:e.images.front,back:e.images.back,video:e.images.video?{matrix:e.images.video.matrix.toArray(),size:e.images.video.size.toArray(),source:e.images.video.source}:void 0}}function sp(e){return{allow_hosts:e.allowHosts.slice(),expire_at:e.expire.getTime().toString(),project_id:e.projectId,code:e.workCode,name:e.name,base_url:e.baseURL,initial:rp(e.initial),model:ip(e.model),observers:e.observers.map(e=>ap(e)),panorama:{count:e.observers.length,list:e.observers.map(e=>op(e))}}}function cp(e){let t=(e.x*2+1)*Math.PI,n=(.5-e.y)*Math.PI,r=Math.sin(n),i=Math.cos(n),a=Math.sin(t),o=Math.cos(t),s=i*a,l=r,u=i*o,d=Math.abs(s),f=Math.abs(l),p=Math.abs(u),m,h;if(d>=f&&d>=p){let e=1/d;s>0?(m=`right`,h=new c.Vector2(-u*e,l*e)):(m=`left`,h=new c.Vector2(u*e,l*e))}else if(f>=d&&f>=p){let e=1/f;l>0?(m=`up`,h=new c.Vector2(s*e,-u*e)):(m=`down`,h=new c.Vector2(s*e,u*e))}else{let e=1/p;u>0?(m=`front`,h=new c.Vector2(s*e,l*e)):(m=`back`,h=new c.Vector2(-s*e,l*e))}return h.x=(h.x+1)/2,h.y=1-(h.y+1)/2,[m,h]}function lp(e,t){let n=t.x*2-1,r=(1-t.y)*2-1,i=0,a=0,o=0;switch(e){case`right`:i=1,a=r,o=-n;break;case`left`:i=-1,a=r,o=n;break;case`up`:i=n,a=1,o=-r;break;case`down`:i=n,a=-1,o=r;break;case`front`:i=n,a=r,o=1;break;case`back`:i=-n,a=r,o=-1;break;default:throw Error(`Invalid cubFace: ${e}`)}let s=Math.sqrt(i*i+a*a+o*o);if(s===0)return new c.Vector2(.5,.5);i/=s,a/=s,o/=s;let l=Math.atan2(i,o),u=Math.asin(Math.max(-1,Math.min(1,a))),d=(l+Math.PI)/(2*Math.PI),f=(Math.PI/2-u)/Math.PI;return d%=1,d=d<0?d+1:d,f=Math.max(0,Math.min(1,f)),new c.Vector2(d,f)}var up={vectorToEquirectangularUv(e,t=`top-left`){let n=new c.Quaternion().setFromRotationMatrix(this.work.transform).inverse(),r=new c.Quaternion().copy(this.quaternion).inverse(),i=new c.Quaternion(0,1,0,0).inverse(),a=new c.Vector3().copy(e).normalize().applyQuaternion(n).applyQuaternion(r).applyQuaternion(i),o=Math.atan2(a.x,-a.z),s=Math.asin(-a.y);if(t===`top-left`)return new c.Vector2(o/(Math.PI*2)+.5,s/Math.PI+.5);if(t===`bottom-left`)return new c.Vector2(o/(Math.PI*2)+.5,.5-s/Math.PI);throw Error(`Invalid uvOrigin ${t}`)},vectorToCubemapUv(e,t=`top-left`){let n=cp(this.vectorToEquirectangularUv(e,`top-left`));if(t===`top-left`)return n;if(t===`bottom-left`){let[e,t]=n;return t.y=1-t.y,n}else throw Error(`Invalid uvOrigin ${t}`)},equirectangularUvToVector(e,t=`top-left`){let n=0;if(t===`top-left`)n=1;else if(t===`bottom-left`)n=-1;else throw Error(`Invalid uvOrigin ${t}`);let r=new c.Quaternion().setFromRotationMatrix(this.work.transform),i=new c.Quaternion().copy(this.quaternion),a=new c.Quaternion(0,1,0,0),o=Math.PI*2*(e.x+.5),s=Math.PI*(e.y-.5),l=Math.abs(Math.cos(s)),u=Math.sin(o)*l,d=-Math.sin(s)*n,f=-Math.cos(o)*l;return new c.Vector3(u,d,f).applyQuaternion(a).applyQuaternion(i).applyQuaternion(r)},cubemapUvToVector(e,t,n=`top-left`){let r;if(n===`top-left`)r=t;else if(n===`bottom-left`)r=new c.Vector2().copy(t),r.y=1-r.y;else throw Error(`Invalid uvOrigin ${n}`);let i=lp(e,r);return this.equirectangularUvToVector(i)},getWorldPosition(){return new c.Vector3().copy(this.position).applyMatrix4(this.work.transform)},getWorldStandingPosition(){return new c.Vector3().copy(this.standingPosition).applyMatrix4(this.work.transform)}};function dp(e){return typeof e==`number`}function fp(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>typeof e!=`object`||!e?e:fp(e));{let t={};for(let n in e){let r=e[n];t[n]=typeof r!=`object`||!r?r:fp(r)}return t}}function pp(e){return e==null?`null`:Array.isArray(e)?`array`:typeof e==`object`?`dict`:`value`}function mp(e,t){let n=pp(e),r=pp(t);if(r===`null`)return e;if(r===`value`)return t;if(r!==n)return fp(t);if(r===`array`)for(let n=0;n<t.length;n++)e[n]=mp(e[n],t[n]);else if(r===`dict`)for(let n in t)e[n]=mp(e[n],t[n]);return e}function hp(e,t=!1){let n=typeof e;if(n===`string`)return JSON.stringify(e);if(e===!0)return`true`;if(e===!1)return`false`;if(e===null)return`null`;if(e instanceof Array){let t=`[`,n=e.length-1,r=0;for(;r<n;r++)t+=hp(e[r],!1)+`,`;return n>-1&&(t+=hp(e[r],!1)),t+`]`}if(e instanceof Object){if(typeof e.toJSON==`function`)return hp(e.toJSON(),t);let n=Object.keys(e).sort(),r=n.length,i=``,a=0;for(;a<r;){let t=n[a],r=hp(e[t],!0);r!==void 0&&(a&&i!==``&&(i+=`,`),i+=JSON.stringify(t)+`:`+r),a++}return`{`+i+`}`}switch(n){case`function`:return JSON.stringify(e.toString());case`undefined`:return t?void 0:null;case`number`:return e;default:return isFinite(e)?e:null}}function gp(e){return hp(e,!1)}function _p(e){return`hash::${_t(gp(e))}`}var vp=/^(.*)\[(\d+)\]$/;function Z(e){if(!isNaN(e.panoIndex)&&isFinite(e.panoIndex))return`${e.workCode}[${e.panoIndex}]`;throw Error(`Invalid Pano`)}function yp(e){let t=e.match(vp);if(t){let[e,n,r]=t,i=Math.floor(Number(r));if(!isNaN(i)&&isFinite(i))return{workCode:n,panoIndex:i}}throw Error(`Invalid PanoId`)}function bp(e,t){return Z(e)===Z(t)}function xp(e){return typeof e==`string`&&vp.test(e)}var Sp=`\\{([^\\}]+)\\}`;function Cp(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function wp(e){return RegExp(`^`+e.map(e=>Cp(e)).join(`(.+)`)+`$`)}var Tp=class{constructor(e){this.strings=[],this.keys=[];let t=new RegExp(Sp,`g`),n,r=0;for(;(n=t.exec(e))!==null;)this.strings.push(e.slice(r,n.index)),this.keys.push(n[1]),r=n.index+n[0].length;this.strings.push(e.slice(r))}stringify(e){let t=[this.strings[0]];for(let n=0;n<this.keys.length;n++){let r=e[this.keys[n]];t.push(String(r),this.strings[n+1])}return t.join(``)}match(e){var t;this.matchRegexp=(t=this.matchRegexp)==null?wp(this.strings):t;let n=e.match(this.matchRegexp);if(!n)return null;let r={};for(let e=0;e<this.keys.length;e++){let t=this.keys[e],i=n[e+1];if(r[t]!==i){if(r[t]!==void 0)return null;r[t]=i}}return r}};function Ep(e){Object.freeze(e);let t=typeof e==`function`,n=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(e).forEach(function(r){n.call(e,r)&&(!t||r!==`caller`&&r!==`callee`&&r!==`arguments`)&&e[r]!==null&&(typeof e[r]==`object`||typeof e[r]==`function`)&&!Object.isFrozen(e[r])&&Ep(e[r])}),e}var Dp=/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/i,Op=Ep(JSON.parse(function(...e){return arguments[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}(`h/y|pnyu|/9/xr;p|z/9/yvn{wvn;p|z/9/rnyrr;p|z/9/rnyrr;p{/9/rnyrr;w}/9/uv;p|z/9/uv;p{/9/rnyrr;p{/9/rnyrr;p|z/9/ywpq{;p|z/9/rnyrr:pq{;p|z/9/rnyrr:pq{;p{/9/rnyrr;nv/9/;p{/9/pq{;p{/9/pnyp{|qr;vr/j`))),kp=/^([^.]+)(\.([^.]+))*$/,Ap=typeof location<`u`?location.hostname:`localhost`;function jp(e){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(e)}function Mp(e,t){if(!kp.test(e)||!kp.test(t))return!1;if(e===`*`)return!0;let n=e.split(`.`).reverse(),r=t.split(`.`).reverse();if(n.length<=1)return e===t;for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0}function Np(e){if(/^blob\:/i.test(e)||/^data\:/i.test(e))return Ap;let t=e.match(Dp);return t?t[2]:Ap}var Pp=()=>Error(`Invalid input.`),Fp=()=>Error(`Invalid certificate.`),Ip=()=>Error(`Invalid signature.`),Lp=e=>Error(`Date(${e.toString()}) expired.`),Rp=e=>Error(`Host(${JSON.stringify(e)}) is not allowed.`);function zp(e,t){let n={};for(let r of Object.keys(e))t.indexOf(r)===-1&&(n[r]=e[r]);return n}function Bp(e,t=!1){let n=typeof e;if(n===`string`)return JSON.stringify(e);if(e===!0)return`true`;if(e===!1)return`false`;if(e===null)return`null`;if(e instanceof Array){let t=`[`,n=e.length-1,r=0;for(;r<n;r++)t+=Bp(e[r],!1)+`,`;return n>-1&&(t+=Bp(e[r],!1)),t+`]`}if(e instanceof Object){if(typeof e.toJSON==`function`)return Bp(e.toJSON(),t);let n=Object.keys(e).sort(),r=n.length,i=``,a=0;for(;a<r;){let t=n[a],r=Bp(e[t],!0);r!==void 0&&(a&&i!==``&&(i+=`,`),i+=JSON.stringify(t)+`:`+r),a++}return`{`+i+`}`}switch(n){case`function`:case`undefined`:return t?void 0:null;case`number`:return 0;default:return isFinite(e)?e:null}}function Vp(e){return String(Bp(e,!1))}function Hp(e){var t,n,r;let i={};try{i=typeof e==`string`?JSON.parse(e):e}catch(e){return Pp()}if(typeof i!=`object`)return Pp();let a=Ap,o=Date.now(),s=new Date(typeof i.expire_at==`string`&&/^\d+$/.test(i.expire_at)?Number(i.expire_at):i.expire_at),c=Array.isArray(i.allow_hosts)?i.allow_hosts:[];if(a.length===0||jp(a)||Op.filter(e=>Mp(e,a)).length>0){let e=String((t=i.certificate)==null?``:t);if(e)try{let t=new z;return t.readCertPEM(e),Ep({issuer:t.getSubjectString(),expire:s,allowHosts:c})}catch(e){let t=e instanceof Error?e.message:String(e);console.warn(`[PARSE Error]: Invalid Certificate. `+t)}return Ep({issuer:`none`,expire:s,allowHosts:c})}let l=String((n=i.certificate)==null?``:n);if(!l)return Fp();let u=new z;u.readCertPEM(l);let d=String((r=i._signature)==null?``:r);return!d||Ct(Vp(zp(i,[`_signature`])),d,u)===!1?Ip():o<s.getTime()?Op.concat(c).filter(e=>Mp(e,a)).length===0?Rp(a):Ep({issuer:u.getSubjectString(),expire:s,allowHosts:c}):Lp(s)}function Up(e,t){let n=Np(e);return Ap.length!==0&&!jp(Ap)&&Op.filter(e=>Mp(e,Ap)).length===0&&!jp(n)&&Op.concat(t).filter(e=>Mp(e,n)).length===0?Rp(n):e}var Wp=new Set,Gp=new c.Vector3(1,1,1),Kp=[`right`,`left`,`up`,`down`,`front`,`back`];function qp(e,t){if(!Sr(e))return e;if(e.indexOf(t)===0)return e.slice(t.length);let n=t.replace(/^https\:/,`http:`);if(e.indexOf(n)===0)return e.slice(n.length);let r=t.replace(/^http\:/,`https:`);return e.indexOf(r)===0?e.slice(r.length):(console.warn(`${e} is not start with base_url(${t}).`),e)}function Jp(e,t,n){return!Sr(e)&&typeof t==`string`&&t.length>0&&(e=wr(t,String(n),e)),e}function Yp(e){for(let t=10;t>=0;t--)if(512*Math.pow(2,t)<=e)return t;return null}function Xp(e){e=e.slice().sort((e,t)=>e.level-t.level);let t=[];for(let n of e){if(t.length===0){t.push(n);continue}let e=t[t.length-1];if(n.level>e.level){t.push(n);continue}if(n.size>e.size){t[t.length-1]=n;continue}}return t}function Zp(e,t){var n,r,i,a,o,s,l,u,d,f,p,m,h,g,_,v,y,b,x;let S=[],C=null;for(let t of[].concat(e))if(`getURL`in t)C={allowHosts:t.allowHosts,expire:t.expire,issuer:t.issuer},S.push(sp(t));else{let e=typeof t==`string`?JSON.parse(t):fp(t),n=Hp(e);if(n instanceof Error)return n;C===null&&(C=n),S.push(e)}if(C===null)return Error(`Empty`);V(t,`issuer`,{enumerable:!0,configurable:!1,writable:!1,value:C.issuer}),V(t,`expire`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(C.expire)}),V(t,`allowHosts`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(C.allowHosts)});let w=S.reduce((e,t)=>mp(e,t));V(t,`name`,{enumerable:!0,configurable:!1,writable:!1,value:String((n=w.name)==null?`Unknown`:n)}),V(t,`workCode`,{enumerable:!0,writable:!0,value:String(w.resource_code||w.basic_code||w.vr_code||w.code||w.project_id||w.work_code||w.workCode||rn())}),V(t,`projectId`,{enumerable:!0,writable:!0,value:w.project_id}),V(t,`baseURL`,{enumerable:!0,writable:!0,value:(()=>{var e;let t=(e=w.base_url)==null?``:e;return t&&t[t.length-1]!==`/`&&(t+=`/`),t})()});let T;typeof w.model==`object`&&(T={},V(T,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),V(T,`file`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e=w.model.file_url;if(e)return qp(e,t.baseURL)})()}),V(T,`textureBase`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e=w.model.material_base_url;return e&&(e=qp(e,t.baseURL)),e})()}),V(T,`textures`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e;return Array.isArray(w.model.material_textures)&&(e=w.model.material_textures.slice(),Object.freeze(e)),e})()}),V(T,`upAxis`,{enumerable:!0,configurable:!1,writable:!1,value:w.model.up_axis}),V(T,`coordinate`,{enumerable:!0,configurable:!1,writable:!1,value:fp(w.model.coordinate)}),V(T,`layers`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{var e,n,r;let i=[];if(Array.isArray(w.model.layers)){for(let a of w.model.layers)if(a&&a.tileset_url){let o={};V(o,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),V(o,`name`,{enumerable:!0,configurable:!1,writable:!1,value:(e=a.name)==null?``:e}),V(o,`type`,{enumerable:!0,configurable:!1,writable:!1,value:(n=a.type)==null?`mesh`:n}),V(o,`upAxis`,{enumerable:!0,configurable:!1,writable:!1,value:(r=a.up_axis)==null?`Z`:r}),V(o,`tileset`,{enumerable:!0,configurable:!1,writable:!1,value:qp(a.tileset_url,t.baseURL)}),i.push(o)}}if(typeof w.model.tiles==`object`){let e=w.model.tiles;if(e&&e.tileset_url){let n={};V(n,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),V(n,`name`,{enumerable:!0,configurable:!1,writable:!1,value:`lod`}),V(n,`type`,{enumerable:!0,configurable:!1,writable:!1,value:`mesh`}),V(n,`upAxis`,{enumerable:!0,configurable:!1,writable:!1,value:`-Y`}),V(n,`tileset`,{enumerable:!0,configurable:!1,writable:!1,value:qp(e.tileset_url,t.baseURL)}),i.push(n)}}return Object.freeze(i)})()})),V(t,`model`,{enumerable:!0,configurable:!1,writable:!1,value:T});let E=[];if(Array.isArray(w.observers)&&w.panorama&&Array.isArray(w.panorama.list||w.panorama.info)){let e=w.observers,n=(r=w.panorama.list||w.panorama.info)==null?[]:r,S=(u=(s=(a=(i=w.panorama)==null?void 0:i.pano_high_cube_base_url)==null?(o=w.panorama)==null?void 0:o.pano_cube_base_url:a)==null?(l=w.panorama)==null?void 0:l.base_url:s)==null?``:u,C=Math.min(e.length,n.length),T={};for(let e of Object.keys((d=w.panorama.pattern)==null?{}:d)){let t=e,n=w.panorama.pattern[t];if(typeof n==`string`){let e=new Tp(n);T[t]=t=>e.stringify(t)}else T[t]=()=>n}let D=(e,t)=>{var n;let r=T[t];return(n=e[t])==null?r?r(e):void 0:n};for(let r=0;r<C;r++){let i=e[r],a=n[r],o=Object.create(up);V(o,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),V(o,`index`,{enumerable:!0,configurable:!1,writable:!1,value:r}),V(o,`panoIndex`,{enumerable:!0,configurable:!1,writable:!1,value:r}),V(o,`panoId`,{enumerable:!0,configurable:!1,writable:!1,value:Z({workCode:t.workCode,panoIndex:r})}),V(o,`floorIndex`,{enumerable:!0,configurable:!1,writable:!1,value:(f=i.floor_index)==null?i.floor:f}),V(o,`derivedId`,{enumerable:!0,configurable:!1,writable:!1,value:(m=(p=i.derived_id)==null?D(a,`derived_id`):p)==null?0:m}),V(o,`derivedIdStr`,{enumerable:!0,configurable:!1,writable:!1,value:(g=(h=i.derived_id_str)==null?D(a,`derived_id_str`):h)==null?String(o.derivedId):g}),V(o,`active`,{enumerable:!0,configurable:!1,writable:!1,value:i.active!==!1&&D(a,`active`)!==!1}),V(o,`loadable`,{enumerable:!0,configurable:!1,writable:!1,value:(v=(_=i.loadable)==null?D(a,`loadable`):_)==null?!1:v}),V(o,`position`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new c.Vector3().fromArray((y=i.position)==null?[0,0,0]:y))}),V(o,`standingPosition`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new c.Vector3().fromArray((x=(b=i.standing_position)==null?i.standingPosition:b)==null?[0,0,0]:x))}),V(o,`quaternion`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new c.Quaternion().fromArray(i.quaternion?[i.quaternion.x,i.quaternion.y,i.quaternion.z,i.quaternion.w]:[0,0,0,1]))}),V(o,`matrix`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new c.Matrix4().compose(o.position,o.quaternion,Gp))}),V(o,`accessibleNodes`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{if(Wp.clear(),i.accessible_nodes&&Array.isArray(i.accessible_nodes))for(let e of i.accessible_nodes)e>=C||e===r||Wp.add(e);else if(i.accessibleNodes&&Array.isArray(i.accessibleNodes))for(let e of i.accessibleNodes)e>=C||e===r||Wp.add(e);else if(i.visible_nodes&&Array.isArray(i.visible_nodes))for(let e of i.visible_nodes)e>=C||e===r||Wp.add(e);else if(i.visibleNodes&&Array.isArray(i.visibleNodes))for(let e of i.visibleNodes)e>=C||e===r||Wp.add(e);if(Wp.size===0)for(let e=0;e<C;e++)e!==r&&Wp.add(e);let e=Array.from(Wp);return Wp.clear(),Object.freeze(e)})()}),V(o,`visibleNodes`,{enumerable:!0,configurable:!1,writable:!1,value:o.accessibleNodes}),V(o,`images`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e={};V(e,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t});for(let n of Kp)V(e,n,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{var e;return qp(Jp((e=D(a,n))==null?``:e,S,r),t.baseURL)})()});return V(e,`sizeList`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let t=$r(e[Kp[0]]),n=D(a,`size_list`),r=D(a,`tiles`);if(t){if(n){let e=n.slice().sort((e,t)=>e-t);return Object.freeze(e)}else if(r){let e=[t],n=r.slice().sort((e,t)=>e-t);for(let r of n){let n=512*Math.pow(2,r);n>t&&e.push(n)}return Object.freeze(e)}return Object.freeze([t])}return Object.freeze([])})()}),V(e,`tiles`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let n=$r(e.front);if(!n)return;let r=e.sizeList.slice();if(r[0]){let e=Yp(r[0]);if(e)for(let t=e-1;t>=0;t--)r.unshift(512*Math.pow(2,t))}if(r.length<=0)return;let i=[];for(let a of r){let r=Yp(a);if(typeof r!=`number`)continue;let o={};if(V(o,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),V(o,`level`,{enumerable:!0,configurable:!1,writable:!1,value:r}),a>n){V(o,`size`,{enumerable:!0,configurable:!1,writable:!1,value:a}),V(o,`scale`,{enumerable:!0,configurable:!1,writable:!1,value:1});for(let t of Kp)V(o,t,{enumerable:!0,configurable:!1,writable:!1,value:ei(e[t],a)})}else{V(o,`size`,{enumerable:!0,configurable:!1,writable:!1,value:n}),V(o,`scale`,{enumerable:!0,configurable:!1,writable:!1,value:a/n});for(let t of Kp)V(o,t,{enumerable:!0,configurable:!1,writable:!1,value:e[t]})}i.push(o)}return i=Xp(i),Object.freeze(i)})()}),V(e,`video`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e=D(a,`video`),n;return e&&(n={},V(n,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),V(n,`source`,{enumerable:!0,configurable:!1,writable:!1,value:e.source}),V(n,`matrix`,{enumerable:!0,configurable:!1,writable:!1,value:new c.Matrix4().fromArray(e.matrix)}),V(n,`size`,{enumerable:!0,configurable:!1,writable:!1,value:new c.Vector2().fromArray(e.size)})),n})()}),e})()}),E.push(o)}}V(t,`observers`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(E)});let D={};if(V(D,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),w.initial){if(t.observers.length>0){let e;dp(w.initial.panoIndex)?e=w.initial.panoIndex:dp(w.initial.pano_index)?e=w.initial.pano_index:dp(w.initial.pano)&&(e=w.initial.pano),typeof e==`number`&&(e=U(e,0,t.observers.length-1),V(D,`panoIndex`,{enumerable:!0,writable:!0,value:e}))}if(w.initial.mode===`Panorama`&&t.observers.length===0||w.initial.mode===`Floorplan`||w.initial.mode===`Topview`||w.initial.mode===`Model`||w.initial.mode===`Mapview`?V(D,`mode`,{enumerable:!0,writable:!0,value:w.initial.mode}):typeof D.panoIndex==`number`?V(D,`mode`,{enumerable:!0,writable:!0,value:`Panorama`}):V(D,`mode`,{enumerable:!0,writable:!0,value:`Mapview`}),dp(w.initial.latitude)&&V(D,`latitude`,{enumerable:!0,writable:!0,value:w.initial.latitude}),dp(w.initial.longitude)?V(D,`longitude`,{enumerable:!0,writable:!0,value:w.initial.longitude}):dp(w.initial.heading)&&V(D,`longitude`,{enumerable:!0,writable:!0,value:Gt(w.initial.heading)}),dp(w.initial.fov)&&V(D,`fov`,{enumerable:!0,writable:!0,value:w.initial.fov}),dp(w.initial.distance)&&V(D,`distance`,{enumerable:!0,writable:!0,value:w.initial.distance}),Array.isArray(w.initial.offset)){let e=w.initial.offset,t=[0,0,0].map((t,n)=>{let r=Number(e[n]);return isNaN(r)||!isFinite(r)?0:r});V(D,`offset`,{enumerable:!0,writable:!0,value:new c.Vector3().fromArray(t)})}else typeof w.initial.offset==`object`&&typeof w.initial.offset.x==`number`&&typeof w.initial.offset.y==`number`&&typeof w.initial.offset.z==`number`&&V(D,`offset`,{enumerable:!0,writable:!0,value:new c.Vector3().fromArray([w.initial.offset.x,w.initial.offset.y,w.initial.offset.z])})}return V(t,`initial`,{enumerable:!0,configurable:!1,writable:!1,value:D}),t}function Qp(e,t){return V(t,`issuer`,{enumerable:!0,configurable:!1,writable:!1,value:`null`}),V(t,`expire`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new Date)}),V(t,`allowHosts`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([`*`])}),V(t,`name`,{enumerable:!0,configurable:!1,writable:!1,value:`Null`}),V(t,`workCode`,{enumerable:!0,value:`null-`+rn()}),V(t,`baseURL`,{enumerable:!0,value:`/`}),V(t,`model`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),V(t,`observers`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([])}),V(t,`initial`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e={};return V(e,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),V(e,`mode`,{enumerable:!0,writable:!0,value:`Mapview`}),e})()}),t}function $p(e,t){var n,r;return V(t,`issuer`,{enumerable:!0,configurable:!1,writable:!1,value:`null`}),V(t,`expire`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new Date)}),V(t,`allowHosts`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([`*`])}),V(t,`name`,{enumerable:!0,configurable:!1,writable:!1,value:String((n=e.name)==null?`Unknown`:n)}),V(t,`workCode`,{enumerable:!0,writable:!0,value:(r=e.code)==null?rn():r}),V(t,`baseURL`,{enumerable:!0,writable:!0,value:`/`}),V(t,`model`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),V(t,`observers`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let n={};return V(n,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),V(n,`index`,{enumerable:!0,configurable:!1,writable:!1,value:0}),V(n,`panoIndex`,{enumerable:!0,configurable:!1,writable:!1,value:0}),V(n,`panoId`,{enumerable:!0,configurable:!1,writable:!1,value:Z({workCode:t.workCode,panoIndex:0})}),V(n,`floorIndex`,{enumerable:!0,configurable:!1,writable:!1,value:0}),V(n,`derivedId`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),V(n,`derivedIdStr`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),V(n,`active`,{enumerable:!0,configurable:!1,writable:!1,value:!0}),V(n,`loadable`,{enumerable:!0,configurable:!1,writable:!1,value:!1}),V(n,`position`,{enumerable:!0,configurable:!1,writable:!1,value:new c.Vector3(0,1.5,0)}),V(n,`standingPosition`,{enumerable:!0,configurable:!1,writable:!1,value:new c.Vector3(0,0,0)}),V(n,`quaternion`,{enumerable:!0,configurable:!1,writable:!1,value:new c.Quaternion(0,1,0,0)}),V(n,`matrix`,{enumerable:!0,configurable:!1,writable:!1,value:new c.Matrix4().compose(n.position,n.quaternion,Gp)}),V(n,`accessibleNodes`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([])}),V(n,`visibleNodes`,{enumerable:!0,configurable:!1,writable:!1,value:n.accessibleNodes}),V(n,`images`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let n={};V(n,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t});for(let t of Kp)V(n,t,{enumerable:!0,configurable:!1,writable:!1,value:e[t]});return V(n,`sizeList`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([e.size])}),V(n,`tiles`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e=$r(n.front);if(!e)return;let r=n.sizeList.slice();if(r[0]){let e=Yp(r[0]);if(e)for(let t=e-1;t>=0;t--)r.unshift(512*Math.pow(2,t))}if(r.length<=0)return;let i=[];for(let a of r){let r=Yp(a);if(typeof r!=`number`)continue;let o={};if(V(o,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),V(o,`level`,{enumerable:!0,configurable:!1,writable:!1,value:r}),a>e){V(o,`size`,{enumerable:!0,configurable:!1,writable:!1,value:a}),V(o,`scale`,{enumerable:!0,configurable:!1,writable:!1,value:1});for(let e of Kp)V(o,e,{enumerable:!0,configurable:!1,writable:!1,value:ei(n[e],a)})}else{V(o,`size`,{enumerable:!0,configurable:!1,writable:!1,value:e}),V(o,`scale`,{enumerable:!0,configurable:!1,writable:!1,value:a/e});for(let e of Kp)V(o,e,{enumerable:!0,configurable:!1,writable:!1,value:n[e]})}i.push(o)}return i=Xp(i),Object.freeze(i)})()}),V(n,`video`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),n})()}),Object.freeze([n])})()}),V(t,`initial`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e={};return V(e,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),V(e,`mode`,{enumerable:!0,writable:!0,value:`Panorama`}),V(e,`panoIndex`,{enumerable:!0,writable:!0,value:0}),e})()}),t}var em=new WeakSet,tm=class{constructor(e,t){this.observerBox=new c.Box3,this.observerBox=new c.Box3,this.transform=new c.Matrix4,this.shortPath=!1,this.jsonp=!1;let n;if(n=e===null?Qp(e,this):typeof e==`object`&&typeof e.size==`number`&&typeof e.up==`string`&&typeof e.down==`string`&&typeof e.right==`string`&&typeof e.left==`string`&&typeof e.front==`string`&&typeof e.back==`string`?$p(e,this):Zp(e,this),n instanceof Error)throw Error(`[PARSE FAILED]: `+n.message+`
939
939
  Error work input:
940
- `+JSON.stringify(e));Zp.add(this);for(let e of this.observers)this.observerBox.expandByPoint(e.position),this.observerBox.expandByPoint(e.standingPosition);t.baseURL&&(this.baseURL=t.baseURL),t.transform&&(Array.isArray(t.transform)?this.transform.fromArray(t.transform):this.transform.copy(t.transform)),typeof t.jsonp==`boolean`&&(this.jsonp=t.jsonp),typeof t.shortPath==`boolean`&&(this.shortPath=t.shortPath),t.workCode&&(typeof t.workCode==`string`?this.workCode=t.workCode:typeof t.workCode==`function`&&(this.workCode=t.workCode(e)));{let e=this;this.options={get transform(){return e.transform}},this.raw={get works(){return[JSON.stringify(ip(e))]}}}}getURL(e){var t;if(!Sr(e)){if(this.jsonp===!0){e=e.replace(/([\?\#].*)?$/i,``);let t=_t(`${e}`).slice(0,7);e=`${e}.${t}.jsonp`}if(this.shortPath===!0){let n=e.replace(e,``).split(`.`),r=(t=n.shift())==null?``:t,i=n.join(`.`);e=_t(r)+(i?`.`+i:``)}e=wr(this.baseURL,e)}return e=Cr(e),e}verifyURL(e){return typeof Bp(this.getURL(e),this.allowHosts)==`string`}toJSON(){return ip(this)}};Qp.parse=$p;function $p(e,t){typeof e==`string`&&e.trim()[0]===`{`&&(e=JSON.parse(e));try{return new Qp(e,t==null?{}:t)}catch(t){console.log(t);let n=t instanceof Error?t.message:String(t);throw Error(`[PARSE Error]: `+n+`
940
+ `+JSON.stringify(e));em.add(this);for(let e of this.observers)this.observerBox.expandByPoint(e.position),this.observerBox.expandByPoint(e.standingPosition);t.baseURL&&(this.baseURL=t.baseURL),t.transform&&(Array.isArray(t.transform)?this.transform.fromArray(t.transform):this.transform.copy(t.transform)),typeof t.jsonp==`boolean`&&(this.jsonp=t.jsonp),typeof t.shortPath==`boolean`&&(this.shortPath=t.shortPath),t.workCode&&(typeof t.workCode==`string`?this.workCode=t.workCode:typeof t.workCode==`function`&&(this.workCode=t.workCode(e)));{let e=this;this.options={get transform(){return e.transform}},this.raw={get works(){return[JSON.stringify(sp(e))]}}}}getURL(e){var t;if(!Sr(e)){if(this.jsonp===!0){e=e.replace(/([\?\#].*)?$/i,``);let t=_t(`${e}`).slice(0,7);e=`${e}.${t}.jsonp`}if(this.shortPath===!0){let n=e.replace(e,``).split(`.`),r=(t=n.shift())==null?``:t,i=n.join(`.`);e=_t(r)+(i?`.`+i:``)}e=wr(this.baseURL,e)}return e=Cr(e),e}verifyURL(e){return typeof Up(this.getURL(e),this.allowHosts)==`string`}toJSON(){return sp(this)}};tm.parse=nm;function nm(e,t){typeof e==`string`&&e.trim()[0]===`{`&&(e=JSON.parse(e));try{return new tm(e,t==null?{}:t)}catch(t){console.log(t);let n=t instanceof Error?t.message:String(t);throw Error(`[PARSE Error]: `+n+`
941
941
  Error work input:
942
- `+JSON.stringify(e))}}var em=new c.Matrix4,tm=class{constructor(e){this.isResolved=!0,this.work=e.work,this.index=e.index,this.panoIndex=e.panoIndex,this.pano={panoIndex:e.panoIndex,workCode:e.work.workCode},this.panoId=Z({panoIndex:e.panoIndex,workCode:e.work.workCode}),this.floorIndex=e.floorIndex,this.derivedId=e.derivedId,this.derivedIdStr=e.derivedIdStr,this.active=e.active,this.loadable=e.loadable,this.images=e.images,this.accessibleNodes=e.accessibleNodes,this.accessibleIds=e.accessibleNodes.map(t=>Z({panoIndex:t,workCode:e.work.workCode})),this.visibleNodes=this.accessibleNodes,this.visibleIds=this.accessibleIds,this.position=new c.Vector3().copy(e.position).applyMatrix4(e.work.transform),this.standingPosition=new c.Vector3().copy(e.standingPosition).applyMatrix4(e.work.transform),this.quaternion=new c.Quaternion().setFromRotationMatrix(em.makeRotationFromQuaternion(e.quaternion).premultiply(e.work.transform)),this.matrix=new c.Matrix4().copy(e.matrix).premultiply(e.work.transform)}};function nm(e){let t=new Set;for(let n of e){if(t.has(n.workCode))throw Error(`WorkCode:${n.workCode} duplicated.`);t.add(n.workCode)}t.clear();let n=e.map(e=>{if(Zp.has(e))return e;{let t=$p(null);return t.workCode=e.workCode,t}});return Object.freeze(Object.assign(n,{get initial(){var e;return(e=n[0])==null?void 0:e.initial},getWork(e){for(let t of n)if(t.workCode===e)return t},getObserver(e){var t,r;let i=(t=n[0])==null?void 0:t.workCode,a=0;if(vp(e)){let t=gp(e);i=t.workCode,a=t.panoIndex}else typeof e==`number`?a=e:(i=e.workCode,a=e.panoIndex);return(r=this.getWork(i))==null?void 0:r.observers[a]},getResolvedObserver(e){let t=this.getObserver(e);if(t)return new tm(t)},toJSON(){return this.map(e=>({work:ip(e),transform:e.transform.toArray()}))}}))}var rm=class{constructor(){this.status={endabledPassNumber:0,needsColorGBuffer:!1,needsDepthGBuffer:!1,needsNormalGBuffer:!1,version:`0|false|false|false`},this.gbuffer=new Map;let e={type:c.UnsignedByteType,generateMipmaps:!1,minFilter:c.LinearFilter,magFilter:c.LinearFilter,format:c.RGBAFormat,depthBuffer:!0,stencilBuffer:!0};this.renderTarget1=new c.WebGLRenderTarget(1,1,e),this.renderTarget1.texture.name=`EffectComposer.rt1`,this.renderTarget2=new c.WebGLRenderTarget(1,1,e),this.renderTarget2.texture.name=`EffectComposer.rt2`,this.readBuffer=this.renderTarget1,this.writeBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.normalMaterial=new c.MeshNormalMaterial({flatShading:!0}),this.clock=new c.Clock}swapBuffers(){let e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e)}insertPass(e,t){this.passes.splice(t,0,e)}render(e){let t=!1;this.renderTarget1.texture.encoding=e.outputEncoding,this.renderTarget2.texture.encoding=e.outputEncoding;let n=this.clock.getDelta(),r=this.passes.filter(e=>e.enabled);for(let i=0;i<r.length;i++){let a=r[i],o=i===r.length-1;a.renderToScreen=this.renderToScreen&&o,a.renderToScreen&&(t=!0),a.gbuffer=this.gbuffer,a.render(e,this.writeBuffer,this.readBuffer,n,!1),a.gbuffer=null,a.needsSwap&&this.swapBuffers()}return t}setSize(e,t){this.renderTarget1.setSize(e,t),this.renderTarget2.setSize(e,t);for(let n=0;n<this.passes.length;n++)this.passes[n].setSize(e,t)}updateStatus(){let e=this.passes.filter(e=>e.enabled),t=!1,n=!1,r=!1;for(let i of e)`dependencies`in i&&Array.isArray(i.dependencies)&&(t===!1&&(t=i.dependencies.indexOf(`color`)>=0),n===!1&&(n=i.dependencies.indexOf(`depth`)>=0),r===!1&&(r=i.dependencies.indexOf(`normal`)>=0));let i=e.length;this.status.endabledPassNumber=i,this.status.needsColorGBuffer=t,this.status.needsDepthGBuffer=n,this.status.needsNormalGBuffer=r,this.status.version=`${i}|${t}|${n}|${r}`}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose()}},im=class e{constructor(t){this._scene=new c.Scene,this._mesh=new c.Mesh(e.geometry,t),this._scene.add(this._mesh)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}dispose(){this._mesh.geometry.dispose(),this._scene.dispose()}render(t){t.render(this._scene,e.camera)}};im.camera=new c.OrthographicCamera(-1,1,1,-1,0,1),im.geometry=new c.PlaneBufferGeometry(2,2,1,1);var am=class{constructor(e){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!0,this.dependencies=e==null?[]:e}setSize(e,t){}render(e,t,n,r,i){}dispose(){}};am.FullScreenQuad=im;var om=new c.ShaderMaterial({uniforms:{tDiffuse:{value:null},opacity:{value:1},scaleY:{value:1}},vertexShader:`
942
+ `+JSON.stringify(e))}}var rm=new c.Matrix4,im=class{constructor(e){this.isResolved=!0,this.work=e.work,this.index=e.index,this.panoIndex=e.panoIndex,this.pano={panoIndex:e.panoIndex,workCode:e.work.workCode},this.panoId=Z({panoIndex:e.panoIndex,workCode:e.work.workCode}),this.floorIndex=e.floorIndex,this.derivedId=e.derivedId,this.derivedIdStr=e.derivedIdStr,this.active=e.active,this.loadable=e.loadable,this.images=e.images,this.accessibleNodes=e.accessibleNodes,this.accessibleIds=e.accessibleNodes.map(t=>Z({panoIndex:t,workCode:e.work.workCode})),this.visibleNodes=this.accessibleNodes,this.visibleIds=this.accessibleIds,this.position=new c.Vector3().copy(e.position).applyMatrix4(e.work.transform),this.standingPosition=new c.Vector3().copy(e.standingPosition).applyMatrix4(e.work.transform),this.quaternion=new c.Quaternion().setFromRotationMatrix(rm.makeRotationFromQuaternion(e.quaternion).premultiply(e.work.transform)),this.matrix=new c.Matrix4().copy(e.matrix).premultiply(e.work.transform)}};function am(e){let t=new Set;for(let n of e){if(t.has(n.workCode))throw Error(`WorkCode:${n.workCode} duplicated.`);t.add(n.workCode)}t.clear();let n=e.map(e=>{if(em.has(e))return e;{let t=nm(null);return t.workCode=e.workCode,t}});return Object.freeze(Object.assign(n,{get initial(){var e;return(e=n[0])==null?void 0:e.initial},getWork(e){for(let t of n)if(t.workCode===e)return t},getObserver(e){var t,r;let i=(t=n[0])==null?void 0:t.workCode,a=0;if(xp(e)){let t=yp(e);i=t.workCode,a=t.panoIndex}else typeof e==`number`?a=e:(i=e.workCode,a=e.panoIndex);return(r=this.getWork(i))==null?void 0:r.observers[a]},getResolvedObserver(e){let t=this.getObserver(e);if(t)return new im(t)},toJSON(){return this.map(e=>({work:sp(e),transform:e.transform.toArray()}))}}))}var om=class{constructor(){this.status={endabledPassNumber:0,needsColorGBuffer:!1,needsDepthGBuffer:!1,needsNormalGBuffer:!1,version:`0|false|false|false`},this.gbuffer=new Map;let e={type:c.UnsignedByteType,generateMipmaps:!1,minFilter:c.LinearFilter,magFilter:c.LinearFilter,format:c.RGBAFormat,depthBuffer:!0,stencilBuffer:!0};this.renderTarget1=new c.WebGLRenderTarget(1,1,e),this.renderTarget1.texture.name=`EffectComposer.rt1`,this.renderTarget2=new c.WebGLRenderTarget(1,1,e),this.renderTarget2.texture.name=`EffectComposer.rt2`,this.readBuffer=this.renderTarget1,this.writeBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.normalMaterial=new c.MeshNormalMaterial({flatShading:!0}),this.clock=new c.Clock}swapBuffers(){let e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e)}insertPass(e,t){this.passes.splice(t,0,e)}render(e){let t=!1;this.renderTarget1.texture.encoding=e.outputEncoding,this.renderTarget2.texture.encoding=e.outputEncoding;let n=this.clock.getDelta(),r=this.passes.filter(e=>e.enabled);for(let i=0;i<r.length;i++){let a=r[i],o=i===r.length-1;a.renderToScreen=this.renderToScreen&&o,a.renderToScreen&&(t=!0),a.gbuffer=this.gbuffer,a.render(e,this.writeBuffer,this.readBuffer,n,!1),a.gbuffer=null,a.needsSwap&&this.swapBuffers()}return t}setSize(e,t){this.renderTarget1.setSize(e,t),this.renderTarget2.setSize(e,t);for(let n=0;n<this.passes.length;n++)this.passes[n].setSize(e,t)}updateStatus(){let e=this.passes.filter(e=>e.enabled),t=!1,n=!1,r=!1;for(let i of e)`dependencies`in i&&Array.isArray(i.dependencies)&&(t===!1&&(t=i.dependencies.indexOf(`color`)>=0),n===!1&&(n=i.dependencies.indexOf(`depth`)>=0),r===!1&&(r=i.dependencies.indexOf(`normal`)>=0));let i=e.length;this.status.endabledPassNumber=i,this.status.needsColorGBuffer=t,this.status.needsDepthGBuffer=n,this.status.needsNormalGBuffer=r,this.status.version=`${i}|${t}|${n}|${r}`}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose()}},sm=class e{constructor(t){this._scene=new c.Scene,this._mesh=new c.Mesh(e.geometry,t),this._scene.add(this._mesh)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}dispose(){this._mesh.geometry.dispose(),this._scene.dispose()}render(t){t.render(this._scene,e.camera)}};sm.camera=new c.OrthographicCamera(-1,1,1,-1,0,1),sm.geometry=new c.PlaneBufferGeometry(2,2,1,1);var cm=class{constructor(e){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!0,this.dependencies=e==null?[]:e}setSize(e,t){}render(e,t,n,r,i){}dispose(){}};cm.FullScreenQuad=sm;var lm=new c.ShaderMaterial({uniforms:{tDiffuse:{value:null},opacity:{value:1},scaleY:{value:1}},vertexShader:`
943
943
  varying vec2 vUv;
944
944
  void main() {
945
945
  vUv = uv;
@@ -954,7 +954,7 @@ void main() {
954
954
  vec4 diffuse = texture2D(tDiffuse, vUv * vec2(1.0, scaleY));
955
955
  gl_FragColor = vec4(diffuse.rgb, diffuse.a * opacity);
956
956
  }
957
- `,transparent:!0,depthTest:!1,depthWrite:!1}),sm=new im(om),cm=new c.ShaderMaterial({uniforms:{color:{value:new c.Color},opacity:{value:1}},vertexShader:`
957
+ `,transparent:!0,depthTest:!1,depthWrite:!1}),um=new sm(lm),dm=new c.ShaderMaterial({uniforms:{color:{value:new c.Color},opacity:{value:1}},vertexShader:`
958
958
  void main() {
959
959
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
960
960
  }
@@ -964,7 +964,7 @@ uniform float opacity;
964
964
  void main() {
965
965
  gl_FragColor = vec4(color, opacity);
966
966
  }
967
- `,transparent:!0,depthTest:!1,depthWrite:!1}),lm=new im(cm);function um(e,t,n=!1,r=1){t instanceof c.Texture?(om.uniforms.tDiffuse.value=t,om.uniforms.opacity.value=r,om.uniforms.scaleY.value=n?-1:1,sm.render(e),om.uniforms.tDiffuse.value=null):(cm.uniforms.color.value.copy(t),cm.uniforms.opacity.value=r,lm.render(e))}var dm=256,fm=128,pm={width:dm,height:fm,data:new Uint8ClampedArray(dm*fm*4)},mm=256,hm=new Uint32Array(mm);function gm(e,t={peak:0,mean:0,min:0,max:0}){let n=0,r=0;for(let e=1;e<mm;e++)hm[e]=0;for(let t=0;t<e.length;t++){let i=e[t],a=i.type===`rgb`?3:4,o=i.data.length/a;n+=o;let s=i.data;for(let e=0;e<o;e++){let t=e*a,n=s[t],i=s[t+1],o=s[t+2],c=Math.round(.299*n+.587*i+.114*o);hm[c]++,r+=c}}let i=r/n,a=0,o=0;for(let e=1;e<mm;e++)hm[e]>o&&(o=hm[e],a=e);let s=0;for(let e=0;e<mm;e++)if(hm[e]!==0){s=e;break}let c=mm-1;for(let e=c;e>=0;e--)if(hm[e]!==0){c=e;break}return t.peak=a/(mm-1),t.mean=i/255,t.min=s/(mm-1),t.max=c/(mm-1),t}var _m=class{constructor(e,t,n,r){this.peak=e==null?0:e,this.mean=t==null?0:t,this.min=n==null?0:n,this.max=r==null?0:r}formPixels(...e){return gm(e.map(e=>({data:e,type:`rgba`})),this),this}toJSON(){return{peak:this.peak,mean:this.mean,min:this.min,max:this.max}}toArray(){return[this.peak,this.mean,this.min,this.max]}toString(){return this.toArray().join(` `)}},vm=Math.PI,ym=vm*2;function bm(e,t,n){if(e===t)return t;let r=t-e;return Math.abs(r)<=n?t:e+(r>0?1:-1)*n}function xm(e,t,n){if(e.equals(t))return new c.Vector3().copy(t);let r=new c.Vector3().subVectors(t,e);return r.lengthSq()<n*n?r.copy(t):r.setLength(n).add(e)}function Sm(e,t,n){if(e.longitude===t.longitude&&e.latitude===t.latitude)return{longitude:t.longitude,latitude:t.latitude};let r=Vt(e.longitude),i=e.latitude,a=Vt(t.longitude),o=t.latitude;a-r>vm?r+=ym:r-a>vm&&(r-=ym);let s=n/Math.sqrt(Math.pow(a-r,2)+Math.pow(o-i,2));return s>=1?{longitude:t.longitude,latitude:t.latitude}:{longitude:r+(a-r)*s,latitude:i+(o-i)*s}}var Cm=new c.ShaderMaterial({uniforms:{inputBuffer:{value:null},minValue:{value:0},maxValue:{value:1}},vertexShader:`
967
+ `,transparent:!0,depthTest:!1,depthWrite:!1}),fm=new sm(dm);function pm(e,t,n=!1,r=1){t instanceof c.Texture?(lm.uniforms.tDiffuse.value=t,lm.uniforms.opacity.value=r,lm.uniforms.scaleY.value=n?-1:1,um.render(e),lm.uniforms.tDiffuse.value=null):(dm.uniforms.color.value.copy(t),dm.uniforms.opacity.value=r,fm.render(e))}var mm=256,hm=128,gm={width:mm,height:hm,data:new Uint8ClampedArray(mm*hm*4)},_m=256,vm=new Uint32Array(_m);function ym(e,t={peak:0,mean:0,min:0,max:0}){let n=0,r=0;for(let e=1;e<_m;e++)vm[e]=0;for(let t=0;t<e.length;t++){let i=e[t],a=i.type===`rgb`?3:4,o=i.data.length/a;n+=o;let s=i.data;for(let e=0;e<o;e++){let t=e*a,n=s[t],i=s[t+1],o=s[t+2],c=Math.round(.299*n+.587*i+.114*o);vm[c]++,r+=c}}let i=r/n,a=0,o=0;for(let e=1;e<_m;e++)vm[e]>o&&(o=vm[e],a=e);let s=0;for(let e=0;e<_m;e++)if(vm[e]!==0){s=e;break}let c=_m-1;for(let e=c;e>=0;e--)if(vm[e]!==0){c=e;break}return t.peak=a/(_m-1),t.mean=i/255,t.min=s/(_m-1),t.max=c/(_m-1),t}var bm=class{constructor(e,t,n,r){this.peak=e==null?0:e,this.mean=t==null?0:t,this.min=n==null?0:n,this.max=r==null?0:r}formPixels(...e){return ym(e.map(e=>({data:e,type:`rgba`})),this),this}toJSON(){return{peak:this.peak,mean:this.mean,min:this.min,max:this.max}}toArray(){return[this.peak,this.mean,this.min,this.max]}toString(){return this.toArray().join(` `)}},xm=Math.PI,Sm=xm*2;function Cm(e,t,n){if(e===t)return t;let r=t-e;return Math.abs(r)<=n?t:e+(r>0?1:-1)*n}function wm(e,t,n){if(e.equals(t))return new c.Vector3().copy(t);let r=new c.Vector3().subVectors(t,e);return r.lengthSq()<n*n?r.copy(t):r.setLength(n).add(e)}function Tm(e,t,n){if(e.longitude===t.longitude&&e.latitude===t.latitude)return{longitude:t.longitude,latitude:t.latitude};let r=Vt(e.longitude),i=e.latitude,a=Vt(t.longitude),o=t.latitude;a-r>xm?r+=Sm:r-a>xm&&(r-=Sm);let s=n/Math.sqrt(Math.pow(a-r,2)+Math.pow(o-i,2));return s>=1?{longitude:t.longitude,latitude:t.latitude}:{longitude:r+(a-r)*s,latitude:i+(o-i)*s}}var Em=new c.ShaderMaterial({uniforms:{inputBuffer:{value:null},minValue:{value:0},maxValue:{value:1}},vertexShader:`
968
968
  varying vec2 vUv;
969
969
  void main() {
970
970
  vUv = uv;
@@ -999,13 +999,13 @@ void main() {
999
999
  yuv.x = clamp((yuv.x - minValue) / (maxValue - minValue), 0.0, 1.0);
1000
1000
  gl_FragColor = vec4(yuv2rgb(yuv), rgba.a);
1001
1001
  }
1002
- `}),wm=new im(Cm);function Tm(e,t,n,r){Cm.uniforms.inputBuffer.value=t,Cm.uniforms.minValue.value=n,Cm.uniforms.maxValue.value=r,wm.render(e),Cm.uniforms.inputBuffer.value=null}var Em=64,Dm=class extends am{constructor(){super(),this.histogram=new _m,this.minValue=0,this.maxValue=1,this.maxMinValue=.2,this.minMaxValue=.8,this.valueStep=1/255,this.sampleTestScale=.8;let e=this.enabled;Object.defineProperty(this,`enabled`,{get(){return e},set(t){e=t,e===!1&&(this.clearBuffer(),this.progress=0)}})}render(e,t,n,r,i){this.luminanceSampleBuffer||(this.luminanceSampleBuffer=new ArrayBuffer(Em*Em*4)),this.luminanceSampleTarget||(this.luminanceSampleTarget=new c.WebGLRenderTarget(Em,Em,{depthBuffer:!1,stencilBuffer:!1,generateMipmaps:!1,magFilter:c.LinearFilter,minFilter:c.LinearFilter}));let a=t.width,o=t.height,s=Em/Math.max(a,o),l=Math.floor(a*s),u=Math.floor(o*s);this.luminanceSampleTarget.setSize(l,u),e.setRenderTarget(this.luminanceSampleTarget),um(e,n.texture);let d=Math.floor(l*((1-this.sampleTestScale)/2)),f=Math.floor(u*((1-this.sampleTestScale)/2)),p=Math.floor(l*this.sampleTestScale),m=Math.floor(u*this.sampleTestScale),h=new Uint8ClampedArray(this.luminanceSampleBuffer,0,p*m*4);e.readRenderTargetPixels(this.luminanceSampleTarget,d,f,p,m,h),this.histogram.formPixels(h);let g=Math.min(this.histogram.min,this.maxMinValue),_=Math.max(this.histogram.max,this.minMaxValue);this.minValue=bm(this.minValue,g,this.valueStep),this.maxValue=bm(this.maxValue,_,this.valueStep),this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear()),Tm(e,n.texture,this.minValue,this.maxValue)}clearBuffer(){this.luminanceSampleTarget&&(this.luminanceSampleTarget.dispose(),this.luminanceSampleTarget=void 0),this.luminanceSampleBuffer&&(this.luminanceSampleBuffer=void 0),this.minValue=0,this.maxValue=1}dispose(){this.clearBuffer()}},Om=`
1002
+ `}),Dm=new sm(Em);function Om(e,t,n,r){Em.uniforms.inputBuffer.value=t,Em.uniforms.minValue.value=n,Em.uniforms.maxValue.value=r,Dm.render(e),Em.uniforms.inputBuffer.value=null}var km=64,Am=class extends cm{constructor(){super(),this.histogram=new bm,this.minValue=0,this.maxValue=1,this.maxMinValue=.2,this.minMaxValue=.8,this.valueStep=1/255,this.sampleTestScale=.8;let e=this.enabled;Object.defineProperty(this,`enabled`,{get(){return e},set(t){e=t,e===!1&&(this.clearBuffer(),this.progress=0)}})}render(e,t,n,r,i){this.luminanceSampleBuffer||(this.luminanceSampleBuffer=new ArrayBuffer(km*km*4)),this.luminanceSampleTarget||(this.luminanceSampleTarget=new c.WebGLRenderTarget(km,km,{depthBuffer:!1,stencilBuffer:!1,generateMipmaps:!1,magFilter:c.LinearFilter,minFilter:c.LinearFilter}));let a=t.width,o=t.height,s=km/Math.max(a,o),l=Math.floor(a*s),u=Math.floor(o*s);this.luminanceSampleTarget.setSize(l,u),e.setRenderTarget(this.luminanceSampleTarget),pm(e,n.texture);let d=Math.floor(l*((1-this.sampleTestScale)/2)),f=Math.floor(u*((1-this.sampleTestScale)/2)),p=Math.floor(l*this.sampleTestScale),m=Math.floor(u*this.sampleTestScale),h=new Uint8ClampedArray(this.luminanceSampleBuffer,0,p*m*4);e.readRenderTargetPixels(this.luminanceSampleTarget,d,f,p,m,h),this.histogram.formPixels(h);let g=Math.min(this.histogram.min,this.maxMinValue),_=Math.max(this.histogram.max,this.minMaxValue);this.minValue=Cm(this.minValue,g,this.valueStep),this.maxValue=Cm(this.maxValue,_,this.valueStep),this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear()),Om(e,n.texture,this.minValue,this.maxValue)}clearBuffer(){this.luminanceSampleTarget&&(this.luminanceSampleTarget.dispose(),this.luminanceSampleTarget=void 0),this.luminanceSampleBuffer&&(this.luminanceSampleBuffer=void 0),this.minValue=0,this.maxValue=1}dispose(){this.clearBuffer()}},jm=`
1003
1003
  varying vec2 vUv;
1004
1004
  void main() {
1005
1005
  vUv = uv;
1006
1006
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
1007
1007
  }
1008
- `,km=`
1008
+ `,Mm=`
1009
1009
  uniform float strength;
1010
1010
  uniform float radius;
1011
1011
 
@@ -1055,7 +1055,7 @@ void main() {
1055
1055
 
1056
1056
  gl_FragColor = vec4(color.rgb * shade, color.a);
1057
1057
  }
1058
- `,Am=class extends am{constructor(e){super(),this.strength=1,this.radius=1,this.neighbours=4,this.camera=e,this.dependencies=[`depth`],this.material=new c.ShaderMaterial({uniforms:{strength:{value:this.strength},radius:{value:this.radius},resolution:{value:new c.Vector2().copy(this.camera.resolution)},cameraNear:{value:this.camera.near},cameraFar:{value:this.camera.far},cameraPerspToOrtho:{value:this.camera.perspToOrtho.x},depthMap:{value:null},colorMap:{value:null}},vertexShader:Om,fragmentShader:km}),this.material.onBeforeCompile=e=>{e.fragmentShader=e.fragmentShader.replace(/NUM_NEIGHBOUR/g,String(this.neighbours))},this.fsQuad=new im(this.material)}render(e,t,n,r,i){let a=this.gbuffer.get(`depth`);this.material.uniforms.resolution.value.copy(this.camera.resolution),this.material.uniforms.cameraNear.value=this.camera.near,this.material.uniforms.cameraFar.value=this.camera.far,this.material.uniforms.cameraPerspToOrtho.value=this.camera.perspToOrtho.x,this.material.uniforms.depthMap.value=a,this.material.uniforms.colorMap.value=n.texture,this.material.uniforms.strength.value=this.strength,this.material.uniforms.radius.value=this.radius,this.material.defines.NUM_NEIGHBOUR!==this.neighbours&&(this.material.needsUpdate=!0),this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear()),this.fsQuad.render(e),this.material.uniforms.depthMap.value=null,this.material.uniforms.colorMap.value=null}dispose(){this.material.dispose(),this.fsQuad.dispose()}},jm=class{constructor(){this.name=`SceneRenderer`}clearBuffers(){}render(e,t,n,r,i,a){return i?(e.setRenderTarget(a),e.render(t,r),!0):!1}},Mm=new c.Vector4,Nm=new c.ShaderMaterial({uniforms:{tDiffuse:{value:null},weight:{value:1}},vertexShader:`
1058
+ `,Nm=class extends cm{constructor(e){super(),this.strength=1,this.radius=1,this.neighbours=4,this.camera=e,this.dependencies=[`depth`],this.material=new c.ShaderMaterial({uniforms:{strength:{value:this.strength},radius:{value:this.radius},resolution:{value:new c.Vector2().copy(this.camera.resolution)},cameraNear:{value:this.camera.near},cameraFar:{value:this.camera.far},cameraPerspToOrtho:{value:this.camera.perspToOrtho.x},depthMap:{value:null},colorMap:{value:null}},vertexShader:jm,fragmentShader:Mm}),this.material.onBeforeCompile=e=>{e.fragmentShader=e.fragmentShader.replace(/NUM_NEIGHBOUR/g,String(this.neighbours))},this.fsQuad=new sm(this.material)}render(e,t,n,r,i){let a=this.gbuffer.get(`depth`);this.material.uniforms.resolution.value.copy(this.camera.resolution),this.material.uniforms.cameraNear.value=this.camera.near,this.material.uniforms.cameraFar.value=this.camera.far,this.material.uniforms.cameraPerspToOrtho.value=this.camera.perspToOrtho.x,this.material.uniforms.depthMap.value=a,this.material.uniforms.colorMap.value=n.texture,this.material.uniforms.strength.value=this.strength,this.material.uniforms.radius.value=this.radius,this.material.defines.NUM_NEIGHBOUR!==this.neighbours&&(this.material.needsUpdate=!0),this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear()),this.fsQuad.render(e),this.material.uniforms.depthMap.value=null,this.material.uniforms.colorMap.value=null}dispose(){this.material.dispose(),this.fsQuad.dispose()}},Pm=class{constructor(){this.name=`SceneRenderer`}clearBuffers(){}render(e,t,n,r,i,a){return i?(e.setRenderTarget(a),e.render(t,r),!0):!1}},Fm=new c.Vector4,Im=new c.ShaderMaterial({uniforms:{tDiffuse:{value:null},weight:{value:1}},vertexShader:`
1059
1059
  varying vec2 vUv;
1060
1060
  void main() {
1061
1061
  vUv = uv;
@@ -1068,7 +1068,7 @@ varying vec2 vUv;
1068
1068
  void main() {
1069
1069
  gl_FragColor = texture2D(tDiffuse, vUv) * weight;
1070
1070
  }
1071
- `,premultipliedAlpha:!0,blending:c.AdditiveBlending,transparent:!0,depthTest:!1,depthWrite:!1}),Pm=new im(Nm);function Fm(e,t,n){Nm.uniforms.weight.value=n,Nm.uniforms.tDiffuse.value=t,Pm.render(e),Nm.uniforms.tDiffuse.value=null}var Im=class extends jm{constructor(){super(...arguments),this.name=`SSAASceneRnderer`,this.sampleLevel=2,this.unbiased=!0,this.sampleRenderTarget=null}clearBuffers(){super.clearBuffers(),this.sampleRenderTarget&&(this.sampleRenderTarget.dispose(),this.sampleRenderTarget=null)}render(e,t,n,r,i,a){if(this.sampleLevel<0)return super.render(e,t,n,r,!0,a);if(!i)return!1;let o=e.getPixelRatio(),s=e.getViewport(Mm),l=s.width*o,u=s.height*o;this.sampleRenderTarget||(this.sampleRenderTarget=new c.WebGLRenderTarget(1,1,{minFilter:c.LinearFilter,magFilter:c.LinearFilter,format:c.RGBAFormat,stencilBuffer:!0,depthBuffer:!0}),this.sampleRenderTarget.texture.name=`${this.name}.sample`),this.sampleRenderTarget.texture.encoding=e.outputEncoding,this.sampleRenderTarget.setSize(l,u),a!=null&&a.depthTexture&&(e.setRenderTarget(a),e.render(t,r));let d=Lm[Math.max(0,Math.min(this.sampleLevel,5))],f=e.autoClear;e.autoClear=!1;let p=e.getClearColor().getHex(),m=e.getClearAlpha(),h=1/d.length,g={fullWidth:l,fullHeight:u,offsetX:0,offsetY:0,width:l,height:u},_=Object.assign({},r.view);_.enabled&&Object.assign(g,_);for(let n=0;n<d.length;n++){let i=d[n];r.setViewOffset&&r.setViewOffset(g.fullWidth,g.fullHeight,g.offsetX+i[0]*.0625,g.offsetY+i[1]*.0625,g.width,g.height);let o=h;if(this.unbiased){let e=-.5+(n+.5)/d.length;o+=.03125*e}e.setRenderTarget(this.sampleRenderTarget),e.setClearColor(p,m),e.clear(),e.render(t,r),e.setRenderTarget(a),n===0&&(e.setClearColor(0,0),e.clearColor(),e.clearStencil()),Fm(e,this.sampleRenderTarget.texture,o)}return r.setViewOffset&&_.enabled?r.setViewOffset(_.fullWidth,_.fullHeight,_.offsetX,_.offsetY,_.width,_.height):r.clearViewOffset&&r.clearViewOffset(),r.needsRender=!1,e.autoClear=f,e.setClearColor(p,m),!0}},Lm=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]],Rm=new c.ShaderMaterial({uniforms:{tDiffuse:{value:null}},vertexShader:`
1071
+ `,premultipliedAlpha:!0,blending:c.AdditiveBlending,transparent:!0,depthTest:!1,depthWrite:!1}),Lm=new sm(Im);function Rm(e,t,n){Im.uniforms.weight.value=n,Im.uniforms.tDiffuse.value=t,Lm.render(e),Im.uniforms.tDiffuse.value=null}var zm=class extends Pm{constructor(){super(...arguments),this.name=`SSAASceneRnderer`,this.sampleLevel=2,this.unbiased=!0,this.sampleRenderTarget=null}clearBuffers(){super.clearBuffers(),this.sampleRenderTarget&&(this.sampleRenderTarget.dispose(),this.sampleRenderTarget=null)}render(e,t,n,r,i,a){if(this.sampleLevel<0)return super.render(e,t,n,r,!0,a);if(!i)return!1;let o=e.getPixelRatio(),s=e.getViewport(Fm),l=s.width*o,u=s.height*o;this.sampleRenderTarget||(this.sampleRenderTarget=new c.WebGLRenderTarget(1,1,{minFilter:c.LinearFilter,magFilter:c.LinearFilter,format:c.RGBAFormat,stencilBuffer:!0,depthBuffer:!0}),this.sampleRenderTarget.texture.name=`${this.name}.sample`),this.sampleRenderTarget.texture.encoding=e.outputEncoding,this.sampleRenderTarget.setSize(l,u),a!=null&&a.depthTexture&&(e.setRenderTarget(a),e.render(t,r));let d=Bm[Math.max(0,Math.min(this.sampleLevel,5))],f=e.autoClear;e.autoClear=!1;let p=e.getClearColor().getHex(),m=e.getClearAlpha(),h=1/d.length,g={fullWidth:l,fullHeight:u,offsetX:0,offsetY:0,width:l,height:u},_=Object.assign({},r.view);_.enabled&&Object.assign(g,_);for(let n=0;n<d.length;n++){let i=d[n];r.setViewOffset&&r.setViewOffset(g.fullWidth,g.fullHeight,g.offsetX+i[0]*.0625,g.offsetY+i[1]*.0625,g.width,g.height);let o=h;if(this.unbiased){let e=-.5+(n+.5)/d.length;o+=.03125*e}e.setRenderTarget(this.sampleRenderTarget),e.setClearColor(p,m),e.clear(),e.render(t,r),e.setRenderTarget(a),n===0&&(e.setClearColor(0,0),e.clearColor(),e.clearStencil()),Rm(e,this.sampleRenderTarget.texture,o)}return r.setViewOffset&&_.enabled?r.setViewOffset(_.fullWidth,_.fullHeight,_.offsetX,_.offsetY,_.width,_.height):r.clearViewOffset&&r.clearViewOffset(),r.needsRender=!1,e.autoClear=f,e.setClearColor(p,m),!0}},Bm=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]],Vm=new c.ShaderMaterial({uniforms:{tDiffuse:{value:null}},vertexShader:`
1072
1072
  varying vec2 vUv;
1073
1073
  void main() {
1074
1074
  vUv = uv;
@@ -1081,7 +1081,7 @@ void main() {
1081
1081
  gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
1082
1082
  gl_FragDepthEXT = texture2D(tDiffuse, vUv).x;
1083
1083
  }
1084
- `,blending:c.NoBlending,depthWrite:!0,depthTest:!0}),zm=new im(Rm);function Bm(e,t){Rm.uniforms.tDiffuse.value=t,e.getContext()instanceof WebGLRenderingContext&&(Rm.extensions.fragDepth=!0),zm.render(e),Rm.uniforms.tDiffuse.value=null}var Vm=new c.Vector4,Hm=new c.ShaderMaterial({uniforms:{depthMap:{value:null},weightMap:{value:null}},vertexShader:`
1084
+ `,blending:c.NoBlending,depthWrite:!0,depthTest:!0}),Hm=new sm(Vm);function Um(e,t){Vm.uniforms.tDiffuse.value=t,e.getContext()instanceof WebGLRenderingContext&&(Vm.extensions.fragDepth=!0),Hm.render(e),Vm.uniforms.tDiffuse.value=null}var Wm=new c.Vector4,Gm=new c.ShaderMaterial({uniforms:{depthMap:{value:null},weightMap:{value:null}},vertexShader:`
1085
1085
  varying vec2 vUv;
1086
1086
  void main() {
1087
1087
  vUv = uv;
@@ -1100,7 +1100,7 @@ void main() {
1100
1100
  color = color / color.a;
1101
1101
  gl_FragColor = vec4(color.xyz, 1.0);
1102
1102
  }
1103
- `,depthTest:!1,depthWrite:!1,transparent:!0}),Um=new im(Hm);function Wm(e,t,n){Hm.uniforms.weightMap.value=t,Hm.uniforms.depthMap.value=n,Um.render(e),Hm.uniforms.weightMap.value=null,Hm.uniforms.depthMap.value=null}var Gm=class extends jm{constructor(){super(...arguments),this.name=`PointCloudHighQualitySceneRnderer`,this.tempRenderTarget=null}clearBuffers(){super.clearBuffers(),this.tempRenderTarget&&(this.tempRenderTarget.dispose(),this.tempRenderTarget=null)}render(e,t,n,r,i,a){if(!i)return!1;let o=e.getPixelRatio(),s=e.getViewport(Vm),l=s.width*o,u=s.height*o;this.tempRenderTarget||(this.tempRenderTarget=new c.WebGLRenderTarget(1,1,{magFilter:c.LinearFilter,minFilter:c.LinearFilter,type:c.FloatType,generateMipmaps:!1,depthBuffer:!0,stencilBuffer:!0}),this.tempRenderTarget.texture.name=`${this.name}.temp`);let d=this.tempRenderTarget.depthTexture;if(!d||d.image.width!==l||d.image.height!==u){let e=new c.DepthTexture(l,u);e.generateMipmaps=!1,e.format=c.DepthStencilFormat,e.type=c.UnsignedInt248Type,e.needsUpdate=!0,this.tempRenderTarget.depthTexture=e,d&&d.dispose(),this.tempRenderTarget.dispose()}this.tempRenderTarget.texture.encoding=e.outputEncoding,this.tempRenderTarget.setSize(l,u);let f=e.getClearColor().clone(),p=e.getClearAlpha();return e.autoClearColor=!0,e.autoClearDepth=!0,e.setClearColor(new c.Color(0,0,0)),e.setClearAlpha(0),n.parameter.set(`useHQDepth`,!0),n.parameter.set(`useHQWeight`,!1),n.update(e,r),e.setRenderTarget(this.tempRenderTarget),e.render(t,r),n.parameter.set(`useHQDepth`,!1),n.parameter.set(`useHQWeight`,!0),n.update(e,r),e.autoClearDepth=!1,e.autoClearColor=!0,e.render(t,r),n.parameter.set(`useHQDepth`,!1),n.parameter.set(`useHQWeight`,!1),n.update(e,r),n.needsRender=!1,e.setClearColor(f,p),e.autoClearDepth=!0,e.autoClearColor=!0,e.setRenderTarget(a),Bm(e,this.tempRenderTarget.depthTexture),e.autoClearDepth=!1,Wm(e,this.tempRenderTarget.texture,this.tempRenderTarget.depthTexture),e.autoClearDepth=!0,!0}},Km=new c.Vector4,qm=new c.MeshNormalMaterial({flatShading:!0}),Jm=class{constructor(){this.composer=new rm,this.composerVersion=``,this.colorRenderTarget=new c.WebGLRenderTarget(1,1,{magFilter:c.LinearFilter,minFilter:c.LinearFilter,generateMipmaps:!1,depthBuffer:!0,stencilBuffer:!0}),this.normalRenderTarget=new c.WebGLRenderTarget(1,1,{magFilter:c.LinearFilter,minFilter:c.LinearFilter,generateMipmaps:!1,depthBuffer:!0,stencilBuffer:!0}),this.renderMode=`default`,this.sceneRenders={default:new jm,ssaa:new Im,"point-cloud-high-quality":new Gm}}renderSceneToBuffers(e,t,n,r,i,a){let{gbuffer:o,status:s}=this.composer,{needsColorGBuffer:c,needsDepthGBuffer:l,needsNormalGBuffer:u}=s,d=!1;o.clear(),this.colorRenderTarget.texture.encoding=e.outputEncoding,this.normalRenderTarget.texture.encoding=e.outputEncoding;for(let e in this.sceneRenders){let t=e;t!==this.renderMode&&this.sceneRenders[t].clearBuffers()}if(this.sceneRenders[this.renderMode]){let o=a?null:this.colorRenderTarget;d=this.sceneRenders[this.renderMode].render(e,t,n,r,i,o)}if(c&&o.set(`color`,this.colorRenderTarget.texture),l&&o.set(`depth`,this.colorRenderTarget.depthTexture),u){e.setRenderTarget(this.normalRenderTarget);let n=t.overrideMaterial;t.overrideMaterial=qm,e.setRenderTarget(this.normalRenderTarget),e.render(t,r),t.overrideMaterial=n,o.set(`normal`,this.normalRenderTarget.texture)}return d}render(e,t,n,r,i){let a=!1;this.composer.updateStatus();let o=e.getRenderTarget();e.setRenderTarget(null);let{endabledPassNumber:s,needsDepthGBuffer:l,needsNormalGBuffer:u,version:d}=this.composer.status;if(s===0)this.colorRenderTarget.depthTexture&&(this.colorRenderTarget.depthTexture.dispose(),this.colorRenderTarget.depthTexture=null,this.colorRenderTarget.dispose()),this.colorRenderTarget.setSize(1,1),this.normalRenderTarget.setSize(1,1),this.composer.setSize(1,1),this.composerVersion=``,a=this.renderSceneToBuffers(e,t,n,r,i,!0);else{let o=e.getPixelRatio(),s=e.getViewport(Km),f=s.width*o,p=s.height*o;if(this.composer.setSize(f,p),i===!1&&d!==this.composerVersion&&(this.composerVersion=d,i=!0),i){if(l){let e=this.colorRenderTarget.depthTexture;if(!e||e.image.width!==f||e.image.height!==p){let t=new c.DepthTexture(f,p);t.generateMipmaps=!1,t.format=c.DepthStencilFormat,t.type=c.UnsignedInt248Type,t.needsUpdate=!0,this.colorRenderTarget.depthTexture=t,e&&e.dispose(),this.colorRenderTarget.dispose()}}else this.colorRenderTarget.depthTexture&&(this.colorRenderTarget.depthTexture.dispose(),this.colorRenderTarget.depthTexture=null,this.colorRenderTarget.dispose());this.colorRenderTarget.setSize(f,p),u?this.normalRenderTarget.setSize(f,p):this.normalRenderTarget.setSize(1,1)}this.renderSceneToBuffers(e,t,n,r,i,!1),e.setRenderTarget(this.composer.readBuffer),um(e,this.colorRenderTarget.texture),a=this.composer.render(e)}return e.setRenderTarget(o),a}dispose(){this.composer.dispose();for(let e in this.sceneRenders){let t=e;this.sceneRenders[t].clearBuffers()}}},Ym=class extends c.WebGLRenderer{constructor({preserveDrawingBuffer:e=!0,premultipliedAlpha:t=!0,stencil:n=!0,antialias:r=!1,webgl2:i,logarithmicDepthBuffer:a,precision:o,powerPreference:s}){let l={antialias:r,alpha:!0,depth:!0,preserveDrawingBuffer:e,stencil:n,premultipliedAlpha:t,powerPreference:s},u={logarithmicDepthBuffer:a,precision:o};if(i){let e=document.createElement(`canvas`),t=e.getContext(`webgl2`,l);t?super(Object.assign(Object.assign(Object.assign({},l),u),{antialias:!0,canvas:e,context:t})):(console.error(`error occurred when getting webgl2 canvas context, mybe webgl2 not support, fallback to webgl.`),super(Object.assign(Object.assign({},l),u)))}else super(Object.assign(Object.assign({},l),u));this.outputEncoding=c.sRGBEncoding,this.autoClear=!0}},Xm=class{constructor(e=!0,t=!1){this.elapsedTime=0,this.autoStart=e,this.autoUpdate=t,this.running=e;let n=H();t?V(this,`currentTime`,{get(){return H()}}):this.currentTime=n,this.startTime=n,this.oldTime=n}update(e){this.autoUpdate||(this.currentTime=e)}start(){this.startTime=this.currentTime,this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;return this.autoStart&&!this.running?(this.start(),0):(this.running&&(e=(this.currentTime-this.oldTime)/1e3,this.oldTime=this.currentTime,this.elapsedTime+=e),e)}},Zm=new c.Matrix4,Qm=new c.Frustum,$m=new c.Vector2,eh=new WeakMap;function th(e){let t=!1;return e.needsRender===!0?(e.needsRender=!1,t=!0):e.mixer&&e.mixer.stats.actions.inUse>0&&(t=!0),t}var nh=class extends c.Scene{constructor(){super(...arguments),this.needsRender=!1}add(...e){return super.add(...e)}remove(...e){return super.remove(...e)}update(e,t){let n=!1,r;return t instanceof tn?(r=t.time,$m.copy(t.resolution)):(r=H(),e.getSize($m)),Zm.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),Qm.setFromProjectionMatrix(Zm),this.traverseVisible(e=>{if(e.setResolution&&e.setResolution($m.x,$m.y),e.setTime&&e.setTime(r),e.mixer instanceof c.AnimationMixer){let t=e.mixer,n=eh.get(t);n||(n=new Xm,eh.set(t,n)),n.update(r),t.update(n.getDelta())}(e instanceof c.Mesh||e instanceof c.Line||e instanceof c.Points)&&(e instanceof c.ImmediateRenderObject||!e.frustumCulled||Qm.intersectsObject(e))&&(th(e)&&(n=!0),e.traverseAncestors(e=>{th(e)&&(n=!0)}))}),this.needsRender=n,n}},rh=e=>e*(2-e),ih=(()=>{let e=new Float32Array([-.18,0,-.18,.18,0,-.18,-.18,0,.18,.18,0,.18]),t=new Float32Array([1,0,0,0,1,1,0,1]),n=new Uint8Array([0,2,1,2,3,1]),r=new c.BufferGeometry;return r.setAttribute(`position`,new c.BufferAttribute(e,3)),r.setAttribute(`uv`,new c.BufferAttribute(t,2)),r.setIndex(new c.BufferAttribute(n,1)),r})(),ah=`
1103
+ `,depthTest:!1,depthWrite:!1,transparent:!0}),Km=new sm(Gm);function qm(e,t,n){Gm.uniforms.weightMap.value=t,Gm.uniforms.depthMap.value=n,Km.render(e),Gm.uniforms.weightMap.value=null,Gm.uniforms.depthMap.value=null}var Jm=class extends Pm{constructor(){super(...arguments),this.name=`PointCloudHighQualitySceneRnderer`,this.tempRenderTarget=null}clearBuffers(){super.clearBuffers(),this.tempRenderTarget&&(this.tempRenderTarget.dispose(),this.tempRenderTarget=null)}render(e,t,n,r,i,a){if(!i)return!1;let o=e.getPixelRatio(),s=e.getViewport(Wm),l=s.width*o,u=s.height*o;this.tempRenderTarget||(this.tempRenderTarget=new c.WebGLRenderTarget(1,1,{magFilter:c.LinearFilter,minFilter:c.LinearFilter,type:c.FloatType,generateMipmaps:!1,depthBuffer:!0,stencilBuffer:!0}),this.tempRenderTarget.texture.name=`${this.name}.temp`);let d=this.tempRenderTarget.depthTexture;if(!d||d.image.width!==l||d.image.height!==u){let e=new c.DepthTexture(l,u);e.generateMipmaps=!1,e.format=c.DepthStencilFormat,e.type=c.UnsignedInt248Type,e.needsUpdate=!0,this.tempRenderTarget.depthTexture=e,d&&d.dispose(),this.tempRenderTarget.dispose()}this.tempRenderTarget.texture.encoding=e.outputEncoding,this.tempRenderTarget.setSize(l,u);let f=e.getClearColor().clone(),p=e.getClearAlpha();return e.autoClearColor=!0,e.autoClearDepth=!0,e.setClearColor(new c.Color(0,0,0)),e.setClearAlpha(0),n.parameter.set(`useHQDepth`,!0),n.parameter.set(`useHQWeight`,!1),n.update(e,r),e.setRenderTarget(this.tempRenderTarget),e.render(t,r),n.parameter.set(`useHQDepth`,!1),n.parameter.set(`useHQWeight`,!0),n.update(e,r),e.autoClearDepth=!1,e.autoClearColor=!0,e.render(t,r),n.parameter.set(`useHQDepth`,!1),n.parameter.set(`useHQWeight`,!1),n.update(e,r),n.needsRender=!1,e.setClearColor(f,p),e.autoClearDepth=!0,e.autoClearColor=!0,e.setRenderTarget(a),Um(e,this.tempRenderTarget.depthTexture),e.autoClearDepth=!1,qm(e,this.tempRenderTarget.texture,this.tempRenderTarget.depthTexture),e.autoClearDepth=!0,!0}},Ym=new c.Vector4,Xm=new c.MeshNormalMaterial({flatShading:!0}),Zm=class{constructor(){this.composer=new om,this.composerVersion=``,this.colorRenderTarget=new c.WebGLRenderTarget(1,1,{magFilter:c.LinearFilter,minFilter:c.LinearFilter,generateMipmaps:!1,depthBuffer:!0,stencilBuffer:!0}),this.normalRenderTarget=new c.WebGLRenderTarget(1,1,{magFilter:c.LinearFilter,minFilter:c.LinearFilter,generateMipmaps:!1,depthBuffer:!0,stencilBuffer:!0}),this.renderMode=`default`,this.sceneRenders={default:new Pm,ssaa:new zm,"point-cloud-high-quality":new Jm}}renderSceneToBuffers(e,t,n,r,i,a){let{gbuffer:o,status:s}=this.composer,{needsColorGBuffer:c,needsDepthGBuffer:l,needsNormalGBuffer:u}=s,d=!1;o.clear(),this.colorRenderTarget.texture.encoding=e.outputEncoding,this.normalRenderTarget.texture.encoding=e.outputEncoding;for(let e in this.sceneRenders){let t=e;t!==this.renderMode&&this.sceneRenders[t].clearBuffers()}if(this.sceneRenders[this.renderMode]){let o=a?null:this.colorRenderTarget;d=this.sceneRenders[this.renderMode].render(e,t,n,r,i,o)}if(c&&o.set(`color`,this.colorRenderTarget.texture),l&&o.set(`depth`,this.colorRenderTarget.depthTexture),u){e.setRenderTarget(this.normalRenderTarget);let n=t.overrideMaterial;t.overrideMaterial=Xm,e.setRenderTarget(this.normalRenderTarget),e.render(t,r),t.overrideMaterial=n,o.set(`normal`,this.normalRenderTarget.texture)}return d}render(e,t,n,r,i){let a=!1;this.composer.updateStatus();let o=e.getRenderTarget();e.setRenderTarget(null);let{endabledPassNumber:s,needsDepthGBuffer:l,needsNormalGBuffer:u,version:d}=this.composer.status;if(s===0)this.colorRenderTarget.depthTexture&&(this.colorRenderTarget.depthTexture.dispose(),this.colorRenderTarget.depthTexture=null,this.colorRenderTarget.dispose()),this.colorRenderTarget.setSize(1,1),this.normalRenderTarget.setSize(1,1),this.composer.setSize(1,1),this.composerVersion=``,a=this.renderSceneToBuffers(e,t,n,r,i,!0);else{let o=e.getPixelRatio(),s=e.getViewport(Ym),f=s.width*o,p=s.height*o;if(this.composer.setSize(f,p),i===!1&&d!==this.composerVersion&&(this.composerVersion=d,i=!0),i){if(l){let e=this.colorRenderTarget.depthTexture;if(!e||e.image.width!==f||e.image.height!==p){let t=new c.DepthTexture(f,p);t.generateMipmaps=!1,t.format=c.DepthStencilFormat,t.type=c.UnsignedInt248Type,t.needsUpdate=!0,this.colorRenderTarget.depthTexture=t,e&&e.dispose(),this.colorRenderTarget.dispose()}}else this.colorRenderTarget.depthTexture&&(this.colorRenderTarget.depthTexture.dispose(),this.colorRenderTarget.depthTexture=null,this.colorRenderTarget.dispose());this.colorRenderTarget.setSize(f,p),u?this.normalRenderTarget.setSize(f,p):this.normalRenderTarget.setSize(1,1)}this.renderSceneToBuffers(e,t,n,r,i,!1),e.setRenderTarget(this.composer.readBuffer),pm(e,this.colorRenderTarget.texture),a=this.composer.render(e)}return e.setRenderTarget(o),a}dispose(){this.composer.dispose();for(let e in this.sceneRenders){let t=e;this.sceneRenders[t].clearBuffers()}}},Qm=class extends c.WebGLRenderer{constructor({preserveDrawingBuffer:e=!0,premultipliedAlpha:t=!0,stencil:n=!0,antialias:r=!1,webgl2:i,logarithmicDepthBuffer:a,precision:o,powerPreference:s}){let l={antialias:r,alpha:!0,depth:!0,preserveDrawingBuffer:e,stencil:n,premultipliedAlpha:t,powerPreference:s},u={logarithmicDepthBuffer:a,precision:o};if(i){let e=document.createElement(`canvas`),t=e.getContext(`webgl2`,l);t?super(Object.assign(Object.assign(Object.assign({},l),u),{antialias:!0,canvas:e,context:t})):(console.error(`error occurred when getting webgl2 canvas context, mybe webgl2 not support, fallback to webgl.`),super(Object.assign(Object.assign({},l),u)))}else super(Object.assign(Object.assign({},l),u));this.outputEncoding=c.sRGBEncoding,this.autoClear=!0}},$m=class{constructor(e=!0,t=!1){this.elapsedTime=0,this.autoStart=e,this.autoUpdate=t,this.running=e;let n=H();t?V(this,`currentTime`,{get(){return H()}}):this.currentTime=n,this.startTime=n,this.oldTime=n}update(e){this.autoUpdate||(this.currentTime=e)}start(){this.startTime=this.currentTime,this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;return this.autoStart&&!this.running?(this.start(),0):(this.running&&(e=(this.currentTime-this.oldTime)/1e3,this.oldTime=this.currentTime,this.elapsedTime+=e),e)}},eh=new c.Matrix4,th=new c.Frustum,nh=new c.Vector2,rh=new WeakMap;function ih(e){let t=!1;return e.needsRender===!0?(e.needsRender=!1,t=!0):e.mixer&&e.mixer.stats.actions.inUse>0&&(t=!0),t}var ah=class extends c.Scene{constructor(){super(...arguments),this.needsRender=!1}add(...e){return super.add(...e)}remove(...e){return super.remove(...e)}update(e,t){let n=!1,r;return t instanceof tn?(r=t.time,nh.copy(t.resolution)):(r=H(),e.getSize(nh)),eh.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),th.setFromProjectionMatrix(eh),this.traverseVisible(e=>{if(e.setResolution&&e.setResolution(nh.x,nh.y),e.setTime&&e.setTime(r),e.mixer instanceof c.AnimationMixer){let t=e.mixer,n=rh.get(t);n||(n=new $m,rh.set(t,n)),n.update(r),t.update(n.getDelta())}(e instanceof c.Mesh||e instanceof c.Line||e instanceof c.Points)&&(e instanceof c.ImmediateRenderObject||!e.frustumCulled||th.intersectsObject(e))&&(ih(e)&&(n=!0),e.traverseAncestors(e=>{ih(e)&&(n=!0)}))}),this.needsRender=n,n}},oh=e=>e*(2-e),sh=(()=>{let e=new Float32Array([-.18,0,-.18,.18,0,-.18,-.18,0,.18,.18,0,.18]),t=new Float32Array([1,0,0,0,1,1,0,1]),n=new Uint8Array([0,2,1,2,3,1]),r=new c.BufferGeometry;return r.setAttribute(`position`,new c.BufferAttribute(e,3)),r.setAttribute(`uv`,new c.BufferAttribute(t,2)),r.setIndex(new c.BufferAttribute(n,1)),r})(),ch=`
1104
1104
  varying vec2 vUv;
1105
1105
  #include <common>
1106
1106
  #include <logdepthbuf_pars_vertex>
@@ -1109,7 +1109,7 @@ void main() {
1109
1109
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
1110
1110
  #include <logdepthbuf_vertex>
1111
1111
  }
1112
- `,oh=`
1112
+ `,lh=`
1113
1113
  uniform vec3 baseColor;
1114
1114
  uniform float circleScale;
1115
1115
  uniform float ringScale;
@@ -1212,7 +1212,7 @@ void main() {
1212
1212
 
1213
1213
  gl_FragColor = vec4(gl_FragColor.rgb * baseColor, gl_FragColor.a * opacity * opacity);
1214
1214
  }
1215
- `,sh=class extends c.Object3D{constructor(e={}){var t,n;super();let r=(t=e.color)==null?16777215:t,i=(n=e.scale)==null?1:n;this.progress=0,this.opacity=0,this.loading=!1,this.current=!1,this.disabled=!1,this.currentMotion=new X({progress:0}),this.ringMotion=new X({scale:1,opacity:1}),this.tapMotion=new X({scale:1,opacity:1}),this.loadingOpacityMotion=new X({opacity:0}),this.progressMotion=new X({progress:0}),this.progressOpacityMotion=new X({opacity:0}),this.opacityMotion=new X({opacity:0}),this.disableMotion=new X({progress:0}),this.panoMesh=new c.Mesh(ih,new c.ShaderMaterial({blending:c.CustomBlending,blendSrc:c.SrcAlphaFactor,blendDst:c.OneMinusSrcAlphaFactor,blendSrcAlpha:c.OneFactor,blendDstAlpha:c.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0,vertexShader:ah,fragmentShader:oh,uniforms:{baseColor:{value:new c.Color(r)},circleScale:{value:1},ringScale:{value:1},ringOpacity:{value:1},loadingAngle:{value:0},loadingOpacity:{value:0},progress:{value:0},progressOpacity:{value:0},expand0:{value:0},expand1:{value:0},expandOpacity:{value:0},opacity:{value:0},tapScale:{value:1},tapOpacity:{value:1},disable:{value:0}}})),this.renderOrder=-2,this.panoMesh.renderOrder=-2,this.panoMesh.position.y=.004,this.panoMesh.scale.set(i,1,i),this.add(this.panoMesh),this.currentStartTime=H(),this.needsRender=!0}setProgress(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=U(e,0,1),this.tapMotion.ended&&(this.progress===0&&this.progressOpacityMotion.set({opacity:1},500).catch(K),e===0?this.progressOpacityMotion.set({opacity:0},500).catch(K).then(()=>{this.progressMotion.set({progress:0},0).catch(K)}):this.progressMotion.set({progress:U(e*1.2,0,1)},100).catch(K)),this.progress=e)}setOpacity(e){this.opacity!==e&&(this.opacity=e=U(e,0,1),this.opacityMotion.set({opacity:e},200).catch(K))}setCurrent(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},2e3).catch(K),this.current=e,this.current===!0&&(this.currentStartTime=H()))}setLoading(e){this.loading!==e&&(this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:e?1:0},500).catch(K))}setDisabled(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({progress:e?1:0},500).catch(K))}tap(){return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(K),this.progressMotion.set({progress:0},0).catch(K),this.tapMotion.setKeyframes([{progress:0,value:{scale:1,opacity:1}},{progress:.3,value:{scale:.85,opacity:.5}},{progress:.8,value:{scale:1.05,opacity:.6}},{progress:1,value:{scale:1,opacity:1}}],600).then(()=>{this.progressOpacityMotion.set({opacity:this.progress>0?1:0},300).catch(K),this.progressMotion.set({progress:this.progress},120).catch(K)}).catch(K)):Promise.resolve()}updateTime(e,t){if(!this.progressMotion.ended){this.progressMotion.update(e);let t=this.progressMotion.value.progress;this.panoMesh.material.uniforms.progress.value=t,this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);let t=this.progressOpacityMotion.value.opacity;this.panoMesh.material.uniforms.progressOpacity.value=t,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);let t=this.opacityMotion.value.opacity;this.panoMesh.material.uniforms.opacity.value=t,this.needsRender=!0}if(this.visible=this.opacityMotion.value.opacity!==0,(!this.loadingOpacityMotion.ended||this.loadingOpacityMotion.value.opacity>0)&&(this.loadingOpacityMotion.update(e),this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingOpacityMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0),this.tapMotion.ended||(this.tapMotion.update(e),this.panoMesh.material.uniforms.tapOpacity.value=this.tapMotion.value.opacity,this.panoMesh.material.uniforms.tapScale.value=this.tapMotion.value.scale,this.needsRender=!0),this.current||!this.currentMotion.ended){this.currentMotion.update(e),this.panoMesh.material.uniforms.expandOpacity.value=this.currentMotion.value.progress;{let t=(e-this.currentStartTime-1500)/2e3;if(t%5<2){let e=1+Math.sin(Math.PI*t)/25*this.currentMotion.value.progress;this.panoMesh.material.uniforms.circleScale.value=e,this.needsRender=!0}}{let t=(e-this.currentStartTime-1500)/2e3;if(t%5<2){let e=t%1;this.panoMesh.material.uniforms.expand0.value=rh(e)*this.currentMotion.value.progress,this.needsRender=!0}}{let t=(e-this.currentStartTime-1e3)/2e3;if(t%5<2){let e=t%1;this.panoMesh.material.uniforms.expand1.value=rh(e)*this.currentMotion.value.progress,this.needsRender=!0}}}if(this.currentMotion.value.progress>.2&&this.progress===0&&this.loading===!1&&(e-this.currentStartTime-1e3)/2e3%5<2?this.ringMotion.getTargetKeyframe().value.scale!==.8&&this.ringMotion.set({scale:.8,opacity:0},600).catch(K):this.ringMotion.getTargetKeyframe().value.scale!==1&&this.ringMotion.set({scale:1,opacity:1},600).catch(K),!this.ringMotion.ended){let{scale:t,opacity:n}=this.ringMotion.value;this.ringMotion.update(e),this.panoMesh.material.uniforms.ringScale.value=t,this.panoMesh.material.uniforms.ringOpacity.value=n,this.needsRender=!0}if(!this.disableMotion.ended){let{progress:t}=this.disableMotion.value;this.disableMotion.update(e),this.panoMesh.material.uniforms.disable.value=t,this.needsRender=!0}}dispose(){this.ringMotion.dispose(),this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()}},ch=e=>e*(2-e),lh=(()=>{let e=new Float32Array([-.18,0,-.18,.18,0,-.18,-.18,0,.18,.18,0,.18]),t=new Float32Array([1,0,0,0,1,1,0,1]),n=new Uint8Array([0,2,1,2,3,1]),r=new c.BufferGeometry;return r.setAttribute(`position`,new c.BufferAttribute(e,3)),r.setAttribute(`uv`,new c.BufferAttribute(t,2)),r.setIndex(new c.BufferAttribute(n,1)),r})(),uh=`
1215
+ `,uh=class extends c.Object3D{constructor(e={}){var t,n;super();let r=(t=e.color)==null?16777215:t,i=(n=e.scale)==null?1:n;this.progress=0,this.opacity=0,this.loading=!1,this.current=!1,this.disabled=!1,this.currentMotion=new X({progress:0}),this.ringMotion=new X({scale:1,opacity:1}),this.tapMotion=new X({scale:1,opacity:1}),this.loadingOpacityMotion=new X({opacity:0}),this.progressMotion=new X({progress:0}),this.progressOpacityMotion=new X({opacity:0}),this.opacityMotion=new X({opacity:0}),this.disableMotion=new X({progress:0}),this.panoMesh=new c.Mesh(sh,new c.ShaderMaterial({blending:c.CustomBlending,blendSrc:c.SrcAlphaFactor,blendDst:c.OneMinusSrcAlphaFactor,blendSrcAlpha:c.OneFactor,blendDstAlpha:c.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0,vertexShader:ch,fragmentShader:lh,uniforms:{baseColor:{value:new c.Color(r)},circleScale:{value:1},ringScale:{value:1},ringOpacity:{value:1},loadingAngle:{value:0},loadingOpacity:{value:0},progress:{value:0},progressOpacity:{value:0},expand0:{value:0},expand1:{value:0},expandOpacity:{value:0},opacity:{value:0},tapScale:{value:1},tapOpacity:{value:1},disable:{value:0}}})),this.renderOrder=-2,this.panoMesh.renderOrder=-2,this.panoMesh.position.y=.004,this.panoMesh.scale.set(i,1,i),this.add(this.panoMesh),this.currentStartTime=H(),this.needsRender=!0}setProgress(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=U(e,0,1),this.tapMotion.ended&&(this.progress===0&&this.progressOpacityMotion.set({opacity:1},500).catch(K),e===0?this.progressOpacityMotion.set({opacity:0},500).catch(K).then(()=>{this.progressMotion.set({progress:0},0).catch(K)}):this.progressMotion.set({progress:U(e*1.2,0,1)},100).catch(K)),this.progress=e)}setOpacity(e){this.opacity!==e&&(this.opacity=e=U(e,0,1),this.opacityMotion.set({opacity:e},200).catch(K))}setCurrent(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},2e3).catch(K),this.current=e,this.current===!0&&(this.currentStartTime=H()))}setLoading(e){this.loading!==e&&(this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:e?1:0},500).catch(K))}setDisabled(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({progress:e?1:0},500).catch(K))}tap(){return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(K),this.progressMotion.set({progress:0},0).catch(K),this.tapMotion.setKeyframes([{progress:0,value:{scale:1,opacity:1}},{progress:.3,value:{scale:.85,opacity:.5}},{progress:.8,value:{scale:1.05,opacity:.6}},{progress:1,value:{scale:1,opacity:1}}],600).then(()=>{this.progressOpacityMotion.set({opacity:this.progress>0?1:0},300).catch(K),this.progressMotion.set({progress:this.progress},120).catch(K)}).catch(K)):Promise.resolve()}updateTime(e,t){if(!this.progressMotion.ended){this.progressMotion.update(e);let t=this.progressMotion.value.progress;this.panoMesh.material.uniforms.progress.value=t,this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);let t=this.progressOpacityMotion.value.opacity;this.panoMesh.material.uniforms.progressOpacity.value=t,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);let t=this.opacityMotion.value.opacity;this.panoMesh.material.uniforms.opacity.value=t,this.needsRender=!0}if(this.visible=this.opacityMotion.value.opacity!==0,(!this.loadingOpacityMotion.ended||this.loadingOpacityMotion.value.opacity>0)&&(this.loadingOpacityMotion.update(e),this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingOpacityMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0),this.tapMotion.ended||(this.tapMotion.update(e),this.panoMesh.material.uniforms.tapOpacity.value=this.tapMotion.value.opacity,this.panoMesh.material.uniforms.tapScale.value=this.tapMotion.value.scale,this.needsRender=!0),this.current||!this.currentMotion.ended){this.currentMotion.update(e),this.panoMesh.material.uniforms.expandOpacity.value=this.currentMotion.value.progress;{let t=(e-this.currentStartTime-1500)/2e3;if(t%5<2){let e=1+Math.sin(Math.PI*t)/25*this.currentMotion.value.progress;this.panoMesh.material.uniforms.circleScale.value=e,this.needsRender=!0}}{let t=(e-this.currentStartTime-1500)/2e3;if(t%5<2){let e=t%1;this.panoMesh.material.uniforms.expand0.value=oh(e)*this.currentMotion.value.progress,this.needsRender=!0}}{let t=(e-this.currentStartTime-1e3)/2e3;if(t%5<2){let e=t%1;this.panoMesh.material.uniforms.expand1.value=oh(e)*this.currentMotion.value.progress,this.needsRender=!0}}}if(this.currentMotion.value.progress>.2&&this.progress===0&&this.loading===!1&&(e-this.currentStartTime-1e3)/2e3%5<2?this.ringMotion.getTargetKeyframe().value.scale!==.8&&this.ringMotion.set({scale:.8,opacity:0},600).catch(K):this.ringMotion.getTargetKeyframe().value.scale!==1&&this.ringMotion.set({scale:1,opacity:1},600).catch(K),!this.ringMotion.ended){let{scale:t,opacity:n}=this.ringMotion.value;this.ringMotion.update(e),this.panoMesh.material.uniforms.ringScale.value=t,this.panoMesh.material.uniforms.ringOpacity.value=n,this.needsRender=!0}if(!this.disableMotion.ended){let{progress:t}=this.disableMotion.value;this.disableMotion.update(e),this.panoMesh.material.uniforms.disable.value=t,this.needsRender=!0}}dispose(){this.ringMotion.dispose(),this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()}},dh=e=>e*(2-e),fh=(()=>{let e=new Float32Array([-.18,0,-.18,.18,0,-.18,-.18,0,.18,.18,0,.18]),t=new Float32Array([1,0,0,0,1,1,0,1]),n=new Uint8Array([0,2,1,2,3,1]),r=new c.BufferGeometry;return r.setAttribute(`position`,new c.BufferAttribute(e,3)),r.setAttribute(`uv`,new c.BufferAttribute(t,2)),r.setIndex(new c.BufferAttribute(n,1)),r})(),ph=`
1216
1216
  varying vec2 vUv;
1217
1217
  #include <common>
1218
1218
  #include <logdepthbuf_pars_vertex>
@@ -1221,7 +1221,7 @@ void main() {
1221
1221
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
1222
1222
  #include <logdepthbuf_vertex>
1223
1223
  }
1224
- `,dh=`
1224
+ `,mh=`
1225
1225
  uniform vec3 baseColor;
1226
1226
  uniform float circleScale;
1227
1227
  uniform float circleOpacity;
@@ -1324,7 +1324,7 @@ void main() {
1324
1324
 
1325
1325
  gl_FragColor = vec4(gl_FragColor.rgb * baseColor, gl_FragColor.a * opacity * opacity);
1326
1326
  }
1327
- `,fh=class extends c.Object3D{constructor(e={}){var t,n;super();let r=(t=e.color)==null?16777215:t,i=(n=e.scale)==null?1:n;this.progress=0,this.opacity=0,this.loading=!1,this.current=!1,this.disabled=!1,this.currentMotion=new X({progress:0}),this.tapMotion=new X({scale:1,opacity:1}),this.loadingOpacityMotion=new X({opacity:0}),this.progressMotion=new X({progress:0}),this.progressOpacityMotion=new X({opacity:0}),this.opacityMotion=new X({opacity:0}),this.disableMotion=new X({progress:0}),this.panoMesh=new c.Mesh(lh,new c.ShaderMaterial({blending:c.CustomBlending,blendSrc:c.SrcAlphaFactor,blendDst:c.OneMinusSrcAlphaFactor,blendSrcAlpha:c.OneFactor,blendDstAlpha:c.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0,vertexShader:uh,fragmentShader:dh,uniforms:{baseColor:{value:new c.Color(r)},circleScale:{value:1},circleOpacity:{value:1},loadingAngle:{value:0},loadingOpacity:{value:0},progress:{value:0},progressOpacity:{value:0},expand0:{value:0},expand1:{value:0},expandOpacity:{value:0},opacity:{value:0},tapScale:{value:1},tapOpacity:{value:1},disable:{value:0}}})),this.renderOrder=-2,this.panoMesh.renderOrder=-2,this.panoMesh.position.y=.004,this.panoMesh.scale.set(i,1,i),this.add(this.panoMesh),this.currentStartTime=H(),this.needsRender=!0}setProgress(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=U(e,0,1),this.tapMotion.ended&&(this.progress===0&&this.progressOpacityMotion.set({opacity:1},500).catch(K),e===0?this.progressOpacityMotion.set({opacity:0},500).catch(K).then(()=>{this.progressMotion.set({progress:0},0).catch(K)}):this.progressMotion.set({progress:U(e*1.2,0,1)},100).catch(K)),this.progress=e)}setOpacity(e){this.opacity!==e&&(this.opacity=e=U(e,0,1),this.opacityMotion.set({opacity:e},200).catch(K))}setCurrent(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},2e3).catch(K),this.current=e,this.current===!0&&(this.currentStartTime=H()))}setLoading(e){this.loading!==e&&(this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:e?1:0},500).catch(K))}setDisabled(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({progress:e?1:0},500).catch(K))}tap(){return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(K),this.progressMotion.set({progress:0},0).catch(K),this.tapMotion.setKeyframes([{progress:0,value:{scale:1,opacity:1}},{progress:.3,value:{scale:.85,opacity:.5}},{progress:.8,value:{scale:1.05,opacity:.6}},{progress:1,value:{scale:1,opacity:1}}],600).then(()=>{this.progressOpacityMotion.set({opacity:this.progress>0?1:0},300).catch(K),this.progressMotion.set({progress:this.progress},120).catch(K)}).catch(K)):Promise.resolve()}updateTime(e,t){if(!this.progressMotion.ended){this.progressMotion.update(e);let t=this.progressMotion.value.progress;this.panoMesh.material.uniforms.progress.value=t,this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);let t=this.progressOpacityMotion.value.opacity;this.panoMesh.material.uniforms.progressOpacity.value=t,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);let t=this.opacityMotion.value.opacity;this.panoMesh.material.uniforms.opacity.value=t,this.needsRender=!0}if(this.visible=this.opacityMotion.value.opacity!==0,(!this.loadingOpacityMotion.ended||this.loadingOpacityMotion.value.opacity>0)&&(this.loadingOpacityMotion.update(e),this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingOpacityMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0),this.tapMotion.ended||(this.tapMotion.update(e),this.panoMesh.material.uniforms.tapOpacity.value=this.tapMotion.value.opacity,this.panoMesh.material.uniforms.tapScale.value=this.tapMotion.value.scale,this.needsRender=!0),this.panoMesh.material.uniforms.circleOpacity.value=Math.max(.6,1-Math.max(this.loadingOpacityMotion.value.opacity,this.progressOpacityMotion.value.opacity)),this.current||!this.currentMotion.ended){this.currentMotion.update(e),this.panoMesh.material.uniforms.expandOpacity.value=this.currentMotion.value.progress;{let t=(e-this.currentStartTime-1500)/2e3;if(t%5<2){let e=1+Math.sin(Math.PI*t)/25*this.currentMotion.value.progress;this.panoMesh.material.uniforms.circleScale.value=e,this.needsRender=!0}}{let t=(e-this.currentStartTime-1500)/2e3;if(t%5<2){let e=t%1;this.panoMesh.material.uniforms.expand0.value=ch(e)*this.currentMotion.value.progress,this.needsRender=!0}}{let t=(e-this.currentStartTime-1e3)/2e3;if(t%5<2){let e=t%1;this.panoMesh.material.uniforms.expand1.value=ch(e)*this.currentMotion.value.progress,this.needsRender=!0}}}if(!this.disableMotion.ended){let{progress:t}=this.disableMotion.value;this.disableMotion.update(e),this.panoMesh.material.uniforms.disable.value=t,this.needsRender=!0}}dispose(){this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()}},ph=e=>e*(2-e),mh=(()=>{let e=new Float32Array([-.18,0,-.18,.18,0,-.18,-.18,0,.18,.18,0,.18]),t=new Float32Array([1,0,0,0,1,1,0,1]),n=new Uint8Array([0,2,1,2,3,1]),r=new c.BufferGeometry;return r.setAttribute(`position`,new c.BufferAttribute(e,3)),r.setAttribute(`uv`,new c.BufferAttribute(t,2)),r.setIndex(new c.BufferAttribute(n,1)),r})(),hh=`
1327
+ `,hh=class extends c.Object3D{constructor(e={}){var t,n;super();let r=(t=e.color)==null?16777215:t,i=(n=e.scale)==null?1:n;this.progress=0,this.opacity=0,this.loading=!1,this.current=!1,this.disabled=!1,this.currentMotion=new X({progress:0}),this.tapMotion=new X({scale:1,opacity:1}),this.loadingOpacityMotion=new X({opacity:0}),this.progressMotion=new X({progress:0}),this.progressOpacityMotion=new X({opacity:0}),this.opacityMotion=new X({opacity:0}),this.disableMotion=new X({progress:0}),this.panoMesh=new c.Mesh(fh,new c.ShaderMaterial({blending:c.CustomBlending,blendSrc:c.SrcAlphaFactor,blendDst:c.OneMinusSrcAlphaFactor,blendSrcAlpha:c.OneFactor,blendDstAlpha:c.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0,vertexShader:ph,fragmentShader:mh,uniforms:{baseColor:{value:new c.Color(r)},circleScale:{value:1},circleOpacity:{value:1},loadingAngle:{value:0},loadingOpacity:{value:0},progress:{value:0},progressOpacity:{value:0},expand0:{value:0},expand1:{value:0},expandOpacity:{value:0},opacity:{value:0},tapScale:{value:1},tapOpacity:{value:1},disable:{value:0}}})),this.renderOrder=-2,this.panoMesh.renderOrder=-2,this.panoMesh.position.y=.004,this.panoMesh.scale.set(i,1,i),this.add(this.panoMesh),this.currentStartTime=H(),this.needsRender=!0}setProgress(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=U(e,0,1),this.tapMotion.ended&&(this.progress===0&&this.progressOpacityMotion.set({opacity:1},500).catch(K),e===0?this.progressOpacityMotion.set({opacity:0},500).catch(K).then(()=>{this.progressMotion.set({progress:0},0).catch(K)}):this.progressMotion.set({progress:U(e*1.2,0,1)},100).catch(K)),this.progress=e)}setOpacity(e){this.opacity!==e&&(this.opacity=e=U(e,0,1),this.opacityMotion.set({opacity:e},200).catch(K))}setCurrent(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},2e3).catch(K),this.current=e,this.current===!0&&(this.currentStartTime=H()))}setLoading(e){this.loading!==e&&(this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:e?1:0},500).catch(K))}setDisabled(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({progress:e?1:0},500).catch(K))}tap(){return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(K),this.progressMotion.set({progress:0},0).catch(K),this.tapMotion.setKeyframes([{progress:0,value:{scale:1,opacity:1}},{progress:.3,value:{scale:.85,opacity:.5}},{progress:.8,value:{scale:1.05,opacity:.6}},{progress:1,value:{scale:1,opacity:1}}],600).then(()=>{this.progressOpacityMotion.set({opacity:this.progress>0?1:0},300).catch(K),this.progressMotion.set({progress:this.progress},120).catch(K)}).catch(K)):Promise.resolve()}updateTime(e,t){if(!this.progressMotion.ended){this.progressMotion.update(e);let t=this.progressMotion.value.progress;this.panoMesh.material.uniforms.progress.value=t,this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);let t=this.progressOpacityMotion.value.opacity;this.panoMesh.material.uniforms.progressOpacity.value=t,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);let t=this.opacityMotion.value.opacity;this.panoMesh.material.uniforms.opacity.value=t,this.needsRender=!0}if(this.visible=this.opacityMotion.value.opacity!==0,(!this.loadingOpacityMotion.ended||this.loadingOpacityMotion.value.opacity>0)&&(this.loadingOpacityMotion.update(e),this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingOpacityMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0),this.tapMotion.ended||(this.tapMotion.update(e),this.panoMesh.material.uniforms.tapOpacity.value=this.tapMotion.value.opacity,this.panoMesh.material.uniforms.tapScale.value=this.tapMotion.value.scale,this.needsRender=!0),this.panoMesh.material.uniforms.circleOpacity.value=Math.max(.6,1-Math.max(this.loadingOpacityMotion.value.opacity,this.progressOpacityMotion.value.opacity)),this.current||!this.currentMotion.ended){this.currentMotion.update(e),this.panoMesh.material.uniforms.expandOpacity.value=this.currentMotion.value.progress;{let t=(e-this.currentStartTime-1500)/2e3;if(t%5<2){let e=1+Math.sin(Math.PI*t)/25*this.currentMotion.value.progress;this.panoMesh.material.uniforms.circleScale.value=e,this.needsRender=!0}}{let t=(e-this.currentStartTime-1500)/2e3;if(t%5<2){let e=t%1;this.panoMesh.material.uniforms.expand0.value=dh(e)*this.currentMotion.value.progress,this.needsRender=!0}}{let t=(e-this.currentStartTime-1e3)/2e3;if(t%5<2){let e=t%1;this.panoMesh.material.uniforms.expand1.value=dh(e)*this.currentMotion.value.progress,this.needsRender=!0}}}if(!this.disableMotion.ended){let{progress:t}=this.disableMotion.value;this.disableMotion.update(e),this.panoMesh.material.uniforms.disable.value=t,this.needsRender=!0}}dispose(){this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()}},gh=e=>e*(2-e),_h=(()=>{let e=new Float32Array([-.18,0,-.18,.18,0,-.18,-.18,0,.18,.18,0,.18]),t=new Float32Array([1,0,0,0,1,1,0,1]),n=new Uint8Array([0,2,1,2,3,1]),r=new c.BufferGeometry;return r.setAttribute(`position`,new c.BufferAttribute(e,3)),r.setAttribute(`uv`,new c.BufferAttribute(t,2)),r.setIndex(new c.BufferAttribute(n,1)),r})(),vh=`
1328
1328
  varying vec2 vUv;
1329
1329
  #include <common>
1330
1330
  #include <logdepthbuf_pars_vertex>
@@ -1333,7 +1333,7 @@ void main() {
1333
1333
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
1334
1334
  #include <logdepthbuf_vertex>
1335
1335
  }
1336
- `,gh=`
1336
+ `,yh=`
1337
1337
  #if defined(USE_MAP)
1338
1338
  uniform sampler2D map;
1339
1339
  uniform float mapAlpha;
@@ -1467,7 +1467,7 @@ void main() {
1467
1467
 
1468
1468
  gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity);
1469
1469
  }
1470
- `,_h=class extends c.Object3D{constructor(e={}){var t,n,r,i,a,o,s;super();let l=(t=e.color)==null?16777215:t,u=(n=e.scale)==null?1:n,d=e.map,f=(r=e.mapAlpha)==null?1:r,p=(i=e.mapUseColor)==null?!1:i,m=(a=e.mapUseReverse)==null?!1:a,h=(o=e.borderWidth)==null?.1:o,g=(s=e.borderColor)==null?16777215:s;this.progress=0,this.opacity=0,this.loading=!1,this.current=!1,this.disabled=!1,this.currentMotion=new X({progress:0}),this.tapMotion=new X({scale:1,opacity:1}),this.loadingOpacityMotion=new X({opacity:0}),this.progressMotion=new X({progress:0}),this.progressOpacityMotion=new X({opacity:0}),this.opacityMotion=new X({opacity:0}),this.disableMotion=new X({progress:0}),this.panoMesh=new c.Mesh(mh,new c.ShaderMaterial({blending:c.CustomBlending,blendSrc:c.SrcAlphaFactor,blendDst:c.OneMinusSrcAlphaFactor,blendSrcAlpha:c.OneFactor,blendDstAlpha:c.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0,vertexShader:hh,fragmentShader:gh,defines:{USE_COLOR:p,USE_MAP:d!==void 0,USE_BORDER:h>0,USE_REVERSE:m},uniforms:{baseColor:{value:new c.Color(l)},circleScale:{value:1},circleOpacity:{value:1},loadingAngle:{value:0},loadingOpacity:{value:0},progress:{value:0},progressOpacity:{value:0},expand0:{value:0},expand1:{value:0},expandOpacity:{value:0},opacity:{value:0},tapScale:{value:1},tapOpacity:{value:1},disable:{value:0},map:{value:d},mapAlpha:{value:f},borderWidth:{value:h},borderColor:{value:new c.Color(g)}}})),this.renderOrder=-2,this.panoMesh.renderOrder=-2,this.panoMesh.position.y=.004,this.panoMesh.scale.set(u,1,u),this.add(this.panoMesh),this.currentStartTime=H(),this.needsRender=!0}setProgress(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=U(e,0,1),this.tapMotion.ended&&(this.progress===0&&this.progressOpacityMotion.set({opacity:1},500).catch(K),e===0?this.progressOpacityMotion.set({opacity:0},500).catch(K).then(()=>{this.progressMotion.set({progress:0},0).catch(K)}):this.progressMotion.set({progress:U(e*1.2,0,1)},100).catch(K)),this.progress=e)}setOpacity(e){this.opacity!==e&&(this.opacity=e=U(e,0,1),this.opacityMotion.set({opacity:e},200).catch(K))}setCurrent(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},2e3).catch(K),this.current=e,this.current===!0&&(this.currentStartTime=H()))}setLoading(e){this.loading!==e&&(this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:e?1:0},500).catch(K))}setDisabled(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({progress:e?1:0},500).catch(K))}tap(){return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(K),this.progressMotion.set({progress:0},0).catch(K),this.tapMotion.setKeyframes([{progress:0,value:{scale:1,opacity:1}},{progress:.3,value:{scale:.85,opacity:.5}},{progress:.8,value:{scale:1.05,opacity:.6}},{progress:1,value:{scale:1,opacity:1}}],600).then(()=>{this.progressOpacityMotion.set({opacity:this.progress>0?1:0},300).catch(K),this.progressMotion.set({progress:this.progress},120).catch(K)}).catch(K)):Promise.resolve()}updateTime(e,t){if(!this.progressMotion.ended){this.progressMotion.update(e);let t=this.progressMotion.value.progress;this.panoMesh.material.uniforms.progress.value=t,this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);let t=this.progressOpacityMotion.value.opacity;this.panoMesh.material.uniforms.progressOpacity.value=t,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);let t=this.opacityMotion.value.opacity;this.panoMesh.material.uniforms.opacity.value=t,this.needsRender=!0}if(this.visible=this.opacityMotion.value.opacity!==0,(!this.loadingOpacityMotion.ended||this.loadingOpacityMotion.value.opacity>0)&&(this.loadingOpacityMotion.update(e),this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingOpacityMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0),this.tapMotion.ended||(this.tapMotion.update(e),this.panoMesh.material.uniforms.tapOpacity.value=this.tapMotion.value.opacity,this.panoMesh.material.uniforms.tapScale.value=this.tapMotion.value.scale,this.needsRender=!0),this.panoMesh.material.uniforms.circleOpacity.value=Math.max(.6,1-Math.max(this.loadingOpacityMotion.value.opacity,this.progressOpacityMotion.value.opacity)),this.current||!this.currentMotion.ended){this.currentMotion.update(e),this.panoMesh.material.uniforms.expandOpacity.value=this.currentMotion.value.progress;{let t=(e-this.currentStartTime-1500)/2e3;if(t%5<2){let e=t%1;this.panoMesh.material.uniforms.expand0.value=ph(e)*this.currentMotion.value.progress,this.needsRender=!0}}{let t=(e-this.currentStartTime-1e3)/2e3;if(t%5<2){let e=t%1;this.panoMesh.material.uniforms.expand1.value=ph(e)*this.currentMotion.value.progress,this.needsRender=!0}}}if(!this.disableMotion.ended){let{progress:t}=this.disableMotion.value;this.disableMotion.update(e),this.panoMesh.material.uniforms.disable.value=t,this.needsRender=!0}}dispose(){this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()}};function vh(e,t,n){let r=Math.abs(e-t);return r<.001||n!==void 0&&Math.abs(n-r)<.001}function yh(e,t,n){return!vh(e,t,n)}function bh(e,t){return e.distanceTo(t)<.001}function xh(e,t){return!bh(e,t)}function Sh(e){return!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`}var Ch,wh=typeof navigator<`u`?((Ch=navigator==null?void 0:navigator.userAgent)==null?``:Ch).toLowerCase():`node`;(()=>{try{let e=document.createElement(`canvas`);return!!(window.WebGLRenderingContext&&(e.getContext(`webgl`)||e.getContext(`experimental-webgl`)))}catch(e){return!1}})(),typeof history<`u`&&`pushState`in history&&`replaceState`in history&&`state`in history;var Th=/android/i.test(wh)||/webos/i.test(wh)||/ipad|iphone|ipod/i.test(wh)||/iemobile/i.test(wh)||/opera mini/i.test(wh)||/blackberry/i.test(wh)||/windows phone/i.test(wh);function Q(e,t){let n=!1,r={type:e,timeStamp:H(),get defaultPrevented(){return n},preventDefault(){n=!0}};for(let e of Object.keys(t))e in r||(r[e]=t[e]);return r}var Eh=new WeakMap;function Dh(e,t){let n=Q(e,Object.assign(Object.assign({},t),{waitUntil(e){let t=Eh.get(n);t&&t.push(e)}}));return Eh.set(n,[]),n}function Oh(e){var t;return Promise.all((t=Eh.get(e))==null?[]:t).then(K)}function kh(){return typeof location>`u`||location.protocol!==`https:`?Promise.reject(Error(`Request DeviceOrientation Permission denied.`)):typeof DeviceOrientationEvent<`u`&&typeof DeviceOrientationEvent.requestPermission==`function`?DeviceOrientationEvent.requestPermission().then(e=>{if(e==`granted`)return Promise.resolve();{let e=Error(`Request DeviceOrientation Permission denied.`);return Promise.reject(e)}}):Promise.resolve()}function Ah(){if(`xr`in navigator)return navigator.xr.isSessionSupported(`immersive-vr`).then(e=>e?Promise.resolve():Promise.reject()).then(()=>navigator.xr.requestSession(`immersive-vr`,{optionalFeatures:[`local-floor`]}).then(e=>Promise.resolve(e)));{let e=Error(`Request XR Permission denied.`);return Promise.reject(e)}}function jh(e,t){e.mode=t.mode,e.workCode=t.workCode,e.panoIndex=t.panoIndex,e.longitude=t.longitude,e.latitude=t.latitude,e.fov=t.fov,e.offset.copy(t.offset),e.distance=t.distance}function Mh(e,t){return e.workCode===t.workCode&&e.mode===t.mode&&e.panoIndex===t.panoIndex&&vh(e.longitude,t.longitude,Math.PI*2)&&vh(e.latitude,t.latitude)&&vh(e.fov,t.fov)&&bh(e.offset,t.offset)&&vh(e.distance,t.distance)}function Nh(e,t){e.longitude=t.longitude,e.latitude=t.latitude,e.fov=t.fov,e.distance=t.distance,e.offset.copy(t.offset)}function $(e){return{longitude:e.longitude,latitude:e.latitude,fov:e.fov,offset:e.offset.clone(),distance:e.distance}}function Ph(e){switch(e){case`Floorplan`:return!0;case`Mapview`:return!0;default:return!1}}function Fh(e){switch(e){case`Panorama`:return!0;case`VRPanorama`:return!0;case`XRPanorama`:return!0;case`Model`:return!0;default:return!1}}function Ih(e){for(let t in e)return!1;return!0}var Lh=new im(new class extends c.ShaderMaterial{constructor(e){super(e),this.uniforms===void 0&&(this.uniforms={}),this.defines===void 0&&(this.defines={})}getUniform(e){return this.uniforms[e].value}setUniform(e,t){Nt(this.uniforms[e],t)}}({vertexShader:`
1470
+ `,bh=class extends c.Object3D{constructor(e={}){var t,n,r,i,a,o,s;super();let l=(t=e.color)==null?16777215:t,u=(n=e.scale)==null?1:n,d=e.map,f=(r=e.mapAlpha)==null?1:r,p=(i=e.mapUseColor)==null?!1:i,m=(a=e.mapUseReverse)==null?!1:a,h=(o=e.borderWidth)==null?.1:o,g=(s=e.borderColor)==null?16777215:s;this.progress=0,this.opacity=0,this.loading=!1,this.current=!1,this.disabled=!1,this.currentMotion=new X({progress:0}),this.tapMotion=new X({scale:1,opacity:1}),this.loadingOpacityMotion=new X({opacity:0}),this.progressMotion=new X({progress:0}),this.progressOpacityMotion=new X({opacity:0}),this.opacityMotion=new X({opacity:0}),this.disableMotion=new X({progress:0}),this.panoMesh=new c.Mesh(_h,new c.ShaderMaterial({blending:c.CustomBlending,blendSrc:c.SrcAlphaFactor,blendDst:c.OneMinusSrcAlphaFactor,blendSrcAlpha:c.OneFactor,blendDstAlpha:c.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0,vertexShader:vh,fragmentShader:yh,defines:{USE_COLOR:p,USE_MAP:d!==void 0,USE_BORDER:h>0,USE_REVERSE:m},uniforms:{baseColor:{value:new c.Color(l)},circleScale:{value:1},circleOpacity:{value:1},loadingAngle:{value:0},loadingOpacity:{value:0},progress:{value:0},progressOpacity:{value:0},expand0:{value:0},expand1:{value:0},expandOpacity:{value:0},opacity:{value:0},tapScale:{value:1},tapOpacity:{value:1},disable:{value:0},map:{value:d},mapAlpha:{value:f},borderWidth:{value:h},borderColor:{value:new c.Color(g)}}})),this.renderOrder=-2,this.panoMesh.renderOrder=-2,this.panoMesh.position.y=.004,this.panoMesh.scale.set(u,1,u),this.add(this.panoMesh),this.currentStartTime=H(),this.needsRender=!0}setProgress(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=U(e,0,1),this.tapMotion.ended&&(this.progress===0&&this.progressOpacityMotion.set({opacity:1},500).catch(K),e===0?this.progressOpacityMotion.set({opacity:0},500).catch(K).then(()=>{this.progressMotion.set({progress:0},0).catch(K)}):this.progressMotion.set({progress:U(e*1.2,0,1)},100).catch(K)),this.progress=e)}setOpacity(e){this.opacity!==e&&(this.opacity=e=U(e,0,1),this.opacityMotion.set({opacity:e},200).catch(K))}setCurrent(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},2e3).catch(K),this.current=e,this.current===!0&&(this.currentStartTime=H()))}setLoading(e){this.loading!==e&&(this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:e?1:0},500).catch(K))}setDisabled(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({progress:e?1:0},500).catch(K))}tap(){return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(K),this.progressMotion.set({progress:0},0).catch(K),this.tapMotion.setKeyframes([{progress:0,value:{scale:1,opacity:1}},{progress:.3,value:{scale:.85,opacity:.5}},{progress:.8,value:{scale:1.05,opacity:.6}},{progress:1,value:{scale:1,opacity:1}}],600).then(()=>{this.progressOpacityMotion.set({opacity:this.progress>0?1:0},300).catch(K),this.progressMotion.set({progress:this.progress},120).catch(K)}).catch(K)):Promise.resolve()}updateTime(e,t){if(!this.progressMotion.ended){this.progressMotion.update(e);let t=this.progressMotion.value.progress;this.panoMesh.material.uniforms.progress.value=t,this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);let t=this.progressOpacityMotion.value.opacity;this.panoMesh.material.uniforms.progressOpacity.value=t,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);let t=this.opacityMotion.value.opacity;this.panoMesh.material.uniforms.opacity.value=t,this.needsRender=!0}if(this.visible=this.opacityMotion.value.opacity!==0,(!this.loadingOpacityMotion.ended||this.loadingOpacityMotion.value.opacity>0)&&(this.loadingOpacityMotion.update(e),this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingOpacityMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0),this.tapMotion.ended||(this.tapMotion.update(e),this.panoMesh.material.uniforms.tapOpacity.value=this.tapMotion.value.opacity,this.panoMesh.material.uniforms.tapScale.value=this.tapMotion.value.scale,this.needsRender=!0),this.panoMesh.material.uniforms.circleOpacity.value=Math.max(.6,1-Math.max(this.loadingOpacityMotion.value.opacity,this.progressOpacityMotion.value.opacity)),this.current||!this.currentMotion.ended){this.currentMotion.update(e),this.panoMesh.material.uniforms.expandOpacity.value=this.currentMotion.value.progress;{let t=(e-this.currentStartTime-1500)/2e3;if(t%5<2){let e=t%1;this.panoMesh.material.uniforms.expand0.value=gh(e)*this.currentMotion.value.progress,this.needsRender=!0}}{let t=(e-this.currentStartTime-1e3)/2e3;if(t%5<2){let e=t%1;this.panoMesh.material.uniforms.expand1.value=gh(e)*this.currentMotion.value.progress,this.needsRender=!0}}}if(!this.disableMotion.ended){let{progress:t}=this.disableMotion.value;this.disableMotion.update(e),this.panoMesh.material.uniforms.disable.value=t,this.needsRender=!0}}dispose(){this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()}};function xh(e,t,n){let r=Math.abs(e-t);return r<.001||n!==void 0&&Math.abs(n-r)<.001}function Sh(e,t,n){return!xh(e,t,n)}function Ch(e,t){return e.distanceTo(t)<.001}function wh(e,t){return!Ch(e,t)}function Th(e){return!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`}var Eh,Dh=typeof navigator<`u`?((Eh=navigator==null?void 0:navigator.userAgent)==null?``:Eh).toLowerCase():`node`;(()=>{try{let e=document.createElement(`canvas`);return!!(window.WebGLRenderingContext&&(e.getContext(`webgl`)||e.getContext(`experimental-webgl`)))}catch(e){return!1}})(),typeof history<`u`&&`pushState`in history&&`replaceState`in history&&`state`in history;var Oh=/android/i.test(Dh)||/webos/i.test(Dh)||/ipad|iphone|ipod/i.test(Dh)||/iemobile/i.test(Dh)||/opera mini/i.test(Dh)||/blackberry/i.test(Dh)||/windows phone/i.test(Dh);function Q(e,t){let n=!1,r={type:e,timeStamp:H(),get defaultPrevented(){return n},preventDefault(){n=!0}};for(let e of Object.keys(t))e in r||(r[e]=t[e]);return r}var kh=new WeakMap;function Ah(e,t){let n=Q(e,Object.assign(Object.assign({},t),{waitUntil(e){let t=kh.get(n);t&&t.push(e)}}));return kh.set(n,[]),n}function jh(e){var t;return Promise.all((t=kh.get(e))==null?[]:t).then(K)}function Mh(){return typeof location>`u`||location.protocol!==`https:`?Promise.reject(Error(`Request DeviceOrientation Permission denied.`)):typeof DeviceOrientationEvent<`u`&&typeof DeviceOrientationEvent.requestPermission==`function`?DeviceOrientationEvent.requestPermission().then(e=>{if(e==`granted`)return Promise.resolve();{let e=Error(`Request DeviceOrientation Permission denied.`);return Promise.reject(e)}}):Promise.resolve()}function Nh(){if(`xr`in navigator)return navigator.xr.isSessionSupported(`immersive-vr`).then(e=>e?Promise.resolve():Promise.reject()).then(()=>navigator.xr.requestSession(`immersive-vr`,{optionalFeatures:[`local-floor`]}).then(e=>Promise.resolve(e)));{let e=Error(`Request XR Permission denied.`);return Promise.reject(e)}}function Ph(e,t){e.mode=t.mode,e.workCode=t.workCode,e.panoIndex=t.panoIndex,e.longitude=t.longitude,e.latitude=t.latitude,e.fov=t.fov,e.offset.copy(t.offset),e.distance=t.distance}function Fh(e,t){return e.workCode===t.workCode&&e.mode===t.mode&&e.panoIndex===t.panoIndex&&xh(e.longitude,t.longitude,Math.PI*2)&&xh(e.latitude,t.latitude)&&xh(e.fov,t.fov)&&Ch(e.offset,t.offset)&&xh(e.distance,t.distance)}function Ih(e,t){e.longitude=t.longitude,e.latitude=t.latitude,e.fov=t.fov,e.distance=t.distance,e.offset.copy(t.offset)}function $(e){return{longitude:e.longitude,latitude:e.latitude,fov:e.fov,offset:e.offset.clone(),distance:e.distance}}function Lh(e){switch(e){case`Floorplan`:return!0;case`Mapview`:return!0;default:return!1}}function Rh(e){switch(e){case`Panorama`:return!0;case`VRPanorama`:return!0;case`XRPanorama`:return!0;case`Model`:return!0;default:return!1}}function zh(e){for(let t in e)return!1;return!0}var Bh=new sm(new class extends c.ShaderMaterial{constructor(e){super(e),this.uniforms===void 0&&(this.uniforms={}),this.defines===void 0&&(this.defines={})}getUniform(e){return this.uniforms[e].value}setUniform(e,t){Nt(this.uniforms[e],t)}}({vertexShader:`
1471
1471
  varying vec2 vUv;
1472
1472
  void main() {
1473
1473
  vUv = uv;
@@ -1494,9 +1494,9 @@ void main() {
1494
1494
 
1495
1495
  gl_FragColor = textureCube(cubemap, target);
1496
1496
  }
1497
- `,uniforms:{cubemap:{value:null},scaleY:{value:1}},defines:{},transparent:!0,depthTest:!1,depthWrite:!1}));function Rh(e,t,n){Lh.material.setUniform(`cubemap`,t),Lh.material.setUniform(`scaleY`,n?-1:1),Lh.render(e),Lh.material.setUniform(`cubemap`,null)}var zh=new c.Color,Bh=[],Vh=0,Hh=1;function Uh(e,t,n,r){let i=new c.WebGLRenderTarget(r.width,r.height,{depthBuffer:!1,stencilBuffer:!1,generateMipmaps:!1,magFilter:c.LinearFilter,minFilter:c.LinearFilter}),a=e.getRenderTarget();zh.copy(e.getClearColor());let o=e.getClearAlpha(),s=e.autoClear,l=e.autoClearColor,u=e.autoClearDepth,d=e.autoClearStencil,f=e.clippingPlanes;return e.autoClear=!0,e.autoClearColor=!0,e.autoClearDepth=!0,e.autoClearStencil=!0,e.clippingPlanes=Bh,e.setRenderTarget(i),e.setClearColor(Vh,Hh),Rh(e,t,n),e.setRenderTarget(a),e.setClearColor(zh,o),e.autoClear=s,e.autoClearColor=l,e.autoClearDepth=u,e.autoClearStencil=d,e.clippingPlanes=f,e.readRenderTargetPixels(i,0,0,r.width,r.height,r.data),i.dispose(),r}var Wh=(function(e,t,n,r){"use strict";var i=[``,`webkit`,`Moz`,`MS`,`ms`,`o`],a=t.createElement?t.createElement(`div`):r,o=`function`,s=Math.round,c=Math.abs,l=Date.now;function u(e,t,n){return setTimeout(v(e,n),t)}function d(e,t,n){return Array.isArray(e)?(f(e,n[t],n),!0):!1}function f(e,t,n){var i;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==r)for(i=0;i<e.length;)t.call(n,e[i],i,e),i++;else for(i in e)e.hasOwnProperty(i)&&t.call(n,e[i],i,e)}function p(t,n,r){var i=`DEPRECATED METHOD: `+n+`
1497
+ `,uniforms:{cubemap:{value:null},scaleY:{value:1}},defines:{},transparent:!0,depthTest:!1,depthWrite:!1}));function Vh(e,t,n){Bh.material.setUniform(`cubemap`,t),Bh.material.setUniform(`scaleY`,n?-1:1),Bh.render(e),Bh.material.setUniform(`cubemap`,null)}var Hh=new c.Color,Uh=[],Wh=0,Gh=1;function Kh(e,t,n,r){let i=new c.WebGLRenderTarget(r.width,r.height,{depthBuffer:!1,stencilBuffer:!1,generateMipmaps:!1,magFilter:c.LinearFilter,minFilter:c.LinearFilter}),a=e.getRenderTarget();Hh.copy(e.getClearColor());let o=e.getClearAlpha(),s=e.autoClear,l=e.autoClearColor,u=e.autoClearDepth,d=e.autoClearStencil,f=e.clippingPlanes;return e.autoClear=!0,e.autoClearColor=!0,e.autoClearDepth=!0,e.autoClearStencil=!0,e.clippingPlanes=Uh,e.setRenderTarget(i),e.setClearColor(Wh,Gh),Vh(e,t,n),e.setRenderTarget(a),e.setClearColor(Hh,o),e.autoClear=s,e.autoClearColor=l,e.autoClearDepth=u,e.autoClearStencil=d,e.clippingPlanes=f,e.readRenderTargetPixels(i,0,0,r.width,r.height,r.data),i.dispose(),r}var qh=(function(e,t,n,r){"use strict";var i=[``,`webkit`,`Moz`,`MS`,`ms`,`o`],a=t.createElement?t.createElement(`div`):r,o=`function`,s=Math.round,c=Math.abs,l=Date.now;function u(e,t,n){return setTimeout(v(e,n),t)}function d(e,t,n){return Array.isArray(e)?(f(e,n[t],n),!0):!1}function f(e,t,n){var i;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==r)for(i=0;i<e.length;)t.call(n,e[i],i,e),i++;else for(i in e)e.hasOwnProperty(i)&&t.call(n,e[i],i,e)}function p(t,n,r){var i=`DEPRECATED METHOD: `+n+`
1498
1498
  `+r+` AT
1499
- `;return function(){var n=Error(`get-stack-trace`),r=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,``).replace(/^\s+at\s+/gm,``).replace(/^Object.<anonymous>\s*\(/gm,`{anonymous}()@`):`Unknown Stack Trace`,a=e.console&&(e.console.warn||e.console.log);return a&&a.call(e.console,i,r),t.apply(this,arguments)}}var m=typeof Object.assign==`function`?Object.assign:function(e){if(e===r||e===null)throw TypeError(`Cannot convert undefined or null to object`);for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==r&&i!==null)for(var a in i)i.hasOwnProperty(a)&&(t[a]=i[a])}return t},h=p(function(e,t,n){for(var i=Object.keys(t),a=0;a<i.length;)(!n||n&&e[i[a]]===r)&&(e[i[a]]=t[i[a]]),a++;return e},`extend`,"Use `assign`."),g=p(function(e,t){return h(e,t,!0)},`merge`,"Use `assign`.");function _(e,t,n){var r=t.prototype,i=e.prototype=Object.create(r);i.constructor=e,i._super=r,n&&m(i,n)}function v(e,t){return function(){return e.apply(t,arguments)}}function y(e,t){return typeof e==o?e.apply(t&&t[0]||r,t):e}function b(e,t){return e===r?t:e}function x(e,t,n){f(T(t),function(t){e.addEventListener(t,n,!1)})}function S(e,t,n){f(T(t),function(t){e.removeEventListener(t,n,!1)})}function C(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function w(e,t){return e.indexOf(t)>-1}function T(e){return e.trim().split(/\s+/g)}function E(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var r=0;r<e.length;){if(n&&e[r][n]==t||!n&&e[r]===t)return r;r++}return-1}function D(e){return Array.prototype.slice.call(e,0)}function O(e,t,n){for(var r=[],i=[],a=0;a<e.length;){var o=t?e[a][t]:e[a];E(i,o)<0&&r.push(e[a]),i[a]=o,a++}return n&&(r=t?r.sort(function(e,n){return e[t]>n[t]}):r.sort()),r}function k(e,t){for(var n,a,o=t[0].toUpperCase()+t.slice(1),s=0;s<i.length;){if(n=i[s],a=n?n+o:t,a in e)return a;s++}return r}var A=1;function j(){return A++}function M(t){var n=t.ownerDocument||t;return n.defaultView||n.parentWindow||e}var N=/mobile|tablet|ip(ad|hone|od)|android/i,ee=`ontouchstart`in e,P=k(e,`PointerEvent`)!==r,te=ee&&N.test(navigator.userAgent),ne=`touch`,re=`pen`,ie=`mouse`,ae=`kinect`,oe=25,se=1,ce=2,F=4,le=8,ue=1,de=2,fe=4,pe=8,me=16,he=de|fe,ge=pe|me,_e=he|ge,ve=[`x`,`y`],ye=[`clientX`,`clientY`];function be(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){y(e.options.enable,[e])&&n.handler(t)},this.init()}be.prototype={handler:function(){},init:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(M(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&S(this.element,this.evEl,this.domHandler),this.evTarget&&S(this.target,this.evTarget,this.domHandler),this.evWin&&S(M(this.element),this.evWin,this.domHandler)}};function xe(e){var t;return t=e.options.inputClass||(P?Be:te?Je:ee?Qe:Ie),new t(e,Se)}function Se(e,t,n){var r=n.pointers.length,i=n.changedPointers.length,a=t&se&&r-i===0,o=t&(F|le)&&r-i===0;n.isFirst=!!a,n.isFinal=!!o,a&&(e.session={}),n.eventType=t,Ce(e,n),e.emit(`hammer.input`,n),e.recognize(n),e.session.prevInput=n}function Ce(e,t){var n=e.session,r=t.pointers,i=r.length;n.firstInput||(n.firstInput=Ee(t)),i>1&&!n.firstMultiple?n.firstMultiple=Ee(t):i===1&&(n.firstMultiple=!1);var a=n.firstInput,o=n.firstMultiple,s=o?o.center:a.center,u=t.center=De(r);t.timeStamp=l(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=Ae(s,u),t.distance=ke(s,u),we(n,t),t.offsetDirection=Oe(t.deltaX,t.deltaY);var d=I(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=d.x,t.overallVelocityY=d.y,t.overallVelocity=c(d.x)>c(d.y)?d.x:d.y,t.scale=o?Me(o.pointers,r):1,t.rotation=o?je(o.pointers,r):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,Te(n,t);var f=e.element;C(t.srcEvent.target,f)&&(f=t.srcEvent.target),t.target=f}function we(e,t){var n=t.center,r=e.offsetDelta||{},i=e.prevDelta||{},a=e.prevInput||{};(t.eventType===se||a.eventType===F)&&(i=e.prevDelta={x:a.deltaX||0,y:a.deltaY||0},r=e.offsetDelta={x:n.x,y:n.y}),t.deltaX=i.x+(n.x-r.x),t.deltaY=i.y+(n.y-r.y)}function Te(e,t){var n=e.lastInterval||t,i=t.timeStamp-n.timeStamp,a,o,s,l;if(t.eventType!=le&&(i>oe||n.velocity===r)){var u=t.deltaX-n.deltaX,d=t.deltaY-n.deltaY,f=I(i,u,d);o=f.x,s=f.y,a=c(f.x)>c(f.y)?f.x:f.y,l=Oe(u,d),e.lastInterval=t}else a=n.velocity,o=n.velocityX,s=n.velocityY,l=n.direction;t.velocity=a,t.velocityX=o,t.velocityY=s,t.direction=l}function Ee(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:s(e.pointers[n].clientX),clientY:s(e.pointers[n].clientY)},n++;return{timeStamp:l(),pointers:t,center:De(t),deltaX:e.deltaX,deltaY:e.deltaY}}function De(e){var t=e.length;if(t===1)return{x:s(e[0].clientX),y:s(e[0].clientY)};for(var n=0,r=0,i=0;i<t;)n+=e[i].clientX,r+=e[i].clientY,i++;return{x:s(n/t),y:s(r/t)}}function I(e,t,n){return{x:t/e||0,y:n/e||0}}function Oe(e,t){return e===t?ue:c(e)>=c(t)?e<0?de:fe:t<0?pe:me}function ke(e,t,n){n||(n=ve);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.sqrt(r*r+i*i)}function Ae(e,t,n){n||(n=ve);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.atan2(i,r)*180/Math.PI}function je(e,t){return Ae(t[1],t[0],ye)+Ae(e[1],e[0],ye)}function Me(e,t){return ke(t[0],t[1],ye)/ke(e[0],e[1],ye)}var Ne={mousedown:se,mousemove:ce,mouseup:F},Pe=`mousedown`,Fe=`mousemove mouseup`;function Ie(){this.evEl=Pe,this.evWin=Fe,this.pressed=!1,be.apply(this,arguments)}_(Ie,be,{handler:function(e){var t=Ne[e.type];t&se&&(e.button===0||e.button===2)&&(this.pressed=!0),t&ce&&e.which!==1&&(t=F),this.pressed&&(t&F&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:ie,srcEvent:e}))}});var Le={pointerdown:se,pointermove:ce,pointerup:F,pointercancel:le,pointerout:le},L={2:ne,3:re,4:ie,5:ae},Re=`pointerdown`,ze=`pointermove pointerup pointercancel`;e.MSPointerEvent&&!e.PointerEvent&&(Re=`MSPointerDown`,ze=`MSPointerMove MSPointerUp MSPointerCancel`);function Be(){this.evEl=Re,this.evWin=ze,be.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}_(Be,be,{handler:function(e){var t=this.store,n=!1,r=!1,i=Le[e.type.toLowerCase().replace(`ms`,``)],a=L[e.pointerType]||e.pointerType,o=a==ne,s=E(t,e.pointerId,`pointerId`);i&se&&(e.button===0||e.button===2||o)?s<0&&(t.push(e),s=t.length-1):i&(F|le)?n=!0:!o&&e.buttons===0&&(n=!0,r=!0,i=Le.pointerup),!(s<0)&&(r||(t[s]=e),this.callback(this.manager,i,{pointers:t,changedPointers:[e],pointerType:a,srcEvent:t[s]}),n&&t.splice(s,1))}});var Ve={touchstart:se,touchmove:ce,touchend:F,touchcancel:le},He=`touchstart`,Ue=`touchstart touchmove touchend touchcancel`;function We(){this.evTarget=He,this.evWin=Ue,this.started=!1,be.apply(this,arguments)}_(We,be,{handler:function(e){var t=Ve[e.type];if(t===se&&(this.started=!0),this.started){var n=Ge.call(this,e,t);t&(F|le)&&n[0].length-n[1].length===0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:ne,srcEvent:e})}}});function Ge(e,t){var n=D(e.touches),r=D(e.changedTouches);return t&(F|le)&&(n=O(n.concat(r),`identifier`,!0)),[n,r]}var Ke={touchstart:se,touchmove:ce,touchend:F,touchcancel:le},qe=`touchstart touchmove touchend touchcancel`;function Je(){this.evTarget=qe,this.targetIds={},be.apply(this,arguments)}_(Je,be,{handler:function(e){var t=Ke[e.type],n=Ye.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:ne,srcEvent:e})}});function Ye(e,t){var n=D(e.touches),r=this.targetIds;if(t&(se|ce)&&n.length===1)return r[n[0].identifier]=!0,[n,n];var i,a,o=D(e.changedTouches),s=[],c=this.target;if(a=n.filter(function(e){return C(e.target,c)}),t===se)for(i=0;i<a.length;)r[a[i].identifier]=!0,i++;for(i=0;i<o.length;)r[o[i].identifier]&&s.push(o[i]),t&(F|le)&&delete r[o[i].identifier],i++;if(s.length)return[O(a.concat(s),`identifier`,!0),s]}var Xe=2500,Ze=25;function Qe(){be.apply(this,arguments);var e=v(this.handler,this);this.touch=new Je(this.manager,e),this.mouse=new Ie(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}_(Qe,be,{handler:function(e,t,n){var r=n.pointerType==ne,i=n.pointerType==ie;if(!(i&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(r)$e.call(this,t,n);else if(i&&tt.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function $e(e,t){e&se?(this.primaryTouch=t.changedPointers[0].identifier,et.call(this,t)):e&(F|le)&&et.call(this,t)}function et(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var r=this.lastTouches;setTimeout(function(){var e=r.indexOf(n);e>-1&&r.splice(e,1)},Xe)}}function tt(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,r=0;r<this.lastTouches.length;r++){var i=this.lastTouches[r],a=Math.abs(t-i.x),o=Math.abs(n-i.y);if(a<=Ze&&o<=Ze)return!0}return!1}var nt=a?k(a.style,`touchAction`):r,rt=nt!==r,it=`compute`,at=`auto`,ot=`manipulation`,st=`none`,ct=`pan-x`,lt=`pan-y`,ut=pt();function dt(e,t){this.manager=e,this.set(t)}dt.prototype={set:function(e){e==it&&(e=this.compute()),rt&&this.manager.element.style&&ut[e]&&(this.manager.element.style[nt]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return f(this.manager.recognizers,function(t){y(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),ft(e.join(` `))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented){t.preventDefault();return}var r=this.actions,i=w(r,st)&&!ut[st],a=w(r,lt)&&!ut[lt],o=w(r,ct)&&!ut[ct];if(i){var s=e.pointers.length===1,c=e.distance<2,l=e.deltaTime<250;if(s&&c&&l)return}if(!(o&&a)&&(i||a&&n&he||o&&n&ge))return this.preventSrc(t)},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};function ft(e){if(w(e,st))return st;var t=w(e,ct),n=w(e,lt);return t&&n?st:t||n?t?ct:lt:w(e,ot)?ot:at}function pt(){if(!rt)return!1;var t={},n=e.CSS&&e.CSS.supports;return[`auto`,`manipulation`,`pan-y`,`pan-x`,`pan-x pan-y`,`none`].forEach(function(r){t[r]=n?e.CSS.supports(`touch-action`,r):!0}),t}var mt=1,ht=2,R=4,gt=8,z=gt,_t=16,vt=32;function yt(e){this.options=m({},this.defaults,e||{}),this.id=j(),this.manager=null,this.options.enable=b(this.options.enable,!0),this.state=mt,this.simultaneous={},this.requireFail=[]}yt.prototype={defaults:{},set:function(e){return m(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(d(e,`recognizeWith`,this))return this;var t=this.simultaneous;return e=St(e,this),t[e.id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return d(e,`dropRecognizeWith`,this)?this:(e=St(e,this),delete this.simultaneous[e.id],this)},requireFailure:function(e){if(d(e,`requireFailure`,this))return this;var t=this.requireFail;return e=St(e,this),E(t,e)===-1&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(d(e,`dropRequireFailure`,this))return this;e=St(e,this);var t=E(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,n=this.state;function r(n){t.manager.emit(n,e)}n<gt&&r(t.options.event+bt(n)),r(t.options.event),e.additionalEvent&&r(e.additionalEvent),n>=gt&&r(t.options.event+bt(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=vt},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(vt|mt)))return!1;e++}return!0},recognize:function(e){var t=m({},e);if(!y(this.options.enable,[this,t])){this.reset(),this.state=vt;return}this.state&(z|_t|vt)&&(this.state=mt),this.state=this.process(t),this.state&(ht|R|gt|_t)&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}};function bt(e){return e&_t?`cancel`:e&gt?`end`:e&R?`move`:e&ht?`start`:``}function xt(e){return e==me?`down`:e==pe?`up`:e==de?`left`:e==fe?`right`:``}function St(e,t){var n=t.manager;return n?n.get(e):e}function Ct(){yt.apply(this,arguments)}_(Ct,yt,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return t===0||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,r=t&(ht|R),i=this.attrTest(e);return r&&(n&le||!i)?t|_t:r||i?n&F?t|gt:t&ht?t|R:ht:vt}});function wt(){Ct.apply(this,arguments),this.pX=null,this.pY=null}_(wt,Ct,{defaults:{event:`pan`,threshold:10,pointers:1,direction:_e},getTouchAction:function(){var e=this.options.direction,t=[];return e&he&&t.push(lt),e&ge&&t.push(ct),t},directionTest:function(e){var t=this.options,n=!0,r=e.distance,i=e.direction,a=e.deltaX,o=e.deltaY;return i&t.direction||(t.direction&he?(i=a===0?ue:a<0?de:fe,n=a!=this.pX,r=Math.abs(e.deltaX)):(i=o===0?ue:o<0?pe:me,n=o!=this.pY,r=Math.abs(e.deltaY))),e.direction=i,n&&r>t.threshold&&i&t.direction},attrTest:function(e){return Ct.prototype.attrTest.call(this,e)&&(this.state&ht||!(this.state&ht)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=xt(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}});function Tt(){Ct.apply(this,arguments)}_(Tt,Ct,{defaults:{event:`pinch`,threshold:0,pointers:2},getTouchAction:function(){return[st]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&ht)},emit:function(e){if(e.scale!==1){var t=e.scale<1?`in`:`out`;e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}});function Et(){yt.apply(this,arguments),this._timer=null,this._input=null}_(Et,yt,{defaults:{event:`press`,pointers:1,time:251,threshold:9},getTouchAction:function(){return[at]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,i=e.deltaTime>t.time;if(this._input=e,!r||!n||e.eventType&(F|le)&&!i)this.reset();else if(e.eventType&se)this.reset(),this._timer=u(function(){this.state=z,this.tryEmit()},t.time,this);else if(e.eventType&F)return z;return vt},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===z&&(e&&e.eventType&F?this.manager.emit(this.options.event+`up`,e):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}});function Dt(){Ct.apply(this,arguments)}_(Dt,Ct,{defaults:{event:`rotate`,threshold:0,pointers:2},getTouchAction:function(){return[st]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&ht)}});function Ot(){Ct.apply(this,arguments)}_(Ot,Ct,{defaults:{event:`swipe`,threshold:10,velocity:.3,direction:he|ge,pointers:1},getTouchAction:function(){return wt.prototype.getTouchAction.call(this)},attrTest:function(e){var t=this.options.direction,n;return t&(he|ge)?n=e.overallVelocity:t&he?n=e.overallVelocityX:t&ge&&(n=e.overallVelocityY),this._super.attrTest.call(this,e)&&t&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&c(n)>this.options.velocity&&e.eventType&F},emit:function(e){var t=xt(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}});function kt(){yt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}_(kt,yt,{defaults:{event:`tap`,pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ot]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,i=e.deltaTime<t.time;if(this.reset(),e.eventType&se&&this.count===0)return this.failTimeout();if(r&&i&&n){if(e.eventType!=F)return this.failTimeout();var a=this.pTime?e.timeStamp-this.pTime<t.interval:!0,o=!this.pCenter||ke(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,!o||!a?this.count=1:this.count+=1,this._input=e,this.count%t.taps===0)return this.hasRequireFailures()?(this._timer=u(function(){this.state=z,this.tryEmit()},t.interval,this),ht):z}return vt},failTimeout:function(){return this._timer=u(function(){this.state=vt},this.options.interval,this),vt},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==z&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function At(e,t){return t=t||{},t.recognizers=b(t.recognizers,At.defaults.preset),new B(e,t)}At.VERSION=`2.0.7`,At.defaults={domEvents:!1,touchAction:it,enable:!0,inputTarget:null,inputClass:null,preset:[[Dt,{enable:!1}],[Tt,{enable:!1},[`rotate`]],[Ot,{direction:he}],[wt,{direction:he},[`swipe`]],[kt],[kt,{event:`doubletap`,taps:2},[`tap`]],[Et]],cssProps:{userSelect:`none`,touchSelect:`none`,touchCallout:`none`,contentZooming:`none`,userDrag:`none`,tapHighlightColor:`rgba(0,0,0,0)`}};var jt=1,Mt=2;function B(e,t){this.options=m({},At.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=xe(this),this.touchAction=new dt(this,this.options.touchAction),Nt(this,!0),f(this.options.recognizers,function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])},this)}B.prototype={set:function(e){return m(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?Mt:jt},recognize:function(e){var t=this.session;if(!t.stopped){this.touchAction.preventDefaults(e);var n,r=this.recognizers,i=t.curRecognizer;(!i||i&&i.state&z)&&(i=t.curRecognizer=null);for(var a=0;a<r.length;)n=r[a],t.stopped!==Mt&&(!i||n==i||n.canRecognizeWith(i))?n.recognize(e):n.reset(),!i&&n.state&(ht|R|gt)&&(i=t.curRecognizer=n),a++}},get:function(e){if(e instanceof yt)return e;for(var t=this.recognizers,n=0;n<t.length;n++)if(t[n].options.event==e)return t[n];return null},add:function(e){if(d(e,`add`,this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(d(e,`remove`,this))return this;if(e=this.get(e),e){var t=this.recognizers,n=E(t,e);n!==-1&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==r&&t!==r){var n=this.handlers;return f(T(e),function(e){n[e]=n[e]||[],n[e].push(t)}),this}},off:function(e,t){if(e!==r){var n=this.handlers;return f(T(e),function(e){t?n[e]&&n[e].splice(E(n[e],t),1):delete n[e]}),this}},emit:function(e,t){this.options.domEvents&&Pt(e,t);var n=this.handlers[e]&&this.handlers[e].slice();if(!(!n||!n.length)){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var r=0;r<n.length;)n[r](t),r++}},destroy:function(){this.element&&Nt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Nt(e,t){var n=e.element;if(n.style){var r;f(e.options.cssProps,function(i,a){r=k(n.style,a),t?(e.oldCssProps[r]=n.style[r],n.style[r]=i):n.style[r]=e.oldCssProps[r]||``}),t||(e.oldCssProps={})}}function Pt(e,n){var r=t.createEvent(`Event`);r.initEvent(e,!0,!0),r.gesture=n,n.target.dispatchEvent(r)}return m(At,{INPUT_START:se,INPUT_MOVE:ce,INPUT_END:F,INPUT_CANCEL:le,STATE_POSSIBLE:mt,STATE_BEGAN:ht,STATE_CHANGED:R,STATE_ENDED:gt,STATE_RECOGNIZED:z,STATE_CANCELLED:_t,STATE_FAILED:vt,DIRECTION_NONE:ue,DIRECTION_LEFT:de,DIRECTION_RIGHT:fe,DIRECTION_UP:pe,DIRECTION_DOWN:me,DIRECTION_HORIZONTAL:he,DIRECTION_VERTICAL:ge,DIRECTION_ALL:_e,Manager:B,Input:be,TouchAction:dt,TouchInput:Je,MouseInput:Ie,PointerEventInput:Be,TouchMouseInput:Qe,SingleTouchInput:We,Recognizer:yt,AttrRecognizer:Ct,Tap:kt,Pan:wt,Swipe:Ot,Pinch:Tt,Rotate:Dt,Press:Et,on:x,off:S,each:f,merge:g,extend:h,assign:m,inherit:_,bindFn:v,prefixed:k}),At})(typeof window<`u`?window:{},typeof document<`u`?document:{},`Hammer`),Gh=class e extends ln{static parseArgs(t){return t instanceof e?t:Object.assign({},t)}static initAnimationEndState(e){var t,n,r,i,a,o,s,c;let l=this.parseArgs(e),{state:u,currentState:d}=l.initial,f=typeof u.panoIndex==`number`?{workCode:(r=(t=u.workCode)==null?(n=l.works[0])==null?void 0:n.workCode:t)==null?``:r,panoIndex:u.panoIndex}:{workCode:d.workCode,panoIndex:d.panoIndex};return Object.assign(Object.assign({},f),{mode:``,longitude:(i=u.longitude)==null?d.longitude:i,latitude:(a=u.latitude)==null?d.latitude:a,fov:(o=u.fov)==null?d.fov:o,offset:(s=u.offset)==null?d.offset:s,distance:(c=u.distance)==null?d.distance:c})}constructor(t){var n,r,i;super();let a=e.parseArgs(t);this.mode=``,this.pending=new Set,this.userAction=a.initial.userAction,this.destroyed=!1,this.fiveId=a.fiveId,this.scene=a.scene,this.modelScene=a.modelScene,this.xrCustomObjectsScene=a.xrCustomObjectsScene,this.helper=a.helper,this.camera=a.camera,this.renderer=a.renderer,this.viewport=a.viewport,this.element=a.element,this.enableWheel=a.enableWheel,this.works=a.works,this.imageOptions=a.imageOptions,this.videoTexture=a.videoTexture,this.extraElements=a.extraElements,this.initial=a.initial,this.currentPano=typeof this.initial.state.panoIndex==`number`?{workCode:(i=(n=this.initial.state.workCode)==null?(r=a.works[0])==null?void 0:r.workCode:n)==null?``:i,panoIndex:this.initial.state.panoIndex}:{workCode:this.initial.currentState.workCode,panoIndex:this.initial.currentState.panoIndex},this.needsRender=!0,this.cameraMotion=new X({longitude:{value:this.camera.pose.longitude,circle:[0,Math.PI*2]},latitude:this.camera.pose.latitude,fov:this.camera.pose.fov}),this.inMomentumMovement=null,this.eventUnbinds=[a.element].concat(a.extraElements||[]).map(e=>this.bindEvents(e)),this.initAnimationIsReady=!1,this.pending.add(`init-animation`),this.initAnimationReady=new Promise(e=>{si.shared.add(()=>{this.initAnimation().then(()=>{this.initAnimationIsReady=!0,this.pending.delete(`init-animation`),e()})},!0,0)})}updateConfiguration(e){return!0}destroy(){var e;this.stopMomentumMovement(),this.destroyed=!0,this.off(),this.cameraMotion.dispose();for(let e of this.eventUnbinds)e();this.panState=void 0,(e=this.pressState)==null||e.stop(),this.pressState=void 0}isReady(){return this.inMomentumMovement===null&&this.pending.size===0&&this.cameraMotion.ended===!0}bindExtraElement(e){for(let t of this.eventUnbinds)if(t.element===e)return;this.eventUnbinds.push(this.bindEvents(e))}unbindExtraElement(e){let t=[];for(let n of this.eventUnbinds)n.element===e?n():t.push(n);this.eventUnbinds=t}updateModel(e){this.needsRender=!0}updateWork(e,t,n,r){return this.works=e,this.userAction=r,!1}updateTime(e,t,...n){if(this.destroyed)return;let r={};this.cameraMotion.ended&&(this.cameraMotion.update(e),r.longitude=this.cameraMotion.value.longitude,r.latitude=this.cameraMotion.value.latitude,r.fov=this.cameraMotion.value.fov),Ih(r)&&this.setCamera(r)}render(){return!1}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={};return e.longitude!==void 0&&(r.longitude=e.longitude),e.latitude!==void 0&&(r.latitude=e.latitude),e.fov!==void 0&&(r.fov=e.fov),this.cameraMotion.set(r,t).catch(K)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.cameraMotion.setKeyframes(r,t)})}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(H())[1];return Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance})}initAnimation(){let{state:t,currentState:n,duration:r,userAction:i}=this.initial,a=e.initAnimationEndState(this);return this.userAction=i,this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:a,userAction:this.userAction})),this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:a,userAction:this.userAction})),Promise.resolve()}setCamera(e={}){var t,n,r,i,a;let o=(t=e.longitude)==null?this.camera.pose.longitude:t,s=(n=e.latitude)==null?this.camera.pose.latitude:n,c=(r=e.fov)==null?this.camera.pose.fov:r,l=(i=e.distance)==null?this.camera.pose.distance:i,u=(a=e.offset)==null?this.camera.pose.offset:a,d=yh(o,this.camera.pose.longitude,Math.PI*2)||yh(s,this.camera.pose.latitude),f=yh(c,this.camera.pose.fov),p=yh(l,this.camera.pose.distance),m=xh(u,this.camera.pose.offset);(f||d||m||p)&&(this.camera.setFromPose({longitude:o,latitude:s,fov:c,distance:l,offset:u}),this.emit(`camera.update`,Q(`camera.update`,{userAction:this.userAction,state:Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:o,latitude:s,fov:c,offset:u,distance:l})})),this.needsRender=!0)}stopMomentumMovement(){if(this.inMomentumMovement&&this.inMomentumMovement.event&&!this.inMomentumMovement.event.defaultPrevented&&!this.inMomentumMovement.event.isFinal){let e=Q(`gesture.momentum`,Object.assign(Object.assign({},this.inMomentumMovement.event),{isFirst:!1,isFinal:!0}));this.emit(`gesture.fire`,e),this.emit(`gesture.momentum`,e)}this.inMomentumMovement=null}onPanGesture(e){this.stopMomentumMovement(),this.emit(`gesture.pan`,e)}onTapGesture(e){this.stopMomentumMovement(),this.emit(`gesture.tap`,e)}onDblTapGesture(e){this.stopMomentumMovement(),this.emit(`gesture.dbltap`,e),!e.defaultPrevented&&(e.type=`gesture.tap`,this.onTapGesture(e))}onPressGesture(e){this.stopMomentumMovement(),this.emit(`gesture.press`,e)}onPinchGesture(e){this.stopMomentumMovement(),this.emit(`gesture.pinch`,e)}onMouseWheel(e){this.stopMomentumMovement(),this.emit(`gesture.mousewheel`,e)}onMouseMove(e){this.stopMomentumMovement(),this.emit(`gesture.mousemove`,e)}relativeClientPosition(e){let{top:t,left:n,width:r,height:i}=this.element.getBoundingClientRect();return n+=r*this.viewport.left,t+=i*(1-this.viewport.bottom-this.viewport.height),r*=this.viewport.width,i*=this.viewport.height,new c.Vector2((e.x-n)/r*2-1,-(e.y-t)/i*2+1)}createRaycasterFromCamera(e,t){let n=new c.Raycaster;return n.params.Points={threshold:.1},n.firstHitOnly=!0,n.near=t.near,n.far=t.far,n.setFromCamera(e,this.camera),n}bindEvents(e){let t=e=>{let t=this.relativeClientPosition(e);return!(Math.abs(t.x)>1||Math.abs(t.y)>1)},n=e=>({button:`button`in e?e.button:0,buttons:`buttons`in e?e.buttons:0,shiftKey:`shiftKey`in e?e.shiftKey:!1,ctrlKey:`ctrlKey`in e?e.ctrlKey:!1,altKey:`altKey`in e?e.altKey:!1,metaKey:`metaKey`in e?e.metaKey:!1}),r=new Wh.Manager(e),i=e=>e.session.firstInput||null,a=new Wh.Pan({threshold:10,pointers:0}),o=new Wh.Tap({interval:410}),s=new Wh.Pinch({threshold:0,pointers:2});r.add([a,o,s]),r.on(`panstart pan`,e=>{let a=n(e.srcEvent),o=i(r);if(o&&!t(o.center))return;let s=Q(`gesture.pan`,{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})}),isFirst:e.isFirst||e.type==`panstart`,isFinal:e.isFinal,scale:e.scale,center:(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})})(e.center),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,s),this.onPanGesture(s),v()}),r.on(`tap`,e=>{let a=n(e.srcEvent);if(e.pointerType===`mouse`&&a.button!==0)return;let o=i(r);if(o&&!t(o.center))return;let s=Q(`gesture.tap`,{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})}),isFirst:!0,isFinal:!0,scale:e.scale,center:(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})})(e.center),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,s),this.onTapGesture(s),v()}),r.on(`pinchstart pinch pinchend`,e=>{let a=n(e.srcEvent),o=i(r);if(o&&!t(o.center))return;let s=Q(`gesture.pinch`,{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map(e=>{var t;let n=this.relativeClientPosition(e),r=new c.Raycaster;return r.params.Points={threshold:.1},r.setFromCamera(n,this.camera),Object.assign(Object.assign({x:e.x,y:e.y,delta:(t=e.delta)==null?0:t},a),{coords:n,raycaster:r})}),isFirst:e.type===`pinchstart`,isFinal:e.type===`pinchend`,scale:e.scale,center:(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})})(e.center),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,s),this.onPinchGesture(s),v()}),r.on(`dbltap`,e=>{let a=n(e.srcEvent);if(e.pointerType===`mouse`&&a.button!==0)return;let o=i(r);if(o&&!t(o.center))return;let s=Q(`gesture.dbltap`,{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})}),isFirst:!0,isFinal:!0,scale:e.scale,center:(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})})(e.center),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,s),this.onDblTapGesture(s),v()});let l=null,u=null,d=(e,t,r)=>{let i={x:r.clientX,y:r.clientY},a=this.relativeClientPosition(i),o=this.createRaycasterFromCamera(a,this.camera),s=Object.assign(Object.assign(Object.assign(Object.assign({},i),{coords:a,raycaster:o}),n(r)),{delta:0}),c=e===`pinchend`?t:t-r.deltaY/280;return Q(`gesture.pinch`,{target:r.target,pointerType:`mouse`,srcEvent:r,pointers:[Object.assign({},s)],isFirst:e===`pinchstart`,isFinal:e===`pinchend`,scale:U(c,.1,10),center:Object.assign({},s),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))})},f=e=>{var r;if(t({x:e.clientX,y:e.clientY})){if(e.preventDefault(),e.ctrlKey){let t=(r=l==null?void 0:l.prevEvent.scale)==null?1:r,n=d(l?`pinch`:`pinchstart`,t,e);this.emit(`gesture.fire`,n),l===null?l={firstEvent:n,prevEvent:n}:l.prevEvent=n,this.emit(`gesture.fire`,n),this.onPinchGesture(n),u!==null&&window.clearTimeout(u),u=window.setTimeout(()=>{var t;u=null;let n=d(`pinchend`,(t=l==null?void 0:l.prevEvent.scale)==null?1:t,e);this.emit(`gesture.fire`,n),l=null,this.onPinchGesture(n)},200)}else{let t=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,r=this.mouseWheelState!==void 0,i={x:e.clientX,y:e.clientY},a=this.relativeClientPosition(i),o=this.createRaycasterFromCamera(a,this.camera),s=Object.assign(Object.assign(Object.assign(Object.assign({},i),{coords:a,raycaster:o}),n(e)),{delta:t}),c=Q(`gesture.mousewheel`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign({},s)],isFirst:r,isFinal:!1,scale:0,center:Object.assign({},s),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,c),this.onMouseWheel(c),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:setTimeout(()=>{this.mouseWheelState=void 0;let t=Q(`gesture.mousewheel`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign(Object.assign({},s),{delta:0})],isFirst:!1,isFinal:!0,scale:0,center:Object.assign(Object.assign({},s),{delta:0}),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,t),this.onMouseWheel(t)},100)}}v()}},p=e=>{if(Th)return;if(!t({x:e.clientX,y:e.clientY})){m();return}let r=!1;this.mouseMoveState||(r=!0);let i={x:e.clientX,y:e.clientY},a=this.relativeClientPosition(i),o=this.createRaycasterFromCamera(a,this.camera),s=Object.assign(Object.assign(Object.assign(Object.assign({},i),{coords:a,raycaster:o}),n(e)),{delta:0}),c=Q(`gesture.mousemove`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign({},s)],isFirst:r,isFinal:!1,scale:0,center:Object.assign({},s),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,c),this.mouseMoveState={timeStamp:H(),event:c},this.onMouseMove(c),this.pressState&&Math.abs(e.clientX-this.pressState.event.center.y)>10&&Math.abs(e.clientY-this.pressState.event.center.y)>10&&v()},m=()=>{if(this.mouseMoveState){let e=Q(this.mouseMoveState.event.type,Object.assign(Object.assign({},this.mouseMoveState.event),{isFinal:!0}));this.emit(`gesture.fire`,e),this.mouseMoveState=void 0,this.onMouseMove(e)}v()},h=e=>{if(!t(e.center)){v();return}let n=!1;this.pressState||(n=!0,this.pressState={event:e,timeStamp:H(),stop:K});let r=H()-this.pressState.timeStamp,i=Q(this.pressState.event.type,Object.assign(Object.assign({},this.pressState.event),{isFirst:n,isFinal:!1,center:Object.assign(Object.assign({},this.pressState.event.center),{delta:r}),pointers:this.pressState.event.pointers.map(e=>Object.assign(Object.assign({},e),{delta:r}))}));this.emit(`gesture.fire`,i),this.onPressGesture(i),this.pressState&&(this.pressState.stop=si.shared.add(t=>{h(e)},!0,1))},g=e=>{if(v(),e.touches.length>1||e.changedTouches.length<=0)return;let t={x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY},r=this.relativeClientPosition(t),i=this.createRaycasterFromCamera(r,this.camera),a=Object.assign(Object.assign(Object.assign(Object.assign({},t),{coords:r,raycaster:i}),n(e)),{delta:0}),o=Q(`gesture.press`,{target:e.target,pointerType:`touch`,srcEvent:e,pointers:[Object.assign({},a)],isFirst:!1,isFinal:!1,scale:0,center:a,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,o),h(o)},_=e=>{v();let t={x:e.clientX,y:e.clientY},r=this.relativeClientPosition(t),i=this.createRaycasterFromCamera(r,this.camera),a=Object.assign(Object.assign(Object.assign(Object.assign({},t),{coords:r,raycaster:i}),n(e)),{delta:0}),o=Q(`gesture.press`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign({},a)],isFirst:!1,isFinal:!1,scale:0,center:a,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,o),h(o)},v=()=>{var e;if(this.pressState){let t=H()-this.pressState.timeStamp,n=Q(this.pressState.event.type,Object.assign(Object.assign({},this.pressState.event),{center:Object.assign(Object.assign({},this.pressState.event.center),{delta:t}),isFirst:!1,isFinal:!0,pointers:this.pressState.event.pointers.map(e=>Object.assign(Object.assign({},e),{delta:t}))}));this.emit(`gesture.fire`,n),this.onPressGesture(n),(e=this.pressState)==null||e.stop(),this.pressState=void 0}},y=null,b=e=>{var t,r,i;let a=!1,o=!1;switch(e.type){case`gesturestart`:a=!0;break;case`gestureend`:o=!0;break;default:break}let s={x:(t=e.clientX)==null?0:t,y:(r=e.clientY)==null?0:r},c=this.relativeClientPosition(s),l=this.createRaycasterFromCamera(c,this.camera),u=Object.assign(Object.assign(Object.assign(Object.assign({},s),{coords:c,raycaster:l}),n(e)),{delta:0});return Q(`gesture.pinch`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign({},u)],isFirst:a,isFinal:o,scale:(i=e.scale)==null?1:i,center:Object.assign({},u),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))})},x=e=>{if(e.preventDefault(),Th)return;let n=b(e);this.emit(`gesture.fire`,n),y={firstEvent:n};let r=y.firstEvent;r&&!t(r.center)||this.onPinchGesture(n)},S=e=>{if(e.preventDefault(),Th||!y)return;let n=y.firstEvent;if(n&&!t(n.center))return;let r=b(e);this.emit(`gesture.fire`,r),this.onPinchGesture(r)},C=e=>{if(e.preventDefault(),Th||!y)return;let n=y.firstEvent;if(y=null,n&&!t(n.center))return;let r=b(e);this.emit(`gesture.fire`,r),this.onPinchGesture(r)},w=t=>{if(t&&typeof t.preventDefault==`function`&&t.currentTarget===e&&t.preventDefault(),typeof getSelection==`function`){let e=getSelection();e&&e.focusNode&&(e.removeAllRanges&&e.removeAllRanges(),e.empty&&e.empty())}};return this.enableWheel&&e.addEventListener(`wheel`,f,{passive:!1}),e.addEventListener(`mousemove`,p,!1),e.addEventListener(`mouseout`,m,!1),e.addEventListener(`touchstart`,g,{passive:!0}),e.addEventListener(`touchend`,v,!1),e.addEventListener(`touchcancel`,v,!1),e.addEventListener(`mousedown`,_,!1),e.addEventListener(`mouseup`,v,!1),e.addEventListener(`gesturestart`,x,{passive:!1}),e.addEventListener(`gesturechange`,S,{passive:!1}),e.addEventListener(`gestureend`,C,{passive:!1}),e.addEventListener(`touchstart`,w,{passive:!1}),e.addEventListener(`contextmenu`,w,!1),Object.assign(()=>{r.destroy(),e.removeEventListener(`wheel`,f,!1),e.removeEventListener(`mousemove`,p,!1),e.removeEventListener(`mouseout`,m,!1),e.removeEventListener(`touchstart`,g,!1),e.removeEventListener(`touchend`,v,!1),e.removeEventListener(`touchcancel`,v,!1),e.removeEventListener(`mousedown`,_,!1),e.removeEventListener(`mouseup`,v,!1),e.removeEventListener(`gesturestart`,x,!1),e.removeEventListener(`gesturechange`,S,!1),e.removeEventListener(`gestureend`,C,!1),e.removeEventListener(`touchstart`,w,!1),e.removeEventListener(`contextmenu`,w,!1)},{element:e})}},Kh=new c.CircleBufferGeometry(.1,16),qh=new c.ShaderMaterial({vertexShader:`
1499
+ `;return function(){var n=Error(`get-stack-trace`),r=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,``).replace(/^\s+at\s+/gm,``).replace(/^Object.<anonymous>\s*\(/gm,`{anonymous}()@`):`Unknown Stack Trace`,a=e.console&&(e.console.warn||e.console.log);return a&&a.call(e.console,i,r),t.apply(this,arguments)}}var m=typeof Object.assign==`function`?Object.assign:function(e){if(e===r||e===null)throw TypeError(`Cannot convert undefined or null to object`);for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==r&&i!==null)for(var a in i)i.hasOwnProperty(a)&&(t[a]=i[a])}return t},h=p(function(e,t,n){for(var i=Object.keys(t),a=0;a<i.length;)(!n||n&&e[i[a]]===r)&&(e[i[a]]=t[i[a]]),a++;return e},`extend`,"Use `assign`."),g=p(function(e,t){return h(e,t,!0)},`merge`,"Use `assign`.");function _(e,t,n){var r=t.prototype,i=e.prototype=Object.create(r);i.constructor=e,i._super=r,n&&m(i,n)}function v(e,t){return function(){return e.apply(t,arguments)}}function y(e,t){return typeof e==o?e.apply(t&&t[0]||r,t):e}function b(e,t){return e===r?t:e}function x(e,t,n){f(T(t),function(t){e.addEventListener(t,n,!1)})}function S(e,t,n){f(T(t),function(t){e.removeEventListener(t,n,!1)})}function C(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function w(e,t){return e.indexOf(t)>-1}function T(e){return e.trim().split(/\s+/g)}function E(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var r=0;r<e.length;){if(n&&e[r][n]==t||!n&&e[r]===t)return r;r++}return-1}function D(e){return Array.prototype.slice.call(e,0)}function O(e,t,n){for(var r=[],i=[],a=0;a<e.length;){var o=t?e[a][t]:e[a];E(i,o)<0&&r.push(e[a]),i[a]=o,a++}return n&&(r=t?r.sort(function(e,n){return e[t]>n[t]}):r.sort()),r}function k(e,t){for(var n,a,o=t[0].toUpperCase()+t.slice(1),s=0;s<i.length;){if(n=i[s],a=n?n+o:t,a in e)return a;s++}return r}var A=1;function j(){return A++}function M(t){var n=t.ownerDocument||t;return n.defaultView||n.parentWindow||e}var N=/mobile|tablet|ip(ad|hone|od)|android/i,ee=`ontouchstart`in e,P=k(e,`PointerEvent`)!==r,te=ee&&N.test(navigator.userAgent),ne=`touch`,re=`pen`,ie=`mouse`,ae=`kinect`,oe=25,se=1,ce=2,F=4,le=8,ue=1,de=2,fe=4,pe=8,me=16,he=de|fe,ge=pe|me,_e=he|ge,ve=[`x`,`y`],ye=[`clientX`,`clientY`];function be(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){y(e.options.enable,[e])&&n.handler(t)},this.init()}be.prototype={handler:function(){},init:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(M(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&S(this.element,this.evEl,this.domHandler),this.evTarget&&S(this.target,this.evTarget,this.domHandler),this.evWin&&S(M(this.element),this.evWin,this.domHandler)}};function xe(e){var t;return t=e.options.inputClass||(P?Be:te?Je:ee?Qe:Ie),new t(e,Se)}function Se(e,t,n){var r=n.pointers.length,i=n.changedPointers.length,a=t&se&&r-i===0,o=t&(F|le)&&r-i===0;n.isFirst=!!a,n.isFinal=!!o,a&&(e.session={}),n.eventType=t,Ce(e,n),e.emit(`hammer.input`,n),e.recognize(n),e.session.prevInput=n}function Ce(e,t){var n=e.session,r=t.pointers,i=r.length;n.firstInput||(n.firstInput=Ee(t)),i>1&&!n.firstMultiple?n.firstMultiple=Ee(t):i===1&&(n.firstMultiple=!1);var a=n.firstInput,o=n.firstMultiple,s=o?o.center:a.center,u=t.center=De(r);t.timeStamp=l(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=Ae(s,u),t.distance=ke(s,u),we(n,t),t.offsetDirection=Oe(t.deltaX,t.deltaY);var d=I(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=d.x,t.overallVelocityY=d.y,t.overallVelocity=c(d.x)>c(d.y)?d.x:d.y,t.scale=o?Me(o.pointers,r):1,t.rotation=o?je(o.pointers,r):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,Te(n,t);var f=e.element;C(t.srcEvent.target,f)&&(f=t.srcEvent.target),t.target=f}function we(e,t){var n=t.center,r=e.offsetDelta||{},i=e.prevDelta||{},a=e.prevInput||{};(t.eventType===se||a.eventType===F)&&(i=e.prevDelta={x:a.deltaX||0,y:a.deltaY||0},r=e.offsetDelta={x:n.x,y:n.y}),t.deltaX=i.x+(n.x-r.x),t.deltaY=i.y+(n.y-r.y)}function Te(e,t){var n=e.lastInterval||t,i=t.timeStamp-n.timeStamp,a,o,s,l;if(t.eventType!=le&&(i>oe||n.velocity===r)){var u=t.deltaX-n.deltaX,d=t.deltaY-n.deltaY,f=I(i,u,d);o=f.x,s=f.y,a=c(f.x)>c(f.y)?f.x:f.y,l=Oe(u,d),e.lastInterval=t}else a=n.velocity,o=n.velocityX,s=n.velocityY,l=n.direction;t.velocity=a,t.velocityX=o,t.velocityY=s,t.direction=l}function Ee(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:s(e.pointers[n].clientX),clientY:s(e.pointers[n].clientY)},n++;return{timeStamp:l(),pointers:t,center:De(t),deltaX:e.deltaX,deltaY:e.deltaY}}function De(e){var t=e.length;if(t===1)return{x:s(e[0].clientX),y:s(e[0].clientY)};for(var n=0,r=0,i=0;i<t;)n+=e[i].clientX,r+=e[i].clientY,i++;return{x:s(n/t),y:s(r/t)}}function I(e,t,n){return{x:t/e||0,y:n/e||0}}function Oe(e,t){return e===t?ue:c(e)>=c(t)?e<0?de:fe:t<0?pe:me}function ke(e,t,n){n||(n=ve);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.sqrt(r*r+i*i)}function Ae(e,t,n){n||(n=ve);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.atan2(i,r)*180/Math.PI}function je(e,t){return Ae(t[1],t[0],ye)+Ae(e[1],e[0],ye)}function Me(e,t){return ke(t[0],t[1],ye)/ke(e[0],e[1],ye)}var Ne={mousedown:se,mousemove:ce,mouseup:F},Pe=`mousedown`,Fe=`mousemove mouseup`;function Ie(){this.evEl=Pe,this.evWin=Fe,this.pressed=!1,be.apply(this,arguments)}_(Ie,be,{handler:function(e){var t=Ne[e.type];t&se&&(e.button===0||e.button===2)&&(this.pressed=!0),t&ce&&e.which!==1&&(t=F),this.pressed&&(t&F&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:ie,srcEvent:e}))}});var Le={pointerdown:se,pointermove:ce,pointerup:F,pointercancel:le,pointerout:le},L={2:ne,3:re,4:ie,5:ae},Re=`pointerdown`,ze=`pointermove pointerup pointercancel`;e.MSPointerEvent&&!e.PointerEvent&&(Re=`MSPointerDown`,ze=`MSPointerMove MSPointerUp MSPointerCancel`);function Be(){this.evEl=Re,this.evWin=ze,be.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}_(Be,be,{handler:function(e){var t=this.store,n=!1,r=!1,i=Le[e.type.toLowerCase().replace(`ms`,``)],a=L[e.pointerType]||e.pointerType,o=a==ne,s=E(t,e.pointerId,`pointerId`);i&se&&(e.button===0||e.button===2||o)?s<0&&(t.push(e),s=t.length-1):i&(F|le)?n=!0:!o&&e.buttons===0&&(n=!0,r=!0,i=Le.pointerup),!(s<0)&&(r||(t[s]=e),this.callback(this.manager,i,{pointers:t,changedPointers:[e],pointerType:a,srcEvent:t[s]}),n&&t.splice(s,1))}});var Ve={touchstart:se,touchmove:ce,touchend:F,touchcancel:le},He=`touchstart`,Ue=`touchstart touchmove touchend touchcancel`;function We(){this.evTarget=He,this.evWin=Ue,this.started=!1,be.apply(this,arguments)}_(We,be,{handler:function(e){var t=Ve[e.type];if(t===se&&(this.started=!0),this.started){var n=Ge.call(this,e,t);t&(F|le)&&n[0].length-n[1].length===0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:ne,srcEvent:e})}}});function Ge(e,t){var n=D(e.touches),r=D(e.changedTouches);return t&(F|le)&&(n=O(n.concat(r),`identifier`,!0)),[n,r]}var Ke={touchstart:se,touchmove:ce,touchend:F,touchcancel:le},qe=`touchstart touchmove touchend touchcancel`;function Je(){this.evTarget=qe,this.targetIds={},be.apply(this,arguments)}_(Je,be,{handler:function(e){var t=Ke[e.type],n=Ye.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:ne,srcEvent:e})}});function Ye(e,t){var n=D(e.touches),r=this.targetIds;if(t&(se|ce)&&n.length===1)return r[n[0].identifier]=!0,[n,n];var i,a,o=D(e.changedTouches),s=[],c=this.target;if(a=n.filter(function(e){return C(e.target,c)}),t===se)for(i=0;i<a.length;)r[a[i].identifier]=!0,i++;for(i=0;i<o.length;)r[o[i].identifier]&&s.push(o[i]),t&(F|le)&&delete r[o[i].identifier],i++;if(s.length)return[O(a.concat(s),`identifier`,!0),s]}var Xe=2500,Ze=25;function Qe(){be.apply(this,arguments);var e=v(this.handler,this);this.touch=new Je(this.manager,e),this.mouse=new Ie(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}_(Qe,be,{handler:function(e,t,n){var r=n.pointerType==ne,i=n.pointerType==ie;if(!(i&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(r)$e.call(this,t,n);else if(i&&tt.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function $e(e,t){e&se?(this.primaryTouch=t.changedPointers[0].identifier,et.call(this,t)):e&(F|le)&&et.call(this,t)}function et(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var r=this.lastTouches;setTimeout(function(){var e=r.indexOf(n);e>-1&&r.splice(e,1)},Xe)}}function tt(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,r=0;r<this.lastTouches.length;r++){var i=this.lastTouches[r],a=Math.abs(t-i.x),o=Math.abs(n-i.y);if(a<=Ze&&o<=Ze)return!0}return!1}var nt=a?k(a.style,`touchAction`):r,rt=nt!==r,it=`compute`,at=`auto`,ot=`manipulation`,st=`none`,ct=`pan-x`,lt=`pan-y`,ut=pt();function dt(e,t){this.manager=e,this.set(t)}dt.prototype={set:function(e){e==it&&(e=this.compute()),rt&&this.manager.element.style&&ut[e]&&(this.manager.element.style[nt]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return f(this.manager.recognizers,function(t){y(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),ft(e.join(` `))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented){t.preventDefault();return}var r=this.actions,i=w(r,st)&&!ut[st],a=w(r,lt)&&!ut[lt],o=w(r,ct)&&!ut[ct];if(i){var s=e.pointers.length===1,c=e.distance<2,l=e.deltaTime<250;if(s&&c&&l)return}if(!(o&&a)&&(i||a&&n&he||o&&n&ge))return this.preventSrc(t)},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};function ft(e){if(w(e,st))return st;var t=w(e,ct),n=w(e,lt);return t&&n?st:t||n?t?ct:lt:w(e,ot)?ot:at}function pt(){if(!rt)return!1;var t={},n=e.CSS&&e.CSS.supports;return[`auto`,`manipulation`,`pan-y`,`pan-x`,`pan-x pan-y`,`none`].forEach(function(r){t[r]=n?e.CSS.supports(`touch-action`,r):!0}),t}var mt=1,ht=2,R=4,gt=8,z=gt,_t=16,vt=32;function yt(e){this.options=m({},this.defaults,e||{}),this.id=j(),this.manager=null,this.options.enable=b(this.options.enable,!0),this.state=mt,this.simultaneous={},this.requireFail=[]}yt.prototype={defaults:{},set:function(e){return m(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(d(e,`recognizeWith`,this))return this;var t=this.simultaneous;return e=St(e,this),t[e.id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return d(e,`dropRecognizeWith`,this)?this:(e=St(e,this),delete this.simultaneous[e.id],this)},requireFailure:function(e){if(d(e,`requireFailure`,this))return this;var t=this.requireFail;return e=St(e,this),E(t,e)===-1&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(d(e,`dropRequireFailure`,this))return this;e=St(e,this);var t=E(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,n=this.state;function r(n){t.manager.emit(n,e)}n<gt&&r(t.options.event+bt(n)),r(t.options.event),e.additionalEvent&&r(e.additionalEvent),n>=gt&&r(t.options.event+bt(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=vt},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(vt|mt)))return!1;e++}return!0},recognize:function(e){var t=m({},e);if(!y(this.options.enable,[this,t])){this.reset(),this.state=vt;return}this.state&(z|_t|vt)&&(this.state=mt),this.state=this.process(t),this.state&(ht|R|gt|_t)&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}};function bt(e){return e&_t?`cancel`:e&gt?`end`:e&R?`move`:e&ht?`start`:``}function xt(e){return e==me?`down`:e==pe?`up`:e==de?`left`:e==fe?`right`:``}function St(e,t){var n=t.manager;return n?n.get(e):e}function Ct(){yt.apply(this,arguments)}_(Ct,yt,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return t===0||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,r=t&(ht|R),i=this.attrTest(e);return r&&(n&le||!i)?t|_t:r||i?n&F?t|gt:t&ht?t|R:ht:vt}});function wt(){Ct.apply(this,arguments),this.pX=null,this.pY=null}_(wt,Ct,{defaults:{event:`pan`,threshold:10,pointers:1,direction:_e},getTouchAction:function(){var e=this.options.direction,t=[];return e&he&&t.push(lt),e&ge&&t.push(ct),t},directionTest:function(e){var t=this.options,n=!0,r=e.distance,i=e.direction,a=e.deltaX,o=e.deltaY;return i&t.direction||(t.direction&he?(i=a===0?ue:a<0?de:fe,n=a!=this.pX,r=Math.abs(e.deltaX)):(i=o===0?ue:o<0?pe:me,n=o!=this.pY,r=Math.abs(e.deltaY))),e.direction=i,n&&r>t.threshold&&i&t.direction},attrTest:function(e){return Ct.prototype.attrTest.call(this,e)&&(this.state&ht||!(this.state&ht)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=xt(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}});function Tt(){Ct.apply(this,arguments)}_(Tt,Ct,{defaults:{event:`pinch`,threshold:0,pointers:2},getTouchAction:function(){return[st]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&ht)},emit:function(e){if(e.scale!==1){var t=e.scale<1?`in`:`out`;e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}});function Et(){yt.apply(this,arguments),this._timer=null,this._input=null}_(Et,yt,{defaults:{event:`press`,pointers:1,time:251,threshold:9},getTouchAction:function(){return[at]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,i=e.deltaTime>t.time;if(this._input=e,!r||!n||e.eventType&(F|le)&&!i)this.reset();else if(e.eventType&se)this.reset(),this._timer=u(function(){this.state=z,this.tryEmit()},t.time,this);else if(e.eventType&F)return z;return vt},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===z&&(e&&e.eventType&F?this.manager.emit(this.options.event+`up`,e):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}});function Dt(){Ct.apply(this,arguments)}_(Dt,Ct,{defaults:{event:`rotate`,threshold:0,pointers:2},getTouchAction:function(){return[st]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&ht)}});function Ot(){Ct.apply(this,arguments)}_(Ot,Ct,{defaults:{event:`swipe`,threshold:10,velocity:.3,direction:he|ge,pointers:1},getTouchAction:function(){return wt.prototype.getTouchAction.call(this)},attrTest:function(e){var t=this.options.direction,n;return t&(he|ge)?n=e.overallVelocity:t&he?n=e.overallVelocityX:t&ge&&(n=e.overallVelocityY),this._super.attrTest.call(this,e)&&t&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&c(n)>this.options.velocity&&e.eventType&F},emit:function(e){var t=xt(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}});function kt(){yt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}_(kt,yt,{defaults:{event:`tap`,pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ot]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,i=e.deltaTime<t.time;if(this.reset(),e.eventType&se&&this.count===0)return this.failTimeout();if(r&&i&&n){if(e.eventType!=F)return this.failTimeout();var a=this.pTime?e.timeStamp-this.pTime<t.interval:!0,o=!this.pCenter||ke(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,!o||!a?this.count=1:this.count+=1,this._input=e,this.count%t.taps===0)return this.hasRequireFailures()?(this._timer=u(function(){this.state=z,this.tryEmit()},t.interval,this),ht):z}return vt},failTimeout:function(){return this._timer=u(function(){this.state=vt},this.options.interval,this),vt},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==z&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function At(e,t){return t=t||{},t.recognizers=b(t.recognizers,At.defaults.preset),new B(e,t)}At.VERSION=`2.0.7`,At.defaults={domEvents:!1,touchAction:it,enable:!0,inputTarget:null,inputClass:null,preset:[[Dt,{enable:!1}],[Tt,{enable:!1},[`rotate`]],[Ot,{direction:he}],[wt,{direction:he},[`swipe`]],[kt],[kt,{event:`doubletap`,taps:2},[`tap`]],[Et]],cssProps:{userSelect:`none`,touchSelect:`none`,touchCallout:`none`,contentZooming:`none`,userDrag:`none`,tapHighlightColor:`rgba(0,0,0,0)`}};var jt=1,Mt=2;function B(e,t){this.options=m({},At.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=xe(this),this.touchAction=new dt(this,this.options.touchAction),Nt(this,!0),f(this.options.recognizers,function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])},this)}B.prototype={set:function(e){return m(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?Mt:jt},recognize:function(e){var t=this.session;if(!t.stopped){this.touchAction.preventDefaults(e);var n,r=this.recognizers,i=t.curRecognizer;(!i||i&&i.state&z)&&(i=t.curRecognizer=null);for(var a=0;a<r.length;)n=r[a],t.stopped!==Mt&&(!i||n==i||n.canRecognizeWith(i))?n.recognize(e):n.reset(),!i&&n.state&(ht|R|gt)&&(i=t.curRecognizer=n),a++}},get:function(e){if(e instanceof yt)return e;for(var t=this.recognizers,n=0;n<t.length;n++)if(t[n].options.event==e)return t[n];return null},add:function(e){if(d(e,`add`,this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(d(e,`remove`,this))return this;if(e=this.get(e),e){var t=this.recognizers,n=E(t,e);n!==-1&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==r&&t!==r){var n=this.handlers;return f(T(e),function(e){n[e]=n[e]||[],n[e].push(t)}),this}},off:function(e,t){if(e!==r){var n=this.handlers;return f(T(e),function(e){t?n[e]&&n[e].splice(E(n[e],t),1):delete n[e]}),this}},emit:function(e,t){this.options.domEvents&&Pt(e,t);var n=this.handlers[e]&&this.handlers[e].slice();if(!(!n||!n.length)){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var r=0;r<n.length;)n[r](t),r++}},destroy:function(){this.element&&Nt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Nt(e,t){var n=e.element;if(n.style){var r;f(e.options.cssProps,function(i,a){r=k(n.style,a),t?(e.oldCssProps[r]=n.style[r],n.style[r]=i):n.style[r]=e.oldCssProps[r]||``}),t||(e.oldCssProps={})}}function Pt(e,n){var r=t.createEvent(`Event`);r.initEvent(e,!0,!0),r.gesture=n,n.target.dispatchEvent(r)}return m(At,{INPUT_START:se,INPUT_MOVE:ce,INPUT_END:F,INPUT_CANCEL:le,STATE_POSSIBLE:mt,STATE_BEGAN:ht,STATE_CHANGED:R,STATE_ENDED:gt,STATE_RECOGNIZED:z,STATE_CANCELLED:_t,STATE_FAILED:vt,DIRECTION_NONE:ue,DIRECTION_LEFT:de,DIRECTION_RIGHT:fe,DIRECTION_UP:pe,DIRECTION_DOWN:me,DIRECTION_HORIZONTAL:he,DIRECTION_VERTICAL:ge,DIRECTION_ALL:_e,Manager:B,Input:be,TouchAction:dt,TouchInput:Je,MouseInput:Ie,PointerEventInput:Be,TouchMouseInput:Qe,SingleTouchInput:We,Recognizer:yt,AttrRecognizer:Ct,Tap:kt,Pan:wt,Swipe:Ot,Pinch:Tt,Rotate:Dt,Press:Et,on:x,off:S,each:f,merge:g,extend:h,assign:m,inherit:_,bindFn:v,prefixed:k}),At})(typeof window<`u`?window:{},typeof document<`u`?document:{},`Hammer`),Jh=class e extends ln{static parseArgs(t){return t instanceof e?t:Object.assign({},t)}static initAnimationEndState(e){var t,n,r,i,a,o,s,c;let l=this.parseArgs(e),{state:u,currentState:d}=l.initial,f=typeof u.panoIndex==`number`?{workCode:(r=(t=u.workCode)==null?(n=l.works[0])==null?void 0:n.workCode:t)==null?``:r,panoIndex:u.panoIndex}:{workCode:d.workCode,panoIndex:d.panoIndex};return Object.assign(Object.assign({},f),{mode:``,longitude:(i=u.longitude)==null?d.longitude:i,latitude:(a=u.latitude)==null?d.latitude:a,fov:(o=u.fov)==null?d.fov:o,offset:(s=u.offset)==null?d.offset:s,distance:(c=u.distance)==null?d.distance:c})}constructor(t){var n,r,i;super();let a=e.parseArgs(t);this.mode=``,this.pending=new Set,this.userAction=a.initial.userAction,this.destroyed=!1,this.fiveId=a.fiveId,this.scene=a.scene,this.modelScene=a.modelScene,this.xrCustomObjectsScene=a.xrCustomObjectsScene,this.helper=a.helper,this.camera=a.camera,this.renderer=a.renderer,this.viewport=a.viewport,this.element=a.element,this.enableWheel=a.enableWheel,this.works=a.works,this.imageOptions=a.imageOptions,this.videoTexture=a.videoTexture,this.extraElements=a.extraElements,this.initial=a.initial,this.currentPano=typeof this.initial.state.panoIndex==`number`?{workCode:(i=(n=this.initial.state.workCode)==null?(r=a.works[0])==null?void 0:r.workCode:n)==null?``:i,panoIndex:this.initial.state.panoIndex}:{workCode:this.initial.currentState.workCode,panoIndex:this.initial.currentState.panoIndex},this.needsRender=!0,this.cameraMotion=new X({longitude:{value:this.camera.pose.longitude,circle:[0,Math.PI*2]},latitude:this.camera.pose.latitude,fov:this.camera.pose.fov}),this.inMomentumMovement=null,this.eventUnbinds=[a.element].concat(a.extraElements||[]).map(e=>this.bindEvents(e)),this.initAnimationIsReady=!1,this.pending.add(`init-animation`),this.initAnimationReady=new Promise(e=>{si.shared.add(()=>{this.initAnimation().then(()=>{this.initAnimationIsReady=!0,this.pending.delete(`init-animation`),e()})},!0,0)})}updateConfiguration(e){return!0}destroy(){var e;this.stopMomentumMovement(),this.destroyed=!0,this.off(),this.cameraMotion.dispose();for(let e of this.eventUnbinds)e();this.panState=void 0,(e=this.pressState)==null||e.stop(),this.pressState=void 0}isReady(){return this.inMomentumMovement===null&&this.pending.size===0&&this.cameraMotion.ended===!0}bindExtraElement(e){for(let t of this.eventUnbinds)if(t.element===e)return;this.eventUnbinds.push(this.bindEvents(e))}unbindExtraElement(e){let t=[];for(let n of this.eventUnbinds)n.element===e?n():t.push(n);this.eventUnbinds=t}updateModel(e){this.needsRender=!0}updateWork(e,t,n,r){return this.works=e,this.userAction=r,!1}updateTime(e,t,...n){if(this.destroyed)return;let r={};this.cameraMotion.ended&&(this.cameraMotion.update(e),r.longitude=this.cameraMotion.value.longitude,r.latitude=this.cameraMotion.value.latitude,r.fov=this.cameraMotion.value.fov),zh(r)&&this.setCamera(r)}render(){return!1}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={};return e.longitude!==void 0&&(r.longitude=e.longitude),e.latitude!==void 0&&(r.latitude=e.latitude),e.fov!==void 0&&(r.fov=e.fov),this.cameraMotion.set(r,t).catch(K)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.cameraMotion.setKeyframes(r,t)})}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(H())[1];return Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance})}initAnimation(){let{state:t,currentState:n,duration:r,userAction:i}=this.initial,a=e.initAnimationEndState(this);return this.userAction=i,this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:a,userAction:this.userAction})),this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:a,userAction:this.userAction})),Promise.resolve()}setCamera(e={}){var t,n,r,i,a;let o=(t=e.longitude)==null?this.camera.pose.longitude:t,s=(n=e.latitude)==null?this.camera.pose.latitude:n,c=(r=e.fov)==null?this.camera.pose.fov:r,l=(i=e.distance)==null?this.camera.pose.distance:i,u=(a=e.offset)==null?this.camera.pose.offset:a,d=Sh(o,this.camera.pose.longitude,Math.PI*2)||Sh(s,this.camera.pose.latitude),f=Sh(c,this.camera.pose.fov),p=Sh(l,this.camera.pose.distance),m=wh(u,this.camera.pose.offset);(f||d||m||p)&&(this.camera.setFromPose({longitude:o,latitude:s,fov:c,distance:l,offset:u}),this.emit(`camera.update`,Q(`camera.update`,{userAction:this.userAction,state:Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:o,latitude:s,fov:c,offset:u,distance:l})})),this.needsRender=!0)}stopMomentumMovement(){if(this.inMomentumMovement&&this.inMomentumMovement.event&&!this.inMomentumMovement.event.defaultPrevented&&!this.inMomentumMovement.event.isFinal){let e=Q(`gesture.momentum`,Object.assign(Object.assign({},this.inMomentumMovement.event),{isFirst:!1,isFinal:!0}));this.emit(`gesture.fire`,e),this.emit(`gesture.momentum`,e)}this.inMomentumMovement=null}onPanGesture(e){this.stopMomentumMovement(),this.emit(`gesture.pan`,e)}onTapGesture(e){this.stopMomentumMovement(),this.emit(`gesture.tap`,e)}onDblTapGesture(e){this.stopMomentumMovement(),this.emit(`gesture.dbltap`,e),!e.defaultPrevented&&(e.type=`gesture.tap`,this.onTapGesture(e))}onPressGesture(e){this.stopMomentumMovement(),this.emit(`gesture.press`,e)}onPinchGesture(e){this.stopMomentumMovement(),this.emit(`gesture.pinch`,e)}onMouseWheel(e){this.stopMomentumMovement(),this.emit(`gesture.mousewheel`,e)}onMouseMove(e){this.stopMomentumMovement(),this.emit(`gesture.mousemove`,e)}relativeClientPosition(e){let{top:t,left:n,width:r,height:i}=this.element.getBoundingClientRect();return n+=r*this.viewport.left,t+=i*(1-this.viewport.bottom-this.viewport.height),r*=this.viewport.width,i*=this.viewport.height,new c.Vector2((e.x-n)/r*2-1,-(e.y-t)/i*2+1)}createRaycasterFromCamera(e,t){let n=new c.Raycaster;return n.params.Points={threshold:.1},n.firstHitOnly=!0,n.near=t.near,n.far=t.far,n.setFromCamera(e,this.camera),n}bindEvents(e){let t=e=>{let t=this.relativeClientPosition(e);return!(Math.abs(t.x)>1||Math.abs(t.y)>1)},n=e=>({button:`button`in e?e.button:0,buttons:`buttons`in e?e.buttons:0,shiftKey:`shiftKey`in e?e.shiftKey:!1,ctrlKey:`ctrlKey`in e?e.ctrlKey:!1,altKey:`altKey`in e?e.altKey:!1,metaKey:`metaKey`in e?e.metaKey:!1}),r=new qh.Manager(e),i=e=>e.session.firstInput||null,a=new qh.Pan({threshold:10,pointers:0}),o=new qh.Tap({interval:410}),s=new qh.Pinch({threshold:0,pointers:2});r.add([a,o,s]),r.on(`panstart pan`,e=>{let a=n(e.srcEvent),o=i(r);if(o&&!t(o.center))return;let s=Q(`gesture.pan`,{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})}),isFirst:e.isFirst||e.type==`panstart`,isFinal:e.isFinal,scale:e.scale,center:(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})})(e.center),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,s),this.onPanGesture(s),v()}),r.on(`tap`,e=>{let a=n(e.srcEvent);if(e.pointerType===`mouse`&&a.button!==0)return;let o=i(r);if(o&&!t(o.center))return;let s=Q(`gesture.tap`,{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})}),isFirst:!0,isFinal:!0,scale:e.scale,center:(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})})(e.center),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,s),this.onTapGesture(s),v()}),r.on(`pinchstart pinch pinchend`,e=>{let a=n(e.srcEvent),o=i(r);if(o&&!t(o.center))return;let s=Q(`gesture.pinch`,{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map(e=>{var t;let n=this.relativeClientPosition(e),r=new c.Raycaster;return r.params.Points={threshold:.1},r.setFromCamera(n,this.camera),Object.assign(Object.assign({x:e.x,y:e.y,delta:(t=e.delta)==null?0:t},a),{coords:n,raycaster:r})}),isFirst:e.type===`pinchstart`,isFinal:e.type===`pinchend`,scale:e.scale,center:(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})})(e.center),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,s),this.onPinchGesture(s),v()}),r.on(`dbltap`,e=>{let a=n(e.srcEvent);if(e.pointerType===`mouse`&&a.button!==0)return;let o=i(r);if(o&&!t(o.center))return;let s=Q(`gesture.dbltap`,{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})}),isFirst:!0,isFinal:!0,scale:e.scale,center:(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})})(e.center),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,s),this.onDblTapGesture(s),v()});let l=null,u=null,d=(e,t,r)=>{let i={x:r.clientX,y:r.clientY},a=this.relativeClientPosition(i),o=this.createRaycasterFromCamera(a,this.camera),s=Object.assign(Object.assign(Object.assign(Object.assign({},i),{coords:a,raycaster:o}),n(r)),{delta:0}),c=e===`pinchend`?t:t-r.deltaY/280;return Q(`gesture.pinch`,{target:r.target,pointerType:`mouse`,srcEvent:r,pointers:[Object.assign({},s)],isFirst:e===`pinchstart`,isFinal:e===`pinchend`,scale:U(c,.1,10),center:Object.assign({},s),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))})},f=e=>{var r;if(t({x:e.clientX,y:e.clientY})){if(e.preventDefault(),e.ctrlKey){let t=(r=l==null?void 0:l.prevEvent.scale)==null?1:r,n=d(l?`pinch`:`pinchstart`,t,e);this.emit(`gesture.fire`,n),l===null?l={firstEvent:n,prevEvent:n}:l.prevEvent=n,this.emit(`gesture.fire`,n),this.onPinchGesture(n),u!==null&&window.clearTimeout(u),u=window.setTimeout(()=>{var t;u=null;let n=d(`pinchend`,(t=l==null?void 0:l.prevEvent.scale)==null?1:t,e);this.emit(`gesture.fire`,n),l=null,this.onPinchGesture(n)},200)}else{let t=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,r=this.mouseWheelState!==void 0,i={x:e.clientX,y:e.clientY},a=this.relativeClientPosition(i),o=this.createRaycasterFromCamera(a,this.camera),s=Object.assign(Object.assign(Object.assign(Object.assign({},i),{coords:a,raycaster:o}),n(e)),{delta:t}),c=Q(`gesture.mousewheel`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign({},s)],isFirst:r,isFinal:!1,scale:0,center:Object.assign({},s),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,c),this.onMouseWheel(c),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:setTimeout(()=>{this.mouseWheelState=void 0;let t=Q(`gesture.mousewheel`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign(Object.assign({},s),{delta:0})],isFirst:!1,isFinal:!0,scale:0,center:Object.assign(Object.assign({},s),{delta:0}),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,t),this.onMouseWheel(t)},100)}}v()}},p=e=>{if(Oh)return;if(!t({x:e.clientX,y:e.clientY})){m();return}let r=!1;this.mouseMoveState||(r=!0);let i={x:e.clientX,y:e.clientY},a=this.relativeClientPosition(i),o=this.createRaycasterFromCamera(a,this.camera),s=Object.assign(Object.assign(Object.assign(Object.assign({},i),{coords:a,raycaster:o}),n(e)),{delta:0}),c=Q(`gesture.mousemove`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign({},s)],isFirst:r,isFinal:!1,scale:0,center:Object.assign({},s),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,c),this.mouseMoveState={timeStamp:H(),event:c},this.onMouseMove(c),this.pressState&&Math.abs(e.clientX-this.pressState.event.center.y)>10&&Math.abs(e.clientY-this.pressState.event.center.y)>10&&v()},m=()=>{if(this.mouseMoveState){let e=Q(this.mouseMoveState.event.type,Object.assign(Object.assign({},this.mouseMoveState.event),{isFinal:!0}));this.emit(`gesture.fire`,e),this.mouseMoveState=void 0,this.onMouseMove(e)}v()},h=e=>{if(!t(e.center)){v();return}let n=!1;this.pressState||(n=!0,this.pressState={event:e,timeStamp:H(),stop:K});let r=H()-this.pressState.timeStamp,i=Q(this.pressState.event.type,Object.assign(Object.assign({},this.pressState.event),{isFirst:n,isFinal:!1,center:Object.assign(Object.assign({},this.pressState.event.center),{delta:r}),pointers:this.pressState.event.pointers.map(e=>Object.assign(Object.assign({},e),{delta:r}))}));this.emit(`gesture.fire`,i),this.onPressGesture(i),this.pressState&&(this.pressState.stop=si.shared.add(t=>{h(e)},!0,1))},g=e=>{if(v(),e.touches.length>1||e.changedTouches.length<=0)return;let t={x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY},r=this.relativeClientPosition(t),i=this.createRaycasterFromCamera(r,this.camera),a=Object.assign(Object.assign(Object.assign(Object.assign({},t),{coords:r,raycaster:i}),n(e)),{delta:0}),o=Q(`gesture.press`,{target:e.target,pointerType:`touch`,srcEvent:e,pointers:[Object.assign({},a)],isFirst:!1,isFinal:!1,scale:0,center:a,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,o),h(o)},_=e=>{v();let t={x:e.clientX,y:e.clientY},r=this.relativeClientPosition(t),i=this.createRaycasterFromCamera(r,this.camera),a=Object.assign(Object.assign(Object.assign(Object.assign({},t),{coords:r,raycaster:i}),n(e)),{delta:0}),o=Q(`gesture.press`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign({},a)],isFirst:!1,isFinal:!1,scale:0,center:a,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,o),h(o)},v=()=>{var e;if(this.pressState){let t=H()-this.pressState.timeStamp,n=Q(this.pressState.event.type,Object.assign(Object.assign({},this.pressState.event),{center:Object.assign(Object.assign({},this.pressState.event.center),{delta:t}),isFirst:!1,isFinal:!0,pointers:this.pressState.event.pointers.map(e=>Object.assign(Object.assign({},e),{delta:t}))}));this.emit(`gesture.fire`,n),this.onPressGesture(n),(e=this.pressState)==null||e.stop(),this.pressState=void 0}},y=null,b=e=>{var t,r,i;let a=!1,o=!1;switch(e.type){case`gesturestart`:a=!0;break;case`gestureend`:o=!0;break;default:break}let s={x:(t=e.clientX)==null?0:t,y:(r=e.clientY)==null?0:r},c=this.relativeClientPosition(s),l=this.createRaycasterFromCamera(c,this.camera),u=Object.assign(Object.assign(Object.assign(Object.assign({},s),{coords:c,raycaster:l}),n(e)),{delta:0});return Q(`gesture.pinch`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign({},u)],isFirst:a,isFinal:o,scale:(i=e.scale)==null?1:i,center:Object.assign({},u),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))})},x=e=>{if(e.preventDefault(),Oh)return;let n=b(e);this.emit(`gesture.fire`,n),y={firstEvent:n};let r=y.firstEvent;r&&!t(r.center)||this.onPinchGesture(n)},S=e=>{if(e.preventDefault(),Oh||!y)return;let n=y.firstEvent;if(n&&!t(n.center))return;let r=b(e);this.emit(`gesture.fire`,r),this.onPinchGesture(r)},C=e=>{if(e.preventDefault(),Oh||!y)return;let n=y.firstEvent;if(y=null,n&&!t(n.center))return;let r=b(e);this.emit(`gesture.fire`,r),this.onPinchGesture(r)},w=t=>{if(t&&typeof t.preventDefault==`function`&&t.currentTarget===e&&t.preventDefault(),typeof getSelection==`function`){let e=getSelection();e&&e.focusNode&&(e.removeAllRanges&&e.removeAllRanges(),e.empty&&e.empty())}};return this.enableWheel&&e.addEventListener(`wheel`,f,{passive:!1}),e.addEventListener(`mousemove`,p,!1),e.addEventListener(`mouseout`,m,!1),e.addEventListener(`touchstart`,g,{passive:!0}),e.addEventListener(`touchend`,v,!1),e.addEventListener(`touchcancel`,v,!1),e.addEventListener(`mousedown`,_,!1),e.addEventListener(`mouseup`,v,!1),e.addEventListener(`gesturestart`,x,{passive:!1}),e.addEventListener(`gesturechange`,S,{passive:!1}),e.addEventListener(`gestureend`,C,{passive:!1}),e.addEventListener(`touchstart`,w,{passive:!1}),e.addEventListener(`contextmenu`,w,!1),Object.assign(()=>{r.destroy(),e.removeEventListener(`wheel`,f,!1),e.removeEventListener(`mousemove`,p,!1),e.removeEventListener(`mouseout`,m,!1),e.removeEventListener(`touchstart`,g,!1),e.removeEventListener(`touchend`,v,!1),e.removeEventListener(`touchcancel`,v,!1),e.removeEventListener(`mousedown`,_,!1),e.removeEventListener(`mouseup`,v,!1),e.removeEventListener(`gesturestart`,x,!1),e.removeEventListener(`gesturechange`,S,!1),e.removeEventListener(`gestureend`,C,!1),e.removeEventListener(`touchstart`,w,!1),e.removeEventListener(`contextmenu`,w,!1)},{element:e})}},Yh=new c.CircleBufferGeometry(.1,16),Xh=new c.ShaderMaterial({vertexShader:`
1500
1500
  varying vec2 vUv;
1501
1501
  #include <common>
1502
1502
  #include <logdepthbuf_pars_vertex>
@@ -1529,7 +1529,7 @@ void main() {
1529
1529
 
1530
1530
  gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * outside * inside);
1531
1531
  }
1532
- `,side:c.DoubleSide,blending:c.CustomBlending,blendSrc:c.SrcAlphaFactor,blendDst:c.OneMinusSrcAlphaFactor,blendSrcAlpha:c.OneFactor,blendDstAlpha:c.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0}),Jh=class extends c.Object3D{constructor(){super(),this.ringMesh=new c.Mesh(Kh,qh),this.ringMesh.position.z=.01,this.ringMesh.renderOrder=9999999999,this.add(this.ringMesh)}dispose(){this.remove(this.ringMesh)}};function Yh(e){if(e instanceof Error)return e;let t=typeof e;return Error(t&&t===`object`?JSON.stringify(e):e)}var Xh=new c.Box3,Zh=new c.Vector3,Qh={defaultLongitude:Math.PI/4,defaultLatitude:Math.PI/4,defaultFov:80,maxFov:120,minFov:20,maxLatitude:Math.PI/2,minLatitude:-Math.PI/2,intersectMeshCreator:()=>new Jh},$h=class e extends Gh{static distanceFromModel(e,t,n){let r=e.boundingBox,i=r.isEmpty()?10:Math.pow(Math.pow(r.max.x-r.min.x+1,2)+Math.pow(r.max.y-r.min.y+1,2)+Math.pow(r.max.z-r.min.z+1,2),1/2);i=isNaN(i)||!isFinite(i)?1:i;let a=i/2/Math.tan(Math.PI*t/360);return n<1&&(a/=n),isNaN(a)||!isFinite(a)?i:a}static parseArgs(t){var n,r,i,a,o,s,c,l;if(t instanceof e)return t;let u=super.parseArgs(t);return Object.assign(Object.assign({},u),{defaultLongitude:(n=t.defaultLongitude)==null?Qh.defaultLongitude:n,defaultLatitude:(r=t.defaultLatitude)==null?Qh.defaultLatitude:r,defaultFov:(i=t.defaultFov)==null?Qh.defaultFov:i,maxFov:(a=t.maxFov)==null?Qh.maxFov:a,minFov:(o=t.minFov)==null?Qh.minFov:o,maxLatitude:(s=t.maxLatitude)==null?Qh.maxLatitude:s,minLatitude:(c=t.minLatitude)==null?Qh.minLatitude:c,intersectMeshCreator:(l=t.intersectMeshCreator)==null?Qh.intersectMeshCreator:l})}static initAnimationEndState(t){var n,r,i,a,o,s,l;let u=this.parseArgs(t),{state:d,currentState:f}=t.initial,p=typeof d.panoIndex==`number`?{workCode:(i=(n=d.workCode)==null?(r=u.works[0])==null?void 0:r.workCode:n)==null?``:i,panoIndex:d.panoIndex}:{workCode:f.workCode,panoIndex:f.panoIndex},m=(a=d.fov)==null?u.defaultFov:a,h=(o=d.longitude)==null?Ph(f.mode)?f.longitude:u.defaultLongitude:o,g=U(typeof u.minLatitude==`function`?u.minLatitude(m):u.minLatitude,-Math.PI/2,Math.PI/2),_=U(typeof u.maxLatitude==`function`?u.maxLatitude(m):u.maxLatitude,-Math.PI/2,Math.PI/2),v=U((s=d.latitude)==null?f.mode===`Floorplan`?f.latitude:u.defaultLatitude:s,g,_),y=d.offset?d.offset.clone():t.modelScene.boundingBox.getCenter(new c.Vector3),b=(l=d.distance)==null?e.distanceFromModel(u.modelScene,u.defaultFov,u.camera.aspect):l;return Object.assign(Object.assign({},p),{mode:`Floorplan`,longitude:h,latitude:v,fov:m,offset:y,distance:b})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Floorplan`,this.defaultLongitude=n.defaultLongitude,this.defaultLatitude=n.defaultLatitude,this.defaultFov=n.defaultFov,this.maxFov=n.maxFov,this.minFov=n.minFov,this.maxLatitude=n.maxLatitude,this.minLatitude=n.minLatitude,this.locationMotion=new X({x:this.camera.pose.offset.x,y:this.camera.pose.offset.y,z:this.camera.pose.offset.z,distance:this.camera.pose.distance}),this.modelAlphaMotion=new X({modelAlpha:this.modelScene.parameter.resolveValue(`modelAlpha`)}),this.perspToOrthoMotion=new X({perspToOrtho:this.camera.perspToOrtho.x}),this.pendingTextureId=null,this.textureLoader=new yi,this.intersectMeshCreator=n.intersectMeshCreator,this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=`intersect`,this.intersectMesh.visible=!1,this.helper.add(this.intersectMesh)}updateConfiguration(e){if(super.updateConfiguration(e)===!1)return!1;if(e.defaultLongitude!==void 0&&this.defaultLongitude!==e.defaultLongitude&&(this.defaultLongitude=e.defaultLongitude),e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.defaultFov!==void 0&&this.defaultFov!==e.defaultFov&&(this.defaultFov=e.defaultFov),e.maxFov!==void 0&&this.maxFov!==e.maxFov&&(this.maxFov=e.maxFov),e.minFov!==void 0&&this.minFov!==e.minFov&&(this.minFov=e.minFov),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;let t=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=t.name,this.intersectMesh.visible=t.visible;let n=this.intersectMesh.parent;n&&n.add(this.intersectMesh),t.dispose()}return!0}destroy(){super.destroy(),this.pendingTextureId=null,this.locationMotion.dispose(),this.panState=void 0,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)}isReady(){return this.locationMotion.ended===!1?!1:super.isReady()}updateWork(e,t,n,r){var i;return this.works=e,this.updateCamera(t,(i=n.duration)==null?0:i,r),!0}updateModel(t){super.updateModel(t);let n=t.boundingBox.getCenter(new c.Vector3),r=e.distanceFromModel(t,this.defaultFov,this.camera.aspect);this.updateCamera({offset:n,distance:r},0,!0)}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={},i={};return e.distance!==void 0&&(r.distance=e.distance),e.offset!==void 0&&(r.x=e.offset.x,r.y=e.offset.y,r.z=e.offset.z),e.longitude!==void 0&&(i.longitude=e.longitude),e.latitude!==void 0&&(i.latitude=e.latitude),e.fov!==void 0&&(i.fov=e.fov),this.locationMotion.set(r,t).catch(K),this.cameraMotion.set(i,t).catch(K)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[],i=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{distance:t.value.distance,x:t.value.offset.x,y:t.value.offset.x,z:t.value.offset.x}}),i.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.locationMotion.setKeyframes(r,t).catch(K),this.cameraMotion.setKeyframes(e,t)})}updateTime(e,t,...n){if(this.destroyed)return;let r={},i={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),r.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){let{pano0:e,pano1:t}=this.modelScene.parameter;e&&e.map!==(t==null?void 0:t.map)&&e.map.dispose(),r.progress=1,r.pano0=r.pano1=t}if(this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(U(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended||(this.locationMotion.update(e),i.distance=this.locationMotion.value.distance,i.offset=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),i.longitude=this.cameraMotion.value.longitude,i.latitude=this.cameraMotion.value.latitude,i.fov=this.cameraMotion.value.fov),Ih(r)||this.modelScene.parameter.set(r),Ih(i)||this.setCamera(i),this.intersectMesh&&this.intersectMesh.parent){let e=U(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1)}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(H())[1],t=this.locationMotion.getKeyFrameSegment(H())[1];return Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new c.Vector3(t.value.x,t.value.y,t.value.z),distance:t.value.distance})}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{state:n,currentState:r,duration:i,userAction:a}=this.initial;this.userAction=a;let o=e.initAnimationEndState(this),s=vr(o,[`longitude`,`latitude`,`fov`]),c={x:o.offset.x,y:o.offset.y,z:o.offset.z,distance:o.distance};this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:o,userAction:this.userAction})),this.modelAlphaMotion.set({modelAlpha:1},i/3).catch(K),this.perspToOrthoMotion.set({perspToOrtho:0},i).catch(K),this.cameraMotion.set(s,i).catch(K),this.locationMotion.set(c,i).then(()=>{this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:o,userAction:this.userAction}))},e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:t,userAction:this.userAction}))}).then(()=>{t()})})}updateRenderSize(e){this.needsRender=!0}getForwardObserverOrNot(e){let[t]=this.modelScene.intersectRaycaster(e);if(!t)return null;let n=[];for(let t of this.works){let r=this.modelScene.models.find(e=>e.work===t);if(!(!r||r.visible===!1)&&!(t.observers.length<=0)&&(Xh.copy(t.observerBox).expandByScalar(10).applyMatrix4(t.transform),Xh.containsPoint(e.ray.origin)||e.ray.intersectsBox(Xh)))for(let e of t.observers)n.push(e)}let[r,i]=zl(n,e=>Zh.copy(e.standingPosition).applyMatrix4(e.work.transform).distanceTo(t.point),!0);return r&&i<Math.max(r.standingPosition.distanceTo(this.camera.position)/5,10)?r:null}coordinatesForOffset(e){let t=this.renderer.getSize(new c.Vector2);return{longitude:-2*e.x/(t.x*this.viewport.width),latitude:2*e.y/(t.y*this.viewport.height)}}requestMomentumMovement(e,t,n,r){if(this.inMomentumMovement===null)return;r=Math.max(r,1);let i=Object.assign({},n),a={longitude:0,latitude:0};for(let e=0;e<r;e++)i.longitude*=.996,i.latitude*=.996*.998,a.longitude+=i.longitude,a.latitude+=i.latitude;let o=Vt(this.cameraMotion.value.longitude+a.longitude),s=this.cameraMotion.value.fov,c=U(typeof this.minLatitude==`function`?this.minLatitude(s):this.minLatitude,-Math.PI/2,Math.PI/2),l=U(typeof this.maxLatitude==`function`?this.maxLatitude(s):this.maxLatitude,-Math.PI/2,Math.PI/2),u=U(this.cameraMotion.value.latitude+a.latitude,c,l),d=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:o,latitude:u,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),f=!(i.longitude>1e-4||i.longitude<-1e-4||i.latitude>1e-4||i.latitude<-1e-4),p=Q(`gesture.momentum`,Object.assign(Object.assign({},e),{isFirst:t,isFinal:f,state:d}));if(this.emit(`gesture.fire`,p),this.inMomentumMovement.event=p,this.emit(`gesture.momentum`,p),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:o,latitude:u},0).catch(K),f?this.inMomentumMovement=null:si.shared.add((t,n)=>{this.requestMomentumMovement(e,!1,i,n)},!0))}onPanGesture(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let t=this.panState,n=e.pointers.length;if(e.isFinal?this.panState=void 0:this.panState={pointerLength:n,defaultPrevented:e.defaultPrevented,x:e.center.x,y:e.center.y},t===void 0||t.pointerLength!==n){this.emit(`gesture.pan`,e);return}let r={x:e.center.x-t.x,y:e.center.y-t.y},i=this.relativeClientPosition(e.center),a=1,o=this.camera.pose.latitude;Math.abs(o)>Math.PI/6&&(a=o<0?i.y<0?-1:1:i.y>0?-1:1),r.x*=a;let s=this.coordinatesForOffset(r),c=Vt(this.cameraMotion.value.longitude+s.longitude),l=this.camera.pose.fov,u=U(typeof this.minLatitude==`function`?this.minLatitude(l):this.minLatitude,-Math.PI/2,Math.PI/2),d=U(typeof this.maxLatitude==`function`?this.maxLatitude(l):this.maxLatitude,-Math.PI/2,Math.PI/2),f=U(this.cameraMotion.value.latitude+s.latitude,u,d);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(f=this.cameraMotion.value.latitude);let p=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:c,latitude:f,fov:l,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.state=p,this.emit(`gesture.pan`,e),e.defaultPrevented){this.panState&&(this.panState.defaultPrevented=e.defaultPrevented);return}if(!(e.isFinal&&t.defaultPrevented)&&(this.cameraMotion.set({longitude:p.longitude,latitude:p.latitude},0).catch(K),e.isFinal)){let t=e.velocityX*a,n=e.velocityY;this.inMomentumMovement={uuid:rn()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:t,y:n}),0)}}onPinchGesture(e){var t;if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement();let n=(t=this.pinchState)==null?void 0:t.fov;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&(this.panState=void 0,this.pinchState=void 0),n===void 0)return;let r=U(n/e.scale,this.minFov,this.maxFov),i=U(typeof this.minLatitude==`function`?this.minLatitude(r):this.minLatitude,-Math.PI/2,Math.PI/2),a=U(typeof this.maxLatitude==`function`?this.maxLatitude(r):this.maxLatitude,-Math.PI/2,Math.PI/2),o=U(this.cameraMotion.value.latitude,i,a);e.state.fov=r,e.state.latitude=o,this.emit(`gesture.pinch`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:r,latitude:o},0).catch(K),this.onPanGesture(e))}onMouseMove(e){var t,n;if(!this.intersectMesh.parent||this.panState)return;if(this.emit(`gesture.mousemove`,e),e.defaultPrevented){this.hideIntersectMesh();return}let r=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}let[i]=this.modelScene.intersectRaycaster(r),a=Q(`intersect.update`,{raycaster:r,intersection:i==null?null:i,object:this.intersectMesh});if(this.emit(`intersect.update`,a),a.defaultPrevented){this.hideIntersectMesh();return}if(i){let e=(n=(t=i.face)==null?void 0:t.normal)==null?new c.Vector3().copy(r.ray.direction).multiplyScalar(-1):n,a=e.clone(),o=i.point.clone();this.intersectMesh.position.copy(o);let s=o.clone().add(a);if(this.intersectMesh.lookAt(s),Math.abs(e.y)>.99){let e=this.camera.position.clone().sub(o);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}onMouseWheel(e){if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement();let{minFov:t,maxFov:n}=this,r=U(this.camera.fov-e.center.delta,t,n),i=U(typeof this.minLatitude==`function`?this.minLatitude(r):this.minLatitude,-Math.PI/2,Math.PI/2),a=U(typeof this.maxLatitude==`function`?this.maxLatitude(r):this.maxLatitude,-Math.PI/2,Math.PI/2),o=U(this.cameraMotion.value.latitude,i,a);e.state.fov=r,e.state.latitude=o,this.emit(`gesture.mousewheel`,e),!e.defaultPrevented&&this.cameraMotion.set({fov:r,latitude:o},0).catch(K)}onTapGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=e.center.raycaster,n=this.getForwardObserverOrNot(t);if(!n)this.emit(`gesture.tap`,e);else{let t={longitude:this.camera.pose.longitude,latitude:0},r=Object.assign(Object.assign({},e.state),{mode:`Panorama`,workCode:n.work.workCode,panoIndex:n.panoIndex,longitude:t.longitude,latitude:t.latitude,offset:n?n.position.clone():new c.Vector3,distance:0});if(e.state=r,this.emit(`gesture.tap`,e),!e.defaultPrevented&&(this.emit(`pano.select`,Q(`pano.select`,{prevPano:this.currentPano,pano:{panoIndex:r.panoIndex,workCode:r.workCode},state:r,userAction:e.userAction,options:t,progress:0,error:null})),n&&n.active)){let e=this.pendingTextureId=rn(),i={panoIndex:n.panoIndex,workCode:n.work.workCode},a=Z(i),o={right:n.images.work.getURL(n.images.right),left:n.images.work.getURL(n.images.left),up:n.images.work.getURL(n.images.up),down:n.images.work.getURL(n.images.down),front:n.images.work.getURL(n.images.front),back:n.images.work.getURL(n.images.back)},s=this.imageOptions.transform,l=Object.assign({key:`pano.${a}`},vr(this.imageOptions,[`format`,`size`,`quality`,`sharpen`,`forceUseExifOrientation`,`mappings`])),u=`pano:`+mp([o,l,s]),d=this.modelScene.parameter,f=Dh(`pano.prepare`,{prevPano:this.currentPano,pano:i});if(this.emit(`pano.prepare`,f),f.defaultPrevented){this.pendingTextureId=null;return}let p;d.pano0&&d.pano0.map.name===u?p=d.pano0:d.pano1&&d.pano1.map.name===u&&(p=d.pano1),p?Promise.resolve().then(()=>Oh(f)).catch(e=>Yh(e)).then(e=>{var n;e instanceof Error?(this.pendingTextureId=null,e.message&&this.emit(`error`,e)):(d.pano0&&d.pano0.map!==p.map&&d.pano0.map.dispose(),d.pano1&&d.pano1.map!==p.map&&d.pano1.map!==((n=d.pano0)==null?void 0:n.map)&&d.pano1.map.dispose(),d.set({pano0:p,pano1:p}),this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:r.panoIndex,workCode:r.workCode},progress:0,state:r,options:t,error:null})))}):Promise.all([Promise.resolve().then(()=>{this.emit(`pano.texture.load`,Q(`pano.texture.load`,{error:null,progress:0,meta:null,pano:i}))}).then(()=>this.textureLoader.loadCubeTexture(o,{imageURL:{transform:s,options:l},format:c.RGBFormat,viaAjax:!0,fetcher:Cf(this.fiveId,n.work)},void 0,void 0,void 0,this.renderer)).catch(e=>{let t=Yh(e);return this.emit(`pano.texture.error`,Q(`pano.texture.error`,{error:t,progress:0,meta:null,pano:i})),t}),Promise.resolve().then(()=>Oh(f)).catch(e=>Yh(e))]).then(([i,o])=>{var s,l;if(!(i instanceof Error)&&!(o instanceof Error)){let{body:o}=i;if(this.destroyed||this.pendingTextureId!==e){o.dispose();return}this.pendingTextureId=null,o.name=u;let f=Array.isArray(o.image)?o.image[0]:o.image,p=(s=f==null?void 0:f.width)==null?2048:s,m=n.images.histogram;m||(m=new _m().formPixels(Uh(this.renderer,o,!0,pm).data),n.images.histogram=m);let h={panoId:a,map:o,mapSize:p,mapHistogram:new c.Vector4().fromArray(m.toArray()),matrix:n.matrix.clone().premultiply(n.work.transform),zoom:1};d.pano0&&d.pano0.map.dispose(),d.pano1&&d.pano1.map!==((l=d.pano0)==null?void 0:l.map)&&d.pano1.map.dispose(),d.set({pano0:h,pano1:h}),this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:r.panoIndex,workCode:r.workCode},progress:0,state:r,options:t,error:null}))}else{let t=null;if(i instanceof Error?t||(t=i):i.body.dispose(),o instanceof Error&&(t||(t=o)),this.destroyed||this.pendingTextureId!==e)return;this.pendingTextureId=null,t instanceof Error&&t.message&&this.emit(`error`,t)}})}}}onDblTapGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=this.cameraMotion.value.fov,n=this.minFov-t<t-this.defaultFov?this.minFov:this.defaultFov;e.state.fov=n,this.emit(`gesture.dbltap`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:n},360).catch(K),this.hideIntersectMesh())}hideIntersectMesh(){this.intersectMesh.visible=!1,this.needsRender=!0}},eg=Object.assign(Object.assign({},yr(Qh,[`defaultLongitude`,`defaultLatitude`,`maxLatitude`,`minLatitude`])),{defaultLongitude:0,defaultLatitude:Math.PI/2}),tg=class e extends $h{static parseArgs(t){var n,r;if(t instanceof e)return t;let i=Object.assign(Object.assign({},t),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2,defaultLongitude:(n=t.defaultLongitude)==null?eg.defaultLongitude:n,defaultLatitude:(r=t.defaultLatitude)==null?eg.defaultLatitude:r});return super.parseArgs(i)}static initAnimationEndState(e){var t,n;let r=this.parseArgs(e),i=super.initAnimationEndState(Object.assign(Object.assign({},r),{initial:Object.assign(Object.assign({},r.initial),{state:Object.assign(Object.assign({},r.initial.state),{longitude:(t=r.initial.state.longitude)==null?r.defaultLongitude:t,latitude:(n=r.initial.state.latitude)==null?r.defaultLatitude:n})})}));return Object.assign(Object.assign({},i),{mode:`Topview`})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Topview`}updateConfiguration(e){return super.updateConfiguration(Object.assign({},e))}updateModel(e){this.needsRender=!0;let t=this.modelScene.boundingBox.getCenter(new c.Vector3);this.locationMotion.set({x:t.x,y:t.y,z:t.z,distance:$h.distanceFromModel(this.modelScene,this.defaultFov,this.camera.aspect)},0).catch(K),this.hideIntersectMesh()}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={},i={};return e.distance!==void 0&&(r.distance=e.distance),e.offset!==void 0&&(r.x=e.offset.x,r.y=e.offset.y,r.z=e.offset.z),e.longitude!==void 0&&(i.longitude=e.longitude),e.latitude!==void 0&&(i.latitude=e.latitude),e.fov!==void 0&&(i.fov=e.fov),this.locationMotion.set(r,t).catch(K),this.cameraMotion.set(i,t).catch(K)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[],i=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{distance:t.value.distance,x:t.value.offset.x,y:t.value.offset.y,z:t.value.offset.z}}),i.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.locationMotion.setKeyframes(r,t).catch(K),this.cameraMotion.setKeyframes(e,t)})}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{state:n,currentState:r,duration:i,userAction:a}=this.initial;this.userAction=a;let o=e.initAnimationEndState(this),s={longitude:o.longitude,latitude:o.latitude,fov:o.fov},c={x:o.offset.x,y:o.offset.y,z:o.offset.z,distance:o.distance};this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:o,userAction:this.userAction})),this.modelAlphaMotion.set({modelAlpha:1},i/3).catch(K),this.perspToOrthoMotion.set({perspToOrtho:1},i).catch(K),this.cameraMotion.set(s,i).catch(K),this.locationMotion.set(c,i).then(()=>{this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:o,userAction:this.userAction}))},e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:t,userAction:this.userAction}))}).then(()=>{t()})})}requestMomentumMovement(){this.inMomentumMovement=null}onPanGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=this.panState,n=e.pointers.length;if(e.isFinal?this.panState=void 0:this.panState={pointerLength:n,defaultPrevented:e.defaultPrevented,x:e.center.x,y:e.center.y},t===void 0||t.pointerLength!==n){this.emit(`gesture.pan`,e);return}let r={x:e.center.x-t.x,y:e.center.y-t.y},i=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),a=this.locationMotion.value.distance;a*=Math.tan(this.cameraMotion.value.fov/2*Math.PI/180);let o=this.renderer.getSize(new c.Vector2),s=2*r.x*a/o.y,l=2*r.y*a/o.y,u=new c.Vector3;u.setFromMatrixColumn(this.camera.matrix,0),u.multiplyScalar(-s),i.add(u),u.setFromMatrixColumn(this.camera.matrix,1),u.multiplyScalar(l),i.add(u);let d=this.modelScene.boundingBox.getCenter(new c.Vector3),f=this.modelScene.boundingBox.getSize(new c.Vector3),p=Math.max(f.x,f.y,f.z)/2;if(i.clamp(d.clone().sub(new c.Vector3().setScalar(p)),d.clone().add(new c.Vector3().setScalar(p))),e.state=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:0,latitude:Math.PI/2,fov:this.cameraMotion.value.fov,offset:i,distance:this.locationMotion.value.distance}),this.emit(`gesture.pan`,e),e.defaultPrevented){this.panState&&(this.panState.defaultPrevented=e.defaultPrevented);return}e.isFinal&&t.defaultPrevented||this.locationMotion.set({x:i.x,y:i.y,z:i.z},0).catch(K)}onPinchGesture(e){var t;if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement();let n=(t=this.pinchState)==null?void 0:t.fov;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&(this.pinchState=void 0),n===void 0)return;let r=U(n/e.scale,this.minFov,this.maxFov);e.state.fov=r,this.emit(`gesture.pinch`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:r},0).catch(K),e.type=`gesture.pan`,this.onPanGesture(e))}onMouseWheel(e){if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement();let t=U(this.cameraMotion.value.fov-e.center.delta,this.minFov,this.maxFov);e.state.fov=t,this.emit(`gesture.mousewheel`,e),!e.defaultPrevented&&this.cameraMotion.set({fov:t},0).catch(K)}},ng={defaultLatitude:0,defaultFov:90,maxFov:120,minFov:20,maxLatitude:e=>Math.PI/2-e/2/180*Math.PI,minLatitude:e=>-Math.PI/2+e/2/180*Math.PI,moveSpeed:3.6,intersectMeshCreator:()=>new Jh,aerialObserverMinHeight:5},rg=class e extends Gh{static parseArgs(t){var n,r,i,a,o,s,c,l,u;if(t instanceof e)return t;let d=super.parseArgs(t);return Object.assign(Object.assign({},d),{defaultLatitude:(n=t.defaultLatitude)==null?ng.defaultLatitude:n,defaultFov:(r=t.defaultFov)==null?ng.defaultFov:r,maxFov:(i=t.maxFov)==null?ng.maxFov:i,minFov:(a=t.minFov)==null?ng.minFov:a,maxLatitude:(o=t.maxLatitude)==null?ng.maxLatitude:o,minLatitude:(s=t.minLatitude)==null?ng.minLatitude:s,moveSpeed:(c=t.moveSpeed)==null?ng.moveSpeed:c,intersectMeshCreator:(l=t.intersectMeshCreator)==null?ng.intersectMeshCreator:l,aerialObserverMinHeight:(u=t.aerialObserverMinHeight)==null?ng.aerialObserverMinHeight:u})}static initAnimationEndState(e){var t,n,r,i,a,o;let s=this.parseArgs(e),l=s.works,{state:u,currentState:d}=e.initial,f=typeof u.panoIndex==`number`?{workCode:(r=(t=u.workCode)==null?(n=s.works[0])==null?void 0:n.workCode:t)==null?``:r,panoIndex:u.panoIndex}:{workCode:d.workCode,panoIndex:d.panoIndex},p=l.getObserver(f),m=U((i=u.fov)==null?Fh(d.mode)?d.fov:s.defaultFov:i,s.minFov,s.maxFov),h=(a=u.longitude)==null?d.longitude:a,g=U(typeof s.minLatitude==`function`?s.minLatitude(m):s.minLatitude,-Math.PI/2,Math.PI/2),_=U(typeof s.maxLatitude==`function`?s.maxLatitude(m):s.maxLatitude,-Math.PI/2,Math.PI/2),v=U((o=u.latitude)==null?Fh(d.mode)?d.latitude:s.defaultLatitude:o,g,_),y=new c.Vector3;return p&&y.copy(p.position).applyMatrix4(p.work.transform),{workCode:f.workCode,panoIndex:f.panoIndex,mode:`PanoramaLike`,longitude:h,latitude:v,fov:m,offset:y,distance:0}}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`PanoramaLike`,this.defaultLatitude=n.defaultLatitude,this.defaultFov=n.defaultFov,this.maxFov=n.maxFov,this.minFov=n.minFov,this.maxLatitude=n.maxLatitude,this.minLatitude=n.minLatitude,this.moveSpeed=n.moveSpeed,this.intersectMeshCreator=n.intersectMeshCreator,this.aerialObserverMinHeight=n.aerialObserverMinHeight,this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=`intersect`,this.intersectMesh.visible=!1,this.helper.add(this.intersectMesh)}updateConfiguration(e){if(super.updateConfiguration(e)===!1)return!1;if(e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.defaultFov!==void 0&&this.defaultFov!==e.defaultFov&&(this.defaultFov=e.defaultFov),e.maxFov!==void 0&&this.maxFov!==e.maxFov&&(this.maxFov=e.maxFov),e.minFov!==void 0&&this.minFov!==e.minFov&&(this.minFov=e.minFov),e.moveSpeed!==void 0&&this.moveSpeed!==e.moveSpeed&&(this.moveSpeed=e.moveSpeed),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;let t=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=t.name,this.intersectMesh.visible=t.visible;let n=this.intersectMesh.parent;n&&n.add(this.intersectMesh),t.dispose()}return e.aerialObserverMinHeight!==void 0&&this.aerialObserverMinHeight!==e.aerialObserverMinHeight&&(this.aerialObserverMinHeight=e.aerialObserverMinHeight),!0}destroy(){super.destroy(),this.intersectMesh&&(this.helper.remove(this.intersectMesh),this.intersectMesh.dispose()),this.panState=void 0}isReady(){return this.panState||this.pinchState?!1:super.isReady()}calculateMovingDuration(e,t){switch(typeof e){case`function`:return e(t,this.moveSpeed);case`number`:return e;case`string`:return Number(e);default:return U(t,2,5)/this.moveSpeed*1e3}}hideIntersectMesh(){this.intersectMesh.visible=!1,this.needsRender=!0}coordinatesForOffset(e){let t=this.cameraMotion.value.fov,n=this.camera.aspect,r=this.renderer.getSize(new c.Vector2);return{longitude:2*e.x/(r.x*this.viewport.width)*t/95*n,latitude:-2*e.y/(r.y*this.viewport.height)*t/95}}cameraBounce(){let{longitude:e,latitude:t,fov:n}=this.cameraMotion.value,r=[{progress:0,value:{longitude:e,latitude:t,fov:n}},{progress:.5,value:{longitude:e,latitude:t,fov:n*.98}},{progress:1,value:{longitude:e,latitude:t,fov:n}}];this.cameraMotion.setKeyframes(r,500).catch(K)}requestMomentumMovement(e,t,n,r){if(this.inMomentumMovement===null)return;r=Math.max(r,1);let i=Object.assign({},n),a={longitude:0,latitude:0};for(let e=0;e<r;e++)i.longitude*=.996,i.latitude*=.996*.99,a.longitude+=i.longitude,a.latitude+=i.latitude;let o=this.cameraMotion.value.fov,s=Vt(this.cameraMotion.value.longitude+a.longitude),c=U(typeof this.minLatitude==`function`?this.minLatitude(o):this.minLatitude,-Math.PI/2,Math.PI/2),l=U(typeof this.maxLatitude==`function`?this.maxLatitude(o):this.maxLatitude,-Math.PI/2,Math.PI/2),u=U(this.cameraMotion.value.latitude+a.latitude,c,l),d=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:s,latitude:u,fov:o,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),f=!(i.longitude>1e-4||i.longitude<-1e-4||i.latitude>1e-4||i.latitude<-1e-4),p=Q(`gesture.momentum`,Object.assign(Object.assign({},e),{isFirst:t,isFinal:f,state:d}));if(this.emit(`gesture.fire`,p),this.inMomentumMovement.event=p,this.emit(`gesture.momentum`,p),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:s,latitude:u},0).catch(K),f?this.inMomentumMovement=null:si.shared.add((t,n)=>{this.requestMomentumMovement(e,!1,i,n)},!0))}onPanGesture(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let t=this.panState,n=e.pointers.length;if(e.isFinal?this.panState=void 0:this.panState={pointerLength:n,defaultPrevented:e.defaultPrevented,x:e.center.x,y:e.center.y},t===void 0||t.pointerLength!==n){this.emit(`gesture.pan`,e);return}let r={x:e.center.x-t.x,y:e.center.y-t.y},i=this.coordinatesForOffset(r),a=Vt(this.cameraMotion.value.longitude+i.longitude),o=this.cameraMotion.value.fov,s=U(typeof this.minLatitude==`function`?this.minLatitude(o):this.minLatitude,-Math.PI/2,Math.PI/2),c=U(typeof this.maxLatitude==`function`?this.maxLatitude(o):this.maxLatitude,-Math.PI/2,Math.PI/2),l=U(this.cameraMotion.value.latitude+i.latitude,s,c);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(l=this.cameraMotion.value.latitude);let u=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:a,latitude:l,fov:o,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance});if(e.state=u,this.emit(`gesture.pan`,e),e.defaultPrevented){this.panState&&(this.panState.defaultPrevented=e.defaultPrevented);return}if(e.isFinal&&t.defaultPrevented)return;let d={longitude:u.longitude,latitude:u.latitude,fov:u.fov};if(this.cameraMotion.set(d,0).catch(K),e.isFinal){let t=e.velocityX,n=e.velocityY*.6;Math.abs(n)>.5&&Math.abs(t)<.5&&(t=0),this.inMomentumMovement={uuid:rn()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:t,y:n}),0)}}onPinchGesture(e){var t;this.userAction=e.userAction,this.stopMomentumMovement();let n=(t=this.pinchState)==null?void 0:t.fov,r=e.scale;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&(this.pinchState=void 0),n===void 0)return;let i=U(n/r,this.minFov,this.maxFov),a=U(typeof this.minLatitude==`function`?this.minLatitude(i):this.minLatitude,-Math.PI/2,Math.PI/2),o=U(typeof this.maxLatitude==`function`?this.maxLatitude(i):this.maxLatitude,-Math.PI/2,Math.PI/2),s=U(this.cameraMotion.value.latitude,a,o);e.state.fov=i,e.state.latitude=s,this.emit(`gesture.pinch`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:i,latitude:s},0).catch(K),e.type=`gesture.pan`,this.onPanGesture(e))}onMouseWheel(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=U(this.cameraMotion.value.fov-e.center.delta,this.minFov,this.maxFov),n=U(typeof this.minLatitude==`function`?this.minLatitude(t):this.minLatitude,-Math.PI/2,Math.PI/2),r=U(typeof this.maxLatitude==`function`?this.maxLatitude(t):this.maxLatitude,-Math.PI/2,Math.PI/2),i=U(this.cameraMotion.value.latitude,n,r);e.state.fov=t,e.state.latitude=i,this.emit(`gesture.mousewheel`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:t,latitude:i},0).catch(K),this.onMouseMove(e))}onMouseMove(e){var t,n;if(!this.intersectMesh.parent||this.panState||(this.emit(`gesture.mousemove`,e),e.defaultPrevented))return;let r=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent){this.hideIntersectMesh();return}r.floorIndex=-1;let[i]=this.modelScene.intersectRaycaster(r),a=Q(`intersect.update`,{raycaster:r,intersection:i==null?null:i,object:this.intersectMesh});if(this.emit(`intersect.update`,a),a.defaultPrevented){this.hideIntersectMesh();return}if(i){let e=(n=(t=i.face)==null?void 0:t.normal)==null?new c.Vector3().copy(r.ray.direction).multiplyScalar(-1):n,a=e.clone(),o=i.point.clone();this.intersectMesh.position.copy(o);let s=o.clone().add(a);if(this.intersectMesh.lookAt(s),Math.abs(e.y)>.99){let e=this.camera.position.clone().sub(o);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}onDblTapGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=this.cameraMotion.value.fov,n=2,r=this.works.getObserver(this.currentPano);if(r){let e=r.images.tiles;e&&e.length&&(n=Math.max(...e.map(e=>e.level)))}let i=Math.max(40-n*5,this.minFov,5),a=i-t<t-this.defaultFov?i:this.defaultFov;e.state.fov=a,this.emit(`gesture.dbltap`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:a},360).catch(K),this.hideIntersectMesh())}},ig=`data:video/mp4;base64,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`,ag;function og(){return ag||(ag=new Promise(e=>{let t,n=document.createElement(`video`);n.muted=!0,n.src=ig,n.addEventListener(`timeupdate`,function r(){n.removeEventListener(`timeupdate`,r,!1),clearTimeout(t);let i=document.createElement(`canvas`);i.width=i.height=1;let a=i.getContext(`2d`);if(!a){e(!1);return}a.drawImage(n,0,0,1,1);let{data:o}=a.getImageData(0,0,1,1);o[3]>10?e(!0):e(!1)},!1),n.addEventListener(`canplay`,function e(){n.removeEventListener(`canplay`,e,!1),n.play()},!1),t=window.setTimeout(()=>e(!1),1e3)}))}var sg=[`right`,`left`,`up`,`down`,`front`,`back`];function cg(e,t,n,r){let i=new c.Box3;switch(e){case`up`:i.min.y=.5,i.max.y=.5,i.min.x=t-.5,i.max.x=t-.5+r,i.min.z=-n+.5-r,i.max.z=-n+.5;break;case`down`:i.min.y=-.5,i.max.y=-.5,i.min.x=t-.5,i.max.x=t-.5+r,i.min.z=n-.5,i.max.z=n-.5+r;break;case`left`:i.min.x=-.5,i.max.x=-.5,i.min.z=-t+.5-r,i.max.z=-t+.5,i.min.y=-n+.5-r,i.max.y=-n+.5;break;case`right`:i.min.x=.5,i.max.x=.5,i.min.z=t-.5,i.max.z=t-.5+r,i.min.y=-n+.5-r,i.max.y=-n+.5;break;case`front`:i.min.z=-.5,i.max.z=-.5,i.min.x=t-.5,i.max.x=t-.5+r,i.min.y=-n+.5-r,i.max.y=-n+.5;break;case`back`:i.min.z=.5,i.max.z=.5,i.min.x=-t+.5-r,i.max.x=-t+.5,i.min.y=-n+.5-r,i.max.y=-n+.5;break;default:break}return i.applyMatrix4(new c.Matrix4().makeRotationY(Math.PI))}var lg=(e,t)=>{if(e.level>=t)return;let n=e.level+1,r=e.size/2,i=[new c.Vector2(e.position.x,e.position.y),new c.Vector2(e.position.x+r,e.position.y),new c.Vector2(e.position.x,e.position.y+r),new c.Vector2(e.position.x+r,e.position.y+r)];for(let a of i){let i={face:e.face,level:n,size:r,position:a,box:cg(e.face,a.x,a.y,r),parent:e,children:[]};e.children.push(i),lg(i,t)}};function ug(e,t){let n={level:0,face:e,position:new c.Vector2(0,0),size:1,box:cg(e,0,0,1),parent:null,children:[]};return lg(n,t),n}function dg(e){return{children:sg.map(t=>ug(t,e)),maxLevel:e}}function fg(e,t){for(let n of e.children)t(n)!==!1&&fg(n,t)}var pg,mg=new c.Vector3,hg=new c.Quaternion,gg=new c.Matrix4,_g=new c.Matrix4,vg=new c.Matrix4,yg=new c.Matrix4,bg=new c.Matrix4,xg=new c.Quaternion,Sg=new c.Matrix4,Cg=new c.Color(0,0,0),wg=0,Tg=new c.Color,Eg=[],Dg=(pg=Math.SQRT1_2)==null?Math.sqrt(2):pg,Og={up:new c.Quaternion(Dg,0,0,Dg),down:new c.Quaternion(-Dg,0,0,Dg),left:new c.Quaternion(0,Dg,0,Dg),right:new c.Quaternion(0,-Dg,0,Dg),front:new c.Quaternion(0,0,0,1),back:new c.Quaternion(0,1,0,0)},kg=(()=>{let e=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),t=new Float32Array([0,0,1,0,0,1,1,1]),n=new Uint32Array([0,1,2,1,3,2]),r=new c.BufferGeometry;return r.setAttribute(`position`,new c.BufferAttribute(e,3)),r.setAttribute(`uv`,new c.BufferAttribute(t,2)),r.setIndex(new c.BufferAttribute(n,1)),r.computeBoundingBox(),r})(),Ag=`
1532
+ `,side:c.DoubleSide,blending:c.CustomBlending,blendSrc:c.SrcAlphaFactor,blendDst:c.OneMinusSrcAlphaFactor,blendSrcAlpha:c.OneFactor,blendDstAlpha:c.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0}),Zh=class extends c.Object3D{constructor(){super(),this.ringMesh=new c.Mesh(Yh,Xh),this.ringMesh.position.z=.01,this.ringMesh.renderOrder=9999999999,this.add(this.ringMesh)}dispose(){this.remove(this.ringMesh)}};function Qh(e){if(e instanceof Error)return e;let t=typeof e;return Error(t&&t===`object`?JSON.stringify(e):e)}var $h=new c.Box3,eg=new c.Vector3,tg={defaultLongitude:Math.PI/4,defaultLatitude:Math.PI/4,defaultFov:80,maxFov:120,minFov:20,maxLatitude:Math.PI/2,minLatitude:-Math.PI/2,intersectMeshCreator:()=>new Zh},ng=class e extends Jh{static distanceFromModel(e,t,n){let r=e.boundingBox,i=r.isEmpty()?10:Math.pow(Math.pow(r.max.x-r.min.x+1,2)+Math.pow(r.max.y-r.min.y+1,2)+Math.pow(r.max.z-r.min.z+1,2),1/2);i=isNaN(i)||!isFinite(i)?1:i;let a=i/2/Math.tan(Math.PI*t/360);return n<1&&(a/=n),isNaN(a)||!isFinite(a)?i:a}static parseArgs(t){var n,r,i,a,o,s,c,l;if(t instanceof e)return t;let u=super.parseArgs(t);return Object.assign(Object.assign({},u),{defaultLongitude:(n=t.defaultLongitude)==null?tg.defaultLongitude:n,defaultLatitude:(r=t.defaultLatitude)==null?tg.defaultLatitude:r,defaultFov:(i=t.defaultFov)==null?tg.defaultFov:i,maxFov:(a=t.maxFov)==null?tg.maxFov:a,minFov:(o=t.minFov)==null?tg.minFov:o,maxLatitude:(s=t.maxLatitude)==null?tg.maxLatitude:s,minLatitude:(c=t.minLatitude)==null?tg.minLatitude:c,intersectMeshCreator:(l=t.intersectMeshCreator)==null?tg.intersectMeshCreator:l})}static initAnimationEndState(t){var n,r,i,a,o,s,l;let u=this.parseArgs(t),{state:d,currentState:f}=t.initial,p=typeof d.panoIndex==`number`?{workCode:(i=(n=d.workCode)==null?(r=u.works[0])==null?void 0:r.workCode:n)==null?``:i,panoIndex:d.panoIndex}:{workCode:f.workCode,panoIndex:f.panoIndex},m=(a=d.fov)==null?u.defaultFov:a,h=(o=d.longitude)==null?Lh(f.mode)?f.longitude:u.defaultLongitude:o,g=U(typeof u.minLatitude==`function`?u.minLatitude(m):u.minLatitude,-Math.PI/2,Math.PI/2),_=U(typeof u.maxLatitude==`function`?u.maxLatitude(m):u.maxLatitude,-Math.PI/2,Math.PI/2),v=U((s=d.latitude)==null?f.mode===`Floorplan`?f.latitude:u.defaultLatitude:s,g,_),y=d.offset?d.offset.clone():t.modelScene.boundingBox.getCenter(new c.Vector3),b=(l=d.distance)==null?e.distanceFromModel(u.modelScene,u.defaultFov,u.camera.aspect):l;return Object.assign(Object.assign({},p),{mode:`Floorplan`,longitude:h,latitude:v,fov:m,offset:y,distance:b})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Floorplan`,this.defaultLongitude=n.defaultLongitude,this.defaultLatitude=n.defaultLatitude,this.defaultFov=n.defaultFov,this.maxFov=n.maxFov,this.minFov=n.minFov,this.maxLatitude=n.maxLatitude,this.minLatitude=n.minLatitude,this.locationMotion=new X({x:this.camera.pose.offset.x,y:this.camera.pose.offset.y,z:this.camera.pose.offset.z,distance:this.camera.pose.distance}),this.modelAlphaMotion=new X({modelAlpha:this.modelScene.parameter.resolveValue(`modelAlpha`)}),this.perspToOrthoMotion=new X({perspToOrtho:this.camera.perspToOrtho.x}),this.pendingTextureId=null,this.textureLoader=new yi,this.intersectMeshCreator=n.intersectMeshCreator,this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=`intersect`,this.intersectMesh.visible=!1,this.helper.add(this.intersectMesh)}updateConfiguration(e){if(super.updateConfiguration(e)===!1)return!1;if(e.defaultLongitude!==void 0&&this.defaultLongitude!==e.defaultLongitude&&(this.defaultLongitude=e.defaultLongitude),e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.defaultFov!==void 0&&this.defaultFov!==e.defaultFov&&(this.defaultFov=e.defaultFov),e.maxFov!==void 0&&this.maxFov!==e.maxFov&&(this.maxFov=e.maxFov),e.minFov!==void 0&&this.minFov!==e.minFov&&(this.minFov=e.minFov),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;let t=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=t.name,this.intersectMesh.visible=t.visible;let n=this.intersectMesh.parent;n&&n.add(this.intersectMesh),t.dispose()}return!0}destroy(){super.destroy(),this.pendingTextureId=null,this.locationMotion.dispose(),this.panState=void 0,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)}isReady(){return this.locationMotion.ended===!1?!1:super.isReady()}updateWork(e,t,n,r){var i;return this.works=e,this.updateCamera(t,(i=n.duration)==null?0:i,r),!0}updateModel(t){super.updateModel(t);let n=t.boundingBox.getCenter(new c.Vector3),r=e.distanceFromModel(t,this.defaultFov,this.camera.aspect);this.updateCamera({offset:n,distance:r},0,!0)}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={},i={};return e.distance!==void 0&&(r.distance=e.distance),e.offset!==void 0&&(r.x=e.offset.x,r.y=e.offset.y,r.z=e.offset.z),e.longitude!==void 0&&(i.longitude=e.longitude),e.latitude!==void 0&&(i.latitude=e.latitude),e.fov!==void 0&&(i.fov=e.fov),this.locationMotion.set(r,t).catch(K),this.cameraMotion.set(i,t).catch(K)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[],i=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{distance:t.value.distance,x:t.value.offset.x,y:t.value.offset.x,z:t.value.offset.x}}),i.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.locationMotion.setKeyframes(r,t).catch(K),this.cameraMotion.setKeyframes(e,t)})}updateTime(e,t,...n){if(this.destroyed)return;let r={},i={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),r.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){let{pano0:e,pano1:t}=this.modelScene.parameter;e&&e.map!==(t==null?void 0:t.map)&&e.map.dispose(),r.progress=1,r.pano0=r.pano1=t}if(this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(U(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended||(this.locationMotion.update(e),i.distance=this.locationMotion.value.distance,i.offset=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),i.longitude=this.cameraMotion.value.longitude,i.latitude=this.cameraMotion.value.latitude,i.fov=this.cameraMotion.value.fov),zh(r)||this.modelScene.parameter.set(r),zh(i)||this.setCamera(i),this.intersectMesh&&this.intersectMesh.parent){let e=U(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1)}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(H())[1],t=this.locationMotion.getKeyFrameSegment(H())[1];return Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new c.Vector3(t.value.x,t.value.y,t.value.z),distance:t.value.distance})}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{state:n,currentState:r,duration:i,userAction:a}=this.initial;this.userAction=a;let o=e.initAnimationEndState(this),s=vr(o,[`longitude`,`latitude`,`fov`]),c={x:o.offset.x,y:o.offset.y,z:o.offset.z,distance:o.distance};this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:o,userAction:this.userAction})),this.modelAlphaMotion.set({modelAlpha:1},i/3).catch(K),this.perspToOrthoMotion.set({perspToOrtho:0},i).catch(K),this.cameraMotion.set(s,i).catch(K),this.locationMotion.set(c,i).then(()=>{this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:o,userAction:this.userAction}))},e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:t,userAction:this.userAction}))}).then(()=>{t()})})}updateRenderSize(e){this.needsRender=!0}getForwardObserverOrNot(e){let[t]=this.modelScene.intersectRaycaster(e);if(!t)return null;let n=[];for(let t of this.works){let r=this.modelScene.models.find(e=>e.work===t);if(!(!r||r.visible===!1)&&!(t.observers.length<=0)&&($h.copy(t.observerBox).expandByScalar(10).applyMatrix4(t.transform),$h.containsPoint(e.ray.origin)||e.ray.intersectsBox($h)))for(let e of t.observers)n.push(e)}let[r,i]=Hl(n,e=>eg.copy(e.standingPosition).applyMatrix4(e.work.transform).distanceTo(t.point),!0);return r&&i<Math.max(r.standingPosition.distanceTo(this.camera.position)/5,10)?r:null}coordinatesForOffset(e){let t=this.renderer.getSize(new c.Vector2);return{longitude:-2*e.x/(t.x*this.viewport.width),latitude:2*e.y/(t.y*this.viewport.height)}}requestMomentumMovement(e,t,n,r){if(this.inMomentumMovement===null)return;r=Math.max(r,1);let i=Object.assign({},n),a={longitude:0,latitude:0};for(let e=0;e<r;e++)i.longitude*=.996,i.latitude*=.996*.998,a.longitude+=i.longitude,a.latitude+=i.latitude;let o=Vt(this.cameraMotion.value.longitude+a.longitude),s=this.cameraMotion.value.fov,c=U(typeof this.minLatitude==`function`?this.minLatitude(s):this.minLatitude,-Math.PI/2,Math.PI/2),l=U(typeof this.maxLatitude==`function`?this.maxLatitude(s):this.maxLatitude,-Math.PI/2,Math.PI/2),u=U(this.cameraMotion.value.latitude+a.latitude,c,l),d=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:o,latitude:u,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),f=!(i.longitude>1e-4||i.longitude<-1e-4||i.latitude>1e-4||i.latitude<-1e-4),p=Q(`gesture.momentum`,Object.assign(Object.assign({},e),{isFirst:t,isFinal:f,state:d}));if(this.emit(`gesture.fire`,p),this.inMomentumMovement.event=p,this.emit(`gesture.momentum`,p),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:o,latitude:u},0).catch(K),f?this.inMomentumMovement=null:si.shared.add((t,n)=>{this.requestMomentumMovement(e,!1,i,n)},!0))}onPanGesture(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let t=this.panState,n=e.pointers.length;if(e.isFinal?this.panState=void 0:this.panState={pointerLength:n,defaultPrevented:e.defaultPrevented,x:e.center.x,y:e.center.y},t===void 0||t.pointerLength!==n){this.emit(`gesture.pan`,e);return}let r={x:e.center.x-t.x,y:e.center.y-t.y},i=this.relativeClientPosition(e.center),a=1,o=this.camera.pose.latitude;Math.abs(o)>Math.PI/6&&(a=o<0?i.y<0?-1:1:i.y>0?-1:1),r.x*=a;let s=this.coordinatesForOffset(r),c=Vt(this.cameraMotion.value.longitude+s.longitude),l=this.camera.pose.fov,u=U(typeof this.minLatitude==`function`?this.minLatitude(l):this.minLatitude,-Math.PI/2,Math.PI/2),d=U(typeof this.maxLatitude==`function`?this.maxLatitude(l):this.maxLatitude,-Math.PI/2,Math.PI/2),f=U(this.cameraMotion.value.latitude+s.latitude,u,d);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(f=this.cameraMotion.value.latitude);let p=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:c,latitude:f,fov:l,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.state=p,this.emit(`gesture.pan`,e),e.defaultPrevented){this.panState&&(this.panState.defaultPrevented=e.defaultPrevented);return}if(!(e.isFinal&&t.defaultPrevented)&&(this.cameraMotion.set({longitude:p.longitude,latitude:p.latitude},0).catch(K),e.isFinal)){let t=e.velocityX*a,n=e.velocityY;this.inMomentumMovement={uuid:rn()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:t,y:n}),0)}}onPinchGesture(e){var t;if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement();let n=(t=this.pinchState)==null?void 0:t.fov;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&(this.panState=void 0,this.pinchState=void 0),n===void 0)return;let r=U(n/e.scale,this.minFov,this.maxFov),i=U(typeof this.minLatitude==`function`?this.minLatitude(r):this.minLatitude,-Math.PI/2,Math.PI/2),a=U(typeof this.maxLatitude==`function`?this.maxLatitude(r):this.maxLatitude,-Math.PI/2,Math.PI/2),o=U(this.cameraMotion.value.latitude,i,a);e.state.fov=r,e.state.latitude=o,this.emit(`gesture.pinch`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:r,latitude:o},0).catch(K),this.onPanGesture(e))}onMouseMove(e){var t,n;if(!this.intersectMesh.parent||this.panState)return;if(this.emit(`gesture.mousemove`,e),e.defaultPrevented){this.hideIntersectMesh();return}let r=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}let[i]=this.modelScene.intersectRaycaster(r),a=Q(`intersect.update`,{raycaster:r,intersection:i==null?null:i,object:this.intersectMesh});if(this.emit(`intersect.update`,a),a.defaultPrevented){this.hideIntersectMesh();return}if(i){let e=(n=(t=i.face)==null?void 0:t.normal)==null?new c.Vector3().copy(r.ray.direction).multiplyScalar(-1):n,a=e.clone(),o=i.point.clone();this.intersectMesh.position.copy(o);let s=o.clone().add(a);if(this.intersectMesh.lookAt(s),Math.abs(e.y)>.99){let e=this.camera.position.clone().sub(o);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}onMouseWheel(e){if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement();let{minFov:t,maxFov:n}=this,r=U(this.camera.fov-e.center.delta,t,n),i=U(typeof this.minLatitude==`function`?this.minLatitude(r):this.minLatitude,-Math.PI/2,Math.PI/2),a=U(typeof this.maxLatitude==`function`?this.maxLatitude(r):this.maxLatitude,-Math.PI/2,Math.PI/2),o=U(this.cameraMotion.value.latitude,i,a);e.state.fov=r,e.state.latitude=o,this.emit(`gesture.mousewheel`,e),!e.defaultPrevented&&this.cameraMotion.set({fov:r,latitude:o},0).catch(K)}onTapGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=e.center.raycaster,n=this.getForwardObserverOrNot(t);if(!n)this.emit(`gesture.tap`,e);else{let t={longitude:this.camera.pose.longitude,latitude:0},r=Object.assign(Object.assign({},e.state),{mode:`Panorama`,workCode:n.work.workCode,panoIndex:n.panoIndex,longitude:t.longitude,latitude:t.latitude,offset:n?n.position.clone():new c.Vector3,distance:0});if(e.state=r,this.emit(`gesture.tap`,e),!e.defaultPrevented&&(this.emit(`pano.select`,Q(`pano.select`,{prevPano:this.currentPano,pano:{panoIndex:r.panoIndex,workCode:r.workCode},state:r,userAction:e.userAction,options:t,progress:0,error:null})),n&&n.active)){let e=this.pendingTextureId=rn(),i={panoIndex:n.panoIndex,workCode:n.work.workCode},a=Z(i),o={right:n.images.work.getURL(n.images.right),left:n.images.work.getURL(n.images.left),up:n.images.work.getURL(n.images.up),down:n.images.work.getURL(n.images.down),front:n.images.work.getURL(n.images.front),back:n.images.work.getURL(n.images.back)},s=this.imageOptions.transform,l=Object.assign({key:`pano.${a}`},vr(this.imageOptions,[`format`,`size`,`quality`,`sharpen`,`forceUseExifOrientation`,`mappings`])),u=`pano:`+_p([o,l,s]),d=this.modelScene.parameter,f=Ah(`pano.prepare`,{prevPano:this.currentPano,pano:i});if(this.emit(`pano.prepare`,f),f.defaultPrevented){this.pendingTextureId=null;return}let p;d.pano0&&d.pano0.map.name===u?p=d.pano0:d.pano1&&d.pano1.map.name===u&&(p=d.pano1),p?Promise.resolve().then(()=>jh(f)).catch(e=>Qh(e)).then(e=>{var n;e instanceof Error?(this.pendingTextureId=null,e.message&&this.emit(`error`,e)):(d.pano0&&d.pano0.map!==p.map&&d.pano0.map.dispose(),d.pano1&&d.pano1.map!==p.map&&d.pano1.map!==((n=d.pano0)==null?void 0:n.map)&&d.pano1.map.dispose(),d.set({pano0:p,pano1:p}),this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:r.panoIndex,workCode:r.workCode},progress:0,state:r,options:t,error:null})))}):Promise.all([Promise.resolve().then(()=>{this.emit(`pano.texture.load`,Q(`pano.texture.load`,{error:null,progress:0,meta:null,pano:i}))}).then(()=>this.textureLoader.loadCubeTexture(o,{imageURL:{transform:s,options:l},format:c.RGBFormat,viaAjax:!0,fetcher:Ef(this.fiveId,n.work)},void 0,void 0,void 0,this.renderer)).catch(e=>{let t=Qh(e);return this.emit(`pano.texture.error`,Q(`pano.texture.error`,{error:t,progress:0,meta:null,pano:i})),t}),Promise.resolve().then(()=>jh(f)).catch(e=>Qh(e))]).then(([i,o])=>{var s,l;if(!(i instanceof Error)&&!(o instanceof Error)){let{body:o}=i;if(this.destroyed||this.pendingTextureId!==e){o.dispose();return}this.pendingTextureId=null,o.name=u;let f=Array.isArray(o.image)?o.image[0]:o.image,p=(s=f==null?void 0:f.width)==null?2048:s,m=n.images.histogram;m||(m=new bm().formPixels(Kh(this.renderer,o,!0,gm).data),n.images.histogram=m);let h={panoId:a,map:o,mapSize:p,mapHistogram:new c.Vector4().fromArray(m.toArray()),matrix:n.matrix.clone().premultiply(n.work.transform),zoom:1};d.pano0&&d.pano0.map.dispose(),d.pano1&&d.pano1.map!==((l=d.pano0)==null?void 0:l.map)&&d.pano1.map.dispose(),d.set({pano0:h,pano1:h}),this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:r.panoIndex,workCode:r.workCode},progress:0,state:r,options:t,error:null}))}else{let t=null;if(i instanceof Error?t||(t=i):i.body.dispose(),o instanceof Error&&(t||(t=o)),this.destroyed||this.pendingTextureId!==e)return;this.pendingTextureId=null,t instanceof Error&&t.message&&this.emit(`error`,t)}})}}}onDblTapGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=this.cameraMotion.value.fov,n=this.minFov-t<t-this.defaultFov?this.minFov:this.defaultFov;e.state.fov=n,this.emit(`gesture.dbltap`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:n},360).catch(K),this.hideIntersectMesh())}hideIntersectMesh(){this.intersectMesh.visible=!1,this.needsRender=!0}},rg=Object.assign(Object.assign({},yr(tg,[`defaultLongitude`,`defaultLatitude`,`maxLatitude`,`minLatitude`])),{defaultLongitude:0,defaultLatitude:Math.PI/2}),ig=class e extends ng{static parseArgs(t){var n,r;if(t instanceof e)return t;let i=Object.assign(Object.assign({},t),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2,defaultLongitude:(n=t.defaultLongitude)==null?rg.defaultLongitude:n,defaultLatitude:(r=t.defaultLatitude)==null?rg.defaultLatitude:r});return super.parseArgs(i)}static initAnimationEndState(e){var t,n;let r=this.parseArgs(e),i=super.initAnimationEndState(Object.assign(Object.assign({},r),{initial:Object.assign(Object.assign({},r.initial),{state:Object.assign(Object.assign({},r.initial.state),{longitude:(t=r.initial.state.longitude)==null?r.defaultLongitude:t,latitude:(n=r.initial.state.latitude)==null?r.defaultLatitude:n})})}));return Object.assign(Object.assign({},i),{mode:`Topview`})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Topview`}updateConfiguration(e){return super.updateConfiguration(Object.assign({},e))}updateModel(e){this.needsRender=!0;let t=this.modelScene.boundingBox.getCenter(new c.Vector3);this.locationMotion.set({x:t.x,y:t.y,z:t.z,distance:ng.distanceFromModel(this.modelScene,this.defaultFov,this.camera.aspect)},0).catch(K),this.hideIntersectMesh()}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={},i={};return e.distance!==void 0&&(r.distance=e.distance),e.offset!==void 0&&(r.x=e.offset.x,r.y=e.offset.y,r.z=e.offset.z),e.longitude!==void 0&&(i.longitude=e.longitude),e.latitude!==void 0&&(i.latitude=e.latitude),e.fov!==void 0&&(i.fov=e.fov),this.locationMotion.set(r,t).catch(K),this.cameraMotion.set(i,t).catch(K)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[],i=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{distance:t.value.distance,x:t.value.offset.x,y:t.value.offset.y,z:t.value.offset.z}}),i.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.locationMotion.setKeyframes(r,t).catch(K),this.cameraMotion.setKeyframes(e,t)})}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{state:n,currentState:r,duration:i,userAction:a}=this.initial;this.userAction=a;let o=e.initAnimationEndState(this),s={longitude:o.longitude,latitude:o.latitude,fov:o.fov},c={x:o.offset.x,y:o.offset.y,z:o.offset.z,distance:o.distance};this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:o,userAction:this.userAction})),this.modelAlphaMotion.set({modelAlpha:1},i/3).catch(K),this.perspToOrthoMotion.set({perspToOrtho:1},i).catch(K),this.cameraMotion.set(s,i).catch(K),this.locationMotion.set(c,i).then(()=>{this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:o,userAction:this.userAction}))},e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:t,userAction:this.userAction}))}).then(()=>{t()})})}requestMomentumMovement(){this.inMomentumMovement=null}onPanGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=this.panState,n=e.pointers.length;if(e.isFinal?this.panState=void 0:this.panState={pointerLength:n,defaultPrevented:e.defaultPrevented,x:e.center.x,y:e.center.y},t===void 0||t.pointerLength!==n){this.emit(`gesture.pan`,e);return}let r={x:e.center.x-t.x,y:e.center.y-t.y},i=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),a=this.locationMotion.value.distance;a*=Math.tan(this.cameraMotion.value.fov/2*Math.PI/180);let o=this.renderer.getSize(new c.Vector2),s=2*r.x*a/o.y,l=2*r.y*a/o.y,u=new c.Vector3;u.setFromMatrixColumn(this.camera.matrix,0),u.multiplyScalar(-s),i.add(u),u.setFromMatrixColumn(this.camera.matrix,1),u.multiplyScalar(l),i.add(u);let d=this.modelScene.boundingBox.getCenter(new c.Vector3),f=this.modelScene.boundingBox.getSize(new c.Vector3),p=Math.max(f.x,f.y,f.z)/2;if(i.clamp(d.clone().sub(new c.Vector3().setScalar(p)),d.clone().add(new c.Vector3().setScalar(p))),e.state=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:0,latitude:Math.PI/2,fov:this.cameraMotion.value.fov,offset:i,distance:this.locationMotion.value.distance}),this.emit(`gesture.pan`,e),e.defaultPrevented){this.panState&&(this.panState.defaultPrevented=e.defaultPrevented);return}e.isFinal&&t.defaultPrevented||this.locationMotion.set({x:i.x,y:i.y,z:i.z},0).catch(K)}onPinchGesture(e){var t;if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement();let n=(t=this.pinchState)==null?void 0:t.fov;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&(this.pinchState=void 0),n===void 0)return;let r=U(n/e.scale,this.minFov,this.maxFov);e.state.fov=r,this.emit(`gesture.pinch`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:r},0).catch(K),e.type=`gesture.pan`,this.onPanGesture(e))}onMouseWheel(e){if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement();let t=U(this.cameraMotion.value.fov-e.center.delta,this.minFov,this.maxFov);e.state.fov=t,this.emit(`gesture.mousewheel`,e),!e.defaultPrevented&&this.cameraMotion.set({fov:t},0).catch(K)}},ag={defaultLatitude:0,defaultFov:90,maxFov:120,minFov:20,maxLatitude:e=>Math.PI/2-e/2/180*Math.PI,minLatitude:e=>-Math.PI/2+e/2/180*Math.PI,moveSpeed:3.6,intersectMeshCreator:()=>new Zh,aerialObserverMinHeight:5},og=class e extends Jh{static parseArgs(t){var n,r,i,a,o,s,c,l,u;if(t instanceof e)return t;let d=super.parseArgs(t);return Object.assign(Object.assign({},d),{defaultLatitude:(n=t.defaultLatitude)==null?ag.defaultLatitude:n,defaultFov:(r=t.defaultFov)==null?ag.defaultFov:r,maxFov:(i=t.maxFov)==null?ag.maxFov:i,minFov:(a=t.minFov)==null?ag.minFov:a,maxLatitude:(o=t.maxLatitude)==null?ag.maxLatitude:o,minLatitude:(s=t.minLatitude)==null?ag.minLatitude:s,moveSpeed:(c=t.moveSpeed)==null?ag.moveSpeed:c,intersectMeshCreator:(l=t.intersectMeshCreator)==null?ag.intersectMeshCreator:l,aerialObserverMinHeight:(u=t.aerialObserverMinHeight)==null?ag.aerialObserverMinHeight:u})}static initAnimationEndState(e){var t,n,r,i,a,o;let s=this.parseArgs(e),l=s.works,{state:u,currentState:d}=e.initial,f=typeof u.panoIndex==`number`?{workCode:(r=(t=u.workCode)==null?(n=s.works[0])==null?void 0:n.workCode:t)==null?``:r,panoIndex:u.panoIndex}:{workCode:d.workCode,panoIndex:d.panoIndex},p=l.getObserver(f),m=U((i=u.fov)==null?Rh(d.mode)?d.fov:s.defaultFov:i,s.minFov,s.maxFov),h=(a=u.longitude)==null?d.longitude:a,g=U(typeof s.minLatitude==`function`?s.minLatitude(m):s.minLatitude,-Math.PI/2,Math.PI/2),_=U(typeof s.maxLatitude==`function`?s.maxLatitude(m):s.maxLatitude,-Math.PI/2,Math.PI/2),v=U((o=u.latitude)==null?Rh(d.mode)?d.latitude:s.defaultLatitude:o,g,_),y=new c.Vector3;return p&&y.copy(p.position).applyMatrix4(p.work.transform),{workCode:f.workCode,panoIndex:f.panoIndex,mode:`PanoramaLike`,longitude:h,latitude:v,fov:m,offset:y,distance:0}}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`PanoramaLike`,this.defaultLatitude=n.defaultLatitude,this.defaultFov=n.defaultFov,this.maxFov=n.maxFov,this.minFov=n.minFov,this.maxLatitude=n.maxLatitude,this.minLatitude=n.minLatitude,this.moveSpeed=n.moveSpeed,this.intersectMeshCreator=n.intersectMeshCreator,this.aerialObserverMinHeight=n.aerialObserverMinHeight,this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=`intersect`,this.intersectMesh.visible=!1,this.helper.add(this.intersectMesh)}updateConfiguration(e){if(super.updateConfiguration(e)===!1)return!1;if(e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.defaultFov!==void 0&&this.defaultFov!==e.defaultFov&&(this.defaultFov=e.defaultFov),e.maxFov!==void 0&&this.maxFov!==e.maxFov&&(this.maxFov=e.maxFov),e.minFov!==void 0&&this.minFov!==e.minFov&&(this.minFov=e.minFov),e.moveSpeed!==void 0&&this.moveSpeed!==e.moveSpeed&&(this.moveSpeed=e.moveSpeed),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;let t=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=t.name,this.intersectMesh.visible=t.visible;let n=this.intersectMesh.parent;n&&n.add(this.intersectMesh),t.dispose()}return e.aerialObserverMinHeight!==void 0&&this.aerialObserverMinHeight!==e.aerialObserverMinHeight&&(this.aerialObserverMinHeight=e.aerialObserverMinHeight),!0}destroy(){super.destroy(),this.intersectMesh&&(this.helper.remove(this.intersectMesh),this.intersectMesh.dispose()),this.panState=void 0}isReady(){return this.panState||this.pinchState?!1:super.isReady()}calculateMovingDuration(e,t){switch(typeof e){case`function`:return e(t,this.moveSpeed);case`number`:return e;case`string`:return Number(e);default:return U(t,2,5)/this.moveSpeed*1e3}}hideIntersectMesh(){this.intersectMesh.visible=!1,this.needsRender=!0}coordinatesForOffset(e){let t=this.cameraMotion.value.fov,n=this.camera.aspect,r=this.renderer.getSize(new c.Vector2);return{longitude:2*e.x/(r.x*this.viewport.width)*t/95*n,latitude:-2*e.y/(r.y*this.viewport.height)*t/95}}cameraBounce(){let{longitude:e,latitude:t,fov:n}=this.cameraMotion.value,r=[{progress:0,value:{longitude:e,latitude:t,fov:n}},{progress:.5,value:{longitude:e,latitude:t,fov:n*.98}},{progress:1,value:{longitude:e,latitude:t,fov:n}}];this.cameraMotion.setKeyframes(r,500).catch(K)}requestMomentumMovement(e,t,n,r){if(this.inMomentumMovement===null)return;r=Math.max(r,1);let i=Object.assign({},n),a={longitude:0,latitude:0};for(let e=0;e<r;e++)i.longitude*=.996,i.latitude*=.996*.99,a.longitude+=i.longitude,a.latitude+=i.latitude;let o=this.cameraMotion.value.fov,s=Vt(this.cameraMotion.value.longitude+a.longitude),c=U(typeof this.minLatitude==`function`?this.minLatitude(o):this.minLatitude,-Math.PI/2,Math.PI/2),l=U(typeof this.maxLatitude==`function`?this.maxLatitude(o):this.maxLatitude,-Math.PI/2,Math.PI/2),u=U(this.cameraMotion.value.latitude+a.latitude,c,l),d=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:s,latitude:u,fov:o,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),f=!(i.longitude>1e-4||i.longitude<-1e-4||i.latitude>1e-4||i.latitude<-1e-4),p=Q(`gesture.momentum`,Object.assign(Object.assign({},e),{isFirst:t,isFinal:f,state:d}));if(this.emit(`gesture.fire`,p),this.inMomentumMovement.event=p,this.emit(`gesture.momentum`,p),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:s,latitude:u},0).catch(K),f?this.inMomentumMovement=null:si.shared.add((t,n)=>{this.requestMomentumMovement(e,!1,i,n)},!0))}onPanGesture(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let t=this.panState,n=e.pointers.length;if(e.isFinal?this.panState=void 0:this.panState={pointerLength:n,defaultPrevented:e.defaultPrevented,x:e.center.x,y:e.center.y},t===void 0||t.pointerLength!==n){this.emit(`gesture.pan`,e);return}let r={x:e.center.x-t.x,y:e.center.y-t.y},i=this.coordinatesForOffset(r),a=Vt(this.cameraMotion.value.longitude+i.longitude),o=this.cameraMotion.value.fov,s=U(typeof this.minLatitude==`function`?this.minLatitude(o):this.minLatitude,-Math.PI/2,Math.PI/2),c=U(typeof this.maxLatitude==`function`?this.maxLatitude(o):this.maxLatitude,-Math.PI/2,Math.PI/2),l=U(this.cameraMotion.value.latitude+i.latitude,s,c);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(l=this.cameraMotion.value.latitude);let u=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:a,latitude:l,fov:o,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance});if(e.state=u,this.emit(`gesture.pan`,e),e.defaultPrevented){this.panState&&(this.panState.defaultPrevented=e.defaultPrevented);return}if(e.isFinal&&t.defaultPrevented)return;let d={longitude:u.longitude,latitude:u.latitude,fov:u.fov};if(this.cameraMotion.set(d,0).catch(K),e.isFinal){let t=e.velocityX,n=e.velocityY*.6;Math.abs(n)>.5&&Math.abs(t)<.5&&(t=0),this.inMomentumMovement={uuid:rn()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:t,y:n}),0)}}onPinchGesture(e){var t;this.userAction=e.userAction,this.stopMomentumMovement();let n=(t=this.pinchState)==null?void 0:t.fov,r=e.scale;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&(this.pinchState=void 0),n===void 0)return;let i=U(n/r,this.minFov,this.maxFov),a=U(typeof this.minLatitude==`function`?this.minLatitude(i):this.minLatitude,-Math.PI/2,Math.PI/2),o=U(typeof this.maxLatitude==`function`?this.maxLatitude(i):this.maxLatitude,-Math.PI/2,Math.PI/2),s=U(this.cameraMotion.value.latitude,a,o);e.state.fov=i,e.state.latitude=s,this.emit(`gesture.pinch`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:i,latitude:s},0).catch(K),e.type=`gesture.pan`,this.onPanGesture(e))}onMouseWheel(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=U(this.cameraMotion.value.fov-e.center.delta,this.minFov,this.maxFov),n=U(typeof this.minLatitude==`function`?this.minLatitude(t):this.minLatitude,-Math.PI/2,Math.PI/2),r=U(typeof this.maxLatitude==`function`?this.maxLatitude(t):this.maxLatitude,-Math.PI/2,Math.PI/2),i=U(this.cameraMotion.value.latitude,n,r);e.state.fov=t,e.state.latitude=i,this.emit(`gesture.mousewheel`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:t,latitude:i},0).catch(K),this.onMouseMove(e))}onMouseMove(e){var t,n;if(!this.intersectMesh.parent||this.panState||(this.emit(`gesture.mousemove`,e),e.defaultPrevented))return;let r=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent){this.hideIntersectMesh();return}r.floorIndex=-1;let[i]=this.modelScene.intersectRaycaster(r),a=Q(`intersect.update`,{raycaster:r,intersection:i==null?null:i,object:this.intersectMesh});if(this.emit(`intersect.update`,a),a.defaultPrevented){this.hideIntersectMesh();return}if(i){let e=(n=(t=i.face)==null?void 0:t.normal)==null?new c.Vector3().copy(r.ray.direction).multiplyScalar(-1):n,a=e.clone(),o=i.point.clone();this.intersectMesh.position.copy(o);let s=o.clone().add(a);if(this.intersectMesh.lookAt(s),Math.abs(e.y)>.99){let e=this.camera.position.clone().sub(o);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}onDblTapGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=this.cameraMotion.value.fov,n=2,r=this.works.getObserver(this.currentPano);if(r){let e=r.images.tiles;e&&e.length&&(n=Math.max(...e.map(e=>e.level)))}let i=Math.max(40-n*5,this.minFov,5),a=i-t<t-this.defaultFov?i:this.defaultFov;e.state.fov=a,this.emit(`gesture.dbltap`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:a},360).catch(K),this.hideIntersectMesh())}},sg=`data:video/mp4;base64,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`,cg;function lg(){return cg||(cg=new Promise(e=>{let t,n=document.createElement(`video`);n.muted=!0,n.src=sg,n.addEventListener(`timeupdate`,function r(){n.removeEventListener(`timeupdate`,r,!1),clearTimeout(t);let i=document.createElement(`canvas`);i.width=i.height=1;let a=i.getContext(`2d`);if(!a){e(!1);return}a.drawImage(n,0,0,1,1);let{data:o}=a.getImageData(0,0,1,1);o[3]>10?e(!0):e(!1)},!1),n.addEventListener(`canplay`,function e(){n.removeEventListener(`canplay`,e,!1),n.play()},!1),t=window.setTimeout(()=>e(!1),1e3)}))}var ug=[`right`,`left`,`up`,`down`,`front`,`back`];function dg(e,t,n,r){let i=new c.Box3;switch(e){case`up`:i.min.y=.5,i.max.y=.5,i.min.x=t-.5,i.max.x=t-.5+r,i.min.z=-n+.5-r,i.max.z=-n+.5;break;case`down`:i.min.y=-.5,i.max.y=-.5,i.min.x=t-.5,i.max.x=t-.5+r,i.min.z=n-.5,i.max.z=n-.5+r;break;case`left`:i.min.x=-.5,i.max.x=-.5,i.min.z=-t+.5-r,i.max.z=-t+.5,i.min.y=-n+.5-r,i.max.y=-n+.5;break;case`right`:i.min.x=.5,i.max.x=.5,i.min.z=t-.5,i.max.z=t-.5+r,i.min.y=-n+.5-r,i.max.y=-n+.5;break;case`front`:i.min.z=-.5,i.max.z=-.5,i.min.x=t-.5,i.max.x=t-.5+r,i.min.y=-n+.5-r,i.max.y=-n+.5;break;case`back`:i.min.z=.5,i.max.z=.5,i.min.x=-t+.5-r,i.max.x=-t+.5,i.min.y=-n+.5-r,i.max.y=-n+.5;break;default:break}return i.applyMatrix4(new c.Matrix4().makeRotationY(Math.PI))}var fg=(e,t)=>{if(e.level>=t)return;let n=e.level+1,r=e.size/2,i=[new c.Vector2(e.position.x,e.position.y),new c.Vector2(e.position.x+r,e.position.y),new c.Vector2(e.position.x,e.position.y+r),new c.Vector2(e.position.x+r,e.position.y+r)];for(let a of i){let i={face:e.face,level:n,size:r,position:a,box:dg(e.face,a.x,a.y,r),parent:e,children:[]};e.children.push(i),fg(i,t)}};function pg(e,t){let n={level:0,face:e,position:new c.Vector2(0,0),size:1,box:dg(e,0,0,1),parent:null,children:[]};return fg(n,t),n}function mg(e){return{children:ug.map(t=>pg(t,e)),maxLevel:e}}function hg(e,t){for(let n of e.children)t(n)!==!1&&hg(n,t)}var gg,_g=new c.Vector3,vg=new c.Quaternion,yg=new c.Matrix4,bg=new c.Matrix4,xg=new c.Matrix4,Sg=new c.Matrix4,Cg=new c.Matrix4,wg=new c.Quaternion,Tg=new c.Matrix4,Eg=new c.Color(0,0,0),Dg=0,Og=new c.Color,kg=[],Ag=(gg=Math.SQRT1_2)==null?Math.sqrt(2):gg,jg={up:new c.Quaternion(Ag,0,0,Ag),down:new c.Quaternion(-Ag,0,0,Ag),left:new c.Quaternion(0,Ag,0,Ag),right:new c.Quaternion(0,-Ag,0,Ag),front:new c.Quaternion(0,0,0,1),back:new c.Quaternion(0,1,0,0)},Mg=(()=>{let e=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),t=new Float32Array([0,0,1,0,0,1,1,1]),n=new Uint32Array([0,1,2,1,3,2]),r=new c.BufferGeometry;return r.setAttribute(`position`,new c.BufferAttribute(e,3)),r.setAttribute(`uv`,new c.BufferAttribute(t,2)),r.setIndex(new c.BufferAttribute(n,1)),r.computeBoundingBox(),r})(),Ng=`
1533
1533
  varying vec2 vUV;
1534
1534
  void main() {
1535
1535
  vUV = uv;
@@ -1538,7 +1538,7 @@ void main() {
1538
1538
  #endif
1539
1539
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
1540
1540
  }
1541
- `,jg=`
1541
+ `,Pg=`
1542
1542
  uniform sampler2D map;
1543
1543
  uniform float opacity;
1544
1544
  varying vec2 vUV;
@@ -1546,14 +1546,14 @@ void main() {
1546
1546
  gl_FragColor = texture2D(map, vUV);
1547
1547
  gl_FragColor.a = gl_FragColor.a * opacity;
1548
1548
  }
1549
- `,Mg=class extends c.ShaderMaterial{constructor(){super({defines:{USE_FLIP_Y:!0},uniforms:{map:{value:null},opacity:{value:1},level:{value:-1}},vertexShader:Ag,fragmentShader:jg,depthTest:!0,depthWrite:!0}),V(this,`flipY`,{get(){return this.defines.USE_FLIP_Y},set(e){this.defines.USE_FLIP_Y!==e&&(this.defines.USE_FLIP_Y=e,this.needsUpdate=!0)}}),V(this,`map`,{get(){return this.uniforms.map.value},set(e){this.uniforms.map.value=e}}),V(this,`opacity`,{get(){return this.uniforms.opacity.value},set(e){this.uniforms.opacity.value=e}}),V(this,`level`,{get(){return this.uniforms.level.value},set(e){this.uniforms.level.value=e}})}},Ng=class extends c.Mesh{constructor(e,t){super(kg,new Mg),this.disposed=!1,e.box.getCenter(this.position),this.quaternion.multiplyQuaternions(new c.Quaternion().setFromAxisAngle(new c.Vector3(0,1,0),-Math.PI),Og[e.face]),this.scale.setScalar(e.size),this.node=e,this.name=`tiling:tile`,this.material.level=e.level,this.material.visible=!1,this.material.polygonOffset=!0,this.material.polygonOffsetFactor=-e.level,this.material.polygonOffsetUnits=-e.level,this.activeTime=-1,this.frustumCulled=!1,this.renderOrder=e.level,this.appearDuration=0,this.appearMotion=new X({appear:0}),t.then(e=>{this.disposed?e.dispose():(this.material.map=e,this.material.flipY=!!e.flipY,this.material.visible=!0,this.appearMotion.set({appear:1},this.appearDuration*1e3).catch(K))}).catch(K)}updateTime(e){let t=!1;if(this.disposed)return t;this.appearMotion.ended===!1&&this.appearMotion.update(e),this.activeTime=e;let n=Ku(this.appearMotion.value.appear);return this.material.opacity!==n&&(this.material.opacity=n,t=!0),this.material.transparent=!0,t}dispose(){this.disposed=!0,this.material.map&&this.material.map.dispose(),this.material.dispose()}},Pg=jf(20,20,20);Pg.applyMatrix4(new c.Matrix4().makeScale(-1,1,1));var Fg=`
1549
+ `,Fg=class extends c.ShaderMaterial{constructor(){super({defines:{USE_FLIP_Y:!0},uniforms:{map:{value:null},opacity:{value:1},level:{value:-1}},vertexShader:Ng,fragmentShader:Pg,depthTest:!0,depthWrite:!0}),V(this,`flipY`,{get(){return this.defines.USE_FLIP_Y},set(e){this.defines.USE_FLIP_Y!==e&&(this.defines.USE_FLIP_Y=e,this.needsUpdate=!0)}}),V(this,`map`,{get(){return this.uniforms.map.value},set(e){this.uniforms.map.value=e}}),V(this,`opacity`,{get(){return this.uniforms.opacity.value},set(e){this.uniforms.opacity.value=e}}),V(this,`level`,{get(){return this.uniforms.level.value},set(e){this.uniforms.level.value=e}})}},Ig=class extends c.Mesh{constructor(e,t){super(Mg,new Fg),this.disposed=!1,e.box.getCenter(this.position),this.quaternion.multiplyQuaternions(new c.Quaternion().setFromAxisAngle(new c.Vector3(0,1,0),-Math.PI),jg[e.face]),this.scale.setScalar(e.size),this.node=e,this.name=`tiling:tile`,this.material.level=e.level,this.material.visible=!1,this.material.polygonOffset=!0,this.material.polygonOffsetFactor=-e.level,this.material.polygonOffsetUnits=-e.level,this.activeTime=-1,this.frustumCulled=!1,this.renderOrder=e.level,this.appearDuration=0,this.appearMotion=new X({appear:0}),t.then(e=>{this.disposed?e.dispose():(this.material.map=e,this.material.flipY=!!e.flipY,this.material.visible=!0,this.appearMotion.set({appear:1},this.appearDuration*1e3).catch(K))}).catch(K)}updateTime(e){let t=!1;if(this.disposed)return t;this.appearMotion.ended===!1&&this.appearMotion.update(e),this.activeTime=e;let n=Yu(this.appearMotion.value.appear);return this.material.opacity!==n&&(this.material.opacity=n,t=!0),this.material.transparent=!0,t}dispose(){this.disposed=!0,this.material.map&&this.material.map.dispose(),this.material.dispose()}},Lg=Pf(20,20,20);Lg.applyMatrix4(new c.Matrix4().makeScale(-1,1,1));var Rg=`
1550
1550
  varying vec4 vFinalPosition;
1551
1551
 
1552
1552
  void main() {
1553
1553
  vFinalPosition = vec4(position, 1.0);
1554
1554
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
1555
1555
  }
1556
- `,Ig=`
1556
+ `,zg=`
1557
1557
  #define FLIP_CUBE_MAP -1.0
1558
1558
  uniform samplerCube map;
1559
1559
  varying vec4 vFinalPosition;
@@ -1561,7 +1561,7 @@ void main() {
1561
1561
  vec3 panoToVertex = normalize(vFinalPosition.xyz);
1562
1562
  gl_FragColor = textureCube(map, vec3(FLIP_CUBE_MAP * panoToVertex.x, panoToVertex.yz));
1563
1563
  }
1564
- `,Lg=class extends c.ShaderMaterial{constructor(){super({defines:{},uniforms:{map:{value:null}},vertexShader:Fg,fragmentShader:Ig,transparent:!1}),V(this,`map`,{get(){return this.uniforms.map.value},set(e){this.uniforms.map.value=e}})}},Rg=class extends c.Mesh{constructor(){super(Pg,new Lg),this.disposed=!1,this.frustumCulled=!1,this.renderOrder=9999}update(e,t){if(this.disposed){this.material.map=null,this.material.visible=!1;return}this.material.map=t,this.material.visible=t!==null}dispose(){this.disposed=!0,this.material.dispose()}},zg=class{constructor(e){this.forceRenderWhenNextUpdate=!0,this.fiveId=e.fiveId,this.disposed=!1,this.level=0,this.pedding=0,this.maxRequest=1,this.appearDuration=.5,this.maxCacheTile=48,this.imageOptions={},this.boundingMesh=new Rg,this.boundingMesh.frustumCulled=!1,this.textureLoader=new yi,this.observer=null,this.tileTree=dg(0),this.tileMeshes=new Map,this.frustum=new c.Frustum,this.scene=new c.Scene,this.camera=new c.PerspectiveCamera(90,1,.1,100),this.scene.add(this.boundingMesh),this.renderTarget=new c.WebGLRenderTarget(1,1,{depthBuffer:!0,stencilBuffer:!1,generateMipmaps:!1,magFilter:c.LinearFilter,minFilter:c.LinearFilter,wrapS:c.ClampToEdgeWrapping,wrapT:c.ClampToEdgeWrapping})}dispose(){this.setObserver(null),this.renderTarget.dispose(),this.boundingMesh.dispose(),this.scene.dispose(),this.disposed=!0}cleanup(){this.tileMeshes.forEach(e=>{e.dispose(),this.scene.remove(e)}),this.tileMeshes.clear(),this.forceRenderWhenNextUpdate=!0}setObserver(e){var t,n,r,i;this.disposed||this.observer!==e&&(this.cleanup(),this.observer=e,this.tileTree=dg((i=(r=(n=(t=this.observer)==null?void 0:t.images.tiles)==null?void 0:n.slice().sort((e,t)=>t.level-e.level)[0])==null?void 0:r.level)==null?0:i))}update(e){let t=this.forceRenderWhenNextUpdate;if(this.disposed)return t;let{time:n,resolution:r,pixelRatio:i,renderer:a,cameraMatrix:o,cameraProjectionMatrix:s,panoMap:l,panoMatrix:u,panoZoom:d,minLevel:f,level:p}=e;if(this.boundingMesh.update(n,l),this.observer===null)return(this.renderTarget.width!==1||this.renderTarget.height!==1)&&(this.renderTarget.setSize(1,1),t=!0),!1;this.level=U(p,0,this.tileTree.maxLevel);let m=Math.floor(r.width*i),h=Math.floor(r.height*i),g=Math.max(m,h),_=a.capabilities.maxTextureSize;g>_&&(m=Math.floor(m/g*_),h=Math.floor(h/g*_)),(this.renderTarget.width!==m||this.renderTarget.height!==h)&&this.renderTarget.setSize(m,h),this.scene.matrix.equals(u)||(this.scene.matrix.copy(u),this.scene.matrixWorld.copy(this.scene.matrix),this.scene.matrix.decompose(this.scene.position,this.scene.quaternion,this.scene.scale),this.scene.matrixAutoUpdate=!1,t=!0);let v=hg.setFromRotationMatrix(o),y=gg.compose(this.scene.position,v,this.scene.scale);this.camera.matrix.equals(y)||(this.camera.matrix.copy(y),this.camera.matrixWorld.copy(this.camera.matrix),this.camera.position.copy(this.scene.position),this.camera.quaternion.copy(v),this.camera.scale.copy(this.scene.scale),t=!0);let b=_g.copy(s);b.elements[0]*=d,b.elements[5]*=d,this.camera.projectionMatrix.equals(b)||(this.camera.projectionMatrix.copy(b),this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix),t=!0),xg.copy(this.scene.quaternion).inverse(),Sg.makeRotationFromQuaternion(xg),vg.copy(this.camera.matrix),vg.setPosition(0,0,0),vg.premultiply(Sg),yg.getInverse(vg),bg.multiplyMatrices(this.camera.projectionMatrix,yg),this.frustum.setFromProjectionMatrix(bg);let x=this.frustum.planes[5].normal,S=[];p>=f&&fg(this.tileTree,e=>{if(!(e.level<f)){if(e.level>p||!this.frustum.intersectsBox(e.box))return!1;S.push(e)}});let C=new WeakMap;S.sort((e,t)=>{if(e.level!==t.level)return e.level-t.level;let n=C.get(e);n===void 0&&(n=e.box.getCenter(mg).angleTo(x),C.set(e,n));let r=C.get(t);return r===void 0&&(r=t.box.getCenter(mg).angleTo(x),C.set(t,r)),n-r});let w=new WeakSet,T=this.observer.images.tiles;if(T)for(let e of S){let r=T.find(t=>t.level===e.level);if(!r)continue;w.add(e);let i=this.tileMeshes.get(e);if(i){i.appearDuration=this.appearDuration,i.updateTime(n)&&(t=!0);continue}if(this.pedding>=this.maxRequest)continue;let o=Math.pow(2,e.level)*e.position.y,s=Math.pow(2,e.level)*e.position.x,l=`${Z({panoIndex:this.observer.panoIndex,workCode:this.observer.work.workCode})}.${e.face}.${e.level}.${o}.${s}`,u=r.work.getURL(r[e.face]),d=r.size,f=this.imageOptions.transform,p=Object.assign(Object.assign({},vr(this.imageOptions,[`format`,`sharpen`,`forceUseExifOrientation`,`mappings`])),{key:`pano_tile.${l}`,size:r.scale>=1?void 0:d*e.size*r.scale,cut:e.size===1?void 0:[d*e.position.x,d*e.position.y,d*e.size,d*e.size]});e.level===1&&r.scale>=.5&&(p.format===`jpg`||/\.jpg$/.test(u))&&(p.size=void 0,p.quality||(p.quality=70)),e.size===1&&console.warn(`tile: ${p.key} should not appear.`),this.pedding++;let m=this.textureLoader.loadTexture(u,{imageURL:{transform:f,options:p},minFilter:c.LinearFilter,magFilter:c.LinearFilter,generateMipmaps:!1,fetcher:Cf(this.fiveId,this.observer.work)}).then(e=>e.body);m.then(e=>Sd(e,a)).then(e=>(this.pedding--,e),e=>(this.pedding--,Promise.reject(e))),i=new Ng(e,m),i.name=`tiling:tile-${l}`,i.visible=!1,i.appearDuration=this.appearDuration,this.tileMeshes.set(e,i),this.scene.add(i),i.updateTime(n),t=!0}let E=[],D=[];this.tileMeshes.forEach((e,n)=>{w.has(n)?E.push(e):D.push(e);let r=n.level>=f&&n.level<=p;e.visible!==r&&(e.visible=r,t=!0)});let O=D.sort((e,t)=>t.activeTime-e.activeTime).slice(Math.max(0,this.maxCacheTile-E.length));for(let e of O)this.tileMeshes.delete(e.node),this.scene.remove(e),e.dispose(),t=!0;if(t){let e=a.getRenderTarget();Tg.copy(a.getClearColor());let t=a.getClearAlpha(),n=a.autoClear,r=a.autoClearColor,i=a.autoClearDepth,o=a.autoClearStencil,s=a.clippingPlanes;a.autoClear=!0,a.autoClearColor=!0,a.autoClearDepth=!0,a.autoClearStencil=!0,a.clippingPlanes=Eg,a.setRenderTarget(this.renderTarget),a.setClearColor(Cg,wg),a.render(this.scene,this.camera),a.setRenderTarget(e),a.setClearColor(Tg,t),a.autoClear=n,a.autoClearColor=r,a.autoClearDepth=i,a.autoClearStencil=o,a.clippingPlanes=s}return this.forceRenderWhenNextUpdate=!1,t}},Bg=new c.Matrix4().makeRotationAxis(new c.Vector3(0,1,0),Math.PI),Vg=jf(2,2,2);Vg.applyMatrix4(new c.Matrix4().makeScale(-1,1,1));var Hg=`
1564
+ `,Bg=class extends c.ShaderMaterial{constructor(){super({defines:{},uniforms:{map:{value:null}},vertexShader:Rg,fragmentShader:zg,transparent:!1}),V(this,`map`,{get(){return this.uniforms.map.value},set(e){this.uniforms.map.value=e}})}},Vg=class extends c.Mesh{constructor(){super(Lg,new Bg),this.disposed=!1,this.frustumCulled=!1,this.renderOrder=9999}update(e,t){if(this.disposed){this.material.map=null,this.material.visible=!1;return}this.material.map=t,this.material.visible=t!==null}dispose(){this.disposed=!0,this.material.dispose()}},Hg=class{constructor(e){this.forceRenderWhenNextUpdate=!0,this.fiveId=e.fiveId,this.disposed=!1,this.level=0,this.pedding=0,this.maxRequest=1,this.appearDuration=.5,this.maxCacheTile=48,this.imageOptions={},this.boundingMesh=new Vg,this.boundingMesh.frustumCulled=!1,this.textureLoader=new yi,this.observer=null,this.tileTree=mg(0),this.tileMeshes=new Map,this.frustum=new c.Frustum,this.scene=new c.Scene,this.camera=new c.PerspectiveCamera(90,1,.1,100),this.scene.add(this.boundingMesh),this.renderTarget=new c.WebGLRenderTarget(1,1,{depthBuffer:!0,stencilBuffer:!1,generateMipmaps:!1,magFilter:c.LinearFilter,minFilter:c.LinearFilter,wrapS:c.ClampToEdgeWrapping,wrapT:c.ClampToEdgeWrapping})}dispose(){this.setObserver(null),this.renderTarget.dispose(),this.boundingMesh.dispose(),this.scene.dispose(),this.disposed=!0}cleanup(){this.tileMeshes.forEach(e=>{e.dispose(),this.scene.remove(e)}),this.tileMeshes.clear(),this.forceRenderWhenNextUpdate=!0}setObserver(e){var t,n,r,i;this.disposed||this.observer!==e&&(this.cleanup(),this.observer=e,this.tileTree=mg((i=(r=(n=(t=this.observer)==null?void 0:t.images.tiles)==null?void 0:n.slice().sort((e,t)=>t.level-e.level)[0])==null?void 0:r.level)==null?0:i))}update(e){let t=this.forceRenderWhenNextUpdate;if(this.disposed)return t;let{time:n,resolution:r,pixelRatio:i,renderer:a,cameraMatrix:o,cameraProjectionMatrix:s,panoMap:l,panoMatrix:u,panoZoom:d,minLevel:f,level:p}=e;if(this.boundingMesh.update(n,l),this.observer===null)return(this.renderTarget.width!==1||this.renderTarget.height!==1)&&(this.renderTarget.setSize(1,1),t=!0),!1;this.level=U(p,0,this.tileTree.maxLevel);let m=Math.floor(r.width*i),h=Math.floor(r.height*i),g=Math.max(m,h),_=a.capabilities.maxTextureSize;g>_&&(m=Math.floor(m/g*_),h=Math.floor(h/g*_)),(this.renderTarget.width!==m||this.renderTarget.height!==h)&&this.renderTarget.setSize(m,h),this.scene.matrix.equals(u)||(this.scene.matrix.copy(u),this.scene.matrixWorld.copy(this.scene.matrix),this.scene.matrix.decompose(this.scene.position,this.scene.quaternion,this.scene.scale),this.scene.matrixAutoUpdate=!1,t=!0);let v=vg.setFromRotationMatrix(o),y=yg.compose(this.scene.position,v,this.scene.scale);this.camera.matrix.equals(y)||(this.camera.matrix.copy(y),this.camera.matrixWorld.copy(this.camera.matrix),this.camera.position.copy(this.scene.position),this.camera.quaternion.copy(v),this.camera.scale.copy(this.scene.scale),t=!0);let b=bg.copy(s);b.elements[0]*=d,b.elements[5]*=d,this.camera.projectionMatrix.equals(b)||(this.camera.projectionMatrix.copy(b),this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix),t=!0),wg.copy(this.scene.quaternion).inverse(),Tg.makeRotationFromQuaternion(wg),xg.copy(this.camera.matrix),xg.setPosition(0,0,0),xg.premultiply(Tg),Sg.getInverse(xg),Cg.multiplyMatrices(this.camera.projectionMatrix,Sg),this.frustum.setFromProjectionMatrix(Cg);let x=this.frustum.planes[5].normal,S=[];p>=f&&hg(this.tileTree,e=>{if(!(e.level<f)){if(e.level>p||!this.frustum.intersectsBox(e.box))return!1;S.push(e)}});let C=new WeakMap;S.sort((e,t)=>{if(e.level!==t.level)return e.level-t.level;let n=C.get(e);n===void 0&&(n=e.box.getCenter(_g).angleTo(x),C.set(e,n));let r=C.get(t);return r===void 0&&(r=t.box.getCenter(_g).angleTo(x),C.set(t,r)),n-r});let w=new WeakSet,T=this.observer.images.tiles;if(T)for(let e of S){let r=T.find(t=>t.level===e.level);if(!r)continue;w.add(e);let i=this.tileMeshes.get(e);if(i){i.appearDuration=this.appearDuration,i.updateTime(n)&&(t=!0);continue}if(this.pedding>=this.maxRequest)continue;let o=Math.pow(2,e.level)*e.position.y,s=Math.pow(2,e.level)*e.position.x,l=`${Z({panoIndex:this.observer.panoIndex,workCode:this.observer.work.workCode})}.${e.face}.${e.level}.${o}.${s}`,u=r.work.getURL(r[e.face]),d=r.size,f=this.imageOptions.transform,p=Object.assign(Object.assign({},vr(this.imageOptions,[`format`,`sharpen`,`forceUseExifOrientation`,`mappings`])),{key:`pano_tile.${l}`,size:r.scale>=1?void 0:d*e.size*r.scale,cut:e.size===1?void 0:[d*e.position.x,d*e.position.y,d*e.size,d*e.size]});e.level===1&&r.scale>=.5&&(p.format===`jpg`||/\.jpg$/.test(u))&&(p.size=void 0,p.quality||(p.quality=70)),e.size===1&&console.warn(`tile: ${p.key} should not appear.`),this.pedding++;let m=this.textureLoader.loadTexture(u,{imageURL:{transform:f,options:p},minFilter:c.LinearFilter,magFilter:c.LinearFilter,generateMipmaps:!1,fetcher:Ef(this.fiveId,this.observer.work)}).then(e=>e.body);m.then(e=>Td(e,a)).then(e=>(this.pedding--,e),e=>(this.pedding--,Promise.reject(e))),i=new Ig(e,m),i.name=`tiling:tile-${l}`,i.visible=!1,i.appearDuration=this.appearDuration,this.tileMeshes.set(e,i),this.scene.add(i),i.updateTime(n),t=!0}let E=[],D=[];this.tileMeshes.forEach((e,n)=>{w.has(n)?E.push(e):D.push(e);let r=n.level>=f&&n.level<=p;e.visible!==r&&(e.visible=r,t=!0)});let O=D.sort((e,t)=>t.activeTime-e.activeTime).slice(Math.max(0,this.maxCacheTile-E.length));for(let e of O)this.tileMeshes.delete(e.node),this.scene.remove(e),e.dispose(),t=!0;if(t){let e=a.getRenderTarget();Og.copy(a.getClearColor());let t=a.getClearAlpha(),n=a.autoClear,r=a.autoClearColor,i=a.autoClearDepth,o=a.autoClearStencil,s=a.clippingPlanes;a.autoClear=!0,a.autoClearColor=!0,a.autoClearDepth=!0,a.autoClearStencil=!0,a.clippingPlanes=kg,a.setRenderTarget(this.renderTarget),a.setClearColor(Eg,Dg),a.render(this.scene,this.camera),a.setRenderTarget(e),a.setClearColor(Og,t),a.autoClear=n,a.autoClearColor=r,a.autoClearDepth=i,a.autoClearStencil=o,a.clippingPlanes=s}return this.forceRenderWhenNextUpdate=!1,t}},Ug=new c.Matrix4().makeRotationAxis(new c.Vector3(0,1,0),Math.PI),Wg=Pf(2,2,2);Wg.applyMatrix4(new c.Matrix4().makeScale(-1,1,1));var Gg=`
1565
1565
 
1566
1566
  #if defined(USE_PANO_VIDEO)
1567
1567
  varying vec3 worldPosition;
@@ -1574,7 +1574,7 @@ void main() {
1574
1574
  #endif
1575
1575
  gl_Position = projectionMatrix * modelViewMatrix * transformed;
1576
1576
  }
1577
- `,Ug=`
1577
+ `,Kg=`
1578
1578
  #define FLIP_CUBE_MAP -1.0
1579
1579
 
1580
1580
  uniform vec2 size;
@@ -1609,7 +1609,7 @@ void main() {
1609
1609
 
1610
1610
  #endif
1611
1611
  }
1612
- `,Wg=class{constructor(){this.material=new c.ShaderMaterial({vertexShader:Hg,fragmentShader:Ug,uniforms:{size:new c.Uniform(new c.Vector2),matrix:new c.Uniform(new c.Matrix4),fixMatrix:new c.Uniform(Bg),panoMatrix:new c.Uniform(new c.Matrix4),alpha:new c.Uniform(1),map:new c.Uniform(null)},depthTest:!1,depthWrite:!1,defines:{USE_PANO_VIDEO:!1},blending:c.CustomBlending,blendSrc:c.SrcAlphaFactor,blendDst:c.OneMinusSrcAlphaFactor,blendSrcAlpha:c.OneFactor,blendDstAlpha:c.OneMinusSrcAlphaFactor}),this.object=new c.Mesh(Vg,this.material),this.object.visible=!1,this.object.renderOrder=-1,this.object.frustumCulled=!1,this.object.name=`pano-video`,this.alphaMotion=new X({alpha:0})}setMaterial(e){e?(this.material.uniforms.size.value.copy(e.size),this.material.uniforms.matrix.value.copy(e.matrix),this.material.uniforms.panoMatrix.value.copy(e.panoMatrix),this.material.uniforms.map.value=e.map,this.alphaMotion.set({alpha:e.alpha},500).catch(K)):(this.material.uniforms.size.value.setScalar(0),this.material.uniforms.matrix.value.identity(),this.material.uniforms.panoMatrix.value.identity(),this.material.uniforms.map.value=null,this.material.uniforms.alpha.value=0,this.alphaMotion.set({alpha:0},0).catch(K));let t=e!==null;t!==this.material.defines.USE_PANO_VIDEO&&(this.material.defines.USE_PANO_VIDEO=t,this.material.needsUpdate=!0,this.object.visible=e!==null)}updateTime(e){this.alphaMotion.ended||(this.alphaMotion.update(e),this.material.uniforms.alpha.value=this.alphaMotion.value.alpha)}dispose(){this.material.dispose()}},Gg=new c.Color(0,0,0),Kg=new c.Color,qg=new c.ShaderMaterial({vertexShader:`
1612
+ `,qg=class{constructor(){this.material=new c.ShaderMaterial({vertexShader:Gg,fragmentShader:Kg,uniforms:{size:new c.Uniform(new c.Vector2),matrix:new c.Uniform(new c.Matrix4),fixMatrix:new c.Uniform(Ug),panoMatrix:new c.Uniform(new c.Matrix4),alpha:new c.Uniform(1),map:new c.Uniform(null)},depthTest:!1,depthWrite:!1,defines:{USE_PANO_VIDEO:!1},blending:c.CustomBlending,blendSrc:c.SrcAlphaFactor,blendDst:c.OneMinusSrcAlphaFactor,blendSrcAlpha:c.OneFactor,blendDstAlpha:c.OneMinusSrcAlphaFactor}),this.object=new c.Mesh(Wg,this.material),this.object.visible=!1,this.object.renderOrder=-1,this.object.frustumCulled=!1,this.object.name=`pano-video`,this.alphaMotion=new X({alpha:0})}setMaterial(e){e?(this.material.uniforms.size.value.copy(e.size),this.material.uniforms.matrix.value.copy(e.matrix),this.material.uniforms.panoMatrix.value.copy(e.panoMatrix),this.material.uniforms.map.value=e.map,this.alphaMotion.set({alpha:e.alpha},500).catch(K)):(this.material.uniforms.size.value.setScalar(0),this.material.uniforms.matrix.value.identity(),this.material.uniforms.panoMatrix.value.identity(),this.material.uniforms.map.value=null,this.material.uniforms.alpha.value=0,this.alphaMotion.set({alpha:0},0).catch(K));let t=e!==null;t!==this.material.defines.USE_PANO_VIDEO&&(this.material.defines.USE_PANO_VIDEO=t,this.material.needsUpdate=!0,this.object.visible=e!==null)}updateTime(e){this.alphaMotion.ended||(this.alphaMotion.update(e),this.material.uniforms.alpha.value=this.alphaMotion.value.alpha)}dispose(){this.material.dispose()}},Jg=new c.Color(0,0,0),Yg=new c.Color,Xg=new c.ShaderMaterial({vertexShader:`
1613
1613
  #include <common>
1614
1614
  #include <uv_pars_vertex>
1615
1615
  #include <morphtarget_pars_vertex>
@@ -1676,7 +1676,7 @@ void main() {
1676
1676
  float cameraDepth = length(cameraVertex);
1677
1677
  gl_FragColor = packDepthToRGBA(clamp(cameraDepth / maxDepth, 0.0, 1.0));
1678
1678
  }
1679
- `,uniforms:{maxDepth:new c.Uniform(0)}});function Jg(e,t,n,r=1e3){qg.uniforms.maxDepth.value=r,Kg.copy(e.getClearColor());let i=e.getClearAlpha(),a=t.overrideMaterial;t.overrideMaterial=qg,e.setClearColor(Gg,0),n.update(e,t),e.setClearColor(Kg,i),t.overrideMaterial=a}var Yg=Gu,Xg=new c.Raycaster,Zg=new c.Vector3,Qg=[new c.Vector3(0,0,0).multiplyScalar(.1),new c.Vector3(1,0,0).multiplyScalar(.1),new c.Vector3(-.5,0,-Math.sqrt(3)/2).multiplyScalar(.1),new c.Vector3(-.5,0,Math.sqrt(3)/2).multiplyScalar(.1)],$g=Object.assign(Object.assign({},ng),{maxAccessibleDistance:5,panoTapTriggerRadius:.5,panoCircleMeshCreator:(e,t)=>e.position.distanceTo(e.standingPosition)>t.aerialObserverMinHeight?new fh:new sh,adjustPanoCircleMeshPositionBasedOnModel:!1,tileLevelForFov:((e,t)=>{var n;let r=e=>e/180*Math.PI,i=(n=Math.log2)==null?(e=>Math.log(e)*Math.LOG2E):n,a=t.height/2/Math.tan(r(e/2))*Math.tan(r(45))*2,o=Math.max(i(a/512),0);return o<2.3&&o>.1&&(o=1),o=o%1>.75?Math.ceil(o):Math.floor(o),o}),tileAppearDuration:.5,tileMaxRequest:3,flyEffectUseDepthBuffer:!1}),e_=class e extends rg{static parseArgs(t){var n,r,i,a,o,s,c,l;if(t instanceof e)return t;let u=super.parseArgs(t);return Object.assign(Object.assign({},u),{maxAccessibleDistance:(n=t.maxAccessibleDistance)==null?$g.maxAccessibleDistance:n,panoTapTriggerRadius:(r=t.panoTapTriggerRadius)==null?$g.panoTapTriggerRadius:r,panoCircleMeshCreator:(i=t.panoCircleMeshCreator)==null?$g.panoCircleMeshCreator:i,adjustPanoCircleMeshPositionBasedOnModel:(a=t.adjustPanoCircleMeshPositionBasedOnModel)==null?$g.adjustPanoCircleMeshPositionBasedOnModel:a,tileLevelForFov:(o=t.tileLevelForFov)==null?$g.tileLevelForFov:o,tileAppearDuration:(s=t.tileAppearDuration)==null?$g.tileAppearDuration:s,tileMaxRequest:(c=t.tileMaxRequest)==null?$g.tileMaxRequest:c,flyEffectUseDepthBuffer:(l=t.flyEffectUseDepthBuffer)==null?$g.flyEffectUseDepthBuffer:l})}static initAnimationEndState(e){let t=this.parseArgs(e),n=super.initAnimationEndState(t);return Object.assign(Object.assign({},n),{mode:`Panorama`})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Panorama`,this.initAnimationed=!1,this.maxAccessibleDistance=n.maxAccessibleDistance,this.panoTapTriggerRadius=n.panoTapTriggerRadius,this.panoCircleMeshCreator=n.panoCircleMeshCreator,this.adjustPanoCircleMeshPositionBasedOnModel=n.adjustPanoCircleMeshPositionBasedOnModel,this.tileLevelForFov=n.tileLevelForFov,this.tileAppearDuration=n.tileAppearDuration,this.tileMaxRequest=n.tileMaxRequest,this.flyEffectUseDepthBuffer=n.flyEffectUseDepthBuffer,this.adjustPanoCircleMeshPositionFix=new Map;let r=this.modelScene.parameter.resolveValue(`pano0`),i=this.modelScene.parameter.resolveValue(`pano1`);r&&(i==null?void 0:i.map)!==r.map&&(this.modelScene.parameter.set({pano0:i}),r.map.dispose());let a=new Set;r&&a.add(r),i&&a.add(i),this.panoMeshes=new Map,this.locationMotion=new X({count:0,distance:this.camera.pose.distance}),this.modelAlphaMotion=new X({modelAlpha:this.modelScene.parameter.resolveValue(`modelAlpha`)}),this.perspToOrthoMotion=new X({perspToOrtho:this.camera.perspToOrtho.x}),this.panoResources={},this.panoResources[this.locationMotion.keyframes[0].key=this.locationMotion.keyframes[1].key=rn()]={panoId:Z(this.currentPano),panoPicture:this.modelScene.parameter.resolveValue(`pano1`),position:this.camera.pose.offset.clone(),effect:`fly`,effectEasing:Yg,fixCameraTransform:new c.Matrix4},this.panoPictureObserverMap=new WeakMap,this.textureLoader=new yi,this.tiling=new zg({fiveId:this.fiveId}),this.panoVideo=new Wg,this.scene.add(this.panoVideo.object),this.accessibleObserverFloorCheckCount=0}get tileLevel(){return this.tiling.level}updateConfiguration(e){return super.updateConfiguration(e)===!1?!1:(e.maxAccessibleDistance!==void 0&&this.maxAccessibleDistance!==e.maxAccessibleDistance&&(this.maxAccessibleDistance=e.maxAccessibleDistance),e.panoTapTriggerRadius!==void 0&&this.panoTapTriggerRadius!==e.panoTapTriggerRadius&&(this.panoTapTriggerRadius=e.panoTapTriggerRadius),e.panoCircleMeshCreator!==void 0&&this.panoCircleMeshCreator!==e.panoCircleMeshCreator&&(this.panoCircleMeshCreator=e.panoCircleMeshCreator,this.panoMeshes&&(this.panoMeshes.forEach(e=>{this.helper.remove(e),e.dispose()}),this.panoMeshes.clear())),e.tileLevelForFov!==void 0&&this.tileLevelForFov!==e.tileLevelForFov&&(this.tileLevelForFov=e.tileLevelForFov),e.tileMaxRequest!==void 0&&this.tileMaxRequest!==e.tileMaxRequest&&(this.tileMaxRequest=e.tileMaxRequest),e.flyEffectUseDepthBuffer!==void 0&&this.flyEffectUseDepthBuffer!==e.flyEffectUseDepthBuffer&&(this.flyEffectUseDepthBuffer=e.flyEffectUseDepthBuffer),e.adjustPanoCircleMeshPositionBasedOnModel!==void 0&&this.adjustPanoCircleMeshPositionBasedOnModel!==e.adjustPanoCircleMeshPositionBasedOnModel&&(this.adjustPanoCircleMeshPositionBasedOnModel=e.adjustPanoCircleMeshPositionBasedOnModel,this.adjustPanoCircleMeshPositionBasedOnModel||this.adjustPanoCircleMeshPositionFix.clear()),!0)}destroy(){super.destroy(),this.tiling.dispose(),this.modelScene.parameter.set({refinedScreen:null,pano0Depth:null,pano1Depth:null}),this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0),this.locationMotion.dispose(),this.pendingPanoTask=void 0,this.panoMeshes&&(this.panoMeshes.forEach(e=>{this.helper.remove(e),e.dispose()}),this.panoMeshes.clear());let e=this.videoTexture.image;e.pause(),e.oncanplay=K,e.ontimeupdate=K,this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();let t=this.modelScene.parameter.resolveValue(`pano0`),n=this.modelScene.parameter.resolveValue(`pano1`);for(let e of Object.keys(this.panoResources)){let r=this.panoResources[e];if(r.panoPicture){let e=r.panoPicture.map;e&&e!==(t==null?void 0:t.map)&&e!==(n==null?void 0:n.map)&&(e.dispose(),r.panoPicture=null)}delete this.panoResources[e]}}isReady(){return this.locationMotion.ended===!0?super.isReady():!1}isTileReady(){let e=this.tiling.pedding<=0;return this.initAnimationed&&e}updateWork(t,n,r,i){this.userAction=i,this.works=t;let a=e.initAnimationEndState(Object.assign(Object.assign({},this),{initial:{currentState:Object.assign(Object.assign({},this.currentPano),this.camera.pose),duration:r.duration,effect:r.effect,state:n,userAction:i}}));return(a.workCode!==this.currentPano.workCode||a.panoIndex!==this.currentPano.panoIndex||a.longitude!==this.cameraMotion.value.longitude||a.latitude!==this.cameraMotion.value.latitude||a.fov!==this.cameraMotion.value.fov)&&(this.initAnimationed=!1,this.moveToPano({workCode:a.workCode,panoIndex:a.panoIndex},{effect:r.effect,duration:r.duration,longitude:a.longitude,latitude:a.latitude,fov:a.fov,moveEndCallback:()=>{this.initAnimationed=!0},moveCancelCallback:()=>{this.initAnimationed=!0}},i)),!0}updateModel(e){this.modelScene=e,this.hideIntersectMesh()}updateTime(e,t,...n){var r,i,a,o,s,l;if(this.destroyed)return;let u={},d={},f=this.camera.getDirection(new c.Vector3),p=this.locationMotion.keyframes[0],m=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[h,g]=this.locationMotion.getKeyFrameSegment(e),_=this.panoResourceFromLocationMotionKeyframe(h),v=this.panoResourceFromLocationMotionKeyframe(g),y=this.panoResourceFromLocationMotionKeyframe(p),b=this.panoResourceFromLocationMotionKeyframe(m),x=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),d.longitude=this.cameraMotion.value.longitude,d.latitude=this.cameraMotion.value.latitude,d.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),u.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(U(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let t=this.locationMotion.value.count-g.value.count+1,n=new c.Vector3().copy(_.position),a=new c.Vector3().copy(v.position);if(u.progress=v.effectEasing(t),t>=.01&&t<=.99&&(u.progress=U(v.effectEasing(t),.01,.99)),v.panoPicture&&(t<1?_.panoPicture&&(u.pano0=_.panoPicture):u.pano0=v.panoPicture,u.pano1=v.panoPicture),v.effect===`montage`?u.transition=`BLACK`:v.effect===`spread`?u.transition=`SPREAD`:u.transition=`FADE`,v.effect===`zoomin`||v.effect===`zoomout`?u.progress=Math.pow(t,3):v.effect===`model`&&this.camera.pose.distance<.01&&(u.modelAlpha=1-Math.pow(U(Math.abs(t-.5)*2,0,1),4)),t<1&&v.effect!==`fly`&&v.effect!==`model`){if(u.pano0&&_.panoPicture){let e={panoId:u.pano0.panoId,map:u.pano0.map,mapHistogram:u.pano0.mapHistogram,mapSize:u.pano0.mapSize,zoom:u.pano0.zoom,matrix:_.panoPicture.matrix.clone().premultiply(_.fixCameraTransform).setPosition(v.position)},t=this.panoPictureObserverMap.get(u.pano0);t&&this.panoPictureObserverMap.set(e,t),u.pano0=e}n.copy(a),x=!0}d.distance=this.locationMotion.value.distance,d.offset=new c.Vector3(n.x+(a.x-n.x)*t,n.y+(a.y-n.y)*t,n.z+(a.z-n.z)*t);let o=[],s=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(o.push(t),n>this.locationMotion.progress&&s.push(t))}for(let e of Object.keys(this.panoResources)){if(s.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.panoPicture){let e=t.panoPicture.map;if(e){if(e===((r=u.pano0)==null?void 0:r.map)||e===((i=u.pano1)==null?void 0:i.map))continue;e.dispose(),t.panoPicture=null}}o.indexOf(e)>=0||delete this.panoResources[e]}let l=gp(v.panoId);l!==this.currentPano&&(this.currentPano=l,this.accessibleObserverFloorCheckCount=0),this.emit(`pano.moving`,Q(`pano.moving`,{userAction:this.userAction,prevPano:gp(y.panoId),pano:gp(b.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},gp(b.panoId)),{mode:this.mode}),$(this.camera.pose)),d),options:{},progress:this.locationMotion.progress,error:null}))}Ih(u)===!1&&this.modelScene.parameter.set(u),Ih(d)===!1&&this.setCamera(d);let S=this.works.getObserver(this.currentPano),C=this.locationMotion.ended?this.getForwardObserverOrNot(this.camera):null,w=this.works.getObserver(_.panoId),T=this.works.getObserver(v.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&S){let e=[],t=S.work.observers;for(let n of S.accessibleNodes){let r=t[n];r&&e.push(r)}let n=new Map;if(e.sort((e,t)=>{let r=n.get(e);r===void 0&&(r=e.standingPosition.distanceTo(S.standingPosition),n.set(e,r));let i=n.get(e);return i===void 0&&(i=t.standingPosition.distanceTo(S.standingPosition),n.set(t,i)),r-i}),e.length){this.accessibleObserverFloorCheckCount%=e.length;let t=e[this.accessibleObserverFloorCheckCount],n=this.modelScene.models.find(e=>e.work===(t==null?void 0:t.work));if(t&&n&&n.visible){let e=.3,r=.005,i=t.standingPosition.clone().applyMatrix4(t.work.transform),a=Z({panoIndex:t.panoIndex,workCode:t.work.workCode}),o=Qg.map(t=>{Xg.ray.origin.copy(i),Xg.ray.origin.add(Zg.copy(t).setY(e)),Xg.ray.direction.set(0,-1,0),Xg.firstHitOnly=!0,Xg.floorIndex=-1;let[a]=n.intersectRaycaster(Xg);return a&&a.distance-r<=e?new c.Vector3().copy(i).setY(a.point.y+r):i});o.sort((e,t)=>t.y-e.y);let s=o[Math.floor(o.length/2)],[l]=o.filter(e=>e.distanceTo(s)<=.05);if(l){let e=new c.Vector4(i.x,i.y,i.z,l.y-i.y),t=this.adjustPanoCircleMeshPositionFix.get(a);t&&!e.equals(t)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(a,e)}}this.accessibleObserverFloorCheckCount++}}let E=new Map;if(w)for(let e of w.accessibleNodes){let t=w.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});E.set(e,t)}}if(T)for(let e of T.accessibleNodes){let t=T.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});E.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{E.get(t)?E.delete(t):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),E.forEach((e,t)=>{let n=this.panoCircleMeshCreator(e,{aerialObserverMinHeight:this.aerialObserverMinHeight});this.panoMeshes.set(t,n),this.helper.add(n),E.delete(t)}),this.panoMeshes.forEach((e,t)=>{let n=this.works.getObserver(t);if(n){let r=n.position.distanceTo(n.standingPosition)>this.aerialObserverMinHeight;if(r)e.position.copy(n.position).applyMatrix4(n.work.transform),e.scale.setScalar(18);else{e.position.copy(n.standingPosition).applyMatrix4(n.work.transform);let t=this.adjustPanoCircleMeshPositionFix.get(n.panoId);t&&(Zg.set(t.x,t.y,t.z),Zg.equals(e.position)&&(e.position.y+=t.w)),e.scale.setScalar(1.2)}let i=this.camera.position.clone().setY(e.position.y),a=new c.Vector3().copy(e.position).sub(i).normalize();if(t===Z(this.currentPano)){let t=U((.5-i.distanceTo(e.position))/.5,0,1);a.multiplyScalar(1-t).add(f.clone().multiplyScalar(t))}if(a.length()>0){let t=r?-Math.PI/2:0,n=Math.atan2(a.x,a.z);e.quaternion.setFromEuler(new c.Euler(t,n,0,`YXZ`))}}else e.visible=!1}),this.camera.pose.distance>.1||x)this.panoMeshes.forEach(n=>{n.setOpacity(0),n.setCurrent(!1),n.updateTime&&n.updateTime(e,t),n.visible=!1});else if(S){let n=S.work.observers,[,r]=zl(S.accessibleNodes,e=>{let t=n[e];return!t||!t.active?1/0:S.standingPosition.distanceTo(t.standingPosition)},!0);r=U(r,3,1/0);let i=S.accessibleNodes.concat(S.panoIndex).map(e=>Z({panoIndex:e,workCode:S.work.workCode}));this.panoMeshes.forEach((n,a)=>{let o=this.works.getObserver(a),s=!1,c=1;if(i.indexOf(a)===-1)s=!1,c=0;else if(!o)s=!1,c=0;else if(!o.loadable&&!o.active)s=!1,c=0;else{let e=n.position.clone().project(this.camera);s=Math.abs(e.x)<1&&Math.abs(e.y)<1&&Math.abs(e.z)<1&&!n.loading&&n.progress===0&&C!==null&&Z({panoIndex:C.panoIndex,workCode:C.work.workCode})===a;let t=n.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);c=t<.01?0:U(r/t,.1,.85)}o&&o===T&&o.position.distanceTo(o.standingPosition)>this.aerialObserverMinHeight&&n.position.distanceTo(this.camera.position)<35&&(c=0),this.modelScene.parameter.resolveValue(`modelAlpha`)>0&&(c=0),n.setCurrent(s),n.setOpacity(c),n.updateTime&&n.updateTime(e,t)})}{let e=(a=this.modelScene.parameter.progress)==null?1:a,t=Math.round(e),n=this.modelScene.parameter.pano0,r=this.modelScene.parameter.pano1,i=t===0?n:r,s;if(i&&(s=this.works.getObserver(i.panoId),s||(s=this.panoPictureObserverMap.get(i))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(di()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!s||!i||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new c.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=ni(i.mapSize),a=e+1,l=new c.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),u=Math.floor(this.tileLevelForFov(this.camera.fov,l)),d=u>e?u:0;this.tiling.setObserver(s);let f={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:i.map,panoMatrix:i.matrix,panoZoom:i.zoom,minLevel:a,level:d},p=this.tiling.update(f),m={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:t,opacity:(n==null?void 0:n.panoId)===(r==null?void 0:r.panoId)?1:qu(Math.abs(((o=this.modelScene.parameter.progress)==null?0:o)-.5)*2)},h=this.modelScene.parameter.refinedScreen;(p||m.pano!==(h==null?void 0:h.pano)||m.opacity!==(h==null?void 0:h.opacity))&&this.modelScene.parameter.set(`refinedScreen`,m)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),S&&S.images.video&&(this.needsRender=!0),this.intersectMesh&&this.intersectMesh.parent&&S&&S.position.y-S.standingPosition.y>10){let e=U(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1);{let e=v.effect,{pano0:t,pano1:n}=this.modelScene.parameter;if(t&&n&&t!==n&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((s=this.modelScene.parameter.pano0Depth)==null?void 0:s.panoId)!==t.panoId||((l=this.modelScene.parameter.pano1Depth)==null?void 0:l.panoId)!==n.panoId){this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new c.WebGLCubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new c.WebGLCubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1});let e=new c.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);e.matrix.copy(t.matrix),e.matrixWorld.copy(e.matrix),e.matrixAutoUpdate=!1,Jg(this.renderer,this.modelScene,e,500);let r=new c.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);r.matrix.copy(n.matrix),r.matrixWorld.copy(r.matrix),r.matrixAutoUpdate=!1,Jg(this.renderer,this.modelScene,r,500),this.modelScene.parameter.set({pano0Depth:{panoId:t.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:500},pano1Depth:{panoId:n.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:500}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(H())[1],t=this.locationMotion.getKeyFrameSegment(H())[1],n=this.panoResourceFromLocationMotionKeyframe(t),r=this.works.getObserver(n.panoId);return{workCode:r?r.work.workCode:this.currentPano.workCode,panoIndex:r?r.panoIndex:this.currentPano.panoIndex,mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:r?r.position.clone().applyMatrix4(r.work.transform):this.camera.position.clone(),distance:this.locationMotion.value.distance}}moveToPano(e,t,n){var r,i,a;let o=(r=t.effect)==null?`fly`:r;this.userAction=n,this.stopMomentumMovement();let s=Z(e),l=this.works.getObserver(e);if(!l)throw Error(`Invalid PanoId ${JSON.stringify(e)}`);let u=$r(l.images.up),d=this.imageOptions.size;d===void 0&&l&&u&&(d=Number(u)),d===void 0&&(d=2048);let f=this.imageOptions.transform,p=Object.assign({key:`pano.${s}`},vr(this.imageOptions,[`format`,`size`,`quality`,`sharpen`,`forceUseExifOrientation`,`mappings`])),m={right:l.images.work.getURL(l.images.right),left:l.images.work.getURL(l.images.left),up:l.images.work.getURL(l.images.up),down:l.images.work.getURL(l.images.down),front:l.images.work.getURL(l.images.front),back:l.images.work.getURL(l.images.back)},h=`pano:`+mp([m,p,f]);if(this.pendingPanoTask){if(this.pendingPanoTask.hash===h)return;{let e=this.pendingPanoTask.panoId;(i=this.panoMeshes.get(e))==null||i.setProgress(0),this.emit(`pano.texture.abort`,Q(`pano.texture.abort`,{error:null,progress:0,meta:null,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode}}))}}let g=`move-to-pano-`+s;this.pending.add(g);let _=Dh(`pano.prepare`,{prevPano:this.currentPano,pano:e});if(this.emit(`pano.prepare`,_),_.defaultPrevented){this.pending.delete(g);return}let v=this.modelScene.parameter,y;if(v.pano0&&v.pano0.map.name===h?y=v.pano0:v.pano1&&v.pano1.map.name===h&&(y=v.pano1),y){let n={panoId:s,effect:o,effectEasing:(a=t.effectEasing)==null?Yg:a,panoPicture:{panoId:y.panoId,map:y.map,mapHistogram:y.mapHistogram,mapSize:y.mapSize,matrix:l.matrix.clone().premultiply(l.work.transform),zoom:1},position:l.position.clone().applyMatrix4(l.work.transform),fixCameraTransform:new c.Matrix4};n.panoPicture&&this.panoPictureObserverMap.set(n.panoPicture,l),this.pendingPanoTask=void 0,Promise.resolve().then(()=>Oh(_)).catch(e=>Yh(e)).then(r=>{var i,a;if(!(r instanceof Error))this.pending.delete(g),this.pendingPanoTask=void 0,(i=this.panoMeshes.get(s))==null||i.setProgress(0),this.doMoveToPano(e,n,t);else{let e=null;r instanceof Error&&(e||(e=r));let n=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{error:e,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),t.moveCancelCallback&&t.moveCancelCallback(),this.emit(`pano.error`,Q(`pano.error`,{error:e,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),e instanceof Error&&e.message&&this.emit(`error`,e),this.pending.delete(g),this.pendingPanoTask=void 0,(a=this.panoMeshes.get(s))==null||a.setProgress(0)}});return}let b=this.panoMeshes.get(s);b&&b.tap&&b.tap(),this.pendingPanoTask={panoId:s,hash:h,onLoad:n=>{var r,i;let a=n.body;if(this.destroyed)a.dispose();else{a.name=h;let n=Array.isArray(a.image)?a.image[0]:a.image,u=(r=n==null?void 0:n.width)==null?2048:r,d=l.images.histogram;d||(d=new _m().formPixels(Uh(this.renderer,a,!0,pm).data),l.images.histogram=d);let f={panoId:s,effect:o,effectEasing:(i=t.effectEasing)==null?Yg:i,panoPicture:{panoId:s,map:a,mapSize:u,mapHistogram:new c.Vector4().fromArray(d.toArray()),matrix:l.matrix.clone().premultiply(l.work.transform),zoom:1},position:l.position.clone().applyMatrix4(l.work.transform),fixCameraTransform:new c.Matrix4};f.panoPicture&&this.panoPictureObserverMap.set(f.panoPicture,l),this.doMoveToPano(e,f,t)}},onError:e=>{let n=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{error:e,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),t.moveCancelCallback&&t.moveCancelCallback(),this.emit(`pano.error`,Q(`pano.error`,{error:e,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),e instanceof Error&&e.message&&this.emit(`error`,e)}},Promise.all([Promise.resolve().then(()=>{this.emit(`pano.texture.load`,Q(`pano.texture.load`,{error:null,progress:0,meta:null,pano:e}))}).then(()=>this.textureLoader.loadCubeTexture(m,{imageURL:{transform:f,options:p},format:c.RGBFormat,viaAjax:!0,fetcher:Cf(this.fiveId,l.work)},void 0,void 0,t=>{var n,r;this.emit(`pano.texture.progress`,Q(`pano.texture.progress`,{error:null,progress:t,meta:null,pano:e})),((n=this.pendingPanoTask)==null?void 0:n.hash)===h&&((r=this.panoMeshes.get(s))==null||r.setProgress(t))},this.renderer)).catch(t=>{let n=Yh(t);return this.emit(`pano.texture.error`,Q(`pano.texture.error`,{error:n,progress:0,meta:null,pano:e})),n}),Promise.resolve().then(()=>Oh(_)).catch(e=>Yh(e))]).then(([t,n])=>{var r,i,a,o;if(!(t instanceof Error)&&!(n instanceof Error))this.pending.delete(g),((r=this.pendingPanoTask)==null?void 0:r.hash)===h?(this.pendingPanoTask.onLoad(t),this.pendingPanoTask=void 0,(i=this.panoMeshes.get(s))==null||i.setProgress(0)):t.body.dispose(),this.emit(`pano.texture.success`,Q(`pano.texture.success`,{error:null,progress:1,meta:t.meta,pano:e}));else{let e=null;t instanceof Error?e||(e=t):t.body.dispose(),n instanceof Error&&(e||(e=n)),this.pending.delete(g),((a=this.pendingPanoTask)==null?void 0:a.hash)===h&&(this.pendingPanoTask.onError(e),this.pendingPanoTask=void 0,(o=this.panoMeshes.get(s))==null||o.setProgress(0))}})}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{duration:n,effect:r,userAction:i}=this.initial;this.userAction=i;let a=e.initAnimationEndState(this),o={workCode:a.workCode,panoIndex:a.panoIndex},s=!1;this.moveToPano(o,{longitude:a.longitude,latitude:a.latitude,fov:a.fov,effect:r,duration:n,moveStartCallback:e=>{s=!0,this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:e,userAction:this.userAction}))},moveEndCallback:e=>{this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:e,userAction:this.userAction})),this.initAnimationed=!0,t()},moveCancelCallback:()=>{let e=Object.assign(Object.assign(Object.assign({},o),{mode:this.mode}),$(this.camera.pose));s===!1&&this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:e,userAction:this.userAction})),this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:e,userAction:this.userAction})),this.initAnimationed=!0,t()}},i)})}panoResourceFromLocationMotionKeyframe(e){return this.panoResources[e.key]}locationMotionKeyframesLength(e){let t=0;for(let n=1;n<e.length;n++){let r=this.panoResourceFromLocationMotionKeyframe(e[n-1]).position,i=this.panoResourceFromLocationMotionKeyframe(e[n]).position,a=r.distanceTo(i)*(e[n].value.count-e[n-1].value.count);t+=a}return t}doMoveToPano(e,t,n={}){var r,i,a,o,s,l,u,d,f,p,m;let h=H(),g=rn();this.panoResources[g]=t;let _,v,y;if(this.locationMotion.ended){let[e,n]=this.locationMotion.getKeyFrameSegment(h),i=this.locationMotion.value,a=((r=this.panoResourceFromLocationMotionKeyframe(n))==null?this.camera:r).position,o=t.position;_=Math.max(a.distanceTo(o),1),v=[{key:n.key,progress:0,value:Object.assign(Object.assign({},i),{count:0})},{key:g,progress:1,value:{distance:0,count:1}}],y=0}else{let[e,n]=this.locationMotion.getKeyFrameSegment(h),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(e).position,a=this.panoResourceFromLocationMotionKeyframe(n).position,o=t.position,s=n.value.count-r.count,c=Math.max(i.distanceTo(a),1)*s;_=c+Math.max(a.distanceTo(o),1),v=[{key:e.key,progress:0,value:Object.assign({},r)},{key:n.key,progress:c/_,value:n.value},{key:g,progress:1,value:{count:n.value.count+1,distance:0}}];let l=this.locationMotionKeyframesLength(this.locationMotion.keyframes),u=this.locationMotionKeyframesLength(v);y=l===0||l===0?0:this.locationMotion.getProgressVelocity(h)*l/u}let b=t.effect===`instant`?0:this.calculateMovingDuration(n.duration,t.effect===`fly`||t.effect===`model`?_:0),x={longitude:n.longitude,latitude:n.latitude,fov:n.fov},S=Object.assign(Object.assign({},e),{mode:this.mode,longitude:(i=x.longitude)==null?this.camera.pose.longitude:i,latitude:(a=x.latitude)==null?this.camera.pose.latitude:a,fov:(o=x.fov)==null?this.camera.pose.fov:o,offset:t.position.clone(),distance:this.camera.pose.distance}),C=this.currentPano;if(this.emit(`pano.moveTo`,Q(`pano.moveTo`,{options:n,prevPano:C,pano:{panoIndex:S.panoIndex,workCode:S.workCode},progress:0,state:S,userAction:this.userAction,error:null})),n.moveStartCallback&&n.moveStartCallback(S),this.perspToOrthoMotion.set({perspToOrtho:0},b).catch(K),this.modelAlphaMotion.setKeyframes([{progress:0,value:Object.assign({},this.modelAlphaMotion.value)},{progress:.6,value:Object.assign({},this.modelAlphaMotion.value)},{progress:1,value:{modelAlpha:0}}],b).catch(K),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute(`src`)&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute(`uuid`),this.videoTexture.image.removeAttribute(`src`),this.videoTexture.image.oncanplay=K,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),t.effect===`fly`||t.effect===`model`)this.cameraMotion.set(x,b).catch(K);else{let e=Ht({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),n=Ht({longitude:(s=x.longitude)==null?this.cameraMotion.value.longitude:s,latitude:(l=x.latitude)==null?this.cameraMotion.value.latitude:l}),r=new c.Object3D;r.lookAt(e);let i=new c.Matrix4().makeRotationFromQuaternion(r.quaternion);r.lookAt(n);let a=new c.Matrix4().makeRotationFromQuaternion(r.quaternion),o=new c.Matrix4().getInverse(i).premultiply(a),h=this.cameraMotion.value.fov,g=(u=x.fov)==null?this.cameraMotion.value.fov:u,_=1;t.effect===`zoomin`?_=1.5:t.effect===`zoomout`&&(_=.4);let y=U(g*_,1,170);for(let e=0;e<v.length-1;e++){let t=v[e].key;if(t){let e=this.panoResources[t];e&&(e.fixCameraTransform.copy(o),e.panoPicture&&(e.panoPicture.zoom=Math.tan(y/2/180*Math.PI)/Math.tan(h/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(d=x.longitude)==null?this.cameraMotion.value.longitude:d,latitude:(f=x.latitude)==null?this.cameraMotion.value.latitude:f,fov:y}},{progress:1,value:{longitude:(p=x.longitude)==null?this.cameraMotion.value.longitude:p,latitude:(m=x.latitude)==null?this.cameraMotion.value.latitude:m,fov:g}}],b).catch(K)}this.locationMotion.setKeyframes(v,b,y).then(()=>{for(let e of this.modelScene.children)e instanceof Hf&&e.show();let t=Object.assign(Object.assign({},e),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance});this.emit(`pano.arrived`,Q(`pano.arrived`,{options:n,prevPano:C,pano:{panoIndex:t.panoIndex,workCode:t.workCode},progress:1,state:t,userAction:this.userAction,error:null})),n.moveEndCallback&&n.moveEndCallback(t);let r=this.works.getObserver(e);if(r&&r.images.video&&this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement){let e={map:this.videoTexture,size:r.images.video.size.clone(),matrix:r.images.video.matrix.clone(),panoMatrix:r.matrix.clone().premultiply(r.work.transform),alpha:1},t=rn(),n=this.videoTexture.image;n.setAttribute(`uuid`,t),n.oncanplay=K,n.ontimeupdate=K,og().then(i=>{i&&r.images.video&&n.getAttribute(`uuid`)===t&&(n.oncanplay=()=>{n.oncanplay=K,n.play()},n.ontimeupdate=()=>{n.currentTime>.5&&(n.ontimeupdate=K,this.panoVideo.setMaterial(e))},n.src=r.images.video.source)}).catch((()=>{n.removeAttribute(`uuid`)}))}else{let e=this.videoTexture.image;e.removeAttribute(`uuid`),e.oncanplay=K,e.ontimeupdate=K}},()=>{let e=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{options:n,prevPano:C,pano:{panoIndex:e.panoIndex,workCode:e.workCode},progress:0,state:e,userAction:this.userAction,error:null})),n.moveCancelCallback&&n.moveCancelCallback()})}getForwardObserverOrNot(e,t){let n=this.works.getObserver(this.currentPano);if(!n)return null;let r=t==null?new c.Raycaster(e.position.clone(),e.getWorldDirection(new c.Vector3)):t;r.params.Points={threshold:.1},r.firstHitOnly=!0,r.floorIndex=-1;let i=n.standingPosition.clone().applyMatrix4(n.work.transform);if(n.position.clone().applyMatrix4(n.work.transform).distanceTo(r.ray.origin)>1){let e=new c.Raycaster(r.ray.origin,new c.Vector3(0,-1,0));e.firstHitOnly=r.firstHitOnly,e.floorIndex=r.floorIndex;let[t]=this.modelScene.intersectRaycaster(e);t&&t.distance<=2?i.copy(t.point):i.copy(r.ray.origin).add(new c.Vector3(0,-1.5,0))}let[a]=this.modelScene.intersectRaycaster(r),o=(a?a.point:r.ray.origin.clone().add(r.ray.direction.clone().normalize().multiplyScalar(3))).clone().sub(i).normalize();if(o.length()===0)return null;let s=n.work.observers,l=n.accessibleNodes.filter(t=>{if(t===this.currentPano.panoIndex&&n.work.workCode===this.currentPano.workCode)return!1;let r=s[t];if(!r)return!1;let i=r.standingPosition.clone().applyMatrix4(r.work.transform).project(e);return Math.abs(i.z)>1||Math.abs(i.x)>1||Math.abs(i.y)>1?!1:r.loadable||r.active}),u=new Map,d=l.slice().sort((e,t)=>{let n=s[e],r=u.get(n);r===void 0&&(r=Zg.copy(n.standingPosition).applyMatrix4(n.work.transform).distanceTo(i),u.set(n,r));let a=s[t],o=u.get(a);return o===void 0&&(o=Zg.copy(a.standingPosition).applyMatrix4(a.work.transform).distanceTo(i),u.set(a,o)),r-o});u.clear();for(let e of[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3])for(let t of d){let n=s[t];if(n){let t=Zg.copy(n.standingPosition).applyMatrix4(n.work.transform).sub(i);if(t&&t.length()!==0&&o.angleTo(t)<e)return n}}let f=null;if(t){let n=t.ray.intersectBox(this.modelScene.boundingBox,Zg);n&&(n.project(e),Math.abs(n.z)<=1&&(f=n.clone()))}else f=new c.Vector3(0,0,0);if(f){let t=n.accessibleNodes.filter(t=>{if(t===this.currentPano.panoIndex&&n.work.workCode===this.currentPano.workCode)return!1;let r=s[t];if(!r)return!1;let i=r.position.clone().applyMatrix4(r.work.transform).project(e);return Math.abs(i.z)>1||Math.abs(i.x)>1||Math.abs(i.y)>1?!1:r.loadable||r.active}),r=new Map,i=t.slice().sort((t,n)=>{let i=s[t],a=r.get(i);a===void 0&&(a=Zg.copy(i.position).applyMatrix4(i.work.transform).distanceTo(e.position),r.set(i,a));let o=s[n],c=r.get(o);return c===void 0&&(c=Zg.copy(o.position).applyMatrix4(o.work.transform).distanceTo(e.position),r.set(o,c)),a-c});r.clear();for(let t of i){let n=s[t];if(n){let t=Zg.copy(n.position).applyMatrix4(n.work.transform);if(t.project(e),Math.abs(t.z)>1)continue;if(Math.pow(f.x-t.x,2)+Math.pow(f.y-t.y,2)<Math.pow(.4,2))return n}}}return null}onTapGesture(e){var t;if(this.userAction=e.userAction,this.stopMomentumMovement(),!this.initAnimationed)return;let n=e.center.raycaster;n.floorIndex=-1;let r=this.camera.getDirection(new c.Vector3).setY(0),i=null,a=this.works.getObserver(this.currentPano);if(!a)return;let o=a.work.observers,s=a.accessibleNodes.filter(e=>{if(e===this.currentPano.panoIndex&&a.work.workCode===this.currentPano.workCode)return!1;let t=o[e];return!t||Zg.copy(t.position).applyMatrix4(t.work.transform).distanceTo(this.camera.position)>this.maxAccessibleDistance?!1:t.loadable||t.active}),[l]=this.modelScene.intersectRaycaster(n);if(l){let[e,n]=zl(s,e=>{let t=o[e];return t?Zg.copy(t.standingPosition).applyMatrix4(t.work.transform).distanceTo(l.point):1/0},!0);typeof e==`number`&&n<this.panoTapTriggerRadius&&(i=(t=o[e])==null?null:t)}if(i||(i=this.getForwardObserverOrNot(this.camera,n)),i&&i.panoId===Z(this.currentPano)&&(i=null),i&&!this.locationMotion.ended){for(let e of this.locationMotion.keyframes)if(this.panoResourceFromLocationMotionKeyframe(e).panoId===i.panoId){i=null;break}}if(!i)this.emit(`gesture.tap`,e),e.defaultPrevented||this.locationMotion.ended===!0&&this.cameraBounce();else{let t={},n=Math.PI/6,o=Math.PI/12,s=i.position.clone().applyMatrix4(i.work.transform).setY(0).sub(a.position.clone().applyMatrix4(i.work.transform).setY(0)).normalize(),c=[],l=[],u=[],d=i.work.observers;for(let e of i.accessibleNodes){if(i.panoIndex===e||e===this.currentPano.panoIndex&&i.work.workCode===this.currentPano.workCode)continue;let t=d[e];if(!t)continue;let r=t.position.clone().applyMatrix4(t.work.transform).sub(i.position.clone().applyMatrix4(i.work.transform)).setY(0).normalize();s.angleTo(r)<n&&u.push(r)}let[f]=(u.length>0?u:[...c,...l]).slice().sort((e,t)=>e.angleTo(s)-t.angleTo(s));if(f&&f.angleTo(r)>o&&(t.longitude=Math.atan2(-f.x,-f.z)),this.cameraMotion.value.latitude<-Math.PI/4){let n=e.state.fov;t.latitude=U(0,U(typeof this.minLatitude==`function`?this.minLatitude(n):this.minLatitude,-Math.PI/2,Math.PI/2),U(typeof this.maxLatitude==`function`?this.maxLatitude(n):this.maxLatitude,-Math.PI/2,Math.PI/2))}let p=Object.assign({},e.state);if(p.workCode=i.work.workCode,p.panoIndex=i.panoIndex,t.longitude!==void 0&&(p.longitude=t.longitude),t.latitude!==void 0&&(p.latitude=t.latitude),t.fov!==void 0&&(p.fov=t.fov),p.distance=0,p.offset=i.position.clone(),e.state=p,this.emit(`gesture.tap`,e),!e.defaultPrevented){if(this.emit(`pano.select`,Q(`pano.select`,{prevPano:this.currentPano,pano:{panoIndex:p.panoIndex,workCode:p.workCode},state:p,userAction:e.userAction,options:t,progress:0,error:null})),i&&!i.active){let e=Z({panoIndex:i.panoIndex,workCode:i.work.workCode}),t=this.panoMeshes.get(e);t&&(t.setDisabled(!1),t.setLoading(!0))}i&&i.active&&this.emit(`pano.request`,Q(`pano.request`,{userAction:e.userAction,prevPano:this.currentPano,pano:{panoIndex:p.panoIndex,workCode:p.workCode},progress:0,state:p,options:t,error:null}))}}}},t_=Math.PI/180,n_=180/Math.PI,r_=.001,i_=1,a_=(()=>{let e=typeof navigator<`u`&&/iPad|iPhone|iPod/.test(navigator.platform);return()=>e})(),o_=(()=>{let e=typeof navigator<`u`&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return()=>e})(),s_=(()=>{let e=typeof navigator<`u`&&navigator.userAgent.indexOf(`Firefox`)!==-1&&navigator.userAgent.indexOf(`Android`)!==-1;return()=>e})(),c_=(()=>{let e=typeof navigator<`u`?navigator.userAgent.match(/.*Chrome\/([0-9]+)/):null,t=e?parseInt(e[1],10):null;return()=>t})(),l_=(()=>{let e=!1;if(c_()===65){let t=typeof navigator<`u`?navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/):null;if(t){let[n,r,i,a]=t[1].split(`.`);e=parseInt(i,10)===3325&&parseInt(a,10)<148}}return()=>e})(),u_=(()=>{let e=a_()&&o_()&&typeof navigator<`u`&&navigator.userAgent.indexOf(`13_4`)!==-1;return()=>e})(),d_=(()=>{let e=typeof navigator<`u`&&navigator.userAgent.indexOf(`R7 Build`)!==-1;return()=>e})();function f_(){let e=typeof window<`u`&&(window.orientation==90||window.orientation==-90);return d_()?!e:e}function p_(e){return!(isNaN(e)||e<=r_||e>i_)}function m_(e){return e.w>1?0:2*Math.acos(e.w)}var h_=(()=>{let e={};return(t,n)=>{e[t]===void 0&&(console.warn(`cardboard: `+n),e[t]=!0)}})();function g_(e){let t,n=e.indexOf(`://`);t=n===-1?0:n+3;let r=e.indexOf(`/`,t);return r===-1&&(r=e.length),e.substring(0,r)}function __(){if(typeof window>`u`||typeof document>`u`)return!1;let e=window.self!==window.top,t=g_(document.referrer),n=g_(window.location.href);return e&&t!==n}var v_=(()=>{function e(e,t,n){let r=t?t[0]:0,i=t?t[1]:0,a=t?t[2]:0,o=t?t[3]:1,s=r+r,c=i+i,l=a+a,u=r*s,d=r*c,f=r*l,p=i*c,m=i*l,h=a*l,g=o*s,_=o*c,v=o*l;return e[0]=1-(p+h),e[1]=d+v,e[2]=f-_,e[3]=0,e[4]=d-v,e[5]=1-(u+h),e[6]=m+g,e[7]=0,e[8]=f+_,e[9]=m-g,e[10]=1-(u+p),e[11]=0,e[12]=n?n[0]:0,e[13]=n?n[1]:0,e[14]=n?n[2]:0,e[15]=1,e}function t(e,t,n){let r=n[0],i=n[1],a=n[2],o,s,c,l,u,d,f,p,m,h,g,_;return t===e?(e[12]=t[0]*r+t[4]*i+t[8]*a+t[12],e[13]=t[1]*r+t[5]*i+t[9]*a+t[13],e[14]=t[2]*r+t[6]*i+t[10]*a+t[14],e[15]=t[3]*r+t[7]*i+t[11]*a+t[15]):(o=t[0],s=t[1],c=t[2],l=t[3],u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],_=t[11],e[0]=o,e[1]=s,e[2]=c,e[3]=l,e[4]=u,e[5]=d,e[6]=f,e[7]=p,e[8]=m,e[9]=h,e[10]=g,e[11]=_,e[12]=o*r+u*i+m*a+t[12],e[13]=s*r+d*i+h*a+t[13],e[14]=c*r+f*i+g*a+t[14],e[15]=l*r+p*i+_*a+t[15]),e}function n(e,t){let n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=n*s-r*o,y=n*c-i*o,b=n*l-a*o,x=r*c-i*s,S=r*l-a*s,C=i*l-a*c,w=u*h-d*m,T=u*g-f*m,E=u*_-p*m,D=d*g-f*h,O=d*_-p*h,k=f*_-p*g,A=v*k-y*O+b*D+x*E-S*T+C*w;return A?(A=1/A,e[0]=(s*k-c*O+l*D)*A,e[1]=(i*O-r*k-a*D)*A,e[2]=(h*C-g*S+_*x)*A,e[3]=(f*S-d*C-p*x)*A,e[4]=(c*E-o*k-l*T)*A,e[5]=(n*k-i*E+a*T)*A,e[6]=(g*b-m*C-_*y)*A,e[7]=(u*C-f*b+p*y)*A,e[8]=(o*O-s*E+l*w)*A,e[9]=(r*E-n*O-a*w)*A,e[10]=(m*S-h*b+_*v)*A,e[11]=(d*b-u*S-p*v)*A,e[12]=(s*T-o*D-c*w)*A,e[13]=(n*D-r*T+i*w)*A,e[14]=(h*y-m*x-g*v)*A,e[15]=(u*x-d*y+f*v)*A,e):null}return(r,i,a)=>{e(r,i),a&&t(r,r,a),n(r,r)}})(),y_=class{constructor(e=new c.Vector3,t=0){this.sample=e,this.timestampS=t}set(e,t){this.sample=e,this.timestampS=t}copy(e){this.set(e.sample,e.timestampS)}},b_=class{constructor(e,t){this.kFilter=e,this.isDebug=t,this.currentAccelMeasurement=new y_,this.currentGyroMeasurement=new y_,this.previousGyroMeasurement=new y_,a_()?this.filterQ=new c.Quaternion(-1,0,0,1):this.filterQ=new c.Quaternion(1,0,0,1),this.previousFilterQ=new c.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new c.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new c.Vector3,this.measuredGravity=new c.Vector3,this.gyroIntegralQ=new c.Quaternion}addAccelMeasurement(e,t){this.currentAccelMeasurement.set(e,t)}addGyroMeasurement(e,t){this.currentGyroMeasurement.set(e,t),p_(t-this.previousGyroMeasurement.timestampS)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)}getOrientation(){return this.filterQ}run_(){if(!this.isOrientationInitialized){this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),this.isOrientationInitialized=!0;return}let e=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,t=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,e);this.gyroIntegralQ.multiply(t),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(t);let n=new c.Quaternion;n.copy(this.filterQ),n.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(n),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();let r=new c.Quaternion;r.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),r.inverse(),this.isDebug&&console.log(`Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)`,n_*m_(r),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));let i=new c.Quaternion;i.copy(this.filterQ),i.multiply(r),this.filterQ.slerp(i,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)}accelToQuaternion_(e){let t=new c.Vector3;t.copy(e),t.normalize();let n=new c.Quaternion;return n.setFromUnitVectors(new c.Vector3(0,0,-1),t),n.inverse(),n}gyroToQuaternionDelta_(e,t){let n=new c.Quaternion,r=new c.Vector3;return r.copy(e),r.normalize(),n.setFromAxisAngle(r,e.length()*t),n}},x_=class{constructor(e,t){this.predictionTimeS=e,this.isDebug=t,this.previousQ=new c.Quaternion,this.previousTimestampS=null,this.deltaQ=new c.Quaternion,this.outQ=new c.Quaternion}getPrediction(e,t,n){if(!this.previousTimestampS)return this.previousQ.copy(e),this.previousTimestampS=n,e;let r=new c.Vector3;r.copy(t),r.normalize();let i=t.length();if(i<t_*20)return this.isDebug&&console.log(`Moving slowly, at %s deg/s: no prediction`,(n_*i).toFixed(1)),this.outQ.copy(e),this.previousQ.copy(e),this.outQ;let a=i*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(r,a),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(e),this.previousTimestampS=n,this.outQ}},S_=class{constructor(e){this.coefficients=e}distortInverse(e){let t=0,n=1,r=e-this.distort(t);for(;Math.abs(n-t)>1e-4;){let i=e-this.distort(n),a=n-i*((n-t)/(i-r));t=n,n=a,r=i}return n}distort(e){let t=e*e,n=0;for(let e=0;e<this.coefficients.length;e++)n=t*(n+this.coefficients[e]);return(n+1)*e}},C_=class{constructor(){this.angularAcceleration=null,this.angularVelocity=null,this.linearAcceleration=null,this.linearVelocity=null,this.orientation=null,this.position=null}},w_=class{constructor(){this.leftDegrees=0,this.rightDegrees=0,this.upDegrees=0,this.downDegrees=0}},T_=class{constructor(e,t,n,r){this.viewer={id:`CardboardV1`,label:`Cardboard I/O 2014`,fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]},this.device={widthMeters:.11,heightMeters:.062,bevelMeters:.004},this.depthNear=.01,this.depthFar=1e4,this.yawOnly=n,this.accelerometer=new c.Vector3,this.gyroscope=new c.Vector3,this.filter=new b_(e,r),this.posePredictor=new x_(t,r),this.isFirefoxAndroid=s_(),this.isIOS=a_();let i=c_();this.isDeviceMotionInRadians=!this.isIOS&&i!==null&&i<66,this.isWithoutDeviceMotion=l_()||u_(),this.filterToWorldQ=new c.Quaternion,a_()?this.filterToWorldQ.setFromAxisAngle(new c.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new c.Vector3(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new c.Quaternion,this.worldToScreenQ=new c.Quaternion,this.originalPoseAdjustQ=new c.Quaternion;let a=typeof window<`u`?-window.orientation*Math.PI/180:0;this.originalPoseAdjustQ.setFromAxisAngle(new c.Vector3(0,0,1),a),this.setScreenTransform_(),f_()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new c.Quaternion,this.orientationOut_=new Float32Array(4),this.previousTimestampS=Date.now()}getPosition(){return null}getOrientation(){let e;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||(function(){let e=new c.Quaternion().setFromAxisAngle(new c.Vector3(0,0,-1),0),t=new c.Quaternion;return typeof window<`u`&&window.orientation===-90?t.setFromAxisAngle(new c.Vector3(0,1,0),Math.PI/-2):t.setFromAxisAngle(new c.Vector3(0,1,0),Math.PI/2),e.multiply(t)})(),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||(function(){let e=new c.Quaternion;return e.setFromAxisAngle(new c.Vector3(1,0,0),-Math.PI/2),e})(),e=this._deviceOrientationQ;let t=new c.Quaternion;return t.copy(e),t.multiply(this.deviceOrientationFilterToWorldQ),t.multiply(this.resetQ),t.multiply(this.worldToScreenQ),t.multiplyQuaternions(this.deviceOrientationFixQ,t),this.yawOnly&&(t.x=0,t.z=0,t.normalize()),this.orientationOut_[0]=t.x,this.orientationOut_[1]=t.y,this.orientationOut_[2]=t.z,this.orientationOut_[3]=t.w,this.orientationOut_}else{let t=this.filter.getOrientation();e=this.posePredictor.getPrediction(t,this.gyroscope,this.previousTimestampS)}let t=new c.Quaternion;return t.copy(this.filterToWorldQ),t.multiply(this.resetQ),t.multiply(e),t.multiply(this.worldToScreenQ),this.yawOnly&&(t.x=0,t.z=0,t.normalize()),this.orientationOut_[0]=t.x,this.orientationOut_[1]=t.y,this.orientationOut_[2]=t.z,this.orientationOut_[3]=t.w,this.orientationOut_}getPose(){let e=new C_;return e.orientation=this.getOrientation(),e}resetPose(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),f_()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)}getFrameData(e){let t=this.getOrientation(),n=this.getEyeOffset(),r=this.getEyeProjectionMatrix();return e.pose.angularAcceleration=null,e.pose.angularVelocity=null,e.pose.linearAcceleration=null,e.pose.linearVelocity=null,e.pose.orientation=t,e.pose.position=null,e.timestamp=this.previousTimestampS,e.leftProjectionMatrix.set(r.left),e.rightProjectionMatrix.set(r.right),v_(e.leftViewMatrix,t,n.left),v_(e.rightViewMatrix,t,n.right),e}start(){if(typeof window>`u`)return()=>{};let e=this.onDeviceMotion_.bind(this),t=this.onOrientationChange_.bind(this),n=this.onMessage_.bind(this),r=this.onDeviceOrientation_.bind(this);return a_()&&__()&&window.addEventListener(`message`,n),window.addEventListener(`orientationchange`,t),this.isWithoutDeviceMotion?window.addEventListener(`deviceorientation`,r):window.addEventListener(`devicemotion`,e),()=>{window.removeEventListener(`devicemotion`,e),window.removeEventListener(`deviceorientation`,t),window.removeEventListener(`orientationchange`,t),window.removeEventListener(`message`,n)}}getEyeOffset(){return{left:[-this.viewer.interLensDistance*.5,0,0],right:[this.viewer.interLensDistance*.5,0,0]}}getEyeProjectionMatrix(){let e=this.getEyeFieldOfView(),t=this.depthNear,n=this.depthFar,r={left:[],right:[]};{let i=e.left.upDegrees*t_,a=e.left.downDegrees*t_,o=e.left.leftDegrees*t_,s=e.left.rightDegrees*t_,c=2/(o+s),l=2/(i+a);r.left[0]=c,r.left[1]=0,r.left[2]=0,r.left[3]=0,r.left[4]=0,r.left[5]=l,r.left[6]=0,r.left[7]=0,r.left[8]=-((o-s)*c*.5),r.left[9]=(i-a)*l*.5,r.left[10]=n/(t-n),r.left[11]=-1,r.left[12]=0,r.left[13]=0,r.left[14]=n*t/(t-n),r.left[15]=0}{let i=e.right.upDegrees*t_,a=e.right.downDegrees*t_,o=e.right.leftDegrees*t_,s=e.right.rightDegrees*t_,c=2/(o+s),l=2/(i+a);r.right[0]=c,r.right[1]=0,r.right[2]=0,r.right[3]=0,r.right[4]=0,r.right[5]=l,r.right[6]=0,r.right[7]=0,r.right[8]=-((o-s)*c*.5),r.right[9]=(i-a)*l*.5,r.right[10]=n/(t-n),r.right[11]=-1,r.right[12]=0,r.right[13]=0,r.right[14]=n*t/(t-n),r.right[15]=0}return r}getEyeFieldOfView(){let e=this.viewer,t=this.device,n=new S_(e.distortionCoefficients),r=e.screenLensDistance,i=(t.widthMeters-e.interLensDistance)/2,a=e.interLensDistance/2,o=e.baselineLensDistance-t.bevelMeters,s=t.heightMeters-o,c=n_*Math.atan(n.distort(i/r)),l=n_*Math.atan(n.distort(a/r)),u=n_*Math.atan(n.distort(o/r)),d=n_*Math.atan(n.distort(s/r)),f=new w_,p=new w_;return f.leftDegrees=Math.min(c,e.fov),f.rightDegrees=Math.min(l,e.fov),f.downDegrees=Math.min(u,e.fov),f.upDegrees=Math.min(d,e.fov),p.leftDegrees=f.rightDegrees,p.rightDegrees=f.leftDegrees,p.upDegrees=f.upDegrees,p.downDegrees=f.downDegrees,{left:f,right:p}}onDeviceOrientation_(e){this._deviceOrientationQ=this._deviceOrientationQ||new c.Quaternion;let{alpha:t,beta:n,gamma:r}=e;t=(t||0)*Math.PI/180,n=(n||0)*Math.PI/180,r=(r||0)*Math.PI/180,this._deviceOrientationQ.setFromEuler(new c.Euler(t,n,-r,`YXZ`))}onDeviceMotion_(e){this.updateDeviceMotion_(e)}updateDeviceMotion_(e){let t=e.accelerationIncludingGravity,n=e.rotationRate,r=e.timeStamp/1e3,i=r-this.previousTimestampS;if(i<0){h_(`fusion-pose-sensor:invalid:non-monotonic`,`Invalid timestamps detected: non-monotonic timestamp from devicemotion`),this.previousTimestampS=r;return}else if(i<=r_||i>i_){h_(`fusion-pose-sensor:invalid:outside-threshold`,`Invalid timestamps detected: Timestamp from devicemotion outside expected range.`),this.previousTimestampS=r;return}t&&(this.accelerometer.set(-t.x,-t.y,-t.z),n&&(d_()?this.gyroscope.set(-n.beta,n.alpha,n.gamma):this.gyroscope.set(n.alpha,n.beta,n.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addGyroMeasurement(this.gyroscope,r)),this.filter.addAccelMeasurement(this.accelerometer,r)),this.previousTimestampS=r}onOrientationChange_(){this.setScreenTransform_()}onMessage_(e){let t=e.data;!t||!t.type||t.type.toLowerCase()===`devicemotion`&&this.updateDeviceMotion_(t.deviceMotionEvent)}setScreenTransform_(){switch(this.worldToScreenQ.set(0,0,0,1),typeof window<`u`?window.orientation:0){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new c.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new c.Vector3(0,0,1),Math.PI/2);break;case 180:break}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()}},E_=[0,0,.5,1],D_=[.5,0,.5,1],O_=class{constructor(e){this.renderer=e,this.sensor=new T_(.98,.04,!1,!1),this.scale=1,this.cameraL=new c.PerspectiveCamera,this.cameraR=new c.PerspectiveCamera;let t=this.sensor.start();this.dispose=()=>{let e=this.renderer.getSize(new c.Vector2);this.renderer.setScissor(0,0,e.width,e.height),this.renderer.setViewport(0,0,e.width,e.height),this.renderer.setScissorTest(!1),t()}}render(e,t){let n=this.renderer.getSize(new c.Vector2);if(n.width>n.height){var r=e.autoUpdate;r&&(e.updateMatrixWorld(),e.autoUpdate=!1);let i={x:Math.round(n.width*E_[0]),y:Math.round(n.height*E_[1]),width:Math.round(n.width*E_[2]),height:Math.round(n.height*E_[3])},a={x:Math.round(n.width*D_[0]),y:Math.round(n.height*D_[1]),width:Math.round(n.width*D_[2]),height:Math.round(n.height*D_[3])};this.renderer.setScissorTest(!0),this.renderer.autoClear&&this.renderer.clear(),t.parent===null&&t.updateMatrixWorld(),t.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),t.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale);let o=this.sensor.getEyeOffset();this.cameraL.translateOnAxis(new c.Vector3().fromArray(o.left),this.scale),this.cameraR.translateOnAxis(new c.Vector3().fromArray(o.right),this.scale);let s=this.sensor.getEyeProjectionMatrix();this.cameraL.projectionMatrix.elements=s.left.slice(),this.cameraR.projectionMatrix.elements=s.right.slice(),this.renderer.setViewport(i.x,i.y,i.width,i.height),this.renderer.setScissor(i.x,i.y,i.width,i.height),this.renderer.render(e,this.cameraL),this.renderer.setViewport(a.x,a.y,a.width,a.height),this.renderer.setScissor(a.x,a.y,a.width,a.height),this.renderer.render(e,this.cameraR),this.renderer.setViewport(0,0,n.width,n.height),this.renderer.setScissor(0,0,n.width,n.height),this.renderer.setScissorTest(!1),r&&(e.autoUpdate=!0)}else this.renderer.render(e,t)}dispose(){}},k_=`data:image/png;base64,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`,A_=`data:image/png;base64,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`,j_,M_={zh:{TITLE:`眼镜模式`,HIT:`请将手机横屏放入 VR 眼镜中`},en:{TITLE:`GLASSES MODE`,HIT:`Please put the mobile phone horizontally into the VR glasses.`},ja:{TITLE:`メガネモード`,HIT:`携帯電話をVRメガネに水平に入れてください。`}},N_=typeof navigator<`u`?(j_=M_[navigator.language.split(`-`)[0]])==null?M_.zh:j_:M_.zh,P_=`
1679
+ `,uniforms:{maxDepth:new c.Uniform(0)}});function Zg(e,t,n,r=1e3){Xg.uniforms.maxDepth.value=r,Yg.copy(e.getClearColor());let i=e.getClearAlpha(),a=t.overrideMaterial;t.overrideMaterial=Xg,e.setClearColor(Jg,0),n.update(e,t),e.setClearColor(Yg,i),t.overrideMaterial=a}var Qg=Ju,$g=new c.Raycaster,e_=new c.Vector3,t_=[new c.Vector3(0,0,0).multiplyScalar(.1),new c.Vector3(1,0,0).multiplyScalar(.1),new c.Vector3(-.5,0,-Math.sqrt(3)/2).multiplyScalar(.1),new c.Vector3(-.5,0,Math.sqrt(3)/2).multiplyScalar(.1)],n_=Object.assign(Object.assign({},ag),{maxAccessibleDistance:5,panoTapTriggerRadius:.5,panoCircleMeshCreator:(e,t)=>e.position.distanceTo(e.standingPosition)>t.aerialObserverMinHeight?new hh:new uh,adjustPanoCircleMeshPositionBasedOnModel:!1,tileLevelForFov:((e,t)=>{var n;let r=e=>e/180*Math.PI,i=(n=Math.log2)==null?(e=>Math.log(e)*Math.LOG2E):n,a=t.height/2/Math.tan(r(e/2))*Math.tan(r(45))*2,o=Math.max(i(a/512),0);return o<2.3&&o>.1&&(o=1),o=o%1>.75?Math.ceil(o):Math.floor(o),o}),tileAppearDuration:.5,tileMaxRequest:3,flyEffectUseDepthBuffer:!1}),r_=class e extends og{static parseArgs(t){var n,r,i,a,o,s,c,l;if(t instanceof e)return t;let u=super.parseArgs(t);return Object.assign(Object.assign({},u),{maxAccessibleDistance:(n=t.maxAccessibleDistance)==null?n_.maxAccessibleDistance:n,panoTapTriggerRadius:(r=t.panoTapTriggerRadius)==null?n_.panoTapTriggerRadius:r,panoCircleMeshCreator:(i=t.panoCircleMeshCreator)==null?n_.panoCircleMeshCreator:i,adjustPanoCircleMeshPositionBasedOnModel:(a=t.adjustPanoCircleMeshPositionBasedOnModel)==null?n_.adjustPanoCircleMeshPositionBasedOnModel:a,tileLevelForFov:(o=t.tileLevelForFov)==null?n_.tileLevelForFov:o,tileAppearDuration:(s=t.tileAppearDuration)==null?n_.tileAppearDuration:s,tileMaxRequest:(c=t.tileMaxRequest)==null?n_.tileMaxRequest:c,flyEffectUseDepthBuffer:(l=t.flyEffectUseDepthBuffer)==null?n_.flyEffectUseDepthBuffer:l})}static initAnimationEndState(e){let t=this.parseArgs(e),n=super.initAnimationEndState(t);return Object.assign(Object.assign({},n),{mode:`Panorama`})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Panorama`,this.initAnimationed=!1,this.maxAccessibleDistance=n.maxAccessibleDistance,this.panoTapTriggerRadius=n.panoTapTriggerRadius,this.panoCircleMeshCreator=n.panoCircleMeshCreator,this.adjustPanoCircleMeshPositionBasedOnModel=n.adjustPanoCircleMeshPositionBasedOnModel,this.tileLevelForFov=n.tileLevelForFov,this.tileAppearDuration=n.tileAppearDuration,this.tileMaxRequest=n.tileMaxRequest,this.flyEffectUseDepthBuffer=n.flyEffectUseDepthBuffer,this.adjustPanoCircleMeshPositionFix=new Map;let r=this.modelScene.parameter.resolveValue(`pano0`),i=this.modelScene.parameter.resolveValue(`pano1`);r&&(i==null?void 0:i.map)!==r.map&&(this.modelScene.parameter.set({pano0:i}),r.map.dispose());let a=new Set;r&&a.add(r),i&&a.add(i),this.panoMeshes=new Map,this.locationMotion=new X({count:0,distance:this.camera.pose.distance}),this.modelAlphaMotion=new X({modelAlpha:this.modelScene.parameter.resolveValue(`modelAlpha`)}),this.perspToOrthoMotion=new X({perspToOrtho:this.camera.perspToOrtho.x}),this.panoResources={},this.panoResources[this.locationMotion.keyframes[0].key=this.locationMotion.keyframes[1].key=rn()]={panoId:Z(this.currentPano),panoPicture:this.modelScene.parameter.resolveValue(`pano1`),position:this.camera.pose.offset.clone(),effect:`fly`,effectEasing:Qg,fixCameraTransform:new c.Matrix4},this.panoPictureObserverMap=new WeakMap,this.textureLoader=new yi,this.tiling=new Hg({fiveId:this.fiveId}),this.panoVideo=new qg,this.scene.add(this.panoVideo.object),this.accessibleObserverFloorCheckCount=0}get tileLevel(){return this.tiling.level}updateConfiguration(e){return super.updateConfiguration(e)===!1?!1:(e.maxAccessibleDistance!==void 0&&this.maxAccessibleDistance!==e.maxAccessibleDistance&&(this.maxAccessibleDistance=e.maxAccessibleDistance),e.panoTapTriggerRadius!==void 0&&this.panoTapTriggerRadius!==e.panoTapTriggerRadius&&(this.panoTapTriggerRadius=e.panoTapTriggerRadius),e.panoCircleMeshCreator!==void 0&&this.panoCircleMeshCreator!==e.panoCircleMeshCreator&&(this.panoCircleMeshCreator=e.panoCircleMeshCreator,this.panoMeshes&&(this.panoMeshes.forEach(e=>{this.helper.remove(e),e.dispose()}),this.panoMeshes.clear())),e.tileLevelForFov!==void 0&&this.tileLevelForFov!==e.tileLevelForFov&&(this.tileLevelForFov=e.tileLevelForFov),e.tileMaxRequest!==void 0&&this.tileMaxRequest!==e.tileMaxRequest&&(this.tileMaxRequest=e.tileMaxRequest),e.flyEffectUseDepthBuffer!==void 0&&this.flyEffectUseDepthBuffer!==e.flyEffectUseDepthBuffer&&(this.flyEffectUseDepthBuffer=e.flyEffectUseDepthBuffer),e.adjustPanoCircleMeshPositionBasedOnModel!==void 0&&this.adjustPanoCircleMeshPositionBasedOnModel!==e.adjustPanoCircleMeshPositionBasedOnModel&&(this.adjustPanoCircleMeshPositionBasedOnModel=e.adjustPanoCircleMeshPositionBasedOnModel,this.adjustPanoCircleMeshPositionBasedOnModel||this.adjustPanoCircleMeshPositionFix.clear()),!0)}destroy(){super.destroy(),this.tiling.dispose(),this.modelScene.parameter.set({refinedScreen:null,pano0Depth:null,pano1Depth:null}),this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0),this.locationMotion.dispose(),this.pendingPanoTask=void 0,this.panoMeshes&&(this.panoMeshes.forEach(e=>{this.helper.remove(e),e.dispose()}),this.panoMeshes.clear());let e=this.videoTexture.image;e.pause(),e.oncanplay=K,e.ontimeupdate=K,this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();let t=this.modelScene.parameter.resolveValue(`pano0`),n=this.modelScene.parameter.resolveValue(`pano1`);for(let e of Object.keys(this.panoResources)){let r=this.panoResources[e];if(r.panoPicture){let e=r.panoPicture.map;e&&e!==(t==null?void 0:t.map)&&e!==(n==null?void 0:n.map)&&(e.dispose(),r.panoPicture=null)}delete this.panoResources[e]}}isReady(){return this.locationMotion.ended===!0?super.isReady():!1}isTileReady(){let e=this.tiling.pedding<=0;return this.initAnimationed&&e}updateWork(t,n,r,i){this.userAction=i,this.works=t;let a=e.initAnimationEndState(Object.assign(Object.assign({},this),{initial:{currentState:Object.assign(Object.assign({},this.currentPano),this.camera.pose),duration:r.duration,effect:r.effect,state:n,userAction:i}}));return(a.workCode!==this.currentPano.workCode||a.panoIndex!==this.currentPano.panoIndex||a.longitude!==this.cameraMotion.value.longitude||a.latitude!==this.cameraMotion.value.latitude||a.fov!==this.cameraMotion.value.fov)&&(this.initAnimationed=!1,this.moveToPano({workCode:a.workCode,panoIndex:a.panoIndex},{effect:r.effect,duration:r.duration,longitude:a.longitude,latitude:a.latitude,fov:a.fov,moveEndCallback:()=>{this.initAnimationed=!0},moveCancelCallback:()=>{this.initAnimationed=!0}},i)),!0}updateModel(e){this.modelScene=e,this.hideIntersectMesh()}updateTime(e,t,...n){var r,i,a,o,s,l;if(this.destroyed)return;let u={},d={},f=this.camera.getDirection(new c.Vector3),p=this.locationMotion.keyframes[0],m=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[h,g]=this.locationMotion.getKeyFrameSegment(e),_=this.panoResourceFromLocationMotionKeyframe(h),v=this.panoResourceFromLocationMotionKeyframe(g),y=this.panoResourceFromLocationMotionKeyframe(p),b=this.panoResourceFromLocationMotionKeyframe(m),x=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),d.longitude=this.cameraMotion.value.longitude,d.latitude=this.cameraMotion.value.latitude,d.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),u.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(U(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let t=this.locationMotion.value.count-g.value.count+1,n=new c.Vector3().copy(_.position),a=new c.Vector3().copy(v.position);if(u.progress=v.effectEasing(t),t>=.01&&t<=.99&&(u.progress=U(v.effectEasing(t),.01,.99)),v.panoPicture&&(t<1?_.panoPicture&&(u.pano0=_.panoPicture):u.pano0=v.panoPicture,u.pano1=v.panoPicture),v.effect===`montage`?u.transition=`BLACK`:v.effect===`spread`?u.transition=`SPREAD`:u.transition=`FADE`,v.effect===`zoomin`||v.effect===`zoomout`?u.progress=Math.pow(t,3):v.effect===`model`&&this.camera.pose.distance<.01&&(u.modelAlpha=1-Math.pow(U(Math.abs(t-.5)*2,0,1),4)),t<1&&v.effect!==`fly`&&v.effect!==`model`){if(u.pano0&&_.panoPicture){let e={panoId:u.pano0.panoId,map:u.pano0.map,mapHistogram:u.pano0.mapHistogram,mapSize:u.pano0.mapSize,zoom:u.pano0.zoom,matrix:_.panoPicture.matrix.clone().premultiply(_.fixCameraTransform).setPosition(v.position)},t=this.panoPictureObserverMap.get(u.pano0);t&&this.panoPictureObserverMap.set(e,t),u.pano0=e}n.copy(a),x=!0}d.distance=this.locationMotion.value.distance,d.offset=new c.Vector3(n.x+(a.x-n.x)*t,n.y+(a.y-n.y)*t,n.z+(a.z-n.z)*t);let o=[],s=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(o.push(t),n>this.locationMotion.progress&&s.push(t))}for(let e of Object.keys(this.panoResources)){if(s.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.panoPicture){let e=t.panoPicture.map;if(e){if(e===((r=u.pano0)==null?void 0:r.map)||e===((i=u.pano1)==null?void 0:i.map))continue;e.dispose(),t.panoPicture=null}}o.indexOf(e)>=0||delete this.panoResources[e]}let l=yp(v.panoId);l!==this.currentPano&&(this.currentPano=l,this.accessibleObserverFloorCheckCount=0),this.emit(`pano.moving`,Q(`pano.moving`,{userAction:this.userAction,prevPano:yp(y.panoId),pano:yp(b.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},yp(b.panoId)),{mode:this.mode}),$(this.camera.pose)),d),options:{},progress:this.locationMotion.progress,error:null}))}zh(u)===!1&&this.modelScene.parameter.set(u),zh(d)===!1&&this.setCamera(d);let S=this.works.getObserver(this.currentPano),C=this.locationMotion.ended?this.getForwardObserverOrNot(this.camera):null,w=this.works.getObserver(_.panoId),T=this.works.getObserver(v.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&S){let e=[],t=S.work.observers;for(let n of S.accessibleNodes){let r=t[n];r&&e.push(r)}let n=new Map;if(e.sort((e,t)=>{let r=n.get(e);r===void 0&&(r=e.standingPosition.distanceTo(S.standingPosition),n.set(e,r));let i=n.get(e);return i===void 0&&(i=t.standingPosition.distanceTo(S.standingPosition),n.set(t,i)),r-i}),e.length){this.accessibleObserverFloorCheckCount%=e.length;let t=e[this.accessibleObserverFloorCheckCount],n=this.modelScene.models.find(e=>e.work===(t==null?void 0:t.work));if(t&&n&&n.visible){let e=.3,r=.005,i=t.standingPosition.clone().applyMatrix4(t.work.transform),a=Z({panoIndex:t.panoIndex,workCode:t.work.workCode}),o=t_.map(t=>{$g.ray.origin.copy(i),$g.ray.origin.add(e_.copy(t).setY(e)),$g.ray.direction.set(0,-1,0),$g.firstHitOnly=!0,$g.floorIndex=-1;let[a]=n.intersectRaycaster($g);return a&&a.distance-r<=e?new c.Vector3().copy(i).setY(a.point.y+r):i});o.sort((e,t)=>t.y-e.y);let s=o[Math.floor(o.length/2)],[l]=o.filter(e=>e.distanceTo(s)<=.05);if(l){let e=new c.Vector4(i.x,i.y,i.z,l.y-i.y),t=this.adjustPanoCircleMeshPositionFix.get(a);t&&!e.equals(t)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(a,e)}}this.accessibleObserverFloorCheckCount++}}let E=new Map;if(w)for(let e of w.accessibleNodes){let t=w.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});E.set(e,t)}}if(T)for(let e of T.accessibleNodes){let t=T.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});E.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{E.get(t)?E.delete(t):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),E.forEach((e,t)=>{let n=this.panoCircleMeshCreator(e,{aerialObserverMinHeight:this.aerialObserverMinHeight});this.panoMeshes.set(t,n),this.helper.add(n),E.delete(t)}),this.panoMeshes.forEach((e,t)=>{let n=this.works.getObserver(t);if(n){let r=n.position.distanceTo(n.standingPosition)>this.aerialObserverMinHeight;if(r)e.position.copy(n.position).applyMatrix4(n.work.transform),e.scale.setScalar(18);else{e.position.copy(n.standingPosition).applyMatrix4(n.work.transform);let t=this.adjustPanoCircleMeshPositionFix.get(n.panoId);t&&(e_.set(t.x,t.y,t.z),e_.equals(e.position)&&(e.position.y+=t.w)),e.scale.setScalar(1.2)}let i=this.camera.position.clone().setY(e.position.y),a=new c.Vector3().copy(e.position).sub(i).normalize();if(t===Z(this.currentPano)){let t=U((.5-i.distanceTo(e.position))/.5,0,1);a.multiplyScalar(1-t).add(f.clone().multiplyScalar(t))}if(a.length()>0){let t=r?-Math.PI/2:0,n=Math.atan2(a.x,a.z);e.quaternion.setFromEuler(new c.Euler(t,n,0,`YXZ`))}}else e.visible=!1}),this.camera.pose.distance>.1||x)this.panoMeshes.forEach(n=>{n.setOpacity(0),n.setCurrent(!1),n.updateTime&&n.updateTime(e,t),n.visible=!1});else if(S){let n=S.work.observers,[,r]=Hl(S.accessibleNodes,e=>{let t=n[e];return!t||!t.active?1/0:S.standingPosition.distanceTo(t.standingPosition)},!0);r=U(r,3,1/0);let i=S.accessibleNodes.concat(S.panoIndex).map(e=>Z({panoIndex:e,workCode:S.work.workCode}));this.panoMeshes.forEach((n,a)=>{let o=this.works.getObserver(a),s=!1,c=1;if(i.indexOf(a)===-1)s=!1,c=0;else if(!o)s=!1,c=0;else if(!o.loadable&&!o.active)s=!1,c=0;else{let e=n.position.clone().project(this.camera);s=Math.abs(e.x)<1&&Math.abs(e.y)<1&&Math.abs(e.z)<1&&!n.loading&&n.progress===0&&C!==null&&Z({panoIndex:C.panoIndex,workCode:C.work.workCode})===a;let t=n.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);c=t<.01?0:U(r/t,.1,.85)}o&&o===T&&o.position.distanceTo(o.standingPosition)>this.aerialObserverMinHeight&&n.position.distanceTo(this.camera.position)<35&&(c=0),this.modelScene.parameter.resolveValue(`modelAlpha`)>0&&(c=0),n.setCurrent(s),n.setOpacity(c),n.updateTime&&n.updateTime(e,t)})}{let e=(a=this.modelScene.parameter.progress)==null?1:a,t=Math.round(e),n=this.modelScene.parameter.pano0,r=this.modelScene.parameter.pano1,i=t===0?n:r,s;if(i&&(s=this.works.getObserver(i.panoId),s||(s=this.panoPictureObserverMap.get(i))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(di()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!s||!i||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new c.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=ni(i.mapSize),a=e+1,l=new c.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),u=Math.floor(this.tileLevelForFov(this.camera.fov,l)),d=u>e?u:0;this.tiling.setObserver(s);let f={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:i.map,panoMatrix:i.matrix,panoZoom:i.zoom,minLevel:a,level:d},p=this.tiling.update(f),m={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:t,opacity:(n==null?void 0:n.panoId)===(r==null?void 0:r.panoId)?1:Xu(Math.abs(((o=this.modelScene.parameter.progress)==null?0:o)-.5)*2)},h=this.modelScene.parameter.refinedScreen;(p||m.pano!==(h==null?void 0:h.pano)||m.opacity!==(h==null?void 0:h.opacity))&&this.modelScene.parameter.set(`refinedScreen`,m)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),S&&S.images.video&&(this.needsRender=!0),this.intersectMesh&&this.intersectMesh.parent&&S&&S.position.y-S.standingPosition.y>10){let e=U(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1);{let e=v.effect,{pano0:t,pano1:n}=this.modelScene.parameter;if(t&&n&&t!==n&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((s=this.modelScene.parameter.pano0Depth)==null?void 0:s.panoId)!==t.panoId||((l=this.modelScene.parameter.pano1Depth)==null?void 0:l.panoId)!==n.panoId){this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new c.WebGLCubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new c.WebGLCubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1});let e=new c.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);e.matrix.copy(t.matrix),e.matrixWorld.copy(e.matrix),e.matrixAutoUpdate=!1,Zg(this.renderer,this.modelScene,e,500);let r=new c.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);r.matrix.copy(n.matrix),r.matrixWorld.copy(r.matrix),r.matrixAutoUpdate=!1,Zg(this.renderer,this.modelScene,r,500),this.modelScene.parameter.set({pano0Depth:{panoId:t.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:500},pano1Depth:{panoId:n.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:500}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(H())[1],t=this.locationMotion.getKeyFrameSegment(H())[1],n=this.panoResourceFromLocationMotionKeyframe(t),r=this.works.getObserver(n.panoId);return{workCode:r?r.work.workCode:this.currentPano.workCode,panoIndex:r?r.panoIndex:this.currentPano.panoIndex,mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:r?r.position.clone().applyMatrix4(r.work.transform):this.camera.position.clone(),distance:this.locationMotion.value.distance}}moveToPano(e,t,n){var r,i,a;let o=(r=t.effect)==null?`fly`:r;this.userAction=n,this.stopMomentumMovement();let s=Z(e),l=this.works.getObserver(e);if(!l)throw Error(`Invalid PanoId ${JSON.stringify(e)}`);let u=$r(l.images.up),d=this.imageOptions.size;d===void 0&&l&&u&&(d=Number(u)),d===void 0&&(d=2048);let f=this.imageOptions.transform,p=Object.assign({key:`pano.${s}`},vr(this.imageOptions,[`format`,`size`,`quality`,`sharpen`,`forceUseExifOrientation`,`mappings`])),m={right:l.images.work.getURL(l.images.right),left:l.images.work.getURL(l.images.left),up:l.images.work.getURL(l.images.up),down:l.images.work.getURL(l.images.down),front:l.images.work.getURL(l.images.front),back:l.images.work.getURL(l.images.back)},h=`pano:`+_p([m,p,f]);if(this.pendingPanoTask){if(this.pendingPanoTask.hash===h)return;{let e=this.pendingPanoTask.panoId;(i=this.panoMeshes.get(e))==null||i.setProgress(0),this.emit(`pano.texture.abort`,Q(`pano.texture.abort`,{error:null,progress:0,meta:null,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode}}))}}let g=`move-to-pano-`+s;this.pending.add(g);let _=Ah(`pano.prepare`,{prevPano:this.currentPano,pano:e});if(this.emit(`pano.prepare`,_),_.defaultPrevented){this.pending.delete(g);return}let v=this.modelScene.parameter,y;if(v.pano0&&v.pano0.map.name===h?y=v.pano0:v.pano1&&v.pano1.map.name===h&&(y=v.pano1),y){let n={panoId:s,effect:o,effectEasing:(a=t.effectEasing)==null?Qg:a,panoPicture:{panoId:y.panoId,map:y.map,mapHistogram:y.mapHistogram,mapSize:y.mapSize,matrix:l.matrix.clone().premultiply(l.work.transform),zoom:1},position:l.position.clone().applyMatrix4(l.work.transform),fixCameraTransform:new c.Matrix4};n.panoPicture&&this.panoPictureObserverMap.set(n.panoPicture,l),this.pendingPanoTask=void 0,Promise.resolve().then(()=>jh(_)).catch(e=>Qh(e)).then(r=>{var i,a;if(!(r instanceof Error))this.pending.delete(g),this.pendingPanoTask=void 0,(i=this.panoMeshes.get(s))==null||i.setProgress(0),this.doMoveToPano(e,n,t);else{let e=null;r instanceof Error&&(e||(e=r));let n=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{error:e,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),t.moveCancelCallback&&t.moveCancelCallback(),this.emit(`pano.error`,Q(`pano.error`,{error:e,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),e instanceof Error&&e.message&&this.emit(`error`,e),this.pending.delete(g),this.pendingPanoTask=void 0,(a=this.panoMeshes.get(s))==null||a.setProgress(0)}});return}let b=this.panoMeshes.get(s);b&&b.tap&&b.tap(),this.pendingPanoTask={panoId:s,hash:h,onLoad:n=>{var r,i;let a=n.body;if(this.destroyed)a.dispose();else{a.name=h;let n=Array.isArray(a.image)?a.image[0]:a.image,u=(r=n==null?void 0:n.width)==null?2048:r,d=l.images.histogram;d||(d=new bm().formPixels(Kh(this.renderer,a,!0,gm).data),l.images.histogram=d);let f={panoId:s,effect:o,effectEasing:(i=t.effectEasing)==null?Qg:i,panoPicture:{panoId:s,map:a,mapSize:u,mapHistogram:new c.Vector4().fromArray(d.toArray()),matrix:l.matrix.clone().premultiply(l.work.transform),zoom:1},position:l.position.clone().applyMatrix4(l.work.transform),fixCameraTransform:new c.Matrix4};f.panoPicture&&this.panoPictureObserverMap.set(f.panoPicture,l),this.doMoveToPano(e,f,t)}},onError:e=>{let n=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{error:e,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),t.moveCancelCallback&&t.moveCancelCallback(),this.emit(`pano.error`,Q(`pano.error`,{error:e,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),e instanceof Error&&e.message&&this.emit(`error`,e)}},Promise.all([Promise.resolve().then(()=>{this.emit(`pano.texture.load`,Q(`pano.texture.load`,{error:null,progress:0,meta:null,pano:e}))}).then(()=>this.textureLoader.loadCubeTexture(m,{imageURL:{transform:f,options:p},format:c.RGBFormat,viaAjax:!0,fetcher:Ef(this.fiveId,l.work)},void 0,void 0,t=>{var n,r;this.emit(`pano.texture.progress`,Q(`pano.texture.progress`,{error:null,progress:t,meta:null,pano:e})),((n=this.pendingPanoTask)==null?void 0:n.hash)===h&&((r=this.panoMeshes.get(s))==null||r.setProgress(t))},this.renderer)).catch(t=>{let n=Qh(t);return this.emit(`pano.texture.error`,Q(`pano.texture.error`,{error:n,progress:0,meta:null,pano:e})),n}),Promise.resolve().then(()=>jh(_)).catch(e=>Qh(e))]).then(([t,n])=>{var r,i,a,o;if(!(t instanceof Error)&&!(n instanceof Error))this.pending.delete(g),((r=this.pendingPanoTask)==null?void 0:r.hash)===h?(this.pendingPanoTask.onLoad(t),this.pendingPanoTask=void 0,(i=this.panoMeshes.get(s))==null||i.setProgress(0)):t.body.dispose(),this.emit(`pano.texture.success`,Q(`pano.texture.success`,{error:null,progress:1,meta:t.meta,pano:e}));else{let e=null;t instanceof Error?e||(e=t):t.body.dispose(),n instanceof Error&&(e||(e=n)),this.pending.delete(g),((a=this.pendingPanoTask)==null?void 0:a.hash)===h&&(this.pendingPanoTask.onError(e),this.pendingPanoTask=void 0,(o=this.panoMeshes.get(s))==null||o.setProgress(0))}})}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{duration:n,effect:r,userAction:i}=this.initial;this.userAction=i;let a=e.initAnimationEndState(this),o={workCode:a.workCode,panoIndex:a.panoIndex},s=!1;this.moveToPano(o,{longitude:a.longitude,latitude:a.latitude,fov:a.fov,effect:r,duration:n,moveStartCallback:e=>{s=!0,this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:e,userAction:this.userAction}))},moveEndCallback:e=>{this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:e,userAction:this.userAction})),this.initAnimationed=!0,t()},moveCancelCallback:()=>{let e=Object.assign(Object.assign(Object.assign({},o),{mode:this.mode}),$(this.camera.pose));s===!1&&this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:e,userAction:this.userAction})),this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:e,userAction:this.userAction})),this.initAnimationed=!0,t()}},i)})}panoResourceFromLocationMotionKeyframe(e){return this.panoResources[e.key]}locationMotionKeyframesLength(e){let t=0;for(let n=1;n<e.length;n++){let r=this.panoResourceFromLocationMotionKeyframe(e[n-1]).position,i=this.panoResourceFromLocationMotionKeyframe(e[n]).position,a=r.distanceTo(i)*(e[n].value.count-e[n-1].value.count);t+=a}return t}doMoveToPano(e,t,n={}){var r,i,a,o,s,l,u,d,f,p,m;let h=H(),g=rn();this.panoResources[g]=t;let _,v,y;if(this.locationMotion.ended){let[e,n]=this.locationMotion.getKeyFrameSegment(h),i=this.locationMotion.value,a=((r=this.panoResourceFromLocationMotionKeyframe(n))==null?this.camera:r).position,o=t.position;_=Math.max(a.distanceTo(o),1),v=[{key:n.key,progress:0,value:Object.assign(Object.assign({},i),{count:0})},{key:g,progress:1,value:{distance:0,count:1}}],y=0}else{let[e,n]=this.locationMotion.getKeyFrameSegment(h),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(e).position,a=this.panoResourceFromLocationMotionKeyframe(n).position,o=t.position,s=n.value.count-r.count,c=Math.max(i.distanceTo(a),1)*s;_=c+Math.max(a.distanceTo(o),1),v=[{key:e.key,progress:0,value:Object.assign({},r)},{key:n.key,progress:c/_,value:n.value},{key:g,progress:1,value:{count:n.value.count+1,distance:0}}];let l=this.locationMotionKeyframesLength(this.locationMotion.keyframes),u=this.locationMotionKeyframesLength(v);y=l===0||l===0?0:this.locationMotion.getProgressVelocity(h)*l/u}let b=t.effect===`instant`?0:this.calculateMovingDuration(n.duration,t.effect===`fly`||t.effect===`model`?_:0),x={longitude:n.longitude,latitude:n.latitude,fov:n.fov},S=Object.assign(Object.assign({},e),{mode:this.mode,longitude:(i=x.longitude)==null?this.camera.pose.longitude:i,latitude:(a=x.latitude)==null?this.camera.pose.latitude:a,fov:(o=x.fov)==null?this.camera.pose.fov:o,offset:t.position.clone(),distance:this.camera.pose.distance}),C=this.currentPano;if(this.emit(`pano.moveTo`,Q(`pano.moveTo`,{options:n,prevPano:C,pano:{panoIndex:S.panoIndex,workCode:S.workCode},progress:0,state:S,userAction:this.userAction,error:null})),n.moveStartCallback&&n.moveStartCallback(S),this.perspToOrthoMotion.set({perspToOrtho:0},b).catch(K),this.modelAlphaMotion.setKeyframes([{progress:0,value:Object.assign({},this.modelAlphaMotion.value)},{progress:.6,value:Object.assign({},this.modelAlphaMotion.value)},{progress:1,value:{modelAlpha:0}}],b).catch(K),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute(`src`)&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute(`uuid`),this.videoTexture.image.removeAttribute(`src`),this.videoTexture.image.oncanplay=K,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),t.effect===`fly`||t.effect===`model`)this.cameraMotion.set(x,b).catch(K);else{let e=Ht({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),n=Ht({longitude:(s=x.longitude)==null?this.cameraMotion.value.longitude:s,latitude:(l=x.latitude)==null?this.cameraMotion.value.latitude:l}),r=new c.Object3D;r.lookAt(e);let i=new c.Matrix4().makeRotationFromQuaternion(r.quaternion);r.lookAt(n);let a=new c.Matrix4().makeRotationFromQuaternion(r.quaternion),o=new c.Matrix4().getInverse(i).premultiply(a),h=this.cameraMotion.value.fov,g=(u=x.fov)==null?this.cameraMotion.value.fov:u,_=1;t.effect===`zoomin`?_=1.5:t.effect===`zoomout`&&(_=.4);let y=U(g*_,1,170);for(let e=0;e<v.length-1;e++){let t=v[e].key;if(t){let e=this.panoResources[t];e&&(e.fixCameraTransform.copy(o),e.panoPicture&&(e.panoPicture.zoom=Math.tan(y/2/180*Math.PI)/Math.tan(h/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(d=x.longitude)==null?this.cameraMotion.value.longitude:d,latitude:(f=x.latitude)==null?this.cameraMotion.value.latitude:f,fov:y}},{progress:1,value:{longitude:(p=x.longitude)==null?this.cameraMotion.value.longitude:p,latitude:(m=x.latitude)==null?this.cameraMotion.value.latitude:m,fov:g}}],b).catch(K)}this.locationMotion.setKeyframes(v,b,y).then(()=>{for(let e of this.modelScene.children)e instanceof Gf&&e.show();let t=Object.assign(Object.assign({},e),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance});this.emit(`pano.arrived`,Q(`pano.arrived`,{options:n,prevPano:C,pano:{panoIndex:t.panoIndex,workCode:t.workCode},progress:1,state:t,userAction:this.userAction,error:null})),n.moveEndCallback&&n.moveEndCallback(t);let r=this.works.getObserver(e);if(r&&r.images.video&&this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement){let e={map:this.videoTexture,size:r.images.video.size.clone(),matrix:r.images.video.matrix.clone(),panoMatrix:r.matrix.clone().premultiply(r.work.transform),alpha:1},t=rn(),n=this.videoTexture.image;n.setAttribute(`uuid`,t),n.oncanplay=K,n.ontimeupdate=K,lg().then(i=>{i&&r.images.video&&n.getAttribute(`uuid`)===t&&(n.oncanplay=()=>{n.oncanplay=K,n.play()},n.ontimeupdate=()=>{n.currentTime>.5&&(n.ontimeupdate=K,this.panoVideo.setMaterial(e))},n.src=r.images.video.source)}).catch((()=>{n.removeAttribute(`uuid`)}))}else{let e=this.videoTexture.image;e.removeAttribute(`uuid`),e.oncanplay=K,e.ontimeupdate=K}},()=>{let e=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{options:n,prevPano:C,pano:{panoIndex:e.panoIndex,workCode:e.workCode},progress:0,state:e,userAction:this.userAction,error:null})),n.moveCancelCallback&&n.moveCancelCallback()})}getForwardObserverOrNot(e,t){let n=this.works.getObserver(this.currentPano);if(!n)return null;let r=t==null?new c.Raycaster(e.position.clone(),e.getWorldDirection(new c.Vector3)):t;r.params.Points={threshold:.1},r.firstHitOnly=!0,r.floorIndex=-1;let i=n.standingPosition.clone().applyMatrix4(n.work.transform);if(n.position.clone().applyMatrix4(n.work.transform).distanceTo(r.ray.origin)>1){let e=new c.Raycaster(r.ray.origin,new c.Vector3(0,-1,0));e.firstHitOnly=r.firstHitOnly,e.floorIndex=r.floorIndex;let[t]=this.modelScene.intersectRaycaster(e);t&&t.distance<=2?i.copy(t.point):i.copy(r.ray.origin).add(new c.Vector3(0,-1.5,0))}let[a]=this.modelScene.intersectRaycaster(r),o=(a?a.point:r.ray.origin.clone().add(r.ray.direction.clone().normalize().multiplyScalar(3))).clone().sub(i).normalize();if(o.length()===0)return null;let s=n.work.observers,l=n.accessibleNodes.filter(t=>{if(t===this.currentPano.panoIndex&&n.work.workCode===this.currentPano.workCode)return!1;let r=s[t];if(!r)return!1;let i=r.standingPosition.clone().applyMatrix4(r.work.transform).project(e);return Math.abs(i.z)>1||Math.abs(i.x)>1||Math.abs(i.y)>1?!1:r.loadable||r.active}),u=new Map,d=l.slice().sort((e,t)=>{let n=s[e],r=u.get(n);r===void 0&&(r=e_.copy(n.standingPosition).applyMatrix4(n.work.transform).distanceTo(i),u.set(n,r));let a=s[t],o=u.get(a);return o===void 0&&(o=e_.copy(a.standingPosition).applyMatrix4(a.work.transform).distanceTo(i),u.set(a,o)),r-o});u.clear();for(let e of[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3])for(let t of d){let n=s[t];if(n){let t=e_.copy(n.standingPosition).applyMatrix4(n.work.transform).sub(i);if(t&&t.length()!==0&&o.angleTo(t)<e)return n}}let f=null;if(t){let n=t.ray.intersectBox(this.modelScene.boundingBox,e_);n&&(n.project(e),Math.abs(n.z)<=1&&(f=n.clone()))}else f=new c.Vector3(0,0,0);if(f){let t=n.accessibleNodes.filter(t=>{if(t===this.currentPano.panoIndex&&n.work.workCode===this.currentPano.workCode)return!1;let r=s[t];if(!r)return!1;let i=r.position.clone().applyMatrix4(r.work.transform).project(e);return Math.abs(i.z)>1||Math.abs(i.x)>1||Math.abs(i.y)>1?!1:r.loadable||r.active}),r=new Map,i=t.slice().sort((t,n)=>{let i=s[t],a=r.get(i);a===void 0&&(a=e_.copy(i.position).applyMatrix4(i.work.transform).distanceTo(e.position),r.set(i,a));let o=s[n],c=r.get(o);return c===void 0&&(c=e_.copy(o.position).applyMatrix4(o.work.transform).distanceTo(e.position),r.set(o,c)),a-c});r.clear();for(let t of i){let n=s[t];if(n){let t=e_.copy(n.position).applyMatrix4(n.work.transform);if(t.project(e),Math.abs(t.z)>1)continue;if(Math.pow(f.x-t.x,2)+Math.pow(f.y-t.y,2)<Math.pow(.4,2))return n}}}return null}onTapGesture(e){var t;if(this.userAction=e.userAction,this.stopMomentumMovement(),!this.initAnimationed)return;let n=e.center.raycaster;n.floorIndex=-1;let r=this.camera.getDirection(new c.Vector3).setY(0),i=null,a=this.works.getObserver(this.currentPano);if(!a)return;let o=a.work.observers,s=a.accessibleNodes.filter(e=>{if(e===this.currentPano.panoIndex&&a.work.workCode===this.currentPano.workCode)return!1;let t=o[e];return!t||e_.copy(t.position).applyMatrix4(t.work.transform).distanceTo(this.camera.position)>this.maxAccessibleDistance?!1:t.loadable||t.active}),[l]=this.modelScene.intersectRaycaster(n);if(l){let[e,n]=Hl(s,e=>{let t=o[e];return t?e_.copy(t.standingPosition).applyMatrix4(t.work.transform).distanceTo(l.point):1/0},!0);typeof e==`number`&&n<this.panoTapTriggerRadius&&(i=(t=o[e])==null?null:t)}if(i||(i=this.getForwardObserverOrNot(this.camera,n)),i&&i.panoId===Z(this.currentPano)&&(i=null),i&&!this.locationMotion.ended){for(let e of this.locationMotion.keyframes)if(this.panoResourceFromLocationMotionKeyframe(e).panoId===i.panoId){i=null;break}}if(!i)this.emit(`gesture.tap`,e),e.defaultPrevented||this.locationMotion.ended===!0&&this.cameraBounce();else{let t={},n=Math.PI/6,o=Math.PI/12,s=i.position.clone().applyMatrix4(i.work.transform).setY(0).sub(a.position.clone().applyMatrix4(i.work.transform).setY(0)).normalize(),c=[],l=[],u=[],d=i.work.observers;for(let e of i.accessibleNodes){if(i.panoIndex===e||e===this.currentPano.panoIndex&&i.work.workCode===this.currentPano.workCode)continue;let t=d[e];if(!t)continue;let r=t.position.clone().applyMatrix4(t.work.transform).sub(i.position.clone().applyMatrix4(i.work.transform)).setY(0).normalize();s.angleTo(r)<n&&u.push(r)}let[f]=(u.length>0?u:[...c,...l]).slice().sort((e,t)=>e.angleTo(s)-t.angleTo(s));if(f&&f.angleTo(r)>o&&(t.longitude=Math.atan2(-f.x,-f.z)),this.cameraMotion.value.latitude<-Math.PI/4){let n=e.state.fov;t.latitude=U(0,U(typeof this.minLatitude==`function`?this.minLatitude(n):this.minLatitude,-Math.PI/2,Math.PI/2),U(typeof this.maxLatitude==`function`?this.maxLatitude(n):this.maxLatitude,-Math.PI/2,Math.PI/2))}let p=Object.assign({},e.state);if(p.workCode=i.work.workCode,p.panoIndex=i.panoIndex,t.longitude!==void 0&&(p.longitude=t.longitude),t.latitude!==void 0&&(p.latitude=t.latitude),t.fov!==void 0&&(p.fov=t.fov),p.distance=0,p.offset=i.position.clone(),e.state=p,this.emit(`gesture.tap`,e),!e.defaultPrevented){if(this.emit(`pano.select`,Q(`pano.select`,{prevPano:this.currentPano,pano:{panoIndex:p.panoIndex,workCode:p.workCode},state:p,userAction:e.userAction,options:t,progress:0,error:null})),i&&!i.active){let e=Z({panoIndex:i.panoIndex,workCode:i.work.workCode}),t=this.panoMeshes.get(e);t&&(t.setDisabled(!1),t.setLoading(!0))}i&&i.active&&this.emit(`pano.request`,Q(`pano.request`,{userAction:e.userAction,prevPano:this.currentPano,pano:{panoIndex:p.panoIndex,workCode:p.workCode},progress:0,state:p,options:t,error:null}))}}}},i_=Math.PI/180,a_=180/Math.PI,o_=.001,s_=1,c_=(()=>{let e=typeof navigator<`u`&&/iPad|iPhone|iPod/.test(navigator.platform);return()=>e})(),l_=(()=>{let e=typeof navigator<`u`&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return()=>e})(),u_=(()=>{let e=typeof navigator<`u`&&navigator.userAgent.indexOf(`Firefox`)!==-1&&navigator.userAgent.indexOf(`Android`)!==-1;return()=>e})(),d_=(()=>{let e=typeof navigator<`u`?navigator.userAgent.match(/.*Chrome\/([0-9]+)/):null,t=e?parseInt(e[1],10):null;return()=>t})(),f_=(()=>{let e=!1;if(d_()===65){let t=typeof navigator<`u`?navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/):null;if(t){let[n,r,i,a]=t[1].split(`.`);e=parseInt(i,10)===3325&&parseInt(a,10)<148}}return()=>e})(),p_=(()=>{let e=c_()&&l_()&&typeof navigator<`u`&&navigator.userAgent.indexOf(`13_4`)!==-1;return()=>e})(),m_=(()=>{let e=typeof navigator<`u`&&navigator.userAgent.indexOf(`R7 Build`)!==-1;return()=>e})();function h_(){let e=typeof window<`u`&&(window.orientation==90||window.orientation==-90);return m_()?!e:e}function g_(e){return!(isNaN(e)||e<=o_||e>s_)}function __(e){return e.w>1?0:2*Math.acos(e.w)}var v_=(()=>{let e={};return(t,n)=>{e[t]===void 0&&(console.warn(`cardboard: `+n),e[t]=!0)}})();function y_(e){let t,n=e.indexOf(`://`);t=n===-1?0:n+3;let r=e.indexOf(`/`,t);return r===-1&&(r=e.length),e.substring(0,r)}function b_(){if(typeof window>`u`||typeof document>`u`)return!1;let e=window.self!==window.top,t=y_(document.referrer),n=y_(window.location.href);return e&&t!==n}var x_=(()=>{function e(e,t,n){let r=t?t[0]:0,i=t?t[1]:0,a=t?t[2]:0,o=t?t[3]:1,s=r+r,c=i+i,l=a+a,u=r*s,d=r*c,f=r*l,p=i*c,m=i*l,h=a*l,g=o*s,_=o*c,v=o*l;return e[0]=1-(p+h),e[1]=d+v,e[2]=f-_,e[3]=0,e[4]=d-v,e[5]=1-(u+h),e[6]=m+g,e[7]=0,e[8]=f+_,e[9]=m-g,e[10]=1-(u+p),e[11]=0,e[12]=n?n[0]:0,e[13]=n?n[1]:0,e[14]=n?n[2]:0,e[15]=1,e}function t(e,t,n){let r=n[0],i=n[1],a=n[2],o,s,c,l,u,d,f,p,m,h,g,_;return t===e?(e[12]=t[0]*r+t[4]*i+t[8]*a+t[12],e[13]=t[1]*r+t[5]*i+t[9]*a+t[13],e[14]=t[2]*r+t[6]*i+t[10]*a+t[14],e[15]=t[3]*r+t[7]*i+t[11]*a+t[15]):(o=t[0],s=t[1],c=t[2],l=t[3],u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],_=t[11],e[0]=o,e[1]=s,e[2]=c,e[3]=l,e[4]=u,e[5]=d,e[6]=f,e[7]=p,e[8]=m,e[9]=h,e[10]=g,e[11]=_,e[12]=o*r+u*i+m*a+t[12],e[13]=s*r+d*i+h*a+t[13],e[14]=c*r+f*i+g*a+t[14],e[15]=l*r+p*i+_*a+t[15]),e}function n(e,t){let n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=n*s-r*o,y=n*c-i*o,b=n*l-a*o,x=r*c-i*s,S=r*l-a*s,C=i*l-a*c,w=u*h-d*m,T=u*g-f*m,E=u*_-p*m,D=d*g-f*h,O=d*_-p*h,k=f*_-p*g,A=v*k-y*O+b*D+x*E-S*T+C*w;return A?(A=1/A,e[0]=(s*k-c*O+l*D)*A,e[1]=(i*O-r*k-a*D)*A,e[2]=(h*C-g*S+_*x)*A,e[3]=(f*S-d*C-p*x)*A,e[4]=(c*E-o*k-l*T)*A,e[5]=(n*k-i*E+a*T)*A,e[6]=(g*b-m*C-_*y)*A,e[7]=(u*C-f*b+p*y)*A,e[8]=(o*O-s*E+l*w)*A,e[9]=(r*E-n*O-a*w)*A,e[10]=(m*S-h*b+_*v)*A,e[11]=(d*b-u*S-p*v)*A,e[12]=(s*T-o*D-c*w)*A,e[13]=(n*D-r*T+i*w)*A,e[14]=(h*y-m*x-g*v)*A,e[15]=(u*x-d*y+f*v)*A,e):null}return(r,i,a)=>{e(r,i),a&&t(r,r,a),n(r,r)}})(),S_=class{constructor(e=new c.Vector3,t=0){this.sample=e,this.timestampS=t}set(e,t){this.sample=e,this.timestampS=t}copy(e){this.set(e.sample,e.timestampS)}},C_=class{constructor(e,t){this.kFilter=e,this.isDebug=t,this.currentAccelMeasurement=new S_,this.currentGyroMeasurement=new S_,this.previousGyroMeasurement=new S_,c_()?this.filterQ=new c.Quaternion(-1,0,0,1):this.filterQ=new c.Quaternion(1,0,0,1),this.previousFilterQ=new c.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new c.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new c.Vector3,this.measuredGravity=new c.Vector3,this.gyroIntegralQ=new c.Quaternion}addAccelMeasurement(e,t){this.currentAccelMeasurement.set(e,t)}addGyroMeasurement(e,t){this.currentGyroMeasurement.set(e,t),g_(t-this.previousGyroMeasurement.timestampS)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)}getOrientation(){return this.filterQ}run_(){if(!this.isOrientationInitialized){this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),this.isOrientationInitialized=!0;return}let e=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,t=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,e);this.gyroIntegralQ.multiply(t),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(t);let n=new c.Quaternion;n.copy(this.filterQ),n.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(n),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();let r=new c.Quaternion;r.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),r.inverse(),this.isDebug&&console.log(`Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)`,a_*__(r),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));let i=new c.Quaternion;i.copy(this.filterQ),i.multiply(r),this.filterQ.slerp(i,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)}accelToQuaternion_(e){let t=new c.Vector3;t.copy(e),t.normalize();let n=new c.Quaternion;return n.setFromUnitVectors(new c.Vector3(0,0,-1),t),n.inverse(),n}gyroToQuaternionDelta_(e,t){let n=new c.Quaternion,r=new c.Vector3;return r.copy(e),r.normalize(),n.setFromAxisAngle(r,e.length()*t),n}},w_=class{constructor(e,t){this.predictionTimeS=e,this.isDebug=t,this.previousQ=new c.Quaternion,this.previousTimestampS=null,this.deltaQ=new c.Quaternion,this.outQ=new c.Quaternion}getPrediction(e,t,n){if(!this.previousTimestampS)return this.previousQ.copy(e),this.previousTimestampS=n,e;let r=new c.Vector3;r.copy(t),r.normalize();let i=t.length();if(i<i_*20)return this.isDebug&&console.log(`Moving slowly, at %s deg/s: no prediction`,(a_*i).toFixed(1)),this.outQ.copy(e),this.previousQ.copy(e),this.outQ;let a=i*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(r,a),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(e),this.previousTimestampS=n,this.outQ}},T_=class{constructor(e){this.coefficients=e}distortInverse(e){let t=0,n=1,r=e-this.distort(t);for(;Math.abs(n-t)>1e-4;){let i=e-this.distort(n),a=n-i*((n-t)/(i-r));t=n,n=a,r=i}return n}distort(e){let t=e*e,n=0;for(let e=0;e<this.coefficients.length;e++)n=t*(n+this.coefficients[e]);return(n+1)*e}},E_=class{constructor(){this.angularAcceleration=null,this.angularVelocity=null,this.linearAcceleration=null,this.linearVelocity=null,this.orientation=null,this.position=null}},D_=class{constructor(){this.leftDegrees=0,this.rightDegrees=0,this.upDegrees=0,this.downDegrees=0}},O_=class{constructor(e,t,n,r){this.viewer={id:`CardboardV1`,label:`Cardboard I/O 2014`,fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]},this.device={widthMeters:.11,heightMeters:.062,bevelMeters:.004},this.depthNear=.01,this.depthFar=1e4,this.yawOnly=n,this.accelerometer=new c.Vector3,this.gyroscope=new c.Vector3,this.filter=new C_(e,r),this.posePredictor=new w_(t,r),this.isFirefoxAndroid=u_(),this.isIOS=c_();let i=d_();this.isDeviceMotionInRadians=!this.isIOS&&i!==null&&i<66,this.isWithoutDeviceMotion=f_()||p_(),this.filterToWorldQ=new c.Quaternion,c_()?this.filterToWorldQ.setFromAxisAngle(new c.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new c.Vector3(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new c.Quaternion,this.worldToScreenQ=new c.Quaternion,this.originalPoseAdjustQ=new c.Quaternion;let a=typeof window<`u`?-window.orientation*Math.PI/180:0;this.originalPoseAdjustQ.setFromAxisAngle(new c.Vector3(0,0,1),a),this.setScreenTransform_(),h_()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new c.Quaternion,this.orientationOut_=new Float32Array(4),this.previousTimestampS=Date.now()}getPosition(){return null}getOrientation(){let e;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||(function(){let e=new c.Quaternion().setFromAxisAngle(new c.Vector3(0,0,-1),0),t=new c.Quaternion;return typeof window<`u`&&window.orientation===-90?t.setFromAxisAngle(new c.Vector3(0,1,0),Math.PI/-2):t.setFromAxisAngle(new c.Vector3(0,1,0),Math.PI/2),e.multiply(t)})(),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||(function(){let e=new c.Quaternion;return e.setFromAxisAngle(new c.Vector3(1,0,0),-Math.PI/2),e})(),e=this._deviceOrientationQ;let t=new c.Quaternion;return t.copy(e),t.multiply(this.deviceOrientationFilterToWorldQ),t.multiply(this.resetQ),t.multiply(this.worldToScreenQ),t.multiplyQuaternions(this.deviceOrientationFixQ,t),this.yawOnly&&(t.x=0,t.z=0,t.normalize()),this.orientationOut_[0]=t.x,this.orientationOut_[1]=t.y,this.orientationOut_[2]=t.z,this.orientationOut_[3]=t.w,this.orientationOut_}else{let t=this.filter.getOrientation();e=this.posePredictor.getPrediction(t,this.gyroscope,this.previousTimestampS)}let t=new c.Quaternion;return t.copy(this.filterToWorldQ),t.multiply(this.resetQ),t.multiply(e),t.multiply(this.worldToScreenQ),this.yawOnly&&(t.x=0,t.z=0,t.normalize()),this.orientationOut_[0]=t.x,this.orientationOut_[1]=t.y,this.orientationOut_[2]=t.z,this.orientationOut_[3]=t.w,this.orientationOut_}getPose(){let e=new E_;return e.orientation=this.getOrientation(),e}resetPose(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),h_()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)}getFrameData(e){let t=this.getOrientation(),n=this.getEyeOffset(),r=this.getEyeProjectionMatrix();return e.pose.angularAcceleration=null,e.pose.angularVelocity=null,e.pose.linearAcceleration=null,e.pose.linearVelocity=null,e.pose.orientation=t,e.pose.position=null,e.timestamp=this.previousTimestampS,e.leftProjectionMatrix.set(r.left),e.rightProjectionMatrix.set(r.right),x_(e.leftViewMatrix,t,n.left),x_(e.rightViewMatrix,t,n.right),e}start(){if(typeof window>`u`)return()=>{};let e=this.onDeviceMotion_.bind(this),t=this.onOrientationChange_.bind(this),n=this.onMessage_.bind(this),r=this.onDeviceOrientation_.bind(this);return c_()&&b_()&&window.addEventListener(`message`,n),window.addEventListener(`orientationchange`,t),this.isWithoutDeviceMotion?window.addEventListener(`deviceorientation`,r):window.addEventListener(`devicemotion`,e),()=>{window.removeEventListener(`devicemotion`,e),window.removeEventListener(`deviceorientation`,t),window.removeEventListener(`orientationchange`,t),window.removeEventListener(`message`,n)}}getEyeOffset(){return{left:[-this.viewer.interLensDistance*.5,0,0],right:[this.viewer.interLensDistance*.5,0,0]}}getEyeProjectionMatrix(){let e=this.getEyeFieldOfView(),t=this.depthNear,n=this.depthFar,r={left:[],right:[]};{let i=e.left.upDegrees*i_,a=e.left.downDegrees*i_,o=e.left.leftDegrees*i_,s=e.left.rightDegrees*i_,c=2/(o+s),l=2/(i+a);r.left[0]=c,r.left[1]=0,r.left[2]=0,r.left[3]=0,r.left[4]=0,r.left[5]=l,r.left[6]=0,r.left[7]=0,r.left[8]=-((o-s)*c*.5),r.left[9]=(i-a)*l*.5,r.left[10]=n/(t-n),r.left[11]=-1,r.left[12]=0,r.left[13]=0,r.left[14]=n*t/(t-n),r.left[15]=0}{let i=e.right.upDegrees*i_,a=e.right.downDegrees*i_,o=e.right.leftDegrees*i_,s=e.right.rightDegrees*i_,c=2/(o+s),l=2/(i+a);r.right[0]=c,r.right[1]=0,r.right[2]=0,r.right[3]=0,r.right[4]=0,r.right[5]=l,r.right[6]=0,r.right[7]=0,r.right[8]=-((o-s)*c*.5),r.right[9]=(i-a)*l*.5,r.right[10]=n/(t-n),r.right[11]=-1,r.right[12]=0,r.right[13]=0,r.right[14]=n*t/(t-n),r.right[15]=0}return r}getEyeFieldOfView(){let e=this.viewer,t=this.device,n=new T_(e.distortionCoefficients),r=e.screenLensDistance,i=(t.widthMeters-e.interLensDistance)/2,a=e.interLensDistance/2,o=e.baselineLensDistance-t.bevelMeters,s=t.heightMeters-o,c=a_*Math.atan(n.distort(i/r)),l=a_*Math.atan(n.distort(a/r)),u=a_*Math.atan(n.distort(o/r)),d=a_*Math.atan(n.distort(s/r)),f=new D_,p=new D_;return f.leftDegrees=Math.min(c,e.fov),f.rightDegrees=Math.min(l,e.fov),f.downDegrees=Math.min(u,e.fov),f.upDegrees=Math.min(d,e.fov),p.leftDegrees=f.rightDegrees,p.rightDegrees=f.leftDegrees,p.upDegrees=f.upDegrees,p.downDegrees=f.downDegrees,{left:f,right:p}}onDeviceOrientation_(e){this._deviceOrientationQ=this._deviceOrientationQ||new c.Quaternion;let{alpha:t,beta:n,gamma:r}=e;t=(t||0)*Math.PI/180,n=(n||0)*Math.PI/180,r=(r||0)*Math.PI/180,this._deviceOrientationQ.setFromEuler(new c.Euler(t,n,-r,`YXZ`))}onDeviceMotion_(e){this.updateDeviceMotion_(e)}updateDeviceMotion_(e){let t=e.accelerationIncludingGravity,n=e.rotationRate,r=e.timeStamp/1e3,i=r-this.previousTimestampS;if(i<0){v_(`fusion-pose-sensor:invalid:non-monotonic`,`Invalid timestamps detected: non-monotonic timestamp from devicemotion`),this.previousTimestampS=r;return}else if(i<=o_||i>s_){v_(`fusion-pose-sensor:invalid:outside-threshold`,`Invalid timestamps detected: Timestamp from devicemotion outside expected range.`),this.previousTimestampS=r;return}t&&(this.accelerometer.set(-t.x,-t.y,-t.z),n&&(m_()?this.gyroscope.set(-n.beta,n.alpha,n.gamma):this.gyroscope.set(n.alpha,n.beta,n.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addGyroMeasurement(this.gyroscope,r)),this.filter.addAccelMeasurement(this.accelerometer,r)),this.previousTimestampS=r}onOrientationChange_(){this.setScreenTransform_()}onMessage_(e){let t=e.data;!t||!t.type||t.type.toLowerCase()===`devicemotion`&&this.updateDeviceMotion_(t.deviceMotionEvent)}setScreenTransform_(){switch(this.worldToScreenQ.set(0,0,0,1),typeof window<`u`?window.orientation:0){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new c.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new c.Vector3(0,0,1),Math.PI/2);break;case 180:break}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()}},k_=[0,0,.5,1],A_=[.5,0,.5,1],j_=class{constructor(e){this.renderer=e,this.sensor=new O_(.98,.04,!1,!1),this.scale=1,this.cameraL=new c.PerspectiveCamera,this.cameraR=new c.PerspectiveCamera;let t=this.sensor.start();this.dispose=()=>{let e=this.renderer.getSize(new c.Vector2);this.renderer.setScissor(0,0,e.width,e.height),this.renderer.setViewport(0,0,e.width,e.height),this.renderer.setScissorTest(!1),t()}}render(e,t){let n=this.renderer.getSize(new c.Vector2);if(n.width>n.height){var r=e.autoUpdate;r&&(e.updateMatrixWorld(),e.autoUpdate=!1);let i={x:Math.round(n.width*k_[0]),y:Math.round(n.height*k_[1]),width:Math.round(n.width*k_[2]),height:Math.round(n.height*k_[3])},a={x:Math.round(n.width*A_[0]),y:Math.round(n.height*A_[1]),width:Math.round(n.width*A_[2]),height:Math.round(n.height*A_[3])};this.renderer.setScissorTest(!0),this.renderer.autoClear&&this.renderer.clear(),t.parent===null&&t.updateMatrixWorld(),t.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),t.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale);let o=this.sensor.getEyeOffset();this.cameraL.translateOnAxis(new c.Vector3().fromArray(o.left),this.scale),this.cameraR.translateOnAxis(new c.Vector3().fromArray(o.right),this.scale);let s=this.sensor.getEyeProjectionMatrix();this.cameraL.projectionMatrix.elements=s.left.slice(),this.cameraR.projectionMatrix.elements=s.right.slice(),this.renderer.setViewport(i.x,i.y,i.width,i.height),this.renderer.setScissor(i.x,i.y,i.width,i.height),this.renderer.render(e,this.cameraL),this.renderer.setViewport(a.x,a.y,a.width,a.height),this.renderer.setScissor(a.x,a.y,a.width,a.height),this.renderer.render(e,this.cameraR),this.renderer.setViewport(0,0,n.width,n.height),this.renderer.setScissor(0,0,n.width,n.height),this.renderer.setScissorTest(!1),r&&(e.autoUpdate=!0)}else this.renderer.render(e,t)}dispose(){}},M_=`data:image/png;base64,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`,N_=`data:image/png;base64,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`,P_,F_={zh:{TITLE:`眼镜模式`,HIT:`请将手机横屏放入 VR 眼镜中`},en:{TITLE:`GLASSES MODE`,HIT:`Please put the mobile phone horizontally into the VR glasses.`},ja:{TITLE:`メガネモード`,HIT:`携帯電話をVRメガネに水平に入れてください。`}},I_=typeof navigator<`u`?(P_=F_[navigator.language.split(`-`)[0]])==null?F_.zh:P_:F_.zh,L_=`
1680
1680
  <style>
1681
1681
  .$id {
1682
1682
  all: initial;
@@ -1759,7 +1759,7 @@ void main() {
1759
1759
  .$id-modal-content-guide-cardboard-image {
1760
1760
  width: 100px;
1761
1761
  height: 82px;
1762
- background-image: url(${k_});
1762
+ background-image: url(${M_});
1763
1763
  background-size: 100%;
1764
1764
  background-repeat: no-repeat;
1765
1765
  }
@@ -1801,7 +1801,7 @@ void main() {
1801
1801
  .$id-modal-content-guide-phone-image {
1802
1802
  width: 58px;
1803
1803
  height: 56px;
1804
- background-image: url(${A_});
1804
+ background-image: url(${N_});
1805
1805
  background-size: 100%;
1806
1806
  background-repeat: no-repeat;
1807
1807
  }
@@ -1878,8 +1878,8 @@ Z
1878
1878
  </div>
1879
1879
  </div>
1880
1880
  <div class="$id-modal-content">
1881
- <div class="$id-modal-content-title">${N_.TITLE}</div>
1882
- <div class="$id-modal-content-hit">${N_.HIT}</div>
1881
+ <div class="$id-modal-content-title">${I_.TITLE}</div>
1882
+ <div class="$id-modal-content-hit">${I_.HIT}</div>
1883
1883
  <div class="$id-modal-content-guide">
1884
1884
  <div class="$id-modal-content-guide-phone">
1885
1885
  <div class="$id-modal-content-guide-phone-move-x">
@@ -1937,7 +1937,7 @@ Z
1937
1937
  </svg>
1938
1938
  </div>
1939
1939
  </div>
1940
- `;function F_(e){let t=1,n=document.getElementsByTagName(`meta`);for(let e=0;e<n.length;e++){let r=n[e];if(r.getAttribute(`name`)===`viewport`){let e=(r.getAttribute(`content`)||``).match(/initial\-scale\=([\d|\.]+)/);e&&(t=Number(e[1])),isNaN(t)&&(t=1)}}let r=e=>Math.floor(e*t)+`px`;return P_.replace(/\n/g,` `).replace(/\ +/g,` `).replace(/\$id/g,e).replace(/(\d+)px/g,(e,t)=>r(Number(t)))}function I_(){let e=`five_vr_helper_`+rn(),t=F_(e),n=document.createElement(`div`);return n.className=e,n.innerHTML=t,n}var L_=new c.CircleBufferGeometry(.12,16),R_=`
1940
+ `;function R_(e){let t=1,n=document.getElementsByTagName(`meta`);for(let e=0;e<n.length;e++){let r=n[e];if(r.getAttribute(`name`)===`viewport`){let e=(r.getAttribute(`content`)||``).match(/initial\-scale\=([\d|\.]+)/);e&&(t=Number(e[1])),isNaN(t)&&(t=1)}}let r=e=>Math.floor(e*t)+`px`;return L_.replace(/\n/g,` `).replace(/\ +/g,` `).replace(/\$id/g,e).replace(/(\d+)px/g,(e,t)=>r(Number(t)))}function z_(){let e=`five_vr_helper_`+rn(),t=R_(e),n=document.createElement(`div`);return n.className=e,n.innerHTML=t,n}var B_=new c.CircleBufferGeometry(.12,16),V_=`
1941
1941
  varying vec2 vUv;
1942
1942
  #include <common>
1943
1943
  #include <logdepthbuf_pars_vertex>
@@ -1946,7 +1946,7 @@ void main() {
1946
1946
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
1947
1947
  #include <logdepthbuf_vertex>
1948
1948
  }
1949
- `,z_=`
1949
+ `,H_=`
1950
1950
  uniform float circleScale;
1951
1951
  uniform float circleFade;
1952
1952
  uniform float circleOpacity;
@@ -2003,7 +2003,7 @@ void main() {
2003
2003
 
2004
2004
  gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity);
2005
2005
  }
2006
- `,B_=`
2006
+ `,U_=`
2007
2007
  varying vec2 vUv;
2008
2008
  #include <common>
2009
2009
  #include <logdepthbuf_pars_vertex>
@@ -2012,7 +2012,7 @@ void main() {
2012
2012
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
2013
2013
  #include <logdepthbuf_vertex>
2014
2014
  }
2015
- `,V_=`
2015
+ `,W_=`
2016
2016
  varying vec2 vUv;
2017
2017
  uniform float opacity;
2018
2018
  #include <common>
@@ -2037,7 +2037,7 @@ void main() {
2037
2037
 
2038
2038
  gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity * outside * inside);
2039
2039
  }
2040
- `,H_=class extends c.Object3D{constructor(){super(),this.progress=0,this.opacity=0,this.loading=!1,this.current=!1,this.disabled=!1,this.currentMotion=new X({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}),this.opacityMotion=new X({opacity:0}),this.loadingMotion=new X({opacity:0}),this.disableMotion=new X({opacity:0});let e={blending:c.CustomBlending,blendSrc:c.SrcAlphaFactor,blendDst:c.OneMinusSrcAlphaFactor,blendSrcAlpha:c.OneFactor,blendDstAlpha:c.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};this.hitTestMesh=new c.Mesh(L_,new c.MeshBasicMaterial(Object.assign(Object.assign({},e),{color:0,opacity:0}))),this.hitTestMesh.scale.set(1.5,1.5,1.5),this.ringMesh=new c.Mesh(L_,new c.ShaderMaterial(Object.assign(Object.assign({},e),{vertexShader:B_,fragmentShader:V_,uniforms:{opacity:{value:0}}}))),this.panoMesh=new c.Mesh(L_,new c.ShaderMaterial(Object.assign(Object.assign({},e),{vertexShader:R_,fragmentShader:z_,uniforms:{circleScale:{value:1.1},circleFade:{value:0},circleOpacity:{value:.5},loadingAngle:{value:0},loadingOpacity:{value:0},opacity:{value:0},disable:{value:0}}}))),this.add(this.hitTestMesh),this.add(this.ringMesh),this.add(this.panoMesh),this.renderOrder=1e4,this.needsRender=!0}setProgress(e){this.progress=e,this.setLoading(e>0)}setOpacity(e){this.opacity!==e&&(this.opacity=e=U(e,0,1),this.opacityMotion.set({opacity:e},30).catch(K))}setCurrent(e){if(this.current!==e){if(e)this.currentMotion.setKeyframes([{progress:0,value:{ringScale:2,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.05,value:{ringScale:1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.15,value:{ringScale:1.2,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.25,value:{ringScale:1.1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.8,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1}},{progress:.9,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:.92,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:1,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1.1}}],1500).catch(K);else{let e=[{progress:0,value:Object.assign({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}}];this.currentMotion.setKeyframes(e,200).catch(K)}this.current=e}}setLoading(e){this.loading!==e&&(e?this.loadingMotion.setKeyframes([{progress:0,value:{opacity:0}},{progress:.3,value:{opacity:0}},{progress:1,value:{opacity:.8}}],500).catch(K):this.loadingMotion.set({opacity:0},0).catch(K),this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.needsRender=!0)}setDisabled(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({opacity:e?1:0},300).catch(K),this.needsRender=!0)}tap(){return Promise.resolve()}updateTime(e,t){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);let n=this.opacityMotion.value.opacity;this.visible=n!==0;let{ringScale:r,ringOpacity:i,circleFade:a,circleOpacity:o,circleScale:s}=this.currentMotion.value;this.ringMesh.scale.set(r,1,r),this.ringMesh.material.uniforms.opacity.value=i*n,this.panoMesh.material.uniforms.opacity.value=n,this.panoMesh.material.uniforms.circleOpacity.value=o,this.panoMesh.material.uniforms.circleScale.value=s,this.panoMesh.material.uniforms.circleFade.value=a,this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingMotion.value.opacity,this.panoMesh.material.uniforms.disable.value=this.disableMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0}dispose(){this.hitTestMesh.material.dispose(),this.ringMesh.material.dispose(),this.panoMesh.material.dispose()}},U_=1500,W_=Object.assign({},yr($g,[`maxLatitude`,`minLatitude`])),G_=class e extends e_{static parseArgs(t){if(t instanceof e)return t;let n=Object.assign(Object.assign({},t),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return super.parseArgs(n)}static initAnimationEndState(e){let t=this.parseArgs(e),n=super.initAnimationEndState(t);return Object.assign(Object.assign({},n),{mode:`VRPanorama`})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`VRPanorama`,this.cardboard=new O_(this.renderer);let r=I_();this.helperElement=r;let i=new Wh(r);this.element.parentNode&&(this.element.parentNode.insertBefore(r,this.element),this.updateHelperElementSize(),i.on(`tap`,()=>this.emit(`vr.requestExit`,Q(`vr.requestExit`,{})))),this.destroyHelper=()=>{i.destroy(),r.parentNode&&r.parentNode.removeChild(r),this.helperElement=void 0}}updateConfiguration(e){return super.updateConfiguration(Object.assign(Object.assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))}destroy(){super.destroy(),this.cardboard.dispose(),this.destroyHelper()}isReady(){return!1}updateRenderSize(){this.needsRender=!0}updateCamera(e,t,n){return Promise.resolve()}updateCameraWithKeyframes(e,t,n){return Promise.resolve()}updateTime(e,t,...n){var r,i,a,o,s,l;if(this.destroyed)return;this.updateHelperElementSize(),this.userAction=!0,this.needsRender=!0;let u={},d={},f=this.locationMotion.keyframes[0],p=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[m,h]=this.locationMotion.getKeyFrameSegment(e),g=this.panoResourceFromLocationMotionKeyframe(m),_=this.panoResourceFromLocationMotionKeyframe(h),v=this.panoResourceFromLocationMotionKeyframe(f),y=this.panoResourceFromLocationMotionKeyframe(p),b=!1;if(this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),u.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(U(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let t=this.locationMotion.value.count-h.value.count+1,n=new c.Vector3().copy(g.position),a=new c.Vector3().copy(_.position);if(u.progress=t,t>=.01&&t<=.99&&(u.progress=U(_.effectEasing(t),.01,.99)),_.panoPicture&&(t<1?g.panoPicture&&(u.pano0=g.panoPicture):u.pano0=_.panoPicture,u.pano1=_.panoPicture),_.effect===`montage`?u.transition=`BLACK`:_.effect===`spread`?u.transition=`SPREAD`:u.transition=`FADE`,_.effect===`zoomin`||_.effect===`zoomout`?u.progress=Math.pow(t,3):_.effect===`model`&&this.camera.pose.distance<.01&&(u.modelAlpha=1-Math.pow(U(Math.abs(t-.5)*2,0,1),4)),t<1&&_.effect!==`fly`){if(u.pano0&&g.panoPicture){let e={panoId:u.pano0.panoId,map:u.pano0.map,mapHistogram:u.pano0.mapHistogram,mapSize:u.pano0.mapSize,zoom:u.pano0.zoom,matrix:g.panoPicture.matrix.clone().setPosition(_.position)},t=this.panoPictureObserverMap.get(u.pano0);t&&this.panoPictureObserverMap.set(e,t),u.pano0=e}n.copy(a),b=!0}d.distance=this.locationMotion.value.distance,d.offset=new c.Vector3(n.x+(a.x-n.x)*t,n.y+(a.y-n.y)*t,n.z+(a.z-n.z)*t);let o=[],s=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(o.push(t),n>this.locationMotion.progress&&s.push(t))}for(let e of Object.keys(this.panoResources)){if(s.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.panoPicture){let e=t.panoPicture.map;if(e){if(e===((r=u.pano0)==null?void 0:r.map)||e===((i=u.pano1)==null?void 0:i.map))continue;e.dispose(),t.panoPicture=null}}o.indexOf(e)>=0||delete this.panoResources[e]}this.currentPano=gp(_.panoId),this.emit(`pano.moving`,Q(`pano.moving`,{userAction:this.userAction,prevPano:gp(v.panoId),pano:gp(y.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},gp(y.panoId)),{mode:this.mode}),$(this.camera.pose)),d),options:{},progress:this.locationMotion.progress,error:null}))}Ih(u)===!1&&this.modelScene.parameter.set(u),d.offset&&this.camera.position.copy(d.offset);let x=this.camera.pose.longitude,S=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.computePose(),(x!==this.camera.pose.longitude||S!==this.camera.pose.latitude)&&(this.cameraMotion.set(vr(this.camera.pose,[`longitude`,`latitude`]),0).catch(K),this.emit(`camera.update`,Q(`camera.update`,{userAction:!0,state:Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose))}))),this.works.getObserver(this.currentPano);let C=this.works.getObserver(g.panoId),w=this.works.getObserver(_.panoId),T=new Map;if(C)for(let e of C.accessibleNodes){let t=C.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});T.set(e,t)}}if(w)for(let e of w.accessibleNodes){let t=w.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});T.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{let n=T.get(t);n?(e.position.copy(n.position).applyMatrix4(n.work.transform),T.delete(t)):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),T.forEach((e,t)=>{let n=new H_;n.position.copy(e.position).applyMatrix4(e.work.transform),e.position.distanceTo(e.standingPosition)>this.aerialObserverMinHeight?n.scale.setScalar(15):n.scale.setScalar(1),this.panoMeshes.set(t,n),this.helper.add(n),T.delete(t)}),this.camera.pose.distance>.1||b?this.panoMeshes.forEach((n,r)=>{n.setOpacity(0),n.updateTime&&n.updateTime(e,t),n.visible=!1}):this.panoMeshes.forEach((e,t)=>{let n=gp(t),r=this.works.getObserver(n);if(!r)return;if(!r.loadable&&!r.active){e.setOpacity(0);return}let i=e.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);i<.05?e.setOpacity(0):e.setOpacity(U(1.5/i,0,1)),_p(this.currentPano,n)&&e.setOpacity(0),e.lookAt(this.camera.position)}),this.locationMotion.ended){let n=this.intersect(e);this.panoMeshes.forEach((r,i)=>{r.setCurrent(r===n),r.updateTime&&r.updateTime(e,t)})}{let e=(a=this.modelScene.parameter.progress)==null?1:a,t=Math.round(e),n=this.modelScene.parameter.pano0,r=this.modelScene.parameter.pano1,i=t===0?n:r,s;if(i&&(s=this.works.getObserver(i.panoId),s||(s=this.panoPictureObserverMap.get(i))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(di()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!s||!i||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new c.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=ni(i.mapSize),a=e+1,l=new c.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),u=Math.floor(this.tileLevelForFov(this.camera.fov,l)),d=u>e?u:0;this.tiling.setObserver(s);let f={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:i.map,panoMatrix:i.matrix,panoZoom:i.zoom,minLevel:a,level:d},p=this.tiling.update(f),m={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:t,opacity:(n==null?void 0:n.panoId)===(r==null?void 0:r.panoId)?1:qu(Math.abs(((o=this.modelScene.parameter.progress)==null?0:o)-.5)*2)},h=this.modelScene.parameter.refinedScreen;(p||m.pano!==(h==null?void 0:h.pano)||m.opacity!==(h==null?void 0:h.opacity))&&this.modelScene.parameter.set(`refinedScreen`,m)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e);{let e=_.effect,{pano0:t,pano1:n}=this.modelScene.parameter;if(t&&n&&t!==n&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((s=this.modelScene.parameter.pano0Depth)==null?void 0:s.panoId)!==t.panoId||((l=this.modelScene.parameter.pano1Depth)==null?void 0:l.panoId)!==n.panoId){this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new c.WebGLCubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new c.WebGLCubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1});let e=new c.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);e.matrix.copy(t.matrix),e.matrixWorld.copy(e.matrix),e.matrixAutoUpdate=!1,Jg(this.renderer,this.modelScene,e,500);let r=new c.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);r.matrix.copy(n.matrix),r.matrixWorld.copy(r.matrix),r.matrixAutoUpdate=!1,Jg(this.renderer,this.modelScene,r,500),this.modelScene.parameter.set({pano0Depth:{panoId:t.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:500},pano1Depth:{panoId:n.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:500}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}render(){return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.cardboard.render(this.scene,this.camera),!0}setCamera(e={}){}destroyHelper(){}updateHelperElementSize(){if(!this.helperElement)return;let e=new c.Vector2(this.element.offsetWidth,this.element.offsetHeight),t=e.x*this.viewport.left,n=e.y*(1-this.viewport.bottom-this.viewport.height),r=e.x*this.viewport.width,i=e.y*this.viewport.height;this.helperElement.style.marginLeft!==t+`px`&&(this.helperElement.style.marginLeft=t+`px`),this.helperElement.style.marginTop!==n+`px`&&(this.helperElement.style.marginTop=n+`px`),this.helperElement.style.width!==r+`px`&&(this.helperElement.style.width=r+`px`),this.helperElement.style.height!==i+`px`&&(this.helperElement.style.height=i+`px`)}intersect(e){var t,n;if(this.locationMotion.ended===!1){this.intersectMesh.visible=!1,this.activePanoMesh=void 0,this.activeTime=void 0;return}if(this.activePanoMesh&&this.activeTime&&e-this.activeTime>U_){let e=this.activePanoMesh,t=null;return this.panoMeshes.forEach((n,r)=>{n===e&&(t=r)}),t!==null&&this.moveToPano(gp(t),{},!0),this.activePanoMesh=void 0,this.activeTime=void 0,e}let r=this.camera.getDirection(new c.Vector3),i=new c.Raycaster(this.camera.position,r);i.params.Points={threshold:.1},i.firstHitOnly=!0,i.floorIndex=-1;let a,o=[],s=this.works.getObserver(this.currentPano),l=s?s.accessibleNodes.map(e=>Z({panoIndex:e,workCode:s.work.workCode})):[];for(let e of l){let r=this.panoMeshes.get(e);if(r){let[e]=i.intersectObject((t=r.hitTestMesh)==null?r:t,!0);if(e){let t=(n=s==null?void 0:s.floorIndex)==null?0:n;o.push({panoMesh:r,intersection:Object.assign({floorIndex:t,floor:t},e)})}}}let[u]=o.sort((e,t)=>e.intersection.distance-t.intersection.distance);u?(a=u.intersection,this.activePanoMesh!==u.panoMesh&&(this.activePanoMesh=u.panoMesh,this.activeTime=e),this.intersectMesh.position.copy(u.panoMesh.position),this.intersectMesh.lookAt(this.camera.position)):(this.activePanoMesh=void 0,this.activeTime=void 0),a||(a=this.modelScene.intersectRaycaster(i)[0]);let d=Q(`intersect.update`,{raycaster:i,intersection:a==null?null:a,object:this.intersectMesh});if(this.emit(`intersect.update`,d),d.defaultPrevented){this.hideIntersectMesh();return}if(a&&a.face){let e=a.face.normal,t=new c.Quaternion;t.setFromUnitVectors(new c.Vector3(0,0,1),e),this.intersectMesh.quaternion.copy(t);let n=a.point.clone();this.intersectMesh.position.copy(n),u?this.intersectMesh.visible=!1:this.intersectMesh.visible=!0}else this.intersectMesh.visible=!1;return u==null?void 0:u.panoMesh}onPanGesture(){}onTapGesture(){}onPinchGesture(){}onMouseMove(){}onMouseOut(){}},K_=new c.Vector3(0,1.6,0),q_=new c.Box3,J_=new c.Vector3,Y_=Object.assign({},ng),X_=class e extends rg{static parseArgs(t){return t instanceof e?t:super.parseArgs(t)}static initAnimationEndState(e){var t,n,r,i,a,o;let s=this.parseArgs(e),l=s.works,{state:u,currentState:d}=e.initial,f=typeof u.panoIndex==`number`?{workCode:(r=(t=u.workCode)==null?(n=s.works[0])==null?void 0:n.workCode:t)==null?``:r,panoIndex:u.panoIndex}:{workCode:d.workCode,panoIndex:d.panoIndex},p=l.getObserver(f),m=U((i=u.fov)==null?!p||Fh(d.mode)?d.fov:s.defaultFov:i,s.minFov,s.maxFov),h=(a=u.longitude)==null?d.longitude:a,g=U(typeof s.minLatitude==`function`?s.minLatitude(m):s.minLatitude,-Math.PI/2,Math.PI/2),_=U(typeof s.maxLatitude==`function`?s.maxLatitude(m):s.maxLatitude,-Math.PI/2,Math.PI/2),v=U((o=u.latitude)==null?!p||Fh(d.mode)?d.latitude:s.defaultLatitude:o,g,_),y=new c.Vector3;if(s.initial.state.offset)y.copy(s.initial.state.offset);else if(p)y.copy(p.position).applyMatrix4(p.work.transform);else{let e=Ht(d).setLength(d.distance);y.copy(s.initial.currentState.offset).sub(e)}return{workCode:f.workCode,panoIndex:f.panoIndex,mode:`Model`,longitude:h,latitude:v,fov:m,offset:y,distance:0}}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Model`,this.locationMotion=new X({x:this.camera.pose.offset.x,y:this.camera.pose.offset.y,z:this.camera.pose.offset.z,distance:this.camera.pose.distance}),this.modelAlphaMotion=new X({modelAlpha:this.modelScene.parameter.resolveValue(`modelAlpha`)}),this.perspToOrthoMotion=new X({perspToOrtho:this.camera.perspToOrtho.x})}updateConfiguration(e){return super.updateConfiguration(e)}destroy(){super.destroy(),this.locationMotion.dispose()}isReady(){return this.locationMotion.ended===!1?!1:super.isReady()}updateWork(t,n,r,i){this.works=t;let a=e.initAnimationEndState(Object.assign(Object.assign({},this),{initial:{currentState:Object.assign(Object.assign({},this.currentPano),this.camera.pose),duration:r.duration,effect:r.effect,state:n,userAction:i}}));return(a.workCode!==this.currentPano.workCode||a.panoIndex!==this.currentPano.panoIndex||a.longitude!==this.cameraMotion.value.longitude||a.latitude!==this.cameraMotion.value.latitude||a.fov!==this.cameraMotion.value.fov)&&this.moveToPosition(a.offset,{duration:0,longitude:a.longitude,latitude:a.latitude,fov:a.fov},i),!0}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={},i={};return r.distance=0,e.offset!==void 0&&(r.x=e.offset.x,r.y=e.offset.y,r.z=e.offset.z),e.longitude!==void 0&&(i.longitude=e.longitude),e.latitude!==void 0&&(i.latitude=e.latitude),e.fov!==void 0&&(i.fov=e.fov),this.locationMotion.set(r,t).catch(K),this.cameraMotion.set(i,t).catch(K)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[],i=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{distance:0,x:t.value.offset.x,y:t.value.offset.x,z:t.value.offset.x}}),i.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.locationMotion.setKeyframes(r,t).catch(K),this.cameraMotion.setKeyframes(e,t)})}updateTime(e,t,...n){if(this.destroyed)return;let r={},i={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),r.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){let{pano0:e,pano1:t}=this.modelScene.parameter;e&&e.map!==(t==null?void 0:t.map)&&e.map.dispose(),r.progress=1,r.pano0=r.pano1=t}if(this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(U(this.perspToOrthoMotion.value.perspToOrtho,0,1))),!this.locationMotion.ended){this.locationMotion.update(e),i.distance=this.locationMotion.value.distance,i.offset=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);let t=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),n=[];for(let e of this.works){let r=this.modelScene.models.find(t=>t.work===e);if(!(!r||r.visible===!1)&&!(e.observers.length<=0)&&(q_.copy(e.observerBox).expandByScalar(10).applyMatrix4(e.transform),q_.containsPoint(t)))for(let t of e.observers)n.push(t)}let r=zl(n,e=>J_.copy(e.position).applyMatrix4(e.work.transform).distanceTo(t));this.currentPano=r?{workCode:r.work.workCode,panoIndex:r.panoIndex}:{workCode:``,panoIndex:0}}this.cameraMotion.ended||(this.cameraMotion.update(e),i.longitude=this.cameraMotion.value.longitude,i.latitude=this.cameraMotion.value.latitude,i.fov=this.cameraMotion.value.fov),Ih(r)||this.modelScene.parameter.set(r),Ih(i)||this.setCamera(i);let a=this.works.getObserver(this.currentPano);if(this.intersectMesh&&this.intersectMesh.parent&&a&&a.position.y-a.standingPosition.y>10){let e=U(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1)}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{state:n,currentState:r,duration:i,userAction:a}=this.initial;this.userAction=a;let o=e.initAnimationEndState(this),s={modelAlpha:1},c={perspToOrtho:0},l={longitude:o.longitude,latitude:o.latitude,fov:o.fov,duration:i,moveStartCallback:e=>{this.perspToOrthoMotion.set(c,i).catch(K),this.modelAlphaMotion.set(s,i).catch(K),this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:e,userAction:this.userAction}))},moveEndCallback:e=>{this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:e,userAction:this.userAction})),t()},moveCancelCallback:()=>{let e=this.currentPano,n=Object.assign(Object.assign({},e),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance});this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:n,userAction:this.userAction})),t()}};this.moveToPosition(o.offset,l,a)})}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(H())[1],t=this.locationMotion.getKeyFrameSegment(H())[1];return Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new c.Vector3(t.value.x,t.value.y,t.value.z),distance:t.value.distance})}moveToPano(e,t={},n){let r=this.works.getObserver(e);if(r){let e=new c.Vector3().copy(r.position).applyMatrix4(r.work.transform);this.moveToPosition(e,t,n)}}moveToPosition(e,t={},n){var r,i,a;this.userAction=n,this.stopMomentumMovement();let o=H(),s=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=s.distanceTo(e),u=this.locationMotion.getProgressVelocity(o),d=0;for(let e=1;e<this.locationMotion.keyframes.length;e++){let{x:t,y:n,z:r}=this.locationMotion.keyframes[e-1].value,{x:i,y:a,z:o}=this.locationMotion.keyframes[e].value;d+=Math.sqrt(Math.pow(i-t,2)+Math.pow(a-n,2)+Math.pow(o-r,2))}let f=l===0?0:u*d/l,p=this.calculateMovingDuration(t.duration,l),m={x:e.x,y:e.y,z:e.z,distance:0},h={longitude:t.longitude,latitude:t.latitude,fov:t.fov},g=[];for(let e of this.works){let t=this.modelScene.models.find(t=>t.work===e);if(!(!t||t.visible===!1)&&!(e.observers.length<=0)&&(q_.copy(e.observerBox).expandByScalar(10).applyMatrix4(e.transform),q_.containsPoint(s)))for(let t of e.observers)g.push(t)}let _=zl(g,e=>J_.copy(e.position).applyMatrix4(e.work.transform).distanceTo(s)),v=_?{workCode:_.work.workCode,panoIndex:_.panoIndex}:{workCode:``,panoIndex:0},y=Object.assign(Object.assign({},v),{mode:this.mode,longitude:(r=h.longitude)==null?this.camera.pose.longitude:r,latitude:(i=h.latitude)==null?this.camera.pose.latitude:i,fov:(a=h.fov)==null?this.camera.pose.fov:a,offset:e.clone(),distance:0}),b=this.currentPano;this.emit(`pano.moveTo`,Q(`pano.moveTo`,{options:t,prevPano:b,pano:{panoIndex:y.panoIndex,workCode:y.workCode},progress:0,state:y,userAction:this.userAction,error:null})),t.moveStartCallback&&t.moveStartCallback(y),this.cameraMotion.set(h,p).catch(K),this.locationMotion.set(m,p,f).then(()=>{for(let e of this.modelScene.children)e instanceof Hf&&e.show();let e=Object.assign(Object.assign(Object.assign({},v),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.arrived`,Q(`pano.arrived`,{options:t,prevPano:b,pano:{panoIndex:e.panoIndex,workCode:e.workCode},progress:0,state:e,userAction:this.userAction,error:null})),t.moveEndCallback&&t.moveEndCallback(e)},()=>{t.moveCancelCallback&&t.moveCancelCallback(),this.emit(`pano.cancel`,Q(`pano.cancel`,{options:t,prevPano:b,pano:{panoIndex:y.panoIndex,workCode:y.workCode},progress:0,state:y,userAction:this.userAction,error:null}))})}onTapGesture(e){let t=e.center.raycaster;this.stopMomentumMovement();let[n]=this.modelScene.intersectRaycaster(t);if(n&&n.face){let e=n.face.normal,t=n.point;if(new c.Vector3(0,1,0).angleTo(e)>Math.PI/3){let r=new c.Raycaster;r.firstHitOnly=!0;let i=e.clone().setLength(.3).add(t);r.set(i,new c.Vector3(0,-1,0)),n=this.modelScene.intersectRaycaster(r)[0]}}if(n){let t=new c.Vector3().copy(n.point).add(K_),r=[];for(let e of this.works){let n=this.modelScene.models.find(t=>t.work===e);if(!(!n||n.visible===!1)&&!(e.observers.length<=0)&&(q_.copy(e.observerBox).expandByScalar(10).applyMatrix4(e.transform),q_.containsPoint(t)))for(let t of e.observers)r.push(t)}let[i,a]=zl(r,e=>J_.copy(e.position).applyMatrix4(e.work.transform).distanceTo(t),!0);i&&a<5&&(t.y=J_.copy(i.position).applyMatrix4(i.work.transform).y),e.state.offset.copy(t),e.state.distance=0,this.emit(`gesture.tap`,e),e.defaultPrevented||this.moveToPosition(t,{},!0)}else this.emit(`gesture.tap`,e),e.defaultPrevented||this.cameraBounce()}},Z_=new c.Box3,Q_=new c.Vector3,$_=.5,ev=Math.PI/7,tv={defaultLongitude:Math.PI/4,defaultLatitude:Math.PI/4,defaultDistance:150,maxLatitude:Math.PI/2,minLatitude:0,cameraType:`auto`,cameraFence:null,intersectMeshCreator:()=>new Jh},nv=class e extends Gh{static parseArgs(t){var n,r,i,a,o,s,c,l;if(t instanceof e)return t;let u=super.parseArgs(t);return Object.assign(Object.assign({},u),{defaultLongitude:(n=t.defaultLongitude)==null?tv.defaultLongitude:n,defaultLatitude:(r=t.defaultLatitude)==null?tv.defaultLatitude:r,defaultDistance:(i=t.defaultDistance)==null?tv.defaultDistance:i,maxLatitude:(a=t.maxLatitude)==null?tv.maxLatitude:a,minLatitude:(o=t.minLatitude)==null?tv.minLatitude:o,cameraType:(s=t.cameraType)==null?tv.cameraType:s,cameraFence:(c=t.cameraFence)==null?tv.cameraFence:c,intersectMeshCreator:(l=t.intersectMeshCreator)==null?tv.intersectMeshCreator:l})}static distanceFromModel(e,t,n){let r=e.boundingBox,i=r.isEmpty()?10:Math.pow(Math.pow(r.max.x-r.min.x+1,2)+Math.pow(r.max.y-r.min.y+1,2)+Math.pow(r.max.z-r.min.z+1,2),1/2);i=isNaN(i)||!isFinite(i)?1:i;let a=i/2/Math.tan(Math.PI*t/360);return n<1&&(a/=n),isNaN(a)||!isFinite(a)?i:a}static initAnimationEndState(t){var n,r,i,a,o,s,l;let u=this.parseArgs(t),d=u.works,f=u.modelScene,{state:p,currentState:m}=t.initial,h=typeof p.panoIndex==`number`?{workCode:(i=(n=p.workCode)==null?(r=u.works[0])==null?void 0:r.workCode:n)==null?``:i,panoIndex:p.panoIndex}:{workCode:m.workCode,panoIndex:m.panoIndex},g=(a=p.fov)==null?60:a,_=U(typeof u.minLatitude==`function`?u.minLatitude(g):u.minLatitude,-Math.PI/2,Math.PI/2),v=U(typeof u.maxLatitude==`function`?u.maxLatitude(g):u.maxLatitude,-Math.PI/2,Math.PI/2),y=U((o=p.latitude)==null?Ph(m.mode)?m.latitude:u.defaultLatitude:o,_,v),b=e.distanceFromModel(u.modelScene,g,u.camera.aspect),x=new c.Vector3,S=(s=p.distance)==null?Math.min(u.defaultDistance,b):s,C=(l=p.longitude)==null?Ph(m.mode)?m.longitude:u.defaultLongitude:l;if(p.offset)x.copy(p.offset);else{let e=d.getObserver(h);u.defaultDistance<b&&e?(x.copy(e.position).applyMatrix4(e.work.transform),p.longitude===void 0&&(C=m.longitude)):(f.boundingBox.getCenter(x),S=b)}return Object.assign(Object.assign({},h),{mode:`Mapview`,longitude:C,latitude:y,fov:g,offset:x,distance:S})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Mapview`,this.defaultLongitude=n.defaultLongitude,this.defaultLatitude=n.defaultLatitude,this.defaultDistance=n.defaultDistance,this.maxLatitude=n.maxLatitude,this.minLatitude=n.minLatitude,this.cameraType=n.cameraType,this.cameraFence=n.cameraFence,this.locationMotion=new X({x:this.camera.pose.offset.x,y:this.camera.pose.offset.y,z:this.camera.pose.offset.z,distance:this.camera.pose.distance}),this.modelAlphaMotion=new X({modelAlpha:this.modelScene.parameter.resolveValue(`modelAlpha`)}),this.perspToOrthoMotion=new X({perspToOrtho:this.camera.perspToOrtho.x}),this.pendingTextureId=null,this.textureLoader=new yi,this.intersectMeshCreator=n.intersectMeshCreator,this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=`intersect`,this.intersectMesh.visible=!1,this.helper.add(this.intersectMesh)}updateConfiguration(e){if(super.updateConfiguration(e)===!1)return!1;if(e.defaultLongitude!==void 0&&this.defaultLongitude!==e.defaultLongitude&&(this.defaultLongitude=e.defaultLongitude),e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.defaultDistance!==void 0&&this.defaultDistance!==e.defaultDistance&&(this.defaultDistance=e.defaultDistance),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.cameraType!==void 0&&this.cameraType!==e.cameraType&&(this.cameraType=e.cameraType),this.cameraFence instanceof c.Box3&&e.cameraFence instanceof c.Box3||this.cameraFence instanceof c.Sphere&&e.cameraFence instanceof c.Sphere?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):e.cameraFence!==void 0&&(this.cameraFence=e.cameraFence),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;let t=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=t.name,this.intersectMesh.visible=t.visible;let n=this.intersectMesh.parent;n&&n.add(this.intersectMesh),t.dispose()}return!0}destroy(){super.destroy(),this.pendingTextureId=null,this.locationMotion.dispose(),this.panState=void 0,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)}isReady(){return this.locationMotion.ended===!1?!1:super.isReady()}updateWork(t,n,r,i){this.userAction=i,this.works=t;let a=e.initAnimationEndState(Object.assign(Object.assign({},this),{initial:{currentState:Object.assign(Object.assign({},this.currentPano),this.camera.pose),duration:r.duration,effect:r.effect,state:n,userAction:i}}));this.currentPano={workCode:a.workCode,panoIndex:a.panoIndex};let o={longitude:a.longitude,latitude:a.latitude,fov:a.fov},s={x:a.offset.x,y:a.offset.y,z:a.offset.z,distance:a.distance};return(o.longitude!==this.cameraMotion.value.longitude||o.latitude!==this.cameraMotion.value.latitude||o.fov!==this.cameraMotion.value.fov)&&this.cameraMotion.set(o,r.duration).catch(K),(s.x!==this.locationMotion.value.x||s.y!==this.locationMotion.value.y||s.z!==this.locationMotion.value.z||s.distance!==this.locationMotion.value.distance)&&this.locationMotion.set(s,r.duration).catch(K),!0}updateModel(e){super.updateModel(e),this.hideIntersectMesh()}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={},i={};return e.distance!==void 0&&(r.distance=e.distance),e.offset!==void 0&&(r.x=e.offset.x,r.y=e.offset.y,r.z=e.offset.z),e.longitude!==void 0&&(i.longitude=e.longitude),e.latitude!==void 0&&(i.latitude=e.latitude),e.fov!==void 0&&(i.fov=e.fov),this.locationMotion.set(r,t).catch(K),this.cameraMotion.set(i,t).catch(K)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[],i=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{distance:t.value.distance,x:t.value.offset.x,y:t.value.offset.x,z:t.value.offset.x}}),i.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.locationMotion.setKeyframes(r,t).catch(K),this.cameraMotion.setKeyframes(e,t)})}updateTime(e,t){if(this.destroyed)return;let n={},r={};if(this.locationMotion.ended||(this.locationMotion.update(e),r.distance=this.locationMotion.value.distance,r.offset=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),r.longitude=this.cameraMotion.value.longitude,r.latitude=this.cameraMotion.value.latitude,r.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),n.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){let{pano0:e,pano1:t}=this.modelScene.parameter;e&&e.map!==(t==null?void 0:t.map)&&e.map.dispose(),n.progress=1,n.pano0=n.pano1=t}let i=0;if(this.cameraType===`auto`?i=Math.abs(Math.PI/2-this.cameraMotion.value.latitude)<.02||Math.abs(-Math.PI/2-this.cameraMotion.value.latitude)<.02?1:0:this.cameraType===`perspective`?i=0:this.cameraType===`orthographic`&&(i=1),this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==i&&this.perspToOrthoMotion.set({perspToOrtho:i},500).catch(K),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(U(this.perspToOrthoMotion.value.perspToOrtho,0,1))),Ih(n)||this.modelScene.parameter.set(n),Ih(r)||this.setCamera(r),this.cameraFence&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&!this.inMomentumMovement&&this.locationMotion.ended&&this.perspToOrthoMotion.ended&&this.cameraMotion.ended){let e=Ht(this.camera.pose,new c.Vector3),t=new c.Vector3().copy(this.camera.pose.offset).sub(e.clone().multiplyScalar(this.camera.pose.distance));if(this.cameraFence.distanceToPoint(t)>.01){let e=this.cameraFence.clampPoint(t,new c.Vector3),n=this.camera.pose.offset.clone().add(e).sub(t),r=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:n,distance:this.camera.pose.distance});this.fixFinalState(r),this.locationMotion.set({x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance},300).catch(K)}}if(this.intersectMesh&&this.intersectMesh.parent){let e=U(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1)}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(H())[1],t=this.locationMotion.getKeyFrameSegment(H())[1];return Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:t.value.distance,offset:new c.Vector3(t.value.x,t.value.y,t.value.z)})}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{state:n,currentState:r,duration:i,userAction:a}=this.initial;this.userAction=a;let o=e.initAnimationEndState(this),s={longitude:o.longitude,latitude:o.latitude,fov:o.fov},c={x:o.offset.x,y:o.offset.y,z:o.offset.z,distance:o.distance};this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:o,userAction:this.userAction})),this.perspToOrthoMotion.set({perspToOrtho:0},i).catch(K),this.modelAlphaMotion.set({modelAlpha:1},i/3).catch(K),this.cameraMotion.set(s,i).catch(K),this.locationMotion.set(c,i).then(()=>{this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:o,userAction:this.userAction}))},e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:t,userAction:this.userAction}))}).then(()=>{t()})})}getForwardObserverOrNot(e){let[t]=this.modelScene.intersectRaycaster(e);if(!t)return null;let n=[];for(let t of this.works){let r=this.modelScene.models.find(e=>e.work===t);if(!(!r||r.visible===!1)&&!(t.observers.length<=0)&&(Z_.copy(t.observerBox).expandByScalar(10).applyMatrix4(t.transform),Z_.containsPoint(e.ray.origin)||e.ray.intersectsBox(Z_)))for(let e of t.observers)n.push(e)}let[r,i]=zl(n,e=>Q_.copy(e.standingPosition).applyMatrix4(e.work.transform).distanceTo(t.point),!0);return r&&i<Math.max(r.standingPosition.distanceTo(this.camera.position)/5,10)?r:null}coordinatesForOffset(e){let t=this.renderer.getSize(new c.Vector2);return{longitude:-2*e.x/(t.x*this.viewport.width),latitude:2*e.y/(t.y*this.viewport.height)}}requestMomentumMovement(e,t,n,r){if(this.inMomentumMovement===null)return;r=Math.max(r,1);let i=Object.assign({},n),a={longitude:0,latitude:0,x:0,y:0,z:0};for(let e=0;e<r;e++)i.longitude*=.996,i.latitude*=.996*.998,i.x*=.99,i.y*=.99,i.z*=.99,a.longitude+=i.longitude,a.latitude+=i.latitude,a.x+=i.x,a.y+=i.y,a.z+=i.z;let o=this.cameraMotion.value.fov,s=Vt(this.cameraMotion.value.longitude+a.longitude),l=U(typeof this.minLatitude==`function`?this.minLatitude(o):this.minLatitude,-Math.PI/2,Math.PI/2),u=U(typeof this.maxLatitude==`function`?this.maxLatitude(o):this.maxLatitude,-Math.PI/2,Math.PI/2),d=U(this.cameraMotion.value.latitude+a.latitude,l,u),f=new c.Vector3(this.locationMotion.value.x+a.x,this.locationMotion.value.y+a.y,this.locationMotion.value.z+a.z),p=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:s,latitude:d,offset:f,fov:o,distance:this.locationMotion.value.distance}),m=e.state.offset.clone().sub(Ht(e.state).setLength(p.distance)),h=!(Math.abs(i.longitude)>1e-4||Math.abs(i.latitude)>1e-4||Math.abs(i.x)>1e-4||Math.abs(i.y)>1e-4||Math.abs(i.z)>1e-4);(this.cameraFence?this.cameraFence.containsPoint(m):!0)===!1&&(h=!0);let g=Q(`gesture.momentum`,Object.assign(Object.assign({},e),{isFirst:t,isFinal:h,state:p}));if(this.emit(`gesture.fire`,g),this.inMomentumMovement.event=g,this.emit(`gesture.momentum`,g),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:s,latitude:d},0).catch(K),this.locationMotion.set({x:p.offset.x,y:p.offset.y,z:p.offset.z,distance:p.distance},0).catch(K),h?this.inMomentumMovement=null:si.shared.add((t,n)=>{this.requestMomentumMovement(e,!1,i,n)},!0))}fixFinalState(e){if(this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho===1)return;let t=Ht(e,new c.Vector3),n=new c.Vector3().copy(e.offset).sub(t.clone().setLength(e.distance)),r=new c.Raycaster(n,t);r.params.Points={threshold:.1},r.firstHitOnly=!0,r.hitFilter=e=>e.distance>$_+r.near,r.near=this.camera.near,r.far=this.camera.far;let i;if(i=this.modelScene.intersectRaycaster(r)[0],i&&i.distance<this.camera.near&&(i=void 0),!i){let e=new c.Plane(new c.Vector3(0,1,0),-this.modelScene.boundingBox.min.y),t=r.ray.intersectPlane(e,new c.Vector3);if(t){let e=t.distanceTo(r.ray.origin);e<1e3&&e>=r.near&&(i={distance:e,floorIndex:0,floor:0,point:t,object:this.scene,face:null})}}if(!i){let r=Math.max(e.distance,3);i={distance:r,floorIndex:0,floor:0,point:n.clone().add(t.clone().setLength(r)),object:this.scene,face:null}}i.distance>=this.camera.near&&yh(e.distance,i.distance)&&(e.distance=i.distance,e.offset=i.point)}onPanGesture(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let t=e.pointers.length,n=this.panState,r=0,i=!1;e.pointerType===`mouse`&&(r=e.center.buttons,i=e.center.shiftKey),n&&r===0&&n.buttons!==0&&(r=n.buttons);let a=n==null?void 0:n.target;if(!a){let t=this.relativeClientPosition(e.center),n=this.createRaycasterFromCamera(t,this.camera);a=new c.Vector3().copy(n.ray.direction).multiplyScalar(3).add(n.ray.origin);let[r]=this.modelScene.intersectRaycaster(n);if(!r&&n.ray.direction.y<-.3){let e=new c.Plane(new c.Vector3(0,1,0),0),t=n.ray.intersectPlane(e,new c.Vector3);if(t){let e=t.distanceTo(n.ray.origin);e<1e4&&e>=n.near&&(r={distance:e,floorIndex:0,floor:0,point:t,object:this.scene})}}if(r)a.copy(r.point);else{let e=new c.Vector3().copy(this.camera.pose.offset).sub(this.camera.position).normalize(),t=new c.Plane().setFromNormalAndCoplanarPoint(e,this.camera.pose.offset);n.ray.intersectPlane(t,a)}}if(e.isFinal?this.panState=void 0:this.panState={target:a,buttons:r,pointerLength:t,defaultPrevented:e.defaultPrevented,x:e.center.x,y:e.center.y},n===void 0||n.pointerLength!==t){this.emit(`gesture.pan`,e);return}if(t>1||r===2||i){let t={x:e.center.x-n.x,y:e.center.y-n.y},r=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),i=Ht(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(r),a=new c.Vector3().copy(i).sub(n.target).length();a*=Math.tan(this.camera.pose.fov/2*Math.PI/180);let o=this.renderer.getSize(new c.Vector2),s=2*t.x*a/o.y,l=2*t.y*a/o.y,u=new c.Vector3;u.setFromMatrixColumn(this.camera.matrix,0),u.multiplyScalar(-s),r.add(u),this.camera.pose.latitude<ev?u.setFromMatrixColumn(this.camera.matrix,1):(u.setFromMatrixColumn(this.camera.matrix,0),u.crossVectors(this.camera.up,u)),u.multiplyScalar(l),r.add(u);let d=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:r,distance:this.camera.pose.distance});if(e.state=d,this.emit(`gesture.pan`,e),e.defaultPrevented){this.panState&&(this.panState.defaultPrevented=e.defaultPrevented);return}if(e.isFinal&&n.defaultPrevented)return;if(this.locationMotion.set({x:d.offset.x,y:d.offset.y,z:d.offset.z},0).catch(K),e.isFinal&&(this.fixFinalState(d),Object.assign(e,{__fixFinalState:!0}),this.locationMotion.set({distance:d.distance,x:d.offset.x,y:d.offset.y,z:d.offset.z},0).catch(K)),e.isFinal){let t=this.renderer.getSize(new c.Vector2),n=2*e.velocityX*a/t.y,r=2*e.velocityY*a/t.y,i=new c.Vector3,o=new c.Vector3;i.setFromMatrixColumn(this.camera.matrix,0),i.multiplyScalar(-n),o.add(i),this.camera.pose.latitude<ev?i.setFromMatrixColumn(this.camera.matrix,1):(i.setFromMatrixColumn(this.camera.matrix,0),i.crossVectors(this.camera.up,i)),i.multiplyScalar(r),o.add(i),this.inMomentumMovement={uuid:rn()},this.requestMomentumMovement(e,!0,{longitude:0,latitude:0,x:o.x,y:o.y,z:o.z},0)}}else{let t={x:e.center.x-n.x,y:e.center.y-n.y},r=this.coordinatesForOffset(t),i=Vt(this.cameraMotion.value.longitude+r.longitude),a=this.camera.pose.fov,o=U(typeof this.minLatitude==`function`?this.minLatitude(a):this.minLatitude,-Math.PI/2,Math.PI/2),s=U(typeof this.maxLatitude==`function`?this.maxLatitude(a):this.maxLatitude,-Math.PI/2,Math.PI/2),c=U(this.cameraMotion.value.latitude+r.latitude,o,s);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(c=this.cameraMotion.value.latitude);let l=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:i,latitude:c,fov:a,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.isFinal&&Object.assign(e,{__fixFinalState:!0}),e.state=l,this.emit(`gesture.pan`,e),e.defaultPrevented||e.isFinal&&n.defaultPrevented)return;if(e.isFinal?this.locationMotion.set({distance:l.distance,x:l.offset.x,y:l.offset.y,z:l.offset.z},0).catch(K):this.cameraMotion.set({longitude:l.longitude,latitude:l.latitude},0).catch(K),e.isFinal){let t=e.velocityX,n=e.velocityY;this.inMomentumMovement={uuid:rn()},this.requestMomentumMovement(e,!0,Object.assign(Object.assign({},this.coordinatesForOffset({x:t,y:n})),{x:0,y:0,z:0}),0)}}}onPinchGesture(t){var n;if(!this.initAnimationIsReady)return;this.userAction=t.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let r=(n=this.pinchState)==null?void 0:n.distance;if(t.isFirst){this.pinchState={x:t.center.x,y:t.center.y,scale:1,distance:this.locationMotion.value.distance};return}if(r===void 0)return;let i=this.modelScene.boundingBox.getCenter(new c.Vector3),a=e.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),o=U(r/t.scale,$_,1/0),s=t.state.offset.clone().sub(Ht(t.state).setLength(o)),l=this.modelScene.boundingBox.containsPoint(s),u;if(!l&&this.pinchState&&this.pinchState.scale>t.scale&&i.distanceTo(s)>a?u=t.state.distance:(u=o,this.pinchState&&(this.pinchState.scale=t.scale)),t.state.distance=u,this.emit(`gesture.pinch`,t),!t.defaultPrevented&&(this.locationMotion.set({distance:t.state.distance},0).catch(K),t.pointerType!==`mouse`&&(t.type=`gesture.pan`,this.onPanGesture(t)),t.isFinal)){if(!(`__fixFinalState`in t)){let e=t.state;this.fixFinalState(t.state);let n={x:e.offset.x,y:e.offset.y,z:e.offset.z,distance:e.distance};this.locationMotion.set(n,0).catch(K)}this.panState=void 0,this.pinchState=void 0}}onMouseMove(e){var t,n;if(!this.intersectMesh.parent||this.panState||this.pinchState||this.mouseWheelState||(this.emit(`gesture.mousemove`,e),e.defaultPrevented))return;let r=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}let[i]=this.modelScene.intersectRaycaster(r),a=Q(`intersect.update`,{raycaster:r,intersection:i==null?null:i,object:this.intersectMesh});if(this.emit(`intersect.update`,a),a.defaultPrevented){this.hideIntersectMesh();return}if(i){let e=(n=(t=i.face)==null?void 0:t.normal)==null?new c.Vector3().copy(r.ray.direction).multiplyScalar(-1):n,a=e.clone(),o=i.point.clone();this.intersectMesh.position.copy(o);let s=o.clone().add(a);if(this.intersectMesh.lookAt(s),Math.abs(e.y)>.99){let e=this.camera.position.clone().sub(o);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}onMouseWheel(t){if(this.initAnimationIsReady)if(this.userAction=t.userAction,this.stopMomentumMovement(),this.hideIntersectMesh(),t.isFinal){let e=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov,offset:new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),distance:this.locationMotion.value.distance});if(this.fixFinalState(e),this.emit(`gesture.mousewheel`,t),t.defaultPrevented)return;let n={x:e.offset.x,y:e.offset.y,z:e.offset.z,distance:e.distance};this.locationMotion.set(n,0).catch(K)}else{let n=e.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),r=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),i=Ht(this.cameraMotion.value,new c.Vector3).negate(),a=new c.Ray(r,i).intersectBox(this.modelScene.boundingBox,new c.Vector3);a&&(n+=a.distanceTo(r));let o=Math.max(this.locationMotion.value.distance-this.camera.near,0),s=t.center.delta/10*Math.max(o/5,.1);if(o<=n||s>0)if(this.locationMotion.value.distance-s>=$_){let e=this.locationMotion.value.distance-s;t.state.distance=e}else{let e=Ht(this.cameraMotion.value);e.setLength(s),t.state.offset.add(e)}if(this.emit(`gesture.mousewheel`,t),t.defaultPrevented)return;this.locationMotion.set({distance:t.state.distance,x:t.state.offset.x,y:t.state.offset.y,z:t.state.offset.z},0).catch(K)}}onTapGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=e.center.raycaster,n=this.getForwardObserverOrNot(t);if(!n)this.emit(`gesture.tap`,e);else{let t={longitude:this.camera.pose.longitude,latitude:0},r=Object.assign(Object.assign({},e.state),{mode:`Panorama`,workCode:n.work.workCode,panoIndex:n.panoIndex,longitude:t.longitude,latitude:t.latitude,offset:n?n.position.clone():new c.Vector3,distance:0});if(e.state=r,this.emit(`gesture.tap`,e),!e.defaultPrevented&&(this.emit(`pano.select`,Q(`pano.select`,{prevPano:this.currentPano,pano:{panoIndex:r.panoIndex,workCode:r.workCode},state:r,userAction:e.userAction,options:t,progress:0,error:null})),n&&n.active)){let e=this.pendingTextureId=rn(),i={panoIndex:n.panoIndex,workCode:n.work.workCode},a=Z(i),o={right:n.images.work.getURL(n.images.right),left:n.images.work.getURL(n.images.left),up:n.images.work.getURL(n.images.up),down:n.images.work.getURL(n.images.down),front:n.images.work.getURL(n.images.front),back:n.images.work.getURL(n.images.back)},s=this.imageOptions.transform,l=Object.assign({key:`pano.${a}`},vr(this.imageOptions,[`format`,`size`,`quality`,`sharpen`,`forceUseExifOrientation`,`mappings`])),u=`pano:`+mp([o,l,s]),d=this.modelScene.parameter,f=Dh(`pano.prepare`,{prevPano:this.currentPano,pano:i});if(this.emit(`pano.prepare`,f),f.defaultPrevented){this.pendingTextureId=null;return}let p;d.pano0&&d.pano0.map.name===u?p=d.pano0:d.pano1&&d.pano1.map.name===u&&(p=d.pano1),p?Promise.resolve().then(()=>Oh(f)).catch(e=>Yh(e)).then(e=>{var n;e instanceof Error?(this.pendingTextureId=null,e.message&&this.emit(`error`,e)):(d.pano0&&d.pano0.map!==p.map&&d.pano0.map.dispose(),d.pano1&&d.pano1.map!==p.map&&d.pano1.map!==((n=d.pano0)==null?void 0:n.map)&&d.pano1.map.dispose(),d.set({pano0:p,pano1:p}),this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:r.panoIndex,workCode:r.workCode},progress:0,state:r,options:t,error:null})))}):Promise.all([Promise.resolve().then(()=>{this.emit(`pano.texture.load`,Q(`pano.texture.load`,{error:null,progress:0,meta:null,pano:i}))}).then(()=>this.textureLoader.loadCubeTexture(o,{imageURL:{transform:s,options:l},format:c.RGBFormat,viaAjax:!0,fetcher:Cf(this.fiveId,n.work)},void 0,void 0,void 0,this.renderer)).catch(e=>{let t=Yh(e);return this.emit(`pano.texture.error`,Q(`pano.texture.error`,{error:t,progress:0,meta:null,pano:i})),t}),Promise.resolve().then(()=>Oh(f)).catch(e=>Yh(e))]).then(([i,o])=>{var s,l;if(!(i instanceof Error)&&!(o instanceof Error)){let{body:o}=i;if(this.destroyed||this.pendingTextureId!==e){o.dispose();return}this.pendingTextureId=null,o.name=u;let f=Array.isArray(o.image)?o.image[0]:o.image,p=(s=f==null?void 0:f.width)==null?2048:s,m=n.images.histogram;m||(m=new _m().formPixels(Uh(this.renderer,o,!0,pm).data),n.images.histogram=m);let h={panoId:a,map:o,mapSize:p,mapHistogram:new c.Vector4().fromArray(m.toArray()),matrix:n.matrix.clone().premultiply(n.work.transform),zoom:1};d.pano0&&d.pano0.map.dispose(),d.pano1&&d.pano1.map!==((l=d.pano0)==null?void 0:l.map)&&d.pano1.map.dispose(),d.set({pano0:h,pano1:h}),this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:r.panoIndex,workCode:r.workCode},progress:0,state:r,options:t,error:null}))}else{let t=null;if(i instanceof Error?t||(t=i):i.body.dispose(),o instanceof Error&&(t||(t=o)),this.destroyed||this.pendingTextureId!==e)return;this.pendingTextureId=null,t instanceof Error&&t.message&&this.emit(`error`,t)}})}}}onDblTapGesture(e){if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let t=e.state,n=e.center.raycaster,r=n.ray.origin.clone().add(n.ray.direction.clone().setLength(3)),i=1,[a]=this.modelScene.intersectRaycaster(n);if(a&&(r=a.point.clone(),i=a.distance>4/2?1:3),e.state.distance=i,e.state.offset=r,this.emit(`gesture.dbltap`,e),e.defaultPrevented)return;let o={x:t.offset.x,y:t.offset.y,z:t.offset.z,distance:t.distance};this.locationMotion.set(o,360).catch(K),this.hideIntersectMesh()}hideIntersectMesh(){this.intersectMesh.visible===!0&&(this.intersectMesh.visible=!1,this.needsRender=!0)}};function rv(e){return e==null}var iv={type:`move`},av=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}getHandSpace(){return this._hand===null&&(this._hand=new c.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new c.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new c.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new c.Vector3),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new c.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new c.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new c.Vector3),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}getAxes(){return this._axes}update(e,t,n){let r=null,i=null,a=null,o=this._targetRay,s=this._grip,l=this._hand;if(e&&e.gamepad&&e.gamepad.axes&&(this._axes=[e.gamepad.axes[2],e.gamepad.axes[3]]),e&&t.session.visibilityState!==`visible-blurred`)if(o!==null&&(r=t.getPose(e.targetRaySpace,n),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(iv))),l&&e.hand){a=!0;for(let r of e.hand.values()){let e=t.getJointPose(r,n);if(l.joints[r.jointName]===void 0){let e=new c.Group;e.matrixAutoUpdate=!1,e.visible=!1,l.joints[r.jointName]=e,l.add(e)}let i=l.joints[r.jointName];e!==null&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.jointRadius=e.radius),i.visible=e!==null}let r=l.joints[`index-finger-tip`],i=l.joints[`thumb-tip`],o=r.position.distanceTo(i.position),s=.02,u=.005;l.inputState.pinching&&o>s+u?(l.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!l.inputState.pinching&&o<=s-u&&(l.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1));return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),l!==null&&(l.visible=a!==null),this}},ov=1,sv=()=>{try{let e=/Macintosh/i.test(navigator.userAgent),t=navigator.maxTouchPoints===5;return e&&t}catch(e){return console.error(`Error determining if the device is an Apple Vision Pro: `,e),!1}},cv=()=>{try{return/Oculus/i.test(navigator.userAgent)}catch(e){return console.error(`Error determining if the device is an Oculus: `,e),!1}},lv=class{constructor(e,t,n){var r,i,a,o,s;this.isPanorama=(r=n==null?void 0:n.isPanorama)==null?!0:r,navigator.userAgent.toLowerCase();let l;l=sv()?`VP`:cv()?`Oculus`:`Pico`,this.machineType=(i=n==null?void 0:n.machineType)==null?l:i,this.renderer=e,this.gl=t,this.enabled=!1,this.session=null,this.referenceSpaceType=(a=n==null?void 0:n.referenceSpaceType)==null?`local-floor`:a,this.referenceSpace=null,this.onSessionStartCallback=(o=n==null?void 0:n.onSessionStart)==null?K:o,this.onSessionEndCallback=(s=n==null?void 0:n.onSessionEnd)==null?K:s,this.controllers=[new av,new av],this.inputSourcesMap=new Map,this.cameraVR=new c.ArrayCamera,this.cameraL=new c.PerspectiveCamera,this.cameraR=new c.PerspectiveCamera,this.cameraVR.cameras.push(this.cameraL,this.cameraR),this.cameraL.viewport=new c.Vector4,this.cameraR.viewport=new c.Vector4,this.cameraL.layers.enable(1),this.cameraR.layers.enable(2),this.cameraVR.layers.enable(1),this.cameraVR.layers.enable(2),this.isPresenting=!1,this.currentDepthNear=null,this.currentDepthFar=null,this.cameraLPos=new c.Vector3,this.cameraRPos=new c.Vector3}getController(e){let t=this.controllers[e];return t||console.warn(`no controller find`),t.getTargetRaySpace()}getRightController(){if(!this.session||!this.session.inputSources)return null;let e;if(this.session.inputSources.forEach((t,n)=>{t.handedness===`right`&&(e=n)}),e===void 0)return console.warn(`no inputSource for right hand`),null;let t=this.controllers[e];return t?t.getTargetRaySpace():(console.warn(`right controller not find`),null)}getLeftController(){if(!this.session||!this.session.inputSources)return null;let e;if(this.session.inputSources.forEach((t,n)=>{t.handedness===`left`&&(e=n)}),e===void 0)return console.warn(`no inputSource for left hand`),null;let t=this.controllers[e];return t?t.getTargetRaySpace():(console.warn(`left controller not find`),null)}getControllerGrip(e){let t=this.controllers[e];return t||console.warn(`no controller find`),t.getGripSpace()}getCameras(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}}updateCamera(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}setProjectionFromUnion(e,t,n){this.cameraLPos.setFromMatrixPosition(t.matrixWorld),this.cameraRPos.setFromMatrixPosition(n.matrixWorld);var r=this.cameraLPos.distanceTo(this.cameraRPos),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var g=o+m,_=s+m,v=f-h,y=p+(r-h),b=c*s/_*g,x=l*s/_*g;e.projectionMatrix.makePerspective(v,y,b,x,g,_)}getCamera(e){this.cameraVR.near=this.cameraR.near=this.cameraL.near=e.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=e.far,this.session&&(this.currentDepthNear!==this.cameraVR.near||this.currentDepthFar!==this.cameraVR.far)&&(this.session.updateRenderState({depthNear:this.cameraVR.near,depthFar:this.cameraVR.far}),this.currentDepthNear=this.cameraVR.near,this.currentDepthFar=this.cameraVR.far);let t=e.parent,n=this.cameraVR.cameras;this.updateCamera(this.cameraVR,t);for(let e=0;e<n.length;e++)this.updateCamera(n[e],t);e.matrixWorld.copy(this.cameraVR.matrixWorld);let r=e.children;for(let e=0,t=r.length;e<t;e++)r[e].updateMatrixWorld(!0);return n.length===2?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR}updateInputSources(e){if(!this.session){console.warn(`session is lose!`);return}let t=this.session.inputSources;for(let e=0;e<this.controllers.length;e++)this.inputSourcesMap.set(t[e],this.controllers[e]);for(let t=0;t<e.removed.length;t++){let n=e.removed[t],r=this.inputSourcesMap.get(n);r&&(r.dispatchEvent({type:`disconnected`,data:n}),this.inputSourcesMap.delete(n))}for(let t=0;t<e.added.length;t++){let n=e.added[t],r=this.inputSourcesMap.get(n);r&&r.dispatchEvent({type:`connected`,data:n})}}onSessionEvent(e){let t=this.inputSourcesMap.get(e.inputSource);t&&t.dispatchEvent({type:e.type})}onSessionEnd(){this.inputSourcesMap.forEach(function(e,t){e.disconnect(t)}),this.inputSourcesMap.clear(),this.isPresenting=!1,this.session=null,si.shared.setContext(null),this.onSessionEndCallback()}onRequestReferenceSpace(e){this.referenceSpace=e,this.isPresenting=!0,this.session&&this.onSessionStartCallback(this.session)}setSession(e){if(this.session=e,this.session){this.session.addEventListener(`select`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`selectstart`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`selectend`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`squeeze`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`squeezestart`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`squeezeend`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`end`,e=>{this.onSessionEnd()});let e=this.gl.getContextAttributes();this.gl.makeXRCompatible().then(()=>{let t={antialias:e==null?void 0:e.antialias,alpha:e==null?void 0:e.alpha,depth:e==null?void 0:e.depth,stencil:e==null?void 0:e.stencil,framebufferScaleFactor:ov};if(!this.session){console.error(`session is lose while set session!`);return}switch(this.machineType){case`Pico`:case`VP`:this.session.updateRenderState({baseLayer:new XRWebGLLayer(this.session,this.gl,t)});break;case`Oculus`:this.session.updateRenderState({baseLayer:new XRWebGLLayer(this.session,this.gl,t)});break;default:this.machineType;break}this.session.requestReferenceSpace(this.referenceSpaceType).then(e=>{this.onRequestReferenceSpace(e)}),this.session.addEventListener(`inputsourceschange`,e=>{this.updateInputSources(e)})})}}},uv=class extends c.InstancedBufferGeometry{constructor(){super(),this.type=`LineSegmentsGeometry`,this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute(`position`,new c.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute(`uv`,new c.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;t=e instanceof Float32Array?e:Array.isArray(e)?new Float32Array(e):new Float32Array;let n=new c.InstancedInterleavedBuffer(t,6,1);return this.setAttribute(`instanceStart`,new c.InterleavedBufferAttribute(n,3,0)),this.setAttribute(`instanceEnd`,new c.InterleavedBufferAttribute(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;t=e instanceof Float32Array?e:Array.isArray(e)?new Float32Array(e):new Float32Array;let n=new c.InstancedInterleavedBuffer(t,6,1);return this.setAttribute(`instanceColorStart`,new c.InterleavedBufferAttribute(n,3,0)),this.setAttribute(`instanceColorEnd`,new c.InterleavedBufferAttribute(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new c.WireframeGeometry(e.geometry)),this}fromLineSegments(e){var t=e.geometry;if(t instanceof c.Geometry){let e=new c.BufferGeometry().fromGeometry(t);this.setPositions(e.attributes.position.array)}else t instanceof c.BufferGeometry&&this.setPositions(t.attributes.position.array);return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new c.Box3);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let n=new c.Box3;this.boundingBox.setFromBufferAttribute(e),n.setFromBufferAttribute(t),this.boundingBox.union(n)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new c.Sphere),this.boundingBox===null&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0,i=new c.Vector3;for(let a=0,o=e.count;a<o;a++)i.fromBufferAttribute(e,a),r=Math.max(r,n.distanceToSquared(i)),i.fromBufferAttribute(t,a),r=Math.max(r,n.distanceToSquared(i));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error(`THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.`,this)}}toJSON(){}};Object.assign(uv.prototype,{isLineSegmentsGeometry:!0});var dv={uniforms:c.UniformsUtils.merge([c.UniformsLib.common,c.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new c.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:`
2040
+ `,G_=class extends c.Object3D{constructor(){super(),this.progress=0,this.opacity=0,this.loading=!1,this.current=!1,this.disabled=!1,this.currentMotion=new X({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}),this.opacityMotion=new X({opacity:0}),this.loadingMotion=new X({opacity:0}),this.disableMotion=new X({opacity:0});let e={blending:c.CustomBlending,blendSrc:c.SrcAlphaFactor,blendDst:c.OneMinusSrcAlphaFactor,blendSrcAlpha:c.OneFactor,blendDstAlpha:c.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};this.hitTestMesh=new c.Mesh(B_,new c.MeshBasicMaterial(Object.assign(Object.assign({},e),{color:0,opacity:0}))),this.hitTestMesh.scale.set(1.5,1.5,1.5),this.ringMesh=new c.Mesh(B_,new c.ShaderMaterial(Object.assign(Object.assign({},e),{vertexShader:U_,fragmentShader:W_,uniforms:{opacity:{value:0}}}))),this.panoMesh=new c.Mesh(B_,new c.ShaderMaterial(Object.assign(Object.assign({},e),{vertexShader:V_,fragmentShader:H_,uniforms:{circleScale:{value:1.1},circleFade:{value:0},circleOpacity:{value:.5},loadingAngle:{value:0},loadingOpacity:{value:0},opacity:{value:0},disable:{value:0}}}))),this.add(this.hitTestMesh),this.add(this.ringMesh),this.add(this.panoMesh),this.renderOrder=1e4,this.needsRender=!0}setProgress(e){this.progress=e,this.setLoading(e>0)}setOpacity(e){this.opacity!==e&&(this.opacity=e=U(e,0,1),this.opacityMotion.set({opacity:e},30).catch(K))}setCurrent(e){if(this.current!==e){if(e)this.currentMotion.setKeyframes([{progress:0,value:{ringScale:2,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.05,value:{ringScale:1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.15,value:{ringScale:1.2,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.25,value:{ringScale:1.1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.8,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1}},{progress:.9,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:.92,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:1,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1.1}}],1500).catch(K);else{let e=[{progress:0,value:Object.assign({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}}];this.currentMotion.setKeyframes(e,200).catch(K)}this.current=e}}setLoading(e){this.loading!==e&&(e?this.loadingMotion.setKeyframes([{progress:0,value:{opacity:0}},{progress:.3,value:{opacity:0}},{progress:1,value:{opacity:.8}}],500).catch(K):this.loadingMotion.set({opacity:0},0).catch(K),this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.needsRender=!0)}setDisabled(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({opacity:e?1:0},300).catch(K),this.needsRender=!0)}tap(){return Promise.resolve()}updateTime(e,t){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);let n=this.opacityMotion.value.opacity;this.visible=n!==0;let{ringScale:r,ringOpacity:i,circleFade:a,circleOpacity:o,circleScale:s}=this.currentMotion.value;this.ringMesh.scale.set(r,1,r),this.ringMesh.material.uniforms.opacity.value=i*n,this.panoMesh.material.uniforms.opacity.value=n,this.panoMesh.material.uniforms.circleOpacity.value=o,this.panoMesh.material.uniforms.circleScale.value=s,this.panoMesh.material.uniforms.circleFade.value=a,this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingMotion.value.opacity,this.panoMesh.material.uniforms.disable.value=this.disableMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0}dispose(){this.hitTestMesh.material.dispose(),this.ringMesh.material.dispose(),this.panoMesh.material.dispose()}},K_=1500,q_=Object.assign({},yr(n_,[`maxLatitude`,`minLatitude`])),J_=class e extends r_{static parseArgs(t){if(t instanceof e)return t;let n=Object.assign(Object.assign({},t),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return super.parseArgs(n)}static initAnimationEndState(e){let t=this.parseArgs(e),n=super.initAnimationEndState(t);return Object.assign(Object.assign({},n),{mode:`VRPanorama`})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`VRPanorama`,this.cardboard=new j_(this.renderer);let r=z_();this.helperElement=r;let i=new qh(r);this.element.parentNode&&(this.element.parentNode.insertBefore(r,this.element),this.updateHelperElementSize(),i.on(`tap`,()=>this.emit(`vr.requestExit`,Q(`vr.requestExit`,{})))),this.destroyHelper=()=>{i.destroy(),r.parentNode&&r.parentNode.removeChild(r),this.helperElement=void 0}}updateConfiguration(e){return super.updateConfiguration(Object.assign(Object.assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))}destroy(){super.destroy(),this.cardboard.dispose(),this.destroyHelper()}isReady(){return!1}updateRenderSize(){this.needsRender=!0}updateCamera(e,t,n){return Promise.resolve()}updateCameraWithKeyframes(e,t,n){return Promise.resolve()}updateTime(e,t,...n){var r,i,a,o,s,l;if(this.destroyed)return;this.updateHelperElementSize(),this.userAction=!0,this.needsRender=!0;let u={},d={},f=this.locationMotion.keyframes[0],p=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[m,h]=this.locationMotion.getKeyFrameSegment(e),g=this.panoResourceFromLocationMotionKeyframe(m),_=this.panoResourceFromLocationMotionKeyframe(h),v=this.panoResourceFromLocationMotionKeyframe(f),y=this.panoResourceFromLocationMotionKeyframe(p),b=!1;if(this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),u.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(U(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let t=this.locationMotion.value.count-h.value.count+1,n=new c.Vector3().copy(g.position),a=new c.Vector3().copy(_.position);if(u.progress=t,t>=.01&&t<=.99&&(u.progress=U(_.effectEasing(t),.01,.99)),_.panoPicture&&(t<1?g.panoPicture&&(u.pano0=g.panoPicture):u.pano0=_.panoPicture,u.pano1=_.panoPicture),_.effect===`montage`?u.transition=`BLACK`:_.effect===`spread`?u.transition=`SPREAD`:u.transition=`FADE`,_.effect===`zoomin`||_.effect===`zoomout`?u.progress=Math.pow(t,3):_.effect===`model`&&this.camera.pose.distance<.01&&(u.modelAlpha=1-Math.pow(U(Math.abs(t-.5)*2,0,1),4)),t<1&&_.effect!==`fly`){if(u.pano0&&g.panoPicture){let e={panoId:u.pano0.panoId,map:u.pano0.map,mapHistogram:u.pano0.mapHistogram,mapSize:u.pano0.mapSize,zoom:u.pano0.zoom,matrix:g.panoPicture.matrix.clone().setPosition(_.position)},t=this.panoPictureObserverMap.get(u.pano0);t&&this.panoPictureObserverMap.set(e,t),u.pano0=e}n.copy(a),b=!0}d.distance=this.locationMotion.value.distance,d.offset=new c.Vector3(n.x+(a.x-n.x)*t,n.y+(a.y-n.y)*t,n.z+(a.z-n.z)*t);let o=[],s=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(o.push(t),n>this.locationMotion.progress&&s.push(t))}for(let e of Object.keys(this.panoResources)){if(s.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.panoPicture){let e=t.panoPicture.map;if(e){if(e===((r=u.pano0)==null?void 0:r.map)||e===((i=u.pano1)==null?void 0:i.map))continue;e.dispose(),t.panoPicture=null}}o.indexOf(e)>=0||delete this.panoResources[e]}this.currentPano=yp(_.panoId),this.emit(`pano.moving`,Q(`pano.moving`,{userAction:this.userAction,prevPano:yp(v.panoId),pano:yp(y.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},yp(y.panoId)),{mode:this.mode}),$(this.camera.pose)),d),options:{},progress:this.locationMotion.progress,error:null}))}zh(u)===!1&&this.modelScene.parameter.set(u),d.offset&&this.camera.position.copy(d.offset);let x=this.camera.pose.longitude,S=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.computePose(),(x!==this.camera.pose.longitude||S!==this.camera.pose.latitude)&&(this.cameraMotion.set(vr(this.camera.pose,[`longitude`,`latitude`]),0).catch(K),this.emit(`camera.update`,Q(`camera.update`,{userAction:!0,state:Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose))}))),this.works.getObserver(this.currentPano);let C=this.works.getObserver(g.panoId),w=this.works.getObserver(_.panoId),T=new Map;if(C)for(let e of C.accessibleNodes){let t=C.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});T.set(e,t)}}if(w)for(let e of w.accessibleNodes){let t=w.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});T.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{let n=T.get(t);n?(e.position.copy(n.position).applyMatrix4(n.work.transform),T.delete(t)):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),T.forEach((e,t)=>{let n=new G_;n.position.copy(e.position).applyMatrix4(e.work.transform),e.position.distanceTo(e.standingPosition)>this.aerialObserverMinHeight?n.scale.setScalar(15):n.scale.setScalar(1),this.panoMeshes.set(t,n),this.helper.add(n),T.delete(t)}),this.camera.pose.distance>.1||b?this.panoMeshes.forEach((n,r)=>{n.setOpacity(0),n.updateTime&&n.updateTime(e,t),n.visible=!1}):this.panoMeshes.forEach((e,t)=>{let n=yp(t),r=this.works.getObserver(n);if(!r)return;if(!r.loadable&&!r.active){e.setOpacity(0);return}let i=e.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);i<.05?e.setOpacity(0):e.setOpacity(U(1.5/i,0,1)),bp(this.currentPano,n)&&e.setOpacity(0),e.lookAt(this.camera.position)}),this.locationMotion.ended){let n=this.intersect(e);this.panoMeshes.forEach((r,i)=>{r.setCurrent(r===n),r.updateTime&&r.updateTime(e,t)})}{let e=(a=this.modelScene.parameter.progress)==null?1:a,t=Math.round(e),n=this.modelScene.parameter.pano0,r=this.modelScene.parameter.pano1,i=t===0?n:r,s;if(i&&(s=this.works.getObserver(i.panoId),s||(s=this.panoPictureObserverMap.get(i))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(di()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!s||!i||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new c.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=ni(i.mapSize),a=e+1,l=new c.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),u=Math.floor(this.tileLevelForFov(this.camera.fov,l)),d=u>e?u:0;this.tiling.setObserver(s);let f={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:i.map,panoMatrix:i.matrix,panoZoom:i.zoom,minLevel:a,level:d},p=this.tiling.update(f),m={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:t,opacity:(n==null?void 0:n.panoId)===(r==null?void 0:r.panoId)?1:Xu(Math.abs(((o=this.modelScene.parameter.progress)==null?0:o)-.5)*2)},h=this.modelScene.parameter.refinedScreen;(p||m.pano!==(h==null?void 0:h.pano)||m.opacity!==(h==null?void 0:h.opacity))&&this.modelScene.parameter.set(`refinedScreen`,m)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e);{let e=_.effect,{pano0:t,pano1:n}=this.modelScene.parameter;if(t&&n&&t!==n&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((s=this.modelScene.parameter.pano0Depth)==null?void 0:s.panoId)!==t.panoId||((l=this.modelScene.parameter.pano1Depth)==null?void 0:l.panoId)!==n.panoId){this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new c.WebGLCubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new c.WebGLCubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1});let e=new c.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);e.matrix.copy(t.matrix),e.matrixWorld.copy(e.matrix),e.matrixAutoUpdate=!1,Zg(this.renderer,this.modelScene,e,500);let r=new c.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);r.matrix.copy(n.matrix),r.matrixWorld.copy(r.matrix),r.matrixAutoUpdate=!1,Zg(this.renderer,this.modelScene,r,500),this.modelScene.parameter.set({pano0Depth:{panoId:t.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:500},pano1Depth:{panoId:n.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:500}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}render(){return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.cardboard.render(this.scene,this.camera),!0}setCamera(e={}){}destroyHelper(){}updateHelperElementSize(){if(!this.helperElement)return;let e=new c.Vector2(this.element.offsetWidth,this.element.offsetHeight),t=e.x*this.viewport.left,n=e.y*(1-this.viewport.bottom-this.viewport.height),r=e.x*this.viewport.width,i=e.y*this.viewport.height;this.helperElement.style.marginLeft!==t+`px`&&(this.helperElement.style.marginLeft=t+`px`),this.helperElement.style.marginTop!==n+`px`&&(this.helperElement.style.marginTop=n+`px`),this.helperElement.style.width!==r+`px`&&(this.helperElement.style.width=r+`px`),this.helperElement.style.height!==i+`px`&&(this.helperElement.style.height=i+`px`)}intersect(e){var t,n;if(this.locationMotion.ended===!1){this.intersectMesh.visible=!1,this.activePanoMesh=void 0,this.activeTime=void 0;return}if(this.activePanoMesh&&this.activeTime&&e-this.activeTime>K_){let e=this.activePanoMesh,t=null;return this.panoMeshes.forEach((n,r)=>{n===e&&(t=r)}),t!==null&&this.moveToPano(yp(t),{},!0),this.activePanoMesh=void 0,this.activeTime=void 0,e}let r=this.camera.getDirection(new c.Vector3),i=new c.Raycaster(this.camera.position,r);i.params.Points={threshold:.1},i.firstHitOnly=!0,i.floorIndex=-1;let a,o=[],s=this.works.getObserver(this.currentPano),l=s?s.accessibleNodes.map(e=>Z({panoIndex:e,workCode:s.work.workCode})):[];for(let e of l){let r=this.panoMeshes.get(e);if(r){let[e]=i.intersectObject((t=r.hitTestMesh)==null?r:t,!0);if(e){let t=(n=s==null?void 0:s.floorIndex)==null?0:n;o.push({panoMesh:r,intersection:Object.assign({floorIndex:t,floor:t},e)})}}}let[u]=o.sort((e,t)=>e.intersection.distance-t.intersection.distance);u?(a=u.intersection,this.activePanoMesh!==u.panoMesh&&(this.activePanoMesh=u.panoMesh,this.activeTime=e),this.intersectMesh.position.copy(u.panoMesh.position),this.intersectMesh.lookAt(this.camera.position)):(this.activePanoMesh=void 0,this.activeTime=void 0),a||(a=this.modelScene.intersectRaycaster(i)[0]);let d=Q(`intersect.update`,{raycaster:i,intersection:a==null?null:a,object:this.intersectMesh});if(this.emit(`intersect.update`,d),d.defaultPrevented){this.hideIntersectMesh();return}if(a&&a.face){let e=a.face.normal,t=new c.Quaternion;t.setFromUnitVectors(new c.Vector3(0,0,1),e),this.intersectMesh.quaternion.copy(t);let n=a.point.clone();this.intersectMesh.position.copy(n),u?this.intersectMesh.visible=!1:this.intersectMesh.visible=!0}else this.intersectMesh.visible=!1;return u==null?void 0:u.panoMesh}onPanGesture(){}onTapGesture(){}onPinchGesture(){}onMouseMove(){}onMouseOut(){}},Y_=new c.Vector3(0,1.6,0),X_=new c.Box3,Z_=new c.Vector3,Q_=Object.assign({},ag),$_=class e extends og{static parseArgs(t){return t instanceof e?t:super.parseArgs(t)}static initAnimationEndState(e){var t,n,r,i,a,o;let s=this.parseArgs(e),l=s.works,{state:u,currentState:d}=e.initial,f=typeof u.panoIndex==`number`?{workCode:(r=(t=u.workCode)==null?(n=s.works[0])==null?void 0:n.workCode:t)==null?``:r,panoIndex:u.panoIndex}:{workCode:d.workCode,panoIndex:d.panoIndex},p=l.getObserver(f),m=U((i=u.fov)==null?!p||Rh(d.mode)?d.fov:s.defaultFov:i,s.minFov,s.maxFov),h=(a=u.longitude)==null?d.longitude:a,g=U(typeof s.minLatitude==`function`?s.minLatitude(m):s.minLatitude,-Math.PI/2,Math.PI/2),_=U(typeof s.maxLatitude==`function`?s.maxLatitude(m):s.maxLatitude,-Math.PI/2,Math.PI/2),v=U((o=u.latitude)==null?!p||Rh(d.mode)?d.latitude:s.defaultLatitude:o,g,_),y=new c.Vector3;if(s.initial.state.offset)y.copy(s.initial.state.offset);else if(p)y.copy(p.position).applyMatrix4(p.work.transform);else{let e=Ht(d).setLength(d.distance);y.copy(s.initial.currentState.offset).sub(e)}return{workCode:f.workCode,panoIndex:f.panoIndex,mode:`Model`,longitude:h,latitude:v,fov:m,offset:y,distance:0}}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Model`,this.locationMotion=new X({x:this.camera.pose.offset.x,y:this.camera.pose.offset.y,z:this.camera.pose.offset.z,distance:this.camera.pose.distance}),this.modelAlphaMotion=new X({modelAlpha:this.modelScene.parameter.resolveValue(`modelAlpha`)}),this.perspToOrthoMotion=new X({perspToOrtho:this.camera.perspToOrtho.x})}updateConfiguration(e){return super.updateConfiguration(e)}destroy(){super.destroy(),this.locationMotion.dispose()}isReady(){return this.locationMotion.ended===!1?!1:super.isReady()}updateWork(t,n,r,i){this.works=t;let a=e.initAnimationEndState(Object.assign(Object.assign({},this),{initial:{currentState:Object.assign(Object.assign({},this.currentPano),this.camera.pose),duration:r.duration,effect:r.effect,state:n,userAction:i}}));return(a.workCode!==this.currentPano.workCode||a.panoIndex!==this.currentPano.panoIndex||a.longitude!==this.cameraMotion.value.longitude||a.latitude!==this.cameraMotion.value.latitude||a.fov!==this.cameraMotion.value.fov)&&this.moveToPosition(a.offset,{duration:0,longitude:a.longitude,latitude:a.latitude,fov:a.fov},i),!0}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={},i={};return r.distance=0,e.offset!==void 0&&(r.x=e.offset.x,r.y=e.offset.y,r.z=e.offset.z),e.longitude!==void 0&&(i.longitude=e.longitude),e.latitude!==void 0&&(i.latitude=e.latitude),e.fov!==void 0&&(i.fov=e.fov),this.locationMotion.set(r,t).catch(K),this.cameraMotion.set(i,t).catch(K)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[],i=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{distance:0,x:t.value.offset.x,y:t.value.offset.x,z:t.value.offset.x}}),i.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.locationMotion.setKeyframes(r,t).catch(K),this.cameraMotion.setKeyframes(e,t)})}updateTime(e,t,...n){if(this.destroyed)return;let r={},i={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),r.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){let{pano0:e,pano1:t}=this.modelScene.parameter;e&&e.map!==(t==null?void 0:t.map)&&e.map.dispose(),r.progress=1,r.pano0=r.pano1=t}if(this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(U(this.perspToOrthoMotion.value.perspToOrtho,0,1))),!this.locationMotion.ended){this.locationMotion.update(e),i.distance=this.locationMotion.value.distance,i.offset=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);let t=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),n=[];for(let e of this.works){let r=this.modelScene.models.find(t=>t.work===e);if(!(!r||r.visible===!1)&&!(e.observers.length<=0)&&(X_.copy(e.observerBox).expandByScalar(10).applyMatrix4(e.transform),X_.containsPoint(t)))for(let t of e.observers)n.push(t)}let r=Hl(n,e=>Z_.copy(e.position).applyMatrix4(e.work.transform).distanceTo(t));this.currentPano=r?{workCode:r.work.workCode,panoIndex:r.panoIndex}:{workCode:``,panoIndex:0}}this.cameraMotion.ended||(this.cameraMotion.update(e),i.longitude=this.cameraMotion.value.longitude,i.latitude=this.cameraMotion.value.latitude,i.fov=this.cameraMotion.value.fov),zh(r)||this.modelScene.parameter.set(r),zh(i)||this.setCamera(i);let a=this.works.getObserver(this.currentPano);if(this.intersectMesh&&this.intersectMesh.parent&&a&&a.position.y-a.standingPosition.y>10){let e=U(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1)}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{state:n,currentState:r,duration:i,userAction:a}=this.initial;this.userAction=a;let o=e.initAnimationEndState(this),s={modelAlpha:1},c={perspToOrtho:0},l={longitude:o.longitude,latitude:o.latitude,fov:o.fov,duration:i,moveStartCallback:e=>{this.perspToOrthoMotion.set(c,i).catch(K),this.modelAlphaMotion.set(s,i).catch(K),this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:e,userAction:this.userAction}))},moveEndCallback:e=>{this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:e,userAction:this.userAction})),t()},moveCancelCallback:()=>{let e=this.currentPano,n=Object.assign(Object.assign({},e),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance});this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:n,userAction:this.userAction})),t()}};this.moveToPosition(o.offset,l,a)})}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(H())[1],t=this.locationMotion.getKeyFrameSegment(H())[1];return Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new c.Vector3(t.value.x,t.value.y,t.value.z),distance:t.value.distance})}moveToPano(e,t={},n){let r=this.works.getObserver(e);if(r){let e=new c.Vector3().copy(r.position).applyMatrix4(r.work.transform);this.moveToPosition(e,t,n)}}moveToPosition(e,t={},n){var r,i,a;this.userAction=n,this.stopMomentumMovement();let o=H(),s=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=s.distanceTo(e),u=this.locationMotion.getProgressVelocity(o),d=0;for(let e=1;e<this.locationMotion.keyframes.length;e++){let{x:t,y:n,z:r}=this.locationMotion.keyframes[e-1].value,{x:i,y:a,z:o}=this.locationMotion.keyframes[e].value;d+=Math.sqrt(Math.pow(i-t,2)+Math.pow(a-n,2)+Math.pow(o-r,2))}let f=l===0?0:u*d/l,p=this.calculateMovingDuration(t.duration,l),m={x:e.x,y:e.y,z:e.z,distance:0},h={longitude:t.longitude,latitude:t.latitude,fov:t.fov},g=[];for(let e of this.works){let t=this.modelScene.models.find(t=>t.work===e);if(!(!t||t.visible===!1)&&!(e.observers.length<=0)&&(X_.copy(e.observerBox).expandByScalar(10).applyMatrix4(e.transform),X_.containsPoint(s)))for(let t of e.observers)g.push(t)}let _=Hl(g,e=>Z_.copy(e.position).applyMatrix4(e.work.transform).distanceTo(s)),v=_?{workCode:_.work.workCode,panoIndex:_.panoIndex}:{workCode:``,panoIndex:0},y=Object.assign(Object.assign({},v),{mode:this.mode,longitude:(r=h.longitude)==null?this.camera.pose.longitude:r,latitude:(i=h.latitude)==null?this.camera.pose.latitude:i,fov:(a=h.fov)==null?this.camera.pose.fov:a,offset:e.clone(),distance:0}),b=this.currentPano;this.emit(`pano.moveTo`,Q(`pano.moveTo`,{options:t,prevPano:b,pano:{panoIndex:y.panoIndex,workCode:y.workCode},progress:0,state:y,userAction:this.userAction,error:null})),t.moveStartCallback&&t.moveStartCallback(y),this.cameraMotion.set(h,p).catch(K),this.locationMotion.set(m,p,f).then(()=>{for(let e of this.modelScene.children)e instanceof Gf&&e.show();let e=Object.assign(Object.assign(Object.assign({},v),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.arrived`,Q(`pano.arrived`,{options:t,prevPano:b,pano:{panoIndex:e.panoIndex,workCode:e.workCode},progress:0,state:e,userAction:this.userAction,error:null})),t.moveEndCallback&&t.moveEndCallback(e)},()=>{t.moveCancelCallback&&t.moveCancelCallback(),this.emit(`pano.cancel`,Q(`pano.cancel`,{options:t,prevPano:b,pano:{panoIndex:y.panoIndex,workCode:y.workCode},progress:0,state:y,userAction:this.userAction,error:null}))})}onTapGesture(e){let t=e.center.raycaster;this.stopMomentumMovement();let[n]=this.modelScene.intersectRaycaster(t);if(n&&n.face){let e=n.face.normal,t=n.point;if(new c.Vector3(0,1,0).angleTo(e)>Math.PI/3){let r=new c.Raycaster;r.firstHitOnly=!0;let i=e.clone().setLength(.3).add(t);r.set(i,new c.Vector3(0,-1,0)),n=this.modelScene.intersectRaycaster(r)[0]}}if(n){let t=new c.Vector3().copy(n.point).add(Y_),r=[];for(let e of this.works){let n=this.modelScene.models.find(t=>t.work===e);if(!(!n||n.visible===!1)&&!(e.observers.length<=0)&&(X_.copy(e.observerBox).expandByScalar(10).applyMatrix4(e.transform),X_.containsPoint(t)))for(let t of e.observers)r.push(t)}let[i,a]=Hl(r,e=>Z_.copy(e.position).applyMatrix4(e.work.transform).distanceTo(t),!0);i&&a<5&&(t.y=Z_.copy(i.position).applyMatrix4(i.work.transform).y),e.state.offset.copy(t),e.state.distance=0,this.emit(`gesture.tap`,e),e.defaultPrevented||this.moveToPosition(t,{},!0)}else this.emit(`gesture.tap`,e),e.defaultPrevented||this.cameraBounce()}},ev=new c.Box3,tv=new c.Vector3,nv=.5,rv=Math.PI/7,iv={defaultLongitude:Math.PI/4,defaultLatitude:Math.PI/4,defaultDistance:150,maxLatitude:Math.PI/2,minLatitude:0,cameraType:`auto`,cameraFence:null,intersectMeshCreator:()=>new Zh},av=class e extends Jh{static parseArgs(t){var n,r,i,a,o,s,c,l;if(t instanceof e)return t;let u=super.parseArgs(t);return Object.assign(Object.assign({},u),{defaultLongitude:(n=t.defaultLongitude)==null?iv.defaultLongitude:n,defaultLatitude:(r=t.defaultLatitude)==null?iv.defaultLatitude:r,defaultDistance:(i=t.defaultDistance)==null?iv.defaultDistance:i,maxLatitude:(a=t.maxLatitude)==null?iv.maxLatitude:a,minLatitude:(o=t.minLatitude)==null?iv.minLatitude:o,cameraType:(s=t.cameraType)==null?iv.cameraType:s,cameraFence:(c=t.cameraFence)==null?iv.cameraFence:c,intersectMeshCreator:(l=t.intersectMeshCreator)==null?iv.intersectMeshCreator:l})}static distanceFromModel(e,t,n){let r=e.boundingBox,i=r.isEmpty()?10:Math.pow(Math.pow(r.max.x-r.min.x+1,2)+Math.pow(r.max.y-r.min.y+1,2)+Math.pow(r.max.z-r.min.z+1,2),1/2);i=isNaN(i)||!isFinite(i)?1:i;let a=i/2/Math.tan(Math.PI*t/360);return n<1&&(a/=n),isNaN(a)||!isFinite(a)?i:a}static initAnimationEndState(t){var n,r,i,a,o,s,l;let u=this.parseArgs(t),d=u.works,f=u.modelScene,{state:p,currentState:m}=t.initial,h=typeof p.panoIndex==`number`?{workCode:(i=(n=p.workCode)==null?(r=u.works[0])==null?void 0:r.workCode:n)==null?``:i,panoIndex:p.panoIndex}:{workCode:m.workCode,panoIndex:m.panoIndex},g=(a=p.fov)==null?60:a,_=U(typeof u.minLatitude==`function`?u.minLatitude(g):u.minLatitude,-Math.PI/2,Math.PI/2),v=U(typeof u.maxLatitude==`function`?u.maxLatitude(g):u.maxLatitude,-Math.PI/2,Math.PI/2),y=U((o=p.latitude)==null?Lh(m.mode)?m.latitude:u.defaultLatitude:o,_,v),b=e.distanceFromModel(u.modelScene,g,u.camera.aspect),x=new c.Vector3,S=(s=p.distance)==null?Math.min(u.defaultDistance,b):s,C=(l=p.longitude)==null?Lh(m.mode)?m.longitude:u.defaultLongitude:l;if(p.offset)x.copy(p.offset);else{let e=d.getObserver(h);u.defaultDistance<b&&e?(x.copy(e.position).applyMatrix4(e.work.transform),p.longitude===void 0&&(C=m.longitude)):(f.boundingBox.getCenter(x),S=b)}return Object.assign(Object.assign({},h),{mode:`Mapview`,longitude:C,latitude:y,fov:g,offset:x,distance:S})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Mapview`,this.defaultLongitude=n.defaultLongitude,this.defaultLatitude=n.defaultLatitude,this.defaultDistance=n.defaultDistance,this.maxLatitude=n.maxLatitude,this.minLatitude=n.minLatitude,this.cameraType=n.cameraType,this.cameraFence=n.cameraFence,this.locationMotion=new X({x:this.camera.pose.offset.x,y:this.camera.pose.offset.y,z:this.camera.pose.offset.z,distance:this.camera.pose.distance}),this.modelAlphaMotion=new X({modelAlpha:this.modelScene.parameter.resolveValue(`modelAlpha`)}),this.perspToOrthoMotion=new X({perspToOrtho:this.camera.perspToOrtho.x}),this.pendingTextureId=null,this.textureLoader=new yi,this.intersectMeshCreator=n.intersectMeshCreator,this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=`intersect`,this.intersectMesh.visible=!1,this.helper.add(this.intersectMesh)}updateConfiguration(e){if(super.updateConfiguration(e)===!1)return!1;if(e.defaultLongitude!==void 0&&this.defaultLongitude!==e.defaultLongitude&&(this.defaultLongitude=e.defaultLongitude),e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.defaultDistance!==void 0&&this.defaultDistance!==e.defaultDistance&&(this.defaultDistance=e.defaultDistance),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.cameraType!==void 0&&this.cameraType!==e.cameraType&&(this.cameraType=e.cameraType),this.cameraFence instanceof c.Box3&&e.cameraFence instanceof c.Box3||this.cameraFence instanceof c.Sphere&&e.cameraFence instanceof c.Sphere?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):e.cameraFence!==void 0&&(this.cameraFence=e.cameraFence),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;let t=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=t.name,this.intersectMesh.visible=t.visible;let n=this.intersectMesh.parent;n&&n.add(this.intersectMesh),t.dispose()}return!0}destroy(){super.destroy(),this.pendingTextureId=null,this.locationMotion.dispose(),this.panState=void 0,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)}isReady(){return this.locationMotion.ended===!1?!1:super.isReady()}updateWork(t,n,r,i){this.userAction=i,this.works=t;let a=e.initAnimationEndState(Object.assign(Object.assign({},this),{initial:{currentState:Object.assign(Object.assign({},this.currentPano),this.camera.pose),duration:r.duration,effect:r.effect,state:n,userAction:i}}));this.currentPano={workCode:a.workCode,panoIndex:a.panoIndex};let o={longitude:a.longitude,latitude:a.latitude,fov:a.fov},s={x:a.offset.x,y:a.offset.y,z:a.offset.z,distance:a.distance};return(o.longitude!==this.cameraMotion.value.longitude||o.latitude!==this.cameraMotion.value.latitude||o.fov!==this.cameraMotion.value.fov)&&this.cameraMotion.set(o,r.duration).catch(K),(s.x!==this.locationMotion.value.x||s.y!==this.locationMotion.value.y||s.z!==this.locationMotion.value.z||s.distance!==this.locationMotion.value.distance)&&this.locationMotion.set(s,r.duration).catch(K),!0}updateModel(e){super.updateModel(e),this.hideIntersectMesh()}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={},i={};return e.distance!==void 0&&(r.distance=e.distance),e.offset!==void 0&&(r.x=e.offset.x,r.y=e.offset.y,r.z=e.offset.z),e.longitude!==void 0&&(i.longitude=e.longitude),e.latitude!==void 0&&(i.latitude=e.latitude),e.fov!==void 0&&(i.fov=e.fov),this.locationMotion.set(r,t).catch(K),this.cameraMotion.set(i,t).catch(K)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[],i=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{distance:t.value.distance,x:t.value.offset.x,y:t.value.offset.x,z:t.value.offset.x}}),i.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.locationMotion.setKeyframes(r,t).catch(K),this.cameraMotion.setKeyframes(e,t)})}updateTime(e,t){if(this.destroyed)return;let n={},r={};if(this.locationMotion.ended||(this.locationMotion.update(e),r.distance=this.locationMotion.value.distance,r.offset=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),r.longitude=this.cameraMotion.value.longitude,r.latitude=this.cameraMotion.value.latitude,r.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),n.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){let{pano0:e,pano1:t}=this.modelScene.parameter;e&&e.map!==(t==null?void 0:t.map)&&e.map.dispose(),n.progress=1,n.pano0=n.pano1=t}let i=0;if(this.cameraType===`auto`?i=Math.abs(Math.PI/2-this.cameraMotion.value.latitude)<.02||Math.abs(-Math.PI/2-this.cameraMotion.value.latitude)<.02?1:0:this.cameraType===`perspective`?i=0:this.cameraType===`orthographic`&&(i=1),this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==i&&this.perspToOrthoMotion.set({perspToOrtho:i},500).catch(K),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(U(this.perspToOrthoMotion.value.perspToOrtho,0,1))),zh(n)||this.modelScene.parameter.set(n),zh(r)||this.setCamera(r),this.cameraFence&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&!this.inMomentumMovement&&this.locationMotion.ended&&this.perspToOrthoMotion.ended&&this.cameraMotion.ended){let e=Ht(this.camera.pose,new c.Vector3),t=new c.Vector3().copy(this.camera.pose.offset).sub(e.clone().multiplyScalar(this.camera.pose.distance));if(this.cameraFence.distanceToPoint(t)>.01){let e=this.cameraFence.clampPoint(t,new c.Vector3),n=this.camera.pose.offset.clone().add(e).sub(t),r=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:n,distance:this.camera.pose.distance});this.fixFinalState(r),this.locationMotion.set({x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance},300).catch(K)}}if(this.intersectMesh&&this.intersectMesh.parent){let e=U(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1)}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(H())[1],t=this.locationMotion.getKeyFrameSegment(H())[1];return Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:t.value.distance,offset:new c.Vector3(t.value.x,t.value.y,t.value.z)})}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{state:n,currentState:r,duration:i,userAction:a}=this.initial;this.userAction=a;let o=e.initAnimationEndState(this),s={longitude:o.longitude,latitude:o.latitude,fov:o.fov},c={x:o.offset.x,y:o.offset.y,z:o.offset.z,distance:o.distance};this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:o,userAction:this.userAction})),this.perspToOrthoMotion.set({perspToOrtho:0},i).catch(K),this.modelAlphaMotion.set({modelAlpha:1},i/3).catch(K),this.cameraMotion.set(s,i).catch(K),this.locationMotion.set(c,i).then(()=>{this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:o,userAction:this.userAction}))},e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:t,userAction:this.userAction}))}).then(()=>{t()})})}getForwardObserverOrNot(e){let[t]=this.modelScene.intersectRaycaster(e);if(!t)return null;let n=[];for(let t of this.works){let r=this.modelScene.models.find(e=>e.work===t);if(!(!r||r.visible===!1)&&!(t.observers.length<=0)&&(ev.copy(t.observerBox).expandByScalar(10).applyMatrix4(t.transform),ev.containsPoint(e.ray.origin)||e.ray.intersectsBox(ev)))for(let e of t.observers)n.push(e)}let[r,i]=Hl(n,e=>tv.copy(e.standingPosition).applyMatrix4(e.work.transform).distanceTo(t.point),!0);return r&&i<Math.max(r.standingPosition.distanceTo(this.camera.position)/5,10)?r:null}coordinatesForOffset(e){let t=this.renderer.getSize(new c.Vector2);return{longitude:-2*e.x/(t.x*this.viewport.width),latitude:2*e.y/(t.y*this.viewport.height)}}requestMomentumMovement(e,t,n,r){if(this.inMomentumMovement===null)return;r=Math.max(r,1);let i=Object.assign({},n),a={longitude:0,latitude:0,x:0,y:0,z:0};for(let e=0;e<r;e++)i.longitude*=.996,i.latitude*=.996*.998,i.x*=.99,i.y*=.99,i.z*=.99,a.longitude+=i.longitude,a.latitude+=i.latitude,a.x+=i.x,a.y+=i.y,a.z+=i.z;let o=this.cameraMotion.value.fov,s=Vt(this.cameraMotion.value.longitude+a.longitude),l=U(typeof this.minLatitude==`function`?this.minLatitude(o):this.minLatitude,-Math.PI/2,Math.PI/2),u=U(typeof this.maxLatitude==`function`?this.maxLatitude(o):this.maxLatitude,-Math.PI/2,Math.PI/2),d=U(this.cameraMotion.value.latitude+a.latitude,l,u),f=new c.Vector3(this.locationMotion.value.x+a.x,this.locationMotion.value.y+a.y,this.locationMotion.value.z+a.z),p=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:s,latitude:d,offset:f,fov:o,distance:this.locationMotion.value.distance}),m=e.state.offset.clone().sub(Ht(e.state).setLength(p.distance)),h=!(Math.abs(i.longitude)>1e-4||Math.abs(i.latitude)>1e-4||Math.abs(i.x)>1e-4||Math.abs(i.y)>1e-4||Math.abs(i.z)>1e-4);(this.cameraFence?this.cameraFence.containsPoint(m):!0)===!1&&(h=!0);let g=Q(`gesture.momentum`,Object.assign(Object.assign({},e),{isFirst:t,isFinal:h,state:p}));if(this.emit(`gesture.fire`,g),this.inMomentumMovement.event=g,this.emit(`gesture.momentum`,g),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:s,latitude:d},0).catch(K),this.locationMotion.set({x:p.offset.x,y:p.offset.y,z:p.offset.z,distance:p.distance},0).catch(K),h?this.inMomentumMovement=null:si.shared.add((t,n)=>{this.requestMomentumMovement(e,!1,i,n)},!0))}fixFinalState(e){if(this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho===1)return;let t=Ht(e,new c.Vector3),n=new c.Vector3().copy(e.offset).sub(t.clone().setLength(e.distance)),r=new c.Raycaster(n,t);r.params.Points={threshold:.1},r.firstHitOnly=!0,r.hitFilter=e=>e.distance>nv+r.near,r.near=this.camera.near,r.far=this.camera.far;let i;if(i=this.modelScene.intersectRaycaster(r)[0],i&&i.distance<this.camera.near&&(i=void 0),!i){let e=new c.Plane(new c.Vector3(0,1,0),-this.modelScene.boundingBox.min.y),t=r.ray.intersectPlane(e,new c.Vector3);if(t){let e=t.distanceTo(r.ray.origin);e<1e3&&e>=r.near&&(i={distance:e,floorIndex:0,floor:0,point:t,object:this.scene,face:null})}}if(!i){let r=Math.max(e.distance,3);i={distance:r,floorIndex:0,floor:0,point:n.clone().add(t.clone().setLength(r)),object:this.scene,face:null}}i.distance>=this.camera.near&&Sh(e.distance,i.distance)&&(e.distance=i.distance,e.offset=i.point)}onPanGesture(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let t=e.pointers.length,n=this.panState,r=0,i=!1;e.pointerType===`mouse`&&(r=e.center.buttons,i=e.center.shiftKey),n&&r===0&&n.buttons!==0&&(r=n.buttons);let a=n==null?void 0:n.target;if(!a){let t=this.relativeClientPosition(e.center),n=this.createRaycasterFromCamera(t,this.camera);a=new c.Vector3().copy(n.ray.direction).multiplyScalar(3).add(n.ray.origin);let[r]=this.modelScene.intersectRaycaster(n);if(!r&&n.ray.direction.y<-.3){let e=new c.Plane(new c.Vector3(0,1,0),0),t=n.ray.intersectPlane(e,new c.Vector3);if(t){let e=t.distanceTo(n.ray.origin);e<1e4&&e>=n.near&&(r={distance:e,floorIndex:0,floor:0,point:t,object:this.scene})}}if(r)a.copy(r.point);else{let e=new c.Vector3().copy(this.camera.pose.offset).sub(this.camera.position).normalize(),t=new c.Plane().setFromNormalAndCoplanarPoint(e,this.camera.pose.offset);n.ray.intersectPlane(t,a)}}if(e.isFinal?this.panState=void 0:this.panState={target:a,buttons:r,pointerLength:t,defaultPrevented:e.defaultPrevented,x:e.center.x,y:e.center.y},n===void 0||n.pointerLength!==t){this.emit(`gesture.pan`,e);return}if(t>1||r===2||i){let t={x:e.center.x-n.x,y:e.center.y-n.y},r=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),i=Ht(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(r),a=new c.Vector3().copy(i).sub(n.target).length();a*=Math.tan(this.camera.pose.fov/2*Math.PI/180);let o=this.renderer.getSize(new c.Vector2),s=2*t.x*a/o.y,l=2*t.y*a/o.y,u=new c.Vector3;u.setFromMatrixColumn(this.camera.matrix,0),u.multiplyScalar(-s),r.add(u),this.camera.pose.latitude<rv?u.setFromMatrixColumn(this.camera.matrix,1):(u.setFromMatrixColumn(this.camera.matrix,0),u.crossVectors(this.camera.up,u)),u.multiplyScalar(l),r.add(u);let d=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:r,distance:this.camera.pose.distance});if(e.state=d,this.emit(`gesture.pan`,e),e.defaultPrevented){this.panState&&(this.panState.defaultPrevented=e.defaultPrevented);return}if(e.isFinal&&n.defaultPrevented)return;if(this.locationMotion.set({x:d.offset.x,y:d.offset.y,z:d.offset.z},0).catch(K),e.isFinal&&(this.fixFinalState(d),Object.assign(e,{__fixFinalState:!0}),this.locationMotion.set({distance:d.distance,x:d.offset.x,y:d.offset.y,z:d.offset.z},0).catch(K)),e.isFinal){let t=this.renderer.getSize(new c.Vector2),n=2*e.velocityX*a/t.y,r=2*e.velocityY*a/t.y,i=new c.Vector3,o=new c.Vector3;i.setFromMatrixColumn(this.camera.matrix,0),i.multiplyScalar(-n),o.add(i),this.camera.pose.latitude<rv?i.setFromMatrixColumn(this.camera.matrix,1):(i.setFromMatrixColumn(this.camera.matrix,0),i.crossVectors(this.camera.up,i)),i.multiplyScalar(r),o.add(i),this.inMomentumMovement={uuid:rn()},this.requestMomentumMovement(e,!0,{longitude:0,latitude:0,x:o.x,y:o.y,z:o.z},0)}}else{let t={x:e.center.x-n.x,y:e.center.y-n.y},r=this.coordinatesForOffset(t),i=Vt(this.cameraMotion.value.longitude+r.longitude),a=this.camera.pose.fov,o=U(typeof this.minLatitude==`function`?this.minLatitude(a):this.minLatitude,-Math.PI/2,Math.PI/2),s=U(typeof this.maxLatitude==`function`?this.maxLatitude(a):this.maxLatitude,-Math.PI/2,Math.PI/2),c=U(this.cameraMotion.value.latitude+r.latitude,o,s);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(c=this.cameraMotion.value.latitude);let l=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:i,latitude:c,fov:a,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.isFinal&&Object.assign(e,{__fixFinalState:!0}),e.state=l,this.emit(`gesture.pan`,e),e.defaultPrevented||e.isFinal&&n.defaultPrevented)return;if(e.isFinal?this.locationMotion.set({distance:l.distance,x:l.offset.x,y:l.offset.y,z:l.offset.z},0).catch(K):this.cameraMotion.set({longitude:l.longitude,latitude:l.latitude},0).catch(K),e.isFinal){let t=e.velocityX,n=e.velocityY;this.inMomentumMovement={uuid:rn()},this.requestMomentumMovement(e,!0,Object.assign(Object.assign({},this.coordinatesForOffset({x:t,y:n})),{x:0,y:0,z:0}),0)}}}onPinchGesture(t){var n;if(!this.initAnimationIsReady)return;this.userAction=t.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let r=(n=this.pinchState)==null?void 0:n.distance;if(t.isFirst){this.pinchState={x:t.center.x,y:t.center.y,scale:1,distance:this.locationMotion.value.distance};return}if(r===void 0)return;let i=this.modelScene.boundingBox.getCenter(new c.Vector3),a=e.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),o=U(r/t.scale,nv,1/0),s=t.state.offset.clone().sub(Ht(t.state).setLength(o)),l=this.modelScene.boundingBox.containsPoint(s),u;if(!l&&this.pinchState&&this.pinchState.scale>t.scale&&i.distanceTo(s)>a?u=t.state.distance:(u=o,this.pinchState&&(this.pinchState.scale=t.scale)),t.state.distance=u,this.emit(`gesture.pinch`,t),!t.defaultPrevented&&(this.locationMotion.set({distance:t.state.distance},0).catch(K),t.pointerType!==`mouse`&&(t.type=`gesture.pan`,this.onPanGesture(t)),t.isFinal)){if(!(`__fixFinalState`in t)){let e=t.state;this.fixFinalState(t.state);let n={x:e.offset.x,y:e.offset.y,z:e.offset.z,distance:e.distance};this.locationMotion.set(n,0).catch(K)}this.panState=void 0,this.pinchState=void 0}}onMouseMove(e){var t,n;if(!this.intersectMesh.parent||this.panState||this.pinchState||this.mouseWheelState||(this.emit(`gesture.mousemove`,e),e.defaultPrevented))return;let r=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}let[i]=this.modelScene.intersectRaycaster(r),a=Q(`intersect.update`,{raycaster:r,intersection:i==null?null:i,object:this.intersectMesh});if(this.emit(`intersect.update`,a),a.defaultPrevented){this.hideIntersectMesh();return}if(i){let e=(n=(t=i.face)==null?void 0:t.normal)==null?new c.Vector3().copy(r.ray.direction).multiplyScalar(-1):n,a=e.clone(),o=i.point.clone();this.intersectMesh.position.copy(o);let s=o.clone().add(a);if(this.intersectMesh.lookAt(s),Math.abs(e.y)>.99){let e=this.camera.position.clone().sub(o);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}onMouseWheel(t){if(this.initAnimationIsReady)if(this.userAction=t.userAction,this.stopMomentumMovement(),this.hideIntersectMesh(),t.isFinal){let e=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov,offset:new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),distance:this.locationMotion.value.distance});if(this.fixFinalState(e),this.emit(`gesture.mousewheel`,t),t.defaultPrevented)return;let n={x:e.offset.x,y:e.offset.y,z:e.offset.z,distance:e.distance};this.locationMotion.set(n,0).catch(K)}else{let n=e.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),r=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),i=Ht(this.cameraMotion.value,new c.Vector3).negate(),a=new c.Ray(r,i).intersectBox(this.modelScene.boundingBox,new c.Vector3);a&&(n+=a.distanceTo(r));let o=Math.max(this.locationMotion.value.distance-this.camera.near,0),s=t.center.delta/10*Math.max(o/5,.1);if(o<=n||s>0)if(this.locationMotion.value.distance-s>=nv){let e=this.locationMotion.value.distance-s;t.state.distance=e}else{let e=Ht(this.cameraMotion.value);e.setLength(s),t.state.offset.add(e)}if(this.emit(`gesture.mousewheel`,t),t.defaultPrevented)return;this.locationMotion.set({distance:t.state.distance,x:t.state.offset.x,y:t.state.offset.y,z:t.state.offset.z},0).catch(K)}}onTapGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=e.center.raycaster,n=this.getForwardObserverOrNot(t);if(!n)this.emit(`gesture.tap`,e);else{let t={longitude:this.camera.pose.longitude,latitude:0},r=Object.assign(Object.assign({},e.state),{mode:`Panorama`,workCode:n.work.workCode,panoIndex:n.panoIndex,longitude:t.longitude,latitude:t.latitude,offset:n?n.position.clone():new c.Vector3,distance:0});if(e.state=r,this.emit(`gesture.tap`,e),!e.defaultPrevented&&(this.emit(`pano.select`,Q(`pano.select`,{prevPano:this.currentPano,pano:{panoIndex:r.panoIndex,workCode:r.workCode},state:r,userAction:e.userAction,options:t,progress:0,error:null})),n&&n.active)){let e=this.pendingTextureId=rn(),i={panoIndex:n.panoIndex,workCode:n.work.workCode},a=Z(i),o={right:n.images.work.getURL(n.images.right),left:n.images.work.getURL(n.images.left),up:n.images.work.getURL(n.images.up),down:n.images.work.getURL(n.images.down),front:n.images.work.getURL(n.images.front),back:n.images.work.getURL(n.images.back)},s=this.imageOptions.transform,l=Object.assign({key:`pano.${a}`},vr(this.imageOptions,[`format`,`size`,`quality`,`sharpen`,`forceUseExifOrientation`,`mappings`])),u=`pano:`+_p([o,l,s]),d=this.modelScene.parameter,f=Ah(`pano.prepare`,{prevPano:this.currentPano,pano:i});if(this.emit(`pano.prepare`,f),f.defaultPrevented){this.pendingTextureId=null;return}let p;d.pano0&&d.pano0.map.name===u?p=d.pano0:d.pano1&&d.pano1.map.name===u&&(p=d.pano1),p?Promise.resolve().then(()=>jh(f)).catch(e=>Qh(e)).then(e=>{var n;e instanceof Error?(this.pendingTextureId=null,e.message&&this.emit(`error`,e)):(d.pano0&&d.pano0.map!==p.map&&d.pano0.map.dispose(),d.pano1&&d.pano1.map!==p.map&&d.pano1.map!==((n=d.pano0)==null?void 0:n.map)&&d.pano1.map.dispose(),d.set({pano0:p,pano1:p}),this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:r.panoIndex,workCode:r.workCode},progress:0,state:r,options:t,error:null})))}):Promise.all([Promise.resolve().then(()=>{this.emit(`pano.texture.load`,Q(`pano.texture.load`,{error:null,progress:0,meta:null,pano:i}))}).then(()=>this.textureLoader.loadCubeTexture(o,{imageURL:{transform:s,options:l},format:c.RGBFormat,viaAjax:!0,fetcher:Ef(this.fiveId,n.work)},void 0,void 0,void 0,this.renderer)).catch(e=>{let t=Qh(e);return this.emit(`pano.texture.error`,Q(`pano.texture.error`,{error:t,progress:0,meta:null,pano:i})),t}),Promise.resolve().then(()=>jh(f)).catch(e=>Qh(e))]).then(([i,o])=>{var s,l;if(!(i instanceof Error)&&!(o instanceof Error)){let{body:o}=i;if(this.destroyed||this.pendingTextureId!==e){o.dispose();return}this.pendingTextureId=null,o.name=u;let f=Array.isArray(o.image)?o.image[0]:o.image,p=(s=f==null?void 0:f.width)==null?2048:s,m=n.images.histogram;m||(m=new bm().formPixels(Kh(this.renderer,o,!0,gm).data),n.images.histogram=m);let h={panoId:a,map:o,mapSize:p,mapHistogram:new c.Vector4().fromArray(m.toArray()),matrix:n.matrix.clone().premultiply(n.work.transform),zoom:1};d.pano0&&d.pano0.map.dispose(),d.pano1&&d.pano1.map!==((l=d.pano0)==null?void 0:l.map)&&d.pano1.map.dispose(),d.set({pano0:h,pano1:h}),this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:r.panoIndex,workCode:r.workCode},progress:0,state:r,options:t,error:null}))}else{let t=null;if(i instanceof Error?t||(t=i):i.body.dispose(),o instanceof Error&&(t||(t=o)),this.destroyed||this.pendingTextureId!==e)return;this.pendingTextureId=null,t instanceof Error&&t.message&&this.emit(`error`,t)}})}}}onDblTapGesture(e){if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let t=e.state,n=e.center.raycaster,r=n.ray.origin.clone().add(n.ray.direction.clone().setLength(3)),i=1,[a]=this.modelScene.intersectRaycaster(n);if(a&&(r=a.point.clone(),i=a.distance>4/2?1:3),e.state.distance=i,e.state.offset=r,this.emit(`gesture.dbltap`,e),e.defaultPrevented)return;let o={x:t.offset.x,y:t.offset.y,z:t.offset.z,distance:t.distance};this.locationMotion.set(o,360).catch(K),this.hideIntersectMesh()}hideIntersectMesh(){this.intersectMesh.visible===!0&&(this.intersectMesh.visible=!1,this.needsRender=!0)}};function ov(e){return e==null}var sv={type:`move`},cv=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}getHandSpace(){return this._hand===null&&(this._hand=new c.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new c.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new c.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new c.Vector3),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new c.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new c.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new c.Vector3),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}getAxes(){return this._axes}update(e,t,n){let r=null,i=null,a=null,o=this._targetRay,s=this._grip,l=this._hand;if(e&&e.gamepad&&e.gamepad.axes&&(this._axes=[e.gamepad.axes[2],e.gamepad.axes[3]]),e&&t.session.visibilityState!==`visible-blurred`)if(o!==null&&(r=t.getPose(e.targetRaySpace,n),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(sv))),l&&e.hand){a=!0;for(let r of e.hand.values()){let e=t.getJointPose(r,n);if(l.joints[r.jointName]===void 0){let e=new c.Group;e.matrixAutoUpdate=!1,e.visible=!1,l.joints[r.jointName]=e,l.add(e)}let i=l.joints[r.jointName];e!==null&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.jointRadius=e.radius),i.visible=e!==null}let r=l.joints[`index-finger-tip`],i=l.joints[`thumb-tip`],o=r.position.distanceTo(i.position),s=.02,u=.005;l.inputState.pinching&&o>s+u?(l.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!l.inputState.pinching&&o<=s-u&&(l.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1));return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),l!==null&&(l.visible=a!==null),this}},lv=1,uv=()=>{try{let e=/Macintosh/i.test(navigator.userAgent),t=navigator.maxTouchPoints===5;return e&&t}catch(e){return console.error(`Error determining if the device is an Apple Vision Pro: `,e),!1}},dv=()=>{try{return/Oculus/i.test(navigator.userAgent)}catch(e){return console.error(`Error determining if the device is an Oculus: `,e),!1}},fv=class{constructor(e,t,n){var r,i,a,o,s;this.isPanorama=(r=n==null?void 0:n.isPanorama)==null?!0:r,navigator.userAgent.toLowerCase();let l;l=uv()?`VP`:dv()?`Oculus`:`Pico`,this.machineType=(i=n==null?void 0:n.machineType)==null?l:i,this.renderer=e,this.gl=t,this.enabled=!1,this.session=null,this.referenceSpaceType=(a=n==null?void 0:n.referenceSpaceType)==null?`local-floor`:a,this.referenceSpace=null,this.onSessionStartCallback=(o=n==null?void 0:n.onSessionStart)==null?K:o,this.onSessionEndCallback=(s=n==null?void 0:n.onSessionEnd)==null?K:s,this.controllers=[new cv,new cv],this.inputSourcesMap=new Map,this.cameraVR=new c.ArrayCamera,this.cameraL=new c.PerspectiveCamera,this.cameraR=new c.PerspectiveCamera,this.cameraVR.cameras.push(this.cameraL,this.cameraR),this.cameraL.viewport=new c.Vector4,this.cameraR.viewport=new c.Vector4,this.cameraL.layers.enable(1),this.cameraR.layers.enable(2),this.cameraVR.layers.enable(1),this.cameraVR.layers.enable(2),this.isPresenting=!1,this.currentDepthNear=null,this.currentDepthFar=null,this.cameraLPos=new c.Vector3,this.cameraRPos=new c.Vector3}getController(e){let t=this.controllers[e];return t||console.warn(`no controller find`),t.getTargetRaySpace()}getRightController(){if(!this.session||!this.session.inputSources)return null;let e;if(this.session.inputSources.forEach((t,n)=>{t.handedness===`right`&&(e=n)}),e===void 0)return console.warn(`no inputSource for right hand`),null;let t=this.controllers[e];return t?t.getTargetRaySpace():(console.warn(`right controller not find`),null)}getLeftController(){if(!this.session||!this.session.inputSources)return null;let e;if(this.session.inputSources.forEach((t,n)=>{t.handedness===`left`&&(e=n)}),e===void 0)return console.warn(`no inputSource for left hand`),null;let t=this.controllers[e];return t?t.getTargetRaySpace():(console.warn(`left controller not find`),null)}getControllerGrip(e){let t=this.controllers[e];return t||console.warn(`no controller find`),t.getGripSpace()}getCameras(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}}updateCamera(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}setProjectionFromUnion(e,t,n){this.cameraLPos.setFromMatrixPosition(t.matrixWorld),this.cameraRPos.setFromMatrixPosition(n.matrixWorld);var r=this.cameraLPos.distanceTo(this.cameraRPos),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var g=o+m,_=s+m,v=f-h,y=p+(r-h),b=c*s/_*g,x=l*s/_*g;e.projectionMatrix.makePerspective(v,y,b,x,g,_)}getCamera(e){this.cameraVR.near=this.cameraR.near=this.cameraL.near=e.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=e.far,this.session&&(this.currentDepthNear!==this.cameraVR.near||this.currentDepthFar!==this.cameraVR.far)&&(this.session.updateRenderState({depthNear:this.cameraVR.near,depthFar:this.cameraVR.far}),this.currentDepthNear=this.cameraVR.near,this.currentDepthFar=this.cameraVR.far);let t=e.parent,n=this.cameraVR.cameras;this.updateCamera(this.cameraVR,t);for(let e=0;e<n.length;e++)this.updateCamera(n[e],t);e.matrixWorld.copy(this.cameraVR.matrixWorld);let r=e.children;for(let e=0,t=r.length;e<t;e++)r[e].updateMatrixWorld(!0);return n.length===2?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR}updateInputSources(e){if(!this.session){console.warn(`session is lose!`);return}let t=this.session.inputSources;for(let e=0;e<this.controllers.length;e++)this.inputSourcesMap.set(t[e],this.controllers[e]);for(let t=0;t<e.removed.length;t++){let n=e.removed[t],r=this.inputSourcesMap.get(n);r&&(r.dispatchEvent({type:`disconnected`,data:n}),this.inputSourcesMap.delete(n))}for(let t=0;t<e.added.length;t++){let n=e.added[t],r=this.inputSourcesMap.get(n);r&&r.dispatchEvent({type:`connected`,data:n})}}onSessionEvent(e){let t=this.inputSourcesMap.get(e.inputSource);t&&t.dispatchEvent({type:e.type})}onSessionEnd(){this.inputSourcesMap.forEach(function(e,t){e.disconnect(t)}),this.inputSourcesMap.clear(),this.isPresenting=!1,this.session=null,si.shared.setContext(null),this.onSessionEndCallback()}onRequestReferenceSpace(e){this.referenceSpace=e,this.isPresenting=!0,this.session&&this.onSessionStartCallback(this.session)}setSession(e){if(this.session=e,this.session){this.session.addEventListener(`select`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`selectstart`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`selectend`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`squeeze`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`squeezestart`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`squeezeend`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`end`,e=>{this.onSessionEnd()});let e=this.gl.getContextAttributes();this.gl.makeXRCompatible().then(()=>{let t={antialias:e==null?void 0:e.antialias,alpha:e==null?void 0:e.alpha,depth:e==null?void 0:e.depth,stencil:e==null?void 0:e.stencil,framebufferScaleFactor:lv};if(!this.session){console.error(`session is lose while set session!`);return}switch(this.machineType){case`Pico`:case`VP`:this.session.updateRenderState({baseLayer:new XRWebGLLayer(this.session,this.gl,t)});break;case`Oculus`:this.session.updateRenderState({baseLayer:new XRWebGLLayer(this.session,this.gl,t)});break;default:this.machineType;break}this.session.requestReferenceSpace(this.referenceSpaceType).then(e=>{this.onRequestReferenceSpace(e)}),this.session.addEventListener(`inputsourceschange`,e=>{this.updateInputSources(e)})})}}},pv=class extends c.InstancedBufferGeometry{constructor(){super(),this.type=`LineSegmentsGeometry`,this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute(`position`,new c.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute(`uv`,new c.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;t=e instanceof Float32Array?e:Array.isArray(e)?new Float32Array(e):new Float32Array;let n=new c.InstancedInterleavedBuffer(t,6,1);return this.setAttribute(`instanceStart`,new c.InterleavedBufferAttribute(n,3,0)),this.setAttribute(`instanceEnd`,new c.InterleavedBufferAttribute(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;t=e instanceof Float32Array?e:Array.isArray(e)?new Float32Array(e):new Float32Array;let n=new c.InstancedInterleavedBuffer(t,6,1);return this.setAttribute(`instanceColorStart`,new c.InterleavedBufferAttribute(n,3,0)),this.setAttribute(`instanceColorEnd`,new c.InterleavedBufferAttribute(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new c.WireframeGeometry(e.geometry)),this}fromLineSegments(e){var t=e.geometry;if(t instanceof c.Geometry){let e=new c.BufferGeometry().fromGeometry(t);this.setPositions(e.attributes.position.array)}else t instanceof c.BufferGeometry&&this.setPositions(t.attributes.position.array);return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new c.Box3);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let n=new c.Box3;this.boundingBox.setFromBufferAttribute(e),n.setFromBufferAttribute(t),this.boundingBox.union(n)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new c.Sphere),this.boundingBox===null&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0,i=new c.Vector3;for(let a=0,o=e.count;a<o;a++)i.fromBufferAttribute(e,a),r=Math.max(r,n.distanceToSquared(i)),i.fromBufferAttribute(t,a),r=Math.max(r,n.distanceToSquared(i));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error(`THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.`,this)}}toJSON(){}};Object.assign(pv.prototype,{isLineSegmentsGeometry:!0});var mv={uniforms:c.UniformsUtils.merge([c.UniformsLib.common,c.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new c.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:`
2041
2041
  #include <common>
2042
2042
  #include <color_pars_vertex>
2043
2043
  #include <fog_pars_vertex>
@@ -2236,7 +2236,7 @@ void main() {
2236
2236
  #include <premultiplied_alpha_fragment>
2237
2237
 
2238
2238
  }
2239
- `},fv=class extends c.ShaderMaterial{constructor(e){super({uniforms:c.UniformsUtils.clone(dv.uniforms),vertexShader:dv.vertexShader,fragmentShader:dv.fragmentShader,clipping:!0}),this.type=`LineMaterial`,this.dashed=!1,Object.defineProperties(this,{color:{enumerable:!0,get(){return this.uniforms.diffuse.value},set(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get(){return this.uniforms.linewidth.value},set(e){this.uniforms.linewidth.value=e}},dashScale:{enumerable:!0,get(){return this.uniforms.dashScale.value},set(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get(){return this.uniforms.dashSize.value},set(e){this.uniforms.dashSize.value=e}},gapSize:{enumerable:!0,get(){return this.uniforms.gapSize.value},set(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(e){this.uniforms.resolution.value.copy(e)}}}),this.setValues(e)}};Object.assign(fv.prototype,{isLineMaterial:!0});var pv=class extends c.Mesh{constructor(e,t){super(),this.type=`LineSegments2`,this.geometry=e===void 0?new uv:e,this.material=t===void 0?new fv({color:Math.random()*16777215}):t}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count),i=new c.Vector3,a=new c.Vector3;for(var o=0,s=0,l=t.count;o<l;o++,s+=2)i.fromBufferAttribute(t,o),a.fromBufferAttribute(n,o),r[s]=s===0?0:r[s-1],r[s+1]=r[s]+i.distanceTo(a);let u=new c.InstancedInterleavedBuffer(r,2,1);return e.setAttribute(`instanceDistanceStart`,new c.InterleavedBufferAttribute(u,1,0)),e.setAttribute(`instanceDistanceEnd`,new c.InterleavedBufferAttribute(u,1,1)),this}raycast(e,t){e.camera===null&&console.error(`LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.`);let n=e.ray,r=e.camera,i=r.projectionMatrix,a=this.geometry,o=this.material,s=o.resolution,l=o.linewidth,u=a.attributes.instanceStart,d=a.attributes.instanceEnd,f=new c.Vector4,p=new c.Vector4,m=new c.Vector4,h=new c.Vector3,g=new c.Matrix4,_=new c.Line3,v=new c.Vector3;n.at(1,m),m.w=1,m.applyMatrix4(r.matrixWorldInverse),m.applyMatrix4(i),m.multiplyScalar(1/m.w),m.x*=s.x/2,m.y*=s.y/2,m.z=0,h.copy(m);let y=this.matrixWorld;g.multiplyMatrices(r.matrixWorldInverse,y);for(var b=0,x=u.count;b<x;b++){f.fromBufferAttribute(u,b),p.fromBufferAttribute(d,b),f.w=1,p.w=1,f.applyMatrix4(g),p.applyMatrix4(g),f.applyMatrix4(i),p.applyMatrix4(i),f.multiplyScalar(1/f.w),p.multiplyScalar(1/p.w);var S=f.z<-1&&p.z<-1,C=f.z>1&&p.z>1;if(S||C)continue;f.x*=s.x/2,f.y*=s.y/2,p.x*=s.x/2,p.y*=s.y/2,_.start.copy(f),_.start.z=0,_.end.copy(p),_.end.z=0;let e=_.closestPointToPointParameter(h,!0);_.at(e,v);let r=c.MathUtils.lerp(f.z,p.z,e),a=r>=-1&&r<=1;var w=h.distanceTo(v)<l*.5;if(a&&w){_.start.fromBufferAttribute(u,b),_.end.fromBufferAttribute(d,b),_.start.applyMatrix4(y),_.end.applyMatrix4(y);var T=new c.Vector3,E=new c.Vector3;n.distanceSqToSegment(_.start,_.end,E,T),t.push({point:E,pointOnLine:T,distance:n.origin.distanceTo(E),object:this,faceIndex:b})}}}};Object.assign(pv.prototype,{isLineSegments2:!0});var mv=class extends pv{constructor(e,t){super(e,t),this.type=`Line2`}};Object.assign(mv.prototype,{isLine2:!0});var hv=class extends uv{constructor(){super(),this.type=`LineGeometry`}setPositions(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setColors(n),this}fromLine(e){let t=e.geometry;if(t instanceof c.Geometry){let e=new c.BufferGeometry().fromGeometry(t);this.setPositions(e.attributes.position.array)}else t instanceof c.BufferGeometry&&this.setPositions(t.attributes.position.array);return this}copy(){return this}};Object.assign(hv.prototype,{isLineGeometry:!0});var gv=14467195,_v=8,vv=2,yv=20,bv=null,xv=class extends c.Object3D{static get version(){return`6.8.0-alpha.27`}constructor(e=new c.Vector3,t=new c.Vector3){super(),this.type=`FiveLine`,this.needsRender=!0,this.line=new mv(new hv,new fv({color:gv,linewidth:vv,dashScale:yv,dashed:!1}));let n=new c.BufferGeometry,r=new c.PointsMaterial({color:gv,size:_v,map:bv||(bv=new c.TextureLoader().load(`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==`)),sizeAttenuation:!1,transparent:!0});this.points=new c.Points(n,r),this.points.renderOrder=11,this.points.frustumCulled=!1,this.setPoints(e,t),this.add(this.line,this.points)}setPoints(e,t){let n=[].concat(e.toArray(),t.toArray());this.points.geometry.setAttribute(`position`,new c.BufferAttribute(new Float32Array(n),3)),this.line.geometry.setPositions(n),this.line.computeLineDistances(),this.needsRender=!0}getPoints(){let e=this.points.geometry.attributes.position.array;return[new c.Vector3(e[0],e[1],e[2]),new c.Vector3(e[3],e[4],e[5])]}setMaterial(e){let t=this.line.material;for(let n in e){if(!e.hasOwnProperty(n))continue;let r=e[n];n===`dashed`?(t.dashed=r,r?t.defines.USE_DASH=``:delete t.defines.USE_DASH,t.needsUpdate=!0):t[n]=e[n]}this.needsRender=!0}setResolution(e,t){let n=this.line.material.resolution;(n.x!==e||n.y!==t)&&(n.set(e,t),this.needsRender=!0)}};Object.assign(xv.prototype,{isFiveLine:!0});var Sv={Handedness:Object.freeze({NONE:`none`,LEFT:`left`,RIGHT:`right`}),ComponentState:Object.freeze({DEFAULT:`default`,TOUCHED:`touched`,PRESSED:`pressed`}),ComponentProperty:Object.freeze({BUTTON:`button`,X_AXIS:`xAxis`,Y_AXIS:`yAxis`,STATE:`state`}),ComponentType:Object.freeze({TRIGGER:`trigger`,SQUEEZE:`squeeze`,TOUCHPAD:`touchpad`,THUMBSTICK:`thumbstick`,BUTTON:`button`}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:`transform`,VISIBILITY:`visibility`})};function Cv(e){return Go(this,void 0,void 0,function*(){let t=yield fetch(e);if(t.ok)return t.json();throw Error(t.statusText)})}function wv(e){return Go(this,void 0,void 0,function*(){if(!e)throw Error(`No basePath supplied`);return yield Cv(`${e}/profilesList.json`)})}function Tv(e,t){return Go(this,arguments,void 0,function*(e,t,n=null,r=!0){if(!e)throw Error(`No xrInputSource supplied`);if(!t)throw Error(`No basePath supplied`);let i=yield wv(t),a;if(e.profiles.some(e=>{let n=i[e];return n&&(a={profileId:e,profilePath:`${t}/${n.path}`,deprecated:!!n.deprecated}),!!a}),!a){if(!n)throw Error(`No matching profile name found`);let e=i[n];if(!e)throw Error(`No matching profile name found and default profile "${n}" missing.`);a={profileId:n,profilePath:`${t}/${e.path}`,deprecated:!!e.deprecated}}let o=yield Cv(a.profilePath),s;if(r){let t;if(t=o.layouts[e.handedness],!t)throw Error(`No matching handedness, ${e.handedness}, in profile ${a.profileId}`);t.assetPath&&(s=a.profilePath.replace(`profile.json`,t.assetPath))}return{profile:o,assetPath:s}})}var Ev={xAxis:0,yAxis:0,button:0,state:Sv.ComponentState.DEFAULT};function Dv(e=0,t=0){let n=e,r=t;if(Math.sqrt(e*e+t*t)>1){let i=Math.atan2(t,e);n=Math.cos(i),r=Math.sin(i)}return{normalizedXAxis:n*.5+.5,normalizedYAxis:r*.5+.5}}var Ov=class{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===Sv.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Ev)}updateFromComponent({xAxis:e,yAxis:t,button:n,state:r}){let{normalizedXAxis:i,normalizedYAxis:a}=Dv(e,t);switch(this.componentProperty){case Sv.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?i:.5;break;case Sv.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?a:.5;break;case Sv.ComponentProperty.BUTTON:this.value=this.states.includes(r)?n:0;break;case Sv.ComponentProperty.STATE:this.valueNodeProperty===Sv.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=this.states.includes(r)?1:0;break;default:throw Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}},kv=class{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw Error(`Invalid arguments supplied`);this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(e=>{let n=new Ov(t.visualResponses[e]);this.visualResponses[e]=n}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:Sv.ComponentState.DEFAULT,button:this.gamepadIndices.button===void 0?void 0:0,xAxis:this.gamepadIndices.xAxis===void 0?void 0:0,yAxis:this.gamepadIndices.yAxis===void 0?void 0:0}}get data(){return Object.assign({id:this.id},this.values)}updateFromGamepad(e){if(this.values.state=Sv.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){let t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=Sv.ComponentState.PRESSED:(t.touched||this.values.button>Sv.ButtonTouchThreshold)&&(this.values.state=Sv.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Sv.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Sv.AxisTouchThreshold&&(this.values.state=Sv.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Sv.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Sv.AxisTouchThreshold&&(this.values.state=Sv.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(e=>{e.updateFromComponent(this.values)})}},Av=class{constructor(e,t,n){if(!e)throw Error(`No xrInputSource supplied`);if(!t)throw Error(`No profile supplied`);this.xrInputSource=e,this.assetUrl=n,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(e=>{let t=this.layoutDescription.components[e];this.components[e]=new kv(e,t)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){let e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}},jv=`https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles`,Mv=`generic-trigger`,Nv=class extends c.Object3D{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(e){return this.envMap==e?this:(this.envMap=e,this.traverse(e=>{e instanceof c.Mesh&&e.isMesh&&(e.material.envMap=this.envMap,e.material.needsUpdate=!0)}),this)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(e=>{Object.values(e.visualResponses).forEach(e=>{let{valueNode:t,minNode:n,maxNode:r,value:i,valueNodeProperty:a}=e;t&&(a===Sv.VisualResponseProperty.VISIBILITY?t.visible=i:a===Sv.VisualResponseProperty.TRANSFORM&&(t.quaternion.copy(n.quaternion).slerp(r.quaternion,i),t.position.lerpVectors(n.position,r.position,i)))})}))}};function Pv(e,t){Object.values(e.components).forEach(e=>{let{type:n,touchPointNodeName:r,visualResponses:i}=e;if(n===Sv.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(r),e.touchPointNode){let t=new c.Mesh(new c.SphereGeometry(.001),new c.MeshBasicMaterial({color:255}));e.touchPointNode.add(t)}else console.warn(`Could not find touch dot, ${e.touchPointNodeName}, in touchpad component ${e.id}`);Object.values(i).forEach(e=>{let{valueNodeName:n,minNodeName:r,maxNodeName:i,valueNodeProperty:a}=e;if(a===Sv.VisualResponseProperty.TRANSFORM){if(e.minNode=t.getObjectByName(r),e.maxNode=t.getObjectByName(i),!e.minNode){console.warn(`Could not find ${r} in the model`);return}if(!e.maxNode){console.warn(`Could not find ${i} in the model`);return}}e.valueNode=t.getObjectByName(n),e.valueNode||console.warn(`Could not find ${n} in the model`)})})}function Fv(e,t){Pv(e.motionController,t),e.envMap&&t.traverse(t=>{t instanceof c.Mesh&&t.isMesh&&(t.material.envMap=e.envMap,t.material.needsUpdate=!0)}),e.add(t)}var Iv=class{constructor(e=null){this.gltfLoader=e,this.path=jv,this._assetCache={}}createControllerModel(e){let t=new Nv,n=null;return e.addEventListener(`connected`,e=>{let r=e.data;r.targetRayMode!==`tracked-pointer`||!r.gamepad||Tv(r,this.path,Mv).then(({profile:e,assetPath:i})=>{t.motionController=new Av(r,e,i);let a=this._assetCache[t.motionController.assetUrl];if(a)n=a.scene.clone(),Fv(t,n);else{if(!this.gltfLoader)throw Error(`GLTFLoader not set.`);this.gltfLoader.load(t.motionController.assetUrl,e=>{this._assetCache[t.motionController.assetUrl]=e,n=e.scene.clone(),Fv(t,n)})}}).catch(e=>{console.warn(e)})}),e.addEventListener(`disconnected`,()=>{t.motionController=null,t.remove(n),n=null}),t}},Lv=Object.assign({},yr($g,[`maxLatitude`,`minLatitude`]));function Rv(e,t){if(!t)return e;let n=e.match(/\d+_[a-z].png/);return e.substring(0,n.index)+t+`/`+e.substring(n.index)}var zv=300,Bv=new c.Raycaster,Vv=new c.Vector3,Hv={Floorplan:$h,Topview:tg,Panorama:e_,VRPanorama:G_,Model:X_,Mapview:nv,XRPanorama:class e extends e_{static parseArgs(t){if(t instanceof e)return t;let n=Object.assign(Object.assign({},t),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return super.parseArgs(n)}static initAnimationEndState(e){let t=this.parseArgs(e),n=super.initAnimationEndState(t);return Object.assign(Object.assign({},n),{mode:`XRPanorama`})}constructor(e){super(e),this.xrManager=new lv(this.renderer,this.renderer.getContext(),{onSessionStart:e=>{this.emit(`xr.session.start`,Q(`xr.session.start`,{session:e,machineType:this.xrManager.machineType}))},onSessionEnd:()=>{this.emit(`xr.session.end`,Q(`xr.session.end`,{session:null,machineType:this.xrManager.machineType}))}}),this.xrControllerRay={left:new c.Raycaster,right:new c.Raycaster},this.xrControllerRay.left.params.Points={threshold:.1},this.xrControllerRay.left.firstHitOnly=!0,this.xrControllerRay.left.floorIndex=-1,this.xrControllerRay.right.params.Points={threshold:.1},this.xrControllerRay.right.firstHitOnly=!0,this.xrControllerRay.right.floorIndex=-1,this.gazeRay=null,this.pointerLines={left:new xv,right:new xv},this.pointerLines.left.visible=!1,this.pointerLines.right.visible=!0,this.pointerLines.left.setMaterial({color:new c.Vector3(1,1,1)}),this.pointerLines.left.points.material.depthTest=!1,this.pointerLines.right.setMaterial({color:new c.Vector3(1,1,1)}),this.pointerLines.right.points.material.depthTest=!1,this.controllerWrappers=[new c.Group,new c.Group];let t=this.xrManager.getController(0);this.controllerWrappers[0].add(t);let n=this.xrManager.getController(1);this.controllerWrappers[1].add(n);let r=new Iv;r.gltfLoader={load(e,t){_r.ajax(e,{responseType:`arraybuffer`}).then(t=>{var n;return cs(t.body,{resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(n=e.split(`?`)[1])==null?``:n,fetcher:_r})}).then(e=>t(e))}},(this.xrManager.machineType===`Oculus`||this.xrManager.machineType===`Pico`)&&this.scene.add(this.pointerLines.left,this.pointerLines.right,this.controllerWrappers[0],this.controllerWrappers[1]),this.panoResources={},this.panoResources[this.locationMotion.keyframes[0].key=this.locationMotion.keyframes[1].key=rn()]={panoId:Z(this.currentPano),leftPanoPicture:null,position:this.camera.pose.offset.clone(),effect:`fade`,effectEasing:Yg,fixCameraTransform:new c.Matrix4},this.parallaxCameraMatrixs=[];let i=si.shared.getContext();if(!i){console.error(`获取session失败,请退出重试`);return}this.on(`xr.session.end`,()=>{this.scene.remove(this.pointerLines.left,this.pointerLines.right)}),this.xrManager.setSession(i),this.on(`xr.session.start`,()=>{let e=this.xrManager.getControllerGrip(0);e.add(r.createControllerModel(e)),this.controllerWrappers[0].add(e);let t=this.xrManager.getControllerGrip(1);t.add(r.createControllerModel(t)),this.controllerWrappers[1].add(t)}),this.xrHandleState={LeftAxesUp:{touchStartTime:0,touchStart:!1},LeftAxesDown:{touchStartTime:0,touchStart:!1},LeftAxesLeft:{touchStartTime:0,touchStart:!1},LeftAxesRight:{touchStartTime:0,touchStart:!1},LeftTrigger:{touchStartTime:0,touchStart:!1},LeftPinch:{touchStartTime:0,touchStart:!1},RightAxesUp:{touchStartTime:0,touchStart:!1},RightAxesDown:{touchStartTime:0,touchStart:!1},RightAxesLeft:{touchStartTime:0,touchStart:!1},RightAxesRight:{touchStartTime:0,touchStart:!1},RightTrigger:{touchStartTime:0,touchStart:!1},RightPinch:{touchStartTime:0,touchStart:!1},Y:{touchStartTime:0,touchStart:!1},X:{touchStartTime:0,touchStart:!1},A:{touchStartTime:0,touchStart:!1},B:{touchStartTime:0,touchStart:!1}},this.xrManager.machineType===`VP`&&this.initHandEvent()}updateConfiguration(e){return super.updateConfiguration(Object.assign(Object.assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))}moveToPano(e,t,n){var r,i,a;let o=(r=t.effect)==null?`fade`:r;this.userAction=n,this.stopMomentumMovement();let s=Z(e),l=this.works.getObserver(e);if(!l)throw Error(`Invalid PanoIndex`);let u=$r(l.images.up),d=this.imageOptions.size;d===void 0&&l&&u&&(d=Number(u)),d===void 0&&(d=2048);let f=this.imageOptions.transform,p=(e,t)=>Rv(Zr(e,f,t)),m=Object.assign({key:`pano.${s}`},vr(this.imageOptions,[`format`,`size`,`quality`])),h={right:l.images.work.getURL(l.images.right),left:l.images.work.getURL(l.images.left),up:l.images.work.getURL(l.images.up),down:l.images.work.getURL(l.images.down),front:l.images.work.getURL(l.images.front),back:l.images.work.getURL(l.images.back)},g=`pano:`+mp([h,m,f]);if(this.pendingPanoTask){if(this.pendingPanoTask.hash===g)return;{let t=this.pendingPanoTask.panoId;(i=this.panoMeshes.get(t))==null||i.setProgress(0),this.emit(`pano.texture.abort`,Q(`pano.texture.abort`,{error:null,progress:0,meta:null,pano:e}))}}let _=`move-to-pano-`+s;this.pending.add(_);let v=Dh(`pano.prepare`,{prevPano:this.currentPano,pano:e});if(this.emit(`pano.prepare`,v),v.defaultPrevented){this.pending.delete(_);return}let y=this.modelScene.parameter,b;if(y.pano0&&y.pano0.map.name===g?b=y.pano0:y.pano1&&y.pano1.map.name===g&&(b=y.pano1),b){let n={panoId:s,effect:o,effectEasing:(a=t.effectEasing)==null?Yg:a,leftPanoPicture:{panoId:b.panoId,map:b.map,mapHistogram:b.mapHistogram,mapSize:b.mapSize,matrix:l.matrix.clone().premultiply(l.work.transform),zoom:1},position:l.position.clone().applyMatrix4(l.work.transform),fixCameraTransform:new c.Matrix4};n.leftPanoPicture&&this.panoPictureObserverMap.set(n.leftPanoPicture,l),this.pendingPanoTask=void 0,Promise.resolve().then(()=>Oh(v)).catch(e=>{let t=Yh(e);return this.emit(`error`,t),t}).then(r=>{var i,a;if(!(r instanceof Error))this.pending.delete(_),this.pendingPanoTask=void 0,(i=this.panoMeshes.get(s))==null||i.setProgress(0),this.doMoveToPano(e,n,t);else{let e=null;r instanceof Error&&(e||(e=r));let n=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{error:null,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),t.moveCancelCallback&&t.moveCancelCallback(),this.emit(`pano.error`,Q(`pano.error`,{error:e,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),e instanceof Error&&e.message&&this.emit(`error`,e),this.pending.delete(_),this.pendingPanoTask=void 0,(a=this.panoMeshes.get(s))==null||a.setProgress(0)}});return}let x=this.panoMeshes.get(s);x&&x.tap&&x.tap(),this.pendingPanoTask={panoId:s,hash:g,onLoad:n=>{var r,i;let a=n.body;if(this.destroyed)a.dispose();else{a.name=g;let n=Array.isArray(a.image)?a.image[0]:a.image,u=(r=n==null?void 0:n.width)==null?2048:r,d=new _m().formPixels(Uh(this.renderer,a,!0,pm).data),f={panoId:s,effect:o,effectEasing:(i=t.effectEasing)==null?Yg:i,leftPanoPicture:{panoId:s,map:a,mapSize:u,mapHistogram:new c.Vector4().fromArray(d.toArray()),matrix:l.matrix.clone(),zoom:1},position:l.position.clone(),fixCameraTransform:new c.Matrix4};f.leftPanoPicture&&this.panoPictureObserverMap.set(f.leftPanoPicture,l),this.doMoveToPano(e,f,t)}},onError:e=>{let n=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{error:null,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),this.emit(`pano.error`,Q(`pano.error`,{error:e,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),e instanceof Error&&e.message&&this.emit(`error`,e),t.moveCancelCallback&&t.moveCancelCallback()}},Promise.all([Promise.resolve().then(()=>{this.emit(`pano.texture.load`,Q(`pano.texture.load`,{error:null,progress:0,meta:null,pano:e}))}).then(()=>this.textureLoader.loadCubeTexture(h,{imageURL:{transform:p,options:m},format:c.RGBFormat,viaAjax:!0,fetcher:Cf(this.fiveId,l.work)},void 0,void 0,t=>{var n,r;this.emit(`pano.texture.progress`,Q(`pano.texture.progress`,{error:null,progress:t,meta:null,pano:e})),((n=this.pendingPanoTask)==null?void 0:n.hash)===g&&((r=this.panoMeshes.get(s))==null||r.setProgress(t))},this.renderer)).catch(t=>{let n=Yh(t);return this.emit(`pano.texture.error`,Q(`pano.texture.error`,{error:n,progress:0,meta:null,pano:e})),n}),Promise.resolve().then(()=>Oh(v)).catch(e=>Yh(e))]).then(([t,n])=>{var r,i,a,o;if(!(t instanceof Error)&&!(n instanceof Error))this.pending.delete(_),((r=this.pendingPanoTask)==null?void 0:r.hash)===g?(this.pendingPanoTask.onLoad(t),this.pendingPanoTask=void 0,(i=this.panoMeshes.get(s))==null||i.setProgress(0)):t.body.dispose(),this.emit(`pano.texture.success`,Q(`pano.texture.success`,{error:null,progress:1,meta:t.meta,pano:e}));else{let e=null;t instanceof Error?e||(e=t):t.body.dispose(),n instanceof Error&&(e||(e=n)),this.pending.delete(_),((a=this.pendingPanoTask)==null?void 0:a.hash)===g&&(this.pendingPanoTask.onError(e),this.pendingPanoTask=void 0,(o=this.panoMeshes.get(s))==null||o.setProgress(0))}})}doMoveToPano(e,t,n={}){var r,i,a,o,s,l,u,d,f,p;let m=H(),h=rn();this.panoResources[h]=t;let g,_,v;if(this.locationMotion.ended){let[e,n]=this.locationMotion.getKeyFrameSegment(m),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(n).position,a=t.position;g=Math.max(i.distanceTo(a),1),_=[{key:n.key,progress:0,value:Object.assign(Object.assign({},r),{count:0})},{key:h,progress:1,value:{distance:0,count:1}}],v=0}else{let[e,n]=this.locationMotion.getKeyFrameSegment(m),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(e).position,a=this.panoResourceFromLocationMotionKeyframe(n).position,o=t.position,s=n.value.count-r.count,c=Math.max(i.distanceTo(a),1)*s;g=c+Math.max(a.distanceTo(o),1),_=[{key:e.key,progress:0,value:Object.assign({},r)},{key:n.key,progress:c/g,value:n.value},{key:h,progress:1,value:{count:n.value.count+1,distance:0}}];let l=this.locationMotionKeyframesLength(this.locationMotion.keyframes),u=this.locationMotionKeyframesLength(_);v=this.locationMotion.getProgressVelocity(m)*l/u}let y=t.effect===`instant`?0:this.calculateMovingDuration(n.duration,t.effect===`fly`||t.effect===`model`?g:0),b={longitude:n.longitude,latitude:n.latitude,fov:n.fov},x=Object.assign(Object.assign({},e),{mode:this.mode,longitude:(r=b.longitude)==null?this.camera.pose.longitude:r,latitude:(i=b.latitude)==null?this.camera.pose.latitude:i,fov:(a=b.fov)==null?this.camera.pose.fov:a,offset:t.position.clone(),distance:0}),S=this.currentPano;if(this.emit(`pano.moveTo`,Q(`pano.moveTo`,{options:n,prevPano:S,pano:{panoIndex:x.panoIndex,workCode:x.workCode},progress:0,state:x,userAction:this.userAction,error:null})),n.moveStartCallback&&n.moveStartCallback(x),this.perspToOrthoMotion.set({perspToOrtho:0},y).catch(K),this.modelAlphaMotion.setKeyframes([{progress:0,value:Object.assign({},this.modelAlphaMotion.value)},{progress:.6,value:Object.assign({},this.modelAlphaMotion.value)},{progress:1,value:{modelAlpha:0}}],y).catch(K),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute(`src`)&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute(`uuid`),this.videoTexture.image.removeAttribute(`src`),this.videoTexture.image.oncanplay=K,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),t.effect===`fly`||t.effect===`model`)this.cameraMotion.set(b,y).catch(K);else{let e=Ht({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),n=Ht({longitude:(o=b.longitude)==null?this.cameraMotion.value.longitude:o,latitude:(s=b.latitude)==null?this.cameraMotion.value.latitude:s}),r=new c.Object3D;r.lookAt(e);let i=new c.Matrix4().makeRotationFromQuaternion(r.quaternion);r.lookAt(n);let a=new c.Matrix4().makeRotationFromQuaternion(r.quaternion),m=new c.Matrix4().getInverse(i).premultiply(a),h=this.cameraMotion.value.fov,g=(l=b.fov)==null?this.cameraMotion.value.fov:l,v=1;t.effect===`zoomin`?v=1.5:t.effect===`zoomout`&&(v=.4);let x=g*v;for(let e=0;e<_.length-1;e++){let t=_[e].key;if(t){let e=this.panoResources[t];e&&(e.fixCameraTransform.copy(m),e.leftPanoPicture&&(e.leftPanoPicture.zoom=Math.tan(x/2/180*Math.PI)/Math.tan(h/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(u=b.longitude)==null?this.cameraMotion.value.longitude:u,latitude:(d=b.latitude)==null?this.cameraMotion.value.latitude:d,fov:x}},{progress:1,value:{longitude:(f=b.longitude)==null?this.cameraMotion.value.longitude:f,latitude:(p=b.latitude)==null?this.cameraMotion.value.latitude:p,fov:g}}],y).catch(K)}this.locationMotion.setKeyframes(_,y,v).then(()=>{for(let e of this.modelScene.children)e instanceof Hf&&e.show();let t=Object.assign(Object.assign({},e),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:0});this.emit(`pano.arrived`,Q(`pano.arrived`,{options:n,prevPano:S,pano:{panoIndex:t.panoIndex,workCode:t.workCode},progress:1,state:t,userAction:this.userAction,error:null})),n.moveEndCallback&&n.moveEndCallback(t);let r=this.works.getObserver(this.currentPano);if(r&&r.images.video&&this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement){let e={map:this.videoTexture,size:r.images.video.size.clone(),matrix:r.images.video.matrix.clone(),panoMatrix:r.matrix.clone().premultiply(r.work.transform),alpha:1},t=rn(),n=this.videoTexture.image;n.setAttribute(`uuid`,t),og().then(i=>{i&&r.images.video&&n.getAttribute(`uuid`)===t&&(n.oncanplay=()=>{n.oncanplay=K,n.play()},n.ontimeupdate=()=>{n.currentTime>.5&&(n.ontimeupdate=K,this.panoVideo.setMaterial(e))},n.src=r.images.video.source)}).catch((()=>{n.removeAttribute(`uuid`)}))}},()=>{let e=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{options:n,prevPano:S,pano:{panoIndex:e.panoIndex,workCode:e.workCode},progress:0,state:e,userAction:this.userAction,error:null})),n.moveCancelCallback&&n.moveCancelCallback()})}checkSelectedPano(e){var t;this.stopMomentumMovement(),this.camera.getDirection(new c.Vector3).setY(0);let n=null,r=this.works.getObserver(this.currentPano);if(!r)return null;let i=r.work.observers,a=r.accessibleNodes.filter(e=>{if(e===this.currentPano.panoIndex&&r.work.workCode===this.currentPano.workCode)return!1;let t=i[e];return!t||Vv.copy(t.position).applyMatrix4(t.work.transform).distanceTo(this.camera.position)>this.maxAccessibleDistance?!1:t.loadable||t.active}),[o]=this.modelScene.intersectRaycaster(e);if(o){let[e,r]=zl(a,e=>{let t=i[e];return t?Vv.copy(t.standingPosition).applyMatrix4(t.work.transform).distanceTo(o.point):1/0},!0);typeof e==`number`&&r<this.panoTapTriggerRadius&&(n=(t=i[e])==null?null:t)}if(rv(n)){let t=this.getForwardObserverOrNot(this.xrManager.cameraVR,e);t&&(n=t)}for(let e of this.locationMotion.keyframes){let t=this.panoResourceFromLocationMotionKeyframe(e);if(!(e.progress<this.locationMotion.progress)&&n){let e=Z({panoIndex:n.panoIndex,workCode:n.work.workCode});if(t.panoId===e){n=null;break}}}if(rv(n))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!n.active){let e=Z({panoIndex:n.panoIndex,workCode:n.work.workCode}),t=this.panoMeshes.get(e);t&&(t.setDisabled(!1),t.setLoading(!0))}let s={workCode:n.work.workCode,panoIndex:n.panoIndex,mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:0,offset:n?n.position.clone():new c.Vector3};return this.emit(`pano.select`,Q(`pano.select`,{prevPano:this.currentPano,pano:{panoIndex:s.panoIndex,workCode:s.workCode},state:s,userAction:!0,options:{},progress:0,error:null})),n&&n.active?(this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:s.panoIndex,workCode:s.workCode},progress:0,state:s,options:{},error:null})),{workCode:n.work.workCode,panoIndex:n.panoIndex}):null}destroy(){super.destroy()}isReady(){return!1}updateCamera(e,t,n){return Promise.resolve()}updateCameraWithKeyframes(e,t,n){return Promise.resolve()}updateTime(e,t,...n){var r,i,a,o,s,l,u,d,f;this.userAction=!0;let p={},m={},h=this.camera.getDirection(new c.Vector3),g=this.locationMotion.keyframes[0],_=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[v,y]=this.locationMotion.getKeyFrameSegment(e),b=this.panoResourceFromLocationMotionKeyframe(v),x=this.panoResourceFromLocationMotionKeyframe(y),S=this.panoResourceFromLocationMotionKeyframe(g),C=this.panoResourceFromLocationMotionKeyframe(_),w=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),m.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),p.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(U(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let t=this.locationMotion.value.count-y.value.count+1,n=new c.Vector3().copy(b.position),a=new c.Vector3().copy(x.position);if(p.progress=t,t>=.01&&t<=.99&&(p.progress=U(x.effectEasing(t),.01,.99)),x.leftPanoPicture&&(t<1?b.leftPanoPicture&&(p.pano0=b.leftPanoPicture):p.pano0=x.leftPanoPicture,p.pano1=x.leftPanoPicture),x.effect===`montage`?p.transition=`BLACK`:x.effect===`spread`?p.transition=`SPREAD`:p.transition=`FADE`,x.effect===`zoomin`||x.effect===`zoomout`?p.progress=Math.pow(t,3):x.effect===`model`&&this.camera.pose.distance<.01&&(p.modelAlpha=1-Math.pow(U(Math.abs(t-.5)*2,0,1),4)),t<1&&x.effect!==`fly`){if(p.pano0&&b.leftPanoPicture){let e={panoId:p.pano0.panoId,map:p.pano0.map,mapHistogram:p.pano0.mapHistogram,mapSize:p.pano0.mapSize,zoom:p.pano0.zoom,matrix:b.leftPanoPicture.matrix.clone().setPosition(x.position)},t=this.panoPictureObserverMap.get(p.pano0);t&&this.panoPictureObserverMap.set(e,t),p.pano0=e}n.copy(a),w=!0}m.distance=this.locationMotion.value.distance,m.offset=new c.Vector3(n.x+(a.x-n.x)*t,n.y+(a.y-n.y)*t,n.z+(a.z-n.z)*t);let o=[],s=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(o.push(t),n>this.locationMotion.progress&&s.push(t))}for(let e of Object.keys(this.panoResources)){if(s.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.leftPanoPicture){let e=t.leftPanoPicture.map;if(e){if(e===((r=p.pano0)==null?void 0:r.map)||e===((i=p.pano1)==null?void 0:i.map))continue;e.dispose(),t.leftPanoPicture=null}}o.indexOf(e)>=0||delete this.panoResources[e]}let l=gp(x.panoId);l!==this.currentPano&&(this.currentPano=l,this.accessibleObserverFloorCheckCount=0),this.emit(`pano.moving`,Q(`pano.moving`,{userAction:this.userAction,prevPano:gp(S.panoId),pano:gp(C.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},gp(C.panoId)),{mode:this.mode}),$(this.camera.pose)),m),options:{},progress:this.locationMotion.progress,error:null}))}this.camera.setFromPose(m),this.xrManager.cameraVR.projectionMatrix.copy(this.camera.projectionMatrix),this.xrManager.cameraVR.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.xrManager.cameraVR.matrix.copy(this.camera.matrix),this.xrManager.cameraVR.position.copy(this.camera.position),this.xrManager.cameraVR.quaternion.copy(this.camera.quaternion),this.xrManager.cameraVR.scale.copy(this.camera.scale),this.xrManager.cameraVR.matrixAutoUpdate=!1,this.xrManager.cameraVR.matrixWorld.copy(this.camera.matrixWorld);let[T,E]=n,D=new c.Vector3(0,0,0),O=new c.Vector2().copy(this.camera.resolution);if(E&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){let n=this.xrManager.cameraVR,r=this.xrManager.referenceSpace,i=this.xrManager.session.renderState.baseLayer,l=E.getViewerPose(r),u=(a=l==null?void 0:l.views)==null?[]:a;for(let e=0;e<u.length;e++){let t=u[e],r=n.cameras[e],a=i.getViewport(t);a&&(r.projectionMatrix.fromArray(t.projectionMatrix),r.projectionMatrixInverse.getInverse(r.projectionMatrix),r.matrix.fromArray(t.transform.matrix),r.matrix.setPosition(this.camera.position),r.matrix.decompose(r.position,r.quaternion,r.scale),r.matrixWorld.copy(r.matrix),r.matrixWorldInverse.getInverse(r.matrixWorld),r.matrixAutoUpdate=!1,D.copy(r.position),r.viewport.set(a.x,a.y,a.width,a.height),O.set(a.width,a.height))}if(this.xrManager.setProjectionFromUnion(this.xrManager.cameraVR,this.xrManager.cameraL,this.xrManager.cameraR),this.camera.quaternion.copy(this.xrManager.cameraVR.quaternion),this.camera.scale.copy(this.xrManager.cameraVR.scale),this.camera.matrix.compose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.computePose((o=m.distance)==null?this.camera.pose.distance:o),this.xrManager.session.inputSources){for(let e=0;e<this.xrManager.session.inputSources.length;e++)if(this.xrManager.session.inputSources[e]&&this.xrManager.session.inputSources[e].targetRayMode===`transient-pointer`){let t=E.getPose(this.xrManager.session.inputSources[e].targetRaySpace,r);if(t){let e=t.transform.orientation,n=new c.Quaternion(e.x,e.y,e.z,e.w),r=new c.Vector3(0,0,-1).applyQuaternion(n);this.gazeRay=new c.Raycaster(this.camera.position,r)}}}if(this.xrManager.machineType===`Oculus`||this.xrManager.machineType===`Pico`){let n=this.xrManager.session.inputSources;for(let e=0;e<n.length;e++){let t=this.xrManager.controllers[e],i=n[e];if(!i)continue;t&&t.update(i,E,r);let a=this.xrManager.getController(e),o=new c.Vector3(0,1.2,0),l=a.position.clone().add(D).sub(o);i.handedness===`left`?this.xrControllerRay.left.set(l,new c.Vector3(0,0,-1).applyEuler(a.rotation)):i.handedness===`right`&&this.xrControllerRay.right.set(l,new c.Vector3(0,0,-1).applyEuler(a.rotation)),this.controllerWrappers[e].position.copy(new c.Vector3(0,0,0).add(D).sub(o));let u=this.modelScene.intersectRaycaster(this.xrControllerRay.right);if(u.length===0){let e=this.works.getResolvedObserver(this.currentPano);u=this.xrControllerRay.right.intersectObject(this.modelScene.boundingMesh,!0).map(t=>{var n;let r=(n=e==null?void 0:e.floorIndex)==null?0:n;return Object.assign({floorIndex:r,floor:r},t)})}if(u.length>=1&&u[0].face)if(i.handedness===`right`){let e=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),t=u[0].face.normal,n=t.clone(),r=u[0].point.clone();this.intersectMesh.position.copy(r);let i=r.clone().add(n);if(this.intersectMesh.lookAt(i),Math.abs(t.y)>.99){let e=this.camera.position.clone().sub(r);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0,e.length>0?(this.pointerLines.right.setPoints(l,e[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(l,u[0].point));let a=u[0],o=Q(`intersect.update`,{raycaster:(s=this.xrControllerRay.right)==null?null:s,intersection:a==null?null:a,object:this.intersectMesh});if(this.emit(`intersect.update`,o),o.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(l,u[0].point)}this.updateControllerHelper(n,e,t)}}else E||console.error(`xrFrame丢失,请重试`),this.xrManager.session||console.error(`session丢失,请重试`),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error(`no layer found`);Ih(p)===!1&&this.modelScene.parameter.set(p),this.emit(`camera.update`,Q(`camera.update`,{userAction:this.userAction,state:Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose))}));let k=this.works.getResolvedObserver(this.currentPano),A=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,j=this.works.getObserver(b.panoId),M=this.works.getObserver(x.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&k){let e=[],t=k.work.observers;for(let n of k.accessibleNodes){let r=t[n];r&&e.push(r)}let n=new Map;if(e.sort((e,t)=>{let r=n.get(e);r===void 0&&(r=e.standingPosition.distanceTo(k.standingPosition),n.set(e,r));let i=n.get(e);return i===void 0&&(i=t.standingPosition.distanceTo(k.standingPosition),n.set(t,i)),r-i}),e.length){this.accessibleObserverFloorCheckCount%=e.length;let t=e[this.accessibleObserverFloorCheckCount],n=this.modelScene.models.find(e=>e.work===(t==null?void 0:t.work));if(t&&n&&n.visible){let e=.3,r=.005,i=t.standingPosition.clone().applyMatrix4(t.work.transform),a=Z({panoIndex:t.panoIndex,workCode:t.work.workCode}),o=Qg.map(t=>{Bv.ray.origin.copy(i),Bv.ray.origin.add(Vv.copy(t).setY(e)),Bv.ray.direction.set(0,-1,0),Bv.firstHitOnly=!0,Bv.floorIndex=-1;let[a]=n.intersectRaycaster(Bv);return a&&a.distance-r<=e?new c.Vector3().copy(i).setY(a.point.y+r):i});o.sort((e,t)=>t.y-e.y);let s=o[Math.floor(o.length/2)],[l]=o.filter(e=>e.distanceTo(s)<=.05);if(l){let e=new c.Vector4(i.x,i.y,i.z,l.y-i.y),t=this.adjustPanoCircleMeshPositionFix.get(a);t&&!e.equals(t)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(a,e)}}this.accessibleObserverFloorCheckCount++}}let N=new Map;if(j)for(let e of j.accessibleNodes){let t=j.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});N.set(e,t)}}if(M)for(let e of M.accessibleNodes){let t=M.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});N.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{N.get(t)?N.delete(t):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),N.forEach((e,t)=>{let n=this.panoCircleMeshCreator(e,{aerialObserverMinHeight:this.aerialObserverMinHeight});this.panoMeshes.set(t,n),this.helper.add(n),N.delete(t)}),this.panoMeshes.forEach((e,t)=>{let n=this.works.getObserver(t);if(n){let r=n.position.distanceTo(n.standingPosition)>this.aerialObserverMinHeight;if(r)e.position.copy(n.position).applyMatrix4(n.work.transform),e.scale.setScalar(18);else{e.position.copy(n.standingPosition).applyMatrix4(n.work.transform);let t=this.adjustPanoCircleMeshPositionFix.get(n.panoId);t&&(Vv.set(t.x,t.y,t.z),Vv.equals(e.position)&&(e.position.y+=t.w)),e.scale.setScalar(1.2)}let i=this.camera.position.clone().setY(e.position.y),a=new c.Vector3().copy(e.position).sub(i).normalize();if(t===Z(this.currentPano)){let t=U((.5-i.distanceTo(e.position))/.5,0,1);a.multiplyScalar(1-t).add(h.clone().multiplyScalar(t))}if(a.length()>0){let t=r?-Math.PI/2:0,n=Math.atan2(a.x,a.z);e.quaternion.setFromEuler(new c.Euler(t,n,0,`YXZ`))}}else e.visible=!1}),this.camera.pose.distance>.1||w)this.panoMeshes.forEach(n=>{n.setOpacity(0),n.setCurrent(!1),n.updateTime&&n.updateTime(e,t),n.visible=!1});else if(k){let n=k.work.observers,[,r]=zl(k.accessibleNodes,e=>{let t=n[e];return!t||!t.active?1/0:k.standingPosition.distanceTo(t.standingPosition)},!0);r=U(r,2.5,1/0);let i=k.accessibleNodes.concat(k.panoIndex).map(e=>Z({panoIndex:e,workCode:k.work.workCode}));this.panoMeshes.forEach((n,a)=>{let o=this.works.getObserver(a),s=!1,c=1;if(i.indexOf(a)===-1)s=!1,c=0;else if(!o)s=!1,c=0;else if(!o.loadable&&!o.active)s=!1,c=0;else{let e=n.position.clone().project(this.camera);s=Math.abs(e.x)<1&&Math.abs(e.y)<1&&Math.abs(e.z)<1&&!n.loading&&n.progress===0&&A!==null&&Z({panoIndex:A.panoIndex,workCode:A.work.workCode})===a;let t=n.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);c=t<.01?0:U(r/t,.1,.85)}o&&o===M&&o.position.distanceTo(o.standingPosition)>this.aerialObserverMinHeight&&n.position.distanceTo(this.camera.position)<35&&(c=0),this.modelScene.parameter.resolveValue(`modelAlpha`)>0&&(c=0),n.setCurrent(s),n.setOpacity(c),n.updateTime&&n.updateTime(e,t)})}{let e=(l=this.modelScene.parameter.progress)==null?1:l,t=Math.round(e),n=this.modelScene.parameter.pano0,r=this.modelScene.parameter.pano1,i=t===0?n:r,a;if(i&&(a=this.works.getObserver(i.panoId),a||(a=this.panoPictureObserverMap.get(i))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(di()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!a||!i||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:O,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new c.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=ni(i.mapSize)+1;this.tiling.setObserver(a);let o={renderer:this.renderer,resolution:O,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:i.map,panoMatrix:i.matrix,panoZoom:i.zoom,minLevel:e,level:4},s=this.tiling.update(o),c={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:t,opacity:(n==null?void 0:n.panoId)===(r==null?void 0:r.panoId)?1:qu(Math.abs(((u=this.modelScene.parameter.progress)==null?0:u)-.5)*2)},l=this.modelScene.parameter.refinedScreen;(s||c.pano!==(l==null?void 0:l.pano)||c.opacity!==(l==null?void 0:l.opacity))&&this.modelScene.parameter.set(`refinedScreen`,c)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&k&&k.position.y-k.standingPosition.y>10){let e=U(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1);{let e=x.effect,{pano0:t,pano1:n}=this.modelScene.parameter;if(t&&n&&t!==n&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((d=this.modelScene.parameter.pano0Depth)==null?void 0:d.panoId)!==t.panoId||((f=this.modelScene.parameter.pano1Depth)==null?void 0:f.panoId)!==n.panoId){this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new c.WebGLCubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new c.WebGLCubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1});let e=new c.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);e.matrix.copy(t.matrix),e.matrixWorld.copy(e.matrix),e.matrixAutoUpdate=!1,Jg(this.renderer,this.modelScene,e,500);let r=new c.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);r.matrix.copy(n.matrix),r.matrixWorld.copy(r.matrix),r.matrixAutoUpdate=!1,Jg(this.renderer,this.modelScene,r,500),this.modelScene.parameter.set({pano0Depth:{panoId:t.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:500},pano1Depth:{panoId:n.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:500}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}render(){if(this.xrManager.session&&this.xrManager.session.renderState.baseLayer){let e=this.xrManager.session.renderState.baseLayer;return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.renderer.setFramebuffer(e.framebuffer),this.renderer.render(this.scene,this.xrManager.cameraVR),this.renderer.setFramebuffer(null),!0}return!1}onPanGesture(){}onTapGesture(){}onPinchGesture(){}onMouseMove(){}onMouseOut(){}panoResourceFromLocationMotionKeyframe(e){return this.panoResources[e.key]}updateControllerHelper(e,t,n){let r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(!e||e.length===0)return;let a={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}};for(let o=0;o<e.length;o++){let s=e[o].handedness,c=e[o].gamepad;switch(s){case`left`:c.axes&&(this.emitHandleEvent(c.axes[2]===-1,`LeftAxesLeft`,t),this.emitHandleEvent(c.axes[2]===1,`LeftAxesRight`,t),this.emitHandleEvent(c.axes[3]===-1,`LeftAxesUp`,t),this.emitHandleEvent(c.axes[3]===1,`LeftAxesDown`,t)),c!=null&&c.buttons&&(c.buttons[4]&&this.emitHandleEvent(c.buttons[4].pressed,`X`,t),c.buttons[5]&&this.emitHandleEvent(c.buttons[5].pressed,`Y`,t),c.buttons[0]&&this.emitHandleEvent(c.buttons[0].pressed,`LeftTrigger`,t),c.buttons[1]&&this.emitHandleEvent(c.buttons[1].pressed,`LeftPinch`,t));let e={raycaster:r,axes:{up:c.axes&&c.axes[3]<0?Math.abs(c.axes[3]):0,down:c.axes&&c.axes[3]<0?0:Math.abs(c.axes[3]),left:c.axes&&c.axes[2]<0?Math.abs(c.axes[2]):0,right:c.axes&&c.axes[2]<0?0:Math.abs(c.axes[2])},deltaTime:n};a.buttons.X=c.buttons&&c.buttons[4]?c.buttons[4].pressed:!1,a.buttons.Y=c.buttons&&c.buttons[5]?c==null?void 0:c.buttons[5].pressed:!1,a.buttons.LeftTrigger=c.buttons&&c.buttons[0]?c==null?void 0:c.buttons[0].pressed:!1,a.buttons.LeftPinch=c.buttons&&c.buttons[1]?c==null?void 0:c.buttons[1].pressed:!1,a.left=e;break;case`right`:c.axes&&(this.emitHandleEvent(c.axes[2]===-1,`RightAxesLeft`,t),this.emitHandleEvent(c.axes[2]===1,`RightAxesRight`,t),this.emitHandleEvent(c.axes[3]===-1,`RightAxesUp`,t),this.emitHandleEvent(c.axes[3]===1,`RightAxesDown`,t)),c.buttons&&(c.buttons[4]&&this.emitHandleEvent(c.buttons[4].pressed,`A`,t),c.buttons[5]&&this.emitHandleEvent(c.buttons[5].pressed,`B`,t),c.buttons[0]&&this.emitHandleEvent(c.buttons[0].pressed,`RightTrigger`,t),c.buttons[1]&&this.emitHandleEvent(c.buttons[1].pressed,`RightPinch`,t)),a.right={raycaster:i,axes:{up:c.axes&&c.axes[3]<0?Math.abs(c.axes[3]):0,down:c.axes&&c.axes[3]<0?0:Math.abs(c.axes[3]),left:c.axes&&c.axes[2]<0?Math.abs(c.axes[2]):0,right:c.axes&&c.axes[2]<0?0:Math.abs(c.axes[2])},deltaTime:n},a.buttons.A=c.buttons&&c.buttons[4]?c==null?void 0:c.buttons[4].pressed:!1,a.buttons.B=c.buttons&&c.buttons[5]?c==null?void 0:c.buttons[5].pressed:!1,a.buttons.RightTrigger=c.buttons&&c.buttons[0]?c==null?void 0:c.buttons[0].pressed:!1,a.buttons.RightPinch=c.buttons&&c.buttons[1]?c==null?void 0:c.buttons[1].pressed:!1;break;default:break}}this.emit(`xr.controller.update`,Q(`xr.controller.update`,a))}emitHandleEvent(e,t,n){let r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(e)this.xrHandleState[t].touchStart===!1?(this.xrHandleState[t].touchStartTime=n,this.xrHandleState[t].touchStart=!0,this.emit(`xr.gesture.buttonDown`,Q(`xr.gesture.buttonDown`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}))):n-this.xrHandleState[t].touchStartTime>zv&&this.emit(`xr.gesture.press`,Q(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}));else if(this.xrHandleState[t].touchStart===!0){if(this.emit(`xr.gesture.buttonUp`,Q(`xr.gesture.buttonUp`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}})),n-this.xrHandleState[t].touchStartTime<=zv){let e=Q(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}});!this.emit(`xr.gesture.tap`,e)&&!e.defaultPrevented&&t===`RightTrigger`&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[t].touchStart=!1,this.xrHandleState[t].touchStartTime=0}}initHandEvent(){if(!this.xrManager.session)throw Error(`初始化失败`);this.xrManager.session.addEventListener(`select`,e=>{this.gazeRay&&this.checkSelectedPano(this.gazeRay)})}}},Uv={Floorplan:Qh,Topview:eg,Panorama:$g,VRPanorama:W_,Model:Y_,Mapview:tv,XRPanorama:Lv},Wv=`gesture.pan,gesture.tap,gesture.dbltap,gesture.press,gesture.pinch,gesture.mousewheel,gesture.mousemove,gesture.momentum,gesture.fire,initAnimation.start,initAnimation.end,camera.update,intersect.update,pano.select,pano.moveTo,pano.moving,pano.arrived,pano.cancel,pano.error,pano.prepare,pano.texture.load,pano.texture.progress,pano.texture.success,pano.texture.error,pano.texture.abort,xr.session.start,xr.session.end,xr.gesture.tap,xr.gesture.press,xr.gesture.buttonUp,xr.gesture.buttonDown,xr.controller.update`.split(`,`);function Gv(e){e.on(`initAnimation.start`,t=>{e.emit(`initAnimationWillStart`,t.state.panoIndex,t.state,t.userAction)}),e.on(`initAnimation.end`,t=>{e.emit(`initAnimationEnded`,t.state.panoIndex,t.state,t.userAction)}),e.on(`gesture.pan`,t=>{let n=!1;n=e.emit(`wantsGesture`,`pan`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPanGesture`,t.state,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`pan`,t.pointers,t.isFinal),e.emit(`panGesture`,t.state,t.isFinal))}),e.on(`gesture.tap`,t=>{let n=!1;n=e.emit(`wantsGesture`,`tap`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsTapGesture`,t.center.raycaster,t.center.coords,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`tap`,t.pointers,t.isFinal),e.emit(`tapGesture`,t.center.raycaster,t.center.coords,t.isFinal))}),e.on(`gesture.dbltap`,t=>{let n=!1;n=e.emit(`wantsGesture`,`dbltap`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsDblTapGesture`,t.center.raycaster,t.center.coords,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`dbltap`,t.pointers,t.isFinal),e.emit(`dblTapGesture`,t.center.raycaster,t.center.coords,t.isFinal))}),e.on(`gesture.press`,t=>{let n=!1;n=e.emit(`wantsGesture`,`press`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPressGesture`,t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`press`,t.pointers,t.isFinal),e.emit(`pressGesture`,t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),e.on(`gesture.pinch`,t=>{let n=!1;n=e.emit(`wantsGesture`,`pinch`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPinchGesture`,t.scale,t.state.fov,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`pinch`,t.pointers,t.isFinal),e.emit(`pinchGesture`,t.scale,t.state.fov,t.isFinal))}),e.on(`gesture.mousewheel`,t=>{let n=!1;n=e.emit(`wantsGesture`,`mouseWheel`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsMouseWheel`,t.center.delta,t.state.fov,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`mouseWheel`,t.pointers,t.isFinal),e.emit(`mouseWheel`,t.center.delta,t.state.fov,t.isFinal))}),e.on(`gesture.mousemove`,t=>{let n=!1;n=e.emit(`wantsGesture`,`mouseMove`,t.pointers,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`mouseMove`,t.pointers,t.isFinal),n=e.emit(`wantsChangeCameraFov`,t.state.fov),n&&t.preventDefault())}),e.on(`gesture.momentum`,t=>{let n=!1;n=e.emit(`wantsInteriaPan`,t.state),n&&t.preventDefault(),t.defaultPrevented||e.emit(`interiaPan`,t.state,t.isFinal)}),e.on(`camera.update`,t=>{e.emit(`cameraFovUpdate`,t.state.fov,t.userAction),e.emit(`cameraDirectionUpdate`,t.state,t.userAction);let n=Ht(t.state);n.setLength(t.state.distance);let r=t.state.offset.clone().sub(n);e.emit(`cameraPositionUpdate`,r,t.userAction),e.emit(`cameraUpdate`,t.state,t.userAction)}),e.on(`intersect.update`,t=>{if(t.intersection){let n=!1;n=e.emit(`wantsShowIntersectionOnModel`,t.raycaster),n&&t.preventDefault(),t.defaultPrevented||e.emit(`intersectionOnModelUpdate`,t.intersection,t.object)}else e.emit(`intersectionHidden`)}),e.on(`pano.request`,t=>{let n=e.emit(`wantsMoveToPano`,t.state.panoIndex,t.options,t.userAction);n||(n=e.emit(`wantsToMoveToPano`,t.state.panoIndex,t.options,t.userAction)),n&&t.preventDefault(),t.defaultPrevented||e.emit(`panoWillLoad`,t.state.panoIndex)}),e.on(`pano.select`,t=>{e.emit(`panoSelected`,t.state.panoIndex)}),e.on(`pano.moveTo`,t=>{e.emit(`panoLoaded`,t.state.panoIndex),e.emit(`moveToPano`,t.state.panoIndex,t.userAction),e.emit(`panoWillArrive`,t.state.panoIndex,t.state,t.userAction)}),e.on(`pano.moving`,t=>{e.emit(`movingToPano`,t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),e.on(`pano.arrived`,t=>{e.emit(`panoArrived`,t.state.panoIndex,t.state,t.userAction)}),e.on(`pano.cancel`,t=>{e.emit(`moveToPanoCanceled`,t.state.panoIndex)}),e.on(`pano.error`,t=>{e.emit(`panoLoadError`,t.error,t.state.panoIndex)}),e.on(`pano.texture.load`,t=>{e.emit(`textureStartLoad`,t.pano.panoIndex)}),e.on(`pano.texture.success`,t=>{e.emit(`textureLoaded`,t.pano.panoIndex,t.meta)}),e.on(`pano.texture.error`,t=>{e.emit(`textureError`,t.error,t.pano.panoIndex)}),e.on(`pano.texture.abort`,t=>{e.emit(`textureAbort`,t.pano.panoIndex)}),e.on(`pano.texture.progress`,t=>{e.emit(`textureLoading`,t.progress,t.pano.panoIndex)}),e.on(`xr.session.start`,t=>{e.emit(`webXRSessionStart`)}),e.on(`xr.session.end`,t=>{e.emit(`webXRSessionEnd`)}),e.on(`xr.gesture.tap`,t=>{e.emit(`webXRControllerEvent`,`tap`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.press`,t=>{e.emit(`webXRControllerEvent`,`press`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.buttonUp`,t=>{e.emit(`webXRControllerEvent`,`buttonUp`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.buttonDown`,t=>{e.emit(`webXRControllerEvent`,`buttonDown`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.controller.update`,t=>{e.emit(`webXRControllerRayUpdate`,{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&e.emit(`webXRAxesUpdate`,`left`,{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.left.axes.up,down:t.left.axes.down,left:t.left.axes.left,right:t.left.axes.right},deltaTime:t.left.deltaTime}),t.right&&e.emit(`webXRAxesUpdate`,`right`,{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.right.axes.up,down:t.right.axes.down,left:t.right.axes.left,right:t.right.axes.right},deltaTime:t.right.deltaTime})}),e.on(`works.request`,t=>{e.emit(`willLoad`,t.input,t.works[0],e.getCurrentState())}),e.on(`works.load`,t=>{e.emit(`load`,t.input,t.works[0],e.getCurrentState())}),e.on(`works.ready`,t=>{e.emit(`loaded`,t.input,t.works[0])}),e.on(`state.change`,t=>{e.emit(`stateChange`,t.state,t.userAction)}),e.on(`currentState.change`,t=>{e.emit(`currentStateChange`,t.state,t.userAction)}),e.on(`state.set`,t=>{e.emit(`setState`,t.state)}),e.on(`state.synced`,t=>{e.emit(`stateSynced`,t.state)}),e.on(`model.request`,t=>{e.emit(`modelWillLoad`,t.work.model)}),e.on(`model.error`,t=>{e.emit(`modelLoadError`,t.error,t.model)}),e.on(`model.load`,t=>{e.emit(`modelLoaded`,t.model)}),e.on(`model.changeShownFloor`,t=>{e.emit(`modelShownFloorChange`,t.model.shownFloor,t.model.floorLength)}),e.on(`render`,t=>{e.emit(`renderFrame`,t.needsRender)}),e.on(`mode.change.request`,t=>{e.emit(`wantsChangeMode`,t.mode,t.prevMode)}),e.on(`mode.change`,t=>{e.emit(`modeChange`,t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),e.on(`helpers.visible`,t=>{e.emit(`helpersVisibleChange`,t.object.visible)}),e.on(`network.resource`,t=>{e.emit(`network`,t.source,t.requestType,t.requestState,t.detail)})}function Kv(){if(typeof window<`u`){let e=document.createElement(`video`);e.loop=!0,e.autoplay=!0,e.playsInline=!0,e.muted=!0,e.crossOrigin=``;let t=()=>{document.removeEventListener(`touchstart`,t,!1),document.removeEventListener(`mousedown`,t,!1),e.muted=!1};return document.addEventListener(`touchstart`,t,!1),document.addEventListener(`mousedown`,t,!1),e}else return{}}function qv(){let e=new c.Group;e.name=`internalLights`;{let t=new c.DirectionalLight(16777215,.1);t.name=`direction0`,t.position.copy(new c.Vector3(0,1,0)),e.add(t)}{let t=new c.DirectionalLight(16777215,.1);t.name=`direction1`,t.position.copy(new c.Vector3(-1,-1,-1)),e.add(t)}{let t=new c.DirectionalLight(16777215,.3);t.name=`direction2`,t.position.copy(new c.Vector3(1,1,1)),e.add(t)}{let t=new c.AmbientLight(16777215,.6);t.name=`ambient0`,e.add(t)}return e}function Jv(e){var t,n;let r={},i=e.split(/(\;|\,)/);for(let e of i){let i=e.split(`=`),a=(t=i[0])==null?void 0:t.trim(),o=(n=i[1])==null?void 0:n.trim();a&&o&&(r[a]=o)}return r}function Yv(){var e;if(typeof document<`u`){let t=document.getElementsByTagName(`meta`);for(let n=0;n<t.length;n++){let r=t[n];if(r.getAttribute(`name`)===`viewport`){let t=Jv((e=r.getAttribute(`content`))==null?``:e),n=Number(t[`initial-scale`]);if(!isNaN(n))return n}}}return 1}var Xv=`data:image/png;base64,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`,Zv=[351,63],Qv=[20,20],$v=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),ey=new Float32Array([0,0,1,0,0,1,1,1]),ty=new Uint8Array([0,1,2,1,3,2]),ny=new c.BufferGeometry;ny.setAttribute(`position`,new c.BufferAttribute($v,3)),ny.setAttribute(`uv`,new c.BufferAttribute(ey,2)),ny.setIndex(new c.BufferAttribute(ty,1));var ry=new c.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),iy=new c.Mesh(ny,ry);iy.matrixAutoUpdate=!1;var ay=new c.Scene;ay.add(iy),ay.matrixAutoUpdate=!1;var oy=new c.OrthographicCamera(-.5,.5,.5,-.5,.1,1);oy.position.set(0,0,.5),oy.lookAt(0,0,0),oy.updateMatrixWorld(!0),oy.matrixAutoUpdate=!1;var sy=new c.Vector4,cy=new c.Vector4;function ly(e){if(ry.map){let t=e.getViewport(sy),n=e.getScissor(cy),r=e.getScissorTest(),i=e.autoClear,a=n.x+Qv[0]/3,o=n.y+Qv[1]/3,s=Zv[0]/3,c=Zv[1]/3;e.setViewport(a,o,s,c),e.setScissor(a,o,s,c),e.setScissorTest(!0),e.autoClear=!1,e.render(ay,oy),e.setViewport(t),e.setScissor(n),e.setScissorTest(r),e.autoClear=i}else{let e=new c.Texture,t=new Image;t.onload=()=>{e.image=t,e.wrapS=c.ClampToEdgeWrapping,e.wrapT=c.ClampToEdgeWrapping,e.minFilter=c.LinearFilter,e.needsUpdate=!0,e.generateMipmaps=!1,ry.needsUpdate=!0,t.onload=K},t.src=Xv,ry.map=e}}var uy=`(function(){function e(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}async function t(e={}){var t,n=e,r=!1,i=!0,a=self.location.href;if(r||i)try{new URL(\`.\`,a).href}catch{}console.log.bind(console),console.error.bind(console);var o=!1;function s(e){for(var t=0,n=e.length,r=new Uint8Array(n),i;t<n;++t)i=e.charCodeAt(t),r[t]=~i>>8&i;return r}var c,l,u=!1;function d(){var e=M.buffer;new Int8Array(e),new Int16Array(e),n.HEAPU8=l=new Uint8Array(e),new Uint16Array(e),new Int32Array(e),n.HEAPU32=new Uint32Array(e),n.HEAPF32=new Float32Array(e),new Float64Array(e),new BigInt64Array(e),new BigUint64Array(e)}function f(){if(n.preRun)for(typeof n.preRun==\`function\`&&(n.preRun=[n.preRun]);n.preRun.length;)T(n.preRun.shift());x(w)}function p(){u=!0,I.c()}function m(){if(n.postRun)for(typeof n.postRun==\`function\`&&(n.postRun=[n.postRun]);n.postRun.length;)C(n.postRun.shift());x(S)}var h;function g(){return s(\`\\0asm\\0\\0\\0&\\\`\\\`}}\\\`}\\\`\\0\\\`\\v\\0\\\`\\0\\0\\x07aa\\0\\0\\b\\x07\\0\\0\\x07‚€€\\bA€Œ\\v\\x07b\\0c\\0\\x07d\\0e\\0f\\0\\f
2239
+ `},hv=class extends c.ShaderMaterial{constructor(e){super({uniforms:c.UniformsUtils.clone(mv.uniforms),vertexShader:mv.vertexShader,fragmentShader:mv.fragmentShader,clipping:!0}),this.type=`LineMaterial`,this.dashed=!1,Object.defineProperties(this,{color:{enumerable:!0,get(){return this.uniforms.diffuse.value},set(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get(){return this.uniforms.linewidth.value},set(e){this.uniforms.linewidth.value=e}},dashScale:{enumerable:!0,get(){return this.uniforms.dashScale.value},set(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get(){return this.uniforms.dashSize.value},set(e){this.uniforms.dashSize.value=e}},gapSize:{enumerable:!0,get(){return this.uniforms.gapSize.value},set(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(e){this.uniforms.resolution.value.copy(e)}}}),this.setValues(e)}};Object.assign(hv.prototype,{isLineMaterial:!0});var gv=class extends c.Mesh{constructor(e,t){super(),this.type=`LineSegments2`,this.geometry=e===void 0?new pv:e,this.material=t===void 0?new hv({color:Math.random()*16777215}):t}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count),i=new c.Vector3,a=new c.Vector3;for(var o=0,s=0,l=t.count;o<l;o++,s+=2)i.fromBufferAttribute(t,o),a.fromBufferAttribute(n,o),r[s]=s===0?0:r[s-1],r[s+1]=r[s]+i.distanceTo(a);let u=new c.InstancedInterleavedBuffer(r,2,1);return e.setAttribute(`instanceDistanceStart`,new c.InterleavedBufferAttribute(u,1,0)),e.setAttribute(`instanceDistanceEnd`,new c.InterleavedBufferAttribute(u,1,1)),this}raycast(e,t){e.camera===null&&console.error(`LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.`);let n=e.ray,r=e.camera,i=r.projectionMatrix,a=this.geometry,o=this.material,s=o.resolution,l=o.linewidth,u=a.attributes.instanceStart,d=a.attributes.instanceEnd,f=new c.Vector4,p=new c.Vector4,m=new c.Vector4,h=new c.Vector3,g=new c.Matrix4,_=new c.Line3,v=new c.Vector3;n.at(1,m),m.w=1,m.applyMatrix4(r.matrixWorldInverse),m.applyMatrix4(i),m.multiplyScalar(1/m.w),m.x*=s.x/2,m.y*=s.y/2,m.z=0,h.copy(m);let y=this.matrixWorld;g.multiplyMatrices(r.matrixWorldInverse,y);for(var b=0,x=u.count;b<x;b++){f.fromBufferAttribute(u,b),p.fromBufferAttribute(d,b),f.w=1,p.w=1,f.applyMatrix4(g),p.applyMatrix4(g),f.applyMatrix4(i),p.applyMatrix4(i),f.multiplyScalar(1/f.w),p.multiplyScalar(1/p.w);var S=f.z<-1&&p.z<-1,C=f.z>1&&p.z>1;if(S||C)continue;f.x*=s.x/2,f.y*=s.y/2,p.x*=s.x/2,p.y*=s.y/2,_.start.copy(f),_.start.z=0,_.end.copy(p),_.end.z=0;let e=_.closestPointToPointParameter(h,!0);_.at(e,v);let r=c.MathUtils.lerp(f.z,p.z,e),a=r>=-1&&r<=1;var w=h.distanceTo(v)<l*.5;if(a&&w){_.start.fromBufferAttribute(u,b),_.end.fromBufferAttribute(d,b),_.start.applyMatrix4(y),_.end.applyMatrix4(y);var T=new c.Vector3,E=new c.Vector3;n.distanceSqToSegment(_.start,_.end,E,T),t.push({point:E,pointOnLine:T,distance:n.origin.distanceTo(E),object:this,faceIndex:b})}}}};Object.assign(gv.prototype,{isLineSegments2:!0});var _v=class extends gv{constructor(e,t){super(e,t),this.type=`Line2`}};Object.assign(_v.prototype,{isLine2:!0});var vv=class extends pv{constructor(){super(),this.type=`LineGeometry`}setPositions(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setColors(n),this}fromLine(e){let t=e.geometry;if(t instanceof c.Geometry){let e=new c.BufferGeometry().fromGeometry(t);this.setPositions(e.attributes.position.array)}else t instanceof c.BufferGeometry&&this.setPositions(t.attributes.position.array);return this}copy(){return this}};Object.assign(vv.prototype,{isLineGeometry:!0});var yv=14467195,bv=8,xv=2,Sv=20,Cv=null,wv=class extends c.Object3D{static get version(){return`6.8.0-alpha.28`}constructor(e=new c.Vector3,t=new c.Vector3){super(),this.type=`FiveLine`,this.needsRender=!0,this.line=new _v(new vv,new hv({color:yv,linewidth:xv,dashScale:Sv,dashed:!1}));let n=new c.BufferGeometry,r=new c.PointsMaterial({color:yv,size:bv,map:Cv||(Cv=new c.TextureLoader().load(`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==`)),sizeAttenuation:!1,transparent:!0});this.points=new c.Points(n,r),this.points.renderOrder=11,this.points.frustumCulled=!1,this.setPoints(e,t),this.add(this.line,this.points)}setPoints(e,t){let n=[].concat(e.toArray(),t.toArray());this.points.geometry.setAttribute(`position`,new c.BufferAttribute(new Float32Array(n),3)),this.line.geometry.setPositions(n),this.line.computeLineDistances(),this.needsRender=!0}getPoints(){let e=this.points.geometry.attributes.position.array;return[new c.Vector3(e[0],e[1],e[2]),new c.Vector3(e[3],e[4],e[5])]}setMaterial(e){let t=this.line.material;for(let n in e){if(!e.hasOwnProperty(n))continue;let r=e[n];n===`dashed`?(t.dashed=r,r?t.defines.USE_DASH=``:delete t.defines.USE_DASH,t.needsUpdate=!0):t[n]=e[n]}this.needsRender=!0}setResolution(e,t){let n=this.line.material.resolution;(n.x!==e||n.y!==t)&&(n.set(e,t),this.needsRender=!0)}};Object.assign(wv.prototype,{isFiveLine:!0});var Tv={Handedness:Object.freeze({NONE:`none`,LEFT:`left`,RIGHT:`right`}),ComponentState:Object.freeze({DEFAULT:`default`,TOUCHED:`touched`,PRESSED:`pressed`}),ComponentProperty:Object.freeze({BUTTON:`button`,X_AXIS:`xAxis`,Y_AXIS:`yAxis`,STATE:`state`}),ComponentType:Object.freeze({TRIGGER:`trigger`,SQUEEZE:`squeeze`,TOUCHPAD:`touchpad`,THUMBSTICK:`thumbstick`,BUTTON:`button`}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:`transform`,VISIBILITY:`visibility`})};function Ev(e){return Go(this,void 0,void 0,function*(){let t=yield fetch(e);if(t.ok)return t.json();throw Error(t.statusText)})}function Dv(e){return Go(this,void 0,void 0,function*(){if(!e)throw Error(`No basePath supplied`);return yield Ev(`${e}/profilesList.json`)})}function Ov(e,t){return Go(this,arguments,void 0,function*(e,t,n=null,r=!0){if(!e)throw Error(`No xrInputSource supplied`);if(!t)throw Error(`No basePath supplied`);let i=yield Dv(t),a;if(e.profiles.some(e=>{let n=i[e];return n&&(a={profileId:e,profilePath:`${t}/${n.path}`,deprecated:!!n.deprecated}),!!a}),!a){if(!n)throw Error(`No matching profile name found`);let e=i[n];if(!e)throw Error(`No matching profile name found and default profile "${n}" missing.`);a={profileId:n,profilePath:`${t}/${e.path}`,deprecated:!!e.deprecated}}let o=yield Ev(a.profilePath),s;if(r){let t;if(t=o.layouts[e.handedness],!t)throw Error(`No matching handedness, ${e.handedness}, in profile ${a.profileId}`);t.assetPath&&(s=a.profilePath.replace(`profile.json`,t.assetPath))}return{profile:o,assetPath:s}})}var kv={xAxis:0,yAxis:0,button:0,state:Tv.ComponentState.DEFAULT};function Av(e=0,t=0){let n=e,r=t;if(Math.sqrt(e*e+t*t)>1){let i=Math.atan2(t,e);n=Math.cos(i),r=Math.sin(i)}return{normalizedXAxis:n*.5+.5,normalizedYAxis:r*.5+.5}}var jv=class{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===Tv.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(kv)}updateFromComponent({xAxis:e,yAxis:t,button:n,state:r}){let{normalizedXAxis:i,normalizedYAxis:a}=Av(e,t);switch(this.componentProperty){case Tv.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?i:.5;break;case Tv.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?a:.5;break;case Tv.ComponentProperty.BUTTON:this.value=this.states.includes(r)?n:0;break;case Tv.ComponentProperty.STATE:this.valueNodeProperty===Tv.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=this.states.includes(r)?1:0;break;default:throw Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}},Mv=class{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw Error(`Invalid arguments supplied`);this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(e=>{let n=new jv(t.visualResponses[e]);this.visualResponses[e]=n}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:Tv.ComponentState.DEFAULT,button:this.gamepadIndices.button===void 0?void 0:0,xAxis:this.gamepadIndices.xAxis===void 0?void 0:0,yAxis:this.gamepadIndices.yAxis===void 0?void 0:0}}get data(){return Object.assign({id:this.id},this.values)}updateFromGamepad(e){if(this.values.state=Tv.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){let t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=Tv.ComponentState.PRESSED:(t.touched||this.values.button>Tv.ButtonTouchThreshold)&&(this.values.state=Tv.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Tv.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Tv.AxisTouchThreshold&&(this.values.state=Tv.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Tv.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Tv.AxisTouchThreshold&&(this.values.state=Tv.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(e=>{e.updateFromComponent(this.values)})}},Nv=class{constructor(e,t,n){if(!e)throw Error(`No xrInputSource supplied`);if(!t)throw Error(`No profile supplied`);this.xrInputSource=e,this.assetUrl=n,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(e=>{let t=this.layoutDescription.components[e];this.components[e]=new Mv(e,t)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){let e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}},Pv=`https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles`,Fv=`generic-trigger`,Iv=class extends c.Object3D{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(e){return this.envMap==e?this:(this.envMap=e,this.traverse(e=>{e instanceof c.Mesh&&e.isMesh&&(e.material.envMap=this.envMap,e.material.needsUpdate=!0)}),this)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(e=>{Object.values(e.visualResponses).forEach(e=>{let{valueNode:t,minNode:n,maxNode:r,value:i,valueNodeProperty:a}=e;t&&(a===Tv.VisualResponseProperty.VISIBILITY?t.visible=i:a===Tv.VisualResponseProperty.TRANSFORM&&(t.quaternion.copy(n.quaternion).slerp(r.quaternion,i),t.position.lerpVectors(n.position,r.position,i)))})}))}};function Lv(e,t){Object.values(e.components).forEach(e=>{let{type:n,touchPointNodeName:r,visualResponses:i}=e;if(n===Tv.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(r),e.touchPointNode){let t=new c.Mesh(new c.SphereGeometry(.001),new c.MeshBasicMaterial({color:255}));e.touchPointNode.add(t)}else console.warn(`Could not find touch dot, ${e.touchPointNodeName}, in touchpad component ${e.id}`);Object.values(i).forEach(e=>{let{valueNodeName:n,minNodeName:r,maxNodeName:i,valueNodeProperty:a}=e;if(a===Tv.VisualResponseProperty.TRANSFORM){if(e.minNode=t.getObjectByName(r),e.maxNode=t.getObjectByName(i),!e.minNode){console.warn(`Could not find ${r} in the model`);return}if(!e.maxNode){console.warn(`Could not find ${i} in the model`);return}}e.valueNode=t.getObjectByName(n),e.valueNode||console.warn(`Could not find ${n} in the model`)})})}function Rv(e,t){Lv(e.motionController,t),e.envMap&&t.traverse(t=>{t instanceof c.Mesh&&t.isMesh&&(t.material.envMap=e.envMap,t.material.needsUpdate=!0)}),e.add(t)}var zv=class{constructor(e=null){this.gltfLoader=e,this.path=Pv,this._assetCache={}}createControllerModel(e){let t=new Iv,n=null;return e.addEventListener(`connected`,e=>{let r=e.data;r.targetRayMode!==`tracked-pointer`||!r.gamepad||Ov(r,this.path,Fv).then(({profile:e,assetPath:i})=>{t.motionController=new Nv(r,e,i);let a=this._assetCache[t.motionController.assetUrl];if(a)n=a.scene.clone(),Rv(t,n);else{if(!this.gltfLoader)throw Error(`GLTFLoader not set.`);this.gltfLoader.load(t.motionController.assetUrl,e=>{this._assetCache[t.motionController.assetUrl]=e,n=e.scene.clone(),Rv(t,n)})}}).catch(e=>{console.warn(e)})}),e.addEventListener(`disconnected`,()=>{t.motionController=null,t.remove(n),n=null}),t}},Bv=Object.assign({},yr(n_,[`maxLatitude`,`minLatitude`]));function Vv(e,t){if(!t)return e;let n=e.match(/\d+_[a-z].png/);return e.substring(0,n.index)+t+`/`+e.substring(n.index)}var Hv=300,Uv=new c.Raycaster,Wv=new c.Vector3,Gv={Floorplan:ng,Topview:ig,Panorama:r_,VRPanorama:J_,Model:$_,Mapview:av,XRPanorama:class e extends r_{static parseArgs(t){if(t instanceof e)return t;let n=Object.assign(Object.assign({},t),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return super.parseArgs(n)}static initAnimationEndState(e){let t=this.parseArgs(e),n=super.initAnimationEndState(t);return Object.assign(Object.assign({},n),{mode:`XRPanorama`})}constructor(e){super(e),this.xrManager=new fv(this.renderer,this.renderer.getContext(),{onSessionStart:e=>{this.emit(`xr.session.start`,Q(`xr.session.start`,{session:e,machineType:this.xrManager.machineType}))},onSessionEnd:()=>{this.emit(`xr.session.end`,Q(`xr.session.end`,{session:null,machineType:this.xrManager.machineType}))}}),this.xrControllerRay={left:new c.Raycaster,right:new c.Raycaster},this.xrControllerRay.left.params.Points={threshold:.1},this.xrControllerRay.left.firstHitOnly=!0,this.xrControllerRay.left.floorIndex=-1,this.xrControllerRay.right.params.Points={threshold:.1},this.xrControllerRay.right.firstHitOnly=!0,this.xrControllerRay.right.floorIndex=-1,this.gazeRay=null,this.pointerLines={left:new wv,right:new wv},this.pointerLines.left.visible=!1,this.pointerLines.right.visible=!0,this.pointerLines.left.setMaterial({color:new c.Vector3(1,1,1)}),this.pointerLines.left.points.material.depthTest=!1,this.pointerLines.right.setMaterial({color:new c.Vector3(1,1,1)}),this.pointerLines.right.points.material.depthTest=!1,this.controllerWrappers=[new c.Group,new c.Group];let t=this.xrManager.getController(0);this.controllerWrappers[0].add(t);let n=this.xrManager.getController(1);this.controllerWrappers[1].add(n);let r=new zv;r.gltfLoader={load(e,t){_r.ajax(e,{responseType:`arraybuffer`}).then(t=>{var n;return ds(t.body,{resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(n=e.split(`?`)[1])==null?``:n,fetcher:_r})}).then(e=>t(e))}},(this.xrManager.machineType===`Oculus`||this.xrManager.machineType===`Pico`)&&this.scene.add(this.pointerLines.left,this.pointerLines.right,this.controllerWrappers[0],this.controllerWrappers[1]),this.panoResources={},this.panoResources[this.locationMotion.keyframes[0].key=this.locationMotion.keyframes[1].key=rn()]={panoId:Z(this.currentPano),leftPanoPicture:null,position:this.camera.pose.offset.clone(),effect:`fade`,effectEasing:Qg,fixCameraTransform:new c.Matrix4},this.parallaxCameraMatrixs=[];let i=si.shared.getContext();if(!i){console.error(`获取session失败,请退出重试`);return}this.on(`xr.session.end`,()=>{this.scene.remove(this.pointerLines.left,this.pointerLines.right)}),this.xrManager.setSession(i),this.on(`xr.session.start`,()=>{let e=this.xrManager.getControllerGrip(0);e.add(r.createControllerModel(e)),this.controllerWrappers[0].add(e);let t=this.xrManager.getControllerGrip(1);t.add(r.createControllerModel(t)),this.controllerWrappers[1].add(t)}),this.xrHandleState={LeftAxesUp:{touchStartTime:0,touchStart:!1},LeftAxesDown:{touchStartTime:0,touchStart:!1},LeftAxesLeft:{touchStartTime:0,touchStart:!1},LeftAxesRight:{touchStartTime:0,touchStart:!1},LeftTrigger:{touchStartTime:0,touchStart:!1},LeftPinch:{touchStartTime:0,touchStart:!1},RightAxesUp:{touchStartTime:0,touchStart:!1},RightAxesDown:{touchStartTime:0,touchStart:!1},RightAxesLeft:{touchStartTime:0,touchStart:!1},RightAxesRight:{touchStartTime:0,touchStart:!1},RightTrigger:{touchStartTime:0,touchStart:!1},RightPinch:{touchStartTime:0,touchStart:!1},Y:{touchStartTime:0,touchStart:!1},X:{touchStartTime:0,touchStart:!1},A:{touchStartTime:0,touchStart:!1},B:{touchStartTime:0,touchStart:!1}},this.xrManager.machineType===`VP`&&this.initHandEvent()}updateConfiguration(e){return super.updateConfiguration(Object.assign(Object.assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))}moveToPano(e,t,n){var r,i,a;let o=(r=t.effect)==null?`fade`:r;this.userAction=n,this.stopMomentumMovement();let s=Z(e),l=this.works.getObserver(e);if(!l)throw Error(`Invalid PanoIndex`);let u=$r(l.images.up),d=this.imageOptions.size;d===void 0&&l&&u&&(d=Number(u)),d===void 0&&(d=2048);let f=this.imageOptions.transform,p=(e,t)=>Vv(Zr(e,f,t)),m=Object.assign({key:`pano.${s}`},vr(this.imageOptions,[`format`,`size`,`quality`])),h={right:l.images.work.getURL(l.images.right),left:l.images.work.getURL(l.images.left),up:l.images.work.getURL(l.images.up),down:l.images.work.getURL(l.images.down),front:l.images.work.getURL(l.images.front),back:l.images.work.getURL(l.images.back)},g=`pano:`+_p([h,m,f]);if(this.pendingPanoTask){if(this.pendingPanoTask.hash===g)return;{let t=this.pendingPanoTask.panoId;(i=this.panoMeshes.get(t))==null||i.setProgress(0),this.emit(`pano.texture.abort`,Q(`pano.texture.abort`,{error:null,progress:0,meta:null,pano:e}))}}let _=`move-to-pano-`+s;this.pending.add(_);let v=Ah(`pano.prepare`,{prevPano:this.currentPano,pano:e});if(this.emit(`pano.prepare`,v),v.defaultPrevented){this.pending.delete(_);return}let y=this.modelScene.parameter,b;if(y.pano0&&y.pano0.map.name===g?b=y.pano0:y.pano1&&y.pano1.map.name===g&&(b=y.pano1),b){let n={panoId:s,effect:o,effectEasing:(a=t.effectEasing)==null?Qg:a,leftPanoPicture:{panoId:b.panoId,map:b.map,mapHistogram:b.mapHistogram,mapSize:b.mapSize,matrix:l.matrix.clone().premultiply(l.work.transform),zoom:1},position:l.position.clone().applyMatrix4(l.work.transform),fixCameraTransform:new c.Matrix4};n.leftPanoPicture&&this.panoPictureObserverMap.set(n.leftPanoPicture,l),this.pendingPanoTask=void 0,Promise.resolve().then(()=>jh(v)).catch(e=>{let t=Qh(e);return this.emit(`error`,t),t}).then(r=>{var i,a;if(!(r instanceof Error))this.pending.delete(_),this.pendingPanoTask=void 0,(i=this.panoMeshes.get(s))==null||i.setProgress(0),this.doMoveToPano(e,n,t);else{let e=null;r instanceof Error&&(e||(e=r));let n=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{error:null,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),t.moveCancelCallback&&t.moveCancelCallback(),this.emit(`pano.error`,Q(`pano.error`,{error:e,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),e instanceof Error&&e.message&&this.emit(`error`,e),this.pending.delete(_),this.pendingPanoTask=void 0,(a=this.panoMeshes.get(s))==null||a.setProgress(0)}});return}let x=this.panoMeshes.get(s);x&&x.tap&&x.tap(),this.pendingPanoTask={panoId:s,hash:g,onLoad:n=>{var r,i;let a=n.body;if(this.destroyed)a.dispose();else{a.name=g;let n=Array.isArray(a.image)?a.image[0]:a.image,u=(r=n==null?void 0:n.width)==null?2048:r,d=new bm().formPixels(Kh(this.renderer,a,!0,gm).data),f={panoId:s,effect:o,effectEasing:(i=t.effectEasing)==null?Qg:i,leftPanoPicture:{panoId:s,map:a,mapSize:u,mapHistogram:new c.Vector4().fromArray(d.toArray()),matrix:l.matrix.clone(),zoom:1},position:l.position.clone(),fixCameraTransform:new c.Matrix4};f.leftPanoPicture&&this.panoPictureObserverMap.set(f.leftPanoPicture,l),this.doMoveToPano(e,f,t)}},onError:e=>{let n=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{error:null,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),this.emit(`pano.error`,Q(`pano.error`,{error:e,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),e instanceof Error&&e.message&&this.emit(`error`,e),t.moveCancelCallback&&t.moveCancelCallback()}},Promise.all([Promise.resolve().then(()=>{this.emit(`pano.texture.load`,Q(`pano.texture.load`,{error:null,progress:0,meta:null,pano:e}))}).then(()=>this.textureLoader.loadCubeTexture(h,{imageURL:{transform:p,options:m},format:c.RGBFormat,viaAjax:!0,fetcher:Ef(this.fiveId,l.work)},void 0,void 0,t=>{var n,r;this.emit(`pano.texture.progress`,Q(`pano.texture.progress`,{error:null,progress:t,meta:null,pano:e})),((n=this.pendingPanoTask)==null?void 0:n.hash)===g&&((r=this.panoMeshes.get(s))==null||r.setProgress(t))},this.renderer)).catch(t=>{let n=Qh(t);return this.emit(`pano.texture.error`,Q(`pano.texture.error`,{error:n,progress:0,meta:null,pano:e})),n}),Promise.resolve().then(()=>jh(v)).catch(e=>Qh(e))]).then(([t,n])=>{var r,i,a,o;if(!(t instanceof Error)&&!(n instanceof Error))this.pending.delete(_),((r=this.pendingPanoTask)==null?void 0:r.hash)===g?(this.pendingPanoTask.onLoad(t),this.pendingPanoTask=void 0,(i=this.panoMeshes.get(s))==null||i.setProgress(0)):t.body.dispose(),this.emit(`pano.texture.success`,Q(`pano.texture.success`,{error:null,progress:1,meta:t.meta,pano:e}));else{let e=null;t instanceof Error?e||(e=t):t.body.dispose(),n instanceof Error&&(e||(e=n)),this.pending.delete(_),((a=this.pendingPanoTask)==null?void 0:a.hash)===g&&(this.pendingPanoTask.onError(e),this.pendingPanoTask=void 0,(o=this.panoMeshes.get(s))==null||o.setProgress(0))}})}doMoveToPano(e,t,n={}){var r,i,a,o,s,l,u,d,f,p;let m=H(),h=rn();this.panoResources[h]=t;let g,_,v;if(this.locationMotion.ended){let[e,n]=this.locationMotion.getKeyFrameSegment(m),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(n).position,a=t.position;g=Math.max(i.distanceTo(a),1),_=[{key:n.key,progress:0,value:Object.assign(Object.assign({},r),{count:0})},{key:h,progress:1,value:{distance:0,count:1}}],v=0}else{let[e,n]=this.locationMotion.getKeyFrameSegment(m),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(e).position,a=this.panoResourceFromLocationMotionKeyframe(n).position,o=t.position,s=n.value.count-r.count,c=Math.max(i.distanceTo(a),1)*s;g=c+Math.max(a.distanceTo(o),1),_=[{key:e.key,progress:0,value:Object.assign({},r)},{key:n.key,progress:c/g,value:n.value},{key:h,progress:1,value:{count:n.value.count+1,distance:0}}];let l=this.locationMotionKeyframesLength(this.locationMotion.keyframes),u=this.locationMotionKeyframesLength(_);v=this.locationMotion.getProgressVelocity(m)*l/u}let y=t.effect===`instant`?0:this.calculateMovingDuration(n.duration,t.effect===`fly`||t.effect===`model`?g:0),b={longitude:n.longitude,latitude:n.latitude,fov:n.fov},x=Object.assign(Object.assign({},e),{mode:this.mode,longitude:(r=b.longitude)==null?this.camera.pose.longitude:r,latitude:(i=b.latitude)==null?this.camera.pose.latitude:i,fov:(a=b.fov)==null?this.camera.pose.fov:a,offset:t.position.clone(),distance:0}),S=this.currentPano;if(this.emit(`pano.moveTo`,Q(`pano.moveTo`,{options:n,prevPano:S,pano:{panoIndex:x.panoIndex,workCode:x.workCode},progress:0,state:x,userAction:this.userAction,error:null})),n.moveStartCallback&&n.moveStartCallback(x),this.perspToOrthoMotion.set({perspToOrtho:0},y).catch(K),this.modelAlphaMotion.setKeyframes([{progress:0,value:Object.assign({},this.modelAlphaMotion.value)},{progress:.6,value:Object.assign({},this.modelAlphaMotion.value)},{progress:1,value:{modelAlpha:0}}],y).catch(K),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute(`src`)&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute(`uuid`),this.videoTexture.image.removeAttribute(`src`),this.videoTexture.image.oncanplay=K,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),t.effect===`fly`||t.effect===`model`)this.cameraMotion.set(b,y).catch(K);else{let e=Ht({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),n=Ht({longitude:(o=b.longitude)==null?this.cameraMotion.value.longitude:o,latitude:(s=b.latitude)==null?this.cameraMotion.value.latitude:s}),r=new c.Object3D;r.lookAt(e);let i=new c.Matrix4().makeRotationFromQuaternion(r.quaternion);r.lookAt(n);let a=new c.Matrix4().makeRotationFromQuaternion(r.quaternion),m=new c.Matrix4().getInverse(i).premultiply(a),h=this.cameraMotion.value.fov,g=(l=b.fov)==null?this.cameraMotion.value.fov:l,v=1;t.effect===`zoomin`?v=1.5:t.effect===`zoomout`&&(v=.4);let x=g*v;for(let e=0;e<_.length-1;e++){let t=_[e].key;if(t){let e=this.panoResources[t];e&&(e.fixCameraTransform.copy(m),e.leftPanoPicture&&(e.leftPanoPicture.zoom=Math.tan(x/2/180*Math.PI)/Math.tan(h/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(u=b.longitude)==null?this.cameraMotion.value.longitude:u,latitude:(d=b.latitude)==null?this.cameraMotion.value.latitude:d,fov:x}},{progress:1,value:{longitude:(f=b.longitude)==null?this.cameraMotion.value.longitude:f,latitude:(p=b.latitude)==null?this.cameraMotion.value.latitude:p,fov:g}}],y).catch(K)}this.locationMotion.setKeyframes(_,y,v).then(()=>{for(let e of this.modelScene.children)e instanceof Gf&&e.show();let t=Object.assign(Object.assign({},e),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:0});this.emit(`pano.arrived`,Q(`pano.arrived`,{options:n,prevPano:S,pano:{panoIndex:t.panoIndex,workCode:t.workCode},progress:1,state:t,userAction:this.userAction,error:null})),n.moveEndCallback&&n.moveEndCallback(t);let r=this.works.getObserver(this.currentPano);if(r&&r.images.video&&this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement){let e={map:this.videoTexture,size:r.images.video.size.clone(),matrix:r.images.video.matrix.clone(),panoMatrix:r.matrix.clone().premultiply(r.work.transform),alpha:1},t=rn(),n=this.videoTexture.image;n.setAttribute(`uuid`,t),lg().then(i=>{i&&r.images.video&&n.getAttribute(`uuid`)===t&&(n.oncanplay=()=>{n.oncanplay=K,n.play()},n.ontimeupdate=()=>{n.currentTime>.5&&(n.ontimeupdate=K,this.panoVideo.setMaterial(e))},n.src=r.images.video.source)}).catch((()=>{n.removeAttribute(`uuid`)}))}},()=>{let e=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{options:n,prevPano:S,pano:{panoIndex:e.panoIndex,workCode:e.workCode},progress:0,state:e,userAction:this.userAction,error:null})),n.moveCancelCallback&&n.moveCancelCallback()})}checkSelectedPano(e){var t;this.stopMomentumMovement(),this.camera.getDirection(new c.Vector3).setY(0);let n=null,r=this.works.getObserver(this.currentPano);if(!r)return null;let i=r.work.observers,a=r.accessibleNodes.filter(e=>{if(e===this.currentPano.panoIndex&&r.work.workCode===this.currentPano.workCode)return!1;let t=i[e];return!t||Wv.copy(t.position).applyMatrix4(t.work.transform).distanceTo(this.camera.position)>this.maxAccessibleDistance?!1:t.loadable||t.active}),[o]=this.modelScene.intersectRaycaster(e);if(o){let[e,r]=Hl(a,e=>{let t=i[e];return t?Wv.copy(t.standingPosition).applyMatrix4(t.work.transform).distanceTo(o.point):1/0},!0);typeof e==`number`&&r<this.panoTapTriggerRadius&&(n=(t=i[e])==null?null:t)}if(ov(n)){let t=this.getForwardObserverOrNot(this.xrManager.cameraVR,e);t&&(n=t)}for(let e of this.locationMotion.keyframes){let t=this.panoResourceFromLocationMotionKeyframe(e);if(!(e.progress<this.locationMotion.progress)&&n){let e=Z({panoIndex:n.panoIndex,workCode:n.work.workCode});if(t.panoId===e){n=null;break}}}if(ov(n))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!n.active){let e=Z({panoIndex:n.panoIndex,workCode:n.work.workCode}),t=this.panoMeshes.get(e);t&&(t.setDisabled(!1),t.setLoading(!0))}let s={workCode:n.work.workCode,panoIndex:n.panoIndex,mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:0,offset:n?n.position.clone():new c.Vector3};return this.emit(`pano.select`,Q(`pano.select`,{prevPano:this.currentPano,pano:{panoIndex:s.panoIndex,workCode:s.workCode},state:s,userAction:!0,options:{},progress:0,error:null})),n&&n.active?(this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:s.panoIndex,workCode:s.workCode},progress:0,state:s,options:{},error:null})),{workCode:n.work.workCode,panoIndex:n.panoIndex}):null}destroy(){super.destroy()}isReady(){return!1}updateCamera(e,t,n){return Promise.resolve()}updateCameraWithKeyframes(e,t,n){return Promise.resolve()}updateTime(e,t,...n){var r,i,a,o,s,l,u,d,f;this.userAction=!0;let p={},m={},h=this.camera.getDirection(new c.Vector3),g=this.locationMotion.keyframes[0],_=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[v,y]=this.locationMotion.getKeyFrameSegment(e),b=this.panoResourceFromLocationMotionKeyframe(v),x=this.panoResourceFromLocationMotionKeyframe(y),S=this.panoResourceFromLocationMotionKeyframe(g),C=this.panoResourceFromLocationMotionKeyframe(_),w=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),m.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),p.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(U(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let t=this.locationMotion.value.count-y.value.count+1,n=new c.Vector3().copy(b.position),a=new c.Vector3().copy(x.position);if(p.progress=t,t>=.01&&t<=.99&&(p.progress=U(x.effectEasing(t),.01,.99)),x.leftPanoPicture&&(t<1?b.leftPanoPicture&&(p.pano0=b.leftPanoPicture):p.pano0=x.leftPanoPicture,p.pano1=x.leftPanoPicture),x.effect===`montage`?p.transition=`BLACK`:x.effect===`spread`?p.transition=`SPREAD`:p.transition=`FADE`,x.effect===`zoomin`||x.effect===`zoomout`?p.progress=Math.pow(t,3):x.effect===`model`&&this.camera.pose.distance<.01&&(p.modelAlpha=1-Math.pow(U(Math.abs(t-.5)*2,0,1),4)),t<1&&x.effect!==`fly`){if(p.pano0&&b.leftPanoPicture){let e={panoId:p.pano0.panoId,map:p.pano0.map,mapHistogram:p.pano0.mapHistogram,mapSize:p.pano0.mapSize,zoom:p.pano0.zoom,matrix:b.leftPanoPicture.matrix.clone().setPosition(x.position)},t=this.panoPictureObserverMap.get(p.pano0);t&&this.panoPictureObserverMap.set(e,t),p.pano0=e}n.copy(a),w=!0}m.distance=this.locationMotion.value.distance,m.offset=new c.Vector3(n.x+(a.x-n.x)*t,n.y+(a.y-n.y)*t,n.z+(a.z-n.z)*t);let o=[],s=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(o.push(t),n>this.locationMotion.progress&&s.push(t))}for(let e of Object.keys(this.panoResources)){if(s.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.leftPanoPicture){let e=t.leftPanoPicture.map;if(e){if(e===((r=p.pano0)==null?void 0:r.map)||e===((i=p.pano1)==null?void 0:i.map))continue;e.dispose(),t.leftPanoPicture=null}}o.indexOf(e)>=0||delete this.panoResources[e]}let l=yp(x.panoId);l!==this.currentPano&&(this.currentPano=l,this.accessibleObserverFloorCheckCount=0),this.emit(`pano.moving`,Q(`pano.moving`,{userAction:this.userAction,prevPano:yp(S.panoId),pano:yp(C.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},yp(C.panoId)),{mode:this.mode}),$(this.camera.pose)),m),options:{},progress:this.locationMotion.progress,error:null}))}this.camera.setFromPose(m),this.xrManager.cameraVR.projectionMatrix.copy(this.camera.projectionMatrix),this.xrManager.cameraVR.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.xrManager.cameraVR.matrix.copy(this.camera.matrix),this.xrManager.cameraVR.position.copy(this.camera.position),this.xrManager.cameraVR.quaternion.copy(this.camera.quaternion),this.xrManager.cameraVR.scale.copy(this.camera.scale),this.xrManager.cameraVR.matrixAutoUpdate=!1,this.xrManager.cameraVR.matrixWorld.copy(this.camera.matrixWorld);let[T,E]=n,D=new c.Vector3(0,0,0),O=new c.Vector2().copy(this.camera.resolution);if(E&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){let n=this.xrManager.cameraVR,r=this.xrManager.referenceSpace,i=this.xrManager.session.renderState.baseLayer,l=E.getViewerPose(r),u=(a=l==null?void 0:l.views)==null?[]:a;for(let e=0;e<u.length;e++){let t=u[e],r=n.cameras[e],a=i.getViewport(t);a&&(r.projectionMatrix.fromArray(t.projectionMatrix),r.projectionMatrixInverse.getInverse(r.projectionMatrix),r.matrix.fromArray(t.transform.matrix),r.matrix.setPosition(this.camera.position),r.matrix.decompose(r.position,r.quaternion,r.scale),r.matrixWorld.copy(r.matrix),r.matrixWorldInverse.getInverse(r.matrixWorld),r.matrixAutoUpdate=!1,D.copy(r.position),r.viewport.set(a.x,a.y,a.width,a.height),O.set(a.width,a.height))}if(this.xrManager.setProjectionFromUnion(this.xrManager.cameraVR,this.xrManager.cameraL,this.xrManager.cameraR),this.camera.quaternion.copy(this.xrManager.cameraVR.quaternion),this.camera.scale.copy(this.xrManager.cameraVR.scale),this.camera.matrix.compose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.computePose((o=m.distance)==null?this.camera.pose.distance:o),this.xrManager.session.inputSources){for(let e=0;e<this.xrManager.session.inputSources.length;e++)if(this.xrManager.session.inputSources[e]&&this.xrManager.session.inputSources[e].targetRayMode===`transient-pointer`){let t=E.getPose(this.xrManager.session.inputSources[e].targetRaySpace,r);if(t){let e=t.transform.orientation,n=new c.Quaternion(e.x,e.y,e.z,e.w),r=new c.Vector3(0,0,-1).applyQuaternion(n);this.gazeRay=new c.Raycaster(this.camera.position,r)}}}if(this.xrManager.machineType===`Oculus`||this.xrManager.machineType===`Pico`){let n=this.xrManager.session.inputSources;for(let e=0;e<n.length;e++){let t=this.xrManager.controllers[e],i=n[e];if(!i)continue;t&&t.update(i,E,r);let a=this.xrManager.getController(e),o=new c.Vector3(0,1.2,0),l=a.position.clone().add(D).sub(o);i.handedness===`left`?this.xrControllerRay.left.set(l,new c.Vector3(0,0,-1).applyEuler(a.rotation)):i.handedness===`right`&&this.xrControllerRay.right.set(l,new c.Vector3(0,0,-1).applyEuler(a.rotation)),this.controllerWrappers[e].position.copy(new c.Vector3(0,0,0).add(D).sub(o));let u=this.modelScene.intersectRaycaster(this.xrControllerRay.right);if(u.length===0){let e=this.works.getResolvedObserver(this.currentPano);u=this.xrControllerRay.right.intersectObject(this.modelScene.boundingMesh,!0).map(t=>{var n;let r=(n=e==null?void 0:e.floorIndex)==null?0:n;return Object.assign({floorIndex:r,floor:r},t)})}if(u.length>=1&&u[0].face)if(i.handedness===`right`){let e=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),t=u[0].face.normal,n=t.clone(),r=u[0].point.clone();this.intersectMesh.position.copy(r);let i=r.clone().add(n);if(this.intersectMesh.lookAt(i),Math.abs(t.y)>.99){let e=this.camera.position.clone().sub(r);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0,e.length>0?(this.pointerLines.right.setPoints(l,e[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(l,u[0].point));let a=u[0],o=Q(`intersect.update`,{raycaster:(s=this.xrControllerRay.right)==null?null:s,intersection:a==null?null:a,object:this.intersectMesh});if(this.emit(`intersect.update`,o),o.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(l,u[0].point)}this.updateControllerHelper(n,e,t)}}else E||console.error(`xrFrame丢失,请重试`),this.xrManager.session||console.error(`session丢失,请重试`),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error(`no layer found`);zh(p)===!1&&this.modelScene.parameter.set(p),this.emit(`camera.update`,Q(`camera.update`,{userAction:this.userAction,state:Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose))}));let k=this.works.getResolvedObserver(this.currentPano),A=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,j=this.works.getObserver(b.panoId),M=this.works.getObserver(x.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&k){let e=[],t=k.work.observers;for(let n of k.accessibleNodes){let r=t[n];r&&e.push(r)}let n=new Map;if(e.sort((e,t)=>{let r=n.get(e);r===void 0&&(r=e.standingPosition.distanceTo(k.standingPosition),n.set(e,r));let i=n.get(e);return i===void 0&&(i=t.standingPosition.distanceTo(k.standingPosition),n.set(t,i)),r-i}),e.length){this.accessibleObserverFloorCheckCount%=e.length;let t=e[this.accessibleObserverFloorCheckCount],n=this.modelScene.models.find(e=>e.work===(t==null?void 0:t.work));if(t&&n&&n.visible){let e=.3,r=.005,i=t.standingPosition.clone().applyMatrix4(t.work.transform),a=Z({panoIndex:t.panoIndex,workCode:t.work.workCode}),o=t_.map(t=>{Uv.ray.origin.copy(i),Uv.ray.origin.add(Wv.copy(t).setY(e)),Uv.ray.direction.set(0,-1,0),Uv.firstHitOnly=!0,Uv.floorIndex=-1;let[a]=n.intersectRaycaster(Uv);return a&&a.distance-r<=e?new c.Vector3().copy(i).setY(a.point.y+r):i});o.sort((e,t)=>t.y-e.y);let s=o[Math.floor(o.length/2)],[l]=o.filter(e=>e.distanceTo(s)<=.05);if(l){let e=new c.Vector4(i.x,i.y,i.z,l.y-i.y),t=this.adjustPanoCircleMeshPositionFix.get(a);t&&!e.equals(t)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(a,e)}}this.accessibleObserverFloorCheckCount++}}let N=new Map;if(j)for(let e of j.accessibleNodes){let t=j.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});N.set(e,t)}}if(M)for(let e of M.accessibleNodes){let t=M.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});N.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{N.get(t)?N.delete(t):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),N.forEach((e,t)=>{let n=this.panoCircleMeshCreator(e,{aerialObserverMinHeight:this.aerialObserverMinHeight});this.panoMeshes.set(t,n),this.helper.add(n),N.delete(t)}),this.panoMeshes.forEach((e,t)=>{let n=this.works.getObserver(t);if(n){let r=n.position.distanceTo(n.standingPosition)>this.aerialObserverMinHeight;if(r)e.position.copy(n.position).applyMatrix4(n.work.transform),e.scale.setScalar(18);else{e.position.copy(n.standingPosition).applyMatrix4(n.work.transform);let t=this.adjustPanoCircleMeshPositionFix.get(n.panoId);t&&(Wv.set(t.x,t.y,t.z),Wv.equals(e.position)&&(e.position.y+=t.w)),e.scale.setScalar(1.2)}let i=this.camera.position.clone().setY(e.position.y),a=new c.Vector3().copy(e.position).sub(i).normalize();if(t===Z(this.currentPano)){let t=U((.5-i.distanceTo(e.position))/.5,0,1);a.multiplyScalar(1-t).add(h.clone().multiplyScalar(t))}if(a.length()>0){let t=r?-Math.PI/2:0,n=Math.atan2(a.x,a.z);e.quaternion.setFromEuler(new c.Euler(t,n,0,`YXZ`))}}else e.visible=!1}),this.camera.pose.distance>.1||w)this.panoMeshes.forEach(n=>{n.setOpacity(0),n.setCurrent(!1),n.updateTime&&n.updateTime(e,t),n.visible=!1});else if(k){let n=k.work.observers,[,r]=Hl(k.accessibleNodes,e=>{let t=n[e];return!t||!t.active?1/0:k.standingPosition.distanceTo(t.standingPosition)},!0);r=U(r,2.5,1/0);let i=k.accessibleNodes.concat(k.panoIndex).map(e=>Z({panoIndex:e,workCode:k.work.workCode}));this.panoMeshes.forEach((n,a)=>{let o=this.works.getObserver(a),s=!1,c=1;if(i.indexOf(a)===-1)s=!1,c=0;else if(!o)s=!1,c=0;else if(!o.loadable&&!o.active)s=!1,c=0;else{let e=n.position.clone().project(this.camera);s=Math.abs(e.x)<1&&Math.abs(e.y)<1&&Math.abs(e.z)<1&&!n.loading&&n.progress===0&&A!==null&&Z({panoIndex:A.panoIndex,workCode:A.work.workCode})===a;let t=n.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);c=t<.01?0:U(r/t,.1,.85)}o&&o===M&&o.position.distanceTo(o.standingPosition)>this.aerialObserverMinHeight&&n.position.distanceTo(this.camera.position)<35&&(c=0),this.modelScene.parameter.resolveValue(`modelAlpha`)>0&&(c=0),n.setCurrent(s),n.setOpacity(c),n.updateTime&&n.updateTime(e,t)})}{let e=(l=this.modelScene.parameter.progress)==null?1:l,t=Math.round(e),n=this.modelScene.parameter.pano0,r=this.modelScene.parameter.pano1,i=t===0?n:r,a;if(i&&(a=this.works.getObserver(i.panoId),a||(a=this.panoPictureObserverMap.get(i))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(di()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!a||!i||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:O,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new c.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=ni(i.mapSize)+1;this.tiling.setObserver(a);let o={renderer:this.renderer,resolution:O,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:i.map,panoMatrix:i.matrix,panoZoom:i.zoom,minLevel:e,level:4},s=this.tiling.update(o),c={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:t,opacity:(n==null?void 0:n.panoId)===(r==null?void 0:r.panoId)?1:Xu(Math.abs(((u=this.modelScene.parameter.progress)==null?0:u)-.5)*2)},l=this.modelScene.parameter.refinedScreen;(s||c.pano!==(l==null?void 0:l.pano)||c.opacity!==(l==null?void 0:l.opacity))&&this.modelScene.parameter.set(`refinedScreen`,c)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&k&&k.position.y-k.standingPosition.y>10){let e=U(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1);{let e=x.effect,{pano0:t,pano1:n}=this.modelScene.parameter;if(t&&n&&t!==n&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((d=this.modelScene.parameter.pano0Depth)==null?void 0:d.panoId)!==t.panoId||((f=this.modelScene.parameter.pano1Depth)==null?void 0:f.panoId)!==n.panoId){this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new c.WebGLCubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new c.WebGLCubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1});let e=new c.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);e.matrix.copy(t.matrix),e.matrixWorld.copy(e.matrix),e.matrixAutoUpdate=!1,Zg(this.renderer,this.modelScene,e,500);let r=new c.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);r.matrix.copy(n.matrix),r.matrixWorld.copy(r.matrix),r.matrixAutoUpdate=!1,Zg(this.renderer,this.modelScene,r,500),this.modelScene.parameter.set({pano0Depth:{panoId:t.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:500},pano1Depth:{panoId:n.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:500}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}render(){if(this.xrManager.session&&this.xrManager.session.renderState.baseLayer){let e=this.xrManager.session.renderState.baseLayer;return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.renderer.setFramebuffer(e.framebuffer),this.renderer.render(this.scene,this.xrManager.cameraVR),this.renderer.setFramebuffer(null),!0}return!1}onPanGesture(){}onTapGesture(){}onPinchGesture(){}onMouseMove(){}onMouseOut(){}panoResourceFromLocationMotionKeyframe(e){return this.panoResources[e.key]}updateControllerHelper(e,t,n){let r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(!e||e.length===0)return;let a={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}};for(let o=0;o<e.length;o++){let s=e[o].handedness,c=e[o].gamepad;switch(s){case`left`:c.axes&&(this.emitHandleEvent(c.axes[2]===-1,`LeftAxesLeft`,t),this.emitHandleEvent(c.axes[2]===1,`LeftAxesRight`,t),this.emitHandleEvent(c.axes[3]===-1,`LeftAxesUp`,t),this.emitHandleEvent(c.axes[3]===1,`LeftAxesDown`,t)),c!=null&&c.buttons&&(c.buttons[4]&&this.emitHandleEvent(c.buttons[4].pressed,`X`,t),c.buttons[5]&&this.emitHandleEvent(c.buttons[5].pressed,`Y`,t),c.buttons[0]&&this.emitHandleEvent(c.buttons[0].pressed,`LeftTrigger`,t),c.buttons[1]&&this.emitHandleEvent(c.buttons[1].pressed,`LeftPinch`,t));let e={raycaster:r,axes:{up:c.axes&&c.axes[3]<0?Math.abs(c.axes[3]):0,down:c.axes&&c.axes[3]<0?0:Math.abs(c.axes[3]),left:c.axes&&c.axes[2]<0?Math.abs(c.axes[2]):0,right:c.axes&&c.axes[2]<0?0:Math.abs(c.axes[2])},deltaTime:n};a.buttons.X=c.buttons&&c.buttons[4]?c.buttons[4].pressed:!1,a.buttons.Y=c.buttons&&c.buttons[5]?c==null?void 0:c.buttons[5].pressed:!1,a.buttons.LeftTrigger=c.buttons&&c.buttons[0]?c==null?void 0:c.buttons[0].pressed:!1,a.buttons.LeftPinch=c.buttons&&c.buttons[1]?c==null?void 0:c.buttons[1].pressed:!1,a.left=e;break;case`right`:c.axes&&(this.emitHandleEvent(c.axes[2]===-1,`RightAxesLeft`,t),this.emitHandleEvent(c.axes[2]===1,`RightAxesRight`,t),this.emitHandleEvent(c.axes[3]===-1,`RightAxesUp`,t),this.emitHandleEvent(c.axes[3]===1,`RightAxesDown`,t)),c.buttons&&(c.buttons[4]&&this.emitHandleEvent(c.buttons[4].pressed,`A`,t),c.buttons[5]&&this.emitHandleEvent(c.buttons[5].pressed,`B`,t),c.buttons[0]&&this.emitHandleEvent(c.buttons[0].pressed,`RightTrigger`,t),c.buttons[1]&&this.emitHandleEvent(c.buttons[1].pressed,`RightPinch`,t)),a.right={raycaster:i,axes:{up:c.axes&&c.axes[3]<0?Math.abs(c.axes[3]):0,down:c.axes&&c.axes[3]<0?0:Math.abs(c.axes[3]),left:c.axes&&c.axes[2]<0?Math.abs(c.axes[2]):0,right:c.axes&&c.axes[2]<0?0:Math.abs(c.axes[2])},deltaTime:n},a.buttons.A=c.buttons&&c.buttons[4]?c==null?void 0:c.buttons[4].pressed:!1,a.buttons.B=c.buttons&&c.buttons[5]?c==null?void 0:c.buttons[5].pressed:!1,a.buttons.RightTrigger=c.buttons&&c.buttons[0]?c==null?void 0:c.buttons[0].pressed:!1,a.buttons.RightPinch=c.buttons&&c.buttons[1]?c==null?void 0:c.buttons[1].pressed:!1;break;default:break}}this.emit(`xr.controller.update`,Q(`xr.controller.update`,a))}emitHandleEvent(e,t,n){let r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(e)this.xrHandleState[t].touchStart===!1?(this.xrHandleState[t].touchStartTime=n,this.xrHandleState[t].touchStart=!0,this.emit(`xr.gesture.buttonDown`,Q(`xr.gesture.buttonDown`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}))):n-this.xrHandleState[t].touchStartTime>Hv&&this.emit(`xr.gesture.press`,Q(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}));else if(this.xrHandleState[t].touchStart===!0){if(this.emit(`xr.gesture.buttonUp`,Q(`xr.gesture.buttonUp`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}})),n-this.xrHandleState[t].touchStartTime<=Hv){let e=Q(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}});!this.emit(`xr.gesture.tap`,e)&&!e.defaultPrevented&&t===`RightTrigger`&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[t].touchStart=!1,this.xrHandleState[t].touchStartTime=0}}initHandEvent(){if(!this.xrManager.session)throw Error(`初始化失败`);this.xrManager.session.addEventListener(`select`,e=>{this.gazeRay&&this.checkSelectedPano(this.gazeRay)})}}},Kv={Floorplan:tg,Topview:rg,Panorama:n_,VRPanorama:q_,Model:Q_,Mapview:iv,XRPanorama:Bv},qv=`gesture.pan,gesture.tap,gesture.dbltap,gesture.press,gesture.pinch,gesture.mousewheel,gesture.mousemove,gesture.momentum,gesture.fire,initAnimation.start,initAnimation.end,camera.update,intersect.update,pano.select,pano.moveTo,pano.moving,pano.arrived,pano.cancel,pano.error,pano.prepare,pano.texture.load,pano.texture.progress,pano.texture.success,pano.texture.error,pano.texture.abort,xr.session.start,xr.session.end,xr.gesture.tap,xr.gesture.press,xr.gesture.buttonUp,xr.gesture.buttonDown,xr.controller.update`.split(`,`);function Jv(e){e.on(`initAnimation.start`,t=>{e.emit(`initAnimationWillStart`,t.state.panoIndex,t.state,t.userAction)}),e.on(`initAnimation.end`,t=>{e.emit(`initAnimationEnded`,t.state.panoIndex,t.state,t.userAction)}),e.on(`gesture.pan`,t=>{let n=!1;n=e.emit(`wantsGesture`,`pan`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPanGesture`,t.state,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`pan`,t.pointers,t.isFinal),e.emit(`panGesture`,t.state,t.isFinal))}),e.on(`gesture.tap`,t=>{let n=!1;n=e.emit(`wantsGesture`,`tap`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsTapGesture`,t.center.raycaster,t.center.coords,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`tap`,t.pointers,t.isFinal),e.emit(`tapGesture`,t.center.raycaster,t.center.coords,t.isFinal))}),e.on(`gesture.dbltap`,t=>{let n=!1;n=e.emit(`wantsGesture`,`dbltap`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsDblTapGesture`,t.center.raycaster,t.center.coords,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`dbltap`,t.pointers,t.isFinal),e.emit(`dblTapGesture`,t.center.raycaster,t.center.coords,t.isFinal))}),e.on(`gesture.press`,t=>{let n=!1;n=e.emit(`wantsGesture`,`press`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPressGesture`,t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`press`,t.pointers,t.isFinal),e.emit(`pressGesture`,t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),e.on(`gesture.pinch`,t=>{let n=!1;n=e.emit(`wantsGesture`,`pinch`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPinchGesture`,t.scale,t.state.fov,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`pinch`,t.pointers,t.isFinal),e.emit(`pinchGesture`,t.scale,t.state.fov,t.isFinal))}),e.on(`gesture.mousewheel`,t=>{let n=!1;n=e.emit(`wantsGesture`,`mouseWheel`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsMouseWheel`,t.center.delta,t.state.fov,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`mouseWheel`,t.pointers,t.isFinal),e.emit(`mouseWheel`,t.center.delta,t.state.fov,t.isFinal))}),e.on(`gesture.mousemove`,t=>{let n=!1;n=e.emit(`wantsGesture`,`mouseMove`,t.pointers,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`mouseMove`,t.pointers,t.isFinal),n=e.emit(`wantsChangeCameraFov`,t.state.fov),n&&t.preventDefault())}),e.on(`gesture.momentum`,t=>{let n=!1;n=e.emit(`wantsInteriaPan`,t.state),n&&t.preventDefault(),t.defaultPrevented||e.emit(`interiaPan`,t.state,t.isFinal)}),e.on(`camera.update`,t=>{e.emit(`cameraFovUpdate`,t.state.fov,t.userAction),e.emit(`cameraDirectionUpdate`,t.state,t.userAction);let n=Ht(t.state);n.setLength(t.state.distance);let r=t.state.offset.clone().sub(n);e.emit(`cameraPositionUpdate`,r,t.userAction),e.emit(`cameraUpdate`,t.state,t.userAction)}),e.on(`intersect.update`,t=>{if(t.intersection){let n=!1;n=e.emit(`wantsShowIntersectionOnModel`,t.raycaster),n&&t.preventDefault(),t.defaultPrevented||e.emit(`intersectionOnModelUpdate`,t.intersection,t.object)}else e.emit(`intersectionHidden`)}),e.on(`pano.request`,t=>{let n=e.emit(`wantsMoveToPano`,t.state.panoIndex,t.options,t.userAction);n||(n=e.emit(`wantsToMoveToPano`,t.state.panoIndex,t.options,t.userAction)),n&&t.preventDefault(),t.defaultPrevented||e.emit(`panoWillLoad`,t.state.panoIndex)}),e.on(`pano.select`,t=>{e.emit(`panoSelected`,t.state.panoIndex)}),e.on(`pano.moveTo`,t=>{e.emit(`panoLoaded`,t.state.panoIndex),e.emit(`moveToPano`,t.state.panoIndex,t.userAction),e.emit(`panoWillArrive`,t.state.panoIndex,t.state,t.userAction)}),e.on(`pano.moving`,t=>{e.emit(`movingToPano`,t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),e.on(`pano.arrived`,t=>{e.emit(`panoArrived`,t.state.panoIndex,t.state,t.userAction)}),e.on(`pano.cancel`,t=>{e.emit(`moveToPanoCanceled`,t.state.panoIndex)}),e.on(`pano.error`,t=>{e.emit(`panoLoadError`,t.error,t.state.panoIndex)}),e.on(`pano.texture.load`,t=>{e.emit(`textureStartLoad`,t.pano.panoIndex)}),e.on(`pano.texture.success`,t=>{e.emit(`textureLoaded`,t.pano.panoIndex,t.meta)}),e.on(`pano.texture.error`,t=>{e.emit(`textureError`,t.error,t.pano.panoIndex)}),e.on(`pano.texture.abort`,t=>{e.emit(`textureAbort`,t.pano.panoIndex)}),e.on(`pano.texture.progress`,t=>{e.emit(`textureLoading`,t.progress,t.pano.panoIndex)}),e.on(`xr.session.start`,t=>{e.emit(`webXRSessionStart`)}),e.on(`xr.session.end`,t=>{e.emit(`webXRSessionEnd`)}),e.on(`xr.gesture.tap`,t=>{e.emit(`webXRControllerEvent`,`tap`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.press`,t=>{e.emit(`webXRControllerEvent`,`press`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.buttonUp`,t=>{e.emit(`webXRControllerEvent`,`buttonUp`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.buttonDown`,t=>{e.emit(`webXRControllerEvent`,`buttonDown`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.controller.update`,t=>{e.emit(`webXRControllerRayUpdate`,{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&e.emit(`webXRAxesUpdate`,`left`,{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.left.axes.up,down:t.left.axes.down,left:t.left.axes.left,right:t.left.axes.right},deltaTime:t.left.deltaTime}),t.right&&e.emit(`webXRAxesUpdate`,`right`,{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.right.axes.up,down:t.right.axes.down,left:t.right.axes.left,right:t.right.axes.right},deltaTime:t.right.deltaTime})}),e.on(`works.request`,t=>{e.emit(`willLoad`,t.input,t.works[0],e.getCurrentState())}),e.on(`works.load`,t=>{e.emit(`load`,t.input,t.works[0],e.getCurrentState())}),e.on(`works.ready`,t=>{e.emit(`loaded`,t.input,t.works[0])}),e.on(`state.change`,t=>{e.emit(`stateChange`,t.state,t.userAction)}),e.on(`currentState.change`,t=>{e.emit(`currentStateChange`,t.state,t.userAction)}),e.on(`state.set`,t=>{e.emit(`setState`,t.state)}),e.on(`state.synced`,t=>{e.emit(`stateSynced`,t.state)}),e.on(`model.request`,t=>{e.emit(`modelWillLoad`,t.work.model)}),e.on(`model.error`,t=>{e.emit(`modelLoadError`,t.error,t.model)}),e.on(`model.load`,t=>{e.emit(`modelLoaded`,t.model)}),e.on(`model.changeShownFloor`,t=>{e.emit(`modelShownFloorChange`,t.model.shownFloor,t.model.floorLength)}),e.on(`render`,t=>{e.emit(`renderFrame`,t.needsRender)}),e.on(`mode.change.request`,t=>{e.emit(`wantsChangeMode`,t.mode,t.prevMode)}),e.on(`mode.change`,t=>{e.emit(`modeChange`,t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),e.on(`helpers.visible`,t=>{e.emit(`helpersVisibleChange`,t.object.visible)}),e.on(`network.resource`,t=>{e.emit(`network`,t.source,t.requestType,t.requestState,t.detail)})}function Yv(){if(typeof window<`u`){let e=document.createElement(`video`);e.loop=!0,e.autoplay=!0,e.playsInline=!0,e.muted=!0,e.crossOrigin=``;let t=()=>{document.removeEventListener(`touchstart`,t,!1),document.removeEventListener(`mousedown`,t,!1),e.muted=!1};return document.addEventListener(`touchstart`,t,!1),document.addEventListener(`mousedown`,t,!1),e}else return{}}function Xv(){let e=new c.Group;e.name=`internalLights`;{let t=new c.DirectionalLight(16777215,.1);t.name=`direction0`,t.position.copy(new c.Vector3(0,1,0)),e.add(t)}{let t=new c.DirectionalLight(16777215,.1);t.name=`direction1`,t.position.copy(new c.Vector3(-1,-1,-1)),e.add(t)}{let t=new c.DirectionalLight(16777215,.3);t.name=`direction2`,t.position.copy(new c.Vector3(1,1,1)),e.add(t)}{let t=new c.AmbientLight(16777215,.6);t.name=`ambient0`,e.add(t)}return e}function Zv(e){var t,n;let r={},i=e.split(/(\;|\,)/);for(let e of i){let i=e.split(`=`),a=(t=i[0])==null?void 0:t.trim(),o=(n=i[1])==null?void 0:n.trim();a&&o&&(r[a]=o)}return r}function Qv(){var e;if(typeof document<`u`){let t=document.getElementsByTagName(`meta`);for(let n=0;n<t.length;n++){let r=t[n];if(r.getAttribute(`name`)===`viewport`){let t=Zv((e=r.getAttribute(`content`))==null?``:e),n=Number(t[`initial-scale`]);if(!isNaN(n))return n}}}return 1}var $v=`data:image/png;base64,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`,ey=[351,63],ty=[20,20],ny=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),ry=new Float32Array([0,0,1,0,0,1,1,1]),iy=new Uint8Array([0,1,2,1,3,2]),ay=new c.BufferGeometry;ay.setAttribute(`position`,new c.BufferAttribute(ny,3)),ay.setAttribute(`uv`,new c.BufferAttribute(ry,2)),ay.setIndex(new c.BufferAttribute(iy,1));var oy=new c.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),sy=new c.Mesh(ay,oy);sy.matrixAutoUpdate=!1;var cy=new c.Scene;cy.add(sy),cy.matrixAutoUpdate=!1;var ly=new c.OrthographicCamera(-.5,.5,.5,-.5,.1,1);ly.position.set(0,0,.5),ly.lookAt(0,0,0),ly.updateMatrixWorld(!0),ly.matrixAutoUpdate=!1;var uy=new c.Vector4,dy=new c.Vector4;function fy(e){if(oy.map){let t=e.getViewport(uy),n=e.getScissor(dy),r=e.getScissorTest(),i=e.autoClear,a=n.x+ty[0]/3,o=n.y+ty[1]/3,s=ey[0]/3,c=ey[1]/3;e.setViewport(a,o,s,c),e.setScissor(a,o,s,c),e.setScissorTest(!0),e.autoClear=!1,e.render(cy,ly),e.setViewport(t),e.setScissor(n),e.setScissorTest(r),e.autoClear=i}else{let e=new c.Texture,t=new Image;t.onload=()=>{e.image=t,e.wrapS=c.ClampToEdgeWrapping,e.wrapT=c.ClampToEdgeWrapping,e.minFilter=c.LinearFilter,e.needsUpdate=!0,e.generateMipmaps=!1,oy.needsUpdate=!0,t.onload=K},t.src=$v,oy.map=e}}var py=`(function(){function e(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}async function t(e={}){var t,n=e,r=!1,i=!0,a=self.location.href;if(r||i)try{new URL(\`.\`,a).href}catch{}console.log.bind(console),console.error.bind(console);var o=!1;function s(e){for(var t=0,n=e.length,r=new Uint8Array(n),i;t<n;++t)i=e.charCodeAt(t),r[t]=~i>>8&i;return r}var c,l,u=!1;function d(){var e=M.buffer;new Int8Array(e),new Int16Array(e),n.HEAPU8=l=new Uint8Array(e),new Uint16Array(e),new Int32Array(e),n.HEAPU32=new Uint32Array(e),n.HEAPF32=new Float32Array(e),new Float64Array(e),new BigInt64Array(e),new BigUint64Array(e)}function f(){if(n.preRun)for(typeof n.preRun==\`function\`&&(n.preRun=[n.preRun]);n.preRun.length;)T(n.preRun.shift());x(w)}function p(){u=!0,I.c()}function m(){if(n.postRun)for(typeof n.postRun==\`function\`&&(n.postRun=[n.postRun]);n.postRun.length;)C(n.postRun.shift());x(S)}var h;function g(){return s(\`\\0asm\\0\\0\\0&\\\`\\\`}}\\\`}\\\`\\0\\\`\\v\\0\\\`\\0\\0\\x07aa\\0\\0\\b\\x07\\0\\0\\x07‚€€\\bA€Œ\\v\\x07b\\0c\\0\\x07d\\0e\\0f\\0\\f
2240
2240
  ™@\\x07T~@A€\\b(\\0"­ \\0­B\\x07|Bøÿÿÿƒ|"BÿÿÿÿX@ §"\\0?\\0AtM\\r \\0\\0\\r\\vA„\\bA06\\0A\\vA€\\b \\x006\\0 \\v\\0 \\0 Atr\\vr \\0¼"Aÿÿÿq!@ AvAÿq"E\\r\\0 Að\\0M@ A€€€rAñ\\0 kv!\\f\\v AK@A€ø!A\\0!\\f\\v A
2241
2241
  tA€€\\x07k!\\v  AvA€€qr A\\rvr\\vß\\v\\b@ \\0E\\r\\0 \\0A\\bk" \\0Ak(\\0"Axq"\\0j!@ Aq\\r\\0 AqE\\r  (\\0"k"A˜\\b(\\0I\\r \\0 j!\\0@@@Aœ\\b(\\0 G@ (\\f! AÿM@  (\\b"G\\rAˆ\\bAˆ\\b(\\0A~ Avwq6\\0\\f\\v (!\\x07  G@ (\\b" 6\\f  6\\b\\f\\v (" Aj ("E\\r Aj\\v!@ ! "Aj! ("\\r\\0 Aj! ("\\r\\0\\v A\\x006\\0\\f\\v ("AqAG\\rA\\b \\x006\\0  A~q6  \\0Ar6  \\x006\\0\\v  6\\f  6\\b\\f\\vA\\0!\\v \\x07E\\r\\0@ ("At"(¸
2242
2242
  F@ A¸
@@ -2262,7 +2262,7 @@ j \\x006\\0 \\0\\rAŒ\\b \\vA~ wq6\\0\\f\\v@  (F@ \\x006\\f\\v
2262
2262
  Aj$\\0 \\0\\v¡\\v\\v }#\\0A\\xA0k"\\v$\\0 \\vA0jA\\0A$ü\\v\\0@  G@  Al"\\fAjAt"j*\\0!  \\fAjAt"j*\\0! \\b \\fAt"j  j*\\0"8\\0 \\b j 8\\0 \\b j 8\\0 \\x07 Atj"\\rA\\x006\\f \\r 8\\b \\r 8 \\r 8\\0@ \\0E@  j-\\0\\0E\\r\\v \\rA€€€\\b6\\f\\v \\r  At"\\fAr"j-\\0\\0A\\bt  \\fj-\\0\\0r  \\fAr"j-\\0\\0Atr  \\fAr"\\fj-\\0\\0Atr6 \\v  At"j*\\0"8 \\v  At"j*\\0"8” \\v  \\fAt"j*\\0"8˜ \\v  At"j*\\0Œ"8œ \\vAà\\0j"\\f \\v*˜"C\\0\\0\\0À” ” \\v*”"C\\0\\0\\0À” ”C\\0\\0€?’’8\\0 \\f \\v*" ’ \\v*”” \\v*˜" ’ \\v*œ”“8 \\f \\v*" ’ \\v*˜” \\v*”" ’ \\v*œ”’8\\b \\f \\v*" ’ \\v*”” \\v*˜" ’ \\v*œ”’8\\f \\f \\v*˜"C\\0\\0\\0À” ” \\v*"C\\0\\0\\0À” ”C\\0\\0€?’’8 \\f \\v*”" ’ \\v*˜” \\v*" ’ \\v*œ”“8 \\f \\v*" ’ \\v*˜” \\v*”" ’ \\v*œ”“8 \\f \\v*”" ’ \\v*˜” \\v*" ’ \\v*œ”’8 \\f \\v*”"C\\0\\0\\0À” ” \\v*"C\\0\\0\\0À” ”C\\0\\0€?’’8 j 8\\0 j 8\\0 j 8\\0 j 8\\0 \\v  j*\\0"80 \\v  j*\\0"8@ \\v  j*\\0"8P
2263
2263
  j 8\\0
2264
2264
  j 8\\0
2265
- j 8\\0 \\v \\f* \\v*8” \\f*\\0 \\v*0” \\f*\\f \\v*4”’’8\\0 \\v \\f* \\v*8” \\f* \\v*0” \\f* \\v*4”’’8 \\v \\f* \\v*8” \\f*\\b \\v*0” \\f* \\v*4”’’8\\b \\v \\f* \\v*D” \\f*\\0 \\v*<” \\f*\\f \\v*@”’’8\\f \\v \\f* \\v*D” \\f* \\v*<” \\f* \\v*@”’’8 \\v \\f* \\v*D” \\f*\\b \\v*<” \\f* \\v*@”’’8 \\v \\f* \\v*P” \\f*\\0 \\v*H” \\f*\\f \\v*L”’’8 \\v \\f* \\v*P” \\f* \\v*H” \\f* \\v*L”’’8 \\v \\f* \\v*P” \\f*\\b \\v*H” \\f* \\v*L”’’8 \\v* ! \\v*\\b! \\v*! \\r \\v*" ” \\v*\\0" ” \\v*\\f"\\x1B \\x1B”’’C\\0\\0€@”  \\v*"”  \\v*"” \\x1B \\v*"”’’C\\0\\0€@”6 \\r  ”  ” \\x1B ”’’C\\0\\0€@”  ”  ”  ”’’C\\0\\0€@”6 \\r  ”  ”  ”’’C\\0\\0€@”  ”  ”  ”’’C\\0\\0€@”6 Aj!\\f\\v\\v \\vA\\xA0j$\\0\\v\\0\\v\\v \\0A\\b\\v\`)}function _(e){return e}function v(e,t){var n,r=_(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function y(){return{a:P}}function b(){function e(e,t){return I=e.exports,N(I),d(),I}var t=y();return n.instantiateWasm?new Promise((r,i)=>{n.instantiateWasm(t,(t,n)=>{r(e(t,n))})}):(h??=g(),e(v(h,t)[0]))}for(var x=e=>{for(;e.length>0;)e.shift()(n)},S=[],C=e=>S.push(e),w=[],T=e=>w.push(e),E=()=>2147483648,D=(e,t)=>Math.ceil(e/t)*t,O=e=>{var t=(e-M.buffer.byteLength+65535)/65536|0;try{return M.grow(t),d(),1}catch{}},k=e=>{var t=l.length;e>>>=0;var n=E();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),O(Math.min(n,D(Math.max(e,i),65536))))return!0}return!1},A=new Uint8Array(123),j=25;j>=0;--j)A[48+j]=52+j,A[65+j]=j,A[97+j]=26+j;if(A[43]=62,A[47]=63,n.noExitRuntime&&n.noExitRuntime,n.print&&n.print,n.printErr&&n.printErr,n.wasmBinary&&n.wasmBinary,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.preInit)for(typeof n.preInit==\`function\`&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.shift()();var M;function N(e){n._pack=e.d,n._malloc=e.e,n._free=e.f,M=e.b,e.__indirect_function_table}var P={a:k};function F(){f();function e(){n.calledRun=!0,!o&&(p(),c?.(n),n.onRuntimeInitialized?.(),m())}n.setStatus?(n.setStatus(\`Running...\`),setTimeout(()=>{setTimeout(()=>n.setStatus(\`\`),1),e()},1)):e()}var I=b();return F(),t=u?n:new Promise((e,t)=>{c=e}),t}let n;function r(){return e(this,void 0,void 0,function*(){n=yield t()})}let i=0,a=[],o=!1,s=!1,c,l,u,d,f,p,m,h,g,_=t=>e(void 0,void 0,void 0,function*(){for(;s;)yield new Promise(e=>setTimeout(e,0));n||(s=!0,yield r(),s=!1);let e=2**Math.ceil(Math.log2(t.vertexCount));e>i&&(i>0&&(n._free(c),n._free(l),n._free(u),n._free(d),n._free(f),n._free(p),n._free(m),n._free(h),n._free(g)),i=e,c=n._malloc(3*i*4),l=n._malloc(4*i*4),u=n._malloc(3*i*4),d=n._malloc(4*i),f=n._malloc(i),p=n._malloc(8*i*4),m=n._malloc(3*i*4),h=n._malloc(4*i*4),g=n._malloc(3*i*4)),n.HEAPF32.set(t.positions,c/4),n.HEAPF32.set(t.rotations,l/4),n.HEAPF32.set(t.scales,u/4),n.HEAPU8.set(t.colors,d),n.HEAPU8.set(t.selection,f),n._pack(t.selected,t.vertexCount,c,l,u,d,f,p,m,h,g);let a=new Uint32Array(n.HEAPU32.buffer,p,t.vertexCount*8),_=new Uint32Array(a.slice().buffer),v=new Float32Array(n.HEAPF32.buffer,m,t.vertexCount*3),y=new Float32Array(v.slice().buffer),b=new Float32Array(n.HEAPF32.buffer,h,t.vertexCount*4),x=new Float32Array(b.slice().buffer),S=new Float32Array(n.HEAPF32.buffer,g,t.vertexCount*3),C={data:_,worldPositions:y,worldRotations:x,worldScales:new Float32Array(S.slice().buffer),offset:t.offset,vertexCount:t.vertexCount,positions:t.positions.buffer,rotations:t.rotations.buffer,scales:t.scales.buffer,colors:t.colors.buffer,selection:t.selection.buffer};self.postMessage({response:C},[C.data.buffer,C.worldPositions.buffer,C.worldRotations.buffer,C.worldScales.buffer,C.positions,C.rotations,C.scales,C.colors,C.selection]),o=!1}),v=()=>{a.length!==0&&(o||(o=!0,_(a.shift()),setTimeout(()=>{o=!1,v()},0)))};self.onmessage=e=>new Promise((t,n)=>{if(e.data.splat){let n=e.data.splat;for(let e=0;e<a.length;e++)if(a[e].offset===n.offset){a[e]=n,t(!0);return}a.push(n),v(),t(!0)}})})();`,dy=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,uy],{type:`text/javascript;charset=utf-8`});function fy(e){let t;try{if(t=dy&&(self.URL||self.webkitURL).createObjectURL(dy),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(uy),{name:e==null?void 0:e.name})}}function py(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function my(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){py(a,r,i,o,s,`next`,e)}function s(e){py(a,r,i,o,s,`throw`,e)}o(void 0)})}}function hy(){return gy.apply(this,arguments)}function gy(){return gy=my(function*(e={}){var t,n=e,r=!1,i=!0,a={}.url;if(r||i){try{new URL(`.`,a).href}catch(e){}(function(){var e=my(function*(e){var t=yield fetch(e,{credentials:`same-origin`});if(t.ok)return t.arrayBuffer();throw Error(t.status+` : `+t.url)});return function(t){return e.apply(this,arguments)}})()}console.log.bind(console),console.error.bind(console);var o=!1;function s(e){for(var t=0,n=e.length,r=new Uint8Array(n),i;t<n;++t)i=e.charCodeAt(t),r[t]=~i>>8&i;return r}var c,l,u=!1;function d(){var e=M.buffer;new Int8Array(e),new Int16Array(e),n.HEAPU8=l=new Uint8Array(e),new Uint16Array(e),new Int32Array(e),n.HEAPU32=new Uint32Array(e),n.HEAPF32=new Float32Array(e),new Float64Array(e),new BigInt64Array(e),new BigUint64Array(e)}function f(){if(n.preRun)for(typeof n.preRun==`function`&&(n.preRun=[n.preRun]);n.preRun.length;)T(n.preRun.shift());x(w)}function p(){u=!0,te.c()}function m(){if(n.postRun)for(typeof n.postRun==`function`&&(n.postRun=[n.postRun]);n.postRun.length;)C(n.postRun.shift());x(S)}var h;function g(){return s(`\0asm\0\0\0&\`\`}}\`}\`\0\`\v\0\`\0\0\x07aa\0\0\b\x07\0\0\x07‚€€\bA€Œ\v\x07b\0c\0\x07d\0e\0f\0\f
2265
+ j 8\\0 \\v \\f* \\v*8” \\f*\\0 \\v*0” \\f*\\f \\v*4”’’8\\0 \\v \\f* \\v*8” \\f* \\v*0” \\f* \\v*4”’’8 \\v \\f* \\v*8” \\f*\\b \\v*0” \\f* \\v*4”’’8\\b \\v \\f* \\v*D” \\f*\\0 \\v*<” \\f*\\f \\v*@”’’8\\f \\v \\f* \\v*D” \\f* \\v*<” \\f* \\v*@”’’8 \\v \\f* \\v*D” \\f*\\b \\v*<” \\f* \\v*@”’’8 \\v \\f* \\v*P” \\f*\\0 \\v*H” \\f*\\f \\v*L”’’8 \\v \\f* \\v*P” \\f* \\v*H” \\f* \\v*L”’’8 \\v \\f* \\v*P” \\f*\\b \\v*H” \\f* \\v*L”’’8 \\v* ! \\v*\\b! \\v*! \\r \\v*" ” \\v*\\0" ” \\v*\\f"\\x1B \\x1B”’’C\\0\\0€@”  \\v*"”  \\v*"” \\x1B \\v*"”’’C\\0\\0€@”6 \\r  ”  ” \\x1B ”’’C\\0\\0€@”  ”  ”  ”’’C\\0\\0€@”6 \\r  ”  ”  ”’’C\\0\\0€@”  ”  ”  ”’’C\\0\\0€@”6 Aj!\\f\\v\\v \\vA\\xA0j$\\0\\v\\0\\v\\v \\0A\\b\\v\`)}function _(e){return e}function v(e,t){var n,r=_(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function y(){return{a:P}}function b(){function e(e,t){return I=e.exports,N(I),d(),I}var t=y();return n.instantiateWasm?new Promise((r,i)=>{n.instantiateWasm(t,(t,n)=>{r(e(t,n))})}):(h??=g(),e(v(h,t)[0]))}for(var x=e=>{for(;e.length>0;)e.shift()(n)},S=[],C=e=>S.push(e),w=[],T=e=>w.push(e),E=()=>2147483648,D=(e,t)=>Math.ceil(e/t)*t,O=e=>{var t=(e-M.buffer.byteLength+65535)/65536|0;try{return M.grow(t),d(),1}catch{}},k=e=>{var t=l.length;e>>>=0;var n=E();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),O(Math.min(n,D(Math.max(e,i),65536))))return!0}return!1},A=new Uint8Array(123),j=25;j>=0;--j)A[48+j]=52+j,A[65+j]=j,A[97+j]=26+j;if(A[43]=62,A[47]=63,n.noExitRuntime&&n.noExitRuntime,n.print&&n.print,n.printErr&&n.printErr,n.wasmBinary&&n.wasmBinary,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.preInit)for(typeof n.preInit==\`function\`&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.shift()();var M;function N(e){n._pack=e.d,n._malloc=e.e,n._free=e.f,M=e.b,e.__indirect_function_table}var P={a:k};function F(){f();function e(){n.calledRun=!0,!o&&(p(),c?.(n),n.onRuntimeInitialized?.(),m())}n.setStatus?(n.setStatus(\`Running...\`),setTimeout(()=>{setTimeout(()=>n.setStatus(\`\`),1),e()},1)):e()}var I=b();return F(),t=u?n:new Promise((e,t)=>{c=e}),t}let n;function r(){return e(this,void 0,void 0,function*(){n=yield t()})}let i=0,a=[],o=!1,s=!1,c,l,u,d,f,p,m,h,g,_=t=>e(void 0,void 0,void 0,function*(){for(;s;)yield new Promise(e=>setTimeout(e,0));n||(s=!0,yield r(),s=!1);let e=2**Math.ceil(Math.log2(t.vertexCount));e>i&&(i>0&&(n._free(c),n._free(l),n._free(u),n._free(d),n._free(f),n._free(p),n._free(m),n._free(h),n._free(g)),i=e,c=n._malloc(3*i*4),l=n._malloc(4*i*4),u=n._malloc(3*i*4),d=n._malloc(4*i),f=n._malloc(i),p=n._malloc(8*i*4),m=n._malloc(3*i*4),h=n._malloc(4*i*4),g=n._malloc(3*i*4)),n.HEAPF32.set(t.positions,c/4),n.HEAPF32.set(t.rotations,l/4),n.HEAPF32.set(t.scales,u/4),n.HEAPU8.set(t.colors,d),n.HEAPU8.set(t.selection,f),n._pack(t.selected,t.vertexCount,c,l,u,d,f,p,m,h,g);let a=new Uint32Array(n.HEAPU32.buffer,p,t.vertexCount*8),_=new Uint32Array(a.slice().buffer),v=new Float32Array(n.HEAPF32.buffer,m,t.vertexCount*3),y=new Float32Array(v.slice().buffer),b=new Float32Array(n.HEAPF32.buffer,h,t.vertexCount*4),x=new Float32Array(b.slice().buffer),S=new Float32Array(n.HEAPF32.buffer,g,t.vertexCount*3),C={data:_,worldPositions:y,worldRotations:x,worldScales:new Float32Array(S.slice().buffer),offset:t.offset,vertexCount:t.vertexCount,positions:t.positions.buffer,rotations:t.rotations.buffer,scales:t.scales.buffer,colors:t.colors.buffer,selection:t.selection.buffer};self.postMessage({response:C},[C.data.buffer,C.worldPositions.buffer,C.worldRotations.buffer,C.worldScales.buffer,C.positions,C.rotations,C.scales,C.colors,C.selection]),o=!1}),v=()=>{a.length!==0&&(o||(o=!0,_(a.shift()),setTimeout(()=>{o=!1,v()},0)))};self.onmessage=e=>new Promise((t,n)=>{if(e.data.splat){let n=e.data.splat;for(let e=0;e<a.length;e++)if(a[e].offset===n.offset){a[e]=n,t(!0);return}a.push(n),v(),t(!0)}})})();`,my=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,py],{type:`text/javascript;charset=utf-8`});function hy(e){let t;try{if(t=my&&(self.URL||self.webkitURL).createObjectURL(my),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(py),{name:e==null?void 0:e.name})}}function gy(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function _y(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){gy(a,r,i,o,s,`next`,e)}function s(e){gy(a,r,i,o,s,`throw`,e)}o(void 0)})}}function vy(){return yy.apply(this,arguments)}function yy(){return yy=_y(function*(e={}){var t,n=e,r=!1,i=!0,a={}.url;if(r||i){try{new URL(`.`,a).href}catch(e){}(function(){var e=_y(function*(e){var t=yield fetch(e,{credentials:`same-origin`});if(t.ok)return t.arrayBuffer();throw Error(t.status+` : `+t.url)});return function(t){return e.apply(this,arguments)}})()}console.log.bind(console),console.error.bind(console);var o=!1;function s(e){for(var t=0,n=e.length,r=new Uint8Array(n),i;t<n;++t)i=e.charCodeAt(t),r[t]=~i>>8&i;return r}var c,l,u=!1;function d(){var e=M.buffer;new Int8Array(e),new Int16Array(e),n.HEAPU8=l=new Uint8Array(e),new Uint16Array(e),new Int32Array(e),n.HEAPU32=new Uint32Array(e),n.HEAPF32=new Float32Array(e),new Float64Array(e),new BigInt64Array(e),new BigUint64Array(e)}function f(){if(n.preRun)for(typeof n.preRun==`function`&&(n.preRun=[n.preRun]);n.preRun.length;)T(n.preRun.shift());x(w)}function p(){u=!0,te.c()}function m(){if(n.postRun)for(typeof n.postRun==`function`&&(n.postRun=[n.postRun]);n.postRun.length;)C(n.postRun.shift());x(S)}var h;function g(){return s(`\0asm\0\0\0&\`\`}}\`}\`\0\`\v\0\`\0\0\x07aa\0\0\b\x07\0\0\x07‚€€\bA€Œ\v\x07b\0c\0\x07d\0e\0f\0\f
2266
2266
  ™@\x07T~@A€\b(\0"­ \0­B\x07|Bøÿÿÿƒ|"BÿÿÿÿX@ §"\0?\0AtM\r \0\0\r\vA„\bA06\0A\vA€\b \x006\0 \v\0 \0 Atr\vr \0¼"Aÿÿÿq!@ AvAÿq"E\r\0 Að\0M@ A€€€rAñ\0 kv!\f\v AK@A€ø!A\0!\f\v A
2267
2267
  tA€€\x07k!\v  AvA€€qr A\rvr\vß\v\b@ \0E\r\0 \0A\bk" \0Ak(\0"Axq"\0j!@ Aq\r\0 AqE\r  (\0"k"A˜\b(\0I\r \0 j!\0@@@Aœ\b(\0 G@ (\f! AÿM@  (\b"G\rAˆ\bAˆ\b(\0A~ Avwq6\0\f\v (!\x07  G@ (\b" 6\f  6\b\f\v (" Aj ("E\r Aj\v!@ ! "Aj! ("\r\0 Aj! ("\r\0\v A\x006\0\f\v ("AqAG\rA\b \x006\0  A~q6  \0Ar6  \x006\0\v  6\f  6\b\f\vA\0!\v \x07E\r\0@ ("At"(¸
2268
2268
  F@ A¸
@@ -2288,7 +2288,7 @@ j \x006\0 \0\rAŒ\b \vA~ wq6\0\f\v@  (F@ \x006\f\v \x006\v \
2288
2288
  Aj$\0 \0\v¡\v\v }#\0A\xA0k"\v$\0 \vA0jA\0A$ü\v\0@  G@  Al"\fAjAt"j*\0!  \fAjAt"j*\0! \b \fAt"j  j*\0"8\0 \b j 8\0 \b j 8\0 \x07 Atj"\rA\x006\f \r 8\b \r 8 \r 8\0@ \0E@  j-\0\0E\r\v \rA€€€\b6\f\v \r  At"\fAr"j-\0\0A\bt  \fj-\0\0r  \fAr"j-\0\0Atr  \fAr"\fj-\0\0Atr6 \v  At"j*\0"8 \v  At"j*\0"8” \v  \fAt"j*\0"8˜ \v  At"j*\0Œ"8œ \vAà\0j"\f \v*˜"C\0\0\0À” ” \v*”"C\0\0\0À” ”C\0\0€?’’8\0 \f \v*" ’ \v*”” \v*˜" ’ \v*œ”“8 \f \v*" ’ \v*˜” \v*”" ’ \v*œ”’8\b \f \v*" ’ \v*”” \v*˜" ’ \v*œ”’8\f \f \v*˜"C\0\0\0À” ” \v*"C\0\0\0À” ”C\0\0€?’’8 \f \v*”" ’ \v*˜” \v*" ’ \v*œ”“8 \f \v*" ’ \v*˜” \v*”" ’ \v*œ”“8 \f \v*”" ’ \v*˜” \v*" ’ \v*œ”’8 \f \v*”"C\0\0\0À” ” \v*"C\0\0\0À” ”C\0\0€?’’8 j 8\0 j 8\0 j 8\0 j 8\0 \v  j*\0"80 \v  j*\0"8@ \v  j*\0"8P
2289
2289
  j 8\0
2290
2290
  j 8\0
2291
- j 8\0 \v \f* \v*8” \f*\0 \v*0” \f*\f \v*4”’’8\0 \v \f* \v*8” \f* \v*0” \f* \v*4”’’8 \v \f* \v*8” \f*\b \v*0” \f* \v*4”’’8\b \v \f* \v*D” \f*\0 \v*<” \f*\f \v*@”’’8\f \v \f* \v*D” \f* \v*<” \f* \v*@”’’8 \v \f* \v*D” \f*\b \v*<” \f* \v*@”’’8 \v \f* \v*P” \f*\0 \v*H” \f*\f \v*L”’’8 \v \f* \v*P” \f* \v*H” \f* \v*L”’’8 \v \f* \v*P” \f*\b \v*H” \f* \v*L”’’8 \v* ! \v*\b! \v*! \r \v*" ” \v*\0" ” \v*\f"\x1B \x1B”’’C\0\0€@”  \v*"”  \v*"” \x1B \v*"”’’C\0\0€@”6 \r  ”  ” \x1B ”’’C\0\0€@”  ”  ”  ”’’C\0\0€@”6 \r  ”  ”  ”’’C\0\0€@”  ”  ”  ”’’C\0\0€@”6 Aj!\f\v\v \vA\xA0j$\0\v\0\v\v \0A\b\v`)}function _(e){return e}function v(e,t){var n,r=_(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function y(){return{a:ee}}function b(){function e(e,t){return te=e.exports,N(te),d(),te}var t=y();return n.instantiateWasm?new Promise((r,i)=>{n.instantiateWasm(t,(t,n)=>{r(e(t,n))})}):(h!=null||(h=g()),e(v(h,t)[0]))}for(var x=e=>{for(;e.length>0;)e.shift()(n)},S=[],C=e=>S.push(e),w=[],T=e=>w.push(e),E=()=>2147483648,D=(e,t)=>Math.ceil(e/t)*t,O=e=>{var t=(e-M.buffer.byteLength+65535)/65536|0;try{return M.grow(t),d(),1}catch(e){}},k=e=>{var t=l.length;e>>>=0;var n=E();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),O(Math.min(n,D(Math.max(e,i),65536))))return!0}return!1},A=new Uint8Array(123),j=25;j>=0;--j)A[48+j]=52+j,A[65+j]=j,A[97+j]=26+j;if(A[43]=62,A[47]=63,n.noExitRuntime&&n.noExitRuntime,n.print&&n.print,n.printErr&&n.printErr,n.wasmBinary&&n.wasmBinary,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.preInit)for(typeof n.preInit==`function`&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.shift()();var M;function N(e){n._pack=e.d,n._malloc=e.e,n._free=e.f,M=e.b,e.__indirect_function_table}var ee={a:k};function P(){f();function e(){var e;n.calledRun=!0,!o&&(p(),c==null||c(n),(e=n.onRuntimeInitialized)==null||e.call(n),m())}n.setStatus?(n.setStatus(`Running...`),setTimeout(()=>{setTimeout(()=>n.setStatus(``),1),e()},1)):e()}var te=b();return P(),t=u?n:new Promise((e,t)=>{c=e}),t}),gy.apply(this,arguments)}var _y=null;function vy(){return _y||(_y=hy()),_y}var yy=class{static warmupWasm(){vy()}constructor(e,t=0){this.dataChanged=!1,this.transformsChanged=!1,this.maxShDegree=0,this.initialBuildComplete=!1,this.pendingInitialBuildCount=0,this.disposed=!1,this.resolveReadyPromise=null,this.objectsInOrder=[],this.generation=t,this.readyPromise=new Promise(e=>{this.resolveReadyPromise=e});let n=0,r=0;this.splatIndices=new Map,this.offsets=new Map,this.layerKeys=[],this.layerKeyToIndex=new Map,this.objectLayerIndices=new Map;let i=new Map;e.forEach(e=>{this.splatIndices.set(e,r),this.offsets.set(e,n),i.set(n,e);let t=e.gsViewLayerKey||e.uuid,a=this.layerKeyToIndex.get(t);a===void 0&&(a=this.layerKeys.length,this.layerKeys.push(t),this.layerKeyToIndex.set(t,a)),this.objectLayerIndices.set(e,a),n+=e.numPoints,r++,this.objectsInOrder.push(e)}),this.numPoints=n,this.pendingInitialBuildCount=e.length,this.initialBuildComplete=this.pendingInitialBuildCount===0,this.width=2048,this.height=Math.ceil(2*this.numPoints/this.width),this.data=new Uint32Array(this.width*this.height*4),this.transformsWidth=5,this.transformsHeight=i.size,this.transforms=new Float32Array(this.transformsWidth*this.transformsHeight*4),this.transformIndicesWidth=1024,this.transformIndicesHeight=Math.ceil(this.numPoints/this.transformIndicesWidth),this.transformIndices=new Uint32Array(this.transformIndicesWidth*this.transformIndicesHeight),this.layerIndicesWidth=1024,this.layerIndicesHeight=Math.ceil(this.numPoints/this.layerIndicesWidth),this.layerIndices=new Uint32Array(this.layerIndicesWidth*this.layerIndicesHeight),this.positions=new Float32Array(this.numPoints*3),this.rotations=new Float32Array(this.numPoints*4),this.scales=new Float32Array(this.numPoints*3);let a=0;e.forEach(e=>{e.maxSHDegree>a&&(a=e.maxSHDegree)}),this.maxShDegree=a,a>=1&&(this.sh1=new Float32Array(this.numPoints*9)),a>=2&&(this.sh2=new Float32Array(this.numPoints*15)),a>=3&&(this.sh3=new Float32Array(this.numPoints*21)),e.forEach(e=>{let t=this.offsets.get(e);e.sh1&&this.sh1&&this.sh1.set(e.sh1,t*9),e.sh2&&this.sh2&&this.sh2.set(e.sh2,t*15),e.sh3&&this.sh3&&this.sh3.set(e.sh3,t*21)}),this.worker=new fy,this.worker.onmessage=e=>{if(!this.disposed&&e.data.response){let t=e.data.response,n=i.get(t.offset);if(!n)return;this.updateTransform(n);let r=this.splatIndices.get(n),a=this.objectLayerIndices.get(n);for(let e=0;e<n.numPoints;e++)this.transformIndices[t.offset+e]=r,this.layerIndices[t.offset+e]=a;this.data.set(t.data,t.offset*8),n.reattach(t.positions,t.rotations,t.scales,t.colors,t.selection),this.positions.set(t.worldPositions,t.offset*3),this.rotations.set(t.worldRotations,t.offset*4),this.scales.set(t.worldScales,t.offset*3),n.selectedChanged=!1,this.dataChanged=!0}},vy().then(e=>{if(this.disposed){this.completeInitialBuild();return}this.splatIndices.forEach((t,n)=>{this.disposed||this.buildImmediate(e,n)})}).catch(e=>{console.warn(`RenderData wasm load failed:`,e),this.completeInitialBuild()}),this.pendingInitialBuildCount===0&&this.completeInitialBuild()}updateTransform(e){let t=this.splatIndices.get(e);this.transforms.set(e.matrixWorld.elements,t*20),this.transforms[t*20+16]=e.selected?1:0,e.transformChanged=!1,e.selectedChanged=!1,this.transformsChanged=!0}getObjectsInOrder(){return this.objectsInOrder}canIncrementalAppend(e){if(this.disposed||e.length<=this.objectsInOrder.length)return!1;for(let t=0;t<this.objectsInOrder.length;t++)if(e[t]!==this.objectsInOrder[t])return!1;return!0}appendObjects(e){return Go(this,void 0,void 0,function*(){if(this.disposed)return!1;if(e.length===0)return!0;let t=yield vy();if(this.disposed)return!1;let n=this.numPoints,r=this.objectsInOrder.length,i=n+e.reduce((e,t)=>e+t.numPoints,0),a=r+e.length;this.numPoints=i,this.height=Math.ceil(2*this.numPoints/this.width),this.data=this.expandUint32Array(this.data,this.width*this.height*4),this.transformsHeight=a,this.transforms=this.expandFloat32Array(this.transforms,this.transformsWidth*this.transformsHeight*4),this.transformIndicesHeight=Math.ceil(this.numPoints/this.transformIndicesWidth),this.transformIndices=this.expandUint32Array(this.transformIndices,this.transformIndicesWidth*this.transformIndicesHeight),this.layerIndicesHeight=Math.ceil(this.numPoints/this.layerIndicesWidth),this.layerIndices=this.expandUint32Array(this.layerIndices,this.layerIndicesWidth*this.layerIndicesHeight),this.positions=this.expandFloat32Array(this.positions,this.numPoints*3),this.rotations=this.expandFloat32Array(this.rotations,this.numPoints*4),this.scales=this.expandFloat32Array(this.scales,this.numPoints*3);let o=e.reduce((e,t)=>Math.max(e,t.maxSHDegree),this.maxShDegree);o>this.maxShDegree&&(this.maxShDegree=o),this.maxShDegree>=1&&(this.sh1=this.expandFloat32Array(this.sh1,this.numPoints*9)),this.maxShDegree>=2&&(this.sh2=this.expandFloat32Array(this.sh2,this.numPoints*15)),this.maxShDegree>=3&&(this.sh3=this.expandFloat32Array(this.sh3,this.numPoints*21));let s=n,c=r;return e.forEach(e=>{this.splatIndices.set(e,c),this.offsets.set(e,s),this.objectsInOrder.push(e);let t=e.gsViewLayerKey||e.uuid,n=this.layerKeyToIndex.get(t);n===void 0&&(n=this.layerKeys.length,this.layerKeys.push(t),this.layerKeyToIndex.set(t,n)),this.objectLayerIndices.set(e,n),e.sh1&&this.sh1&&this.sh1.set(e.sh1,s*9),e.sh2&&this.sh2&&this.sh2.set(e.sh2,s*15),e.sh3&&this.sh3&&this.sh3.set(e.sh3,s*21),s+=e.numPoints,c++}),e.forEach(e=>{this.buildImmediate(t,e)}),!0})}buildImmediate(e,t){if(this.disposed)return;this.updateTransform(t);let n=e._malloc(3*t.numPoints*4),r=e._malloc(4*t.numPoints*4),i=e._malloc(3*t.numPoints*4),a=e._malloc(4*t.numPoints),o=e._malloc(t.numPoints),s=e._malloc(8*t.numPoints*4),c=e._malloc(3*t.numPoints*4),l=e._malloc(4*t.numPoints*4),u=e._malloc(3*t.numPoints*4);e.HEAPF32.set(t.positions,n/4),e.HEAPF32.set(t.rotations,r/4),e.HEAPF32.set(t.scales,i/4),e.HEAPU8.set(t.colors,a),e.HEAPU8.set(t.selection,o),e._pack(t.selected,t.numPoints,n,r,i,a,o,s,c,l,u);let d=new Uint32Array(e.HEAPU32.buffer,s,t.numPoints*8),f=new Float32Array(e.HEAPF32.buffer,c,t.numPoints*3),p=new Float32Array(e.HEAPF32.buffer,l,t.numPoints*4),m=new Float32Array(e.HEAPF32.buffer,u,t.numPoints*3),h=this.splatIndices.get(t),g=this.offsets.get(t),_=this.objectLayerIndices.get(t);for(let e=0;e<t.numPoints;e++)this.transformIndices[g+e]=h,this.layerIndices[g+e]=_;this.data.set(d,g*8),this.positions.set(f,g*3),this.rotations.set(p,g*4),this.scales.set(m,g*3),e._free(n),e._free(r),e._free(i),e._free(a),e._free(o),e._free(s),e._free(c),e._free(l),e._free(u),this.dataChanged=!0,this.pendingInitialBuildCount=Math.max(0,this.pendingInitialBuildCount-1),this.pendingInitialBuildCount===0&&this.completeInitialBuild()}expandFloat32Array(e,t){if(!e)return new Float32Array(t);if(e.length>=t)return e;let n=new Float32Array(t);return n.set(e.subarray(0,e.length)),n}expandUint32Array(e,t){if(!e)return new Uint32Array(t);if(e.length>=t)return e;let n=new Uint32Array(t);return n.set(e.subarray(0,e.length)),n}getSplat(e){let t=null;return this.offsets.forEach((n,r)=>{if(e>=n)t=r;else return}),t}getLocalIndex(e,t){return t-this.offsets.get(e)}dispose(){this.disposed||(this.disposed=!0,this.worker.terminate(),this.completeInitialBuild())}completeInitialBuild(){this.initialBuildComplete||(this.initialBuildComplete=!0),this.resolveReadyPromise&&(this.resolveReadyPromise(),this.resolveReadyPromise=null)}},by=`(function(){function e(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}async function t(e={}){var t,n=e,r=!1,i=!0,a=self.location.href;if(r||i)try{new URL(\`.\`,a).href}catch{}console.log.bind(console),console.error.bind(console);var o=!1;function s(e){for(var t=0,n=e.length,r=new Uint8Array(n),i;t<n;++t)i=e.charCodeAt(t),r[t]=~i>>8&i;return r}var c,l,u=!1;function d(){var e=M.buffer;new Int8Array(e),new Int16Array(e),n.HEAPU8=l=new Uint8Array(e),new Uint16Array(e),new Int32Array(e),n.HEAPU32=new Uint32Array(e),n.HEAPF32=new Float32Array(e),new Float64Array(e),new BigInt64Array(e),new BigUint64Array(e)}function f(){if(n.preRun)for(typeof n.preRun==\`function\`&&(n.preRun=[n.preRun]);n.preRun.length;)T(n.preRun.shift());x(w)}function p(){u=!0,I.c()}function m(){if(n.postRun)for(typeof n.postRun==\`function\`&&(n.postRun=[n.postRun]);n.postRun.length;)C(n.postRun.shift());x(S)}var h;function g(){return s(\`\\0asm\\0\\0\\0\\\`\\\`\\0\\\` \\0\\\`\\0\\0\\x07aa\\0\\0\\0\\0\\x07‚€€\\bA€Œ\\v\\x07b\\0c\\0d\\0e\\0f\\0\\f
2291
+ j 8\0 \v \f* \v*8” \f*\0 \v*0” \f*\f \v*4”’’8\0 \v \f* \v*8” \f* \v*0” \f* \v*4”’’8 \v \f* \v*8” \f*\b \v*0” \f* \v*4”’’8\b \v \f* \v*D” \f*\0 \v*<” \f*\f \v*@”’’8\f \v \f* \v*D” \f* \v*<” \f* \v*@”’’8 \v \f* \v*D” \f*\b \v*<” \f* \v*@”’’8 \v \f* \v*P” \f*\0 \v*H” \f*\f \v*L”’’8 \v \f* \v*P” \f* \v*H” \f* \v*L”’’8 \v \f* \v*P” \f*\b \v*H” \f* \v*L”’’8 \v* ! \v*\b! \v*! \r \v*" ” \v*\0" ” \v*\f"\x1B \x1B”’’C\0\0€@”  \v*"”  \v*"” \x1B \v*"”’’C\0\0€@”6 \r  ”  ” \x1B ”’’C\0\0€@”  ”  ”  ”’’C\0\0€@”6 \r  ”  ”  ”’’C\0\0€@”  ”  ”  ”’’C\0\0€@”6 Aj!\f\v\v \vA\xA0j$\0\v\0\v\v \0A\b\v`)}function _(e){return e}function v(e,t){var n,r=_(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function y(){return{a:ee}}function b(){function e(e,t){return te=e.exports,N(te),d(),te}var t=y();return n.instantiateWasm?new Promise((r,i)=>{n.instantiateWasm(t,(t,n)=>{r(e(t,n))})}):(h!=null||(h=g()),e(v(h,t)[0]))}for(var x=e=>{for(;e.length>0;)e.shift()(n)},S=[],C=e=>S.push(e),w=[],T=e=>w.push(e),E=()=>2147483648,D=(e,t)=>Math.ceil(e/t)*t,O=e=>{var t=(e-M.buffer.byteLength+65535)/65536|0;try{return M.grow(t),d(),1}catch(e){}},k=e=>{var t=l.length;e>>>=0;var n=E();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),O(Math.min(n,D(Math.max(e,i),65536))))return!0}return!1},A=new Uint8Array(123),j=25;j>=0;--j)A[48+j]=52+j,A[65+j]=j,A[97+j]=26+j;if(A[43]=62,A[47]=63,n.noExitRuntime&&n.noExitRuntime,n.print&&n.print,n.printErr&&n.printErr,n.wasmBinary&&n.wasmBinary,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.preInit)for(typeof n.preInit==`function`&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.shift()();var M;function N(e){n._pack=e.d,n._malloc=e.e,n._free=e.f,M=e.b,e.__indirect_function_table}var ee={a:k};function P(){f();function e(){var e;n.calledRun=!0,!o&&(p(),c==null||c(n),(e=n.onRuntimeInitialized)==null||e.call(n),m())}n.setStatus?(n.setStatus(`Running...`),setTimeout(()=>{setTimeout(()=>n.setStatus(``),1),e()},1)):e()}var te=b();return P(),t=u?n:new Promise((e,t)=>{c=e}),t}),yy.apply(this,arguments)}var by=null;function xy(){return by||(by=vy()),by}var Sy=class{static warmupWasm(){xy()}constructor(e,t=0){this.dataChanged=!1,this.transformsChanged=!1,this.maxShDegree=0,this.initialBuildComplete=!1,this.pendingInitialBuildCount=0,this.disposed=!1,this.resolveReadyPromise=null,this.objectsInOrder=[],this.generation=t,this.readyPromise=new Promise(e=>{this.resolveReadyPromise=e});let n=0,r=0;this.splatIndices=new Map,this.offsets=new Map,this.layerKeys=[],this.layerKeyToIndex=new Map,this.objectLayerIndices=new Map;let i=new Map;e.forEach(e=>{this.splatIndices.set(e,r),this.offsets.set(e,n),i.set(n,e);let t=e.gsViewLayerKey||e.uuid,a=this.layerKeyToIndex.get(t);a===void 0&&(a=this.layerKeys.length,this.layerKeys.push(t),this.layerKeyToIndex.set(t,a)),this.objectLayerIndices.set(e,a),n+=e.numPoints,r++,this.objectsInOrder.push(e)}),this.numPoints=n,this.pendingInitialBuildCount=e.length,this.initialBuildComplete=this.pendingInitialBuildCount===0,this.width=2048,this.height=Math.ceil(2*this.numPoints/this.width),this.data=new Uint32Array(this.width*this.height*4),this.transformsWidth=5,this.transformsHeight=i.size,this.transforms=new Float32Array(this.transformsWidth*this.transformsHeight*4),this.transformIndicesWidth=1024,this.transformIndicesHeight=Math.ceil(this.numPoints/this.transformIndicesWidth),this.transformIndices=new Uint32Array(this.transformIndicesWidth*this.transformIndicesHeight),this.layerIndicesWidth=1024,this.layerIndicesHeight=Math.ceil(this.numPoints/this.layerIndicesWidth),this.layerIndices=new Uint32Array(this.layerIndicesWidth*this.layerIndicesHeight),this.positions=new Float32Array(this.numPoints*3),this.rotations=new Float32Array(this.numPoints*4),this.scales=new Float32Array(this.numPoints*3);let a=0;e.forEach(e=>{e.maxSHDegree>a&&(a=e.maxSHDegree)}),this.maxShDegree=a,a>=1&&(this.sh1=new Float32Array(this.numPoints*9)),a>=2&&(this.sh2=new Float32Array(this.numPoints*15)),a>=3&&(this.sh3=new Float32Array(this.numPoints*21)),e.forEach(e=>{let t=this.offsets.get(e);e.sh1&&this.sh1&&this.sh1.set(e.sh1,t*9),e.sh2&&this.sh2&&this.sh2.set(e.sh2,t*15),e.sh3&&this.sh3&&this.sh3.set(e.sh3,t*21)}),this.worker=new hy,this.worker.onmessage=e=>{if(!this.disposed&&e.data.response){let t=e.data.response,n=i.get(t.offset);if(!n)return;this.updateTransform(n);let r=this.splatIndices.get(n),a=this.objectLayerIndices.get(n);for(let e=0;e<n.numPoints;e++)this.transformIndices[t.offset+e]=r,this.layerIndices[t.offset+e]=a;this.data.set(t.data,t.offset*8),n.reattach(t.positions,t.rotations,t.scales,t.colors,t.selection),this.positions.set(t.worldPositions,t.offset*3),this.rotations.set(t.worldRotations,t.offset*4),this.scales.set(t.worldScales,t.offset*3),n.selectedChanged=!1,this.dataChanged=!0}},xy().then(e=>{if(this.disposed){this.completeInitialBuild();return}this.splatIndices.forEach((t,n)=>{this.disposed||this.buildImmediate(e,n)})}).catch(e=>{console.warn(`RenderData wasm load failed:`,e),this.completeInitialBuild()}),this.pendingInitialBuildCount===0&&this.completeInitialBuild()}updateTransform(e){let t=this.splatIndices.get(e);this.transforms.set(e.matrixWorld.elements,t*20),this.transforms[t*20+16]=e.selected?1:0,e.transformChanged=!1,e.selectedChanged=!1,this.transformsChanged=!0}getObjectsInOrder(){return this.objectsInOrder}canIncrementalAppend(e){if(this.disposed||e.length<=this.objectsInOrder.length)return!1;for(let t=0;t<this.objectsInOrder.length;t++)if(e[t]!==this.objectsInOrder[t])return!1;return!0}appendObjects(e){return Go(this,void 0,void 0,function*(){if(this.disposed)return!1;if(e.length===0)return!0;let t=yield xy();if(this.disposed)return!1;let n=this.numPoints,r=this.objectsInOrder.length,i=n+e.reduce((e,t)=>e+t.numPoints,0),a=r+e.length;this.numPoints=i,this.height=Math.ceil(2*this.numPoints/this.width),this.data=this.expandUint32Array(this.data,this.width*this.height*4),this.transformsHeight=a,this.transforms=this.expandFloat32Array(this.transforms,this.transformsWidth*this.transformsHeight*4),this.transformIndicesHeight=Math.ceil(this.numPoints/this.transformIndicesWidth),this.transformIndices=this.expandUint32Array(this.transformIndices,this.transformIndicesWidth*this.transformIndicesHeight),this.layerIndicesHeight=Math.ceil(this.numPoints/this.layerIndicesWidth),this.layerIndices=this.expandUint32Array(this.layerIndices,this.layerIndicesWidth*this.layerIndicesHeight),this.positions=this.expandFloat32Array(this.positions,this.numPoints*3),this.rotations=this.expandFloat32Array(this.rotations,this.numPoints*4),this.scales=this.expandFloat32Array(this.scales,this.numPoints*3);let o=e.reduce((e,t)=>Math.max(e,t.maxSHDegree),this.maxShDegree);o>this.maxShDegree&&(this.maxShDegree=o),this.maxShDegree>=1&&(this.sh1=this.expandFloat32Array(this.sh1,this.numPoints*9)),this.maxShDegree>=2&&(this.sh2=this.expandFloat32Array(this.sh2,this.numPoints*15)),this.maxShDegree>=3&&(this.sh3=this.expandFloat32Array(this.sh3,this.numPoints*21));let s=n,c=r;return e.forEach(e=>{this.splatIndices.set(e,c),this.offsets.set(e,s),this.objectsInOrder.push(e);let t=e.gsViewLayerKey||e.uuid,n=this.layerKeyToIndex.get(t);n===void 0&&(n=this.layerKeys.length,this.layerKeys.push(t),this.layerKeyToIndex.set(t,n)),this.objectLayerIndices.set(e,n),e.sh1&&this.sh1&&this.sh1.set(e.sh1,s*9),e.sh2&&this.sh2&&this.sh2.set(e.sh2,s*15),e.sh3&&this.sh3&&this.sh3.set(e.sh3,s*21),s+=e.numPoints,c++}),e.forEach(e=>{this.buildImmediate(t,e)}),!0})}buildImmediate(e,t){if(this.disposed)return;this.updateTransform(t);let n=e._malloc(3*t.numPoints*4),r=e._malloc(4*t.numPoints*4),i=e._malloc(3*t.numPoints*4),a=e._malloc(4*t.numPoints),o=e._malloc(t.numPoints),s=e._malloc(8*t.numPoints*4),c=e._malloc(3*t.numPoints*4),l=e._malloc(4*t.numPoints*4),u=e._malloc(3*t.numPoints*4);e.HEAPF32.set(t.positions,n/4),e.HEAPF32.set(t.rotations,r/4),e.HEAPF32.set(t.scales,i/4),e.HEAPU8.set(t.colors,a),e.HEAPU8.set(t.selection,o),e._pack(t.selected,t.numPoints,n,r,i,a,o,s,c,l,u);let d=new Uint32Array(e.HEAPU32.buffer,s,t.numPoints*8),f=new Float32Array(e.HEAPF32.buffer,c,t.numPoints*3),p=new Float32Array(e.HEAPF32.buffer,l,t.numPoints*4),m=new Float32Array(e.HEAPF32.buffer,u,t.numPoints*3),h=this.splatIndices.get(t),g=this.offsets.get(t),_=this.objectLayerIndices.get(t);for(let e=0;e<t.numPoints;e++)this.transformIndices[g+e]=h,this.layerIndices[g+e]=_;this.data.set(d,g*8),this.positions.set(f,g*3),this.rotations.set(p,g*4),this.scales.set(m,g*3),e._free(n),e._free(r),e._free(i),e._free(a),e._free(o),e._free(s),e._free(c),e._free(l),e._free(u),this.dataChanged=!0,this.pendingInitialBuildCount=Math.max(0,this.pendingInitialBuildCount-1),this.pendingInitialBuildCount===0&&this.completeInitialBuild()}expandFloat32Array(e,t){if(!e)return new Float32Array(t);if(e.length>=t)return e;let n=new Float32Array(t);return n.set(e.subarray(0,e.length)),n}expandUint32Array(e,t){if(!e)return new Uint32Array(t);if(e.length>=t)return e;let n=new Uint32Array(t);return n.set(e.subarray(0,e.length)),n}getSplat(e){let t=null;return this.offsets.forEach((n,r)=>{if(e>=n)t=r;else return}),t}getLocalIndex(e,t){return t-this.offsets.get(e)}dispose(){this.disposed||(this.disposed=!0,this.worker.terminate(),this.completeInitialBuild())}completeInitialBuild(){this.initialBuildComplete||(this.initialBuildComplete=!0),this.resolveReadyPromise&&(this.resolveReadyPromise(),this.resolveReadyPromise=null)}},Cy=`(function(){function e(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}async function t(e={}){var t,n=e,r=!1,i=!0,a=self.location.href;if(r||i)try{new URL(\`.\`,a).href}catch{}console.log.bind(console),console.error.bind(console);var o=!1;function s(e){for(var t=0,n=e.length,r=new Uint8Array(n),i;t<n;++t)i=e.charCodeAt(t),r[t]=~i>>8&i;return r}var c,l,u=!1;function d(){var e=M.buffer;new Int8Array(e),new Int16Array(e),n.HEAPU8=l=new Uint8Array(e),new Uint16Array(e),new Int32Array(e),n.HEAPU32=new Uint32Array(e),n.HEAPF32=new Float32Array(e),new Float64Array(e),new BigInt64Array(e),new BigUint64Array(e)}function f(){if(n.preRun)for(typeof n.preRun==\`function\`&&(n.preRun=[n.preRun]);n.preRun.length;)T(n.preRun.shift());x(w)}function p(){u=!0,I.c()}function m(){if(n.postRun)for(typeof n.postRun==\`function\`&&(n.postRun=[n.postRun]);n.postRun.length;)C(n.postRun.shift());x(S)}var h;function g(){return s(\`\\0asm\\0\\0\\0\\\`\\\`\\0\\\` \\0\\\`\\0\\0\\x07aa\\0\\0\\0\\0\\x07‚€€\\bA€Œ\\v\\x07b\\0c\\0d\\0e\\0f\\0\\f
2292
2292
  9T~@A€\\b(\\0"­ \\0­B\\x07|Bøÿÿÿƒ|"BÿÿÿÿX@ §"\\0?\\0AtM\\r \\0\\0\\r\\vA„\\bA06\\0A\\vA€\\b \\x006\\0 \\vß\\v\\b@ \\0E\\r\\0 \\0A\\bk" \\0Ak(\\0"Axq"\\0j!@ Aq\\r\\0 AqE\\r  (\\0"k"A˜\\b(\\0I\\r \\0 j!\\0@@@Aœ\\b(\\0 G@ (\\f! AÿM@  (\\b"G\\rAˆ\\bAˆ\\b(\\0A~ Avwq6\\0\\f\\v (!\\x07  G@ (\\b" 6\\f  6\\b\\f\\v (" Aj ("E\\r Aj\\v!@ ! "Aj! ("\\r\\0 Aj! ("\\r\\0\\v A\\x006\\0\\f\\v ("AqAG\\rA\\b \\x006\\0  A~q6  \\0Ar6  \\x006\\0\\v  6\\f  6\\b\\f\\vA\\0!\\v \\x07E\\r\\0@ ("At"(¸
2293
2293
  F@ A¸
2294
2294
  j 6\\0 \\rAŒ\\bAŒ\\b(\\0A~ wq6\\0\\f\\v@  \\x07(F@ \\x07 6\\f\\v \\x07 6\\v E\\r\\v  \\x076 ("@  6  6\\v ("E\\r\\0  6  6\\v  O\\r\\0 ("AqE\\r\\0@@@@ AqE@A\\xA0\\b(\\0 F@A\\xA0\\b 6\\0A”\\bA”\\b(\\0 \\0j"\\x006\\0  \\0Ar6 Aœ\\b(\\0G\\rA\\bA\\x006\\0Aœ\\bA\\x006\\0\\vAœ\\b(\\0"\\x07 F@Aœ\\b 6\\0A\\bA\\b(\\0 \\0j"\\x006\\0  \\0Ar6 \\0 j \\x006\\0\\v Axq \\0j!\\0 (\\f! AÿM@ (\\b" F@Aˆ\\bAˆ\\b(\\0A~ Avwq6\\0\\f\\v  6\\f  6\\b\\f\\v (!\\b  G@ (\\b" 6\\f  6\\b\\f\\v (" Aj ("E\\r Aj\\v!@ ! "Aj! ("\\r\\0 Aj! ("\\r\\0\\v A\\x006\\0\\f\\v  A~q6  \\0Ar6 \\0 j \\x006\\0\\f\\vA\\0!\\v \\bE\\r\\0@ ("At"(¸
@@ -2324,5 +2324,5 @@ A\\0H\\x1Bs6\\0 \\rAj!\\r\\f\\v\\v@  \\vFE@  \\vAtj \\v6\\0 \\vAj!\\v\
2324
2324
 
2325
2325
  (\\0"
2326
2326
  Aj6\\0 \\x07
2327
- Atj 6\\0 \\0Aj!\\0\\f\\v\\v Aj! \\x07!\\0 !\\x07\\f \\b   \\0Atj(\\0Atj(\\0 vAÿqAtj" (\\0Aj6\\0 \\0Aj!\\0\\f\\v\\0\\v\\0\\v\\0\\v\\0\\v\\v \\0A\\b\\v\`)}function _(e){return e}function v(e,t){var n,r=_(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function y(){return{a:P}}function b(){function e(e,t){return I=e.exports,N(I),d(),I}var t=y();return n.instantiateWasm?new Promise((r,i)=>{n.instantiateWasm(t,(t,n)=>{r(e(t,n))})}):(h??=g(),e(v(h,t)[0]))}for(var x=e=>{for(;e.length>0;)e.shift()(n)},S=[],C=e=>S.push(e),w=[],T=e=>w.push(e),E=()=>2147483648,D=(e,t)=>Math.ceil(e/t)*t,O=e=>{var t=(e-M.buffer.byteLength+65535)/65536|0;try{return M.grow(t),d(),1}catch{}},k=e=>{var t=l.length;e>>>=0;var n=E();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),O(Math.min(n,D(Math.max(e,i),65536))))return!0}return!1},A=new Uint8Array(123),j=25;j>=0;--j)A[48+j]=52+j,A[65+j]=j,A[97+j]=26+j;if(A[43]=62,A[47]=63,n.noExitRuntime&&n.noExitRuntime,n.print&&n.print,n.printErr&&n.printErr,n.wasmBinary&&n.wasmBinary,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.preInit)for(typeof n.preInit==\`function\`&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.shift()();var M;function N(e){n._sort=e.d,n._malloc=e.e,n._free=e.f,M=e.b,e.__indirect_function_table}var P={a:k};function F(){f();function e(){n.calledRun=!0,!o&&(p(),c?.(n),n.onRuntimeInitialized?.(),m())}n.setStatus?(n.setStatus(\`Running...\`),setTimeout(()=>{setTimeout(()=>n.setStatus(\`\`),1),e()},1)):e()}var I=b();return F(),t=u?n:new Promise((e,t)=>{c=e}),t}let n;function r(){return e(this,void 0,void 0,function*(){n=yield t()})}let i,a,o,s,c,l,u,d,f,p=0,m=0,h=[],g=!0,_=!1,v=!1,y=!1,b=()=>e(void 0,void 0,void 0,function*(){if(_){v=!0;return}_=!0,v=!1,n||(yield r());let e=2**Math.ceil(Math.log2(i.vertexCount));p<e&&(p>0&&(n._free(a),n._free(s),n._free(c),n._free(l),n._free(u),n._free(d),n._free(f)),p=e,a=n._malloc(64),s=n._malloc(p*4),c=n._malloc(3*p*4),l=n._malloc(p*4),u=n._malloc(p*4),d=n._malloc(p*4),f=n._malloc(p*4)),m<i.transforms.length&&(m>0&&n._free(o),m=i.transforms.length,o=n._malloc(m*4)),_=!1,v&&(v=!1,yield b())}),x=()=>{if(_||v||!n)return;_=!0,n.HEAPF32.set(i.positions,c/4),n.HEAPF32.set(i.transforms,o/4),n.HEAPU32.set(i.transformIndices,s/4),n.HEAPF32.set(new Float32Array(h),a/4),n._sort(a,o,s,i.vertexCount,c,l,u,d,f);let e=new Uint32Array(n.HEAPU32.buffer,u,i.vertexCount),t=new Uint32Array(e.slice().buffer);self.postMessage({depthIndex:t,generation:i.generation},[t.buffer]),_=!1,g=!1},S=()=>{y||(y=!0,g&&x(),setTimeout(()=>{y=!1,S()}))};self.onmessage=e=>new Promise(t=>{if(e.data.warmup){r().finally(()=>t(!0));return}e.data.sortData&&(i={positions:new Float32Array(e.data.sortData.positions),transforms:new Float32Array(e.data.sortData.transforms),transformIndices:new Uint32Array(e.data.sortData.transformIndices),vertexCount:e.data.sortData.vertexCount,generation:e.data.sortData.generation??0},g=!0,b()),e.data.viewProj?(e.data.viewProj.every(e=>h.includes(e))===!1&&(h=e.data.viewProj,g=!0),S(),t(!0)):t(!0)})})();`,xy=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,by],{type:`text/javascript;charset=utf-8`});function Sy(e){let t;try{if(t=xy&&(self.URL||self.webkitURL).createObjectURL(xy),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(by),{name:e==null?void 0:e.name})}}var Cy=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}("}rpvv|{-uvtu}-sy|nH}rpvv|{-uvtu}-v{Hnvor-sy|n-}ynV{qr\x07H{vs|z-uvtu}-nz}yr?Q-lr\x07rH{vs|z-uvtu}-nz}yr?Q-ln{s|zH{vs|z-uvtu}-nz}yr?Q-ln{s|zV{qvprH{vs|z-uvtu}-nz}yr?Q-lyn\brV{qvprH{vs|z-uvtu}-nz}yr?Q-luar\x07rH{vs|z-rp?-luar\x07r`v rH{vs|z-v{-lzn\x07`uQrtrrH0vs-[bZlT`lPYV]]R_`-K-=----{vs|z-rp?-lyn\brPyv}}r_n{trh[bZlT`lYNfR_`jH----{vs|z-znA-lpyv}}rZnvprV{rrh[bZlT`lPYV]]R_`jH0r{qvs{vs|z-rp?-r|yv|{H{vs|z-o||y-lnttrtnv|{R{noyrqH{vs|z-sy|n-lnttrtnv|{]|trH-------<<-整个动画的归一化进度-h=9->j{vs|z-sy|n-lnttrtnv|{]|v{Qnv|{H--<<-每个点的固定聚合时长(归一化到总时长,可调试){vs|z-rp@-lnttrtnv|{O|{qZv{H{vs|z-rp@-lnttrtnv|{O|{qZn\x07Hn\bv{t-rpA-P|y|Hn\bv{t-rp?-]|vv|{Hn\bv{t-rp?-bH<<参考Tnvn{`}yn@qp|{-sy|n-\0E-J-\05E;=6H<<原版的固定xr{ry`v r,不要轻易调整这个数p|{-sy|n-xr{ry?Q`v r-J-=;@Hp|{-sy|n-zn\x07`prr{`}npr`}yn`v r-J-?=AE;=H<<固定的u相关系数p|{-sy|n-`UlP>-J-=;AEEC=?B>>F=?F>FFHp|{-sy|n-`UlP?l=-J->;=F?BAEAHp|{-sy|n-`UlP?l>-J-:>;=F?BAEAHp|{-sy|n-`UlP?l?-J-=;@>B@F>CHp|{-sy|n-`UlP?l@-J-:>;=F?BAEAHp|{-sy|n-`UlP?lA-J-=;BAC?DA?Hrp?-tr`UQnnbc5v{-}ynVq\x079-v{-p|z}|{r{\\ssr9-rp?-r\x07r`v r6-\n----v{-uP|z}|{r{P|{-J-=H----vs-5lzn\x07`uQrtrr-KJ->6-uP|z}|{r{P|{-8J-FH----vs-5lzn\x07`uQrtrr-KJ-?6-uP|z}|{r{P|{-8J->BH----vs-5lzn\x07`uQrtrr-KJ-@6-uP|z}|{r{P|{-8J-?>H--------v{-}nqqrqP|z}|{r{P|{-J-uP|z}|{r{P|{H----vs-5}nqqrqP|z}|{r{P|{-2-A-.J-=6-\n--------}nqqrqP|z}|{r{P|{-J-55}nqqrqP|z}|{r{P|{-<-A6-8->6-7-AH----\f--------sy|n-yv{rnP|z}|{r{V{qr\x07-J-sy|n5}ynVq\x07-7-}nqqrqP|z}|{r{P|{-8-p|z}|{r{\\ssr6H----sy|n-r\x07ryV{qr\x07-J-yv{rnP|z}|{r{V{qr\x07-<-A;=H------sy|n-q-J-r\x07ryV{qr\x07-<-r\x07r`v r;\x07H----sy|n-\b-J-sy||5q6-<-r\x07r`v r;\bH----sy|n-\x07-J-snp5q6H----r{-rp?5\x079-\b6H\f|vq-znv{-56-\n----v{-}ynV{qr\x07b-J-v{5}ynV{qr\x07-8-=;B6H----v{-}ynV{qr\x07V-J-v{5}ynV{qr\x07b6H----rpA-pr{-J-r\x07rySrpu5lr\x07r9-vrp?55}ynV{qr\x07b-3-=\x07@ss6-II->9-}ynV{qr\x07b-KK->=69-=6H--------v{-n{s|zV{qr\x07-J-r\x07rySrpu5ln{s|zV{qvpr9-vrp?5}ynV{qr\x07b-3-=\x07@ss9-}ynV{qr\x07b-KK->=69-=6;\x07H----znA-n{s|z-J-znA5--------r\x07rySrpu5ln{s|z9-vrp?5=9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5>9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5?9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5@9-n{s|zV{qr\x0769-=6----6H----znA-n{s|zZ|qrycvrZnv\x07-J-vrZnv\x07-7-n{s|zH----rp@-}ynPr{r-J-v{Ova|Sy|n5pr{;\x07\b 6H----rpA-|yqPr{r-J-n{s|z-7-rpA5}ynPr{r9->;=6H----<<-JJJ-聚合特效-JJJ----sy|n-y|pny]|tr-J-lnttrtnv|{]|trH----sy|n-pnyr]|tr-J-=;=H----o||y-v{O|{qS|Nttrtnv|{-J-snyrH----vs-5lnttrtnv|{R{noyrq-33-lnttrtnv|{]|tr-I->;=6-\n--------o||y-v{O|{q-J-|yqPr{r;\x07-KJ-lnttrtnv|{O|{qZv{;\x07---------------------33-|yqPr{r;\x07-IJ-lnttrtnv|{O|{qZn\x07;\x07---------------------33-|yqPr{r; -KJ-lnttrtnv|{O|{qZv{; ---------------------33-|yqPr{r; -IJ-lnttrtnv|{O|{qZn\x07; H--------vs-5v{O|{q6-\n------------v{O|{qS|Nttrtnv|{-J-rH------------<<-归一化高度-h=9>j,>J最高,=J最低------------sy|n-urvtu_n{tr-J-lnttrtnv|{O|{qZn\x07;\b-:-lnttrtnv|{O|{qZv{;\bH------------sy|n-{|znyv rqUrvtu-J-urvtu_n{tr-K-=;==>----------------L-pynz}55|yqPr{r;\b-:-lnttrtnv|{O|{qZv{;\b6-<-urvtu_n{tr9-=;=9->;=6----------------G-=;BH------------<<-lnttrtnv|{]|v{Qnv|{G-每个点的固定聚合时长(归一化,占总时长的比例)------------<<-最高处5{|znyv rqUrvtuJ>6G-navzrJ=9-r{qavzrJ}|v{Q------------<<-最低处5{|znyv rqUrvtuJ=6G-navzrJ>:}|v{Q9-r{qavzrJ>------------<<-保证最底部的点在总动画结束时刚好聚合完毕------------sy|n-}|v{Q-J-pynz}5lnttrtnv|{]|v{Qnv|{9-=;=>9->;=6H------------sy|n-navzr-J-5>;=-:-{|znyv rqUrvtu6-7-5>;=-:-}|v{Q6H------------y|pny]|tr-J-pynz}55lnttrtnv|{]|tr-:-navzr6-<-}|v{Q9-=;=9->;=6H------------<<-聚合|ssr曲线:先加速后减速(rnr:v{:|)------------sy|n-|ssr]|tr-J-z||ur}5=;=9->;=9-y|pny]|tr6H------------<<-pnyr曲线:缓慢加速,加速度越来越大(rnr:v{-三次方)------------pnyr]|tr-J-y|pny]|tr-7-y|pny]|tr-7-y|pny]|tr-H------------rp@-nttrtnv|{Pr{r-J-5lnttrtnv|{O|{qZv{-8-lnttrtnv|{O|{qZn\x076-<-?;=H------------rp@-qv-J-|yqPr{r;\x07\b -:-nttrtnv|{Pr{rH------------sy|n-qv-J-yr{tu5qv6H------------<<-基于-}ynPr{r-的伪随机距离-8-v{<p|-螺旋方向------------sy|n-n{q`rrq-J-q|5}ynPr{r9-rp@5>?;FEFE9-DE;?@@9-AB;>CA66H------------sy|n-n{qQv-J-snp5v{5n{q`rrq6-7-A@DBE;BAB@6H------------sy|n-n{tyr-J-n{q`rrq-7->=;=H------------rp@-pnrQv-J-{|znyv r5rp@5----------------p|5n{tyr69----------------zv\x075:=;D9-=;>9-snp5v{5n{q`rrq-7->;D6-7-A@DBE;BAB@669----------------v{5n{tyr6------------66H------------sy|n-r\x07}y|v|{Snp|-J-5>;=-:-|ssr]|tr6-7-5>;=-8->;=-7-n{qQv6H------------rp@-|ssr-J-pnrQv-7-qv-7-r\x07}y|v|{Snp|H------------|yqPr{r;\x07\b -8J-|ssrH------------}ynPr{r-J-5v{rr5n{s|z6-7-|yqPr{r6;\x07\b H--------\f----\f----0vs-[bZlT`lPYV]]R_`-K-=----v{-yn\brV{qr\x07-J-v{5r\x07rySrpu5lyn\brV{qvpr9-vrp?5}ynV{qr\x07b-3-=\x07@ss9-}ynV{qr\x07b-KK->=69-=6;\x076H----vs-5yn\brV{qr\x07-KJ-=-33-yn\brV{qr\x07-I-[bZlT`lYNfR_`6-\n--------rp?-pyv}_n{tr-J-lyn\brPyv}}r_n{trhyn\brV{qr\x07jH--------v{-pyv}`n-J-v{5pyv}_n{tr;\x07-8-=;B6H--------v{-pyv}P|{-J-v{5pyv}_n{tr;\b-8-=;B6H--------v{-pyv}R{q-J-pyv}`n-8-pyv}P|{H--------s|-5v{-v-J-=H-v-I-[bZlT`lPYV]]R_`H-v886-\n----------------vs-5v-I-pyv}`n-\v\v-v-KJ-pyv}R{q6-\n--------------------p|{v{rH----------------\f----------------rpA-pyv}}r]|vv|{-J-lpyv}}rZnvprV{rrhvj-7-|yqPr{rH----------------o||y-pyv}}rq-J-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH----------------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH----------------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH----------------vs-5pyv}}rq6-\n--------------------tyl]|vv|{-J-rpA5=;=9-=;=9-?;=9->;=6H--------------------r{H----------------\f--------\f----\f----0r{qvs----rpA-vrPr{r-J-n{s|zZ|qrycvrZnv\x07-7-rpA5}ynPr{r9->;=6H----rpA-pyv}Pr{r-J-}|wrpv|{Znv\x07-7-vrPr{rH----<<剔除超出视锥体的}yn----sy|n-pyv}-J->;?-7-pyv}Pr{r;H----vs-5pyv}Pr{r; -I-:pyv}Pr{r;-\v\v-pyv}Pr{r; -K-pyv}Pr{r;-\v\v---------pyv}Pr{r;\x07-I-:pyv}-\v\v-pyv}Pr{r;\x07-K-pyv}-\v\v---------pyv}Pr{r;\b-I-:pyv}-\v\v-pyv}Pr{r;\b-K-pyv}6-\n--------tyl]|vv|{-J-rpA5=;=9-=;=9-?;=9->;=6H--------r{H----\f----rp@-{qpPr{r-J-pyv}Pr{r;\x07\b -<-pyv}Pr{r;H----rp?-s|pny-J-rp?5--------}|wrpv|{Znv\x07h=jh=j-7-r|yv|{;\x07-7-=;B9--------}|wrpv|{Znv\x07h>jh>j-7-r|yv|{;\b-7-=;B----6H--------]|vv|{-J-}|vv|{;\x07\bH----<<-读取协方差数据(使用-unys?\x07>C-打包)----rpA-p|-J-r\x07rySrpu5lr\x07r9-vrp?555}ynV{qr\x07b-3-=\x07@ss6-II->6-\v->9-}ynV{qr\x07b-KK->=69-=6H----rp?->-J-{}npxUnys?\x07>C5p|;\x076H-----rp?-?-J-{}npxUnys?\x07>C5p|;\b6H------rp?-@-J-{}npxUnys?\x07>C5p|; 6H----------sy|n-Z>>-J->;\x07-<-A;=H----sy|n-Z>?-J->;\b-<-A;=H----sy|n-Z>@-J-?;\x07-<-A;=H----sy|n-Z??-J-?;\b-<-A;=H----sy|n-Z?@-J-@;\x07-<-A;=H----sy|n-Z@@-J-@;\b-<-A;=H--------zn@-cx-J-zn@5--------Z>>9-Z>?9-Z>@9--------Z>?9-Z??9-Z?@9----------Z>@9-Z?@9-Z@@-------6H----<<-判断是否是正交模式:透视时-}|wrpv|{Znv\x07h@jh@j-J-=,正交时-J->----o||y-v\\u|tn}uvp-J-}|wrpv|{Znv\x07h@jh@j-K-=;DH----sy|n-n{vznv|{]|tr-J--}|wrpv|{Znv\x07h@jh@jH----zn@-WH----vs-5v\\u|tn}uvp6-\n--------<<-正交模式的雅可比矩阵--------W-J-n{}|r5zn@5------------s|pny;\x079-=;=9-=;=9------------=;=9-s|pny;\b9-=;=9------------=;=9-=;=9-=;=--------66H----\f-ryr-\n--------<<-透视模式的雅可比矩阵--------sy|n--J->;=-<-5vrPr{r; -7-vrPr{r; 6H--------W-J-zn@5------------s|pny;\x07-<-vrPr{r; 9-=;=9-:5s|pny;\x07-7-vrPr{r;\x076-7-9------------=;=9-s|pny;\b-<-vrPr{r; 9-:5s|pny;\b-7-vrPr{r;\b6-7-9------------=;=9-=;=9-=;=--------6H----\f----zn@-d-J-n{}|r5zn@5n{s|zZ|qrycvrZnv\x0766H----zn@-a-J-d-7-WH----<<-将-@Q-协方差矩阵变换为-?Q-协方差矩阵----zn@-p|?Qz-J-n{}|r5a6-7-cx-7-aH----p|?Qzh=jh=j-8J-xr{ry?Q`v rH----p|?Qzh>jh>j-8J-xr{ry?Q`v rH----rp@-p|?Q-J-rp@5p|?Qzh=jh=j9-p|?Qzh=jh>j9-p|?Qzh>jh>j6H----sy|n-n-J-p|?Q;\x07H----sy|n-q-J-p|?Q; H----sy|n-o-J-p|?Q;\bH----sy|n-Q-J-n-7-q-:-o-7-oH----sy|n-npr-J-n-8-qH----sy|n-npr\\r?-J-=;B-7-nprH----sy|n-rz?-J-\05zn\x075=;>9-npr\\r?-7-npr\\r?-:-Q66H----sy|n-rvtr{cnyr>-J-npr\\r?-8-rz?H----sy|n-rvtr{cnyr?-J-npr\\r?-:-rz?H----vs-5rvtr{cnyr?-IJ-=;=6-\n--------r{H----\f----rp?-rvtr{crp|>-J-{|znyv r5rp?5o9-rvtr{cnyr>-:-n66H----rp?-rvtr{crp|?-J-rp?5rvtr{crp|>;\b9-:rvtr{crp|>;\x076H----rp?-onvcrp|>-J-rvtr{crp|>--7-zv{5\0E-7-\05rvtr{cnyr>69-zn\x07`prr{`}npr`}yn`v r6H----rp?-onvcrp|?-J-rvtr{crp|?--7-zv{5\0E-7-\05rvtr{cnyr?69-zn\x07`prr{`}npr`}yn`v r6H----rp?-onvcvr}|-J-rp?5>;=-<-r|yv|{;\x079->;=-<-r|yv|{;\b6H----rp?-{qp\\ssr-J-rp?5]|vv|{;\x07-7-onvcrp|>-8-]|vv|{;\b-7-onvcrp|?6-7---------------------onvcvr}|-7-?;=H----<<-JJJ-点云→@QT`-过渡-JJJ----vs-5lnttrtnv|{R{noyrq6-\n--------sy|n-sv{ny`pnyr]|tr-J-v{O|{qS|Nttrtnv|{-L-pnyr]|tr-G-5lnttrtnv|{]|tr-7-lnttrtnv|{]|tr-7-lnttrtnv|{]|tr6H--------{qp\\ssr-7J-zv\x075=;>9->;=9-sv{ny`pnyr]|tr6H----\f----rpA-\0nq]|-J-rpA5{qpPr{r;\x07\b-8-{qp\\ssr9-{qpPr{r; 9->;=6H----tyl]|vv|{-J-\0nq]|H----<<-读取颜色----rpA-p|y|-J-rpA5--------5p|;6-3-=\x07ss9--------5p|;-KK-E6-3-=\x07ss9--------5p|;-KK->C6-3-=\x07ss9--------5p|;-KK-?A6-3-=\x07ss----6-<-?BB;=H----<<应用球谐光照,目前只兼容=>?----vs-5lzn\x07`uQrtrr-KJ->6-\n--------rp@-pnzrn]|V{\\owrp-J-rp@5v{rr5n{s|z6-7-rpA5pnzrn]|vv|{9->;=66H--------rp@-|owrpcvrQv-J-{|znyv r5}ynPr{r-:-pnzrn]|V{\\owrp6H----------------rpA-u=>?@-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9-=9-luar\x07r`v r66H----------rpA-uABCD-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9-A9-luar\x07r`v r66H----------rpA-uEF>=>>-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9-E9-luar\x07r`v r66H-----------------rp@-u>-J-u=>?@;toH-----------------------------------rp@-u?-J-rp@5u=>?@;n9-uABCD;t6H---------------------rp@-u@-J-rp@5uABCD;on9-uEF>=>>;6H-----------------------------sy|n-\x07-J-|owrpcvrQv;\x07H--------sy|n-\b-J-|owrpcvrQv;\bH--------sy|n- -J-|owrpcvrQv; H--------rp@-uP|y|-J-u>-7-5:=;AEEC=?B-7-\b6-8-u?-7-5=;AEEC=?B-7- 6-8-u@-7-5:=;AEEC=?B-7-\x076H--------p|y|;to-8J-uP|y|H----------------vs-5lzn\x07`uQrtrr-KJ-?6-\n----------------------rpA-u>?>@>A>B-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9->?9-luar\x07r`v r66H------------rpA-u>C>D>E>F-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9->C9-luar\x07r`v r66H-------------rpA-u?=?>???@-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9-?=9-luar\x07r`v r66H-------------------------rp@-uA-J-uEF>=>>;tonH------------------------------------rp@-uB-J-u>?>@>A>B;toH----------------------------------rp@-uC-J-rp@5u>?>@>A>B;n9-u>C>D>E>F;t6H---------------rp@-uD-J-rp@5u>C>D>E>F;on9-u?=?>???@;6H---------------rp@-uElqrt?-J-u?=?>???@;tonH-----------------------------------------sy|n-\x07\x07-J-\x07-7-\x07H------------sy|n-\b\b-J-\b-7-\bH------------sy|n- -J- -7- H------------sy|n-\x07\b-J-\x07-7-\bH------------sy|n-\b -J-\b-7- H------------sy|n-\x07 -J-\x07-7- H------------------------p|y|;to-8J----------------5`UlP?l=-7-\x07\b6-7-uA-8----------------5`UlP?l>-7-\b 6-7-uB-8----------------5`UlP?l?-7-5?;=-7- -:-\x07\x07-:-\b\b66-7-uC-8----------------5`UlP?l@-7-\x07 6-7-uD-8----------------5`UlP?lA-7-5\x07\x07-:-\b\b66-7-uElqrt?H--------\f----\f--------p|y|;to-J-pynz}5p|y|;to9-rp@5=;=69-rp@5>;=66H----P|y|-J-p|y|H----]|vv|{-7J-\0EH----b-J-}|vv|{;\x07\bH\f"),wy=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}(`}rpvv|{-uvtu}-sy|nH0v{pyqr-Ip|zz|{Kn\bv{t-rpA-P|y|Hn\bv{t-rp?-]|vv|{Hn\bv{t-rp?-bH|vq-znv{-56-
2328
- ----<<-计算从-}yn-中心到当前片段的平方距离----<<-由于-]|vv|{-已经按-\05E6-缩放,平方结果会被缩放-E-倍----<<-如果平方结果大于-E,说明在椭圆外,距离均值超过-\05E6-个标准差----sy|n-N-J-q|5]|vv|{9-]|vv|{6H----vs-5N-K-E;=6-qvpnqH--------rp@-p|y|-J-P|y|;toH--------<<-由于渲染的-}yn-按-\05E6-缩放,高斯公式中的逆协方差矩阵部分变成单位矩阵----<<-因此只剩下-5e-:-zrn{6-7-5e-:-zrn{6,而-zrn{-为零,所以是-e-7-e,即-N----sy|n-|}npv\b-J-r\x07}5:=;B-7-N6-7-P|y|;nH--------tylSntP|y|-J-rpA5p|y|;to9-|}npv\b6H\f`),Ty=class extends c.Mesh{constructor(){super(),this.renderData=null,this.needsRender=!1,this.sortWorker=null,this.depthIndex=new Uint32Array,this.splatIndexCapacity=0,this.activeSlot=null,this.pendingSlot=null,this.rebuildGeneration=0,this.forceClipperUniformRefresh=!1,this.incrementalUpdateInFlight=!1,this.dataTexture=null,this.transformsTexture=null,this.transformIndicesTexture=null,this.layerIndicesTexture=null,this.shTexture=null,this.usedSHDegree=0,this.onBeforeRender=(e,t,n)=>{let r=n,i=this.collectObjects(t);if(i.length===0){this.geometry.instanceCount=0;return}let a=0;i.forEach(e=>{e.usedSHDegree>a&&(a=e.usedSHDegree)}),this.setMaxShDegree(a),this.isSceneNeedsRebuild(i)&&(this.tryStartIncrementalUpdate(i)||(this.startPendingRebuild(i),this.gsSceneState.lastClipperHash=``));let o=i.filter(e=>e.transformChanged);o.length>0&&(this.syncTransformsForSlot(this.activeSlot,o),this.syncTransformsForSlot(this.pendingSlot,o),o.forEach(e=>{e.transformChanged=!1,e.selectedChanged=!1})),this.activeSlot&&this.updateSlotTextures(this.activeSlot),this.pendingSlot&&this.updateSlotTextures(this.pendingSlot);let s=new c.Matrix4().multiplyMatrices(r.perspectiveProjectionMatrix,r.matrixWorldInverse).elements;this.pendingSlot&&this.pendingSlot.renderData.initialBuildComplete&&this.pendingSlot.awaitingFirstSort?this.requestSort(this.pendingSlot,s):this.activeSlot&&this.requestSort(this.activeSlot,s);let l=this.getClipperHash(i);if((this.forceClipperUniformRefresh||l!==this.gsSceneState.lastClipperHash)&&(this.updateClipperUniforms(i),this.gsSceneState.lastClipperHash=l,this.forceClipperUniformRefresh=!1,this.needsRender=!0),this.activeSlot){let e=Math.min(this.usedSHDegree,this.activeSlot.renderData.maxShDegree);this.material.uniforms.u_maxShDegree.value=e,e>0&&!this.activeSlot.textures.shTexture?this.createSHTexture(this.activeSlot):e===0&&this.activeSlot.textures.shTexture&&(this.activeSlot.textures.shTexture.dispose(),this.activeSlot.textures.shTexture=null),this.material.uniforms.u_shTexture.value=this.activeSlot.textures.shTexture,this.renderData=this.activeSlot.renderData}else this.pendingSlot||(this.bindSlotTextures(null),this.material.uniforms.u_maxShDegree.value=0,this.geometry.instanceCount=0);this.material.uniforms.resolution.value.set(r.resolution.x,r.resolution.y)};let e=this.createGeometry(),t=this.createMaterial();this.geometry=e,this.material=t,this.frustumCulled=!1,this.renderOrder=-99999999999,this.gsSceneState={lastObjectsHash:``,lastClipperHash:``},this.sortWorker=new Sy,this.sortWorker.postMessage({warmup:!0}),yy.warmupWasm(),this.sortWorker.onmessage=e=>{if(e.data.depthIndex){let t=e.data.generation;if(this.pendingSlot&&t===this.pendingSlot.generation){this.pendingSlot.awaitingFirstSort=!1,this.swapPendingToActive(e.data.depthIndex);return}this.activeSlot&&t===this.activeSlot.generation&&(this.activeSlot.awaitingFirstSort=!1,this.applyDepthIndex(e.data.depthIndex))}}}ensureSplatIndexCapacity(e){let t=this.geometry.getAttribute(`splatIndex`);if(e<=this.splatIndexCapacity)return t;let n=this.getExpandedCapacity(e),r=t.array,i=new Float32Array(n);i.set(r.subarray(0,Math.min(r.length,n)));let a=new c.InstancedBufferAttribute(i,1,!1,1);return a.setUsage(c.DynamicDrawUsage),this.geometry.setAttribute(`splatIndex`,a),this.splatIndexCapacity=n,this.geometry._maxInstanceCount=n,a}getExpandedCapacity(e){let t=Math.max(this.splatIndexCapacity,1);for(;t<e;)t*=2;return t}createGeometry(){let e=new c.InstancedBufferGeometry,t=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,1,0]);e.setAttribute(`position`,new c.BufferAttribute(t,3));let n=new Uint16Array([0,1,2,0,2,3]);e.setIndex(new c.BufferAttribute(n,1)),this.splatIndexCapacity=1;let r=new Float32Array(this.splatIndexCapacity);for(let e=0;e<r.length;e++)r[e]=e;let i=new c.InstancedBufferAttribute(r,1,!1,1);return i.setUsage(c.DynamicDrawUsage),e.setAttribute(`splatIndex`,i),e._maxInstanceCount=this.splatIndexCapacity,e.instanceCount=0,e}createMaterial(){return new c.ShaderMaterial({vertexShader:Cy,fragmentShader:wy,defines:{NUM_GS_LAYERS:0,NUM_GS_CLIPPERS:0},uniforms:{u_texture:{value:null},u_transforms:{value:null},u_transformIndices:{value:null},u_layerIndices:{value:null},u_numGsLayers:{value:0},u_numGsClippers:{value:0},u_layerClipperRanges:{value:[]},u_clipperMatricesInverse:{value:[]},u_shTexture:{value:null},u_shTextureSize:{value:new c.Vector2},u_maxShDegree:{value:0},resolution:{value:new c.Vector2},u_aggregationEnabled:{value:!0},u_aggregationProgress:{value:0},u_aggregationBoundsMin:{value:new c.Vector3(0,0,0)},u_aggregationBoundsMax:{value:new c.Vector3(0,0,0)},u_aggregationPointDuration:{value:.6}},side:c.DoubleSide,transparent:!0,blending:c.NormalBlending,depthTest:!0,depthWrite:!1})}createDefaultLayerClipperRanges(e){return Array.from({length:e},()=>new c.Vector2(-1,0))}createDefaultClipperMatrices(e){return Array.from({length:e},()=>new c.Matrix4)}createTextures(e){let t=new c.DataTexture(e.data,e.width,e.height,c.RGBAIntegerFormat,c.UnsignedIntType);t.internalFormat=`RGBA32UI`,t.minFilter=c.NearestFilter,t.magFilter=c.NearestFilter,t.needsUpdate=!0;let n=new c.DataTexture(e.transforms,e.transformsWidth,e.transformsHeight,c.RGBAFormat,c.FloatType);n.internalFormat=`RGBA32F`,n.minFilter=c.NearestFilter,n.magFilter=c.NearestFilter,n.needsUpdate=!0;let r=new c.DataTexture(e.transformIndices,e.transformIndicesWidth,e.transformIndicesHeight,c.RedIntegerFormat,c.UnsignedIntType);r.internalFormat=`R32UI`,r.minFilter=c.NearestFilter,r.magFilter=c.NearestFilter,r.needsUpdate=!0;let i=new c.DataTexture(e.layerIndices,e.layerIndicesWidth,e.layerIndicesHeight,c.RedIntegerFormat,c.UnsignedIntType);return i.internalFormat=`R32UI`,i.minFilter=c.NearestFilter,i.magFilter=c.NearestFilter,i.needsUpdate=!0,{dataTexture:t,transformsTexture:n,transformIndicesTexture:r,layerIndicesTexture:i,shTexture:null}}createSHTexture(e){let{renderData:t,textures:n}=e;n.shTexture&&(n.shTexture.dispose(),n.shTexture=null);let r=Math.min(this.usedSHDegree,t.maxShDegree),i=0;if(r>=1&&(i+=9),r>=2&&(i+=15),r>=3&&(i+=21),i===0)return;let a=i;a%4!=0&&(a=Math.ceil(a/4)*4);let o=t.numPoints*a/4,s=2048,l=Math.ceil(o/s),u=new Float32Array(s*l*4);for(let e=0;e<t.numPoints;e++){let n=a/4*e,i=0;if(t.sh1&&r>=1)for(let r=0;r<9;r++){let a=n+Math.floor(i/4),o=i%4,s=a*4+o;u[s]=t.sh1[e*9+r],i++}if(t.sh2&&r>=2)for(let r=0;r<15;r++){let a=n+Math.floor(i/4),o=i%4,s=a*4+o;u[s]=t.sh2[e*15+r],i++}if(t.sh3&&r>=3)for(let r=0;r<21;r++){let a=n+Math.floor(i/4),o=i%4,s=a*4+o;u[s]=t.sh3[e*21+r],i++}}n.shTexture=new c.DataTexture(u,s,l,c.RGBAFormat,c.FloatType),n.shTexture.internalFormat=`RGBA32F`,n.shTexture.minFilter=c.NearestFilter,n.shTexture.magFilter=c.NearestFilter,n.shTexture.needsUpdate=!0,this.material.uniforms.u_shTextureSize.value.set(s,l),this.material.uniforms.u_maxShDegree.value=r}setMaxShDegree(e){var t,n;if(e<0||e>2){console.warn(`现在只支持012三种阶数,你输入的是${e}`);return}let r=this.usedSHDegree;this.usedSHDegree=e,r!==e&&((t=this.activeSlot)!=null&&t.textures.shTexture&&(this.activeSlot.textures.shTexture.dispose(),this.activeSlot.textures.shTexture=null),(n=this.pendingSlot)!=null&&n.textures.shTexture&&(this.pendingSlot.textures.shTexture.dispose(),this.pendingSlot.textures.shTexture=null),this.material.uniforms.u_maxShDegree.value=e,e===0?this.material.uniforms.u_shTexture.value=null:this.activeSlot&&this.activeSlot.renderData.maxShDegree>0&&(this.createSHTexture(this.activeSlot),this.material.uniforms.u_shTexture.value=this.activeSlot.textures.shTexture))}bindSlotTextures(e){if(!e){this.dataTexture=null,this.transformsTexture=null,this.transformIndicesTexture=null,this.layerIndicesTexture=null,this.shTexture=null,this.material.uniforms.u_texture.value=null,this.material.uniforms.u_transforms.value=null,this.material.uniforms.u_transformIndices.value=null,this.material.uniforms.u_layerIndices.value=null,this.material.uniforms.u_shTexture.value=null;return}this.dataTexture=e.textures.dataTexture,this.transformsTexture=e.textures.transformsTexture,this.transformIndicesTexture=e.textures.transformIndicesTexture,this.layerIndicesTexture=e.textures.layerIndicesTexture,this.shTexture=e.textures.shTexture,this.material.uniforms.u_texture.value=this.dataTexture,this.material.uniforms.u_transforms.value=this.transformsTexture,this.material.uniforms.u_transformIndices.value=this.transformIndicesTexture,this.material.uniforms.u_layerIndices.value=this.layerIndicesTexture,this.material.uniforms.u_shTexture.value=this.shTexture}disposeSlot(e){e&&(e.renderData.dispose(),this.disposeTextures(e.textures))}disposeTextures(e){e.dataTexture.dispose(),e.transformsTexture.dispose(),e.transformIndicesTexture.dispose(),e.layerIndicesTexture.dispose(),e.shTexture&&(e.shTexture.dispose(),e.shTexture=null)}applyDepthIndex(e){this.depthIndex=e;let t=this.depthIndex.length,n=this.ensureSplatIndexCapacity(t);n.array.set(this.depthIndex,0),n.count=this.depthIndex.length,n.updateRange.offset=0,n.updateRange.count=t,n.needsUpdate=!0,this.geometry.instanceCount=this.depthIndex.length,this.needsRender=!0}swapPendingToActive(e){if(!this.pendingSlot)return;let t=this.activeSlot;this.activeSlot=this.pendingSlot,this.pendingSlot=null,this.renderData=this.activeSlot.renderData,this.ensureSplatIndexCapacity(this.activeSlot.renderData.numPoints),this.bindSlotTextures(this.activeSlot),this.activeSlot.sortDataUploaded=!0,this.forceClipperUniformRefresh=!0,this.applyDepthIndex(e),t&&this.disposeSlot(t)}createSlot(e){let t={generation:e.generation,renderData:e,textures:this.createTextures(e),awaitingFirstSort:!0,sortDataUploaded:!1};return this.usedSHDegree>0&&e.maxShDegree>0&&this.createSHTexture(t),t}updateSlotTextures(e){e.renderData.dataChanged&&(e.textures.dataTexture.needsUpdate=!0,e.renderData.dataChanged=!1),e.renderData.transformsChanged&&(e.textures.transformsTexture.needsUpdate=!0,e.textures.transformIndicesTexture.needsUpdate=!0,e.renderData.transformsChanged=!1)}postSortData(e){var t;let n=new Float32Array(e.renderData.positions.slice().buffer),r=new Float32Array(e.renderData.transforms.slice().buffer),i=new Uint32Array(e.renderData.transformIndices.slice().buffer);(t=this.sortWorker)==null||t.postMessage({sortData:{positions:n,transforms:r,transformIndices:i,vertexCount:e.renderData.numPoints,generation:e.generation}},[n.buffer,r.buffer,i.buffer]),e.sortDataUploaded=!0}requestSort(e,t){var n;e.renderData.initialBuildComplete&&((e.renderData.dataChanged||e.renderData.transformsChanged||!e.sortDataUploaded)&&this.postSortData(e),(n=this.sortWorker)==null||n.postMessage({viewProj:t}))}syncTransformsForSlot(e,t){e&&t.forEach(t=>{e.renderData.splatIndices.has(t)&&e.renderData.updateTransform(t)})}collectObjects(e){let t=[];return e.traverse(e=>{e instanceof $n&&e.visible&&t.push(e)}),t.sort((e,t)=>{let n=e.uuid+e.gsViewLayerKey,r=t.uuid+t.gsViewLayerKey;return n<r?-1:n>r?1:0}),t}isSceneNeedsRebuild(e){let t=e.map(e=>`${e.uuid}:${e.gsViewLayerKey}`).join(`|`),n=t!==this.gsSceneState.lastObjectsHash;return this.gsSceneState.lastObjectsHash=t,n}getClipperHash(e){return e.map(e=>{let t=e.gsClippers.map(e=>{var t;return`${(t=e.floorIndex)==null?-1:t}:${e.clippingBoxMatrix.elements.join(`,`)}`}).join(`;`);return`${e.gsViewLayerKey}:${t}`}).join(`|`)}updateClipperCounts(e,t){let n=Math.max(0,e|0),r=Math.max(0,t|0),i=this.material.defines;(i.NUM_GS_LAYERS!==n||i.NUM_GS_CLIPPERS!==r)&&(i.NUM_GS_LAYERS=n,i.NUM_GS_CLIPPERS=r,this.material.needsUpdate=!0),this.material.uniforms.u_numGsLayers.value=e,this.material.uniforms.u_numGsClippers.value=t}updateClipperUniforms(e){var t,n,r,i;let a=(n=(t=this.activeSlot)==null?void 0:t.renderData)==null?null:n;if(!a){this.material.uniforms.u_layerClipperRanges.value=[],this.material.uniforms.u_clipperMatricesInverse.value=[],this.updateClipperCounts(0,0);return}let o=new Map;for(let t of e)o.has(t.gsViewLayerKey)||o.set(t.gsViewLayerKey,t.gsClippers);let s=a.layerKeys.length,c=0;for(let e of a.layerKeys)c+=((r=o.get(e))==null?[]:r).length;let l=this.createDefaultLayerClipperRanges(s),u=this.createDefaultClipperMatrices(c),d=0;for(let e of a.layerKeys){let t=a.layerKeyToIndex.get(e);if(t===void 0)continue;let n=(i=o.get(e))==null?[]:i,r=d,s=0;for(let e of n)u[d].getInverse(e.clippingBoxMatrix),d++,s++;s>0&&l[t].set(r,s)}this.material.uniforms.u_layerClipperRanges.value=l,this.material.uniforms.u_clipperMatricesInverse.value=u,this.updateClipperCounts(s,d)}startPendingRebuild(e){this.pendingSlot&&(this.disposeSlot(this.pendingSlot),this.pendingSlot=null),this.rebuildGeneration+=1;let t=new yy(e,this.rebuildGeneration);this.pendingSlot=this.createSlot(t)}tryStartIncrementalUpdate(e){if(!this.activeSlot||this.pendingSlot||this.incrementalUpdateInFlight)return!1;let t=this.activeSlot.renderData.getObjectsInOrder();if(!this.activeSlot.renderData.canIncrementalAppend(e))return!1;let n=e.slice(t.length);if(n.length===0)return!1;this.incrementalUpdateInFlight=!0;let r=this.activeSlot;return r.renderData.appendObjects(n).then(e=>{if(!e||this.activeSlot!==r||r.renderData.disposed)return;let t=r.textures;r.textures=this.createTextures(r.renderData),this.usedSHDegree>0&&r.renderData.maxShDegree>0&&this.createSHTexture(r),this.bindSlotTextures(r),this.ensureSplatIndexCapacity(r.renderData.numPoints),r.sortDataUploaded=!1,r.awaitingFirstSort=!0,this.disposeTextures(t),this.forceClipperUniformRefresh=!0,this.gsSceneState.lastClipperHash=``,this.needsRender=!0}).catch(e=>{console.warn(`Incremental append failed, fallback to rebuild:`,e)}).finally(()=>{this.incrementalUpdateInFlight=!1}),!0}dispose(){this.disposeSlot(this.pendingSlot),this.pendingSlot=null,this.disposeSlot(this.activeSlot),this.activeSlot=null,this.renderData=null,this.sortWorker&&this.sortWorker.terminate(),this.bindSlotTextures(null),this.geometry.dispose(),this.material.dispose()}},Ey=class extends c.Mesh{constructor(){super(),this.onBeforeRender=(e,t,n)=>{this.collectObjects(t).length>0&&console.warn(`未开启webgl2, 3dgs仅支持在开启webgl2模式后使用`)}}collectObjects(e){let t=[];return e.traverse(e=>{e instanceof $n&&e.visible&&t.push(e)}),t}},Dy=1e3,Oy=90,ky=e=>e.replace(`//vrlab-public.ljcdn.com/`,`//vr-public.realsee-cdn.cn/`).replace(`//vrlab-image4.ljcdn.com/`,`//vr-image-4.realsee-cdn.cn/`).replace(`//vrlab-image3.ljcdn.com/`,`//vr-image-3.realsee-cdn.cn/`).replace(`//vrlab-image2.ljcdn.com/`,`//vr-image-2.realsee-cdn.cn/`).replace(`//vrlab-image1.ljcdn.com/`,`//vr-image-1.realsee-cdn.cn/`),Ay=new c.Sphere,jy=new c.Box3,My=new c.Vector4,Ny=new c.Vector4,Py=new c.Color,Fy=new c.Vector2,Iy=new WeakMap,Ly=nm([$p(null)]),Ry={},zy=class e extends ln{static get version(){return`6.8.0-alpha.27`}static get dracoPath(){return io.decoderPath}static set dracoPath(e){io.setDecoderPath(e)}static get ktx2Path(){return po.transcoderPath}static set ktx2Path(e){po.setTranscoderPath(e)}static get useNativeImageBitmap(){return di()}static set useNativeImageBitmap(e){ui(e)}constructor(e={}){var t,n,r,i,a,o,s,l,u,d,f;if(super(),this.pbmGaussianSplattingRenderMesh=null,this.fiveId=rn(),Ry[this.fiveId]=this,this.currentUpdateArgs={time:H(),args:[]},this.currentMode=`Panorama`,this.pano={workCode:``,panoIndex:0},this.needsRender=!1,this.onlyRenderIfNeeds=(t=e.onlyRenderIfNeeds)==null?!0:t,this.imageOptions=Object.assign({},(n=e.imageOptions)==null?{}:n),this.textureOptions=Object.assign({},(r=e.textureOptions)==null?{}:r),this.poweredByRealsee=(i=e.poweredByRealsee)==null?!0:i,this.backgroundColor=new c.Color((a=e.backgroundColor)==null?1579548:a),this.backgroundAlpha=(o=e.backgroundAlpha)==null?1:o,this.extraElements=[],this.controllerInits={Panorama:Object.assign({},e.panorama),Model:Object.assign({},e.model),Floorplan:Object.assign({},e.floorplan),Topview:Object.assign({},e.topview),Mapview:Object.assign({},e.mapview),VRPanorama:Object.assign({},e.vrPanorama),XRPanorama:Object.assign({},e.xrPanorama)},this.fps={testCount:0,testTime:H()},this.modeChangeDuration=(s=e.modeChangeDuration)==null?Dy:s,this.enableWheel=(l=e.enableWheel)==null?!0:l,typeof window<`u`)if(`renderer`in e)e.renderer instanceof Ym&&this.throwError(Error(`cannot render a internal renderer`)),this.renderer=e.renderer;else try{this.renderer=new Ym({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});let t=Yv();this.renderer.setPixelRatio(t===1?window.devicePixelRatio:1),this.renderer.setSize(512,512),this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha)}catch(e){let t=e instanceof Error?e:Error(String(e));this.throwError(t)}this.getPixelsRenderTarget=new c.WebGLRenderTarget(1,1,{encoding:(d=(u=this.renderer)==null?void 0:u.outputEncoding)==null?c.sRGBEncoding:d,generateMipmaps:!1}),this.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),this.camera=new tn(Oy),this.scene=new nh,this.xrCustomObjectsScene=new c.Scene,this.scene.add(this.xrCustomObjectsScene),this.scene.matrixAutoUpdate=!1,this.loadWorkTask=Promise.resolve(),this.requestProxy=(f=e.requestProxy)==null?ky:f,this.networkSubscribe=new dr,this.networkSubscribe.on(`network`,(e,t,n,r)=>{var i;this.emit(`network.resource`,Q(`network.resource`,{source:e,requestType:t,requestState:n,detail:r})),(i=this.analysis)==null||i.network(this.works,e,t,n,r)}),this.readyCallbacks=[],this.syncingState=!1,this.helperGroup=new c.Group,this.helperGroup.name=`helper`,this.helperGroup.matrixAutoUpdate=!1,this.scene.add(this.helperGroup),Iy.set(this,Ly),this.modelScene=new $f({fiveId:this.fiveId}),this.modelScene.addEventListener(`model.create`,e=>{this.bindModel(e.model)}),this.scene.add(this.modelScene);let[p]=this.modelScene.setModels(Ly,{forceReplaceImmediately:!0});V(p,`loaded`,{get(){return!1},set(e){}}),this.videoTexture=new c.VideoTexture(e.videoInstance||Kv());let m=qv();this.scene.add(m),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.stateSynced=!1,this.destroyed=!1,this.paused=!0,typeof window<`u`&&(e.play!==!1&&this.play(),this.stopAnimationLoop=si.shared.add((e,t,...n)=>{this.updateTime(e,t,...n)},!1,0,10));let h=()=>{typeof document<`u`&&document.fullscreenElement===null&&this.currentMode===`VRPanorama`&&this.controller.emit(`vr.requestExit`,Q(`vr.requestExit`,{}))},g=()=>{this.needsRender=!0};if(typeof document<`u`&&document.addEventListener(`fullscreenchange`,h,!1),this.renderer&&this.renderer.domElement.addEventListener(`webglcontextrestored`,g,!1),this.removeEventListeners=()=>{typeof document<`u`&&document.removeEventListener(`fullscreenchange`,h,!1),this.renderer&&this.renderer.domElement.removeEventListener(`webglcontextrestored`,g,!1)},this.plugins={},e.plugins&&e.plugins.length){for(let t of e.plugins)if(typeof t==`function`)t(this);else if(Array.isArray(t)){let[e,n,r]=t;if(typeof e==`function`){let t=e(this,r);typeof n==`string`&&(this.plugins[n]?this.throwError(Error(`plugin name ${n} is exists.`)):this.plugins[n]=t)}}}Gv(this),this.fiveRenderer=new Jm,this.adaptiveLuminancePass=new Dm,this.adaptiveLuminancePass.enabled=!1,this.fiveRenderer.composer.addPass(this.adaptiveLuminancePass),this.eyeDomeLightingPass=new Am(this.camera),this.eyeDomeLightingPass.enabled=!1,this.fiveRenderer.composer.addPass(this.eyeDomeLightingPass),e.webgl2?(this.pbmGaussianSplattingRenderMesh=new Ty,this.scene.add(this.pbmGaussianSplattingRenderMesh)):this.scene.add(new Ey)}get ident(){return this.fiveId}get panoIndex(){return this.pano.panoIndex}get panoId(){return Z(this.pano)}dispose(){var e;if(this.destroyed===!0)return;delete Ry[this.fiveId],this.emit(`dispose`),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),this.stopAnimationLoop=void 0),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);let t=this.getElement();t&&t.parentNode&&t.parentNode.removeChild(t);let n=this.modelScene.parameter;n.pano0&&n.pano0.map.dispose(),n.pano1&&n.pano1.map!==((e=n.pano0)==null?void 0:e.map)&&n.pano1.map.dispose(),n.reset(`pano0`,`pano1`),this.modelScene.dispose(),this.scene.dispose(),this.xrCustomObjectsScene.dispose(),Iy.set(this,Ly),this.renderer&&this.renderer.render(new c.Scene,new c.Camera),this.fiveRenderer.dispose(),this.renderer instanceof Ym&&(this.renderer.forceContextLoss&&this.renderer.forceContextLoss(),this.renderer.dispose())}setViewport(e){Object.assign(this.viewport,e),this.needsRender=!0}get boundingMesh(){return this.modelScene.boundingMesh}get helperVisible(){return this.helperGroup.visible}set helperVisible(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit(`helpers.visible`,Q(`helpers.visible`,{object:this.helperGroup})),this.needsRender=!0)}updateConfiguration(e,t=!0){let n=!1,r=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,br(e.panorama)),this.currentMode===`Panorama`&&(n=!0)),e.model&&(Object.assign(this.controllerInits.Model,br(e.model)),this.currentMode===`Model`&&(n=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,br(e.floorplan)),this.currentMode===`Floorplan`&&(n=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,br(e.topview)),this.currentMode===`Topview`&&(n=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,br(e.mapview)),this.currentMode===`Mapview`&&(n=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,br(e.vrPanorama)),this.currentMode===`VRPanorama`&&(n=!0)),e.xrPanorama&&(Object.assign(this.controllerInits.XRPanorama,br(e.xrPanorama)),this.currentMode===`XRPanorama`&&(n=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),(this.currentMode===`Panorama`||this.currentMode===`VRPanorama`)&&(r=!0,n=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),t&&n&&this.controller&&this.currentMode&&(!this.controller.updateConfiguration(this.controllerInits[this.currentMode])||r)&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)}appendTo(e,t={}){if(!this.renderer)return;if(!(this.renderer instanceof Ym)){this.throwError(Error(`cannot call appendTo method when render a external renderer`));return}let n=this.getElement();if(!n)return;e.appendChild(n),this.refresh(t);let r=window.getComputedStyle(e).position;r!==`relative`&&r!==`absolute`&&r!==`fixed`&&r!==`sticky`&&(e.style.position=`relative`)}refresh(e={},t){var n,r,i;if(!this.renderer)return;let a=this.renderer.domElement.parentNode,{width:o=(n=a==null?void 0:a.offsetWidth)==null?512:n,height:s=(r=a==null?void 0:a.offsetHeight)==null?512:r}=e;if(o=Math.max(1,o),s=Math.max(1,s),!t){let e=Yv(),n=typeof window<`u`?window.devicePixelRatio:1;if(t=(i=e===1?n:1)==null?1:i,t>1){let e=Math.max(o,s)*t,n=Math.min(this.renderer.capabilities.maxTextureSize,4096);e>n&&(t=Math.max(t/e*n,1),t=Math.floor(t*100)/100)}}this.renderer.setPixelRatio(t),this.renderer.setSize(o,s),this.needsRender=!0;let c=H(),l=c-this.currentUpdateArgs.time,u=this.currentUpdateArgs.args;this.updateTime(c,l,...u)}addExtraElement(e){return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),()=>this.removeExtraElement(e)}removeExtraElement(e){let t=this.extraElements.indexOf(e);t!==-1&&(this.extraElements.splice(t,1),this.controller&&this.controller.unbindExtraElement(e))}getSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}getDrawingBufferSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getDrawingBufferSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}updateCamera(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCamera(e,t,n)}updateCameraWithKeyframes(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCameraWithKeyframes(e,t,n)}get works(){return Iy.get(this)||Ly}get work(){return this.works[0]}get observers(){return this.work.observers}get models(){return this.modelScene.models}get model(){return this.modelScene.models[0]}load(e,t,n,r=!0){if(!this.renderer)throw Error(`renderer is not initialized`);let i=this.loadWorkTask.then(()=>Sh(e)?e.then(e=>this.load_(e,t,n,r)):this.load_(e,t,n,r));return this.loadWorkTask=i.catch(e=>{this.throwError(e)}),i}load_(t,n,r,i=!0){var a,o,s,l,u,d,f,p,m,h;let g={};typeof r==`number`?g.duration=r:typeof r==`object`&&Object.assign(g,r),this.works===Ly&&(g.duration===void 0&&(g.duration=0),g.effect===void 0&&(g.effect=`instant`));let _={};Object.assign(_,g.model),!_[`3d-tiles`]&&g[`3d-tiles`]&&(_[`3d-tiles`]=g[`3d-tiles`]),!_.textureOptions&&g.textureOptions&&(_.textureOptions=g.textureOptions),!_.textureOptions&&this.textureOptions&&(_.textureOptions=this.textureOptions);let v=[];if(Array.isArray(t))for(let e of t)e instanceof Qp?v.push(e):typeof e!=`string`&&`work`in e?v.push($p(e.work,e)):v.push($p(e));else t instanceof Qp?v.push(t):v.push($p(t));g.mode===`add`&&(v=[].concat(this.works,v));let y;try{y=nm(v)}catch(e){return this.throwError(e),Promise.reject(e)}for(let e of y)this.bindWorkFetcher(e);n===void 0&&(n=`inherit`),n===`inherit`&&this.works===Ly&&(n=`initial`);let b=this.currentMode,x=y.initial,S=x.work.observers[0],C=S?{workCode:S.work.workCode,panoIndex:S.panoIndex}:{workCode:x.work.workCode,panoIndex:0},w=(a=x.mode)==null?S?`Panorama`:`Mapview`:a,T={};if(n===`inherit`){let e=this.getCurrentState(),[t]=y.filter(t=>t.workCode===e.workCode);if(t)C={workCode:e.workCode,panoIndex:e.panoIndex},w=e.mode,T={longitude:e.latitude,latitude:e.latitude,fov:e.fov,distance:e.distance,offset:e.offset.clone()};else{n={mode:b};let e=(s=(o=y[0])==null?void 0:o.observers)==null?void 0:s[this.panoIndex];e?(n.workCode=e.work.workCode,n.panoIndex=e.panoIndex):typeof y.initial.panoIndex==`number`?(n.workCode=y.initial.work.workCode,n.panoIndex=y.initial.panoIndex):(n.mode===`Panorama`||n.mode===`VRPanorama`||n.mode===`XRPanorama`)&&(n.mode=`Mapview`),n.mode===b&&(n.longitude=this.camera.pose.longitude,n.latitude=this.camera.pose.latitude,n.fov=this.camera.pose.fov)}}if(n===`initial`&&(typeof x.panoIndex==`number`&&(C={workCode:x.work.workCode,panoIndex:x.panoIndex}),x.mode&&(w=x.mode),T={longitude:x.longitude,latitude:x.latitude,fov:x.fov,distance:x.distance,offset:(l=x.offset)==null?void 0:l.clone()}),typeof n==`object`){if(w=(u=n.mode)==null?b:u,typeof n.panoIndex==`number`){let e=y.getObserver({workCode:(f=(d=n.workCode)==null?x.work.workCode:d)==null?``:f,panoIndex:n.panoIndex});e&&(C={workCode:e.work.workCode,panoIndex:e.panoIndex})}T={longitude:n.longitude,latitude:n.latitude,fov:n.fov,distance:n.distance,offset:n.offset?new c.Vector3().copy(n.offset):void 0}}let E=(p=g.duration)==null?this.modeChangeDuration:p;(w===`Floorplan`||w===`Topview`||w===`Mapview`)&&b===w&&(E=0);let D=`fly`;(w===`Panorama`||w===`VRPanorama`||w===`XRPanorama`)&&b===w&&(D=(m=g.effect)==null?`fade`:m),this.emit(`works.request`,Q(`works.request`,{input:t,works:y,userAction:i}));let O=(e,t,r)=>{let a=this.getCurrentState(),o=Object.assign(Object.assign({mode:e},t),r);n===`inherit`&&(o=this.getCurrentState()),this.pano=t;let s=Object.assign(Object.assign({initial:{state:o,currentState:a,duration:E,effect:D,userAction:i}},this.commonParams()),this.controllerInits[e]),c=Hv[o.mode].initAnimationEndState(s);if(this.controller&&b===e)this.controller.updateWork(y,c,{effect:D,duration:E},i)===!1&&(this.controller.destroy(),this.controller=this.applyController(e,s));else{if(this.controller)this.controller.destroy();else{let t=Hv[e].initAnimationEndState(s);this.camera.setFromPose(t),this.emit(`camera.update`,Q(`camera.update`,{state:this.getCurrentState(),userAction:i}))}this.controller=this.applyController(e,s);let t=Q(`mode.change`,{prevMode:b,mode:e,state:c,userAction:i});try{this.emit(`mode.change`,t)}catch(e){console.error(e)}}this.updateTime(this.currentUpdateArgs.time,0,...this.currentUpdateArgs.args)};Iy.set(this,y);let k=Promise.resolve();if(w===e.Mode.Floorplan||w===e.Mode.Topview||w===e.Mode.Mapview||w===e.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(T),Nh(this.state,this.camera.pose));let e=this.modelScene.setModels(y,_);k=Promise.all(e.map(e=>e.loadedReady)).then(()=>{this.needsRender=!0,O(w,C,T),this.emit(`camera.update`,Q(`camera.update`,{state:this.getCurrentState(),userAction:i}))})}else{O(w,C,T);let e=this.controller,t=!1;this.modelScene.autoRefine=!1;let n=()=>{this.works===y&&t===!1&&(this.needsRender=!0,this.emit(`camera.update`,Q(`camera.update`,{state:this.getCurrentState(),userAction:i})),t=!0,this.modelScene.autoRefine=!0),e.off(`pano.arrived`,n),e.off(`pano.cancel`,n)},r=this.modelScene.setModels(y,_);k=Promise.all(r.map(e=>e.initReady)).then(K),e.once(`pano.arrived`,n),e.once(`pano.cancel`,n),setTimeout(n,((h=g.duration)==null?this.modeChangeDuration:h)+1e3)}return this.emit(`works.load`,Q(`works.load`,{input:t,userAction:i,works:y})),k.then(()=>this.ready()).then(()=>{var e;this.emit(`works.ready`,Q(`works.ready`,{input:t,userAction:i,works:y})),(e=this.analysis)==null||e.work(y)})}reset(){let e=this.loadWorkTask.then(()=>this.reset_());return this.loadWorkTask=e.catch(e=>{this.throwError(e)}),e}reset_(){return new Promise(e=>{var t;this.controller&&(this.controller.destroy(),this.controller=void 0);let n=this.modelScene.parameter;n.pano0&&n.pano0.map.dispose(),n.pano1&&n.pano1.map!==((t=n.pano0)==null?void 0:t.map)&&n.pano1.map.dispose(),n.set({pano0:null,pano1:null,modelAlpha:1}),Iy.set(this,Ly),this.modelScene.setModels(Ly,{forceReplaceImmediately:!0}),this.renderer&&this.modelScene.update(this.renderer,this.camera),this.needsRender=!0,this.currentMode=`Panorama`,this.pano={workCode:``,panoIndex:0},this.camera.setFromPose({distance:0,fov:Oy,longitude:0,latitude:0,offset:new c.Vector3(0,0,0)}),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.camera.needsRender=!1,this.needsRender=!1,e()})}changeMode(t,n={},r,i=!0,a=!1){return new Promise((o,s)=>{var c,l,u,d;if(!this.renderer)throw Error(`renderer is not initialized.`);n=Object.assign({},n);let f=0;this.controller&&(f=typeof r==`number`?r:(c=r==null?void 0:r.duration)==null?this.modeChangeDuration:c);let p=`fly`;this.controller&&typeof r==`object`&&r.effect&&(p=r.effect);let m=typeof n.panoIndex==`number`?{workCode:(d=(l=n.workCode)==null?(u=this.work)==null?void 0:u.workCode:l)==null?``:d,panoIndex:n.panoIndex}:this.pano;if(!e.Mode.hasOwnProperty(t)){let e=Error(`mode "${t}" is not existed`);this.throwError(e),s(e);return}if((t===e.Mode.Panorama||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama)&&!this.works.getObserver(m)){let e=Error(`PanoId ${Z(m)} not existed.`);this.throwError(e),s(e);return}(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)&&this.modelScene.empty&&(f=0);let h=this.controller,g=this.currentMode,_=()=>{if(this.controller&&this.controller.stopMomentumMovement(),this.controller&&a===!1&&g===t)t===e.Mode.Panorama||t===e.Mode.Model||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama?!_p(this.pano,m)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`?this.controller.moveToPano(m,Object.assign({duration:f},n),i):this.controller.updateCamera(n,f,i).catch(K):(_p(this.pano,m)||(this.pano=m),this.controller.updateCamera(n,f,i).catch(K));else{let e=Object.assign(Object.assign({},n),m),r=Object.assign(Object.assign({initial:{state:e,currentState:this.getCurrentState(),duration:f,effect:p,userAction:i}},this.commonParams()),this.controllerInits[t]),a=Hv[t].initAnimationEndState(r),o=Q(`mode.change.request`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});if(this.emit(`mode.change.request`,o),!o.defaultPrevented){h&&h.destroy(),this.controller=this.applyController(t,r);let e=Q(`mode.change`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});this.emit(`mode.change`,e)}}o()},v=si.shared.getContext();v&&(typeof XRSession<`u`&&v instanceof XRSession&&v.end(),si.shared.setContext(null)),t===e.Mode.VRPanorama?(this.requestFullscreen(),kh().then(()=>_()).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.exitFullscreen(),this.throwError(t),s(t)})):t===e.Mode.XRPanorama?Ah().then(e=>{si.shared.setContext(e),a=!0,_()}).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.throwError(t),s(t)}):_()})}getPixels(e,t,n,r,i,a,o){if(!this.renderer)throw Error(`renderer is not initialized.`);let s=H(),l=this.renderer.getPixelRatio(),u=this.renderer.getRenderTarget(),d=this.getSize(new c.Vector2),f=0,p=0,m=1,h=1,g,_,v,y,b;typeof e==`number`?(f=e,typeof t==`number`&&(p=t),typeof n==`number`&&(m=n),typeof r==`number`&&(h=r),g=i,_=a,b=o):(f=e.x,p=e.y,m=e.width,h=e.height,g=e.pixelRatio,_=e.flipY,v=e.helperVisible,y=e.skipPanorama,b=e.buffer),f=Math.floor(f),p=Math.floor(p),m=Math.floor(m),h=Math.floor(h),g=Math.floor(g==null?l:g),_=_==null?!1:_;let x=this.helperVisible,S=this.modelScene.parameter.modelAlpha;this.helperVisible=v==null?this.helperVisible:v,y&&(this.controller instanceof Hv.Panorama||this.controller instanceof Hv.VRPanorama||this.controller instanceof Hv.XRPanorama)&&y===!0&&this.modelScene.parameter.set(`modelAlpha`,1),this.modelScene.update(this.renderer,this.camera);let C=this.getPixelsRenderTarget;C.setSize(m*g,h*g),this.renderer.setRenderTarget(C),this.camera.pixelRatio=g,this.camera.resolution.set(m,h),this.camera.setViewOffset(d.width,d.height,f,d.height-p-h,m,h),this.camera.aspect=d.width/d.height,this.camera.updateTime(s),this.scene.update(this.renderer,this.camera);let w=this.renderer.autoClear,T=this.renderer.autoClearColor,E=this.renderer.autoClearDepth,D=this.renderer.autoClearStencil,O=Py.copy(this.renderer.getClearColor()),k=this.renderer.getClearAlpha(),A=this.renderer.getScissorTest();this.renderer.autoClear=!0,this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.autoClearStencil=!0,this.renderer.setScissorTest(!1);let j=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:j,this.renderer.render(this.scene,this.camera),this.scene.background=j,this.renderer.autoClear=w,this.renderer.autoClearColor=T,this.renderer.autoClearDepth=E,this.renderer.autoClearStencil=D,this.renderer.setClearColor(O,k),this.renderer.setScissorTest(A),this.helperVisible=x,S===void 0?this.modelScene.parameter.reset(`modelAlpha`):this.modelScene.parameter.set(`modelAlpha`,S),this.renderer.setRenderTarget(u),this.camera.clearViewOffset(),this.camera.pixelRatio=l,this.camera.resolution.copy(d),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.camera.updateTime(s),this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);let M=m*g,N=h*g,ee=M*N,P=ee*4;if(b){if(b.length!==P)throw Error(`buffer length is not equals pixels ${P}`)}else b=new Uint8Array(P);if(this.renderer.readRenderTargetPixels(C,0,0,m*g,h*g,b),_){let e=ee/2;for(let t=0,n=0,r=0,i=0;n<e;n++)for(i=(N-Math.floor(n/M)-1)*M+n%M,r=0;r<4;r++)t=b[n*4+r],b[n*4+r]=b[i*4+r],b[i*4+r]=t}return b}getElement(){var e;return(e=this.renderer)==null?void 0:e.domElement}render(e){let t=this.renderer;if(!t)return;let n=t.getRenderTarget();t.setRenderTarget(null);let r=t.autoClear,i=t.autoClearColor,a=t.autoClearDepth,o=t.autoClearStencil,s=Py.copy(t.getClearColor()),c=t.getClearAlpha(),l=t.getViewport(My),u=t.getScissor(Ny),d=t.getScissorTest();t.autoClear=!0,t.autoClearColor=!0,t.autoClearDepth=!0,t.autoClearStencil=!0;let f=t.getSize(Fy),p=Math.floor(f.x*this.viewport.left),m=Math.floor(f.y*this.viewport.bottom),h=Math.floor(f.x*this.viewport.width),g=Math.floor(f.y*this.viewport.height);t.setClearColor(this.backgroundColor,this.backgroundAlpha),t.setViewport(p,m,h,g),t.setScissor(p,m,h,g);let _=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;t.setScissorTest(_);let v=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:v;let y=!0;if(this.controller&&this.controller.render()&&(y=!1),y){let e=this.fiveRenderer.render(t,this.scene,this.modelScene,this.camera,this.needsRender);this.poweredByRealsee&&e&&ly(t)}this.scene.background=v,t.autoClear=r,t.autoClearColor=i,t.autoClearDepth=a,t.autoClearStencil=o,t.setClearColor(s,c),t.setViewport(l),t.setScissor(u),t.setScissorTest(d),t.setRenderTarget(n),e&&si.shared.add(e,!0)}updateTime(e,t,...n){if(this.currentUpdateArgs={time:e,args:n},this.destroyed)return;if(this.renderer&&po.detectSupport(this.renderer),this.syncingState=this.syncState(e,t),this.controller&&this.controller.updateTime(e,t,...n),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){let e=this.modelScene.loaded,t=this.modelScene.refined;this.modelScene.update(this.renderer,this.camera),e===!1&&this.modelScene.loaded===!0&&(this.controller&&this.controller.updateModel(this.modelScene),si.shared.add(()=>{this.emit(`models.load`,Q(`models.load`,{modelScene:this.modelScene}))},!0,0,10)),t===!1&&this.modelScene.refined===!0&&si.shared.add(()=>{this.emit(`models.refined`,Q(`models.refined`,{modelScene:this.modelScene}))},!0,0,10)}if(this.camera.autoNearFar){jy.makeEmpty(),jy.expandByObject(this.modelScene.boundingMesh);let t=jy.getBoundingSphere(Ay),n=t.radius*2;t.containsPoint(this.camera.position)||(n=this.camera.position.distanceTo(t.center)+t.radius),n=U(n,800);let r=n/1e4;r=U(r,.03,.1),this.camera.near!==r&&(this.camera.near=r),this.camera.far!==n&&(this.camera.far=n),this.camera.updateTime(e)}if(this.renderer){let e=this.modelScene.visible;this.modelScene.visible=!1,this.scene.update(this.renderer,this.camera),this.modelScene.visible=e}if(this.syncingState=!1,this.controller&&this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0),this.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.pbmGaussianSplattingRenderMesh&&this.pbmGaussianSplattingRenderMesh.needsRender===!0&&(this.pbmGaussianSplattingRenderMesh.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0),this.paused===!0)return;let r=Q(`render.prepare`,{needsRender:this.needsRender});this.emit(`render.prepare`,r),r.defaultPrevented&&(this.needsRender=!1);let i=this.needsRender;this.render(),this.needsRender=!1,this.emit(`render`,Q(`render`,{needsRender:i})),this.hasListener(`fps`)&&(this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit(`fps`,this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0))}pause(){this.paused=!0,this.renderer&&this.renderer instanceof Ym&&this.renderer.clear(!0,!0,!0)}play(){this.needsRender=!0,this.paused=!1}moveToPano(t,n={},r=!0){let{controller:i,renderer:a}=this;if(!i)return this.throwError(Error(`controller is not initialized.`)),Promise.resolve();if(!a)return this.throwError(Error(`renderer is not initialized.`)),Promise.resolve();typeof t==`number`&&this.pano.workCode&&(t={workCode:this.pano.workCode,panoIndex:t});let o=this.works.getObserver(t);if(!o)return this.throwError(Error(`pano ${JSON.stringify(t)} not existed.`)),Promise.resolve();let s={workCode:o.work.workCode,panoIndex:o.panoIndex};return`moveToPano`in i&&typeof i.moveToPano==`function`?i.moveToPano(s,n,r):o&&(this.pano=s,this.once(`initAnimation.start`,e=>{n.moveStartCallback&&n.moveStartCallback(e.state)}),this.once(`initAnimation.end`,e=>{n.moveEndCallback&&n.moveEndCallback(e.state)}),this.changeMode(e.Mode.Panorama,n,{effect:n.effect},r)),this.ready()}preloadPano(e,t=K){let n=this.works.getObserver(e);if(!n)return Promise.reject(Error(`Pano ${JSON.stringify(e)} never found`));let r=[`right`,`left`,`up`,`down`,`front`,`back`],i=H();return Promise.all(r.map(e=>{let t=Z({panoIndex:n.panoIndex,workCode:n.work.workCode}),r=Object.assign({key:`pano.${t}.${e}`},vr(this.imageOptions,[`size`,`format`,`quality`,`forceUseExifOrientation`,`mappings`])),i=n.work.getURL(n.images[e]),a=this.imageOptions.transform?this.imageOptions.transform(i,r):Xr(i,r);return Cf(this.fiveId,n.work).preload(a)})).then(()=>{let e=H()-i;return t(e),e})}project2d(e,t=!1){if(!this.renderer)return null;if(t){let t=this.camera.position,n=e.clone().sub(t),r=new c.Raycaster(t,n.clone().normalize());r.params.Points={threshold:.1};let[i]=this.modelScene.intersectRaycaster(r);if(i&&i.distance+.01<n.length())return null}let n=e.clone().project(this.camera);if(Math.abs(n.z)>1)return null;let r=this.renderer.getSize(new c.Vector2),i=r.x*this.viewport.width,a=r.y*this.viewport.height,o=r.x*this.viewport.left+(n.x+1)/2*i,s=r.y*(1-this.viewport.bottom-this.viewport.height)+(-n.y+1)/2*a;return new c.Vector2(o,s)}getCurrentState(){return Object.assign(Object.assign({},this.camera.copyPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})}setState(e,t=!1,n=!0){var r,i,a,o,s,l,u,d,f,p;e=vr(e,[`mode`,`workCode`,`panoIndex`,`longitude`,`latitude`,`fov`,`offset`,`distance`]),e.offset&&!(e instanceof c.Vector3)&&(e.offset=new c.Vector3(e.offset.x,e.offset.y,e.offset.z));let m;if(typeof e.panoIndex==`number`)if(e.workCode)m={workCode:e.workCode,panoIndex:e.panoIndex};else{let t=(i=(r=this.work)==null?void 0:r.workCode)==null?``:i,n=this.state.workCode;this.works.filter(e=>e.workCode===n).length>0&&(t=n),m={workCode:t,panoIndex:e.panoIndex}}let h=(a=e.mode)==null?this.state.mode:a,g,_,v,y,b;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==h){if(h===`VRPanorama`){this.changeMode(`VRPanorama`,void 0,void 0,!0);return}let t={workCode:m==null?void 0:m.workCode,panoIndex:m==null?void 0:m.panoIndex};typeof e.longitude==`number`&&(t.longitude=e.longitude),typeof e.latitude==`number`&&(t.latitude=e.latitude),typeof e.fov==`number`&&(t.fov=e.fov),typeof e.distance==`number`&&(t.distance=e.distance),e.offset instanceof c.Vector3&&(t.offset=e.offset);let n=Object.assign(Object.assign({initial:{state:t,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:`fly`,userAction:!1}},this.commonParams()),this.controllerInits[h]),r=Hv[h].initAnimationEndState(n);g=r.longitude,_=r.latitude,v=r.fov,y=r.offset,b=r.distance}else g=(o=e.longitude)==null?this.state.longitude:o,_=(s=e.latitude)==null?this.state.latitude:s,v=(l=e.fov)==null?this.state.fov:l,y=(u=e.offset)==null?this.state.offset:u,b=(d=e.distance)==null?this.state.distance:d;let x={workCode:(m==null?this.pano:m).workCode,panoIndex:(m==null?this.pano:m).panoIndex,mode:h,longitude:g,latitude:_,fov:v,offset:y,distance:b};this.emit(`state.set`,Q(`state.set`,{userAction:n,state:x})),Mh(this.state,x)||(this.controller&&x.mode===`VRPanorama`&&x.mode!==this.state.mode?(jh(this.state,x),this.changeMode(`VRPanorama`)):this.controller&&x.mode===`XRPanorama`&&x.mode!==this.state.mode?(jh(this.state,x),this.changeMode(`XRPanorama`)):(jh(this.state,x),this.controller&&n&&(this.controller.userAction=!1),t&&this.state.mode===x.mode&&(this.syncingState=this.syncState(H(),0,t),this.syncingState&&((f=this.controller)==null||f.updateTime(H(),0),this.syncingState=!1)),this.emit(`state.change`,Q(`state.change`,{userAction:n,state:this.state})),(p=this.analysis)==null||p.state(this.works,this.state)))}syncState(t,n,r=!1){let i=this.stateSynced;if(this.stateSynced=!1,!this.controller)return!1;if(this.state.mode!==this.currentMode){let e={mode:this.state.mode,workCode:this.state.workCode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.changeMode(this.state.mode,e,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof Hv.Model){if(xh(this.camera.pose.offset,this.state.offset)){let e={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,Object.assign(Object.assign({},e),{duration:r?0:void 0}),!1),!0}}else{let e={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!_p(e,this.pano)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`){let t={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(e,t,!1),!0}}if(this.controller instanceof Hv.Floorplan||this.controller instanceof Hv.Topview||this.controller instanceof Hv.Mapview){let e=.2,t=Math.PI/45,n=r?this.state.fov:bm(this.camera.pose.fov,this.state.fov,1),i=Math.abs(this.camera.pose.distance-this.state.distance),a=i>e*15?i/15:.2,o=r?this.state.distance:bm(this.camera.pose.distance,this.state.distance,a),s=this.camera.pose.offset.distanceTo(this.state.offset),l=s>e*15?s/15:e,u=r?new c.Vector3().copy(this.state.offset):xm(this.camera.pose.offset,this.state.offset,l),{longitude:d,latitude:f}=r?{longitude:this.state.longitude,latitude:this.state.latitude}:Sm({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},t);if(yh(n,this.camera.pose.fov)||xh(u,this.camera.pose.offset)||yh(o,this.camera.pose.distance)||yh(d,this.camera.pose.longitude,Math.PI*2)||yh(f,this.camera.pose.latitude)){let e={x:u.x,y:u.y,z:u.z},t={fov:n};return Object.assign(e,{distance:o}),Object.assign(t,{longitude:d,latitude:f}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(t,0).catch(K),this.controller.locationMotion.set(e,0).catch(K),!0}}else{let e=Math.PI/45,t=r?this.state.fov:bm(this.camera.pose.fov,this.state.fov,1),{longitude:n,latitude:i}=r?{longitude:this.state.longitude,latitude:this.state.latitude}:Sm({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},e),a=this.state.distance,o=new c.Vector3().copy(this.state.offset);if(yh(a,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),xh(o,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),yh(n,this.camera.pose.longitude,Math.PI*2)||yh(i,this.camera.pose.latitude)||yh(t,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:n,latitude:i,fov:t},0).catch(K),!0}if(this.stateSynced=!0,i===!1&&this.emit(`state.synced`,Q(`state.synced`,{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){let t=this.currentMode;if(!(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)||this.modelScene.loaded){let e=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(let t of e)this.controller instanceof Hv.Panorama&&t.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(t):t()}}return!1}ready(e={}){return new Promise(t=>{var n;this.readyCallbacks.push(Object.assign(t,{tile:(n=e.tile)==null?!1:n}))}).then(()=>this.model.initReady).then(K)}requestFullscreen(){var e;if(!Th)return;let t=(e=this.getElement())==null?void 0:e.parentNode;t&&`requestFullscreen`in t&&typeof document<`u`&&document.fullscreenElement===null&&t.requestFullscreen()}exitFullscreen(){typeof document<`u`&&document.fullscreenElement&&`exitFullscreen`in document&&document.exitFullscreen()}throwError(e){this.hasListener(`error`)?this.emit(`error`,e):console.error(e)}bindModel(e){let t=()=>{si.shared.add(()=>{this.emit(`model.load`,Q(`model.load`,{work:e.work,model:e,error:null}))},!0)},n=t=>{let{error:n}=t;this.emit(`model.error`,Q(`model.error`,{work:e.work,model:e,error:n})),this.throwError(n)},r=()=>{this.emit(`model.changeShownFloor`,Q(`model.changeShownFloor`,{work:e.work,model:e,error:null}))},i=t=>{this.emit(`models.tileLoad`,Q(`model.tileLoad`,{work:e.work,model:e,tile:t.tile}))},a=t=>{this.emit(`models.tileUnload`,Q(`model.tileUnload`,{work:e.work,model:e,tile:t.tile}))},o=()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),e.removeEventListener(`changeShownFloor`,r),e.removeEventListener(`tileLoad`,i),e.removeEventListener(`tileUnload`,a),e.removeEventListener(`dispose`,o)};e.addEventListener(`load`,t),e.addEventListener(`error`,n),e.addEventListener(`changeShownFloor`,r),e.addEventListener(`tileLoad`,i),e.addEventListener(`tileUnload`,a),e.addEventListener(`dispose`,o),this.emit(`model.request`,Q(`model.request`,{work:e.work,model:e,error:null}))}bindWorkFetcher(e){let t=this,n=e.workCode,r=e.allowHosts,i=new gr({get networkSubscribe(){return t.networkSubscribe},requestProxy(e){return Promise.resolve(e).then(e=>t.requestProxy(e,n)).then(e=>{let t=Bp(e,r);return t instanceof Error?Promise.reject(t):t})}});wf(this.fiveId,e,i)}commonParams(){return{fiveId:this.fiveId,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,camera:this.camera,renderer:this.renderer,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}}applyController(t,n){if(!this.renderer)throw Error(`renderer is not initialized.`);let r=Hv[t];this.currentMode=t;let i=new r(n);for(let e of Wv)i.on(e,(...t)=>{if(this.emit(e,...t))return!1});{let e=Hv[t].initAnimationEndState(n),r=n.initial.userAction;Mh(this.state,e)||(jh(this.state,e),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state}))),this.emit(`currentState.change`,Q(`currentState.change`,{userAction:r,state:this.getCurrentState()}))}return i.on(`camera.update`,e=>{var t;if(this.controller){let n=this.controller.getTargetState();e.userAction&&this.syncingState===!1&&this.state.mode===n.mode&&!Mh(this.state,n)&&(jh(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:e.userAction,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}this.emit(`currentState.change`,Q(`currentState.change`,{userAction:e.userAction,state:this.getCurrentState()}))}),i.on(`initAnimation.start`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!Mh(this.state,n)&&(jh(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`initAnimation.end`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!Mh(this.state,n)&&(jh(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.moveTo`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!Mh(this.state,n)&&(jh(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.arrived`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!Mh(this.state,n)&&(jh(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.cancel`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!Mh(this.state,n)&&(jh(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.error`,e=>{var t;let{state:n}=e;this.state.mode===n.mode&&!Mh(this.state,n)&&(jh(this.state,n),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.moveTo`,e=>{let{userAction:t}=e;this.emit(`currentState.change`,Q(`currentState.change`,{userAction:t,state:this.getCurrentState()}))}),i.on(`pano.request`,e=>{this.emit(`pano.request`,e),e.defaultPrevented||this.moveToPano(e.state,e.options,e.userAction)}),i.on(`vr.requestExit`,()=>{this.currentMode===e.Mode.VRPanorama&&(this.exitFullscreen(),this.changeMode(e.Mode.Panorama))}),i.on(`error`,e=>this.throwError(e)),i}removeEventListeners(){}get internalLightsEnabled(){let e=this.scene.children.find(e=>e.name===`internalLights`);return e?e.visible:!1}set internalLightsEnabled(e){let t=this.scene.children.find(e=>e.name===`internalLights`);t&&(t.visible=e),t=this.modelScene.children.find(e=>e.name===`internalLights`),t&&(t.visible=e)}get scissor(){return this.viewport}setScissor(e){return this.setViewport(e)}getPose(){let{longitude:e,latitude:t,fov:n,offset:r,distance:i}=this.camera.copyPose();return{longitude:e,latitude:t,fov:n,offset:r.clone(),distance:i}}getLongitudeAndLatitude(){let{longitude:e,latitude:t}=this.getPose();return{longitude:e,latitude:t}}getOffset(){return this.getPose().offset}getCameraLocal(){if(this.pano.workCode&&this.controller&&this.works){let e=this.works.getObserver(this.pano);if(e){let t=new c.Object3D;t.matrix.copy(e.matrix).premultiply(e.work.transform),t.matrix.decompose(t.position,t.quaternion,t.scale),t.matrixAutoUpdate=!1;let n=new c.Vector3(0,0,-1);n.applyQuaternion(this.camera.quaternion);let r=t.quaternion.clone().inverse();return n.applyQuaternion(r),{theta:Math.atan2(n.x,-n.z),phi:-Math.asin(n.y),lookAtVector:n}}}return null}addPass(e){this.fiveRenderer.composer.addPass(e)}removePass(e){let t=this.fiveRenderer.composer.passes.indexOf(e);t!==-1&&this.fiveRenderer.composer.passes.splice(t,1)}insertPass(e,t){this.fiveRenderer.composer.insertPass(e,t)}get renderMode(){return this.fiveRenderer.renderMode}set renderMode(e){this.fiveRenderer.renderMode=e}get enableHQ(){return this.fiveRenderer.renderMode===`point-cloud-high-quality`}set enableHQ(e){this.fiveRenderer.renderMode=e?`point-cloud-high-quality`:`default`,this.needsRender=!0}get enableEDL(){return this.eyeDomeLightingPass.enabled}set enableEDL(e){this.eyeDomeLightingPass.enabled=e,this.needsRender=!0}get enableAdaptiveLuminance(){return this.adaptiveLuminancePass.enabled}set enableAdaptiveLuminance(e){this.adaptiveLuminancePass.enabled=e,this.needsRender=!0}get enableIOSEDR(){return!1}set enableIOSEDR(e){}get enablePostProcessing(){return!0}set enablePostProcessing(e){}get modelSceneNeedsRender(){return this.modelScene.needsRender}set modelSceneNeedsRender(e){this.modelScene.needsRender=e}};zy.Mode={Panorama:`Panorama`,Model:`Model`,Floorplan:`Floorplan`,Topview:`Topview`,Mapview:`Mapview`,VRPanorama:`VRPanorama`,XRPanorama:`XRPanorama`},typeof window<`u`&&Object.assign(window,{__FIVE_DEBUG__:{THREE:c,constructor:zy,instances:Ry}});var By=class{static createButton(e){let t=document.createElement(`button`);function n(){t.style.display=``,t.style.cursor=`pointer`,t.style.left=`calc(50% - 50px)`,t.style.width=`100px`,t.textContent=`ENTER VR`,t.onmouseenter=function(){t.style.opacity=`1.0`},t.onmouseleave=function(){t.style.opacity=`0.5`},t.onclick=function(){e&&e()}}function r(){t.style.display=``,t.style.cursor=`auto`,t.style.left=`calc(50% - 75px)`,t.style.width=`150px`,t.onmouseenter=null,t.onmouseleave=null,t.onclick=null}function i(){r(),t.textContent=`VR NOT SUPPORTED`}function a(e){e.style.position=`absolute`,e.style.bottom=`20px`,e.style.padding=`12px 6px`,e.style.border=`1px solid #fff`,e.style.borderRadius=`4px`,e.style.background=`rgba(0,0,0,0.1)`,e.style.color=`#fff`,e.style.font=`normal 13px sans-serif`,e.style.textAlign=`center`,e.style.opacity=`0.5`,e.style.outline=`none`,e.style.zIndex=`999`}if(`xr`in navigator)return t.id=`VRButton`,t.style.display=`none`,a(t),navigator.xr.isSessionSupported(`immersive-vr`).then(function(e){e?n():i()}),t;{let e=document.createElement(`a`);return window.isSecureContext===!1?(e.href=document.location.href.replace(/^http:/,`https:`),e.innerHTML=`WEBXR NEEDS HTTPS`):(e.href=`https://immersiveweb.dev/`,e.innerHTML=`WEBXR NOT AVAILABLE`),e.style.left=`calc(50% - 90px)`,e.style.width=`180px`,e.style.textDecoration=`none`,a(e),e}}};exports.AdaptiveLuminancePass=Dm,exports.AnimationFrameLoop=si,exports.BoundingMesh=Zf,exports.Camera=tn,exports.CustomShader=dn,exports.PBMCustomShader=dn,exports.EffectComposer=rm,exports.EyeDomeLightingPass=Am,exports.Fetcher=gr,exports.Five=zy,exports.FivePass=am,exports.FiveRenderer=Jm,exports.FullScreenQuad=im,exports.Histogram=_m,exports.InternalWebGLRenderer=Ym,exports.Model=Hf,exports.ModelScene=$f,exports.Motion=X,exports.NetworkSubscribe=dr,exports.PBMContainer=Xn,exports.PBMGSObject=$n,exports.PBMGroup=wt,exports.PBMMesh=bn,exports.PBMMeshMaterial=yn,exports.PBMPanoFilter=fn,exports.PBMPointCloud=An,exports.PBMPointCloudMaterial=kn,exports.PBMSkinnedMesh=xn,exports.PBMUpdateable=un,exports.PROXY_CONTROLLER_EVENT_NAMES=Wv,exports.PanoCircleMesh=sh,exports.PanoCircleMeshCustom=_h,exports.PanoCircleMeshSolid=fh,exports.Parameter=G,exports.Scene=nh,exports.Subscribe=ln,exports.TextureLoader=yi,exports.Tile=Ll,exports.Tile3D=xf,exports.Tile3DModel=xf,exports.TileCache=ld,exports.TileNode=Qu,exports.TileRequestScheduler=od,exports.Tileset=hd,exports.Trajectory=nd,exports.TrajectoryNode=rd,exports.Work=Qp,exports.WorkResolvedObserver=tm,exports.XRButton=By,exports.controllersDefaultInitArgs=Uv,exports.coordinatesToVector=Ht,exports.createDebugBoundingMesh=Ml,exports.createWorks=nm,exports.defaultImageURLTransform=Xr,exports.draco=io,exports.getViewportScale=Yv,exports.headingToLongitude=Gt,exports.imageSupport=Nr,exports.isBoundingVolume=Dl,exports.isPanoId=vp,exports.ktx2=po,exports.loadAt3d=ia,exports.loadB3dm=ls,exports.loadDome=ca,exports.loadDomez=ha,exports.loadFbx=wc,exports.loadGltf=vs,exports.loadPbm=Ii,exports.loadPly=bs,exports.loadPnts=gs,exports.loadSplat=sl,exports.loadSpz=is,exports.loadX3p=il,exports.longitudeToHeading=Wt,exports.makeBoundingVolume=Ol,exports.panoEqual=_p,exports.panoParse=gp,exports.panoStringify=Z,exports.parseWork=$p,exports.vectorToCoordinates=Ut,exports.workToJson=ip;
2327
+ Atj 6\\0 \\0Aj!\\0\\f\\v\\v Aj! \\x07!\\0 !\\x07\\f \\b   \\0Atj(\\0Atj(\\0 vAÿqAtj" (\\0Aj6\\0 \\0Aj!\\0\\f\\v\\0\\v\\0\\v\\0\\v\\0\\v\\v \\0A\\b\\v\`)}function _(e){return e}function v(e,t){var n,r=_(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function y(){return{a:P}}function b(){function e(e,t){return I=e.exports,N(I),d(),I}var t=y();return n.instantiateWasm?new Promise((r,i)=>{n.instantiateWasm(t,(t,n)=>{r(e(t,n))})}):(h??=g(),e(v(h,t)[0]))}for(var x=e=>{for(;e.length>0;)e.shift()(n)},S=[],C=e=>S.push(e),w=[],T=e=>w.push(e),E=()=>2147483648,D=(e,t)=>Math.ceil(e/t)*t,O=e=>{var t=(e-M.buffer.byteLength+65535)/65536|0;try{return M.grow(t),d(),1}catch{}},k=e=>{var t=l.length;e>>>=0;var n=E();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),O(Math.min(n,D(Math.max(e,i),65536))))return!0}return!1},A=new Uint8Array(123),j=25;j>=0;--j)A[48+j]=52+j,A[65+j]=j,A[97+j]=26+j;if(A[43]=62,A[47]=63,n.noExitRuntime&&n.noExitRuntime,n.print&&n.print,n.printErr&&n.printErr,n.wasmBinary&&n.wasmBinary,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.preInit)for(typeof n.preInit==\`function\`&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.shift()();var M;function N(e){n._sort=e.d,n._malloc=e.e,n._free=e.f,M=e.b,e.__indirect_function_table}var P={a:k};function F(){f();function e(){n.calledRun=!0,!o&&(p(),c?.(n),n.onRuntimeInitialized?.(),m())}n.setStatus?(n.setStatus(\`Running...\`),setTimeout(()=>{setTimeout(()=>n.setStatus(\`\`),1),e()},1)):e()}var I=b();return F(),t=u?n:new Promise((e,t)=>{c=e}),t}let n;function r(){return e(this,void 0,void 0,function*(){n=yield t()})}let i,a,o,s,c,l,u,d,f,p=0,m=0,h=[],g=!0,_=!1,v=!1,y=!1,b=()=>e(void 0,void 0,void 0,function*(){if(_){v=!0;return}_=!0,v=!1,n||(yield r());let e=2**Math.ceil(Math.log2(i.vertexCount));p<e&&(p>0&&(n._free(a),n._free(s),n._free(c),n._free(l),n._free(u),n._free(d),n._free(f)),p=e,a=n._malloc(64),s=n._malloc(p*4),c=n._malloc(3*p*4),l=n._malloc(p*4),u=n._malloc(p*4),d=n._malloc(p*4),f=n._malloc(p*4)),m<i.transforms.length&&(m>0&&n._free(o),m=i.transforms.length,o=n._malloc(m*4)),_=!1,v&&(v=!1,yield b())}),x=()=>{if(_||v||!n)return;_=!0,n.HEAPF32.set(i.positions,c/4),n.HEAPF32.set(i.transforms,o/4),n.HEAPU32.set(i.transformIndices,s/4),n.HEAPF32.set(new Float32Array(h),a/4),n._sort(a,o,s,i.vertexCount,c,l,u,d,f);let e=new Uint32Array(n.HEAPU32.buffer,u,i.vertexCount),t=new Uint32Array(e.slice().buffer);self.postMessage({depthIndex:t,generation:i.generation},[t.buffer]),_=!1,g=!1},S=()=>{y||(y=!0,g&&x(),setTimeout(()=>{y=!1,S()}))};self.onmessage=e=>new Promise(t=>{if(e.data.warmup){r().finally(()=>t(!0));return}e.data.sortData&&(i={positions:new Float32Array(e.data.sortData.positions),transforms:new Float32Array(e.data.sortData.transforms),transformIndices:new Uint32Array(e.data.sortData.transformIndices),vertexCount:e.data.sortData.vertexCount,generation:e.data.sortData.generation??0},g=!0,b()),e.data.viewProj?(e.data.viewProj.every(e=>h.includes(e))===!1&&(h=e.data.viewProj,g=!0),S(),t(!0)):t(!0)})})();`,wy=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,Cy],{type:`text/javascript;charset=utf-8`});function Ty(e){let t;try{if(t=wy&&(self.URL||self.webkitURL).createObjectURL(wy),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(Cy),{name:e==null?void 0:e.name})}}var Ey=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}("}rpvv|{-uvtu}-sy|nH}rpvv|{-uvtu}-v{Hnvor-sy|n-}ynV{qr\x07H{vs|z-uvtu}-nz}yr?Q-lr\x07rH{vs|z-uvtu}-nz}yr?Q-ln{s|zH{vs|z-uvtu}-nz}yr?Q-ln{s|zV{qvprH{vs|z-uvtu}-nz}yr?Q-lyn\brV{qvprH{vs|z-uvtu}-nz}yr?Q-luar\x07rH{vs|z-rp?-luar\x07r`v rH{vs|z-v{-lzn\x07`uQrtrrH0vs-[bZlT`lPYV]]R_`-K-=----{vs|z-rp?-lyn\brPyv}}r_n{trh[bZlT`lYNfR_`jH----{vs|z-znA-lpyv}}rZnvprV{rrh[bZlT`lPYV]]R_`jH0r{qvs{vs|z-rp?-r|yv|{H{vs|z-o||y-lnttrtnv|{R{noyrqH{vs|z-sy|n-lnttrtnv|{]|trH-------<<-整个动画的归一化进度-h=9->j{vs|z-sy|n-lnttrtnv|{]|v{Qnv|{H--<<-每个点的固定聚合时长(归一化到总时长,可调试){vs|z-rp@-lnttrtnv|{O|{qZv{H{vs|z-rp@-lnttrtnv|{O|{qZn\x07Hn\bv{t-rpA-P|y|Hn\bv{t-rp?-]|vv|{Hn\bv{t-rp?-bH<<参考Tnvn{`}yn@qp|{-sy|n-\0E-J-\05E;=6H<<原版的固定xr{ry`v r,不要轻易调整这个数p|{-sy|n-xr{ry?Q`v r-J-=;@Hp|{-sy|n-zn\x07`prr{`}npr`}yn`v r-J-?=AE;=H<<固定的u相关系数p|{-sy|n-`UlP>-J-=;AEEC=?B>>F=?F>FFHp|{-sy|n-`UlP?l=-J->;=F?BAEAHp|{-sy|n-`UlP?l>-J-:>;=F?BAEAHp|{-sy|n-`UlP?l?-J-=;@>B@F>CHp|{-sy|n-`UlP?l@-J-:>;=F?BAEAHp|{-sy|n-`UlP?lA-J-=;BAC?DA?Hrp?-tr`UQnnbc5v{-}ynVq\x079-v{-p|z}|{r{\\ssr9-rp?-r\x07r`v r6-\n----v{-uP|z}|{r{P|{-J-=H----vs-5lzn\x07`uQrtrr-KJ->6-uP|z}|{r{P|{-8J-FH----vs-5lzn\x07`uQrtrr-KJ-?6-uP|z}|{r{P|{-8J->BH----vs-5lzn\x07`uQrtrr-KJ-@6-uP|z}|{r{P|{-8J-?>H--------v{-}nqqrqP|z}|{r{P|{-J-uP|z}|{r{P|{H----vs-5}nqqrqP|z}|{r{P|{-2-A-.J-=6-\n--------}nqqrqP|z}|{r{P|{-J-55}nqqrqP|z}|{r{P|{-<-A6-8->6-7-AH----\f--------sy|n-yv{rnP|z}|{r{V{qr\x07-J-sy|n5}ynVq\x07-7-}nqqrqP|z}|{r{P|{-8-p|z}|{r{\\ssr6H----sy|n-r\x07ryV{qr\x07-J-yv{rnP|z}|{r{V{qr\x07-<-A;=H------sy|n-q-J-r\x07ryV{qr\x07-<-r\x07r`v r;\x07H----sy|n-\b-J-sy||5q6-<-r\x07r`v r;\bH----sy|n-\x07-J-snp5q6H----r{-rp?5\x079-\b6H\f|vq-znv{-56-\n----v{-}ynV{qr\x07b-J-v{5}ynV{qr\x07-8-=;B6H----v{-}ynV{qr\x07V-J-v{5}ynV{qr\x07b6H----rpA-pr{-J-r\x07rySrpu5lr\x07r9-vrp?55}ynV{qr\x07b-3-=\x07@ss6-II->9-}ynV{qr\x07b-KK->=69-=6H--------v{-n{s|zV{qr\x07-J-r\x07rySrpu5ln{s|zV{qvpr9-vrp?5}ynV{qr\x07b-3-=\x07@ss9-}ynV{qr\x07b-KK->=69-=6;\x07H----znA-n{s|z-J-znA5--------r\x07rySrpu5ln{s|z9-vrp?5=9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5>9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5?9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5@9-n{s|zV{qr\x0769-=6----6H----znA-n{s|zZ|qrycvrZnv\x07-J-vrZnv\x07-7-n{s|zH----rp@-}ynPr{r-J-v{Ova|Sy|n5pr{;\x07\b 6H----rpA-|yqPr{r-J-n{s|z-7-rpA5}ynPr{r9->;=6H----<<-JJJ-聚合特效-JJJ----sy|n-y|pny]|tr-J-lnttrtnv|{]|trH----sy|n-pnyr]|tr-J-=;=H----o||y-v{O|{qS|Nttrtnv|{-J-snyrH----vs-5lnttrtnv|{R{noyrq-33-lnttrtnv|{]|tr-I->;=6-\n--------o||y-v{O|{q-J-|yqPr{r;\x07-KJ-lnttrtnv|{O|{qZv{;\x07---------------------33-|yqPr{r;\x07-IJ-lnttrtnv|{O|{qZn\x07;\x07---------------------33-|yqPr{r; -KJ-lnttrtnv|{O|{qZv{; ---------------------33-|yqPr{r; -IJ-lnttrtnv|{O|{qZn\x07; H--------vs-5v{O|{q6-\n------------v{O|{qS|Nttrtnv|{-J-rH------------<<-归一化高度-h=9>j,>J最高,=J最低------------sy|n-urvtu_n{tr-J-lnttrtnv|{O|{qZn\x07;\b-:-lnttrtnv|{O|{qZv{;\bH------------sy|n-{|znyv rqUrvtu-J-urvtu_n{tr-K-=;==>----------------L-pynz}55|yqPr{r;\b-:-lnttrtnv|{O|{qZv{;\b6-<-urvtu_n{tr9-=;=9->;=6----------------G-=;BH------------<<-lnttrtnv|{]|v{Qnv|{G-每个点的固定聚合时长(归一化,占总时长的比例)------------<<-最高处5{|znyv rqUrvtuJ>6G-navzrJ=9-r{qavzrJ}|v{Q------------<<-最低处5{|znyv rqUrvtuJ=6G-navzrJ>:}|v{Q9-r{qavzrJ>------------<<-保证最底部的点在总动画结束时刚好聚合完毕------------sy|n-}|v{Q-J-pynz}5lnttrtnv|{]|v{Qnv|{9-=;=>9->;=6H------------sy|n-navzr-J-5>;=-:-{|znyv rqUrvtu6-7-5>;=-:-}|v{Q6H------------y|pny]|tr-J-pynz}55lnttrtnv|{]|tr-:-navzr6-<-}|v{Q9-=;=9->;=6H------------<<-聚合|ssr曲线:先加速后减速(rnr:v{:|)------------sy|n-|ssr]|tr-J-z||ur}5=;=9->;=9-y|pny]|tr6H------------<<-pnyr曲线:缓慢加速,加速度越来越大(rnr:v{-三次方)------------pnyr]|tr-J-y|pny]|tr-7-y|pny]|tr-7-y|pny]|tr-H------------rp@-nttrtnv|{Pr{r-J-5lnttrtnv|{O|{qZv{-8-lnttrtnv|{O|{qZn\x076-<-?;=H------------rp@-qv-J-|yqPr{r;\x07\b -:-nttrtnv|{Pr{rH------------sy|n-qv-J-yr{tu5qv6H------------<<-基于-}ynPr{r-的伪随机距离-8-v{<p|-螺旋方向------------sy|n-n{q`rrq-J-q|5}ynPr{r9-rp@5>?;FEFE9-DE;?@@9-AB;>CA66H------------sy|n-n{qQv-J-snp5v{5n{q`rrq6-7-A@DBE;BAB@6H------------sy|n-n{tyr-J-n{q`rrq-7->=;=H------------rp@-pnrQv-J-{|znyv r5rp@5----------------p|5n{tyr69----------------zv\x075:=;D9-=;>9-snp5v{5n{q`rrq-7->;D6-7-A@DBE;BAB@669----------------v{5n{tyr6------------66H------------sy|n-r\x07}y|v|{Snp|-J-5>;=-:-|ssr]|tr6-7-5>;=-8->;=-7-n{qQv6H------------rp@-|ssr-J-pnrQv-7-qv-7-r\x07}y|v|{Snp|H------------|yqPr{r;\x07\b -8J-|ssrH------------}ynPr{r-J-5v{rr5n{s|z6-7-|yqPr{r6;\x07\b H--------\f----\f----0vs-[bZlT`lPYV]]R_`-K-=----v{-yn\brV{qr\x07-J-v{5r\x07rySrpu5lyn\brV{qvpr9-vrp?5}ynV{qr\x07b-3-=\x07@ss9-}ynV{qr\x07b-KK->=69-=6;\x076H----vs-5yn\brV{qr\x07-KJ-=-33-yn\brV{qr\x07-I-[bZlT`lYNfR_`6-\n--------rp?-pyv}_n{tr-J-lyn\brPyv}}r_n{trhyn\brV{qr\x07jH--------v{-pyv}`n-J-v{5pyv}_n{tr;\x07-8-=;B6H--------v{-pyv}P|{-J-v{5pyv}_n{tr;\b-8-=;B6H--------v{-pyv}R{q-J-pyv}`n-8-pyv}P|{H--------s|-5v{-v-J-=H-v-I-[bZlT`lPYV]]R_`H-v886-\n----------------vs-5v-I-pyv}`n-\v\v-v-KJ-pyv}R{q6-\n--------------------p|{v{rH----------------\f----------------rpA-pyv}}r]|vv|{-J-lpyv}}rZnvprV{rrhvj-7-|yqPr{rH----------------o||y-pyv}}rq-J-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH----------------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH----------------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH----------------vs-5pyv}}rq6-\n--------------------tyl]|vv|{-J-rpA5=;=9-=;=9-?;=9->;=6H--------------------r{H----------------\f--------\f----\f----0r{qvs----rpA-vrPr{r-J-n{s|zZ|qrycvrZnv\x07-7-rpA5}ynPr{r9->;=6H----rpA-pyv}Pr{r-J-}|wrpv|{Znv\x07-7-vrPr{rH----<<剔除超出视锥体的}yn----sy|n-pyv}-J->;?-7-pyv}Pr{r;H----vs-5pyv}Pr{r; -I-:pyv}Pr{r;-\v\v-pyv}Pr{r; -K-pyv}Pr{r;-\v\v---------pyv}Pr{r;\x07-I-:pyv}-\v\v-pyv}Pr{r;\x07-K-pyv}-\v\v---------pyv}Pr{r;\b-I-:pyv}-\v\v-pyv}Pr{r;\b-K-pyv}6-\n--------tyl]|vv|{-J-rpA5=;=9-=;=9-?;=9->;=6H--------r{H----\f----rp@-{qpPr{r-J-pyv}Pr{r;\x07\b -<-pyv}Pr{r;H----rp?-s|pny-J-rp?5--------}|wrpv|{Znv\x07h=jh=j-7-r|yv|{;\x07-7-=;B9--------}|wrpv|{Znv\x07h>jh>j-7-r|yv|{;\b-7-=;B----6H--------]|vv|{-J-}|vv|{;\x07\bH----<<-读取协方差数据(使用-unys?\x07>C-打包)----rpA-p|-J-r\x07rySrpu5lr\x07r9-vrp?555}ynV{qr\x07b-3-=\x07@ss6-II->6-\v->9-}ynV{qr\x07b-KK->=69-=6H----rp?->-J-{}npxUnys?\x07>C5p|;\x076H-----rp?-?-J-{}npxUnys?\x07>C5p|;\b6H------rp?-@-J-{}npxUnys?\x07>C5p|; 6H----------sy|n-Z>>-J->;\x07-<-A;=H----sy|n-Z>?-J->;\b-<-A;=H----sy|n-Z>@-J-?;\x07-<-A;=H----sy|n-Z??-J-?;\b-<-A;=H----sy|n-Z?@-J-@;\x07-<-A;=H----sy|n-Z@@-J-@;\b-<-A;=H--------zn@-cx-J-zn@5--------Z>>9-Z>?9-Z>@9--------Z>?9-Z??9-Z?@9----------Z>@9-Z?@9-Z@@-------6H----<<-判断是否是正交模式:透视时-}|wrpv|{Znv\x07h@jh@j-J-=,正交时-J->----o||y-v\\u|tn}uvp-J-}|wrpv|{Znv\x07h@jh@j-K-=;DH----sy|n-n{vznv|{]|tr-J--}|wrpv|{Znv\x07h@jh@jH----zn@-WH----vs-5v\\u|tn}uvp6-\n--------<<-正交模式的雅可比矩阵--------W-J-n{}|r5zn@5------------s|pny;\x079-=;=9-=;=9------------=;=9-s|pny;\b9-=;=9------------=;=9-=;=9-=;=--------66H----\f-ryr-\n--------<<-透视模式的雅可比矩阵--------sy|n--J->;=-<-5vrPr{r; -7-vrPr{r; 6H--------W-J-zn@5------------s|pny;\x07-<-vrPr{r; 9-=;=9-:5s|pny;\x07-7-vrPr{r;\x076-7-9------------=;=9-s|pny;\b-<-vrPr{r; 9-:5s|pny;\b-7-vrPr{r;\b6-7-9------------=;=9-=;=9-=;=--------6H----\f----zn@-d-J-n{}|r5zn@5n{s|zZ|qrycvrZnv\x0766H----zn@-a-J-d-7-WH----<<-将-@Q-协方差矩阵变换为-?Q-协方差矩阵----zn@-p|?Qz-J-n{}|r5a6-7-cx-7-aH----p|?Qzh=jh=j-8J-xr{ry?Q`v rH----p|?Qzh>jh>j-8J-xr{ry?Q`v rH----rp@-p|?Q-J-rp@5p|?Qzh=jh=j9-p|?Qzh=jh>j9-p|?Qzh>jh>j6H----sy|n-n-J-p|?Q;\x07H----sy|n-q-J-p|?Q; H----sy|n-o-J-p|?Q;\bH----sy|n-Q-J-n-7-q-:-o-7-oH----sy|n-npr-J-n-8-qH----sy|n-npr\\r?-J-=;B-7-nprH----sy|n-rz?-J-\05zn\x075=;>9-npr\\r?-7-npr\\r?-:-Q66H----sy|n-rvtr{cnyr>-J-npr\\r?-8-rz?H----sy|n-rvtr{cnyr?-J-npr\\r?-:-rz?H----vs-5rvtr{cnyr?-IJ-=;=6-\n--------r{H----\f----rp?-rvtr{crp|>-J-{|znyv r5rp?5o9-rvtr{cnyr>-:-n66H----rp?-rvtr{crp|?-J-rp?5rvtr{crp|>;\b9-:rvtr{crp|>;\x076H----rp?-onvcrp|>-J-rvtr{crp|>--7-zv{5\0E-7-\05rvtr{cnyr>69-zn\x07`prr{`}npr`}yn`v r6H----rp?-onvcrp|?-J-rvtr{crp|?--7-zv{5\0E-7-\05rvtr{cnyr?69-zn\x07`prr{`}npr`}yn`v r6H----rp?-onvcvr}|-J-rp?5>;=-<-r|yv|{;\x079->;=-<-r|yv|{;\b6H----rp?-{qp\\ssr-J-rp?5]|vv|{;\x07-7-onvcrp|>-8-]|vv|{;\b-7-onvcrp|?6-7---------------------onvcvr}|-7-?;=H----<<-JJJ-点云→@QT`-过渡-JJJ----vs-5lnttrtnv|{R{noyrq6-\n--------sy|n-sv{ny`pnyr]|tr-J-v{O|{qS|Nttrtnv|{-L-pnyr]|tr-G-5lnttrtnv|{]|tr-7-lnttrtnv|{]|tr-7-lnttrtnv|{]|tr6H--------{qp\\ssr-7J-zv\x075=;>9->;=9-sv{ny`pnyr]|tr6H----\f----rpA-\0nq]|-J-rpA5{qpPr{r;\x07\b-8-{qp\\ssr9-{qpPr{r; 9->;=6H----tyl]|vv|{-J-\0nq]|H----<<-读取颜色----rpA-p|y|-J-rpA5--------5p|;6-3-=\x07ss9--------5p|;-KK-E6-3-=\x07ss9--------5p|;-KK->C6-3-=\x07ss9--------5p|;-KK-?A6-3-=\x07ss----6-<-?BB;=H----<<应用球谐光照,目前只兼容=>?----vs-5lzn\x07`uQrtrr-KJ->6-\n--------rp@-pnzrn]|V{\\owrp-J-rp@5v{rr5n{s|z6-7-rpA5pnzrn]|vv|{9->;=66H--------rp@-|owrpcvrQv-J-{|znyv r5}ynPr{r-:-pnzrn]|V{\\owrp6H----------------rpA-u=>?@-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9-=9-luar\x07r`v r66H----------rpA-uABCD-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9-A9-luar\x07r`v r66H----------rpA-uEF>=>>-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9-E9-luar\x07r`v r66H-----------------rp@-u>-J-u=>?@;toH-----------------------------------rp@-u?-J-rp@5u=>?@;n9-uABCD;t6H---------------------rp@-u@-J-rp@5uABCD;on9-uEF>=>>;6H-----------------------------sy|n-\x07-J-|owrpcvrQv;\x07H--------sy|n-\b-J-|owrpcvrQv;\bH--------sy|n- -J-|owrpcvrQv; H--------rp@-uP|y|-J-u>-7-5:=;AEEC=?B-7-\b6-8-u?-7-5=;AEEC=?B-7- 6-8-u@-7-5:=;AEEC=?B-7-\x076H--------p|y|;to-8J-uP|y|H----------------vs-5lzn\x07`uQrtrr-KJ-?6-\n----------------------rpA-u>?>@>A>B-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9->?9-luar\x07r`v r66H------------rpA-u>C>D>E>F-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9->C9-luar\x07r`v r66H-------------rpA-u?=?>???@-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9-?=9-luar\x07r`v r66H-------------------------rp@-uA-J-uEF>=>>;tonH------------------------------------rp@-uB-J-u>?>@>A>B;toH----------------------------------rp@-uC-J-rp@5u>?>@>A>B;n9-u>C>D>E>F;t6H---------------rp@-uD-J-rp@5u>C>D>E>F;on9-u?=?>???@;6H---------------rp@-uElqrt?-J-u?=?>???@;tonH-----------------------------------------sy|n-\x07\x07-J-\x07-7-\x07H------------sy|n-\b\b-J-\b-7-\bH------------sy|n- -J- -7- H------------sy|n-\x07\b-J-\x07-7-\bH------------sy|n-\b -J-\b-7- H------------sy|n-\x07 -J-\x07-7- H------------------------p|y|;to-8J----------------5`UlP?l=-7-\x07\b6-7-uA-8----------------5`UlP?l>-7-\b 6-7-uB-8----------------5`UlP?l?-7-5?;=-7- -:-\x07\x07-:-\b\b66-7-uC-8----------------5`UlP?l@-7-\x07 6-7-uD-8----------------5`UlP?lA-7-5\x07\x07-:-\b\b66-7-uElqrt?H--------\f----\f--------p|y|;to-J-pynz}5p|y|;to9-rp@5=;=69-rp@5>;=66H----P|y|-J-p|y|H----]|vv|{-7J-\0EH----b-J-}|vv|{;\x07\bH\f"),Dy=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}(`}rpvv|{-uvtu}-sy|nH0v{pyqr-Ip|zz|{Kn\bv{t-rpA-P|y|Hn\bv{t-rp?-]|vv|{Hn\bv{t-rp?-bH|vq-znv{-56-
2328
+ ----<<-计算从-}yn-中心到当前片段的平方距离----<<-由于-]|vv|{-已经按-\05E6-缩放,平方结果会被缩放-E-倍----<<-如果平方结果大于-E,说明在椭圆外,距离均值超过-\05E6-个标准差----sy|n-N-J-q|5]|vv|{9-]|vv|{6H----vs-5N-K-E;=6-qvpnqH--------rp@-p|y|-J-P|y|;toH--------<<-由于渲染的-}yn-按-\05E6-缩放,高斯公式中的逆协方差矩阵部分变成单位矩阵----<<-因此只剩下-5e-:-zrn{6-7-5e-:-zrn{6,而-zrn{-为零,所以是-e-7-e,即-N----sy|n-|}npv\b-J-r\x07}5:=;B-7-N6-7-P|y|;nH--------tylSntP|y|-J-rpA5p|y|;to9-|}npv\b6H\f`),Oy=class extends c.Mesh{constructor(){super(),this.renderData=null,this.needsRender=!1,this.sortWorker=null,this.depthIndex=new Uint32Array,this.splatIndexCapacity=0,this.activeSlot=null,this.pendingSlot=null,this.rebuildGeneration=0,this.forceClipperUniformRefresh=!1,this.incrementalUpdateInFlight=!1,this.dataTexture=null,this.transformsTexture=null,this.transformIndicesTexture=null,this.layerIndicesTexture=null,this.shTexture=null,this.usedSHDegree=0,this.onBeforeRender=(e,t,n)=>{let r=n,i=this.collectObjects(t);if(i.length===0){this.geometry.instanceCount=0;return}let a=0;i.forEach(e=>{e.usedSHDegree>a&&(a=e.usedSHDegree)}),this.setMaxShDegree(a),this.isSceneNeedsRebuild(i)&&(this.tryStartIncrementalUpdate(i)||(this.startPendingRebuild(i),this.gsSceneState.lastClipperHash=``));let o=i.filter(e=>e.transformChanged);o.length>0&&(this.syncTransformsForSlot(this.activeSlot,o),this.syncTransformsForSlot(this.pendingSlot,o),o.forEach(e=>{e.transformChanged=!1,e.selectedChanged=!1})),this.activeSlot&&this.updateSlotTextures(this.activeSlot),this.pendingSlot&&this.updateSlotTextures(this.pendingSlot);let s=new c.Matrix4().multiplyMatrices(r.perspectiveProjectionMatrix,r.matrixWorldInverse).elements;this.pendingSlot&&this.pendingSlot.renderData.initialBuildComplete&&this.pendingSlot.awaitingFirstSort?this.requestSort(this.pendingSlot,s):this.activeSlot&&this.requestSort(this.activeSlot,s);let l=this.getClipperHash(i);if((this.forceClipperUniformRefresh||l!==this.gsSceneState.lastClipperHash)&&(this.updateClipperUniforms(i),this.gsSceneState.lastClipperHash=l,this.forceClipperUniformRefresh=!1,this.needsRender=!0),this.activeSlot){let e=Math.min(this.usedSHDegree,this.activeSlot.renderData.maxShDegree);this.material.uniforms.u_maxShDegree.value=e,e>0&&!this.activeSlot.textures.shTexture?this.createSHTexture(this.activeSlot):e===0&&this.activeSlot.textures.shTexture&&(this.activeSlot.textures.shTexture.dispose(),this.activeSlot.textures.shTexture=null),this.material.uniforms.u_shTexture.value=this.activeSlot.textures.shTexture,this.renderData=this.activeSlot.renderData}else this.pendingSlot||(this.bindSlotTextures(null),this.material.uniforms.u_maxShDegree.value=0,this.geometry.instanceCount=0);this.material.uniforms.resolution.value.set(r.resolution.x,r.resolution.y)};let e=this.createGeometry(),t=this.createMaterial();this.geometry=e,this.material=t,this.frustumCulled=!1,this.renderOrder=-99999999999,this.gsSceneState={lastObjectsHash:``,lastClipperHash:``},this.sortWorker=new Ty,this.sortWorker.postMessage({warmup:!0}),Sy.warmupWasm(),this.sortWorker.onmessage=e=>{if(e.data.depthIndex){let t=e.data.generation;if(this.pendingSlot&&t===this.pendingSlot.generation){this.pendingSlot.awaitingFirstSort=!1,this.swapPendingToActive(e.data.depthIndex);return}this.activeSlot&&t===this.activeSlot.generation&&(this.activeSlot.awaitingFirstSort=!1,this.applyDepthIndex(e.data.depthIndex))}}}ensureSplatIndexCapacity(e){let t=this.geometry.getAttribute(`splatIndex`);if(e<=this.splatIndexCapacity)return t;let n=this.getExpandedCapacity(e),r=t.array,i=new Float32Array(n);i.set(r.subarray(0,Math.min(r.length,n)));let a=new c.InstancedBufferAttribute(i,1,!1,1);return a.setUsage(c.DynamicDrawUsage),this.geometry.setAttribute(`splatIndex`,a),this.splatIndexCapacity=n,this.geometry._maxInstanceCount=n,a}getExpandedCapacity(e){let t=Math.max(this.splatIndexCapacity,1);for(;t<e;)t*=2;return t}createGeometry(){let e=new c.InstancedBufferGeometry,t=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,1,0]);e.setAttribute(`position`,new c.BufferAttribute(t,3));let n=new Uint16Array([0,1,2,0,2,3]);e.setIndex(new c.BufferAttribute(n,1)),this.splatIndexCapacity=1;let r=new Float32Array(this.splatIndexCapacity);for(let e=0;e<r.length;e++)r[e]=e;let i=new c.InstancedBufferAttribute(r,1,!1,1);return i.setUsage(c.DynamicDrawUsage),e.setAttribute(`splatIndex`,i),e._maxInstanceCount=this.splatIndexCapacity,e.instanceCount=0,e}createMaterial(){return new c.ShaderMaterial({vertexShader:Ey,fragmentShader:Dy,defines:{NUM_GS_LAYERS:0,NUM_GS_CLIPPERS:0},uniforms:{u_texture:{value:null},u_transforms:{value:null},u_transformIndices:{value:null},u_layerIndices:{value:null},u_numGsLayers:{value:0},u_numGsClippers:{value:0},u_layerClipperRanges:{value:[]},u_clipperMatricesInverse:{value:[]},u_shTexture:{value:null},u_shTextureSize:{value:new c.Vector2},u_maxShDegree:{value:0},resolution:{value:new c.Vector2},u_aggregationEnabled:{value:!0},u_aggregationProgress:{value:0},u_aggregationBoundsMin:{value:new c.Vector3(0,0,0)},u_aggregationBoundsMax:{value:new c.Vector3(0,0,0)},u_aggregationPointDuration:{value:.6}},side:c.DoubleSide,transparent:!0,blending:c.NormalBlending,depthTest:!0,depthWrite:!1})}createDefaultLayerClipperRanges(e){return Array.from({length:e},()=>new c.Vector2(-1,0))}createDefaultClipperMatrices(e){return Array.from({length:e},()=>new c.Matrix4)}createTextures(e){let t=new c.DataTexture(e.data,e.width,e.height,c.RGBAIntegerFormat,c.UnsignedIntType);t.internalFormat=`RGBA32UI`,t.minFilter=c.NearestFilter,t.magFilter=c.NearestFilter,t.needsUpdate=!0;let n=new c.DataTexture(e.transforms,e.transformsWidth,e.transformsHeight,c.RGBAFormat,c.FloatType);n.internalFormat=`RGBA32F`,n.minFilter=c.NearestFilter,n.magFilter=c.NearestFilter,n.needsUpdate=!0;let r=new c.DataTexture(e.transformIndices,e.transformIndicesWidth,e.transformIndicesHeight,c.RedIntegerFormat,c.UnsignedIntType);r.internalFormat=`R32UI`,r.minFilter=c.NearestFilter,r.magFilter=c.NearestFilter,r.needsUpdate=!0;let i=new c.DataTexture(e.layerIndices,e.layerIndicesWidth,e.layerIndicesHeight,c.RedIntegerFormat,c.UnsignedIntType);return i.internalFormat=`R32UI`,i.minFilter=c.NearestFilter,i.magFilter=c.NearestFilter,i.needsUpdate=!0,{dataTexture:t,transformsTexture:n,transformIndicesTexture:r,layerIndicesTexture:i,shTexture:null}}createSHTexture(e){let{renderData:t,textures:n}=e;n.shTexture&&(n.shTexture.dispose(),n.shTexture=null);let r=Math.min(this.usedSHDegree,t.maxShDegree),i=0;if(r>=1&&(i+=9),r>=2&&(i+=15),r>=3&&(i+=21),i===0)return;let a=i;a%4!=0&&(a=Math.ceil(a/4)*4);let o=t.numPoints*a/4,s=2048,l=Math.ceil(o/s),u=new Float32Array(s*l*4);for(let e=0;e<t.numPoints;e++){let n=a/4*e,i=0;if(t.sh1&&r>=1)for(let r=0;r<9;r++){let a=n+Math.floor(i/4),o=i%4,s=a*4+o;u[s]=t.sh1[e*9+r],i++}if(t.sh2&&r>=2)for(let r=0;r<15;r++){let a=n+Math.floor(i/4),o=i%4,s=a*4+o;u[s]=t.sh2[e*15+r],i++}if(t.sh3&&r>=3)for(let r=0;r<21;r++){let a=n+Math.floor(i/4),o=i%4,s=a*4+o;u[s]=t.sh3[e*21+r],i++}}n.shTexture=new c.DataTexture(u,s,l,c.RGBAFormat,c.FloatType),n.shTexture.internalFormat=`RGBA32F`,n.shTexture.minFilter=c.NearestFilter,n.shTexture.magFilter=c.NearestFilter,n.shTexture.needsUpdate=!0,this.material.uniforms.u_shTextureSize.value.set(s,l),this.material.uniforms.u_maxShDegree.value=r}setMaxShDegree(e){var t,n;if(e<0||e>2){console.warn(`现在只支持012三种阶数,你输入的是${e}`);return}let r=this.usedSHDegree;this.usedSHDegree=e,r!==e&&((t=this.activeSlot)!=null&&t.textures.shTexture&&(this.activeSlot.textures.shTexture.dispose(),this.activeSlot.textures.shTexture=null),(n=this.pendingSlot)!=null&&n.textures.shTexture&&(this.pendingSlot.textures.shTexture.dispose(),this.pendingSlot.textures.shTexture=null),this.material.uniforms.u_maxShDegree.value=e,e===0?this.material.uniforms.u_shTexture.value=null:this.activeSlot&&this.activeSlot.renderData.maxShDegree>0&&(this.createSHTexture(this.activeSlot),this.material.uniforms.u_shTexture.value=this.activeSlot.textures.shTexture))}bindSlotTextures(e){if(!e){this.dataTexture=null,this.transformsTexture=null,this.transformIndicesTexture=null,this.layerIndicesTexture=null,this.shTexture=null,this.material.uniforms.u_texture.value=null,this.material.uniforms.u_transforms.value=null,this.material.uniforms.u_transformIndices.value=null,this.material.uniforms.u_layerIndices.value=null,this.material.uniforms.u_shTexture.value=null;return}this.dataTexture=e.textures.dataTexture,this.transformsTexture=e.textures.transformsTexture,this.transformIndicesTexture=e.textures.transformIndicesTexture,this.layerIndicesTexture=e.textures.layerIndicesTexture,this.shTexture=e.textures.shTexture,this.material.uniforms.u_texture.value=this.dataTexture,this.material.uniforms.u_transforms.value=this.transformsTexture,this.material.uniforms.u_transformIndices.value=this.transformIndicesTexture,this.material.uniforms.u_layerIndices.value=this.layerIndicesTexture,this.material.uniforms.u_shTexture.value=this.shTexture}disposeSlot(e){e&&(e.renderData.dispose(),this.disposeTextures(e.textures))}disposeTextures(e){e.dataTexture.dispose(),e.transformsTexture.dispose(),e.transformIndicesTexture.dispose(),e.layerIndicesTexture.dispose(),e.shTexture&&(e.shTexture.dispose(),e.shTexture=null)}applyDepthIndex(e){this.depthIndex=e;let t=this.depthIndex.length,n=this.ensureSplatIndexCapacity(t);n.array.set(this.depthIndex,0),n.count=this.depthIndex.length,n.updateRange.offset=0,n.updateRange.count=t,n.needsUpdate=!0,this.geometry.instanceCount=this.depthIndex.length,this.needsRender=!0}swapPendingToActive(e){if(!this.pendingSlot)return;let t=this.activeSlot;this.activeSlot=this.pendingSlot,this.pendingSlot=null,this.renderData=this.activeSlot.renderData,this.ensureSplatIndexCapacity(this.activeSlot.renderData.numPoints),this.bindSlotTextures(this.activeSlot),this.activeSlot.sortDataUploaded=!0,this.forceClipperUniformRefresh=!0,this.applyDepthIndex(e),t&&this.disposeSlot(t)}createSlot(e){let t={generation:e.generation,renderData:e,textures:this.createTextures(e),awaitingFirstSort:!0,sortDataUploaded:!1};return this.usedSHDegree>0&&e.maxShDegree>0&&this.createSHTexture(t),t}updateSlotTextures(e){e.renderData.dataChanged&&(e.textures.dataTexture.needsUpdate=!0,e.renderData.dataChanged=!1),e.renderData.transformsChanged&&(e.textures.transformsTexture.needsUpdate=!0,e.textures.transformIndicesTexture.needsUpdate=!0,e.renderData.transformsChanged=!1)}postSortData(e){var t;let n=new Float32Array(e.renderData.positions.slice().buffer),r=new Float32Array(e.renderData.transforms.slice().buffer),i=new Uint32Array(e.renderData.transformIndices.slice().buffer);(t=this.sortWorker)==null||t.postMessage({sortData:{positions:n,transforms:r,transformIndices:i,vertexCount:e.renderData.numPoints,generation:e.generation}},[n.buffer,r.buffer,i.buffer]),e.sortDataUploaded=!0}requestSort(e,t){var n;e.renderData.initialBuildComplete&&((e.renderData.dataChanged||e.renderData.transformsChanged||!e.sortDataUploaded)&&this.postSortData(e),(n=this.sortWorker)==null||n.postMessage({viewProj:t}))}syncTransformsForSlot(e,t){e&&t.forEach(t=>{e.renderData.splatIndices.has(t)&&e.renderData.updateTransform(t)})}collectObjects(e){let t=[];return e.traverse(e=>{e instanceof $n&&e.visible&&t.push(e)}),t.sort((e,t)=>{let n=e.uuid+e.gsViewLayerKey,r=t.uuid+t.gsViewLayerKey;return n<r?-1:n>r?1:0}),t}isSceneNeedsRebuild(e){let t=e.map(e=>`${e.uuid}:${e.gsViewLayerKey}`).join(`|`),n=t!==this.gsSceneState.lastObjectsHash;return this.gsSceneState.lastObjectsHash=t,n}getClipperHash(e){return e.map(e=>{let t=e.gsClippers.map(e=>{var t;return`${(t=e.floorIndex)==null?-1:t}:${e.clippingBoxMatrix.elements.join(`,`)}`}).join(`;`);return`${e.gsViewLayerKey}:${t}`}).join(`|`)}updateClipperCounts(e,t){let n=Math.max(0,e|0),r=Math.max(0,t|0),i=this.material.defines;(i.NUM_GS_LAYERS!==n||i.NUM_GS_CLIPPERS!==r)&&(i.NUM_GS_LAYERS=n,i.NUM_GS_CLIPPERS=r,this.material.needsUpdate=!0),this.material.uniforms.u_numGsLayers.value=e,this.material.uniforms.u_numGsClippers.value=t}updateClipperUniforms(e){var t,n,r,i;let a=(n=(t=this.activeSlot)==null?void 0:t.renderData)==null?null:n;if(!a){this.material.uniforms.u_layerClipperRanges.value=[],this.material.uniforms.u_clipperMatricesInverse.value=[],this.updateClipperCounts(0,0);return}let o=new Map;for(let t of e)o.has(t.gsViewLayerKey)||o.set(t.gsViewLayerKey,t.gsClippers);let s=a.layerKeys.length,c=0;for(let e of a.layerKeys)c+=((r=o.get(e))==null?[]:r).length;let l=this.createDefaultLayerClipperRanges(s),u=this.createDefaultClipperMatrices(c),d=0;for(let e of a.layerKeys){let t=a.layerKeyToIndex.get(e);if(t===void 0)continue;let n=(i=o.get(e))==null?[]:i,r=d,s=0;for(let e of n)u[d].getInverse(e.clippingBoxMatrix),d++,s++;s>0&&l[t].set(r,s)}this.material.uniforms.u_layerClipperRanges.value=l,this.material.uniforms.u_clipperMatricesInverse.value=u,this.updateClipperCounts(s,d)}startPendingRebuild(e){this.pendingSlot&&(this.disposeSlot(this.pendingSlot),this.pendingSlot=null),this.rebuildGeneration+=1;let t=new Sy(e,this.rebuildGeneration);this.pendingSlot=this.createSlot(t)}tryStartIncrementalUpdate(e){if(!this.activeSlot||this.pendingSlot||this.incrementalUpdateInFlight)return!1;let t=this.activeSlot.renderData.getObjectsInOrder();if(!this.activeSlot.renderData.canIncrementalAppend(e))return!1;let n=e.slice(t.length);if(n.length===0)return!1;this.incrementalUpdateInFlight=!0;let r=this.activeSlot;return r.renderData.appendObjects(n).then(e=>{if(!e||this.activeSlot!==r||r.renderData.disposed)return;let t=r.textures;r.textures=this.createTextures(r.renderData),this.usedSHDegree>0&&r.renderData.maxShDegree>0&&this.createSHTexture(r),this.bindSlotTextures(r),this.ensureSplatIndexCapacity(r.renderData.numPoints),r.sortDataUploaded=!1,r.awaitingFirstSort=!0,this.disposeTextures(t),this.forceClipperUniformRefresh=!0,this.gsSceneState.lastClipperHash=``,this.needsRender=!0}).catch(e=>{console.warn(`Incremental append failed, fallback to rebuild:`,e)}).finally(()=>{this.incrementalUpdateInFlight=!1}),!0}dispose(){this.disposeSlot(this.pendingSlot),this.pendingSlot=null,this.disposeSlot(this.activeSlot),this.activeSlot=null,this.renderData=null,this.sortWorker&&this.sortWorker.terminate(),this.bindSlotTextures(null),this.geometry.dispose(),this.material.dispose()}},ky=class extends c.Mesh{constructor(){super(),this.onBeforeRender=(e,t,n)=>{this.collectObjects(t).length>0&&console.warn(`未开启webgl2, 3dgs仅支持在开启webgl2模式后使用`)}}collectObjects(e){let t=[];return e.traverse(e=>{e instanceof $n&&e.visible&&t.push(e)}),t}},Ay=1e3,jy=90,My=e=>e.replace(`//vrlab-public.ljcdn.com/`,`//vr-public.realsee-cdn.cn/`).replace(`//vrlab-image4.ljcdn.com/`,`//vr-image-4.realsee-cdn.cn/`).replace(`//vrlab-image3.ljcdn.com/`,`//vr-image-3.realsee-cdn.cn/`).replace(`//vrlab-image2.ljcdn.com/`,`//vr-image-2.realsee-cdn.cn/`).replace(`//vrlab-image1.ljcdn.com/`,`//vr-image-1.realsee-cdn.cn/`),Ny=new c.Sphere,Py=new c.Box3,Fy=new c.Vector4,Iy=new c.Vector4,Ly=new c.Color,Ry=new c.Vector2,zy=new WeakMap,By=am([nm(null)]),Vy={},Hy=class e extends ln{static get version(){return`6.8.0-alpha.28`}static get dracoPath(){return io.decoderPath}static set dracoPath(e){io.setDecoderPath(e)}static get ktx2Path(){return po.transcoderPath}static set ktx2Path(e){po.setTranscoderPath(e)}static get useNativeImageBitmap(){return di()}static set useNativeImageBitmap(e){ui(e)}constructor(e={}){var t,n,r,i,a,o,s,l,u,d,f;if(super(),this.pbmGaussianSplattingRenderMesh=null,this.fiveId=rn(),Vy[this.fiveId]=this,this.currentUpdateArgs={time:H(),args:[]},this.currentMode=`Panorama`,this.pano={workCode:``,panoIndex:0},this.needsRender=!1,this.onlyRenderIfNeeds=(t=e.onlyRenderIfNeeds)==null?!0:t,this.imageOptions=Object.assign({},(n=e.imageOptions)==null?{}:n),this.textureOptions=Object.assign({},(r=e.textureOptions)==null?{}:r),this.poweredByRealsee=(i=e.poweredByRealsee)==null?!0:i,this.backgroundColor=new c.Color((a=e.backgroundColor)==null?1579548:a),this.backgroundAlpha=(o=e.backgroundAlpha)==null?1:o,this.extraElements=[],this.controllerInits={Panorama:Object.assign({},e.panorama),Model:Object.assign({},e.model),Floorplan:Object.assign({},e.floorplan),Topview:Object.assign({},e.topview),Mapview:Object.assign({},e.mapview),VRPanorama:Object.assign({},e.vrPanorama),XRPanorama:Object.assign({},e.xrPanorama)},this.fps={testCount:0,testTime:H()},this.modeChangeDuration=(s=e.modeChangeDuration)==null?Ay:s,this.enableWheel=(l=e.enableWheel)==null?!0:l,typeof window<`u`)if(`renderer`in e)e.renderer instanceof Qm&&this.throwError(Error(`cannot render a internal renderer`)),this.renderer=e.renderer;else try{this.renderer=new Qm({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});let t=Qv();this.renderer.setPixelRatio(t===1?window.devicePixelRatio:1),this.renderer.setSize(512,512),this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha)}catch(e){let t=e instanceof Error?e:Error(String(e));this.throwError(t)}this.getPixelsRenderTarget=new c.WebGLRenderTarget(1,1,{encoding:(d=(u=this.renderer)==null?void 0:u.outputEncoding)==null?c.sRGBEncoding:d,generateMipmaps:!1}),this.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),this.camera=new tn(jy),this.scene=new ah,this.xrCustomObjectsScene=new c.Scene,this.scene.add(this.xrCustomObjectsScene),this.scene.matrixAutoUpdate=!1,this.loadWorkTask=Promise.resolve(),this.requestProxy=(f=e.requestProxy)==null?My:f,this.networkSubscribe=new dr,this.networkSubscribe.on(`network`,(e,t,n,r)=>{var i;this.emit(`network.resource`,Q(`network.resource`,{source:e,requestType:t,requestState:n,detail:r})),(i=this.analysis)==null||i.network(this.works,e,t,n,r)}),this.readyCallbacks=[],this.syncingState=!1,this.helperGroup=new c.Group,this.helperGroup.name=`helper`,this.helperGroup.matrixAutoUpdate=!1,this.scene.add(this.helperGroup),zy.set(this,By),this.modelScene=new np({fiveId:this.fiveId}),this.modelScene.addEventListener(`model.create`,e=>{this.bindModel(e.model)}),this.scene.add(this.modelScene);let[p]=this.modelScene.setModels(By,{forceReplaceImmediately:!0});V(p,`loaded`,{get(){return!1},set(e){}}),this.videoTexture=new c.VideoTexture(e.videoInstance||Yv());let m=Xv();this.scene.add(m),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.stateSynced=!1,this.destroyed=!1,this.paused=!0,typeof window<`u`&&(e.play!==!1&&this.play(),this.stopAnimationLoop=si.shared.add((e,t,...n)=>{this.updateTime(e,t,...n)},!1,0,10));let h=()=>{typeof document<`u`&&document.fullscreenElement===null&&this.currentMode===`VRPanorama`&&this.controller.emit(`vr.requestExit`,Q(`vr.requestExit`,{}))},g=()=>{this.needsRender=!0};if(typeof document<`u`&&document.addEventListener(`fullscreenchange`,h,!1),this.renderer&&this.renderer.domElement.addEventListener(`webglcontextrestored`,g,!1),this.removeEventListeners=()=>{typeof document<`u`&&document.removeEventListener(`fullscreenchange`,h,!1),this.renderer&&this.renderer.domElement.removeEventListener(`webglcontextrestored`,g,!1)},this.plugins={},e.plugins&&e.plugins.length){for(let t of e.plugins)if(typeof t==`function`)t(this);else if(Array.isArray(t)){let[e,n,r]=t;if(typeof e==`function`){let t=e(this,r);typeof n==`string`&&(this.plugins[n]?this.throwError(Error(`plugin name ${n} is exists.`)):this.plugins[n]=t)}}}Jv(this),this.fiveRenderer=new Zm,this.adaptiveLuminancePass=new Am,this.adaptiveLuminancePass.enabled=!1,this.fiveRenderer.composer.addPass(this.adaptiveLuminancePass),this.eyeDomeLightingPass=new Nm(this.camera),this.eyeDomeLightingPass.enabled=!1,this.fiveRenderer.composer.addPass(this.eyeDomeLightingPass),e.webgl2?(this.pbmGaussianSplattingRenderMesh=new Oy,this.scene.add(this.pbmGaussianSplattingRenderMesh)):this.scene.add(new ky)}get ident(){return this.fiveId}get panoIndex(){return this.pano.panoIndex}get panoId(){return Z(this.pano)}dispose(){var e;if(this.destroyed===!0)return;delete Vy[this.fiveId],this.emit(`dispose`),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),this.stopAnimationLoop=void 0),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);let t=this.getElement();t&&t.parentNode&&t.parentNode.removeChild(t);let n=this.modelScene.parameter;n.pano0&&n.pano0.map.dispose(),n.pano1&&n.pano1.map!==((e=n.pano0)==null?void 0:e.map)&&n.pano1.map.dispose(),n.reset(`pano0`,`pano1`),this.modelScene.dispose(),this.scene.dispose(),this.xrCustomObjectsScene.dispose(),zy.set(this,By),this.renderer&&this.renderer.render(new c.Scene,new c.Camera),this.fiveRenderer.dispose(),this.renderer instanceof Qm&&(this.renderer.forceContextLoss&&this.renderer.forceContextLoss(),this.renderer.dispose())}setViewport(e){Object.assign(this.viewport,e),this.needsRender=!0}get boundingMesh(){return this.modelScene.boundingMesh}get helperVisible(){return this.helperGroup.visible}set helperVisible(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit(`helpers.visible`,Q(`helpers.visible`,{object:this.helperGroup})),this.needsRender=!0)}updateConfiguration(e,t=!0){let n=!1,r=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,br(e.panorama)),this.currentMode===`Panorama`&&(n=!0)),e.model&&(Object.assign(this.controllerInits.Model,br(e.model)),this.currentMode===`Model`&&(n=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,br(e.floorplan)),this.currentMode===`Floorplan`&&(n=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,br(e.topview)),this.currentMode===`Topview`&&(n=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,br(e.mapview)),this.currentMode===`Mapview`&&(n=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,br(e.vrPanorama)),this.currentMode===`VRPanorama`&&(n=!0)),e.xrPanorama&&(Object.assign(this.controllerInits.XRPanorama,br(e.xrPanorama)),this.currentMode===`XRPanorama`&&(n=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),(this.currentMode===`Panorama`||this.currentMode===`VRPanorama`)&&(r=!0,n=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),t&&n&&this.controller&&this.currentMode&&(!this.controller.updateConfiguration(this.controllerInits[this.currentMode])||r)&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)}appendTo(e,t={}){if(!this.renderer)return;if(!(this.renderer instanceof Qm)){this.throwError(Error(`cannot call appendTo method when render a external renderer`));return}let n=this.getElement();if(!n)return;e.appendChild(n),this.refresh(t);let r=window.getComputedStyle(e).position;r!==`relative`&&r!==`absolute`&&r!==`fixed`&&r!==`sticky`&&(e.style.position=`relative`)}refresh(e={},t){var n,r,i;if(!this.renderer)return;let a=this.renderer.domElement.parentNode,{width:o=(n=a==null?void 0:a.offsetWidth)==null?512:n,height:s=(r=a==null?void 0:a.offsetHeight)==null?512:r}=e;if(o=Math.max(1,o),s=Math.max(1,s),!t){let e=Qv(),n=typeof window<`u`?window.devicePixelRatio:1;if(t=(i=e===1?n:1)==null?1:i,t>1){let e=Math.max(o,s)*t,n=Math.min(this.renderer.capabilities.maxTextureSize,4096);e>n&&(t=Math.max(t/e*n,1),t=Math.floor(t*100)/100)}}this.renderer.setPixelRatio(t),this.renderer.setSize(o,s),this.needsRender=!0;let c=H(),l=c-this.currentUpdateArgs.time,u=this.currentUpdateArgs.args;this.updateTime(c,l,...u)}addExtraElement(e){return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),()=>this.removeExtraElement(e)}removeExtraElement(e){let t=this.extraElements.indexOf(e);t!==-1&&(this.extraElements.splice(t,1),this.controller&&this.controller.unbindExtraElement(e))}getSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}getDrawingBufferSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getDrawingBufferSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}updateCamera(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCamera(e,t,n)}updateCameraWithKeyframes(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCameraWithKeyframes(e,t,n)}get works(){return zy.get(this)||By}get work(){return this.works[0]}get observers(){return this.work.observers}get models(){return this.modelScene.models}get model(){return this.modelScene.models[0]}load(e,t,n,r=!0){if(!this.renderer)throw Error(`renderer is not initialized`);let i=this.loadWorkTask.then(()=>Th(e)?e.then(e=>this.load_(e,t,n,r)):this.load_(e,t,n,r));return this.loadWorkTask=i.catch(e=>{this.throwError(e)}),i}load_(t,n,r,i=!0){var a,o,s,l,u,d,f,p,m,h;let g={};typeof r==`number`?g.duration=r:typeof r==`object`&&Object.assign(g,r),this.works===By&&(g.duration===void 0&&(g.duration=0),g.effect===void 0&&(g.effect=`instant`));let _={};Object.assign(_,g.model),!_[`3d-tiles`]&&g[`3d-tiles`]&&(_[`3d-tiles`]=g[`3d-tiles`]),!_.textureOptions&&g.textureOptions&&(_.textureOptions=g.textureOptions),!_.textureOptions&&this.textureOptions&&(_.textureOptions=this.textureOptions);let v=[];if(Array.isArray(t))for(let e of t)e instanceof tm?v.push(e):typeof e!=`string`&&`work`in e?v.push(nm(e.work,e)):v.push(nm(e));else t instanceof tm?v.push(t):v.push(nm(t));g.mode===`add`&&(v=[].concat(this.works,v));let y;try{y=am(v)}catch(e){return this.throwError(e),Promise.reject(e)}for(let e of y)this.bindWorkFetcher(e);n===void 0&&(n=`inherit`),n===`inherit`&&this.works===By&&(n=`initial`);let b=this.currentMode,x=y.initial,S=x.work.observers[0],C=S?{workCode:S.work.workCode,panoIndex:S.panoIndex}:{workCode:x.work.workCode,panoIndex:0},w=(a=x.mode)==null?S?`Panorama`:`Mapview`:a,T={};if(n===`inherit`){let e=this.getCurrentState(),[t]=y.filter(t=>t.workCode===e.workCode);if(t)C={workCode:e.workCode,panoIndex:e.panoIndex},w=e.mode,T={longitude:e.latitude,latitude:e.latitude,fov:e.fov,distance:e.distance,offset:e.offset.clone()};else{n={mode:b};let e=(s=(o=y[0])==null?void 0:o.observers)==null?void 0:s[this.panoIndex];e?(n.workCode=e.work.workCode,n.panoIndex=e.panoIndex):typeof y.initial.panoIndex==`number`?(n.workCode=y.initial.work.workCode,n.panoIndex=y.initial.panoIndex):(n.mode===`Panorama`||n.mode===`VRPanorama`||n.mode===`XRPanorama`)&&(n.mode=`Mapview`),n.mode===b&&(n.longitude=this.camera.pose.longitude,n.latitude=this.camera.pose.latitude,n.fov=this.camera.pose.fov)}}if(n===`initial`&&(typeof x.panoIndex==`number`&&(C={workCode:x.work.workCode,panoIndex:x.panoIndex}),x.mode&&(w=x.mode),T={longitude:x.longitude,latitude:x.latitude,fov:x.fov,distance:x.distance,offset:(l=x.offset)==null?void 0:l.clone()}),typeof n==`object`){if(w=(u=n.mode)==null?b:u,typeof n.panoIndex==`number`){let e=y.getObserver({workCode:(f=(d=n.workCode)==null?x.work.workCode:d)==null?``:f,panoIndex:n.panoIndex});e&&(C={workCode:e.work.workCode,panoIndex:e.panoIndex})}T={longitude:n.longitude,latitude:n.latitude,fov:n.fov,distance:n.distance,offset:n.offset?new c.Vector3().copy(n.offset):void 0}}let E=(p=g.duration)==null?this.modeChangeDuration:p;(w===`Floorplan`||w===`Topview`||w===`Mapview`)&&b===w&&(E=0);let D=`fly`;(w===`Panorama`||w===`VRPanorama`||w===`XRPanorama`)&&b===w&&(D=(m=g.effect)==null?`fade`:m),this.emit(`works.request`,Q(`works.request`,{input:t,works:y,userAction:i}));let O=(e,t,r)=>{let a=this.getCurrentState(),o=Object.assign(Object.assign({mode:e},t),r);n===`inherit`&&(o=this.getCurrentState()),this.pano=t;let s=Object.assign(Object.assign({initial:{state:o,currentState:a,duration:E,effect:D,userAction:i}},this.commonParams()),this.controllerInits[e]),c=Gv[o.mode].initAnimationEndState(s);if(this.controller&&b===e)this.controller.updateWork(y,c,{effect:D,duration:E},i)===!1&&(this.controller.destroy(),this.controller=this.applyController(e,s));else{if(this.controller)this.controller.destroy();else{let t=Gv[e].initAnimationEndState(s);this.camera.setFromPose(t),this.emit(`camera.update`,Q(`camera.update`,{state:this.getCurrentState(),userAction:i}))}this.controller=this.applyController(e,s);let t=Q(`mode.change`,{prevMode:b,mode:e,state:c,userAction:i});try{this.emit(`mode.change`,t)}catch(e){console.error(e)}}this.updateTime(this.currentUpdateArgs.time,0,...this.currentUpdateArgs.args)};zy.set(this,y);let k=Promise.resolve();if(w===e.Mode.Floorplan||w===e.Mode.Topview||w===e.Mode.Mapview||w===e.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(T),Ih(this.state,this.camera.pose));let e=this.modelScene.setModels(y,_);k=Promise.all(e.map(e=>e.loadedReady)).then(()=>{this.needsRender=!0,O(w,C,T),this.emit(`camera.update`,Q(`camera.update`,{state:this.getCurrentState(),userAction:i}))})}else{O(w,C,T);let e=this.controller,t=!1;this.modelScene.autoRefine=!1;let n=()=>{this.works===y&&t===!1&&(this.needsRender=!0,this.emit(`camera.update`,Q(`camera.update`,{state:this.getCurrentState(),userAction:i})),t=!0,this.modelScene.autoRefine=!0),e.off(`pano.arrived`,n),e.off(`pano.cancel`,n)},r=this.modelScene.setModels(y,_);k=Promise.all(r.map(e=>e.initReady)).then(K),e.once(`pano.arrived`,n),e.once(`pano.cancel`,n),setTimeout(n,((h=g.duration)==null?this.modeChangeDuration:h)+1e3)}return this.emit(`works.load`,Q(`works.load`,{input:t,userAction:i,works:y})),k.then(()=>this.ready()).then(()=>{var e;this.emit(`works.ready`,Q(`works.ready`,{input:t,userAction:i,works:y})),(e=this.analysis)==null||e.work(y)})}reset(){let e=this.loadWorkTask.then(()=>this.reset_());return this.loadWorkTask=e.catch(e=>{this.throwError(e)}),e}reset_(){return new Promise(e=>{var t;this.controller&&(this.controller.destroy(),this.controller=void 0);let n=this.modelScene.parameter;n.pano0&&n.pano0.map.dispose(),n.pano1&&n.pano1.map!==((t=n.pano0)==null?void 0:t.map)&&n.pano1.map.dispose(),n.set({pano0:null,pano1:null,modelAlpha:1}),zy.set(this,By),this.modelScene.setModels(By,{forceReplaceImmediately:!0}),this.renderer&&this.modelScene.update(this.renderer,this.camera),this.needsRender=!0,this.currentMode=`Panorama`,this.pano={workCode:``,panoIndex:0},this.camera.setFromPose({distance:0,fov:jy,longitude:0,latitude:0,offset:new c.Vector3(0,0,0)}),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.camera.needsRender=!1,this.needsRender=!1,e()})}changeMode(t,n={},r,i=!0,a=!1){return new Promise((o,s)=>{var c,l,u,d;if(!this.renderer)throw Error(`renderer is not initialized.`);n=Object.assign({},n);let f=0;this.controller&&(f=typeof r==`number`?r:(c=r==null?void 0:r.duration)==null?this.modeChangeDuration:c);let p=`fly`;this.controller&&typeof r==`object`&&r.effect&&(p=r.effect);let m=typeof n.panoIndex==`number`?{workCode:(d=(l=n.workCode)==null?(u=this.work)==null?void 0:u.workCode:l)==null?``:d,panoIndex:n.panoIndex}:this.pano;if(!e.Mode.hasOwnProperty(t)){let e=Error(`mode "${t}" is not existed`);this.throwError(e),s(e);return}if((t===e.Mode.Panorama||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama)&&!this.works.getObserver(m)){let e=Error(`PanoId ${Z(m)} not existed.`);this.throwError(e),s(e);return}(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)&&this.modelScene.empty&&(f=0);let h=this.controller,g=this.currentMode,_=()=>{if(this.controller&&this.controller.stopMomentumMovement(),this.controller&&a===!1&&g===t)t===e.Mode.Panorama||t===e.Mode.Model||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama?!bp(this.pano,m)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`?this.controller.moveToPano(m,Object.assign({duration:f},n),i):this.controller.updateCamera(n,f,i).catch(K):(bp(this.pano,m)||(this.pano=m),this.controller.updateCamera(n,f,i).catch(K));else{let e=Object.assign(Object.assign({},n),m),r=Object.assign(Object.assign({initial:{state:e,currentState:this.getCurrentState(),duration:f,effect:p,userAction:i}},this.commonParams()),this.controllerInits[t]),a=Gv[t].initAnimationEndState(r),o=Q(`mode.change.request`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});if(this.emit(`mode.change.request`,o),!o.defaultPrevented){h&&h.destroy(),this.controller=this.applyController(t,r);let e=Q(`mode.change`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});this.emit(`mode.change`,e)}}o()},v=si.shared.getContext();v&&(typeof XRSession<`u`&&v instanceof XRSession&&v.end(),si.shared.setContext(null)),t===e.Mode.VRPanorama?(this.requestFullscreen(),Mh().then(()=>_()).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.exitFullscreen(),this.throwError(t),s(t)})):t===e.Mode.XRPanorama?Nh().then(e=>{si.shared.setContext(e),a=!0,_()}).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.throwError(t),s(t)}):_()})}getPixels(e,t,n,r,i,a,o){if(!this.renderer)throw Error(`renderer is not initialized.`);let s=H(),l=this.renderer.getPixelRatio(),u=this.renderer.getRenderTarget(),d=this.getSize(new c.Vector2),f=0,p=0,m=1,h=1,g,_,v,y,b;typeof e==`number`?(f=e,typeof t==`number`&&(p=t),typeof n==`number`&&(m=n),typeof r==`number`&&(h=r),g=i,_=a,b=o):(f=e.x,p=e.y,m=e.width,h=e.height,g=e.pixelRatio,_=e.flipY,v=e.helperVisible,y=e.skipPanorama,b=e.buffer),f=Math.floor(f),p=Math.floor(p),m=Math.floor(m),h=Math.floor(h),g=Math.floor(g==null?l:g),_=_==null?!1:_;let x=this.helperVisible,S=this.modelScene.parameter.modelAlpha;this.helperVisible=v==null?this.helperVisible:v,y&&(this.controller instanceof Gv.Panorama||this.controller instanceof Gv.VRPanorama||this.controller instanceof Gv.XRPanorama)&&y===!0&&this.modelScene.parameter.set(`modelAlpha`,1),this.modelScene.update(this.renderer,this.camera);let C=this.getPixelsRenderTarget;C.setSize(m*g,h*g),this.renderer.setRenderTarget(C),this.camera.pixelRatio=g,this.camera.resolution.set(m,h),this.camera.setViewOffset(d.width,d.height,f,d.height-p-h,m,h),this.camera.aspect=d.width/d.height,this.camera.updateTime(s),this.scene.update(this.renderer,this.camera);let w=this.renderer.autoClear,T=this.renderer.autoClearColor,E=this.renderer.autoClearDepth,D=this.renderer.autoClearStencil,O=Ly.copy(this.renderer.getClearColor()),k=this.renderer.getClearAlpha(),A=this.renderer.getScissorTest();this.renderer.autoClear=!0,this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.autoClearStencil=!0,this.renderer.setScissorTest(!1);let j=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:j,this.renderer.render(this.scene,this.camera),this.scene.background=j,this.renderer.autoClear=w,this.renderer.autoClearColor=T,this.renderer.autoClearDepth=E,this.renderer.autoClearStencil=D,this.renderer.setClearColor(O,k),this.renderer.setScissorTest(A),this.helperVisible=x,S===void 0?this.modelScene.parameter.reset(`modelAlpha`):this.modelScene.parameter.set(`modelAlpha`,S),this.renderer.setRenderTarget(u),this.camera.clearViewOffset(),this.camera.pixelRatio=l,this.camera.resolution.copy(d),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.camera.updateTime(s),this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);let M=m*g,N=h*g,ee=M*N,P=ee*4;if(b){if(b.length!==P)throw Error(`buffer length is not equals pixels ${P}`)}else b=new Uint8Array(P);if(this.renderer.readRenderTargetPixels(C,0,0,m*g,h*g,b),_){let e=ee/2;for(let t=0,n=0,r=0,i=0;n<e;n++)for(i=(N-Math.floor(n/M)-1)*M+n%M,r=0;r<4;r++)t=b[n*4+r],b[n*4+r]=b[i*4+r],b[i*4+r]=t}return b}getElement(){var e;return(e=this.renderer)==null?void 0:e.domElement}render(e){let t=this.renderer;if(!t)return;let n=t.getRenderTarget();t.setRenderTarget(null);let r=t.autoClear,i=t.autoClearColor,a=t.autoClearDepth,o=t.autoClearStencil,s=Ly.copy(t.getClearColor()),c=t.getClearAlpha(),l=t.getViewport(Fy),u=t.getScissor(Iy),d=t.getScissorTest();t.autoClear=!0,t.autoClearColor=!0,t.autoClearDepth=!0,t.autoClearStencil=!0;let f=t.getSize(Ry),p=Math.floor(f.x*this.viewport.left),m=Math.floor(f.y*this.viewport.bottom),h=Math.floor(f.x*this.viewport.width),g=Math.floor(f.y*this.viewport.height);t.setClearColor(this.backgroundColor,this.backgroundAlpha),t.setViewport(p,m,h,g),t.setScissor(p,m,h,g);let _=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;t.setScissorTest(_);let v=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:v;let y=!0;if(this.controller&&this.controller.render()&&(y=!1),y){let e=this.fiveRenderer.render(t,this.scene,this.modelScene,this.camera,this.needsRender);this.poweredByRealsee&&e&&fy(t)}this.scene.background=v,t.autoClear=r,t.autoClearColor=i,t.autoClearDepth=a,t.autoClearStencil=o,t.setClearColor(s,c),t.setViewport(l),t.setScissor(u),t.setScissorTest(d),t.setRenderTarget(n),e&&si.shared.add(e,!0)}updateTime(e,t,...n){if(this.currentUpdateArgs={time:e,args:n},this.destroyed)return;if(this.renderer&&po.detectSupport(this.renderer),this.syncingState=this.syncState(e,t),this.controller&&this.controller.updateTime(e,t,...n),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){let e=this.modelScene.loaded,t=this.modelScene.refined;this.modelScene.update(this.renderer,this.camera),e===!1&&this.modelScene.loaded===!0&&(this.controller&&this.controller.updateModel(this.modelScene),si.shared.add(()=>{this.emit(`models.load`,Q(`models.load`,{modelScene:this.modelScene}))},!0,0,10)),t===!1&&this.modelScene.refined===!0&&si.shared.add(()=>{this.emit(`models.refined`,Q(`models.refined`,{modelScene:this.modelScene}))},!0,0,10)}if(this.camera.autoNearFar){Py.makeEmpty(),Py.expandByObject(this.modelScene.boundingMesh);let t=Py.getBoundingSphere(Ny),n=t.radius*2;t.containsPoint(this.camera.position)||(n=this.camera.position.distanceTo(t.center)+t.radius),n=U(n,800);let r=n/1e4;r=U(r,.03,.1),this.camera.near!==r&&(this.camera.near=r),this.camera.far!==n&&(this.camera.far=n),this.camera.updateTime(e)}if(this.renderer){let e=this.modelScene.visible;this.modelScene.visible=!1,this.scene.update(this.renderer,this.camera),this.modelScene.visible=e}if(this.syncingState=!1,this.controller&&this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0),this.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.pbmGaussianSplattingRenderMesh&&this.pbmGaussianSplattingRenderMesh.needsRender===!0&&(this.pbmGaussianSplattingRenderMesh.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0),this.paused===!0)return;let r=Q(`render.prepare`,{needsRender:this.needsRender});this.emit(`render.prepare`,r),r.defaultPrevented&&(this.needsRender=!1);let i=this.needsRender;this.render(),this.needsRender=!1,this.emit(`render`,Q(`render`,{needsRender:i})),this.hasListener(`fps`)&&(this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit(`fps`,this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0))}pause(){this.paused=!0,this.renderer&&this.renderer instanceof Qm&&this.renderer.clear(!0,!0,!0)}play(){this.needsRender=!0,this.paused=!1}moveToPano(t,n={},r=!0){let{controller:i,renderer:a}=this;if(!i)return this.throwError(Error(`controller is not initialized.`)),Promise.resolve();if(!a)return this.throwError(Error(`renderer is not initialized.`)),Promise.resolve();typeof t==`number`&&this.pano.workCode&&(t={workCode:this.pano.workCode,panoIndex:t});let o=this.works.getObserver(t);if(!o)return this.throwError(Error(`pano ${JSON.stringify(t)} not existed.`)),Promise.resolve();let s={workCode:o.work.workCode,panoIndex:o.panoIndex};return`moveToPano`in i&&typeof i.moveToPano==`function`?i.moveToPano(s,n,r):o&&(this.pano=s,this.once(`initAnimation.start`,e=>{n.moveStartCallback&&n.moveStartCallback(e.state)}),this.once(`initAnimation.end`,e=>{n.moveEndCallback&&n.moveEndCallback(e.state)}),this.changeMode(e.Mode.Panorama,n,{effect:n.effect},r)),this.ready()}preloadPano(e,t=K){let n=this.works.getObserver(e);if(!n)return Promise.reject(Error(`Pano ${JSON.stringify(e)} never found`));let r=[`right`,`left`,`up`,`down`,`front`,`back`],i=H();return Promise.all(r.map(e=>{let t=Z({panoIndex:n.panoIndex,workCode:n.work.workCode}),r=Object.assign({key:`pano.${t}.${e}`},vr(this.imageOptions,[`size`,`format`,`quality`,`forceUseExifOrientation`,`mappings`])),i=n.work.getURL(n.images[e]),a=this.imageOptions.transform?this.imageOptions.transform(i,r):Xr(i,r);return Ef(this.fiveId,n.work).preload(a)})).then(()=>{let e=H()-i;return t(e),e})}project2d(e,t=!1){if(!this.renderer)return null;if(t){let t=this.camera.position,n=e.clone().sub(t),r=new c.Raycaster(t,n.clone().normalize());r.params.Points={threshold:.1};let[i]=this.modelScene.intersectRaycaster(r);if(i&&i.distance+.01<n.length())return null}let n=e.clone().project(this.camera);if(Math.abs(n.z)>1)return null;let r=this.renderer.getSize(new c.Vector2),i=r.x*this.viewport.width,a=r.y*this.viewport.height,o=r.x*this.viewport.left+(n.x+1)/2*i,s=r.y*(1-this.viewport.bottom-this.viewport.height)+(-n.y+1)/2*a;return new c.Vector2(o,s)}getCurrentState(){return Object.assign(Object.assign({},this.camera.copyPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})}setState(e,t=!1,n=!0){var r,i,a,o,s,l,u,d,f,p;e=vr(e,[`mode`,`workCode`,`panoIndex`,`longitude`,`latitude`,`fov`,`offset`,`distance`]),e.offset&&!(e instanceof c.Vector3)&&(e.offset=new c.Vector3(e.offset.x,e.offset.y,e.offset.z));let m;if(typeof e.panoIndex==`number`)if(e.workCode)m={workCode:e.workCode,panoIndex:e.panoIndex};else{let t=(i=(r=this.work)==null?void 0:r.workCode)==null?``:i,n=this.state.workCode;this.works.filter(e=>e.workCode===n).length>0&&(t=n),m={workCode:t,panoIndex:e.panoIndex}}let h=(a=e.mode)==null?this.state.mode:a,g,_,v,y,b;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==h){if(h===`VRPanorama`){this.changeMode(`VRPanorama`,void 0,void 0,!0);return}let t={workCode:m==null?void 0:m.workCode,panoIndex:m==null?void 0:m.panoIndex};typeof e.longitude==`number`&&(t.longitude=e.longitude),typeof e.latitude==`number`&&(t.latitude=e.latitude),typeof e.fov==`number`&&(t.fov=e.fov),typeof e.distance==`number`&&(t.distance=e.distance),e.offset instanceof c.Vector3&&(t.offset=e.offset);let n=Object.assign(Object.assign({initial:{state:t,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:`fly`,userAction:!1}},this.commonParams()),this.controllerInits[h]),r=Gv[h].initAnimationEndState(n);g=r.longitude,_=r.latitude,v=r.fov,y=r.offset,b=r.distance}else g=(o=e.longitude)==null?this.state.longitude:o,_=(s=e.latitude)==null?this.state.latitude:s,v=(l=e.fov)==null?this.state.fov:l,y=(u=e.offset)==null?this.state.offset:u,b=(d=e.distance)==null?this.state.distance:d;let x={workCode:(m==null?this.pano:m).workCode,panoIndex:(m==null?this.pano:m).panoIndex,mode:h,longitude:g,latitude:_,fov:v,offset:y,distance:b};this.emit(`state.set`,Q(`state.set`,{userAction:n,state:x})),Fh(this.state,x)||(this.controller&&x.mode===`VRPanorama`&&x.mode!==this.state.mode?(Ph(this.state,x),this.changeMode(`VRPanorama`)):this.controller&&x.mode===`XRPanorama`&&x.mode!==this.state.mode?(Ph(this.state,x),this.changeMode(`XRPanorama`)):(Ph(this.state,x),this.controller&&n&&(this.controller.userAction=!1),t&&this.state.mode===x.mode&&(this.syncingState=this.syncState(H(),0,t),this.syncingState&&((f=this.controller)==null||f.updateTime(H(),0),this.syncingState=!1)),this.emit(`state.change`,Q(`state.change`,{userAction:n,state:this.state})),(p=this.analysis)==null||p.state(this.works,this.state)))}syncState(t,n,r=!1){let i=this.stateSynced;if(this.stateSynced=!1,!this.controller)return!1;if(this.state.mode!==this.currentMode){let e={mode:this.state.mode,workCode:this.state.workCode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.changeMode(this.state.mode,e,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof Gv.Model){if(wh(this.camera.pose.offset,this.state.offset)){let e={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,Object.assign(Object.assign({},e),{duration:r?0:void 0}),!1),!0}}else{let e={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!bp(e,this.pano)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`){let t={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(e,t,!1),!0}}if(this.controller instanceof Gv.Floorplan||this.controller instanceof Gv.Topview||this.controller instanceof Gv.Mapview){let e=.2,t=Math.PI/45,n=r?this.state.fov:Cm(this.camera.pose.fov,this.state.fov,1),i=Math.abs(this.camera.pose.distance-this.state.distance),a=i>e*15?i/15:.2,o=r?this.state.distance:Cm(this.camera.pose.distance,this.state.distance,a),s=this.camera.pose.offset.distanceTo(this.state.offset),l=s>e*15?s/15:e,u=r?new c.Vector3().copy(this.state.offset):wm(this.camera.pose.offset,this.state.offset,l),{longitude:d,latitude:f}=r?{longitude:this.state.longitude,latitude:this.state.latitude}:Tm({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},t);if(Sh(n,this.camera.pose.fov)||wh(u,this.camera.pose.offset)||Sh(o,this.camera.pose.distance)||Sh(d,this.camera.pose.longitude,Math.PI*2)||Sh(f,this.camera.pose.latitude)){let e={x:u.x,y:u.y,z:u.z},t={fov:n};return Object.assign(e,{distance:o}),Object.assign(t,{longitude:d,latitude:f}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(t,0).catch(K),this.controller.locationMotion.set(e,0).catch(K),!0}}else{let e=Math.PI/45,t=r?this.state.fov:Cm(this.camera.pose.fov,this.state.fov,1),{longitude:n,latitude:i}=r?{longitude:this.state.longitude,latitude:this.state.latitude}:Tm({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},e),a=this.state.distance,o=new c.Vector3().copy(this.state.offset);if(Sh(a,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),wh(o,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),Sh(n,this.camera.pose.longitude,Math.PI*2)||Sh(i,this.camera.pose.latitude)||Sh(t,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:n,latitude:i,fov:t},0).catch(K),!0}if(this.stateSynced=!0,i===!1&&this.emit(`state.synced`,Q(`state.synced`,{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){let t=this.currentMode;if(!(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)||this.modelScene.loaded){let e=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(let t of e)this.controller instanceof Gv.Panorama&&t.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(t):t()}}return!1}ready(e={}){return new Promise(t=>{var n;this.readyCallbacks.push(Object.assign(t,{tile:(n=e.tile)==null?!1:n}))}).then(()=>this.model.initReady).then(K)}requestFullscreen(){var e;if(!Oh)return;let t=(e=this.getElement())==null?void 0:e.parentNode;t&&`requestFullscreen`in t&&typeof document<`u`&&document.fullscreenElement===null&&t.requestFullscreen()}exitFullscreen(){typeof document<`u`&&document.fullscreenElement&&`exitFullscreen`in document&&document.exitFullscreen()}throwError(e){this.hasListener(`error`)?this.emit(`error`,e):console.error(e)}bindModel(e){let t=()=>{si.shared.add(()=>{this.emit(`model.load`,Q(`model.load`,{work:e.work,model:e,error:null}))},!0)},n=t=>{let{error:n}=t;this.emit(`model.error`,Q(`model.error`,{work:e.work,model:e,error:n})),this.throwError(n)},r=()=>{this.emit(`model.changeShownFloor`,Q(`model.changeShownFloor`,{work:e.work,model:e,error:null}))},i=t=>{this.emit(`models.tileLoad`,Q(`model.tileLoad`,{work:e.work,model:e,tile:t.tile}))},a=t=>{this.emit(`models.tileUnload`,Q(`model.tileUnload`,{work:e.work,model:e,tile:t.tile}))},o=()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),e.removeEventListener(`changeShownFloor`,r),e.removeEventListener(`tileLoad`,i),e.removeEventListener(`tileUnload`,a),e.removeEventListener(`dispose`,o)};e.addEventListener(`load`,t),e.addEventListener(`error`,n),e.addEventListener(`changeShownFloor`,r),e.addEventListener(`tileLoad`,i),e.addEventListener(`tileUnload`,a),e.addEventListener(`dispose`,o),this.emit(`model.request`,Q(`model.request`,{work:e.work,model:e,error:null}))}bindWorkFetcher(e){let t=this,n=e.workCode,r=e.allowHosts,i=new gr({get networkSubscribe(){return t.networkSubscribe},requestProxy(e){return Promise.resolve(e).then(e=>t.requestProxy(e,n)).then(e=>{let t=Up(e,r);return t instanceof Error?Promise.reject(t):t})}});Df(this.fiveId,e,i)}commonParams(){return{fiveId:this.fiveId,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,camera:this.camera,renderer:this.renderer,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}}applyController(t,n){if(!this.renderer)throw Error(`renderer is not initialized.`);let r=Gv[t];this.currentMode=t;let i=new r(n);for(let e of qv)i.on(e,(...t)=>{if(this.emit(e,...t))return!1});{let e=Gv[t].initAnimationEndState(n),r=n.initial.userAction;Fh(this.state,e)||(Ph(this.state,e),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state}))),this.emit(`currentState.change`,Q(`currentState.change`,{userAction:r,state:this.getCurrentState()}))}return i.on(`camera.update`,e=>{var t;if(this.controller){let n=this.controller.getTargetState();e.userAction&&this.syncingState===!1&&this.state.mode===n.mode&&!Fh(this.state,n)&&(Ph(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:e.userAction,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}this.emit(`currentState.change`,Q(`currentState.change`,{userAction:e.userAction,state:this.getCurrentState()}))}),i.on(`initAnimation.start`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!Fh(this.state,n)&&(Ph(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`initAnimation.end`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!Fh(this.state,n)&&(Ph(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.moveTo`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!Fh(this.state,n)&&(Ph(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.arrived`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!Fh(this.state,n)&&(Ph(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.cancel`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!Fh(this.state,n)&&(Ph(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.error`,e=>{var t;let{state:n}=e;this.state.mode===n.mode&&!Fh(this.state,n)&&(Ph(this.state,n),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.moveTo`,e=>{let{userAction:t}=e;this.emit(`currentState.change`,Q(`currentState.change`,{userAction:t,state:this.getCurrentState()}))}),i.on(`pano.request`,e=>{this.emit(`pano.request`,e),e.defaultPrevented||this.moveToPano(e.state,e.options,e.userAction)}),i.on(`vr.requestExit`,()=>{this.currentMode===e.Mode.VRPanorama&&(this.exitFullscreen(),this.changeMode(e.Mode.Panorama))}),i.on(`error`,e=>this.throwError(e)),i}removeEventListeners(){}get internalLightsEnabled(){let e=this.scene.children.find(e=>e.name===`internalLights`);return e?e.visible:!1}set internalLightsEnabled(e){let t=this.scene.children.find(e=>e.name===`internalLights`);t&&(t.visible=e),t=this.modelScene.children.find(e=>e.name===`internalLights`),t&&(t.visible=e)}get scissor(){return this.viewport}setScissor(e){return this.setViewport(e)}getPose(){let{longitude:e,latitude:t,fov:n,offset:r,distance:i}=this.camera.copyPose();return{longitude:e,latitude:t,fov:n,offset:r.clone(),distance:i}}getLongitudeAndLatitude(){let{longitude:e,latitude:t}=this.getPose();return{longitude:e,latitude:t}}getOffset(){return this.getPose().offset}getCameraLocal(){if(this.pano.workCode&&this.controller&&this.works){let e=this.works.getObserver(this.pano);if(e){let t=new c.Object3D;t.matrix.copy(e.matrix).premultiply(e.work.transform),t.matrix.decompose(t.position,t.quaternion,t.scale),t.matrixAutoUpdate=!1;let n=new c.Vector3(0,0,-1);n.applyQuaternion(this.camera.quaternion);let r=t.quaternion.clone().inverse();return n.applyQuaternion(r),{theta:Math.atan2(n.x,-n.z),phi:-Math.asin(n.y),lookAtVector:n}}}return null}addPass(e){this.fiveRenderer.composer.addPass(e)}removePass(e){let t=this.fiveRenderer.composer.passes.indexOf(e);t!==-1&&this.fiveRenderer.composer.passes.splice(t,1)}insertPass(e,t){this.fiveRenderer.composer.insertPass(e,t)}get renderMode(){return this.fiveRenderer.renderMode}set renderMode(e){this.fiveRenderer.renderMode=e}get enableHQ(){return this.fiveRenderer.renderMode===`point-cloud-high-quality`}set enableHQ(e){this.fiveRenderer.renderMode=e?`point-cloud-high-quality`:`default`,this.needsRender=!0}get enableEDL(){return this.eyeDomeLightingPass.enabled}set enableEDL(e){this.eyeDomeLightingPass.enabled=e,this.needsRender=!0}get enableAdaptiveLuminance(){return this.adaptiveLuminancePass.enabled}set enableAdaptiveLuminance(e){this.adaptiveLuminancePass.enabled=e,this.needsRender=!0}get enableIOSEDR(){return!1}set enableIOSEDR(e){}get enablePostProcessing(){return!0}set enablePostProcessing(e){}get modelSceneNeedsRender(){return this.modelScene.needsRender}set modelSceneNeedsRender(e){this.modelScene.needsRender=e}};Hy.Mode={Panorama:`Panorama`,Model:`Model`,Floorplan:`Floorplan`,Topview:`Topview`,Mapview:`Mapview`,VRPanorama:`VRPanorama`,XRPanorama:`XRPanorama`},typeof window<`u`&&Object.assign(window,{__FIVE_DEBUG__:{THREE:c,constructor:Hy,instances:Vy}});var Uy=class{static createButton(e){let t=document.createElement(`button`);function n(){t.style.display=``,t.style.cursor=`pointer`,t.style.left=`calc(50% - 50px)`,t.style.width=`100px`,t.textContent=`ENTER VR`,t.onmouseenter=function(){t.style.opacity=`1.0`},t.onmouseleave=function(){t.style.opacity=`0.5`},t.onclick=function(){e&&e()}}function r(){t.style.display=``,t.style.cursor=`auto`,t.style.left=`calc(50% - 75px)`,t.style.width=`150px`,t.onmouseenter=null,t.onmouseleave=null,t.onclick=null}function i(){r(),t.textContent=`VR NOT SUPPORTED`}function a(e){e.style.position=`absolute`,e.style.bottom=`20px`,e.style.padding=`12px 6px`,e.style.border=`1px solid #fff`,e.style.borderRadius=`4px`,e.style.background=`rgba(0,0,0,0.1)`,e.style.color=`#fff`,e.style.font=`normal 13px sans-serif`,e.style.textAlign=`center`,e.style.opacity=`0.5`,e.style.outline=`none`,e.style.zIndex=`999`}if(`xr`in navigator)return t.id=`VRButton`,t.style.display=`none`,a(t),navigator.xr.isSessionSupported(`immersive-vr`).then(function(e){e?n():i()}),t;{let e=document.createElement(`a`);return window.isSecureContext===!1?(e.href=document.location.href.replace(/^http:/,`https:`),e.innerHTML=`WEBXR NEEDS HTTPS`):(e.href=`https://immersiveweb.dev/`,e.innerHTML=`WEBXR NOT AVAILABLE`),e.style.left=`calc(50% - 90px)`,e.style.width=`180px`,e.style.textDecoration=`none`,a(e),e}}};exports.AdaptiveLuminancePass=Am,exports.AnimationFrameLoop=si,exports.BoundingMesh=ep,exports.Camera=tn,exports.CustomShader=dn,exports.PBMCustomShader=dn,exports.EffectComposer=om,exports.EyeDomeLightingPass=Nm,exports.Fetcher=gr,exports.Five=Hy,exports.FivePass=cm,exports.FiveRenderer=Zm,exports.FullScreenQuad=sm,exports.Histogram=bm,exports.InternalWebGLRenderer=Qm,exports.Model=Gf,exports.ModelScene=np,exports.Motion=X,exports.NetworkSubscribe=dr,exports.PBMContainer=Xn,exports.PBMGSObject=$n,exports.PBMGroup=wt,exports.PBMMesh=bn,exports.PBMMeshMaterial=yn,exports.PBMPanoFilter=fn,exports.PBMPointCloud=An,exports.PBMPointCloudMaterial=kn,exports.PBMSkinnedMesh=xn,exports.PBMUpdateable=un,exports.PROXY_CONTROLLER_EVENT_NAMES=qv,exports.PanoCircleMesh=uh,exports.PanoCircleMeshCustom=bh,exports.PanoCircleMeshSolid=hh,exports.Parameter=G,exports.Scene=ah,exports.Subscribe=ln,exports.TextureLoader=yi,exports.Tile=Bl,exports.Tile3D=wf,exports.Tile3DModel=wf,exports.TileCache=fd,exports.TileNode=td,exports.TileRequestScheduler=ld,exports.Tileset=vd,exports.Trajectory=ad,exports.TrajectoryNode=od,exports.Work=tm,exports.WorkResolvedObserver=im,exports.XRButton=Uy,exports.controllersDefaultInitArgs=Kv,exports.coordinatesToVector=Ht,exports.createDebugBoundingMesh=Fl,exports.createWorks=am,exports.defaultImageURLTransform=Xr,exports.draco=io,exports.getViewportScale=Qv,exports.headingToLongitude=Gt,exports.imageSupport=Nr,exports.isBoundingVolume=Al,exports.isPanoId=xp,exports.ktx2=po,exports.loadAt3d=ia,exports.loadB3dm=fs,exports.loadDome=ca,exports.loadDomez=ha,exports.loadFbx=Dc,exports.loadGltf=xs,exports.loadPbm=Ii,exports.loadPly=Cs,exports.loadPnts=ys,exports.loadSplat=ul,exports.loadSpz=is,exports.loadX3p=sl,exports.longitudeToHeading=Wt,exports.makeBoundingVolume=jl,exports.panoEqual=bp,exports.panoParse=yp,exports.panoStringify=Z,exports.parseWork=nm,exports.vectorToCoordinates=Ut,exports.workToJson=sp;