@korial29/tiny-fps 1.18.0 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/room.js CHANGED
@@ -1 +1 @@
1
- export { n as MAPS, r as RULES, t as Room } from "./assets/room-84qRjTTp.js";
1
+ export { n as MAPS, r as RULES, t as Room } from "./assets/room-DYc9HfDS.js";
package/dist/server.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Room } from "./assets/room-84qRjTTp.js";
1
+ import { t as Room } from "./assets/room-DYc9HfDS.js";
2
2
  import { WebSocketServer } from "ws";
3
3
  // src/server/index.ts
4
4
  /** `/demo` → "demo", `/` → "default". Undecodable paths are kept as is. */
@@ -1 +1 @@
1
- import{$ as e,et as t,pr as n,r}from"./brick-Ba93nQNN.js";var i=e=>(e=Math.min(Math.max(e,0),1))*e*(3-2*e),a=[1,2,3,4,6].map(e=>{let n=(1+Math.sqrt(5))/2,r=[[-1,n,0],[1,n,0],[-1,-n,0],[1,-n,0],[0,-1,n],[0,1,n],[0,-1,-n],[0,1,-n],[n,0,-1],[n,0,1],[-n,0,-1],[-n,0,1]].map(e=>t(e));return[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]].map(e=>e.map(e=>r[e])).flatMap(([n,r,i])=>{let a=(a,o)=>t(n.map((t,n)=>t+((r[n]-t)*a+(i[n]-t)*o)/e)),o=[];for(let t=0;t<e;t++)for(let n=0;t+n<e;n++)o.push([a(t,n),a(t+1,n),a(t,n+1)]),t+n<e-1&&o.push([a(t+1,n),a(t+1,n+1),a(t,n+1)]);return o})}),o=(o,s,c,l,u,d,f,p)=>{let m=/* @__PURE__ */ new Map,h=(typeof s==`number`?a[s-1]:s).map(e=>e.map(e=>{let t=(e=>e.map(e=>Math.round(1e4*e)).join())(e),n=m.get(t);if(!n){let r=c(e);n={p:r,n:[0,0,0],low:!!p&&r[1]<p(r[0],r[2])-.05},m.set(t,n)}return n}));for(let t of h){let n=r(e(t[1].p,t[0].p),e(t[2].p,t[0].p));t.forEach(e=>e.n=[e.n[0]+n[0],e.n[1]+n[1],e.n[2]+n[2]])}for(let a of h){if(a.every(e=>e.low))continue;let s=r(e(a[1].p,a[0].p),e(a[2].p,a[0].p)),c=Math.abs(s[1])>Math.max(Math.abs(s[0]),Math.abs(s[2])),p=Math.abs(s[0])>Math.abs(s[2]);for(let{p:e,n:r}of a){let a=Math.hypot(...r)>1e-12?t(r):[0,1,0];o.push(...e,...a,...c?[e[0],e[2]]:p?[e[2]+3*d,e[1]]:[e[0]+3*d,e[1]],n.ROCK,.85*f*(.55+.45*i((e[1]-l)/(.3*(u-l)))))}}};export{o as t};
1
+ import{$ as e,et as t,gr as n,r}from"./brick-mdI4ov5M.js";var i=e=>(e=Math.min(Math.max(e,0),1))*e*(3-2*e),a=[1,2,3,4,6].map(e=>{let n=(1+Math.sqrt(5))/2,r=[[-1,n,0],[1,n,0],[-1,-n,0],[1,-n,0],[0,-1,n],[0,1,n],[0,-1,-n],[0,1,-n],[n,0,-1],[n,0,1],[-n,0,-1],[-n,0,1]].map(e=>t(e));return[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]].map(e=>e.map(e=>r[e])).flatMap(([n,r,i])=>{let a=(a,o)=>t(n.map((t,n)=>t+((r[n]-t)*a+(i[n]-t)*o)/e)),o=[];for(let t=0;t<e;t++)for(let n=0;t+n<e;n++)o.push([a(t,n),a(t+1,n),a(t,n+1)]),t+n<e-1&&o.push([a(t+1,n),a(t+1,n+1),a(t,n+1)]);return o})}),o=(o,s,c,l,u,d,f,p)=>{let m=/* @__PURE__ */ new Map,h=(typeof s==`number`?a[s-1]:s).map(e=>e.map(e=>{let t=(e=>e.map(e=>Math.round(1e4*e)).join())(e),n=m.get(t);if(!n){let r=c(e);n={p:r,n:[0,0,0],low:!!p&&r[1]<p(r[0],r[2])-.05},m.set(t,n)}return n}));for(let t of h){let n=r(e(t[1].p,t[0].p),e(t[2].p,t[0].p));t.forEach(e=>e.n=[e.n[0]+n[0],e.n[1]+n[1],e.n[2]+n[2]])}for(let a of h){if(a.every(e=>e.low))continue;let s=r(e(a[1].p,a[0].p),e(a[2].p,a[0].p)),c=Math.abs(s[1])>Math.max(Math.abs(s[0]),Math.abs(s[2])),p=Math.abs(s[0])>Math.abs(s[2]);for(let{p:e,n:r}of a){let a=Math.hypot(...r)>1e-12?t(r):[0,1,0];o.push(...e,...a,...c?[e[0],e[2]]:p?[e[2]+3*d,e[1]]:[e[0]+3*d,e[1]],n.ROCK,.85*f*(.55+.45*i((e[1]-l)/(.3*(u-l)))))}}};export{o as t};
@@ -1 +1 @@
1
- import{pr as e}from"./brick-Ba93nQNN.js";var t,n=Object.keys(e).length,r=(e,t,n)=>{let r=Math.imul(e,374761393)+Math.imul(t,668265263)+Math.imul(n,144665)|0;return r=Math.imul(r^r>>>13,1274126177),((r^r>>>16)>>>0)/4294967296},i=(e,t,n,i)=>{let[a,o]=[Math.floor(e),Math.floor(t)],[s,c]=[e-a,t-o].map(e=>e*e*(3-2*e)),l=(e,t)=>r((a+e)%n,(o+t)%n,i);return(l(0,0)*(1-s)+l(1,0)*s)*(1-c)+(l(0,1)*(1-s)+l(1,1)*s)*c},a=(e,t,n,r,a)=>{let[o,s]=[0,.5];for(let c=0;c<r;c++,s/=2)o+=s*i(e*(1<<c),t*(1<<c),n<<c,a+c);return o/(1-2*s)},o=(e,t,n)=>e.map((e,r)=>e+(t[r]-e)*n),s=(e,t)=>e.map(e=>e*t),c=e=>Math.min(Math.max(e,0),1),l=2*Math.PI,u=[];u[e.BRICK]=(e,t)=>{let n=Math.floor(8*t),a=4*e+.5*(1&n),[o,l,u]=[Math.floor(a)%4,a%1,8*t%1],d=i(16*e,16*t,16,5),f=.8+.4*d;return l<.05||u<.1?[s([165,160,150],.7+.3*f),.1+.1*d]:[s([170,78,56],(.8+.4*r(o,n,1))*f*(.85+.15*u)),.7+.2*d+.1*c(12*Math.min(l-.05,u-.1))]},u[e.TILE]=(e,t)=>{let[n,a]=[Math.floor(4*e),Math.floor(4*t)],[o,l]=[4*e%1,4*t%1],u=i(16*e,16*t,16,7),d=.9+.2*u;return o<.05||l<.05?[s([85,85,80],d),.1]:[s([196,190,172],d*(.88+.08*(n+a&1)+.1*r(n,a,2))),.8+.1*u+.1*c(14*(Math.min(o,l)-.05))]},u[e.LAVA]=(e,t)=>{let n=a(4*e,4*t,4,4,11),r=Math.max(0,1-7*Math.abs(n-.5))**2;return[o(o([55,8,4],[230,70,8],n),[255,215,90],r),.5]},u[e.STONE]=(e,t)=>{let n=a(8*e,8*t,8,4,3);return[s([128,124,120],.45+.7*(1.3*n+.1*r(Math.floor(128*e),Math.floor(128*t),4))),c(1.4*n-.2)]},u[e.METAL]=(e,t)=>{let[n,a,l,u]=[Math.floor(2*e),Math.floor(2*t),2*e%1,2*t%1],d=c(6*(i(8*e,8*t,8,13)-.68)),f=e=>.4*Math.min(Math.max(Math.round((e-.1)/.4),0),2)+.1,[p,m]=[f(l),f(u)],h=p==m&&p==.5?1:Math.hypot(l-p,u-m),g=c(1-h/.07),_=s([98,108,124],(.9+.2*i(32*e,32*t,32,9)+.12*r(n,a,6))*(1+.3*g)*(.65+.35*c((h-.06)/.04)));return Math.min(l,u,1-l,1-u)<.03?[s([40,44,50],1+d),.05]:[o(_,[105,68,45],.7*d),.5+.1*(1-d)+.4*g]},u[e.WOOD]=(e,t)=>{let n=Math.floor(8*t),a=2*e+2*r(n,0,8),[s,u,d]=[Math.floor(a)%2,a%1,8*t%1],f=r(n,s,3),p=.5+.5*Math.sin(l*(40*t+2.5*i(4*e,4*t,4,21)+7*f));return d<.08||u<.015?[[28,18,10],.05]:[o([92,58,32],[158,106,62],.6*p+.35*f),.7+.15*p+.15*c(15*(d-.08))]},u[e.MOSS]=(e,t)=>{let n=Math.floor(4*t),l=2*e+.5*(1&n),[u,d,f]=[Math.floor(l)%2,l%1,4*t%1],p=Math.min(d,1-d,.5*(f<.5?f:1-f)),m=d<.04||f<.06,h=c(12*(.3*a(12*e,12*t,12,3,17)-.03-p)),g=i(64*e,64*t,64,19),_=s([128,126,118],(.7+.4*r(u,n,5))*(.7+.5*i(16*e,16*t,16,15)));return[o(m?s(_,.45):_,o([52,100,34],[96,148,56],g),h),m?.1+.6*h*g:.6+.2*c(30*p)+.2*h*g]},u[e.GRATE]=(e,t)=>{let[n,r]=[8*e%1,8*t%1],a=Math.max(Math.abs(n-.5),Math.abs(r-.5)),l=Math.min(Math.abs(n-.5),Math.abs(r-.5))>.43,u=i(16*e,16*t,16,23);return a<.36?[[9,9,12],0]:[s(o([104,108,116],[96,80,68],c(4*(u-.55))),(l?1.25:1)-2.2*(.5-a)+.2*u),l?1:.6+.4*c(12*(a-.36))]},u[e.CONCRETE]=(e,t)=>{let[n,i]=[2*e%1,2*t%1],o=a(4*e,4*t,4,3,41),c=r(Math.floor(128*e),Math.floor(128*t),43)>.992,l=Math.hypot(n%.5-.25,i%.5-.25)<.02,u=(.94+.1*o+.03*r(Math.floor(2*e),Math.floor(2*t),44))*(c||l?.9:1);return n<.015||i<.015?[s([160,164,172],u),.3]:[s([206,209,214],u),l?.5:.8+.2*o-(c?.15:0)]},u[e.GLASS]=(e,t)=>{let n=2*e%1,r=((n+.7*t)%1-.5)/.12,i=Math.exp(-r*r);return n<.03||t<.03?[s([150,158,170],1-.3*n),.9]:[o(o([7,20,44],[48,88,136],t**2),[120,160,200],.18*i),.4]},u[e.STEEL]=(e,t)=>{let n=Math.floor(128*t),a=.5*r(n,3,31)+.5*i(8*e,0,8,n+7),o=4*e%1;return o<.03?[[60,66,76],.1]:[s([176,184,196],.8+.35*a+(o>.97?.15:0)),.6+.2*a]},u[e.PAINT]=(e,t)=>{let[n,i]=[2*e%1,2*t%1],a=r(Math.floor(128*e),Math.floor(128*t),47);return n<.02||i<.02?[[200,200,206],.3]:[s([246,246,248],.96+.06*a),.85+.04*a]},u[e.ROCK]=(e,t)=>{let n=a(4*e,4*t,4,4,21),l=c(8*(i(2*e,2*t,2,24)-.55))*Math.max(0,1-110*Math.abs(a(2*e,2*t,2,3,23)-.5)),[u,d]=[Math.floor(64*e),Math.floor(64*t)],[f,p]=[64*e%1-.5,64*t%1-.5],m=r(u,d,25),h=m<.06?c(1-Math.hypot(f,p)/(.2+3*m)):0,g=m>.96?.35:0;return[o(o(o(s([84,82,79],.65+.6*n+.1*r(Math.floor(128*e),Math.floor(128*t),27)),[150,146,140],g),[30,29,28],.7*h),[26,25,24],.7*l),c(.35+.5*n-.3*h-.25*l)]},u[e.FABRIC]=(e,t)=>{let[n,i]=[Math.floor(128*e),Math.floor(128*t)],a=+((n+i)%4<2),o=r(n,i,51),[l,u]=[n%16-7.5,i%16-7.5],d=+(Math.abs(Math.abs(l)+Math.abs(u)-4)<1.2);return[s([232,232,236],.78+.1*a+.08*o+.2*d),c(.3+.45*a+.2*o)]},u[e.HIDE]=(e,t)=>{let[n,i]=[Math.floor(128*e),Math.floor(128*t)],o=r(n>>2,i>>2,53),l=3&n&&3&i?0:1,u=a(4*e,4*t,4,3,55),[d,f]=[n%64,i%64],p=d<2||f<2;return[s([228,226,224],p?.55:(.82+.1*o-.08*l)*(.9+.2*u)*(d==4&&(3&i)<2||f==4&&(3&n)<2?1.15:1)),p?.1:c(.35+.35*o-.2*l+.2*u)]},u[e.HULL]=(e,t)=>{let n=2*e%1,r=Math.min(n,t,1-n,1-t)-.008,o=.6*a(4*e,4*t,4,3,51)+.4*i(64*e,64*t,64,53);return r<0?[[70,74,82],.15]:[s([172,177,186],1.01-.06*c(100*r)+.06*(e>.5)+.05*o),.8+.04*o]};var d,f,p=()=>t??=m(),m=()=>{let e=new Uint8ClampedArray(128*n*128*4);return u.forEach((t,n)=>{for(let r=0;r<16384;r++){let[i,a]=t(r%128/128,Math.floor(r/128)/128);e.set([...i,255*a],4*(128*n*128+r))}}),e},[h,g]=[6,16],_=()=>{for(;v(););return d},v=()=>{if(d)return!1;let e=(f??=function*(){let e=h,t=e*g,n=3,r=Float64Array.from({length:e*e*e*3},()=>.1+.8*(n=16807*n%2147483647)/2147483647),i=new Uint8Array(t*t*t);for(let n=0;n<t;n++){n%8==7&&(yield);let a=(n+.5)/g,o=Math.floor(a);for(let s=0;s<t;s++){let c=(s+.5)/g,l=Math.floor(c);for(let u=0;u<t;u++){let d=(u+.5)/g,f=Math.floor(d),p=9,m=9;for(let t=o-1;t<=o+1;t++)for(let n=l-1;n<=l+1;n++)for(let i=f-1;i<=f+1;i++){let o=3*((i+e)%e+(n+e)%e*e+(t+e)%e*e*e),s=d-i-r[o],l=c-n-r[o+1],u=a-t-r[o+2],f=s*s+l*l+u*u;f<p?(m=p,p=f):f<m&&(m=f)}i[u+(s+n*t)*t]=255*Math.min(Math.sqrt(m)-Math.sqrt(p),1)}}}return i}()).next();return e.done&&([d,f]=[e.value,void 0]),!e.done};export{_ as a,r as i,h as n,v as o,g as r,p as s,n as t};
1
+ import{gr as e}from"./brick-mdI4ov5M.js";var t,n=Object.keys(e).length,r=(e,t,n)=>{let r=Math.imul(e,374761393)+Math.imul(t,668265263)+Math.imul(n,144665)|0;return r=Math.imul(r^r>>>13,1274126177),((r^r>>>16)>>>0)/4294967296},i=(e,t,n,i)=>{let[a,o]=[Math.floor(e),Math.floor(t)],[s,c]=[e-a,t-o].map(e=>e*e*(3-2*e)),l=(e,t)=>r((a+e)%n,(o+t)%n,i);return(l(0,0)*(1-s)+l(1,0)*s)*(1-c)+(l(0,1)*(1-s)+l(1,1)*s)*c},a=(e,t,n,r,a)=>{let[o,s]=[0,.5];for(let c=0;c<r;c++,s/=2)o+=s*i(e*(1<<c),t*(1<<c),n<<c,a+c);return o/(1-2*s)},o=(e,t,n)=>e.map((e,r)=>e+(t[r]-e)*n),s=(e,t)=>e.map(e=>e*t),c=e=>Math.min(Math.max(e,0),1),l=2*Math.PI,u=[];u[e.BRICK]=(e,t)=>{let n=Math.floor(8*t),a=4*e+.5*(1&n),[o,l,u]=[Math.floor(a)%4,a%1,8*t%1],d=i(16*e,16*t,16,5),f=.8+.4*d;return l<.05||u<.1?[s([165,160,150],.7+.3*f),.1+.1*d]:[s([170,78,56],(.8+.4*r(o,n,1))*f*(.85+.15*u)),.7+.2*d+.1*c(12*Math.min(l-.05,u-.1))]},u[e.TILE]=(e,t)=>{let[n,a]=[Math.floor(4*e),Math.floor(4*t)],[o,l]=[4*e%1,4*t%1],u=i(16*e,16*t,16,7),d=.9+.2*u;return o<.05||l<.05?[s([85,85,80],d),.1]:[s([196,190,172],d*(.88+.08*(n+a&1)+.1*r(n,a,2))),.8+.1*u+.1*c(14*(Math.min(o,l)-.05))]},u[e.LAVA]=(e,t)=>{let n=a(4*e,4*t,4,4,11),r=Math.max(0,1-7*Math.abs(n-.5))**2;return[o(o([55,8,4],[230,70,8],n),[255,215,90],r),.5]},u[e.STONE]=(e,t)=>{let n=a(8*e,8*t,8,4,3);return[s([128,124,120],.45+.7*(1.3*n+.1*r(Math.floor(128*e),Math.floor(128*t),4))),c(1.4*n-.2)]},u[e.METAL]=(e,t)=>{let[n,a,l,u]=[Math.floor(2*e),Math.floor(2*t),2*e%1,2*t%1],d=c(6*(i(8*e,8*t,8,13)-.68)),f=e=>.4*Math.min(Math.max(Math.round((e-.1)/.4),0),2)+.1,[p,m]=[f(l),f(u)],h=p==m&&p==.5?1:Math.hypot(l-p,u-m),g=c(1-h/.07),_=s([98,108,124],(.9+.2*i(32*e,32*t,32,9)+.12*r(n,a,6))*(1+.3*g)*(.65+.35*c((h-.06)/.04)));return Math.min(l,u,1-l,1-u)<.03?[s([40,44,50],1+d),.05]:[o(_,[105,68,45],.7*d),.5+.1*(1-d)+.4*g]},u[e.WOOD]=(e,t)=>{let n=Math.floor(8*t),a=2*e+2*r(n,0,8),[s,u,d]=[Math.floor(a)%2,a%1,8*t%1],f=r(n,s,3),p=.5+.5*Math.sin(l*(40*t+2.5*i(4*e,4*t,4,21)+7*f));return d<.08||u<.015?[[28,18,10],.05]:[o([92,58,32],[158,106,62],.6*p+.35*f),.7+.15*p+.15*c(15*(d-.08))]},u[e.MOSS]=(e,t)=>{let n=Math.floor(4*t),l=2*e+.5*(1&n),[u,d,f]=[Math.floor(l)%2,l%1,4*t%1],p=Math.min(d,1-d,.5*(f<.5?f:1-f)),m=d<.04||f<.06,h=c(12*(.3*a(12*e,12*t,12,3,17)-.03-p)),g=i(64*e,64*t,64,19),_=s([128,126,118],(.7+.4*r(u,n,5))*(.7+.5*i(16*e,16*t,16,15)));return[o(m?s(_,.45):_,o([52,100,34],[96,148,56],g),h),m?.1+.6*h*g:.6+.2*c(30*p)+.2*h*g]},u[e.GRATE]=(e,t)=>{let[n,r]=[8*e%1,8*t%1],a=Math.max(Math.abs(n-.5),Math.abs(r-.5)),l=Math.min(Math.abs(n-.5),Math.abs(r-.5))>.43,u=i(16*e,16*t,16,23);return a<.36?[[9,9,12],0]:[s(o([104,108,116],[96,80,68],c(4*(u-.55))),(l?1.25:1)-2.2*(.5-a)+.2*u),l?1:.6+.4*c(12*(a-.36))]},u[e.CONCRETE]=(e,t)=>{let[n,i]=[2*e%1,2*t%1],o=a(4*e,4*t,4,3,41),c=r(Math.floor(128*e),Math.floor(128*t),43)>.992,l=Math.hypot(n%.5-.25,i%.5-.25)<.02,u=(.94+.1*o+.03*r(Math.floor(2*e),Math.floor(2*t),44))*(c||l?.9:1);return n<.015||i<.015?[s([160,164,172],u),.3]:[s([206,209,214],u),l?.5:.8+.2*o-(c?.15:0)]},u[e.GLASS]=(e,t)=>{let n=2*e%1,r=((n+.7*t)%1-.5)/.12,i=Math.exp(-r*r);return n<.03||t<.03?[s([150,158,170],1-.3*n),.9]:[o(o([7,20,44],[48,88,136],t**2),[120,160,200],.18*i),.4]},u[e.STEEL]=(e,t)=>{let n=Math.floor(128*t),a=.5*r(n,3,31)+.5*i(8*e,0,8,n+7),o=4*e%1;return o<.03?[[60,66,76],.1]:[s([176,184,196],.8+.35*a+(o>.97?.15:0)),.6+.2*a]},u[e.PAINT]=(e,t)=>{let[n,i]=[2*e%1,2*t%1],a=r(Math.floor(128*e),Math.floor(128*t),47);return n<.02||i<.02?[[200,200,206],.3]:[s([246,246,248],.96+.06*a),.85+.04*a]},u[e.ROCK]=(e,t)=>{let n=a(4*e,4*t,4,4,21),l=c(8*(i(2*e,2*t,2,24)-.55))*Math.max(0,1-110*Math.abs(a(2*e,2*t,2,3,23)-.5)),[u,d]=[Math.floor(64*e),Math.floor(64*t)],[f,p]=[64*e%1-.5,64*t%1-.5],m=r(u,d,25),h=m<.06?c(1-Math.hypot(f,p)/(.2+3*m)):0,g=m>.96?.35:0;return[o(o(o(s([84,82,79],.65+.6*n+.1*r(Math.floor(128*e),Math.floor(128*t),27)),[150,146,140],g),[30,29,28],.7*h),[26,25,24],.7*l),c(.35+.5*n-.3*h-.25*l)]},u[e.FABRIC]=(e,t)=>{let[n,i]=[Math.floor(128*e),Math.floor(128*t)],a=+((n+i)%4<2),o=r(n,i,51),[l,u]=[n%16-7.5,i%16-7.5],d=+(Math.abs(Math.abs(l)+Math.abs(u)-4)<1.2);return[s([232,232,236],.78+.1*a+.08*o+.2*d),c(.3+.45*a+.2*o)]},u[e.HIDE]=(e,t)=>{let[n,i]=[Math.floor(128*e),Math.floor(128*t)],o=r(n>>2,i>>2,53),l=3&n&&3&i?0:1,u=a(4*e,4*t,4,3,55),[d,f]=[n%64,i%64],p=d<2||f<2;return[s([228,226,224],p?.55:(.82+.1*o-.08*l)*(.9+.2*u)*(d==4&&(3&i)<2||f==4&&(3&n)<2?1.15:1)),p?.1:c(.35+.35*o-.2*l+.2*u)]},u[e.HULL]=(e,t)=>{let n=2*e%1,r=Math.min(n,t,1-n,1-t)-.008,o=.6*a(4*e,4*t,4,3,51)+.4*i(64*e,64*t,64,53);return r<0?[[70,74,82],.15]:[s([172,177,186],1.01-.06*c(100*r)+.06*(e>.5)+.05*o),.8+.04*o]};var d,f,p=()=>t??=m(),m=()=>{let e=new Uint8ClampedArray(128*n*128*4);return u.forEach((t,n)=>{for(let r=0;r<16384;r++){let[i,a]=t(r%128/128,Math.floor(r/128)/128);e.set([...i,255*a],4*(128*n*128+r))}}),e},[h,g]=[6,16],_=()=>{for(;v(););return d},v=()=>{if(d)return!1;let e=(f??=function*(){let e=h,t=e*g,n=3,r=Float64Array.from({length:e*e*e*3},()=>.1+.8*(n=16807*n%2147483647)/2147483647),i=new Uint8Array(t*t*t);for(let n=0;n<t;n++){n%8==7&&(yield);let a=(n+.5)/g,o=Math.floor(a);for(let s=0;s<t;s++){let c=(s+.5)/g,l=Math.floor(c);for(let u=0;u<t;u++){let d=(u+.5)/g,f=Math.floor(d),p=9,m=9;for(let t=o-1;t<=o+1;t++)for(let n=l-1;n<=l+1;n++)for(let i=f-1;i<=f+1;i++){let o=3*((i+e)%e+(n+e)%e*e+(t+e)%e*e*e),s=d-i-r[o],l=c-n-r[o+1],u=a-t-r[o+2],f=s*s+l*l+u*u;f<p?(m=p,p=f):f<m&&(m=f)}i[u+(s+n*t)*t]=255*Math.min(Math.sqrt(m)-Math.sqrt(p),1)}}}return i}()).next();return e.done&&([d,f]=[e.value,void 0]),!e.done};export{_ as a,r as i,h as n,v as o,g as r,p as s,n as t};
@@ -0,0 +1 @@
1
+ import{$ as e,A as t,Bt as n,F as r,Ft as i,Gt as a,H as o,Ht as s,I as c,It as l,J as u,K as d,Kt as f,Pt as p,Q as m,Rt as h,Ut as g,Vt as _,Wt as v,X as y,Xt as b,Y as x,Z as S,a as C,an as w,cn as T,d as E,dn as ee,et as D,f as te,fn as O,gr as k,hn as A,i as j,in as ne,it as M,ln as re,mn as N,n as P,nt as ie,o as ae,on as oe,pn as se,pr as ce,q as F,qt as le,r as I,s as ue,sn as de,t as fe,tn as pe,un as me,zt as L}from"./brick-mdI4ov5M.js";import{i as R}from"./textures-lwIKyT9M.js";import{t as he}from"./stone-C0leigjc.js";var ge=[.8,.82,.86],_e=[.35,.36,.4],ve=w.filter(e=>e.min[1]===2.48&&e.max[1]===4),[z,B]=oe,ye=[z,0,B],V=22.4,be=[-.6,.6,.53],xe=[[2,1],[0,2],[0,1]],[Se,Ce]=[-2.35,-2.4],we=[1.25,1.3,1.4],Te=[.56,.48,.28],Ee=[.04,.04,.05],{CONCRETE:De,HULL:Oe,PAINT:ke}=k,[H,Ae,je,U,Me,Ne]=[[.86,.87,.9],[.55,.57,.6],[.32,.33,.36],[.07,.075,.085],[.42,.52,.66],[.2,.13,.08]],[Pe,W,Fe,Ie,Le,Re]=[[.3,.8,1],[.35,1,.5],[1,.7,.25],[1,.2,.15],[.7,.35,1],[1,.35,.85]],ze=(e,t,n,r=1,[i,a]=xe[1])=>{for(let o of[0,1,2,0,2,3])e.push(...t[o],...be),typeof n==`number`?e.push(t[o][i],t[o][a],n,r):e.push(n[0],n[1],-2,n[2])},G=(e,t,n,r,i,a,o)=>ze(e,[[0,0],[1,0],[1,1],[0,1]].map(([e,a])=>{let o=[0,0,0],[s,c]=[(t+1)%3,(t+2)%3];return[o[t],o[s],o[c]]=[n,(e?i:r)[s],(a?i:r)[c]],o}),a,o,xe[t]),Be=(e,{min:t,max:n,top:r,side:i},a=0)=>{for(let o=0;o<3;o++)G(e,o,t[o],t,n,i,a+(o==1?.4:1.25-.15*o)),G(e,o,n[o],t,n,o==1?r:i,a+(o==1?1.85:1.25-.15*o))},Ve=(e,t)=>{let n=e.length;t();let r=ie(e,0);for(let t=n;t<e.length;t+=10){if(r[t+8]==-1){let e=2.2*(.72+.28*r[t+4]-.12*Math.abs(r[t+3]));r[t+6]*=e,r[t+7]*=e,r[t+9]*=e}[r[t+3],r[t+4],r[t+5]]=be}},He=(e,t,n,r)=>{let i=ie(e,0);for(let a=t;a<e.length;a+=10)[i[a+3],i[a+4],i[a+5],i[a+8]]=[n[0],n[1],n[2],r]},Ue=(e,t,n,r,i,a)=>{for(let[o,s,c]of[[r,r+.1,0],[i-.1,i,0],[r,i,a-.1]])G(e,t,n,[o,c,o],[s,a,s],we)},We=(e,t,n,r,i,a,o,s=[])=>{[...s,[i,i,0]].forEach(([i,c,l],u)=>{let[d,f]=[[0,0,0],[0,a,0]];[d[2-t],f[2-t]]=[u?s[u-1][1]:r,i],G(e,t,n,d,f,ke,o),c>i&&([d[1],d[2-t],f[2-t]]=[l,i,c],G(e,t,n,d,f,ke,o))})},Ge=(e,t,n,r,i)=>{let a=Math.min(i,...n.map((e,n)=>(e-t[n])/3)),o=t.map((e,t)=>(e+n[t])/2),s=(e,r)=>[0,1,2].map(i=>{let o=e>>i&1,s=o?n[i]:t[i];return i==r?s:s+(o?-a:a)});for(let t=0;t<3;t++){let[n,i]=[1<<(t+1)%3,1<<(t+2)%3];for(let a of[0,1<<t])j(e,[a,a|n,a|n|i,a|i].map(e=>s(e,t)),r,o);let[a,c]=[(t+1)%3,(t+2)%3];for(let l of[0,n,i,n|i])j(e,[s(l,a),s(l,c),s(l|1<<t,c),s(l|1<<t,a)],r,o)}for(let t=0;t<8;t++)j(e,[s(t,0),s(t,1),s(t,2)],r,o)},Ke=(e,t,[n,r,i])=>e.push(...t,...be,n,r,-2,i),qe=(e,t,n,r,[i,a],o,s,c=12,l=0)=>{let u=l>0?c/2:c,d=Array.from({length:l>0?2*(u+1):c+1},(e,t)=>{let n=l>0?t<=u?1:-1:0,r=l>0?(t<=u?t:t-u-1)/u*Math.PI-Math.PI/2:t/c*2*Math.PI;return[n,n<0?Math.PI+r:r]});l>0&&d.push(d[0]);let f=([e,i],a)=>{let[o,s]=[e*l+Math.cos(i)*a,Math.sin(i)*a];return[0,1,2].map(e=>t[e]+n[e]*o+r[e]*s)};for(let t=0;t+1<d.length;t++){let[n,r]=[d[t],d[t+1]],c=[[f(n,i),o],[f(n,a),s],[f(r,a),s]];(i>0||n[0]!=r[0])&&c.push([f(n,i),o],[f(r,a),s],[f(r,i),o]);for(let[t,n]of c)Ke(e,t,n)}},[Je,Ye,Xe]=[[.13,.135,.15],[.2,.205,.22],[.05,.05,.06]],Ze=[.62,.6,1.05],Qe=[.04,.04,.09],[$e,et,tt]=[7,38*Math.PI/180,32*Math.PI/180],nt=[[-.2,-.22,.2,-.2],[-.2,.2,.2,.22],[-.2,-.22,-.18,.22],[.18,-.22,.2,.22],[-.12,-.1,-.1,.1],[.1,-.1,.12,.1],[-.12,-.01,.12,.01],[-.02,.12,.02,.16],[-.02,-.16,.02,-.12],[.22,-.05,.25,.05]],rt=(e,t,[n,r,i,a],[o,s,c])=>{for(let[l,u]of[[n,r],[n,a],[i,a],[n,r],[i,a],[i,r]])e.push(l,t,u,0,1,0,o,s,-2,c)},it=(()=>{let e=[];Ge(e,[.95,0,-.22],[1.35,.74,.22],Je,.05);let t=e.length;Ge(e,[-.32,-.05,-.3],[.32,.03,.3],Je,.03),rt(e,.032,[-.27,-.25,.27,.25],Ze.map(e=>.9*e));for(let t of nt)rt(e,.034,[t[1],t[0],t[3],t[2]],Qe);for(let[t,n]of[[-.15,[.5,1,.6]],[0,Ze],[.15,[1,.7,.3]]])qe(e,[-.322,-.01,t],[0,0,-1],[0,1,0],[0,.014],n.map(e=>2*e),n,8);return((e,t,n)=>{let[r,i]=[Math.cos(n),Math.sin(n)];for(let n=t;n<e.length;n+=10)for(let[t,a]of[[0,1],[3,0]]){let[o,s]=[e[n+t],e[n+t+1]];[e[n+t],e[n+t+1]]=[r*o-i*s+(a?1.1:0),i*o+r*s+(a?.86:0)]}})(e,t,tt),e})(),at=[0,1,0],ot=[.035,.037,.045],st=(e,t)=>e.map(e=>(e+(1-e)/3)*t),ct=[[-1,96.2,242.65,98.6,242.7,1,2.3,3],[-1,96.2,229.3,98.6,229.35,1,2.3,1],[-1,61.4,242.65,63.8,242.7,1,2.3,3],[-1,61.4,229.3,63.8,229.35,1,2.3,1],[-1,73.3,252.4,73.35,255.4,4.3,5.5,0],[-1,86.65,252.4,86.7,255.4,4.3,5.5,2],[-1,73.3,216.6,73.35,219.6,1,2.3,0],[-1,86.65,216.6,86.7,219.6,1,2.3,2]],lt=(e,t,n,i,a,o)=>{let s=ie(e,0);for(let c=t;c<e.length;c+=10){let e=[0,1,2].map(e=>s[c+e]-n[e]),t=e[0]*i[0]+e[1]*i[1]+e[2]*i[2];[s[c+3],s[c+4],s[c+5]]=D([0,1,2].map(n=>i[n]+o*(e[n]-t*i[n])/a)),s[c+8]=r}},ut=[[-M/4-Math.asin(se[0][2]/V),-M/4+Math.asin(se[0][2]/V),se[0][3]],[-Math.acos((N[1].min[0]-z)/V),Math.asin((N[0].max[2]-B)/V),se[1][3]]],dt=e=>e.filter((t,n)=>{let r=n-n%30;return Math.max(e[r],e[r+10],e[r+20])>-.49}),ft=dt(F(S([[1,0],[1,1]],12),ge)),pt=dt(F(S([[1.06,0],[1.06,.3]],12),_e)),mt=({brushes:e},t)=>{let n=[];for(let r of e)r.ghost&&r.tint&&Be(n,r,2*Math.max(0,t.indexOf(`${r.tint}`)));let r=[];(e=>{[...ee,...ct].forEach(t=>((e,[t,n,r,i,a,o,s,c])=>{let l=1&c?2:0,[u,d]=[[n,o,r],[i,s,a]],f=c<2?1:-1,p=(e,t,n)=>{let r=[0,o+t,0];return r[l]=(f>0?u[l]:d[l])+f*n,r[2-l]=u[2-l]+e,r},[h,g,_]=[d[2-l]-u[2-l],d[l]-u[l],s-o],v=(t,n,r)=>{let[i,a]=[p(t[0],t[1],t[2]),p(n[0],n[1],n[2])];P(e,i.map((e,t)=>Math.min(e,a[t])),i.map((e,t)=>Math.max(e,a[t])),r)},b=(t,n,r,i=.025)=>{let[a,o]=[p(t[0],t[1],t[2]),p(n[0],n[1],n[2])];Ge(e,a.map((e,t)=>Math.min(e,o[t])),a.map((e,t)=>Math.max(e,o[t])),r,i)},S=[0,0,0];S[2-l]=(l?1:-1)*f;let w=[0,1,0],T=(t,n,r,i,a,o=1.6,s=!0,c=8,l=0)=>{qe(e,p(t,n,i+.004),S,w,[0,r],st(a,1.4*o),a.map(e=>e*o),c,l),s&&qe(e,p(t,n,i+.001),S,w,[r,3*r],a.map(e=>.45*e),ot,c,l)},E=(t,n,r,i,a,o,s=1)=>C(e,s,()=>j(e,[p(t,n,a),p(r,n,a),p(r,i,a),p(t,i,a)],o,p(t,n,a-1))),ee=(e,t,n,r,i,a)=>{b([e,t,i-.06],[n,r,i],U,.025),E(e+.04,t+.04,n-.04,r-.04,i+.005,a,.45);for(let o=0;r-t>.3&&o<4;o++){let s=r-.12-o*((r-t-.16)/4);E(e+.08,s-.025,e+.08+(n-e-.16)*(.4+(7*e+o)%4*.15),s,i+.01,a,1.1)}};t==me.CONSOLE?((e,t,n,r,i)=>{Ve(e,()=>{let a=m(2,1,[1,1],[0,0]);y(e,a,[t,r,n],[t,r+.08,n],[1,0,0],1,1.48,Ye),y(e,a,[t,r+.08,n],[t,r+.14,n],[1,0,0],1,.75,Je),y(e,a,[t,r+.14,n],[t,r+.5,n],[1,0,0],1,.05,Ye),y(e,a,[t,r+.5,n],[t,r+.6,n],[1,0,0],1,.22,Xe);for(let a=0;a<$e;a++){let o=i+Math.PI+(a-($e-1)/2)*et;ae(e,it,[t,r,n],-o)}})})(e,(n+i)/2,(r+a)/2,o,c*Math.PI/2):Ve(e,()=>{if(t==me.BENCH){b([0,_-.06,0],[h,_,g],H,.03),b([.05,0,0],[h-.05,_-.06,g-.06],Ae,.04);for(let e=1.1;e<h-.5;e+=1.1)v([e-.01,.1,g-.06],[e+.01,_-.1,g-.05],U);for(let t=0;t<4;t++){let n=1.4+2.75*t;v([n-.05,_,.16],[n+.05,_+.22,.22],U),ee(n-.45,_+.2,n+.45,_+.75,.28,[Pe,W,Fe,Pe][t]),v([n-.3,_,.45],[n+.3,_+.025,.65],je);let r=m(2,1,[1,1],[0,0]);y(e,r,p(n+.76,_,.26),p(n+.76,_+.2,.26),[1,0,0],1,.055,[W,Me,Fe,Le][t])}}else if(t==me.RACKS){b([0,0,0],[h,_,g],U,.05);for(let e=0;e<3;e++){let t=.1+1.63*e;for(let n=0;n<12;n++){let r=.25+.2*n;E(t,r,t+1.43,r+.16,g+.01,je,.25);for(let i=0;i<5;i++){let a=[W,Fe,W,Pe,Ie,null][(7*e+5*n+3*i)%6];a&&T(t+.12+.08*i,r+.08,.017,g+.011,a,1.9,!1,6)}}E(t,_-.4,t+1.43,_-.34,g+.01,Pe,.9)}}else if(t==me.SCOPE){v([.2,0,.2],[1,.1,1],U),b([.45,.1,.45],[.75,.85,.75],H,.04),T(.6,.6,.035,.75,W,1.8,!1),b([.35,.85,.35],[.85,1.05,.85],je,.04);let[t,n]=[p(.6,.9,.2),p(1.4,2.8,2.1)];y(e,m(2,1,[1,1],[0,0]),t,n,[1,0,0],1,.2,H),y(e,m(2,1,[1,1],[0,0]),p(1.3,2.56,1.86),p(1.42,2.83,2.13),[1,0,0],1,.24,U),y(e,m(2,1,[1,1],[0,0]),p(.86,1.4,.6),p(1.2,2.2,1.4),[1,0,0],1,.05,je)}else if(t==me.ANALYSER){b([0,0,0],[h,.9,g],H,.04),b([0,.9,0],[h,_,.5],H,.04),ee(.12,.92,.95,1.26,.56,W),b([1.1,.9,.55],[1.88,1.18,1.1],je,.03),E(1.16,.95,1.82,1.13,1.105,Le,1.3),b([.08,.68,g-.01],[.9,.86,g+.015],U,.012);for(let e=0;e<6;e++)T(.185+.125*e,.77,.025,g+.015,[Fe,W,Pe][e%3]);for(let e of[.3,.6])v([.05,e,g],[h-.05,e+.015,g+.005],U)}else if(t==me.PLANTS){for(let e of[0,h/2-.03,h-.06])b([e,0,0],[e+.06,_,g],je,.02);b([0,_-.04,0],[h,_,g],H,.015);for(let t of[.3,.9,1.5]){b([0,t,0],[h,t+.04,g],H,.015),v([.1,t+.04,.12],[h-.1,t+.18,g-.12],Ne);for(let e=.25;e<h-.15;e+=.4)v([e-.1,t+.18,.2],[e+.1,t+.18+(.12+(10*e+3*t)%3*.06),g-.2],10*e%2<1?[.18,.5,.16]:[.3,.62,.2]);C(e,1.1,()=>v([.1,t+.53,.3],[h-.1,t+.56,g-.3],Re))}}else if(t==me.LOCKERS){b([0,0,0],[h,_,g],Me,.04);for(let e=0;e<6;e++){let t=.8*e;e&&v([t-.01,.05,g],[t+.01,_-.05,g+.01],U);for(let e=0;e<3;e++)v([t+.2,1.7+.08*e,g],[t+.6,1.73+.08*e,g+.01],U);b([t+.64,.95,g],[t+.68,1.2,g+.04],Ae,.015),T(t+.4,1.53,.025,g+.008,Fe,1.3,!1,12,.07)}}else if(t==me.SUIT){v([.1,0,.1],[.9,.06,.9],U),v([.47,.06,.06],[.53,1.7,.14],je);for(let e of[.27,.54])v([e-.02,.06,.36],[e+.21,.22,.68],je),v([e,.22,.4],[e+.19,.95,.62],H);b([.22,.95,.32],[.78,1.58,.7],H,.07),b([.25,1,.14],[.75,1.62,.32],Ae,.05);for(let e of[.08,.78])v([e,1,.4],[e+.14,1.54,.6],H),v([e,.88,.4],[e+.14,1,.6],je);T(.42,1.36,.05,.7,Pe,1.3,!1),T(.6,1.38,.03,.7,Ie,1.6,!1),x(e,m(2,0,[1,1]),p(.5,1.8,.5),fe,[0,0,0],.21,H),E(.38,1.74,.62,1.88,.715,Fe,.7)}else{b([0,0,0],[h,_,.05],je,.03),b([.08,.3,.03],[.6*h+.02,_-.08,.07],U,.02),E(.12,.34,.6*h-.02,_-.12,.071,Pe,.5),b([.64*h,.3,.03],[h-.08,_-.08,.07],U,.02);for(let e=0;e<12;e++){let[t,n]=[.64*h+.15+e%3*.24,.42+.23*Math.floor(e/3)];T(t,n,.04,.07,[W,Fe,Ie,Pe][(e+Math.floor(e/3))%4])}b([.1,.09,.03],[h-.1,.21,.06],U,.015),T(h/2,.15,.03,.06,Fe,1.4,!1,12,h/2-.2)}})})(e,t));let[,t]=se[0],n=B+t+.03;G(e,2,n,[z-3,3.4,0],[z+3,4.3,0],Ee);for(let t of[3.42,4.22])G(e,2,n+.01,[z-2.95,t,0],[z+2.95,t+.05,0],we);for(let t=0;t<9;t++){let r=z-2.6+.6*t;G(e,2,n+.01,[r,3.9,0],[r+.45,4.1,0],[.9,.95,1]),G(e,2,n+.01,[r+.05,3.6,0],[r+.3+t%2*.1,3.7,0],Pe)}for(let[t,n]of[[z+16.6,.3],[z+17.1,.15]])Ve(e,()=>P(e,[t,2.94,B-6.7],[t+n,3.06,B+6.7],U));N.forEach(({min:t,max:n},r)=>{let i=r?2:0,[a,o]=[t[i],r?N[0].min[2]:n[i]],s=t[2-i]+A,c=[0,2,0],l=[0,2.1,0];[c[i],l[i],c[2-i],l[2-i]]=[a,o,s,s+.12],Ve(e,()=>P(e,c,l,U));let[u,d]=[[0,0,0],[0,0,0]];[u[i],d[2-i]]=[i?-1:1,1];for(let t=a+2.5;t<o-1;t+=5){let[n,r]=[[0,1.22,0],[0,1.58,0]];[n[i],r[i],n[2-i],r[2-i]]=[t-.3,t+.3,s,s+.03],Ve(e,()=>Ge(e,n,r,U,.012));let a=[0,1.4,0];[a[i],a[2-i]]=[t,s+.03],qe(e,a,u,at,[.05,.13],W.map(e=>.5*e),ot,12,.16),qe(e,a.map((e,t)=>e+.002*d[t]),u,at,[0,.05],st(W,2),W.map(e=>1.4*e),12,.16)}});for(let t of ve){let n=t.max[0]-t.min[0]<1?0:2,[r]=O.filter(({min:e,max:n})=>e[0]<=t.min[0]&&t.max[0]<=n[0]&&e[2]<=t.min[2]&&t.max[2]<=n[2]),i=(r.min[n]+r.max[n])/2>t.min[n]?1:-1,a=(i>0?t.max[n]:t.min[n])+.02*i,[o,s]=[t.min[2-n],t.max[2-n]];if(N.some(e=>[0,2].every(n=>e.min[n]<=t.max[n]+.01&&t.min[n]-.01<=e.max[n])))continue;for(let t=0;o+.3*t<s;t++){let[r,i]=[[0,re+.05,0],[0,re+.35,0]];[r[2-n],i[2-n]]=[o+.3*t,Math.min(o+.3*t+.15,s)],G(e,n,a,r,i,Fe),[r[2-n],i[2-n]]=[i[2-n],Math.min(o+.3*t+.3,s)],G(e,n,a,r,i,U)}let c=(o+s)/2,[l,u]=[[0,3.32,0],[0,0,0]];[l[n],l[2-n],u[2-n]]=[a,c,(n?1:-1)*i],qe(e,l,u,at,[.12,.17],ot,ot,14),l[n]+=.003*i,qe(e,l,u,at,[0,.12],st(Ie,2.2),Ie.map(e=>1.6*e),14)}})(r);for(let e of r)n.push(e);for(let e=0;e<r.length;e+=30)for(let t of[0,2,1]){let i=e+10*t;n.push(r[i],r[i+1],280-r[i+2],r[i+3],r[i+4],-r[i+5],...r.slice(i+6,i+10))}return n},K=e=>Number.isInteger(e)?`${e}.`:`${e}`,ht=e=>`vec3(${e.map(K)})`,[[gt,_t],[vt,yt]]=O.map(({min:e,max:t})=>[[e[0]+A,0,e[2]+A],[t[0]-A,4,t[2]-A]]),[bt,xt]=oe,St=[...T,...T.map(([e,t])=>[t,e])],Ct=`if(L<${(Se+.05).toFixed(2)}&&L>${(Ce-.05).toFixed(2)}){\nbool rd=P.z>${K(140)};vec3 id=1./(r+step(abs(r),vec3(1e-5))*1e-5),h,e,W=vec3(.55,.56,.58);float t=0.;\nif(L<${((Se+Ce)/2).toFixed(3)}){vec2 o=P.xz-vec2(${K(bt)},rd?${K(xt)}:${K(280-xt)}),E[4]=vec2[](${St.map(([e,t])=>`vec2(${K(e)},${K(t)})`)});float ax=0.;\nfor(int n=0;n<2;n++)for(int i=0;i<4;i++){vec2 a=(-E[i]-o)*id.xz,b=(E[i]-o)*id.xz,lo=min(a,b),hi=max(a,b);float t1=min(hi.x,hi.y);\nif(max(lo.x,lo.y)<=t+.01&&t1>t){t=t1;ax=hi.x<hi.y?0.:1.;}}\nfloat tf=r.y<0.?-P.y*id.y:1e3;bool fl=tf<t;t=min(t,tf);h=P+r*t;float u=fract((ax<.5?h.z:h.x)/2.4);\ne=fl?vec3(.42,.43,.45)*(min(fract(h.x),fract(h.z))<.03?.7:1.):h.y>${K(8)}?vec3(.03,.03,.04):h.y>${K(7.4)}&&h.y<${K(7.6)}?vec3(1.3):h.y<.25?vec3(.04):\n((h.y>1.7&&h.y<2.9)||(h.y>5.1&&h.y<6.3))&&u>.25&&u<.75?vec3(.56,.48,.28):W;}\nelse{bool m0=P.x>${K((yt[0]+gt[0])/2)};vec3 lo=m0?${ht(gt)}:${ht(vt)},hi=m0?${ht(_t)}:${ht(yt)};\nif(!rd){float z=lo.z;lo.z=${K(280)}-hi.z;hi.z=${K(280)}-z;}\nvec3 x=max((lo-P)*id,(hi-P)*id);t=min(x.x,min(x.y,x.z));h=P+r*t;float s=(hi.x-lo.x)/3.,lx=abs(fract((h.x-lo.x)/s)-.5)*s,wx=abs(fract((h.x-lo.x-${K(1-A)})*.5+.5)-.5)*2.;\ne=t==x.y?(r.y>0.?(lx<1.2&&abs(h.z-(lo.z+hi.z)*.5)<.3?vec3(1.6):vec3(.5)):vec3(.4,.41,.44)):\nt==x.z&&h.y>2.7&&h.y<3.7&&wx<.46?vec3(.22,.24,.26):W;}\nvec3 dv=normalize(P-E),w;if(dv.y>0.)w=K0(dv,.0015);else{float tg=-P.y/dv.y;vec2 g=P.xz+dv.xz*tg;\nw=vec3(.5,.49,.47)*(.7+.45*vn(g*.12))*(.75+.35*vn(g*1.7))*(.25+.75*max(O.y,0.));}\nc=mix(w,e,.08+.6*fr);}`,[wt,Tt]=oe,Et=22.4,q=M/48,Dt=[.4,.42,.46],Ot=[.27,.29,.33],[J,kt,At,jt,Mt,Nt,Pt]=[[.16,.17,.2],[.6,.62,.66],[1,.8,.45],[.7,.9,1],[1,.6,.2],[1,.12,.08],[.35,1,.5]],Ft=[.6,.64,.48],It=F(S([[1,0],[1,1]],6),[1,1,1]),Lt=F(S([[0,-1],[1,0],[0,1]],6),[1,1,1]),Rt=F(S([[0,0],[1,.4],[.93,.42],[0,.12]],12),[.82,.84,.88]),zt=(e,t,n,r,i=kt)=>y(e,It,t,n,Ft,1,r,i),Bt=(e,t,n,r,i=2.2)=>{let a=e.length;x(e,Lt,t,fe,[0,0,0],n,r),i&&E(e,a,i)},Vt=(e,t,n)=>C(e,1.8,()=>j(e,[[t-.15,.03,n-.15],[t+.15,.03,n-.15],[t+.15,.03,n+.15],[t-.15,.03,n+.15]],jt,[t,-5,n])),Ht=e=>[Et*Math.cos(e*M/40),12*Math.sin(e*M/40)],Ut=(e,t,n=.02)=>{let r=Math.max(t-5,0),i=Math.floor(r),[a,o]=[Ht(i),Ht(i+1)],[s,c]=[a[0]+(o[0]-a[0])*(r-i),a[1]+(o[1]-a[1])*(r-i)],l=D([s/Et/Et,c/144,0]),u=s*Math.cos(q/2)/Math.cos((e%q+q)%q-q/2)+n*l[0];return[wt+u*Math.cos(e),Math.min(t,5)+c+n*l[1],Tt+u*Math.sin(e)]},Wt=ut.map(([e,t])=>[e-.03,t+.03]),Gt=e=>!Wt.some(([t,n])=>[e,e-M].some(e=>e>t&&e<n)),Kt=[...Array.from({length:35},(e,t)=>(2*t+1)*M/70).filter(e=>Gt(e-.03)&&Gt(e+.03)).map(e=>{let[t,n]=[Math.cos(e),Math.sin(e)];return[wt+22.419999999999998*t,4.02,Tt+22.419999999999998*n,t,n,.38,0]}),...O.flatMap(({min:e,max:t})=>[-1,1].flatMap(n=>[-2,2].map(r=>[(n>0?t[0]:e[0])+.02*n,3.1,(e[2]+t[2])/2+r,n,0,.45,1]))).filter(([e,,t])=>!N.some(n=>e>n.min[0]-.5&&e<n.max[0]+.5&&t>n.min[2]-.6&&t<n.max[2]+.6))],qt=(e,[t,n,r,i,a],o,s,c)=>j(e,Array.from({length:12},(e,c)=>{let l=o*Math.cos(c*M/12);return[t+s*i-a*l,n+o*Math.sin(c*M/12),r+s*a+i*l]}),c,[t-i,n,r-a]),Jt=(e,[t,n,r,i,a],o,s)=>{let c=e.length,l=e=>{let c=o*Math.cos(e*M/12);return[t+s*i-a*c,n+o*Math.sin(e*M/12),r+s*a+i*c]},u=[t+s*i,n,r+s*a];for(let o=0;o<12;o++)j(e,[u,l(o),l(o+1)],At,[t-i,n,r-a]);E(e,c,.7),lt(e,c,u,[i,0,a],o,.8)},[Yt,Xt]=[160,280],Zt=[80,0,140],Qt=Zt,$t=D([.3,.62,-.75]),Y=e=>(e=Math.min(Math.max(e,0),1))*e*(3-2*e),X=(e,t,n)=>{let[r,i]=[Math.floor(e),Math.floor(t)],[a,o]=[e-r,t-i].map(e=>e*e*(3-2*e)),s=(e,t)=>R(r+e,i+t,n);return(s(0,0)*(1-a)+s(1,0)*a)*(1-o)+(s(0,1)*(1-a)+s(1,1)*a)*o},en=(e,t,n)=>.55*X(e,t,n)+.3*X(2*e,2*t,n+1)+.15*X(4*e,4*t,n+2),tn=F(S([[1,0],[1,1]],6),[.5,.52,.56]),nn=F(S([[0,-1],[1,0],[0,1]],6),[1,1,1]),rn=F(S([[0,0],[.5,1.6],[.85,3.5],[1,6],[1,10],[.8,12.5],[.55,14],[0,14]],12),[.9,.9,.92]),an=F(S([[0,0],[2.2,.6],[0,.9]],12),[.8,.82,.86]),on=(e,t,n)=>{let r=e=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2]-n,i=[],a=e.map(e=>{let t=[];return e.forEach((n,a)=>{let o=e[(a+1)%e.length],[s,c]=[r(n),r(o)];if(s<=0&&t.push(n),s*c<0){let e=s/(s-c),r=[n[0]+(o[0]-n[0])*e,n[1]+(o[1]-n[1])*e,n[2]+(o[2]-n[2])*e];t.push(r),i.some(e=>Math.abs(e[0]-r[0])+Math.abs(e[1]-r[1])+Math.abs(e[2]-r[2])<1e-9)||i.push(r)}}),t}).filter(e=>e.length>2);if(i.length>2){let e=i.reduce((e,t)=>e.map((e,n)=>e+t[n]/i.length),[0,0,0]),n=D(I(t,Math.abs(t[1])<.9?[0,1,0]:[1,0,0])),r=I(t,n),o=t=>{let i=[t[0]-e[0],t[1]-e[1],t[2]-e[2]];return Math.atan2(i[0]*r[0]+i[1]*r[1]+i[2]*r[2],i[0]*n[0]+i[1]*n[1]+i[2]*n[2])};a.push(i.sort((e,t)=>o(e)-o(t)))}return a},sn=[0,1,2].flatMap(e=>[-1,1].map(t=>[[-1,-1],[1,-1],[1,1],[-1,1]].map(([n,r])=>{let i=[0,0,0];return i[e]=1.2*t,i[(e+1)%3]=1.2*n,i[(e+2)%3]=1.2*r,i}))),cn=(e,t,[n,r,i],a,o,s=!0)=>{let c=(e,t)=>R(e,t,a),l=on(sn,[0,-1,0],.35),u=(e,t,n)=>{let r=Math.sqrt(1-e*e);l=on(l,[r*Math.cos(t),e,r*Math.sin(t)],n)};u(.92+.08*c(0,1),M*c(0,2),.72+.15*c(0,3));for(let[e,t,n,r,i,a]of[[7,-.4,.2,.62,.2,0],[8,-.05,.25,.74,.18,.3],[6,.45,.3,.6,.2,.6],[s?14:0,-.22,.2,.78,.1,.5],[s?12:0,.24,.2,.76,.1,.15],[s?9:0,.66,.2,.74,.1,.4]])for(let o=0;o<e;o++){let s=10*e+o;u(t+n*c(s,1),M*((o+a+.45*c(s,2))/e),r+i*c(s,3))}let[d,f]=[.8+.4*R(a,1,9),M*R(a,2,9)],[p,m]=[Math.cos(f),Math.sin(f)],h=([e,a,o])=>{let[s,c]=[e*n*d,o*i*(2-d)];return[t[0]+s*p-c*m,t[1]+a*r,t[2]+s*m+c*p]};l.forEach((n,r)=>{let i=n.map(h).filter((e,t,n)=>Math.hypot(...e.map((e,r)=>e-n[(t+n.length-1)%n.length][r]))>1e-5);if(i.length<3)return;let a=D(I([i[1][0]-i[0][0],i[1][1]-i[0][1],i[1][2]-i[0][2]],[i[2][0]-i[0][0],i[2][1]-i[0][1],i[2][2]-i[0][2]]));a[0]*(i[0][0]-t[0])+a[1]*(i[0][1]-t[1])+a[2]*(i[0][2]-t[2])<0&&(i.reverse(),a.forEach((e,t)=>a[t]=-e));let s=D(I(a,Math.abs(a[1])<.9?[0,1,0]:[1,0,0])),l=I(a,s),u=.85*o*(.88+.24*c(r,7))*(.8+.2*Math.sqrt(Math.max(a[1]+1,0)/2)),d=e=>[...e,...a,e[0]*s[0]+e[1]*s[1]+e[2]*s[2]+7*c(0,5),e[0]*l[0]+e[1]*l[1]+e[2]*l[2]+7*c(0,6),k.ROCK,u];for(let t=1;t<i.length-1;t++)e.push(...d(i[0]),...d(i[t]),...d(i[t+1]))})},ln=(t,n,r,i,a,o,s)=>{let c=I(e(n[1],n[0]),e(n[2],n[0]));if(Math.hypot(...c)<1e-9)return;c=D(c),d(c,e(n[0],r))<0&&(n.reverse(),c=c.map(e=>-e));let l=(n[0][1]+n[1][1]+n[2][1])/3,u=.85*s*(.86+.28*R(t.length,o,7))*(.55+.45*Y((l-i)/(.3*(a-i))))*(.82+.18*Math.max(c[1],0));for(let e of n)t.push(...e,...c,...Math.abs(c[1])>.7?[e[0],e[2]]:Math.abs(c[0])>Math.abs(c[2])?[e[2]+3*o,e[1]]:[e[0]+3*o,e[1]],k.ROCK,u)},un=(e,t,n,r,i,a)=>{let[o,s,c,l,u,d]=t[0],f=[(o+l)/2,n+.3*(u-n),(c+d)/2],[p,m]=[(i>1?.54:.5)*(l-o),(i>1?.54:.5)*(d-c)];he(e,i>2?5:i>1?3:l-o>1.4?2:1,e=>{let t=e[1]>0?u-f[1]:f[1]-s,n=[e[0]/p,e[1]/t,e[2]/m].map(e=>e*e),a=i>1?1/Math.sqrt(Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2])):1/Math.sqrt(n[0]+n[1]+n[2]),o=a*(.93+.14*X(1.3*e[0]+r,1.3*e[2]+e[1],r));return[f[0]+e[0]*o,Math.min(f[1]+e[1]*a,u),f[2]+e[2]*o]},n,u,r,a)},dn=(e,t,n)=>{x(e,F(S([[13,0],[13,.27],[0,.27]],32),[.13,.13,.15]),[t,0,n],fe,[0,0,0],1),te(e,[t,.29,n],7.6,8,[.8,.8,.82]);for(let r=0;r<24;r++){let i=r*M/24,[a,o]=[t+11.6*Math.cos(i),n+11.6*Math.sin(i)],s=(e,t)=>[a+e,.31,o+t];C(e,1.8,()=>j(e,[s(-.25,-.25),s(.25,-.25),s(.25,.25),s(-.25,.25)],r%3?[1,.95,.8]:[1,.45,.1],[a,-5,o]))}},fn=(e,t,n,r,i=10,a=[1,.93,.75])=>{x(e,tn,[t,r,n],fe,[0,0,0],[.2,.2,i]),x(e,tn,[t,r,n],fe,[0,0,0],[.5,.5,.5]),C(e,ue,()=>x(e,nn,[t,r+i+.4,n],fe,[0,0,0],[.55,.55,.45],a))},pn=(e,t)=>{let n=(n,r)=>{let[i,a]=[t[n],M*(r+.5*n)/e];return[Math.sqrt(1-i*i)*Math.cos(a),i,Math.sqrt(1-i*i)*Math.sin(a)]},r=[];for(let i=0;i<e;i++){r.push([[0,1,0],n(0,i+1),n(0,i)]);for(let e=0;e+1<t.length;e++)r.push([n(e,i),n(e,i+1),n(e+1,i)],[n(e+1,i),n(e,i+1),n(e+1,i+1)])}return r},mn=[pn(6,[-.35]),pn(5,[.45,-.35]),pn(9,[.62,.1,-.35])],hn=[.08,.2,.45],gn=(e,t,n,r,i,a,o)=>{un(e,[[t,a-4,n,r,a,i]],a-3.4,o,3,.9),un(e,[[t+.15,-17,n+.15,r-.15,a-3,i-.15]],-15,o+9,2,.5)},_n=[[0,.02,.6],[.55,.04,.72],[.88,.2,1.05],[1,.24,1.12],[1.4,.015,1]],vn=({brushes:e},t,n,r)=>!e.some(e=>e.max[1]>0&&Math.hypot(Math.max(e.min[0]-t,t-e.max[0],0),Math.max(e.min[2]-n,n-e.max[2],0))<r+.5)&&[0,1,2,3,4].every(i=>{let[a,o]=i?[t+r*Math.cos(1.57*i),n+r*Math.sin(1.57*i)]:[t,n];return Math.abs(a-Zt[0])<=Zt[0]-.5&&Math.abs(o-Zt[2])<=Zt[2]-.5&&e.some(e=>e.max[1]==0&&a>e.min[0]&&a<e.max[0]&&o>e.min[2]&&o<e.max[2])}),yn=(e,t)=>{let n=[0,20,40,60,80,120,160,200,240];return[...n.map(t=>e-t).reverse(),...Array.from({length:(t-e)/20-1},(t,n)=>e+20*(n+1)),...n.map(e=>t+e)]},bn=[[0,0,0,1],[-.6,-.25,0,.9],[-3,-.2,.7,.95],[-7,.1,.9,.85],[-7.4,.8,.9,.5],[-14,1,1.2,.55],[-14.5,1.7,1.2,.3],[-22,2.1,1.5,.34],[-30,5.6,1.5,.12]],xn=(()=>{let e=e=>l[Math.min(Math.max(e,0),l.length-1)],t=[[0,140]];for(let n=0;n<=l.length;n++){let[r,i]=[e(n-1),e(n)];Math.abs(r-i)>.5?t.push([n,148+r],[n,148+i]):t.push([n,148+Math.min(r,i)-.12*R(n,1,71)])}return[...t,[l.length,140]]})(),Sn=[[640,75,4,.17,.02,3],[690,95,3,.16,.03,5],[740,115,3,.15,.04,8]],Cn=(e,t,n,r)=>{let i=(i,a)=>X(e*n/i+7*r,t*n/i-3*r,r+a),a=n=>{let i=M*R(r,n,97);return e*Math.cos(i)+t*Math.sin(i)},o=Math.max(Y((a(1)-.93)/.07),.8*Y((a(2)-.95)/.05)),s=Math.max(Y((a(3)-.985)/.015),Y((a(4)-.985)/.015)),c=1-Math.abs(2*i(150,2)-1);return(.42+.2*i(520,1)+.14*c*c+.24*o)*(1-.5*s)+.1*(i(60,3)-.5)+.04*(i(24,4)-.5)};function*wn(t){let r=[];(e=>{(e=>{(e=>{let t=Array.from({length:9},(e,t)=>{let n=(t+1)/10*(M/4);return[V*Math.cos(n),5+12*Math.sin(n)]}),n=[];x(n,F(S([[V,0],[V,5],...t,[0,17]],48),ge),[z,0,B],fe,[0,0,0],1);let r=(e,t)=>(t?Math.ceil:Math.floor)(e*48/M)*M/48;for(let t=0;t<n.length;t+=30){let[i,a,o]=[t,t+10,t+20],s=Math.atan2(n[i+2]+n[a+2]+n[o+2]-3*B,n[i]+n[a]+n[o]-3*z);if(Math.max(n[i+1],n[a+1],n[o+1])>5.01||!ut.some(([e,t])=>s>r(e,0)&&s<r(t,1)))for(let r=t;r<t+30;r++)e.push(n[r])}let i=(e,t)=>[z+V*Math.cos(e),t,B+V*Math.sin(e),Math.cos(e),0,Math.sin(e),ge[0],ge[1],-1,ge[2]];for(let[t,n,a]of ut){let o=[r(t,0),t];for(let e=Math.ceil(t*48/M);e*M/48<n;e++)o.push(e*M/48);o.push(n,r(n,1)),o.slice(1).forEach((t,n)=>{let r=o[n],s=n&&n<o.length-2?a:0;e.push(...i(r,s),...i(t,s),...i(t,5),...i(r,s),...i(t,5),...i(r,5))})}let a=(e,t,n)=>[z+(V+n)*Math.cos(e),t,B+(V+n)*Math.sin(e)];for(let t=0;t<70;t++){let n=t*M/70,r=n>M/2?n-M:n;if(ut.some(([e,t])=>r>e-.04&&r<t+.04))continue;let i=(e,t,r,i)=>[[-e,t],[e,t],[e,r],[-e,r]].map(([e,t])=>a(n+e/V,t,i));j(e,i(.72,1.5,2.9,.04),[.06,.06,.08],[z,2.2,B]);let o=e.length;C(e,.56,()=>j(e,i(.6,1.7,2.7,.07),[1,.85,.5],[z,2.2,B])),lt(e,o,a(n,2.2,.07),[Math.cos(n),0,Math.sin(n)],.6,.25)}let[,o,s,c,l]=se[0],u=B+o-l;for(let[t,n,r]of[[-s-.3,-s-.02,0],[s+.02,s+.3,0],[-s-.3,s+.3,c]])P(e,[z+t,r,u-.1],[z+n,c+.3,u+.5],_e),G(e,2,u-.12,[z+t+.09,r+.09,0],[z+n-.09,c+.21,0],we)})(e),(e=>{let t=[...T,...T.map(([e,t])=>[t,e]).reverse()];for(let[n,r]of t)G(e,1,.02,[z-n,0,B-r],[z+n,0,B+r],De,1.85);let n=t.flatMap(([e,n],r)=>[[e,n],...t[r+1]?[[t[r+1][0],n]]:[]]),r=[...n,...n.map(([e,t])=>[-e,t]).reverse(),...n.map(([e,t])=>[-e,-t]),...n.map(([e,t])=>[e,-t]).reverse()];r.forEach((t,n)=>{let i=r[(n+1)%r.length],a=t[0]==i[0]?0:2,o=2-a,[s,c]=[ye[a]+t[a/2],Math.sign(t[a/2])],[l,u]=[t[o/2],i[o/2]].sort((e,t)=>e-t),d=se.find(e=>e[a/2]==t[a/2]&&e[o/2]>l&&e[o/2]<u),[f,p,m,h]=d?[d[o/2],d[2],d[3],d[4]]:[l,0,0,0],g=(t,n,r,i,l,u=0,d=0)=>{let[f,p]=[[0,r,0],[0,i,0]];[f[o],p[o]]=[ye[o]+t,ye[o]+n],G(e,a,s-c*d,f,p,l,u)};We(e,a,s,ye[o]+l,ye[o]+u,8,1.7,d&&[[ye[o]+f-p,ye[o]+f+p,m]]),g(l,u,0,.25,Ee,0,.02),g(l,u,7.4,7.6,we,0,.03);let _=u-l>6?Math.floor((u-l)/2.4):0;for(let t=0;t<_;t++){let n=l+(u-l)*(t+.5)/_;for(let t of[1.5,4.9])if(t>m||Math.abs(n-f)>p+.8){g(n-.72,n+.72,t,t+1.4,Ee,0,.02);let r=e.length;g(n-.6,n+.6,t+.2,t+1.2,Te,0,.04);let i=[0,0,0];i[a]=-c,He(e,r,i,Ce)}}let v=Math.ceil((u-l)/4.2);for(let n=0;n<v;n++){let r=(e,n)=>{let r=[0,8,0];[r[a],r[o]]=[t[a/2],l+(u-l)*e/v];let i=n?21.55/Math.hypot(r[0],r[2]):1;return[z+r[0]*i,8,B+r[2]*i]};ze(e,[r(n,0),r(n+1,0),r(n+1,1),r(n,1)],De,1)}if(d){let[t,n]=[[0,0,0],[0,m,0]];[t[a],n[a]]=[s,s+c*h].sort((e,t)=>e-t),[t[o],n[o]]=[ye[o]+f-p,ye[o]+f+p],G(e,o,t[o],t,n,ke,1.4),G(e,o,n[o],t,n,ke,1.4),G(e,1,m,t,n,ke,.9),G(e,1,.02,t,n,De,1.85),Ue(e,a,s-.03*c,t[o],n[o],m)}});let[i,a,o]=[32,6,Math.asin(3/11.7)],s=(e,t)=>{let[n,r]=[o+(M/4-o)*t/a,e*M/i],s=(V-.3)*Math.cos(n);return[z+s*Math.cos(r),5+11.7*Math.sin(n),B+s*Math.sin(r)]};for(let t=0;t<a;t++)for(let n=0;n<i;n++){let r=.31-.028*t-.018*(n+t&1);ze(e,[s(n,t),s(n+1,t),s(n+1,t+1),s(n,t+1)],[r,r,1.06*r])}for(let t=0;t<16;t+=2){let n=e=>[z+3*Math.cos(e*M/16),16.2,B+3*Math.sin(e*M/16)];ze(e,[[z,16.2,B],n(t),n(t+1),n(t+2)],we)}de.forEach(t=>Be(e,t))})(e),(e=>{N.forEach(({min:t,max:n},r)=>{let i=r?2:0,[a,o,s]=[t[i],r?N[0].min[2]:n[i],(t[2-i]+n[2-i])/2],c=e=>i?[s,1.75,e]:[e,1.75,s],l=(n[2-i]-t[2-i])/2+.1;y(e,ft,c(a),c(o),[0,1,0],1,[1.75,l]);for(let t=5;t<o-a-1;t+=5)y(e,pt,c(a+t),c(a+t+.3),[0,1,0],.3,[1.75,l]);We(e,2-i,t[2-i]+A+.02,a,o,re,1.4),We(e,2-i,n[2-i]-A-.02,r?a:N[1].min[0],o,re,1.4),G(e,1,re-.01,t,n,ke,.9);let[u,d]=[[...t],[...n]];[u[2-i],d[2-i]]=[s-.15,s+.15],G(e,1,re-.02,u,d,we)})})(e),(e=>{for(let{min:t,max:n}of O){let r=[(t[0]+n[0])/2,2.5,(t[2]+n[2])/2];for(let i of[-1,1]){let a=i>0?n[2]:t[2];for(let n=0;n<7;n++){let o=t[0]+1+2*n;if(ve.some(e=>Math.abs(e.min[2]-a)<1&&o+.72>e.min[0]&&o-.72<e.max[0]))continue;let s=(e,t,n,r)=>[[-e,t],[e,t],[e,n],[-e,n]].map(([e,t])=>[o+e,t,a+i*r]);j(e,s(.72,2.6,3.8,.02),[.06,.06,.08],r);let c=e.length;C(e,.5,()=>j(e,s(.6,2.7,3.7,.04),[.9,.95,1],r)),lt(e,c,[o,3.2,a+.04*i],[0,0,i],.6,.25),ze(e,s(.56,2.6,3.8,-A-.04),Ee);let l=e.length;ze(e,s(.46,2.7,3.7,-A-.06),[.45,.48,.5]),He(e,l,[0,0,-i],Se)}}for(let r of[0,2])for(let[i,a]of[[t[r],A+.02],[n[r]-A,-.02]])We(e,r,i+a,t[2-r]+A,n[2-r]-A,4,1.5,ve.filter(e=>Math.abs(e.min[r]-i)<.01).map(e=>[e.min[2-r],e.max[2-r],re]));G(e,1,3.99,t,n,ke,.9);for(let i=0;i<3;i++){let a=t[0]+(n[0]-t[0])*(i+.5)/3;G(e,1,3.98,[a-1.2,0,r[2]-.3],[a+1.2,0,r[2]+.3],we)}}})(e);for(let{min:t,max:n}of[...O,...N])G(e,1,.02,t,n,Oe,1.99);for(let{min:t,max:n}of ve){let r=n[0]-t[0]<1?0:2;for(let i of[t[r]-.02,n[r]+.02])Ue(e,r,i,t[2-r],n[2-r],t[1])}})(e),(e=>{(e=>{let t=(t,n=Dt)=>j(e,t,n,[wt,5,Tt]),n=(e,n,r,i,a,o)=>{for(let s=e;s<n-1e-9;){let e=Math.min(n,(Math.floor(s/q+1e-9)+1)*q);t([Ut(s,r,o),Ut(e,r,o),Ut(e,i,o),Ut(s,i,o)],a),s=e}};for(let[t,r]of[[Wt[0][1],Wt[1][0]],[Wt[1][1],Wt[0][0]+M]])n(t,r,0,.45,J),C(e,1.6,()=>n(t,r,.16,.3,jt,.035)),n(t,r,3.18,3.32);n(0,M,4.55,5.01,J,.03),[.4,1.9,2.5,3.7,5.2].forEach(e=>n(e,e+.05,4.68,4.86,kt,.045));for(let e=0;e<70;e++){let n=(e+.5)*M/70,r=.07/Et;Gt(n)&&[0,2].includes(e%5)&&t([Ut(n-r,.45),Ut(n+r,.45),Ut(n+r,4.55),Ut(n-r,4.55)])}let r=(e,n=.1,r,i=.03)=>e.slice(1).forEach(([a,o],s)=>{let[c,l]=e[s],u=Math.max(Math.abs(a-c),Math.abs(o-l)),d=(e,t)=>{let[r,s]=[c+(a-c)*e/u,l+(o-l)*e/u];return a==c?Ut(r*q+t*n/Ht(s)[0],5+s,i):Ut(r*q,5+s+t*n/2.5,i)};for(let e=0;e<u;e++)t([d(e,-1),d(e,1),d(e+1,1),d(e+1,-1)],r)});for(let t=0;t<12;t++){let n=4*t;r([[n,0],[n,9]],.22,Ot,.05),1&t?(C(e,1.6,()=>r([[n,1],[n,8]],.04,jt,.065)),r([[n,4],[n+2,2],[n+4,4]]),r([[n,6],[n+1,7],[n+3,7],[n+4,6]])):(r([[n,2],[n+1,3],[n+3,3],[n+4,2]]),r([[n+1,3],[n+1,5],[n+2,6],[n+3,5],[n+3,3]]))}n(0,M,13.75,14.15,Ot,.05),C(e,1.6,()=>n(0,M,13.9,14,jt,.065));for(let[t,r]of[[5,0],[22,1],[34,0]])n(t*q+.02,(t+2)*q-.02,5.25+r,5.8+r,J,.03),C(e,2,()=>n(t*q+.04,t*q+.05,5.65+r,5.72+r,Pt,.045));let[,i,a,o,s]=se[0],c=Tt+i-s;for(let[t,n,r]of[[-a-.62,-a-.3,0],[a+.3,a+.62,0],[-a-.62,a+.62,o+.3]])P(e,[wt+t,r,c-.04],[wt+n,o+.62,c+.6],J),C(e,1.5,()=>j(e,[[t+.1,r+.1],[n-.1,r+.1],[n-.1,o+.52],[t+.1,o+.52]].map(([e,t])=>[wt+e,t,c-.055]),Mt,[wt,1,Tt]));for(let t=1;t<7;t++)for(let n of[-2.6,2.6])Vt(e,wt+n,c-2.5*t);let l=(e,t=0,n=0)=>[wt+t,e,Tt+n];Bt(e,l(17),.7,J,0),zt(e,l(17),l(25.099999999999998),.11),[1.9,1.5,1.1].forEach((t,n)=>{let r=20+1.6*n;zt(e,1&n?l(r,0,-t):l(r,-t),1&n?l(r,0,t):l(r,t),.06)}),Bt(e,l(25.4),.34,Nt)})(e),(e=>{N.forEach(({min:t,max:n},r)=>{let i=r?2:0,a=2-i,[o,s]=[t[i],r?N[0].min[2]:n[i]];for(let r=1;o+5*r/3<s-1;r++)if(r%3){let[s,c]=[[0,0,0],[0,3.53,0]];[s[i],c[i]]=[o+5*r/3-.06,o+5*r/3+.06];for(let r of[0,1]){s[a]=r?n[a]:t[a]-.12,c[a]=s[a]+.12,P(e,s,c,Dt,12|(i?32:2)>>r);let o=r?c[a]+.015:s[a]-.015;C(e,1.8,()=>j(e,[[s[i]+.015,2.7],[c[i]-.015,2.7],[c[i]-.015,2.9],[s[i]+.015,2.9]].map(([e,t])=>{let n=[0,t,0];return[n[i],n[a]]=[e,o],n}),jt,[(t[0]+n[0])/2,2.8,(t[2]+n[2])/2]))}[s[a],c[a],s[1]]=[t[a]-.12,n[a]+.12,3.5],P(e,s,c,Dt,4|(i?48:3))}})})(e),(e=>{O.forEach(({min:t,max:n},r)=>{for(let r of[0,2]){let i=2-r;for(let a of[-1,1]){let o=a>0?n[r]:t[r],s=(r?1:16)*(a>0?1:2),c=(e,t,n)=>{let s=[0,t,0];return[s[r],s[i]]=[o+a*n,e],s},l=(t,n,r,i=0)=>P(e,t.map((e,t)=>Math.min(e,n[t])),t.map((e,t)=>Math.max(e,n[t])),r,i),u=(t,n,r,i,a,o)=>j(e,[c(t,n,a),c(r,n,a),c(r,i,a),c(t,i,a)],o,c(t,n,-1)),[d]=ve.filter(e=>Math.abs((a>0?e.max[r]:e.min[r])-o)<.01&&e.min[i]>t[i]&&e.max[i]<n[i]).map(e=>{let t=(e.min[i]+e.max[i])/2;return e.max[i]-e.min[i]>3?[t-2.25,t+2.25,3.62,0]:[t-1.32,t+1.32,re+.14,t]});l(c(t[i]-.06,4.7,0),c(n[i]+.06,5,.06),J,s|(r?48:3));for(let[e,r]of d?[[t[i],d[0]],[d[1],n[i]]]:[[t[i],n[i]]])l(c(e,0,0),c(r,.3,.04),Dt,4|s);let f=(t[i]+n[i])/2;for(let i of r?[1,-1]:[]){let r=i>0?t[0]:n[0],a=d?d[i>0?0:1]:f-.8*i;(a-r)*i>4.2&&(u(r,1,r+3*i,1.1,.02,Dt),u(r+4*i,2,a,2.1,.02,Dt),j(e,[c(r+3*i,1,.02),c(r+4*i,2,.02),c(r+4*i,2.1,.02),c(r+3*i,1.1,.02)],Dt,c(r,1,-1)))}if(r&&C(e,1.6,()=>u(t[0]+.3,4.82,n[0]-.3,4.9,.075,jt)),!r&&!d){u(f-1.1,.9,f+1.1,1.9,.02,J);for(let e=0;e<4;e++)u(f-1,1.05+.2*e,f+1,1.15+.2*e,.035,kt)}if(d?.[3]){let t=d[3];l(c(t-.5,2.95,0),c(t+.5,3.05,.22),J,s),C(e,1.8,()=>l(c(t-.4,2.83,0),c(t+.4,2.95,.12),At,8|s)),l(c(t-.05,4.1,0),c(t+.05,4.2,.5),J,s),l(c(t-.5,4.2,.32),c(t+.5,4.42,.5),kt),C(e,2,()=>u(t-.42,4.27,t-.3,4.35,.515,Pt)),zt(e,c(t+.35,4.42,.41),c(t+.35,5.4,.41),.03),Bt(e,c(t+.35,5.45,.41),.07,Nt);for(let n of[1.5,3.5,5.5])for(let r of[t-1.5,t+1.5]){let[t,,i]=c(r,0,n);Vt(e,t,i)}}}}if(r){let r=n[0]-.7;P(e,[r-.3,5,t[2]+2],[r+.3,5.2,n[2]-2],J),[3.4,4.6,2.8].forEach((n,i)=>{let a=t[2]+2.5+1.5*i;zt(e,[r,5.2,a],[r,5.2+n,a],.04),Bt(e,[r,5.26+n,a],.07,1&i?Nt:jt)})}else{let r=[n[0]-1.4,6.35,t[2]+1.4],i=e=>[r[0]+.6*e,r[1]+.8*e,r[2]];P(e,[r[0]-.4,5,r[2]-.4],[r[0]+.4,5.12,r[2]+.4],J),zt(e,[r[0],5,r[2]],r,.16),Bt(e,r,.26,J,0),y(e,Rt,i(.1),i(1.1),Ft,1,1.15),zt(e,i(.2),i(1.05),.03),Bt(e,i(1.1),.08,Nt)}})})(e),(e=>{for(let t of Kt){let n=t[5];if(qt(e,t,n+.1,0,J),Jt(e,t,n,.015),t[6]){let r=e.length,i=[t[0],t[1],t[2],-t[3],-t[4]];qt(e,i,n+.1,A+.06,[.04,.04,.05]),qt(e,i,n,A+.08,[.45,.48,.5]);for(let t=r;t<e.length;t+=10)[e[t+3],e[t+4],e[t+5],e[t+8]]=[...be,-2]}}})(e)})(e);for(let[t,n]of i.pads.slice(0,i.pads.length/2))dn(e,t,n);for(let[t,n]of i.masts.slice(0,i.masts.length/2))fn(e,t,n,0)})(r),t.relief&&((t,n)=>{let{at:r}=n.relief,a=xn,o=(e,t)=>Math.max(r(e,Math.max(t,148)),0),s=e=>Y(4*(X(e/6,.5,82)-.35))*(.55+.45*X(e/1.7,.5,83)),c=([e,t],n)=>{let[r,i,a]=bn[n];return[e,n?r:o(e,t),t-i-a*s(e)*+!!n]};for(let n=0;n<a.length-1;n++){let[r,i]=[a[n],a[n+1]];for(let a=0;a<bn.length-1;a++){let o=[c(r,a),c(i,a),c(i,a+1),c(r,a+1)];for(let[c,l,u]of n+a&1?[[0,1,2],[0,2,3]]:[[0,1,3],[1,2,3]]){let d=I(e(o[l],o[c]),e(o[u],o[c]));if(Math.hypot(...d)<1e-9)continue;d=D(d),d=d[2]>0||Math.abs(d[2])<1e-9&&d[1]<0?d.map(e=>-e):d;let f=bn[a][3]*(.82+.3*R(n,a,73))*(.7+.3*s((r[0]+i[0])/2));for(let e of[o[c],o[l],o[u]])t.push(...e,...d,e[0]+e[2],e[1],k.ROCK,f)}}}i.pillars.forEach(([e,n,r,i,a],o)=>n>140&&gn(t,e,n,r,i,a,o+400)),j(t,[[-2,-30,140],[162,-30,140],[162,-30,158],[-2,-30,158]],[.012,.012,.015]);for(let e=0;e<9;e++){let n=6+17*e+8*R(e,1,77);C(t,.1,()=>j(t,[[n,-29.9,140],[n+9+6*R(e,2,77),-29.9,140],[n+5,-29.9,140.25+.3*R(e,3,77)]],[.2,.55,1]));let r=1.5+2.5*R(e,4,77);cn(t,[n,-29.6,142.5+5*R(e,5,77)],[r,.7*r,r],e+200,.25,!1)}})(r,t);let a=t.relief?.at??(()=>0);i.crags.forEach(e=>((e,{at:[t,n,r],R:i,H:a,s:o},s)=>{let{reach:c}=v(o,i,a),l=[t,n+g(a),r];he(e,i<1.5?3:i<2.5?4:5,e=>{let t=c(e);return[l[0]+e[0]*t,l[1]+e[1]*t,l[2]+e[2]*t]},n,n+a,o,.8+.4*R(o,5,41),s)})(r,e,a));let o=r.concat((e=>{let t=[];for(let n=0;n<e.length;n+=30)for(let r of[0,2,1]){let i=n+10*r;t.push(e[i],e[i+1],Xt-e[i+2],e[i+3],e[i+4],-e[i+5],...e.slice(i+6,i+10))}return t})(r));yield,t.relief&&((e,t)=>{for(let[r,a,o,c,u]of(e=>{let t=ne(e.relief),[r,a,o,c]=t.bound,u=(e,n)=>{if(e>t.hole[0]-.3&&e<t.hole[2]+.3&&n>t.hole[1]-.3&&n<t.hole[3]+.3||t.pits.some(t=>e>=t[0]-.3&&e<=t[2]+.3&&n>=t[1]-.3&&n<=t[3]+.3))return NaN;let[r,i]=[(e-t.x0)/t.cell,(n-t.z0)/t.cell],[a,o]=[Math.floor(r),Math.floor(i)],[s,c]=[r-a,i-o],l=a+o*t.nx,[u,d,f,p]=[t.h[l],t.h[l+1],t.h[l+t.nx],t.h[l+t.nx+1]];return s>=c?u+(d-u)*s+(p-d)*c:u+(f-u)*c+(p-f)*s},d=[],f=(e,t,l,f=1)=>{if(((e,t)=>{let l=t-Xt/2,d=([t,n,r,i])=>Math.hypot(Math.max(t-e,e-r,0),Math.max(n-l,l-i,0));return l>.3&&Math.hypot((e-r)/o,(t-a)/c)<.97&&!p.some(e=>d(e)<2.5)&&!s.some(e=>d(e)<1)&&!i.pits.some(r=>Math.abs(e-r.x)<n+.5&&Math.abs(t-r.z)<n+.5)&&!i.crags.some(n=>Math.hypot(e-n.at[0],t-n.at[2])<1.3*n.R)&&Number.isFinite(u(e,t))})(e,t)){let n=R(l,3,211);d.push([e,u(e,t),t,n<.62?0:n<.945+.055*(1-f)?1:2,l])}};i.sites.forEach(([e,t,n],r)=>{for(let i=0;i<Math.round(8+5*n);i++){let a=e=>R(r,5*i+e,201),o=n*(.1+1.7*a(1)*a(1));f(e+o*Math.cos(M*a(2)),t+o*Math.sin(M*a(2)),1e3*r+i)}}),i.crags.forEach(({at:[e,,t],R:n},r)=>{for(let i=0;i<Math.round(8+5*n);i++){let a=e=>R(r,5*i+e,215),o=n*(1.32+.75*a(1)*a(1));f(e+o*Math.cos(M*a(2)),t+o*Math.sin(M*a(2)),5e5+1e3*r+i)}}),i.bowls.forEach(([e,t,n],r)=>{for(let i=0;t>=Xt/2&&i<Math.round(1.1*n);i++){let a=e=>R(r,5*i+e,203),o=i%5<2?.94+.16*a(1):1.15+1.25*a(1)*a(1);f(e+o*n*Math.cos(M*a(2)),t+o*n*Math.sin(M*a(2)),1e5+1e3*r+i)}});for(let e=0;e<60;e++){let t=t=>R(e,t,205),n=1+158*t(1),r=l[Math.floor(n)];f(n,Xt/2+8+Math.max(r,0)+.5+2.5*t(2)*t(2),2e5+e,.5)}for(let e=0;e<18;e++){let t=t=>R(e,t,207),[n,i,a]=[r+o*(1.8*t(1)-.9),Xt/2+4+(c-8)*t(2),M*t(3)];for(let r=0;r<10+12*t(4);r++)a+=.5*(R(e,10+r,208)-.5),[n,i]=[n+(1+1.4*R(e,40+r,208))*Math.cos(a),i+(1+1.4*R(e,40+r,208))*Math.sin(a)],f(n+.8*(R(e,70+r,208)-.5),i+.8*(R(e,100+r,208)-.5),3e5+100*e+r,.6)}for(let e=0;e<520;e++){let t=t=>R(e,t,209),[n,i]=[r+o*(2*t(1)-1),Xt/2+c*t(2)];(X(n/20,i/20,77)>.62||t(3)<.04)&&f(n,i,4e5+e,.7)}return[...d,...d.map(([e,,t,n,r])=>[e,u(e,Xt-t),Xt-t,n,r])]})(t)){let t=e=>R(u,e,213),n=hn[c]*(.88+.24*t(1)),[i,s,l]=[n/2,n/2*(.65+.35*t(2)),n*(.5+.3*t(3))],[d,f]=[Math.cos(M*t(4)),Math.sin(M*t(4))],p=a+.1*l;he(e,mn[c],e=>{let[t,n]=[e[0]*d+e[2]*f,e[2]*d-e[0]*f],a=(.9+.2*X(1.3*e[0]+u,1.3*e[2]+e[1],u%97))/Math.hypot(t/i,2*e[1]/l,n/s);return[r+e[0]*a,p+e[1]*a,o+e[2]*a]},a,p+l/2,u,.5+.25*t(5))}})(o,t);for(let[e,t,n,r,a]of i.pillars)t<140&&r>140&&gn(o,e,t,n,r,a,401);return((e,t)=>{let n={relief:t.relief&&ne(t.relief)},r=(e,r,i)=>!t.relief||Array.from({length:17},(e,t)=>t*M/16).every((t,a)=>pe(n,e+(a?i*Math.cos(t):0),r+(a?i*Math.sin(t):0))===0);for(let n=0,i=0;i<72&&n<900;n++){let[a,o,s]=[Yt*R(n,1,61),Xt*R(n,2,61),.6+2*R(n,3,61)**2];if(!vn(t,a,o,1.5*s)||!r(a,o,1.5*s)||Math.abs(o-Zt[2])<24||(t.rovers??[]).some(([e,,t])=>Math.hypot(a-e,o-t)<6))continue;i++;let c=(e,t)=>{let[r,i,c]=_n[e],[l,u]=[r*(e&&e<4?.86+.28*R(n,t%12,67):1),e===2||e===3?i*(.55+.45*R(n,t%12,68)):i],d=t*M/12,[f,p]=[Math.cos(d),Math.sin(d)],[m,h]=[_n[Math.max(e-1,0)],_n[Math.min(e+1,_n.length-1)]],g=-3*(h[1]-m[1])/((h[0]-m[0])*s),_=Math.hypot(g,1),[v,y]=[a+f*l*s,o+p*l*s];return[v,u,y,g*f/_,1/_,g*p/_,v,y,k.STONE,c]};for(let t=0;t<_n.length-1;t++)for(let n=0;n<12;n++){let[r,i,a,o]=[c(t,n),c(t+1,n),c(t+1,n+1),c(t,n+1)];e.push(...r,...a,...i,...r,...o,...a)}}})(o,t),yield,t.relief&&(((e,t)=>{let{at:n}=t.relief,r=(e,t)=>n(e,Math.max(t,148));for(let t of[1,-1]){let n=(e,n)=>{let i=D([r(e-1,n)-r(e+1,n),2,t*(r(e,n-1)-r(e,n+1))]);return[e,Math.max(r(e,n),0),140+t*(n-140),...i,e,140+t*(n-140),k.STONE,1]};for(let t=0;t<xn.length-1;t++){let[r,i]=[xn[t],xn[t+1]];if(r[0]!==i[0]){let[t,a,o,s]=[n(r[0],156),n(i[0],156),n(i[0],i[1]),n(r[0],r[1])];e.push(...t,...o,...a,...t,...s,...o)}}}})(o,t),(e=>{for(let[t,{x:r,z:a,level:o,rows:s}]of i.pits.entries()){let i=(e,t)=>s[e]?.[2+t]??0,c=Array.from({length:s.length+1},(e,t)=>[s[0][0]+t,-Math.min(i(t-1,0),i(t,0)),Math.min(i(t-1,1),i(t,1))]),l=(e,t)=>[e,o,t,0,1,0,e,t,k.STONE,.6+.4*Y((Math.hypot(e-r,t-a)-L)/3)],u=(t,n,r,i)=>e.push(...t,...r,...n,...t,...i,...r);for(let[e,t]of[[a-n,a-L],[a+L,a+n]])for(let i=r-n;i<r+n;i+=2)u(l(i,e),l(i+2,e),l(i+2,t),l(i,t));for(let i=0;i<c.length-1;i++){let[[s,d,f],[p,m,g]]=[c[i],c[i+1]];u(l(r-n,s),l(r+d,s),l(r+m,p),l(r-n,p)),u(l(r+f,s),l(r+n,s),l(r+n,p),l(r+g,p));for(let n of[1,2]){let s=[o,o-.6,o-5,o-10,h],l=(e,t)=>[r+e[n]+(n>1?-1:1)*(t&&t<4?.9*R(e[0],t,83+n)-.25:0),s[t],e[0]];for(let u=0;u<4;u++){let d=[l(c[i],u),l(c[i+1],u),l(c[i+1],u+1),l(c[i],u+1)],f=[r+(n>1?99:-99),s[u],a],p=e.length;ln(e,[d[0],d[1],d[2]],f,h-12,o,t+u,1.2),ln(e,[d[0],d[2],d[3]],f,h-12,o,t+u,1.2);for(let t=p+3;t<e.length;t+=10){let n=D([e[t],e[t+1]+.9,e[t+2]]);[e[t],e[t+1],e[t+2]]=n}}}}let d=(e,t)=>[e,h,t,0,1,0,e,t,k.STONE,.5];u(d(r-L-1.5,a-L),d(r+L+1.5,a-L),d(r+L+1.5,a+L),d(r-L-1.5,a+L));let f=s[L][3],p=(o-h)/_;for(let n=0;n<_-1;n++){let i=r+f-1.3*(_-1-n);un(e,[[i,h-1,a-1,i+1.3,h+p*(n+1),a+1]],h,9*t+n,2,.9)}for(let n=0;n<20;n++){let i=M*(n+R(t,n,85))/20,[s,c,l]=[r+(L+1.6)*Math.cos(i),a+(L+1.6)*Math.sin(i),.3+.35*R(t,n,86)];un(e,[[s-l,o-.3,c-l,s+l,o+.9*l,c+l]],o,40*t+n,1,.9)}}})(o),yield,((e,t)=>{let{at:n}=t.relief,r={relief:ne(t.relief)};i.bowls.forEach(([t,i,a],o)=>{let s=a<12?0:Math.round(M*a/1.5),c=Array.from({length:s},(e,r)=>{let[o,c]=[Math.cos(M*r/s),Math.sin(M*r/s)],[l,u]=[a,-1/0];for(let e=.8*a;e<1.3*a;e+=.5){let r=n(t+o*e,i+c*e);[l,u]=r>u?[e,r]:[l,u]}return l}),l=Array.from({length:s},(e,n)=>{let[a,l]=[Math.cos(M*n/s),Math.sin(M*n/s)],u=[-2,-1,0,1,2].reduce((e,t)=>e+c[(n+t+s)%s],0)/5,d=R(n,o,87);return[-2.4,-1.2,0,1.2,2.4].map((e,s)=>{let[c,f]=[t+a*(u+e),i+l*(u+e)],p=[.04,.12,.1+.15*d,.1,.04][s],m=[.62+.3*R(n>>1,o,88),.9,1.22+.2*d,1.1,1][s];return[c,pe(r,c,f)+p,f,0,1,0,c,f,k.STONE,m]})});l.forEach((t,n)=>{let r=l[(n+1)%s];for(let n=0;n<4;n++)[t[n],t[n+1],r[n],r[n+1]].every(e=>Number.isFinite(e[1]))&&e.push(...t[n],...r[n+1],...r[n],...t[n],...t[n+1],...r[n+1])})})})(o,t),yield,((e,t)=>{let r=ne(t.relief),[a,o,s,c]=r.bound,[l,u]=[yn(r.x0,a+s),yn(r.z0,o+c)],d=(e,n)=>{let[i,a]=[(e-r.x0)/r.cell,(n-r.z0)/r.cell];return i%1||a%1||i<0||a<0||i>=r.nx||a>=r.nz?t.relief.at(e,n):r.h[i+a*r.nx]},f=(e,t)=>i.bowls.reduce((n,[r,i,a])=>{let o=Math.hypot(e-r,t-i),s=o/a,c=X((e-r)/o*5+r,(t-i)/o*5+i,19);return s>1.05&&s<2.4?n+.22*Y(5*(c-.55))*Y((2.4-s)/.9)*Y(6*(s-1.05)):n},0),p=/* @__PURE__ */ new Map,m=(e,t)=>{let n=4096*e+t,r=p.get(n);if(!r){let i=d(e,t),a=[d(e-4,t)-d(e+4,t),d(e,t-4)-d(e,t+4)],o=i===0&&a[0]===0&&a[1]===0,s=n=>o?0:1.4*(R(e,t,131+n)-.5);r=[e,i,t,...D([a[0]+s(0),8,a[1]+s(1)]),e,t,k.STONE,Math.min(Math.max(1+i/60,.78),1.2)+f(e,t)],p.set(n,r)}return r},h=(e,t)=>{let[n,r,i,d]=[l[e],l[e+1],u[t],u[t+1]];if(!(n<r&&i<d))return 0;let f=Math.hypot((Math.min(Math.max(a,n),r)-a)/s,(Math.min(Math.max(o,i),d)-o)/c);return f<1?2:+(f<1.65)};for(let t=0;t<l.length-1;t++)for(let a=0;a<u.length-1;a++){let[o,s,c,d,f]=[l[t],l[t+1],u[a],u[a+1],h(t,a)];if(f>1)for(let t=o;t<s;t+=r.cell)for(let a=c;a<d;a+=r.cell){if(t>=r.hole[0]&&t<r.hole[2]&&a>=r.hole[1]-8&&a<r.hole[3]+8||i.pits.some(e=>t>=e.x-n&&t<e.x+n&&a>=e.z-n&&a<e.z+n))continue;let[o,s,c,l]=[m(t,a),m(t+r.cell,a),m(t+r.cell,a+r.cell),m(t,a+r.cell)];e.push(...o,...c,...s,...o,...l,...c)}else if(f){let n=[];for(let[e,r,i,l,u]of[[o,c,s,c,h(t,a-1)],[s,c,s,d,h(t+1,a)],[s,d,o,d,h(t,a+1)],[o,d,o,c,h(t-1,a)]]){let t=u>1?5:1;for(let a=0;a<t;a++)n.push(m(e+(i-e)*a/t,r+(l-r)*a/t))}let r=m((o+s)/2,(c+d)/2);n.forEach((t,i)=>e.push(...r,...n[(i+1)%n.length],...t))}}})(o,t),yield,((e,t)=>{let{at:n}=t.relief,r=D(I([0,1,0],$t)),a=[r,I($t,r),$t];for(let[t,r]of i.dishes)fn(e,t,r,n(t,r),6,[1,.25,.15]),x(e,an,[t,n(t,r)+5.2,r],a,[0,0,-.9],1);for(let[t,r,a,o]of i.ramps)for(let i of[-8,8])fn(e,t+i*o,r-i*a,n(t+i*o,r-i*a),2.2,[1,.45,.1]);let[o,s]=i.wreck,c=h,l=D([.8,-.35,.5]),u=D(I([0,1,0],l));x(e,rn,[o-3,c+3.1,s-2],[u,I(l,u),l],[0,0,0],[1.6,1.4,.55],[.6,.6,.62]),j(e,[[o+3,c,s+4],[o+6.5,c+.2,s+5],[o+4,c+2.6,s+5.5]],[.7,.3,.14]),fn(e,o-3.4,s+2.6,c,3.5,[1,.12,.08])})(o,t)),((e,t)=>{for(let[n,r,i,a,o,s]of Sn){let c=e=>{let c=e*M/480,[l,u]=[Math.cos(c),Math.sin(c)],f=r*Cn(l,u,n,s),p=(e+1)*M/480,m=(r*Cn(Math.cos(p),Math.sin(p),n,s)-f)/(n*M/480);return Array.from({length:i+1},(e,r)=>{let c=r/i,p=n-.3*f*(1-c),h=n/(30+26*(1-c))*(1+.05*c),g=2*X(l*h+s+1.7*c,u*h-1.3*c,s+9)-1,_=D([-l-u*(-1.5*m-1.6*g*(1-.5*c)),.75,l*(-1.5*m-1.6*g*(1-.5*c))-u]),v=Math.max(d(_,t),0),y=(.8+.3*X(l*n/90-s,u*n/90+2.3*c,s+11))*(.72+.28*Y(.5+.9*g))*(o+(a-o)*Math.min(1.2*v+(r===i?.3:0),1));return[Zt[0]+l*p,(f+25)*c-25,Zt[2]+u*p,l,0,u,y,y,-2,1.03*y]})},l=c(0);for(let t=1;t<=480;t++){let n=c(t%480);for(let t=0;t<i;t++)e.push(...l[t],...n[t],...n[t+1],...l[t],...n[t+1],...l[t+1]);l=n}}})(o,D(t.sun.dir)),o}var Tn=()=>{let e=[];return(e=>{let t=$t,n=t.map(e=>-e),r=D([n[2],0,-n[0]]),i=I(n,r),a=t.map((e,t)=>Zt[t]+800*e),o=t.map((e,t)=>a[t]+100*e),[s,c]=[28,64],l=(e,t)=>a.map((n,a)=>n+60*e*(r[a]*Math.cos(t)+i[a]*Math.sin(t))),d=e.length;for(let t=0;t<s;t++)for(let n=0;n<c;n++){let[r,i]=[n*M/c,(n+1)*M/c],[a,d]=[(t+.5)/s,(n+.5)*M/c],[f,p]=[a*Math.cos(d),a*Math.sin(d)],m=Math.sqrt(1-a*a),[h,g]=[(Math.atan2(f,m)+1.5)/M*12,6*(Math.asin(p)/Math.PI+.5)],_=en(h,g,11)>.5?u([.13,.32,.09],[.4,.3,.15],en(2*h,2*g,13)):[.03,.16,.5],v=Math.abs(p)>.93?1:Y(4*(en(1.5*h+4,3*g,17)-.5));_=u(_,[.95,.97,1],v).map(e=>e*(.55+.45*Math.max(0,.3*f+.25*p+.9*m))*(.6+.4*m)),j(e,t?[l(t/s,r),l((t+1)/s,r),l((t+1)/s,i),l(t/s,i)]:[l(0,0),l(1/s,r),l(1/s,i)],_,o)}E(e,d,1.5)})(e),e},{FORWARD:En,BACK:Dn,JUMP:On,CROUCH:kn,SPRINT:An,USE:jn}=ce,Mn=(e,t,n,r,i)=>e.push(...t,...n,r[0],r[1],i,r[2]),Z=(e,t,n,r,i=-1)=>{let[[a,o],[s,c],[l,u]]=[0,1,2].map(e=>[t[e],n[e]]),d=[[[0,1,0],[[a,c,l],[a,c,u],[o,c,u],[o,c,l]]],[[0,-1,0],[[a,s,l],[o,s,l],[o,s,u],[a,s,u]]],[[1,0,0],[[o,s,l],[o,c,l],[o,c,u],[o,s,u]]],[[-1,0,0],[[a,s,l],[a,s,u],[a,c,u],[a,c,l]]],[[0,0,1],[[a,s,u],[o,s,u],[o,c,u],[a,c,u]]],[[0,0,-1],[[a,s,l],[a,c,l],[o,c,l],[o,s,l]]]];for(let[t,n]of d)for(let a of[0,1,2,0,2,3])Mn(e,n[a],t,r,i)},Nn=(e,t,n,r)=>{let i=F(S(e,r),t);for(let e=8;e<i.length;e+=10)i[e]=n;return i},Q=(e,t,n,r,i,a=c)=>y(e,Nn([[0,0],[r,0],[r,1],[0,1]],i,a,8),t,n,[0,1,0],1),Pn=[.2,.22,.26],Fn=[.42,.45,.5],In=[.05,.05,.06],Ln=[.3,.32,.36],Rn=[.95,.72,.08],zn=[.08,.35,.8],Bn=[.35,.9,1.4],Vn=[[1.6,.12,.08],[.15,1.4,.35],[1.5,.8,.12],[.3,.6,1.6]],Hn=(e,[t,,n],r,i,a,o)=>{for(let s=0;s<24;s++){let[c,l]=[2*s*Math.PI/24,2*(s+1)*Math.PI/24],u=(e,i)=>[t+r*Math.cos(e),i,n+r*Math.sin(e)],d=(c+l)/2,f=[Math.cos(d),0,Math.sin(d)];for(let t of[u(c,i),u(c,a),u(l,a),u(c,i),u(l,a),u(l,i)])Mn(e,t,f,o,-1);for(let r of[[t,a,n],u(l,a),u(c,a)])Mn(e,r,[0,1,0],o,-1)}},Un=(e,t)=>{let n=43758.5453*Math.sin(91.7*e+47.3*t);return n-Math.floor(n)},Wn=[.2,.22,.26],Gn=[.5,.53,.58],Kn=[.13,.14,.17],qn=[.62,.65,.7],Jn=[.42,.44,.48],Yn=[.06,.06,.07],Xn=[.1,.1,.12],Zn=[.3,.45,.9],Qn=[.55,.7,1.1],$n=[.08,.35,.8],er=[2.2,2.3,2.6],tr=2*Math.PI,nr=48,rr=(e,t,n,r,i,a,o=-1)=>{let[s,c]=[n,r].map(e=>e.map((e,n)=>e-t[n])),l=[s[1]*c[2]-s[2]*c[1],s[2]*c[0]-s[0]*c[2],s[0]*c[1]-s[1]*c[0]],u=Math.hypot(...l)||1;for(let s of[t,n,r,t,r,i])Mn(e,s,[l[0]/u,l[1]/u,l[2]/u],a,o)},ir=(e,t,n,r,i,a=-1)=>{let o=([e,t],n)=>[n,t,e];rr(e,o(t[0],n),o(t[1],n),o(t[2],n),o(t[3],n),i,a);for(let s=0;s<4;s++){let[c,l]=[t[s],t[(s+1)%4]];rr(e,o(l,n),o(c,n),o(c,r),o(l,r),i,a)}},ar=({hull:[e,,t],deck:n})=>({cz:t,cy:n+a.DAIS+a.UP,px:e+a.X1}),or=a.R+5,sr=(e,t,n,r,i,o)=>{let{cz:s,cy:c,px:l}=ar(e),u=Math.max(Math.min(n,r)-s,s-Math.max(n,r),0),d=Math.max(i-c,c-o,0);return t>l-4&&Math.hypot(u,d)<a.R+.3},cr=(e,t,n,r,i,a)=>{rr(e,t,n,r,i,a),rr(e,i,r,n,t,a)},lr=2*Math.PI,ur=[.5,.51,.53],dr=[.62,.63,.64],fr=[.36,.37,.4],pr=[.16,.17,.19],mr=[1.5,1.4,1.05],$=(e,t)=>{let n=43758.5453*Math.sin(91.7*e+47.3*t+3.1);return n-Math.floor(n)},hr=(e,t,n)=>e>=t+44&&e<n-36,gr=[.78,.8,.84],_r=[.95,.68,.22],vr=[.06,.06,.07],yr=[.9,.9,.88],br=[.14,.24,.55],xr=[.75,.42,.2],Sr=[3.2,.35,.15],Cr=2*Math.PI,wr=(e,t,n,r,i,a=-1,s=48)=>x(e,Nn(t,i,a,s),n,o(r,Math.abs(r[1])>.9?[1,0,0]:[0,1,0]),[0,0,0],1),Tr=(e,t,n)=>{let r=43758.5453*Math.sin(127.1*e+311.7*t+74.7*n);return 2*(r-Math.floor(r))-1},Er=(e,t)=>{let n=Tr(Math.floor(Math.min(e,Cr-e)/(4*Cr/72)),Math.floor(t/6),3);return ur.map(e=>e*(1+.12*n))},Dr=(e,t,n,r,i=-2)=>{for(let a of[0,1,2,0,2,3])Mn(e,[t[a][0],n,t[a][1]],[0,1,0],r,i)},Or=[.55,.57,.6],kr=[.9,.45,.08],Ar=[.95,.75,.1],jr=[.4,2.6,1.6],Mr=[2.6,1.3,.25],Nr=[2.2,2.3,2.6];function*Pr(e,n){let r=yield*wn(e);return yield,r=r.concat(mt(e,n)),e.station&&(yield,r=r.concat((e=>{let{hall:[n],deck:r,hull:[i,o,s,l],gun:u}=e,d=[],{R:p}=f,[m,h]=[n[0],n[0]+48],g=[m,h].flatMap(e=>{let t=Math.acos((e-i)/p);return[t,Cr-t]}),_=[...Array.from({length:72},(e,t)=>t*Cr/72),...g,Cr].sort((e,t)=>e-t);for(let n=o;n<l-.01;n+=2){let a=hr(n,r,l);for(let o=0;o+1<_.length;o++){let[c,l]=[_[o],_[o+1]],u=(c+l)/2,f=i+p*Math.cos(u);if(f>m&&f<h&&n>=r-2&&n<r+16||sr(e,i+p*Math.cos(u),s+p*Math.sin(c),s+p*Math.sin(l),n,n+2))continue;let g=a,v=g?_r:Er(u,n),y=g?.22:.03;for(let[e,r]of[[o,n],[o+1,n],[o+1,n+2],[o,n],[o+1,n+2],[o,n+2]]){let n=_[e],a=e%(_.length-1),[o,c]=[Tr(a,r,1)*y,Tr(a,r,2)*y],l=[Math.cos(n)+o*Math.sin(n),c,Math.sin(n)-o*Math.cos(n)];Mn(d,[i+p*Math.cos(n),r,s+p*Math.sin(n)],l,v,g?t:-1)}}}wr(d,[[p,0],[p-3,3],[.6*p,le.DOME-1],[0,le.DOME]],[i,l,s],[0,1,0],gr,c);let v=[i-16,l+le.MAST,s];Q(d,[v[0],l+4,s],v,.8,gr);let y=Array.from({length:6},(e,t)=>[2.4*t,3.6*(t/5)**2]);wr(d,[...y,...[...y].reverse().map(([e,t])=>[e,t-.3])],v,[-.6,.8,0],yr,-1,20);let b=le.BARREL*p,x=o-u[1];wr(d,[[p,0],[p-1.5,2],[b+2,2.6],[0,2.6]],[i,o,s],[0,-1,0],gr,c),wr(d,[[0,2.6],[b+2,2.6],[b+2,5],[b,6.5],[b,x-4],[b+3,x-1.5],[b+3,x],[b-2,x],[b-3,x-10],[0,x-10.5]],[i,o,s],[0,-1,0],vr,c);for(let e=10;e<x-8;e+=7)wr(d,[[0,e],[b+.8,e],[b+.8,e+1.6],[0,e+1.6]],[i,o,s],[0,-1,0],gr,c);wr(d,[[0,x-10.3],[b-3.5,x-10.1],[0,x-9.9]],[i,o,s],[0,-1,0],Sr,-2),Z(d,[i-b-8,u[1]-18,s-16],[i-b-7.2,u[1]+8,s+16],yr,c),Q(d,[i-b-1,u[1]+3,s],[i-b-7.2,u[1]+3,s],.6,gr);let S=o+(l-o)*le.WING,[C,w,T]=[le.PANEL,le.SPAN,le.GAP],ee=(e,t,n,r,a,o)=>Z(d,[i-a,n,s+Math.min(e,t)],[i+a,r,s+Math.max(e,t)],o,c);for(let e of[-1,1]){let t=e*(p+le.BOOM);Q(d,[i,S,s+e*p],[i,S,s+t],1.4,gr),ee(t,t+3*e,S-6,S+6,2,gr),Q(d,[i,S,s+t],[i,S,s+t+e*(4*(C+T)+2)],.6,xr);for(let n=0;n<4;n++){let r=t+e*(3+n*(C+T)),[i,a]=[Math.min(r,r+e*C),Math.max(r,r+e*C)];ee(i,a,S-w/2,S+w/2,.2,br);for(let e of[S-w/2,S+w/2-.6,S-.3,S-w/4,S+w/4-.3])ee(i,a,e,e+.6,.3,gr);for(let e of[i,i+C/2-.3,a-.6])ee(e,e+.6,S-w/2,S+w/2,.3,gr)}}return((e,t=[])=>{let{hall:[n],deck:r,hull:[i,o,s,c]}=e,{R:l}=f,[u,d]=[n[0],n[0]+48],p=o+(c-o)*le.WING,m=(e,t,n,r)=>[i+n*Math.cos(e)-t*Math.sin(e),r,s+n*Math.sin(e)+t*Math.cos(e)],h=(t,n,o,c)=>{let f=i+l*Math.cos(t),m=f>u-4-n&&f<d+4+n&&c>r-4&&o<r+19,h=Math.abs(Math.cos(t))<.2&&c>p-10&&o<p+10,g=((e,t,n,r,i)=>{let{cz:a,cy:o,px:s}=ar(e);return t>s-4&&Math.hypot(n-a,r-o)<or+.5+i})(e,f,s+l*Math.sin(t),Math.max(o,Math.min(c,r+a.DAIS+a.UP)),n);return!m&&!h&&!g},g=(e,n,r,i,a,o,s)=>{let[c,u]=[l+a,l+o],d=m(e,0,(c+u)/2,(r+i)/2),f=(t,r,i)=>m(e,t*n,r,i);for(let e of[[f(-1,u,r),f(1,u,r),f(1,u,i),f(-1,u,i)],[f(-1,c,i),f(-1,u,i),f(1,u,i),f(1,c,i)],[f(-1,c,r),f(1,c,r),f(1,u,r),f(-1,u,r)],[f(-1,c,r),f(-1,u,r),f(-1,u,i),f(-1,c,i)],[f(1,c,r),f(1,c,i),f(1,u,i),f(1,u,r)]])j(t,e,s,d)},_=e=>e<1e-6||e>Math.PI-1e-6?[e]:[e,lr-e],v=(e,n,r,i,a)=>{for(let o=0;o<72;o++){let[s,c]=[o*lr/72,(o+1)*lr/72],[u,d]=[l+n,l+i];j(t,[m(s,0,u,e),m(c,0,u,e),m(c,0,d,r),m(s,0,d,r)],a,m((s+c)/2,0,l-1,(e+r)/2))}};for(let[e,t]of[[0,o+14],[1,c-24]]){v(t,.12,t+3,.12,pr),v(t-.6,0,t,.45,dr),v(t+3,.45,t+3.6,0,dr);for(let n=0;n<14;n++){let r=(n+.5+.4*$(n,e))*Math.PI/14,i=.5+.9*$(n,e+7);for(let a of _(r))g(a,i,t+.4,t+1.2+1.4*$(n,e+3),.1,.35,fr)}}[[o+1,o+13],[o+18,r+44],[c-36,c-25],[c-20,c-1]].forEach(([e,n],r)=>{for(let r=0;r<18;r++){let i=4*r*lr/72;if(h(i,.1,e,n)){let r=(e,t)=>m(i,.09*e,l+.03,t);j(t,[r(-1,e),r(1,e),r(1,n),r(-1,n)],pr,m(i,0,l,e))}}let i=Math.round(.5*(n-e));for(let t=0;t<i;t++){let a=(t+.15+.7*$(t,10+r))*Math.PI/i,o=Math.min(n-e-2,3+8*$(t,20+r)),s=e+1+(n-e-2-o)*$(t,30+r),c=2+4*$(t,40+r);if(h(a,c,s,s+o))for(let e of _(a))g(e,c,s,s+o,0,.35,dr),$(t,45+r)<.5&&o>3&&g(e,.6*c,s+.25*o,s+.75*o,.35,.7,ur)}for(let t=0;t<i;t++){let a=(t+$(t,50+r))*Math.PI/i,o=.8+2.4*$(t,60+r),s=e+.5+(n-e-1-o)*$(t,70+r),c=.6+1.8*$(t,80+r);if(h(a,c,s,s+o))for(let e of _(a))g(e,c,s,s+o,0,.6+1.2*$(t,90+r),fr)}for(let i=0;e+3+10*i<n-1;i++){let n=e+3+10*i;for(let e=0;e<9;e++){let a=4+Math.floor(5*$(e,100+r+9*i)),o=1.2/l,s=(a-1)*o,c=(e+.1+.5*$(e,110+r+9*i))*Math.PI/9;if(c+s>Math.PI||!h(c+s/2,s*l/2+1,n,n+.45))continue;let u=t.length;for(let e=0;e<a;e++)for(let r of _(c+e*o)){let e=(e,t)=>m(r,.35*e,l+.06,t);j(t,[e(-1,n),e(1,n),e(1,n+.45),e(-1,n+.45)],mr,m(r,0,l,n))}E(t,u,1)}}})})(e,d),d})(e.station),(e=>{let{hall:[t],deck:n,hull:[r,,i]}=e,o=[],[s,c]=[t[0]+4,t[0]+44],[l,u]=[i-f.R,i+f.R];for(let[e,t,r,i]of[[s+.5,2.4,.25,1],[s+.5,3.1,.16,1],[s+.7,8.5,.4,1],[c-.5,4.6,.25,-1],[c-.7,8.5,.4,-1]]){Q(o,[e,n+t,l+5],[e,n+t,u-5],r,Or);for(let a=l+8;a<u-5;a+=8)Z(o,[Math.min(e,e-.5*i),n+t-r-.1,a-.15],[Math.max(e,e-.5*i)+.01,n+t+r+.1,a+.15],vr),a/8%3<1&&Q(o,[e,n+t,a+1.5],[e,n+t,a+1.8],r+.12,kr,-1)}for(let e of[s+.6,c-.6])for(let t of[l+6,u-6])Q(o,[e,n,t],[e,n+14,t],.3,Or);for(let e of[r-10,r+10])Q(o,[e,n+13.2,l+5],[e,n+13.2,u-5],.6,Or);for(let e=l+10;e<u-5;e+=12)Z(o,[r-4,n+13.7,e-.6],[r+4,n+13.9,e+.6],Nr,-2);for(let e of[-1,1]){let[t,a]=[r+6,i+10*e];for(let e=0;e<32;e++){let[r,i]=[e*Cr/32,(e+1)*Cr/32],s=(e,n)=>[t+n*Math.cos(e),a+n*Math.sin(e)];Dr(o,[s(r,7),s(i,7),s(i,6.4),s(r,6.4)],n+.03,Ar,-1),e%4==0&&Z(o,[t+7.4*Math.cos(r)-.15,n,a+7.4*Math.sin(r)-.15],[t+7.4*Math.cos(r)+.15,n+.12,a+7.4*Math.sin(r)+.15],Mr,-2)}let d=e<0?l:u;for(let r=a+10*e;e*(d-r)>4;r+=5*e)for(let i of[-1,1])Dr(o,[[t+.4*i,r+1.2*e],[t+3.2*i,r-.6*e],[t+3.2*i,r-1.3*e],[t+.4*i,r+.5*e]],n+.04,Mr);Dr(o,[[s,d-.6*e],[c,d-.6*e],[c,d-.2*e],[s,d-.2*e]],n+.04,jr);for(let t of[s+.06,c-.06])Z(o,[t-.06,n,d-.6*e-.2],[t+.06,n+11,d-.6*e+.2],jr,-2);Z(o,[s,n+10.94,d-.6*e-.2],[c,n+11,d-.6*e+.2],jr,-2)}return((e,t)=>{let{X0:n,X1:r,Z:i,H:o,STAIR0:s,STAIR1:c,STEPS:l,W:u,DAIS:d,GALLERY:p,SIDE:m,R:h}=a,{hull:[g,,_],deck:v}=t,{cy:y,px:x}=ar(t),[S,C]=[g+n,g+r],w=(e,t)=>[_+e*Math.cos(t),y+e*Math.sin(t)],T=[[i,v+o-y],[-i,v+o-y],[-i,v-y],[i,v-y]].map(([e,t])=>(Math.atan2(t,e)+tr)%tr),E=[...Array.from({length:49},(e,t)=>t*tr/nr),...T].sort((e,t)=>e-t),ee=e=>{let[t,n]=[Math.cos(e),Math.sin(e)],r=Math.min(Math.abs(t)>1e-9?i/Math.abs(t):1/0,n>1e-9?(v+o-y)/n:n<-1e-9?(v-y)/n:1/0);return[_+r*t,y+r*n]};for(let t=0;t+1<E.length;t++){let[n,r]=[E[t],E[t+1]];if(r-n<1e-6)continue;let i=[w(h,n),w(h,r),ee(r),ee(n)],a=([e,t],n)=>[n,t,e];rr(e,a(i[0],x),a(i[1],x),a(i[2],x),a(i[3],x),Wn),rr(e,a(i[3],x+.5),a(i[2],x+.5),a(i[1],x+.5),a(i[0],x+.5),Wn)}let D=(e,t,n)=>{let[r,i]=w(e,t);return[g+Math.sqrt(f.R**2-(r-_)**2)+n,i,r]};for(let t=0;t<nr;t++){let[n,r]=[t*tr/nr,(t+1)*tr/nr],[i,a]=w(h,n),[o,s]=w(h,r);cr(e,[x+.5,a,i],[x+.5,s,o],D(h,r,.3),D(h,n,.3),Gn),cr(e,D(h,n,.3),D(h,r,.3),D(or,r,.15),D(or,n,.15),Jn),cr(e,D(or,n,.15),D(or,r,.15),D(or,r,-.3),D(or,n,-.3),Kn)}for(let t=0;t<nr;t++){let[n,r]=[t*tr/nr,(t+1)*tr/nr];ir(e,[w(h,n),w(h-.7,n),w(h-.7,r),w(h,r)],x-.8,x,Gn),ir(e,[w(h+1.6,n),w(h,n),w(h,r),w(h+1.6,r)],x-.3,x,Kn),ir(e,[w(4.6,n),w(4.1,n),w(4.1,r),w(4.6,r)],x-.4,x,Gn)}for(let t=0;t<9;t++){let[n,r]=[(t+.06)*Math.PI/9,(t+.94)*Math.PI/9];ir(e,[w(h+3,n),w(h+1.7,n),w(h+1.7,r),w(h+3,r)],x-1.2,x,Gn),ir(e,[w(h+2.8,n),w(h+1.9,n),w(h+1.9,r),w(h+2.8,r)],x-1.25,x,Qn,-2)}for(let t=0;t<8;t++){let n=t*tr/8+tr/16,[r,i]=[Math.cos(n),Math.sin(n)],a=.18,o=(e,t)=>[_+e*r-t*i,y+e*i+t*r];ir(e,[o(h-.6,a),o(4.4,a),o(4.4,-.18),o(h-.6,-.18)],x-.3,x,Gn)}let te=(c-s)/l;for(let t=0;t<l;t++){let[n,r]=[g+s+te*t,v+d*(t+1)/l];Z(e,[n-.02,r-.08,_-u+.1],[n+.06,r-.02,_+u-.1],Zn,-2)}for(let t of[-1,1]){let n=_+t*(u-.15),r=g+s+.3;Q(e,[r,v+1.1,n],[g+c,v+d+1.1,n],.05,qn);for(let t=r;t<g+c;t+=1.5){let r=v+d*(t-g-s+te)/(c-s);Q(e,[t,Math.min(r,v+d),n],[t,Math.min(r,v+d)+1.1,n],.04,qn)}let a=_+t*(m+.15);for(let[n,r]of[[[g+p+.15,a],[g+c+.15,a]],[[g+c+.15,a],[g+c+.15,_+t*u]],[[g+p+.15,a],[g+p+.15,_+t*(i-.3)]]]){Q(e,[n[0],v+d+1.1,n[1]],[r[0],v+d+1.1,r[1]],.05,qn);let t=Math.max(1,Math.round(Math.hypot(r[0]-n[0],r[1]-n[1])/1.5));for(let i=0;i<=t;i++){let[a,o]=[n[0]+(r[0]-n[0])*i/t,n[1]+(r[1]-n[1])*i/t];Q(e,[a,v+d,o],[a,v+d+1.1,o],.04,qn)}}let l=_+t*i,f=e=>t<0?[l,l+e]:[l-e,l];for(let t=S+1.5;t<C-.5;t+=3){let[n,r]=f(.7);Z(e,[t-.3,v,n],[t+.3,v+o,r],Kn)}let[h,y]=f(1.1);Z(e,[S,v+19,h],[C,v+19.6,y],Kn);let[b,x]=f(.05);for(let t=S+4.6;t<g+c;t+=3)Z(e,[t-1.1,v+8,b],[t+1.1,v+12,x],Qn,-2),Z(e,[t-1.1,v+22,b],[t+1.1,v+26,x],$n,-2);let[w,T]=f(1.1);Z(e,[g+p+.6,v+d,w],[g+c-.4,v+d+1,T],Yn);for(let t=g+p+1;t<g+c-1.8;t+=2.3)Z(e,[t,v+d+1.4,b],[t+1.9,v+d+2.6,x],$n,-2);let[E,ee]=f(.25);Z(e,[S,v+.05,E],[g+p,v+.15,ee],Zn,-2);let D=_+6*t;Z(e,[g+37.4,v+d,D-.6],[g+38.6,v+d+1.2,D+.6],Yn),Z(e,[g+37.3,v+d+1.2,D-.7],[g+38.7,v+d+1.3,D+.7],Qn,-2);let O=_+3*t;Q(e,[g+36,v+o,O],[g+36,v+18,O],.25,Gn),Q(e,[g+36,v+18,O],[g+38,v+14,O],.2,Gn),Z(e,[g+37.6,v+13.4,O-.4],[g+38.4,v+14,O+.4],er,-2)}((e,t)=>{let[n,r]=t.post,[i,a]=[n[1],(n[2]+r[2])/2];Z(e,[n[0]+.15,i,n[2]+.15],[r[0]-.1,i+.12,r[2]-.15],In),Z(e,[n[0]+.2,i+.12,n[2]+.1],[r[0]-.05,i+.95,r[2]-.1],Pn);for(let t=0;t<6;t++){let a=i+.32+.08*t;Z(e,[n[0]+.17,a,n[2]+.45],[n[0]+.2,a+.03,r[2]-.45],In)}Z(e,[n[0]+.16,i+.15,n[2]+.3],[n[0]+.2,i+.19,r[2]-.3],Vn[0],-2),Z(e,[n[0],i+.95,n[2]],[r[0],r[1],r[2]],Fn),Z(e,[n[0]-.02,i+1.01,n[2]+.05],[n[0],i+1.04,r[2]-.05],Bn,-2);for(let t of[-1,1])for(let i=0;i<4;i++)for(let o=0;o<6;o++){let[s,c]=[n[0]+.14+.19*i,a+t*(.5+.15*o)],l=Un(i+4*t,o),[u,d]=l<.3?[Vn[Math.floor(13*l)%4],-2]:[Ln,-1];Z(e,[s,r[1],c-.055],[s+.13,r[1]+.035,c+.055],u,d)}let o=b(t);Hn(e,o,.31,r[1],r[1]+.02,Rn),Hn(e,o,.25,r[1],r[1]+.035,In);let s=r[0]-.6;Z(e,[s,r[1],n[2]+.05],[r[0]-.05,i+2.4,r[2]-.05],Pn),Z(e,[s-.02,i+1.35,a-.65],[s,i+2.15,a+.65],zn,-2);for(let t=1;t<4;t++){let n=i+1.35+.2*t;Z(e,[s-.03,n,a-.6],[s-.02,n+.012,a+.6],Bn,-2);let r=a-.65+.325*t;Z(e,[s-.03,i+1.4,r],[s-.02,i+2.1,r+.012],Bn,-2)}for(let[t,n]of[[-1,Vn[1]],[1,Vn[2]]]){let[r,o]=[a+.8*t,a+1.35*t];Z(e,[s-.02,i+1.5,Math.min(r,o)],[s,i+2,Math.max(r,o)],n,-2)}for(let t=0;t<8;t++){let n=a-1.2+.33*t;Z(e,[s-.04,i+2.22,n-.05],[s,i+2.3,n+.05],Vn[t%2?1:0],-2)}Z(e,[s-.1,i+2.4,n[2]],[r[0]+.05,i+2.5,r[2]],Fn);for(let t of[-1,1])Q(e,[r[0]-.05,i+.5,a+.9*t],[r[0]+.5,i+.04,a+1.2*t],.06,In)})(e,t);let[O,k]=[g+39.6,v+d];Z(e,[O-.3,k,_-.3],[O+.3,k+.45,_+.3],Yn),Z(e,[O-.45,k+.45,_-.45],[O+.45,k+.6,_+.45],Xn),Z(e,[O-.6,k+.6,_-.5],[O-.45,k+2.2,_+.5],Xn);for(let t of[-1,1])Z(e,[O-.45,k+.6,_+.45*t-.07],[O+.4,k+.9,_+.45*t+.07],Xn);for(let t of[-1,1])Z(e,[S,v,_+3.2*t-.12],[S+.08,v+3.4,_+3.2*t+.12],Zn,-2);Z(e,[S,v+3.3,_-3.3],[S+.08,v+3.45,_+3.3],Zn,-2),Z(e,[S,v+19,_-i],[S+1.1,v+19.6,_+i],Kn);for(let t=S+1.5;t<C-.5;t+=3)Z(e,[t-.3,v+o-1.2,_-i],[t+.3,v+o,_+i],Kn),t+1.5<C-1&&Z(e,[t+1.1,v+o-.15,_-4],[t+1.9,v+o-.05,_+4],er,-2)})(o,e),o})(e.station))),yield,{land:r,sky:Tn(),heavens:Qt,glaze:Ct}}export{Pr as default};
@@ -0,0 +1,6 @@
1
+ import type { V, Mat } from './types';
2
+ /**
3
+ * The back at its foot `p`, its axes `bk` (ax[0] ahead, ax[1] up it, ax[2] across): the front in
4
+ * `front`, the back and the sides in `rear`.
5
+ */
6
+ export declare const back: (p: V, bk: V[], front: Mat, rear: Mat) => void;
@@ -1,4 +1,4 @@
1
- /** The captain, seated with the middle of his seat's cushion at (x, y, z) (y the cushion's top). */
1
+ /** The captain, seated with the middle of his seat's cushion at (x, y, z) (y the cushion's top), facing +x. */
2
2
  export declare const captain: (x: number, y: number, z: number) => void;
