quake2ts 0.0.296 → 0.0.298
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/package.json +1 -1
- package/packages/cgame/dist/index.cjs +3 -1
- package/packages/cgame/dist/index.cjs.map +1 -1
- package/packages/cgame/dist/index.js +3 -1
- package/packages/cgame/dist/index.js.map +1 -1
- package/packages/client/dist/browser/index.global.js +13 -13
- package/packages/client/dist/browser/index.global.js.map +1 -1
- package/packages/client/dist/cjs/index.cjs +20 -11
- package/packages/client/dist/cjs/index.cjs.map +1 -1
- package/packages/client/dist/esm/index.js +20 -11
- package/packages/client/dist/esm/index.js.map +1 -1
- package/packages/client/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/engine/dist/browser/index.global.js +8 -8
- package/packages/engine/dist/browser/index.global.js.map +1 -1
- package/packages/engine/dist/cjs/index.cjs +11 -2
- package/packages/engine/dist/cjs/index.cjs.map +1 -1
- package/packages/engine/dist/esm/index.js +11 -2
- package/packages/engine/dist/esm/index.js.map +1 -1
- package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/engine/dist/types/demo/parser.d.ts.map +1 -1
- package/packages/game/dist/browser/index.global.js +4 -4
- package/packages/game/dist/browser/index.global.js.map +1 -1
- package/packages/game/dist/cjs/index.cjs +67 -20
- package/packages/game/dist/cjs/index.cjs.map +1 -1
- package/packages/game/dist/esm/index.js +67 -20
- package/packages/game/dist/esm/index.js.map +1 -1
- package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/game/dist/types/ai/movement.d.ts.map +1 -1
- package/packages/shared/dist/browser/index.global.js +1 -1
- package/packages/shared/dist/browser/index.global.js.map +1 -1
- package/packages/shared/dist/cjs/index.cjs +1342 -1038
- package/packages/shared/dist/cjs/index.cjs.map +1 -1
- package/packages/shared/dist/esm/index.js +1340 -1038
- package/packages/shared/dist/esm/index.js.map +1 -1
- package/packages/shared/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/shared/dist/types/pmove/jump.d.ts +2 -0
- package/packages/shared/dist/types/pmove/jump.d.ts.map +1 -1
- package/packages/shared/dist/types/pmove/move.d.ts +20 -0
- package/packages/shared/dist/types/pmove/move.d.ts.map +1 -1
- package/packages/shared/dist/types/pmove/pmove.d.ts +5 -1
- package/packages/shared/dist/types/pmove/pmove.d.ts.map +1 -1
- package/packages/shared/dist/types/pmove/types.d.ts +25 -1
- package/packages/shared/dist/types/pmove/types.d.ts.map +1 -1
- package/packages/tools/dist/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"movement.d.ts","sourceRoot":"","sources":["../../../src/ai/movement.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"movement.d.ts","sourceRoot":"","sources":["../../../src/ai/movement.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAqB1D;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAOpF;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAwBlE;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CASjD;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAE5D;AAgBD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI,CAKxF;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI,CA0BzG;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CASlF;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI,CA8BxG;AAED,wBAAgB,OAAO,CACrB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GACnB,IAAI,CAWN;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI,CAc3G;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI,CA0BrE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CA8C1E;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAsJ7G;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAgBxG;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI,CAsB5G"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var Quake2Shared=(()=>{var Xe=Object.defineProperty;var Nn=Object.getOwnPropertyDescriptor;var Vn=Object.getOwnPropertyNames;var Cn=Object.prototype.hasOwnProperty;var Je=(t,e)=>{for(var n in e)Xe(t,n,{get:e[n],enumerable:!0})},On=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Vn(e))!Cn.call(t,r)&&r!==n&&Xe(t,r,{get:()=>e[r],enumerable:!(o=Nn(e,r))||o.enumerable});return t};var Rn=t=>On(Xe({},"__esModule",{value:!0}),t);var Ei={};Je(Ei,{AMMO_MAX:()=>Ge,AMMO_TYPE_COUNT:()=>Si,ANORMS:()=>J,ATTN_IDLE:()=>il,ATTN_LOOP_NONE:()=>ol,ATTN_NONE:()=>rl,ATTN_NORM:()=>sl,ATTN_STATIC:()=>cl,AmmoItemId:()=>_n,AmmoType:()=>Ct,BinaryStream:()=>Et,BinaryWriter:()=>_e,CGAME_EXPORT_KEYS:()=>tr,CGAME_IMPORT_KEYS:()=>er,CMD_BACKUP:()=>Es,CONTENTS_AREAPORTAL:()=>Ii,CONTENTS_AUX:()=>wi,CONTENTS_CURRENT_0:()=>so,CONTENTS_CURRENT_180:()=>co,CONTENTS_CURRENT_270:()=>ao,CONTENTS_CURRENT_90:()=>io,CONTENTS_CURRENT_DOWN:()=>uo,CONTENTS_CURRENT_UP:()=>lo,CONTENTS_DEADMONSTER:()=>Ki,CONTENTS_DETAIL:()=>Xi,CONTENTS_LADDER:()=>Pt,CONTENTS_LAVA:()=>zi,CONTENTS_MIST:()=>Ui,CONTENTS_MONSTER:()=>Hi,CONTENTS_MONSTERCLIP:()=>Wi,CONTENTS_NONE:()=>Oe,CONTENTS_NO_WATERJUMP:()=>ro,CONTENTS_ORIGIN:()=>ki,CONTENTS_PLAYER:()=>Yi,CONTENTS_PLAYERCLIP:()=>Gi,CONTENTS_PROJECTILE:()=>ji,CONTENTS_PROJECTILECLIP:()=>Bi,CONTENTS_SLIME:()=>Fi,CONTENTS_SOLID:()=>Li,CONTENTS_TRANSLUCENT:()=>Ji,CONTENTS_TRIGGER:()=>oo,CONTENTS_WATER:()=>Di,CONTENTS_WINDOW:()=>Pi,CS_MAX_STRING_LENGTH:()=>zc,CS_MAX_STRING_LENGTH_OLD:()=>Fc,ClientCommand:()=>dn,CollisionEntityIndex:()=>Qe,ConfigStringIndex:()=>ae,CvarFlags:()=>Wt,DEFAULT_FORWARD_SPEED:()=>ds,DEFAULT_MOUSE_SENSITIVITY:()=>bs,DEFAULT_PITCH_SPEED:()=>hs,DEFAULT_SIDE_SPEED:()=>ms,DEFAULT_UP_SPEED:()=>xs,DEFAULT_YAW_SPEED:()=>ps,DEG2RAD:()=>Jn,DIST_EPSILON:()=>Z,EntityFlags:()=>At,GAME_EXPORT_KEYS:()=>Qo,GAME_IMPORT_KEYS:()=>$o,G_GetAmmoStat:()=>Ks,G_GetPowerupStat:()=>Js,G_SetAmmoStat:()=>Hs,G_SetPowerupStat:()=>Xs,LAST_VISIBLE_CONTENTS:()=>Zi,LayoutFlags:()=>xn,MASK_ALL:()=>fc,MASK_BLOCK_SIGHT:()=>bc,MASK_CURRENT:()=>fo,MASK_DEADSOLID:()=>mc,MASK_LADDER_NAV_SOLID:()=>Tc,MASK_MONSTERSOLID:()=>xc,MASK_NAV_SOLID:()=>yc,MASK_OPAQUE:()=>pc,MASK_PLAYERSOLID:()=>dc,MASK_PROJECTILE:()=>_c,MASK_SHOT:()=>hc,MASK_SOLID:()=>Ze,MASK_WALK_NAV_SOLID:()=>Sc,MASK_WATER:()=>Re,MAX_CHALLENGES:()=>_s,MAX_CLIENTS:()=>Fo,MAX_CONFIGSTRINGS:()=>Ho,MAX_EDICTS:()=>wc,MAX_GENERAL:()=>Wo,MAX_IMAGES:()=>Io,MAX_INFO_STRING:()=>Ns,MAX_ITEMS:()=>Go,MAX_LIGHTSTYLES:()=>Do,MAX_MODELS:()=>Uo,MAX_MSGLEN:()=>Vs,MAX_OSPATH:()=>Pc,MAX_PACKET_ENTITIES:()=>As,MAX_QPATH:()=>Lc,MAX_SHADOW_LIGHTS:()=>ko,MAX_SOUNDS:()=>Bo,MAX_SOUND_CHANNELS:()=>nl,MAX_STRING_CHARS:()=>Rc,MAX_STRING_TOKENS:()=>Mc,MAX_TOKEN_CHARS:()=>vc,MAX_WHEEL_ITEMS:()=>rt,MZ_BFG:()=>Bs,MZ_BLASTER:()=>Cs,MZ_CHAINGUN1:()=>Ms,MZ_CHAINGUN2:()=>vs,MZ_CHAINGUN3:()=>Ls,MZ_GRENADE:()=>zs,MZ_HYPERBLASTER:()=>Is,MZ_LOGIN:()=>Fs,MZ_LOGOUT:()=>Ds,MZ_MACHINEGUN:()=>Os,MZ_RAILGUN:()=>Ps,MZ_ROCKET:()=>ws,MZ_SHOTGUN:()=>Rs,MZ_SSHOTGUN:()=>Us,MersenneTwister19937:()=>Ve,NUM_AMMO_STATS:()=>Ws,NUM_BITS_FOR_AMMO:()=>We,NUM_BITS_FOR_POWERUP:()=>He,NUM_POWERUP_STATS:()=>ks,NetChan:()=>Vt,NetworkMessageBuilder:()=>Nt,PITCH:()=>Ee,POWERUP_MAX:()=>ke,PlaneSide:()=>zt,PlayerButton:()=>re,PlayerStat:()=>bn,PmFlag:()=>oe,PmType:()=>ue,PowerupId:()=>hn,RAD2DEG:()=>Yn,ROLL:()=>je,RandomGenerator:()=>Ce,RenderFx:()=>Tn,Replay:()=>st,SLIDEMOVE_BLOCKED_FLOOR:()=>Kt,SLIDEMOVE_BLOCKED_WALL:()=>Xt,SOUND_FULLVOLUME:()=>al,SOUND_LOOP_ATTENUATE:()=>ll,STOP_EPSILON:()=>$,SURF_ALPHATEST:()=>ic,SURF_FLOWING:()=>rc,SURF_LIGHT:()=>$i,SURF_N64_SCROLL_FLIP:()=>uc,SURF_N64_SCROLL_X:()=>ac,SURF_N64_SCROLL_Y:()=>lc,SURF_N64_UV:()=>cc,SURF_NODRAW:()=>sc,SURF_NONE:()=>qi,SURF_SKY:()=>ec,SURF_SLICK:()=>Qi,SURF_TRANS33:()=>nc,SURF_TRANS66:()=>oc,SURF_WARP:()=>tc,ServerCommand:()=>fn,SoundChannel:()=>An,TempEntity:()=>mn,UPDATE_BACKUP:()=>gs,WEAPON_AMMO_MAP:()=>Ai,WEAPON_WHEEL_ORDER:()=>_i,WaterLevel:()=>le,WeaponId:()=>Sn,YAW:()=>Ne,ZERO_VEC3:()=>L,addBlendColor:()=>$n,addContents:()=>po,addPmFlag:()=>G,addPointToBounds:()=>Bn,addVec3:()=>R,addViewAngles:()=>Ts,angleMod:()=>xe,angleVectors:()=>pe,applyPmove:()=>Ti,applyPmoveAccelerate:()=>Y,applyPmoveAddCurrents:()=>Fe,applyPmoveAirAccelerate:()=>at,applyPmoveAirMove:()=>Kr,applyPmoveFlyMove:()=>Tr,applyPmoveFriction:()=>ct,applyPmoveWaterMove:()=>Xr,assertContract:()=>qo,attenuationToDistanceMultiplier:()=>gn,boxContents:()=>Ro,boxOnPlaneSide:()=>Eo,boxesIntersect:()=>In,buildAirGroundWish:()=>lt,buildCollisionModel:()=>Ao,buildWaterWish:()=>ut,calculateMaxAudibleDistance:()=>gi,categorizePosition:()=>kr,checkDuckState:()=>Rr,checkJump:()=>Er,checkSpecialMovement:()=>ss,clampViewAngles:()=>fs,clipBoxToBrush:()=>tt,clipVelocityAgainstPlanes:()=>Gn,clipVelocityVec3:()=>te,closestPointToBox:()=>Fn,combineSurfaceFlags:()=>yo,computePlaneSignBits:()=>et,computePlayerDimensions:()=>Ue,concatRotationMatrices:()=>Ye,configStringSize:()=>Ko,copyVec3:()=>vn,crc8:()=>Zs,createDefaultTrace:()=>Le,createEmptyBounds3:()=>Un,createMat4Identity:()=>Lt,createRandomGenerator:()=>Qn,crossVec3:()=>ee,currentVectorFromContents:()=>pt,degToRad:()=>Ae,disableTraceDebug:()=>So,distance:()=>wn,distanceBetweenBoxesSquared:()=>Dn,dotVec3:()=>z,enableTraceDebug:()=>To,fixStuckObjectGeneric:()=>mt,getWaterLevel:()=>Te,goodPosition:()=>yt,groundCurrentVelocity:()=>nn,hasAllContents:()=>mo,hasAnyContents:()=>xo,hasPmFlag:()=>F,hasSurfaceFlags:()=>bo,inPHS:()=>vo,inPVS:()=>Mo,initialSnapPosition:()=>as,isAtLeastWaistDeep:()=>it,isUnderwater:()=>nr,lengthSquaredVec3:()=>ie,lengthVec3:()=>B,lerpAngle:()=>jn,mat4FromBasis:()=>no,mouseDeltaToViewDelta:()=>Ss,multiplyMat4:()=>eo,multiplyVec3:()=>Ln,negateVec3:()=>Pn,normalizeVec3:()=>P,perpendicularVec3:()=>Rt,planeDistanceToPoint:()=>ne,pmoveCmdScale:()=>or,pointContents:()=>Co,pointContentsMany:()=>Oo,pointInsideBrush:()=>Ft,pointOnPlaneSide:()=>go,projectPointOnPlane:()=>Ot,projectSourceVec3:()=>kn,projectSourceVec3WithUp:()=>Hn,radToDeg:()=>ge,removeContents:()=>ho,removePmFlag:()=>X,resolveSlideMove:()=>Jt,rotatePointAroundVector:()=>Xn,scaleVec3:()=>M,slerpVec3:()=>Kn,slideClipVelocityVec3:()=>Wn,slideMove:()=>ft,snapPosition:()=>cs,stepSlideMove:()=>se,subtractVec3:()=>Q,testBoxInBrush:()=>Dt,traceBox:()=>Gt,traceDebugInfo:()=>K,transformPointMat4:()=>to,validateContract:()=>kt,vec3Equals:()=>zn,vectorToAngles:()=>qn,vectorToYaw:()=>Zn,waterCurrentVelocity:()=>tn,writeUserCommand:()=>Ys});var L={x:0,y:0,z:0},$=.1,Mn=Math.PI/180;function vn(t){return{x:t.x,y:t.y,z:t.z}}function R(t,e){return{x:t.x+e.x,y:t.y+e.y,z:t.z+e.z}}function Q(t,e){return{x:t.x-e.x,y:t.y-e.y,z:t.z-e.z}}function Ln(t,e){return{x:t.x*e.x,y:t.y*e.y,z:t.z*e.z}}function M(t,e){return{x:t.x*e,y:t.y*e,z:t.z*e}}function Pn(t){return M(t,-1)}function z(t,e){return t.x*e.x+t.y*e.y+t.z*e.z}function ee(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 ie(t){return z(t,t)}function B(t){return Math.sqrt(ie(t))}function wn(t,e){return B(Q(t,e))}function zn(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z}function P(t){let e=B(t);return e===0?t:M(t,1/e)}function Ot(t,e){let n=1/z(e,e),o=z(e,t)*n;return Q(t,M(e,n*o))}function Rt(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),P(Ot(e===0?{x:1,y:0,z:0}:e===1?{x:0,y:1,z:0}:{x:0,y:0,z:1},t))}function Fn(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 Dn(t,e,n,o){let r=0;if(e.x<n.x){let s=e.x-n.x;r+=s*s}else if(t.x>o.x){let s=t.x-o.x;r+=s*s}if(e.y<n.y){let s=e.y-n.y;r+=s*s}else if(t.y>o.y){let s=t.y-o.y;r+=s*s}if(e.z<n.z){let s=e.z-n.z;r+=s*s}else if(t.z>o.z){let s=t.z-o.z;r+=s*s}return r}function Un(){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 Bn(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 In(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 te(t,e,n){let o=z(t,e)*n,r=t.x-e.x*o,s=t.y-e.y*o,i=t.z-e.z*o;return r>-$&&r<$&&(r=0),s>-$&&s<$&&(s=0),i>-$&&i<$&&(i=0),{x:r,y:s,z:i}}function Gn(t,e,n,o){if(e.length===0)return t;let r=t;for(let s=0;s<e.length;s++){r=te(r,e[s],n);let i=0;for(;i<e.length&&!(i!==s&&z(r,e[i])<0);i++);if(i===e.length)return o&&z(r,o)<=0?L:r}if(e.length===2){let s=ee(e[0],e[1]),i=z(s,t),c=M(s,i);return o&&z(c,o)<=0?L:c}return o&&z(r,o)<=0,L}function Wn(t,e,n){return te(t,e,n)}function kn(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 Hn(t,e,n,o,r){return{x:t.x+n.x*e.x+o.x*e.y+r.x*e.z,y:t.y+n.y*e.x+o.y*e.y+r.y*e.z,z:t.z+n.z*e.x+o.z*e.y+r.z*e.z}}function Kn(t,e,n){let o=z(t,e),r,s;if(Math.abs(o)>.9995)r=1-n,s=n;else{let i=Math.acos(o),c=Math.sin(i),l=Math.sin((1-n)*i),u=Math.sin(n*i);r=l/c,s=u/c}return{x:t.x*r+e.x*s,y:t.y*r+e.y*s,z:t.z*r+e.z*s}}function Ye(t,e){let n=r=>[t[r][0]*e[0][0]+t[r][1]*e[1][0]+t[r][2]*e[2][0],t[r][0]*e[0][1]+t[r][1]*e[1][1]+t[r][2]*e[2][1],t[r][0]*e[0][2]+t[r][1]*e[1][2]+t[r][2]*e[2][2]];return[n(0),n(1),n(2)]}function Xn(t,e,n){if(B(t)===0)return e;let r=P(t),s=Rt(r),i=ee(s,r),c=[[s.x,i.x,r.x],[s.y,i.y,r.y],[s.z,i.z,r.z]],l=[[c[0][0],c[1][0],c[2][0]],[c[0][1],c[1][1],c[2][1]],[c[0][2],c[1][2],c[2][2]]],u=n*Mn,x=Math.cos(u),a=Math.sin(u),m=[[x,a,0],[-a,x,0],[0,0,1]],p=Ye(Ye(c,m),l);return{x:p[0][0]*e.x+p[0][1]*e.y+p[0][2]*e.z,y:p[1][0]*e.x+p[1][1]*e.y+p[1][2]*e.z,z:p[2][0]*e.x+p[2][1]*e.y+p[2][2]*e.z}}var Ee=0,Ne=1,je=2,Mt=Math.PI/180,vt=180/Math.PI,Jn=Mt,Yn=vt;function me(t,e){switch(e){case Ee:return t.x;case Ne:return t.y;case je:default:return t.z}}function Ae(t){return t*Mt}function ge(t){return t*vt}function jn(t,e,n){let o=e;return o-t>180?o-=360:o-t<-180&&(o+=360),t+n*(o-t)}function xe(t){let e=t%360;return e<0?360+e:e}function pe(t){let e=Ae(me(t,Ne)),n=Ae(me(t,Ee)),o=Ae(me(t,je)),r=Math.sin(e),s=Math.cos(e),i=Math.sin(n),c=Math.cos(n),l=Math.sin(o),u=Math.cos(o),x={x:c*s,y:c*r,z:-i},a={x:-l*i*s-u*-r,y:-l*i*r-u*s,z:-l*c},m={x:u*i*s-l*-r,y:u*i*r-l*s,z:u*c};return{forward:x,right:a,up:m}}function Zn(t){let e=me(t,Ee),n=me(t,Ne);if(e===0)return n===0?0:n>0?90:270;let o=ge(Math.atan2(n,e));return o<0?o+360:o}function qn(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 r;e?r=ge(Math.atan2(n,e)):n>0?r=90:r=270,r<0&&(r+=360);let s=Math.sqrt(e*e+n*n),i=ge(Math.atan2(o,s));return i<0&&(i+=360),{x:-i,y:r,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 $n(t,e,n,o,r){if(o<=0)return r;let s=r[0],i=r[1],c=r[2],l=r[3],u=l+(1-l)*o;if(u<=0)return[0,0,0,0];let x=l/u,a=s*x+t*(1-x),m=i*x+e*(1-x),p=c*x+n*(1-x);return[a,m,p,u]}var Ve=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,r=Math.imul(o>>>0,1812433253)+n;this.state[n]=r>>>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)}},Ce=class{constructor(e={}){this.mt=new Ve(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,r=4294967296-4294967296%o,s;do s=this.mt.nextUint32();while(s>=r);return e+s%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 Qn(t){return new Ce(t)}function Lt(){return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function eo(t,e){let n=new Float32Array(16);for(let o=0;o<4;o+=1)for(let r=0;r<4;r+=1)n[r*4+o]=t[0+o]*e[r*4+0]+t[4+o]*e[r*4+1]+t[8+o]*e[r*4+2]+t[12+o]*e[r*4+3];return n}function to(t,e){let n=e.x,o=e.y,r=e.z;return{x:t[0]*n+t[4]*o+t[8]*r+t[12],y:t[1]*n+t[5]*o+t[9]*r+t[13],z:t[2]*n+t[6]*o+t[10]*r+t[14]}}function no(t,e){let n=Lt();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}var Oe=0,Li=1,Pi=2,wi=4,zi=8,Fi=16,Di=32,Ui=64,oo=1073741824,ro=8192,Bi=16384,Ii=32768,Gi=65536,Wi=131072,so=262144,io=524288,co=1048576,ao=2097152,lo=4194304,uo=8388608,ki=16777216,Hi=33554432,Ki=67108864,Xi=134217728,Ji=268435456,Pt=536870912,Yi=1073741824,ji=-2147483648,Zi=64,qi=0,$i=1,Qi=2,ec=4,tc=8,nc=16,oc=32,rc=64,sc=128,ic=33554432,cc=268435456,ac=536870912,lc=1073741824,uc=-2147483648,fc=4294967295,Ze=3,dc=1107361795,mc=65539,xc=1107427331,Re=56,pc=25,hc=1174405123,fo=16515072,bc=1107296281,yc=65539,Tc=3,Sc=196611,_c=1174421507;function mo(t,e){return(t&e)===e}function xo(t,e){return(t&e)!==0}function po(t,e){return t|e}function ho(t,e){return t&~e}function bo(t,e){return(t&e)===e}function yo(...t){let e=0;for(let n of t)e|=n;return e}function Me(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,r=.5*(o===0?e.x+n.x:e.y+n.y),s={...e},i={...n},c={...e},l={...n};o===0?(i.x=r,c.x=r):(i.y=r,c.y=r);let u=Me(t+1,s,i),x=Me(t+1,c,l);return{axis:o,dist:r,children:[u,x],items:new Set}}function wt(t,e,n,o){let r=t;for(;r.axis!==-1&&r.children;){let s=r.axis,i=r.dist,c=s===0?n.x:n.y,l=s===0?o.x:o.y;if(c>i)r=r.children[1];else if(l<i)r=r.children[0];else break}return r.items.add(e),r}function he(t,e,n,o){for(let l of t.items)o.add(l);if(t.axis===-1||!t.children)return;let r=t.axis,s=t.dist,i=r===0?e.x:e.y;(r===0?n.x:n.y)>s&&he(t.children[1],e,n,o),i<s&&he(t.children[0],e,n,o)}var zt=(o=>(o[o.FRONT=1]="FRONT",o[o.BACK=2]="BACK",o[o.CROSS=3]="CROSS",o))(zt||{}),K=null;function To(){K={nodesTraversed:0,leafsReached:0,brushesTested:0}}function So(){K=null}var Z=.03125,_o=Number.MAX_SAFE_INTEGER-1,ve=1;function Ao(t){let e=t.planes.map(i=>({...i,signbits:et(i.normal)})),n=t.nodes.map(i=>({plane:e[i.planenum],children:i.children})),o=t.brushes.map(i=>{let c=t.brushSides.slice(i.firstSide,i.firstSide+i.numSides).map(l=>({plane:e[l.planenum],surfaceFlags:l.surfaceFlags}));return{contents:i.contents,sides:c,checkcount:0}}),r=t.leaves.map(i=>({contents:i.contents,cluster:i.cluster,area:i.area,firstLeafBrush:i.firstLeafBrush,numLeafBrushes:i.numLeafBrushes})),s=t.bmodels.map(i=>({mins:i.mins,maxs:i.maxs,origin:i.origin,headnode:i.headnode}));return{planes:e,nodes:n,leaves:r,brushes:o,leafBrushes:t.leafBrushes,bmodels:s,visibility:t.visibility}}function et(t){let e=0;return t.x<0&&(e|=1),t.y<0&&(e|=2),t.z<0&&(e|=4),e}function ne(t,e){return t.normal.x*e.x+t.normal.y*e.y+t.normal.z*e.z-t.dist}function go(t,e,n=0){let o=ne(t,e);return o>n?1:o<-n?2:3}function Eo(t,e,n,o=0){let r,s;switch(n.signbits){case 0:r=n.normal.x*e.x+n.normal.y*e.y+n.normal.z*e.z,s=n.normal.x*t.x+n.normal.y*t.y+n.normal.z*t.z;break;case 1:r=n.normal.x*t.x+n.normal.y*e.y+n.normal.z*e.z,s=n.normal.x*e.x+n.normal.y*t.y+n.normal.z*t.z;break;case 2:r=n.normal.x*e.x+n.normal.y*t.y+n.normal.z*e.z,s=n.normal.x*t.x+n.normal.y*e.y+n.normal.z*t.z;break;case 3:r=n.normal.x*t.x+n.normal.y*t.y+n.normal.z*e.z,s=n.normal.x*e.x+n.normal.y*e.y+n.normal.z*t.z;break;case 4:r=n.normal.x*e.x+n.normal.y*e.y+n.normal.z*t.z,s=n.normal.x*t.x+n.normal.y*t.y+n.normal.z*e.z;break;case 5:r=n.normal.x*t.x+n.normal.y*e.y+n.normal.z*t.z,s=n.normal.x*e.x+n.normal.y*t.y+n.normal.z*e.z;break;case 6:r=n.normal.x*e.x+n.normal.y*t.y+n.normal.z*t.z,s=n.normal.x*t.x+n.normal.y*e.y+n.normal.z*e.z;break;default:r=n.normal.x*t.x+n.normal.y*t.y+n.normal.z*t.z,s=n.normal.x*e.x+n.normal.y*e.y+n.normal.z*e.z;break}let i=0;return r-n.dist>=-o&&(i=1),s-n.dist<=o&&(i|=2),i}function Ft(t,e,n=Z){for(let o of e.sides)if(ne(o.plane,t)>n)return!1;return!0}function Dt(t,e,n,o){for(let r of o.sides){let s=r.plane.normal.x*(r.plane.normal.x<0?n.x:e.x)+r.plane.normal.y*(r.plane.normal.y<0?n.y:e.y)+r.plane.normal.z*(r.plane.normal.z<0?n.z:e.z),i=r.plane.dist-s;if(t.x*r.plane.normal.x+t.y*r.plane.normal.y+t.z*r.plane.normal.z-i>0)return{startsolid:!1,allsolid:!1,contents:0}}return{startsolid:!0,allsolid:!0,contents:o.contents}}function tt({start:t,end:e,mins:n,maxs:o,brush:r,trace:s}){if(r.sides.length===0)return;let i=n.x===0&&n.y===0&&n.z===0&&o.x===0&&o.y===0&&o.z===0,c=-1,l=1,u=null,x=null,a=!1,m=!1;for(let p of r.sides){let{plane:f}=p,A=f.dist;if(!i){let C=f.normal.x<0?o.x:n.x,T=f.normal.y<0?o.y:n.y,S=f.normal.z<0?o.z:n.z;A-=f.normal.x*C+f.normal.y*T+f.normal.z*S}let _=t.x*f.normal.x+t.y*f.normal.y+t.z*f.normal.z-A,g=e.x*f.normal.x+e.y*f.normal.y+e.z*f.normal.z-A;if(g>0&&(a=!0),_>0&&(m=!0),_>0&&g>=_)return;if(!(_<=0&&g<=0))if(_>g){let C=(_-Z)/(_-g);C>c&&(c=C,u=f,x=p)}else{let C=(_+Z)/(_-g);C<l&&(l=C)}}if(!m){s.startsolid=!0,a||(s.allsolid=!0),s.fraction=0;return}c<l&&c>-1&&c<s.fraction&&(s.fraction=c<0?0:c,s.plane=u,s.contents=r.contents,s.surfaceFlags=x?.surfaceFlags??0)}function Le(){return{fraction:1,plane:null,contents:0,surfaceFlags:0,startsolid:!1,allsolid:!1}}function nt(t,e,n){let o=n;for(;o>=0;){let r=e.nodes[o];o=ne(r.plane,t)>=0?r.children[0]:r.children[1]}return-1-o}function Ut(t,e,n){let o=t.leaves[e],r=o.contents,s=ot(),i=o.firstLeafBrush,c=i+o.numLeafBrushes;for(let l=i;l<c;l+=1){let u=t.leafBrushes[l],x=t.brushes[u];x.checkcount!==s&&(x.checkcount=s,x.sides.length!==0&&Ft(n,x)&&(r|=x.contents))}return r}function ot(){let t=ve;return ve+=1,ve>=_o&&(ve=1),t}function No(t,e){return t.x===0&&t.y===0&&t.z===0&&e.x===0&&e.y===0&&e.z===0}function Vo(t,e,n){return No(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 Bt(t,e,n){return Math.abs(Vo(t,e,n))}function qe(t,e,n){return R(t,M(Q(e,t),n))}function $e(t,e,n){let o=t.allsolid?0:t.fraction,r=qe(e,n,o);return{fraction:o,endpos:r,plane:t.plane,planeNormal:t.startsolid?void 0:t.plane?.normal,contents:t.contents,surfaceFlags:t.surfaceFlags,startsolid:t.startsolid,allsolid:t.allsolid}}function Pe(t,e,n){let o=nt(t,e,n);return e.leaves[o]?.cluster??-1}function It(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 r=t.clusters[e],i=(o?r.phs:r.pvs)[n>>3];return i===void 0?!1:(i&1<<(n&7))!==0}function be(t){let{model:e,nodeIndex:n,startFraction:o,endFraction:r,start:s,end:i,traceStart:c,traceEnd:l,mins:u,maxs:x,contentMask:a,trace:m,brushCheckCount:p}=t;if(m.fraction<=o)return;if(n<0){K&&K.leafsReached++;let D=-1-n,V=e.leaves[D],I=V.firstLeafBrush,j=I+V.numLeafBrushes;for(let U=I;U<j;U+=1){let H=e.leafBrushes[U],y=e.brushes[H];if((y.contents&a)!==0&&y.sides.length&&y.checkcount!==p&&(y.checkcount=p,K&&K.brushesTested++,tt({start:c,end:l,mins:u,maxs:x,brush:y,trace:m}),m.allsolid))return}return}K&&K.nodesTraversed++;let f=e.nodes[n],A=f.plane,_=Bt(A,u,x),g=ne(A,s),C=ne(A,i);if(g>=_&&C>=_){be({model:e,nodeIndex:f.children[0],startFraction:o,endFraction:r,start:s,end:i,traceStart:c,traceEnd:l,mins:u,maxs:x,contentMask:a,trace:m,brushCheckCount:p});return}if(g<-_&&C<-_){be({model:e,nodeIndex:f.children[1],startFraction:o,endFraction:r,start:s,end:i,traceStart:c,traceEnd:l,mins:u,maxs:x,contentMask:a,trace:m,brushCheckCount:p});return}let T=0,S=1/(g-C),O,E;g<C?(T=1,E=(g+_+Z)*S,O=(g-_+Z)*S):(T=0,E=(g-_-Z)*S,O=(g+_+Z)*S),O<0?O=0:O>1&&(O=1),E<0?E=0:E>1&&(E=1);let v=o+(r-o)*O,N=qe(s,i,O);if(be({model:e,nodeIndex:f.children[T],startFraction:o,endFraction:v,start:s,end:N,traceStart:c,traceEnd:l,mins:u,maxs:x,contentMask:a,trace:m,brushCheckCount:p}),m.fraction<=v)return;let k=o+(r-o)*E,h=qe(s,i,E);be({model:e,nodeIndex:f.children[1-T],startFraction:k,endFraction:r,start:h,end:i,traceStart:c,traceEnd:l,mins:u,maxs:x,contentMask:a,trace:m,brushCheckCount:p})}function Gt(t){let{model:e,start:n,end:o}=t,r=t.mins??L,s=t.maxs??L,i=t.contentMask??4294967295,c=t.headnode??0,l=Le(),u=ot();return be({model:e,nodeIndex:c,startFraction:0,endFraction:1,start:n,end:o,traceStart:n,traceEnd:o,mins:r,maxs:s,contentMask:i,trace:l,brushCheckCount:u}),$e(l,n,o)}function Co(t,e,n=0){let o=nt(t,e,n);return Ut(e,o,t)}function Oo(t,e,n=0){let o=new Map;return t.map(r=>{let s=nt(r,e,n),i=e.leaves[s];if(i.numLeafBrushes===0){let c=o.get(s);return c!==void 0?c:(o.set(s,i.contents),i.contents)}return Ut(e,s,r)})}function Ro(t,e,n,o,r=0){let s=ot(),i=0;function c(l){if(l<0){K&&K.leafsReached++;let p=-1-l,f=o.leaves[p];i|=f.contents;let A=f.firstLeafBrush,_=A+f.numLeafBrushes;for(let g=A;g<_;g+=1){let C=o.leafBrushes[g],T=o.brushes[C];if(T.checkcount===s||(T.checkcount=s,T.sides.length===0))continue;let S=Dt(t,e,n,T);S.startsolid&&(i|=S.contents)}return}let u=o.nodes[l],x=u.plane,a=Bt(x,e,n),m=ne(x,t);if(a===0){c(m>=0?u.children[0]:u.children[1]);return}if(m>a){c(u.children[0]);return}if(m<-a){c(u.children[1]);return}c(u.children[0]),c(u.children[1])}return c(r),i}function Mo(t,e,n,o=0){let{visibility:r}=n;if(!r)return!0;let s=Pe(t,n,o),i=Pe(e,n,o);return It(r,s,i,!1)}function vo(t,e,n,o=0){let{visibility:r}=n;if(!r)return!0;let s=Pe(t,n,o),i=Pe(e,n,o);return It(r,s,i,!0)}function ce(t,e,n){return{normal:t,dist:e,type:n,signbits:et(t)}}function Lo(t){let e=t.surfaceFlags??0,n=t.origin.x+t.maxs.x,o=t.origin.x+t.mins.x,r=t.origin.y+t.maxs.y,s=t.origin.y+t.mins.y,i=t.origin.z+t.maxs.z,c=t.origin.z+t.mins.z,u=[ce({x:1,y:0,z:0},n,0),ce({x:-1,y:0,z:0},-o,0),ce({x:0,y:1,z:0},r,1),ce({x:0,y:-1,z:0},-s,1),ce({x:0,y:0,z:1},i,2),ce({x:0,y:0,z:-1},-c,2)].map(x=>({plane:x,surfaceFlags:e}));return{contents:t.contents,sides:u,checkcount:0}}function Po(t){let e=Lo(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 wo(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 zo(t,e){return e.allsolid&&!t.allsolid||e.startsolid&&!t.startsolid?!0:e.fraction<t.fraction}var Qe=class{constructor(){this.entities=new Map;this.entityNodes=new Map;this.rootNode=Me()}link(e){let n=Po(e);this.entities.set(e.id,n);let o=this.entityNodes.get(e.id);o&&o.items.delete(e.id);let r=wt(this.rootNode,e.id,n.bounds.mins,n.bounds.maxs);this.entityNodes.set(e.id,r)}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??L,r=e.maxs??L,s=e.contentMask??4294967295,i,c=null;e.model?i=Gt(e):i=$e(Le(),e.start,e.end);let l={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},u={x:Math.max(e.start.x,e.end.x)+r.x,y:Math.max(e.start.y,e.end.y)+r.y,z:Math.max(e.start.z,e.end.z)+r.z},x=new Set;he(this.rootNode,l,u,x);for(let a of x){if(a===n)continue;let m=this.entities.get(a);if(!m||(m.contents&s)===0)continue;let p=Le();if(tt({start:e.start,end:e.end,mins:o,maxs:r,brush:m.brush,trace:p}),p.contents===0&&(p.contents=m.contents),p.startsolid||p.allsolid||p.fraction<i.fraction){let f=$e(p,e.start,e.end);zo(i,f)&&(i=f,c=m.id)}}return{...i,entityId:c}}gatherTriggerTouches(e,n,o,r=1073741824){let s=[],i={mins:R(e,n),maxs:R(e,o)},c=new Set;he(this.rootNode,i.mins,i.maxs,c);for(let l of c){let u=this.entities.get(l);u&&(u.contents&r)!==0&&wo(i,u.bounds)&&s.push(u.id)}return s}};var Wt=(i=>(i[i.None=0]="None",i[i.Archive=1]="Archive",i[i.UserInfo=2]="UserInfo",i[i.ServerInfo=4]="ServerInfo",i[i.Latch=8]="Latch",i[i.Cheat=16]="Cheat",i))(Wt||{});var Rc=1024,Mc=80,vc=512,Lc=64,Pc=128,Fo=256,wc=8192,Do=256,Uo=8192,Bo=2048,Io=512,Go=256,Wo=512,ko=256,rt=32,zc=96,Fc=64,ae=(h=>(h[h.Name=0]="Name",h[h.CdTrack=1]="CdTrack",h[h.Sky=2]="Sky",h[h.SkyAxis=3]="SkyAxis",h[h.SkyRotate=4]="SkyRotate",h[h.StatusBar=5]="StatusBar",h[h.HealthBarName=55]="HealthBarName",h[h.CONFIG_N64_PHYSICS=56]="CONFIG_N64_PHYSICS",h[h.CONFIG_CTF_TEAMS=57]="CONFIG_CTF_TEAMS",h[h.CONFIG_COOP_RESPAWN_STRING=58]="CONFIG_COOP_RESPAWN_STRING",h[h.AirAccel=59]="AirAccel",h[h.MaxClients=60]="MaxClients",h[h.MapChecksum=61]="MapChecksum",h[h.Models=62]="Models",h[h.Sounds=62+Uo]="Sounds",h[h.Images=h.Sounds+Bo]="Images",h[h.Lights=h.Images+Io]="Lights",h[h.ShadowLights=h.Lights+Do]="ShadowLights",h[h.Items=h.ShadowLights+ko]="Items",h[h.PlayerSkins=h.Items+Go]="PlayerSkins",h[h.General=h.PlayerSkins+Fo]="General",h[h.WheelWeapons=h.General+Wo]="WheelWeapons",h[h.WheelAmmo=h.WheelWeapons+rt]="WheelAmmo",h[h.WheelPowerups=h.WheelAmmo+rt]="WheelPowerups",h[h.CdLoopCount=h.WheelPowerups+rt]="CdLoopCount",h[h.GameStyle=h.CdLoopCount+1]="GameStyle",h[h.MaxConfigStrings=h.GameStyle+1]="MaxConfigStrings",h))(ae||{}),Ho=ae.MaxConfigStrings;function Ko(t){return t>=5&&t<59?96*(59-t):t>=ae.General&&t<ae.WheelWeapons?96*(ae.MaxConfigStrings-t):96}var st={};Je(st,{addReplayFrame:()=>jo,createReplaySession:()=>Yo,deserializeReplay:()=>Jo,serializeReplay:()=>Xo});function Xo(t){return JSON.stringify(t,null,2)}function Jo(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 Yo(t,e){return{metadata:{map:t,date:new Date().toISOString(),version:"1.0",seed:e},frames:[]}}function jo(t,e,n,o){t.frames.push({serverFrame:n,cmd:e,timestamp:Date.now()-o})}function Zo(t){return t??{}}function kt(t,e,n={}){let o=Zo(t),r=[],s=[];for(let c of e){if(!(c in o)){r.push(c);continue}typeof o[c]!="function"&&s.push(c)}let i=n.allowExtra===!1?Object.keys(o).filter(c=>!e.includes(c)):[];return{missing:r,nonFunctions:s,extras:i}}function qo(t,e,n={}){let{missing:o,nonFunctions:r,extras:s}=kt(t,e,n);if(o.length===0&&r.length===0&&s.length===0)return;let i=[];o.length>0&&i.push(`missing: ${o.join(", ")}`),r.length>0&&i.push(`non-functions: ${r.join(", ")}`),s.length>0&&i.push(`extras: ${s.join(", ")}`);let c=n.name??"contract";throw new Error(`${c} validation failed (${i.join("; ")})`)}var $o=["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"],Qo=["PreInit","Init","Shutdown","SpawnEntities","WriteGameJson","ReadGameJson","WriteLevelJson","ReadLevelJson","CanSave","ClientConnect","ClientThink","RunFrame","Pmove"],er=["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"],tr=["Init","Shutdown","DrawHUD","TouchPics","LayoutFlags","GetActiveWeaponWheelWeapon","GetOwnedWeaponWheelWeapons","GetWeaponWheelAmmoCount","GetPowerupWheelCount","GetHitMarkerDamage","Pmove","ParseConfigString","ParseCenterPrint","ClearNotify","ClearCenterprint","NotifyMessage","GetMonsterFlashOffset"];var le=(r=>(r[r.None=0]="None",r[r.Feet=1]="Feet",r[r.Waist=2]="Waist",r[r.Under=3]="Under",r))(le||{});function it(t){return t>=2}function nr(t){return t===3}var oe=(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))(oe||{});function F(t,e){return(t&e)!==0}function G(t,e){return t|e}function X(t,e){return t&~e}var ue=(c=>(c[c.Normal=0]="Normal",c[c.Grapple=1]="Grapple",c[c.NoClip=2]="NoClip",c[c.Spectator=3]="Spectator",c[c.Dead=4]="Dead",c[c.Gib=5]="Gib",c[c.Freeze=6]="Freeze",c))(ue||{}),re=(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.Any=128]="Any",c))(re||{});function ct(t){let{velocity:e,frametime:n,onGround:o,groundIsSlick:r,onLadder:s,waterlevel:i,pmFriction:c,pmStopSpeed:l,pmWaterFriction:u}=t,x=B(e);if(x<1)return{x:0,y:0,z:e.z};let a=0;if(o&&!r||s){let f=x<l?l:x;a+=f*c*n}i>0&&!s&&(a+=x*u*i*n);let m=x-a;if(m<0&&(m=0),m===x)return e;let p=m/x;return M(e,p)}function Y(t){let{velocity:e,wishdir:n,wishspeed:o,accel:r,frametime:s}=t,i=z(e,n),c=o-i;if(c<=0)return e;let l=r*s*o;return l>c&&(l=c),{x:e.x+n.x*l,y:e.y+n.y*l,z:e.z+n.z*l}}function at(t){let{velocity:e,wishdir:n,wishspeed:o,accel:r,frametime:s}=t,i=Math.min(o,30),c=z(e,n),l=i-c;if(l<=0)return e;let u=r*o*s;return u>l&&(u=l),{x:e.x+n.x*u,y:e.y+n.y*u,z:e.z+n.z*u}}function or(t,e){let n=Math.abs(t.forwardmove),o=Math.abs(t.sidemove),r=Math.abs(t.upmove),s=Math.max(n,o,r);if(s===0)return 0;let i=Math.sqrt(t.forwardmove*t.forwardmove+t.sidemove*t.sidemove+t.upmove*t.upmove);return e*s/(127*i)}function lt(t){let{forward:e,right:n,cmd:o,maxSpeed:r}=t,s={x:e.x*o.forwardmove+n.x*o.sidemove,y:e.y*o.forwardmove+n.y*o.sidemove,z:0},i=B(s);if(i>r){let c=r/i;s=M(s,c),i=r}return{wishdir:i===0?s:P(s),wishspeed:i}}function ut(t){let{forward:e,right:n,cmd:o,maxSpeed:r}=t,s={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?s=R(s,{x:0,y:0,z:o.upmove}):o.upmove<-10?s=R(s,{x:0,y:0,z:o.upmove}):Math.abs(o.forwardmove)<10&&Math.abs(o.sidemove)<10?s=R(s,{x:0,y:0,z:-60}):s=R(s,{x:0,y:0,z:10});let i=B(s);if(i>r){let c=r/i;s=M(s,c),i=r}return i*=.5,{wishdir:i===0?s:P(s),wishspeed:i}}var Ht=5,rr=4,sr=18,ir=.7,Kt=1,Xt=2;function Jt(t,e,n,o=Ht,r=t){if(e.length===0)return{velocity:t,planes:[],stopped:!1};let s=[],i=t;for(let l of e){if(s.length>=o)return{velocity:L,planes:s,stopped:!0};if(s.find(m=>z(m,l)>.99))continue;s.push(l);let x,a=0;for(;a<s.length;a++){let m=te(i,s[a],n),p=0;for(;p<s.length&&!(p!==a&&z(m,s[p])<0);p++);if(p===s.length){x=m;break}}if(x)i=x;else{if(s.length!==2)return{velocity:L,planes:s,stopped:!0};let m=ee(s[0],s[1]),p=z(m,i);i=M(m,p)}if(z(i,r)<=0)return{velocity:L,planes:s,stopped:!0}}let c=i.x===0&&i.y===0&&i.z===0;return{velocity:i,planes:s,stopped:c}}function ft(t){let{origin:e,velocity:n,frametime:o,overbounce:r,trace:s,maxBumps:i=rr,maxClipPlanes:c=Ht,mins:l,maxs:u,hasTime:x=!1}=t,a=e,m=n,p=[],f=n,A=o,_=0;for(let C=0;C<i&&!(m.x===0&&m.y===0&&m.z===0);C++){let T=R(a,M(m,A)),S=s(a,T,l,u);if(S.allsolid){let E=x?f:L;return{origin:S.endpos,velocity:E,planes:p,stopped:!0,blocked:_}}if(S.startsolid){let E=x?f:L;return{origin:S.endpos,velocity:E,planes:p,stopped:!0,blocked:_}}if(S.fraction>0&&(a=S.endpos),S.fraction===1)break;if(!S.planeNormal)return{origin:a,velocity:x?f:L,planes:p,stopped:!0,blocked:_};S.planeNormal.z>.7&&(_|=Kt),S.planeNormal.z===0&&(_|=Xt),p.push(S.planeNormal),A-=A*S.fraction;let O=Jt(m,p,r,c,f);if(m=O.velocity,p.splice(0,p.length,...O.planes),f.z>0&&m.z<0&&(m={...m,z:0}),O.stopped)return{origin:a,velocity:x?f:m,planes:p,stopped:!0,blocked:_}}let g=x?f:m;return{origin:a,velocity:g,planes:p,stopped:g.x===0&&g.y===0&&g.z===0,blocked:_}}function se(t){let{mins:e,maxs:n,stepSize:o=sr,...r}=t,s=t.origin,i=t.velocity,c=ft({...r,mins:e,maxs:n}),l=R(s,{x:0,y:0,z:o}),u=r.trace(s,l,e,n);if(u.allsolid)return{...c,stepped:!1,stepHeight:0};let x=u.endpos.z-s.z,a=ft({...r,origin:u.endpos,velocity:i,mins:e,maxs:n}),m=R(a.origin,{x:0,y:0,z:-x}),p=r.trace(a.origin,m,e,n),f=a.origin,A=p.planeNormal;p.allsolid||(f=p.endpos);let _=(E,v)=>(E.x-v.x)**2+(E.y-v.y)**2,g=_(c.origin,s),C=_(f,s);if(g>C||A&&A.z<ir)return{...c,stepped:!1,stepHeight:0};let T={...a.velocity,z:c.velocity.z},S=a.blocked,O=T.x===0&&T.y===0&&T.z===0;return{origin:f,velocity:T,planes:a.planes,blocked:S,stopped:O,stepped:!0,stepHeight:x,stepNormal:A}}var fe=["x","y","z"],dt=[{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]}],Yt={x:0,y:0,z:0};function de(t){return{x:t.x,y:t.y,z:t.z}}function cr(t){return{x:t[0],y:t[1],z:t[2]}}function ye(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 jt(t,e,n){switch(e){case"x":t.x=n;break;case"y":t.y=n;break;case"z":t.z=n;break}}function we(t,e){switch(e){case"x":return t.x;case"y":return t.y;case"z":default:return t.z}}function Zt(t,e,n,o){return t===-1?we(n,e):t===1?we(o,e):0}function qt(t,e,n,o){let r=de(t);for(let s=0;s<fe.length;s++){let i=fe[s],c=e.normal[s];c<0?ye(r,i,we(n,i)):c>0&&ye(r,i,we(o,i))}return r}function ar(t,e,n){let o=de(Yt),r=de(Yt);for(let s=0;s<fe.length;s++){let i=fe[s];jt(o,i,Zt(t.mins[s],i,e,n)),jt(r,i,Zt(t.maxs[s],i,e,n))}return{mins:o,maxs:r}}function lr(t,e,n){if(!e||n===0)return t;let o=de(t);return ye(o,e,n),o}function ur(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 mt(t){let{origin:e,mins:n,maxs:o,trace:r}=t;if(!r(e,n,o,e).startsolid)return{result:"good-position",origin:{...e}};let i=[];for(let c=0;c<dt.length;c++){let l=dt[c],{mins:u,maxs:x}=ar(l,n,o),a=qt(e,l,n,o),m=r(a,u,x,a),p,f=0;if(m.startsolid)for(let E=0;E<fe.length;E++){if(l.normal[E]!==0)continue;let v=fe[E],N=de(a);if(ye(N,v,1),m=r(N,u,x,N),!m.startsolid){a=N,p=v,f=1;break}if(N=de(a),ye(N,v,-1),m=r(N,u,x,N),!m.startsolid){a=N,p=v,f=-1;break}}if(m.startsolid)continue;let A=dt[c^1],_=qt(e,A,n,o);if(_=lr(_,p,f),m=r(a,u,x,_),m.startsolid)continue;let g=cr(l.normal),C=R(m.endpos??_,M(g,.125)),T=Q(C,_),S=R(e,T);S=ur(S,p,f),!r(S,n,o,S).startsolid&&i.push({origin:S,distance:ie(T)})}return i.length===0?{result:"no-good-position",origin:{...e}}:(i.sort((c,l)=>c.distance-l.distance),{result:"fixed",origin:{...i[0].origin}})}var fr=100,xt=200,$t=150,ze=25,dr=15,mr=1,xr={x:0,y:0,z:1},pr=(t,e)=>({fraction:1,endpos:e,allsolid:!1,startsolid:!1});function pt(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?L:{x:e,y:n,z:o}}function tn(t){let{watertype:e,waterlevel:n,onGround:o,waterSpeed:r}=t;if((e&16515072)===0)return L;let s=pt(e);if(s===L)return L;let i=r;return n===1&&o&&(i*=.5),M(s,i)}function nn(t){let{groundContents:e,scale:n=fr}=t,o=pt(e);return o===L?L:M(o,n)}function Fe(t){let{wishVelocity:e,onLadder:n,onGround:o,waterlevel:r,watertype:s,groundContents:i,cmd:c,viewPitch:l,maxSpeed:u,ladderMod:x,waterSpeed:a,forward:m,origin:p,mins:f,maxs:A,trace:_=pr}=t,g=e;n&&(g=hr({wishVelocity:g,cmd:c,waterlevel:r,viewPitch:l,maxSpeed:u,ladderMod:x,onGround:o,forward:m,origin:p,mins:f,maxs:A,trace:_}));let C=tn({watertype:s,waterlevel:r,onGround:o,waterSpeed:a});if(C!==L&&(g=R(g,C)),o){let T=nn({groundContents:i});T!==L&&(g=R(g,T))}return g}function hr(t){let{wishVelocity:e,cmd:n,waterlevel:o,viewPitch:r,maxSpeed:s,ladderMod:i,onGround:c,forward:l,origin:u,mins:x,maxs:a,trace:m}=t,p=n.buttons??0,f={...e};if((p&24)!==0){let A=it(o)?s:xt;f={...f,z:p&8?A:-A}}else if(n.forwardmove){let A=Qt(n.forwardmove,-xt,xt);if(n.forwardmove>0){let _=r<dr?A:-A;f={...f,z:_}}else c||(f={...f,x:0,y:0}),f={...f,z:A}}else f={...f,z:0};if(!c)if(n.sidemove){let A=Qt(n.sidemove,-$t,$t);o<2&&(A*=i);let _=P({x:l.x,y:l.y,z:0});if(_.x!==0||_.y!==0){let g=R(u,M(_,mr)),C=m(u,g,x,a);if(C.fraction!==1&&!C.allsolid&&C.contents!==void 0&&(C.contents&536870912)!==0&&C.planeNormal){let T=ee(C.planeNormal,xr);f={...f,x:0,y:0},f=R(f,M(T,-A))}}}else f={...f,x:en(f.x),y:en(f.y)};return f}function Qt(t,e,n){return Math.max(e,Math.min(n,t))}function en(t){return t<-ze?-ze:t>ze?ze:t}var br=1.5,on=.5,yr=1.01;function Tr(t){let{origin:e,cmd:n,frametime:o,pmFriction:r,pmStopSpeed:s,pmMaxSpeed:i,pmAccelerate:c,pmWaterSpeed:l,doclip:u,forward:x,right:a,mins:m,maxs:p,trace:f,overbounce:A=yr,stepSize:_,maxBumps:g,maxClipPlanes:C}=t,T=Sr({velocity:t.velocity,pmFriction:r,pmStopSpeed:s,frametime:o}),S=_r({cmd:n,forward:x,right:a,pmMaxSpeed:i,pmWaterSpeed:l});if(S.wishspeed>0&&(T=Y({velocity:T,wishdir:S.wishdir,wishspeed:S.accelSpeed,accel:c,frametime:o})),!u){let O=M(T,o);return{origin:R(e,O),velocity:T,planes:[],blocked:0,stopped:T.x===0&&T.y===0&&T.z===0,stepped:!1,stepHeight:0}}if(!f||!m||!p)throw new Error("applyPmoveFlyMove: doclip=true requires trace/mins/maxs");return se({origin:e,velocity:T,frametime:o,overbounce:A,trace:f,mins:m,maxs:p,stepSize:_,maxBumps:g,maxClipPlanes:C})}function Sr(t){let{velocity:e,pmFriction:n,pmStopSpeed:o,frametime:r}=t,s=B(e);if(s<1)return{x:0,y:0,z:0};let i=n*br,l=(s<o?o:s)*i*r,u=s-l;return u<0&&(u=0),u===s?e:M(e,u/s)}function _r(t){let{cmd:e,forward:n,right:o,pmMaxSpeed:r,pmWaterSpeed:s}=t,i=P(n),c=P(o),u={x:i.x*e.forwardmove+c.x*e.sidemove,y:i.y*e.forwardmove+c.y*e.sidemove,z:i.z*e.forwardmove+c.z*e.sidemove},x=e.buttons??0;x&8&&(u=R(u,{x:0,y:0,z:s*on})),x&16&&(u=R(u,{x:0,y:0,z:-s*on}));let a=B(u),m=a===0?{x:0,y:0,z:0}:P(u);if(a>r){let f=r/a;u=M(u,f),a=r,m=a===0?{x:0,y:0,z:0}:P(u)}let p=a*2;return{wishdir:m,wishspeed:a,accelSpeed:p}}function Te(t){let{origin:e,mins:n,viewheight:o,pointContents:r}=t,s=o-n.z,i=s/2,c={x:e.x,y:e.y,z:e.z+n.z+1},l=r(c);if((l&56)===0)return{waterlevel:0,watertype:0};let u=l,x=1,a={x:c.x,y:c.y,z:e.z+n.z+i};if(l=r(a),(l&56)!==0){x=2;let m={x:c.x,y:c.y,z:e.z+n.z+s};l=r(m),(l&56)!==0&&(x=3)}return{waterlevel:x,watertype:u}}var Ar=270;function gr(t,e){return(t&e)!==0}function Er(t){let{pmFlags:e,pmType:n,buttons:o,waterlevel:r,onGround:s,velocity:i,jumpHeight:c=Ar}=t;if(e&16)return{pmFlags:e,onGround:s,velocity:i,jumpSound:!1,jumped:!1};let l=gr(o,8),u=e,x=s,a=!1,m=!1,p=i;if(!l)return u=X(u,2),{pmFlags:u,onGround:x,velocity:p,jumpSound:a,jumped:m};if(Nr(u))return{pmFlags:u,onGround:x,velocity:p,jumpSound:a,jumped:m};if(n===4)return{pmFlags:u,onGround:x,velocity:p,jumpSound:a,jumped:m};if(r>=2)return x=!1,{pmFlags:u,onGround:x,velocity:p,jumpSound:a,jumped:m};if(!x)return{pmFlags:u,onGround:x,velocity:p,jumpSound:a,jumped:m};u=G(u,2),u=X(u,4),x=!1,a=!0,m=!0;let f=i.z+c,A=f<c?c:f;return p={...i,z:A},{pmFlags:u,onGround:x,velocity:p,jumpSound:a,jumped:m}}function Nr(t){return(t&2)!==0}function De(t,e,n){return{x:t,y:e,z:n}}function Ue(t,e){let n=De(-16,-16,0),o=De(16,16,16);if(t===5)return{mins:n,maxs:o,viewheight:8};let r=t===4||(e&1)!==0,s=De(n.x,n.y,-24),i=De(o.x,o.y,r?4:32);return{mins:s,maxs:i,viewheight:r?-2:22}}var Vr=4,Cr=32,Or=8;function Rr(t){let{pmType:e}=t;if(e===5){let i=Ue(e,t.pmFlags);return{pmFlags:t.pmFlags,ducked:F(t.pmFlags,1),changed:!1,...i}}let n=t.pmFlags,o=!1;e===4?F(n,1)||(n=G(n,1),o=!0):Mr(t)?!F(n,1)&&!vr(t)&&(n=G(n,1),o=!0):F(n,1)&&!Lr(t)&&(n=X(n,1),o=!0);let r=Ue(e,n),s=e===4||F(n,1);return{pmFlags:n,ducked:s,changed:o,...r}}function Mr(t){return(t.buttons&16)===0||t.onLadder||t.n64Physics?!1:!!(t.hasGroundEntity||t.waterlevel<=1&&!Pr(t))}function vr(t){return t.trace({start:t.origin,end:t.origin,mins:t.mins,maxs:rn(t.maxs,Vr),mask:3}).allsolid}function Lr(t){return t.trace({start:t.origin,end:t.origin,mins:t.mins,maxs:rn(t.maxs,Cr),mask:3}).allsolid}function Pr(t){let e={x:t.origin.x,y:t.origin.y,z:t.origin.z-Or};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 rn(t,e){return{x:t.x,y:t.y,z:e}}var wr=.25,zr=180,Fr=100,Dr=.7,Ur=.9,Br=64,Ir=128,Gr=1.01,Wr=1080;function kr(t){let{pmType:e,n64Physics:n,velocity:o,startVelocity:r,origin:s,mins:i,maxs:c,viewheight:l,trace:u,pointContents:x}=t,a=t.pmFlags,m=t.pmTime,p,f=F(a,4),A,_=0;if(o.z>zr||e===1)a=X(a,4),f=!1;else{let S={x:s.x,y:s.y,z:s.z-wr},O=u(s,S,i,c);A=O,_=O.contents??0;let E=O.planeNormal,v=O.fraction<1&&!!E&&E.z<Dr;if(v&&E){let N=R(s,E),W=u(s,N,i,c);W.fraction<1&&!W.startsolid&&(v=!1)}if(O.fraction===1||!E||v&&!O.startsolid)a=X(a,4),f=!1;else{f=!0,F(a,8)&&(a&=~Wr,m=0);let N=F(a,4);if(!N){!n&&o.z>=Fr&&E.z>=Ur&&!F(a,1)&&(a=G(a,1024),m=Br);let W=te(o,E,Gr);p=r.z-W.z}a=G(a,4),!N&&(n||F(a,1))&&(a=G(a,16),m=Ir)}}let{waterlevel:C,watertype:T}=Te({origin:s,mins:i,viewheight:l,pointContents:x});return{pmFlags:a,pmTime:m,onGround:F(a,4),groundTrace:A,groundContents:_,waterlevel:C,watertype:T,impactDelta:p}}var sn=1,Hr=60,ht=1.01;function Kr(t){let{origin:e,frametime:n,mins:o,maxs:r,trace:s,overbounce:i=ht,stepSize:c,maxBumps:l,maxClipPlanes:u,hasTime:x,forward:a,right:m,cmd:p,pmFlags:f,onGround:A,gravity:_,pmType:g,pmAccelerate:C,pmAirAccelerate:T=sn,pmMaxSpeed:S,pmDuckSpeed:O,onLadder:E,waterlevel:v,watertype:N,groundContents:W,viewPitch:k,ladderMod:h,pmWaterSpeed:D}=t,V={...t.velocity},I=Jr(a,m,p);I=Fe({wishVelocity:I,onLadder:E,onGround:A,waterlevel:v,watertype:N,groundContents:W,cmd:p,viewPitch:k,maxSpeed:F(f,1)?O:S,ladderMod:h,waterSpeed:D,forward:a,origin:e,mins:o,maxs:r,trace:s});let U=F(f,1)?O:S,H=I,y=B(H);if(y!==0&&(H=P(H)),y>U){let q=U/y;I=M(I,q),y=U,y!==0&&(H=P(I))}return E?(V=Y({velocity:V,wishdir:H,wishspeed:y,accel:C,frametime:n}),Math.abs(I.z)<Number.EPSILON&&(V=Zr(V,_,n)),Be({origin:e,velocity:V,frametime:n,mins:o,maxs:r,trace:s,overbounce:i,stepSize:c,maxBumps:l,maxClipPlanes:u,hasTime:x})):A?(V={...V,z:0},V=Y({velocity:V,wishdir:H,wishspeed:y,accel:C,frametime:n}),_>0?V={...V,z:0}:V={...V,z:V.z-_*n},V.x===0&&V.y===0?{origin:e,velocity:V,planes:[],blocked:0,stopped:!0,stepped:!1,stepHeight:0}:Be({origin:e,velocity:V,frametime:n,mins:o,maxs:r,trace:s,overbounce:i,stepSize:c,maxBumps:l,maxClipPlanes:u,hasTime:x})):(T>0?V=at({velocity:V,wishdir:H,wishspeed:y,accel:T,frametime:n}):V=Y({velocity:V,wishdir:H,wishspeed:y,accel:sn,frametime:n}),g!==1&&(V={...V,z:V.z-_*n}),Be({origin:e,velocity:V,frametime:n,mins:o,maxs:r,trace:s,overbounce:i,stepSize:c,maxBumps:l,maxClipPlanes:u,hasTime:x}))}function Xr(t){let{origin:e,frametime:n,mins:o,maxs:r,trace:s,overbounce:i=ht,stepSize:c,maxBumps:l,maxClipPlanes:u,hasTime:x,forward:a,right:m,cmd:p,pmFlags:f,onGround:A,pmMaxSpeed:_,pmDuckSpeed:g,pmWaterAccelerate:C,pmWaterSpeed:T,onLadder:S,watertype:O,groundContents:E,waterlevel:v,viewPitch:N,ladderMod:W}=t,k={...t.velocity},h=Yr(a,m,p);jr(p,A)?h={...h,z:h.z-Hr}:cn(p,16)?h=R(h,{x:0,y:0,z:-T*.5}):cn(p,8)&&(h=R(h,{x:0,y:0,z:T*.5})),h=Fe({wishVelocity:h,onLadder:S,onGround:A,waterlevel:v,watertype:O,groundContents:E,cmd:p,viewPitch:N,maxSpeed:F(f,1)?g:_,ladderMod:W,waterSpeed:T,forward:a,origin:e,mins:o,maxs:r,trace:s});let D=h,V=B(D);if(V!==0&&(D=P(D)),V>_){let j=_/V;h=M(h,j),V=_,V!==0&&(D=P(h))}if(V*=.5,F(f,1)&&V>g){let j=g/V;h=M(h,j),V=g,V!==0&&(D=P(h))}return k=Y({velocity:k,wishdir:D,wishspeed:V,accel:C,frametime:n}),Be({origin:e,velocity:k,frametime:n,mins:o,maxs:r,trace:s,overbounce:i,stepSize:c,maxBumps:l,maxClipPlanes:u,hasTime:x})}function Jr(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 Yr(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 cn(t,e){return!!((t.buttons??0)&e)}function jr(t,e){let n=t.forwardmove===0&&t.sidemove===0,o=!((t.buttons??0)&24);return n&&o&&!e}function Zr(t,e,n){let o=t.z,r=e*n;return o>0?(o-=r,o<0&&(o=0)):(o+=r,o>0&&(o=0)),{...t,z:o}}function Be(t){let{origin:e,velocity:n,frametime:o,mins:r,maxs:s,trace:i,overbounce:c=ht,stepSize:l,maxBumps:u,maxClipPlanes:x,hasTime:a}=t;return se({origin:e,velocity:n,frametime:o,trace:i,mins:r,maxs:s,overbounce:c,stepSize:l,maxBumps:u,maxClipPlanes:x,hasTime:a})}var qr=1,$r=40,Ie=50,an=350,Qr=2048,ln=.1,es=800,ts=50,un=.7,ns=18,os=1.01,rs=2;function ss(t){let{pmFlags:e,pmTime:n,waterlevel:o,watertype:r,gravity:s,cmd:i,forward:c,origin:l,velocity:u,mins:x,maxs:a,viewheight:m,trace:p,pointContents:f,onGround:A,overbounce:_=os,stepSize:g=ns,maxBumps:C,maxClipPlanes:T}=t;if(n>0)return{pmFlags:e,pmTime:n,velocity:u,performedWaterJump:!1};let S=X(e,128),O=n,E=u,v=P({x:c.x,y:c.y,z:0}),N=ie(v)>0;if(o<2&&N){let y=R(l,M(v,qr)),q=p(l,y,x,a),En=q.contents??0;q.fraction<1&&(En&536870912)!==0&&(S=G(S,128))}if(s===0)return{pmFlags:S,pmTime:O,velocity:E,performedWaterJump:!1};if(((i.buttons??0)&8)===0&&i.forwardmove<=0)return{pmFlags:S,pmTime:O,velocity:E,performedWaterJump:!1};if(o!==2)return{pmFlags:S,pmTime:O,velocity:E,performedWaterJump:!1};if((r&8192)!==0)return{pmFlags:S,pmTime:O,velocity:E,performedWaterJump:!1};if(!N)return{pmFlags:S,pmTime:O,velocity:E,performedWaterJump:!1};let W=R(l,M(v,$r)),k=p(l,W,x,a);if(k.fraction===1||!k.planeNormal||k.planeNormal.z>=un)return{pmFlags:S,pmTime:O,velocity:E,performedWaterJump:!1};let h={x:v.x*Ie,y:v.y*Ie,z:an},D=l,V=!0,I=is(s);for(let y=0;y<I;y++){h={x:h.x,y:h.y,z:h.z-s*ln},h.z<0&&(V=!1);let q=se({origin:D,velocity:h,frametime:ln,trace:p,mins:x,maxs:a,overbounce:_,stepSize:g,maxBumps:C,maxClipPlanes:T,hasTime:V});D=q.origin,h=q.velocity}let j=R(D,{x:0,y:0,z:-rs}),U=p(D,j,x,a);return U.fraction===1||!U.planeNormal||U.planeNormal.z<un||U.endpos.z<l.z?{pmFlags:S,pmTime:O,velocity:E,performedWaterJump:!1}:A&&Math.abs(l.z-U.endpos.z)<=g?{pmFlags:S,pmTime:O,velocity:E,performedWaterJump:!1}:Te({origin:U.endpos,mins:x,viewheight:m,pointContents:f}).waterlevel>=2?{pmFlags:S,pmTime:O,velocity:E,performedWaterJump:!1}:(S=G(S,8),O=Qr,E={x:v.x*Ie,y:v.y*Ie,z:an},{pmFlags:S,pmTime:O,velocity:E,performedWaterJump:!0})}function is(t){if(t===0)return 0;let e=Math.floor(10*(es/t));return e<=0?0:Math.min(ts,e)}var bt=[0,-1,1];function yt(t){let{origin:e,mins:n,maxs:o,trace:r}=t;return!r(e,e,n,o).allsolid}function cs(t){let{origin:e,velocity:n,mins:o,maxs:r,previousOrigin:s,trace:i}=t;if(yt({origin:e,mins:o,maxs:r,trace:i}))return{origin:{...e},velocity:{...n},resolution:"unchanged"};let c=mt({origin:e,mins:o,maxs:r,trace:(l,u,x,a)=>i(l,a,u,x)});return c.result==="fixed"||c.result==="good-position"?{origin:c.origin,velocity:{...n},resolution:"fixed"}:{origin:{...s},velocity:{...n},resolution:"reverted"}}function as(t){let{origin:e,mins:n,maxs:o,trace:r}=t;for(let s of bt)for(let i of bt)for(let c of bt){let l={x:e.x+c,y:e.y+i,z:e.z+s};if(yt({origin:l,mins:n,maxs:o,trace:r}))return{origin:l,snapped:c!==0||i!==0||s!==0}}return{origin:{...e},snapped:!1}}function ls(t,e){return{x:t.x+e.x,y:t.y+e.y,z:t.z+e.z}}function us(t){return t>89&&t<180?89:t<271&&t>=180?271:t}function fs(t){let{pmFlags:e,cmdAngles:n,deltaAngles:o}=t,r;(e&32)!==0?r={x:0,y:n.y+o.y,z:0}:(r=ls(n,o),r={...r,x:us(r.x)});let s=pe(r);return{viewangles:r,...s}}var ds=200,ms=200,xs=200,ps=140,hs=150,bs=3;function ys(t){let e=xe(t);return e>89&&e<180?89:e<271&&e>=180?271:e}function Ts(t,e){return{x:ys(t.x+e.x),y:xe(t.y+e.y),z:xe(t.z+e.z)}}function Ss(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 fn=(y=>(y[y.bad=0]="bad",y[y.muzzleflash=1]="muzzleflash",y[y.muzzleflash2=2]="muzzleflash2",y[y.temp_entity=3]="temp_entity",y[y.layout=4]="layout",y[y.inventory=5]="inventory",y[y.nop=6]="nop",y[y.disconnect=7]="disconnect",y[y.reconnect=8]="reconnect",y[y.sound=9]="sound",y[y.print=10]="print",y[y.stufftext=11]="stufftext",y[y.serverdata=12]="serverdata",y[y.configstring=13]="configstring",y[y.spawnbaseline=14]="spawnbaseline",y[y.centerprint=15]="centerprint",y[y.download=16]="download",y[y.playerinfo=17]="playerinfo",y[y.packetentities=18]="packetentities",y[y.deltapacketentities=19]="deltapacketentities",y[y.frame=20]="frame",y[y.splitclient=21]="splitclient",y[y.configblast=22]="configblast",y[y.spawnbaselineblast=23]="spawnbaselineblast",y[y.level_restart=24]="level_restart",y[y.damage=25]="damage",y[y.locprint=26]="locprint",y[y.fog=27]="fog",y[y.waitingforplayers=28]="waitingforplayers",y[y.bot_chat=29]="bot_chat",y[y.poi=30]="poi",y[y.help_path=31]="help_path",y[y.muzzleflash3=32]="muzzleflash3",y[y.achievement=33]="achievement",y))(fn||{}),dn=(s=>(s[s.bad=0]="bad",s[s.nop=1]="nop",s[s.move=2]="move",s[s.userinfo=3]="userinfo",s[s.stringcmd=4]="stringcmd",s))(dn||{});var mn=(d=>(d[d.GUNSHOT=0]="GUNSHOT",d[d.BLOOD=1]="BLOOD",d[d.BLASTER=2]="BLASTER",d[d.RAILTRAIL=3]="RAILTRAIL",d[d.SHOTGUN=4]="SHOTGUN",d[d.EXPLOSION1=5]="EXPLOSION1",d[d.EXPLOSION2=6]="EXPLOSION2",d[d.ROCKET_EXPLOSION=7]="ROCKET_EXPLOSION",d[d.GRENADE_EXPLOSION=8]="GRENADE_EXPLOSION",d[d.SPARKS=9]="SPARKS",d[d.SPLASH=10]="SPLASH",d[d.BUBBLETRAIL=11]="BUBBLETRAIL",d[d.SCREEN_SPARKS=12]="SCREEN_SPARKS",d[d.SHIELD_SPARKS=13]="SHIELD_SPARKS",d[d.BULLET_SPARKS=14]="BULLET_SPARKS",d[d.LASER_SPARKS=15]="LASER_SPARKS",d[d.PARASITE_ATTACK=16]="PARASITE_ATTACK",d[d.ROCKET_EXPLOSION_WATER=17]="ROCKET_EXPLOSION_WATER",d[d.GRENADE_EXPLOSION_WATER=18]="GRENADE_EXPLOSION_WATER",d[d.MEDIC_CABLE_ATTACK=19]="MEDIC_CABLE_ATTACK",d[d.BFG_EXPLOSION=20]="BFG_EXPLOSION",d[d.BFG_BIGEXPLOSION=21]="BFG_BIGEXPLOSION",d[d.BOSSTPORT=22]="BOSSTPORT",d[d.BFG_LASER=23]="BFG_LASER",d[d.GRAPPLE_CABLE=24]="GRAPPLE_CABLE",d[d.WELDING_SPARKS=25]="WELDING_SPARKS",d[d.GREENBLOOD=26]="GREENBLOOD",d[d.BLUEHYPERBLASTER=27]="BLUEHYPERBLASTER",d[d.PLASMA_EXPLOSION=28]="PLASMA_EXPLOSION",d[d.TUNNEL_SPARKS=29]="TUNNEL_SPARKS",d[d.BLASTER2=30]="BLASTER2",d[d.RAILTRAIL2=31]="RAILTRAIL2",d[d.FLAME=32]="FLAME",d[d.LIGHTNING=33]="LIGHTNING",d[d.DEBUGTRAIL=34]="DEBUGTRAIL",d[d.PLAIN_EXPLOSION=35]="PLAIN_EXPLOSION",d[d.FLASHLIGHT=36]="FLASHLIGHT",d[d.FORCEWALL=37]="FORCEWALL",d[d.HEATBEAM=38]="HEATBEAM",d[d.MONSTER_HEATBEAM=39]="MONSTER_HEATBEAM",d[d.STEAM=40]="STEAM",d[d.BUBBLETRAIL2=41]="BUBBLETRAIL2",d[d.MOREBLOOD=42]="MOREBLOOD",d[d.HEATBEAM_SPARKS=43]="HEATBEAM_SPARKS",d[d.HEATBEAM_STEAM=44]="HEATBEAM_STEAM",d[d.CHAINFIST_SMOKE=45]="CHAINFIST_SMOKE",d[d.ELECTRIC_SPARKS=46]="ELECTRIC_SPARKS",d[d.TRACKER_EXPLOSION=47]="TRACKER_EXPLOSION",d[d.TELEPORT_EFFECT=48]="TELEPORT_EFFECT",d[d.DBALL_GOAL=49]="DBALL_GOAL",d[d.WIDOWBEAMOUT=50]="WIDOWBEAMOUT",d[d.NUKEBLAST=51]="NUKEBLAST",d[d.WIDOWSPLASH=52]="WIDOWSPLASH",d[d.EXPLOSION1_BIG=53]="EXPLOSION1_BIG",d[d.EXPLOSION1_NP=54]="EXPLOSION1_NP",d[d.FLECHETTE=55]="FLECHETTE",d[d.BLUEHYPERBLASTER_KEX=56]="BLUEHYPERBLASTER_KEX",d[d.BFG_ZAP=57]="BFG_ZAP",d[d.BERSERK_SLAM=58]="BERSERK_SLAM",d[d.GRAPPLE_CABLE_2=59]="GRAPPLE_CABLE_2",d[d.POWER_SPLASH=60]="POWER_SPLASH",d[d.LIGHTNING_BEAM=61]="LIGHTNING_BEAM",d[d.EXPLOSION1_NL=62]="EXPLOSION1_NL",d[d.EXPLOSION2_NL=63]="EXPLOSION2_NL",d))(mn||{});var _s=1024,As=256,gs=16,Es=64,Ns=512,Vs=1400,Cs=0,Os=1,Rs=2,Ms=3,vs=4,Ls=5,Ps=6,ws=7,zs=8,Fs=9,Ds=10,Us=11,Bs=12,Is=13;var xn=(i=>(i[i.LAYOUTS_LAYOUT=1]="LAYOUTS_LAYOUT",i[i.LAYOUTS_INVENTORY=2]="LAYOUTS_INVENTORY",i[i.LAYOUTS_HIDE_HUD=4]="LAYOUTS_HIDE_HUD",i[i.LAYOUTS_INTERMISSION=8]="LAYOUTS_INTERMISSION",i[i.LAYOUTS_HELP=16]="LAYOUTS_HELP",i[i.LAYOUTS_HIDE_CROSSHAIR=32]="LAYOUTS_HIDE_CROSSHAIR",i))(xn||{});function Tt(t){return t<<16>>16}function pn(t,e,n){let o=Math.floor(n/2),r=n%2!==0,s=e+o,i=t[s]||0;if(r){let c=t[s+1]||0,l=i>>>8&255;return(c&255)<<8|l}else return i&65535}function Gs(t,e,n,o){let r=Math.floor(n/2),s=n%2!==0,i=e+r;if(t[i]===void 0&&(t[i]=0),!s)t[i]=Tt(o);else{t[i+1]===void 0&&(t[i+1]=0);let c=t[i],l=t[i+1],u=o&255,x=c&255|u<<8;t[i]=Tt(x);let m=o>>>8&255|l&65280;t[i+1]=Tt(m)}}function St(t,e,n,o,r){let s=r*n,i=Math.floor(s/8),c=s%8,l=(1<<r)-1<<c,x=pn(t,e,i)&~l|o<<c&l;Gs(t,e,i,x&65535)}function _t(t,e,n,o){let r=o*n,s=Math.floor(r/8),i=r%8,c=(1<<o)-1<<i;return(pn(t,e,s)&c)>>>i}var hn=(N=>(N.QuadDamage="quad",N.Invulnerability="invulnerability",N.EnviroSuit="enviro_suit",N.Rebreather="rebreather",N.Silencer="silencer",N.PowerScreen="power_screen",N.PowerShield="power_shield",N.QuadFire="quad_fire",N.Invisibility="invisibility",N.Bandolier="bandolier",N.AmmoPack="ammo_pack",N.IRGoggles="ir_goggles",N.DoubleDamage="double_damage",N.SphereVengeance="sphere_vengeance",N.SphereHunter="sphere_hunter",N.SphereDefender="sphere_defender",N.Doppelganger="doppelganger",N.TagToken="tag_token",N.TechResistance="tech_resistance",N.TechStrength="tech_strength",N.TechHaste="tech_haste",N.TechRegeneration="tech_regeneration",N.Flashlight="flashlight",N.Compass="compass",N))(hn||{});var bn=(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))(bn||{}),Ge=12,We=9,Ws=Math.ceil(Ge*We/16),ke=23,He=2,ks=Math.ceil(ke*He/16),yn={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 Hs(t,e,n){if(e<0||e>=Ge)return;let o=n;o>511&&(o=511),o<0&&(o=0),St(t,34,e,o,We)}function Ks(t,e){return e<0||e>=Ge?0:_t(t,34,e,We)}function Xs(t,e,n){let o;if(typeof e=="number"?o=e:o=yn[e],o===void 0||o<0||o>=ke)return;let r=n;r>3&&(r=3),r<0&&(r=0),St(t,41,o,r,He)}function Js(t,e){let n;return typeof e=="number"?n=e:n=yn[e],n===void 0||n<0||n>=ke?0:_t(t,41,n,He)}function Ys(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(0),t.writeByte(0)}var Tn=(T=>(T[T.MinLight=1]="MinLight",T[T.ViewerModel=2]="ViewerModel",T[T.WeaponModel=4]="WeaponModel",T[T.FullBright=8]="FullBright",T[T.DepthHack=16]="DepthHack",T[T.Translucent=32]="Translucent",T[T.FrameLerp=64]="FrameLerp",T[T.Beam=128]="Beam",T[T.CustomLight=256]="CustomLight",T[T.Glow=512]="Glow",T[T.ShellRed=1024]="ShellRed",T[T.ShellGreen=2048]="ShellGreen",T[T.ShellBlue=4096]="ShellBlue",T[T.IrVisible=32768]="IrVisible",T[T.ShellDouble=65536]="ShellDouble",T[T.ShellHalfDam=131072]="ShellHalfDam",T[T.MinLightPlus=262144]="MinLightPlus",T[T.ExtraLight=524288]="ExtraLight",T[T.BeamLightning=1048576]="BeamLightning",T))(Tn||{});var js=[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 Zs(t){let e=0;for(let n=0;n<t.length;n++)e=js[(e^t[n])&255];return e}var At={};Je(At,{U_ANGLE1:()=>oi,U_ANGLE2:()=>ri,U_ANGLE3:()=>si,U_EFFECTS:()=>ai,U_EVENT:()=>fi,U_FRAME:()=>ii,U_MODEL:()=>$s,U_MODEL2:()=>mi,U_MODEL3:()=>xi,U_MODEL4:()=>pi,U_MOREBITS:()=>di,U_NUMBER:()=>qs,U_ORIGIN1:()=>ei,U_ORIGIN2:()=>ti,U_ORIGIN3:()=>ni,U_REMOVE:()=>hi,U_RENDERFX:()=>li,U_SKIN:()=>ci,U_SOLID:()=>ui,U_SOUND:()=>Qs});var qs=1,$s=2,Qs=4,ei=8,ti=16,ni=32,oi=64,ri=128,si=256,ii=512,ci=1024,ai=2048,li=4096,ui=8192,fi=16384,di=32768,mi=1,xi=2,pi=4,hi=32768;var Se=.025,gt=33554432,Ke={None:0,Feet:1,Waist:2,Under:3},bi=(t,e)=>{let n={...t.origin};n.z-=.25;let o=e(t.origin,n);return{...t,onGround:o.fraction<1}},yi=(t,e)=>{let n={...t.origin},{mins:o,maxs:r}=t;if(n.z=t.origin.z+o.z+1,!(e(n)>))return{...t,waterLevel:Ke.None};let i=Ke.Feet,c=t.origin.z+(o.z+r.z)*.5;if(n.z=c,e(n)>){i=Ke.Waist;let u=t.origin.z+22;n.z=u,e(n)>&&(i=Ke.Under)}return{...t,waterLevel:i}},Ti=(t,e,n,o)=>{let r={...t};r=bi(r,n),r=yi(r,o);let{origin:s,velocity:i,onGround:c,waterLevel:l,viewAngles:u}=r,x=l>=2?u:{x:u.x>180?(u.x-360)/3:u.x/3,y:u.y,z:u.z},{forward:a,right:m}=pe(x),p=ct({velocity:i,frametime:Se,onGround:c,groundIsSlick:!1,onLadder:!1,waterlevel:l,pmFriction:6,pmStopSpeed:100,pmWaterFriction:1}),f=l>=2?ut({forward:a,right:m,cmd:e,maxSpeed:320}):lt({forward:a,right:m,cmd:e,maxSpeed:320}),A=Y({velocity:p,wishdir:f.wishdir,wishspeed:f.wishspeed,accel:c||l>=2?10:1,frametime:Se}),_=n(s,{x:s.x+A.x*Se,y:s.y+A.y*Se,z:s.z+A.z*Se});return{...r,origin:_.endpos,velocity:A}};var Et=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}seek(e){if(e<0||e>this.length)throw new Error(`Seek out of bounds: ${e} (length: ${this.length})`);this.offset=e}hasMore(){return this.offset<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 _e=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}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 r=0;r<J.length;r++){let s=J[r],i=e.x*s[0]+e.y*s[1]+e.z*s[2];i>n&&(n=i,o=r)}this.writeByte(o)}getData(){return this.buffer.slice(0,this.offset)}getBuffer(){return this.buffer}getOffset(){return this.offset}reset(){this.offset=0}};var Nt=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 r=0,s=-999999,i=Math.sqrt(e*e+n*n+o*o);if(i>0){e/=i,n/=i,o/=i;for(let c=0;c<162;c++){let l=e*J[c][0]+n*J[c][1]+o*J[c][2];l>s&&(s=l,r=c)}}this.writeByte(r)}};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.lastReceived=0;this.lastSent=0;this.remoteAddress=null;this.reliableMessage=new _e(w.MAX_MSGLEN);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.lastReceived=Date.now(),this.lastSent=Date.now()}transmit(e){this.outgoingSequence++,this.lastSent=Date.now();let n=w.PACKET_HEADER,o=this.reliableLength>0?this.reliableLength+2:0,r=e?e.length:0;n+o+r>w.MAX_MSGLEN&&(r=w.MAX_MSGLEN-n-o,r<0&&(r=0));let s=new ArrayBuffer(n+o+r),i=new DataView(s),c=new Uint8Array(s),l=this.outgoingSequence;this.reliableLength>0&&(l|=2147483648,(this.outgoingReliableSequence&1)!==0&&(l|=1073741824)),i.setUint32(0,l,!0);let u=this.incomingSequence;(this.incomingReliableSequence&1)!==0&&(u|=2147483648),i.setUint32(4,u,!0),i.setUint16(8,this.qport,!0);let x=n;if(this.reliableLength>0){i.setUint16(x,this.reliableLength,!0),x+=2;let m=this.reliableMessage.getBuffer().subarray(0,this.reliableLength);c.set(m,x),x+=this.reliableLength}if(e&&r>0){let a=e.slice(0,r);c.set(a,x)}return c}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),r=n.getUint32(4,!0),s=n.getUint16(8,!0);if(this.qport!==s)return null;let i=o&1073741823;if((i-this.incomingSequence|0)<=0)return null;this.incomingSequence=i;let c=r&2147483647,l=(r&2147483648)!==0;if(c>this.incomingAcknowledged&&(this.incomingAcknowledged=c),this.reliableLength>0){let f=l?1:0,A=this.outgoingReliableSequence&1;f!==A&&(this.reliableLength=0,this.reliableMessage.reset(),this.outgoingReliableSequence^=1)}let u=(o&2147483648)!==0,x=(o&1073741824)!==0?1:0,a=w.PACKET_HEADER,m=null;if(u){if(a+2>e.byteLength)return null;let f=n.getUint16(a,!0);a+=2;let A=this.incomingReliableSequence&1;if(x===A){if(this.incomingReliableSequence++,a+f>e.byteLength)return null;m=e.slice(a,a+f)}a+=f}let p=e.slice(a);if(m&&m.length>0){let f=m.length+p.length,A=new Uint8Array(f);return A.set(m,0),A.set(p,m.length),A}return p||new Uint8Array(0)}canSendReliable(){return this.reliableLength===0}writeReliableByte(e){if(this.reliableLength+1>w.MAX_MSGLEN-w.HEADER_OVERHEAD)throw new Error("NetChan reliable buffer overflow");this.reliableMessage.writeByte(e),this.reliableLength++}writeReliableShort(e){if(this.reliableLength+2>w.MAX_MSGLEN-w.HEADER_OVERHEAD)throw new Error("NetChan reliable buffer overflow");this.reliableMessage.writeShort(e),this.reliableLength+=2}writeReliableLong(e){if(this.reliableLength+4>w.MAX_MSGLEN-w.HEADER_OVERHEAD)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_MSGLEN-w.HEADER_OVERHEAD)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;var Vt=w;var Sn=(S=>(S.Blaster="blaster",S.Shotgun="shotgun",S.SuperShotgun="supershotgun",S.Machinegun="machinegun",S.Chaingun="chaingun",S.HandGrenade="grenades",S.GrenadeLauncher="grenadelauncher",S.RocketLauncher="rocketlauncher",S.HyperBlaster="hyperblaster",S.Railgun="railgun",S.BFG10K="bfg10k",S.Grapple="grapple",S.ChainFist="chainfist",S.EtfRifle="etf_rifle",S.ProxLauncher="prox_launcher",S.IonRipper="ionripper",S.PlasmaBeam="plasmabeam",S.Phalanx="phalanx",S.Disruptor="disruptor",S.Trap="trap",S))(Sn||{});var Ct=(f=>(f[f.Bullets=0]="Bullets",f[f.Shells=1]="Shells",f[f.Rockets=2]="Rockets",f[f.Grenades=3]="Grenades",f[f.Cells=4]="Cells",f[f.Slugs=5]="Slugs",f[f.MagSlugs=6]="MagSlugs",f[f.Trap=7]="Trap",f[f.Flechettes=8]="Flechettes",f[f.Tesla=9]="Tesla",f[f.Disruptor=10]="Disruptor",f[f.Prox=11]="Prox",f[f.Nuke=12]="Nuke",f[f.Rounds=13]="Rounds",f))(Ct||{}),Si=Object.keys(Ct).length/2,_n=(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))(_n||{});var _i=["blaster","shotgun","supershotgun","machinegun","chaingun","grenadelauncher","rocketlauncher","grenades","hyperblaster","railgun","bfg10k"],Ai={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 nl=32,An=(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))(An||{}),ol=-1,rl=0,sl=1,il=2,cl=3,al=80,ll=.003;function gn(t){return t===3?t*.001:t*5e-4}function gi(t){let e=gn(t);return e<=0?Number.POSITIVE_INFINITY:80+1/e}return Rn(Ei);})();
|
|
1
|
+
"use strict";var Quake2Shared=(()=>{var Ze=Object.defineProperty;var wn=Object.getOwnPropertyDescriptor;var Ln=Object.getOwnPropertyNames;var Fn=Object.prototype.hasOwnProperty;var qe=(t,e)=>{for(var n in e)Ze(t,n,{get:e[n],enumerable:!0})},zn=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ln(e))!Fn.call(t,r)&&r!==n&&Ze(t,r,{get:()=>e[r],enumerable:!(o=wn(e,r))||o.enumerable});return t};var Dn=t=>zn(Ze({},"__esModule",{value:!0}),t);var Ni={};qe(Ni,{AMMO_MAX:()=>Ke,AMMO_TYPE_COUNT:()=>Ai,ANORMS:()=>j,ATTN_IDLE:()=>yl,ATTN_LOOP_NONE:()=>pl,ATTN_NONE:()=>xl,ATTN_NORM:()=>hl,ATTN_STATIC:()=>bl,AmmoItemId:()=>On,AmmoType:()=>Lt,BinaryStream:()=>Mt,BinaryWriter:()=>Ee,CGAME_EXPORT_KEYS:()=>lr,CGAME_IMPORT_KEYS:()=>cr,CMD_BACKUP:()=>Ns,CONTENTS_AREAPORTAL:()=>ki,CONTENTS_AUX:()=>Di,CONTENTS_CURRENT_0:()=>po,CONTENTS_CURRENT_180:()=>ho,CONTENTS_CURRENT_270:()=>yo,CONTENTS_CURRENT_90:()=>xo,CONTENTS_CURRENT_DOWN:()=>To,CONTENTS_CURRENT_UP:()=>bo,CONTENTS_DEADMONSTER:()=>Yi,CONTENTS_DETAIL:()=>ji,CONTENTS_LADDER:()=>It,CONTENTS_LAVA:()=>Ui,CONTENTS_MIST:()=>Gi,CONTENTS_MONSTER:()=>Ji,CONTENTS_MONSTERCLIP:()=>Ki,CONTENTS_NONE:()=>Me,CONTENTS_NO_WATERJUMP:()=>mo,CONTENTS_ORIGIN:()=>Xi,CONTENTS_PLAYER:()=>qi,CONTENTS_PLAYERCLIP:()=>Hi,CONTENTS_PROJECTILE:()=>$i,CONTENTS_PROJECTILECLIP:()=>Wi,CONTENTS_SLIME:()=>Bi,CONTENTS_SOLID:()=>Fi,CONTENTS_TRANSLUCENT:()=>Zi,CONTENTS_TRIGGER:()=>fo,CONTENTS_WATER:()=>Ii,CONTENTS_WINDOW:()=>zi,CS_MAX_STRING_LENGTH:()=>Ua,CS_MAX_STRING_LENGTH_OLD:()=>Ba,ClientCommand:()=>Sn,CollisionEntityIndex:()=>ot,ConfigStringIndex:()=>ue,CvarFlags:()=>jt,DEFAULT_FORWARD_SPEED:()=>xs,DEFAULT_MOUSE_SENSITIVITY:()=>Ss,DEFAULT_PITCH_SPEED:()=>Ts,DEFAULT_SIDE_SPEED:()=>hs,DEFAULT_UP_SPEED:()=>ys,DEFAULT_YAW_SPEED:()=>bs,DEG2RAD:()=>to,DIST_EPSILON:()=>Z,EntityFlags:()=>Ot,GAME_EXPORT_KEYS:()=>ar,GAME_IMPORT_KEYS:()=>ir,G_GetAmmoStat:()=>Ys,G_GetPowerupStat:()=>Zs,G_SetAmmoStat:()=>Js,G_SetPowerupStat:()=>js,LAST_VISIBLE_CONTENTS:()=>Qi,LayoutFlags:()=>_n,MASK_ALL:()=>pa,MASK_BLOCK_SIGHT:()=>Sa,MASK_CURRENT:()=>So,MASK_DEADSOLID:()=>ha,MASK_LADDER_NAV_SOLID:()=>_a,MASK_MONSTERSOLID:()=>ya,MASK_NAV_SOLID:()=>ga,MASK_OPAQUE:()=>ba,MASK_PLAYERSOLID:()=>xa,MASK_PROJECTILE:()=>Ea,MASK_SHOT:()=>Ta,MASK_SOLID:()=>et,MASK_WALK_NAV_SOLID:()=>Aa,MASK_WATER:()=>Pe,MAX_CHALLENGES:()=>Es,MAX_CLIENTS:()=>Ho,MAX_CONFIGSTRINGS:()=>$o,MAX_EDICTS:()=>Da,MAX_GENERAL:()=>Zo,MAX_IMAGES:()=>Yo,MAX_INFO_STRING:()=>Cs,MAX_ITEMS:()=>jo,MAX_LIGHTSTYLES:()=>Ko,MAX_MODELS:()=>Xo,MAX_MSGLEN:()=>Os,MAX_OSPATH:()=>za,MAX_PACKET_ENTITIES:()=>vs,MAX_QPATH:()=>Fa,MAX_SHADOW_LIGHTS:()=>qo,MAX_SOUNDS:()=>Jo,MAX_SOUND_CHANNELS:()=>ml,MAX_STRING_CHARS:()=>Pa,MAX_STRING_TOKENS:()=>wa,MAX_TOKEN_CHARS:()=>La,MAX_WHEEL_ITEMS:()=>ct,MZ_BFG:()=>Ws,MZ_BLASTER:()=>Rs,MZ_CHAINGUN1:()=>ws,MZ_CHAINGUN2:()=>Ls,MZ_CHAINGUN3:()=>Fs,MZ_GRENADE:()=>Us,MZ_HYPERBLASTER:()=>ks,MZ_LOGIN:()=>Bs,MZ_LOGOUT:()=>Is,MZ_MACHINEGUN:()=>Ms,MZ_RAILGUN:()=>zs,MZ_ROCKET:()=>Ds,MZ_SHOTGUN:()=>Ps,MZ_SSHOTGUN:()=>Gs,MersenneTwister19937:()=>Oe,NUM_AMMO_STATS:()=>Ks,NUM_BITS_FOR_AMMO:()=>Xe,NUM_BITS_FOR_POWERUP:()=>Ye,NUM_POWERUP_STATS:()=>Xs,NetChan:()=>wt,NetworkMessageBuilder:()=>Pt,PITCH:()=>Ne,POWERUP_MAX:()=>Je,PlaneSide:()=>Wt,PlayerButton:()=>ie,PlayerStat:()=>vn,PmFlag:()=>q,PmType:()=>se,PowerupId:()=>En,RAD2DEG:()=>no,ROLL:()=>Qe,RandomGenerator:()=>Re,RenderFx:()=>Nn,Replay:()=>lt,SLIDEMOVE_BLOCKED_FLOOR:()=>on,SLIDEMOVE_BLOCKED_WALL:()=>rn,SOUND_FULLVOLUME:()=>Tl,SOUND_LOOP_ATTENUATE:()=>Sl,STOP_EPSILON:()=>Q,SURF_ALPHATEST:()=>la,SURF_FLOWING:()=>aa,SURF_LIGHT:()=>ta,SURF_N64_SCROLL_FLIP:()=>ma,SURF_N64_SCROLL_X:()=>da,SURF_N64_SCROLL_Y:()=>fa,SURF_N64_UV:()=>ua,SURF_NODRAW:()=>ca,SURF_NONE:()=>ea,SURF_SKY:()=>oa,SURF_SLICK:()=>na,SURF_TRANS33:()=>sa,SURF_TRANS66:()=>ia,SURF_WARP:()=>ra,ServerCommand:()=>Tn,SoundChannel:()=>Rn,TempEntity:()=>gn,UPDATE_BACKUP:()=>Vs,WEAPON_AMMO_MAP:()=>vi,WEAPON_WHEEL_ORDER:()=>Ei,WaterLevel:()=>de,WeaponId:()=>Cn,YAW:()=>Ce,ZERO_VEC3:()=>P,addBlendColor:()=>io,addContents:()=>Ao,addPmFlag:()=>G,addPointToBounds:()=>Jn,addVec3:()=>O,addViewAngles:()=>_s,angleMod:()=>xe,angleVectors:()=>oe,applyPmove:()=>_i,applyPmoveAccelerate:()=>Y,applyPmoveAddCurrents:()=>be,applyPmoveAirAccelerate:()=>bt,applyPmoveAirMove:()=>xt,applyPmoveFlyMove:()=>qr,applyPmoveFriction:()=>We,applyPmoveWalkMove:()=>yt,applyPmoveWaterMove:()=>ht,assertContract:()=>sr,attenuationToDistanceMultiplier:()=>Mn,boxContents:()=>Do,boxOnPlaneSide:()=>Po,boxesIntersect:()=>Yn,buildAirGroundWish:()=>St,buildCollisionModel:()=>Ro,buildWaterWish:()=>gt,calculateMaxAudibleDistance:()=>Vi,categorizePosition:()=>Be,checkDuckState:()=>Tt,checkJump:()=>dt,checkSpecialMovement:()=>cs,clampViewAngles:()=>ps,clipBoxToBrush:()=>st,clipVelocityAgainstPlanes:()=>jn,clipVelocityVec3:()=>ne,closestPointToBox:()=>Hn,combineSurfaceFlags:()=>Vo,computePlaneSignBits:()=>rt,computePlayerDimensions:()=>Ge,concatRotationMatrices:()=>$e,configStringSize:()=>Qo,copyVec3:()=>Bn,crc8:()=>Qs,createDefaultTrace:()=>Fe,createEmptyBounds3:()=>Xn,createMat4Identity:()=>Bt,createRandomGenerator:()=>ao,crossVec3:()=>te,currentVectorFromContents:()=>mt,degToRad:()=>ve,disableTraceDebug:()=>Co,distance:()=>Wn,distanceBetweenBoxesSquared:()=>Kn,dotVec3:()=>U,enableTraceDebug:()=>No,fixStuckObjectGeneric:()=>At,getWaterLevel:()=>Se,goodPosition:()=>vt,groundCurrentVelocity:()=>tn,hasAllContents:()=>go,hasAnyContents:()=>_o,hasPmFlag:()=>z,hasSurfaceFlags:()=>vo,inPHS:()=>Bo,inPVS:()=>Uo,initialSnapPosition:()=>ds,isAtLeastWaistDeep:()=>ut,isUnderwater:()=>ur,lengthSquaredVec3:()=>ce,lengthVec3:()=>I,lerpAngle:()=>oo,mat4FromBasis:()=>uo,mouseDeltaToViewDelta:()=>As,multiplyMat4:()=>co,multiplyVec3:()=>In,negateVec3:()=>Gn,normalizeVec3:()=>w,perpendicularVec3:()=>zt,planeDistanceToPoint:()=>re,pmoveCmdScale:()=>kr,pointContents:()=>Fo,pointContentsMany:()=>zo,pointInsideBrush:()=>kt,pointOnPlaneSide:()=>Mo,projectPointOnPlane:()=>Ft,projectSourceVec3:()=>qn,projectSourceVec3WithUp:()=>$n,radToDeg:()=>Ve,removeContents:()=>Eo,removePmFlag:()=>X,resolveSlideMove:()=>sn,rotatePointAroundVector:()=>eo,runPmove:()=>Hr,scaleVec3:()=>R,slerpVec3:()=>Qn,slideClipVelocityVec3:()=>Zn,slideMove:()=>pt,snapPosition:()=>us,stepSlideMove:()=>ae,subtractVec3:()=>ee,testBoxInBrush:()=>Ht,traceBox:()=>Yt,traceDebugInfo:()=>J,transformPointMat4:()=>lo,validateContract:()=>Zt,vec3Equals:()=>kn,vectorToAngles:()=>so,vectorToYaw:()=>ro,waterCurrentVelocity:()=>en,writeUserCommand:()=>qs});var P={x:0,y:0,z:0},Q=.1,Un=Math.PI/180;function Bn(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 ee(t,e){return{x:t.x-e.x,y:t.y-e.y,z:t.z-e.z}}function In(t,e){return{x:t.x*e.x,y:t.y*e.y,z:t.z*e.z}}function R(t,e){return{x:t.x*e,y:t.y*e,z:t.z*e}}function Gn(t){return R(t,-1)}function U(t,e){return t.x*e.x+t.y*e.y+t.z*e.z}function te(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 ce(t){return U(t,t)}function I(t){return Math.sqrt(ce(t))}function Wn(t,e){return I(ee(t,e))}function kn(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z}function w(t){let e=I(t);return e===0?t:R(t,1/e)}function Ft(t,e){let n=1/U(e,e),o=U(e,t)*n;return ee(t,R(e,n*o))}function zt(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),w(Ft(e===0?{x:1,y:0,z:0}:e===1?{x:0,y:1,z:0}:{x:0,y:0,z:1},t))}function Hn(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 Kn(t,e,n,o){let r=0;if(e.x<n.x){let s=e.x-n.x;r+=s*s}else if(t.x>o.x){let s=t.x-o.x;r+=s*s}if(e.y<n.y){let s=e.y-n.y;r+=s*s}else if(t.y>o.y){let s=t.y-o.y;r+=s*s}if(e.z<n.z){let s=e.z-n.z;r+=s*s}else if(t.z>o.z){let s=t.z-o.z;r+=s*s}return r}function Xn(){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 Jn(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 Yn(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 ne(t,e,n){let o=U(t,e)*n,r=t.x-e.x*o,s=t.y-e.y*o,i=t.z-e.z*o;return r>-Q&&r<Q&&(r=0),s>-Q&&s<Q&&(s=0),i>-Q&&i<Q&&(i=0),{x:r,y:s,z:i}}function jn(t,e,n,o){if(e.length===0)return t;let r=t;for(let s=0;s<e.length;s++){r=ne(r,e[s],n);let i=0;for(;i<e.length&&!(i!==s&&U(r,e[i])<0);i++);if(i===e.length)return o&&U(r,o)<=0?P:r}if(e.length===2){let s=te(e[0],e[1]),i=U(s,t),a=R(s,i);return o&&U(a,o)<=0?P:a}return o&&U(r,o)<=0,P}function Zn(t,e,n){return ne(t,e,n)}function qn(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 $n(t,e,n,o,r){return{x:t.x+n.x*e.x+o.x*e.y+r.x*e.z,y:t.y+n.y*e.x+o.y*e.y+r.y*e.z,z:t.z+n.z*e.x+o.z*e.y+r.z*e.z}}function Qn(t,e,n){let o=U(t,e),r,s;if(Math.abs(o)>.9995)r=1-n,s=n;else{let i=Math.acos(o),a=Math.sin(i),l=Math.sin((1-n)*i),d=Math.sin(n*i);r=l/a,s=d/a}return{x:t.x*r+e.x*s,y:t.y*r+e.y*s,z:t.z*r+e.z*s}}function $e(t,e){let n=r=>[t[r][0]*e[0][0]+t[r][1]*e[1][0]+t[r][2]*e[2][0],t[r][0]*e[0][1]+t[r][1]*e[1][1]+t[r][2]*e[2][1],t[r][0]*e[0][2]+t[r][1]*e[1][2]+t[r][2]*e[2][2]];return[n(0),n(1),n(2)]}function eo(t,e,n){if(I(t)===0)return e;let r=w(t),s=zt(r),i=te(s,r),a=[[s.x,i.x,r.x],[s.y,i.y,r.y],[s.z,i.z,r.z]],l=[[a[0][0],a[1][0],a[2][0]],[a[0][1],a[1][1],a[2][1]],[a[0][2],a[1][2],a[2][2]]],d=n*Un,f=Math.cos(d),c=Math.sin(d),m=[[f,c,0],[-c,f,0],[0,0,1]],h=$e($e(a,m),l);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 Ne=0,Ce=1,Qe=2,Dt=Math.PI/180,Ut=180/Math.PI,to=Dt,no=Ut;function pe(t,e){switch(e){case Ne:return t.x;case Ce:return t.y;case Qe:default:return t.z}}function ve(t){return t*Dt}function Ve(t){return t*Ut}function oo(t,e,n){let o=e;return o-t>180?o-=360:o-t<-180&&(o+=360),t+n*(o-t)}function xe(t){let e=t%360;return e<0?360+e:e}function oe(t){let e=ve(pe(t,Ce)),n=ve(pe(t,Ne)),o=ve(pe(t,Qe)),r=Math.sin(e),s=Math.cos(e),i=Math.sin(n),a=Math.cos(n),l=Math.sin(o),d=Math.cos(o),f={x:a*s,y:a*r,z:-i},c={x:-l*i*s-d*-r,y:-l*i*r-d*s,z:-l*a},m={x:d*i*s-l*-r,y:d*i*r-l*s,z:d*a};return{forward:f,right:c,up:m}}function ro(t){let e=pe(t,Ne),n=pe(t,Ce);if(e===0)return n===0?0:n>0?90:270;let o=Ve(Math.atan2(n,e));return o<0?o+360:o}function so(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 r;e?r=Ve(Math.atan2(n,e)):n>0?r=90:r=270,r<0&&(r+=360);let s=Math.sqrt(e*e+n*n),i=Ve(Math.atan2(o,s));return i<0&&(i+=360),{x:-i,y:r,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 io(t,e,n,o,r){if(o<=0)return r;let s=r[0],i=r[1],a=r[2],l=r[3],d=l+(1-l)*o;if(d<=0)return[0,0,0,0];let f=l/d,c=s*f+t*(1-f),m=i*f+e*(1-f),h=a*f+n*(1-f);return[c,m,h,d]}var Oe=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,r=Math.imul(o>>>0,1812433253)+n;this.state[n]=r>>>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)}},Re=class{constructor(e={}){this.mt=new Oe(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,r=4294967296-4294967296%o,s;do s=this.mt.nextUint32();while(s>=r);return e+s%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 ao(t){return new Re(t)}function Bt(){return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function co(t,e){let n=new Float32Array(16);for(let o=0;o<4;o+=1)for(let r=0;r<4;r+=1)n[r*4+o]=t[0+o]*e[r*4+0]+t[4+o]*e[r*4+1]+t[8+o]*e[r*4+2]+t[12+o]*e[r*4+3];return n}function lo(t,e){let n=e.x,o=e.y,r=e.z;return{x:t[0]*n+t[4]*o+t[8]*r+t[12],y:t[1]*n+t[5]*o+t[9]*r+t[13],z:t[2]*n+t[6]*o+t[10]*r+t[14]}}function uo(t,e){let n=Bt();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}var Me=0,Fi=1,zi=2,Di=4,Ui=8,Bi=16,Ii=32,Gi=64,fo=1073741824,mo=8192,Wi=16384,ki=32768,Hi=65536,Ki=131072,po=262144,xo=524288,ho=1048576,yo=2097152,bo=4194304,To=8388608,Xi=16777216,Ji=33554432,Yi=67108864,ji=134217728,Zi=268435456,It=536870912,qi=1073741824,$i=-2147483648,Qi=64,ea=0,ta=1,na=2,oa=4,ra=8,sa=16,ia=32,aa=64,ca=128,la=33554432,ua=268435456,da=536870912,fa=1073741824,ma=-2147483648,pa=4294967295,et=3,xa=1107361795,ha=65539,ya=1107427331,Pe=56,ba=25,Ta=1174405123,So=16515072,Sa=1107296281,ga=65539,_a=3,Aa=196611,Ea=1174421507;function go(t,e){return(t&e)===e}function _o(t,e){return(t&e)!==0}function Ao(t,e){return t|e}function Eo(t,e){return t&~e}function vo(t,e){return(t&e)===e}function Vo(...t){let e=0;for(let n of t)e|=n;return e}function we(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,r=.5*(o===0?e.x+n.x:e.y+n.y),s={...e},i={...n},a={...e},l={...n};o===0?(i.x=r,a.x=r):(i.y=r,a.y=r);let d=we(t+1,s,i),f=we(t+1,a,l);return{axis:o,dist:r,children:[d,f],items:new Set}}function Gt(t,e,n,o){let r=t;for(;r.axis!==-1&&r.children;){let s=r.axis,i=r.dist,a=s===0?n.x:n.y,l=s===0?o.x:o.y;if(a>i)r=r.children[1];else if(l<i)r=r.children[0];else break}return r.items.add(e),r}function he(t,e,n,o){for(let l of t.items)o.add(l);if(t.axis===-1||!t.children)return;let r=t.axis,s=t.dist,i=r===0?e.x:e.y;(r===0?n.x:n.y)>s&&he(t.children[1],e,n,o),i<s&&he(t.children[0],e,n,o)}var Wt=(o=>(o[o.FRONT=1]="FRONT",o[o.BACK=2]="BACK",o[o.CROSS=3]="CROSS",o))(Wt||{}),J=null;function No(){J={nodesTraversed:0,leafsReached:0,brushesTested:0}}function Co(){J=null}var Z=.03125,Oo=Number.MAX_SAFE_INTEGER-1,Le=1;function Ro(t){let e=t.planes.map(i=>({...i,signbits:rt(i.normal)})),n=t.nodes.map(i=>({plane:e[i.planenum],children:i.children})),o=t.brushes.map(i=>{let a=t.brushSides.slice(i.firstSide,i.firstSide+i.numSides).map(l=>({plane:e[l.planenum],surfaceFlags:l.surfaceFlags}));return{contents:i.contents,sides:a,checkcount:0}}),r=t.leaves.map(i=>({contents:i.contents,cluster:i.cluster,area:i.area,firstLeafBrush:i.firstLeafBrush,numLeafBrushes:i.numLeafBrushes})),s=t.bmodels.map(i=>({mins:i.mins,maxs:i.maxs,origin:i.origin,headnode:i.headnode}));return{planes:e,nodes:n,leaves:r,brushes:o,leafBrushes:t.leafBrushes,bmodels:s,visibility:t.visibility}}function rt(t){let e=0;return t.x<0&&(e|=1),t.y<0&&(e|=2),t.z<0&&(e|=4),e}function re(t,e){return t.normal.x*e.x+t.normal.y*e.y+t.normal.z*e.z-t.dist}function Mo(t,e,n=0){let o=re(t,e);return o>n?1:o<-n?2:3}function Po(t,e,n,o=0){let r,s;switch(n.signbits){case 0:r=n.normal.x*e.x+n.normal.y*e.y+n.normal.z*e.z,s=n.normal.x*t.x+n.normal.y*t.y+n.normal.z*t.z;break;case 1:r=n.normal.x*t.x+n.normal.y*e.y+n.normal.z*e.z,s=n.normal.x*e.x+n.normal.y*t.y+n.normal.z*t.z;break;case 2:r=n.normal.x*e.x+n.normal.y*t.y+n.normal.z*e.z,s=n.normal.x*t.x+n.normal.y*e.y+n.normal.z*t.z;break;case 3:r=n.normal.x*t.x+n.normal.y*t.y+n.normal.z*e.z,s=n.normal.x*e.x+n.normal.y*e.y+n.normal.z*t.z;break;case 4:r=n.normal.x*e.x+n.normal.y*e.y+n.normal.z*t.z,s=n.normal.x*t.x+n.normal.y*t.y+n.normal.z*e.z;break;case 5:r=n.normal.x*t.x+n.normal.y*e.y+n.normal.z*t.z,s=n.normal.x*e.x+n.normal.y*t.y+n.normal.z*e.z;break;case 6:r=n.normal.x*e.x+n.normal.y*t.y+n.normal.z*t.z,s=n.normal.x*t.x+n.normal.y*e.y+n.normal.z*e.z;break;default:r=n.normal.x*t.x+n.normal.y*t.y+n.normal.z*t.z,s=n.normal.x*e.x+n.normal.y*e.y+n.normal.z*e.z;break}let i=0;return r-n.dist>=-o&&(i=1),s-n.dist<=o&&(i|=2),i}function kt(t,e,n=Z){for(let o of e.sides)if(re(o.plane,t)>n)return!1;return!0}function Ht(t,e,n,o){for(let r of o.sides){let s=r.plane.normal.x*(r.plane.normal.x<0?n.x:e.x)+r.plane.normal.y*(r.plane.normal.y<0?n.y:e.y)+r.plane.normal.z*(r.plane.normal.z<0?n.z:e.z),i=r.plane.dist-s;if(t.x*r.plane.normal.x+t.y*r.plane.normal.y+t.z*r.plane.normal.z-i>0)return{startsolid:!1,allsolid:!1,contents:0}}return{startsolid:!0,allsolid:!0,contents:o.contents}}function st({start:t,end:e,mins:n,maxs:o,brush:r,trace:s}){if(r.sides.length===0)return;let i=n.x===0&&n.y===0&&n.z===0&&o.x===0&&o.y===0&&o.z===0,a=-1,l=1,d=null,f=null,c=!1,m=!1;for(let h of r.sides){let{plane:u}=h,_=u.dist;if(!i){let V=u.normal.x<0?o.x:n.x,b=u.normal.y<0?o.y:n.y,S=u.normal.z<0?o.z:n.z;_-=u.normal.x*V+u.normal.y*b+u.normal.z*S}let g=t.x*u.normal.x+t.y*u.normal.y+t.z*u.normal.z-_,A=e.x*u.normal.x+e.y*u.normal.y+e.z*u.normal.z-_;if(A>0&&(c=!0),g>0&&(m=!0),g>0&&A>=g)return;if(!(g<=0&&A<=0))if(g>A){let V=(g-Z)/(g-A);V>a&&(a=V,d=u,f=h)}else{let V=(g+Z)/(g-A);V<l&&(l=V)}}if(!m){s.startsolid=!0,c||(s.allsolid=!0),s.fraction=0;return}a<l&&a>-1&&a<s.fraction&&(s.fraction=a<0?0:a,s.plane=d,s.contents=r.contents,s.surfaceFlags=f?.surfaceFlags??0)}function Fe(){return{fraction:1,plane:null,contents:0,surfaceFlags:0,startsolid:!1,allsolid:!1}}function it(t,e,n){let o=n;for(;o>=0;){let r=e.nodes[o];o=re(r.plane,t)>=0?r.children[0]:r.children[1]}return-1-o}function Kt(t,e,n){let o=t.leaves[e],r=o.contents,s=at(),i=o.firstLeafBrush,a=i+o.numLeafBrushes;for(let l=i;l<a;l+=1){let d=t.leafBrushes[l],f=t.brushes[d];f.checkcount!==s&&(f.checkcount=s,f.sides.length!==0&&kt(n,f)&&(r|=f.contents))}return r}function at(){let t=Le;return Le+=1,Le>=Oo&&(Le=1),t}function wo(t,e){return t.x===0&&t.y===0&&t.z===0&&e.x===0&&e.y===0&&e.z===0}function Lo(t,e,n){return wo(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 Xt(t,e,n){return Math.abs(Lo(t,e,n))}function tt(t,e,n){return O(t,R(ee(e,t),n))}function nt(t,e,n){let o=t.allsolid?0:t.fraction,r=tt(e,n,o);return{fraction:o,endpos:r,plane:t.plane,planeNormal:t.startsolid?void 0:t.plane?.normal,contents:t.contents,surfaceFlags:t.surfaceFlags,startsolid:t.startsolid,allsolid:t.allsolid}}function ze(t,e,n){let o=it(t,e,n);return e.leaves[o]?.cluster??-1}function Jt(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 r=t.clusters[e],i=(o?r.phs:r.pvs)[n>>3];return i===void 0?!1:(i&1<<(n&7))!==0}function ye(t){let{model:e,nodeIndex:n,startFraction:o,endFraction:r,start:s,end:i,traceStart:a,traceEnd:l,mins:d,maxs:f,contentMask:c,trace:m,brushCheckCount:h}=t;if(m.fraction<=o)return;if(n<0){J&&J.leafsReached++;let L=-1-n,N=e.leaves[L],B=N.firstLeafBrush,k=B+N.numLeafBrushes;for(let F=B;F<k;F+=1){let K=e.leafBrushes[F],T=e.brushes[K];if((T.contents&c)!==0&&T.sides.length&&T.checkcount!==h&&(T.checkcount=h,J&&J.brushesTested++,st({start:a,end:l,mins:d,maxs:f,brush:T,trace:m}),m.allsolid))return}return}J&&J.nodesTraversed++;let u=e.nodes[n],_=u.plane,g=Xt(_,d,f),A=re(_,s),V=re(_,i);if(A>=g&&V>=g){ye({model:e,nodeIndex:u.children[0],startFraction:o,endFraction:r,start:s,end:i,traceStart:a,traceEnd:l,mins:d,maxs:f,contentMask:c,trace:m,brushCheckCount:h});return}if(A<-g&&V<-g){ye({model:e,nodeIndex:u.children[1],startFraction:o,endFraction:r,start:s,end:i,traceStart:a,traceEnd:l,mins:d,maxs:f,contentMask:c,trace:m,brushCheckCount:h});return}let b=0,S=1/(A-V),C,E;A<V?(b=1,E=(A+g+Z)*S,C=(A-g+Z)*S):(b=0,E=(A-g-Z)*S,C=(A+g+Z)*S),C<0?C=0:C>1&&(C=1),E<0?E=0:E>1&&(E=1);let M=o+(r-o)*C,v=tt(s,i,C);if(ye({model:e,nodeIndex:u.children[b],startFraction:o,endFraction:M,start:s,end:v,traceStart:a,traceEnd:l,mins:d,maxs:f,contentMask:c,trace:m,brushCheckCount:h}),m.fraction<=M)return;let H=o+(r-o)*E,x=tt(s,i,E);ye({model:e,nodeIndex:u.children[1-b],startFraction:H,endFraction:r,start:x,end:i,traceStart:a,traceEnd:l,mins:d,maxs:f,contentMask:c,trace:m,brushCheckCount:h})}function Yt(t){let{model:e,start:n,end:o}=t,r=t.mins??P,s=t.maxs??P,i=t.contentMask??4294967295,a=t.headnode??0,l=Fe(),d=at();return ye({model:e,nodeIndex:a,startFraction:0,endFraction:1,start:n,end:o,traceStart:n,traceEnd:o,mins:r,maxs:s,contentMask:i,trace:l,brushCheckCount:d}),nt(l,n,o)}function Fo(t,e,n=0){let o=it(t,e,n);return Kt(e,o,t)}function zo(t,e,n=0){let o=new Map;return t.map(r=>{let s=it(r,e,n),i=e.leaves[s];if(i.numLeafBrushes===0){let a=o.get(s);return a!==void 0?a:(o.set(s,i.contents),i.contents)}return Kt(e,s,r)})}function Do(t,e,n,o,r=0){let s=at(),i=0;function a(l){if(l<0){J&&J.leafsReached++;let h=-1-l,u=o.leaves[h];i|=u.contents;let _=u.firstLeafBrush,g=_+u.numLeafBrushes;for(let A=_;A<g;A+=1){let V=o.leafBrushes[A],b=o.brushes[V];if(b.checkcount===s||(b.checkcount=s,b.sides.length===0))continue;let S=Ht(t,e,n,b);S.startsolid&&(i|=S.contents)}return}let d=o.nodes[l],f=d.plane,c=Xt(f,e,n),m=re(f,t);if(c===0){a(m>=0?d.children[0]:d.children[1]);return}if(m>c){a(d.children[0]);return}if(m<-c){a(d.children[1]);return}a(d.children[0]),a(d.children[1])}return a(r),i}function Uo(t,e,n,o=0){let{visibility:r}=n;if(!r)return!0;let s=ze(t,n,o),i=ze(e,n,o);return Jt(r,s,i,!1)}function Bo(t,e,n,o=0){let{visibility:r}=n;if(!r)return!0;let s=ze(t,n,o),i=ze(e,n,o);return Jt(r,s,i,!0)}function le(t,e,n){return{normal:t,dist:e,type:n,signbits:rt(t)}}function Io(t){let e=t.surfaceFlags??0,n=t.origin.x+t.maxs.x,o=t.origin.x+t.mins.x,r=t.origin.y+t.maxs.y,s=t.origin.y+t.mins.y,i=t.origin.z+t.maxs.z,a=t.origin.z+t.mins.z,d=[le({x:1,y:0,z:0},n,0),le({x:-1,y:0,z:0},-o,0),le({x:0,y:1,z:0},r,1),le({x:0,y:-1,z:0},-s,1),le({x:0,y:0,z:1},i,2),le({x:0,y:0,z:-1},-a,2)].map(f=>({plane:f,surfaceFlags:e}));return{contents:t.contents,sides:d,checkcount:0}}function Go(t){let e=Io(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 Wo(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 ko(t,e){return e.allsolid&&!t.allsolid||e.startsolid&&!t.startsolid?!0:e.fraction<t.fraction}var ot=class{constructor(){this.entities=new Map;this.entityNodes=new Map;this.rootNode=we()}link(e){let n=Go(e);this.entities.set(e.id,n);let o=this.entityNodes.get(e.id);o&&o.items.delete(e.id);let r=Gt(this.rootNode,e.id,n.bounds.mins,n.bounds.maxs);this.entityNodes.set(e.id,r)}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??P,r=e.maxs??P,s=e.contentMask??4294967295,i,a=null;e.model?i=Yt(e):i=nt(Fe(),e.start,e.end);let l={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},d={x:Math.max(e.start.x,e.end.x)+r.x,y:Math.max(e.start.y,e.end.y)+r.y,z:Math.max(e.start.z,e.end.z)+r.z},f=new Set;he(this.rootNode,l,d,f);for(let c of f){if(c===n)continue;let m=this.entities.get(c);if(!m||(m.contents&s)===0)continue;let h=Fe();if(st({start:e.start,end:e.end,mins:o,maxs:r,brush:m.brush,trace:h}),h.contents===0&&(h.contents=m.contents),h.startsolid||h.allsolid||h.fraction<i.fraction){let u=nt(h,e.start,e.end);ko(i,u)&&(i=u,a=m.id)}}return{...i,entityId:a}}gatherTriggerTouches(e,n,o,r=1073741824){let s=[],i={mins:O(e,n),maxs:O(e,o)},a=new Set;he(this.rootNode,i.mins,i.maxs,a);for(let l of a){let d=this.entities.get(l);d&&(d.contents&r)!==0&&Wo(i,d.bounds)&&s.push(d.id)}return s}};var jt=(i=>(i[i.None=0]="None",i[i.Archive=1]="Archive",i[i.UserInfo=2]="UserInfo",i[i.ServerInfo=4]="ServerInfo",i[i.Latch=8]="Latch",i[i.Cheat=16]="Cheat",i))(jt||{});var Pa=1024,wa=80,La=512,Fa=64,za=128,Ho=256,Da=8192,Ko=256,Xo=8192,Jo=2048,Yo=512,jo=256,Zo=512,qo=256,ct=32,Ua=96,Ba=64,ue=(x=>(x[x.Name=0]="Name",x[x.CdTrack=1]="CdTrack",x[x.Sky=2]="Sky",x[x.SkyAxis=3]="SkyAxis",x[x.SkyRotate=4]="SkyRotate",x[x.StatusBar=5]="StatusBar",x[x.HealthBarName=55]="HealthBarName",x[x.CONFIG_N64_PHYSICS=56]="CONFIG_N64_PHYSICS",x[x.CONFIG_CTF_TEAMS=57]="CONFIG_CTF_TEAMS",x[x.CONFIG_COOP_RESPAWN_STRING=58]="CONFIG_COOP_RESPAWN_STRING",x[x.AirAccel=59]="AirAccel",x[x.MaxClients=60]="MaxClients",x[x.MapChecksum=61]="MapChecksum",x[x.Models=62]="Models",x[x.Sounds=62+Xo]="Sounds",x[x.Images=x.Sounds+Jo]="Images",x[x.Lights=x.Images+Yo]="Lights",x[x.ShadowLights=x.Lights+Ko]="ShadowLights",x[x.Items=x.ShadowLights+qo]="Items",x[x.PlayerSkins=x.Items+jo]="PlayerSkins",x[x.General=x.PlayerSkins+Ho]="General",x[x.WheelWeapons=x.General+Zo]="WheelWeapons",x[x.WheelAmmo=x.WheelWeapons+ct]="WheelAmmo",x[x.WheelPowerups=x.WheelAmmo+ct]="WheelPowerups",x[x.CdLoopCount=x.WheelPowerups+ct]="CdLoopCount",x[x.GameStyle=x.CdLoopCount+1]="GameStyle",x[x.MaxConfigStrings=x.GameStyle+1]="MaxConfigStrings",x))(ue||{}),$o=ue.MaxConfigStrings;function Qo(t){return t>=5&&t<59?96*(59-t):t>=ue.General&&t<ue.WheelWeapons?96*(ue.MaxConfigStrings-t):96}var lt={};qe(lt,{addReplayFrame:()=>or,createReplaySession:()=>nr,deserializeReplay:()=>tr,serializeReplay:()=>er});function er(t){return JSON.stringify(t,null,2)}function tr(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 nr(t,e){return{metadata:{map:t,date:new Date().toISOString(),version:"1.0",seed:e},frames:[]}}function or(t,e,n,o){t.frames.push({serverFrame:n,cmd:e,timestamp:Date.now()-o})}function rr(t){return t??{}}function Zt(t,e,n={}){let o=rr(t),r=[],s=[];for(let a of e){if(!(a in o)){r.push(a);continue}typeof o[a]!="function"&&s.push(a)}let i=n.allowExtra===!1?Object.keys(o).filter(a=>!e.includes(a)):[];return{missing:r,nonFunctions:s,extras:i}}function sr(t,e,n={}){let{missing:o,nonFunctions:r,extras:s}=Zt(t,e,n);if(o.length===0&&r.length===0&&s.length===0)return;let i=[];o.length>0&&i.push(`missing: ${o.join(", ")}`),r.length>0&&i.push(`non-functions: ${r.join(", ")}`),s.length>0&&i.push(`extras: ${s.join(", ")}`);let a=n.name??"contract";throw new Error(`${a} validation failed (${i.join("; ")})`)}var ir=["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"],ar=["PreInit","Init","Shutdown","SpawnEntities","WriteGameJson","ReadGameJson","WriteLevelJson","ReadLevelJson","CanSave","ClientConnect","ClientThink","RunFrame","Pmove"],cr=["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"],lr=["Init","Shutdown","DrawHUD","TouchPics","LayoutFlags","GetActiveWeaponWheelWeapon","GetOwnedWeaponWheelWeapons","GetWeaponWheelAmmoCount","GetPowerupWheelCount","GetHitMarkerDamage","Pmove","ParseConfigString","ParseCenterPrint","ClearNotify","ClearCenterprint","NotifyMessage","GetMonsterFlashOffset"];var de=(r=>(r[r.None=0]="None",r[r.Feet=1]="Feet",r[r.Waist=2]="Waist",r[r.Under=3]="Under",r))(de||{});function ut(t){return t>=2}function ur(t){return t===3}var q=(c=>(c[c.Ducked=1]="Ducked",c[c.JumpHeld=2]="JumpHeld",c[c.OnGround=4]="OnGround",c[c.TimeWaterJump=8]="TimeWaterJump",c[c.TimeLand=16]="TimeLand",c[c.TimeTeleport=32]="TimeTeleport",c[c.NoPositionalPrediction=64]="NoPositionalPrediction",c[c.OnLadder=128]="OnLadder",c[c.NoAngularPrediction=256]="NoAngularPrediction",c[c.IgnorePlayerCollision=512]="IgnorePlayerCollision",c[c.TimeTrick=1024]="TimeTrick",c))(q||{});function z(t,e){return(t&e)!==0}function G(t,e){return t|e}function X(t,e){return t&~e}var se=(a=>(a[a.Normal=0]="Normal",a[a.Grapple=1]="Grapple",a[a.NoClip=2]="NoClip",a[a.Spectator=3]="Spectator",a[a.Dead=4]="Dead",a[a.Gib=5]="Gib",a[a.Freeze=6]="Freeze",a))(se||{}),ie=(a=>(a[a.None=0]="None",a[a.Attack=1]="Attack",a[a.Use=2]="Use",a[a.Holster=4]="Holster",a[a.Jump=8]="Jump",a[a.Crouch=16]="Crouch",a[a.Any=128]="Any",a))(ie||{});var dr=270;function fr(t,e){return(t&e)!==0}function dt(t){let{pmFlags:e,pmType:n,buttons:o,waterlevel:r,onGround:s,velocity:i,origin:a,jumpHeight:l=dr}=t;if(e&16)return{pmFlags:e,onGround:s,velocity:i,origin:a,jumpSound:!1,jumped:!1};let d=fr(o,8),f=e,c=s,m=!1,h=!1,u=i,_=a;if(!d)return f=X(f,2),{pmFlags:f,onGround:c,velocity:u,origin:_,jumpSound:m,jumped:h};if(mr(f))return{pmFlags:f,onGround:c,velocity:u,origin:_,jumpSound:m,jumped:h};if(n===4)return{pmFlags:f,onGround:c,velocity:u,origin:_,jumpSound:m,jumped:h};if(r>=2)return c=!1,{pmFlags:f,onGround:c,velocity:u,origin:_,jumpSound:m,jumped:h};if(!c)return{pmFlags:f,onGround:c,velocity:u,origin:_,jumpSound:m,jumped:h};f=G(f,2),f=X(f,4),c=!1,m=!0,h=!0;let g=i.z+l,A=g<l?l:g;return u={...i,z:A},_={...a,z:a.z+1},{pmFlags:f,onGround:c,velocity:u,origin:_,jumpSound:m,jumped:h}}function mr(t){return(t&2)!==0}var pr=100,ft=200,qt=150,De=25,xr=15,hr=1,yr={x:0,y:0,z:1},br=(t,e)=>({fraction:1,endpos:e,allsolid:!1,startsolid:!1});function mt(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?P:{x:e,y:n,z:o}}function en(t){let{watertype:e,waterlevel:n,onGround:o,waterSpeed:r}=t;if((e&16515072)===0)return P;let s=mt(e);if(s===P)return P;let i=r;return n===1&&o&&(i*=.5),R(s,i)}function tn(t){let{groundContents:e,scale:n=pr}=t,o=mt(e);return o===P?P:R(o,n)}function be(t){let{wishVelocity:e,onLadder:n,onGround:o,waterlevel:r,watertype:s,groundContents:i,cmd:a,viewPitch:l,maxSpeed:d,ladderMod:f,waterSpeed:c,forward:m,origin:h,mins:u,maxs:_,trace:g=br}=t,A=e;n&&(A=Tr({wishVelocity:A,cmd:a,waterlevel:r,viewPitch:l,maxSpeed:d,ladderMod:f,onGround:o,forward:m,origin:h,mins:u,maxs:_,trace:g}));let V=en({watertype:s,waterlevel:r,onGround:o,waterSpeed:c});if(V!==P&&(A=O(A,V)),o){let b=tn({groundContents:i});b!==P&&(A=O(A,b))}return A}function Tr(t){let{wishVelocity:e,cmd:n,waterlevel:o,viewPitch:r,maxSpeed:s,ladderMod:i,onGround:a,forward:l,origin:d,mins:f,maxs:c,trace:m}=t,h=n.buttons??0,u={...e};if((h&24)!==0){let _=ut(o)?s:ft;u={...u,z:h&8?_:-_}}else if(n.forwardmove){let _=$t(n.forwardmove,-ft,ft);if(n.forwardmove>0){let g=r<xr?_:-_;u={...u,z:g}}else a||(u={...u,x:0,y:0}),u={...u,z:_}}else u={...u,z:0};if(!a)if(n.sidemove){let _=$t(n.sidemove,-qt,qt);o<2&&(_*=i);let g=w({x:l.x,y:l.y,z:0});if(g.x!==0||g.y!==0){let A=O(d,R(g,hr)),V=m(d,A,f,c);if(V.fraction!==1&&!V.allsolid&&V.contents!==void 0&&(V.contents&536870912)!==0&&V.planeNormal){let b=te(V.planeNormal,yr);u={...u,x:0,y:0},u=O(u,R(b,-_))}}}else u={...u,x:Qt(u.x),y:Qt(u.y)};return u}function $t(t,e,n){return Math.max(e,Math.min(n,t))}function Qt(t){return t<-De?-De:t>De?De:t}var nn=5,Sr=4,gr=18,_r=.7,on=1,rn=2;function sn(t,e,n,o=nn,r=t){if(e.length===0)return{velocity:t,planes:[],stopped:!1};let s=[],i=t;for(let l of e){if(s.length>=o)return{velocity:P,planes:s,stopped:!0};if(s.find(m=>U(m,l)>.99))continue;s.push(l);let f,c=0;for(;c<s.length;c++){let m=ne(i,s[c],n),h=0;for(;h<s.length&&!(h!==c&&U(m,s[h])<0);h++);if(h===s.length){f=m;break}}if(f)i=f;else{if(s.length!==2)return{velocity:P,planes:s,stopped:!0};let m=te(s[0],s[1]),h=U(m,i);i=R(m,h)}if(U(i,r)<=0)return{velocity:P,planes:s,stopped:!0}}let a=i.x===0&&i.y===0&&i.z===0;return{velocity:i,planes:s,stopped:a}}function pt(t){let{origin:e,velocity:n,frametime:o,overbounce:r,trace:s,maxBumps:i=Sr,maxClipPlanes:a=nn,mins:l,maxs:d,hasTime:f=!1}=t,c=e,m=n,h=[],u=n,_=o,g=0;for(let V=0;V<i&&!(m.x===0&&m.y===0&&m.z===0);V++){let b=O(c,R(m,_)),S=s(c,b,l,d);if(S.allsolid){let E=f?u:P;return{origin:S.endpos,velocity:E,planes:h,stopped:!0,blocked:g}}if(S.startsolid){let E=f?u:P;return{origin:S.endpos,velocity:E,planes:h,stopped:!0,blocked:g}}if(S.fraction>0&&(c=S.endpos),S.fraction===1)break;if(!S.planeNormal)return{origin:c,velocity:f?u:P,planes:h,stopped:!0,blocked:g};S.planeNormal.z>.7&&(g|=on),S.planeNormal.z===0&&(g|=rn),h.push(S.planeNormal),_-=_*S.fraction;let C=sn(m,h,r,a,u);if(m=C.velocity,h.splice(0,h.length,...C.planes),u.z>0&&m.z<0&&(m={...m,z:0}),C.stopped)return{origin:c,velocity:f?u:m,planes:h,stopped:!0,blocked:g}}let A=f?u:m;return{origin:c,velocity:A,planes:h,stopped:A.x===0&&A.y===0&&A.z===0,blocked:g}}function ae(t){let{mins:e,maxs:n,stepSize:o=gr,...r}=t,s=t.origin,i=t.velocity,a=pt({...r,mins:e,maxs:n}),l=O(s,{x:0,y:0,z:o}),d=r.trace(s,l,e,n);if(d.allsolid)return{...a,stepped:!1,stepHeight:0};let f=d.endpos.z-s.z,c=pt({...r,origin:d.endpos,velocity:i,mins:e,maxs:n}),m=O(c.origin,{x:0,y:0,z:-f}),h=r.trace(c.origin,m,e,n),u=c.origin,_=h.planeNormal;h.allsolid||(u=h.endpos);let g=(E,M)=>(E.x-M.x)**2+(E.y-M.y)**2,A=g(a.origin,s),V=g(u,s);if(A>V||_&&_.z<_r)return{...a,stepped:!1,stepHeight:0};let b={...c.velocity,z:a.velocity.z},S=c.blocked,C=b.x===0&&b.y===0&&b.z===0;return{origin:u,velocity:b,planes:c.planes,blocked:S,stopped:C,stepped:!0,stepHeight:f,stepNormal:_}}var an=1,Ar=60,Ue=1.01;function xt(t){let{origin:e,frametime:n,mins:o,maxs:r,trace:s,overbounce:i=Ue,stepSize:a,maxBumps:l,maxClipPlanes:d,hasTime:f,forward:c,right:m,cmd:h,pmFlags:u,onGround:_,gravity:g,pmType:A,pmAccelerate:V,pmAirAccelerate:b=an,pmMaxSpeed:S,pmDuckSpeed:C,onLadder:E,waterlevel:M,watertype:v,groundContents:W,viewPitch:H,ladderMod:x,pmWaterSpeed:L}=t,N={...t.velocity},B=ln(c,m,h);B=be({wishVelocity:B,onLadder:E,onGround:_,waterlevel:M,watertype:v,groundContents:W,cmd:h,viewPitch:H,maxSpeed:z(u,1)?C:S,ladderMod:x,waterSpeed:L,forward:c,origin:e,mins:o,maxs:r,trace:s});let F=z(u,1)?C:S,K=B,T=I(K);if(T!==0&&(K=w(K)),T>F){let $=F/T;B=R(B,$),T=F,T!==0&&(K=w(B))}return E?(N=Y({velocity:N,wishdir:K,wishspeed:T,accel:V,frametime:n}),Math.abs(B.z)<Number.EPSILON&&(N=Vr(N,g,n)),Te({origin:e,velocity:N,frametime:n,mins:o,maxs:r,trace:s,overbounce:i,stepSize:a,maxBumps:l,maxClipPlanes:d,hasTime:f})):_?(N={...N,z:0},N=Y({velocity:N,wishdir:K,wishspeed:T,accel:V,frametime:n}),g>0?N={...N,z:0}:N={...N,z:N.z-g*n},N.x===0&&N.y===0?{origin:e,velocity:N,planes:[],blocked:0,stopped:!0,stepped:!1,stepHeight:0}:Te({origin:e,velocity:N,frametime:n,mins:o,maxs:r,trace:s,overbounce:i,stepSize:a,maxBumps:l,maxClipPlanes:d,hasTime:f})):(b>0?N=bt({velocity:N,wishdir:K,wishspeed:T,accel:b,frametime:n}):N=Y({velocity:N,wishdir:K,wishspeed:T,accel:an,frametime:n}),A!==1&&(N={...N,z:N.z-g*n}),Te({origin:e,velocity:N,frametime:n,mins:o,maxs:r,trace:s,overbounce:i,stepSize:a,maxBumps:l,maxClipPlanes:d,hasTime:f}))}function ht(t){let{origin:e,frametime:n,mins:o,maxs:r,trace:s,overbounce:i=Ue,stepSize:a,maxBumps:l,maxClipPlanes:d,hasTime:f,forward:c,right:m,cmd:h,pmFlags:u,onGround:_,pmMaxSpeed:g,pmDuckSpeed:A,pmWaterAccelerate:V,pmWaterSpeed:b,onLadder:S,watertype:C,groundContents:E,waterlevel:M,viewPitch:v,ladderMod:W}=t,H={...t.velocity},x=Er(c,m,h);vr(h,_)?x={...x,z:x.z-Ar}:cn(h,16)?x=O(x,{x:0,y:0,z:-b*.5}):cn(h,8)&&(x=O(x,{x:0,y:0,z:b*.5})),x=be({wishVelocity:x,onLadder:S,onGround:_,waterlevel:M,watertype:C,groundContents:E,cmd:h,viewPitch:v,maxSpeed:z(u,1)?A:g,ladderMod:W,waterSpeed:b,forward:c,origin:e,mins:o,maxs:r,trace:s});let L=x,N=I(L);if(N!==0&&(L=w(L)),N>g){let k=g/N;x=R(x,k),N=g,N!==0&&(L=w(x))}if(N*=.5,z(u,1)&&N>A){let k=A/N;x=R(x,k),N=A,N!==0&&(L=w(x))}return H=Y({velocity:H,wishdir:L,wishspeed:N,accel:V,frametime:n}),Te({origin:e,velocity:H,frametime:n,mins:o,maxs:r,trace:s,overbounce:i,stepSize:a,maxBumps:l,maxClipPlanes:d,hasTime:f})}function yt(t){let{origin:e,frametime:n,mins:o,maxs:r,trace:s,overbounce:i=Ue,stepSize:a,maxBumps:l,maxClipPlanes:d,hasTime:f,forward:c,right:m,cmd:h,pmFlags:u,onGround:_,gravity:g,pmAccelerate:A,pmMaxSpeed:V,pmDuckSpeed:b,onLadder:S,waterlevel:C,watertype:E,groundContents:M,viewPitch:v,ladderMod:W,pmWaterSpeed:H}=t,x={...t.velocity},L=ln(c,m,h);L=be({wishVelocity:L,onLadder:S,onGround:_,waterlevel:C,watertype:E,groundContents:M,cmd:h,viewPitch:v,maxSpeed:z(u,1)?b:V,ladderMod:W,waterSpeed:H,forward:c,origin:e,mins:o,maxs:r,trace:s});let B=z(u,1)?b:V,k=L,F=I(k);if(F!==0&&(k=w(k)),F>B){let K=B/F;L=R(L,K),F=B,F!==0&&(k=w(L))}return x={...x,z:0},x=Y({velocity:x,wishdir:k,wishspeed:F,accel:A,frametime:n}),g>0?x={...x,z:0}:x={...x,z:x.z-g*n},x.x===0&&x.y===0?{origin:e,velocity:x,planes:[],blocked:0,stopped:!0,stepped:!1,stepHeight:0}:Te({origin:e,velocity:x,frametime:n,mins:o,maxs:r,trace:s,overbounce:i,stepSize:a,maxBumps:l,maxClipPlanes:d,hasTime:f})}function ln(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 Er(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 cn(t,e){return!!((t.buttons??0)&e)}function vr(t,e){let n=t.forwardmove===0&&t.sidemove===0,o=!((t.buttons??0)&24);return n&&o&&!e}function Vr(t,e,n){let o=t.z,r=e*n;return o>0?(o-=r,o<0&&(o=0)):(o+=r,o>0&&(o=0)),{...t,z:o}}function Te(t){let{origin:e,velocity:n,frametime:o,mins:r,maxs:s,trace:i,overbounce:a=Ue,stepSize:l,maxBumps:d,maxClipPlanes:f,hasTime:c}=t;return ae({origin:e,velocity:n,frametime:o,trace:i,mins:r,maxs:s,overbounce:a,stepSize:l,maxBumps:d,maxClipPlanes:f,hasTime:c})}function Se(t){let{origin:e,mins:n,viewheight:o,pointContents:r}=t,s=o-n.z,i=s/2,a={x:e.x,y:e.y,z:e.z+n.z+1},l=r(a);if((l&56)===0)return{waterlevel:0,watertype:0};let d=l,f=1,c={x:a.x,y:a.y,z:e.z+n.z+i};if(l=r(c),(l&56)!==0){f=2;let m={x:a.x,y:a.y,z:e.z+n.z+s};l=r(m),(l&56)!==0&&(f=3)}return{waterlevel:f,watertype:d}}var Nr=.25,Cr=180,Or=100,Rr=.7,Mr=.9,Pr=64,wr=128,Lr=1.01,Fr=1080;function Be(t){let{pmType:e,n64Physics:n,velocity:o,startVelocity:r,origin:s,mins:i,maxs:a,viewheight:l,trace:d,pointContents:f}=t,c=t.pmFlags,m=t.pmTime,h,u=z(c,4),_,g=0;if(o.z>Cr||e===1)c=X(c,4),u=!1;else{let S={x:s.x,y:s.y,z:s.z-Nr},C=d(s,S,i,a);_=C,g=C.contents??0;let E=C.planeNormal,M=C.fraction<1&&!!E&&E.z<Rr;if(M&&E){let v=O(s,E),W=d(s,v,i,a);W.fraction<1&&!W.startsolid&&(M=!1)}if(C.fraction===1||!E||M&&!C.startsolid)c=X(c,4),u=!1;else{u=!0,z(c,8)&&(c&=~Fr,m=0);let v=z(c,4);if(!v){!n&&o.z>=Or&&E.z>=Mr&&!z(c,1)&&(c=G(c,1024),m=Pr);let W=ne(o,E,Lr);h=r.z-W.z}c=G(c,4),!v&&(n||z(c,1))&&(c=G(c,16),m=wr)}}let{waterlevel:V,watertype:b}=Se({origin:s,mins:i,viewheight:l,pointContents:f});return{pmFlags:c,pmTime:m,onGround:z(c,4),groundTrace:_,groundContents:g,waterlevel:V,watertype:b,impactDelta:h}}function Ie(t,e,n){return{x:t,y:e,z:n}}function Ge(t,e){let n=Ie(-16,-16,0),o=Ie(16,16,16);if(t===5)return{mins:n,maxs:o,viewheight:8};let r=t===4||(e&1)!==0,s=Ie(n.x,n.y,-24),i=Ie(o.x,o.y,r?4:32);return{mins:s,maxs:i,viewheight:r?-2:22}}var zr=4,Dr=32,Ur=8;function Tt(t){let{pmType:e}=t;if(e===5){let i=Ge(e,t.pmFlags);return{pmFlags:t.pmFlags,ducked:z(t.pmFlags,1),changed:!1,...i}}let n=t.pmFlags,o=!1;e===4?z(n,1)||(n=G(n,1),o=!0):Br(t)?!z(n,1)&&!Ir(t)&&(n=G(n,1),o=!0):z(n,1)&&!Gr(t)&&(n=X(n,1),o=!0);let r=Ge(e,n),s=e===4||z(n,1);return{pmFlags:n,ducked:s,changed:o,...r}}function Br(t){return(t.buttons&16)===0||t.onLadder||t.n64Physics?!1:!!(t.hasGroundEntity||t.waterlevel<=1&&!Wr(t))}function Ir(t){return t.trace({start:t.origin,end:t.origin,mins:t.mins,maxs:un(t.maxs,zr),mask:3}).allsolid}function Gr(t){return t.trace({start:t.origin,end:t.origin,mins:t.mins,maxs:un(t.maxs,Dr),mask:3}).allsolid}function Wr(t){let e={x:t.origin.x,y:t.origin.y,z:t.origin.z-Ur};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 un(t,e){return{x:t.x,y:t.y,z:e}}var ge=.025;function We(t){let{velocity:e,frametime:n,onGround:o,groundIsSlick:r,onLadder:s,waterlevel:i,pmFriction:a,pmStopSpeed:l,pmWaterFriction:d}=t,f=I(e);if(f<1)return{x:0,y:0,z:e.z};let c=0;if(o&&!r||s){let u=f<l?l:f;c+=u*a*n}i>0&&!s&&(c+=f*d*i*n);let m=f-c;if(m<0&&(m=0),m===f)return e;let h=m/f;return R(e,h)}function Y(t){let{velocity:e,wishdir:n,wishspeed:o,accel:r,frametime:s}=t,i=U(e,n),a=o-i;if(a<=0)return e;let l=r*s*o;return l>a&&(l=a),{x:e.x+n.x*l,y:e.y+n.y*l,z:e.z+n.z*l}}function bt(t){let{velocity:e,wishdir:n,wishspeed:o,accel:r,frametime:s}=t,i=Math.min(o,30),a=U(e,n),l=i-a;if(l<=0)return e;let d=r*o*s;return d>l&&(d=l),{x:e.x+n.x*d,y:e.y+n.y*d,z:e.z+n.z*d}}function kr(t,e){let n=Math.abs(t.forwardmove),o=Math.abs(t.sidemove),r=Math.abs(t.upmove),s=Math.max(n,o,r);if(s===0)return 0;let i=Math.sqrt(t.forwardmove*t.forwardmove+t.sidemove*t.sidemove+t.upmove*t.upmove);return e*s/(127*i)}function St(t){let{forward:e,right:n,cmd:o,maxSpeed:r}=t,s={x:e.x*o.forwardmove+n.x*o.sidemove,y:e.y*o.forwardmove+n.y*o.sidemove,z:0},i=I(s);if(i>r){let a=r/i;s=R(s,a),i=r}return{wishdir:i===0?s:w(s),wishspeed:i}}function gt(t){let{forward:e,right:n,cmd:o,maxSpeed:r}=t,s={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?s=O(s,{x:0,y:0,z:o.upmove}):o.upmove<-10?s=O(s,{x:0,y:0,z:o.upmove}):Math.abs(o.forwardmove)<10&&Math.abs(o.sidemove)<10?s=O(s,{x:0,y:0,z:-60}):s=O(s,{x:0,y:0,z:10});let i=I(s);if(i>r){let a=r/i;s=R(s,a),i=r}return i*=.5,{wishdir:i===0?s:w(s),wishspeed:i}}function Hr(t,e){if(t.pmType===4)return t;let n={...t},o=Be({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 r=Tt({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:c=>e.trace(c.start,c.end,c.mins,c.maxs)});n.pmFlags=r.pmFlags,n.mins=r.mins,n.maxs=r.maxs,n.viewHeight=r.viewheight;let s=dt({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=s.pmFlags,n.velocity=s.velocity,n.origin=s.origin,s.onGround!==((n.pmFlags&4)!==0)&&(s.onGround?n.pmFlags=G(n.pmFlags,4):n.pmFlags=X(n.pmFlags,4));let i=(n.pmFlags&4)!==0,a=n.velocity;n.velocity=We({velocity:n.velocity,frametime:ge,onGround:i,groundIsSlick:!1,onLadder:!1,waterlevel:n.waterlevel,pmFriction:6,pmStopSpeed:100,pmWaterFriction:1});let{forward:l,right:d}=oe(n.viewAngles);if(n.pmType===2){let c={x:l.x*n.cmd.forwardmove+d.x*n.cmd.sidemove,y:l.y*n.cmd.forwardmove+d.y*n.cmd.sidemove,z:n.cmd.upmove},m=ge;n.velocity=c,n.origin={x:n.origin.x+c.x*m,y:n.origin.y+c.y*m,z:n.origin.z+c.z*m}}else if(n.waterlevel>=2){let c=ht({origin:n.origin,velocity:n.velocity,frametime:ge,mins:n.mins,maxs:n.maxs,trace:e.trace,cmd:n.cmd,forward:l,right:d,pmFlags:n.pmFlags,onGround:i,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=c.origin,n.velocity=c.velocity}else if((n.pmFlags&4)===0){let c=xt({origin:n.origin,velocity:n.velocity,frametime:ge,mins:n.mins,maxs:n.maxs,trace:e.trace,cmd:n.cmd,forward:l,right:d,pmFlags:n.pmFlags,onGround:i,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=c.origin,n.velocity=c.velocity}else{let c=yt({origin:n.origin,velocity:n.velocity,frametime:ge,mins:n.mins,maxs:n.maxs,trace:e.trace,cmd:n.cmd,forward:l,right:d,pmFlags:n.pmFlags,onGround:i,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=c.origin,n.velocity=c.velocity}let f=Be({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=f.pmFlags,n.waterlevel=f.waterlevel,n.watertype=f.watertype,n}var fe=["x","y","z"],_t=[{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]}],dn={x:0,y:0,z:0};function me(t){return{x:t.x,y:t.y,z:t.z}}function Kr(t){return{x:t[0],y:t[1],z:t[2]}}function _e(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 fn(t,e,n){switch(e){case"x":t.x=n;break;case"y":t.y=n;break;case"z":t.z=n;break}}function ke(t,e){switch(e){case"x":return t.x;case"y":return t.y;case"z":default:return t.z}}function mn(t,e,n,o){return t===-1?ke(n,e):t===1?ke(o,e):0}function pn(t,e,n,o){let r=me(t);for(let s=0;s<fe.length;s++){let i=fe[s],a=e.normal[s];a<0?_e(r,i,ke(n,i)):a>0&&_e(r,i,ke(o,i))}return r}function Xr(t,e,n){let o=me(dn),r=me(dn);for(let s=0;s<fe.length;s++){let i=fe[s];fn(o,i,mn(t.mins[s],i,e,n)),fn(r,i,mn(t.maxs[s],i,e,n))}return{mins:o,maxs:r}}function Jr(t,e,n){if(!e||n===0)return t;let o=me(t);return _e(o,e,n),o}function Yr(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 At(t){let{origin:e,mins:n,maxs:o,trace:r}=t;if(!r(e,n,o,e).startsolid)return{result:"good-position",origin:{...e}};let i=[];for(let a=0;a<_t.length;a++){let l=_t[a],{mins:d,maxs:f}=Xr(l,n,o),c=pn(e,l,n,o),m=r(c,d,f,c),h,u=0;if(m.startsolid)for(let E=0;E<fe.length;E++){if(l.normal[E]!==0)continue;let M=fe[E],v=me(c);if(_e(v,M,1),m=r(v,d,f,v),!m.startsolid){c=v,h=M,u=1;break}if(v=me(c),_e(v,M,-1),m=r(v,d,f,v),!m.startsolid){c=v,h=M,u=-1;break}}if(m.startsolid)continue;let _=_t[a^1],g=pn(e,_,n,o);if(g=Jr(g,h,u),m=r(c,d,f,g),m.startsolid)continue;let A=Kr(l.normal),V=O(m.endpos??g,R(A,.125)),b=ee(V,g),S=O(e,b);S=Yr(S,h,u),!r(S,n,o,S).startsolid&&i.push({origin:S,distance:ce(b)})}return i.length===0?{result:"no-good-position",origin:{...e}}:(i.sort((a,l)=>a.distance-l.distance),{result:"fixed",origin:{...i[0].origin}})}var jr=1.5,xn=.5,Zr=1.01;function qr(t){let{origin:e,cmd:n,frametime:o,pmFriction:r,pmStopSpeed:s,pmMaxSpeed:i,pmAccelerate:a,pmWaterSpeed:l,doclip:d,forward:f,right:c,mins:m,maxs:h,trace:u,overbounce:_=Zr,stepSize:g,maxBumps:A,maxClipPlanes:V}=t,b=$r({velocity:t.velocity,pmFriction:r,pmStopSpeed:s,frametime:o}),S=Qr({cmd:n,forward:f,right:c,pmMaxSpeed:i,pmWaterSpeed:l});if(S.wishspeed>0&&(b=Y({velocity:b,wishdir:S.wishdir,wishspeed:S.accelSpeed,accel:a,frametime:o})),!d){let C=R(b,o);return{origin:O(e,C),velocity:b,planes:[],blocked:0,stopped:b.x===0&&b.y===0&&b.z===0,stepped:!1,stepHeight:0}}if(!u||!m||!h)throw new Error("applyPmoveFlyMove: doclip=true requires trace/mins/maxs");return ae({origin:e,velocity:b,frametime:o,overbounce:_,trace:u,mins:m,maxs:h,stepSize:g,maxBumps:A,maxClipPlanes:V})}function $r(t){let{velocity:e,pmFriction:n,pmStopSpeed:o,frametime:r}=t,s=I(e);if(s<1)return{x:0,y:0,z:0};let i=n*jr,l=(s<o?o:s)*i*r,d=s-l;return d<0&&(d=0),d===s?e:R(e,d/s)}function Qr(t){let{cmd:e,forward:n,right:o,pmMaxSpeed:r,pmWaterSpeed:s}=t,i=w(n),a=w(o),d={x:i.x*e.forwardmove+a.x*e.sidemove,y:i.y*e.forwardmove+a.y*e.sidemove,z:i.z*e.forwardmove+a.z*e.sidemove},f=e.buttons??0;f&8&&(d=O(d,{x:0,y:0,z:s*xn})),f&16&&(d=O(d,{x:0,y:0,z:-s*xn}));let c=I(d),m=c===0?{x:0,y:0,z:0}:w(d);if(c>r){let u=r/c;d=R(d,u),c=r,m=c===0?{x:0,y:0,z:0}:w(d)}let h=c*2;return{wishdir:m,wishspeed:c,accelSpeed:h}}var es=1,ts=40,He=50,hn=350,ns=2048,yn=.1,os=800,rs=50,bn=.7,ss=18,is=1.01,as=2;function cs(t){let{pmFlags:e,pmTime:n,waterlevel:o,watertype:r,gravity:s,cmd:i,forward:a,origin:l,velocity:d,mins:f,maxs:c,viewheight:m,trace:h,pointContents:u,onGround:_,overbounce:g=is,stepSize:A=ss,maxBumps:V,maxClipPlanes:b}=t;if(n>0)return{pmFlags:e,pmTime:n,velocity:d,performedWaterJump:!1};let S=X(e,128),C=n,E=d,M=w({x:a.x,y:a.y,z:0}),v=ce(M)>0;if(o<2&&v){let T=O(l,R(M,es)),$=h(l,T,f,c),Pn=$.contents??0;$.fraction<1&&(Pn&536870912)!==0&&(S=G(S,128))}if(s===0)return{pmFlags:S,pmTime:C,velocity:E,performedWaterJump:!1};if(((i.buttons??0)&8)===0&&i.forwardmove<=0)return{pmFlags:S,pmTime:C,velocity:E,performedWaterJump:!1};if(o!==2)return{pmFlags:S,pmTime:C,velocity:E,performedWaterJump:!1};if((r&8192)!==0)return{pmFlags:S,pmTime:C,velocity:E,performedWaterJump:!1};if(!v)return{pmFlags:S,pmTime:C,velocity:E,performedWaterJump:!1};let W=O(l,R(M,ts)),H=h(l,W,f,c);if(H.fraction===1||!H.planeNormal||H.planeNormal.z>=bn)return{pmFlags:S,pmTime:C,velocity:E,performedWaterJump:!1};let x={x:M.x*He,y:M.y*He,z:hn},L=l,N=!0,B=ls(s);for(let T=0;T<B;T++){x={x:x.x,y:x.y,z:x.z-s*yn},x.z<0&&(N=!1);let $=ae({origin:L,velocity:x,frametime:yn,trace:h,mins:f,maxs:c,overbounce:g,stepSize:A,maxBumps:V,maxClipPlanes:b,hasTime:N});L=$.origin,x=$.velocity}let k=O(L,{x:0,y:0,z:-as}),F=h(L,k,f,c);return F.fraction===1||!F.planeNormal||F.planeNormal.z<bn||F.endpos.z<l.z?{pmFlags:S,pmTime:C,velocity:E,performedWaterJump:!1}:_&&Math.abs(l.z-F.endpos.z)<=A?{pmFlags:S,pmTime:C,velocity:E,performedWaterJump:!1}:Se({origin:F.endpos,mins:f,viewheight:m,pointContents:u}).waterlevel>=2?{pmFlags:S,pmTime:C,velocity:E,performedWaterJump:!1}:(S=G(S,8),C=ns,E={x:M.x*He,y:M.y*He,z:hn},{pmFlags:S,pmTime:C,velocity:E,performedWaterJump:!0})}function ls(t){if(t===0)return 0;let e=Math.floor(10*(os/t));return e<=0?0:Math.min(rs,e)}var Et=[0,-1,1];function vt(t){let{origin:e,mins:n,maxs:o,trace:r}=t;return!r(e,e,n,o).allsolid}function us(t){let{origin:e,velocity:n,mins:o,maxs:r,previousOrigin:s,trace:i}=t;if(vt({origin:e,mins:o,maxs:r,trace:i}))return{origin:{...e},velocity:{...n},resolution:"unchanged"};let a=At({origin:e,mins:o,maxs:r,trace:(l,d,f,c)=>i(l,c,d,f)});return a.result==="fixed"||a.result==="good-position"?{origin:a.origin,velocity:{...n},resolution:"fixed"}:{origin:{...s},velocity:{...n},resolution:"reverted"}}function ds(t){let{origin:e,mins:n,maxs:o,trace:r}=t;for(let s of Et)for(let i of Et)for(let a of Et){let l={x:e.x+a,y:e.y+i,z:e.z+s};if(vt({origin:l,mins:n,maxs:o,trace:r}))return{origin:l,snapped:a!==0||i!==0||s!==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 ms(t){return t>89&&t<180?89:t<271&&t>=180?271:t}function ps(t){let{pmFlags:e,cmdAngles:n,deltaAngles:o}=t,r;(e&32)!==0?r={x:0,y:n.y+o.y,z:0}:(r=fs(n,o),r={...r,x:ms(r.x)});let s=oe(r);return{viewangles:r,...s}}var xs=200,hs=200,ys=200,bs=140,Ts=150,Ss=3;function gs(t){let e=xe(t);return e>89&&e<180?89:e<271&&e>=180?271:e}function _s(t,e){return{x:gs(t.x+e.x),y:xe(t.y+e.y),z:xe(t.z+e.z)}}function As(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 Tn=(T=>(T[T.bad=0]="bad",T[T.muzzleflash=1]="muzzleflash",T[T.muzzleflash2=2]="muzzleflash2",T[T.temp_entity=3]="temp_entity",T[T.layout=4]="layout",T[T.inventory=5]="inventory",T[T.nop=6]="nop",T[T.disconnect=7]="disconnect",T[T.reconnect=8]="reconnect",T[T.sound=9]="sound",T[T.print=10]="print",T[T.stufftext=11]="stufftext",T[T.serverdata=12]="serverdata",T[T.configstring=13]="configstring",T[T.spawnbaseline=14]="spawnbaseline",T[T.centerprint=15]="centerprint",T[T.download=16]="download",T[T.playerinfo=17]="playerinfo",T[T.packetentities=18]="packetentities",T[T.deltapacketentities=19]="deltapacketentities",T[T.frame=20]="frame",T[T.splitclient=21]="splitclient",T[T.configblast=22]="configblast",T[T.spawnbaselineblast=23]="spawnbaselineblast",T[T.level_restart=24]="level_restart",T[T.damage=25]="damage",T[T.locprint=26]="locprint",T[T.fog=27]="fog",T[T.waitingforplayers=28]="waitingforplayers",T[T.bot_chat=29]="bot_chat",T[T.poi=30]="poi",T[T.help_path=31]="help_path",T[T.muzzleflash3=32]="muzzleflash3",T[T.achievement=33]="achievement",T))(Tn||{}),Sn=(s=>(s[s.bad=0]="bad",s[s.nop=1]="nop",s[s.move=2]="move",s[s.userinfo=3]="userinfo",s[s.stringcmd=4]="stringcmd",s))(Sn||{});var gn=(p=>(p[p.GUNSHOT=0]="GUNSHOT",p[p.BLOOD=1]="BLOOD",p[p.BLASTER=2]="BLASTER",p[p.RAILTRAIL=3]="RAILTRAIL",p[p.SHOTGUN=4]="SHOTGUN",p[p.EXPLOSION1=5]="EXPLOSION1",p[p.EXPLOSION2=6]="EXPLOSION2",p[p.ROCKET_EXPLOSION=7]="ROCKET_EXPLOSION",p[p.GRENADE_EXPLOSION=8]="GRENADE_EXPLOSION",p[p.SPARKS=9]="SPARKS",p[p.SPLASH=10]="SPLASH",p[p.BUBBLETRAIL=11]="BUBBLETRAIL",p[p.SCREEN_SPARKS=12]="SCREEN_SPARKS",p[p.SHIELD_SPARKS=13]="SHIELD_SPARKS",p[p.BULLET_SPARKS=14]="BULLET_SPARKS",p[p.LASER_SPARKS=15]="LASER_SPARKS",p[p.PARASITE_ATTACK=16]="PARASITE_ATTACK",p[p.ROCKET_EXPLOSION_WATER=17]="ROCKET_EXPLOSION_WATER",p[p.GRENADE_EXPLOSION_WATER=18]="GRENADE_EXPLOSION_WATER",p[p.MEDIC_CABLE_ATTACK=19]="MEDIC_CABLE_ATTACK",p[p.BFG_EXPLOSION=20]="BFG_EXPLOSION",p[p.BFG_BIGEXPLOSION=21]="BFG_BIGEXPLOSION",p[p.BOSSTPORT=22]="BOSSTPORT",p[p.BFG_LASER=23]="BFG_LASER",p[p.GRAPPLE_CABLE=24]="GRAPPLE_CABLE",p[p.WELDING_SPARKS=25]="WELDING_SPARKS",p[p.GREENBLOOD=26]="GREENBLOOD",p[p.BLUEHYPERBLASTER=27]="BLUEHYPERBLASTER",p[p.PLASMA_EXPLOSION=28]="PLASMA_EXPLOSION",p[p.TUNNEL_SPARKS=29]="TUNNEL_SPARKS",p[p.BLASTER2=30]="BLASTER2",p[p.RAILTRAIL2=31]="RAILTRAIL2",p[p.FLAME=32]="FLAME",p[p.LIGHTNING=33]="LIGHTNING",p[p.DEBUGTRAIL=34]="DEBUGTRAIL",p[p.PLAIN_EXPLOSION=35]="PLAIN_EXPLOSION",p[p.FLASHLIGHT=36]="FLASHLIGHT",p[p.FORCEWALL=37]="FORCEWALL",p[p.HEATBEAM=38]="HEATBEAM",p[p.MONSTER_HEATBEAM=39]="MONSTER_HEATBEAM",p[p.STEAM=40]="STEAM",p[p.BUBBLETRAIL2=41]="BUBBLETRAIL2",p[p.MOREBLOOD=42]="MOREBLOOD",p[p.HEATBEAM_SPARKS=43]="HEATBEAM_SPARKS",p[p.HEATBEAM_STEAM=44]="HEATBEAM_STEAM",p[p.CHAINFIST_SMOKE=45]="CHAINFIST_SMOKE",p[p.ELECTRIC_SPARKS=46]="ELECTRIC_SPARKS",p[p.TRACKER_EXPLOSION=47]="TRACKER_EXPLOSION",p[p.TELEPORT_EFFECT=48]="TELEPORT_EFFECT",p[p.DBALL_GOAL=49]="DBALL_GOAL",p[p.WIDOWBEAMOUT=50]="WIDOWBEAMOUT",p[p.NUKEBLAST=51]="NUKEBLAST",p[p.WIDOWSPLASH=52]="WIDOWSPLASH",p[p.EXPLOSION1_BIG=53]="EXPLOSION1_BIG",p[p.EXPLOSION1_NP=54]="EXPLOSION1_NP",p[p.FLECHETTE=55]="FLECHETTE",p[p.BLUEHYPERBLASTER_KEX=56]="BLUEHYPERBLASTER_KEX",p[p.BFG_ZAP=57]="BFG_ZAP",p[p.BERSERK_SLAM=58]="BERSERK_SLAM",p[p.GRAPPLE_CABLE_2=59]="GRAPPLE_CABLE_2",p[p.POWER_SPLASH=60]="POWER_SPLASH",p[p.LIGHTNING_BEAM=61]="LIGHTNING_BEAM",p[p.EXPLOSION1_NL=62]="EXPLOSION1_NL",p[p.EXPLOSION2_NL=63]="EXPLOSION2_NL",p))(gn||{});var Es=1024,vs=256,Vs=16,Ns=64,Cs=512,Os=1400,Rs=0,Ms=1,Ps=2,ws=3,Ls=4,Fs=5,zs=6,Ds=7,Us=8,Bs=9,Is=10,Gs=11,Ws=12,ks=13;var _n=(i=>(i[i.LAYOUTS_LAYOUT=1]="LAYOUTS_LAYOUT",i[i.LAYOUTS_INVENTORY=2]="LAYOUTS_INVENTORY",i[i.LAYOUTS_HIDE_HUD=4]="LAYOUTS_HIDE_HUD",i[i.LAYOUTS_INTERMISSION=8]="LAYOUTS_INTERMISSION",i[i.LAYOUTS_HELP=16]="LAYOUTS_HELP",i[i.LAYOUTS_HIDE_CROSSHAIR=32]="LAYOUTS_HIDE_CROSSHAIR",i))(_n||{});function Vt(t){return t<<16>>16}function An(t,e,n){let o=Math.floor(n/2),r=n%2!==0,s=e+o,i=t[s]||0;if(r){let a=t[s+1]||0,l=i>>>8&255;return(a&255)<<8|l}else return i&65535}function Hs(t,e,n,o){let r=Math.floor(n/2),s=n%2!==0,i=e+r;if(t[i]===void 0&&(t[i]=0),!s)t[i]=Vt(o);else{t[i+1]===void 0&&(t[i+1]=0);let a=t[i],l=t[i+1],d=o&255,f=a&255|d<<8;t[i]=Vt(f);let m=o>>>8&255|l&65280;t[i+1]=Vt(m)}}function Nt(t,e,n,o,r){let s=r*n,i=Math.floor(s/8),a=s%8,l=(1<<r)-1<<a,f=An(t,e,i)&~l|o<<a&l;Hs(t,e,i,f&65535)}function Ct(t,e,n,o){let r=o*n,s=Math.floor(r/8),i=r%8,a=(1<<o)-1<<i;return(An(t,e,s)&a)>>>i}var En=(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))(En||{});var vn=(y=>(y[y.STAT_HEALTH_ICON=0]="STAT_HEALTH_ICON",y[y.STAT_HEALTH=1]="STAT_HEALTH",y[y.STAT_AMMO_ICON=2]="STAT_AMMO_ICON",y[y.STAT_AMMO=3]="STAT_AMMO",y[y.STAT_ARMOR_ICON=4]="STAT_ARMOR_ICON",y[y.STAT_ARMOR=5]="STAT_ARMOR",y[y.STAT_SELECTED_ICON=6]="STAT_SELECTED_ICON",y[y.STAT_PICKUP_ICON=7]="STAT_PICKUP_ICON",y[y.STAT_PICKUP_STRING=8]="STAT_PICKUP_STRING",y[y.STAT_TIMER_ICON=9]="STAT_TIMER_ICON",y[y.STAT_TIMER=10]="STAT_TIMER",y[y.STAT_HELPICON=11]="STAT_HELPICON",y[y.STAT_SELECTED_ITEM=12]="STAT_SELECTED_ITEM",y[y.STAT_LAYOUTS=13]="STAT_LAYOUTS",y[y.STAT_FRAGS=14]="STAT_FRAGS",y[y.STAT_FLASHES=15]="STAT_FLASHES",y[y.STAT_CHASE=16]="STAT_CHASE",y[y.STAT_SPECTATOR=17]="STAT_SPECTATOR",y[y.STAT_CTF_TEAM1_PIC=18]="STAT_CTF_TEAM1_PIC",y[y.STAT_CTF_TEAM1_CAPS=19]="STAT_CTF_TEAM1_CAPS",y[y.STAT_CTF_TEAM2_PIC=20]="STAT_CTF_TEAM2_PIC",y[y.STAT_CTF_TEAM2_CAPS=21]="STAT_CTF_TEAM2_CAPS",y[y.STAT_CTF_FLAG_PIC=22]="STAT_CTF_FLAG_PIC",y[y.STAT_CTF_JOINED_TEAM1_PIC=23]="STAT_CTF_JOINED_TEAM1_PIC",y[y.STAT_CTF_JOINED_TEAM2_PIC=24]="STAT_CTF_JOINED_TEAM2_PIC",y[y.STAT_CTF_TEAM1_HEADER=25]="STAT_CTF_TEAM1_HEADER",y[y.STAT_CTF_TEAM2_HEADER=26]="STAT_CTF_TEAM2_HEADER",y[y.STAT_CTF_TECH=27]="STAT_CTF_TECH",y[y.STAT_CTF_ID_VIEW=28]="STAT_CTF_ID_VIEW",y[y.STAT_CTF_MATCH=29]="STAT_CTF_MATCH",y[y.STAT_CTF_ID_VIEW_COLOR=30]="STAT_CTF_ID_VIEW_COLOR",y[y.STAT_CTF_TEAMINFO=31]="STAT_CTF_TEAMINFO",y[y.STAT_WEAPONS_OWNED_1=32]="STAT_WEAPONS_OWNED_1",y[y.STAT_WEAPONS_OWNED_2=33]="STAT_WEAPONS_OWNED_2",y[y.STAT_AMMO_INFO_START=34]="STAT_AMMO_INFO_START",y[y.STAT_POWERUP_INFO_START=41]="STAT_POWERUP_INFO_START",y[y.STAT_KEY_A=44]="STAT_KEY_A",y[y.STAT_KEY_B=45]="STAT_KEY_B",y[y.STAT_KEY_C=46]="STAT_KEY_C",y[y.STAT_ACTIVE_WHEEL_WEAPON=47]="STAT_ACTIVE_WHEEL_WEAPON",y[y.STAT_COOP_RESPAWN=48]="STAT_COOP_RESPAWN",y[y.STAT_LIVES=49]="STAT_LIVES",y[y.STAT_HIT_MARKER=50]="STAT_HIT_MARKER",y[y.STAT_SELECTED_ITEM_NAME=51]="STAT_SELECTED_ITEM_NAME",y[y.STAT_HEALTH_BARS=52]="STAT_HEALTH_BARS",y[y.STAT_ACTIVE_WEAPON=53]="STAT_ACTIVE_WEAPON",y[y.STAT_LAST=54]="STAT_LAST",y))(vn||{}),Ke=12,Xe=9,Ks=Math.ceil(Ke*Xe/16),Je=23,Ye=2,Xs=Math.ceil(Je*Ye/16),Vn={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 Js(t,e,n){if(e<0||e>=Ke)return;let o=n;o>511&&(o=511),o<0&&(o=0),Nt(t,34,e,o,Xe)}function Ys(t,e){return e<0||e>=Ke?0:Ct(t,34,e,Xe)}function js(t,e,n){let o;if(typeof e=="number"?o=e:o=Vn[e],o===void 0||o<0||o>=Je)return;let r=n;r>3&&(r=3),r<0&&(r=0),Nt(t,41,o,r,Ye)}function Zs(t,e){let n;return typeof e=="number"?n=e:n=Vn[e],n===void 0||n<0||n>=Je?0:Ct(t,41,n,Ye)}function qs(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(0),t.writeByte(0)}var Nn=(b=>(b[b.MinLight=1]="MinLight",b[b.ViewerModel=2]="ViewerModel",b[b.WeaponModel=4]="WeaponModel",b[b.FullBright=8]="FullBright",b[b.DepthHack=16]="DepthHack",b[b.Translucent=32]="Translucent",b[b.FrameLerp=64]="FrameLerp",b[b.Beam=128]="Beam",b[b.CustomLight=256]="CustomLight",b[b.Glow=512]="Glow",b[b.ShellRed=1024]="ShellRed",b[b.ShellGreen=2048]="ShellGreen",b[b.ShellBlue=4096]="ShellBlue",b[b.IrVisible=32768]="IrVisible",b[b.ShellDouble=65536]="ShellDouble",b[b.ShellHalfDam=131072]="ShellHalfDam",b[b.MinLightPlus=262144]="MinLightPlus",b[b.ExtraLight=524288]="ExtraLight",b[b.BeamLightning=1048576]="BeamLightning",b))(Nn||{});var $s=[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 Qs(t){let e=0;for(let n=0;n<t.length;n++)e=$s[(e^t[n])&255];return e}var Ot={};qe(Ot,{U_ANGLE1:()=>ii,U_ANGLE2:()=>ai,U_ANGLE3:()=>ci,U_EFFECTS:()=>di,U_EVENT:()=>pi,U_FRAME:()=>li,U_MODEL:()=>ti,U_MODEL2:()=>hi,U_MODEL3:()=>yi,U_MODEL4:()=>bi,U_MOREBITS:()=>xi,U_NUMBER:()=>ei,U_ORIGIN1:()=>oi,U_ORIGIN2:()=>ri,U_ORIGIN3:()=>si,U_REMOVE:()=>Ti,U_RENDERFX:()=>fi,U_SKIN:()=>ui,U_SOLID:()=>mi,U_SOUND:()=>ni});var ei=1,ti=2,ni=4,oi=8,ri=16,si=32,ii=64,ai=128,ci=256,li=512,ui=1024,di=2048,fi=4096,mi=8192,pi=16384,xi=32768,hi=1,yi=2,bi=4,Ti=32768;var Ae=.025,Rt=33554432,je={None:0,Feet:1,Waist:2,Under:3},Si=(t,e)=>{let n={...t.origin};n.z-=.25;let o=e(t.origin,n);return{...t,onGround:o.fraction<1}},gi=(t,e)=>{let n={...t.origin},{mins:o,maxs:r}=t;if(n.z=t.origin.z+o.z+1,!(e(n)&Rt))return{...t,waterLevel:je.None};let i=je.Feet,a=t.origin.z+(o.z+r.z)*.5;if(n.z=a,e(n)&Rt){i=je.Waist;let d=t.origin.z+22;n.z=d,e(n)&Rt&&(i=je.Under)}return{...t,waterLevel:i}},_i=(t,e,n,o)=>{let r={...t};r=Si(r,n),r=gi(r,o);let{origin:s,velocity:i,onGround:a,waterLevel:l,viewAngles:d}=r,f=l>=2?d:{x:d.x>180?(d.x-360)/3:d.x/3,y:d.y,z:d.z},{forward:c,right:m}=oe(f),h=We({velocity:i,frametime:Ae,onGround:a,groundIsSlick:!1,onLadder:!1,waterlevel:l,pmFriction:6,pmStopSpeed:100,pmWaterFriction:1}),u=l>=2?gt({forward:c,right:m,cmd:e,maxSpeed:320}):St({forward:c,right:m,cmd:e,maxSpeed:320}),_=Y({velocity:h,wishdir:u.wishdir,wishspeed:u.wishspeed,accel:a||l>=2?10:1,frametime:Ae}),g=n(s,{x:s.x+_.x*Ae,y:s.y+_.y*Ae,z:s.z+_.z*Ae});return{...r,origin:g.endpos,velocity:_}};var Mt=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}seek(e){if(e<0||e>this.length)throw new Error(`Seek out of bounds: ${e} (length: ${this.length})`);this.offset=e}hasMore(){return this.offset<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 Ee=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}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 r=0;r<j.length;r++){let s=j[r],i=e.x*s[0]+e.y*s[1]+e.z*s[2];i>n&&(n=i,o=r)}this.writeByte(o)}getData(){return this.buffer.slice(0,this.offset)}getBuffer(){return this.buffer}getOffset(){return this.offset}reset(){this.offset=0}};var Pt=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 r=0,s=-999999,i=Math.sqrt(e*e+n*n+o*o);if(i>0){e/=i,n/=i,o/=i;for(let a=0;a<162;a++){let l=e*j[a][0]+n*j[a][1]+o*j[a][2];l>s&&(s=l,r=a)}}this.writeByte(r)}};var D=class D{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.lastReceived=0;this.lastSent=0;this.remoteAddress=null;this.reliableMessage=new Ee(D.MAX_MSGLEN);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.lastReceived=Date.now(),this.lastSent=Date.now()}transmit(e){this.outgoingSequence++,this.lastSent=Date.now();let n=D.PACKET_HEADER,o=this.reliableLength>0?this.reliableLength+2:0,r=e?e.length:0;n+o+r>D.MAX_MSGLEN&&(r=D.MAX_MSGLEN-n-o,r<0&&(r=0));let s=new ArrayBuffer(n+o+r),i=new DataView(s),a=new Uint8Array(s),l=this.outgoingSequence;this.reliableLength>0&&(l|=2147483648,(this.outgoingReliableSequence&1)!==0&&(l|=1073741824)),i.setUint32(0,l,!0);let d=this.incomingSequence;(this.incomingReliableSequence&1)!==0&&(d|=2147483648),i.setUint32(4,d,!0),i.setUint16(8,this.qport,!0);let f=n;if(this.reliableLength>0){i.setUint16(f,this.reliableLength,!0),f+=2;let m=this.reliableMessage.getBuffer().subarray(0,this.reliableLength);a.set(m,f),f+=this.reliableLength}if(e&&r>0){let c=e.slice(0,r);a.set(c,f)}return a}process(e){if(e.length<D.PACKET_HEADER)return null;this.lastReceived=Date.now();let n=new DataView(e.buffer,e.byteOffset,e.byteLength),o=n.getUint32(0,!0),r=n.getUint32(4,!0),s=n.getUint16(8,!0);if(this.qport!==s)return null;let i=o&1073741823;if((i-this.incomingSequence|0)<=0)return null;this.incomingSequence=i;let a=r&2147483647,l=(r&2147483648)!==0;if(a>this.incomingAcknowledged&&(this.incomingAcknowledged=a),this.reliableLength>0){let u=l?1:0,_=this.outgoingReliableSequence&1;u!==_&&(this.reliableLength=0,this.reliableMessage.reset(),this.outgoingReliableSequence^=1)}let d=(o&2147483648)!==0,f=(o&1073741824)!==0?1:0,c=D.PACKET_HEADER,m=null;if(d){if(c+2>e.byteLength)return null;let u=n.getUint16(c,!0);c+=2;let _=this.incomingReliableSequence&1;if(f===_){if(this.incomingReliableSequence++,c+u>e.byteLength)return null;m=e.slice(c,c+u)}c+=u}let h=e.slice(c);if(m&&m.length>0){let u=m.length+h.length,_=new Uint8Array(u);return _.set(m,0),_.set(h,m.length),_}return h||new Uint8Array(0)}canSendReliable(){return this.reliableLength===0}writeReliableByte(e){if(this.reliableLength+1>D.MAX_MSGLEN-D.HEADER_OVERHEAD)throw new Error("NetChan reliable buffer overflow");this.reliableMessage.writeByte(e),this.reliableLength++}writeReliableShort(e){if(this.reliableLength+2>D.MAX_MSGLEN-D.HEADER_OVERHEAD)throw new Error("NetChan reliable buffer overflow");this.reliableMessage.writeShort(e),this.reliableLength+=2}writeReliableLong(e){if(this.reliableLength+4>D.MAX_MSGLEN-D.HEADER_OVERHEAD)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>D.MAX_MSGLEN-D.HEADER_OVERHEAD)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}};D.MAX_MSGLEN=1400,D.FRAGMENT_SIZE=1024,D.PACKET_HEADER=10,D.HEADER_OVERHEAD=D.PACKET_HEADER+2;var wt=D;var Cn=(S=>(S.Blaster="blaster",S.Shotgun="shotgun",S.SuperShotgun="supershotgun",S.Machinegun="machinegun",S.Chaingun="chaingun",S.HandGrenade="grenades",S.GrenadeLauncher="grenadelauncher",S.RocketLauncher="rocketlauncher",S.HyperBlaster="hyperblaster",S.Railgun="railgun",S.BFG10K="bfg10k",S.Grapple="grapple",S.ChainFist="chainfist",S.EtfRifle="etf_rifle",S.ProxLauncher="prox_launcher",S.IonRipper="ionripper",S.PlasmaBeam="plasmabeam",S.Phalanx="phalanx",S.Disruptor="disruptor",S.Trap="trap",S))(Cn||{});var Lt=(u=>(u[u.Bullets=0]="Bullets",u[u.Shells=1]="Shells",u[u.Rockets=2]="Rockets",u[u.Grenades=3]="Grenades",u[u.Cells=4]="Cells",u[u.Slugs=5]="Slugs",u[u.MagSlugs=6]="MagSlugs",u[u.Trap=7]="Trap",u[u.Flechettes=8]="Flechettes",u[u.Tesla=9]="Tesla",u[u.Disruptor=10]="Disruptor",u[u.Prox=11]="Prox",u[u.Nuke=12]="Nuke",u[u.Rounds=13]="Rounds",u))(Lt||{}),Ai=Object.keys(Lt).length/2,On=(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))(On||{});var Ei=["blaster","shotgun","supershotgun","machinegun","chaingun","grenadelauncher","rocketlauncher","grenades","hyperblaster","railgun","bfg10k"],vi={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 ml=32,Rn=(c=>(c[c.Auto=0]="Auto",c[c.Weapon=1]="Weapon",c[c.Voice=2]="Voice",c[c.Item=3]="Item",c[c.Body=4]="Body",c[c.Aux=5]="Aux",c[c.Footstep=6]="Footstep",c[c.Aux3=7]="Aux3",c[c.NoPhsAdd=8]="NoPhsAdd",c[c.Reliable=16]="Reliable",c[c.ForcePos=32]="ForcePos",c))(Rn||{}),pl=-1,xl=0,hl=1,yl=2,bl=3,Tl=80,Sl=.003;function Mn(t){return t===3?t*.001:t*5e-4}function Vi(t){let e=Mn(t);return e<=0?Number.POSITIVE_INFINITY:80+1/e}return Dn(Ni);})();
|
|
2
2
|
//# sourceMappingURL=index.global.js.map
|