@quake2ts/shared 0.0.754 → 0.0.757
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/browser/index.global.js +1 -1
- package/dist/browser/index.global.js.map +1 -1
- package/dist/cjs/index.cjs +7 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +7 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/net/netchan.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/net/netchan.ts +11 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var Quake2Shared=(()=>{var nt=Object.defineProperty;var Lo=Object.getOwnPropertyDescriptor;var wo=Object.getOwnPropertyNames;var zo=Object.prototype.hasOwnProperty;var yn=(t,e)=>{for(var n in e)nt(t,n,{get:e[n],enumerable:!0})},Do=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of wo(e))!zo.call(t,i)&&i!==n&&nt(t,i,{get:()=>e[i],enumerable:!(o=Lo(e,i))||o.enumerable});return t};var Io=t=>Do(nt({},"__esModule",{value:!0}),t);var Ja={};yn(Ja,{AMMO_ITEM_MAP:()=>Fo,AMMO_MAX:()=>Ye,AMMO_TYPE_COUNT:()=>Ga,ANORMS:()=>j,ATTN_IDLE:()=>W0,ATTN_LOOP_NONE:()=>U0,ATTN_NONE:()=>G0,ATTN_NORM:()=>k0,ATTN_STATIC:()=>H0,AmmoItemId:()=>tt,AmmoType:()=>et,BinaryStream:()=>mn,BinaryWriter:()=>Ve,CGAME_EXPORT_KEYS:()=>Ri,CGAME_IMPORT_KEYS:()=>Ci,CMD_BACKUP:()=>Zs,CONTENTS_AREAPORTAL:()=>dl,CONTENTS_AUX:()=>il,CONTENTS_CURRENT_0:()=>br,CONTENTS_CURRENT_180:()=>Sr,CONTENTS_CURRENT_270:()=>_r,CONTENTS_CURRENT_90:()=>gr,CONTENTS_CURRENT_DOWN:()=>Ar,CONTENTS_CURRENT_UP:()=>Tr,CONTENTS_DEADMONSTER:()=>hl,CONTENTS_DETAIL:()=>yl,CONTENTS_LADDER:()=>we,CONTENTS_LAVA:()=>sl,CONTENTS_MIST:()=>cl,CONTENTS_MONSTER:()=>pl,CONTENTS_MONSTERCLIP:()=>ml,CONTENTS_NONE:()=>Le,CONTENTS_NO_WATERJUMP:()=>yr,CONTENTS_ORIGIN:()=>xl,CONTENTS_PLAYER:()=>gl,CONTENTS_PLAYERCLIP:()=>fl,CONTENTS_PROJECTILE:()=>Sl,CONTENTS_PROJECTILECLIP:()=>ul,CONTENTS_SLIME:()=>al,CONTENTS_SOLID:()=>ol,CONTENTS_TRANSLUCENT:()=>bl,CONTENTS_TRIGGER:()=>hr,CONTENTS_WATER:()=>ll,CONTENTS_WINDOW:()=>rl,CS_AIRACCEL:()=>ui,CS_CDTRACK:()=>ii,CS_GENERAL:()=>gi,CS_IMAGES:()=>pi,CS_ITEMS:()=>yi,CS_LIGHTS:()=>hi,CS_MAPCHECKSUM:()=>fi,CS_MAXCLIENTS:()=>di,CS_MAX_STRING_LENGTH:()=>sc,CS_MAX_STRING_LENGTH_OLD:()=>ac,CS_MODELS:()=>mi,CS_NAME:()=>ri,CS_PLAYERS:()=>bi,CS_SKY:()=>si,CS_SKYAXIS:()=>ai,CS_SKYROTATE:()=>li,CS_SOUNDS:()=>xi,CS_STATUSBAR:()=>ci,ClientCommand:()=>to,CollisionEntityIndex:()=>lt,ConfigStringIndex:()=>K,CvarFlags:()=>Pn,DEFAULT_FORWARD_SPEED:()=>ws,DEFAULT_MOUSE_SENSITIVITY:()=>Us,DEFAULT_PITCH_SPEED:()=>Bs,DEFAULT_SIDE_SPEED:()=>zs,DEFAULT_UP_SPEED:()=>Ds,DEFAULT_YAW_SPEED:()=>Is,DEG2RAD:()=>nr,DIST_EPSILON:()=>q,EntityEffects:()=>co,EntityEvent:()=>uo,GAME_EXPORT_KEYS:()=>Vi,GAME_IMPORT_KEYS:()=>Ni,G_GetAmmoStat:()=>Lt,G_GetPowerupStat:()=>Oa,G_SetAmmoStat:()=>Ca,G_SetPowerupStat:()=>Ra,LAST_VISIBLE_CONTENTS:()=>_l,LayoutFlags:()=>oo,MASK_ALL:()=>zl,MASK_BLOCK_SIGHT:()=>kl,MASK_CURRENT:()=>Mr,MASK_DEADSOLID:()=>Il,MASK_LADDER_NAV_SOLID:()=>Hl,MASK_MONSTERSOLID:()=>Bl,MASK_NAV_SOLID:()=>Wl,MASK_OPAQUE:()=>Ul,MASK_PLAYERSOLID:()=>Dl,MASK_PROJECTILE:()=>Xl,MASK_SHOT:()=>Gl,MASK_SOLID:()=>it,MASK_WALK_NAV_SOLID:()=>Kl,MASK_WATER:()=>ie,MAX_CHALLENGES:()=>Hs,MAX_CLIENTS:()=>Yr,MAX_CONFIGSTRINGS:()=>ni,MAX_EDICTS:()=>ic,MAX_GENERAL:()=>ei,MAX_IMAGES:()=>$r,MAX_INFO_STRING:()=>Ys,MAX_ITEMS:()=>Qr,MAX_LIGHTSTYLES:()=>Jr,MAX_MODELS:()=>jr,MAX_MSGLEN:()=>Js,MAX_OSPATH:()=>rc,MAX_PACKET_ENTITIES:()=>Ks,MAX_QPATH:()=>oc,MAX_SHADOW_LIGHTS:()=>ti,MAX_SOUNDS:()=>qr,MAX_SOUND_CHANNELS:()=>B0,MAX_STRING_CHARS:()=>ec,MAX_STRING_TOKENS:()=>tc,MAX_TOKEN_CHARS:()=>nc,MAX_WHEEL_ITEMS:()=>mt,MZ_BFG:()=>la,MZ_BFG2:()=>ma,MZ_BLASTER:()=>js,MZ_BLASTER2:()=>ga,MZ_BLUEHYPERBLASTER:()=>da,MZ_CHAINGUN1:()=>Qs,MZ_CHAINGUN2:()=>ea,MZ_CHAINGUN3:()=>ta,MZ_ETF_RIFLE:()=>pa,MZ_ETF_RIFLE_2:()=>ya,MZ_GRENADE:()=>ra,MZ_HEATBEAM:()=>ba,MZ_HYPERBLASTER:()=>ca,MZ_IONRIPPER:()=>ua,MZ_LOGIN:()=>ia,MZ_LOGOUT:()=>sa,MZ_MACHINEGUN:()=>qs,MZ_NUKE1:()=>_a,MZ_NUKE2:()=>Ta,MZ_NUKE4:()=>Aa,MZ_NUKE8:()=>Ma,MZ_PHALANX:()=>fa,MZ_PHALANX2:()=>xa,MZ_PROX:()=>ha,MZ_RAILGUN:()=>na,MZ_ROCKET:()=>oa,MZ_SHOTGUN:()=>$s,MZ_SSHOTGUN:()=>aa,MZ_TRACKER:()=>Sa,MersenneTwister19937:()=>Fe,NUM_AMMO_STATS:()=>Na,NUM_BITS_FOR_AMMO:()=>Je,NUM_BITS_FOR_POWERUP:()=>qe,NUM_POWERUP_STATS:()=>Va,NetChan:()=>pn,NetworkMessageBuilder:()=>xn,PITCH:()=>Oe,POWERUP_MAX:()=>je,PlaneSide:()=>Mn,PlayerButton:()=>le,PlayerStat:()=>so,PmFlag:()=>$,PmType:()=>ae,PowerupId:()=>io,RAD2DEG:()=>or,ROLL:()=>rt,RandomGenerator:()=>Ee,RenderFx:()=>lo,Replay:()=>xt,SLIDEMOVE_BLOCKED_FLOOR:()=>Bn,SLIDEMOVE_BLOCKED_WALL:()=>Un,SOUND_FULLVOLUME:()=>K0,SOUND_LOOP_ATTENUATE:()=>X0,STOP_EPSILON:()=>ee,SURF_ALPHATEST:()=>Pl,SURF_FLOWING:()=>Rl,SURF_LIGHT:()=>Al,SURF_N64_SCROLL_FLIP:()=>wl,SURF_N64_SCROLL_X:()=>El,SURF_N64_SCROLL_Y:()=>Ll,SURF_N64_UV:()=>Fl,SURF_NODRAW:()=>Ol,SURF_NONE:()=>Tl,SURF_SKY:()=>vl,SURF_SLICK:()=>Ml,SURF_TRANS33:()=>Vl,SURF_TRANS66:()=>Cl,SURF_WARP:()=>Nl,ServerCommand:()=>eo,SoundChannel:()=>Oo,TempEntity:()=>no,UPDATE_BACKUP:()=>Xs,U_ALPHA:()=>Kt,U_ANGLE1:()=>kt,U_ANGLE2:()=>Dt,U_ANGLE3:()=>It,U_EFFECTS16:()=>qt,U_EFFECTS8:()=>Xt,U_EVENT:()=>Ut,U_FRAME16:()=>Jt,U_FRAME8:()=>Bt,U_INSTANCE_BITS:()=>an,U_LOOP_ATTENUATION_HIGH:()=>un,U_LOOP_VOLUME:()=>ln,U_MODEL:()=>Wt,U_MODEL2:()=>$t,U_MODEL3:()=>Qt,U_MODEL4:()=>en,U_MOREBITS1:()=>Me,U_MOREBITS2:()=>Zt,U_MOREBITS3:()=>tn,U_MOREBITS4:()=>cn,U_NUMBER16:()=>ve,U_OLDORIGIN:()=>mo,U_OLD_FRAME_HIGH:()=>fn,U_ORIGIN1:()=>wt,U_ORIGIN2:()=>zt,U_ORIGIN3:()=>Gt,U_OWNER_HIGH:()=>dn,U_REMOVE:()=>fo,U_RENDERFX16:()=>jt,U_RENDERFX8:()=>Ht,U_SCALE:()=>sn,U_SKIN16:()=>nn,U_SKIN8:()=>Yt,U_SOLID:()=>rn,U_SOUND:()=>on,WEAPON_AMMO_MAP:()=>hn,WEAPON_WHEEL_ORDER:()=>ka,WaterLevel:()=>fe,WeaponId:()=>Qe,YAW:()=>Pe,ZERO_VEC3:()=>E,addBlendColor:()=>ar,addContents:()=>Vr,addPmFlag:()=>G,addPointToBounds:()=>Yo,addVec3:()=>O,addViewAngles:()=>ks,angleMod:()=>he,angleVectors:()=>re,applyPmove:()=>Ua,applyPmoveAccelerate:()=>J,applyPmoveAddCurrents:()=>ge,applyPmoveAirAccelerate:()=>At,applyPmoveAirMove:()=>St,applyPmoveFlyMove:()=>ys,applyPmoveFriction:()=>Ke,applyPmoveWalkMove:()=>Tt,applyPmoveWaterMove:()=>_t,assertContract:()=>vi,attenuationToDistanceMultiplier:()=>Po,boxContents:()=>Gr,boxOnPlaneSide:()=>zr,boxesIntersect:()=>Jo,buildAirGroundWish:()=>vt,buildCollisionModel:()=>Lr,buildWaterWish:()=>Nt,calculateMaxAudibleDistance:()=>Wa,categorizePosition:()=>ke,checkDuckState:()=>Mt,checkJump:()=>ht,checkSpecialMovement:()=>Cs,clampViewAngles:()=>Ls,clipBoxToBrush:()=>ut,clipVelocityAgainstPlanes:()=>jo,clipVelocityVec3:()=>oe,closestPointToBox:()=>Ko,combineSurfaceFlags:()=>Or,computePlaneSignBits:()=>ct,computePlayerDimensions:()=>He,concatRotationMatrices:()=>ot,configStringSize:()=>oi,copyVec3:()=>Uo,crc8:()=>Ea,createDefaultTrace:()=>Ie,createEmptyBounds3:()=>Zo,createMat4Identity:()=>Tn,createRandomGenerator:()=>lr,crossVec3:()=>ne,currentVectorFromContents:()=>bt,degToRad:()=>Ce,disableTraceDebug:()=>Fr,distance:()=>Wo,distanceBetweenBoxesSquared:()=>Xo,dotVec3:()=>B,enableTraceDebug:()=>Pr,fixStuckObjectGeneric:()=>Ct,getAmmoCount:()=>Ha,getIconPath:()=>Ka,getWaterLevel:()=>_e,goodPosition:()=>Ot,groundCurrentVelocity:()=>Dn,hasAllContents:()=>vr,hasAnyContents:()=>Nr,hasPmFlag:()=>I,hasSurfaceFlags:()=>Rr,inPHS:()=>Wr,inPVS:()=>kr,initialSnapPosition:()=>Ps,intersects:()=>Xa,isAtLeastWaistDeep:()=>pt,isUnderwater:()=>Oi,ladderTrace:()=>Ya,lengthSquaredVec3:()=>ue,lengthVec3:()=>U,lerpAngle:()=>rr,mat4FromBasis:()=>mr,mat4Identity:()=>cr,mat4Ortho:()=>dr,mat4Perspective:()=>pr,mat4Translate:()=>xr,mouseDeltaToViewDelta:()=>Ws,multiplyMat4:()=>ur,multiplyVec3:()=>Go,negateVec3:()=>ko,normalizeVec3:()=>L,perpendicularVec3:()=>gn,planeDistanceToPoint:()=>se,pmoveCmdScale:()=>cs,pointContents:()=>Br,pointContentsMany:()=>Ur,pointInsideBrush:()=>vn,pointOnPlaneSide:()=>wr,projectPointOnPlane:()=>bn,projectSourceVec3:()=>$o,projectSourceVec3WithUp:()=>Qo,radToDeg:()=>Re,removeContents:()=>Cr,removePmFlag:()=>Z,resolveSlideMove:()=>Gn,rotatePointAroundVector:()=>tr,runPmove:()=>us,scaleVec3:()=>P,slerpVec3:()=>er,slideClipVelocityVec3:()=>qo,slideMove:()=>gt,snapPosition:()=>Os,stairTrace:()=>Za,stepSlideMove:()=>ce,subtractVec3:()=>te,testBoxInBrush:()=>Nn,traceBox:()=>On,traceDebugInfo:()=>Y,transformPointMat4:()=>fr,validateContract:()=>Fn,vec3Equals:()=>Ho,vectorToAngles:()=>sr,vectorToYaw:()=>ir,waterCurrentVelocity:()=>zn,writeDeltaEntity:()=>za,writePlayerState:()=>Da,writeRemoveEntity:()=>wa,writeUserCommand:()=>Pa});var E={x:0,y:0,z:0},ee=.1,Bo=Math.PI/180;function Uo(t){return{x:t.x,y:t.y,z:t.z}}function O(t,e){return{x:t.x+e.x,y:t.y+e.y,z:t.z+e.z}}function te(t,e){return{x:t.x-e.x,y:t.y-e.y,z:t.z-e.z}}function Go(t,e){return{x:t.x*e.x,y:t.y*e.y,z:t.z*e.z}}function P(t,e){return{x:t.x*e,y:t.y*e,z:t.z*e}}function ko(t){return P(t,-1)}function B(t,e){return t.x*e.x+t.y*e.y+t.z*e.z}function ne(t,e){return{x:t.y*e.z-t.z*e.y,y:t.z*e.x-t.x*e.z,z:t.x*e.y-t.y*e.x}}function ue(t){return B(t,t)}function U(t){return Math.sqrt(ue(t))}function Wo(t,e){return U(te(t,e))}function Ho(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z}function L(t){let e=U(t);return e===0?t:P(t,1/e)}function bn(t,e){let n=1/B(e,e),o=B(e,t)*n;return te(t,P(e,n*o))}function gn(t){let e=0,n=Math.abs(t.x);return Math.abs(t.y)<n&&(e=1,n=Math.abs(t.y)),Math.abs(t.z)<n&&(e=2),L(bn(e===0?{x:1,y:0,z:0}:e===1?{x:0,y:1,z:0}:{x:0,y:0,z:1},t))}function Ko(t,e,n){return{x:t.x<e.x?e.x:t.x>n.x?n.x:t.x,y:t.y<e.y?e.y:t.y>n.y?n.y:t.y,z:t.z<e.z?e.z:t.z>n.z?n.z:t.z}}function Xo(t,e,n,o){let i=0;if(e.x<n.x){let r=e.x-n.x;i+=r*r}else if(t.x>o.x){let r=t.x-o.x;i+=r*r}if(e.y<n.y){let r=e.y-n.y;i+=r*r}else if(t.y>o.y){let r=t.y-o.y;i+=r*r}if(e.z<n.z){let r=e.z-n.z;i+=r*r}else if(t.z>o.z){let r=t.z-o.z;i+=r*r}return i}function Zo(){return{mins:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,z:Number.POSITIVE_INFINITY},maxs:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY,z:Number.NEGATIVE_INFINITY}}}function Yo(t,e){return{mins:{x:Math.min(e.mins.x,t.x),y:Math.min(e.mins.y,t.y),z:Math.min(e.mins.z,t.z)},maxs:{x:Math.max(e.maxs.x,t.x),y:Math.max(e.maxs.y,t.y),z:Math.max(e.maxs.z,t.z)}}}function Jo(t,e){return t.mins.x<=e.maxs.x&&t.maxs.x>=e.mins.x&&t.mins.y<=e.maxs.y&&t.maxs.y>=e.mins.y&&t.mins.z<=e.maxs.z&&t.maxs.z>=e.mins.z}function oe(t,e,n){let o=B(t,e)*n,i=t.x-e.x*o,r=t.y-e.y*o,s=t.z-e.z*o;return i>-ee&&i<ee&&(i=0),r>-ee&&r<ee&&(r=0),s>-ee&&s<ee&&(s=0),{x:i,y:r,z:s}}function jo(t,e,n,o){if(e.length===0)return t;let i=t;for(let r=0;r<e.length;r++){i=oe(i,e[r],n);let s=0;for(;s<e.length&&!(s!==r&&B(i,e[s])<0);s++);if(s===e.length)return o&&B(i,o)<=0?E:i}if(e.length===2){let r=ne(e[0],e[1]),s=B(r,t),l=P(r,s);return o&&B(l,o)<=0?E:l}return o&&B(i,o)<=0,E}function qo(t,e,n){return oe(t,e,n)}function $o(t,e,n,o){return{x:t.x+n.x*e.x+o.x*e.y,y:t.y+n.y*e.x+o.y*e.y,z:t.z+n.z*e.x+o.z*e.y+e.z}}function Qo(t,e,n,o,i){return{x:t.x+n.x*e.x+o.x*e.y+i.x*e.z,y:t.y+n.y*e.x+o.y*e.y+i.y*e.z,z:t.z+n.z*e.x+o.z*e.y+i.z*e.z}}function er(t,e,n){let o=B(t,e),i,r;if(Math.abs(o)>.9995)i=1-n,r=n;else{let s=Math.acos(o),l=Math.sin(s),c=Math.sin((1-n)*s),f=Math.sin(n*s);i=c/l,r=f/l}return{x:t.x*i+e.x*r,y:t.y*i+e.y*r,z:t.z*i+e.z*r}}function ot(t,e){let n=i=>[t[i][0]*e[0][0]+t[i][1]*e[1][0]+t[i][2]*e[2][0],t[i][0]*e[0][1]+t[i][1]*e[1][1]+t[i][2]*e[2][1],t[i][0]*e[0][2]+t[i][1]*e[1][2]+t[i][2]*e[2][2]];return[n(0),n(1),n(2)]}function tr(t,e,n){if(U(t)===0)return e;let i=L(t),r=gn(i),s=ne(r,i),l=[[r.x,s.x,i.x],[r.y,s.y,i.y],[r.z,s.z,i.z]],c=[[l[0][0],l[1][0],l[2][0]],[l[0][1],l[1][1],l[2][1]],[l[0][2],l[1][2],l[2][2]]],f=n*Bo,u=Math.cos(f),a=Math.sin(f),m=[[u,a,0],[-a,u,0],[0,0,1]],h=ot(ot(l,m),c);return{x:h[0][0]*e.x+h[0][1]*e.y+h[0][2]*e.z,y:h[1][0]*e.x+h[1][1]*e.y+h[1][2]*e.z,z:h[2][0]*e.x+h[2][1]*e.y+h[2][2]*e.z}}var Oe=0,Pe=1,rt=2,Sn=Math.PI/180,_n=180/Math.PI,nr=Sn,or=_n;function pe(t,e){switch(e){case Oe:return t.x;case Pe:return t.y;case rt:default:return t.z}}function Ce(t){return t*Sn}function Re(t){return t*_n}function rr(t,e,n){let o=e;return o-t>180?o-=360:o-t<-180&&(o+=360),t+n*(o-t)}function he(t){let e=t%360;return e<0?360+e:e}function re(t){let e=Ce(pe(t,Pe)),n=Ce(pe(t,Oe)),o=Ce(pe(t,rt)),i=Math.sin(e),r=Math.cos(e),s=Math.sin(n),l=Math.cos(n),c=Math.sin(o),f=Math.cos(o),u={x:l*r,y:l*i,z:-s},a={x:-c*s*r-f*-i,y:-c*s*i-f*r,z:-c*l},m={x:f*s*r-c*-i,y:f*s*i-c*r,z:f*l};return{forward:u,right:a,up:m}}function ir(t){let e=pe(t,Oe),n=pe(t,Pe);if(e===0)return n===0?0:n>0?90:270;let o=Re(Math.atan2(n,e));return o<0?o+360:o}function sr(t){let e=t.x,n=t.y,o=t.z;if(n===0&&e===0)return{x:o>0?-90:-270,y:0,z:0};let i;e?i=Re(Math.atan2(n,e)):n>0?i=90:i=270,i<0&&(i+=360);let r=Math.sqrt(e*e+n*n),s=Re(Math.atan2(o,r));return s<0&&(s+=360),{x:-s,y:i,z:0}}var j=[[-.525731,0,.850651],[-.442863,.238856,.864188],[-.295242,0,.955423],[-.309017,.5,.809017],[-.16246,.262866,.951056],[0,0,1],[0,.850651,.525731],[-.147621,.716567,.681718],[.147621,.716567,.681718],[0,.525731,.850651],[.309017,.5,.809017],[.525731,0,.850651],[.295242,0,.955423],[.442863,.238856,.864188],[.16246,.262866,.951056],[-.681718,.147621,.716567],[-.809017,.309017,.5],[-.587785,.425325,.688191],[-.850651,.525731,0],[-.864188,.442863,.238856],[-.716567,.681718,.147621],[-.688191,.587785,.425325],[-.5,.809017,.309017],[-.238856,.864188,.442863],[-.425325,.688191,.587785],[-.716567,.681718,-.147621],[-.5,.809017,-.309017],[-.525731,.850651,0],[0,.850651,-.525731],[-.238856,.864188,-.442863],[0,.955423,-.295242],[-.262866,.951056,-.16246],[0,1,0],[0,.955423,.295242],[-.262866,.951056,.16246],[.238856,.864188,.442863],[.262866,.951056,.16246],[.5,.809017,.309017],[.238856,.864188,-.442863],[.262866,.951056,-.16246],[.5,.809017,-.309017],[.850651,.525731,0],[.716567,.681718,.147621],[.716567,.681718,-.147621],[.525731,.850651,0],[.425325,.688191,.587785],[.864188,.442863,.238856],[.688191,.587785,.425325],[.809017,.309017,.5],[.681718,.147621,.716567],[.587785,.425325,.688191],[.955423,.295242,0],[1,0,0],[.951056,.16246,.262866],[.850651,-.525731,0],[.955423,-.295242,0],[.864188,-.442863,.238856],[.951056,-.16246,.262866],[.809017,-.309017,.5],[.681718,-.147621,.716567],[.850651,0,.525731],[.864188,.442863,-.238856],[.809017,.309017,-.5],[.951056,.16246,-.262866],[.525731,0,-.850651],[.681718,.147621,-.716567],[.681718,-.147621,-.716567],[.850651,0,-.525731],[.809017,-.309017,-.5],[.864188,-.442863,-.238856],[.951056,-.16246,-.262866],[.147621,.716567,-.681718],[.309017,.5,-.809017],[.425325,.688191,-.587785],[.442863,.238856,-.864188],[.587785,.425325,-.688191],[.688191,.587785,-.425325],[-.147621,.716567,-.681718],[-.309017,.5,-.809017],[0,.525731,-.850651],[-.525731,0,-.850651],[-.442863,.238856,-.864188],[-.295242,0,-.955423],[-.16246,.262866,-.951056],[0,0,-1],[.295242,0,-.955423],[.16246,.262866,-.951056],[-.442863,-.238856,-.864188],[-.309017,-.5,-.809017],[-.16246,-.262866,-.951056],[0,-.850651,-.525731],[-.147621,-.716567,-.681718],[.147621,-.716567,-.681718],[0,-.525731,-.850651],[.309017,-.5,-.809017],[.442863,-.238856,-.864188],[.16246,-.262866,-.951056],[.238856,-.864188,-.442863],[.5,-.809017,-.309017],[.425325,-.688191,-.587785],[.716567,-.681718,-.147621],[.688191,-.587785,-.425325],[.587785,-.425325,-.688191],[0,-.955423,-.295242],[0,-1,0],[.262866,-.951056,-.16246],[0,-.850651,.525731],[0,-.955423,.295242],[.238856,-.864188,.442863],[.262866,-.951056,.16246],[.5,-.809017,.309017],[.716567,-.681718,.147621],[.525731,-.850651,0],[-.238856,-.864188,-.442863],[-.5,-.809017,-.309017],[-.262866,-.951056,-.16246],[-.850651,-.525731,0],[-.716567,-.681718,-.147621],[-.716567,-.681718,.147621],[-.525731,-.850651,0],[-.5,-.809017,.309017],[-.238856,-.864188,.442863],[-.262866,-.951056,.16246],[-.864188,-.442863,.238856],[-.809017,-.309017,.5],[-.688191,-.587785,.425325],[-.681718,-.147621,.716567],[-.442863,-.238856,.864188],[-.587785,-.425325,.688191],[-.309017,-.5,.809017],[-.147621,-.716567,.681718],[-.425325,-.688191,.587785],[-.16246,-.262866,.951056],[.442863,-.238856,.864188],[.16246,-.262866,.951056],[.309017,-.5,.809017],[.147621,-.716567,.681718],[0,-.525731,.850651],[.425325,-.688191,.587785],[.587785,-.425325,.688191],[.688191,-.587785,.425325],[-.955423,.295242,0],[-.951056,.16246,.262866],[-1,0,0],[-.850651,0,.525731],[-.955423,-.295242,0],[-.951056,-.16246,.262866],[-.864188,.442863,-.238856],[-.951056,.16246,-.262866],[-.809017,.309017,-.5],[-.864188,-.442863,-.238856],[-.951056,-.16246,-.262866],[-.809017,-.309017,-.5],[-.681718,.147621,-.716567],[-.681718,-.147621,-.716567],[-.850651,0,-.525731],[-.688191,.587785,-.425325],[-.587785,.425325,-.688191],[-.425325,.688191,-.587785],[-.425325,-.688191,-.587785],[-.587785,-.425325,-.688191],[-.688191,-.587785,-.425325]];function ar(t,e,n,o,i){if(o<=0)return i;let r=i[0],s=i[1],l=i[2],c=i[3],f=c+(1-c)*o;if(f<=0)return[0,0,0,0];let u=c/f,a=r*u+t*(1-u),m=s*u+e*(1-u),h=l*u+n*(1-u);return[a,m,h,f]}var Fe=class{constructor(e=5489){this.state=new Uint32Array(624);this.index=624;this.seed(e)}seed(e){this.state[0]=e>>>0;for(let n=1;n<624;n++){let o=this.state[n-1]^this.state[n-1]>>>30,i=Math.imul(o>>>0,1812433253)+n;this.state[n]=i>>>0}this.index=624}nextUint32(){this.index>=624&&this.twist();let e=this.state[this.index++];return e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,e^=e>>>18,e>>>0}twist(){for(let e=0;e<624;e++){let n=this.state[e]&2147483648|this.state[(e+1)%624]&2147483647,o=this.state[(e+397)%624]^n>>>1;(n&1)!==0&&(o^=2567483615),this.state[e]=o>>>0}this.index=0}getState(){return{index:this.index,state:Array.from(this.state)}}setState(e){if(e.state.length!==624)throw new Error(`Expected 624 MT state values, received ${e.state.length}`);this.index=e.index,this.state=Uint32Array.from(e.state,n=>n>>>0)}},Ee=class{constructor(e={}){this.mt=new Fe(e.seed)}seed(e){this.mt.seed(e)}frandom(){return this.mt.nextUint32()/4294967296}frandomRange(e,n){return e+(n-e)*this.frandom()}frandomMax(e){return this.frandomRange(0,e)}crandom(){return this.frandomRange(-1,1)}crandomOpen(){let e=Number.EPSILON;return this.frandomRange(-1+e,1)}irandomUint32(){return this.mt.nextUint32()}irandomRange(e,n){if(n-e<=1)return e;let o=n-e,i=4294967296-4294967296%o,r;do r=this.mt.nextUint32();while(r>=i);return e+r%o}irandom(e){return e<=0?0:this.irandomRange(0,e)}randomTimeRange(e,n){return n<=e?e:this.irandomRange(e,n)}randomTime(e){return this.irandom(e)}randomIndex(e){return this.irandom(e.length)}getState(){return{mt:this.mt.getState()}}setState(e){this.mt.setState(e.mt)}};function lr(t){return new Ee(t)}function Tn(){return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function cr(t=new Float32Array(16)){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ur(t,e){let n=new Float32Array(16);for(let o=0;o<4;o+=1)for(let i=0;i<4;i+=1)n[i*4+o]=t[0+o]*e[i*4+0]+t[4+o]*e[i*4+1]+t[8+o]*e[i*4+2]+t[12+o]*e[i*4+3];return n}function dr(t,e,n,o,i,r,s){let l=1/(e-n),c=1/(o-i),f=1/(r-s);return t[0]=-2*l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=f,t[11]=0,t[12]=(e+n)*l,t[13]=(i+o)*c,t[14]=r*f,t[15]=1,t}function fr(t,e){let n=e.x,o=e.y,i=e.z;return{x:t[0]*n+t[4]*o+t[8]*i+t[12],y:t[1]*n+t[5]*o+t[9]*i+t[13],z:t[2]*n+t[6]*o+t[10]*i+t[14]}}function mr(t,e){let n=Tn();return n[0]=e[0].x,n[1]=e[0].y,n[2]=e[0].z,n[4]=e[1].x,n[5]=e[1].y,n[6]=e[1].z,n[8]=e[2].x,n[9]=e[2].y,n[10]=e[2].z,n[12]=t.x,n[13]=t.y,n[14]=t.z,n}function xr(t,e){let n=e.x,o=e.y,i=e.z;return t[12]=t[0]*n+t[4]*o+t[8]*i+t[12],t[13]=t[1]*n+t[5]*o+t[9]*i+t[13],t[14]=t[2]*n+t[6]*o+t[10]*i+t[14],t[15]=t[3]*n+t[7]*o+t[11]*i+t[15],t}function pr(t,e,n,o,i){let r=1/Math.tan(e/2);if(t[0]=r/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[15]=0,i!=null&&i!==1/0){let s=1/(o-i);t[10]=(i+o)*s,t[14]=2*i*o*s}else t[10]=-1,t[14]=-2*o;return t}var Le=0,ol=1,rl=2,il=4,sl=8,al=16,ll=32,cl=64,hr=1073741824,yr=8192,ul=16384,dl=32768,fl=65536,ml=131072,br=262144,gr=524288,Sr=1048576,_r=2097152,Tr=4194304,Ar=8388608,xl=16777216,pl=33554432,hl=67108864,yl=134217728,bl=268435456,we=536870912,gl=1073741824,Sl=-2147483648,_l=64,Tl=0,Al=1,Ml=2,vl=4,Nl=8,Vl=16,Cl=32,Rl=64,Ol=128,Pl=33554432,Fl=268435456,El=536870912,Ll=1073741824,wl=-2147483648,zl=4294967295,it=3,Dl=1107361795,Il=65539,Bl=1107427331,ie=56,Ul=25,Gl=1174405123,Mr=16515072,kl=1107296281,Wl=65539,Hl=3,Kl=196611,Xl=1174421507;function vr(t,e){return(t&e)===e}function Nr(t,e){return(t&e)!==0}function Vr(t,e){return t|e}function Cr(t,e){return t&~e}function Rr(t,e){return(t&e)===e}function Or(...t){let e=0;for(let n of t)e|=n;return e}function ze(t=0,e={x:-8192,y:-8192,z:-8192},n={x:8192,y:8192,z:8192}){if(t>=4)return{axis:-1,dist:0,children:null,items:new Set};let o=t%2,i=.5*(o===0?e.x+n.x:e.y+n.y),r={...e},s={...n},l={...e},c={...n};o===0?(s.x=i,l.x=i):(s.y=i,l.y=i);let f=ze(t+1,r,s),u=ze(t+1,l,c);return{axis:o,dist:i,children:[f,u],items:new Set}}function An(t,e,n,o){let i=t;for(;i.axis!==-1&&i.children;){let r=i.axis,s=i.dist,l=r===0?n.x:n.y,c=r===0?o.x:o.y;if(l>s)i=i.children[1];else if(c<s)i=i.children[0];else break}return i.items.add(e),i}function ye(t,e,n,o){for(let c of t.items)o.add(c);if(t.axis===-1||!t.children)return;let i=t.axis,r=t.dist,s=i===0?e.x:e.y;(i===0?n.x:n.y)>r&&ye(t.children[1],e,n,o),s<r&&ye(t.children[0],e,n,o)}var Mn=(o=>(o[o.FRONT=1]="FRONT",o[o.BACK=2]="BACK",o[o.CROSS=3]="CROSS",o))(Mn||{}),Y=null;function Pr(){Y={nodesTraversed:0,leafsReached:0,brushesTested:0}}function Fr(){Y=null}var q=.03125,Er=Number.MAX_SAFE_INTEGER-1,De=1;function Lr(t){let e=t.planes.map(s=>({...s,signbits:ct(s.normal)})),n=t.nodes.map(s=>({plane:e[s.planenum],children:s.children})),o=t.brushes.map(s=>{let l=t.brushSides.slice(s.firstSide,s.firstSide+s.numSides).map(c=>({plane:e[c.planenum],surfaceFlags:c.surfaceFlags}));return{contents:s.contents,sides:l,checkcount:0}}),i=t.leaves.map(s=>({contents:s.contents,cluster:s.cluster,area:s.area,firstLeafBrush:s.firstLeafBrush,numLeafBrushes:s.numLeafBrushes})),r=t.bmodels.map(s=>({mins:s.mins,maxs:s.maxs,origin:s.origin,headnode:s.headnode}));return{planes:e,nodes:n,leaves:i,brushes:o,leafBrushes:t.leafBrushes,bmodels:r,visibility:t.visibility}}function ct(t){let e=0;return t.x<0&&(e|=1),t.y<0&&(e|=2),t.z<0&&(e|=4),e}function se(t,e){return t.normal.x*e.x+t.normal.y*e.y+t.normal.z*e.z-t.dist}function wr(t,e,n=0){let o=se(t,e);return o>n?1:o<-n?2:3}function zr(t,e,n,o=0){let i,r;switch(n.signbits){case 0:i=n.normal.x*e.x+n.normal.y*e.y+n.normal.z*e.z,r=n.normal.x*t.x+n.normal.y*t.y+n.normal.z*t.z;break;case 1:i=n.normal.x*t.x+n.normal.y*e.y+n.normal.z*e.z,r=n.normal.x*e.x+n.normal.y*t.y+n.normal.z*t.z;break;case 2:i=n.normal.x*e.x+n.normal.y*t.y+n.normal.z*e.z,r=n.normal.x*t.x+n.normal.y*e.y+n.normal.z*t.z;break;case 3:i=n.normal.x*t.x+n.normal.y*t.y+n.normal.z*e.z,r=n.normal.x*e.x+n.normal.y*e.y+n.normal.z*t.z;break;case 4:i=n.normal.x*e.x+n.normal.y*e.y+n.normal.z*t.z,r=n.normal.x*t.x+n.normal.y*t.y+n.normal.z*e.z;break;case 5:i=n.normal.x*t.x+n.normal.y*e.y+n.normal.z*t.z,r=n.normal.x*e.x+n.normal.y*t.y+n.normal.z*e.z;break;case 6:i=n.normal.x*e.x+n.normal.y*t.y+n.normal.z*t.z,r=n.normal.x*t.x+n.normal.y*e.y+n.normal.z*e.z;break;default:i=n.normal.x*t.x+n.normal.y*t.y+n.normal.z*t.z,r=n.normal.x*e.x+n.normal.y*e.y+n.normal.z*e.z;break}let s=0;return i-n.dist>=-o&&(s=1),r-n.dist<=o&&(s|=2),s}function vn(t,e,n=q){for(let o of e.sides)if(se(o.plane,t)>n)return!1;return!0}function Nn(t,e,n,o){for(let i of o.sides){let r=i.plane.normal.x*(i.plane.normal.x<0?n.x:e.x)+i.plane.normal.y*(i.plane.normal.y<0?n.y:e.y)+i.plane.normal.z*(i.plane.normal.z<0?n.z:e.z),s=i.plane.dist-r;if(t.x*i.plane.normal.x+t.y*i.plane.normal.y+t.z*i.plane.normal.z-s>0)return{startsolid:!1,allsolid:!1,contents:0}}return{startsolid:!0,allsolid:!0,contents:o.contents}}function ut({start:t,end:e,mins:n,maxs:o,brush:i,trace:r}){if(i.sides.length===0)return;let s=n.x===0&&n.y===0&&n.z===0&&o.x===0&&o.y===0&&o.z===0,l=-1,c=1,f=null,u=null,a=!1,m=!1;for(let h of i.sides){let{plane:d}=h,S=d.dist;if(!s){let M=d.normal.x<0?o.x:n.x,v=d.normal.y<0?o.y:n.y,p=d.normal.z<0?o.z:n.z;S-=d.normal.x*M+d.normal.y*v+d.normal.z*p}let _=t.x*d.normal.x+t.y*d.normal.y+t.z*d.normal.z-S,A=e.x*d.normal.x+e.y*d.normal.y+e.z*d.normal.z-S;if(A>0&&(a=!0),_>0&&(m=!0),_>0&&A>=_)return;if(!(_<=0&&A<=0))if(_>A){let M=(_-q)/(_-A);M>l&&(l=M,f=d,u=h)}else{let M=(_+q)/(_-A);M<c&&(c=M)}}if(!m){r.startsolid=!0,a||(r.allsolid=!0),r.fraction=0;return}l<c&&l>-1&&l<r.fraction&&(l<0&&(l=0),r.fraction=l,r.plane=f,r.contents=i.contents,r.surfaceFlags=u?.surfaceFlags??0)}function Ie(){return{fraction:1,plane:null,contents:0,surfaceFlags:0,startsolid:!1,allsolid:!1}}function dt(t,e,n){let o=n;for(;o>=0;){let i=e.nodes[o];o=se(i.plane,t)>=0?i.children[0]:i.children[1]}return-1-o}function Vn(t,e,n){let o=t.leaves[e],i=o.contents,r=ft(),s=o.firstLeafBrush,l=s+o.numLeafBrushes;for(let c=s;c<l;c+=1){let f=t.leafBrushes[c],u=t.brushes[f];u.checkcount!==r&&(u.checkcount=r,u.sides.length!==0&&vn(n,u)&&(i|=u.contents))}return i}function ft(){let t=De;return De+=1,De>=Er&&(De=1),t}function Dr(t,e){return t.x===0&&t.y===0&&t.z===0&&e.x===0&&e.y===0&&e.z===0}function Ir(t,e,n){return Dr(e,n)?0:t.normal.x*(t.normal.x<0?n.x:e.x)+t.normal.y*(t.normal.y<0?n.y:e.y)+t.normal.z*(t.normal.z<0?n.z:e.z)}function Cn(t,e,n){return Math.abs(Ir(t,e,n))}function st(t,e,n){return O(t,P(te(e,t),n))}function at(t,e,n){let o=t.allsolid?0:t.fraction,i=st(e,n,o);return{fraction:o,endpos:i,plane:t.plane,planeNormal:t.startsolid?void 0:t.plane?.normal,contents:t.contents,surfaceFlags:t.surfaceFlags,startsolid:t.startsolid,allsolid:t.allsolid}}function Be(t,e,n){let o=dt(t,e,n);return e.leaves[o]?.cluster??-1}function Rn(t,e,n,o){if(!t||t.numClusters===0)return!0;if(e<0||n<0||e>=t.clusters.length||n>=t.numClusters)return!1;let i=t.clusters[e],s=(o?i.phs:i.pvs)[n>>3];return s===void 0?!1:(s&1<<(n&7))!==0}function be(t){let{model:e,nodeIndex:n,startFraction:o,endFraction:i,start:r,end:s,traceStart:l,traceEnd:c,mins:f,maxs:u,contentMask:a,trace:m,brushCheckCount:h}=t;if(m.fraction<=o)return;if(n<0){Y&&Y.leafsReached++;let z=-1-n,y=e.leaves[z],T=y.firstLeafBrush,H=T+y.numLeafBrushes;for(let D=T;D<H;D+=1){let X=e.leafBrushes[D],g=e.brushes[X];if((g.contents&a)!==0&&g.sides.length&&g.checkcount!==h&&(g.checkcount=h,Y&&Y.brushesTested++,ut({start:l,end:c,mins:f,maxs:u,brush:g,trace:m}),m.allsolid))return}return}Y&&Y.nodesTraversed++;let d=e.nodes[n],S=d.plane,_=Cn(S,f,u),A=se(S,r),M=se(S,s);if(A>=_&&M>=_){be({model:e,nodeIndex:d.children[0],startFraction:o,endFraction:i,start:r,end:s,traceStart:l,traceEnd:c,mins:f,maxs:u,contentMask:a,trace:m,brushCheckCount:h});return}if(A<-_&&M<-_){be({model:e,nodeIndex:d.children[1],startFraction:o,endFraction:i,start:r,end:s,traceStart:l,traceEnd:c,mins:f,maxs:u,contentMask:a,trace:m,brushCheckCount:h});return}let v=0,p=1/(A-M),C,N;A<M?(v=1,N=(A+_+q)*p,C=(A-_+q)*p):(v=0,N=(A-_-q)*p,C=(A+_+q)*p),C<0?C=0:C>1&&(C=1),N<0?N=0:N>1&&(N=1);let F=o+(i-o)*C,V=st(r,s,C);if(be({model:e,nodeIndex:d.children[v],startFraction:o,endFraction:F,start:r,end:V,traceStart:l,traceEnd:c,mins:f,maxs:u,contentMask:a,trace:m,brushCheckCount:h}),m.fraction<=F)return;let W=o+(i-o)*N,R=st(r,s,N);be({model:e,nodeIndex:d.children[1-v],startFraction:W,endFraction:i,start:R,end:s,traceStart:l,traceEnd:c,mins:f,maxs:u,contentMask:a,trace:m,brushCheckCount:h})}function On(t){let{model:e,start:n,end:o}=t,i=t.mins??E,r=t.maxs??E,s=t.contentMask??4294967295,l=t.headnode??0,c=Ie(),f=ft();return be({model:e,nodeIndex:l,startFraction:0,endFraction:1,start:n,end:o,traceStart:n,traceEnd:o,mins:i,maxs:r,contentMask:s,trace:c,brushCheckCount:f}),at(c,n,o)}function Br(t,e,n=0){let o=dt(t,e,n);return Vn(e,o,t)}function Ur(t,e,n=0){let o=new Map;return t.map(i=>{let r=dt(i,e,n),s=e.leaves[r];if(s.numLeafBrushes===0){let l=o.get(r);return l!==void 0?l:(o.set(r,s.contents),s.contents)}return Vn(e,r,i)})}function Gr(t,e,n,o,i=0){let r=ft(),s=0;function l(c){if(c<0){Y&&Y.leafsReached++;let h=-1-c,d=o.leaves[h];s|=d.contents;let S=d.firstLeafBrush,_=S+d.numLeafBrushes;for(let A=S;A<_;A+=1){let M=o.leafBrushes[A],v=o.brushes[M];if(v.checkcount===r||(v.checkcount=r,v.sides.length===0))continue;let p=Nn(t,e,n,v);p.startsolid&&(s|=p.contents)}return}let f=o.nodes[c],u=f.plane,a=Cn(u,e,n),m=se(u,t);if(a===0){l(m>=0?f.children[0]:f.children[1]);return}if(m>a){l(f.children[0]);return}if(m<-a){l(f.children[1]);return}l(f.children[0]),l(f.children[1])}return l(i),s}function kr(t,e,n,o=0){let{visibility:i}=n;if(!i)return!0;let r=Be(t,n,o),s=Be(e,n,o);return Rn(i,r,s,!1)}function Wr(t,e,n,o=0){let{visibility:i}=n;if(!i)return!0;let r=Be(t,n,o),s=Be(e,n,o);return Rn(i,r,s,!0)}function de(t,e,n){return{normal:t,dist:e,type:n,signbits:ct(t)}}function Hr(t){let e=t.surfaceFlags??0,n=t.origin.x+t.maxs.x,o=t.origin.x+t.mins.x,i=t.origin.y+t.maxs.y,r=t.origin.y+t.mins.y,s=t.origin.z+t.maxs.z,l=t.origin.z+t.mins.z,f=[de({x:1,y:0,z:0},n,0),de({x:-1,y:0,z:0},-o,0),de({x:0,y:1,z:0},i,1),de({x:0,y:-1,z:0},-r,1),de({x:0,y:0,z:1},s,2),de({x:0,y:0,z:-1},-l,2)].map(u=>({plane:u,surfaceFlags:e}));return{contents:t.contents,sides:f,checkcount:0}}function Kr(t){let e=Hr(t);return{...t,brush:e,bounds:{mins:{x:t.origin.x+t.mins.x,y:t.origin.y+t.mins.y,z:t.origin.z+t.mins.z},maxs:{x:t.origin.x+t.maxs.x,y:t.origin.y+t.maxs.y,z:t.origin.z+t.maxs.z}}}}function Xr(t,e){return!(t.mins.x>e.maxs.x||t.maxs.x<e.mins.x||t.mins.y>e.maxs.y||t.maxs.y<e.mins.y||t.mins.z>e.maxs.z||t.maxs.z<e.mins.z)}function Zr(t,e){return e.allsolid&&!t.allsolid||e.startsolid&&!t.startsolid?!0:e.fraction<t.fraction}var lt=class{constructor(){this.entities=new Map;this.entityNodes=new Map;this.rootNode=ze()}link(e){let n=Kr(e);this.entities.set(e.id,n);let o=this.entityNodes.get(e.id);o&&o.items.delete(e.id);let i=An(this.rootNode,e.id,n.bounds.mins,n.bounds.maxs);this.entityNodes.set(e.id,i)}unlink(e){this.entities.delete(e);let n=this.entityNodes.get(e);n&&(n.items.delete(e),this.entityNodes.delete(e))}trace(e){let{passId:n}=e,o=e.mins??E,i=e.maxs??E,r=e.contentMask??4294967295,s,l=null;e.model?s=On(e):s=at(Ie(),e.start,e.end);let c={x:Math.min(e.start.x,e.end.x)+o.x,y:Math.min(e.start.y,e.end.y)+o.y,z:Math.min(e.start.z,e.end.z)+o.z},f={x:Math.max(e.start.x,e.end.x)+i.x,y:Math.max(e.start.y,e.end.y)+i.y,z:Math.max(e.start.z,e.end.z)+i.z},u=new Set;ye(this.rootNode,c,f,u);for(let a of u){if(a===n)continue;let m=this.entities.get(a);if(!m||(m.contents&r)===0)continue;let h=Ie();if(ut({start:e.start,end:e.end,mins:o,maxs:i,brush:m.brush,trace:h}),h.contents===0&&(h.contents=m.contents),h.startsolid||h.allsolid||h.fraction<s.fraction){let d=at(h,e.start,e.end);Zr(s,d)&&(s=d,l=m.id)}}return{...s,entityId:l}}gatherTriggerTouches(e,n,o,i=1073741824){let r=[],s={mins:O(e,n),maxs:O(e,o)},l=new Set;ye(this.rootNode,s.mins,s.maxs,l);for(let c of l){let f=this.entities.get(c);f&&(f.contents&i)!==0&&Xr(s,f.bounds)&&r.push(f.id)}return r}};var Pn=(s=>(s[s.None=0]="None",s[s.Archive=1]="Archive",s[s.UserInfo=2]="UserInfo",s[s.ServerInfo=4]="ServerInfo",s[s.Latch=8]="Latch",s[s.Cheat=16]="Cheat",s))(Pn||{});var ec=1024,tc=80,nc=512,oc=64,rc=128,Yr=256,ic=8192,Jr=256,jr=8192,qr=2048,$r=512,Qr=256,ei=512,ti=256,mt=32,sc=96,ac=64,K=(y=>(y[y.Name=0]="Name",y[y.CdTrack=1]="CdTrack",y[y.Sky=2]="Sky",y[y.SkyAxis=3]="SkyAxis",y[y.SkyRotate=4]="SkyRotate",y[y.StatusBar=5]="StatusBar",y[y.HealthBarName=55]="HealthBarName",y[y.CONFIG_N64_PHYSICS=56]="CONFIG_N64_PHYSICS",y[y.CONFIG_CTF_TEAMS=57]="CONFIG_CTF_TEAMS",y[y.CONFIG_COOP_RESPAWN_STRING=58]="CONFIG_COOP_RESPAWN_STRING",y[y.Story=54]="Story",y[y.AirAccel=59]="AirAccel",y[y.MaxClients=60]="MaxClients",y[y.MapChecksum=61]="MapChecksum",y[y.Models=62]="Models",y[y.Sounds=62+jr]="Sounds",y[y.Images=y.Sounds+qr]="Images",y[y.Lights=y.Images+$r]="Lights",y[y.ShadowLights=y.Lights+Jr]="ShadowLights",y[y.Items=y.ShadowLights+ti]="Items",y[y.Players=y.Items+Qr]="Players",y[y.PlayerSkins=y.Players]="PlayerSkins",y[y.General=y.Players+Yr]="General",y[y.WheelWeapons=y.General+ei]="WheelWeapons",y[y.WheelAmmo=y.WheelWeapons+mt]="WheelAmmo",y[y.WheelPowerups=y.WheelAmmo+mt]="WheelPowerups",y[y.CdLoopCount=y.WheelPowerups+mt]="CdLoopCount",y[y.GameStyle=y.CdLoopCount+1]="GameStyle",y[y.MaxConfigStrings=y.GameStyle+1]="MaxConfigStrings",y))(K||{}),ni=K.MaxConfigStrings;function oi(t){return t>=5&&t<59?96*(59-t):t>=K.General&&t<K.WheelWeapons?96*(K.MaxConfigStrings-t):96}var ri=0,ii=1,si=2,ai=3,li=4,ci=5,ui=59,di=60,fi=61,mi=62,xi=K.Sounds,pi=K.Images,hi=K.Lights,yi=K.Items,bi=K.Players,gi=K.General;var xt={};yn(xt,{addReplayFrame:()=>Ai,createReplaySession:()=>Ti,deserializeReplay:()=>_i,serializeReplay:()=>Si});function Si(t){return JSON.stringify(t,null,2)}function _i(t){let e=JSON.parse(t);if(!e.metadata||!Array.isArray(e.frames))throw new Error("Invalid replay format: missing metadata or frames");return e}function Ti(t,e){return{metadata:{map:t,date:new Date().toISOString(),version:"1.0",seed:e},frames:[]}}function Ai(t,e,n,o){t.frames.push({serverFrame:n,cmd:e,timestamp:Date.now()-o})}function Mi(t){return t??{}}function Fn(t,e,n={}){let o=Mi(t),i=[],r=[];for(let l of e){if(!(l in o)){i.push(l);continue}typeof o[l]!="function"&&r.push(l)}let s=n.allowExtra===!1?Object.keys(o).filter(l=>!e.includes(l)):[];return{missing:i,nonFunctions:r,extras:s}}function vi(t,e,n={}){let{missing:o,nonFunctions:i,extras:r}=Fn(t,e,n);if(o.length===0&&i.length===0&&r.length===0)return;let s=[];o.length>0&&s.push(`missing: ${o.join(", ")}`),i.length>0&&s.push(`non-functions: ${i.join(", ")}`),r.length>0&&s.push(`extras: ${r.join(", ")}`);let l=n.name??"contract";throw new Error(`${l} validation failed (${s.join("; ")})`)}var Ni=["Broadcast_Print","Com_Print","Client_Print","Center_Print","sound","positioned_sound","local_sound","configstring","get_configstring","Com_Error","modelindex","soundindex","imageindex","setmodel","trace","clip","pointcontents","inPVS","inPHS","SetAreaPortalState","AreasConnected","linkentity","unlinkentity","BoxEdicts","multicast","unicast"],Vi=["PreInit","Init","Shutdown","SpawnEntities","WriteGameJson","ReadGameJson","WriteLevelJson","ReadLevelJson","CanSave","ClientConnect","ClientThink","RunFrame","Pmove"],Ci=["Com_Print","get_configstring","Com_Error","TagMalloc","TagFree","AddCommandString","CL_FrameValid","CL_FrameTime","CL_ClientTime","CL_ServerFrame","Draw_RegisterPic","Draw_GetPicSize","SCR_DrawChar","SCR_DrawPic","SCR_DrawColorPic"],Ri=["Init","Shutdown","DrawHUD","TouchPics","LayoutFlags","GetActiveWeaponWheelWeapon","GetOwnedWeaponWheelWeapons","GetWeaponWheelAmmoCount","GetPowerupWheelCount","GetHitMarkerDamage","Pmove","ParseConfigString","ParseCenterPrint","ClearNotify","ClearCenterprint","NotifyMessage","GetMonsterFlashOffset"];var fe=(i=>(i[i.None=0]="None",i[i.Feet=1]="Feet",i[i.Waist=2]="Waist",i[i.Under=3]="Under",i))(fe||{});function pt(t){return t>=2}function Oi(t){return t===3}var $=(a=>(a[a.Ducked=1]="Ducked",a[a.JumpHeld=2]="JumpHeld",a[a.OnGround=4]="OnGround",a[a.TimeWaterJump=8]="TimeWaterJump",a[a.TimeLand=16]="TimeLand",a[a.TimeTeleport=32]="TimeTeleport",a[a.NoPositionalPrediction=64]="NoPositionalPrediction",a[a.OnLadder=128]="OnLadder",a[a.NoAngularPrediction=256]="NoAngularPrediction",a[a.IgnorePlayerCollision=512]="IgnorePlayerCollision",a[a.TimeTrick=1024]="TimeTrick",a))($||{});function I(t,e){return(t&e)!==0}function G(t,e){return t|e}function Z(t,e){return t&~e}var ae=(l=>(l[l.Normal=0]="Normal",l[l.Grapple=1]="Grapple",l[l.NoClip=2]="NoClip",l[l.Spectator=3]="Spectator",l[l.Dead=4]="Dead",l[l.Gib=5]="Gib",l[l.Freeze=6]="Freeze",l))(ae||{}),le=(c=>(c[c.None=0]="None",c[c.Attack=1]="Attack",c[c.Use=2]="Use",c[c.Holster=4]="Holster",c[c.Jump=8]="Jump",c[c.Crouch=16]="Crouch",c[c.Attack2=32]="Attack2",c[c.Any=128]="Any",c))(le||{});var Pi=270;function Fi(t,e){return(t&e)!==0}function ht(t){let{pmFlags:e,pmType:n,buttons:o,waterlevel:i,onGround:r,velocity:s,origin:l,jumpHeight:c=Pi}=t;if(e&16)return{pmFlags:e,onGround:r,velocity:s,origin:l,jumpSound:!1,jumped:!1};let f=Fi(o,8),u=e,a=r,m=!1,h=!1,d=s,S=l;if(!f)return u=Z(u,2),{pmFlags:u,onGround:a,velocity:d,origin:S,jumpSound:m,jumped:h};if(Ei(u))return{pmFlags:u,onGround:a,velocity:d,origin:S,jumpSound:m,jumped:h};if(n===4)return{pmFlags:u,onGround:a,velocity:d,origin:S,jumpSound:m,jumped:h};if(i>=2)return a=!1,{pmFlags:u,onGround:a,velocity:d,origin:S,jumpSound:m,jumped:h};if(!a)return{pmFlags:u,onGround:a,velocity:d,origin:S,jumpSound:m,jumped:h};u=G(u,2),u=Z(u,4),a=!1,m=!0,h=!0;let _=s.z+c,A=_<c?c:_;return d={...s,z:A},S={...l,z:l.z+1},{pmFlags:u,onGround:a,velocity:d,origin:S,jumpSound:m,jumped:h}}function Ei(t){return(t&2)!==0}var Li=100,yt=200,En=150,Ue=25,wi=15,zi=1,Di={x:0,y:0,z:1},Ii=(t,e)=>({fraction:1,endpos:e,allsolid:!1,startsolid:!1});function bt(t){let e=0,n=0,o=0;return t&262144&&(e+=1),t&524288&&(n+=1),t&1048576&&(e-=1),t&2097152&&(n-=1),t&4194304&&(o+=1),t&8388608&&(o-=1),e===0&&n===0&&o===0?E:{x:e,y:n,z:o}}function zn(t){let{watertype:e,waterlevel:n,onGround:o,waterSpeed:i}=t;if((e&16515072)===0)return E;let r=bt(e);if(r===E)return E;let s=i;return n===1&&o&&(s*=.5),P(r,s)}function Dn(t){let{groundContents:e,scale:n=Li}=t,o=bt(e);return o===E?E:P(o,n)}function ge(t){let{wishVelocity:e,onLadder:n,onGround:o,waterlevel:i,watertype:r,groundContents:s,cmd:l,viewPitch:c,maxSpeed:f,ladderMod:u,waterSpeed:a,forward:m,origin:h,mins:d,maxs:S,trace:_=Ii}=t,A=e;n&&(A=Bi({wishVelocity:A,cmd:l,waterlevel:i,viewPitch:c,maxSpeed:f,ladderMod:u,onGround:o,forward:m,origin:h,mins:d,maxs:S,trace:_}));let M=zn({watertype:r,waterlevel:i,onGround:o,waterSpeed:a});if(M!==E&&(A=O(A,M)),o){let v=Dn({groundContents:s});v!==E&&(A=O(A,v))}return A}function Bi(t){let{wishVelocity:e,cmd:n,waterlevel:o,viewPitch:i,maxSpeed:r,ladderMod:s,onGround:l,forward:c,origin:f,mins:u,maxs:a,trace:m}=t,h=n.buttons??0,d={...e};if((h&24)!==0){let S=pt(o)?r:yt;d={...d,z:h&8?S:-S}}else if(n.forwardmove){let S=Ln(n.forwardmove,-yt,yt);if(n.forwardmove>0){let _=i<wi?S:-S;d={...d,z:_}}else l||(d={...d,x:0,y:0}),d={...d,z:S}}else d={...d,z:0};if(!l)if(n.sidemove){let S=Ln(n.sidemove,-En,En);o<2&&(S*=s);let _=L({x:c.x,y:c.y,z:0});if(_.x!==0||_.y!==0){let A=O(f,P(_,zi)),M=m(f,A,u,a);if(M.fraction!==1&&!M.allsolid&&M.contents!==void 0&&(M.contents&536870912)!==0&&M.planeNormal){let v=ne(M.planeNormal,Di);d={...d,x:0,y:0},d=O(d,P(v,-S))}}}else d={...d,x:wn(d.x),y:wn(d.y)};return d}function Ln(t,e,n){return Math.max(e,Math.min(n,t))}function wn(t){return t<-Ue?-Ue:t>Ue?Ue:t}var In=5,Ui=4,Gi=18,ki=.7,Bn=1,Un=2;function Gn(t,e,n,o=In,i=t){if(e.length===0)return{velocity:t,planes:[],stopped:!1};let r=[],s=t;for(let c of e){if(r.length>=o)return{velocity:E,planes:r,stopped:!0};if(r.find(m=>B(m,c)>.99))continue;r.push(c);let u,a=0;for(;a<r.length;a++){let m=oe(s,r[a],n),h=0;for(;h<r.length&&!(h!==a&&B(m,r[h])<0);h++);if(h===r.length){u=m;break}}if(u)s=u;else{if(r.length!==2)return{velocity:E,planes:r,stopped:!0};let m=ne(r[0],r[1]),h=B(m,s);s=P(m,h)}if(B(s,i)<=0)return{velocity:E,planes:r,stopped:!0}}let l=s.x===0&&s.y===0&&s.z===0;return{velocity:s,planes:r,stopped:l}}function gt(t){let{origin:e,velocity:n,frametime:o,overbounce:i,trace:r,maxBumps:s=Ui,maxClipPlanes:l=In,mins:c,maxs:f,hasTime:u=!1}=t,a=e,m=n,h=[],d=n,S=o,_=0;for(let M=0;M<s&&!(m.x===0&&m.y===0&&m.z===0);M++){let v=O(a,P(m,S)),p=r(a,v,c,f);if(p.allsolid){let N=u?d:E;return{origin:p.endpos,velocity:N,planes:h,stopped:!0,blocked:_}}if(p.startsolid){let N=u?d:E;return{origin:p.endpos,velocity:N,planes:h,stopped:!0,blocked:_}}if(p.fraction>0&&(a=p.endpos),p.fraction===1)break;if(!p.planeNormal)return{origin:a,velocity:u?d:E,planes:h,stopped:!0,blocked:_};p.planeNormal.z>.7&&(_|=Bn),p.planeNormal.z===0&&(_|=Un),h.push(p.planeNormal),S-=S*p.fraction;let C=Gn(m,h,i,l,d);if(m=C.velocity,h.splice(0,h.length,...C.planes),d.z>0&&m.z<0&&(m={...m,z:0}),C.stopped)return{origin:a,velocity:u?d:m,planes:h,stopped:!0,blocked:_}}let A=u?d:m;return{origin:a,velocity:A,planes:h,stopped:A.x===0&&A.y===0&&A.z===0,blocked:_}}function ce(t){let{mins:e,maxs:n,stepSize:o=Gi,...i}=t,r=t.origin,s=t.velocity,l=gt({...i,mins:e,maxs:n}),c=O(r,{x:0,y:0,z:o}),f=i.trace(r,c,e,n);if(f.allsolid)return{...l,stepped:!1,stepHeight:0};let u=f.endpos.z-r.z,a=gt({...i,origin:f.endpos,velocity:s,mins:e,maxs:n}),m=O(a.origin,{x:0,y:0,z:-u}),h=i.trace(a.origin,m,e,n),d=a.origin,S=h.planeNormal;h.allsolid||(d=h.endpos);let _=(N,F)=>(N.x-F.x)**2+(N.y-F.y)**2,A=_(l.origin,r),M=_(d,r);if(A>M||S&&S.z<ki)return{...l,stepped:!1,stepHeight:0};let v={...a.velocity,z:l.velocity.z},p=a.blocked,C=v.x===0&&v.y===0&&v.z===0;return{origin:d,velocity:v,planes:a.planes,blocked:p,stopped:C,stepped:!0,stepHeight:u,stepNormal:S}}var kn=1,Wi=60,Ge=1.01;function St(t){let{origin:e,frametime:n,mins:o,maxs:i,trace:r,overbounce:s=Ge,stepSize:l,maxBumps:c,maxClipPlanes:f,hasTime:u,forward:a,right:m,cmd:h,pmFlags:d,onGround:S,gravity:_,pmType:A,pmAccelerate:M,pmAirAccelerate:v=kn,pmMaxSpeed:p,pmDuckSpeed:C,onLadder:N,waterlevel:F,watertype:V,groundContents:k,viewPitch:W,ladderMod:R,pmWaterSpeed:z}=t,y={...t.velocity},T=Hn(a,m,h);T=ge({wishVelocity:T,onLadder:N,onGround:S,waterlevel:F,watertype:V,groundContents:k,cmd:h,viewPitch:W,maxSpeed:I(d,1)?C:p,ladderMod:R,waterSpeed:z,forward:a,origin:e,mins:o,maxs:i,trace:r});let D=I(d,1)?C:p,X=T,g=U(X);if(g!==0&&(X=L(X)),g>D){let Q=D/g;T=P(T,Q),g=D,g!==0&&(X=L(T))}return N?(y=J({velocity:y,wishdir:X,wishspeed:g,accel:M,frametime:n}),Math.abs(T.z)<Number.EPSILON&&(y=Xi(y,_,n)),Se({origin:e,velocity:y,frametime:n,mins:o,maxs:i,trace:r,overbounce:s,stepSize:l,maxBumps:c,maxClipPlanes:f,hasTime:u})):S?(y={...y,z:0},y=J({velocity:y,wishdir:X,wishspeed:g,accel:M,frametime:n}),_>0?y={...y,z:0}:y={...y,z:y.z-_*n},y.x===0&&y.y===0?{origin:e,velocity:y,planes:[],blocked:0,stopped:!0,stepped:!1,stepHeight:0}:Se({origin:e,velocity:y,frametime:n,mins:o,maxs:i,trace:r,overbounce:s,stepSize:l,maxBumps:c,maxClipPlanes:f,hasTime:u})):(v>0?y=At({velocity:y,wishdir:X,wishspeed:g,accel:v,frametime:n}):y=J({velocity:y,wishdir:X,wishspeed:g,accel:kn,frametime:n}),A!==1&&(y={...y,z:y.z-_*n}),Se({origin:e,velocity:y,frametime:n,mins:o,maxs:i,trace:r,overbounce:s,stepSize:l,maxBumps:c,maxClipPlanes:f,hasTime:u}))}function _t(t){let{origin:e,frametime:n,mins:o,maxs:i,trace:r,overbounce:s=Ge,stepSize:l,maxBumps:c,maxClipPlanes:f,hasTime:u,forward:a,right:m,cmd:h,pmFlags:d,onGround:S,pmMaxSpeed:_,pmDuckSpeed:A,pmWaterAccelerate:M,pmWaterSpeed:v,onLadder:p,watertype:C,groundContents:N,waterlevel:F,viewPitch:V,ladderMod:k}=t,W={...t.velocity},R=Hi(a,m,h);Ki(h,S)?R={...R,z:R.z-Wi}:Wn(h,16)?R=O(R,{x:0,y:0,z:-v*.5}):Wn(h,8)&&(R=O(R,{x:0,y:0,z:v*.5})),R=ge({wishVelocity:R,onLadder:p,onGround:S,waterlevel:F,watertype:C,groundContents:N,cmd:h,viewPitch:V,maxSpeed:I(d,1)?A:_,ladderMod:k,waterSpeed:v,forward:a,origin:e,mins:o,maxs:i,trace:r});let z=R,y=U(z);if(y!==0&&(z=L(z)),y>_){let H=_/y;R=P(R,H),y=_,y!==0&&(z=L(R))}if(y*=.5,I(d,1)&&y>A){let H=A/y;R=P(R,H),y=A,y!==0&&(z=L(R))}return W=J({velocity:W,wishdir:z,wishspeed:y,accel:M,frametime:n}),Se({origin:e,velocity:W,frametime:n,mins:o,maxs:i,trace:r,overbounce:s,stepSize:l,maxBumps:c,maxClipPlanes:f,hasTime:u})}function Tt(t){let{origin:e,frametime:n,mins:o,maxs:i,trace:r,overbounce:s=Ge,stepSize:l,maxBumps:c,maxClipPlanes:f,hasTime:u,forward:a,right:m,cmd:h,pmFlags:d,onGround:S,gravity:_,pmAccelerate:A,pmMaxSpeed:M,pmDuckSpeed:v,onLadder:p,waterlevel:C,watertype:N,groundContents:F,viewPitch:V,ladderMod:k,pmWaterSpeed:W}=t,R={...t.velocity},z=Hn(a,m,h);z=ge({wishVelocity:z,onLadder:p,onGround:S,waterlevel:C,watertype:N,groundContents:F,cmd:h,viewPitch:V,maxSpeed:I(d,1)?v:M,ladderMod:k,waterSpeed:W,forward:a,origin:e,mins:o,maxs:i,trace:r});let T=I(d,1)?v:M,H=z,D=U(H);if(D!==0&&(H=L(H)),D>T){let X=T/D;z=P(z,X),D=T,D!==0&&(H=L(z))}return R={...R,z:0},R=J({velocity:R,wishdir:H,wishspeed:D,accel:A,frametime:n}),_>0?R={...R,z:0}:R={...R,z:R.z-_*n},R.x===0&&R.y===0?{origin:e,velocity:R,planes:[],blocked:0,stopped:!0,stepped:!1,stepHeight:0}:Se({origin:e,velocity:R,frametime:n,mins:o,maxs:i,trace:r,overbounce:s,stepSize:l,maxBumps:c,maxClipPlanes:f,hasTime:u})}function Hn(t,e,n){return{x:t.x*n.forwardmove+e.x*n.sidemove,y:t.y*n.forwardmove+e.y*n.sidemove,z:0}}function Hi(t,e,n){return{x:t.x*n.forwardmove+e.x*n.sidemove,y:t.y*n.forwardmove+e.y*n.sidemove,z:t.z*n.forwardmove+e.z*n.sidemove}}function Wn(t,e){return!!((t.buttons??0)&e)}function Ki(t,e){let n=t.forwardmove===0&&t.sidemove===0,o=!((t.buttons??0)&24);return n&&o&&!e}function Xi(t,e,n){let o=t.z,i=e*n;return o>0?(o-=i,o<0&&(o=0)):(o+=i,o>0&&(o=0)),{...t,z:o}}function Se(t){let{origin:e,velocity:n,frametime:o,mins:i,maxs:r,trace:s,overbounce:l=Ge,stepSize:c,maxBumps:f,maxClipPlanes:u,hasTime:a}=t;return ce({origin:e,velocity:n,frametime:o,trace:s,mins:i,maxs:r,overbounce:l,stepSize:c,maxBumps:f,maxClipPlanes:u,hasTime:a})}function _e(t){let{origin:e,mins:n,viewheight:o,pointContents:i}=t,r=o-n.z,s=r/2,l={x:e.x,y:e.y,z:e.z+n.z+1},c=i(l);if((c&56)===0)return{waterlevel:0,watertype:0};let f=c,u=1,a={x:l.x,y:l.y,z:e.z+n.z+s};if(c=i(a),(c&56)!==0){u=2;let m={x:l.x,y:l.y,z:e.z+n.z+r};c=i(m),(c&56)!==0&&(u=3)}return{waterlevel:u,watertype:f}}var Zi=.25,Yi=180,Ji=100,ji=.7,qi=.9,$i=64,Qi=128,es=1.01,ts=1080;function ke(t){let{pmType:e,n64Physics:n,velocity:o,startVelocity:i,origin:r,mins:s,maxs:l,viewheight:c,trace:f,pointContents:u}=t,a=t.pmFlags,m=t.pmTime,h,d=I(a,4),S,_=0;if(o.z>Yi||e===1)a=Z(a,4),d=!1;else{let p={x:r.x,y:r.y,z:r.z-Zi},C=f(r,p,s,l);S=C,_=C.contents??0;let N=C.planeNormal,F=C.fraction<1&&!!N&&N.z<ji;if(F&&N){let V=O(r,N),k=f(r,V,s,l);k.fraction<1&&!k.startsolid&&(F=!1)}if(C.fraction===1||!N||F&&!C.startsolid)a=Z(a,4),d=!1;else{d=!0,I(a,8)&&(a&=~ts,m=0);let V=I(a,4);if(!V){!n&&o.z>=Ji&&N.z>=qi&&!I(a,1)&&(a=G(a,1024),m=$i);let k=oe(o,N,es);h=i.z-k.z}a=G(a,4),!V&&(n||I(a,1))&&(a=G(a,16),m=Qi)}}let{waterlevel:M,watertype:v}=_e({origin:r,mins:s,viewheight:c,pointContents:u});return{pmFlags:a,pmTime:m,onGround:I(a,4),groundTrace:S,groundContents:_,waterlevel:M,watertype:v,impactDelta:h}}function We(t,e,n){return{x:t,y:e,z:n}}function He(t,e){let n=We(-16,-16,0),o=We(16,16,16);if(t===5)return{mins:n,maxs:o,viewheight:8};let i=t===4||(e&1)!==0,r=We(n.x,n.y,-24),s=We(o.x,o.y,i?4:32);return{mins:r,maxs:s,viewheight:i?-2:22}}var ns=4,os=32,rs=8;function Mt(t){let{pmType:e}=t;if(e===5){let s=He(e,t.pmFlags);return{pmFlags:t.pmFlags,ducked:I(t.pmFlags,1),changed:!1,...s}}let n=t.pmFlags,o=!1;e===4?I(n,1)||(n=G(n,1),o=!0):is(t)?!I(n,1)&&!ss(t)&&(n=G(n,1),o=!0):I(n,1)&&!as(t)&&(n=Z(n,1),o=!0);let i=He(e,n),r=e===4||I(n,1);return{pmFlags:n,ducked:r,changed:o,...i}}function is(t){return(t.buttons&16)===0||t.onLadder||t.n64Physics?!1:!!(t.hasGroundEntity||t.waterlevel<=1&&!ls(t))}function ss(t){return t.trace({start:t.origin,end:t.origin,mins:t.mins,maxs:Kn(t.maxs,ns),mask:3}).allsolid}function as(t){return t.trace({start:t.origin,end:t.origin,mins:t.mins,maxs:Kn(t.maxs,os),mask:3}).allsolid}function ls(t){let e={x:t.origin.x,y:t.origin.y,z:t.origin.z-rs};return t.trace({start:t.origin,end:e,mins:t.mins,maxs:t.maxs,mask:3}).fraction<1?!1:t.trace({start:t.origin,end:e,mins:t.mins,maxs:t.maxs,mask:56}).fraction<1}function Kn(t,e){return{x:t.x,y:t.y,z:e}}var Te=.025;function Ke(t){let{velocity:e,frametime:n,onGround:o,groundIsSlick:i,onLadder:r,waterlevel:s,pmFriction:l,pmStopSpeed:c,pmWaterFriction:f}=t,u=U(e);if(u<1)return{x:0,y:0,z:e.z};let a=0;if(o&&!i||r){let d=u<c?c:u;a+=d*l*n}s>0&&!r&&(a+=u*f*s*n);let m=u-a;if(m<0&&(m=0),m===u)return e;let h=m/u;return P(e,h)}function J(t){let{velocity:e,wishdir:n,wishspeed:o,accel:i,frametime:r}=t,s=B(e,n),l=o-s;if(l<=0)return e;let c=i*r*o;return c>l&&(c=l),{x:e.x+n.x*c,y:e.y+n.y*c,z:e.z+n.z*c}}function At(t){let{velocity:e,wishdir:n,wishspeed:o,accel:i,frametime:r}=t,s=Math.min(o,30),l=B(e,n),c=s-l;if(c<=0)return e;let f=i*o*r;return f>c&&(f=c),{x:e.x+n.x*f,y:e.y+n.y*f,z:e.z+n.z*f}}function cs(t,e){let n=Math.abs(t.forwardmove),o=Math.abs(t.sidemove),i=Math.abs(t.upmove),r=Math.max(n,o,i);if(r===0)return 0;let s=Math.sqrt(t.forwardmove*t.forwardmove+t.sidemove*t.sidemove+t.upmove*t.upmove);return e*r/(127*s)}function vt(t){let{forward:e,right:n,cmd:o,maxSpeed:i}=t,r={x:e.x*o.forwardmove+n.x*o.sidemove,y:e.y*o.forwardmove+n.y*o.sidemove,z:0},s=U(r);if(s>i){let l=i/s;r=P(r,l),s=i}return{wishdir:s===0?r:L(r),wishspeed:s}}function Nt(t){let{forward:e,right:n,cmd:o,maxSpeed:i}=t,r={x:e.x*o.forwardmove+n.x*o.sidemove,y:e.y*o.forwardmove+n.y*o.sidemove,z:e.z*o.forwardmove+n.z*o.sidemove};o.upmove>10?r=O(r,{x:0,y:0,z:o.upmove}):o.upmove<-10?r=O(r,{x:0,y:0,z:o.upmove}):Math.abs(o.forwardmove)<10&&Math.abs(o.sidemove)<10?r=O(r,{x:0,y:0,z:-60}):r=O(r,{x:0,y:0,z:10});let s=U(r);if(s>i){let l=i/s;r=P(r,l),s=i}return s*=.5,{wishdir:s===0?r:L(r),wishspeed:s}}function us(t,e){if(t.pmType===4)return t;let n={...t},o=ke({pmType:n.pmType,pmFlags:n.pmFlags,pmTime:0,n64Physics:!1,velocity:n.velocity,startVelocity:n.velocity,origin:n.origin,mins:n.mins,maxs:n.maxs,viewheight:n.viewHeight,trace:e.trace,pointContents:e.pointcontents});n.pmFlags=o.pmFlags,n.waterlevel=o.waterlevel,n.watertype=o.watertype;let i=Mt({pmType:n.pmType,pmFlags:n.pmFlags,buttons:n.cmd.buttons,waterlevel:n.waterlevel,hasGroundEntity:(n.pmFlags&4)!==0,onLadder:!1,n64Physics:!1,origin:n.origin,mins:n.mins,maxs:n.maxs,trace:a=>e.trace(a.start,a.end,a.mins,a.maxs)});n.pmFlags=i.pmFlags,n.mins=i.mins,n.maxs=i.maxs,n.viewHeight=i.viewheight;let r=ht({pmFlags:n.pmFlags,pmType:n.pmType,buttons:n.cmd.buttons,waterlevel:n.waterlevel,onGround:(n.pmFlags&4)!==0,velocity:n.velocity,origin:n.origin});n.pmFlags=r.pmFlags,n.velocity=r.velocity,n.origin=r.origin,r.onGround!==((n.pmFlags&4)!==0)&&(r.onGround?n.pmFlags=G(n.pmFlags,4):n.pmFlags=Z(n.pmFlags,4));let s=(n.pmFlags&4)!==0,l=n.velocity;n.velocity=Ke({velocity:n.velocity,frametime:Te,onGround:s,groundIsSlick:!1,onLadder:!1,waterlevel:n.waterlevel,pmFriction:6,pmStopSpeed:100,pmWaterFriction:1});let{forward:c,right:f}=re(n.viewAngles);if(n.pmType===2){let a={x:c.x*n.cmd.forwardmove+f.x*n.cmd.sidemove,y:c.y*n.cmd.forwardmove+f.y*n.cmd.sidemove,z:n.cmd.upmove},m=Te;n.velocity=a,n.origin={x:n.origin.x+a.x*m,y:n.origin.y+a.y*m,z:n.origin.z+a.z*m}}else if(n.waterlevel>=2){let a=_t({origin:n.origin,velocity:n.velocity,frametime:Te,mins:n.mins,maxs:n.maxs,trace:e.trace,cmd:n.cmd,forward:c,right:f,pmFlags:n.pmFlags,onGround:s,pmMaxSpeed:300,pmDuckSpeed:100,pmWaterAccelerate:4,pmWaterSpeed:400,onLadder:!1,watertype:n.watertype,groundContents:0,waterlevel:n.waterlevel,viewPitch:n.viewAngles.x,ladderMod:1,stepSize:18});n.origin=a.origin,n.velocity=a.velocity}else if((n.pmFlags&4)===0){let a=St({origin:n.origin,velocity:n.velocity,frametime:Te,mins:n.mins,maxs:n.maxs,trace:e.trace,cmd:n.cmd,forward:c,right:f,pmFlags:n.pmFlags,onGround:s,gravity:n.gravity,pmType:n.pmType,pmAccelerate:10,pmAirAccelerate:1,pmMaxSpeed:300,pmDuckSpeed:100,onLadder:!1,waterlevel:n.waterlevel,watertype:n.watertype,groundContents:0,viewPitch:n.viewAngles.x,ladderMod:1,pmWaterSpeed:400,stepSize:18});n.origin=a.origin,n.velocity=a.velocity}else{let a=Tt({origin:n.origin,velocity:n.velocity,frametime:Te,mins:n.mins,maxs:n.maxs,trace:e.trace,cmd:n.cmd,forward:c,right:f,pmFlags:n.pmFlags,onGround:s,gravity:n.gravity,pmType:n.pmType,pmAccelerate:10,pmMaxSpeed:300,pmDuckSpeed:100,onLadder:!1,waterlevel:n.waterlevel,watertype:n.watertype,groundContents:0,viewPitch:n.viewAngles.x,ladderMod:1,pmWaterSpeed:400,stepSize:18});n.origin=a.origin,n.velocity=a.velocity}let u=ke({pmType:n.pmType,pmFlags:n.pmFlags,pmTime:0,n64Physics:!1,velocity:n.velocity,startVelocity:n.velocity,origin:n.origin,mins:n.mins,maxs:n.maxs,viewheight:n.viewHeight,trace:e.trace,pointContents:e.pointcontents});return n.pmFlags=u.pmFlags,n.waterlevel=u.waterlevel,n.watertype=u.watertype,n}var me=["x","y","z"],Vt=[{normal:[0,0,1],mins:[-1,-1,0],maxs:[1,1,0]},{normal:[0,0,-1],mins:[-1,-1,0],maxs:[1,1,0]},{normal:[1,0,0],mins:[0,-1,-1],maxs:[0,1,1]},{normal:[-1,0,0],mins:[0,-1,-1],maxs:[0,1,1]},{normal:[0,1,0],mins:[-1,0,-1],maxs:[1,0,1]},{normal:[0,-1,0],mins:[-1,0,-1],maxs:[1,0,1]}],Xn={x:0,y:0,z:0};function xe(t){return{x:t.x,y:t.y,z:t.z}}function ds(t){return{x:t[0],y:t[1],z:t[2]}}function Ae(t,e,n){if(n!==0)switch(e){case"x":t.x+=n;break;case"y":t.y+=n;break;case"z":t.z+=n;break}}function Zn(t,e,n){switch(e){case"x":t.x=n;break;case"y":t.y=n;break;case"z":t.z=n;break}}function Xe(t,e){switch(e){case"x":return t.x;case"y":return t.y;case"z":default:return t.z}}function Yn(t,e,n,o){return t===-1?Xe(n,e):t===1?Xe(o,e):0}function Jn(t,e,n,o){let i=xe(t);for(let r=0;r<me.length;r++){let s=me[r],l=e.normal[r];l<0?Ae(i,s,Xe(n,s)):l>0&&Ae(i,s,Xe(o,s))}return i}function fs(t,e,n){let o=xe(Xn),i=xe(Xn);for(let r=0;r<me.length;r++){let s=me[r];Zn(o,s,Yn(t.mins[r],s,e,n)),Zn(i,s,Yn(t.maxs[r],s,e,n))}return{mins:o,maxs:i}}function ms(t,e,n){if(!e||n===0)return t;let o=xe(t);return Ae(o,e,n),o}function xs(t,e,n){if(!e||n===0)return t;switch(e){case"x":return{...t,x:t.x+n};case"y":return{...t,y:t.y+n};case"z":default:return{...t,z:t.z+n}}}function Ct(t){let{origin:e,mins:n,maxs:o,trace:i}=t;if(!i(e,n,o,e).startsolid)return{result:"good-position",origin:{...e}};let s=[];for(let l=0;l<Vt.length;l++){let c=Vt[l],{mins:f,maxs:u}=fs(c,n,o),a=Jn(e,c,n,o),m=i(a,f,u,a),h,d=0;if(m.startsolid)for(let N=0;N<me.length;N++){if(c.normal[N]!==0)continue;let F=me[N],V=xe(a);if(Ae(V,F,1),m=i(V,f,u,V),!m.startsolid){a=V,h=F,d=1;break}if(V=xe(a),Ae(V,F,-1),m=i(V,f,u,V),!m.startsolid){a=V,h=F,d=-1;break}}if(m.startsolid)continue;let S=Vt[l^1],_=Jn(e,S,n,o);if(_=ms(_,h,d),m=i(a,f,u,_),m.startsolid)continue;let A=ds(c.normal),M=O(m.endpos??_,P(A,.125)),v=te(M,_),p=O(e,v);p=xs(p,h,d),!i(p,n,o,p).startsolid&&s.push({origin:p,distance:ue(v)})}return s.length===0?{result:"no-good-position",origin:{...e}}:(s.sort((l,c)=>l.distance-c.distance),{result:"fixed",origin:{...s[0].origin}})}var ps=1.5,jn=.5,hs=1.01;function ys(t){let{origin:e,cmd:n,frametime:o,pmFriction:i,pmStopSpeed:r,pmMaxSpeed:s,pmAccelerate:l,pmWaterSpeed:c,doclip:f,forward:u,right:a,mins:m,maxs:h,trace:d,overbounce:S=hs,stepSize:_,maxBumps:A,maxClipPlanes:M}=t,v=bs({velocity:t.velocity,pmFriction:i,pmStopSpeed:r,frametime:o}),p=gs({cmd:n,forward:u,right:a,pmMaxSpeed:s,pmWaterSpeed:c});if(p.wishspeed>0&&(v=J({velocity:v,wishdir:p.wishdir,wishspeed:p.accelSpeed,accel:l,frametime:o})),!f){let C=P(v,o);return{origin:O(e,C),velocity:v,planes:[],blocked:0,stopped:v.x===0&&v.y===0&&v.z===0,stepped:!1,stepHeight:0}}if(!d||!m||!h)throw new Error("applyPmoveFlyMove: doclip=true requires trace/mins/maxs");return ce({origin:e,velocity:v,frametime:o,overbounce:S,trace:d,mins:m,maxs:h,stepSize:_,maxBumps:A,maxClipPlanes:M})}function bs(t){let{velocity:e,pmFriction:n,pmStopSpeed:o,frametime:i}=t,r=U(e);if(r<1)return{x:0,y:0,z:0};let s=n*ps,c=(r<o?o:r)*s*i,f=r-c;return f<0&&(f=0),f===r?e:P(e,f/r)}function gs(t){let{cmd:e,forward:n,right:o,pmMaxSpeed:i,pmWaterSpeed:r}=t,s=L(n),l=L(o),f={x:s.x*e.forwardmove+l.x*e.sidemove,y:s.y*e.forwardmove+l.y*e.sidemove,z:s.z*e.forwardmove+l.z*e.sidemove},u=e.buttons??0;u&8&&(f=O(f,{x:0,y:0,z:r*jn})),u&16&&(f=O(f,{x:0,y:0,z:-r*jn}));let a=U(f),m=a===0?{x:0,y:0,z:0}:L(f);if(a>i){let d=i/a;f=P(f,d),a=i,m=a===0?{x:0,y:0,z:0}:L(f)}let h=a*2;return{wishdir:m,wishspeed:a,accelSpeed:h}}var Ss=1,_s=40,Ze=50,qn=350,Ts=2048,$n=.1,As=800,Ms=50,Qn=.7,vs=18,Ns=1.01,Vs=2;function Cs(t){let{pmFlags:e,pmTime:n,waterlevel:o,watertype:i,gravity:r,cmd:s,forward:l,origin:c,velocity:f,mins:u,maxs:a,viewheight:m,trace:h,pointContents:d,onGround:S,overbounce:_=Ns,stepSize:A=vs,maxBumps:M,maxClipPlanes:v}=t;if(n>0)return{pmFlags:e,pmTime:n,velocity:f,performedWaterJump:!1};let p=Z(e,128),C=n,N=f,F=L({x:l.x,y:l.y,z:0}),V=ue(F)>0;if(o<2&&V){let g=O(c,P(F,Ss)),Q=h(c,g,u,a),Eo=Q.contents??0;Q.fraction<1&&(Eo&536870912)!==0&&(p=G(p,128))}if(r===0)return{pmFlags:p,pmTime:C,velocity:N,performedWaterJump:!1};if(((s.buttons??0)&8)===0&&s.forwardmove<=0)return{pmFlags:p,pmTime:C,velocity:N,performedWaterJump:!1};if(o!==2)return{pmFlags:p,pmTime:C,velocity:N,performedWaterJump:!1};if((i&8192)!==0)return{pmFlags:p,pmTime:C,velocity:N,performedWaterJump:!1};if(!V)return{pmFlags:p,pmTime:C,velocity:N,performedWaterJump:!1};let k=O(c,P(F,_s)),W=h(c,k,u,a);if(W.fraction===1||!W.planeNormal||W.planeNormal.z>=Qn)return{pmFlags:p,pmTime:C,velocity:N,performedWaterJump:!1};let R={x:F.x*Ze,y:F.y*Ze,z:qn},z=c,y=!0,T=Rs(r);for(let g=0;g<T;g++){R={x:R.x,y:R.y,z:R.z-r*$n},R.z<0&&(y=!1);let Q=ce({origin:z,velocity:R,frametime:$n,trace:h,mins:u,maxs:a,overbounce:_,stepSize:A,maxBumps:M,maxClipPlanes:v,hasTime:y});z=Q.origin,R=Q.velocity}let H=O(z,{x:0,y:0,z:-Vs}),D=h(z,H,u,a);return D.fraction===1||!D.planeNormal||D.planeNormal.z<Qn||D.endpos.z<c.z?{pmFlags:p,pmTime:C,velocity:N,performedWaterJump:!1}:S&&Math.abs(c.z-D.endpos.z)<=A?{pmFlags:p,pmTime:C,velocity:N,performedWaterJump:!1}:_e({origin:D.endpos,mins:u,viewheight:m,pointContents:d}).waterlevel>=2?{pmFlags:p,pmTime:C,velocity:N,performedWaterJump:!1}:(p=G(p,8),C=Ts,N={x:F.x*Ze,y:F.y*Ze,z:qn},{pmFlags:p,pmTime:C,velocity:N,performedWaterJump:!0})}function Rs(t){if(t===0)return 0;let e=Math.floor(10*(As/t));return e<=0?0:Math.min(Ms,e)}var Rt=[0,-1,1];function Ot(t){let{origin:e,mins:n,maxs:o,trace:i}=t;return!i(e,e,n,o).allsolid}function Os(t){let{origin:e,velocity:n,mins:o,maxs:i,previousOrigin:r,trace:s}=t;if(Ot({origin:e,mins:o,maxs:i,trace:s}))return{origin:{...e},velocity:{...n},resolution:"unchanged"};let l=Ct({origin:e,mins:o,maxs:i,trace:(c,f,u,a)=>s(c,a,f,u)});return l.result==="fixed"||l.result==="good-position"?{origin:l.origin,velocity:{...n},resolution:"fixed"}:{origin:{...r},velocity:{...n},resolution:"reverted"}}function Ps(t){let{origin:e,mins:n,maxs:o,trace:i}=t;for(let r of Rt)for(let s of Rt)for(let l of Rt){let c={x:e.x+l,y:e.y+s,z:e.z+r};if(Ot({origin:c,mins:n,maxs:o,trace:i}))return{origin:c,snapped:l!==0||s!==0||r!==0}}return{origin:{...e},snapped:!1}}function Fs(t,e){return{x:t.x+e.x,y:t.y+e.y,z:t.z+e.z}}function Es(t){return t>89&&t<180?89:t<271&&t>=180?271:t}function Ls(t){let{pmFlags:e,cmdAngles:n,deltaAngles:o}=t,i;(e&32)!==0?i={x:0,y:n.y+o.y,z:0}:(i=Fs(n,o),i={...i,x:Es(i.x)});let r=re(i);return{viewangles:i,...r}}var ws=200,zs=200,Ds=200,Is=140,Bs=150,Us=3;function Gs(t){let e=he(t);return e>89&&e<180?89:e<271&&e>=180?271:e}function ks(t,e){return{x:Gs(t.x+e.x),y:he(t.y+e.y),z:he(t.z+e.z)}}function Ws(t,e){let n=e.sensitivityX??e.sensitivity,o=(e.sensitivityY??e.sensitivity)*(e.invertY?-1:1);return{x:t.deltaY*o,y:t.deltaX*n,z:0}}var eo=(g=>(g[g.bad=0]="bad",g[g.muzzleflash=1]="muzzleflash",g[g.muzzleflash2=2]="muzzleflash2",g[g.temp_entity=3]="temp_entity",g[g.layout=4]="layout",g[g.inventory=5]="inventory",g[g.nop=6]="nop",g[g.disconnect=7]="disconnect",g[g.reconnect=8]="reconnect",g[g.sound=9]="sound",g[g.print=10]="print",g[g.stufftext=11]="stufftext",g[g.serverdata=12]="serverdata",g[g.configstring=13]="configstring",g[g.spawnbaseline=14]="spawnbaseline",g[g.centerprint=15]="centerprint",g[g.download=16]="download",g[g.playerinfo=17]="playerinfo",g[g.packetentities=18]="packetentities",g[g.deltapacketentities=19]="deltapacketentities",g[g.frame=20]="frame",g[g.splitclient=21]="splitclient",g[g.configblast=22]="configblast",g[g.spawnbaselineblast=23]="spawnbaselineblast",g[g.level_restart=24]="level_restart",g[g.damage=25]="damage",g[g.locprint=26]="locprint",g[g.fog=27]="fog",g[g.waitingforplayers=28]="waitingforplayers",g[g.bot_chat=29]="bot_chat",g[g.poi=30]="poi",g[g.help_path=31]="help_path",g[g.muzzleflash3=32]="muzzleflash3",g[g.achievement=33]="achievement",g))(eo||{}),to=(r=>(r[r.bad=0]="bad",r[r.nop=1]="nop",r[r.move=2]="move",r[r.userinfo=3]="userinfo",r[r.stringcmd=4]="stringcmd",r))(to||{});var no=(x=>(x[x.GUNSHOT=0]="GUNSHOT",x[x.BLOOD=1]="BLOOD",x[x.BLASTER=2]="BLASTER",x[x.RAILTRAIL=3]="RAILTRAIL",x[x.SHOTGUN=4]="SHOTGUN",x[x.EXPLOSION1=5]="EXPLOSION1",x[x.EXPLOSION2=6]="EXPLOSION2",x[x.ROCKET_EXPLOSION=7]="ROCKET_EXPLOSION",x[x.GRENADE_EXPLOSION=8]="GRENADE_EXPLOSION",x[x.SPARKS=9]="SPARKS",x[x.SPLASH=10]="SPLASH",x[x.BUBBLETRAIL=11]="BUBBLETRAIL",x[x.SCREEN_SPARKS=12]="SCREEN_SPARKS",x[x.SHIELD_SPARKS=13]="SHIELD_SPARKS",x[x.BULLET_SPARKS=14]="BULLET_SPARKS",x[x.LASER_SPARKS=15]="LASER_SPARKS",x[x.PARASITE_ATTACK=16]="PARASITE_ATTACK",x[x.ROCKET_EXPLOSION_WATER=17]="ROCKET_EXPLOSION_WATER",x[x.GRENADE_EXPLOSION_WATER=18]="GRENADE_EXPLOSION_WATER",x[x.MEDIC_CABLE_ATTACK=19]="MEDIC_CABLE_ATTACK",x[x.BFG_EXPLOSION=20]="BFG_EXPLOSION",x[x.BFG_BIGEXPLOSION=21]="BFG_BIGEXPLOSION",x[x.BOSSTPORT=22]="BOSSTPORT",x[x.BFG_LASER=23]="BFG_LASER",x[x.GRAPPLE_CABLE=24]="GRAPPLE_CABLE",x[x.WELDING_SPARKS=25]="WELDING_SPARKS",x[x.GREENBLOOD=26]="GREENBLOOD",x[x.BLUEHYPERBLASTER=27]="BLUEHYPERBLASTER",x[x.PLASMA_EXPLOSION=28]="PLASMA_EXPLOSION",x[x.TUNNEL_SPARKS=29]="TUNNEL_SPARKS",x[x.BLASTER2=30]="BLASTER2",x[x.RAILTRAIL2=31]="RAILTRAIL2",x[x.FLAME=32]="FLAME",x[x.LIGHTNING=33]="LIGHTNING",x[x.DEBUGTRAIL=34]="DEBUGTRAIL",x[x.PLAIN_EXPLOSION=35]="PLAIN_EXPLOSION",x[x.FLASHLIGHT=36]="FLASHLIGHT",x[x.FORCEWALL=37]="FORCEWALL",x[x.HEATBEAM=38]="HEATBEAM",x[x.MONSTER_HEATBEAM=39]="MONSTER_HEATBEAM",x[x.STEAM=40]="STEAM",x[x.BUBBLETRAIL2=41]="BUBBLETRAIL2",x[x.MOREBLOOD=42]="MOREBLOOD",x[x.HEATBEAM_SPARKS=43]="HEATBEAM_SPARKS",x[x.HEATBEAM_STEAM=44]="HEATBEAM_STEAM",x[x.CHAINFIST_SMOKE=45]="CHAINFIST_SMOKE",x[x.ELECTRIC_SPARKS=46]="ELECTRIC_SPARKS",x[x.TRACKER_EXPLOSION=47]="TRACKER_EXPLOSION",x[x.TELEPORT_EFFECT=48]="TELEPORT_EFFECT",x[x.DBALL_GOAL=49]="DBALL_GOAL",x[x.WIDOWBEAMOUT=50]="WIDOWBEAMOUT",x[x.NUKEBLAST=51]="NUKEBLAST",x[x.WIDOWSPLASH=52]="WIDOWSPLASH",x[x.EXPLOSION1_BIG=53]="EXPLOSION1_BIG",x[x.EXPLOSION1_NP=54]="EXPLOSION1_NP",x[x.FLECHETTE=55]="FLECHETTE",x[x.BLUEHYPERBLASTER_KEX=56]="BLUEHYPERBLASTER_KEX",x[x.BFG_ZAP=57]="BFG_ZAP",x[x.BERSERK_SLAM=58]="BERSERK_SLAM",x[x.GRAPPLE_CABLE_2=59]="GRAPPLE_CABLE_2",x[x.POWER_SPLASH=60]="POWER_SPLASH",x[x.LIGHTNING_BEAM=61]="LIGHTNING_BEAM",x[x.EXPLOSION1_NL=62]="EXPLOSION1_NL",x[x.EXPLOSION2_NL=63]="EXPLOSION2_NL",x))(no||{});var Hs=1024,Ks=256,Xs=16,Zs=64,Ys=512,Js=1400,js=0,qs=1,$s=2,Qs=3,ea=4,ta=5,na=6,oa=7,ra=8,ia=9,sa=10,aa=11,la=12,ca=13,ua=16,da=17,fa=18,ma=19,xa=20,pa=30,ha=31,ya=32,ba=33,ga=34,Sa=35,_a=36,Ta=37,Aa=38,Ma=39;var oo=(s=>(s[s.LAYOUTS_LAYOUT=1]="LAYOUTS_LAYOUT",s[s.LAYOUTS_INVENTORY=2]="LAYOUTS_INVENTORY",s[s.LAYOUTS_HIDE_HUD=4]="LAYOUTS_HIDE_HUD",s[s.LAYOUTS_INTERMISSION=8]="LAYOUTS_INTERMISSION",s[s.LAYOUTS_HELP=16]="LAYOUTS_HELP",s[s.LAYOUTS_HIDE_CROSSHAIR=32]="LAYOUTS_HIDE_CROSSHAIR",s))(oo||{});function Pt(t){return t<<16>>16}function ro(t,e,n){let o=Math.floor(n/2),i=n%2!==0,r=e+o,s=t[r]||0;if(i){let l=t[r+1]||0,c=s>>>8&255;return(l&255)<<8|c}else return s&65535}function va(t,e,n,o){let i=Math.floor(n/2),r=n%2!==0,s=e+i;if(t[s]===void 0&&(t[s]=0),!r)t[s]=Pt(o);else{t[s+1]===void 0&&(t[s+1]=0);let l=t[s],c=t[s+1],f=o&255,u=l&255|f<<8;t[s]=Pt(u);let m=o>>>8&255|c&65280;t[s+1]=Pt(m)}}function Ft(t,e,n,o,i){let r=i*n,s=Math.floor(r/8),l=r%8,c=(1<<i)-1<<l,u=ro(t,e,s)&~c|o<<l&c;va(t,e,s,u&65535)}function Et(t,e,n,o){let i=o*n,r=Math.floor(i/8),s=i%8,l=(1<<o)-1<<s;return(ro(t,e,r)&l)>>>s}var io=(V=>(V.QuadDamage="quad",V.Invulnerability="invulnerability",V.EnviroSuit="enviro_suit",V.Rebreather="rebreather",V.Silencer="silencer",V.PowerScreen="power_screen",V.PowerShield="power_shield",V.QuadFire="quad_fire",V.Invisibility="invisibility",V.Bandolier="bandolier",V.AmmoPack="ammo_pack",V.IRGoggles="ir_goggles",V.DoubleDamage="double_damage",V.SphereVengeance="sphere_vengeance",V.SphereHunter="sphere_hunter",V.SphereDefender="sphere_defender",V.Doppelganger="doppelganger",V.TagToken="tag_token",V.TechResistance="tech_resistance",V.TechStrength="tech_strength",V.TechHaste="tech_haste",V.TechRegeneration="tech_regeneration",V.Flashlight="flashlight",V.Compass="compass",V))(io||{});var so=(b=>(b[b.STAT_HEALTH_ICON=0]="STAT_HEALTH_ICON",b[b.STAT_HEALTH=1]="STAT_HEALTH",b[b.STAT_AMMO_ICON=2]="STAT_AMMO_ICON",b[b.STAT_AMMO=3]="STAT_AMMO",b[b.STAT_ARMOR_ICON=4]="STAT_ARMOR_ICON",b[b.STAT_ARMOR=5]="STAT_ARMOR",b[b.STAT_SELECTED_ICON=6]="STAT_SELECTED_ICON",b[b.STAT_PICKUP_ICON=7]="STAT_PICKUP_ICON",b[b.STAT_PICKUP_STRING=8]="STAT_PICKUP_STRING",b[b.STAT_TIMER_ICON=9]="STAT_TIMER_ICON",b[b.STAT_TIMER=10]="STAT_TIMER",b[b.STAT_HELPICON=11]="STAT_HELPICON",b[b.STAT_SELECTED_ITEM=12]="STAT_SELECTED_ITEM",b[b.STAT_LAYOUTS=13]="STAT_LAYOUTS",b[b.STAT_FRAGS=14]="STAT_FRAGS",b[b.STAT_FLASHES=15]="STAT_FLASHES",b[b.STAT_CHASE=16]="STAT_CHASE",b[b.STAT_SPECTATOR=17]="STAT_SPECTATOR",b[b.STAT_CTF_TEAM1_PIC=18]="STAT_CTF_TEAM1_PIC",b[b.STAT_CTF_TEAM1_CAPS=19]="STAT_CTF_TEAM1_CAPS",b[b.STAT_CTF_TEAM2_PIC=20]="STAT_CTF_TEAM2_PIC",b[b.STAT_CTF_TEAM2_CAPS=21]="STAT_CTF_TEAM2_CAPS",b[b.STAT_CTF_FLAG_PIC=22]="STAT_CTF_FLAG_PIC",b[b.STAT_CTF_JOINED_TEAM1_PIC=23]="STAT_CTF_JOINED_TEAM1_PIC",b[b.STAT_CTF_JOINED_TEAM2_PIC=24]="STAT_CTF_JOINED_TEAM2_PIC",b[b.STAT_CTF_TEAM1_HEADER=25]="STAT_CTF_TEAM1_HEADER",b[b.STAT_CTF_TEAM2_HEADER=26]="STAT_CTF_TEAM2_HEADER",b[b.STAT_CTF_TECH=27]="STAT_CTF_TECH",b[b.STAT_CTF_ID_VIEW=28]="STAT_CTF_ID_VIEW",b[b.STAT_CTF_MATCH=29]="STAT_CTF_MATCH",b[b.STAT_CTF_ID_VIEW_COLOR=30]="STAT_CTF_ID_VIEW_COLOR",b[b.STAT_CTF_TEAMINFO=31]="STAT_CTF_TEAMINFO",b[b.STAT_WEAPONS_OWNED_1=32]="STAT_WEAPONS_OWNED_1",b[b.STAT_WEAPONS_OWNED_2=33]="STAT_WEAPONS_OWNED_2",b[b.STAT_AMMO_INFO_START=34]="STAT_AMMO_INFO_START",b[b.STAT_POWERUP_INFO_START=41]="STAT_POWERUP_INFO_START",b[b.STAT_KEY_A=44]="STAT_KEY_A",b[b.STAT_KEY_B=45]="STAT_KEY_B",b[b.STAT_KEY_C=46]="STAT_KEY_C",b[b.STAT_ACTIVE_WHEEL_WEAPON=47]="STAT_ACTIVE_WHEEL_WEAPON",b[b.STAT_COOP_RESPAWN=48]="STAT_COOP_RESPAWN",b[b.STAT_LIVES=49]="STAT_LIVES",b[b.STAT_HIT_MARKER=50]="STAT_HIT_MARKER",b[b.STAT_SELECTED_ITEM_NAME=51]="STAT_SELECTED_ITEM_NAME",b[b.STAT_HEALTH_BARS=52]="STAT_HEALTH_BARS",b[b.STAT_ACTIVE_WEAPON=53]="STAT_ACTIVE_WEAPON",b[b.STAT_LAST=54]="STAT_LAST",b))(so||{}),Ye=12,Je=9,Na=Math.ceil(Ye*Je/16),je=23,qe=2,Va=Math.ceil(je*qe/16),ao={power_screen:0,power_shield:1,quad:3,quad_fire:4,invulnerability:5,invisibility:6,silencer:7,rebreather:8,enviro_suit:9,bandolier:10,ammo_pack:10,ir_goggles:11,double_damage:12,sphere_vengeance:13,sphere_hunter:14,sphere_defender:15,doppelganger:16,flashlight:17,compass:18,tech_resistance:19,tech_strength:20,tech_haste:21,tech_regeneration:22,tag_token:-1};function Ca(t,e,n){if(e<0||e>=Ye)return;let o=n;o>511&&(o=511),o<0&&(o=0),Ft(t,34,e,o,Je)}function Lt(t,e){return e<0||e>=Ye?0:Et(t,34,e,Je)}function Ra(t,e,n){let o;if(typeof e=="number"?o=e:o=ao[e],o===void 0||o<0||o>=je)return;let i=n;i>3&&(i=3),i<0&&(i=0),Ft(t,41,o,i,qe)}function Oa(t,e){let n;return typeof e=="number"?n=e:n=ao[e],n===void 0||n<0||n>=je?0:Et(t,41,n,qe)}function Pa(t,e){t.writeByte(e.msec),t.writeByte(e.buttons),t.writeAngle16(e.angles.x),t.writeAngle16(e.angles.y),t.writeAngle16(e.angles.z),t.writeShort(e.forwardmove),t.writeShort(e.sidemove),t.writeShort(e.upmove),t.writeByte(e.impulse),t.writeByte(0)}var lo=(p=>(p[p.MinLight=1]="MinLight",p[p.ViewerModel=2]="ViewerModel",p[p.WeaponModel=4]="WeaponModel",p[p.FullBright=8]="FullBright",p[p.DepthHack=16]="DepthHack",p[p.Translucent=32]="Translucent",p[p.FrameLerp=64]="FrameLerp",p[p.Beam=128]="Beam",p[p.CustomLight=256]="CustomLight",p[p.Glow=512]="Glow",p[p.ShellRed=1024]="ShellRed",p[p.ShellGreen=2048]="ShellGreen",p[p.ShellBlue=4096]="ShellBlue",p[p.IrVisible=32768]="IrVisible",p[p.ShellDouble=65536]="ShellDouble",p[p.ShellHalfDam=131072]="ShellHalfDam",p[p.MinLightPlus=262144]="MinLightPlus",p[p.ExtraLight=524288]="ExtraLight",p[p.BeamLightning=1048576]="BeamLightning",p[p.Flashlight=2097152]="Flashlight",p))(lo||{});var Fa=[0,145,227,114,7,150,228,117,14,159,237,124,9,152,234,123,28,141,255,110,27,138,248,105,18,131,241,96,21,132,246,103,56,169,219,74,63,174,220,77,54,167,213,68,49,160,210,67,36,181,199,86,35,178,192,81,42,187,201,88,45,188,206,95,112,225,147,2,119,230,148,5,126,239,157,12,121,232,154,11,108,253,143,30,107,250,136,25,98,243,129,16,101,244,134,23,72,217,171,58,79,222,172,61,70,215,165,52,65,208,162,51,84,197,183,38,83,194,176,33,90,203,185,40,93,204,190,47,224,113,3,146,231,118,4,149,238,127,13,156,233,120,10,155,252,109,31,142,251,106,24,137,242,99,17,128,245,100,22,135,216,73,59,170,223,78,60,173,214,71,53,164,209,64,50,163,196,85,39,182,195,82,32,177,202,91,41,184,205,92,46,191,144,1,115,226,151,6,116,229,158,15,125,236,153,8,122,235,140,29,111,254,139,26,104,249,130,19,97,240,133,20,102,247,168,57,75,218,175,62,76,221,166,55,69,212,161,48,66,211,180,37,86,199,179,34,80,193,186,43,89,200,189,44,94,207];function Ea(t){let e=0;for(let n=0;n<t.length;n++)e=Fa[(e^t[n])&255];return e}var co=(T=>(T[T.Rotate=4]="Rotate",T[T.Gib=8]="Gib",T[T.RotateScript=16]="RotateScript",T[T.Blaster=32]="Blaster",T[T.Rocket=64]="Rocket",T[T.Grenade=128]="Grenade",T[T.HyperBlaster=256]="HyperBlaster",T[T.Bfg=512]="Bfg",T[T.ColorShell=1024]="ColorShell",T[T.Powerscreen=2048]="Powerscreen",T[T.Anim01=4096]="Anim01",T[T.Anim23=8192]="Anim23",T[T.AnimAll=16384]="AnimAll",T[T.AnimAllFast=32768]="AnimAllFast",T[T.Quad=65536]="Quad",T[T.Pent=131072]="Pent",T[T.Explosion=262144]="Explosion",T[T.Teleport=524288]="Teleport",T[T.Flag1=1048576]="Flag1",T[T.Flag2=2097152]="Flag2",T[T.Boomerang=4194304]="Boomerang",T[T.Greengibs=8388608]="Greengibs",T[T.Bluehyperblaster=16777216]="Bluehyperblaster",T[T.Spinning=33554432]="Spinning",T[T.Plasma=67108864]="Plasma",T[T.Trap=134217728]="Trap",T[T.Tracker=268435456]="Tracker",T[T.Double=536870912]="Double",T[T.Sphinx=1073741824]="Sphinx",T[T.TagTrail=2147483648]="TagTrail",T))(co||{});var uo=(u=>(u[u.None=0]="None",u[u.ItemRespawn=1]="ItemRespawn",u[u.Footstep=2]="Footstep",u[u.FallShort=3]="FallShort",u[u.Fall=4]="Fall",u[u.FallFar=5]="FallFar",u[u.PlayerTeleport=6]="PlayerTeleport",u[u.OtherTeleport=7]="OtherTeleport",u[u.OtherFootstep=8]="OtherFootstep",u[u.LadderStep=9]="LadderStep",u))(uo||{});var wt=1,zt=2,Dt=4,It=8,Bt=16,Ut=32,fo=64,Me=128,ve=256,Gt=512,kt=1024,Wt=2048,Ht=4096,Kt=8192,Xt=16384,Zt=32768,Yt=65536,Jt=1<<17,jt=1<<18,qt=1<<19,$t=1<<20,Qt=1<<21,en=1<<22,tn=1<<23,mo=1<<24,nn=1<<25,on=1<<26,rn=1<<27,sn=1<<28,an=1<<29,ln=1<<30,cn=-2147483648,un=1,dn=2,fn=4,La={number:0,origin:{x:0,y:0,z:0},angles:{x:0,y:0,z:0},modelIndex:0,frame:0,skinNum:0,effects:0,renderfx:0,solid:0,sound:0,event:0,alpha:0,scale:0,instanceBits:0,loopVolume:0,loopAttenuation:0,owner:0,oldFrame:0,modelIndex2:0,modelIndex3:0,modelIndex4:0};function wa(t,e){let n=fo;t>=256&&(n|=ve),n&65280&&(n|=Me),e.writeByte(n&255),n&Me&&e.writeByte(n>>8&255),n&ve?e.writeShort(t):e.writeByte(t)}function za(t,e,n,o,i){let r=0,s=0;i&&(t=La),(e.modelIndex!==t.modelIndex||o)&&(r|=Wt),(e.modelIndex2!==t.modelIndex2||o)&&(r|=$t),(e.modelIndex3!==t.modelIndex3||o)&&(r|=Qt),(e.modelIndex4!==t.modelIndex4||o)&&(r|=en),(e.origin.x!==t.origin.x||o)&&(r|=wt),(e.origin.y!==t.origin.y||o)&&(r|=zt),(e.origin.z!==t.origin.z||o)&&(r|=Gt),(e.angles.x!==t.angles.x||o)&&(r|=kt),(e.angles.y!==t.angles.y||o)&&(r|=Dt),(e.angles.z!==t.angles.z||o)&&(r|=It),(e.frame!==t.frame||o)&&(e.frame>=256?r|=Jt:r|=Bt),(e.skinNum!==t.skinNum||o)&&(e.skinNum>=256?r|=nn:r|=Yt),(e.effects!==t.effects||o)&&(e.effects>=256?r|=qt:r|=Xt),(e.renderfx!==t.renderfx||o)&&(e.renderfx>=256?r|=jt:r|=Ht),(e.solid!==t.solid||o)&&(r|=rn),(e.sound!==t.sound||o)&&(r|=on),(e.event!==t.event||o)&&(r|=Ut),(e.alpha!==t.alpha||o)&&e.alpha!==void 0&&(r|=Kt),(e.scale!==t.scale||o)&&e.scale!==void 0&&(r|=sn),(e.instanceBits!==t.instanceBits||o)&&e.instanceBits!==void 0&&(r|=an),(e.loopVolume!==t.loopVolume||o)&&e.loopVolume!==void 0&&(r|=ln),(e.loopAttenuation!==t.loopAttenuation||o)&&e.loopAttenuation!==void 0&&(s|=un),(e.owner!==t.owner||o)&&e.owner!==void 0&&(s|=dn),(e.oldFrame!==t.oldFrame||o)&&e.oldFrame!==void 0&&(s|=fn),e.number>=256&&(r|=ve),s>0&&(r|=cn),r&4278190080&&(r|=tn),r&4294901760&&(r|=Zt),r&4294967040&&(r|=Me),n.writeByte(r&255),r&Me&&n.writeByte(r>>8&255),r&Zt&&n.writeByte(r>>16&255),r&tn&&n.writeByte(r>>24&255),r&cn&&n.writeByte(s&255),r&ve?n.writeShort(e.number):n.writeByte(e.number),r&Wt&&n.writeByte(e.modelIndex),r&$t&&n.writeByte(e.modelIndex2??0),r&Qt&&n.writeByte(e.modelIndex3??0),r&en&&n.writeByte(e.modelIndex4??0),r&Bt&&n.writeByte(e.frame),r&Jt&&n.writeShort(e.frame),r&Yt&&n.writeByte(e.skinNum),r&nn&&n.writeShort(e.skinNum),r&Xt&&n.writeByte(e.effects),r&qt&&n.writeShort(e.effects),r&Ht&&n.writeByte(e.renderfx),r&jt&&n.writeShort(e.renderfx),r&wt&&n.writeCoord(e.origin.x),r&zt&&n.writeCoord(e.origin.y),r&Gt&&n.writeCoord(e.origin.z),r&kt&&n.writeAngle(e.angles.x),r&Dt&&n.writeAngle(e.angles.y),r&It&&n.writeAngle(e.angles.z),r&mo,r&on&&n.writeByte(e.sound??0),r&Ut&&n.writeByte(e.event??0),r&rn&&n.writeShort(e.solid),r&Kt&&n.writeByte(Math.floor((e.alpha??0)*255)),r&sn&&n.writeFloat(e.scale??0),r&an&&n.writeLong(e.instanceBits??0),r&ln&&n.writeByte(Math.floor((e.loopVolume??0)*255)),s&un&&n.writeByte(Math.floor((e.loopAttenuation??0)*255)),s&dn&&n.writeShort(e.owner??0),s&fn&&n.writeShort(e.oldFrame??0)}var xo=1,po=2,ho=4,yo=8,bo=16,go=32,So=64,_o=128,To=256,Ao=512,Mo=1024,vo=2048,No=4096,Vo=8192,Co=16384,Ro=32768;function Da(t,e){let n=0;e.pm_type!==0&&(n|=xo),(e.origin.x!==0||e.origin.y!==0||e.origin.z!==0)&&(n|=po),(e.velocity.x!==0||e.velocity.y!==0||e.velocity.z!==0)&&(n|=ho),e.pm_time!==0&&(n|=yo),e.pm_flags!==0&&(n|=bo),e.gravity!==0&&(n|=go),(e.delta_angles.x!==0||e.delta_angles.y!==0||e.delta_angles.z!==0)&&(n|=So),(e.viewoffset.x!==0||e.viewoffset.y!==0||e.viewoffset.z!==0)&&(n|=_o),(e.viewangles.x!==0||e.viewangles.y!==0||e.viewangles.z!==0)&&(n|=To),(e.kick_angles.x!==0||e.kick_angles.y!==0||e.kick_angles.z!==0)&&(n|=Ao),e.gun_index!==0&&(n|=No),(e.gun_frame!==0||e.gun_offset.x!==0||e.gun_offset.y!==0||e.gun_offset.z!==0||e.gun_angles.x!==0||e.gun_angles.y!==0||e.gun_angles.z!==0)&&(n|=Vo),e.blend&&(e.blend[0]!==0||e.blend[1]!==0||e.blend[2]!==0||e.blend[3]!==0)&&(n|=Mo),e.fov!==0&&(n|=vo),e.rdflags!==0&&(n|=Co),e.watertype!==0&&(n|=Ro);let o=0;for(let i=0;i<32;i++)e.stats[i]&&e.stats[i]!==0&&(o|=1<<i);t.writeShort(n),n&xo&&t.writeByte(e.pm_type),n&po&&(t.writeShort(Math.round(e.origin.x*8)),t.writeShort(Math.round(e.origin.y*8)),t.writeShort(Math.round(e.origin.z*8))),n&ho&&(t.writeShort(Math.round(e.velocity.x*8)),t.writeShort(Math.round(e.velocity.y*8)),t.writeShort(Math.round(e.velocity.z*8))),n&yo&&t.writeByte(e.pm_time),n&bo&&t.writeByte(e.pm_flags),n&go&&t.writeShort(e.gravity),n&So&&(t.writeShort(Math.round(e.delta_angles.x*(32768/180))),t.writeShort(Math.round(e.delta_angles.y*(32768/180))),t.writeShort(Math.round(e.delta_angles.z*(32768/180)))),n&_o&&(t.writeChar(Math.round(e.viewoffset.x*4)),t.writeChar(Math.round(e.viewoffset.y*4)),t.writeChar(Math.round(e.viewoffset.z*4))),n&To&&(t.writeAngle16(e.viewangles.x),t.writeAngle16(e.viewangles.y),t.writeAngle16(e.viewangles.z)),n&Ao&&(t.writeChar(Math.round(e.kick_angles.x*4)),t.writeChar(Math.round(e.kick_angles.y*4)),t.writeChar(Math.round(e.kick_angles.z*4))),n&No&&t.writeByte(e.gun_index),n&Vo&&(t.writeByte(e.gun_frame),t.writeChar(Math.round(e.gun_offset.x*4)),t.writeChar(Math.round(e.gun_offset.y*4)),t.writeChar(Math.round(e.gun_offset.z*4)),t.writeChar(Math.round(e.gun_angles.x*4)),t.writeChar(Math.round(e.gun_angles.y*4)),t.writeChar(Math.round(e.gun_angles.z*4))),n&Mo&&(t.writeByte(Math.round(e.blend[0])),t.writeByte(Math.round(e.blend[1])),t.writeByte(Math.round(e.blend[2])),t.writeByte(Math.round(e.blend[3]))),n&vo&&t.writeByte(e.fov),n&Co&&t.writeByte(e.rdflags),n&Ro&&t.writeByte(e.watertype),t.writeLong(o);for(let i=0;i<32;i++)o&1<<i&&t.writeShort(e.stats[i])}var Ne=.025,$e={None:0,Feet:1,Waist:2,Under:3},Ia=(t,e)=>{let n={...t.origin};n.z-=.25;let o=e(t.origin,n);return{...t,onGround:o.fraction<1}},Ba=(t,e)=>{let n={...t.origin},{mins:o,maxs:i}=t;n.z=t.origin.z+o.z+1;let r=e(n);if(!(r&56))return{...t,waterLevel:$e.None,watertype:0};let s=$e.Feet,l=r,c=t.origin.z+(o.z+i.z)*.5;n.z=c;let f=e(n);if(f&56){s=$e.Waist,l=f;let u=t.origin.z+22;n.z=u;let a=e(n);a&56&&(s=$e.Under,l=a)}return{...t,waterLevel:s,watertype:l}},Ua=(t,e,n,o)=>{let i={...t};i=Ia(i,n),i=Ba(i,o);let{origin:r,velocity:s,onGround:l,waterLevel:c,viewAngles:f}=i,u=c>=2?f:{x:f.x>180?(f.x-360)/3:f.x/3,y:f.y,z:f.z},{forward:a,right:m}=re(u),h=Ke({velocity:s,frametime:Ne,onGround:l,groundIsSlick:!1,onLadder:!1,waterlevel:c,pmFriction:6,pmStopSpeed:100,pmWaterFriction:1}),d=c>=2?Nt({forward:a,right:m,cmd:e,maxSpeed:320}):vt({forward:a,right:m,cmd:e,maxSpeed:320}),S=J({velocity:h,wishdir:d.wishdir,wishspeed:d.wishspeed,accel:l||c>=2?10:1,frametime:Ne}),_=n(r,{x:r.x+S.x*Ne,y:r.y+S.y*Ne,z:r.z+S.z*Ne});return{...i,origin:_.endpos,velocity:S}};var mn=class{constructor(e){e instanceof Uint8Array?this.view=new DataView(e.buffer,e.byteOffset,e.byteLength):this.view=new DataView(e),this.offset=0,this.length=this.view.byteLength}getPosition(){return this.offset}getReadPosition(){return this.offset}getLength(){return this.length}getRemaining(){return this.length-this.offset}seek(e){if(e<0||e>this.length)throw new Error(`Seek out of bounds: ${e} (length: ${this.length})`);this.offset=e}setReadPosition(e){this.seek(e)}hasMore(){return this.offset<this.length}hasBytes(e){return this.offset+e<=this.length}readChar(){let e=this.view.getInt8(this.offset);return this.offset+=1,e}readByte(){let e=this.view.getUint8(this.offset);return this.offset+=1,e}readShort(){let e=this.view.getInt16(this.offset,!0);return this.offset+=2,e}readUShort(){let e=this.view.getUint16(this.offset,!0);return this.offset+=2,e}readLong(){let e=this.view.getInt32(this.offset,!0);return this.offset+=4,e}readULong(){let e=this.view.getUint32(this.offset,!0);return this.offset+=4,e}readFloat(){let e=this.view.getFloat32(this.offset,!0);return this.offset+=4,e}readString(){let e="";for(;this.offset<this.length;){let n=this.readChar();if(n===-1||n===0)break;e+=String.fromCharCode(n)}return e}readStringLine(){let e="";for(;this.offset<this.length;){let n=this.readChar();if(n===-1||n===0||n===10)break;e+=String.fromCharCode(n)}return e}readCoord(){return this.readShort()*(1/8)}readAngle(){return this.readChar()*(360/256)}readAngle16(){return this.readShort()*360/65536}readData(e){if(this.offset+e>this.length)throw new Error(`Read out of bounds: ${this.offset+e} (length: ${this.length})`);let n=new Uint8Array(this.view.buffer,this.view.byteOffset+this.offset,e);return this.offset+=e,new Uint8Array(n)}readPos(e){e.x=this.readCoord(),e.y=this.readCoord(),e.z=this.readCoord()}readDir(e){let n=this.readByte();if(n>=162){e.x=0,e.y=0,e.z=0;return}let o=j[n];e.x=o[0],e.y=o[1],e.z=o[2]}};var Ve=class{constructor(e=1400){typeof e=="number"?(this.buffer=new Uint8Array(e),this.fixed=!1):(this.buffer=e,this.fixed=!0),this.view=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),this.offset=0}ensureSpace(e){if(this.offset+e>this.buffer.byteLength){if(this.fixed)throw new Error(`Buffer overflow: capacity ${this.buffer.byteLength}, needed ${this.offset+e}`);let n=Math.max(this.buffer.byteLength*2,this.offset+e),o=new Uint8Array(n);o.set(this.buffer),this.buffer=o,this.view=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength)}}writeByte(e){this.ensureSpace(1),this.view.setUint8(this.offset,e),this.offset+=1}writeBytes(e){this.ensureSpace(e.byteLength),this.buffer.set(e,this.offset),this.offset+=e.byteLength}writeChar(e){this.ensureSpace(1),this.view.setInt8(this.offset,e),this.offset+=1}writeShort(e){this.ensureSpace(2),this.view.setInt16(this.offset,e,!0),this.offset+=2}writeLong(e){this.ensureSpace(4),this.view.setInt32(this.offset,e,!0),this.offset+=4}writeFloat(e){this.ensureSpace(4),this.view.setFloat32(this.offset,e,!0),this.offset+=4}writeString(e){let n=e.length;this.ensureSpace(n+1);for(let o=0;o<n;o++)this.view.setUint8(this.offset+o,e.charCodeAt(o));this.view.setUint8(this.offset+n,0),this.offset+=n+1}writeCoord(e){this.writeShort(Math.trunc(e*8))}writeAngle(e){this.writeByte(Math.trunc(e*256/360)&255)}writeAngle16(e){this.writeShort(Math.trunc(e*65536/360)&65535)}writePos(e){this.writeCoord(e.x),this.writeCoord(e.y),this.writeCoord(e.z)}writeDir(e){let n=-1,o=0;if(e.x===0&&e.y===0&&e.z===0){this.writeByte(0);return}for(let i=0;i<j.length;i++){let r=j[i],s=e.x*r[0]+e.y*r[1]+e.z*r[2];s>n&&(n=s,o=i)}this.writeByte(o)}getData(){return this.buffer.slice(0,this.offset)}getBuffer(){return this.buffer}getOffset(){return this.offset}reset(){this.offset=0}};var xn=class{constructor(e=1024){this.buffer=new Uint8Array(e),this.view=new DataView(this.buffer.buffer),this.offset=0}ensureCapacity(e){if(this.offset+e>this.buffer.length){let n=Math.max(this.buffer.length*2,this.offset+e),o=new Uint8Array(n);o.set(this.buffer),this.buffer=o,this.view=new DataView(this.buffer.buffer)}}getData(){return this.buffer.slice(0,this.offset)}writeByte(e){this.ensureCapacity(1),this.view.setUint8(this.offset,e),this.offset+=1}writeChar(e){this.ensureCapacity(1),this.view.setInt8(this.offset,e),this.offset+=1}writeShort(e){this.ensureCapacity(2),this.view.setInt16(this.offset,e,!0),this.offset+=2}writeUShort(e){this.ensureCapacity(2),this.view.setUint16(this.offset,e,!0),this.offset+=2}writeLong(e){this.ensureCapacity(4),this.view.setInt32(this.offset,e,!0),this.offset+=4}writeFloat(e){this.ensureCapacity(4),this.view.setFloat32(this.offset,e,!0),this.offset+=4}writeString(e){let n=e.length+1;this.ensureCapacity(n);for(let o=0;o<e.length;o++)this.view.setUint8(this.offset+o,e.charCodeAt(o));this.view.setUint8(this.offset+e.length,0),this.offset+=n}writeData(e){this.ensureCapacity(e.length),this.buffer.set(e,this.offset),this.offset+=e.length}writeCoord(e){this.writeShort(Math.round(e*8))}writeAngle(e){this.writeByte(Math.round(e*256/360)&255)}writeAngle16(e){this.writeShort(Math.round(e*65536/360))}writeDir(e,n,o){let i=0,r=-999999,s=Math.sqrt(e*e+n*n+o*o);if(s>0){e/=s,n/=s,o/=s;for(let l=0;l<162;l++){let c=e*j[l][0]+n*j[l][1]+o*j[l][2];c>r&&(r=c,i=l)}}this.writeByte(i)}};var w=class w{constructor(){this.qport=0;this.incomingSequence=0;this.outgoingSequence=0;this.incomingAcknowledged=0;this.incomingReliableAcknowledged=!1;this.incomingReliableSequence=0;this.outgoingReliableSequence=0;this.reliableLength=0;this.fragmentSendOffset=0;this.fragmentBuffer=null;this.fragmentLength=0;this.fragmentReceived=0;this.lastReceived=0;this.lastSent=0;this.remoteAddress=null;this.reliableMessage=new Ve(w.MAX_RELIABLE_BUFFER);let e=Date.now();this.lastReceived=e,this.lastSent=e,this.qport=Math.floor(Math.random()*65536)}setup(e,n=null){this.qport=e,this.remoteAddress=n,this.reset()}reset(){this.incomingSequence=0,this.outgoingSequence=0,this.incomingAcknowledged=0,this.incomingReliableAcknowledged=!1,this.incomingReliableSequence=0,this.outgoingReliableSequence=0,this.reliableLength=0,this.reliableMessage.reset(),this.fragmentSendOffset=0,this.fragmentBuffer=null,this.fragmentLength=0,this.fragmentReceived=0,this.lastReceived=Date.now(),this.lastSent=Date.now()}transmit(e){this.outgoingSequence++,this.lastSent=Date.now();let n=0,o=!1,i=0;this.reliableLength>0&&(this.reliableLength>w.FRAGMENT_SIZE?(o=!0,this.fragmentSendOffset>=this.reliableLength&&(this.fragmentSendOffset=0),n=this.reliableLength-this.fragmentSendOffset,n>w.FRAGMENT_SIZE&&(n=w.FRAGMENT_SIZE),i=this.fragmentSendOffset,this.fragmentSendOffset+=n):n=this.reliableLength);let r=w.PACKET_HEADER,s=n>0?2+(o?8:0):0,l=e?e.length:0;r+s+n+l>w.MAX_MSGLEN&&(l=w.MAX_MSGLEN-r-s-n,l<0&&(l=0));let c=new ArrayBuffer(r+s+n+l),f=new DataView(c),u=new Uint8Array(c),a=this.outgoingSequence;n>0&&(a|=2147483648,(this.outgoingReliableSequence&1)!==0&&(a|=1073741824)),f.setUint32(0,a,!0);let m=this.incomingSequence;(this.incomingReliableSequence&1)!==0&&(m|=2147483648),f.setUint32(4,m,!0),f.setUint16(8,this.qport,!0);let h=r;if(n>0){let d=n;o&&(d|=32768),f.setUint16(h,d,!0),h+=2,o&&(f.setUint32(h,i,!0),h+=4,f.setUint32(h,this.reliableLength,!0),h+=4);let _=this.reliableMessage.getBuffer().subarray(i,i+n);u.set(_,h),h+=n}if(e&&l>0){let d=e.slice(0,l);u.set(d,h)}return u}process(e){if(e.length<w.PACKET_HEADER)return null;this.lastReceived=Date.now();let n=new DataView(e.buffer,e.byteOffset,e.byteLength),o=n.getUint32(0,!0),i=n.getUint32(4,!0),r=n.getUint16(8,!0);if(this.qport!==r)return null;let s=o&1073741823;if((s-this.incomingSequence|0)<=0)return null;this.incomingSequence=s;let l=i&2147483647,c=(i&2147483648)!==0;if(l>this.incomingAcknowledged&&(this.incomingAcknowledged=l),this.reliableLength>0){let d=c?1:0,S=this.outgoingReliableSequence&1;d!==S&&(this.reliableLength=0,this.reliableMessage.reset(),this.outgoingReliableSequence^=1,this.fragmentSendOffset=0)}let f=(o&2147483648)!==0,u=(o&1073741824)!==0?1:0,a=w.PACKET_HEADER,m=null;if(f){if(a+2>e.byteLength)return null;let d=n.getUint16(a,!0);a+=2;let S=(d&32768)!==0;d&=32767;let _=this.incomingReliableSequence&1;if(u===_)if(S){if(a+8>e.byteLength)return null;let A=n.getUint32(a,!0);a+=4;let M=n.getUint32(a,!0);if(a+=4,M>w.MAX_RELIABLE_BUFFER)return console.warn(`NetChan: received invalid fragment total ${M} > ${w.MAX_RELIABLE_BUFFER}`),null;if((!this.fragmentBuffer||this.fragmentBuffer.length!==M)&&(this.fragmentBuffer=new Uint8Array(M),this.fragmentLength=M,this.fragmentReceived=0),a+d>e.byteLength)return null;let v=e.subarray(a,a+d);A===this.fragmentReceived&&A+d<=M&&(this.fragmentBuffer.set(v,A),this.fragmentReceived+=d,this.fragmentReceived>=M&&(m=this.fragmentBuffer,this.incomingReliableSequence++,this.fragmentBuffer=null,this.fragmentLength=0,this.fragmentReceived=0))}else{if(this.incomingReliableSequence++,a+d>e.byteLength)return null;m=e.slice(a,a+d)}a+=d}let h=e.slice(a);if(m&&m.length>0){let d=m.length+h.length,S=new Uint8Array(d);return S.set(m,0),S.set(h,m.length),S}return h||new Uint8Array(0)}canSendReliable(){return this.reliableLength===0}writeReliableByte(e){if(this.reliableLength+1>w.MAX_RELIABLE_BUFFER)throw new Error("NetChan reliable buffer overflow");this.reliableMessage.writeByte(e),this.reliableLength++}writeReliableShort(e){if(this.reliableLength+2>w.MAX_RELIABLE_BUFFER)throw new Error("NetChan reliable buffer overflow");this.reliableMessage.writeShort(e),this.reliableLength+=2}writeReliableLong(e){if(this.reliableLength+4>w.MAX_RELIABLE_BUFFER)throw new Error("NetChan reliable buffer overflow");this.reliableMessage.writeLong(e),this.reliableLength+=4}writeReliableString(e){let n=e.length+1;if(this.reliableLength+n>w.MAX_RELIABLE_BUFFER)throw new Error("NetChan reliable buffer overflow");this.reliableMessage.writeString(e),this.reliableLength+=n}getReliableData(){return this.reliableLength===0?new Uint8Array(0):this.reliableMessage.getBuffer().subarray(0,this.reliableLength)}needsKeepalive(e){return e-this.lastSent>1e3}isTimedOut(e,n=3e4){return e-this.lastReceived>n}};w.MAX_MSGLEN=1400,w.FRAGMENT_SIZE=1024,w.PACKET_HEADER=10,w.HEADER_OVERHEAD=w.PACKET_HEADER+2,w.MAX_RELIABLE_BUFFER=262144;var pn=w;var Qe=(p=>(p.Blaster="blaster",p.Shotgun="shotgun",p.SuperShotgun="supershotgun",p.Machinegun="machinegun",p.Chaingun="chaingun",p.HandGrenade="grenades",p.GrenadeLauncher="grenadelauncher",p.RocketLauncher="rocketlauncher",p.HyperBlaster="hyperblaster",p.Railgun="railgun",p.BFG10K="bfg10k",p.Grapple="grapple",p.ChainFist="chainfist",p.EtfRifle="etf_rifle",p.ProxLauncher="prox_launcher",p.IonRipper="ionripper",p.PlasmaBeam="plasmabeam",p.Phalanx="phalanx",p.Disruptor="disruptor",p.Trap="trap",p))(Qe||{});var et=(d=>(d[d.Bullets=0]="Bullets",d[d.Shells=1]="Shells",d[d.Rockets=2]="Rockets",d[d.Grenades=3]="Grenades",d[d.Cells=4]="Cells",d[d.Slugs=5]="Slugs",d[d.MagSlugs=6]="MagSlugs",d[d.Trap=7]="Trap",d[d.Flechettes=8]="Flechettes",d[d.Tesla=9]="Tesla",d[d.Disruptor=10]="Disruptor",d[d.Prox=11]="Prox",d[d.Nuke=12]="Nuke",d[d.Rounds=13]="Rounds",d))(et||{}),Ga=Object.keys(et).length/2,tt=(m=>(m.Shells="ammo_shells",m.Bullets="ammo_bullets",m.Rockets="ammo_rockets",m.Grenades="ammo_grenades",m.Cells="ammo_cells",m.Slugs="ammo_slugs",m.MagSlugs="ammo_magslug",m.Flechettes="ammo_flechettes",m.Disruptor="ammo_disruptor",m.Tesla="ammo_tesla",m.Trap="ammo_trap",m.Prox="ammo_prox",m))(tt||{});var ka=["blaster","shotgun","supershotgun","machinegun","chaingun","grenadelauncher","rocketlauncher","grenades","hyperblaster","railgun","bfg10k"],hn={blaster:null,shotgun:1,supershotgun:1,machinegun:0,chaingun:0,grenades:3,grenadelauncher:3,rocketlauncher:2,hyperblaster:4,railgun:5,bfg10k:4,grapple:null,chainfist:null,etf_rifle:8,prox_launcher:11,ionripper:4,plasmabeam:4,phalanx:6,disruptor:10,trap:7};var B0=32,Oo=(a=>(a[a.Auto=0]="Auto",a[a.Weapon=1]="Weapon",a[a.Voice=2]="Voice",a[a.Item=3]="Item",a[a.Body=4]="Body",a[a.Aux=5]="Aux",a[a.Footstep=6]="Footstep",a[a.Aux3=7]="Aux3",a[a.NoPhsAdd=8]="NoPhsAdd",a[a.Reliable=16]="Reliable",a[a.ForcePos=32]="ForcePos",a))(Oo||{}),U0=-1,G0=0,k0=1,W0=2,H0=3,K0=80,X0=.003;function Po(t){return t*.001}function Wa(t){let e=Po(t);return e<=0?Number.POSITIVE_INFINITY:80+1/e}var Fo={ammo_shells:1,ammo_bullets:0,ammo_rockets:2,ammo_grenades:3,ammo_cells:4,ammo_slugs:5,ammo_magslug:6,ammo_flechettes:8,ammo_disruptor:10,ammo_tesla:9,ammo_trap:7,ammo_prox:11};function Ha(t,e){let n;if(Object.values(tt).includes(e))n=Fo[e];else if(Object.values(Qe).includes(e)&&(n=hn[e],n===null))return-1;return n==null?0:Lt(t.stats,n)}function Ka(t,e,n){let o=e.stats[t];if(o===void 0||o<=0)return;let i=K.Images+o;if(!(i<0||i>=n.length))return n[i]}var Xa=(t,e,n,o,i)=>t.x+e.x>o.x&&t.x+n.x<i.x&&t.y+e.y>o.y&&t.y+n.y<i.y&&t.z+e.z>o.z&&t.z+n.z<i.z,Za=(t,e,n,o)=>{let i=n??{x:-16,y:-16,z:-24},r=o??{x:16,y:16,z:32},s=8,l=0,c=Math.abs(e.z-t.z)<1,f=e.z<t.z,u=e.z+i.z,a=t.z+i.z,m=e.x+r.x;if(c&&e.z<s&&m>l&&t.x+r.x<=l)return{allsolid:!1,startsolid:!1,fraction:0,endpos:t,planeNormal:{x:-1,y:0,z:0},contents:1};if(f&&e.x>=l){let h=s-i.z;if(a>s&&u<s){let d=(s-a)/(u-a),S=Math.max(0,Math.min(1,d)),_=t.x+S*(e.x-t.x),A=t.y+S*(e.y-t.y),M=t.z+S*(e.z-t.z);return{allsolid:!1,startsolid:!1,fraction:S,endpos:{x:_,y:A,z:M},planeNormal:{x:0,y:0,z:1},contents:1}}}if(f&&u<0){let h=-i.z;if(a>=0){let d=(0-a)/(u-a),S=Math.max(0,Math.min(1,d)),_=t.x+S*(e.x-t.x),A=t.y+S*(e.y-t.y),M=t.z+S*(e.z-t.z);return{allsolid:!1,startsolid:!1,fraction:S,endpos:{x:_,y:A,z:M},planeNormal:{x:0,y:0,z:1},contents:1}}return{allsolid:!1,startsolid:!1,fraction:0,endpos:t,planeNormal:{x:0,y:0,z:1},contents:1}}return{allsolid:!1,startsolid:!1,fraction:1,endpos:e,contents:0}},Ya=(t,e,n,o)=>{let i=n??{x:-16,y:-16,z:-24},r=o??{x:16,y:16,z:32},s=0,m=e.x+i.x<8&&e.x+r.x>s&&e.y+i.y<16&&e.y+r.y>-16&&e.z+i.z<100&&e.z+r.z>0;return t.x<s&&e.x>=s&&Math.abs(e.z-t.z)<.1?{allsolid:!1,startsolid:!1,fraction:0,endpos:t,planeNormal:{x:-1,y:0,z:0},contents:536870912}:m?{allsolid:!1,startsolid:!1,fraction:1,endpos:e,contents:536870912}:e.z+i.z<=0?{allsolid:!1,startsolid:!1,fraction:0,endpos:t,planeNormal:{x:0,y:0,z:1},contents:1}:{allsolid:!1,startsolid:!1,fraction:1,endpos:e,contents:0}};return Io(Ja);})();
|
|
1
|
+
"use strict";var Quake2Shared=(()=>{var nt=Object.defineProperty;var Lo=Object.getOwnPropertyDescriptor;var wo=Object.getOwnPropertyNames;var zo=Object.prototype.hasOwnProperty;var yn=(t,e)=>{for(var n in e)nt(t,n,{get:e[n],enumerable:!0})},Do=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of wo(e))!zo.call(t,i)&&i!==n&&nt(t,i,{get:()=>e[i],enumerable:!(o=Lo(e,i))||o.enumerable});return t};var Io=t=>Do(nt({},"__esModule",{value:!0}),t);var Ja={};yn(Ja,{AMMO_ITEM_MAP:()=>Fo,AMMO_MAX:()=>Ye,AMMO_TYPE_COUNT:()=>Ga,ANORMS:()=>j,ATTN_IDLE:()=>k0,ATTN_LOOP_NONE:()=>U0,ATTN_NONE:()=>G0,ATTN_NORM:()=>W0,ATTN_STATIC:()=>H0,AmmoItemId:()=>tt,AmmoType:()=>et,BinaryStream:()=>mn,BinaryWriter:()=>Ve,CGAME_EXPORT_KEYS:()=>Ri,CGAME_IMPORT_KEYS:()=>Ci,CMD_BACKUP:()=>Zs,CONTENTS_AREAPORTAL:()=>dl,CONTENTS_AUX:()=>il,CONTENTS_CURRENT_0:()=>br,CONTENTS_CURRENT_180:()=>Sr,CONTENTS_CURRENT_270:()=>_r,CONTENTS_CURRENT_90:()=>gr,CONTENTS_CURRENT_DOWN:()=>Ar,CONTENTS_CURRENT_UP:()=>Tr,CONTENTS_DEADMONSTER:()=>hl,CONTENTS_DETAIL:()=>yl,CONTENTS_LADDER:()=>we,CONTENTS_LAVA:()=>sl,CONTENTS_MIST:()=>cl,CONTENTS_MONSTER:()=>pl,CONTENTS_MONSTERCLIP:()=>ml,CONTENTS_NONE:()=>Le,CONTENTS_NO_WATERJUMP:()=>yr,CONTENTS_ORIGIN:()=>xl,CONTENTS_PLAYER:()=>gl,CONTENTS_PLAYERCLIP:()=>fl,CONTENTS_PROJECTILE:()=>Sl,CONTENTS_PROJECTILECLIP:()=>ul,CONTENTS_SLIME:()=>al,CONTENTS_SOLID:()=>ol,CONTENTS_TRANSLUCENT:()=>bl,CONTENTS_TRIGGER:()=>hr,CONTENTS_WATER:()=>ll,CONTENTS_WINDOW:()=>rl,CS_AIRACCEL:()=>ui,CS_CDTRACK:()=>ii,CS_GENERAL:()=>gi,CS_IMAGES:()=>pi,CS_ITEMS:()=>yi,CS_LIGHTS:()=>hi,CS_MAPCHECKSUM:()=>fi,CS_MAXCLIENTS:()=>di,CS_MAX_STRING_LENGTH:()=>sc,CS_MAX_STRING_LENGTH_OLD:()=>ac,CS_MODELS:()=>mi,CS_NAME:()=>ri,CS_PLAYERS:()=>bi,CS_SKY:()=>si,CS_SKYAXIS:()=>ai,CS_SKYROTATE:()=>li,CS_SOUNDS:()=>xi,CS_STATUSBAR:()=>ci,ClientCommand:()=>to,CollisionEntityIndex:()=>lt,ConfigStringIndex:()=>K,CvarFlags:()=>Pn,DEFAULT_FORWARD_SPEED:()=>ws,DEFAULT_MOUSE_SENSITIVITY:()=>Us,DEFAULT_PITCH_SPEED:()=>Bs,DEFAULT_SIDE_SPEED:()=>zs,DEFAULT_UP_SPEED:()=>Ds,DEFAULT_YAW_SPEED:()=>Is,DEG2RAD:()=>nr,DIST_EPSILON:()=>q,EntityEffects:()=>co,EntityEvent:()=>uo,GAME_EXPORT_KEYS:()=>Vi,GAME_IMPORT_KEYS:()=>Ni,G_GetAmmoStat:()=>Lt,G_GetPowerupStat:()=>Oa,G_SetAmmoStat:()=>Ca,G_SetPowerupStat:()=>Ra,LAST_VISIBLE_CONTENTS:()=>_l,LayoutFlags:()=>oo,MASK_ALL:()=>zl,MASK_BLOCK_SIGHT:()=>Wl,MASK_CURRENT:()=>Mr,MASK_DEADSOLID:()=>Il,MASK_LADDER_NAV_SOLID:()=>Hl,MASK_MONSTERSOLID:()=>Bl,MASK_NAV_SOLID:()=>kl,MASK_OPAQUE:()=>Ul,MASK_PLAYERSOLID:()=>Dl,MASK_PROJECTILE:()=>Xl,MASK_SHOT:()=>Gl,MASK_SOLID:()=>it,MASK_WALK_NAV_SOLID:()=>Kl,MASK_WATER:()=>ie,MAX_CHALLENGES:()=>Hs,MAX_CLIENTS:()=>Yr,MAX_CONFIGSTRINGS:()=>ni,MAX_EDICTS:()=>ic,MAX_GENERAL:()=>ei,MAX_IMAGES:()=>$r,MAX_INFO_STRING:()=>Ys,MAX_ITEMS:()=>Qr,MAX_LIGHTSTYLES:()=>Jr,MAX_MODELS:()=>jr,MAX_MSGLEN:()=>Js,MAX_OSPATH:()=>rc,MAX_PACKET_ENTITIES:()=>Ks,MAX_QPATH:()=>oc,MAX_SHADOW_LIGHTS:()=>ti,MAX_SOUNDS:()=>qr,MAX_SOUND_CHANNELS:()=>B0,MAX_STRING_CHARS:()=>ec,MAX_STRING_TOKENS:()=>tc,MAX_TOKEN_CHARS:()=>nc,MAX_WHEEL_ITEMS:()=>mt,MZ_BFG:()=>la,MZ_BFG2:()=>ma,MZ_BLASTER:()=>js,MZ_BLASTER2:()=>ga,MZ_BLUEHYPERBLASTER:()=>da,MZ_CHAINGUN1:()=>Qs,MZ_CHAINGUN2:()=>ea,MZ_CHAINGUN3:()=>ta,MZ_ETF_RIFLE:()=>pa,MZ_ETF_RIFLE_2:()=>ya,MZ_GRENADE:()=>ra,MZ_HEATBEAM:()=>ba,MZ_HYPERBLASTER:()=>ca,MZ_IONRIPPER:()=>ua,MZ_LOGIN:()=>ia,MZ_LOGOUT:()=>sa,MZ_MACHINEGUN:()=>qs,MZ_NUKE1:()=>_a,MZ_NUKE2:()=>Ta,MZ_NUKE4:()=>Aa,MZ_NUKE8:()=>Ma,MZ_PHALANX:()=>fa,MZ_PHALANX2:()=>xa,MZ_PROX:()=>ha,MZ_RAILGUN:()=>na,MZ_ROCKET:()=>oa,MZ_SHOTGUN:()=>$s,MZ_SSHOTGUN:()=>aa,MZ_TRACKER:()=>Sa,MersenneTwister19937:()=>Fe,NUM_AMMO_STATS:()=>Na,NUM_BITS_FOR_AMMO:()=>Je,NUM_BITS_FOR_POWERUP:()=>qe,NUM_POWERUP_STATS:()=>Va,NetChan:()=>pn,NetworkMessageBuilder:()=>xn,PITCH:()=>Oe,POWERUP_MAX:()=>je,PlaneSide:()=>Mn,PlayerButton:()=>le,PlayerStat:()=>so,PmFlag:()=>$,PmType:()=>ae,PowerupId:()=>io,RAD2DEG:()=>or,ROLL:()=>rt,RandomGenerator:()=>Ee,RenderFx:()=>lo,Replay:()=>xt,SLIDEMOVE_BLOCKED_FLOOR:()=>Bn,SLIDEMOVE_BLOCKED_WALL:()=>Un,SOUND_FULLVOLUME:()=>K0,SOUND_LOOP_ATTENUATE:()=>X0,STOP_EPSILON:()=>ee,SURF_ALPHATEST:()=>Pl,SURF_FLOWING:()=>Rl,SURF_LIGHT:()=>Al,SURF_N64_SCROLL_FLIP:()=>wl,SURF_N64_SCROLL_X:()=>El,SURF_N64_SCROLL_Y:()=>Ll,SURF_N64_UV:()=>Fl,SURF_NODRAW:()=>Ol,SURF_NONE:()=>Tl,SURF_SKY:()=>vl,SURF_SLICK:()=>Ml,SURF_TRANS33:()=>Vl,SURF_TRANS66:()=>Cl,SURF_WARP:()=>Nl,ServerCommand:()=>eo,SoundChannel:()=>Oo,TempEntity:()=>no,UPDATE_BACKUP:()=>Xs,U_ALPHA:()=>Kt,U_ANGLE1:()=>Wt,U_ANGLE2:()=>Dt,U_ANGLE3:()=>It,U_EFFECTS16:()=>qt,U_EFFECTS8:()=>Xt,U_EVENT:()=>Ut,U_FRAME16:()=>Jt,U_FRAME8:()=>Bt,U_INSTANCE_BITS:()=>an,U_LOOP_ATTENUATION_HIGH:()=>un,U_LOOP_VOLUME:()=>ln,U_MODEL:()=>kt,U_MODEL2:()=>$t,U_MODEL3:()=>Qt,U_MODEL4:()=>en,U_MOREBITS1:()=>Me,U_MOREBITS2:()=>Zt,U_MOREBITS3:()=>tn,U_MOREBITS4:()=>cn,U_NUMBER16:()=>ve,U_OLDORIGIN:()=>mo,U_OLD_FRAME_HIGH:()=>fn,U_ORIGIN1:()=>wt,U_ORIGIN2:()=>zt,U_ORIGIN3:()=>Gt,U_OWNER_HIGH:()=>dn,U_REMOVE:()=>fo,U_RENDERFX16:()=>jt,U_RENDERFX8:()=>Ht,U_SCALE:()=>sn,U_SKIN16:()=>nn,U_SKIN8:()=>Yt,U_SOLID:()=>rn,U_SOUND:()=>on,WEAPON_AMMO_MAP:()=>hn,WEAPON_WHEEL_ORDER:()=>Wa,WaterLevel:()=>fe,WeaponId:()=>Qe,YAW:()=>Pe,ZERO_VEC3:()=>E,addBlendColor:()=>ar,addContents:()=>Vr,addPmFlag:()=>G,addPointToBounds:()=>Yo,addVec3:()=>O,addViewAngles:()=>Ws,angleMod:()=>he,angleVectors:()=>re,applyPmove:()=>Ua,applyPmoveAccelerate:()=>J,applyPmoveAddCurrents:()=>ge,applyPmoveAirAccelerate:()=>At,applyPmoveAirMove:()=>St,applyPmoveFlyMove:()=>ys,applyPmoveFriction:()=>Ke,applyPmoveWalkMove:()=>Tt,applyPmoveWaterMove:()=>_t,assertContract:()=>vi,attenuationToDistanceMultiplier:()=>Po,boxContents:()=>Gr,boxOnPlaneSide:()=>zr,boxesIntersect:()=>Jo,buildAirGroundWish:()=>vt,buildCollisionModel:()=>Lr,buildWaterWish:()=>Nt,calculateMaxAudibleDistance:()=>ka,categorizePosition:()=>We,checkDuckState:()=>Mt,checkJump:()=>ht,checkSpecialMovement:()=>Cs,clampViewAngles:()=>Ls,clipBoxToBrush:()=>ut,clipVelocityAgainstPlanes:()=>jo,clipVelocityVec3:()=>oe,closestPointToBox:()=>Ko,combineSurfaceFlags:()=>Or,computePlaneSignBits:()=>ct,computePlayerDimensions:()=>He,concatRotationMatrices:()=>ot,configStringSize:()=>oi,copyVec3:()=>Uo,crc8:()=>Ea,createDefaultTrace:()=>Ie,createEmptyBounds3:()=>Zo,createMat4Identity:()=>Tn,createRandomGenerator:()=>lr,crossVec3:()=>ne,currentVectorFromContents:()=>bt,degToRad:()=>Ce,disableTraceDebug:()=>Fr,distance:()=>ko,distanceBetweenBoxesSquared:()=>Xo,dotVec3:()=>B,enableTraceDebug:()=>Pr,fixStuckObjectGeneric:()=>Ct,getAmmoCount:()=>Ha,getIconPath:()=>Ka,getWaterLevel:()=>_e,goodPosition:()=>Ot,groundCurrentVelocity:()=>Dn,hasAllContents:()=>vr,hasAnyContents:()=>Nr,hasPmFlag:()=>I,hasSurfaceFlags:()=>Rr,inPHS:()=>kr,inPVS:()=>Wr,initialSnapPosition:()=>Ps,intersects:()=>Xa,isAtLeastWaistDeep:()=>pt,isUnderwater:()=>Oi,ladderTrace:()=>Ya,lengthSquaredVec3:()=>ue,lengthVec3:()=>U,lerpAngle:()=>rr,mat4FromBasis:()=>mr,mat4Identity:()=>cr,mat4Ortho:()=>dr,mat4Perspective:()=>pr,mat4Translate:()=>xr,mouseDeltaToViewDelta:()=>ks,multiplyMat4:()=>ur,multiplyVec3:()=>Go,negateVec3:()=>Wo,normalizeVec3:()=>L,perpendicularVec3:()=>gn,planeDistanceToPoint:()=>se,pmoveCmdScale:()=>cs,pointContents:()=>Br,pointContentsMany:()=>Ur,pointInsideBrush:()=>vn,pointOnPlaneSide:()=>wr,projectPointOnPlane:()=>bn,projectSourceVec3:()=>$o,projectSourceVec3WithUp:()=>Qo,radToDeg:()=>Re,removeContents:()=>Cr,removePmFlag:()=>Z,resolveSlideMove:()=>Gn,rotatePointAroundVector:()=>tr,runPmove:()=>us,scaleVec3:()=>P,slerpVec3:()=>er,slideClipVelocityVec3:()=>qo,slideMove:()=>gt,snapPosition:()=>Os,stairTrace:()=>Za,stepSlideMove:()=>ce,subtractVec3:()=>te,testBoxInBrush:()=>Nn,traceBox:()=>On,traceDebugInfo:()=>Y,transformPointMat4:()=>fr,validateContract:()=>Fn,vec3Equals:()=>Ho,vectorToAngles:()=>sr,vectorToYaw:()=>ir,waterCurrentVelocity:()=>zn,writeDeltaEntity:()=>za,writePlayerState:()=>Da,writeRemoveEntity:()=>wa,writeUserCommand:()=>Pa});var E={x:0,y:0,z:0},ee=.1,Bo=Math.PI/180;function Uo(t){return{x:t.x,y:t.y,z:t.z}}function O(t,e){return{x:t.x+e.x,y:t.y+e.y,z:t.z+e.z}}function te(t,e){return{x:t.x-e.x,y:t.y-e.y,z:t.z-e.z}}function Go(t,e){return{x:t.x*e.x,y:t.y*e.y,z:t.z*e.z}}function P(t,e){return{x:t.x*e,y:t.y*e,z:t.z*e}}function Wo(t){return P(t,-1)}function B(t,e){return t.x*e.x+t.y*e.y+t.z*e.z}function ne(t,e){return{x:t.y*e.z-t.z*e.y,y:t.z*e.x-t.x*e.z,z:t.x*e.y-t.y*e.x}}function ue(t){return B(t,t)}function U(t){return Math.sqrt(ue(t))}function ko(t,e){return U(te(t,e))}function Ho(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z}function L(t){let e=U(t);return e===0?t:P(t,1/e)}function bn(t,e){let n=1/B(e,e),o=B(e,t)*n;return te(t,P(e,n*o))}function gn(t){let e=0,n=Math.abs(t.x);return Math.abs(t.y)<n&&(e=1,n=Math.abs(t.y)),Math.abs(t.z)<n&&(e=2),L(bn(e===0?{x:1,y:0,z:0}:e===1?{x:0,y:1,z:0}:{x:0,y:0,z:1},t))}function Ko(t,e,n){return{x:t.x<e.x?e.x:t.x>n.x?n.x:t.x,y:t.y<e.y?e.y:t.y>n.y?n.y:t.y,z:t.z<e.z?e.z:t.z>n.z?n.z:t.z}}function Xo(t,e,n,o){let i=0;if(e.x<n.x){let r=e.x-n.x;i+=r*r}else if(t.x>o.x){let r=t.x-o.x;i+=r*r}if(e.y<n.y){let r=e.y-n.y;i+=r*r}else if(t.y>o.y){let r=t.y-o.y;i+=r*r}if(e.z<n.z){let r=e.z-n.z;i+=r*r}else if(t.z>o.z){let r=t.z-o.z;i+=r*r}return i}function Zo(){return{mins:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,z:Number.POSITIVE_INFINITY},maxs:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY,z:Number.NEGATIVE_INFINITY}}}function Yo(t,e){return{mins:{x:Math.min(e.mins.x,t.x),y:Math.min(e.mins.y,t.y),z:Math.min(e.mins.z,t.z)},maxs:{x:Math.max(e.maxs.x,t.x),y:Math.max(e.maxs.y,t.y),z:Math.max(e.maxs.z,t.z)}}}function Jo(t,e){return t.mins.x<=e.maxs.x&&t.maxs.x>=e.mins.x&&t.mins.y<=e.maxs.y&&t.maxs.y>=e.mins.y&&t.mins.z<=e.maxs.z&&t.maxs.z>=e.mins.z}function oe(t,e,n){let o=B(t,e)*n,i=t.x-e.x*o,r=t.y-e.y*o,s=t.z-e.z*o;return i>-ee&&i<ee&&(i=0),r>-ee&&r<ee&&(r=0),s>-ee&&s<ee&&(s=0),{x:i,y:r,z:s}}function jo(t,e,n,o){if(e.length===0)return t;let i=t;for(let r=0;r<e.length;r++){i=oe(i,e[r],n);let s=0;for(;s<e.length&&!(s!==r&&B(i,e[s])<0);s++);if(s===e.length)return o&&B(i,o)<=0?E:i}if(e.length===2){let r=ne(e[0],e[1]),s=B(r,t),l=P(r,s);return o&&B(l,o)<=0?E:l}return o&&B(i,o)<=0,E}function qo(t,e,n){return oe(t,e,n)}function $o(t,e,n,o){return{x:t.x+n.x*e.x+o.x*e.y,y:t.y+n.y*e.x+o.y*e.y,z:t.z+n.z*e.x+o.z*e.y+e.z}}function Qo(t,e,n,o,i){return{x:t.x+n.x*e.x+o.x*e.y+i.x*e.z,y:t.y+n.y*e.x+o.y*e.y+i.y*e.z,z:t.z+n.z*e.x+o.z*e.y+i.z*e.z}}function er(t,e,n){let o=B(t,e),i,r;if(Math.abs(o)>.9995)i=1-n,r=n;else{let s=Math.acos(o),l=Math.sin(s),c=Math.sin((1-n)*s),f=Math.sin(n*s);i=c/l,r=f/l}return{x:t.x*i+e.x*r,y:t.y*i+e.y*r,z:t.z*i+e.z*r}}function ot(t,e){let n=i=>[t[i][0]*e[0][0]+t[i][1]*e[1][0]+t[i][2]*e[2][0],t[i][0]*e[0][1]+t[i][1]*e[1][1]+t[i][2]*e[2][1],t[i][0]*e[0][2]+t[i][1]*e[1][2]+t[i][2]*e[2][2]];return[n(0),n(1),n(2)]}function tr(t,e,n){if(U(t)===0)return e;let i=L(t),r=gn(i),s=ne(r,i),l=[[r.x,s.x,i.x],[r.y,s.y,i.y],[r.z,s.z,i.z]],c=[[l[0][0],l[1][0],l[2][0]],[l[0][1],l[1][1],l[2][1]],[l[0][2],l[1][2],l[2][2]]],f=n*Bo,u=Math.cos(f),a=Math.sin(f),m=[[u,a,0],[-a,u,0],[0,0,1]],h=ot(ot(l,m),c);return{x:h[0][0]*e.x+h[0][1]*e.y+h[0][2]*e.z,y:h[1][0]*e.x+h[1][1]*e.y+h[1][2]*e.z,z:h[2][0]*e.x+h[2][1]*e.y+h[2][2]*e.z}}var Oe=0,Pe=1,rt=2,Sn=Math.PI/180,_n=180/Math.PI,nr=Sn,or=_n;function pe(t,e){switch(e){case Oe:return t.x;case Pe:return t.y;case rt:default:return t.z}}function Ce(t){return t*Sn}function Re(t){return t*_n}function rr(t,e,n){let o=e;return o-t>180?o-=360:o-t<-180&&(o+=360),t+n*(o-t)}function he(t){let e=t%360;return e<0?360+e:e}function re(t){let e=Ce(pe(t,Pe)),n=Ce(pe(t,Oe)),o=Ce(pe(t,rt)),i=Math.sin(e),r=Math.cos(e),s=Math.sin(n),l=Math.cos(n),c=Math.sin(o),f=Math.cos(o),u={x:l*r,y:l*i,z:-s},a={x:-c*s*r-f*-i,y:-c*s*i-f*r,z:-c*l},m={x:f*s*r-c*-i,y:f*s*i-c*r,z:f*l};return{forward:u,right:a,up:m}}function ir(t){let e=pe(t,Oe),n=pe(t,Pe);if(e===0)return n===0?0:n>0?90:270;let o=Re(Math.atan2(n,e));return o<0?o+360:o}function sr(t){let e=t.x,n=t.y,o=t.z;if(n===0&&e===0)return{x:o>0?-90:-270,y:0,z:0};let i;e?i=Re(Math.atan2(n,e)):n>0?i=90:i=270,i<0&&(i+=360);let r=Math.sqrt(e*e+n*n),s=Re(Math.atan2(o,r));return s<0&&(s+=360),{x:-s,y:i,z:0}}var j=[[-.525731,0,.850651],[-.442863,.238856,.864188],[-.295242,0,.955423],[-.309017,.5,.809017],[-.16246,.262866,.951056],[0,0,1],[0,.850651,.525731],[-.147621,.716567,.681718],[.147621,.716567,.681718],[0,.525731,.850651],[.309017,.5,.809017],[.525731,0,.850651],[.295242,0,.955423],[.442863,.238856,.864188],[.16246,.262866,.951056],[-.681718,.147621,.716567],[-.809017,.309017,.5],[-.587785,.425325,.688191],[-.850651,.525731,0],[-.864188,.442863,.238856],[-.716567,.681718,.147621],[-.688191,.587785,.425325],[-.5,.809017,.309017],[-.238856,.864188,.442863],[-.425325,.688191,.587785],[-.716567,.681718,-.147621],[-.5,.809017,-.309017],[-.525731,.850651,0],[0,.850651,-.525731],[-.238856,.864188,-.442863],[0,.955423,-.295242],[-.262866,.951056,-.16246],[0,1,0],[0,.955423,.295242],[-.262866,.951056,.16246],[.238856,.864188,.442863],[.262866,.951056,.16246],[.5,.809017,.309017],[.238856,.864188,-.442863],[.262866,.951056,-.16246],[.5,.809017,-.309017],[.850651,.525731,0],[.716567,.681718,.147621],[.716567,.681718,-.147621],[.525731,.850651,0],[.425325,.688191,.587785],[.864188,.442863,.238856],[.688191,.587785,.425325],[.809017,.309017,.5],[.681718,.147621,.716567],[.587785,.425325,.688191],[.955423,.295242,0],[1,0,0],[.951056,.16246,.262866],[.850651,-.525731,0],[.955423,-.295242,0],[.864188,-.442863,.238856],[.951056,-.16246,.262866],[.809017,-.309017,.5],[.681718,-.147621,.716567],[.850651,0,.525731],[.864188,.442863,-.238856],[.809017,.309017,-.5],[.951056,.16246,-.262866],[.525731,0,-.850651],[.681718,.147621,-.716567],[.681718,-.147621,-.716567],[.850651,0,-.525731],[.809017,-.309017,-.5],[.864188,-.442863,-.238856],[.951056,-.16246,-.262866],[.147621,.716567,-.681718],[.309017,.5,-.809017],[.425325,.688191,-.587785],[.442863,.238856,-.864188],[.587785,.425325,-.688191],[.688191,.587785,-.425325],[-.147621,.716567,-.681718],[-.309017,.5,-.809017],[0,.525731,-.850651],[-.525731,0,-.850651],[-.442863,.238856,-.864188],[-.295242,0,-.955423],[-.16246,.262866,-.951056],[0,0,-1],[.295242,0,-.955423],[.16246,.262866,-.951056],[-.442863,-.238856,-.864188],[-.309017,-.5,-.809017],[-.16246,-.262866,-.951056],[0,-.850651,-.525731],[-.147621,-.716567,-.681718],[.147621,-.716567,-.681718],[0,-.525731,-.850651],[.309017,-.5,-.809017],[.442863,-.238856,-.864188],[.16246,-.262866,-.951056],[.238856,-.864188,-.442863],[.5,-.809017,-.309017],[.425325,-.688191,-.587785],[.716567,-.681718,-.147621],[.688191,-.587785,-.425325],[.587785,-.425325,-.688191],[0,-.955423,-.295242],[0,-1,0],[.262866,-.951056,-.16246],[0,-.850651,.525731],[0,-.955423,.295242],[.238856,-.864188,.442863],[.262866,-.951056,.16246],[.5,-.809017,.309017],[.716567,-.681718,.147621],[.525731,-.850651,0],[-.238856,-.864188,-.442863],[-.5,-.809017,-.309017],[-.262866,-.951056,-.16246],[-.850651,-.525731,0],[-.716567,-.681718,-.147621],[-.716567,-.681718,.147621],[-.525731,-.850651,0],[-.5,-.809017,.309017],[-.238856,-.864188,.442863],[-.262866,-.951056,.16246],[-.864188,-.442863,.238856],[-.809017,-.309017,.5],[-.688191,-.587785,.425325],[-.681718,-.147621,.716567],[-.442863,-.238856,.864188],[-.587785,-.425325,.688191],[-.309017,-.5,.809017],[-.147621,-.716567,.681718],[-.425325,-.688191,.587785],[-.16246,-.262866,.951056],[.442863,-.238856,.864188],[.16246,-.262866,.951056],[.309017,-.5,.809017],[.147621,-.716567,.681718],[0,-.525731,.850651],[.425325,-.688191,.587785],[.587785,-.425325,.688191],[.688191,-.587785,.425325],[-.955423,.295242,0],[-.951056,.16246,.262866],[-1,0,0],[-.850651,0,.525731],[-.955423,-.295242,0],[-.951056,-.16246,.262866],[-.864188,.442863,-.238856],[-.951056,.16246,-.262866],[-.809017,.309017,-.5],[-.864188,-.442863,-.238856],[-.951056,-.16246,-.262866],[-.809017,-.309017,-.5],[-.681718,.147621,-.716567],[-.681718,-.147621,-.716567],[-.850651,0,-.525731],[-.688191,.587785,-.425325],[-.587785,.425325,-.688191],[-.425325,.688191,-.587785],[-.425325,-.688191,-.587785],[-.587785,-.425325,-.688191],[-.688191,-.587785,-.425325]];function ar(t,e,n,o,i){if(o<=0)return i;let r=i[0],s=i[1],l=i[2],c=i[3],f=c+(1-c)*o;if(f<=0)return[0,0,0,0];let u=c/f,a=r*u+t*(1-u),m=s*u+e*(1-u),h=l*u+n*(1-u);return[a,m,h,f]}var Fe=class{constructor(e=5489){this.state=new Uint32Array(624);this.index=624;this.seed(e)}seed(e){this.state[0]=e>>>0;for(let n=1;n<624;n++){let o=this.state[n-1]^this.state[n-1]>>>30,i=Math.imul(o>>>0,1812433253)+n;this.state[n]=i>>>0}this.index=624}nextUint32(){this.index>=624&&this.twist();let e=this.state[this.index++];return e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,e^=e>>>18,e>>>0}twist(){for(let e=0;e<624;e++){let n=this.state[e]&2147483648|this.state[(e+1)%624]&2147483647,o=this.state[(e+397)%624]^n>>>1;(n&1)!==0&&(o^=2567483615),this.state[e]=o>>>0}this.index=0}getState(){return{index:this.index,state:Array.from(this.state)}}setState(e){if(e.state.length!==624)throw new Error(`Expected 624 MT state values, received ${e.state.length}`);this.index=e.index,this.state=Uint32Array.from(e.state,n=>n>>>0)}},Ee=class{constructor(e={}){this.mt=new Fe(e.seed)}seed(e){this.mt.seed(e)}frandom(){return this.mt.nextUint32()/4294967296}frandomRange(e,n){return e+(n-e)*this.frandom()}frandomMax(e){return this.frandomRange(0,e)}crandom(){return this.frandomRange(-1,1)}crandomOpen(){let e=Number.EPSILON;return this.frandomRange(-1+e,1)}irandomUint32(){return this.mt.nextUint32()}irandomRange(e,n){if(n-e<=1)return e;let o=n-e,i=4294967296-4294967296%o,r;do r=this.mt.nextUint32();while(r>=i);return e+r%o}irandom(e){return e<=0?0:this.irandomRange(0,e)}randomTimeRange(e,n){return n<=e?e:this.irandomRange(e,n)}randomTime(e){return this.irandom(e)}randomIndex(e){return this.irandom(e.length)}getState(){return{mt:this.mt.getState()}}setState(e){this.mt.setState(e.mt)}};function lr(t){return new Ee(t)}function Tn(){return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function cr(t=new Float32Array(16)){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ur(t,e){let n=new Float32Array(16);for(let o=0;o<4;o+=1)for(let i=0;i<4;i+=1)n[i*4+o]=t[0+o]*e[i*4+0]+t[4+o]*e[i*4+1]+t[8+o]*e[i*4+2]+t[12+o]*e[i*4+3];return n}function dr(t,e,n,o,i,r,s){let l=1/(e-n),c=1/(o-i),f=1/(r-s);return t[0]=-2*l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=f,t[11]=0,t[12]=(e+n)*l,t[13]=(i+o)*c,t[14]=r*f,t[15]=1,t}function fr(t,e){let n=e.x,o=e.y,i=e.z;return{x:t[0]*n+t[4]*o+t[8]*i+t[12],y:t[1]*n+t[5]*o+t[9]*i+t[13],z:t[2]*n+t[6]*o+t[10]*i+t[14]}}function mr(t,e){let n=Tn();return n[0]=e[0].x,n[1]=e[0].y,n[2]=e[0].z,n[4]=e[1].x,n[5]=e[1].y,n[6]=e[1].z,n[8]=e[2].x,n[9]=e[2].y,n[10]=e[2].z,n[12]=t.x,n[13]=t.y,n[14]=t.z,n}function xr(t,e){let n=e.x,o=e.y,i=e.z;return t[12]=t[0]*n+t[4]*o+t[8]*i+t[12],t[13]=t[1]*n+t[5]*o+t[9]*i+t[13],t[14]=t[2]*n+t[6]*o+t[10]*i+t[14],t[15]=t[3]*n+t[7]*o+t[11]*i+t[15],t}function pr(t,e,n,o,i){let r=1/Math.tan(e/2);if(t[0]=r/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[15]=0,i!=null&&i!==1/0){let s=1/(o-i);t[10]=(i+o)*s,t[14]=2*i*o*s}else t[10]=-1,t[14]=-2*o;return t}var Le=0,ol=1,rl=2,il=4,sl=8,al=16,ll=32,cl=64,hr=1073741824,yr=8192,ul=16384,dl=32768,fl=65536,ml=131072,br=262144,gr=524288,Sr=1048576,_r=2097152,Tr=4194304,Ar=8388608,xl=16777216,pl=33554432,hl=67108864,yl=134217728,bl=268435456,we=536870912,gl=1073741824,Sl=-2147483648,_l=64,Tl=0,Al=1,Ml=2,vl=4,Nl=8,Vl=16,Cl=32,Rl=64,Ol=128,Pl=33554432,Fl=268435456,El=536870912,Ll=1073741824,wl=-2147483648,zl=4294967295,it=3,Dl=1107361795,Il=65539,Bl=1107427331,ie=56,Ul=25,Gl=1174405123,Mr=16515072,Wl=1107296281,kl=65539,Hl=3,Kl=196611,Xl=1174421507;function vr(t,e){return(t&e)===e}function Nr(t,e){return(t&e)!==0}function Vr(t,e){return t|e}function Cr(t,e){return t&~e}function Rr(t,e){return(t&e)===e}function Or(...t){let e=0;for(let n of t)e|=n;return e}function ze(t=0,e={x:-8192,y:-8192,z:-8192},n={x:8192,y:8192,z:8192}){if(t>=4)return{axis:-1,dist:0,children:null,items:new Set};let o=t%2,i=.5*(o===0?e.x+n.x:e.y+n.y),r={...e},s={...n},l={...e},c={...n};o===0?(s.x=i,l.x=i):(s.y=i,l.y=i);let f=ze(t+1,r,s),u=ze(t+1,l,c);return{axis:o,dist:i,children:[f,u],items:new Set}}function An(t,e,n,o){let i=t;for(;i.axis!==-1&&i.children;){let r=i.axis,s=i.dist,l=r===0?n.x:n.y,c=r===0?o.x:o.y;if(l>s)i=i.children[1];else if(c<s)i=i.children[0];else break}return i.items.add(e),i}function ye(t,e,n,o){for(let c of t.items)o.add(c);if(t.axis===-1||!t.children)return;let i=t.axis,r=t.dist,s=i===0?e.x:e.y;(i===0?n.x:n.y)>r&&ye(t.children[1],e,n,o),s<r&&ye(t.children[0],e,n,o)}var Mn=(o=>(o[o.FRONT=1]="FRONT",o[o.BACK=2]="BACK",o[o.CROSS=3]="CROSS",o))(Mn||{}),Y=null;function Pr(){Y={nodesTraversed:0,leafsReached:0,brushesTested:0}}function Fr(){Y=null}var q=.03125,Er=Number.MAX_SAFE_INTEGER-1,De=1;function Lr(t){let e=t.planes.map(s=>({...s,signbits:ct(s.normal)})),n=t.nodes.map(s=>({plane:e[s.planenum],children:s.children})),o=t.brushes.map(s=>{let l=t.brushSides.slice(s.firstSide,s.firstSide+s.numSides).map(c=>({plane:e[c.planenum],surfaceFlags:c.surfaceFlags}));return{contents:s.contents,sides:l,checkcount:0}}),i=t.leaves.map(s=>({contents:s.contents,cluster:s.cluster,area:s.area,firstLeafBrush:s.firstLeafBrush,numLeafBrushes:s.numLeafBrushes})),r=t.bmodels.map(s=>({mins:s.mins,maxs:s.maxs,origin:s.origin,headnode:s.headnode}));return{planes:e,nodes:n,leaves:i,brushes:o,leafBrushes:t.leafBrushes,bmodels:r,visibility:t.visibility}}function ct(t){let e=0;return t.x<0&&(e|=1),t.y<0&&(e|=2),t.z<0&&(e|=4),e}function se(t,e){return t.normal.x*e.x+t.normal.y*e.y+t.normal.z*e.z-t.dist}function wr(t,e,n=0){let o=se(t,e);return o>n?1:o<-n?2:3}function zr(t,e,n,o=0){let i,r;switch(n.signbits){case 0:i=n.normal.x*e.x+n.normal.y*e.y+n.normal.z*e.z,r=n.normal.x*t.x+n.normal.y*t.y+n.normal.z*t.z;break;case 1:i=n.normal.x*t.x+n.normal.y*e.y+n.normal.z*e.z,r=n.normal.x*e.x+n.normal.y*t.y+n.normal.z*t.z;break;case 2:i=n.normal.x*e.x+n.normal.y*t.y+n.normal.z*e.z,r=n.normal.x*t.x+n.normal.y*e.y+n.normal.z*t.z;break;case 3:i=n.normal.x*t.x+n.normal.y*t.y+n.normal.z*e.z,r=n.normal.x*e.x+n.normal.y*e.y+n.normal.z*t.z;break;case 4:i=n.normal.x*e.x+n.normal.y*e.y+n.normal.z*t.z,r=n.normal.x*t.x+n.normal.y*t.y+n.normal.z*e.z;break;case 5:i=n.normal.x*t.x+n.normal.y*e.y+n.normal.z*t.z,r=n.normal.x*e.x+n.normal.y*t.y+n.normal.z*e.z;break;case 6:i=n.normal.x*e.x+n.normal.y*t.y+n.normal.z*t.z,r=n.normal.x*t.x+n.normal.y*e.y+n.normal.z*e.z;break;default:i=n.normal.x*t.x+n.normal.y*t.y+n.normal.z*t.z,r=n.normal.x*e.x+n.normal.y*e.y+n.normal.z*e.z;break}let s=0;return i-n.dist>=-o&&(s=1),r-n.dist<=o&&(s|=2),s}function vn(t,e,n=q){for(let o of e.sides)if(se(o.plane,t)>n)return!1;return!0}function Nn(t,e,n,o){for(let i of o.sides){let r=i.plane.normal.x*(i.plane.normal.x<0?n.x:e.x)+i.plane.normal.y*(i.plane.normal.y<0?n.y:e.y)+i.plane.normal.z*(i.plane.normal.z<0?n.z:e.z),s=i.plane.dist-r;if(t.x*i.plane.normal.x+t.y*i.plane.normal.y+t.z*i.plane.normal.z-s>0)return{startsolid:!1,allsolid:!1,contents:0}}return{startsolid:!0,allsolid:!0,contents:o.contents}}function ut({start:t,end:e,mins:n,maxs:o,brush:i,trace:r}){if(i.sides.length===0)return;let s=n.x===0&&n.y===0&&n.z===0&&o.x===0&&o.y===0&&o.z===0,l=-1,c=1,f=null,u=null,a=!1,m=!1;for(let h of i.sides){let{plane:d}=h,S=d.dist;if(!s){let M=d.normal.x<0?o.x:n.x,v=d.normal.y<0?o.y:n.y,p=d.normal.z<0?o.z:n.z;S-=d.normal.x*M+d.normal.y*v+d.normal.z*p}let _=t.x*d.normal.x+t.y*d.normal.y+t.z*d.normal.z-S,A=e.x*d.normal.x+e.y*d.normal.y+e.z*d.normal.z-S;if(A>0&&(a=!0),_>0&&(m=!0),_>0&&A>=_)return;if(!(_<=0&&A<=0))if(_>A){let M=(_-q)/(_-A);M>l&&(l=M,f=d,u=h)}else{let M=(_+q)/(_-A);M<c&&(c=M)}}if(!m){r.startsolid=!0,a||(r.allsolid=!0),r.fraction=0;return}l<c&&l>-1&&l<r.fraction&&(l<0&&(l=0),r.fraction=l,r.plane=f,r.contents=i.contents,r.surfaceFlags=u?.surfaceFlags??0)}function Ie(){return{fraction:1,plane:null,contents:0,surfaceFlags:0,startsolid:!1,allsolid:!1}}function dt(t,e,n){let o=n;for(;o>=0;){let i=e.nodes[o];o=se(i.plane,t)>=0?i.children[0]:i.children[1]}return-1-o}function Vn(t,e,n){let o=t.leaves[e],i=o.contents,r=ft(),s=o.firstLeafBrush,l=s+o.numLeafBrushes;for(let c=s;c<l;c+=1){let f=t.leafBrushes[c],u=t.brushes[f];u.checkcount!==r&&(u.checkcount=r,u.sides.length!==0&&vn(n,u)&&(i|=u.contents))}return i}function ft(){let t=De;return De+=1,De>=Er&&(De=1),t}function Dr(t,e){return t.x===0&&t.y===0&&t.z===0&&e.x===0&&e.y===0&&e.z===0}function Ir(t,e,n){return Dr(e,n)?0:t.normal.x*(t.normal.x<0?n.x:e.x)+t.normal.y*(t.normal.y<0?n.y:e.y)+t.normal.z*(t.normal.z<0?n.z:e.z)}function Cn(t,e,n){return Math.abs(Ir(t,e,n))}function st(t,e,n){return O(t,P(te(e,t),n))}function at(t,e,n){let o=t.allsolid?0:t.fraction,i=st(e,n,o);return{fraction:o,endpos:i,plane:t.plane,planeNormal:t.startsolid?void 0:t.plane?.normal,contents:t.contents,surfaceFlags:t.surfaceFlags,startsolid:t.startsolid,allsolid:t.allsolid}}function Be(t,e,n){let o=dt(t,e,n);return e.leaves[o]?.cluster??-1}function Rn(t,e,n,o){if(!t||t.numClusters===0)return!0;if(e<0||n<0||e>=t.clusters.length||n>=t.numClusters)return!1;let i=t.clusters[e],s=(o?i.phs:i.pvs)[n>>3];return s===void 0?!1:(s&1<<(n&7))!==0}function be(t){let{model:e,nodeIndex:n,startFraction:o,endFraction:i,start:r,end:s,traceStart:l,traceEnd:c,mins:f,maxs:u,contentMask:a,trace:m,brushCheckCount:h}=t;if(m.fraction<=o)return;if(n<0){Y&&Y.leafsReached++;let z=-1-n,y=e.leaves[z],T=y.firstLeafBrush,H=T+y.numLeafBrushes;for(let D=T;D<H;D+=1){let X=e.leafBrushes[D],g=e.brushes[X];if((g.contents&a)!==0&&g.sides.length&&g.checkcount!==h&&(g.checkcount=h,Y&&Y.brushesTested++,ut({start:l,end:c,mins:f,maxs:u,brush:g,trace:m}),m.allsolid))return}return}Y&&Y.nodesTraversed++;let d=e.nodes[n],S=d.plane,_=Cn(S,f,u),A=se(S,r),M=se(S,s);if(A>=_&&M>=_){be({model:e,nodeIndex:d.children[0],startFraction:o,endFraction:i,start:r,end:s,traceStart:l,traceEnd:c,mins:f,maxs:u,contentMask:a,trace:m,brushCheckCount:h});return}if(A<-_&&M<-_){be({model:e,nodeIndex:d.children[1],startFraction:o,endFraction:i,start:r,end:s,traceStart:l,traceEnd:c,mins:f,maxs:u,contentMask:a,trace:m,brushCheckCount:h});return}let v=0,p=1/(A-M),C,N;A<M?(v=1,N=(A+_+q)*p,C=(A-_+q)*p):(v=0,N=(A-_-q)*p,C=(A+_+q)*p),C<0?C=0:C>1&&(C=1),N<0?N=0:N>1&&(N=1);let F=o+(i-o)*C,V=st(r,s,C);if(be({model:e,nodeIndex:d.children[v],startFraction:o,endFraction:F,start:r,end:V,traceStart:l,traceEnd:c,mins:f,maxs:u,contentMask:a,trace:m,brushCheckCount:h}),m.fraction<=F)return;let k=o+(i-o)*N,R=st(r,s,N);be({model:e,nodeIndex:d.children[1-v],startFraction:k,endFraction:i,start:R,end:s,traceStart:l,traceEnd:c,mins:f,maxs:u,contentMask:a,trace:m,brushCheckCount:h})}function On(t){let{model:e,start:n,end:o}=t,i=t.mins??E,r=t.maxs??E,s=t.contentMask??4294967295,l=t.headnode??0,c=Ie(),f=ft();return be({model:e,nodeIndex:l,startFraction:0,endFraction:1,start:n,end:o,traceStart:n,traceEnd:o,mins:i,maxs:r,contentMask:s,trace:c,brushCheckCount:f}),at(c,n,o)}function Br(t,e,n=0){let o=dt(t,e,n);return Vn(e,o,t)}function Ur(t,e,n=0){let o=new Map;return t.map(i=>{let r=dt(i,e,n),s=e.leaves[r];if(s.numLeafBrushes===0){let l=o.get(r);return l!==void 0?l:(o.set(r,s.contents),s.contents)}return Vn(e,r,i)})}function Gr(t,e,n,o,i=0){let r=ft(),s=0;function l(c){if(c<0){Y&&Y.leafsReached++;let h=-1-c,d=o.leaves[h];s|=d.contents;let S=d.firstLeafBrush,_=S+d.numLeafBrushes;for(let A=S;A<_;A+=1){let M=o.leafBrushes[A],v=o.brushes[M];if(v.checkcount===r||(v.checkcount=r,v.sides.length===0))continue;let p=Nn(t,e,n,v);p.startsolid&&(s|=p.contents)}return}let f=o.nodes[c],u=f.plane,a=Cn(u,e,n),m=se(u,t);if(a===0){l(m>=0?f.children[0]:f.children[1]);return}if(m>a){l(f.children[0]);return}if(m<-a){l(f.children[1]);return}l(f.children[0]),l(f.children[1])}return l(i),s}function Wr(t,e,n,o=0){let{visibility:i}=n;if(!i)return!0;let r=Be(t,n,o),s=Be(e,n,o);return Rn(i,r,s,!1)}function kr(t,e,n,o=0){let{visibility:i}=n;if(!i)return!0;let r=Be(t,n,o),s=Be(e,n,o);return Rn(i,r,s,!0)}function de(t,e,n){return{normal:t,dist:e,type:n,signbits:ct(t)}}function Hr(t){let e=t.surfaceFlags??0,n=t.origin.x+t.maxs.x,o=t.origin.x+t.mins.x,i=t.origin.y+t.maxs.y,r=t.origin.y+t.mins.y,s=t.origin.z+t.maxs.z,l=t.origin.z+t.mins.z,f=[de({x:1,y:0,z:0},n,0),de({x:-1,y:0,z:0},-o,0),de({x:0,y:1,z:0},i,1),de({x:0,y:-1,z:0},-r,1),de({x:0,y:0,z:1},s,2),de({x:0,y:0,z:-1},-l,2)].map(u=>({plane:u,surfaceFlags:e}));return{contents:t.contents,sides:f,checkcount:0}}function Kr(t){let e=Hr(t);return{...t,brush:e,bounds:{mins:{x:t.origin.x+t.mins.x,y:t.origin.y+t.mins.y,z:t.origin.z+t.mins.z},maxs:{x:t.origin.x+t.maxs.x,y:t.origin.y+t.maxs.y,z:t.origin.z+t.maxs.z}}}}function Xr(t,e){return!(t.mins.x>e.maxs.x||t.maxs.x<e.mins.x||t.mins.y>e.maxs.y||t.maxs.y<e.mins.y||t.mins.z>e.maxs.z||t.maxs.z<e.mins.z)}function Zr(t,e){return e.allsolid&&!t.allsolid||e.startsolid&&!t.startsolid?!0:e.fraction<t.fraction}var lt=class{constructor(){this.entities=new Map;this.entityNodes=new Map;this.rootNode=ze()}link(e){let n=Kr(e);this.entities.set(e.id,n);let o=this.entityNodes.get(e.id);o&&o.items.delete(e.id);let i=An(this.rootNode,e.id,n.bounds.mins,n.bounds.maxs);this.entityNodes.set(e.id,i)}unlink(e){this.entities.delete(e);let n=this.entityNodes.get(e);n&&(n.items.delete(e),this.entityNodes.delete(e))}trace(e){let{passId:n}=e,o=e.mins??E,i=e.maxs??E,r=e.contentMask??4294967295,s,l=null;e.model?s=On(e):s=at(Ie(),e.start,e.end);let c={x:Math.min(e.start.x,e.end.x)+o.x,y:Math.min(e.start.y,e.end.y)+o.y,z:Math.min(e.start.z,e.end.z)+o.z},f={x:Math.max(e.start.x,e.end.x)+i.x,y:Math.max(e.start.y,e.end.y)+i.y,z:Math.max(e.start.z,e.end.z)+i.z},u=new Set;ye(this.rootNode,c,f,u);for(let a of u){if(a===n)continue;let m=this.entities.get(a);if(!m||(m.contents&r)===0)continue;let h=Ie();if(ut({start:e.start,end:e.end,mins:o,maxs:i,brush:m.brush,trace:h}),h.contents===0&&(h.contents=m.contents),h.startsolid||h.allsolid||h.fraction<s.fraction){let d=at(h,e.start,e.end);Zr(s,d)&&(s=d,l=m.id)}}return{...s,entityId:l}}gatherTriggerTouches(e,n,o,i=1073741824){let r=[],s={mins:O(e,n),maxs:O(e,o)},l=new Set;ye(this.rootNode,s.mins,s.maxs,l);for(let c of l){let f=this.entities.get(c);f&&(f.contents&i)!==0&&Xr(s,f.bounds)&&r.push(f.id)}return r}};var Pn=(s=>(s[s.None=0]="None",s[s.Archive=1]="Archive",s[s.UserInfo=2]="UserInfo",s[s.ServerInfo=4]="ServerInfo",s[s.Latch=8]="Latch",s[s.Cheat=16]="Cheat",s))(Pn||{});var ec=1024,tc=80,nc=512,oc=64,rc=128,Yr=256,ic=8192,Jr=256,jr=8192,qr=2048,$r=512,Qr=256,ei=512,ti=256,mt=32,sc=96,ac=64,K=(y=>(y[y.Name=0]="Name",y[y.CdTrack=1]="CdTrack",y[y.Sky=2]="Sky",y[y.SkyAxis=3]="SkyAxis",y[y.SkyRotate=4]="SkyRotate",y[y.StatusBar=5]="StatusBar",y[y.HealthBarName=55]="HealthBarName",y[y.CONFIG_N64_PHYSICS=56]="CONFIG_N64_PHYSICS",y[y.CONFIG_CTF_TEAMS=57]="CONFIG_CTF_TEAMS",y[y.CONFIG_COOP_RESPAWN_STRING=58]="CONFIG_COOP_RESPAWN_STRING",y[y.Story=54]="Story",y[y.AirAccel=59]="AirAccel",y[y.MaxClients=60]="MaxClients",y[y.MapChecksum=61]="MapChecksum",y[y.Models=62]="Models",y[y.Sounds=62+jr]="Sounds",y[y.Images=y.Sounds+qr]="Images",y[y.Lights=y.Images+$r]="Lights",y[y.ShadowLights=y.Lights+Jr]="ShadowLights",y[y.Items=y.ShadowLights+ti]="Items",y[y.Players=y.Items+Qr]="Players",y[y.PlayerSkins=y.Players]="PlayerSkins",y[y.General=y.Players+Yr]="General",y[y.WheelWeapons=y.General+ei]="WheelWeapons",y[y.WheelAmmo=y.WheelWeapons+mt]="WheelAmmo",y[y.WheelPowerups=y.WheelAmmo+mt]="WheelPowerups",y[y.CdLoopCount=y.WheelPowerups+mt]="CdLoopCount",y[y.GameStyle=y.CdLoopCount+1]="GameStyle",y[y.MaxConfigStrings=y.GameStyle+1]="MaxConfigStrings",y))(K||{}),ni=K.MaxConfigStrings;function oi(t){return t>=5&&t<59?96*(59-t):t>=K.General&&t<K.WheelWeapons?96*(K.MaxConfigStrings-t):96}var ri=0,ii=1,si=2,ai=3,li=4,ci=5,ui=59,di=60,fi=61,mi=62,xi=K.Sounds,pi=K.Images,hi=K.Lights,yi=K.Items,bi=K.Players,gi=K.General;var xt={};yn(xt,{addReplayFrame:()=>Ai,createReplaySession:()=>Ti,deserializeReplay:()=>_i,serializeReplay:()=>Si});function Si(t){return JSON.stringify(t,null,2)}function _i(t){let e=JSON.parse(t);if(!e.metadata||!Array.isArray(e.frames))throw new Error("Invalid replay format: missing metadata or frames");return e}function Ti(t,e){return{metadata:{map:t,date:new Date().toISOString(),version:"1.0",seed:e},frames:[]}}function Ai(t,e,n,o){t.frames.push({serverFrame:n,cmd:e,timestamp:Date.now()-o})}function Mi(t){return t??{}}function Fn(t,e,n={}){let o=Mi(t),i=[],r=[];for(let l of e){if(!(l in o)){i.push(l);continue}typeof o[l]!="function"&&r.push(l)}let s=n.allowExtra===!1?Object.keys(o).filter(l=>!e.includes(l)):[];return{missing:i,nonFunctions:r,extras:s}}function vi(t,e,n={}){let{missing:o,nonFunctions:i,extras:r}=Fn(t,e,n);if(o.length===0&&i.length===0&&r.length===0)return;let s=[];o.length>0&&s.push(`missing: ${o.join(", ")}`),i.length>0&&s.push(`non-functions: ${i.join(", ")}`),r.length>0&&s.push(`extras: ${r.join(", ")}`);let l=n.name??"contract";throw new Error(`${l} validation failed (${s.join("; ")})`)}var Ni=["Broadcast_Print","Com_Print","Client_Print","Center_Print","sound","positioned_sound","local_sound","configstring","get_configstring","Com_Error","modelindex","soundindex","imageindex","setmodel","trace","clip","pointcontents","inPVS","inPHS","SetAreaPortalState","AreasConnected","linkentity","unlinkentity","BoxEdicts","multicast","unicast"],Vi=["PreInit","Init","Shutdown","SpawnEntities","WriteGameJson","ReadGameJson","WriteLevelJson","ReadLevelJson","CanSave","ClientConnect","ClientThink","RunFrame","Pmove"],Ci=["Com_Print","get_configstring","Com_Error","TagMalloc","TagFree","AddCommandString","CL_FrameValid","CL_FrameTime","CL_ClientTime","CL_ServerFrame","Draw_RegisterPic","Draw_GetPicSize","SCR_DrawChar","SCR_DrawPic","SCR_DrawColorPic"],Ri=["Init","Shutdown","DrawHUD","TouchPics","LayoutFlags","GetActiveWeaponWheelWeapon","GetOwnedWeaponWheelWeapons","GetWeaponWheelAmmoCount","GetPowerupWheelCount","GetHitMarkerDamage","Pmove","ParseConfigString","ParseCenterPrint","ClearNotify","ClearCenterprint","NotifyMessage","GetMonsterFlashOffset"];var fe=(i=>(i[i.None=0]="None",i[i.Feet=1]="Feet",i[i.Waist=2]="Waist",i[i.Under=3]="Under",i))(fe||{});function pt(t){return t>=2}function Oi(t){return t===3}var $=(a=>(a[a.Ducked=1]="Ducked",a[a.JumpHeld=2]="JumpHeld",a[a.OnGround=4]="OnGround",a[a.TimeWaterJump=8]="TimeWaterJump",a[a.TimeLand=16]="TimeLand",a[a.TimeTeleport=32]="TimeTeleport",a[a.NoPositionalPrediction=64]="NoPositionalPrediction",a[a.OnLadder=128]="OnLadder",a[a.NoAngularPrediction=256]="NoAngularPrediction",a[a.IgnorePlayerCollision=512]="IgnorePlayerCollision",a[a.TimeTrick=1024]="TimeTrick",a))($||{});function I(t,e){return(t&e)!==0}function G(t,e){return t|e}function Z(t,e){return t&~e}var ae=(l=>(l[l.Normal=0]="Normal",l[l.Grapple=1]="Grapple",l[l.NoClip=2]="NoClip",l[l.Spectator=3]="Spectator",l[l.Dead=4]="Dead",l[l.Gib=5]="Gib",l[l.Freeze=6]="Freeze",l))(ae||{}),le=(c=>(c[c.None=0]="None",c[c.Attack=1]="Attack",c[c.Use=2]="Use",c[c.Holster=4]="Holster",c[c.Jump=8]="Jump",c[c.Crouch=16]="Crouch",c[c.Attack2=32]="Attack2",c[c.Any=128]="Any",c))(le||{});var Pi=270;function Fi(t,e){return(t&e)!==0}function ht(t){let{pmFlags:e,pmType:n,buttons:o,waterlevel:i,onGround:r,velocity:s,origin:l,jumpHeight:c=Pi}=t;if(e&16)return{pmFlags:e,onGround:r,velocity:s,origin:l,jumpSound:!1,jumped:!1};let f=Fi(o,8),u=e,a=r,m=!1,h=!1,d=s,S=l;if(!f)return u=Z(u,2),{pmFlags:u,onGround:a,velocity:d,origin:S,jumpSound:m,jumped:h};if(Ei(u))return{pmFlags:u,onGround:a,velocity:d,origin:S,jumpSound:m,jumped:h};if(n===4)return{pmFlags:u,onGround:a,velocity:d,origin:S,jumpSound:m,jumped:h};if(i>=2)return a=!1,{pmFlags:u,onGround:a,velocity:d,origin:S,jumpSound:m,jumped:h};if(!a)return{pmFlags:u,onGround:a,velocity:d,origin:S,jumpSound:m,jumped:h};u=G(u,2),u=Z(u,4),a=!1,m=!0,h=!0;let _=s.z+c,A=_<c?c:_;return d={...s,z:A},S={...l,z:l.z+1},{pmFlags:u,onGround:a,velocity:d,origin:S,jumpSound:m,jumped:h}}function Ei(t){return(t&2)!==0}var Li=100,yt=200,En=150,Ue=25,wi=15,zi=1,Di={x:0,y:0,z:1},Ii=(t,e)=>({fraction:1,endpos:e,allsolid:!1,startsolid:!1});function bt(t){let e=0,n=0,o=0;return t&262144&&(e+=1),t&524288&&(n+=1),t&1048576&&(e-=1),t&2097152&&(n-=1),t&4194304&&(o+=1),t&8388608&&(o-=1),e===0&&n===0&&o===0?E:{x:e,y:n,z:o}}function zn(t){let{watertype:e,waterlevel:n,onGround:o,waterSpeed:i}=t;if((e&16515072)===0)return E;let r=bt(e);if(r===E)return E;let s=i;return n===1&&o&&(s*=.5),P(r,s)}function Dn(t){let{groundContents:e,scale:n=Li}=t,o=bt(e);return o===E?E:P(o,n)}function ge(t){let{wishVelocity:e,onLadder:n,onGround:o,waterlevel:i,watertype:r,groundContents:s,cmd:l,viewPitch:c,maxSpeed:f,ladderMod:u,waterSpeed:a,forward:m,origin:h,mins:d,maxs:S,trace:_=Ii}=t,A=e;n&&(A=Bi({wishVelocity:A,cmd:l,waterlevel:i,viewPitch:c,maxSpeed:f,ladderMod:u,onGround:o,forward:m,origin:h,mins:d,maxs:S,trace:_}));let M=zn({watertype:r,waterlevel:i,onGround:o,waterSpeed:a});if(M!==E&&(A=O(A,M)),o){let v=Dn({groundContents:s});v!==E&&(A=O(A,v))}return A}function Bi(t){let{wishVelocity:e,cmd:n,waterlevel:o,viewPitch:i,maxSpeed:r,ladderMod:s,onGround:l,forward:c,origin:f,mins:u,maxs:a,trace:m}=t,h=n.buttons??0,d={...e};if((h&24)!==0){let S=pt(o)?r:yt;d={...d,z:h&8?S:-S}}else if(n.forwardmove){let S=Ln(n.forwardmove,-yt,yt);if(n.forwardmove>0){let _=i<wi?S:-S;d={...d,z:_}}else l||(d={...d,x:0,y:0}),d={...d,z:S}}else d={...d,z:0};if(!l)if(n.sidemove){let S=Ln(n.sidemove,-En,En);o<2&&(S*=s);let _=L({x:c.x,y:c.y,z:0});if(_.x!==0||_.y!==0){let A=O(f,P(_,zi)),M=m(f,A,u,a);if(M.fraction!==1&&!M.allsolid&&M.contents!==void 0&&(M.contents&536870912)!==0&&M.planeNormal){let v=ne(M.planeNormal,Di);d={...d,x:0,y:0},d=O(d,P(v,-S))}}}else d={...d,x:wn(d.x),y:wn(d.y)};return d}function Ln(t,e,n){return Math.max(e,Math.min(n,t))}function wn(t){return t<-Ue?-Ue:t>Ue?Ue:t}var In=5,Ui=4,Gi=18,Wi=.7,Bn=1,Un=2;function Gn(t,e,n,o=In,i=t){if(e.length===0)return{velocity:t,planes:[],stopped:!1};let r=[],s=t;for(let c of e){if(r.length>=o)return{velocity:E,planes:r,stopped:!0};if(r.find(m=>B(m,c)>.99))continue;r.push(c);let u,a=0;for(;a<r.length;a++){let m=oe(s,r[a],n),h=0;for(;h<r.length&&!(h!==a&&B(m,r[h])<0);h++);if(h===r.length){u=m;break}}if(u)s=u;else{if(r.length!==2)return{velocity:E,planes:r,stopped:!0};let m=ne(r[0],r[1]),h=B(m,s);s=P(m,h)}if(B(s,i)<=0)return{velocity:E,planes:r,stopped:!0}}let l=s.x===0&&s.y===0&&s.z===0;return{velocity:s,planes:r,stopped:l}}function gt(t){let{origin:e,velocity:n,frametime:o,overbounce:i,trace:r,maxBumps:s=Ui,maxClipPlanes:l=In,mins:c,maxs:f,hasTime:u=!1}=t,a=e,m=n,h=[],d=n,S=o,_=0;for(let M=0;M<s&&!(m.x===0&&m.y===0&&m.z===0);M++){let v=O(a,P(m,S)),p=r(a,v,c,f);if(p.allsolid){let N=u?d:E;return{origin:p.endpos,velocity:N,planes:h,stopped:!0,blocked:_}}if(p.startsolid){let N=u?d:E;return{origin:p.endpos,velocity:N,planes:h,stopped:!0,blocked:_}}if(p.fraction>0&&(a=p.endpos),p.fraction===1)break;if(!p.planeNormal)return{origin:a,velocity:u?d:E,planes:h,stopped:!0,blocked:_};p.planeNormal.z>.7&&(_|=Bn),p.planeNormal.z===0&&(_|=Un),h.push(p.planeNormal),S-=S*p.fraction;let C=Gn(m,h,i,l,d);if(m=C.velocity,h.splice(0,h.length,...C.planes),d.z>0&&m.z<0&&(m={...m,z:0}),C.stopped)return{origin:a,velocity:u?d:m,planes:h,stopped:!0,blocked:_}}let A=u?d:m;return{origin:a,velocity:A,planes:h,stopped:A.x===0&&A.y===0&&A.z===0,blocked:_}}function ce(t){let{mins:e,maxs:n,stepSize:o=Gi,...i}=t,r=t.origin,s=t.velocity,l=gt({...i,mins:e,maxs:n}),c=O(r,{x:0,y:0,z:o}),f=i.trace(r,c,e,n);if(f.allsolid)return{...l,stepped:!1,stepHeight:0};let u=f.endpos.z-r.z,a=gt({...i,origin:f.endpos,velocity:s,mins:e,maxs:n}),m=O(a.origin,{x:0,y:0,z:-u}),h=i.trace(a.origin,m,e,n),d=a.origin,S=h.planeNormal;h.allsolid||(d=h.endpos);let _=(N,F)=>(N.x-F.x)**2+(N.y-F.y)**2,A=_(l.origin,r),M=_(d,r);if(A>M||S&&S.z<Wi)return{...l,stepped:!1,stepHeight:0};let v={...a.velocity,z:l.velocity.z},p=a.blocked,C=v.x===0&&v.y===0&&v.z===0;return{origin:d,velocity:v,planes:a.planes,blocked:p,stopped:C,stepped:!0,stepHeight:u,stepNormal:S}}var Wn=1,ki=60,Ge=1.01;function St(t){let{origin:e,frametime:n,mins:o,maxs:i,trace:r,overbounce:s=Ge,stepSize:l,maxBumps:c,maxClipPlanes:f,hasTime:u,forward:a,right:m,cmd:h,pmFlags:d,onGround:S,gravity:_,pmType:A,pmAccelerate:M,pmAirAccelerate:v=Wn,pmMaxSpeed:p,pmDuckSpeed:C,onLadder:N,waterlevel:F,watertype:V,groundContents:W,viewPitch:k,ladderMod:R,pmWaterSpeed:z}=t,y={...t.velocity},T=Hn(a,m,h);T=ge({wishVelocity:T,onLadder:N,onGround:S,waterlevel:F,watertype:V,groundContents:W,cmd:h,viewPitch:k,maxSpeed:I(d,1)?C:p,ladderMod:R,waterSpeed:z,forward:a,origin:e,mins:o,maxs:i,trace:r});let D=I(d,1)?C:p,X=T,g=U(X);if(g!==0&&(X=L(X)),g>D){let Q=D/g;T=P(T,Q),g=D,g!==0&&(X=L(T))}return N?(y=J({velocity:y,wishdir:X,wishspeed:g,accel:M,frametime:n}),Math.abs(T.z)<Number.EPSILON&&(y=Xi(y,_,n)),Se({origin:e,velocity:y,frametime:n,mins:o,maxs:i,trace:r,overbounce:s,stepSize:l,maxBumps:c,maxClipPlanes:f,hasTime:u})):S?(y={...y,z:0},y=J({velocity:y,wishdir:X,wishspeed:g,accel:M,frametime:n}),_>0?y={...y,z:0}:y={...y,z:y.z-_*n},y.x===0&&y.y===0?{origin:e,velocity:y,planes:[],blocked:0,stopped:!0,stepped:!1,stepHeight:0}:Se({origin:e,velocity:y,frametime:n,mins:o,maxs:i,trace:r,overbounce:s,stepSize:l,maxBumps:c,maxClipPlanes:f,hasTime:u})):(v>0?y=At({velocity:y,wishdir:X,wishspeed:g,accel:v,frametime:n}):y=J({velocity:y,wishdir:X,wishspeed:g,accel:Wn,frametime:n}),A!==1&&(y={...y,z:y.z-_*n}),Se({origin:e,velocity:y,frametime:n,mins:o,maxs:i,trace:r,overbounce:s,stepSize:l,maxBumps:c,maxClipPlanes:f,hasTime:u}))}function _t(t){let{origin:e,frametime:n,mins:o,maxs:i,trace:r,overbounce:s=Ge,stepSize:l,maxBumps:c,maxClipPlanes:f,hasTime:u,forward:a,right:m,cmd:h,pmFlags:d,onGround:S,pmMaxSpeed:_,pmDuckSpeed:A,pmWaterAccelerate:M,pmWaterSpeed:v,onLadder:p,watertype:C,groundContents:N,waterlevel:F,viewPitch:V,ladderMod:W}=t,k={...t.velocity},R=Hi(a,m,h);Ki(h,S)?R={...R,z:R.z-ki}:kn(h,16)?R=O(R,{x:0,y:0,z:-v*.5}):kn(h,8)&&(R=O(R,{x:0,y:0,z:v*.5})),R=ge({wishVelocity:R,onLadder:p,onGround:S,waterlevel:F,watertype:C,groundContents:N,cmd:h,viewPitch:V,maxSpeed:I(d,1)?A:_,ladderMod:W,waterSpeed:v,forward:a,origin:e,mins:o,maxs:i,trace:r});let z=R,y=U(z);if(y!==0&&(z=L(z)),y>_){let H=_/y;R=P(R,H),y=_,y!==0&&(z=L(R))}if(y*=.5,I(d,1)&&y>A){let H=A/y;R=P(R,H),y=A,y!==0&&(z=L(R))}return k=J({velocity:k,wishdir:z,wishspeed:y,accel:M,frametime:n}),Se({origin:e,velocity:k,frametime:n,mins:o,maxs:i,trace:r,overbounce:s,stepSize:l,maxBumps:c,maxClipPlanes:f,hasTime:u})}function Tt(t){let{origin:e,frametime:n,mins:o,maxs:i,trace:r,overbounce:s=Ge,stepSize:l,maxBumps:c,maxClipPlanes:f,hasTime:u,forward:a,right:m,cmd:h,pmFlags:d,onGround:S,gravity:_,pmAccelerate:A,pmMaxSpeed:M,pmDuckSpeed:v,onLadder:p,waterlevel:C,watertype:N,groundContents:F,viewPitch:V,ladderMod:W,pmWaterSpeed:k}=t,R={...t.velocity},z=Hn(a,m,h);z=ge({wishVelocity:z,onLadder:p,onGround:S,waterlevel:C,watertype:N,groundContents:F,cmd:h,viewPitch:V,maxSpeed:I(d,1)?v:M,ladderMod:W,waterSpeed:k,forward:a,origin:e,mins:o,maxs:i,trace:r});let T=I(d,1)?v:M,H=z,D=U(H);if(D!==0&&(H=L(H)),D>T){let X=T/D;z=P(z,X),D=T,D!==0&&(H=L(z))}return R={...R,z:0},R=J({velocity:R,wishdir:H,wishspeed:D,accel:A,frametime:n}),_>0?R={...R,z:0}:R={...R,z:R.z-_*n},R.x===0&&R.y===0?{origin:e,velocity:R,planes:[],blocked:0,stopped:!0,stepped:!1,stepHeight:0}:Se({origin:e,velocity:R,frametime:n,mins:o,maxs:i,trace:r,overbounce:s,stepSize:l,maxBumps:c,maxClipPlanes:f,hasTime:u})}function Hn(t,e,n){return{x:t.x*n.forwardmove+e.x*n.sidemove,y:t.y*n.forwardmove+e.y*n.sidemove,z:0}}function Hi(t,e,n){return{x:t.x*n.forwardmove+e.x*n.sidemove,y:t.y*n.forwardmove+e.y*n.sidemove,z:t.z*n.forwardmove+e.z*n.sidemove}}function kn(t,e){return!!((t.buttons??0)&e)}function Ki(t,e){let n=t.forwardmove===0&&t.sidemove===0,o=!((t.buttons??0)&24);return n&&o&&!e}function Xi(t,e,n){let o=t.z,i=e*n;return o>0?(o-=i,o<0&&(o=0)):(o+=i,o>0&&(o=0)),{...t,z:o}}function Se(t){let{origin:e,velocity:n,frametime:o,mins:i,maxs:r,trace:s,overbounce:l=Ge,stepSize:c,maxBumps:f,maxClipPlanes:u,hasTime:a}=t;return ce({origin:e,velocity:n,frametime:o,trace:s,mins:i,maxs:r,overbounce:l,stepSize:c,maxBumps:f,maxClipPlanes:u,hasTime:a})}function _e(t){let{origin:e,mins:n,viewheight:o,pointContents:i}=t,r=o-n.z,s=r/2,l={x:e.x,y:e.y,z:e.z+n.z+1},c=i(l);if((c&56)===0)return{waterlevel:0,watertype:0};let f=c,u=1,a={x:l.x,y:l.y,z:e.z+n.z+s};if(c=i(a),(c&56)!==0){u=2;let m={x:l.x,y:l.y,z:e.z+n.z+r};c=i(m),(c&56)!==0&&(u=3)}return{waterlevel:u,watertype:f}}var Zi=.25,Yi=180,Ji=100,ji=.7,qi=.9,$i=64,Qi=128,es=1.01,ts=1080;function We(t){let{pmType:e,n64Physics:n,velocity:o,startVelocity:i,origin:r,mins:s,maxs:l,viewheight:c,trace:f,pointContents:u}=t,a=t.pmFlags,m=t.pmTime,h,d=I(a,4),S,_=0;if(o.z>Yi||e===1)a=Z(a,4),d=!1;else{let p={x:r.x,y:r.y,z:r.z-Zi},C=f(r,p,s,l);S=C,_=C.contents??0;let N=C.planeNormal,F=C.fraction<1&&!!N&&N.z<ji;if(F&&N){let V=O(r,N),W=f(r,V,s,l);W.fraction<1&&!W.startsolid&&(F=!1)}if(C.fraction===1||!N||F&&!C.startsolid)a=Z(a,4),d=!1;else{d=!0,I(a,8)&&(a&=~ts,m=0);let V=I(a,4);if(!V){!n&&o.z>=Ji&&N.z>=qi&&!I(a,1)&&(a=G(a,1024),m=$i);let W=oe(o,N,es);h=i.z-W.z}a=G(a,4),!V&&(n||I(a,1))&&(a=G(a,16),m=Qi)}}let{waterlevel:M,watertype:v}=_e({origin:r,mins:s,viewheight:c,pointContents:u});return{pmFlags:a,pmTime:m,onGround:I(a,4),groundTrace:S,groundContents:_,waterlevel:M,watertype:v,impactDelta:h}}function ke(t,e,n){return{x:t,y:e,z:n}}function He(t,e){let n=ke(-16,-16,0),o=ke(16,16,16);if(t===5)return{mins:n,maxs:o,viewheight:8};let i=t===4||(e&1)!==0,r=ke(n.x,n.y,-24),s=ke(o.x,o.y,i?4:32);return{mins:r,maxs:s,viewheight:i?-2:22}}var ns=4,os=32,rs=8;function Mt(t){let{pmType:e}=t;if(e===5){let s=He(e,t.pmFlags);return{pmFlags:t.pmFlags,ducked:I(t.pmFlags,1),changed:!1,...s}}let n=t.pmFlags,o=!1;e===4?I(n,1)||(n=G(n,1),o=!0):is(t)?!I(n,1)&&!ss(t)&&(n=G(n,1),o=!0):I(n,1)&&!as(t)&&(n=Z(n,1),o=!0);let i=He(e,n),r=e===4||I(n,1);return{pmFlags:n,ducked:r,changed:o,...i}}function is(t){return(t.buttons&16)===0||t.onLadder||t.n64Physics?!1:!!(t.hasGroundEntity||t.waterlevel<=1&&!ls(t))}function ss(t){return t.trace({start:t.origin,end:t.origin,mins:t.mins,maxs:Kn(t.maxs,ns),mask:3}).allsolid}function as(t){return t.trace({start:t.origin,end:t.origin,mins:t.mins,maxs:Kn(t.maxs,os),mask:3}).allsolid}function ls(t){let e={x:t.origin.x,y:t.origin.y,z:t.origin.z-rs};return t.trace({start:t.origin,end:e,mins:t.mins,maxs:t.maxs,mask:3}).fraction<1?!1:t.trace({start:t.origin,end:e,mins:t.mins,maxs:t.maxs,mask:56}).fraction<1}function Kn(t,e){return{x:t.x,y:t.y,z:e}}var Te=.025;function Ke(t){let{velocity:e,frametime:n,onGround:o,groundIsSlick:i,onLadder:r,waterlevel:s,pmFriction:l,pmStopSpeed:c,pmWaterFriction:f}=t,u=U(e);if(u<1)return{x:0,y:0,z:e.z};let a=0;if(o&&!i||r){let d=u<c?c:u;a+=d*l*n}s>0&&!r&&(a+=u*f*s*n);let m=u-a;if(m<0&&(m=0),m===u)return e;let h=m/u;return P(e,h)}function J(t){let{velocity:e,wishdir:n,wishspeed:o,accel:i,frametime:r}=t,s=B(e,n),l=o-s;if(l<=0)return e;let c=i*r*o;return c>l&&(c=l),{x:e.x+n.x*c,y:e.y+n.y*c,z:e.z+n.z*c}}function At(t){let{velocity:e,wishdir:n,wishspeed:o,accel:i,frametime:r}=t,s=Math.min(o,30),l=B(e,n),c=s-l;if(c<=0)return e;let f=i*o*r;return f>c&&(f=c),{x:e.x+n.x*f,y:e.y+n.y*f,z:e.z+n.z*f}}function cs(t,e){let n=Math.abs(t.forwardmove),o=Math.abs(t.sidemove),i=Math.abs(t.upmove),r=Math.max(n,o,i);if(r===0)return 0;let s=Math.sqrt(t.forwardmove*t.forwardmove+t.sidemove*t.sidemove+t.upmove*t.upmove);return e*r/(127*s)}function vt(t){let{forward:e,right:n,cmd:o,maxSpeed:i}=t,r={x:e.x*o.forwardmove+n.x*o.sidemove,y:e.y*o.forwardmove+n.y*o.sidemove,z:0},s=U(r);if(s>i){let l=i/s;r=P(r,l),s=i}return{wishdir:s===0?r:L(r),wishspeed:s}}function Nt(t){let{forward:e,right:n,cmd:o,maxSpeed:i}=t,r={x:e.x*o.forwardmove+n.x*o.sidemove,y:e.y*o.forwardmove+n.y*o.sidemove,z:e.z*o.forwardmove+n.z*o.sidemove};o.upmove>10?r=O(r,{x:0,y:0,z:o.upmove}):o.upmove<-10?r=O(r,{x:0,y:0,z:o.upmove}):Math.abs(o.forwardmove)<10&&Math.abs(o.sidemove)<10?r=O(r,{x:0,y:0,z:-60}):r=O(r,{x:0,y:0,z:10});let s=U(r);if(s>i){let l=i/s;r=P(r,l),s=i}return s*=.5,{wishdir:s===0?r:L(r),wishspeed:s}}function us(t,e){if(t.pmType===4)return t;let n={...t},o=We({pmType:n.pmType,pmFlags:n.pmFlags,pmTime:0,n64Physics:!1,velocity:n.velocity,startVelocity:n.velocity,origin:n.origin,mins:n.mins,maxs:n.maxs,viewheight:n.viewHeight,trace:e.trace,pointContents:e.pointcontents});n.pmFlags=o.pmFlags,n.waterlevel=o.waterlevel,n.watertype=o.watertype;let i=Mt({pmType:n.pmType,pmFlags:n.pmFlags,buttons:n.cmd.buttons,waterlevel:n.waterlevel,hasGroundEntity:(n.pmFlags&4)!==0,onLadder:!1,n64Physics:!1,origin:n.origin,mins:n.mins,maxs:n.maxs,trace:a=>e.trace(a.start,a.end,a.mins,a.maxs)});n.pmFlags=i.pmFlags,n.mins=i.mins,n.maxs=i.maxs,n.viewHeight=i.viewheight;let r=ht({pmFlags:n.pmFlags,pmType:n.pmType,buttons:n.cmd.buttons,waterlevel:n.waterlevel,onGround:(n.pmFlags&4)!==0,velocity:n.velocity,origin:n.origin});n.pmFlags=r.pmFlags,n.velocity=r.velocity,n.origin=r.origin,r.onGround!==((n.pmFlags&4)!==0)&&(r.onGround?n.pmFlags=G(n.pmFlags,4):n.pmFlags=Z(n.pmFlags,4));let s=(n.pmFlags&4)!==0,l=n.velocity;n.velocity=Ke({velocity:n.velocity,frametime:Te,onGround:s,groundIsSlick:!1,onLadder:!1,waterlevel:n.waterlevel,pmFriction:6,pmStopSpeed:100,pmWaterFriction:1});let{forward:c,right:f}=re(n.viewAngles);if(n.pmType===2){let a={x:c.x*n.cmd.forwardmove+f.x*n.cmd.sidemove,y:c.y*n.cmd.forwardmove+f.y*n.cmd.sidemove,z:n.cmd.upmove},m=Te;n.velocity=a,n.origin={x:n.origin.x+a.x*m,y:n.origin.y+a.y*m,z:n.origin.z+a.z*m}}else if(n.waterlevel>=2){let a=_t({origin:n.origin,velocity:n.velocity,frametime:Te,mins:n.mins,maxs:n.maxs,trace:e.trace,cmd:n.cmd,forward:c,right:f,pmFlags:n.pmFlags,onGround:s,pmMaxSpeed:300,pmDuckSpeed:100,pmWaterAccelerate:4,pmWaterSpeed:400,onLadder:!1,watertype:n.watertype,groundContents:0,waterlevel:n.waterlevel,viewPitch:n.viewAngles.x,ladderMod:1,stepSize:18});n.origin=a.origin,n.velocity=a.velocity}else if((n.pmFlags&4)===0){let a=St({origin:n.origin,velocity:n.velocity,frametime:Te,mins:n.mins,maxs:n.maxs,trace:e.trace,cmd:n.cmd,forward:c,right:f,pmFlags:n.pmFlags,onGround:s,gravity:n.gravity,pmType:n.pmType,pmAccelerate:10,pmAirAccelerate:1,pmMaxSpeed:300,pmDuckSpeed:100,onLadder:!1,waterlevel:n.waterlevel,watertype:n.watertype,groundContents:0,viewPitch:n.viewAngles.x,ladderMod:1,pmWaterSpeed:400,stepSize:18});n.origin=a.origin,n.velocity=a.velocity}else{let a=Tt({origin:n.origin,velocity:n.velocity,frametime:Te,mins:n.mins,maxs:n.maxs,trace:e.trace,cmd:n.cmd,forward:c,right:f,pmFlags:n.pmFlags,onGround:s,gravity:n.gravity,pmType:n.pmType,pmAccelerate:10,pmMaxSpeed:300,pmDuckSpeed:100,onLadder:!1,waterlevel:n.waterlevel,watertype:n.watertype,groundContents:0,viewPitch:n.viewAngles.x,ladderMod:1,pmWaterSpeed:400,stepSize:18});n.origin=a.origin,n.velocity=a.velocity}let u=We({pmType:n.pmType,pmFlags:n.pmFlags,pmTime:0,n64Physics:!1,velocity:n.velocity,startVelocity:n.velocity,origin:n.origin,mins:n.mins,maxs:n.maxs,viewheight:n.viewHeight,trace:e.trace,pointContents:e.pointcontents});return n.pmFlags=u.pmFlags,n.waterlevel=u.waterlevel,n.watertype=u.watertype,n}var me=["x","y","z"],Vt=[{normal:[0,0,1],mins:[-1,-1,0],maxs:[1,1,0]},{normal:[0,0,-1],mins:[-1,-1,0],maxs:[1,1,0]},{normal:[1,0,0],mins:[0,-1,-1],maxs:[0,1,1]},{normal:[-1,0,0],mins:[0,-1,-1],maxs:[0,1,1]},{normal:[0,1,0],mins:[-1,0,-1],maxs:[1,0,1]},{normal:[0,-1,0],mins:[-1,0,-1],maxs:[1,0,1]}],Xn={x:0,y:0,z:0};function xe(t){return{x:t.x,y:t.y,z:t.z}}function ds(t){return{x:t[0],y:t[1],z:t[2]}}function Ae(t,e,n){if(n!==0)switch(e){case"x":t.x+=n;break;case"y":t.y+=n;break;case"z":t.z+=n;break}}function Zn(t,e,n){switch(e){case"x":t.x=n;break;case"y":t.y=n;break;case"z":t.z=n;break}}function Xe(t,e){switch(e){case"x":return t.x;case"y":return t.y;case"z":default:return t.z}}function Yn(t,e,n,o){return t===-1?Xe(n,e):t===1?Xe(o,e):0}function Jn(t,e,n,o){let i=xe(t);for(let r=0;r<me.length;r++){let s=me[r],l=e.normal[r];l<0?Ae(i,s,Xe(n,s)):l>0&&Ae(i,s,Xe(o,s))}return i}function fs(t,e,n){let o=xe(Xn),i=xe(Xn);for(let r=0;r<me.length;r++){let s=me[r];Zn(o,s,Yn(t.mins[r],s,e,n)),Zn(i,s,Yn(t.maxs[r],s,e,n))}return{mins:o,maxs:i}}function ms(t,e,n){if(!e||n===0)return t;let o=xe(t);return Ae(o,e,n),o}function xs(t,e,n){if(!e||n===0)return t;switch(e){case"x":return{...t,x:t.x+n};case"y":return{...t,y:t.y+n};case"z":default:return{...t,z:t.z+n}}}function Ct(t){let{origin:e,mins:n,maxs:o,trace:i}=t;if(!i(e,n,o,e).startsolid)return{result:"good-position",origin:{...e}};let s=[];for(let l=0;l<Vt.length;l++){let c=Vt[l],{mins:f,maxs:u}=fs(c,n,o),a=Jn(e,c,n,o),m=i(a,f,u,a),h,d=0;if(m.startsolid)for(let N=0;N<me.length;N++){if(c.normal[N]!==0)continue;let F=me[N],V=xe(a);if(Ae(V,F,1),m=i(V,f,u,V),!m.startsolid){a=V,h=F,d=1;break}if(V=xe(a),Ae(V,F,-1),m=i(V,f,u,V),!m.startsolid){a=V,h=F,d=-1;break}}if(m.startsolid)continue;let S=Vt[l^1],_=Jn(e,S,n,o);if(_=ms(_,h,d),m=i(a,f,u,_),m.startsolid)continue;let A=ds(c.normal),M=O(m.endpos??_,P(A,.125)),v=te(M,_),p=O(e,v);p=xs(p,h,d),!i(p,n,o,p).startsolid&&s.push({origin:p,distance:ue(v)})}return s.length===0?{result:"no-good-position",origin:{...e}}:(s.sort((l,c)=>l.distance-c.distance),{result:"fixed",origin:{...s[0].origin}})}var ps=1.5,jn=.5,hs=1.01;function ys(t){let{origin:e,cmd:n,frametime:o,pmFriction:i,pmStopSpeed:r,pmMaxSpeed:s,pmAccelerate:l,pmWaterSpeed:c,doclip:f,forward:u,right:a,mins:m,maxs:h,trace:d,overbounce:S=hs,stepSize:_,maxBumps:A,maxClipPlanes:M}=t,v=bs({velocity:t.velocity,pmFriction:i,pmStopSpeed:r,frametime:o}),p=gs({cmd:n,forward:u,right:a,pmMaxSpeed:s,pmWaterSpeed:c});if(p.wishspeed>0&&(v=J({velocity:v,wishdir:p.wishdir,wishspeed:p.accelSpeed,accel:l,frametime:o})),!f){let C=P(v,o);return{origin:O(e,C),velocity:v,planes:[],blocked:0,stopped:v.x===0&&v.y===0&&v.z===0,stepped:!1,stepHeight:0}}if(!d||!m||!h)throw new Error("applyPmoveFlyMove: doclip=true requires trace/mins/maxs");return ce({origin:e,velocity:v,frametime:o,overbounce:S,trace:d,mins:m,maxs:h,stepSize:_,maxBumps:A,maxClipPlanes:M})}function bs(t){let{velocity:e,pmFriction:n,pmStopSpeed:o,frametime:i}=t,r=U(e);if(r<1)return{x:0,y:0,z:0};let s=n*ps,c=(r<o?o:r)*s*i,f=r-c;return f<0&&(f=0),f===r?e:P(e,f/r)}function gs(t){let{cmd:e,forward:n,right:o,pmMaxSpeed:i,pmWaterSpeed:r}=t,s=L(n),l=L(o),f={x:s.x*e.forwardmove+l.x*e.sidemove,y:s.y*e.forwardmove+l.y*e.sidemove,z:s.z*e.forwardmove+l.z*e.sidemove},u=e.buttons??0;u&8&&(f=O(f,{x:0,y:0,z:r*jn})),u&16&&(f=O(f,{x:0,y:0,z:-r*jn}));let a=U(f),m=a===0?{x:0,y:0,z:0}:L(f);if(a>i){let d=i/a;f=P(f,d),a=i,m=a===0?{x:0,y:0,z:0}:L(f)}let h=a*2;return{wishdir:m,wishspeed:a,accelSpeed:h}}var Ss=1,_s=40,Ze=50,qn=350,Ts=2048,$n=.1,As=800,Ms=50,Qn=.7,vs=18,Ns=1.01,Vs=2;function Cs(t){let{pmFlags:e,pmTime:n,waterlevel:o,watertype:i,gravity:r,cmd:s,forward:l,origin:c,velocity:f,mins:u,maxs:a,viewheight:m,trace:h,pointContents:d,onGround:S,overbounce:_=Ns,stepSize:A=vs,maxBumps:M,maxClipPlanes:v}=t;if(n>0)return{pmFlags:e,pmTime:n,velocity:f,performedWaterJump:!1};let p=Z(e,128),C=n,N=f,F=L({x:l.x,y:l.y,z:0}),V=ue(F)>0;if(o<2&&V){let g=O(c,P(F,Ss)),Q=h(c,g,u,a),Eo=Q.contents??0;Q.fraction<1&&(Eo&536870912)!==0&&(p=G(p,128))}if(r===0)return{pmFlags:p,pmTime:C,velocity:N,performedWaterJump:!1};if(((s.buttons??0)&8)===0&&s.forwardmove<=0)return{pmFlags:p,pmTime:C,velocity:N,performedWaterJump:!1};if(o!==2)return{pmFlags:p,pmTime:C,velocity:N,performedWaterJump:!1};if((i&8192)!==0)return{pmFlags:p,pmTime:C,velocity:N,performedWaterJump:!1};if(!V)return{pmFlags:p,pmTime:C,velocity:N,performedWaterJump:!1};let W=O(c,P(F,_s)),k=h(c,W,u,a);if(k.fraction===1||!k.planeNormal||k.planeNormal.z>=Qn)return{pmFlags:p,pmTime:C,velocity:N,performedWaterJump:!1};let R={x:F.x*Ze,y:F.y*Ze,z:qn},z=c,y=!0,T=Rs(r);for(let g=0;g<T;g++){R={x:R.x,y:R.y,z:R.z-r*$n},R.z<0&&(y=!1);let Q=ce({origin:z,velocity:R,frametime:$n,trace:h,mins:u,maxs:a,overbounce:_,stepSize:A,maxBumps:M,maxClipPlanes:v,hasTime:y});z=Q.origin,R=Q.velocity}let H=O(z,{x:0,y:0,z:-Vs}),D=h(z,H,u,a);return D.fraction===1||!D.planeNormal||D.planeNormal.z<Qn||D.endpos.z<c.z?{pmFlags:p,pmTime:C,velocity:N,performedWaterJump:!1}:S&&Math.abs(c.z-D.endpos.z)<=A?{pmFlags:p,pmTime:C,velocity:N,performedWaterJump:!1}:_e({origin:D.endpos,mins:u,viewheight:m,pointContents:d}).waterlevel>=2?{pmFlags:p,pmTime:C,velocity:N,performedWaterJump:!1}:(p=G(p,8),C=Ts,N={x:F.x*Ze,y:F.y*Ze,z:qn},{pmFlags:p,pmTime:C,velocity:N,performedWaterJump:!0})}function Rs(t){if(t===0)return 0;let e=Math.floor(10*(As/t));return e<=0?0:Math.min(Ms,e)}var Rt=[0,-1,1];function Ot(t){let{origin:e,mins:n,maxs:o,trace:i}=t;return!i(e,e,n,o).allsolid}function Os(t){let{origin:e,velocity:n,mins:o,maxs:i,previousOrigin:r,trace:s}=t;if(Ot({origin:e,mins:o,maxs:i,trace:s}))return{origin:{...e},velocity:{...n},resolution:"unchanged"};let l=Ct({origin:e,mins:o,maxs:i,trace:(c,f,u,a)=>s(c,a,f,u)});return l.result==="fixed"||l.result==="good-position"?{origin:l.origin,velocity:{...n},resolution:"fixed"}:{origin:{...r},velocity:{...n},resolution:"reverted"}}function Ps(t){let{origin:e,mins:n,maxs:o,trace:i}=t;for(let r of Rt)for(let s of Rt)for(let l of Rt){let c={x:e.x+l,y:e.y+s,z:e.z+r};if(Ot({origin:c,mins:n,maxs:o,trace:i}))return{origin:c,snapped:l!==0||s!==0||r!==0}}return{origin:{...e},snapped:!1}}function Fs(t,e){return{x:t.x+e.x,y:t.y+e.y,z:t.z+e.z}}function Es(t){return t>89&&t<180?89:t<271&&t>=180?271:t}function Ls(t){let{pmFlags:e,cmdAngles:n,deltaAngles:o}=t,i;(e&32)!==0?i={x:0,y:n.y+o.y,z:0}:(i=Fs(n,o),i={...i,x:Es(i.x)});let r=re(i);return{viewangles:i,...r}}var ws=200,zs=200,Ds=200,Is=140,Bs=150,Us=3;function Gs(t){let e=he(t);return e>89&&e<180?89:e<271&&e>=180?271:e}function Ws(t,e){return{x:Gs(t.x+e.x),y:he(t.y+e.y),z:he(t.z+e.z)}}function ks(t,e){let n=e.sensitivityX??e.sensitivity,o=(e.sensitivityY??e.sensitivity)*(e.invertY?-1:1);return{x:t.deltaY*o,y:t.deltaX*n,z:0}}var eo=(g=>(g[g.bad=0]="bad",g[g.muzzleflash=1]="muzzleflash",g[g.muzzleflash2=2]="muzzleflash2",g[g.temp_entity=3]="temp_entity",g[g.layout=4]="layout",g[g.inventory=5]="inventory",g[g.nop=6]="nop",g[g.disconnect=7]="disconnect",g[g.reconnect=8]="reconnect",g[g.sound=9]="sound",g[g.print=10]="print",g[g.stufftext=11]="stufftext",g[g.serverdata=12]="serverdata",g[g.configstring=13]="configstring",g[g.spawnbaseline=14]="spawnbaseline",g[g.centerprint=15]="centerprint",g[g.download=16]="download",g[g.playerinfo=17]="playerinfo",g[g.packetentities=18]="packetentities",g[g.deltapacketentities=19]="deltapacketentities",g[g.frame=20]="frame",g[g.splitclient=21]="splitclient",g[g.configblast=22]="configblast",g[g.spawnbaselineblast=23]="spawnbaselineblast",g[g.level_restart=24]="level_restart",g[g.damage=25]="damage",g[g.locprint=26]="locprint",g[g.fog=27]="fog",g[g.waitingforplayers=28]="waitingforplayers",g[g.bot_chat=29]="bot_chat",g[g.poi=30]="poi",g[g.help_path=31]="help_path",g[g.muzzleflash3=32]="muzzleflash3",g[g.achievement=33]="achievement",g))(eo||{}),to=(r=>(r[r.bad=0]="bad",r[r.nop=1]="nop",r[r.move=2]="move",r[r.userinfo=3]="userinfo",r[r.stringcmd=4]="stringcmd",r))(to||{});var no=(x=>(x[x.GUNSHOT=0]="GUNSHOT",x[x.BLOOD=1]="BLOOD",x[x.BLASTER=2]="BLASTER",x[x.RAILTRAIL=3]="RAILTRAIL",x[x.SHOTGUN=4]="SHOTGUN",x[x.EXPLOSION1=5]="EXPLOSION1",x[x.EXPLOSION2=6]="EXPLOSION2",x[x.ROCKET_EXPLOSION=7]="ROCKET_EXPLOSION",x[x.GRENADE_EXPLOSION=8]="GRENADE_EXPLOSION",x[x.SPARKS=9]="SPARKS",x[x.SPLASH=10]="SPLASH",x[x.BUBBLETRAIL=11]="BUBBLETRAIL",x[x.SCREEN_SPARKS=12]="SCREEN_SPARKS",x[x.SHIELD_SPARKS=13]="SHIELD_SPARKS",x[x.BULLET_SPARKS=14]="BULLET_SPARKS",x[x.LASER_SPARKS=15]="LASER_SPARKS",x[x.PARASITE_ATTACK=16]="PARASITE_ATTACK",x[x.ROCKET_EXPLOSION_WATER=17]="ROCKET_EXPLOSION_WATER",x[x.GRENADE_EXPLOSION_WATER=18]="GRENADE_EXPLOSION_WATER",x[x.MEDIC_CABLE_ATTACK=19]="MEDIC_CABLE_ATTACK",x[x.BFG_EXPLOSION=20]="BFG_EXPLOSION",x[x.BFG_BIGEXPLOSION=21]="BFG_BIGEXPLOSION",x[x.BOSSTPORT=22]="BOSSTPORT",x[x.BFG_LASER=23]="BFG_LASER",x[x.GRAPPLE_CABLE=24]="GRAPPLE_CABLE",x[x.WELDING_SPARKS=25]="WELDING_SPARKS",x[x.GREENBLOOD=26]="GREENBLOOD",x[x.BLUEHYPERBLASTER=27]="BLUEHYPERBLASTER",x[x.PLASMA_EXPLOSION=28]="PLASMA_EXPLOSION",x[x.TUNNEL_SPARKS=29]="TUNNEL_SPARKS",x[x.BLASTER2=30]="BLASTER2",x[x.RAILTRAIL2=31]="RAILTRAIL2",x[x.FLAME=32]="FLAME",x[x.LIGHTNING=33]="LIGHTNING",x[x.DEBUGTRAIL=34]="DEBUGTRAIL",x[x.PLAIN_EXPLOSION=35]="PLAIN_EXPLOSION",x[x.FLASHLIGHT=36]="FLASHLIGHT",x[x.FORCEWALL=37]="FORCEWALL",x[x.HEATBEAM=38]="HEATBEAM",x[x.MONSTER_HEATBEAM=39]="MONSTER_HEATBEAM",x[x.STEAM=40]="STEAM",x[x.BUBBLETRAIL2=41]="BUBBLETRAIL2",x[x.MOREBLOOD=42]="MOREBLOOD",x[x.HEATBEAM_SPARKS=43]="HEATBEAM_SPARKS",x[x.HEATBEAM_STEAM=44]="HEATBEAM_STEAM",x[x.CHAINFIST_SMOKE=45]="CHAINFIST_SMOKE",x[x.ELECTRIC_SPARKS=46]="ELECTRIC_SPARKS",x[x.TRACKER_EXPLOSION=47]="TRACKER_EXPLOSION",x[x.TELEPORT_EFFECT=48]="TELEPORT_EFFECT",x[x.DBALL_GOAL=49]="DBALL_GOAL",x[x.WIDOWBEAMOUT=50]="WIDOWBEAMOUT",x[x.NUKEBLAST=51]="NUKEBLAST",x[x.WIDOWSPLASH=52]="WIDOWSPLASH",x[x.EXPLOSION1_BIG=53]="EXPLOSION1_BIG",x[x.EXPLOSION1_NP=54]="EXPLOSION1_NP",x[x.FLECHETTE=55]="FLECHETTE",x[x.BLUEHYPERBLASTER_KEX=56]="BLUEHYPERBLASTER_KEX",x[x.BFG_ZAP=57]="BFG_ZAP",x[x.BERSERK_SLAM=58]="BERSERK_SLAM",x[x.GRAPPLE_CABLE_2=59]="GRAPPLE_CABLE_2",x[x.POWER_SPLASH=60]="POWER_SPLASH",x[x.LIGHTNING_BEAM=61]="LIGHTNING_BEAM",x[x.EXPLOSION1_NL=62]="EXPLOSION1_NL",x[x.EXPLOSION2_NL=63]="EXPLOSION2_NL",x))(no||{});var Hs=1024,Ks=256,Xs=16,Zs=64,Ys=512,Js=1400,js=0,qs=1,$s=2,Qs=3,ea=4,ta=5,na=6,oa=7,ra=8,ia=9,sa=10,aa=11,la=12,ca=13,ua=16,da=17,fa=18,ma=19,xa=20,pa=30,ha=31,ya=32,ba=33,ga=34,Sa=35,_a=36,Ta=37,Aa=38,Ma=39;var oo=(s=>(s[s.LAYOUTS_LAYOUT=1]="LAYOUTS_LAYOUT",s[s.LAYOUTS_INVENTORY=2]="LAYOUTS_INVENTORY",s[s.LAYOUTS_HIDE_HUD=4]="LAYOUTS_HIDE_HUD",s[s.LAYOUTS_INTERMISSION=8]="LAYOUTS_INTERMISSION",s[s.LAYOUTS_HELP=16]="LAYOUTS_HELP",s[s.LAYOUTS_HIDE_CROSSHAIR=32]="LAYOUTS_HIDE_CROSSHAIR",s))(oo||{});function Pt(t){return t<<16>>16}function ro(t,e,n){let o=Math.floor(n/2),i=n%2!==0,r=e+o,s=t[r]||0;if(i){let l=t[r+1]||0,c=s>>>8&255;return(l&255)<<8|c}else return s&65535}function va(t,e,n,o){let i=Math.floor(n/2),r=n%2!==0,s=e+i;if(t[s]===void 0&&(t[s]=0),!r)t[s]=Pt(o);else{t[s+1]===void 0&&(t[s+1]=0);let l=t[s],c=t[s+1],f=o&255,u=l&255|f<<8;t[s]=Pt(u);let m=o>>>8&255|c&65280;t[s+1]=Pt(m)}}function Ft(t,e,n,o,i){let r=i*n,s=Math.floor(r/8),l=r%8,c=(1<<i)-1<<l,u=ro(t,e,s)&~c|o<<l&c;va(t,e,s,u&65535)}function Et(t,e,n,o){let i=o*n,r=Math.floor(i/8),s=i%8,l=(1<<o)-1<<s;return(ro(t,e,r)&l)>>>s}var io=(V=>(V.QuadDamage="quad",V.Invulnerability="invulnerability",V.EnviroSuit="enviro_suit",V.Rebreather="rebreather",V.Silencer="silencer",V.PowerScreen="power_screen",V.PowerShield="power_shield",V.QuadFire="quad_fire",V.Invisibility="invisibility",V.Bandolier="bandolier",V.AmmoPack="ammo_pack",V.IRGoggles="ir_goggles",V.DoubleDamage="double_damage",V.SphereVengeance="sphere_vengeance",V.SphereHunter="sphere_hunter",V.SphereDefender="sphere_defender",V.Doppelganger="doppelganger",V.TagToken="tag_token",V.TechResistance="tech_resistance",V.TechStrength="tech_strength",V.TechHaste="tech_haste",V.TechRegeneration="tech_regeneration",V.Flashlight="flashlight",V.Compass="compass",V))(io||{});var so=(b=>(b[b.STAT_HEALTH_ICON=0]="STAT_HEALTH_ICON",b[b.STAT_HEALTH=1]="STAT_HEALTH",b[b.STAT_AMMO_ICON=2]="STAT_AMMO_ICON",b[b.STAT_AMMO=3]="STAT_AMMO",b[b.STAT_ARMOR_ICON=4]="STAT_ARMOR_ICON",b[b.STAT_ARMOR=5]="STAT_ARMOR",b[b.STAT_SELECTED_ICON=6]="STAT_SELECTED_ICON",b[b.STAT_PICKUP_ICON=7]="STAT_PICKUP_ICON",b[b.STAT_PICKUP_STRING=8]="STAT_PICKUP_STRING",b[b.STAT_TIMER_ICON=9]="STAT_TIMER_ICON",b[b.STAT_TIMER=10]="STAT_TIMER",b[b.STAT_HELPICON=11]="STAT_HELPICON",b[b.STAT_SELECTED_ITEM=12]="STAT_SELECTED_ITEM",b[b.STAT_LAYOUTS=13]="STAT_LAYOUTS",b[b.STAT_FRAGS=14]="STAT_FRAGS",b[b.STAT_FLASHES=15]="STAT_FLASHES",b[b.STAT_CHASE=16]="STAT_CHASE",b[b.STAT_SPECTATOR=17]="STAT_SPECTATOR",b[b.STAT_CTF_TEAM1_PIC=18]="STAT_CTF_TEAM1_PIC",b[b.STAT_CTF_TEAM1_CAPS=19]="STAT_CTF_TEAM1_CAPS",b[b.STAT_CTF_TEAM2_PIC=20]="STAT_CTF_TEAM2_PIC",b[b.STAT_CTF_TEAM2_CAPS=21]="STAT_CTF_TEAM2_CAPS",b[b.STAT_CTF_FLAG_PIC=22]="STAT_CTF_FLAG_PIC",b[b.STAT_CTF_JOINED_TEAM1_PIC=23]="STAT_CTF_JOINED_TEAM1_PIC",b[b.STAT_CTF_JOINED_TEAM2_PIC=24]="STAT_CTF_JOINED_TEAM2_PIC",b[b.STAT_CTF_TEAM1_HEADER=25]="STAT_CTF_TEAM1_HEADER",b[b.STAT_CTF_TEAM2_HEADER=26]="STAT_CTF_TEAM2_HEADER",b[b.STAT_CTF_TECH=27]="STAT_CTF_TECH",b[b.STAT_CTF_ID_VIEW=28]="STAT_CTF_ID_VIEW",b[b.STAT_CTF_MATCH=29]="STAT_CTF_MATCH",b[b.STAT_CTF_ID_VIEW_COLOR=30]="STAT_CTF_ID_VIEW_COLOR",b[b.STAT_CTF_TEAMINFO=31]="STAT_CTF_TEAMINFO",b[b.STAT_WEAPONS_OWNED_1=32]="STAT_WEAPONS_OWNED_1",b[b.STAT_WEAPONS_OWNED_2=33]="STAT_WEAPONS_OWNED_2",b[b.STAT_AMMO_INFO_START=34]="STAT_AMMO_INFO_START",b[b.STAT_POWERUP_INFO_START=41]="STAT_POWERUP_INFO_START",b[b.STAT_KEY_A=44]="STAT_KEY_A",b[b.STAT_KEY_B=45]="STAT_KEY_B",b[b.STAT_KEY_C=46]="STAT_KEY_C",b[b.STAT_ACTIVE_WHEEL_WEAPON=47]="STAT_ACTIVE_WHEEL_WEAPON",b[b.STAT_COOP_RESPAWN=48]="STAT_COOP_RESPAWN",b[b.STAT_LIVES=49]="STAT_LIVES",b[b.STAT_HIT_MARKER=50]="STAT_HIT_MARKER",b[b.STAT_SELECTED_ITEM_NAME=51]="STAT_SELECTED_ITEM_NAME",b[b.STAT_HEALTH_BARS=52]="STAT_HEALTH_BARS",b[b.STAT_ACTIVE_WEAPON=53]="STAT_ACTIVE_WEAPON",b[b.STAT_LAST=54]="STAT_LAST",b))(so||{}),Ye=12,Je=9,Na=Math.ceil(Ye*Je/16),je=23,qe=2,Va=Math.ceil(je*qe/16),ao={power_screen:0,power_shield:1,quad:3,quad_fire:4,invulnerability:5,invisibility:6,silencer:7,rebreather:8,enviro_suit:9,bandolier:10,ammo_pack:10,ir_goggles:11,double_damage:12,sphere_vengeance:13,sphere_hunter:14,sphere_defender:15,doppelganger:16,flashlight:17,compass:18,tech_resistance:19,tech_strength:20,tech_haste:21,tech_regeneration:22,tag_token:-1};function Ca(t,e,n){if(e<0||e>=Ye)return;let o=n;o>511&&(o=511),o<0&&(o=0),Ft(t,34,e,o,Je)}function Lt(t,e){return e<0||e>=Ye?0:Et(t,34,e,Je)}function Ra(t,e,n){let o;if(typeof e=="number"?o=e:o=ao[e],o===void 0||o<0||o>=je)return;let i=n;i>3&&(i=3),i<0&&(i=0),Ft(t,41,o,i,qe)}function Oa(t,e){let n;return typeof e=="number"?n=e:n=ao[e],n===void 0||n<0||n>=je?0:Et(t,41,n,qe)}function Pa(t,e){t.writeByte(e.msec),t.writeByte(e.buttons),t.writeAngle16(e.angles.x),t.writeAngle16(e.angles.y),t.writeAngle16(e.angles.z),t.writeShort(e.forwardmove),t.writeShort(e.sidemove),t.writeShort(e.upmove),t.writeByte(e.impulse),t.writeByte(0)}var lo=(p=>(p[p.MinLight=1]="MinLight",p[p.ViewerModel=2]="ViewerModel",p[p.WeaponModel=4]="WeaponModel",p[p.FullBright=8]="FullBright",p[p.DepthHack=16]="DepthHack",p[p.Translucent=32]="Translucent",p[p.FrameLerp=64]="FrameLerp",p[p.Beam=128]="Beam",p[p.CustomLight=256]="CustomLight",p[p.Glow=512]="Glow",p[p.ShellRed=1024]="ShellRed",p[p.ShellGreen=2048]="ShellGreen",p[p.ShellBlue=4096]="ShellBlue",p[p.IrVisible=32768]="IrVisible",p[p.ShellDouble=65536]="ShellDouble",p[p.ShellHalfDam=131072]="ShellHalfDam",p[p.MinLightPlus=262144]="MinLightPlus",p[p.ExtraLight=524288]="ExtraLight",p[p.BeamLightning=1048576]="BeamLightning",p[p.Flashlight=2097152]="Flashlight",p))(lo||{});var Fa=[0,145,227,114,7,150,228,117,14,159,237,124,9,152,234,123,28,141,255,110,27,138,248,105,18,131,241,96,21,132,246,103,56,169,219,74,63,174,220,77,54,167,213,68,49,160,210,67,36,181,199,86,35,178,192,81,42,187,201,88,45,188,206,95,112,225,147,2,119,230,148,5,126,239,157,12,121,232,154,11,108,253,143,30,107,250,136,25,98,243,129,16,101,244,134,23,72,217,171,58,79,222,172,61,70,215,165,52,65,208,162,51,84,197,183,38,83,194,176,33,90,203,185,40,93,204,190,47,224,113,3,146,231,118,4,149,238,127,13,156,233,120,10,155,252,109,31,142,251,106,24,137,242,99,17,128,245,100,22,135,216,73,59,170,223,78,60,173,214,71,53,164,209,64,50,163,196,85,39,182,195,82,32,177,202,91,41,184,205,92,46,191,144,1,115,226,151,6,116,229,158,15,125,236,153,8,122,235,140,29,111,254,139,26,104,249,130,19,97,240,133,20,102,247,168,57,75,218,175,62,76,221,166,55,69,212,161,48,66,211,180,37,86,199,179,34,80,193,186,43,89,200,189,44,94,207];function Ea(t){let e=0;for(let n=0;n<t.length;n++)e=Fa[(e^t[n])&255];return e}var co=(T=>(T[T.Rotate=4]="Rotate",T[T.Gib=8]="Gib",T[T.RotateScript=16]="RotateScript",T[T.Blaster=32]="Blaster",T[T.Rocket=64]="Rocket",T[T.Grenade=128]="Grenade",T[T.HyperBlaster=256]="HyperBlaster",T[T.Bfg=512]="Bfg",T[T.ColorShell=1024]="ColorShell",T[T.Powerscreen=2048]="Powerscreen",T[T.Anim01=4096]="Anim01",T[T.Anim23=8192]="Anim23",T[T.AnimAll=16384]="AnimAll",T[T.AnimAllFast=32768]="AnimAllFast",T[T.Quad=65536]="Quad",T[T.Pent=131072]="Pent",T[T.Explosion=262144]="Explosion",T[T.Teleport=524288]="Teleport",T[T.Flag1=1048576]="Flag1",T[T.Flag2=2097152]="Flag2",T[T.Boomerang=4194304]="Boomerang",T[T.Greengibs=8388608]="Greengibs",T[T.Bluehyperblaster=16777216]="Bluehyperblaster",T[T.Spinning=33554432]="Spinning",T[T.Plasma=67108864]="Plasma",T[T.Trap=134217728]="Trap",T[T.Tracker=268435456]="Tracker",T[T.Double=536870912]="Double",T[T.Sphinx=1073741824]="Sphinx",T[T.TagTrail=2147483648]="TagTrail",T))(co||{});var uo=(u=>(u[u.None=0]="None",u[u.ItemRespawn=1]="ItemRespawn",u[u.Footstep=2]="Footstep",u[u.FallShort=3]="FallShort",u[u.Fall=4]="Fall",u[u.FallFar=5]="FallFar",u[u.PlayerTeleport=6]="PlayerTeleport",u[u.OtherTeleport=7]="OtherTeleport",u[u.OtherFootstep=8]="OtherFootstep",u[u.LadderStep=9]="LadderStep",u))(uo||{});var wt=1,zt=2,Dt=4,It=8,Bt=16,Ut=32,fo=64,Me=128,ve=256,Gt=512,Wt=1024,kt=2048,Ht=4096,Kt=8192,Xt=16384,Zt=32768,Yt=65536,Jt=1<<17,jt=1<<18,qt=1<<19,$t=1<<20,Qt=1<<21,en=1<<22,tn=1<<23,mo=1<<24,nn=1<<25,on=1<<26,rn=1<<27,sn=1<<28,an=1<<29,ln=1<<30,cn=-2147483648,un=1,dn=2,fn=4,La={number:0,origin:{x:0,y:0,z:0},angles:{x:0,y:0,z:0},modelIndex:0,frame:0,skinNum:0,effects:0,renderfx:0,solid:0,sound:0,event:0,alpha:0,scale:0,instanceBits:0,loopVolume:0,loopAttenuation:0,owner:0,oldFrame:0,modelIndex2:0,modelIndex3:0,modelIndex4:0};function wa(t,e){let n=fo;t>=256&&(n|=ve),n&65280&&(n|=Me),e.writeByte(n&255),n&Me&&e.writeByte(n>>8&255),n&ve?e.writeShort(t):e.writeByte(t)}function za(t,e,n,o,i){let r=0,s=0;i&&(t=La),(e.modelIndex!==t.modelIndex||o)&&(r|=kt),(e.modelIndex2!==t.modelIndex2||o)&&(r|=$t),(e.modelIndex3!==t.modelIndex3||o)&&(r|=Qt),(e.modelIndex4!==t.modelIndex4||o)&&(r|=en),(e.origin.x!==t.origin.x||o)&&(r|=wt),(e.origin.y!==t.origin.y||o)&&(r|=zt),(e.origin.z!==t.origin.z||o)&&(r|=Gt),(e.angles.x!==t.angles.x||o)&&(r|=Wt),(e.angles.y!==t.angles.y||o)&&(r|=Dt),(e.angles.z!==t.angles.z||o)&&(r|=It),(e.frame!==t.frame||o)&&(e.frame>=256?r|=Jt:r|=Bt),(e.skinNum!==t.skinNum||o)&&(e.skinNum>=256?r|=nn:r|=Yt),(e.effects!==t.effects||o)&&(e.effects>=256?r|=qt:r|=Xt),(e.renderfx!==t.renderfx||o)&&(e.renderfx>=256?r|=jt:r|=Ht),(e.solid!==t.solid||o)&&(r|=rn),(e.sound!==t.sound||o)&&(r|=on),(e.event!==t.event||o)&&(r|=Ut),(e.alpha!==t.alpha||o)&&e.alpha!==void 0&&(r|=Kt),(e.scale!==t.scale||o)&&e.scale!==void 0&&(r|=sn),(e.instanceBits!==t.instanceBits||o)&&e.instanceBits!==void 0&&(r|=an),(e.loopVolume!==t.loopVolume||o)&&e.loopVolume!==void 0&&(r|=ln),(e.loopAttenuation!==t.loopAttenuation||o)&&e.loopAttenuation!==void 0&&(s|=un),(e.owner!==t.owner||o)&&e.owner!==void 0&&(s|=dn),(e.oldFrame!==t.oldFrame||o)&&e.oldFrame!==void 0&&(s|=fn),e.number>=256&&(r|=ve),s>0&&(r|=cn),r&4278190080&&(r|=tn),r&4294901760&&(r|=Zt),r&4294967040&&(r|=Me),n.writeByte(r&255),r&Me&&n.writeByte(r>>8&255),r&Zt&&n.writeByte(r>>16&255),r&tn&&n.writeByte(r>>24&255),r&cn&&n.writeByte(s&255),r&ve?n.writeShort(e.number):n.writeByte(e.number),r&kt&&n.writeByte(e.modelIndex),r&$t&&n.writeByte(e.modelIndex2??0),r&Qt&&n.writeByte(e.modelIndex3??0),r&en&&n.writeByte(e.modelIndex4??0),r&Bt&&n.writeByte(e.frame),r&Jt&&n.writeShort(e.frame),r&Yt&&n.writeByte(e.skinNum),r&nn&&n.writeShort(e.skinNum),r&Xt&&n.writeByte(e.effects),r&qt&&n.writeShort(e.effects),r&Ht&&n.writeByte(e.renderfx),r&jt&&n.writeShort(e.renderfx),r&wt&&n.writeCoord(e.origin.x),r&zt&&n.writeCoord(e.origin.y),r&Gt&&n.writeCoord(e.origin.z),r&Wt&&n.writeAngle(e.angles.x),r&Dt&&n.writeAngle(e.angles.y),r&It&&n.writeAngle(e.angles.z),r&mo,r&on&&n.writeByte(e.sound??0),r&Ut&&n.writeByte(e.event??0),r&rn&&n.writeShort(e.solid),r&Kt&&n.writeByte(Math.floor((e.alpha??0)*255)),r&sn&&n.writeFloat(e.scale??0),r&an&&n.writeLong(e.instanceBits??0),r&ln&&n.writeByte(Math.floor((e.loopVolume??0)*255)),s&un&&n.writeByte(Math.floor((e.loopAttenuation??0)*255)),s&dn&&n.writeShort(e.owner??0),s&fn&&n.writeShort(e.oldFrame??0)}var xo=1,po=2,ho=4,yo=8,bo=16,go=32,So=64,_o=128,To=256,Ao=512,Mo=1024,vo=2048,No=4096,Vo=8192,Co=16384,Ro=32768;function Da(t,e){let n=0;e.pm_type!==0&&(n|=xo),(e.origin.x!==0||e.origin.y!==0||e.origin.z!==0)&&(n|=po),(e.velocity.x!==0||e.velocity.y!==0||e.velocity.z!==0)&&(n|=ho),e.pm_time!==0&&(n|=yo),e.pm_flags!==0&&(n|=bo),e.gravity!==0&&(n|=go),(e.delta_angles.x!==0||e.delta_angles.y!==0||e.delta_angles.z!==0)&&(n|=So),(e.viewoffset.x!==0||e.viewoffset.y!==0||e.viewoffset.z!==0)&&(n|=_o),(e.viewangles.x!==0||e.viewangles.y!==0||e.viewangles.z!==0)&&(n|=To),(e.kick_angles.x!==0||e.kick_angles.y!==0||e.kick_angles.z!==0)&&(n|=Ao),e.gun_index!==0&&(n|=No),(e.gun_frame!==0||e.gun_offset.x!==0||e.gun_offset.y!==0||e.gun_offset.z!==0||e.gun_angles.x!==0||e.gun_angles.y!==0||e.gun_angles.z!==0)&&(n|=Vo),e.blend&&(e.blend[0]!==0||e.blend[1]!==0||e.blend[2]!==0||e.blend[3]!==0)&&(n|=Mo),e.fov!==0&&(n|=vo),e.rdflags!==0&&(n|=Co),e.watertype!==0&&(n|=Ro);let o=0;for(let i=0;i<32;i++)e.stats[i]&&e.stats[i]!==0&&(o|=1<<i);t.writeShort(n),n&xo&&t.writeByte(e.pm_type),n&po&&(t.writeShort(Math.round(e.origin.x*8)),t.writeShort(Math.round(e.origin.y*8)),t.writeShort(Math.round(e.origin.z*8))),n&ho&&(t.writeShort(Math.round(e.velocity.x*8)),t.writeShort(Math.round(e.velocity.y*8)),t.writeShort(Math.round(e.velocity.z*8))),n&yo&&t.writeByte(e.pm_time),n&bo&&t.writeByte(e.pm_flags),n&go&&t.writeShort(e.gravity),n&So&&(t.writeShort(Math.round(e.delta_angles.x*(32768/180))),t.writeShort(Math.round(e.delta_angles.y*(32768/180))),t.writeShort(Math.round(e.delta_angles.z*(32768/180)))),n&_o&&(t.writeChar(Math.round(e.viewoffset.x*4)),t.writeChar(Math.round(e.viewoffset.y*4)),t.writeChar(Math.round(e.viewoffset.z*4))),n&To&&(t.writeAngle16(e.viewangles.x),t.writeAngle16(e.viewangles.y),t.writeAngle16(e.viewangles.z)),n&Ao&&(t.writeChar(Math.round(e.kick_angles.x*4)),t.writeChar(Math.round(e.kick_angles.y*4)),t.writeChar(Math.round(e.kick_angles.z*4))),n&No&&t.writeByte(e.gun_index),n&Vo&&(t.writeByte(e.gun_frame),t.writeChar(Math.round(e.gun_offset.x*4)),t.writeChar(Math.round(e.gun_offset.y*4)),t.writeChar(Math.round(e.gun_offset.z*4)),t.writeChar(Math.round(e.gun_angles.x*4)),t.writeChar(Math.round(e.gun_angles.y*4)),t.writeChar(Math.round(e.gun_angles.z*4))),n&Mo&&(t.writeByte(Math.round(e.blend[0])),t.writeByte(Math.round(e.blend[1])),t.writeByte(Math.round(e.blend[2])),t.writeByte(Math.round(e.blend[3]))),n&vo&&t.writeByte(e.fov),n&Co&&t.writeByte(e.rdflags),n&Ro&&t.writeByte(e.watertype),t.writeLong(o);for(let i=0;i<32;i++)o&1<<i&&t.writeShort(e.stats[i])}var Ne=.025,$e={None:0,Feet:1,Waist:2,Under:3},Ia=(t,e)=>{let n={...t.origin};n.z-=.25;let o=e(t.origin,n);return{...t,onGround:o.fraction<1}},Ba=(t,e)=>{let n={...t.origin},{mins:o,maxs:i}=t;n.z=t.origin.z+o.z+1;let r=e(n);if(!(r&56))return{...t,waterLevel:$e.None,watertype:0};let s=$e.Feet,l=r,c=t.origin.z+(o.z+i.z)*.5;n.z=c;let f=e(n);if(f&56){s=$e.Waist,l=f;let u=t.origin.z+22;n.z=u;let a=e(n);a&56&&(s=$e.Under,l=a)}return{...t,waterLevel:s,watertype:l}},Ua=(t,e,n,o)=>{let i={...t};i=Ia(i,n),i=Ba(i,o);let{origin:r,velocity:s,onGround:l,waterLevel:c,viewAngles:f}=i,u=c>=2?f:{x:f.x>180?(f.x-360)/3:f.x/3,y:f.y,z:f.z},{forward:a,right:m}=re(u),h=Ke({velocity:s,frametime:Ne,onGround:l,groundIsSlick:!1,onLadder:!1,waterlevel:c,pmFriction:6,pmStopSpeed:100,pmWaterFriction:1}),d=c>=2?Nt({forward:a,right:m,cmd:e,maxSpeed:320}):vt({forward:a,right:m,cmd:e,maxSpeed:320}),S=J({velocity:h,wishdir:d.wishdir,wishspeed:d.wishspeed,accel:l||c>=2?10:1,frametime:Ne}),_=n(r,{x:r.x+S.x*Ne,y:r.y+S.y*Ne,z:r.z+S.z*Ne});return{...i,origin:_.endpos,velocity:S}};var mn=class{constructor(e){e instanceof Uint8Array?this.view=new DataView(e.buffer,e.byteOffset,e.byteLength):this.view=new DataView(e),this.offset=0,this.length=this.view.byteLength}getPosition(){return this.offset}getReadPosition(){return this.offset}getLength(){return this.length}getRemaining(){return this.length-this.offset}seek(e){if(e<0||e>this.length)throw new Error(`Seek out of bounds: ${e} (length: ${this.length})`);this.offset=e}setReadPosition(e){this.seek(e)}hasMore(){return this.offset<this.length}hasBytes(e){return this.offset+e<=this.length}readChar(){let e=this.view.getInt8(this.offset);return this.offset+=1,e}readByte(){let e=this.view.getUint8(this.offset);return this.offset+=1,e}readShort(){let e=this.view.getInt16(this.offset,!0);return this.offset+=2,e}readUShort(){let e=this.view.getUint16(this.offset,!0);return this.offset+=2,e}readLong(){let e=this.view.getInt32(this.offset,!0);return this.offset+=4,e}readULong(){let e=this.view.getUint32(this.offset,!0);return this.offset+=4,e}readFloat(){let e=this.view.getFloat32(this.offset,!0);return this.offset+=4,e}readString(){let e="";for(;this.offset<this.length;){let n=this.readChar();if(n===-1||n===0)break;e+=String.fromCharCode(n)}return e}readStringLine(){let e="";for(;this.offset<this.length;){let n=this.readChar();if(n===-1||n===0||n===10)break;e+=String.fromCharCode(n)}return e}readCoord(){return this.readShort()*(1/8)}readAngle(){return this.readChar()*(360/256)}readAngle16(){return this.readShort()*360/65536}readData(e){if(this.offset+e>this.length)throw new Error(`Read out of bounds: ${this.offset+e} (length: ${this.length})`);let n=new Uint8Array(this.view.buffer,this.view.byteOffset+this.offset,e);return this.offset+=e,new Uint8Array(n)}readPos(e){e.x=this.readCoord(),e.y=this.readCoord(),e.z=this.readCoord()}readDir(e){let n=this.readByte();if(n>=162){e.x=0,e.y=0,e.z=0;return}let o=j[n];e.x=o[0],e.y=o[1],e.z=o[2]}};var Ve=class{constructor(e=1400){typeof e=="number"?(this.buffer=new Uint8Array(e),this.fixed=!1):(this.buffer=e,this.fixed=!0),this.view=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),this.offset=0}ensureSpace(e){if(this.offset+e>this.buffer.byteLength){if(this.fixed)throw new Error(`Buffer overflow: capacity ${this.buffer.byteLength}, needed ${this.offset+e}`);let n=Math.max(this.buffer.byteLength*2,this.offset+e),o=new Uint8Array(n);o.set(this.buffer),this.buffer=o,this.view=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength)}}writeByte(e){this.ensureSpace(1),this.view.setUint8(this.offset,e),this.offset+=1}writeBytes(e){this.ensureSpace(e.byteLength),this.buffer.set(e,this.offset),this.offset+=e.byteLength}writeChar(e){this.ensureSpace(1),this.view.setInt8(this.offset,e),this.offset+=1}writeShort(e){this.ensureSpace(2),this.view.setInt16(this.offset,e,!0),this.offset+=2}writeLong(e){this.ensureSpace(4),this.view.setInt32(this.offset,e,!0),this.offset+=4}writeFloat(e){this.ensureSpace(4),this.view.setFloat32(this.offset,e,!0),this.offset+=4}writeString(e){let n=e.length;this.ensureSpace(n+1);for(let o=0;o<n;o++)this.view.setUint8(this.offset+o,e.charCodeAt(o));this.view.setUint8(this.offset+n,0),this.offset+=n+1}writeCoord(e){this.writeShort(Math.trunc(e*8))}writeAngle(e){this.writeByte(Math.trunc(e*256/360)&255)}writeAngle16(e){this.writeShort(Math.trunc(e*65536/360)&65535)}writePos(e){this.writeCoord(e.x),this.writeCoord(e.y),this.writeCoord(e.z)}writeDir(e){let n=-1,o=0;if(e.x===0&&e.y===0&&e.z===0){this.writeByte(0);return}for(let i=0;i<j.length;i++){let r=j[i],s=e.x*r[0]+e.y*r[1]+e.z*r[2];s>n&&(n=s,o=i)}this.writeByte(o)}getData(){return this.buffer.slice(0,this.offset)}getBuffer(){return this.buffer}getOffset(){return this.offset}reset(){this.offset=0}};var xn=class{constructor(e=1024){this.buffer=new Uint8Array(e),this.view=new DataView(this.buffer.buffer),this.offset=0}ensureCapacity(e){if(this.offset+e>this.buffer.length){let n=Math.max(this.buffer.length*2,this.offset+e),o=new Uint8Array(n);o.set(this.buffer),this.buffer=o,this.view=new DataView(this.buffer.buffer)}}getData(){return this.buffer.slice(0,this.offset)}writeByte(e){this.ensureCapacity(1),this.view.setUint8(this.offset,e),this.offset+=1}writeChar(e){this.ensureCapacity(1),this.view.setInt8(this.offset,e),this.offset+=1}writeShort(e){this.ensureCapacity(2),this.view.setInt16(this.offset,e,!0),this.offset+=2}writeUShort(e){this.ensureCapacity(2),this.view.setUint16(this.offset,e,!0),this.offset+=2}writeLong(e){this.ensureCapacity(4),this.view.setInt32(this.offset,e,!0),this.offset+=4}writeFloat(e){this.ensureCapacity(4),this.view.setFloat32(this.offset,e,!0),this.offset+=4}writeString(e){let n=e.length+1;this.ensureCapacity(n);for(let o=0;o<e.length;o++)this.view.setUint8(this.offset+o,e.charCodeAt(o));this.view.setUint8(this.offset+e.length,0),this.offset+=n}writeData(e){this.ensureCapacity(e.length),this.buffer.set(e,this.offset),this.offset+=e.length}writeCoord(e){this.writeShort(Math.round(e*8))}writeAngle(e){this.writeByte(Math.round(e*256/360)&255)}writeAngle16(e){this.writeShort(Math.round(e*65536/360))}writeDir(e,n,o){let i=0,r=-999999,s=Math.sqrt(e*e+n*n+o*o);if(s>0){e/=s,n/=s,o/=s;for(let l=0;l<162;l++){let c=e*j[l][0]+n*j[l][1]+o*j[l][2];c>r&&(r=c,i=l)}}this.writeByte(i)}};var w=class w{constructor(){this.qport=0;this.incomingSequence=0;this.outgoingSequence=0;this.incomingAcknowledged=0;this.incomingReliableAcknowledged=!1;this.incomingReliableSequence=0;this.outgoingReliableSequence=0;this.reliableLength=0;this.fragmentSendOffset=0;this.fragmentBuffer=null;this.fragmentLength=0;this.fragmentReceived=0;this.lastReceived=0;this.lastSent=0;this.remoteAddress=null;this.reliableMessage=new Ve(w.MAX_RELIABLE_BUFFER);let e=Date.now();this.lastReceived=e,this.lastSent=e,this.qport=Math.floor(Math.random()*65536)}setup(e,n=null){this.qport=e,this.remoteAddress=n,this.reset()}reset(){this.incomingSequence=0,this.outgoingSequence=0,this.incomingAcknowledged=0,this.incomingReliableAcknowledged=!1,this.incomingReliableSequence=0,this.outgoingReliableSequence=0,this.reliableLength=0,this.reliableMessage.reset(),this.fragmentSendOffset=0,this.fragmentBuffer=null,this.fragmentLength=0,this.fragmentReceived=0,this.lastReceived=Date.now(),this.lastSent=Date.now()}transmit(e){this.outgoingSequence++,this.lastSent=Date.now();let n=0,o=!1,i=0;this.reliableLength>0&&(this.reliableLength>w.FRAGMENT_SIZE?(o=!0,this.fragmentSendOffset>=this.reliableLength&&(this.fragmentSendOffset=0),n=this.reliableLength-this.fragmentSendOffset,n>w.FRAGMENT_SIZE&&(n=w.FRAGMENT_SIZE),i=this.fragmentSendOffset,this.fragmentSendOffset+=n):n=this.reliableLength);let r=w.PACKET_HEADER,s=n>0?2+(o?8:0):0,l=e?e.length:0;r+s+n+l>w.MAX_MSGLEN&&(l=w.MAX_MSGLEN-r-s-n,l<0&&(l=0));let c=new ArrayBuffer(r+s+n+l),f=new DataView(c),u=new Uint8Array(c),a=this.outgoingSequence;n>0&&(a|=2147483648,(this.outgoingReliableSequence&1)!==0&&(a|=1073741824)),f.setUint32(0,a,!0);let m=this.incomingSequence;(this.incomingReliableSequence&1)!==0&&(m|=2147483648),f.setUint32(4,m,!0),f.setUint16(8,this.qport,!0);let h=r;if(n>0){let d=n;o&&(d|=32768),f.setUint16(h,d,!0),h+=2,o&&(f.setUint32(h,i,!0),h+=4,f.setUint32(h,this.reliableLength,!0),h+=4);let _=this.reliableMessage.getBuffer().subarray(i,i+n);u.set(_,h),h+=n}if(e&&l>0){let d=e.slice(0,l);u.set(d,h)}return u}process(e){if(e.length<4)return null;this.lastReceived=Date.now();let n=new DataView(e.buffer,e.byteOffset,e.byteLength),o=n.getUint32(0,!0);if(o===4294967295)return e.subarray(4);if(e.length<w.PACKET_HEADER)return null;let i=n.getUint32(4,!0),r=n.getUint16(8,!0);if(this.qport!==r)return null;let s=o&1073741823;if((s-this.incomingSequence|0)<=0)return null;this.incomingSequence=s;let l=i&2147483647,c=(i&2147483648)!==0;if(l>this.incomingAcknowledged&&(this.incomingAcknowledged=l),this.reliableLength>0){let d=c?1:0,S=this.outgoingReliableSequence&1;d!==S&&(this.reliableLength=0,this.reliableMessage.reset(),this.outgoingReliableSequence^=1,this.fragmentSendOffset=0)}let f=(o&2147483648)!==0,u=(o&1073741824)!==0?1:0,a=w.PACKET_HEADER,m=null;if(f){if(a+2>e.byteLength)return null;let d=n.getUint16(a,!0);a+=2;let S=(d&32768)!==0;d&=32767;let _=this.incomingReliableSequence&1;if(u===_)if(S){if(a+8>e.byteLength)return null;let A=n.getUint32(a,!0);a+=4;let M=n.getUint32(a,!0);if(a+=4,M>w.MAX_RELIABLE_BUFFER)return console.warn(`NetChan: received invalid fragment total ${M} > ${w.MAX_RELIABLE_BUFFER}`),null;if((!this.fragmentBuffer||this.fragmentBuffer.length!==M)&&(this.fragmentBuffer=new Uint8Array(M),this.fragmentLength=M,this.fragmentReceived=0),a+d>e.byteLength)return null;let v=e.subarray(a,a+d);A===this.fragmentReceived&&A+d<=M&&(this.fragmentBuffer.set(v,A),this.fragmentReceived+=d,this.fragmentReceived>=M&&(m=this.fragmentBuffer,this.incomingReliableSequence++,this.fragmentBuffer=null,this.fragmentLength=0,this.fragmentReceived=0))}else{if(this.incomingReliableSequence++,a+d>e.byteLength)return null;m=e.slice(a,a+d)}a+=d}let h=e.slice(a);if(m&&m.length>0){let d=m.length+h.length,S=new Uint8Array(d);return S.set(m,0),S.set(h,m.length),S}return h||new Uint8Array(0)}canSendReliable(){return this.reliableLength===0}writeReliableByte(e){if(this.reliableLength+1>w.MAX_RELIABLE_BUFFER)throw new Error("NetChan reliable buffer overflow");this.reliableMessage.writeByte(e),this.reliableLength++}writeReliableShort(e){if(this.reliableLength+2>w.MAX_RELIABLE_BUFFER)throw new Error("NetChan reliable buffer overflow");this.reliableMessage.writeShort(e),this.reliableLength+=2}writeReliableLong(e){if(this.reliableLength+4>w.MAX_RELIABLE_BUFFER)throw new Error("NetChan reliable buffer overflow");this.reliableMessage.writeLong(e),this.reliableLength+=4}writeReliableString(e){let n=e.length+1;if(this.reliableLength+n>w.MAX_RELIABLE_BUFFER)throw new Error("NetChan reliable buffer overflow");this.reliableMessage.writeString(e),this.reliableLength+=n}getReliableData(){return this.reliableLength===0?new Uint8Array(0):this.reliableMessage.getBuffer().subarray(0,this.reliableLength)}needsKeepalive(e){return e-this.lastSent>1e3}isTimedOut(e,n=3e4){return e-this.lastReceived>n}};w.MAX_MSGLEN=1400,w.FRAGMENT_SIZE=1024,w.PACKET_HEADER=10,w.HEADER_OVERHEAD=w.PACKET_HEADER+2,w.MAX_RELIABLE_BUFFER=262144;var pn=w;var Qe=(p=>(p.Blaster="blaster",p.Shotgun="shotgun",p.SuperShotgun="supershotgun",p.Machinegun="machinegun",p.Chaingun="chaingun",p.HandGrenade="grenades",p.GrenadeLauncher="grenadelauncher",p.RocketLauncher="rocketlauncher",p.HyperBlaster="hyperblaster",p.Railgun="railgun",p.BFG10K="bfg10k",p.Grapple="grapple",p.ChainFist="chainfist",p.EtfRifle="etf_rifle",p.ProxLauncher="prox_launcher",p.IonRipper="ionripper",p.PlasmaBeam="plasmabeam",p.Phalanx="phalanx",p.Disruptor="disruptor",p.Trap="trap",p))(Qe||{});var et=(d=>(d[d.Bullets=0]="Bullets",d[d.Shells=1]="Shells",d[d.Rockets=2]="Rockets",d[d.Grenades=3]="Grenades",d[d.Cells=4]="Cells",d[d.Slugs=5]="Slugs",d[d.MagSlugs=6]="MagSlugs",d[d.Trap=7]="Trap",d[d.Flechettes=8]="Flechettes",d[d.Tesla=9]="Tesla",d[d.Disruptor=10]="Disruptor",d[d.Prox=11]="Prox",d[d.Nuke=12]="Nuke",d[d.Rounds=13]="Rounds",d))(et||{}),Ga=Object.keys(et).length/2,tt=(m=>(m.Shells="ammo_shells",m.Bullets="ammo_bullets",m.Rockets="ammo_rockets",m.Grenades="ammo_grenades",m.Cells="ammo_cells",m.Slugs="ammo_slugs",m.MagSlugs="ammo_magslug",m.Flechettes="ammo_flechettes",m.Disruptor="ammo_disruptor",m.Tesla="ammo_tesla",m.Trap="ammo_trap",m.Prox="ammo_prox",m))(tt||{});var Wa=["blaster","shotgun","supershotgun","machinegun","chaingun","grenadelauncher","rocketlauncher","grenades","hyperblaster","railgun","bfg10k"],hn={blaster:null,shotgun:1,supershotgun:1,machinegun:0,chaingun:0,grenades:3,grenadelauncher:3,rocketlauncher:2,hyperblaster:4,railgun:5,bfg10k:4,grapple:null,chainfist:null,etf_rifle:8,prox_launcher:11,ionripper:4,plasmabeam:4,phalanx:6,disruptor:10,trap:7};var B0=32,Oo=(a=>(a[a.Auto=0]="Auto",a[a.Weapon=1]="Weapon",a[a.Voice=2]="Voice",a[a.Item=3]="Item",a[a.Body=4]="Body",a[a.Aux=5]="Aux",a[a.Footstep=6]="Footstep",a[a.Aux3=7]="Aux3",a[a.NoPhsAdd=8]="NoPhsAdd",a[a.Reliable=16]="Reliable",a[a.ForcePos=32]="ForcePos",a))(Oo||{}),U0=-1,G0=0,W0=1,k0=2,H0=3,K0=80,X0=.003;function Po(t){return t*.001}function ka(t){let e=Po(t);return e<=0?Number.POSITIVE_INFINITY:80+1/e}var Fo={ammo_shells:1,ammo_bullets:0,ammo_rockets:2,ammo_grenades:3,ammo_cells:4,ammo_slugs:5,ammo_magslug:6,ammo_flechettes:8,ammo_disruptor:10,ammo_tesla:9,ammo_trap:7,ammo_prox:11};function Ha(t,e){let n;if(Object.values(tt).includes(e))n=Fo[e];else if(Object.values(Qe).includes(e)&&(n=hn[e],n===null))return-1;return n==null?0:Lt(t.stats,n)}function Ka(t,e,n){let o=e.stats[t];if(o===void 0||o<=0)return;let i=K.Images+o;if(!(i<0||i>=n.length))return n[i]}var Xa=(t,e,n,o,i)=>t.x+e.x>o.x&&t.x+n.x<i.x&&t.y+e.y>o.y&&t.y+n.y<i.y&&t.z+e.z>o.z&&t.z+n.z<i.z,Za=(t,e,n,o)=>{let i=n??{x:-16,y:-16,z:-24},r=o??{x:16,y:16,z:32},s=8,l=0,c=Math.abs(e.z-t.z)<1,f=e.z<t.z,u=e.z+i.z,a=t.z+i.z,m=e.x+r.x;if(c&&e.z<s&&m>l&&t.x+r.x<=l)return{allsolid:!1,startsolid:!1,fraction:0,endpos:t,planeNormal:{x:-1,y:0,z:0},contents:1};if(f&&e.x>=l){let h=s-i.z;if(a>s&&u<s){let d=(s-a)/(u-a),S=Math.max(0,Math.min(1,d)),_=t.x+S*(e.x-t.x),A=t.y+S*(e.y-t.y),M=t.z+S*(e.z-t.z);return{allsolid:!1,startsolid:!1,fraction:S,endpos:{x:_,y:A,z:M},planeNormal:{x:0,y:0,z:1},contents:1}}}if(f&&u<0){let h=-i.z;if(a>=0){let d=(0-a)/(u-a),S=Math.max(0,Math.min(1,d)),_=t.x+S*(e.x-t.x),A=t.y+S*(e.y-t.y),M=t.z+S*(e.z-t.z);return{allsolid:!1,startsolid:!1,fraction:S,endpos:{x:_,y:A,z:M},planeNormal:{x:0,y:0,z:1},contents:1}}return{allsolid:!1,startsolid:!1,fraction:0,endpos:t,planeNormal:{x:0,y:0,z:1},contents:1}}return{allsolid:!1,startsolid:!1,fraction:1,endpos:e,contents:0}},Ya=(t,e,n,o)=>{let i=n??{x:-16,y:-16,z:-24},r=o??{x:16,y:16,z:32},s=0,m=e.x+i.x<8&&e.x+r.x>s&&e.y+i.y<16&&e.y+r.y>-16&&e.z+i.z<100&&e.z+r.z>0;return t.x<s&&e.x>=s&&Math.abs(e.z-t.z)<.1?{allsolid:!1,startsolid:!1,fraction:0,endpos:t,planeNormal:{x:-1,y:0,z:0},contents:536870912}:m?{allsolid:!1,startsolid:!1,fraction:1,endpos:e,contents:536870912}:e.z+i.z<=0?{allsolid:!1,startsolid:!1,fraction:0,endpos:t,planeNormal:{x:0,y:0,z:1},contents:1}:{allsolid:!1,startsolid:!1,fraction:1,endpos:e,contents:0}};return Io(Ja);})();
|
|
2
2
|
//# sourceMappingURL=index.global.js.map
|