2026-04-08 23:48:42 -07:00
|
|
|
import{A as e,E as t,M as n,a as r,b as i,f as a,l as o,n as s,r as c,t as l,v as u,x as d,y as f}from"./streamHelpers-CYLk-lCT.js";import{i as p}from"./scene-C20n9V3Y.js";import{L as m}from"./index-BZ0wFa-D.js";function h(e){let t=null,n=null,r=null,i=null,a=null,o=null,s=NaN,c=null;for(let l=0;l<e.length;l++){let d=e[l].split(` `);if(d.length>=3&&d[1]?.endsWith(`Game`)&&(r=d[1]),e[l]!==`readplayerinfo`)continue;let f=e[l+1];if(f){if(f.startsWith(`1 `)){let e=f.split(` `);e[1]&&(s=parseInt(e[1],10)),e[2]&&(o=u(e[2]).trim());continue}if(f.startsWith(`2 `)){let e=f.split(` `);e[1]&&(i=e[1]),e[3]&&(c=e[3]),e[4]&&(t=e[4]);continue}if(f.startsWith(`3 `)){let e=f.split(` `);e[1]&&(a=e[1]),e[2]&&(n=e[2])}}}return{missionDisplayName:t,missionType:n,gameClassName:r,serverDisplayName:i,mod:a,recorderName:o,recorderClientId:Number.isFinite(s)?s:null,recordingDate:c}}function g(e){let t={weaponsHud:null,backpackHud:null,inventoryHud:null,teamScores:[],playerRoster:new Map,chatMessages:[],clockTimeMin:null,gravity:-20};if(!e.length)return t;let n=0,r=()=>{let t=e[n++];return t===`<BLANK>`?``:t??``};if(r(),n>=e.length)return t;let i=parseInt(r(),10)||0,a=new Map;for(let e=0;e<i;e++){let e=r().split(` `),n=u(e[0]??``).trim(),i=parseInt(e[2],10),o=parseInt(e[4],10),s=parseInt(e[5],10)||0,c=parseInt(e[6],10)||0,l=parseInt(e[7],10)||0;!isNaN(i)&&!isNaN(o)&&t.playerRoster.set(i,{name:n,teamId:o,score:s,ping:c,packetLoss:l}),!isNaN(o)&&o>0&&a.set(o,(a.get(o)??0)+1)}if(n>=e.length||(r(),n>=e.length))return t;{let e=r().split(` `),n=e[0]??``,i=e[1]===`1`||e[1]===`true`,a=e[2]??``,o=e[4]===`1`||e[4]===`true`;i&&n&&(t.backpackHud={packIndex:s(n),active:o,text:a})}if(n>=e.length)return t;let o=r().split(` `),c=parseInt(o[4],10)||0,l=parseInt(o[5],10)||0,d=parseInt(o[6],10);for(let e=0;e<c;e++)r();let f=new Map;for(let e=0;e<l;e++){let e=r().split(` `),t=parseInt(e[0],10),n=parseInt(e[1],10);isNaN(t)||f.set(t,isNaN(n)?-1:n)}if(t.weaponsHud={slots:f,activeIndex:isNaN(d)?-1:d},n>=e.length)return t;let p=r().split(` `),m=parseInt(p[4],10)||0,h=parseInt(p[5],10)||0,g=parseInt(p[6],10);for(let e=0;e<m;e++)r();{let e=new Map;for(let t=0;t<h;t++){let t=r().split(` `),n=parseInt(t[0],10),i=parseInt(t[1],10);!isNaN(n)&&!isNaN(i)&&i>0&&e.set(n,i)}e.size>0&&(t.inventoryHud={slots:e,activeSlot:isNaN(g)?-1:g})}if(n>=e.length)return t;let _=r().split(` `),v=_[1]??``,y=parseInt(_[2],10)||0,b=[];for(let e=0;e<y;e++)b.push(r());if(v===`CTFGame`&&y>=8)for(let e=0;e<2;e++){let n=e*4,r=e+1;t.teamScores.push({teamId:r,name:b[n]??``,score:parseInt(b[n+1],10)||0,playerCount:a.get(r)??0})}else if(v===`TR2Game`&&y>=4)for(let e=0;e<2;e++){let n=e*2,r=e+1;t.teamScores.push({teamId:r,name:b[n+1]??``,score:parseInt(b[n],10)||0,playerCount:a.get(r)??0})}if(n>=e.length)return t;{let e=r().split(` `),n=parseFloat(e[1]??``);Number.isFinite(n)&&(t.clockTimeMin=n)}for(let i=0;i<10&&!(n>=e.length);i++){let e=r();e&&t.chatMessages.push(e)}if(n<e.length){let e=parseFloat(r());Number.isFinite(e)&&(t.gravity=e)}return t}var _=class extends m{parser;initialBlock;moveTicks=0;absoluteYaw=0;absolutePitch=0;lastAbsYaw=0;lastAbsPitch=0;exhausted=!1;_teamScoresGen=0;_rosterGen=0;_weaponsHudGen=0;_inventoryHudGen=0;_cachedSnapshot=null;_cachedSnapshotTick=-1;_cachedSnapshotGen=-1;_snap=null;constructor(e){super(),this.parser=e,this.registry=e.getRegistry(),this.ghostTracker=e.getGhostTracker();let t=e.initialBlock;this.initialBlock={dataBlocks:t.dataBlocks,initialGhosts:t.initialGhosts,controlObjectGhostIndex:t.controlObjectGhostIndex,controlObjectData:t.controlObjectData,targetEntries:t.targetEntries,sensorGroupColors:t.sensorGroupColors,taggedStrings:t.taggedStrings,initialEvents:t.initialEvents,demoValues:t.demoValues,firstPerson:t.firstPerson},this.reset()}getDataBlockData(e){let t=this.initialBlock.dataBlocks.get(e);return t?.data?t.data:this.parser.getPacketParser().dataBlockDataMap?.get(e)}_shapeConstructorCache=null;getShapeConstructorSequences(e){if(!this._shapeConstructorCache){this._shapeConstructorCache=new Map;for(let[,e]of this.initialBlock.dataBlocks){if(e.className!==`TSShape
|