3
- /** The captain's cap on the floor at (x, y, z), turned `t` round the vertical: its crown, the black peak, the badge. */
3
+ /** The captain's cap on the floor at (x, y, z), turned `t` round the vertical: its domed crown, the black peak rounded at its front, the round badge. */
4
4
  export declare const cap: (x: number, y: number, z: number, t: number) => void;
@@ -1,6 +1,12 @@
1
1
  import type { V, Mat } from './types';
2
- /** A tube from a to b, w across: three sides and no ends, enough at arm's length. */
3
- export declare const rod: (a: V, b: V, w: number, m: Mat) => void;
2
+ /** A tube from a to b, w across: `n` sides (three, enough at arm's length) and no ends. */
3
+ export declare const rod: (a: V, b: V, w: number, m: Mat, n?: number) => void;
4
+ /**
5
+ * A ball at c, its radii along the axes `ax` (r[0] ahead, r[1] up, r[2] across: a knob, a
6
+ * crown, its lower half sunk in the floor), `lat` rings from pole to pole and `lon` points
7
+ * round each, the poles on ax[1].
8
+ */
9
+ export declare const ball: (c: V, ax: V[], r: V, m: Mat, lat?: number, lon?: number) => void;
4
10
  /** A box in the frame of `o` and its axes `ax`, from `lo` to `hi` along them: its faces less those of `skip` (bits as box()'s: 4 the bottom), the top (+ax[1]) in `top`. */
