@rr0/ufoathome 0.202.0 → 0.202.1

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 (98) hide show
  1. package/dist-embed-scene/{AirshipEditor-BnRmKeVs.js → AirshipEditor-guE_ib3z.js} +1 -1
  2. package/dist-embed-scene/{AirshipFlight-C9DSPGwk.js → AirshipFlight-DzW0313e.js} +1 -1
  3. package/dist-embed-scene/{BalloonEditor-BehJs6H-.js → BalloonEditor-BIsCy_y4.js} +2 -2
  4. package/dist-embed-scene/{BalloonFlight-BYn4diw1.js → BalloonFlight-gunghgAq.js} +1 -1
  5. package/dist-embed-scene/{BirdEditor-dOp1sGsz.js → BirdEditor-CuLv4Ij5.js} +1 -1
  6. package/dist-embed-scene/{BirdFlock-CfJeXvWu.js → BirdFlock-L3dYU2K_.js} +1 -1
  7. package/dist-embed-scene/{DroneEditor-CBoR4fJ_.js → DroneEditor-BQWPhTyf.js} +1 -1
  8. package/dist-embed-scene/{DroneFlight-DSE1OXqh.js → DroneFlight-ERYah68l.js} +1 -1
  9. package/dist-embed-scene/{DroneParameters-D3EOg4oe.js → DroneParameters-CoWQympS.js} +1 -1
  10. package/dist-embed-scene/{LanternEditor-CbcA7K8y.js → LanternEditor-BpCyb79i.js} +1 -1
  11. package/dist-embed-scene/{ModuleSession-XnOI5Mcr.js → ModuleSession-bj7QHWjO.js} +2 -2
  12. package/dist-embed-scene/ModuleThree-DRsA8rtL.js +1 -0
  13. package/dist-embed-scene/SearchlightSystem-Ddws2hQY.js +1 -0
  14. package/dist-embed-scene/{SkyLantern-Dp_B40X0.js → SkyLantern-C3BSxHtq.js} +1 -1
  15. package/dist-embed-scene/rr0-scene.mjs +85 -64
  16. package/dist-embed-sighting/{CaseReportExport-CkWf0HNx.js → CaseReportExport-BtGCWD7H.js} +1 -1
  17. package/dist-embed-sighting/{ModuleSession-ChJsGuTn.js → ModuleSession-DztK084a.js} +2 -2
  18. package/dist-embed-sighting/{ModuleThree-whEZoXYF.js → ModuleThree-BLNSm2eY.js} +1 -1
  19. package/dist-embed-sighting/SearchlightSystem-PEMBDW1s.js +1 -0
  20. package/dist-embed-sighting/rr0-sighting.mjs +90 -69
  21. package/dist-embed-sighting-editor/{BallesterGuaspAssessor-Bylahnc2.js → BallesterGuaspAssessor-CJyRqwvh.js} +1 -1
  22. package/dist-embed-sighting-editor/{CaseElement-DPlro-7S.js → CaseElement-D80gHg4r.js} +1 -1
  23. package/dist-embed-sighting-editor/{CaseReportExport-C1g5C8hi.js → CaseReportExport-Bv6FWPs2.js} +1 -1
  24. package/dist-embed-sighting-editor/{ControlPasses-BMEmppip.js → ControlPasses-CaVHMhEY.js} +1 -1
  25. package/dist-embed-sighting-editor/{CoverageAssessor-uzQnTEH8.js → CoverageAssessor-CTfHqAd_.js} +1 -1
  26. package/dist-embed-sighting-editor/{GLTFLoader-2Zbfb3kh.js → GLTFLoader-CrRPu-Pt.js} +1 -1
  27. package/dist-embed-sighting-editor/{HeadlightSystem-CBmEcC9f.js → HeadlightSystem-BmPfcHt1.js} +1 -1
  28. package/dist-embed-sighting-editor/{HynekAssessor-uub2VxTi.js → HynekAssessor-nBidt6QV.js} +1 -1
  29. package/dist-embed-sighting-editor/{InterviewEditorElement-_1fa2bG7.js → InterviewEditorElement-CQWfYlGL.js} +2 -2
  30. package/dist-embed-sighting-editor/{ModuleConformance-Cr6fM28A.js → ModuleConformance-CpMYkYgb.js} +2 -2
  31. package/dist-embed-sighting-editor/{ModuleSession-WA6lqfV6.js → ModuleSession-b_pmjUfP.js} +2 -2
  32. package/dist-embed-sighting-editor/ModuleThree-B_FZVqsf.js +1 -0
  33. package/dist-embed-sighting-editor/{ModulesPanelElement-BsRg3mzl.js → ModulesPanelElement-D0gn9Z-y.js} +3 -3
  34. package/dist-embed-sighting-editor/{NearestApproach-Bnx9Ld5_.js → NearestApproach-Bxo_N7a9.js} +1 -1
  35. package/dist-embed-sighting-editor/{PoherAssessor-CNj_Nyci.js → PoherAssessor-CEVA26zd.js} +1 -1
  36. package/dist-embed-sighting-editor/{RailwaySystem-6bwbv8UB.js → RailwaySystem-Ceb0_MVz.js} +1 -1
  37. package/dist-embed-sighting-editor/{ReferenceSystem-8QgwbbAG.js → ReferenceSystem-B15kw0uH.js} +1 -1
  38. package/dist-embed-sighting-editor/SearchlightSystem-D7sdsRYn.js +1 -0
  39. package/dist-embed-sighting-editor/{SightingElement-BQdiez39.js → SightingElement-Bp-t_EAF.js} +1 -1
  40. package/dist-embed-sighting-editor/{TraceSystem-DZMUxSn-.js → TraceSystem-Bv4kLpie.js} +2 -2
  41. package/dist-embed-sighting-editor/{WaterSystem-CB5jE7qB.js → WaterSystem-Bbk_RJKg.js} +1 -1
  42. package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +193 -172
  43. package/dist-embed-ufoathome/{AdsbLolArchiveProvider-KbJPyJ97.js → AdsbLolArchiveProvider-v1sSwhN1.js} +1 -1
  44. package/dist-embed-ufoathome/{Aurora-C_mCH4JM.js → Aurora-Dc4u2vEw.js} +1 -1
  45. package/dist-embed-ufoathome/{AuroraEditor-Dzvgh6e0.js → AuroraEditor-CeLzRDPj.js} +1 -1
  46. package/dist-embed-ufoathome/{AuroraSimulation-BRUnHmlp.js → AuroraSimulation-BT1CdWX5.js} +1 -1
  47. package/dist-embed-ufoathome/{BallesterGuaspAssessor-DurdUgbG.js → BallesterGuaspAssessor-CPW-Omah.js} +1 -1
  48. package/dist-embed-ufoathome/{BeamEditor-Ccvx7l7x.js → BeamEditor-BS73mBZU.js} +1 -1
  49. package/dist-embed-ufoathome/{BeamSystem-CPM8m17q.js → BeamSystem-C5EpRhij.js} +1 -1
  50. package/dist-embed-ufoathome/{BodyEditor-BG--NjnZ.js → BodyEditor-BV8WwzAj.js} +1 -1
  51. package/dist-embed-ufoathome/{CaseEditorElement-0J_TCeiq.js → CaseEditorElement-HR8RFluQ.js} +6 -6
  52. package/dist-embed-ufoathome/{CaseElement-CRXPyMMR.js → CaseElement-vCbCfGOv.js} +3 -3
  53. package/dist-embed-ufoathome/{CaseReportExport-DKrBXPgZ.js → CaseReportExport-XLbFCkPg.js} +3 -3
  54. package/dist-embed-ufoathome/{ColumnResize-DV-byvDt.js → ColumnResize-CEXrq3KB.js} +3 -3
  55. package/dist-embed-ufoathome/{ControlPasses-CKvTCqTI.js → ControlPasses-CKOU_3lG.js} +1 -1
  56. package/dist-embed-ufoathome/{CoverageAssessor-MeOMUjkZ.js → CoverageAssessor-BYMf3Qhv.js} +1 -1
  57. package/dist-embed-ufoathome/{Flightradar24Provider-DxTfswSh.js → Flightradar24Provider-_QPbhh5s.js} +1 -1
  58. package/dist-embed-ufoathome/{GLTFLoader-pi-JKaNa.js → GLTFLoader-DQeHB-Bk.js} +1 -1
  59. package/dist-embed-ufoathome/{GeoJsonExport-iyhoKOUU.js → GeoJsonExport-Pq_pPvjK.js} +1 -1
  60. package/dist-embed-ufoathome/{GeographicFigures-DBmuFlvH.js → GeographicFigures-KII55iXE.js} +1 -1
  61. package/dist-embed-ufoathome/{HynekAssessor-Bda6csgM.js → HynekAssessor-wCDhgIB8.js} +1 -1
  62. package/dist-embed-ufoathome/{InterviewEditorElement-BA060rqJ.js → InterviewEditorElement-BSwkegEp.js} +4 -4
  63. package/dist-embed-ufoathome/{InterviewElement-DvqsCA3I.js → InterviewElement-CfkDtybc.js} +1 -1
  64. package/dist-embed-ufoathome/{KmlExport-DEPgRRWe.js → KmlExport-BMNwwys8.js} +1 -1
  65. package/dist-embed-ufoathome/{LaserBeam--dquPX_h.js → LaserBeam-B-tlAzNB.js} +1 -1
  66. package/dist-embed-ufoathome/{LaunchEditor-D3P0GkLr.js → LaunchEditor-Cy5D-gwU.js} +1 -1
  67. package/dist-embed-ufoathome/{LaunchPlume-w4l4TR4A.js → LaunchPlume-D-vSb8tJ.js} +1 -1
  68. package/dist-embed-ufoathome/{LaunchSimulation-BpZd-Nov.js → LaunchSimulation-CZ8Oba00.js} +1 -1
  69. package/dist-embed-ufoathome/{ModelSource-Csnm3RH_.js → ModelSource-HSiigkeO.js} +1 -1
  70. package/dist-embed-ufoathome/{ModelThumbnails-Cnt2GxTb.js → ModelThumbnails-DWvRMmj_.js} +1 -1
  71. package/dist-embed-ufoathome/{ModelViewer-DOfAkPgK.js → ModelViewer-CM7qTW8F.js} +1 -1
  72. package/dist-embed-ufoathome/{ModulesPanelElement-DH1oroWm.js → ModulesPanelElement-DsOa2zH0.js} +1 -1
  73. package/dist-embed-ufoathome/{NearestApproach-DJ98M81-.js → NearestApproach-PAsV5RlG.js} +1 -1
  74. package/dist-embed-ufoathome/{PoherAssessor-4zSdFnFp.js → PoherAssessor-CniYlhUl.js} +1 -1
  75. package/dist-embed-ufoathome/{QuestionnaireFeed-W69udpmT.js → QuestionnaireFeed-CpZqkxlt.js} +1 -1
  76. package/dist-embed-ufoathome/{QuestionnaireForm-U78nFPn5.js → QuestionnaireForm-LkllpNx-.js} +1 -1
  77. package/dist-embed-ufoathome/{QuestionnaireImport-Q5uHxQwU.js → QuestionnaireImport-CNROmkT2.js} +1 -1
  78. package/dist-embed-ufoathome/{ReentryEditor-DEi9nT0z.js → ReentryEditor-Qax1sT82.js} +1 -1
  79. package/dist-embed-ufoathome/{ReentrySimulation-CSO1vgro.js → ReentrySimulation-CTeCaxZl.js} +1 -1
  80. package/dist-embed-ufoathome/{ReferenceSystem--tiMGm4e.js → ReferenceSystem-CM27OCUo.js} +1 -1
  81. package/dist-embed-ufoathome/{ScenarioReadings-Dzdgopl3.js → ScenarioReadings-Is3HX0n0.js} +1 -1
  82. package/dist-embed-ufoathome/{ScenarioSweep-CMcleprC.js → ScenarioSweep-BbtX26Fi.js} +1 -1
  83. package/dist-embed-ufoathome/{SearchlightEditor--1uL8bTa.js → SearchlightEditor-PuLz84pp.js} +1 -1
  84. package/dist-embed-ufoathome/SearchlightSystem-B-tHvY1M.js +1 -0
  85. package/dist-embed-ufoathome/{ShareDialogElement-Dlfy9NCE.js → ShareDialogElement-EzLob2Tz.js} +92 -71
  86. package/dist-embed-ufoathome/{SightingElement-BJSNmFM6.js → SightingElement--qpGoyxL.js} +2 -2
  87. package/dist-embed-ufoathome/{TraceSystem-Cq2TgP-u.js → TraceSystem-8XQX03MS.js} +1 -1
  88. package/dist-embed-ufoathome/{VideoButton-MRJlVNm_.js → VideoButton-WNtEngz-.js} +1 -1
  89. package/dist-embed-ufoathome/rr0-ufoathome.mjs +2 -2
  90. package/dist-embed-ufoathome/{surroundingsSources--qffL_nJ.js → surroundingsSources-UHKGesPa.js} +1 -1
  91. package/dist-embed-ufoathome/{trafficRuntime-CTCGr90P.js → trafficRuntime-CgY_7-NH.js} +1 -1
  92. package/package.json +1 -1
  93. package/dist-embed-scene/ModuleThree-BTQgimAj.js +0 -1
  94. package/dist-embed-scene/SearchlightSystem-CX1_nBkz.js +0 -1
  95. package/dist-embed-sighting/SearchlightSystem-B2-MzG4x.js +0 -1
  96. package/dist-embed-sighting-editor/ModuleThree-CB_EjTOI.js +0 -1
  97. package/dist-embed-sighting-editor/SearchlightSystem-CEG52QDx.js +0 -1
  98. package/dist-embed-ufoathome/SearchlightSystem-7bntVtp_.js +0 -1
