@rr0/ufoathome 0.185.0 → 0.185.2
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.
- package/dist-embed-scene/{AdsbLolArchiveProvider-B0Yi081_.js → AdsbLolArchiveProvider-CzTJVwX_.js} +1 -1
- package/dist-embed-scene/{BeamEditor-DXIKipID.js → BeamEditor-B1rrWZ8t.js} +1 -1
- package/dist-embed-scene/{BeamSystem-ebEMoYD3.js → BeamSystem-BxfhSMvb.js} +1 -1
- package/dist-embed-scene/ControlPasses-X_kTXa-p.js +29 -0
- package/dist-embed-scene/{Flightradar24Provider-CpwhYfIE.js → Flightradar24Provider-ae0_oe2g.js} +1 -1
- package/dist-embed-scene/{GLTFLoader-BxToReDu.js → GLTFLoader-CZ-8eVJ4.js} +1 -1
- package/dist-embed-scene/{LanternEditor-JvQQ8GOQ.js → LanternEditor-DbaHa2ey.js} +1 -1
- package/dist-embed-scene/{LaserBeam-B48FKTrt.js → LaserBeam-DW1f0LPn.js} +1 -1
- package/dist-embed-scene/{LaunchEditor-DIxYPs4d.js → LaunchEditor-M8G5W83U.js} +2 -2
- package/dist-embed-scene/{LaunchPlume-FP3Yk-8B.js → LaunchPlume-BtEO63Vx.js} +1 -1
- package/dist-embed-scene/{LaunchSimulation-v4khqz4r.js → LaunchSimulation-xgRnC8OK.js} +1 -1
- package/dist-embed-scene/{ModuleSession-CLUE46BO.js → ModuleSession-BGUJHOk9.js} +2 -2
- package/dist-embed-scene/ModuleThree-BljKXj42.js +1 -0
- package/dist-embed-scene/{ParameterForm-BFp5BoHL.js → ParameterForm-DMplRkcQ.js} +6 -6
- package/dist-embed-scene/{ReentryEditor-ByVtt--5.js → ReentryEditor-FFxrv4q7.js} +1 -1
- package/dist-embed-scene/{ReentrySimulation-nzg5V3kJ.js → ReentrySimulation-xFQ_R53U.js} +1 -1
- package/dist-embed-scene/{ReferenceSystem-D9IdSvFM.js → ReferenceSystem-Dyc08-lR.js} +1 -1
- package/dist-embed-scene/{SceneNames_en-BSE4vlLT.js → SceneNames_en-CIzANCLW.js} +1 -1
- package/dist-embed-scene/{SceneNames_es-CZyu8Wnr.js → SceneNames_es-DntR6o9V.js} +1 -1
- package/dist-embed-scene/{SceneNames_fr-CphfTjGw.js → SceneNames_fr-7wmERMPd.js} +1 -1
- package/dist-embed-scene/{SceneNames_it-DQ_cY7aP.js → SceneNames_it-Bxtenoxp.js} +1 -1
- package/dist-embed-scene/{TimelineTracks-BOjTfdGu.js → TimelineTracks-CZBILU3f.js} +2 -2
- package/dist-embed-scene/{UfoMessages_en-CXQNZd8v.js → UfoMessages_en-AS8tBKJW.js} +1 -1
- package/dist-embed-scene/rr0-scene.mjs +241 -241
- package/dist-embed-sighting/{AdsbLolArchiveProvider-BqLvFUVC.js → AdsbLolArchiveProvider-D9EKDsic.js} +1 -1
- package/dist-embed-sighting/{BeamEditor-CcOf6lNz.js → BeamEditor-Cod7HUNj.js} +2 -2
- package/dist-embed-sighting/{BeamSystem-B5d0Ymn5.js → BeamSystem-BZ2f4hh1.js} +1 -1
- package/dist-embed-sighting/{CaseReportExport-D1-5JJhQ.js → CaseReportExport-Drb2dd78.js} +1 -1
- package/dist-embed-sighting/ControlPasses-BnlLorfW.js +29 -0
- package/dist-embed-sighting/{Flightradar24Provider-DQtEJ3tX.js → Flightradar24Provider-DQ-bvlMM.js} +1 -1
- package/dist-embed-sighting/{GLTFLoader-VIIHsteW.js → GLTFLoader-DPrksej_.js} +1 -1
- package/dist-embed-sighting/{LanternEditor-D1BA5pRP.js → LanternEditor-9zPknaGj.js} +1 -1
- package/dist-embed-sighting/{LaserBeam-BjjC_CzP.js → LaserBeam-CFUYJu2F.js} +1 -1
- package/dist-embed-sighting/{LaunchEditor-TTSgWqbE.js → LaunchEditor-GiZERDOz.js} +1 -1
- package/dist-embed-sighting/{LaunchPlume-B2Fjd2_C.js → LaunchPlume-CuDQMA8K.js} +1 -1
- package/dist-embed-sighting/{LaunchSimulation-BcmPicEe.js → LaunchSimulation-Fpwvzpf1.js} +1 -1
- package/dist-embed-sighting/{ModuleSession-CY9_UusZ.js → ModuleSession-CY6DsJx0.js} +2 -2
- package/dist-embed-sighting/ModuleThree-EigESy50.js +1 -0
- package/dist-embed-sighting/{ParameterForm-BaUeWd7v.js → ParameterForm-BHITM-mQ.js} +1 -1
- package/dist-embed-sighting/{ReentryEditor-CGN3ewTE.js → ReentryEditor-C_AN8aTr.js} +1 -1
- package/dist-embed-sighting/{ReentrySimulation-C2kIulZ6.js → ReentrySimulation-sBnymskP.js} +1 -1
- package/dist-embed-sighting/{ReferenceSystem-BRTCOQHk.js → ReferenceSystem-Cn6gWxGT.js} +1 -1
- package/dist-embed-sighting/{TimelineTracks-Ddv5sZHp.js → TimelineTracks-B7EcGLEf.js} +1 -1
- package/dist-embed-sighting/rr0-sighting.mjs +276 -276
- package/dist-embed-sighting-editor/{CaseReportExport-jYtQCrPV.js → CaseReportExport-COqBs7VN.js} +1 -1
- package/dist-embed-sighting-editor/ControlPasses-BsZQ-_CW.js +29 -0
- package/dist-embed-sighting-editor/{GLTFLoader-CJy8wjmO.js → GLTFLoader-D7spTlJl.js} +1 -1
- package/dist-embed-sighting-editor/{ModuleConformance-B8OYKQop.js → ModuleConformance-D7QNv2-c.js} +2 -2
- package/dist-embed-sighting-editor/{ModuleSession-BQSTCqob.js → ModuleSession-DTZs4At5.js} +2 -2
- package/dist-embed-sighting-editor/ModuleThree-COSQVAvF.js +1 -0
- package/dist-embed-sighting-editor/{ModulesPanelElement-CZcbo6lq.js → ModulesPanelElement-9x7kP_Tx.js} +3 -3
- package/dist-embed-sighting-editor/{ReferenceSystem-BxKEbMVI.js → ReferenceSystem-ZQRGSWgC.js} +1 -1
- package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +278 -278
- package/package.json +1 -1
- package/dist-embed-scene/ControlPasses-BMma2JRm.js +0 -29
- package/dist-embed-scene/ModuleThree-DQfMGMDy.js +0 -1
- package/dist-embed-sighting/ControlPasses-BxgSO3B9.js +0 -29
- package/dist-embed-sighting/ModuleThree-BhryLUjX.js +0 -1
- package/dist-embed-sighting-editor/ControlPasses-oqSnNDq6.js +0 -29
- package/dist-embed-sighting-editor/ModuleThree-DwGM2nF4.js +0 -1
package/dist-embed-sighting-editor/{CaseReportExport-jYtQCrPV.js → CaseReportExport-COqBs7VN.js}
RENAMED
|
@@ -62,4 +62,4 @@ ${o.join(`
|
|
|
62
62
|
`)}
|
|
63
63
|
</body>
|
|
64
64
|
</html>
|
|
65
|
-
`}static comparedTable(t,n){const a=n.texts.columns,s=z.escape;return z.table([a.reading,a.reads,a.reproduced,a.gap,a.robustness,a.supposedCount],t.readings.map(i=>{const e=n.robustness(i.sensitivity);return[s(i.title),s(i.reads),`<span class="n">${n.reproduced(i.sensitivity)}</span>`,n.degrees(i.sensitivity?.medianSeparationDeg),`<span class="${e.kind}">${s(e.text)}</span>`,String(i.supposed.length)]}),[2,3,5])}static witness(t,n,a){const s=a.texts,i=s.columns,e=z.escape,r=[`<h3>${e(a.fill(s.witnessHeading,{witness:t.title}))}</h3>`],o=[[s.columns.time,t.time??""],[s.place,t.place??""],[s.duration,t.durationSeconds!==void 0?a.instant(t.durationSeconds*1e3):""],[s.instrument,t.instrument??""]].filter(([,m])=>m!=="");o.length&&r.push(`<dl class="facts">${o.map(([m,d])=>`<dt>${e(m)}</dt><dd>${e(d)}</dd>`).join("")}</dl>`),t.description&&r.push(`<h4>${e(s.account)}</h4>`,`<blockquote>${e(t.description)}</blockquote>`),t.sources.length&&r.push(`<h4>${e(s.sources)}</h4>`,`<ul class="sources">${t.sources.map(m=>`<li>${[m.authors?.join(", "),m.title?`<em>${e(m.title)}</em>`:"",m.publisher,m.time,m.index].filter(Boolean).map(g=>g.startsWith("<em>")?g:e(g)).join(", ")}${m.url?` <a href="${e(m.url)}">${e(m.url)}</a>`:""}</li>`).join("")}</ul>`);const u=S.svg(t,a);u&&r.push(`<figure>${u}<figcaption>${e(s.timelineCaption)}</figcaption></figure>`),n=n.filter(m=>m.comparisons.length>0);const p=D.svg(t,n,a);if(p){const m=[`<li><svg viewBox="0 0 14 14" width="14" height="14" aria-hidden="true"><circle cx="7" cy="7" r="4" fill="#111827"/></svg>${e(s.saidLegend)}</li>`,...n.map((d,g)=>`<li>${D.legendMark(g)}${e(d.title)}</li>`)];r.push(`<figure>${p}<ul class="legend">${m.join("")}</ul><figcaption>${e(s.figureCaption)}</figcaption></figure>`)}if(t.pictures?.length){const m=t.pictures[0].views.map(d=>d.label);r.push(`<h4>${e(s.pictures)}</h4>`,`<div class="scroll"><table class="pictures"><thead><tr><th scope="col">${e(s.columns.instant)}</th>${m.map(d=>`<th scope="col">${e(d)}</th>`).join("")}</tr></thead><tbody>${t.pictures.map(d=>`<tr><td class="n">${a.instant(d.t)}</td>${d.views.map(g=>`<td>${g.image?`<img src="${g.image}" alt="${e(g.label)}, ${a.instant(d.t)}">`:`<span class="nothing">${e(s.noPicture)}</span>`}</td>`).join("")}</tr>`).join("")}</tbody></table></div>`,`<p class="caption">${e(s.picturesCaption)}</p>`)}r.push(`<h4>${e(s.indications)}</h4>`),t.indications.length===0?r.push(`<p>${e(s.noIndication)}</p>`):r.push(z.table([i.instant,i.phenomenon,i.azimuth,i.altitude,i.uncertainty,i.size,i.basis,i.rests],t.indications.map(m=>{const d=m.uncertainty;return[a.instant(m.t),e(m.phenomenon??m.sourceId),m.directionSaid?a.azimuth(m.aim?.azimuthDeg):"",m.directionSaid?a.degrees(m.aim?.altitudeDeg):"",d?`${a.azimuth(d.azimuthDeg[0])} … ${a.azimuth(d.azimuthDeg[1])} ; ${a.degrees(d.altitudeDeg[0])} … ${a.degrees(d.altitudeDeg[1])}`:"",m.sizeSaid?a.degrees(m.angular?.widthDeg):"",m.basis?e(s.bases[m.basis]):"",e(a.rests(m))]}),[0,2,3,5]));const l=t.values.filter(m=>!/^timeline\.keyframes\.\d+\.shapes\.\d+\.shape\.(aim|angular)/.test(m.path));return l.length>0&&r.push(`<h4>${e(s.values)}</h4>`,z.valuesTable(l,a)),r}static reading(t,n,a){const s=a.texts,i=s.columns,e=z.escape,r=[`<h2>${e(a.fill(s.readingHeading,{title:t.title,witness:t.reads}))}</h2>`],c=[t.by.length?a.fill(s.by,{names:t.by.join(", ")}):"",t.time?a.fill(s.made,{time:t.time}):""].filter(Boolean).join(" ");c&&r.push(`<p class="meta">${e(c)}</p>`),t.description&&r.push(`<blockquote>${e(t.description)}</blockquote>`),r.push(`<h4>${e(s.supposed)}</h4>`,t.supposed.length?z.valuesTable(t.supposed,a):`<p>${e(s.noneSupposed)}</p>`),r.push(`<h4>${e(s.findings)}</h4>`),r.push(t.findings.length?z.table([i.finding,i.outcome,i.against,i.origin],t.findings.map(u=>[e(u.text),`<span class="${u.outcome}">${e(s.outcomes[u.outcome])}</span>`,u.outcome==="fails"?e(s.grounds[u.against??"established"]):"",e(s.origins[u.written?"written":"computed"])])):`<p>${e(s.noFinding)}</p>`);const o=t.sensitivity;if(o){const u=a.robustness(o);if(r.push(`<h4>${e(s.sensitivity)}</h4>`,`<p>${e(i.reproduced)} : ${a.reproduced(o)||"–"} · ${e(i.gap)} : ${a.degrees(o.medianSeparationDeg)||"–"} · <span class="${u.kind}">${e(u.text)}</span></p>`),u.kind!=="too-few"&&u.kind!=="nothing"&&o.margins.length>0&&r.push(z.table([i.knob,i.from,i.to,i.reference,i.covered],o.margins.map(p=>{const l=a.ends(p),m=p.reference?`${a.amount(p.knob,p.reference.lower)} … ${a.amount(p.knob,p.reference.upper)}`:s.noLaw;return[e(s.knobs[p.knob]),l.from,l.to,e(m),p.coverage===void 0?"":`${Math.round(p.coverage*100)} %`]}),[1,2,4])),o.better){const{knob:p,amount:l,agreement:m}=o.better;r.push(`<p class="fine-tuned">${e(a.fill(s.better,{knob:s.knobs[p],amount:a.amount(p,l),agreed:String(Math.round(m*o.compared)),compared:String(o.compared)}))}</p>`)}}return t.comparisons.length>0&&r.push(`<h4>${e(s.comparisons)}</h4>`,z.table([i.instant,i.phenomenon,`${i.said} (${i.azimuth}, ${i.altitude})`,`${i.read} (${i.azimuth}, ${i.altitude})`,i.separation,i.agrees],t.comparisons.map(u=>[a.instant(u.t),e(n?.phenomena?.[u.sourceId]??u.sourceId),u.said?`${a.azimuth(u.said.azimuthDeg)}, ${a.degrees(u.said.altitudeDeg)}`:"",`${a.azimuth(u.predicted.azimuthDeg)}, ${a.degrees(u.predicted.altitudeDeg)}`,a.degrees(u.separationDeg),`<span class="${u.agrees?"holds":"fails"}">${e(u.agrees?s.yes:s.no)}</span>`]),[0,4])),r}static valuesTable(t,n){const a=n.texts,s=a.columns,i=z.escape;return z.table([s.path,s.value,s.basis,s.rests],t.map(e=>[`<code>${i(e.path)}</code>`,i(n.value(e)),i(a.bases[e.basis]),i(n.rests(e))]))}static table(t,n,a=[]){const s=z.escape,i=`<tr>${t.map(r=>`<th scope="col">${s(r)}</th>`).join("")}</tr>`,e=n.map(r=>`<tr>${r.map((c,o)=>`<td${a.includes(o)?' class="n"':""}>${c}</td>`).join("")}</tr>`);return`<div class="scroll"><table><thead>${i}</thead><tbody>${e.join("")}</tbody></table></div>`}static escape(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}}const _=P.catalog({en:()=>B(()=>import("./CaseReportTexts_en-DlN7p1pC.js"),[],import.meta.url).then(N=>N.caseReportTexts_en),fr:()=>B(()=>import("./CaseReportTexts_fr-B5nP6RlP.js"),[],import.meta.url).then(N=>N.caseReportTexts_fr),es:()=>B(()=>import("./CaseReportTexts_es-CncAEaey.js"),[],import.meta.url).then(N=>N.caseReportTexts_es),it:()=>B(()=>import("./CaseReportTexts_it-Dc-oPmXB.js"),[],import.meta.url).then(N=>N.caseReportTexts_it)});class U{static async make(t,n,a,s,i=!1,e){const[r,c]=await Promise.all([_.load(a),J.load(a)]),o=j.of(n.caseJson,n.caseUrl,n.recordings,new C([...s]),new F(c));i&&t!=="csv"&&await U.pictures(o,n,r,e);const u=`${n.caseJson.id??"case"}-report`;switch(t){case"html":U.download(new Blob([z.of(o,r,a,"0.185.
|
|
65
|
+
`}static comparedTable(t,n){const a=n.texts.columns,s=z.escape;return z.table([a.reading,a.reads,a.reproduced,a.gap,a.robustness,a.supposedCount],t.readings.map(i=>{const e=n.robustness(i.sensitivity);return[s(i.title),s(i.reads),`<span class="n">${n.reproduced(i.sensitivity)}</span>`,n.degrees(i.sensitivity?.medianSeparationDeg),`<span class="${e.kind}">${s(e.text)}</span>`,String(i.supposed.length)]}),[2,3,5])}static witness(t,n,a){const s=a.texts,i=s.columns,e=z.escape,r=[`<h3>${e(a.fill(s.witnessHeading,{witness:t.title}))}</h3>`],o=[[s.columns.time,t.time??""],[s.place,t.place??""],[s.duration,t.durationSeconds!==void 0?a.instant(t.durationSeconds*1e3):""],[s.instrument,t.instrument??""]].filter(([,m])=>m!=="");o.length&&r.push(`<dl class="facts">${o.map(([m,d])=>`<dt>${e(m)}</dt><dd>${e(d)}</dd>`).join("")}</dl>`),t.description&&r.push(`<h4>${e(s.account)}</h4>`,`<blockquote>${e(t.description)}</blockquote>`),t.sources.length&&r.push(`<h4>${e(s.sources)}</h4>`,`<ul class="sources">${t.sources.map(m=>`<li>${[m.authors?.join(", "),m.title?`<em>${e(m.title)}</em>`:"",m.publisher,m.time,m.index].filter(Boolean).map(g=>g.startsWith("<em>")?g:e(g)).join(", ")}${m.url?` <a href="${e(m.url)}">${e(m.url)}</a>`:""}</li>`).join("")}</ul>`);const u=S.svg(t,a);u&&r.push(`<figure>${u}<figcaption>${e(s.timelineCaption)}</figcaption></figure>`),n=n.filter(m=>m.comparisons.length>0);const p=D.svg(t,n,a);if(p){const m=[`<li><svg viewBox="0 0 14 14" width="14" height="14" aria-hidden="true"><circle cx="7" cy="7" r="4" fill="#111827"/></svg>${e(s.saidLegend)}</li>`,...n.map((d,g)=>`<li>${D.legendMark(g)}${e(d.title)}</li>`)];r.push(`<figure>${p}<ul class="legend">${m.join("")}</ul><figcaption>${e(s.figureCaption)}</figcaption></figure>`)}if(t.pictures?.length){const m=t.pictures[0].views.map(d=>d.label);r.push(`<h4>${e(s.pictures)}</h4>`,`<div class="scroll"><table class="pictures"><thead><tr><th scope="col">${e(s.columns.instant)}</th>${m.map(d=>`<th scope="col">${e(d)}</th>`).join("")}</tr></thead><tbody>${t.pictures.map(d=>`<tr><td class="n">${a.instant(d.t)}</td>${d.views.map(g=>`<td>${g.image?`<img src="${g.image}" alt="${e(g.label)}, ${a.instant(d.t)}">`:`<span class="nothing">${e(s.noPicture)}</span>`}</td>`).join("")}</tr>`).join("")}</tbody></table></div>`,`<p class="caption">${e(s.picturesCaption)}</p>`)}r.push(`<h4>${e(s.indications)}</h4>`),t.indications.length===0?r.push(`<p>${e(s.noIndication)}</p>`):r.push(z.table([i.instant,i.phenomenon,i.azimuth,i.altitude,i.uncertainty,i.size,i.basis,i.rests],t.indications.map(m=>{const d=m.uncertainty;return[a.instant(m.t),e(m.phenomenon??m.sourceId),m.directionSaid?a.azimuth(m.aim?.azimuthDeg):"",m.directionSaid?a.degrees(m.aim?.altitudeDeg):"",d?`${a.azimuth(d.azimuthDeg[0])} … ${a.azimuth(d.azimuthDeg[1])} ; ${a.degrees(d.altitudeDeg[0])} … ${a.degrees(d.altitudeDeg[1])}`:"",m.sizeSaid?a.degrees(m.angular?.widthDeg):"",m.basis?e(s.bases[m.basis]):"",e(a.rests(m))]}),[0,2,3,5]));const l=t.values.filter(m=>!/^timeline\.keyframes\.\d+\.shapes\.\d+\.shape\.(aim|angular)/.test(m.path));return l.length>0&&r.push(`<h4>${e(s.values)}</h4>`,z.valuesTable(l,a)),r}static reading(t,n,a){const s=a.texts,i=s.columns,e=z.escape,r=[`<h2>${e(a.fill(s.readingHeading,{title:t.title,witness:t.reads}))}</h2>`],c=[t.by.length?a.fill(s.by,{names:t.by.join(", ")}):"",t.time?a.fill(s.made,{time:t.time}):""].filter(Boolean).join(" ");c&&r.push(`<p class="meta">${e(c)}</p>`),t.description&&r.push(`<blockquote>${e(t.description)}</blockquote>`),r.push(`<h4>${e(s.supposed)}</h4>`,t.supposed.length?z.valuesTable(t.supposed,a):`<p>${e(s.noneSupposed)}</p>`),r.push(`<h4>${e(s.findings)}</h4>`),r.push(t.findings.length?z.table([i.finding,i.outcome,i.against,i.origin],t.findings.map(u=>[e(u.text),`<span class="${u.outcome}">${e(s.outcomes[u.outcome])}</span>`,u.outcome==="fails"?e(s.grounds[u.against??"established"]):"",e(s.origins[u.written?"written":"computed"])])):`<p>${e(s.noFinding)}</p>`);const o=t.sensitivity;if(o){const u=a.robustness(o);if(r.push(`<h4>${e(s.sensitivity)}</h4>`,`<p>${e(i.reproduced)} : ${a.reproduced(o)||"–"} · ${e(i.gap)} : ${a.degrees(o.medianSeparationDeg)||"–"} · <span class="${u.kind}">${e(u.text)}</span></p>`),u.kind!=="too-few"&&u.kind!=="nothing"&&o.margins.length>0&&r.push(z.table([i.knob,i.from,i.to,i.reference,i.covered],o.margins.map(p=>{const l=a.ends(p),m=p.reference?`${a.amount(p.knob,p.reference.lower)} … ${a.amount(p.knob,p.reference.upper)}`:s.noLaw;return[e(s.knobs[p.knob]),l.from,l.to,e(m),p.coverage===void 0?"":`${Math.round(p.coverage*100)} %`]}),[1,2,4])),o.better){const{knob:p,amount:l,agreement:m}=o.better;r.push(`<p class="fine-tuned">${e(a.fill(s.better,{knob:s.knobs[p],amount:a.amount(p,l),agreed:String(Math.round(m*o.compared)),compared:String(o.compared)}))}</p>`)}}return t.comparisons.length>0&&r.push(`<h4>${e(s.comparisons)}</h4>`,z.table([i.instant,i.phenomenon,`${i.said} (${i.azimuth}, ${i.altitude})`,`${i.read} (${i.azimuth}, ${i.altitude})`,i.separation,i.agrees],t.comparisons.map(u=>[a.instant(u.t),e(n?.phenomena?.[u.sourceId]??u.sourceId),u.said?`${a.azimuth(u.said.azimuthDeg)}, ${a.degrees(u.said.altitudeDeg)}`:"",`${a.azimuth(u.predicted.azimuthDeg)}, ${a.degrees(u.predicted.altitudeDeg)}`,a.degrees(u.separationDeg),`<span class="${u.agrees?"holds":"fails"}">${e(u.agrees?s.yes:s.no)}</span>`]),[0,4])),r}static valuesTable(t,n){const a=n.texts,s=a.columns,i=z.escape;return z.table([s.path,s.value,s.basis,s.rests],t.map(e=>[`<code>${i(e.path)}</code>`,i(n.value(e)),i(a.bases[e.basis]),i(n.rests(e))]))}static table(t,n,a=[]){const s=z.escape,i=`<tr>${t.map(r=>`<th scope="col">${s(r)}</th>`).join("")}</tr>`,e=n.map(r=>`<tr>${r.map((c,o)=>`<td${a.includes(o)?' class="n"':""}>${c}</td>`).join("")}</tr>`);return`<div class="scroll"><table><thead>${i}</thead><tbody>${e.join("")}</tbody></table></div>`}static escape(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}}const _=P.catalog({en:()=>B(()=>import("./CaseReportTexts_en-DlN7p1pC.js"),[],import.meta.url).then(N=>N.caseReportTexts_en),fr:()=>B(()=>import("./CaseReportTexts_fr-B5nP6RlP.js"),[],import.meta.url).then(N=>N.caseReportTexts_fr),es:()=>B(()=>import("./CaseReportTexts_es-CncAEaey.js"),[],import.meta.url).then(N=>N.caseReportTexts_es),it:()=>B(()=>import("./CaseReportTexts_it-Dc-oPmXB.js"),[],import.meta.url).then(N=>N.caseReportTexts_it)});class U{static async make(t,n,a,s,i=!1,e){const[r,c]=await Promise.all([_.load(a),J.load(a)]),o=j.of(n.caseJson,n.caseUrl,n.recordings,new C([...s]),new F(c));i&&t!=="csv"&&await U.pictures(o,n,r,e);const u=`${n.caseJson.id??"case"}-report`;switch(t){case"html":U.download(new Blob([z.of(o,r,a,"0.185.2")],{type:"text/html"}),`${u}.html`);return;case"print":U.print(z.of(o,r,a,"0.185.2"));return;case"json":U.download(new Blob([T.json(o,"0.185.2")],{type:"application/json"}),`${u}.json`);return;case"csv":{const{zipSync:p,strToU8:l}=await B(async()=>{const{zipSync:d,strToU8:g}=await import("./browser-CltifEM0.js");return{zipSync:d,strToU8:g}},[],import.meta.url),m=Object.fromEntries(Object.entries(T.csv(o,r,a)).map(([d,g])=>[d,l(`\uFEFF${g}`)]));U.download(new Blob([p(m)],{type:"application/zip"}),`${u}-tables.zip`)}}}static PICTURED_INSTANTS=3;static async pictures(t,n,a,s){const{registerScene:i,SCENE_ELEMENT_NAME:e}=await B(async()=>{const{registerScene:p,SCENE_ELEMENT_NAME:l}=await import("./rr0-sighting-editor.mjs").then(m=>m.cj);return{registerScene:p,SCENE_ELEMENT_NAME:l}},[],import.meta.url);i();const r=t.witnesses.map(p=>{const l=p.indications.filter(f=>f.directionSaid).map(f=>f.t),m=l.length<=U.PICTURED_INSTANTS?l:[l[0],l[Math.floor(l.length/2)],l[l.length-1]],d=t.readings.filter(f=>f.reads===p.title&&f.comparisons.length>0),g=[{label:a.accountView,url:p.url,reading:void 0},...d.map(f=>({label:f.title,url:p.url,reading:f.url}))];return{witness:p,instants:[...new Set(m)],recordings:g}}).filter(p=>p.instants.length>0),c=r.reduce((p,l)=>p+l.instants.length*l.recordings.length,0);if(c===0)return;const o=document.createElement(e);o.setAttribute("max-pixel-ratio","1"),o.setAttribute("always-live",""),Object.assign(o.style,{position:"fixed",left:"-10000px",top:"0",width:"640px",height:"360px",visibility:"hidden",pointerEvents:"none"}),document.body.appendChild(o);let u=0;s?.(u,c);try{for(const p of r){const l=p.instants.map(d=>({t:d,views:[]})),m=n.recordings.get(p.witness.url);m&&(o.documentUrl=p.witness.url,o.sightingData=m);for(const d of p.recordings){const g=m,f=d.reading?n.recordings.get(d.reading):void 0;for(const w of l){let b;g&&(!d.reading||f)&&(w===l[0]&&(o.interpretation=U.bodiesOf(f??g,d.reading??p.witness.url)),b=await o.pictureAt(w.t,480).catch(()=>{})),w.views.push({label:d.label,...b?{image:b}:{}}),s?.(++u,c)}}p.witness.pictures=l}}finally{o.remove()}}static bodiesOf(t,n){const a=W.strip(t).recording.interpretation;if(a)return{...a,bodies:a.bodies.map(s=>s.model?.url?{...s,model:{...s.model,url:new URL(s.model.url,n).href}}:s)}}static print(t){const n=document.createElement("iframe");n.setAttribute("aria-hidden","true"),n.style.cssText="position: fixed; right: 0; bottom: 0; width: 0; height: 0; border: 0",n.addEventListener("load",()=>{const a=n.contentWindow;a&&(a.addEventListener("afterprint",()=>n.remove()),a.focus(),a.print(),window.setTimeout(()=>n.remove(),6e4))},{once:!0}),n.srcdoc=t,document.body.append(n)}static download(t,n){const a=URL.createObjectURL(t),s=document.createElement("a");s.href=a,s.download=n,s.click(),window.setTimeout(()=>URL.revokeObjectURL(a),1e3)}}export{U as CaseReportExport};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import{ax as b,b1 as A,bn as D,bo as F,bp as M,bq as R,br as E,ap as P,aS as S,bs as U,b9 as k}from"./rr0-sighting-editor.mjs";class w{target;wideCamera=new b;materials=new Map;draw(t){const{renderer:s,camera:r,equidistant:a}=t,o=s.getDrawingBufferSize(new A),n=o.x,i=o.y,e=n/i;if(a&&!D.supports(r.fov,e))throw new Error(`A field of ${r.fov}° is drawn through a cube, which the control passes do not follow yet: export through a narrower field.`);const c=this.sourceCamera(r,a?a.sourceFovDeg(r.fov,e):r.fov),d=this.usableTarget(n,i),l=this.drawDistance(t,c,d),u=this.drawPhenomenon(t,c,d),f=Math.tan(c.fov*Math.PI/360),p=new Float32Array(n*i),h=new Uint8Array(n*i);for(let v=0;v<i;v++)for(let g=0;g<n;g++){const m=this.sourcePixel(g,v,n,i,r.fov,e,f,a);if(m<0)continue;const x=v*n+g;p[x]=l[m*4];const y=u[m*4],T=u[m*4+1],C=u[m*4+2],_=u[m*4+3];h[x]=Math.max(y,T,C,_)>w.LIGHT_THRESHOLD?255:0}return{width:n,height:i,distanceM:p,phenomenon:h}}dispose(){this.target?.dispose();for(const t of this.materials.values())t.dispose();this.materials.clear()}static LIGHT_THRESHOLD=1e-6;sourcePixel(t,s,r,a,o,n,i,e){if(!e)return(a-1-s)*r+t;const c=(t+.5)/r*2-1,d=1-(s+.5)/a*2,l=e.directionFor(c,d,o);if(l.z>=0)return-1;const u=l.x/-l.z/(i*n),f=l.y/-l.z/i,p=Math.floor((u+1)/2*r),h=Math.floor((f+1)/2*a);return p<0||p>=r||h<0||h>=a?-1:h*r+p}sourceCamera(t,s){const r=this.wideCamera.copy(t);return r.fov=s,r.clearViewOffset(),r.updateProjectionMatrix(),r.updateMatrixWorld(),r}usableTarget(t,s){return this.target?(this.target.width!==t||this.target.height!==s)&&this.target.setSize(t,s):this.target=new F(t,s,{type:E,format:R,minFilter:M,magFilter:M,depthBuffer:!0}),this.target}drawDistance(t,s,r){const{renderer:a,scene:o}=t,n=[],i=[];for(const e of t.sky)e.visible&&(e.visible=!1,n.push(e));o.traverseVisible(e=>{if(e instanceof P){if(t.isSolid(e)){i.push({mesh:e,material:e.material}),e.material=Array.isArray(e.material)?e.material.map(c=>this.distanceMaterial(c)):this.distanceMaterial(e.material);return}}else if(!e.isPoints&&!e.isLine&&!e.isSprite)return;n.push(e)});for(const e of n)e.visible=!1;try{return this.drawInto(t,r,()=>a.render(o,s))}finally{for(const e of n)e.visible=!0;for(const{mesh:e,material:c}of i)e.material=c}}drawPhenomenon(t,s,r){return this.drawInto(t,r,()=>t.drawPhenomena(s))}drawInto(t,s,r){const{renderer:a,scene:o}=t,n=a.getRenderTarget(),i=a.autoClear,e=a.shadowMap.autoUpdate,c=o.fog,d=o.background,l=a.getClearAlpha(),u=a.getClearColor(new S);o.fog=null,o.background=null,a.shadowMap.autoUpdate=!1,a.setRenderTarget(s),a.setClearColor(0,0),a.clear(!0,!0,!0),a.autoClear=!1;try{r();const f=new Float32Array(s.width*s.height*4);return U.now(a,s,0,0,s.width,s.height,f),f}finally{a.autoClear=i,a.shadowMap.autoUpdate=e,a.setRenderTarget(n),a.setClearColor(u,l),o.fog=c,o.background=d}}distanceMaterial(t){const s=t.alphaTest??0,r=t.map??t.alphaMap??null,a=s>0&&r!==null,o=`${t.side}:${a?`${r.uuid}:${s}`:"-"}`;let n=this.materials.get(o);return n||(n=new k({defines:a?{CUTOUT:"",USE_UV:""}:{},uniforms:{cutoutMap:{value:r},cutoutAlpha:{value:s}},vertexShader:w.VERTEX,fragmentShader:w.FRAGMENT,side:t.side}),this.materials.set(o,n)),n}static VERTEX=`
|
|
2
|
+
#include <common>
|
|
3
|
+
#include <uv_pars_vertex>
|
|
4
|
+
#include <batching_pars_vertex>
|
|
5
|
+
#include <morphtarget_pars_vertex>
|
|
6
|
+
#include <skinning_pars_vertex>
|
|
7
|
+
varying float vDistance;
|
|
8
|
+
void main() {
|
|
9
|
+
#include <uv_vertex>
|
|
10
|
+
#include <batching_vertex>
|
|
11
|
+
#include <skinbase_vertex>
|
|
12
|
+
#include <begin_vertex>
|
|
13
|
+
#include <morphtarget_vertex>
|
|
14
|
+
#include <skinning_vertex>
|
|
15
|
+
#include <project_vertex>
|
|
16
|
+
vDistance = length(mvPosition.xyz);
|
|
17
|
+
}
|
|
18
|
+
`;static FRAGMENT=`
|
|
19
|
+
#include <uv_pars_fragment>
|
|
20
|
+
uniform sampler2D cutoutMap;
|
|
21
|
+
uniform float cutoutAlpha;
|
|
22
|
+
varying float vDistance;
|
|
23
|
+
void main() {
|
|
24
|
+
#ifdef CUTOUT
|
|
25
|
+
if (texture2D(cutoutMap, vUv).a < cutoutAlpha) discard;
|
|
26
|
+
#endif
|
|
27
|
+
gl_FragColor = vec4(vDistance, 0.0, 0.0, 1.0);
|
|
28
|
+
}
|
|
29
|
+
`}export{w as ControlPasses};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bA as Le,bB as Q,bC as he,bD as Me,bE as v,bF as de,b0 as y,b1 as pe,aS as F,bG as w,bu as U,bl as be,bH as Se,aw as ye,K,bI as we,V as C,Q as me,bJ as Ne,G as ge,bK as Ie,bL as Oe,aC as V,bM as Ce,bN as Te,bO as Fe,bP as Pe,bQ as He,bv as J,bp as Re,bR as Z,bS as ke,bT as De,bh as Ge,bU as X,bV as ve,ar as Ee,aE as Ue,aD as G,bW as Ke,aB as Be,bX as je,ap as Ve,bY as Xe,bZ as ze,b_ as qe,aQ as We,am as z,ax as Ye,bf as Qe,b$ as Je,c0 as Ze,c1 as $e,c2 as en,c3 as nn,c4 as tn,c5 as xe,b7 as sn,bw as ne,c6 as te,c7 as se,c8 as ie,c9 as re,ca as rn,cb as on,as as an,at as cn}from"./rr0-sighting-editor.mjs";function oe(f,n){if(n===Le)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),f;if(n===Q||n===he){let e=f.getIndex();if(e===null){const r=[],a=f.getAttribute("position");if(a!==void 0){for(let o=0;o<a.count;o++)r.push(o);f.setIndex(r),e=f.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),f}const s=e.count-2,t=[];if(n===Q)for(let r=1;r<=s;r++)t.push(e.getX(0)),t.push(e.getX(r)),t.push(e.getX(r+1));else for(let r=0;r<s;r++)r%2===0?(t.push(e.getX(r)),t.push(e.getX(r+1)),t.push(e.getX(r+2))):(t.push(e.getX(r+2)),t.push(e.getX(r+1)),t.push(e.getX(r)));t.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const i=f.clone();return i.setIndex(t),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",n),f}class jn extends Me{constructor(n){super(n),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new dn(e)}),this.register(function(e){return new pn(e)}),this.register(function(e){return new Ln(e)}),this.register(function(e){return new Mn(e)}),this.register(function(e){return new bn(e)}),this.register(function(e){return new gn(e)}),this.register(function(e){return new Tn(e)}),this.register(function(e){return new Rn(e)}),this.register(function(e){return new En(e)}),this.register(function(e){return new hn(e)}),this.register(function(e){return new xn(e)}),this.register(function(e){return new mn(e)}),this.register(function(e){return new _n(e)}),this.register(function(e){return new An(e)}),this.register(function(e){return new ln(e)}),this.register(function(e){return new ae(e,g.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new ae(e,g.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new Sn(e)})}load(n,e,s,t){const i=this;let r;if(this.resourcePath!=="")r=this.resourcePath;else if(this.path!==""){const c=v.extractUrlBase(n);r=v.resolveURL(c,this.path)}else r=v.extractUrlBase(n);this.manager.itemStart(n);const a=function(c){t?t(c):console.error(c),i.manager.itemError(n),i.manager.itemEnd(n)},o=new de(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(n,function(c){try{i.parse(c,r,function(u){e(u),i.manager.itemEnd(n)},a)}catch(u){a(u)}},s,a)}setDRACOLoader(n){return this.dracoLoader=n,this}setKTX2Loader(n){return this.ktx2Loader=n,this}setMeshoptDecoder(n){return this.meshoptDecoder=n,this}register(n){return this.pluginCallbacks.indexOf(n)===-1&&this.pluginCallbacks.push(n),this}unregister(n){return this.pluginCallbacks.indexOf(n)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(n),1),this}parse(n,e,s,t){let i;const r={},a={},o=new TextDecoder;if(typeof n=="string")i=JSON.parse(n);else if(n instanceof ArrayBuffer)if(o.decode(new Uint8Array(n,0,4))===Ae){try{r[g.KHR_BINARY_GLTF]=new yn(n)}catch(l){t&&t(l);return}i=JSON.parse(r[g.KHR_BINARY_GLTF].content)}else i=JSON.parse(o.decode(n));else i=n;if(i.asset===void 0||i.asset.version[0]<2){t&&t(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new Un(i,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){const l=this.pluginCallbacks[u](c);l.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[l.name]=l,r[l.name]=!0}if(i.extensionsUsed)for(let u=0;u<i.extensionsUsed.length;++u){const l=i.extensionsUsed[u],h=i.extensionsRequired||[];switch(l){case g.KHR_MATERIALS_UNLIT:r[l]=new fn;break;case g.KHR_DRACO_MESH_COMPRESSION:r[l]=new wn(i,this.dracoLoader);break;case g.KHR_TEXTURE_TRANSFORM:r[l]=new Nn;break;case g.KHR_MESH_QUANTIZATION:r[l]=new In;break;default:h.indexOf(l)>=0&&a[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}c.setExtensions(r),c.setPlugins(a),c.parse(s,t)}parseAsync(n,e){const s=this;return new Promise(function(t,i){s.parse(n,e,t,i)})}}function un(){let f={};return{get:function(n){return f[n]},add:function(n,e){f[n]=e},remove:function(n){delete f[n]},removeAll:function(){f={}}}}function _(f,n,e){const s=f.json.materials[n];return s.extensions&&s.extensions[e]?s.extensions[e]:null}const g={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ln{constructor(n){this.parser=n,this.name=g.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const n=this.parser,e=this.parser.json.nodes||[];for(let s=0,t=e.length;s<t;s++){const i=e[s];i.extensions&&i.extensions[this.name]&&i.extensions[this.name].light!==void 0&&n._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(n){const e=this.parser,s="light:"+n;let t=e.cache.get(s);if(t)return t;const i=e.json,o=((i.extensions&&i.extensions[this.name]||{}).lights||[])[n];let c;const u=new F(16777215);o.color!==void 0&&u.setRGB(o.color[0],o.color[1],o.color[2],w);const l=o.range!==void 0?o.range:0;switch(o.type){case"directional":c=new ye(u),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new Se(u),c.distance=l;break;case"spot":c=new be(u),c.distance=l,o.spot=o.spot||{},o.spot.innerConeAngle=o.spot.innerConeAngle!==void 0?o.spot.innerConeAngle:0,o.spot.outerConeAngle=o.spot.outerConeAngle!==void 0?o.spot.outerConeAngle:Math.PI/4,c.angle=o.spot.outerConeAngle,c.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return c.position.set(0,0,0),S(c,o),o.intensity!==void 0&&(c.intensity=o.intensity),c.name=e.createUniqueName(o.name||"light_"+n),t=Promise.resolve(c),e.cache.add(s,t),t}getDependency(n,e){if(n==="light")return this._loadLight(e)}createNodeAttachment(n){const e=this,s=this.parser,i=s.json.nodes[n],a=(i.extensions&&i.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(o){return s._getNodeRef(e.cache,a,o)})}}class fn{constructor(){this.name=g.KHR_MATERIALS_UNLIT}getMaterialType(){return G}extendParams(n,e,s){const t=[];n.color=new F(1,1,1),n.opacity=1;const i=e.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const r=i.baseColorFactor;n.color.setRGB(r[0],r[1],r[2],w),n.opacity=r[3]}i.baseColorTexture!==void 0&&t.push(s.assignTexture(n,"map",i.baseColorTexture,U))}return Promise.all(t)}}class hn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);return s===null||s.emissiveStrength!==void 0&&(e.emissiveIntensity=s.emissiveStrength),Promise.resolve()}}class dn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_CLEARCOAT}getMaterialType(n){return _(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];if(s.clearcoatFactor!==void 0&&(e.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&t.push(this.parser.assignTexture(e,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&t.push(this.parser.assignTexture(e,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(t.push(this.parser.assignTexture(e,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const i=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new pe(i,i)}return Promise.all(t)}}class pn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_DISPERSION}getMaterialType(n){return _(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);return s===null||(e.dispersion=s.dispersion!==void 0?s.dispersion:0),Promise.resolve()}}class mn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_IRIDESCENCE}getMaterialType(n){return _(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.iridescenceFactor!==void 0&&(e.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&t.push(this.parser.assignTexture(e,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(e.iridescenceIOR=s.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&t.push(this.parser.assignTexture(e,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(t)}}class gn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_SHEEN}getMaterialType(n){return _(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];if(e.sheenColor=new F(0,0,0),e.sheenRoughness=0,e.sheen=1,s.sheenColorFactor!==void 0){const i=s.sheenColorFactor;e.sheenColor.setRGB(i[0],i[1],i[2],w)}return s.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&t.push(this.parser.assignTexture(e,"sheenColorMap",s.sheenColorTexture,U)),s.sheenRoughnessTexture!==void 0&&t.push(this.parser.assignTexture(e,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(t)}}class Tn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_TRANSMISSION}getMaterialType(n){return _(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.transmissionFactor!==void 0&&(e.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&t.push(this.parser.assignTexture(e,"transmissionMap",s.transmissionTexture)),Promise.all(t)}}class Rn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_VOLUME}getMaterialType(n){return _(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];e.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&t.push(this.parser.assignTexture(e,"thicknessMap",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||1/0;const i=s.attenuationColor||[1,1,1];return e.attenuationColor=new F().setRGB(i[0],i[1],i[2],w),Promise.all(t)}}class En{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_IOR}getMaterialType(n){return _(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);return s===null||(e.ior=s.ior!==void 0?s.ior:1.5,e.ior===0&&(e.ior=1e3)),Promise.resolve()}}class xn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_SPECULAR}getMaterialType(n){return _(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];e.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&t.push(this.parser.assignTexture(e,"specularIntensityMap",s.specularTexture));const i=s.specularColorFactor||[1,1,1];return e.specularColor=new F().setRGB(i[0],i[1],i[2],w),s.specularColorTexture!==void 0&&t.push(this.parser.assignTexture(e,"specularColorMap",s.specularColorTexture,U)),Promise.all(t)}}class An{constructor(n){this.parser=n,this.name=g.EXT_MATERIALS_BUMP}getMaterialType(n){return _(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return e.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&t.push(this.parser.assignTexture(e,"bumpMap",s.bumpTexture)),Promise.all(t)}}class _n{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_ANISOTROPY}getMaterialType(n){return _(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.anisotropyStrength!==void 0&&(e.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(e.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&t.push(this.parser.assignTexture(e,"anisotropyMap",s.anisotropyTexture)),Promise.all(t)}}class Ln{constructor(n){this.parser=n,this.name=g.KHR_TEXTURE_BASISU}loadTexture(n){const e=this.parser,s=e.json,t=s.textures[n];if(!t.extensions||!t.extensions[this.name])return null;const i=t.extensions[this.name],r=e.options.ktx2Loader;if(!r){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(n,i.source,r)}}class Mn{constructor(n){this.parser=n,this.name=g.EXT_TEXTURE_WEBP}loadTexture(n){const e=this.name,s=this.parser,t=s.json,i=t.textures[n];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],a=t.images[r.source];let o=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(o=c)}return s.loadTextureImage(n,r.source,o)}}class bn{constructor(n){this.parser=n,this.name=g.EXT_TEXTURE_AVIF}loadTexture(n){const e=this.name,s=this.parser,t=s.json,i=t.textures[n];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],a=t.images[r.source];let o=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(o=c)}return s.loadTextureImage(n,r.source,o)}}class ae{constructor(n,e){this.name=e,this.parser=n}loadBufferView(n){const e=this.parser.json,s=e.bufferViews[n];if(s.extensions&&s.extensions[this.name]){const t=s.extensions[this.name],i=this.parser.getDependency("buffer",t.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(a){const o=t.byteOffset||0,c=t.byteLength||0,u=t.count,l=t.byteStride,h=new Uint8Array(a,o,c);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(u,l,h,t.mode,t.filter).then(function(d){return d.buffer}):r.ready.then(function(){const d=new ArrayBuffer(u*l);return r.decodeGltfBuffer(new Uint8Array(d),u,l,h,t.mode,t.filter),d})})}else return null}}class Sn{constructor(n){this.name=g.EXT_MESH_GPU_INSTANCING,this.parser=n}createNodeMesh(n){const e=this.parser.json,s=e.nodes[n];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const t=e.meshes[s.mesh];for(const c of t.primitives)if(c.mode!==M.TRIANGLES&&c.mode!==M.TRIANGLE_STRIP&&c.mode!==M.TRIANGLE_FAN&&c.mode!==void 0)return null;const r=s.extensions[this.name].attributes,a=[],o={};for(const c in r)a.push(this.parser.getDependency("accessor",r[c]).then(u=>(o[c]=u,o[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(n)),Promise.all(a).then(c=>{const u=c.pop(),l=u.isGroup?u.children:[u],h=c[0].count,d=[];for(const p of l){const R=new K,m=new C,T=new me,A=new C(1,1,1),x=new we(p.geometry,p.material,h);for(let E=0;E<h;E++)o.TRANSLATION&&m.fromBufferAttribute(o.TRANSLATION,E),o.ROTATION&&T.fromBufferAttribute(o.ROTATION,E),o.SCALE&&A.fromBufferAttribute(o.SCALE,E),x.setMatrixAt(E,R.compose(m,T,A));for(const E in o)if(E==="_COLOR_0"){const L=o[E];x.instanceColor=new Ne(L.array,L.itemSize,L.normalized)}else E!=="TRANSLATION"&&E!=="ROTATION"&&E!=="SCALE"&&p.geometry.setAttribute(E,o[E]);ge.prototype.copy.call(x,p),this.parser.assignFinalMaterial(x),d.push(x)}return u.isGroup?(u.clear(),u.add(...d),u):d[0]}))}}const Ae="glTF",D=12,ce={JSON:1313821514,BIN:5130562};class yn{constructor(n){this.name=g.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(n,0,D),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(n.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==Ae)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const t=this.header.length-D,i=new DataView(n,D);let r=0;for(;r<t;){const a=i.getUint32(r,!0);r+=4;const o=i.getUint32(r,!0);if(r+=4,o===ce.JSON){const c=new Uint8Array(n,D+r,a);this.content=s.decode(c)}else if(o===ce.BIN){const c=D+r;this.body=n.slice(c,c+a)}r+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class wn{constructor(n,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=g.KHR_DRACO_MESH_COMPRESSION,this.json=n,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(n,e){const s=this.json,t=this.dracoLoader,i=n.extensions[this.name].bufferView,r=n.extensions[this.name].attributes,a={},o={},c={};for(const u in r){const l=$[u]||u.toLowerCase();a[l]=r[u]}for(const u in n.attributes){const l=$[u]||u.toLowerCase();if(r[u]!==void 0){const h=s.accessors[n.attributes[u]],d=H[h.componentType];c[l]=d.name,o[l]=h.normalized===!0}}return e.getDependency("bufferView",i).then(function(u){return new Promise(function(l,h){t.decodeDracoFile(u,function(d){for(const p in d.attributes){const R=d.attributes[p],m=o[p];m!==void 0&&(R.normalized=m)}l(d)},a,c,w,h)})})}}class Nn{constructor(){this.name=g.KHR_TEXTURE_TRANSFORM}extendTexture(n,e){return(e.texCoord===void 0||e.texCoord===n.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(n=n.clone(),e.texCoord!==void 0&&(n.channel=e.texCoord),e.offset!==void 0&&n.offset.fromArray(e.offset),e.rotation!==void 0&&(n.rotation=e.rotation),e.scale!==void 0&&n.repeat.fromArray(e.scale),n.needsUpdate=!0),n}}class In{constructor(){this.name=g.KHR_MESH_QUANTIZATION}}class _e extends on{constructor(n,e,s,t){super(n,e,s,t)}copySampleValue_(n){const e=this.resultBuffer,s=this.sampleValues,t=this.valueSize,i=n*t*3+t;for(let r=0;r!==t;r++)e[r]=s[i+r];return e}interpolate_(n,e,s,t){const i=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=a*2,c=a*3,u=t-e,l=(s-e)/u,h=l*l,d=h*l,p=n*c,R=p-c,m=-2*d+3*h,T=d-h,A=1-m,x=T-h+l;for(let E=0;E!==a;E++){const L=r[R+E+a],N=r[R+E+o]*u,b=r[p+E+a],k=r[p+E]*u;i[E]=A*L+x*N+m*b+T*k}return i}}const On=new me;class Cn extends _e{interpolate_(n,e,s,t){const i=super.interpolate_(n,e,s,t);return On.fromArray(i).normalize().toArray(i),i}}const M={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},H={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ue={9728:Re,9729:J,9984:He,9985:Pe,9986:Fe,9987:Te},le={33071:De,33648:ke,10497:Z},q={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},$={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},I={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Fn={CUBICSPLINE:void 0,LINEAR:xe,STEP:tn},W={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Pn(f){return f.DefaultMaterial===void 0&&(f.DefaultMaterial=new Ee({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:rn})),f.DefaultMaterial}function O(f,n,e){for(const s in e.extensions)f[s]===void 0&&(n.userData.gltfExtensions=n.userData.gltfExtensions||{},n.userData.gltfExtensions[s]=e.extensions[s])}function S(f,n){n.extras!==void 0&&(typeof n.extras=="object"?Object.assign(f.userData,n.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+n.extras))}function Hn(f,n,e){let s=!1,t=!1,i=!1;for(let c=0,u=n.length;c<u;c++){const l=n[c];if(l.POSITION!==void 0&&(s=!0),l.NORMAL!==void 0&&(t=!0),l.COLOR_0!==void 0&&(i=!0),s&&t&&i)break}if(!s&&!t&&!i)return Promise.resolve(f);const r=[],a=[],o=[];for(let c=0,u=n.length;c<u;c++){const l=n[c];if(s){const h=l.POSITION!==void 0?e.getDependency("accessor",l.POSITION):f.attributes.position;r.push(h)}if(t){const h=l.NORMAL!==void 0?e.getDependency("accessor",l.NORMAL):f.attributes.normal;a.push(h)}if(i){const h=l.COLOR_0!==void 0?e.getDependency("accessor",l.COLOR_0):f.attributes.color;o.push(h)}}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o)]).then(function(c){const u=c[0],l=c[1],h=c[2];return s&&(f.morphAttributes.position=u),t&&(f.morphAttributes.normal=l),i&&(f.morphAttributes.color=h),f.morphTargetsRelative=!0,f})}function kn(f,n){if(f.updateMorphTargets(),n.weights!==void 0)for(let e=0,s=n.weights.length;e<s;e++)f.morphTargetInfluences[e]=n.weights[e];if(n.extras&&Array.isArray(n.extras.targetNames)){const e=n.extras.targetNames;if(f.morphTargetInfluences.length===e.length){f.morphTargetDictionary={};for(let s=0,t=e.length;s<t;s++)f.morphTargetDictionary[e[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Dn(f){let n;const e=f.extensions&&f.extensions[g.KHR_DRACO_MESH_COMPRESSION];if(e?n="draco:"+e.bufferView+":"+e.indices+":"+Y(e.attributes):n=f.indices+":"+Y(f.attributes)+":"+f.mode,f.targets!==void 0)for(let s=0,t=f.targets.length;s<t;s++)n+=":"+Y(f.targets[s]);return n}function Y(f){let n="";const e=Object.keys(f).sort();for(let s=0,t=e.length;s<t;s++)n+=e[s]+":"+f[e[s]]+";";return n}function ee(f){switch(f){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Gn(f){return f.search(/\.jpe?g($|\?)/i)>0||f.search(/^data\:image\/jpeg/)===0?"image/jpeg":f.search(/\.webp($|\?)/i)>0||f.search(/^data\:image\/webp/)===0?"image/webp":f.search(/\.ktx2($|\?)/i)>0||f.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const vn=new K;class Un{constructor(n={},e={}){this.json=n,this.extensions={},this.plugins={},this.options=e,this.cache=new un,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,t=-1,i=!1,r=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){const a=navigator.userAgent;s=/^((?!chrome|android).)*safari/i.test(a)===!0;const o=a.match(/Version\/(\d+)/);t=s&&o?parseInt(o[1],10):-1,i=a.indexOf("Firefox")>-1,r=i?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||s&&t<17||i&&r<98?this.textureLoader=new Ie(this.options.manager):this.textureLoader=new Oe(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new de(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(n){this.extensions=n}setPlugins(n){this.plugins=n}parse(n,e){const s=this,t=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(r){return r._markDefs&&r._markDefs()}),Promise.all(this._invokeAll(function(r){return r.beforeRoot&&r.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(r){const a={scene:r[0][t.scene||0],scenes:r[0],animations:r[1],cameras:r[2],asset:t.asset,parser:s,userData:{}};return O(i,a,t),S(a,t),Promise.all(s._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){for(const o of a.scenes)o.updateMatrixWorld();n(a)})}).catch(e)}_markDefs(){const n=this.json.nodes||[],e=this.json.skins||[],s=this.json.meshes||[];for(let t=0,i=e.length;t<i;t++){const r=e[t].joints;for(let a=0,o=r.length;a<o;a++)n[r[a]].isBone=!0}for(let t=0,i=n.length;t<i;t++){const r=n[t];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(s[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(n,e){e!==void 0&&(n.refs[e]===void 0&&(n.refs[e]=n.uses[e]=0),n.refs[e]++)}_getNodeRef(n,e,s){if(n.refs[e]<=1)return s;const t=s.clone(),i=(r,a)=>{const o=this.associations.get(r);o!=null&&this.associations.set(a,o);for(const[c,u]of r.children.entries())i(u,a.children[c])};return i(s,t),t.name+="_instance_"+n.uses[e]++,t}_invokeOne(n){const e=Object.values(this.plugins);e.push(this);for(let s=0;s<e.length;s++){const t=n(e[s]);if(t)return t}return null}_invokeAll(n){const e=Object.values(this.plugins);e.unshift(this);const s=[];for(let t=0;t<e.length;t++){const i=n(e[t]);i&&s.push(i)}return s}getDependency(n,e){const s=n+":"+e;let t=this.cache.get(s);if(!t){switch(n){case"scene":t=this.loadScene(e);break;case"node":t=this._invokeOne(function(i){return i.loadNode&&i.loadNode(e)});break;case"mesh":t=this._invokeOne(function(i){return i.loadMesh&&i.loadMesh(e)});break;case"accessor":t=this.loadAccessor(e);break;case"bufferView":t=this._invokeOne(function(i){return i.loadBufferView&&i.loadBufferView(e)});break;case"buffer":t=this.loadBuffer(e);break;case"material":t=this._invokeOne(function(i){return i.loadMaterial&&i.loadMaterial(e)});break;case"texture":t=this._invokeOne(function(i){return i.loadTexture&&i.loadTexture(e)});break;case"skin":t=this.loadSkin(e);break;case"animation":t=this._invokeOne(function(i){return i.loadAnimation&&i.loadAnimation(e)});break;case"camera":t=this.loadCamera(e);break;default:if(t=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(n,e)}),!t)throw new Error("Unknown type: "+n);break}this.cache.add(s,t)}return t}getDependencies(n){let e=this.cache.get(n);if(!e){const s=this,t=this.json[n+(n==="mesh"?"es":"s")]||[];e=Promise.all(t.map(function(i,r){return s.getDependency(n,r)})),this.cache.add(n,e)}return e}loadBuffer(n){const e=this.json.buffers[n],s=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&n===0)return Promise.resolve(this.extensions[g.KHR_BINARY_GLTF].body);const t=this.options;return new Promise(function(i,r){s.load(v.resolveURL(e.uri,t.path),i,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(n){const e=this.json.bufferViews[n];return this.getDependency("buffer",e.buffer).then(function(s){const t=e.byteLength||0,i=e.byteOffset||0;return s.slice(i,i+t)})}loadAccessor(n){const e=this,s=this.json,t=this.json.accessors[n];if(t.bufferView===void 0&&t.sparse===void 0){const r=q[t.type],a=H[t.componentType],o=t.normalized===!0,c=new a(t.count*r);return Promise.resolve(new V(c,r,o))}const i=[];return t.bufferView!==void 0?i.push(this.getDependency("bufferView",t.bufferView)):i.push(null),t.sparse!==void 0&&(i.push(this.getDependency("bufferView",t.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",t.sparse.values.bufferView))),Promise.all(i).then(function(r){const a=r[0],o=q[t.type],c=H[t.componentType],u=c.BYTES_PER_ELEMENT,l=u*o,h=t.byteOffset||0,d=t.bufferView!==void 0?s.bufferViews[t.bufferView].byteStride:void 0,p=t.normalized===!0;let R,m;if(d&&d!==l){const T=Math.floor(h/d),A="InterleavedBuffer:"+t.bufferView+":"+t.componentType+":"+T+":"+t.count;let x=e.cache.get(A);x||(R=new c(a,T*d,t.count*d/u),x=new Ce(R,d/u),e.cache.add(A,x)),m=new sn(x,o,h%d/u,p)}else a===null?R=new c(t.count*o):R=new c(a,h,t.count*o),m=new V(R,o,p);if(t.sparse!==void 0){const T=q.SCALAR,A=H[t.sparse.indices.componentType],x=t.sparse.indices.byteOffset||0,E=t.sparse.values.byteOffset||0,L=new A(r[1],x,t.sparse.count*T),N=new c(r[2],E,t.sparse.count*o);a!==null&&(m=new V(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let b=0,k=L.length;b<k;b++){const P=L[b];if(m.setX(P,N[b*o]),o>=2&&m.setY(P,N[b*o+1]),o>=3&&m.setZ(P,N[b*o+2]),o>=4&&m.setW(P,N[b*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=p}return m})}loadTexture(n){const e=this.json,s=this.options,i=e.textures[n].source,r=e.images[i];let a=this.textureLoader;if(r.uri){const o=s.manager.getHandler(r.uri);o!==null&&(a=o)}return this.loadTextureImage(n,i,a)}loadTextureImage(n,e,s){const t=this,i=this.json,r=i.textures[n],a=i.images[e],o=(a.uri||a.bufferView)+":"+r.sampler;if(this.textureCache[o])return this.textureCache[o];const c=this.loadImageSource(e,s).then(function(u){u.flipY=!1,u.name=r.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const h=(i.samplers||{})[r.sampler]||{};return u.magFilter=ue[h.magFilter]||J,u.minFilter=ue[h.minFilter]||Te,u.wrapS=le[h.wrapS]||Z,u.wrapT=le[h.wrapT]||Z,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==Re&&u.minFilter!==J,t.associations.set(u,{textures:n}),u}).catch(function(){return null});return this.textureCache[o]=c,c}loadImageSource(n,e){const s=this,t=this.json,i=this.options;if(this.sourceCache[n]!==void 0)return this.sourceCache[n].then(l=>l.clone());const r=t.images[n],a=self.URL||self.webkitURL;let o=r.uri||"",c=!1;if(r.bufferView!==void 0)o=s.getDependency("bufferView",r.bufferView).then(function(l){c=!0;const h=new Blob([l],{type:r.mimeType});return o=a.createObjectURL(h),o});else if(r.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+n+" is missing URI and bufferView");const u=Promise.resolve(o).then(function(l){return new Promise(function(h,d){let p=h;e.isImageBitmapLoader===!0&&(p=function(R){const m=new ne(R);m.needsUpdate=!0,h(m)}),e.load(v.resolveURL(l,i.path),p,void 0,d)})}).then(function(l){return c===!0&&a.revokeObjectURL(o),S(l,r),l.userData.mimeType=r.mimeType||Gn(r.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),l});return this.sourceCache[n]=u,u}assignTexture(n,e,s,t){const i=this;return this.getDependency("texture",s.index).then(function(r){if(!r)return null;if(s.texCoord!==void 0&&s.texCoord>0&&(r=r.clone(),r.channel=s.texCoord),i.extensions[g.KHR_TEXTURE_TRANSFORM]){const a=s.extensions!==void 0?s.extensions[g.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const o=i.associations.get(r);r=i.extensions[g.KHR_TEXTURE_TRANSFORM].extendTexture(r,a),i.associations.set(r,o)}}return t!==void 0&&(r.colorSpace=t),n[e]=r,r})}assignFinalMaterial(n){const e=n.geometry;let s=n.material;const t=e.attributes.tangent===void 0,i=e.attributes.color!==void 0,r=e.attributes.normal===void 0;if(n.isPoints){const a="PointsMaterial:"+s.uuid;let o=this.cache.get(a);o||(o=new Ge,X.prototype.copy.call(o,s),o.color.copy(s.color),o.map=s.map,o.sizeAttenuation=!1,this.cache.add(a,o)),s=o}else if(n.isLine){const a="LineBasicMaterial:"+s.uuid;let o=this.cache.get(a);o||(o=new ve,X.prototype.copy.call(o,s),o.color.copy(s.color),o.map=s.map,this.cache.add(a,o)),s=o}if(t||i||r){let a="ClonedMaterial:"+s.uuid+":";t&&(a+="derivative-tangents:"),i&&(a+="vertex-colors:"),r&&(a+="flat-shading:");let o=this.cache.get(a);o||(o=s.clone(),i&&(o.vertexColors=!0),r&&(o.flatShading=!0),t&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),this.cache.add(a,o),this.associations.set(o,this.associations.get(s))),s=o}n.material=s}getMaterialType(){return Ee}loadMaterial(n){const e=this,s=this.json,t=this.extensions,i=s.materials[n];let r;const a={},o=i.extensions||{},c=[];if(o[g.KHR_MATERIALS_UNLIT]){const l=t[g.KHR_MATERIALS_UNLIT];r=l.getMaterialType(),c.push(l.extendParams(a,i,e))}else{const l=i.pbrMetallicRoughness||{};if(a.color=new F(1,1,1),a.opacity=1,Array.isArray(l.baseColorFactor)){const h=l.baseColorFactor;a.color.setRGB(h[0],h[1],h[2],w),a.opacity=h[3]}l.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",l.baseColorTexture,U)),a.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,a.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",l.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",l.metallicRoughnessTexture))),r=this._invokeOne(function(h){return h.getMaterialType&&h.getMaterialType(n)}),c.push(Promise.all(this._invokeAll(function(h){return h.extendMaterialParams&&h.extendMaterialParams(n,a)})))}i.doubleSided===!0&&(a.side=Ue);const u=i.alphaMode||W.OPAQUE;if(u===W.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===W.MASK&&(a.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5)),i.normalTexture!==void 0&&r!==G&&(c.push(e.assignTexture(a,"normalMap",i.normalTexture)),a.normalScale=new pe(1,1),i.normalTexture.scale!==void 0)){const l=i.normalTexture.scale;a.normalScale.set(l,l)}if(i.occlusionTexture!==void 0&&r!==G&&(c.push(e.assignTexture(a,"aoMap",i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&r!==G){const l=i.emissiveFactor;a.emissive=new F().setRGB(l[0],l[1],l[2],w)}return i.emissiveTexture!==void 0&&r!==G&&c.push(e.assignTexture(a,"emissiveMap",i.emissiveTexture,U)),Promise.all(c).then(function(){const l=new r(a);return i.name&&(l.name=i.name),S(l,i),e.associations.set(l,{materials:n}),i.extensions&&O(t,l,i),l})}createUniqueName(n){const e=Ke.sanitizeNodeName(n||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(n){const e=this,s=this.extensions,t=this.primitiveCache;function i(a){return s[g.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(o){return fe(o,a,e)})}const r=[];for(let a=0,o=n.length;a<o;a++){const c=n[a],u=Dn(c),l=t[u];if(l)r.push(l.promise);else{let h;c.extensions&&c.extensions[g.KHR_DRACO_MESH_COMPRESSION]?h=i(c):h=fe(new Be,c,e),t[u]={primitive:c,promise:h},r.push(h)}}return Promise.all(r)}loadMesh(n){const e=this,s=this.json,t=this.extensions,i=s.meshes[n],r=i.primitives,a=[];for(let o=0,c=r.length;o<c;o++){const u=r[o].material===void 0?Pn(this.cache):this.getDependency("material",r[o].material);a.push(u)}return a.push(e.loadGeometries(r)),Promise.all(a).then(function(o){const c=o.slice(0,o.length-1),u=o[o.length-1],l=[];for(let d=0,p=u.length;d<p;d++){const R=u[d],m=r[d];let T;const A=c[d];if(m.mode===M.TRIANGLES||m.mode===M.TRIANGLE_STRIP||m.mode===M.TRIANGLE_FAN||m.mode===void 0)T=i.isSkinnedMesh===!0?new je(R,A):new Ve(R,A),T.isSkinnedMesh===!0&&T.normalizeSkinWeights(),m.mode===M.TRIANGLE_STRIP?T.geometry=oe(T.geometry,he):m.mode===M.TRIANGLE_FAN&&(T.geometry=oe(T.geometry,Q));else if(m.mode===M.LINES)T=new Xe(R,A);else if(m.mode===M.LINE_STRIP)T=new ze(R,A);else if(m.mode===M.LINE_LOOP)T=new qe(R,A);else if(m.mode===M.POINTS)T=new We(R,A);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(T.geometry.morphAttributes).length>0&&kn(T,i),T.name=e.createUniqueName(i.name||"mesh_"+n),S(T,i),m.extensions&&O(t,T,m),e.assignFinalMaterial(T),l.push(T)}for(let d=0,p=l.length;d<p;d++)e.associations.set(l[d],{meshes:n,primitives:d});if(l.length===1)return i.extensions&&O(t,l[0],i),l[0];const h=new z;i.extensions&&O(t,h,i),e.associations.set(h,{meshes:n});for(let d=0,p=l.length;d<p;d++)h.add(l[d]);return h})}loadCamera(n){let e;const s=this.json.cameras[n],t=s[s.type];if(!t){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?e=new Ye(Qe.radToDeg(t.yfov),t.aspectRatio||1,t.znear||1,t.zfar||2e6):s.type==="orthographic"&&(e=new Je(-t.xmag,t.xmag,t.ymag,-t.ymag,t.znear,t.zfar)),s.name&&(e.name=this.createUniqueName(s.name)),S(e,s),Promise.resolve(e)}loadSkin(n){const e=this.json.skins[n],s=[];for(let t=0,i=e.joints.length;t<i;t++)s.push(this._loadNodeShallow(e.joints[t]));return e.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",e.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(t){const i=t.pop(),r=t,a=[],o=[];for(let c=0,u=r.length;c<u;c++){const l=r[c];if(l){a.push(l);const h=new K;i!==null&&h.fromArray(i.array,c*16),o.push(h)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[c])}return new Ze(a,o)})}loadAnimation(n){const e=this.json,s=this,t=e.animations[n],i=t.name?t.name:"animation_"+n,r=[],a=[],o=[],c=[],u=[];for(let l=0,h=t.channels.length;l<h;l++){const d=t.channels[l],p=t.samplers[d.sampler],R=d.target,m=R.node,T=t.parameters!==void 0?t.parameters[p.input]:p.input,A=t.parameters!==void 0?t.parameters[p.output]:p.output;R.node!==void 0&&(r.push(this.getDependency("node",m)),a.push(this.getDependency("accessor",T)),o.push(this.getDependency("accessor",A)),c.push(p),u.push(R))}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(u)]).then(function(l){const h=l[0],d=l[1],p=l[2],R=l[3],m=l[4],T=[];for(let x=0,E=h.length;x<E;x++){const L=h[x],N=d[x],b=p[x],k=R[x],P=m[x];if(L===void 0)continue;L.updateMatrix&&L.updateMatrix();const B=s._createAnimationTracks(L,N,b,k,P);if(B)for(let j=0;j<B.length;j++)T.push(B[j])}const A=new $e(i,void 0,T);return S(A,t),A})}createNodeMesh(n){const e=this.json,s=this,t=e.nodes[n];return t.mesh===void 0?null:s.getDependency("mesh",t.mesh).then(function(i){const r=s._getNodeRef(s.meshCache,t.mesh,i);return t.weights!==void 0&&r.traverse(function(a){if(a.isMesh)for(let o=0,c=t.weights.length;o<c;o++)a.morphTargetInfluences[o]=t.weights[o]}),r})}loadNode(n){const e=this.json,s=this,t=e.nodes[n],i=s._loadNodeShallow(n),r=[],a=t.children||[];for(let c=0,u=a.length;c<u;c++)r.push(s.getDependency("node",a[c]));const o=t.skin===void 0?Promise.resolve(null):s.getDependency("skin",t.skin);return Promise.all([i,Promise.all(r),o]).then(function(c){const u=c[0],l=c[1],h=c[2];h!==null&&u.traverse(function(d){d.isSkinnedMesh&&d.bind(h,vn)});for(let d=0,p=l.length;d<p;d++)u.add(l[d]);if(u.userData.pivot!==void 0&&l.length>0){const d=u.userData.pivot,p=l[0];u.pivot=new C().fromArray(d),u.position.x-=d[0],u.position.y-=d[1],u.position.z-=d[2],p.position.set(0,0,0),delete u.userData.pivot}return u})}_loadNodeShallow(n){const e=this.json,s=this.extensions,t=this;if(this.nodeCache[n]!==void 0)return this.nodeCache[n];const i=e.nodes[n],r=i.name?t.createUniqueName(i.name):"",a=[],o=t._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(n)});return o&&a.push(o),i.camera!==void 0&&a.push(t.getDependency("camera",i.camera).then(function(c){return t._getNodeRef(t.cameraCache,i.camera,c)})),t._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(n)}).forEach(function(c){a.push(c)}),this.nodeCache[n]=Promise.all(a).then(function(c){let u;if(i.isBone===!0?u=new en:c.length>1?u=new z:c.length===1?u=c[0]:u=new ge,u!==c[0])for(let l=0,h=c.length;l<h;l++)u.add(c[l]);if(i.name&&(u.userData.name=i.name,u.name=r),S(u,i),i.extensions&&O(s,u,i),i.matrix!==void 0){const l=new K;l.fromArray(i.matrix),u.applyMatrix4(l)}else i.translation!==void 0&&u.position.fromArray(i.translation),i.rotation!==void 0&&u.quaternion.fromArray(i.rotation),i.scale!==void 0&&u.scale.fromArray(i.scale);if(!t.associations.has(u))t.associations.set(u,{});else if(i.mesh!==void 0&&t.meshCache.refs[i.mesh]>1){const l=t.associations.get(u);t.associations.set(u,{...l})}return t.associations.get(u).nodes=n,u}),this.nodeCache[n]}loadScene(n){const e=this.extensions,s=this.json.scenes[n],t=this,i=new z;s.name&&(i.name=t.createUniqueName(s.name)),S(i,s),s.extensions&&O(e,i,s);const r=s.nodes||[],a=[];for(let o=0,c=r.length;o<c;o++)a.push(t.getDependency("node",r[o]));return Promise.all(a).then(function(o){for(let u=0,l=o.length;u<l;u++){const h=o[u];h.parent!==null?i.add(nn(h)):i.add(h)}const c=u=>{const l=new Map;for(const[h,d]of t.associations)(h instanceof X||h instanceof ne)&&l.set(h,d);return u.traverse(h=>{const d=t.associations.get(h);d!=null&&l.set(h,d)}),l};return t.associations=c(i),i})}_createAnimationTracks(n,e,s,t,i){const r=[],a=n.name?n.name:n.uuid,o=[];function c(d){d.morphTargetInfluences&&o.push(d.name?d.name:d.uuid)}I[i.path]===I.weights?(c(n),n.isGroup&&n.children.forEach(c)):o.push(a);let u;switch(I[i.path]){case I.weights:u=se;break;case I.rotation:u=ie;break;case I.translation:case I.scale:u=te;break;default:switch(s.itemSize){case 1:u=se;break;case 2:case 3:default:u=te;break}break}const l=t.interpolation!==void 0?Fn[t.interpolation]:xe,h=this._getArrayFromAccessor(s);for(let d=0,p=o.length;d<p;d++){const R=new u(o[d]+"."+I[i.path],e.array,h,l);t.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(R),r.push(R)}return r}_getArrayFromAccessor(n){let e=n.array;if(n.normalized){const s=ee(e.constructor),t=new Float32Array(e.length);for(let i=0,r=e.length;i<r;i++)t[i]=e[i]*s;e=t}return e}_createCubicSplineTrackInterpolant(n){n.createInterpolant=function(s){const t=this instanceof ie?Cn:_e;return new t(this.times,this.values,this.getValueSize()/3,s)},n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Kn(f,n,e){const s=n.attributes,t=new an;if(s.POSITION!==void 0){const a=e.json.accessors[s.POSITION],o=a.min,c=a.max;if(o!==void 0&&c!==void 0){if(t.set(new C(o[0],o[1],o[2]),new C(c[0],c[1],c[2])),a.normalized){const u=ee(H[a.componentType]);t.min.multiplyScalar(u),t.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const i=n.targets;if(i!==void 0){const a=new C,o=new C;for(let c=0,u=i.length;c<u;c++){const l=i[c];if(l.POSITION!==void 0){const h=e.json.accessors[l.POSITION],d=h.min,p=h.max;if(d!==void 0&&p!==void 0){if(o.setX(Math.max(Math.abs(d[0]),Math.abs(p[0]))),o.setY(Math.max(Math.abs(d[1]),Math.abs(p[1]))),o.setZ(Math.max(Math.abs(d[2]),Math.abs(p[2]))),h.normalized){const R=ee(H[h.componentType]);o.multiplyScalar(R)}a.max(o)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}t.expandByVector(a)}f.boundingBox=t;const r=new cn;t.getCenter(r.center),r.radius=t.min.distanceTo(t.max)/2,f.boundingSphere=r}function fe(f,n,e){const s=n.attributes,t=[];function i(r,a){return e.getDependency("accessor",r).then(function(o){f.setAttribute(a,o)})}for(const r in s){const a=$[r]||r.toLowerCase();a in f.attributes||t.push(i(s[r],a))}if(n.indices!==void 0&&!f.index){const r=e.getDependency("accessor",n.indices).then(function(a){f.setIndex(a)});t.push(r)}return re.workingColorSpace!==w&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${re.workingColorSpace}" not supported.`),S(f,n),Kn(f,n,e),Promise.all(t).then(function(){return n.targets!==void 0?Hn(f,n.targets,e):f})}export{jn as GLTFLoader};
|
|
1
|
+
import{bB as Le,bC as Q,bD as he,bE as Me,bF as v,bG as de,b0 as y,b1 as pe,aS as F,bH as w,bv as U,bl as be,bI as Se,aw as ye,K,bJ as we,V as C,Q as me,bK as Ne,G as ge,bL as Ie,bM as Oe,aC as V,bN as Ce,bO as Te,bP as Fe,bQ as Pe,bR as He,bw as J,bp as Re,bS as Z,bT as ke,bU as De,bh as Ge,bV as X,bW as ve,ar as Ee,aE as Ue,aD as G,bX as Ke,aB as Be,bY as je,ap as Ve,bZ as Xe,b_ as ze,b$ as qe,aQ as We,am as z,ax as Ye,bf as Qe,c0 as Je,c1 as Ze,c2 as $e,c3 as en,c4 as nn,c5 as tn,c6 as xe,b7 as sn,bx as ne,c7 as te,c8 as se,c9 as ie,ca as re,cb as rn,cc as on,as as an,at as cn}from"./rr0-sighting-editor.mjs";function oe(f,n){if(n===Le)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),f;if(n===Q||n===he){let e=f.getIndex();if(e===null){const r=[],a=f.getAttribute("position");if(a!==void 0){for(let o=0;o<a.count;o++)r.push(o);f.setIndex(r),e=f.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),f}const s=e.count-2,t=[];if(n===Q)for(let r=1;r<=s;r++)t.push(e.getX(0)),t.push(e.getX(r)),t.push(e.getX(r+1));else for(let r=0;r<s;r++)r%2===0?(t.push(e.getX(r)),t.push(e.getX(r+1)),t.push(e.getX(r+2))):(t.push(e.getX(r+2)),t.push(e.getX(r+1)),t.push(e.getX(r)));t.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const i=f.clone();return i.setIndex(t),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",n),f}class jn extends Me{constructor(n){super(n),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new dn(e)}),this.register(function(e){return new pn(e)}),this.register(function(e){return new Ln(e)}),this.register(function(e){return new Mn(e)}),this.register(function(e){return new bn(e)}),this.register(function(e){return new gn(e)}),this.register(function(e){return new Tn(e)}),this.register(function(e){return new Rn(e)}),this.register(function(e){return new En(e)}),this.register(function(e){return new hn(e)}),this.register(function(e){return new xn(e)}),this.register(function(e){return new mn(e)}),this.register(function(e){return new An(e)}),this.register(function(e){return new _n(e)}),this.register(function(e){return new ln(e)}),this.register(function(e){return new ae(e,g.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new ae(e,g.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new Sn(e)})}load(n,e,s,t){const i=this;let r;if(this.resourcePath!=="")r=this.resourcePath;else if(this.path!==""){const c=v.extractUrlBase(n);r=v.resolveURL(c,this.path)}else r=v.extractUrlBase(n);this.manager.itemStart(n);const a=function(c){t?t(c):console.error(c),i.manager.itemError(n),i.manager.itemEnd(n)},o=new de(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(n,function(c){try{i.parse(c,r,function(u){e(u),i.manager.itemEnd(n)},a)}catch(u){a(u)}},s,a)}setDRACOLoader(n){return this.dracoLoader=n,this}setKTX2Loader(n){return this.ktx2Loader=n,this}setMeshoptDecoder(n){return this.meshoptDecoder=n,this}register(n){return this.pluginCallbacks.indexOf(n)===-1&&this.pluginCallbacks.push(n),this}unregister(n){return this.pluginCallbacks.indexOf(n)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(n),1),this}parse(n,e,s,t){let i;const r={},a={},o=new TextDecoder;if(typeof n=="string")i=JSON.parse(n);else if(n instanceof ArrayBuffer)if(o.decode(new Uint8Array(n,0,4))===_e){try{r[g.KHR_BINARY_GLTF]=new yn(n)}catch(l){t&&t(l);return}i=JSON.parse(r[g.KHR_BINARY_GLTF].content)}else i=JSON.parse(o.decode(n));else i=n;if(i.asset===void 0||i.asset.version[0]<2){t&&t(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new Un(i,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){const l=this.pluginCallbacks[u](c);l.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[l.name]=l,r[l.name]=!0}if(i.extensionsUsed)for(let u=0;u<i.extensionsUsed.length;++u){const l=i.extensionsUsed[u],h=i.extensionsRequired||[];switch(l){case g.KHR_MATERIALS_UNLIT:r[l]=new fn;break;case g.KHR_DRACO_MESH_COMPRESSION:r[l]=new wn(i,this.dracoLoader);break;case g.KHR_TEXTURE_TRANSFORM:r[l]=new Nn;break;case g.KHR_MESH_QUANTIZATION:r[l]=new In;break;default:h.indexOf(l)>=0&&a[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}c.setExtensions(r),c.setPlugins(a),c.parse(s,t)}parseAsync(n,e){const s=this;return new Promise(function(t,i){s.parse(n,e,t,i)})}}function un(){let f={};return{get:function(n){return f[n]},add:function(n,e){f[n]=e},remove:function(n){delete f[n]},removeAll:function(){f={}}}}function A(f,n,e){const s=f.json.materials[n];return s.extensions&&s.extensions[e]?s.extensions[e]:null}const g={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ln{constructor(n){this.parser=n,this.name=g.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const n=this.parser,e=this.parser.json.nodes||[];for(let s=0,t=e.length;s<t;s++){const i=e[s];i.extensions&&i.extensions[this.name]&&i.extensions[this.name].light!==void 0&&n._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(n){const e=this.parser,s="light:"+n;let t=e.cache.get(s);if(t)return t;const i=e.json,o=((i.extensions&&i.extensions[this.name]||{}).lights||[])[n];let c;const u=new F(16777215);o.color!==void 0&&u.setRGB(o.color[0],o.color[1],o.color[2],w);const l=o.range!==void 0?o.range:0;switch(o.type){case"directional":c=new ye(u),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new Se(u),c.distance=l;break;case"spot":c=new be(u),c.distance=l,o.spot=o.spot||{},o.spot.innerConeAngle=o.spot.innerConeAngle!==void 0?o.spot.innerConeAngle:0,o.spot.outerConeAngle=o.spot.outerConeAngle!==void 0?o.spot.outerConeAngle:Math.PI/4,c.angle=o.spot.outerConeAngle,c.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return c.position.set(0,0,0),S(c,o),o.intensity!==void 0&&(c.intensity=o.intensity),c.name=e.createUniqueName(o.name||"light_"+n),t=Promise.resolve(c),e.cache.add(s,t),t}getDependency(n,e){if(n==="light")return this._loadLight(e)}createNodeAttachment(n){const e=this,s=this.parser,i=s.json.nodes[n],a=(i.extensions&&i.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(o){return s._getNodeRef(e.cache,a,o)})}}class fn{constructor(){this.name=g.KHR_MATERIALS_UNLIT}getMaterialType(){return G}extendParams(n,e,s){const t=[];n.color=new F(1,1,1),n.opacity=1;const i=e.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const r=i.baseColorFactor;n.color.setRGB(r[0],r[1],r[2],w),n.opacity=r[3]}i.baseColorTexture!==void 0&&t.push(s.assignTexture(n,"map",i.baseColorTexture,U))}return Promise.all(t)}}class hn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);return s===null||s.emissiveStrength!==void 0&&(e.emissiveIntensity=s.emissiveStrength),Promise.resolve()}}class dn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_CLEARCOAT}getMaterialType(n){return A(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];if(s.clearcoatFactor!==void 0&&(e.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&t.push(this.parser.assignTexture(e,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&t.push(this.parser.assignTexture(e,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(t.push(this.parser.assignTexture(e,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const i=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new pe(i,i)}return Promise.all(t)}}class pn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_DISPERSION}getMaterialType(n){return A(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);return s===null||(e.dispersion=s.dispersion!==void 0?s.dispersion:0),Promise.resolve()}}class mn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_IRIDESCENCE}getMaterialType(n){return A(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.iridescenceFactor!==void 0&&(e.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&t.push(this.parser.assignTexture(e,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(e.iridescenceIOR=s.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&t.push(this.parser.assignTexture(e,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(t)}}class gn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_SHEEN}getMaterialType(n){return A(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];if(e.sheenColor=new F(0,0,0),e.sheenRoughness=0,e.sheen=1,s.sheenColorFactor!==void 0){const i=s.sheenColorFactor;e.sheenColor.setRGB(i[0],i[1],i[2],w)}return s.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&t.push(this.parser.assignTexture(e,"sheenColorMap",s.sheenColorTexture,U)),s.sheenRoughnessTexture!==void 0&&t.push(this.parser.assignTexture(e,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(t)}}class Tn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_TRANSMISSION}getMaterialType(n){return A(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.transmissionFactor!==void 0&&(e.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&t.push(this.parser.assignTexture(e,"transmissionMap",s.transmissionTexture)),Promise.all(t)}}class Rn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_VOLUME}getMaterialType(n){return A(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];e.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&t.push(this.parser.assignTexture(e,"thicknessMap",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||1/0;const i=s.attenuationColor||[1,1,1];return e.attenuationColor=new F().setRGB(i[0],i[1],i[2],w),Promise.all(t)}}class En{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_IOR}getMaterialType(n){return A(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);return s===null||(e.ior=s.ior!==void 0?s.ior:1.5,e.ior===0&&(e.ior=1e3)),Promise.resolve()}}class xn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_SPECULAR}getMaterialType(n){return A(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];e.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&t.push(this.parser.assignTexture(e,"specularIntensityMap",s.specularTexture));const i=s.specularColorFactor||[1,1,1];return e.specularColor=new F().setRGB(i[0],i[1],i[2],w),s.specularColorTexture!==void 0&&t.push(this.parser.assignTexture(e,"specularColorMap",s.specularColorTexture,U)),Promise.all(t)}}class _n{constructor(n){this.parser=n,this.name=g.EXT_MATERIALS_BUMP}getMaterialType(n){return A(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return e.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&t.push(this.parser.assignTexture(e,"bumpMap",s.bumpTexture)),Promise.all(t)}}class An{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_ANISOTROPY}getMaterialType(n){return A(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.anisotropyStrength!==void 0&&(e.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(e.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&t.push(this.parser.assignTexture(e,"anisotropyMap",s.anisotropyTexture)),Promise.all(t)}}class Ln{constructor(n){this.parser=n,this.name=g.KHR_TEXTURE_BASISU}loadTexture(n){const e=this.parser,s=e.json,t=s.textures[n];if(!t.extensions||!t.extensions[this.name])return null;const i=t.extensions[this.name],r=e.options.ktx2Loader;if(!r){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(n,i.source,r)}}class Mn{constructor(n){this.parser=n,this.name=g.EXT_TEXTURE_WEBP}loadTexture(n){const e=this.name,s=this.parser,t=s.json,i=t.textures[n];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],a=t.images[r.source];let o=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(o=c)}return s.loadTextureImage(n,r.source,o)}}class bn{constructor(n){this.parser=n,this.name=g.EXT_TEXTURE_AVIF}loadTexture(n){const e=this.name,s=this.parser,t=s.json,i=t.textures[n];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],a=t.images[r.source];let o=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(o=c)}return s.loadTextureImage(n,r.source,o)}}class ae{constructor(n,e){this.name=e,this.parser=n}loadBufferView(n){const e=this.parser.json,s=e.bufferViews[n];if(s.extensions&&s.extensions[this.name]){const t=s.extensions[this.name],i=this.parser.getDependency("buffer",t.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(a){const o=t.byteOffset||0,c=t.byteLength||0,u=t.count,l=t.byteStride,h=new Uint8Array(a,o,c);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(u,l,h,t.mode,t.filter).then(function(d){return d.buffer}):r.ready.then(function(){const d=new ArrayBuffer(u*l);return r.decodeGltfBuffer(new Uint8Array(d),u,l,h,t.mode,t.filter),d})})}else return null}}class Sn{constructor(n){this.name=g.EXT_MESH_GPU_INSTANCING,this.parser=n}createNodeMesh(n){const e=this.parser.json,s=e.nodes[n];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const t=e.meshes[s.mesh];for(const c of t.primitives)if(c.mode!==M.TRIANGLES&&c.mode!==M.TRIANGLE_STRIP&&c.mode!==M.TRIANGLE_FAN&&c.mode!==void 0)return null;const r=s.extensions[this.name].attributes,a=[],o={};for(const c in r)a.push(this.parser.getDependency("accessor",r[c]).then(u=>(o[c]=u,o[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(n)),Promise.all(a).then(c=>{const u=c.pop(),l=u.isGroup?u.children:[u],h=c[0].count,d=[];for(const p of l){const R=new K,m=new C,T=new me,_=new C(1,1,1),x=new we(p.geometry,p.material,h);for(let E=0;E<h;E++)o.TRANSLATION&&m.fromBufferAttribute(o.TRANSLATION,E),o.ROTATION&&T.fromBufferAttribute(o.ROTATION,E),o.SCALE&&_.fromBufferAttribute(o.SCALE,E),x.setMatrixAt(E,R.compose(m,T,_));for(const E in o)if(E==="_COLOR_0"){const L=o[E];x.instanceColor=new Ne(L.array,L.itemSize,L.normalized)}else E!=="TRANSLATION"&&E!=="ROTATION"&&E!=="SCALE"&&p.geometry.setAttribute(E,o[E]);ge.prototype.copy.call(x,p),this.parser.assignFinalMaterial(x),d.push(x)}return u.isGroup?(u.clear(),u.add(...d),u):d[0]}))}}const _e="glTF",D=12,ce={JSON:1313821514,BIN:5130562};class yn{constructor(n){this.name=g.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(n,0,D),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(n.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==_e)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const t=this.header.length-D,i=new DataView(n,D);let r=0;for(;r<t;){const a=i.getUint32(r,!0);r+=4;const o=i.getUint32(r,!0);if(r+=4,o===ce.JSON){const c=new Uint8Array(n,D+r,a);this.content=s.decode(c)}else if(o===ce.BIN){const c=D+r;this.body=n.slice(c,c+a)}r+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class wn{constructor(n,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=g.KHR_DRACO_MESH_COMPRESSION,this.json=n,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(n,e){const s=this.json,t=this.dracoLoader,i=n.extensions[this.name].bufferView,r=n.extensions[this.name].attributes,a={},o={},c={};for(const u in r){const l=$[u]||u.toLowerCase();a[l]=r[u]}for(const u in n.attributes){const l=$[u]||u.toLowerCase();if(r[u]!==void 0){const h=s.accessors[n.attributes[u]],d=H[h.componentType];c[l]=d.name,o[l]=h.normalized===!0}}return e.getDependency("bufferView",i).then(function(u){return new Promise(function(l,h){t.decodeDracoFile(u,function(d){for(const p in d.attributes){const R=d.attributes[p],m=o[p];m!==void 0&&(R.normalized=m)}l(d)},a,c,w,h)})})}}class Nn{constructor(){this.name=g.KHR_TEXTURE_TRANSFORM}extendTexture(n,e){return(e.texCoord===void 0||e.texCoord===n.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(n=n.clone(),e.texCoord!==void 0&&(n.channel=e.texCoord),e.offset!==void 0&&n.offset.fromArray(e.offset),e.rotation!==void 0&&(n.rotation=e.rotation),e.scale!==void 0&&n.repeat.fromArray(e.scale),n.needsUpdate=!0),n}}class In{constructor(){this.name=g.KHR_MESH_QUANTIZATION}}class Ae extends on{constructor(n,e,s,t){super(n,e,s,t)}copySampleValue_(n){const e=this.resultBuffer,s=this.sampleValues,t=this.valueSize,i=n*t*3+t;for(let r=0;r!==t;r++)e[r]=s[i+r];return e}interpolate_(n,e,s,t){const i=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=a*2,c=a*3,u=t-e,l=(s-e)/u,h=l*l,d=h*l,p=n*c,R=p-c,m=-2*d+3*h,T=d-h,_=1-m,x=T-h+l;for(let E=0;E!==a;E++){const L=r[R+E+a],N=r[R+E+o]*u,b=r[p+E+a],k=r[p+E]*u;i[E]=_*L+x*N+m*b+T*k}return i}}const On=new me;class Cn extends Ae{interpolate_(n,e,s,t){const i=super.interpolate_(n,e,s,t);return On.fromArray(i).normalize().toArray(i),i}}const M={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},H={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ue={9728:Re,9729:J,9984:He,9985:Pe,9986:Fe,9987:Te},le={33071:De,33648:ke,10497:Z},q={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},$={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},I={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Fn={CUBICSPLINE:void 0,LINEAR:xe,STEP:tn},W={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Pn(f){return f.DefaultMaterial===void 0&&(f.DefaultMaterial=new Ee({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:rn})),f.DefaultMaterial}function O(f,n,e){for(const s in e.extensions)f[s]===void 0&&(n.userData.gltfExtensions=n.userData.gltfExtensions||{},n.userData.gltfExtensions[s]=e.extensions[s])}function S(f,n){n.extras!==void 0&&(typeof n.extras=="object"?Object.assign(f.userData,n.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+n.extras))}function Hn(f,n,e){let s=!1,t=!1,i=!1;for(let c=0,u=n.length;c<u;c++){const l=n[c];if(l.POSITION!==void 0&&(s=!0),l.NORMAL!==void 0&&(t=!0),l.COLOR_0!==void 0&&(i=!0),s&&t&&i)break}if(!s&&!t&&!i)return Promise.resolve(f);const r=[],a=[],o=[];for(let c=0,u=n.length;c<u;c++){const l=n[c];if(s){const h=l.POSITION!==void 0?e.getDependency("accessor",l.POSITION):f.attributes.position;r.push(h)}if(t){const h=l.NORMAL!==void 0?e.getDependency("accessor",l.NORMAL):f.attributes.normal;a.push(h)}if(i){const h=l.COLOR_0!==void 0?e.getDependency("accessor",l.COLOR_0):f.attributes.color;o.push(h)}}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o)]).then(function(c){const u=c[0],l=c[1],h=c[2];return s&&(f.morphAttributes.position=u),t&&(f.morphAttributes.normal=l),i&&(f.morphAttributes.color=h),f.morphTargetsRelative=!0,f})}function kn(f,n){if(f.updateMorphTargets(),n.weights!==void 0)for(let e=0,s=n.weights.length;e<s;e++)f.morphTargetInfluences[e]=n.weights[e];if(n.extras&&Array.isArray(n.extras.targetNames)){const e=n.extras.targetNames;if(f.morphTargetInfluences.length===e.length){f.morphTargetDictionary={};for(let s=0,t=e.length;s<t;s++)f.morphTargetDictionary[e[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Dn(f){let n;const e=f.extensions&&f.extensions[g.KHR_DRACO_MESH_COMPRESSION];if(e?n="draco:"+e.bufferView+":"+e.indices+":"+Y(e.attributes):n=f.indices+":"+Y(f.attributes)+":"+f.mode,f.targets!==void 0)for(let s=0,t=f.targets.length;s<t;s++)n+=":"+Y(f.targets[s]);return n}function Y(f){let n="";const e=Object.keys(f).sort();for(let s=0,t=e.length;s<t;s++)n+=e[s]+":"+f[e[s]]+";";return n}function ee(f){switch(f){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Gn(f){return f.search(/\.jpe?g($|\?)/i)>0||f.search(/^data\:image\/jpeg/)===0?"image/jpeg":f.search(/\.webp($|\?)/i)>0||f.search(/^data\:image\/webp/)===0?"image/webp":f.search(/\.ktx2($|\?)/i)>0||f.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const vn=new K;class Un{constructor(n={},e={}){this.json=n,this.extensions={},this.plugins={},this.options=e,this.cache=new un,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,t=-1,i=!1,r=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){const a=navigator.userAgent;s=/^((?!chrome|android).)*safari/i.test(a)===!0;const o=a.match(/Version\/(\d+)/);t=s&&o?parseInt(o[1],10):-1,i=a.indexOf("Firefox")>-1,r=i?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||s&&t<17||i&&r<98?this.textureLoader=new Ie(this.options.manager):this.textureLoader=new Oe(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new de(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(n){this.extensions=n}setPlugins(n){this.plugins=n}parse(n,e){const s=this,t=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(r){return r._markDefs&&r._markDefs()}),Promise.all(this._invokeAll(function(r){return r.beforeRoot&&r.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(r){const a={scene:r[0][t.scene||0],scenes:r[0],animations:r[1],cameras:r[2],asset:t.asset,parser:s,userData:{}};return O(i,a,t),S(a,t),Promise.all(s._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){for(const o of a.scenes)o.updateMatrixWorld();n(a)})}).catch(e)}_markDefs(){const n=this.json.nodes||[],e=this.json.skins||[],s=this.json.meshes||[];for(let t=0,i=e.length;t<i;t++){const r=e[t].joints;for(let a=0,o=r.length;a<o;a++)n[r[a]].isBone=!0}for(let t=0,i=n.length;t<i;t++){const r=n[t];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(s[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(n,e){e!==void 0&&(n.refs[e]===void 0&&(n.refs[e]=n.uses[e]=0),n.refs[e]++)}_getNodeRef(n,e,s){if(n.refs[e]<=1)return s;const t=s.clone(),i=(r,a)=>{const o=this.associations.get(r);o!=null&&this.associations.set(a,o);for(const[c,u]of r.children.entries())i(u,a.children[c])};return i(s,t),t.name+="_instance_"+n.uses[e]++,t}_invokeOne(n){const e=Object.values(this.plugins);e.push(this);for(let s=0;s<e.length;s++){const t=n(e[s]);if(t)return t}return null}_invokeAll(n){const e=Object.values(this.plugins);e.unshift(this);const s=[];for(let t=0;t<e.length;t++){const i=n(e[t]);i&&s.push(i)}return s}getDependency(n,e){const s=n+":"+e;let t=this.cache.get(s);if(!t){switch(n){case"scene":t=this.loadScene(e);break;case"node":t=this._invokeOne(function(i){return i.loadNode&&i.loadNode(e)});break;case"mesh":t=this._invokeOne(function(i){return i.loadMesh&&i.loadMesh(e)});break;case"accessor":t=this.loadAccessor(e);break;case"bufferView":t=this._invokeOne(function(i){return i.loadBufferView&&i.loadBufferView(e)});break;case"buffer":t=this.loadBuffer(e);break;case"material":t=this._invokeOne(function(i){return i.loadMaterial&&i.loadMaterial(e)});break;case"texture":t=this._invokeOne(function(i){return i.loadTexture&&i.loadTexture(e)});break;case"skin":t=this.loadSkin(e);break;case"animation":t=this._invokeOne(function(i){return i.loadAnimation&&i.loadAnimation(e)});break;case"camera":t=this.loadCamera(e);break;default:if(t=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(n,e)}),!t)throw new Error("Unknown type: "+n);break}this.cache.add(s,t)}return t}getDependencies(n){let e=this.cache.get(n);if(!e){const s=this,t=this.json[n+(n==="mesh"?"es":"s")]||[];e=Promise.all(t.map(function(i,r){return s.getDependency(n,r)})),this.cache.add(n,e)}return e}loadBuffer(n){const e=this.json.buffers[n],s=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&n===0)return Promise.resolve(this.extensions[g.KHR_BINARY_GLTF].body);const t=this.options;return new Promise(function(i,r){s.load(v.resolveURL(e.uri,t.path),i,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(n){const e=this.json.bufferViews[n];return this.getDependency("buffer",e.buffer).then(function(s){const t=e.byteLength||0,i=e.byteOffset||0;return s.slice(i,i+t)})}loadAccessor(n){const e=this,s=this.json,t=this.json.accessors[n];if(t.bufferView===void 0&&t.sparse===void 0){const r=q[t.type],a=H[t.componentType],o=t.normalized===!0,c=new a(t.count*r);return Promise.resolve(new V(c,r,o))}const i=[];return t.bufferView!==void 0?i.push(this.getDependency("bufferView",t.bufferView)):i.push(null),t.sparse!==void 0&&(i.push(this.getDependency("bufferView",t.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",t.sparse.values.bufferView))),Promise.all(i).then(function(r){const a=r[0],o=q[t.type],c=H[t.componentType],u=c.BYTES_PER_ELEMENT,l=u*o,h=t.byteOffset||0,d=t.bufferView!==void 0?s.bufferViews[t.bufferView].byteStride:void 0,p=t.normalized===!0;let R,m;if(d&&d!==l){const T=Math.floor(h/d),_="InterleavedBuffer:"+t.bufferView+":"+t.componentType+":"+T+":"+t.count;let x=e.cache.get(_);x||(R=new c(a,T*d,t.count*d/u),x=new Ce(R,d/u),e.cache.add(_,x)),m=new sn(x,o,h%d/u,p)}else a===null?R=new c(t.count*o):R=new c(a,h,t.count*o),m=new V(R,o,p);if(t.sparse!==void 0){const T=q.SCALAR,_=H[t.sparse.indices.componentType],x=t.sparse.indices.byteOffset||0,E=t.sparse.values.byteOffset||0,L=new _(r[1],x,t.sparse.count*T),N=new c(r[2],E,t.sparse.count*o);a!==null&&(m=new V(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let b=0,k=L.length;b<k;b++){const P=L[b];if(m.setX(P,N[b*o]),o>=2&&m.setY(P,N[b*o+1]),o>=3&&m.setZ(P,N[b*o+2]),o>=4&&m.setW(P,N[b*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=p}return m})}loadTexture(n){const e=this.json,s=this.options,i=e.textures[n].source,r=e.images[i];let a=this.textureLoader;if(r.uri){const o=s.manager.getHandler(r.uri);o!==null&&(a=o)}return this.loadTextureImage(n,i,a)}loadTextureImage(n,e,s){const t=this,i=this.json,r=i.textures[n],a=i.images[e],o=(a.uri||a.bufferView)+":"+r.sampler;if(this.textureCache[o])return this.textureCache[o];const c=this.loadImageSource(e,s).then(function(u){u.flipY=!1,u.name=r.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const h=(i.samplers||{})[r.sampler]||{};return u.magFilter=ue[h.magFilter]||J,u.minFilter=ue[h.minFilter]||Te,u.wrapS=le[h.wrapS]||Z,u.wrapT=le[h.wrapT]||Z,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==Re&&u.minFilter!==J,t.associations.set(u,{textures:n}),u}).catch(function(){return null});return this.textureCache[o]=c,c}loadImageSource(n,e){const s=this,t=this.json,i=this.options;if(this.sourceCache[n]!==void 0)return this.sourceCache[n].then(l=>l.clone());const r=t.images[n],a=self.URL||self.webkitURL;let o=r.uri||"",c=!1;if(r.bufferView!==void 0)o=s.getDependency("bufferView",r.bufferView).then(function(l){c=!0;const h=new Blob([l],{type:r.mimeType});return o=a.createObjectURL(h),o});else if(r.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+n+" is missing URI and bufferView");const u=Promise.resolve(o).then(function(l){return new Promise(function(h,d){let p=h;e.isImageBitmapLoader===!0&&(p=function(R){const m=new ne(R);m.needsUpdate=!0,h(m)}),e.load(v.resolveURL(l,i.path),p,void 0,d)})}).then(function(l){return c===!0&&a.revokeObjectURL(o),S(l,r),l.userData.mimeType=r.mimeType||Gn(r.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),l});return this.sourceCache[n]=u,u}assignTexture(n,e,s,t){const i=this;return this.getDependency("texture",s.index).then(function(r){if(!r)return null;if(s.texCoord!==void 0&&s.texCoord>0&&(r=r.clone(),r.channel=s.texCoord),i.extensions[g.KHR_TEXTURE_TRANSFORM]){const a=s.extensions!==void 0?s.extensions[g.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const o=i.associations.get(r);r=i.extensions[g.KHR_TEXTURE_TRANSFORM].extendTexture(r,a),i.associations.set(r,o)}}return t!==void 0&&(r.colorSpace=t),n[e]=r,r})}assignFinalMaterial(n){const e=n.geometry;let s=n.material;const t=e.attributes.tangent===void 0,i=e.attributes.color!==void 0,r=e.attributes.normal===void 0;if(n.isPoints){const a="PointsMaterial:"+s.uuid;let o=this.cache.get(a);o||(o=new Ge,X.prototype.copy.call(o,s),o.color.copy(s.color),o.map=s.map,o.sizeAttenuation=!1,this.cache.add(a,o)),s=o}else if(n.isLine){const a="LineBasicMaterial:"+s.uuid;let o=this.cache.get(a);o||(o=new ve,X.prototype.copy.call(o,s),o.color.copy(s.color),o.map=s.map,this.cache.add(a,o)),s=o}if(t||i||r){let a="ClonedMaterial:"+s.uuid+":";t&&(a+="derivative-tangents:"),i&&(a+="vertex-colors:"),r&&(a+="flat-shading:");let o=this.cache.get(a);o||(o=s.clone(),i&&(o.vertexColors=!0),r&&(o.flatShading=!0),t&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),this.cache.add(a,o),this.associations.set(o,this.associations.get(s))),s=o}n.material=s}getMaterialType(){return Ee}loadMaterial(n){const e=this,s=this.json,t=this.extensions,i=s.materials[n];let r;const a={},o=i.extensions||{},c=[];if(o[g.KHR_MATERIALS_UNLIT]){const l=t[g.KHR_MATERIALS_UNLIT];r=l.getMaterialType(),c.push(l.extendParams(a,i,e))}else{const l=i.pbrMetallicRoughness||{};if(a.color=new F(1,1,1),a.opacity=1,Array.isArray(l.baseColorFactor)){const h=l.baseColorFactor;a.color.setRGB(h[0],h[1],h[2],w),a.opacity=h[3]}l.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",l.baseColorTexture,U)),a.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,a.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",l.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",l.metallicRoughnessTexture))),r=this._invokeOne(function(h){return h.getMaterialType&&h.getMaterialType(n)}),c.push(Promise.all(this._invokeAll(function(h){return h.extendMaterialParams&&h.extendMaterialParams(n,a)})))}i.doubleSided===!0&&(a.side=Ue);const u=i.alphaMode||W.OPAQUE;if(u===W.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===W.MASK&&(a.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5)),i.normalTexture!==void 0&&r!==G&&(c.push(e.assignTexture(a,"normalMap",i.normalTexture)),a.normalScale=new pe(1,1),i.normalTexture.scale!==void 0)){const l=i.normalTexture.scale;a.normalScale.set(l,l)}if(i.occlusionTexture!==void 0&&r!==G&&(c.push(e.assignTexture(a,"aoMap",i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&r!==G){const l=i.emissiveFactor;a.emissive=new F().setRGB(l[0],l[1],l[2],w)}return i.emissiveTexture!==void 0&&r!==G&&c.push(e.assignTexture(a,"emissiveMap",i.emissiveTexture,U)),Promise.all(c).then(function(){const l=new r(a);return i.name&&(l.name=i.name),S(l,i),e.associations.set(l,{materials:n}),i.extensions&&O(t,l,i),l})}createUniqueName(n){const e=Ke.sanitizeNodeName(n||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(n){const e=this,s=this.extensions,t=this.primitiveCache;function i(a){return s[g.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(o){return fe(o,a,e)})}const r=[];for(let a=0,o=n.length;a<o;a++){const c=n[a],u=Dn(c),l=t[u];if(l)r.push(l.promise);else{let h;c.extensions&&c.extensions[g.KHR_DRACO_MESH_COMPRESSION]?h=i(c):h=fe(new Be,c,e),t[u]={primitive:c,promise:h},r.push(h)}}return Promise.all(r)}loadMesh(n){const e=this,s=this.json,t=this.extensions,i=s.meshes[n],r=i.primitives,a=[];for(let o=0,c=r.length;o<c;o++){const u=r[o].material===void 0?Pn(this.cache):this.getDependency("material",r[o].material);a.push(u)}return a.push(e.loadGeometries(r)),Promise.all(a).then(function(o){const c=o.slice(0,o.length-1),u=o[o.length-1],l=[];for(let d=0,p=u.length;d<p;d++){const R=u[d],m=r[d];let T;const _=c[d];if(m.mode===M.TRIANGLES||m.mode===M.TRIANGLE_STRIP||m.mode===M.TRIANGLE_FAN||m.mode===void 0)T=i.isSkinnedMesh===!0?new je(R,_):new Ve(R,_),T.isSkinnedMesh===!0&&T.normalizeSkinWeights(),m.mode===M.TRIANGLE_STRIP?T.geometry=oe(T.geometry,he):m.mode===M.TRIANGLE_FAN&&(T.geometry=oe(T.geometry,Q));else if(m.mode===M.LINES)T=new Xe(R,_);else if(m.mode===M.LINE_STRIP)T=new ze(R,_);else if(m.mode===M.LINE_LOOP)T=new qe(R,_);else if(m.mode===M.POINTS)T=new We(R,_);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(T.geometry.morphAttributes).length>0&&kn(T,i),T.name=e.createUniqueName(i.name||"mesh_"+n),S(T,i),m.extensions&&O(t,T,m),e.assignFinalMaterial(T),l.push(T)}for(let d=0,p=l.length;d<p;d++)e.associations.set(l[d],{meshes:n,primitives:d});if(l.length===1)return i.extensions&&O(t,l[0],i),l[0];const h=new z;i.extensions&&O(t,h,i),e.associations.set(h,{meshes:n});for(let d=0,p=l.length;d<p;d++)h.add(l[d]);return h})}loadCamera(n){let e;const s=this.json.cameras[n],t=s[s.type];if(!t){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?e=new Ye(Qe.radToDeg(t.yfov),t.aspectRatio||1,t.znear||1,t.zfar||2e6):s.type==="orthographic"&&(e=new Je(-t.xmag,t.xmag,t.ymag,-t.ymag,t.znear,t.zfar)),s.name&&(e.name=this.createUniqueName(s.name)),S(e,s),Promise.resolve(e)}loadSkin(n){const e=this.json.skins[n],s=[];for(let t=0,i=e.joints.length;t<i;t++)s.push(this._loadNodeShallow(e.joints[t]));return e.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",e.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(t){const i=t.pop(),r=t,a=[],o=[];for(let c=0,u=r.length;c<u;c++){const l=r[c];if(l){a.push(l);const h=new K;i!==null&&h.fromArray(i.array,c*16),o.push(h)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[c])}return new Ze(a,o)})}loadAnimation(n){const e=this.json,s=this,t=e.animations[n],i=t.name?t.name:"animation_"+n,r=[],a=[],o=[],c=[],u=[];for(let l=0,h=t.channels.length;l<h;l++){const d=t.channels[l],p=t.samplers[d.sampler],R=d.target,m=R.node,T=t.parameters!==void 0?t.parameters[p.input]:p.input,_=t.parameters!==void 0?t.parameters[p.output]:p.output;R.node!==void 0&&(r.push(this.getDependency("node",m)),a.push(this.getDependency("accessor",T)),o.push(this.getDependency("accessor",_)),c.push(p),u.push(R))}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(u)]).then(function(l){const h=l[0],d=l[1],p=l[2],R=l[3],m=l[4],T=[];for(let x=0,E=h.length;x<E;x++){const L=h[x],N=d[x],b=p[x],k=R[x],P=m[x];if(L===void 0)continue;L.updateMatrix&&L.updateMatrix();const B=s._createAnimationTracks(L,N,b,k,P);if(B)for(let j=0;j<B.length;j++)T.push(B[j])}const _=new $e(i,void 0,T);return S(_,t),_})}createNodeMesh(n){const e=this.json,s=this,t=e.nodes[n];return t.mesh===void 0?null:s.getDependency("mesh",t.mesh).then(function(i){const r=s._getNodeRef(s.meshCache,t.mesh,i);return t.weights!==void 0&&r.traverse(function(a){if(a.isMesh)for(let o=0,c=t.weights.length;o<c;o++)a.morphTargetInfluences[o]=t.weights[o]}),r})}loadNode(n){const e=this.json,s=this,t=e.nodes[n],i=s._loadNodeShallow(n),r=[],a=t.children||[];for(let c=0,u=a.length;c<u;c++)r.push(s.getDependency("node",a[c]));const o=t.skin===void 0?Promise.resolve(null):s.getDependency("skin",t.skin);return Promise.all([i,Promise.all(r),o]).then(function(c){const u=c[0],l=c[1],h=c[2];h!==null&&u.traverse(function(d){d.isSkinnedMesh&&d.bind(h,vn)});for(let d=0,p=l.length;d<p;d++)u.add(l[d]);if(u.userData.pivot!==void 0&&l.length>0){const d=u.userData.pivot,p=l[0];u.pivot=new C().fromArray(d),u.position.x-=d[0],u.position.y-=d[1],u.position.z-=d[2],p.position.set(0,0,0),delete u.userData.pivot}return u})}_loadNodeShallow(n){const e=this.json,s=this.extensions,t=this;if(this.nodeCache[n]!==void 0)return this.nodeCache[n];const i=e.nodes[n],r=i.name?t.createUniqueName(i.name):"",a=[],o=t._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(n)});return o&&a.push(o),i.camera!==void 0&&a.push(t.getDependency("camera",i.camera).then(function(c){return t._getNodeRef(t.cameraCache,i.camera,c)})),t._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(n)}).forEach(function(c){a.push(c)}),this.nodeCache[n]=Promise.all(a).then(function(c){let u;if(i.isBone===!0?u=new en:c.length>1?u=new z:c.length===1?u=c[0]:u=new ge,u!==c[0])for(let l=0,h=c.length;l<h;l++)u.add(c[l]);if(i.name&&(u.userData.name=i.name,u.name=r),S(u,i),i.extensions&&O(s,u,i),i.matrix!==void 0){const l=new K;l.fromArray(i.matrix),u.applyMatrix4(l)}else i.translation!==void 0&&u.position.fromArray(i.translation),i.rotation!==void 0&&u.quaternion.fromArray(i.rotation),i.scale!==void 0&&u.scale.fromArray(i.scale);if(!t.associations.has(u))t.associations.set(u,{});else if(i.mesh!==void 0&&t.meshCache.refs[i.mesh]>1){const l=t.associations.get(u);t.associations.set(u,{...l})}return t.associations.get(u).nodes=n,u}),this.nodeCache[n]}loadScene(n){const e=this.extensions,s=this.json.scenes[n],t=this,i=new z;s.name&&(i.name=t.createUniqueName(s.name)),S(i,s),s.extensions&&O(e,i,s);const r=s.nodes||[],a=[];for(let o=0,c=r.length;o<c;o++)a.push(t.getDependency("node",r[o]));return Promise.all(a).then(function(o){for(let u=0,l=o.length;u<l;u++){const h=o[u];h.parent!==null?i.add(nn(h)):i.add(h)}const c=u=>{const l=new Map;for(const[h,d]of t.associations)(h instanceof X||h instanceof ne)&&l.set(h,d);return u.traverse(h=>{const d=t.associations.get(h);d!=null&&l.set(h,d)}),l};return t.associations=c(i),i})}_createAnimationTracks(n,e,s,t,i){const r=[],a=n.name?n.name:n.uuid,o=[];function c(d){d.morphTargetInfluences&&o.push(d.name?d.name:d.uuid)}I[i.path]===I.weights?(c(n),n.isGroup&&n.children.forEach(c)):o.push(a);let u;switch(I[i.path]){case I.weights:u=se;break;case I.rotation:u=ie;break;case I.translation:case I.scale:u=te;break;default:switch(s.itemSize){case 1:u=se;break;case 2:case 3:default:u=te;break}break}const l=t.interpolation!==void 0?Fn[t.interpolation]:xe,h=this._getArrayFromAccessor(s);for(let d=0,p=o.length;d<p;d++){const R=new u(o[d]+"."+I[i.path],e.array,h,l);t.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(R),r.push(R)}return r}_getArrayFromAccessor(n){let e=n.array;if(n.normalized){const s=ee(e.constructor),t=new Float32Array(e.length);for(let i=0,r=e.length;i<r;i++)t[i]=e[i]*s;e=t}return e}_createCubicSplineTrackInterpolant(n){n.createInterpolant=function(s){const t=this instanceof ie?Cn:Ae;return new t(this.times,this.values,this.getValueSize()/3,s)},n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Kn(f,n,e){const s=n.attributes,t=new an;if(s.POSITION!==void 0){const a=e.json.accessors[s.POSITION],o=a.min,c=a.max;if(o!==void 0&&c!==void 0){if(t.set(new C(o[0],o[1],o[2]),new C(c[0],c[1],c[2])),a.normalized){const u=ee(H[a.componentType]);t.min.multiplyScalar(u),t.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const i=n.targets;if(i!==void 0){const a=new C,o=new C;for(let c=0,u=i.length;c<u;c++){const l=i[c];if(l.POSITION!==void 0){const h=e.json.accessors[l.POSITION],d=h.min,p=h.max;if(d!==void 0&&p!==void 0){if(o.setX(Math.max(Math.abs(d[0]),Math.abs(p[0]))),o.setY(Math.max(Math.abs(d[1]),Math.abs(p[1]))),o.setZ(Math.max(Math.abs(d[2]),Math.abs(p[2]))),h.normalized){const R=ee(H[h.componentType]);o.multiplyScalar(R)}a.max(o)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}t.expandByVector(a)}f.boundingBox=t;const r=new cn;t.getCenter(r.center),r.radius=t.min.distanceTo(t.max)/2,f.boundingSphere=r}function fe(f,n,e){const s=n.attributes,t=[];function i(r,a){return e.getDependency("accessor",r).then(function(o){f.setAttribute(a,o)})}for(const r in s){const a=$[r]||r.toLowerCase();a in f.attributes||t.push(i(s[r],a))}if(n.indices!==void 0&&!f.index){const r=e.getDependency("accessor",n.indices).then(function(a){f.setIndex(a)});t.push(r)}return re.workingColorSpace!==w&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${re.workingColorSpace}" not supported.`),S(f,n),Kn(f,n,e),Promise.all(t).then(function(){return n.targets!==void 0?Hn(f,n.targets,e):f})}export{jn as GLTFLoader};
|
package/dist-embed-sighting-editor/{ModuleConformance-B8OYKQop.js → ModuleConformance-D7QNv2-c.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleThree-
|
|
2
|
-
import{_ as w}from"./rr0-sighting-editor.mjs";class n{static MEMBERS={weather:["getWeather"],place:["attribution","search","reverse"],timeZone:["zoneAt"],narrative:["settings","draft"],assessment:["assess"],lightPollution:["year","citation","lookUp"],aircraft:["citation","between"],upperAir:["between"],elevation:["getElevationGrid"],imagery:["attribution","getImageryTexture"],surroundings:["id","name","attribution","creditUrl","contemporary","covers","getSurroundings"],decorModels:["attribution","entries","entry"],skyEvents:["key","messages","simulation"],interpretations:["key","messages","bodiesOf"],perception:["id","messages","sources","settings","perceive"],transcription:["sendsAudio","engine","transcribe"]};static WEATHER_SHARES=["cloudCover","cloudDarkness","precipitationIntensity","highCloudCover","lowerCloudCover","iceCrystalAlignment","rareIceCrystals","relativeHumidity"];static WEATHER_REQUIRED=["cloudCover","cloudDarkness","precipitationIntensity"];static PRECIPITATIONS=["none","rain","snow","hail"];static HIGH_WIND_MS=60;static TIMEOUT_MS=3e4;static async check(e,a={}){const s=[];e.hasScript&&!e.scriptRun&&s.push({level:"note",code:"scriptNotRun"});for(const[t,r]of Object.entries(e.module.contributes))Object.hasOwn(n.MEMBERS,t)?Array.isArray(r)?await n.checkPoint(t,r,a,s):s.push({level:"failed",code:"notAList",point:t}):s.push({level:"failed",code:"unknownPoint",point:t});return s}static async checkPoint(e,a,s,t){const r=new Set;for(const i of a){const c=(l,d,g="failed")=>{t.push({level:g,code:l,point:e,source:typeof i?.id=="string"?i.id:void 0,detail:d})};if(r.has(i?.id)&&c("duplicateId"),r.add(i?.id),n.checkEntry(i,c),typeof i?.create!="function"){c("createMissing");continue}const o=n.build(i,c);if(o===void 0)continue;const h=n.MEMBERS[e].filter(l=>o[l]===void 0);for(const l of h)c("missingMember",l);h.length>0||(e==="weather"&&await n.checkWeather(i.id,o,s,c),e==="skyEvents"&&await n.checkSkyEventKind(i.id,o,s,c),e==="interpretations"&&await n.checkInterpretationKind(i.id,o,s,c))}}static checkEntry(e,a){for(const s of["id","name","credit","creditUrl"]){const t=e?.[s];(typeof t!="string"||t.trim()==="")&&a("entryField",s)}typeof e?.creditUrl=="string"&&e.creditUrl!==""&&!URL.canParse(e.creditUrl)&&a("entryField","creditUrl")}static build(e,a){let s=!1;const t=(async()=>(s=!0,new Response("",{status:503}))),r=globalThis.fetch;globalThis.fetch=t;try{const i=e.create(t);if(s&&a("createAsked"),i==null){a("createEmpty");return}return i}catch(i){a("createThrew",n.told(i));return}finally{globalThis.fetch=r}}static async checkWeather(e,a,s,t){const r=s.weatherQuery;if(!r){t("weatherNotAsked",void 0,"note");return}let i;try{i=await n.within(a.getWeather(r),s)}catch(l){t("weatherThrew",n.told(l));return}if(i===void 0){t("weatherNoRecord",void 0,"note");return}const c=i?.samples;if(!Array.isArray(c)||c.length!==r.points.length){t("weatherSamples",`${Array.isArray(c)?c.length:0}/${r.points.length}`);return}c.some((l,d)=>l?.time?.getTime?.()!==r.points[d].time.getTime())&&t("weatherOrder");const o=new Set;let h=!1;for(const l of c){const d=l?.weather??{};for(const g of n.WEATHER_SHARES){const u=d[g],p=n.WEATHER_REQUIRED.includes(g);(u!==void 0||p)&&!n.between(u,0,1)&&o.add(`${g} = ${String(u)}`)}n.between(d.windDirectionDeg,0,360)||o.add(`windDirectionDeg = ${String(d.windDirectionDeg)}`),n.between(d.windSpeed,0,1/0)?d.windSpeed>n.HIGH_WIND_MS&&(h=!0):o.add(`windSpeed = ${String(d.windSpeed)}`),n.PRECIPITATIONS.includes(d.precipitationType)||o.add(`precipitationType = ${String(d.precipitationType)}`),typeof d.storm!="boolean"&&o.add(`storm = ${String(d.storm)}`)}for(const l of o)t("weatherValue",l);h&&t("weatherWindHigh",void 0,"note"),i.source?.id!==e&&t("weatherSource","id"),(typeof i.source?.name!="string"||i.source.name==="")&&t("weatherSource","name"),(typeof i.source?.url!="string"||i.source.url==="")&&t("weatherSource","url")}static async checkSkyEventKind(e,a,s,t){a.key!==e&&t("kindKey",String(a.key)),await n.checkTexts(a.messages,["title","name"],s,t);let r;try{r=(await n.within(a.simulation(),s))()}catch(o){t("simulationFailed",n.told(o));return}const{MODULE_THREE:i}=await w(async()=>{const{MODULE_THREE:o}=await import("./ModuleThree-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleThree-COSQVAvF.js","./rr0-sighting-editor.mjs"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as w}from"./rr0-sighting-editor.mjs";class n{static MEMBERS={weather:["getWeather"],place:["attribution","search","reverse"],timeZone:["zoneAt"],narrative:["settings","draft"],assessment:["assess"],lightPollution:["year","citation","lookUp"],aircraft:["citation","between"],upperAir:["between"],elevation:["getElevationGrid"],imagery:["attribution","getImageryTexture"],surroundings:["id","name","attribution","creditUrl","contemporary","covers","getSurroundings"],decorModels:["attribution","entries","entry"],skyEvents:["key","messages","simulation"],interpretations:["key","messages","bodiesOf"],perception:["id","messages","sources","settings","perceive"],transcription:["sendsAudio","engine","transcribe"]};static WEATHER_SHARES=["cloudCover","cloudDarkness","precipitationIntensity","highCloudCover","lowerCloudCover","iceCrystalAlignment","rareIceCrystals","relativeHumidity"];static WEATHER_REQUIRED=["cloudCover","cloudDarkness","precipitationIntensity"];static PRECIPITATIONS=["none","rain","snow","hail"];static HIGH_WIND_MS=60;static TIMEOUT_MS=3e4;static async check(e,a={}){const s=[];e.hasScript&&!e.scriptRun&&s.push({level:"note",code:"scriptNotRun"});for(const[t,r]of Object.entries(e.module.contributes))Object.hasOwn(n.MEMBERS,t)?Array.isArray(r)?await n.checkPoint(t,r,a,s):s.push({level:"failed",code:"notAList",point:t}):s.push({level:"failed",code:"unknownPoint",point:t});return s}static async checkPoint(e,a,s,t){const r=new Set;for(const i of a){const c=(l,d,g="failed")=>{t.push({level:g,code:l,point:e,source:typeof i?.id=="string"?i.id:void 0,detail:d})};if(r.has(i?.id)&&c("duplicateId"),r.add(i?.id),n.checkEntry(i,c),typeof i?.create!="function"){c("createMissing");continue}const o=n.build(i,c);if(o===void 0)continue;const h=n.MEMBERS[e].filter(l=>o[l]===void 0);for(const l of h)c("missingMember",l);h.length>0||(e==="weather"&&await n.checkWeather(i.id,o,s,c),e==="skyEvents"&&await n.checkSkyEventKind(i.id,o,s,c),e==="interpretations"&&await n.checkInterpretationKind(i.id,o,s,c))}}static checkEntry(e,a){for(const s of["id","name","credit","creditUrl"]){const t=e?.[s];(typeof t!="string"||t.trim()==="")&&a("entryField",s)}typeof e?.creditUrl=="string"&&e.creditUrl!==""&&!URL.canParse(e.creditUrl)&&a("entryField","creditUrl")}static build(e,a){let s=!1;const t=(async()=>(s=!0,new Response("",{status:503}))),r=globalThis.fetch;globalThis.fetch=t;try{const i=e.create(t);if(s&&a("createAsked"),i==null){a("createEmpty");return}return i}catch(i){a("createThrew",n.told(i));return}finally{globalThis.fetch=r}}static async checkWeather(e,a,s,t){const r=s.weatherQuery;if(!r){t("weatherNotAsked",void 0,"note");return}let i;try{i=await n.within(a.getWeather(r),s)}catch(l){t("weatherThrew",n.told(l));return}if(i===void 0){t("weatherNoRecord",void 0,"note");return}const c=i?.samples;if(!Array.isArray(c)||c.length!==r.points.length){t("weatherSamples",`${Array.isArray(c)?c.length:0}/${r.points.length}`);return}c.some((l,d)=>l?.time?.getTime?.()!==r.points[d].time.getTime())&&t("weatherOrder");const o=new Set;let h=!1;for(const l of c){const d=l?.weather??{};for(const g of n.WEATHER_SHARES){const u=d[g],p=n.WEATHER_REQUIRED.includes(g);(u!==void 0||p)&&!n.between(u,0,1)&&o.add(`${g} = ${String(u)}`)}n.between(d.windDirectionDeg,0,360)||o.add(`windDirectionDeg = ${String(d.windDirectionDeg)}`),n.between(d.windSpeed,0,1/0)?d.windSpeed>n.HIGH_WIND_MS&&(h=!0):o.add(`windSpeed = ${String(d.windSpeed)}`),n.PRECIPITATIONS.includes(d.precipitationType)||o.add(`precipitationType = ${String(d.precipitationType)}`),typeof d.storm!="boolean"&&o.add(`storm = ${String(d.storm)}`)}for(const l of o)t("weatherValue",l);h&&t("weatherWindHigh",void 0,"note"),i.source?.id!==e&&t("weatherSource","id"),(typeof i.source?.name!="string"||i.source.name==="")&&t("weatherSource","name"),(typeof i.source?.url!="string"||i.source.url==="")&&t("weatherSource","url")}static async checkSkyEventKind(e,a,s,t){a.key!==e&&t("kindKey",String(a.key)),await n.checkTexts(a.messages,["title","name"],s,t);let r;try{r=(await n.within(a.simulation(),s))()}catch(o){t("simulationFailed",n.told(o));return}const{MODULE_THREE:i}=await w(async()=>{const{MODULE_THREE:o}=await import("./ModuleThree-COSQVAvF.js");return{MODULE_THREE:o}},__vite__mapDeps([0,1]),import.meta.url);if(!(r?.object instanceof i.Object3D)){t("secondThree");return}try{r.update([],0,n.frame(new i.Vector3)),r.drawnCount!==0&&t("drawnWithoutEvents",String(r.drawnCount))}catch(o){t("updateThrew",n.told(o))}const c=new i.Group;c.add(r.object);try{r.dispose(),r.object.parent===c&&t("disposeLeft")}catch(o){t("disposeThrew",n.told(o))}}static async checkInterpretationKind(e,a,s,t){a.key!==e&&t("kindKey",String(a.key)),await n.checkTexts(a.messages,["title"],s,t);const r=s.interpretation?.[a.key];if(!Array.isArray(r)||r.length===0){t("readingNotTried",void 0,"note");return}for(const i of r)try{const c=a.bodiesOf(i);Array.isArray(c)||t("readingNotAList")}catch(c){t("readingThrew",n.told(c))}}static async checkTexts(e,a,s,t){for(const r of["en","fr"])try{const i=await n.within(e.load(r),s);for(const c of a)(typeof i?.[c]!="string"||i[c]==="")&&t("kindMessages",`${r}: ${c}`)}catch(i){t("kindMessages",`${r}: ${n.told(i)}`)}}static frame(e){return{reference:{lat:0,lng:0},origin:{x:0,z:0},eastScale:1,siteElevationM:0,eye:e,pixelRad:.001,relativeScale:1,air:{},transmittanceTo:()=>[1,1,1],groundYAt:()=>0,wind:{eastMS:0,northMS:0},observer:{lat:0,lng:0,heightM:0},date:new Date(0),magnitudeLimit:6,cloudTransmission:()=>1,arrivingIlluminance:()=>[0,0,0],transmittanceFromSpace:()=>[1,1,1],lightFrom:()=>{},glareFrom:()=>{}}}static between(e,a,s){return typeof e=="number"&&!Number.isNaN(e)&&e>=a&&e<=s}static told(e){return e instanceof Error?e.message:String(e)}static within(e,a){const s=a.timeoutMs??n.TIMEOUT_MS;let t;const r=new Promise((i,c)=>{t=setTimeout(()=>c(new Error(`> ${s/1e3} s`)),s)});return Promise.race([e,r]).finally(()=>clearTimeout(t))}}export{n as ModuleConformance};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleThree-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleThree-COSQVAvF.js","./rr0-sighting-editor.mjs"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{C as g,D as w,_ as b,M as p}from"./rr0-sighting-editor.mjs";class n{static STORAGE_KEY="ufoathome.modules";static FORMAT=1;static empty(){return{format:1,modules:[]}}static read(t=n.storage()){try{const e=t?.getItem(n.STORAGE_KEY);return e?n.parse(e):n.empty()}catch{return n.empty()}}static write(t,e=n.storage()){try{return e?(t.modules.length===0?e.removeItem(n.STORAGE_KEY):e.setItem(n.STORAGE_KEY,n.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>n.FORMAT)throw new Error(`format ${e.format} is newer than ${n.FORMAT}`);const r=new Set,s=[];for(const i of e.modules)typeof i?.url!="string"||r.has(i.url)||(r.add(i.url),s.push({url:i.url,enabled:i.enabled!==!1}));return{format:1,modules:s}}static text(t){return JSON.stringify({format:n.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,r=>f.tileUrl(this.tileUrlTemplate,r),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 r=o=>{throw new v(e,o)};(t===null||typeof t!="object"||Array.isArray(t))&&r("not a JSON object");const s=t;typeof s.format!="number"&&r('no "format"'),s.format>d.FORMAT&&r(`format ${s.format} is newer than ${d.FORMAT}, which this version reads`),(typeof s.id!="string"||!/^[a-z0-9][a-z0-9._-]*$/.test(s.id))&&r(`"id" must be lowercase letters, digits, '.', '_' or '-'`),(typeof s.name!="string"||s.name.trim()==="")&&r('no "name"'),s.script!==void 0&&typeof s.script!="string"&&r('"script" must be an address');const i=s.contributes??{};for(const o of["imagery","elevation"]){const c=i[o];c!==void 0&&(Array.isArray(c)||r(`"contributes.${o}" must be a list`),c.forEach((l,h)=>{for(const m of["id","name","credit","creditUrl","tiles"])(typeof l?.[m]!="string"||l[m]==="")&&r(`"contributes.${o}[${h}].${m}" is missing`);["{z}","{x}","{y}"].every(m=>l.tiles.includes(m))||r(`"contributes.${o}[${h}].tiles" must hold {z}, {x} and {y}`)}))}const a=i.models;return a!==void 0&&(Array.isArray(a)||r('"contributes.models" must be a list'),a.forEach((o,c)=>{for(const l of["id","name","file"])(typeof o?.[l]!="string"||o[l]==="")&&r(`"contributes.models[${c}].${l}" is missing`);o.kind===void 0&&r(`"contributes.models[${c}].kind" is missing`),(!o.credit||typeof o.credit!="object")&&r(`"contributes.models[${c}].credit" is missing: a model is shown with its author and licence`)})),s}static contributions(t,e){const r=t.contributes??{},s={};if(r.imagery?.length&&(s.imagery=r.imagery.map(i=>({id:i.id,name:i.name,credit:i.credit,creditUrl:i.creditUrl,create:a=>new f({tileUrlTemplate:d.absoluteTemplate(i.tiles,e),attribution:i.credit,fetchImpl:a})}))),r.elevation?.length&&(s.elevation=r.elevation.map(i=>({id:i.id,name:i.name,credit:i.credit,creditUrl:i.creditUrl,create:a=>new w({tileUrlTemplate:d.absoluteTemplate(i.tiles,e),fetchImpl:a})}))),r.models?.length){const i=r.models.map(({file:o,...c})=>({...c,url:new URL(o,e).href})),a=t.credit??t.name;s.decorModels=[{id:`${t.id}-models`,name:t.name,credit:a,creditUrl:t.creditUrl??e,create:()=>new E(a,i)}]}return s}static module(t,e,r={}){const s=d.contributions(t,e);for(const[i,a]of Object.entries(r))Array.isArray(a)&&(s[i]=[...s[i]??[],...a]);return{id:t.id,name:t.name,credit:t.credit,creditUrl:t.creditUrl,url:e,contributes:s}}static absoluteTemplate(t,e){const r=t.replaceAll("{z}","__Z__").replaceAll("{x}","__X__").replaceAll("{y}","__Y__");return new URL(r,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 r=await this.fetchImpl(t);if(!r.ok)throw new Error(`${t}: HTTP ${r.status}`);const s=d.check(await r.json(),t),i=s.script!==void 0;let a={};if(i&&e.runScript){const o=new URL(s.script,t).href,c=await this.importImpl(o);if(typeof c.default!="function")throw new Error(`${o}: its default export is not a function`);const{MODULE_THREE:l}=await b(async()=>{const{MODULE_THREE:h}=await import("./ModuleThree-
|
|
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,r=>f.tileUrl(this.tileUrlTemplate,r),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 r=o=>{throw new v(e,o)};(t===null||typeof t!="object"||Array.isArray(t))&&r("not a JSON object");const s=t;typeof s.format!="number"&&r('no "format"'),s.format>d.FORMAT&&r(`format ${s.format} is newer than ${d.FORMAT}, which this version reads`),(typeof s.id!="string"||!/^[a-z0-9][a-z0-9._-]*$/.test(s.id))&&r(`"id" must be lowercase letters, digits, '.', '_' or '-'`),(typeof s.name!="string"||s.name.trim()==="")&&r('no "name"'),s.script!==void 0&&typeof s.script!="string"&&r('"script" must be an address');const i=s.contributes??{};for(const o of["imagery","elevation"]){const c=i[o];c!==void 0&&(Array.isArray(c)||r(`"contributes.${o}" must be a list`),c.forEach((l,h)=>{for(const m of["id","name","credit","creditUrl","tiles"])(typeof l?.[m]!="string"||l[m]==="")&&r(`"contributes.${o}[${h}].${m}" is missing`);["{z}","{x}","{y}"].every(m=>l.tiles.includes(m))||r(`"contributes.${o}[${h}].tiles" must hold {z}, {x} and {y}`)}))}const a=i.models;return a!==void 0&&(Array.isArray(a)||r('"contributes.models" must be a list'),a.forEach((o,c)=>{for(const l of["id","name","file"])(typeof o?.[l]!="string"||o[l]==="")&&r(`"contributes.models[${c}].${l}" is missing`);o.kind===void 0&&r(`"contributes.models[${c}].kind" is missing`),(!o.credit||typeof o.credit!="object")&&r(`"contributes.models[${c}].credit" is missing: a model is shown with its author and licence`)})),s}static contributions(t,e){const r=t.contributes??{},s={};if(r.imagery?.length&&(s.imagery=r.imagery.map(i=>({id:i.id,name:i.name,credit:i.credit,creditUrl:i.creditUrl,create:a=>new f({tileUrlTemplate:d.absoluteTemplate(i.tiles,e),attribution:i.credit,fetchImpl:a})}))),r.elevation?.length&&(s.elevation=r.elevation.map(i=>({id:i.id,name:i.name,credit:i.credit,creditUrl:i.creditUrl,create:a=>new w({tileUrlTemplate:d.absoluteTemplate(i.tiles,e),fetchImpl:a})}))),r.models?.length){const i=r.models.map(({file:o,...c})=>({...c,url:new URL(o,e).href})),a=t.credit??t.name;s.decorModels=[{id:`${t.id}-models`,name:t.name,credit:a,creditUrl:t.creditUrl??e,create:()=>new E(a,i)}]}return s}static module(t,e,r={}){const s=d.contributions(t,e);for(const[i,a]of Object.entries(r))Array.isArray(a)&&(s[i]=[...s[i]??[],...a]);return{id:t.id,name:t.name,credit:t.credit,creditUrl:t.creditUrl,url:e,contributes:s}}static absoluteTemplate(t,e){const r=t.replaceAll("{z}","__Z__").replaceAll("{x}","__X__").replaceAll("{y}","__Y__");return new URL(r,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 r=await this.fetchImpl(t);if(!r.ok)throw new Error(`${t}: HTTP ${r.status}`);const s=d.check(await r.json(),t),i=s.script!==void 0;let a={};if(i&&e.runScript){const o=new URL(s.script,t).href,c=await this.importImpl(o);if(typeof c.default!="function")throw new Error(`${o}: its default export is not a function`);const{MODULE_THREE:l}=await b(async()=>{const{MODULE_THREE:h}=await import("./ModuleThree-COSQVAvF.js");return{MODULE_THREE:h}},__vite__mapDeps([0,1]),import.meta.url);a=await c.default({manifestUrl:t,three:l})??{}}return{url:t,manifest:s,module:d.module(s,t,a),hasScript:i,scriptRun:i&&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=n.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(n.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(r=>r.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(r=>r.url===t?{...r,enabled:e}:r)},this.save(),await this.reload(t)}exportText(){return n.text(this.config)}async importText(t){const e=n.parse(t);await this.start();const r=this.config.modules.map(s=>s.url);this.config=e,this.save(),await Promise.all([...new Set([...r,...e.modules.map(s=>s.url)])].map(s=>this.reload(s)))}async require(t,e){t?.length&&(await this.start(),await Promise.all(t.map(async r=>{let s;try{s=new URL(r,e??(typeof location>"u"?void 0:location.href)).href}catch{return}const i=this.states.get(s);if(i&&i.status!=="off")return i.status==="loading"?this.pending.get(s):void 0;this.named.add(s),await this.reload(s)})))}named=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),r=this.states.get(t);r?.loaded&&p.uninstall(r.loaded.module.id);const s=e!==void 0,i=e?.enabled??!0;if(!s&&!this.named.has(t))return this.states.delete(t),this.announce(),{url:t,addedByPerson:s,enabled:i,status:"off"};if(s&&!i&&!this.named.has(t))return this.set({url:t,addedByPerson:s,enabled:i,status:"off"});this.set({url:t,addedByPerson:s,enabled:i,status:"loading"});try{const a=await this.loader.load(t,{runScript:s&&i});return p.install(a.module),this.set({url:t,addedByPerson:s,enabled:i,status:"installed",loaded:a})}catch(a){return this.set({url:t,addedByPerson:s,enabled:i,status:"failed",error:a instanceof Error?a.message:String(a)})}}set(t){return this.states.set(t.url,t),this.announce(),t}save(){n.write(this.config,this.storage)}announce(){this.changes.dispatchEvent(new Event("change"))}}export{y as ModuleSession};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{V as a,b1 as e,cd as s,bi as t,bk as r,bz as i,b9 as o,Q as n,bh as b,aQ as l,bI as c,bA as d,G as m,ce as u,ar as M,aD as B,ap as S,K as y,bZ as G,bW as f,b_ as h,am as p,cb as g,b3 as x,J as C,aE as D,cf as E,cg as L,ch as A,aS as P,bj as T,aB as F,aC as Q,ci as V,by as j,aF as k}from"./rr0-sighting-editor.mjs";const O={AdditiveBlending:k,BackSide:j,BoxGeometry:V,BufferAttribute:Q,BufferGeometry:F,CanvasTexture:T,Color:P,ConeGeometry:A,CylinderGeometry:L,DataTexture:E,DoubleSide:D,Euler:C,Float32BufferAttribute:x,FrontSide:g,Group:p,Line:h,LineBasicMaterial:f,LineSegments:G,Matrix4:y,Mesh:S,MeshBasicMaterial:B,MeshStandardMaterial:M,NormalBlending:u,Object3D:m,PlaneGeometry:d,PointLight:c,Points:l,PointsMaterial:b,Quaternion:n,ShaderMaterial:o,SphereGeometry:i,Sprite:r,SpriteMaterial:t,TorusGeometry:s,Vector2:e,Vector3:a};export{O as MODULE_THREE};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleConformance-
|
|
2
|
-
import{o as _,_ as x,H as y,z as L,i as m}from"./rr0-sighting-editor.mjs";import{ModuleSession as C}from"./ModuleSession-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleConformance-D7QNv2-c.js","./rr0-sighting-editor.mjs"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as _,_ as x,H as y,z as L,i as m}from"./rr0-sighting-editor.mjs";import{ModuleSession as C}from"./ModuleSession-DTZs4At5.js";const P=_.catalog({en:()=>x(()=>import("./ModulesPanelMessages_en-t8LOPRx0.js"),[],import.meta.url).then(b=>b.modulesPanelMessages_en),fr:()=>x(()=>import("./ModulesPanelMessages_fr-DZMwqDs0.js"),[],import.meta.url).then(b=>b.modulesPanelMessages_fr),es:()=>x(()=>import("./ModulesPanelMessages_es-DQFuXaUa.js"),[],import.meta.url).then(b=>b.modulesPanelMessages_es),it:()=>x(()=>import("./ModulesPanelMessages_it-DfX1ObVK.js"),[],import.meta.url).then(b=>b.modulesPanelMessages_it)}),N="rr0-modules-panel",A=`
|
|
3
3
|
rr0-modules-panel { display: block; }
|
|
4
4
|
rr0-modules-panel .mp-add { display: flex; gap: .4em; align-items: center; margin: .4em 0; }
|
|
5
5
|
rr0-modules-panel .mp-add input { flex: 1 1 16em; min-width: 0; }
|
|
@@ -12,4 +12,4 @@ rr0-modules-panel .mp-head .mp-remove { margin-left: auto; }
|
|
|
12
12
|
rr0-modules-panel .mp-module p { margin: .2em 0; }
|
|
13
13
|
rr0-modules-panel .mp-findings { margin: .3em 0; padding-left: 1.2em; }
|
|
14
14
|
rr0-modules-panel .mp-files { display: flex; gap: .6em; flex-wrap: wrap; align-items: center; margin-top: .6em; }
|
|
15
|
-
`;class M extends HTMLElement{session=C.shared;messages;languageAsked=!1;named=[];recordingBase;note;languageToken=0;draft="";onChange=()=>this.render();checkContext;checks=new Map;set moduleSession(e){this.session.changes.removeEventListener("change",this.onChange),this.session=e,this.isConnected&&this.session.changes.addEventListener("change",this.onChange),this.render()}get recordingModules(){return[...this.named]}set recordingModules(e){this.named=[...e??[]],this.render()}set base(e){this.recordingBase=e,this.render()}async setLanguage(e){this.languageAsked=!0;const t=++this.languageToken,n=await P.load(e);t===this.languageToken&&(this.messages=n,this.render())}connectedCallback(){this.languageAsked||this.setLanguage(y.preferencesFor(this)[0]??"en"),this.session.changes.addEventListener("change",this.onChange),this.session.start(),this.render()}disconnectedCallback(){this.session.changes.removeEventListener("change",this.onChange)}absolute(e){try{return new URL(e,this.recordingBase??location.href).href}catch{return}}isNamed(e){return this.named.some(t=>this.absolute(t)===e)}setNamed(e,t){t!==this.isNamed(e)&&(this.named=t?[...this.named,L.of(e,this.recordingBase)]:this.named.filter(n=>this.absolute(n)!==e),t&&this.session.require([e]),this.dispatchEvent(new Event("recordingmoduleschange",{bubbles:!0})),this.render())}render(){const e=this.messages;if(!this.isConnected||!this.messages)return;const t=this.ownerDocument,n=t.createElement("style");n.textContent=A;const s=t.createElement("p");s.className=m.INFO,s.textContent=e.intro;const a=t.createElement("form");a.className="mp-add";const i=t.createElement("input");i.type="url",i.id="module-url",i.required=!0,i.placeholder=e.urlPlaceholder,i.value=this.draft,i.addEventListener("input",()=>{this.draft=i.value}),i.setAttribute("aria-label",e.urlPlaceholder);const u=t.createElement("button");u.type="submit",u.textContent=e.add,a.append(i,u),a.addEventListener("submit",r=>{r.preventDefault();const w=i.value.trim();w&&(this.draft="",this.session.add(w))});const l=t.createElement("p");l.className=m.WARNING,l.textContent=e.codeWarning;const c=this.session.list(),h=new Set(c.map(r=>r.url)),v=this.named.map(r=>this.absolute(r)).filter(r=>r!==void 0&&!h.has(r)),g=t.createElement("ul");g.className="mp-list",g.append(...c.map(r=>this.item(r)),...v.map(r=>this.item({url:r,addedByPerson:!1,enabled:!0,status:"loading"})));const k=t.createElement("p");k.className=m.INFO,k.textContent=e.none,k.hidden=g.childElementCount>0;const f=t.createElement("div");f.className="mp-files";const E=t.createElement("button");E.type="button",E.id="modules-export",E.textContent=e.exportConfig,E.disabled=!c.some(r=>r.addedByPerson),E.addEventListener("click",()=>this.download());const p=t.createElement("input");p.type="file",p.id="modules-import",p.accept="application/json,.json",p.hidden=!0;const o=t.createElement("button");o.type="button",o.textContent=e.importConfig,o.addEventListener("click",()=>p.click()),p.addEventListener("change",()=>{const r=p.files?.[0];r&&this.importFile(r),p.value=""}),f.append(E,o,p);const d=t.createElement("p");d.id="modules-note",d.setAttribute("role","status"),m.show(d,this.note?.text,this.note?.kind),this.replaceChildren(n,s,a,l,g,k,f,d)}item(e){const t=this.messages,n=this.ownerDocument,s=e.loaded,a=n.createElement("li");a.className="mp-module",a.dataset.url=e.url;const i=n.createElement("div");if(i.className="mp-head",e.addedByPerson){const o=n.createElement("label"),d=n.createElement("input");d.type="checkbox",d.className="mp-enabled",d.checked=e.enabled,d.addEventListener("change",()=>void this.session.setEnabled(e.url,d.checked)),o.append(d,n.createTextNode(` ${t.enabled}`)),i.append(o)}const u=n.createElement("span");u.className="mp-name",u.textContent=e.loaded?.module.name??e.url,i.append(u);const l=e.loaded?.module.credit;if(l){const o=n.createElement(e.loaded?.module.creditUrl?"a":"span");o.className=m.INFO,o.textContent=l,o instanceof HTMLAnchorElement&&(o.href=e.loaded.module.creditUrl,o.target="_blank",o.rel="noopener noreferrer"),i.append(o)}const c=n.createElement("button");if(c.type="button",c.className="mp-remove",e.addedByPerson?(c.textContent=t.remove,c.addEventListener("click",()=>void this.session.remove(e.url))):(c.textContent=t.addToMine,c.addEventListener("click",()=>void this.session.add(e.url))),e.status==="installed"&&s){const o=n.createElement("button");o.type="button",o.className="mp-check";const d=this.checks.get(e.url),r=d?.of===s&&d.findings===void 0&&d.crash===void 0;o.textContent=r?t.checking:t.check,o.disabled=r,o.addEventListener("click",()=>void this.check(e.url,s)),i.append(o)}i.append(c);const h=n.createElement("p");h.className=`${m.INFO} mp-url`,h.textContent=e.url;const v=n.createElement("p");v.className="mp-status",e.status==="loading"?m.show(v,t.loading):e.status==="failed"?m.show(v,t.failed.replace("{error}",e.error??""),"error"):e.status==="off"?m.show(v,t.off):m.show(v,this.brings(e));const g=n.createElement("p");g.className="mp-code",s?.scriptRun?m.show(g,t.runsCode,"warning"):s?.hasScript?m.show(g,t.codeNotRun,"info"):g.hidden=!0;const k=n.createElement("label");k.title=t.namedByRecordingHint;const f=n.createElement("input");f.type="checkbox",f.className="mp-named",f.checked=this.isNamed(e.url),f.addEventListener("change",()=>this.setNamed(e.url,f.checked)),k.append(f,n.createTextNode(` ${t.namedByRecording}`));const E=n.createElement("p");E.append(k),a.append(i,h,v,g,E);const p=this.checks.get(e.url);return p&&p.of===s&&a.append(...this.checkResult(p)),a}async check(e,t){const n={of:t};this.checks.set(e,n),this.render();try{const{ModuleConformance:s}=await x(async()=>{const{ModuleConformance:a}=await import("./ModuleConformance-
|
|
15
|
+
`;class M extends HTMLElement{session=C.shared;messages;languageAsked=!1;named=[];recordingBase;note;languageToken=0;draft="";onChange=()=>this.render();checkContext;checks=new Map;set moduleSession(e){this.session.changes.removeEventListener("change",this.onChange),this.session=e,this.isConnected&&this.session.changes.addEventListener("change",this.onChange),this.render()}get recordingModules(){return[...this.named]}set recordingModules(e){this.named=[...e??[]],this.render()}set base(e){this.recordingBase=e,this.render()}async setLanguage(e){this.languageAsked=!0;const t=++this.languageToken,n=await P.load(e);t===this.languageToken&&(this.messages=n,this.render())}connectedCallback(){this.languageAsked||this.setLanguage(y.preferencesFor(this)[0]??"en"),this.session.changes.addEventListener("change",this.onChange),this.session.start(),this.render()}disconnectedCallback(){this.session.changes.removeEventListener("change",this.onChange)}absolute(e){try{return new URL(e,this.recordingBase??location.href).href}catch{return}}isNamed(e){return this.named.some(t=>this.absolute(t)===e)}setNamed(e,t){t!==this.isNamed(e)&&(this.named=t?[...this.named,L.of(e,this.recordingBase)]:this.named.filter(n=>this.absolute(n)!==e),t&&this.session.require([e]),this.dispatchEvent(new Event("recordingmoduleschange",{bubbles:!0})),this.render())}render(){const e=this.messages;if(!this.isConnected||!this.messages)return;const t=this.ownerDocument,n=t.createElement("style");n.textContent=A;const s=t.createElement("p");s.className=m.INFO,s.textContent=e.intro;const a=t.createElement("form");a.className="mp-add";const i=t.createElement("input");i.type="url",i.id="module-url",i.required=!0,i.placeholder=e.urlPlaceholder,i.value=this.draft,i.addEventListener("input",()=>{this.draft=i.value}),i.setAttribute("aria-label",e.urlPlaceholder);const u=t.createElement("button");u.type="submit",u.textContent=e.add,a.append(i,u),a.addEventListener("submit",r=>{r.preventDefault();const w=i.value.trim();w&&(this.draft="",this.session.add(w))});const l=t.createElement("p");l.className=m.WARNING,l.textContent=e.codeWarning;const c=this.session.list(),h=new Set(c.map(r=>r.url)),v=this.named.map(r=>this.absolute(r)).filter(r=>r!==void 0&&!h.has(r)),g=t.createElement("ul");g.className="mp-list",g.append(...c.map(r=>this.item(r)),...v.map(r=>this.item({url:r,addedByPerson:!1,enabled:!0,status:"loading"})));const k=t.createElement("p");k.className=m.INFO,k.textContent=e.none,k.hidden=g.childElementCount>0;const f=t.createElement("div");f.className="mp-files";const E=t.createElement("button");E.type="button",E.id="modules-export",E.textContent=e.exportConfig,E.disabled=!c.some(r=>r.addedByPerson),E.addEventListener("click",()=>this.download());const p=t.createElement("input");p.type="file",p.id="modules-import",p.accept="application/json,.json",p.hidden=!0;const o=t.createElement("button");o.type="button",o.textContent=e.importConfig,o.addEventListener("click",()=>p.click()),p.addEventListener("change",()=>{const r=p.files?.[0];r&&this.importFile(r),p.value=""}),f.append(E,o,p);const d=t.createElement("p");d.id="modules-note",d.setAttribute("role","status"),m.show(d,this.note?.text,this.note?.kind),this.replaceChildren(n,s,a,l,g,k,f,d)}item(e){const t=this.messages,n=this.ownerDocument,s=e.loaded,a=n.createElement("li");a.className="mp-module",a.dataset.url=e.url;const i=n.createElement("div");if(i.className="mp-head",e.addedByPerson){const o=n.createElement("label"),d=n.createElement("input");d.type="checkbox",d.className="mp-enabled",d.checked=e.enabled,d.addEventListener("change",()=>void this.session.setEnabled(e.url,d.checked)),o.append(d,n.createTextNode(` ${t.enabled}`)),i.append(o)}const u=n.createElement("span");u.className="mp-name",u.textContent=e.loaded?.module.name??e.url,i.append(u);const l=e.loaded?.module.credit;if(l){const o=n.createElement(e.loaded?.module.creditUrl?"a":"span");o.className=m.INFO,o.textContent=l,o instanceof HTMLAnchorElement&&(o.href=e.loaded.module.creditUrl,o.target="_blank",o.rel="noopener noreferrer"),i.append(o)}const c=n.createElement("button");if(c.type="button",c.className="mp-remove",e.addedByPerson?(c.textContent=t.remove,c.addEventListener("click",()=>void this.session.remove(e.url))):(c.textContent=t.addToMine,c.addEventListener("click",()=>void this.session.add(e.url))),e.status==="installed"&&s){const o=n.createElement("button");o.type="button",o.className="mp-check";const d=this.checks.get(e.url),r=d?.of===s&&d.findings===void 0&&d.crash===void 0;o.textContent=r?t.checking:t.check,o.disabled=r,o.addEventListener("click",()=>void this.check(e.url,s)),i.append(o)}i.append(c);const h=n.createElement("p");h.className=`${m.INFO} mp-url`,h.textContent=e.url;const v=n.createElement("p");v.className="mp-status",e.status==="loading"?m.show(v,t.loading):e.status==="failed"?m.show(v,t.failed.replace("{error}",e.error??""),"error"):e.status==="off"?m.show(v,t.off):m.show(v,this.brings(e));const g=n.createElement("p");g.className="mp-code",s?.scriptRun?m.show(g,t.runsCode,"warning"):s?.hasScript?m.show(g,t.codeNotRun,"info"):g.hidden=!0;const k=n.createElement("label");k.title=t.namedByRecordingHint;const f=n.createElement("input");f.type="checkbox",f.className="mp-named",f.checked=this.isNamed(e.url),f.addEventListener("change",()=>this.setNamed(e.url,f.checked)),k.append(f,n.createTextNode(` ${t.namedByRecording}`));const E=n.createElement("p");E.append(k),a.append(i,h,v,g,E);const p=this.checks.get(e.url);return p&&p.of===s&&a.append(...this.checkResult(p)),a}async check(e,t){const n={of:t};this.checks.set(e,n),this.render();try{const{ModuleConformance:s}=await x(async()=>{const{ModuleConformance:a}=await import("./ModuleConformance-D7QNv2-c.js");return{ModuleConformance:a}},__vite__mapDeps([0,1]),import.meta.url);n.findings=await s.check(t,this.checkContext?.())}catch(s){n.crash=s instanceof Error?s.message:String(s)}this.render()}checkResult(e){const t=this.messages,n=this.ownerDocument,s=(l,c)=>{const h=n.createElement("p");return h.className="mp-check-result",h.setAttribute("role","status"),m.show(h,l,c),h};if(e.crash!==void 0)return[s(t.checkCrashed.replace("{error}",()=>e.crash),"error")];if(!e.findings)return[];const a=e.findings.filter(l=>l.level==="failed"),i=e.findings.filter(l=>l.level==="note"),u=[];if(a.length===0&&u.push(s(t.checkPassed,"info")),a.length+i.length>0){const l=n.createElement("ul");l.className="mp-findings";for(const c of[...a,...i]){const h=n.createElement("li");m.show(h,this.finding(c),c.level==="failed"?"error":"info"),l.append(h)}u.push(l)}return u}finding(e){const t=this.messages,n=e.point===void 0?"":t.points[e.point]??e.point,s=t.checks[e.code].replace("{point}",()=>e.point??"").replace("{detail}",()=>e.detail??""),a=e.source??(e.code==="unknownPoint"||e.code==="notAList"?void 0:n);return a?t.checkAbout.replace("{about}",()=>a).replace("{text}",()=>s):s}brings(e){const t=Object.entries(e.loaded?.module.contributes??{}).filter(([,n])=>Array.isArray(n)&&n.length>0).map(([n,s])=>`${this.messages.points[n]??n} (${s.length})`);return t.length>0?this.messages.brings.replace("{points}",t.join(", ")):this.messages.bringsNothing}download(){const e=new Blob([this.session.exportText()],{type:"application/json"}),t=URL.createObjectURL(e),n=this.ownerDocument.createElement("a");n.href=t,n.download="ufoathome-modules.json",n.click(),URL.revokeObjectURL(t)}async importFile(e){try{await this.session.importText(await e.text());const t=this.session.list().filter(n=>n.addedByPerson).length;this.note={text:this.messages.imported.replace("{count}",String(t)),kind:"info"}}catch(t){this.note={text:this.messages.importFailed.replace("{error}",t instanceof Error?t.message:String(t)),kind:"error"}}this.render()}}function B(){customElements.get(N)||customElements.define(N,M)}export{N as MODULES_PANEL_ELEMENT_NAME,M as ModulesPanelElement,B as register};
|
package/dist-embed-sighting-editor/{ReferenceSystem-BxKEbMVI.js → ReferenceSystem-ZQRGSWgC.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as w,Q as M,
|
|
1
|
+
import{n as w,Q as M,bt as d,bu as y,bv as g,bw as c,bx as b,ap as k,aD as O,by as T,bz as E,bA as D,G as I}from"./rr0-sighting-editor.mjs";import{P as m,a as f}from"./PictureFetch-C3wgf1ZV.js";const v=3,u=800,l=Math.PI/180;class r{constructor(t,i,s=r.fetchImage,e=r.openVideo){this.scene=t,this.onImageLoaded=i,this.loadImage=s,this.loadVideo=e}meshes=new Map;signatures=new Map;images=new Map;loading=new Map;failed=new Map;references=[];views=new Map;shown=!0;observerAt;clock={t:0,playing:!1,timeScale:1};static PRESENT_WITHIN_M=2;static GONE_BEYOND_M=20;static presenceAt(t,i){if(!t.from||!i)return 1;const s=w(i.lat,i.lng,t.from.lat,t.from.lng),a=(Math.hypot(s.x,s.z)-r.PRESENT_WITHIN_M)/(r.GONE_BEYOND_M-r.PRESENT_WITHIN_M),o=Math.min(Math.max(a,0),1);return 1-o*o*(3-2*o)}set(t,i=this.views,s){this.references=t,this.observerAt=s,this.views=i;const e=new Set(t.map(a=>a.id));for(const[a,o]of this.meshes)e.has(a)||(this.dispose(o),this.meshes.delete(a),this.signatures.delete(a));for(const[a,o]of this.images){const n=t.find(p=>p.id===a);if(n&&n.src===o.texture.userData.src&&n.kind==="video"==(o.video!==void 0))continue;r.release(o),this.images.delete(a);const h=this.meshes.get(a);h&&(this.dispose(h),this.meshes.delete(a),this.signatures.delete(a))}for(const a of t){const o=this.images.get(a.id);if(!o){this.load(a);continue}this.build(a,o)}this.follow()}setTime(t){this.clock=t,this.follow()}setShown(t){this.shown=t;for(const i of this.meshes.values())i.visible=t&&this.opacityOf(i.userData.id)>0}setView(t,i){this.views.set(t,i);const s=this.meshes.get(t);s&&this.applyOpacity(s,t)}layer=v;get any(){for(const t of this.meshes.values())if(t.visible)return!0;return!1}place(t){const i=this.held;i&&t.getWorldQuaternion(this.cameraTurn);for(const s of this.meshes.values()){if(!s.visible)continue;s.position.copy(t.position);const e=i?.get(s);e&&s.quaternion.copy(this.cameraTurn).multiply(e),s.updateMatrixWorld()}}hold(t){t.getWorldQuaternion(this.cameraTurn);const i=this.cameraTurn.clone().invert();this.held=new Map([...this.meshes.values()].map(s=>[s,i.clone().multiply(s.quaternion)])),this.registered=new Map([...this.meshes.values()].map(s=>[s,s.quaternion.clone()]))}release(){if(this.held){for(const[t,i]of this.registered??[])t.quaternion.copy(i);this.held=void 0,this.registered=void 0}}registered;held;cameraTurn=new M;get furthestM(){return this.meshes.size>0?u:0}directionOfPixel(t,i,s,e){const a=this.images.get(t.id),o=a?a.width/a.height:1,n=d.registrationAt(t,this.clock.t),h=Math.tan(n.fovDeg/2*l),p=h*o;return e.set((i*2-1)*p,(1-s*2)*h,-1).normalize(),e.applyQuaternion(r.orientation(n))}aspectOf(t){const i=this.images.get(t);return i?i.width/i.height:void 0}failureOf(t){return this.failed.get(t)}follow(){for(const t of this.references){const i=this.meshes.get(t.id),s=this.images.get(t.id)?.video;s&&this.sync(t,s),i&&(t.registrationTrack?.length&&r.point(i,t,d.registrationAt(t,this.clock.t)),t.kind==="video"&&this.applyOpacity(i,t.id))}}sync(t,i){const s=d.mediaSecondsAt(t,this.clock.t,this.clock.timeScale,Number.isFinite(i.duration)?i.duration:void 0);if(s===void 0){i.paused||i.pause();return}const e=d.command(i.currentTime,s,this.clock.playing,d.rateOf(t));i.playbackRate=e.rate,e.seekS!==void 0&&!i.seeking&&(i.currentTime=e.seekS),e.play&&i.paused&&i.play().catch(()=>{}),!e.play&&!i.paused&&i.pause()}load(t){const i=t.src;if(this.loading.has(t.id)||this.failed.has(i))return;const s=t.kind==="video",a=(s?this.loadVideo(i,()=>this.onVideoFrame()):this.loadImage(i)).then(o=>{this.loading.delete(t.id);const n=this.references.find(h=>h.id===t.id);if(!n||n.src!==i||n.kind==="video"!==s){r.release(o);return}o.texture.userData.src=i,this.images.set(t.id,o),this.build(n,o),this.follow(),this.onImageLoaded()},o=>{this.loading.delete(t.id),this.failed.set(i,m.failureOf(o)),this.onImageLoaded()});this.loading.set(t.id,a)}onVideoFrame(){this.follow(),this.onFrame?.()}onFrame;static openVideo(t,i){return new Promise((s,e)=>{const a=document.createElement("video");a.crossOrigin="anonymous",a.muted=!0,a.playsInline=!0,a.preload="auto",a.addEventListener("loadeddata",()=>{const o=new y(a);o.colorSpace=g,o.minFilter=c,o.magFilter=c,o.generateMipmaps=!1,a.addEventListener("seeked",i);const n=()=>{a.paused&&i(),a.src&&a.requestVideoFrameCallback(n)};"requestVideoFrameCallback"in a&&a.requestVideoFrameCallback(n),s({texture:o,width:a.videoWidth,height:a.videoHeight,video:a})},{once:!0}),a.addEventListener("error",()=>{m.whyVideoUnread(t).then(o=>e(new f(t,o)))},{once:!0}),a.src=t})}static release(t){t.texture.dispose();const i=t.video;i&&(i.pause(),i.removeAttribute?.("src"),i.load?.())}static async fetchImage(t){const i=await m.blob(t),s=await createImageBitmap(i,{imageOrientation:"flipY"}).catch(()=>{throw new f(t,{kind:"notPicture"})}),e=new b(s);return e.flipY=!1,e.colorSpace=g,e.minFilter=c,e.magFilter=c,e.generateMipmaps=!1,e.needsUpdate=!0,{texture:e,width:s.width,height:s.height}}build(t,i){const s=r.signatureOf(t,i);let e=this.meshes.get(t.id);if(e&&this.signatures.get(t.id)===s){this.applyOpacity(e,t.id);return}e&&(this.dispose(e),this.meshes.delete(t.id)),e=new k(r.geometryOf(t,i),new O({map:i.texture,transparent:!0,depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1})),t.kind==="panorama"&&(e.material.side=T),e.frustumCulled=!1,e.layers.set(v),e.userData.id=t.id,r.point(e,t,d.registrationAt(t,this.clock.t)),this.scene.add(e),this.meshes.set(t.id,e),this.signatures.set(t.id,s),this.applyOpacity(e,t.id)}static geometryOf(t,i){if(t.kind==="panorama"){const o=new E(u,64,32,Math.PI/2,Math.PI*2),n=o.attributes.uv;for(let h=0;h<n.count;h++)n.setX(h,1-n.getX(h));return n.needsUpdate=!0,o}const s=2*u*Math.tan(t.registration.fovDeg/2*l),e=s*(i.width/Math.max(i.height,1)),a=new D(e,s);return a.translate(0,0,-u),a}static orientation({headingDeg:t,pitchDeg:i,rollDeg:s}){const e=new I;return e.rotation.set(i*l,-t*l,-(s??0)*l,"YXZ"),e.quaternion}static point(t,i,s){if(t.quaternion.copy(r.orientation(s)),i.kind==="panorama")return;const e=Math.tan(s.fovDeg/2*l)/Math.tan(i.registration.fovDeg/2*l);t.scale.set(e,e,1)}inTime(t){if(t.kind!=="video")return!0;const i=this.images.get(t.id)?.video?.duration;return d.mediaSecondsAt(t,this.clock.t,this.clock.timeScale,i!==void 0&&Number.isFinite(i)?i:void 0)!==void 0}opacityOf(t){const i=this.references.find(a=>a.id===t);if(i&&!this.inTime(i))return 0;const s=this.views.get(t),e=i?r.presenceAt(i,this.observerAt):1;return(s?.opacity??i?.opacity??0)*e}applyOpacity(t,i){const s=this.opacityOf(i);t.material.opacity=s,t.visible=this.shown&&s>0}static signatureOf(t,i){const{headingDeg:s,pitchDeg:e,rollDeg:a,fovDeg:o}=t.registration;return[t.kind,t.src,i.width,i.height,s,e,a??0,o].join("|")}dispose(t){this.scene.remove(t),t.geometry.dispose(),t.material.dispose()}disposeAll(){for(const t of this.meshes.values())this.dispose(t);this.meshes.clear(),this.signatures.clear();for(const t of this.images.values())r.release(t);this.images.clear()}}export{v as REFERENCE_LAYER,r as ReferenceSystem};
|