5
11
  export declare const cube: (o: V, ax: V[], lo: V, hi: V, m: Mat, top?: Mat, skip?: number) => void;
6
12
  /**
@@ -2,7 +2,7 @@ import type { StationDef } from '../shared/station';
2
2
  import type { Light } from './lights';
3
3
  import type { Vec3 } from './mesh';
4
4
  /**
5
- * The station's lamps as lights, while the eye is near it: three under the hangar's roof and one in
5
+ * The station's lamps as lights, while the eye is near it: three under the hangar's roof and one high in
6
6
  * the command room, cold white; red and pulsing while a strike counts down (`alarm`).
7
7
  */
8
- export declare const lamps: ({ hall: [lo], post, hull: [cx, , cz] }: StationDef, eye: Vec3, alarm: boolean, t: number) => Light[];
8
+ export declare const lamps: ({ hull: [cx, , cz], deck: Y }: StationDef, eye: Vec3, alarm: boolean, t: number) => Light[];
@@ -1,8 +1,4 @@
1
1
  import type { SocketLike } from '../../shared/types';
2
- /**
3
- * The game on one map, talking through `ws`: the scene, the HUD, the input, the sound. `progress`
4
- * hears each step of STEPS (loading.ts) as it starts, then STEPS.length once the first frame is drawn.
5
- */
6
2
  export declare const play: (container: HTMLElement, key: string, ws: SocketLike, quit?: () => void, progress?: (step: number) => void, period?: number, cast?: boolean, voices?: boolean, look?: import("../render").Decor) => {
7
3
  destroy(): void;
8
4
  };
