quake2ts 0.0.185 → 0.0.187
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.d.mts +3 -0
- package/packages/cgame/dist/index.d.ts +3 -0
- package/packages/cgame/dist/index.js +32 -0
- package/packages/cgame/dist/index.mjs +7 -0
- package/packages/client/dist/browser/index.global.js +5 -5
- package/packages/client/dist/browser/index.global.js.map +1 -1
- package/packages/client/dist/cjs/index.cjs +6 -0
- package/packages/client/dist/cjs/index.cjs.map +1 -1
- package/packages/client/dist/esm/index.js +6 -0
- 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 +1 -1
- package/packages/engine/dist/browser/index.global.js.map +1 -1
- package/packages/engine/dist/cjs/index.cjs +3 -0
- package/packages/engine/dist/cjs/index.cjs.map +1 -1
- package/packages/engine/dist/esm/index.js +3 -0
- package/packages/engine/dist/esm/index.js.map +1 -1
- package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/game/dist/browser/index.global.js +2 -2
- package/packages/game/dist/browser/index.global.js.map +1 -1
- package/packages/game/dist/cjs/index.cjs +95 -19
- package/packages/game/dist/cjs/index.cjs.map +1 -1
- package/packages/game/dist/esm/index.js +95 -19
- package/packages/game/dist/esm/index.js.map +1 -1
- package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/game/dist/types/entities/monsters/medic.d.ts +1 -0
- package/packages/game/dist/types/entities/monsters/medic.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 +3 -0
- package/packages/shared/dist/cjs/index.cjs.map +1 -1
- package/packages/shared/dist/esm/index.js +3 -0
- package/packages/shared/dist/esm/index.js.map +1 -1
- package/packages/shared/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/shared/dist/types/pmove/config.d.ts +5 -0
- package/packages/shared/dist/types/pmove/config.d.ts.map +1 -0
- package/packages/shared/dist/types/protocol/configstrings.d.ts +3 -0
- package/packages/shared/dist/types/protocol/configstrings.d.ts.map +1 -1
- package/packages/shared/dist/types/protocol/layout.d.ts +9 -0
- package/packages/shared/dist/types/protocol/layout.d.ts.map +1 -0
- package/packages/shared/dist/types/protocol/stats.d.ts +28 -0
- package/packages/shared/dist/types/protocol/stats.d.ts.map +1 -0
- package/packages/tools/dist/tsconfig.tsbuildinfo +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var Quake2Shared=(()=>{var De=Object.defineProperty;var eo=Object.getOwnPropertyDescriptor;var to=Object.getOwnPropertyNames;var oo=Object.prototype.hasOwnProperty;var Ie=(t,e)=>{for(var o in e)De(t,o,{get:e[o],enumerable:!0})},no=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of to(e))!oo.call(t,r)&&r!==o&&De(t,r,{get:()=>e[r],enumerable:!(n=eo(e,r))||n.enumerable});return t};var ro=t=>no(De({},"__esModule",{value:!0}),t);var Ns={};Ie(Ns,{ANORMS:()=>re,BinaryStream:()=>mt,BinaryWriter:()=>ft,CGAME_EXPORT_KEYS:()=>On,CGAME_IMPORT_KEYS:()=>vn,CONTENTS_AREAPORTAL:()=>Us,CONTENTS_AUX:()=>Ms,CONTENTS_CURRENT_0:()=>Mo,CONTENTS_CURRENT_180:()=>Do,CONTENTS_CURRENT_270:()=>Io,CONTENTS_CURRENT_90:()=>wo,CONTENTS_CURRENT_DOWN:()=>Bo,CONTENTS_CURRENT_UP:()=>Wo,CONTENTS_DEADMONSTER:()=>Xs,CONTENTS_DETAIL:()=>Js,CONTENTS_LADDER:()=>bt,CONTENTS_LAVA:()=>ws,CONTENTS_MIST:()=>Ws,CONTENTS_MONSTER:()=>Ks,CONTENTS_MONSTERCLIP:()=>Gs,CONTENTS_NONE:()=>_e,CONTENTS_NO_WATERJUMP:()=>Lo,CONTENTS_ORIGIN:()=>Hs,CONTENTS_PLAYER:()=>Ys,CONTENTS_PLAYERCLIP:()=>ks,CONTENTS_PROJECTILE:()=>Zs,CONTENTS_PROJECTILECLIP:()=>Bs,CONTENTS_SLIME:()=>Ds,CONTENTS_SOLID:()=>Fs,CONTENTS_TRANSLUCENT:()=>js,CONTENTS_TRIGGER:()=>Fo,CONTENTS_WATER:()=>Is,CONTENTS_WINDOW:()=>Ls,CS_MAX_STRING_LENGTH:()=>wi,CS_MAX_STRING_LENGTH_OLD:()=>Di,ClientCommand:()=>qt,CollisionEntityIndex:()=>Ke,ConfigStringIndex:()=>ie,CvarFlags:()=>gt,DEFAULT_FORWARD_SPEED:()=>kr,DEFAULT_MOUSE_SENSITIVITY:()=>Jr,DEFAULT_PITCH_SPEED:()=>Xr,DEFAULT_SIDE_SPEED:()=>Gr,DEFAULT_UP_SPEED:()=>Hr,DEFAULT_YAW_SPEED:()=>Kr,DEG2RAD:()=>Co,DIST_EPSILON:()=>J,EntityFlags:()=>dt,GAME_EXPORT_KEYS:()=>Rn,GAME_IMPORT_KEYS:()=>gn,LAST_VISIBLE_CONTENTS:()=>qs,MASK_ALL:()=>mi,MASK_BLOCK_SIGHT:()=>Si,MASK_CURRENT:()=>Uo,MASK_DEADSOLID:()=>pi,MASK_LADDER_NAV_SOLID:()=>Vi,MASK_MONSTERSOLID:()=>yi,MASK_NAV_SOLID:()=>bi,MASK_OPAQUE:()=>xi,MASK_PLAYERSOLID:()=>fi,MASK_PROJECTILE:()=>Pi,MASK_SHOT:()=>hi,MASK_SOLID:()=>ke,MASK_WALK_NAV_SOLID:()=>Ti,MASK_WATER:()=>Ne,MAX_CHALLENGES:()=>qr,MAX_CLIENTS:()=>mn,MAX_CONFIGSTRINGS:()=>Vn,MAX_EDICTS:()=>Mi,MAX_GENERAL:()=>Sn,MAX_IMAGES:()=>xn,MAX_INFO_STRING:()=>es,MAX_ITEMS:()=>hn,MAX_LIGHTSTYLES:()=>fn,MAX_MODELS:()=>pn,MAX_MSGLEN:()=>ts,MAX_OSPATH:()=>Li,MAX_PACKET_ENTITIES:()=>$r,MAX_QPATH:()=>Fi,MAX_SHADOW_LIGHTS:()=>bn,MAX_SOUNDS:()=>yn,MAX_STRING_CHARS:()=>vi,MAX_STRING_TOKENS:()=>Oi,MAX_TOKEN_CHARS:()=>zi,MAX_WHEEL_ITEMS:()=>Ze,MersenneTwister19937:()=>Pe,PITCH:()=>Ve,PlaneSide:()=>Tt,PlayerButton:()=>te,PmFlag:()=>ee,PmType:()=>ce,RAD2DEG:()=>_o,ROLL:()=>Be,RandomGenerator:()=>Ce,Replay:()=>qe,SLIDEMOVE_BLOCKED_FLOOR:()=>Ot,SLIDEMOVE_BLOCKED_WALL:()=>zt,STOP_EPSILON:()=>Y,SURF_ALPHATEST:()=>ai,SURF_FLOWING:()=>si,SURF_LIGHT:()=>Qs,SURF_N64_SCROLL_FLIP:()=>di,SURF_N64_SCROLL_X:()=>li,SURF_N64_SCROLL_Y:()=>ui,SURF_N64_UV:()=>ci,SURF_NODRAW:()=>ii,SURF_NONE:()=>$s,SURF_SKY:()=>ti,SURF_SLICK:()=>ei,SURF_TRANS33:()=>ni,SURF_TRANS66:()=>ri,SURF_WARP:()=>oi,ServerCommand:()=>Zt,TempEntity:()=>$t,UPDATE_BACKUP:()=>Qr,WaterLevel:()=>ae,YAW:()=>Te,ZERO_VEC3:()=>R,addBlendColor:()=>go,addContents:()=>Ho,addPmFlag:()=>W,addPointToBounds:()=>yo,addVec3:()=>A,addViewAngles:()=>Yr,angleMod:()=>me,angleVectors:()=>Ue,applyPmove:()=>_s,applyPmoveAccelerate:()=>K,applyPmoveAddCurrents:()=>ze,applyPmoveAirAccelerate:()=>et,applyPmoveAirMove:()=>Tr,applyPmoveFlyMove:()=>Yn,applyPmoveFriction:()=>Qe,applyPmoveWaterMove:()=>Pr,assertContract:()=>En,boxContents:()=>rn,boxOnPlaneSide:()=>Qo,boxesIntersect:()=>xo,buildAirGroundWish:()=>tt,buildCollisionModel:()=>qo,buildWaterWish:()=>ot,categorizePosition:()=>br,checkDuckState:()=>sr,checkJump:()=>er,checkSpecialMovement:()=>Mr,clampViewAngles:()=>Ur,clipBoxToBrush:()=>Je,clipVelocityAgainstPlanes:()=>ho,clipVelocityVec3:()=>$,closestPointToBox:()=>mo,combineSurfaceFlags:()=>Jo,computePlaneSignBits:()=>Xe,computePlayerDimensions:()=>Le,concatRotationMatrices:()=>We,configStringSize:()=>Tn,copyVec3:()=>io,createDefaultTrace:()=>ge,createEmptyBounds3:()=>po,createMat4Identity:()=>St,createRandomGenerator:()=>Ro,crossVec3:()=>q,currentVectorFromContents:()=>at,degToRad:()=>Se,disableTraceDebug:()=>Yo,distance:()=>lo,distanceBetweenBoxesSquared:()=>fo,dotVec3:()=>F,enableTraceDebug:()=>jo,fixStuckObjectGeneric:()=>st,getWaterLevel:()=>xe,goodPosition:()=>ut,groundCurrentVelocity:()=>kt,hasAllContents:()=>ko,hasAnyContents:()=>Go,hasPmFlag:()=>L,hasSurfaceFlags:()=>Xo,inPHS:()=>an,inPVS:()=>sn,initialSnapPosition:()=>Ir,isAtLeastWaistDeep:()=>$e,isUnderwater:()=>zn,lengthSquaredVec3:()=>ne,lengthVec3:()=>D,lerpAngle:()=>No,mat4FromBasis:()=>zo,mouseDeltaToViewDelta:()=>Zr,multiplyMat4:()=>vo,multiplyVec3:()=>ao,negateVec3:()=>co,normalizeVec3:()=>O,perpendicularVec3:()=>yt,planeDistanceToPoint:()=>Q,pmoveCmdScale:()=>Fn,pointContents:()=>on,pointContentsMany:()=>nn,pointInsideBrush:()=>Pt,pointOnPlaneSide:()=>$o,projectPointOnPlane:()=>pt,projectSourceVec3:()=>bo,projectSourceVec3WithUp:()=>Vo,radToDeg:()=>be,removeContents:()=>Ko,removePmFlag:()=>H,resolveSlideMove:()=>Ft,rotatePointAroundVector:()=>Po,scaleVec3:()=>E,slerpVec3:()=>To,slideClipVelocityVec3:()=>So,slideMove:()=>nt,snapPosition:()=>Dr,stepSlideMove:()=>oe,subtractVec3:()=>Z,testBoxInBrush:()=>Ct,traceBox:()=>Et,traceDebugInfo:()=>G,transformPointMat4:()=>Oo,validateContract:()=>Rt,vec3Equals:()=>uo,vectorToAngles:()=>Eo,vectorToYaw:()=>Ao,waterCurrentVelocity:()=>Ut});var R={x:0,y:0,z:0},Y=.1,so=Math.PI/180;function io(t){return{x:t.x,y:t.y,z:t.z}}function A(t,e){return{x:t.x+e.x,y:t.y+e.y,z:t.z+e.z}}function Z(t,e){return{x:t.x-e.x,y:t.y-e.y,z:t.z-e.z}}function ao(t,e){return{x:t.x*e.x,y:t.y*e.y,z:t.z*e.z}}function E(t,e){return{x:t.x*e,y:t.y*e,z:t.z*e}}function co(t){return E(t,-1)}function F(t,e){return t.x*e.x+t.y*e.y+t.z*e.z}function q(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 ne(t){return F(t,t)}function D(t){return Math.sqrt(ne(t))}function lo(t,e){return D(Z(t,e))}function uo(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z}function O(t){let e=D(t);return e===0?t:E(t,1/e)}function pt(t,e){let o=1/F(e,e),n=F(e,t)*o;return Z(t,E(e,o*n))}function yt(t){let e=0,o=Math.abs(t.x);return Math.abs(t.y)<o&&(e=1,o=Math.abs(t.y)),Math.abs(t.z)<o&&(e=2),O(pt(e===0?{x:1,y:0,z:0}:e===1?{x:0,y:1,z:0}:{x:0,y:0,z:1},t))}function mo(t,e,o){return{x:t.x<e.x?e.x:t.x>o.x?o.x:t.x,y:t.y<e.y?e.y:t.y>o.y?o.y:t.y,z:t.z<e.z?e.z:t.z>o.z?o.z:t.z}}function fo(t,e,o,n){let r=0;if(e.x<o.x){let s=e.x-o.x;r+=s*s}else if(t.x>n.x){let s=t.x-n.x;r+=s*s}if(e.y<o.y){let s=e.y-o.y;r+=s*s}else if(t.y>n.y){let s=t.y-n.y;r+=s*s}if(e.z<o.z){let s=e.z-o.z;r+=s*s}else if(t.z>n.z){let s=t.z-n.z;r+=s*s}return r}function po(){return{mins:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,z:Number.POSITIVE_INFINITY},maxs:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY,z:Number.NEGATIVE_INFINITY}}}function yo(t,e){return{mins:{x:Math.min(e.mins.x,t.x),y:Math.min(e.mins.y,t.y),z:Math.min(e.mins.z,t.z)},maxs:{x:Math.max(e.maxs.x,t.x),y:Math.max(e.maxs.y,t.y),z:Math.max(e.maxs.z,t.z)}}}function xo(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 $(t,e,o){let n=F(t,e)*o,r=t.x-e.x*n,s=t.y-e.y*n,i=t.z-e.z*n;return r>-Y&&r<Y&&(r=0),s>-Y&&s<Y&&(s=0),i>-Y&&i<Y&&(i=0),{x:r,y:s,z:i}}function ho(t,e,o,n){if(e.length===0)return t;let r=t;for(let s=0;s<e.length;s++){r=$(r,e[s],o);let i=0;for(;i<e.length&&!(i!==s&&F(r,e[i])<0);i++);if(i===e.length)return n&&F(r,n)<=0?R:r}if(e.length===2){let s=q(e[0],e[1]),i=F(s,t),a=E(s,i);return n&&F(a,n)<=0?R:a}return n&&F(r,n)<=0,R}function So(t,e,o){return $(t,e,o)}function bo(t,e,o,n){return{x:t.x+o.x*e.x+n.x*e.y,y:t.y+o.y*e.x+n.y*e.y,z:t.z+o.z*e.x+n.z*e.y+e.z}}function Vo(t,e,o,n,r){return{x:t.x+o.x*e.x+n.x*e.y+r.x*e.z,y:t.y+o.y*e.x+n.y*e.y+r.y*e.z,z:t.z+o.z*e.x+n.z*e.y+r.z*e.z}}function To(t,e,o){let n=F(t,e),r,s;if(Math.abs(n)>.9995)r=1-o,s=o;else{let i=Math.acos(n),a=Math.sin(i),d=Math.sin((1-o)*i),u=Math.sin(o*i);r=d/a,s=u/a}return{x:t.x*r+e.x*s,y:t.y*r+e.y*s,z:t.z*r+e.z*s}}function We(t,e){let o=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[o(0),o(1),o(2)]}function Po(t,e,o){if(D(t)===0)return e;let r=O(t),s=yt(r),i=q(s,r),a=[[s.x,i.x,r.x],[s.y,i.y,r.y],[s.z,i.z,r.z]],d=[[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]]],u=o*so,m=Math.cos(u),c=Math.sin(u),f=[[m,c,0],[-c,m,0],[0,0,1]],p=We(We(a,f),d);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 Ve=0,Te=1,Be=2,xt=Math.PI/180,ht=180/Math.PI,Co=xt,_o=ht;function de(t,e){switch(e){case Ve:return t.x;case Te:return t.y;case Be:default:return t.z}}function Se(t){return t*xt}function be(t){return t*ht}function No(t,e,o){let n=e;return n-t>180?n-=360:n-t<-180&&(n+=360),t+o*(n-t)}function me(t){let e=t%360;return e<0?360+e:e}function Ue(t){let e=Se(de(t,Te)),o=Se(de(t,Ve)),n=Se(de(t,Be)),r=Math.sin(e),s=Math.cos(e),i=Math.sin(o),a=Math.cos(o),d=Math.sin(n),u=Math.cos(n),m={x:a*s,y:a*r,z:-i},c={x:-d*i*s-u*-r,y:-d*i*r-u*s,z:-d*a},f={x:u*i*s-d*-r,y:u*i*r-d*s,z:u*a};return{forward:m,right:c,up:f}}function Ao(t){let e=de(t,Ve),o=de(t,Te);if(e===0)return o===0?0:o>0?90:270;let n=be(Math.atan2(o,e));return n<0?n+360:n}function Eo(t){let e=t.x,o=t.y,n=t.z;if(o===0&&e===0)return{x:n>0?-90:-270,y:0,z:0};let r;e?r=be(Math.atan2(o,e)):o>0?r=90:r=270,r<0&&(r+=360);let s=Math.sqrt(e*e+o*o),i=be(Math.atan2(n,s));return i<0&&(i+=360),{x:-i,y:r,z:0}}var re=[[-.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 go(t,e,o,n,r){if(n<=0)return r;let s=r[0],i=r[1],a=r[2],d=r[3],u=d+(1-d)*n;if(u<=0)return[0,0,0,0];let m=d/u,c=s*m+t*(1-m),f=i*m+e*(1-m),p=a*m+o*(1-m);return[c,f,p,u]}var Pe=class{constructor(e=5489){this.state=new Uint32Array(624);this.index=624;this.seed(e)}seed(e){this.state[0]=e>>>0;for(let o=1;o<624;o++){let n=this.state[o-1]^this.state[o-1]>>>30,r=Math.imul(n>>>0,1812433253)+o;this.state[o]=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 o=this.state[e]&2147483648|this.state[(e+1)%624]&2147483647,n=this.state[(e+397)%624]^o>>>1;(o&1)!==0&&(n^=2567483615),this.state[e]=n>>>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,o=>o>>>0)}},Ce=class{constructor(e={}){this.mt=new Pe(e.seed)}seed(e){this.mt.seed(e)}frandom(){return this.mt.nextUint32()/4294967296}frandomRange(e,o){return e+(o-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,o){if(o-e<=1)return e;let n=o-e,r=4294967296-4294967296%n,s;do s=this.mt.nextUint32();while(s>=r);return e+s%n}irandom(e){return e<=0?0:this.irandomRange(0,e)}randomTimeRange(e,o){return o<=e?e:this.irandomRange(e,o)}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 Ro(t){return new Ce(t)}function St(){return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function vo(t,e){let o=new Float32Array(16);for(let n=0;n<4;n+=1)for(let r=0;r<4;r+=1)o[r*4+n]=t[0+n]*e[r*4+0]+t[4+n]*e[r*4+1]+t[8+n]*e[r*4+2]+t[12+n]*e[r*4+3];return o}function Oo(t,e){let o=e.x,n=e.y,r=e.z;return{x:t[0]*o+t[4]*n+t[8]*r+t[12],y:t[1]*o+t[5]*n+t[9]*r+t[13],z:t[2]*o+t[6]*n+t[10]*r+t[14]}}function zo(t,e){let o=St();return o[0]=e[0].x,o[1]=e[0].y,o[2]=e[0].z,o[4]=e[1].x,o[5]=e[1].y,o[6]=e[1].z,o[8]=e[2].x,o[9]=e[2].y,o[10]=e[2].z,o[12]=t.x,o[13]=t.y,o[14]=t.z,o}var _e=0,Fs=1,Ls=2,Ms=4,ws=8,Ds=16,Is=32,Ws=64,Fo=1073741824,Lo=8192,Bs=16384,Us=32768,ks=65536,Gs=131072,Mo=262144,wo=524288,Do=1048576,Io=2097152,Wo=4194304,Bo=8388608,Hs=16777216,Ks=33554432,Xs=67108864,Js=134217728,js=268435456,bt=536870912,Ys=1073741824,Zs=-2147483648,qs=64,$s=0,Qs=1,ei=2,ti=4,oi=8,ni=16,ri=32,si=64,ii=128,ai=33554432,ci=268435456,li=536870912,ui=1073741824,di=-2147483648,mi=4294967295,ke=3,fi=1107361795,pi=65539,yi=1107427331,Ne=56,xi=25,hi=1174405123,Uo=16515072,Si=1107296281,bi=65539,Vi=3,Ti=196611,Pi=1174421507;function ko(t,e){return(t&e)===e}function Go(t,e){return(t&e)!==0}function Ho(t,e){return t|e}function Ko(t,e){return t&~e}function Xo(t,e){return(t&e)===e}function Jo(...t){let e=0;for(let o of t)e|=o;return e}function Ae(t=0,e={x:-8192,y:-8192,z:-8192},o={x:8192,y:8192,z:8192}){if(t>=4)return{axis:-1,dist:0,children:null,items:new Set};let n=t%2,r=.5*(n===0?e.x+o.x:e.y+o.y),s={...e},i={...o},a={...e},d={...o};n===0?(i.x=r,a.x=r):(i.y=r,a.y=r);let u=Ae(t+1,s,i),m=Ae(t+1,a,d);return{axis:n,dist:r,children:[u,m],items:new Set}}function Vt(t,e,o,n){let r=t;for(;r.axis!==-1&&r.children;){let s=r.axis,i=r.dist,a=s===0?o.x:o.y,d=s===0?n.x:n.y;if(a>i)r=r.children[1];else if(d<i)r=r.children[0];else break}return r.items.add(e),r}function fe(t,e,o,n){for(let d of t.items)n.add(d);if(t.axis===-1||!t.children)return;let r=t.axis,s=t.dist,i=r===0?e.x:e.y;(r===0?o.x:o.y)>s&&fe(t.children[1],e,o,n),i<s&&fe(t.children[0],e,o,n)}var Tt=(n=>(n[n.FRONT=1]="FRONT",n[n.BACK=2]="BACK",n[n.CROSS=3]="CROSS",n))(Tt||{}),G=null;function jo(){G={nodesTraversed:0,leafsReached:0,brushesTested:0}}function Yo(){G=null}var J=.03125,Zo=Number.MAX_SAFE_INTEGER-1,Ee=1;function qo(t){let e=t.planes.map(i=>({...i,signbits:Xe(i.normal)})),o=t.nodes.map(i=>({plane:e[i.planenum],children:i.children})),n=t.brushes.map(i=>{let a=t.brushSides.slice(i.firstSide,i.firstSide+i.numSides).map(d=>({plane:e[d.planenum],surfaceFlags:d.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:o,leaves:r,brushes:n,leafBrushes:t.leafBrushes,bmodels:s,visibility:t.visibility}}function Xe(t){let e=0;return t.x<0&&(e|=1),t.y<0&&(e|=2),t.z<0&&(e|=4),e}function Q(t,e){return t.normal.x*e.x+t.normal.y*e.y+t.normal.z*e.z-t.dist}function $o(t,e,o=0){let n=Q(t,e);return n>o?1:n<-o?2:3}function Qo(t,e,o,n=0){let r,s;switch(o.signbits){case 0:r=o.normal.x*e.x+o.normal.y*e.y+o.normal.z*e.z,s=o.normal.x*t.x+o.normal.y*t.y+o.normal.z*t.z;break;case 1:r=o.normal.x*t.x+o.normal.y*e.y+o.normal.z*e.z,s=o.normal.x*e.x+o.normal.y*t.y+o.normal.z*t.z;break;case 2:r=o.normal.x*e.x+o.normal.y*t.y+o.normal.z*e.z,s=o.normal.x*t.x+o.normal.y*e.y+o.normal.z*t.z;break;case 3:r=o.normal.x*t.x+o.normal.y*t.y+o.normal.z*e.z,s=o.normal.x*e.x+o.normal.y*e.y+o.normal.z*t.z;break;case 4:r=o.normal.x*e.x+o.normal.y*e.y+o.normal.z*t.z,s=o.normal.x*t.x+o.normal.y*t.y+o.normal.z*e.z;break;case 5:r=o.normal.x*t.x+o.normal.y*e.y+o.normal.z*t.z,s=o.normal.x*e.x+o.normal.y*t.y+o.normal.z*e.z;break;case 6:r=o.normal.x*e.x+o.normal.y*t.y+o.normal.z*t.z,s=o.normal.x*t.x+o.normal.y*e.y+o.normal.z*e.z;break;default:r=o.normal.x*t.x+o.normal.y*t.y+o.normal.z*t.z,s=o.normal.x*e.x+o.normal.y*e.y+o.normal.z*e.z;break}let i=0;return r-o.dist>=-n&&(i=1),s-o.dist<=n&&(i|=2),i}function Pt(t,e,o=J){for(let n of e.sides)if(Q(n.plane,t)>o)return!1;return!0}function Ct(t,e,o,n){for(let r of n.sides){let s=r.plane.normal.x*(r.plane.normal.x<0?o.x:e.x)+r.plane.normal.y*(r.plane.normal.y<0?o.y:e.y)+r.plane.normal.z*(r.plane.normal.z<0?o.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:n.contents}}function Je({start:t,end:e,mins:o,maxs:n,brush:r,trace:s}){if(r.sides.length===0)return;let i=o.x===0&&o.y===0&&o.z===0&&n.x===0&&n.y===0&&n.z===0,a=-1,d=1,u=null,m=null,c=!1,f=!1;for(let p of r.sides){let{plane:y}=p,T=y.dist;if(!i){let N=y.normal.x<0?n.x:o.x,C=y.normal.y<0?n.y:o.y,b=y.normal.z<0?n.z:o.z;T-=y.normal.x*N+y.normal.y*C+y.normal.z*b}let S=t.x*y.normal.x+t.y*y.normal.y+t.z*y.normal.z-T,V=e.x*y.normal.x+e.y*y.normal.y+e.z*y.normal.z-T;if(V>0&&(c=!0),S>0&&(f=!0),S>0&&V>=S)return;if(!(S<=0&&V<=0))if(S>V){let N=(S-J)/(S-V);N>a&&(a=N,u=y,m=p)}else{let N=(S+J)/(S-V);N<d&&(d=N)}}if(!f){s.startsolid=!0,c||(s.allsolid=!0),s.fraction=0;return}a<d&&a>-1&&a<s.fraction&&(s.fraction=a<0?0:a,s.plane=u,s.contents=r.contents,s.surfaceFlags=m?.surfaceFlags??0)}function ge(){return{fraction:1,plane:null,contents:0,surfaceFlags:0,startsolid:!1,allsolid:!1}}function je(t,e,o){let n=o;for(;n>=0;){let r=e.nodes[n];n=Q(r.plane,t)>=0?r.children[0]:r.children[1]}return-1-n}function _t(t,e,o){let n=t.leaves[e],r=n.contents,s=Ye(),i=n.firstLeafBrush,a=i+n.numLeafBrushes;for(let d=i;d<a;d+=1){let u=t.leafBrushes[d],m=t.brushes[u];m.checkcount!==s&&(m.checkcount=s,m.sides.length!==0&&Pt(o,m)&&(r|=m.contents))}return r}function Ye(){let t=Ee;return Ee+=1,Ee>=Zo&&(Ee=1),t}function en(t,e){return t.x===0&&t.y===0&&t.z===0&&e.x===0&&e.y===0&&e.z===0}function tn(t,e,o){return en(e,o)?0:t.normal.x*(t.normal.x<0?o.x:e.x)+t.normal.y*(t.normal.y<0?o.y:e.y)+t.normal.z*(t.normal.z<0?o.z:e.z)}function Nt(t,e,o){return Math.abs(tn(t,e,o))}function Ge(t,e,o){return A(t,E(Z(e,t),o))}function He(t,e,o){let n=t.allsolid?0:t.fraction,r=Ge(e,o,n);return{fraction:n,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 Re(t,e,o){let n=je(t,e,o);return e.leaves[n]?.cluster??-1}function At(t,e,o,n){if(!t||t.numClusters===0)return!0;if(e<0||o<0||e>=t.clusters.length||o>=t.numClusters)return!1;let r=t.clusters[e],i=(n?r.phs:r.pvs)[o>>3];return i===void 0?!1:(i&1<<(o&7))!==0}function pe(t){let{model:e,nodeIndex:o,startFraction:n,endFraction:r,start:s,end:i,traceStart:a,traceEnd:d,mins:u,maxs:m,contentMask:c,trace:f,brushCheckCount:p}=t;if(f.fraction<=n)return;if(o<0){G&&G.leafsReached++;let M=-1-o,_=e.leaves[M],I=_.firstLeafBrush,X=I+_.numLeafBrushes;for(let w=I;w<X;w+=1){let k=e.leafBrushes[w],z=e.brushes[k];if((z.contents&c)!==0&&z.sides.length&&z.checkcount!==p&&(z.checkcount=p,G&&G.brushesTested++,Je({start:a,end:d,mins:u,maxs:m,brush:z,trace:f}),f.allsolid))return}return}G&&G.nodesTraversed++;let y=e.nodes[o],T=y.plane,S=Nt(T,u,m),V=Q(T,s),N=Q(T,i);if(V>=S&&N>=S){pe({model:e,nodeIndex:y.children[0],startFraction:n,endFraction:r,start:s,end:i,traceStart:a,traceEnd:d,mins:u,maxs:m,contentMask:c,trace:f,brushCheckCount:p});return}if(V<-S&&N<-S){pe({model:e,nodeIndex:y.children[1],startFraction:n,endFraction:r,start:s,end:i,traceStart:a,traceEnd:d,mins:u,maxs:m,contentMask:c,trace:f,brushCheckCount:p});return}let C=0,b=1/(V-N),x,P;V<N?(C=1,P=(V+S+J)*b,x=(V-S+J)*b):(C=0,P=(V-S-J)*b,x=(V+S+J)*b),x<0?x=0:x>1&&(x=1),P<0?P=0:P>1&&(P=1);let h=n+(r-n)*x,v=Ge(s,i,x);if(pe({model:e,nodeIndex:y.children[C],startFraction:n,endFraction:h,start:s,end:v,traceStart:a,traceEnd:d,mins:u,maxs:m,contentMask:c,trace:f,brushCheckCount:p}),f.fraction<=h)return;let U=n+(r-n)*P,g=Ge(s,i,P);pe({model:e,nodeIndex:y.children[1-C],startFraction:U,endFraction:r,start:g,end:i,traceStart:a,traceEnd:d,mins:u,maxs:m,contentMask:c,trace:f,brushCheckCount:p})}function Et(t){let{model:e,start:o,end:n}=t,r=t.mins??R,s=t.maxs??R,i=t.contentMask??4294967295,a=t.headnode??0,d=ge(),u=Ye();return pe({model:e,nodeIndex:a,startFraction:0,endFraction:1,start:o,end:n,traceStart:o,traceEnd:n,mins:r,maxs:s,contentMask:i,trace:d,brushCheckCount:u}),He(d,o,n)}function on(t,e,o=0){let n=je(t,e,o);return _t(e,n,t)}function nn(t,e,o=0){let n=new Map;return t.map(r=>{let s=je(r,e,o),i=e.leaves[s];if(i.numLeafBrushes===0){let a=n.get(s);return a!==void 0?a:(n.set(s,i.contents),i.contents)}return _t(e,s,r)})}function rn(t,e,o,n,r=0){let s=Ye(),i=0;function a(d){if(d<0){G&&G.leafsReached++;let p=-1-d,y=n.leaves[p];i|=y.contents;let T=y.firstLeafBrush,S=T+y.numLeafBrushes;for(let V=T;V<S;V+=1){let N=n.leafBrushes[V],C=n.brushes[N];if(C.checkcount===s||(C.checkcount=s,C.sides.length===0))continue;let b=Ct(t,e,o,C);b.startsolid&&(i|=b.contents)}return}let u=n.nodes[d],m=u.plane,c=Nt(m,e,o),f=Q(m,t);if(c===0){a(f>=0?u.children[0]:u.children[1]);return}if(f>c){a(u.children[0]);return}if(f<-c){a(u.children[1]);return}a(u.children[0]),a(u.children[1])}return a(r),i}function sn(t,e,o,n=0){let{visibility:r}=o;if(!r)return!0;let s=Re(t,o,n),i=Re(e,o,n);return At(r,s,i,!1)}function an(t,e,o,n=0){let{visibility:r}=o;if(!r)return!0;let s=Re(t,o,n),i=Re(e,o,n);return At(r,s,i,!0)}function se(t,e,o){return{normal:t,dist:e,type:o,signbits:Xe(t)}}function cn(t){let e=t.surfaceFlags??0,o=t.origin.x+t.maxs.x,n=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,u=[se({x:1,y:0,z:0},o,0),se({x:-1,y:0,z:0},-n,0),se({x:0,y:1,z:0},r,1),se({x:0,y:-1,z:0},-s,1),se({x:0,y:0,z:1},i,2),se({x:0,y:0,z:-1},-a,2)].map(m=>({plane:m,surfaceFlags:e}));return{contents:t.contents,sides:u,checkcount:0}}function ln(t){let e=cn(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 un(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 dn(t,e){return e.allsolid&&!t.allsolid||e.startsolid&&!t.startsolid?!0:e.fraction<t.fraction}var Ke=class{constructor(){this.entities=new Map;this.entityNodes=new Map;this.rootNode=Ae()}link(e){let o=ln(e);this.entities.set(e.id,o);let n=this.entityNodes.get(e.id);n&&n.items.delete(e.id);let r=Vt(this.rootNode,e.id,o.bounds.mins,o.bounds.maxs);this.entityNodes.set(e.id,r)}unlink(e){this.entities.delete(e);let o=this.entityNodes.get(e);o&&(o.items.delete(e),this.entityNodes.delete(e))}trace(e){let{passId:o}=e,n=e.mins??R,r=e.maxs??R,s=e.contentMask??4294967295,i,a=null;e.model?i=Et(e):i=He(ge(),e.start,e.end);let d={x:Math.min(e.start.x,e.end.x)+n.x,y:Math.min(e.start.y,e.end.y)+n.y,z:Math.min(e.start.z,e.end.z)+n.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},m=new Set;fe(this.rootNode,d,u,m);for(let c of m){if(c===o)continue;let f=this.entities.get(c);if(!f||(f.contents&s)===0)continue;let p=ge();if(Je({start:e.start,end:e.end,mins:n,maxs:r,brush:f.brush,trace:p}),p.contents===0&&(p.contents=f.contents),p.startsolid||p.allsolid||p.fraction<i.fraction){let y=He(p,e.start,e.end);dn(i,y)&&(i=y,a=f.id)}}return{...i,entityId:a}}gatherTriggerTouches(e,o,n,r=1073741824){let s=[],i={mins:A(e,o),maxs:A(e,n)},a=new Set;fe(this.rootNode,i.mins,i.maxs,a);for(let d of a){let u=this.entities.get(d);u&&(u.contents&r)!==0&&un(i,u.bounds)&&s.push(u.id)}return s}};var gt=(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))(gt||{});var vi=1024,Oi=80,zi=512,Fi=64,Li=128,mn=256,Mi=8192,fn=256,pn=8192,yn=2048,xn=512,hn=256,Sn=512,bn=256,Ze=32,wi=96,Di=64,ie=(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.AirAccel=59]="AirAccel",h[h.MaxClients=60]="MaxClients",h[h.MapChecksum=61]="MapChecksum",h[h.Models=62]="Models",h[h.Sounds=62+pn]="Sounds",h[h.Images=h.Sounds+yn]="Images",h[h.Lights=h.Images+xn]="Lights",h[h.ShadowLights=h.Lights+fn]="ShadowLights",h[h.Items=h.ShadowLights+bn]="Items",h[h.PlayerSkins=h.Items+hn]="PlayerSkins",h[h.General=h.PlayerSkins+mn]="General",h[h.WheelWeapons=h.General+Sn]="WheelWeapons",h[h.WheelAmmo=h.WheelWeapons+Ze]="WheelAmmo",h[h.WheelPowerups=h.WheelAmmo+Ze]="WheelPowerups",h[h.CdLoopCount=h.WheelPowerups+Ze]="CdLoopCount",h[h.GameStyle=h.CdLoopCount+1]="GameStyle",h[h.MaxConfigStrings=h.GameStyle+1]="MaxConfigStrings",h))(ie||{}),Vn=ie.MaxConfigStrings;function Tn(t){return t>=5&&t<59?96*(59-t):t>=ie.General&&t<ie.WheelWeapons?96*(ie.MaxConfigStrings-t):96}var qe={};Ie(qe,{addReplayFrame:()=>Nn,createReplaySession:()=>_n,deserializeReplay:()=>Cn,serializeReplay:()=>Pn});function Pn(t){return JSON.stringify(t,null,2)}function Cn(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 _n(t,e){return{metadata:{map:t,date:new Date().toISOString(),version:"1.0",seed:e},frames:[]}}function Nn(t,e,o,n){t.frames.push({serverFrame:o,cmd:e,timestamp:Date.now()-n})}function An(t){return t??{}}function Rt(t,e,o={}){let n=An(t),r=[],s=[];for(let a of e){if(!(a in n)){r.push(a);continue}typeof n[a]!="function"&&s.push(a)}let i=o.allowExtra===!1?Object.keys(n).filter(a=>!e.includes(a)):[];return{missing:r,nonFunctions:s,extras:i}}function En(t,e,o={}){let{missing:n,nonFunctions:r,extras:s}=Rt(t,e,o);if(n.length===0&&r.length===0&&s.length===0)return;let i=[];n.length>0&&i.push(`missing: ${n.join(", ")}`),r.length>0&&i.push(`non-functions: ${r.join(", ")}`),s.length>0&&i.push(`extras: ${s.join(", ")}`);let a=o.name??"contract";throw new Error(`${a} validation failed (${i.join("; ")})`)}var gn=["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"],Rn=["PreInit","Init","Shutdown","SpawnEntities","WriteGameJson","ReadGameJson","WriteLevelJson","ReadLevelJson","CanSave","ClientConnect","ClientThink","RunFrame","Pmove"],vn=["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"],On=["Init","Shutdown","DrawHUD","TouchPics","LayoutFlags","GetActiveWeaponWheelWeapon","GetOwnedWeaponWheelWeapons","GetWeaponWheelAmmoCount","GetPowerupWheelCount","GetHitMarkerDamage","Pmove","ParseConfigString","ParseCenterPrint","ClearNotify","ClearCenterprint","NotifyMessage","GetMonsterFlashOffset"];var ae=(r=>(r[r.None=0]="None",r[r.Feet=1]="Feet",r[r.Waist=2]="Waist",r[r.Under=3]="Under",r))(ae||{});function $e(t){return t>=2}function zn(t){return t===3}var ee=(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))(ee||{});function L(t,e){return(t&e)!==0}function W(t,e){return t|e}function H(t,e){return t&~e}var ce=(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))(ce||{}),te=(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))(te||{});function Qe(t){let{velocity:e,frametime:o,onGround:n,groundIsSlick:r,onLadder:s,waterlevel:i,pmFriction:a,pmStopSpeed:d,pmWaterFriction:u}=t,m=D(e);if(m<1)return{x:0,y:0,z:e.z};let c=0;if(n&&!r||s){let y=m<d?d:m;c+=y*a*o}i>0&&!s&&(c+=m*u*i*o);let f=m-c;if(f<0&&(f=0),f===m)return e;let p=f/m;return E(e,p)}function K(t){let{velocity:e,wishdir:o,wishspeed:n,accel:r,frametime:s}=t,i=F(e,o),a=n-i;if(a<=0)return e;let d=r*s*n;return d>a&&(d=a),{x:e.x+o.x*d,y:e.y+o.y*d,z:e.z+o.z*d}}function et(t){let{velocity:e,wishdir:o,wishspeed:n,accel:r,frametime:s}=t,i=Math.min(n,30),a=F(e,o),d=i-a;if(d<=0)return e;let u=r*n*s;return u>d&&(u=d),{x:e.x+o.x*u,y:e.y+o.y*u,z:e.z+o.z*u}}function Fn(t,e){let o=Math.abs(t.forwardmove),n=Math.abs(t.sidemove),r=Math.abs(t.upmove),s=Math.max(o,n,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 tt(t){let{forward:e,right:o,cmd:n,maxSpeed:r}=t,s={x:e.x*n.forwardmove+o.x*n.sidemove,y:e.y*n.forwardmove+o.y*n.sidemove,z:0},i=D(s);if(i>r){let a=r/i;s=E(s,a),i=r}return{wishdir:i===0?s:O(s),wishspeed:i}}function ot(t){let{forward:e,right:o,cmd:n,maxSpeed:r}=t,s={x:e.x*n.forwardmove+o.x*n.sidemove,y:e.y*n.forwardmove+o.y*n.sidemove,z:0};n.upmove>10?s=A(s,{x:0,y:0,z:n.upmove}):n.upmove<-10?s=A(s,{x:0,y:0,z:n.upmove}):s=A(s,{x:0,y:0,z:10});let i=D(s);if(i>r){let a=r/i;s=E(s,a),i=r}return i*=.5,{wishdir:i===0?s:O(s),wishspeed:i}}var vt=5,Ln=4,Mn=18,wn=.7,Ot=1,zt=2;function Ft(t,e,o,n=vt,r=t){if(e.length===0)return{velocity:t,planes:[],stopped:!1};let s=[],i=t;for(let d of e){if(s.length>=n)return{velocity:R,planes:s,stopped:!0};if(s.find(f=>F(f,d)>.99))continue;s.push(d);let m,c=0;for(;c<s.length;c++){let f=$(i,s[c],o),p=0;for(;p<s.length&&!(p!==c&&F(f,s[p])<0);p++);if(p===s.length){m=f;break}}if(m)i=m;else{if(s.length!==2)return{velocity:R,planes:s,stopped:!0};let f=q(s[0],s[1]),p=F(f,i);i=E(f,p)}if(F(i,r)<=0)return{velocity:R,planes:s,stopped:!0}}let a=i.x===0&&i.y===0&&i.z===0;return{velocity:i,planes:s,stopped:a}}function nt(t){let{origin:e,velocity:o,frametime:n,overbounce:r,trace:s,maxBumps:i=Ln,maxClipPlanes:a=vt,mins:d,maxs:u,hasTime:m=!1}=t,c=e,f=o,p=[],y=o,T=n,S=0;for(let N=0;N<i&&!(f.x===0&&f.y===0&&f.z===0);N++){let C=A(c,E(f,T)),b=s(c,C,d,u);if(b.allsolid){let P=m?y:R;return{origin:b.endpos,velocity:P,planes:p,stopped:!0,blocked:S}}if(b.startsolid){let P=m?y:R;return{origin:b.endpos,velocity:P,planes:p,stopped:!0,blocked:S}}if(b.fraction>0&&(c=b.endpos),b.fraction===1)break;if(!b.planeNormal)return{origin:c,velocity:m?y:R,planes:p,stopped:!0,blocked:S};b.planeNormal.z>.7&&(S|=Ot),b.planeNormal.z===0&&(S|=zt),p.push(b.planeNormal),T-=T*b.fraction;let x=Ft(f,p,r,a,y);if(f=x.velocity,p.splice(0,p.length,...x.planes),y.z>0&&f.z<0&&(f={...f,z:0}),x.stopped)return{origin:c,velocity:m?y:f,planes:p,stopped:!0,blocked:S}}let V=m?y:f;return{origin:c,velocity:V,planes:p,stopped:V.x===0&&V.y===0&&V.z===0,blocked:S}}function oe(t){let{mins:e,maxs:o,stepSize:n=Mn,...r}=t,s=t.origin,i=t.velocity,a=nt({...r,mins:e,maxs:o}),d=A(s,{x:0,y:0,z:n}),u=r.trace(s,d,e,o);if(u.allsolid)return{...a,stepped:!1,stepHeight:0};let m=u.endpos.z-s.z,c=nt({...r,origin:u.endpos,velocity:i,mins:e,maxs:o}),f=A(c.origin,{x:0,y:0,z:-m}),p=r.trace(c.origin,f,e,o),y=c.origin,T=p.planeNormal;p.allsolid||(y=p.endpos);let S=(P,h)=>(P.x-h.x)**2+(P.y-h.y)**2,V=S(a.origin,s),N=S(y,s);if(V>N||T&&T.z<wn)return{...a,stepped:!1,stepHeight:0};let C={...c.velocity,z:a.velocity.z},b=c.blocked,x=C.x===0&&C.y===0&&C.z===0;return{origin:y,velocity:C,planes:c.planes,blocked:b,stopped:x,stepped:!0,stepHeight:m,stepNormal:T}}var le=["x","y","z"],rt=[{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]}],Lt={x:0,y:0,z:0};function ue(t){return{x:t.x,y:t.y,z:t.z}}function Dn(t){return{x:t[0],y:t[1],z:t[2]}}function ye(t,e,o){if(o!==0)switch(e){case"x":t.x+=o;break;case"y":t.y+=o;break;case"z":t.z+=o;break}}function Mt(t,e,o){switch(e){case"x":t.x=o;break;case"y":t.y=o;break;case"z":t.z=o;break}}function ve(t,e){switch(e){case"x":return t.x;case"y":return t.y;case"z":default:return t.z}}function wt(t,e,o,n){return t===-1?ve(o,e):t===1?ve(n,e):0}function Dt(t,e,o,n){let r=ue(t);for(let s=0;s<le.length;s++){let i=le[s],a=e.normal[s];a<0?ye(r,i,ve(o,i)):a>0&&ye(r,i,ve(n,i))}return r}function In(t,e,o){let n=ue(Lt),r=ue(Lt);for(let s=0;s<le.length;s++){let i=le[s];Mt(n,i,wt(t.mins[s],i,e,o)),Mt(r,i,wt(t.maxs[s],i,e,o))}return{mins:n,maxs:r}}function Wn(t,e,o){if(!e||o===0)return t;let n=ue(t);return ye(n,e,o),n}function Bn(t,e,o){if(!e||o===0)return t;switch(e){case"x":return{...t,x:t.x+o};case"y":return{...t,y:t.y+o};case"z":default:return{...t,z:t.z+o}}}function st(t){let{origin:e,mins:o,maxs:n,trace:r}=t;if(!r(e,o,n,e).startsolid)return{result:"good-position",origin:{...e}};let i=[];for(let a=0;a<rt.length;a++){let d=rt[a],{mins:u,maxs:m}=In(d,o,n),c=Dt(e,d,o,n),f=r(c,u,m,c),p,y=0;if(f.startsolid)for(let P=0;P<le.length;P++){if(d.normal[P]!==0)continue;let h=le[P],v=ue(c);if(ye(v,h,1),f=r(v,u,m,v),!f.startsolid){c=v,p=h,y=1;break}if(v=ue(c),ye(v,h,-1),f=r(v,u,m,v),!f.startsolid){c=v,p=h,y=-1;break}}if(f.startsolid)continue;let T=rt[a^1],S=Dt(e,T,o,n);if(S=Wn(S,p,y),f=r(c,u,m,S),f.startsolid)continue;let V=Dn(d.normal),N=A(f.endpos??S,E(V,.125)),C=Z(N,S),b=A(e,C);b=Bn(b,p,y),!r(b,o,n,b).startsolid&&i.push({origin:b,distance:ne(C)})}return i.length===0?{result:"no-good-position",origin:{...e}}:(i.sort((a,d)=>a.distance-d.distance),{result:"fixed",origin:{...i[0].origin}})}var Un=100,it=200,It=150,Oe=25,kn=15,Gn=1,Hn={x:0,y:0,z:1},Kn=(t,e)=>({fraction:1,endpos:e,allsolid:!1,startsolid:!1});function at(t){let e=0,o=0,n=0;return t&262144&&(e+=1),t&524288&&(o+=1),t&1048576&&(e-=1),t&2097152&&(o-=1),t&4194304&&(n+=1),t&8388608&&(n-=1),e===0&&o===0&&n===0?R:{x:e,y:o,z:n}}function Ut(t){let{watertype:e,waterlevel:o,onGround:n,waterSpeed:r}=t;if((e&16515072)===0)return R;let s=at(e);if(s===R)return R;let i=r;return o===1&&n&&(i*=.5),E(s,i)}function kt(t){let{groundContents:e,scale:o=Un}=t,n=at(e);return n===R?R:E(n,o)}function ze(t){let{wishVelocity:e,onLadder:o,onGround:n,waterlevel:r,watertype:s,groundContents:i,cmd:a,viewPitch:d,maxSpeed:u,ladderMod:m,waterSpeed:c,forward:f,origin:p,mins:y,maxs:T,trace:S=Kn}=t,V=e;o&&(V=Xn({wishVelocity:V,cmd:a,waterlevel:r,viewPitch:d,maxSpeed:u,ladderMod:m,onGround:n,forward:f,origin:p,mins:y,maxs:T,trace:S}));let N=Ut({watertype:s,waterlevel:r,onGround:n,waterSpeed:c});if(N!==R&&(V=A(V,N)),n){let C=kt({groundContents:i});C!==R&&(V=A(V,C))}return V}function Xn(t){let{wishVelocity:e,cmd:o,waterlevel:n,viewPitch:r,maxSpeed:s,ladderMod:i,onGround:a,forward:d,origin:u,mins:m,maxs:c,trace:f}=t,p=o.buttons??0,y={...e};if((p&24)!==0){let T=$e(n)?s:it;y={...y,z:p&8?T:-T}}else if(o.forwardmove){let T=Wt(o.forwardmove,-it,it);if(o.forwardmove>0){let S=r<kn?T:-T;y={...y,z:S}}else a||(y={...y,x:0,y:0}),y={...y,z:T}}else y={...y,z:0};if(!a)if(o.sidemove){let T=Wt(o.sidemove,-It,It);n<2&&(T*=i);let S=O({x:d.x,y:d.y,z:0});if(S.x!==0||S.y!==0){let V=A(u,E(S,Gn)),N=f(u,V,m,c);if(N.fraction!==1&&!N.allsolid&&N.contents!==void 0&&(N.contents&536870912)!==0&&N.planeNormal){let C=q(N.planeNormal,Hn);y={...y,x:0,y:0},y=A(y,E(C,-T))}}}else y={...y,x:Bt(y.x),y:Bt(y.y)};return y}function Wt(t,e,o){return Math.max(e,Math.min(o,t))}function Bt(t){return t<-Oe?-Oe:t>Oe?Oe:t}var Jn=1.5,Gt=.5,jn=1.01;function Yn(t){let{origin:e,cmd:o,frametime:n,pmFriction:r,pmStopSpeed:s,pmMaxSpeed:i,pmAccelerate:a,pmWaterSpeed:d,doclip:u,forward:m,right:c,mins:f,maxs:p,trace:y,overbounce:T=jn,stepSize:S,maxBumps:V,maxClipPlanes:N}=t,C=Zn({velocity:t.velocity,pmFriction:r,pmStopSpeed:s,frametime:n}),b=qn({cmd:o,forward:m,right:c,pmMaxSpeed:i,pmWaterSpeed:d});if(b.wishspeed>0&&(C=K({velocity:C,wishdir:b.wishdir,wishspeed:b.accelSpeed,accel:a,frametime:n})),!u){let x=E(C,n);return{origin:A(e,x),velocity:C,planes:[],blocked:0,stopped:C.x===0&&C.y===0&&C.z===0,stepped:!1,stepHeight:0}}if(!y||!f||!p)throw new Error("applyPmoveFlyMove: doclip=true requires trace/mins/maxs");return oe({origin:e,velocity:C,frametime:n,overbounce:T,trace:y,mins:f,maxs:p,stepSize:S,maxBumps:V,maxClipPlanes:N})}function Zn(t){let{velocity:e,pmFriction:o,pmStopSpeed:n,frametime:r}=t,s=D(e);if(s<1)return{x:0,y:0,z:0};let i=o*Jn,d=(s<n?n:s)*i*r,u=s-d;return u<0&&(u=0),u===s?e:E(e,u/s)}function qn(t){let{cmd:e,forward:o,right:n,pmMaxSpeed:r,pmWaterSpeed:s}=t,i=O(o),a=O(n),u={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},m=e.buttons??0;m&8&&(u=A(u,{x:0,y:0,z:s*Gt})),m&16&&(u=A(u,{x:0,y:0,z:-s*Gt}));let c=D(u),f=c===0?{x:0,y:0,z:0}:O(u);if(c>r){let y=r/c;u=E(u,y),c=r,f=c===0?{x:0,y:0,z:0}:O(u)}let p=c*2;return{wishdir:f,wishspeed:c,accelSpeed:p}}function xe(t){let{origin:e,mins:o,viewheight:n,pointContents:r}=t,s=n-o.z,i=s/2,a={x:e.x,y:e.y,z:e.z+o.z+1},d=r(a);if((d&56)===0)return{waterlevel:0,watertype:0};let u=d,m=1,c={x:a.x,y:a.y,z:e.z+o.z+i};if(d=r(c),(d&56)!==0){m=2;let f={x:a.x,y:a.y,z:e.z+o.z+s};d=r(f),(d&56)!==0&&(m=3)}return{waterlevel:m,watertype:u}}var $n=270;function Qn(t,e){return(t&e)!==0}function er(t){let{pmFlags:e,pmType:o,buttons:n,waterlevel:r,onGround:s,velocity:i,jumpHeight:a=$n}=t;if(e&16)return{pmFlags:e,onGround:s,velocity:i,jumpSound:!1,jumped:!1};let d=Qn(n,8),u=e,m=s,c=!1,f=!1,p=i;if(!d)return u=H(u,2),{pmFlags:u,onGround:m,velocity:p,jumpSound:c,jumped:f};if(tr(u))return{pmFlags:u,onGround:m,velocity:p,jumpSound:c,jumped:f};if(o===4)return{pmFlags:u,onGround:m,velocity:p,jumpSound:c,jumped:f};if(r>=2)return m=!1,{pmFlags:u,onGround:m,velocity:p,jumpSound:c,jumped:f};if(!m)return{pmFlags:u,onGround:m,velocity:p,jumpSound:c,jumped:f};u=W(u,2),u=H(u,4),m=!1,c=!0,f=!0;let y=i.z+a,T=y<a?a:y;return p={...i,z:T},{pmFlags:u,onGround:m,velocity:p,jumpSound:c,jumped:f}}function tr(t){return(t&2)!==0}function Fe(t,e,o){return{x:t,y:e,z:o}}function Le(t,e){let o=Fe(-16,-16,0),n=Fe(16,16,16);if(t===5)return{mins:o,maxs:n,viewheight:8};let r=t===4||(e&1)!==0,s=Fe(o.x,o.y,-24),i=Fe(n.x,n.y,r?4:32);return{mins:s,maxs:i,viewheight:r?-2:22}}var or=4,nr=32,rr=8;function sr(t){let{pmType:e}=t;if(e===5){let i=Le(e,t.pmFlags);return{pmFlags:t.pmFlags,ducked:L(t.pmFlags,1),changed:!1,...i}}let o=t.pmFlags,n=!1;e===4?L(o,1)||(o=W(o,1),n=!0):ir(t)?!L(o,1)&&!ar(t)&&(o=W(o,1),n=!0):L(o,1)&&!cr(t)&&(o=H(o,1),n=!0);let r=Le(e,o),s=e===4||L(o,1);return{pmFlags:o,ducked:s,changed:n,...r}}function ir(t){return(t.buttons&16)===0||t.onLadder||t.n64Physics?!1:!!(t.hasGroundEntity||t.waterlevel<=1&&!lr(t))}function ar(t){return t.trace({start:t.origin,end:t.origin,mins:t.mins,maxs:Ht(t.maxs,or),mask:3}).allsolid}function cr(t){return t.trace({start:t.origin,end:t.origin,mins:t.mins,maxs:Ht(t.maxs,nr),mask:3}).allsolid}function lr(t){let e={x:t.origin.x,y:t.origin.y,z:t.origin.z-rr};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 Ht(t,e){return{x:t.x,y:t.y,z:e}}var ur=.25,dr=180,mr=100,fr=.7,pr=.9,yr=64,xr=128,hr=1.01,Sr=1080;function br(t){let{pmType:e,n64Physics:o,velocity:n,startVelocity:r,origin:s,mins:i,maxs:a,viewheight:d,trace:u,pointContents:m}=t,c=t.pmFlags,f=t.pmTime,p,y=L(c,4),T,S=0;if(n.z>dr||e===1)c=H(c,4),y=!1;else{let b={x:s.x,y:s.y,z:s.z-ur},x=u(s,b,i,a);T=x,S=x.contents??0;let P=x.planeNormal,h=x.fraction<1&&!!P&&P.z<fr;if(h&&P){let v=A(s,P),B=u(s,v,i,a);B.fraction<1&&!B.startsolid&&(h=!1)}if(x.fraction===1||!P||h&&!x.startsolid)c=H(c,4),y=!1;else{y=!0,L(c,8)&&(c&=~Sr,f=0);let v=L(c,4);if(!v){!o&&n.z>=mr&&P.z>=pr&&!L(c,1)&&(c=W(c,1024),f=yr);let B=$(n,P,hr);p=r.z-B.z}c=W(c,4),!v&&(o||L(c,1))&&(c=W(c,16),f=xr)}}let{waterlevel:N,watertype:C}=xe({origin:s,mins:i,viewheight:d,pointContents:m});return{pmFlags:c,pmTime:f,onGround:L(c,4),groundTrace:T,groundContents:S,waterlevel:N,watertype:C,impactDelta:p}}var Kt=1,Vr=60,ct=1.01;function Tr(t){let{origin:e,frametime:o,mins:n,maxs:r,trace:s,overbounce:i=ct,stepSize:a,maxBumps:d,maxClipPlanes:u,hasTime:m,forward:c,right:f,cmd:p,pmFlags:y,onGround:T,gravity:S,pmType:V,pmAccelerate:N,pmAirAccelerate:C=Kt,pmMaxSpeed:b,pmDuckSpeed:x,onLadder:P,waterlevel:h,watertype:v,groundContents:B,viewPitch:U,ladderMod:g,pmWaterSpeed:M}=t,_={...t.velocity},I=Cr(c,f,p);I=ze({wishVelocity:I,onLadder:P,onGround:T,waterlevel:h,watertype:v,groundContents:B,cmd:p,viewPitch:U,maxSpeed:L(y,1)?x:b,ladderMod:g,waterSpeed:M,forward:c,origin:e,mins:n,maxs:r,trace:s});let w=L(y,1)?x:b,k=I,z=D(k);if(z!==0&&(k=O(k)),z>w){let j=w/z;I=E(I,j),z=w,z!==0&&(k=O(I))}return P?(_=K({velocity:_,wishdir:k,wishspeed:z,accel:N,frametime:o}),Math.abs(I.z)<Number.EPSILON&&(_=Ar(_,S,o)),Me({origin:e,velocity:_,frametime:o,mins:n,maxs:r,trace:s,overbounce:i,stepSize:a,maxBumps:d,maxClipPlanes:u,hasTime:m})):T?(_={..._,z:0},_=K({velocity:_,wishdir:k,wishspeed:z,accel:N,frametime:o}),S>0?_={..._,z:0}:_={..._,z:_.z-S*o},_.x===0&&_.y===0?{origin:e,velocity:_,planes:[],blocked:0,stopped:!0,stepped:!1,stepHeight:0}:Me({origin:e,velocity:_,frametime:o,mins:n,maxs:r,trace:s,overbounce:i,stepSize:a,maxBumps:d,maxClipPlanes:u,hasTime:m})):(C>0?_=et({velocity:_,wishdir:k,wishspeed:z,accel:C,frametime:o}):_=K({velocity:_,wishdir:k,wishspeed:z,accel:Kt,frametime:o}),V!==1&&(_={..._,z:_.z-S*o}),Me({origin:e,velocity:_,frametime:o,mins:n,maxs:r,trace:s,overbounce:i,stepSize:a,maxBumps:d,maxClipPlanes:u,hasTime:m}))}function Pr(t){let{origin:e,frametime:o,mins:n,maxs:r,trace:s,overbounce:i=ct,stepSize:a,maxBumps:d,maxClipPlanes:u,hasTime:m,forward:c,right:f,cmd:p,pmFlags:y,onGround:T,pmMaxSpeed:S,pmDuckSpeed:V,pmWaterAccelerate:N,pmWaterSpeed:C,onLadder:b,watertype:x,groundContents:P,waterlevel:h,viewPitch:v,ladderMod:B}=t,U={...t.velocity},g=_r(c,f,p);Nr(p,T)?g={...g,z:g.z-Vr}:Xt(p,16)?g=A(g,{x:0,y:0,z:-C*.5}):Xt(p,8)&&(g=A(g,{x:0,y:0,z:C*.5})),g=ze({wishVelocity:g,onLadder:b,onGround:T,waterlevel:h,watertype:x,groundContents:P,cmd:p,viewPitch:v,maxSpeed:L(y,1)?V:S,ladderMod:B,waterSpeed:C,forward:c,origin:e,mins:n,maxs:r,trace:s});let M=g,_=D(M);if(_!==0&&(M=O(M)),_>S){let X=S/_;g=E(g,X),_=S,_!==0&&(M=O(g))}if(_*=.5,L(y,1)&&_>V){let X=V/_;g=E(g,X),_=V,_!==0&&(M=O(g))}return U=K({velocity:U,wishdir:M,wishspeed:_,accel:N,frametime:o}),Me({origin:e,velocity:U,frametime:o,mins:n,maxs:r,trace:s,overbounce:i,stepSize:a,maxBumps:d,maxClipPlanes:u,hasTime:m})}function Cr(t,e,o){return{x:t.x*o.forwardmove+e.x*o.sidemove,y:t.y*o.forwardmove+e.y*o.sidemove,z:0}}function _r(t,e,o){return{x:t.x*o.forwardmove+e.x*o.sidemove,y:t.y*o.forwardmove+e.y*o.sidemove,z:t.z*o.forwardmove+e.z*o.sidemove}}function Xt(t,e){return!!((t.buttons??0)&e)}function Nr(t,e){let o=t.forwardmove===0&&t.sidemove===0,n=!((t.buttons??0)&24);return o&&n&&!e}function Ar(t,e,o){let n=t.z,r=e*o;return n>0?(n-=r,n<0&&(n=0)):(n+=r,n>0&&(n=0)),{...t,z:n}}function Me(t){let{origin:e,velocity:o,frametime:n,mins:r,maxs:s,trace:i,overbounce:a=ct,stepSize:d,maxBumps:u,maxClipPlanes:m,hasTime:c}=t;return oe({origin:e,velocity:o,frametime:n,trace:i,mins:r,maxs:s,overbounce:a,stepSize:d,maxBumps:u,maxClipPlanes:m,hasTime:c})}var Er=1,gr=40,we=50,Jt=350,Rr=2048,jt=.1,vr=800,Or=50,Yt=.7,zr=18,Fr=1.01,Lr=2;function Mr(t){let{pmFlags:e,pmTime:o,waterlevel:n,watertype:r,gravity:s,cmd:i,forward:a,origin:d,velocity:u,mins:m,maxs:c,viewheight:f,trace:p,pointContents:y,onGround:T,overbounce:S=Fr,stepSize:V=zr,maxBumps:N,maxClipPlanes:C}=t;if(o>0)return{pmFlags:e,pmTime:o,velocity:u,performedWaterJump:!1};let b=H(e,128),x=o,P=u,h=O({x:a.x,y:a.y,z:0}),v=ne(h)>0;if(n<2&&v){let z=A(d,E(h,Er)),j=p(d,z,m,c),Qt=j.contents??0;j.fraction<1&&(Qt&536870912)!==0&&(b=W(b,128))}if(s===0)return{pmFlags:b,pmTime:x,velocity:P,performedWaterJump:!1};if(((i.buttons??0)&8)===0&&i.forwardmove<=0)return{pmFlags:b,pmTime:x,velocity:P,performedWaterJump:!1};if(n!==2)return{pmFlags:b,pmTime:x,velocity:P,performedWaterJump:!1};if((r&8192)!==0)return{pmFlags:b,pmTime:x,velocity:P,performedWaterJump:!1};if(!v)return{pmFlags:b,pmTime:x,velocity:P,performedWaterJump:!1};let B=A(d,E(h,gr)),U=p(d,B,m,c);if(U.fraction===1||!U.planeNormal||U.planeNormal.z>=Yt)return{pmFlags:b,pmTime:x,velocity:P,performedWaterJump:!1};let g={x:h.x*we,y:h.y*we,z:Jt},M=d,_=!0,I=wr(s);for(let z=0;z<I;z++){g={x:g.x,y:g.y,z:g.z-s*jt},g.z<0&&(_=!1);let j=oe({origin:M,velocity:g,frametime:jt,trace:p,mins:m,maxs:c,overbounce:S,stepSize:V,maxBumps:N,maxClipPlanes:C,hasTime:_});M=j.origin,g=j.velocity}let X=A(M,{x:0,y:0,z:-Lr}),w=p(M,X,m,c);return w.fraction===1||!w.planeNormal||w.planeNormal.z<Yt||w.endpos.z<d.z?{pmFlags:b,pmTime:x,velocity:P,performedWaterJump:!1}:T&&Math.abs(d.z-w.endpos.z)<=V?{pmFlags:b,pmTime:x,velocity:P,performedWaterJump:!1}:xe({origin:w.endpos,mins:m,viewheight:f,pointContents:y}).waterlevel>=2?{pmFlags:b,pmTime:x,velocity:P,performedWaterJump:!1}:(b=W(b,8),x=Rr,P={x:h.x*we,y:h.y*we,z:Jt},{pmFlags:b,pmTime:x,velocity:P,performedWaterJump:!0})}function wr(t){if(t===0)return 0;let e=Math.floor(10*(vr/t));return e<=0?0:Math.min(Or,e)}var lt=[0,-1,1];function ut(t){let{origin:e,mins:o,maxs:n,trace:r}=t;return!r(e,e,o,n).allsolid}function Dr(t){let{origin:e,velocity:o,mins:n,maxs:r,previousOrigin:s,trace:i}=t;if(ut({origin:e,mins:n,maxs:r,trace:i}))return{origin:{...e},velocity:{...o},resolution:"unchanged"};let a=st({origin:e,mins:n,maxs:r,trace:(d,u,m,c)=>i(d,c,u,m)});return a.result==="fixed"||a.result==="good-position"?{origin:a.origin,velocity:{...o},resolution:"fixed"}:{origin:{...s},velocity:{...o},resolution:"reverted"}}function Ir(t){let{origin:e,mins:o,maxs:n,trace:r}=t;for(let s of lt)for(let i of lt)for(let a of lt){let d={x:e.x+a,y:e.y+i,z:e.z+s};if(ut({origin:d,mins:o,maxs:n,trace:r}))return{origin:d,snapped:a!==0||i!==0||s!==0}}return{origin:{...e},snapped:!1}}function Wr(t,e){return{x:t.x+e.x,y:t.y+e.y,z:t.z+e.z}}function Br(t){return t>89&&t<180?89:t<271&&t>=180?271:t}function Ur(t){let{pmFlags:e,cmdAngles:o,deltaAngles:n}=t,r;(e&32)!==0?r={x:0,y:o.y+n.y,z:0}:(r=Wr(o,n),r={...r,x:Br(r.x)});let s=Ue(r);return{viewangles:r,...s}}var kr=200,Gr=200,Hr=200,Kr=140,Xr=150,Jr=3;function jr(t){let e=me(t);return e>89&&e<180?89:e<271&&e>=180?271:e}function Yr(t,e){return{x:jr(t.x+e.x),y:me(t.y+e.y),z:me(t.z+e.z)}}function Zr(t,e){let o=e.sensitivityX??e.sensitivity,n=(e.sensitivityY??e.sensitivity)*(e.invertY?-1:1);return{x:t.deltaY*n,y:t.deltaX*o,z:0}}var Zt=(x=>(x[x.bad=0]="bad",x[x.muzzleflash=1]="muzzleflash",x[x.muzzleflash2=2]="muzzleflash2",x[x.temp_entity=3]="temp_entity",x[x.layout=4]="layout",x[x.inventory=5]="inventory",x[x.nop=6]="nop",x[x.disconnect=7]="disconnect",x[x.reconnect=8]="reconnect",x[x.sound=9]="sound",x[x.print=10]="print",x[x.stufftext=11]="stufftext",x[x.serverdata=12]="serverdata",x[x.configstring=13]="configstring",x[x.spawnbaseline=14]="spawnbaseline",x[x.centerprint=15]="centerprint",x[x.download=16]="download",x[x.playerinfo=17]="playerinfo",x[x.packetentities=18]="packetentities",x[x.deltapacketentities=19]="deltapacketentities",x[x.frame=20]="frame",x))(Zt||{}),qt=(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))(qt||{});var $t=(l=>(l[l.GUNSHOT=0]="GUNSHOT",l[l.BLOOD=1]="BLOOD",l[l.BLASTER=2]="BLASTER",l[l.RAILTRAIL=3]="RAILTRAIL",l[l.SHOTGUN=4]="SHOTGUN",l[l.EXPLOSION1=5]="EXPLOSION1",l[l.EXPLOSION2=6]="EXPLOSION2",l[l.ROCKET_EXPLOSION=7]="ROCKET_EXPLOSION",l[l.GRENADE_EXPLOSION=8]="GRENADE_EXPLOSION",l[l.SPARKS=9]="SPARKS",l[l.SPLASH=10]="SPLASH",l[l.BUBBLETRAIL=11]="BUBBLETRAIL",l[l.SCREEN_SPARKS=12]="SCREEN_SPARKS",l[l.SHIELD_SPARKS=13]="SHIELD_SPARKS",l[l.BULLET_SPARKS=14]="BULLET_SPARKS",l[l.LASER_SPARKS=15]="LASER_SPARKS",l[l.PARASITE_ATTACK=16]="PARASITE_ATTACK",l[l.ROCKET_EXPLOSION_WATER=17]="ROCKET_EXPLOSION_WATER",l[l.GRENADE_EXPLOSION_WATER=18]="GRENADE_EXPLOSION_WATER",l[l.MEDIC_CABLE_ATTACK=19]="MEDIC_CABLE_ATTACK",l[l.BFG_EXPLOSION=20]="BFG_EXPLOSION",l[l.BFG_BIGEXPLOSION=21]="BFG_BIGEXPLOSION",l[l.BOSSTPORT=22]="BOSSTPORT",l[l.BFG_LASER=23]="BFG_LASER",l[l.GRAPPLE_CABLE=24]="GRAPPLE_CABLE",l[l.WELDING_SPARKS=25]="WELDING_SPARKS",l[l.GREENBLOOD=26]="GREENBLOOD",l[l.BLUEHYPERBLASTER=27]="BLUEHYPERBLASTER",l[l.PLASMA_EXPLOSION=28]="PLASMA_EXPLOSION",l[l.TUNNEL_SPARKS=29]="TUNNEL_SPARKS",l[l.BLASTER2=30]="BLASTER2",l[l.RAILTRAIL2=31]="RAILTRAIL2",l[l.FLAME=32]="FLAME",l[l.LIGHTNING=33]="LIGHTNING",l[l.DEBUGTRAIL=34]="DEBUGTRAIL",l[l.PLAIN_EXPLOSION=35]="PLAIN_EXPLOSION",l[l.FLASHLIGHT=36]="FLASHLIGHT",l[l.FORCEWALL=37]="FORCEWALL",l[l.HEATBEAM=38]="HEATBEAM",l[l.MONSTER_HEATBEAM=39]="MONSTER_HEATBEAM",l[l.STEAM=40]="STEAM",l[l.BUBBLETRAIL2=41]="BUBBLETRAIL2",l[l.MOREBLOOD=42]="MOREBLOOD",l[l.HEATBEAM_SPARKS=43]="HEATBEAM_SPARKS",l[l.HEATBEAM_STEAM=44]="HEATBEAM_STEAM",l[l.CHAINFIST_SMOKE=45]="CHAINFIST_SMOKE",l[l.ELECTRIC_SPARKS=46]="ELECTRIC_SPARKS",l[l.TRACKER_EXPLOSION=47]="TRACKER_EXPLOSION",l[l.TELEPORT_EFFECT=48]="TELEPORT_EFFECT",l[l.DBALL_GOAL=49]="DBALL_GOAL",l[l.WIDOWBEAMOUT=50]="WIDOWBEAMOUT",l[l.NUKEBLAST=51]="NUKEBLAST",l[l.WIDOWSPLASH=52]="WIDOWSPLASH",l[l.EXPLOSION1_BIG=53]="EXPLOSION1_BIG",l[l.EXPLOSION1_NP=54]="EXPLOSION1_NP",l[l.FLECHETTE=55]="FLECHETTE",l[l.BLUEHYPERBLASTER_KEX=56]="BLUEHYPERBLASTER_KEX",l[l.BFG_ZAP=57]="BFG_ZAP",l[l.BERSERK_SLAM=58]="BERSERK_SLAM",l[l.GRAPPLE_CABLE_2=59]="GRAPPLE_CABLE_2",l[l.POWER_SPLASH=60]="POWER_SPLASH",l[l.LIGHTNING_BEAM=61]="LIGHTNING_BEAM",l[l.EXPLOSION1_NL=62]="EXPLOSION1_NL",l[l.EXPLOSION2_NL=63]="EXPLOSION2_NL",l))($t||{});var qr=1024,$r=256,Qr=16,es=512,ts=1400;var dt={};Ie(dt,{U_ANGLE1:()=>cs,U_ANGLE2:()=>ls,U_ANGLE3:()=>us,U_EFFECTS:()=>fs,U_EVENT:()=>xs,U_FRAME:()=>ds,U_MODEL:()=>ns,U_MODEL2:()=>Ss,U_MODEL3:()=>bs,U_MODEL4:()=>Vs,U_MOREBITS:()=>hs,U_NUMBER:()=>os,U_ORIGIN1:()=>ss,U_ORIGIN2:()=>is,U_ORIGIN3:()=>as,U_REMOVE:()=>Ts,U_RENDERFX:()=>ps,U_SKIN:()=>ms,U_SOLID:()=>ys,U_SOUND:()=>rs});var os=1,ns=2,rs=4,ss=8,is=16,as=32,cs=64,ls=128,us=256,ds=512,ms=1024,fs=2048,ps=4096,ys=8192,xs=16384,hs=32768,Ss=1,bs=2,Vs=4,Ts=32768;var he=.025,Ps=(t,e)=>{let o={...t.origin};o.z-=.25;let n=e(t.origin,o);return{...t,onGround:n.fraction<1}},Cs=(t,e)=>{let o={...t.origin};return o.z+=t.mins.z+1,e(o)&33554432?{...t,waterLevel:1}:{...t,waterLevel:0}},_s=(t,e,o,n)=>{let r={...t};r=Ps(r,o),r=Cs(r,n);let{origin:s,velocity:i,onGround:a,waterLevel:d}=r,u=Qe({velocity:i,frametime:he,onGround:a,groundIsSlick:!1,onLadder:!1,waterlevel:d,pmFriction:6,pmStopSpeed:100,pmWaterFriction:1}),m=d>=2?ot({forward:{x:1,y:0,z:0},right:{x:0,y:1,z:0},cmd:e,maxSpeed:320}):tt({forward:{x:1,y:0,z:0},right:{x:0,y:1,z:0},cmd:e,maxSpeed:320}),c=K({velocity:u,wishdir:m.wishdir,wishspeed:m.wishspeed,accel:a?10:1,frametime:he}),f=o(s,{x:s.x+c.x*he,y:s.y+c.y*he,z:s.z+c.z*he});return{...r,origin:f.endpos,velocity:c}};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}readLong(){let e=this.view.getInt32(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 o=this.readChar();if(o===-1||o===0)break;e+=String.fromCharCode(o)}return e}readStringLine(){let e="";for(;this.offset<this.length;){let o=this.readChar();if(o===-1||o===0||o===10)break;e+=String.fromCharCode(o)}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 o=new Uint8Array(this.view.buffer,this.view.byteOffset+this.offset,e);return this.offset+=e,new Uint8Array(o)}readPos(e){e.x=this.readCoord(),e.y=this.readCoord(),e.z=this.readCoord()}readDir(e){let o=this.readByte();if(o>=162){e.x=0,e.y=0,e.z=0;return}let n=re[o];e.x=n[0],e.y=n[1],e.z=n[2]}};var ft=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 o=Math.max(this.buffer.byteLength*2,this.offset+e),n=new Uint8Array(o);n.set(this.buffer),this.buffer=n,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 o=e.length;this.ensureSpace(o+1);for(let n=0;n<o;n++)this.view.setUint8(this.offset+n,e.charCodeAt(n));this.view.setUint8(this.offset+o,0),this.offset+=o+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 o=-1,n=0;if(e.x===0&&e.y===0&&e.z===0){this.writeByte(0);return}for(let r=0;r<re.length;r++){let s=re[r],i=e.x*s[0]+e.y*s[1]+e.z*s[2];i>o&&(o=i,n=r)}this.writeByte(n)}getData(){return this.buffer.slice(0,this.offset)}getBuffer(){return this.buffer}getOffset(){return this.offset}reset(){this.offset=0}};return ro(Ns);})();
|
|
1
|
+
"use strict";var Quake2Shared=(()=>{var De=Object.defineProperty;var eo=Object.getOwnPropertyDescriptor;var to=Object.getOwnPropertyNames;var oo=Object.prototype.hasOwnProperty;var Ie=(t,e)=>{for(var o in e)De(t,o,{get:e[o],enumerable:!0})},no=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of to(e))!oo.call(t,r)&&r!==o&&De(t,r,{get:()=>e[r],enumerable:!(n=eo(e,r))||n.enumerable});return t};var ro=t=>no(De({},"__esModule",{value:!0}),t);var Ns={};Ie(Ns,{ANORMS:()=>re,BinaryStream:()=>mt,BinaryWriter:()=>ft,CGAME_EXPORT_KEYS:()=>vn,CGAME_IMPORT_KEYS:()=>On,CONTENTS_AREAPORTAL:()=>Us,CONTENTS_AUX:()=>Ms,CONTENTS_CURRENT_0:()=>Mo,CONTENTS_CURRENT_180:()=>Do,CONTENTS_CURRENT_270:()=>Io,CONTENTS_CURRENT_90:()=>wo,CONTENTS_CURRENT_DOWN:()=>Bo,CONTENTS_CURRENT_UP:()=>Wo,CONTENTS_DEADMONSTER:()=>Xs,CONTENTS_DETAIL:()=>Js,CONTENTS_LADDER:()=>bt,CONTENTS_LAVA:()=>ws,CONTENTS_MIST:()=>Ws,CONTENTS_MONSTER:()=>Ks,CONTENTS_MONSTERCLIP:()=>Gs,CONTENTS_NONE:()=>Ce,CONTENTS_NO_WATERJUMP:()=>Lo,CONTENTS_ORIGIN:()=>Hs,CONTENTS_PLAYER:()=>Ys,CONTENTS_PLAYERCLIP:()=>ks,CONTENTS_PROJECTILE:()=>Zs,CONTENTS_PROJECTILECLIP:()=>Bs,CONTENTS_SLIME:()=>Ds,CONTENTS_SOLID:()=>Fs,CONTENTS_TRANSLUCENT:()=>js,CONTENTS_TRIGGER:()=>Fo,CONTENTS_WATER:()=>Is,CONTENTS_WINDOW:()=>Ls,CS_MAX_STRING_LENGTH:()=>wi,CS_MAX_STRING_LENGTH_OLD:()=>Di,ClientCommand:()=>qt,CollisionEntityIndex:()=>Ke,ConfigStringIndex:()=>ie,CvarFlags:()=>Rt,DEFAULT_FORWARD_SPEED:()=>kr,DEFAULT_MOUSE_SENSITIVITY:()=>Jr,DEFAULT_PITCH_SPEED:()=>Xr,DEFAULT_SIDE_SPEED:()=>Gr,DEFAULT_UP_SPEED:()=>Hr,DEFAULT_YAW_SPEED:()=>Kr,DEG2RAD:()=>_o,DIST_EPSILON:()=>J,EntityFlags:()=>dt,GAME_EXPORT_KEYS:()=>gn,GAME_IMPORT_KEYS:()=>Rn,LAST_VISIBLE_CONTENTS:()=>qs,MASK_ALL:()=>mi,MASK_BLOCK_SIGHT:()=>Si,MASK_CURRENT:()=>Uo,MASK_DEADSOLID:()=>pi,MASK_LADDER_NAV_SOLID:()=>Vi,MASK_MONSTERSOLID:()=>yi,MASK_NAV_SOLID:()=>bi,MASK_OPAQUE:()=>xi,MASK_PLAYERSOLID:()=>fi,MASK_PROJECTILE:()=>Pi,MASK_SHOT:()=>hi,MASK_SOLID:()=>ke,MASK_WALK_NAV_SOLID:()=>Ti,MASK_WATER:()=>Ne,MAX_CHALLENGES:()=>qr,MAX_CLIENTS:()=>mn,MAX_CONFIGSTRINGS:()=>Vn,MAX_EDICTS:()=>Mi,MAX_GENERAL:()=>Sn,MAX_IMAGES:()=>xn,MAX_INFO_STRING:()=>es,MAX_ITEMS:()=>hn,MAX_LIGHTSTYLES:()=>fn,MAX_MODELS:()=>pn,MAX_MSGLEN:()=>ts,MAX_OSPATH:()=>Li,MAX_PACKET_ENTITIES:()=>$r,MAX_QPATH:()=>Fi,MAX_SHADOW_LIGHTS:()=>bn,MAX_SOUNDS:()=>yn,MAX_STRING_CHARS:()=>Oi,MAX_STRING_TOKENS:()=>vi,MAX_TOKEN_CHARS:()=>zi,MAX_WHEEL_ITEMS:()=>Ze,MersenneTwister19937:()=>Pe,PITCH:()=>Ve,PlaneSide:()=>Tt,PlayerButton:()=>te,PmFlag:()=>ee,PmType:()=>ce,RAD2DEG:()=>Co,ROLL:()=>Be,RandomGenerator:()=>_e,Replay:()=>qe,SLIDEMOVE_BLOCKED_FLOOR:()=>vt,SLIDEMOVE_BLOCKED_WALL:()=>zt,STOP_EPSILON:()=>Y,SURF_ALPHATEST:()=>ai,SURF_FLOWING:()=>si,SURF_LIGHT:()=>Qs,SURF_N64_SCROLL_FLIP:()=>di,SURF_N64_SCROLL_X:()=>li,SURF_N64_SCROLL_Y:()=>ui,SURF_N64_UV:()=>ci,SURF_NODRAW:()=>ii,SURF_NONE:()=>$s,SURF_SKY:()=>ti,SURF_SLICK:()=>ei,SURF_TRANS33:()=>ni,SURF_TRANS66:()=>ri,SURF_WARP:()=>oi,ServerCommand:()=>Zt,TempEntity:()=>$t,UPDATE_BACKUP:()=>Qr,WaterLevel:()=>ae,YAW:()=>Te,ZERO_VEC3:()=>O,addBlendColor:()=>Ro,addContents:()=>Ho,addPmFlag:()=>B,addPointToBounds:()=>yo,addVec3:()=>A,addViewAngles:()=>Yr,angleMod:()=>me,angleVectors:()=>Ue,applyPmove:()=>Cs,applyPmoveAccelerate:()=>K,applyPmoveAddCurrents:()=>ze,applyPmoveAirAccelerate:()=>et,applyPmoveAirMove:()=>Tr,applyPmoveFlyMove:()=>Yn,applyPmoveFriction:()=>Qe,applyPmoveWaterMove:()=>Pr,assertContract:()=>En,boxContents:()=>rn,boxOnPlaneSide:()=>Qo,boxesIntersect:()=>xo,buildAirGroundWish:()=>tt,buildCollisionModel:()=>qo,buildWaterWish:()=>ot,categorizePosition:()=>br,checkDuckState:()=>sr,checkJump:()=>er,checkSpecialMovement:()=>Mr,clampViewAngles:()=>Ur,clipBoxToBrush:()=>Je,clipVelocityAgainstPlanes:()=>ho,clipVelocityVec3:()=>$,closestPointToBox:()=>mo,combineSurfaceFlags:()=>Jo,computePlaneSignBits:()=>Xe,computePlayerDimensions:()=>Le,concatRotationMatrices:()=>We,configStringSize:()=>Tn,copyVec3:()=>io,createDefaultTrace:()=>Re,createEmptyBounds3:()=>po,createMat4Identity:()=>St,createRandomGenerator:()=>go,crossVec3:()=>q,currentVectorFromContents:()=>at,degToRad:()=>Se,disableTraceDebug:()=>Yo,distance:()=>lo,distanceBetweenBoxesSquared:()=>fo,dotVec3:()=>L,enableTraceDebug:()=>jo,fixStuckObjectGeneric:()=>st,getWaterLevel:()=>xe,goodPosition:()=>ut,groundCurrentVelocity:()=>kt,hasAllContents:()=>ko,hasAnyContents:()=>Go,hasPmFlag:()=>M,hasSurfaceFlags:()=>Xo,inPHS:()=>an,inPVS:()=>sn,initialSnapPosition:()=>Ir,isAtLeastWaistDeep:()=>$e,isUnderwater:()=>zn,lengthSquaredVec3:()=>ne,lengthVec3:()=>I,lerpAngle:()=>No,mat4FromBasis:()=>zo,mouseDeltaToViewDelta:()=>Zr,multiplyMat4:()=>Oo,multiplyVec3:()=>ao,negateVec3:()=>co,normalizeVec3:()=>z,perpendicularVec3:()=>yt,planeDistanceToPoint:()=>Q,pmoveCmdScale:()=>Fn,pointContents:()=>on,pointContentsMany:()=>nn,pointInsideBrush:()=>Pt,pointOnPlaneSide:()=>$o,projectPointOnPlane:()=>pt,projectSourceVec3:()=>bo,projectSourceVec3WithUp:()=>Vo,radToDeg:()=>be,removeContents:()=>Ko,removePmFlag:()=>H,resolveSlideMove:()=>Ft,rotatePointAroundVector:()=>Po,scaleVec3:()=>E,slerpVec3:()=>To,slideClipVelocityVec3:()=>So,slideMove:()=>nt,snapPosition:()=>Dr,stepSlideMove:()=>oe,subtractVec3:()=>Z,testBoxInBrush:()=>_t,traceBox:()=>Et,traceDebugInfo:()=>G,transformPointMat4:()=>vo,validateContract:()=>gt,vec3Equals:()=>uo,vectorToAngles:()=>Eo,vectorToYaw:()=>Ao,waterCurrentVelocity:()=>Ut});var O={x:0,y:0,z:0},Y=.1,so=Math.PI/180;function io(t){return{x:t.x,y:t.y,z:t.z}}function A(t,e){return{x:t.x+e.x,y:t.y+e.y,z:t.z+e.z}}function Z(t,e){return{x:t.x-e.x,y:t.y-e.y,z:t.z-e.z}}function ao(t,e){return{x:t.x*e.x,y:t.y*e.y,z:t.z*e.z}}function E(t,e){return{x:t.x*e,y:t.y*e,z:t.z*e}}function co(t){return E(t,-1)}function L(t,e){return t.x*e.x+t.y*e.y+t.z*e.z}function q(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 ne(t){return L(t,t)}function I(t){return Math.sqrt(ne(t))}function lo(t,e){return I(Z(t,e))}function uo(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z}function z(t){let e=I(t);return e===0?t:E(t,1/e)}function pt(t,e){let o=1/L(e,e),n=L(e,t)*o;return Z(t,E(e,o*n))}function yt(t){let e=0,o=Math.abs(t.x);return Math.abs(t.y)<o&&(e=1,o=Math.abs(t.y)),Math.abs(t.z)<o&&(e=2),z(pt(e===0?{x:1,y:0,z:0}:e===1?{x:0,y:1,z:0}:{x:0,y:0,z:1},t))}function mo(t,e,o){return{x:t.x<e.x?e.x:t.x>o.x?o.x:t.x,y:t.y<e.y?e.y:t.y>o.y?o.y:t.y,z:t.z<e.z?e.z:t.z>o.z?o.z:t.z}}function fo(t,e,o,n){let r=0;if(e.x<o.x){let s=e.x-o.x;r+=s*s}else if(t.x>n.x){let s=t.x-n.x;r+=s*s}if(e.y<o.y){let s=e.y-o.y;r+=s*s}else if(t.y>n.y){let s=t.y-n.y;r+=s*s}if(e.z<o.z){let s=e.z-o.z;r+=s*s}else if(t.z>n.z){let s=t.z-n.z;r+=s*s}return r}function po(){return{mins:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,z:Number.POSITIVE_INFINITY},maxs:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY,z:Number.NEGATIVE_INFINITY}}}function yo(t,e){return{mins:{x:Math.min(e.mins.x,t.x),y:Math.min(e.mins.y,t.y),z:Math.min(e.mins.z,t.z)},maxs:{x:Math.max(e.maxs.x,t.x),y:Math.max(e.maxs.y,t.y),z:Math.max(e.maxs.z,t.z)}}}function xo(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 $(t,e,o){let n=L(t,e)*o,r=t.x-e.x*n,s=t.y-e.y*n,i=t.z-e.z*n;return r>-Y&&r<Y&&(r=0),s>-Y&&s<Y&&(s=0),i>-Y&&i<Y&&(i=0),{x:r,y:s,z:i}}function ho(t,e,o,n){if(e.length===0)return t;let r=t;for(let s=0;s<e.length;s++){r=$(r,e[s],o);let i=0;for(;i<e.length&&!(i!==s&&L(r,e[i])<0);i++);if(i===e.length)return n&&L(r,n)<=0?O:r}if(e.length===2){let s=q(e[0],e[1]),i=L(s,t),a=E(s,i);return n&&L(a,n)<=0?O:a}return n&&L(r,n)<=0,O}function So(t,e,o){return $(t,e,o)}function bo(t,e,o,n){return{x:t.x+o.x*e.x+n.x*e.y,y:t.y+o.y*e.x+n.y*e.y,z:t.z+o.z*e.x+n.z*e.y+e.z}}function Vo(t,e,o,n,r){return{x:t.x+o.x*e.x+n.x*e.y+r.x*e.z,y:t.y+o.y*e.x+n.y*e.y+r.y*e.z,z:t.z+o.z*e.x+n.z*e.y+r.z*e.z}}function To(t,e,o){let n=L(t,e),r,s;if(Math.abs(n)>.9995)r=1-o,s=o;else{let i=Math.acos(n),a=Math.sin(i),d=Math.sin((1-o)*i),u=Math.sin(o*i);r=d/a,s=u/a}return{x:t.x*r+e.x*s,y:t.y*r+e.y*s,z:t.z*r+e.z*s}}function We(t,e){let o=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[o(0),o(1),o(2)]}function Po(t,e,o){if(I(t)===0)return e;let r=z(t),s=yt(r),i=q(s,r),a=[[s.x,i.x,r.x],[s.y,i.y,r.y],[s.z,i.z,r.z]],d=[[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]]],u=o*so,m=Math.cos(u),c=Math.sin(u),f=[[m,c,0],[-c,m,0],[0,0,1]],p=We(We(a,f),d);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 Ve=0,Te=1,Be=2,xt=Math.PI/180,ht=180/Math.PI,_o=xt,Co=ht;function de(t,e){switch(e){case Ve:return t.x;case Te:return t.y;case Be:default:return t.z}}function Se(t){return t*xt}function be(t){return t*ht}function No(t,e,o){let n=e;return n-t>180?n-=360:n-t<-180&&(n+=360),t+o*(n-t)}function me(t){let e=t%360;return e<0?360+e:e}function Ue(t){let e=Se(de(t,Te)),o=Se(de(t,Ve)),n=Se(de(t,Be)),r=Math.sin(e),s=Math.cos(e),i=Math.sin(o),a=Math.cos(o),d=Math.sin(n),u=Math.cos(n),m={x:a*s,y:a*r,z:-i},c={x:-d*i*s-u*-r,y:-d*i*r-u*s,z:-d*a},f={x:u*i*s-d*-r,y:u*i*r-d*s,z:u*a};return{forward:m,right:c,up:f}}function Ao(t){let e=de(t,Ve),o=de(t,Te);if(e===0)return o===0?0:o>0?90:270;let n=be(Math.atan2(o,e));return n<0?n+360:n}function Eo(t){let e=t.x,o=t.y,n=t.z;if(o===0&&e===0)return{x:n>0?-90:-270,y:0,z:0};let r;e?r=be(Math.atan2(o,e)):o>0?r=90:r=270,r<0&&(r+=360);let s=Math.sqrt(e*e+o*o),i=be(Math.atan2(n,s));return i<0&&(i+=360),{x:-i,y:r,z:0}}var re=[[-.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 Ro(t,e,o,n,r){if(n<=0)return r;let s=r[0],i=r[1],a=r[2],d=r[3],u=d+(1-d)*n;if(u<=0)return[0,0,0,0];let m=d/u,c=s*m+t*(1-m),f=i*m+e*(1-m),p=a*m+o*(1-m);return[c,f,p,u]}var Pe=class{constructor(e=5489){this.state=new Uint32Array(624);this.index=624;this.seed(e)}seed(e){this.state[0]=e>>>0;for(let o=1;o<624;o++){let n=this.state[o-1]^this.state[o-1]>>>30,r=Math.imul(n>>>0,1812433253)+o;this.state[o]=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 o=this.state[e]&2147483648|this.state[(e+1)%624]&2147483647,n=this.state[(e+397)%624]^o>>>1;(o&1)!==0&&(n^=2567483615),this.state[e]=n>>>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,o=>o>>>0)}},_e=class{constructor(e={}){this.mt=new Pe(e.seed)}seed(e){this.mt.seed(e)}frandom(){return this.mt.nextUint32()/4294967296}frandomRange(e,o){return e+(o-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,o){if(o-e<=1)return e;let n=o-e,r=4294967296-4294967296%n,s;do s=this.mt.nextUint32();while(s>=r);return e+s%n}irandom(e){return e<=0?0:this.irandomRange(0,e)}randomTimeRange(e,o){return o<=e?e:this.irandomRange(e,o)}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 go(t){return new _e(t)}function St(){return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function Oo(t,e){let o=new Float32Array(16);for(let n=0;n<4;n+=1)for(let r=0;r<4;r+=1)o[r*4+n]=t[0+n]*e[r*4+0]+t[4+n]*e[r*4+1]+t[8+n]*e[r*4+2]+t[12+n]*e[r*4+3];return o}function vo(t,e){let o=e.x,n=e.y,r=e.z;return{x:t[0]*o+t[4]*n+t[8]*r+t[12],y:t[1]*o+t[5]*n+t[9]*r+t[13],z:t[2]*o+t[6]*n+t[10]*r+t[14]}}function zo(t,e){let o=St();return o[0]=e[0].x,o[1]=e[0].y,o[2]=e[0].z,o[4]=e[1].x,o[5]=e[1].y,o[6]=e[1].z,o[8]=e[2].x,o[9]=e[2].y,o[10]=e[2].z,o[12]=t.x,o[13]=t.y,o[14]=t.z,o}var Ce=0,Fs=1,Ls=2,Ms=4,ws=8,Ds=16,Is=32,Ws=64,Fo=1073741824,Lo=8192,Bs=16384,Us=32768,ks=65536,Gs=131072,Mo=262144,wo=524288,Do=1048576,Io=2097152,Wo=4194304,Bo=8388608,Hs=16777216,Ks=33554432,Xs=67108864,Js=134217728,js=268435456,bt=536870912,Ys=1073741824,Zs=-2147483648,qs=64,$s=0,Qs=1,ei=2,ti=4,oi=8,ni=16,ri=32,si=64,ii=128,ai=33554432,ci=268435456,li=536870912,ui=1073741824,di=-2147483648,mi=4294967295,ke=3,fi=1107361795,pi=65539,yi=1107427331,Ne=56,xi=25,hi=1174405123,Uo=16515072,Si=1107296281,bi=65539,Vi=3,Ti=196611,Pi=1174421507;function ko(t,e){return(t&e)===e}function Go(t,e){return(t&e)!==0}function Ho(t,e){return t|e}function Ko(t,e){return t&~e}function Xo(t,e){return(t&e)===e}function Jo(...t){let e=0;for(let o of t)e|=o;return e}function Ae(t=0,e={x:-8192,y:-8192,z:-8192},o={x:8192,y:8192,z:8192}){if(t>=4)return{axis:-1,dist:0,children:null,items:new Set};let n=t%2,r=.5*(n===0?e.x+o.x:e.y+o.y),s={...e},i={...o},a={...e},d={...o};n===0?(i.x=r,a.x=r):(i.y=r,a.y=r);let u=Ae(t+1,s,i),m=Ae(t+1,a,d);return{axis:n,dist:r,children:[u,m],items:new Set}}function Vt(t,e,o,n){let r=t;for(;r.axis!==-1&&r.children;){let s=r.axis,i=r.dist,a=s===0?o.x:o.y,d=s===0?n.x:n.y;if(a>i)r=r.children[1];else if(d<i)r=r.children[0];else break}return r.items.add(e),r}function fe(t,e,o,n){for(let d of t.items)n.add(d);if(t.axis===-1||!t.children)return;let r=t.axis,s=t.dist,i=r===0?e.x:e.y;(r===0?o.x:o.y)>s&&fe(t.children[1],e,o,n),i<s&&fe(t.children[0],e,o,n)}var Tt=(n=>(n[n.FRONT=1]="FRONT",n[n.BACK=2]="BACK",n[n.CROSS=3]="CROSS",n))(Tt||{}),G=null;function jo(){G={nodesTraversed:0,leafsReached:0,brushesTested:0}}function Yo(){G=null}var J=.03125,Zo=Number.MAX_SAFE_INTEGER-1,Ee=1;function qo(t){let e=t.planes.map(i=>({...i,signbits:Xe(i.normal)})),o=t.nodes.map(i=>({plane:e[i.planenum],children:i.children})),n=t.brushes.map(i=>{let a=t.brushSides.slice(i.firstSide,i.firstSide+i.numSides).map(d=>({plane:e[d.planenum],surfaceFlags:d.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:o,leaves:r,brushes:n,leafBrushes:t.leafBrushes,bmodels:s,visibility:t.visibility}}function Xe(t){let e=0;return t.x<0&&(e|=1),t.y<0&&(e|=2),t.z<0&&(e|=4),e}function Q(t,e){return t.normal.x*e.x+t.normal.y*e.y+t.normal.z*e.z-t.dist}function $o(t,e,o=0){let n=Q(t,e);return n>o?1:n<-o?2:3}function Qo(t,e,o,n=0){let r,s;switch(o.signbits){case 0:r=o.normal.x*e.x+o.normal.y*e.y+o.normal.z*e.z,s=o.normal.x*t.x+o.normal.y*t.y+o.normal.z*t.z;break;case 1:r=o.normal.x*t.x+o.normal.y*e.y+o.normal.z*e.z,s=o.normal.x*e.x+o.normal.y*t.y+o.normal.z*t.z;break;case 2:r=o.normal.x*e.x+o.normal.y*t.y+o.normal.z*e.z,s=o.normal.x*t.x+o.normal.y*e.y+o.normal.z*t.z;break;case 3:r=o.normal.x*t.x+o.normal.y*t.y+o.normal.z*e.z,s=o.normal.x*e.x+o.normal.y*e.y+o.normal.z*t.z;break;case 4:r=o.normal.x*e.x+o.normal.y*e.y+o.normal.z*t.z,s=o.normal.x*t.x+o.normal.y*t.y+o.normal.z*e.z;break;case 5:r=o.normal.x*t.x+o.normal.y*e.y+o.normal.z*t.z,s=o.normal.x*e.x+o.normal.y*t.y+o.normal.z*e.z;break;case 6:r=o.normal.x*e.x+o.normal.y*t.y+o.normal.z*t.z,s=o.normal.x*t.x+o.normal.y*e.y+o.normal.z*e.z;break;default:r=o.normal.x*t.x+o.normal.y*t.y+o.normal.z*t.z,s=o.normal.x*e.x+o.normal.y*e.y+o.normal.z*e.z;break}let i=0;return r-o.dist>=-n&&(i=1),s-o.dist<=n&&(i|=2),i}function Pt(t,e,o=J){for(let n of e.sides)if(Q(n.plane,t)>o)return!1;return!0}function _t(t,e,o,n){for(let r of n.sides){let s=r.plane.normal.x*(r.plane.normal.x<0?o.x:e.x)+r.plane.normal.y*(r.plane.normal.y<0?o.y:e.y)+r.plane.normal.z*(r.plane.normal.z<0?o.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:n.contents}}function Je({start:t,end:e,mins:o,maxs:n,brush:r,trace:s}){if(r.sides.length===0)return;let i=o.x===0&&o.y===0&&o.z===0&&n.x===0&&n.y===0&&n.z===0,a=-1,d=1,u=null,m=null,c=!1,f=!1;for(let p of r.sides){let{plane:y}=p,T=y.dist;if(!i){let N=y.normal.x<0?n.x:o.x,_=y.normal.y<0?n.y:o.y,b=y.normal.z<0?n.z:o.z;T-=y.normal.x*N+y.normal.y*_+y.normal.z*b}let S=t.x*y.normal.x+t.y*y.normal.y+t.z*y.normal.z-T,V=e.x*y.normal.x+e.y*y.normal.y+e.z*y.normal.z-T;if(V>0&&(c=!0),S>0&&(f=!0),S>0&&V>=S)return;if(!(S<=0&&V<=0))if(S>V){let N=(S-J)/(S-V);N>a&&(a=N,u=y,m=p)}else{let N=(S+J)/(S-V);N<d&&(d=N)}}if(!f){s.startsolid=!0,c||(s.allsolid=!0),s.fraction=0;return}a<d&&a>-1&&a<s.fraction&&(s.fraction=a<0?0:a,s.plane=u,s.contents=r.contents,s.surfaceFlags=m?.surfaceFlags??0)}function Re(){return{fraction:1,plane:null,contents:0,surfaceFlags:0,startsolid:!1,allsolid:!1}}function je(t,e,o){let n=o;for(;n>=0;){let r=e.nodes[n];n=Q(r.plane,t)>=0?r.children[0]:r.children[1]}return-1-n}function Ct(t,e,o){let n=t.leaves[e],r=n.contents,s=Ye(),i=n.firstLeafBrush,a=i+n.numLeafBrushes;for(let d=i;d<a;d+=1){let u=t.leafBrushes[d],m=t.brushes[u];m.checkcount!==s&&(m.checkcount=s,m.sides.length!==0&&Pt(o,m)&&(r|=m.contents))}return r}function Ye(){let t=Ee;return Ee+=1,Ee>=Zo&&(Ee=1),t}function en(t,e){return t.x===0&&t.y===0&&t.z===0&&e.x===0&&e.y===0&&e.z===0}function tn(t,e,o){return en(e,o)?0:t.normal.x*(t.normal.x<0?o.x:e.x)+t.normal.y*(t.normal.y<0?o.y:e.y)+t.normal.z*(t.normal.z<0?o.z:e.z)}function Nt(t,e,o){return Math.abs(tn(t,e,o))}function Ge(t,e,o){return A(t,E(Z(e,t),o))}function He(t,e,o){let n=t.allsolid?0:t.fraction,r=Ge(e,o,n);return{fraction:n,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 ge(t,e,o){let n=je(t,e,o);return e.leaves[n]?.cluster??-1}function At(t,e,o,n){if(!t||t.numClusters===0)return!0;if(e<0||o<0||e>=t.clusters.length||o>=t.numClusters)return!1;let r=t.clusters[e],i=(n?r.phs:r.pvs)[o>>3];return i===void 0?!1:(i&1<<(o&7))!==0}function pe(t){let{model:e,nodeIndex:o,startFraction:n,endFraction:r,start:s,end:i,traceStart:a,traceEnd:d,mins:u,maxs:m,contentMask:c,trace:f,brushCheckCount:p}=t;if(f.fraction<=n)return;if(o<0){G&&G.leafsReached++;let w=-1-o,C=e.leaves[w],W=C.firstLeafBrush,X=W+C.numLeafBrushes;for(let D=W;D<X;D+=1){let k=e.leafBrushes[D],F=e.brushes[k];if((F.contents&c)!==0&&F.sides.length&&F.checkcount!==p&&(F.checkcount=p,G&&G.brushesTested++,Je({start:a,end:d,mins:u,maxs:m,brush:F,trace:f}),f.allsolid))return}return}G&&G.nodesTraversed++;let y=e.nodes[o],T=y.plane,S=Nt(T,u,m),V=Q(T,s),N=Q(T,i);if(V>=S&&N>=S){pe({model:e,nodeIndex:y.children[0],startFraction:n,endFraction:r,start:s,end:i,traceStart:a,traceEnd:d,mins:u,maxs:m,contentMask:c,trace:f,brushCheckCount:p});return}if(V<-S&&N<-S){pe({model:e,nodeIndex:y.children[1],startFraction:n,endFraction:r,start:s,end:i,traceStart:a,traceEnd:d,mins:u,maxs:m,contentMask:c,trace:f,brushCheckCount:p});return}let _=0,b=1/(V-N),x,P;V<N?(_=1,P=(V+S+J)*b,x=(V-S+J)*b):(_=0,P=(V-S-J)*b,x=(V+S+J)*b),x<0?x=0:x>1&&(x=1),P<0?P=0:P>1&&(P=1);let g=n+(r-n)*x,v=Ge(s,i,x);if(pe({model:e,nodeIndex:y.children[_],startFraction:n,endFraction:g,start:s,end:v,traceStart:a,traceEnd:d,mins:u,maxs:m,contentMask:c,trace:f,brushCheckCount:p}),f.fraction<=g)return;let h=n+(r-n)*P,R=Ge(s,i,P);pe({model:e,nodeIndex:y.children[1-_],startFraction:h,endFraction:r,start:R,end:i,traceStart:a,traceEnd:d,mins:u,maxs:m,contentMask:c,trace:f,brushCheckCount:p})}function Et(t){let{model:e,start:o,end:n}=t,r=t.mins??O,s=t.maxs??O,i=t.contentMask??4294967295,a=t.headnode??0,d=Re(),u=Ye();return pe({model:e,nodeIndex:a,startFraction:0,endFraction:1,start:o,end:n,traceStart:o,traceEnd:n,mins:r,maxs:s,contentMask:i,trace:d,brushCheckCount:u}),He(d,o,n)}function on(t,e,o=0){let n=je(t,e,o);return Ct(e,n,t)}function nn(t,e,o=0){let n=new Map;return t.map(r=>{let s=je(r,e,o),i=e.leaves[s];if(i.numLeafBrushes===0){let a=n.get(s);return a!==void 0?a:(n.set(s,i.contents),i.contents)}return Ct(e,s,r)})}function rn(t,e,o,n,r=0){let s=Ye(),i=0;function a(d){if(d<0){G&&G.leafsReached++;let p=-1-d,y=n.leaves[p];i|=y.contents;let T=y.firstLeafBrush,S=T+y.numLeafBrushes;for(let V=T;V<S;V+=1){let N=n.leafBrushes[V],_=n.brushes[N];if(_.checkcount===s||(_.checkcount=s,_.sides.length===0))continue;let b=_t(t,e,o,_);b.startsolid&&(i|=b.contents)}return}let u=n.nodes[d],m=u.plane,c=Nt(m,e,o),f=Q(m,t);if(c===0){a(f>=0?u.children[0]:u.children[1]);return}if(f>c){a(u.children[0]);return}if(f<-c){a(u.children[1]);return}a(u.children[0]),a(u.children[1])}return a(r),i}function sn(t,e,o,n=0){let{visibility:r}=o;if(!r)return!0;let s=ge(t,o,n),i=ge(e,o,n);return At(r,s,i,!1)}function an(t,e,o,n=0){let{visibility:r}=o;if(!r)return!0;let s=ge(t,o,n),i=ge(e,o,n);return At(r,s,i,!0)}function se(t,e,o){return{normal:t,dist:e,type:o,signbits:Xe(t)}}function cn(t){let e=t.surfaceFlags??0,o=t.origin.x+t.maxs.x,n=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,u=[se({x:1,y:0,z:0},o,0),se({x:-1,y:0,z:0},-n,0),se({x:0,y:1,z:0},r,1),se({x:0,y:-1,z:0},-s,1),se({x:0,y:0,z:1},i,2),se({x:0,y:0,z:-1},-a,2)].map(m=>({plane:m,surfaceFlags:e}));return{contents:t.contents,sides:u,checkcount:0}}function ln(t){let e=cn(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 un(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 dn(t,e){return e.allsolid&&!t.allsolid||e.startsolid&&!t.startsolid?!0:e.fraction<t.fraction}var Ke=class{constructor(){this.entities=new Map;this.entityNodes=new Map;this.rootNode=Ae()}link(e){let o=ln(e);this.entities.set(e.id,o);let n=this.entityNodes.get(e.id);n&&n.items.delete(e.id);let r=Vt(this.rootNode,e.id,o.bounds.mins,o.bounds.maxs);this.entityNodes.set(e.id,r)}unlink(e){this.entities.delete(e);let o=this.entityNodes.get(e);o&&(o.items.delete(e),this.entityNodes.delete(e))}trace(e){let{passId:o}=e,n=e.mins??O,r=e.maxs??O,s=e.contentMask??4294967295,i,a=null;e.model?i=Et(e):i=He(Re(),e.start,e.end);let d={x:Math.min(e.start.x,e.end.x)+n.x,y:Math.min(e.start.y,e.end.y)+n.y,z:Math.min(e.start.z,e.end.z)+n.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},m=new Set;fe(this.rootNode,d,u,m);for(let c of m){if(c===o)continue;let f=this.entities.get(c);if(!f||(f.contents&s)===0)continue;let p=Re();if(Je({start:e.start,end:e.end,mins:n,maxs:r,brush:f.brush,trace:p}),p.contents===0&&(p.contents=f.contents),p.startsolid||p.allsolid||p.fraction<i.fraction){let y=He(p,e.start,e.end);dn(i,y)&&(i=y,a=f.id)}}return{...i,entityId:a}}gatherTriggerTouches(e,o,n,r=1073741824){let s=[],i={mins:A(e,o),maxs:A(e,n)},a=new Set;fe(this.rootNode,i.mins,i.maxs,a);for(let d of a){let u=this.entities.get(d);u&&(u.contents&r)!==0&&un(i,u.bounds)&&s.push(u.id)}return s}};var Rt=(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))(Rt||{});var Oi=1024,vi=80,zi=512,Fi=64,Li=128,mn=256,Mi=8192,fn=256,pn=8192,yn=2048,xn=512,hn=256,Sn=512,bn=256,Ze=32,wi=96,Di=64,ie=(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.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+pn]="Sounds",h[h.Images=h.Sounds+yn]="Images",h[h.Lights=h.Images+xn]="Lights",h[h.ShadowLights=h.Lights+fn]="ShadowLights",h[h.Items=h.ShadowLights+bn]="Items",h[h.PlayerSkins=h.Items+hn]="PlayerSkins",h[h.General=h.PlayerSkins+mn]="General",h[h.WheelWeapons=h.General+Sn]="WheelWeapons",h[h.WheelAmmo=h.WheelWeapons+Ze]="WheelAmmo",h[h.WheelPowerups=h.WheelAmmo+Ze]="WheelPowerups",h[h.CdLoopCount=h.WheelPowerups+Ze]="CdLoopCount",h[h.GameStyle=h.CdLoopCount+1]="GameStyle",h[h.MaxConfigStrings=h.GameStyle+1]="MaxConfigStrings",h))(ie||{}),Vn=ie.MaxConfigStrings;function Tn(t){return t>=5&&t<59?96*(59-t):t>=ie.General&&t<ie.WheelWeapons?96*(ie.MaxConfigStrings-t):96}var qe={};Ie(qe,{addReplayFrame:()=>Nn,createReplaySession:()=>Cn,deserializeReplay:()=>_n,serializeReplay:()=>Pn});function Pn(t){return JSON.stringify(t,null,2)}function _n(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 Cn(t,e){return{metadata:{map:t,date:new Date().toISOString(),version:"1.0",seed:e},frames:[]}}function Nn(t,e,o,n){t.frames.push({serverFrame:o,cmd:e,timestamp:Date.now()-n})}function An(t){return t??{}}function gt(t,e,o={}){let n=An(t),r=[],s=[];for(let a of e){if(!(a in n)){r.push(a);continue}typeof n[a]!="function"&&s.push(a)}let i=o.allowExtra===!1?Object.keys(n).filter(a=>!e.includes(a)):[];return{missing:r,nonFunctions:s,extras:i}}function En(t,e,o={}){let{missing:n,nonFunctions:r,extras:s}=gt(t,e,o);if(n.length===0&&r.length===0&&s.length===0)return;let i=[];n.length>0&&i.push(`missing: ${n.join(", ")}`),r.length>0&&i.push(`non-functions: ${r.join(", ")}`),s.length>0&&i.push(`extras: ${s.join(", ")}`);let a=o.name??"contract";throw new Error(`${a} validation failed (${i.join("; ")})`)}var Rn=["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"],gn=["PreInit","Init","Shutdown","SpawnEntities","WriteGameJson","ReadGameJson","WriteLevelJson","ReadLevelJson","CanSave","ClientConnect","ClientThink","RunFrame","Pmove"],On=["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"],vn=["Init","Shutdown","DrawHUD","TouchPics","LayoutFlags","GetActiveWeaponWheelWeapon","GetOwnedWeaponWheelWeapons","GetWeaponWheelAmmoCount","GetPowerupWheelCount","GetHitMarkerDamage","Pmove","ParseConfigString","ParseCenterPrint","ClearNotify","ClearCenterprint","NotifyMessage","GetMonsterFlashOffset"];var ae=(r=>(r[r.None=0]="None",r[r.Feet=1]="Feet",r[r.Waist=2]="Waist",r[r.Under=3]="Under",r))(ae||{});function $e(t){return t>=2}function zn(t){return t===3}var ee=(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))(ee||{});function M(t,e){return(t&e)!==0}function B(t,e){return t|e}function H(t,e){return t&~e}var ce=(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))(ce||{}),te=(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))(te||{});function Qe(t){let{velocity:e,frametime:o,onGround:n,groundIsSlick:r,onLadder:s,waterlevel:i,pmFriction:a,pmStopSpeed:d,pmWaterFriction:u}=t,m=I(e);if(m<1)return{x:0,y:0,z:e.z};let c=0;if(n&&!r||s){let y=m<d?d:m;c+=y*a*o}i>0&&!s&&(c+=m*u*i*o);let f=m-c;if(f<0&&(f=0),f===m)return e;let p=f/m;return E(e,p)}function K(t){let{velocity:e,wishdir:o,wishspeed:n,accel:r,frametime:s}=t,i=L(e,o),a=n-i;if(a<=0)return e;let d=r*s*n;return d>a&&(d=a),{x:e.x+o.x*d,y:e.y+o.y*d,z:e.z+o.z*d}}function et(t){let{velocity:e,wishdir:o,wishspeed:n,accel:r,frametime:s}=t,i=Math.min(n,30),a=L(e,o),d=i-a;if(d<=0)return e;let u=r*n*s;return u>d&&(u=d),{x:e.x+o.x*u,y:e.y+o.y*u,z:e.z+o.z*u}}function Fn(t,e){let o=Math.abs(t.forwardmove),n=Math.abs(t.sidemove),r=Math.abs(t.upmove),s=Math.max(o,n,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 tt(t){let{forward:e,right:o,cmd:n,maxSpeed:r}=t,s={x:e.x*n.forwardmove+o.x*n.sidemove,y:e.y*n.forwardmove+o.y*n.sidemove,z:0},i=I(s);if(i>r){let a=r/i;s=E(s,a),i=r}return{wishdir:i===0?s:z(s),wishspeed:i}}function ot(t){let{forward:e,right:o,cmd:n,maxSpeed:r}=t,s={x:e.x*n.forwardmove+o.x*n.sidemove,y:e.y*n.forwardmove+o.y*n.sidemove,z:0};n.upmove>10?s=A(s,{x:0,y:0,z:n.upmove}):n.upmove<-10?s=A(s,{x:0,y:0,z:n.upmove}):s=A(s,{x:0,y:0,z:10});let i=I(s);if(i>r){let a=r/i;s=E(s,a),i=r}return i*=.5,{wishdir:i===0?s:z(s),wishspeed:i}}var Ot=5,Ln=4,Mn=18,wn=.7,vt=1,zt=2;function Ft(t,e,o,n=Ot,r=t){if(e.length===0)return{velocity:t,planes:[],stopped:!1};let s=[],i=t;for(let d of e){if(s.length>=n)return{velocity:O,planes:s,stopped:!0};if(s.find(f=>L(f,d)>.99))continue;s.push(d);let m,c=0;for(;c<s.length;c++){let f=$(i,s[c],o),p=0;for(;p<s.length&&!(p!==c&&L(f,s[p])<0);p++);if(p===s.length){m=f;break}}if(m)i=m;else{if(s.length!==2)return{velocity:O,planes:s,stopped:!0};let f=q(s[0],s[1]),p=L(f,i);i=E(f,p)}if(L(i,r)<=0)return{velocity:O,planes:s,stopped:!0}}let a=i.x===0&&i.y===0&&i.z===0;return{velocity:i,planes:s,stopped:a}}function nt(t){let{origin:e,velocity:o,frametime:n,overbounce:r,trace:s,maxBumps:i=Ln,maxClipPlanes:a=Ot,mins:d,maxs:u,hasTime:m=!1}=t,c=e,f=o,p=[],y=o,T=n,S=0;for(let N=0;N<i&&!(f.x===0&&f.y===0&&f.z===0);N++){let _=A(c,E(f,T)),b=s(c,_,d,u);if(b.allsolid){let P=m?y:O;return{origin:b.endpos,velocity:P,planes:p,stopped:!0,blocked:S}}if(b.startsolid){let P=m?y:O;return{origin:b.endpos,velocity:P,planes:p,stopped:!0,blocked:S}}if(b.fraction>0&&(c=b.endpos),b.fraction===1)break;if(!b.planeNormal)return{origin:c,velocity:m?y:O,planes:p,stopped:!0,blocked:S};b.planeNormal.z>.7&&(S|=vt),b.planeNormal.z===0&&(S|=zt),p.push(b.planeNormal),T-=T*b.fraction;let x=Ft(f,p,r,a,y);if(f=x.velocity,p.splice(0,p.length,...x.planes),y.z>0&&f.z<0&&(f={...f,z:0}),x.stopped)return{origin:c,velocity:m?y:f,planes:p,stopped:!0,blocked:S}}let V=m?y:f;return{origin:c,velocity:V,planes:p,stopped:V.x===0&&V.y===0&&V.z===0,blocked:S}}function oe(t){let{mins:e,maxs:o,stepSize:n=Mn,...r}=t,s=t.origin,i=t.velocity,a=nt({...r,mins:e,maxs:o}),d=A(s,{x:0,y:0,z:n}),u=r.trace(s,d,e,o);if(u.allsolid)return{...a,stepped:!1,stepHeight:0};let m=u.endpos.z-s.z,c=nt({...r,origin:u.endpos,velocity:i,mins:e,maxs:o}),f=A(c.origin,{x:0,y:0,z:-m}),p=r.trace(c.origin,f,e,o),y=c.origin,T=p.planeNormal;p.allsolid||(y=p.endpos);let S=(P,g)=>(P.x-g.x)**2+(P.y-g.y)**2,V=S(a.origin,s),N=S(y,s);if(V>N||T&&T.z<wn)return{...a,stepped:!1,stepHeight:0};let _={...c.velocity,z:a.velocity.z},b=c.blocked,x=_.x===0&&_.y===0&&_.z===0;return{origin:y,velocity:_,planes:c.planes,blocked:b,stopped:x,stepped:!0,stepHeight:m,stepNormal:T}}var le=["x","y","z"],rt=[{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]}],Lt={x:0,y:0,z:0};function ue(t){return{x:t.x,y:t.y,z:t.z}}function Dn(t){return{x:t[0],y:t[1],z:t[2]}}function ye(t,e,o){if(o!==0)switch(e){case"x":t.x+=o;break;case"y":t.y+=o;break;case"z":t.z+=o;break}}function Mt(t,e,o){switch(e){case"x":t.x=o;break;case"y":t.y=o;break;case"z":t.z=o;break}}function Oe(t,e){switch(e){case"x":return t.x;case"y":return t.y;case"z":default:return t.z}}function wt(t,e,o,n){return t===-1?Oe(o,e):t===1?Oe(n,e):0}function Dt(t,e,o,n){let r=ue(t);for(let s=0;s<le.length;s++){let i=le[s],a=e.normal[s];a<0?ye(r,i,Oe(o,i)):a>0&&ye(r,i,Oe(n,i))}return r}function In(t,e,o){let n=ue(Lt),r=ue(Lt);for(let s=0;s<le.length;s++){let i=le[s];Mt(n,i,wt(t.mins[s],i,e,o)),Mt(r,i,wt(t.maxs[s],i,e,o))}return{mins:n,maxs:r}}function Wn(t,e,o){if(!e||o===0)return t;let n=ue(t);return ye(n,e,o),n}function Bn(t,e,o){if(!e||o===0)return t;switch(e){case"x":return{...t,x:t.x+o};case"y":return{...t,y:t.y+o};case"z":default:return{...t,z:t.z+o}}}function st(t){let{origin:e,mins:o,maxs:n,trace:r}=t;if(!r(e,o,n,e).startsolid)return{result:"good-position",origin:{...e}};let i=[];for(let a=0;a<rt.length;a++){let d=rt[a],{mins:u,maxs:m}=In(d,o,n),c=Dt(e,d,o,n),f=r(c,u,m,c),p,y=0;if(f.startsolid)for(let P=0;P<le.length;P++){if(d.normal[P]!==0)continue;let g=le[P],v=ue(c);if(ye(v,g,1),f=r(v,u,m,v),!f.startsolid){c=v,p=g,y=1;break}if(v=ue(c),ye(v,g,-1),f=r(v,u,m,v),!f.startsolid){c=v,p=g,y=-1;break}}if(f.startsolid)continue;let T=rt[a^1],S=Dt(e,T,o,n);if(S=Wn(S,p,y),f=r(c,u,m,S),f.startsolid)continue;let V=Dn(d.normal),N=A(f.endpos??S,E(V,.125)),_=Z(N,S),b=A(e,_);b=Bn(b,p,y),!r(b,o,n,b).startsolid&&i.push({origin:b,distance:ne(_)})}return i.length===0?{result:"no-good-position",origin:{...e}}:(i.sort((a,d)=>a.distance-d.distance),{result:"fixed",origin:{...i[0].origin}})}var Un=100,it=200,It=150,ve=25,kn=15,Gn=1,Hn={x:0,y:0,z:1},Kn=(t,e)=>({fraction:1,endpos:e,allsolid:!1,startsolid:!1});function at(t){let e=0,o=0,n=0;return t&262144&&(e+=1),t&524288&&(o+=1),t&1048576&&(e-=1),t&2097152&&(o-=1),t&4194304&&(n+=1),t&8388608&&(n-=1),e===0&&o===0&&n===0?O:{x:e,y:o,z:n}}function Ut(t){let{watertype:e,waterlevel:o,onGround:n,waterSpeed:r}=t;if((e&16515072)===0)return O;let s=at(e);if(s===O)return O;let i=r;return o===1&&n&&(i*=.5),E(s,i)}function kt(t){let{groundContents:e,scale:o=Un}=t,n=at(e);return n===O?O:E(n,o)}function ze(t){let{wishVelocity:e,onLadder:o,onGround:n,waterlevel:r,watertype:s,groundContents:i,cmd:a,viewPitch:d,maxSpeed:u,ladderMod:m,waterSpeed:c,forward:f,origin:p,mins:y,maxs:T,trace:S=Kn}=t,V=e;o&&(V=Xn({wishVelocity:V,cmd:a,waterlevel:r,viewPitch:d,maxSpeed:u,ladderMod:m,onGround:n,forward:f,origin:p,mins:y,maxs:T,trace:S}));let N=Ut({watertype:s,waterlevel:r,onGround:n,waterSpeed:c});if(N!==O&&(V=A(V,N)),n){let _=kt({groundContents:i});_!==O&&(V=A(V,_))}return V}function Xn(t){let{wishVelocity:e,cmd:o,waterlevel:n,viewPitch:r,maxSpeed:s,ladderMod:i,onGround:a,forward:d,origin:u,mins:m,maxs:c,trace:f}=t,p=o.buttons??0,y={...e};if((p&24)!==0){let T=$e(n)?s:it;y={...y,z:p&8?T:-T}}else if(o.forwardmove){let T=Wt(o.forwardmove,-it,it);if(o.forwardmove>0){let S=r<kn?T:-T;y={...y,z:S}}else a||(y={...y,x:0,y:0}),y={...y,z:T}}else y={...y,z:0};if(!a)if(o.sidemove){let T=Wt(o.sidemove,-It,It);n<2&&(T*=i);let S=z({x:d.x,y:d.y,z:0});if(S.x!==0||S.y!==0){let V=A(u,E(S,Gn)),N=f(u,V,m,c);if(N.fraction!==1&&!N.allsolid&&N.contents!==void 0&&(N.contents&536870912)!==0&&N.planeNormal){let _=q(N.planeNormal,Hn);y={...y,x:0,y:0},y=A(y,E(_,-T))}}}else y={...y,x:Bt(y.x),y:Bt(y.y)};return y}function Wt(t,e,o){return Math.max(e,Math.min(o,t))}function Bt(t){return t<-ve?-ve:t>ve?ve:t}var Jn=1.5,Gt=.5,jn=1.01;function Yn(t){let{origin:e,cmd:o,frametime:n,pmFriction:r,pmStopSpeed:s,pmMaxSpeed:i,pmAccelerate:a,pmWaterSpeed:d,doclip:u,forward:m,right:c,mins:f,maxs:p,trace:y,overbounce:T=jn,stepSize:S,maxBumps:V,maxClipPlanes:N}=t,_=Zn({velocity:t.velocity,pmFriction:r,pmStopSpeed:s,frametime:n}),b=qn({cmd:o,forward:m,right:c,pmMaxSpeed:i,pmWaterSpeed:d});if(b.wishspeed>0&&(_=K({velocity:_,wishdir:b.wishdir,wishspeed:b.accelSpeed,accel:a,frametime:n})),!u){let x=E(_,n);return{origin:A(e,x),velocity:_,planes:[],blocked:0,stopped:_.x===0&&_.y===0&&_.z===0,stepped:!1,stepHeight:0}}if(!y||!f||!p)throw new Error("applyPmoveFlyMove: doclip=true requires trace/mins/maxs");return oe({origin:e,velocity:_,frametime:n,overbounce:T,trace:y,mins:f,maxs:p,stepSize:S,maxBumps:V,maxClipPlanes:N})}function Zn(t){let{velocity:e,pmFriction:o,pmStopSpeed:n,frametime:r}=t,s=I(e);if(s<1)return{x:0,y:0,z:0};let i=o*Jn,d=(s<n?n:s)*i*r,u=s-d;return u<0&&(u=0),u===s?e:E(e,u/s)}function qn(t){let{cmd:e,forward:o,right:n,pmMaxSpeed:r,pmWaterSpeed:s}=t,i=z(o),a=z(n),u={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},m=e.buttons??0;m&8&&(u=A(u,{x:0,y:0,z:s*Gt})),m&16&&(u=A(u,{x:0,y:0,z:-s*Gt}));let c=I(u),f=c===0?{x:0,y:0,z:0}:z(u);if(c>r){let y=r/c;u=E(u,y),c=r,f=c===0?{x:0,y:0,z:0}:z(u)}let p=c*2;return{wishdir:f,wishspeed:c,accelSpeed:p}}function xe(t){let{origin:e,mins:o,viewheight:n,pointContents:r}=t,s=n-o.z,i=s/2,a={x:e.x,y:e.y,z:e.z+o.z+1},d=r(a);if((d&56)===0)return{waterlevel:0,watertype:0};let u=d,m=1,c={x:a.x,y:a.y,z:e.z+o.z+i};if(d=r(c),(d&56)!==0){m=2;let f={x:a.x,y:a.y,z:e.z+o.z+s};d=r(f),(d&56)!==0&&(m=3)}return{waterlevel:m,watertype:u}}var $n=270;function Qn(t,e){return(t&e)!==0}function er(t){let{pmFlags:e,pmType:o,buttons:n,waterlevel:r,onGround:s,velocity:i,jumpHeight:a=$n}=t;if(e&16)return{pmFlags:e,onGround:s,velocity:i,jumpSound:!1,jumped:!1};let d=Qn(n,8),u=e,m=s,c=!1,f=!1,p=i;if(!d)return u=H(u,2),{pmFlags:u,onGround:m,velocity:p,jumpSound:c,jumped:f};if(tr(u))return{pmFlags:u,onGround:m,velocity:p,jumpSound:c,jumped:f};if(o===4)return{pmFlags:u,onGround:m,velocity:p,jumpSound:c,jumped:f};if(r>=2)return m=!1,{pmFlags:u,onGround:m,velocity:p,jumpSound:c,jumped:f};if(!m)return{pmFlags:u,onGround:m,velocity:p,jumpSound:c,jumped:f};u=B(u,2),u=H(u,4),m=!1,c=!0,f=!0;let y=i.z+a,T=y<a?a:y;return p={...i,z:T},{pmFlags:u,onGround:m,velocity:p,jumpSound:c,jumped:f}}function tr(t){return(t&2)!==0}function Fe(t,e,o){return{x:t,y:e,z:o}}function Le(t,e){let o=Fe(-16,-16,0),n=Fe(16,16,16);if(t===5)return{mins:o,maxs:n,viewheight:8};let r=t===4||(e&1)!==0,s=Fe(o.x,o.y,-24),i=Fe(n.x,n.y,r?4:32);return{mins:s,maxs:i,viewheight:r?-2:22}}var or=4,nr=32,rr=8;function sr(t){let{pmType:e}=t;if(e===5){let i=Le(e,t.pmFlags);return{pmFlags:t.pmFlags,ducked:M(t.pmFlags,1),changed:!1,...i}}let o=t.pmFlags,n=!1;e===4?M(o,1)||(o=B(o,1),n=!0):ir(t)?!M(o,1)&&!ar(t)&&(o=B(o,1),n=!0):M(o,1)&&!cr(t)&&(o=H(o,1),n=!0);let r=Le(e,o),s=e===4||M(o,1);return{pmFlags:o,ducked:s,changed:n,...r}}function ir(t){return(t.buttons&16)===0||t.onLadder||t.n64Physics?!1:!!(t.hasGroundEntity||t.waterlevel<=1&&!lr(t))}function ar(t){return t.trace({start:t.origin,end:t.origin,mins:t.mins,maxs:Ht(t.maxs,or),mask:3}).allsolid}function cr(t){return t.trace({start:t.origin,end:t.origin,mins:t.mins,maxs:Ht(t.maxs,nr),mask:3}).allsolid}function lr(t){let e={x:t.origin.x,y:t.origin.y,z:t.origin.z-rr};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 Ht(t,e){return{x:t.x,y:t.y,z:e}}var ur=.25,dr=180,mr=100,fr=.7,pr=.9,yr=64,xr=128,hr=1.01,Sr=1080;function br(t){let{pmType:e,n64Physics:o,velocity:n,startVelocity:r,origin:s,mins:i,maxs:a,viewheight:d,trace:u,pointContents:m}=t,c=t.pmFlags,f=t.pmTime,p,y=M(c,4),T,S=0;if(n.z>dr||e===1)c=H(c,4),y=!1;else{let b={x:s.x,y:s.y,z:s.z-ur},x=u(s,b,i,a);T=x,S=x.contents??0;let P=x.planeNormal,g=x.fraction<1&&!!P&&P.z<fr;if(g&&P){let v=A(s,P),U=u(s,v,i,a);U.fraction<1&&!U.startsolid&&(g=!1)}if(x.fraction===1||!P||g&&!x.startsolid)c=H(c,4),y=!1;else{y=!0,M(c,8)&&(c&=~Sr,f=0);let v=M(c,4);if(!v){!o&&n.z>=mr&&P.z>=pr&&!M(c,1)&&(c=B(c,1024),f=yr);let U=$(n,P,hr);p=r.z-U.z}c=B(c,4),!v&&(o||M(c,1))&&(c=B(c,16),f=xr)}}let{waterlevel:N,watertype:_}=xe({origin:s,mins:i,viewheight:d,pointContents:m});return{pmFlags:c,pmTime:f,onGround:M(c,4),groundTrace:T,groundContents:S,waterlevel:N,watertype:_,impactDelta:p}}var Kt=1,Vr=60,ct=1.01;function Tr(t){let{origin:e,frametime:o,mins:n,maxs:r,trace:s,overbounce:i=ct,stepSize:a,maxBumps:d,maxClipPlanes:u,hasTime:m,forward:c,right:f,cmd:p,pmFlags:y,onGround:T,gravity:S,pmType:V,pmAccelerate:N,pmAirAccelerate:_=Kt,pmMaxSpeed:b,pmDuckSpeed:x,onLadder:P,waterlevel:g,watertype:v,groundContents:U,viewPitch:h,ladderMod:R,pmWaterSpeed:w}=t,C={...t.velocity},W=_r(c,f,p);W=ze({wishVelocity:W,onLadder:P,onGround:T,waterlevel:g,watertype:v,groundContents:U,cmd:p,viewPitch:h,maxSpeed:M(y,1)?x:b,ladderMod:R,waterSpeed:w,forward:c,origin:e,mins:n,maxs:r,trace:s});let D=M(y,1)?x:b,k=W,F=I(k);if(F!==0&&(k=z(k)),F>D){let j=D/F;W=E(W,j),F=D,F!==0&&(k=z(W))}return P?(C=K({velocity:C,wishdir:k,wishspeed:F,accel:N,frametime:o}),Math.abs(W.z)<Number.EPSILON&&(C=Ar(C,S,o)),Me({origin:e,velocity:C,frametime:o,mins:n,maxs:r,trace:s,overbounce:i,stepSize:a,maxBumps:d,maxClipPlanes:u,hasTime:m})):T?(C={...C,z:0},C=K({velocity:C,wishdir:k,wishspeed:F,accel:N,frametime:o}),S>0?C={...C,z:0}:C={...C,z:C.z-S*o},C.x===0&&C.y===0?{origin:e,velocity:C,planes:[],blocked:0,stopped:!0,stepped:!1,stepHeight:0}:Me({origin:e,velocity:C,frametime:o,mins:n,maxs:r,trace:s,overbounce:i,stepSize:a,maxBumps:d,maxClipPlanes:u,hasTime:m})):(_>0?C=et({velocity:C,wishdir:k,wishspeed:F,accel:_,frametime:o}):C=K({velocity:C,wishdir:k,wishspeed:F,accel:Kt,frametime:o}),V!==1&&(C={...C,z:C.z-S*o}),Me({origin:e,velocity:C,frametime:o,mins:n,maxs:r,trace:s,overbounce:i,stepSize:a,maxBumps:d,maxClipPlanes:u,hasTime:m}))}function Pr(t){let{origin:e,frametime:o,mins:n,maxs:r,trace:s,overbounce:i=ct,stepSize:a,maxBumps:d,maxClipPlanes:u,hasTime:m,forward:c,right:f,cmd:p,pmFlags:y,onGround:T,pmMaxSpeed:S,pmDuckSpeed:V,pmWaterAccelerate:N,pmWaterSpeed:_,onLadder:b,watertype:x,groundContents:P,waterlevel:g,viewPitch:v,ladderMod:U}=t,h={...t.velocity},R=Cr(c,f,p);Nr(p,T)?R={...R,z:R.z-Vr}:Xt(p,16)?R=A(R,{x:0,y:0,z:-_*.5}):Xt(p,8)&&(R=A(R,{x:0,y:0,z:_*.5})),R=ze({wishVelocity:R,onLadder:b,onGround:T,waterlevel:g,watertype:x,groundContents:P,cmd:p,viewPitch:v,maxSpeed:M(y,1)?V:S,ladderMod:U,waterSpeed:_,forward:c,origin:e,mins:n,maxs:r,trace:s});let w=R,C=I(w);if(C!==0&&(w=z(w)),C>S){let X=S/C;R=E(R,X),C=S,C!==0&&(w=z(R))}if(C*=.5,M(y,1)&&C>V){let X=V/C;R=E(R,X),C=V,C!==0&&(w=z(R))}return h=K({velocity:h,wishdir:w,wishspeed:C,accel:N,frametime:o}),Me({origin:e,velocity:h,frametime:o,mins:n,maxs:r,trace:s,overbounce:i,stepSize:a,maxBumps:d,maxClipPlanes:u,hasTime:m})}function _r(t,e,o){return{x:t.x*o.forwardmove+e.x*o.sidemove,y:t.y*o.forwardmove+e.y*o.sidemove,z:0}}function Cr(t,e,o){return{x:t.x*o.forwardmove+e.x*o.sidemove,y:t.y*o.forwardmove+e.y*o.sidemove,z:t.z*o.forwardmove+e.z*o.sidemove}}function Xt(t,e){return!!((t.buttons??0)&e)}function Nr(t,e){let o=t.forwardmove===0&&t.sidemove===0,n=!((t.buttons??0)&24);return o&&n&&!e}function Ar(t,e,o){let n=t.z,r=e*o;return n>0?(n-=r,n<0&&(n=0)):(n+=r,n>0&&(n=0)),{...t,z:n}}function Me(t){let{origin:e,velocity:o,frametime:n,mins:r,maxs:s,trace:i,overbounce:a=ct,stepSize:d,maxBumps:u,maxClipPlanes:m,hasTime:c}=t;return oe({origin:e,velocity:o,frametime:n,trace:i,mins:r,maxs:s,overbounce:a,stepSize:d,maxBumps:u,maxClipPlanes:m,hasTime:c})}var Er=1,Rr=40,we=50,Jt=350,gr=2048,jt=.1,Or=800,vr=50,Yt=.7,zr=18,Fr=1.01,Lr=2;function Mr(t){let{pmFlags:e,pmTime:o,waterlevel:n,watertype:r,gravity:s,cmd:i,forward:a,origin:d,velocity:u,mins:m,maxs:c,viewheight:f,trace:p,pointContents:y,onGround:T,overbounce:S=Fr,stepSize:V=zr,maxBumps:N,maxClipPlanes:_}=t;if(o>0)return{pmFlags:e,pmTime:o,velocity:u,performedWaterJump:!1};let b=H(e,128),x=o,P=u,g=z({x:a.x,y:a.y,z:0}),v=ne(g)>0;if(n<2&&v){let F=A(d,E(g,Er)),j=p(d,F,m,c),Qt=j.contents??0;j.fraction<1&&(Qt&536870912)!==0&&(b=B(b,128))}if(s===0)return{pmFlags:b,pmTime:x,velocity:P,performedWaterJump:!1};if(((i.buttons??0)&8)===0&&i.forwardmove<=0)return{pmFlags:b,pmTime:x,velocity:P,performedWaterJump:!1};if(n!==2)return{pmFlags:b,pmTime:x,velocity:P,performedWaterJump:!1};if((r&8192)!==0)return{pmFlags:b,pmTime:x,velocity:P,performedWaterJump:!1};if(!v)return{pmFlags:b,pmTime:x,velocity:P,performedWaterJump:!1};let U=A(d,E(g,Rr)),h=p(d,U,m,c);if(h.fraction===1||!h.planeNormal||h.planeNormal.z>=Yt)return{pmFlags:b,pmTime:x,velocity:P,performedWaterJump:!1};let R={x:g.x*we,y:g.y*we,z:Jt},w=d,C=!0,W=wr(s);for(let F=0;F<W;F++){R={x:R.x,y:R.y,z:R.z-s*jt},R.z<0&&(C=!1);let j=oe({origin:w,velocity:R,frametime:jt,trace:p,mins:m,maxs:c,overbounce:S,stepSize:V,maxBumps:N,maxClipPlanes:_,hasTime:C});w=j.origin,R=j.velocity}let X=A(w,{x:0,y:0,z:-Lr}),D=p(w,X,m,c);return D.fraction===1||!D.planeNormal||D.planeNormal.z<Yt||D.endpos.z<d.z?{pmFlags:b,pmTime:x,velocity:P,performedWaterJump:!1}:T&&Math.abs(d.z-D.endpos.z)<=V?{pmFlags:b,pmTime:x,velocity:P,performedWaterJump:!1}:xe({origin:D.endpos,mins:m,viewheight:f,pointContents:y}).waterlevel>=2?{pmFlags:b,pmTime:x,velocity:P,performedWaterJump:!1}:(b=B(b,8),x=gr,P={x:g.x*we,y:g.y*we,z:Jt},{pmFlags:b,pmTime:x,velocity:P,performedWaterJump:!0})}function wr(t){if(t===0)return 0;let e=Math.floor(10*(Or/t));return e<=0?0:Math.min(vr,e)}var lt=[0,-1,1];function ut(t){let{origin:e,mins:o,maxs:n,trace:r}=t;return!r(e,e,o,n).allsolid}function Dr(t){let{origin:e,velocity:o,mins:n,maxs:r,previousOrigin:s,trace:i}=t;if(ut({origin:e,mins:n,maxs:r,trace:i}))return{origin:{...e},velocity:{...o},resolution:"unchanged"};let a=st({origin:e,mins:n,maxs:r,trace:(d,u,m,c)=>i(d,c,u,m)});return a.result==="fixed"||a.result==="good-position"?{origin:a.origin,velocity:{...o},resolution:"fixed"}:{origin:{...s},velocity:{...o},resolution:"reverted"}}function Ir(t){let{origin:e,mins:o,maxs:n,trace:r}=t;for(let s of lt)for(let i of lt)for(let a of lt){let d={x:e.x+a,y:e.y+i,z:e.z+s};if(ut({origin:d,mins:o,maxs:n,trace:r}))return{origin:d,snapped:a!==0||i!==0||s!==0}}return{origin:{...e},snapped:!1}}function Wr(t,e){return{x:t.x+e.x,y:t.y+e.y,z:t.z+e.z}}function Br(t){return t>89&&t<180?89:t<271&&t>=180?271:t}function Ur(t){let{pmFlags:e,cmdAngles:o,deltaAngles:n}=t,r;(e&32)!==0?r={x:0,y:o.y+n.y,z:0}:(r=Wr(o,n),r={...r,x:Br(r.x)});let s=Ue(r);return{viewangles:r,...s}}var kr=200,Gr=200,Hr=200,Kr=140,Xr=150,Jr=3;function jr(t){let e=me(t);return e>89&&e<180?89:e<271&&e>=180?271:e}function Yr(t,e){return{x:jr(t.x+e.x),y:me(t.y+e.y),z:me(t.z+e.z)}}function Zr(t,e){let o=e.sensitivityX??e.sensitivity,n=(e.sensitivityY??e.sensitivity)*(e.invertY?-1:1);return{x:t.deltaY*n,y:t.deltaX*o,z:0}}var Zt=(x=>(x[x.bad=0]="bad",x[x.muzzleflash=1]="muzzleflash",x[x.muzzleflash2=2]="muzzleflash2",x[x.temp_entity=3]="temp_entity",x[x.layout=4]="layout",x[x.inventory=5]="inventory",x[x.nop=6]="nop",x[x.disconnect=7]="disconnect",x[x.reconnect=8]="reconnect",x[x.sound=9]="sound",x[x.print=10]="print",x[x.stufftext=11]="stufftext",x[x.serverdata=12]="serverdata",x[x.configstring=13]="configstring",x[x.spawnbaseline=14]="spawnbaseline",x[x.centerprint=15]="centerprint",x[x.download=16]="download",x[x.playerinfo=17]="playerinfo",x[x.packetentities=18]="packetentities",x[x.deltapacketentities=19]="deltapacketentities",x[x.frame=20]="frame",x))(Zt||{}),qt=(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))(qt||{});var $t=(l=>(l[l.GUNSHOT=0]="GUNSHOT",l[l.BLOOD=1]="BLOOD",l[l.BLASTER=2]="BLASTER",l[l.RAILTRAIL=3]="RAILTRAIL",l[l.SHOTGUN=4]="SHOTGUN",l[l.EXPLOSION1=5]="EXPLOSION1",l[l.EXPLOSION2=6]="EXPLOSION2",l[l.ROCKET_EXPLOSION=7]="ROCKET_EXPLOSION",l[l.GRENADE_EXPLOSION=8]="GRENADE_EXPLOSION",l[l.SPARKS=9]="SPARKS",l[l.SPLASH=10]="SPLASH",l[l.BUBBLETRAIL=11]="BUBBLETRAIL",l[l.SCREEN_SPARKS=12]="SCREEN_SPARKS",l[l.SHIELD_SPARKS=13]="SHIELD_SPARKS",l[l.BULLET_SPARKS=14]="BULLET_SPARKS",l[l.LASER_SPARKS=15]="LASER_SPARKS",l[l.PARASITE_ATTACK=16]="PARASITE_ATTACK",l[l.ROCKET_EXPLOSION_WATER=17]="ROCKET_EXPLOSION_WATER",l[l.GRENADE_EXPLOSION_WATER=18]="GRENADE_EXPLOSION_WATER",l[l.MEDIC_CABLE_ATTACK=19]="MEDIC_CABLE_ATTACK",l[l.BFG_EXPLOSION=20]="BFG_EXPLOSION",l[l.BFG_BIGEXPLOSION=21]="BFG_BIGEXPLOSION",l[l.BOSSTPORT=22]="BOSSTPORT",l[l.BFG_LASER=23]="BFG_LASER",l[l.GRAPPLE_CABLE=24]="GRAPPLE_CABLE",l[l.WELDING_SPARKS=25]="WELDING_SPARKS",l[l.GREENBLOOD=26]="GREENBLOOD",l[l.BLUEHYPERBLASTER=27]="BLUEHYPERBLASTER",l[l.PLASMA_EXPLOSION=28]="PLASMA_EXPLOSION",l[l.TUNNEL_SPARKS=29]="TUNNEL_SPARKS",l[l.BLASTER2=30]="BLASTER2",l[l.RAILTRAIL2=31]="RAILTRAIL2",l[l.FLAME=32]="FLAME",l[l.LIGHTNING=33]="LIGHTNING",l[l.DEBUGTRAIL=34]="DEBUGTRAIL",l[l.PLAIN_EXPLOSION=35]="PLAIN_EXPLOSION",l[l.FLASHLIGHT=36]="FLASHLIGHT",l[l.FORCEWALL=37]="FORCEWALL",l[l.HEATBEAM=38]="HEATBEAM",l[l.MONSTER_HEATBEAM=39]="MONSTER_HEATBEAM",l[l.STEAM=40]="STEAM",l[l.BUBBLETRAIL2=41]="BUBBLETRAIL2",l[l.MOREBLOOD=42]="MOREBLOOD",l[l.HEATBEAM_SPARKS=43]="HEATBEAM_SPARKS",l[l.HEATBEAM_STEAM=44]="HEATBEAM_STEAM",l[l.CHAINFIST_SMOKE=45]="CHAINFIST_SMOKE",l[l.ELECTRIC_SPARKS=46]="ELECTRIC_SPARKS",l[l.TRACKER_EXPLOSION=47]="TRACKER_EXPLOSION",l[l.TELEPORT_EFFECT=48]="TELEPORT_EFFECT",l[l.DBALL_GOAL=49]="DBALL_GOAL",l[l.WIDOWBEAMOUT=50]="WIDOWBEAMOUT",l[l.NUKEBLAST=51]="NUKEBLAST",l[l.WIDOWSPLASH=52]="WIDOWSPLASH",l[l.EXPLOSION1_BIG=53]="EXPLOSION1_BIG",l[l.EXPLOSION1_NP=54]="EXPLOSION1_NP",l[l.FLECHETTE=55]="FLECHETTE",l[l.BLUEHYPERBLASTER_KEX=56]="BLUEHYPERBLASTER_KEX",l[l.BFG_ZAP=57]="BFG_ZAP",l[l.BERSERK_SLAM=58]="BERSERK_SLAM",l[l.GRAPPLE_CABLE_2=59]="GRAPPLE_CABLE_2",l[l.POWER_SPLASH=60]="POWER_SPLASH",l[l.LIGHTNING_BEAM=61]="LIGHTNING_BEAM",l[l.EXPLOSION1_NL=62]="EXPLOSION1_NL",l[l.EXPLOSION2_NL=63]="EXPLOSION2_NL",l))($t||{});var qr=1024,$r=256,Qr=16,es=512,ts=1400;var dt={};Ie(dt,{U_ANGLE1:()=>cs,U_ANGLE2:()=>ls,U_ANGLE3:()=>us,U_EFFECTS:()=>fs,U_EVENT:()=>xs,U_FRAME:()=>ds,U_MODEL:()=>ns,U_MODEL2:()=>Ss,U_MODEL3:()=>bs,U_MODEL4:()=>Vs,U_MOREBITS:()=>hs,U_NUMBER:()=>os,U_ORIGIN1:()=>ss,U_ORIGIN2:()=>is,U_ORIGIN3:()=>as,U_REMOVE:()=>Ts,U_RENDERFX:()=>ps,U_SKIN:()=>ms,U_SOLID:()=>ys,U_SOUND:()=>rs});var os=1,ns=2,rs=4,ss=8,is=16,as=32,cs=64,ls=128,us=256,ds=512,ms=1024,fs=2048,ps=4096,ys=8192,xs=16384,hs=32768,Ss=1,bs=2,Vs=4,Ts=32768;var he=.025,Ps=(t,e)=>{let o={...t.origin};o.z-=.25;let n=e(t.origin,o);return{...t,onGround:n.fraction<1}},_s=(t,e)=>{let o={...t.origin};return o.z+=t.mins.z+1,e(o)&33554432?{...t,waterLevel:1}:{...t,waterLevel:0}},Cs=(t,e,o,n)=>{let r={...t};r=Ps(r,o),r=_s(r,n);let{origin:s,velocity:i,onGround:a,waterLevel:d}=r,u=Qe({velocity:i,frametime:he,onGround:a,groundIsSlick:!1,onLadder:!1,waterlevel:d,pmFriction:6,pmStopSpeed:100,pmWaterFriction:1}),m=d>=2?ot({forward:{x:1,y:0,z:0},right:{x:0,y:1,z:0},cmd:e,maxSpeed:320}):tt({forward:{x:1,y:0,z:0},right:{x:0,y:1,z:0},cmd:e,maxSpeed:320}),c=K({velocity:u,wishdir:m.wishdir,wishspeed:m.wishspeed,accel:a?10:1,frametime:he}),f=o(s,{x:s.x+c.x*he,y:s.y+c.y*he,z:s.z+c.z*he});return{...r,origin:f.endpos,velocity:c}};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}readLong(){let e=this.view.getInt32(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 o=this.readChar();if(o===-1||o===0)break;e+=String.fromCharCode(o)}return e}readStringLine(){let e="";for(;this.offset<this.length;){let o=this.readChar();if(o===-1||o===0||o===10)break;e+=String.fromCharCode(o)}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 o=new Uint8Array(this.view.buffer,this.view.byteOffset+this.offset,e);return this.offset+=e,new Uint8Array(o)}readPos(e){e.x=this.readCoord(),e.y=this.readCoord(),e.z=this.readCoord()}readDir(e){let o=this.readByte();if(o>=162){e.x=0,e.y=0,e.z=0;return}let n=re[o];e.x=n[0],e.y=n[1],e.z=n[2]}};var ft=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 o=Math.max(this.buffer.byteLength*2,this.offset+e),n=new Uint8Array(o);n.set(this.buffer),this.buffer=n,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 o=e.length;this.ensureSpace(o+1);for(let n=0;n<o;n++)this.view.setUint8(this.offset+n,e.charCodeAt(n));this.view.setUint8(this.offset+o,0),this.offset+=o+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 o=-1,n=0;if(e.x===0&&e.y===0&&e.z===0){this.writeByte(0);return}for(let r=0;r<re.length;r++){let s=re[r],i=e.x*s[0]+e.y*s[1]+e.z*s[2];i>o&&(o=i,n=r)}this.writeByte(n)}getData(){return this.buffer.slice(0,this.offset)}getBuffer(){return this.buffer}getOffset(){return this.offset}reset(){this.offset=0}};return ro(Ns);})();
|
|
2
2
|
//# sourceMappingURL=index.global.js.map
|