@rr0/ufoathome 0.144.1 → 0.146.0
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/rr0-scene.mjs +331 -652
- package/dist-embed-scene/{sightingSchema-t3YCF0eV.js → sightingSchema-BpEpb5Vc.js} +1 -1
- package/dist-embed-sighting/SightingMessages_es-CLihvSau.js +1 -0
- package/dist-embed-sighting/SightingMessages_fr-1Wf0tZCS.js +1 -0
- package/dist-embed-sighting/SightingMessages_it-BBpNT9oj.js +1 -0
- package/dist-embed-sighting/rr0-sighting.mjs +317 -638
- package/dist-embed-sighting/{sightingSchema-t3YCF0eV.js → sightingSchema-BpEpb5Vc.js} +1 -1
- package/dist-embed-sighting-editor/AdsbLolArchiveProvider-RNAaE2P_.js +1 -0
- package/dist-embed-sighting-editor/{BeamEditor-Bko8HBqB.js → BeamEditor-qZfCSNrr.js} +1 -1
- package/dist-embed-sighting-editor/{BeamSystem-DibQnDQt.js → BeamSystem-CrrOjNqD.js} +1 -1
- package/dist-embed-sighting-editor/{BodyEditor-3Pv5hYe4.js → BodyEditor-XZ5oo20k.js} +2 -2
- package/dist-embed-sighting-editor/{ContrailSystem-CnMn7-P3.js → ContrailSystem-CXR_fe3m.js} +1 -1
- package/dist-embed-sighting-editor/{CoverageAssessor-ZPfl-pIr.js → CoverageAssessor-B8gBscye.js} +1 -1
- package/dist-embed-sighting-editor/{GLTFLoader-BwKeFCRw.js → GLTFLoader-DHQ7X9p5.js} +1 -1
- package/dist-embed-sighting-editor/{HeadlightSystem-CoBP2hn0.js → HeadlightSystem-CPbn_3dw.js} +1 -1
- package/dist-embed-sighting-editor/{HynekAssessor-kTvEbabz.js → HynekAssessor-BopK5jfz.js} +1 -1
- package/dist-embed-sighting-editor/{InterviewEditorElement-DBuxtdMB.js → InterviewEditorElement-CpK8gAgI.js} +2 -2
- package/dist-embed-sighting-editor/LanternEditor-D2yl5PH3.js +9 -0
- package/dist-embed-sighting-editor/LanternEditorMessages_en-3XzIx2c4.js +1 -0
- package/dist-embed-sighting-editor/LanternEditorMessages_es-BwzbSSd3.js +1 -0
- package/dist-embed-sighting-editor/LanternEditorMessages_fr-Cf444dJM.js +1 -0
- package/dist-embed-sighting-editor/LanternEditorMessages_it-Bhk0A4Ug.js +1 -0
- package/dist-embed-sighting-editor/{LaserBeam-BuHV0CAP.js → LaserBeam-D6hhHu5-.js} +1 -1
- package/dist-embed-sighting-editor/{LaunchEditor-B-i5uD19.js → LaunchEditor-Dry3DiMo.js} +1 -1
- package/dist-embed-sighting-editor/{ModelSource-DvO3GvYu.js → ModelSource-n0nZrWMU.js} +1 -1
- package/dist-embed-sighting-editor/{ModelThumbnails-T8FwtOCM.js → ModelThumbnails-Bj4DwXU0.js} +1 -1
- package/dist-embed-sighting-editor/{ModelViewer-s4OyekVX.js → ModelViewer-YecYa7OI.js} +1 -1
- package/dist-embed-sighting-editor/{RailwaySystem-BgkkxR-M.js → RailwaySystem-DMCp5YHT.js} +4 -4
- package/dist-embed-sighting-editor/{ReferenceSystem-D30Dc7NR.js → ReferenceSystem-BeFpOHFl.js} +1 -1
- package/dist-embed-sighting-editor/{RoadMarkings-BME7pFh2.js → RoadMarkings-GCEFUqp7.js} +1 -1
- package/dist-embed-sighting-editor/{SceneNames_es-CYEwepgA.js → SceneNames_es-Bxqb_rVs.js} +1 -1
- package/dist-embed-sighting-editor/{SceneNames_fr-DcmXYPbm.js → SceneNames_fr-B5y3B23j.js} +1 -1
- package/dist-embed-sighting-editor/{SceneNames_it-Doviz6zH.js → SceneNames_it-DBmk3NDJ.js} +1 -1
- package/dist-embed-sighting-editor/{SightingEditorMessages_es-BXrXCsmJ.js → SightingEditorMessages_es-8tTlDrVR.js} +1 -1
- package/dist-embed-sighting-editor/{SightingEditorMessages_fr-DtMIkYvz.js → SightingEditorMessages_fr-B6HG_PkP.js} +1 -1
- package/dist-embed-sighting-editor/{SightingEditorMessages_it-Cii6z1Lk.js → SightingEditorMessages_it-BwIheqwp.js} +1 -1
- package/dist-embed-sighting-editor/{SightingFileEditor-DDAzzasL.js → SightingFileEditor-IEZGobI0.js} +1 -1
- package/dist-embed-sighting-editor/{TraceSystem-BGF0P9zl.js → TraceSystem-lNFPtyqy.js} +2 -2
- package/dist-embed-sighting-editor/{WaterSystem-BKoFKdK_.js → WaterSystem-KGutPogf.js} +1 -1
- package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +325 -637
- package/dist-embed-sighting-editor/{sightingSchema-t3YCF0eV.js → sightingSchema-BpEpb5Vc.js} +1 -1
- package/dist-embed-sighting-editor/trafficRuntime-ZmzuyzhR.js +2 -0
- package/package.json +1 -1
- package/dist-embed-sighting/SightingMessages_es-DBRW6jG0.js +0 -1
- package/dist-embed-sighting/SightingMessages_fr-Dwkll3ZY.js +0 -1
- package/dist-embed-sighting/SightingMessages_it-CS1pKPSh.js +0 -1
- package/dist-embed-sighting-editor/AdsbLolArchiveProvider-CtHllfL6.js +0 -1
- package/dist-embed-sighting-editor/trafficRuntime-BoN9h4Uo.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{L as o}from"./LaserBeam-
|
|
1
|
+
import{L as o}from"./LaserBeam-D6hhHu5-.js";import{x as m,U as f,C as b,u as d,v as u,t as h,D as v}from"./rr0-sighting-editor.mjs";import{beamEditorMessages_en as c}from"./BeamEditorMessages_en-DBs2OUXJ.js";class i{static LIGHT={en:"Light",fr:"Lumière",es:"Luz",it:"Luce"};static WHEN={en:"When",fr:"Quand",es:"Cuándo",it:"Quando"};static nextPlace(e){const t=e[e.length-1]??{lat:0,lng:0,altitudeM:0},a=e[e.length-2];return a?{lat:2*t.lat-a.lat,lng:2*t.lng-a.lng,altitudeM:2*t.altitudeM-a.altitudeM}:{lat:t.lat,lng:t.lng+500/(111320*Math.max(.05,Math.cos(t.lat*Math.PI/180))),altitudeM:t.altitudeM}}static instant(e,t,a){return{type:"number",key:e,min:-3600,max:36e3,step:.1,unit:"s",scale:.001,label:t,hint:a,group:i.WHEN}}static SET={kind:"beam",title:{en:"Beam",fr:"Faisceau",es:"Haz",it:"Fascio"},parameters:[{type:"said",key:"title",label:{en:"Name",fr:"Nom",es:"Nombre",it:"Nome"},group:i.LIGHT},{type:"number",key:"wavelengthNm",min:380,max:780,step:1,unit:"nm",required:!0,group:i.LIGHT,label:{en:"Wavelength",fr:"Longueur d'onde",es:"Longitud de onda",it:"Lunghezza d'onda"},hint:{en:"Its colour: 532 for the green of a frequency-doubled laser, 520 for a green diode, 638 for a red one, 450 for a blue one.",fr:"Sa couleur : 532 pour le vert d'un laser doublé en fréquence, 520 pour une diode verte, 638 pour une rouge, 450 pour une bleue.",es:"Su color: 532 para el verde de un láser doblado en frecuencia, 520 para un diodo verde, 638 para uno rojo, 450 para uno azul.",it:"Il suo colore: 532 per il verde di un laser a frequenza raddoppiata, 520 per un diodo verde, 638 per uno rosso, 450 per uno blu."}},{type:"number",key:"powerW",min:.001,max:1e5,step:.001,unit:"W",required:!0,group:i.LIGHT,label:{en:"Power",fr:"Puissance",es:"Potencia",it:"Potenza"},hint:{en:"The optical power it carries, its mean for a pulsed laser, whose pulses no eye tells apart. What is seen of it is what the air scatters.",fr:"La puissance optique qu'il porte, sa moyenne pour un laser pulsé, dont aucun œil ne distingue les impulsions. Ce qui s'en voit est ce que l'air en diffuse.",es:"La potencia óptica que lleva, su media para un láser pulsado, cuyos pulsos ningún ojo distingue. Lo que se ve de él es lo que el aire difunde.",it:"La potenza ottica che porta, la sua media per un laser pulsato, i cui impulsi nessun occhio distingue. Ciò che se ne vede è ciò che l'aria diffonde."}},{type:"number",key:"divergenceMrad",min:.001,max:1e3,step:.001,unit:"mrad",group:i.LIGHT,effective:()=>o.DEFAULT_DIVERGENCE_MRAD,label:{en:"Divergence",fr:"Divergence",es:"Divergencia",it:"Divergenza"},hint:{en:"How fast it widens, full angle: 0.1 mrad is a metre wide at 10 km.",fr:"À quelle vitesse il s'élargit, angle total : 0,1 mrad fait un mètre de large à 10 km.",es:"Lo rápido que se ensancha, ángulo total: 0,1 mrad es un metro de ancho a 10 km.",it:"Quanto in fretta si allarga, angolo totale: 0,1 mrad è un metro di larghezza a 10 km."}},{type:"number",key:"apertureM",min:.001,max:10,step:.001,unit:"m",group:i.LIGHT,effective:()=>o.DEFAULT_APERTURE_M,label:{en:"Width at the emitter",fr:"Largeur à l'émetteur",es:"Anchura en el emisor",it:"Larghezza all'emettitore"}},i.instant("fromT",{en:"On from",fr:"Allumé à",es:"Encendido a",it:"Acceso a"},{en:"Seconds of the recording; empty, from its start.",fr:"Secondes de l'enregistrement ; vide, dès son début.",es:"Segundos de la grabación; vacío, desde su inicio.",it:"Secondi della registrazione; vuoto, dal suo inizio."}),i.instant("untilT",{en:"Off at",fr:"Éteint à",es:"Apagado a",it:"Spento a"},{en:"Seconds of the recording; empty, until its end.",fr:"Secondes de l'enregistrement ; vide, jusqu'à sa fin.",es:"Segundos de la grabación; vacío, hasta su final.",it:"Secondi della registrazione; vuoto, fino alla sua fine."})]};static PLACE={kind:"beam-place",title:{en:"Point of the path",fr:"Point du trajet",es:"Punto del trayecto",it:"Punto del percorso"},parameters:[{type:"number",key:"lat",min:-90,max:90,step:1e-6,unit:"°",required:!0,label:{en:"Latitude",fr:"Latitude",es:"Latitud",it:"Latitudine"}},{type:"number",key:"lng",min:-180,max:180,step:1e-6,unit:"°",required:!0,label:{en:"Longitude",fr:"Longitude",es:"Longitud",it:"Longitudine"}},{type:"number",key:"altitudeM",min:-500,max:1e5,step:.1,unit:"m",required:!0,label:{en:"Altitude",fr:"Altitude",es:"Altitud",it:"Altitudine"},hint:{en:"Above the sea, not the ground: an emitter at a window twelve metres up a building on ground at 160 m is at 172 m.",fr:"Au-dessus de la mer, pas du sol : un émetteur à une fenêtre à douze mètres de haut, sur un sol à 160 m, est à 172 m.",es:"Sobre el mar, no sobre el suelo: un emisor en una ventana a doce metros de altura, sobre un suelo a 160 m, está a 172 m.",it:"Sul mare, non sul suolo: un emettitore a una finestra a dodici metri d'altezza, su un suolo a 160 m, è a 172 m."}}]};static publish(){m.publish(i.SET)}}class r{constructor(e,t,a){this.container=e,this.host=t,this.language=a,m.of("beam")||i.publish(),this.render(),this.setLanguage(a)}messages=c;languageToken=0;currentId;form;list;places;placeForm;placeIndex=0;language;shown=[];async setLanguage(e){const t=++this.languageToken;this.language=e;const a=f.includes(e)?e:"en",s=a==="en"?c:await b(a);t===this.languageToken&&(this.messages=s,this.render(),this.sync())}sync(){const e=this.beams;this.shown=[...e],e.some(a=>a.id===this.currentId)||(this.currentId=e[0]?.id),this.list?.setItems(e.map(a=>({id:a.id,label:this.labelOf(a)})),this.currentId),this.syncAddState();const t=this.current;this.element("beam-fields").hidden=t===void 0,t&&(this.syncPlaces(t),this.form??=new d(this.element("beam-parameters"),this.language,"beam.",{said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()}),this.form.show(i.SET,new u(()=>this.current,a=>this.editBeam(s=>a(s))),()=>this.written()))}refresh(){this.syncAddState();const e=this.beams;e.length===this.shown.length&&e.every((t,a)=>t.id===this.shown[a].id)||this.sync()}syncAddState(){const e=this.pathOfNew()!==void 0;this.list?.setAddState(e,e?void 0:this.messages.addBeamNowhere)}get current(){return this.beams.find(e=>e.id===this.currentId)}show(e){this.currentId=e,this.placeIndex=0,this.sync()}render(){const e=this.messages;this.form=void 0,this.container.innerHTML=`<div class="launch-editor">
|
|
2
2
|
<p class="launch-intro">${e.intro}</p>
|
|
3
3
|
<div id="beam-list"></div>
|
|
4
4
|
<div id="beam-fields" class="launch-fields">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a6 as P,ar as V,at as m,a9 as W,aM as X,aN as D,aO as k}from"./rr0-sighting-editor.mjs";import{L as f}from"./LaserBeam-D6hhHu5-.js";class M{static MAX_SEGMENTS=12e3;static MIN_PIXELS=2;static VERTICES_PER_SEGMENT=24;static HALO_RAD=.002;static HALO_SHARE=.15;static BRIGHTEST_RELATIVE=6e4;group=new P;mesh;positions=new Float32Array(M.MAX_SEGMENTS*M.VERTICES_PER_SEGMENT*3);colors=new Float32Array(M.MAX_SEGMENTS*M.VERTICES_PER_SEGMENT*3);segments=0;drawn=[];cut;constructor(){const s=new V;s.setAttribute("position",new m(this.positions,3)),s.setAttribute("color",new m(this.colors,3)),s.setDrawRange(0,0),this.mesh=new W(s,new X({vertexColors:!0,transparent:!0,blending:k,depthWrite:!1,fog:!1,side:D})),this.mesh.frustumCulled=!1,this.mesh.renderOrder=8,this.mesh.name="beams",this.group.name="beams",this.group.add(this.mesh)}get segmentCount(){return this.segments}update(s,t,o){const c=this.viewsOf(s,t,o);let r=0;this.segments=0,this.drawn=[];for(const i of c){const l=f.colourOf(i.wavelengthNm),h=this.place(i,o);this.drawn.push({id:i.id,points:h});for(let u=0;u+1<h.length&&!(this.segments>=M.MAX_SEGMENTS);u++){const A=this.pushSegment(r,h[u],h[u+1],i.wavelengthNm,l,o);A>r&&this.segments++,r=A}}const n=this.mesh.geometry;n.setDrawRange(0,r);for(const i of["position","color"]){const l=n.getAttribute(i);l.clearUpdateRanges(),r>0&&l.addUpdateRange(0,r*3),l.needsUpdate=!0}}viewsOf(s,t,o){const{lat:c,lng:r}=o.reference;(!this.cut||this.cut.lat!==c||this.cut.lng!==r||this.cut.air!==o.air)&&(this.cut={lat:c,lng:r,air:o.air,views:new Map});const n=this.cut.views;return f.onAt(s,t).map(i=>{let l=n.get(i);return l||n.set(i,l={id:i.id,wavelengthNm:i.wavelengthNm,samples:f.samplesOf(i,o.reference,o.air)}),l})}place(s,t){const o=[];for(const c of s.samples){const r=t.origin.x+c.eastM*t.eastScale,n=t.origin.z-c.northM,i=c.upM-t.siteElevationM;if(o.length>0&&i<t.groundYAt(r,n))break;o.push({x:r,y:i,z:n,altitudeM:c.altitudeM,widthM:c.widthM,powerW:c.powerW})}return o}static SMOOTH_RATIO=1.08;static MAX_HALVINGS=6;pushSegment(s,t,o,c,r,n,i=0){const l={x:o.x-t.x,y:o.y-t.y,z:o.z-t.z},h=Math.hypot(l.x,l.y,l.z);if(h<1e-6)return s;const u={x:l.x/h,y:l.y/h,z:l.z/h};if(Math.hypot((t.x+o.x)/2-n.eye.x,(t.y+o.y)/2-n.eye.y,(t.z+o.z)/2-n.eye.z)<.001)return s;const A=e=>{const y={x:n.eye.x-e.x,y:n.eye.y-e.y,z:n.eye.z-e.z},z=Math.hypot(y.x,y.y,y.z)||.001,p=(u.x*y.x+u.y*y.y+u.z*y.z)/z,a=Math.sqrt(Math.max(0,1-p*p)),w=f.phasedScattering(f.coefficientsAt(n.air,c,e.altitudeM),p);return{sinTurn:a,scattered:w,through:n.transmittanceTo(e.x,e.y,e.z)}},T=e=>M.MIN_PIXELS*n.pixelRad*Math.hypot(e.x-n.eye.x,e.y-n.eye.y,e.z-n.eye.z),N=e=>Math.hypot(e.x-n.eye.x,e.y-n.eye.y,e.z-n.eye.z),R=e=>Math.max(e.widthM,M.HALO_RAD*N(e)),g=e=>{const y=R(e)/T(e),z=Math.min(1,Math.max(0,y-1));return M.HALO_SHARE*z*z*(3-2*z)},O=new Map([t,o].map(e=>[e,A(e)])),x=(e,y,z)=>{const p=Math.max(y,T(e)),{sinTurn:a,scattered:w,through:E}=O.get(e),I=2*z*f.luminanceCdM2(e.powerW,c,w,p,a),H=r.map((v,C)=>Math.min(M.BRIGHTEST_RELATIVE,I*n.relativeScale*v*E[C])),L={x:n.eye.x-e.x,y:n.eye.y-e.y,z:n.eye.z-e.z},_=this.normalise(this.cross(u,L));return{point:e,half:p/2,level:H,across:_}},d=[[x(t,t.widthM,1-g(t)),x(o,o.widthM,1-g(o))],[x(t,R(t),g(t)),x(o,R(o),g(o))]],[G,S]=d[0].map(e=>Math.max(...e.level));if(i<M.MAX_HALVINGS&&Math.max(G,S)>M.SMOOTH_RATIO*Math.max(Math.min(G,S),1e-12)){const e={x:(t.x+o.x)/2,y:(t.y+o.y)/2,z:(t.z+o.z)/2,altitudeM:(t.altitudeM+o.altitudeM)/2,widthM:(t.widthM+o.widthM)/2,powerW:Math.sqrt(t.powerW*o.powerW)};return this.pushSegment(this.pushSegment(s,t,e,c,r,n,i+1),e,o,c,r,n,i+1)}if((s+M.VERTICES_PER_SEGMENT)*3>this.positions.length)return s;for(const e of d){if(e.every(a=>Math.max(...a.level)<=0))continue;const y=(a,w)=>{const E=s*3;this.positions[E]=a.point.x+a.across.x*a.half*w,this.positions[E+1]=a.point.y+a.across.y*a.half*w,this.positions[E+2]=a.point.z+a.across.z*a.half*w;const I=w===0?1:0;this.colors[E]=a.level[0]*I,this.colors[E+1]=a.level[1]*I,this.colors[E+2]=a.level[2]*I,s++},[z,p]=e;for(const a of[-1,1])y(z,a),y(z,0),y(p,a),y(z,0),y(p,0),y(p,a)}return s}pickAt(s,t,o){let c;for(const r of this.drawn)for(let n=0;n+1<r.points.length;n++){const i=r.points[n],l=r.points[n+1],h={x:l.x-i.x,y:l.y-i.y,z:l.z-i.z},u={x:i.x-s.x,y:i.y-s.y,z:i.z-s.z},A=h.x*h.x+h.y*h.y+h.z*h.z,T=h.x*t.x+h.y*t.y+h.z*t.z,N=h.x*u.x+h.y*u.y+h.z*u.z,R=t.x*u.x+t.y*u.y+t.z*u.z,g=A-T*T,O=g>1e-9?Math.min(1,Math.max(0,(T*R-N)/g)):0,x={x:i.x+h.x*O,y:i.y+h.y*O,z:i.z+h.z*O},d=(x.x-s.x)*t.x+(x.y-s.y)*t.y+(x.z-s.z)*t.z;if(d<=0)continue;const G=Math.hypot(x.x-s.x-t.x*d,x.y-s.y-t.y*d,x.z-s.z-t.z*d),S=Math.atan2(G,d);S<=o&&(!c||S<c.angle)&&(c={id:r.id,distanceM:Math.hypot(x.x-s.x,x.y-s.y,x.z-s.z),angle:S})}return c&&{id:c.id,distanceM:c.distanceM}}cross(s,t){return{x:s.y*t.z-s.z*t.y,y:s.z*t.x-s.x*t.z,z:s.x*t.y-s.y*t.x}}normalise(s){const t=Math.hypot(s.x,s.y,s.z)||1;return{x:s.x/t,y:s.y/t,z:s.z/t}}dispose(){this.mesh.geometry.dispose(),this.mesh.material.dispose(),this.group.removeFromParent()}}export{M as BeamSystem};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{U as A,q as O,B as u,t as f,u as v,v as M}from"./rr0-sighting-editor.mjs";import{bodyEditorMessages_en as w}from"./BodyEditorMessages_en-DmM8Dasm.js";class
|
|
1
|
+
import{U as A,q as O,B as u,t as f,u as v,v as M}from"./rr0-sighting-editor.mjs";import{bodyEditorMessages_en as w}from"./BodyEditorMessages_en-DmM8Dasm.js";class b{static before(e,i){const t=[...e.track].sort((s,o)=>s.t-o.t);return[...t].reverse().find(s=>s.t<=i)??t[0]}static viewOf(e,i,t){const s=b.before(e,i),o=n=>Number(n.toFixed(2));return{mode:s?.eastM!==void 0&&s.northM!==void 0?"world":"observer",azimuthDeg:o(t.azimuthDeg),elevationDeg:o(t.altitudeDeg),distanceM:o(t.distanceM),eastM:o(t.eastM),northM:o(t.northM),aboveGroundM:o(t.aboveGroundM),onGround:s?.onGround===!0,widthM:o(t.sizeM.widthM),lengthM:o(t.sizeM.lengthM),heightM:o(t.sizeM.heightM),headingDeg:o(t.attitude.headingDeg),pitchDeg:o(t.attitude.pitchDeg),rollDeg:o(t.attitude.rollDeg),color:t.appearance.color,albedo:o(t.appearance.albedo),luminanceCdM2:o(t.appearance.luminanceCdM2),transparency:o(t.appearance.transparency??0),haloScale:o(t.appearance.haloScale??1)}}static keyframeOf(e,i,t,s){const o=d=>Number.isFinite(d)?d:0,n=e.mode==="world"?{t:i,eastM:o(e.eastM),northM:o(e.northM),...e.onGround?{onGround:!0}:{altitudeAboveGroundM:o(e.aboveGroundM)}}:{t:i,azimuthDeg:o(e.azimuthDeg),altitudeDeg:o(e.elevationDeg),distanceM:Math.max(.1,o(e.distanceM)),...e.onGround?{onGround:!0}:{}},r=s?{color:e.color,albedo:Math.max(0,Math.min(1,o(e.albedo))),luminanceCdM2:Math.max(0,o(e.luminanceCdM2)),transparency:Math.max(0,Math.min(1,o(e.transparency))),haloScale:Math.max(0,o(e.haloScale))}:t?.appearance;return{...b.withoutPlacement(t),...n,sizeM:{widthM:Math.max(.01,o(e.widthM)),lengthM:Math.max(.01,o(e.lengthM)),heightM:Math.max(.01,o(e.heightM))},attitude:{headingDeg:o(e.headingDeg),pitchDeg:o(e.pitchDeg),rollDeg:o(e.rollDeg)},...r?{appearance:r}:{}}}static withoutPlacement(e){if(!e)return{};const{eastM:i,northM:t,azimuthDeg:s,altitudeDeg:o,distanceM:n,onGround:r,altitudeAboveGroundM:d,sizeM:a,attitude:h,appearance:c,...m}=e;return m}}class l{static number(e,i,t,s,o,n,r={}){return{type:"number",key:e,label:i,min:t,max:s,step:o,unit:n,required:!0,...r}}static BODY={kind:"body",title:{en:"Body",fr:"Corps",es:"Cuerpo",it:"Corpo"},parameters:[{type:"text",key:"id",required:!0,label:{en:"ID",fr:"Identifiant",es:"Identificador",it:"Identificativo"},validate:(e,i,t)=>!(t?.ids??[]).some(s=>s===e&&s!==i.id)},{type:"said",key:"title",label:{en:"Name",fr:"Nom",es:"Nombre",it:"Nome"}},{type:"set",key:"explains",label:{en:"Stands for the shapes",fr:"Représente les formes",es:"Representa las formas",it:"Rappresenta le forme"},options:(e,i)=>{const t=i?.shapes??[],s=(e.explains??[]).filter(o=>!t.some(n=>n.value===o));return[...t,...s.map(o=>({value:o,label:o}))]},empty:{en:"No shape",fr:"Aucune forme",es:"Ninguna forma",it:"Nessuna forma"}},{type:"text",key:"outlineNode",label:{en:"Part drawn by the observer",fr:"Partie dessinée par l'observateur",es:"Parte dibujada por el observador",it:"Parte disegnata dall'osservatore"},placeholder:{en:"Node of the model, e.g. hull",fr:"Nœud du modèle, par ex. hull",es:"Nodo del modelo, p. ej. hull",it:"Nodo del modello, ad es. hull"}}]};static KEYFRAME={kind:"body-keyframe",title:{en:"At the playhead",fr:"À l'instant courant",es:"En el instante actual",it:"All'istante corrente"},parameters:[{type:"choice",key:"mode",required:!0,label:{en:"Position",fr:"Position",es:"Posición",it:"Posizione"},choices:[{value:"observer",label:{en:"From the observer",fr:"Depuis l'observateur",es:"Desde el observador",it:"Dall'osservatore"}},{value:"world",label:{en:"In the world",fr:"Dans le monde",es:"En el mundo",it:"Nel mondo"}}]},l.number("azimuthDeg",{en:"Azimuth",fr:"Azimut",es:"Acimut",it:"Azimut"},0,360,.01,"°",{visibleWhen:e=>e.mode==="observer"}),l.number("elevationDeg",{en:"Elevation",fr:"Hauteur",es:"Elevación",it:"Elevazione"},-90,90,.01,"°",{visibleWhen:e=>e.mode==="observer"}),l.number("distanceM",{en:"Distance",fr:"Distance",es:"Distancia",it:"Distanza"},.1,3e4,.1,"m",{visibleWhen:e=>e.mode==="observer"}),l.number("eastM",{en:"East",fr:"Est",es:"Este",it:"Est"},-3e4,3e4,.1,"m",{visibleWhen:e=>e.mode==="world"}),l.number("northM",{en:"North",fr:"Nord",es:"Norte",it:"Nord"},-3e4,3e4,.1,"m",{visibleWhen:e=>e.mode==="world"}),{type:"boolean",key:"onGround",label:{en:"On the ground",fr:"Au sol",es:"En el suelo",it:"A terra"}},l.number("aboveGroundM",{en:"Above the ground",fr:"Au-dessus du sol",es:"Sobre el suelo",it:"Sopra il suolo"},0,3e4,.1,"m",{visibleWhen:e=>e.mode==="world"&&e.onGround!==!0}),l.number("widthM",{en:"Width",fr:"Largeur",es:"Ancho",it:"Larghezza"},.01,1e3,.01,"m"),l.number("lengthM",{en:"Length",fr:"Longueur",es:"Largo",it:"Lunghezza"},.01,1e3,.01,"m"),l.number("heightM",{en:"Height",fr:"Hauteur",es:"Alto",it:"Altezza"},.01,1e3,.01,"m"),l.number("headingDeg",{en:"Heading",fr:"Cap",es:"Rumbo",it:"Rotta"},0,360,.1,"°"),l.number("pitchDeg",{en:"Pitch",fr:"Tangage",es:"Cabeceo",it:"Beccheggio"},-90,90,.1,"°"),l.number("rollDeg",{en:"Roll",fr:"Roulis",es:"Alabeo",it:"Rollio"},-180,180,.1,"°"),{type:"colour",key:"color",label:{en:"Colour",fr:"Couleur",es:"Color",it:"Colore"},fallback:"#c8c8c8",visibleWhen:(e,i)=>i?.drawnFromModel!==!0},l.number("albedo",{en:"Albedo",fr:"Albédo",es:"Albedo",it:"Albedo"},0,1,.01,void 0),l.number("luminanceCdM2",{en:"Light of its own",fr:"Lumière propre",es:"Luz propia",it:"Luce propria"},0,1e10,.1,"cd/m²"),l.number("transparency",{en:"Transparency",fr:"Transparence",es:"Transparencia",it:"Trasparenza"},0,1,.01,void 0),l.number("haloScale",{en:"Halo",fr:"Halo",es:"Halo",it:"Alone"},0,20,.1,"×")]}}class p{constructor(e,i,t){this.container=e,this.host=i,this.language=t,this.render(),this.setLanguage(t)}static APPEARANCE_KEYS=["color","albedo","luminanceCdM2","transparency","haloScale"];messages=w;languageToken=0;currentId;catalogueToken=0;shownEntry;syncedId;bodyForm;keyForm;async setLanguage(e){const i=++this.languageToken;this.language=e;const t=A.includes(e)?e:"en",s=t==="en"?w:await O(t);i===this.languageToken&&s!==this.messages&&(this.messages=s,this.render())}sync(){const e=this.bodies;e.some(n=>n.id===this.currentId)||(this.currentId=e[0]?.id),this.input("body-interpretation-title").value=this.host.said().read(this.interpretation?.title)??"",this.list?.setItems(e.map(n=>({id:n.id,label:this.labelOf(n)})),this.currentId);const i=this.host.newBodyStart();this.list?.setAddState(i!==void 0,i?i.label!==void 0?this.messages.addBodyHint.replace("{shape}",i.label):this.messages.addBodyHintView:void 0),this.input("body-interpretation-title").closest("label").hidden=!1;const t=this.current;if(this.element("body-fields").hidden=t===void 0,!t)return;this.bodyForm?.sync(),this.syncModelOptions(t);const s=t.model;this.input("body-model-url").value=s.url??"",this.input("body-model-title").value=s.credit?.title??"",this.input("body-model-author").value=s.credit?.author??"",this.input("body-model-license").value=s.credit?.license??"",this.input("body-model-source").value=s.credit?.sourceUrl??"";const o=this.element("body-model-advanced");o.open=s.url!==void 0||o.open&&t.id===this.syncedId,this.syncedId=t.id,this.element("body-model-incomplete").hidden=s.url===void 0||s.credit?.title!==void 0&&s.credit.license!==void 0,this.syncKeyframe()}syncKeyframe(e=!1){const i=this.current;if(!i)return;const t=this.host.currentTime(),s=this.messages,o=this.host.readingOf(i,t),n=i.track.find(d=>d.t===t),r=this.element("body-key-legend");r.textContent=s.atPlayhead.replace("{t}",p.seconds(t)),r.hidden=n!==void 0,this.element("body-key-note").textContent=o?n?s.keyframeHere:s.keyframeAdded:s.notPlaced,this.keyList?.setItems(i.track.map(d=>({id:String(d.t),label:p.seconds(d.t)})),n?String(n.t):""),this.keyList?.setAddState(o!==void 0&&n===void 0),this.keyList?.setStepState(i.track.some(d=>d.t<t),i.track.some(d=>d.t>t)),this.element("body-key-parameters").hidden=!o,o&&this.keyForm?.sync(e)}stepKeyframe(e){const i=this.current;if(!i)return;const t=this.host.currentTime(),s=i.track.map(o=>o.t).filter(o=>e<0?o<t:o>t);s.length!==0&&(this.host.seekTo(e<0?Math.max(...s):Math.min(...s)),this.syncKeyframe(!0))}keyframeContext(){const e=this.current?.model;return{drawnFromModel:e===void 0||e.url!==void 0||!u.includes(e.id??"")}}keyframeView(){const e=this.current;if(!e)return;const i=this.host.currentTime(),t=this.host.readingOf(e,i);return t?b.viewOf(e,i,t):void 0}render(){const e=this.messages,i=(r,d,a="text",h="",c="",m="")=>`<label><span>${d}</span> <input id="${r}" type="${a}" placeholder="${h}" ${m} autocomplete="off"/>${c?` ${c}`:""}</label>`;this.container.innerHTML=`<div class="body-editor">
|
|
2
2
|
<p class="body-intro">${e.intro}</p>
|
|
3
3
|
${i("body-interpretation-title",e.interpretationTitle)}
|
|
4
4
|
<div id="body-list" class="body-list"></div>
|
|
@@ -24,4 +24,4 @@ import{U as A,q as O,B as u,t as f,u as v,v as M}from"./rr0-sighting-editor.mjs"
|
|
|
24
24
|
<p class="body-intro">${e.pictureHint}</p>
|
|
25
25
|
</fieldset>
|
|
26
26
|
</div>
|
|
27
|
-
</div>`;const t=this.element("body-list");this.list=new f({header:t,body:this.element("body-fields"),ids:{list:"body-select",remove:"body-delete",add:"body-add"},actions:[{id:"body-look",glyph:"🎯",onClick:()=>{const r=this.current;r&&this.host.lookAt(r)}}],onSelect:r=>{this.currentId=r,this.sync()},onAdd:()=>void this.addBody(),onRemove:()=>this.deleteCurrent()}),this.list.setLabels({list:e.body,remove:e.deleteBody,add:e.addBody,empty:e.none,actions:{"body-look":e.lookAtBody}}),this.input("body-interpretation-title").addEventListener("change",()=>this.updateInterpretationTitle());for(const r of["body-model-url","body-model-title","body-model-author","body-model-license","body-model-source"])this.input(r).addEventListener("change",()=>this.updateCurrent());this.select("body-model").addEventListener("change",()=>{const r=this.select("body-model").value;r!==""&&(this.input("body-model-url").value=""),this.updateCurrent(),this.syncModelOptions(this.current),r!==""&&this.adoptCatalogueSize(r),this.element("body-model-advanced").open=r!==""&&!u.includes(r)});const s=this.element("body-keys");this.keyList=new f({header:s,optional:!0,ids:{list:"body-key",remove:"body-key-delete",add:"body-key-add"},navigation:{scope:this.container,onStep:r=>this.stepKeyframe(r)},onSelect:r=>{r!==""&&this.host.seekTo(Number(r)),this.syncKeyframe(!0)},onAdd:()=>this.editView(()=>{}),onRemove:()=>this.deleteKeyframe()}),this.keyList.setLabels({list:e.keyframes,remove:e.deleteKeyframe,add:e.addKeyframe,none:e.noKeyframeHere,previous:e.previousKeyframe,next:e.nextKeyframe}),this.host.modelPicker().enhance(this.select("body-model"),r=>this.modelSourceOf(r),{current:()=>{const r=this.current?.model;return r?.url===void 0?void 0:{url:r.url,title:r.credit?.title??"",author:r.credit?.author??"",license:r.credit?.license??"",source:r.credit?.sourceUrl??""}},apply:r=>{this.input("body-model-url").value=r.url,this.input("body-model-title").value=r.title,this.input("body-model-author").value=r.author,this.input("body-model-license").value=r.license,this.input("body-model-source").value=r.source,this.shownEntry=void 0,this.select("body-model").value="",this.updateCurrent(),this.syncModelOptions(this.current)}});const o=this.select("body-model").nextElementSibling;o&&(o.disabled=!0,o.title=e.modelFixed),this.input("body-model-url").readOnly=!0;const n={said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()};this.bodyForm=new v(this.element("body-parameters"),this.language,"body.",n),this.bodyForm.show(l.BODY,new M(()=>this.current,r=>this.editBody(r),()=>({ids:this.bodies.map(r=>r.id),shapes:this.host.shapes().map(r=>({value:r.id,label:r.label}))})),()=>{}),this.keyForm=new v(this.element("body-key-parameters"),this.language,"bodyKey."),this.keyForm.show(l.KEYFRAME,new M(()=>this.keyframeView(),(r,d)=>this.editView(r,b.APPEARANCE_KEYS.includes(d.key)),()=>this.keyframeContext()),()=>{}),this.sync()}async syncModelOptions(e){const i=++this.catalogueToken,t=await this.host.modelProvider().entries().catch(()=>[]);if(i!==this.catalogueToken)return;const s=this.messages,o=this.select("body-model"),n=e.model.url===void 0?e.model.id:void 0,r=n===void 0||u.includes(n)||t.some(a=>a.id===n),d=[s.primitives,s.catalogue,t.map(a=>`${a.id}:${a.name}`).join(),e.model.url!==void 0,r?"":n].join("|");if(o.dataset.signature!==d){o.dataset.signature=d;const a=document.createElement("optgroup");a.label=s.primitives,a.append(...u.map(c=>new Option(s.primitive[c],c)));const h=document.createElement("optgroup");h.label=s.catalogue,h.append(...t.map(c=>new Option(c.name,c.id))),o.replaceChildren(a,h),e.model.url!==void 0&&o.prepend(new Option(s.modelAdvanced,"")),r||o.append(new Option(n,n))}o.value=n??"",this.showCatalogueModel(e.model.url===void 0?t.find(a=>a.id===e.model.id):void 0)}showCatalogueModel(e){const i=this.current;if(!i||i.model.url!==void 0){this.shownEntry=void 0,this.element("body-model-catalogue").hidden=!0;return}this.shownEntry=e;const t=this.container.getRootNode().activeElement,s=[["body-model-url",e?.url],["body-model-title",e?.credit.title],["body-model-author",e?.credit.author],["body-model-license",e?.credit.license],["body-model-source",e?.credit.sourceUrl]];for(const[o,n]of s)this.input(o)!==t&&(this.input(o).value=n??"");this.element("body-model-catalogue").hidden=e===void 0,this.element("body-model-incomplete").hidden=!0}updateInterpretationTitle(){const e=this.interpretation??{bodies:[]},i=this.host.said().write(e.title,this.input("body-interpretation-title").value,this.host.writingLanguage());this.write({...e,title:i})}updateCurrent(){const e=this.current;e&&this.write({...this.interpretation,bodies:this.bodies.map(i=>i===e?{...e,model:this.statedModel(e.model)}:i)})}editBody(e){const i=this.current;if(!i)return;const t=structuredClone(i);e(t),this.currentId=t.id,this.write({...this.interpretation,bodies:this.bodies.map(s=>s===i?t:s)})}editView(e,i=!1){const t=this.current,s=this.keyframeView();if(!t||!s)return;const o=this.host.currentTime();e(s);const n=p.keyframeOf(s,o,t.track.find(d=>d.t===o),i),r=[...t.track.filter(d=>d.t!==o),n].sort((d,a)=>d.t-a.t);this.write({...this.interpretation,bodies:this.bodies.map(d=>d===t?{...t,track:r}:d)}),this.syncKeyframe()}async addBody(){if(!this.host.newBodyStart())return;const e=this.messages,i=await this.host.modelProvider().entries().catch(()=>[]),t=document.createElement("select"),s=document.createElement("optgroup");s.label=e.primitives,s.append(...u.map(n=>new Option(e.primitive[n],n)));const o=document.createElement("optgroup");o.label=e.catalogue,o.append(...i.map(n=>new Option(n.name,n.id))),t.append(s,o),this.host.modelPicker().chooseFrom(t,n=>this.modelSourceOf(n),n=>{this.createBody({id:n}),u.includes(n)||this.adoptCatalogueSize(n)},{current:()=>{},apply:n=>this.createBody({url:n.url,credit:n.title!==""&&n.license!==""?{title:n.title,license:n.license,author:n.author||void 0,sourceUrl:n.source||void 0}:void 0})})}createBody(e){const i=this.host.newBodyStart();if(!i)return;const t=new Set(this.bodies.map(r=>r.id));let s=t.size+1;for(;t.has(`body-${s}`);)s++;const o={id:`body-${s}`,explains:i.sourceId!==void 0?[i.sourceId]:void 0,model:e,track:[i.keyframe]};this.currentId=o.id;const n=this.interpretation??{bodies:[]};this.write({...n,bodies:[...this.bodies,o]},!0)}modelSourceOf(e){return u.includes(e)?Promise.resolve({shape:e}):this.host.modelProvider().entry(e).then(i=>i&&{url:i.url,headingOffsetDeg:i.headingOffsetDeg})}async adoptCatalogueSize(e){const t=(await this.host.modelProvider().entry(e).catch(()=>{}))?.sizeM,s=this.current;if(!t||!s||s.model.id!==e)return;if(!s.track.some(n=>n.sizeM)&&s.track.length>0){const[n,...r]=[...s.track].sort((h,c)=>h.t-c.t),d={widthM:t.widthM??1,lengthM:t.lengthM??t.widthM??1,heightM:t.heightM??1},a=[{...n,sizeM:d},...r];this.write({...this.interpretation,bodies:this.bodies.map(h=>h===s?{...s,track:a}:h)},!0);return}const o=s.track.map(n=>{const r=n.sizeM?.widthM,d=t.widthM??r;if(!n.sizeM||r===void 0||d===void 0||r<=0)return n;const a=d/r,h={widthM:t.widthM??n.sizeM.widthM*a,lengthM:t.lengthM??n.sizeM.lengthM*a,heightM:t.heightM??n.sizeM.heightM*a};return n.distanceM!==void 0&&n.azimuthDeg!==void 0?{...n,sizeM:h,distanceM:Number((n.distanceM*a).toFixed(1))}:{...n,sizeM:h}});this.write({...this.interpretation,bodies:this.bodies.map(n=>n===s?{...s,track:o}:n)},!0)}get currentBodyId(){return this.current?.id}resize(e){const i=t=>Number(Math.max(.01,t).toFixed(2));this.editView(t=>Object.assign(t,{widthM:i(e.widthM),lengthM:i(e.lengthM),heightM:i(e.heightM)}))}turnTo(e){const i=t=>((t+180)%360+360)%360-180;this.editView(t=>Object.assign(t,{headingDeg:Number(((e.headingDeg%360+360)%360).toFixed(1)),pitchDeg:Number(Math.max(-90,Math.min(90,e.pitchDeg)).toFixed(1)),rollDeg:Number(i(e.rollDeg).toFixed(1))}))}show(e){!this.bodies.some(i=>i.id===e)||e===this.currentId||(this.currentId=e,this.sync())}readingNow(){const e=this.current;return e&&this.host.readingOf(e,this.host.currentTime())}dragTo(e,i){const t=this.readingNow();if(!t)return;const s=this.host.currentTime(),o=Math.PI/180,n=r=>Number(r.toFixed(2));this.editView(r=>{const d=r,a=d.onGround?this.host.groundAlong(e,i,s):void 0;if(d.mode==="world"){const h=Math.cos(t.altitudeDeg*o),c=t.eastM-Math.sin(t.azimuthDeg*o)*h*t.distanceM,m=t.northM-Math.cos(t.azimuthDeg*o)*h*t.distanceM,k=Math.hypot(t.eastM-c,t.northM-m),y=a!==void 0?a*Math.cos(i*o):k;if(d.eastM=n(c+Math.sin(e*o)*y),d.northM=n(m+Math.cos(e*o)*y),!d.onGround){const g=D=>Math.max(-89,Math.min(89,D))*o;d.aboveGroundM=n(Math.max(0,t.aboveGroundM+y*(Math.tan(g(i))-Math.tan(g(t.altitudeDeg)))))}}else d.azimuthDeg=n((e%360+360)%360),d.elevationDeg=n(Math.max(-90,Math.min(90,i))),a!==void 0&&(d.distanceM=n(a))})}scaleDistance(e){const i=this.readingNow();if(!i)return;const t=s=>Number(s.toFixed(2));this.editView(s=>{const o=s;if(o.mode==="world"){const n=Math.PI/180,r=Math.cos(i.altitudeDeg*n),d=i.eastM-Math.sin(i.azimuthDeg*n)*r*i.distanceM,a=i.northM-Math.cos(i.azimuthDeg*n)*r*i.distanceM;o.eastM=t(d+(i.eastM-d)*e),o.northM=t(a+(i.northM-a)*e)}else o.distanceM=t(Math.max(.1,i.distanceM*e))})}deleteKeyframe(){const e=this.current;if(!e)return;const i=this.host.currentTime(),t=e.track.filter(s=>s.t!==i);t.length!==e.track.length&&this.write({...this.interpretation,bodies:this.bodies.map(s=>s===e?{...e,track:t}:s)},!0)}static seconds(e){return`${Math.round(e/100)/10} s`}deleteCurrent(){const e=this.current;e&&(this.currentId=void 0,this.write({...this.interpretation,bodies:this.bodies.filter(i=>i!==e)},!0))}statedModel(e){const i=this.stringOrUndefined(this.input("body-model-url").value),t=this.shownEntry,s=n=>this.stringOrUndefined(this.input(n).value);if(t&&i===t.url&&s("body-model-title")===t.credit.title&&s("body-model-author")===t.credit.author&&s("body-model-license")===t.credit.license&&s("body-model-source")===t.credit.sourceUrl)return{id:t.id};if(i){const n=this.stringOrUndefined(this.input("body-model-title").value),r=this.stringOrUndefined(this.input("body-model-license").value);return{url:i,headingOffsetDeg:e.url!==void 0?e.headingOffsetDeg:void 0,credit:n!==void 0&&r!==void 0?{title:n,license:r,author:this.stringOrUndefined(this.input("body-model-author").value),sourceUrl:this.stringOrUndefined(this.input("body-model-source").value)}:void 0}}return{id:this.stringOrUndefined(this.select("body-model").value)??e.id??"ellipsoid"}}write(e,i=!1){const t=e.bodies.length===0&&e.title===void 0&&e.smoke===void 0;if(this.host.sighting().interpretation=t?void 0:e,this.host.changed(),i){this.sync();return}this.list?.setItems(this.bodies.map(o=>({id:o.id,label:this.labelOf(o)})),this.currentId);const s=this.current;s&&(this.element("body-model-incomplete").hidden=s.model.url===void 0||s.model.credit!==void 0,this.syncModelOptions(s))}labelOf(e){const i=this.host.said().read(e.title);return i?`${i} (${e.id})`:e.id}get interpretation(){return this.host.sighting().interpretation}get bodies(){return this.interpretation?.bodies??[]}get current(){return this.bodies.find(e=>e.id===this.currentId)}stringOrUndefined(e){const i=e.trim();return i===""?void 0:i}list;keyList;element(e){return this.container.querySelector("#"+e)}input(e){return this.element(e)}select(e){return this.element(e)}}export{b as BodyEditor};
|
|
27
|
+
</div>`;const t=this.element("body-list");this.list=new f({header:t,body:this.element("body-fields"),ids:{list:"body-select",remove:"body-delete",add:"body-add"},actions:[{id:"body-look",glyph:"🎯",onClick:()=>{const r=this.current;r&&this.host.lookAt(r)}}],onSelect:r=>{this.currentId=r,this.sync()},onAdd:()=>void this.addBody(),onRemove:()=>this.deleteCurrent()}),this.list.setLabels({list:e.body,remove:e.deleteBody,add:e.addBody,empty:e.none,actions:{"body-look":e.lookAtBody}}),this.input("body-interpretation-title").addEventListener("change",()=>this.updateInterpretationTitle());for(const r of["body-model-url","body-model-title","body-model-author","body-model-license","body-model-source"])this.input(r).addEventListener("change",()=>this.updateCurrent());this.select("body-model").addEventListener("change",()=>{const r=this.select("body-model").value;r!==""&&(this.input("body-model-url").value=""),this.updateCurrent(),this.syncModelOptions(this.current),r!==""&&this.adoptCatalogueSize(r),this.element("body-model-advanced").open=r!==""&&!u.includes(r)});const s=this.element("body-keys");this.keyList=new f({header:s,optional:!0,ids:{list:"body-key",remove:"body-key-delete",add:"body-key-add"},navigation:{scope:this.container,onStep:r=>this.stepKeyframe(r)},onSelect:r=>{r!==""&&this.host.seekTo(Number(r)),this.syncKeyframe(!0)},onAdd:()=>this.editView(()=>{}),onRemove:()=>this.deleteKeyframe()}),this.keyList.setLabels({list:e.keyframes,remove:e.deleteKeyframe,add:e.addKeyframe,none:e.noKeyframeHere,previous:e.previousKeyframe,next:e.nextKeyframe}),this.host.modelPicker().enhance(this.select("body-model"),r=>this.modelSourceOf(r),{current:()=>{const r=this.current?.model;return r?.url===void 0?void 0:{url:r.url,title:r.credit?.title??"",author:r.credit?.author??"",license:r.credit?.license??"",source:r.credit?.sourceUrl??""}},apply:r=>{this.input("body-model-url").value=r.url,this.input("body-model-title").value=r.title,this.input("body-model-author").value=r.author,this.input("body-model-license").value=r.license,this.input("body-model-source").value=r.source,this.shownEntry=void 0,this.select("body-model").value="",this.updateCurrent(),this.syncModelOptions(this.current)}});const o=this.select("body-model").nextElementSibling;o&&(o.disabled=!0,o.title=e.modelFixed),this.input("body-model-url").readOnly=!0;const n={said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()};this.bodyForm=new v(this.element("body-parameters"),this.language,"body.",n),this.bodyForm.show(l.BODY,new M(()=>this.current,r=>this.editBody(r),()=>({ids:this.bodies.map(r=>r.id),shapes:this.host.shapes().map(r=>({value:r.id,label:r.label}))})),()=>{}),this.keyForm=new v(this.element("body-key-parameters"),this.language,"bodyKey."),this.keyForm.show(l.KEYFRAME,new M(()=>this.keyframeView(),(r,d)=>this.editView(r,p.APPEARANCE_KEYS.includes(d.key)),()=>this.keyframeContext()),()=>{}),this.sync()}async syncModelOptions(e){const i=++this.catalogueToken,t=await this.host.modelProvider().entries().catch(()=>[]);if(i!==this.catalogueToken)return;const s=this.messages,o=this.select("body-model"),n=e.model.url===void 0?e.model.id:void 0,r=n===void 0||u.includes(n)||t.some(a=>a.id===n),d=[s.primitives,s.catalogue,t.map(a=>`${a.id}:${a.name}`).join(),e.model.url!==void 0,r?"":n].join("|");if(o.dataset.signature!==d){o.dataset.signature=d;const a=document.createElement("optgroup");a.label=s.primitives,a.append(...u.map(c=>new Option(s.primitive[c],c)));const h=document.createElement("optgroup");h.label=s.catalogue,h.append(...t.map(c=>new Option(c.name,c.id))),o.replaceChildren(a,h),e.model.url!==void 0&&o.prepend(new Option(s.modelAdvanced,"")),r||o.append(new Option(n,n))}o.value=n??"",this.showCatalogueModel(e.model.url===void 0?t.find(a=>a.id===e.model.id):void 0)}showCatalogueModel(e){const i=this.current;if(!i||i.model.url!==void 0){this.shownEntry=void 0,this.element("body-model-catalogue").hidden=!0;return}this.shownEntry=e;const t=this.container.getRootNode().activeElement,s=[["body-model-url",e?.url],["body-model-title",e?.credit.title],["body-model-author",e?.credit.author],["body-model-license",e?.credit.license],["body-model-source",e?.credit.sourceUrl]];for(const[o,n]of s)this.input(o)!==t&&(this.input(o).value=n??"");this.element("body-model-catalogue").hidden=e===void 0,this.element("body-model-incomplete").hidden=!0}updateInterpretationTitle(){const e=this.interpretation??{bodies:[]},i=this.host.said().write(e.title,this.input("body-interpretation-title").value,this.host.writingLanguage());this.write({...e,title:i})}updateCurrent(){const e=this.current;e&&this.write({...this.interpretation,bodies:this.bodies.map(i=>i===e?{...e,model:this.statedModel(e.model)}:i)})}editBody(e){const i=this.current;if(!i)return;const t=structuredClone(i);e(t),this.currentId=t.id,this.write({...this.interpretation,bodies:this.bodies.map(s=>s===i?t:s)})}editView(e,i=!1){const t=this.current,s=this.keyframeView();if(!t||!s)return;const o=this.host.currentTime();e(s);const n=b.keyframeOf(s,o,t.track.find(d=>d.t===o),i),r=[...t.track.filter(d=>d.t!==o),n].sort((d,a)=>d.t-a.t);this.write({...this.interpretation,bodies:this.bodies.map(d=>d===t?{...t,track:r}:d)}),this.syncKeyframe()}async addBody(){if(!this.host.newBodyStart())return;const e=this.messages,i=await this.host.modelProvider().entries().catch(()=>[]),t=document.createElement("select"),s=document.createElement("optgroup");s.label=e.primitives,s.append(...u.map(n=>new Option(e.primitive[n],n)));const o=document.createElement("optgroup");o.label=e.catalogue,o.append(...i.map(n=>new Option(n.name,n.id))),t.append(s,o),this.host.modelPicker().chooseFrom(t,n=>this.modelSourceOf(n),n=>{this.createBody({id:n}),u.includes(n)||this.adoptCatalogueSize(n)},{current:()=>{},apply:n=>this.createBody({url:n.url,credit:n.title!==""&&n.license!==""?{title:n.title,license:n.license,author:n.author||void 0,sourceUrl:n.source||void 0}:void 0})})}createBody(e){const i=this.host.newBodyStart();if(!i)return;const t=new Set(this.bodies.map(r=>r.id));let s=t.size+1;for(;t.has(`body-${s}`);)s++;const o={id:`body-${s}`,explains:i.sourceId!==void 0?[i.sourceId]:void 0,model:e,track:[i.keyframe]};this.currentId=o.id;const n=this.interpretation??{bodies:[]};this.write({...n,bodies:[...this.bodies,o]},!0)}modelSourceOf(e){return u.includes(e)?Promise.resolve({shape:e}):this.host.modelProvider().entry(e).then(i=>i&&{url:i.url,headingOffsetDeg:i.headingOffsetDeg})}async adoptCatalogueSize(e){const t=(await this.host.modelProvider().entry(e).catch(()=>{}))?.sizeM,s=this.current;if(!t||!s||s.model.id!==e)return;if(!s.track.some(n=>n.sizeM)&&s.track.length>0){const[n,...r]=[...s.track].sort((h,c)=>h.t-c.t),d={widthM:t.widthM??1,lengthM:t.lengthM??t.widthM??1,heightM:t.heightM??1},a=[{...n,sizeM:d},...r];this.write({...this.interpretation,bodies:this.bodies.map(h=>h===s?{...s,track:a}:h)},!0);return}const o=s.track.map(n=>{const r=n.sizeM?.widthM,d=t.widthM??r;if(!n.sizeM||r===void 0||d===void 0||r<=0)return n;const a=d/r,h={widthM:t.widthM??n.sizeM.widthM*a,lengthM:t.lengthM??n.sizeM.lengthM*a,heightM:t.heightM??n.sizeM.heightM*a};return n.distanceM!==void 0&&n.azimuthDeg!==void 0?{...n,sizeM:h,distanceM:Number((n.distanceM*a).toFixed(1))}:{...n,sizeM:h}});this.write({...this.interpretation,bodies:this.bodies.map(n=>n===s?{...s,track:o}:n)},!0)}get currentBodyId(){return this.current?.id}resize(e){const i=t=>Number(Math.max(.01,t).toFixed(2));this.editView(t=>Object.assign(t,{widthM:i(e.widthM),lengthM:i(e.lengthM),heightM:i(e.heightM)}))}turnTo(e){const i=t=>((t+180)%360+360)%360-180;this.editView(t=>Object.assign(t,{headingDeg:Number(((e.headingDeg%360+360)%360).toFixed(1)),pitchDeg:Number(Math.max(-90,Math.min(90,e.pitchDeg)).toFixed(1)),rollDeg:Number(i(e.rollDeg).toFixed(1))}))}show(e){!this.bodies.some(i=>i.id===e)||e===this.currentId||(this.currentId=e,this.sync())}readingNow(){const e=this.current;return e&&this.host.readingOf(e,this.host.currentTime())}dragTo(e,i){const t=this.readingNow();if(!t)return;const s=this.host.currentTime(),o=Math.PI/180,n=r=>Number(r.toFixed(2));this.editView(r=>{const d=r,a=d.onGround?this.host.groundAlong(e,i,s):void 0;if(d.mode==="world"){const h=Math.cos(t.altitudeDeg*o),c=t.eastM-Math.sin(t.azimuthDeg*o)*h*t.distanceM,m=t.northM-Math.cos(t.azimuthDeg*o)*h*t.distanceM,k=Math.hypot(t.eastM-c,t.northM-m),y=a!==void 0?a*Math.cos(i*o):k;if(d.eastM=n(c+Math.sin(e*o)*y),d.northM=n(m+Math.cos(e*o)*y),!d.onGround){const g=D=>Math.max(-89,Math.min(89,D))*o;d.aboveGroundM=n(Math.max(0,t.aboveGroundM+y*(Math.tan(g(i))-Math.tan(g(t.altitudeDeg)))))}}else d.azimuthDeg=n((e%360+360)%360),d.elevationDeg=n(Math.max(-90,Math.min(90,i))),a!==void 0&&(d.distanceM=n(a))})}scaleDistance(e){const i=this.readingNow();if(!i)return;const t=s=>Number(s.toFixed(2));this.editView(s=>{const o=s;if(o.mode==="world"){const n=Math.PI/180,r=Math.cos(i.altitudeDeg*n),d=i.eastM-Math.sin(i.azimuthDeg*n)*r*i.distanceM,a=i.northM-Math.cos(i.azimuthDeg*n)*r*i.distanceM;o.eastM=t(d+(i.eastM-d)*e),o.northM=t(a+(i.northM-a)*e)}else o.distanceM=t(Math.max(.1,i.distanceM*e))})}deleteKeyframe(){const e=this.current;if(!e)return;const i=this.host.currentTime(),t=e.track.filter(s=>s.t!==i);t.length!==e.track.length&&this.write({...this.interpretation,bodies:this.bodies.map(s=>s===e?{...e,track:t}:s)},!0)}static seconds(e){return`${Math.round(e/100)/10} s`}deleteCurrent(){const e=this.current;e&&(this.currentId=void 0,this.write({...this.interpretation,bodies:this.bodies.filter(i=>i!==e)},!0))}statedModel(e){const i=this.stringOrUndefined(this.input("body-model-url").value),t=this.shownEntry,s=n=>this.stringOrUndefined(this.input(n).value);if(t&&i===t.url&&s("body-model-title")===t.credit.title&&s("body-model-author")===t.credit.author&&s("body-model-license")===t.credit.license&&s("body-model-source")===t.credit.sourceUrl)return{id:t.id};if(i){const n=this.stringOrUndefined(this.input("body-model-title").value),r=this.stringOrUndefined(this.input("body-model-license").value);return{url:i,headingOffsetDeg:e.url!==void 0?e.headingOffsetDeg:void 0,credit:n!==void 0&&r!==void 0?{title:n,license:r,author:this.stringOrUndefined(this.input("body-model-author").value),sourceUrl:this.stringOrUndefined(this.input("body-model-source").value)}:void 0}}return{id:this.stringOrUndefined(this.select("body-model").value)??e.id??"ellipsoid"}}write(e,i=!1){const t=e.bodies.length===0&&e.title===void 0&&e.smoke===void 0&&e.flares===void 0&&e.lanterns===void 0;if(this.host.sighting().interpretation=t?void 0:e,this.host.changed(),i){this.sync();return}this.list?.setItems(this.bodies.map(o=>({id:o.id,label:this.labelOf(o)})),this.currentId);const s=this.current;s&&(this.element("body-model-incomplete").hidden=s.model.url===void 0||s.model.credit!==void 0,this.syncModelOptions(s))}labelOf(e){const i=this.host.said().read(e.title);return i?`${i} (${e.id})`:e.id}get interpretation(){return this.host.sighting().interpretation}get bodies(){return this.interpretation?.bodies??[]}get current(){return this.bodies.find(e=>e.id===this.currentId)}stringOrUndefined(e){const i=e.trim();return i===""?void 0:i}list;keyList;element(e){return this.container.querySelector("#"+e)}input(e){return this.element(e)}select(e){return this.element(e)}}export{p as BodyEditor};
|
package/dist-embed-sighting-editor/{ContrailSystem-CnMn7-P3.js → ContrailSystem-CXR_fe3m.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a6 as F,ar as m,at as I,a9 as X,aM as D,aN as L}from"./rr0-sighting-editor.mjs";import{C as x}from"./ContrailGrowth-DwHS8If9.js";class h{static MAX_SEGMENTS=8e3;static MIN_PIXELS=2;static UNRESOLVED_CONTRAST=.5;static STATIONS=[0,.5,1,1.5,2.25];static VERTICES_PER_SEGMENT=12*(h.STATIONS.length-1);static ICE_ASYMMETRY=.75;static phase(t){const s=h.ICE_ASYMMETRY;return(1-s*s)/(1+s*s-2*s*t)**1.5}object;group=new F;trails=[];positions=new Float32Array(h.MAX_SEGMENTS*h.VERTICES_PER_SEGMENT*3);colors=new Float32Array(h.MAX_SEGMENTS*h.VERTICES_PER_SEGMENT*4);segments=0;constructor(){const t=new m;t.setAttribute("position",new I(this.positions,3)),t.setAttribute("color",new I(this.colors,4)),t.setDrawRange(0,0),this.object=new X(t,new D({vertexColors:!0,transparent:!0,depthWrite:!1,side:L})),this.object.frustumCulled=!1,this.object.name="contrails",this.group.name="contrails",this.group.add(this.object)}get segmentCount(){return this.segments}set(t){this.trails=t}update(t,s,c){let p=0;this.segments=0;for(const o of this.trails){const u=this.samplesOf(o,t,s),i=c(o.id);for(let a=0;a+1<u.length;a++){const n=u[a],M=u[a+1];if(!n.forms||!M.forms)continue;if(this.segments>=h.MAX_SEGMENTS)break;const d=this.pushSegment(p,n,M,o.spanM,i,s);d>p&&this.segments++,p=d}}const y=this.object.geometry;y.setDrawRange(0,p);for(const[o,u]of[["position",3],["color",4]]){const i=y.getAttribute(o);i.clearUpdateRanges(),p>0&&i.addUpdateRange(0,p*u),i.needsUpdate=!0}}samplesOf(t,s,c){const p=s-x.FORMATION_S*1e3,y=[],o=(n,M,d,T,l,N)=>({x:M+n.driftEastMs*l+c.origin.x,y:T,z:-(d+n.driftNorthMs*l)+c.origin.z,age:l,forms:N,point:n});let u=-1;t.points.forEach((n,M)=>{n.tMs>p||(u=M,y.push(o(n,n.eastM,n.northM,n.upM,(s-n.tMs)/1e3,n.forms)))});const i=t.points[u],a=t.points[u+1];if(i&&a){const n=(p-i.tMs)/(a.tMs-i.tMs),M=(d,T)=>d+(T-d)*n;y.push(o(i,M(i.eastM,a.eastM),M(i.northM,a.northM),M(i.upM,a.upM),x.FORMATION_S,i.forms&&a.forms))}return y}pushSegment(t,s,c,p,y,o){const u=e=>({persistent:e.point.persistent,lifetimeS:e.point.lifetimeS,spanM:p,shearPerS:e.point.shearPerS,saturatedForS:e.point.saturatedForS}),i=x.opacity(s.age,u(s)),a=x.opacity(c.age,u(c));if(i<=0&&a<=0)return t;const n={x:c.x-s.x,y:c.y-s.y,z:c.z-s.z};if(Math.hypot(n.x,n.y,n.z)<1e-6)return t;const M={x:(s.x+c.x)/2-o.eye.x,y:(s.y+c.y)/2-o.eye.y,z:(s.z+c.z)/2-o.eye.z},d=this.normalise(this.cross(n,M)),T=e=>{if(!o.sun)return y;const r={x:e.x-o.eye.x,y:e.y-o.eye.y,z:e.z-o.eye.z},E=h.phase((o.sun.x*r.x+o.sun.y*r.y+o.sun.z*r.z)/(Math.hypot(r.x,r.y,r.z)||1));return[y[0]*E,y[1]*E,y[2]*E]},l=(e,r)=>{const E=Math.hypot(e.x-o.eye.x,e.y-o.eye.y,e.z-o.eye.z),A=x.widthM(p,e.age,e.point.shearPerS),g=Math.max(A,h.MIN_PIXELS*o.pixelRad*E),z=r*(A/g)**h.UNRESOLVED_CONTRAST,S=x.profileExponent(e.age),G=h.STATIONS.map((j,P)=>P===h.STATIONS.length-1?0:z*Math.exp(-Math.LN2*j**S));return{half:g/2,profile:G,scattered:T(e)}},N=[{sample:s,...l(s,i)},{sample:c,...l(c,a)}],w=h.STATIONS.length-1,f=(e,r,E)=>{const A=h.STATIONS[r],g=e.half*A*E,z=t*3;this.positions[z]=e.sample.x+d.x*g,this.positions[z+1]=e.sample.y+d.y*g,this.positions[z+2]=e.sample.z+d.z*g;const S=t*4;this.colors[S]=e.scattered[0],this.colors[S+1]=e.scattered[1],this.colors[S+2]=e.scattered[2],this.colors[S+3]=e.profile[r],t++},[R,O]=N;for(const e of[-1,1])for(let r=0;r<w;r++)f(R,r+1,e),f(R,r,e),f(O,r+1,e),f(R,r,e),f(O,r,e),f(O,r+1,e);return t}cross(t,s){return{x:t.y*s.z-t.z*s.y,y:t.z*s.x-t.x*s.z,z:t.x*s.y-t.y*s.x}}normalise(t){const s=Math.hypot(t.x,t.y,t.z)||1;return{x:t.x/s,y:t.y/s,z:t.z/s}}dispose(){this.object.geometry.dispose(),this.object.material.dispose(),this.group.removeFromParent()}}export{h as ContrailSystem};
|
package/dist-embed-sighting-editor/{CoverageAssessor-ZPfl-pIr.js → CoverageAssessor-B8gBscye.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ai as m}from"./rr0-sighting-editor.mjs";const o=[{id:"when",paths:["time.year","time.month","time.day","time.hour","time.minute","time.raw"]},{id:"where",paths:["place.*.lat","place.*.lng","observerTrack.keyframes.*.pose.lat","observerTrack.keyframes.*.pose.lng"]},{id:"facing",paths:["observerTrack.keyframes.*.pose.headingDeg"]},{id:"apparent-size",paths:["timeline.keyframes.*.shapes.*.shape.angular.widthDeg","timeline.keyframes.*.shapes.*.shape.angular.heightDeg"]},{id:"sky-position",paths:["timeline.keyframes.*.shapes.*.shape.aim.azimuthDeg","timeline.keyframes.*.shapes.*.shape.aim.altitudeDeg"]},{id:"how-long",paths:["durationSeconds","endTime.hour","endTime.minute","endTime.raw"]},{id:"appearance",paths:["timeline.keyframes.*.shapes.*.shape.kind","timeline.keyframes.*.shapes.*.shape.title","timeline.keyframes.*.shapes.*.shape.color","timeline.keyframes.*.shapes.*.shape.brightness"]},{id:"movement",paths:["timeline.keyframes.1.t","observerTrack.keyframes.1.t"]},{id:"sound",paths:["soundTrack.keyframes.*.sound.kind"]},{id:"conditions",paths:["weatherTrack.keyframes.*.weather.*","weather.*"]}],d=["assumed","derived","stated","measured"];class p{about="observer";async assess(t){const r=m(t),s=o.map(e=>p.answer(e,r,t));return{score:s.filter(e=>e.basis==="stated").length/s.length,criteria:s}}static answer(t,r,s){const e=t.paths.flatMap(a=>p.resolve(a,r));if(e.length===0)return{id:t.id,paths:[]};const n=e.map(a=>s.provenance.at(a)?.basis??"stated");return{id:t.id,basis:d.find(a=>n.includes(a)),paths:e}}static resolve(t,r){let s=[{path:[],value:r}];for(const e of t.split("."))s=s.flatMap(({path:n,value:a})=>{if(typeof a!="object"||a===null)return[];if(e!=="*"){const i=a[e];return i===void 0?[]:[{path:[...n,e],value:i}]}return Object.entries(a).filter(([,i])=>i!==void 0).map(([i,h])=>({path:[...n,i],value:h}))});return s.filter(({value:e})=>e!==null&&e!==""&&!(Array.isArray(e)&&e.length===0)).map(({path:e})=>e.join("."))}}export{p as CoverageAssessor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aU as Le,aV as Q,aW as he,aX as Me,aY as v,aZ as de,aj as y,am as pe,ak as F,a_ as w,aP as U,aM as be,a$ as Se,ad as ye,o as K,b0 as we,V as C,Q as me,b1 as Ne,m as ge,b2 as Ie,b3 as Oe,aq as V,b4 as Ce,b5 as Te,b6 as Fe,b7 as Pe,b8 as He,aQ as J,b9 as Re,ba as Z,bb as ke,bc as De,aE as Ge,bd as X,be as ve,a8 as Ee,aK as Ue,aJ as G,bf as Ke,ao as Be,bg as je,a6 as Ve,bh as Xe,bi as ze,bj as qe,aF as We,a3 as z,ae as Ye,aC as Qe,bk as Je,bl as Ze,bm as $e,bn as en,bo as nn,bp as tn,bq as xe,au as sn,aO as ne,br as te,bs as se,bt as ie,bu as re,bv as rn,bw as on,a9 as an,aa 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};
|
|
1
|
+
import{aX as Le,aY as Q,aZ as he,a_ as Me,a$ as v,b0 as de,am as y,ap as pe,an as F,b1 as w,aS as U,aP as be,b2 as Se,ag as ye,o as K,b3 as we,V as C,Q as me,b4 as Ne,m as ge,b5 as Ie,b6 as Oe,at as V,b7 as Ce,b8 as Te,b9 as Fe,ba as Pe,bb as He,aT as J,bc as Re,bd as Z,be as ke,bf as De,aH as Ge,bg as X,bh as ve,ab as Ee,aN as Ue,aM as G,bi as Ke,ar as Be,bj as je,a9 as Ve,bk as Xe,bl as ze,bm as qe,aI as We,a6 as z,ah as Ye,aF as Qe,bn as Je,bo as Ze,bp as $e,bq as en,br as nn,bs as tn,bt as xe,ax as sn,aR as ne,bu as te,bv as se,bw as ie,bx as re,by as rn,bz as on,ac as an,ad 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/{HeadlightSystem-CoBP2hn0.js → HeadlightSystem-CPbn_3dw.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aP as b,a9 as g,V as P,aQ as m,ar as C,at as E,az as L,an as x,aN as R,aO as I}from"./rr0-sighting-editor.mjs";class i{constructor(e){this.scene=e}static REAL_BEAMS=4;static LAMPS=2;static DISTANCE_M=500;static AIR_LENGTH_M=90;static CLEAR_AIR_SCATTER_PER_M=2e-4;static SHADOW_MAP_PX=1024;beams=new Map;static airGeometry;has(e){return this.beams.has(e)}get size(){return this.beams.size}lamps(e){return this.beams.get(e)?.lamps??[]}airMeshes(e){return this.beams.get(e)?.air??[]}add(e){if(this.beams.has(e))return!0;if(this.beams.size>=i.REAL_BEAMS)return!1;const t=[],r=[];for(let n=0;n<i.LAMPS;n++){const a=new b(16777215,0,i.DISTANCE_M,Math.PI/8,.5,2);a.castShadow=e==="observer",a.shadow.mapSize.set(i.SHADOW_MAP_PX,i.SHADOW_MAP_PX),a.shadow.camera.near=.4,a.shadow.camera.far=110,a.shadow.bias=-4e-4,a.shadow.normalBias=.04,a.shadow.radius=2,this.scene.add(a),this.scene.add(a.target),t.push(a);const o=new g(i.airCone(),i.airMaterial());o.visible=!1,o.frustumCulled=!1,o.renderOrder=8,o.castShadow=!1,o.receiveShadow=!1,o.name="headlight air",this.scene.add(o),r.push(o)}return this.beams.set(e,{lamps:t,air:r}),!0}remove(e){const t=this.beams.get(e);if(t){for(const r of t.lamps)r.removeFromParent(),r.target.removeFromParent(),r.dispose();for(const r of t.air)r.removeFromParent(),r.material.dispose();this.beams.delete(e)}}clear(e){for(const t of[...this.beams.keys()])e&&t==="observer"||this.remove(t)}dispose(){this.clear(!1),i.airGeometry?.dispose(),i.airGeometry=void 0}aim(e,t,r,n,a,o,u){const c=this.beams.get(e),w=Math.max(u,i.CLEAR_AIR_SCATTER_PER_M);if(!c)return;const l=m.BEAMS[t],v=new P(-n.z,0,n.x),A=e==="observer"&&l!==void 0;c.lamps.forEach((s,d)=>{if(!l){s.intensity=0,c.air[d].visible=!1,s.shadow.autoUpdate=!1;return}const f=d===0?-1:1,h=l.pitchDeg*Math.PI/180,p=l.candela*m.DISPLAY_GAIN*o/c.lamps.length;s.color.set(l.color),s.intensity=p,s.angle=l.halfAngleDeg*Math.PI/180,s.penumbra=l.penumbra,A?(s.shadow.autoUpdate||(s.shadow.needsUpdate=!0),s.shadow.autoUpdate=!0):s.shadow.autoUpdate=!1,s.position.copy(r).addScaledVector(v,f*a);const M=n.clone().addScaledVector(v,-f*Math.tan(m.TOE_IN_DEG*Math.PI/180)).normalize();s.target.position.set(s.position.x+M.x*Math.cos(h)*50,s.position.y-Math.sin(h)*50,s.position.z+M.z*Math.cos(h)*50),s.target.updateMatrixWorld(),this.aimAir(c.air[d],s,l.color,p,w)})}aimAir(e,t,r,n,a){if(e.visible=a*n>1e-4,!e.visible)return;const o=i.AIR_LENGTH_M,u=o*Math.tan(t.angle);e.position.copy(t.position),e.scale.set(u,u,o),e.lookAt(t.target.position),e.updateMatrixWorld();const c=e.material.uniforms;c.uColor.value.set(r),c.uCandela.value=n,c.uScatter.value=a,c.uLength.value=o,c.uRadius.value=u}static airCone(){if(i.airGeometry)return i.airGeometry;const e=24,t=new Float32Array((e+1)*3);for(let a=0;a<e;a++){const o=a/e*Math.PI*2;t.set([Math.cos(o),Math.sin(o),1],(a+1)*3)}const r=[];for(let a=0;a<e;a++)r.push(0,1+a,1+(a+1)%e);const n=new C;return n.setAttribute("position",new E(t,3)),n.setIndex(r),i.airGeometry=n,n}static airMaterial(){return new L({transparent:!0,depthWrite:!1,depthTest:!0,blending:I,side:R,uniforms:{uColor:{value:new x(1,1,1)},uCandela:{value:0},uScatter:{value:0},uLength:{value:90},uRadius:{value:20}},vertexShader:`
|
|
2
2
|
varying vec3 vLocal;
|
|
3
3
|
varying vec3 vNormalView;
|
|
4
4
|
varying vec3 vViewDir;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aj as r,ak as c,al as l}from"./rr0-sighting-editor.mjs";const v=-6,p=150;class o{about="temporal";async assess(e){const t=o.daylight(e),i=e.decor.map((s,n)=>({object:s,index:n})).filter(({object:s})=>s.kind==="entity"),a=o.nearest(e),d=a!==void 0&&a<=p;return{verdict:i.length>0?"ce3":d?"ce1":t===void 0?void 0:t?"dd":"nl",criteria:[{id:"entities",basis:i.length>0?"stated":void 0,paths:i.map(({index:s})=>`decor.${s}`)},{id:"traces",paths:[],unsupported:!0},{id:"proximity",basis:a===void 0?void 0:"derived",paths:a===void 0?[]:["timeline","observerTrack"]},{id:"radar",paths:[],unsupported:!0},{id:"daylight",basis:t===void 0?void 0:"derived",paths:t===void 0?[]:["time","place"]}]}}static nearest(e){const t=e.timeline.sourceIds.map(i=>r.of(e,i)?.nearestM).filter(i=>i!==void 0);return t.length>0?Math.min(...t):void 0}static daylight(e){const t=e.event.place?.[0],i=e.event.time;if(!t||!i)return;const a=c(i,t.lng,e.event.utcOffsetHours);if(a)return l("Sun",a,{lat:t.lat,lng:t.lng,elevationM:0}).altitudeDeg>v}}export{o as HynekAssessor};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SightingFileEditor-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SightingFileEditor-IEZGobI0.js","./index-DSNA74v6.js","./sightingSchema-BpEpb5Vc.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{S as L,a as T,H as j,s as P,U as H,l as I,I as W,P as z,b as y,W as O,r as J,c as D,E as C,A as U,d as E,M as q,_ as A,e as V}from"./rr0-sighting-editor.mjs";import{interviewMessages_en as S}from"./InterviewMessages_en-CRvWVmlL.js";import{InterviewMedia as N}from"./InterviewMedia-CvAxC62V.js";import{InterviewFile as g}from"./interviewJson-DXD8FSBX.js";const F="rr0-interview",G=`
|
|
3
3
|
rr0-interview { display: block; --rr0-interview-line: color-mix(in srgb, currentColor 35%, transparent); }
|
|
4
4
|
rr0-interview [hidden] { display: none !important; }
|
|
@@ -226,4 +226,4 @@ rr0-interview .turn .ref svg { width: 1.1em; height: 1.1em; }
|
|
|
226
226
|
</section>
|
|
227
227
|
</div>
|
|
228
228
|
`;class m extends HTMLElement{shadow=this.attachShadow({mode:"open"});get importInput(){return this.shadow.getElementById("import")}messages=S;said=new L(["en"]);language="en";localeToken=0;current;options=[];group="summary";base;text;fileEditor;fileEditorLoading;shownFor;player;drawn;takenOut=new Map;constructor(){super(),this.shadow.innerHTML=K,customElements.upgrade(this.shadow),this.importInput.build();for(const e of["title","time","by","url","summary","witness","medium"])this.shadow.getElementById(e).addEventListener(e==="witness"||e==="medium"?"change":"input",()=>this.write(e));for(const e of this.shadow.querySelectorAll("#tabs .group-tab"))e.addEventListener("click",()=>this.openGroup(m.GROUPS[e.getAttribute("aria-controls")]??"summary"));this.shadow.getElementById("url").addEventListener("change",()=>{this.shownFor=void 0,this.text===void 0&&this.group==="file"&&this.showTranscript()}),this.importInput.addEventListener("filepick",e=>{const t=e.detail;t.file?this.importFromFile(t.file):this.importFromUrl(t.url)}),this.shadow.getElementById("save").addEventListener("click",()=>this.save()),this.player=new B(this.shadow.getElementById("player"),{timeChanged:e=>this.markCurrentTurn(e),recordingsChanged:e=>void this.editTranscript(t=>{e.length===0?delete t.recordings:t.recordings=e})},this.messages),this.shadow.getElementById("redact-selection").addEventListener("click",()=>void this.redactSelection()),this.shadow.getElementById("exchanges").addEventListener("click",e=>{const t=e.target.closest(".bar[data-restorable]");t&&this.restore(t.dataset.restorable)})}static GROUPS={"group-summary":"summary","group-exchanges":"exchanges","group-transcript":"file"};static get observedAttributes(){return["readonly"]}attributeChangedCallback(){this.applyReadonly()}connectedCallback(){this.loadLocale()}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||this.releaseFileEditor()})}releaseFileEditor(){this.fileEditor&&(this.text=this.fileEditor.text,this.fileEditor.destroy(),this.fileEditor=void 0,this.fileEditorLoading=void 0,this.shownFor=void 0)}get event(){return this.current}set event(e){e!==this.current&&(this.shownFor=void 0),this.current=e,this.render(),this.takenOut.clear(),this.group==="file"&&this.showTranscript(),queueMicrotask(()=>{this.current===e&&this.showExchanges()})}set witnesses(e){this.options=e,this.render()}set documentUrl(e){this.base=e}get transcriptText(){return this.text}set transcriptText(e){this.text=e,this.shownFor=void 0}field(e){return this.shadow.getElementById(e)}async loadLocale(){const e=++this.localeToken,t=j.preferencesFor(this),r=P(t,H),s=r==="en"?S:await I(r);e===this.localeToken&&(this.language=r,this.said=new L(t),this.messages=s,this.render())}applyReadonly(){const e=this.hasAttribute("readonly");for(const t of["title","time","by","url","summary"])this.field(t).readOnly=e;for(const t of this.shadow.querySelectorAll("#witness input"))t.disabled=e;this.field("medium").disabled=e,this.importInput.disabled=e}static byText(e){return(e??[]).map(t=>"people"in t?t.people:"org"in t?t.org:t.title??"").filter(t=>t!=="").join(", ")}render(){const e=this.messages,t=(o,d)=>{this.shadow.getElementById(o).textContent=d};t("label-summary-group",e.summaryTab),t("label-file-group",e.fileTab),t("label-exchanges-group",e.exchangesTab),t("label-title",e.title),t("label-witness",e.witness),t("label-medium",e.medium),t("label-time",e.time),t("label-by",e.by),t("label-summary",e.summary),t("label-url",e.transcript),t("label-import-file",e.importFile),t("redact-selection",e.redactSelection),this.player?.setMessages(e),this.importInput.messages=e,t("save",e.saveButton),this.field("url").title=e.transcriptHint,this.field("by").title=e.byHint;const r=this.current,s=this.shadow.activeElement,i=(o,d)=>{this.field(o)!==s&&(this.field(o).value=d)};i("title",this.said.read(r?.title)??""),i("time",r?.time??""),i("by",m.byText(r?.by)),i("url",r?.url??""),i("summary",this.said.read(r?.summary)??"");const a=[r?.interviewOf].flat().filter(o=>typeof o=="string"),n=this.shadow.getElementById("witness"),l=[...this.options,...a.filter(o=>!this.options.some(d=>d.id===o)).map(o=>({id:o,label:o}))];n.replaceChildren(n.querySelector("legend"),...l.map(o=>{const d=document.createElement("label"),h=document.createElement("input");return h.type="checkbox",h.value=o.id,h.checked=a.includes(o.id),d.append(h,o.label),d}));const c=this.shadow.getElementById("medium");if(c.replaceChildren(...N.ALL.map(o=>new Option(N.label(o,this.language),o))),r?.medium!==void 0&&!N.ALL.includes(r.medium)&&c.append(new Option(String(r.medium),String(r.medium))),r?.medium===void 0){const o=new Option(e.witnessNone,"");o.disabled=!0,o.hidden=!0,c.prepend(o)}c.value=r?.medium??"",this.applyReadonly()}write(e){const t=this.current;if(!t)return;const r=e==="witness"?"":this.field(e).value;switch(e){case"title":{const s=this.said.write(t.title,r,this.language);s===void 0?delete t.title:t.title=s;break}case"summary":{const s=this.said.write(t.summary,r,this.language);s===void 0?delete t.summary:t.summary=s;break}case"time":r.trim()===""?delete t.time:t.time=r.trim();break;case"url":r.trim()===""?delete t.url:t.url=r.trim();break;case"by":{const s=r.split(",").map(i=>i.trim()).filter(i=>i!=="");s.length===0?delete t.by:t.by=s.map(i=>({people:i}));break}case"witness":{const s=[...this.shadow.querySelectorAll("#witness input:checked")].map(i=>i.value);if(s.length===0){this.render();return}t.interviewOf=s.length===1?s[0]:s;break}case"medium":r===""?delete t.medium:t.medium=r;break}this.dispatchEvent(new CustomEvent(E,{bubbles:!0,composed:!0,detail:{field:e,event:t}})),e==="medium"&&this.render(),e!=="url"&&this.syncFileFromEvent()}openGroup(e){this.group=e;const t={summary:"group-summary",exchanges:"group-exchanges",file:"group-transcript"};for(const r of this.shadow.querySelectorAll("#tabs .group-tab"))r.setAttribute("aria-expanded",String(r.getAttribute("aria-controls")===t[e]));for(const[r,s]of Object.entries(t))this.shadow.getElementById(s).hidden=r!==e;e==="file"&&this.showTranscript(),e==="exchanges"&&this.showExchanges()}exchangesToken=0;async transcriptJson(e){try{const t=this.fileEditor?.text??this.text;if(t!==void 0)return g.read(JSON.parse(t));const r=this.transcriptUrl(e);if(r!==void 0)return g.read(await T.json(r))}catch{}}async showExchanges(){const e=this.current;if(!e)return;const t=++this.exchangesToken,r=await this.transcriptJson(e);t!==this.exchangesToken||this.current!==e||this.drawExchanges(r)}drawExchanges(e){const t=this.shadow.getElementById("exchanges");t.documentUrl=this.current?this.transcriptUrl(this.current):void 0,t.interview=e,this.drawn=e,this.player.show(e,this.current?this.transcriptUrl(this.current):void 0),this.renderReview(e),this.decorateExchanges(e)}async editTranscript(e){const t=this.current;if(!t||this.hasAttribute("readonly"))return;const r=await this.transcriptJson(t)??JSON.parse(this.template(t));Array.isArray(r.segments)||(r.segments=[]),e(r);const s=m.pretty(m.withEventFields(r,t));this.fileEditor?.replaceText(s,!1),this.onEdited(s)}get redactReason(){return this.said.write(void 0,this.messages.redactReason,this.language)??this.messages.redactReason}speakerLabel(e,t){const r=g.speakerName(e,t),s=e.speakers?.[t]?.role;return r===s&&s in this.messages.roles?this.messages.roles[s]:r}renderReview(e){const t=this.shadow.getElementById("review"),r=Object.keys(e?.speakers??{});if(t.hidden=!e||r.length===0,!e||r.length===0)return;const s=l=>["approved","covered"].includes(e.proofreading?.[l]?.status??""),i=r.filter(l=>!s(l)),a=document.createElement("span");a.textContent=i.length===0?this.messages.proofreadAll:this.messages.proofreadPending.replace("{names}",i.map(l=>this.speakerLabel(e,l)).join(", ")),t.toggleAttribute("data-done",i.length===0);const n=document.createElement("span");n.className="review-boxes";for(const l of r){const c=document.createElement("label"),o=document.createElement("input");o.type="checkbox",o.checked=s(l),o.disabled=this.hasAttribute("readonly"),o.addEventListener("change",()=>void this.editTranscript(d=>{d.proofreading??={},o.checked?d.proofreading[l]={status:"approved",date:new Date().toISOString().slice(0,10)}:d.proofreading[l]={status:"pending"}})),c.append(o,this.messages.reviewedBy.replace("{name}",this.speakerLabel(e,l))),n.append(c)}t.replaceChildren(a,n)}momentsOf(e,t){const r=e.speakers?.[t]?.of??g.sightingsOf(e)[0];return this.options.find(s=>s.id===r)?.moments??this.options.flatMap(s=>s.moments??[])}decorateExchanges(e){if(!e)return;const t=this.messages,r=this.hasAttribute("readonly");for(const s of this.shadow.querySelectorAll("#exchanges .turn[data-segment]")){const i=Number(s.dataset.segment),a=e.segments[i];if(!a)continue;if(a.start!==void 0){const c=document.createElement("button");c.type="button",c.className="turn-time",c.textContent=g.clock(a.start),c.addEventListener("click",()=>this.player.seek(a.start)),s.prepend(c)}const n=a.redacted?[a.redacted]:f.partsOf(a).flatMap(c=>"redacted"in c?[c.redacted]:[]);s.querySelectorAll(".bar").forEach((c,o)=>{const d=n[o]?.words;c.textContent=d!==void 0?t.redactedWords.replace("{n}",String(d)):t.redacted,c.classList.add("redacted-label");const h=a.redacted?`${i}:all`:`${i}:${o}`;this.takenOut.has(h)&&(c.dataset.restorable=h)});const l=this.momentsOf(e,a.speaker);s.querySelectorAll(".ref").forEach((c,o)=>{const d=a.refs?.[o];if(!d)return;const h=l.find(p=>Math.abs(p.at-d.at)<.05);if(h){const p=document.createElement("span");p.className="moment-letter",p.textContent=h.label.slice(0,2),c.replaceChildren(p,t.momentLabel.replace("{k}",h.label).replace("{text}",h.note??g.clock(d.at)))}if(r)return;const u=document.createElement("button");u.type="button",u.className="ref-unlink",u.textContent="×",u.title=t.unlinkMoment,u.setAttribute("aria-label",t.unlinkMoment),u.addEventListener("click",()=>void this.editTranscript(p=>{p.segments[i].refs?.splice(o,1),p.segments[i].refs?.length===0&&delete p.segments[i].refs})),c.after(u)}),r||s.append(this.turnTools(e,i,a,l))}}turnTools(e,t,r,s){const i=this.messages,a=document.createElement("div");a.className="turn-tools";const n=(o,d)=>{const h=document.createElement("button");return h.type="button",h.textContent=o,h.addEventListener("click",d),h};if(e.speakers?.[r.speaker]?.role==="witness"&&!r.redacted){const o=n(i.linkMoment,()=>{});a.append(o),new U(o,`moment-menu-${t}`,h=>void this.editTranscript(u=>{const p=u.segments[t].refs??[];p.some(b=>Math.abs(b.at-Number(h))<.05)||p.push({at:Number(h)}),u.segments[t].refs=p}),h=>`moment-${t}-${h}`).setKinds(s.length>0?s.map(h=>({value:String(h.at),label:i.momentLabel.replace("{k}",h.label).replace("{text}",h.note??g.clock(h.at))})):[{value:"",label:i.noMoments,disabledReason:i.noMoments}])}r.redacted||a.append(n(i.editTurn,()=>this.editTurn(t)));const l=this.takenOut.has(`${t}:all`)||[...this.takenOut.keys()].some(o=>o.startsWith(`${t}:`));if(r.redacted||r.parts&&l){const o=n(i.restoreAll,()=>void this.restoreAll(t));o.disabled=!l,a.append(o)}else a.append(n(i.redactAll,()=>void this.editTranscript(o=>{this.forget(t),this.takenOut.set(`${t}:all`,f.redactWhole(o.segments[t],this.redactReason))})));const c=n("",()=>void this.editTranscript(o=>{o.segments.splice(t,1),this.shiftTakenOut(t)}));return c.className="icon-btn",c.innerHTML=y.TRASH,c.title=i.deleteTurn,c.setAttribute("aria-label",i.deleteTurn),a.append(c),a}async redactSelection(){const e=this.messages,t=this.shadow.getElementById("redact-note"),r=(h,u=!1)=>{t.textContent=h,t.classList.toggle("error",u)},s=this.shadow.getSelection?.()??document.getSelection(),i=s&&s.rangeCount>0?s.getRangeAt(0):void 0;if(!i||i.collapsed){r(e.selectionNone);return}const a=h=>h instanceof Element?h:h.parentElement,n=a(i.startContainer)?.closest(".said");if(!n||a(i.endContainer)?.closest(".said")!==n||a(i.startContainer)?.closest(".bar")||a(i.endContainer)?.closest(".bar")){r(e.selectionOnePassage,!0);return}const l=Number(n.closest(".turn").dataset.segment),c=m.offsetIn(n,i.startContainer,i.startOffset),o=m.offsetIn(n,i.endContainer,i.endOffset);let d=!1;await this.editTranscript(h=>{const u=f.redact(h.segments[l],Math.min(c,o),Math.max(c,o),this.redactReason);u&&(d=!0,this.shiftParts(l,u.nth),this.takenOut.set(`${l}:${u.nth}`,u.text))}),s?.removeAllRanges(),r(d?"":e.selectionOnePassage,!d)}static offsetIn(e,t,r){let s=0;const i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:a=>a.parentElement?.closest(".bar")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});for(let a=i.nextNode();a;a=i.nextNode()){if(a===t)return s+r;if(t.contains(a)&&t!==a){const l=[...t.childNodes].slice(0,r);return s+l.reduce((c,o)=>c+(o instanceof Element&&o.closest(".bar")?0:(o.textContent??"").length),0)}s+=(a.textContent??"").length}return s}async restore(e){const t=this.takenOut.get(e);if(t===void 0)return;const[r,s]=e.split(":"),i=Number(r);await this.editTranscript(a=>{s==="all"?f.restoreWhole(a.segments[i],t):(f.restorePart(a.segments[i],Number(s),t),this.shiftParts(i,Number(s),-1)),this.takenOut.delete(e)})}async restoreAll(e){if(this.takenOut.has(`${e}:all`)){await this.restore(`${e}:all`);return}const t=[...this.takenOut.keys()].filter(r=>r.startsWith(`${e}:`)).map(r=>Number(r.split(":")[1])).sort((r,s)=>s-r);for(const r of t)await this.restore(`${e}:${r}`)}editTurn(e){const r=this.drawn?.segments[e],s=this.shadow.querySelector(`#exchanges .turn[data-segment="${e}"] .said`);if(!r||!s)return;const i=this.messages,a=document.createElement("div");a.className="turn-edit";const n=document.createElement("textarea");n.value=f.raw(r,h=>this.takenOut.get(`${e}:${h}`));const l=document.createElement("span");l.className="hint",l.textContent=i.turnEditHint;const c=document.createElement("div");c.className="buttons";const o=document.createElement("button");o.type="button",o.className="pill-btn primary",o.textContent=i.saveTurn,o.addEventListener("click",()=>void this.editTranscript(h=>{const u=f.fromRaw(h.segments[e],n.value,this.redactReason);this.forget(e);for(const[p,b]of u)this.takenOut.set(`${e}:${p}`,b)}));const d=document.createElement("button");d.type="button",d.className="pill-btn",d.textContent=i.cancelTurn,d.addEventListener("click",()=>this.drawExchanges(this.drawn)),c.append(o,d),a.append(n,l,c),s.replaceWith(a),n.focus()}forget(e){for(const t of[...this.takenOut.keys()])t.startsWith(`${e}:`)&&this.takenOut.delete(t)}shiftParts(e,t,r=1){const s=[...this.takenOut].filter(([i])=>i.startsWith(`${e}:`)&&i!==`${e}:all`&&Number(i.split(":")[1])>=t+(r<0?1:0));for(const[i]of s)this.takenOut.delete(i);for(const[i,a]of s)this.takenOut.set(`${e}:${Number(i.split(":")[1])+r}`,a)}shiftTakenOut(e){const t=[...this.takenOut];this.takenOut.clear();for(const[r,s]of t){const[i,a]=r.split(":"),n=Number(i);n<e?this.takenOut.set(r,s):n>e&&this.takenOut.set(`${n-1}:${a}`,s)}}markCurrentTurn(e){const t=this.drawn?.segments??[];let r=-1;t.forEach((a,n)=>{a.start!==void 0&&a.start<=e&&(r=n)});for(const a of this.shadow.querySelectorAll("#exchanges .turn.current"))a.classList.remove("current");const s=this.shadow.querySelector(`#exchanges .turn[data-segment="${r}"]`);if(!s)return;s.classList.add("current");const i=s.closest(".rr0-interview-turns");i&&(s.offsetTop<i.scrollTop||s.offsetTop>i.scrollTop+i.clientHeight-s.offsetHeight)&&i.scrollTo({top:s.offsetTop-i.clientHeight/3,behavior:"smooth"})}async revealSegment(e){this.openGroup("exchanges"),await this.showExchanges(),this.shadow.getElementById("exchanges").revealSegment(e)}note(e,t="info"){q.show(this.shadow.getElementById("file-note"),e,t)}transcriptUrl(e){return e.url?new URL(e.url,this.base??location.href).href:void 0}static pretty(e){return JSON.stringify(e,null,2)+`
|
|
229
|
-
`}static SHARED=["title","time","medium","by","interviewOf","summary"];static ORDER=["version","id","language","title","time","medium","by","interviewOf","summary","speakers","transcription","proofreading","anonymization","recordings","segments"];static ordered(e){const t={};for(const r of m.ORDER)r in e&&(t[r]=e[r]);for(const r of Object.keys(e))r in t||(t[r]=e[r]);return t}static witnessesOf(e){return[e].flat().filter(t=>typeof t=="string")}static withEventFields(e,t){const r={...e};for(const i of m.SHARED)t[i]===void 0?delete r[i]:r[i]=structuredClone(t[i]);const s=r.speakers;if(typeof s=="object"&&s!==null){const i={...s},a=(n,l,c)=>{c.forEach((o,d)=>{const h=d===0?n:`${n}${d+1}`;i[h]?i[h]={...i[h],[l]:o}:d>0&&(i[h]={role:n,[l]:o})})};a("interviewer","by",t.by??[]),a("witness","of",m.witnessesOf(t.interviewOf)),r.speakers=i}return m.ordered(r)}applyFileToEvent(e,t){const r=this.current;if(!r)return!1;const s=JSON.stringify(m.SHARED.map(n=>r[n])),i=n=>typeof n=="string"||typeof n=="object"&&n!==null&&!Array.isArray(n),a={title:i,summary:i,time:n=>typeof n=="string",medium:n=>typeof n=="string",by:n=>Array.isArray(n),interviewOf:n=>typeof n=="string"||Array.isArray(n)};for(const n of m.SHARED){const l=e[n];l!==void 0&&a[n](l)?r[n]=structuredClone(l):t&&delete r[n]}return JSON.stringify(m.SHARED.map(n=>r[n]))!==s}syncFileFromEvent(){const e=this.current,t=this.fileEditor?.text??this.text;if(!e||t===void 0)return;let r;try{r=JSON.parse(t)}catch{return}if(typeof r!="object"||r===null||Array.isArray(r))return;const s=m.pretty(m.withEventFields(r,e));s!==t&&(this.text=s,this.fileEditor?.replaceText(s,!1),this.dispatchEvent(new CustomEvent(E,{bubbles:!0,composed:!0,detail:{field:"transcript",event:e,text:s}})))}template(e){return m.pretty(m.withEventFields({version:1,language:this.language,speakers:{interviewer:{role:"interviewer"},witness:{role:"witness"}},segments:[]},e))}loadFileEditor(e){return this.fileEditorLoading??=(async()=>{try{const[{SightingFileEditor:t},{default:r},s]=await Promise.all([A(()=>import("./SightingFileEditor-
|
|
229
|
+
`}static SHARED=["title","time","medium","by","interviewOf","summary"];static ORDER=["version","id","language","title","time","medium","by","interviewOf","summary","speakers","transcription","proofreading","anonymization","recordings","segments"];static ordered(e){const t={};for(const r of m.ORDER)r in e&&(t[r]=e[r]);for(const r of Object.keys(e))r in t||(t[r]=e[r]);return t}static witnessesOf(e){return[e].flat().filter(t=>typeof t=="string")}static withEventFields(e,t){const r={...e};for(const i of m.SHARED)t[i]===void 0?delete r[i]:r[i]=structuredClone(t[i]);const s=r.speakers;if(typeof s=="object"&&s!==null){const i={...s},a=(n,l,c)=>{c.forEach((o,d)=>{const h=d===0?n:`${n}${d+1}`;i[h]?i[h]={...i[h],[l]:o}:d>0&&(i[h]={role:n,[l]:o})})};a("interviewer","by",t.by??[]),a("witness","of",m.witnessesOf(t.interviewOf)),r.speakers=i}return m.ordered(r)}applyFileToEvent(e,t){const r=this.current;if(!r)return!1;const s=JSON.stringify(m.SHARED.map(n=>r[n])),i=n=>typeof n=="string"||typeof n=="object"&&n!==null&&!Array.isArray(n),a={title:i,summary:i,time:n=>typeof n=="string",medium:n=>typeof n=="string",by:n=>Array.isArray(n),interviewOf:n=>typeof n=="string"||Array.isArray(n)};for(const n of m.SHARED){const l=e[n];l!==void 0&&a[n](l)?r[n]=structuredClone(l):t&&delete r[n]}return JSON.stringify(m.SHARED.map(n=>r[n]))!==s}syncFileFromEvent(){const e=this.current,t=this.fileEditor?.text??this.text;if(!e||t===void 0)return;let r;try{r=JSON.parse(t)}catch{return}if(typeof r!="object"||r===null||Array.isArray(r))return;const s=m.pretty(m.withEventFields(r,e));s!==t&&(this.text=s,this.fileEditor?.replaceText(s,!1),this.dispatchEvent(new CustomEvent(E,{bubbles:!0,composed:!0,detail:{field:"transcript",event:e,text:s}})))}template(e){return m.pretty(m.withEventFields({version:1,language:this.language,speakers:{interviewer:{role:"interviewer"},witness:{role:"witness"}},segments:[]},e))}loadFileEditor(e){return this.fileEditorLoading??=(async()=>{try{const[{SightingFileEditor:t},{default:r},s]=await Promise.all([A(()=>import("./SightingFileEditor-IEZGobI0.js"),__vite__mapDeps([0,1,2]),import.meta.url),A(()=>import("./interviewSchema-D82l9P1r.js"),[],import.meta.url),V(this.language)]);return this.fileEditor=new t(this.shadow.getElementById("file-editor"),e,i=>this.onEdited(i),this.messages.editorLabel,{baseline:e,phrases:s.fileSearchPhrases,schema:r}),this.fileEditor}catch(t){throw this.fileEditorLoading=void 0,t}})(),this.fileEditorLoading}async showTranscript(){const e=this.current;if(!e||this.shownFor===e)return;this.note(this.messages.loading);let t=this.text;if(t===void 0){const r=this.transcriptUrl(e);if(r!==void 0)try{const s=await T.json(r);this.current===e&&typeof s=="object"&&s!==null&&!Array.isArray(s)?(this.applyFileToEvent(s,!1)&&this.fileChangedEvent(),t=m.pretty(m.withEventFields(s,e))):t=m.pretty(s)}catch{this.note(this.messages.loadFailed,"error")}t??=this.template(e)}if(this.current===e)try{const r=await this.loadFileEditor(t);if(this.current!==e)return;r.replaceText(t,!1),this.shownFor=e,this.text!==void 0||this.transcriptUrl(e)===void 0?this.note(void 0):this.shadow.getElementById("file-note").textContent===this.messages.loading&&this.note(void 0)}catch{this.note(this.messages.loadFailed,"error")}}onEdited(e){this.text=e;let t,r=!0;try{t=JSON.parse(e)}catch{r=!1}this.note(r?void 0:this.messages.invalid,"error");const s=this.current;if(r&&s&&typeof t=="object"&&t!==null&&!Array.isArray(t)&&this.applyFileToEvent(t,!0)&&this.fileChangedEvent(),s&&!s.url&&e.trim()!==""){const i=s.id??"1";s.url=`${i.startsWith("interview")?i:`interview-${i}`}.json`,this.field("url").value=s.url,this.dispatchEvent(new CustomEvent(E,{bubbles:!0,composed:!0,detail:{field:"url",event:s}}))}this.dispatchEvent(new CustomEvent(E,{bubbles:!0,composed:!0,detail:{field:"transcript",event:s,text:e}})),this.showExchanges()}fileChangedEvent(){this.render(),this.dispatchEvent(new CustomEvent(E,{bubbles:!0,composed:!0,detail:{field:"file",event:this.current}}))}async take(e){if(typeof e!="object"||e===null||!Array.isArray(e.segments)){this.note(this.messages.notATranscript,"error");return}const t=this.current;t&&this.applyFileToEvent(e,!1)&&this.fileChangedEvent();const r=m.pretty(t?m.withEventFields(e,t):e);await this.loadFileEditor(r).then(s=>s.replaceText(r,!1),()=>{}),this.shownFor=this.current,this.note(void 0),this.onEdited(r)}async importFromFile(e){try{const t=await e.text();let r;try{r=JSON.parse(t)}catch{r=void 0}if(typeof r!="object"||r===null){const{InterviewImport:s}=await A(async()=>{const{InterviewImport:l}=await import("./interviewImport-C-TiARLK.js");return{InterviewImport:l}},[],import.meta.url),i=this.current,a=[i?.interviewOf].flat().filter(l=>typeof l=="string"),n=s.parse(t,{by:(i?.by??[]).map(l=>m.byText([l])).filter(l=>l!==""),witnesses:this.options.filter(l=>a.length===0||a.includes(l.id))});r=n&&{...n,transcription:{note:`Imported from ${e.name}: who speaks and when are as the file gave them, to be checked.`}}}r===void 0?this.note(this.messages.notATranscript,"error"):await this.take(r)}catch{this.note(this.messages.loadFailed,"error")}}async importFromUrl(e){try{await this.take(await T.json(new URL(e,this.base??location.href).href))}catch{this.note(this.messages.loadFailed,"error")}}save(){const e=this.fileEditor?.text??this.text;if(e===void 0)return;const t=(this.current?.url??"").split("/").pop()||`${this.current?.id??"interview"}.json`,r=URL.createObjectURL(new Blob([e],{type:"application/json"})),s=document.createElement("a");s.href=r,s.download=t,s.click(),URL.revokeObjectURL(r)}}function te(){Y(),J(),customElements.get($)||customElements.define($,m)}export{E as INTERVIEW_CHANGE_EVENT,$ as INTERVIEW_EDITOR_ELEMENT_NAME,W as INTERVIEW_SEEK_EVENT,m as InterviewEditorElement,te as register};
|