@@ -4,7 +4,6 @@ export declare const satellite: (def: StationDef) => number[];
4
4
  * The station's inside (the user, 2026-11-14): pipes along the hangar's walls and ducts under its
5
5
  * roof, a painted landing circle with its lights where each team's ship sets down (sortie.ts lands
6
6
  * there), the way out to space lit (a green bar across each mouth's edge and up its sides, amber
7
- * chevrons on the deck toward it), lamps under the roof, and in the command room consoles with
8
- * glowing screens. The hangar's x0..x1 inside its walls, its mouths at z0 and z1.
7
+ * chevrons on the deck toward it), lamps under the roof, and the command room (station/command.ts). The hangar's x0..x1 inside its walls, its mouths at z0 and z1.
9
8
  */
10
- export declare const hangar: ({ hall: [lo], post, hull: [cx, , cz] }: StationDef) => number[];
9
+ export declare const hangar: (def: StationDef) => number[];
@@ -0,0 +1,10 @@
1
+ import type { StationDef } from '../../shared/station';
2
+ import type { Vec3 } from '../mesh';
3
+ import type { Out } from '../verts';
4
+ /** The cap at `at` (its foot), `h` high, onto o. */
5
+ export declare const cap: (o: Out, at: Vec3, h: number, rgb: number[]) => void;
6
+ export interface Button {
7
+ /** The button and the beacons near `eye`, the station in `phase`, `t` s, `dt` s since the last. */
8
+ draw(o: Out, eye: Vec3, phase: number, t: number, dt: number): void;
9
+ }
10
+ export declare const createButton: (def: StationDef) => Button;
@@ -0,0 +1,11 @@
1
+ import type { StationDef } from '../../shared/station';
2
+ import type { Out } from './kit';
3
+ /**
4
+ * Whether a hull facet over z0..z1 and y0..y1, its middle at x, is left out for the window: on the
5
+ * window's side, any of it within the pane's radius of the window's middle.
6
+ */
7
+ export declare const cut: (def: StationDef, x: number, z0: number, z1: number, y0: number, y1: number) => boolean;
8
+ /** Whether a piece on the hull at (x, z), height y, half `pad` wide, would stand on the collar. */
9
+ export declare const hole: (def: StationDef, x: number, z: number, y: number, pad: number) => boolean;
10
+ /** The command room's dressing, onto o. */
11
+ export declare const command: (o: Out, def: StationDef) => void;
@@ -0,0 +1,4 @@
1
+ import type { StationDef } from '../../shared/station';
2
+ import type { Out } from './kit';
3
+ /** The computer round the console's box, onto o. */
4
+ export declare const computer: (o: Out, def: StationDef) => void;
@@ -5,5 +5,5 @@ export declare const PLATE: number[];
5
5
  /** The grey bands of the wall: where the gold foil is not (the hangar's floor to its top, then the cap). */
