@rr0/ufoathome 0.62.0 → 0.62.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5145,7 +5145,7 @@ vec3 encodeSrgb(vec3 linear) {
5145
5145
  void main() {
5146
5146
  gl_FragColor = vec4(encodeSrgb(texture2D(uFilm, vUv).rgb * uGain), 1.0);
5147
5147
  }
5148
- `,blending:Ei,depthTest:!1,depthWrite:!1}),this.quad=new Ge(new Di(2,2),this.addMaterial),this.quadScene.add(this.quad)}get instantTarget(){return this.frameTarget}open(e){const t=e.getRenderTarget();e.setRenderTarget(this.filmTarget),e.setClearColor(0,1),e.clear(!0,!0,!0),e.setRenderTarget(t)}add(e,t){this.addMaterial.uniforms.uShare.value=t,this.quad.material=this.addMaterial;const n=e.getRenderTarget(),i=e.autoClear;e.autoClear=!1,e.setRenderTarget(this.filmTarget),e.render(this.quadScene,this.quadCamera),e.setRenderTarget(n),e.autoClear=i}develop(e,t=1){this.developMaterial.uniforms.uGain.value=t,this.quad.material=this.developMaterial,e.setRenderTarget(null),e.render(this.quadScene,this.quadCamera)}resize(e,t){this.width=Math.max(1,e),this.height=Math.max(1,t),this.frameTarget.setSize(this.width,this.height),this.filmTarget.setSize(this.width,this.height)}dispose(){this.frameTarget.dispose(),this.filmTarget.dispose(),this.addMaterial.dispose(),this.developMaterial.dispose(),this.quad.geometry.dispose(),this.quadScene.clear()}}const hu=Math.PI/180,yf=180/Math.PI;function Ja(s,e,t){return Math.max(e,Math.min(t,s))}const rs=[{altitudeDeg:-90,zenith:[0,0,.02],horizon:[.01,.01,.03]},{altitudeDeg:-18,zenith:[.01,.01,.05],horizon:[.03,.02,.08]},{altitudeDeg:-6,zenith:[.02,.03,.12],horizon:[.25,.12,.15]},{altitudeDeg:0,zenith:[.05,.1,.35],horizon:[.9,.55,.35]},{altitudeDeg:8,zenith:[.1,.22,.55],horizon:[.82,.6,.45]},{altitudeDeg:25,zenith:[.15,.38,.78],horizon:[.76,.82,.91]},{altitudeDeg:90,zenith:[.15,.45,.9],horizon:[.7,.8,.95]}];function Fl(s,e,t){return s+(e-s)*t}function Rc(s,e,t){return[Fl(s[0],e[0],t),Fl(s[1],e[1],t),Fl(s[2],e[2],t)]}function uu(s){const e=Math.max(rs[0].altitudeDeg,Math.min(rs[rs.length-1].altitudeDeg,s));for(let n=0;n<rs.length-1;n++){const i=rs[n],r=rs[n+1];if(e>=i.altitudeDeg&&e<=r.altitudeDeg){const a=(e-i.altitudeDeg)/(r.altitudeDeg-i.altitudeDeg);return{zenith:Rc(i.zenith,r.zenith,a),horizon:Rc(i.horizon,r.horizon,a)}}}const t=rs[rs.length-1];return{zenith:t.zenith,horizon:t.horizon}}const Sf=-18,bf=-4,Vy=1.8;function du(s,e=0){if(s<=Sf)return cc+e;if(s>=0)return bf+e;const t=s/Sf;return cc-(cc-bf)*(1-t)**Vy+e}const wf=-1.5,cc=6.5,Wy=1.6;function _a(s,e=cc){const t=Math.max(e,wf+1),n=(t-s)/(t-wf);return Ja(n,0,1)**Wy}function jt(s,e,t){const n=s*hu,i=e*hu,r=t*Math.cos(n);return{x:r*Math.sin(i),y:t*Math.sin(n),z:-r*Math.cos(i)}}function Xy(s,e,t){const n=Math.sqrt(s*s+e*e+t*t),i=n===0?0:Math.asin(Ja(e/n,-1,1))*yf,r=(Math.atan2(s,-t)*yf+360)%360;return{altitudeDeg:i,azimuthDeg:r}}function qy(s,e){const t=Math.abs(s-e)%360;return t>180?360-t:t}function Yy(s,e,t,n){const i=Math.max(0,1-qy(s,t)/Ky),r=Math.exp(-Math.max(0,e)/$y),a=n>0?Math.max(0,1-n/Jy):Math.max(0,1-Math.abs(n+Zy)/jy);return i*r*a}const Ky=90,$y=12,Jy=8,Zy=2,jy=12;function Qy(s,e,t,n){const{zenith:i,horizon:r}=uu(n),a=Ja((s+90)/180,0,1),o=Rc(r,i,a),c=Yy(e,s,t,n);if(c<=0)return o;const l=uu(n+eS).horizon,h=[Math.max(r[0],l[0]),Math.max(r[1],l[1]),Math.max(r[2],l[2])];return Rc(o,h,c)}const eS=6;function ya(s){return .12+.88*s}const tS=-4;function nS(s){return Math.max(0,tS-s)}const iS=6,sS=60;function rS(s){return Math.min(sS,iS*Math.sqrt(s))}const aS=3,oS=.55;function cS(s){return oS*Ja(s/aS,0,1)}function Lm(s){const e=Math.max(s,-4),t=Math.sin(e*hu)+.50572*Math.pow(e+6.07995,-1.6364);return Ja(1/t,1,40)}function os(s){const e=Lm(s)-1;return[1,Math.exp(-.022*e),Math.exp(-.062*e)]}function lS(s){return uS*(Lm(Math.max(s,0))-1)}function hS(s){return Math.pow(10,-.4*lS(s))}const uS=5/37,od=[{maxBrightness:.35,size:1.2},{maxBrightness:.7,size:2},{maxBrightness:1/0,size:3.2}];function Nm(s){return od.findIndex(e=>s<=e.maxBrightness)}const dS=.25,Ef=.3,fS=2.2;function pS(s,{phase:e,speedFactor:t},n){const r=1+dS*(Ef+(1-Ef)*s)*Math.sin(n*fS*t+e);return Math.min(1,Math.max(0,r))}/**
5148
+ `,blending:Ei,depthTest:!1,depthWrite:!1}),this.quad=new Ge(new Di(2,2),this.addMaterial),this.quadScene.add(this.quad)}get instantTarget(){return this.frameTarget}open(e){const t=e.getRenderTarget();e.setRenderTarget(this.filmTarget),e.setClearColor(0,1),e.clear(!0,!0,!0),e.setRenderTarget(t)}add(e,t){this.addMaterial.uniforms.uShare.value=t,this.quad.material=this.addMaterial;const n=e.getRenderTarget(),i=e.autoClear;e.autoClear=!1,e.setRenderTarget(this.filmTarget),e.render(this.quadScene,this.quadCamera),e.setRenderTarget(n),e.autoClear=i}develop(e,t=1){this.developMaterial.uniforms.uGain.value=t,this.quad.material=this.developMaterial,e.setRenderTarget(null),e.render(this.quadScene,this.quadCamera)}resize(e,t){this.width=Math.max(1,e),this.height=Math.max(1,t),this.frameTarget.setSize(this.width,this.height),this.filmTarget.setSize(this.width,this.height)}dispose(){this.frameTarget.dispose(),this.filmTarget.dispose(),this.addMaterial.dispose(),this.developMaterial.dispose(),this.quad.geometry.dispose(),this.quadScene.clear()}}const hu=Math.PI/180,yf=180/Math.PI;function Ja(s,e,t){return Math.max(e,Math.min(t,s))}const rs=[{altitudeDeg:-90,zenith:[0,0,.02],horizon:[.01,.01,.03]},{altitudeDeg:-18,zenith:[.01,.01,.05],horizon:[.03,.02,.08]},{altitudeDeg:-6,zenith:[.02,.03,.12],horizon:[.25,.12,.15]},{altitudeDeg:0,zenith:[.05,.1,.35],horizon:[.9,.55,.35]},{altitudeDeg:8,zenith:[.1,.22,.55],horizon:[.82,.6,.45]},{altitudeDeg:25,zenith:[.15,.38,.78],horizon:[.76,.82,.91]},{altitudeDeg:90,zenith:[.15,.45,.9],horizon:[.7,.8,.95]}];function Fl(s,e,t){return s+(e-s)*t}function Rc(s,e,t){return[Fl(s[0],e[0],t),Fl(s[1],e[1],t),Fl(s[2],e[2],t)]}function uu(s){const e=Math.max(rs[0].altitudeDeg,Math.min(rs[rs.length-1].altitudeDeg,s));for(let n=0;n<rs.length-1;n++){const i=rs[n],r=rs[n+1];if(e>=i.altitudeDeg&&e<=r.altitudeDeg){const a=(e-i.altitudeDeg)/(r.altitudeDeg-i.altitudeDeg);return{zenith:Rc(i.zenith,r.zenith,a),horizon:Rc(i.horizon,r.horizon,a)}}}const t=rs[rs.length-1];return{zenith:t.zenith,horizon:t.horizon}}const Sf=-18,bf=-4,Vy=1.8;function du(s,e=0){if(s<=Sf)return cc+e;if(s>=0)return bf+e;const t=s/Sf;return cc-(cc-bf)*(1-t)**Vy+e}const wf=-1.5,cc=6.5,Wy=1.6;function _a(s,e=cc){const t=Math.max(e,wf+1),n=(t-s)/(t-wf);return Ja(n,0,1)**Wy}function jt(s,e,t){const n=s*hu,i=e*hu,r=t*Math.cos(n);return{x:r*Math.sin(i),y:t*Math.sin(n),z:-r*Math.cos(i)}}function Xy(s,e,t){const n=Math.sqrt(s*s+e*e+t*t),i=n===0?0:Math.asin(Ja(e/n,-1,1))*yf,r=(Math.atan2(s,-t)*yf+360)%360;return{altitudeDeg:i,azimuthDeg:r}}function qy(s,e){const t=Math.abs(s-e)%360;return t>180?360-t:t}function Yy(s,e,t,n){const i=Math.max(0,1-qy(s,t)/Ky),r=Math.exp(-Math.max(0,e)/$y),a=n>0?Math.max(0,1-n/Jy):Math.max(0,1-Math.abs(n+Zy)/jy);return i*r*a}const Ky=90,$y=12,Jy=8,Zy=2,jy=12;function Qy(s,e,t,n){const{zenith:i,horizon:r}=uu(n),a=Ja((s+90)/180,0,1),o=Rc(r,i,a),c=Yy(e,s,t,n);if(c<=0)return o;const l=uu(n+e5).horizon,h=[Math.max(r[0],l[0]),Math.max(r[1],l[1]),Math.max(r[2],l[2])];return Rc(o,h,c)}const e5=6;function ya(s){return .12+.88*s}const t5=-4;function n5(s){return Math.max(0,t5-s)}const i5=6,s5=60;function r5(s){return Math.min(s5,i5*Math.sqrt(s))}const a5=3,o5=.55;function c5(s){return o5*Ja(s/a5,0,1)}function Lm(s){const e=Math.max(s,-4),t=Math.sin(e*hu)+.50572*Math.pow(e+6.07995,-1.6364);return Ja(1/t,1,40)}function os(s){const e=Lm(s)-1;return[1,Math.exp(-.022*e),Math.exp(-.062*e)]}function l5(s){return u5*(Lm(Math.max(s,0))-1)}function h5(s){return Math.pow(10,-.4*l5(s))}const u5=5/37,od=[{maxBrightness:.35,size:1.2},{maxBrightness:.7,size:2},{maxBrightness:1/0,size:3.2}];function Nm(s){return od.findIndex(e=>s<=e.maxBrightness)}const d5=.25,Ef=.3,f5=2.2;function p5(s,{phase:e,speedFactor:t},n){const r=1+d5*(Ef+(1-Ef)*s)*Math.sin(n*f5*t+e);return Math.min(1,Math.max(0,r))}/**
5149
5149
  @preserve
5150
5150
 
5151
5151
  Astronomy library for JavaScript (browser and Node.js).
@@ -5176,11 +5176,11 @@ vec3 encodeSrgb(vec3 linear) {
5176
5176
  * @fileoverview Astronomy calculation library for browser scripting and Node.js.
5177
5177
  * @author Don Cross <cosinekitty@gmail.com>
5178
5178
  * @license MIT
5179
- */const cd=173.1446326846693,Is=14959787069098932e-8,ot=.017453292519943295,Af=.26179938779914946,Ti=57.29577951308232,Om=3.819718634205488,mS=365.24217,Tf=new Date("2000-01-01T12:00:00Z"),Ui=2*Math.PI,as=3600*(180/Math.PI),Tr=484813681109536e-20,Um=10800*60,gS=2*Um,Rf=7292115e-11,vS=Um/Math.PI,MS=-.17-5*Math.log10(vS),fu=.996647180302104,xS=fu*fu,pu=6378.1366,_S=pu/Is,Fm=81.30056,ld=.0002959122082855911,mu=2825345909524226e-22,gu=8459715185680659e-23,vu=1292024916781969e-23,Mu=1524358900784276e-23;function Dc(s){if(s!==!0&&s!==!1)throw console.trace(),`Value is not boolean: ${s}`;return s}function tn(s){if(!Number.isFinite(s))throw console.trace(),`Value is not a finite number: ${s}`;return s}function _r(s){return s-Math.floor(s)}function yS(s,e){const t=s.x*s.x+s.y*s.y+s.z*s.z;if(Math.abs(t)<1e-8)throw"AngleBetween: first vector is too short.";const n=e.x*e.x+e.y*e.y+e.z*e.z;if(Math.abs(n)<1e-8)throw"AngleBetween: second vector is too short.";const i=(s.x*e.x+s.y*e.y+s.z*e.z)/Math.sqrt(t*n);return i<=-1?180:i>=1?0:Ti*Math.acos(i)}var Se;(function(s){s.Sun="Sun",s.Moon="Moon",s.Mercury="Mercury",s.Venus="Venus",s.Earth="Earth",s.Mars="Mars",s.Jupiter="Jupiter",s.Saturn="Saturn",s.Uranus="Uranus",s.Neptune="Neptune",s.Pluto="Pluto",s.SSB="SSB",s.EMB="EMB",s.Star1="Star1",s.Star2="Star2",s.Star3="Star3",s.Star4="Star4",s.Star5="Star5",s.Star6="Star6",s.Star7="Star7",s.Star8="Star8"})(Se||(Se={}));const SS=[Se.Star1,Se.Star2,Se.Star3,Se.Star4,Se.Star5,Se.Star6,Se.Star7,Se.Star8],bS=[{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0}];function wS(s){const e=SS.indexOf(s);return e>=0?bS[e]:null}function hd(s){const e=wS(s);return e&&e.dist>0?e:null}var on;(function(s){s[s.From2000=0]="From2000",s[s.Into2000=1]="Into2000"})(on||(on={}));const wi={Mercury:[[[[4.40250710144,0,0],[.40989414977,1.48302034195,26087.9031415742],[.050462942,4.47785489551,52175.8062831484],[.00855346844,1.16520322459,78263.70942472259],[.00165590362,4.11969163423,104351.61256629678],[.00034561897,.77930768443,130439.51570787099],[7583476e-11,3.71348404924,156527.41884944518]],[[26087.90313685529,0,0],[.01131199811,6.21874197797,26087.9031415742],[.00292242298,3.04449355541,52175.8062831484],[.00075775081,6.08568821653,78263.70942472259],[.00019676525,2.80965111777,104351.61256629678]]],[[[.11737528961,1.98357498767,26087.9031415742],[.02388076996,5.03738959686,52175.8062831484],[.01222839532,3.14159265359,0],[.0054325181,1.79644363964,78263.70942472259],[.0012977877,4.83232503958,104351.61256629678],[.00031866927,1.58088495658,130439.51570787099],[7963301e-11,4.60972126127,156527.41884944518]],[[.00274646065,3.95008450011,26087.9031415742],[.00099737713,3.14159265359,0]]],[[[.39528271651,0,0],[.07834131818,6.19233722598,26087.9031415742],[.00795525558,2.95989690104,52175.8062831484],[.00121281764,6.01064153797,78263.70942472259],[.00021921969,2.77820093972,104351.61256629678],[4354065e-11,5.82894543774,130439.51570787099]],[[.0021734774,4.65617158665,26087.9031415742],[.00044141826,1.42385544001,52175.8062831484]]]],Venus:[[[[3.17614666774,0,0],[.01353968419,5.59313319619,10213.285546211],[.00089891645,5.30650047764,20426.571092422],[5477194e-11,4.41630661466,7860.4193924392],[3455741e-11,2.6996444782,11790.6290886588],[2372061e-11,2.99377542079,3930.2096962196],[1317168e-11,5.18668228402,26.2983197998],[1664146e-11,4.25018630147,1577.3435424478],[1438387e-11,4.15745084182,9683.5945811164],[1200521e-11,6.15357116043,30639.856638633]],[[10213.28554621638,0,0],[.00095617813,2.4640651111,10213.285546211],[7787201e-11,.6247848222,20426.571092422]]],[[[.05923638472,.26702775812,10213.285546211],[.00040107978,1.14737178112,20426.571092422],[.00032814918,3.14159265359,0]],[[.00287821243,1.88964962838,10213.285546211]]],[[[.72334820891,0,0],[.00489824182,4.02151831717,10213.285546211],[1658058e-11,4.90206728031,20426.571092422],[1378043e-11,1.12846591367,11790.6290886588],[1632096e-11,2.84548795207,7860.4193924392],[498395e-11,2.58682193892,9683.5945811164],[221985e-11,2.01346696541,19367.1891622328],[237454e-11,2.55136053886,15720.8387848784]],[[.00034551041,.89198706276,10213.285546211]]]],Earth:[[[[1.75347045673,0,0],[.03341656453,4.66925680415,6283.0758499914],[.00034894275,4.62610242189,12566.1516999828],[3417572e-11,2.82886579754,3.523118349],[3497056e-11,2.74411783405,5753.3848848968],[3135899e-11,3.62767041756,77713.7714681205],[2676218e-11,4.41808345438,7860.4193924392],[2342691e-11,6.13516214446,3930.2096962196],[1273165e-11,2.03709657878,529.6909650946],[1324294e-11,.74246341673,11506.7697697936],[901854e-11,2.04505446477,26.2983197998],[1199167e-11,1.10962946234,1577.3435424478],[857223e-11,3.50849152283,398.1490034082],[779786e-11,1.17882681962,5223.6939198022],[99025e-10,5.23268072088,5884.9268465832],[753141e-11,2.53339052847,5507.5532386674],[505267e-11,4.58292599973,18849.2275499742],[492392e-11,4.20505711826,775.522611324],[356672e-11,2.91954114478,.0673103028],[284125e-11,1.89869240932,796.2980068164],[242879e-11,.34481445893,5486.777843175],[317087e-11,5.84901948512,11790.6290886588],[271112e-11,.31486255375,10977.078804699],[206217e-11,4.80646631478,2544.3144198834],[205478e-11,1.86953770281,5573.1428014331],[202318e-11,2.45767790232,6069.7767545534],[126225e-11,1.08295459501,20.7753954924],[155516e-11,.83306084617,213.299095438]],[[6283.0758499914,0,0],[.00206058863,2.67823455808,6283.0758499914],[4303419e-11,2.63512233481,12566.1516999828]],[[8721859e-11,1.07253635559,6283.0758499914]]],[[],[[.00227777722,3.4137662053,6283.0758499914],[3805678e-11,3.37063423795,12566.1516999828]]],[[[1.00013988784,0,0],[.01670699632,3.09846350258,6283.0758499914],[.00013956024,3.05524609456,12566.1516999828],[308372e-10,5.19846674381,77713.7714681205],[1628463e-11,1.17387558054,5753.3848848968],[1575572e-11,2.84685214877,7860.4193924392],[924799e-11,5.45292236722,11506.7697697936],[542439e-11,4.56409151453,3930.2096962196],[47211e-10,3.66100022149,5884.9268465832],[85831e-11,1.27079125277,161000.6857376741],[57056e-11,2.01374292245,83996.84731811189],[55736e-11,5.2415979917,71430.69561812909],[174844e-11,3.01193636733,18849.2275499742],[243181e-11,4.2734953079,11790.6290886588]],[[.00103018607,1.10748968172,6283.0758499914],[1721238e-11,1.06442300386,12566.1516999828]],[[4359385e-11,5.78455133808,6283.0758499914]]]],Mars:[[[[6.20347711581,0,0],[.18656368093,5.0503710027,3340.6124266998],[.01108216816,5.40099836344,6681.2248533996],[.00091798406,5.75478744667,10021.8372800994],[.00027744987,5.97049513147,3.523118349],[.00010610235,2.93958560338,2281.2304965106],[.00012315897,.84956094002,2810.9214616052],[8926784e-11,4.15697846427,.0172536522],[8715691e-11,6.11005153139,13362.4497067992],[6797556e-11,.36462229657,398.1490034082],[7774872e-11,3.33968761376,5621.8429232104],[3575078e-11,1.6618650571,2544.3144198834],[4161108e-11,.22814971327,2942.4634232916],[3075252e-11,.85696614132,191.4482661116],[2628117e-11,.64806124465,3337.0893083508],[2937546e-11,6.07893711402,.0673103028],[2389414e-11,5.03896442664,796.2980068164],[2579844e-11,.02996736156,3344.1355450488],[1528141e-11,1.14979301996,6151.533888305],[1798806e-11,.65634057445,529.6909650946],[1264357e-11,3.62275122593,5092.1519581158],[1286228e-11,3.06796065034,2146.1654164752],[1546404e-11,2.91579701718,1751.539531416],[1024902e-11,3.69334099279,8962.4553499102],[891566e-11,.18293837498,16703.062133499],[858759e-11,2.4009381194,2914.0142358238],[832715e-11,2.46418619474,3340.5951730476],[83272e-10,4.49495782139,3340.629680352],[712902e-11,3.66335473479,1059.3819301892],[748723e-11,3.82248614017,155.4203994342],[723861e-11,.67497311481,3738.761430108],[635548e-11,2.92182225127,8432.7643848156],[655162e-11,.48864064125,3127.3133312618],[550474e-11,3.81001042328,.9803210682],[55275e-10,4.47479317037,1748.016413067],[425966e-11,.55364317304,6283.0758499914],[415131e-11,.49662285038,213.299095438],[472167e-11,3.62547124025,1194.4470102246],[306551e-11,.38052848348,6684.7479717486],[312141e-11,.99853944405,6677.7017350506],[293198e-11,4.22131299634,20.7753954924],[302375e-11,4.48618007156,3532.0606928114],[274027e-11,.54222167059,3340.545116397],[281079e-11,5.88163521788,1349.8674096588],[231183e-11,1.28242156993,3870.3033917944],[283602e-11,5.7688543494,3149.1641605882],[236117e-11,5.75503217933,3333.498879699],[274033e-11,.13372524985,3340.6797370026],[299395e-11,2.78323740866,6254.6266625236]],[[3340.61242700512,0,0],[.01457554523,3.60433733236,3340.6124266998],[.00168414711,3.92318567804,6681.2248533996],[.00020622975,4.26108844583,10021.8372800994],[3452392e-11,4.7321039319,3.523118349],[2586332e-11,4.60670058555,13362.4497067992],[841535e-11,4.45864030426,2281.2304965106]],[[.00058152577,2.04961712429,3340.6124266998],[.00013459579,2.45738706163,6681.2248533996]]],[[[.03197134986,3.76832042431,3340.6124266998],[.00298033234,4.10616996305,6681.2248533996],[.00289104742,0,0],[.00031365539,4.4465105309,10021.8372800994],[34841e-9,4.7881254926,13362.4497067992]],[[.00217310991,6.04472194776,3340.6124266998],[.00020976948,3.14159265359,0],[.00012834709,1.60810667915,6681.2248533996]]],[[[1.53033488271,0,0],[.1418495316,3.47971283528,3340.6124266998],[.00660776362,3.81783443019,6681.2248533996],[.00046179117,4.15595316782,10021.8372800994],[8109733e-11,5.55958416318,2810.9214616052],[7485318e-11,1.77239078402,5621.8429232104],[5523191e-11,1.3643630377,2281.2304965106],[382516e-10,4.49407183687,13362.4497067992],[2306537e-11,.09081579001,2544.3144198834],[1999396e-11,5.36059617709,3337.0893083508],[2484394e-11,4.9254563992,2942.4634232916],[1960195e-11,4.74249437639,3344.1355450488],[1167119e-11,2.11260868341,5092.1519581158],[1102816e-11,5.00908403998,398.1490034082],[899066e-11,4.40791133207,529.6909650946],[992252e-11,5.83861961952,6151.533888305],[807354e-11,2.10217065501,1059.3819301892],[797915e-11,3.44839203899,796.2980068164],[740975e-11,1.49906336885,2146.1654164752]],[[.01107433345,2.03250524857,3340.6124266998],[.00103175887,2.37071847807,6681.2248533996],[128772e-9,0,0],[.0001081588,2.70888095665,10021.8372800994]],[[.00044242249,.47930604954,3340.6124266998],[8138042e-11,.86998389204,6681.2248533996]]]],Jupiter:[[[[.59954691494,0,0],[.09695898719,5.06191793158,529.6909650946],[.00573610142,1.44406205629,7.1135470008],[.00306389205,5.41734730184,1059.3819301892],[.00097178296,4.14264726552,632.7837393132],[.00072903078,3.64042916389,522.5774180938],[.00064263975,3.41145165351,103.0927742186],[.00039806064,2.29376740788,419.4846438752],[.00038857767,1.27231755835,316.3918696566],[.00027964629,1.7845459182,536.8045120954],[.0001358973,5.7748104079,1589.0728952838],[8246349e-11,3.5822792584,206.1855484372],[8768704e-11,3.63000308199,949.1756089698],[7368042e-11,5.0810119427,735.8765135318],[626315e-10,.02497628807,213.299095438],[6114062e-11,4.51319998626,1162.4747044078],[4905396e-11,1.32084470588,110.2063212194],[5305285e-11,1.30671216791,14.2270940016],[5305441e-11,4.18625634012,1052.2683831884],[4647248e-11,4.69958103684,3.9321532631],[3045023e-11,4.31676431084,426.598190876],[2609999e-11,1.56667394063,846.0828347512],[2028191e-11,1.06376530715,3.1813937377],[1764763e-11,2.14148655117,1066.49547719],[1722972e-11,3.88036268267,1265.5674786264],[1920945e-11,.97168196472,639.897286314],[1633223e-11,3.58201833555,515.463871093],[1431999e-11,4.29685556046,625.6701923124],[973272e-11,4.09764549134,95.9792272178]],[[529.69096508814,0,0],[.00489503243,4.2208293947,529.6909650946],[.00228917222,6.02646855621,7.1135470008],[.00030099479,4.54540782858,1059.3819301892],[.0002072092,5.45943156902,522.5774180938],[.00012103653,.16994816098,536.8045120954],[6067987e-11,4.42422292017,103.0927742186],[5433968e-11,3.98480737746,419.4846438752],[4237744e-11,5.89008707199,14.2270940016]],[[.00047233601,4.32148536482,7.1135470008],[.00030649436,2.929777887,529.6909650946],[.00014837605,3.14159265359,0]]],[[[.02268615702,3.55852606721,529.6909650946],[.00109971634,3.90809347197,1059.3819301892],[.00110090358,0,0],[8101428e-11,3.60509572885,522.5774180938],[6043996e-11,4.25883108339,1589.0728952838],[6437782e-11,.30627119215,536.8045120954]],[[.00078203446,1.52377859742,529.6909650946]]],[[[5.20887429326,0,0],[.25209327119,3.49108639871,529.6909650946],[.00610599976,3.84115365948,1059.3819301892],[.00282029458,2.57419881293,632.7837393132],[.00187647346,2.07590383214,522.5774180938],[.00086792905,.71001145545,419.4846438752],[.00072062974,.21465724607,536.8045120954],[.00065517248,5.9799588479,316.3918696566],[.00029134542,1.67759379655,103.0927742186],[.00030135335,2.16132003734,949.1756089698],[.00023453271,3.54023522184,735.8765135318],[.00022283743,4.19362594399,1589.0728952838],[.00023947298,.2745803748,7.1135470008],[.00013032614,2.96042965363,1162.4747044078],[970336e-10,1.90669633585,206.1855484372],[.00012749023,2.71550286592,1052.2683831884],[7057931e-11,2.18184839926,1265.5674786264],[6137703e-11,6.26418240033,846.0828347512],[2616976e-11,2.00994012876,1581.959348283]],[[.0127180152,2.64937512894,529.6909650946],[.00061661816,3.00076460387,1059.3819301892],[.00053443713,3.89717383175,522.5774180938],[.00031185171,4.88276958012,536.8045120954],[.00041390269,0,0]]]],Saturn:[[[[.87401354025,0,0],[.11107659762,3.96205090159,213.299095438],[.01414150957,4.58581516874,7.1135470008],[.00398379389,.52112032699,206.1855484372],[.00350769243,3.30329907896,426.598190876],[.00206816305,.24658372002,103.0927742186],[792713e-9,3.84007056878,220.4126424388],[.00023990355,4.66976924553,110.2063212194],[.00016573588,.43719228296,419.4846438752],[.00014906995,5.76903183869,316.3918696566],[.0001582029,.93809155235,632.7837393132],[.00014609559,1.56518472,3.9321532631],[.00013160301,4.44891291899,14.2270940016],[.00015053543,2.71669915667,639.897286314],[.00013005299,5.98119023644,11.0457002639],[.00010725067,3.12939523827,202.2533951741],[5863206e-11,.23656938524,529.6909650946],[5227757e-11,4.20783365759,3.1813937377],[6126317e-11,1.76328667907,277.0349937414],[5019687e-11,3.17787728405,433.7117378768],[459255e-10,.61977744975,199.0720014364],[4005867e-11,2.24479718502,63.7358983034],[2953796e-11,.98280366998,95.9792272178],[387367e-10,3.22283226966,138.5174968707],[2461186e-11,2.03163875071,735.8765135318],[3269484e-11,.77492638211,949.1756089698],[1758145e-11,3.2658010994,522.5774180938],[1640172e-11,5.5050445305,846.0828347512],[1391327e-11,4.02333150505,323.5054166574],[1580648e-11,4.37265307169,309.2783226558],[1123498e-11,2.83726798446,415.5524906121],[1017275e-11,3.71700135395,227.5261894396],[848642e-11,3.1915017083,209.3669421749]],[[213.2990952169,0,0],[.01297370862,1.82834923978,213.299095438],[.00564345393,2.88499717272,7.1135470008],[.00093734369,1.06311793502,426.598190876],[.00107674962,2.27769131009,206.1855484372],[.00040244455,2.04108104671,220.4126424388],[.00019941774,1.2795439047,103.0927742186],[.00010511678,2.7488034213,14.2270940016],[6416106e-11,.38238295041,639.897286314],[4848994e-11,2.43037610229,419.4846438752],[4056892e-11,2.92133209468,110.2063212194],[3768635e-11,3.6496533078,3.9321532631]],[[.0011644133,1.17988132879,7.1135470008],[.00091841837,.0732519584,213.299095438],[.00036661728,0,0],[.00015274496,4.06493179167,206.1855484372]]],[[[.04330678039,3.60284428399,213.299095438],[.00240348302,2.85238489373,426.598190876],[.00084745939,0,0],[.00030863357,3.48441504555,220.4126424388],[.00034116062,.57297307557,206.1855484372],[.0001473407,2.11846596715,639.897286314],[9916667e-11,5.79003188904,419.4846438752],[6993564e-11,4.7360468972,7.1135470008],[4807588e-11,5.43305312061,316.3918696566]],[[.00198927992,4.93901017903,213.299095438],[.00036947916,3.14159265359,0],[.00017966989,.5197943111,426.598190876]]],[[[9.55758135486,0,0],[.52921382865,2.39226219573,213.299095438],[.01873679867,5.2354960466,206.1855484372],[.01464663929,1.64763042902,426.598190876],[.00821891141,5.93520042303,316.3918696566],[.00547506923,5.0153261898,103.0927742186],[.0037168465,2.27114821115,220.4126424388],[.00361778765,3.13904301847,7.1135470008],[.00140617506,5.70406606781,632.7837393132],[.00108974848,3.29313390175,110.2063212194],[.00069006962,5.94099540992,419.4846438752],[.00061053367,.94037691801,639.897286314],[.00048913294,1.55733638681,202.2533951741],[.00034143772,.19519102597,277.0349937414],[.00032401773,5.47084567016,949.1756089698],[.00020936596,.46349251129,735.8765135318],[9796004e-11,5.20477537945,1265.5674786264],[.00011993338,5.98050967385,846.0828347512],[208393e-9,1.52102476129,433.7117378768],[.00015298404,3.0594381494,529.6909650946],[6465823e-11,.17732249942,1052.2683831884],[.00011380257,1.7310542704,522.5774180938],[3419618e-11,4.94550542171,1581.959348283]],[[.0618298134,.2584351148,213.299095438],[.00506577242,.71114625261,206.1855484372],[.00341394029,5.79635741658,426.598190876],[.00188491195,.47215589652,220.4126424388],[.00186261486,3.14159265359,0],[.00143891146,1.40744822888,7.1135470008]],[[.00436902572,4.78671677509,213.299095438]]]],Uranus:[[[[5.48129294297,0,0],[.09260408234,.89106421507,74.7815985673],[.01504247898,3.6271926092,1.4844727083],[.00365981674,1.89962179044,73.297125859],[.00272328168,3.35823706307,149.5631971346],[.00070328461,5.39254450063,63.7358983034],[.00068892678,6.09292483287,76.2660712756],[.00061998615,2.26952066061,2.9689454166],[.00061950719,2.85098872691,11.0457002639],[.0002646877,3.14152083966,71.8126531507],[.00025710476,6.11379840493,454.9093665273],[.0002107885,4.36059339067,148.0787244263],[.00017818647,1.74436930289,36.6485629295],[.00014613507,4.73732166022,3.9321532631],[.00011162509,5.8268179635,224.3447957019],[.0001099791,.48865004018,138.5174968707],[9527478e-11,2.95516862826,35.1640902212],[7545601e-11,5.236265824,109.9456887885],[4220241e-11,3.23328220918,70.8494453042],[40519e-9,2.277550173,151.0476698429],[3354596e-11,1.0654900738,4.4534181249],[2926718e-11,4.62903718891,9.5612275556],[349034e-10,5.48306144511,146.594251718],[3144069e-11,4.75199570434,77.7505439839],[2922333e-11,5.35235361027,85.8272988312],[2272788e-11,4.36600400036,70.3281804424],[2051219e-11,1.51773566586,.1118745846],[2148602e-11,.60745949945,38.1330356378],[1991643e-11,4.92437588682,277.0349937414],[1376226e-11,2.04283539351,65.2203710117],[1666902e-11,3.62744066769,380.12776796],[1284107e-11,3.11347961505,202.2533951741],[1150429e-11,.93343589092,3.1813937377],[1533221e-11,2.58594681212,52.6901980395],[1281604e-11,.54271272721,222.8603229936],[1372139e-11,4.19641530878,111.4301614968],[1221029e-11,.1990065003,108.4612160802],[946181e-11,1.19253165736,127.4717966068],[1150989e-11,4.17898916639,33.6796175129]],[[74.7815986091,0,0],[.00154332863,5.24158770553,74.7815985673],[.00024456474,1.71260334156,1.4844727083],[9258442e-11,.4282973235,11.0457002639],[8265977e-11,1.50218091379,63.7358983034],[915016e-10,1.41213765216,149.5631971346]]],[[[.01346277648,2.61877810547,74.7815985673],[623414e-9,5.08111189648,149.5631971346],[.00061601196,3.14159265359,0],[9963722e-11,1.61603805646,76.2660712756],[992616e-10,.57630380333,73.297125859]],[[.00034101978,.01321929936,74.7815985673]]],[[[19.21264847206,0,0],[.88784984413,5.60377527014,74.7815985673],[.03440836062,.32836099706,73.297125859],[.0205565386,1.7829515933,149.5631971346],[.0064932241,4.52247285911,76.2660712756],[.00602247865,3.86003823674,63.7358983034],[.00496404167,1.40139935333,454.9093665273],[.00338525369,1.58002770318,138.5174968707],[.00243509114,1.57086606044,71.8126531507],[.00190522303,1.99809394714,1.4844727083],[.00161858838,2.79137786799,148.0787244263],[.00143706183,1.38368544947,11.0457002639],[.00093192405,.17437220467,36.6485629295],[.00071424548,4.24509236074,224.3447957019],[.00089806014,3.66105364565,109.9456887885],[.00039009723,1.66971401684,70.8494453042],[.00046677296,1.39976401694,35.1640902212],[.00039025624,3.36234773834,277.0349937414],[.00036755274,3.88649278513,146.594251718],[.00030348723,.70100838798,151.0476698429],[.00029156413,3.180563367,77.7505439839],[.00022637073,.72518687029,529.6909650946],[.00011959076,1.7504339214,984.6003316219],[.00025620756,5.25656086672,380.12776796]],[[.01479896629,3.67205697578,74.7815985673]]]],Neptune:[[[[5.31188633046,0,0],[.0179847553,2.9010127389,38.1330356378],[.01019727652,.48580922867,1.4844727083],[.00124531845,4.83008090676,36.6485629295],[.00042064466,5.41054993053,2.9689454166],[.00037714584,6.09221808686,35.1640902212],[.00033784738,1.24488874087,76.2660712756],[.00016482741,7727998e-11,491.5579294568],[9198584e-11,4.93747051954,39.6175083461],[899425e-10,.27462171806,175.1660598002]],[[38.13303563957,0,0],[.00016604172,4.86323329249,1.4844727083],[.00015744045,2.27887427527,38.1330356378]]],[[[.03088622933,1.44104372644,38.1330356378],[.00027780087,5.91271884599,76.2660712756],[.00027623609,0,0],[.00015355489,2.52123799551,36.6485629295],[.00015448133,3.50877079215,39.6175083461]]],[[[30.07013205828,0,0],[.27062259632,1.32999459377,38.1330356378],[.01691764014,3.25186135653,36.6485629295],[.00807830553,5.18592878704,1.4844727083],[.0053776051,4.52113935896,35.1640902212],[.00495725141,1.5710564165,491.5579294568],[.00274571975,1.84552258866,175.1660598002],[.0001201232,1.92059384991,1021.2488945514],[.00121801746,5.79754470298,76.2660712756],[.00100896068,.3770272493,73.297125859],[.00135134092,3.37220609835,39.6175083461],[7571796e-11,1.07149207335,388.4651552382]]]]};function ES(s){var e,t,n,i,r,a,o;const c=2e3+(s-14)/mS;return c<-500?(e=(c-1820)/100,-20+32*e*e):c<500?(e=c/100,t=e*e,n=e*t,i=t*t,r=t*n,a=n*n,10583.6-1014.41*e+33.78311*t-5.952053*n-.1798452*i+.022174192*r+.0090316521*a):c<1600?(e=(c-1e3)/100,t=e*e,n=e*t,i=t*t,r=t*n,a=n*n,1574.2-556.01*e+71.23472*t+.319781*n-.8503463*i-.005050998*r+.0083572073*a):c<1700?(e=c-1600,t=e*e,n=e*t,120-.9808*e-.01532*t+n/7129):c<1800?(e=c-1700,t=e*e,n=e*t,i=t*t,8.83+.1603*e-.0059285*t+13336e-8*n-i/1174e3):c<1860?(e=c-1800,t=e*e,n=e*t,i=t*t,r=t*n,a=n*n,o=n*i,13.72-.332447*e+.0068612*t+.0041116*n-37436e-8*i+121272e-10*r-1699e-10*a+875e-12*o):c<1900?(e=c-1860,t=e*e,n=e*t,i=t*t,r=t*n,7.62+.5737*e-.251754*t+.01680668*n-.0004473624*i+r/233174):c<1920?(e=c-1900,t=e*e,n=e*t,i=t*t,-2.79+1.494119*e-.0598939*t+.0061966*n-197e-6*i):c<1941?(e=c-1920,t=e*e,n=e*t,21.2+.84493*e-.0761*t+.0020936*n):c<1961?(e=c-1950,t=e*e,n=e*t,29.07+.407*e-t/233+n/2547):c<1986?(e=c-1975,t=e*e,n=e*t,45.45+1.067*e-t/260-n/718):c<2005?(e=c-2e3,t=e*e,n=e*t,i=t*t,r=t*n,63.86+.3345*e-.060374*t+.0017275*n+651814e-9*i+2373599e-11*r):c<2050?(e=c-2e3,62.92+.32217*e+.005589*e*e):c<2150?(e=(c-1820)/100,-20+32*e*e-.5628*(2150-c)):(e=(c-1820)/100,-20+32*e*e)}let AS=ES;function Df(s){return s+AS(s)/86400}class Fr{constructor(e){if(e instanceof Fr){this.date=e.date,this.ut=e.ut,this.tt=e.tt;return}const t=1e3*3600*24;if(e instanceof Date&&Number.isFinite(e.getTime())){this.date=e,this.ut=(e.getTime()-Tf.getTime())/t,this.tt=Df(this.ut);return}if(Number.isFinite(e)){this.date=new Date(Tf.getTime()+e*t),this.ut=e,this.tt=Df(this.ut);return}throw"Argument must be a Date object, an AstroTime object, or a numeric UTC Julian date."}static FromTerrestrialTime(e){let t=new Fr(e);for(;;){const n=e-t.tt;if(Math.abs(n)<1e-12)return t;t=t.AddDays(n)}}toString(){return this.date.toISOString()}AddDays(e){return new Fr(this.ut+e)}}function Tt(s){return s instanceof Fr?s:new Fr(s)}function TS(s){function e(d){return d%gS*Tr}const t=s.tt/36525,n=e(128710479305e-5+t*1295965810481e-4),i=e(335779.526232+t*17395272628478e-4),r=e(107226070369e-5+t*1602961601209e-3),a=e(450160.398036-t*69628905431e-4);let o=Math.sin(a),c=Math.cos(a),l=(-172064161-174666*t)*o+33386*c,h=(92052331+9086*t)*c+15377*o,u=2*(i-r+a);return o=Math.sin(u),c=Math.cos(u),l+=(-13170906-1675*t)*o-13696*c,h+=(5730336-3015*t)*c-4587*o,u=2*(i+a),o=Math.sin(u),c=Math.cos(u),l+=(-2276413-234*t)*o+2796*c,h+=(978459-485*t)*c+1374*o,u=2*a,o=Math.sin(u),c=Math.cos(u),l+=(2074554+207*t)*o-698*c,h+=(-897492+470*t)*c-291*o,o=Math.sin(n),c=Math.cos(n),l+=(1475877-3633*t)*o+11817*c,h+=(73871-184*t)*c-1924*o,{dpsi:-135e-6+l*1e-7,deps:388e-6+h*1e-7}}function km(s){var e=s.tt/36525,t=((((-434e-10*e-576e-9)*e+.0020034)*e-1831e-7)*e-46.836769)*e+84381.406;return t/3600}var zo;function Za(s){if(!zo||Math.abs(zo.tt-s.tt)>1e-6){const e=TS(s),t=km(s),n=t+e.deps/3600;zo={tt:s.tt,dpsi:e.dpsi,deps:e.deps,ee:e.dpsi*Math.cos(t*ot)/15,mobl:t,tobl:n}}return zo}function RS(s,e){const t=s*ot,n=Math.cos(t),i=Math.sin(t);return[e[0],e[1]*n-e[2]*i,e[1]*i+e[2]*n]}function DS(s,e){return RS(km(s),e)}function CS(s){const e=s.tt/36525;function t(Te,xe){const Ne=[];let Oe;for(Oe=0;Oe<=xe-Te;++Oe)Ne.push(0);return{min:Te,array:Ne}}function n(Te,xe,Ne,Oe){const Ue=[];for(let nt=0;nt<=xe-Te;++nt)Ue.push(t(Ne,Oe));return{min:Te,array:Ue}}function i(Te,xe,Ne){const Oe=Te.array[xe-Te.min];return Oe.array[Ne-Oe.min]}function r(Te,xe,Ne,Oe){const Ue=Te.array[xe-Te.min];Ue.array[Ne-Ue.min]=Oe}let a,o,c,l,h,u,d,f,p,v,m,g,b,w,_,S,E,R,M,A,P,D,I,F=n(-6,6,1,4),H=n(-6,6,1,4);function O(Te,xe){return i(F,Te,xe)}function V(Te,xe){return i(H,Te,xe)}function z(Te,xe,Ne){return r(F,Te,xe,Ne)}function Y(Te,xe,Ne){return r(H,Te,xe,Ne)}function ee(Te,xe,Ne,Oe,Ue){Ue(Te*Ne-xe*Oe,xe*Ne+Te*Oe)}function Z(Te){return Math.sin(Ui*Te)}d=e*e,p=0,I=0,m=0,g=3422.7;var ne=Z(.19833+.05611*e),ae=Z(.27869+.04508*e),He=Z(.16827-.36903*e),$e=Z(.34734-5.37261*e),Be=Z(.10498-5.37899*e),K=Z(.42681-.41855*e),re=Z(.14943-5.37511*e);for(R=.84*ne+.31*ae+14.27*He+7.26*$e+.28*Be+.24*K,M=2.94*ne+.31*ae+14.27*He+9.34*$e+1.12*Be+.83*K,A=-6.4*ne-1.89*K,P=.21*ne+.31*ae+14.27*He-88.7*$e-15.3*Be+.24*K-1.86*re,D=R-A,f=-3332e-9*Z(.59734-5.37261*e)-539e-9*Z(.35498-5.37899*e)-64e-9*Z(.39943-5.37511*e),b=Ui*_r(.60643382+1336.85522467*e-313e-8*d)+R/as,w=Ui*_r(.37489701+1325.55240982*e+2565e-8*d)+M/as,_=Ui*_r(.99312619+99.99735956*e-44e-8*d)+A/as,S=Ui*_r(.25909118+1342.2278298*e-892e-8*d)+P/as,E=Ui*_r(.82736186+1236.85308708*e-397e-8*d)+D/as,h=1;h<=4;++h){switch(h){case 1:c=w,o=4,l=1.000002208;break;case 2:c=_,o=3,l=.997504612-.002495388*e;break;case 3:c=S,o=4,l=1.000002708+139.978*f;break;case 4:c=E,o=6,l=1;break;default:throw`Internal error: I = ${h}`}for(z(0,h,1),z(1,h,Math.cos(c)*l),Y(0,h,0),Y(1,h,Math.sin(c)*l),u=2;u<=o;++u)ee(O(u-1,h),V(u-1,h),O(1,h),V(1,h),(Te,xe)=>(z(u,h,Te),Y(u,h,xe)));for(u=1;u<=o;++u)z(-u,h,O(u,h)),Y(-u,h,-V(u,h))}function ie(Te,xe,Ne,Oe){for(var Ue={x:1,y:0},nt=[0,Te,xe,Ne,Oe],it=1;it<=4;++it)nt[it]!==0&&ee(Ue.x,Ue.y,O(nt[it],it),V(nt[it],it),(Rt,_t)=>(Ue.x=Rt,Ue.y=_t));return Ue}function B(Te,xe,Ne,Oe,Ue,nt,it,Rt){var _t=ie(Ue,nt,it,Rt);p+=Te*_t.y,I+=xe*_t.y,m+=Ne*_t.x,g+=Oe*_t.x}B(13.902,14.06,-.001,.2607,0,0,0,4),B(.403,-4.01,.394,.0023,0,0,0,3),B(2369.912,2373.36,.601,28.2333,0,0,0,2),B(-125.154,-112.79,-.725,-.9781,0,0,0,1),B(1.979,6.98,-.445,.0433,1,0,0,4),B(191.953,192.72,.029,3.0861,1,0,0,2),B(-8.466,-13.51,.455,-.1093,1,0,0,1),B(22639.5,22609.07,.079,186.5398,1,0,0,0),B(18.609,3.59,-.094,.0118,1,0,0,-1),B(-4586.465,-4578.13,-.077,34.3117,1,0,0,-2),B(3.215,5.44,.192,-.0386,1,0,0,-3),B(-38.428,-38.64,.001,.6008,1,0,0,-4),B(-.393,-1.43,-.092,.0086,1,0,0,-6),B(-.289,-1.59,.123,-.0053,0,1,0,4),B(-24.42,-25.1,.04,-.3,0,1,0,2),B(18.023,17.93,.007,.1494,0,1,0,1),B(-668.146,-126.98,-1.302,-.3997,0,1,0,0),B(.56,.32,-.001,-.0037,0,1,0,-1),B(-165.145,-165.06,.054,1.9178,0,1,0,-2),B(-1.877,-6.46,-.416,.0339,0,1,0,-4),B(.213,1.02,-.074,.0054,2,0,0,4),B(14.387,14.78,-.017,.2833,2,0,0,2),B(-.586,-1.2,.054,-.01,2,0,0,1),B(769.016,767.96,.107,10.1657,2,0,0,0),B(1.75,2.01,-.018,.0155,2,0,0,-1),B(-211.656,-152.53,5.679,-.3039,2,0,0,-2),B(1.225,.91,-.03,-.0088,2,0,0,-3),B(-30.773,-34.07,-.308,.3722,2,0,0,-4),B(-.57,-1.4,-.074,.0109,2,0,0,-6),B(-2.921,-11.75,.787,-.0484,1,1,0,2),B(1.267,1.52,-.022,.0164,1,1,0,1),B(-109.673,-115.18,.461,-.949,1,1,0,0),B(-205.962,-182.36,2.056,1.4437,1,1,0,-2),B(.233,.36,.012,-.0025,1,1,0,-3),B(-4.391,-9.66,-.471,.0673,1,1,0,-4),B(.283,1.53,-.111,.006,1,-1,0,4),B(14.577,31.7,-1.54,.2302,1,-1,0,2),B(147.687,138.76,.679,1.1528,1,-1,0,0),B(-1.089,.55,.021,0,1,-1,0,-1),B(28.475,23.59,-.443,-.2257,1,-1,0,-2),B(-.276,-.38,-.006,-.0036,1,-1,0,-3),B(.636,2.27,.146,-.0102,1,-1,0,-4),B(-.189,-1.68,.131,-.0028,0,2,0,2),B(-7.486,-.66,-.037,-.0086,0,2,0,0),B(-8.096,-16.35,-.74,.0918,0,2,0,-2),B(-5.741,-.04,0,-9e-4,0,0,2,2),B(.255,0,0,0,0,0,2,1),B(-411.608,-.2,0,-.0124,0,0,2,0),B(.584,.84,0,.0071,0,0,2,-1),B(-55.173,-52.14,0,-.1052,0,0,2,-2),B(.254,.25,0,-.0017,0,0,2,-3),B(.025,-1.67,0,.0031,0,0,2,-4),B(1.06,2.96,-.166,.0243,3,0,0,2),B(36.124,50.64,-1.3,.6215,3,0,0,0),B(-13.193,-16.4,.258,-.1187,3,0,0,-2),B(-1.187,-.74,.042,.0074,3,0,0,-4),B(-.293,-.31,-.002,.0046,3,0,0,-6),B(-.29,-1.45,.116,-.0051,2,1,0,2),B(-7.649,-10.56,.259,-.1038,2,1,0,0),B(-8.627,-7.59,.078,-.0192,2,1,0,-2),B(-2.74,-2.54,.022,.0324,2,1,0,-4),B(1.181,3.32,-.212,.0213,2,-1,0,2),B(9.703,11.67,-.151,.1268,2,-1,0,0),B(-.352,-.37,.001,-.0028,2,-1,0,-1),B(-2.494,-1.17,-.003,-.0017,2,-1,0,-2),B(.36,.2,-.012,-.0043,2,-1,0,-4),B(-1.167,-1.25,.008,-.0106,1,2,0,0),B(-7.412,-6.12,.117,.0484,1,2,0,-2),B(-.311,-.65,-.032,.0044,1,2,0,-4),B(.757,1.82,-.105,.0112,1,-2,0,2),B(2.58,2.32,.027,.0196,1,-2,0,0),B(2.533,2.4,-.014,-.0212,1,-2,0,-2),B(-.344,-.57,-.025,.0036,0,3,0,-2),B(-.992,-.02,0,0,1,0,2,2),B(-45.099,-.02,0,-.001,1,0,2,0),B(-.179,-9.52,0,-.0833,1,0,2,-2),B(-.301,-.33,0,.0014,1,0,2,-4),B(-6.382,-3.37,0,-.0481,1,0,-2,2),B(39.528,85.13,0,-.7136,1,0,-2,0),B(9.366,.71,0,-.0112,1,0,-2,-2),B(.202,.02,0,0,1,0,-2,-4),B(.415,.1,0,.0013,0,1,2,0),B(-2.152,-2.26,0,-.0066,0,1,2,-2),B(-1.44,-1.3,0,.0014,0,1,-2,2),B(.384,-.04,0,0,0,1,-2,-2),B(1.938,3.6,-.145,.0401,4,0,0,0),B(-.952,-1.58,.052,-.013,4,0,0,-2),B(-.551,-.94,.032,-.0097,3,1,0,0),B(-.482,-.57,.005,-.0045,3,1,0,-2),B(.681,.96,-.026,.0115,3,-1,0,0),B(-.297,-.27,.002,-9e-4,2,2,0,-2),B(.254,.21,-.003,0,2,-2,0,-2),B(-.25,-.22,.004,.0014,1,3,0,-2),B(-3.996,0,0,4e-4,2,0,2,0),B(.557,-.75,0,-.009,2,0,2,-2),B(-.459,-.38,0,-.0053,2,0,-2,2),B(-1.298,.74,0,4e-4,2,0,-2,0),B(.538,1.14,0,-.0141,2,0,-2,-2),B(.263,.02,0,0,1,1,2,0),B(.426,.07,0,-6e-4,1,1,-2,-2),B(-.304,.03,0,3e-4,1,-1,2,0),B(-.372,-.19,0,-.0027,1,-1,-2,2),B(.418,0,0,0,0,0,4,0),B(-.33,-.04,0,0,3,0,2,0);function we(Te,xe,Ne,Oe,Ue){return Te*ie(xe,Ne,Oe,Ue).y}v=0,v+=we(-526.069,0,0,1,-2),v+=we(-3.352,0,0,1,-4),v+=we(44.297,1,0,1,-2),v+=we(-6,1,0,1,-4),v+=we(20.599,-1,0,1,0),v+=we(-30.598,-1,0,1,-2),v+=we(-24.649,-2,0,1,0),v+=we(-2,-2,0,1,-2),v+=we(-22.571,0,1,1,-2),v+=we(10.985,0,-1,1,-2),p+=.82*Z(.7736-62.5512*e)+.31*Z(.0466-125.1025*e)+.35*Z(.5785-25.1042*e)+.66*Z(.4591+1335.8075*e)+.64*Z(.313-91.568*e)+1.14*Z(.148+1331.2898*e)+.21*Z(.5918+1056.5859*e)+.44*Z(.5784+1322.8595*e)+.24*Z(.2275-5.7374*e)+.28*Z(.2965+2.6929*e)+.33*Z(.3132+6.3368*e),a=S+I/as;let Ie=(1.000002708+139.978*f)*(18518.511+1.189+m)*Math.sin(a)-6.24*Math.sin(3*a)+v;return{geo_eclip_lon:Ui*_r((b+p/as)/Ui),geo_eclip_lat:Math.PI/(180*3600)*Ie,distance_au:as*_S/(.999953253*g)}}function zm(s,e){return[s.rot[0][0]*e[0]+s.rot[1][0]*e[1]+s.rot[2][0]*e[2],s.rot[0][1]*e[0]+s.rot[1][1]*e[1]+s.rot[2][1]*e[2],s.rot[0][2]*e[0]+s.rot[1][2]*e[1]+s.rot[2][2]*e[2]]}function Cc(s,e,t){const n=ud(e,t);return zm(n,s)}function ud(s,e){const t=s.tt/36525;let n=84381.406,i=((((-951e-10*t+132851e-9)*t-.00114045)*t-1.0790069)*t+5038.481507)*t,r=((((3337e-10*t-467e-9)*t-.00772503)*t+.0512623)*t-.025754)*t+n,a=((((-56e-9*t+170663e-9)*t-.00121197)*t-2.3814292)*t+10.556403)*t;n*=Tr,i*=Tr,r*=Tr,a*=Tr;const o=Math.sin(n),c=Math.cos(n),l=Math.sin(-i),h=Math.cos(-i),u=Math.sin(-r),d=Math.cos(-r),f=Math.sin(a),p=Math.cos(a),v=p*h-l*f*d,m=p*l*c+f*d*h*c-o*f*u,g=p*l*o+f*d*h*o+c*f*u,b=-f*h-l*p*d,w=-f*l*c+p*d*h*c-o*p*u,_=-f*l*o+p*d*h*o+c*p*u,S=l*u,E=-u*h*c-o*d,R=-u*h*o+d*c;if(e===on.Into2000)return new xs([[v,m,g],[b,w,_],[S,E,R]]);if(e===on.From2000)return new xs([[v,b,S],[m,w,E],[g,_,R]]);throw"Invalid precess direction"}function PS(s){const e=.779057273264+.00273781191135448*s.ut,t=s.ut%1;let n=360*((e+t)%1);return n<0&&(n+=360),n}let Bo;function Gc(s){if(!Bo||Bo.tt!==s.tt){const e=s.tt/36525;let t=15*Za(s).ee;const n=PS(s);let r=((t+.014506+((((-368e-10*e-29956e-9)*e-44e-8)*e+1.3915817)*e+4612.156534)*e)/3600+n)%360/15;r<0&&(r+=24),Bo={tt:s.tt,st:r}}return Bo.st}function IS(s){const e=Tt(s);return Gc(e)}function Bm(s,e){const t=s.latitude*ot,n=Math.sin(t),i=Math.cos(t),r=1/Math.hypot(i,fu*n),a=xS*r,o=s.height/1e3,c=pu*r+o,l=pu*a+o,h=(15*e+s.longitude)*ot,u=Math.sin(h),d=Math.cos(h);return{pos:[c*i*d/Is,c*i*u/Is,l*n/Is],vel:[-Rf*c*i*u*86400/Is,Rf*c*i*d*86400/Is,0]}}function xu(s,e,t){const n=dd(e,t);return zm(n,s)}function dd(s,e){const t=Za(s),n=t.mobl*ot,i=t.tobl*ot,r=t.dpsi*Tr,a=Math.cos(n),o=Math.sin(n),c=Math.cos(i),l=Math.sin(i),h=Math.cos(r),u=Math.sin(r),d=h,f=-u*a,p=-u*o,v=u*c,m=h*a*c+o*l,g=h*o*c-a*l,b=u*l,w=h*a*l-o*c,_=h*o*l+a*c;if(e===on.From2000)return new xs([[d,v,b],[f,m,w],[p,g,_]]);if(e===on.Into2000)return new xs([[d,f,p],[v,m,g],[b,w,_]]);throw"Invalid precess direction"}function fd(s,e,t){return t===on.Into2000?Cc(xu(s,e,t),e,t):xu(Cc(s,e,t),e,t)}function LS(s,e){const t=Gc(s),n=Bm(e,t).pos;return fd(n,s,on.Into2000)}class vt{constructor(e,t,n,i){this.x=e,this.y=t,this.z=n,this.t=i}Length(){return Math.hypot(this.x,this.y,this.z)}}class ms{constructor(e,t,n,i,r,a,o){this.x=e,this.y=t,this.z=n,this.vx=i,this.vy=r,this.vz=a,this.t=o}}class Vc{constructor(e,t,n){this.lat=tn(e),this.lon=tn(t),this.dist=tn(n)}}class _u{constructor(e,t,n,i){this.ra=tn(e),this.dec=tn(t),this.dist=tn(n),this.vec=i}}class xs{constructor(e){this.rot=e}}class NS{constructor(e,t,n,i){this.azimuth=tn(e),this.altitude=tn(t),this.ra=tn(n),this.dec=tn(i)}}class OS{constructor(e,t,n){this.vec=e,this.elat=tn(t),this.elon=tn(n)}}function Hm(s,e){return new vt(s[0],s[1],s[2],e)}function US(s,e){const t=Hm(s,e),n=t.x*t.x+t.y*t.y,i=Math.sqrt(n+t.z*t.z);if(n===0){if(t.z===0)throw"Indeterminate sky coordinates";return new _u(0,t.z<0?-90:90,i,t)}let r=Om*Math.atan2(t.y,t.x);r<0&&(r+=24);const a=Ti*Math.atan2(s[2],Math.sqrt(n));return new _u(r,a,i,t)}function kl(s,e){const t=s*ot,n=Math.cos(t),i=Math.sin(t);return[n*e[0]+i*e[1],n*e[1]-i*e[0],e[2]]}function Gm(s,e,t,n,i){let r=Tt(s);pd(e),tn(t),tn(n);const a=Math.sin(e.latitude*ot),o=Math.cos(e.latitude*ot),c=Math.sin(e.longitude*ot),l=Math.cos(e.longitude*ot),h=Math.sin(n*ot),u=Math.cos(n*ot),d=Math.sin(t*Af),f=Math.cos(t*Af);let p=[o*l,o*c,a],v=[-a*l,-a*c,o],m=[c,-l,0];const g=-15*Gc(r);let b=kl(g,p),w=kl(g,v),_=kl(g,m),S=[u*f,u*d,h];const E=S[0]*b[0]+S[1]*b[1]+S[2]*b[2],R=S[0]*w[0]+S[1]*w[1]+S[2]*w[2],M=S[0]*_[0]+S[1]*_[1]+S[2]*_[2];let A=Math.hypot(R,M),P;A>0?(P=-Ti*Math.atan2(M,R),P<0&&(P+=360)):P=0;let D=Ti*Math.atan2(A,E),I=t,F=n;if(i){let H=D,O=Zm(i,90-D);if(D-=O,O>0&&D>3e-4){const V=Math.sin(D*ot),z=Math.cos(D*ot),Y=Math.sin(H*ot),ee=Math.cos(H*ot),Z=[];for(let ne=0;ne<3;++ne)Z.push((S[ne]-ee*b[ne])/Y*V+b[ne]*z);A=Math.hypot(Z[0],Z[1]),A>0?(I=Om*Math.atan2(Z[1],Z[0]),I<0&&(I+=24)):I=0,F=Ti*Math.atan2(Z[2],A)}}return new NS(P,90-D,I,F)}function pd(s){if(!(s instanceof md))throw`Not an instance of the Observer class: ${s}`;if(tn(s.latitude),tn(s.longitude),tn(s.height),s.latitude<-90||s.latitude>90)throw`Latitude ${s.latitude} is out of range. Must be -90..+90.`;return s}class md{constructor(e,t,n){this.latitude=e,this.longitude=t,this.height=n,pd(this)}}function FS(s){const e=Tt(s).AddDays(-1/cd),t=zr(wi.Earth,e),n=[-t.x,-t.y,-t.z],[i,r,a]=fd(n,e,on.From2000),o=ot*Za(e).tobl,c=Math.cos(o),l=Math.sin(o),h=new vt(i,r,a,e);return Vm(h,c,l)}function kS(s,e,t,n,i){pd(t),Dc(n),Dc(i);const r=Tt(e),a=LS(r,t),o=Cu(s,r,i),c=[o.x-a[0],o.y-a[1],o.z-a[2]],l=fd(c,r,on.From2000);return US(l,r)}function zS(s,e,t){const n=Tt(s),i=Gc(n);let r=Bm(e,i).pos;return Hm(r,n)}function Vm(s,e,t){const n=s.x,i=s.y*e+s.z*t,r=-s.y*t+s.z*e,a=Math.hypot(n,i);let o=0;a>0&&(o=Ti*Math.atan2(i,n),o<0&&(o+=360));let c=Ti*Math.atan2(r,a),l=new vt(n,i,r,s.t);return new OS(l,c,o)}function yu(s){const e=Za(s.t),t=[s.x,s.y,s.z],n=Cc(t,s.t,on.From2000),[i,r,a]=xu(n,s.t,on.From2000),o=new vt(i,r,a,s.t),c=e.tobl*ot;return Vm(o,Math.cos(c),Math.sin(c))}function Xr(s){const e=Tt(s),t=CS(e),n=t.distance_au*Math.cos(t.geo_eclip_lat),i=[n*Math.cos(t.geo_eclip_lon),n*Math.sin(t.geo_eclip_lon),t.distance_au*Math.sin(t.geo_eclip_lat)],r=DS(e,i),a=Cc(r,e,on.Into2000);return new vt(a[0],a[1],a[2],e)}function Wm(s){const e=Tt(s),t=1e-5,n=e.AddDays(-t),i=e.AddDays(+t),r=Xr(n),a=Xr(i);return new ms((r.x+a.x)/2,(r.y+a.y)/2,(r.z+a.z)/2,(a.x-r.x)/(2*t),(a.y-r.y)/(2*t),(a.z-r.z)/(2*t),e)}function BS(s){const e=Tt(s),t=Wm(e),n=1+Fm;return new ms(t.x/n,t.y/n,t.z/n,t.vx/n,t.vy/n,t.vz/n,e)}function kr(s,e,t){let n=1,i=0;for(let r of s){let a=0;for(let[c,l,h]of r)a+=c*Math.cos(l+e*h);let o=n*a;t&&(o%=Ui),i+=o,n*=e}return i}function zl(s,e){let t=1,n=0,i=0,r=0;for(let a of s){let o=0,c=0;for(let[l,h,u]of a){let d=h+e*u;o+=l*u*Math.sin(d),r>0&&(c+=l*Math.cos(d))}i+=r*n*c-t*o,n=t,t*=e,++r}return i}const Sa=365250,Su=0,bu=1,wu=2;function Eu(s){return new dn(s[0]+44036e-11*s[1]-190919e-12*s[2],-479966e-12*s[0]+.917482137087*s[1]-.397776982902*s[2],.397776982902*s[1]+.917482137087*s[2])}function Xm(s,e,t){const n=t*Math.cos(e),i=Math.cos(s),r=Math.sin(s);return[n*i,n*r,t*Math.sin(e)]}function zr(s,e){const t=e.tt/Sa,n=kr(s[Su],t,!0),i=kr(s[bu],t,!1),r=kr(s[wu],t,!1),a=Xm(n,i,r);return Eu(a).ToAstroVector(e)}function Au(s,e){const t=e/Sa,n=kr(s[Su],t,!0),i=kr(s[bu],t,!1),r=kr(s[wu],t,!1),a=zl(s[Su],t),o=zl(s[bu],t),c=zl(s[wu],t),l=Math.cos(n),h=Math.sin(n),u=Math.cos(i),d=Math.sin(i),f=+(c*u*l)-r*d*l*o-r*u*h*a,p=+(c*u*h)-r*d*h*o+r*u*l*a,v=+(c*d)+r*u*o,m=Xm(n,i,r),g=[f/Sa,p/Sa,v/Sa],b=Eu(m),w=Eu(g);return new Ws(e,b,w)}function Ho(s,e,t,n){const i=n/(n+ld),r=zr(wi[t],e);s.x+=i*r.x,s.y+=i*r.y,s.z+=i*r.z}function HS(s){const e=new vt(0,0,0,s);return Ho(e,s,Se.Jupiter,mu),Ho(e,s,Se.Saturn,gu),Ho(e,s,Se.Uranus,vu),Ho(e,s,Se.Neptune,Mu),e}const Tu=51,GS=29200,Rr=146,Fi=201,ks=[[-73e4,[-26.118207232108,-14.376168177825,3.384402515299],[.0016339372163656,-.0027861699588508,-.0013585880229445]],[-700800,[41.974905202127,-.448502952929,-12.770351505989],[.00073458569351457,.0022785014891658,.00048619778602049]],[-671600,[14.706930780744,44.269110540027,9.353698474772],[-.00210001479998,.00022295915939915,.00070143443551414]],[-642400,[-29.441003929957,-6.43016153057,6.858481011305],[.00084495803960544,-.0030783914758711,-.0012106305981192]],[-613200,[39.444396946234,-6.557989760571,-13.913760296463],[.0011480029005873,.0022400006880665,.00035168075922288]],[-584e3,[20.2303809507,43.266966657189,7.382966091923],[-.0019754081700585,.00053457141292226,.00075929169129793]],[-554800,[-30.65832536462,2.093818874552,9.880531138071],[61010603013347e-18,-.0031326500935382,-.00099346125151067]],[-525600,[35.737703251673,-12.587706024764,-14.677847247563],[.0015802939375649,.0021347678412429,.00019074436384343]],[-496400,[25.466295188546,41.367478338417,5.216476873382],[-.0018054401046468,.0008328308359951,.00080260156912107]],[-467200,[-29.847174904071,10.636426313081,12.297904180106],[-.00063257063052907,-.0029969577578221,-.00074476074151596]],[-438e3,[30.774692107687,-18.236637015304,-14.945535879896],[.0020113162005465,.0019353827024189,-20937793168297e-19]],[-408800,[30.243153324028,38.656267888503,2.938501750218],[-.0016052508674468,.0011183495337525,.00083333973416824]],[-379600,[-27.288984772533,18.643162147874,14.023633623329],[-.0011856388898191,-.0027170609282181,-.00049015526126399]],[-350400,[24.519605196774,-23.245756064727,-14.626862367368],[.0024322321483154,.0016062008146048,-.00023369181613312]],[-321200,[34.505274805875,35.125338586954,.557361475637],[-.0013824391637782,.0013833397561817,.00084823598806262]],[-292e3,[-23.275363915119,25.818514298769,15.055381588598],[-.0016062295460975,-.0023395961498533,-.00024377362639479]],[-262800,[17.050384798092,-27.180376290126,-13.608963321694],[.0028175521080578,.0011358749093955,-.00049548725258825]],[-233600,[38.093671910285,30.880588383337,-1.843688067413],[-.0011317697153459,.0016128814698472,.00084177586176055]],[-204400,[-18.197852930878,31.932869934309,15.438294826279],[-.0019117272501813,-.0019146495909842,-19657304369835e-18]],[-175200,[8.528924039997,-29.618422200048,-11.805400994258],[.0031034370787005,.0005139363329243,-.00077293066202546]],[-146e3,[40.94685725864,25.904973592021,-4.256336240499],[-.00083652705194051,.0018129497136404,.0008156422827306]],[-116800,[-12.326958895325,36.881883446292,15.217158258711],[-.0021166103705038,-.001481442003599,.00017401209844705]],[-87600,[-.633258375909,-30.018759794709,-9.17193287495],[.0032016994581737,-.00025279858672148,-.0010411088271861]],[-58400,[42.936048423883,20.344685584452,-6.588027007912],[-.00050525450073192,.0019910074335507,.00077440196540269]],[-29200,[-5.975910552974,40.61180995846,14.470131723673],[-.0022184202156107,-.0010562361130164,.00033652250216211]],[0,[-9.875369580774,-27.978926224737,-5.753711824704],[.0030287533248818,-.0011276087003636,-.0012651326732361]],[29200,[43.958831986165,14.214147973292,-8.808306227163],[-.00014717608981871,.0021404187242141,.00071486567806614]],[58400,[.67813676352,43.094461639362,13.243238780721],[-.0022358226110718,-.00063233636090933,.00047664798895648]],[87600,[-18.282602096834,-23.30503958666,-1.766620508028],[.0025567245263557,-.0019902940754171,-.0013943491701082]],[116800,[43.873338744526,7.700705617215,-10.814273666425],[.00023174803055677,.0022402163127924,.00062988756452032]],[146e3,[7.392949027906,44.382678951534,11.629500214854],[-.002193281545383,-.00021751799585364,.00059556516201114]],[175200,[-24.981690229261,-16.204012851426,2.466457544298],[.001819398914958,-.0026765419531201,-.0013848283502247]],[204400,[42.530187039511,.845935508021,-12.554907527683],[.00065059779150669,.0022725657282262,.00051133743202822]],[233600,[13.999526486822,44.462363044894,9.669418486465],[-.0021079296569252,.00017533423831993,.00069128485798076]],[262800,[-29.184024803031,-7.371243995762,6.493275957928],[.00093581363109681,-.0030610357109184,-.0012364201089345]],[292e3,[39.831980671753,-6.078405766765,-13.909815358656],[.0011117769689167,.0022362097830152,.00036230548231153]],[321200,[20.294955108476,43.417190420251,7.450091985932],[-.0019742157451535,.00053102050468554,.00075938408813008]],[350400,[-30.66999230216,2.318743558955,9.973480913858],[45605107450676e-18,-.0031308219926928,-.00099066533301924]],[379600,[35.626122155983,-12.897647509224,-14.777586508444],[.0016015684949743,.0021171931182284,.00018002516202204]],[408800,[26.133186148561,41.232139187599,5.00640132622],[-.0017857704419579,.00086046232702817,.00080614690298954]],[438e3,[-29.57674022923,11.863535943587,12.631323039872],[-.00072292830060955,-.0029587820140709,-.000708242964503]],[467200,[29.910805787391,-19.159019294,-15.013363865194],[.0020871080437997,.0018848372554514,-38528655083926e-18]],[496400,[31.375957451819,38.050372720763,2.433138343754],[-.0015546055556611,.0011699815465629,.00083565439266001]],[525600,[-26.360071336928,20.662505904952,14.414696258958],[-.0013142373118349,-.0026236647854842,-.00042542017598193]],[554800,[22.599441488648,-24.508879898306,-14.484045731468],[.0025454108304806,.0014917058755191,-.00030243665086079]],[584e3,[35.877864013014,33.894226366071,-.224524636277],[-.0012941245730845,.0014560427668319,.00084762160640137]],[613200,[-21.538149762417,28.204068269761,15.321973799534],[-.001731211740901,-.0021939631314577,-.0001631691327518]],[642400,[13.971521374415,-28.339941764789,-13.083792871886],[.0029334630526035,.00091860931752944,-.00059939422488627]],[671600,[39.526942044143,28.93989736011,-2.872799527539],[-.0010068481658095,.001702113288809,.00083578230511981]],[700800,[-15.576200701394,34.399412961275,15.466033737854],[-.0020098814612884,-.0017191109825989,70414782780416e-18]],[73e4,[4.24325283709,-30.118201690825,-10.707441231349],[.0031725847067411,.0001609846120227,-.00090672150593868]]];class dn{constructor(e,t,n){this.x=e,this.y=t,this.z=n}clone(){return new dn(this.x,this.y,this.z)}ToAstroVector(e){return new vt(this.x,this.y,this.z,e)}static zero(){return new dn(0,0,0)}quadrature(){return this.x*this.x+this.y*this.y+this.z*this.z}add(e){return new dn(this.x+e.x,this.y+e.y,this.z+e.z)}sub(e){return new dn(this.x-e.x,this.y-e.y,this.z-e.z)}incr(e){this.x+=e.x,this.y+=e.y,this.z+=e.z}decr(e){this.x-=e.x,this.y-=e.y,this.z-=e.z}mul(e){return new dn(e*this.x,e*this.y,e*this.z)}div(e){return new dn(this.x/e,this.y/e,this.z/e)}mean(e){return new dn((this.x+e.x)/2,(this.y+e.y)/2,(this.z+e.z)/2)}neg(){return new dn(-this.x,-this.y,-this.z)}}class Ws{constructor(e,t,n){this.tt=e,this.r=t,this.v=n}clone(){return new Ws(this.tt,this.r,this.v)}sub(e){return new Ws(this.tt,this.r.sub(e.r),this.v.sub(e.v))}}function VS(s){let[e,[t,n,i],[r,a,o]]=s;return new Ws(e,new dn(t,n,i),new dn(r,a,o))}function Go(s,e,t,n){const i=n/(n+ld),r=Au(wi[t],e);return s.r.incr(r.r.mul(i)),s.v.incr(r.v.mul(i)),r}function ua(s,e,t){const n=t.sub(s),i=n.quadrature();return n.mul(e/(i*Math.sqrt(i)))}class Wc{constructor(e){let t=new Ws(e,new dn(0,0,0),new dn(0,0,0));this.Jupiter=Go(t,e,Se.Jupiter,mu),this.Saturn=Go(t,e,Se.Saturn,gu),this.Uranus=Go(t,e,Se.Uranus,vu),this.Neptune=Go(t,e,Se.Neptune,Mu),this.Jupiter.r.decr(t.r),this.Jupiter.v.decr(t.v),this.Saturn.r.decr(t.r),this.Saturn.v.decr(t.v),this.Uranus.r.decr(t.r),this.Uranus.v.decr(t.v),this.Neptune.r.decr(t.r),this.Neptune.v.decr(t.v),this.Sun=new Ws(e,t.r.mul(-1),t.v.mul(-1))}Acceleration(e){let t=ua(e,ld,this.Sun.r);return t.incr(ua(e,mu,this.Jupiter.r)),t.incr(ua(e,gu,this.Saturn.r)),t.incr(ua(e,vu,this.Uranus.r)),t.incr(ua(e,Mu,this.Neptune.r)),t}}class Xc{constructor(e,t,n,i){this.tt=e,this.r=t,this.v=n,this.a=i}clone(){return new Xc(this.tt,this.r.clone(),this.v.clone(),this.a.clone())}}class qm{constructor(e,t){this.bary=e,this.grav=t}}function Pc(s,e,t,n){return new dn(e.x+s*(t.x+s*n.x/2),e.y+s*(t.y+s*n.y/2),e.z+s*(t.z+s*n.z/2))}function Cf(s,e,t){return new dn(e.x+s*t.x,e.y+s*t.y,e.z+s*t.z)}function Ru(s,e){const t=s-e.tt,n=new Wc(s),i=Pc(t,e.r,e.v,e.a),r=n.Acceleration(i).mean(e.a),a=Pc(t,e.r,e.v,r),o=e.v.add(r.mul(t)),c=n.Acceleration(a),l=new Xc(s,a,o,c);return new qm(n,l)}const WS=[];function Ym(s,e){const t=Math.floor(s);return t<0?0:t>=e?e-1:t}function Du(s){const e=VS(s),t=new Wc(e.tt),n=e.r.add(t.Sun.r),i=e.v.add(t.Sun.v),r=t.Acceleration(n),a=new Xc(e.tt,n,i,r);return new qm(t,a)}function XS(s,e){const t=ks[0][0];if(e<t||e>ks[Tu-1][0])return null;const n=Ym((e-t)/GS,Tu-1);if(!s[n]){const r=s[n]=[];r[0]=Du(ks[n]).grav,r[Fi-1]=Du(ks[n+1]).grav;let a,o=r[0].tt;for(a=1;a<Fi-1;++a)r[a]=Ru(o+=Rr,r[a-1]).grav;o=r[Fi-1].tt;var i=[];for(i[Fi-1]=r[Fi-1],a=Fi-2;a>0;--a)i[a]=Ru(o-=Rr,i[a+1]).grav;for(a=Fi-2;a>0;--a){const c=a/(Fi-1);r[a].r=r[a].r.mul(1-c).add(i[a].r.mul(c)),r[a].v=r[a].v.mul(1-c).add(i[a].v.mul(c)),r[a].a=r[a].a.mul(1-c).add(i[a].a.mul(c))}}return s[n]}function Pf(s,e,t){let n=Du(s);const i=Math.ceil((e-n.grav.tt)/t);for(let r=0;r<i;++r)n=Ru(r+1===i?e:n.grav.tt+t,n.grav);return n}function Km(s,e){let t,n,i;const r=XS(WS,s.tt);if(r){const a=Ym((s.tt-r[0].tt)/Rr,Fi-1),o=r[a],c=r[a+1],l=o.a.mean(c.a),h=Pc(s.tt-o.tt,o.r,o.v,l),u=Cf(s.tt-o.tt,o.v,l),d=Pc(s.tt-c.tt,c.r,c.v,l),f=Cf(s.tt-c.tt,c.v,l),p=(s.tt-o.tt)/Rr;t=h.mul(1-p).add(d.mul(p)),n=u.mul(1-p).add(f.mul(p))}else{let a;s.tt<ks[0][0]?a=Pf(ks[0],s.tt,-Rr):a=Pf(ks[Tu-1],s.tt,+Rr),t=a.grav.r,n=a.grav.v,i=a.bary}return i||(i=new Wc(s.tt)),t=t.sub(i.Sun.r),n=n.sub(i.Sun.v),new ms(t.x,t.y,t.z,n.x,n.y,n.z,s)}function vs(s,e){var t=Tt(e);if(s in wi)return zr(wi[s],t);if(s===Se.Pluto){const a=Km(t);return new vt(a.x,a.y,a.z,t)}if(s===Se.Sun)return new vt(0,0,0,t);if(s===Se.Moon){var n=zr(wi.Earth,t),i=Xr(t);return new vt(n.x+i.x,n.y+i.y,n.z+i.z,t)}if(s===Se.EMB){const a=zr(wi.Earth,t),o=Xr(t),c=1+Fm;return new vt(a.x+o.x/c,a.y+o.y/c,a.z+o.z/c,t)}if(s===Se.SSB)return HS(t);const r=hd(s);if(r){const a=new Vc(r.dec,15*r.ra,r.dist);return gd(a,t)}throw`HelioVector: Unknown body "${s}"`}function qS(s,e){let t=e,n=0;for(let i=0;i<10;++i){const r=s(t),a=r.Length()/cd;if(a>1)throw"Object is too distant for light-travel solver.";const o=e.AddDays(-a);if(n=Math.abs(o.tt-t.tt),n<1e-9)return r;t=o}throw`Light-travel time solver did not converge: dt = ${n}`}class YS{constructor(e,t,n,i){this.observerBody=e,this.targetBody=t,this.aberration=n,this.observerPos=i}Position(e){this.aberration&&(this.observerPos=vs(this.observerBody,e));const t=vs(this.targetBody,e);return new vt(t.x-this.observerPos.x,t.y-this.observerPos.y,t.z-this.observerPos.z,e)}}function KS(s,e,t,n){Dc(n);const i=Tt(s);if(hd(t)){const o=vs(t,i);if(n){const l=JS(e,i),h=new vt(o.x-l.x,o.y-l.y,o.z-l.z,i),u=cd/h.Length();return new vt(h.x+l.vx/u,h.y+l.vy/u,h.z+l.vz/u,i)}const c=vs(e,i);return new vt(o.x-c.x,o.y-c.y,o.z-c.z,i)}let r;n?r=new vt(0,0,0,i):r=vs(e,i);const a=new YS(e,t,n,r);return qS(o=>a.Position(o),i)}function Cu(s,e,t){Dc(t);const n=Tt(e);switch(s){case Se.Earth:return new vt(0,0,0,n);case Se.Moon:return Xr(n);default:const i=KS(n,Se.Earth,s,t);return i.t=n,i}}function $S(s,e){return new ms(s.r.x,s.r.y,s.r.z,s.v.x,s.v.y,s.v.z,e)}function JS(s,e){const t=Tt(e);switch(s){case Se.Sun:return new ms(0,0,0,0,0,0,t);case Se.SSB:const n=new Wc(t.tt);return new ms(-n.Sun.r.x,-n.Sun.r.y,-n.Sun.r.z,-n.Sun.v.x,-n.Sun.v.y,-n.Sun.v.z,t);case Se.Mercury:case Se.Venus:case Se.Earth:case Se.Mars:case Se.Jupiter:case Se.Saturn:case Se.Uranus:case Se.Neptune:const i=Au(wi[s],t.tt);return $S(i,t);case Se.Pluto:return Km(t);case Se.Moon:case Se.EMB:const r=Au(wi.Earth,t.tt),a=s==Se.Moon?Wm(t):BS(t);return new ms(a.x+r.r.x,a.y+r.r.y,a.z+r.r.z,a.vx+r.v.x,a.vy+r.v.y,a.vz+r.v.z,t);default:if(hd(s)){const o=vs(s,t);return new ms(o.x,o.y,o.z,0,0,0,t)}throw`HelioState: Unsupported body "${s}"`}}function ZS(s){for(;s<0;)s+=360;for(;s>=360;)s-=360;return s}function jS(s,e,t){if(s===Se.Earth||e===Se.Earth)throw"The Earth does not have a longitude as seen from itself.";const n=Tt(t),i=Cu(s,n,!1),r=yu(i),a=Cu(e,n,!1),o=yu(a);return ZS(r.elon-o.elon)}function QS(s,e,t,n){let i,r=0,a=0,o=0;switch(s){case Se.Mercury:i=-.6,r=4.98,a=-4.88,o=3.02;break;case Se.Venus:e<163.6?(i=-4.47,r=1.03,a=.57,o=.13):(i=.98,r=-1.02);break;case Se.Mars:i=-1.52,r=1.6;break;case Se.Jupiter:i=-9.4,r=.5;break;case Se.Uranus:i=-7.19,r=.25;break;case Se.Neptune:i=-6.87;break;case Se.Pluto:i=-1,r=4;break;default:throw`VisualMagnitude: unsupported body ${s}`}const c=e/100;let l=i+c*(r+c*(a+c*o));return l+=5*Math.log10(t*n),l}function e5(s,e,t,n,i){const r=yu(n),a=ot*28.06,o=ot*(169.51+382e-7*i.tt),c=ot*r.elat,l=ot*r.elon,h=Math.asin(Math.sin(c)*Math.cos(a)-Math.cos(c)*Math.sin(a)*Math.sin(l-o)),u=Math.sin(Math.abs(h));let d=-9+.044*s;return d+=u*(-2.6+1.2*u),d+=5*Math.log10(e*t),{mag:d,ring_tilt:Ti*h}}function t5(s,e,t){let n=s*ot,i=n*n,r=i*i,a=-12.717+1.49*Math.abs(n)+.0431*r;const o=385000.6/Is;let c=t/o;return a+=5*Math.log10(e*c),a}class n5{constructor(e,t,n,i,r,a,o,c){this.time=e,this.mag=t,this.phase_angle=n,this.helio_dist=i,this.geo_dist=r,this.gc=a,this.hc=o,this.ring_tilt=c,this.phase_fraction=(1+Math.cos(ot*n))/2}}function $m(s,e){if(s===Se.Earth)throw"The illumination of the Earth is not defined.";const t=Tt(e),n=zr(wi.Earth,t);let i,r,a,o;s===Se.Sun?(a=new vt(-n.x,-n.y,-n.z,t),r=new vt(0,0,0,t),i=0):(s===Se.Moon?(a=Xr(t),r=new vt(n.x+a.x,n.y+a.y,n.z+a.z,t)):(r=vs(s,e),a=new vt(r.x-n.x,r.y-n.y,r.z-n.z,t)),i=yS(a,r));let c=a.Length(),l=r.Length(),h;if(s===Se.Sun)o=MS+5*Math.log10(c);else if(s===Se.Moon)o=t5(i,l,c);else if(s===Se.Saturn){const u=e5(i,l,c,a,t);o=u.mag,h=u.ring_tilt}else o=QS(s,i,l,c);return new n5(t,o,i,l,c,a,r,h)}function i5(s){return jS(Se.Moon,Se.Sun,s)}var If;(function(s){s[s.Pericenter=0]="Pericenter",s[s.Apocenter=1]="Apocenter"})(If||(If={}));function Jm(s,e){return new xs([[e.rot[0][0]*s.rot[0][0]+e.rot[1][0]*s.rot[0][1]+e.rot[2][0]*s.rot[0][2],e.rot[0][1]*s.rot[0][0]+e.rot[1][1]*s.rot[0][1]+e.rot[2][1]*s.rot[0][2],e.rot[0][2]*s.rot[0][0]+e.rot[1][2]*s.rot[0][1]+e.rot[2][2]*s.rot[0][2]],[e.rot[0][0]*s.rot[1][0]+e.rot[1][0]*s.rot[1][1]+e.rot[2][0]*s.rot[1][2],e.rot[0][1]*s.rot[1][0]+e.rot[1][1]*s.rot[1][1]+e.rot[2][1]*s.rot[1][2],e.rot[0][2]*s.rot[1][0]+e.rot[1][2]*s.rot[1][1]+e.rot[2][2]*s.rot[1][2]],[e.rot[0][0]*s.rot[2][0]+e.rot[1][0]*s.rot[2][1]+e.rot[2][0]*s.rot[2][2],e.rot[0][1]*s.rot[2][0]+e.rot[1][1]*s.rot[2][1]+e.rot[2][1]*s.rot[2][2],e.rot[0][2]*s.rot[2][0]+e.rot[1][2]*s.rot[2][1]+e.rot[2][2]*s.rot[2][2]]])}function gd(s,e){e=Tt(e);const t=s.lat*ot,n=s.lon*ot,i=s.dist*Math.cos(t);return new vt(i*Math.cos(n),i*Math.sin(n),s.dist*Math.sin(t),e)}function vd(s){const e=s5(s);return new _u(e.lon/15,e.lat,e.dist,s)}function s5(s){const e=s.x*s.x+s.y*s.y,t=Math.sqrt(e+s.z*s.z);let n,i;if(e===0){if(s.z===0)throw"Zero-length vector not allowed.";i=0,n=s.z<0?-90:90}else i=Ti*Math.atan2(s.y,s.x),i<0&&(i+=360),n=Ti*Math.atan2(s.z,Math.sqrt(e));return new Vc(n,i,t)}function Zm(s,e){let t;if(tn(e),e<-90||e>90)return 0;if(s==="normal"||s==="jplhor"){let n=e;n<-1&&(n=-1),t=1.02/Math.tan((n+10.3/(n+5.11))*ot)/60,s==="normal"&&e<-1&&(t*=(e+90)/89)}else if(!s)t=0;else throw`Invalid refraction option: ${s}`;return t}function Br(s,e){return new vt(s.rot[0][0]*e.x+s.rot[1][0]*e.y+s.rot[2][0]*e.z,s.rot[0][1]*e.x+s.rot[1][1]*e.y+s.rot[2][1]*e.z,s.rot[0][2]*e.x+s.rot[1][2]*e.y+s.rot[2][2]*e.z,e.t)}function r5(){return new xs([[1,0,0],[0,.9174821430670688,-.3977769691083922],[0,.3977769691083922,.9174821430670688]])}function a5(){return new xs([[1,0,0],[0,.9174821430670688,.3977769691083922],[0,-.3977769691083922,.9174821430670688]])}function jm(s){s=Tt(s);const e=ud(s,on.From2000),t=dd(s,on.From2000);return Jm(e,t)}function o5(s){s=Tt(s);const e=dd(s,on.Into2000),t=ud(s,on.Into2000);return Jm(e,t)}function c5(s){const t=Za(Tt(s)).tobl*ot,n=Math.cos(t),i=Math.sin(t);return new xs([[1,0,0],[0,+n,+i],[0,-i,+n]])}var Lf;(function(s){s.Penumbral="penumbral",s.Partial="partial",s.Annular="annular",s.Total="total"})(Lf||(Lf={}));var Nf;(function(s){s[s.Invalid=0]="Invalid",s[s.Ascending=1]="Ascending",s[s.Descending=-1]="Descending"})(Nf||(Nf={}));const l5=["Venus","Mars","Jupiter","Saturn"];function Qm(s){return new md(s.lat,s.lng,s.elevationM)}function Md(s,e,t,n,i=!0){const r=Gm(t,Qm(n),s,e,i?"normal":void 0);return{altitudeDeg:r.altitude,azimuthDeg:r.azimuth}}class ei{up;north;west;constructor(e,t){const n=Tt(e),i=Math.sin(t.lat*ki),r=Math.cos(t.lat*ki),a=Math.sin(t.lng*ki),o=Math.cos(t.lng*ki),c=-15*IS(n),l=o5(n);this.up=ei.rotate(l,ei.spin(c,[r*o,r*a,i]),n),this.north=ei.rotate(l,ei.spin(c,[-i*o,-i*a,r]),n),this.west=ei.rotate(l,ei.spin(c,[a,-o,0]),n)}static ofJ2000(e,t,n,i,r=!0){const a=Tt(n),o=gd(new Vc(t,e*15,1),a),c=vd(Br(jm(a),o));return Md(c.ra,c.dec,n,i,r)}position(e,t){const n=Math.sin(t*ki),i=Math.cos(t*ki),r=Math.sin(e*Uf),a=Math.cos(e*Uf),o=i*a,c=i*r,l=n,h=o*this.up[0]+c*this.up[1]+l*this.up[2],u=o*this.north[0]+c*this.north[1]+l*this.north[2],d=o*this.west[0]+c*this.west[1]+l*this.west[2],f=Math.hypot(u,d);let p=0;f>0&&(p=-Of*Math.atan2(d,u),p<0&&(p+=360));let v=Of*Math.atan2(f,h);return v-=Zm("normal",90-v),{altitudeDeg:90-v,azimuthDeg:p}}static spin(e,[t,n,i]){const r=Math.cos(e*ki),a=Math.sin(e*ki);return[r*t+a*n,r*n-a*t,i]}static rotate(e,[t,n,i],r){const a=Br(e,new vt(t,n,i,r));return[a.x,a.y,a.z]}}const ki=Math.PI/180,Of=180/Math.PI,Uf=15*ki;function Bl(s,e,t){const n=Qm(t),i=kS(Se[s],e,n,!0,!0),r=Gm(e,n,i.ra,i.dec,"normal");return{altitudeDeg:r.altitude,azimuthDeg:r.azimuth}}function Hl(s,e){return $m(Se[s],e).mag}function h5(s){const e=i5(s),t=$m(Se.Moon,s);return{phaseFraction:e/360,illuminatedFraction:t.phase_fraction}}const u5=2e3,d5=3,f5=20;function Vo(s,e,t){if(s.year===void 0&&s.month===void 0&&s.day===void 0&&s.hour===void 0)return;const n=s.year!==void 0,i=s.year??u5,r=s.month??(n?1:d5),a=s.day??(n?1:f5),o=t??Math.round(e/15);return new Date(Date.UTC(i,r-1,a,(s.hour??12)-o,s.minute??0,s.second??0))}class fs{static ANCHOR="vec4 diffuseColor = vec4( diffuse, opacity );";static CORE=.18;static RIM=.5;static apply(e){e.transparent=!0,e.depthWrite=!1,e.onBeforeCompile=t=>{t.fragmentShader=fs.patch(t.fragmentShader)}}static patch(e){return e.replace(fs.ANCHOR,`float distanceFromCentre = length( gl_PointCoord - vec2( 0.5 ) );
5179
+ */const cd=173.1446326846693,Is=14959787069098932e-8,ot=.017453292519943295,Af=.26179938779914946,Ti=57.29577951308232,Om=3.819718634205488,m5=365.24217,Tf=new Date("2000-01-01T12:00:00Z"),Ui=2*Math.PI,as=3600*(180/Math.PI),Tr=484813681109536e-20,Um=10800*60,g5=2*Um,Rf=7292115e-11,v5=Um/Math.PI,M5=-.17-5*Math.log10(v5),fu=.996647180302104,x5=fu*fu,pu=6378.1366,_5=pu/Is,Fm=81.30056,ld=.0002959122082855911,mu=2825345909524226e-22,gu=8459715185680659e-23,vu=1292024916781969e-23,Mu=1524358900784276e-23;function Dc(s){if(s!==!0&&s!==!1)throw console.trace(),`Value is not boolean: ${s}`;return s}function tn(s){if(!Number.isFinite(s))throw console.trace(),`Value is not a finite number: ${s}`;return s}function _r(s){return s-Math.floor(s)}function y5(s,e){const t=s.x*s.x+s.y*s.y+s.z*s.z;if(Math.abs(t)<1e-8)throw"AngleBetween: first vector is too short.";const n=e.x*e.x+e.y*e.y+e.z*e.z;if(Math.abs(n)<1e-8)throw"AngleBetween: second vector is too short.";const i=(s.x*e.x+s.y*e.y+s.z*e.z)/Math.sqrt(t*n);return i<=-1?180:i>=1?0:Ti*Math.acos(i)}var Se;(function(s){s.Sun="Sun",s.Moon="Moon",s.Mercury="Mercury",s.Venus="Venus",s.Earth="Earth",s.Mars="Mars",s.Jupiter="Jupiter",s.Saturn="Saturn",s.Uranus="Uranus",s.Neptune="Neptune",s.Pluto="Pluto",s.SSB="SSB",s.EMB="EMB",s.Star1="Star1",s.Star2="Star2",s.Star3="Star3",s.Star4="Star4",s.Star5="Star5",s.Star6="Star6",s.Star7="Star7",s.Star8="Star8"})(Se||(Se={}));const S5=[Se.Star1,Se.Star2,Se.Star3,Se.Star4,Se.Star5,Se.Star6,Se.Star7,Se.Star8],b5=[{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0}];function w5(s){const e=S5.indexOf(s);return e>=0?b5[e]:null}function hd(s){const e=w5(s);return e&&e.dist>0?e:null}var on;(function(s){s[s.From2000=0]="From2000",s[s.Into2000=1]="Into2000"})(on||(on={}));const wi={Mercury:[[[[4.40250710144,0,0],[.40989414977,1.48302034195,26087.9031415742],[.050462942,4.47785489551,52175.8062831484],[.00855346844,1.16520322459,78263.70942472259],[.00165590362,4.11969163423,104351.61256629678],[.00034561897,.77930768443,130439.51570787099],[7583476e-11,3.71348404924,156527.41884944518]],[[26087.90313685529,0,0],[.01131199811,6.21874197797,26087.9031415742],[.00292242298,3.04449355541,52175.8062831484],[.00075775081,6.08568821653,78263.70942472259],[.00019676525,2.80965111777,104351.61256629678]]],[[[.11737528961,1.98357498767,26087.9031415742],[.02388076996,5.03738959686,52175.8062831484],[.01222839532,3.14159265359,0],[.0054325181,1.79644363964,78263.70942472259],[.0012977877,4.83232503958,104351.61256629678],[.00031866927,1.58088495658,130439.51570787099],[7963301e-11,4.60972126127,156527.41884944518]],[[.00274646065,3.95008450011,26087.9031415742],[.00099737713,3.14159265359,0]]],[[[.39528271651,0,0],[.07834131818,6.19233722598,26087.9031415742],[.00795525558,2.95989690104,52175.8062831484],[.00121281764,6.01064153797,78263.70942472259],[.00021921969,2.77820093972,104351.61256629678],[4354065e-11,5.82894543774,130439.51570787099]],[[.0021734774,4.65617158665,26087.9031415742],[.00044141826,1.42385544001,52175.8062831484]]]],Venus:[[[[3.17614666774,0,0],[.01353968419,5.59313319619,10213.285546211],[.00089891645,5.30650047764,20426.571092422],[5477194e-11,4.41630661466,7860.4193924392],[3455741e-11,2.6996444782,11790.6290886588],[2372061e-11,2.99377542079,3930.2096962196],[1317168e-11,5.18668228402,26.2983197998],[1664146e-11,4.25018630147,1577.3435424478],[1438387e-11,4.15745084182,9683.5945811164],[1200521e-11,6.15357116043,30639.856638633]],[[10213.28554621638,0,0],[.00095617813,2.4640651111,10213.285546211],[7787201e-11,.6247848222,20426.571092422]]],[[[.05923638472,.26702775812,10213.285546211],[.00040107978,1.14737178112,20426.571092422],[.00032814918,3.14159265359,0]],[[.00287821243,1.88964962838,10213.285546211]]],[[[.72334820891,0,0],[.00489824182,4.02151831717,10213.285546211],[1658058e-11,4.90206728031,20426.571092422],[1378043e-11,1.12846591367,11790.6290886588],[1632096e-11,2.84548795207,7860.4193924392],[498395e-11,2.58682193892,9683.5945811164],[221985e-11,2.01346696541,19367.1891622328],[237454e-11,2.55136053886,15720.8387848784]],[[.00034551041,.89198706276,10213.285546211]]]],Earth:[[[[1.75347045673,0,0],[.03341656453,4.66925680415,6283.0758499914],[.00034894275,4.62610242189,12566.1516999828],[3417572e-11,2.82886579754,3.523118349],[3497056e-11,2.74411783405,5753.3848848968],[3135899e-11,3.62767041756,77713.7714681205],[2676218e-11,4.41808345438,7860.4193924392],[2342691e-11,6.13516214446,3930.2096962196],[1273165e-11,2.03709657878,529.6909650946],[1324294e-11,.74246341673,11506.7697697936],[901854e-11,2.04505446477,26.2983197998],[1199167e-11,1.10962946234,1577.3435424478],[857223e-11,3.50849152283,398.1490034082],[779786e-11,1.17882681962,5223.6939198022],[99025e-10,5.23268072088,5884.9268465832],[753141e-11,2.53339052847,5507.5532386674],[505267e-11,4.58292599973,18849.2275499742],[492392e-11,4.20505711826,775.522611324],[356672e-11,2.91954114478,.0673103028],[284125e-11,1.89869240932,796.2980068164],[242879e-11,.34481445893,5486.777843175],[317087e-11,5.84901948512,11790.6290886588],[271112e-11,.31486255375,10977.078804699],[206217e-11,4.80646631478,2544.3144198834],[205478e-11,1.86953770281,5573.1428014331],[202318e-11,2.45767790232,6069.7767545534],[126225e-11,1.08295459501,20.7753954924],[155516e-11,.83306084617,213.299095438]],[[6283.0758499914,0,0],[.00206058863,2.67823455808,6283.0758499914],[4303419e-11,2.63512233481,12566.1516999828]],[[8721859e-11,1.07253635559,6283.0758499914]]],[[],[[.00227777722,3.4137662053,6283.0758499914],[3805678e-11,3.37063423795,12566.1516999828]]],[[[1.00013988784,0,0],[.01670699632,3.09846350258,6283.0758499914],[.00013956024,3.05524609456,12566.1516999828],[308372e-10,5.19846674381,77713.7714681205],[1628463e-11,1.17387558054,5753.3848848968],[1575572e-11,2.84685214877,7860.4193924392],[924799e-11,5.45292236722,11506.7697697936],[542439e-11,4.56409151453,3930.2096962196],[47211e-10,3.66100022149,5884.9268465832],[85831e-11,1.27079125277,161000.6857376741],[57056e-11,2.01374292245,83996.84731811189],[55736e-11,5.2415979917,71430.69561812909],[174844e-11,3.01193636733,18849.2275499742],[243181e-11,4.2734953079,11790.6290886588]],[[.00103018607,1.10748968172,6283.0758499914],[1721238e-11,1.06442300386,12566.1516999828]],[[4359385e-11,5.78455133808,6283.0758499914]]]],Mars:[[[[6.20347711581,0,0],[.18656368093,5.0503710027,3340.6124266998],[.01108216816,5.40099836344,6681.2248533996],[.00091798406,5.75478744667,10021.8372800994],[.00027744987,5.97049513147,3.523118349],[.00010610235,2.93958560338,2281.2304965106],[.00012315897,.84956094002,2810.9214616052],[8926784e-11,4.15697846427,.0172536522],[8715691e-11,6.11005153139,13362.4497067992],[6797556e-11,.36462229657,398.1490034082],[7774872e-11,3.33968761376,5621.8429232104],[3575078e-11,1.6618650571,2544.3144198834],[4161108e-11,.22814971327,2942.4634232916],[3075252e-11,.85696614132,191.4482661116],[2628117e-11,.64806124465,3337.0893083508],[2937546e-11,6.07893711402,.0673103028],[2389414e-11,5.03896442664,796.2980068164],[2579844e-11,.02996736156,3344.1355450488],[1528141e-11,1.14979301996,6151.533888305],[1798806e-11,.65634057445,529.6909650946],[1264357e-11,3.62275122593,5092.1519581158],[1286228e-11,3.06796065034,2146.1654164752],[1546404e-11,2.91579701718,1751.539531416],[1024902e-11,3.69334099279,8962.4553499102],[891566e-11,.18293837498,16703.062133499],[858759e-11,2.4009381194,2914.0142358238],[832715e-11,2.46418619474,3340.5951730476],[83272e-10,4.49495782139,3340.629680352],[712902e-11,3.66335473479,1059.3819301892],[748723e-11,3.82248614017,155.4203994342],[723861e-11,.67497311481,3738.761430108],[635548e-11,2.92182225127,8432.7643848156],[655162e-11,.48864064125,3127.3133312618],[550474e-11,3.81001042328,.9803210682],[55275e-10,4.47479317037,1748.016413067],[425966e-11,.55364317304,6283.0758499914],[415131e-11,.49662285038,213.299095438],[472167e-11,3.62547124025,1194.4470102246],[306551e-11,.38052848348,6684.7479717486],[312141e-11,.99853944405,6677.7017350506],[293198e-11,4.22131299634,20.7753954924],[302375e-11,4.48618007156,3532.0606928114],[274027e-11,.54222167059,3340.545116397],[281079e-11,5.88163521788,1349.8674096588],[231183e-11,1.28242156993,3870.3033917944],[283602e-11,5.7688543494,3149.1641605882],[236117e-11,5.75503217933,3333.498879699],[274033e-11,.13372524985,3340.6797370026],[299395e-11,2.78323740866,6254.6266625236]],[[3340.61242700512,0,0],[.01457554523,3.60433733236,3340.6124266998],[.00168414711,3.92318567804,6681.2248533996],[.00020622975,4.26108844583,10021.8372800994],[3452392e-11,4.7321039319,3.523118349],[2586332e-11,4.60670058555,13362.4497067992],[841535e-11,4.45864030426,2281.2304965106]],[[.00058152577,2.04961712429,3340.6124266998],[.00013459579,2.45738706163,6681.2248533996]]],[[[.03197134986,3.76832042431,3340.6124266998],[.00298033234,4.10616996305,6681.2248533996],[.00289104742,0,0],[.00031365539,4.4465105309,10021.8372800994],[34841e-9,4.7881254926,13362.4497067992]],[[.00217310991,6.04472194776,3340.6124266998],[.00020976948,3.14159265359,0],[.00012834709,1.60810667915,6681.2248533996]]],[[[1.53033488271,0,0],[.1418495316,3.47971283528,3340.6124266998],[.00660776362,3.81783443019,6681.2248533996],[.00046179117,4.15595316782,10021.8372800994],[8109733e-11,5.55958416318,2810.9214616052],[7485318e-11,1.77239078402,5621.8429232104],[5523191e-11,1.3643630377,2281.2304965106],[382516e-10,4.49407183687,13362.4497067992],[2306537e-11,.09081579001,2544.3144198834],[1999396e-11,5.36059617709,3337.0893083508],[2484394e-11,4.9254563992,2942.4634232916],[1960195e-11,4.74249437639,3344.1355450488],[1167119e-11,2.11260868341,5092.1519581158],[1102816e-11,5.00908403998,398.1490034082],[899066e-11,4.40791133207,529.6909650946],[992252e-11,5.83861961952,6151.533888305],[807354e-11,2.10217065501,1059.3819301892],[797915e-11,3.44839203899,796.2980068164],[740975e-11,1.49906336885,2146.1654164752]],[[.01107433345,2.03250524857,3340.6124266998],[.00103175887,2.37071847807,6681.2248533996],[128772e-9,0,0],[.0001081588,2.70888095665,10021.8372800994]],[[.00044242249,.47930604954,3340.6124266998],[8138042e-11,.86998389204,6681.2248533996]]]],Jupiter:[[[[.59954691494,0,0],[.09695898719,5.06191793158,529.6909650946],[.00573610142,1.44406205629,7.1135470008],[.00306389205,5.41734730184,1059.3819301892],[.00097178296,4.14264726552,632.7837393132],[.00072903078,3.64042916389,522.5774180938],[.00064263975,3.41145165351,103.0927742186],[.00039806064,2.29376740788,419.4846438752],[.00038857767,1.27231755835,316.3918696566],[.00027964629,1.7845459182,536.8045120954],[.0001358973,5.7748104079,1589.0728952838],[8246349e-11,3.5822792584,206.1855484372],[8768704e-11,3.63000308199,949.1756089698],[7368042e-11,5.0810119427,735.8765135318],[626315e-10,.02497628807,213.299095438],[6114062e-11,4.51319998626,1162.4747044078],[4905396e-11,1.32084470588,110.2063212194],[5305285e-11,1.30671216791,14.2270940016],[5305441e-11,4.18625634012,1052.2683831884],[4647248e-11,4.69958103684,3.9321532631],[3045023e-11,4.31676431084,426.598190876],[2609999e-11,1.56667394063,846.0828347512],[2028191e-11,1.06376530715,3.1813937377],[1764763e-11,2.14148655117,1066.49547719],[1722972e-11,3.88036268267,1265.5674786264],[1920945e-11,.97168196472,639.897286314],[1633223e-11,3.58201833555,515.463871093],[1431999e-11,4.29685556046,625.6701923124],[973272e-11,4.09764549134,95.9792272178]],[[529.69096508814,0,0],[.00489503243,4.2208293947,529.6909650946],[.00228917222,6.02646855621,7.1135470008],[.00030099479,4.54540782858,1059.3819301892],[.0002072092,5.45943156902,522.5774180938],[.00012103653,.16994816098,536.8045120954],[6067987e-11,4.42422292017,103.0927742186],[5433968e-11,3.98480737746,419.4846438752],[4237744e-11,5.89008707199,14.2270940016]],[[.00047233601,4.32148536482,7.1135470008],[.00030649436,2.929777887,529.6909650946],[.00014837605,3.14159265359,0]]],[[[.02268615702,3.55852606721,529.6909650946],[.00109971634,3.90809347197,1059.3819301892],[.00110090358,0,0],[8101428e-11,3.60509572885,522.5774180938],[6043996e-11,4.25883108339,1589.0728952838],[6437782e-11,.30627119215,536.8045120954]],[[.00078203446,1.52377859742,529.6909650946]]],[[[5.20887429326,0,0],[.25209327119,3.49108639871,529.6909650946],[.00610599976,3.84115365948,1059.3819301892],[.00282029458,2.57419881293,632.7837393132],[.00187647346,2.07590383214,522.5774180938],[.00086792905,.71001145545,419.4846438752],[.00072062974,.21465724607,536.8045120954],[.00065517248,5.9799588479,316.3918696566],[.00029134542,1.67759379655,103.0927742186],[.00030135335,2.16132003734,949.1756089698],[.00023453271,3.54023522184,735.8765135318],[.00022283743,4.19362594399,1589.0728952838],[.00023947298,.2745803748,7.1135470008],[.00013032614,2.96042965363,1162.4747044078],[970336e-10,1.90669633585,206.1855484372],[.00012749023,2.71550286592,1052.2683831884],[7057931e-11,2.18184839926,1265.5674786264],[6137703e-11,6.26418240033,846.0828347512],[2616976e-11,2.00994012876,1581.959348283]],[[.0127180152,2.64937512894,529.6909650946],[.00061661816,3.00076460387,1059.3819301892],[.00053443713,3.89717383175,522.5774180938],[.00031185171,4.88276958012,536.8045120954],[.00041390269,0,0]]]],Saturn:[[[[.87401354025,0,0],[.11107659762,3.96205090159,213.299095438],[.01414150957,4.58581516874,7.1135470008],[.00398379389,.52112032699,206.1855484372],[.00350769243,3.30329907896,426.598190876],[.00206816305,.24658372002,103.0927742186],[792713e-9,3.84007056878,220.4126424388],[.00023990355,4.66976924553,110.2063212194],[.00016573588,.43719228296,419.4846438752],[.00014906995,5.76903183869,316.3918696566],[.0001582029,.93809155235,632.7837393132],[.00014609559,1.56518472,3.9321532631],[.00013160301,4.44891291899,14.2270940016],[.00015053543,2.71669915667,639.897286314],[.00013005299,5.98119023644,11.0457002639],[.00010725067,3.12939523827,202.2533951741],[5863206e-11,.23656938524,529.6909650946],[5227757e-11,4.20783365759,3.1813937377],[6126317e-11,1.76328667907,277.0349937414],[5019687e-11,3.17787728405,433.7117378768],[459255e-10,.61977744975,199.0720014364],[4005867e-11,2.24479718502,63.7358983034],[2953796e-11,.98280366998,95.9792272178],[387367e-10,3.22283226966,138.5174968707],[2461186e-11,2.03163875071,735.8765135318],[3269484e-11,.77492638211,949.1756089698],[1758145e-11,3.2658010994,522.5774180938],[1640172e-11,5.5050445305,846.0828347512],[1391327e-11,4.02333150505,323.5054166574],[1580648e-11,4.37265307169,309.2783226558],[1123498e-11,2.83726798446,415.5524906121],[1017275e-11,3.71700135395,227.5261894396],[848642e-11,3.1915017083,209.3669421749]],[[213.2990952169,0,0],[.01297370862,1.82834923978,213.299095438],[.00564345393,2.88499717272,7.1135470008],[.00093734369,1.06311793502,426.598190876],[.00107674962,2.27769131009,206.1855484372],[.00040244455,2.04108104671,220.4126424388],[.00019941774,1.2795439047,103.0927742186],[.00010511678,2.7488034213,14.2270940016],[6416106e-11,.38238295041,639.897286314],[4848994e-11,2.43037610229,419.4846438752],[4056892e-11,2.92133209468,110.2063212194],[3768635e-11,3.6496533078,3.9321532631]],[[.0011644133,1.17988132879,7.1135470008],[.00091841837,.0732519584,213.299095438],[.00036661728,0,0],[.00015274496,4.06493179167,206.1855484372]]],[[[.04330678039,3.60284428399,213.299095438],[.00240348302,2.85238489373,426.598190876],[.00084745939,0,0],[.00030863357,3.48441504555,220.4126424388],[.00034116062,.57297307557,206.1855484372],[.0001473407,2.11846596715,639.897286314],[9916667e-11,5.79003188904,419.4846438752],[6993564e-11,4.7360468972,7.1135470008],[4807588e-11,5.43305312061,316.3918696566]],[[.00198927992,4.93901017903,213.299095438],[.00036947916,3.14159265359,0],[.00017966989,.5197943111,426.598190876]]],[[[9.55758135486,0,0],[.52921382865,2.39226219573,213.299095438],[.01873679867,5.2354960466,206.1855484372],[.01464663929,1.64763042902,426.598190876],[.00821891141,5.93520042303,316.3918696566],[.00547506923,5.0153261898,103.0927742186],[.0037168465,2.27114821115,220.4126424388],[.00361778765,3.13904301847,7.1135470008],[.00140617506,5.70406606781,632.7837393132],[.00108974848,3.29313390175,110.2063212194],[.00069006962,5.94099540992,419.4846438752],[.00061053367,.94037691801,639.897286314],[.00048913294,1.55733638681,202.2533951741],[.00034143772,.19519102597,277.0349937414],[.00032401773,5.47084567016,949.1756089698],[.00020936596,.46349251129,735.8765135318],[9796004e-11,5.20477537945,1265.5674786264],[.00011993338,5.98050967385,846.0828347512],[208393e-9,1.52102476129,433.7117378768],[.00015298404,3.0594381494,529.6909650946],[6465823e-11,.17732249942,1052.2683831884],[.00011380257,1.7310542704,522.5774180938],[3419618e-11,4.94550542171,1581.959348283]],[[.0618298134,.2584351148,213.299095438],[.00506577242,.71114625261,206.1855484372],[.00341394029,5.79635741658,426.598190876],[.00188491195,.47215589652,220.4126424388],[.00186261486,3.14159265359,0],[.00143891146,1.40744822888,7.1135470008]],[[.00436902572,4.78671677509,213.299095438]]]],Uranus:[[[[5.48129294297,0,0],[.09260408234,.89106421507,74.7815985673],[.01504247898,3.6271926092,1.4844727083],[.00365981674,1.89962179044,73.297125859],[.00272328168,3.35823706307,149.5631971346],[.00070328461,5.39254450063,63.7358983034],[.00068892678,6.09292483287,76.2660712756],[.00061998615,2.26952066061,2.9689454166],[.00061950719,2.85098872691,11.0457002639],[.0002646877,3.14152083966,71.8126531507],[.00025710476,6.11379840493,454.9093665273],[.0002107885,4.36059339067,148.0787244263],[.00017818647,1.74436930289,36.6485629295],[.00014613507,4.73732166022,3.9321532631],[.00011162509,5.8268179635,224.3447957019],[.0001099791,.48865004018,138.5174968707],[9527478e-11,2.95516862826,35.1640902212],[7545601e-11,5.236265824,109.9456887885],[4220241e-11,3.23328220918,70.8494453042],[40519e-9,2.277550173,151.0476698429],[3354596e-11,1.0654900738,4.4534181249],[2926718e-11,4.62903718891,9.5612275556],[349034e-10,5.48306144511,146.594251718],[3144069e-11,4.75199570434,77.7505439839],[2922333e-11,5.35235361027,85.8272988312],[2272788e-11,4.36600400036,70.3281804424],[2051219e-11,1.51773566586,.1118745846],[2148602e-11,.60745949945,38.1330356378],[1991643e-11,4.92437588682,277.0349937414],[1376226e-11,2.04283539351,65.2203710117],[1666902e-11,3.62744066769,380.12776796],[1284107e-11,3.11347961505,202.2533951741],[1150429e-11,.93343589092,3.1813937377],[1533221e-11,2.58594681212,52.6901980395],[1281604e-11,.54271272721,222.8603229936],[1372139e-11,4.19641530878,111.4301614968],[1221029e-11,.1990065003,108.4612160802],[946181e-11,1.19253165736,127.4717966068],[1150989e-11,4.17898916639,33.6796175129]],[[74.7815986091,0,0],[.00154332863,5.24158770553,74.7815985673],[.00024456474,1.71260334156,1.4844727083],[9258442e-11,.4282973235,11.0457002639],[8265977e-11,1.50218091379,63.7358983034],[915016e-10,1.41213765216,149.5631971346]]],[[[.01346277648,2.61877810547,74.7815985673],[623414e-9,5.08111189648,149.5631971346],[.00061601196,3.14159265359,0],[9963722e-11,1.61603805646,76.2660712756],[992616e-10,.57630380333,73.297125859]],[[.00034101978,.01321929936,74.7815985673]]],[[[19.21264847206,0,0],[.88784984413,5.60377527014,74.7815985673],[.03440836062,.32836099706,73.297125859],[.0205565386,1.7829515933,149.5631971346],[.0064932241,4.52247285911,76.2660712756],[.00602247865,3.86003823674,63.7358983034],[.00496404167,1.40139935333,454.9093665273],[.00338525369,1.58002770318,138.5174968707],[.00243509114,1.57086606044,71.8126531507],[.00190522303,1.99809394714,1.4844727083],[.00161858838,2.79137786799,148.0787244263],[.00143706183,1.38368544947,11.0457002639],[.00093192405,.17437220467,36.6485629295],[.00071424548,4.24509236074,224.3447957019],[.00089806014,3.66105364565,109.9456887885],[.00039009723,1.66971401684,70.8494453042],[.00046677296,1.39976401694,35.1640902212],[.00039025624,3.36234773834,277.0349937414],[.00036755274,3.88649278513,146.594251718],[.00030348723,.70100838798,151.0476698429],[.00029156413,3.180563367,77.7505439839],[.00022637073,.72518687029,529.6909650946],[.00011959076,1.7504339214,984.6003316219],[.00025620756,5.25656086672,380.12776796]],[[.01479896629,3.67205697578,74.7815985673]]]],Neptune:[[[[5.31188633046,0,0],[.0179847553,2.9010127389,38.1330356378],[.01019727652,.48580922867,1.4844727083],[.00124531845,4.83008090676,36.6485629295],[.00042064466,5.41054993053,2.9689454166],[.00037714584,6.09221808686,35.1640902212],[.00033784738,1.24488874087,76.2660712756],[.00016482741,7727998e-11,491.5579294568],[9198584e-11,4.93747051954,39.6175083461],[899425e-10,.27462171806,175.1660598002]],[[38.13303563957,0,0],[.00016604172,4.86323329249,1.4844727083],[.00015744045,2.27887427527,38.1330356378]]],[[[.03088622933,1.44104372644,38.1330356378],[.00027780087,5.91271884599,76.2660712756],[.00027623609,0,0],[.00015355489,2.52123799551,36.6485629295],[.00015448133,3.50877079215,39.6175083461]]],[[[30.07013205828,0,0],[.27062259632,1.32999459377,38.1330356378],[.01691764014,3.25186135653,36.6485629295],[.00807830553,5.18592878704,1.4844727083],[.0053776051,4.52113935896,35.1640902212],[.00495725141,1.5710564165,491.5579294568],[.00274571975,1.84552258866,175.1660598002],[.0001201232,1.92059384991,1021.2488945514],[.00121801746,5.79754470298,76.2660712756],[.00100896068,.3770272493,73.297125859],[.00135134092,3.37220609835,39.6175083461],[7571796e-11,1.07149207335,388.4651552382]]]]};function E5(s){var e,t,n,i,r,a,o;const c=2e3+(s-14)/m5;return c<-500?(e=(c-1820)/100,-20+32*e*e):c<500?(e=c/100,t=e*e,n=e*t,i=t*t,r=t*n,a=n*n,10583.6-1014.41*e+33.78311*t-5.952053*n-.1798452*i+.022174192*r+.0090316521*a):c<1600?(e=(c-1e3)/100,t=e*e,n=e*t,i=t*t,r=t*n,a=n*n,1574.2-556.01*e+71.23472*t+.319781*n-.8503463*i-.005050998*r+.0083572073*a):c<1700?(e=c-1600,t=e*e,n=e*t,120-.9808*e-.01532*t+n/7129):c<1800?(e=c-1700,t=e*e,n=e*t,i=t*t,8.83+.1603*e-.0059285*t+13336e-8*n-i/1174e3):c<1860?(e=c-1800,t=e*e,n=e*t,i=t*t,r=t*n,a=n*n,o=n*i,13.72-.332447*e+.0068612*t+.0041116*n-37436e-8*i+121272e-10*r-1699e-10*a+875e-12*o):c<1900?(e=c-1860,t=e*e,n=e*t,i=t*t,r=t*n,7.62+.5737*e-.251754*t+.01680668*n-.0004473624*i+r/233174):c<1920?(e=c-1900,t=e*e,n=e*t,i=t*t,-2.79+1.494119*e-.0598939*t+.0061966*n-197e-6*i):c<1941?(e=c-1920,t=e*e,n=e*t,21.2+.84493*e-.0761*t+.0020936*n):c<1961?(e=c-1950,t=e*e,n=e*t,29.07+.407*e-t/233+n/2547):c<1986?(e=c-1975,t=e*e,n=e*t,45.45+1.067*e-t/260-n/718):c<2005?(e=c-2e3,t=e*e,n=e*t,i=t*t,r=t*n,63.86+.3345*e-.060374*t+.0017275*n+651814e-9*i+2373599e-11*r):c<2050?(e=c-2e3,62.92+.32217*e+.005589*e*e):c<2150?(e=(c-1820)/100,-20+32*e*e-.5628*(2150-c)):(e=(c-1820)/100,-20+32*e*e)}let A5=E5;function Df(s){return s+A5(s)/86400}class Fr{constructor(e){if(e instanceof Fr){this.date=e.date,this.ut=e.ut,this.tt=e.tt;return}const t=1e3*3600*24;if(e instanceof Date&&Number.isFinite(e.getTime())){this.date=e,this.ut=(e.getTime()-Tf.getTime())/t,this.tt=Df(this.ut);return}if(Number.isFinite(e)){this.date=new Date(Tf.getTime()+e*t),this.ut=e,this.tt=Df(this.ut);return}throw"Argument must be a Date object, an AstroTime object, or a numeric UTC Julian date."}static FromTerrestrialTime(e){let t=new Fr(e);for(;;){const n=e-t.tt;if(Math.abs(n)<1e-12)return t;t=t.AddDays(n)}}toString(){return this.date.toISOString()}AddDays(e){return new Fr(this.ut+e)}}function Tt(s){return s instanceof Fr?s:new Fr(s)}function T5(s){function e(d){return d%g5*Tr}const t=s.tt/36525,n=e(128710479305e-5+t*1295965810481e-4),i=e(335779.526232+t*17395272628478e-4),r=e(107226070369e-5+t*1602961601209e-3),a=e(450160.398036-t*69628905431e-4);let o=Math.sin(a),c=Math.cos(a),l=(-172064161-174666*t)*o+33386*c,h=(92052331+9086*t)*c+15377*o,u=2*(i-r+a);return o=Math.sin(u),c=Math.cos(u),l+=(-13170906-1675*t)*o-13696*c,h+=(5730336-3015*t)*c-4587*o,u=2*(i+a),o=Math.sin(u),c=Math.cos(u),l+=(-2276413-234*t)*o+2796*c,h+=(978459-485*t)*c+1374*o,u=2*a,o=Math.sin(u),c=Math.cos(u),l+=(2074554+207*t)*o-698*c,h+=(-897492+470*t)*c-291*o,o=Math.sin(n),c=Math.cos(n),l+=(1475877-3633*t)*o+11817*c,h+=(73871-184*t)*c-1924*o,{dpsi:-135e-6+l*1e-7,deps:388e-6+h*1e-7}}function km(s){var e=s.tt/36525,t=((((-434e-10*e-576e-9)*e+.0020034)*e-1831e-7)*e-46.836769)*e+84381.406;return t/3600}var zo;function Za(s){if(!zo||Math.abs(zo.tt-s.tt)>1e-6){const e=T5(s),t=km(s),n=t+e.deps/3600;zo={tt:s.tt,dpsi:e.dpsi,deps:e.deps,ee:e.dpsi*Math.cos(t*ot)/15,mobl:t,tobl:n}}return zo}function R5(s,e){const t=s*ot,n=Math.cos(t),i=Math.sin(t);return[e[0],e[1]*n-e[2]*i,e[1]*i+e[2]*n]}function D5(s,e){return R5(km(s),e)}function C5(s){const e=s.tt/36525;function t(Te,xe){const Ne=[];let Oe;for(Oe=0;Oe<=xe-Te;++Oe)Ne.push(0);return{min:Te,array:Ne}}function n(Te,xe,Ne,Oe){const Ue=[];for(let nt=0;nt<=xe-Te;++nt)Ue.push(t(Ne,Oe));return{min:Te,array:Ue}}function i(Te,xe,Ne){const Oe=Te.array[xe-Te.min];return Oe.array[Ne-Oe.min]}function r(Te,xe,Ne,Oe){const Ue=Te.array[xe-Te.min];Ue.array[Ne-Ue.min]=Oe}let a,o,c,l,h,u,d,f,p,v,m,g,b,w,_,S,E,R,M,A,P,D,I,F=n(-6,6,1,4),H=n(-6,6,1,4);function O(Te,xe){return i(F,Te,xe)}function V(Te,xe){return i(H,Te,xe)}function z(Te,xe,Ne){return r(F,Te,xe,Ne)}function Y(Te,xe,Ne){return r(H,Te,xe,Ne)}function ee(Te,xe,Ne,Oe,Ue){Ue(Te*Ne-xe*Oe,xe*Ne+Te*Oe)}function Z(Te){return Math.sin(Ui*Te)}d=e*e,p=0,I=0,m=0,g=3422.7;var ne=Z(.19833+.05611*e),ae=Z(.27869+.04508*e),He=Z(.16827-.36903*e),$e=Z(.34734-5.37261*e),Be=Z(.10498-5.37899*e),K=Z(.42681-.41855*e),re=Z(.14943-5.37511*e);for(R=.84*ne+.31*ae+14.27*He+7.26*$e+.28*Be+.24*K,M=2.94*ne+.31*ae+14.27*He+9.34*$e+1.12*Be+.83*K,A=-6.4*ne-1.89*K,P=.21*ne+.31*ae+14.27*He-88.7*$e-15.3*Be+.24*K-1.86*re,D=R-A,f=-3332e-9*Z(.59734-5.37261*e)-539e-9*Z(.35498-5.37899*e)-64e-9*Z(.39943-5.37511*e),b=Ui*_r(.60643382+1336.85522467*e-313e-8*d)+R/as,w=Ui*_r(.37489701+1325.55240982*e+2565e-8*d)+M/as,_=Ui*_r(.99312619+99.99735956*e-44e-8*d)+A/as,S=Ui*_r(.25909118+1342.2278298*e-892e-8*d)+P/as,E=Ui*_r(.82736186+1236.85308708*e-397e-8*d)+D/as,h=1;h<=4;++h){switch(h){case 1:c=w,o=4,l=1.000002208;break;case 2:c=_,o=3,l=.997504612-.002495388*e;break;case 3:c=S,o=4,l=1.000002708+139.978*f;break;case 4:c=E,o=6,l=1;break;default:throw`Internal error: I = ${h}`}for(z(0,h,1),z(1,h,Math.cos(c)*l),Y(0,h,0),Y(1,h,Math.sin(c)*l),u=2;u<=o;++u)ee(O(u-1,h),V(u-1,h),O(1,h),V(1,h),(Te,xe)=>(z(u,h,Te),Y(u,h,xe)));for(u=1;u<=o;++u)z(-u,h,O(u,h)),Y(-u,h,-V(u,h))}function ie(Te,xe,Ne,Oe){for(var Ue={x:1,y:0},nt=[0,Te,xe,Ne,Oe],it=1;it<=4;++it)nt[it]!==0&&ee(Ue.x,Ue.y,O(nt[it],it),V(nt[it],it),(Rt,_t)=>(Ue.x=Rt,Ue.y=_t));return Ue}function B(Te,xe,Ne,Oe,Ue,nt,it,Rt){var _t=ie(Ue,nt,it,Rt);p+=Te*_t.y,I+=xe*_t.y,m+=Ne*_t.x,g+=Oe*_t.x}B(13.902,14.06,-.001,.2607,0,0,0,4),B(.403,-4.01,.394,.0023,0,0,0,3),B(2369.912,2373.36,.601,28.2333,0,0,0,2),B(-125.154,-112.79,-.725,-.9781,0,0,0,1),B(1.979,6.98,-.445,.0433,1,0,0,4),B(191.953,192.72,.029,3.0861,1,0,0,2),B(-8.466,-13.51,.455,-.1093,1,0,0,1),B(22639.5,22609.07,.079,186.5398,1,0,0,0),B(18.609,3.59,-.094,.0118,1,0,0,-1),B(-4586.465,-4578.13,-.077,34.3117,1,0,0,-2),B(3.215,5.44,.192,-.0386,1,0,0,-3),B(-38.428,-38.64,.001,.6008,1,0,0,-4),B(-.393,-1.43,-.092,.0086,1,0,0,-6),B(-.289,-1.59,.123,-.0053,0,1,0,4),B(-24.42,-25.1,.04,-.3,0,1,0,2),B(18.023,17.93,.007,.1494,0,1,0,1),B(-668.146,-126.98,-1.302,-.3997,0,1,0,0),B(.56,.32,-.001,-.0037,0,1,0,-1),B(-165.145,-165.06,.054,1.9178,0,1,0,-2),B(-1.877,-6.46,-.416,.0339,0,1,0,-4),B(.213,1.02,-.074,.0054,2,0,0,4),B(14.387,14.78,-.017,.2833,2,0,0,2),B(-.586,-1.2,.054,-.01,2,0,0,1),B(769.016,767.96,.107,10.1657,2,0,0,0),B(1.75,2.01,-.018,.0155,2,0,0,-1),B(-211.656,-152.53,5.679,-.3039,2,0,0,-2),B(1.225,.91,-.03,-.0088,2,0,0,-3),B(-30.773,-34.07,-.308,.3722,2,0,0,-4),B(-.57,-1.4,-.074,.0109,2,0,0,-6),B(-2.921,-11.75,.787,-.0484,1,1,0,2),B(1.267,1.52,-.022,.0164,1,1,0,1),B(-109.673,-115.18,.461,-.949,1,1,0,0),B(-205.962,-182.36,2.056,1.4437,1,1,0,-2),B(.233,.36,.012,-.0025,1,1,0,-3),B(-4.391,-9.66,-.471,.0673,1,1,0,-4),B(.283,1.53,-.111,.006,1,-1,0,4),B(14.577,31.7,-1.54,.2302,1,-1,0,2),B(147.687,138.76,.679,1.1528,1,-1,0,0),B(-1.089,.55,.021,0,1,-1,0,-1),B(28.475,23.59,-.443,-.2257,1,-1,0,-2),B(-.276,-.38,-.006,-.0036,1,-1,0,-3),B(.636,2.27,.146,-.0102,1,-1,0,-4),B(-.189,-1.68,.131,-.0028,0,2,0,2),B(-7.486,-.66,-.037,-.0086,0,2,0,0),B(-8.096,-16.35,-.74,.0918,0,2,0,-2),B(-5.741,-.04,0,-9e-4,0,0,2,2),B(.255,0,0,0,0,0,2,1),B(-411.608,-.2,0,-.0124,0,0,2,0),B(.584,.84,0,.0071,0,0,2,-1),B(-55.173,-52.14,0,-.1052,0,0,2,-2),B(.254,.25,0,-.0017,0,0,2,-3),B(.025,-1.67,0,.0031,0,0,2,-4),B(1.06,2.96,-.166,.0243,3,0,0,2),B(36.124,50.64,-1.3,.6215,3,0,0,0),B(-13.193,-16.4,.258,-.1187,3,0,0,-2),B(-1.187,-.74,.042,.0074,3,0,0,-4),B(-.293,-.31,-.002,.0046,3,0,0,-6),B(-.29,-1.45,.116,-.0051,2,1,0,2),B(-7.649,-10.56,.259,-.1038,2,1,0,0),B(-8.627,-7.59,.078,-.0192,2,1,0,-2),B(-2.74,-2.54,.022,.0324,2,1,0,-4),B(1.181,3.32,-.212,.0213,2,-1,0,2),B(9.703,11.67,-.151,.1268,2,-1,0,0),B(-.352,-.37,.001,-.0028,2,-1,0,-1),B(-2.494,-1.17,-.003,-.0017,2,-1,0,-2),B(.36,.2,-.012,-.0043,2,-1,0,-4),B(-1.167,-1.25,.008,-.0106,1,2,0,0),B(-7.412,-6.12,.117,.0484,1,2,0,-2),B(-.311,-.65,-.032,.0044,1,2,0,-4),B(.757,1.82,-.105,.0112,1,-2,0,2),B(2.58,2.32,.027,.0196,1,-2,0,0),B(2.533,2.4,-.014,-.0212,1,-2,0,-2),B(-.344,-.57,-.025,.0036,0,3,0,-2),B(-.992,-.02,0,0,1,0,2,2),B(-45.099,-.02,0,-.001,1,0,2,0),B(-.179,-9.52,0,-.0833,1,0,2,-2),B(-.301,-.33,0,.0014,1,0,2,-4),B(-6.382,-3.37,0,-.0481,1,0,-2,2),B(39.528,85.13,0,-.7136,1,0,-2,0),B(9.366,.71,0,-.0112,1,0,-2,-2),B(.202,.02,0,0,1,0,-2,-4),B(.415,.1,0,.0013,0,1,2,0),B(-2.152,-2.26,0,-.0066,0,1,2,-2),B(-1.44,-1.3,0,.0014,0,1,-2,2),B(.384,-.04,0,0,0,1,-2,-2),B(1.938,3.6,-.145,.0401,4,0,0,0),B(-.952,-1.58,.052,-.013,4,0,0,-2),B(-.551,-.94,.032,-.0097,3,1,0,0),B(-.482,-.57,.005,-.0045,3,1,0,-2),B(.681,.96,-.026,.0115,3,-1,0,0),B(-.297,-.27,.002,-9e-4,2,2,0,-2),B(.254,.21,-.003,0,2,-2,0,-2),B(-.25,-.22,.004,.0014,1,3,0,-2),B(-3.996,0,0,4e-4,2,0,2,0),B(.557,-.75,0,-.009,2,0,2,-2),B(-.459,-.38,0,-.0053,2,0,-2,2),B(-1.298,.74,0,4e-4,2,0,-2,0),B(.538,1.14,0,-.0141,2,0,-2,-2),B(.263,.02,0,0,1,1,2,0),B(.426,.07,0,-6e-4,1,1,-2,-2),B(-.304,.03,0,3e-4,1,-1,2,0),B(-.372,-.19,0,-.0027,1,-1,-2,2),B(.418,0,0,0,0,0,4,0),B(-.33,-.04,0,0,3,0,2,0);function we(Te,xe,Ne,Oe,Ue){return Te*ie(xe,Ne,Oe,Ue).y}v=0,v+=we(-526.069,0,0,1,-2),v+=we(-3.352,0,0,1,-4),v+=we(44.297,1,0,1,-2),v+=we(-6,1,0,1,-4),v+=we(20.599,-1,0,1,0),v+=we(-30.598,-1,0,1,-2),v+=we(-24.649,-2,0,1,0),v+=we(-2,-2,0,1,-2),v+=we(-22.571,0,1,1,-2),v+=we(10.985,0,-1,1,-2),p+=.82*Z(.7736-62.5512*e)+.31*Z(.0466-125.1025*e)+.35*Z(.5785-25.1042*e)+.66*Z(.4591+1335.8075*e)+.64*Z(.313-91.568*e)+1.14*Z(.148+1331.2898*e)+.21*Z(.5918+1056.5859*e)+.44*Z(.5784+1322.8595*e)+.24*Z(.2275-5.7374*e)+.28*Z(.2965+2.6929*e)+.33*Z(.3132+6.3368*e),a=S+I/as;let Ie=(1.000002708+139.978*f)*(18518.511+1.189+m)*Math.sin(a)-6.24*Math.sin(3*a)+v;return{geo_eclip_lon:Ui*_r((b+p/as)/Ui),geo_eclip_lat:Math.PI/(180*3600)*Ie,distance_au:as*_5/(.999953253*g)}}function zm(s,e){return[s.rot[0][0]*e[0]+s.rot[1][0]*e[1]+s.rot[2][0]*e[2],s.rot[0][1]*e[0]+s.rot[1][1]*e[1]+s.rot[2][1]*e[2],s.rot[0][2]*e[0]+s.rot[1][2]*e[1]+s.rot[2][2]*e[2]]}function Cc(s,e,t){const n=ud(e,t);return zm(n,s)}function ud(s,e){const t=s.tt/36525;let n=84381.406,i=((((-951e-10*t+132851e-9)*t-.00114045)*t-1.0790069)*t+5038.481507)*t,r=((((3337e-10*t-467e-9)*t-.00772503)*t+.0512623)*t-.025754)*t+n,a=((((-56e-9*t+170663e-9)*t-.00121197)*t-2.3814292)*t+10.556403)*t;n*=Tr,i*=Tr,r*=Tr,a*=Tr;const o=Math.sin(n),c=Math.cos(n),l=Math.sin(-i),h=Math.cos(-i),u=Math.sin(-r),d=Math.cos(-r),f=Math.sin(a),p=Math.cos(a),v=p*h-l*f*d,m=p*l*c+f*d*h*c-o*f*u,g=p*l*o+f*d*h*o+c*f*u,b=-f*h-l*p*d,w=-f*l*c+p*d*h*c-o*p*u,_=-f*l*o+p*d*h*o+c*p*u,S=l*u,E=-u*h*c-o*d,R=-u*h*o+d*c;if(e===on.Into2000)return new xs([[v,m,g],[b,w,_],[S,E,R]]);if(e===on.From2000)return new xs([[v,b,S],[m,w,E],[g,_,R]]);throw"Invalid precess direction"}function P5(s){const e=.779057273264+.00273781191135448*s.ut,t=s.ut%1;let n=360*((e+t)%1);return n<0&&(n+=360),n}let Bo;function Gc(s){if(!Bo||Bo.tt!==s.tt){const e=s.tt/36525;let t=15*Za(s).ee;const n=P5(s);let r=((t+.014506+((((-368e-10*e-29956e-9)*e-44e-8)*e+1.3915817)*e+4612.156534)*e)/3600+n)%360/15;r<0&&(r+=24),Bo={tt:s.tt,st:r}}return Bo.st}function I5(s){const e=Tt(s);return Gc(e)}function Bm(s,e){const t=s.latitude*ot,n=Math.sin(t),i=Math.cos(t),r=1/Math.hypot(i,fu*n),a=x5*r,o=s.height/1e3,c=pu*r+o,l=pu*a+o,h=(15*e+s.longitude)*ot,u=Math.sin(h),d=Math.cos(h);return{pos:[c*i*d/Is,c*i*u/Is,l*n/Is],vel:[-Rf*c*i*u*86400/Is,Rf*c*i*d*86400/Is,0]}}function xu(s,e,t){const n=dd(e,t);return zm(n,s)}function dd(s,e){const t=Za(s),n=t.mobl*ot,i=t.tobl*ot,r=t.dpsi*Tr,a=Math.cos(n),o=Math.sin(n),c=Math.cos(i),l=Math.sin(i),h=Math.cos(r),u=Math.sin(r),d=h,f=-u*a,p=-u*o,v=u*c,m=h*a*c+o*l,g=h*o*c-a*l,b=u*l,w=h*a*l-o*c,_=h*o*l+a*c;if(e===on.From2000)return new xs([[d,v,b],[f,m,w],[p,g,_]]);if(e===on.Into2000)return new xs([[d,f,p],[v,m,g],[b,w,_]]);throw"Invalid precess direction"}function fd(s,e,t){return t===on.Into2000?Cc(xu(s,e,t),e,t):xu(Cc(s,e,t),e,t)}function L5(s,e){const t=Gc(s),n=Bm(e,t).pos;return fd(n,s,on.Into2000)}class vt{constructor(e,t,n,i){this.x=e,this.y=t,this.z=n,this.t=i}Length(){return Math.hypot(this.x,this.y,this.z)}}class ms{constructor(e,t,n,i,r,a,o){this.x=e,this.y=t,this.z=n,this.vx=i,this.vy=r,this.vz=a,this.t=o}}class Vc{constructor(e,t,n){this.lat=tn(e),this.lon=tn(t),this.dist=tn(n)}}class _u{constructor(e,t,n,i){this.ra=tn(e),this.dec=tn(t),this.dist=tn(n),this.vec=i}}class xs{constructor(e){this.rot=e}}class N5{constructor(e,t,n,i){this.azimuth=tn(e),this.altitude=tn(t),this.ra=tn(n),this.dec=tn(i)}}class O5{constructor(e,t,n){this.vec=e,this.elat=tn(t),this.elon=tn(n)}}function Hm(s,e){return new vt(s[0],s[1],s[2],e)}function U5(s,e){const t=Hm(s,e),n=t.x*t.x+t.y*t.y,i=Math.sqrt(n+t.z*t.z);if(n===0){if(t.z===0)throw"Indeterminate sky coordinates";return new _u(0,t.z<0?-90:90,i,t)}let r=Om*Math.atan2(t.y,t.x);r<0&&(r+=24);const a=Ti*Math.atan2(s[2],Math.sqrt(n));return new _u(r,a,i,t)}function kl(s,e){const t=s*ot,n=Math.cos(t),i=Math.sin(t);return[n*e[0]+i*e[1],n*e[1]-i*e[0],e[2]]}function Gm(s,e,t,n,i){let r=Tt(s);pd(e),tn(t),tn(n);const a=Math.sin(e.latitude*ot),o=Math.cos(e.latitude*ot),c=Math.sin(e.longitude*ot),l=Math.cos(e.longitude*ot),h=Math.sin(n*ot),u=Math.cos(n*ot),d=Math.sin(t*Af),f=Math.cos(t*Af);let p=[o*l,o*c,a],v=[-a*l,-a*c,o],m=[c,-l,0];const g=-15*Gc(r);let b=kl(g,p),w=kl(g,v),_=kl(g,m),S=[u*f,u*d,h];const E=S[0]*b[0]+S[1]*b[1]+S[2]*b[2],R=S[0]*w[0]+S[1]*w[1]+S[2]*w[2],M=S[0]*_[0]+S[1]*_[1]+S[2]*_[2];let A=Math.hypot(R,M),P;A>0?(P=-Ti*Math.atan2(M,R),P<0&&(P+=360)):P=0;let D=Ti*Math.atan2(A,E),I=t,F=n;if(i){let H=D,O=Zm(i,90-D);if(D-=O,O>0&&D>3e-4){const V=Math.sin(D*ot),z=Math.cos(D*ot),Y=Math.sin(H*ot),ee=Math.cos(H*ot),Z=[];for(let ne=0;ne<3;++ne)Z.push((S[ne]-ee*b[ne])/Y*V+b[ne]*z);A=Math.hypot(Z[0],Z[1]),A>0?(I=Om*Math.atan2(Z[1],Z[0]),I<0&&(I+=24)):I=0,F=Ti*Math.atan2(Z[2],A)}}return new N5(P,90-D,I,F)}function pd(s){if(!(s instanceof md))throw`Not an instance of the Observer class: ${s}`;if(tn(s.latitude),tn(s.longitude),tn(s.height),s.latitude<-90||s.latitude>90)throw`Latitude ${s.latitude} is out of range. Must be -90..+90.`;return s}class md{constructor(e,t,n){this.latitude=e,this.longitude=t,this.height=n,pd(this)}}function F5(s){const e=Tt(s).AddDays(-1/cd),t=zr(wi.Earth,e),n=[-t.x,-t.y,-t.z],[i,r,a]=fd(n,e,on.From2000),o=ot*Za(e).tobl,c=Math.cos(o),l=Math.sin(o),h=new vt(i,r,a,e);return Vm(h,c,l)}function k5(s,e,t,n,i){pd(t),Dc(n),Dc(i);const r=Tt(e),a=L5(r,t),o=Cu(s,r,i),c=[o.x-a[0],o.y-a[1],o.z-a[2]],l=fd(c,r,on.From2000);return U5(l,r)}function z5(s,e,t){const n=Tt(s),i=Gc(n);let r=Bm(e,i).pos;return Hm(r,n)}function Vm(s,e,t){const n=s.x,i=s.y*e+s.z*t,r=-s.y*t+s.z*e,a=Math.hypot(n,i);let o=0;a>0&&(o=Ti*Math.atan2(i,n),o<0&&(o+=360));let c=Ti*Math.atan2(r,a),l=new vt(n,i,r,s.t);return new O5(l,c,o)}function yu(s){const e=Za(s.t),t=[s.x,s.y,s.z],n=Cc(t,s.t,on.From2000),[i,r,a]=xu(n,s.t,on.From2000),o=new vt(i,r,a,s.t),c=e.tobl*ot;return Vm(o,Math.cos(c),Math.sin(c))}function Xr(s){const e=Tt(s),t=C5(e),n=t.distance_au*Math.cos(t.geo_eclip_lat),i=[n*Math.cos(t.geo_eclip_lon),n*Math.sin(t.geo_eclip_lon),t.distance_au*Math.sin(t.geo_eclip_lat)],r=D5(e,i),a=Cc(r,e,on.Into2000);return new vt(a[0],a[1],a[2],e)}function Wm(s){const e=Tt(s),t=1e-5,n=e.AddDays(-t),i=e.AddDays(+t),r=Xr(n),a=Xr(i);return new ms((r.x+a.x)/2,(r.y+a.y)/2,(r.z+a.z)/2,(a.x-r.x)/(2*t),(a.y-r.y)/(2*t),(a.z-r.z)/(2*t),e)}function B5(s){const e=Tt(s),t=Wm(e),n=1+Fm;return new ms(t.x/n,t.y/n,t.z/n,t.vx/n,t.vy/n,t.vz/n,e)}function kr(s,e,t){let n=1,i=0;for(let r of s){let a=0;for(let[c,l,h]of r)a+=c*Math.cos(l+e*h);let o=n*a;t&&(o%=Ui),i+=o,n*=e}return i}function zl(s,e){let t=1,n=0,i=0,r=0;for(let a of s){let o=0,c=0;for(let[l,h,u]of a){let d=h+e*u;o+=l*u*Math.sin(d),r>0&&(c+=l*Math.cos(d))}i+=r*n*c-t*o,n=t,t*=e,++r}return i}const Sa=365250,Su=0,bu=1,wu=2;function Eu(s){return new dn(s[0]+44036e-11*s[1]-190919e-12*s[2],-479966e-12*s[0]+.917482137087*s[1]-.397776982902*s[2],.397776982902*s[1]+.917482137087*s[2])}function Xm(s,e,t){const n=t*Math.cos(e),i=Math.cos(s),r=Math.sin(s);return[n*i,n*r,t*Math.sin(e)]}function zr(s,e){const t=e.tt/Sa,n=kr(s[Su],t,!0),i=kr(s[bu],t,!1),r=kr(s[wu],t,!1),a=Xm(n,i,r);return Eu(a).ToAstroVector(e)}function Au(s,e){const t=e/Sa,n=kr(s[Su],t,!0),i=kr(s[bu],t,!1),r=kr(s[wu],t,!1),a=zl(s[Su],t),o=zl(s[bu],t),c=zl(s[wu],t),l=Math.cos(n),h=Math.sin(n),u=Math.cos(i),d=Math.sin(i),f=+(c*u*l)-r*d*l*o-r*u*h*a,p=+(c*u*h)-r*d*h*o+r*u*l*a,v=+(c*d)+r*u*o,m=Xm(n,i,r),g=[f/Sa,p/Sa,v/Sa],b=Eu(m),w=Eu(g);return new Ws(e,b,w)}function Ho(s,e,t,n){const i=n/(n+ld),r=zr(wi[t],e);s.x+=i*r.x,s.y+=i*r.y,s.z+=i*r.z}function H5(s){const e=new vt(0,0,0,s);return Ho(e,s,Se.Jupiter,mu),Ho(e,s,Se.Saturn,gu),Ho(e,s,Se.Uranus,vu),Ho(e,s,Se.Neptune,Mu),e}const Tu=51,G5=29200,Rr=146,Fi=201,ks=[[-73e4,[-26.118207232108,-14.376168177825,3.384402515299],[.0016339372163656,-.0027861699588508,-.0013585880229445]],[-700800,[41.974905202127,-.448502952929,-12.770351505989],[.00073458569351457,.0022785014891658,.00048619778602049]],[-671600,[14.706930780744,44.269110540027,9.353698474772],[-.00210001479998,.00022295915939915,.00070143443551414]],[-642400,[-29.441003929957,-6.43016153057,6.858481011305],[.00084495803960544,-.0030783914758711,-.0012106305981192]],[-613200,[39.444396946234,-6.557989760571,-13.913760296463],[.0011480029005873,.0022400006880665,.00035168075922288]],[-584e3,[20.2303809507,43.266966657189,7.382966091923],[-.0019754081700585,.00053457141292226,.00075929169129793]],[-554800,[-30.65832536462,2.093818874552,9.880531138071],[61010603013347e-18,-.0031326500935382,-.00099346125151067]],[-525600,[35.737703251673,-12.587706024764,-14.677847247563],[.0015802939375649,.0021347678412429,.00019074436384343]],[-496400,[25.466295188546,41.367478338417,5.216476873382],[-.0018054401046468,.0008328308359951,.00080260156912107]],[-467200,[-29.847174904071,10.636426313081,12.297904180106],[-.00063257063052907,-.0029969577578221,-.00074476074151596]],[-438e3,[30.774692107687,-18.236637015304,-14.945535879896],[.0020113162005465,.0019353827024189,-20937793168297e-19]],[-408800,[30.243153324028,38.656267888503,2.938501750218],[-.0016052508674468,.0011183495337525,.00083333973416824]],[-379600,[-27.288984772533,18.643162147874,14.023633623329],[-.0011856388898191,-.0027170609282181,-.00049015526126399]],[-350400,[24.519605196774,-23.245756064727,-14.626862367368],[.0024322321483154,.0016062008146048,-.00023369181613312]],[-321200,[34.505274805875,35.125338586954,.557361475637],[-.0013824391637782,.0013833397561817,.00084823598806262]],[-292e3,[-23.275363915119,25.818514298769,15.055381588598],[-.0016062295460975,-.0023395961498533,-.00024377362639479]],[-262800,[17.050384798092,-27.180376290126,-13.608963321694],[.0028175521080578,.0011358749093955,-.00049548725258825]],[-233600,[38.093671910285,30.880588383337,-1.843688067413],[-.0011317697153459,.0016128814698472,.00084177586176055]],[-204400,[-18.197852930878,31.932869934309,15.438294826279],[-.0019117272501813,-.0019146495909842,-19657304369835e-18]],[-175200,[8.528924039997,-29.618422200048,-11.805400994258],[.0031034370787005,.0005139363329243,-.00077293066202546]],[-146e3,[40.94685725864,25.904973592021,-4.256336240499],[-.00083652705194051,.0018129497136404,.0008156422827306]],[-116800,[-12.326958895325,36.881883446292,15.217158258711],[-.0021166103705038,-.001481442003599,.00017401209844705]],[-87600,[-.633258375909,-30.018759794709,-9.17193287495],[.0032016994581737,-.00025279858672148,-.0010411088271861]],[-58400,[42.936048423883,20.344685584452,-6.588027007912],[-.00050525450073192,.0019910074335507,.00077440196540269]],[-29200,[-5.975910552974,40.61180995846,14.470131723673],[-.0022184202156107,-.0010562361130164,.00033652250216211]],[0,[-9.875369580774,-27.978926224737,-5.753711824704],[.0030287533248818,-.0011276087003636,-.0012651326732361]],[29200,[43.958831986165,14.214147973292,-8.808306227163],[-.00014717608981871,.0021404187242141,.00071486567806614]],[58400,[.67813676352,43.094461639362,13.243238780721],[-.0022358226110718,-.00063233636090933,.00047664798895648]],[87600,[-18.282602096834,-23.30503958666,-1.766620508028],[.0025567245263557,-.0019902940754171,-.0013943491701082]],[116800,[43.873338744526,7.700705617215,-10.814273666425],[.00023174803055677,.0022402163127924,.00062988756452032]],[146e3,[7.392949027906,44.382678951534,11.629500214854],[-.002193281545383,-.00021751799585364,.00059556516201114]],[175200,[-24.981690229261,-16.204012851426,2.466457544298],[.001819398914958,-.0026765419531201,-.0013848283502247]],[204400,[42.530187039511,.845935508021,-12.554907527683],[.00065059779150669,.0022725657282262,.00051133743202822]],[233600,[13.999526486822,44.462363044894,9.669418486465],[-.0021079296569252,.00017533423831993,.00069128485798076]],[262800,[-29.184024803031,-7.371243995762,6.493275957928],[.00093581363109681,-.0030610357109184,-.0012364201089345]],[292e3,[39.831980671753,-6.078405766765,-13.909815358656],[.0011117769689167,.0022362097830152,.00036230548231153]],[321200,[20.294955108476,43.417190420251,7.450091985932],[-.0019742157451535,.00053102050468554,.00075938408813008]],[350400,[-30.66999230216,2.318743558955,9.973480913858],[45605107450676e-18,-.0031308219926928,-.00099066533301924]],[379600,[35.626122155983,-12.897647509224,-14.777586508444],[.0016015684949743,.0021171931182284,.00018002516202204]],[408800,[26.133186148561,41.232139187599,5.00640132622],[-.0017857704419579,.00086046232702817,.00080614690298954]],[438e3,[-29.57674022923,11.863535943587,12.631323039872],[-.00072292830060955,-.0029587820140709,-.000708242964503]],[467200,[29.910805787391,-19.159019294,-15.013363865194],[.0020871080437997,.0018848372554514,-38528655083926e-18]],[496400,[31.375957451819,38.050372720763,2.433138343754],[-.0015546055556611,.0011699815465629,.00083565439266001]],[525600,[-26.360071336928,20.662505904952,14.414696258958],[-.0013142373118349,-.0026236647854842,-.00042542017598193]],[554800,[22.599441488648,-24.508879898306,-14.484045731468],[.0025454108304806,.0014917058755191,-.00030243665086079]],[584e3,[35.877864013014,33.894226366071,-.224524636277],[-.0012941245730845,.0014560427668319,.00084762160640137]],[613200,[-21.538149762417,28.204068269761,15.321973799534],[-.001731211740901,-.0021939631314577,-.0001631691327518]],[642400,[13.971521374415,-28.339941764789,-13.083792871886],[.0029334630526035,.00091860931752944,-.00059939422488627]],[671600,[39.526942044143,28.93989736011,-2.872799527539],[-.0010068481658095,.001702113288809,.00083578230511981]],[700800,[-15.576200701394,34.399412961275,15.466033737854],[-.0020098814612884,-.0017191109825989,70414782780416e-18]],[73e4,[4.24325283709,-30.118201690825,-10.707441231349],[.0031725847067411,.0001609846120227,-.00090672150593868]]];class dn{constructor(e,t,n){this.x=e,this.y=t,this.z=n}clone(){return new dn(this.x,this.y,this.z)}ToAstroVector(e){return new vt(this.x,this.y,this.z,e)}static zero(){return new dn(0,0,0)}quadrature(){return this.x*this.x+this.y*this.y+this.z*this.z}add(e){return new dn(this.x+e.x,this.y+e.y,this.z+e.z)}sub(e){return new dn(this.x-e.x,this.y-e.y,this.z-e.z)}incr(e){this.x+=e.x,this.y+=e.y,this.z+=e.z}decr(e){this.x-=e.x,this.y-=e.y,this.z-=e.z}mul(e){return new dn(e*this.x,e*this.y,e*this.z)}div(e){return new dn(this.x/e,this.y/e,this.z/e)}mean(e){return new dn((this.x+e.x)/2,(this.y+e.y)/2,(this.z+e.z)/2)}neg(){return new dn(-this.x,-this.y,-this.z)}}class Ws{constructor(e,t,n){this.tt=e,this.r=t,this.v=n}clone(){return new Ws(this.tt,this.r,this.v)}sub(e){return new Ws(this.tt,this.r.sub(e.r),this.v.sub(e.v))}}function V5(s){let[e,[t,n,i],[r,a,o]]=s;return new Ws(e,new dn(t,n,i),new dn(r,a,o))}function Go(s,e,t,n){const i=n/(n+ld),r=Au(wi[t],e);return s.r.incr(r.r.mul(i)),s.v.incr(r.v.mul(i)),r}function ua(s,e,t){const n=t.sub(s),i=n.quadrature();return n.mul(e/(i*Math.sqrt(i)))}class Wc{constructor(e){let t=new Ws(e,new dn(0,0,0),new dn(0,0,0));this.Jupiter=Go(t,e,Se.Jupiter,mu),this.Saturn=Go(t,e,Se.Saturn,gu),this.Uranus=Go(t,e,Se.Uranus,vu),this.Neptune=Go(t,e,Se.Neptune,Mu),this.Jupiter.r.decr(t.r),this.Jupiter.v.decr(t.v),this.Saturn.r.decr(t.r),this.Saturn.v.decr(t.v),this.Uranus.r.decr(t.r),this.Uranus.v.decr(t.v),this.Neptune.r.decr(t.r),this.Neptune.v.decr(t.v),this.Sun=new Ws(e,t.r.mul(-1),t.v.mul(-1))}Acceleration(e){let t=ua(e,ld,this.Sun.r);return t.incr(ua(e,mu,this.Jupiter.r)),t.incr(ua(e,gu,this.Saturn.r)),t.incr(ua(e,vu,this.Uranus.r)),t.incr(ua(e,Mu,this.Neptune.r)),t}}class Xc{constructor(e,t,n,i){this.tt=e,this.r=t,this.v=n,this.a=i}clone(){return new Xc(this.tt,this.r.clone(),this.v.clone(),this.a.clone())}}class qm{constructor(e,t){this.bary=e,this.grav=t}}function Pc(s,e,t,n){return new dn(e.x+s*(t.x+s*n.x/2),e.y+s*(t.y+s*n.y/2),e.z+s*(t.z+s*n.z/2))}function Cf(s,e,t){return new dn(e.x+s*t.x,e.y+s*t.y,e.z+s*t.z)}function Ru(s,e){const t=s-e.tt,n=new Wc(s),i=Pc(t,e.r,e.v,e.a),r=n.Acceleration(i).mean(e.a),a=Pc(t,e.r,e.v,r),o=e.v.add(r.mul(t)),c=n.Acceleration(a),l=new Xc(s,a,o,c);return new qm(n,l)}const W5=[];function Ym(s,e){const t=Math.floor(s);return t<0?0:t>=e?e-1:t}function Du(s){const e=V5(s),t=new Wc(e.tt),n=e.r.add(t.Sun.r),i=e.v.add(t.Sun.v),r=t.Acceleration(n),a=new Xc(e.tt,n,i,r);return new qm(t,a)}function X5(s,e){const t=ks[0][0];if(e<t||e>ks[Tu-1][0])return null;const n=Ym((e-t)/G5,Tu-1);if(!s[n]){const r=s[n]=[];r[0]=Du(ks[n]).grav,r[Fi-1]=Du(ks[n+1]).grav;let a,o=r[0].tt;for(a=1;a<Fi-1;++a)r[a]=Ru(o+=Rr,r[a-1]).grav;o=r[Fi-1].tt;var i=[];for(i[Fi-1]=r[Fi-1],a=Fi-2;a>0;--a)i[a]=Ru(o-=Rr,i[a+1]).grav;for(a=Fi-2;a>0;--a){const c=a/(Fi-1);r[a].r=r[a].r.mul(1-c).add(i[a].r.mul(c)),r[a].v=r[a].v.mul(1-c).add(i[a].v.mul(c)),r[a].a=r[a].a.mul(1-c).add(i[a].a.mul(c))}}return s[n]}function Pf(s,e,t){let n=Du(s);const i=Math.ceil((e-n.grav.tt)/t);for(let r=0;r<i;++r)n=Ru(r+1===i?e:n.grav.tt+t,n.grav);return n}function Km(s,e){let t,n,i;const r=X5(W5,s.tt);if(r){const a=Ym((s.tt-r[0].tt)/Rr,Fi-1),o=r[a],c=r[a+1],l=o.a.mean(c.a),h=Pc(s.tt-o.tt,o.r,o.v,l),u=Cf(s.tt-o.tt,o.v,l),d=Pc(s.tt-c.tt,c.r,c.v,l),f=Cf(s.tt-c.tt,c.v,l),p=(s.tt-o.tt)/Rr;t=h.mul(1-p).add(d.mul(p)),n=u.mul(1-p).add(f.mul(p))}else{let a;s.tt<ks[0][0]?a=Pf(ks[0],s.tt,-Rr):a=Pf(ks[Tu-1],s.tt,+Rr),t=a.grav.r,n=a.grav.v,i=a.bary}return i||(i=new Wc(s.tt)),t=t.sub(i.Sun.r),n=n.sub(i.Sun.v),new ms(t.x,t.y,t.z,n.x,n.y,n.z,s)}function vs(s,e){var t=Tt(e);if(s in wi)return zr(wi[s],t);if(s===Se.Pluto){const a=Km(t);return new vt(a.x,a.y,a.z,t)}if(s===Se.Sun)return new vt(0,0,0,t);if(s===Se.Moon){var n=zr(wi.Earth,t),i=Xr(t);return new vt(n.x+i.x,n.y+i.y,n.z+i.z,t)}if(s===Se.EMB){const a=zr(wi.Earth,t),o=Xr(t),c=1+Fm;return new vt(a.x+o.x/c,a.y+o.y/c,a.z+o.z/c,t)}if(s===Se.SSB)return H5(t);const r=hd(s);if(r){const a=new Vc(r.dec,15*r.ra,r.dist);return gd(a,t)}throw`HelioVector: Unknown body "${s}"`}function q5(s,e){let t=e,n=0;for(let i=0;i<10;++i){const r=s(t),a=r.Length()/cd;if(a>1)throw"Object is too distant for light-travel solver.";const o=e.AddDays(-a);if(n=Math.abs(o.tt-t.tt),n<1e-9)return r;t=o}throw`Light-travel time solver did not converge: dt = ${n}`}class Y5{constructor(e,t,n,i){this.observerBody=e,this.targetBody=t,this.aberration=n,this.observerPos=i}Position(e){this.aberration&&(this.observerPos=vs(this.observerBody,e));const t=vs(this.targetBody,e);return new vt(t.x-this.observerPos.x,t.y-this.observerPos.y,t.z-this.observerPos.z,e)}}function K5(s,e,t,n){Dc(n);const i=Tt(s);if(hd(t)){const o=vs(t,i);if(n){const l=J5(e,i),h=new vt(o.x-l.x,o.y-l.y,o.z-l.z,i),u=cd/h.Length();return new vt(h.x+l.vx/u,h.y+l.vy/u,h.z+l.vz/u,i)}const c=vs(e,i);return new vt(o.x-c.x,o.y-c.y,o.z-c.z,i)}let r;n?r=new vt(0,0,0,i):r=vs(e,i);const a=new Y5(e,t,n,r);return q5(o=>a.Position(o),i)}function Cu(s,e,t){Dc(t);const n=Tt(e);switch(s){case Se.Earth:return new vt(0,0,0,n);case Se.Moon:return Xr(n);default:const i=K5(n,Se.Earth,s,t);return i.t=n,i}}function $5(s,e){return new ms(s.r.x,s.r.y,s.r.z,s.v.x,s.v.y,s.v.z,e)}function J5(s,e){const t=Tt(e);switch(s){case Se.Sun:return new ms(0,0,0,0,0,0,t);case Se.SSB:const n=new Wc(t.tt);return new ms(-n.Sun.r.x,-n.Sun.r.y,-n.Sun.r.z,-n.Sun.v.x,-n.Sun.v.y,-n.Sun.v.z,t);case Se.Mercury:case Se.Venus:case Se.Earth:case Se.Mars:case Se.Jupiter:case Se.Saturn:case Se.Uranus:case Se.Neptune:const i=Au(wi[s],t.tt);return $5(i,t);case Se.Pluto:return Km(t);case Se.Moon:case Se.EMB:const r=Au(wi.Earth,t.tt),a=s==Se.Moon?Wm(t):B5(t);return new ms(a.x+r.r.x,a.y+r.r.y,a.z+r.r.z,a.vx+r.v.x,a.vy+r.v.y,a.vz+r.v.z,t);default:if(hd(s)){const o=vs(s,t);return new ms(o.x,o.y,o.z,0,0,0,t)}throw`HelioState: Unsupported body "${s}"`}}function Z5(s){for(;s<0;)s+=360;for(;s>=360;)s-=360;return s}function j5(s,e,t){if(s===Se.Earth||e===Se.Earth)throw"The Earth does not have a longitude as seen from itself.";const n=Tt(t),i=Cu(s,n,!1),r=yu(i),a=Cu(e,n,!1),o=yu(a);return Z5(r.elon-o.elon)}function Q5(s,e,t,n){let i,r=0,a=0,o=0;switch(s){case Se.Mercury:i=-.6,r=4.98,a=-4.88,o=3.02;break;case Se.Venus:e<163.6?(i=-4.47,r=1.03,a=.57,o=.13):(i=.98,r=-1.02);break;case Se.Mars:i=-1.52,r=1.6;break;case Se.Jupiter:i=-9.4,r=.5;break;case Se.Uranus:i=-7.19,r=.25;break;case Se.Neptune:i=-6.87;break;case Se.Pluto:i=-1,r=4;break;default:throw`VisualMagnitude: unsupported body ${s}`}const c=e/100;let l=i+c*(r+c*(a+c*o));return l+=5*Math.log10(t*n),l}function eS(s,e,t,n,i){const r=yu(n),a=ot*28.06,o=ot*(169.51+382e-7*i.tt),c=ot*r.elat,l=ot*r.elon,h=Math.asin(Math.sin(c)*Math.cos(a)-Math.cos(c)*Math.sin(a)*Math.sin(l-o)),u=Math.sin(Math.abs(h));let d=-9+.044*s;return d+=u*(-2.6+1.2*u),d+=5*Math.log10(e*t),{mag:d,ring_tilt:Ti*h}}function tS(s,e,t){let n=s*ot,i=n*n,r=i*i,a=-12.717+1.49*Math.abs(n)+.0431*r;const o=385000.6/Is;let c=t/o;return a+=5*Math.log10(e*c),a}class nS{constructor(e,t,n,i,r,a,o,c){this.time=e,this.mag=t,this.phase_angle=n,this.helio_dist=i,this.geo_dist=r,this.gc=a,this.hc=o,this.ring_tilt=c,this.phase_fraction=(1+Math.cos(ot*n))/2}}function $m(s,e){if(s===Se.Earth)throw"The illumination of the Earth is not defined.";const t=Tt(e),n=zr(wi.Earth,t);let i,r,a,o;s===Se.Sun?(a=new vt(-n.x,-n.y,-n.z,t),r=new vt(0,0,0,t),i=0):(s===Se.Moon?(a=Xr(t),r=new vt(n.x+a.x,n.y+a.y,n.z+a.z,t)):(r=vs(s,e),a=new vt(r.x-n.x,r.y-n.y,r.z-n.z,t)),i=y5(a,r));let c=a.Length(),l=r.Length(),h;if(s===Se.Sun)o=M5+5*Math.log10(c);else if(s===Se.Moon)o=tS(i,l,c);else if(s===Se.Saturn){const u=eS(i,l,c,a,t);o=u.mag,h=u.ring_tilt}else o=Q5(s,i,l,c);return new nS(t,o,i,l,c,a,r,h)}function iS(s){return j5(Se.Moon,Se.Sun,s)}var If;(function(s){s[s.Pericenter=0]="Pericenter",s[s.Apocenter=1]="Apocenter"})(If||(If={}));function Jm(s,e){return new xs([[e.rot[0][0]*s.rot[0][0]+e.rot[1][0]*s.rot[0][1]+e.rot[2][0]*s.rot[0][2],e.rot[0][1]*s.rot[0][0]+e.rot[1][1]*s.rot[0][1]+e.rot[2][1]*s.rot[0][2],e.rot[0][2]*s.rot[0][0]+e.rot[1][2]*s.rot[0][1]+e.rot[2][2]*s.rot[0][2]],[e.rot[0][0]*s.rot[1][0]+e.rot[1][0]*s.rot[1][1]+e.rot[2][0]*s.rot[1][2],e.rot[0][1]*s.rot[1][0]+e.rot[1][1]*s.rot[1][1]+e.rot[2][1]*s.rot[1][2],e.rot[0][2]*s.rot[1][0]+e.rot[1][2]*s.rot[1][1]+e.rot[2][2]*s.rot[1][2]],[e.rot[0][0]*s.rot[2][0]+e.rot[1][0]*s.rot[2][1]+e.rot[2][0]*s.rot[2][2],e.rot[0][1]*s.rot[2][0]+e.rot[1][1]*s.rot[2][1]+e.rot[2][1]*s.rot[2][2],e.rot[0][2]*s.rot[2][0]+e.rot[1][2]*s.rot[2][1]+e.rot[2][2]*s.rot[2][2]]])}function gd(s,e){e=Tt(e);const t=s.lat*ot,n=s.lon*ot,i=s.dist*Math.cos(t);return new vt(i*Math.cos(n),i*Math.sin(n),s.dist*Math.sin(t),e)}function vd(s){const e=sS(s);return new _u(e.lon/15,e.lat,e.dist,s)}function sS(s){const e=s.x*s.x+s.y*s.y,t=Math.sqrt(e+s.z*s.z);let n,i;if(e===0){if(s.z===0)throw"Zero-length vector not allowed.";i=0,n=s.z<0?-90:90}else i=Ti*Math.atan2(s.y,s.x),i<0&&(i+=360),n=Ti*Math.atan2(s.z,Math.sqrt(e));return new Vc(n,i,t)}function Zm(s,e){let t;if(tn(e),e<-90||e>90)return 0;if(s==="normal"||s==="jplhor"){let n=e;n<-1&&(n=-1),t=1.02/Math.tan((n+10.3/(n+5.11))*ot)/60,s==="normal"&&e<-1&&(t*=(e+90)/89)}else if(!s)t=0;else throw`Invalid refraction option: ${s}`;return t}function Br(s,e){return new vt(s.rot[0][0]*e.x+s.rot[1][0]*e.y+s.rot[2][0]*e.z,s.rot[0][1]*e.x+s.rot[1][1]*e.y+s.rot[2][1]*e.z,s.rot[0][2]*e.x+s.rot[1][2]*e.y+s.rot[2][2]*e.z,e.t)}function rS(){return new xs([[1,0,0],[0,.9174821430670688,-.3977769691083922],[0,.3977769691083922,.9174821430670688]])}function aS(){return new xs([[1,0,0],[0,.9174821430670688,.3977769691083922],[0,-.3977769691083922,.9174821430670688]])}function jm(s){s=Tt(s);const e=ud(s,on.From2000),t=dd(s,on.From2000);return Jm(e,t)}function oS(s){s=Tt(s);const e=dd(s,on.Into2000),t=ud(s,on.Into2000);return Jm(e,t)}function cS(s){const t=Za(Tt(s)).tobl*ot,n=Math.cos(t),i=Math.sin(t);return new xs([[1,0,0],[0,+n,+i],[0,-i,+n]])}var Lf;(function(s){s.Penumbral="penumbral",s.Partial="partial",s.Annular="annular",s.Total="total"})(Lf||(Lf={}));var Nf;(function(s){s[s.Invalid=0]="Invalid",s[s.Ascending=1]="Ascending",s[s.Descending=-1]="Descending"})(Nf||(Nf={}));const lS=["Venus","Mars","Jupiter","Saturn"];function Qm(s){return new md(s.lat,s.lng,s.elevationM)}function Md(s,e,t,n,i=!0){const r=Gm(t,Qm(n),s,e,i?"normal":void 0);return{altitudeDeg:r.altitude,azimuthDeg:r.azimuth}}class ei{up;north;west;constructor(e,t){const n=Tt(e),i=Math.sin(t.lat*ki),r=Math.cos(t.lat*ki),a=Math.sin(t.lng*ki),o=Math.cos(t.lng*ki),c=-15*I5(n),l=oS(n);this.up=ei.rotate(l,ei.spin(c,[r*o,r*a,i]),n),this.north=ei.rotate(l,ei.spin(c,[-i*o,-i*a,r]),n),this.west=ei.rotate(l,ei.spin(c,[a,-o,0]),n)}static ofJ2000(e,t,n,i,r=!0){const a=Tt(n),o=gd(new Vc(t,e*15,1),a),c=vd(Br(jm(a),o));return Md(c.ra,c.dec,n,i,r)}position(e,t){const n=Math.sin(t*ki),i=Math.cos(t*ki),r=Math.sin(e*Uf),a=Math.cos(e*Uf),o=i*a,c=i*r,l=n,h=o*this.up[0]+c*this.up[1]+l*this.up[2],u=o*this.north[0]+c*this.north[1]+l*this.north[2],d=o*this.west[0]+c*this.west[1]+l*this.west[2],f=Math.hypot(u,d);let p=0;f>0&&(p=-Of*Math.atan2(d,u),p<0&&(p+=360));let v=Of*Math.atan2(f,h);return v-=Zm("normal",90-v),{altitudeDeg:90-v,azimuthDeg:p}}static spin(e,[t,n,i]){const r=Math.cos(e*ki),a=Math.sin(e*ki);return[r*t+a*n,r*n-a*t,i]}static rotate(e,[t,n,i],r){const a=Br(e,new vt(t,n,i,r));return[a.x,a.y,a.z]}}const ki=Math.PI/180,Of=180/Math.PI,Uf=15*ki;function Bl(s,e,t){const n=Qm(t),i=k5(Se[s],e,n,!0,!0),r=Gm(e,n,i.ra,i.dec,"normal");return{altitudeDeg:r.altitude,azimuthDeg:r.azimuth}}function Hl(s,e){return $m(Se[s],e).mag}function hS(s){const e=iS(s),t=$m(Se.Moon,s);return{phaseFraction:e/360,illuminatedFraction:t.phase_fraction}}const uS=2e3,dS=3,fS=20;function Vo(s,e,t){if(s.year===void 0&&s.month===void 0&&s.day===void 0&&s.hour===void 0)return;const n=s.year!==void 0,i=s.year??uS,r=s.month??(n?1:dS),a=s.day??(n?1:fS),o=t??Math.round(e/15);return new Date(Date.UTC(i,r-1,a,(s.hour??12)-o,s.minute??0,s.second??0))}class fs{static ANCHOR="vec4 diffuseColor = vec4( diffuse, opacity );";static CORE=.18;static RIM=.5;static apply(e){e.transparent=!0,e.depthWrite=!1,e.onBeforeCompile=t=>{t.fragmentShader=fs.patch(t.fragmentShader)}}static patch(e){return e.replace(fs.ANCHOR,`float distanceFromCentre = length( gl_PointCoord - vec2( 0.5 ) );
5180
5180
  // Outside the inscribed circle there is no star at all — this is what kills the corners.
5181
5181
  if ( distanceFromCentre > ${fs.RIM.toFixed(2)} ) discard;
5182
5182
  float glare = 1.0 - smoothstep( ${fs.CORE.toFixed(2)}, ${fs.RIM.toFixed(2)}, distanceFromCentre );
5183
- vec4 diffuseColor = vec4( diffuse, opacity * glare );`)}}const p5=[{name:{en:"Sirius",fr:"Sirius"},raHours:6.7525,decDeg:-16.7161,mag:-1.44},{name:{en:"Canopus",fr:"Canopus"},raHours:6.3992,decDeg:-52.6957,mag:-.62},{name:{en:"Arcturus",fr:"Arcturus"},raHours:14.261,decDeg:19.1824,mag:-.05},{name:{en:"Rigil Kentaurus",fr:"Rigil Kentaurus"},raHours:14.6608,decDeg:-60.834,mag:-.01},{name:{en:"Vega",fr:"Véga"},raHours:18.6156,decDeg:38.7837,mag:.03},{name:{en:"Capella",fr:"Capella"},raHours:5.2782,decDeg:45.998,mag:.08},{name:{en:"Rigel",fr:"Rigel"},raHours:5.2423,decDeg:-8.2016,mag:.18},{name:{en:"Procyon",fr:"Procyon"},raHours:7.655,decDeg:5.225,mag:.4},{name:{en:"Achernar",fr:"Achernar"},raHours:1.6286,decDeg:-57.2368,mag:.45},{name:{en:"Betelgeuse",fr:"Bételgeuse"},raHours:5.9195,decDeg:7.4071,mag:.45},{name:{en:"Hadar",fr:"Hadar"},raHours:14.0637,decDeg:-60.373,mag:.61},{name:{en:"Altair",fr:"Altaïr"},raHours:19.8464,decDeg:8.8683,mag:.76},{name:{en:"Acrux",fr:"Acrux"},raHours:12.4433,decDeg:-63.0991,mag:.77},{name:{en:"Aldebaran",fr:"Aldébaran"},raHours:4.5987,decDeg:16.5093,mag:.87},{name:{en:"Spica",fr:"Spica"},raHours:13.4199,decDeg:-11.1613,mag:.98},{name:{en:"Antares",fr:"Antarès"},raHours:16.4901,decDeg:-26.432,mag:1.06},{name:{en:"Pollux",fr:"Pollux"},raHours:7.7553,decDeg:28.0262,mag:1.16},{name:{en:"Fomalhaut",fr:"Fomalhaut"},raHours:22.9608,decDeg:-29.6222,mag:1.17},{name:{en:"Mimosa",fr:"Mimosa"},raHours:12.7954,decDeg:-59.6888,mag:1.25},{name:{en:"Deneb",fr:"Deneb"},raHours:20.6905,decDeg:45.2803,mag:1.25},{name:{en:"Toliman",fr:"Toliman"},raHours:14.6603,decDeg:-60.8383,mag:1.35},{name:{en:"Regulus",fr:"Régulus"},raHours:10.1395,decDeg:11.9672,mag:1.36},{name:{en:"Adhara",fr:"Adhara"},raHours:6.9771,decDeg:-28.9721,mag:1.5},{name:{en:"Castor",fr:"Castor"},raHours:7.5766,decDeg:31.8883,mag:1.58},{name:{en:"Gacrux",fr:"Gacrux"},raHours:12.5194,decDeg:-57.1132,mag:1.59},{name:{en:"Shaula",fr:"Shaula"},raHours:17.5601,decDeg:-37.1038,mag:1.62},{name:{en:"Bellatrix",fr:"Bellatrix"},raHours:5.4189,decDeg:6.3497,mag:1.64},{name:{en:"Elnath",fr:"Elnath"},raHours:5.4382,decDeg:28.6075,mag:1.65},{name:{en:"Miaplacidus",fr:"Miaplacidus"},raHours:9.22,decDeg:-69.7172,mag:1.67},{name:{en:"Alnilam",fr:"Alnilam"},raHours:5.6036,decDeg:-1.2019,mag:1.69},{name:{en:"Alnair",fr:"Alnair"},raHours:22.1372,decDeg:-46.961,mag:1.73},{name:{en:"Alnitak",fr:"Alnitak"},raHours:5.6793,decDeg:-1.9426,mag:1.74},{name:{en:"γ² Velorum",fr:"γ² Velorum"},raHours:8.1589,decDeg:-47.3366,mag:1.75},{name:{en:"Alioth",fr:"Alioth"},raHours:12.9005,decDeg:55.9598,mag:1.76},{name:{en:"Mirfak",fr:"Mirfak"},raHours:3.4054,decDeg:49.8612,mag:1.79},{name:{en:"Kaus Australis",fr:"Kaus Australis"},raHours:18.4029,decDeg:-34.3846,mag:1.79},{name:{en:"Dubhe",fr:"Dubhe"},raHours:11.0622,decDeg:61.751,mag:1.81},{name:{en:"Wezen",fr:"Wezen"},raHours:7.1399,decDeg:-26.3932,mag:1.83},{name:{en:"Alkaid",fr:"Alkaid"},raHours:13.7924,decDeg:49.3133,mag:1.85},{name:{en:"Avior",fr:"Avior"},raHours:8.3752,decDeg:-59.5095,mag:1.86},{name:{en:"Sargas",fr:"Sargas"},raHours:17.622,decDeg:-42.9978,mag:1.86},{name:{en:"Menkalinan",fr:"Menkalinan"},raHours:5.9921,decDeg:44.9474,mag:1.9},{name:{en:"Atria",fr:"Atria"},raHours:16.8111,decDeg:-69.0277,mag:1.91},{name:{en:"Alhena",fr:"Alhena"},raHours:6.6285,decDeg:16.3993,mag:1.93},{name:{en:"Alsephina",fr:"Alsephina"},raHours:8.7451,decDeg:-54.7088,mag:1.93},{name:{en:"Peacock",fr:"Peacock"},raHours:20.4275,decDeg:-56.7351,mag:1.94},{name:{en:"Polaris",fr:"Polaris"},raHours:2.5297,decDeg:89.2641,mag:1.97},{name:{en:"Mirzam",fr:"Mirzam"},raHours:6.3783,decDeg:-17.9559,mag:1.98},{name:{en:"Alphard",fr:"Alphard"},raHours:9.4598,decDeg:-8.6586,mag:1.99},{name:{en:"Hamal",fr:"Hamal"},raHours:2.1196,decDeg:23.4624,mag:2.01},{name:{en:"Algieba",fr:"Algieba"},raHours:10.3329,decDeg:19.8415,mag:2.01},{name:{en:"Diphda",fr:"Diphda"},raHours:.7265,decDeg:-17.9866,mag:2.04},{name:{en:"Nunki",fr:"Nunki"},raHours:18.9211,decDeg:-26.2967,mag:2.05},{name:{en:"Menkent",fr:"Menkent"},raHours:14.1114,decDeg:-36.37,mag:2.06},{name:{en:"Alpheratz",fr:"Alpheratz"},raHours:.1398,decDeg:29.0904,mag:2.07},{name:{en:"Mirach",fr:"Mirach"},raHours:1.1622,decDeg:35.6206,mag:2.07},{name:{en:"Saiph",fr:"Saiph"},raHours:5.7959,decDeg:-9.6696,mag:2.07},{name:{en:"Kochab",fr:"Kochab"},raHours:14.8451,decDeg:74.1555,mag:2.07},{name:{en:"Tiaki",fr:"Tiaki"},raHours:22.7111,decDeg:-46.8846,mag:2.07},{name:{en:"Rasalhague",fr:"Rasalhague"},raHours:17.5822,decDeg:12.56,mag:2.08},{name:{en:"Algol",fr:"Algol"},raHours:3.1361,decDeg:40.9556,mag:2.09},{name:{en:"Almach",fr:"Almach"},raHours:2.065,decDeg:42.3297,mag:2.1},{name:{en:"Denebola",fr:"Denebola"},raHours:11.8177,decDeg:14.5721,mag:2.14},{name:{en:"Cih",fr:"Cih"},raHours:.9451,decDeg:60.7167,mag:2.15},{name:{en:"γ Centauri",fr:"γ Centauri"},raHours:12.692,decDeg:-48.9599,mag:2.2},{name:{en:"Naos",fr:"Naos"},raHours:8.0597,decDeg:-40.0031,mag:2.21},{name:{en:"Aspidiske",fr:"Aspidiske"},raHours:9.2848,decDeg:-59.2752,mag:2.21},{name:{en:"Alphecca",fr:"Alphecca"},raHours:15.5781,decDeg:26.7147,mag:2.22},{name:{en:"Suhail",fr:"Suhail"},raHours:9.1333,decDeg:-43.4326,mag:2.23},{name:{en:"Mizar",fr:"Mizar"},raHours:13.3987,decDeg:54.9254,mag:2.23},{name:{en:"Sadr",fr:"Sadr"},raHours:20.3705,decDeg:40.2567,mag:2.23},{name:{en:"Schedar",fr:"Schedar"},raHours:.6751,decDeg:56.5373,mag:2.24},{name:{en:"Eltanin",fr:"Eltanin"},raHours:17.9434,decDeg:51.4889,mag:2.24},{name:{en:"Mintaka",fr:"Mintaka"},raHours:5.5334,decDeg:-.2991,mag:2.25},{name:{en:"Caph",fr:"Caph"},raHours:.1529,decDeg:59.1498,mag:2.28},{name:{en:"ε Centauri",fr:"ε Centauri"},raHours:13.6648,decDeg:-53.4664,mag:2.29},{name:{en:"Dschubba",fr:"Dschubba"},raHours:16.0056,decDeg:-22.6217,mag:2.29},{name:{en:"Larawag",fr:"Larawag"},raHours:16.8361,decDeg:-34.2932,mag:2.29},{name:{en:"α Lupi",fr:"α Lupi"},raHours:14.6988,decDeg:-47.3882,mag:2.3},{name:{en:"η Centauri",fr:"η Centauri"},raHours:14.5918,decDeg:-42.1578,mag:2.33},{name:{en:"Merak",fr:"Merak"},raHours:11.0307,decDeg:56.3824,mag:2.34},{name:{en:"Izar",fr:"Izar"},raHours:14.7498,decDeg:27.0742,mag:2.35},{name:{en:"Enif",fr:"Enif"},raHours:21.7364,decDeg:9.875,mag:2.38},{name:{en:"κ Scorpii",fr:"κ Scorpii"},raHours:17.7081,decDeg:-39.03,mag:2.39},{name:{en:"Ankaa",fr:"Ankaa"},raHours:.4381,decDeg:-42.306,mag:2.4},{name:{en:"Phecda",fr:"Phecda"},raHours:11.8972,decDeg:53.6948,mag:2.41},{name:{en:"Sabik",fr:"Sabik"},raHours:17.173,decDeg:-15.7249,mag:2.43},{name:{en:"Scheat",fr:"Scheat"},raHours:23.0629,decDeg:28.0828,mag:2.44},{name:{en:"Aludra",fr:"Aludra"},raHours:7.4016,decDeg:-29.3031,mag:2.45},{name:{en:"Alderamin",fr:"Alderamin"},raHours:21.3096,decDeg:62.5856,mag:2.45},{name:{en:"Markeb",fr:"Markeb"},raHours:9.3686,decDeg:-55.0107,mag:2.47},{name:{en:"Aljanah",fr:"Aljanah"},raHours:20.7702,decDeg:33.9703,mag:2.48},{name:{en:"Markab",fr:"Markab"},raHours:23.0793,decDeg:15.2053,mag:2.49},{name:{en:"Menkar",fr:"Menkar"},raHours:3.038,decDeg:4.0897,mag:2.54},{name:{en:"ζ Ophiuchi",fr:"ζ Ophiuchi"},raHours:16.6193,decDeg:-10.5671,mag:2.54},{name:{en:"ζ Centauri",fr:"ζ Centauri"},raHours:13.9257,decDeg:-47.2884,mag:2.55},{name:{en:"Zosma",fr:"Zosma"},raHours:11.2351,decDeg:20.5237,mag:2.56},{name:{en:"Acrab",fr:"Acrab"},raHours:16.0906,decDeg:-19.8055,mag:2.56},{name:{en:"Arneb",fr:"Arneb"},raHours:5.5455,decDeg:-17.8223,mag:2.58},{name:{en:"δ Centauri",fr:"δ Centauri"},raHours:12.1393,decDeg:-50.7224,mag:2.58},{name:{en:"Gienah",fr:"Gienah"},raHours:12.2634,decDeg:-17.5419,mag:2.58},{name:{en:"Ascella",fr:"Ascella"},raHours:19.0435,decDeg:-29.8801,mag:2.6},{name:{en:"Zubeneschamali",fr:"Zubeneschamali"},raHours:15.2834,decDeg:-9.3829,mag:2.61},{name:{en:"Unukalhai",fr:"Unukalhai"},raHours:15.7378,decDeg:6.4256,mag:2.63},{name:{en:"Sheratan",fr:"Sheratan"},raHours:1.9107,decDeg:20.808,mag:2.64},{name:{en:"Phact",fr:"Phact"},raHours:5.6608,decDeg:-34.0741,mag:2.65},{name:{en:"Mahasim",fr:"Mahasim"},raHours:5.9954,decDeg:37.2126,mag:2.65},{name:{en:"Kraz",fr:"Kraz"},raHours:12.5731,decDeg:-23.3968,mag:2.65},{name:{en:"Ruchbah",fr:"Ruchbah"},raHours:1.4302,decDeg:60.2353,mag:2.66},{name:{en:"Muphrid",fr:"Muphrid"},raHours:13.9114,decDeg:18.3977,mag:2.68},{name:{en:"β Lupi",fr:"β Lupi"},raHours:14.9755,decDeg:-43.134,mag:2.68},{name:{en:"Hassaleh",fr:"Hassaleh"},raHours:4.9499,decDeg:33.1661,mag:2.69},{name:{en:"μ Velorum",fr:"μ Velorum"},raHours:10.7795,decDeg:-49.4203,mag:2.69},{name:{en:"α Muscae",fr:"α Muscae"},raHours:12.6197,decDeg:-69.1356,mag:2.69},{name:{en:"Lesath",fr:"Lesath"},raHours:17.5127,decDeg:-37.2958,mag:2.7},{name:{en:"π Puppis",fr:"π Puppis"},raHours:7.2857,decDeg:-37.0975,mag:2.71},{name:{en:"Kaus Media",fr:"Kaus Media"},raHours:18.3499,decDeg:-29.8281,mag:2.72},{name:{en:"Tarazed",fr:"Tarazed"},raHours:19.771,decDeg:10.6133,mag:2.72},{name:{en:"Yed Prior",fr:"Yed Prior"},raHours:16.2391,decDeg:-3.6943,mag:2.73},{name:{en:"Athebyne",fr:"Athebyne"},raHours:16.3999,decDeg:61.5142,mag:2.73},{name:{en:"θ Carinae",fr:"θ Carinae"},raHours:10.7159,decDeg:-64.3945,mag:2.74},{name:{en:"Porrima",fr:"Porrima"},raHours:12.6943,decDeg:-1.4494,mag:2.74},{name:{en:"Hatysa",fr:"Hatysa"},raHours:5.5906,decDeg:-5.9099,mag:2.75},{name:{en:"ι Centauri",fr:"ι Centauri"},raHours:13.3433,decDeg:-36.7123,mag:2.75},{name:{en:"Zubenelgenubi",fr:"Zubenelgenubi"},raHours:14.848,decDeg:-16.0418,mag:2.75},{name:{en:"Cebalrai",fr:"Cebalrai"},raHours:17.7245,decDeg:4.5673,mag:2.76},{name:{en:"Cursa",fr:"Cursa"},raHours:5.1308,decDeg:-5.0864,mag:2.78},{name:{en:"Kornephoros",fr:"Kornephoros"},raHours:16.5037,decDeg:21.4896,mag:2.78},{name:{en:"Rasalgethi",fr:"Rasalgethi"},raHours:17.2441,decDeg:14.3903,mag:2.78},{name:{en:"Imai",fr:"Imai"},raHours:12.2524,decDeg:-58.7489,mag:2.79},{name:{en:"Rastaban",fr:"Rastaban"},raHours:17.5072,decDeg:52.3014,mag:2.79},{name:{en:"γ Lupi",fr:"γ Lupi"},raHours:15.5857,decDeg:-41.1668,mag:2.8},{name:{en:"Nihal",fr:"Nihal"},raHours:5.4708,decDeg:-20.7594,mag:2.81},{name:{en:"ζ Herculis",fr:"ζ Herculis"},raHours:16.6881,decDeg:31.6027,mag:2.81},{name:{en:"β Hydri",fr:"β Hydri"},raHours:.4279,decDeg:-77.2542,mag:2.82},{name:{en:"Paikauhale",fr:"Paikauhale"},raHours:16.598,decDeg:-28.216,mag:2.82},{name:{en:"Kaus Borealis",fr:"Kaus Borealis"},raHours:18.4662,decDeg:-25.4217,mag:2.82},{name:{en:"Algenib",fr:"Algenib"},raHours:.2206,decDeg:15.1836,mag:2.83},{name:{en:"Tureis",fr:"Tureis"},raHours:8.1257,decDeg:-24.3043,mag:2.83},{name:{en:"β Trianguli Australis",fr:"β Trianguli Australis"},raHours:15.9191,decDeg:-63.4307,mag:2.83},{name:{en:"ζ Persei",fr:"ζ Persei"},raHours:3.9022,decDeg:31.8836,mag:2.84},{name:{en:"β Arae",fr:"β Arae"},raHours:17.4217,decDeg:-55.5299,mag:2.84},{name:{en:"α Arae",fr:"α Arae"},raHours:17.5307,decDeg:-49.8761,mag:2.84},{name:{en:"Alcyone",fr:"Alcyone"},raHours:3.7914,decDeg:24.1051,mag:2.85},{name:{en:"Vindemiatrix",fr:"Vindemiatrix"},raHours:13.0363,decDeg:10.9591,mag:2.85},{name:{en:"Deneb Algedi",fr:"Deneb Algedi"},raHours:21.784,decDeg:-16.1273,mag:2.85},{name:{en:"Castor B",fr:"Castor B"},raHours:7.5768,decDeg:31.8905,mag:2.85},{name:{en:"α Hydri",fr:"α Hydri"},raHours:1.9795,decDeg:-61.5699,mag:2.86},{name:{en:"Fawaris",fr:"Fawaris"},raHours:19.7496,decDeg:45.1308,mag:2.86},{name:{en:"Tejat",fr:"Tejat"},raHours:6.3827,decDeg:22.5136,mag:2.87},{name:{en:"γ Trianguli Australis",fr:"γ Trianguli Australis"},raHours:15.3152,decDeg:-68.6795,mag:2.87},{name:{en:"α Tucanae",fr:"α Tucanae"},raHours:22.3084,decDeg:-60.2596,mag:2.87},{name:{en:"Acamar",fr:"Acamar"},raHours:2.971,decDeg:-40.3047,mag:2.88},{name:{en:"Albaldah",fr:"Albaldah"},raHours:19.1627,decDeg:-21.0236,mag:2.88},{name:{en:"Gomeisa",fr:"Gomeisa"},raHours:7.4525,decDeg:8.2893,mag:2.89},{name:{en:"Cor Caroli",fr:"Cor Caroli"},raHours:12.9338,decDeg:38.3184,mag:2.89},{name:{en:"Fang",fr:"Fang"},raHours:15.9809,decDeg:-26.1141,mag:2.89},{name:{en:"ε Persei",fr:"ε Persei"},raHours:3.9642,decDeg:40.0102,mag:2.9},{name:{en:"Alniyat",fr:"Alniyat"},raHours:16.3531,decDeg:-25.5928,mag:2.9},{name:{en:"Sadalsuud",fr:"Sadalsuud"},raHours:21.526,decDeg:-5.5712,mag:2.9},{name:{en:"γ Persei",fr:"γ Persei"},raHours:3.0799,decDeg:53.5064,mag:2.91},{name:{en:"υ Carinae",fr:"υ Carinae"},raHours:9.785,decDeg:-65.072,mag:2.92},{name:{en:"Matar",fr:"Matar"},raHours:22.7167,decDeg:30.2212,mag:2.93},{name:{en:"τ Puppis",fr:"τ Puppis"},raHours:6.8323,decDeg:-50.6146,mag:2.94},{name:{en:"Algorab",fr:"Algorab"},raHours:12.4977,decDeg:-16.5154,mag:2.94},{name:{en:"Sadalmelik",fr:"Sadalmelik"},raHours:22.0964,decDeg:-.3199,mag:2.95},{name:{en:"Zaurak",fr:"Zaurak"},raHours:3.9672,decDeg:-13.5085,mag:2.97},{name:{en:"Tianguan",fr:"Tianguan"},raHours:5.6274,decDeg:21.1425,mag:2.97},{name:{en:"Ras Elased Australis",fr:"Ras Elased Australis"},raHours:9.7642,decDeg:23.7743,mag:2.97},{name:{en:"Alnasl",fr:"Alnasl"},raHours:18.0968,decDeg:-30.4241,mag:2.98},{name:{en:"γ Hydrae",fr:"γ Hydrae"},raHours:13.3154,decDeg:-23.1715,mag:2.99},{name:{en:"ι¹ Scorpii",fr:"ι¹ Scorpii"},raHours:17.7931,decDeg:-40.127,mag:2.99},{name:{en:"Okab",fr:"Okab"},raHours:19.0902,decDeg:13.8635,mag:2.99},{name:{en:"β Trianguli",fr:"β Trianguli"},raHours:2.1591,decDeg:34.9873,mag:3},{name:{en:"ψ Ursae Majoris",fr:"ψ Ursae Majoris"},raHours:11.1611,decDeg:44.4985,mag:3},{name:{en:"Pherkad",fr:"Pherkad"},raHours:15.3455,decDeg:71.834,mag:3},{name:{en:"Xamidimura",fr:"Xamidimura"},raHours:16.8645,decDeg:-38.0474,mag:3},{name:{en:"Aldhanab",fr:"Aldhanab"},raHours:21.8988,decDeg:-37.3649,mag:3}],ba=64,$t=ba+1,Ff=512,m5=900,g5=700/900,v5=0,M5=.01;function x5(s,e,t){return{north:Hi(0,-t,s,e).lat,south:Hi(0,t,s,e).lat,east:Hi(t,0,s,e).lng,west:Hi(-t,0,s,e).lng}}async function _5(s,e,t,n=m5){const i=n,r=n*g5,a=x5(s,e,i),o={width:$t,height:$t},[c,l]=await Promise.all([t.elevation.getElevationGrid(a,o),t.imagery.getImageryTexture(a,{width:Ff,height:Ff})]),h=Math.floor($t/2),u=c.heights[h*$t+h],d=new Float32Array($t*$t*3),f=new Float32Array($t*$t*2),p=new Float32Array($t*$t*4);for(let S=0;S<$t;S++){const E=S/($t-1),R=a.north+(a.south-a.north)*E;for(let M=0;M<$t;M++){const A=M/($t-1),P=a.west+(a.east-a.west)*A,{x:D,z:I}=rn(R,P,s,e),F=c.heights[S*$t+M],H=Math.max(Math.abs(D),Math.abs(I)),O=1-y5((H-r)/(i-r),0,1),V=v5+M5+(F-u),z=S*$t+M;d[z*3]=D,d[z*3+1]=V,d[z*3+2]=I;const Y=Vp(l.bounds,P,R);f[z*2]=Y.x,f[z*2+1]=Y.y,p[z*4]=1,p[z*4+1]=1,p[z*4+2]=1,p[z*4+3]=O}}const v=new Uint16Array(ba*ba*6);let m=0;for(let S=0;S<ba;S++)for(let E=0;E<ba;E++){const R=S*$t+E,M=R+1,A=R+$t,P=A+1;v[m++]=R,v[m++]=A,v[m++]=M,v[m++]=M,v[m++]=A,v[m++]=P}const g=new Mt;g.setAttribute("position",new tt(d,3)),g.setAttribute("uv",new tt(f,2)),g.setAttribute("color",new tt(p,4)),g.setIndex(new tt(v,1)),g.computeVertexNormals();const b=new Ri(l.source);b.flipY=!1;const w=new Ya({map:b,color:new oe(1,1,1),vertexColors:!0,transparent:!0,fog:!0}),_=new Ge(g,w);return _.receiveShadow=!0,_.castShadow=!0,{mesh:_,attribution:t.imagery.attribution}}function y5(s,e,t){return Math.max(e,Math.min(t,s))}const S5=18,b5=.55,w5=.5,E5=`
5183
+ vec4 diffuseColor = vec4( diffuse, opacity * glare );`)}}const pS=[{name:{en:"Sirius",fr:"Sirius"},raHours:6.7525,decDeg:-16.7161,mag:-1.44},{name:{en:"Canopus",fr:"Canopus"},raHours:6.3992,decDeg:-52.6957,mag:-.62},{name:{en:"Arcturus",fr:"Arcturus"},raHours:14.261,decDeg:19.1824,mag:-.05},{name:{en:"Rigil Kentaurus",fr:"Rigil Kentaurus"},raHours:14.6608,decDeg:-60.834,mag:-.01},{name:{en:"Vega",fr:"Véga"},raHours:18.6156,decDeg:38.7837,mag:.03},{name:{en:"Capella",fr:"Capella"},raHours:5.2782,decDeg:45.998,mag:.08},{name:{en:"Rigel",fr:"Rigel"},raHours:5.2423,decDeg:-8.2016,mag:.18},{name:{en:"Procyon",fr:"Procyon"},raHours:7.655,decDeg:5.225,mag:.4},{name:{en:"Achernar",fr:"Achernar"},raHours:1.6286,decDeg:-57.2368,mag:.45},{name:{en:"Betelgeuse",fr:"Bételgeuse"},raHours:5.9195,decDeg:7.4071,mag:.45},{name:{en:"Hadar",fr:"Hadar"},raHours:14.0637,decDeg:-60.373,mag:.61},{name:{en:"Altair",fr:"Altaïr"},raHours:19.8464,decDeg:8.8683,mag:.76},{name:{en:"Acrux",fr:"Acrux"},raHours:12.4433,decDeg:-63.0991,mag:.77},{name:{en:"Aldebaran",fr:"Aldébaran"},raHours:4.5987,decDeg:16.5093,mag:.87},{name:{en:"Spica",fr:"Spica"},raHours:13.4199,decDeg:-11.1613,mag:.98},{name:{en:"Antares",fr:"Antarès"},raHours:16.4901,decDeg:-26.432,mag:1.06},{name:{en:"Pollux",fr:"Pollux"},raHours:7.7553,decDeg:28.0262,mag:1.16},{name:{en:"Fomalhaut",fr:"Fomalhaut"},raHours:22.9608,decDeg:-29.6222,mag:1.17},{name:{en:"Mimosa",fr:"Mimosa"},raHours:12.7954,decDeg:-59.6888,mag:1.25},{name:{en:"Deneb",fr:"Deneb"},raHours:20.6905,decDeg:45.2803,mag:1.25},{name:{en:"Toliman",fr:"Toliman"},raHours:14.6603,decDeg:-60.8383,mag:1.35},{name:{en:"Regulus",fr:"Régulus"},raHours:10.1395,decDeg:11.9672,mag:1.36},{name:{en:"Adhara",fr:"Adhara"},raHours:6.9771,decDeg:-28.9721,mag:1.5},{name:{en:"Castor",fr:"Castor"},raHours:7.5766,decDeg:31.8883,mag:1.58},{name:{en:"Gacrux",fr:"Gacrux"},raHours:12.5194,decDeg:-57.1132,mag:1.59},{name:{en:"Shaula",fr:"Shaula"},raHours:17.5601,decDeg:-37.1038,mag:1.62},{name:{en:"Bellatrix",fr:"Bellatrix"},raHours:5.4189,decDeg:6.3497,mag:1.64},{name:{en:"Elnath",fr:"Elnath"},raHours:5.4382,decDeg:28.6075,mag:1.65},{name:{en:"Miaplacidus",fr:"Miaplacidus"},raHours:9.22,decDeg:-69.7172,mag:1.67},{name:{en:"Alnilam",fr:"Alnilam"},raHours:5.6036,decDeg:-1.2019,mag:1.69},{name:{en:"Alnair",fr:"Alnair"},raHours:22.1372,decDeg:-46.961,mag:1.73},{name:{en:"Alnitak",fr:"Alnitak"},raHours:5.6793,decDeg:-1.9426,mag:1.74},{name:{en:"γ² Velorum",fr:"γ² Velorum"},raHours:8.1589,decDeg:-47.3366,mag:1.75},{name:{en:"Alioth",fr:"Alioth"},raHours:12.9005,decDeg:55.9598,mag:1.76},{name:{en:"Mirfak",fr:"Mirfak"},raHours:3.4054,decDeg:49.8612,mag:1.79},{name:{en:"Kaus Australis",fr:"Kaus Australis"},raHours:18.4029,decDeg:-34.3846,mag:1.79},{name:{en:"Dubhe",fr:"Dubhe"},raHours:11.0622,decDeg:61.751,mag:1.81},{name:{en:"Wezen",fr:"Wezen"},raHours:7.1399,decDeg:-26.3932,mag:1.83},{name:{en:"Alkaid",fr:"Alkaid"},raHours:13.7924,decDeg:49.3133,mag:1.85},{name:{en:"Avior",fr:"Avior"},raHours:8.3752,decDeg:-59.5095,mag:1.86},{name:{en:"Sargas",fr:"Sargas"},raHours:17.622,decDeg:-42.9978,mag:1.86},{name:{en:"Menkalinan",fr:"Menkalinan"},raHours:5.9921,decDeg:44.9474,mag:1.9},{name:{en:"Atria",fr:"Atria"},raHours:16.8111,decDeg:-69.0277,mag:1.91},{name:{en:"Alhena",fr:"Alhena"},raHours:6.6285,decDeg:16.3993,mag:1.93},{name:{en:"Alsephina",fr:"Alsephina"},raHours:8.7451,decDeg:-54.7088,mag:1.93},{name:{en:"Peacock",fr:"Peacock"},raHours:20.4275,decDeg:-56.7351,mag:1.94},{name:{en:"Polaris",fr:"Polaris"},raHours:2.5297,decDeg:89.2641,mag:1.97},{name:{en:"Mirzam",fr:"Mirzam"},raHours:6.3783,decDeg:-17.9559,mag:1.98},{name:{en:"Alphard",fr:"Alphard"},raHours:9.4598,decDeg:-8.6586,mag:1.99},{name:{en:"Hamal",fr:"Hamal"},raHours:2.1196,decDeg:23.4624,mag:2.01},{name:{en:"Algieba",fr:"Algieba"},raHours:10.3329,decDeg:19.8415,mag:2.01},{name:{en:"Diphda",fr:"Diphda"},raHours:.7265,decDeg:-17.9866,mag:2.04},{name:{en:"Nunki",fr:"Nunki"},raHours:18.9211,decDeg:-26.2967,mag:2.05},{name:{en:"Menkent",fr:"Menkent"},raHours:14.1114,decDeg:-36.37,mag:2.06},{name:{en:"Alpheratz",fr:"Alpheratz"},raHours:.1398,decDeg:29.0904,mag:2.07},{name:{en:"Mirach",fr:"Mirach"},raHours:1.1622,decDeg:35.6206,mag:2.07},{name:{en:"Saiph",fr:"Saiph"},raHours:5.7959,decDeg:-9.6696,mag:2.07},{name:{en:"Kochab",fr:"Kochab"},raHours:14.8451,decDeg:74.1555,mag:2.07},{name:{en:"Tiaki",fr:"Tiaki"},raHours:22.7111,decDeg:-46.8846,mag:2.07},{name:{en:"Rasalhague",fr:"Rasalhague"},raHours:17.5822,decDeg:12.56,mag:2.08},{name:{en:"Algol",fr:"Algol"},raHours:3.1361,decDeg:40.9556,mag:2.09},{name:{en:"Almach",fr:"Almach"},raHours:2.065,decDeg:42.3297,mag:2.1},{name:{en:"Denebola",fr:"Denebola"},raHours:11.8177,decDeg:14.5721,mag:2.14},{name:{en:"Cih",fr:"Cih"},raHours:.9451,decDeg:60.7167,mag:2.15},{name:{en:"γ Centauri",fr:"γ Centauri"},raHours:12.692,decDeg:-48.9599,mag:2.2},{name:{en:"Naos",fr:"Naos"},raHours:8.0597,decDeg:-40.0031,mag:2.21},{name:{en:"Aspidiske",fr:"Aspidiske"},raHours:9.2848,decDeg:-59.2752,mag:2.21},{name:{en:"Alphecca",fr:"Alphecca"},raHours:15.5781,decDeg:26.7147,mag:2.22},{name:{en:"Suhail",fr:"Suhail"},raHours:9.1333,decDeg:-43.4326,mag:2.23},{name:{en:"Mizar",fr:"Mizar"},raHours:13.3987,decDeg:54.9254,mag:2.23},{name:{en:"Sadr",fr:"Sadr"},raHours:20.3705,decDeg:40.2567,mag:2.23},{name:{en:"Schedar",fr:"Schedar"},raHours:.6751,decDeg:56.5373,mag:2.24},{name:{en:"Eltanin",fr:"Eltanin"},raHours:17.9434,decDeg:51.4889,mag:2.24},{name:{en:"Mintaka",fr:"Mintaka"},raHours:5.5334,decDeg:-.2991,mag:2.25},{name:{en:"Caph",fr:"Caph"},raHours:.1529,decDeg:59.1498,mag:2.28},{name:{en:"ε Centauri",fr:"ε Centauri"},raHours:13.6648,decDeg:-53.4664,mag:2.29},{name:{en:"Dschubba",fr:"Dschubba"},raHours:16.0056,decDeg:-22.6217,mag:2.29},{name:{en:"Larawag",fr:"Larawag"},raHours:16.8361,decDeg:-34.2932,mag:2.29},{name:{en:"α Lupi",fr:"α Lupi"},raHours:14.6988,decDeg:-47.3882,mag:2.3},{name:{en:"η Centauri",fr:"η Centauri"},raHours:14.5918,decDeg:-42.1578,mag:2.33},{name:{en:"Merak",fr:"Merak"},raHours:11.0307,decDeg:56.3824,mag:2.34},{name:{en:"Izar",fr:"Izar"},raHours:14.7498,decDeg:27.0742,mag:2.35},{name:{en:"Enif",fr:"Enif"},raHours:21.7364,decDeg:9.875,mag:2.38},{name:{en:"κ Scorpii",fr:"κ Scorpii"},raHours:17.7081,decDeg:-39.03,mag:2.39},{name:{en:"Ankaa",fr:"Ankaa"},raHours:.4381,decDeg:-42.306,mag:2.4},{name:{en:"Phecda",fr:"Phecda"},raHours:11.8972,decDeg:53.6948,mag:2.41},{name:{en:"Sabik",fr:"Sabik"},raHours:17.173,decDeg:-15.7249,mag:2.43},{name:{en:"Scheat",fr:"Scheat"},raHours:23.0629,decDeg:28.0828,mag:2.44},{name:{en:"Aludra",fr:"Aludra"},raHours:7.4016,decDeg:-29.3031,mag:2.45},{name:{en:"Alderamin",fr:"Alderamin"},raHours:21.3096,decDeg:62.5856,mag:2.45},{name:{en:"Markeb",fr:"Markeb"},raHours:9.3686,decDeg:-55.0107,mag:2.47},{name:{en:"Aljanah",fr:"Aljanah"},raHours:20.7702,decDeg:33.9703,mag:2.48},{name:{en:"Markab",fr:"Markab"},raHours:23.0793,decDeg:15.2053,mag:2.49},{name:{en:"Menkar",fr:"Menkar"},raHours:3.038,decDeg:4.0897,mag:2.54},{name:{en:"ζ Ophiuchi",fr:"ζ Ophiuchi"},raHours:16.6193,decDeg:-10.5671,mag:2.54},{name:{en:"ζ Centauri",fr:"ζ Centauri"},raHours:13.9257,decDeg:-47.2884,mag:2.55},{name:{en:"Zosma",fr:"Zosma"},raHours:11.2351,decDeg:20.5237,mag:2.56},{name:{en:"Acrab",fr:"Acrab"},raHours:16.0906,decDeg:-19.8055,mag:2.56},{name:{en:"Arneb",fr:"Arneb"},raHours:5.5455,decDeg:-17.8223,mag:2.58},{name:{en:"δ Centauri",fr:"δ Centauri"},raHours:12.1393,decDeg:-50.7224,mag:2.58},{name:{en:"Gienah",fr:"Gienah"},raHours:12.2634,decDeg:-17.5419,mag:2.58},{name:{en:"Ascella",fr:"Ascella"},raHours:19.0435,decDeg:-29.8801,mag:2.6},{name:{en:"Zubeneschamali",fr:"Zubeneschamali"},raHours:15.2834,decDeg:-9.3829,mag:2.61},{name:{en:"Unukalhai",fr:"Unukalhai"},raHours:15.7378,decDeg:6.4256,mag:2.63},{name:{en:"Sheratan",fr:"Sheratan"},raHours:1.9107,decDeg:20.808,mag:2.64},{name:{en:"Phact",fr:"Phact"},raHours:5.6608,decDeg:-34.0741,mag:2.65},{name:{en:"Mahasim",fr:"Mahasim"},raHours:5.9954,decDeg:37.2126,mag:2.65},{name:{en:"Kraz",fr:"Kraz"},raHours:12.5731,decDeg:-23.3968,mag:2.65},{name:{en:"Ruchbah",fr:"Ruchbah"},raHours:1.4302,decDeg:60.2353,mag:2.66},{name:{en:"Muphrid",fr:"Muphrid"},raHours:13.9114,decDeg:18.3977,mag:2.68},{name:{en:"β Lupi",fr:"β Lupi"},raHours:14.9755,decDeg:-43.134,mag:2.68},{name:{en:"Hassaleh",fr:"Hassaleh"},raHours:4.9499,decDeg:33.1661,mag:2.69},{name:{en:"μ Velorum",fr:"μ Velorum"},raHours:10.7795,decDeg:-49.4203,mag:2.69},{name:{en:"α Muscae",fr:"α Muscae"},raHours:12.6197,decDeg:-69.1356,mag:2.69},{name:{en:"Lesath",fr:"Lesath"},raHours:17.5127,decDeg:-37.2958,mag:2.7},{name:{en:"π Puppis",fr:"π Puppis"},raHours:7.2857,decDeg:-37.0975,mag:2.71},{name:{en:"Kaus Media",fr:"Kaus Media"},raHours:18.3499,decDeg:-29.8281,mag:2.72},{name:{en:"Tarazed",fr:"Tarazed"},raHours:19.771,decDeg:10.6133,mag:2.72},{name:{en:"Yed Prior",fr:"Yed Prior"},raHours:16.2391,decDeg:-3.6943,mag:2.73},{name:{en:"Athebyne",fr:"Athebyne"},raHours:16.3999,decDeg:61.5142,mag:2.73},{name:{en:"θ Carinae",fr:"θ Carinae"},raHours:10.7159,decDeg:-64.3945,mag:2.74},{name:{en:"Porrima",fr:"Porrima"},raHours:12.6943,decDeg:-1.4494,mag:2.74},{name:{en:"Hatysa",fr:"Hatysa"},raHours:5.5906,decDeg:-5.9099,mag:2.75},{name:{en:"ι Centauri",fr:"ι Centauri"},raHours:13.3433,decDeg:-36.7123,mag:2.75},{name:{en:"Zubenelgenubi",fr:"Zubenelgenubi"},raHours:14.848,decDeg:-16.0418,mag:2.75},{name:{en:"Cebalrai",fr:"Cebalrai"},raHours:17.7245,decDeg:4.5673,mag:2.76},{name:{en:"Cursa",fr:"Cursa"},raHours:5.1308,decDeg:-5.0864,mag:2.78},{name:{en:"Kornephoros",fr:"Kornephoros"},raHours:16.5037,decDeg:21.4896,mag:2.78},{name:{en:"Rasalgethi",fr:"Rasalgethi"},raHours:17.2441,decDeg:14.3903,mag:2.78},{name:{en:"Imai",fr:"Imai"},raHours:12.2524,decDeg:-58.7489,mag:2.79},{name:{en:"Rastaban",fr:"Rastaban"},raHours:17.5072,decDeg:52.3014,mag:2.79},{name:{en:"γ Lupi",fr:"γ Lupi"},raHours:15.5857,decDeg:-41.1668,mag:2.8},{name:{en:"Nihal",fr:"Nihal"},raHours:5.4708,decDeg:-20.7594,mag:2.81},{name:{en:"ζ Herculis",fr:"ζ Herculis"},raHours:16.6881,decDeg:31.6027,mag:2.81},{name:{en:"β Hydri",fr:"β Hydri"},raHours:.4279,decDeg:-77.2542,mag:2.82},{name:{en:"Paikauhale",fr:"Paikauhale"},raHours:16.598,decDeg:-28.216,mag:2.82},{name:{en:"Kaus Borealis",fr:"Kaus Borealis"},raHours:18.4662,decDeg:-25.4217,mag:2.82},{name:{en:"Algenib",fr:"Algenib"},raHours:.2206,decDeg:15.1836,mag:2.83},{name:{en:"Tureis",fr:"Tureis"},raHours:8.1257,decDeg:-24.3043,mag:2.83},{name:{en:"β Trianguli Australis",fr:"β Trianguli Australis"},raHours:15.9191,decDeg:-63.4307,mag:2.83},{name:{en:"ζ Persei",fr:"ζ Persei"},raHours:3.9022,decDeg:31.8836,mag:2.84},{name:{en:"β Arae",fr:"β Arae"},raHours:17.4217,decDeg:-55.5299,mag:2.84},{name:{en:"α Arae",fr:"α Arae"},raHours:17.5307,decDeg:-49.8761,mag:2.84},{name:{en:"Alcyone",fr:"Alcyone"},raHours:3.7914,decDeg:24.1051,mag:2.85},{name:{en:"Vindemiatrix",fr:"Vindemiatrix"},raHours:13.0363,decDeg:10.9591,mag:2.85},{name:{en:"Deneb Algedi",fr:"Deneb Algedi"},raHours:21.784,decDeg:-16.1273,mag:2.85},{name:{en:"Castor B",fr:"Castor B"},raHours:7.5768,decDeg:31.8905,mag:2.85},{name:{en:"α Hydri",fr:"α Hydri"},raHours:1.9795,decDeg:-61.5699,mag:2.86},{name:{en:"Fawaris",fr:"Fawaris"},raHours:19.7496,decDeg:45.1308,mag:2.86},{name:{en:"Tejat",fr:"Tejat"},raHours:6.3827,decDeg:22.5136,mag:2.87},{name:{en:"γ Trianguli Australis",fr:"γ Trianguli Australis"},raHours:15.3152,decDeg:-68.6795,mag:2.87},{name:{en:"α Tucanae",fr:"α Tucanae"},raHours:22.3084,decDeg:-60.2596,mag:2.87},{name:{en:"Acamar",fr:"Acamar"},raHours:2.971,decDeg:-40.3047,mag:2.88},{name:{en:"Albaldah",fr:"Albaldah"},raHours:19.1627,decDeg:-21.0236,mag:2.88},{name:{en:"Gomeisa",fr:"Gomeisa"},raHours:7.4525,decDeg:8.2893,mag:2.89},{name:{en:"Cor Caroli",fr:"Cor Caroli"},raHours:12.9338,decDeg:38.3184,mag:2.89},{name:{en:"Fang",fr:"Fang"},raHours:15.9809,decDeg:-26.1141,mag:2.89},{name:{en:"ε Persei",fr:"ε Persei"},raHours:3.9642,decDeg:40.0102,mag:2.9},{name:{en:"Alniyat",fr:"Alniyat"},raHours:16.3531,decDeg:-25.5928,mag:2.9},{name:{en:"Sadalsuud",fr:"Sadalsuud"},raHours:21.526,decDeg:-5.5712,mag:2.9},{name:{en:"γ Persei",fr:"γ Persei"},raHours:3.0799,decDeg:53.5064,mag:2.91},{name:{en:"υ Carinae",fr:"υ Carinae"},raHours:9.785,decDeg:-65.072,mag:2.92},{name:{en:"Matar",fr:"Matar"},raHours:22.7167,decDeg:30.2212,mag:2.93},{name:{en:"τ Puppis",fr:"τ Puppis"},raHours:6.8323,decDeg:-50.6146,mag:2.94},{name:{en:"Algorab",fr:"Algorab"},raHours:12.4977,decDeg:-16.5154,mag:2.94},{name:{en:"Sadalmelik",fr:"Sadalmelik"},raHours:22.0964,decDeg:-.3199,mag:2.95},{name:{en:"Zaurak",fr:"Zaurak"},raHours:3.9672,decDeg:-13.5085,mag:2.97},{name:{en:"Tianguan",fr:"Tianguan"},raHours:5.6274,decDeg:21.1425,mag:2.97},{name:{en:"Ras Elased Australis",fr:"Ras Elased Australis"},raHours:9.7642,decDeg:23.7743,mag:2.97},{name:{en:"Alnasl",fr:"Alnasl"},raHours:18.0968,decDeg:-30.4241,mag:2.98},{name:{en:"γ Hydrae",fr:"γ Hydrae"},raHours:13.3154,decDeg:-23.1715,mag:2.99},{name:{en:"ι¹ Scorpii",fr:"ι¹ Scorpii"},raHours:17.7931,decDeg:-40.127,mag:2.99},{name:{en:"Okab",fr:"Okab"},raHours:19.0902,decDeg:13.8635,mag:2.99},{name:{en:"β Trianguli",fr:"β Trianguli"},raHours:2.1591,decDeg:34.9873,mag:3},{name:{en:"ψ Ursae Majoris",fr:"ψ Ursae Majoris"},raHours:11.1611,decDeg:44.4985,mag:3},{name:{en:"Pherkad",fr:"Pherkad"},raHours:15.3455,decDeg:71.834,mag:3},{name:{en:"Xamidimura",fr:"Xamidimura"},raHours:16.8645,decDeg:-38.0474,mag:3},{name:{en:"Aldhanab",fr:"Aldhanab"},raHours:21.8988,decDeg:-37.3649,mag:3}],ba=64,$t=ba+1,Ff=512,mS=900,gS=700/900,vS=0,MS=.01;function xS(s,e,t){return{north:Hi(0,-t,s,e).lat,south:Hi(0,t,s,e).lat,east:Hi(t,0,s,e).lng,west:Hi(-t,0,s,e).lng}}async function _S(s,e,t,n=mS){const i=n,r=n*gS,a=xS(s,e,i),o={width:$t,height:$t},[c,l]=await Promise.all([t.elevation.getElevationGrid(a,o),t.imagery.getImageryTexture(a,{width:Ff,height:Ff})]),h=Math.floor($t/2),u=c.heights[h*$t+h],d=new Float32Array($t*$t*3),f=new Float32Array($t*$t*2),p=new Float32Array($t*$t*4);for(let S=0;S<$t;S++){const E=S/($t-1),R=a.north+(a.south-a.north)*E;for(let M=0;M<$t;M++){const A=M/($t-1),P=a.west+(a.east-a.west)*A,{x:D,z:I}=rn(R,P,s,e),F=c.heights[S*$t+M],H=Math.max(Math.abs(D),Math.abs(I)),O=1-yS((H-r)/(i-r),0,1),V=vS+MS+(F-u),z=S*$t+M;d[z*3]=D,d[z*3+1]=V,d[z*3+2]=I;const Y=Vp(l.bounds,P,R);f[z*2]=Y.x,f[z*2+1]=Y.y,p[z*4]=1,p[z*4+1]=1,p[z*4+2]=1,p[z*4+3]=O}}const v=new Uint16Array(ba*ba*6);let m=0;for(let S=0;S<ba;S++)for(let E=0;E<ba;E++){const R=S*$t+E,M=R+1,A=R+$t,P=A+1;v[m++]=R,v[m++]=A,v[m++]=M,v[m++]=M,v[m++]=A,v[m++]=P}const g=new Mt;g.setAttribute("position",new tt(d,3)),g.setAttribute("uv",new tt(f,2)),g.setAttribute("color",new tt(p,4)),g.setIndex(new tt(v,1)),g.computeVertexNormals();const b=new Ri(l.source);b.flipY=!1;const w=new Ya({map:b,color:new oe(1,1,1),vertexColors:!0,transparent:!0,fog:!0}),_=new Ge(g,w);return _.receiveShadow=!0,_.castShadow=!0,{mesh:_,attribution:t.imagery.attribution}}function yS(s,e,t){return Math.max(e,Math.min(t,s))}const SS=18,bS=.55,wS=.5,ES=`
5184
5184
  attribute float aSpeed;
5185
5185
  uniform float uTime;
5186
5186
  uniform float uOverallSpeed;
@@ -5238,9 +5238,9 @@ void main() {
5238
5238
  vec2 travel = vec2((ahead.x - here.x) * uAspect, ahead.y - here.y);
5239
5239
  // Straight down is the texture's own orientation, so that is the zero.
5240
5240
  vSlant = length(travel) < 1e-6 ? 0.0 : atan(travel.x, -travel.y);
5241
- gl_PointSize = uPixelSize / dist + vNearBlur * ${S5.toFixed(1)};
5241
+ gl_PointSize = uPixelSize / dist + vNearBlur * ${SS.toFixed(1)};
5242
5242
  }
5243
- `,A5=`
5243
+ `,AS=`
5244
5244
  precision mediump float;
5245
5245
  uniform sampler2D uTexture;
5246
5246
  uniform vec3 uColor;
@@ -5276,11 +5276,11 @@ void main() {
5276
5276
  // defocus doesn't change color, only spreads+dims (see vertex shader's own gl_PointSize term) —
5277
5277
  // both dim the alpha so a maximally blurred/hazy drop doesn't stay as visually "solid" as a sharp
5278
5278
  // one right in the middle distance.
5279
- vec3 color = mix(uColor, uHazeColor, vHaze * ${b5.toFixed(2)});
5279
+ vec3 color = mix(uColor, uHazeColor, vHaze * ${bS.toFixed(2)});
5280
5280
  float blur = max(vNearBlur, vHaze);
5281
- gl_FragColor = vec4(color, tex.a * uOpacity * (1.0 - blur * ${w5.toFixed(2)}));
5281
+ gl_FragColor = vec4(color, tex.a * uOpacity * (1.0 - blur * ${wS.toFixed(2)}));
5282
5282
  }
5283
- `;function T5(s){let e=s;return function(){e|=0,e=e+1831565813|0;let n=Math.imul(e^e>>>15,1|e);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}const R5=.14,kf=4.5;let Wo;function D5(){if(Wo)return Wo;const s=128,e=document.createElement("canvas");e.width=s,e.height=s;const t=e.getContext("2d"),n=t.createImageData(s,s),i=s/2,r=s*R5,a=s-r;for(let o=0;o<s;o++)for(let c=0;c<s;c++){const l=c+.5-i,h=o+.5<r?o+.5-r:o+.5>a?o+.5-a:0,u=Math.hypot(l,h),d=Math.exp(-(u*u)/(2*kf*kf)),f=(o*s+c)*4;n.data[f]=255,n.data[f+1]=255,n.data[f+2]=255,n.data[f+3]=Math.round(255*Math.min(1,d))}return t.putImageData(n,0,0),Wo=new Ri(e),Wo}function C5(s){const e=T5(s.seed),t=new Float32Array(s.count*3),n=new Float32Array(s.count),i=s.radiusM;for(let l=0;l<s.count;l++){const h=e()*Math.PI*2,u=Math.sqrt(e())*s.radiusM;t[l*3]=Math.cos(h)*u,t[l*3+1]=e()*s.heightM,t[l*3+2]=Math.sin(h)*u,n[l]=.85+e()*.3}const r=new Mt;r.setAttribute("position",new tt(t,3)),r.setAttribute("aSpeed",new tt(n,1)),r.setDrawRange(0,s.visibleCount);const a={uTime:{value:0},uOverallSpeed:{value:s.overallSpeed},uPixelSize:{value:s.pixelSize},uOpacity:{value:s.opacity},uColor:{value:s.color},uUvSquash:{value:1},uSpeedStreak:{value:s.speedStreak},uWindOffset:{value:new Pe(0,0)},uDropVelocity:{value:new C(0,-1,0)},uAspect:{value:1},uHeight:{value:s.heightM},uBottomY:{value:s.bottomYM},uHalfWidth:{value:i},uTexture:{value:D5()},uNearFocusDistance:{value:s.nearFocusDistanceM},uHazeDistance:{value:s.hazeDistanceM},uHazeColor:{value:s.hazeColor}},o=new At({uniforms:a,vertexShader:E5,fragmentShader:A5,transparent:!0,depthWrite:!1,depthTest:!0}),c=new Ra(r,o);return c.frustumCulled=!1,{points:c,uniforms:a}}class Xs{static S10_MAG_PER_ARCSEC2=10+2.5*Math.log10(3600*3600);static toMagPerArcsec2(e){return Xs.S10_MAG_PER_ARCSEC2-2.5*Math.log10(Math.max(e,1e-12))}static fromMagPerArcsec2(e){return 10**(.4*(Xs.S10_MAG_PER_ARCSEC2-e))}static latitudeOfRowCoord(e){const t=2*e-1;return 90*Math.sign(t)*t*t}static rowCoordOfLatitude(e){return(Math.sign(e)*Math.sqrt(Math.min(Math.abs(e),90)/90)+1)/2}static angleOfColumnCoord(e){return 180*e*e}static columnCoordOfAngle(e){return Math.sqrt(Math.min(Math.max(e,0),180)/180)}}class Ze{static LONGITUDE_STEPS=256;static LATITUDE_STEPS=128;static SUN_RADIUS_KPC=8.2;static SUN_HEIGHT_KPC=.02;static DISK_SCALE_LENGTH_KPC=2.6;static DISK_SCALE_HEIGHT_KPC=.3;static BULGE_SCALE_KPC=.5;static BULGE_FLATTENING=.6;static BULGE_TO_LOCAL_DISK=20;static DUST_SCALE_LENGTH_KPC=3.5;static DUST_SCALE_HEIGHT_KPC=.1;static EXTINCTION_MAG_PER_KPC=.8;static NEAR_LIMIT_KPC=.01;static FAR_LIMIT_KPC=40;static STEPS=192;static OPAQUE_MAG=15;static PEAK_MAG_PER_ARCSEC2=21;static PEAK_RADIANCE=6.278;static PEAK_LONGITUDE_DEG=0;static PEAK_LATITUDE_DEG=4.5;surfaceBrightnessS10(e,t){return this.radianceTowards(e,t)*Ze.anchor()}static anchor(){return Xs.fromMagPerArcsec2(Ze.PEAK_MAG_PER_ARCSEC2)/Ze.PEAK_RADIANCE}radianceTowards(e,t){return this.trace(e,t).light}extinctionTowards(e,t){return this.trace(e,t).extinctionMag}trace(e,t){const n=e*Math.PI/180,i=t*Math.PI/180,r=-Math.cos(i)*Math.cos(n),a=Math.cos(i)*Math.sin(n),o=Math.sin(i);let c=0,l=0,h=0;const u=Math.log(Ze.NEAR_LIMIT_KPC),d=Math.log(Ze.FAR_LIMIT_KPC)-u;for(let f=0;f<Ze.STEPS;f++){const p=Math.exp(u+d*f/(Ze.STEPS-1)),v=p-h;h=p;const m=p-v/2,g=Ze.SUN_RADIUS_KPC+m*r,b=m*a,w=Ze.SUN_HEIGHT_KPC+m*o,_=Math.hypot(g,b),S=Math.exp(-(_-Ze.SUN_RADIUS_KPC)/Ze.DISK_SCALE_LENGTH_KPC-Math.abs(w)/Ze.DISK_SCALE_HEIGHT_KPC),E=Math.hypot(_,w/Ze.BULGE_FLATTENING),R=Ze.BULGE_TO_LOCAL_DISK*Math.exp(-E/Ze.BULGE_SCALE_KPC);if(c+=(S+R)*v*10**(-.4*l),l+=Ze.EXTINCTION_MAG_PER_KPC*Math.exp(-(_-Ze.SUN_RADIUS_KPC)/Ze.DUST_SCALE_LENGTH_KPC-(Math.abs(w)-Ze.SUN_HEIGHT_KPC)/Ze.DUST_SCALE_HEIGHT_KPC)*v,l>Ze.OPAQUE_MAG)break}return{light:c,extinctionMag:l}}values=new Float32Array(Ze.LONGITUDE_STEPS*Ze.LATITUDE_STEPS);walked=0;get done(){return this.walked>=Ze.LATITUDE_STEPS}walk(e){const t=Ze.LONGITUDE_STEPS,n=Math.min(Ze.LATITUDE_STEPS,this.walked+e);for(;this.walked<n;this.walked++){const i=Xs.latitudeOfRowCoord((this.walked+.5)/Ze.LATITUDE_STEPS);for(let r=0;r<t;r++)this.values[this.walked*t+r]=this.radianceTowards(360*(r+.5)/t,i)}}harvest(){let e=Number.POSITIVE_INFINITY;for(const i of this.values)i<e&&(e=i);const t=Ze.anchor(),n=new Float32Array(this.values.length);for(let i=0;i<n.length;i++)n[i]=(this.values[i]-e)*t;return{width:Ze.LONGITUDE_STEPS,height:Ze.LATITUDE_STEPS,data:n}}}class wt{static LONGITUDE_STEPS=128;static LATITUDE_STEPS=96;static RADIAL_FALLOFF=1.3;static FAN_EXPONENT=2.6;static SUBLIMATION_AU=.1;static NEAR_LIMIT_AU=.004;static FAR_LIMIT_AU=8;static STEPS=224;static LOBE_ASYMMETRY=[.7,-.2,-.81];static LOBE_WEIGHT=[.665,.33,.00541];static RIGHT_ANGLE_S10=200;static POLE_S10=77;surfaceBrightnessS10(e,t){return this.radianceTowards(e,t)*this.anchor()}anchored;anchor(){return this.anchored===void 0&&(this.anchored=wt.RIGHT_ANGLE_S10/this.radianceTowards(90,0)),this.anchored}radianceTowards(e,t){const n=e*Math.PI/180,i=t*Math.PI/180,r=-Math.cos(i)*Math.cos(n),a=-Math.cos(i)*Math.sin(n),o=Math.sin(i),c=-r;let l=0,h=0;const u=Math.log(wt.NEAR_LIMIT_AU),d=Math.log(wt.FAR_LIMIT_AU)-u;for(let f=0;f<wt.STEPS;f++){const p=Math.exp(u+d*f/(wt.STEPS-1)),v=p-h;h=p;const m=p-v/2,g=1+m*r,b=m*a,w=m*o,_=Math.hypot(g,b,w);if(_<wt.SUBLIMATION_AU)continue;const S=w/_,E=_**-1.3*Math.exp(-2.6*Math.abs(S)),R=(c-m)/_;l+=E*this.scattering(R)*v/(_*_)}return l}scattering(e){let t=0;for(let n=0;n<wt.LOBE_ASYMMETRY.length;n++){const i=wt.LOBE_ASYMMETRY[n],r=1+i*i-2*i*e;t+=wt.LOBE_WEIGHT[n]*(1-i*i)/(4*Math.PI*r**1.5)}return t}values=new Float32Array(wt.LONGITUDE_STEPS*wt.LATITUDE_STEPS);walked=0;get done(){return this.walked>=wt.LATITUDE_STEPS}walk(e){const t=wt.LONGITUDE_STEPS,n=Math.min(wt.LATITUDE_STEPS,this.walked+e);for(;this.walked<n;this.walked++){const i=Xs.latitudeOfRowCoord((this.walked+.5)/wt.LATITUDE_STEPS);for(let r=0;r<t;r++){const a=Xs.angleOfColumnCoord((r+.5)/t);this.values[this.walked*t+r]=this.radianceTowards(a,i)}}}harvest(){const e=this.anchor();let t=Number.POSITIVE_INFINITY;for(const i of this.values)i<t&&(t=i);const n=new Float32Array(this.values.length);for(let i=0;i<n.length;i++)n[i]=(this.values[i]-t)*e;return{width:wt.LONGITUDE_STEPS,height:wt.LATITUDE_STEPS,data:n}}}class Je{static get NANOLAMBERTS_PER_S10(){return Je.toNanolamberts(10+2.5*Math.log10(3600*3600))}static nanolambertsOfS10(e){return e*Je.NANOLAMBERTS_PER_S10}static TWILIGHT=[{sunAltitudeDeg:90,magPerArcsec2:3.5},{sunAltitudeDeg:10,magPerArcsec2:4.2},{sunAltitudeDeg:0,magPerArcsec2:7.5},{sunAltitudeDeg:-4,magPerArcsec2:13},{sunAltitudeDeg:-6,magPerArcsec2:15.6},{sunAltitudeDeg:-8,magPerArcsec2:17.2},{sunAltitudeDeg:-10,magPerArcsec2:18.5},{sunAltitudeDeg:-12,magPerArcsec2:19.7},{sunAltitudeDeg:-14,magPerArcsec2:20.8},{sunAltitudeDeg:-16,magPerArcsec2:21.6},{sunAltitudeDeg:-18,magPerArcsec2:21.9},{sunAltitudeDeg:-24,magPerArcsec2:22}];static moonlessMagPerArcsec2(e){const t=Je.TWILIGHT;for(let n=0;n<t.length-1;n++){const i=t[n],r=t[n+1];if(e<=i.sunAltitudeDeg&&e>=r.sunAltitudeDeg){const a=(i.sunAltitudeDeg-e)/(i.sunAltitudeDeg-r.sunAltitudeDeg);return i.magPerArcsec2+(r.magPerArcsec2-i.magPerArcsec2)*a}}return e>0?t[0].magPerArcsec2:t[t.length-1].magPerArcsec2}static toNanolamberts(e){return 34.08*Math.exp(Je.NANOLAMBERT_OFFSET-Je.PER_MAGNITUDE*e)}static fromNanolamberts(e){return(Je.NANOLAMBERT_OFFSET-Math.log(Math.max(e,1e-6)/34.08))/Je.PER_MAGNITUDE}static NANOLAMBERT_OFFSET=20.7233;static PER_MAGNITUDE=Math.LN10/2.5;static airMass(e){const t=Math.cos(Math.max(e,0)*Math.PI/180);return 1/Math.sqrt(Math.max(1-.96*t*t,.001))}static EXTINCTION_PER_AIR_MASS=.172;static scatteringAt(e){const t=Math.min(Math.max(e,0),180)*Math.PI/180;return 10**5.36*(1.06+Math.cos(t)**2)+10**(6.15-Math.min(e,180)/40)}static scatteredFraction(e){return 1-10**(-.4*Je.EXTINCTION_PER_AIR_MASS*Je.airMass(e))}static AIRGLOW_MAG_PER_ARCSEC2=22;static twilightExcessNanolamberts(e){return Math.max(0,Je.toNanolamberts(Je.moonlessMagPerArcsec2(e))-Je.toNanolamberts(Je.AIRGLOW_MAG_PER_ARCSEC2))}static twilightOutput(e){const t=Je.scatteringAt(90-e)*Je.scatteredFraction(90);return Je.twilightExcessNanolamberts(e)/t}static moonNanolamberts(e,t,n,i){return Je.scatteringAt(n)*Je.moonOutput(e,t)*Je.scatteredFraction(i)}static moonOutput(e,t){if(t<=0)return 0;const n=Math.min(Math.abs(e),180);return 10**(-.4*(3.84+.026*n+4e-9*n**4))*10**(-.4*Je.EXTINCTION_PER_AIR_MASS*Je.airMass(t))}static phaseAngleOf(e){return Math.acos(Math.min(Math.max(2*e-1,-1),1))*180/Math.PI}static magPerArcsec2(e,t,n){const i=Je.scatteredFraction(n),r=Je.scatteringAt(e.separationDeg)*Je.twilightOutput(e.altitudeDeg)*i,a=Je.scatteringAt(t.separationDeg)*Je.moonOutput(t.phaseAngleDeg,t.altitudeDeg)*i;return Je.fromNanolamberts(Je.toNanolamberts(Je.AIRGLOW_MAG_PER_ARCSEC2)+r+a)}}class ls{static RADIUS=890;static TOO_BRIGHT_MAG_PER_ARCSEC2=16;static MILKY_WAY_TINT=[.9,.94,1];static ZODIACAL_TINT=[1,.97,.9];object;material;maps=Ls.shared;milkyWayTexture;zodiacalTexture;milkyWayTexels;zodiacalTexels;repaint;constructor(){this.milkyWayTexels=this.maps.milkyWayTexels,this.milkyWayTexture=ls.buildTexture(this.milkyWayTexels,Ze.LONGITUDE_STEPS,Ze.LATITUDE_STEPS,ka),this.zodiacalTexels=this.maps.zodiacalTexels,this.zodiacalTexture=ls.buildTexture(this.zodiacalTexels,wt.LONGITUDE_STEPS,wt.LATITUDE_STEPS,xn),this.material=new At({uniforms:{uMilkyWay:{value:this.milkyWayTexture},uZodiacal:{value:this.zodiacalTexture},uGalactic:{value:new ze},uEclipticPole:{value:new C(0,1,0)},uSunLongitude:{value:new C(1,0,0)},uMoonDirection:{value:new C(0,-1,0)},uMoonOutput:{value:0},uSunDirection:{value:new C(0,-1,0)},uTwilightOutput:{value:0},uAirglowNanolamberts:{value:Je.toNanolamberts(Je.AIRGLOW_MAG_PER_ARCSEC2)},uSkyColor:{value:new C(0,0,0)},uMilkyWayTint:{value:new C(...ls.MILKY_WAY_TINT)},uZodiacalTint:{value:new C(...ls.ZODIACAL_TINT)},uReady:{value:this.maps.done?1:0},uEncodeDestination:{value:1}},vertexShader:`
5283
+ `;function TS(s){let e=s;return function(){e|=0,e=e+1831565813|0;let n=Math.imul(e^e>>>15,1|e);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}const RS=.14,kf=4.5;let Wo;function DS(){if(Wo)return Wo;const s=128,e=document.createElement("canvas");e.width=s,e.height=s;const t=e.getContext("2d"),n=t.createImageData(s,s),i=s/2,r=s*RS,a=s-r;for(let o=0;o<s;o++)for(let c=0;c<s;c++){const l=c+.5-i,h=o+.5<r?o+.5-r:o+.5>a?o+.5-a:0,u=Math.hypot(l,h),d=Math.exp(-(u*u)/(2*kf*kf)),f=(o*s+c)*4;n.data[f]=255,n.data[f+1]=255,n.data[f+2]=255,n.data[f+3]=Math.round(255*Math.min(1,d))}return t.putImageData(n,0,0),Wo=new Ri(e),Wo}function CS(s){const e=TS(s.seed),t=new Float32Array(s.count*3),n=new Float32Array(s.count),i=s.radiusM;for(let l=0;l<s.count;l++){const h=e()*Math.PI*2,u=Math.sqrt(e())*s.radiusM;t[l*3]=Math.cos(h)*u,t[l*3+1]=e()*s.heightM,t[l*3+2]=Math.sin(h)*u,n[l]=.85+e()*.3}const r=new Mt;r.setAttribute("position",new tt(t,3)),r.setAttribute("aSpeed",new tt(n,1)),r.setDrawRange(0,s.visibleCount);const a={uTime:{value:0},uOverallSpeed:{value:s.overallSpeed},uPixelSize:{value:s.pixelSize},uOpacity:{value:s.opacity},uColor:{value:s.color},uUvSquash:{value:1},uSpeedStreak:{value:s.speedStreak},uWindOffset:{value:new Pe(0,0)},uDropVelocity:{value:new C(0,-1,0)},uAspect:{value:1},uHeight:{value:s.heightM},uBottomY:{value:s.bottomYM},uHalfWidth:{value:i},uTexture:{value:DS()},uNearFocusDistance:{value:s.nearFocusDistanceM},uHazeDistance:{value:s.hazeDistanceM},uHazeColor:{value:s.hazeColor}},o=new At({uniforms:a,vertexShader:ES,fragmentShader:AS,transparent:!0,depthWrite:!1,depthTest:!0}),c=new Ra(r,o);return c.frustumCulled=!1,{points:c,uniforms:a}}class Xs{static S10_MAG_PER_ARCSEC2=10+2.5*Math.log10(3600*3600);static toMagPerArcsec2(e){return Xs.S10_MAG_PER_ARCSEC2-2.5*Math.log10(Math.max(e,1e-12))}static fromMagPerArcsec2(e){return 10**(.4*(Xs.S10_MAG_PER_ARCSEC2-e))}static latitudeOfRowCoord(e){const t=2*e-1;return 90*Math.sign(t)*t*t}static rowCoordOfLatitude(e){return(Math.sign(e)*Math.sqrt(Math.min(Math.abs(e),90)/90)+1)/2}static angleOfColumnCoord(e){return 180*e*e}static columnCoordOfAngle(e){return Math.sqrt(Math.min(Math.max(e,0),180)/180)}}class Ze{static LONGITUDE_STEPS=256;static LATITUDE_STEPS=128;static SUN_RADIUS_KPC=8.2;static SUN_HEIGHT_KPC=.02;static DISK_SCALE_LENGTH_KPC=2.6;static DISK_SCALE_HEIGHT_KPC=.3;static BULGE_SCALE_KPC=.5;static BULGE_FLATTENING=.6;static BULGE_TO_LOCAL_DISK=20;static DUST_SCALE_LENGTH_KPC=3.5;static DUST_SCALE_HEIGHT_KPC=.1;static EXTINCTION_MAG_PER_KPC=.8;static NEAR_LIMIT_KPC=.01;static FAR_LIMIT_KPC=40;static STEPS=192;static OPAQUE_MAG=15;static PEAK_MAG_PER_ARCSEC2=21;static PEAK_RADIANCE=6.278;static PEAK_LONGITUDE_DEG=0;static PEAK_LATITUDE_DEG=4.5;surfaceBrightnessS10(e,t){return this.radianceTowards(e,t)*Ze.anchor()}static anchor(){return Xs.fromMagPerArcsec2(Ze.PEAK_MAG_PER_ARCSEC2)/Ze.PEAK_RADIANCE}radianceTowards(e,t){return this.trace(e,t).light}extinctionTowards(e,t){return this.trace(e,t).extinctionMag}trace(e,t){const n=e*Math.PI/180,i=t*Math.PI/180,r=-Math.cos(i)*Math.cos(n),a=Math.cos(i)*Math.sin(n),o=Math.sin(i);let c=0,l=0,h=0;const u=Math.log(Ze.NEAR_LIMIT_KPC),d=Math.log(Ze.FAR_LIMIT_KPC)-u;for(let f=0;f<Ze.STEPS;f++){const p=Math.exp(u+d*f/(Ze.STEPS-1)),v=p-h;h=p;const m=p-v/2,g=Ze.SUN_RADIUS_KPC+m*r,b=m*a,w=Ze.SUN_HEIGHT_KPC+m*o,_=Math.hypot(g,b),S=Math.exp(-(_-Ze.SUN_RADIUS_KPC)/Ze.DISK_SCALE_LENGTH_KPC-Math.abs(w)/Ze.DISK_SCALE_HEIGHT_KPC),E=Math.hypot(_,w/Ze.BULGE_FLATTENING),R=Ze.BULGE_TO_LOCAL_DISK*Math.exp(-E/Ze.BULGE_SCALE_KPC);if(c+=(S+R)*v*10**(-.4*l),l+=Ze.EXTINCTION_MAG_PER_KPC*Math.exp(-(_-Ze.SUN_RADIUS_KPC)/Ze.DUST_SCALE_LENGTH_KPC-(Math.abs(w)-Ze.SUN_HEIGHT_KPC)/Ze.DUST_SCALE_HEIGHT_KPC)*v,l>Ze.OPAQUE_MAG)break}return{light:c,extinctionMag:l}}values=new Float32Array(Ze.LONGITUDE_STEPS*Ze.LATITUDE_STEPS);walked=0;get done(){return this.walked>=Ze.LATITUDE_STEPS}walk(e){const t=Ze.LONGITUDE_STEPS,n=Math.min(Ze.LATITUDE_STEPS,this.walked+e);for(;this.walked<n;this.walked++){const i=Xs.latitudeOfRowCoord((this.walked+.5)/Ze.LATITUDE_STEPS);for(let r=0;r<t;r++)this.values[this.walked*t+r]=this.radianceTowards(360*(r+.5)/t,i)}}harvest(){let e=Number.POSITIVE_INFINITY;for(const i of this.values)i<e&&(e=i);const t=Ze.anchor(),n=new Float32Array(this.values.length);for(let i=0;i<n.length;i++)n[i]=(this.values[i]-e)*t;return{width:Ze.LONGITUDE_STEPS,height:Ze.LATITUDE_STEPS,data:n}}}class wt{static LONGITUDE_STEPS=128;static LATITUDE_STEPS=96;static RADIAL_FALLOFF=1.3;static FAN_EXPONENT=2.6;static SUBLIMATION_AU=.1;static NEAR_LIMIT_AU=.004;static FAR_LIMIT_AU=8;static STEPS=224;static LOBE_ASYMMETRY=[.7,-.2,-.81];static LOBE_WEIGHT=[.665,.33,.00541];static RIGHT_ANGLE_S10=200;static POLE_S10=77;surfaceBrightnessS10(e,t){return this.radianceTowards(e,t)*this.anchor()}anchored;anchor(){return this.anchored===void 0&&(this.anchored=wt.RIGHT_ANGLE_S10/this.radianceTowards(90,0)),this.anchored}radianceTowards(e,t){const n=e*Math.PI/180,i=t*Math.PI/180,r=-Math.cos(i)*Math.cos(n),a=-Math.cos(i)*Math.sin(n),o=Math.sin(i),c=-r;let l=0,h=0;const u=Math.log(wt.NEAR_LIMIT_AU),d=Math.log(wt.FAR_LIMIT_AU)-u;for(let f=0;f<wt.STEPS;f++){const p=Math.exp(u+d*f/(wt.STEPS-1)),v=p-h;h=p;const m=p-v/2,g=1+m*r,b=m*a,w=m*o,_=Math.hypot(g,b,w);if(_<wt.SUBLIMATION_AU)continue;const S=w/_,E=_**-1.3*Math.exp(-2.6*Math.abs(S)),R=(c-m)/_;l+=E*this.scattering(R)*v/(_*_)}return l}scattering(e){let t=0;for(let n=0;n<wt.LOBE_ASYMMETRY.length;n++){const i=wt.LOBE_ASYMMETRY[n],r=1+i*i-2*i*e;t+=wt.LOBE_WEIGHT[n]*(1-i*i)/(4*Math.PI*r**1.5)}return t}values=new Float32Array(wt.LONGITUDE_STEPS*wt.LATITUDE_STEPS);walked=0;get done(){return this.walked>=wt.LATITUDE_STEPS}walk(e){const t=wt.LONGITUDE_STEPS,n=Math.min(wt.LATITUDE_STEPS,this.walked+e);for(;this.walked<n;this.walked++){const i=Xs.latitudeOfRowCoord((this.walked+.5)/wt.LATITUDE_STEPS);for(let r=0;r<t;r++){const a=Xs.angleOfColumnCoord((r+.5)/t);this.values[this.walked*t+r]=this.radianceTowards(a,i)}}}harvest(){const e=this.anchor();let t=Number.POSITIVE_INFINITY;for(const i of this.values)i<t&&(t=i);const n=new Float32Array(this.values.length);for(let i=0;i<n.length;i++)n[i]=(this.values[i]-t)*e;return{width:wt.LONGITUDE_STEPS,height:wt.LATITUDE_STEPS,data:n}}}class Je{static get NANOLAMBERTS_PER_S10(){return Je.toNanolamberts(10+2.5*Math.log10(3600*3600))}static nanolambertsOfS10(e){return e*Je.NANOLAMBERTS_PER_S10}static TWILIGHT=[{sunAltitudeDeg:90,magPerArcsec2:3.5},{sunAltitudeDeg:10,magPerArcsec2:4.2},{sunAltitudeDeg:0,magPerArcsec2:7.5},{sunAltitudeDeg:-4,magPerArcsec2:13},{sunAltitudeDeg:-6,magPerArcsec2:15.6},{sunAltitudeDeg:-8,magPerArcsec2:17.2},{sunAltitudeDeg:-10,magPerArcsec2:18.5},{sunAltitudeDeg:-12,magPerArcsec2:19.7},{sunAltitudeDeg:-14,magPerArcsec2:20.8},{sunAltitudeDeg:-16,magPerArcsec2:21.6},{sunAltitudeDeg:-18,magPerArcsec2:21.9},{sunAltitudeDeg:-24,magPerArcsec2:22}];static moonlessMagPerArcsec2(e){const t=Je.TWILIGHT;for(let n=0;n<t.length-1;n++){const i=t[n],r=t[n+1];if(e<=i.sunAltitudeDeg&&e>=r.sunAltitudeDeg){const a=(i.sunAltitudeDeg-e)/(i.sunAltitudeDeg-r.sunAltitudeDeg);return i.magPerArcsec2+(r.magPerArcsec2-i.magPerArcsec2)*a}}return e>0?t[0].magPerArcsec2:t[t.length-1].magPerArcsec2}static toNanolamberts(e){return 34.08*Math.exp(Je.NANOLAMBERT_OFFSET-Je.PER_MAGNITUDE*e)}static fromNanolamberts(e){return(Je.NANOLAMBERT_OFFSET-Math.log(Math.max(e,1e-6)/34.08))/Je.PER_MAGNITUDE}static NANOLAMBERT_OFFSET=20.7233;static PER_MAGNITUDE=Math.LN10/2.5;static airMass(e){const t=Math.cos(Math.max(e,0)*Math.PI/180);return 1/Math.sqrt(Math.max(1-.96*t*t,.001))}static EXTINCTION_PER_AIR_MASS=.172;static scatteringAt(e){const t=Math.min(Math.max(e,0),180)*Math.PI/180;return 10**5.36*(1.06+Math.cos(t)**2)+10**(6.15-Math.min(e,180)/40)}static scatteredFraction(e){return 1-10**(-.4*Je.EXTINCTION_PER_AIR_MASS*Je.airMass(e))}static AIRGLOW_MAG_PER_ARCSEC2=22;static twilightExcessNanolamberts(e){return Math.max(0,Je.toNanolamberts(Je.moonlessMagPerArcsec2(e))-Je.toNanolamberts(Je.AIRGLOW_MAG_PER_ARCSEC2))}static twilightOutput(e){const t=Je.scatteringAt(90-e)*Je.scatteredFraction(90);return Je.twilightExcessNanolamberts(e)/t}static moonNanolamberts(e,t,n,i){return Je.scatteringAt(n)*Je.moonOutput(e,t)*Je.scatteredFraction(i)}static moonOutput(e,t){if(t<=0)return 0;const n=Math.min(Math.abs(e),180);return 10**(-.4*(3.84+.026*n+4e-9*n**4))*10**(-.4*Je.EXTINCTION_PER_AIR_MASS*Je.airMass(t))}static phaseAngleOf(e){return Math.acos(Math.min(Math.max(2*e-1,-1),1))*180/Math.PI}static magPerArcsec2(e,t,n){const i=Je.scatteredFraction(n),r=Je.scatteringAt(e.separationDeg)*Je.twilightOutput(e.altitudeDeg)*i,a=Je.scatteringAt(t.separationDeg)*Je.moonOutput(t.phaseAngleDeg,t.altitudeDeg)*i;return Je.fromNanolamberts(Je.toNanolamberts(Je.AIRGLOW_MAG_PER_ARCSEC2)+r+a)}}class ls{static RADIUS=890;static TOO_BRIGHT_MAG_PER_ARCSEC2=16;static MILKY_WAY_TINT=[.9,.94,1];static ZODIACAL_TINT=[1,.97,.9];object;material;maps=Ls.shared;milkyWayTexture;zodiacalTexture;milkyWayTexels;zodiacalTexels;repaint;constructor(){this.milkyWayTexels=this.maps.milkyWayTexels,this.milkyWayTexture=ls.buildTexture(this.milkyWayTexels,Ze.LONGITUDE_STEPS,Ze.LATITUDE_STEPS,ka),this.zodiacalTexels=this.maps.zodiacalTexels,this.zodiacalTexture=ls.buildTexture(this.zodiacalTexels,wt.LONGITUDE_STEPS,wt.LATITUDE_STEPS,xn),this.material=new At({uniforms:{uMilkyWay:{value:this.milkyWayTexture},uZodiacal:{value:this.zodiacalTexture},uGalactic:{value:new ze},uEclipticPole:{value:new C(0,1,0)},uSunLongitude:{value:new C(1,0,0)},uMoonDirection:{value:new C(0,-1,0)},uMoonOutput:{value:0},uSunDirection:{value:new C(0,-1,0)},uTwilightOutput:{value:0},uAirglowNanolamberts:{value:Je.toNanolamberts(Je.AIRGLOW_MAG_PER_ARCSEC2)},uSkyColor:{value:new C(0,0,0)},uMilkyWayTint:{value:new C(...ls.MILKY_WAY_TINT)},uZodiacalTint:{value:new C(...ls.ZODIACAL_TINT)},uReady:{value:this.maps.done?1:0},uEncodeDestination:{value:1}},vertexShader:`
5284
5284
  varying vec3 vDirection;
5285
5285
  void main() {
5286
5286
  vDirection = normalize((modelMatrix * vec4(position, 1.0)).xyz - cameraPosition);
@@ -5395,13 +5395,13 @@ void main() {
5395
5395
  vec3 onEncoded = encodeSrgb(uSkyColor + light) - encodeSrgb(uSkyColor);
5396
5396
  gl_FragColor = vec4(mix(light, onEncoded, uEncodeDestination), 1.0);
5397
5397
  }
5398
- `,transparent:!0,blending:Un,depthWrite:!1,side:Nt,fog:!1}),this.object=new Ge(new an(ls.RADIUS,64,32),this.material),this.object.renderOrder=-1,this.object.frustumCulled=!1,this.object.visible=!1}static buildTexture(e,t,n,i){const r=new qr(e,t,n,_n,fn);return r.minFilter=gt,r.magFilter=gt,r.wrapS=i,r.wrapT=xn,r.needsUpdate=!0,r}set onReady(e){this.repaint=e}update(e){if(Je.moonlessMagPerArcsec2(e.sunAltitudeDeg)<ls.TOO_BRIGHT_MAG_PER_ARCSEC2){this.object.visible=!1,this.stopWork();return}const n=this.material.uniforms;n.uGalactic.value.copy(e.galactic),n.uEclipticPole.value.copy(e.eclipticPole).normalize(),n.uSunLongitude.value.copy(e.sunLongitude).normalize(),n.uMoonDirection.value.copy(e.moon.direction).normalize(),n.uSunDirection.value.copy(e.sunDirection).normalize(),n.uMoonOutput.value=Je.moonOutput(e.moon.phaseAngleDeg,e.moon.altitudeDeg),n.uTwilightOutput.value=Je.twilightOutput(e.sunAltitudeDeg),n.uSkyColor.value.copy(e.skyColor),this.object.visible=!0,n.uReady.value<.5&&this.scheduleWork()}setDestinationEncoded(e){this.material.uniforms.uEncodeDestination.value=e?1:0}hide(){this.object.visible=!1,this.stopWork()}scheduleWork(){this.maps.request(this.publish)}stopWork(){this.maps.cancel(this.publish)}publish=()=>{this.milkyWayTexture.needsUpdate=!0,this.zodiacalTexture.needsUpdate=!0,this.material.uniforms.uReady.value=1,this.repaint?.()};dispose(){this.stopWork(),this.milkyWayTexture.dispose(),this.zodiacalTexture.dispose(),this.object.geometry.dispose(),this.material.dispose()}}class Ls{static instance;static get shared(){return Ls.instance??=new Ls}static WORK_BUDGET_MS=6;milkyWayTexels=new Uint16Array(Ze.LONGITUDE_STEPS*Ze.LATITUDE_STEPS*4);zodiacalTexels=new Uint16Array(wt.LONGITUDE_STEPS*wt.LATITUDE_STEPS*4);galaxy=new Ze;dust=new wt;waiting=new Set;workHandle;published=!1;get done(){return this.published}request(e){if(this.published){e();return}if(this.waiting.add(e),this.workHandle!==void 0)return;const t=()=>{this.workHandle=void 0;const n=performance.now()+Ls.WORK_BUDGET_MS;for(;performance.now()<n&&!(this.galaxy.done&&this.dust.done);)this.galaxy.walk(1),this.dust.walk(1);if(this.galaxy.done&&this.dust.done){this.publish();return}this.workHandle=requestAnimationFrame(t)};this.workHandle=requestAnimationFrame(t)}cancel(e){this.waiting.delete(e),!(this.waiting.size>0||this.workHandle===void 0)&&(cancelAnimationFrame(this.workHandle),this.workHandle=void 0)}publish(){Ls.fill(this.milkyWayTexels,this.galaxy.harvest()),Ls.fill(this.zodiacalTexels,this.dust.harvest()),this.published=!0;const e=[...this.waiting];this.waiting.clear();for(const t of e)t()}static fill(e,t){for(let n=0;n<t.data.length;n++)e[n*4]=gs.toHalfFloat(Je.nanolambertsOfS10(t.data[n])),e[n*4+3]=gs.toHalfFloat(1)}}class Zn{static GALACTIC_CENTRE={raHours:266.4051/15,decDeg:-28.936175};static GALACTIC_ROTATION={raHours:318.00448/15,decDeg:48.32964};static GALACTIC_POLE={raHours:192.85948/15,decDeg:27.12825};static ECLIPTIC_POLE={raHours:18,decDeg:90-23.439291};static galactic(e,t){return{centre:Zn.at(Zn.GALACTIC_CENTRE,e,t),rotation:Zn.at(Zn.GALACTIC_ROTATION,e,t),pole:Zn.at(Zn.GALACTIC_POLE,e,t)}}static eclipticPole(e,t){return Zn.at(Zn.ECLIPTIC_POLE,e,t)}static at(e,t,n){return ei.ofJ2000(e.raHours,e.decDeg,t,n,!1)}}const P5=`
5398
+ `,transparent:!0,blending:Un,depthWrite:!1,side:Nt,fog:!1}),this.object=new Ge(new an(ls.RADIUS,64,32),this.material),this.object.renderOrder=-1,this.object.frustumCulled=!1,this.object.visible=!1}static buildTexture(e,t,n,i){const r=new qr(e,t,n,_n,fn);return r.minFilter=gt,r.magFilter=gt,r.wrapS=i,r.wrapT=xn,r.needsUpdate=!0,r}set onReady(e){this.repaint=e}update(e){if(Je.moonlessMagPerArcsec2(e.sunAltitudeDeg)<ls.TOO_BRIGHT_MAG_PER_ARCSEC2){this.object.visible=!1,this.stopWork();return}const n=this.material.uniforms;n.uGalactic.value.copy(e.galactic),n.uEclipticPole.value.copy(e.eclipticPole).normalize(),n.uSunLongitude.value.copy(e.sunLongitude).normalize(),n.uMoonDirection.value.copy(e.moon.direction).normalize(),n.uSunDirection.value.copy(e.sunDirection).normalize(),n.uMoonOutput.value=Je.moonOutput(e.moon.phaseAngleDeg,e.moon.altitudeDeg),n.uTwilightOutput.value=Je.twilightOutput(e.sunAltitudeDeg),n.uSkyColor.value.copy(e.skyColor),this.object.visible=!0,n.uReady.value<.5&&this.scheduleWork()}setDestinationEncoded(e){this.material.uniforms.uEncodeDestination.value=e?1:0}hide(){this.object.visible=!1,this.stopWork()}scheduleWork(){this.maps.request(this.publish)}stopWork(){this.maps.cancel(this.publish)}publish=()=>{this.milkyWayTexture.needsUpdate=!0,this.zodiacalTexture.needsUpdate=!0,this.material.uniforms.uReady.value=1,this.repaint?.()};dispose(){this.stopWork(),this.milkyWayTexture.dispose(),this.zodiacalTexture.dispose(),this.object.geometry.dispose(),this.material.dispose()}}class Ls{static instance;static get shared(){return Ls.instance??=new Ls}static WORK_BUDGET_MS=6;milkyWayTexels=new Uint16Array(Ze.LONGITUDE_STEPS*Ze.LATITUDE_STEPS*4);zodiacalTexels=new Uint16Array(wt.LONGITUDE_STEPS*wt.LATITUDE_STEPS*4);galaxy=new Ze;dust=new wt;waiting=new Set;workHandle;published=!1;get done(){return this.published}request(e){if(this.published){e();return}if(this.waiting.add(e),this.workHandle!==void 0)return;const t=()=>{this.workHandle=void 0;const n=performance.now()+Ls.WORK_BUDGET_MS;for(;performance.now()<n&&!(this.galaxy.done&&this.dust.done);)this.galaxy.walk(1),this.dust.walk(1);if(this.galaxy.done&&this.dust.done){this.publish();return}this.workHandle=requestAnimationFrame(t)};this.workHandle=requestAnimationFrame(t)}cancel(e){this.waiting.delete(e),!(this.waiting.size>0||this.workHandle===void 0)&&(cancelAnimationFrame(this.workHandle),this.workHandle=void 0)}publish(){Ls.fill(this.milkyWayTexels,this.galaxy.harvest()),Ls.fill(this.zodiacalTexels,this.dust.harvest()),this.published=!0;const e=[...this.waiting];this.waiting.clear();for(const t of e)t()}static fill(e,t){for(let n=0;n<t.data.length;n++)e[n*4]=gs.toHalfFloat(Je.nanolambertsOfS10(t.data[n])),e[n*4+3]=gs.toHalfFloat(1)}}class Zn{static GALACTIC_CENTRE={raHours:266.4051/15,decDeg:-28.936175};static GALACTIC_ROTATION={raHours:318.00448/15,decDeg:48.32964};static GALACTIC_POLE={raHours:192.85948/15,decDeg:27.12825};static ECLIPTIC_POLE={raHours:18,decDeg:90-23.439291};static galactic(e,t){return{centre:Zn.at(Zn.GALACTIC_CENTRE,e,t),rotation:Zn.at(Zn.GALACTIC_ROTATION,e,t),pole:Zn.at(Zn.GALACTIC_POLE,e,t)}}static eclipticPole(e,t){return Zn.at(Zn.ECLIPTIC_POLE,e,t)}static at(e,t,n){return ei.ofJ2000(e.raHours,e.decDeg,t,n,!1)}}const PS=`
5399
5399
  varying vec2 vUv;
5400
5400
  void main() {
5401
5401
  vUv = uv;
5402
5402
  gl_Position = vec4(position, 1.0);
5403
5403
  }
5404
- `,I5=`
5404
+ `,IS=`
5405
5405
  // Based on https://www.shadertoy.com/view/4sX3Rs
5406
5406
  uniform float uTime;
5407
5407
  uniform vec2 uLensPosition;
@@ -5831,7 +5831,7 @@ void main()
5831
5831
  // stays what it always was for the optional artifacts.
5832
5832
  gl_FragColor = vec4(dazzle + artifactsContribution * uOpacity, 1.0);
5833
5833
  }
5834
- `;let Xo;function L5(){if(Xo)return Xo;const s=256,e=document.createElement("canvas");e.width=s,e.height=s;const t=e.getContext("2d");t.fillStyle="rgba(60,60,60,1)",t.fillRect(0,0,s,s);const n=[[.3,.35,.22,.5],[.7,.6,.16,.35],[.55,.8,.3,.4],[.15,.7,.12,.3],[.85,.2,.18,.3]];for(const[i,r,a,o]of n){const c=t.createRadialGradient(i*s,r*s,0,i*s,r*s,a*s);c.addColorStop(0,`rgba(200,200,200,${o})`),c.addColorStop(1,"rgba(200,200,200,0)"),t.fillStyle=c,t.fillRect(0,0,s,s)}return Xo=new Ri(e),Xo}function N5(){const s={uTime:{value:0},uResolution:{value:new Pe(1,1)},uLensPosition:{value:new Pe(0,0)},uColorGain:{value:new oe(55,55,51)},uOpacity:{value:.5},uFlareIntensity:{value:0},uStarPoints:{value:0},uTanHalfFov:{value:Math.tan(Math.PI/6)},uSourceRadiusDeg:{value:.265},uVeilStrength:{value:0},uDazzleColour:{value:new oe(1,1,1)},uFlareSize:{value:.0025},uFlareSpeed:{value:.4},uFlareShape:{value:1.2},uHaloScale:{value:.5},uGhostScale:{value:.3},uAnimated:{value:!1},uAnamorphic:{value:!1},uSecondaryGhosts:{value:!0},uStarBurst:{value:!0},uAdditionalStreaks:{value:!0},uLensDirtTexture:{value:L5()}},e=new At({uniforms:s,vertexShader:P5,fragmentShader:I5,transparent:!0,depthWrite:!1,depthTest:!1,blending:Un,fog:!1,name:"LensFlareShader"}),t=new Ge(new Di(2,2),e);return t.frustumCulled=!1,t.renderOrder=20,{mesh:t,uniforms:s}}class Da{static MAX_HALF_ANGLE_DEG=80;target;quadScene=new Va;quadCamera=new Ys(-1,1,1,-1,0,1);material;width;height;constructor(e,t){this.width=Math.max(1,e),this.height=Math.max(1,t),this.target=new Rn(this.width,this.height,{type:fn}),this.material=new At({uniforms:{uSource:{value:this.target.texture},uHalfFovRad:{value:.5236},uAspect:{value:this.width/this.height},uSrcTanHalfFovY:{value:1},uResolution:{value:new Pe(this.width,this.height)},uEncodeOutput:{value:1}},vertexShader:`
5834
+ `;let Xo;function LS(){if(Xo)return Xo;const s=256,e=document.createElement("canvas");e.width=s,e.height=s;const t=e.getContext("2d");t.fillStyle="rgba(60,60,60,1)",t.fillRect(0,0,s,s);const n=[[.3,.35,.22,.5],[.7,.6,.16,.35],[.55,.8,.3,.4],[.15,.7,.12,.3],[.85,.2,.18,.3]];for(const[i,r,a,o]of n){const c=t.createRadialGradient(i*s,r*s,0,i*s,r*s,a*s);c.addColorStop(0,`rgba(200,200,200,${o})`),c.addColorStop(1,"rgba(200,200,200,0)"),t.fillStyle=c,t.fillRect(0,0,s,s)}return Xo=new Ri(e),Xo}function NS(){const s={uTime:{value:0},uResolution:{value:new Pe(1,1)},uLensPosition:{value:new Pe(0,0)},uColorGain:{value:new oe(55,55,51)},uOpacity:{value:.5},uFlareIntensity:{value:0},uStarPoints:{value:0},uTanHalfFov:{value:Math.tan(Math.PI/6)},uSourceRadiusDeg:{value:.265},uVeilStrength:{value:0},uDazzleColour:{value:new oe(1,1,1)},uFlareSize:{value:.0025},uFlareSpeed:{value:.4},uFlareShape:{value:1.2},uHaloScale:{value:.5},uGhostScale:{value:.3},uAnimated:{value:!1},uAnamorphic:{value:!1},uSecondaryGhosts:{value:!0},uStarBurst:{value:!0},uAdditionalStreaks:{value:!0},uLensDirtTexture:{value:LS()}},e=new At({uniforms:s,vertexShader:PS,fragmentShader:IS,transparent:!0,depthWrite:!1,depthTest:!1,blending:Un,fog:!1,name:"LensFlareShader"}),t=new Ge(new Di(2,2),e);return t.frustumCulled=!1,t.renderOrder=20,{mesh:t,uniforms:s}}class Da{static MAX_HALF_ANGLE_DEG=80;target;quadScene=new Va;quadCamera=new Ys(-1,1,1,-1,0,1);material;width;height;constructor(e,t){this.width=Math.max(1,e),this.height=Math.max(1,t),this.target=new Rn(this.width,this.height,{type:fn}),this.material=new At({uniforms:{uSource:{value:this.target.texture},uHalfFovRad:{value:.5236},uAspect:{value:this.width/this.height},uSrcTanHalfFovY:{value:1},uResolution:{value:new Pe(this.width,this.height)},uEncodeOutput:{value:1}},vertexShader:`
5835
5835
  varying vec2 vNdc;
5836
5836
  void main() {
5837
5837
  vNdc = position.xy;
@@ -5948,7 +5948,7 @@ void main()
5948
5948
  // values — and encoded only at the very end. See colorSpace.ts.
5949
5949
  gl_FragColor = vec4(forDestination(total / weight), colour.a);
5950
5950
  }
5951
- `,depthTest:!1,depthWrite:!1}),this.quadScene.add(new Ge(new Di(2,2),this.material))}resize(e,t){this.width=Math.max(1,e),this.height=Math.max(1,t),this.target.setSize(this.width,this.height),this.material.uniforms.uResolution.value.set(this.width,this.height)}setLens(e,t,n,i){const r=this.material.uniforms;r.uApertureMm2.value=e*e/Math.max(.1,t),r.uFocusDistance.value=Math.max(0,n),r.uFocalLengthMm.value=e,r.uPixelsPerMm.value=this.height/Math.max(.1,i)}setEncodesOutput(e){this.material.uniforms.uEncodeOutput.value=e?1:0}render(e,t,n,i){const r=this.material.uniforms;r.uNear.value=n.near,r.uFar.value=n.far;const a=e.getRenderTarget();e.setRenderTarget(this.target),e.clear(),e.render(t,n),i?.(),e.setRenderTarget(a),e.render(this.quadScene,this.quadCamera)}dispose(){this.target.depthTexture?.dispose(),this.target.dispose(),this.material.dispose()}}class yt{static MIN_RATIO=1;static STEP=.25;static GPU_LATE_MS=12;static GPU_ROOM_MS=6;static INTERVAL_LATE_MS=21;static LOWER_COOLDOWN_MS=750;static RAISE_COOLDOWN_MS=2e3;static PROBE_WATCH_MS=2e3;static PROBE_EVERY_MS=6e3;static PROBE_BACKOFF_MS=3e4;ratio;maxRatio;timer;intervalMs;lastChangeMs=-1/0;nextProbeMs=0;probe;constructor(e,t){this.maxRatio=yt.clamp(e),this.ratio=this.maxRatio,this.timer=t?Ic.create(t):void 0}get pixelRatio(){return this.ratio}get timesGpu(){return this.timer!==void 0}set maximum(e){this.maxRatio=yt.clamp(e),this.ratio>this.maxRatio&&(this.ratio=this.maxRatio)}get maximum(){return this.maxRatio}beginDrawing(){this.timer?.begin()}endDrawing(){this.timer?.end()}reset(){this.intervalMs=void 0,this.probe=void 0,this.timer?.reset()}update(e,t){const n=this.timer?.poll();if(!(this.timer&&n===void 0))return n!==void 0?this.followGpu(e,n):this.followIntervals(e,t)}followGpu(e,t){if(t>yt.GPU_LATE_MS)return this.lower(e,yt.LOWER_COOLDOWN_MS);if(t<yt.GPU_ROOM_MS)return this.raise(e,yt.RAISE_COOLDOWN_MS)}followIntervals(e,t){if(!(t>0)||t>1e3)return;this.intervalMs=this.intervalMs===void 0?t:this.intervalMs*.9+t*.1;const n=this.intervalMs>yt.INTERVAL_LATE_MS;if(this.probe){if(n)return this.ratio=this.probe.ratioBefore,this.probe=void 0,this.lastChangeMs=e,this.nextProbeMs=e+yt.PROBE_BACKOFF_MS,this.ratio;e-this.probe.sinceMs>=yt.PROBE_WATCH_MS&&(this.probe=void 0,this.nextProbeMs=e+yt.PROBE_EVERY_MS);return}if(n){const i=this.lower(e,yt.LOWER_COOLDOWN_MS);return i!==void 0&&(this.nextProbeMs=e+yt.PROBE_EVERY_MS),i}if(this.ratio<this.maxRatio&&e>=this.nextProbeMs&&e-this.lastChangeMs>=yt.RAISE_COOLDOWN_MS){const i=this.ratio,r=this.raise(e,0);return r!==void 0&&(this.probe={sinceMs:e,ratioBefore:i}),r}}lower(e,t){if(!(this.ratio<=yt.MIN_RATIO||e-this.lastChangeMs<t))return this.ratio=yt.clamp(this.ratio-yt.STEP),this.lastChangeMs=e,this.ratio}raise(e,t){if(!(this.ratio>=this.maxRatio||e-this.lastChangeMs<t))return this.ratio=Math.min(this.maxRatio,yt.clamp(this.ratio+yt.STEP)),this.lastChangeMs=e,this.ratio}static clamp(e){return Number.isFinite(e)?Math.max(yt.MIN_RATIO,Math.round(e/yt.STEP)*yt.STEP):yt.MIN_RATIO}}class Ic{constructor(e,t){this.gl=e,this.extension=t}static IN_FLIGHT_MAX=8;static create(e){if(!(e instanceof WebGL2RenderingContext))return;const t=e.getExtension("EXT_disjoint_timer_query_webgl2");return t?new Ic(e,t):void 0}pending=[];active;smoothedMs;begin(){if(!(this.active||this.pending.length>=Ic.IN_FLIGHT_MAX))try{const e=this.gl.createQuery();if(!e)return;this.gl.beginQuery(this.extension.TIME_ELAPSED_EXT,e),this.active=e}catch{this.active=void 0}}end(){if(this.active){try{this.gl.endQuery(this.extension.TIME_ELAPSED_EXT),this.pending.push(this.active)}catch{}this.active=void 0}}poll(){const e=this.gl;try{for(let t=0;t<this.pending.length;t++){const n=this.pending[t];if(!e.getQueryParameter(n,e.QUERY_RESULT_AVAILABLE))continue;if(!e.getParameter(this.extension.GPU_DISJOINT_EXT)){const r=e.getQueryParameter(n,e.QUERY_RESULT)/1e6;this.smoothedMs=this.smoothedMs===void 0?r:this.smoothedMs*.8+r*.2}e.deleteQuery(n),this.pending.splice(t,1),t--}}catch{this.pending.length=0}return this.smoothedMs}reset(){this.smoothedMs=void 0}}class et{static ICE_INDEX_RED=1.3067;static ICE_INDEX_BLUE=1.317;static SIDE_PRISM_ANGLE_DEG=60;static END_PRISM_ANGLE_DEG=90;static get PARHELIA_MAX_SUN_ALTITUDE_DEG(){const e=et.ICE_INDEX_RED,t=Math.sqrt((4-e*e)/3);return Math.asin(Math.min(1,t))*180/Math.PI}static minimumDeviationDeg(e,t){const n=e*Math.PI/180,i=t*Math.sin(n/2);return i>1?Number.NaN:(2*Math.asin(i)-n)*180/Math.PI}static effectiveIndex(e,t){const n=t*Math.PI/180,i=Math.cos(n);return i<=0?Number.POSITIVE_INFINITY:Math.sqrt(e*e-Math.sin(n)**2)/i}static parheliaAzimuthDeg(e,t=et.ICE_INDEX_RED){const n=et.minimumDeviationDeg(et.SIDE_PRISM_ANGLE_DEG,et.effectiveIndex(t,e));return Number.isFinite(n)?n:void 0}static parheliaDistanceDeg(e,t=et.ICE_INDEX_RED){const n=et.parheliaAzimuthDeg(e,t);if(n===void 0)return;const i=e*Math.PI/180,r=Math.sin(i)**2,a=Math.cos(i)**2*Math.cos(n*Math.PI/180);return Math.acos(Math.max(-1,Math.min(1,r+a)))*180/Math.PI}static get PLATE_END_FACE_LIMIT_DEG(){const e=et.ICE_INDEX_RED;return Math.asin(Math.min(1,Math.sqrt(e*e-1)))*180/Math.PI}static circumzenithalAltitudeDeg(e,t=et.ICE_INDEX_RED){if(e<0||e>90-et.PLATE_END_FACE_LIMIT_DEG)return;const n=Math.cos(e*Math.PI/180),i=Math.sqrt(t*t-n*n);if(!(i>=1))return Math.asin(i)*180/Math.PI}static DECK_HEIGHT_M=8e3;static deckLitUntilDeg(e){return Math.acos(6371e3/(6371e3+Math.max(0,e)))*180/Math.PI}static halo22(){return et.ringOf("halo22",et.SIDE_PRISM_ANGLE_DEG)}static halo46(){return et.ringOf("halo46",et.END_PRISM_ANGLE_DEG)}static ringOf(e,t){const n=et.minimumDeviationDeg(t,et.ICE_INDEX_RED),i=et.minimumDeviationDeg(t,et.ICE_INDEX_BLUE);return{id:e,angleDeg:(n+i)/2,redAngleDeg:n,blueAngleDeg:i}}static strength(e,t,n=90,i=0){const r=Math.max(0,Math.min(1,e)),a=Math.max(0,1-Math.max(0,Math.min(1,t))),o=n>=0?1:i<=0?0:Math.max(0,1+n/i);return r*a*o}static formsAt(e,t=0){if(e<=-t)return[];const n=[et.halo22(),et.halo46()],i=e>0?et.parheliaDistanceDeg(e):void 0;i!==void 0&&n.push({id:"parhelia",angleDeg:i,redAngleDeg:i,blueAngleDeg:et.parheliaDistanceDeg(e,et.ICE_INDEX_BLUE)}),n.push({id:"tangentArc",angleDeg:et.halo22().angleDeg}),e>0&&n.push({id:"parhelicCircle",angleDeg:e});const r=et.circumzenithalAltitudeDeg(e);return r!==void 0&&n.push({id:"circumzenithal",angleDeg:r}),e>et.PLATE_END_FACE_LIMIT_DEG&&n.push({id:"circumhorizontal"}),e<et.PILLAR_MAX_SOURCE_ALTITUDE_DEG&&n.push({id:"pillar"}),n}static PILLAR_MAX_SOURCE_ALTITUDE_DEG=20}class En{static get WATER_INDEX_RED(){return Zt.indexAt(Zt.RED_NM)}static get WATER_INDEX_BLUE(){return Zt.indexAt(Zt.BLUE_NM)}static radiusDeg(e,t){const n=(t*t-1)/(e*e-1);if(n<0||n>1)return Number.NaN;const i=Math.acos(Math.sqrt(n)),r=Math.asin(Math.sin(i)/t),a=2*(i-r)+(e-1)*(Math.PI-2*r),o=2*Math.PI;let c=a%o;return c<0&&(c+=o),c>Math.PI&&(c=o-c),180-c*180/Math.PI}static primary(){return En.bowOf("primary",2,0)}static secondary(){return En.bowOf("secondary",3,0)}static bowOf(e,t,n){const i=En.radiusDeg(t,En.WATER_INDEX_RED),r=En.radiusDeg(t,En.WATER_INDEX_BLUE),a=(i+r)/2;return{id:e,radiusDeg:a,redRadiusDeg:i,violetRadiusDeg:r,topAltitudeDeg:a-n}}static alexandersBandDeg(){return{fromDeg:En.primary().redRadiusDeg,toDeg:En.secondary().redRadiusDeg}}static formsAt(e){return e<0?[]:[En.bowOf("primary",2,e),En.bowOf("secondary",3,e)].filter(t=>t.topAltitudeDeg>0)}static FULL_MOON_MAGNITUDE=-12.7;static moonlightShare(e){return Math.min(1,10**(-.4*(e-En.FULL_MOON_MAGNITUDE)))}static strength(e,t,n){if(n<=0)return 0;const i=Math.max(0,Math.min(1,e)),r=Math.max(0,1-Math.max(0,Math.min(1,t)));return i*r}}class Ln{constructor(e){this.radius=e;const t=Ln.SEGMENTS*Ln.VERTICES_PER_SEGMENT;this.positions=new Float32Array(t*3),this.colors=new Float32Array(t*3);const n=new Mt;n.setAttribute("position",new tt(this.positions,3)),n.setAttribute("color",new tt(this.colors,3)),n.setDrawRange(0,0),this.object=new Ge(n,new qn({vertexColors:!0,transparent:!0,blending:Un,depthWrite:!1,fog:!1,side:ti})),this.object.frustumCulled=!1}static POINTS=24;static SEGMENTS=Ln.POINTS-1;static ACROSS=3;static VERTICES_PER_SEGMENT=(Ln.ACROSS-1)*6;static HEAD_HALF_WIDTH_DEG=.15;static SPREAD_FRACTION=.05;static FADE_POWER=1.8;object;positions;colors;head;tip;brightness=0;set(e,t,n){this.head=e&&jt(e.altitudeDeg,e.azimuthDeg,1),this.tip=t&&jt(t.altitudeDeg,t.azimuthDeg,1),this.brightness=n,this.rebuild()}rebuild(){const e=this.object.geometry,t=this.head,n=this.tip;if(!t||!n||this.brightness<=0){e.setDrawRange(0,0);return}const i=this.angleBetween(t,n);if(i<=0){e.setDrawRange(0,0);return}const r=i*Ln.SPREAD_FRACTION*Math.PI/180,a=h=>this.scale(this.slerp(t,n,h),this.radius),o=h=>this.radius*(Ln.HEAD_HALF_WIDTH_DEG*Math.PI/180+r*h),c=h=>this.brightness*(1-h)**Ln.FADE_POWER;let l=0;for(let h=1;h<Ln.POINTS;h++){const u=(h-1)/Ln.SEGMENTS,d=h/Ln.SEGMENTS;l=this.pushBand(l,a(u),a(d),o(u),o(d),c(u),c(d))}e.setDrawRange(0,l),e.getAttribute("position").needsUpdate=!0,e.getAttribute("color").needsUpdate=!0}pushBand(e,t,n,i,r,a,o){const c=this.normalise(this.cross(this.normalise(t),this.normalise(this.subtract(n,t))));for(let l=0;l<Ln.ACROSS-1;l++){const h=l-1,u=l,d=this.across(t,c,i,h),f=this.across(n,c,r,h),p=this.across(t,c,i,u),v=this.across(n,c,r,u),m=(g,b)=>g===0?b:0;e=this.push(e,d,m(h,a)),e=this.push(e,f,m(h,o)),e=this.push(e,p,m(u,a)),e=this.push(e,f,m(h,o)),e=this.push(e,v,m(u,o)),e=this.push(e,p,m(u,a))}return e}across(e,t,n,i){return{x:e.x+t.x*n*i,y:e.y+t.y*n*i,z:e.z+t.z*n*i}}push(e,t,n){const i=e*3;this.positions[i]=t.x,this.positions[i+1]=t.y,this.positions[i+2]=t.z;const r=Math.max(0,Math.min(1,n));return this.colors[i]=r*.55,this.colors[i+1]=r*.75,this.colors[i+2]=r,e+1}slerp(e,t,n){const i=this.angleBetweenRadians(e,t);if(i<1e-9)return e;const r=Math.sin(i),a=Math.sin((1-n)*i)/r,o=Math.sin(n*i)/r;return{x:e.x*a+t.x*o,y:e.y*a+t.y*o,z:e.z*a+t.z*o}}angleBetween(e,t){return this.angleBetweenRadians(e,t)*180/Math.PI}angleBetweenRadians(e,t){const n=e.x*t.x+e.y*t.y+e.z*t.z;return Math.acos(Math.min(1,Math.max(-1,n)))}scale(e,t){return{x:e.x*t,y:e.y*t,z:e.z*t}}subtract(e,t){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}}cross(e,t){return{x:e.y*t.z-e.z*t.y,y:e.z*t.x-e.x*t.z,z:e.x*t.y-e.y*t.x}}normalise(e){const t=Math.hypot(e.x,e.y,e.z)||1;return{x:e.x/t,y:e.y/t,z:e.z/t}}dispose(){this.object.geometry.dispose(),this.object.material.dispose()}}class O5{object=new en;radius;tiers;drawn=[];constructor(e){this.radius=e,this.object.name="satellites",this.tiers=od.map(t=>{const n=new ed({vertexColors:!0,size:t.size,sizeAttenuation:!1,fog:!1});fs.apply(n);const i=new Ra(new Mt,n);return i.frustumCulled=!1,this.object.add(i),i})}set(e,t,n){const i=this.tiers.map(()=>[]);this.drawn=[];for(const r of e){const a=n(r.position);if(a<=0)continue;const o=r.magnitude-2.5*Math.log10(a);if(o>t)continue;const c=_a(o,t),l=Nm(c),{x:h,y:u,z:d}=jt(r.position.altitudeDeg,r.position.azimuthDeg,this.radius),f=os(r.position.altitudeDeg),p=ya(c);i[l].push({x:h,y:u,z:d,r:p*f[0],g:p*f[1],b:p*f[2]}),this.drawn.push({satellite:r,direction:new C(h,u,d).normalize()})}this.tiers.forEach((r,a)=>{const o=i[a],c=new Float32Array(o.length*3),l=new Float32Array(o.length*3);o.forEach((u,d)=>{c.set([u.x,u.y,u.z],d*3),l.set([u.r,u.g,u.b],d*3)}),r.geometry.dispose();const h=new Mt;h.setAttribute("position",new tt(c,3)),h.setAttribute("color",new tt(l,3)),r.geometry=h})}get count(){return this.drawn.length}nearest(e,t){let n,i=t;for(const r of this.drawn){const a=r.direction.dot(e);a>i&&(i=a,n=r.satellite)}return n}dispose(){for(const e of this.tiers)e.geometry.dispose(),e.material.dispose();this.object.removeFromParent(),this.drawn=[]}}class qc{constructor(e){this.state=e}next(){this.state=this.state+1831565813|0;let e=this.state;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}between(e,t){return e+this.next()*(t-e)}}class zs{static MIN_DURATION_MS=250;static MAX_DURATION_MS=1400;static schedule(e){const{ratePerHour:t,durationMs:n,velocityKmS:i,seed:r}=e;if(t<=0||n<=0)return[];const a=t*n/36e5,o=new qc(r),c=Math.floor(a),l=c+(o.next()<a-c?1:0),h=[];for(let u=0;u<l;u++){const d=Math.min(1,Math.max(0,(i-20)/52)),f=zs.MAX_DURATION_MS-d*(zs.MAX_DURATION_MS-zs.MIN_DURATION_MS),p=o.between(5,70);h.push({t:o.between(0,n),durationMs:f*o.between(.7,1.3),fromRadiantDeg:p,bearingDeg:o.between(0,360),lengthDeg:Math.sin(p*Math.PI/180)*o.between(8,40)*(.6+d),brightness:o.next()**3}),h.sort((v,m)=>v.t-m.t)}return h}static aliveAt(e,t){return e.filter(n=>t>=n.t&&t<=n.t+n.durationMs).map(n=>({meteor:n,progress:(t-n.t)/n.durationMs}))}}class Dr{object=new en;radius;core;glow;flashKey;static CORE_WIDTH_DEG=.06;static GLOW_WIDTH_DEG=.5;static SEGMENTS=28;constructor(e){this.radius=e,this.object.name="lightning-bolt",this.core=new qn({color:15659775,transparent:!0,opacity:0,blending:Un,depthWrite:!1,fog:!1}),this.glow=new qn({color:10466559,transparent:!0,opacity:0,blending:Un,depthWrite:!1,fog:!1}),this.object.visible=!1,this.object.renderOrder=5.95}set(e,t,n){if(!e||!e.cloudToGround||t<=.01){this.object.visible=!1;return}const i=`${e.channelSeed}:${Math.round(n)}`;i!==this.flashKey&&this.build(e,n,i),this.core.opacity=Math.min(1,t*1.4),this.glow.opacity=t*.35,this.object.visible=!0}build(e,t,n){this.flashKey=n;for(const l of[...this.object.children])l.geometry.dispose(),this.object.remove(l);const i=new qc(e.channelSeed),r=Math.atan2(t,e.distanceM)*180/Math.PI,a=this.channel(i,e.azimuthDeg,r,0,1),o=[a],c=1+Math.floor(i.next()*2);for(let l=0;l<c;l++){const h=a[Math.floor(i.between(.15,.5)*a.length)];o.push(this.channel(i,h.azimuthDeg,h.altitudeDeg,h.altitudeDeg*i.between(.3,.7),.5))}for(const l of o)this.object.add(new Ge(this.ribbon(l,Dr.GLOW_WIDTH_DEG),this.glow)),this.object.add(new Ge(this.ribbon(l,Dr.CORE_WIDTH_DEG),this.core))}channel(e,t,n,i,r){const a=[],o=n-i;let c=t;for(let l=0;l<=Dr.SEGMENTS;l++){const h=n-o*l/Dr.SEGMENTS;a.push({azimuthDeg:c,altitudeDeg:h}),c+=e.between(-1,1)*o*.06*r}return a}ribbon(e,t){const n=new Float32Array(e.length*2*3),i=[],r=this.radius*Math.tan(t*Math.PI/180)/2,a=e.map(c=>{const{x:l,y:h,z:u}=jt(c.altitudeDeg,c.azimuthDeg,this.radius);return new C(l,h,u)});a.forEach((c,l)=>{const h=a[Math.min(l+1,a.length-1)],u=a[Math.max(l-1,0)],f=h.clone().sub(u).normalize().cross(c.clone().normalize()).normalize().multiplyScalar(r);if(n.set([c.x+f.x,c.y+f.y,c.z+f.z],l*6),n.set([c.x-f.x,c.y-f.y,c.z-f.z],l*6+3),l<a.length-1){const p=l*2;i.push(p,p+1,p+2,p+1,p+3,p+2)}});const o=new Mt;return o.setAttribute("position",new tt(n,3)),o.setIndex(i),o}dispose(){for(const e of this.object.children)e.geometry.dispose();this.core.dispose(),this.glow.dispose(),this.object.removeFromParent()}}class Wt{static MIN_INTERVAL_S=8;static MAX_INTERVAL_S=25;static SEVERE_MIN_INTERVAL_S=2;static SEVERE_MAX_INTERVAL_S=8;static CLOUD_TO_GROUND_FRACTION=.25;static MIN_DISTANCE_M=1e3;static MAX_DISTANCE_M=15e3;static INTERSTROKE_MS=60;static STROKE_DECAY_MS=40;static SOUND_SPEED_M_S=343;static schedule(e){const t=new qc(e.seed),n=[],{minS:i,maxS:r}=Wt.intervalFor(e.intensity??.5);let a=t.between(0,r)*1e3;for(;a<e.durationMs;){const o=t.next()<Wt.CLOUD_TO_GROUND_FRACTION,c=Wt.MIN_DISTANCE_M,l=Wt.MAX_DISTANCE_M,h=Math.sqrt(t.between(c*c,l*l)),u=o?1+Math.floor(t.next()*4):1,d=[];let f=0;for(let p=0;p<u;p++)d.push({offsetMs:f,intensity:p===0?1:t.between(.4,.9)}),f+=Wt.INTERSTROKE_MS*t.between(.5,1.6);n.push({t:a,azimuthDeg:t.between(0,360),distanceM:h,cloudToGround:o,strokes:d,channelSeed:Math.floor(t.next()*2**31)}),a+=t.between(i,r)*1e3}return n}static intervalFor(e){const t=Math.min(1,Math.max(0,(e-.5)/.5));return{minS:Wt.MIN_INTERVAL_S-t*(Wt.MIN_INTERVAL_S-Wt.SEVERE_MIN_INTERVAL_S),maxS:Wt.MAX_INTERVAL_S-t*(Wt.MAX_INTERVAL_S-Wt.SEVERE_MAX_INTERVAL_S)}}static brightnessAt(e,t){let n=0;for(const i of e.strokes){const r=t-e.t-i.offsetMs;r<0||r>Wt.STROKE_DECAY_MS*6||(n+=i.intensity*Math.exp(-r/Wt.STROKE_DECAY_MS))}return Math.min(1,n)}static endOf(e){const t=e.strokes[e.strokes.length-1];return e.t+t.offsetMs+Wt.STROKE_DECAY_MS*6}static thunderDelayMs(e){return e.distanceM/Wt.SOUND_SPEED_M_S*1e3}}class bn{static RED_NM=656.3;static BLUE_NM=435.8;static ANCHOR_RED=1.3067;static ANCHOR_BLUE=1.317;static B=(bn.ANCHOR_BLUE-bn.ANCHOR_RED)/(1/(bn.BLUE_NM*bn.BLUE_NM)-1/(bn.RED_NM*bn.RED_NM));static A=bn.ANCHOR_RED-bn.B/(bn.RED_NM*bn.RED_NM);static indexAt(e){return bn.A+bn.B/(e*e)}}class Wa{normals=new Float64Array(24);offsets=new Float64Array(8);radius=1;set(e,t,n,i,r,a){let o=0,c=0,l=0;Math.abs(n)<.9?(o=-t,c=e,l=0):(o=0,c=-n,l=t);const h=Math.hypot(o,c,l)||1;o/=h,c/=h,l/=h;const u=t*l-n*c,d=n*o-e*l,f=e*c-t*o,p=r/2,v=a/2;for(let m=0;m<6;m++){const g=i+m*Math.PI/3,b=Math.cos(g),w=Math.sin(g);this.normals[m*3]=o*b+u*w,this.normals[m*3+1]=c*b+d*w,this.normals[m*3+2]=l*b+f*w,this.offsets[m]=p}this.normals[18]=e,this.normals[19]=t,this.normals[20]=n,this.offsets[6]=v,this.normals[21]=-e,this.normals[22]=-t,this.normals[23]=-n,this.offsets[7]=v,this.radius=Math.hypot(p,v)}get aimRadius(){return this.radius}trace(e,t,n,i,r,a,o){let c=-t,l=e,h=0,u=Math.hypot(c,l,h);u<1e-6&&(c=1,l=0,h=0,u=1),c/=u,l/=u,h/=u;const d=t*h-n*l,f=n*c-e*h,p=e*l-t*c,v=c*i+d*r-e*this.radius*2,m=l*i+f*r-t*this.radius*2,g=h*i+p*r-n*this.radius*2;let b=-1,w=-1/0,_=1/0;for(let Z=0;Z<8;Z++){const ne=this.normals[Z*3],ae=this.normals[Z*3+1],He=this.normals[Z*3+2],$e=ne*e+ae*t+He*n,Be=this.offsets[Z]-(ne*v+ae*m+He*g);if($e>1e-9){const K=Be/$e;K<_&&(_=K)}else if($e<-1e-9){const K=Be/$e;K>w&&(w=K,b=Z)}else if(Be<0)return 0}if(b<0||w>=_)return 0;let S=0;const E=this.normals[b*3],R=this.normals[b*3+1],M=this.normals[b*3+2],A=-(E*e+R*t+M*n),P=Ac.reflectance(A,1,a);o[S].x=e+2*A*E,o[S].y=t+2*A*R,o[S].z=n+2*A*M,o[S].weight=P,S++;const D=1/a,I=Math.sqrt(Math.max(0,1-D*D*(1-A*A)));let F=D*e+(D*A-I)*E,H=D*t+(D*A-I)*R,O=D*n+(D*A-I)*M,V=v+e*w,z=m+t*w,Y=g+n*w,ee=1-P;for(let Z=0;Z<Wa.MAX_BOUNCES&&ee>Wa.MIN_WEIGHT;Z++){let ne=-1,ae=1/0;for(let B=0;B<8;B++){const we=this.normals[B*3],Ie=this.normals[B*3+1],Te=this.normals[B*3+2],xe=we*F+Ie*H+Te*O;if(xe<=1e-9)continue;const Ne=(this.offsets[B]-(we*V+Ie*z+Te*Y))/xe;Ne>1e-9&&Ne<ae&&(ae=Ne,ne=B)}if(ne<0)break;const He=this.normals[ne*3],$e=this.normals[ne*3+1],Be=this.normals[ne*3+2],K=He*F+$e*H+Be*O,re=a*Math.sqrt(Math.max(0,1-K*K));if(V+=F*ae,z+=H*ae,Y+=O*ae,re<1){const B=Math.sqrt(Math.max(0,1-re*re)),we=Ac.reflectance(K,a,1);if(o[S].x=a*F-(a*K-B)*He,o[S].y=a*H-(a*K-B)*$e,o[S].z=a*O-(a*K-B)*Be,o[S].weight=ee*(1-we),S++,S>=o.length)return S;ee*=we}const ie=2*K;F-=ie*He,H-=ie*$e,O-=ie*Be}return S}static MAX_BOUNCES=6;static MIN_WEIGHT=1e-4}class St{static AZIMUTH_BINS=512;static ALTITUDE_BINS=512;static POPULATIONS=[{orientation:"tumbling",widthMicrons:50,lengthMicrons:50,share:.52},{orientation:"plate",widthMicrons:100,lengthMicrons:15,share:.27},{orientation:"column",widthMicrons:40,lengthMicrons:120,share:.19},{orientation:"parry",widthMicrons:40,lengthMicrons:120,share:.02}];static WORST_TILT_DEG=180;static BEST_TILT_DEG=.5;static SOURCE_RADIUS_DEG=.265;static UNDEVIATED_DEG=.6;crystal=new Wa;emergent=Array.from({length:Wa.MAX_BOUNCES+2},()=>({x:0,y:0,z:0,weight:0}));tally=new Float32Array(St.AZIMUTH_BINS*St.ALTITUDE_BINS*3);radiance=new Float32Array(St.AZIMUTH_BINS*St.ALTITUDE_BINS*3);scratch=new Float32Array(St.AZIMUTH_BINS*St.ALTITUDE_BINS*3);seed=1;spare=0;hasSpare=!1;altitude=0;tilt=0;alignment=0;traced=0;begin(e,t,n=2654435769){this.seed=n>>>0||1,this.hasSpare=!1,this.tally.fill(0),this.traced=0,this.altitude=e*Math.PI/180,this.alignment=Math.min(1,Math.max(0,t));const i=St.WORST_TILT_DEG*(St.BEST_TILT_DEG/St.WORST_TILT_DEG)**this.alignment;this.tilt=i*Math.PI/180}trace(e){const t=St.AZIMUTH_BINS,n=St.ALTITUDE_BINS,i=this.tally,r=St.SOURCE_RADIUS_DEG*Math.PI/180,a=Math.cos(St.UNDEVIATED_DEG*Math.PI/180),o=this.altitude;for(let c=0;c<e;c++){const l=this.pickPopulation();this.orient(l,this.tilt);const h=this.random()*2*Math.PI,u=r*Math.sqrt(this.random()),d=o+u*Math.sin(h),f=u*Math.cos(h)/Math.max(.05,Math.cos(o)),p=-Math.cos(d)*Math.cos(f),v=-Math.cos(d)*Math.sin(f),m=-Math.sin(d),g=this.crystal.aimRadius,b=(this.random()*2-1)*g,w=(this.random()*2-1)*g,_=4*g*g,S=ii.SAMPLES[this.random()*ii.SAMPLES.length|0],E=this.crystal.trace(p,v,m,b,w,bn.indexAt(S.wavelengthNm),this.emergent);for(let R=0;R<E;R++){const M=this.emergent[R],A=Math.hypot(M.x,M.y,M.z);if(A<1e-9||M.weight<=0)continue;const P=M.x/A,D=M.y/A,I=M.z/A;if(P*p+D*v+I*m>a)continue;const F=Math.asin(Math.max(-1,Math.min(1,-I))),H=Math.abs(Math.atan2(-D,-P)),O=Math.min(t-1,H/Math.PI*t|0),z=(Math.min(n-1,(F+Math.PI/2)/Math.PI*n|0)*t+O)*3,Y=M.weight*_*ii.SAMPLES.length;i[z]+=Y*S.r,i[z+1]+=Y*S.g,i[z+2]+=Y*S.b}}this.traced+=e}get tracedRays(){return this.traced}harvest(){const e=St.AZIMUTH_BINS,t=St.ALTITUDE_BINS;return this.toRadiance(e,t),this.smooth(e,t),{width:e,height:t,data:this.radiance,sourceAltitudeDeg:this.altitude*180/Math.PI,alignment:this.alignment,rays:this.traced}}compute(e,t,n,i){return this.begin(e,t,i),this.trace(n),this.harvest()}toRadiance(e,t){const n=2*Math.PI/e,i=Math.max(1,this.traced),r=4*St.REFERENCE_MICRONS*St.REFERENCE_MICRONS;for(let a=0;a<t;a++){const o=Math.sin(a/t*Math.PI-Math.PI/2),c=Math.sin((a+1)/t*Math.PI-Math.PI/2),l=1/(n*(c-o)*i*r);for(let h=0;h<e;h++){const u=(a*e+h)*3;this.radiance[u]=this.tally[u]*l,this.radiance[u+1]=this.tally[u+1]*l,this.radiance[u+2]=this.tally[u+2]*l}}}static REFERENCE_MICRONS=50;smooth(e,t){const n=this.scratch,i=this.radiance;n.set(i);for(let a=0;a<t;a++){const o=a*e*3;for(let c=0;c<3;c++){let l=n[o+c];for(let h=0;h<e;h++){const u=o+h*3+c,d=h+1<e?n[u+3]:n[u];i[u]=(l+2*n[u]+d)/4,l=n[u]}}}n.set(i);const r=e*3;for(let a=0;a<t;a++){const o=a>0?-r:0,c=a+1<t?r:0,l=a*r;for(let h=l;h<l+r;h++)i[h]=(n[h+o]+2*n[h]+n[h+c])/4}}pickPopulation(){const e=this.random();let t=0;for(const n of St.POPULATIONS)if(t+=n.share,e<=t)return n;return St.POPULATIONS[St.POPULATIONS.length-1]}orient(e,t){const n=this.random()*2*Math.PI;let i=this.random()*2*Math.PI,r=0,a=0,o=1;switch(e.orientation){case"tumbling":{o=this.random()*2-1;const c=Math.sqrt(Math.max(0,1-o*o));r=c*Math.cos(n),a=c*Math.sin(n);break}case"plate":{o=this.spreadAboutAnAxis(t);const c=Math.sqrt(Math.max(0,1-o*o));r=c*Math.cos(n),a=c*Math.sin(n);break}case"column":case"parry":{o=this.spreadAboutAPlane(t);const c=Math.sqrt(Math.max(0,1-o*o));r=c*Math.cos(n),a=c*Math.sin(n),e.orientation==="parry"&&(i=Math.PI/2+this.gaussian()*t);break}}this.crystal.set(r,a,o,i,e.widthMicrons,e.lengthMicrons)}random(){this.seed=this.seed+1831565813>>>0;let e=this.seed;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}spreadAboutAnAxis(e){const t=1/Math.max(1e-6,e*e),n=Math.max(1e-12,this.random()),i=1+Math.log(n+(1-n)*Math.exp(-2*t))/t;return Math.max(-1,Math.min(1,i))}spreadAboutAPlane(e){for(let t=0;t<8;t++){const n=this.gaussian()*e;if(n>=-1&&n<=1)return n}return this.random()*2-1}gaussian(){if(this.hasSpare)return this.hasSpare=!1,this.spare;const e=Math.sqrt(-2*Math.log(Math.max(1e-12,this.random()))),t=2*Math.PI*this.random();return this.spare=e*Math.sin(t),this.hasSpare=!0,e*Math.cos(t)}}class gi{static RADIUS=880;static RAYS=9e5;static RAYS_PER_FRAME=4e3;static FIRST_GLIMPSE_RAYS=5e4;static ALTITUDE_STEP_DEG=1;static GAIN=.55;setCloudOffset(e){this.material.uniforms.uFieldOffset.value.copy(e)}object;material;sky=new St;texture;texels;mappedAltitudeDeg=Number.NaN;mappedAlignment=Number.NaN;tracing=!1;everDisplayed=!1;refining=!0;nextGlimpse=gi.FIRST_GLIMPSE_RAYS;workHandle;onRepaint;constructor(){const e=St.AZIMUTH_BINS,t=St.ALTITUDE_BINS;this.texels=new Uint16Array(e*t*4),this.texture=new qr(this.texels,e,t,_n,fn),this.texture.minFilter=gt,this.texture.magFilter=gt,this.texture.wrapS=xn,this.texture.wrapT=xn,this.texture.needsUpdate=!0,this.material=new At({uniforms:{uSource:{value:new C(0,1,0)},uUp:{value:new C(0,1,0)},uStrength:{value:0},uTint:{value:new C(1,.97,.92)},uIceCover:{value:0},uIceHeight:{value:1},uFieldOffset:{value:new C},uMap:{value:this.texture},uGain:{value:gi.GAIN}},vertexShader:`
5951
+ `,depthTest:!1,depthWrite:!1}),this.quadScene.add(new Ge(new Di(2,2),this.material))}resize(e,t){this.width=Math.max(1,e),this.height=Math.max(1,t),this.target.setSize(this.width,this.height),this.material.uniforms.uResolution.value.set(this.width,this.height)}setLens(e,t,n,i){const r=this.material.uniforms;r.uApertureMm2.value=e*e/Math.max(.1,t),r.uFocusDistance.value=Math.max(0,n),r.uFocalLengthMm.value=e,r.uPixelsPerMm.value=this.height/Math.max(.1,i)}setEncodesOutput(e){this.material.uniforms.uEncodeOutput.value=e?1:0}render(e,t,n,i){const r=this.material.uniforms;r.uNear.value=n.near,r.uFar.value=n.far;const a=e.getRenderTarget();e.setRenderTarget(this.target),e.clear(),e.render(t,n),i?.(),e.setRenderTarget(a),e.render(this.quadScene,this.quadCamera)}dispose(){this.target.depthTexture?.dispose(),this.target.dispose(),this.material.dispose()}}class yt{static MIN_RATIO=1;static STEP=.25;static GPU_LATE_MS=12;static GPU_ROOM_MS=6;static INTERVAL_LATE_MS=21;static LOWER_COOLDOWN_MS=750;static RAISE_COOLDOWN_MS=2e3;static PROBE_WATCH_MS=2e3;static PROBE_EVERY_MS=6e3;static PROBE_BACKOFF_MS=3e4;ratio;maxRatio;timer;intervalMs;lastChangeMs=-1/0;nextProbeMs=0;probe;constructor(e,t){this.maxRatio=yt.clamp(e),this.ratio=this.maxRatio,this.timer=t?Ic.create(t):void 0}get pixelRatio(){return this.ratio}get timesGpu(){return this.timer!==void 0}set maximum(e){this.maxRatio=yt.clamp(e),this.ratio>this.maxRatio&&(this.ratio=this.maxRatio)}get maximum(){return this.maxRatio}beginDrawing(){this.timer?.begin()}endDrawing(){this.timer?.end()}reset(){this.intervalMs=void 0,this.probe=void 0,this.timer?.reset()}update(e,t){const n=this.timer?.poll();if(!(this.timer&&n===void 0))return n!==void 0?this.followGpu(e,n):this.followIntervals(e,t)}followGpu(e,t){if(t>yt.GPU_LATE_MS)return this.lower(e,yt.LOWER_COOLDOWN_MS);if(t<yt.GPU_ROOM_MS)return this.raise(e,yt.RAISE_COOLDOWN_MS)}followIntervals(e,t){if(!(t>0)||t>1e3)return;this.intervalMs=this.intervalMs===void 0?t:this.intervalMs*.9+t*.1;const n=this.intervalMs>yt.INTERVAL_LATE_MS;if(this.probe){if(n)return this.ratio=this.probe.ratioBefore,this.probe=void 0,this.lastChangeMs=e,this.nextProbeMs=e+yt.PROBE_BACKOFF_MS,this.ratio;e-this.probe.sinceMs>=yt.PROBE_WATCH_MS&&(this.probe=void 0,this.nextProbeMs=e+yt.PROBE_EVERY_MS);return}if(n){const i=this.lower(e,yt.LOWER_COOLDOWN_MS);return i!==void 0&&(this.nextProbeMs=e+yt.PROBE_EVERY_MS),i}if(this.ratio<this.maxRatio&&e>=this.nextProbeMs&&e-this.lastChangeMs>=yt.RAISE_COOLDOWN_MS){const i=this.ratio,r=this.raise(e,0);return r!==void 0&&(this.probe={sinceMs:e,ratioBefore:i}),r}}lower(e,t){if(!(this.ratio<=yt.MIN_RATIO||e-this.lastChangeMs<t))return this.ratio=yt.clamp(this.ratio-yt.STEP),this.lastChangeMs=e,this.ratio}raise(e,t){if(!(this.ratio>=this.maxRatio||e-this.lastChangeMs<t))return this.ratio=Math.min(this.maxRatio,yt.clamp(this.ratio+yt.STEP)),this.lastChangeMs=e,this.ratio}static clamp(e){return Number.isFinite(e)?Math.max(yt.MIN_RATIO,Math.round(e/yt.STEP)*yt.STEP):yt.MIN_RATIO}}class Ic{constructor(e,t){this.gl=e,this.extension=t}static IN_FLIGHT_MAX=8;static create(e){if(!(e instanceof WebGL2RenderingContext))return;const t=e.getExtension("EXT_disjoint_timer_query_webgl2");return t?new Ic(e,t):void 0}pending=[];active;smoothedMs;begin(){if(!(this.active||this.pending.length>=Ic.IN_FLIGHT_MAX))try{const e=this.gl.createQuery();if(!e)return;this.gl.beginQuery(this.extension.TIME_ELAPSED_EXT,e),this.active=e}catch{this.active=void 0}}end(){if(this.active){try{this.gl.endQuery(this.extension.TIME_ELAPSED_EXT),this.pending.push(this.active)}catch{}this.active=void 0}}poll(){const e=this.gl;try{for(let t=0;t<this.pending.length;t++){const n=this.pending[t];if(!e.getQueryParameter(n,e.QUERY_RESULT_AVAILABLE))continue;if(!e.getParameter(this.extension.GPU_DISJOINT_EXT)){const r=e.getQueryParameter(n,e.QUERY_RESULT)/1e6;this.smoothedMs=this.smoothedMs===void 0?r:this.smoothedMs*.8+r*.2}e.deleteQuery(n),this.pending.splice(t,1),t--}}catch{this.pending.length=0}return this.smoothedMs}reset(){this.smoothedMs=void 0}}class et{static ICE_INDEX_RED=1.3067;static ICE_INDEX_BLUE=1.317;static SIDE_PRISM_ANGLE_DEG=60;static END_PRISM_ANGLE_DEG=90;static get PARHELIA_MAX_SUN_ALTITUDE_DEG(){const e=et.ICE_INDEX_RED,t=Math.sqrt((4-e*e)/3);return Math.asin(Math.min(1,t))*180/Math.PI}static minimumDeviationDeg(e,t){const n=e*Math.PI/180,i=t*Math.sin(n/2);return i>1?Number.NaN:(2*Math.asin(i)-n)*180/Math.PI}static effectiveIndex(e,t){const n=t*Math.PI/180,i=Math.cos(n);return i<=0?Number.POSITIVE_INFINITY:Math.sqrt(e*e-Math.sin(n)**2)/i}static parheliaAzimuthDeg(e,t=et.ICE_INDEX_RED){const n=et.minimumDeviationDeg(et.SIDE_PRISM_ANGLE_DEG,et.effectiveIndex(t,e));return Number.isFinite(n)?n:void 0}static parheliaDistanceDeg(e,t=et.ICE_INDEX_RED){const n=et.parheliaAzimuthDeg(e,t);if(n===void 0)return;const i=e*Math.PI/180,r=Math.sin(i)**2,a=Math.cos(i)**2*Math.cos(n*Math.PI/180);return Math.acos(Math.max(-1,Math.min(1,r+a)))*180/Math.PI}static get PLATE_END_FACE_LIMIT_DEG(){const e=et.ICE_INDEX_RED;return Math.asin(Math.min(1,Math.sqrt(e*e-1)))*180/Math.PI}static circumzenithalAltitudeDeg(e,t=et.ICE_INDEX_RED){if(e<0||e>90-et.PLATE_END_FACE_LIMIT_DEG)return;const n=Math.cos(e*Math.PI/180),i=Math.sqrt(t*t-n*n);if(!(i>=1))return Math.asin(i)*180/Math.PI}static DECK_HEIGHT_M=8e3;static deckLitUntilDeg(e){return Math.acos(6371e3/(6371e3+Math.max(0,e)))*180/Math.PI}static halo22(){return et.ringOf("halo22",et.SIDE_PRISM_ANGLE_DEG)}static halo46(){return et.ringOf("halo46",et.END_PRISM_ANGLE_DEG)}static ringOf(e,t){const n=et.minimumDeviationDeg(t,et.ICE_INDEX_RED),i=et.minimumDeviationDeg(t,et.ICE_INDEX_BLUE);return{id:e,angleDeg:(n+i)/2,redAngleDeg:n,blueAngleDeg:i}}static strength(e,t,n=90,i=0){const r=Math.max(0,Math.min(1,e)),a=Math.max(0,1-Math.max(0,Math.min(1,t))),o=n>=0?1:i<=0?0:Math.max(0,1+n/i);return r*a*o}static formsAt(e,t=0){if(e<=-t)return[];const n=[et.halo22(),et.halo46()],i=e>0?et.parheliaDistanceDeg(e):void 0;i!==void 0&&n.push({id:"parhelia",angleDeg:i,redAngleDeg:i,blueAngleDeg:et.parheliaDistanceDeg(e,et.ICE_INDEX_BLUE)}),n.push({id:"tangentArc",angleDeg:et.halo22().angleDeg}),e>0&&n.push({id:"parhelicCircle",angleDeg:e});const r=et.circumzenithalAltitudeDeg(e);return r!==void 0&&n.push({id:"circumzenithal",angleDeg:r}),e>et.PLATE_END_FACE_LIMIT_DEG&&n.push({id:"circumhorizontal"}),e<et.PILLAR_MAX_SOURCE_ALTITUDE_DEG&&n.push({id:"pillar"}),n}static PILLAR_MAX_SOURCE_ALTITUDE_DEG=20}class En{static get WATER_INDEX_RED(){return Zt.indexAt(Zt.RED_NM)}static get WATER_INDEX_BLUE(){return Zt.indexAt(Zt.BLUE_NM)}static radiusDeg(e,t){const n=(t*t-1)/(e*e-1);if(n<0||n>1)return Number.NaN;const i=Math.acos(Math.sqrt(n)),r=Math.asin(Math.sin(i)/t),a=2*(i-r)+(e-1)*(Math.PI-2*r),o=2*Math.PI;let c=a%o;return c<0&&(c+=o),c>Math.PI&&(c=o-c),180-c*180/Math.PI}static primary(){return En.bowOf("primary",2,0)}static secondary(){return En.bowOf("secondary",3,0)}static bowOf(e,t,n){const i=En.radiusDeg(t,En.WATER_INDEX_RED),r=En.radiusDeg(t,En.WATER_INDEX_BLUE),a=(i+r)/2;return{id:e,radiusDeg:a,redRadiusDeg:i,violetRadiusDeg:r,topAltitudeDeg:a-n}}static alexandersBandDeg(){return{fromDeg:En.primary().redRadiusDeg,toDeg:En.secondary().redRadiusDeg}}static formsAt(e){return e<0?[]:[En.bowOf("primary",2,e),En.bowOf("secondary",3,e)].filter(t=>t.topAltitudeDeg>0)}static FULL_MOON_MAGNITUDE=-12.7;static moonlightShare(e){return Math.min(1,10**(-.4*(e-En.FULL_MOON_MAGNITUDE)))}static strength(e,t,n){if(n<=0)return 0;const i=Math.max(0,Math.min(1,e)),r=Math.max(0,1-Math.max(0,Math.min(1,t)));return i*r}}class Ln{constructor(e){this.radius=e;const t=Ln.SEGMENTS*Ln.VERTICES_PER_SEGMENT;this.positions=new Float32Array(t*3),this.colors=new Float32Array(t*3);const n=new Mt;n.setAttribute("position",new tt(this.positions,3)),n.setAttribute("color",new tt(this.colors,3)),n.setDrawRange(0,0),this.object=new Ge(n,new qn({vertexColors:!0,transparent:!0,blending:Un,depthWrite:!1,fog:!1,side:ti})),this.object.frustumCulled=!1}static POINTS=24;static SEGMENTS=Ln.POINTS-1;static ACROSS=3;static VERTICES_PER_SEGMENT=(Ln.ACROSS-1)*6;static HEAD_HALF_WIDTH_DEG=.15;static SPREAD_FRACTION=.05;static FADE_POWER=1.8;object;positions;colors;head;tip;brightness=0;set(e,t,n){this.head=e&&jt(e.altitudeDeg,e.azimuthDeg,1),this.tip=t&&jt(t.altitudeDeg,t.azimuthDeg,1),this.brightness=n,this.rebuild()}rebuild(){const e=this.object.geometry,t=this.head,n=this.tip;if(!t||!n||this.brightness<=0){e.setDrawRange(0,0);return}const i=this.angleBetween(t,n);if(i<=0){e.setDrawRange(0,0);return}const r=i*Ln.SPREAD_FRACTION*Math.PI/180,a=h=>this.scale(this.slerp(t,n,h),this.radius),o=h=>this.radius*(Ln.HEAD_HALF_WIDTH_DEG*Math.PI/180+r*h),c=h=>this.brightness*(1-h)**Ln.FADE_POWER;let l=0;for(let h=1;h<Ln.POINTS;h++){const u=(h-1)/Ln.SEGMENTS,d=h/Ln.SEGMENTS;l=this.pushBand(l,a(u),a(d),o(u),o(d),c(u),c(d))}e.setDrawRange(0,l),e.getAttribute("position").needsUpdate=!0,e.getAttribute("color").needsUpdate=!0}pushBand(e,t,n,i,r,a,o){const c=this.normalise(this.cross(this.normalise(t),this.normalise(this.subtract(n,t))));for(let l=0;l<Ln.ACROSS-1;l++){const h=l-1,u=l,d=this.across(t,c,i,h),f=this.across(n,c,r,h),p=this.across(t,c,i,u),v=this.across(n,c,r,u),m=(g,b)=>g===0?b:0;e=this.push(e,d,m(h,a)),e=this.push(e,f,m(h,o)),e=this.push(e,p,m(u,a)),e=this.push(e,f,m(h,o)),e=this.push(e,v,m(u,o)),e=this.push(e,p,m(u,a))}return e}across(e,t,n,i){return{x:e.x+t.x*n*i,y:e.y+t.y*n*i,z:e.z+t.z*n*i}}push(e,t,n){const i=e*3;this.positions[i]=t.x,this.positions[i+1]=t.y,this.positions[i+2]=t.z;const r=Math.max(0,Math.min(1,n));return this.colors[i]=r*.55,this.colors[i+1]=r*.75,this.colors[i+2]=r,e+1}slerp(e,t,n){const i=this.angleBetweenRadians(e,t);if(i<1e-9)return e;const r=Math.sin(i),a=Math.sin((1-n)*i)/r,o=Math.sin(n*i)/r;return{x:e.x*a+t.x*o,y:e.y*a+t.y*o,z:e.z*a+t.z*o}}angleBetween(e,t){return this.angleBetweenRadians(e,t)*180/Math.PI}angleBetweenRadians(e,t){const n=e.x*t.x+e.y*t.y+e.z*t.z;return Math.acos(Math.min(1,Math.max(-1,n)))}scale(e,t){return{x:e.x*t,y:e.y*t,z:e.z*t}}subtract(e,t){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}}cross(e,t){return{x:e.y*t.z-e.z*t.y,y:e.z*t.x-e.x*t.z,z:e.x*t.y-e.y*t.x}}normalise(e){const t=Math.hypot(e.x,e.y,e.z)||1;return{x:e.x/t,y:e.y/t,z:e.z/t}}dispose(){this.object.geometry.dispose(),this.object.material.dispose()}}class OS{object=new en;radius;tiers;drawn=[];constructor(e){this.radius=e,this.object.name="satellites",this.tiers=od.map(t=>{const n=new ed({vertexColors:!0,size:t.size,sizeAttenuation:!1,fog:!1});fs.apply(n);const i=new Ra(new Mt,n);return i.frustumCulled=!1,this.object.add(i),i})}set(e,t,n){const i=this.tiers.map(()=>[]);this.drawn=[];for(const r of e){const a=n(r.position);if(a<=0)continue;const o=r.magnitude-2.5*Math.log10(a);if(o>t)continue;const c=_a(o,t),l=Nm(c),{x:h,y:u,z:d}=jt(r.position.altitudeDeg,r.position.azimuthDeg,this.radius),f=os(r.position.altitudeDeg),p=ya(c);i[l].push({x:h,y:u,z:d,r:p*f[0],g:p*f[1],b:p*f[2]}),this.drawn.push({satellite:r,direction:new C(h,u,d).normalize()})}this.tiers.forEach((r,a)=>{const o=i[a],c=new Float32Array(o.length*3),l=new Float32Array(o.length*3);o.forEach((u,d)=>{c.set([u.x,u.y,u.z],d*3),l.set([u.r,u.g,u.b],d*3)}),r.geometry.dispose();const h=new Mt;h.setAttribute("position",new tt(c,3)),h.setAttribute("color",new tt(l,3)),r.geometry=h})}get count(){return this.drawn.length}nearest(e,t){let n,i=t;for(const r of this.drawn){const a=r.direction.dot(e);a>i&&(i=a,n=r.satellite)}return n}dispose(){for(const e of this.tiers)e.geometry.dispose(),e.material.dispose();this.object.removeFromParent(),this.drawn=[]}}class qc{constructor(e){this.state=e}next(){this.state=this.state+1831565813|0;let e=this.state;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}between(e,t){return e+this.next()*(t-e)}}class zs{static MIN_DURATION_MS=250;static MAX_DURATION_MS=1400;static schedule(e){const{ratePerHour:t,durationMs:n,velocityKmS:i,seed:r}=e;if(t<=0||n<=0)return[];const a=t*n/36e5,o=new qc(r),c=Math.floor(a),l=c+(o.next()<a-c?1:0),h=[];for(let u=0;u<l;u++){const d=Math.min(1,Math.max(0,(i-20)/52)),f=zs.MAX_DURATION_MS-d*(zs.MAX_DURATION_MS-zs.MIN_DURATION_MS),p=o.between(5,70);h.push({t:o.between(0,n),durationMs:f*o.between(.7,1.3),fromRadiantDeg:p,bearingDeg:o.between(0,360),lengthDeg:Math.sin(p*Math.PI/180)*o.between(8,40)*(.6+d),brightness:o.next()**3}),h.sort((v,m)=>v.t-m.t)}return h}static aliveAt(e,t){return e.filter(n=>t>=n.t&&t<=n.t+n.durationMs).map(n=>({meteor:n,progress:(t-n.t)/n.durationMs}))}}class Dr{object=new en;radius;core;glow;flashKey;static CORE_WIDTH_DEG=.06;static GLOW_WIDTH_DEG=.5;static SEGMENTS=28;constructor(e){this.radius=e,this.object.name="lightning-bolt",this.core=new qn({color:15659775,transparent:!0,opacity:0,blending:Un,depthWrite:!1,fog:!1}),this.glow=new qn({color:10466559,transparent:!0,opacity:0,blending:Un,depthWrite:!1,fog:!1}),this.object.visible=!1,this.object.renderOrder=5.95}set(e,t,n){if(!e||!e.cloudToGround||t<=.01){this.object.visible=!1;return}const i=`${e.channelSeed}:${Math.round(n)}`;i!==this.flashKey&&this.build(e,n,i),this.core.opacity=Math.min(1,t*1.4),this.glow.opacity=t*.35,this.object.visible=!0}build(e,t,n){this.flashKey=n;for(const l of[...this.object.children])l.geometry.dispose(),this.object.remove(l);const i=new qc(e.channelSeed),r=Math.atan2(t,e.distanceM)*180/Math.PI,a=this.channel(i,e.azimuthDeg,r,0,1),o=[a],c=1+Math.floor(i.next()*2);for(let l=0;l<c;l++){const h=a[Math.floor(i.between(.15,.5)*a.length)];o.push(this.channel(i,h.azimuthDeg,h.altitudeDeg,h.altitudeDeg*i.between(.3,.7),.5))}for(const l of o)this.object.add(new Ge(this.ribbon(l,Dr.GLOW_WIDTH_DEG),this.glow)),this.object.add(new Ge(this.ribbon(l,Dr.CORE_WIDTH_DEG),this.core))}channel(e,t,n,i,r){const a=[],o=n-i;let c=t;for(let l=0;l<=Dr.SEGMENTS;l++){const h=n-o*l/Dr.SEGMENTS;a.push({azimuthDeg:c,altitudeDeg:h}),c+=e.between(-1,1)*o*.06*r}return a}ribbon(e,t){const n=new Float32Array(e.length*2*3),i=[],r=this.radius*Math.tan(t*Math.PI/180)/2,a=e.map(c=>{const{x:l,y:h,z:u}=jt(c.altitudeDeg,c.azimuthDeg,this.radius);return new C(l,h,u)});a.forEach((c,l)=>{const h=a[Math.min(l+1,a.length-1)],u=a[Math.max(l-1,0)],f=h.clone().sub(u).normalize().cross(c.clone().normalize()).normalize().multiplyScalar(r);if(n.set([c.x+f.x,c.y+f.y,c.z+f.z],l*6),n.set([c.x-f.x,c.y-f.y,c.z-f.z],l*6+3),l<a.length-1){const p=l*2;i.push(p,p+1,p+2,p+1,p+3,p+2)}});const o=new Mt;return o.setAttribute("position",new tt(n,3)),o.setIndex(i),o}dispose(){for(const e of this.object.children)e.geometry.dispose();this.core.dispose(),this.glow.dispose(),this.object.removeFromParent()}}class Wt{static MIN_INTERVAL_S=8;static MAX_INTERVAL_S=25;static SEVERE_MIN_INTERVAL_S=2;static SEVERE_MAX_INTERVAL_S=8;static CLOUD_TO_GROUND_FRACTION=.25;static MIN_DISTANCE_M=1e3;static MAX_DISTANCE_M=15e3;static INTERSTROKE_MS=60;static STROKE_DECAY_MS=40;static SOUND_SPEED_M_S=343;static schedule(e){const t=new qc(e.seed),n=[],{minS:i,maxS:r}=Wt.intervalFor(e.intensity??.5);let a=t.between(0,r)*1e3;for(;a<e.durationMs;){const o=t.next()<Wt.CLOUD_TO_GROUND_FRACTION,c=Wt.MIN_DISTANCE_M,l=Wt.MAX_DISTANCE_M,h=Math.sqrt(t.between(c*c,l*l)),u=o?1+Math.floor(t.next()*4):1,d=[];let f=0;for(let p=0;p<u;p++)d.push({offsetMs:f,intensity:p===0?1:t.between(.4,.9)}),f+=Wt.INTERSTROKE_MS*t.between(.5,1.6);n.push({t:a,azimuthDeg:t.between(0,360),distanceM:h,cloudToGround:o,strokes:d,channelSeed:Math.floor(t.next()*2**31)}),a+=t.between(i,r)*1e3}return n}static intervalFor(e){const t=Math.min(1,Math.max(0,(e-.5)/.5));return{minS:Wt.MIN_INTERVAL_S-t*(Wt.MIN_INTERVAL_S-Wt.SEVERE_MIN_INTERVAL_S),maxS:Wt.MAX_INTERVAL_S-t*(Wt.MAX_INTERVAL_S-Wt.SEVERE_MAX_INTERVAL_S)}}static brightnessAt(e,t){let n=0;for(const i of e.strokes){const r=t-e.t-i.offsetMs;r<0||r>Wt.STROKE_DECAY_MS*6||(n+=i.intensity*Math.exp(-r/Wt.STROKE_DECAY_MS))}return Math.min(1,n)}static endOf(e){const t=e.strokes[e.strokes.length-1];return e.t+t.offsetMs+Wt.STROKE_DECAY_MS*6}static thunderDelayMs(e){return e.distanceM/Wt.SOUND_SPEED_M_S*1e3}}class bn{static RED_NM=656.3;static BLUE_NM=435.8;static ANCHOR_RED=1.3067;static ANCHOR_BLUE=1.317;static B=(bn.ANCHOR_BLUE-bn.ANCHOR_RED)/(1/(bn.BLUE_NM*bn.BLUE_NM)-1/(bn.RED_NM*bn.RED_NM));static A=bn.ANCHOR_RED-bn.B/(bn.RED_NM*bn.RED_NM);static indexAt(e){return bn.A+bn.B/(e*e)}}class Wa{normals=new Float64Array(24);offsets=new Float64Array(8);radius=1;set(e,t,n,i,r,a){let o=0,c=0,l=0;Math.abs(n)<.9?(o=-t,c=e,l=0):(o=0,c=-n,l=t);const h=Math.hypot(o,c,l)||1;o/=h,c/=h,l/=h;const u=t*l-n*c,d=n*o-e*l,f=e*c-t*o,p=r/2,v=a/2;for(let m=0;m<6;m++){const g=i+m*Math.PI/3,b=Math.cos(g),w=Math.sin(g);this.normals[m*3]=o*b+u*w,this.normals[m*3+1]=c*b+d*w,this.normals[m*3+2]=l*b+f*w,this.offsets[m]=p}this.normals[18]=e,this.normals[19]=t,this.normals[20]=n,this.offsets[6]=v,this.normals[21]=-e,this.normals[22]=-t,this.normals[23]=-n,this.offsets[7]=v,this.radius=Math.hypot(p,v)}get aimRadius(){return this.radius}trace(e,t,n,i,r,a,o){let c=-t,l=e,h=0,u=Math.hypot(c,l,h);u<1e-6&&(c=1,l=0,h=0,u=1),c/=u,l/=u,h/=u;const d=t*h-n*l,f=n*c-e*h,p=e*l-t*c,v=c*i+d*r-e*this.radius*2,m=l*i+f*r-t*this.radius*2,g=h*i+p*r-n*this.radius*2;let b=-1,w=-1/0,_=1/0;for(let Z=0;Z<8;Z++){const ne=this.normals[Z*3],ae=this.normals[Z*3+1],He=this.normals[Z*3+2],$e=ne*e+ae*t+He*n,Be=this.offsets[Z]-(ne*v+ae*m+He*g);if($e>1e-9){const K=Be/$e;K<_&&(_=K)}else if($e<-1e-9){const K=Be/$e;K>w&&(w=K,b=Z)}else if(Be<0)return 0}if(b<0||w>=_)return 0;let S=0;const E=this.normals[b*3],R=this.normals[b*3+1],M=this.normals[b*3+2],A=-(E*e+R*t+M*n),P=Ac.reflectance(A,1,a);o[S].x=e+2*A*E,o[S].y=t+2*A*R,o[S].z=n+2*A*M,o[S].weight=P,S++;const D=1/a,I=Math.sqrt(Math.max(0,1-D*D*(1-A*A)));let F=D*e+(D*A-I)*E,H=D*t+(D*A-I)*R,O=D*n+(D*A-I)*M,V=v+e*w,z=m+t*w,Y=g+n*w,ee=1-P;for(let Z=0;Z<Wa.MAX_BOUNCES&&ee>Wa.MIN_WEIGHT;Z++){let ne=-1,ae=1/0;for(let B=0;B<8;B++){const we=this.normals[B*3],Ie=this.normals[B*3+1],Te=this.normals[B*3+2],xe=we*F+Ie*H+Te*O;if(xe<=1e-9)continue;const Ne=(this.offsets[B]-(we*V+Ie*z+Te*Y))/xe;Ne>1e-9&&Ne<ae&&(ae=Ne,ne=B)}if(ne<0)break;const He=this.normals[ne*3],$e=this.normals[ne*3+1],Be=this.normals[ne*3+2],K=He*F+$e*H+Be*O,re=a*Math.sqrt(Math.max(0,1-K*K));if(V+=F*ae,z+=H*ae,Y+=O*ae,re<1){const B=Math.sqrt(Math.max(0,1-re*re)),we=Ac.reflectance(K,a,1);if(o[S].x=a*F-(a*K-B)*He,o[S].y=a*H-(a*K-B)*$e,o[S].z=a*O-(a*K-B)*Be,o[S].weight=ee*(1-we),S++,S>=o.length)return S;ee*=we}const ie=2*K;F-=ie*He,H-=ie*$e,O-=ie*Be}return S}static MAX_BOUNCES=6;static MIN_WEIGHT=1e-4}class St{static AZIMUTH_BINS=512;static ALTITUDE_BINS=512;static POPULATIONS=[{orientation:"tumbling",widthMicrons:50,lengthMicrons:50,share:.52},{orientation:"plate",widthMicrons:100,lengthMicrons:15,share:.27},{orientation:"column",widthMicrons:40,lengthMicrons:120,share:.19},{orientation:"parry",widthMicrons:40,lengthMicrons:120,share:.02}];static WORST_TILT_DEG=180;static BEST_TILT_DEG=.5;static SOURCE_RADIUS_DEG=.265;static UNDEVIATED_DEG=.6;crystal=new Wa;emergent=Array.from({length:Wa.MAX_BOUNCES+2},()=>({x:0,y:0,z:0,weight:0}));tally=new Float32Array(St.AZIMUTH_BINS*St.ALTITUDE_BINS*3);radiance=new Float32Array(St.AZIMUTH_BINS*St.ALTITUDE_BINS*3);scratch=new Float32Array(St.AZIMUTH_BINS*St.ALTITUDE_BINS*3);seed=1;spare=0;hasSpare=!1;altitude=0;tilt=0;alignment=0;traced=0;begin(e,t,n=2654435769){this.seed=n>>>0||1,this.hasSpare=!1,this.tally.fill(0),this.traced=0,this.altitude=e*Math.PI/180,this.alignment=Math.min(1,Math.max(0,t));const i=St.WORST_TILT_DEG*(St.BEST_TILT_DEG/St.WORST_TILT_DEG)**this.alignment;this.tilt=i*Math.PI/180}trace(e){const t=St.AZIMUTH_BINS,n=St.ALTITUDE_BINS,i=this.tally,r=St.SOURCE_RADIUS_DEG*Math.PI/180,a=Math.cos(St.UNDEVIATED_DEG*Math.PI/180),o=this.altitude;for(let c=0;c<e;c++){const l=this.pickPopulation();this.orient(l,this.tilt);const h=this.random()*2*Math.PI,u=r*Math.sqrt(this.random()),d=o+u*Math.sin(h),f=u*Math.cos(h)/Math.max(.05,Math.cos(o)),p=-Math.cos(d)*Math.cos(f),v=-Math.cos(d)*Math.sin(f),m=-Math.sin(d),g=this.crystal.aimRadius,b=(this.random()*2-1)*g,w=(this.random()*2-1)*g,_=4*g*g,S=ii.SAMPLES[this.random()*ii.SAMPLES.length|0],E=this.crystal.trace(p,v,m,b,w,bn.indexAt(S.wavelengthNm),this.emergent);for(let R=0;R<E;R++){const M=this.emergent[R],A=Math.hypot(M.x,M.y,M.z);if(A<1e-9||M.weight<=0)continue;const P=M.x/A,D=M.y/A,I=M.z/A;if(P*p+D*v+I*m>a)continue;const F=Math.asin(Math.max(-1,Math.min(1,-I))),H=Math.abs(Math.atan2(-D,-P)),O=Math.min(t-1,H/Math.PI*t|0),z=(Math.min(n-1,(F+Math.PI/2)/Math.PI*n|0)*t+O)*3,Y=M.weight*_*ii.SAMPLES.length;i[z]+=Y*S.r,i[z+1]+=Y*S.g,i[z+2]+=Y*S.b}}this.traced+=e}get tracedRays(){return this.traced}harvest(){const e=St.AZIMUTH_BINS,t=St.ALTITUDE_BINS;return this.toRadiance(e,t),this.smooth(e,t),{width:e,height:t,data:this.radiance,sourceAltitudeDeg:this.altitude*180/Math.PI,alignment:this.alignment,rays:this.traced}}compute(e,t,n,i){return this.begin(e,t,i),this.trace(n),this.harvest()}toRadiance(e,t){const n=2*Math.PI/e,i=Math.max(1,this.traced),r=4*St.REFERENCE_MICRONS*St.REFERENCE_MICRONS;for(let a=0;a<t;a++){const o=Math.sin(a/t*Math.PI-Math.PI/2),c=Math.sin((a+1)/t*Math.PI-Math.PI/2),l=1/(n*(c-o)*i*r);for(let h=0;h<e;h++){const u=(a*e+h)*3;this.radiance[u]=this.tally[u]*l,this.radiance[u+1]=this.tally[u+1]*l,this.radiance[u+2]=this.tally[u+2]*l}}}static REFERENCE_MICRONS=50;smooth(e,t){const n=this.scratch,i=this.radiance;n.set(i);for(let a=0;a<t;a++){const o=a*e*3;for(let c=0;c<3;c++){let l=n[o+c];for(let h=0;h<e;h++){const u=o+h*3+c,d=h+1<e?n[u+3]:n[u];i[u]=(l+2*n[u]+d)/4,l=n[u]}}}n.set(i);const r=e*3;for(let a=0;a<t;a++){const o=a>0?-r:0,c=a+1<t?r:0,l=a*r;for(let h=l;h<l+r;h++)i[h]=(n[h+o]+2*n[h]+n[h+c])/4}}pickPopulation(){const e=this.random();let t=0;for(const n of St.POPULATIONS)if(t+=n.share,e<=t)return n;return St.POPULATIONS[St.POPULATIONS.length-1]}orient(e,t){const n=this.random()*2*Math.PI;let i=this.random()*2*Math.PI,r=0,a=0,o=1;switch(e.orientation){case"tumbling":{o=this.random()*2-1;const c=Math.sqrt(Math.max(0,1-o*o));r=c*Math.cos(n),a=c*Math.sin(n);break}case"plate":{o=this.spreadAboutAnAxis(t);const c=Math.sqrt(Math.max(0,1-o*o));r=c*Math.cos(n),a=c*Math.sin(n);break}case"column":case"parry":{o=this.spreadAboutAPlane(t);const c=Math.sqrt(Math.max(0,1-o*o));r=c*Math.cos(n),a=c*Math.sin(n),e.orientation==="parry"&&(i=Math.PI/2+this.gaussian()*t);break}}this.crystal.set(r,a,o,i,e.widthMicrons,e.lengthMicrons)}random(){this.seed=this.seed+1831565813>>>0;let e=this.seed;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}spreadAboutAnAxis(e){const t=1/Math.max(1e-6,e*e),n=Math.max(1e-12,this.random()),i=1+Math.log(n+(1-n)*Math.exp(-2*t))/t;return Math.max(-1,Math.min(1,i))}spreadAboutAPlane(e){for(let t=0;t<8;t++){const n=this.gaussian()*e;if(n>=-1&&n<=1)return n}return this.random()*2-1}gaussian(){if(this.hasSpare)return this.hasSpare=!1,this.spare;const e=Math.sqrt(-2*Math.log(Math.max(1e-12,this.random()))),t=2*Math.PI*this.random();return this.spare=e*Math.sin(t),this.hasSpare=!0,e*Math.cos(t)}}class gi{static RADIUS=880;static RAYS=9e5;static RAYS_PER_FRAME=4e3;static FIRST_GLIMPSE_RAYS=5e4;static ALTITUDE_STEP_DEG=1;static GAIN=.55;setCloudOffset(e){this.material.uniforms.uFieldOffset.value.copy(e)}object;material;sky=new St;texture;texels;mappedAltitudeDeg=Number.NaN;mappedAlignment=Number.NaN;tracing=!1;everDisplayed=!1;refining=!0;nextGlimpse=gi.FIRST_GLIMPSE_RAYS;workHandle;onRepaint;constructor(){const e=St.AZIMUTH_BINS,t=St.ALTITUDE_BINS;this.texels=new Uint16Array(e*t*4),this.texture=new qr(this.texels,e,t,_n,fn),this.texture.minFilter=gt,this.texture.magFilter=gt,this.texture.wrapS=xn,this.texture.wrapT=xn,this.texture.needsUpdate=!0,this.material=new At({uniforms:{uSource:{value:new C(0,1,0)},uUp:{value:new C(0,1,0)},uStrength:{value:0},uTint:{value:new C(1,.97,.92)},uIceCover:{value:0},uIceHeight:{value:1},uFieldOffset:{value:new C},uMap:{value:this.texture},uGain:{value:gi.GAIN}},vertexShader:`
5952
5952
  varying vec3 vDirection;
5953
5953
  void main() {
5954
5954
  vDirection = normalize((modelMatrix * vec4(position, 1.0)).xyz - cameraPosition);
@@ -5999,11 +5999,11 @@ void main()
5999
5999
  // display fades at the edge of a fibre instead of ending on a cut line.
6000
6000
  gl_FragColor = vec4(light * uStrength * (0.25 + 0.75 * ice), 1.0);
6001
6001
  }
6002
- `,transparent:!0,blending:Un,depthWrite:!1,side:Nt,fog:!1}),this.object=new Ge(new an(gi.RADIUS,64,32),this.material),this.object.renderOrder=-1,this.object.frustumCulled=!1,this.object.visible=!1}set onReady(e){this.onRepaint=e}update(e,t,n,i,r,a){const o=this.material.uniforms;if(n<=0){o.uStrength.value=0,this.object.visible=!1,this.stopWork();return}o.uSource.value.set(e.x,e.y,e.z).normalize(),o.uStrength.value=n,o.uTint.value.set(i[0],i[1],i[2]),o.uIceCover.value=r.cover,o.uIceHeight.value=r.layerHeight,this.object.visible=this.everDisplayed,this.requestMap(t,a)}requestMap(e,t){!(!(Math.abs(e-this.mappedAltitudeDeg)<gi.ALTITUDE_STEP_DEG)||t!==this.mappedAlignment)||this.tracingFor(e,t)||(this.pendingAltitudeDeg=e,this.pendingAlignment=t,this.sky.begin(e,t),this.tracing=!0,this.nextGlimpse=gi.FIRST_GLIMPSE_RAYS,this.scheduleWork())}pendingAltitudeDeg=Number.NaN;pendingAlignment=Number.NaN;tracingFor(e,t){return this.tracing&&Math.abs(e-this.pendingAltitudeDeg)<gi.ALTITUDE_STEP_DEG&&t===this.pendingAlignment}scheduleWork(){if(this.workHandle!==void 0)return;const e=()=>{if(this.workHandle=void 0,!this.tracing)return;this.sky.trace(gi.RAYS_PER_FRAME);const t=this.sky.tracedRays>=gi.RAYS,n=this.refining&&this.sky.tracedRays>=this.nextGlimpse;if(n&&(this.nextGlimpse*=2),(t||n)&&this.publish(),t){this.tracing=!1,this.refining=!1,this.mappedAltitudeDeg=this.pendingAltitudeDeg,this.mappedAlignment=this.pendingAlignment;return}this.workHandle=requestAnimationFrame(e)};this.workHandle=requestAnimationFrame(e)}stopWork(){this.workHandle!==void 0&&cancelAnimationFrame(this.workHandle),this.workHandle=void 0,this.tracing=!1}publish(){const t=this.sky.harvest().data;for(let n=0,i=0;i<t.length;n+=4,i+=3)this.texels[n]=gs.toHalfFloat(t[i]),this.texels[n+1]=gs.toHalfFloat(t[i+1]),this.texels[n+2]=gs.toHalfFloat(t[i+2]),this.texels[n+3]=1;this.texture.needsUpdate=!0,this.everDisplayed=!0,this.object.visible=this.material.uniforms.uStrength.value>0,this.onRepaint?.()}dispose(){this.stopWork(),this.texture.dispose(),this.object.geometry.dispose(),this.material.dispose()}}class Jt{static MAX_CONCURRENT=24;static POINTS=8;static SEGMENTS=Jt.POINTS-1;static ACROSS=3;static VERTICES_PER_SEGMENT=(Jt.ACROSS-1)*6;static RADIUS=840;static MIN_HALF_WIDTH_DEG=.05;static BRIGHT_HALF_WIDTH_DEG=.22;object;positions;colors;meteors=[];radiantAltitudeDeg=0;radiantAzimuthDeg=0;constructor(){const e=Jt.MAX_CONCURRENT*Jt.SEGMENTS*Jt.VERTICES_PER_SEGMENT;this.positions=new Float32Array(e*3),this.colors=new Float32Array(e*3);const t=new Mt;t.setAttribute("position",new tt(this.positions,3)),t.setAttribute("color",new tt(this.colors,3)),t.setDrawRange(0,0),this.object=new Ge(t,new qn({vertexColors:!0,transparent:!0,blending:Un,depthWrite:!1,fog:!1,side:ti})),this.object.frustumCulled=!1}get schedule(){return this.meteors}setShower(e,t,n){this.meteors=e,this.radiantAltitudeDeg=t,this.radiantAzimuthDeg=n}update(e){const t=this.object.geometry;if(this.meteors.length===0){t.setDrawRange(0,0);return}const n=zs.aliveAt(this.meteors,e).slice(0,Jt.MAX_CONCURRENT);let i=0;for(const{meteor:r,progress:a}of n){const o=this.radiantOf(r);if(!o)continue;const c=jt(o.altitudeDeg,o.azimuthDeg,1),[l,h]=this.basisAround(c),u=r.fromRadiantDeg+a*r.lengthDeg,d=Math.max(r.fromRadiantDeg,u-r.lengthDeg*.6),f=Math.min(1,(1-a)*2.5),p=this.turn(l,h,r.bearingDeg),v=(.15+.85*r.brightness)*f,m=w=>v*w**1.6,g=w=>this.onSphere(c,p,d+(u-d)*w),b=w=>Jt.RADIUS*((Jt.MIN_HALF_WIDTH_DEG+Jt.BRIGHT_HALF_WIDTH_DEG*r.brightness*w)*Math.PI/180);for(let w=1;w<Jt.POINTS;w++){const _=(w-1)/Jt.SEGMENTS,S=w/Jt.SEGMENTS;i=this.pushRibbon(i,g(_),g(S),b(_),b(S),m(_),m(S))}}t.setDrawRange(0,i),t.getAttribute("position").needsUpdate=!0,t.getAttribute("color").needsUpdate=!0}midpointOf(e){const t=this.radiantOf(e);if(!t)return;const n=jt(t.altitudeDeg,t.azimuthDeg,1),[i,r]=this.basisAround(n),a=this.turn(i,r,e.bearingDeg),o=this.onSphere(n,a,e.fromRadiantDeg+e.lengthDeg/2),c=Math.hypot(o.x,o.y,o.z)||1;return{altitudeDeg:Math.asin(o.y/c)*180/Math.PI,azimuthDeg:(Math.atan2(o.x,-o.z)*180/Math.PI+360)%360}}radiantOf(e){return e.radiant?e.radiant:this.radiantAltitudeDeg>0?{altitudeDeg:this.radiantAltitudeDeg,azimuthDeg:this.radiantAzimuthDeg}:void 0}pushRibbon(e,t,n,i,r,a,o){const c=this.normalise(this.cross(this.normalise(t),this.normalise(this.subtract(n,t))));for(let l=0;l<Jt.ACROSS-1;l++){const h=l-1,u=l,d=this.across(t,c,i,h),f=this.across(n,c,r,h),p=this.across(t,c,i,u),v=this.across(n,c,r,u),m=(g,b)=>g===0?b:0;e=this.push(e,d,m(h,a)),e=this.push(e,f,m(h,o)),e=this.push(e,p,m(u,a)),e=this.push(e,f,m(h,o)),e=this.push(e,v,m(u,o)),e=this.push(e,p,m(u,a))}return e}across(e,t,n,i){return{x:e.x+t.x*n*i,y:e.y+t.y*n*i,z:e.z+t.z*n*i}}push(e,t,n){const i=e*3;this.positions[i]=t.x,this.positions[i+1]=t.y,this.positions[i+2]=t.z;const r=Math.max(0,Math.min(1,n));return this.colors[i]=r*.9,this.colors[i+1]=r*.95,this.colors[i+2]=r,e+1}turn(e,t,n){const i=n*Math.PI/180,r=Math.cos(i),a=Math.sin(i);return{x:e.x*r+t.x*a,y:e.y*r+t.y*a,z:e.z*r+t.z*a}}onSphere(e,t,n){const i=n*Math.PI/180,r=Math.cos(i),a=Math.sin(i);return{x:(e.x*r+t.x*a)*Jt.RADIUS,y:(e.y*r+t.y*a)*Jt.RADIUS,z:(e.z*r+t.z*a)*Jt.RADIUS}}basisAround(e){const t=Math.abs(e.y)<.9?{x:0,y:1,z:0}:{x:1,y:0,z:0},n=this.normalise(this.cross(e,t));return[n,this.normalise(this.cross(e,n))]}subtract(e,t){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}}cross(e,t){return{x:e.y*t.z-e.z*t.y,y:e.z*t.x-e.x*t.z,z:e.x*t.y-e.y*t.x}}normalise(e){const t=Math.hypot(e.x,e.y,e.z)||1;return{x:e.x/t,y:e.y/t,z:e.z/t}}dispose(){this.object.geometry.dispose(),this.object.material.dispose()}}const Gl=Math.PI/180;function zt(s,e,t,n,i=!1){const r=i?new qn({color:new oe(...t)}):new Ya({color:new oe(...t)}),a=new Ge(e,r);return a.position.y=n,a.userData={emissive:i},a.castShadow=!i,a.receiveShadow=!i,s.add(a),a}const zf=.25,U5=.002,F5=20;function k5(s){const e=/^#([0-9a-f]{6})$/i.exec(s);if(!e)return[1,1,1];const t=parseInt(e[1],16);return[(t>>16&255)/255,(t>>8&255)/255,(t&255)/255]}const eg=[.32,.32,.3],tg=[1,.85,.5],ng=[.25,.25,.25],ig=[1,.97,.85],z5=[.55,.68,.72],xi=.03,_i=.05,sg={front:0,behind:Math.PI,left:Math.PI/2,right:-Math.PI/2,"front-left":Math.PI/2,"behind-left":Math.PI/2,"front-right":-Math.PI/2,"behind-right":-Math.PI/2};function Mn(s,e){return s?.[e]}function yi(s,e,t,n,i,r,a,o){if(o===void 0)return;const c=new Ya({color:new oe(...z5),transparent:!0,opacity:o/100}),l=new Ge(new Yn(e,t,n),c);l.position.set(i,r,a),s.add(l)}const Bn=.05,Vl=[.6,.58,.53],Bf=[.5,.5,.48];function Cr(s,e,t,n,i,r,a,o){const c=new Ya({color:new oe(...o),side:Nt}),l=new Ge(new Yn(e,t,n),c);l.position.set(i,r,a),s.add(l)}function B5(s,e,t,n,i,r,a,o,c){const l=(n-r)/2,h=(p,v,m,g)=>{p<=0||(e?Cr(s,p,v,Bn,m,o+g,a,c):Cr(s,Bn,v,p,a,o+g,m,c))};h(t,l,0,n/2-l/2),h(t,l,0,-(n/2-l/2));const u=[...i].sort((p,v)=>p.center-v.center);let d=-t/2;for(const p of u){const m=p.center-p.main/2-d;h(m,r,d+m/2,0),d=p.center+p.main/2}const f=t/2-d;h(f,r,d+f/2,0)}function rg(s,e,t,n,i,r,a,o,c,l){const h=(n+i)/2,u=i-n,d=(f,p,v,m)=>{f.length===0?p?Cr(s,v,u,Bn,0,h,m,Vl):Cr(s,Bn,u,v,m,h,0,Vl):B5(s,p,v,u,f,r,m,h,Vl)};d(a,!0,e*2,-t+Bn),d(o,!0,e*2,t-Bn),d(c,!1,t*2,-e+Bn),d(l,!1,t*2,e-Bn),Cr(s,e*2,Bn,t*2,0,n+Bn,0,Bf),Cr(s,e*2,Bn,t*2,0,i-Bn,0,Bf)}function Pu(s,e,t,n){switch(s){case"front":return{x:0,z:-(t-n)};case"behind":return{x:0,z:t-n};case"left":return{x:-(e-n),z:0};case"right":return{x:e-n,z:0};case"front-left":return{x:-(e-n),z:-Si};case"front-right":return{x:e-n,z:-Si};case"behind-left":return{x:-(e-n),z:Si};case"behind-right":return{x:e-n,z:Si}}}function ag(s,e,t,n,i,r,a){const o=Nu();o.scale.setScalar(n),o.rotation.y=sg[e];const{x:c,z:l}=Pu(e,i,r,a);o.position.set(c,t,l),s.add(o)}const Iu=6,Lu=6,hs=3,da=1.4,fa=hs*.5,og=1.2,cg=.35,H5=.75,G5=1.6;function Hf(s,e,t,n){const i=new en,r=Math.max(1,s+1),a=r*hs;zt(i,new Yn(Iu,a,Lu),[.55,.54,.5],a/2);const o=Iu/2,c=Lu/2;for(let l=0;l<r;l++){const h=l*hs+hs/2;yi(i,da,fa,_i,0,h,-c-xi,Mn(e,"front")),yi(i,da,fa,_i,0,h,c+xi,Mn(e,"behind")),yi(i,_i,fa,da,-o-xi,h,0,Mn(e,"left")),yi(i,_i,fa,da,o+xi,h,0,Mn(e,"right"))}if(t){const l=Math.min(Math.max(n??0,0),r-1);ag(i,t,l*hs,.72,o,c,og);const h=u=>Mn(e,u)!==void 0?[{main:da,center:0}]:[];rg(i,o,c,l*hs,(l+1)*hs,fa,h("front"),h("behind"),h("left"),h("right"))}return i}function Gf(){const s=new en;return zt(s,new $i(.15,.22,2,8),[.32,.22,.14],1),zt(s,new qa(1.4,3,8),[.16,.32,.14],3.5),s}const Vf=.275,V5=.35,W5=.9,X5=34,q5=8,Y5=1.4;function Wf(){const s=new en,e=new an(Vf,7,3,0,Math.PI*2,0,Math.PI/2);e.scale(1,V5/Vf,1);const t=sn.repeatOnGrid(e,X5,W5,q5,Y5),n=zt(s,t,[.26,.28,.22],0);return n.castShadow=!1,n.userData.cropBasePositions=t.getAttribute("position").array.slice(),n.userData.cropVerticesPerClump=e.getAttribute("position").count,e.dispose(),s}function Xf(){const s=new en,e=new an(1,7,3,0,Math.PI*2,0,Math.PI/2);return zt(s,e,[.38,.36,.32],0),s}function qf(s){const e=new en;return zt(e,new $i(.05,.08,5,8),[.28,.28,.3],2.5),zt(e,new an(.25,12,8),s?tg:eg,5.1,!0),e}const K5=[.08,.08,.08],cs=.8,wr=1,mi=1.7,Wl=.6,As=.4,qo=1.2,yr=.7,Si=.5,$5=mi;function Yf(s,e,t){const n=new en;zt(n,new Yn(1.8,1.4,4.2),[.45,.14,.14],.7),zt(n,new Yn(cs*2,Wl,wr*2),[.4,.12,.12],mi);for(const r of[-1.4,1.4])for(const a of[-.95,.95]){const o=zt(n,new $i(.4,.4,.3,12),K5,.4);o.rotation.z=Math.PI/2,o.position.x=a,o.position.z=r}const i=s?ig:ng;for(const r of[-.7,.7])zt(n,new an(.15,8,6),i,.7,!0).position.set(r,.7,-2.1);if(yi(n,qo,As,_i,0,mi,-wr-xi,Mn(e,"front")),yi(n,qo,As,_i,0,mi,wr+xi,Mn(e,"behind")),yi(n,_i,As,yr,-cs-xi,mi,-Si,Mn(e,"front-left")),yi(n,_i,As,yr,-cs-xi,mi,Si,Mn(e,"behind-left")),yi(n,_i,As,yr,cs+xi,mi,-Si,Mn(e,"front-right")),yi(n,_i,As,yr,cs+xi,mi,Si,Mn(e,"behind-right")),t){ag(n,t,H5,.5,cs,wr,cg);const r=(c,l)=>{const h=[];return Mn(e,c)!==void 0&&h.push({main:yr,center:-Si}),Mn(e,l)!==void 0&&h.push({main:yr,center:Si}),h},a=Mn(e,"front")!==void 0?[{main:qo,center:0}]:[],o=Mn(e,"behind")!==void 0?[{main:qo,center:0}]:[];rg(n,cs,wr,mi-Wl/2,mi+Wl/2,As,a,o,r("front-left","behind-left"),r("front-right","behind-right"))}return n}const Kf=new Map;function $f(s,e){if(!s)return;const t=[[s.lengthM,e.lengthM],[s.heightM,e.heightM],[s.widthM,e.widthM]];for(const[n,i]of t)if(n!==void 0&&i>1e-6)return n/i}function Xl(s,e){return e>1e-6?s/e:1}const lg=[.95,.9,.82],Jf=[.72,.74,.78];function Zf(){const s=new en;zt(s,new $i(.25,.3,1.5,10),Jf,.75),zt(s,new an(.26,10,8),Jf,1.74);const e=zt(s,new qa(.07,.16,8),lg,1.74);return e.rotation.x=-Math.PI/2,e.position.z=-.22,s}function Nu(){const s=new en;zt(s,new $i(.25,.3,1.5,10),[.3,.3,.35],.75),zt(s,new an(.22,10,8),[.62,.52,.46],1.72);const e=zt(s,new qa(.07,.16,8),lg,1.72);return e.rotation.x=-Math.PI/2,e.position.z=-.2,s}const J5=17,jf=18.5,ql=[.16,.16,.18];function Qf(){const s=new en,e=zt(s,new $i(1.8,1.8,jf*2,10),ql,0);e.rotation.x=Math.PI/2,zt(s,new Yn(J5*2,.5,4.5),ql,0);const t=zt(s,new Yn(.4,5.5,4),ql,3);return t.position.z=-jf+2,s}class sn{static groundUnderFootprint(e,t,n,i,r,a=0){const o=sn.sizeOf(e);if(a>o.heightM)return r(t,n);const c=(i??0)*Math.PI/180,l=Math.min(21,Math.max(2,Math.ceil(o.lengthM/.75)+1)),h=Math.min(21,Math.max(2,Math.ceil(o.widthM/.75)+1));let u=-1/0;for(let d=0;d<l;d++){const f=(d/(l-1)-.5)*o.lengthM;for(let p=0;p<h;p++){const v=(p/(h-1)-.5)*o.widthM,m=t+Math.sin(c)*f+Math.cos(c)*v,g=n-Math.cos(c)*f+Math.sin(c)*v;u=Math.max(u,r(m,g))}}return Number.isFinite(u)?u:r(t,n)}static occupantView(e){const t=e.witnessSide;if(!t)throw new Error("occupantView requires object.witnessSide to be set");const{x:n,z:i}=e.kind==="vehicle"?Pu(t,cs,wr,cg):Pu(t,Iu/2,Lu/2,og),r=e.kind==="vehicle"?$5:(e.occupiedFloor??0)*hs+G5,a=(e.headingDeg??0)-sg[t]/Gl,o=this.scaleFor(e);return{x:n*o.x,z:i*o.z,eyeY:r*o.y,headingDeg:a}}static BODY_NAME="decor-body";static bodyOf(e){return e.getObjectByName(sn.BODY_NAME)??e}static repeatOnGrid(e,t,n,i,r){const a=e.getAttribute("position"),o=e.getAttribute("normal"),c=e.getIndex();if(!c)throw new Error("repeatOnGrid needs an indexed geometry");const l=a.count,h=t*i,u=new Float32Array(l*h*3),d=new Float32Array(l*h*3),f=new Uint32Array(c.count*h),p=-((t-1)*n)/2,v=-((i-1)*r)/2;let m=0;for(let b=0;b<i;b++)for(let w=0;w<t;w++,m++){const _=v+b*r,S=p+w*n;for(let E=0;E<l;E++){const R=(m*l+E)*3;u[R]=a.getX(E)+_,u[R+1]=a.getY(E),u[R+2]=a.getZ(E)+S,d[R]=o.getX(E),d[R+1]=o.getY(E),d[R+2]=o.getZ(E)}for(let E=0;E<c.count;E++)f[m*c.count+E]=c.getX(E)+m*l}const g=new Mt;return g.setAttribute("position",new Et(u,3)),g.setAttribute("normal",new Et(d,3)),g.setIndex(new ju(f,1)),g}static fitCropToGround(e,t){e.updateMatrixWorld(!0);const n=new C;e.traverse(i=>{const r=i,a=r.userData.cropBasePositions,o=r.userData.cropVerticesPerClump;if(!r.isMesh||!a||!o)return;const c=r.geometry.getAttribute("position"),l=new Xe().copy(r.matrixWorld).invert();for(let h=0;h<c.count;h+=o){n.set(a[h*3],0,a[h*3+2]).applyMatrix4(r.matrixWorld),n.y=t(n.x,n.z),n.applyMatrix4(l);for(let u=h;u<h+o;u++)c.setY(u,a[u*3+1]+n.y)}c.needsUpdate=!0,r.geometry.computeBoundingBox(),r.geometry.computeBoundingSphere()})}static paint(e,t){e.traverse(n=>{const i=n,r=i.userData;if(!i.isMesh||r?.emissive)return;const a=i.material;a?.color&&a.color.set(t)})}static build(e,t){const n=e.kind==="building"?Hf(e.floors??Xd,e.windows,e.witnessSide,e.occupiedFloor):e.kind==="tree"?Gf():e.kind==="crop"?Wf():e.kind==="mound"?Xf():e.kind==="streetlight"?qf(t):e.kind==="vehicle"?Yf(t,e.windows,e.witnessSide):e.kind==="aircraft"?Qf():e.kind==="entity"?Zf():Nu();e.color&&this.paint(n,e.color);const i=this.scaleFor(e),r=new en;return n.name=sn.BODY_NAME,n.scale.copy(i),r.add(n),e.headingDeg!==void 0&&(r.rotation.y=-e.headingDeg*Gl),this.addLights(r,e.lights),e.kind==="aircraft"&&this.exemptFromFog(r),r}static scaleFor(e){const t=e.sizeM;if(!t)return new C(1,1,1);const n=this.naturalSize(e.kind,e.floors);return new C(t.widthM===void 0?1:Xl(t.widthM,n.widthM),t.heightM===void 0?1:Xl(t.heightM,n.heightM),t.lengthM===void 0?1:Xl(t.lengthM,n.lengthM))}static naturalSize(e,t){const n=e==="building"?Math.max(1,(t??Xd)+1):0,i=`${e}:${n}`,r=Kf.get(i);if(r)return r;const a=e==="building"?Hf(n-1,void 0,void 0,void 0):e==="tree"?Gf():e==="crop"?Wf():e==="mound"?Xf():e==="streetlight"?qf(!1):e==="vehicle"?Yf(!1,void 0,void 0):e==="aircraft"?Qf():e==="entity"?Zf():Nu(),o=new ai().setFromObject(a),c={widthM:o.max.x-o.min.x,heightM:o.max.y-o.min.y,lengthM:o.max.z-o.min.z};return this.dispose(a),Kf.set(i,c),c}static usesModel(e){return e.model!==void 0&&!(e.witnessSide!==void 0&&Fp(e.kind))}static applyModel(e,t,n,i={}){const r=this.bodyOf(e),a=new en;a.name=sn.BODY_NAME,n.rotation.y=-(i.headingOffsetDeg??0)*Gl,n.updateMatrixWorld(!0);const o=new ai().setFromObject(n),c={lengthM:o.max.z-o.min.z,heightM:o.max.y-o.min.y,widthM:o.max.x-o.min.x},l=$f(t.sizeM,c)??$f(i.depictedSizeM,c)??1;n.scale.multiplyScalar(l);const h=o.getCenter(new C).multiplyScalar(l);n.position.x-=h.x,n.position.z-=h.z,n.position.y-=t.kind==="aircraft"?h.y:o.min.y*l,n.traverse(u=>{u instanceof Ge&&(u.castShadow=!0,u.receiveShadow=!0)}),a.add(n),r.parent?(r.parent.add(a),r.removeFromParent()):e.add(a),this.dispose(r)}static sizeOf(e){const t=this.naturalSize(e.kind,e.floors);return{widthM:e.sizeM?.widthM??t.widthM,lengthM:e.sizeM?.lengthM??t.lengthM,heightM:e.sizeM?.heightM??t.heightM}}static exemptFromFog(e){e.traverse(t=>{if(!(t instanceof Ge))return;const n=t.material;n.fog=!1,n.needsUpdate=!0})}static addLights(e,t){for(const n of t??[]){const i=k5(n.color),r=zt(e,new an(zf,8,6),i,n.offsetM.y,!0);r.position.set(n.offsetM.x,n.offsetM.y,n.offsetM.z),r.userData={emissive:!0,lightId:n.id,lightColor:i},r.visible=!1}}static setLights(e,t,n,i,r=0){if(!t||t.length===0)return;const a=new Map(t.map(c=>[c.id,c])),o=Math.max(1,i*U5/zf);for(const c of e.children){if(!(c instanceof Ge))continue;const l=c.userData.lightId;if(!l)continue;const h=a.get(l);if(!h)continue;const u=r>0?kp(h,n,n+r):r1(h,n)?1:0;c.visible=u>0;const d=c.material,f=c.userData.lightColor;if(f){const p=r>0?u*F5*(h.intensity??1):u;d.color.setRGB(f[0]*p,f[1]*p,f[2]*p)}c.scale.setScalar(o)}}static setLit(e,t,n){const i=t==="streetlight"?n?tg:eg:n?ig:ng;e.traverse(r=>{const a=r.userData;!(r instanceof Ge)||!a.emissive||a.lightId||r.material.color.setRGB(...i)})}static dispose(e){e.traverse(t=>{if(!(t instanceof Ge))return;t.geometry.dispose();const n=t.material;for(const i of Array.isArray(n)?n:[n])i.dispose()})}}const Yl="https://ufoathome.org/models/index.json";class Z5{attribution="3D models re-hosted by UFO@home, each under its own author's licence";fetchImpl;indexUrls;loading;constructor(e={}){this.fetchImpl=e.fetchImpl??fetch.bind(globalThis),this.indexUrls=e.indexUrls??j5()}async entries(e){const t=await this.load();return e?t.filter(n=>n.kind===e):t}async entry(e){return(await this.load()).find(t=>t.id===e)}load(){return this.loading??=this.fetchFirstAvailable(),this.loading}async fetchFirstAvailable(){for(const e of this.indexUrls){const t=await this.fetchIndex(e);if(t)return t}return[]}async fetchIndex(e){try{const t=await this.fetchImpl(e);if(!t.ok)return;const n=await t.json();return Array.isArray(n?.models)?n.models.map(({file:i,...r})=>({...r,url:new URL(i,e).href})):void 0}catch{return}}}function j5(){const s=typeof location>"u"?void 0:new URL("/models/index.json",location.href).href;return s&&s!==Yl?[s,Yl]:[Yl]}const Q5=[{id:"ufoathome",name:"UFO@home",credit:"3D models re-hosted by UFO@home, each under its own author's licence",creditUrl:"https://ufoathome.org/models/",create:()=>new Z5}];async function eb(s){const{GLTFLoader:e}=await lc(async()=>{const{GLTFLoader:n}=await import("./GLTFLoader-BumifFuq.js");return{GLTFLoader:n}},[],import.meta.url),t=new e;return new Promise((n,i)=>{t.load(s,r=>n(r.scene),void 0,r=>i(new Error(`Could not load 3D model ${s}: ${r instanceof Error?r.message:String(r)}`)))})}const hg=2,tb=5,nb=2048;class jn{constructor(e){this.scene=e}cloudLayers=[];cloudSignature="";setCloudLayers(e){const t=e.map(n=>n.mesh.uuid).join(",");if(t!==this.cloudSignature){this.cloudSignature=t,this.cloudLayers=e;for(const n of this.meshes.values())this.configureCloudMaterial(n.material)}}configureCloudMaterial(e){const t=this.cloudLayers,n=this.cloudSignature;e.customProgramCacheKey=()=>n,e.onBeforeCompile=i=>{if(!t.length)return;i.vertexShader=`varying vec3 cloudPoint;
6002
+ `,transparent:!0,blending:Un,depthWrite:!1,side:Nt,fog:!1}),this.object=new Ge(new an(gi.RADIUS,64,32),this.material),this.object.renderOrder=-1,this.object.frustumCulled=!1,this.object.visible=!1}set onReady(e){this.onRepaint=e}update(e,t,n,i,r,a){const o=this.material.uniforms;if(n<=0){o.uStrength.value=0,this.object.visible=!1,this.stopWork();return}o.uSource.value.set(e.x,e.y,e.z).normalize(),o.uStrength.value=n,o.uTint.value.set(i[0],i[1],i[2]),o.uIceCover.value=r.cover,o.uIceHeight.value=r.layerHeight,this.object.visible=this.everDisplayed,this.requestMap(t,a)}requestMap(e,t){!(!(Math.abs(e-this.mappedAltitudeDeg)<gi.ALTITUDE_STEP_DEG)||t!==this.mappedAlignment)||this.tracingFor(e,t)||(this.pendingAltitudeDeg=e,this.pendingAlignment=t,this.sky.begin(e,t),this.tracing=!0,this.nextGlimpse=gi.FIRST_GLIMPSE_RAYS,this.scheduleWork())}pendingAltitudeDeg=Number.NaN;pendingAlignment=Number.NaN;tracingFor(e,t){return this.tracing&&Math.abs(e-this.pendingAltitudeDeg)<gi.ALTITUDE_STEP_DEG&&t===this.pendingAlignment}scheduleWork(){if(this.workHandle!==void 0)return;const e=()=>{if(this.workHandle=void 0,!this.tracing)return;this.sky.trace(gi.RAYS_PER_FRAME);const t=this.sky.tracedRays>=gi.RAYS,n=this.refining&&this.sky.tracedRays>=this.nextGlimpse;if(n&&(this.nextGlimpse*=2),(t||n)&&this.publish(),t){this.tracing=!1,this.refining=!1,this.mappedAltitudeDeg=this.pendingAltitudeDeg,this.mappedAlignment=this.pendingAlignment;return}this.workHandle=requestAnimationFrame(e)};this.workHandle=requestAnimationFrame(e)}stopWork(){this.workHandle!==void 0&&cancelAnimationFrame(this.workHandle),this.workHandle=void 0,this.tracing=!1}publish(){const t=this.sky.harvest().data;for(let n=0,i=0;i<t.length;n+=4,i+=3)this.texels[n]=gs.toHalfFloat(t[i]),this.texels[n+1]=gs.toHalfFloat(t[i+1]),this.texels[n+2]=gs.toHalfFloat(t[i+2]),this.texels[n+3]=1;this.texture.needsUpdate=!0,this.everDisplayed=!0,this.object.visible=this.material.uniforms.uStrength.value>0,this.onRepaint?.()}dispose(){this.stopWork(),this.texture.dispose(),this.object.geometry.dispose(),this.material.dispose()}}class Jt{static MAX_CONCURRENT=24;static POINTS=8;static SEGMENTS=Jt.POINTS-1;static ACROSS=3;static VERTICES_PER_SEGMENT=(Jt.ACROSS-1)*6;static RADIUS=840;static MIN_HALF_WIDTH_DEG=.05;static BRIGHT_HALF_WIDTH_DEG=.22;object;positions;colors;meteors=[];radiantAltitudeDeg=0;radiantAzimuthDeg=0;constructor(){const e=Jt.MAX_CONCURRENT*Jt.SEGMENTS*Jt.VERTICES_PER_SEGMENT;this.positions=new Float32Array(e*3),this.colors=new Float32Array(e*3);const t=new Mt;t.setAttribute("position",new tt(this.positions,3)),t.setAttribute("color",new tt(this.colors,3)),t.setDrawRange(0,0),this.object=new Ge(t,new qn({vertexColors:!0,transparent:!0,blending:Un,depthWrite:!1,fog:!1,side:ti})),this.object.frustumCulled=!1}get schedule(){return this.meteors}setShower(e,t,n){this.meteors=e,this.radiantAltitudeDeg=t,this.radiantAzimuthDeg=n}update(e){const t=this.object.geometry;if(this.meteors.length===0){t.setDrawRange(0,0);return}const n=zs.aliveAt(this.meteors,e).slice(0,Jt.MAX_CONCURRENT);let i=0;for(const{meteor:r,progress:a}of n){const o=this.radiantOf(r);if(!o)continue;const c=jt(o.altitudeDeg,o.azimuthDeg,1),[l,h]=this.basisAround(c),u=r.fromRadiantDeg+a*r.lengthDeg,d=Math.max(r.fromRadiantDeg,u-r.lengthDeg*.6),f=Math.min(1,(1-a)*2.5),p=this.turn(l,h,r.bearingDeg),v=(.15+.85*r.brightness)*f,m=w=>v*w**1.6,g=w=>this.onSphere(c,p,d+(u-d)*w),b=w=>Jt.RADIUS*((Jt.MIN_HALF_WIDTH_DEG+Jt.BRIGHT_HALF_WIDTH_DEG*r.brightness*w)*Math.PI/180);for(let w=1;w<Jt.POINTS;w++){const _=(w-1)/Jt.SEGMENTS,S=w/Jt.SEGMENTS;i=this.pushRibbon(i,g(_),g(S),b(_),b(S),m(_),m(S))}}t.setDrawRange(0,i),t.getAttribute("position").needsUpdate=!0,t.getAttribute("color").needsUpdate=!0}midpointOf(e){const t=this.radiantOf(e);if(!t)return;const n=jt(t.altitudeDeg,t.azimuthDeg,1),[i,r]=this.basisAround(n),a=this.turn(i,r,e.bearingDeg),o=this.onSphere(n,a,e.fromRadiantDeg+e.lengthDeg/2),c=Math.hypot(o.x,o.y,o.z)||1;return{altitudeDeg:Math.asin(o.y/c)*180/Math.PI,azimuthDeg:(Math.atan2(o.x,-o.z)*180/Math.PI+360)%360}}radiantOf(e){return e.radiant?e.radiant:this.radiantAltitudeDeg>0?{altitudeDeg:this.radiantAltitudeDeg,azimuthDeg:this.radiantAzimuthDeg}:void 0}pushRibbon(e,t,n,i,r,a,o){const c=this.normalise(this.cross(this.normalise(t),this.normalise(this.subtract(n,t))));for(let l=0;l<Jt.ACROSS-1;l++){const h=l-1,u=l,d=this.across(t,c,i,h),f=this.across(n,c,r,h),p=this.across(t,c,i,u),v=this.across(n,c,r,u),m=(g,b)=>g===0?b:0;e=this.push(e,d,m(h,a)),e=this.push(e,f,m(h,o)),e=this.push(e,p,m(u,a)),e=this.push(e,f,m(h,o)),e=this.push(e,v,m(u,o)),e=this.push(e,p,m(u,a))}return e}across(e,t,n,i){return{x:e.x+t.x*n*i,y:e.y+t.y*n*i,z:e.z+t.z*n*i}}push(e,t,n){const i=e*3;this.positions[i]=t.x,this.positions[i+1]=t.y,this.positions[i+2]=t.z;const r=Math.max(0,Math.min(1,n));return this.colors[i]=r*.9,this.colors[i+1]=r*.95,this.colors[i+2]=r,e+1}turn(e,t,n){const i=n*Math.PI/180,r=Math.cos(i),a=Math.sin(i);return{x:e.x*r+t.x*a,y:e.y*r+t.y*a,z:e.z*r+t.z*a}}onSphere(e,t,n){const i=n*Math.PI/180,r=Math.cos(i),a=Math.sin(i);return{x:(e.x*r+t.x*a)*Jt.RADIUS,y:(e.y*r+t.y*a)*Jt.RADIUS,z:(e.z*r+t.z*a)*Jt.RADIUS}}basisAround(e){const t=Math.abs(e.y)<.9?{x:0,y:1,z:0}:{x:1,y:0,z:0},n=this.normalise(this.cross(e,t));return[n,this.normalise(this.cross(e,n))]}subtract(e,t){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}}cross(e,t){return{x:e.y*t.z-e.z*t.y,y:e.z*t.x-e.x*t.z,z:e.x*t.y-e.y*t.x}}normalise(e){const t=Math.hypot(e.x,e.y,e.z)||1;return{x:e.x/t,y:e.y/t,z:e.z/t}}dispose(){this.object.geometry.dispose(),this.object.material.dispose()}}const Gl=Math.PI/180;function zt(s,e,t,n,i=!1){const r=i?new qn({color:new oe(...t)}):new Ya({color:new oe(...t)}),a=new Ge(e,r);return a.position.y=n,a.userData={emissive:i},a.castShadow=!i,a.receiveShadow=!i,s.add(a),a}const zf=.25,US=.002,FS=20;function kS(s){const e=/^#([0-9a-f]{6})$/i.exec(s);if(!e)return[1,1,1];const t=parseInt(e[1],16);return[(t>>16&255)/255,(t>>8&255)/255,(t&255)/255]}const eg=[.32,.32,.3],tg=[1,.85,.5],ng=[.25,.25,.25],ig=[1,.97,.85],zS=[.55,.68,.72],xi=.03,_i=.05,sg={front:0,behind:Math.PI,left:Math.PI/2,right:-Math.PI/2,"front-left":Math.PI/2,"behind-left":Math.PI/2,"front-right":-Math.PI/2,"behind-right":-Math.PI/2};function Mn(s,e){return s?.[e]}function yi(s,e,t,n,i,r,a,o){if(o===void 0)return;const c=new Ya({color:new oe(...zS),transparent:!0,opacity:o/100}),l=new Ge(new Yn(e,t,n),c);l.position.set(i,r,a),s.add(l)}const Bn=.05,Vl=[.6,.58,.53],Bf=[.5,.5,.48];function Cr(s,e,t,n,i,r,a,o){const c=new Ya({color:new oe(...o),side:Nt}),l=new Ge(new Yn(e,t,n),c);l.position.set(i,r,a),s.add(l)}function BS(s,e,t,n,i,r,a,o,c){const l=(n-r)/2,h=(p,v,m,g)=>{p<=0||(e?Cr(s,p,v,Bn,m,o+g,a,c):Cr(s,Bn,v,p,a,o+g,m,c))};h(t,l,0,n/2-l/2),h(t,l,0,-(n/2-l/2));const u=[...i].sort((p,v)=>p.center-v.center);let d=-t/2;for(const p of u){const m=p.center-p.main/2-d;h(m,r,d+m/2,0),d=p.center+p.main/2}const f=t/2-d;h(f,r,d+f/2,0)}function rg(s,e,t,n,i,r,a,o,c,l){const h=(n+i)/2,u=i-n,d=(f,p,v,m)=>{f.length===0?p?Cr(s,v,u,Bn,0,h,m,Vl):Cr(s,Bn,u,v,m,h,0,Vl):BS(s,p,v,u,f,r,m,h,Vl)};d(a,!0,e*2,-t+Bn),d(o,!0,e*2,t-Bn),d(c,!1,t*2,-e+Bn),d(l,!1,t*2,e-Bn),Cr(s,e*2,Bn,t*2,0,n+Bn,0,Bf),Cr(s,e*2,Bn,t*2,0,i-Bn,0,Bf)}function Pu(s,e,t,n){switch(s){case"front":return{x:0,z:-(t-n)};case"behind":return{x:0,z:t-n};case"left":return{x:-(e-n),z:0};case"right":return{x:e-n,z:0};case"front-left":return{x:-(e-n),z:-Si};case"front-right":return{x:e-n,z:-Si};case"behind-left":return{x:-(e-n),z:Si};case"behind-right":return{x:e-n,z:Si}}}function ag(s,e,t,n,i,r,a){const o=Nu();o.scale.setScalar(n),o.rotation.y=sg[e];const{x:c,z:l}=Pu(e,i,r,a);o.position.set(c,t,l),s.add(o)}const Iu=6,Lu=6,hs=3,da=1.4,fa=hs*.5,og=1.2,cg=.35,HS=.75,GS=1.6;function Hf(s,e,t,n){const i=new en,r=Math.max(1,s+1),a=r*hs;zt(i,new Yn(Iu,a,Lu),[.55,.54,.5],a/2);const o=Iu/2,c=Lu/2;for(let l=0;l<r;l++){const h=l*hs+hs/2;yi(i,da,fa,_i,0,h,-c-xi,Mn(e,"front")),yi(i,da,fa,_i,0,h,c+xi,Mn(e,"behind")),yi(i,_i,fa,da,-o-xi,h,0,Mn(e,"left")),yi(i,_i,fa,da,o+xi,h,0,Mn(e,"right"))}if(t){const l=Math.min(Math.max(n??0,0),r-1);ag(i,t,l*hs,.72,o,c,og);const h=u=>Mn(e,u)!==void 0?[{main:da,center:0}]:[];rg(i,o,c,l*hs,(l+1)*hs,fa,h("front"),h("behind"),h("left"),h("right"))}return i}function Gf(){const s=new en;return zt(s,new $i(.15,.22,2,8),[.32,.22,.14],1),zt(s,new qa(1.4,3,8),[.16,.32,.14],3.5),s}const Vf=.275,VS=.35,WS=.9,XS=34,qS=8,YS=1.4;function Wf(){const s=new en,e=new an(Vf,7,3,0,Math.PI*2,0,Math.PI/2);e.scale(1,VS/Vf,1);const t=sn.repeatOnGrid(e,XS,WS,qS,YS),n=zt(s,t,[.26,.28,.22],0);return n.castShadow=!1,n.userData.cropBasePositions=t.getAttribute("position").array.slice(),n.userData.cropVerticesPerClump=e.getAttribute("position").count,e.dispose(),s}function Xf(){const s=new en,e=new an(1,7,3,0,Math.PI*2,0,Math.PI/2);return zt(s,e,[.38,.36,.32],0),s}function qf(s){const e=new en;return zt(e,new $i(.05,.08,5,8),[.28,.28,.3],2.5),zt(e,new an(.25,12,8),s?tg:eg,5.1,!0),e}const KS=[.08,.08,.08],cs=.8,wr=1,mi=1.7,Wl=.6,As=.4,qo=1.2,yr=.7,Si=.5,$S=mi;function Yf(s,e,t){const n=new en;zt(n,new Yn(1.8,1.4,4.2),[.45,.14,.14],.7),zt(n,new Yn(cs*2,Wl,wr*2),[.4,.12,.12],mi);for(const r of[-1.4,1.4])for(const a of[-.95,.95]){const o=zt(n,new $i(.4,.4,.3,12),KS,.4);o.rotation.z=Math.PI/2,o.position.x=a,o.position.z=r}const i=s?ig:ng;for(const r of[-.7,.7])zt(n,new an(.15,8,6),i,.7,!0).position.set(r,.7,-2.1);if(yi(n,qo,As,_i,0,mi,-wr-xi,Mn(e,"front")),yi(n,qo,As,_i,0,mi,wr+xi,Mn(e,"behind")),yi(n,_i,As,yr,-cs-xi,mi,-Si,Mn(e,"front-left")),yi(n,_i,As,yr,-cs-xi,mi,Si,Mn(e,"behind-left")),yi(n,_i,As,yr,cs+xi,mi,-Si,Mn(e,"front-right")),yi(n,_i,As,yr,cs+xi,mi,Si,Mn(e,"behind-right")),t){ag(n,t,HS,.5,cs,wr,cg);const r=(c,l)=>{const h=[];return Mn(e,c)!==void 0&&h.push({main:yr,center:-Si}),Mn(e,l)!==void 0&&h.push({main:yr,center:Si}),h},a=Mn(e,"front")!==void 0?[{main:qo,center:0}]:[],o=Mn(e,"behind")!==void 0?[{main:qo,center:0}]:[];rg(n,cs,wr,mi-Wl/2,mi+Wl/2,As,a,o,r("front-left","behind-left"),r("front-right","behind-right"))}return n}const Kf=new Map;function $f(s,e){if(!s)return;const t=[[s.lengthM,e.lengthM],[s.heightM,e.heightM],[s.widthM,e.widthM]];for(const[n,i]of t)if(n!==void 0&&i>1e-6)return n/i}function Xl(s,e){return e>1e-6?s/e:1}const lg=[.95,.9,.82],Jf=[.72,.74,.78];function Zf(){const s=new en;zt(s,new $i(.25,.3,1.5,10),Jf,.75),zt(s,new an(.26,10,8),Jf,1.74);const e=zt(s,new qa(.07,.16,8),lg,1.74);return e.rotation.x=-Math.PI/2,e.position.z=-.22,s}function Nu(){const s=new en;zt(s,new $i(.25,.3,1.5,10),[.3,.3,.35],.75),zt(s,new an(.22,10,8),[.62,.52,.46],1.72);const e=zt(s,new qa(.07,.16,8),lg,1.72);return e.rotation.x=-Math.PI/2,e.position.z=-.2,s}const JS=17,jf=18.5,ql=[.16,.16,.18];function Qf(){const s=new en,e=zt(s,new $i(1.8,1.8,jf*2,10),ql,0);e.rotation.x=Math.PI/2,zt(s,new Yn(JS*2,.5,4.5),ql,0);const t=zt(s,new Yn(.4,5.5,4),ql,3);return t.position.z=-jf+2,s}class sn{static groundUnderFootprint(e,t,n,i,r,a=0){const o=sn.sizeOf(e);if(a>o.heightM)return r(t,n);const c=(i??0)*Math.PI/180,l=Math.min(21,Math.max(2,Math.ceil(o.lengthM/.75)+1)),h=Math.min(21,Math.max(2,Math.ceil(o.widthM/.75)+1));let u=-1/0;for(let d=0;d<l;d++){const f=(d/(l-1)-.5)*o.lengthM;for(let p=0;p<h;p++){const v=(p/(h-1)-.5)*o.widthM,m=t+Math.sin(c)*f+Math.cos(c)*v,g=n-Math.cos(c)*f+Math.sin(c)*v;u=Math.max(u,r(m,g))}}return Number.isFinite(u)?u:r(t,n)}static occupantView(e){const t=e.witnessSide;if(!t)throw new Error("occupantView requires object.witnessSide to be set");const{x:n,z:i}=e.kind==="vehicle"?Pu(t,cs,wr,cg):Pu(t,Iu/2,Lu/2,og),r=e.kind==="vehicle"?$S:(e.occupiedFloor??0)*hs+GS,a=(e.headingDeg??0)-sg[t]/Gl,o=this.scaleFor(e);return{x:n*o.x,z:i*o.z,eyeY:r*o.y,headingDeg:a}}static BODY_NAME="decor-body";static bodyOf(e){return e.getObjectByName(sn.BODY_NAME)??e}static repeatOnGrid(e,t,n,i,r){const a=e.getAttribute("position"),o=e.getAttribute("normal"),c=e.getIndex();if(!c)throw new Error("repeatOnGrid needs an indexed geometry");const l=a.count,h=t*i,u=new Float32Array(l*h*3),d=new Float32Array(l*h*3),f=new Uint32Array(c.count*h),p=-((t-1)*n)/2,v=-((i-1)*r)/2;let m=0;for(let b=0;b<i;b++)for(let w=0;w<t;w++,m++){const _=v+b*r,S=p+w*n;for(let E=0;E<l;E++){const R=(m*l+E)*3;u[R]=a.getX(E)+_,u[R+1]=a.getY(E),u[R+2]=a.getZ(E)+S,d[R]=o.getX(E),d[R+1]=o.getY(E),d[R+2]=o.getZ(E)}for(let E=0;E<c.count;E++)f[m*c.count+E]=c.getX(E)+m*l}const g=new Mt;return g.setAttribute("position",new Et(u,3)),g.setAttribute("normal",new Et(d,3)),g.setIndex(new ju(f,1)),g}static fitCropToGround(e,t){e.updateMatrixWorld(!0);const n=new C;e.traverse(i=>{const r=i,a=r.userData.cropBasePositions,o=r.userData.cropVerticesPerClump;if(!r.isMesh||!a||!o)return;const c=r.geometry.getAttribute("position"),l=new Xe().copy(r.matrixWorld).invert();for(let h=0;h<c.count;h+=o){n.set(a[h*3],0,a[h*3+2]).applyMatrix4(r.matrixWorld),n.y=t(n.x,n.z),n.applyMatrix4(l);for(let u=h;u<h+o;u++)c.setY(u,a[u*3+1]+n.y)}c.needsUpdate=!0,r.geometry.computeBoundingBox(),r.geometry.computeBoundingSphere()})}static paint(e,t){e.traverse(n=>{const i=n,r=i.userData;if(!i.isMesh||r?.emissive)return;const a=i.material;a?.color&&a.color.set(t)})}static build(e,t){const n=e.kind==="building"?Hf(e.floors??Xd,e.windows,e.witnessSide,e.occupiedFloor):e.kind==="tree"?Gf():e.kind==="crop"?Wf():e.kind==="mound"?Xf():e.kind==="streetlight"?qf(t):e.kind==="vehicle"?Yf(t,e.windows,e.witnessSide):e.kind==="aircraft"?Qf():e.kind==="entity"?Zf():Nu();e.color&&this.paint(n,e.color);const i=this.scaleFor(e),r=new en;return n.name=sn.BODY_NAME,n.scale.copy(i),r.add(n),e.headingDeg!==void 0&&(r.rotation.y=-e.headingDeg*Gl),this.addLights(r,e.lights),e.kind==="aircraft"&&this.exemptFromFog(r),r}static scaleFor(e){const t=e.sizeM;if(!t)return new C(1,1,1);const n=this.naturalSize(e.kind,e.floors);return new C(t.widthM===void 0?1:Xl(t.widthM,n.widthM),t.heightM===void 0?1:Xl(t.heightM,n.heightM),t.lengthM===void 0?1:Xl(t.lengthM,n.lengthM))}static naturalSize(e,t){const n=e==="building"?Math.max(1,(t??Xd)+1):0,i=`${e}:${n}`,r=Kf.get(i);if(r)return r;const a=e==="building"?Hf(n-1,void 0,void 0,void 0):e==="tree"?Gf():e==="crop"?Wf():e==="mound"?Xf():e==="streetlight"?qf(!1):e==="vehicle"?Yf(!1,void 0,void 0):e==="aircraft"?Qf():e==="entity"?Zf():Nu(),o=new ai().setFromObject(a),c={widthM:o.max.x-o.min.x,heightM:o.max.y-o.min.y,lengthM:o.max.z-o.min.z};return this.dispose(a),Kf.set(i,c),c}static usesModel(e){return e.model!==void 0&&!(e.witnessSide!==void 0&&Fp(e.kind))}static applyModel(e,t,n,i={}){const r=this.bodyOf(e),a=new en;a.name=sn.BODY_NAME,n.rotation.y=-(i.headingOffsetDeg??0)*Gl,n.updateMatrixWorld(!0);const o=new ai().setFromObject(n),c={lengthM:o.max.z-o.min.z,heightM:o.max.y-o.min.y,widthM:o.max.x-o.min.x},l=$f(t.sizeM,c)??$f(i.depictedSizeM,c)??1;n.scale.multiplyScalar(l);const h=o.getCenter(new C).multiplyScalar(l);n.position.x-=h.x,n.position.z-=h.z,n.position.y-=t.kind==="aircraft"?h.y:o.min.y*l,n.traverse(u=>{u instanceof Ge&&(u.castShadow=!0,u.receiveShadow=!0)}),a.add(n),r.parent?(r.parent.add(a),r.removeFromParent()):e.add(a),this.dispose(r)}static sizeOf(e){const t=this.naturalSize(e.kind,e.floors);return{widthM:e.sizeM?.widthM??t.widthM,lengthM:e.sizeM?.lengthM??t.lengthM,heightM:e.sizeM?.heightM??t.heightM}}static exemptFromFog(e){e.traverse(t=>{if(!(t instanceof Ge))return;const n=t.material;n.fog=!1,n.needsUpdate=!0})}static addLights(e,t){for(const n of t??[]){const i=kS(n.color),r=zt(e,new an(zf,8,6),i,n.offsetM.y,!0);r.position.set(n.offsetM.x,n.offsetM.y,n.offsetM.z),r.userData={emissive:!0,lightId:n.id,lightColor:i},r.visible=!1}}static setLights(e,t,n,i,r=0){if(!t||t.length===0)return;const a=new Map(t.map(c=>[c.id,c])),o=Math.max(1,i*US/zf);for(const c of e.children){if(!(c instanceof Ge))continue;const l=c.userData.lightId;if(!l)continue;const h=a.get(l);if(!h)continue;const u=r>0?kp(h,n,n+r):r1(h,n)?1:0;c.visible=u>0;const d=c.material,f=c.userData.lightColor;if(f){const p=r>0?u*FS*(h.intensity??1):u;d.color.setRGB(f[0]*p,f[1]*p,f[2]*p)}c.scale.setScalar(o)}}static setLit(e,t,n){const i=t==="streetlight"?n?tg:eg:n?ig:ng;e.traverse(r=>{const a=r.userData;!(r instanceof Ge)||!a.emissive||a.lightId||r.material.color.setRGB(...i)})}static dispose(e){e.traverse(t=>{if(!(t instanceof Ge))return;t.geometry.dispose();const n=t.material;for(const i of Array.isArray(n)?n:[n])i.dispose()})}}const Yl="https://ufoathome.org/models/index.json";class ZS{attribution="3D models re-hosted by UFO@home, each under its own author's licence";fetchImpl;indexUrls;loading;constructor(e={}){this.fetchImpl=e.fetchImpl??fetch.bind(globalThis),this.indexUrls=e.indexUrls??jS()}async entries(e){const t=await this.load();return e?t.filter(n=>n.kind===e):t}async entry(e){return(await this.load()).find(t=>t.id===e)}load(){return this.loading??=this.fetchFirstAvailable(),this.loading}async fetchFirstAvailable(){for(const e of this.indexUrls){const t=await this.fetchIndex(e);if(t)return t}return[]}async fetchIndex(e){try{const t=await this.fetchImpl(e);if(!t.ok)return;const n=await t.json();return Array.isArray(n?.models)?n.models.map(({file:i,...r})=>({...r,url:new URL(i,e).href})):void 0}catch{return}}}function jS(){const s=typeof location>"u"?void 0:new URL("/models/index.json",location.href).href;return s&&s!==Yl?[s,Yl]:[Yl]}const QS=[{id:"ufoathome",name:"UFO@home",credit:"3D models re-hosted by UFO@home, each under its own author's licence",creditUrl:"https://ufoathome.org/models/",create:()=>new ZS}];async function eb(s){const{GLTFLoader:e}=await lc(async()=>{const{GLTFLoader:n}=await import("./GLTFLoader-BumifFuq.js");return{GLTFLoader:n}},[],import.meta.url),t=new e;return new Promise((n,i)=>{t.load(s,r=>n(r.scene),void 0,r=>i(new Error(`Could not load 3D model ${s}: ${r instanceof Error?r.message:String(r)}`)))})}const hg=2,tb=5,nb=2048;class jn{constructor(e){this.scene=e}cloudLayers=[];cloudSignature="";setCloudLayers(e){const t=e.map(n=>n.mesh.uuid).join(",");if(t!==this.cloudSignature){this.cloudSignature=t,this.cloudLayers=e;for(const n of this.meshes.values())this.configureCloudMaterial(n.material)}}configureCloudMaterial(e){const t=this.cloudLayers,n=this.cloudSignature;e.customProgramCacheKey=()=>n,e.onBeforeCompile=i=>{if(!t.length)return;i.vertexShader=`varying vec3 cloudPoint;
6003
6003
  `+i.vertexShader,i.vertexShader=i.vertexShader.replace("#include <project_vertex>",`#include <project_vertex>
6004
6004
  cloudPoint = (modelMatrix * vec4(transformed, 1.0)).xyz - cameraPosition;`);let r=`varying vec3 cloudPoint;
6005
6005
  `,a="";t.forEach((o,c)=>{const l=`cloud${c}_`;for(const[h,u]of Object.entries(o.uniforms))i.uniforms[l+h]=u;r+=Hy(l),a+=`diffuseColor.a *= ${l}transmissionAt(normalize(cloudPoint), length(cloudPoint));
6006
- `}),i.fragmentShader=r+i.fragmentShader,i.fragmentShader=i.fragmentShader.replace("#include <opaque_fragment>",a+"#include <opaque_fragment>")},e.needsUpdate=!0}meshes=new Map;signatures=new Map;extents=new Map;placed=[];frame;direction=new C;up=new C;lookAt=new Xe;vertex=new C;centre=new C;right=new C;above=new C;set(e,t){this.placed=e,this.frame=t;const n=new Set(e.map(i=>i.sourceId));for(const[i,r]of this.meshes)n.has(i)||(this.dispose(r),this.meshes.delete(i),this.signatures.delete(i),this.extents.delete(i));for(const i of e){let r=this.meshes.get(i.sourceId);r||(r=new Ge(new Di(1,1,jn.SEGMENTS,jn.SEGMENTS),new qn({transparent:!0,depthWrite:!1,depthTest:!0,fog:!1,toneMapped:!1})),this.configureCloudMaterial(r.material),r.frustumCulled=!1,r.layers.set(hg),this.scene.add(r),this.meshes.set(i.sourceId,r)),r.renderOrder=tb+i.renderOrder,r.visible=!i.hidden&&i.shape.transparency<1,r.visible&&this.paint(r,i,t)}}place(e,t,n){const i=this.frame;if(i)for(const r of this.placed){const a=this.meshes.get(r.sourceId);if(!a||!a.visible)continue;const o=this.extents.get(r.sourceId);if(!o)continue;const{bounds:c}=r.shape;let l=c.x+c.width/2,h=c.y+c.height/2,u=!0;if(r.aim){const d=n(jn.directionOf(r.aim,this.direction));d&&Math.abs(d.ndcX)<jn.FURTHEST_NDC&&Math.abs(d.ndcY)<jn.FURTHEST_NDC?(l=(d.ndcX+1)/2*i.canvasWidthPx,h=(1-d.ndcY)/2*i.canvasHeightPx):u=!1}u?this.curve(a,e,t,i,o,l,h,r.distanceM):this.flat(a,e,i,o,r.distanceM)}}static FURTHEST_NDC=4;curve(e,t,n,i,r,a,o,c){const l=a-r.width/2,h=o-r.height/2,u=e.geometry.attributes.position,d=jn.SEGMENTS;let f=0;for(let p=0;p<=d;p++){const v=h+p/d*r.height;for(let m=0;m<=d;m++){const g=l+m/d*r.width;n(g/i.canvasWidthPx*2-1,-(v/i.canvasHeightPx*2-1),this.direction),this.vertex.copy(t.position).addScaledVector(this.direction,c),u.setXYZ(f++,this.vertex.x,this.vertex.y,this.vertex.z)}}u.needsUpdate=!0,e.matrixAutoUpdate=!1,e.matrix.identity(),e.matrixWorldNeedsUpdate=!0,e.scale.set(mt.sizeMAt(c,i.projection.pxToDeg(r.width)),mt.sizeMAt(c,i.projection.pxToDeg(r.height)),1)}flat(e,t,n,i,r){const a=e.geometry.attributes.position,o=jn.SEGMENTS,c=mt.sizeMAt(r,n.projection.pxToDeg(i.width)),l=mt.sizeMAt(r,n.projection.pxToDeg(i.height));this.up.set(0,1,0).applyQuaternion(t.quaternion),this.centre.copy(t.position).addScaledVector(this.direction,r),this.lookAt.lookAt(t.position,this.centre,this.up),this.right.setFromMatrixColumn(this.lookAt,0),this.above.setFromMatrixColumn(this.lookAt,1);let h=0;for(let u=0;u<=o;u++){const d=.5-u/o;for(let f=0;f<=o;f++){const p=f/o-.5;this.vertex.copy(this.centre).addScaledVector(this.right,p*c).addScaledVector(this.above,d*l),a.setXYZ(h++,this.vertex.x,this.vertex.y,this.vertex.z)}}a.needsUpdate=!0,e.matrixAutoUpdate=!1,e.matrix.identity(),e.matrixWorldNeedsUpdate=!0,e.scale.set(c,l,1)}static SEGMENTS=16;static directionOf(e,t){const n=e.azimuthDeg*Math.PI/180,i=e.altitudeDeg*Math.PI/180;return t.set(Math.sin(n)*Math.cos(i),Math.sin(i),-Math.cos(n)*Math.cos(i))}get any(){for(const e of this.meshes.values())if(e.visible)return!0;return!1}get furthestM(){return this.placed.reduce((e,t)=>Math.max(e,t.distanceM),0)}paint(e,t,n){const{shape:i}=t,r=Fa.paintExtent(i);this.extents.set(t.sourceId,r);const a=jn.signatureOf(i,n);if(this.signatures.get(t.sourceId)===a&&e.material.map)return;this.signatures.set(t.sourceId,a);const o=Math.min(n.scale,nb/Math.max(r.width,r.height,1)),c=Math.max(1,Math.ceil(r.width*o)),l=Math.max(1,Math.ceil(r.height*o)),h=e.material.map,u=h?.image??document.createElement("canvas"),d=u.width!==c||u.height!==l;d&&(u.width=c,u.height=l);const f=u.getContext("2d");if(!f)return;f.clearRect(0,0,c,l);const p=new Fa(f);if(p.setStarPoints(n.starPoints),p.setRoll(n.rollRad),p.paintInto(i,r,o),h&&!d){h.needsUpdate=!0;return}h?.dispose();const v=new Ri(u);v.colorSpace=An,v.minFilter=gt,v.generateMipmaps=!1,e.material.map=v,e.material.needsUpdate=!0}static signatureOf(e,t){const{bounds:n}=e;return JSON.stringify([e.kind,Math.round(n.width*10),Math.round(n.height*10),e.color,e.angle,e.transparency,e.haloScale,e.blur??0,e.brightness??0,e.kind==="polygon"?e.points:void 0,t.scale,t.starPoints,t.rollRad])}dispose(e){e.removeFromParent(),e.geometry.dispose(),e.material.map?.dispose(),e.material.dispose()}clear(){for(const e of this.meshes.values())this.dispose(e);this.meshes.clear(),this.signatures.clear(),this.extents.clear(),this.placed=[]}}const ug=3,Yo=800,pa=Math.PI/180;class Ns{constructor(e,t,n=Ns.fetchImage){this.scene=e,this.onImageLoaded=t,this.loadImage=n}meshes=new Map;signatures=new Map;images=new Map;loading=new Map;failed=new Set;references=[];views=new Map;shown=!0;set(e,t=this.views){this.references=e,this.views=t;const n=new Set(e.map(i=>i.id));for(const[i,r]of this.meshes)n.has(i)||(this.dispose(r),this.meshes.delete(i),this.signatures.delete(i));for(const[i,r]of this.images){const a=e.find(o=>o.id===i);a&&a.src===r.texture.userData.src||(r.texture.dispose(),this.images.delete(i))}for(const i of e){const r=this.images.get(i.id);if(!r){this.load(i);continue}this.build(i,r)}}setShown(e){this.shown=e;for(const t of this.meshes.values())t.visible=e&&this.opacityOf(t.userData.id)>0}setView(e,t){this.views.set(e,t);const n=this.meshes.get(e);n&&this.applyOpacity(n,e)}get any(){for(const e of this.meshes.values())if(e.visible)return!0;return!1}place(e){for(const t of this.meshes.values())t.visible&&(t.position.copy(e.position),t.updateMatrixWorld())}get furthestM(){return this.meshes.size>0?Yo:0}directionOfPixel(e,t,n,i){const r=this.images.get(e.id),a=r?r.width/r.height:1,o=Math.tan(e.registration.fovDeg/2*pa),c=o*a;return i.set((t*2-1)*c,(1-n*2)*o,-1).normalize(),i.applyQuaternion(Ns.orientation(e))}aspectOf(e){const t=this.images.get(e);return t?t.width/t.height:void 0}failedToLoad(e){return this.failed.has(e)}load(e){const t=e.src;if(this.loading.has(e.id)||this.failed.has(t))return;const n=this.loadImage(t).then(i=>{this.loading.delete(e.id);const r=this.references.find(a=>a.id===e.id);if(!r||r.src!==t){i.texture.dispose();return}i.texture.userData.src=t,this.images.set(e.id,i),this.build(r,i),this.onImageLoaded()},()=>{this.loading.delete(e.id),this.failed.add(t)});this.loading.set(e.id,n)}static async fetchImage(e){const t=await fetch(e);if(!t.ok)throw new Error(`${e}: ${t.status}`);const n=await createImageBitmap(await t.blob(),{imageOrientation:"flipY"}),i=new nn(n);return i.flipY=!1,i.colorSpace=An,i.minFilter=gt,i.magFilter=gt,i.generateMipmaps=!1,i.needsUpdate=!0,{texture:i,width:n.width,height:n.height}}build(e,t){const n=Ns.signatureOf(e,t);let i=this.meshes.get(e.id);if(i&&this.signatures.get(e.id)===n){this.applyOpacity(i,e.id);return}i&&(this.dispose(i),this.meshes.delete(e.id)),i=new Ge(Ns.geometryOf(e,t),new qn({map:t.texture,transparent:!0,depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1})),e.kind==="panorama"&&(i.material.side=Nt),i.frustumCulled=!1,i.layers.set(ug),i.userData.id=e.id,i.quaternion.copy(Ns.orientation(e)),this.scene.add(i),this.meshes.set(e.id,i),this.signatures.set(e.id,n),this.applyOpacity(i,e.id)}static geometryOf(e,t){if(e.kind==="panorama"){const a=new an(Yo,64,32,Math.PI/2,Math.PI*2),o=a.attributes.uv;for(let c=0;c<o.count;c++)o.setX(c,1-o.getX(c));return o.needsUpdate=!0,a}const n=2*Yo*Math.tan(e.registration.fovDeg/2*pa),i=n*(t.width/Math.max(t.height,1)),r=new Di(i,n);return r.translate(0,0,-Yo),r}static orientation(e){const{headingDeg:t,pitchDeg:n,rollDeg:i}=e.registration,r=new xt;return r.rotation.set(n*pa,-t*pa,-(i??0)*pa,"YXZ"),r.quaternion}opacityOf(e){const t=this.references.find(i=>i.id===e);return this.views.get(e)?.opacity??t?.opacity??0}applyOpacity(e,t){const n=this.opacityOf(t);e.material.opacity=n,e.visible=this.shown&&n>0}static signatureOf(e,t){const{headingDeg:n,pitchDeg:i,rollDeg:r,fovDeg:a}=e.registration;return[e.kind,e.src,t.width,t.height,n,i,r??0,a].join("|")}dispose(e){this.scene.remove(e),e.geometry.dispose(),e.material.dispose()}disposeAll(){for(const e of this.meshes.values())this.dispose(e);this.meshes.clear(),this.signatures.clear();for(const e of this.images.values())e.texture.dispose();this.images.clear()}}function ib(s,e){return JSON.stringify(s.cloudLayers)===JSON.stringify(e.cloudLayers)&&s.cloudCover===e.cloudCover&&s.cloudDarkness===e.cloudDarkness&&s.cloudBaseM===e.cloudBaseM&&s.highCloudCover===e.highCloudCover&&s.iceCrystalAlignment===e.iceCrystalAlignment&&s.lowerCloudCover===e.lowerCloudCover&&s.precipitationType===e.precipitationType&&s.precipitationIntensity===e.precipitationIntensity&&s.windDirectionDeg===e.windDirectionDeg&&s.windSpeed===e.windSpeed&&s.storm===e.storm}const Ko=900,Kl=1,ep=.5,wa=900,sb=6371e3,rb=3e4;function tp(s){const e=Math.sqrt(2*sb*Math.max(s,0));return Math.max(wa,Math.min(e,rb))}const $l=.5,Jl=850,np=.03,Sr=850,Zl=4,jl=1.5,ip=-1,ab=6,Ou=-4,sp=.2,$o=2600,ob=.97,cb=.38,rp=Ou,lb=3,hb=.15,ub=.6,db=40,fb=30,pb=[0,45,90,135,180,225,270,315],mb={en:["N","NE","E","SE","S","SW","W","NW"],fr:["N","NE","E","SE","S","SO","O","NO"]},gb=["en","fr"],ap=880,Jo=40,op=60,vb=10,Mb=1,xb=150,_b=55,yb=.5,Sb=2.05,cp=.265,lp=[[0,0],...Array.from({length:8},(s,e)=>{const t=e*Math.PI/4;return[Math.cos(t)*cp,Math.sin(t)*cp]})],Ql=700,eh=250/1e3,bb=12,hp=5,th=6,Ts=[.92,.92,.95],nh=[.15,.15,.19],up={snow:{fallSpeedMPerS:2,size:.3,color:new oe(1,1,1),driftSensitivity:1,radiusM:25,topYM:20,opacity:.75,poolSize:2400},hail:{fallSpeedMPerS:14,size:.5,color:new oe(.95,.98,1),driftSensitivity:.25,radiusM:25,topYM:10,opacity:.95,poolSize:1200}},Er=0,ih=0,wb=150,dp=3e3,ma=20,Eb=15,fp=Er,Ab=40,pp=1,Tb=9;function mp(s){return pp+(Tb-pp)*s}const Rb=new oe(.75,.82,.92),Db=10,Cb=.5;function Pb(s){return Pa(s/Db,Cb,1)}const br=200,gp=.18,vp=.32,Ib=.35,Lb=new oe(.85,.9,.98),Mp=5,xp=.85,_p=.01;function sh(s,e){return Math.round(s*(_p+(1-_p)*e))}const yp=230,Sp=.7,bp=.05,Nb=.6,Ob=.7,Ub=.15,wp=.35,Fb=3,kb=1/12,zb=.5,pi=new oe(.82,.86,1),Bb=2500,Hb=1.6,Gb=1.2,Vb=2.2,Wb={Venus:new oe(1,.96,.85),Mars:new oe(1,.55,.4),Jupiter:new oe(.95,.87,.72),Saturn:new oe(.92,.86,.68)};class Hn{renderer;scene=new Va;phenomena=new jn(this.scene);references=new Ns(this.scene,()=>this.render());camera;celestialGroup=new en;skyMesh;groundMesh;terrainMesh;terrainProviders;terrainOrigin;terrainBuildToken=0;terrainAttribution;decorModelProvider=Q5[0].create();decorModelToken=0;decorModelCredits=new Map;starTiers=[];bodyMeshes=new Map;hitAreas=new Map;glareSprites=new Map;decorObjects=[];decorGroups=new Map;decorReferencePose;decorCurrentPose;decorTime=0;celestialLight=new Y0(16777215,0);celestialLightTarget=new xt;skyLight=new yv(16777215,0,0);streetlightLights=new Map;compassSprites=[];showCompass=!1;compassHovered=!1;compassForced=!1;animationFrameId=null;resolution;cssSize={width:1,height:1};frameDirty=!1;flushFrameId=null;framesDriven=!1;lastFrameTimeMs;raycaster=new Dl;weather=Lp;observerElevationM=0;groundRadius=wa;terrainRadius=wa;cloudRendering="volume";layeredClouds;cloudLayerOffsetsM={};cloudOffsetM=new C;cloudFieldOffset=new C;cloudMesh;cirrusMesh;cirrusMaterial;cirrusUniforms;cloudMaterial;cloudUniforms;precipitationPoints;precipitationPositions;precipitationPhase;precipitationSpeedJitter;precipitationWobbleFreqJitter;precipitationWobbleAmpJitter;precipitationBounceRemaining;precipitationBounceHeight;precipitationBounceDuration;precipitationBounceVelX;precipitationBounceVelZ;precipitationUniforms;rainSystem;rainSplashSystem;rainCameraDirection=new C;rainLastVerticalFacing=-1;rainViewportSize=new Pe;lightningArmed=!1;lightningFlashes=[];lightningLevel=0;lightningBolt;lightningLight=new Y0(16777215,0);baseFogColor=[0,0,0];lastSunPosition;lensFlare;sunCloudTransmission=1;sunUnhiddenFraction=1;lensFlareArtifactIntensity=0;sunWorldPosition=new C;sunVisible=!1;lensFlareScratch=new C;sunOcclusionRaycaster=new Dl;sunOcclusionDirectionScratch=new C;sunOcclusionRightScratch=new C;sunOcclusionUpScratch=new C;ufoOcclusionRaycaster=new Dl;projectionKind="rectilinear";starPoints=0;namedStars=[];equidistantPass;depthOfFieldPass;exposureAccumulation;exposureInstants=1;get developingExposure(){return this.exposureInstants>1&&this.exposureInstantAt!==void 0}static EXPOSURE_BUDGET_MS=12;static exposureInstantsPerFrame(e){return Math.max(3,Math.round(6e6/Math.max(1,e)))}exposureFrameId=null;exposureInstantsDone=0;exposureInstantAt;restatingExposure=!1;lensOptics;instrumentMagnitudeGain=0;meteorSystem;cometTail;satelliteField;iceHalos;rainbow;skyGlow;cometKey;novaKeys=new Set;constructor(e,t=y1()){this.renderer=new Iy({canvas:e,antialias:!0}),this.resolution=new yt(Math.min(window.devicePixelRatio||1,2),this.renderer.getContext()),this.renderer.setPixelRatio(this.resolution.pixelRatio),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=Ea,this.camera=new Tn(60,e.width/Math.max(e.height,1),.1,Ko*1.2),this.camera.position.set(0,1.6,0),this.terrainProviders=t,this.celestialLight.shadow.mapSize.set(1024,1024),this.celestialLight.shadow.camera.left=-120,this.celestialLight.shadow.camera.right=120,this.celestialLight.shadow.camera.top=120,this.celestialLight.shadow.camera.bottom=-120,this.celestialLight.shadow.camera.near=1,this.celestialLight.shadow.camera.far=1e3,this.celestialLight.shadow.bias=-.0015,this.celestialLight.target=this.celestialLightTarget,this.lightningLight.color.copy(pi),this.scene.add(this.celestialLight,this.celestialLightTarget,this.skyLight,this.lightningLight),this.scene.add(this.celestialGroup)}get currentTerrainAttribution(){return this.terrainAttribution}resize(e,t){this.cssSize.width=e,this.cssSize.height=t,this.renderer.setSize(e,t,!1),this.camera.aspect=e/Math.max(t,1),this.camera.updateProjectionMatrix(),this.render()}setCloudRendering(e){e!==this.cloudRendering&&(this.cloudTransmissionMemo.clear(),this.cloudRendering=e,this.layeredClouds?.dispose(),this.layeredClouds=void 0,this.buildClouds(),this.buildCirrus(),this.render())}setCloudOffset(e,t={}){this.cloudOffsetM.set(e.x,0,e.z),this.cloudLayerOffsetsM=t,this.layeredClouds?.setOffsets(e,t),this.cloudFieldOffset.set(e.x*eh,0,e.z*eh);for(const n of[this.cloudUniforms,this.cirrusUniforms])n?.fieldOffset.value.copy(this.cloudFieldOffset);this.iceHalos?.setCloudOffset(this.layeredClouds?.cirrusMask?.offset??this.cloudFieldOffset)}setObserverPose(e){const t=((e.rollDeg??0)+this.gaitOffset.rollDeg)*Sn,n=(e.pitchDeg+this.lookPitchDeg+this.gaitOffset.pitchDeg)*Sn;if(e.headingDeg!==void 0?this.camera.rotation.set(n,-(e.headingDeg+this.lookYawDeg+this.gaitOffset.yawDeg)*Sn,t,"YXZ"):this.camera.rotation.set(n,this.camera.rotation.y,t,"YXZ"),e.elevationM!==this.observerElevationM&&(this.observerElevationM=e.elevationM,this.syncCloudLayer(),Math.abs(tp(e.elevationM)-this.groundRadius)>1&&(this.buildGround(),this.celestialGroup.scale.setScalar(this.groundRadius/wa),this.camera.far=Math.max(Ko*1.2,this.groundRadius*2.5),this.camera.updateProjectionMatrix())),this.terrainMesh&&this.terrainOrigin&&e.lat!==void 0&&e.lng!==void 0){const i=rn(this.terrainOrigin.lat,this.terrainOrigin.lng,e.lat,e.lng);this.terrainMesh.position.x=i.x,this.terrainMesh.position.z=i.z}this.poseCameraY=this.groundYUnder(0,0)+1.6+e.elevationM,this.camera.position.y=this.poseCameraY,this.celestialGroup.position.y=this.camera.position.y,this.camera.fov!==e.fovDeg&&(this.camera.fov=e.fovDeg,this.camera.updateProjectionMatrix(),this.updateCompassScale())}setTerrainProviders(e){this.terrainProviders=e,this.disposeMesh(this.terrainMesh),this.terrainMesh=void 0,this.terrainOrigin=void 0,this.terrainAttribution=void 0,this.applyGroundDepthWrite(),this.terrainBuildToken++}setTerrainOrigin(e,t,n){if(e===void 0||t===void 0)return;const i=this.groundRadius;if(this.terrainOrigin&&Math.abs(this.terrainRadius-i)<i*.1){const{x:c,z:l}=rn(e,t,this.terrainOrigin.lat,this.terrainOrigin.lng);if(Math.sqrt(c*c+l*l)<xb*(i/wa))return}const r=this.terrainOrigin,a=this.terrainRadius;this.terrainOrigin={lat:e,lng:t},this.terrainRadius=i;const o=++this.terrainBuildToken;_5(e,t,this.terrainProviders,i).then(({mesh:c,attribution:l})=>{if(o!==this.terrainBuildToken)return;const h=this.terrainMesh,u=r?rn(e,t,r.lat,r.lng):void 0;h&&u&&Math.hypot(u.x,u.z)<=a&&(c.position.y=h.position.y+this.groundYOfPatch(h,u.x,u.z)),this.disposeMesh(this.terrainMesh),c.renderOrder=Mb,this.terrainMesh=c,this.compileNextFrameOffThread(),this.terrainAttribution=l,this.scene.add(c),this.applyGroundDepthWrite(),this.decorCurrentPose&&(this.setObserverPose(this.decorCurrentPose),this.updateDecorAnchoring(this.decorReferencePose,this.decorCurrentPose,this.decorTime)),this.render(),n?.()}).catch(c=>{console.warn("Terrain build failed, keeping the flat ground fallback:",c),n?.()})}setShowCompass(e){this.showCompass!==e&&(this.showCompass=e,this.disposeCompassLabels(),e&&this.buildCompassLabels(),this.render())}applyLensFlareTint(e){if(!this.lensFlare)return;const t=_b*this.sunCloudTransmission;this.lensFlare.uniforms.uColorGain.value.setRGB(t*e[0],t*e[1],t*e[2]),this.applyDazzleStrength()}applyDazzleStrength(){if(!this.lensFlare)return;const e=this.lastSunPosition?.altitudeDeg??-90,t=hS(e)*this.sunCloudTransmission*this.sunUnhiddenFraction,n=os(e);this.lensFlare.uniforms.uDazzleColour.value.setRGB(n[0],n[1],n[2]),this.lensFlare.uniforms.uVeilStrength.value=Sb**2*Math.max(0,t)}setCompassHovered(e){this.compassHovered!==e&&(this.compassHovered=e,this.updateCompassVisibility())}setCompassForced(e){this.compassForced!==e&&(this.compassForced=e,this.updateCompassVisibility())}updateCompassVisibility(){const e=this.compassHovered||this.compassForced;if(this.compassSprites.some(t=>t.visible!==e)){for(const t of this.compassSprites)t.visible=e;this.developingExposure?this.exposureInstantsDone>0&&this.presentExposure():this.render()}}setWeather(e){this.cloudTransmissionMemo.clear(),!ib(this.weather,e)&&(this.weather=e,this.buildClouds(),this.buildCirrus(),this.buildPrecipitation(),this.lightningArmed=e.storm&&e.cloudDarkness>=zb,this.syncAnimationLoop(),this.render())}setDecor(e){if(this.decorObjects!==e){this.decorObjects=e,this.decorModelToken++,this.decorModelCredits.clear();for(const t of this.decorGroups.values())t.removeFromParent(),sn.dispose(t);this.decorGroups.clear(),this.streetlightLights.clear();for(const t of e){const n=sn.build(t,t.lit??!1);this.scene.add(n),this.decorGroups.set(t.id,n),t.kind==="streetlight"&&this.addStreetlightLight(t.id,n),this.loadDecorModel(t,this.decorModelToken)}this.celestialLight.castShadow=this.decorGroups.size>0}}setDecorModelProvider(e){this.decorModelProvider=e;const t=this.decorObjects;this.decorObjects=[],this.setDecor(t)}get currentDecorModelCredits(){return[...this.decorModelCredits.values()]}async loadDecorModel(e,t){const n=e.model;if(!(!n||!sn.usesModel(e)))try{const i=n.url?void 0:n.id?await this.decorModelProvider.entry(n.id):void 0,r=n.url??i?.url,a=n.credit??i?.credit;if(!r||!a)return;const o=await eb(r);if(t!==this.decorModelToken)return;const c=this.decorGroups.get(e.id);if(!c)return;sn.applyModel(c,e,o,{headingOffsetDeg:n.headingOffsetDeg??i?.headingOffsetDeg,depictedSizeM:i?.sizeM}),this.decorModelCredits.set(e.id,a),this.render()}catch(i){console.warn(`Keeping the built-in shape for decor "${e.id}":`,i)}}updateDecorAnchoring(e,t,n=0){this.decorReferencePose=e,this.decorCurrentPose=t,this.decorTime=n;const i=e?.lat!==void 0&&e.lng!==void 0&&t?.lat!==void 0&&t?.lng!==void 0?rn(e.lat,e.lng,t.lat,t.lng):{x:0,z:0},r=this.decorObjects.find(l=>l.witnessSide!==void 0&&Fp(l.kind));if(this.terrainMesh&&this.terrainOrigin&&t?.lat!==void 0&&t.lng!==void 0){const l=rn(this.terrainOrigin.lat,this.terrainOrigin.lng,t.lat,t.lng);this.terrainMesh.position.x=l.x-(r?0:this.gaitOffset.eastM),this.terrainMesh.position.z=l.z+(r?0:this.gaitOffset.northM)}r||(i.x-=this.gaitOffset.eastM,i.z+=this.gaitOffset.northM,this.camera.position.y=this.poseCameraY+this.gaitOffset.upM,this.celestialGroup.position.y=this.camera.position.y);const a={x:0,z:0};let o=0;if(r){const l=sn.occupantView(r),h=-(r.headingDeg??0)*Sn,u=l.x*Math.cos(h)+l.z*Math.sin(h),d=-l.x*Math.sin(h)+l.z*Math.cos(h),f=r.eastM+i.x,p=-r.northM+i.z;a.x=-(f+u),a.z=-(p+d),this.camera.position.y=this.groundYUnder(f,p)+l.eyeY,this.camera.rotation.set(this.indoorLookPitchDeg*Sn,-(l.headingDeg+this.indoorLookYawDeg)*Sn,0,"YXZ")}for(const l of this.decorObjects){const h=this.decorGroups.get(l.id);if(!h)continue;const u=Fu(l,n),d=u.eastM+i.x+a.x,f=-u.northM+i.z+a.z,p=this.terrainMesh,v=`${p?.geometry.uuid}:${(d-(p?.position.x??0)).toFixed(3)}:${(f-(p?.position.z??0)).toFixed(3)}:${(p?.position.y??0).toFixed(3)}:${u.headingDeg}:${u.altitudeM}`;if(h.userData.footprintKey!==v&&(h.userData.footprintGroundY=this.groundUnderFootprint(l,d,f,u.headingDeg,u.altitudeM),h.userData.footprintKey=v),h.position.set(d,h.userData.footprintGroundY+u.altitudeM,f),l.kind==="crop"){const m=Math.hypot(d,f);h.visible=m<=wb}if(u.headingDeg!==void 0&&(h.rotation.y=-u.headingDeg*Sn),l.kind==="crop"&&h.visible){const m=this.terrainMesh,g=[m?.geometry.uuid,d-(m?.position.x??0),f-(m?.position.z??0),h.position.y-(m?.position.y??0),u.headingDeg,u.altitudeM].map(b=>typeof b=="number"?b.toFixed(4):b).join(":");h.userData.cropGroundKey!==g&&(sn.fitCropToGround(h,(b,w)=>this.groundYUnder(b,w)+u.altitudeM),h.userData.cropGroundKey=g)}o=Math.max(o,h.position.distanceTo(this.camera.position))}const c=Math.max(Ko*1.2,this.groundRadius*2.5,o*1.2);Math.abs(this.camera.far-c)>1&&(this.camera.far=c,this.camera.updateProjectionMatrix())}groundYUnder(e,t){const n=this.terrainMesh;return n?n.position.y+this.groundYOfPatch(n,e-n.position.x,t-n.position.z):ih}groundYOfPatch(e,t,n){const i=e.geometry.getAttribute("position"),r=Math.round(Math.sqrt(i.count));if(r<2||r*r!==i.count)return ih;const a=i.getX(0),o=i.getX(r-1),c=i.getZ(0),l=i.getZ((r-1)*r),h=Pa((t-a)/(o-a)*(r-1),0,r-1),u=Pa((n-c)/(l-c)*(r-1),0,r-1);if(!Number.isFinite(h)||!Number.isFinite(u))return ih;const d=Math.min(Math.floor(h),r-2),f=Math.min(Math.floor(u),r-2),p=h-d,v=u-f,m=(S,E)=>i.getY(S*r+E),g=m(f,d),b=m(f,d+1),w=m(f+1,d),_=m(f+1,d+1);return p+v<=1?g+(b-g)*p+(w-g)*v:_+(w-_)*(1-p)+(b-_)*(1-v)}groundUnderFootprint(e,t,n,i,r=0){return sn.groundUnderFootprint(e,t,n,i,(a,o)=>this.groundYUnder(a,o),r)}lookYawDeg=0;lookPitchDeg=0;poseCameraY=1.6;setGait(e){this.gaitOffset=e}gaitOffset={eastM:0,northM:0,upM:0,rollDeg:0,pitchDeg:0,yawDeg:0};setLookOffset(e,t){this.lookYawDeg=e,this.lookPitchDeg=t}indoorLookYawDeg=0;indoorLookPitchDeg=0;setIndoorLook(e,t){this.indoorLookYawDeg=e,this.indoorLookPitchDeg=t}updateDecorLitState(e,t=0){for(const n of this.decorObjects){const i=this.decorGroups.get(n.id);if(i&&n.lights?.length&&sn.setLights(i,n.lights,e,i.position.distanceTo(this.camera.position),t),n.kind!=="streetlight"&&n.kind!=="vehicle")continue;const r=this.decorGroups.get(n.id);if(!r)continue;const a=s1(n,e);sn.setLit(r,n.kind,a);const o=this.streetlightLights.get(n.id);o&&(o.visible=a)}}addStreetlightLight(e,t){const n=sn.bodyOf(t),i=n.children.find(a=>a.userData.emissive);if(!i)return;const r=new wv(16764006,db,fb);r.position.copy(i.position).multiply(n.scale),r.castShadow=!0,r.shadow.mapSize.set(512,512),r.shadow.bias=-.002,t.add(r),this.streetlightLights.set(e,r)}setAstronomy(e){const t=uu(e.sun.altitudeDeg),n=t.horizon;this.baseFogColor=n,this.lastSunPosition=e.sun,this.buildSky(e.sun),this.buildGround(),this.updateCloudLighting(e.sun,n),this.updateCelestialLight(e,t.zenith,n);const i=du(e.sun.altitudeDeg,this.instrumentMagnitudeGain);this.buildStars(e.stars,i),this.setBodyMesh("sun",e.sun,Zl,new oe(1,.96,.88),e.sun.magnitude),this.setMoonMesh(e.moon,i),this.buildPlanets(e.planets,i),this.buildComet(e.comet,i),this.buildNovae(e.novae??[],i),this.buildIceHalos(e.sun,e.moon),this.buildRainbow(e.sun,e.moon),this.buildSkyGlow(e,t.zenith),this.scene.fog instanceof yc?(this.scene.fog.color.setRGB(...n),this.scene.fog.near=this.groundRadius*.2,this.scene.fog.far=this.groundRadius):this.scene.fog=new yc(new oe(...n),this.groundRadius*.2,this.groundRadius),this.syncAnimationLoop(),this.render()}setSatellites(e){if(e.length===0&&!this.satelliteField?.count)return;this.satelliteField||(this.satelliteField=new O5(Jl),this.celestialGroup.add(this.satelliteField.object));const t=du(this.lastSunPosition?.altitudeDeg??-90,this.instrumentMagnitudeGain);this.satelliteField.set(e,t,n=>this.cloudTransmission(n)),this.render()}pickSatelliteAt(e,t){if(!this.satelliteField?.count)return;this.aimAtScreenPoint(this.raycaster,e,t);const n=Math.cos(np*this.camera.fov*Math.PI/180),i=this.satelliteField.nearest(this.raycaster.ray.direction,n);return i&&this.groundHides(e,t)?void 0:i}updateCelestialLight(e,t,n){this.skyLight.color.setRGB(t[0],t[1],t[2]),this.skyLight.groundColor.setRGB(n[0],n[1],n[2]),this.skyLight.intensity=ub;const i=e.sun.altitudeDeg>=rp,r=!i&&e.moon.altitudeDeg>=rp;if(!i&&!r){this.celestialLight.intensity=0;return}const a=i?e.sun:e.moon,{x:o,y:c,z:l}=jt(a.altitudeDeg,a.azimuthDeg,Sr);this.celestialLight.position.set(o,c,l);const h=os(a.altitudeDeg);this.celestialLight.color.setRGB(h[0],h[1],h[2]);const u=Math.max(0,Math.sin(Math.max(a.altitudeDeg,0)*Sn));this.celestialLight.intensity=(i?lb:hb)*u,this.celestialLight.castShadow=this.decorGroups.size>0}setMeteorShower(e,t,n){this.meteorSystem||(this.meteorSystem=new Jt,this.celestialGroup.add(this.meteorSystem.object)),this.meteorSystem.setShower(e,t,n)}get meteorSchedule(){return this.meteorSystem?.schedule??[]}meteorMidpoint(e){return this.meteorSystem?.midpointOf(e)}updateMeteors(e){this.meteorSystem?.update(e)}setInstrument(e){this.projectionKind=e.projection;const t=Vt.starPointsOf(e),n=Vt.flareArtifactsOf(e);t===this.starPoints&&n===this.lensFlareArtifactIntensity||(this.starPoints=t,this.lensFlareArtifactIntensity=n,this.lensFlare&&(this.lensFlare.uniforms.uStarPoints.value=t,this.lensFlare.uniforms.uFlareIntensity.value=n),this.render())}setInstrumentGain(e){this.instrumentMagnitudeGain=Number.isFinite(e)?e:0}render(){this.restatingExposure||(this.frameDirty=!0,!(this.animationFrameId!==null||this.framesDriven||this.flushFrameId!==null)&&(this.flushFrameId=requestAnimationFrame(()=>{this.flushFrameId=null,this.drawIfDirty()})))}drawIfDirty(){if(!(!this.frameDirty||this.contextReleased)){if(this.compileBeforeNextDraw){this.compileBeforeNextDraw=!1;const e=this.compileOffThread().then(()=>{this.compiling===e&&(this.compiling=void 0,this.render())});this.compiling=e;return}if(!this.compiling){this.frameDirty=!1,this.resolution.beginDrawing();try{this.renderOnce()}finally{this.resolution.endDrawing()}this.developingExposure&&this.startExposure()}}}compileBeforeNextDraw=!1;compiling;static COMPILE_WAIT_MS=1500;compileOffThread(){const e=this.renderer.compile(this.scene,this.camera);if(!this.renderer.extensions.get("KHR_parallel_shader_compile"))return Promise.resolve();const t=this.renderer.properties,n=performance.now()+Hn.COMPILE_WAIT_MS;return new Promise(i=>{const r=()=>{if(this.contextReleased)return i();for(const a of e){const o=t.get(a)?.currentProgram;(!o||o.isReady())&&e.delete(a)}e.size===0||performance.now()>n?i():setTimeout(r,10)};r()})}compileNextFrameOffThread(){this.compileBeforeNextDraw=!0}contextReleased=!1;releaseContext(){this.contextReleased||(this.contextReleased=!0,this.stopTwinkle(),this.cancelFlush(),this.cancelExposure(),this.compiling=void 0,this.renderer.forceContextLoss())}restoreContext(){this.contextReleased&&(this.contextReleased=!1,this.renderer.forceContextRestore(),this.compileNextFrameOffThread(),this.syncAnimationLoop(),this.render())}cancelFlush(){this.flushFrameId!==null&&(cancelAnimationFrame(this.flushFrameId),this.flushFrameId=null)}frame(e){if(this.animationsRunning){const t=this.lastFrameTimeMs===void 0?0:e-this.lastFrameTimeMs;this.lastFrameTimeMs=e,this.hasAnimations()&&this.animate(e,t);const n=this.resolution.update(e,t);n!==void 0&&this.applyPixelRatio(n)}this.drawIfDirty()}animate(e,t){const n=Math.min(t/1e3,kb);this.updateTwinkle(e/1e3),this.updatePrecipitation(e/1e3,n),this.updateRain(n),this.lensFlare&&(this.lensFlare.uniforms.uTime.value=e/1e3),this.developingExposure||(this.frameDirty=!0)}setMaxPixelRatio(e){this.resolution.maximum=e,this.renderer.getPixelRatio()!==this.resolution.pixelRatio&&this.applyPixelRatio(this.resolution.pixelRatio)}applyPixelRatio(e){this.renderer.setPixelRatio(e),this.renderer.setSize(this.cssSize.width,this.cssSize.height,!1),this.frameDirty=!0}setExposure(e,t){const n=t?Math.max(1,Math.round(e)):1;if(n===this.exposureInstants&&(n===1||t===this.exposureInstantAt)){this.exposureInstantAt=t;return}this.exposureInstants=n,this.exposureInstantAt=t,n===1&&(this.cancelExposure(),this.exposureAccumulation?.dispose(),this.exposureAccumulation=void 0),this.render()}renderOnce(e){if(this.onMapSubjectBounds){const r=this.mapSubjectBounds();e?this.exposureSubjectBounds.push(...r):this.onMapSubjectBounds(r)}const t=this.usableEquidistantPass();this.phenomena.setCloudLayers(this.layeredClouds?.volumes??[]),this.phenomena.place(this.camera,(r,a,o)=>this.directionAtScreenPoint(r,a,o),r=>this.screenPointOf(r)),this.references.place(this.camera);const n=Math.max(this.phenomena.furthestM,this.references.furthestM)*1.2;n>this.camera.far&&(this.camera.far=n,this.camera.updateProjectionMatrix());const i=this.renderer.getRenderTarget();if(!t){this.updateLensFlarePosition();const r=this.usableDepthOfFieldPass();r?.setEncodesOutput(e===void 0),this.skyGlow?.setDestinationEncoded(e===void 0&&!r),e&&this.renderer.setRenderTarget(e),r?r.render(this.renderer,this.scene,this.camera,()=>this.renderOverlayPasses()):(this.renderer.render(this.scene,this.camera),this.renderOverlayPasses()),e&&this.renderer.setRenderTarget(i);return}t.setEncodesOutput(e===void 0),this.skyGlow?.setDestinationEncoded(!1),e&&this.renderer.setRenderTarget(e),t.render(this.renderer,this.scene,this.camera,this.camera.fov,()=>this.updateLensFlarePosition(),()=>this.renderOverlayPasses()),e&&this.renderer.setRenderTarget(i)}renderOverlayPasses(){this.renderReferencesPass(),this.renderPhenomenaPass()}renderReferencesPass(){if(!this.references.any)return;const e=this.renderer.autoClear,t=this.renderer.shadowMap.autoUpdate;this.renderer.autoClear=!1,this.renderer.shadowMap.autoUpdate=!1,this.camera.layers.set(ug),this.renderer.render(this.scene,this.camera),this.camera.layers.set(0),this.renderer.autoClear=e,this.renderer.shadowMap.autoUpdate=t}setReferences(e){this.references.set(e)}referenceAspect(e){return this.references.aspectOf(e)}directionAt(e,t){return this.directionAtScreenPoint(e,t,new C)}referenceFailedToLoad(e){return this.references.failedToLoad(e)}setReferencesShown(e){this.references.setShown(e),this.render()}setReferenceView(e,t){this.references.setView(e,t),this.render()}renderPhenomenaPass(){if(!this.phenomena.any)return;const e=this.renderer.autoClear,t=this.renderer.shadowMap.autoUpdate;this.renderer.autoClear=!1,this.renderer.shadowMap.autoUpdate=!1,this.renderer.clearDepth();for(const n of this.decorObjects){const i=this.decorGroups.get(n.id);i&&Hn.markDecorDepth(i,n.kind!=="crop")}this.camera.layers.set(Kl),this.scene.overrideMaterial=this.decorDepthMaterial,this.renderer.render(this.scene,this.camera),this.scene.overrideMaterial=null,this.camera.layers.set(hg),this.renderer.render(this.scene,this.camera),this.camera.layers.set(0),this.renderer.autoClear=e,this.renderer.shadowMap.autoUpdate=t}decorDepthMaterial=new qn({colorWrite:!1});static markDecorDepth(e,t){e.traverse(n=>{if(!(n instanceof Ge))return;const i=Array.isArray(n.material)?n.material[0]:n.material;t&&i.depthWrite!==!1&&i.blending!==Un?n.layers.enable(Kl):n.layers.disable(Kl)})}startExposure(){this.cancelExposure(),this.exposureSubjectBounds=[];const e=this.renderer.getDrawingBufferSize(new Pe),t=Math.max(1,Math.round(e.x)),n=Math.max(1,Math.round(e.y));this.exposureAccumulation||(this.exposureAccumulation=new Gy(t,n)),this.exposureAccumulation.resize(t,n),this.exposureAccumulation.open(this.renderer),this.exposureInstantsDone=0,this.exposureFrameId=requestAnimationFrame(()=>this.developExposure())}developExposure(){this.exposureFrameId=null;const e=this.exposureInstantAt,t=this.exposureAccumulation;if(!e||!t)return;const n=1/this.exposureInstants;this.resolution.beginDrawing();const i=performance.now()+Hn.EXPOSURE_BUDGET_MS,r=Hn.exposureInstantsPerFrame(t.instantTarget.width*t.instantTarget.height);let a=0;do{this.restateAt(e,this.exposureInstantsDone);const o=this.compassSprites.map(c=>c.visible);for(const c of this.compassSprites)c.visible=!1;try{this.renderOnce(t.instantTarget)}finally{this.compassSprites.forEach((c,l)=>{c.visible=o[l]})}t.add(this.renderer,n),this.exposureInstantsDone++,a++}while(this.exposureInstantsDone<this.exposureInstants&&performance.now()<i&&a<r);this.restateAt(e,0),this.presentExposure(),this.resolution.endDrawing(),this.exposureInstantsDone<this.exposureInstants&&(this.exposureFrameId=requestAnimationFrame(()=>this.developExposure()))}presentExposure(){if(this.exposureAccumulation?.develop(this.renderer,this.exposureInstants/this.exposureInstantsDone),this.onMapSubjectBounds?.(this.exposureSubjectBounds),!this.compassSprites.some(r=>r.visible))return;const e=new Va,t=new Ys(-1,1,1,-1,0,2),n=Jo/(ap*Math.tan(op*Sn/2));for(const r of this.compassSprites){if(!r.visible)continue;const a=r.getWorldPosition(new C).sub(this.camera.position).normalize(),o=this.screenPointOf(a);if(!o)continue;const c=new pr(r.material);c.position.set(o.ndcX,o.ndcY,-1),c.scale.set(n/this.camera.aspect,n,1),e.add(c)}const i=this.renderer.autoClear;this.renderer.autoClear=!1;try{this.renderer.render(e,t)}finally{this.renderer.autoClear=i}}onMapSubjectBounds;exposureSubjectBounds=[];mapSubjectBounds(){const e=[],t=new ai,n=new C;for(const i of this.decorObjects){if(!i.track?.length&&i.kind!=="aircraft"&&i.kind!=="vehicle")continue;const r=this.decorGroups.get(i.id);if(!r?.visible||(t.setFromObject(r),t.isEmpty()))continue;let a=1/0,o=-1/0,c=1/0,l=-1/0;for(const h of[t.min.x,t.max.x])for(const u of[t.min.y,t.max.y])for(const d of[t.min.z,t.max.z]){n.set(h,u,d).sub(this.camera.position).normalize();const f=this.screenPointOf(n);if(!f)continue;const p=(f.ndcX+1)/2,v=(1-f.ndcY)/2;a=Math.min(a,p),o=Math.max(o,p),c=Math.min(c,v),l=Math.max(l,v)}Number.isFinite(a)&&e.push({x:a,y:c,width:o-a,height:l-c})}return e}restateAt(e,t){this.restatingExposure=!0;try{e(t)}finally{this.restatingExposure=!1}}cancelExposure(){this.exposureFrameId!==null&&(cancelAnimationFrame(this.exposureFrameId),this.exposureFrameId=null)}setLensOptics(e){const t=this.lensOptics;this.lensOptics=e,(t===void 0!=(e===void 0)||t&&e&&(t.focalLengthMm!==e.focalLengthMm||t.fNumber!==e.fNumber||t.focusDistance!==e.focusDistance||t.frameHeightMm!==e.frameHeightMm))&&(e&&this.depthOfFieldPass&&this.depthOfFieldPass.setLens(e.focalLengthMm,e.fNumber,e.focusDistance,e.frameHeightMm),this.render())}usableDepthOfFieldPass(){const e=this.lensOptics;if(!e)return;const t=this.renderer.getDrawingBufferSize(new Pe),n=Math.max(1,Math.round(t.x)),i=Math.max(1,Math.round(t.y));return this.depthOfFieldPass||(this.depthOfFieldPass=new Ca(n,i)),this.depthOfFieldPass.resize(n,i),this.depthOfFieldPass.setLens(e.focalLengthMm,e.fNumber,e.focusDistance,e.frameHeightMm),this.depthOfFieldPass}usableEquidistantPass(){if(this.projectionKind!=="equidistant")return;const e=this.renderer.getDrawingBufferSize(new Pe);if(Da.supports(this.camera.fov,e.x/Math.max(e.y,1)))return this.equidistantPass?this.equidistantPass.resize(e.x,e.y):this.equidistantPass=new Da(e.x,e.y),this.equidistantPass}aimAtScreenPoint(e,t,n){const i=this.projectionKind==="equidistant"?this.equidistantPass:void 0;if(!i){e.setFromCamera(new Pe(t,n),this.camera);return}const r=i.directionFor(t,n,this.camera.fov);this.camera.updateMatrixWorld(),e.ray.origin.setFromMatrixPosition(this.camera.matrixWorld),e.ray.direction.set(r.x,r.y,r.z).applyQuaternion(this.camera.quaternion).normalize(),e.camera=this.camera}pickCloudAt(e,t){return this.layeredClouds?.pickInstance(this.cloudDirectionAt(e,t))}cloudDirectionAt(e,t){return this.directionAtScreenPoint(e,t,new C)}directionAtScreenPoint(e,t,n){return this.aimAtScreenPoint(this.ufoOcclusionRaycaster,e,t),n.copy(this.ufoOcclusionRaycaster.ray.direction)}screenPointOf(e){this.camera.updateMatrixWorld();const t=this.screenPointScratch.copy(e).applyQuaternion(this.screenPointQuaternion.copy(this.camera.quaternion).invert());if(t.z>=0)return;const n=this.renderer.getDrawingBufferSize(this.screenPointSize),i=n.x/Math.max(n.y,1);if(this.projectionKind==="equidistant"&&this.equidistantPass)return Da.ndcFor(t,this.camera.fov,i);const r=Math.tan(this.camera.fov/2*Sn);return{ndcX:t.x/-t.z/(i*r),ndcY:t.y/-t.z/r}}screenPointScratch=new C;screenPointQuaternion=new _s;screenPointSize=new Pe;updateLensFlarePosition(){const e=this.lensFlare;if(!e)return;if(!this.sunVisible){e.mesh.visible=!1;return}if(this.camera.updateMatrixWorld(),this.lensFlareScratch.copy(this.sunWorldPosition).applyMatrix4(this.camera.matrixWorldInverse),this.lensFlareScratch.z>0){e.mesh.visible=!1;return}const t=this.sunVisibleFraction();if(t<=0){e.mesh.visible=!1;return}e.mesh.visible=!0,this.sunUnhiddenFraction=t,this.applyDazzleStrength();const n=this.lensFlareScratch.copy(this.sunWorldPosition).project(this.camera);e.uniforms.uLensPosition.value.set(n.x,n.y);const i=this.renderer.domElement.width,r=this.renderer.domElement.height;e.uniforms.uResolution.value.set(i,r),e.uniforms.uTanHalfFov.value=Math.tan(this.camera.fov*Math.PI/360)}sunVisibleFraction(){this.raycastableDecor().length>0&&this.scene.updateMatrixWorld();let e=0;for(const t of lp)this.isSunOccluded(t[0],t[1])||e++;return e/lp.length}raycastableDecor(){const e=[];for(const t of this.decorObjects){if(t.kind==="crop")continue;const n=this.decorGroups.get(t.id);n&&e.push(n)}return e}isSunOccluded(e=0,t=0){const n=this.raycastableDecor();if(!this.groundMesh&&!this.terrainMesh&&n.length===0)return!1;const i=this.sunOcclusionDirectionScratch.copy(this.sunWorldPosition).sub(this.camera.position),r=i.length();if(i.normalize(),e!==0||t!==0){const o=Math.PI/180,c=this.sunOcclusionRightScratch.set(i.z,0,-i.x);c.lengthSq()<1e-9&&c.set(1,0,0),c.normalize();const l=this.sunOcclusionUpScratch.crossVectors(c,i).normalize();i.addScaledVector(c,e*o).addScaledVector(l,t*o).normalize()}if(this.groundBlocks(this.camera.position,i,r))return!0;if(n.length===0)return!1;this.sunOcclusionRaycaster.set(this.camera.position,i);const a=this.sunOcclusionRaycaster.intersectObjects(n,!0)[0];return a!==void 0&&a.distance<r}groundBlocks(e,t,n,i=0){const r=this.groundMesh;if(r&&t.y<0){const m=(r.position.y-e.y)/t.y;if(m>i&&m<n){const g=e.x+t.x*m-r.position.x,b=e.z+t.z*m-r.position.z;if(Math.hypot(g,b)<=this.groundRadius)return!0}}const a=this.terrainMesh;if(!a)return!1;const o=a.geometry.getAttribute("position"),c=Math.round(Math.sqrt(o.count));if(c<2||c*c!==o.count)return!1;const l=[a.position.x+o.getX(0),a.position.x+o.getX(c-1)],h=[a.position.z+o.getZ(0),a.position.z+o.getZ((c-1)*c)],u=Math.min(Math.abs(l[1]-l[0]),Math.abs(h[1]-h[0]))/(c-1);if(!(u>0))return!1;let d=i,f=n;for(const[m,g,b]of[[e.x,t.x,l],[e.z,t.z,h]]){const w=Math.min(b[0],b[1]),_=Math.max(b[0],b[1]);if(Math.abs(g)<1e-12){if(m<w||m>_)return!1;continue}const S=(w-m)/g,E=(_-m)/g;d=Math.max(d,Math.min(S,E)),f=Math.min(f,Math.max(S,E))}if(!(f>d))return!1;const p=Math.hypot(t.x,t.z),v=Math.min(4096,Math.max(8,Math.ceil((f-d)*p/(u/2))));for(let m=0;m<=v;m++){const g=d+(f-d)*m/v,b=e.x+t.x*g,w=e.y+t.y*g,_=e.z+t.z*g;if(w<=this.groundYUnder(b,_))return!0}return!1}setPhenomena(e,t){this.phenomena.set(e,t)}decorDistancesAt(e,t,n){this.aimAtScreenPoint(this.ufoOcclusionRaycaster,e,t),this.ufoOcclusionRaycaster.near=ep;let i,r;for(const a of this.decorObjects){if(a.kind==="crop")continue;const o=this.decorGroups.get(a.id);if(!o)continue;const c=this.ufoOcclusionRaycaster.intersectObject(o,!0)[0];c&&(a.occludesSourceIds?.includes(n)?i=i===void 0?c.distance:Math.max(i,c.distance):r=r===void 0?c.distance:Math.min(r,c.distance))}return{behindM:i,inFrontM:r}}pickBodyAt(e,t){this.aimAtScreenPoint(this.raycaster,e,t);const n=[...this.hitAreas.entries()],i=this.raycaster.intersectObjects(n.map(([,r])=>r))[0];if(i&&!this.groundHides(e,t))return n.find(([,r])=>r===i.object)?.[0]}pickStarAt(e,t){if(this.namedStars.length===0)return;this.aimAtScreenPoint(this.raycaster,e,t);const n=this.raycaster.ray.direction,i=Math.cos(np*this.camera.fov*Math.PI/180);let r,a=i;for(const o of this.namedStars){const c=o.direction.dot(n);c>a&&(a=c,r={star:o.star,altitudeDeg:o.altitudeDeg})}return r&&this.groundHides(e,t)?void 0:r}groundHides(e,t){if(!this.terrainMesh&&!this.groundMesh)return!1;this.aimAtScreenPoint(this.ufoOcclusionRaycaster,e,t);const n=this.ufoOcclusionRaycaster.ray;return this.groundBlocks(n.origin,n.direction,1/0,ep)}pickDecorAt(e,t){this.aimAtScreenPoint(this.raycaster,e,t);const n=[...this.decorGroups.entries()],i=this.raycaster.intersectObjects(n.map(([,a])=>a),!0)[0];if(!i)return;let r=i.object;for(;r&&!n.some(([,a])=>a===r);)r=r.parent;return n.find(([,a])=>a===r)?.[0]}dispose(){this.stopTwinkle(),this.cancelFlush(),this.phenomena.clear(),this.references.disposeAll(),this.terrainBuildToken++,this.disposeMesh(this.skyMesh),this.disposeMesh(this.groundMesh),this.disposeMesh(this.terrainMesh),this.disposeCloudSystem(),this.disposeCirrus(),this.disposePrecipitationPoints(),this.disposeRain(),this.disposeStarTiers(),this.meteorSystem?.dispose(),this.meteorSystem=void 0,this.iceHalos?.dispose(),this.iceHalos=void 0,this.rainbow?.dispose(),this.rainbow=void 0,this.skyGlow?.dispose(),this.skyGlow=void 0,this.depthOfFieldPass?.dispose(),this.depthOfFieldPass=void 0,this.cancelExposure(),this.exposureAccumulation?.dispose(),this.exposureAccumulation=void 0,this.cometTail?.dispose(),this.cometTail=void 0,this.satelliteField?.dispose(),this.satelliteField=void 0,this.lightningBolt?.dispose(),this.lightningBolt=void 0;for(const e of this.bodyMeshes.values())this.disposeMesh(e);this.bodyMeshes.clear(),this.novaKeys.clear();for(const e of[...this.hitAreas.keys()])this.disposeHitArea(e);for(const e of[...this.glareSprites.keys()])this.disposeGlare(e);this.disposeCompassLabels();for(const e of this.decorGroups.values())sn.dispose(e);this.decorGroups.clear(),this.streetlightLights.clear(),this.lensFlare&&(this.lensFlare.mesh.removeFromParent(),this.lensFlare.mesh.geometry.dispose(),this.lensFlare.mesh.material.dispose(),this.lensFlare=void 0),this.renderer.dispose()}animationsRunning=!1;startTwinkle(){if(this.animationFrameId!==null||!this.needsAnimationLoop())return;this.cancelFlush();const e=t=>{this.frame(t),this.animationFrameId=requestAnimationFrame(e)};this.animationFrameId=requestAnimationFrame(e)}setAnimationsRunning(e,t=!1){const n=e&&t;if(e===this.animationsRunning&&n===this.framesDriven)return;const i=this.animationsRunning;this.animationsRunning=e,this.framesDriven=n,e&&!i&&(this.lastFrameTimeMs=void 0,this.resolution.reset()),this.syncAnimationLoop(),(!e||this.frameDirty)&&this.render()}stopTwinkle(){this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}needsAnimationLoop(){return this.animationsRunning&&!this.framesDriven&&this.hasAnimations()}hasAnimations(){return this.starTiers.length>0||this.precipitationPoints!==void 0||this.rainSystem!==void 0||this.lensFlare!==void 0&&this.sunVisible}syncAnimationLoop(){this.needsAnimationLoop()?this.startTwinkle():this.stopTwinkle()}buildSky(e){const t=this.skyMesh?.geometry??new an(Ko,32,16),n=t.attributes.position,i=t.getAttribute("color")??new Et(new Float32Array(n.count*3),3);for(let a=0;a<n.count;a++){const{altitudeDeg:o,azimuthDeg:c}=Xy(n.getX(a),n.getY(a),n.getZ(a)),l=Qy(o,c,e.azimuthDeg,e.altitudeDeg);i.setXYZ(a,l[0],l[1],l[2])}if(i.needsUpdate=!0,this.skyMesh)return;t.setAttribute("color",i);const r=new qn({vertexColors:!0,side:Nt,fog:!1,depthWrite:!1});this.skyMesh=new Ge(t,r),this.skyMesh.renderOrder=-1,this.celestialGroup.add(this.skyMesh)}buildGround(){const e=tp(this.observerElevationM);if(this.groundMesh&&e===this.groundRadius)return;this.disposeMesh(this.groundMesh),this.groundRadius=e;const t=new td(this.groundRadius,48),n=new Ya({color:new oe($l,$l,$l),fog:!0});this.groundMesh=new Ge(t,n),this.groundMesh.rotation.x=-Math.PI/2,this.groundMesh.position.y=0,this.groundMesh.receiveShadow=!0,this.scene.add(this.groundMesh),this.applyGroundDepthWrite()}applyGroundDepthWrite(){const e=this.groundMesh?.material;if(!e)return;const t=this.terrainMesh===void 0;e.depthWrite!==t&&(e.depthWrite=t,e.needsUpdate=!0)}cloudTransmission(e){const t=`${e.altitudeDeg.toFixed(1)}:${e.azimuthDeg.toFixed(1)}:${Math.round(this.cloudOffsetM.x/10)}:${Math.round(this.cloudOffsetM.z/10)}:${Math.round(this.observerElevationM)}:`+Object.entries(this.cloudLayerOffsetsM).map(([r,a])=>`${r}=${Math.round(a.x/10)},${Math.round(a.z/10)}`).join(";"),n=this.cloudTransmissionMemo.get(t);if(n!==void 0)return n;this.cloudTransmissionMemo.size>256&&this.cloudTransmissionMemo.clear();const i=this.computeCloudTransmission(e);return this.cloudTransmissionMemo.set(t,i),i}cloudTransmissionMemo=new Map;computeCloudTransmission(e){const t=jt(e.altitudeDeg,e.azimuthDeg,1);if(this.layeredClouds)return this.layeredClouds.transmissionAt(t);let n=1;const i=this.lowerCloudCover();i>0&&(n*=1-It.alphaAt(t,Math.abs(this.cloudLayerOffset()),i,this.cloudFieldOffset)*ob);const r=this.weather.highCloudCover??0;return r>0&&(n*=1-It.alphaAt(t,$o,r)*cb),Math.max(0,Math.min(1,n))}setBodyMesh(e,t,n,i,r){if(t.altitudeDeg<Ou){this.disposeMesh(this.bodyMeshes.get(e)),this.bodyMeshes.delete(e),this.disposeHitArea(e),this.disposeGlare(e),e==="sun"&&(this.sunVisible=!1);return}const{x:a,y:o,z:c}=jt(t.altitudeDeg,t.azimuthDeg,Sr),l=os(t.altitudeDeg),h=this.cloudTransmission(t),u=new oe(i.r*l[0]*h,i.g*l[1]*h,i.b*l[2]*h);let d=this.bodyMeshes.get(e);d instanceof Ge?d.material.color.copy(u):(this.disposeMesh(d),d=new Ge(new an(1,16,16),new qn({color:u,fog:!1})),this.celestialGroup.add(d),this.bodyMeshes.set(e,d)),d.scale.setScalar(n),d.position.set(a,o,c),this.setHitArea(e,a,o,c,n);const f=r-2.5*Math.log10(Math.max(h,.001));if(e==="sun"&&(this.sunCloudTransmission=h),e!=="sun"&&this.setGlare(e,a,o,c,f,u),e==="sun"){this.sunVisible=!0;const p=this.celestialGroup.scale.x;this.sunWorldPosition.set(a*p,o*p+this.celestialGroup.position.y,c*p),this.lensFlare||(this.lensFlare=N5(),this.lensFlare.uniforms.uOpacity.value=yb,this.lensFlare.uniforms.uFlareIntensity.value=this.lensFlareArtifactIntensity,this.lensFlare.uniforms.uStarPoints.value=this.starPoints,this.scene.add(this.lensFlare.mesh)),this.applyLensFlareTint(l)}}setMoonMesh(e,t){const n="moon";if(e.magnitude>t||e.altitudeDeg<Ou){this.disposeMesh(this.bodyMeshes.get(n)),this.bodyMeshes.delete(n),this.disposeHitArea(n),this.disposeGlare(n);return}const{x:i,y:r,z:a}=jt(e.altitudeDeg,e.azimuthDeg,Sr),o=os(e.altitudeDeg),c=new oe(o[0],o[1],o[2]),l=`${e.phase.phaseFraction<.5}:${Math.round(Pa(e.phase.illuminatedFraction,0,1)*500)}`;let h=this.bodyMeshes.get(n);if(h instanceof pr)h.userData.phaseKey!==l&&(h.material.map?.dispose(),h.material.map=Ap(e.phase),h.userData.phaseKey=l),h.material.color.copy(c);else{this.disposeMesh(h),h=new pr(new Ma({map:Ap(e.phase),color:c,fog:!1})),h.userData.phaseKey=l;const u=Zl*2;h.scale.set(u,u,1),this.celestialGroup.add(h),this.bodyMeshes.set(n,h)}h.position.set(i,r,a),this.setHitArea(n,i,r,a,Zl),this.setGlare(n,i,r,a,e.magnitude,c)}setHitArea(e,t,n,i,r){let a=this.hitAreas.get(e);if(!a){const c=new Ma({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1,fog:!1});a=new pr(c),this.celestialGroup.add(a),this.hitAreas.set(e,a)}a.position.set(t,n,i);const o=r*ab;a.scale.set(o,o,1)}disposeHitArea(e){const t=this.hitAreas.get(e);t&&(t.removeFromParent(),t.material.dispose(),this.hitAreas.delete(e))}setGlare(e,t,n,i,r,a){const o=nS(r);if(o<=0){this.disposeGlare(e);return}const c=rS(o),l=this.glareSprites.get(e),h=l??new pr(new Ma({map:Qb(),transparent:!0,blending:Un,depthWrite:!1,fog:!1}));h.material.color.copy(a),h.material.opacity=cS(o),h.position.set(t,n,i),h.scale.set(c*2,c*2,1),l||(this.celestialGroup.add(h),this.glareSprites.set(e,h))}disposeGlare(e){const t=this.glareSprites.get(e);t&&(t.removeFromParent(),t.material.dispose(),this.glareSprites.delete(e))}buildComet(e,t){const n=e&&`comet:${e.id}`;if(!e||!n||e.magnitude>t){this.disposeComet();return}this.cometKey&&this.cometKey!==n&&this.disposeComet();const i=_a(e.magnitude,t),r=ya(i);this.cometKey=n,this.setBodyMesh(n,e.position,jl*(.5+.5*i),new oe(r,r,r),e.magnitude),this.cometTail||(this.cometTail=new Ln(Sr),this.celestialGroup.add(this.cometTail.object)),this.cometTail.set(e.position,e.tailEnd,i)}buildIceHalos(e,t){this.iceHalos||(this.iceHalos=new gi,this.iceHalos.setCloudOffset(this.cloudFieldOffset),this.iceHalos.onReady=()=>this.render(),this.celestialGroup.add(this.iceHalos.object));const n=this.highCloudCover(),i=this.layeredClouds?.cirrusMask;if(this.iceHalos.setCloudOffset(i?.offset??this.cloudFieldOffset),n===void 0){this.iceHalos.update({x:0,y:1,z:0},-1,0,[1,1,1],{cover:0,layerHeight:$o},0);return}const r=this.lowerCloudCover(),a=et.deckLitUntilDeg(et.DECK_HEIGHT_M),o=e.altitudeDeg>-a?e:t,c=et.strength(n,r,o.altitudeDeg,a)*(o===e?1:sp),{x:l,y:h,z:u}=jt(o.altitudeDeg,o.azimuthDeg,1),d=os(o.altitudeDeg);this.iceHalos.update({x:l,y:h,z:u},o.altitudeDeg,c,[d[0],d[1],d[2]],{cover:i?.cover??n,layerHeight:i?.layerHeight??$o},i?.iceCrystalAlignment??this.weather.iceCrystalAlignment??.65)}buildRainbow(e,t){this.rainbow||(this.rainbow=new Fs,this.celestialGroup.add(this.rainbow.object));const n=this.weather.precipitationType==="rain"?this.weather.precipitationIntensity:0,i=e.altitudeDeg>0,r=i?e:t,a=this.lowerCloudCover(),o=sp*En.moonlightShare(t.magnitude),c=En.strength(n,a,r.altitudeDeg)*(i?1:o);if(c<=0){this.rainbow.update({x:0,y:1,z:0},0,[1,1,1],!0);return}const{x:l,y:h,z:u}=jt(r.altitudeDeg,r.azimuthDeg,1),d=os(r.altitudeDeg);this.rainbow.update({x:l,y:h,z:u},c,[d[0],d[1],d[2]],i)}buildSkyGlow(e,t){if(!e.frame){this.skyGlow?.hide();return}this.skyGlow||(this.skyGlow=new ls,this.skyGlow.onReady=()=>this.render(),this.celestialGroup.add(this.skyGlow.object));const{date:n,observer:i}=e.frame,r=Zn.galactic(n,i),a=Hn.directionOf(r.centre),o=Hn.directionOf(r.rotation),c=Hn.directionOf(r.pole),l=new ze().set(a.x,a.y,a.z,o.x,o.y,o.z,c.x,c.y,c.z),h=Hn.directionOf(Zn.eclipticPole(n,i)),u=Hn.directionOf(e.sun),d=u.clone().addScaledVector(h,-u.dot(h)).normalize();this.skyGlow.update({galactic:l,eclipticPole:h,sunLongitude:d,sunDirection:u,sunAltitudeDeg:e.sun.altitudeDeg,moon:{direction:Hn.directionOf(e.moon),altitudeDeg:e.moon.altitudeDeg,phaseAngleDeg:Je.phaseAngleOf(e.moon.phase.illuminatedFraction)},skyColor:new C(t[0],t[1],t[2])})}static directionOf(e){const{x:t,y:n,z:i}=jt(e.altitudeDeg,e.azimuthDeg,1);return new C(t,n,i).normalize()}buildNovae(e,t){const n=new Set;for(const i of e){if(i.magnitude>t)continue;const r=`nova:${i.id}`;n.add(r);const a=_a(i.magnitude,t),o=ya(a);this.setBodyMesh(r,i.position,jl*(.5+.5*a),new oe(o,o,o),i.magnitude)}for(const i of this.novaKeys)n.has(i)||(this.disposeMesh(this.bodyMeshes.get(i)),this.bodyMeshes.delete(i),this.disposeHitArea(i),this.disposeGlare(i));this.novaKeys=n}disposeComet(){this.cometTail?.set(void 0,void 0,0),this.cometKey&&(this.disposeMesh(this.bodyMeshes.get(this.cometKey)),this.bodyMeshes.delete(this.cometKey),this.disposeHitArea(this.cometKey),this.disposeGlare(this.cometKey),this.cometKey=void 0)}buildPlanets(e,t){const n=new Set(["sun","moon",...this.cometKey?[this.cometKey]:[],...this.novaKeys]);for(const i of e){if(i.magnitude>t)continue;n.add(i.body);const r=_a(i.magnitude,t),a=ya(r),o=Wb[i.body]??new oe(1,1,1),c=new oe(o.r*a,o.g*a,o.b*a),l=jl*(.5+.5*r);this.setBodyMesh(i.body,i.position,l,c,i.magnitude)}for(const i of[...this.bodyMeshes.keys()])n.has(i)||(this.disposeMesh(this.bodyMeshes.get(i)),this.bodyMeshes.delete(i),this.disposeHitArea(i),this.disposeGlare(i))}buildStars(e,t){if(this.namedStars=[],!e||e.catalog.count===0){this.disposeStarTiers(),this.syncAnimationLoop();return}const{catalog:n,date:i,observer:r}=e,a=new ei(i,r),o=rh(1337),c=[];for(let l=0;l<n.count;l++){const h=n.mag[l];if(h>t)break;const{altitudeDeg:u,azimuthDeg:d}=a.position(n.ra[l],n.dec[l]);if(u<ip)continue;const{x:f,y:p,z:v}=jt(u,d,Jl);c.push({x:f,y:p,z:v,brightness:_a(h,t),phase:o()*Math.PI*2,speedFactor:.7+o()*.6})}for(const l of p5){if(l.mag>t)continue;const{altitudeDeg:h,azimuthDeg:u}=a.position(l.raHours,l.decDeg);if(h<ip)continue;const{x:d,y:f,z:p}=jt(h,u,Jl);this.namedStars.push({star:l,direction:new C(d,f,p).normalize(),altitudeDeg:h})}this.starTiers=od.map((l,h)=>{const u=c.filter(w=>Nm(w.brightness)===h),d=new Float32Array(u.length*3),f=new Float32Array(u.length),p=new Float32Array(u.length),v=new Float32Array(u.length);u.forEach((w,_)=>{d[_*3]=w.x,d[_*3+1]=w.y,d[_*3+2]=w.z,f[_]=w.brightness,p[_]=w.phase,v[_]=w.speedFactor});const m=new Mt;m.setAttribute("position",new tt(d,3));const g=new tt(new Float32Array(u.length*3),3);m.setAttribute("color",g);let b=this.starTiers[h]?.points;if(b)b.geometry.dispose(),b.geometry=m;else{const w=new ed({vertexColors:!0,size:l.size,sizeAttenuation:!1,fog:!1});fs.apply(w),b=new Ra(m,w),this.celestialGroup.add(b)}return{points:b,colorAttribute:g,brightness:f,phase:p,speedFactor:v}}),this.updateTwinkle(0),this.startTwinkle()}updateTwinkle(e){for(const t of this.starTiers){const n=t.colorAttribute.array;for(let i=0;i<t.brightness.length;i++){const r=pS(t.brightness[i],{phase:t.phase[i],speedFactor:t.speedFactor[i]},e),a=ya(t.brightness[i])*r;n[i*3]=a,n[i*3+1]=a,n[i*3+2]=a}t.colorAttribute.needsUpdate=!0}}buildClouds(){if(this.cloudRendering==="volume"||this.weather.cloudLayers!==void 0){this.layeredClouds||(this.disposeCloudSystem(),this.layeredClouds=new Tc(this.celestialGroup,Ql,this.cloudRendering)),this.disposeCirrus(),this.layeredClouds.update(this.weather,this.observerElevationM+1.6),this.layeredClouds.setOffsets(this.cloudOffsetM,this.cloudLayerOffsetsM),this.lastSunPosition&&this.updateCloudLighting(this.lastSunPosition,this.baseFogColor);return}const e=this.lowerCloudCover();if(e<=0){this.disposeCloudSystem();return}const t=this.weather.cloudDarkness,n=new oe(Ts[0]+(nh[0]-Ts[0])*t,Ts[1]+(nh[1]-Ts[1])*t,Ts[2]+(nh[2]-Ts[2])*t);if(this.cloudMesh&&this.cloudUniforms){this.cloudUniforms.coverage.value=e,this.cloudUniforms.baseColor.value.copy(n),this.syncCloudLayer(),this.lastSunPosition&&this.updateCloudLighting(this.lastSunPosition,this.baseFogColor);return}this.disposeCloudSystem();const{material:i,uniforms:r}=au(n,e,Math.abs(this.cloudLayerOffset()));this.cloudMaterial=i,this.cloudUniforms=r,r.fieldOffset.value.copy(this.cloudFieldOffset),this.lastSunPosition&&this.updateCloudLighting(this.lastSunPosition,this.baseFogColor);const a=ou(Ql);this.cloudMesh=new Ge(a,i),this.faceCloudDeck(this.cloudMesh,this.cloudLayerOffset()),this.celestialGroup.add(this.cloudMesh)}lowerCloudCover(){return this.weather.cloudLayers?1-this.weather.cloudLayers.filter(e=>e.type!=="cirrus").reduce((e,t)=>e*(1-t.coverage),1):this.weather.lowerCloudCover??this.weather.cloudCover}highCloudCover(){return this.weather.cloudLayers?1-this.weather.cloudLayers.filter(e=>e.type==="cirrus").reduce((e,t)=>e*(1-t.coverage),1):this.weather.highCloudCover}buildCirrus(){const e=this.weather.highCloudCover??0;if(this.layeredClouds||e<=0){this.disposeCirrus();return}if(this.cirrusMesh&&this.cirrusUniforms){this.cirrusUniforms.coverage.value=e,this.lastSunPosition&&this.updateCloudLighting(this.lastSunPosition,this.baseFogColor);return}const{material:t,uniforms:n}=au(new oe(...Ts),e,$o,1);this.cirrusMaterial=t,this.cirrusUniforms=n,n.fieldOffset.value.copy(this.cloudFieldOffset),this.lastSunPosition&&this.updateCloudLighting(this.lastSunPosition,this.baseFogColor),this.cirrusMesh=new Ge(ou(Ql*1.04),t),this.cirrusMesh.renderOrder=hp-1,this.celestialGroup.add(this.cirrusMesh)}disposeCirrus(){this.cirrusMesh&&(this.cirrusMesh.removeFromParent(),this.cirrusMesh.geometry.dispose()),this.cirrusMaterial?.dispose(),this.cirrusMesh=void 0,this.cirrusMaterial=void 0,this.cirrusUniforms=void 0}syncCloudLayer(){this.layeredClouds?.update(this.weather,this.observerElevationM+1.6);const e=this.cloudLayerOffset();this.cloudUniforms&&(this.cloudUniforms.layerHeight.value=Math.abs(e)),this.cloudMesh&&this.faceCloudDeck(this.cloudMesh,e)}faceCloudDeck(e,t){const n=t<0;e.scale.y=n?-1:1,e.renderOrder=n?Tc.deckOrder(!0,0,1):hp}cloudLayerOffset(){const t=((this.weather.cloudBaseM??1e3)-this.observerElevationM)*eh;return Math.sign(t||1)*Math.max(Math.abs(t),bb)}updateCloudLighting(e,t){const n=[this.cloudUniforms,this.cirrusUniforms].filter(u=>u!==void 0);if(n.length===0&&!this.layeredClouds)return;const{x:i,y:r,z:a}=jt(e.altitudeDeg,e.azimuthDeg,1),o=os(e.altitudeDeg),c=Math.max(0,Math.sin(Math.max(e.altitudeDeg,0)*Sn)),l=this.lightningLevel*Gb,h=new oe(t[0]+pi.r*l,t[1]+pi.g*l,t[2]+pi.b*l);this.layeredClouds?.setLighting(new C(i,r,a),new oe(o[0]*c,.96*o[1]*c,.88*o[2]*c),h,h);for(const u of n)u.sunDir.value.set(i,r,a),u.sunColor.value.setRGB(o[0]*c,.96*o[1]*c,.88*o[2]*c),u.ambientColor.value.copy(h)}disposeCloudSystem(){this.layeredClouds?.dispose(),this.layeredClouds=void 0,this.cloudMesh&&(this.cloudMesh.removeFromParent(),this.cloudMesh.geometry.dispose()),this.cloudMaterial?.dispose(),this.cloudMesh=void 0,this.cloudMaterial=void 0,this.cloudUniforms=void 0}disposePrecipitationPoints(){this.precipitationPoints&&(this.precipitationPoints.removeFromParent(),this.precipitationPoints.geometry.dispose(),this.precipitationPoints.material.dispose()),this.precipitationPoints=void 0,this.precipitationPositions=void 0,this.precipitationPhase=void 0,this.precipitationSpeedJitter=void 0,this.precipitationWobbleFreqJitter=void 0,this.precipitationWobbleAmpJitter=void 0,this.precipitationBounceRemaining=void 0,this.precipitationBounceHeight=void 0,this.precipitationBounceDuration=void 0,this.precipitationBounceVelX=void 0,this.precipitationBounceVelZ=void 0,this.precipitationUniforms=void 0}buildPrecipitation(){this.disposePrecipitationPoints(),this.disposeRain();const e=this.weather.precipitationType;if(e==="none")return;if(e==="rain"){this.buildRain();return}const t=up[e],n=t.poolSize,i=rh(9001),r=new Float32Array(n*3),a=new Float32Array(n),o=new Float32Array(n),c=new Float32Array(n),l=new Float32Array(n),h=new Float32Array(n),u=new Float32Array(n),d=new Float32Array(n),f=new Float32Array(n),p=new Float32Array(n);for(let w=0;w<n;w++){const _=i()*Math.PI*2,S=i()*t.radiusM;r[w*3]=Math.cos(_)*S,r[w*3+1]=Er+i()*(t.topYM-Er),r[w*3+2]=Math.sin(_)*S,a[w]=i()*Math.PI*2,o[w]=.7+i()*.6,c[w]=.6+i()*.8,l[w]=.4+i()*1.2}const v=new Mt;v.setAttribute("position",new tt(r,3)),v.setDrawRange(0,sh(n,this.weather.precipitationIntensity));const m={uSize:{value:t.size},uScale:{value:.5*this.renderer.domElement.height},uOpacity:{value:t.opacity},uColor:{value:t.color},uHazeColor:{value:new oe(...this.baseFogColor)},uTexture:{value:Xb(e)},uNearFocusDistance:{value:Mp},uHazeDistance:{value:t.radiusM*xp}},g=new At({uniforms:m,vertexShader:Zb,fragmentShader:jb,transparent:!0,depthWrite:!1});this.precipitationUniforms=m;const b=new Ra(v,g);b.renderOrder=th,this.scene.add(b),this.precipitationPoints=b,this.precipitationPositions=r,this.precipitationPhase=a,this.precipitationSpeedJitter=o,this.precipitationWobbleFreqJitter=c,this.precipitationWobbleAmpJitter=l,this.precipitationBounceRemaining=h,this.precipitationBounceHeight=u,this.precipitationBounceDuration=d,this.precipitationBounceVelX=f,this.precipitationBounceVelZ=p}updatePrecipitation(e,t){if(!this.precipitationPoints||!this.precipitationPositions||!this.precipitationPhase||!this.precipitationSpeedJitter||(this.precipitationUniforms?.uHazeColor.value.setRGB(...this.baseFogColor),t<=0))return;const n=this.weather.precipitationType;if(n==="none"||n==="rain")return;const i=up[n],r=this.weather.windDirectionDeg*Sn,a=Math.sin(r)*this.weather.windSpeed*i.driftSensitivity,o=-Math.cos(r)*this.weather.windSpeed*i.driftSensitivity,c=this.precipitationPositions,l=this.precipitationPhase,h=this.precipitationSpeedJitter,u=this.precipitationWobbleFreqJitter,d=this.precipitationWobbleAmpJitter,f=this.precipitationBounceRemaining,p=this.precipitationBounceHeight,v=this.precipitationBounceDuration,m=this.precipitationBounceVelX,g=this.precipitationBounceVelZ,b=n==="snow"&&u&&d,w=n==="hail"&&f&&p&&v&&m&&g;for(let _=0,S=0;_<c.length;_+=3,S++){if(w&&f[S]>0){if(f[S]-=t,f[S]<=0){const M=Math.random()*Math.PI*2,A=Math.sqrt(Math.random())*i.radiusM;c[_]=Math.cos(M)*A,c[_+1]=i.topYM,c[_+2]=Math.sin(M)*A,f[S]=0}else{const M=1-f[S]/v[S];c[_+1]=Er+Math.sin(Math.PI*M)*p[S],c[_]=Zo(c[_]+(a+m[S])*t,i.radiusM),c[_+2]=Zo(c[_+2]+(o+g[S])*t,i.radiusM)}continue}let E=0,R=0;if(b){const M=Nb*u[S],A=Ob*d[S];E=Math.sin(e*M*Math.PI*2+l[S])*A,R=Math.sin(e*M*Math.PI*2+l[S]+Math.PI/2)*A}if(c[_]+=(a+E)*t,c[_+1]-=i.fallSpeedMPerS*h[S]*t,c[_+2]+=(o+R)*t,c[_]=Zo(c[_],i.radiusM),c[_+2]=Zo(c[_+2],i.radiusM),c[_+1]<Er){if(w){p[S]=wp*(.2+Math.random()*1.6),v[S]=Ub*(.5+Math.random()),f[S]=v[S];const P=Math.random()*Math.PI*2,D=Fb*(p[S]/wp);m[S]=Math.cos(P)*D,g[S]=Math.sin(P)*D,c[_+1]=Er;continue}const M=Math.random()*Math.PI*2,A=Math.sqrt(Math.random())*i.radiusM;c[_]=Math.cos(M)*A,c[_+1]=i.topYM,c[_+2]=Math.sin(M)*A}}this.precipitationPoints.geometry.attributes.position.needsUpdate=!0}buildRain(){const e=mp(this.weather.precipitationIntensity);this.rainSystem=C5({count:dp,radiusM:ma,heightM:Eb,bottomYM:fp,overallSpeed:Ab,color:Rb,opacity:.85,visibleCount:sh(dp,this.weather.precipitationIntensity),speedStreak:Pb(e),pixelSize:yp,seed:9001,nearFocusDistanceM:Mp,hazeDistanceM:ma*xp,hazeColor:new oe(...this.baseFogColor)}),this.rainLastVerticalFacing=-1,this.syncRainSlant(),this.rainSystem.points.renderOrder=th,this.scene.add(this.rainSystem.points),this.buildRainSplashes()}buildRainSplashes(){const e=rh(4242),t=new Float32Array(br*3),n=new Float32Array(br),i=new Float32Array(br),r=new Float32Array(br);for(let h=0;h<br;h++){const u=e()*Math.PI*2,d=Math.sqrt(e())*ma;t[h*3]=Math.cos(u)*d,t[h*3+1]=fp,t[h*3+2]=Math.sin(u)*d,i[h]=Ep(gp,vp),n[h]=e()*i[h],r[h]=n[h]/i[h]}const a=new Mt;a.setAttribute("position",new tt(t,3));const o=new tt(r,1);a.setAttribute("aLife",o),a.setDrawRange(0,sh(br,this.weather.precipitationIntensity));const c=new At({uniforms:{uMaxSize:{value:Ib},uScale:{value:.5*this.renderer.domElement.height},uColor:{value:Lb},uTexture:{value:Kb()}},vertexShader:$b,fragmentShader:Jb,transparent:!0,depthWrite:!1}),l=new Ra(a,c);l.renderOrder=th,this.scene.add(l),this.rainSplashSystem={points:l,positions:t,life:n,duration:i,lifeAttribute:o}}disposeRain(){this.rainSystem&&(this.rainSystem.points.removeFromParent(),this.rainSystem.points.geometry.dispose(),this.rainSystem.points.material.dispose()),this.rainSystem=void 0,this.disposeRainSplashes()}disposeRainSplashes(){this.rainSplashSystem&&(this.rainSplashSystem.points.removeFromParent(),this.rainSplashSystem.points.geometry.dispose(),this.rainSplashSystem.points.material.dispose()),this.rainSplashSystem=void 0}syncRainSlant(){const e=this.rainSystem;if(!e)return;const t=this.weather.windDirectionDeg*Sn;e.uniforms.uDropVelocity.value.set(Math.sin(t)*this.weather.windSpeed,-mp(this.weather.precipitationIntensity),-Math.cos(t)*this.weather.windSpeed);const n=this.renderer.getSize(this.rainViewportSize);e.uniforms.uAspect.value=n.x/Math.max(n.y,1)}updateRain(e){const t=this.rainSystem;if(!t)return;t.uniforms.uTime.value+=e,t.uniforms.uHazeColor.value.setRGB(...this.baseFogColor);const n=this.weather.windDirectionDeg*Sn,i=Math.sin(n)*this.weather.windSpeed,r=-Math.cos(n)*this.weather.windSpeed,a=ma,o=l=>(l%(a*2)+a*3)%(a*2)-a;t.uniforms.uWindOffset.value.set(o(t.uniforms.uWindOffset.value.x+i*e),o(t.uniforms.uWindOffset.value.y+r*e)),this.syncRainSlant(),this.camera.getWorldDirection(this.rainCameraDirection);const c=Math.abs(this.rainCameraDirection.y);if(Math.abs(c-this.rainLastVerticalFacing)>.001){this.rainLastVerticalFacing=c;const l=Sp+(1-Sp)*(1-c),h=bp+(1-bp)*(1-c);t.uniforms.uUvSquash.value=h,t.uniforms.uPixelSize.value=yp*l*(.5+.5*h)}this.updateRainSplashes(e)}updateRainSplashes(e){const t=this.rainSplashSystem;if(!t||e<=0)return;const{positions:n,life:i,duration:r,lifeAttribute:a}=t,o=a.array;for(let c=0,l=0;c<n.length;c+=3,l++){if(i[l]+=e,i[l]>=r[l]){const h=Math.random()*Math.PI*2,u=Math.sqrt(Math.random())*ma;n[c]=Math.cos(h)*u,n[c+2]=Math.sin(h)*u,r[l]=Ep(gp,vp),i[l]=0}o[l]=i[l]/r[l]}t.points.geometry.attributes.position.needsUpdate=!0,a.needsUpdate=!0}setLightning(e){this.lightningFlashes=e}updateLightning(e){let t,n=0;if(this.lightningArmed)for(const o of this.lightningFlashes){if(o.t>e)break;const c=Wt.brightnessAt(o,e);c>n&&(t=o,n=c)}const i=t?Math.min(1,Math.max(.1,(Bb/t.distanceM)**2)):0,r=n*i*(t?.cloudToGround?1:.6);if(r===this.lightningLevel&&!t?.cloudToGround)return;if(this.lightningLevel=r,this.scene.fog){const o=this.scene.fog,c=Math.min(1,r);o.color.setRGB(this.baseFogColor[0]+(pi.r-this.baseFogColor[0])*c,this.baseFogColor[1]+(pi.g-this.baseFogColor[1])*c,this.baseFogColor[2]+(pi.b-this.baseFogColor[2])*c)}if(this.skyMesh){const o=r*Hb;this.skyMesh.material.color.setRGB(1+o*pi.r,1+o*pi.g,1+o*pi.b)}if(this.lastSunPosition&&this.updateCloudLighting(this.lastSunPosition,this.baseFogColor),this.lightningLight.intensity=r*Vb,t){const{x:o,y:c,z:l}=jt(25,t.azimuthDeg,Sr);this.lightningLight.position.set(o,c,l)}this.lightningBolt||(this.lightningBolt=new Dr(Sr*.95),this.celestialGroup.add(this.lightningBolt.object));const a=this.weather.cloudBaseM??1500;this.lightningBolt.set(t,n,a),this.render()}buildCompassLabels(){const e=ku(navigator.languages,gb),t=mb[e];this.compassSprites=pb.map((n,i)=>{const r=t[i],a=new Ma({map:ew(r),depthTest:!1,fog:!1}),o=new pr(a),{x:c,y:l,z:h}=jt(0,n,ap);return o.position.set(c,l,h),o.scale.set(Jo,Jo,1),o.renderOrder=vb,o.visible=this.compassHovered||this.compassForced,this.celestialGroup.add(o),o}),this.updateCompassScale()}updateCompassScale(){const e=this.camera.fov*Math.PI/360,t=op*Math.PI/360,n=Jo*Math.tan(e)/Math.tan(t);for(const i of this.compassSprites)i.scale.set(n,n,1)}disposeCompassLabels(){for(const e of this.compassSprites)e.removeFromParent(),e.material.map?.dispose(),e.material.dispose();this.compassSprites=[]}disposeStarTiers(){for(const e of this.starTiers)this.disposeMesh(e.points);this.starTiers=[]}disposeMesh(e){if(!e)return;e.removeFromParent(),"geometry"in e&&e.geometry.dispose();const t=e.material;for(const n of Array.isArray(t)?t:[t]){const i=n.map;i&&i.dispose(),n.dispose()}}}const Sn=Math.PI/180;function Pa(s,e,t){return Math.max(e,Math.min(t,s))}function Ep(s,e){return s+Math.random()*(e-s)}function Zo(s,e){return(s%(e*2)+e*3)%(e*2)-e}let jo,Qo;function Xb(s){switch(s){case"snow":return qb();case"hail":return Yb()}}function qb(){if(jo)return jo;const s=64,e=document.createElement("canvas");e.width=s,e.height=s;const t=e.getContext("2d"),n=t.createRadialGradient(s/2,s/2,0,s/2,s/2,s/2);return n.addColorStop(0,"rgba(255,255,255,0.95)"),n.addColorStop(.5,"rgba(255,255,255,0.55)"),n.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=n,t.fillRect(0,0,s,s),jo=new Ri(e),jo}function Yb(){if(Qo)return Qo;const s=64,e=document.createElement("canvas");e.width=s,e.height=s;const t=e.getContext("2d"),n=t.createRadialGradient(s/2,s/2,0,s/2,s/2,s/2);return n.addColorStop(0,"rgba(255,255,255,1)"),n.addColorStop(.55,"rgba(255,255,255,0.95)"),n.addColorStop(.8,"rgba(255,255,255,0.4)"),n.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=n,t.fillRect(0,0,s,s),Qo=new Ri(e),Qo}let ec;function Kb(){if(ec)return ec;const s=64,e=document.createElement("canvas");e.width=s,e.height=s;const t=e.getContext("2d"),n=t.createRadialGradient(s/2,s/2,0,s/2,s/2,s/2);return n.addColorStop(0,"rgba(255,255,255,0)"),n.addColorStop(.4,"rgba(255,255,255,0)"),n.addColorStop(.6,"rgba(255,255,255,0.9)"),n.addColorStop(.8,"rgba(255,255,255,0.25)"),n.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=n,t.fillRect(0,0,s,s),ec=new Ri(e),ec}const $b=`
6006
+ `}),i.fragmentShader=r+i.fragmentShader,i.fragmentShader=i.fragmentShader.replace("#include <opaque_fragment>",a+"#include <opaque_fragment>")},e.needsUpdate=!0}meshes=new Map;signatures=new Map;extents=new Map;placed=[];frame;direction=new C;up=new C;lookAt=new Xe;vertex=new C;centre=new C;right=new C;above=new C;set(e,t){this.placed=e,this.frame=t;const n=new Set(e.map(i=>i.sourceId));for(const[i,r]of this.meshes)n.has(i)||(this.dispose(r),this.meshes.delete(i),this.signatures.delete(i),this.extents.delete(i));for(const i of e){let r=this.meshes.get(i.sourceId);r||(r=new Ge(new Di(1,1,jn.SEGMENTS,jn.SEGMENTS),new qn({transparent:!0,depthWrite:!1,depthTest:!0,fog:!1,toneMapped:!1})),this.configureCloudMaterial(r.material),r.frustumCulled=!1,r.layers.set(hg),this.scene.add(r),this.meshes.set(i.sourceId,r)),r.renderOrder=tb+i.renderOrder,r.visible=!i.hidden&&i.shape.transparency<1,r.visible&&this.paint(r,i,t)}}place(e,t,n){const i=this.frame;if(i)for(const r of this.placed){const a=this.meshes.get(r.sourceId);if(!a||!a.visible)continue;const o=this.extents.get(r.sourceId);if(!o)continue;const{bounds:c}=r.shape;let l=c.x+c.width/2,h=c.y+c.height/2,u=!0;if(r.aim){const d=n(jn.directionOf(r.aim,this.direction));d&&Math.abs(d.ndcX)<jn.FURTHEST_NDC&&Math.abs(d.ndcY)<jn.FURTHEST_NDC?(l=(d.ndcX+1)/2*i.canvasWidthPx,h=(1-d.ndcY)/2*i.canvasHeightPx):u=!1}u?this.curve(a,e,t,i,o,l,h,r.distanceM):this.flat(a,e,i,o,r.distanceM)}}static FURTHEST_NDC=4;curve(e,t,n,i,r,a,o,c){const l=a-r.width/2,h=o-r.height/2,u=e.geometry.attributes.position,d=jn.SEGMENTS;let f=0;for(let p=0;p<=d;p++){const v=h+p/d*r.height;for(let m=0;m<=d;m++){const g=l+m/d*r.width;n(g/i.canvasWidthPx*2-1,-(v/i.canvasHeightPx*2-1),this.direction),this.vertex.copy(t.position).addScaledVector(this.direction,c),u.setXYZ(f++,this.vertex.x,this.vertex.y,this.vertex.z)}}u.needsUpdate=!0,e.matrixAutoUpdate=!1,e.matrix.identity(),e.matrixWorldNeedsUpdate=!0,e.scale.set(mt.sizeMAt(c,i.projection.pxToDeg(r.width)),mt.sizeMAt(c,i.projection.pxToDeg(r.height)),1)}flat(e,t,n,i,r){const a=e.geometry.attributes.position,o=jn.SEGMENTS,c=mt.sizeMAt(r,n.projection.pxToDeg(i.width)),l=mt.sizeMAt(r,n.projection.pxToDeg(i.height));this.up.set(0,1,0).applyQuaternion(t.quaternion),this.centre.copy(t.position).addScaledVector(this.direction,r),this.lookAt.lookAt(t.position,this.centre,this.up),this.right.setFromMatrixColumn(this.lookAt,0),this.above.setFromMatrixColumn(this.lookAt,1);let h=0;for(let u=0;u<=o;u++){const d=.5-u/o;for(let f=0;f<=o;f++){const p=f/o-.5;this.vertex.copy(this.centre).addScaledVector(this.right,p*c).addScaledVector(this.above,d*l),a.setXYZ(h++,this.vertex.x,this.vertex.y,this.vertex.z)}}a.needsUpdate=!0,e.matrixAutoUpdate=!1,e.matrix.identity(),e.matrixWorldNeedsUpdate=!0,e.scale.set(c,l,1)}static SEGMENTS=16;static directionOf(e,t){const n=e.azimuthDeg*Math.PI/180,i=e.altitudeDeg*Math.PI/180;return t.set(Math.sin(n)*Math.cos(i),Math.sin(i),-Math.cos(n)*Math.cos(i))}get any(){for(const e of this.meshes.values())if(e.visible)return!0;return!1}get furthestM(){return this.placed.reduce((e,t)=>Math.max(e,t.distanceM),0)}paint(e,t,n){const{shape:i}=t,r=Fa.paintExtent(i);this.extents.set(t.sourceId,r);const a=jn.signatureOf(i,n);if(this.signatures.get(t.sourceId)===a&&e.material.map)return;this.signatures.set(t.sourceId,a);const o=Math.min(n.scale,nb/Math.max(r.width,r.height,1)),c=Math.max(1,Math.ceil(r.width*o)),l=Math.max(1,Math.ceil(r.height*o)),h=e.material.map,u=h?.image??document.createElement("canvas"),d=u.width!==c||u.height!==l;d&&(u.width=c,u.height=l);const f=u.getContext("2d");if(!f)return;f.clearRect(0,0,c,l);const p=new Fa(f);if(p.setStarPoints(n.starPoints),p.setRoll(n.rollRad),p.paintInto(i,r,o),h&&!d){h.needsUpdate=!0;return}h?.dispose();const v=new Ri(u);v.colorSpace=An,v.minFilter=gt,v.generateMipmaps=!1,e.material.map=v,e.material.needsUpdate=!0}static signatureOf(e,t){const{bounds:n}=e;return JSON.stringify([e.kind,Math.round(n.width*10),Math.round(n.height*10),e.color,e.angle,e.transparency,e.haloScale,e.blur??0,e.brightness??0,e.kind==="polygon"?e.points:void 0,t.scale,t.starPoints,t.rollRad])}dispose(e){e.removeFromParent(),e.geometry.dispose(),e.material.map?.dispose(),e.material.dispose()}clear(){for(const e of this.meshes.values())this.dispose(e);this.meshes.clear(),this.signatures.clear(),this.extents.clear(),this.placed=[]}}const ug=3,Yo=800,pa=Math.PI/180;class Ns{constructor(e,t,n=Ns.fetchImage){this.scene=e,this.onImageLoaded=t,this.loadImage=n}meshes=new Map;signatures=new Map;images=new Map;loading=new Map;failed=new Set;references=[];views=new Map;shown=!0;set(e,t=this.views){this.references=e,this.views=t;const n=new Set(e.map(i=>i.id));for(const[i,r]of this.meshes)n.has(i)||(this.dispose(r),this.meshes.delete(i),this.signatures.delete(i));for(const[i,r]of this.images){const a=e.find(o=>o.id===i);a&&a.src===r.texture.userData.src||(r.texture.dispose(),this.images.delete(i))}for(const i of e){const r=this.images.get(i.id);if(!r){this.load(i);continue}this.build(i,r)}}setShown(e){this.shown=e;for(const t of this.meshes.values())t.visible=e&&this.opacityOf(t.userData.id)>0}setView(e,t){this.views.set(e,t);const n=this.meshes.get(e);n&&this.applyOpacity(n,e)}get any(){for(const e of this.meshes.values())if(e.visible)return!0;return!1}place(e){for(const t of this.meshes.values())t.visible&&(t.position.copy(e.position),t.updateMatrixWorld())}get furthestM(){return this.meshes.size>0?Yo:0}directionOfPixel(e,t,n,i){const r=this.images.get(e.id),a=r?r.width/r.height:1,o=Math.tan(e.registration.fovDeg/2*pa),c=o*a;return i.set((t*2-1)*c,(1-n*2)*o,-1).normalize(),i.applyQuaternion(Ns.orientation(e))}aspectOf(e){const t=this.images.get(e);return t?t.width/t.height:void 0}failedToLoad(e){return this.failed.has(e)}load(e){const t=e.src;if(this.loading.has(e.id)||this.failed.has(t))return;const n=this.loadImage(t).then(i=>{this.loading.delete(e.id);const r=this.references.find(a=>a.id===e.id);if(!r||r.src!==t){i.texture.dispose();return}i.texture.userData.src=t,this.images.set(e.id,i),this.build(r,i),this.onImageLoaded()},()=>{this.loading.delete(e.id),this.failed.add(t)});this.loading.set(e.id,n)}static async fetchImage(e){const t=await fetch(e);if(!t.ok)throw new Error(`${e}: ${t.status}`);const n=await createImageBitmap(await t.blob(),{imageOrientation:"flipY"}),i=new nn(n);return i.flipY=!1,i.colorSpace=An,i.minFilter=gt,i.magFilter=gt,i.generateMipmaps=!1,i.needsUpdate=!0,{texture:i,width:n.width,height:n.height}}build(e,t){const n=Ns.signatureOf(e,t);let i=this.meshes.get(e.id);if(i&&this.signatures.get(e.id)===n){this.applyOpacity(i,e.id);return}i&&(this.dispose(i),this.meshes.delete(e.id)),i=new Ge(Ns.geometryOf(e,t),new qn({map:t.texture,transparent:!0,depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1})),e.kind==="panorama"&&(i.material.side=Nt),i.frustumCulled=!1,i.layers.set(ug),i.userData.id=e.id,i.quaternion.copy(Ns.orientation(e)),this.scene.add(i),this.meshes.set(e.id,i),this.signatures.set(e.id,n),this.applyOpacity(i,e.id)}static geometryOf(e,t){if(e.kind==="panorama"){const a=new an(Yo,64,32,Math.PI/2,Math.PI*2),o=a.attributes.uv;for(let c=0;c<o.count;c++)o.setX(c,1-o.getX(c));return o.needsUpdate=!0,a}const n=2*Yo*Math.tan(e.registration.fovDeg/2*pa),i=n*(t.width/Math.max(t.height,1)),r=new Di(i,n);return r.translate(0,0,-Yo),r}static orientation(e){const{headingDeg:t,pitchDeg:n,rollDeg:i}=e.registration,r=new xt;return r.rotation.set(n*pa,-t*pa,-(i??0)*pa,"YXZ"),r.quaternion}opacityOf(e){const t=this.references.find(i=>i.id===e);return this.views.get(e)?.opacity??t?.opacity??0}applyOpacity(e,t){const n=this.opacityOf(t);e.material.opacity=n,e.visible=this.shown&&n>0}static signatureOf(e,t){const{headingDeg:n,pitchDeg:i,rollDeg:r,fovDeg:a}=e.registration;return[e.kind,e.src,t.width,t.height,n,i,r??0,a].join("|")}dispose(e){this.scene.remove(e),e.geometry.dispose(),e.material.dispose()}disposeAll(){for(const e of this.meshes.values())this.dispose(e);this.meshes.clear(),this.signatures.clear();for(const e of this.images.values())e.texture.dispose();this.images.clear()}}function ib(s,e){return JSON.stringify(s.cloudLayers)===JSON.stringify(e.cloudLayers)&&s.cloudCover===e.cloudCover&&s.cloudDarkness===e.cloudDarkness&&s.cloudBaseM===e.cloudBaseM&&s.highCloudCover===e.highCloudCover&&s.iceCrystalAlignment===e.iceCrystalAlignment&&s.lowerCloudCover===e.lowerCloudCover&&s.precipitationType===e.precipitationType&&s.precipitationIntensity===e.precipitationIntensity&&s.windDirectionDeg===e.windDirectionDeg&&s.windSpeed===e.windSpeed&&s.storm===e.storm}const Ko=900,Kl=1,ep=.5,wa=900,sb=6371e3,rb=3e4;function tp(s){const e=Math.sqrt(2*sb*Math.max(s,0));return Math.max(wa,Math.min(e,rb))}const $l=.5,Jl=850,np=.03,Sr=850,Zl=4,jl=1.5,ip=-1,ab=6,Ou=-4,sp=.2,$o=2600,ob=.97,cb=.38,rp=Ou,lb=3,hb=.15,ub=.6,db=40,fb=30,pb=[0,45,90,135,180,225,270,315],mb={en:["N","NE","E","SE","S","SW","W","NW"],fr:["N","NE","E","SE","S","SO","O","NO"]},gb=["en","fr"],ap=880,Jo=40,op=60,vb=10,Mb=1,xb=150,_b=55,yb=.5,Sb=2.05,cp=.265,lp=[[0,0],...Array.from({length:8},(s,e)=>{const t=e*Math.PI/4;return[Math.cos(t)*cp,Math.sin(t)*cp]})],Ql=700,eh=250/1e3,bb=12,hp=5,th=6,Ts=[.92,.92,.95],nh=[.15,.15,.19],up={snow:{fallSpeedMPerS:2,size:.3,color:new oe(1,1,1),driftSensitivity:1,radiusM:25,topYM:20,opacity:.75,poolSize:2400},hail:{fallSpeedMPerS:14,size:.5,color:new oe(.95,.98,1),driftSensitivity:.25,radiusM:25,topYM:10,opacity:.95,poolSize:1200}},Er=0,ih=0,wb=150,dp=3e3,ma=20,Eb=15,fp=Er,Ab=40,pp=1,Tb=9;function mp(s){return pp+(Tb-pp)*s}const Rb=new oe(.75,.82,.92),Db=10,Cb=.5;function Pb(s){return Pa(s/Db,Cb,1)}const br=200,gp=.18,vp=.32,Ib=.35,Lb=new oe(.85,.9,.98),Mp=5,xp=.85,_p=.01;function sh(s,e){return Math.round(s*(_p+(1-_p)*e))}const yp=230,Sp=.7,bp=.05,Nb=.6,Ob=.7,Ub=.15,wp=.35,Fb=3,kb=1/12,zb=.5,pi=new oe(.82,.86,1),Bb=2500,Hb=1.6,Gb=1.2,Vb=2.2,Wb={Venus:new oe(1,.96,.85),Mars:new oe(1,.55,.4),Jupiter:new oe(.95,.87,.72),Saturn:new oe(.92,.86,.68)};class Hn{renderer;scene=new Va;phenomena=new jn(this.scene);references=new Ns(this.scene,()=>this.render());camera;celestialGroup=new en;skyMesh;groundMesh;terrainMesh;terrainProviders;terrainOrigin;terrainBuildToken=0;terrainAttribution;decorModelProvider=QS[0].create();decorModelToken=0;decorModelCredits=new Map;starTiers=[];bodyMeshes=new Map;hitAreas=new Map;glareSprites=new Map;decorObjects=[];decorGroups=new Map;decorReferencePose;decorCurrentPose;decorTime=0;celestialLight=new Y0(16777215,0);celestialLightTarget=new xt;skyLight=new yv(16777215,0,0);streetlightLights=new Map;compassSprites=[];showCompass=!1;compassHovered=!1;compassForced=!1;animationFrameId=null;resolution;cssSize={width:1,height:1};frameDirty=!1;flushFrameId=null;framesDriven=!1;lastFrameTimeMs;raycaster=new Dl;weather=Lp;observerElevationM=0;groundRadius=wa;terrainRadius=wa;cloudRendering="volume";layeredClouds;cloudLayerOffsetsM={};cloudOffsetM=new C;cloudFieldOffset=new C;cloudMesh;cirrusMesh;cirrusMaterial;cirrusUniforms;cloudMaterial;cloudUniforms;precipitationPoints;precipitationPositions;precipitationPhase;precipitationSpeedJitter;precipitationWobbleFreqJitter;precipitationWobbleAmpJitter;precipitationBounceRemaining;precipitationBounceHeight;precipitationBounceDuration;precipitationBounceVelX;precipitationBounceVelZ;precipitationUniforms;rainSystem;rainSplashSystem;rainCameraDirection=new C;rainLastVerticalFacing=-1;rainViewportSize=new Pe;lightningArmed=!1;lightningFlashes=[];lightningLevel=0;lightningBolt;lightningLight=new Y0(16777215,0);baseFogColor=[0,0,0];lastSunPosition;lensFlare;sunCloudTransmission=1;sunUnhiddenFraction=1;lensFlareArtifactIntensity=0;sunWorldPosition=new C;sunVisible=!1;lensFlareScratch=new C;sunOcclusionRaycaster=new Dl;sunOcclusionDirectionScratch=new C;sunOcclusionRightScratch=new C;sunOcclusionUpScratch=new C;ufoOcclusionRaycaster=new Dl;projectionKind="rectilinear";starPoints=0;namedStars=[];equidistantPass;depthOfFieldPass;exposureAccumulation;exposureInstants=1;get developingExposure(){return this.exposureInstants>1&&this.exposureInstantAt!==void 0}static EXPOSURE_BUDGET_MS=12;static exposureInstantsPerFrame(e){return Math.max(3,Math.round(6e6/Math.max(1,e)))}exposureFrameId=null;exposureInstantsDone=0;exposureInstantAt;restatingExposure=!1;lensOptics;instrumentMagnitudeGain=0;meteorSystem;cometTail;satelliteField;iceHalos;rainbow;skyGlow;cometKey;novaKeys=new Set;constructor(e,t=y1()){this.renderer=new Iy({canvas:e,antialias:!0}),this.resolution=new yt(Math.min(window.devicePixelRatio||1,2),this.renderer.getContext()),this.renderer.setPixelRatio(this.resolution.pixelRatio),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=Ea,this.camera=new Tn(60,e.width/Math.max(e.height,1),.1,Ko*1.2),this.camera.position.set(0,1.6,0),this.terrainProviders=t,this.celestialLight.shadow.mapSize.set(1024,1024),this.celestialLight.shadow.camera.left=-120,this.celestialLight.shadow.camera.right=120,this.celestialLight.shadow.camera.top=120,this.celestialLight.shadow.camera.bottom=-120,this.celestialLight.shadow.camera.near=1,this.celestialLight.shadow.camera.far=1e3,this.celestialLight.shadow.bias=-.0015,this.celestialLight.target=this.celestialLightTarget,this.lightningLight.color.copy(pi),this.scene.add(this.celestialLight,this.celestialLightTarget,this.skyLight,this.lightningLight),this.scene.add(this.celestialGroup)}get currentTerrainAttribution(){return this.terrainAttribution}resize(e,t){this.cssSize.width=e,this.cssSize.height=t,this.renderer.setSize(e,t,!1),this.camera.aspect=e/Math.max(t,1),this.camera.updateProjectionMatrix(),this.render()}setCloudRendering(e){e!==this.cloudRendering&&(this.cloudTransmissionMemo.clear(),this.cloudRendering=e,this.layeredClouds?.dispose(),this.layeredClouds=void 0,this.buildClouds(),this.buildCirrus(),this.render())}setCloudOffset(e,t={}){this.cloudOffsetM.set(e.x,0,e.z),this.cloudLayerOffsetsM=t,this.layeredClouds?.setOffsets(e,t),this.cloudFieldOffset.set(e.x*eh,0,e.z*eh);for(const n of[this.cloudUniforms,this.cirrusUniforms])n?.fieldOffset.value.copy(this.cloudFieldOffset);this.iceHalos?.setCloudOffset(this.layeredClouds?.cirrusMask?.offset??this.cloudFieldOffset)}setObserverPose(e){const t=((e.rollDeg??0)+this.gaitOffset.rollDeg)*Sn,n=(e.pitchDeg+this.lookPitchDeg+this.gaitOffset.pitchDeg)*Sn;if(e.headingDeg!==void 0?this.camera.rotation.set(n,-(e.headingDeg+this.lookYawDeg+this.gaitOffset.yawDeg)*Sn,t,"YXZ"):this.camera.rotation.set(n,this.camera.rotation.y,t,"YXZ"),e.elevationM!==this.observerElevationM&&(this.observerElevationM=e.elevationM,this.syncCloudLayer(),Math.abs(tp(e.elevationM)-this.groundRadius)>1&&(this.buildGround(),this.celestialGroup.scale.setScalar(this.groundRadius/wa),this.camera.far=Math.max(Ko*1.2,this.groundRadius*2.5),this.camera.updateProjectionMatrix())),this.terrainMesh&&this.terrainOrigin&&e.lat!==void 0&&e.lng!==void 0){const i=rn(this.terrainOrigin.lat,this.terrainOrigin.lng,e.lat,e.lng);this.terrainMesh.position.x=i.x,this.terrainMesh.position.z=i.z}this.poseCameraY=this.groundYUnder(0,0)+1.6+e.elevationM,this.camera.position.y=this.poseCameraY,this.celestialGroup.position.y=this.camera.position.y,this.camera.fov!==e.fovDeg&&(this.camera.fov=e.fovDeg,this.camera.updateProjectionMatrix(),this.updateCompassScale())}setTerrainProviders(e){this.terrainProviders=e,this.disposeMesh(this.terrainMesh),this.terrainMesh=void 0,this.terrainOrigin=void 0,this.terrainAttribution=void 0,this.applyGroundDepthWrite(),this.terrainBuildToken++}setTerrainOrigin(e,t,n){if(e===void 0||t===void 0)return;const i=this.groundRadius;if(this.terrainOrigin&&Math.abs(this.terrainRadius-i)<i*.1){const{x:c,z:l}=rn(e,t,this.terrainOrigin.lat,this.terrainOrigin.lng);if(Math.sqrt(c*c+l*l)<xb*(i/wa))return}const r=this.terrainOrigin,a=this.terrainRadius;this.terrainOrigin={lat:e,lng:t},this.terrainRadius=i;const o=++this.terrainBuildToken;_S(e,t,this.terrainProviders,i).then(({mesh:c,attribution:l})=>{if(o!==this.terrainBuildToken)return;const h=this.terrainMesh,u=r?rn(e,t,r.lat,r.lng):void 0;h&&u&&Math.hypot(u.x,u.z)<=a&&(c.position.y=h.position.y+this.groundYOfPatch(h,u.x,u.z)),this.disposeMesh(this.terrainMesh),c.renderOrder=Mb,this.terrainMesh=c,this.compileNextFrameOffThread(),this.terrainAttribution=l,this.scene.add(c),this.applyGroundDepthWrite(),this.decorCurrentPose&&(this.setObserverPose(this.decorCurrentPose),this.updateDecorAnchoring(this.decorReferencePose,this.decorCurrentPose,this.decorTime)),this.render(),n?.()}).catch(c=>{console.warn("Terrain build failed, keeping the flat ground fallback:",c),n?.()})}setShowCompass(e){this.showCompass!==e&&(this.showCompass=e,this.disposeCompassLabels(),e&&this.buildCompassLabels(),this.render())}applyLensFlareTint(e){if(!this.lensFlare)return;const t=_b*this.sunCloudTransmission;this.lensFlare.uniforms.uColorGain.value.setRGB(t*e[0],t*e[1],t*e[2]),this.applyDazzleStrength()}applyDazzleStrength(){if(!this.lensFlare)return;const e=this.lastSunPosition?.altitudeDeg??-90,t=h5(e)*this.sunCloudTransmission*this.sunUnhiddenFraction,n=os(e);this.lensFlare.uniforms.uDazzleColour.value.setRGB(n[0],n[1],n[2]),this.lensFlare.uniforms.uVeilStrength.value=Sb**2*Math.max(0,t)}setCompassHovered(e){this.compassHovered!==e&&(this.compassHovered=e,this.updateCompassVisibility())}setCompassForced(e){this.compassForced!==e&&(this.compassForced=e,this.updateCompassVisibility())}updateCompassVisibility(){const e=this.compassHovered||this.compassForced;if(this.compassSprites.some(t=>t.visible!==e)){for(const t of this.compassSprites)t.visible=e;this.developingExposure?this.exposureInstantsDone>0&&this.presentExposure():this.render()}}setWeather(e){this.cloudTransmissionMemo.clear(),!ib(this.weather,e)&&(this.weather=e,this.buildClouds(),this.buildCirrus(),this.buildPrecipitation(),this.lightningArmed=e.storm&&e.cloudDarkness>=zb,this.syncAnimationLoop(),this.render())}setDecor(e){if(this.decorObjects!==e){this.decorObjects=e,this.decorModelToken++,this.decorModelCredits.clear();for(const t of this.decorGroups.values())t.removeFromParent(),sn.dispose(t);this.decorGroups.clear(),this.streetlightLights.clear();for(const t of e){const n=sn.build(t,t.lit??!1);this.scene.add(n),this.decorGroups.set(t.id,n),t.kind==="streetlight"&&this.addStreetlightLight(t.id,n),this.loadDecorModel(t,this.decorModelToken)}this.celestialLight.castShadow=this.decorGroups.size>0}}setDecorModelProvider(e){this.decorModelProvider=e;const t=this.decorObjects;this.decorObjects=[],this.setDecor(t)}get currentDecorModelCredits(){return[...this.decorModelCredits.values()]}async loadDecorModel(e,t){const n=e.model;if(!(!n||!sn.usesModel(e)))try{const i=n.url?void 0:n.id?await this.decorModelProvider.entry(n.id):void 0,r=n.url??i?.url,a=n.credit??i?.credit;if(!r||!a)return;const o=await eb(r);if(t!==this.decorModelToken)return;const c=this.decorGroups.get(e.id);if(!c)return;sn.applyModel(c,e,o,{headingOffsetDeg:n.headingOffsetDeg??i?.headingOffsetDeg,depictedSizeM:i?.sizeM}),this.decorModelCredits.set(e.id,a),this.render()}catch(i){console.warn(`Keeping the built-in shape for decor "${e.id}":`,i)}}updateDecorAnchoring(e,t,n=0){this.decorReferencePose=e,this.decorCurrentPose=t,this.decorTime=n;const i=e?.lat!==void 0&&e.lng!==void 0&&t?.lat!==void 0&&t?.lng!==void 0?rn(e.lat,e.lng,t.lat,t.lng):{x:0,z:0},r=this.decorObjects.find(l=>l.witnessSide!==void 0&&Fp(l.kind));if(this.terrainMesh&&this.terrainOrigin&&t?.lat!==void 0&&t.lng!==void 0){const l=rn(this.terrainOrigin.lat,this.terrainOrigin.lng,t.lat,t.lng);this.terrainMesh.position.x=l.x-(r?0:this.gaitOffset.eastM),this.terrainMesh.position.z=l.z+(r?0:this.gaitOffset.northM)}r||(i.x-=this.gaitOffset.eastM,i.z+=this.gaitOffset.northM,this.camera.position.y=this.poseCameraY+this.gaitOffset.upM,this.celestialGroup.position.y=this.camera.position.y);const a={x:0,z:0};let o=0;if(r){const l=sn.occupantView(r),h=-(r.headingDeg??0)*Sn,u=l.x*Math.cos(h)+l.z*Math.sin(h),d=-l.x*Math.sin(h)+l.z*Math.cos(h),f=r.eastM+i.x,p=-r.northM+i.z;a.x=-(f+u),a.z=-(p+d),this.camera.position.y=this.groundYUnder(f,p)+l.eyeY,this.camera.rotation.set(this.indoorLookPitchDeg*Sn,-(l.headingDeg+this.indoorLookYawDeg)*Sn,0,"YXZ")}for(const l of this.decorObjects){const h=this.decorGroups.get(l.id);if(!h)continue;const u=Fu(l,n),d=u.eastM+i.x+a.x,f=-u.northM+i.z+a.z,p=this.terrainMesh,v=`${p?.geometry.uuid}:${(d-(p?.position.x??0)).toFixed(3)}:${(f-(p?.position.z??0)).toFixed(3)}:${(p?.position.y??0).toFixed(3)}:${u.headingDeg}:${u.altitudeM}`;if(h.userData.footprintKey!==v&&(h.userData.footprintGroundY=this.groundUnderFootprint(l,d,f,u.headingDeg,u.altitudeM),h.userData.footprintKey=v),h.position.set(d,h.userData.footprintGroundY+u.altitudeM,f),l.kind==="crop"){const m=Math.hypot(d,f);h.visible=m<=wb}if(u.headingDeg!==void 0&&(h.rotation.y=-u.headingDeg*Sn),l.kind==="crop"&&h.visible){const m=this.terrainMesh,g=[m?.geometry.uuid,d-(m?.position.x??0),f-(m?.position.z??0),h.position.y-(m?.position.y??0),u.headingDeg,u.altitudeM].map(b=>typeof b=="number"?b.toFixed(4):b).join(":");h.userData.cropGroundKey!==g&&(sn.fitCropToGround(h,(b,w)=>this.groundYUnder(b,w)+u.altitudeM),h.userData.cropGroundKey=g)}o=Math.max(o,h.position.distanceTo(this.camera.position))}const c=Math.max(Ko*1.2,this.groundRadius*2.5,o*1.2);Math.abs(this.camera.far-c)>1&&(this.camera.far=c,this.camera.updateProjectionMatrix())}groundYUnder(e,t){const n=this.terrainMesh;return n?n.position.y+this.groundYOfPatch(n,e-n.position.x,t-n.position.z):ih}groundYOfPatch(e,t,n){const i=e.geometry.getAttribute("position"),r=Math.round(Math.sqrt(i.count));if(r<2||r*r!==i.count)return ih;const a=i.getX(0),o=i.getX(r-1),c=i.getZ(0),l=i.getZ((r-1)*r),h=Pa((t-a)/(o-a)*(r-1),0,r-1),u=Pa((n-c)/(l-c)*(r-1),0,r-1);if(!Number.isFinite(h)||!Number.isFinite(u))return ih;const d=Math.min(Math.floor(h),r-2),f=Math.min(Math.floor(u),r-2),p=h-d,v=u-f,m=(S,E)=>i.getY(S*r+E),g=m(f,d),b=m(f,d+1),w=m(f+1,d),_=m(f+1,d+1);return p+v<=1?g+(b-g)*p+(w-g)*v:_+(w-_)*(1-p)+(b-_)*(1-v)}groundUnderFootprint(e,t,n,i,r=0){return sn.groundUnderFootprint(e,t,n,i,(a,o)=>this.groundYUnder(a,o),r)}lookYawDeg=0;lookPitchDeg=0;poseCameraY=1.6;setGait(e){this.gaitOffset=e}gaitOffset={eastM:0,northM:0,upM:0,rollDeg:0,pitchDeg:0,yawDeg:0};setLookOffset(e,t){this.lookYawDeg=e,this.lookPitchDeg=t}indoorLookYawDeg=0;indoorLookPitchDeg=0;setIndoorLook(e,t){this.indoorLookYawDeg=e,this.indoorLookPitchDeg=t}updateDecorLitState(e,t=0){for(const n of this.decorObjects){const i=this.decorGroups.get(n.id);if(i&&n.lights?.length&&sn.setLights(i,n.lights,e,i.position.distanceTo(this.camera.position),t),n.kind!=="streetlight"&&n.kind!=="vehicle")continue;const r=this.decorGroups.get(n.id);if(!r)continue;const a=s1(n,e);sn.setLit(r,n.kind,a);const o=this.streetlightLights.get(n.id);o&&(o.visible=a)}}addStreetlightLight(e,t){const n=sn.bodyOf(t),i=n.children.find(a=>a.userData.emissive);if(!i)return;const r=new wv(16764006,db,fb);r.position.copy(i.position).multiply(n.scale),r.castShadow=!0,r.shadow.mapSize.set(512,512),r.shadow.bias=-.002,t.add(r),this.streetlightLights.set(e,r)}setAstronomy(e){const t=uu(e.sun.altitudeDeg),n=t.horizon;this.baseFogColor=n,this.lastSunPosition=e.sun,this.buildSky(e.sun),this.buildGround(),this.updateCloudLighting(e.sun,n),this.updateCelestialLight(e,t.zenith,n);const i=du(e.sun.altitudeDeg,this.instrumentMagnitudeGain);this.buildStars(e.stars,i),this.setBodyMesh("sun",e.sun,Zl,new oe(1,.96,.88),e.sun.magnitude),this.setMoonMesh(e.moon,i),this.buildPlanets(e.planets,i),this.buildComet(e.comet,i),this.buildNovae(e.novae??[],i),this.buildIceHalos(e.sun,e.moon),this.buildRainbow(e.sun,e.moon),this.buildSkyGlow(e,t.zenith),this.scene.fog instanceof yc?(this.scene.fog.color.setRGB(...n),this.scene.fog.near=this.groundRadius*.2,this.scene.fog.far=this.groundRadius):this.scene.fog=new yc(new oe(...n),this.groundRadius*.2,this.groundRadius),this.syncAnimationLoop(),this.render()}setSatellites(e){if(e.length===0&&!this.satelliteField?.count)return;this.satelliteField||(this.satelliteField=new OS(Jl),this.celestialGroup.add(this.satelliteField.object));const t=du(this.lastSunPosition?.altitudeDeg??-90,this.instrumentMagnitudeGain);this.satelliteField.set(e,t,n=>this.cloudTransmission(n)),this.render()}pickSatelliteAt(e,t){if(!this.satelliteField?.count)return;this.aimAtScreenPoint(this.raycaster,e,t);const n=Math.cos(np*this.camera.fov*Math.PI/180),i=this.satelliteField.nearest(this.raycaster.ray.direction,n);return i&&this.groundHides(e,t)?void 0:i}updateCelestialLight(e,t,n){this.skyLight.color.setRGB(t[0],t[1],t[2]),this.skyLight.groundColor.setRGB(n[0],n[1],n[2]),this.skyLight.intensity=ub;const i=e.sun.altitudeDeg>=rp,r=!i&&e.moon.altitudeDeg>=rp;if(!i&&!r){this.celestialLight.intensity=0;return}const a=i?e.sun:e.moon,{x:o,y:c,z:l}=jt(a.altitudeDeg,a.azimuthDeg,Sr);this.celestialLight.position.set(o,c,l);const h=os(a.altitudeDeg);this.celestialLight.color.setRGB(h[0],h[1],h[2]);const u=Math.max(0,Math.sin(Math.max(a.altitudeDeg,0)*Sn));this.celestialLight.intensity=(i?lb:hb)*u,this.celestialLight.castShadow=this.decorGroups.size>0}setMeteorShower(e,t,n){this.meteorSystem||(this.meteorSystem=new Jt,this.celestialGroup.add(this.meteorSystem.object)),this.meteorSystem.setShower(e,t,n)}get meteorSchedule(){return this.meteorSystem?.schedule??[]}meteorMidpoint(e){return this.meteorSystem?.midpointOf(e)}updateMeteors(e){this.meteorSystem?.update(e)}setInstrument(e){this.projectionKind=e.projection;const t=Vt.starPointsOf(e),n=Vt.flareArtifactsOf(e);t===this.starPoints&&n===this.lensFlareArtifactIntensity||(this.starPoints=t,this.lensFlareArtifactIntensity=n,this.lensFlare&&(this.lensFlare.uniforms.uStarPoints.value=t,this.lensFlare.uniforms.uFlareIntensity.value=n),this.render())}setInstrumentGain(e){this.instrumentMagnitudeGain=Number.isFinite(e)?e:0}render(){this.restatingExposure||(this.frameDirty=!0,!(this.animationFrameId!==null||this.framesDriven||this.flushFrameId!==null)&&(this.flushFrameId=requestAnimationFrame(()=>{this.flushFrameId=null,this.drawIfDirty()})))}drawIfDirty(){if(!(!this.frameDirty||this.contextReleased)){if(this.compileBeforeNextDraw){this.compileBeforeNextDraw=!1;const e=this.compileOffThread().then(()=>{this.compiling===e&&(this.compiling=void 0,this.render())});this.compiling=e;return}if(!this.compiling){this.frameDirty=!1,this.resolution.beginDrawing();try{this.renderOnce()}finally{this.resolution.endDrawing()}this.developingExposure&&this.startExposure()}}}compileBeforeNextDraw=!1;compiling;static COMPILE_WAIT_MS=1500;compileOffThread(){const e=this.renderer.compile(this.scene,this.camera);if(!this.renderer.extensions.get("KHR_parallel_shader_compile"))return Promise.resolve();const t=this.renderer.properties,n=performance.now()+Hn.COMPILE_WAIT_MS;return new Promise(i=>{const r=()=>{if(this.contextReleased)return i();for(const a of e){const o=t.get(a)?.currentProgram;(!o||o.isReady())&&e.delete(a)}e.size===0||performance.now()>n?i():setTimeout(r,10)};r()})}compileNextFrameOffThread(){this.compileBeforeNextDraw=!0}contextReleased=!1;releaseContext(){this.contextReleased||(this.contextReleased=!0,this.stopTwinkle(),this.cancelFlush(),this.cancelExposure(),this.compiling=void 0,this.renderer.forceContextLoss())}restoreContext(){this.contextReleased&&(this.contextReleased=!1,this.renderer.forceContextRestore(),this.compileNextFrameOffThread(),this.syncAnimationLoop(),this.render())}cancelFlush(){this.flushFrameId!==null&&(cancelAnimationFrame(this.flushFrameId),this.flushFrameId=null)}frame(e){if(this.animationsRunning){const t=this.lastFrameTimeMs===void 0?0:e-this.lastFrameTimeMs;this.lastFrameTimeMs=e,this.hasAnimations()&&this.animate(e,t);const n=this.resolution.update(e,t);n!==void 0&&this.applyPixelRatio(n)}this.drawIfDirty()}animate(e,t){const n=Math.min(t/1e3,kb);this.updateTwinkle(e/1e3),this.updatePrecipitation(e/1e3,n),this.updateRain(n),this.lensFlare&&(this.lensFlare.uniforms.uTime.value=e/1e3),this.developingExposure||(this.frameDirty=!0)}setMaxPixelRatio(e){this.resolution.maximum=e,this.renderer.getPixelRatio()!==this.resolution.pixelRatio&&this.applyPixelRatio(this.resolution.pixelRatio)}applyPixelRatio(e){this.renderer.setPixelRatio(e),this.renderer.setSize(this.cssSize.width,this.cssSize.height,!1),this.frameDirty=!0}setExposure(e,t){const n=t?Math.max(1,Math.round(e)):1;if(n===this.exposureInstants&&(n===1||t===this.exposureInstantAt)){this.exposureInstantAt=t;return}this.exposureInstants=n,this.exposureInstantAt=t,n===1&&(this.cancelExposure(),this.exposureAccumulation?.dispose(),this.exposureAccumulation=void 0),this.render()}renderOnce(e){if(this.onMapSubjectBounds){const r=this.mapSubjectBounds();e?this.exposureSubjectBounds.push(...r):this.onMapSubjectBounds(r)}const t=this.usableEquidistantPass();this.phenomena.setCloudLayers(this.layeredClouds?.volumes??[]),this.phenomena.place(this.camera,(r,a,o)=>this.directionAtScreenPoint(r,a,o),r=>this.screenPointOf(r)),this.references.place(this.camera);const n=Math.max(this.phenomena.furthestM,this.references.furthestM)*1.2;n>this.camera.far&&(this.camera.far=n,this.camera.updateProjectionMatrix());const i=this.renderer.getRenderTarget();if(!t){this.updateLensFlarePosition();const r=this.usableDepthOfFieldPass();r?.setEncodesOutput(e===void 0),this.skyGlow?.setDestinationEncoded(e===void 0&&!r),e&&this.renderer.setRenderTarget(e),r?r.render(this.renderer,this.scene,this.camera,()=>this.renderOverlayPasses()):(this.renderer.render(this.scene,this.camera),this.renderOverlayPasses()),e&&this.renderer.setRenderTarget(i);return}t.setEncodesOutput(e===void 0),this.skyGlow?.setDestinationEncoded(!1),e&&this.renderer.setRenderTarget(e),t.render(this.renderer,this.scene,this.camera,this.camera.fov,()=>this.updateLensFlarePosition(),()=>this.renderOverlayPasses()),e&&this.renderer.setRenderTarget(i)}renderOverlayPasses(){this.renderReferencesPass(),this.renderPhenomenaPass()}renderReferencesPass(){if(!this.references.any)return;const e=this.renderer.autoClear,t=this.renderer.shadowMap.autoUpdate;this.renderer.autoClear=!1,this.renderer.shadowMap.autoUpdate=!1,this.camera.layers.set(ug),this.renderer.render(this.scene,this.camera),this.camera.layers.set(0),this.renderer.autoClear=e,this.renderer.shadowMap.autoUpdate=t}setReferences(e){this.references.set(e)}referenceAspect(e){return this.references.aspectOf(e)}directionAt(e,t){return this.directionAtScreenPoint(e,t,new C)}referenceFailedToLoad(e){return this.references.failedToLoad(e)}setReferencesShown(e){this.references.setShown(e),this.render()}setReferenceView(e,t){this.references.setView(e,t),this.render()}renderPhenomenaPass(){if(!this.phenomena.any)return;const e=this.renderer.autoClear,t=this.renderer.shadowMap.autoUpdate;this.renderer.autoClear=!1,this.renderer.shadowMap.autoUpdate=!1,this.renderer.clearDepth();for(const n of this.decorObjects){const i=this.decorGroups.get(n.id);i&&Hn.markDecorDepth(i,n.kind!=="crop")}this.camera.layers.set(Kl),this.scene.overrideMaterial=this.decorDepthMaterial,this.renderer.render(this.scene,this.camera),this.scene.overrideMaterial=null,this.camera.layers.set(hg),this.renderer.render(this.scene,this.camera),this.camera.layers.set(0),this.renderer.autoClear=e,this.renderer.shadowMap.autoUpdate=t}decorDepthMaterial=new qn({colorWrite:!1});static markDecorDepth(e,t){e.traverse(n=>{if(!(n instanceof Ge))return;const i=Array.isArray(n.material)?n.material[0]:n.material;t&&i.depthWrite!==!1&&i.blending!==Un?n.layers.enable(Kl):n.layers.disable(Kl)})}startExposure(){this.cancelExposure(),this.exposureSubjectBounds=[];const e=this.renderer.getDrawingBufferSize(new Pe),t=Math.max(1,Math.round(e.x)),n=Math.max(1,Math.round(e.y));this.exposureAccumulation||(this.exposureAccumulation=new Gy(t,n)),this.exposureAccumulation.resize(t,n),this.exposureAccumulation.open(this.renderer),this.exposureInstantsDone=0,this.exposureFrameId=requestAnimationFrame(()=>this.developExposure())}developExposure(){this.exposureFrameId=null;const e=this.exposureInstantAt,t=this.exposureAccumulation;if(!e||!t)return;const n=1/this.exposureInstants;this.resolution.beginDrawing();const i=performance.now()+Hn.EXPOSURE_BUDGET_MS,r=Hn.exposureInstantsPerFrame(t.instantTarget.width*t.instantTarget.height);let a=0;do{this.restateAt(e,this.exposureInstantsDone);const o=this.compassSprites.map(c=>c.visible);for(const c of this.compassSprites)c.visible=!1;try{this.renderOnce(t.instantTarget)}finally{this.compassSprites.forEach((c,l)=>{c.visible=o[l]})}t.add(this.renderer,n),this.exposureInstantsDone++,a++}while(this.exposureInstantsDone<this.exposureInstants&&performance.now()<i&&a<r);this.restateAt(e,0),this.presentExposure(),this.resolution.endDrawing(),this.exposureInstantsDone<this.exposureInstants&&(this.exposureFrameId=requestAnimationFrame(()=>this.developExposure()))}presentExposure(){if(this.exposureAccumulation?.develop(this.renderer,this.exposureInstants/this.exposureInstantsDone),this.onMapSubjectBounds?.(this.exposureSubjectBounds),!this.compassSprites.some(r=>r.visible))return;const e=new Va,t=new Ys(-1,1,1,-1,0,2),n=Jo/(ap*Math.tan(op*Sn/2));for(const r of this.compassSprites){if(!r.visible)continue;const a=r.getWorldPosition(new C).sub(this.camera.position).normalize(),o=this.screenPointOf(a);if(!o)continue;const c=new pr(r.material);c.position.set(o.ndcX,o.ndcY,-1),c.scale.set(n/this.camera.aspect,n,1),e.add(c)}const i=this.renderer.autoClear;this.renderer.autoClear=!1;try{this.renderer.render(e,t)}finally{this.renderer.autoClear=i}}onMapSubjectBounds;exposureSubjectBounds=[];mapSubjectBounds(){const e=[],t=new ai,n=new C;for(const i of this.decorObjects){if(!i.track?.length&&i.kind!=="aircraft"&&i.kind!=="vehicle")continue;const r=this.decorGroups.get(i.id);if(!r?.visible||(t.setFromObject(r),t.isEmpty()))continue;let a=1/0,o=-1/0,c=1/0,l=-1/0;for(const h of[t.min.x,t.max.x])for(const u of[t.min.y,t.max.y])for(const d of[t.min.z,t.max.z]){n.set(h,u,d).sub(this.camera.position).normalize();const f=this.screenPointOf(n);if(!f)continue;const p=(f.ndcX+1)/2,v=(1-f.ndcY)/2;a=Math.min(a,p),o=Math.max(o,p),c=Math.min(c,v),l=Math.max(l,v)}Number.isFinite(a)&&e.push({x:a,y:c,width:o-a,height:l-c})}return e}restateAt(e,t){this.restatingExposure=!0;try{e(t)}finally{this.restatingExposure=!1}}cancelExposure(){this.exposureFrameId!==null&&(cancelAnimationFrame(this.exposureFrameId),this.exposureFrameId=null)}setLensOptics(e){const t=this.lensOptics;this.lensOptics=e,(t===void 0!=(e===void 0)||t&&e&&(t.focalLengthMm!==e.focalLengthMm||t.fNumber!==e.fNumber||t.focusDistance!==e.focusDistance||t.frameHeightMm!==e.frameHeightMm))&&(e&&this.depthOfFieldPass&&this.depthOfFieldPass.setLens(e.focalLengthMm,e.fNumber,e.focusDistance,e.frameHeightMm),this.render())}usableDepthOfFieldPass(){const e=this.lensOptics;if(!e)return;const t=this.renderer.getDrawingBufferSize(new Pe),n=Math.max(1,Math.round(t.x)),i=Math.max(1,Math.round(t.y));return this.depthOfFieldPass||(this.depthOfFieldPass=new Ca(n,i)),this.depthOfFieldPass.resize(n,i),this.depthOfFieldPass.setLens(e.focalLengthMm,e.fNumber,e.focusDistance,e.frameHeightMm),this.depthOfFieldPass}usableEquidistantPass(){if(this.projectionKind!=="equidistant")return;const e=this.renderer.getDrawingBufferSize(new Pe);if(Da.supports(this.camera.fov,e.x/Math.max(e.y,1)))return this.equidistantPass?this.equidistantPass.resize(e.x,e.y):this.equidistantPass=new Da(e.x,e.y),this.equidistantPass}aimAtScreenPoint(e,t,n){const i=this.projectionKind==="equidistant"?this.equidistantPass:void 0;if(!i){e.setFromCamera(new Pe(t,n),this.camera);return}const r=i.directionFor(t,n,this.camera.fov);this.camera.updateMatrixWorld(),e.ray.origin.setFromMatrixPosition(this.camera.matrixWorld),e.ray.direction.set(r.x,r.y,r.z).applyQuaternion(this.camera.quaternion).normalize(),e.camera=this.camera}pickCloudAt(e,t){return this.layeredClouds?.pickInstance(this.cloudDirectionAt(e,t))}cloudDirectionAt(e,t){return this.directionAtScreenPoint(e,t,new C)}directionAtScreenPoint(e,t,n){return this.aimAtScreenPoint(this.ufoOcclusionRaycaster,e,t),n.copy(this.ufoOcclusionRaycaster.ray.direction)}screenPointOf(e){this.camera.updateMatrixWorld();const t=this.screenPointScratch.copy(e).applyQuaternion(this.screenPointQuaternion.copy(this.camera.quaternion).invert());if(t.z>=0)return;const n=this.renderer.getDrawingBufferSize(this.screenPointSize),i=n.x/Math.max(n.y,1);if(this.projectionKind==="equidistant"&&this.equidistantPass)return Da.ndcFor(t,this.camera.fov,i);const r=Math.tan(this.camera.fov/2*Sn);return{ndcX:t.x/-t.z/(i*r),ndcY:t.y/-t.z/r}}screenPointScratch=new C;screenPointQuaternion=new _s;screenPointSize=new Pe;updateLensFlarePosition(){const e=this.lensFlare;if(!e)return;if(!this.sunVisible){e.mesh.visible=!1;return}if(this.camera.updateMatrixWorld(),this.lensFlareScratch.copy(this.sunWorldPosition).applyMatrix4(this.camera.matrixWorldInverse),this.lensFlareScratch.z>0){e.mesh.visible=!1;return}const t=this.sunVisibleFraction();if(t<=0){e.mesh.visible=!1;return}e.mesh.visible=!0,this.sunUnhiddenFraction=t,this.applyDazzleStrength();const n=this.lensFlareScratch.copy(this.sunWorldPosition).project(this.camera);e.uniforms.uLensPosition.value.set(n.x,n.y);const i=this.renderer.domElement.width,r=this.renderer.domElement.height;e.uniforms.uResolution.value.set(i,r),e.uniforms.uTanHalfFov.value=Math.tan(this.camera.fov*Math.PI/360)}sunVisibleFraction(){this.raycastableDecor().length>0&&this.scene.updateMatrixWorld();let e=0;for(const t of lp)this.isSunOccluded(t[0],t[1])||e++;return e/lp.length}raycastableDecor(){const e=[];for(const t of this.decorObjects){if(t.kind==="crop")continue;const n=this.decorGroups.get(t.id);n&&e.push(n)}return e}isSunOccluded(e=0,t=0){const n=this.raycastableDecor();if(!this.groundMesh&&!this.terrainMesh&&n.length===0)return!1;const i=this.sunOcclusionDirectionScratch.copy(this.sunWorldPosition).sub(this.camera.position),r=i.length();if(i.normalize(),e!==0||t!==0){const o=Math.PI/180,c=this.sunOcclusionRightScratch.set(i.z,0,-i.x);c.lengthSq()<1e-9&&c.set(1,0,0),c.normalize();const l=this.sunOcclusionUpScratch.crossVectors(c,i).normalize();i.addScaledVector(c,e*o).addScaledVector(l,t*o).normalize()}if(this.groundBlocks(this.camera.position,i,r))return!0;if(n.length===0)return!1;this.sunOcclusionRaycaster.set(this.camera.position,i);const a=this.sunOcclusionRaycaster.intersectObjects(n,!0)[0];return a!==void 0&&a.distance<r}groundBlocks(e,t,n,i=0){const r=this.groundMesh;if(r&&t.y<0){const m=(r.position.y-e.y)/t.y;if(m>i&&m<n){const g=e.x+t.x*m-r.position.x,b=e.z+t.z*m-r.position.z;if(Math.hypot(g,b)<=this.groundRadius)return!0}}const a=this.terrainMesh;if(!a)return!1;const o=a.geometry.getAttribute("position"),c=Math.round(Math.sqrt(o.count));if(c<2||c*c!==o.count)return!1;const l=[a.position.x+o.getX(0),a.position.x+o.getX(c-1)],h=[a.position.z+o.getZ(0),a.position.z+o.getZ((c-1)*c)],u=Math.min(Math.abs(l[1]-l[0]),Math.abs(h[1]-h[0]))/(c-1);if(!(u>0))return!1;let d=i,f=n;for(const[m,g,b]of[[e.x,t.x,l],[e.z,t.z,h]]){const w=Math.min(b[0],b[1]),_=Math.max(b[0],b[1]);if(Math.abs(g)<1e-12){if(m<w||m>_)return!1;continue}const S=(w-m)/g,E=(_-m)/g;d=Math.max(d,Math.min(S,E)),f=Math.min(f,Math.max(S,E))}if(!(f>d))return!1;const p=Math.hypot(t.x,t.z),v=Math.min(4096,Math.max(8,Math.ceil((f-d)*p/(u/2))));for(let m=0;m<=v;m++){const g=d+(f-d)*m/v,b=e.x+t.x*g,w=e.y+t.y*g,_=e.z+t.z*g;if(w<=this.groundYUnder(b,_))return!0}return!1}setPhenomena(e,t){this.phenomena.set(e,t)}decorDistancesAt(e,t,n){this.aimAtScreenPoint(this.ufoOcclusionRaycaster,e,t),this.ufoOcclusionRaycaster.near=ep;let i,r;for(const a of this.decorObjects){if(a.kind==="crop")continue;const o=this.decorGroups.get(a.id);if(!o)continue;const c=this.ufoOcclusionRaycaster.intersectObject(o,!0)[0];c&&(a.occludesSourceIds?.includes(n)?i=i===void 0?c.distance:Math.max(i,c.distance):r=r===void 0?c.distance:Math.min(r,c.distance))}return{behindM:i,inFrontM:r}}pickBodyAt(e,t){this.aimAtScreenPoint(this.raycaster,e,t);const n=[...this.hitAreas.entries()],i=this.raycaster.intersectObjects(n.map(([,r])=>r))[0];if(i&&!this.groundHides(e,t))return n.find(([,r])=>r===i.object)?.[0]}pickStarAt(e,t){if(this.namedStars.length===0)return;this.aimAtScreenPoint(this.raycaster,e,t);const n=this.raycaster.ray.direction,i=Math.cos(np*this.camera.fov*Math.PI/180);let r,a=i;for(const o of this.namedStars){const c=o.direction.dot(n);c>a&&(a=c,r={star:o.star,altitudeDeg:o.altitudeDeg})}return r&&this.groundHides(e,t)?void 0:r}groundHides(e,t){if(!this.terrainMesh&&!this.groundMesh)return!1;this.aimAtScreenPoint(this.ufoOcclusionRaycaster,e,t);const n=this.ufoOcclusionRaycaster.ray;return this.groundBlocks(n.origin,n.direction,1/0,ep)}pickDecorAt(e,t){this.aimAtScreenPoint(this.raycaster,e,t);const n=[...this.decorGroups.entries()],i=this.raycaster.intersectObjects(n.map(([,a])=>a),!0)[0];if(!i)return;let r=i.object;for(;r&&!n.some(([,a])=>a===r);)r=r.parent;return n.find(([,a])=>a===r)?.[0]}dispose(){this.stopTwinkle(),this.cancelFlush(),this.phenomena.clear(),this.references.disposeAll(),this.terrainBuildToken++,this.disposeMesh(this.skyMesh),this.disposeMesh(this.groundMesh),this.disposeMesh(this.terrainMesh),this.disposeCloudSystem(),this.disposeCirrus(),this.disposePrecipitationPoints(),this.disposeRain(),this.disposeStarTiers(),this.meteorSystem?.dispose(),this.meteorSystem=void 0,this.iceHalos?.dispose(),this.iceHalos=void 0,this.rainbow?.dispose(),this.rainbow=void 0,this.skyGlow?.dispose(),this.skyGlow=void 0,this.depthOfFieldPass?.dispose(),this.depthOfFieldPass=void 0,this.cancelExposure(),this.exposureAccumulation?.dispose(),this.exposureAccumulation=void 0,this.cometTail?.dispose(),this.cometTail=void 0,this.satelliteField?.dispose(),this.satelliteField=void 0,this.lightningBolt?.dispose(),this.lightningBolt=void 0;for(const e of this.bodyMeshes.values())this.disposeMesh(e);this.bodyMeshes.clear(),this.novaKeys.clear();for(const e of[...this.hitAreas.keys()])this.disposeHitArea(e);for(const e of[...this.glareSprites.keys()])this.disposeGlare(e);this.disposeCompassLabels();for(const e of this.decorGroups.values())sn.dispose(e);this.decorGroups.clear(),this.streetlightLights.clear(),this.lensFlare&&(this.lensFlare.mesh.removeFromParent(),this.lensFlare.mesh.geometry.dispose(),this.lensFlare.mesh.material.dispose(),this.lensFlare=void 0),this.renderer.dispose()}animationsRunning=!1;startTwinkle(){if(this.animationFrameId!==null||!this.needsAnimationLoop())return;this.cancelFlush();const e=t=>{this.frame(t),this.animationFrameId=requestAnimationFrame(e)};this.animationFrameId=requestAnimationFrame(e)}setAnimationsRunning(e,t=!1){const n=e&&t;if(e===this.animationsRunning&&n===this.framesDriven)return;const i=this.animationsRunning;this.animationsRunning=e,this.framesDriven=n,e&&!i&&(this.lastFrameTimeMs=void 0,this.resolution.reset()),this.syncAnimationLoop(),(!e||this.frameDirty)&&this.render()}stopTwinkle(){this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}needsAnimationLoop(){return this.animationsRunning&&!this.framesDriven&&this.hasAnimations()}hasAnimations(){return this.starTiers.length>0||this.precipitationPoints!==void 0||this.rainSystem!==void 0||this.lensFlare!==void 0&&this.sunVisible}syncAnimationLoop(){this.needsAnimationLoop()?this.startTwinkle():this.stopTwinkle()}buildSky(e){const t=this.skyMesh?.geometry??new an(Ko,32,16),n=t.attributes.position,i=t.getAttribute("color")??new Et(new Float32Array(n.count*3),3);for(let a=0;a<n.count;a++){const{altitudeDeg:o,azimuthDeg:c}=Xy(n.getX(a),n.getY(a),n.getZ(a)),l=Qy(o,c,e.azimuthDeg,e.altitudeDeg);i.setXYZ(a,l[0],l[1],l[2])}if(i.needsUpdate=!0,this.skyMesh)return;t.setAttribute("color",i);const r=new qn({vertexColors:!0,side:Nt,fog:!1,depthWrite:!1});this.skyMesh=new Ge(t,r),this.skyMesh.renderOrder=-1,this.celestialGroup.add(this.skyMesh)}buildGround(){const e=tp(this.observerElevationM);if(this.groundMesh&&e===this.groundRadius)return;this.disposeMesh(this.groundMesh),this.groundRadius=e;const t=new td(this.groundRadius,48),n=new Ya({color:new oe($l,$l,$l),fog:!0});this.groundMesh=new Ge(t,n),this.groundMesh.rotation.x=-Math.PI/2,this.groundMesh.position.y=0,this.groundMesh.receiveShadow=!0,this.scene.add(this.groundMesh),this.applyGroundDepthWrite()}applyGroundDepthWrite(){const e=this.groundMesh?.material;if(!e)return;const t=this.terrainMesh===void 0;e.depthWrite!==t&&(e.depthWrite=t,e.needsUpdate=!0)}cloudTransmission(e){const t=`${e.altitudeDeg.toFixed(1)}:${e.azimuthDeg.toFixed(1)}:${Math.round(this.cloudOffsetM.x/10)}:${Math.round(this.cloudOffsetM.z/10)}:${Math.round(this.observerElevationM)}:`+Object.entries(this.cloudLayerOffsetsM).map(([r,a])=>`${r}=${Math.round(a.x/10)},${Math.round(a.z/10)}`).join(";"),n=this.cloudTransmissionMemo.get(t);if(n!==void 0)return n;this.cloudTransmissionMemo.size>256&&this.cloudTransmissionMemo.clear();const i=this.computeCloudTransmission(e);return this.cloudTransmissionMemo.set(t,i),i}cloudTransmissionMemo=new Map;computeCloudTransmission(e){const t=jt(e.altitudeDeg,e.azimuthDeg,1);if(this.layeredClouds)return this.layeredClouds.transmissionAt(t);let n=1;const i=this.lowerCloudCover();i>0&&(n*=1-It.alphaAt(t,Math.abs(this.cloudLayerOffset()),i,this.cloudFieldOffset)*ob);const r=this.weather.highCloudCover??0;return r>0&&(n*=1-It.alphaAt(t,$o,r)*cb),Math.max(0,Math.min(1,n))}setBodyMesh(e,t,n,i,r){if(t.altitudeDeg<Ou){this.disposeMesh(this.bodyMeshes.get(e)),this.bodyMeshes.delete(e),this.disposeHitArea(e),this.disposeGlare(e),e==="sun"&&(this.sunVisible=!1);return}const{x:a,y:o,z:c}=jt(t.altitudeDeg,t.azimuthDeg,Sr),l=os(t.altitudeDeg),h=this.cloudTransmission(t),u=new oe(i.r*l[0]*h,i.g*l[1]*h,i.b*l[2]*h);let d=this.bodyMeshes.get(e);d instanceof Ge?d.material.color.copy(u):(this.disposeMesh(d),d=new Ge(new an(1,16,16),new qn({color:u,fog:!1})),this.celestialGroup.add(d),this.bodyMeshes.set(e,d)),d.scale.setScalar(n),d.position.set(a,o,c),this.setHitArea(e,a,o,c,n);const f=r-2.5*Math.log10(Math.max(h,.001));if(e==="sun"&&(this.sunCloudTransmission=h),e!=="sun"&&this.setGlare(e,a,o,c,f,u),e==="sun"){this.sunVisible=!0;const p=this.celestialGroup.scale.x;this.sunWorldPosition.set(a*p,o*p+this.celestialGroup.position.y,c*p),this.lensFlare||(this.lensFlare=NS(),this.lensFlare.uniforms.uOpacity.value=yb,this.lensFlare.uniforms.uFlareIntensity.value=this.lensFlareArtifactIntensity,this.lensFlare.uniforms.uStarPoints.value=this.starPoints,this.scene.add(this.lensFlare.mesh)),this.applyLensFlareTint(l)}}setMoonMesh(e,t){const n="moon";if(e.magnitude>t||e.altitudeDeg<Ou){this.disposeMesh(this.bodyMeshes.get(n)),this.bodyMeshes.delete(n),this.disposeHitArea(n),this.disposeGlare(n);return}const{x:i,y:r,z:a}=jt(e.altitudeDeg,e.azimuthDeg,Sr),o=os(e.altitudeDeg),c=new oe(o[0],o[1],o[2]),l=`${e.phase.phaseFraction<.5}:${Math.round(Pa(e.phase.illuminatedFraction,0,1)*500)}`;let h=this.bodyMeshes.get(n);if(h instanceof pr)h.userData.phaseKey!==l&&(h.material.map?.dispose(),h.material.map=Ap(e.phase),h.userData.phaseKey=l),h.material.color.copy(c);else{this.disposeMesh(h),h=new pr(new Ma({map:Ap(e.phase),color:c,fog:!1})),h.userData.phaseKey=l;const u=Zl*2;h.scale.set(u,u,1),this.celestialGroup.add(h),this.bodyMeshes.set(n,h)}h.position.set(i,r,a),this.setHitArea(n,i,r,a,Zl),this.setGlare(n,i,r,a,e.magnitude,c)}setHitArea(e,t,n,i,r){let a=this.hitAreas.get(e);if(!a){const c=new Ma({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1,fog:!1});a=new pr(c),this.celestialGroup.add(a),this.hitAreas.set(e,a)}a.position.set(t,n,i);const o=r*ab;a.scale.set(o,o,1)}disposeHitArea(e){const t=this.hitAreas.get(e);t&&(t.removeFromParent(),t.material.dispose(),this.hitAreas.delete(e))}setGlare(e,t,n,i,r,a){const o=n5(r);if(o<=0){this.disposeGlare(e);return}const c=r5(o),l=this.glareSprites.get(e),h=l??new pr(new Ma({map:Qb(),transparent:!0,blending:Un,depthWrite:!1,fog:!1}));h.material.color.copy(a),h.material.opacity=c5(o),h.position.set(t,n,i),h.scale.set(c*2,c*2,1),l||(this.celestialGroup.add(h),this.glareSprites.set(e,h))}disposeGlare(e){const t=this.glareSprites.get(e);t&&(t.removeFromParent(),t.material.dispose(),this.glareSprites.delete(e))}buildComet(e,t){const n=e&&`comet:${e.id}`;if(!e||!n||e.magnitude>t){this.disposeComet();return}this.cometKey&&this.cometKey!==n&&this.disposeComet();const i=_a(e.magnitude,t),r=ya(i);this.cometKey=n,this.setBodyMesh(n,e.position,jl*(.5+.5*i),new oe(r,r,r),e.magnitude),this.cometTail||(this.cometTail=new Ln(Sr),this.celestialGroup.add(this.cometTail.object)),this.cometTail.set(e.position,e.tailEnd,i)}buildIceHalos(e,t){this.iceHalos||(this.iceHalos=new gi,this.iceHalos.setCloudOffset(this.cloudFieldOffset),this.iceHalos.onReady=()=>this.render(),this.celestialGroup.add(this.iceHalos.object));const n=this.highCloudCover(),i=this.layeredClouds?.cirrusMask;if(this.iceHalos.setCloudOffset(i?.offset??this.cloudFieldOffset),n===void 0){this.iceHalos.update({x:0,y:1,z:0},-1,0,[1,1,1],{cover:0,layerHeight:$o},0);return}const r=this.lowerCloudCover(),a=et.deckLitUntilDeg(et.DECK_HEIGHT_M),o=e.altitudeDeg>-a?e:t,c=et.strength(n,r,o.altitudeDeg,a)*(o===e?1:sp),{x:l,y:h,z:u}=jt(o.altitudeDeg,o.azimuthDeg,1),d=os(o.altitudeDeg);this.iceHalos.update({x:l,y:h,z:u},o.altitudeDeg,c,[d[0],d[1],d[2]],{cover:i?.cover??n,layerHeight:i?.layerHeight??$o},i?.iceCrystalAlignment??this.weather.iceCrystalAlignment??.65)}buildRainbow(e,t){this.rainbow||(this.rainbow=new Fs,this.celestialGroup.add(this.rainbow.object));const n=this.weather.precipitationType==="rain"?this.weather.precipitationIntensity:0,i=e.altitudeDeg>0,r=i?e:t,a=this.lowerCloudCover(),o=sp*En.moonlightShare(t.magnitude),c=En.strength(n,a,r.altitudeDeg)*(i?1:o);if(c<=0){this.rainbow.update({x:0,y:1,z:0},0,[1,1,1],!0);return}const{x:l,y:h,z:u}=jt(r.altitudeDeg,r.azimuthDeg,1),d=os(r.altitudeDeg);this.rainbow.update({x:l,y:h,z:u},c,[d[0],d[1],d[2]],i)}buildSkyGlow(e,t){if(!e.frame){this.skyGlow?.hide();return}this.skyGlow||(this.skyGlow=new ls,this.skyGlow.onReady=()=>this.render(),this.celestialGroup.add(this.skyGlow.object));const{date:n,observer:i}=e.frame,r=Zn.galactic(n,i),a=Hn.directionOf(r.centre),o=Hn.directionOf(r.rotation),c=Hn.directionOf(r.pole),l=new ze().set(a.x,a.y,a.z,o.x,o.y,o.z,c.x,c.y,c.z),h=Hn.directionOf(Zn.eclipticPole(n,i)),u=Hn.directionOf(e.sun),d=u.clone().addScaledVector(h,-u.dot(h)).normalize();this.skyGlow.update({galactic:l,eclipticPole:h,sunLongitude:d,sunDirection:u,sunAltitudeDeg:e.sun.altitudeDeg,moon:{direction:Hn.directionOf(e.moon),altitudeDeg:e.moon.altitudeDeg,phaseAngleDeg:Je.phaseAngleOf(e.moon.phase.illuminatedFraction)},skyColor:new C(t[0],t[1],t[2])})}static directionOf(e){const{x:t,y:n,z:i}=jt(e.altitudeDeg,e.azimuthDeg,1);return new C(t,n,i).normalize()}buildNovae(e,t){const n=new Set;for(const i of e){if(i.magnitude>t)continue;const r=`nova:${i.id}`;n.add(r);const a=_a(i.magnitude,t),o=ya(a);this.setBodyMesh(r,i.position,jl*(.5+.5*a),new oe(o,o,o),i.magnitude)}for(const i of this.novaKeys)n.has(i)||(this.disposeMesh(this.bodyMeshes.get(i)),this.bodyMeshes.delete(i),this.disposeHitArea(i),this.disposeGlare(i));this.novaKeys=n}disposeComet(){this.cometTail?.set(void 0,void 0,0),this.cometKey&&(this.disposeMesh(this.bodyMeshes.get(this.cometKey)),this.bodyMeshes.delete(this.cometKey),this.disposeHitArea(this.cometKey),this.disposeGlare(this.cometKey),this.cometKey=void 0)}buildPlanets(e,t){const n=new Set(["sun","moon",...this.cometKey?[this.cometKey]:[],...this.novaKeys]);for(const i of e){if(i.magnitude>t)continue;n.add(i.body);const r=_a(i.magnitude,t),a=ya(r),o=Wb[i.body]??new oe(1,1,1),c=new oe(o.r*a,o.g*a,o.b*a),l=jl*(.5+.5*r);this.setBodyMesh(i.body,i.position,l,c,i.magnitude)}for(const i of[...this.bodyMeshes.keys()])n.has(i)||(this.disposeMesh(this.bodyMeshes.get(i)),this.bodyMeshes.delete(i),this.disposeHitArea(i),this.disposeGlare(i))}buildStars(e,t){if(this.namedStars=[],!e||e.catalog.count===0){this.disposeStarTiers(),this.syncAnimationLoop();return}const{catalog:n,date:i,observer:r}=e,a=new ei(i,r),o=rh(1337),c=[];for(let l=0;l<n.count;l++){const h=n.mag[l];if(h>t)break;const{altitudeDeg:u,azimuthDeg:d}=a.position(n.ra[l],n.dec[l]);if(u<ip)continue;const{x:f,y:p,z:v}=jt(u,d,Jl);c.push({x:f,y:p,z:v,brightness:_a(h,t),phase:o()*Math.PI*2,speedFactor:.7+o()*.6})}for(const l of pS){if(l.mag>t)continue;const{altitudeDeg:h,azimuthDeg:u}=a.position(l.raHours,l.decDeg);if(h<ip)continue;const{x:d,y:f,z:p}=jt(h,u,Jl);this.namedStars.push({star:l,direction:new C(d,f,p).normalize(),altitudeDeg:h})}this.starTiers=od.map((l,h)=>{const u=c.filter(w=>Nm(w.brightness)===h),d=new Float32Array(u.length*3),f=new Float32Array(u.length),p=new Float32Array(u.length),v=new Float32Array(u.length);u.forEach((w,_)=>{d[_*3]=w.x,d[_*3+1]=w.y,d[_*3+2]=w.z,f[_]=w.brightness,p[_]=w.phase,v[_]=w.speedFactor});const m=new Mt;m.setAttribute("position",new tt(d,3));const g=new tt(new Float32Array(u.length*3),3);m.setAttribute("color",g);let b=this.starTiers[h]?.points;if(b)b.geometry.dispose(),b.geometry=m;else{const w=new ed({vertexColors:!0,size:l.size,sizeAttenuation:!1,fog:!1});fs.apply(w),b=new Ra(m,w),this.celestialGroup.add(b)}return{points:b,colorAttribute:g,brightness:f,phase:p,speedFactor:v}}),this.updateTwinkle(0),this.startTwinkle()}updateTwinkle(e){for(const t of this.starTiers){const n=t.colorAttribute.array;for(let i=0;i<t.brightness.length;i++){const r=p5(t.brightness[i],{phase:t.phase[i],speedFactor:t.speedFactor[i]},e),a=ya(t.brightness[i])*r;n[i*3]=a,n[i*3+1]=a,n[i*3+2]=a}t.colorAttribute.needsUpdate=!0}}buildClouds(){if(this.cloudRendering==="volume"||this.weather.cloudLayers!==void 0){this.layeredClouds||(this.disposeCloudSystem(),this.layeredClouds=new Tc(this.celestialGroup,Ql,this.cloudRendering)),this.disposeCirrus(),this.layeredClouds.update(this.weather,this.observerElevationM+1.6),this.layeredClouds.setOffsets(this.cloudOffsetM,this.cloudLayerOffsetsM),this.lastSunPosition&&this.updateCloudLighting(this.lastSunPosition,this.baseFogColor);return}const e=this.lowerCloudCover();if(e<=0){this.disposeCloudSystem();return}const t=this.weather.cloudDarkness,n=new oe(Ts[0]+(nh[0]-Ts[0])*t,Ts[1]+(nh[1]-Ts[1])*t,Ts[2]+(nh[2]-Ts[2])*t);if(this.cloudMesh&&this.cloudUniforms){this.cloudUniforms.coverage.value=e,this.cloudUniforms.baseColor.value.copy(n),this.syncCloudLayer(),this.lastSunPosition&&this.updateCloudLighting(this.lastSunPosition,this.baseFogColor);return}this.disposeCloudSystem();const{material:i,uniforms:r}=au(n,e,Math.abs(this.cloudLayerOffset()));this.cloudMaterial=i,this.cloudUniforms=r,r.fieldOffset.value.copy(this.cloudFieldOffset),this.lastSunPosition&&this.updateCloudLighting(this.lastSunPosition,this.baseFogColor);const a=ou(Ql);this.cloudMesh=new Ge(a,i),this.faceCloudDeck(this.cloudMesh,this.cloudLayerOffset()),this.celestialGroup.add(this.cloudMesh)}lowerCloudCover(){return this.weather.cloudLayers?1-this.weather.cloudLayers.filter(e=>e.type!=="cirrus").reduce((e,t)=>e*(1-t.coverage),1):this.weather.lowerCloudCover??this.weather.cloudCover}highCloudCover(){return this.weather.cloudLayers?1-this.weather.cloudLayers.filter(e=>e.type==="cirrus").reduce((e,t)=>e*(1-t.coverage),1):this.weather.highCloudCover}buildCirrus(){const e=this.weather.highCloudCover??0;if(this.layeredClouds||e<=0){this.disposeCirrus();return}if(this.cirrusMesh&&this.cirrusUniforms){this.cirrusUniforms.coverage.value=e,this.lastSunPosition&&this.updateCloudLighting(this.lastSunPosition,this.baseFogColor);return}const{material:t,uniforms:n}=au(new oe(...Ts),e,$o,1);this.cirrusMaterial=t,this.cirrusUniforms=n,n.fieldOffset.value.copy(this.cloudFieldOffset),this.lastSunPosition&&this.updateCloudLighting(this.lastSunPosition,this.baseFogColor),this.cirrusMesh=new Ge(ou(Ql*1.04),t),this.cirrusMesh.renderOrder=hp-1,this.celestialGroup.add(this.cirrusMesh)}disposeCirrus(){this.cirrusMesh&&(this.cirrusMesh.removeFromParent(),this.cirrusMesh.geometry.dispose()),this.cirrusMaterial?.dispose(),this.cirrusMesh=void 0,this.cirrusMaterial=void 0,this.cirrusUniforms=void 0}syncCloudLayer(){this.layeredClouds?.update(this.weather,this.observerElevationM+1.6);const e=this.cloudLayerOffset();this.cloudUniforms&&(this.cloudUniforms.layerHeight.value=Math.abs(e)),this.cloudMesh&&this.faceCloudDeck(this.cloudMesh,e)}faceCloudDeck(e,t){const n=t<0;e.scale.y=n?-1:1,e.renderOrder=n?Tc.deckOrder(!0,0,1):hp}cloudLayerOffset(){const t=((this.weather.cloudBaseM??1e3)-this.observerElevationM)*eh;return Math.sign(t||1)*Math.max(Math.abs(t),bb)}updateCloudLighting(e,t){const n=[this.cloudUniforms,this.cirrusUniforms].filter(u=>u!==void 0);if(n.length===0&&!this.layeredClouds)return;const{x:i,y:r,z:a}=jt(e.altitudeDeg,e.azimuthDeg,1),o=os(e.altitudeDeg),c=Math.max(0,Math.sin(Math.max(e.altitudeDeg,0)*Sn)),l=this.lightningLevel*Gb,h=new oe(t[0]+pi.r*l,t[1]+pi.g*l,t[2]+pi.b*l);this.layeredClouds?.setLighting(new C(i,r,a),new oe(o[0]*c,.96*o[1]*c,.88*o[2]*c),h,h);for(const u of n)u.sunDir.value.set(i,r,a),u.sunColor.value.setRGB(o[0]*c,.96*o[1]*c,.88*o[2]*c),u.ambientColor.value.copy(h)}disposeCloudSystem(){this.layeredClouds?.dispose(),this.layeredClouds=void 0,this.cloudMesh&&(this.cloudMesh.removeFromParent(),this.cloudMesh.geometry.dispose()),this.cloudMaterial?.dispose(),this.cloudMesh=void 0,this.cloudMaterial=void 0,this.cloudUniforms=void 0}disposePrecipitationPoints(){this.precipitationPoints&&(this.precipitationPoints.removeFromParent(),this.precipitationPoints.geometry.dispose(),this.precipitationPoints.material.dispose()),this.precipitationPoints=void 0,this.precipitationPositions=void 0,this.precipitationPhase=void 0,this.precipitationSpeedJitter=void 0,this.precipitationWobbleFreqJitter=void 0,this.precipitationWobbleAmpJitter=void 0,this.precipitationBounceRemaining=void 0,this.precipitationBounceHeight=void 0,this.precipitationBounceDuration=void 0,this.precipitationBounceVelX=void 0,this.precipitationBounceVelZ=void 0,this.precipitationUniforms=void 0}buildPrecipitation(){this.disposePrecipitationPoints(),this.disposeRain();const e=this.weather.precipitationType;if(e==="none")return;if(e==="rain"){this.buildRain();return}const t=up[e],n=t.poolSize,i=rh(9001),r=new Float32Array(n*3),a=new Float32Array(n),o=new Float32Array(n),c=new Float32Array(n),l=new Float32Array(n),h=new Float32Array(n),u=new Float32Array(n),d=new Float32Array(n),f=new Float32Array(n),p=new Float32Array(n);for(let w=0;w<n;w++){const _=i()*Math.PI*2,S=i()*t.radiusM;r[w*3]=Math.cos(_)*S,r[w*3+1]=Er+i()*(t.topYM-Er),r[w*3+2]=Math.sin(_)*S,a[w]=i()*Math.PI*2,o[w]=.7+i()*.6,c[w]=.6+i()*.8,l[w]=.4+i()*1.2}const v=new Mt;v.setAttribute("position",new tt(r,3)),v.setDrawRange(0,sh(n,this.weather.precipitationIntensity));const m={uSize:{value:t.size},uScale:{value:.5*this.renderer.domElement.height},uOpacity:{value:t.opacity},uColor:{value:t.color},uHazeColor:{value:new oe(...this.baseFogColor)},uTexture:{value:Xb(e)},uNearFocusDistance:{value:Mp},uHazeDistance:{value:t.radiusM*xp}},g=new At({uniforms:m,vertexShader:Zb,fragmentShader:jb,transparent:!0,depthWrite:!1});this.precipitationUniforms=m;const b=new Ra(v,g);b.renderOrder=th,this.scene.add(b),this.precipitationPoints=b,this.precipitationPositions=r,this.precipitationPhase=a,this.precipitationSpeedJitter=o,this.precipitationWobbleFreqJitter=c,this.precipitationWobbleAmpJitter=l,this.precipitationBounceRemaining=h,this.precipitationBounceHeight=u,this.precipitationBounceDuration=d,this.precipitationBounceVelX=f,this.precipitationBounceVelZ=p}updatePrecipitation(e,t){if(!this.precipitationPoints||!this.precipitationPositions||!this.precipitationPhase||!this.precipitationSpeedJitter||(this.precipitationUniforms?.uHazeColor.value.setRGB(...this.baseFogColor),t<=0))return;const n=this.weather.precipitationType;if(n==="none"||n==="rain")return;const i=up[n],r=this.weather.windDirectionDeg*Sn,a=Math.sin(r)*this.weather.windSpeed*i.driftSensitivity,o=-Math.cos(r)*this.weather.windSpeed*i.driftSensitivity,c=this.precipitationPositions,l=this.precipitationPhase,h=this.precipitationSpeedJitter,u=this.precipitationWobbleFreqJitter,d=this.precipitationWobbleAmpJitter,f=this.precipitationBounceRemaining,p=this.precipitationBounceHeight,v=this.precipitationBounceDuration,m=this.precipitationBounceVelX,g=this.precipitationBounceVelZ,b=n==="snow"&&u&&d,w=n==="hail"&&f&&p&&v&&m&&g;for(let _=0,S=0;_<c.length;_+=3,S++){if(w&&f[S]>0){if(f[S]-=t,f[S]<=0){const M=Math.random()*Math.PI*2,A=Math.sqrt(Math.random())*i.radiusM;c[_]=Math.cos(M)*A,c[_+1]=i.topYM,c[_+2]=Math.sin(M)*A,f[S]=0}else{const M=1-f[S]/v[S];c[_+1]=Er+Math.sin(Math.PI*M)*p[S],c[_]=Zo(c[_]+(a+m[S])*t,i.radiusM),c[_+2]=Zo(c[_+2]+(o+g[S])*t,i.radiusM)}continue}let E=0,R=0;if(b){const M=Nb*u[S],A=Ob*d[S];E=Math.sin(e*M*Math.PI*2+l[S])*A,R=Math.sin(e*M*Math.PI*2+l[S]+Math.PI/2)*A}if(c[_]+=(a+E)*t,c[_+1]-=i.fallSpeedMPerS*h[S]*t,c[_+2]+=(o+R)*t,c[_]=Zo(c[_],i.radiusM),c[_+2]=Zo(c[_+2],i.radiusM),c[_+1]<Er){if(w){p[S]=wp*(.2+Math.random()*1.6),v[S]=Ub*(.5+Math.random()),f[S]=v[S];const P=Math.random()*Math.PI*2,D=Fb*(p[S]/wp);m[S]=Math.cos(P)*D,g[S]=Math.sin(P)*D,c[_+1]=Er;continue}const M=Math.random()*Math.PI*2,A=Math.sqrt(Math.random())*i.radiusM;c[_]=Math.cos(M)*A,c[_+1]=i.topYM,c[_+2]=Math.sin(M)*A}}this.precipitationPoints.geometry.attributes.position.needsUpdate=!0}buildRain(){const e=mp(this.weather.precipitationIntensity);this.rainSystem=CS({count:dp,radiusM:ma,heightM:Eb,bottomYM:fp,overallSpeed:Ab,color:Rb,opacity:.85,visibleCount:sh(dp,this.weather.precipitationIntensity),speedStreak:Pb(e),pixelSize:yp,seed:9001,nearFocusDistanceM:Mp,hazeDistanceM:ma*xp,hazeColor:new oe(...this.baseFogColor)}),this.rainLastVerticalFacing=-1,this.syncRainSlant(),this.rainSystem.points.renderOrder=th,this.scene.add(this.rainSystem.points),this.buildRainSplashes()}buildRainSplashes(){const e=rh(4242),t=new Float32Array(br*3),n=new Float32Array(br),i=new Float32Array(br),r=new Float32Array(br);for(let h=0;h<br;h++){const u=e()*Math.PI*2,d=Math.sqrt(e())*ma;t[h*3]=Math.cos(u)*d,t[h*3+1]=fp,t[h*3+2]=Math.sin(u)*d,i[h]=Ep(gp,vp),n[h]=e()*i[h],r[h]=n[h]/i[h]}const a=new Mt;a.setAttribute("position",new tt(t,3));const o=new tt(r,1);a.setAttribute("aLife",o),a.setDrawRange(0,sh(br,this.weather.precipitationIntensity));const c=new At({uniforms:{uMaxSize:{value:Ib},uScale:{value:.5*this.renderer.domElement.height},uColor:{value:Lb},uTexture:{value:Kb()}},vertexShader:$b,fragmentShader:Jb,transparent:!0,depthWrite:!1}),l=new Ra(a,c);l.renderOrder=th,this.scene.add(l),this.rainSplashSystem={points:l,positions:t,life:n,duration:i,lifeAttribute:o}}disposeRain(){this.rainSystem&&(this.rainSystem.points.removeFromParent(),this.rainSystem.points.geometry.dispose(),this.rainSystem.points.material.dispose()),this.rainSystem=void 0,this.disposeRainSplashes()}disposeRainSplashes(){this.rainSplashSystem&&(this.rainSplashSystem.points.removeFromParent(),this.rainSplashSystem.points.geometry.dispose(),this.rainSplashSystem.points.material.dispose()),this.rainSplashSystem=void 0}syncRainSlant(){const e=this.rainSystem;if(!e)return;const t=this.weather.windDirectionDeg*Sn;e.uniforms.uDropVelocity.value.set(Math.sin(t)*this.weather.windSpeed,-mp(this.weather.precipitationIntensity),-Math.cos(t)*this.weather.windSpeed);const n=this.renderer.getSize(this.rainViewportSize);e.uniforms.uAspect.value=n.x/Math.max(n.y,1)}updateRain(e){const t=this.rainSystem;if(!t)return;t.uniforms.uTime.value+=e,t.uniforms.uHazeColor.value.setRGB(...this.baseFogColor);const n=this.weather.windDirectionDeg*Sn,i=Math.sin(n)*this.weather.windSpeed,r=-Math.cos(n)*this.weather.windSpeed,a=ma,o=l=>(l%(a*2)+a*3)%(a*2)-a;t.uniforms.uWindOffset.value.set(o(t.uniforms.uWindOffset.value.x+i*e),o(t.uniforms.uWindOffset.value.y+r*e)),this.syncRainSlant(),this.camera.getWorldDirection(this.rainCameraDirection);const c=Math.abs(this.rainCameraDirection.y);if(Math.abs(c-this.rainLastVerticalFacing)>.001){this.rainLastVerticalFacing=c;const l=Sp+(1-Sp)*(1-c),h=bp+(1-bp)*(1-c);t.uniforms.uUvSquash.value=h,t.uniforms.uPixelSize.value=yp*l*(.5+.5*h)}this.updateRainSplashes(e)}updateRainSplashes(e){const t=this.rainSplashSystem;if(!t||e<=0)return;const{positions:n,life:i,duration:r,lifeAttribute:a}=t,o=a.array;for(let c=0,l=0;c<n.length;c+=3,l++){if(i[l]+=e,i[l]>=r[l]){const h=Math.random()*Math.PI*2,u=Math.sqrt(Math.random())*ma;n[c]=Math.cos(h)*u,n[c+2]=Math.sin(h)*u,r[l]=Ep(gp,vp),i[l]=0}o[l]=i[l]/r[l]}t.points.geometry.attributes.position.needsUpdate=!0,a.needsUpdate=!0}setLightning(e){this.lightningFlashes=e}updateLightning(e){let t,n=0;if(this.lightningArmed)for(const o of this.lightningFlashes){if(o.t>e)break;const c=Wt.brightnessAt(o,e);c>n&&(t=o,n=c)}const i=t?Math.min(1,Math.max(.1,(Bb/t.distanceM)**2)):0,r=n*i*(t?.cloudToGround?1:.6);if(r===this.lightningLevel&&!t?.cloudToGround)return;if(this.lightningLevel=r,this.scene.fog){const o=this.scene.fog,c=Math.min(1,r);o.color.setRGB(this.baseFogColor[0]+(pi.r-this.baseFogColor[0])*c,this.baseFogColor[1]+(pi.g-this.baseFogColor[1])*c,this.baseFogColor[2]+(pi.b-this.baseFogColor[2])*c)}if(this.skyMesh){const o=r*Hb;this.skyMesh.material.color.setRGB(1+o*pi.r,1+o*pi.g,1+o*pi.b)}if(this.lastSunPosition&&this.updateCloudLighting(this.lastSunPosition,this.baseFogColor),this.lightningLight.intensity=r*Vb,t){const{x:o,y:c,z:l}=jt(25,t.azimuthDeg,Sr);this.lightningLight.position.set(o,c,l)}this.lightningBolt||(this.lightningBolt=new Dr(Sr*.95),this.celestialGroup.add(this.lightningBolt.object));const a=this.weather.cloudBaseM??1500;this.lightningBolt.set(t,n,a),this.render()}buildCompassLabels(){const e=ku(navigator.languages,gb),t=mb[e];this.compassSprites=pb.map((n,i)=>{const r=t[i],a=new Ma({map:ew(r),depthTest:!1,fog:!1}),o=new pr(a),{x:c,y:l,z:h}=jt(0,n,ap);return o.position.set(c,l,h),o.scale.set(Jo,Jo,1),o.renderOrder=vb,o.visible=this.compassHovered||this.compassForced,this.celestialGroup.add(o),o}),this.updateCompassScale()}updateCompassScale(){const e=this.camera.fov*Math.PI/360,t=op*Math.PI/360,n=Jo*Math.tan(e)/Math.tan(t);for(const i of this.compassSprites)i.scale.set(n,n,1)}disposeCompassLabels(){for(const e of this.compassSprites)e.removeFromParent(),e.material.map?.dispose(),e.material.dispose();this.compassSprites=[]}disposeStarTiers(){for(const e of this.starTiers)this.disposeMesh(e.points);this.starTiers=[]}disposeMesh(e){if(!e)return;e.removeFromParent(),"geometry"in e&&e.geometry.dispose();const t=e.material;for(const n of Array.isArray(t)?t:[t]){const i=n.map;i&&i.dispose(),n.dispose()}}}const Sn=Math.PI/180;function Pa(s,e,t){return Math.max(e,Math.min(t,s))}function Ep(s,e){return s+Math.random()*(e-s)}function Zo(s,e){return(s%(e*2)+e*3)%(e*2)-e}let jo,Qo;function Xb(s){switch(s){case"snow":return qb();case"hail":return Yb()}}function qb(){if(jo)return jo;const s=64,e=document.createElement("canvas");e.width=s,e.height=s;const t=e.getContext("2d"),n=t.createRadialGradient(s/2,s/2,0,s/2,s/2,s/2);return n.addColorStop(0,"rgba(255,255,255,0.95)"),n.addColorStop(.5,"rgba(255,255,255,0.55)"),n.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=n,t.fillRect(0,0,s,s),jo=new Ri(e),jo}function Yb(){if(Qo)return Qo;const s=64,e=document.createElement("canvas");e.width=s,e.height=s;const t=e.getContext("2d"),n=t.createRadialGradient(s/2,s/2,0,s/2,s/2,s/2);return n.addColorStop(0,"rgba(255,255,255,1)"),n.addColorStop(.55,"rgba(255,255,255,0.95)"),n.addColorStop(.8,"rgba(255,255,255,0.4)"),n.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=n,t.fillRect(0,0,s,s),Qo=new Ri(e),Qo}let ec;function Kb(){if(ec)return ec;const s=64,e=document.createElement("canvas");e.width=s,e.height=s;const t=e.getContext("2d"),n=t.createRadialGradient(s/2,s/2,0,s/2,s/2,s/2);return n.addColorStop(0,"rgba(255,255,255,0)"),n.addColorStop(.4,"rgba(255,255,255,0)"),n.addColorStop(.6,"rgba(255,255,255,0.9)"),n.addColorStop(.8,"rgba(255,255,255,0.25)"),n.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=n,t.fillRect(0,0,s,s),ec=new Ri(e),ec}const $b=`
6007
6007
  uniform float uMaxSize;
6008
6008
  uniform float uScale;
6009
6009
  attribute float aLife;
@@ -6069,4 +6069,4 @@ void main() {
6069
6069
  gl_FragColor = vec4(color, tex.a * uOpacity * (1.0 - blur * 0.5));
6070
6070
  }
6071
6071
  `;let tc;function Qb(){if(tc)return tc;const s=128,e=document.createElement("canvas");e.width=s,e.height=s;const t=e.getContext("2d"),n=t.createRadialGradient(s/2,s/2,0,s/2,s/2,s/2);return n.addColorStop(0,"rgba(255,255,255,1)"),n.addColorStop(.4,"rgba(255,255,255,0.35)"),n.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=n,t.fillRect(0,0,s,s),tc=new Ri(e),tc}function Ap(s){const t=document.createElement("canvas");t.width=128,t.height=128;const n=t.getContext("2d"),i=128/2-2,r=128/2,a=128/2,o="#2e2b26",c="#f4f1e2";n.fillStyle=o,n.beginPath(),n.arc(r,a,i,0,Math.PI*2),n.fill();const l=Pa(s.illuminatedFraction,0,1),h=s.phaseFraction<.5,u=i*Math.abs(1-2*l),d=l<.5;return n.save(),n.beginPath(),n.arc(r,a,i,0,Math.PI*2),n.clip(),n.fillStyle=c,n.beginPath(),h?(n.arc(r,a,i,-Math.PI/2,Math.PI/2,!1),n.ellipse(r,a,u,i,0,Math.PI/2,-Math.PI/2,d)):(n.arc(r,a,i,Math.PI/2,-Math.PI/2,!1),n.ellipse(r,a,u,i,0,-Math.PI/2,Math.PI/2,d)),n.fill(),n.restore(),new Ri(t)}function ew(s){const e=document.createElement("canvas");e.width=128,e.height=128;const t=e.getContext("2d");return t.fillStyle="rgba(0, 0, 0, 0.55)",t.beginPath(),t.arc(64,64,60,0,Math.PI*2),t.fill(),t.fillStyle="#ffffff",t.font="bold 52px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(s,64,68),new Ri(e)}function rh(s){let e=s;return function(){e|=0,e=e+1831565813|0;let n=Math.imul(e^e>>>15,1|e);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}const ah=7.5,oh=9;class vi{static cache=new Map;static load(e){let t=vi.cache.get(e);return t||(t=fetch(e).then(n=>n.arrayBuffer()).then(n=>vi.parse(n)),vi.cache.set(e,t)),t}static upTo(e,t){const n=e.filter((a,o)=>o===0||e[o-1].magnitudeLimit<t);if(n.length<=1)return vi.load(e[0].url);const i=n.map(a=>a.url).join(`
6072
- `);let r=vi.cache.get(i);return r||(r=Promise.all(n.map(a=>vi.load(a.url))).then(a=>a.reduce((o,c)=>vi.concat(o,c))),vi.cache.set(i,r)),r}static parse(e){const t=e.byteLength/(4*Float32Array.BYTES_PER_ELEMENT),n=t*Float32Array.BYTES_PER_ELEMENT;return{count:t,ra:new Float32Array(e,0*n,t),dec:new Float32Array(e,1*n,t),mag:new Float32Array(e,2*n,t),ci:new Float32Array(e,3*n,t)}}static concat(e,t){const n=(i,r)=>{const a=new Float32Array(i.length+r.length);return a.set(i,0),a.set(r,i.length),a};return{count:e.count+t.count,ra:n(e.ra,t.ra),dec:n(e.dec,t.dec),mag:n(e.mag,t.mag),ci:n(e.ci,t.ci)}}}const tw=new URL(""+new URL("rain-BvWZrB9h.ogg",import.meta.url).href,import.meta.url).href,nw=new URL(""+new URL("wind-BjklexY7.ogg",import.meta.url).href,import.meta.url).href,iw=new URL(""+new URL("thunder-DA48qs_v.wav",import.meta.url).href,import.meta.url).href,sw=20,rw=1;class aw{context;buffers=new Map;ambientSource;ambientGain;ambientKey="none";ambientToken=0;ambientVolume=0;windSource;windGain;windActive=!1;windToken=0;windVolume=0;paused=!0;requested={type:"none",intensity:0,windSpeed:0};resume(){if(!this.context){if(typeof AudioContext>"u")return;try{this.context=new AudioContext}catch(e){console.warn("WeatherAudio: Web Audio unavailable, weather sounds disabled:",e);return}}this.context.state==="suspended"&&this.context.resume()}setAmbient(e,t,n){if(this.requested={type:e,intensity:t,windSpeed:n},!this.context)return;this.paused&&(e="none",t=0,n=0);const i=e==="rain"||e==="hail"?e:"none";if(this.ambientVolume=i==="hail"?Math.min(1,t*1.3+.2):i==="rain"?t:0,i!==this.ambientKey){this.ambientKey=i;const a=++this.ambientToken;this.stopSource(this.ambientSource,this.ambientGain),this.ambientSource=void 0,this.ambientGain=void 0,i!=="none"&&this.startLoop(tw,this.ambientVolume).then(o=>this.applyIfCurrent(o,a,()=>this.ambientToken,c=>{this.ambientSource=c?.source,this.ambientGain=c?.gain,c&&(c.gain.gain.value=this.ambientVolume)}))}else this.ambientGain&&(this.ambientGain.gain.value=this.ambientVolume);this.windVolume=Math.min(n/sw,1);const r=n>rw;if(r!==this.windActive){this.windActive=r;const a=++this.windToken;this.stopSource(this.windSource,this.windGain),this.windSource=void 0,this.windGain=void 0,r&&this.startLoop(nw,this.windVolume).then(o=>this.applyIfCurrent(o,a,()=>this.windToken,c=>{this.windSource=c?.source,this.windGain=c?.gain,c&&(c.gain.gain.value=this.windVolume)}))}else this.windGain&&(this.windGain.gain.value=this.windVolume)}setPaused(e){if(e===this.paused)return;this.paused=e;const{type:t,intensity:n,windSpeed:i}=this.requested;this.setAmbient(t,n,i)}playThunder(){!this.context||this.paused||this.playOneShot(iw,.9)}dispose(){this.ambientToken++,this.windToken++,this.stopSource(this.ambientSource,this.ambientGain),this.stopSource(this.windSource,this.windGain),this.ambientSource=void 0,this.ambientGain=void 0,this.windSource=void 0,this.windGain=void 0,this.context?.close(),this.context=void 0,this.buffers.clear()}applyIfCurrent(e,t,n,i){if(t!==n()){e?.source.stop();return}i(e)}async startLoop(e,t){const n=this.context;if(n)try{const i=await this.getBuffer(e),r=n.createBufferSource();r.buffer=i,r.loop=!0;const a=n.createGain();return a.gain.value=t,r.connect(a).connect(n.destination),r.start(),{source:r,gain:a}}catch(i){console.warn("Weather ambient sound failed to load, staying silent:",i);return}}async playOneShot(e,t){const n=this.context;if(n)try{const i=await this.getBuffer(e),r=n.createBufferSource();r.buffer=i;const a=n.createGain();a.gain.value=t,r.connect(a).connect(n.destination),r.start()}catch(i){console.warn("Thunder sound failed to load:",i)}}async getBuffer(e){const t=this.context;if(!t)throw new Error("WeatherAudio: AudioContext not ready — resume() must be called first");let n=this.buffers.get(e);return n||(n=fetch(e).then(i=>{if(!i.ok)throw new Error(`Audio fetch failed (${i.status}): ${e}`);return i.arrayBuffer()}).then(i=>t.decodeAudioData(i)),this.buffers.set(e,n)),n}stopSource(e,t){try{e?.stop()}catch{}e?.disconnect(),t?.disconnect()}}class zi{constructor(e){this.elements=e;const{eccentricity:t,perihelionAu:n}=e,[i,r]=this.perifocalAxes(),a=Math.sqrt(zi.SUN_GM_AU3_PER_DAY2*(1+t)/n);this.perihelionPosition=this.scale(i,n),this.perihelionVelocity=this.scale(r,a),this.inverseSemiMajorAxis=(1-t)/n}static SUN_GM_AU3_PER_DAY2=.0002959122082855911;static MAX_ITERATIONS=200;perihelionPosition;perihelionVelocity;inverseSemiMajorAxis;positionAt(e){const t=e-this.elements.perihelionJd,n=this.universalAnomaly(t),i=this.inverseSemiMajorAxis*n*n,r=this.elements.perihelionAu,a=1-n*n/r*zi.stumpffC(i),o=t-n*n*n/Math.sqrt(zi.SUN_GM_AU3_PER_DAY2)*zi.stumpffS(i);return{x:a*this.perihelionPosition.x+o*this.perihelionVelocity.x,y:a*this.perihelionPosition.y+o*this.perihelionVelocity.y,z:a*this.perihelionPosition.z+o*this.perihelionVelocity.z}}heliocentricDistanceAt(e){const t=this.positionAt(e);return Math.hypot(t.x,t.y,t.z)}universalAnomaly(e){if(e===0)return 0;const t=Math.sign(e),n=Math.sqrt(zi.SUN_GM_AU3_PER_DAY2)*Math.abs(e),i=o=>{const c=this.inverseSemiMajorAxis*o*o,l=this.elements.perihelionAu;return(1-this.inverseSemiMajorAxis*l)*o*o*o*zi.stumpffS(c)+l*o};let r=Math.max(1,n/this.elements.perihelionAu);for(;i(r)<n;)r*=2;let a=0;for(let o=0;o<zi.MAX_ITERATIONS&&r-a>1e-13*Math.max(1,r);o++){const c=(a+r)/2;i(c)<n?a=c:r=c}return t*(a+r)/2}perifocalAxes(){const e=this.elements.ascendingNodeDeg*Math.PI/180,t=this.elements.argumentOfPerihelionDeg*Math.PI/180,n=this.elements.inclinationDeg*Math.PI/180,i=Math.cos(e),r=Math.sin(e),a=Math.cos(t),o=Math.sin(t),c=Math.cos(n),l=Math.sin(n);return[{x:i*a-r*o*c,y:r*a+i*o*c,z:o*l},{x:-i*o-r*a*c,y:-r*o+i*a*c,z:a*l}]}scale(e,t){return{x:e.x*t,y:e.y*t,z:e.z*t}}static stumpffC(e){if(Math.abs(e)<1e-6)return 1/2-e/24+e*e/720;if(e>0)return(1-Math.cos(Math.sqrt(e)))/e;const t=Math.sqrt(-e);return(Math.cosh(t)-1)/-e}static stumpffS(e){if(Math.abs(e)<1e-6)return 1/6-e/120+e*e/5040;if(e>0){const n=Math.sqrt(e);return(n-Math.sin(n))/(n*n*n)}const t=Math.sqrt(-e);return(Math.sinh(t)-t)/(t*t*t)}}const dg=[{id:"halley-1910",designation:"1P/Halley",name:{en:"Halley's Comet",fr:"comète de Halley"},orbit:{eccentricity:.9672960498922706,perihelionAu:.5872100477652511,inclinationDeg:162.218798367122,ascendingNodeDeg:58.56208298700436,argumentOfPerihelionDeg:111.7366940639061,perihelionJd:2.4187816784171113e6},peakMagnitude:0,peakOn:"1910-05-20",absoluteMagnitude:4.72,activityExponent:4,tailLengthDeg:100,tailLengthAu:.1638,note:"Passed 0.15 au from Earth on 20 May 1910, and the Earth crossed the outer tail the day before — the apparition that produced a genuine public panic."},{id:"brooks-1911",designation:"C/1911 O1",name:{en:"Comet Brooks",fr:"comète Brooks"},orbit:{eccentricity:.9876404970138669,perihelionAu:.4898172916113738,inclinationDeg:33.34043866978714,ascendingNodeDeg:293.7022074981857,argumentOfPerihelionDeg:153.5578007321686,perihelionJd:2.4193378856140426e6},peakMagnitude:2,peakOn:"1911-10-25",absoluteMagnitude:5.59,activityExponent:4},{id:"skjellerup-maristany-1927",designation:"C/1927 X1",name:{en:"Comet Skjellerup-Maristany",fr:"comète Skjellerup-Maristany"},orbit:{eccentricity:.999839726885059,perihelionAu:.1761569619628186,inclinationDeg:85.1125991950808,ascendingNodeDeg:78.24360172472711,argumentOfPerihelionDeg:47.15877857390136,perihelionJd:2.4252326808989984e6},peakMagnitude:-6,peakOn:"1927-12-15",absoluteMagnitude:1.19,activityExponent:4,note:"One of the few comets of the century seen in full daylight."},{id:"de-kock-paraskevopoulos-1941",designation:"C/1941 B2",name:{en:"Comet de Kock-Paraskevopoulos",fr:"comète de Kock-Paraskevopoulos"},orbit:{eccentricity:.9991026715181549,perihelionAu:.7900329662827822,inclinationDeg:168.2039226531089,ascendingNodeDeg:43.10609347214336,argumentOfPerihelionDeg:268.6990344196369,perihelionJd:2430022157765061e-9},peakMagnitude:2,peakOn:"1941-02-05",absoluteMagnitude:5.01,activityExponent:4},{id:"southern-1947",designation:"C/1947 X1",name:{en:"the Southern Comet",fr:"comète australe"},orbit:{eccentricity:.9998424430916737,perihelionAu:.1100045955093761,inclinationDeg:138.5113919632757,ascendingNodeDeg:337.3114969669252,argumentOfPerihelionDeg:196.1820121395961,perihelionJd:2.4325220864727003e6},peakMagnitude:-3,peakOn:"1947-12-08",absoluteMagnitude:3.01,activityExponent:4,note:"A bright southern-hemisphere comet of December 1947, the month the American sighting wave of that year was still being argued over."},{id:"eclipse-1948",designation:"C/1948 V1",name:{en:"the Eclipse Comet",fr:"comète de l'éclipse"},orbit:{eccentricity:.9999130678247334,perihelionAu:.1354437057263306,inclinationDeg:23.11668597152911,ascendingNodeDeg:211.0454985994762,argumentOfPerihelionDeg:107.2474157073104,perihelionJd:2.4328519265329437e6},peakMagnitude:-2,peakOn:"1948-11-01",absoluteMagnitude:4.79,activityExponent:4,note:"Found during the total solar eclipse of 1 November 1948, which is how a comet that bright had gone unnoticed: it had been hidden in the Sun's glare."},{id:"arend-roland-1957",designation:"C/1956 R1",name:{en:"Comet Arend-Roland",fr:"comète Arend-Roland"},orbit:{eccentricity:1.0002570255357,perihelionAu:.3160532361485914,inclinationDeg:119.9440863251822,ascendingNodeDeg:215.8548157717755,argumentOfPerihelionDeg:308.775920364167,perihelionJd:2.4359365327396123e6},peakMagnitude:.5,peakOn:"1957-04-25",absoluteMagnitude:3.96,activityExponent:4,note:"Showed a spike pointing back TOWARD the Sun in late April 1957 — a real anti-tail, and much reported at the time."},{id:"mrkos-1957",designation:"C/1957 P1",name:{en:"Comet Mrkos",fr:"comète Mrkos"},orbit:{eccentricity:.9993521583504134,perihelionAu:.3549238508212375,inclinationDeg:93.9433042053929,ascendingNodeDeg:68.32441518619923,argumentOfPerihelionDeg:40.31823675802871,perihelionJd:243605193752228e-8},peakMagnitude:1,peakOn:"1957-08-05",absoluteMagnitude:5.07,activityExponent:4,note:"The second bright naked-eye comet of 1957, four months after Arend-Roland."},{id:"seki-lines-1962",designation:"C/1962 C1",name:{en:"Comet Seki-Lines",fr:"comète Seki-Lines"},orbit:{eccentricity:1.000003791331562,perihelionAu:.03139689112215131,inclinationDeg:65.01487186102287,ascendingNodeDeg:304.6776602796538,argumentOfPerihelionDeg:11.47295326312573,perihelionJd:2437756163010178e-9},peakMagnitude:-2.5,peakOn:"1962-04-01",absoluteMagnitude:9.3,activityExponent:4},{id:"ikeya-seki-1965",designation:"C/1965 S1",name:{en:"Comet Ikeya-Seki",fr:"comète Ikeya-Seki"},orbit:{eccentricity:.9999141178248997,perihelionAu:.007785966366889336,inclinationDeg:141.8642315267051,ascendingNodeDeg:346.9951764632611,argumentOfPerihelionDeg:69.04909813996062,perihelionJd:2.4390546837018197e6},peakMagnitude:-10,peakOn:"1965-10-21",alsoRecordedMagnitude:2,alsoRecordedOn:"1965-10-30",absoluteMagnitude:5.26,activityExponent:4.002,tailLengthDeg:25,tailLengthAu:.5048,note:"A sungrazer that passed 450 000 km above the Sun's surface and was seen beside it in broad daylight — the brightest comet of the twentieth century. It then stood in the dawn sky for a fortnight with a tail some 25 degrees long, which is the second magnitude recorded here."},{id:"bennett-1970",designation:"C/1969 Y1",name:{en:"Comet Bennett",fr:"comète Bennett"},orbit:{eccentricity:.9962979048768408,perihelionAu:.5376209981502136,inclinationDeg:90.03975717147327,ascendingNodeDeg:224.6576652531314,argumentOfPerihelionDeg:354.1494209173161,perihelionJd:2.4406655455270996e6},peakMagnitude:0,peakOn:"1970-03-26",absoluteMagnitude:3.36,activityExponent:4},{id:"white-ortiz-bolelli-1970",designation:"C/1970 K1",name:{en:"Comet White-Ortiz-Bolelli",fr:"comète White-Ortiz-Bolelli"},orbit:{eccentricity:.9999488875801225,perihelionAu:.00884411465256722,inclinationDeg:138.9520738221631,ascendingNodeDeg:336.8194095816687,argumentOfPerihelionDeg:61.10224765396615,perihelionJd:2.4407209807728203e6},peakMagnitude:1,peakOn:"1970-05-22",absoluteMagnitude:4.35,activityExponent:4},{id:"kohoutek-1973",designation:"C/1973 E1",name:{en:"Comet Kohoutek",fr:"comète Kohoutek"},orbit:{eccentricity:1.000007152175185,perihelionAu:.1424250377812859,inclinationDeg:14.30414984159355,ascendingNodeDeg:258.4893339663974,argumentOfPerihelionDeg:37.79772760699667,perihelionJd:2442044930687027e-9},peakMagnitude:0,peakOn:"1974-01-05",absoluteMagnitude:4.89,activityExponent:4,note:"Announced in advance as the comet of the century and remembered for disappointing: it was an ordinary naked-eye object, not the spectacle the press had promised."},{id:"west-1976",designation:"C/1975 V1",name:{en:"Comet West",fr:"comète West"},orbit:{eccentricity:1.000017859625611,perihelionAu:.1966006188461085,inclinationDeg:43.07319920579427,ascendingNodeDeg:118.9189245655447,argumentOfPerihelionDeg:358.4315101259072,perihelionJd:2442833721841768e-9},peakMagnitude:-3,peakOn:"1976-02-25",absoluteMagnitude:4.41,activityExponent:4,tailLengthDeg:30,tailLengthAu:.4325,note:"Broke into four pieces at perihelion. Barely reported at the time — the press had been burned by Kohoutek two years earlier."},{id:"iras-araki-alcock-1983",designation:"C/1983 H1",name:{en:"Comet IRAS-Araki-Alcock",fr:"comète IRAS-Araki-Alcock"},orbit:{eccentricity:.9898409731606003,perihelionAu:.9913412593828502,inclinationDeg:73.25000846947029,ascendingNodeDeg:49.10235754476374,argumentOfPerihelionDeg:192.8506176754439,perihelionJd:2.4454757545235856e6},peakMagnitude:1.7,peakOn:"1983-05-11",absoluteMagnitude:9.04,activityExponent:4,note:"Passed 0.031 au from Earth on 11 May 1983, one of the closest cometary approaches on record: it crossed a quarter of the sky in a night, which no other comet in this list did."},{id:"halley-1986",designation:"1P/Halley",name:{en:"Halley's Comet",fr:"comète de Halley"},orbit:{eccentricity:.9672792271749998,perihelionAu:.5871034488173393,inclinationDeg:162.2422242700916,ascendingNodeDeg:58.85993640671803,argumentOfPerihelionDeg:111.8655480539208,perihelionJd:2.4464709589610207e6},peakMagnitude:2.1,peakOn:"1986-03-10",absoluteMagnitude:2.71,activityExponent:4,note:"The worst-placed return in two thousand years — famous, expected, and for most observers a faint smudge."},{id:"hyakutake-1996",designation:"C/1996 B2",name:{en:"Comet Hyakutake",fr:"comète Hyakutake"},orbit:{eccentricity:.9997295133739305,perihelionAu:.2302272039470452,inclinationDeg:124.923592343765,ascendingNodeDeg:188.0454295899424,argumentOfPerihelionDeg:130.1724036582639,perihelionJd:2.4502048946148166e6},peakMagnitude:0,peakOn:"1996-03-25",absoluteMagnitude:4.75,activityExponent:4,tailLengthDeg:80,tailLengthAu:1,note:"Passed 0.10 au from Earth in March 1996, five weeks BEFORE perihelion, with a tail measured at some 80 degrees — the longest of the modern era."},{id:"hale-bopp-1997",designation:"C/1995 O1",name:{en:"Comet Hale-Bopp",fr:"comète Hale-Bopp"},orbit:{eccentricity:.9951314746156615,perihelionAu:.9141695067003724,inclinationDeg:89.43017155012492,ascendingNodeDeg:282.470602866853,argumentOfPerihelionDeg:130.5872524854533,perihelionJd:2450539633099368e-9},peakMagnitude:-.8,peakOn:"1997-04-01",absoluteMagnitude:-1.06,activityExponent:4,tailLengthDeg:20,tailLengthAu:.9938,note:"Visible to the naked eye for about eighteen months, longer than any comet on record."},{id:"mcnaught-2007",designation:"C/2006 P1",name:{en:"Comet McNaught",fr:"comète McNaught"},orbit:{eccentricity:1.00001811603225,perihelionAu:.1707325614080681,inclinationDeg:77.83726446452654,ascendingNodeDeg:267.4149080498975,argumentOfPerihelionDeg:155.9756130642756,perihelionJd:2454113298753579e-9},peakMagnitude:-5.5,peakOn:"2007-01-13",absoluteMagnitude:2.53,activityExponent:4,tailLengthDeg:35,tailLengthAu:.5009,note:"The brightest comet since Ikeya-Seki, seen in daylight beside the Sun in January 2007."},{id:"lovejoy-2011",designation:"C/2011 W3",name:{en:"Comet Lovejoy",fr:"comète Lovejoy"},orbit:{eccentricity:.999915056276912,perihelionAu:.005553783989325053,inclinationDeg:134.3558712062691,ascendingNodeDeg:326.3693517957772,argumentOfPerihelionDeg:53.50991655176601,perihelionJd:2455911511809431e-9},peakMagnitude:-3,peakOn:"2011-12-16",alsoRecordedMagnitude:1.5,alsoRecordedOn:"2011-12-22",absoluteMagnitude:3.51,activityExponent:1.194,note:"A sungrazer that was expected to be destroyed at perihelion and came out the other side, to stand in the southern dawn sky for the rest of December — which is the second magnitude recorded here."},{id:"panstarrs-2013",designation:"C/2011 L4",name:{en:"Comet PANSTARRS",fr:"comète PANSTARRS"},orbit:{eccentricity:1.000032542889696,perihelionAu:.301544229714915,inclinationDeg:84.2081978367921,ascendingNodeDeg:65.66588626213694,argumentOfPerihelionDeg:333.6516444379993,perihelionJd:2456361669960698e-9},peakMagnitude:1,peakOn:"2013-03-10",absoluteMagnitude:5.98,activityExponent:4},{id:"neowise-2020",designation:"C/2020 F3",name:{en:"Comet NEOWISE",fr:"comète NEOWISE"},orbit:{eccentricity:.9991782081129224,perihelionAu:.2946512466331692,inclinationDeg:128.9375043020912,ascendingNodeDeg:61.01042991771634,argumentOfPerihelionDeg:37.2786526292898,perihelionJd:2.4590341788972816e6},peakMagnitude:.9,peakOn:"2020-07-08",absoluteMagnitude:5.79,activityExponent:4,tailLengthDeg:10,tailLengthAu:.1808,note:"The first comet since Hale-Bopp that ordinary observers in the northern hemisphere saw without being told where to look."},{id:"tsuchinshan-atlas-2024",designation:"C/2023 A3",name:{en:"Comet Tsuchinshan-ATLAS",fr:"comète Tsuchinshan-ATLAS"},orbit:{eccentricity:1.000020192843226,perihelionAu:.3914228969475176,inclinationDeg:139.1105462619479,ascendingNodeDeg:21.55945689078845,argumentOfPerihelionDeg:308.4913086299446,perihelionJd:2460581242087108e-9},peakMagnitude:0,peakOn:"2024-10-14",absoluteMagnitude:3.97,activityExponent:4,tailLengthDeg:20,tailLengthAu:.1902,note:"Briefly reported far brighter around 9 October 2024, when it stood almost between the observer and the Sun and forward-scattered the light through its own dust — a geometry this catalog's brightness model does not attempt, so what is stored is the ordinary evening-sky peak a few days later."}];class ow{static WINDOW_DAYS=200;static TWILIGHT_ELONGATION_DEG=15;static LIGHT_SPEED_AU_PER_DAY=173.144632674;static orbits=new Map;static aroundDate(e){const t=this.julianDayOf(e);return dg.filter(n=>Math.abs(t-n.orbit.perihelionJd)<=this.WINDOW_DAYS)}static brightestAt(e,t){return this.aroundDate(e).map(n=>this.appearanceOf(n,e,t)).sort((n,i)=>n.magnitude-i.magnitude)[0]}static appearanceOf(e,t,n){const i=Tt(t),r=this.earthPositionAt(i),a=this.apparentPositionOf(e,2451545+i.tt,r),o=this.subtract(a,r),c=this.length(a),l=this.length(o),h=this.tailEndAt(e,a,r,c,i,t,n),u=this.horizontalOf(o,i,t,n);return{apparition:e,position:u,...h,heliocentricDistanceAu:c,earthDistanceAu:l,elongationDeg:this.angleBetween(o,this.subtract({x:0,y:0,z:0},r)),magnitude:this.magnitudeAt(e,c,l)}}static magnitudeAt(e,t,n){const i=e.absoluteMagnitude+5*Math.log10(n)+2.5*e.activityExponent*Math.log10(t);return Math.max(i,e.peakMagnitude)}static tailEndAt(e,t,n,i,r,a,o){if(e.tailLengthAu===void 0)return{};const c=1+e.tailLengthAu/i,l=this.subtract({x:t.x*c,y:t.y*c,z:t.z*c},n),h=this.subtract(t,n);return{tailEnd:this.horizontalOf(l,r,a,o),tailLengthDeg:this.angleBetween(h,l)}}static apparentPositionOf(e,t,n){const i=this.orbitOf(e);let r=i.positionAt(t);for(let a=0;a<2;a++){const o=this.length(this.subtract(r,n))/this.LIGHT_SPEED_AU_PER_DAY;r=i.positionAt(t-o)}return r}static horizontalOf(e,t,n,i){const r=Br(a5(),new vt(e.x,e.y,e.z,t)),a=Br(jm(t),r),o=zS(t,new md(i.lat,i.lng,i.elevationM)),c=new vt(a.x-o.x,a.y-o.y,a.z-o.z,t),l=vd(c);return Md(l.ra,l.dec,n,i)}static earthPositionAt(e){return Br(r5(),vs(Se.Earth,e))}static julianDayOf(e){return 2451545+Tt(e).tt}static orbitOf(e){const t=this.orbits.get(e.id);if(t)return t;const n=new zi(e.orbit);return this.orbits.set(e.id,n),n}static subtract(e,t){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}}static length(e){return Math.hypot(e.x,e.y,e.z)}static angleBetween(e,t){const n=(e.x*t.x+e.y*t.y+e.z*t.z)/(this.length(e)*this.length(t)||1);return Math.acos(Math.min(1,Math.max(-1,n)))*180/Math.PI}}const ch=[{id:"sn-1006",kind:"supernova",designation:"SN 1006",name:{en:"Supernova of 1006",fr:"supernova de 1006"},raHours:15.03947,decDeg:-42.09694,peakMagnitude:-7.5,peakJd:2088620,startJd:2088620,lightCurve:[[0,-7.5],[29,-5.9],[60,-4.9],[106,-3.2],[166,-1.9],[258,-1],[350,.5],[364,.7],[411,1.2],[456,1.8],[484,2.5],[785.5,7]],source:"Winkler, Gupta & Long 2003 (peak); decline borrowed from SN 1572",note:"The brightest stellar event in recorded history, seen in daylight, low in the southern sky from Europe and the Near East. The decline is modelled, not recorded, and falls below the naked eye after about two years where the chronicles speak of three."},{id:"sn-1054",kind:"supernova",designation:"SN 1054",name:{en:"Supernova of 1054",fr:"supernova de 1054"},raHours:5.5755,decDeg:22.0175,peakMagnitude:-6,peakJd:2106216,startJd:2106216,lightCurve:[[0,-6],[23,-4],[642,6]],source:"Chinese chronicles (Song huiyao), via Stephenson & Green 2002",note:"The explosion that left the Crab Nebula. Its magnitude is an estimate; the two durations are recorded."},{id:"sn-1181",kind:"supernova",designation:"SN 1181",name:{en:"Supernova of 1181",fr:"supernova de 1181"},raHours:.88645,decDeg:67.50067,peakMagnitude:0,peakJd:2152636,startJd:2152636,lightCurve:[[0,0],[185,6]],source:"Chinese and Japanese chronicles, via Stephenson & Green 2002",note:"Circumpolar from Europe and China, so never set. Its peak magnitude is uncertain by at least a magnitude."},{id:"sn-1572",kind:"supernova",designation:"SN 1572",name:{en:"Tycho's Supernova",fr:"supernova de Tycho"},raHours:.42264,decDeg:64.14083,peakMagnitude:-4,peakJd:2295551,startJd:2295546,lightCurve:[[0,-3],[5,-4],[34,-2.4],[65,-1.4],[111,.3],[171,1.6],[263,2.5],[355,4],[369,4.2],[416,4.7],[461,5.3],[489,6]],source:"Tycho Brahe and contemporaries, reduced by Ruiz-Lapuente 2004",note:"Circumpolar from northern Europe. Tycho showed it had no parallax, so it was not in the air: a new star, beyond the Moon."},{id:"sn-1604",kind:"supernova",designation:"SN 1604",name:{en:"Kepler's Supernova",fr:"supernova de Kepler"},raHours:17.51125,decDeg:-21.48733,peakMagnitude:-2.95,peakJd:2307210,startJd:2307191,lightCurve:[[0,.23],[3,-1.3],[6,-2.08],[9,-2.17],[19,-2.95],[27,-2.95],[32,-1.95],[36,-1.52],[86,.9],[96,.45],[103,1],[114,1.2],[118,1.55],[133,1.95],[137,2.3],[170,2.25],[185,2.25],[194,2.4],[197,2.9],[308,4.45],[324,4.45],[339,4.95],[364,4.7]],source:"Kepler, Fabricius, Maestlin and the Korean court astronomers, reduced by Ruiz-Lapuente 2017",note:"The last supernova in our Galaxy seen with the naked eye. It went behind the Sun from mid-November 1604 to January 1605, which is the gap in its record."},{id:"t-crb-1866",kind:"nova",designation:"T CrB",name:{en:"Nova Coronae Borealis 1866",fr:"nova de la Couronne boréale 1866"},raHours:15.99171,decDeg:25.92017,peakMagnitude:2,peakJd:2402734,startJd:2402734,lightCurve:[[0,2],[1.5,3],[2.5,3.11],[6.5,5.18],[8.5,5.75],[10.5,6.85],[11.5,6.8],[12.5,7.5],[16,8.18],[32,9.27],[38,9.2],[40,8.95],[44,9.4],[48,9.07],[54,9.4],[58,9.21],[79,9.44],[107,9.26],[111,9.01],[115,8.21],[119,7.96],[159,7.51],[179,7.57],[183,7.97],[191,7.66],[199,8.2],[207,8.31],[211,8.83],[215,8.65],[223,8.97],[297,8.9],[345,9.25],[377,9.07],[425,9.3],[537,9.3]],source:"Recorded peak (Birmingham); curve borrowed from its 1946 eruption",note:"The first eruption of the recurrent nova T CrB to be seen. The decline is its 1946 one."},{id:"t-aur-1891",kind:"nova",designation:"T Aur",name:{en:"Nova Aurigae 1891",fr:"nova du Cocher 1891"},raHours:5.53309,decDeg:30.44583,peakMagnitude:4.49,peakJd:2412083,startJd:2412079,lightCurve:[[0,5.28],[4,4.49],[24,4.58],[40,4.97],[52,4.95],[56,4.5],[60,4.9],[68,4.88],[72,5.25],[76,4.93],[84,5.44],[88,7.23],[96,8.85],[100,10.44]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"gk-per-1901",kind:"nova",designation:"GK Per",name:{en:"Nova Persei 1901",fr:"nova de Persée 1901"},raHours:3.52,decDeg:43.90431,peakMagnitude:.19,peakJd:24154395e-1,startJd:24154377e-1,lightCurve:[[0,2.7],[.8,.86],[1.8,.19],[2.3,.2],[5.8,1.78],[11.8,2.54],[12.8,2.98],[17.8,3.62],[18.8,3.35],[19.8,3.77],[20.8,3.59],[22.8,3.95],[24.8,3.82],[25.6,4.99],[25.9,4.89],[26.6,3.69],[27.6,3.94],[27.9,4.61],[28.6,5.28],[28.9,4.46],[29.9,3.8],[30.9,4.27],[31.6,5.21],[31.9,5.22],[32.9,3.88],[33.9,4.19],[34.6,4.85],[35.6,4.8],[36.6,4.23],[37.6,4.44],[38.9,4.15],[39.7,5.19],[40.6,5.39],[40.9,5.35],[41.9,4.01],[42.6,4.5],[42.9,4.49],[43.6,5.53],[44,5.23],[44.6,5.61],[44.9,5.5],[45.9,4.17],[46.9,4.69],[47.6,5.5],[48.6,5.59],[49.6,5.14],[49.9,4.48],[50.6,4.45],[50.9,4.55],[51.6,5.47],[52.6,5.74],[53.7,5.66],[55.7,4.41],[56.7,5.43],[58.7,5.81],[58.9,5.58],[59.7,5.64],[59.9,4.76],[60.9,4.26],[61.9,5.62],[62.7,5.85],[62.9,5.53],[63.7,5.8],[64.9,4.28],[65.6,5.33],[66.7,5.87],[66.9,5.56],[68.7,5.7],[68.9,5.3],[69.7,4.47],[70.7,5.65],[72.9,5.98],[73.9,5.71],[74.7,4.98],[74.9,4.46],[75.7,4.87],[76.9,6.05],[77.6,5.76],[78,6],[78.7,5.95],[80.7,4.98],[81.9,5.85],[82.7,6.02],[84.7,5.41],[84.9,5.08],[85.7,5.17],[85.9,5.6],[87,6.1],[88.8,6.2],[89.7,4.96],[89.9,4.93],[90.7,5.9],[91.9,6.32],[92.7,5.86],[93.1,6.24],[93.7,5.38],[93.9,6.2],[96.1,6.12],[97.1,6.37],[97.6,5.12],[98,5.85],[99.3,6.35],[101.3,6.12],[101.7,5.25],[102.3,4.95],[102.7,6.12],[103.2,5.83],[104.7,6.37],[105,6.13],[106,6.22],[106.7,4.88],[107.7,6.3],[108.1,6.4],[109,6],[109.7,5.16],[110,5.82],[112.1,5.89],[113.1,5.5],[115.7,5.8],[116,6.11],[118.7,5.68],[119,6.23],[119.7,5.85],[120,6.12],[121,4.62],[121.8,5.9],[123,5.48],[125,6.05],[126,5.89],[130.9,6.11],[146.1,6.02],[155.6,6.26],[180.4,6.09],[190.4,6.39],[245.5,6.87],[266.2,6.77],[301.1,7.16],[321.5,7.07],[346.5,7.87],[375.7,7.86],[385.8,8.09],[389.8,8.55],[406.1,8.33],[416.5,8.59],[445.9,8.62],[472.1,9.24],[565.9,9.74],[571,9.4],[589.8,9.76]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010",note:"Discovered on 21 February 1901 by Thomas Anderson in Edinburgh, and the brightest nova of the century until V603 Aql."},{id:"dn-gem-1912",kind:"nova",designation:"DN Gem",name:{en:"Nova Geminorum 1912",fr:"nova des Gémeaux 1912"},raHours:6.9151,decDeg:32.14108,peakMagnitude:3.58,peakJd:241947675e-2,startJd:241947275e-2,lightCurve:[[0,11.7],[1,4.5],[4,3.58],[5,4.45],[5.5,5.32],[6,5.53],[6.5,5.11],[8,5.43],[8.5,5.16],[11,5.53],[11.5,5.13],[12,5.18],[13.75,4.5],[15.75,5.3],[18.75,6],[19.75,5.55],[26.75,6],[28.75,5.9],[31.75,6.6],[32.75,6.2],[33.75,6.5],[36.75,6.55],[39.75,6.2],[40.75,6.75],[41.75,7],[44.75,6.75],[52.75,6.75],[54.75,7.23],[58.25,7.5],[62.25,7.3],[64.25,7.47],[66.25,8.1],[70.25,7.5],[72.25,8.1],[78.25,7.55],[80.25,8.2],[86.25,7.2],[90.25,7.3],[92.25,7.8],[152.25,7.2],[160.25,7.4],[166.25,8.2],[168.25,8.2],[170.25,7.3],[180.25,7.4],[182.25,8],[186.25,7.5],[190.25,7.6],[192.25,8],[211.25,7.75],[227.25,8],[275.25,7.78],[315.25,8.6],[331.25,7.79],[339.25,8.27],[363.25,8.61],[443.25,8.93],[451.25,9.2],[535.25,10.3],[567.25,9.9],[615.25,10.8],[631.25,10.63],[647.25,10.88],[679.25,10.8],[695.25,11.07],[727.25,11]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"v603-aql-1918",kind:"nova",designation:"V603 Aql",name:{en:"Nova Aquilae 1918",fr:"nova de l'Aigle 1918"},raHours:18.81518,decDeg:.58414,peakMagnitude:-.5,peakJd:242175475e-2,startJd:242174875e-2,lightCurve:[[0,11.3],[2,10.5],[4,6.6],[4.5,1.04],[6,-.5],[6.5,.18],[10,1.1],[10.5,.95],[12.75,1.89],[21.75,3.07],[23.75,3.76],[29.75,3.16],[34.75,3.5],[36.75,3.86],[44.75,3.79],[48.75,4.43],[52.75,3.84],[56.75,3.95],[57.75,4.04],[58.75,4.49],[59.75,4.42],[60.75,4.69],[62.75,4.6],[63.75,4.11],[64.75,3.97],[68.75,4.18],[70.75,4.65],[71.75,4.51],[73.75,4.73],[75.75,4.44],[79.75,4.85],[83.75,4.43],[89.75,4.88],[92.75,4.86],[94.75,4.58],[96.75,4.92],[99.75,5.05],[163.25,5.45],[167.25,5.7],[179.25,5.48],[191.25,5.8],[203.25,5.5],[247.25,5.9],[251.25,6.25],[257.25,5.5],[265.25,6.13],[281.25,6.33],[345.25,6.3],[385.25,6.73],[393.25,6.43],[425.25,6.71],[433.25,6.56],[461.25,7.27],[525.25,7.6],[541.25,7.47],[637.25,8.3],[669.25,8.17],[717.25,8.55],[749.25,8.4],[765.25,8.68],[885.25,8.75],[949.25,9.4],[1013.25,9.19],[1141.25,9.57],[1269.25,9.48],[1333.25,9.95],[1653.25,9.94],[1781.25,10.28],[1909.25,10.34],[2037.25,10.1],[2101.25,10.46],[2165.25,10.51],[2357.25,10.3],[2549.25,10.77],[2741.25,10.46],[2869.25,10.83],[3125.25,10.71],[3317.25,11.22],[3381.25,10.91],[3637.25,11.42],[3829.25,10.96],[3893.25,11.65],[3957.25,11.63],[4085.25,11.14],[4213.25,11.48],[4277.25,10.7],[4341.25,11.42],[4405.25,11.47],[4469.25,11.06],[4533.25,11.08],[4597.25,11.7],[4725.25,11.45],[4789.25,10.94]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010",note:"The brightest nova of the modern era, at magnitude -0.5 on 9-10 June 1918: as bright as Vega, in a summer evening sky, in wartime."},{id:"v476-cyg-1920",kind:"nova",designation:"V476 Cyg",name:{en:"Nova Cygni 1920",fr:"nova du Cygne 1920"},raHours:19.97347,decDeg:53.61858,peakMagnitude:1.94,peakJd:242256025e-2,startJd:242255925e-2,lightCurve:[[0,2.7],[1,1.94],[3,2.07],[4.5,2.95],[8.25,4],[31.75,6.41],[35.75,7.23],[37.75,7.08],[41.75,7.33],[43.75,7.92],[45.75,8.2],[51.75,8.59],[63.75,8.82],[65.75,9.25],[71.75,8.93],[85.75,9.43],[87.75,9.05],[95.75,9.2],[97.75,8.67],[99.75,9.07],[112.75,8.78],[120.75,9.03],[128.75,8.67],[144.75,8.94],[152.75,8.73],[168.75,8.79],[176.75,9.28],[192.75,9],[216.75,9.6],[232.75,9.27],[240.75,9.5],[288.75,9.4],[296.75,9.6],[304.75,9.3],[320.75,9.73],[328.75,9.5],[336.75,9.8],[428.75,9.61],[476.75,10.01],[492.75,9.76],[508.75,9.87],[524.75,9.65],[556.75,9.87],[572.75,9.65],[620.75,10.22],[668.75,10.44],[684.75,10.23],[716.75,10.33],[756.75,10.66],[884.75,10.59],[948.75,10.96],[1108.75,10.96]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"rr-pic-1925",kind:"nova",designation:"RR Pic",name:{en:"Nova Pictoris 1925",fr:"nova du Peintre 1925"},raHours:6.59335,decDeg:-62.64008,peakMagnitude:.95,peakJd:24243085e-1,startJd:24242995e-1,lightCurve:[[0,2.43],[5,2.35],[6,2.1],[7,2.4],[9,.95],[13,1.8],[14,1.7],[16,2.15],[18,2.2],[19,1.9],[23,3.1],[27,3.05],[31.5,3.58],[43.5,3.08],[47.5,3.15],[57.5,2.3],[59.5,1.65],[63.5,3.03],[65.5,2.84],[67.5,3.16],[69.5,2.4],[71.5,2.04],[73.5,2.05],[75.5,2.55],[79.5,3],[83.5,3.15],[116.5,3.54],[120.5,3.78],[124.5,3.67],[136.5,4.18],[148.5,4.34],[154.5,4.17],[194.5,4.43],[226.5,4.93],[234.5,4.8],[242.5,5.4],[250.5,5.5],[266.5,5.15],[298.5,5.6],[362.5,5.4],[414.5,5.7],[430.5,5.5],[494.5,6.2],[718.5,6.52],[830.5,6.3],[862.5,6.6],[878.5,6.4],[910.5,6.77],[958.5,6.67],[1062.5,7.07],[1318.5,7.35],[1590.5,8.12],[1718.5,8.25],[2486.5,8.59],[2614.5,8.47],[2742.5,8.7],[3382.5,8.6],[3766.5,8.97],[4022.5,8.79],[4150.5,9.22],[6710.5,10.29],[7414.5,11.03],[8438.5,10.96]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010",note:"A slow nova, and a southern one: more than two months within two magnitudes of its peak."},{id:"dq-her-1934",kind:"nova",designation:"DQ Her",name:{en:"Nova Herculis 1934",fr:"nova d'Hercule 1934"},raHours:18.12507,decDeg:45.85906,peakMagnitude:1.56,peakJd:24277935e-1,startJd:242778675e-2,lightCurve:[[0,3.4],[1.5,2.4],[3,2.67],[5.75,2.01],[6.75,1.56],[7.75,1.59],[11.75,2.97],[12.75,2.31],[14.75,3.07],[15.75,2.56],[16.75,2.51],[19.75,2.68],[23.75,2.53],[24.75,2.27],[26.75,2.58],[30.75,2.24],[31.75,2.63],[32.75,2.66],[34.75,2.11],[39.75,2.71],[41.75,2.31],[43.75,2.37],[46.75,3.64],[47.75,3.21],[50.75,3.23],[52.75,2.66],[55.75,2.56],[58.75,2.97],[60.75,2.77],[61.75,3.36],[63.75,3.43],[64.75,2.89],[65.75,3.22],[68.75,3.52],[69.75,2.95],[70.75,3.06],[71.75,2.7],[76.75,3.65],[79.75,3.74],[81.75,3.21],[83.75,3.75],[87.75,3.69],[92.75,4.04],[94.75,4.8],[97.75,4.24],[98.75,4.52],[100.75,4.08],[101.75,4.43],[105.75,4.58],[106.75,4.33],[107.75,4.73],[108.75,6.57],[109.75,8.08],[110.75,8.15],[111.75,8.56],[113.75,8.45],[114.75,9.15],[115.75,9.15],[116.75,9.59],[117.75,9.43],[118.75,9.8],[122.75,10.5],[123.75,10.28],[124.75,10.93],[127.75,10.83],[129.75,11.87],[131.75,12.42],[135.75,12.5],[137.75,12.9],[138.75,12.77],[139.75,13],[143.75,12],[144.75,12.33],[146.75,12.35],[147.75,11.64],[148.75,11.83],[150.75,10.9],[151.75,10.78],[152.75,11.17],[154.75,10.32],[155.75,10.4],[165.25,9.24],[185.25,7.74],[225.25,6.8],[273.25,6.72],[321.25,6.97],[333.25,6.79],[353.25,7],[357.25,6.82],[377.25,6.88],[401.25,7.29],[409.25,6.8],[413.25,6.8],[419.25,7.1],[435.25,7.09],[451.25,7.4],[475.25,7],[555.25,7.48],[823.25,7.83],[855.25,8.18],[1135.25,8.43],[1823.25,9.98],[1887.25,9.71],[2015.25,10.55],[2335.25,10.95]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010",note:"Lost about ten magnitudes in a few weeks from April 1935, when dust condensed around it, then came back to naked-eye brightness."},{id:"cp-lac-1936",kind:"nova",designation:"CP Lac",name:{en:"Nova Lacertae 1936",fr:"nova du Lézard 1936"},raHours:22.26142,decDeg:55.61703,peakMagnitude:2.02,peakJd:242834025e-2,startJd:242833825e-2,lightCurve:[[0,4.03],[.5,2.9],[1,2.45],[2,2.02],[2.5,2.61],[4,3],[4.5,3.35],[5,3.3],[9.25,4.59],[14.25,5.45],[22.25,6.03],[23.25,6.3],[26.25,6.23],[38.25,6.74],[41.25,6.61],[50.25,7.35],[53.25,7.27],[57.25,7.7],[58.25,7.54],[60.25,7.55],[61.25,7.79],[71.25,7.6],[74.25,7.81],[76.25,8.3],[77.25,7.79],[86.25,8.21],[87.25,8],[88.25,8.25],[92.25,8.17],[94.25,8.47],[102.25,8.27],[103.25,8.7],[104.25,8.4],[110.25,8.66],[116.75,8.55],[122.75,8.83],[126.75,8.7],[140.75,9.06],[154.75,9.01],[164.75,9.36],[170.75,9.18],[174.75,9.48],[186.75,9.42],[188.75,9.73],[192.75,9.53],[200.75,9.74],[202.75,9.5],[204.75,9.77],[208.75,9.6],[214.75,9.75],[216.75,10.05],[222.75,9.7],[232.75,10.03],[236.75,9.82],[250.75,10.1],[254.75,9.9],[260.75,10.1],[264.75,9.8],[266.75,10.15],[268.75,10],[274.75,10.2],[276.75,9.9],[292.75,10.6],[294.75,10.6],[298.75,10.1],[318.75,10.35],[320.75,10.6],[322.75,10.3],[328.75,10.65],[332.75,10.3],[338.75,10.7],[348.75,10.53],[350.75,10.7],[354.75,10.37],[358.75,10.58],[365.75,10.43],[373.75,10.85],[421.75,10.94]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"cp-pup-1942",kind:"nova",designation:"CP Pup",name:{en:"Nova Puppis 1942",fr:"nova de la Poupe 1942"},raHours:8.19613,decDeg:-35.35139,peakMagnitude:.73,peakJd:243067675e-2,startJd:243067275e-2,lightCurve:[[0,.95],[4,.73],[4.5,1.3],[5.5,1.47],[6,2.01],[7.75,2.88],[8.75,2.97],[10.75,3.5],[11.75,4.02],[13.75,4.4],[14.75,3.8],[17.75,5],[18.75,4.93],[19.75,5.48],[23.75,5.5],[25.75,5.65],[26.75,5.99],[33.25,6.28],[45.25,6.6],[57.25,6.41],[81.25,6.85],[89.25,6.5],[97.25,6.67],[101.25,7],[113.25,6.66],[125.25,7.1],[135.25,6.96],[231.25,7.86],[279.25,7.8],[327.25,8.33],[407.25,8.18],[423.25,8.59],[471.25,8.53],[503.25,8.99],[551.25,8.97],[567.25,8.7],[583.25,9.47],[615.25,8.95],[655.25,9.5],[751.25,9.55],[815.25,10.09],[847.25,10.02],[879.25,10.48],[911.25,10.34],[1023.25,10.79],[1279.25,10.9]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010",note:"One of the fastest bright novae: two magnitudes gone in four days."},{id:"t-crb-1946",kind:"nova",designation:"T CrB",name:{en:"Nova Coronae Borealis 1946",fr:"nova de la Couronne boréale 1946"},raHours:15.99171,decDeg:25.92017,peakMagnitude:2.5,peakJd:2431860,startJd:2431860,lightCurve:[[0,2.5],[1.5,3.5],[2.5,3.61],[6.5,5.68],[8.5,6.25],[10.5,7.35],[11.5,7.3],[12.5,8],[16,8.68],[32,9.77],[38,9.7],[40,9.45],[44,9.9],[48,9.57],[54,9.9],[58,9.71],[79,9.94],[107,9.76],[111,9.51],[115,8.71],[119,8.46],[159,8.01],[179,8.07],[183,8.47],[191,8.16],[199,8.7],[207,8.81],[211,9.33],[215,9.15],[223,9.47],[297,9.4],[345,9.75],[377,9.57],[425,9.8],[537,9.8]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010",note:"A recurrent nova. It erupted in 1866 and in 1946, and a third eruption was expected from 2024 on."},{id:"v446-her-1960",kind:"nova",designation:"V446 Her",name:{en:"Nova Herculis 1960",fr:"nova d'Hercule 1960"},raHours:18.956,decDeg:13.24147,peakMagnitude:4.83,peakJd:24370038e-1,startJd:24370033e-1,lightCurve:[[0,5.2],[.5,4.83],[2,4.9],[2.5,5.4],[3,5.05],[3.5,5.57],[4,5.25],[5,5.5],[6.5,5.4],[7.2,5.78],[8.2,5.6],[9.2,5.98],[10.2,5.92],[11.2,6.21],[16.2,6.1],[17.2,6.23],[18.2,7.2],[19.2,6.51],[20.2,6.78],[26.2,6.97],[27.2,7.24],[28.2,7.13],[29.2,7.45],[31.2,7.2],[40.7,7.57],[44.7,8.25],[46.7,7.84],[56.7,8.15],[60.7,8.9],[70.7,8.7],[72.7,8.14],[76.7,8.71],[80.7,8.47],[82.7,8.87],[86.7,8.57],[90.7,8.93],[107.7,9.11],[111.7,8.94],[115.7,9.27],[139.7,9.38],[151.7,9.91],[155.7,9.72],[173.7,10.51],[221.7,10.95]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"v533-her-1963",kind:"nova",designation:"V533 Her",name:{en:"Nova Herculis 1963",fr:"nova d'Hercule 1963"},raHours:18.23902,decDeg:41.85614,peakMagnitude:3,peakJd:24380605e-1,startJd:24380565e-1,lightCurve:[[0,8],[4,3],[4.5,3],[8,4],[13,3.95],[15,4.6],[21,4.53],[24,5.05],[27,5.15],[32,4.76],[34,4.98],[35,5.39],[37,5.43],[41,6.04],[49,6.02],[56.5,6.34],[60.5,6.11],[74.5,6.72],[102.5,6.99],[137.5,7.81],[197.5,8.31],[217.5,8.8],[225.5,8.57],[233.5,9.03],[237.5,8.78],[277.5,9.44],[301.5,9.46],[315.5,9.86],[323.5,9.73],[339.5,10.05],[355.5,10.74],[363.5,10.32],[371.5,10.6],[387.5,10.69],[427.5,10.38],[435.5,10.84],[443.5,10.74],[451.5,11.33],[459.5,10.98],[467.5,11.17],[507.5,11.16],[539.5,11.66],[603.5,11.7],[619.5,12.05],[651.5,12.03],[659.5,11.74],[667.5,10.9]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"hr-del-1967",kind:"nova",designation:"HR Del",name:{en:"Nova Delphini 1967",fr:"nova du Dauphin 1967"},raHours:20.70565,decDeg:19.16092,peakMagnitude:3.58,peakJd:2439838,startJd:2439646,lightCurve:[[0,11.9],[6,11.8],[12,8.8],[16,8.3],[20,6.7],[30,5.8],[36,5.51],[66,5.55],[78,5.35],[86,4.89],[96,5],[108,4.75],[136,5.13],[152,4.83],[182,4.93],[186,4.59],[192,3.58],[202,5],[220,5.46],[226,5.14],[230,5.45],[232,5.14],[236,5],[242,5.08],[244,4.59],[246,4.45],[254,5.3],[256,4.75],[260,5.69],[268,4.8],[274,4.94],[276,5.45],[280,5.2],[282,5.51],[286,5.58],[292,4.95],[294,5.16],[298,4.94],[311,5.09],[335,4.4],[367,5.76],[407,6.16],[423,6.55],[603,7.43],[907,8.32],[1451,9.41],[2347,10.75]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010",note:"An exceptionally slow nova: rose over months and stayed near magnitude 4 to 5 for most of 1967 and 1968."},{id:"lv-vul-1968",kind:"nova",designation:"LV Vul",name:{en:"Nova Vulpeculae 1968",fr:"nova du Petit Renard 1968"},raHours:19.80012,decDeg:27.1715,peakMagnitude:4.5,peakJd:243996425e-2,startJd:243996325e-2,lightCurve:[[0,5],[1,4.5],[2,5],[2.5,4.86],[3,5.1],[3.5,4.88],[4,5.1],[5,4.9],[7,5.4],[8,5.23],[10.5,5.42],[12,5.82],[13,5.4],[13.5,5.74],[14,5.7],[14.5,6.08],[15,5.75],[15.5,5.86],[16,5.6],[17,5.8],[18,5.6],[20.5,6.34],[21,6.2],[22.5,6.84],[23,6.57],[24,6.98],[24.5,6.3],[25,7.1],[26,6.65],[34.25,7.48],[35.25,7.23],[39.25,7.32],[44.25,7.76],[45.25,7.49],[46.25,7.78],[50.25,7.84],[51.25,8.1],[53.25,7.9],[54.25,8.13],[56.25,8],[57.75,8.24],[67.75,8.52],[75.75,8.38],[83.75,8.69],[89.75,8.59],[125.75,9.32],[127.75,9.33],[129.75,8.98],[131.75,9.29],[135.75,9.43],[212.75,9.9],[220.75,10.16],[228.75,10.03],[236.75,10.3],[244.75,10.16],[264.75,10.54],[280.75,10.45],[296.75,10.79],[328.75,10.78]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"fh-ser-1970",kind:"nova",designation:"FH Ser",name:{en:"Nova Serpentis 1970",fr:"nova du Serpent 1970"},raHours:18.51307,decDeg:2.61444,peakMagnitude:4.5,peakJd:244063425e-2,startJd:244063125e-2,lightCurve:[[0,7],[2,5],[3,4.5],[3.5,5],[4.5,4.6],[5.5,5],[6.5,4.68],[12.25,4.66],[16.25,5.3],[17.25,5.72],[18.25,5.3],[19.25,5.2],[23.25,5.84],[24.25,5.68],[27.25,5.9],[30.25,5.47],[32.25,5.9],[34.25,5.7],[43.25,6.28],[45.25,6.1],[50.25,6.62],[52.25,6.47],[57.25,6.63],[60.25,7.08],[61.25,6.87],[62.25,7.2],[63.25,6.85],[64.25,7.68],[65.25,7.3],[66.25,8.3],[67.25,7.93],[69.25,9.15],[71.25,9.2],[72.25,9.63],[74.25,9.9],[76.25,9.7],[77.25,10.25],[78.25,10.1],[79.25,10.4],[80.25,10.23],[81.25,10.57],[83.25,10.64],[85.25,10.35],[86.25,11.2],[87.25,10.1],[89.25,11.2],[96.25,11.35],[100.25,11.95],[102.25,11.1],[104.25,11.65],[106.25,11.5],[108.25,12.07],[114.75,11.32],[118.75,11.28],[122.75,10.93],[130.75,10.85],[134.75,10.52],[154.75,10.65],[162.75,10.12],[174.75,9.98],[178.75,10.34],[186.75,9.98],[214.75,10.25],[224.75,10.02],[240.75,10.2],[264.75,10],[272.75,10.2],[280.75,10.05],[288.75,10.4],[296.75,10],[348.75,10.7],[396.75,10.3],[444.75,10.73],[460.75,10.59],[540.75,10.94],[556.75,10.82]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"v1500-cyg-1975",kind:"nova",designation:"V1500 Cyg",name:{en:"Nova Cygni 1975",fr:"nova du Cygne 1975"},raHours:21.19349,decDeg:48.15056,peakMagnitude:1.88,peakJd:244265525e-2,startJd:244265425e-2,lightCurve:[[0,2.44],[1,1.88],[1.5,1.88],[2.5,2.41],[3,3.38],[4,4.28],[8.25,5.81],[11.25,6.46],[22.25,7.35],[33.25,7.73],[34.25,7.97],[37.25,7.86],[40.25,8.3],[43.25,8.19],[48.25,8.6],[49.25,8.46],[66.25,9.04],[70.25,8.93],[75.25,9.23],[76.25,9.03],[80.25,9.39],[81.25,9.19],[83.25,9.35],[84.25,9.13],[86.25,9.39],[89.25,9.32],[90.25,9.54],[93.25,9.37],[105.75,9.86],[193.75,10.43],[201.75,10.7],[209.75,10.47],[257.75,10.94],[265.75,10.81]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010",note:"One of the fastest novae on record: discovered on 29 August 1975, at its peak of magnitude 1.9 within two days, and two magnitudes down again two days later."},{id:"v842-cen-1986",kind:"nova",designation:"V842 Cen",name:{en:"Nova Centauri 1986",fr:"nova du Centaure 1986"},raHours:14.59794,decDeg:-57.6265,peakMagnitude:4.9,peakJd:244675975e-2,startJd:244675725e-2,lightCurve:[[0,5.6],[2.5,4.9],[3.5,5.1],[15.5,5.1],[17.5,5.75],[18.5,5.4],[20.5,5.5],[22.5,5.95],[30.5,6.15],[31.5,6.3],[32,7.5],[34.5,7.2],[38.5,7.5],[39,7],[41.5,7.15],[42.5,6.7],[44.5,7.23],[45.5,6.6],[53,9.3]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"sn-1987a",kind:"supernova",designation:"SN 1987A",name:{en:"Supernova 1987A",fr:"supernova 1987A"},raHours:5.59111,decDeg:-69.26975,peakMagnitude:2.98,peakJd:24469425e-1,startJd:24468495e-1,lightCurve:[[0,6.36],[1,6.11],[2,4.63],[4,4.45],[32,3.97],[56,3.15],[93,2.98],[105,3.35],[118,4.11],[134,4.43],[504,8.15],[617,10.27]],source:"V photometry compiled by the Open Supernova Catalog (Sternberg catalogue, IAU circulars, CTIO)",note:"In the Large Magellanic Cloud, 160 000 light years away: the nearest supernova since Kepler's, and invisible north of about 20° N."},{id:"v1974-cyg-1992",kind:"nova",designation:"V1974 Cyg",name:{en:"Nova Cygni 1992",fr:"nova du Cygne 1992"},raHours:20.50879,decDeg:52.63078,peakMagnitude:4.27,peakJd:24486753e-1,startJd:24486718e-1,lightCurve:[[0,7.2],[1,5.23],[2,4.62],[3.5,4.27],[4.5,4.59],[6,4.5],[7,4.78],[7.5,4.52],[8,4.82],[10.7,5.25],[11.7,5.66],[16.7,5.85],[21.7,6.47],[22.7,6.3],[27.7,6.46],[29.7,6.83],[34.7,6.9],[35.7,7.25],[36.7,7],[37.7,7.16],[39.7,7.03],[43.7,7.41],[45.7,7.26],[50.7,7.45],[57.7,7.78],[58.7,8.13],[61.7,7.92],[64.7,8.19],[65.7,7.99],[71.7,8.22],[76.7,8.01],[128.2,8.72],[176.2,8.89],[192.2,9.15],[216.2,9.28],[232.2,9.07],[236.2,9.3],[390.2,10.99]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"v382-vel-1999",kind:"nova",designation:"V382 Vel",name:{en:"Nova Velorum 1999",fr:"nova des Voiles 1999"},raHours:10.74678,decDeg:-52.42533,peakMagnitude:2.88,peakJd:245132225e-2,startJd:245132075e-2,lightCurve:[[0,2.99],[1.5,2.88],[2.5,3.46],[4.5,3.98],[5,4.32],[5.5,4.23],[7.5,4.85],[21.75,6.67],[30.25,7.2],[40.25,7.41],[93.25,7.95],[97.25,8.25],[101.25,8],[113.25,7.96],[129.25,8.5],[155.25,8.47],[163.25,9.1],[179.25,9],[187.25,8.7],[195.25,9.15],[211.25,9.23],[235.25,9.8],[243.25,9.71],[299.25,10.42],[383.25,10.52],[415.25,10.81]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"v1494-aql-1999",kind:"nova",designation:"V1494 Aql",name:{en:"Nova Aquilae 1999",fr:"nova de l'Aigle 1999"},raHours:19.38482,decDeg:4.9555,peakMagnitude:4.11,peakJd:245151575e-2,startJd:245151425e-2,lightCurve:[[0,5.15],[.5,4.86],[1,4.27],[1.5,4.11],[2.5,4.35],[5,5.48],[10.5,6.26],[14.25,6.28],[20.25,7.43],[24.25,7.25],[25.25,7.63],[27.25,7.7],[29.25,7.42],[33.25,8.08],[35.25,8.03],[36.25,7.6],[37.25,7.6],[46.25,8.5],[54.25,8.28],[56.25,8.63],[58.25,8.4],[61.25,9.53],[62.25,9],[64.25,9.13],[69.25,8.58],[70.25,8.9],[72.25,8.88],[75.25,8.57],[77.25,9],[79.25,8.8],[81.25,9.7],[83.25,9.6],[85.25,9.8],[86.75,9.5],[88.75,9.54],[90.75,8.9],[92.75,8.85],[96.75,9.63],[102.75,9.7],[104.75,8.98],[106.75,8.73],[116.75,9.63],[118.75,9.6],[120.75,9.07],[122.75,9.26],[124.75,9.8],[128.75,9.36],[134.75,9.75],[147.75,9.92],[155.75,9.81],[259.75,10.96]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"v4743-sgr-2002",kind:"nova",designation:"V4743 Sgr",name:{en:"Nova Sagittarii 2002",fr:"nova du Sagittaire 2002"},raHours:19.01926,decDeg:-22.00167,peakMagnitude:5,peakJd:245253775e-2,startJd:245253675e-2,lightCurve:[[0,5.2],[1,5],[2,5.89],[2.5,5.91],[3.5,6.43],[5,6.45],[5.5,6.86],[6,6.59],[7,6.77],[7.5,7.31],[8.5,6.99],[9,7.09],[10.5,7.86],[11,7.58],[11.5,7.89],[15.75,8.33],[17.75,8.18],[18.75,8.58],[19.75,8.44],[22.75,8.83],[23.75,8.6],[24.75,8.85],[27.75,8.83],[30.75,9.4],[31.75,9.09],[36.25,9.08],[38.25,9.34],[62.25,9.75],[66.25,10.1],[70.25,9.7],[74.25,10],[171.25,10.9]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"rs-oph-2006",kind:"nova",designation:"RS Oph",name:{en:"Nova Ophiuchi 2006",fr:"nova d'Ophiuchus 2006"},raHours:17.83699,decDeg:-6.70792,peakMagnitude:4.8,peakJd:2453779,startJd:2453779,lightCurve:[[0,4.8],[1.25,4.97],[2.75,5.78],[3.25,5.7],[3.75,6.24],[4.25,6.05],[4.75,6.38],[5.25,6.3],[8.5,7.25],[14.5,7.95],[24.5,8.55],[29.5,9.08],[48,9.87],[80,10.28],[107,11.54],[119,11.54],[139,11.98],[147,11.83],[163,12.03],[171,11.97],[175,11.65],[183,11.84],[195,11.64],[203,11.8],[207,12.13],[219,11.45],[277,11.68],[325,11],[341,11.53],[357,11.62],[373,11.3],[405,11.5],[421,11.17],[469,10.96],[501,11.22],[549,10.75],[581,11.08],[597,10.98]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010",note:"A recurrent nova, erupting every twenty years or so (1898, 1907, 1933, 1945, 1958, 1967, 1985, 2006, 2021)."},{id:"v1280-sco-2007",kind:"nova",designation:"V1280 Sco",name:{en:"Nova Scorpii 2007",fr:"nova du Scorpion 2007"},raHours:16.96145,decDeg:-32.34325,peakMagnitude:3.8,peakJd:2454149,startJd:2454136,lightCurve:[[0,9.7],[13,3.8],[34,5.8],[103,15]],source:"AAVSO (discovery, peak, dust minimum); t2 from Das et al. 2008",note:"Faded from sight quickly when dust formed around it, three weeks after its peak."},{id:"v339-del-2013",kind:"nova",designation:"V339 Del",name:{en:"Nova Delphini 2013",fr:"nova du Dauphin 2013"},raHours:20.39186,decDeg:20.76772,peakMagnitude:4.4,peakJd:24565214e-1,startJd:24565214e-1,lightCurve:[[0,4.4],[11,6.4],[20,7.4]],source:"Gehrz et al. 2015 (peak, t2, t3)",note:"High in the summer evening sky of the northern hemisphere, and widely photographed."},{id:"rs-oph-2021",kind:"nova",designation:"RS Oph",name:{en:"Nova Ophiuchi 2021",fr:"nova d'Ophiuchus 2021"},raHours:17.83699,decDeg:-6.70792,peakMagnitude:4.6,peakJd:2459436,startJd:2459435,lightCurve:[[0,5],[1,4.6],[2.25,4.77],[3.75,5.58],[4.25,5.5],[4.75,6.04],[5.25,5.85],[5.75,6.18],[6.25,6.1],[9.5,7.05],[15.5,7.75],[25.5,8.35],[30.5,8.88],[49,9.67],[81,10.08],[108,11.34],[120,11.34],[140,11.78],[148,11.63],[164,11.83],[172,11.77],[176,11.45],[184,11.64],[196,11.44],[204,11.6],[208,11.93],[220,11.25],[278,11.48],[326,10.8],[342,11.33],[358,11.42],[374,11.1],[406,11.3],[422,10.97],[470,10.76],[502,11.02],[550,10.55],[582,10.88],[598,10.78]],source:"Recorded discovery and peak (8 and 9 August 2021); curve borrowed from its 2006 eruption",note:"RS Oph's latest eruption, discovered on 8 August 2021. The decline is its 2006 one."}];class Tp{static UNIX_EPOCH_JD=24405875e-1;static aroundDate(e){const t=this.julianDayOf(e);return ch.filter(n=>this.magnitudeAt(n,t)!==void 0)}static appearancesAt(e,t){const n=this.julianDayOf(e),i=[];for(const r of ch){const a=this.magnitudeAt(r,n);a!==void 0&&i.push({outburst:r,position:ei.ofJ2000(r.raHours,r.decDeg,e,t),magnitude:a})}return i.sort((r,a)=>r.magnitude-a.magnitude)}static brightestAt(e,t){return this.appearancesAt(e,t)[0]}static byId(e){return ch.find(t=>t.id===e)}static magnitudeAt(e,t){const n=e.lightCurve,i=t-e.startJd;if(n.length===0||i<n[0][0]||i>n[n.length-1][0])return;let r=1;for(;r<n.length-1&&n[r][0]<i;)r++;const[a,o]=n[r-1]??n[0],[c,l]=n[r]??n[0];if(c===a)return o;const h=Math.min(1,Math.max(0,(i-a)/(c-a)));return o+h*(l-o)}static julianDayOf(e){return e.getTime()/864e5+this.UNIX_EPOCH_JD}}const cw=[{id:"quadrantids",code:"QUA",name:{en:"Quadrantids",fr:"Quadrantides"},radiantRaHours:15.33,radiantDecDeg:49.7,start:{month:12,day:28},peak:{month:1,day:3},end:{month:1,day:12},peakZhr:110,velocityKmS:41,populationIndex:2.1},{id:"lyrids",code:"LYR",name:{en:"April Lyrids",fr:"Lyrides d'avril"},radiantRaHours:18.13,radiantDecDeg:33.3,start:{month:4,day:16},peak:{month:4,day:22},end:{month:4,day:25},peakZhr:18,velocityKmS:49,populationIndex:2.1},{id:"eta-aquariids",code:"ETA",name:{en:"eta Aquariids",fr:"Êta Aquarides"},radiantRaHours:22.53,radiantDecDeg:-1,start:{month:4,day:19},peak:{month:5,day:6},end:{month:5,day:28},peakZhr:50,velocityKmS:66,populationIndex:2.4},{id:"alpha-capricornids",code:"CAP",name:{en:"alpha Capricornids",fr:"Alpha Capricornides"},radiantRaHours:20.47,radiantDecDeg:-9.2,start:{month:7,day:3},peak:{month:7,day:30},end:{month:8,day:15},peakZhr:5,velocityKmS:23,populationIndex:2.5},{id:"southern-delta-aquariids",code:"SDA",name:{en:"Southern delta Aquariids",fr:"Delta Aquarides du Sud"},radiantRaHours:22.67,radiantDecDeg:-16.4,start:{month:7,day:12},peak:{month:7,day:30},end:{month:8,day:23},peakZhr:25,velocityKmS:41,populationIndex:3.2},{id:"perseids",code:"PER",name:{en:"Perseids",fr:"Perséides"},radiantRaHours:3.22,radiantDecDeg:58,start:{month:7,day:17},peak:{month:8,day:12},end:{month:8,day:24},peakZhr:100,velocityKmS:59,populationIndex:2.2},{id:"southern-taurids",code:"STA",name:{en:"Southern Taurids",fr:"Taurides du Sud"},radiantRaHours:3.47,radiantDecDeg:13,start:{month:9,day:10},peak:{month:10,day:10},end:{month:11,day:20},peakZhr:5,velocityKmS:27,populationIndex:2.3},{id:"draconids",code:"DRA",name:{en:"October Draconids",fr:"Draconides d'octobre"},radiantRaHours:17.47,radiantDecDeg:54,start:{month:10,day:6},peak:{month:10,day:8},end:{month:10,day:10},peakZhr:10,velocityKmS:20,populationIndex:2.6},{id:"orionids",code:"ORI",name:{en:"Orionids",fr:"Orionides"},radiantRaHours:6.35,radiantDecDeg:15.6,start:{month:10,day:2},peak:{month:10,day:21},end:{month:11,day:7},peakZhr:20,velocityKmS:66,populationIndex:2.5},{id:"northern-taurids",code:"NTA",name:{en:"Northern Taurids",fr:"Taurides du Nord"},radiantRaHours:3.87,radiantDecDeg:22,start:{month:10,day:20},peak:{month:11,day:12},end:{month:12,day:10},peakZhr:5,velocityKmS:29,populationIndex:2.3},{id:"leonids",code:"LEO",name:{en:"Leonids",fr:"Léonides"},radiantRaHours:10.13,radiantDecDeg:21.6,start:{month:11,day:6},peak:{month:11,day:17},end:{month:11,day:30},peakZhr:15,velocityKmS:71,populationIndex:2.5},{id:"geminids",code:"GEM",name:{en:"Geminids",fr:"Géminides"},radiantRaHours:7.47,radiantDecDeg:32.3,start:{month:12,day:4},peak:{month:12,day:14},end:{month:12,day:17},peakZhr:150,velocityKmS:35,populationIndex:2.6},{id:"ursids",code:"URS",name:{en:"Ursids",fr:"Ursides"},radiantRaHours:14.47,radiantDecDeg:75.3,start:{month:12,day:17},peak:{month:12,day:22},end:{month:12,day:26},peakZhr:10,velocityKmS:33,populationIndex:3}],Lc=6.5;class lh{static activeAt(e){return cw.flatMap(t=>{const n=this.nearness(t,e);return n<=0?[]:[{shower:t,zhr:t.peakZhr*n,nearness:n}]})}static nearness(e,t){const n=this.dayOfYear(t),i=this.dayOfYear(this.asDate(e.start)),r=this.dayOfYear(this.asDate(e.peak)),a=this.dayOfYear(this.asDate(e.end)),o=this.wrappedDelta(n,r),c=this.wrappedDelta(r,i),l=this.wrappedDelta(a,r);return o<0?o<-c?0:1+o/c:o>0?o>l?0:1-o/l:1}static observedRatePerHour(e,t,n,i=Lc){if(t<=0)return 0;const r=Lc-i;return e*Math.sin(t*Math.PI/180)/Math.pow(n,r)}static radiantPosition(e,t,n){return ei.ofJ2000(e.radiantRaHours,e.radiantDecDeg,t,n)}static dayOfYear(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return Math.floor((Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())-t)/864e5)+1}static asDate(e){return new Date(Date.UTC(2001,e.month-1,e.day))}static wrappedDelta(e,t){const n=e-t;return n>182?n-365:n<-182?n+365:n}}class Lt{static QUIET_RATE_PER_HOUR=2;static APEX_RATE_PER_HOUR=8;static POPULATION_INDEX=3;static apexPosition(e,t){const n=Tt(e),i=new Vc(0,FS(e).elon-90,1),r=Br(c5(n),gd(i,n)),a=vd(r);return Md(a.ra,a.dec,e,t)}static observedRatePerHour(e,t=Lc){const n=Lt.APEX_RATE_PER_HOUR*Math.max(0,Math.sin(e*Math.PI/180)),i=Lc-t;return(Lt.QUIET_RATE_PER_HOUR+n)/Math.pow(Lt.POPULATION_INDEX,i)}static schedule(e){const t=new qc(e.seed^1542469173);return zs.schedule(e).map(n=>{const i=Lt.toCartesian({altitudeDeg:Math.asin(t.next())*180/Math.PI,azimuthDeg:t.between(0,360)}),r=n.fromRadiantDeg*Math.PI/180,a=Lt.turnAround(i,t.between(0,360)),o={x:i.x*Math.cos(r)+a.x*Math.sin(r),y:i.y*Math.cos(r)+a.y*Math.sin(r),z:i.z*Math.cos(r)+a.z*Math.sin(r)};return{...n,radiant:Lt.toHorizontal(o),bearingDeg:Lt.bearingFrom(o,i)}})}static turnAround(e,t){const[n,i]=Lt.basisAround(e),r=t*Math.PI/180;return{x:n.x*Math.cos(r)+i.x*Math.sin(r),y:n.y*Math.cos(r)+i.y*Math.sin(r),z:n.z*Math.cos(r)+i.z*Math.sin(r)}}static bearingFrom(e,t){const[n,i]=Lt.basisAround(e),r=e.x*t.x+e.y*t.y+e.z*t.z,a=Lt.normalise({x:t.x-e.x*r,y:t.y-e.y*r,z:t.z-e.z*r});return(Math.atan2(a.x*i.x+a.y*i.y+a.z*i.z,a.x*n.x+a.y*n.y+a.z*n.z)*180/Math.PI%360+360)%360}static basisAround(e){const t=Math.abs(e.y)<.9?{x:0,y:1,z:0}:{x:1,y:0,z:0},n=Lt.normalise(Lt.cross(e,t));return[n,Lt.normalise(Lt.cross(e,n))]}static toHorizontal(e){const t=Math.hypot(e.x,e.y,e.z)||1;return{altitudeDeg:Math.asin(Math.min(1,Math.max(-1,e.y/t)))*180/Math.PI,azimuthDeg:(Math.atan2(e.x,-e.z)*180/Math.PI%360+360)%360}}static appearanceOf(e){const t=Lt.toCartesian(e.radiant??{altitudeDeg:90,azimuthDeg:0}),n=Lt.turnAround(t,e.bearingDeg),i=e.fromRadiantDeg*Math.PI/180;return Lt.toHorizontal({x:t.x*Math.cos(i)+n.x*Math.sin(i),y:t.y*Math.cos(i)+n.y*Math.sin(i),z:t.z*Math.cos(i)+n.z*Math.sin(i)})}static toCartesian(e){const t=e.altitudeDeg*Math.PI/180,n=e.azimuthDeg*Math.PI/180,i=Math.cos(t);return{x:i*Math.sin(n),y:Math.sin(t),z:-i*Math.cos(n)}}static cross(e,t){return{x:e.y*t.z-e.z*t.y,y:e.z*t.x-e.x*t.z,z:e.x*t.y-e.y*t.x}}static normalise(e){const t=Math.hypot(e.x,e.y,e.z)||1;return{x:e.x/t,y:e.y/t,z:e.z/t}}static TYPICAL_VELOCITY_KM_S=40}const Rp="https://ufoathome.org/tle/index.json";class un{static MAX_ELEMENT_AGE_DAYS=7;static DAY_MS=864e5;fetchImpl;indexUrls;index;files=new Map;constructor(e={}){this.fetchImpl=e.fetchImpl??fetch.bind(globalThis),this.indexUrls=e.indexUrls??un.defaultIndexUrls()}static defaultIndexUrls(){const e=[];return typeof location<"u"&&/^https?:$/.test(location.protocol)&&e.push(new URL("/tle/index.json",location.href).href),e.includes(Rp)||e.push(Rp),e}static FIRST_SNAPSHOT="2021-02-22";async covers(e){const t=Date.parse(`${un.FIRST_SNAPSHOT}T00:00:00Z`)-un.MAX_ELEMENT_AGE_DAYS*un.DAY_MS;if(e.getTime()<t)return!1;const n=await this.loadIndex();return n?Object.values(n.index.kinds).some(i=>e.getTime()>=Date.parse(i.from)-un.MAX_ELEMENT_AGE_DAYS*un.DAY_MS&&e.getTime()<=Date.parse(i.to)+un.MAX_ELEMENT_AGE_DAYS*un.DAY_MS):!1}async at(e){const t=await this.loadIndex();if(!t)return;const{index:n,base:i}=t,r=[],a=[];for(const o of Object.keys(n.kinds)){const c=await this.kindAt(o,e,n,i);r.push(...c),a.push(this.coverageOf(o,e,n,c.length>0))}return{objects:r,coverage:a,credit:n.credit,creditUrl:n.source}}async kindAt(e,t,n,i){const r=t.getTime(),a=n.binDays*un.DAY_MS,o=Math.floor(r/a),c=r-o*a<a/2?o-1:o+1,l=new Set(n.kinds[e].bins),h=[o,c].map(v=>new Date(v*a).toISOString().slice(0,10)).filter(v=>l.has(v));if(h.length===0)return[];const[u,...d]=await Promise.all([this.json(new URL(`objects-${e}.json`,i).href),...h.map(v=>this.binary(new URL(`${e}/${v}.bin`,i).href))]),f=new Map;for(const v of d)for(const m of un.decode(v,n.recordBytes)){const g=f.get(m.norad);(!g||Math.abs(m.epochMs-r)<Math.abs(g.epochMs-r))&&f.set(m.norad,m)}const p=[];for(const v of f.values()){const m=Math.abs(v.epochMs-r)/un.DAY_MS;if(m>un.MAX_ELEMENT_AGE_DAYS)continue;const g=u[v.norad]??{name:String(v.norad)};g.launch&&Date.parse(`${g.launch}T00:00:00Z`)>r||p.push({norad:v.norad,name:g.name,kind:e,launch:g.launch,stdMag:g.stdMag,elements:v,ageDays:m})}return p}coverageOf(e,t,n,i){const{from:r,to:a}=n.kinds[e],o=t.getTime(),c=un.MAX_ELEMENT_AGE_DAYS*un.DAY_MS,l=i?"covered":o<Date.parse(r)-c?"before":o>Date.parse(a)+c?"after":"gap";return{kind:e,status:l,from:r,to:a}}static decode(e,t){const n=new DataView(e),i=[];for(let r=0;r+t<=e.byteLength;r+=t)i.push({norad:n.getUint32(r,!0),epochMs:n.getFloat64(r+4,!0),bstar:n.getFloat32(r+12,!0),inclinationDeg:n.getFloat32(r+16,!0),raanDeg:n.getFloat32(r+20,!0),eccentricity:n.getFloat32(r+24,!0),argOfPerigeeDeg:n.getFloat32(r+28,!0),meanAnomalyDeg:n.getFloat32(r+32,!0),meanMotion:n.getFloat64(r+36,!0)});return i}loadIndex(){return this.index??=(async()=>{for(const e of this.indexUrls)try{const t=await this.fetchImpl(e);if(!t.ok)continue;return{index:await t.json(),base:e}}catch{}})(),this.index}json(e){return this.cached(e,async t=>t.json())}binary(e){return this.cached(e,async t=>t.arrayBuffer())}cached(e,t){let n=this.files.get(e);return n||(n=this.fetchImpl(e).then(i=>{if(!i.ok)throw new Error(`${e}: ${i.status}`);return t(i)}),n.catch(()=>this.files.delete(e)),this.files.set(e,n)),n}}class lw{lowerM;upperM;add(e,t){if(!(e<=0)){if(t.behindM!==void 0){const n=mt.sizeMAt(t.behindM,e);this.lowerM=this.lowerM===void 0?n:Math.max(this.lowerM,n)}if(t.inFrontM!==void 0){const n=mt.sizeMAt(t.inFrontM,e);this.upperM=this.upperM===void 0?n:Math.min(this.upperM,n)}}}get sizeRange(){return{minM:this.lowerM,maxM:this.upperM}}get empty(){return this.lowerM===void 0&&this.upperM===void 0}get contradictory(){return this.lowerM!==void 0&&this.upperM!==void 0&&this.lowerM>this.upperM}distanceRangeAt(e){return e<=0?{}:{minM:this.lowerM===void 0?void 0:mt.distanceMAt(this.lowerM,e),maxM:this.upperM===void 0?void 0:mt.distanceMAt(this.upperM,e)}}clear(){this.lowerM=void 0,this.upperM=void 0}}class Bs{static DEG_PER_SECOND=360/86164.0905;static degOver(e){return Math.max(0,e)*Bs.DEG_PER_SECOND}static instants(e,t){if(!(t>0))return 1;const n=Bs.degOver(e)/t;return n<1?1:Math.min(Bs.MAX_INSTANTS,Math.max(2,Math.ceil(n)))}static MAX_INSTANTS=64}class vn{static EYE={apertureMm:7,exposureSeconds:.1,resolutionArcsec:60};static WAVELENGTH_M=55e-8;static ARCSEC_PER_RADIAN=180*3600/Math.PI;static UNKNOWN_CAMERA_FOCAL_MM=50;static UNKNOWN_CAMERA_DETAIL_UM=20;static get skyDriftArcsecPerSecond(){return Bs.DEG_PER_SECOND*3600}static graspOf(e,t={}){const n=t.exposureSeconds??e.exposureSeconds,i=t.fNumber??e.fNumber;if(n===void 0||i===void 0||!(n>0)||!(i>0))return vn.EYE;const r=t.focalLengthMm??e.frame?.focalLengthMm??vn.UNKNOWN_CAMERA_FOCAL_MM,a=r/i,o=vn.resolutionArcsec(e,r,a);return{apertureMm:a,exposureSeconds:Math.min(n,vn.trailLimitedSeconds(o)),resolutionArcsec:o}}static resolutionArcsec(e,t,n){const r=(e.detailUm??vn.UNKNOWN_CAMERA_DETAIL_UM)/1e3/t*vn.ARCSEC_PER_RADIAN,a=1.22*vn.WAVELENGTH_M/(n/1e3)*vn.ARCSEC_PER_RADIAN;return Math.max(r,a)}static trailLimitedSeconds(e){return e/vn.skyDriftArcsecPerSecond}static gainOverEye(e,t={}){const n=vn.graspOf(e,t),i=vn.EYE,r=(n.apertureMm/i.apertureMm)**2,a=n.exposureSeconds/i.exposureSeconds,o=(i.resolutionArcsec/n.resolutionArcsec)**2;return 1.25*Math.log10(r*a*o)}static gainFor(e,t){const n=t.fieldOfViewDeg===void 0?void 0:Vt.focalLengthMmFor(e,t.fieldOfViewDeg);return vn.gainOverEye(e,{fNumber:t.fNumber,focalLengthMm:n,exposureSeconds:t.exposureSeconds})}}const Dp=111320,ga=Math.PI/180,hw=1.02,uw=1;class Ia{static of(e,t){const n=Ia.sightings(e,t);if(n.length<2)return;const i=Ia.baseline(n);if(!i)return;const{near:r,far:a,closedM:o}=i,c=Math.tan(a.widthDeg/2*ga)===0?0:Math.tan(r.widthDeg/2*ga)/Math.tan(a.widthDeg/2*ga);if(c<hw)return;const l=o/(c-1),h=mt.sizeMAt(l,r.widthDeg),u=n.map(d=>({t:d.t,m:mt.distanceMAt(h,d.widthDeg)}));return{widthM:h,distanceM:u,nearestM:Math.min(...u.map(d=>d.m)),fromT:a.t,toT:r.t,closedM:o}}static sightings(e,t){return e.timeline.allKeyframes.flatMap(n=>{const i=n.shapes.find(o=>o.sourceId===t)?.shape,r=i?.angular?.widthDeg,a=Qt(e,n.t);return r===void 0||r<=0||a?.lat===void 0||a.lng===void 0?[]:[{t:n.t,widthDeg:r,lat:a.lat,lng:a.lng,sightAzimuthDeg:i?.aim?.azimuthDeg??a.headingDeg}]}).sort((n,i)=>n.t-i.t)}static baseline(e){let t;for(const n of e)for(const i of e){if(n.t>=i.t)continue;const r=Ia.closedAlongSight(n,i),[a,o,c]=r>=0?[i,n,r]:[n,i,-r];c<uw||a.widthDeg<=o.widthDeg||(!t||c>t.closedM)&&(t={near:a,far:o,closedM:c})}return t}static closedAlongSight(e,t){const n=(t.lat-e.lat)*Dp,i=(t.lng-e.lng)*Dp*Math.cos(e.lat*ga),r=(e.sightAzimuthDeg??0)*ga;return n*Math.cos(r)+i*Math.sin(r)}}class gn{static CONVENTIONAL_M=5;static NEAREST_M=.2;static MARGIN=1.1;static resolve(e){if(e.statedM!==void 0&&e.statedM>0)return{distanceM:gn.atLeastNearest(e.statedM),basis:"stated"};if(e.hypothesisM!==void 0&&e.hypothesisM>0)return{distanceM:gn.atLeastNearest(e.hypothesisM),basis:"hypothesis"};if(e.derivedM!==void 0&&e.derivedM>0)return{distanceM:gn.atLeastNearest(e.derivedM),basis:"derived"};const t=gn.largest(e.range?.minM,e.crossing?.behindM),n=gn.smallest(e.range?.maxM,e.crossing?.inFrontM),i=t===void 0?void 0:t*gn.MARGIN,r=n===void 0?void 0:n/gn.MARGIN;return i!==void 0&&r!==void 0?{distanceM:gn.atLeastNearest(i<=r?Math.sqrt(i*r):i),basis:"bounded"}:i!==void 0?{distanceM:gn.atLeastNearest(i),basis:"bounded"}:r!==void 0&&r<gn.CONVENTIONAL_M?{distanceM:gn.atLeastNearest(r),basis:"bounded"}:{distanceM:gn.CONVENTIONAL_M,basis:"conventional"}}static atLeastNearest(e){return Math.max(gn.NEAREST_M,e)}static largest(...e){const t=e.filter(n=>n!==void 0&&n>0);return t.length===0?void 0:Math.max(...t)}static smallest(...e){const t=e.filter(n=>n!==void 0&&n>0);return t.length===0?void 0:Math.min(...t)}}qp();const dw={sun:{en:"Sun",fr:"Soleil"},moon:{en:"Moon",fr:"Lune"},Venus:{en:"Venus",fr:"Vénus"},Mars:{en:"Mars",fr:"Mars"},Jupiter:{en:"Jupiter",fr:"Jupiter"},Saturn:{en:"Saturn",fr:"Saturne"}},fw=["en","fr"],pw={en:"{name} — mag {mag}, {alt}° above the horizon",fr:"{name} — mag {mag}, {alt}° au-dessus de l'horizon"},mw={en:"{name} — satellite, mag {mag}, {height} km up",fr:"{name} — satellite, mag {mag}, à {height} km d'altitude"},gw="satellites-change",vw={en:"{name} — mag {mag}, {alt}° below the horizontal",fr:"{name} — mag {mag}, {alt}° sous l'horizontale"},Cp="comet:",Pp="nova:",Mw={building:{en:"Building",fr:"Bâtiment"},tree:{en:"Tree",fr:"Arbre"},crop:{en:"Crop row",fr:"Rang de culture"},mound:{en:"Stone heap",fr:"Tas de pierres"},streetlight:{en:"Streetlight",fr:"Lampadaire"},vehicle:{en:"Vehicle",fr:"Véhicule"},witness:{en:"Witness",fr:"Témoin"},aircraft:{en:"Aircraft",fr:"Aéronef"},entity:{en:"Being",fr:"Être"}},xw=new URL(""+new URL("stars-mag7.5-B43R6Wvg.bin",import.meta.url).href,import.meta.url).href,_w=new URL(""+new URL("stars-mag7.5-9-BLV2tFmZ.bin",import.meta.url).href,import.meta.url).href,yw=-18,Sw={sun:{altitudeDeg:-3,azimuthDeg:180,magnitude:-26.7},moon:{altitudeDeg:-90,azimuthDeg:0,phase:{phaseFraction:0,illuminatedFraction:0},magnitude:-12.7},planets:[]},hh={lat:0,lng:0,elevationM:0,headingDeg:void 0,pitchDeg:0,fovDeg:60};class xd extends HTMLElement{static get observedAttributes(){return["src","star-catalog-src","deep-star-catalog-src","show-compass","max-pixel-ratio",Pr,Ir]}shadow;stageElement;frameElement;sceneCanvas;ufoElement;sceneRenderer;hoverTooltip;resizeObserver;sizeEstimates=new Map;sizeEstimatesFor;distanceHypotheses=new Map;depths=new Map;directionScratch=new C;meteorScheduleFor;lightningScheduleFor;lightningFlashes=[];lastLightningT;lastTimeMs=0;lastSkyKey;starCatalog;starCatalogRequest=0;static tleArchive=new un;satellitesFor;satelliteRequest=0;satelliteStatus="none";satellites;satellitePassesMemo;starCatalogDepth=0;weatherAudio=new aw;animateWhilePausedValue=!1;set animateWhilePaused(e){e!==this.animateWhilePausedValue&&(this.animateWhilePausedValue=e,this.syncAnimationsToPlayback())}get animateWhilePaused(){return this.animateWhilePausedValue}thunderTimeoutId;handleFullscreenChange=()=>this.resizeToStage();handlePointerMove=e=>{this.sceneRenderer.setCompassHovered(!0);const t=this.ufoElement.canvasElement,n=t.getBoundingClientRect();if(n.width===0||n.height===0)return;const i=(e.clientX-n.left)/n.width*t.width,r=(e.clientY-n.top)/n.height*t.height;if(this.ufoElement.hasVisibleShapeAt(i,r)){this.hoverTooltip.hidden=!0;return}const a=(e.clientX-n.left)/n.width*2-1,o=-((e.clientY-n.top)/n.height*2-1),c=ku(fc.preferencesFor(this),fw),l=this.sceneRenderer.pickBodyAt(a,o);if(l){this.showHoverTooltip(e,this.bodyName(l,c));return}const h=this.sceneRenderer.pickDecorAt(a,o),u=h?this.ufoElement.sighting.decor.find(p=>p.id===h):void 0;if(u){this.showHoverTooltip(e,this.said.read(u.title)||Mw[u.kind][c]);return}const d=this.sceneRenderer.pickSatelliteAt(a,o);if(d){this.showHoverTooltip(e,mw[c].replace("{name}",d.name).replace("{mag}",d.magnitude.toLocaleString(void 0,{maximumFractionDigits:1})).replace("{height}",Math.round(d.heightKm).toLocaleString()));return}const f=this.sceneRenderer.pickStarAt(a,o);if(f){const p=f.star.mag,v=f.altitudeDeg,m=(v<0?vw:pw)[c];this.showHoverTooltip(e,m.replace("{name}",f.star.name[c]).replace("{mag}",p.toLocaleString(void 0,{maximumFractionDigits:Math.abs(p)<1?2:1})).replace("{alt}",String(Math.round(Math.abs(v)))));return}this.hoverTooltip.hidden=!0};bodyName(e,t){const n=e.startsWith(Cp)?e.slice(Cp.length):void 0,i=n?dg.find(a=>a.id===n):void 0,r=e.startsWith(Pp)?Tp.byId(e.slice(Pp.length)):void 0;return i?.name[t]??r?.name[t]??dw[e]?.[t]??e}showHoverTooltip(e,t){this.hoverTooltip.textContent=t,this.hoverTooltip.hidden=!1;const n=this.stageElement.getBoundingClientRect();this.hoverTooltip.style.left=`${e.clientX-n.left+12}px`,this.hoverTooltip.style.top=`${e.clientY-n.top+12}px`}handlePointerLeave=()=>{this.hoverTooltip.hidden=!0,this.sceneRenderer.setCompassHovered(!1)};handleLightningFlash(e){clearTimeout(this.thunderTimeoutId),this.thunderTimeoutId=window.setTimeout(()=>this.weatherAudio.playThunder(),Wt.thunderDelayMs(e))}handleFirstInteraction=()=>{this.removeEventListener("pointerdown",this.handleFirstInteraction,!0),this.removeEventListener("keydown",this.handleFirstInteraction,!0),this.weatherAudio.resume(),this.setWeather(js(this.ufoElement.sighting,this.lastTimeMs))};handleTimeUpdate=e=>{this.lastTimeMs=e.detail.time,this.syncAnimationsToPlayback(),this.updateAstronomy(this.lastTimeMs),this.ufoElement.playbackState==="playing"&&this.sceneRenderer.frame(performance.now())};syncAnimationsToPlayback(){const e=this.ufoElement.playbackState==="playing",t=e||this.animateWhilePaused;this.sceneRenderer.setAnimationsRunning(t,e),this.weatherAudio.setPaused(!t),t||clearTimeout(this.thunderTimeoutId)}constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${bg}</style>${Sg}`,this.shadow.appendChild(e.content.cloneNode(!0)),this.stageElement=this.shadow.getElementById("stage"),this.frameElement=this.shadow.getElementById("frame"),this.sceneCanvas=this.shadow.getElementById("scene-canvas"),this.sceneRenderer=new Hn(this.sceneCanvas),this.hoverTooltip=this.shadow.getElementById("hover-tooltip"),this.ufoElement=document.createElement(fh),this.ufoElement.classList.add("ufo-overlay"),this.ufoElement.paintsShapes=!1,this.forwardPlayerAttributes(),this.ufoElement.addEventListener("lookat",t=>this.lookToward(t.detail)),this.ufoElement.style.setProperty("--ufo-canvas-background","transparent"),this.ufoElement.style.setProperty("--ufo-canvas-border","none"),this.ufoElement.fullscreenTarget=this.stageElement,this.shadow.getElementById("ufo-slot").replaceWith(this.ufoElement),this.sceneRenderer.onMapSubjectBounds=t=>this.ufoElement.setMapSubjectBounds(t),this.ufoElement.addEventListener("timeupdate",this.handleTimeUpdate),this.ufoElement.addEventListener("referenceview",t=>this.applyReferenceView(t.detail)),this.ufoElement.canvasElement.addEventListener("pointermove",this.handlePointerMove),this.ufoElement.canvasElement.addEventListener("pointerleave",this.handlePointerLeave),this.addEventListener("pointerdown",this.handleFirstInteraction,!0),this.addEventListener("keydown",this.handleFirstInteraction,!0)}get said(){return this.saidTexts??=new us(fc.preferencesFor(this))}saidTexts;connectedCallback(){this.saidTexts=void 0,this.sceneRenderer.restoreContext(),this.resizeToStage(),this.updateAstronomy(this.lastTimeMs),this.loadStars(),this.resizeObserver=new ResizeObserver(()=>this.resizeToStage()),this.resizeObserver.observe(this.frameElement),document.addEventListener("fullscreenchange",this.handleFullscreenChange);const e=this.getAttribute("src");e&&this.loadFromSrc(e)}disconnectedCallback(){this.resizeObserver?.disconnect(),document.removeEventListener("fullscreenchange",this.handleFullscreenChange),this.sceneRenderer.stopTwinkle(),clearTimeout(this.thunderTimeoutId),this.weatherAudio.dispose(),queueMicrotask(()=>{this.isConnected||this.sceneRenderer.releaseContext()})}attributeChangedCallback(e,t,n){if(e==="src"&&n&&n!==t&&this.isConnected&&this.loadFromSrc(n),(e==="star-catalog-src"||e==="deep-star-catalog-src")&&n!==t&&this.isConnected&&this.loadStars(),e==="show-compass"&&n!==t&&this.sceneRenderer.setShowCompass(this.hasAttribute("show-compass")),e==="max-pixel-ratio"&&n!==t){const i=Number(n);this.sceneRenderer.setMaxPixelRatio(Number.isFinite(i)&&i>0?i:Math.min(window.devicePixelRatio||1,2))}(e===Pr||e===Ir)&&n!==t&&this.forwardPlayerAttributes()}forwardPlayerAttributes(){for(const e of[Pr,Ir])this.ufoElement.toggleAttribute(e,this.hasAttribute(e))}setCompassForced(e){this.sceneRenderer.setCompassForced(e)}lookToward(e){const t=Qt(this.ufoElement.sighting,this.lastTimeMs);if(e.kind==="witness"||t?.lat===void 0||t.lng===void 0||t.headingDeg===void 0){this.setLookOffset(0,0);return}const{x:n,z:i}=rn(e.lat,e.lng,t.lat,t.lng);if(Math.hypot(n,i)<1)return this.setLookOffset(0,0);const r=(Math.atan2(n,-i)*180/Math.PI+360)%360;this.setLookOffset(((r-t.headingDeg)%360+540)%360-180,-t.pitchDeg)}setLookOffset(e,t){this.sceneRenderer.setLookOffset(e,t),this.ufoElement.setLookOffset(e,t),this.updateAstronomy(this.lastTimeMs)}setIndoorLook(e,t){this.sceneRenderer.setIndoorLook(e,t)}setCloudRendering(e){this.sceneRenderer.setCloudRendering(e)}setWeather(e){this.sceneRenderer.setWeather(e),this.weatherAudio.setAmbient(e.precipitationType,e.precipitationIntensity,e.windSpeed)}pickCloudAt(e,t){return this.sceneRenderer.pickCloudAt(e,t)}cloudDirectionAt(e,t){return this.sceneRenderer.cloudDirectionAt(e,t)}pickDecorAt(e,t){return this.sceneRenderer.pickDecorAt(e,t)}resumeWeatherAudio(){this.weatherAudio.resume()}async loadFromSrc(e){this.sightingData=await Op.json(e)}get sightingData(){return this.ufoElement.sightingData}set sightingData(e){this.ufoElement.sightingData=e,this.applyFrameFormat(),this.lastTimeMs=0,this.sceneRenderer.compileNextFrameOffThread(),this.updateAstronomy(0)}referenceAspect(e){return this.sceneRenderer.referenceAspect(e)}screenPointOf(e){return this.sceneRenderer.screenPointOf(e)}directionAt(e,t){return this.sceneRenderer.directionAt(e,t)}referenceFailedToLoad(e){return this.sceneRenderer.referenceFailedToLoad(e)}applyReferenceView(e){this.sceneRenderer.setReferencesShown(e.shown);for(const t of this.ufoElement.sighting.references)this.sceneRenderer.setReferenceView(t.id,{opacity:e.opacity})}get currentTerrainAttribution(){return this.sceneRenderer.currentTerrainAttribution}setTerrainProviders(e){this.sceneRenderer.setTerrainProviders(e)}setDecorModelProvider(e){this.sceneRenderer.setDecorModelProvider(e)}get decorModelCredits(){return this.sceneRenderer.currentDecorModelCredits}applyFrameFormat(){const e=this.ufoElement.sighting.instrument,t=mt.CANVAS_HEIGHT_PX,n=Vt.frameWidthPx(e,t);this.frameElement.style.setProperty("--frame-aspect",`${n} / ${t}`)}resizeToStage(){const e=this.frameElement.getBoundingClientRect(),t=Math.max(1,Math.round(e.width)),n=Math.max(1,Math.round(e.height));this.sceneCanvas.width=t,this.sceneCanvas.height=n,this.sceneRenderer.resize(t,n)}async loadStars(){const e=[{magnitudeLimit:ah,url:this.getAttribute("star-catalog-src")??xw},{magnitudeLimit:oh,url:this.getAttribute("deep-star-catalog-src")??_w}],t=this.instrumentReach(),n=++this.starCatalogRequest;this.starCatalogDepth=t>ah?oh:ah;const i=await vi.upTo(e,t);n===this.starCatalogRequest&&(this.starCatalog=i,this.sceneRenderer.compileNextFrameOffThread(),this.updateAstronomy(this.lastTimeMs))}ensureStarsDeepEnough(){!this.starCatalog||this.starCatalogDepth>=oh||this.instrumentReach()<=this.starCatalogDepth||this.loadStars()}instrumentReach(){const e=this.ufoElement.sighting,t=vn.gainFor(e.instrument,{fNumber:Qt(e,0)?.fNumber,fieldOfViewDeg:Vn.fovOf(e,0),exposureSeconds:e.exposure});return du(yw,t)}updateAstronomy(e){this.ensureStarsDeepEnough(),this.applySceneAt(e);const t=Qn.windowEndingAt(e,this.exposureSeconds()),n=t.seconds,i=this.degreesPerPixelAt(e),r=Bs.instants(n,i),a=Math.max(r,this.ufoElement.exposureTimes(e).length,Qn.instants(this.ufoElement.sighting.decor,Qt(this.ufoElement.sighting,e)?.elevationM??0,t.fromMs,n,i));if(a<=1){this.sceneRenderer.setExposure(1);return}this.sceneRenderer.setExposure(a,o=>this.applySceneAt(t.fromMs+t.ms*o/(a-1),{sky:Math.floor(o*r/a)!==Math.floor((o-1)*r/a),stepMs:t.ms/a}))}exposureSeconds(){return this.ufoElement.sighting.exposure??0}degreesPerPixelAt(e){const t=this.sceneCanvas.height;return t<=0?0:Vn.fovOf(this.ufoElement.sighting,e)/t}applySceneAt(e,t){const n=this.ufoElement.sighting;this.setWeather(js(n,e)),this.sceneRenderer.setInstrument(n.instrument),this.updateMeteorShower(n,e),this.updateLightning(n,e,t!==void 0),this.sceneRenderer.setDecor(n.decor),this.sceneRenderer.setReferences(n.references);const i=Qt(n,e),r=Qt(n,0),a=js(n,0),o=Object.fromEntries(hc(js(n,e)).map(w=>[w.id,Cd(e,n.weatherTrack,a,r,i,w.id)]));this.sceneRenderer.setCloudOffset(Cd(e,n.weatherTrack,a,r,i),o),this.sceneRenderer.setObserverPose(i??hh),this.sceneRenderer.setLensOptics(this.lensOpticsAt(e)),this.sceneRenderer.setInstrumentGain(vn.gainFor(n.instrument,{fNumber:i?.fNumber,fieldOfViewDeg:Vn.fovOf(n,e),exposureSeconds:n.exposure})),this.sceneRenderer.setGait(Gt.of(n)?.offsetAt(e)??Gt.STILL),this.sceneRenderer.updateDecorAnchoring(Qt(n,0),i,e),this.sceneRenderer.updateDecorLitState(e,t?.stepMs??0),this.sceneRenderer.setTerrainOrigin(i?.lat,i?.lng),this.pushPhenomenaAt(e);const c=i?.lat??hh.lat,l=i?.lng??hh.lng,h=Vo(n.event.time??{},l,n.event.utcOffsetHours),u={lat:c,lng:l,elevationM:i?.elevationM??0};if(this.pushSatellitesAt(h,e,u),t&&!t.sky)return;if(!h){this.sceneRenderer.setAstronomy(Sw);return}const d=new Date(h.getTime()+e),f=Math.max(1,Math.round(.25*this.degreesPerPixelAt(e)/Bs.DEG_PER_SECOND*1e3)),p=Math.max(1e-8,this.degreesPerPixelAt(e)*.1),v=`${Math.floor(d.getTime()/f)}|${Math.round(c/p)}|${Math.round(l/p)}|${Math.round(u.elevationM)}|${this.starCatalog?this.starCatalogDepth:0}`;if(v===this.lastSkyKey){this.sceneRenderer.render();return}this.lastSkyKey=v;const m={...Bl("Sun",d,u),magnitude:Hl("Sun",d)},g={...Bl("Moon",d,u),phase:h5(d),magnitude:Hl("Moon",d)},b=l5.map(w=>({body:w,position:Bl(w,d,u),magnitude:Hl(w,d)}));this.sceneRenderer.setAstronomy({sun:m,moon:g,planets:b,comet:this.cometAt(d,u),novae:Tp.appearancesAt(d,u).map(({outburst:w,position:_,magnitude:S})=>({id:w.id,position:_,magnitude:S})),stars:this.starCatalog?{catalog:this.starCatalog,date:d,observer:u}:void 0,frame:{date:d,observer:u}}),this.ufoElement.setSunAltitude(m.altitudeDeg)}pushSatellitesAt(e,t,n){if(this.ensureSatellites(e),!e||!this.satellites){this.sceneRenderer.setSatellites([]);return}const i=new Date(e.getTime()+t),r=[];for(const a of this.satellites.passes.positionsAt(i,n,-1))a.magnitude!==void 0&&r.push({norad:a.object.norad,name:a.object.name,position:{altitudeDeg:a.altitudeDeg,azimuthDeg:a.azimuthDeg},magnitude:a.magnitude,heightKm:a.heightKm});this.sceneRenderer.setSatellites(r)}ensureSatellites(e){const t=e?String(e.getTime()):"";if(t===this.satellitesFor)return;this.satellitesFor=t,this.satellites=void 0,this.satellitePassesMemo=void 0;const n=++this.satelliteRequest;if(!e){this.satelliteStatus="none";return}this.satelliteStatus="loading";const i=a=>{n===this.satelliteRequest&&(this.satelliteStatus=a,this.dispatchEvent(new CustomEvent(gw)))},r=xd.tleArchive;(async()=>{if(!await r.covers(e))return i("outside");const[a,o]=await Promise.all([r.at(e),lc(()=>import("./SatellitePasses-Pfro2-0Z.js"),[],import.meta.url)]);if(n===this.satelliteRequest){if(!a)return i("unavailable");this.satellites={snapshot:a,passes:new o.SatellitePasses(a.objects)},i("ready"),this.updateAstronomy(this.lastTimeMs)}})().catch(()=>i("unavailable"))}get satelliteState(){const e=this.satellites?.snapshot;return{status:this.satelliteStatus,coverage:e?.coverage,credit:e?.credit,creditUrl:e?.creditUrl}}satellitePassesDuring(e){const t=this.satellites,n=this.ufoElement.sighting,i=Qt(n,0),r=n.event.place?.[0],a=i?.lat??r?.lat,o=i?.lng??r?.lng;if(!t||a===void 0||o===void 0)return[];const c=Vo(n.event.time??{},o,n.event.utcOffsetHours);if(!c)return[];const l=Math.min(Math.max(e,0),4*36e5),h={lat:a,lng:o,elevationM:i?.elevationM??0},u=JSON.stringify([this.satellitesFor,c.getTime(),a,o,h.elevationM,l]);if(this.satellitePassesMemo?.key===u)return this.satellitePassesMemo.passes;const d=Math.max(10,Math.ceil(l/1e3/600)),f=t.passes.passesDuring(c,new Date(c.getTime()+l),h,d);return this.satellitePassesMemo={key:u,passes:f},f}cometAt(e,t){const n=ow.brightestAt(e,t);if(n)return{id:n.apparition.id,position:n.position,tailEnd:n.tailEnd,magnitude:n.magnitude}}pushPhenomenaAt(e){const t=this.ufoElement.sighting;t!==this.sizeEstimatesFor&&(this.sizeEstimates.clear(),this.distanceHypotheses.clear(),this.sizeEstimatesFor=t);const n=t.timeline,i=this.ufoElement.canvasElement,r=this.ufoElement.frameShiftPx,a=this.projectionAt(e),o=new Map,c=new Map,l=new Set;for(const p of n.sourceIds){const v=n.getInterpolatedShapeAt(e,p);if(!v)continue;const m={...v,bounds:{...v.bounds,x:v.bounds.x+r.x,y:v.bounds.y+r.y}};o.set(p,m);const g=v.aim?this.sceneRenderer.screenPointOf(jn.directionOf(v.aim,this.directionScratch)):{ndcX:(m.bounds.x+m.bounds.width/2)/i.width*2-1,ndcY:-((m.bounds.y+m.bounds.height/2)/i.height*2-1)},b=g!==void 0&&Math.abs(g.ndcX)<=1&&Math.abs(g.ndcY)<=1,w=b?this.sceneRenderer.decorDistancesAt(g.ndcX,g.ndcY,p):{};l.add(p),(b||v.aim)&&l.delete(p);const _=v.angular?.widthDeg??a.pxToDeg(v.bounds.width),S=this.sizeEstimateOf(p);S.add(_,w);const E=Ia.of(t,p);c.set(p,gn.resolve({hypothesisM:this.distanceHypotheses.get(p),derivedM:E&&_>0?mt.distanceMAt(E.widthM,_):void 0,range:S.distanceRangeAt(_),crossing:w}))}for(const[p,v]of o)for(const[m,g]of o){if(m===p||g.transparency>=1||g.bounds.width*g.bounds.height<=v.bounds.width*v.bounds.height||!(v.bounds.x>=g.bounds.x&&v.bounds.y>=g.bounds.y&&v.bounds.x+v.bounds.width<=g.bounds.x+g.bounds.width&&v.bounds.y+v.bounds.height<=g.bounds.y+g.bounds.height))continue;const w=c.get(m);w&&c.set(p,{distanceM:w.distanceM*.999,basis:w.basis});break}this.depths=c;const h=n.sourceIds,u=[];for(const[p,v]of o)u.push({sourceId:p,shape:v,distanceM:c.get(p).distanceM,renderOrder:h.indexOf(p),aim:v.aim,hidden:l.has(p)});const f=(Qt(t,e)?.rollDeg??0)+(Gt.of(t)?.offsetAt(e)??Gt.STILL).rollDeg;this.sceneRenderer.setPhenomena(u,{projection:a,canvasWidthPx:i.width,canvasHeightPx:i.height,scale:Math.max(1,this.sceneCanvas.height/Math.max(1,i.height)),starPoints:Vt.starPointsOf(t.instrument),rollRad:f*Math.PI/180})}setDistanceHypothesis(e,t){t===void 0||!(t>0)?this.distanceHypotheses.delete(e):this.distanceHypotheses.set(e,t),this.updateAstronomy(this.lastTimeMs)}depthOf(e){return this.depths.get(e)}sizeRangeOf(e){return this.sizeEstimateOf(e).sizeRange}distanceRangeAt(e,t){const n=this.ufoElement.sighting.timeline.getInterpolatedShapeAt(t,e);if(!n)return{};const i=n.angular?.widthDeg??this.projectionAt(t).pxToDeg(n.bounds.width);return this.sizeEstimateOf(e).distanceRangeAt(i)}sizeContradictory(e){return this.sizeEstimateOf(e).contradictory}updateMeteorShower(e,t){this.ensureMeteorSchedule(e),this.sceneRenderer.updateMeteors(t)}updateLightning(e,t,n){if(this.ensureLightningSchedule(e),this.sceneRenderer.updateLightning(t),n)return;const i=this.lastLightningT;if(this.lastLightningT=t,i===void 0||t<i||this.ufoElement.playbackState!=="playing")return;const r=this.lightningFlashes.filter(a=>a.t>i&&a.t<=t).pop();r&&js(e,r.t).storm&&this.handleLightningFlash(r)}ensureLightningSchedule(e){const t=js(e,0).precipitationIntensity,n=`${this.meteorInputsOf(e)}|${t}`;if(n===this.lightningScheduleFor)return;this.lightningScheduleFor=n;const i=e.event.time,r=e.event.place?.[0],a=i?.year!==void 0?Vo(i,r?.lng??0,e.event.utcOffsetHours):void 0,o=(e.event.durationSeconds??0)*1e3||e.timeline.duration||2e4,c=Math.round((a?.getTime()??0)/1e3)+Math.round((r?.lat??0)*1e3)+7;this.lightningFlashes=Wt.schedule({durationMs:o,seed:c,intensity:t}),this.sceneRenderer.setLightning(this.lightningFlashes)}ensureMeteorSchedule(e){const t=this.meteorInputsOf(e);t!==this.meteorScheduleFor&&(this.meteorScheduleFor=t,this.scheduleMeteors(e))}meteorInputsOf(e){const t=e.event.place?.[0],n=e.event.time;return JSON.stringify([t?.lat,t?.lng,n?.year,n?.month,n?.day,n?.hour,n?.minute,n?.second,e.event.utcOffsetHours,e.event.durationSeconds,e.timeline.duration])}scheduleMeteors(e){const t=e.event.place?.[0],n=e.event.time,i=t?.lat!==void 0&&t.lng!==void 0&&n?.year!==void 0?Vo(n,t.lng,e.event.utcOffsetHours):void 0;if(!i||t?.lat===void 0||t.lng===void 0){this.sceneRenderer.setMeteorShower([],0,0);return}const r={lat:t.lat,lng:t.lng,elevationM:0},a=(e.event.durationSeconds??0)*1e3||e.timeline.duration||2e4,o=Math.round(i.getTime()/1e3)+Math.round(t.lat*1e3),c=Lt.schedule({ratePerHour:Lt.observedRatePerHour(Lt.apexPosition(i,r).altitudeDeg),durationMs:a,velocityKmS:Lt.TYPICAL_VELOCITY_KM_S,seed:o}),l=lh.activeAt(i).map(u=>{const d=lh.radiantPosition(u.shower,i,r);return{entry:u,position:d,rate:lh.observedRatePerHour(u.zhr,d.altitudeDeg,u.shower.populationIndex)}}).sort((u,d)=>d.rate-u.rate)[0];if(!l||l.rate<=0){this.sceneRenderer.setMeteorShower(c,0,0);return}const h=zs.schedule({ratePerHour:l.rate,durationMs:a,velocityKmS:l.entry.shower.velocityKmS,seed:o+1});this.sceneRenderer.setMeteorShower([...h,...c],l.position.altitudeDeg,l.position.azimuthDeg)}meteorByRank(e){this.ensureMeteorSchedule(this.ufoElement.sighting);const t=[...this.sceneRenderer.meteorSchedule].filter(r=>r.t+r.durationMs<=this.ufoElement.seekableDuration).sort((r,a)=>a.brightness-r.brightness);if(t.length===0)return;const n=t[e%t.length],i=this.sceneRenderer.meteorMidpoint(n);if(i)return{t:Math.round(n.t+n.durationMs*.45),...i}}lensOpticsAt(e){const t=this.ufoElement.sighting,n=t.instrument,i=n.frame,r=Qt(t,e),a=r?.fNumber??n.fNumber;if(!i||a===void 0)return;const o=Vt.focalLengthMmFor(n,Vn.fovOf(t,e));if(o!==void 0)return{focalLengthMm:o,fNumber:a,focusDistance:r?.focusDistanceM??0,frameHeightMm:i.heightMm}}projectionAt(e){const t=this.ufoElement.sighting;return Gi.of(t.instrument,mt.CANVAS_HEIGHT_PX,Vn.fovOf(t,e))}sizeEstimateOf(e){let t=this.sizeEstimates.get(e);return t||(t=new lw,this.sizeEstimates.set(e,t)),t}}const Ip="rr0-scene";function bw(){qp(),customElements.get(Ip)||customElements.define(Ip,xd)}bw();export{q2 as $,Rw as A,tt as B,oe as C,Y0 as D,Ge as E,Nw as F,Cw as G,pm as H,Dw as I,Pw as J,Ra as K,$a as L,Iw as M,ao as N,xt as O,wv as P,_s as Q,ka as R,An as S,ww as T,en as U,Pe as V,Tn as W,Tw as X,Ys as Y,fm as Z,Lw as _,Aw as a,gc as a0,eu as a1,Sc as a2,nn as a3,xm as a4,nd as a5,id as a6,je as a7,Ms as a8,Ka as a9,ai as aa,Yi as ab,Ew as b,Fw as c,Mc as d,Uw as e,Xe as f,C as g,P0 as h,Ow as i,kw as j,G2 as k,Os as l,Qc as m,Y1 as n,gt as o,Xt as p,bh as q,xn as r,ed as s,Ki as t,j2 as u,rv as v,ti as w,qn as x,lt as y,Mt as z};
6072
+ `);let r=vi.cache.get(i);return r||(r=Promise.all(n.map(a=>vi.load(a.url))).then(a=>a.reduce((o,c)=>vi.concat(o,c))),vi.cache.set(i,r)),r}static parse(e){const t=e.byteLength/(4*Float32Array.BYTES_PER_ELEMENT),n=t*Float32Array.BYTES_PER_ELEMENT;return{count:t,ra:new Float32Array(e,0*n,t),dec:new Float32Array(e,1*n,t),mag:new Float32Array(e,2*n,t),ci:new Float32Array(e,3*n,t)}}static concat(e,t){const n=(i,r)=>{const a=new Float32Array(i.length+r.length);return a.set(i,0),a.set(r,i.length),a};return{count:e.count+t.count,ra:n(e.ra,t.ra),dec:n(e.dec,t.dec),mag:n(e.mag,t.mag),ci:n(e.ci,t.ci)}}}const tw=new URL(""+new URL("rain-BvWZrB9h.ogg",import.meta.url).href,import.meta.url).href,nw=new URL(""+new URL("wind-BjklexY7.ogg",import.meta.url).href,import.meta.url).href,iw=new URL(""+new URL("thunder-DA48qs_v.wav",import.meta.url).href,import.meta.url).href,sw=20,rw=1;class aw{context;buffers=new Map;ambientSource;ambientGain;ambientKey="none";ambientToken=0;ambientVolume=0;windSource;windGain;windActive=!1;windToken=0;windVolume=0;paused=!0;requested={type:"none",intensity:0,windSpeed:0};resume(){if(!this.context){if(typeof AudioContext>"u")return;try{this.context=new AudioContext}catch(e){console.warn("WeatherAudio: Web Audio unavailable, weather sounds disabled:",e);return}}this.context.state==="suspended"&&this.context.resume()}setAmbient(e,t,n){if(this.requested={type:e,intensity:t,windSpeed:n},!this.context)return;this.paused&&(e="none",t=0,n=0);const i=e==="rain"||e==="hail"?e:"none";if(this.ambientVolume=i==="hail"?Math.min(1,t*1.3+.2):i==="rain"?t:0,i!==this.ambientKey){this.ambientKey=i;const a=++this.ambientToken;this.stopSource(this.ambientSource,this.ambientGain),this.ambientSource=void 0,this.ambientGain=void 0,i!=="none"&&this.startLoop(tw,this.ambientVolume).then(o=>this.applyIfCurrent(o,a,()=>this.ambientToken,c=>{this.ambientSource=c?.source,this.ambientGain=c?.gain,c&&(c.gain.gain.value=this.ambientVolume)}))}else this.ambientGain&&(this.ambientGain.gain.value=this.ambientVolume);this.windVolume=Math.min(n/sw,1);const r=n>rw;if(r!==this.windActive){this.windActive=r;const a=++this.windToken;this.stopSource(this.windSource,this.windGain),this.windSource=void 0,this.windGain=void 0,r&&this.startLoop(nw,this.windVolume).then(o=>this.applyIfCurrent(o,a,()=>this.windToken,c=>{this.windSource=c?.source,this.windGain=c?.gain,c&&(c.gain.gain.value=this.windVolume)}))}else this.windGain&&(this.windGain.gain.value=this.windVolume)}setPaused(e){if(e===this.paused)return;this.paused=e;const{type:t,intensity:n,windSpeed:i}=this.requested;this.setAmbient(t,n,i)}playThunder(){!this.context||this.paused||this.playOneShot(iw,.9)}dispose(){this.ambientToken++,this.windToken++,this.stopSource(this.ambientSource,this.ambientGain),this.stopSource(this.windSource,this.windGain),this.ambientSource=void 0,this.ambientGain=void 0,this.windSource=void 0,this.windGain=void 0,this.context?.close(),this.context=void 0,this.buffers.clear()}applyIfCurrent(e,t,n,i){if(t!==n()){e?.source.stop();return}i(e)}async startLoop(e,t){const n=this.context;if(n)try{const i=await this.getBuffer(e),r=n.createBufferSource();r.buffer=i,r.loop=!0;const a=n.createGain();return a.gain.value=t,r.connect(a).connect(n.destination),r.start(),{source:r,gain:a}}catch(i){console.warn("Weather ambient sound failed to load, staying silent:",i);return}}async playOneShot(e,t){const n=this.context;if(n)try{const i=await this.getBuffer(e),r=n.createBufferSource();r.buffer=i;const a=n.createGain();a.gain.value=t,r.connect(a).connect(n.destination),r.start()}catch(i){console.warn("Thunder sound failed to load:",i)}}async getBuffer(e){const t=this.context;if(!t)throw new Error("WeatherAudio: AudioContext not ready — resume() must be called first");let n=this.buffers.get(e);return n||(n=fetch(e).then(i=>{if(!i.ok)throw new Error(`Audio fetch failed (${i.status}): ${e}`);return i.arrayBuffer()}).then(i=>t.decodeAudioData(i)),this.buffers.set(e,n)),n}stopSource(e,t){try{e?.stop()}catch{}e?.disconnect(),t?.disconnect()}}class zi{constructor(e){this.elements=e;const{eccentricity:t,perihelionAu:n}=e,[i,r]=this.perifocalAxes(),a=Math.sqrt(zi.SUN_GM_AU3_PER_DAY2*(1+t)/n);this.perihelionPosition=this.scale(i,n),this.perihelionVelocity=this.scale(r,a),this.inverseSemiMajorAxis=(1-t)/n}static SUN_GM_AU3_PER_DAY2=.0002959122082855911;static MAX_ITERATIONS=200;perihelionPosition;perihelionVelocity;inverseSemiMajorAxis;positionAt(e){const t=e-this.elements.perihelionJd,n=this.universalAnomaly(t),i=this.inverseSemiMajorAxis*n*n,r=this.elements.perihelionAu,a=1-n*n/r*zi.stumpffC(i),o=t-n*n*n/Math.sqrt(zi.SUN_GM_AU3_PER_DAY2)*zi.stumpffS(i);return{x:a*this.perihelionPosition.x+o*this.perihelionVelocity.x,y:a*this.perihelionPosition.y+o*this.perihelionVelocity.y,z:a*this.perihelionPosition.z+o*this.perihelionVelocity.z}}heliocentricDistanceAt(e){const t=this.positionAt(e);return Math.hypot(t.x,t.y,t.z)}universalAnomaly(e){if(e===0)return 0;const t=Math.sign(e),n=Math.sqrt(zi.SUN_GM_AU3_PER_DAY2)*Math.abs(e),i=o=>{const c=this.inverseSemiMajorAxis*o*o,l=this.elements.perihelionAu;return(1-this.inverseSemiMajorAxis*l)*o*o*o*zi.stumpffS(c)+l*o};let r=Math.max(1,n/this.elements.perihelionAu);for(;i(r)<n;)r*=2;let a=0;for(let o=0;o<zi.MAX_ITERATIONS&&r-a>1e-13*Math.max(1,r);o++){const c=(a+r)/2;i(c)<n?a=c:r=c}return t*(a+r)/2}perifocalAxes(){const e=this.elements.ascendingNodeDeg*Math.PI/180,t=this.elements.argumentOfPerihelionDeg*Math.PI/180,n=this.elements.inclinationDeg*Math.PI/180,i=Math.cos(e),r=Math.sin(e),a=Math.cos(t),o=Math.sin(t),c=Math.cos(n),l=Math.sin(n);return[{x:i*a-r*o*c,y:r*a+i*o*c,z:o*l},{x:-i*o-r*a*c,y:-r*o+i*a*c,z:a*l}]}scale(e,t){return{x:e.x*t,y:e.y*t,z:e.z*t}}static stumpffC(e){if(Math.abs(e)<1e-6)return 1/2-e/24+e*e/720;if(e>0)return(1-Math.cos(Math.sqrt(e)))/e;const t=Math.sqrt(-e);return(Math.cosh(t)-1)/-e}static stumpffS(e){if(Math.abs(e)<1e-6)return 1/6-e/120+e*e/5040;if(e>0){const n=Math.sqrt(e);return(n-Math.sin(n))/(n*n*n)}const t=Math.sqrt(-e);return(Math.sinh(t)-t)/(t*t*t)}}const dg=[{id:"halley-1910",designation:"1P/Halley",name:{en:"Halley's Comet",fr:"comète de Halley"},orbit:{eccentricity:.9672960498922706,perihelionAu:.5872100477652511,inclinationDeg:162.218798367122,ascendingNodeDeg:58.56208298700436,argumentOfPerihelionDeg:111.7366940639061,perihelionJd:2.4187816784171113e6},peakMagnitude:0,peakOn:"1910-05-20",absoluteMagnitude:4.72,activityExponent:4,tailLengthDeg:100,tailLengthAu:.1638,note:"Passed 0.15 au from Earth on 20 May 1910, and the Earth crossed the outer tail the day before — the apparition that produced a genuine public panic."},{id:"brooks-1911",designation:"C/1911 O1",name:{en:"Comet Brooks",fr:"comète Brooks"},orbit:{eccentricity:.9876404970138669,perihelionAu:.4898172916113738,inclinationDeg:33.34043866978714,ascendingNodeDeg:293.7022074981857,argumentOfPerihelionDeg:153.5578007321686,perihelionJd:2.4193378856140426e6},peakMagnitude:2,peakOn:"1911-10-25",absoluteMagnitude:5.59,activityExponent:4},{id:"skjellerup-maristany-1927",designation:"C/1927 X1",name:{en:"Comet Skjellerup-Maristany",fr:"comète Skjellerup-Maristany"},orbit:{eccentricity:.999839726885059,perihelionAu:.1761569619628186,inclinationDeg:85.1125991950808,ascendingNodeDeg:78.24360172472711,argumentOfPerihelionDeg:47.15877857390136,perihelionJd:2.4252326808989984e6},peakMagnitude:-6,peakOn:"1927-12-15",absoluteMagnitude:1.19,activityExponent:4,note:"One of the few comets of the century seen in full daylight."},{id:"de-kock-paraskevopoulos-1941",designation:"C/1941 B2",name:{en:"Comet de Kock-Paraskevopoulos",fr:"comète de Kock-Paraskevopoulos"},orbit:{eccentricity:.9991026715181549,perihelionAu:.7900329662827822,inclinationDeg:168.2039226531089,ascendingNodeDeg:43.10609347214336,argumentOfPerihelionDeg:268.6990344196369,perihelionJd:2430022157765061e-9},peakMagnitude:2,peakOn:"1941-02-05",absoluteMagnitude:5.01,activityExponent:4},{id:"southern-1947",designation:"C/1947 X1",name:{en:"the Southern Comet",fr:"comète australe"},orbit:{eccentricity:.9998424430916737,perihelionAu:.1100045955093761,inclinationDeg:138.5113919632757,ascendingNodeDeg:337.3114969669252,argumentOfPerihelionDeg:196.1820121395961,perihelionJd:2.4325220864727003e6},peakMagnitude:-3,peakOn:"1947-12-08",absoluteMagnitude:3.01,activityExponent:4,note:"A bright southern-hemisphere comet of December 1947, the month the American sighting wave of that year was still being argued over."},{id:"eclipse-1948",designation:"C/1948 V1",name:{en:"the Eclipse Comet",fr:"comète de l'éclipse"},orbit:{eccentricity:.9999130678247334,perihelionAu:.1354437057263306,inclinationDeg:23.11668597152911,ascendingNodeDeg:211.0454985994762,argumentOfPerihelionDeg:107.2474157073104,perihelionJd:2.4328519265329437e6},peakMagnitude:-2,peakOn:"1948-11-01",absoluteMagnitude:4.79,activityExponent:4,note:"Found during the total solar eclipse of 1 November 1948, which is how a comet that bright had gone unnoticed: it had been hidden in the Sun's glare."},{id:"arend-roland-1957",designation:"C/1956 R1",name:{en:"Comet Arend-Roland",fr:"comète Arend-Roland"},orbit:{eccentricity:1.0002570255357,perihelionAu:.3160532361485914,inclinationDeg:119.9440863251822,ascendingNodeDeg:215.8548157717755,argumentOfPerihelionDeg:308.775920364167,perihelionJd:2.4359365327396123e6},peakMagnitude:.5,peakOn:"1957-04-25",absoluteMagnitude:3.96,activityExponent:4,note:"Showed a spike pointing back TOWARD the Sun in late April 1957 — a real anti-tail, and much reported at the time."},{id:"mrkos-1957",designation:"C/1957 P1",name:{en:"Comet Mrkos",fr:"comète Mrkos"},orbit:{eccentricity:.9993521583504134,perihelionAu:.3549238508212375,inclinationDeg:93.9433042053929,ascendingNodeDeg:68.32441518619923,argumentOfPerihelionDeg:40.31823675802871,perihelionJd:243605193752228e-8},peakMagnitude:1,peakOn:"1957-08-05",absoluteMagnitude:5.07,activityExponent:4,note:"The second bright naked-eye comet of 1957, four months after Arend-Roland."},{id:"seki-lines-1962",designation:"C/1962 C1",name:{en:"Comet Seki-Lines",fr:"comète Seki-Lines"},orbit:{eccentricity:1.000003791331562,perihelionAu:.03139689112215131,inclinationDeg:65.01487186102287,ascendingNodeDeg:304.6776602796538,argumentOfPerihelionDeg:11.47295326312573,perihelionJd:2437756163010178e-9},peakMagnitude:-2.5,peakOn:"1962-04-01",absoluteMagnitude:9.3,activityExponent:4},{id:"ikeya-seki-1965",designation:"C/1965 S1",name:{en:"Comet Ikeya-Seki",fr:"comète Ikeya-Seki"},orbit:{eccentricity:.9999141178248997,perihelionAu:.007785966366889336,inclinationDeg:141.8642315267051,ascendingNodeDeg:346.9951764632611,argumentOfPerihelionDeg:69.04909813996062,perihelionJd:2.4390546837018197e6},peakMagnitude:-10,peakOn:"1965-10-21",alsoRecordedMagnitude:2,alsoRecordedOn:"1965-10-30",absoluteMagnitude:5.26,activityExponent:4.002,tailLengthDeg:25,tailLengthAu:.5048,note:"A sungrazer that passed 450 000 km above the Sun's surface and was seen beside it in broad daylight — the brightest comet of the twentieth century. It then stood in the dawn sky for a fortnight with a tail some 25 degrees long, which is the second magnitude recorded here."},{id:"bennett-1970",designation:"C/1969 Y1",name:{en:"Comet Bennett",fr:"comète Bennett"},orbit:{eccentricity:.9962979048768408,perihelionAu:.5376209981502136,inclinationDeg:90.03975717147327,ascendingNodeDeg:224.6576652531314,argumentOfPerihelionDeg:354.1494209173161,perihelionJd:2.4406655455270996e6},peakMagnitude:0,peakOn:"1970-03-26",absoluteMagnitude:3.36,activityExponent:4},{id:"white-ortiz-bolelli-1970",designation:"C/1970 K1",name:{en:"Comet White-Ortiz-Bolelli",fr:"comète White-Ortiz-Bolelli"},orbit:{eccentricity:.9999488875801225,perihelionAu:.00884411465256722,inclinationDeg:138.9520738221631,ascendingNodeDeg:336.8194095816687,argumentOfPerihelionDeg:61.10224765396615,perihelionJd:2.4407209807728203e6},peakMagnitude:1,peakOn:"1970-05-22",absoluteMagnitude:4.35,activityExponent:4},{id:"kohoutek-1973",designation:"C/1973 E1",name:{en:"Comet Kohoutek",fr:"comète Kohoutek"},orbit:{eccentricity:1.000007152175185,perihelionAu:.1424250377812859,inclinationDeg:14.30414984159355,ascendingNodeDeg:258.4893339663974,argumentOfPerihelionDeg:37.79772760699667,perihelionJd:2442044930687027e-9},peakMagnitude:0,peakOn:"1974-01-05",absoluteMagnitude:4.89,activityExponent:4,note:"Announced in advance as the comet of the century and remembered for disappointing: it was an ordinary naked-eye object, not the spectacle the press had promised."},{id:"west-1976",designation:"C/1975 V1",name:{en:"Comet West",fr:"comète West"},orbit:{eccentricity:1.000017859625611,perihelionAu:.1966006188461085,inclinationDeg:43.07319920579427,ascendingNodeDeg:118.9189245655447,argumentOfPerihelionDeg:358.4315101259072,perihelionJd:2442833721841768e-9},peakMagnitude:-3,peakOn:"1976-02-25",absoluteMagnitude:4.41,activityExponent:4,tailLengthDeg:30,tailLengthAu:.4325,note:"Broke into four pieces at perihelion. Barely reported at the time — the press had been burned by Kohoutek two years earlier."},{id:"iras-araki-alcock-1983",designation:"C/1983 H1",name:{en:"Comet IRAS-Araki-Alcock",fr:"comète IRAS-Araki-Alcock"},orbit:{eccentricity:.9898409731606003,perihelionAu:.9913412593828502,inclinationDeg:73.25000846947029,ascendingNodeDeg:49.10235754476374,argumentOfPerihelionDeg:192.8506176754439,perihelionJd:2.4454757545235856e6},peakMagnitude:1.7,peakOn:"1983-05-11",absoluteMagnitude:9.04,activityExponent:4,note:"Passed 0.031 au from Earth on 11 May 1983, one of the closest cometary approaches on record: it crossed a quarter of the sky in a night, which no other comet in this list did."},{id:"halley-1986",designation:"1P/Halley",name:{en:"Halley's Comet",fr:"comète de Halley"},orbit:{eccentricity:.9672792271749998,perihelionAu:.5871034488173393,inclinationDeg:162.2422242700916,ascendingNodeDeg:58.85993640671803,argumentOfPerihelionDeg:111.8655480539208,perihelionJd:2.4464709589610207e6},peakMagnitude:2.1,peakOn:"1986-03-10",absoluteMagnitude:2.71,activityExponent:4,note:"The worst-placed return in two thousand years — famous, expected, and for most observers a faint smudge."},{id:"hyakutake-1996",designation:"C/1996 B2",name:{en:"Comet Hyakutake",fr:"comète Hyakutake"},orbit:{eccentricity:.9997295133739305,perihelionAu:.2302272039470452,inclinationDeg:124.923592343765,ascendingNodeDeg:188.0454295899424,argumentOfPerihelionDeg:130.1724036582639,perihelionJd:2.4502048946148166e6},peakMagnitude:0,peakOn:"1996-03-25",absoluteMagnitude:4.75,activityExponent:4,tailLengthDeg:80,tailLengthAu:1,note:"Passed 0.10 au from Earth in March 1996, five weeks BEFORE perihelion, with a tail measured at some 80 degrees — the longest of the modern era."},{id:"hale-bopp-1997",designation:"C/1995 O1",name:{en:"Comet Hale-Bopp",fr:"comète Hale-Bopp"},orbit:{eccentricity:.9951314746156615,perihelionAu:.9141695067003724,inclinationDeg:89.43017155012492,ascendingNodeDeg:282.470602866853,argumentOfPerihelionDeg:130.5872524854533,perihelionJd:2450539633099368e-9},peakMagnitude:-.8,peakOn:"1997-04-01",absoluteMagnitude:-1.06,activityExponent:4,tailLengthDeg:20,tailLengthAu:.9938,note:"Visible to the naked eye for about eighteen months, longer than any comet on record."},{id:"mcnaught-2007",designation:"C/2006 P1",name:{en:"Comet McNaught",fr:"comète McNaught"},orbit:{eccentricity:1.00001811603225,perihelionAu:.1707325614080681,inclinationDeg:77.83726446452654,ascendingNodeDeg:267.4149080498975,argumentOfPerihelionDeg:155.9756130642756,perihelionJd:2454113298753579e-9},peakMagnitude:-5.5,peakOn:"2007-01-13",absoluteMagnitude:2.53,activityExponent:4,tailLengthDeg:35,tailLengthAu:.5009,note:"The brightest comet since Ikeya-Seki, seen in daylight beside the Sun in January 2007."},{id:"lovejoy-2011",designation:"C/2011 W3",name:{en:"Comet Lovejoy",fr:"comète Lovejoy"},orbit:{eccentricity:.999915056276912,perihelionAu:.005553783989325053,inclinationDeg:134.3558712062691,ascendingNodeDeg:326.3693517957772,argumentOfPerihelionDeg:53.50991655176601,perihelionJd:2455911511809431e-9},peakMagnitude:-3,peakOn:"2011-12-16",alsoRecordedMagnitude:1.5,alsoRecordedOn:"2011-12-22",absoluteMagnitude:3.51,activityExponent:1.194,note:"A sungrazer that was expected to be destroyed at perihelion and came out the other side, to stand in the southern dawn sky for the rest of December — which is the second magnitude recorded here."},{id:"panstarrs-2013",designation:"C/2011 L4",name:{en:"Comet PANSTARRS",fr:"comète PANSTARRS"},orbit:{eccentricity:1.000032542889696,perihelionAu:.301544229714915,inclinationDeg:84.2081978367921,ascendingNodeDeg:65.66588626213694,argumentOfPerihelionDeg:333.6516444379993,perihelionJd:2456361669960698e-9},peakMagnitude:1,peakOn:"2013-03-10",absoluteMagnitude:5.98,activityExponent:4},{id:"neowise-2020",designation:"C/2020 F3",name:{en:"Comet NEOWISE",fr:"comète NEOWISE"},orbit:{eccentricity:.9991782081129224,perihelionAu:.2946512466331692,inclinationDeg:128.9375043020912,ascendingNodeDeg:61.01042991771634,argumentOfPerihelionDeg:37.2786526292898,perihelionJd:2.4590341788972816e6},peakMagnitude:.9,peakOn:"2020-07-08",absoluteMagnitude:5.79,activityExponent:4,tailLengthDeg:10,tailLengthAu:.1808,note:"The first comet since Hale-Bopp that ordinary observers in the northern hemisphere saw without being told where to look."},{id:"tsuchinshan-atlas-2024",designation:"C/2023 A3",name:{en:"Comet Tsuchinshan-ATLAS",fr:"comète Tsuchinshan-ATLAS"},orbit:{eccentricity:1.000020192843226,perihelionAu:.3914228969475176,inclinationDeg:139.1105462619479,ascendingNodeDeg:21.55945689078845,argumentOfPerihelionDeg:308.4913086299446,perihelionJd:2460581242087108e-9},peakMagnitude:0,peakOn:"2024-10-14",absoluteMagnitude:3.97,activityExponent:4,tailLengthDeg:20,tailLengthAu:.1902,note:"Briefly reported far brighter around 9 October 2024, when it stood almost between the observer and the Sun and forward-scattered the light through its own dust — a geometry this catalog's brightness model does not attempt, so what is stored is the ordinary evening-sky peak a few days later."}];class ow{static WINDOW_DAYS=200;static TWILIGHT_ELONGATION_DEG=15;static LIGHT_SPEED_AU_PER_DAY=173.144632674;static orbits=new Map;static aroundDate(e){const t=this.julianDayOf(e);return dg.filter(n=>Math.abs(t-n.orbit.perihelionJd)<=this.WINDOW_DAYS)}static brightestAt(e,t){return this.aroundDate(e).map(n=>this.appearanceOf(n,e,t)).sort((n,i)=>n.magnitude-i.magnitude)[0]}static appearanceOf(e,t,n){const i=Tt(t),r=this.earthPositionAt(i),a=this.apparentPositionOf(e,2451545+i.tt,r),o=this.subtract(a,r),c=this.length(a),l=this.length(o),h=this.tailEndAt(e,a,r,c,i,t,n),u=this.horizontalOf(o,i,t,n);return{apparition:e,position:u,...h,heliocentricDistanceAu:c,earthDistanceAu:l,elongationDeg:this.angleBetween(o,this.subtract({x:0,y:0,z:0},r)),magnitude:this.magnitudeAt(e,c,l)}}static magnitudeAt(e,t,n){const i=e.absoluteMagnitude+5*Math.log10(n)+2.5*e.activityExponent*Math.log10(t);return Math.max(i,e.peakMagnitude)}static tailEndAt(e,t,n,i,r,a,o){if(e.tailLengthAu===void 0)return{};const c=1+e.tailLengthAu/i,l=this.subtract({x:t.x*c,y:t.y*c,z:t.z*c},n),h=this.subtract(t,n);return{tailEnd:this.horizontalOf(l,r,a,o),tailLengthDeg:this.angleBetween(h,l)}}static apparentPositionOf(e,t,n){const i=this.orbitOf(e);let r=i.positionAt(t);for(let a=0;a<2;a++){const o=this.length(this.subtract(r,n))/this.LIGHT_SPEED_AU_PER_DAY;r=i.positionAt(t-o)}return r}static horizontalOf(e,t,n,i){const r=Br(aS(),new vt(e.x,e.y,e.z,t)),a=Br(jm(t),r),o=z5(t,new md(i.lat,i.lng,i.elevationM)),c=new vt(a.x-o.x,a.y-o.y,a.z-o.z,t),l=vd(c);return Md(l.ra,l.dec,n,i)}static earthPositionAt(e){return Br(rS(),vs(Se.Earth,e))}static julianDayOf(e){return 2451545+Tt(e).tt}static orbitOf(e){const t=this.orbits.get(e.id);if(t)return t;const n=new zi(e.orbit);return this.orbits.set(e.id,n),n}static subtract(e,t){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}}static length(e){return Math.hypot(e.x,e.y,e.z)}static angleBetween(e,t){const n=(e.x*t.x+e.y*t.y+e.z*t.z)/(this.length(e)*this.length(t)||1);return Math.acos(Math.min(1,Math.max(-1,n)))*180/Math.PI}}const ch=[{id:"sn-1006",kind:"supernova",designation:"SN 1006",name:{en:"Supernova of 1006",fr:"supernova de 1006"},raHours:15.03947,decDeg:-42.09694,peakMagnitude:-7.5,peakJd:2088620,startJd:2088620,lightCurve:[[0,-7.5],[29,-5.9],[60,-4.9],[106,-3.2],[166,-1.9],[258,-1],[350,.5],[364,.7],[411,1.2],[456,1.8],[484,2.5],[785.5,7]],source:"Winkler, Gupta & Long 2003 (peak); decline borrowed from SN 1572",note:"The brightest stellar event in recorded history, seen in daylight, low in the southern sky from Europe and the Near East. The decline is modelled, not recorded, and falls below the naked eye after about two years where the chronicles speak of three."},{id:"sn-1054",kind:"supernova",designation:"SN 1054",name:{en:"Supernova of 1054",fr:"supernova de 1054"},raHours:5.5755,decDeg:22.0175,peakMagnitude:-6,peakJd:2106216,startJd:2106216,lightCurve:[[0,-6],[23,-4],[642,6]],source:"Chinese chronicles (Song huiyao), via Stephenson & Green 2002",note:"The explosion that left the Crab Nebula. Its magnitude is an estimate; the two durations are recorded."},{id:"sn-1181",kind:"supernova",designation:"SN 1181",name:{en:"Supernova of 1181",fr:"supernova de 1181"},raHours:.88645,decDeg:67.50067,peakMagnitude:0,peakJd:2152636,startJd:2152636,lightCurve:[[0,0],[185,6]],source:"Chinese and Japanese chronicles, via Stephenson & Green 2002",note:"Circumpolar from Europe and China, so never set. Its peak magnitude is uncertain by at least a magnitude."},{id:"sn-1572",kind:"supernova",designation:"SN 1572",name:{en:"Tycho's Supernova",fr:"supernova de Tycho"},raHours:.42264,decDeg:64.14083,peakMagnitude:-4,peakJd:2295551,startJd:2295546,lightCurve:[[0,-3],[5,-4],[34,-2.4],[65,-1.4],[111,.3],[171,1.6],[263,2.5],[355,4],[369,4.2],[416,4.7],[461,5.3],[489,6]],source:"Tycho Brahe and contemporaries, reduced by Ruiz-Lapuente 2004",note:"Circumpolar from northern Europe. Tycho showed it had no parallax, so it was not in the air: a new star, beyond the Moon."},{id:"sn-1604",kind:"supernova",designation:"SN 1604",name:{en:"Kepler's Supernova",fr:"supernova de Kepler"},raHours:17.51125,decDeg:-21.48733,peakMagnitude:-2.95,peakJd:2307210,startJd:2307191,lightCurve:[[0,.23],[3,-1.3],[6,-2.08],[9,-2.17],[19,-2.95],[27,-2.95],[32,-1.95],[36,-1.52],[86,.9],[96,.45],[103,1],[114,1.2],[118,1.55],[133,1.95],[137,2.3],[170,2.25],[185,2.25],[194,2.4],[197,2.9],[308,4.45],[324,4.45],[339,4.95],[364,4.7]],source:"Kepler, Fabricius, Maestlin and the Korean court astronomers, reduced by Ruiz-Lapuente 2017",note:"The last supernova in our Galaxy seen with the naked eye. It went behind the Sun from mid-November 1604 to January 1605, which is the gap in its record."},{id:"t-crb-1866",kind:"nova",designation:"T CrB",name:{en:"Nova Coronae Borealis 1866",fr:"nova de la Couronne boréale 1866"},raHours:15.99171,decDeg:25.92017,peakMagnitude:2,peakJd:2402734,startJd:2402734,lightCurve:[[0,2],[1.5,3],[2.5,3.11],[6.5,5.18],[8.5,5.75],[10.5,6.85],[11.5,6.8],[12.5,7.5],[16,8.18],[32,9.27],[38,9.2],[40,8.95],[44,9.4],[48,9.07],[54,9.4],[58,9.21],[79,9.44],[107,9.26],[111,9.01],[115,8.21],[119,7.96],[159,7.51],[179,7.57],[183,7.97],[191,7.66],[199,8.2],[207,8.31],[211,8.83],[215,8.65],[223,8.97],[297,8.9],[345,9.25],[377,9.07],[425,9.3],[537,9.3]],source:"Recorded peak (Birmingham); curve borrowed from its 1946 eruption",note:"The first eruption of the recurrent nova T CrB to be seen. The decline is its 1946 one."},{id:"t-aur-1891",kind:"nova",designation:"T Aur",name:{en:"Nova Aurigae 1891",fr:"nova du Cocher 1891"},raHours:5.53309,decDeg:30.44583,peakMagnitude:4.49,peakJd:2412083,startJd:2412079,lightCurve:[[0,5.28],[4,4.49],[24,4.58],[40,4.97],[52,4.95],[56,4.5],[60,4.9],[68,4.88],[72,5.25],[76,4.93],[84,5.44],[88,7.23],[96,8.85],[100,10.44]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"gk-per-1901",kind:"nova",designation:"GK Per",name:{en:"Nova Persei 1901",fr:"nova de Persée 1901"},raHours:3.52,decDeg:43.90431,peakMagnitude:.19,peakJd:24154395e-1,startJd:24154377e-1,lightCurve:[[0,2.7],[.8,.86],[1.8,.19],[2.3,.2],[5.8,1.78],[11.8,2.54],[12.8,2.98],[17.8,3.62],[18.8,3.35],[19.8,3.77],[20.8,3.59],[22.8,3.95],[24.8,3.82],[25.6,4.99],[25.9,4.89],[26.6,3.69],[27.6,3.94],[27.9,4.61],[28.6,5.28],[28.9,4.46],[29.9,3.8],[30.9,4.27],[31.6,5.21],[31.9,5.22],[32.9,3.88],[33.9,4.19],[34.6,4.85],[35.6,4.8],[36.6,4.23],[37.6,4.44],[38.9,4.15],[39.7,5.19],[40.6,5.39],[40.9,5.35],[41.9,4.01],[42.6,4.5],[42.9,4.49],[43.6,5.53],[44,5.23],[44.6,5.61],[44.9,5.5],[45.9,4.17],[46.9,4.69],[47.6,5.5],[48.6,5.59],[49.6,5.14],[49.9,4.48],[50.6,4.45],[50.9,4.55],[51.6,5.47],[52.6,5.74],[53.7,5.66],[55.7,4.41],[56.7,5.43],[58.7,5.81],[58.9,5.58],[59.7,5.64],[59.9,4.76],[60.9,4.26],[61.9,5.62],[62.7,5.85],[62.9,5.53],[63.7,5.8],[64.9,4.28],[65.6,5.33],[66.7,5.87],[66.9,5.56],[68.7,5.7],[68.9,5.3],[69.7,4.47],[70.7,5.65],[72.9,5.98],[73.9,5.71],[74.7,4.98],[74.9,4.46],[75.7,4.87],[76.9,6.05],[77.6,5.76],[78,6],[78.7,5.95],[80.7,4.98],[81.9,5.85],[82.7,6.02],[84.7,5.41],[84.9,5.08],[85.7,5.17],[85.9,5.6],[87,6.1],[88.8,6.2],[89.7,4.96],[89.9,4.93],[90.7,5.9],[91.9,6.32],[92.7,5.86],[93.1,6.24],[93.7,5.38],[93.9,6.2],[96.1,6.12],[97.1,6.37],[97.6,5.12],[98,5.85],[99.3,6.35],[101.3,6.12],[101.7,5.25],[102.3,4.95],[102.7,6.12],[103.2,5.83],[104.7,6.37],[105,6.13],[106,6.22],[106.7,4.88],[107.7,6.3],[108.1,6.4],[109,6],[109.7,5.16],[110,5.82],[112.1,5.89],[113.1,5.5],[115.7,5.8],[116,6.11],[118.7,5.68],[119,6.23],[119.7,5.85],[120,6.12],[121,4.62],[121.8,5.9],[123,5.48],[125,6.05],[126,5.89],[130.9,6.11],[146.1,6.02],[155.6,6.26],[180.4,6.09],[190.4,6.39],[245.5,6.87],[266.2,6.77],[301.1,7.16],[321.5,7.07],[346.5,7.87],[375.7,7.86],[385.8,8.09],[389.8,8.55],[406.1,8.33],[416.5,8.59],[445.9,8.62],[472.1,9.24],[565.9,9.74],[571,9.4],[589.8,9.76]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010",note:"Discovered on 21 February 1901 by Thomas Anderson in Edinburgh, and the brightest nova of the century until V603 Aql."},{id:"dn-gem-1912",kind:"nova",designation:"DN Gem",name:{en:"Nova Geminorum 1912",fr:"nova des Gémeaux 1912"},raHours:6.9151,decDeg:32.14108,peakMagnitude:3.58,peakJd:241947675e-2,startJd:241947275e-2,lightCurve:[[0,11.7],[1,4.5],[4,3.58],[5,4.45],[5.5,5.32],[6,5.53],[6.5,5.11],[8,5.43],[8.5,5.16],[11,5.53],[11.5,5.13],[12,5.18],[13.75,4.5],[15.75,5.3],[18.75,6],[19.75,5.55],[26.75,6],[28.75,5.9],[31.75,6.6],[32.75,6.2],[33.75,6.5],[36.75,6.55],[39.75,6.2],[40.75,6.75],[41.75,7],[44.75,6.75],[52.75,6.75],[54.75,7.23],[58.25,7.5],[62.25,7.3],[64.25,7.47],[66.25,8.1],[70.25,7.5],[72.25,8.1],[78.25,7.55],[80.25,8.2],[86.25,7.2],[90.25,7.3],[92.25,7.8],[152.25,7.2],[160.25,7.4],[166.25,8.2],[168.25,8.2],[170.25,7.3],[180.25,7.4],[182.25,8],[186.25,7.5],[190.25,7.6],[192.25,8],[211.25,7.75],[227.25,8],[275.25,7.78],[315.25,8.6],[331.25,7.79],[339.25,8.27],[363.25,8.61],[443.25,8.93],[451.25,9.2],[535.25,10.3],[567.25,9.9],[615.25,10.8],[631.25,10.63],[647.25,10.88],[679.25,10.8],[695.25,11.07],[727.25,11]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"v603-aql-1918",kind:"nova",designation:"V603 Aql",name:{en:"Nova Aquilae 1918",fr:"nova de l'Aigle 1918"},raHours:18.81518,decDeg:.58414,peakMagnitude:-.5,peakJd:242175475e-2,startJd:242174875e-2,lightCurve:[[0,11.3],[2,10.5],[4,6.6],[4.5,1.04],[6,-.5],[6.5,.18],[10,1.1],[10.5,.95],[12.75,1.89],[21.75,3.07],[23.75,3.76],[29.75,3.16],[34.75,3.5],[36.75,3.86],[44.75,3.79],[48.75,4.43],[52.75,3.84],[56.75,3.95],[57.75,4.04],[58.75,4.49],[59.75,4.42],[60.75,4.69],[62.75,4.6],[63.75,4.11],[64.75,3.97],[68.75,4.18],[70.75,4.65],[71.75,4.51],[73.75,4.73],[75.75,4.44],[79.75,4.85],[83.75,4.43],[89.75,4.88],[92.75,4.86],[94.75,4.58],[96.75,4.92],[99.75,5.05],[163.25,5.45],[167.25,5.7],[179.25,5.48],[191.25,5.8],[203.25,5.5],[247.25,5.9],[251.25,6.25],[257.25,5.5],[265.25,6.13],[281.25,6.33],[345.25,6.3],[385.25,6.73],[393.25,6.43],[425.25,6.71],[433.25,6.56],[461.25,7.27],[525.25,7.6],[541.25,7.47],[637.25,8.3],[669.25,8.17],[717.25,8.55],[749.25,8.4],[765.25,8.68],[885.25,8.75],[949.25,9.4],[1013.25,9.19],[1141.25,9.57],[1269.25,9.48],[1333.25,9.95],[1653.25,9.94],[1781.25,10.28],[1909.25,10.34],[2037.25,10.1],[2101.25,10.46],[2165.25,10.51],[2357.25,10.3],[2549.25,10.77],[2741.25,10.46],[2869.25,10.83],[3125.25,10.71],[3317.25,11.22],[3381.25,10.91],[3637.25,11.42],[3829.25,10.96],[3893.25,11.65],[3957.25,11.63],[4085.25,11.14],[4213.25,11.48],[4277.25,10.7],[4341.25,11.42],[4405.25,11.47],[4469.25,11.06],[4533.25,11.08],[4597.25,11.7],[4725.25,11.45],[4789.25,10.94]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010",note:"The brightest nova of the modern era, at magnitude -0.5 on 9-10 June 1918: as bright as Vega, in a summer evening sky, in wartime."},{id:"v476-cyg-1920",kind:"nova",designation:"V476 Cyg",name:{en:"Nova Cygni 1920",fr:"nova du Cygne 1920"},raHours:19.97347,decDeg:53.61858,peakMagnitude:1.94,peakJd:242256025e-2,startJd:242255925e-2,lightCurve:[[0,2.7],[1,1.94],[3,2.07],[4.5,2.95],[8.25,4],[31.75,6.41],[35.75,7.23],[37.75,7.08],[41.75,7.33],[43.75,7.92],[45.75,8.2],[51.75,8.59],[63.75,8.82],[65.75,9.25],[71.75,8.93],[85.75,9.43],[87.75,9.05],[95.75,9.2],[97.75,8.67],[99.75,9.07],[112.75,8.78],[120.75,9.03],[128.75,8.67],[144.75,8.94],[152.75,8.73],[168.75,8.79],[176.75,9.28],[192.75,9],[216.75,9.6],[232.75,9.27],[240.75,9.5],[288.75,9.4],[296.75,9.6],[304.75,9.3],[320.75,9.73],[328.75,9.5],[336.75,9.8],[428.75,9.61],[476.75,10.01],[492.75,9.76],[508.75,9.87],[524.75,9.65],[556.75,9.87],[572.75,9.65],[620.75,10.22],[668.75,10.44],[684.75,10.23],[716.75,10.33],[756.75,10.66],[884.75,10.59],[948.75,10.96],[1108.75,10.96]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"rr-pic-1925",kind:"nova",designation:"RR Pic",name:{en:"Nova Pictoris 1925",fr:"nova du Peintre 1925"},raHours:6.59335,decDeg:-62.64008,peakMagnitude:.95,peakJd:24243085e-1,startJd:24242995e-1,lightCurve:[[0,2.43],[5,2.35],[6,2.1],[7,2.4],[9,.95],[13,1.8],[14,1.7],[16,2.15],[18,2.2],[19,1.9],[23,3.1],[27,3.05],[31.5,3.58],[43.5,3.08],[47.5,3.15],[57.5,2.3],[59.5,1.65],[63.5,3.03],[65.5,2.84],[67.5,3.16],[69.5,2.4],[71.5,2.04],[73.5,2.05],[75.5,2.55],[79.5,3],[83.5,3.15],[116.5,3.54],[120.5,3.78],[124.5,3.67],[136.5,4.18],[148.5,4.34],[154.5,4.17],[194.5,4.43],[226.5,4.93],[234.5,4.8],[242.5,5.4],[250.5,5.5],[266.5,5.15],[298.5,5.6],[362.5,5.4],[414.5,5.7],[430.5,5.5],[494.5,6.2],[718.5,6.52],[830.5,6.3],[862.5,6.6],[878.5,6.4],[910.5,6.77],[958.5,6.67],[1062.5,7.07],[1318.5,7.35],[1590.5,8.12],[1718.5,8.25],[2486.5,8.59],[2614.5,8.47],[2742.5,8.7],[3382.5,8.6],[3766.5,8.97],[4022.5,8.79],[4150.5,9.22],[6710.5,10.29],[7414.5,11.03],[8438.5,10.96]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010",note:"A slow nova, and a southern one: more than two months within two magnitudes of its peak."},{id:"dq-her-1934",kind:"nova",designation:"DQ Her",name:{en:"Nova Herculis 1934",fr:"nova d'Hercule 1934"},raHours:18.12507,decDeg:45.85906,peakMagnitude:1.56,peakJd:24277935e-1,startJd:242778675e-2,lightCurve:[[0,3.4],[1.5,2.4],[3,2.67],[5.75,2.01],[6.75,1.56],[7.75,1.59],[11.75,2.97],[12.75,2.31],[14.75,3.07],[15.75,2.56],[16.75,2.51],[19.75,2.68],[23.75,2.53],[24.75,2.27],[26.75,2.58],[30.75,2.24],[31.75,2.63],[32.75,2.66],[34.75,2.11],[39.75,2.71],[41.75,2.31],[43.75,2.37],[46.75,3.64],[47.75,3.21],[50.75,3.23],[52.75,2.66],[55.75,2.56],[58.75,2.97],[60.75,2.77],[61.75,3.36],[63.75,3.43],[64.75,2.89],[65.75,3.22],[68.75,3.52],[69.75,2.95],[70.75,3.06],[71.75,2.7],[76.75,3.65],[79.75,3.74],[81.75,3.21],[83.75,3.75],[87.75,3.69],[92.75,4.04],[94.75,4.8],[97.75,4.24],[98.75,4.52],[100.75,4.08],[101.75,4.43],[105.75,4.58],[106.75,4.33],[107.75,4.73],[108.75,6.57],[109.75,8.08],[110.75,8.15],[111.75,8.56],[113.75,8.45],[114.75,9.15],[115.75,9.15],[116.75,9.59],[117.75,9.43],[118.75,9.8],[122.75,10.5],[123.75,10.28],[124.75,10.93],[127.75,10.83],[129.75,11.87],[131.75,12.42],[135.75,12.5],[137.75,12.9],[138.75,12.77],[139.75,13],[143.75,12],[144.75,12.33],[146.75,12.35],[147.75,11.64],[148.75,11.83],[150.75,10.9],[151.75,10.78],[152.75,11.17],[154.75,10.32],[155.75,10.4],[165.25,9.24],[185.25,7.74],[225.25,6.8],[273.25,6.72],[321.25,6.97],[333.25,6.79],[353.25,7],[357.25,6.82],[377.25,6.88],[401.25,7.29],[409.25,6.8],[413.25,6.8],[419.25,7.1],[435.25,7.09],[451.25,7.4],[475.25,7],[555.25,7.48],[823.25,7.83],[855.25,8.18],[1135.25,8.43],[1823.25,9.98],[1887.25,9.71],[2015.25,10.55],[2335.25,10.95]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010",note:"Lost about ten magnitudes in a few weeks from April 1935, when dust condensed around it, then came back to naked-eye brightness."},{id:"cp-lac-1936",kind:"nova",designation:"CP Lac",name:{en:"Nova Lacertae 1936",fr:"nova du Lézard 1936"},raHours:22.26142,decDeg:55.61703,peakMagnitude:2.02,peakJd:242834025e-2,startJd:242833825e-2,lightCurve:[[0,4.03],[.5,2.9],[1,2.45],[2,2.02],[2.5,2.61],[4,3],[4.5,3.35],[5,3.3],[9.25,4.59],[14.25,5.45],[22.25,6.03],[23.25,6.3],[26.25,6.23],[38.25,6.74],[41.25,6.61],[50.25,7.35],[53.25,7.27],[57.25,7.7],[58.25,7.54],[60.25,7.55],[61.25,7.79],[71.25,7.6],[74.25,7.81],[76.25,8.3],[77.25,7.79],[86.25,8.21],[87.25,8],[88.25,8.25],[92.25,8.17],[94.25,8.47],[102.25,8.27],[103.25,8.7],[104.25,8.4],[110.25,8.66],[116.75,8.55],[122.75,8.83],[126.75,8.7],[140.75,9.06],[154.75,9.01],[164.75,9.36],[170.75,9.18],[174.75,9.48],[186.75,9.42],[188.75,9.73],[192.75,9.53],[200.75,9.74],[202.75,9.5],[204.75,9.77],[208.75,9.6],[214.75,9.75],[216.75,10.05],[222.75,9.7],[232.75,10.03],[236.75,9.82],[250.75,10.1],[254.75,9.9],[260.75,10.1],[264.75,9.8],[266.75,10.15],[268.75,10],[274.75,10.2],[276.75,9.9],[292.75,10.6],[294.75,10.6],[298.75,10.1],[318.75,10.35],[320.75,10.6],[322.75,10.3],[328.75,10.65],[332.75,10.3],[338.75,10.7],[348.75,10.53],[350.75,10.7],[354.75,10.37],[358.75,10.58],[365.75,10.43],[373.75,10.85],[421.75,10.94]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"cp-pup-1942",kind:"nova",designation:"CP Pup",name:{en:"Nova Puppis 1942",fr:"nova de la Poupe 1942"},raHours:8.19613,decDeg:-35.35139,peakMagnitude:.73,peakJd:243067675e-2,startJd:243067275e-2,lightCurve:[[0,.95],[4,.73],[4.5,1.3],[5.5,1.47],[6,2.01],[7.75,2.88],[8.75,2.97],[10.75,3.5],[11.75,4.02],[13.75,4.4],[14.75,3.8],[17.75,5],[18.75,4.93],[19.75,5.48],[23.75,5.5],[25.75,5.65],[26.75,5.99],[33.25,6.28],[45.25,6.6],[57.25,6.41],[81.25,6.85],[89.25,6.5],[97.25,6.67],[101.25,7],[113.25,6.66],[125.25,7.1],[135.25,6.96],[231.25,7.86],[279.25,7.8],[327.25,8.33],[407.25,8.18],[423.25,8.59],[471.25,8.53],[503.25,8.99],[551.25,8.97],[567.25,8.7],[583.25,9.47],[615.25,8.95],[655.25,9.5],[751.25,9.55],[815.25,10.09],[847.25,10.02],[879.25,10.48],[911.25,10.34],[1023.25,10.79],[1279.25,10.9]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010",note:"One of the fastest bright novae: two magnitudes gone in four days."},{id:"t-crb-1946",kind:"nova",designation:"T CrB",name:{en:"Nova Coronae Borealis 1946",fr:"nova de la Couronne boréale 1946"},raHours:15.99171,decDeg:25.92017,peakMagnitude:2.5,peakJd:2431860,startJd:2431860,lightCurve:[[0,2.5],[1.5,3.5],[2.5,3.61],[6.5,5.68],[8.5,6.25],[10.5,7.35],[11.5,7.3],[12.5,8],[16,8.68],[32,9.77],[38,9.7],[40,9.45],[44,9.9],[48,9.57],[54,9.9],[58,9.71],[79,9.94],[107,9.76],[111,9.51],[115,8.71],[119,8.46],[159,8.01],[179,8.07],[183,8.47],[191,8.16],[199,8.7],[207,8.81],[211,9.33],[215,9.15],[223,9.47],[297,9.4],[345,9.75],[377,9.57],[425,9.8],[537,9.8]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010",note:"A recurrent nova. It erupted in 1866 and in 1946, and a third eruption was expected from 2024 on."},{id:"v446-her-1960",kind:"nova",designation:"V446 Her",name:{en:"Nova Herculis 1960",fr:"nova d'Hercule 1960"},raHours:18.956,decDeg:13.24147,peakMagnitude:4.83,peakJd:24370038e-1,startJd:24370033e-1,lightCurve:[[0,5.2],[.5,4.83],[2,4.9],[2.5,5.4],[3,5.05],[3.5,5.57],[4,5.25],[5,5.5],[6.5,5.4],[7.2,5.78],[8.2,5.6],[9.2,5.98],[10.2,5.92],[11.2,6.21],[16.2,6.1],[17.2,6.23],[18.2,7.2],[19.2,6.51],[20.2,6.78],[26.2,6.97],[27.2,7.24],[28.2,7.13],[29.2,7.45],[31.2,7.2],[40.7,7.57],[44.7,8.25],[46.7,7.84],[56.7,8.15],[60.7,8.9],[70.7,8.7],[72.7,8.14],[76.7,8.71],[80.7,8.47],[82.7,8.87],[86.7,8.57],[90.7,8.93],[107.7,9.11],[111.7,8.94],[115.7,9.27],[139.7,9.38],[151.7,9.91],[155.7,9.72],[173.7,10.51],[221.7,10.95]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"v533-her-1963",kind:"nova",designation:"V533 Her",name:{en:"Nova Herculis 1963",fr:"nova d'Hercule 1963"},raHours:18.23902,decDeg:41.85614,peakMagnitude:3,peakJd:24380605e-1,startJd:24380565e-1,lightCurve:[[0,8],[4,3],[4.5,3],[8,4],[13,3.95],[15,4.6],[21,4.53],[24,5.05],[27,5.15],[32,4.76],[34,4.98],[35,5.39],[37,5.43],[41,6.04],[49,6.02],[56.5,6.34],[60.5,6.11],[74.5,6.72],[102.5,6.99],[137.5,7.81],[197.5,8.31],[217.5,8.8],[225.5,8.57],[233.5,9.03],[237.5,8.78],[277.5,9.44],[301.5,9.46],[315.5,9.86],[323.5,9.73],[339.5,10.05],[355.5,10.74],[363.5,10.32],[371.5,10.6],[387.5,10.69],[427.5,10.38],[435.5,10.84],[443.5,10.74],[451.5,11.33],[459.5,10.98],[467.5,11.17],[507.5,11.16],[539.5,11.66],[603.5,11.7],[619.5,12.05],[651.5,12.03],[659.5,11.74],[667.5,10.9]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"hr-del-1967",kind:"nova",designation:"HR Del",name:{en:"Nova Delphini 1967",fr:"nova du Dauphin 1967"},raHours:20.70565,decDeg:19.16092,peakMagnitude:3.58,peakJd:2439838,startJd:2439646,lightCurve:[[0,11.9],[6,11.8],[12,8.8],[16,8.3],[20,6.7],[30,5.8],[36,5.51],[66,5.55],[78,5.35],[86,4.89],[96,5],[108,4.75],[136,5.13],[152,4.83],[182,4.93],[186,4.59],[192,3.58],[202,5],[220,5.46],[226,5.14],[230,5.45],[232,5.14],[236,5],[242,5.08],[244,4.59],[246,4.45],[254,5.3],[256,4.75],[260,5.69],[268,4.8],[274,4.94],[276,5.45],[280,5.2],[282,5.51],[286,5.58],[292,4.95],[294,5.16],[298,4.94],[311,5.09],[335,4.4],[367,5.76],[407,6.16],[423,6.55],[603,7.43],[907,8.32],[1451,9.41],[2347,10.75]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010",note:"An exceptionally slow nova: rose over months and stayed near magnitude 4 to 5 for most of 1967 and 1968."},{id:"lv-vul-1968",kind:"nova",designation:"LV Vul",name:{en:"Nova Vulpeculae 1968",fr:"nova du Petit Renard 1968"},raHours:19.80012,decDeg:27.1715,peakMagnitude:4.5,peakJd:243996425e-2,startJd:243996325e-2,lightCurve:[[0,5],[1,4.5],[2,5],[2.5,4.86],[3,5.1],[3.5,4.88],[4,5.1],[5,4.9],[7,5.4],[8,5.23],[10.5,5.42],[12,5.82],[13,5.4],[13.5,5.74],[14,5.7],[14.5,6.08],[15,5.75],[15.5,5.86],[16,5.6],[17,5.8],[18,5.6],[20.5,6.34],[21,6.2],[22.5,6.84],[23,6.57],[24,6.98],[24.5,6.3],[25,7.1],[26,6.65],[34.25,7.48],[35.25,7.23],[39.25,7.32],[44.25,7.76],[45.25,7.49],[46.25,7.78],[50.25,7.84],[51.25,8.1],[53.25,7.9],[54.25,8.13],[56.25,8],[57.75,8.24],[67.75,8.52],[75.75,8.38],[83.75,8.69],[89.75,8.59],[125.75,9.32],[127.75,9.33],[129.75,8.98],[131.75,9.29],[135.75,9.43],[212.75,9.9],[220.75,10.16],[228.75,10.03],[236.75,10.3],[244.75,10.16],[264.75,10.54],[280.75,10.45],[296.75,10.79],[328.75,10.78]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"fh-ser-1970",kind:"nova",designation:"FH Ser",name:{en:"Nova Serpentis 1970",fr:"nova du Serpent 1970"},raHours:18.51307,decDeg:2.61444,peakMagnitude:4.5,peakJd:244063425e-2,startJd:244063125e-2,lightCurve:[[0,7],[2,5],[3,4.5],[3.5,5],[4.5,4.6],[5.5,5],[6.5,4.68],[12.25,4.66],[16.25,5.3],[17.25,5.72],[18.25,5.3],[19.25,5.2],[23.25,5.84],[24.25,5.68],[27.25,5.9],[30.25,5.47],[32.25,5.9],[34.25,5.7],[43.25,6.28],[45.25,6.1],[50.25,6.62],[52.25,6.47],[57.25,6.63],[60.25,7.08],[61.25,6.87],[62.25,7.2],[63.25,6.85],[64.25,7.68],[65.25,7.3],[66.25,8.3],[67.25,7.93],[69.25,9.15],[71.25,9.2],[72.25,9.63],[74.25,9.9],[76.25,9.7],[77.25,10.25],[78.25,10.1],[79.25,10.4],[80.25,10.23],[81.25,10.57],[83.25,10.64],[85.25,10.35],[86.25,11.2],[87.25,10.1],[89.25,11.2],[96.25,11.35],[100.25,11.95],[102.25,11.1],[104.25,11.65],[106.25,11.5],[108.25,12.07],[114.75,11.32],[118.75,11.28],[122.75,10.93],[130.75,10.85],[134.75,10.52],[154.75,10.65],[162.75,10.12],[174.75,9.98],[178.75,10.34],[186.75,9.98],[214.75,10.25],[224.75,10.02],[240.75,10.2],[264.75,10],[272.75,10.2],[280.75,10.05],[288.75,10.4],[296.75,10],[348.75,10.7],[396.75,10.3],[444.75,10.73],[460.75,10.59],[540.75,10.94],[556.75,10.82]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"v1500-cyg-1975",kind:"nova",designation:"V1500 Cyg",name:{en:"Nova Cygni 1975",fr:"nova du Cygne 1975"},raHours:21.19349,decDeg:48.15056,peakMagnitude:1.88,peakJd:244265525e-2,startJd:244265425e-2,lightCurve:[[0,2.44],[1,1.88],[1.5,1.88],[2.5,2.41],[3,3.38],[4,4.28],[8.25,5.81],[11.25,6.46],[22.25,7.35],[33.25,7.73],[34.25,7.97],[37.25,7.86],[40.25,8.3],[43.25,8.19],[48.25,8.6],[49.25,8.46],[66.25,9.04],[70.25,8.93],[75.25,9.23],[76.25,9.03],[80.25,9.39],[81.25,9.19],[83.25,9.35],[84.25,9.13],[86.25,9.39],[89.25,9.32],[90.25,9.54],[93.25,9.37],[105.75,9.86],[193.75,10.43],[201.75,10.7],[209.75,10.47],[257.75,10.94],[265.75,10.81]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010",note:"One of the fastest novae on record: discovered on 29 August 1975, at its peak of magnitude 1.9 within two days, and two magnitudes down again two days later."},{id:"v842-cen-1986",kind:"nova",designation:"V842 Cen",name:{en:"Nova Centauri 1986",fr:"nova du Centaure 1986"},raHours:14.59794,decDeg:-57.6265,peakMagnitude:4.9,peakJd:244675975e-2,startJd:244675725e-2,lightCurve:[[0,5.6],[2.5,4.9],[3.5,5.1],[15.5,5.1],[17.5,5.75],[18.5,5.4],[20.5,5.5],[22.5,5.95],[30.5,6.15],[31.5,6.3],[32,7.5],[34.5,7.2],[38.5,7.5],[39,7],[41.5,7.15],[42.5,6.7],[44.5,7.23],[45.5,6.6],[53,9.3]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"sn-1987a",kind:"supernova",designation:"SN 1987A",name:{en:"Supernova 1987A",fr:"supernova 1987A"},raHours:5.59111,decDeg:-69.26975,peakMagnitude:2.98,peakJd:24469425e-1,startJd:24468495e-1,lightCurve:[[0,6.36],[1,6.11],[2,4.63],[4,4.45],[32,3.97],[56,3.15],[93,2.98],[105,3.35],[118,4.11],[134,4.43],[504,8.15],[617,10.27]],source:"V photometry compiled by the Open Supernova Catalog (Sternberg catalogue, IAU circulars, CTIO)",note:"In the Large Magellanic Cloud, 160 000 light years away: the nearest supernova since Kepler's, and invisible north of about 20° N."},{id:"v1974-cyg-1992",kind:"nova",designation:"V1974 Cyg",name:{en:"Nova Cygni 1992",fr:"nova du Cygne 1992"},raHours:20.50879,decDeg:52.63078,peakMagnitude:4.27,peakJd:24486753e-1,startJd:24486718e-1,lightCurve:[[0,7.2],[1,5.23],[2,4.62],[3.5,4.27],[4.5,4.59],[6,4.5],[7,4.78],[7.5,4.52],[8,4.82],[10.7,5.25],[11.7,5.66],[16.7,5.85],[21.7,6.47],[22.7,6.3],[27.7,6.46],[29.7,6.83],[34.7,6.9],[35.7,7.25],[36.7,7],[37.7,7.16],[39.7,7.03],[43.7,7.41],[45.7,7.26],[50.7,7.45],[57.7,7.78],[58.7,8.13],[61.7,7.92],[64.7,8.19],[65.7,7.99],[71.7,8.22],[76.7,8.01],[128.2,8.72],[176.2,8.89],[192.2,9.15],[216.2,9.28],[232.2,9.07],[236.2,9.3],[390.2,10.99]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"v382-vel-1999",kind:"nova",designation:"V382 Vel",name:{en:"Nova Velorum 1999",fr:"nova des Voiles 1999"},raHours:10.74678,decDeg:-52.42533,peakMagnitude:2.88,peakJd:245132225e-2,startJd:245132075e-2,lightCurve:[[0,2.99],[1.5,2.88],[2.5,3.46],[4.5,3.98],[5,4.32],[5.5,4.23],[7.5,4.85],[21.75,6.67],[30.25,7.2],[40.25,7.41],[93.25,7.95],[97.25,8.25],[101.25,8],[113.25,7.96],[129.25,8.5],[155.25,8.47],[163.25,9.1],[179.25,9],[187.25,8.7],[195.25,9.15],[211.25,9.23],[235.25,9.8],[243.25,9.71],[299.25,10.42],[383.25,10.52],[415.25,10.81]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"v1494-aql-1999",kind:"nova",designation:"V1494 Aql",name:{en:"Nova Aquilae 1999",fr:"nova de l'Aigle 1999"},raHours:19.38482,decDeg:4.9555,peakMagnitude:4.11,peakJd:245151575e-2,startJd:245151425e-2,lightCurve:[[0,5.15],[.5,4.86],[1,4.27],[1.5,4.11],[2.5,4.35],[5,5.48],[10.5,6.26],[14.25,6.28],[20.25,7.43],[24.25,7.25],[25.25,7.63],[27.25,7.7],[29.25,7.42],[33.25,8.08],[35.25,8.03],[36.25,7.6],[37.25,7.6],[46.25,8.5],[54.25,8.28],[56.25,8.63],[58.25,8.4],[61.25,9.53],[62.25,9],[64.25,9.13],[69.25,8.58],[70.25,8.9],[72.25,8.88],[75.25,8.57],[77.25,9],[79.25,8.8],[81.25,9.7],[83.25,9.6],[85.25,9.8],[86.75,9.5],[88.75,9.54],[90.75,8.9],[92.75,8.85],[96.75,9.63],[102.75,9.7],[104.75,8.98],[106.75,8.73],[116.75,9.63],[118.75,9.6],[120.75,9.07],[122.75,9.26],[124.75,9.8],[128.75,9.36],[134.75,9.75],[147.75,9.92],[155.75,9.81],[259.75,10.96]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"v4743-sgr-2002",kind:"nova",designation:"V4743 Sgr",name:{en:"Nova Sagittarii 2002",fr:"nova du Sagittaire 2002"},raHours:19.01926,decDeg:-22.00167,peakMagnitude:5,peakJd:245253775e-2,startJd:245253675e-2,lightCurve:[[0,5.2],[1,5],[2,5.89],[2.5,5.91],[3.5,6.43],[5,6.45],[5.5,6.86],[6,6.59],[7,6.77],[7.5,7.31],[8.5,6.99],[9,7.09],[10.5,7.86],[11,7.58],[11.5,7.89],[15.75,8.33],[17.75,8.18],[18.75,8.58],[19.75,8.44],[22.75,8.83],[23.75,8.6],[24.75,8.85],[27.75,8.83],[30.75,9.4],[31.75,9.09],[36.25,9.08],[38.25,9.34],[62.25,9.75],[66.25,10.1],[70.25,9.7],[74.25,10],[171.25,10.9]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010"},{id:"rs-oph-2006",kind:"nova",designation:"RS Oph",name:{en:"Nova Ophiuchi 2006",fr:"nova d'Ophiuchus 2006"},raHours:17.83699,decDeg:-6.70792,peakMagnitude:4.8,peakJd:2453779,startJd:2453779,lightCurve:[[0,4.8],[1.25,4.97],[2.75,5.78],[3.25,5.7],[3.75,6.24],[4.25,6.05],[4.75,6.38],[5.25,6.3],[8.5,7.25],[14.5,7.95],[24.5,8.55],[29.5,9.08],[48,9.87],[80,10.28],[107,11.54],[119,11.54],[139,11.98],[147,11.83],[163,12.03],[171,11.97],[175,11.65],[183,11.84],[195,11.64],[203,11.8],[207,12.13],[219,11.45],[277,11.68],[325,11],[341,11.53],[357,11.62],[373,11.3],[405,11.5],[421,11.17],[469,10.96],[501,11.22],[549,10.75],[581,11.08],[597,10.98]],source:"AAVSO, binned by Strope, Schaefer & Henden 2010",note:"A recurrent nova, erupting every twenty years or so (1898, 1907, 1933, 1945, 1958, 1967, 1985, 2006, 2021)."},{id:"v1280-sco-2007",kind:"nova",designation:"V1280 Sco",name:{en:"Nova Scorpii 2007",fr:"nova du Scorpion 2007"},raHours:16.96145,decDeg:-32.34325,peakMagnitude:3.8,peakJd:2454149,startJd:2454136,lightCurve:[[0,9.7],[13,3.8],[34,5.8],[103,15]],source:"AAVSO (discovery, peak, dust minimum); t2 from Das et al. 2008",note:"Faded from sight quickly when dust formed around it, three weeks after its peak."},{id:"v339-del-2013",kind:"nova",designation:"V339 Del",name:{en:"Nova Delphini 2013",fr:"nova du Dauphin 2013"},raHours:20.39186,decDeg:20.76772,peakMagnitude:4.4,peakJd:24565214e-1,startJd:24565214e-1,lightCurve:[[0,4.4],[11,6.4],[20,7.4]],source:"Gehrz et al. 2015 (peak, t2, t3)",note:"High in the summer evening sky of the northern hemisphere, and widely photographed."},{id:"v1369-cen-2013",kind:"nova",designation:"V1369 Cen",name:{en:"Nova Centauri 2013",fr:"nova du Centaure 2013"},raHours:13.9126,decDeg:-59.15114,peakMagnitude:3.48,peakJd:245663965e-2,startJd:24566285e-1,lightCurve:[[0,5.33],[1.57,4.08],[2.75,3.73],[4.57,4.16],[5.96,4.15],[10.26,3.77],[11.15,3.48],[12.14,3.74],[14.17,4.78],[15.46,4.97],[23.16,4.22],[26.25,4.32],[27.31,4.82],[29.56,5.11],[32.66,4.71],[33.84,4.86],[36.05,4.46],[37.15,4.99],[41.42,4.59],[42.37,4.93],[43.37,4.82],[44.54,5.09],[49.95,5.38],[51.99,5.82],[54.21,5.77]],source:"AAVSO, binned by day, as plotted by Izzo 2017 (arXiv:1704.07214, figure 1)",note:"Discovered on 2 December 2013 by John Seach at magnitude 5.5, it flared several times, reaching about 3.3 around 14 December: the brightest nova of the century so far, and a southern one."},{id:"rs-oph-2021",kind:"nova",designation:"RS Oph",name:{en:"Nova Ophiuchi 2021",fr:"nova d'Ophiuchus 2021"},raHours:17.83699,decDeg:-6.70792,peakMagnitude:4.6,peakJd:2459436,startJd:2459435,lightCurve:[[0,5],[1,4.6],[2.25,4.77],[3.75,5.58],[4.25,5.5],[4.75,6.04],[5.25,5.85],[5.75,6.18],[6.25,6.1],[9.5,7.05],[15.5,7.75],[25.5,8.35],[30.5,8.88],[49,9.67],[81,10.08],[108,11.34],[120,11.34],[140,11.78],[148,11.63],[164,11.83],[172,11.77],[176,11.45],[184,11.64],[196,11.44],[204,11.6],[208,11.93],[220,11.25],[278,11.48],[326,10.8],[342,11.33],[358,11.42],[374,11.1],[406,11.3],[422,10.97],[470,10.76],[502,11.02],[550,10.55],[582,10.88],[598,10.78]],source:"Recorded discovery and peak (8 and 9 August 2021); curve borrowed from its 2006 eruption",note:"RS Oph's latest eruption, discovered on 8 August 2021. The decline is its 2006 one."}];class Tp{static UNIX_EPOCH_JD=24405875e-1;static aroundDate(e){const t=this.julianDayOf(e);return ch.filter(n=>this.magnitudeAt(n,t)!==void 0)}static appearancesAt(e,t){const n=this.julianDayOf(e),i=[];for(const r of ch){const a=this.magnitudeAt(r,n);a!==void 0&&i.push({outburst:r,position:ei.ofJ2000(r.raHours,r.decDeg,e,t),magnitude:a})}return i.sort((r,a)=>r.magnitude-a.magnitude)}static brightestAt(e,t){return this.appearancesAt(e,t)[0]}static byId(e){return ch.find(t=>t.id===e)}static magnitudeAt(e,t){const n=e.lightCurve,i=t-e.startJd;if(n.length===0||i<n[0][0]||i>n[n.length-1][0])return;let r=1;for(;r<n.length-1&&n[r][0]<i;)r++;const[a,o]=n[r-1]??n[0],[c,l]=n[r]??n[0];if(c===a)return o;const h=Math.min(1,Math.max(0,(i-a)/(c-a)));return o+h*(l-o)}static julianDayOf(e){return e.getTime()/864e5+this.UNIX_EPOCH_JD}}const cw=[{id:"quadrantids",code:"QUA",name:{en:"Quadrantids",fr:"Quadrantides"},radiantRaHours:15.33,radiantDecDeg:49.7,start:{month:12,day:28},peak:{month:1,day:3},end:{month:1,day:12},peakZhr:110,velocityKmS:41,populationIndex:2.1},{id:"lyrids",code:"LYR",name:{en:"April Lyrids",fr:"Lyrides d'avril"},radiantRaHours:18.13,radiantDecDeg:33.3,start:{month:4,day:16},peak:{month:4,day:22},end:{month:4,day:25},peakZhr:18,velocityKmS:49,populationIndex:2.1},{id:"eta-aquariids",code:"ETA",name:{en:"eta Aquariids",fr:"Êta Aquarides"},radiantRaHours:22.53,radiantDecDeg:-1,start:{month:4,day:19},peak:{month:5,day:6},end:{month:5,day:28},peakZhr:50,velocityKmS:66,populationIndex:2.4},{id:"alpha-capricornids",code:"CAP",name:{en:"alpha Capricornids",fr:"Alpha Capricornides"},radiantRaHours:20.47,radiantDecDeg:-9.2,start:{month:7,day:3},peak:{month:7,day:30},end:{month:8,day:15},peakZhr:5,velocityKmS:23,populationIndex:2.5},{id:"southern-delta-aquariids",code:"SDA",name:{en:"Southern delta Aquariids",fr:"Delta Aquarides du Sud"},radiantRaHours:22.67,radiantDecDeg:-16.4,start:{month:7,day:12},peak:{month:7,day:30},end:{month:8,day:23},peakZhr:25,velocityKmS:41,populationIndex:3.2},{id:"perseids",code:"PER",name:{en:"Perseids",fr:"Perséides"},radiantRaHours:3.22,radiantDecDeg:58,start:{month:7,day:17},peak:{month:8,day:12},end:{month:8,day:24},peakZhr:100,velocityKmS:59,populationIndex:2.2},{id:"southern-taurids",code:"STA",name:{en:"Southern Taurids",fr:"Taurides du Sud"},radiantRaHours:3.47,radiantDecDeg:13,start:{month:9,day:10},peak:{month:10,day:10},end:{month:11,day:20},peakZhr:5,velocityKmS:27,populationIndex:2.3},{id:"draconids",code:"DRA",name:{en:"October Draconids",fr:"Draconides d'octobre"},radiantRaHours:17.47,radiantDecDeg:54,start:{month:10,day:6},peak:{month:10,day:8},end:{month:10,day:10},peakZhr:10,velocityKmS:20,populationIndex:2.6},{id:"orionids",code:"ORI",name:{en:"Orionids",fr:"Orionides"},radiantRaHours:6.35,radiantDecDeg:15.6,start:{month:10,day:2},peak:{month:10,day:21},end:{month:11,day:7},peakZhr:20,velocityKmS:66,populationIndex:2.5},{id:"northern-taurids",code:"NTA",name:{en:"Northern Taurids",fr:"Taurides du Nord"},radiantRaHours:3.87,radiantDecDeg:22,start:{month:10,day:20},peak:{month:11,day:12},end:{month:12,day:10},peakZhr:5,velocityKmS:29,populationIndex:2.3},{id:"leonids",code:"LEO",name:{en:"Leonids",fr:"Léonides"},radiantRaHours:10.13,radiantDecDeg:21.6,start:{month:11,day:6},peak:{month:11,day:17},end:{month:11,day:30},peakZhr:15,velocityKmS:71,populationIndex:2.5},{id:"geminids",code:"GEM",name:{en:"Geminids",fr:"Géminides"},radiantRaHours:7.47,radiantDecDeg:32.3,start:{month:12,day:4},peak:{month:12,day:14},end:{month:12,day:17},peakZhr:150,velocityKmS:35,populationIndex:2.6},{id:"ursids",code:"URS",name:{en:"Ursids",fr:"Ursides"},radiantRaHours:14.47,radiantDecDeg:75.3,start:{month:12,day:17},peak:{month:12,day:22},end:{month:12,day:26},peakZhr:10,velocityKmS:33,populationIndex:3}],Lc=6.5;class lh{static activeAt(e){return cw.flatMap(t=>{const n=this.nearness(t,e);return n<=0?[]:[{shower:t,zhr:t.peakZhr*n,nearness:n}]})}static nearness(e,t){const n=this.dayOfYear(t),i=this.dayOfYear(this.asDate(e.start)),r=this.dayOfYear(this.asDate(e.peak)),a=this.dayOfYear(this.asDate(e.end)),o=this.wrappedDelta(n,r),c=this.wrappedDelta(r,i),l=this.wrappedDelta(a,r);return o<0?o<-c?0:1+o/c:o>0?o>l?0:1-o/l:1}static observedRatePerHour(e,t,n,i=Lc){if(t<=0)return 0;const r=Lc-i;return e*Math.sin(t*Math.PI/180)/Math.pow(n,r)}static radiantPosition(e,t,n){return ei.ofJ2000(e.radiantRaHours,e.radiantDecDeg,t,n)}static dayOfYear(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return Math.floor((Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())-t)/864e5)+1}static asDate(e){return new Date(Date.UTC(2001,e.month-1,e.day))}static wrappedDelta(e,t){const n=e-t;return n>182?n-365:n<-182?n+365:n}}class Lt{static QUIET_RATE_PER_HOUR=2;static APEX_RATE_PER_HOUR=8;static POPULATION_INDEX=3;static apexPosition(e,t){const n=Tt(e),i=new Vc(0,F5(e).elon-90,1),r=Br(cS(n),gd(i,n)),a=vd(r);return Md(a.ra,a.dec,e,t)}static observedRatePerHour(e,t=Lc){const n=Lt.APEX_RATE_PER_HOUR*Math.max(0,Math.sin(e*Math.PI/180)),i=Lc-t;return(Lt.QUIET_RATE_PER_HOUR+n)/Math.pow(Lt.POPULATION_INDEX,i)}static schedule(e){const t=new qc(e.seed^1542469173);return zs.schedule(e).map(n=>{const i=Lt.toCartesian({altitudeDeg:Math.asin(t.next())*180/Math.PI,azimuthDeg:t.between(0,360)}),r=n.fromRadiantDeg*Math.PI/180,a=Lt.turnAround(i,t.between(0,360)),o={x:i.x*Math.cos(r)+a.x*Math.sin(r),y:i.y*Math.cos(r)+a.y*Math.sin(r),z:i.z*Math.cos(r)+a.z*Math.sin(r)};return{...n,radiant:Lt.toHorizontal(o),bearingDeg:Lt.bearingFrom(o,i)}})}static turnAround(e,t){const[n,i]=Lt.basisAround(e),r=t*Math.PI/180;return{x:n.x*Math.cos(r)+i.x*Math.sin(r),y:n.y*Math.cos(r)+i.y*Math.sin(r),z:n.z*Math.cos(r)+i.z*Math.sin(r)}}static bearingFrom(e,t){const[n,i]=Lt.basisAround(e),r=e.x*t.x+e.y*t.y+e.z*t.z,a=Lt.normalise({x:t.x-e.x*r,y:t.y-e.y*r,z:t.z-e.z*r});return(Math.atan2(a.x*i.x+a.y*i.y+a.z*i.z,a.x*n.x+a.y*n.y+a.z*n.z)*180/Math.PI%360+360)%360}static basisAround(e){const t=Math.abs(e.y)<.9?{x:0,y:1,z:0}:{x:1,y:0,z:0},n=Lt.normalise(Lt.cross(e,t));return[n,Lt.normalise(Lt.cross(e,n))]}static toHorizontal(e){const t=Math.hypot(e.x,e.y,e.z)||1;return{altitudeDeg:Math.asin(Math.min(1,Math.max(-1,e.y/t)))*180/Math.PI,azimuthDeg:(Math.atan2(e.x,-e.z)*180/Math.PI%360+360)%360}}static appearanceOf(e){const t=Lt.toCartesian(e.radiant??{altitudeDeg:90,azimuthDeg:0}),n=Lt.turnAround(t,e.bearingDeg),i=e.fromRadiantDeg*Math.PI/180;return Lt.toHorizontal({x:t.x*Math.cos(i)+n.x*Math.sin(i),y:t.y*Math.cos(i)+n.y*Math.sin(i),z:t.z*Math.cos(i)+n.z*Math.sin(i)})}static toCartesian(e){const t=e.altitudeDeg*Math.PI/180,n=e.azimuthDeg*Math.PI/180,i=Math.cos(t);return{x:i*Math.sin(n),y:Math.sin(t),z:-i*Math.cos(n)}}static cross(e,t){return{x:e.y*t.z-e.z*t.y,y:e.z*t.x-e.x*t.z,z:e.x*t.y-e.y*t.x}}static normalise(e){const t=Math.hypot(e.x,e.y,e.z)||1;return{x:e.x/t,y:e.y/t,z:e.z/t}}static TYPICAL_VELOCITY_KM_S=40}const Rp="https://ufoathome.org/tle/index.json";class un{static MAX_ELEMENT_AGE_DAYS=7;static DAY_MS=864e5;fetchImpl;indexUrls;index;files=new Map;constructor(e={}){this.fetchImpl=e.fetchImpl??fetch.bind(globalThis),this.indexUrls=e.indexUrls??un.defaultIndexUrls()}static defaultIndexUrls(){const e=[];return typeof location<"u"&&/^https?:$/.test(location.protocol)&&e.push(new URL("/tle/index.json",location.href).href),e.includes(Rp)||e.push(Rp),e}static FIRST_SNAPSHOT="2021-02-22";async covers(e){const t=Date.parse(`${un.FIRST_SNAPSHOT}T00:00:00Z`)-un.MAX_ELEMENT_AGE_DAYS*un.DAY_MS;if(e.getTime()<t)return!1;const n=await this.loadIndex();return n?Object.values(n.index.kinds).some(i=>e.getTime()>=Date.parse(i.from)-un.MAX_ELEMENT_AGE_DAYS*un.DAY_MS&&e.getTime()<=Date.parse(i.to)+un.MAX_ELEMENT_AGE_DAYS*un.DAY_MS):!1}async at(e){const t=await this.loadIndex();if(!t)return;const{index:n,base:i}=t,r=[],a=[];for(const o of Object.keys(n.kinds)){const c=await this.kindAt(o,e,n,i);r.push(...c),a.push(this.coverageOf(o,e,n,c.length>0))}return{objects:r,coverage:a,credit:n.credit,creditUrl:n.source}}async kindAt(e,t,n,i){const r=t.getTime(),a=n.binDays*un.DAY_MS,o=Math.floor(r/a),c=r-o*a<a/2?o-1:o+1,l=new Set(n.kinds[e].bins),h=[o,c].map(v=>new Date(v*a).toISOString().slice(0,10)).filter(v=>l.has(v));if(h.length===0)return[];const[u,...d]=await Promise.all([this.json(new URL(`objects-${e}.json`,i).href),...h.map(v=>this.binary(new URL(`${e}/${v}.bin`,i).href))]),f=new Map;for(const v of d)for(const m of un.decode(v,n.recordBytes)){const g=f.get(m.norad);(!g||Math.abs(m.epochMs-r)<Math.abs(g.epochMs-r))&&f.set(m.norad,m)}const p=[];for(const v of f.values()){const m=Math.abs(v.epochMs-r)/un.DAY_MS;if(m>un.MAX_ELEMENT_AGE_DAYS)continue;const g=u[v.norad]??{name:String(v.norad)};g.launch&&Date.parse(`${g.launch}T00:00:00Z`)>r||p.push({norad:v.norad,name:g.name,kind:e,launch:g.launch,stdMag:g.stdMag,elements:v,ageDays:m})}return p}coverageOf(e,t,n,i){const{from:r,to:a}=n.kinds[e],o=t.getTime(),c=un.MAX_ELEMENT_AGE_DAYS*un.DAY_MS,l=i?"covered":o<Date.parse(r)-c?"before":o>Date.parse(a)+c?"after":"gap";return{kind:e,status:l,from:r,to:a}}static decode(e,t){const n=new DataView(e),i=[];for(let r=0;r+t<=e.byteLength;r+=t)i.push({norad:n.getUint32(r,!0),epochMs:n.getFloat64(r+4,!0),bstar:n.getFloat32(r+12,!0),inclinationDeg:n.getFloat32(r+16,!0),raanDeg:n.getFloat32(r+20,!0),eccentricity:n.getFloat32(r+24,!0),argOfPerigeeDeg:n.getFloat32(r+28,!0),meanAnomalyDeg:n.getFloat32(r+32,!0),meanMotion:n.getFloat64(r+36,!0)});return i}loadIndex(){return this.index??=(async()=>{for(const e of this.indexUrls)try{const t=await this.fetchImpl(e);if(!t.ok)continue;return{index:await t.json(),base:e}}catch{}})(),this.index}json(e){return this.cached(e,async t=>t.json())}binary(e){return this.cached(e,async t=>t.arrayBuffer())}cached(e,t){let n=this.files.get(e);return n||(n=this.fetchImpl(e).then(i=>{if(!i.ok)throw new Error(`${e}: ${i.status}`);return t(i)}),n.catch(()=>this.files.delete(e)),this.files.set(e,n)),n}}class lw{lowerM;upperM;add(e,t){if(!(e<=0)){if(t.behindM!==void 0){const n=mt.sizeMAt(t.behindM,e);this.lowerM=this.lowerM===void 0?n:Math.max(this.lowerM,n)}if(t.inFrontM!==void 0){const n=mt.sizeMAt(t.inFrontM,e);this.upperM=this.upperM===void 0?n:Math.min(this.upperM,n)}}}get sizeRange(){return{minM:this.lowerM,maxM:this.upperM}}get empty(){return this.lowerM===void 0&&this.upperM===void 0}get contradictory(){return this.lowerM!==void 0&&this.upperM!==void 0&&this.lowerM>this.upperM}distanceRangeAt(e){return e<=0?{}:{minM:this.lowerM===void 0?void 0:mt.distanceMAt(this.lowerM,e),maxM:this.upperM===void 0?void 0:mt.distanceMAt(this.upperM,e)}}clear(){this.lowerM=void 0,this.upperM=void 0}}class Bs{static DEG_PER_SECOND=360/86164.0905;static degOver(e){return Math.max(0,e)*Bs.DEG_PER_SECOND}static instants(e,t){if(!(t>0))return 1;const n=Bs.degOver(e)/t;return n<1?1:Math.min(Bs.MAX_INSTANTS,Math.max(2,Math.ceil(n)))}static MAX_INSTANTS=64}class vn{static EYE={apertureMm:7,exposureSeconds:.1,resolutionArcsec:60};static WAVELENGTH_M=55e-8;static ARCSEC_PER_RADIAN=180*3600/Math.PI;static UNKNOWN_CAMERA_FOCAL_MM=50;static UNKNOWN_CAMERA_DETAIL_UM=20;static get skyDriftArcsecPerSecond(){return Bs.DEG_PER_SECOND*3600}static graspOf(e,t={}){const n=t.exposureSeconds??e.exposureSeconds,i=t.fNumber??e.fNumber;if(n===void 0||i===void 0||!(n>0)||!(i>0))return vn.EYE;const r=t.focalLengthMm??e.frame?.focalLengthMm??vn.UNKNOWN_CAMERA_FOCAL_MM,a=r/i,o=vn.resolutionArcsec(e,r,a);return{apertureMm:a,exposureSeconds:Math.min(n,vn.trailLimitedSeconds(o)),resolutionArcsec:o}}static resolutionArcsec(e,t,n){const r=(e.detailUm??vn.UNKNOWN_CAMERA_DETAIL_UM)/1e3/t*vn.ARCSEC_PER_RADIAN,a=1.22*vn.WAVELENGTH_M/(n/1e3)*vn.ARCSEC_PER_RADIAN;return Math.max(r,a)}static trailLimitedSeconds(e){return e/vn.skyDriftArcsecPerSecond}static gainOverEye(e,t={}){const n=vn.graspOf(e,t),i=vn.EYE,r=(n.apertureMm/i.apertureMm)**2,a=n.exposureSeconds/i.exposureSeconds,o=(i.resolutionArcsec/n.resolutionArcsec)**2;return 1.25*Math.log10(r*a*o)}static gainFor(e,t){const n=t.fieldOfViewDeg===void 0?void 0:Vt.focalLengthMmFor(e,t.fieldOfViewDeg);return vn.gainOverEye(e,{fNumber:t.fNumber,focalLengthMm:n,exposureSeconds:t.exposureSeconds})}}const Dp=111320,ga=Math.PI/180,hw=1.02,uw=1;class Ia{static of(e,t){const n=Ia.sightings(e,t);if(n.length<2)return;const i=Ia.baseline(n);if(!i)return;const{near:r,far:a,closedM:o}=i,c=Math.tan(a.widthDeg/2*ga)===0?0:Math.tan(r.widthDeg/2*ga)/Math.tan(a.widthDeg/2*ga);if(c<hw)return;const l=o/(c-1),h=mt.sizeMAt(l,r.widthDeg),u=n.map(d=>({t:d.t,m:mt.distanceMAt(h,d.widthDeg)}));return{widthM:h,distanceM:u,nearestM:Math.min(...u.map(d=>d.m)),fromT:a.t,toT:r.t,closedM:o}}static sightings(e,t){return e.timeline.allKeyframes.flatMap(n=>{const i=n.shapes.find(o=>o.sourceId===t)?.shape,r=i?.angular?.widthDeg,a=Qt(e,n.t);return r===void 0||r<=0||a?.lat===void 0||a.lng===void 0?[]:[{t:n.t,widthDeg:r,lat:a.lat,lng:a.lng,sightAzimuthDeg:i?.aim?.azimuthDeg??a.headingDeg}]}).sort((n,i)=>n.t-i.t)}static baseline(e){let t;for(const n of e)for(const i of e){if(n.t>=i.t)continue;const r=Ia.closedAlongSight(n,i),[a,o,c]=r>=0?[i,n,r]:[n,i,-r];c<uw||a.widthDeg<=o.widthDeg||(!t||c>t.closedM)&&(t={near:a,far:o,closedM:c})}return t}static closedAlongSight(e,t){const n=(t.lat-e.lat)*Dp,i=(t.lng-e.lng)*Dp*Math.cos(e.lat*ga),r=(e.sightAzimuthDeg??0)*ga;return n*Math.cos(r)+i*Math.sin(r)}}class gn{static CONVENTIONAL_M=5;static NEAREST_M=.2;static MARGIN=1.1;static resolve(e){if(e.statedM!==void 0&&e.statedM>0)return{distanceM:gn.atLeastNearest(e.statedM),basis:"stated"};if(e.hypothesisM!==void 0&&e.hypothesisM>0)return{distanceM:gn.atLeastNearest(e.hypothesisM),basis:"hypothesis"};if(e.derivedM!==void 0&&e.derivedM>0)return{distanceM:gn.atLeastNearest(e.derivedM),basis:"derived"};const t=gn.largest(e.range?.minM,e.crossing?.behindM),n=gn.smallest(e.range?.maxM,e.crossing?.inFrontM),i=t===void 0?void 0:t*gn.MARGIN,r=n===void 0?void 0:n/gn.MARGIN;return i!==void 0&&r!==void 0?{distanceM:gn.atLeastNearest(i<=r?Math.sqrt(i*r):i),basis:"bounded"}:i!==void 0?{distanceM:gn.atLeastNearest(i),basis:"bounded"}:r!==void 0&&r<gn.CONVENTIONAL_M?{distanceM:gn.atLeastNearest(r),basis:"bounded"}:{distanceM:gn.CONVENTIONAL_M,basis:"conventional"}}static atLeastNearest(e){return Math.max(gn.NEAREST_M,e)}static largest(...e){const t=e.filter(n=>n!==void 0&&n>0);return t.length===0?void 0:Math.max(...t)}static smallest(...e){const t=e.filter(n=>n!==void 0&&n>0);return t.length===0?void 0:Math.min(...t)}}qp();const dw={sun:{en:"Sun",fr:"Soleil"},moon:{en:"Moon",fr:"Lune"},Venus:{en:"Venus",fr:"Vénus"},Mars:{en:"Mars",fr:"Mars"},Jupiter:{en:"Jupiter",fr:"Jupiter"},Saturn:{en:"Saturn",fr:"Saturne"}},fw=["en","fr"],pw={en:"{name} — mag {mag}, {alt}° above the horizon",fr:"{name} — mag {mag}, {alt}° au-dessus de l'horizon"},mw={en:"{name} — satellite, mag {mag}, {height} km up",fr:"{name} — satellite, mag {mag}, à {height} km d'altitude"},gw="satellites-change",vw={en:"{name} — mag {mag}, {alt}° below the horizontal",fr:"{name} — mag {mag}, {alt}° sous l'horizontale"},Cp="comet:",Pp="nova:",Mw={building:{en:"Building",fr:"Bâtiment"},tree:{en:"Tree",fr:"Arbre"},crop:{en:"Crop row",fr:"Rang de culture"},mound:{en:"Stone heap",fr:"Tas de pierres"},streetlight:{en:"Streetlight",fr:"Lampadaire"},vehicle:{en:"Vehicle",fr:"Véhicule"},witness:{en:"Witness",fr:"Témoin"},aircraft:{en:"Aircraft",fr:"Aéronef"},entity:{en:"Being",fr:"Être"}},xw=new URL(""+new URL("stars-mag7.5-B43R6Wvg.bin",import.meta.url).href,import.meta.url).href,_w=new URL(""+new URL("stars-mag7.5-9-BLV2tFmZ.bin",import.meta.url).href,import.meta.url).href,yw=-18,Sw={sun:{altitudeDeg:-3,azimuthDeg:180,magnitude:-26.7},moon:{altitudeDeg:-90,azimuthDeg:0,phase:{phaseFraction:0,illuminatedFraction:0},magnitude:-12.7},planets:[]},hh={lat:0,lng:0,elevationM:0,headingDeg:void 0,pitchDeg:0,fovDeg:60};class xd extends HTMLElement{static get observedAttributes(){return["src","star-catalog-src","deep-star-catalog-src","show-compass","max-pixel-ratio",Pr,Ir]}shadow;stageElement;frameElement;sceneCanvas;ufoElement;sceneRenderer;hoverTooltip;resizeObserver;sizeEstimates=new Map;sizeEstimatesFor;distanceHypotheses=new Map;depths=new Map;directionScratch=new C;meteorScheduleFor;lightningScheduleFor;lightningFlashes=[];lastLightningT;lastTimeMs=0;lastSkyKey;starCatalog;starCatalogRequest=0;static tleArchive=new un;satellitesFor;satelliteRequest=0;satelliteStatus="none";satellites;satellitePassesMemo;starCatalogDepth=0;weatherAudio=new aw;animateWhilePausedValue=!1;set animateWhilePaused(e){e!==this.animateWhilePausedValue&&(this.animateWhilePausedValue=e,this.syncAnimationsToPlayback())}get animateWhilePaused(){return this.animateWhilePausedValue}thunderTimeoutId;handleFullscreenChange=()=>this.resizeToStage();handlePointerMove=e=>{this.sceneRenderer.setCompassHovered(!0);const t=this.ufoElement.canvasElement,n=t.getBoundingClientRect();if(n.width===0||n.height===0)return;const i=(e.clientX-n.left)/n.width*t.width,r=(e.clientY-n.top)/n.height*t.height;if(this.ufoElement.hasVisibleShapeAt(i,r)){this.hoverTooltip.hidden=!0;return}const a=(e.clientX-n.left)/n.width*2-1,o=-((e.clientY-n.top)/n.height*2-1),c=ku(fc.preferencesFor(this),fw),l=this.sceneRenderer.pickBodyAt(a,o);if(l){this.showHoverTooltip(e,this.bodyName(l,c));return}const h=this.sceneRenderer.pickDecorAt(a,o),u=h?this.ufoElement.sighting.decor.find(p=>p.id===h):void 0;if(u){this.showHoverTooltip(e,this.said.read(u.title)||Mw[u.kind][c]);return}const d=this.sceneRenderer.pickSatelliteAt(a,o);if(d){this.showHoverTooltip(e,mw[c].replace("{name}",d.name).replace("{mag}",d.magnitude.toLocaleString(void 0,{maximumFractionDigits:1})).replace("{height}",Math.round(d.heightKm).toLocaleString()));return}const f=this.sceneRenderer.pickStarAt(a,o);if(f){const p=f.star.mag,v=f.altitudeDeg,m=(v<0?vw:pw)[c];this.showHoverTooltip(e,m.replace("{name}",f.star.name[c]).replace("{mag}",p.toLocaleString(void 0,{maximumFractionDigits:Math.abs(p)<1?2:1})).replace("{alt}",String(Math.round(Math.abs(v)))));return}this.hoverTooltip.hidden=!0};bodyName(e,t){const n=e.startsWith(Cp)?e.slice(Cp.length):void 0,i=n?dg.find(a=>a.id===n):void 0,r=e.startsWith(Pp)?Tp.byId(e.slice(Pp.length)):void 0;return i?.name[t]??r?.name[t]??dw[e]?.[t]??e}showHoverTooltip(e,t){this.hoverTooltip.textContent=t,this.hoverTooltip.hidden=!1;const n=this.stageElement.getBoundingClientRect();this.hoverTooltip.style.left=`${e.clientX-n.left+12}px`,this.hoverTooltip.style.top=`${e.clientY-n.top+12}px`}handlePointerLeave=()=>{this.hoverTooltip.hidden=!0,this.sceneRenderer.setCompassHovered(!1)};handleLightningFlash(e){clearTimeout(this.thunderTimeoutId),this.thunderTimeoutId=window.setTimeout(()=>this.weatherAudio.playThunder(),Wt.thunderDelayMs(e))}handleFirstInteraction=()=>{this.removeEventListener("pointerdown",this.handleFirstInteraction,!0),this.removeEventListener("keydown",this.handleFirstInteraction,!0),this.weatherAudio.resume(),this.setWeather(js(this.ufoElement.sighting,this.lastTimeMs))};handleTimeUpdate=e=>{this.lastTimeMs=e.detail.time,this.syncAnimationsToPlayback(),this.updateAstronomy(this.lastTimeMs),this.ufoElement.playbackState==="playing"&&this.sceneRenderer.frame(performance.now())};syncAnimationsToPlayback(){const e=this.ufoElement.playbackState==="playing",t=e||this.animateWhilePaused;this.sceneRenderer.setAnimationsRunning(t,e),this.weatherAudio.setPaused(!t),t||clearTimeout(this.thunderTimeoutId)}constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${bg}</style>${Sg}`,this.shadow.appendChild(e.content.cloneNode(!0)),this.stageElement=this.shadow.getElementById("stage"),this.frameElement=this.shadow.getElementById("frame"),this.sceneCanvas=this.shadow.getElementById("scene-canvas"),this.sceneRenderer=new Hn(this.sceneCanvas),this.hoverTooltip=this.shadow.getElementById("hover-tooltip"),this.ufoElement=document.createElement(fh),this.ufoElement.classList.add("ufo-overlay"),this.ufoElement.paintsShapes=!1,this.forwardPlayerAttributes(),this.ufoElement.addEventListener("lookat",t=>this.lookToward(t.detail)),this.ufoElement.style.setProperty("--ufo-canvas-background","transparent"),this.ufoElement.style.setProperty("--ufo-canvas-border","none"),this.ufoElement.fullscreenTarget=this.stageElement,this.shadow.getElementById("ufo-slot").replaceWith(this.ufoElement),this.sceneRenderer.onMapSubjectBounds=t=>this.ufoElement.setMapSubjectBounds(t),this.ufoElement.addEventListener("timeupdate",this.handleTimeUpdate),this.ufoElement.addEventListener("referenceview",t=>this.applyReferenceView(t.detail)),this.ufoElement.canvasElement.addEventListener("pointermove",this.handlePointerMove),this.ufoElement.canvasElement.addEventListener("pointerleave",this.handlePointerLeave),this.addEventListener("pointerdown",this.handleFirstInteraction,!0),this.addEventListener("keydown",this.handleFirstInteraction,!0)}get said(){return this.saidTexts??=new us(fc.preferencesFor(this))}saidTexts;connectedCallback(){this.saidTexts=void 0,this.sceneRenderer.restoreContext(),this.resizeToStage(),this.updateAstronomy(this.lastTimeMs),this.loadStars(),this.resizeObserver=new ResizeObserver(()=>this.resizeToStage()),this.resizeObserver.observe(this.frameElement),document.addEventListener("fullscreenchange",this.handleFullscreenChange);const e=this.getAttribute("src");e&&this.loadFromSrc(e)}disconnectedCallback(){this.resizeObserver?.disconnect(),document.removeEventListener("fullscreenchange",this.handleFullscreenChange),this.sceneRenderer.stopTwinkle(),clearTimeout(this.thunderTimeoutId),this.weatherAudio.dispose(),queueMicrotask(()=>{this.isConnected||this.sceneRenderer.releaseContext()})}attributeChangedCallback(e,t,n){if(e==="src"&&n&&n!==t&&this.isConnected&&this.loadFromSrc(n),(e==="star-catalog-src"||e==="deep-star-catalog-src")&&n!==t&&this.isConnected&&this.loadStars(),e==="show-compass"&&n!==t&&this.sceneRenderer.setShowCompass(this.hasAttribute("show-compass")),e==="max-pixel-ratio"&&n!==t){const i=Number(n);this.sceneRenderer.setMaxPixelRatio(Number.isFinite(i)&&i>0?i:Math.min(window.devicePixelRatio||1,2))}(e===Pr||e===Ir)&&n!==t&&this.forwardPlayerAttributes()}forwardPlayerAttributes(){for(const e of[Pr,Ir])this.ufoElement.toggleAttribute(e,this.hasAttribute(e))}setCompassForced(e){this.sceneRenderer.setCompassForced(e)}lookToward(e){const t=Qt(this.ufoElement.sighting,this.lastTimeMs);if(e.kind==="witness"||t?.lat===void 0||t.lng===void 0||t.headingDeg===void 0){this.setLookOffset(0,0);return}const{x:n,z:i}=rn(e.lat,e.lng,t.lat,t.lng);if(Math.hypot(n,i)<1)return this.setLookOffset(0,0);const r=(Math.atan2(n,-i)*180/Math.PI+360)%360;this.setLookOffset(((r-t.headingDeg)%360+540)%360-180,-t.pitchDeg)}setLookOffset(e,t){this.sceneRenderer.setLookOffset(e,t),this.ufoElement.setLookOffset(e,t),this.updateAstronomy(this.lastTimeMs)}setIndoorLook(e,t){this.sceneRenderer.setIndoorLook(e,t)}setCloudRendering(e){this.sceneRenderer.setCloudRendering(e)}setWeather(e){this.sceneRenderer.setWeather(e),this.weatherAudio.setAmbient(e.precipitationType,e.precipitationIntensity,e.windSpeed)}pickCloudAt(e,t){return this.sceneRenderer.pickCloudAt(e,t)}cloudDirectionAt(e,t){return this.sceneRenderer.cloudDirectionAt(e,t)}pickDecorAt(e,t){return this.sceneRenderer.pickDecorAt(e,t)}resumeWeatherAudio(){this.weatherAudio.resume()}async loadFromSrc(e){this.sightingData=await Op.json(e)}get sightingData(){return this.ufoElement.sightingData}set sightingData(e){this.ufoElement.sightingData=e,this.applyFrameFormat(),this.lastTimeMs=0,this.sceneRenderer.compileNextFrameOffThread(),this.updateAstronomy(0)}referenceAspect(e){return this.sceneRenderer.referenceAspect(e)}screenPointOf(e){return this.sceneRenderer.screenPointOf(e)}directionAt(e,t){return this.sceneRenderer.directionAt(e,t)}referenceFailedToLoad(e){return this.sceneRenderer.referenceFailedToLoad(e)}applyReferenceView(e){this.sceneRenderer.setReferencesShown(e.shown);for(const t of this.ufoElement.sighting.references)this.sceneRenderer.setReferenceView(t.id,{opacity:e.opacity})}get currentTerrainAttribution(){return this.sceneRenderer.currentTerrainAttribution}setTerrainProviders(e){this.sceneRenderer.setTerrainProviders(e)}setDecorModelProvider(e){this.sceneRenderer.setDecorModelProvider(e)}get decorModelCredits(){return this.sceneRenderer.currentDecorModelCredits}applyFrameFormat(){const e=this.ufoElement.sighting.instrument,t=mt.CANVAS_HEIGHT_PX,n=Vt.frameWidthPx(e,t);this.frameElement.style.setProperty("--frame-aspect",`${n} / ${t}`)}resizeToStage(){const e=this.frameElement.getBoundingClientRect(),t=Math.max(1,Math.round(e.width)),n=Math.max(1,Math.round(e.height));this.sceneCanvas.width=t,this.sceneCanvas.height=n,this.sceneRenderer.resize(t,n)}async loadStars(){const e=[{magnitudeLimit:ah,url:this.getAttribute("star-catalog-src")??xw},{magnitudeLimit:oh,url:this.getAttribute("deep-star-catalog-src")??_w}],t=this.instrumentReach(),n=++this.starCatalogRequest;this.starCatalogDepth=t>ah?oh:ah;const i=await vi.upTo(e,t);n===this.starCatalogRequest&&(this.starCatalog=i,this.sceneRenderer.compileNextFrameOffThread(),this.updateAstronomy(this.lastTimeMs))}ensureStarsDeepEnough(){!this.starCatalog||this.starCatalogDepth>=oh||this.instrumentReach()<=this.starCatalogDepth||this.loadStars()}instrumentReach(){const e=this.ufoElement.sighting,t=vn.gainFor(e.instrument,{fNumber:Qt(e,0)?.fNumber,fieldOfViewDeg:Vn.fovOf(e,0),exposureSeconds:e.exposure});return du(yw,t)}updateAstronomy(e){this.ensureStarsDeepEnough(),this.applySceneAt(e);const t=Qn.windowEndingAt(e,this.exposureSeconds()),n=t.seconds,i=this.degreesPerPixelAt(e),r=Bs.instants(n,i),a=Math.max(r,this.ufoElement.exposureTimes(e).length,Qn.instants(this.ufoElement.sighting.decor,Qt(this.ufoElement.sighting,e)?.elevationM??0,t.fromMs,n,i));if(a<=1){this.sceneRenderer.setExposure(1);return}this.sceneRenderer.setExposure(a,o=>this.applySceneAt(t.fromMs+t.ms*o/(a-1),{sky:Math.floor(o*r/a)!==Math.floor((o-1)*r/a),stepMs:t.ms/a}))}exposureSeconds(){return this.ufoElement.sighting.exposure??0}degreesPerPixelAt(e){const t=this.sceneCanvas.height;return t<=0?0:Vn.fovOf(this.ufoElement.sighting,e)/t}applySceneAt(e,t){const n=this.ufoElement.sighting;this.setWeather(js(n,e)),this.sceneRenderer.setInstrument(n.instrument),this.updateMeteorShower(n,e),this.updateLightning(n,e,t!==void 0),this.sceneRenderer.setDecor(n.decor),this.sceneRenderer.setReferences(n.references);const i=Qt(n,e),r=Qt(n,0),a=js(n,0),o=Object.fromEntries(hc(js(n,e)).map(w=>[w.id,Cd(e,n.weatherTrack,a,r,i,w.id)]));this.sceneRenderer.setCloudOffset(Cd(e,n.weatherTrack,a,r,i),o),this.sceneRenderer.setObserverPose(i??hh),this.sceneRenderer.setLensOptics(this.lensOpticsAt(e)),this.sceneRenderer.setInstrumentGain(vn.gainFor(n.instrument,{fNumber:i?.fNumber,fieldOfViewDeg:Vn.fovOf(n,e),exposureSeconds:n.exposure})),this.sceneRenderer.setGait(Gt.of(n)?.offsetAt(e)??Gt.STILL),this.sceneRenderer.updateDecorAnchoring(Qt(n,0),i,e),this.sceneRenderer.updateDecorLitState(e,t?.stepMs??0),this.sceneRenderer.setTerrainOrigin(i?.lat,i?.lng),this.pushPhenomenaAt(e);const c=i?.lat??hh.lat,l=i?.lng??hh.lng,h=Vo(n.event.time??{},l,n.event.utcOffsetHours),u={lat:c,lng:l,elevationM:i?.elevationM??0};if(this.pushSatellitesAt(h,e,u),t&&!t.sky)return;if(!h){this.sceneRenderer.setAstronomy(Sw);return}const d=new Date(h.getTime()+e),f=Math.max(1,Math.round(.25*this.degreesPerPixelAt(e)/Bs.DEG_PER_SECOND*1e3)),p=Math.max(1e-8,this.degreesPerPixelAt(e)*.1),v=`${Math.floor(d.getTime()/f)}|${Math.round(c/p)}|${Math.round(l/p)}|${Math.round(u.elevationM)}|${this.starCatalog?this.starCatalogDepth:0}`;if(v===this.lastSkyKey){this.sceneRenderer.render();return}this.lastSkyKey=v;const m={...Bl("Sun",d,u),magnitude:Hl("Sun",d)},g={...Bl("Moon",d,u),phase:hS(d),magnitude:Hl("Moon",d)},b=lS.map(w=>({body:w,position:Bl(w,d,u),magnitude:Hl(w,d)}));this.sceneRenderer.setAstronomy({sun:m,moon:g,planets:b,comet:this.cometAt(d,u),novae:Tp.appearancesAt(d,u).map(({outburst:w,position:_,magnitude:S})=>({id:w.id,position:_,magnitude:S})),stars:this.starCatalog?{catalog:this.starCatalog,date:d,observer:u}:void 0,frame:{date:d,observer:u}}),this.ufoElement.setSunAltitude(m.altitudeDeg)}pushSatellitesAt(e,t,n){if(this.ensureSatellites(e),!e||!this.satellites){this.sceneRenderer.setSatellites([]);return}const i=new Date(e.getTime()+t),r=[];for(const a of this.satellites.passes.positionsAt(i,n,-1))a.magnitude!==void 0&&r.push({norad:a.object.norad,name:a.object.name,position:{altitudeDeg:a.altitudeDeg,azimuthDeg:a.azimuthDeg},magnitude:a.magnitude,heightKm:a.heightKm});this.sceneRenderer.setSatellites(r)}ensureSatellites(e){const t=e?String(e.getTime()):"";if(t===this.satellitesFor)return;this.satellitesFor=t,this.satellites=void 0,this.satellitePassesMemo=void 0;const n=++this.satelliteRequest;if(!e){this.satelliteStatus="none";return}this.satelliteStatus="loading";const i=a=>{n===this.satelliteRequest&&(this.satelliteStatus=a,this.dispatchEvent(new CustomEvent(gw)))},r=xd.tleArchive;(async()=>{if(!await r.covers(e))return i("outside");const[a,o]=await Promise.all([r.at(e),lc(()=>import("./SatellitePasses-Pfro2-0Z.js"),[],import.meta.url)]);if(n===this.satelliteRequest){if(!a)return i("unavailable");this.satellites={snapshot:a,passes:new o.SatellitePasses(a.objects)},i("ready"),this.updateAstronomy(this.lastTimeMs)}})().catch(()=>i("unavailable"))}get satelliteState(){const e=this.satellites?.snapshot;return{status:this.satelliteStatus,coverage:e?.coverage,credit:e?.credit,creditUrl:e?.creditUrl}}satellitePassesDuring(e){const t=this.satellites,n=this.ufoElement.sighting,i=Qt(n,0),r=n.event.place?.[0],a=i?.lat??r?.lat,o=i?.lng??r?.lng;if(!t||a===void 0||o===void 0)return[];const c=Vo(n.event.time??{},o,n.event.utcOffsetHours);if(!c)return[];const l=Math.min(Math.max(e,0),4*36e5),h={lat:a,lng:o,elevationM:i?.elevationM??0},u=JSON.stringify([this.satellitesFor,c.getTime(),a,o,h.elevationM,l]);if(this.satellitePassesMemo?.key===u)return this.satellitePassesMemo.passes;const d=Math.max(10,Math.ceil(l/1e3/600)),f=t.passes.passesDuring(c,new Date(c.getTime()+l),h,d);return this.satellitePassesMemo={key:u,passes:f},f}cometAt(e,t){const n=ow.brightestAt(e,t);if(n)return{id:n.apparition.id,position:n.position,tailEnd:n.tailEnd,magnitude:n.magnitude}}pushPhenomenaAt(e){const t=this.ufoElement.sighting;t!==this.sizeEstimatesFor&&(this.sizeEstimates.clear(),this.distanceHypotheses.clear(),this.sizeEstimatesFor=t);const n=t.timeline,i=this.ufoElement.canvasElement,r=this.ufoElement.frameShiftPx,a=this.projectionAt(e),o=new Map,c=new Map,l=new Set;for(const p of n.sourceIds){const v=n.getInterpolatedShapeAt(e,p);if(!v)continue;const m={...v,bounds:{...v.bounds,x:v.bounds.x+r.x,y:v.bounds.y+r.y}};o.set(p,m);const g=v.aim?this.sceneRenderer.screenPointOf(jn.directionOf(v.aim,this.directionScratch)):{ndcX:(m.bounds.x+m.bounds.width/2)/i.width*2-1,ndcY:-((m.bounds.y+m.bounds.height/2)/i.height*2-1)},b=g!==void 0&&Math.abs(g.ndcX)<=1&&Math.abs(g.ndcY)<=1,w=b?this.sceneRenderer.decorDistancesAt(g.ndcX,g.ndcY,p):{};l.add(p),(b||v.aim)&&l.delete(p);const _=v.angular?.widthDeg??a.pxToDeg(v.bounds.width),S=this.sizeEstimateOf(p);S.add(_,w);const E=Ia.of(t,p);c.set(p,gn.resolve({hypothesisM:this.distanceHypotheses.get(p),derivedM:E&&_>0?mt.distanceMAt(E.widthM,_):void 0,range:S.distanceRangeAt(_),crossing:w}))}for(const[p,v]of o)for(const[m,g]of o){if(m===p||g.transparency>=1||g.bounds.width*g.bounds.height<=v.bounds.width*v.bounds.height||!(v.bounds.x>=g.bounds.x&&v.bounds.y>=g.bounds.y&&v.bounds.x+v.bounds.width<=g.bounds.x+g.bounds.width&&v.bounds.y+v.bounds.height<=g.bounds.y+g.bounds.height))continue;const w=c.get(m);w&&c.set(p,{distanceM:w.distanceM*.999,basis:w.basis});break}this.depths=c;const h=n.sourceIds,u=[];for(const[p,v]of o)u.push({sourceId:p,shape:v,distanceM:c.get(p).distanceM,renderOrder:h.indexOf(p),aim:v.aim,hidden:l.has(p)});const f=(Qt(t,e)?.rollDeg??0)+(Gt.of(t)?.offsetAt(e)??Gt.STILL).rollDeg;this.sceneRenderer.setPhenomena(u,{projection:a,canvasWidthPx:i.width,canvasHeightPx:i.height,scale:Math.max(1,this.sceneCanvas.height/Math.max(1,i.height)),starPoints:Vt.starPointsOf(t.instrument),rollRad:f*Math.PI/180})}setDistanceHypothesis(e,t){t===void 0||!(t>0)?this.distanceHypotheses.delete(e):this.distanceHypotheses.set(e,t),this.updateAstronomy(this.lastTimeMs)}depthOf(e){return this.depths.get(e)}sizeRangeOf(e){return this.sizeEstimateOf(e).sizeRange}distanceRangeAt(e,t){const n=this.ufoElement.sighting.timeline.getInterpolatedShapeAt(t,e);if(!n)return{};const i=n.angular?.widthDeg??this.projectionAt(t).pxToDeg(n.bounds.width);return this.sizeEstimateOf(e).distanceRangeAt(i)}sizeContradictory(e){return this.sizeEstimateOf(e).contradictory}updateMeteorShower(e,t){this.ensureMeteorSchedule(e),this.sceneRenderer.updateMeteors(t)}updateLightning(e,t,n){if(this.ensureLightningSchedule(e),this.sceneRenderer.updateLightning(t),n)return;const i=this.lastLightningT;if(this.lastLightningT=t,i===void 0||t<i||this.ufoElement.playbackState!=="playing")return;const r=this.lightningFlashes.filter(a=>a.t>i&&a.t<=t).pop();r&&js(e,r.t).storm&&this.handleLightningFlash(r)}ensureLightningSchedule(e){const t=js(e,0).precipitationIntensity,n=`${this.meteorInputsOf(e)}|${t}`;if(n===this.lightningScheduleFor)return;this.lightningScheduleFor=n;const i=e.event.time,r=e.event.place?.[0],a=i?.year!==void 0?Vo(i,r?.lng??0,e.event.utcOffsetHours):void 0,o=(e.event.durationSeconds??0)*1e3||e.timeline.duration||2e4,c=Math.round((a?.getTime()??0)/1e3)+Math.round((r?.lat??0)*1e3)+7;this.lightningFlashes=Wt.schedule({durationMs:o,seed:c,intensity:t}),this.sceneRenderer.setLightning(this.lightningFlashes)}ensureMeteorSchedule(e){const t=this.meteorInputsOf(e);t!==this.meteorScheduleFor&&(this.meteorScheduleFor=t,this.scheduleMeteors(e))}meteorInputsOf(e){const t=e.event.place?.[0],n=e.event.time;return JSON.stringify([t?.lat,t?.lng,n?.year,n?.month,n?.day,n?.hour,n?.minute,n?.second,e.event.utcOffsetHours,e.event.durationSeconds,e.timeline.duration])}scheduleMeteors(e){const t=e.event.place?.[0],n=e.event.time,i=t?.lat!==void 0&&t.lng!==void 0&&n?.year!==void 0?Vo(n,t.lng,e.event.utcOffsetHours):void 0;if(!i||t?.lat===void 0||t.lng===void 0){this.sceneRenderer.setMeteorShower([],0,0);return}const r={lat:t.lat,lng:t.lng,elevationM:0},a=(e.event.durationSeconds??0)*1e3||e.timeline.duration||2e4,o=Math.round(i.getTime()/1e3)+Math.round(t.lat*1e3),c=Lt.schedule({ratePerHour:Lt.observedRatePerHour(Lt.apexPosition(i,r).altitudeDeg),durationMs:a,velocityKmS:Lt.TYPICAL_VELOCITY_KM_S,seed:o}),l=lh.activeAt(i).map(u=>{const d=lh.radiantPosition(u.shower,i,r);return{entry:u,position:d,rate:lh.observedRatePerHour(u.zhr,d.altitudeDeg,u.shower.populationIndex)}}).sort((u,d)=>d.rate-u.rate)[0];if(!l||l.rate<=0){this.sceneRenderer.setMeteorShower(c,0,0);return}const h=zs.schedule({ratePerHour:l.rate,durationMs:a,velocityKmS:l.entry.shower.velocityKmS,seed:o+1});this.sceneRenderer.setMeteorShower([...h,...c],l.position.altitudeDeg,l.position.azimuthDeg)}meteorByRank(e){this.ensureMeteorSchedule(this.ufoElement.sighting);const t=[...this.sceneRenderer.meteorSchedule].filter(r=>r.t+r.durationMs<=this.ufoElement.seekableDuration).sort((r,a)=>a.brightness-r.brightness);if(t.length===0)return;const n=t[e%t.length],i=this.sceneRenderer.meteorMidpoint(n);if(i)return{t:Math.round(n.t+n.durationMs*.45),...i}}lensOpticsAt(e){const t=this.ufoElement.sighting,n=t.instrument,i=n.frame,r=Qt(t,e),a=r?.fNumber??n.fNumber;if(!i||a===void 0)return;const o=Vt.focalLengthMmFor(n,Vn.fovOf(t,e));if(o!==void 0)return{focalLengthMm:o,fNumber:a,focusDistance:r?.focusDistanceM??0,frameHeightMm:i.heightMm}}projectionAt(e){const t=this.ufoElement.sighting;return Gi.of(t.instrument,mt.CANVAS_HEIGHT_PX,Vn.fovOf(t,e))}sizeEstimateOf(e){let t=this.sizeEstimates.get(e);return t||(t=new lw,this.sizeEstimates.set(e,t)),t}}const Ip="rr0-scene";function bw(){qp(),customElements.get(Ip)||customElements.define(Ip,xd)}bw();export{q2 as $,Rw as A,tt as B,oe as C,Y0 as D,Ge as E,Nw as F,Cw as G,pm as H,Dw as I,Pw as J,Ra as K,$a as L,Iw as M,ao as N,xt as O,wv as P,_s as Q,ka as R,An as S,ww as T,en as U,Pe as V,Tn as W,Tw as X,Ys as Y,fm as Z,Lw as _,Aw as a,gc as a0,eu as a1,Sc as a2,nn as a3,xm as a4,nd as a5,id as a6,je as a7,Ms as a8,Ka as a9,ai as aa,Yi as ab,Ew as b,Fw as c,Mc as d,Uw as e,Xe as f,C as g,P0 as h,Ow as i,kw as j,G2 as k,Os as l,Qc as m,Y1 as n,gt as o,Xt as p,bh as q,xn as r,ed as s,Ki as t,j2 as u,rv as v,ti as w,qn as x,lt as y,Mt as z};