@@ -1,3 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleThree-BTQgimAj.js","./rr0-scene.mjs"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleThree-DRsA8rtL.js","./rr0-scene.mjs"])))=>i.map(i=>d[i]);
2
2
  import{f as g,d as w,_ as b,M as p}from"./rr0-scene.mjs";class o{static STORAGE_KEY="ufoathome.modules";static FORMAT=1;static empty(){return{format:1,modules:[]}}static read(t=o.storage()){try{const e=t?.getItem(o.STORAGE_KEY);return e?o.parse(e):o.empty()}catch{return o.empty()}}static write(t,e=o.storage()){try{return e?(t.modules.length===0?e.removeItem(o.STORAGE_KEY):e.setItem(o.STORAGE_KEY,o.text(t)),!0):!1}catch{return!1}}static parse(t){const e=JSON.parse(t);if(e===null||typeof e!="object"||!Array.isArray(e.modules))throw new Error("not a UFO@home module list");if(typeof e.format=="number"&&e.format>o.FORMAT)throw new Error(`format ${e.format} is newer than ${o.FORMAT}`);const s=new Set,i=[];for(const r of e.modules)typeof r?.url!="string"||s.has(r.url)||(s.add(r.url),i.push({url:r.url,enabled:r.enabled!==!1}));return{format:1,modules:i}}static text(t){return JSON.stringify({format:o.FORMAT,modules:t.modules},null,2)+`
3
- `}static storage(){try{return typeof localStorage>"u"?void 0:localStorage}catch{return}}}class E{constructor(t,e){this.attribution=t,this.models=e}async entries(t){return t?this.models.filter(e=>[e.kind].flat().includes(t)):[...this.models]}async entry(t){return this.models.find(e=>e.id===t)}}class f{attribution;fetchImpl;tileUrlTemplate;constructor(t){this.attribution=t.attribution,this.tileUrlTemplate=t.tileUrlTemplate,this.fetchImpl=t.fetchImpl??fetch.bind(globalThis)}getImageryTexture(t,e){return g(t,e,s=>f.tileUrl(this.tileUrlTemplate,s),this.fetchImpl)}static tileUrl(t,e){return t.replaceAll("{z}",String(e.z)).replaceAll("{x}",String(e.x)).replaceAll("{y}",String(e.y))}}class v extends Error{constructor(t,e){super(`${t}: ${e}`),this.url=t,this.reason=e,this.name="ModuleManifestError"}}class d{static FORMAT=1;static check(t,e){const s=n=>{throw new v(e,n)};(t===null||typeof t!="object"||Array.isArray(t))&&s("not a JSON object");const i=t;typeof i.format!="number"&&s('no "format"'),i.format>d.FORMAT&&s(`format ${i.format} is newer than ${d.FORMAT}, which this version reads`),(typeof i.id!="string"||!/^[a-z0-9][a-z0-9._-]*$/.test(i.id))&&s(`"id" must be lowercase letters, digits, '.', '_' or '-'`),(typeof i.name!="string"||i.name.trim()==="")&&s('no "name"'),i.script!==void 0&&typeof i.script!="string"&&s('"script" must be an address');const r=i.contributes??{};for(const n of["imagery","elevation"]){const c=r[n];c!==void 0&&(Array.isArray(c)||s(`"contributes.${n}" must be a list`),c.forEach((l,m)=>{for(const h of["id","name","credit","creditUrl","tiles"])(typeof l?.[h]!="string"||l[h]==="")&&s(`"contributes.${n}[${m}].${h}" is missing`);["{z}","{x}","{y}"].every(h=>l.tiles.includes(h))||s(`"contributes.${n}[${m}].tiles" must hold {z}, {x} and {y}`)}))}const a=r.models;return a!==void 0&&(Array.isArray(a)||s('"contributes.models" must be a list'),a.forEach((n,c)=>{for(const l of["id","name","file"])(typeof n?.[l]!="string"||n[l]==="")&&s(`"contributes.models[${c}].${l}" is missing`);n.kind===void 0&&s(`"contributes.models[${c}].kind" is missing`),(!n.credit||typeof n.credit!="object")&&s(`"contributes.models[${c}].credit" is missing: a model is shown with its author and licence`)})),i}static contributions(t,e){const s=t.contributes??{},i={};if(s.imagery?.length&&(i.imagery=s.imagery.map(r=>({id:r.id,name:r.name,credit:r.credit,creditUrl:r.creditUrl,create:a=>new f({tileUrlTemplate:d.absoluteTemplate(r.tiles,e),attribution:r.credit,fetchImpl:a})}))),s.elevation?.length&&(i.elevation=s.elevation.map(r=>({id:r.id,name:r.name,credit:r.credit,creditUrl:r.creditUrl,create:a=>new w({tileUrlTemplate:d.absoluteTemplate(r.tiles,e),fetchImpl:a})}))),s.models?.length){const r=s.models.map(({file:n,...c})=>({...c,url:new URL(n,e).href})),a=t.credit??t.name;i.decorModels=[{id:`${t.id}-models`,name:t.name,credit:a,creditUrl:t.creditUrl??e,create:()=>new E(a,r)}]}return i}static module(t,e,s={}){const i=d.contributions(t,e);for(const[r,a]of Object.entries(s))Array.isArray(a)&&(i[r]=[...i[r]??[],...a]);return{id:t.id,name:t.name,credit:t.credit,creditUrl:t.creditUrl,url:e,contributes:i}}static absoluteTemplate(t,e){const s=t.replaceAll("{z}","__Z__").replaceAll("{x}","__X__").replaceAll("{y}","__Y__");return new URL(s,e).href.replaceAll("__Z__","{z}").replaceAll("__X__","{x}").replaceAll("__Y__","{y}")}}class T{fetchImpl;importImpl;constructor(t={}){this.fetchImpl=t.fetchImpl??fetch.bind(globalThis),this.importImpl=t.importImpl??(e=>import(e))}async load(t,e){const s=await this.fetchImpl(t);if(!s.ok)throw new Error(`${t}: HTTP ${s.status}`);const i=d.check(await s.json(),t),r=i.script!==void 0;let a={};if(r&&e.runScript){const n=new URL(i.script,t).href,c=await this.importImpl(n);if(typeof c.default!="function")throw new Error(`${n}: its default export is not a function`);const{MODULE_THREE:l}=await b(async()=>{const{MODULE_THREE:m}=await import("./ModuleThree-BTQgimAj.js");return{MODULE_THREE:m}},__vite__mapDeps([0,1]),import.meta.url);a=await c.default({manifestUrl:t,three:l})??{}}return{url:t,manifest:i,module:d.module(i,t,a),hasScript:r,scriptRun:r&&e.runScript}}}class y{constructor(t=new T,e){this.loader=t,this.storage=e}static shared=new y;changes=new EventTarget;states=new Map;config=o.empty();started;list(){const t=[...this.states.values()];return[...t.filter(e=>e.addedByPerson),...t.filter(e=>!e.addedByPerson)]}state(t){return this.states.get(t)}start(){return this.started??=this.applyConfig(o.read(this.storage)),this.started}async add(t){await this.start();const e=new URL(t,typeof location>"u"?void 0:location.href).href;return this.config.modules.some(s=>s.url===e)||(this.config={...this.config,modules:[...this.config.modules,{url:e,enabled:!0}]},this.save()),this.reload(e)}async remove(t){this.config={...this.config,modules:this.config.modules.filter(e=>e.url!==t)},this.save(),await this.reload(t)}async setEnabled(t,e){this.config={...this.config,modules:this.config.modules.map(s=>s.url===t?{...s,enabled:e}:s)},this.save(),await this.reload(t)}exportText(){return o.text(this.config)}async importText(t){const e=o.parse(t);await this.start();const s=this.config.modules.map(i=>i.url);this.config=e,this.save(),await Promise.all([...new Set([...s,...e.modules.map(i=>i.url)])].map(i=>this.reload(i)))}async require(t,e,s=!1){t?.length&&(await this.start(),await Promise.all(t.map(async i=>{let r;try{r=new URL(i,e??(typeof location>"u"?void 0:location.href)).href}catch{return}const a=this.states.get(r),n=s&&!this.trusted.has(r);if(s&&this.trusted.add(r),a&&a.status!=="off"&&!(n&&a.loaded&&!a.loaded.scriptRun))return a.status==="loading"?this.pending.get(r):void 0;this.named.add(r),await this.reload(r)})))}named=new Set;trusted=new Set;pending=new Map;async applyConfig(t){this.config=t,await Promise.all(t.modules.map(e=>this.reload(e.url)))}reload(t){const e=this.reloadNow(t);return this.pending.set(t,e),e}async reloadNow(t){const e=this.config.modules.find(a=>a.url===t),s=this.states.get(t);s?.loaded&&p.uninstall(s.loaded.module.id);const i=e!==void 0,r=e?.enabled??!0;if(!i&&!this.named.has(t))return this.states.delete(t),this.announce(),{url:t,addedByPerson:i,enabled:r,status:"off"};if(i&&!r&&!this.named.has(t))return this.set({url:t,addedByPerson:i,enabled:r,status:"off"});this.set({url:t,addedByPerson:i,enabled:r,status:"loading"});try{const a=await this.loader.load(t,{runScript:i&&r||!i&&this.trusted.has(t)});return p.install(a.module),this.set({url:t,addedByPerson:i,enabled:r,status:"installed",loaded:a})}catch(a){return this.set({url:t,addedByPerson:i,enabled:r,status:"failed",error:a instanceof Error?a.message:String(a)})}}set(t){return this.states.set(t.url,t),this.announce(),t}save(){o.write(this.config,this.storage)}announce(){this.changes.dispatchEvent(new Event("change"))}}export{y as ModuleSession};
3
+ `}static storage(){try{return typeof localStorage>"u"?void 0:localStorage}catch{return}}}class E{constructor(t,e){this.attribution=t,this.models=e}async entries(t){return t?this.models.filter(e=>[e.kind].flat().includes(t)):[...this.models]}async entry(t){return this.models.find(e=>e.id===t)}}class f{attribution;fetchImpl;tileUrlTemplate;constructor(t){this.attribution=t.attribution,this.tileUrlTemplate=t.tileUrlTemplate,this.fetchImpl=t.fetchImpl??fetch.bind(globalThis)}getImageryTexture(t,e){return g(t,e,s=>f.tileUrl(this.tileUrlTemplate,s),this.fetchImpl)}static tileUrl(t,e){return t.replaceAll("{z}",String(e.z)).replaceAll("{x}",String(e.x)).replaceAll("{y}",String(e.y))}}class v extends Error{constructor(t,e){super(`${t}: ${e}`),this.url=t,this.reason=e,this.name="ModuleManifestError"}}class d{static FORMAT=1;static check(t,e){const s=n=>{throw new v(e,n)};(t===null||typeof t!="object"||Array.isArray(t))&&s("not a JSON object");const i=t;typeof i.format!="number"&&s('no "format"'),i.format>d.FORMAT&&s(`format ${i.format} is newer than ${d.FORMAT}, which this version reads`),(typeof i.id!="string"||!/^[a-z0-9][a-z0-9._-]*$/.test(i.id))&&s(`"id" must be lowercase letters, digits, '.', '_' or '-'`),(typeof i.name!="string"||i.name.trim()==="")&&s('no "name"'),i.script!==void 0&&typeof i.script!="string"&&s('"script" must be an address');const r=i.contributes??{};for(const n of["imagery","elevation"]){const c=r[n];c!==void 0&&(Array.isArray(c)||s(`"contributes.${n}" must be a list`),c.forEach((l,m)=>{for(const h of["id","name","credit","creditUrl","tiles"])(typeof l?.[h]!="string"||l[h]==="")&&s(`"contributes.${n}[${m}].${h}" is missing`);["{z}","{x}","{y}"].every(h=>l.tiles.includes(h))||s(`"contributes.${n}[${m}].tiles" must hold {z}, {x} and {y}`)}))}const a=r.models;return a!==void 0&&(Array.isArray(a)||s('"contributes.models" must be a list'),a.forEach((n,c)=>{for(const l of["id","name","file"])(typeof n?.[l]!="string"||n[l]==="")&&s(`"contributes.models[${c}].${l}" is missing`);n.kind===void 0&&s(`"contributes.models[${c}].kind" is missing`),(!n.credit||typeof n.credit!="object")&&s(`"contributes.models[${c}].credit" is missing: a model is shown with its author and licence`)})),i}static contributions(t,e){const s=t.contributes??{},i={};if(s.imagery?.length&&(i.imagery=s.imagery.map(r=>({id:r.id,name:r.name,credit:r.credit,creditUrl:r.creditUrl,create:a=>new f({tileUrlTemplate:d.absoluteTemplate(r.tiles,e),attribution:r.credit,fetchImpl:a})}))),s.elevation?.length&&(i.elevation=s.elevation.map(r=>({id:r.id,name:r.name,credit:r.credit,creditUrl:r.creditUrl,create:a=>new w({tileUrlTemplate:d.absoluteTemplate(r.tiles,e),fetchImpl:a})}))),s.models?.length){const r=s.models.map(({file:n,...c})=>({...c,url:new URL(n,e).href})),a=t.credit??t.name;i.decorModels=[{id:`${t.id}-models`,name:t.name,credit:a,creditUrl:t.creditUrl??e,create:()=>new E(a,r)}]}return i}static module(t,e,s={}){const i=d.contributions(t,e);for(const[r,a]of Object.entries(s))Array.isArray(a)&&(i[r]=[...i[r]??[],...a]);return{id:t.id,name:t.name,credit:t.credit,creditUrl:t.creditUrl,url:e,contributes:i}}static absoluteTemplate(t,e){const s=t.replaceAll("{z}","__Z__").replaceAll("{x}","__X__").replaceAll("{y}","__Y__");return new URL(s,e).href.replaceAll("__Z__","{z}").replaceAll("__X__","{x}").replaceAll("__Y__","{y}")}}class T{fetchImpl;importImpl;constructor(t={}){this.fetchImpl=t.fetchImpl??fetch.bind(globalThis),this.importImpl=t.importImpl??(e=>import(e))}async load(t,e){const s=await this.fetchImpl(t);if(!s.ok)throw new Error(`${t}: HTTP ${s.status}`);const i=d.check(await s.json(),t),r=i.script!==void 0;let a={};if(r&&e.runScript){const n=new URL(i.script,t).href,c=await this.importImpl(n);if(typeof c.default!="function")throw new Error(`${n}: its default export is not a function`);const{MODULE_THREE:l}=await b(async()=>{const{MODULE_THREE:m}=await import("./ModuleThree-DRsA8rtL.js");return{MODULE_THREE:m}},__vite__mapDeps([0,1]),import.meta.url);a=await c.default({manifestUrl:t,three:l})??{}}return{url:t,manifest:i,module:d.module(i,t,a),hasScript:r,scriptRun:r&&e.runScript}}}class y{constructor(t=new T,e){this.loader=t,this.storage=e}static shared=new y;changes=new EventTarget;states=new Map;config=o.empty();started;list(){const t=[...this.states.values()];return[...t.filter(e=>e.addedByPerson),...t.filter(e=>!e.addedByPerson)]}state(t){return this.states.get(t)}start(){return this.started??=this.applyConfig(o.read(this.storage)),this.started}async add(t){await this.start();const e=new URL(t,typeof location>"u"?void 0:location.href).href;return this.config.modules.some(s=>s.url===e)||(this.config={...this.config,modules:[...this.config.modules,{url:e,enabled:!0}]},this.save()),this.reload(e)}async remove(t){this.config={...this.config,modules:this.config.modules.filter(e=>e.url!==t)},this.save(),await this.reload(t)}async setEnabled(t,e){this.config={...this.config,modules:this.config.modules.map(s=>s.url===t?{...s,enabled:e}:s)},this.save(),await this.reload(t)}exportText(){return o.text(this.config)}async importText(t){const e=o.parse(t);await this.start();const s=this.config.modules.map(i=>i.url);this.config=e,this.save(),await Promise.all([...new Set([...s,...e.modules.map(i=>i.url)])].map(i=>this.reload(i)))}async require(t,e,s=!1){t?.length&&(await this.start(),await Promise.all(t.map(async i=>{let r;try{r=new URL(i,e??(typeof location>"u"?void 0:location.href)).href}catch{return}const a=this.states.get(r),n=s&&!this.trusted.has(r);if(s&&this.trusted.add(r),a&&a.status!=="off"&&!(n&&a.loaded&&!a.loaded.scriptRun))return a.status==="loading"?this.pending.get(r):void 0;this.named.add(r),await this.reload(r)})))}named=new Set;trusted=new Set;pending=new Map;async applyConfig(t){this.config=t,await Promise.all(t.modules.map(e=>this.reload(e.url)))}reload(t){const e=this.reloadNow(t);return this.pending.set(t,e),e}async reloadNow(t){const e=this.config.modules.find(a=>a.url===t),s=this.states.get(t);s?.loaded&&p.uninstall(s.loaded.module.id);const i=e!==void 0,r=e?.enabled??!0;if(!i&&!this.named.has(t))return this.states.delete(t),this.announce(),{url:t,addedByPerson:i,enabled:r,status:"off"};if(i&&!r&&!this.named.has(t))return this.set({url:t,addedByPerson:i,enabled:r,status:"off"});this.set({url:t,addedByPerson:i,enabled:r,status:"loading"});try{const a=await this.loader.load(t,{runScript:i&&r||!i&&this.trusted.has(t)});return p.install(a.module),this.set({url:t,addedByPerson:i,enabled:r,status:"installed",loaded:a})}catch(a){return this.set({url:t,addedByPerson:i,enabled:r,status:"failed",error:a instanceof Error?a.message:String(a)})}}set(t){return this.states.set(t.url,t),this.announce(),t}save(){o.write(this.config,this.storage)}announce(){this.changes.dispatchEvent(new Event("change"))}}export{y as ModuleSession};
@@ -0,0 +1 @@
1
+ import{V as a,m as e,bJ as s,$ as t,a1 as r,ai as i,E as o,ad as n,Y as l,Z as b,ay as d,aj as m,ak as u,bK as M,s as B,a2 as y,o as G,h as S,aQ as h,aN as c,aR as f,G as p,b2 as L,F as x,bL as C,a3 as E,bM as P,bN as g,bO as D,C as T,a0 as A,B as F,t as N,bP as O,ah as V,a6 as j}from"./rr0-scene.mjs";const v={AdditiveBlending:j,BackSide:V,BoxGeometry:O,BufferAttribute:N,BufferGeometry:F,CanvasTexture:A,Color:T,ConeGeometry:D,CylinderGeometry:g,DataTexture:P,DoubleSide:E,Euler:C,Float32BufferAttribute:x,FrontSide:L,Group:p,Line:f,LineBasicMaterial:c,LineSegments:h,Matrix4:S,Mesh:G,MeshBasicMaterial:y,MeshStandardMaterial:B,NormalBlending:M,Object3D:u,PlaneGeometry:m,PointLight:d,Points:b,PointsMaterial:l,Quaternion:n,ShaderMaterial:o,SphereGeometry:i,Sprite:r,SpriteMaterial:t,TorusGeometry:s,Vector2:e,Vector3:a};export{v as MODULE_THREE};
@@ -0,0 +1 @@
1
+ import{BeamSystem as C}from"./BeamSystem-DtRwoKHP.js";import{L}from"./LaserBeam-AjgGxDIq.js";import{bx as N,by as M,bz as U,R as D}from"./rr0-scene.mjs";class E{static APERTURE_M=.6;static NEAR_STEP_M=10;static FAR_STEP_M=250;static STEP_SHARE=.05;static CLOUD_STEP_M=25;static SPENT=.003;beams=new C;placed;lineOwners=[];constructor(){this.beams.group.name="searchlights"}get object(){return this.beams.group}get drawnCount(){return this.beams.drawnCount}update(a,o,t){const c=[],r=[];this.lineOwners=[];const i=t.clouds;i?i.dim(this.beams.material):N.apply(this.beams.material,[]);const l=t.wind??{eastMS:0,northMS:0};for(const s of M.onAt(a,o)){const b=this.whereOf(s,t.reference),g=t.origin.x+b.eastM*t.eastScale,u=t.origin.z-b.northM,p=t.groundYAt(g,u)+(s.heightM??M.DEFAULT_HEIGHT_M),e=s.intensityCd??M.DEFAULT_INTENSITY_CD,m=s.divergenceDeg??M.DEFAULT_DIVERGENCE_DEG,S=m*Math.PI/180,w=M.fluxLm(e,m),n=U.ofTemperature(s.colourTemperatureK??M.DEFAULT_TEMPERATURE_K),T=C.white(n);M.aimsAt(s,o).forEach((A,_)=>{const d=M.axisOf(A),h={x:d.east,y:d.up,z:-d.north},R={windAlongMS:l.eastMS*d.east+l.northMS*d.north,windAcrossMS:l.eastMS*d.north-l.northMS*d.east},{points:y,throughBelow:I}=this.walk({x:g,y:p,z:u},h,S,w,o,t,R);if(c.push({id:s.id,points:y,spectrum:T}),this.lineOwners.push({id:s.id,beam:_}),i&&h.y>.02&&i.bottomY>p){const v=(i.bottomY-p)/h.y,P=t.air.transmittance(t.siteElevationM+p,t.siteElevationM+i.bottomY,v),x=e*t.relativeScale;r.push({x:g,y:p,z:u,axis:h,fwhmRad:S,rgb:[x*n[0]*P[0],x*n[1]*P[1],x*n[2]*P[2]],throughCloudsBelow:I})}})}this.beams.drawLines(c,t),t.lightClouds?.(r)}walk(a,o,t,c,r,i,l){const s=i.clouds,b=[],g=[],u=[],p=i.siteElevationM+a.y;let e=0,m=0;for(;;){const w=a.x+o.x*e,n=a.y+o.y*e,T=a.z+o.z*e,A=s!==void 0&&n>=s.bottomY&&n<=s.topY,_=Math.exp(-m),d=e>0?i.air.transmittance(p,i.siteElevationM+n,e)[1]:1;if(b.push({x:w,y:n,z:T,altitudeM:i.siteElevationM+n,widthM:E.APERTURE_M+t*e,powerW:c*d*_,haze:L.patchAt(e,r,{...l,patchiness:L.DEFAULT_PATCHINESS})}),g.push(n),u.push(_),e>=M.RANGE_M||n>=M.CEILING_M||_<E.SPENT)break;const h=A?E.CLOUD_STEP_M:Math.min(E.FAR_STEP_M,Math.max(E.NEAR_STEP_M,e*E.STEP_SHARE));if(s&&(A||n<s.bottomY&&n+o.y*h>s.bottomY)){const R=A?h:Math.max(0,(s.bottomY-n)/Math.max(o.y,1e-6));if(!A){e+=Math.max(1,R);continue}m+=s.extinctionAt(w+o.x*h/2,n+o.y*h/2,T+o.z*h/2)*h}e+=h}return{points:b,throughBelow:w=>{const n=g.findIndex(T=>T>=w);return n<0?u[u.length-1]:u[n]}}}whereOf(a,o){(!this.placed||this.placed.lat!==o.lat||this.placed.lng!==o.lng)&&(this.placed={...o,at:new Map});let t=this.placed.at.get(a);if(!t){const c=D.ecef({lat:o.lat,lng:o.lng,heightM:0}),r=D.ecef({lat:a.lat,lng:a.lng,heightM:0}),i=o.lat*Math.PI/180,l=o.lng*Math.PI/180,s=[r[0]-c[0],r[1]-c[1],r[2]-c[2]];t={eastM:-Math.sin(l)*s[0]+Math.cos(l)*s[1],northM:-Math.sin(i)*Math.cos(l)*s[0]-Math.sin(i)*Math.sin(l)*s[1]+Math.cos(i)*s[2]},this.placed.at.set(a,t)}return t}pick(a,o,t){const c=this.beams.pickAt(a,o,t.toleranceRad);if(c)return{id:c.id,distanceM:c.distanceM,detail:{beam:(this.lineOwners[c.line]?.beam??0)+1}}}dispose(){this.beams.dispose()}}export{E as SearchlightSystem};
@@ -1 +1 @@
1
- import{bB as w}from"./rr0-scene.mjs";class i{static COMMON={envelopeVolumeM3:.19,massKg:.065,fuelKg:.03,burnS:600,insideExcessK:150,dragAreaM2:.25,luminousIntensityCd:10,widthM:.6,heightM:1,color:"#ff8a24",shape:"classic",paperColor:"#ffffff"};static FLAME_CDM2=5e3;static TITLE={en:"Sky lantern",fr:"Lanterne céleste",es:"Farolillo volador",it:"Lanterna volante"};static FLICKER=.15;static INSIDE_SHARE=2;static PAPER_FULL_CDM2=i.COMMON.luminousIntensityCd/(Math.PI*i.COMMON.widthM/2*i.COMMON.heightM/2);static SAMPLE_MS=1e3;static STEP_S=.05;static COOLING_S=20;static GUST_GROUND_M=2;static TURBULENCE={horizontalMS:.8,verticalMS:.3,timescaleS:30};static G=9.81;static R_AIR=287.05;static LAPSE=.0065;static expand(t){const e=t?.lanterns;return!t||!e||e.length===0?t:{...t,bodies:[...t.bodies,...e.flatMap(s=>i.bodiesOf(s))]}}static bodiesOf(t,e=w.NONE){return i.releasesOf(t).map((s,r)=>i.lanternBody(t,s,r,e))}static releasesOf(t){const e=[...t.releases??[]],s=t.group;if(!s||!(s.count>0))return e;const r=i.randomFrom(s.seed??1),o=n=>n.min+(n.max-n.min)*r(),M=s.count>1?(s.untilT-s.fromT)/(s.count-1):0,c=s.radiusM??20;for(let n=0;n<s.count;n++){const d=s.fromT+M*n+(r()-.5)*M,u=c*Math.sqrt(r()),a=2*Math.PI*r();e.push({t:Math.round(Math.min(s.untilT,Math.max(s.fromT,d))),explains:s.explains,eastM:Math.round(u*Math.sin(a)*10)/10,northM:Math.round(u*Math.cos(a)*10)/10,burnedS:s.burnedS,seed:Math.floor(r()*4294967296),lantern:{burnS:Math.round(o(s.burnS??{min:480,max:900})),insideExcessK:Math.round(o(s.insideExcessK??{min:125,max:175}))}})}return e}static randomFrom(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let s=e;return s=Math.imul(s^s>>>15,s|1),s^=s+Math.imul(s^s>>>7,s|61),((s^s>>>14)>>>0)/4294967296}}static typeOf(t,e){return{...i.COMMON,...t.lantern,...e.lantern}}static heatShare(t,e){if(e<0||e>=t.burnS)return 0;const s=t.burnS*.75;return e<=s?1:(t.burnS-e)/(t.burnS-s)}static windAt(t,e){const s=i.componentsOf(t.wind),r=t.windAloft;if(!r)return s;const o=i.componentsOf(r),M=Math.max(0,Math.min(1,e/r.atM));return{x:s.x+(o.x-s.x)*M,y:s.y+(o.y-s.y)*M}}static trajectory(t,e,s=i.SAMPLE_MS,r=w.NONE){const o=i.typeOf(t,e),M=t.site,c=M.altitudeM??0,n=Math.max(0,e.burnedS??0),d=M.originElevationM??0,u=(t.airTemperatureC??10)+273.15,a={x:M.eastM+(e.eastM??0),y:M.northM+(e.northM??0),z:e.altitudeM??c,vx:0,vy:0,vz:0,excessK:o.insideExcessK*i.heatShare(o,n)},h=i.STEP_S,y=Math.max(1,Math.round(s/1e3/h)),E=Math.ceil(Math.max(0,o.burnS-n)/h),I=[{t:e.t,x:a.x,y:a.y,z:a.z,light:i.heatShare(o,n),tiltDeg:0,tiltTowardDeg:0}],S=i.gusts(t.turbulence??i.TURBULENCE,i.seedOf(e),h);for(let x=1;x<=E;x++){const C=x*h,A=n+C,P=i.heatShare(o,A);a.excessK+=(o.insideExcessK*P-a.excessK)*Math.min(1,h/i.COOLING_S);const p=a.z-c,T=u-i.LAPSE*Math.max(0,p),b=101325*Math.exp(-(a.z+d)/8400),f=b/(i.R_AIR*T),D=b/(i.R_AIR*(T+a.excessK)),g=o.massKg-o.fuelKg*Math.min(1,A/o.burnS),F=(f-D)*o.envelopeVolumeM3*i.G,K=g+D*o.envelopeVolumeM3+.5*f*o.envelopeVolumeM3,N=i.windAt(t,p),z=S(),G=Math.max(0,Math.min(1,p/i.GUST_GROUND_M)),l={x:N.x+z.x,y:N.y+z.y,z:z.z*G},U=a.vx-l.x,B=a.vy-l.y,V=a.vz-l.z,m=.5*f*o.dragAreaM2*Math.hypot(U,B,V)/K;a.vx=(a.vx+m*h*l.x)/(1+m*h),a.vy=(a.vy+m*h*l.y)/(1+m*h),a.vz=(a.vz+m*h*l.z+(F-g*i.G)/K*h)/(1+m*h);const R=a.z<=c&&a.vz<=0;R&&(a.vx=0,a.vy=0,a.vz=0);const j=a.z;if(a.x+=a.vx*h,a.y+=a.vy*h,a.z=Math.max(c,a.z+a.vz*h),r.empty||i.keptOut(a,j,o.widthM/2,r),x%y===0||x===E){const v=l.x-a.vx,O=l.y-a.vy,q=.5*f*o.dragAreaM2*Math.hypot(v,O,l.z-a.vz)*Math.hypot(v,O);I.push({t:e.t+Math.round(C*1e3),x:a.x,y:a.y,z:a.z,light:P,tiltDeg:R?0:Math.atan2(q,g*i.G)*180/Math.PI,tiltTowardDeg:(Math.atan2(v,O)*180/Math.PI+360)%360})}}return I}static keptOut(t,e,s,r){const o=r.inside(t.x,t.y,t.z,s);if(!o)return;const M=o.box.topM;if(e>=M-1e-6||t.z>=M-1e-6){t.z<M&&(t.z=M,t.vz<0&&(t.vz=0));return}t.x+=o.nx*o.depthM,t.y+=o.ny*o.depthM;const c=t.vx*o.nx+t.vy*o.ny;c<0&&(t.vx-=c*o.nx,t.vy-=c*o.ny)}static seedOf(t){return t.seed!==void 0?t.seed:Math.round(t.t)*2654435761+Math.round((t.eastM??0)*100)*40503+Math.round((t.northM??0)*100)>>>0}static gusts(t,e,s){const r=i.randomFrom(e),o=()=>Math.sqrt(-2*Math.log(Math.max(1e-12,r())))*Math.cos(2*Math.PI*r()),M=t.timescaleS>0?Math.exp(-s/t.timescaleS):0,c=Math.sqrt(1-M*M),n={x:t.horizontalMS*o(),y:t.horizontalMS*o(),z:t.verticalMS*o()};return()=>(n.x=M*n.x+c*t.horizontalMS*o(),n.y=M*n.y+c*t.horizontalMS*o(),n.z=M*n.z+c*t.verticalMS*o(),n)}static componentsOf(t){if(!t)return{x:0,y:0};const e=t.towardDeg*Math.PI/180;return{x:Math.sin(e)*t.speedMS,y:Math.cos(e)*t.speedMS}}static lanternBody(t,e,s,r){const o=i.typeOf(t,e),M=o.luminousIntensityCd/(Math.PI*o.widthM/2*o.heightM/2),c=i.trajectory(t,e,i.SAMPLE_MS,r),n={widthM:o.widthM,lengthM:o.widthM,heightM:o.heightM},d=i.through(o.color,o.paperColor),u=c.map((a,h)=>({t:a.t,eastM:a.x,northM:a.y,altitudeM:a.z,...h===0?{sizeM:n,present:!0}:{},attitude:{headingDeg:Math.round(a.tiltTowardDeg),pitchDeg:-Math.round(a.tiltDeg*10)/10},appearance:{color:d,luminanceCdM2:M*a.light,...h===0?{albedo:.6,haloScale:1}:{}},lights:i.lightsOf(M*a.light)}));return u.push({t:c[c.length-1].t+1,present:!1}),{id:`${t.id}-lantern-${s+1}`,title:i.TITLE,explains:e.explains,model:{id:`ufoathome-sky-lantern-${o.shape}`},modelParameters:{paperColor:o.paperColor},flicker:i.FLICKER,altitudeFrom:{eastM:c[0].x,northM:c[0].y},track:u}}static lightsOf(t){return{paper:t,"paper-inside":t*i.INSIDE_SHARE,flame:t>0?i.FLAME_CDM2*t/i.PAPER_FULL_CDM2:0}}static through(t,e){const s=n=>[1,3,5].map(d=>parseInt(n.slice(d,d+2),16)/255),r=s(t),o=s(e),M=r.map((n,d)=>n*o[d]),c=Math.max(...r)/(Math.max(...M)||1);return"#"+M.map(n=>Math.round(Math.min(1,n*c)*255).toString(16).padStart(2,"0")).join("")}}export{i as SkyLantern};
1
+ import{bA as w}from"./rr0-scene.mjs";class i{static COMMON={envelopeVolumeM3:.19,massKg:.065,fuelKg:.03,burnS:600,insideExcessK:150,dragAreaM2:.25,luminousIntensityCd:10,widthM:.6,heightM:1,color:"#ff8a24",shape:"classic",paperColor:"#ffffff"};static FLAME_CDM2=5e3;static TITLE={en:"Sky lantern",fr:"Lanterne céleste",es:"Farolillo volador",it:"Lanterna volante"};static FLICKER=.15;static INSIDE_SHARE=2;static PAPER_FULL_CDM2=i.COMMON.luminousIntensityCd/(Math.PI*i.COMMON.widthM/2*i.COMMON.heightM/2);static SAMPLE_MS=1e3;static STEP_S=.05;static COOLING_S=20;static GUST_GROUND_M=2;static TURBULENCE={horizontalMS:.8,verticalMS:.3,timescaleS:30};static G=9.81;static R_AIR=287.05;static LAPSE=.0065;static expand(t){const e=t?.lanterns;return!t||!e||e.length===0?t:{...t,bodies:[...t.bodies,...e.flatMap(s=>i.bodiesOf(s))]}}static bodiesOf(t,e=w.NONE){return i.releasesOf(t).map((s,r)=>i.lanternBody(t,s,r,e))}static releasesOf(t){const e=[...t.releases??[]],s=t.group;if(!s||!(s.count>0))return e;const r=i.randomFrom(s.seed??1),o=n=>n.min+(n.max-n.min)*r(),M=s.count>1?(s.untilT-s.fromT)/(s.count-1):0,c=s.radiusM??20;for(let n=0;n<s.count;n++){const d=s.fromT+M*n+(r()-.5)*M,u=c*Math.sqrt(r()),a=2*Math.PI*r();e.push({t:Math.round(Math.min(s.untilT,Math.max(s.fromT,d))),explains:s.explains,eastM:Math.round(u*Math.sin(a)*10)/10,northM:Math.round(u*Math.cos(a)*10)/10,burnedS:s.burnedS,seed:Math.floor(r()*4294967296),lantern:{burnS:Math.round(o(s.burnS??{min:480,max:900})),insideExcessK:Math.round(o(s.insideExcessK??{min:125,max:175}))}})}return e}static randomFrom(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let s=e;return s=Math.imul(s^s>>>15,s|1),s^=s+Math.imul(s^s>>>7,s|61),((s^s>>>14)>>>0)/4294967296}}static typeOf(t,e){return{...i.COMMON,...t.lantern,...e.lantern}}static heatShare(t,e){if(e<0||e>=t.burnS)return 0;const s=t.burnS*.75;return e<=s?1:(t.burnS-e)/(t.burnS-s)}static windAt(t,e){const s=i.componentsOf(t.wind),r=t.windAloft;if(!r)return s;const o=i.componentsOf(r),M=Math.max(0,Math.min(1,e/r.atM));return{x:s.x+(o.x-s.x)*M,y:s.y+(o.y-s.y)*M}}static trajectory(t,e,s=i.SAMPLE_MS,r=w.NONE){const o=i.typeOf(t,e),M=t.site,c=M.altitudeM??0,n=Math.max(0,e.burnedS??0),d=M.originElevationM??0,u=(t.airTemperatureC??10)+273.15,a={x:M.eastM+(e.eastM??0),y:M.northM+(e.northM??0),z:e.altitudeM??c,vx:0,vy:0,vz:0,excessK:o.insideExcessK*i.heatShare(o,n)},h=i.STEP_S,y=Math.max(1,Math.round(s/1e3/h)),E=Math.ceil(Math.max(0,o.burnS-n)/h),I=[{t:e.t,x:a.x,y:a.y,z:a.z,light:i.heatShare(o,n),tiltDeg:0,tiltTowardDeg:0}],S=i.gusts(t.turbulence??i.TURBULENCE,i.seedOf(e),h);for(let x=1;x<=E;x++){const A=x*h,C=n+A,P=i.heatShare(o,C);a.excessK+=(o.insideExcessK*P-a.excessK)*Math.min(1,h/i.COOLING_S);const p=a.z-c,T=u-i.LAPSE*Math.max(0,p),b=101325*Math.exp(-(a.z+d)/8400),f=b/(i.R_AIR*T),D=b/(i.R_AIR*(T+a.excessK)),g=o.massKg-o.fuelKg*Math.min(1,C/o.burnS),F=(f-D)*o.envelopeVolumeM3*i.G,K=g+D*o.envelopeVolumeM3+.5*f*o.envelopeVolumeM3,N=i.windAt(t,p),z=S(),G=Math.max(0,Math.min(1,p/i.GUST_GROUND_M)),l={x:N.x+z.x,y:N.y+z.y,z:z.z*G},U=a.vx-l.x,B=a.vy-l.y,V=a.vz-l.z,m=.5*f*o.dragAreaM2*Math.hypot(U,B,V)/K;a.vx=(a.vx+m*h*l.x)/(1+m*h),a.vy=(a.vy+m*h*l.y)/(1+m*h),a.vz=(a.vz+m*h*l.z+(F-g*i.G)/K*h)/(1+m*h);const R=a.z<=c&&a.vz<=0;R&&(a.vx=0,a.vy=0,a.vz=0);const j=a.z;if(a.x+=a.vx*h,a.y+=a.vy*h,a.z=Math.max(c,a.z+a.vz*h),r.empty||i.keptOut(a,j,o.widthM/2,r),x%y===0||x===E){const v=l.x-a.vx,O=l.y-a.vy,q=.5*f*o.dragAreaM2*Math.hypot(v,O,l.z-a.vz)*Math.hypot(v,O);I.push({t:e.t+Math.round(A*1e3),x:a.x,y:a.y,z:a.z,light:P,tiltDeg:R?0:Math.atan2(q,g*i.G)*180/Math.PI,tiltTowardDeg:(Math.atan2(v,O)*180/Math.PI+360)%360})}}return I}static keptOut(t,e,s,r){const o=r.inside(t.x,t.y,t.z,s);if(!o)return;const M=o.box.topM;if(e>=M-1e-6||t.z>=M-1e-6){t.z<M&&(t.z=M,t.vz<0&&(t.vz=0));return}t.x+=o.nx*o.depthM,t.y+=o.ny*o.depthM;const c=t.vx*o.nx+t.vy*o.ny;c<0&&(t.vx-=c*o.nx,t.vy-=c*o.ny)}static seedOf(t){return t.seed!==void 0?t.seed:Math.round(t.t)*2654435761+Math.round((t.eastM??0)*100)*40503+Math.round((t.northM??0)*100)>>>0}static gusts(t,e,s){const r=i.randomFrom(e),o=()=>Math.sqrt(-2*Math.log(Math.max(1e-12,r())))*Math.cos(2*Math.PI*r()),M=t.timescaleS>0?Math.exp(-s/t.timescaleS):0,c=Math.sqrt(1-M*M),n={x:t.horizontalMS*o(),y:t.horizontalMS*o(),z:t.verticalMS*o()};return()=>(n.x=M*n.x+c*t.horizontalMS*o(),n.y=M*n.y+c*t.horizontalMS*o(),n.z=M*n.z+c*t.verticalMS*o(),n)}static componentsOf(t){if(!t)return{x:0,y:0};const e=t.towardDeg*Math.PI/180;return{x:Math.sin(e)*t.speedMS,y:Math.cos(e)*t.speedMS}}static lanternBody(t,e,s,r){const o=i.typeOf(t,e),M=o.luminousIntensityCd/(Math.PI*o.widthM/2*o.heightM/2),c=i.trajectory(t,e,i.SAMPLE_MS,r),n={widthM:o.widthM,lengthM:o.widthM,heightM:o.heightM},d=i.through(o.color,o.paperColor),u=c.map((a,h)=>({t:a.t,eastM:a.x,northM:a.y,altitudeM:a.z,...h===0?{sizeM:n,present:!0}:{},attitude:{headingDeg:Math.round(a.tiltTowardDeg),pitchDeg:-Math.round(a.tiltDeg*10)/10},appearance:{color:d,luminanceCdM2:M*a.light,...h===0?{albedo:.6,haloScale:1}:{}},lights:i.lightsOf(M*a.light)}));return u.push({t:c[c.length-1].t+1,present:!1}),{id:`${t.id}-lantern-${s+1}`,title:i.TITLE,explains:e.explains,model:{id:`ufoathome-sky-lantern-${o.shape}`},modelParameters:{paperColor:o.paperColor},flicker:i.FLICKER,altitudeFrom:{eastM:c[0].x,northM:c[0].y},track:u}}static lightsOf(t){return{paper:t,"paper-inside":t*i.INSIDE_SHARE,flame:t>0?i.FLAME_CDM2*t/i.PAPER_FULL_CDM2:0}}static through(t,e){const s=n=>[1,3,5].map(d=>parseInt(n.slice(d,d+2),16)/255),r=s(t),o=s(e),M=r.map((n,d)=>n*o[d]),c=Math.max(...r)/(Math.max(...M)||1);return"#"+M.map(n=>Math.round(Math.min(1,n*c)*255).toString(16).padStart(2,"0")).join("")}}export{i as SkyLantern};