6
6
  export declare const foiled: (y: number, deck: number, y1: number) => boolean;
7
7
  /** Adds the plated hull's detail to `o`, and returns it. */
8
- export declare const plating: ({ hall: [lo], post, hull: [cx, y0, cz, y1] }: StationDef, o?: Out) => Out;
8
+ export declare const plating: (def: StationDef, o?: Out) => Out;
9
9
  export {};
@@ -0,0 +1,9 @@
1
+ import type { Vec3 } from '../mesh';
2
+ export type Out = number[];
3
+ export declare const vert: (o: Out, p: Vec3, n: Vec3, rgb: number[], layer: number) => number;
4
+ /** A box from a to b with outward normals, a flat colour on layer `layer`. */
5
+ export declare const slab: (o: Out, a: Vec3, b: Vec3, rgb: number[], layer?: number) => void;
6
+ /** smooth() of a profile, `sides` round, in a flat colour on `layer`. */
7
+ export declare const lathed: (profile: [number, number][], rgb: number[], layer: number, sides: number) => number[];
8
+ /** A round bar of radius r from a to b. */
9
+ export declare const bar: (o: Out, a: Vec3, b: Vec3, r: number, rgb: number[], layer?: number) => void;
@@ -40,7 +40,7 @@ export declare const SORTIE: {
40
40
  LAND: number;
41
41
  };
42
42
  /** A team's way into the station: in front of its mouth (red's is the +z one), then down on the deck inside. */
43
- export declare const approach: ({ hull: [cx, , cz], post }: StationDef, team: number) => [Vec3, Vec3];
43
+ export declare const approach: ({ hull: [cx, , cz], deck }: StationDef, team: number) => [Vec3, Vec3];
44
44
  /**
45
45
  * The keys and look that fly the ship `r` toward `to`: the nose on it, thrust while it points there
46
46
  * and the speed is under what it asks (all it can far away, easing to a stop when `stop`), the
@@ -8,6 +8,8 @@ type Vec3 = [number, number, number];
8
8
  */
9
9
  export interface StationDef {
10
10
  post: [min: Vec3, max: Vec3];
11
+ /** The height of the hangar's deck and of the command room's floor. */
12
+ deck: number;
11
13
  hall: [min: Vec3, max: Vec3];
12
14
  /** The satellite's cylinder (HULL.R wide): its axis at (x, z), from y0 to y1. */
13
15
  hull: [x: number, y0: number, z: number, y1: number];
@@ -33,14 +35,41 @@ export declare const STATION: {
33
35
  COOL: number;
34
36
  RECALL: number;
35
37
  };
38
+ /** Where the console's red button stands on its desk (client/station/): its middle and the desk's top. */
39
+ export declare const knob: ({ post: [lo, hi] }: StationDef) => Vec3;
36
40
  /** True when the feet of `p` are within STATION.REACH of the console's sides, at its foot. */
37
41
  export declare const reaches: ({ post: [min, max] }: StationDef, { x, y, z }: PlayerState) => boolean;
38
42
  /** True when (x, y, z) is inside the station. */
39
43
  export declare const inside: ({ hall: [min, max] }: StationDef, x: number, y: number, z: number) => boolean;
44
+ /**
45
+ * The command room east of the hangar (the user, 2026-11-27, after a picture of a throne room): from
46
+ * the hangar's east wall (X0) to the window (X1) over the station's axis, Z either side of its middle
47
+ * along z, H high. A flight of steps (STEPS of RISE, from STAIR0 to STAIR1, W either side) climbs to
48
+ * the dais (from STAIR1 to the window, DAIS high, the console on it); galleries as high stand along
49
+ * the side walls from GALLERY to STAIR1, from SIDE out. The window is a round pane in the east wall,
50
+ * R across, its middle UP over the dais, which shows space: the wall there is a ghost, the hull cut.
51
+ */
52
+ export declare const COMMAND: {
53
+ X0: number;
54
+ X1: number;
55
+ Z: number;
56
+ H: number;
57
+ STAIR0: number;
58
+ STAIR1: number;
59
+ STEPS: number;
60
+ W: number;
61
+ DAIS: number;
62
+ GALLERY: number;
63
+ SIDE: number;
64
+ R: number;
65
+ UP: number;
66
+ };
40
67
  /** The hangar and the command room, each [min, max]: shut but for the hangar's mouths (station()). */
41
- export declare const rooms: ({ hull: [x, , z], post: [[, Y]] }: StationDef) => [Vec3, Vec3][];
68
+ export declare const rooms: ({ hull: [x, , z], deck: Y }: StationDef) => [Vec3, Vec3][];
69
+ /** The command room's window: the square round its pane, four corners on the east wall. */
70
+ export declare const vista: ({ hull: [x, , z], deck: Y }: StationDef) => Vec3[][];
42
71
  /** The hangar's two mouths, between its side walls and under the lintels: four corners each. */
43
- export declare const mouths: ({ hull: [x, , z], post: [[, Y]] }: StationDef) => Vec3[][];
72
+ export declare const mouths: ({ hull: [x, , z], deck: Y }: StationDef) => Vec3[][];
44
73
  export declare class Station {
45
74
  phase: number;
46
75
  /** The team that armed the mission (ARMED, STRUCK). */
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@korial29/tiny-fps",
3
3
  "description": "Tiny multiplayer first-person rooftop game for the browser: raw WebGL, zero runtime dependencies, WebSocket or same-browser multi-tab play.",
4
4
  "license": "Apache-2.0",
5
- "version": "1.18.0",
5
+ "version": "1.19.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"
@@ -1 +0,0 @@
1
- var e,t={HOME:0,CARRIED:1,DROPPED:2},n={FORWARD:1,BACK:2,LEFT:4,RIGHT:8,JUMP:16,SPRINT:32,DASH:64,CROUCH:128,FIRE:256,BLADE:512,SPECIAL:1024,RAIL:2048,RELOAD:4096,RIFLE:8192,USE:16384,FISTS:32768},r={THRUST:0,LEFT:1,RIGHT:2,SLASH:3,LUNGE:4,ARC_L:5,ARC_R:6,LEAP:7},i={NONE:0,HEAD:1,ARM_L:2,ARM_R:3,LEG_L:4,LEG_R:5,EATEN:6,BURST:7},a={PLAIN:0,SHOT:1,STRUCK:2},o={GROUND:0,AIR:1,WALLRUN:2,HANG:3,CLIMB:4,SLIDE:5,CROUCH:6,RIDE:7,CLING:8,SWIM:9},s={JUMP:1,DOUBLE:2,DASH:4,LAND:8,GRAB:16,CLIMB:32,WALLRUN_START:64,WALLRUN_END:128,SLIDE_START:256,SLIDE_END:512,RESPAWN:1024},c={BRICK:0,TILE:1,LAVA:2,STONE:3,METAL:4,WOOD:5,MOSS:6,GRATE:7,CONCRETE:8,GLASS:9,STEEL:10,PAINT:11,ROCK:12,FABRIC:13,HIDE:14,HULL:15},l=(e,t,n,r,i,a=c.CONCRETE)=>({min:[e,-30,t],max:[n,i,r],top:c.CONCRETE,side:a}),u=([e,t,n],[r,i,a],o,s=o,c)=>({min:[e,t,n],max:[r,i,a],top:o,side:s,tint:c}),d=(l(4,57.7,24,76,10),l(4,36,24,53.5,10,c.GLASS),l(4,20,24,36,12.4),l(4,-5,24,7,12.4,c.GLASS),l(27,20,47,50,8),l(27,60,47,76,8,c.BRICK),u([9,12.2,39],[19,12.6,47],c.STEEL),[1,2,3,4,5,6].map(e=>u([12,10,53-e],[14,10+.4*e,53-e+1],c.CONCRETE)),u([5,10,42],[5.5,14,42.5],c.STEEL),u([5,10,50],[5.5,14,50.5],c.STEEL),u([8,12.4,24],[20,12.85,24.45],c.STEEL),u([36,8,22],[37,14.5,48],c.PAINT,c.PAINT,[.15,.72,.62]),u([30,8,28],[34,10,32],c.CONCRETE),u([40,8,30],[44,10.2,34],c.PAINT,c.PAINT,[1,.3,.06]),u([28,9.2,44],[35,12,46],c.STEEL,c.PAINT,[.2,.42,1]),u([41.5,7.6,50],[42,8,60],c.STEEL),u([30,8,64],[34,9.6,68],c.PAINT,c.PAINT,[.2,.8,.3]),240),f=[1,.22,.26],p=[.2,.46,1],m=[f,p],h=[1,.42,.08],g=[.12,.7,.62],_=(e,t,n,r,i,a,o)=>u([e,t,n],[r,i,a],c.PAINT,c.PAINT,o),v=(e,t,n,r,i,a,o,s=-30)=>{let l=Math.ceil((o-a)/.46);return Array.from({length:l},(d,f)=>{let[p,m]=[t+(n-t)*f/l,t+(n-t)*(f+1)/l].sort((e,t)=>e-t),h=a+(o-a)*(f+1)/l;return e===0?u([p,s,r],[m,h,i],c.CONCRETE):u([r,s,p],[i,h,m],c.CONCRETE)})},y=(e,t,n,r,i,a,o)=>o.map((o,s)=>u([e+s*n,a,t+s*r],[e+s*n+4,o,t+s*r+i],c.STEEL,c.CONCRETE)),b=[l(12,212,52,240,26,c.GLASS),_(12,26,212,52,26.12,212.5,f),_(12,26,239.5,52,26.12,240,f),_(12,26,212.5,12.5,26.12,239.5,f),_(51.5,26,212.5,52,26.12,239.5,f),_(11.6,12,222,12,25.8,232,f),_(28,12,211.4,31,25.5,212,f),u([19,26,222],[22,27.4,225],c.STEEL),u([42,26,222],[45,27.4,225],c.STEEL),u([29,26,229],[35,27.1,229.6],c.CONCRETE),l(6,164,26,201,26,c.GLASS),l(6,134,26,147,26,c.GLASS),l(6,201,26,212,19),l(15,147,26,164,19),u([14,26,164],[15,32,196],c.PAINT,c.PAINT,g),u([14,18,147],[15,32,164],c.PAINT,c.PAINT,g),u([14,26,134],[15,32,147],c.PAINT,c.PAINT,g),...y(6,201,7,0,4,19,[21.2,23.4,25]),...[[18,152,22,156,21.2],[18,158,22,162,23.4],[23,160,26,164,25]].map(([e,t,n,r,i])=>u([e,19,t],[n,i,r],c.STEEL,c.CONCRETE)),u([20,26,178],[23,27.3,181],c.STEEL),u([8,26,176],[11,27.2,179],c.STEEL),u([8,26,190],[11,27.3,193],c.STEEL),u([20,26,140],[23,27.3,143],c.STEEL),l(32,186,76,209,19),_(32,19,207.5,76,19.1,209,f),...y(33,209,7,0,3,19,[21.2,23.4,25]),...[[28,196,32,200,21.2],[28,190,32,194,23.4],[26,184,30,188,25]].map(([e,t,n,r,i])=>u([e,-30,t],[n,i,r],c.STEEL,c.CONCRETE)),l(32,166,64,182,21.2,c.GLASS),l(32,140,64,161,19),u([40,21.2,172],[44,22.6,176],c.STEEL),u([52,19,148],[57,20.3,151],c.STEEL),u([38,19,196],[41,20.4,199],c.STEEL),u([60,19,200],[63,20.4,203],c.STEEL),u([52,19,190],[58,20.6,194],c.STEEL),u([66,19,204],[72,20.2,207],c.STEEL),u([56,21.2,170],[60,22.4,174],c.STEEL),u([34,19,152],[37,20.3,156],c.STEEL),...y(36,135,18,0,3,15,[17.2,17.2]),...y(6.5,129,6,0,4,15,[17.2,19.4,21.6,23.8]),l(76,213,100,240,14.5,c.STEEL),_(76,14.5,238.5,100,14.6,240,f),l(76,185,100,209,14.5),l(76,138,100,181,14.5,c.GLASS),u([80,15.7,158],[96,17.7,162],c.STEEL,c.PAINT,h),u([82,14.5,234],[85,15.9,237],c.STEEL),u([91,14.5,190],[94,15.9,193],c.STEEL),u([80,14.5,204],[83,15.6,207],c.STEEL),u([78,14.5,170],[81,15.9,173],c.STEEL),u([92,14.5,146],[95,15.7,149],c.STEEL),u([92,14.5,222],[96,15.8,226],c.STEEL),...v(0,76,52,226,232,14.5,26),...v(0,85,76,196,202,14.5,19,14.5)],x=[l(6,106,62,134,15),l(62,106,100,134,14.5),u([34,15,112],[54,17.2,128],c.CONCRETE),_(38,17.2,116,50,17.3,124,h),...[[35,113],[35,126.2],[51,113],[51,126.2]].map(([e,t])=>u([e,17.2,t],[e+.8,21.5,t+.8],c.STEEL)),u([34.6,21.5,112.6],[52.2,21.9,127.4],c.GLASS),u([14,15,114],[17,16.5,117],c.STEEL),u([14,15,123],[17,16.5,126],c.STEEL),u([56,15,114],[59,16.5,117],c.STEEL),u([56,15,123],[59,16.5,126],c.STEEL),u([15.35,25.5,106],[15.85,26,134],c.STEEL),u([70,14.5,108],[70.8,38,108.8],c.STEEL),u([70,14.5,131.2],[70.8,38,132],c.STEEL),u([66,14.5,110],[69,15.9,113],c.STEEL),u([66,14.5,127],[69,15.9,130],c.STEEL)],ee=(e,t,n)=>[...[16,22,28,34,40].map(n=>[n,26,t,e]),...[19,31,43].map(t=>[t,26,n,e])],te=[[20,26,190],[48,21.2,172],[48,19,200],[88,14.5,198]],ne=[[21,26,168],[16,26,140],[46,19,144],[36,21.2,178],[58,19,156],[64,19,196],[88,14.5,216],[88,14.5,172],[90,14.5,150]],S=[[19.5,26,179],[46,19,152],[39.5,21.2,172],[88,14.5,186],[88,14.5,207]],re={armor:!0,name:`Highline`,tag:`Rooftops · 94 × 240 m`,lore:`The towers of an old business district, closed for years, far above streets that still have traffic. Two crews of runners have taken the roofs. Three routes cross between them, and a fall takes you back to your tower.`,brushes:[...b,...b.map(e=>({...e,min:[e.min[0],e.min[1],d-e.max[2]],max:[e.max[0],e.max[1],d-e.min[2]],tint:e.tint===f?p:e.tint})),...x],teams:[{base:[32,26,224],spawns:ee(0,236,231),rack:[30.75,26,217],blade:[38,26,217],rail:[18,26,137],rifle:[48,19,156]},{base:[32,26,16],spawns:ee(Math.PI,4,9),rack:[30.75,26,23],blade:[38,26,23],rail:[18,26,103],rifle:[48,19,84]}],packs:[...te,...te.map(([e,t,n])=>[e,t,d-n]),[24,15,112],[24,15,128]],ammo:[...ne,...ne.map(([e,t,n])=>[e,t,d-n]),[12,15,116],[12,15,124]],cells:[...S,...S.map(([e,t,n])=>[e,t,d-n]),[28,15,120]],vests:[[36,17.2,120],[23,26,136],[23,26,104]],floor:-25,sun:{dir:[.8,.6,0],color:[2.6,2.3,1.8]},sky:[[.04,.2,.72],[.72,.86,.98]],fog:[.72,.86,.98,.0035]},C=.4,ie=1.8,ae=1.6,oe=1.55,se=.5,ce=2.4,le=.03,ue=[`Red`,`Blue`],de=[`#ff3d4f`,`#2f80ff`],fe={ticks:20,strike:6,reach:1.4,arc:.6,hp:0,hold:-1,knock:0},pe={JAB:0,CROSS:1,HOOK:2,LUNGE:3,CLAW_L:4,CLAW_R:5},me={ticks:16,strike:5,reach:1.8,arc:.7,hp:2,hold:-1,knock:0},he=[fe,fe,{ticks:28,strike:9,reach:1.5,arc:.9,hp:1,hold:-1,knock:1.4},{ticks:26,strike:7,reach:2.2,arc:.5,hp:1,hold:-1,knock:1.2},me,me],ge=[2,6],_e={STAB:0,SWEEP_L:1,SWEEP_R:2,LASH:3,SPIN:6,LEAP:7},ve=[{ticks:52,strike:26,reach:3.4,arc:.25,hp:ge[0],hold:18,knock:0},{ticks:50,strike:26,reach:2.8,arc:1.1,hp:ge[0],hold:16,knock:0},{ticks:50,strike:26,reach:2.8,arc:1.1,hp:ge[0],hold:16,knock:0},{ticks:54,strike:28,reach:3.1,arc:.4,hp:ge[0],hold:20,knock:0},me,me,{ticks:60,strike:30,reach:2.6,arc:Math.PI,hp:3,hold:18,knock:0},{ticks:63,strike:52,reach:2.8,arc:.6,hp:5,hold:32,knock:0}],[ye,be]=[.75,1],[xe,Se,Ce,we]=[3,2.5,1,120],Te={TICKS:88,REACH:1.3,FIST:.85,CUTS:[26,71],KILLER:1,VICTIM:2},Ee=.12,De=.08,Oe=.16,ke=.5,Ae=.012,je=1.2,Me=[{ticks:28,strike:10,reach:2.65,arc:.3,hp:2,hold:8},{ticks:34,strike:13,reach:2.15,arc:1.2,hp:2,hold:4},{ticks:34,strike:13,reach:2.15,arc:1.2,hp:2,hold:4},{ticks:40,strike:16,reach:2.15,arc:.45,hp:3,hold:11},{ticks:36,strike:12,reach:3.2,arc:.3,hp:3,hold:-1},{ticks:46,strike:20,reach:2.15,arc:.6,hp:3,hold:-1},{ticks:46,strike:20,reach:2.15,arc:.6,hp:3,hold:-1},{ticks:58,strike:40,reach:2.4,arc:.6,hp:4,hold:-1}],[Ne,Pe,Fe]=[1.8,15,60],[Ie,Le,Re]=[2,.5,1.4],[ze,Be,Ve]=[24,15,.6],He=7.5,Ue=.7,We=.3,[Ge,Ke,qe]=[20,4,2.5],Je=.012,Ye={maxPlayers:16,scoreLimit:3,timeLimit:480,map:`highline`},Xe={HP:10,WRECK:300,FADE:60,GRAZE:4,SKID:.92},Ze={SEAM:300,TOP:960,ALT:25e4},{CONCRETE:Qe,HULL:w,STEEL:T,PAINT:$e}=c,E=(e,t,n,r,i,a,o,s=o,c)=>({min:[e,t,n],max:[r,i,a],top:o,side:s,tint:c}),et=(e,t,n,r,i,a)=>({min:[e,t,n],max:[r,i,a]}),tt=22.4,nt=e=>Math.round(10*e)/10,rt=[0,10.5,13.5,15.5,17],it=.4,at=2.48,[D,O]=[.4,2.48],k=[80,236],A=[et(111,0,222,125,5,230),et(96,0,196,110,5,204)],ot=[et(102,0,223.2,111,3.5,227.2),et(98,0,204,102,3.5,227.2)],[[st,,ct],[lt,ut,dt],[ft,,pt],[mt]]=ot.flatMap(e=>[e.min,e.max]),ht=[[19.8,6.7],[16,13.5]],[[gt,_t],[vt,yt]]=ht,j=[[0,-gt,2,3,2.8],[vt,-10.8,2,3.5,2]],bt=[et(k[0]-j[0][2],0,k[1]-gt-1.55,k[0]+j[0][2],j[0][3],k[1]-gt-1.25),et(116.8,0,A[0].max[2]-.3,119.2,O,A[0].max[2]-.1),et(101.8,0,A[1].min[2]+.1,104.2,O,A[1].min[2]+.3)],xt=e=>[...new Map(e.flatMap(([e,t,n,r])=>[1,-1].flatMap(i=>[1,-1].flatMap(a=>[[e,n,t,r],[t,r,e,n]].map(([e,t,n,r])=>[Math.min(i*e,i*t),Math.min(a*n,a*r),Math.max(i*e,i*t),Math.max(a*n,a*r)])))).map(e=>[`${e}`,e])).values()],St=(()=>{let e=tt/Math.SQRT2,t=[...Array.from({length:Math.ceil(e**2/13.53)},(e,t)=>Math.round(100*Math.sqrt(13.53*t))/100),_t,yt,j[0][2],nt(-j[1][1]-j[1][2]),nt(-j[1][1]+j[1][2])],n=[.../* @__PURE__ */ new Set([...t.filter(t=>t<e),e])].sort((e,t)=>e-t),r=[...ht,...ht.map(([e,t])=>[t,e])];return n.slice(1).flatMap((e,t)=>{let i=n[t],a=Math.max(...r.filter(([,e])=>e>i).map(([e])=>e)),o=(s=Math.sqrt(tt*tt-i*i),Math.ceil(100*s)/100);var s;return a<e?[[i,i,e,e],[e,i,o,e]]:[[a,i,o,e]]})})(),Ct=([e,t,n,r])=>j.find(([i,a,o])=>Math.abs(i)>Math.abs(a)?e<=i&&i<=n&&a-o-1e-6<=t&&r<=a+o+1e-6:t<=a&&a<=r&&i-o-1e-6<=e&&n<=i+o+1e-6)?.[3]??0,M=([e,t,n,r],i,a,o=Qe,s=o)=>({...E(k[0]+e,i,k[1]+t,k[0]+n,a,k[1]+r,o,s),ghost:!0}),wt=(e,t,n,r,i,a,o)=>{let s=Math.ceil((o-a)/.46);return Array.from({length:s},(c,l)=>{let[u,d]=[t+(n-t)*l/s,t+(n-t)*(l+1)/s].sort((e,t)=>e-t),f=a+(o-a)*(l+1)/s;return e?E(r,a,u,i,f,d,Qe):E(u,a,r,d,f,i,Qe)})},Tt=[...xt([[12,-yt,vt,yt],[vt,-_t,gt,_t]]).filter(e=>e[1]>-gt).map(e=>M(e,3.1,3.5,w,T)),...wt(2,k[1]+5.6,k[1]+12,k[0]-1.5,k[0]+1.5,0,3.5).map(e=>({...e,ghost:!0})),M([-3,19,3,gt],3.5,4.6,T,w),M([-9,12,-2.5,12.5],3.5,4.6,T,$e),M([2.5,12,9,12.5],3.5,4.6,T,$e),M([-9.5,-10,-7.5,-8],0,1.4,T),M([7.5,-10,9.5,-8],0,1.4,T),M([7.5,3,10,5.5],0,2.4,T)],Et={BENCH:0,CONSOLE:1,RACKS:2,SCOPE:3,ANALYSER:4,PLANTS:5,LOCKERS:6,SUIT:7},{BENCH:Dt,CONSOLE:Ot,RACKS:kt,SCOPE:At,ANALYSER:jt,PLANTS:Mt,LOCKERS:Nt,SUIT:Pt}=Et,Ft=[[Dt,60.2,230.5,61.2,241.5,0,.95,0],[Ot,64.25,234.5,67.25,237.5,0,1,0],[kt,98.8,229.3,99.8,234.3,0,3.1,2],[kt,98.8,237.7,99.8,242.7,0,3.1,2],[At,68.9,250.8,70.1,252,3.5,4.5,3],[jt,89.4,250.8,91.4,252,3.5,4.8,3],[Mt,115,222.4,121,223.2,0,2,1],[Mt,123.8,226.4,124.6,229.6,0,2,2],[Nt,96.4,200.4,97,203.6,0,2.1,0],[Pt,108.6,197.4,109.6,198.4,0,2,2]],It=(e,t,n,r,i,a,o=[])=>{let s=(t,n,o)=>e?E(r,o,t,i,a,n,Qe):E(t,o,r,n,a,i,Qe);return[...o,[n,n]].flatMap(([e,n],r,i)=>[s(r?i[r-1][1]:t,e,0),...n>e?[s(e,n,O)]:[]])},Lt=({min:[e,,t],max:[n,r,i]},a,o)=>[E(e,4,t,n,r,i,w,Qe),...It(0,e,n,t,t+D,4,a[0]),...It(0,e,n,i-D,i,4,a[1]),...It(2,t+D,i-D,e,e+D,4,a[2]),...It(2,t+D,i-D,n-D,n,4),o],Rt=[1,.42,.08],zt=[...rt.slice(2).flatMap((e,t)=>{return(n=(e=>e<5?tt:tt*Math.sqrt(1-((e-5)/12)**2))(rt[t+1])+.2,[[1,.39],[.93,.71],[.71,.93],[.39,1]].map(([e,t])=>[nt(e*n),nt(t*n)])).map(([n,r])=>M([-n,-r,n,r],rt[t+1],e));var n}),...xt(St).flatMap(e=>(e=>{let[t,n,r,i]=e,[a,o,s]=[ft-k[0],pt-k[1],ct-k[1]];return t<a&&a<r+1&&o<i&&n<s?[[[t,n,a,i],0],...r>a?[[[a,n,r,i],ut]]:[]]:[[e,Ct(e)]]})(e).map(([e,t])=>M(e,t,rt[1]))),...Tt,...Ft.map(([,e,t,n,r,i,a])=>({...E(e,i,t,n,a,r,T),ghost:!0})),...Lt(A[0],[[[118,118]],[[116.8,119.2]],[[ct+D,dt-D]]],E(121.5,0,223.5,123.5,1.2,225.5,$e,$e,Rt)),...Lt(A[1],[[[101.8,104.2]],[[ft+D,mt-D],[105.8,105.8]]],E(106,0,200.6,108,1.2,202.6,$e,$e,Rt)),E(st,O,ct,lt,ut,dt,T,w),E(ft,O,pt,mt,ut,dt,T,w),E(ft,0,dt-D,lt,O,dt,w),E(mt-D,0,ct,lt,O,ct+D,w),E(ft,0,pt,ft+D,O,ct,w),E(mt-D,0,pt,mt,O,ct,w),...wt(2,214,ct,105,109,0,3.5),...wt(0,108,mt,206,210,0,3.5)],Bt=(e,t,n)=>{let r=Math.imul(e,374761393)+Math.imul(t,668265263)+Math.imul(n,144665)|0;return r=Math.imul(r^r>>>13,1274126177),((r^r>>>16)>>>0)/4294967296},N=(e,t,n)=>{let[r,i]=[Math.floor(e),Math.floor(t)],[a,o]=[e-r,t-i].map(e=>e*e*(3-2*e)),s=(e,t)=>Bt(r+e,i+t,n);return(s(0,0)*(1-a)+s(1,0)*a)*(1-o)+(s(0,1)*(1-a)+s(1,1)*a)*o},Vt=/* @__PURE__ */ new WeakMap,Ht=e=>{let t=Vt.get(e);if(t)return t;let{hole:n,bound:r,cell:i,at:a,pits:o=[],origin:[s,c]=[0,0]}=e,l=o.reduce((e,t)=>[Math.min(e[0],t[0]),Math.min(e[1],t[1]),Math.max(e[2],t[2]),Math.max(e[3],t[3])],[1/0,1/0,-1/0,-1/0]),[u,d,f,p]=r,m=Math.floor((u-f-s)/i)*i+s,h=Math.floor((d-p-c)/i)*i+c,g=Math.ceil((u+f-m)/i)+1,_=Math.ceil((d+p-h)/i)+1,v=new Float32Array(g*_),y=-1/0;for(let e=0;e<_;e++)for(let t=0;t<g;t++)v[t+e*g]=a(m+t*i,h+e*i),y=Math.max(y,v[t+e*g]);let b=new Uint8Array(g*_);for(let[e,t,n,r]of o)for(let a=Math.floor((t-h)/i)-1;a<=Math.floor((r-h)/i)+1;a++)for(let t=Math.floor((e-m)/i)-1;t<=Math.floor((n-m)/i)+1;t++)t>=0&&a>=0&&t<g&&a<_&&(b[t+a*g]=1);let x={x0:m,z0:h,cell:i,nx:g,nz:_,h:v,hole:n,pits:o,pitted:b,box:l,bound:r,top:y};return Vt.set(e,x),x},Ut=(e,t,n)=>{let r=e.relief;if(!r||t>r.hole[0]&&t<r.hole[2]&&n>r.hole[1]&&n<r.hole[3])return-1/0;let i=Math.min(Math.max((t-r.x0)/r.cell,0),r.nx-1),a=Math.min(Math.max((n-r.z0)/r.cell,0),r.nz-1),o=Math.min(Math.floor(i),r.nx-2),s=Math.min(Math.floor(a),r.nz-2);if(r.pitted[o+s*r.nx]&&r.pits.some(e=>t>=e[0]&&t<=e[2]&&n>=e[1]&&n<=e[3]))return-1/0;let[c,l]=[i-o,a-s],u=o+s*r.nx,[d,f,p,m]=[r.h[u],r.h[u+1],r.h[u+r.nx],r.h[u+r.nx+1]];return c>=l?d+(f-d)*c+(m-f)*l:d+(p-d)*l+(m-p)*c},Wt=(e,t)=>{if(!t.relief)return;let[n,r,i,a]=t.relief.bound,[o,s]=[(e.x-n)/i,(e.z-r)/a],c=o*o+s*s;if(c<=1)return;let l=1/Math.sqrt(c);e.x=n+o*l*i,e.z=r+s*l*a;let[u,d]=[o*l/i,s*l/a],f=(e.vx*u+e.vz*d)/(u*u+d*d);f>0&&(e.vx-=f*u,e.vz-=f*d)},Gt={READY:0,ARMED:1,STRUCK:2,COOL:3},Kt=({hall:[e,t]},n,r,i)=>n>e[0]&&n<t[0]&&r>e[1]&&r<t[1]&&i>e[2]&&i<t[2],qt=({hull:[e,,t],post:[[,n]]})=>[[[e-24,n,t-$t.R],[e+24,n+14,t+$t.R]],[[e+24,n,t-10],[e+40,n+4,t+10]]],Jt=({hull:[e,,t],post:[[,n]]})=>[t-$t.R,t+$t.R].map(t=>[[e-20,n,t],[e+20,n,t],[e+20,n+11,t],[e-20,n+11,t]]),{METAL:Yt,STEEL:Xt,PAINT:P,GLASS:Zt,GRATE:Qt}=c,F=(e,t,n,r,i,a,o,s=o,c)=>({min:[e,t,n],max:[r,i,a],top:o,side:s,tint:c}),$t={R:44,LOW:-40,TOP:130},I={BARREL:.68,GUN:44,BOOM:16,PANEL:44,SPAN:50,GAP:2,WING:.45,DOME:7,MAST:16},[en,tn]=m,{STONE:L,CONCRETE:nn,METAL:rn,STEEL:an,PAINT:on}=c,sn=({min:e,max:t})=>et(e[0],e[1],280-t[2],t[0],t[1],280-e[2]),cn=[[40,220,13],[13.5,220,13]],ln=[[106.2,230.4],[103.2,212.4]],un=k[1]-2,R=e=>Math.min(Math.max(e,0),1),z=e=>R(e)*R(e)*(3-2*R(e)),B=(e,t)=>Math.sqrt(e*e+t*t),dn=[[-100,0,46,.13,.52],[-4,224,36,.12,.67],[110,236,16],[-112,108,14],[236,170,13],[-52,230,10],[80,184,14],[150,250,13],[-36,168,10],[200,152,12],[262,134,14],[240,150,9],[-140,60,12],[-66,60,9],[40,262,10],[118,200,11]],fn=[[-20,0,-1,0],[192,124,0,-1],[64,236,1,0],[-60,100,0,1]],[pn,mn]=[[248,64],[180,200]],hn=[[12,24],[36,60],[72,88],[124,156]],gn=(()=>{let e=Array.from({length:160},(e,t)=>hn.some(([e,n])=>t>=e-1&&t<=n)?0:Math.min(Math.round(Math.max(26*N(t/17,0,33)+8*N(t/5,0,35)-11,0))/2,6.5));for(let t of[1,-1])for(let n=t>0?1:158;n>=0&&n<160;n+=t)e[n]=Math.min(e[n],e[n-t]+.5);return e.map((e,t)=>{let n=Math.min(t,159-t);return n<4?-6:n<8?-3:e})})(),_n=e=>e.reduce((e,t,n)=>(e.at(-1)?.[2]===t?e.at(-1)[1]++:e.push([n,1,t]),e),[]),vn=_n(gn),V=[114,176,2],yn=[48,144],[bn,xn]=[3,8],Sn=[[27,67,53,93],[.5,67,26.5,93],[56,74,104,133],[96,56,125,90],[98,36,102,40],[28,113,32,117],[30,45,30,45],[135,50,135,50],[50,106,50,106],[35,104,35,104],[115,22,115,22],[45,20,51,62],[114,36,114,36],[141,20,147,66]],Cn=[[0,0,4.5],[-14,6,3],[10,-12,3.5],[16,10,2.5],[-8,-16,2.2],[-20,-8,3.8],[6,18,3],[22,-4,2],[-12,20,2.4]].map(([e,t,n])=>[e-50,t+330,n]),wn=[[126,143,131,147,1.2],[130,138.5,135,141.5,2.4],[126,133,131,137,1.2]],Tn=[[180,340],[173,346],[186,347]],En=[dn[0][0]-4.5,140],Dn=[[6,174,2.5],[32.5,156.5,3.1],[67.5,159.5,1.9],[97.5,166,2.8],[128,177.5,3.4],[94,188,2.5],...Array.from({length:36},(e,t)=>{let n=e=>Bt(t,e,41),r=Math.floor(3*n(1)),[i,a]=r<2?[(r?151:0)+9*n(2),150+122*n(3)]:[5+150*n(2),273+7*n(3)];return[i,a+(r===0&&Math.abs(a-174)<8?16:0),.6+2.4*n(4)*n(4)]}),...Cn],On=(e,t)=>{let n=t=>R((12-Math.abs(t-e))/8)*R((152-t)/4),r=4*Math.floor(t/4);return n(r)+(n(r+4)-n(r))*(t-r)/4},kn=[[8,0,28,16],[70,0,90,16],[122,0,139,16],[36,0,60,16],[132,0,156,16]],An=(e,t)=>{t=Math.abs(t-140);let n=B((e-80)/300,t/360),r=Math.max((n-.78)/.22,0),i=((e,t)=>{let[n,r]=[0,0];for(let[i,a,o,s=.17,c=0]of dn){let l=B(e-i,t-a),[u,d]=l?[(e-i)/l,(t-a)/l]:[1,0],f=l/o*(.9+.2*N(2.5*u+.37*i,2.5*d+.21*a,9)),p=.03+.045*N(4*u-.1*a,4*d+.1*i,10),m=1-R((f-1-4/o)/.6),h=c?(s+p)*R((f-c)/(1-c))-s:(s+p)*f*f-s;n+=o*(f<1?h:p*m*m),r=Math.max(r,c?R((1.6-f)/(1.5-c)):0)}return[n,r]})(e,t),a=Math.max(Math.abs(e-80)-80,t-140),o=z((a-12)/48)*(1-.7*z(r))*(16*N(e/96,t/96,1)+6*N(e/52,t/52,4)+5*N(e/36,t/36,2)+1.4*N(e/22,t/22,3)-14.2);if(a<0){let n=z((t-16-10*N(e/19,.5,37))/8)*z(-a/10);for(let[r,i,a,o]of Sn)n*=z((B(Math.max(r-e,e-a,0),Math.max(i-t,t-o,0))-(r<a?6:7.5))/6);o=n*Math.min(Math.max(4.8*N(e/15,t/15,21)-.9,0)+Math.max(3*N(e/31,t/31,23)-.6,0),2.6);let r=z((10-B(e-V[0],t-(V[1]-140)))/8);o=o*(1-r)-V[2]*r;for(let n of yn)o+=bn*R((8+xn-t)/xn)*On(n,e);o=t<8?0:o}o=(a<0?o:o*(1-i[1]))+i[0]+((e,t,n)=>{let r=(n,r,i)=>n.reduce((n,[a,o,s,c])=>n*z((B(Math.max(a-e,e-s,0),Math.max(o-t,t-c,0))-r)/i),1);if(n<0){let i=Math.min(Math.max(Math.floor(e),6),gn.length-7),a=Math.max(...gn.slice(i-6,i+7),0);return(.6*Math.max(N(e/5,t/5,61)-.42,0)+.25*Math.max(N(e/9,t/9,67)-.5,0))*z(-n/4)*z((t-14-a)/3)*r(Sn.filter(e=>e[0]===e[2]),7.5,2)*r(Sn.filter(e=>e[0]<e[2]),5.7,2)*r(kn,5.7,2)}let i=z(n/4)*(Math.abs(e-80)<96?z((t-10)/6):1);for(let[n,r,a,o]of fn){let[s,c]=[e-n,t-r],l=s*a+c*o;i*=z((B(Math.max(-22-l,l-38,0),Math.max(Math.abs(s*o-c*a)-10,0))-2)/4)}for(let[n,r,a]of dn)i*=z((B(e-n,t-r)/a-1.3)/.25);return i*=z((B(e-mn[0],t-mn[1])-40)/20),(.75*Math.max(N(e/5,t/5,61)-.42,0)-.8*Math.max(N(e/7,t/7,63)-.6,0)+.25*(N(e/11,t/11,65)-.5))*i})(e,t,a)*(1-i[1])*(1-z(r));for(let[n,r,i,a]of fn){let[s,c]=[e-n,t-r],l=s*i+c*a;o+=5.6*R(Math.min(l/16,(32-l)/12))*R((18-Math.abs(s*a-c*i))/12)}let s=R(B(e-pn[0],Math.max(t-pn[1],0))/36);o+=12*(1-s*s)*(1-s*s)+8*z((36-B(e-mn[0],t-mn[1]))/24);let c=10*r*(1+r);if(n>1){let r=28+14*N(e/170,t/170,5)+6*N(e/70,t/70,7),i=10*z((n-1)/.1);c=(c+r-Math.sqrt((c-r)*(c-r)+i*i))/2*(1-z((n-1.3)/.35))}return o*=1-.55*z((16-B(e-44,t-122))/10),Math.max(o,-14.5)+c},jn=e=>Math.max(.3*e,Math.min(.5*e,.8)),Mn=(e,t,n)=>{let r=t=>Bt(e,t,131),i=e=>{let[t,n]=[2*r(e)-1,2*r(e+1)-1],i=Math.sqrt(t*t+n*n)||1;return[t/i,n/i]},[a,o]=i(1),[s,c]=[t*(.9+.25*r(3)),t*(.68+.22*r(4))],l=.3*r(9)-.15,[u,d]=i(5),[f,p]=i(7),m=t=>{let n=.8+.28*N(1.1*t[0]+e,1.1*t[2]+.9*t[1],e)+.1*N(2.3*t[0]-e,2.3*t[2]+1.7*t[1],e+1),r=R((.8*(t[0]*u+t[2]*d)+.6*t[1]-.55)/.45),i=R((.954*(t[0]*f+t[2]*p)+.3*t[1]-.4)/.6);return n*(1-.14*r*r)*(1-.16*i*i)},h=(n-jn(n))/m([0,1,0]),g=jn(n)+.7*n,_=e=>{if(e[1]<0){let t=Math.sqrt(e[0]*e[0]+e[2]*e[2]);return t<1e-6?g:Math.min(_([e[0]/t,0,e[2]/t])/t,g/-e[1])}let t=(e[0]*a+e[2]*o-l*e[1])/s,n=(e[2]*a-e[0]*o-(.15-l)*e[1])/c,r=e[1]*e[1]/(h*h),[i,u]=[t*t+n*n+.65*r,.35*r*r],d=u<1e-12?1/i:(Math.sqrt(i*i+4*u)-i)/(2*u);return Math.sqrt(d)*m(e)};return{reach:_}},Nn=[.16,.3,.16,.3],Pn=({reach:e},t,n,r,i)=>{let a=(n,r)=>{let i=new Float64Array(8*r),a=[0,0,0];for(let o=0;o<8*r;o++){let s=(o%(2*r)+.5)/r-1,c=Math.floor(o/(2*r)),l=Math.sqrt(1+s*s)*(c>1?-1:1),u=(c%2?-s:1)/l,d=(c%2?1:s)/l,f=0,p=1.6*t;for(let t=0;t<8;t++){let t=(f+p)/2,r=Math.sqrt(t*t+n*n);a[0]=t*u/r,a[1]=n/r,a[2]=t*d/r,r<=e(a)+.07?f=t:p=t}i[o]=f}return i},o=(e,t,n)=>{let r=e.length/8,i=Math.abs(t)>=Math.abs(n);if(Math.abs(t)+Math.abs(n)<1e-9)return!0;let a=(1+(i?n/t:-t/n))*r-.5+2*(i?t>0?0:2:n>0?1:3)*r,o=Math.floor(a),s=e[(o+8*r)%(8*r)]*(1-(a-o))+e[(o+1)%(8*r)]*(a-o);return t*t+n*n<=s*s},s=e([0,1,0])-.1,c=Math.max(.07,Math.min(.12,t/12)),l=[],u=r-ie+.7,d=[n];for(let e=n;e<s-1e-9;){let t=e<r-1e-9?Nn[0]:Nn[1],i=a(e+.03,2),o=Math.min(e===n&&u<s-.3?u:e+.25,s);for(;o<s&&o-e<.9&&a(Math.min(o+.1,s),2).every((e,n)=>Math.abs(e-i[n])<=t);)o=Math.min(o+.1,s);e=s-o<.15?s:o,d.push(e)}let f=d.map((e,t)=>a(t?e:e+.03,8));for(let e=0;e+1<d.length;e++){let[t,n]=[d[e],d[e+1]],a=t<r-1e-9?Nn[2]:Nn[3],s=Math.ceil(Math.min(Math.max(...f[e]),Math.max(...f[e+1]))/c)+1,u=2*s+1,p=new Uint8Array(u*u);for(let t=0;t<u;t++)for(let n=0;n<u;n++){let[r,i]=[(t-s)*c,(n-s)*c];p[t+n*u]=o(f[e],r,i)&&o(f[e+1],r,i)?1:0}let m=Math.max(1,Math.round(a/c)),h=(e,t)=>e>=0&&e<u&&t>=0&&t<u&&p[e+t*u]>0,g=new Uint8Array(u*u);for(let e=0;e<u;e++)for(let t=0;t<u;t++)g[e+t*u]=!h(e,t)||h(e-1,t)&&h(e+1,t)&&h(e,t-1)&&h(e,t+1)?0:1;let _=[],v=new Uint8Array(u),y=u>48?2:1;for(let e=0;e<u;e+=y){v.fill(1);for(let t=e;t<u;t++){let n=!1;for(let r=0,i=0;r<=u;r++)v[r]=r<u&&v[r]&&p[t+r*u]?1:0,v[r]||(r-1-i>=2&&t-e>=2&&(t-e)%y===0&&_.push([e,i,t,r-1]),n||=r-1>i,i=r+1);if(!n)break}}let b=new Int32Array((u+1)*(u+1)),x=(e,t,n,r)=>{let[i,a,o,s]=[Math.max(e,0),Math.max(t,0),Math.min(n,u-1)+1,Math.min(r,u-1)+1];return b[o+s*(u+1)]-b[i+s*(u+1)]-b[o+a*(u+1)]+b[i+a*(u+1)]},ee=[];for(let r=0;r<40&&_.length;r++){for(let e=0;e<u;e++)for(let t=0;t<u;t++)b[t+1+(e+1)*(u+1)]=g[t+e*u]+b[t+(e+1)*(u+1)]+b[t+1+e*(u+1)]-b[t+e*(u+1)];let[a,o]=[-1,0];for(let e=0;e<_.length;e++){let t=_[e];if(r&&!ee.some(e=>t[0]<e[2]&&e[0]<t[2]&&t[1]<e[3]&&e[1]<t[3]))continue;let n=(t[2]-t[0])*(t[3]-t[1]),i=r?x(t[0]-m,t[1]-m,t[2]+m,t[3]+m):2,s=r?1e6*i+n:n;i>=2&&s>o&&([a,o]=[e,s])}if(a<0)break;let[d,f,p,h]=_[a];ee.push(_[a]);for(let e=Math.max(d-m,0);e<=Math.min(p+m,u-1);e++)for(let t=Math.max(f-m,0);t<=Math.min(h+m,u-1);t++)g[e+t*u]=0;l.push([(d-s)*c,e?t:i,(f-s)*c,(p-s)*c,n,(h-s)*c])}}return l},Fn=(e,t)=>{let[n,r]=[Math.floor(e/4),Math.floor(t/4)],[i,a]=[e/4-n,t/4-r],o=(e,t)=>An(4*(n+e),4*(r+t)),[s,c]=[o(0,0),o(1,1)];return i>=a?s+(o(1,0)-s)*i+(c-o(1,0))*a:s+(o(0,1)-s)*a+(c-o(0,1))*i},In=[[32.5,156.5,3.1,3.45,62],[67.5,159.5,1.86,1.84,63],[97.5,166,2.79,2.99,64],[128,177.5,3.41,3.68,65],[-50,330,3.6,2.9,100],[-64,336,2.4,1.9,101],[-14,204,2.4,1.9,110],[176,212,2.8,2.3,111]].map(([e,t,n,r,i])=>((e,t,n,r,i)=>{let a=Fn(e,t),o=a+jn(r),s=[-3,-2,-1,0,1,2,3].map(e=>.4*n*e),c=s.map(n=>s.map(r=>Fn(e+n,t+r))),l=Math.max(Math.min(...c.flat()),a-.55*r),u=Math.max(...c.flat())+ie;return{at:[e,a,t],R:n,H:r,s:i,parts:Pn(Mn(i,n,r),n,l-o,u-o,l-.5-o).map(([n,r,i,a,s,c])=>[e+n,o+r,t+i,e+a,o+s,t+c])}})(e,t,n,r,i)),[H,U,Ln,Rn]=[9,12,-19,7],zn=dn.filter(e=>e[4]).map(([e,t],n)=>{let r=140+t,i=Array.from({length:2*H},(e,t)=>{let i=Math.abs(t+.5-H),a=Math.sqrt(H*H-i*i),o=e=>Math.ceil(2*a*(.88+.24*N(i/4,e+.5,60+n)))/2;return[r-H+t,r-H+t+1,o(0),o(1)]});return{x:e,z:r,level:An(e,r),rows:i}}),Bn=({x:e,z:t,level:n,rows:r})=>{let i=r.reduce((e,[t,n,r,i])=>{let a=e.at(-1);return a&&a[2]===r&&a[3]===i?a[1]=n:e.push([t,n,r,i]),e},[]),a=r[H][3],o=(n-Ln)/Rn;return[E(e-U,-30,t-U,e+U,n,t-H,L),E(e-U,-30,t+H,e+U,n,t+U,L),...i.flatMap(([t,r,i,a])=>[E(e-U,-30,t,e-i,n,r,L),E(e+a,-30,t,e+U,n,r,L)]),E(e-H-1.5,-30,t-H,e+H+1.5,Ln,t+H,L),...Array.from({length:Rn-1},(n,r)=>E(e+a-1.3*(Rn-1-r),Ln,t-1,e+a-1.3*(Rn-2-r),Ln+o*(r+1),t+1,L))].map(e=>({...e,ghost:!0}))},Vn=(e,t,n,r)=>({...E(e-n,An(e,t)-6,t-n,e+n,An(e,t)+r,t+n,L),ghost:!0}),Hn={dishes:[...Tn,...Tn.map(([e,t])=>[e,280-t])],ramps:fn.flatMap(([e,t,n,r])=>(t?[1,-1]:[1]).map(i=>[e+16*n,140+i*(t+16*r),n,i*r+0])),wreck:En,pits:zn.flatMap(e=>e.z===140?[e]:[e,{...e,z:280-e.z,rows:e.rows.map(([e,t,n,r])=>[280-t,280-e,n,r]).reverse()}]),bowls:dn.flatMap(([e,t,n,r=.17])=>(t?[1,-1]:[1]).map(i=>[e,140+i*t,n,r])),crags:In,sites:Dn,pillars:wn,domes:[k,[k[0],280-k[1]]],pads:[...cn,...cn.map(([e,t,n])=>[e,280-t,n])],modules:[...A,...A.map(sn)],tubes:[...ot,...ot.map(sn)],masts:[...ln,...ln.map(([e,t])=>[e,280-t])]},Un=([e,t,n])=>[e,t,280-n],Wn=(e,...t)=>[...e,...e.map(Un),...t],Gn=[...[E(0,-30,160,160,0,V[1]-12,L),E(0,-30,V[1]-12,V[0]-12,0,V[1]+12,L),E(V[0]+12,-30,V[1]-12,160,0,V[1]+12,L),E(0,-30,V[1]+12,160,0,280,L),E(V[0]-12,-30,V[1]-12,V[0]+12,-3,V[1]+12,L),...vn.filter(e=>e[2]<0).map(([e,t,n])=>E(e,-30,148+n,e+t,0,160,L)),...Array.from({length:14},(e,t)=>_n(gn.map(e=>e<0?2:+(e>t/2))).filter(e=>!e[2]).map(([e,n])=>E(e,-30,148+t/2,e+n,0,t<13?148.5+t/2:160,L))).flat(),...yn.flatMap(e=>[-12,-10,-8,-6,-4,4,6,8,10].map(e=>[e,e+(e===-4?8:2)]).map(([t,n])=>[e+t,e+n,bn*Math.min(On(e,e+t),On(e,e+n))*(1-.5/xn)-.12]).filter(e=>e[2]>.3).map(([e,t,n])=>E(e,0,148,t,n,148.5,L)))].map(e=>({...e,ghost:!0})),...zt,{...E(75.25,0,un-4.75,84.75,.5,un+4.75,on,nn,en),ghost:!0},{...E(75.75,.5,un-4.25,84.25,1,un+4.25,on,nn,en),ghost:!0},...cn.map(([e,t,n])=>E(e-n,0,t-n,e+n,.25,t+n,rn)),...ln.map(([e,t])=>E(e-.2,0,t-.2,e+.2,10,t+.2,an)),E(12,-30,146.75,24,0,148,on,L,[1,.42,.08]),...zn.filter(e=>e.z!==140).flatMap(Bn),...(e=In,e.flatMap(e=>e.parts).map(([e,t,n,r,i,a])=>({...E(e,t,n,r,i,a,L),ghost:!0}))),...Tn.map(([e,t])=>Vn(e,t,.4,6))],Kn=[E(74,-1.5,132,86,0,148,rn,an),E(74,0,132,74.4,1.1,148,nn),E(85.6,0,132,86,1.1,148,nn),...wn.map(([e,t,n,r,i])=>({...E(e,-30,t,n,i,r,L),ghost:!0})),{...E(-10,-30,132,0,0,148,L),ghost:!0},{...E(160,-30,132,170,0,148,L),ghost:!0},{...E(En[0]-3.6,-30,En[1]-3.6,En[0]+3.6,Ln+3.5,En[1]+3.6,L),ghost:!0},...zn.filter(e=>e.z===140).flatMap(Bn),...Hn.ramps.flatMap(([e,t,n,r])=>[-8,8].map(i=>Vn(e+i*r,t-i*n,.2,2.2)))],qn=[...[56,68,80,92,104].map(e=>[e,0,271,0]),...[62,80,98].map(e=>[e,0,267,0])],Jn=(e,t)=>{let n=t=>e>140?t:Un(t);return{base:[80,1,e],spawns:t,rack:n([66,0,262]),blade:n([94,0,262]),rifle:n([145,0,191]),rail:n([43,0,158])}},[Yn,Xn,Zn]=((e,t,n)=>{let{R:r,LOW:i,TOP:a}=$t,[o,s,c,l]=[56,104,n-r,n+r],u=[.78,.8,.84],d=[.95,.55,.15],f=[[110.5,t,138.5],[112.5,601.1,141.5]],p=[];for(let u=e-r;u<e+r;u+=4){let d=Math.max(Math.abs(u-e),Math.abs(u+4-e)),f=Math.sqrt(r*r-d*d),m=(e,t,n,r)=>r>n&&p.push({...F(u,e,n,u+4,t,r,Yt),ghost:!0});m(t+i,598,n-f,n+f),m(616,t+a,n-f,n+f);let[h,g]=u<s?u+4>o?[c,l]:[n,n]:u<120?[130,150]:[n,n];m(598,616,n-f,Math.min(h,n+f)),m(598,616,Math.max(g,n-f),n+f);let _=Math.sqrt(Math.max(0,(.75*r)**2-d*d));m(t+a,t+a+I.DOME-2,n-_,n+_);let v=I.BARREL*r+3,y=Math.sqrt(Math.max(0,v*v-d*d));m(t+i-I.GUN,t+i,n-y,n+y)}let m=t+i+(a-i)*I.WING,h=I.BOOM+4*(I.PANEL+I.GAP)+3;for(let t of[-1,1]){let[n,i]=[e+t*r,e+t*(r+h)];p.push({...F(Math.min(n,i),m-1.5,138.5,Math.max(n,i),m+1.5,141.5,Yt),ghost:!0},{...F(Math.min(n,i),m-I.SPAN/2,139.6,Math.max(n,i),m+I.SPAN/2,140.4,Yt),ghost:!0})}p.push({...F(55,t+a+3,133,73,t+a+I.MAST+6,147,Yt),ghost:!0});let g=[[s-2.15,t,137],[s-1.85,603.2,143]];return[[F(o,598,c,s,t,l,Qt,Yt),F(o,614,c,s,616,l,Yt),F(o,t,c,o+4,614,l,P,P,u),F(s-4,t,c,s,614,137,P,P,u),F(s-4,t,143,s,614,l,P,P,u),F(s-4,603.2,137,s,614,143,P,P,u),F(o+4,611,c,s-4,614,c+4,Xt,Xt,d),F(o+4,611,l-4,s-4,614,l,Xt,Xt,d),F(s,598,130,120,t,150,Yt),F(s,604,130,120,605,150,Yt),F(s,t,130,120,604,132,P,P,u),F(s,t,148,120,604,150,P,P,u),F(118,t,132,120,604,148,Zt),F(...f[0],...f[1],Xt,Xt,d),...p],{post:f,hall:[[o,599,c],[120,616,l]],hull:[e,t+i,n,t+a],gun:[e,t+i-I.GUN,n]},{min:g[0],max:g[1]}]})(80,600,140),Qn={name:`Tranquility`,tag:`Moon · half gravity`,lore:`A mining base left in a lunar crater, its domes still lit. Two crews fight for it in space helmets, under the Earth and a black sky. Jumps float twice as high, and a rille cuts the base in two.`,brushes:[...Gn,...Gn.map(e=>({...e,min:[e.min[0],e.min[1],280-e.max[2]],max:[e.max[0],e.max[1],280-e.min[2]],tint:e.tint===en?tn:e.tint})),...Kn,...Yn],teams:[Jn(un,qn),Jn(280-un,qn.map(([e,t,n])=>[e,t,280-n,Math.PI]))],packs:Wn([[90,0,210],[118,5,226],[30,0,185],[80,3.5,253.5]],[45,0,162],[45,0,118]),ammo:Wn([[50,0,246],[103,5,200],[135,0,190]],[115,0,162],[115,0,118]),cells:Wn([[106.5,3.5,226],[35,0,244]],[80,0,140]),vests:Wn([[107,5,200]],[132.5,2.4,140]),floor:-26,relief:{hole:[0,132,160,148],pits:[...vn.flatMap(([e,t,n])=>n>0?[[e,148,e+t,148+n],[e,132-n,e+t,132]]:[]),...Hn.pits.flatMap(({x:e,rows:t})=>t.map(([t,n,r,i])=>[e-r,t,e+i,n]))],bound:[80,140,300,360],cell:4,at:An},sun:{dir:[.87996,.40998,.23999],color:[3,2.95,2.85]},sky:[[.002,.002,.006],[.02,.02,.035]],gravity:.5,rovers:[[100,0,178,0],[30,0,255,0],[100,0,102,Math.PI],[30,0,25,Math.PI]],ships:[...cn.map(([e,t])=>[e,.25,t,0]),...cn.map(([e,t])=>[e,.25,280-t,Math.PI])],doors:[...bt,...bt.map(sn),Zn],scenery:`moon`,helmets:!0,armor:!0,seam:Ze.SEAM,station:Xn},W={MARINE:0,NINJA:1,ASTRONAUT:2,XENO:3,HUNTER:4},$n={run:6,sprint:9,jump:7,double:6,wallrun:75,dashes:1,dash:16,haste:1,ammo:60,rail:240,rifle:240,cool:7,rifleCool:3,mag:15,cap:80,clip:60,damage:1,slow:1,accel:1,parry:0,hp:8,gear:!0,xeno:!1},er=[$n,{run:6*1.2,sprint:9*1.2,jump:9.1,double:6*1.3,wallrun:150,dashes:3,dash:16,haste:2,ammo:30,rail:120,rifle:120,cool:14,rifleCool:6,mag:8,cap:40,clip:30,damage:.5,slow:.55,accel:1,parry:.7,katana:!0,hp:8,gear:!0,xeno:!1},$n,{...$n,run:7.5,sprint:11.25,jump:7*Math.SQRT2,double:6*Math.SQRT2,dashes:3,dash:22.4,accel:1.25,ammo:0,rail:0,rifle:0,mag:0,cap:0,clip:0,hp:12,gear:!1,xeno:!0,girth:.1},{...$n,katana:!0,hunter:!0,ammo:12,mag:1,cap:15,rail:90,girth:.25,size:1.2}],tr=e=>e.helmets?[W.ASTRONAUT,W.XENO,W.HUNTER]:[W.MARINE,W.NINJA,W.XENO,W.HUNTER],nr=(e,t)=>{let n=tr(t);return n.includes(e??-1)?e:n[0]},rr=(e,t)=>nr(e.role,t)==W.XENO?0:e.body??0,ir=(e,t)=>er[nr(e,t)],ar=1024,or=(e,t)=>2048*(e+ar)+t+ar,G=(e,t)=>Math.min(Math.max(Math.floor(e/t),-1024),1023),sr=[],cr=e=>[...new Map([[`1,1,1`,[1,1,1]],...(e.tints??[]).map(e=>[`${e}`,e]),...e.brushes.flatMap(({tint:e})=>e?[[`${e}`,e]]:[])]).values()],lr=(e,t=4)=>{let n=/* @__PURE__ */ new Map;return e.brushes.forEach(({min:e,max:r},i)=>{for(let a=G(e[0],t);a<=G(r[0],t);a++)for(let o=G(e[2],t);o<=G(r[2],t);o++){let e=or(a,o),t=n.get(e);t?t.push(i):n.set(e,[i])}}),{def:e,cell:t,grid:n,...e.relief?{relief:Ht(e.relief)}:{},...e.doors?{doors:e.doors.map(()=>({open:0,wait:0}))}:{}}},ur=/* @__PURE__ */ new Uint32Array,dr=0,K=(e,t,n,r)=>{let i=[];ur.length<e.def.brushes.length&&(ur=new Uint32Array(e.def.brushes.length)),dr=dr+1>>>0||(ur.fill(0),1);for(let a=G(t-r,e.cell);a<=G(t+r,e.cell);a++)for(let t=G(n-r,e.cell);t<=G(n+r,e.cell);t++)for(let n of e.grid.get(or(a,t))??[])ur[n]!==dr&&(ur[n]=dr,i.push(n));return i},fr=(e,t,n,r,i=0)=>{let a=pr(e,t,n,r,i);return e.doors?.forEach(({open:r},o)=>{if(r<.5){let{min:r,max:s}=e.def.doors[o],[c,l]=[0,a];for(let e=0;e<3;e++){let[a,o]=n[e]?[(r[e]-i-t[e])/n[e],(s[e]+i-t[e])/n[e]]:t[e]<r[e]-i||t[e]>s[e]+i?[1,-1]:[-1/0,1/0];c=Math.max(c,Math.min(a,o)),l=Math.min(l,Math.max(a,o))}c<=l&&l>0&&(a=c)}}),e.relief?((e,t,n,r,i=0)=>{let a=e.relief;if(!a||Math.min(t[1],t[1]+n[1]*r)-i>a.top)return r;let[o,s]=[0,r];for(let e of[0,1]){let[r,i,c,l]=[t[2*e],n[2*e],a.hole[e],a.hole[e+2]];if(i){let[e,t]=[(c-r)/i,(l-r)/i];o=Math.max(o,Math.min(e,t)),s=Math.min(s,Math.max(e,t))}else(r<=c||r>=l)&&(s=-1)}let c=r=>t[1]+n[1]*r-i-Ut(e,t[0]+n[0]*r,t[2]+n[2]*r);if(!n[0]&&!n[2]){let e=c(0);return e<0?0:n[1]<0?Math.min(r,e/-n[1]):r}for(let[e,t]of o<s?[[0,o],[s,r]]:[[0,r]]){if(e<t&&c(e)<0)return e;for(let n=e;n<t;n+=1){let e=Math.min(n+1,t);if(c(e)<0){let[t,r]=[n,e];for(let e=0;e<6;e++){let e=(t+r)/2;c(e)<0?r=e:t=e}return t}}}return r})(e,t,n,a,i):a},pr=(e,t,n,r,i)=>{let{cell:a,def:o}=e,s=r,c=G(t[0],a),l=G(t[2],a),u=Math.sign(n[0]),d=Math.sign(n[2]),f=u?((c+ +(u>0))*a-t[0])/n[0]:1/0,p=d?((l+ +(d>0))*a-t[2])/n[2]:1/0,m=u?a/Math.abs(n[0]):1/0,h=d?a/Math.abs(n[2]):1/0;for(;;){for(let r of e.grid.get(or(c,l))??[]){let e=o.brushes[r],[a,c]=[0,s];for(let r=0;r<3&&a<=c;r++){if(!n[r]){(t[r]<e.min[r]-i||t[r]>e.max[r]+i)&&(c=-1);continue}let o=(e.min[r]-i-t[r])/n[r],s=(e.max[r]+i-t[r])/n[r];a=Math.max(a,Math.min(o,s)),c=Math.min(c,Math.max(o,s))}a<=c&&c>0&&a<s&&(s=a)}if(Math.min(f,p)>=s||Math.abs(c)>ar||Math.abs(l)>ar)return s;f<p?(c+=u,f+=m):(l+=d,p+=h)}},mr=(e,t,n)=>{let[r,i,a]=[n[0]-t[0],n[1]-t[1],n[2]-t[2]],o=Math.hypot(r,i,a);return o>0&&fr(e,t,[r/o,i/o,a/o],o)<o-1e-4},q=1/60,hr=2*Math.PI,gr=1e-6,J=.01,_r=e=>(e%hr+hr)%hr,vr=e=>[-Math.sin(e),-Math.cos(e)],Y=Math.fround,yr=Math.sqrt,br=(e,t,n)=>Math.min(Math.max(e,t),n),X=(e,t)=>yr(e*e+t*t),Z=[[0,0],[1,0],[-1,0],[0,1],[0,-1]],xr={vx:0,vz:0,mode:o.GROUND,t:0,wall:0,edge:0,jumps:1,dashes:1,dash:0,stun:0,coyote:6,buffer:0,held:0,hp:8,armor:0,ammo:-1,cool:0,mag:0,cap:0,reload:0,rack:!1,down:0,shots:0,hits:0,blade:!1,wield:!1,fists:!1,side:-1,sideMag:0,sided:!1,swing:0,cut:0,zap:!1,lost:i.NONE,rail:-1,railed:!1,rifle:-1,clip:0,rifled:!1,nades:0,lob:0,inRifle:!1,inRail:!1,zapping:!1,slow:0,fried:!1,heavy:!1,ev:0,fall:0},Sr=(e,t,n,r=0,i=er[0])=>{let{spawns:a}=t.def.teams[r],[o,s,c,l]=a[(n%a.length+a.length)%a.length];return{id:e,x:Y(o),y:Y(s),z:Y(c),vy:0,yaw:_r(l),pitch:0,ground:!0,...xr,hp:i.hp,blade:!!i.katana,wield:!!i.katana}},Cr=(e,t,n,r=er[0])=>{let{yaw:i,pitch:a,id:o,shots:c,hits:l}=e;Object.assign(e,Sr(o,t,o,n,r),{yaw:i,pitch:a,shots:c,hits:l,ev:e.ev|s.RESPAWN})},wr=e=>e===o.GROUND||e===o.SLIDE||e===o.CROUCH,Tr=e=>e.mode===o.SLIDE||e.mode===o.CROUCH?.9:ie,Er=e=>e.mode===o.SWIM?1.35:e.mode===o.SLIDE||e.mode===o.CROUCH?.7:1.6,Dr=e=>X(e.vx,e.vz),Or=e=>e.mode===o.GROUND&&X(e.vx,e.vz)>6.5,kr=(e,t,n)=>e.max[1]>t+.5+J&&e.min[1]<t+n-J,Ar=(e,t,n)=>[t-br(t,e.min[0],e.max[0]),n-br(n,e.min[2],e.max[2])],jr=(e,t,n)=>Mr(e,t,n,C),Mr=(e,t,n,r)=>{let{brushes:i}=t.def,a=K(t,e.x,e.z,2*r),o=(r-gr)**2,[s,c]=[0,0];for(let t=0;t<4;t++){let t=0,l=0,u=0;for(let s of a){let a=i[s];if(!kr(a,e.y,n))continue;let[c,d]=Ar(a,e.x,e.z),f=c*c+d*d;if(f>=o)continue;if(f){let e=yr(f);r-e>t&&(t=r-e,l=c/e*t,u=d/e*t);continue}let[p,m,h]=[[e.x-a.min[0],-1,0],[a.max[0]-e.x,1,0],[e.z-a.min[2],0,-1],[a.max[2]-e.z,0,1]].reduce((e,t)=>t[0]<e[0]?t:e);p+r>t&&(t=p+r,[l,u]=[m*t,h*t])}if(!t)break;e.x+=l,e.z+=u,s+=l,c+=u}return[s,c]},Nr=(e,t,n)=>{let[[r,i,a],[o,s,c]]=[e.a,e.b],[l,u]=[o-r,c-a],d=l*l+u*u,f=d?br(((t-r)*l+(n-a)*u)/d,0,1):0;return[t-r-f*l,n-a-f*u,i+f*(s-i)]},Pr=(e,t,n,r)=>t>=Math.min(e.a[0],e.b[0])-r&&t<=Math.max(e.a[0],e.b[0])+r&&n>=Math.min(e.a[2],e.b[2])-r&&n<=Math.max(e.a[2],e.b[2])+r,Fr=(e,t,n,r=[])=>{let{brushes:i}=t.def,a=(C-gr)**2,o=Ut(t,e.x,e.z),s=1/0;for(let r of K(t,e.x,e.z,C)){let t=i[r],[c,l]=Ar(t,e.x,e.z);c*c+l*l>=a||(t.max[1]<=e.y+.5+J?o=Math.max(o,t.max[1]):t.min[1]>=e.y+n-J&&(s=Math.min(s,t.min[1])))}for(let t of r){if(!Pr(t,e.x,e.z,t.r+.4))continue;let[r,i,a]=Nr(t,e.x,e.z);r*r+i*i>=(t.r+.4-gr)**2||(a+t.h<=e.y+.5+J?o=Math.max(o,a+t.h):a>=e.y+n-J&&(s=Math.min(s,a)))}return[o,s]},Ir=(e,t,n,r)=>{let i=Ut(e,t,n);for(let a of((e,t,n)=>e.grid.get(or(G(t,e.cell),G(n,e.cell)))??sr)(e,t,n)){let{min:o,max:s}=e.def.brushes[a];t>=o[0]&&t<=s[0]&&n>=o[2]&&n<=s[2]&&s[1]<=r&&(i=Math.max(i,s[1]))}return i},Lr=(e,t)=>{let n=(C-gr)**2;return K(t,e.x,e.z,C).every(r=>{let i=t.def.brushes[r],[a,o]=Ar(i,e.x,e.z);return a*a+o*o>=n||!kr(i,e.y,1.8)})},Rr=(e,t,n,r,i)=>{let a=(C-gr)**2;return K(e,t,n,C).every(o=>{let s=e.def.brushes[o],[c,l]=Ar(s,t,n);return c*c+l*l>=a||s.max[1]<=r||s.min[1]>=i})},zr=(e,t)=>{let[n,r]=Z[t],i=n?0:2;return{a:i,o:2-i,sign:n||r,c:n?e.x:e.z,co:n?e.z:e.x}},Br=(e,t,n,r)=>{let{a:i,o:a,sign:o,c:s,co:c}=zr(t,n),l=((o>0?e.min[i]:e.max[i])-s)*o;return l>=.399&&l<=.4+r&&c>=e.min[a]&&c<=e.max[a]?l:void 0},Vr=(e,t,n)=>{let r;for(let i of K(t,e.x,e.z,.9)){let a=t.def.brushes[i],o=Br(a,e,n,.5);o!==void 0&&a.min[1]<e.y+.5&&a.max[1]>e.y+1.8&&(r=Math.min(r??1/0,Math.max(0,o-C)))}return r},Hr=e=>e>20?Math.ceil((e-20)/2):0,Ur=e=>20*(e.def.gravity??1),Q=(e,t)=>{e.mode=t,e.t=0},Wr=e=>!!e.zap&&e.stun>24,Gr=(e,t)=>{let n=X(e.vx,e.vz);n>t&&(e.vx*=t/n,e.vz*=t/n)},Kr=(e,t,n,r)=>{let[i,a]=[n.wx,n.wz];for(let n of K(t,e.x,e.z,.401)){let o=t.def.brushes[n],[s,c]=Ar(o,e.x,e.z),l=X(s,c);if(l>0&&l<=.401&&kr(o,e.y,r)){let e=(-i*s-a*c)/l;e>0&&(i+=e*s/l,a+=e*c/l)}}return[i,a]},qr=(e,t,n,r=6,i=1)=>{let a=X(t[0],t[1]);if(a<gr){let t=X(e.vx,e.vz),n=t?Math.max(0,t-.75)/t:0;e.vx*=n,e.vz*=n;return}let[o,s]=[t[0]/a,t[1]/a],c=e.vx*o+e.vz*s,[l,u]=[e.vx-c*o,e.vz-c*s],d=X(l,u);if(d){let e=Math.max(0,d-.75)/d;[l,u]=[l*e,u*e]}c=c<(n*=a)?Math.min(n,c+(c>=r?3:50)*i*q):Math.max(n,c-.2),e.vx=l+c*o,e.vz=u+c*s},Jr=(e,t,n)=>{Yr(e,t,Tr(e),0,!1,n),[e.x,e.y,e.z]=[Y(e.x),Y(e.y),Y(e.z)]},Yr=(e,t,n,r,i,a)=>{let o=e.y;e.x+=e.vx*q,e.z+=e.vz*q;let[s,c]=jr(e,t,n),[l,u]=((e,t,n)=>{let[r,i]=[0,0];for(let a of t){let t=a.r+C;if(!Pr(a,e.x,e.z,t))continue;let[o,s,c]=Nr(a,e.x,e.z),l=o*o+s*s;if(l>=(t-gr)**2||c+a.h<=e.y+.5+J||c>=e.y+n-J)continue;let u=yr(l),[d,f]=[a.b[0]-a.a[0],a.b[2]-a.a[2]],p=X(d,f),[m,h]=u?[o/u,s/u]:p?[f/p,-d/p]:[1,0];e.x+=m*(t-u),e.z+=h*(t-u),r+=m*(t-u),i+=h*(t-u)}return[r,i]})(e,a,n);if(l||u){let[r,i]=jr(e,t,n);s+=l+r,c+=u+i}let d=X(s,c);if(d){let t=(e.vx*s+e.vz*c)/d;t<0&&(e.vx-=t*s/d,e.vz-=t*c/d)}Wt(e,t);let[f,p]=Fr(e,t,n,a),m=e.vy-r*Ur(t)*q;if(e.y+=(e.vy+m)/2*q,e.vy=m,e.y+n>p&&(e.y=p-n,e.vy=Math.min(e.vy,0)),e.vy<=0?e.y<=f+J:e.y<f){if(e.y=f,e.vy<=0){let t=-e.vy;return e.vy=0,t}}else if(i&&e.vy<=0&&f>=o-.5)return e.y=f,e.vy=0,0;return-1},Xr=(e,t)=>{e.vy=t,e.coyote=0,e.buffer=0,e.ev|=s.JUMP},Zr=e=>(e.def.water??0)-1.1,Qr=(e,t,r,i)=>{let a=(r.keys&n.CROUCH)!==0;if(e.buffer>0&&(e.mode===o.GROUND||Lr(e,t)))return e.ev|=e.mode===o.SLIDE?s.SLIDE_END:0,Q(e,o.AIR),void Xr(e,r.kit.jump);let c=X(e.vx,e.vz);if(e.mode===o.GROUND&&a){let t=c>=7.5;Q(e,t?o.SLIDE:o.CROUCH),e.ev|=t?s.SLIDE_START:0}else e.mode===o.SLIDE&&(e.t>=60||c<4.5||r.stumble)?(e.ev|=s.SLIDE_END,Q(e,!a&&Lr(e,t)?o.GROUND:o.CROUCH)):e.mode===o.SLIDE&&!a&&Lr(e,t)?(e.ev|=s.SLIDE_END,Q(e,o.GROUND)):e.mode===o.CROUCH&&!a&&Lr(e,t)&&Q(e,o.GROUND);if(!i){if(r.stumble){if(c>2.5){let t=Math.max(2.5,c-.2)/c;e.vx*=t,e.vz*=t}else qr(e,Kr(e,t,r,Tr(e)),2.5)}else if(e.mode===o.SLIDE){let t=Math.max(0,c-4*q)/c;e.vx*=t,e.vz*=t}else if(e.mode===o.CROUCH)qr(e,Kr(e,t,r,.9),3);else{let i=(r.keys&n.SPRINT)!==0&&r.fwd,a=r.kit.run*r.pace;qr(e,Kr(e,t,r,ie),i?r.kit.sprint*r.pace:a,a,r.kit.accel)}}},$r=(e,t,n,r)=>{if(e.buffer>0&&(e.coyote>0?Xr(e,n.kit.jump):e.jumps>0&&!((e,t)=>{if(e.vy>=0)return!1;let[n]=Fr(e,t,ie);return e.y-n<=.1*-e.vy+.5*Ur(t)*.1*.1})(e,t)&&(e.jumps--,Xr(e,n.kit.double),e.ev=e.ev&~s.JUMP|s.DOUBLE)),r||!n.wx&&!n.wz)return;let i=X(e.vx,e.vz);e.vx+=14*n.wx*q,e.vz+=14*n.wz*q,Gr(e,Math.max(i,6))},ei=(e,t,r,i=0,a=[],c=er[0])=>{e.yaw=_r(t.yaw),e.pitch=Math.max(-1.55,Math.min(1.55,t.pitch));let l=(t.keys&n.FORWARD?1:0)-(t.keys&n.BACK?1:0),u=(t.keys&n.RIGHT?1:0)-(t.keys&n.LEFT?1:0),d=Wr(e)?1/0:X(l,u)||1,[f,p]=vr(e.yaw),m=n=>(t.keys&n)!==0&&(e.held&n)===0,h=e.stun>0,g=e.mode===o.RIDE,_={keys:t.keys,stumble:h,jump:!h&&!g&&m(n.JUMP),dash:!h&&!g&&m(n.DASH),fwd:l>0,wx:(f*l-p*u)/d,wz:(p*l+f*u)/d,fx:f,fz:p,bodies:a,kit:c,pace:e.fists||e.wield||!(e.ammo>=0||(e.rail??-1)>=0||(e.rifle??-1)>=0)?1:c.slow},v=e.mode;e.ev=0,e.fall=0,_.jump&&(e.buffer=7),h&&e.stun--,e.dash>0&&(e.dash--,e.dash===50&&Gr(e,10)),e.mode===o.HANG&&((e,t,r)=>{let[i,a]=Z[e.wall],s=t=>{Q(e,t),e.edge=0};if(r.keys&(n.BACK|n.CROUCH))s(o.AIR),e.coyote=0;else if(r.jump&&r.fx*i+r.fz*a<0)s(o.AIR),e.vx=4*-i,e.vz=4*-a,Xr(e,6);else if(r.jump||r.fwd&&e.t>=6)Q(e,o.CLIMB);else if(e.t>=30)s(o.AIR),e.coyote=0;else{let n=Math.max(e.edge-2,Fr(e,t,ie)[0]);e.y+=br(n-e.y,-8*q,8*q)}})(e,r,_),e.mode===o.CLING&&((e,t,r)=>{let[i,a]=Z[e.wall],c=((e,t,n)=>{let{a:r,sign:i}=zr(e,n),a;for(let o of K(t,e.x,e.z,.9)){let s=t.def.brushes[o],c=Br(s,e,n,.5);if(c!==void 0&&s.max[1]>e.y+.4&&s.min[1]<e.y+1.8){let e=Math.max(0,c-C);a={gap:Math.min(a?.gap??1/0,e),top:Math.max(a?.top??-1/0,s.max[1]),face:i>0?s.min[r]:s.max[r]}}}return a})(e,t,e.wall);if(r.keys&n.CROUCH||!c)return Q(e,o.AIR),void(e.coyote=0);if(r.jump){Q(e,o.AIR);let[t,n]=[10*Math.cos(e.pitch),10*Math.sin(e.pitch)],[s,c]=[Math.max(n,3.25),(r.fz*i-r.fx*a)*t];e.vx=-i*s-a*c,e.vz=-a*s+i*c,Xr(e,(r.fx*i+r.fz*a)*t);return}let l=(r.keys&n.FORWARD?1:0)-(r.keys&n.BACK?1:0),u=(r.keys&n.RIGHT?1:0)-(r.keys&n.LEFT?1:0),[d,f]=[-a,i],[p,m]=[r.fx*i+r.fz*a,r.fx*d+r.fz*f],[h,g]=[l*p-u*m,l*m+u*p],_=Math.sqrt(h*h+g*g),v=Math.sqrt(e.vx*e.vx+e.vy*e.vy+e.vz*e.vz),y=r.keys&n.SPRINT,b=r.kit.run*r.pace*(y?1:.5),x=y?r.kit.sprint*r.pace:b,ee=v>x?Math.max(x,v-.2):Math.min(x,Math.max(b,v+3*r.kit.accel*q)),te=_>1?ee/_:ee,ne=h>.05?1:h<-.05?-1:0,S=g*te,{a:re,sign:ie}=zr(e,e.wall);if(ne>0&&c.top<e.y+1.8){let n=c.face+.2*ie,[r,i]=re===0?[n,e.z]:[e.x,n];if(Rr(t,r,i,c.top+J,c.top+1.8))return Q(e,o.CLIMB),e.edge=Y(c.top),void(e.vx=e.vy=e.vz=0)}e.vx=d*S,e.vz=f*S,e.vy=ne>0&&c.top-e.y<=.45?0:h*te;let ae=Math.min(c.gap,4*q);e.x+=i*ae,e.z+=a*ae,Yr(e,t,1.8,0,!1,r.bodies)>=0&&ne<0&&(Q(e,o.GROUND),e.wall=0,e.coyote=6,e.ev|=s.LAND)})(e,r,_),e.mode===o.SWIM?((e,t,r)=>{let i=.1,a=Zr(t),s=(r.keys&n.FORWARD?1:0)-(r.keys&n.BACK?1:0),c=s!==0&&(e.pitch<0||e.y<a-J)?Math.cos(e.pitch):1;e.vx+=(4*r.wx*c-e.vx)*i,e.vz+=(4*r.wz*c-e.vz)*i,e.vy+=((s===0?1.5:s*Math.sin(e.pitch)*4)-e.vy)*i,Yr(e,t,Tr(e),0,!1,r.bodies),Fr(e,t,Tr(e),r.bodies)[0]>=a-J?(e.y=Math.max(e.y,a),e.vy=0,e.jumps=1,e.dashes=r.kit.dashes,Q(e,o.GROUND)):e.y>a&&(e.y=a,e.vy=Math.min(e.vy,0))})(e,r,_):e.mode===o.CLIMB?((e,t)=>{let[n,r]=Z[e.wall];e.y<e.edge?e.y=Math.min(e.edge,e.y+8*q):(e.x+=5.5*n*q,e.z+=5.5*r*q),e.y>=e.edge&&((e,t)=>{let{a:n,o:r,sign:i,c:a,co:o}=zr(e,e.wall);return K(t,e.x,e.z,0).some(s=>{let c=t.def.brushes[s],l=i>0?a-c.min[n]:c.max[n]-a;return Y(c.max[1])===e.edge&&o>=c.min[r]&&o<=c.max[r]&&l>=.2})})(e,t)?(Q(e,o.GROUND),e.vx=3*n,e.vz=3*r,e.vy=0,e.edge=0,e.wall=0,e.coyote=6,e.ev|=s.CLIMB):e.t>=40&&(Q(e,e.y>=e.edge?o.GROUND:o.AIR),e.edge=0,e.wall=0)})(e,r):e.mode===o.HANG||e.mode===o.CLING||g||((e,t,r)=>{let i=e.mode===o.GROUND,a=r.kit.dashes>1;if(a&&i&&e.dash===0&&(e.dashes=r.kit.dashes),r.dash&&(e.dash===0||a&&e.dashes>0&&e.dash<=44)&&(i?!a||e.dashes>0:(e.mode===o.AIR||e.mode===o.WALLRUN)&&e.dashes>0)){let[t,n]=r.wx||r.wz?[r.wx,r.wz]:[r.fx,r.fz];e.dashes-=+(i&&a),i||(e.dashes--,e.vy=0,e.mode===o.WALLRUN&&(Q(e,o.AIR),e.ev|=s.WALLRUN_END)),e.vx=t*r.kit.dash,e.vz=n*r.kit.dash,e.dash=60,e.ev|=s.DASH}let c=e.dash>50;e.mode===o.WALLRUN&&((e,t,n)=>{let[r,i]=Z[e.wall],a=e.vx*r+e.vz*i,[c,l]=[e.vx-a*r,e.vz-a*i],u=X(c,l);if(n.jump){Q(e,o.AIR);let t=u>0?1+2/u:1;e.vx=c*t-6.5*r,e.vz=l*t-6.5*i,Xr(e,7.5),e.jumps=1,e.dashes=n.kit.dashes,e.ev|=s.WALLRUN_END}else{let a=Vr(e,t,e.wall);if(a===void 0||!n.fwd||u<3.5||e.t>=n.kit.wallrun)return Q(e,o.AIR),void(e.ev|=s.WALLRUN_END);let d=Math.max(0,u-.025)/u;e.vx=c*d,e.vz=l*d;let f=Math.min(a,4*q);e.x+=r*f,e.z+=i*f}})(e,t,r),wr(e.mode)&&Qr(e,t,r,c),e.mode===o.AIR&&$r(e,t,r,c);let l=c&&e.vy<=0?0:e.mode===o.WALLRUN?.15:1,u=e.mode,d=[X(e.vx,e.vz),e.vx,e.vz],f=Yr(e,t,Tr(e),l,wr(u),r.bodies);if(f>=0){if(!wr(e.mode)){if(e.ev|=s.LAND|(e.mode===o.WALLRUN?s.WALLRUN_END:0),e.fall=f,e.jumps=1,e.dashes=r.kit.dashes,e.wall=0,r.keys&n.CROUCH){let t=X(e.vx,e.vz)>=7.5;Q(e,t?o.SLIDE:o.CROUCH),e.ev|=t?s.SLIDE_START:0}else Q(e,o.GROUND)}e.coyote=6}else wr(e.mode)&&(e.ev|=e.mode===o.SLIDE?s.SLIDE_END:0,Q(e,o.AIR));if((e.mode!==o.AIR&&e.mode!==o.GROUND||!((e,t,r,i)=>{if(!r.kit.xeno||!r.fwd||!(r.keys&n.SPRINT)||r.stumble)return!1;let a=e.mode===o.AIR?.5:.05;for(let n=1;n<=4;n++){let[c,l]=Z[n],u=Vr(e,t,n);if(n!==e.wall&&r.fx*c+r.fz*l>=.6&&u!==void 0&&u<=a){Q(e,o.CLING),e.wall=n;let[t,a]=[-l,c],u=Math.min(1,r.kit.sprint*r.pace/Math.max(i[0],gr)),d=(i[1]*t+i[2]*a)*u;return e.vx=t*d,e.vz=a*d,e.vy=Math.sqrt(Math.max(0,(i[0]*u)**2-d*d)),e.jumps=1,e.coyote=0,e.ev|=s.GRAB,!0}}return!1})(e,t,r,d))&&e.mode===o.AIR){let n=((e,t)=>{let[n,r]=vr(e.yaw),i;for(let a=1;a<=4;a++){let[o,s]=Z[a];if(a===e.wall||n*o+r*s<.5)continue;let{a:c,sign:l}=zr(e,a);for(let n of K(t,e.x,e.z,C+.2)){let r=t.def.brushes[n],o=r.max[1],s=o-e.y;if(Br(r,e,a,.2)===void 0||s<1.2||s>2.4||r.min[1]>o-.25||i&&i.top>=o)continue;let u=l>0?r.min[c]:r.max[c],d=u-l*(C+.03),f=u+.2*l,[p,m]=c===0?[d,e.z]:[e.x,d],[h,g]=c===0?[f,e.z]:[e.x,f];Rr(t,p,m,Math.min(e.y,o-2)+J,o+1.8)&&Rr(t,h,g,o+J,o+1.8)&&(i={side:a,top:o,hang:d})}}return i})(e,t);n?((e,t,n)=>{Q(e,o.HANG),e.wall=t.side,e.edge=Y(t.top),t.side<=2?e.x=t.hang:e.z=t.hang,e.vx=e.vy=e.vz=0,e.jumps=1,e.dashes=n,e.coyote=0,e.buffer=0,e.ev|=s.GRAB})(e,n,r.kit.dashes):((e,t,n)=>{if(!n.fwd)return;let r=X(e.vx,e.vz);if(!(r<4.5))for(let i=1;i<=4;i++){let[a,c]=Z[i],l=e.vx*a+e.vz*c,[u,d]=[e.vx-l*a,e.vz-l*c];if(i!==e.wall&&l<=.75*r&&l>=-.2*r&&Vr(e,t,i)!==void 0){let t=X(u,d),a=Math.max(t,.9*r)/t;Q(e,o.WALLRUN),e.wall=i,[e.vx,e.vz]=[u*a,d*a],e.vy=br(e.vy,2,3),e.jumps=1,e.dashes=n.kit.dashes,e.coyote=0,e.ev|=s.WALLRUN_START;return}}})(e,t,r)}})(e,r,_),((e,t)=>{t.def.water===void 0||e.y>=Zr(t)-.02||e.mode!==o.GROUND&&e.mode!==o.AIR&&e.mode!==o.CROUCH&&e.mode!==o.SLIDE&&e.mode!==o.WALLRUN||(Q(e,o.SWIM),e.y=Zr(t),e.vy=0,e.dash=0,e.wall=0)})(e,r),e.slow&&(e.slow--,Gr(e,3)),e.y<r.def.floor&&e.mode!==o.SWIM&&Cr(e,r,i,c),e.t=e.mode===v?Math.min(255,e.t+1):e.t,e.buffer=Math.max(0,e.buffer-1),e.mode===o.AIR&&v===o.AIR&&(e.coyote=Math.max(0,e.coyote-1)),e.held=t.keys&(n.JUMP|n.DASH|n.USE),e.ground=wr(e.mode),e.x=Y(e.x),e.y=Y(e.y),e.z=Y(e.z),e.vx=Y(e.vx),e.vy=Y(e.vy),e.vz=Y(e.vz),e.edge=Y(e.edge)},ti=class{a=/* @__PURE__ */ new Float64Array(65536);length=0;room(e){let t=this.length+e;if(t>this.a.length){let e=new Float64Array(Math.max(t,2*this.a.length));e.set(this.a),this.a=e}return this.a}push(...e){let t=this.room(e.length);for(let n=0;n<e.length;n++)t[this.length++]=e[n]}slice(e,t){return Array.from(this.a.subarray(e,t))}},ni=(e,t)=>Array.isArray(e)?e:e.room(t),ri=(e,t)=>[e[0]-t[0],e[1]-t[1],e[2]-t[2]],ii=(e,t)=>[e[0]+t[0],e[1]+t[1],e[2]+t[2]],ai=(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2],oi=(e,t,n)=>[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n],si=e=>{let t=Math.hypot(...e)||1;return[e[0]/t,e[1]/t,e[2]/t]},ci=-1.25,li=-1.12,ui=-1.42,di=-2.2,[fi,pi]=[-1.45,.04],[mi,hi]=[-1.36,1e-4],gi=-1.06,_i=[.3,.2,.14],vi=-1.17,yi=-1.19,bi=-1.135,xi=-.94,Si=(e,t,n=0)=>{let[r,i,a,o,s,c]=[e,t,n].flatMap(e=>[Math.sin(e),Math.cos(e)]),l=[i,0,-r],u=[r*a,o,i*a];return[l.map((e,t)=>e*c-u[t]*s),u.map((e,t)=>e*c+l[t]*s),[-r*o,a,-i*o]]},Ci=(e,t,n=[0,0,0])=>{let r=[],i=e.filter((t,n)=>!n||Math.hypot(t[0]-e[n-1][0],t[1]-e[n-1][1])>1e-9),a=i.slice(1).map(([e,t],n)=>{let[r,a]=i[n],o=Math.hypot(e-r,t-a);return[(t-a)/o,-(e-r)/o]}),o=i.map(([e],t)=>{let[n,r]=[0,1].map(e=>(a[t-1]?.[e]??0)+(a[t]?.[e]??0)),i=Math.hypot(n,r);return e?[n/i,r/i]:[0,Math.sign(r)]}),s=(e,a)=>{let[s,c]=i[a],[l,u]=[Math.cos(e*hr/t),Math.sin(e*hr/t)];r.push(n[0]+s*l,n[1]+s*u,n[2]-c,o[a][0]*l,o[a][0]*u,-o[a][1])};for(let e=1;e<i.length;e++)for(let n=0;n<t;n++)[...i[e-1][0]?[[n,e-1],[n+1,e-1],[n+1,e]]:[],...i[e][0]?[[n,e-1],[n+1,e],[n,e]]:[]].forEach(([e,t])=>s(e,t));return r},wi=(e,t,n,[r,i],a)=>{let o=(e,t,n,r)=>Array.from({length:t},(i,a)=>{let o=a*hr/t/4;return[e*Math.sin(o),n-r*e*Math.cos(o)]});return Ci([...r?o(t[0],r,0,1):[[0,0]],...t.map((n,r)=>[n,e*r/(t.length-1)]),...i?o(t[t.length-1],i,e,-1).reverse():[[0,e]]],n,a)},Ti=(e,[t,n,r])=>Array.from({length:e.length*(10/6)},(i,a)=>{let[o,s]=[Math.floor(a/10),a%10];return s<6?e[6*o+s]:[t,n,-1,r][s-6]}),Ei=[[5,1],[7,2],[10,3]],Di=/* @__PURE__ */ new Map,Oi=(e,t,n,r=[1,1])=>{let[i,a]=Ei[e];!e&&n.length>3&&(n=[n[0],n[n.length>>1],n[n.length-1]]);let o=`${e} ${t} ${n} ${r}`,s=Di.get(o);return s||(s=Ti(wi(t,n,i,r.map(e=>Math.ceil(a*e))),[1,1,1]),Di.set(o,s)),s},ki=(e,t,n,[r,i,a],o,s,c=[1,1,1])=>{let[l,u,d]=typeof s==`number`?[s,s,s]:s,f=l==u&&u==d,[p,m,h,g,_,v,y,b,x]=[...r,...i,...a],ee=n[0]+p*o[0]+g*o[1]+y*o[2],te=n[1]+m*o[0]+_*o[1]+b*o[2],ne=n[2]+h*o[0]+v*o[1]+x*o[2];for(let n=0;n<t.length;n+=10){let[r,i,a]=[t[n]*l,t[n+1]*u,t[n+2]*d],[o,s,S]=[t[n+3],t[n+4],t[n+5]];if(!f){[o,s,S]=[o/l,s/u,S/d];let e=Math.sqrt(o*o+s*s+S*S)||1;[o,s,S]=[o/e,s/e,S/e]}e.push(ee+p*r+g*i-y*a,te+m*r+_*i-b*a,ne+h*r+v*i-x*a,p*o+g*s-y*S,m*o+_*s-b*S,h*o+v*s-x*S,t[n+6]*c[0],t[n+7]*c[1],t[n+8],t[n+9]*c[2])}},Ai=(e,t,n)=>{let r=ni(e,0);for(let i=t;n<1&&i<e.length;i+=10)r[i+8]==-2&&(r[i+6]*=n,r[i+7]*=n,r[i+9]*=n)},ji=(e,t)=>{let n=e[0]*t[0]+e[1]*t[1]+e[2]*t[2],r=t.map((t,r)=>t-e[r]*n),i=Math.hypot(...r)||1,[a,o,s]=r.map(e=>e/i);return[[a,o,s],[o*e[2]-s*e[1],s*e[0]-a*e[2],a*e[1]-o*e[0]],e]},Mi=(e,t,n,r,i,a,o=1,s)=>{let c=[r[0]-n[0],r[1]-n[1],r[2]-n[2]],l=Math.hypot(...c)||1,[u,d]=typeof o==`number`?[o,o]:o;ki(e,t,n,ji([c[0]/l,c[1]/l,c[2]/l],i),[0,0,0],[u,d,l/a],s)},Ni={PELVIS:0,SPINE:1,CHEST:2,NECK:3,HEAD:4,CLAVICLE_L:5,ARM_L:6,FOREARM_L:7,HAND_L:8,CLAVICLE_R:9,ARM_R:10,FOREARM_R:11,HAND_R:12,THIGH_L:13,SHIN_L:14,FOOT_L:15,TOE_L:16,THIGH_R:17,SHIN_R:18,FOOT_R:19,TOE_R:20},Pi=Object.keys(Ni).length,Fi=[-1,0,1,2,3,2,5,6,7,2,9,10,11,0,13,14,15,0,17,18,19],Ii=[[0,.98,0],[0,.12,0],[0,.2,0],[0,.22,0],[0,.1,0],[-.04,.17,0],[-.15,0,0],[-.03,-.29,0],[0,-.26,0],[.04,.17,0],[.15,0,0],[.03,-.29,0],[0,-.26,0],[-.1,-.05,0],[0,-.44,0],[0,-.43,0],[0,-.04,-.13],[.1,-.05,0],[0,-.44,0],[0,-.43,0],[0,-.04,-.13]],Li={MALE:0,FEMALE:1},$=Ii.map(e=>[...e]);$[1]=[0,.115,0],$[2]=[0,.19,0],$[3]=[0,.21,0],$[4]=[0,.095,0],[-1,1].forEach((e,t)=>{$[5+4*t]=[.035*e,.16,0],$[6+4*t]=[.132*e,0,0],$[7+4*t]=[.026*e,-.275,0],$[8+4*t]=[0,-.25,0],$[13+4*t]=[.104*e,-.05,0]});var Ri=[Ii,$],zi=[0,0,0,1],Bi=(e=[0,0,0],t=0,n=0)=>({at:e,yaw:t,hips:[0,0,0],rot:Array.from({length:Pi},()=>[...zi]),...n?{rest:Ri[n]}:{}}),Vi=([e,t,n,r],[i,a,o,s])=>[r*i+e*s+t*o-n*a,r*a-e*o+t*s+n*i,r*o+e*a-t*i+n*s,r*s-e*i-t*a-n*o],Hi=([e,t,n],r)=>{let i=Math.sin(r/2);return[e*i,t*i,n*i,Math.cos(r/2)]},Ui=(e,[t,n,r])=>{let[i,a,o,s]=e,[c,l,u]=[2*(a*r-o*n),2*(o*t-i*r),2*(i*n-a*t)];return[t+s*c+a*u-o*l,n+s*l+o*c-i*u,r+s*u+i*l-a*c]},Wi=(e,t,n)=>{let r=e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],i=r<0?-1:1;if(r*=i,r>.9995){let r=e.map((e,r)=>e+(i*t[r]-e)*n),a=Math.hypot(...r);return r.map(e=>e/a)}let a=Math.acos(r),[o,s]=[Math.sin((1-n)*a),Math.sin(n*a)*i],c=1/Math.sin(a);return e.map((e,n)=>(e*o+t[n]*s)*c)},Gi=e=>{let t=[],n=[],r=Hi([0,1,0],e.yaw),i=e.rest??Ri[0];for(let a=0;a<Pi;a++){let o=Fi[a],s=o<0?r:n[o];n[a]=Vi(s,e.rot[a]);let c=Ui(s,a===0?i[0].map((t,n)=>t+e.hips[n]):i[a]),l=o<0?e.at:t[o];t[a]=[l[0]+c[0],l[1]+c[1],l[2]+c[2]]}return{pos:t,rot:n}},Ki=[1,.62],qi=2.2,Ji=e=>{let t=parseInt(de[e].slice(1),16);return[t>>16,t>>8&255,255&t].map(e=>e/255)},Yi=(e,n,r)=>e.flatMap((e,i)=>{if(e.state===t.DROPPED)return[{team:i,at:[e.x,e.y,e.z],dropped:!0}];if(e.state===t.CARRIED){let t=r(e.by);return t?[{team:i,at:[t.x,t.y,t.z],by:{id:e.by,yaw:t.yaw,vx:t.vx,vz:t.vz}}]:[]}return[{team:i,at:n[i]}]}),Xi=[[1,0,0],[0,1,0],[0,0,1]],Zi=(e,t,n)=>{let r=ni(e,0);for(let i=t;i<e.length;i+=10)r[i+6]*=n,r[i+7]*=n,r[i+9]*=n,r[i+8]=-2},Qi=(e,t,n,r,[i,a,o])=>{let[s,c,l]=[n[0]-t[0],n[1]-t[1],n[2]-t[2]],[u,d,f]=[r[0]-t[0],r[1]-t[1],r[2]-t[2]],p=[c*f-l*d,l*u-s*f,s*d-c*u],m=Math.hypot(...p)||1;if(Array.isArray(e))for(let s of[t,n,r])e.push(...s,p[0]/m,p[1]/m,p[2]/m,i,a,-1,o);else{let s=e.room(30),c=e.length,l=p[0]/m,u=p[1]/m,d=p[2]/m;for(let e of[t,n,r])s[c++]=e[0],s[c++]=e[1],s[c++]=e[2],s[c++]=l,s[c++]=u,s[c++]=d,s[c++]=i,s[c++]=a,s[c++]=-1,s[c++]=o;e.length=c}},$i=(e,t,n,r,i)=>{for(let a=0;a<28;a++){let[o,s]=[a,a+1].map(e=>2*e*Math.PI/28),c=(e,n)=>[t[0]+e*Math.cos(n),t[1],t[2]+e*Math.sin(n)];Qi(e,c(n,o),c(r,s),c(r,o),i),Qi(e,c(n,o),c(n,s),c(r,s),i)}},ea=(e,t,n,r)=>{((e,t,n,r)=>{for(let i=0;i<28;i++){let[a,o]=[i,i+1].map(e=>2*e*Math.PI/28);Qi(e,t,[t[0]+n*Math.cos(o),t[1],t[2]+n*Math.sin(o)],[t[0]+n*Math.cos(a),t[1],t[2]+n*Math.sin(a)],r)}})(e,[t[0],t[1]+.04,t[2]],1.5,n.map(e=>.4*e));let i=e.length;$i(e,[t[0],t[1]+.045,t[2]],1.34,1.5,n),Zi(e,i,qi*(.75+.25*Math.sin(3*r)))},ta=(e,t,n,[r,i],a,o,s)=>{let c=[-n[2],0,n[0]],l=(e,s)=>{let l=a*e*Math.sin(7*o-5*e),u=i*s*(1-e);return[t[0]+n[0]*r*e+c[0]*l,t[1]-u+.12*r*e*Math.sin(5*o-4*e)*a,t[2]+n[2]*r*e+c[2]*l]};for(let t=0;t<8;t++){let[n,r]=[t/8,(t+1)/8],[i,a,o,c]=[l(n,0),l(r,0),l(r,1),l(n,1)],u=[(a[1]-i[1])*(c[2]-i[2])-(a[2]-i[2])*(c[1]-i[1]),(a[2]-i[2])*(c[0]-i[0])-(a[0]-i[0])*(c[2]-i[2]),(a[0]-i[0])*(c[1]-i[1])-(a[1]-i[1])*(c[0]-i[0])],d=Math.hypot(...u)||1,f=(e,t)=>[e[0]+u[0]/d*.004*t,e[1]+u[1]/d*.004*t,e[2]+u[2]/d*.004*t];for(let t of[1,-1]){let n=[i,a,o,c].map(e=>f(e,t)),[r,l,u,d]=t>0?n:[n[0],n[3],n[2],n[1]];Qi(e,r,l,u,s),Qi(e,r,u,d,s)}}},na=(e,t,n,r)=>{Mi(e,Oi(1,1,[1,1],[0,0]),t,n,[.6,0,.8],1,.045,[.82,.84,.9]);let i=e.length;ki(e,Oi(1,0,[1,1]),n,Xi,[0,0,0],.09,r),Zi(e,i,qi)},ra=(e,t,n,r,i)=>{let[a,o,s]=t.at,c=r+1.7*t.team;if(t.by){let{yaw:r,vx:l,vz:u}=t.by,d=-Math.sin(r),f=-Math.cos(r),p=Math.hypot(l,u),[m,h]=i??[[a,o+1.3,s],Hi([0,1,0],r)],g=e=>Ui(h,e).map((e,t)=>m[t]+e),_=g([0,-.4,.2]),v=g([0,1.5499999999999998,.42]),[y,b]=p>1?[-l/p,-u/p]:[-d,-f];na(e,_,v,n);let x=Math.min(1,p/8);ta(e,v,[y,0,b],[Ki[0]*(.7+.5*x),Ki[1]],.1+.16*x,c,n);return}if(t.dropped){let t=12.9898*a+78.233*s,[i,l]=[Math.cos(t),Math.sin(t)],u=[a+2.3*i,o+.6,s+2.3*l];na(e,[a,o+.06,s],u,n),ta(e,u,[i,0,l],[.8*Ki[0],.8*Ki[1]],.04,c,n);let d=e.length;$i(e,[a,o+.045,s],1.4,1.5,n),Zi(e,d,qi*(.5+.5*Math.abs(Math.sin(5*r))));return}let l=[a,o+2.4,s];na(e,[a,o,s],l,n);let u=.6+t.team*Math.PI;ta(e,l,[Math.cos(u),0,Math.sin(u)],Ki,.18,c,n)},ia=[[1,0,0],[0,0,1],[0,1,0]],aa=(e,t)=>[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]],oa=(e,t,n,r)=>{let i=aa(ri(t[1],t[0]),ri(t[2],t[0])),a=r&&ai(i,ri(t[0],r))<0?[...t].reverse():t;for(let t=1;t<a.length-1;t++)Qi(e,a[0],a[t],a[t+1],n)},sa=(e,t,n,r,i=0)=>{let a=t.map((e,t)=>(e+n[t])/2),o=e=>[1&e?n[0]:t[0],2&e?n[1]:t[1],4&e?n[2]:t[2]];for(let t of[[0,1,3,2],[4,5,7,6],[0,1,5,4],[2,3,7,6],[0,2,6,4],[1,3,7,5]].filter((e,t)=>!(i>>t&1)))oa(e,t.map(o),r,a)},ca=(e,t,[n,r,i],a=0)=>{let[o,s]=[Math.cos(a),Math.sin(a)];for(let a=0;a<t.length;a+=10)e.push(n+o*t[a]+s*t[a+2],r+t[a+1],i-s*t[a]+o*t[a+2],o*t[a+3]+s*t[a+5],t[a+4],o*t[a+5]-s*t[a+3],...t.slice(a+6,a+10))},la=(e,t,n)=>{let r=e.length;n(),Zi(e,r,t)};export{ri as $,be as $n,Bt as $t,ui as A,Re as An,rr as At,xi as B,Ee as Bn,U as Bt,Bi as C,xe as Cn,lr as Ct,mi as D,ce as Dn,cr as Dt,Ui as E,le as En,fr as Et,di as F,He as Fn,Hn as Ft,Ai as G,Ae as Gn,$t as Gt,ji as H,C as Hn,kn as Ht,ci as I,oe as In,gn as It,oi as J,Ke as Jn,Kt as Jt,ai as K,Je as Kn,I as Kt,gi as L,Ze as Ln,Qn as Lt,fi as M,Fe as Mn,nr as Mt,pi as N,Le as Nn,tr as Nt,hi as O,De as On,er as Ot,_i as P,Pe as Pn,Sn as Pt,Oi as Q,ve as Qn,Ut as Qt,yi as R,Ue as Rn,Ln as Rt,Vi as S,Ce as Sn,Or as St,Gi as T,we as Tn,K as Tt,Si as U,he as Un,jn as Ut,ii as V,ie as Vn,Rn as Vt,wi as W,je as Wn,Mn as Wt,Mi as X,se as Xn,qt as Xt,ki as Y,Ye as Yn,Jt as Yt,Ci as Z,_e as Zn,Wt as Zt,Pi as _,Me as _n,_r as _t,la as a,ht as an,m as ar,Z as at,Ri as b,Te as bn,Sr as bt,ea as c,Ft as cn,a as cr,Er as ct,Zi as d,ot as dn,i as dr,vr as dt,N as en,ye as er,si as et,$i as f,it as fn,o as fr,Nr as ft,Ni as g,pe as gn,Pr as gt,Li as h,ze as hn,ei as ht,oa as i,Tt as in,re as ir,hr as it,li as j,Ie as jn,ir as jt,vi as k,Ne as kn,W as kt,ra as l,A as ln,t as lr,Ir as lt,Qi as m,Be as mn,Tr as mt,sa as n,zt as nn,ue as nr,ni as nt,ca as o,at as on,r as or,Hr as ot,Ji as p,Ve as pn,c as pr,Ur as pt,Ti as q,Ge as qn,Gt as qt,aa as r,k as rn,Xe as rr,xr as rt,qi as s,Et as sn,s as sr,Jr as st,ia as t,Ht as tn,de as tr,ti as tt,Yi as u,j as un,n as ur,Wr as ut,Fi as v,Oe as vn,Cr as vt,Wi as w,Se as wn,mr as wt,Hi as x,ae as xn,Dr as xt,Ii as y,ke as yn,Mr as yt,bi as z,We as zn,H as zt};