fiverunner 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/assets/{index-BIEQGv2-.js → index-BUYlg8Xi.js} +1 -1
- package/dist/dev/assets/{module-ES6BEMUI-CruD6PV8.js → module-ES6BEMUI-B3C8EMJw.js} +1 -1
- package/dist/dev/assets/{worker-BfZwl0oS.js → worker-BAR8L3pe.js} +2 -2
- package/dist/dev/index.html +1 -1
- package/dist/fiverunner.js +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./routes-DFIWFSAi.js";var t=`/__fiverunner/api/`;new TextDecoder;function n(e,t){let n=document.createElement(`label`);return n.append(t,e),n}function r(e,t){switch(e.type){case`TextBlock`:{let t=document.createElement(`p`);return t.textContent=e.text??``,t.classList.toggle(`large`,/large/i.test(e.size??``)),t.classList.toggle(`bold`,e.weight===`Bolder`),[t]}case`Input.Text`:case`Input.Number`:{let n=document.createElement(e.isMultiline?`textarea`:`input`);return n.placeholder=e.placeholder??``,n.value=e.value??``,n.ariaLabel=e.placeholder??e.id??``,t.set(e.id??``,()=>n.value),[n]}case`Input.Toggle`:{let r=document.createElement(`input`);r.type=`checkbox`;let i=e.valueOn??`true`;return r.checked=e.value===i,t.set(e.id??``,()=>r.checked?i:e.valueOff??`false`),[n(e.title??``,r)]}case`Input.ChoiceSet`:{let n=document.createElement(`select`);n.ariaLabel=e.id??``;for(let{title:t,value:r}of e.choices??[])n.add(new Option(t,r));return n.value=e.value??n.value,t.set(e.id??``,()=>n.value),[n]}case`Container`:case`Column`:return i(e.items??[],t);case`ColumnSet`:return i(e.columns??[],t);default:return}}function i(e,t){let n=e.map(e=>r(e,t));return n.every(e=>e!==void 0)?n.flat():void 0}function a(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=new Map,a=i(n.body??[],r);if(a===void 0)return;let o=document.createElement(`form`);o.className=`adaptive`,o.addEventListener(`submit`,e=>e.preventDefault()),o.append(...a);for(let e of n.actions??[]){if(e.type!==`Action.Submit`)return;let n=document.createElement(`button`);n.textContent=e.title??`Submit`,n.addEventListener(`click`,()=>{let n=Object.fromEntries([...r].map(([e,t])=>[e,t()])),i=e.id===void 0?{}:{submitId:e.id};t(JSON.stringify({...n,...e.data,...i}))}),o.append(n)}return o}var o=[``,`red`,`green`,`yellow`,`blue`,`cyan`,`magenta`,``,`orange`,`gray`],s=2e3,c=class{element;constructor(e){this.element=e}add(e){this.entry(e.channel,e.text,`kind-${e.kind}`)}entry(e,t,n){let r=document.createElement(`div`);r.className=`line ${n}`;let i=document.createElement(`span`);i.className=`channel`,i.textContent=`[${e}] `,r.append(i,...u(t)),this.#e(r)}note(e){let t=document.createElement(`div`);t.className=`line note`,t.textContent=e,this.#e(t)}#e(e){let{element:t}=this,n=t.scrollHeight-t.scrollTop-t.clientHeight<4;for(t.append(e);t.childElementCount>s;)t.firstElementChild.remove();n&&(t.scrollTop=t.scrollHeight)}};function l(e){let t=[],n=0;return e.addEventListener(`keydown`,r=>{(r.key===`ArrowUp`||r.key===`ArrowDown`)&&(r.preventDefault(),n=Math.max(0,Math.min(t.length,n+(r.key===`ArrowUp`?-1:1))),e.value=t[n]??``)}),e=>{t.push(e),n=t.length}}function u(e){let t=[],n=``;for(let[r,i]of e.split(/\^(\d)/).entries())if(r%2==1)n=o[Number(i)]??``;else if(i!==``){let e=document.createElement(`span`);n!==``&&(e.className=`color-${n}`),e.textContent=i,t.push(e)}return t}var d=class{#e;#t;#n=new Map;constructor(e,t,n){this.#e=new c(e),this.#t=t.elements.namedItem(`target`);let r=t.elements.namedItem(`name`),i=t.elements.namedItem(`args`);t.addEventListener(`submit`,e=>{e.preventDefault();let t=f(this.#t.value);if(t===void 0||r.value.trim()===``)return;let a;try{a=JSON.parse(i.value.trim()===``?`[]`:i.value)}catch(e){this.#e.note(`The arguments are no JSON: ${String(e)}`);return}Array.isArray(a)?n.emit(r.value.trim(),a,t):this.#e.note(`The arguments are a JSON array, such as [100, "cash"]`)}),this.players([])}add({from:e,to:t,name:n,args:r}){this.#e.entry(`${this.#r(e)} -> ${this.#r(t)}`,`${n}(${r})`,`kind-event`)}note(e){this.#e.note(e)}players(e){this.#n.clear();for(let{client:t,name:n}of e)this.#n.set(t,n);let t=e.filter(({state:e})=>e===`joined`),n=[...t.map(({client:e,name:t})=>[`from:${e}`,`To the server, from ${t}`]),...t.map(({client:e,name:t})=>[`to:${e}`,`To ${t}, from the server`]),[`to:everyone`,`To every player, from the server`]],r=this.#t.value;this.#t.replaceChildren(...n.map(([e,t])=>{let n=document.createElement(`option`);return n.value=e,n.textContent=t,n})),n.some(([e])=>e===r)&&(this.#t.value=r)}#r(e){return e===`server`?`server`:this.#n.get(e)??`client ${e}`}};function f(e){let[t,n]=e.split(`:`);if(t===`to`&&n===`everyone`)return{to:`everyone`};let r=Number(n);if(!(!Number.isInteger(r)||r<1))return t===`from`?{from:r}:{to:r}}function p(e,t){if(t.length===0){let t=document.createElement(`p`);t.className=`empty`,t.textContent=`No state bag has keys.`,e.replaceChildren(t)}else e.replaceChildren(...t.map(({name:e,keys:t})=>{let n=document.createElement(`section`),r=document.createElement(`h3`);r.textContent=e;let i=document.createElement(`dl`);for(let{key:e,value:n}of t){let t=document.createElement(`dt`);t.textContent=e;let r=document.createElement(`dd`);r.textContent=n,i.append(t,r)}return n.append(r,i),n}))}var m=1e3,h=[[`Exports`,({exports:e})=>e],[`Events`,({events:e})=>e],[`NUI callbacks`,({nuiCallbacks:e})=>e],[`Commands`,({commands:e})=>e],[`Key mappings`,({keyMappings:e})=>e],[`KVP`,({kvp:e})=>e.map(({key:e,value:t})=>`${e} = ${t}`)]],g=e=>String(e),_=class{#e;#t;#n=new Map;#r;#i;#a=``;#o=``;constructor(e,t){this.#t=e,this.#e=t;let{process:n,form:r,code:i,filter:a}=e;this.players([]),n.addEventListener(`change`,()=>{this.#r=void 0,this.#c()});let o=l(i);r.addEventListener(`submit`,e=>{e.preventDefault(),i.value.trim()!==``&&this.#i!==void 0&&(t.evaluate(this.#s,this.#i,i.value),o(i.value),i.value=``)}),a.addEventListener(`input`,()=>this.#f()),setInterval(()=>this.#c(),m)}players(e){let{process:t}=this.#t,n=t.value,r=[[`server`,`Server`],...e.filter(({state:e})=>e===`joined`).map(({client:e,name:t})=>[g(e),t])];t.replaceChildren(...r.map(([e,t])=>{let n=document.createElement(`option`);return n.value=e,n.textContent=t,n})),t.value=r.some(([e])=>e===n)?n:`server`}show(e){if(e.process!==this.#s)return;this.#l(e),this.#r=e,this.#d();let t=JSON.stringify(e.convars);t!==this.#o&&(this.#o=t,this.#t.convars.replaceChildren(...e.convars.flatMap(({name:e,value:t})=>{let n=document.createElement(`dt`);n.textContent=e;let r=document.createElement(`dd`);return r.textContent=t,[n,r]})),this.#f())}get#s(){let{value:e}=this.#t.process;return e===`server`?e:Number(e)}#c(){document.hidden||this.#e.inspect(this.#s)}#l({resources:e,ticks:t}){let n=this.#t.resources,r=e.map(({name:e})=>e);r.join()!==[...this.#n.keys()].join()&&(this.#n.clear(),n.replaceChildren(...r.map(e=>this.#u(e))));let i=this.#r;for(let n of e){let e=this.#n.get(n.name);e.classList.toggle(`stopped`,n.state!==`started`),e.classList.toggle(`chosen`,n.name===this.#i);let r=i?.resources.find(({name:e})=>e===n.name),a=t-(i?.ticks??0);r!==void 0&&a>0&&(e.lastElementChild.textContent=`${((n.cpu-r.cpu)/a).toFixed(2)} ms`)}}#u(e){let t=document.createElement(`button`);t.type=`button`;let n=document.createElement(`span`);return n.textContent=e,t.append(n,document.createElement(`span`)),t.addEventListener(`click`,()=>{this.#i=e;for(let[t,n]of this.#n)n.classList.toggle(`chosen`,t===e);this.#d()}),this.#n.set(e,t),t}#d(){let e=this.#r?.resources.find(({name:e})=>e===this.#i),{details:t,code:n}=this.#t;n.disabled=e===void 0,n.placeholder=e===void 0?`Pick a resource to run code in it`:`Code to run in ${e.name}, such as GetNumResources()`;let r=JSON.stringify(e&&{...e,cpu:0});r!==this.#a&&(this.#a=r??``,e===void 0?t.textContent=`Pick a resource`:t.replaceChildren(...h.flatMap(([t,n])=>{let r=n(e);if(r.length===0)return[];let i=document.createElement(`h3`);i.textContent=`${t} (${r.length})`;let a=document.createElement(`ul`);return a.replaceChildren(...r.map(e=>{let t=document.createElement(`li`);return t.textContent=e,t})),[i,a]})))}#f(){let{convars:e,filter:t}=this.#t,n=t.value.trim().toLowerCase();for(let t of e.querySelectorAll(`dt`)){let e=!t.textContent.toLowerCase().includes(n);t.hidden=e,t.nextElementSibling.hidden=e}}},v=[657415,1708816,2497301,3351579,4140064,4994598,5914672,6834999,7755326,8675910,9662543,10649435,11570534,12360562,13085055,13743756,14336923,14864298,15326139,15721932,16051933,4004370,5382682,7023388,8729630,10370848,12078372,13393708,14251837,14914910,3874639,5580911,7485856,9523911,11894496,7149638,10231646,13184891,14899868,15765437,1780843,2311326,3106761,5215203,8830448,1003351,1407616,2073507,1923628,2787900,5749063,10802750,15255082,15769892,15232287,13185054,2829101,4474183,6250595,8158592,10263968,12369343,14343132,15987697],y=new Map([[8,`flag`],[40,`house`],[50,`car`],[52,`basket`],[56,`badge`],[59,`basket`],[60,`badge`],[61,`cross`],[67,`car`],[68,`lock`],[71,`scissors`],[72,`spray`],[73,`shirt`],[75,`heart`],[93,`bottle`],[102,`syringe`],[108,`dollar`],[110,`gun`],[198,`car`],[225,`car`],[273,`cutlery`],[326,`car`],[356,`boat`],[357,`parking`],[359,`plane`],[360,`plane`],[361,`fuel`],[366,`shirt`],[402,`wrench`],[403,`pill`],[423,`plane`],[424,`plane`],[427,`boat`],[477,`car`],[566,`anvil`],[729,`anchor`]]);function b(e){return y.get(e)}function x(e,t,n=!1){let r=0;for(let e=0;e<t.length;e+=2){let n=(e+2)%t.length;r+=t[e]*t[n+1]-t[n]*t[e+1]}let i=[...Array(t.length/2).keys()];r>0===n&&i.reverse(),i.forEach((n,r)=>{r===0?e.moveTo(t[2*n],t[2*n+1]):e.lineTo(t[2*n],t[2*n+1])}),e.closePath()}function S(e,t,n,r,i=!1){e.moveTo(t+r,n),e.arc(t,n,r,0,Math.PI*2,i),e.closePath()}function C(e,t){let n=new Path2D;return n.addPath(e,new DOMMatrix().rotate(t)),n}function w(e,t,n=0){let r=new Path2D;e(r);let i=n===0?r:C(r,n);return t===void 0?{path:i}:{path:i,width:t}}var T;function ee(){return{anchor:[w(e=>{S(e,0,-5.4,2.1),S(e,0,-5.4,1,!0),e.roundRect(-.95,-3.6,1.9,10.4,.6),e.roundRect(-3.8,-2.6,7.6,1.7,.85),x(e,[-7.4,1.2,-4.2,1.2,-5.8,3.6]),x(e,[7.4,1.2,4.2,1.2,5.8,3.6])}),w(e=>{e.moveTo(-5.8,2.4),e.quadraticCurveTo(-5,6.6,0,6.7),e.quadraticCurveTo(5,6.6,5.8,2.4)},1.7)],anvil:[w(e=>x(e,[-6.4,-4.4,4.2,-4.4,7.8,-3.4,4.6,-1.4,2.6,-1.4,2.6,1.6,4.8,4.4,4.8,6.2,-4.8,6.2,-4.8,4.4,-2.6,1.6,-2.6,-1.4,-6.4,-1.4]))],badge:[w(e=>{let t=[];for(let e=0;e<10;e++){let n=e*Math.PI/5-Math.PI/2,r=e%2==0?7.8:3.4;t.push(Math.cos(n)*r,Math.sin(n)*r+.6)}x(e,t)})],basket:[w(e=>{e.roundRect(-7.8,-2.4,15.6,2.4,1),x(e,[-6.8,-.4,6.8,-.4,5.2,6.6,-5.2,6.6]);for(let t of[-3.7,-.75,2.2])x(e,[t,1.2,t+1.5,1.2,t+1.5,5,t,5],!0)}),w(e=>{e.moveTo(-4.6,-2.4),e.arc(0,-2.4,4.6,Math.PI,Math.PI*2)},1.6)],boat:[w(e=>{x(e,[-7.6,2,7.6,2,5,6.6,-5,6.6]),x(e,[.6,-7.6,6,.8,.6,.8]),x(e,[-.6,-5.6,-.6,.8,-5,.8])})],bottle:[w(e=>{e.roundRect(-1.9,-7.8,3.8,1.6,.6),e.roundRect(-1.35,-6.6,2.7,3,.4),x(e,[-1.35,-4,1.35,-4,3.7,-1.4,-3.7,-1.4]),e.roundRect(-3.7,-2.4,7.4,10.2,1.8),x(e,[-2.3,.6,2.3,.6,2.3,4.2,-2.3,4.2],!0)})],car:[w(e=>{e.roundRect(-7.6,-1.6,15.2,5,1.8),x(e,[-4.8,-1.6,-2.9,-5.8,3.1,-5.8,5.2,-1.6]),x(e,[-2.9,-2.4,-.4,-2.4,-.4,-4.8,-2.1,-4.8],!0),x(e,[.5,-2.4,3.6,-2.4,2.6,-4.8,.5,-4.8],!0),S(e,-4.2,3.6,2.2),S(e,4.2,3.6,2.2)})],cross:[w(e=>{e.roundRect(-2.7,-7.4,5.4,14.8,1),e.roundRect(-7.4,-2.7,14.8,5.4,1)})],cutlery:[w(e=>{e.roundRect(-5.6,-3.4,5,2.6,1.3),x(e,[2,-7.6,4.9,-4.8,4.9,.6,2,.6])}),w(e=>{e.moveTo(-3.1,-1.4),e.lineTo(-3.1,7),e.moveTo(3.4,.6),e.lineTo(3.4,7)},1.9),w(e=>{for(let t of[-5,-3.1,-1.2])e.moveTo(t,-7.4),e.lineTo(t,-2.6)},1.1)],dollar:[w(e=>{e.moveTo(0,-7.6),e.lineTo(0,7.6)},1.6),w(e=>{e.moveTo(4.3,-3.9),e.bezierCurveTo(3.3,-6.3,-4.6,-6.3,-4.4,-2.6),e.bezierCurveTo(-4.2,.2,4.4,-.4,4.4,2.8),e.bezierCurveTo(4.4,6.5,-3.6,6.5,-4.6,3.8)},2.3)],flag:[w(e=>{e.roundRect(-5.4,-7.8,1.9,15.6,.9),e.moveTo(-3.8,-7.4),e.quadraticCurveTo(.8,-9.4,6.8,-6),e.quadraticCurveTo(.8,-2.4,-3.8,-1.2),e.closePath()})],fuel:[w(e=>{e.roundRect(-6.6,-7,8.6,14.4,1.6),x(e,[-5,-5.4,.4,-5.4,.4,-1.6,-5,-1.6],!0),e.roundRect(-7.6,5.6,10.6,1.8,.6)}),w(e=>{e.moveTo(2,-3.4),e.lineTo(4.6,-3.4),e.lineTo(5.8,-1.8),e.lineTo(5.8,4.2),e.quadraticCurveTo(5.8,5.4,4.6,5.2)},1.5)],gun:[w(e=>x(e,[-7.4,-4.6,7,-4.6,7,-1.4,-.4,-1.4,-1.1,1.8,-2.7,1.8,-3.6,6.6,-7.2,6.6,-5.7,-1.4,-7.4,-1.4])),w(e=>{e.moveTo(-.4,-1.4),e.quadraticCurveTo(.6,2.4,-2.4,2)},1.1)],heart:[w(e=>{S(e,-3.2,-2.4,3.8),S(e,3.2,-2.4,3.8),x(e,[-6.8,-1,6.8,-1,0,7])})],house:[w(e=>x(e,[0,-7.8,7.8,-.4,5.2,-.4,5.2,7.2,1.6,7.2,1.6,2.6,-1.6,2.6,-1.6,7.2,-5.2,7.2,-5.2,-.4,-7.8,-.4]))],lock:[w(e=>{e.moveTo(-3.7,-.6),e.lineTo(-3.7,-3.6),e.arc(0,-3.6,3.7,Math.PI,Math.PI*2),e.lineTo(3.7,-.6)},2),w(e=>{e.roundRect(-6.2,-1.8,12.4,9.4,1.8);let t=Math.sqrt(1.5**2-.6**2);e.moveTo(.6,1.8+t),e.arc(0,1.8,1.5,Math.atan2(t,.6),Math.atan2(t,-.6),!0),e.lineTo(-1,5.2),e.lineTo(1,5.2),e.closePath()})],parking:[w(e=>{e.roundRect(-7.2,-7.2,14.4,14.4,3),e.moveTo(-2.9,4.9),e.lineTo(-.8,4.9),e.lineTo(-.8,1.1),e.lineTo(.8,1.1),e.arc(.8,-1.9,3,Math.PI/2,-Math.PI/2,!0),e.lineTo(-2.9,-4.9),e.closePath(),e.moveTo(-.8,-3),e.lineTo(.7,-3),e.arc(.7,-1.9,1.1,-Math.PI/2,Math.PI/2),e.lineTo(-.8,-.8),e.closePath()})],pill:[w(e=>{e.roundRect(-3.1,-7.6,6.2,15.2,3.1),x(e,[-3.1,-.45,3.1,-.45,3.1,.45,-3.1,.45],!0)},void 0,45)],plane:[w(e=>{e.moveTo(0,-8),e.quadraticCurveTo(1.6,-7,1.6,-3),e.lineTo(8,1),e.lineTo(8,2.6),e.lineTo(1.6,.6),e.lineTo(1.1,5),e.lineTo(3.6,7),e.lineTo(3.6,8),e.lineTo(0,7),e.lineTo(-3.6,8),e.lineTo(-3.6,7),e.lineTo(-1.1,5),e.lineTo(-1.6,.6),e.lineTo(-8,2.6),e.lineTo(-8,1),e.lineTo(-1.6,-3),e.quadraticCurveTo(-1.6,-7,0,-8),e.closePath()})],scissors:[w(e=>{for(let t of[-3.5,3.5])S(e,t,4.3,2.8),S(e,t,4.3,1.35,!0);x(e,[-2.9,2,-1.3,2.5,3.9,-7.4,2.5,-7.8]),x(e,[2.9,2,1.3,2.5,-3.9,-7.4,-2.5,-7.8])})],shirt:[w(e=>{e.moveTo(-3,-7.2),e.lineTo(-7.8,-4.6),e.lineTo(-5.8,-.4),e.lineTo(-4.2,-1.4),e.lineTo(-4.2,7.2),e.lineTo(4.2,7.2),e.lineTo(4.2,-1.4),e.lineTo(5.8,-.4),e.lineTo(7.8,-4.6),e.lineTo(3,-7.2),e.quadraticCurveTo(0,-4.2,-3,-7.2),e.closePath()})],spray:[w(e=>{e.roundRect(-4.6,-3.2,7.2,11,1.6),x(e,[-3.4,0,1.4,0,1.4,3.4,-3.4,3.4],!0),e.roundRect(-3.2,-5.8,4.4,2.8,.8),e.roundRect(-1.8,-7.4,1.6,1.8,.4),S(e,2.6,-6.6,.9),S(e,4.6,-7.4,.8),S(e,4.8,-5.2,.9),S(e,6.8,-6.2,.8)})],syringe:[w(e=>{e.roundRect(-2.7,-4.2,5.4,8.2,.9),x(e,[-1.2,-2.8,1.2,-2.8,1.2,2.6,-1.2,2.6],!0),e.roundRect(-3.4,3.4,6.8,1.3,.5),e.roundRect(-.7,4.6,1.4,2.2,.3),e.roundRect(-2.6,6.6,5.2,1.3,.5),e.roundRect(-1,-5.4,2,1.4,.4),x(e,[-.55,-5.2,.55,-5.2,0,-8.4])},void 0,45)],wrench:[w(e=>{e.roundRect(-1.4,-1.4,2.8,9.4,1.4);let t=Math.sqrt(3.7**2-1.25**2);e.moveTo(1.25,-4.2-t),e.arc(0,-4.2,3.7,Math.atan2(-t,1.25),Math.atan2(-t,-1.25)+Math.PI*2),e.lineTo(-1.25,-3.5),e.lineTo(1.25,-3.5),e.closePath()},void 0,45)]}}function E(e,t,n,r=0){T??=ee();let i=T[t],a=n/16,o=e.fillStyle;if(e.save(),e.scale(a,a),e.lineJoin=`round`,e.lineCap=`round`,r>0)for(let{path:t,width:n}of i)e.lineWidth=(n??0)+r*2/a,e.stroke(t);e.strokeStyle=o;for(let{path:t,width:n}of i)n===void 0?e.fill(t):(e.lineWidth=n,e.stroke(t));e.restore()}var te=`#f0f0f0.#e04646.#6fcf6f.#5a9ef0.#f0f0f0.#f0d24a.#e57373.#b07ee0.#f080c0.#f0b070.#c8a070.#90e090.#80c8f0.#c8a0f0.#7050b0.#50d0d0.#f0e090.#f09030.#6aa8f0.#c05090.#c0a030.#d07020.#b0b0b0.#f0b0d0.#c0e050.#3a8a3a.#4060f0.#a040f0.#806050.#304090.#208080.#b09070.#90c0f0.#f0e8a0.#f0a8c0.#f08080.#e0d0a0.#f4f4f4.#3c78e0.#c0c0c0.#606060.#f06080.#4c8ce0.#a0e0a0.#f0c080.#f8f8f8.#e0b030.#f08c28.#f050a0.#d83c3c.#9070d0.#f09080.#2c7a3c.#a0d8f0.#3c6e7a.#c0c8d0.#8a5a30.#4a80e0.#4a5a8a.#e04848.#f0b040.#c04890.#d0d0d0.#3a7aa0.#c86020.#8a7a9a.#f0b440.#4a88e8.#5090e8.#58c058.#f0b848.#f0bc4c.#202020.#f0b040.#4888e0.#e04040.#a02828.#4888e8.#5090f0.#284080.#505050.#f0d840.#a0e040.#9050c0.#4878d8.#484848`.split(`.`),D=[`#f0a030`,`#4fd6e0`,`#d070f0`,`#5fd068`,`#ff5c5c`,`#5c8dff`],O=[10,25,50,100,250,500,1e3,2e3],ne=`Bahnschrift, 'Arial Narrow', 'Roboto Condensed', 'Helvetica Neue', Arial, sans-serif`,k=`'Nunito', 'Varela Round', 'Segoe UI', system-ui, sans-serif`;function re(e,t,n){let r=t*Math.min(n,1-n),i=t=>{let i=(t+e/30)%12,a=n-r*Math.max(-1,Math.min(i-3,9-i,1));return Math.round(a*255).toString(16).padStart(2,`0`)};return`#${i(0)}${i(8)}${i(4)}`}function A(e){return te[e]??re(e*137.5%360,.7,.62)}function j(e){return D[(e-1)%D.length]}function M(e){let t=Number.parseInt(e.slice(1,7),16);return[t>>16&255,t>>8&255,t&255]}function N(e,t){let[n,r,i]=M(e).map(e=>Math.round(t<0?e*(1+t):e+(255-e)*t));return`rgb(${n} ${r} ${i})`}function P(e){let[t,n,r]=M(e).map(e=>(e/255)**2.2);return .2126*t+.7152*n+.0722*r}function F(e,t,n,r=[],i=0){let{context:a,width:o,height:s}=e,c=O.find(t=>t*e.scale>=70)??O.at(-1),[l,u]=e.toWorld(0,0),[d,f]=e.toWorld(o,s);a.lineWidth=1,a.font=n,a.fillStyle=t.text,a.setLineDash(r);for(let n=Math.ceil(l/c)*c;n<=d;n+=c){let[r]=e.toScreen(n,0);a.strokeStyle=n===0?t.axis:t.line,a.beginPath(),a.moveTo(Math.round(r)+.5,0),a.lineTo(Math.round(r)+.5,s),a.stroke(),e.bare!==!0&&a.fillText(String(n),r+3,i+12)}for(let n=Math.ceil(f/c)*c;n<=u;n+=c){let[,r]=e.toScreen(0,n);a.strokeStyle=n===0?t.axis:t.line,a.beginPath(),a.moveTo(0,Math.round(r)+.5),a.lineTo(o,Math.round(r)+.5),a.stroke(),r>i+20&&e.bare!==!0&&a.fillText(String(n),3,r-3)}a.setLineDash([])}function I(e,t,n,r,i){let a=r.findIndex(([r,i])=>e.claim(r,i,t,n));if(a>=0)return a;if(!i)return;let o=r.map(([r,i])=>e.crowding(r,i,t,n)),s=o.indexOf(Math.min(...o));return e.claim(...r[s],t,n,!0),s}function L(e,t,n,r,i,a,o=!1){let{context:s}=e;s.font=a;let c=s.measureText(t).width,l=([e,,t])=>t===`center`?e-c/2:t===`right`?e-c:e,u=I(e,c+4,16,n.map(e=>[l(e)-2,e[1]-12]),o);if(u===void 0)return;let d=l(n[u]),f=n[u][1];s.lineJoin=`round`,s.lineWidth=3,s.strokeStyle=i,s.strokeText(t,d,f),s.fillStyle=r,s.fillText(t,d,f),s.lineWidth=1}var R=e=>-e.heading*Math.PI/180;function z(e,t){let n=Math.sin(e*127.1+t*311.7)*43758.5453;return n-Math.floor(n)}var ie=Float64Array.from({length:512},(e,t)=>{let n=Math.floor(t/2)/256*Math.PI*2;return t%2==0?Math.cos(n):Math.sin(n)});function ae(e,t){let n=Math.imul(e|0,668265261)^Math.imul(t|0,374761393);return n=Math.imul(n^n>>>15,2246822507),((n^n>>>13)&255)*2}function oe(e,t){let n=Math.floor(e),r=Math.floor(t),i=e=>e*e*e*(e*(e*6-15)+10),a=(n,r)=>{let i=ae(n,r);return ie[i]*(e-n)+ie[i+1]*(t-r)},o=i(e-n),s=i(t-r),c=a(n,r)+(a(n+1,r)-a(n,r))*o;return .5+(c+(a(n,r+1)+(a(n+1,r+1)-a(n,r+1))*o-c)*s)*.75}function se(e,t){return oe(e,t)*.68+oe((e*.8-t*.6)*2.1+31,(e*.6+t*.8)*2.1-7)*.32}function B(e,t){return 2**Math.round(Math.log2(t/e.scale))}function ce(e=1/0){let t,n=``;return(r,i,a=``)=>{let[o,s]=r.toWorld(0,0),c=`${r.width} ${r.height} ${r.ratio} ${o} ${s} ${r.scale} ${a}`;if(t??=document.createElement(`canvas`),c!==n){let a=Math.min(r.ratio,e),o=Math.round(r.width*a),s=Math.round(r.height*a);(t.width!==o||t.height!==s)&&(t.width=o,t.height=s);let l=t.getContext(`2d`);l.setTransform(1,0,0,1,0,0),l.clearRect(0,0,o,s),l.setTransform(a,0,0,a,0,0),i({...r,context:l,ratio:a}),n=c}r.context.drawImage(t,0,0,r.width,r.height)}}function le(e){let t=e.length;for(let{x:n,y:r}of e)t=(t*31+Math.round(n)*7+Math.round(r))%1e9;return String(t)}var V={name:`Classic`,animated:!1,background(e){e.context.clearRect(0,0,e.width,e.height),F(e,{line:`#1f232b`,axis:`#3a404c`,text:`#5a606c`},`11px ui-monospace, Consolas, monospace`)},area(e,t,n,r){let{context:i}=e;if(i.globalAlpha=t.alpha/255*.35,i.fillStyle=A(t.colour),i.beginPath(),t.shape===`radius`)i.arc(n,r,(t.radius??0)*e.scale,0,Math.PI*2);else{let a=(t.width??0)*e.scale,o=(t.height??0)*e.scale;i.rect(n-a/2,r-o/2,a,o)}i.fill(),i.globalAlpha=1},route(e,t,n,r){let{context:i}=e;i.strokeStyle=r,i.lineWidth=2,i.setLineDash([6,5]),i.beginPath(),i.moveTo(...t),i.lineTo(...n),i.stroke(),i.setLineDash([]),i.lineWidth=1},blip(e,t,n,r){let{context:i}=e;e.claim(n-6,r-6,12,12,!0),i.globalAlpha=Math.max(t.alpha/255,.25),t.sprite===8?(i.fillStyle=`#d070f0`,i.beginPath(),i.moveTo(n,r-9),i.lineTo(n+7,r),i.lineTo(n,r+9),i.lineTo(n-7,r),i.closePath(),i.fill()):t.shape!==`radius`&&t.shape!==`area`&&(i.fillStyle=A(t.colour),i.strokeStyle=`#0b0c10`,i.beginPath(),i.arc(n,r,5,0,Math.PI*2),i.fill(),i.stroke()),i.globalAlpha=1},label(e,t,n,r,i){L(e,t,[[n+8,r+4,`left`],[n-8,r+4,`right`]],`#c8ccd4`,`#0b0c10`,`12px system-ui, sans-serif`,i)},tag(e,t,n,r,i){L(e,t,[[r,i+22,`center`],[r,i-14,`center`]],n,`#0b0c10`,`12px system-ui, sans-serif`,!0)},entity(e,t,n,r,i,a){let{context:o}=e;if(t.kind===`player`){let i=a?.colour??`#d7dae0`;e.claim(n-8,r-10,16,18,!0),o.save(),o.translate(n,r),o.rotate(R(t)),o.fillStyle=i,o.strokeStyle=`#0b0c10`,o.beginPath(),o.moveTo(0,-10),o.lineTo(7,7),o.lineTo(0,3),o.lineTo(-7,7),o.closePath(),o.fill(),o.stroke(),o.restore()}else t.kind===`vehicle`?(o.save(),o.translate(n,r),o.rotate(R(t)),o.fillStyle=`#8a909c`,o.fillRect(-4,-7,8,14),o.restore()):(o.fillStyle=t.kind===`ped`?`#a8adb8`:`#5a606c`,o.beginPath(),o.arc(n,r,t.kind===`ped`?3.5:2.5,0,Math.PI*2),o.fill());return[n,r]}},H={grass:`#8fcf68`,light:[166,220,127],dark:[124,192,88],tuft:`#6eb24c`,ink:`#2b2d3a`,text:`#2d3142`},ue=[`#ef5b5b`,`#3f8efc`,`#ffc145`,`#34c38f`,`#a66cff`,`#ff8a3d`,`#f2f4f8`],U=[`#8d99ae`,`#e9c46a`,`#2a9d8f`,`#e76f51`,`#9b5de5`,`#577590`],W=[`#f8d5b5`,`#eab78e`,`#c98d62`,`#9c6644`,`#6f4630`],G=[`#3b2a20`,`#6b4423`,`#d8a93f`,`#a0522d`,`#23232b`,`#c8553d`],K=[`#3d4a6b`,`#e9c46a`,`#2a9d8f`,`#e76f51`,`#9b5de5`,`#577590`,`#f4f1de`,`#ef476f`,`#118ab2`,`#06d6a0`,`#ffd166`,`#264653`,`#8d99ae`,`#f78c6b`,`#2b2d42`,`#b5838d`],de=[`#f8d5b5`,`#f1c6a0`,`#eab78e`,`#d9a077`,`#c98d62`,`#b07650`,`#9c6644`,`#845437`,`#6f4630`];function fe(e){if(e===void 0)return;let t=([e,t],n)=>K[Math.abs(e*5+t*3+n)%K.length],n=e=>M(de[Math.abs(e)%de.length]),[r,i,a]=e.skin,[o,s]=[n(r),n(i)],c=o.map((e,t)=>Math.round(e+(s[t]-e)*a)),l=v[e.hair]??v[0];return{skin:`rgb(${c.join(` `)})`,hair:`#${l.toString(16).padStart(6,`0`)}`,top:t(e.top,1),legs:t(e.legs,0),shoes:t(e.shoes,14),long:e.hairStyle%2==1}}function q(e,t,n,r=1.6){e.lineWidth=r*2,e.strokeStyle=H.ink,e.stroke(t),e.fillStyle=n,e.fill(t)}function J(e,t,n,r,i,a=.22){e.fillStyle=`rgba(32, 70, 26, ${a})`,e.beginPath(),e.ellipse(t,n,r,i,0,0,Math.PI*2),e.fill()}function pe(e,t,n,r,i){J(e,t+4*i,n+1,12*i,4.5*i);let a=new Path2D;a.roundRect(t-2.2*i,n-9*i,4.4*i,10*i,1.6*i),q(e,a,`#9a6a45`,1.1);let o=new Path2D;if(r){for(let[e,r,a]of[[-30,7,-18],[-24,9.5,-12],[-18,11.5,-6]])o.moveTo(t,n+e*i),o.lineTo(t+r*i,n+a*i),o.lineTo(t-r*i,n+a*i),o.closePath();q(e,o,`#3f9a54`,1.1),e.fillStyle=`rgba(255, 255, 255, 0.18)`,e.beginPath(),e.moveTo(t,n-29*i),e.lineTo(t-5*i,n-20*i),e.lineTo(t-1*i,n-20*i),e.closePath(),e.fill()}else{for(let[e,r,a]of[[-6,-14,7],[6,-14,7],[0,-20,8.5]])o.moveTo(t+(e+a)*i,n+r*i),o.arc(t+e*i,n+r*i,a*i,0,Math.PI*2);q(e,o,`#4caf50`,1.1),e.fillStyle=`#7bd06b`,e.beginPath(),e.arc(t-3*i,n-22*i,3.6*i,0,Math.PI*2),e.arc(t-7.5*i,n-15.5*i,2.4*i,0,Math.PI*2),e.fill()}}function me(e,t,n,r){if(r<.12){J(e,t+2,n+1,9,3);let r=new Path2D;for(let[e,i,a]of[[-5,-4,4.6],[4.5,-4,4.6],[0,-7,5.4]])r.moveTo(t+e+a,n+i),r.arc(t+e,n+i,a,0,Math.PI*2);q(e,r,`#5cb85c`,1),e.fillStyle=`#86d176`,e.beginPath(),e.arc(t-1.5,n-8.5,2,0,Math.PI*2),e.fill()}else if(r<.19){let[i,a]=[[`#ffffff`,`#ffd23f`],[`#ff8fb1`,`#fff3b0`],[`#ffd23f`,`#f08a3c`]][Math.floor(r*1e3)%3];for(let[r,o]of[[0,0],[6,3],[-5,4]]){e.fillStyle=i,e.beginPath();for(let i=0;i<5;i++){let a=i*Math.PI*2/5;e.moveTo(t+r+Math.cos(a)*1.8+1.5,n+o+Math.sin(a)*1.8),e.arc(t+r+Math.cos(a)*1.8,n+o+Math.sin(a)*1.8,1.5,0,Math.PI*2)}e.fill(),e.fillStyle=a,e.beginPath(),e.arc(t+r,n+o,1.2,0,Math.PI*2),e.fill()}}else if(r<.215){J(e,t+2,n+1.5,7,2.5);let r=new Path2D;r.ellipse(t,n-2,6,4,0,0,Math.PI*2),q(e,r,`#c3ccd6`,1),e.fillStyle=`#e6ebf0`,e.beginPath(),e.ellipse(t-2,n-3.6,2.4,1.3,-.3,0,Math.PI*2),e.fill()}else{e.strokeStyle=H.tuft,e.lineWidth=1.8,e.lineCap=`round`,e.beginPath();for(let r of[-3,0,3])e.moveTo(t+r,n),e.quadraticCurveTo(t+r*1.1,n-3,t+r*1.7,n-6+Math.abs(r)*.4);e.stroke(),e.lineCap=`butt`}}function he(e,t){let{context:n,width:r,height:i}=e;n.fillStyle=H.grass,n.fillRect(0,0,r,i);let a=B(e,380),o=Math.ceil(r/16)+1,s=Math.ceil(i/16)+1,c=document.createElement(`canvas`);c.width=o,c.height=s;let l=c.getContext(`2d`),u=l.createImageData(o,s),[d,f]=e.toWorld(0,0);for(let t=0;t<s;t++)for(let n=0;n<o;n++){let r=se((d+n*16/e.scale)/a,(f-t*16/e.scale)/a),i=Math.min(Math.max((r-.55)/.09,0),1),s=Math.min(Math.max((.45-r)/.09,0),1),[c,l,p]=i>0?H.light:H.dark,m=i>0?i:s,h=(t*o+n)*4;u.data[h]=c,u.data[h+1]=l,u.data[h+2]=p,u.data[h+3]=Math.round(m*255)}l.putImageData(u,0,0),n.imageSmoothingQuality=`high`,n.drawImage(c,-8,-8,o*16,s*16);let p=new Set;for(let a of t){if(a.shape===`radius`||a.shape===`area`)continue;let[t,o]=e.toScreen(a.x,a.y);if(!(t<-30||o<-30||t>r+30||o>i+30)){for(let e=-1;e<=1;e++)for(let n=-1;n<=1;n++)p.add(`${Math.floor(t/30)+e} ${Math.floor(o/30)+n}`);e.scale>=.1&&a.sprite!==8&&(n.fillStyle=`rgba(244, 228, 178, 0.85)`,n.beginPath(),n.ellipse(t,o+6,19,8.5,0,0,Math.PI*2),n.fill(),n.fillStyle=`rgba(255, 246, 214, 0.7)`,n.beginPath(),n.ellipse(t,o+5,12,5,0,0,Math.PI*2),n.fill())}}let m=B(e,58),h=Math.log2(m),[g,_]=e.toWorld(-40,-40),[v,y]=e.toWorld(r+40,i+60),b=[];for(let t=Math.floor(g/m);t<=v/m;t++)for(let n=Math.floor(y/m);n<=_/m;n++){let r=z(t+h*7.3,n-h*3.1);if(r>.55)continue;let[i,a]=e.toScreen((t+.15+z(n,t+h)*.7)*m,(n+.15+z(t+3.7,n-h)*.7)*m);r<.215&&p.has(`${Math.floor(i/30)} ${Math.floor(a/30)}`)||b.push([i,a,r])}b.sort((e,t)=>e[1]-t[1]);for(let[e,t,r]of b)r<.07?pe(n,e,t,r<.025,.85+r*97%1*.35):me(n,e,t,r);F(e,{line:`rgba(255, 255, 255, 0.22)`,axis:`rgba(255, 255, 255, 0.6)`,text:`#3f6e2c`},`800 10px ${k}`,[2,6])}function ge(e){let{context:t,width:n,height:r,time:i}=e;t.fillStyle=`rgba(28, 60, 36, 0.05)`;for(let e=0;e<4;e++){let a=n+600,o=(e*.31*a+i*.012)%a-300,s=(e*.37+.12)%1*r+Math.sin(i/9e3+e)*24;t.beginPath();for(let[e,n,r,i]of[[0,0,120,52],[90,-20,90,44],[-80,14,80,38]])t.moveTo(o+e+r,s+n),t.ellipse(o+e,s+n,r,i,0,0,Math.PI*2);t.fill()}}function _e(e){return e.scale>=.1?12.5:e.scale>=.04?10.5:8.5}function ve(e){let t=P(e);return t>.8?`#5f6b7d`:t>.42?N(e,-.32):e}function ye(e,t,n,r,i,a){let{context:o}=e;o.font=`800 12px ${k}`;let s=Math.ceil(o.measureText(t).width)+16,c=r.map(([e,t])=>t?e:e-20),l=I(e,s,26,r.map(([,,e=0],t)=>[n+e-s/2,c[t]-3]),a);if(l===void 0)return;let u=c[l],[,d,f=0]=r[l],p=n+f,m=new Path2D;m.roundRect(p-s/2,u,s,20,10);let h=d?u:u+20;m.moveTo(p-5,h),m.lineTo(p,h+(d?-5:5)),m.lineTo(p+5,h),o.fillStyle=`rgba(30, 50, 30, 0.18)`,o.save(),o.translate(0,2.5),o.fill(m),o.restore(),o.fillStyle=i,o.fill(m),o.fillStyle=H.text,o.textAlign=`center`,o.fillText(t,p,u+14.5),o.textAlign=`left`}function be(e){return[`back`,`right`,`front`,`left`][Math.round((e%(Math.PI*2)+Math.PI*2)/(Math.PI/2))%4]}function xe(e,t,n,r,i,a,o=!1,s){let c=be(r),l=s?.skin??W[a%W.length],u=s?.hair??G[Math.floor(a/5)%G.length],d=s?.long??Math.floor(a/3)%2==0,f=t/105+a,p=n?Math.sin(f):0,m=n?-Math.abs(Math.sin(f))*2:Math.sin(t/420+a)*.5;o||J(e,0,.5,10-(n?Math.abs(p):0),3.6,.26),e.save(),e.translate(0,m);let h=c===`left`||c===`right`,g=c===`left`?-1:1,_=new Path2D,v=new Path2D;for(let[e,t]of[[-3,Math.max(0,p)],[3,Math.max(0,-p)]]){let n=h?p*(e<0?3:-3)*g:0,r=o?1.5:-t*2.6;_.roundRect((h?e*.35:e)-2.1+n,-8.5+r,4.2,8.5,2),v.roundRect((h?e*.35+g:e)-2.6+n,-2.8+r,5.2,3.2,1.5)}q(e,_,s?.legs??`#3d4a6b`,1.4),q(e,v,s?.shoes??`#2b2d42`,1.2);let y=new Path2D;for(let[e,t]of[[-8.2,-p],[8.2,p]]){if(h&&e*g<0)continue;let n=h?t*2.2*g:0;y.roundRect((h?1.5*g:e)-2+n,-18-(o?3:0)+t*1.2,4,8.5,2)}let b=new Path2D;b.roundRect(-7,-20,14,12.5,5),q(e,b,i,1.4),e.save(),e.clip(b),e.fillStyle=`rgba(0, 0, 0, 0.13)`,e.fillRect(h?-7*g:2,-20,h?6*g:5,13),e.restore(),q(e,y,N(i,-.08),1.4);let x=new Path2D;if(x.arc(0,-27.5,9,0,Math.PI*2),q(e,x,l,1.4),e.save(),e.clip(x),e.fillStyle=u,e.beginPath(),c===`back`?e.rect(-10,-40,20,16):h?(e.ellipse(-3*g,-32,9.5,6.5,0,0,Math.PI*2),e.rect(-10*g,-36,7*g,12)):e.ellipse(0,-33.5,11,6.5,0,0,Math.PI*2),e.fill(),e.restore(),d&&c!==`front`&&(e.fillStyle=u,e.strokeStyle=H.ink,e.lineWidth=1.4,e.beginPath(),e.roundRect(h?-9*g-2.5:-7,-28,5,10,2.5),h||e.roundRect(2,-28,5,10,2.5),e.fill(),e.stroke()),c!==`back`){let n=(t+a*977)%3800<130,r=h?[3.6*g]:[-3.2,3.2];e.fillStyle=H.ink,e.strokeStyle=H.ink,e.lineWidth=1.3;for(let t of r)e.beginPath(),n?(e.moveTo(t-1.4,-26.5),e.lineTo(t+1.4,-26.5),e.stroke()):(e.ellipse(t,-26.6,1.25,1.6,0,0,Math.PI*2),e.fill());e.fillStyle=`rgba(255, 120, 120, 0.35)`;for(let t of h?[2*g]:[-5.2,5.2])e.beginPath(),e.ellipse(t,-23.4,1.9,1.2,0,0,Math.PI*2),e.fill();h||(e.beginPath(),e.arc(0,-24,1.8,.15*Math.PI,.85*Math.PI),e.stroke())}e.restore()}function Se(e,t,n,r){let i=new Path2D;for(let[e,t]of[[-9,-11],[5.4,-11],[-9,5.5],[5.4,5.5]])i.roundRect(e,t,3.6,6.5,1.6);e.fillStyle=`#23232b`,e.fill(i);let a=new Path2D;a.roundRect(-8,-15.5,16,31,6.5),q(e,a,t,1.3),e.save(),e.clip(a),e.fillStyle=`rgba(255, 255, 255, 0.22)`,e.fillRect(-8,-15.5,4,31),e.fillStyle=`rgba(0, 0, 0, 0.12)`,e.fillRect(4.5,-15.5,4,31),e.restore();let o=e.createLinearGradient(0,-9,0,-3);o.addColorStop(0,`#d9f4ff`),o.addColorStop(1,`#7cc6ee`),e.fillStyle=o,e.strokeStyle=H.ink,e.lineWidth=1,e.beginPath(),e.roundRect(-6,-9.5,12,6,2),e.fill(),e.stroke(),e.fillStyle=N(t,.18),e.beginPath(),e.roundRect(-6,-2.5,12,9,2.5),e.fill(),e.stroke(),e.fillStyle=`#7cc6ee`,e.beginPath(),e.roundRect(-5.5,7.5,11,4,1.5),e.fill(),e.stroke(),e.strokeStyle=`rgba(255, 255, 255, 0.85)`,e.lineWidth=1.2,e.beginPath(),e.moveTo(-3.5,-8.5),e.lineTo(-1,-4.5),e.stroke();for(let[t,n,r]of[[-6,-15.4,`#ffe066`],[3.6,-15.4,`#ffe066`],[-6,13.6,`#ff6b6b`],[3.6,13.6,`#ff6b6b`]])e.fillStyle=r,e.beginPath(),e.roundRect(t,n,2.4,1.8,.8),e.fill();if(n)for(let t=0;t<3;t++){let n=(r/420+t/3)%1;e.fillStyle=`rgba(255, 255, 255, ${.55*(1-n)})`,e.beginPath(),e.arc(-3+Math.sin(t*2.1)*2,18+n*12,2+n*3,0,Math.PI*2),e.fill()}}function Ce(){let e=ce();return{name:`Cartoon`,animated:!0,background(t,n){e(t,e=>he(e,n),le(n)),ge(t)},area(e,t,n,r){let{context:i}=e,a=A(t.colour),o=new Path2D;if(t.shape===`radius`)o.arc(n,r,(t.radius??0)*e.scale,0,Math.PI*2);else{let i=(t.width??0)*e.scale,a=(t.height??0)*e.scale;o.roundRect(n-i/2,r-a/2,i,a,Math.min(16,i/4,a/4))}i.globalAlpha=t.alpha/255*.22,i.fillStyle=a,i.fill(o),i.globalAlpha=Math.max(t.alpha/255,.4),i.strokeStyle=N(a,-.15),i.lineWidth=2.5,i.setLineDash([8,6]),i.lineDashOffset=-e.time/45,i.stroke(o),i.setLineDash([]),i.lineDashOffset=0,i.globalAlpha=1,i.lineWidth=1},route(e,t,n,r){let{context:i,time:a}=e;i.strokeStyle=r,i.globalAlpha=.18,i.lineWidth=9,i.lineCap=`round`,i.beginPath(),i.moveTo(...t),i.lineTo(...n),i.stroke(),i.globalAlpha=1,i.lineCap=`butt`;let o=Math.hypot(n[0]-t[0],n[1]-t[1]),s=a/36%14;i.lineWidth=1.6,i.strokeStyle=N(r,-.25),i.fillStyle=`#ffffff`;for(let e=s;e<o-6;e+=14){let r=e/o;i.beginPath(),i.arc(t[0]+(n[0]-t[0])*r,t[1]+(n[1]-t[1])*r,3,0,Math.PI*2),i.fill(),i.stroke()}i.lineWidth=1},blip(e,t,n,r,i){let{context:a,time:o}=e,s=A(t.colour);if(a.globalAlpha=Math.max(t.alpha/255,.35),t.sprite===8){e.claim(n-3,r-30,22,32,!0);let t=o/1600%1;a.strokeStyle=`rgba(239, 71, 111, ${.7*(1-t)})`,a.lineWidth=2,a.beginPath(),a.ellipse(n,r,6+t*14,(6+t*14)*.4,0,0,Math.PI*2),a.stroke(),J(a,n+2,r,6,2.4);let i=new Path2D;i.roundRect(n-1.3,r-28,2.6,28,1.3),q(a,i,`#e8e2d4`,1);let s=new Path2D,c=e=>Math.sin(o/160-e/4)*1.6*(e/16);s.moveTo(n+1,r-27);for(let e=0;e<=16;e+=2)s.lineTo(n+1+e,r-27+c(e)+e*.06);for(let e=16;e>=0;e-=2)s.lineTo(n+1+e,r-17+c(e)-e*.06);s.closePath(),q(a,s,`#ef476f`,1)}else if(t.shape!==`radius`&&t.shape!==`area`){let c=_e(e);e.claim(n-c,r-c*1.35-1,c*2,c*2.1+2,!0);let l=i?5:0,u=Math.sin(o/700+t.handle*1.7)*1.1-l;J(a,n,r+c*.75,c*.85-l*.3,c*.32),a.save(),a.translate(n,r+u-c*.35),i&&a.scale(1.12,1.12),a.fillStyle=N(P(s)>.8?`#9aa5b4`:s,-.35),a.beginPath(),a.arc(0,2.6,c,0,Math.PI*2),a.fill(),a.fillStyle=`#ffffff`,a.beginPath(),a.arc(0,0,c,0,Math.PI*2),a.fill(),a.strokeStyle=P(s)>.8?`#9aa5b4`:s,a.lineWidth=c>10?3:2.4,a.beginPath(),a.arc(0,0,c-1.5,0,Math.PI*2),a.stroke();let d=b(t.sprite);a.fillStyle=ve(s),d===void 0?(a.font=`900 ${Math.round(c)}px ${k}`,a.textAlign=`center`,a.fillText((t.name??`•`).slice(0,1).toUpperCase(),0,c*.36),a.textAlign=`left`):E(a,d,c*1.18),a.restore()}a.globalAlpha=1,a.lineWidth=1},label(e,t,n,r,i){let a=_e(e);ye(e,t,n,[[r+a*.75+9,!0],[r-a*1.45-7,!1]],`#ffffff`,i)},tag(e,t,n,r,i){ye(e,t,r,[[i-47,!1],[i+10,!0],[i-47,!1,48],[i-47,!1,-48]],n,!0)},entity(e,t,n,r,i,a){let{context:o,time:s}=e;if(t.kind===`player`||t.kind===`ped`){let c=a?.colour??U[t.id%U.length],l=t.kind===`ped`?.86:1.08;if(e.claim(n-10*l,r-37*l,20*l,38*l,!0),a!==void 0){let e=s/2200%1;o.strokeStyle=c,o.lineWidth=2.5,o.beginPath(),o.ellipse(n,r,14,5.5,0,0,Math.PI*2),o.stroke(),o.globalAlpha=1-e,o.lineWidth=1.5,o.beginPath(),o.ellipse(n,r,14+e*12,5.5+e*4.5,0,0,Math.PI*2),o.stroke(),o.globalAlpha=1}o.save(),o.translate(n,r),o.scale(l,l);let u=fe(t.look);return xe(o,s,i,R(t),u?.top??c,(a?.client??t.id)*7,!1,u),o.restore(),[n,r-14*l]}if(t.kind===`vehicle`){let a=Math.min(Math.max(e.scale/6,.8),1.4),c=R(t),l=i?Math.sin(s/55)*.5:0;return o.save(),o.translate(n+3*a,r+4*a),o.rotate(c),o.scale(a,a),o.fillStyle=`rgba(32, 70, 26, 0.24)`,o.beginPath(),o.roundRect(-9,-15,18,31,7),o.fill(),o.restore(),o.save(),o.translate(n,r+l),o.rotate(c),o.scale(a,a),Se(o,ue[t.id%ue.length],i,s),o.restore(),o.lineWidth=1,[n,r]}J(o,n+2,r+5,8,3);let c=new Path2D;return c.roundRect(n-6,r-6,12,12,2),q(o,c,`#c8915a`,1.2),o.strokeStyle=`#8a5a30`,o.lineWidth=1.2,o.beginPath(),o.moveTo(n-4.5,r-4.5),o.lineTo(n+4.5,r+4.5),o.moveTo(n+4.5,r-4.5),o.lineTo(n-4.5,r+4.5),o.stroke(),o.lineWidth=1,[n,r]},dragging(e,t,n,r){let{context:i,time:a}=e;i.fillStyle=`#ffffff`;let o=Math.hypot(n[0]-t[0],n[1]-t[1]);for(let e=8;e<o-24;e+=12){let r=e/o;i.beginPath(),i.arc(t[0]+(n[0]-t[0])*r,t[1]+(n[1]-t[1])*r,2.2,0,Math.PI*2),i.fill()}J(i,n[0],n[1]+26,9,3.2,.3),i.save(),i.translate(n[0],n[1]+16+Math.sin(a/160)*1.5),i.rotate(Math.sin(a/240)*.08);let s=fe(r.look);xe(i,a,!1,Math.PI,s?.top??r.colour,r.client*7,!0,s),i.restore()},overlay(e){let{context:t,height:n,time:r}=e,i=n-34;t.fillStyle=`rgba(30, 50, 30, 0.2)`,t.beginPath(),t.arc(34,i+3,21,0,Math.PI*2),t.fill();let a=new Path2D;a.arc(34,i,21,0,Math.PI*2),q(t,a,`#ffffff`,1.2),t.save(),t.translate(34,i),t.rotate(Math.sin(r/900)*.07),t.fillStyle=`#ef476f`,t.beginPath(),t.moveTo(0,-15),t.lineTo(4.5,0),t.lineTo(-4.5,0),t.closePath(),t.fill(),t.fillStyle=`#b8c2cf`,t.beginPath(),t.moveTo(0,15),t.lineTo(4.5,0),t.lineTo(-4.5,0),t.closePath(),t.fill(),t.restore(),t.fillStyle=H.ink,t.beginPath(),t.arc(34,i,2,0,Math.PI*2),t.fill(),t.font=`900 9px ${k}`,t.textAlign=`center`,t.fillText(`N`,34,i-23-3);let o=[5,10,25,50,100,250,500,1e3,2500,5e3].find(t=>t*e.scale>=56)??5e3,s=o*e.scale,c=o>=1e3?`${o/1e3} km`:`${o} m`;t.font=`800 11px ${k}`;let l=Math.max(s,t.measureText(c).width)+20;t.fillStyle=`rgba(30, 50, 30, 0.2)`,t.beginPath(),t.roundRect(66,i-12+2.5,l,26,13),t.fill(),t.fillStyle=`#ffffff`,t.beginPath(),t.roundRect(66,i-12,l,26,13),t.fill(),t.fillStyle=H.text,t.fillText(c,66+l/2,i+1),t.fillStyle=H.ink,t.fillRect(66+(l-s)/2,i+6,s/2,3),t.fillStyle=`#b8c2cf`,t.fillRect(66+l/2,i+6,s/2,3),t.textAlign=`left`}}}var we=[[],[[3,2]],[[2,1]],[[3,1]],[[0,1]],[[0,3],[1,2]],[[0,2]],[[0,3]],[[0,3]],[[0,2]],[[0,1],[3,2]],[[0,1]],[[3,1]],[[1,2]],[[3,2]],[]];function Te(e){let{context:t,width:n,height:r}=e,i=B(e,520),a=Math.ceil(n/9)+1,o=Math.ceil(r/9)+1,[s,c]=e.toWorld(0,0),l=9/e.scale,u=new Float32Array(a*o);for(let e=0;e<o;e++)for(let t=0;t<a;t++)u[e*a+t]=se((s+t*l)/i,(c-e*l)/i);let d=.3,f=.04,p=Array.from({length:12},()=>new Path2D);for(let e=0;e<o-1;e++)for(let t=0;t<a-1;t++){let n=u[e*a+t],r=u[e*a+t+1],i=u[(e+1)*a+t+1],o=u[(e+1)*a+t],s=Math.max(n,r,i,o);for(let a=Math.max(Math.ceil((Math.min(n,r,i,o)-d)/f),0);a<p.length&&d+a*f<=s;a++){let s=d+a*f,c=a=>a===0?[(t+(s-n)/(r-n))*9,e*9]:a===1?[(t+1)*9,(e+(s-r)/(i-r))*9]:a===2?[(t+(s-o)/(i-o))*9,(e+1)*9]:[t*9,(e+(s-n)/(o-n))*9],l=(n>s?8:0)|(r>s?4:0)|(i>s?2:0)|o>s;for(let[e,t]of we[l])p[a].moveTo(...c(e)),p[a].lineTo(...c(t))}}t.lineWidth=1,p.forEach((e,n)=>{t.strokeStyle=n%4==3?`rgba(150, 200, 235, 0.13)`:`rgba(150, 200, 235, 0.055)`,t.stroke(e)})}function Ee(e){let t=`#c65ad8`,n=`#05080b`,r=(e,t=600)=>`semi-condensed ${t} ${e}px ${ne}`,i=e=>e>=760,a=ce(1),o=e=>{e.fillStyle=`rgba(0, 0, 0, 0.4)`,e.beginPath(),e.ellipse(0,0,4.5,1.8,0,0,Math.PI*2),e.fill();let r=new Path2D;r.moveTo(0,0),r.bezierCurveTo(-1.8,-5,-7,-8,-7,-13.5),r.arc(0,-13.5,7,Math.PI,0),r.bezierCurveTo(7,-8,1.8,-5,0,0),r.closePath(),e.lineWidth=3,e.lineJoin=`round`,e.strokeStyle=n,e.stroke(r),e.fillStyle=t,e.fill(r),e.fillStyle=`#ffffff`,e.beginPath(),e.arc(0,-13.5,2.6,0,Math.PI*2),e.fill()},s=(e,t)=>{let r=new Path2D;r.moveTo(0,-12),r.lineTo(8.5,9),r.lineTo(0,4.5),r.lineTo(-8.5,9),r.closePath(),e.lineJoin=`round`,e.lineWidth=3.5,e.strokeStyle=n,e.stroke(r),e.fillStyle=t,e.fill(r),e.fillStyle=`rgba(255, 255, 255, 0.35)`,e.beginPath(),e.moveTo(0,-12),e.lineTo(0,4.5),e.lineTo(-8.5,9),e.closePath(),e.fill()},c=(e,t,n,i)=>{e.strokeStyle=`#ffffff`,e.fillStyle=`#ffffff`,e.lineWidth=1.4,e.beginPath(),e.roundRect(t,n,11,16,5.5),e.stroke(),e.beginPath(),e.moveTo(t,n+6.5),e.lineTo(t+11,n+6.5),e.moveTo(t+5.5,n),e.lineTo(t+5.5,n+6.5),e.stroke(),e.beginPath(),i===`wheel`?e.roundRect(t+4.2,n+1.8,2.6,4,1.3):(e.moveTo(t+5.5,n+.7),e.lineTo(t+5.5,n+6.5),e.lineTo(t+.7,n+6.5),e.arc(t+5.5,n+5.5,4.8,Math.PI,Math.PI*1.5)),e.fill(),i===`twice`&&(e.font=r(9,700),e.fillText(`2`,t+13,n+6))};return{name:`GTA`,animated:!0,instructions:!0,insets:e=>({top:48,right:i(e)?260:0,bottom:42,left:0}),background(t){let{context:n,width:i,height:o}=t,s=n.createRadialGradient(i*.45,o*.55,0,i*.45,o*.55,Math.hypot(i,o)*.62);s.addColorStop(0,`#1d3448`),s.addColorStop(1,`#0c1824`),n.fillStyle=s,n.fillRect(0,0,i,o);let c=e();if(c!==void 0){let[e,r]=t.toScreen(c.left,c.top),[i,a]=t.toScreen(c.right,c.bottom);n.drawImage(c.image,e,r,i-e,a-r)}else a(t,Te);F(t,{line:`rgba(140, 180, 215, 0.09)`,axis:`rgba(140, 180, 215, 0.26)`,text:`rgba(180, 205, 228, 0.5)`},r(10),[],48);let l=n.createRadialGradient(i/2,o/2,Math.min(i,o)*.4,i/2,o/2,Math.hypot(i,o)*.6);l.addColorStop(0,`rgba(0, 0, 0, 0)`),l.addColorStop(1,`rgba(0, 0, 0, 0.45)`),n.fillStyle=l,n.fillRect(0,0,i,o)},area(e,t,n,r){let{context:i}=e,a=A(t.colour),o=new Path2D;if(t.shape===`radius`)o.arc(n,r,(t.radius??0)*e.scale,0,Math.PI*2);else{let i=(t.width??0)*e.scale,a=(t.height??0)*e.scale;o.rect(n-i/2,r-a/2,i,a)}i.globalAlpha=t.alpha/255*.3,i.fillStyle=a,i.fill(o),i.globalAlpha=Math.max(t.alpha/255,.3)*.7,i.strokeStyle=a,i.lineWidth=1.5,i.stroke(o),i.globalAlpha=1,i.lineWidth=1},route(e,n,r){let{context:i,time:a}=e;i.lineCap=`round`;for(let[e,a]of[[`#16081c`,8],[t,4.5]])i.strokeStyle=e,i.lineWidth=a,i.beginPath(),i.moveTo(...n),i.lineTo(...r),i.stroke();let o=Math.hypot(r[0]-n[0],r[1]-n[1]),s=Math.atan2(r[1]-n[1],r[0]-n[0]);i.strokeStyle=`rgba(255, 255, 255, 0.8)`,i.lineWidth=1.6;for(let e=a/24%26;e<o-14;e+=26){let t=e/o;i.save(),i.translate(n[0]+(r[0]-n[0])*t,n[1]+(r[1]-n[1])*t),i.rotate(s),i.beginPath(),i.moveTo(-1.8,-2.6),i.lineTo(1.4,0),i.lineTo(-1.8,2.6),i.stroke(),i.restore()}i.lineCap=`butt`,i.lineWidth=1},blip(e,t,r,i,a){let{context:s,time:c}=e;if(t.sprite===8?e.claim(r-8,i-22,16,24,!0):t.shape!==`radius`&&t.shape!==`area`&&e.claim(r-9,i-9,18,18,!0),s.globalAlpha=Math.max(t.alpha/255,.3),s.strokeStyle=n,s.save(),s.translate(r,i),t.sprite===8)o(s);else if(t.shape!==`radius`&&t.shape!==`area`){let e=b(t.sprite);s.fillStyle=A(t.colour),e===void 0?(s.lineWidth=3,s.beginPath(),s.arc(0,0,5.5,0,Math.PI*2),s.stroke(),s.fill()):E(s,e,17,1.6)}if(s.restore(),s.globalAlpha=1,a){let e=15+Math.sin(c/160);s.strokeStyle=`#ffffff`,s.lineWidth=2;for(let t=0;t<4;t++){let n=t*Math.PI/2+Math.PI/4;s.beginPath(),s.arc(r,i,e,n-.42,n+.42),s.stroke()}s.lineWidth=1}},label(e,t,i,a,o){L(e,t.toUpperCase(),[[i+12,a+4,`left`],[i-12,a+4,`right`],[i,a+22,`center`],[i,a-14,`center`]],`#ffffff`,n,r(11,700),o)},tag(e,t,n,i,a){let{context:o}=e;o.font=r(11,700);let s=t.toUpperCase(),c=Math.ceil(o.measureText(s).width)+15,l=[[i-c/2,a+16],[i-c/2,a-33],[i+15,a-8.5],[i-15-c,a-8.5]],u=l[I(e,c,17,l,!0)];o.fillStyle=`rgba(0, 0, 0, 0.8)`,o.fillRect(u[0],u[1],c,17),o.fillStyle=n,o.fillRect(u[0],u[1],3,17),o.fillStyle=`#ffffff`,o.fillText(s,u[0]+9,u[1]+12.5)},entity(e,t,r,i,a,o){let{context:c,time:l}=e;if(t.kind===`player`){let n=o?.colour??`#ffffff`;e.claim(r-10,i-12,20,22,!0),c.save(),c.translate(r,i),c.rotate(R(t));let a=c.createRadialGradient(0,0,0,0,0,44);a.addColorStop(0,`rgba(255, 255, 255, 0.32)`),a.addColorStop(1,`rgba(255, 255, 255, 0)`),c.fillStyle=a,c.globalAlpha=.8+Math.sin(l/500)*.2,c.beginPath(),c.moveTo(0,0),c.arc(0,0,44,-Math.PI/2-.55,-Math.PI/2+.55),c.closePath(),c.fill(),c.globalAlpha=1,s(c,n),c.restore(),c.lineWidth=1}else if(t.kind===`vehicle`){c.save(),c.translate(r,i),c.rotate(R(t));let e=new Path2D;e.roundRect(-5,-9,10,18,3),c.lineWidth=3,c.strokeStyle=n,c.stroke(e),c.fillStyle=`#dbe3ea`,c.fill(e),c.fillStyle=`#2b3743`,c.beginPath(),c.roundRect(-3.6,-5,7.2,3.4,1),c.roundRect(-3.6,3.6,7.2,2.4,1),c.fill(),c.restore(),c.lineWidth=1}else c.lineWidth=2.5,c.strokeStyle=n,c.fillStyle=t.kind===`ped`?`#c9d1d9`:`#8b98a5`,c.beginPath(),t.kind===`ped`?c.arc(r,i,3.8,0,Math.PI*2):c.rect(r-3.5,i-3.5,7,7),c.stroke(),c.fill(),c.lineWidth=1;return[r,i]},dragging(e,t,n,r){let{context:i}=e;i.strokeStyle=`rgba(255, 255, 255, 0.7)`,i.lineWidth=1.5,i.setLineDash([5,5]),i.beginPath(),i.moveTo(...t),i.lineTo(...n),i.stroke(),i.setLineDash([]),i.save(),i.translate(...n),i.globalAlpha=.7,s(i,r.colour),i.restore(),i.globalAlpha=1,i.lineWidth=1},overlay(e,t,a,o){let{context:s,width:l,height:u}=e,d=s.createLinearGradient(0,0,0,48);d.addColorStop(0,`rgba(3, 6, 9, 0.94)`),d.addColorStop(1,`rgba(3, 6, 9, 0.78)`),s.fillStyle=d,s.fillRect(0,0,l,48),s.fillStyle=`rgba(255, 255, 255, 0.12)`,s.fillRect(0,47,l,1),s.fillStyle=`#ffffff`,s.font=`italic ${r(25,700)}`,s.fillText(`FIVERUNNER`,18,33);let f=s.measureText(`FIVERUNNER`).width,p=a.find(({client:e})=>e===o)?.colour??`#f0a030`;s.font=r(13,700);let m=s.measureText(`MAP`).width+28,h=18+f+18;s.fillStyle=`#ffffff`,s.fillRect(h,12,m,26),s.fillStyle=p,s.fillRect(h,12,m,3),s.fillStyle=`#05080b`,s.fillText(`MAP`,h+14,30.5),s.textAlign=`right`;let g=l-18;s.fillStyle=`rgba(220, 230, 240, 0.7)`,s.font=r(12,600);let _=`${t.length} ${t.length===1?`BLIP`:`BLIPS`}`;s.fillText(_,g,29),g-=s.measureText(_).width+22;for(let e of[...a].reverse()){if(e.name===void 0)continue;let t=e.name.toUpperCase();s.font=r(13,700),s.fillStyle=o===void 0||o===e.client?`#ffffff`:`rgba(255, 255, 255, 0.45)`,s.fillText(t,g,29);let n=s.measureText(t).width;if(s.fillStyle=e.colour,s.beginPath(),s.arc(g-n-9,25,4,0,Math.PI*2),s.fill(),g-=n+30,g<h+m+40)break}if(s.textAlign=`left`,i(l)){let e=new Map;for(let n of t){if(n.name===void 0)continue;let t=e.get(n.name);t===void 0?e.set(n.name,{blip:n,count:1}):t.count++}if(e.size>0){let t=[...e.entries()].sort(([e],[t])=>e.localeCompare(t)),i=l-236-14,a=Math.max(Math.floor((u-62-28-30-36)/22),1),o=t.length>a?t.slice(0,a-1):t,c=t.length-o.length,d=36+(o.length+ +(c>0))*22+6;s.fillStyle=`rgba(3, 6, 9, 0.78)`,s.fillRect(i,62,236,d),s.fillStyle=p,s.fillRect(i,62,236,2),s.fillStyle=`#ffffff`,s.font=r(14,700),s.fillText(`LEGEND`,i+12,86),s.textAlign=`right`,s.fillStyle=`rgba(220, 230, 240, 0.6)`,s.font=r(12,600),s.fillText(String(e.size),i+236-12,86),s.textAlign=`left`,o.forEach(([e,{blip:t,count:a}],o)=>{let c=98+o*22;o%2==0&&(s.fillStyle=`rgba(255, 255, 255, 0.035)`,s.fillRect(i,c,236,22)),s.save(),s.translate(i+22,c+11),s.fillStyle=A(t.colour),s.strokeStyle=n;let l=b(t.sprite);l===void 0?(s.lineWidth=2.4,s.beginPath(),s.arc(0,0,4.5,0,Math.PI*2),s.stroke(),s.fill()):E(s,l,14,1.2),s.restore(),s.font=r(12,600);let u=e.toUpperCase();for(;u.length>1&&s.measureText(u).width>146;)u=u.slice(0,-1);u!==e.toUpperCase()&&(u=`${u.trimEnd()}…`),s.fillStyle=`#eef3f8`,s.fillText(u,i+40,c+15.5),s.textAlign=`right`,s.fillStyle=`rgba(200, 215, 230, 0.55)`,s.font=r(11,600),s.fillText(`×${a}`,i+236-12,c+15.5),s.textAlign=`left`}),c>0&&(s.fillStyle=`rgba(200, 215, 230, 0.6)`,s.font=r(11,700),s.fillText(`+ ${c} MORE`,i+40,98+o.length*22+15.5))}}let v=[[`left`,`MOVE PLAYER`],[`twice`,`WAYPOINT`],[`wheel`,`ZOOM`]];s.font=r(11,700);let y=v.map(([,e])=>s.measureText(e).width+36),x=l-14-y.reduce((e,t)=>e+t,0)-8,S=u-14-28;s.fillStyle=`rgba(3, 6, 9, 0.78)`,s.fillRect(x,S,l-14-x,28),x+=12,v.forEach(([e,t],n)=>{c(s,x,S+6,e),s.fillStyle=`#ffffff`,s.font=r(11,700),s.fillText(t,x+22,S+18.5),x+=y[n]}),s.lineWidth=1}}}var De=7,Y={left:-4e3,right:4500,bottom:-4e3,top:8e3},X={top:0,right:0,bottom:0,left:0},Oe=450,ke=`fiverunner:map-style`,Ae=`fiverunner:map-image`;function je(e){try{return localStorage.getItem(e)}catch{return null}}function Z(e,t){try{localStorage.setItem(e,t)}catch{}}var Me=class{element;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f={entities:[],blips:[]};#p=[];#m=(Y.left+Y.right)/2;#h=(Y.bottom+Y.top)/2;#g=.05;#_=!1;#v=[];#y=new Map;#b=new Map;#x=!1;#S=!0;#C;#w;constructor(e,t,n){this.element=e,this.#s=t,this.#l=n,this.#c=[V,Ce(),Ee(()=>this.#d)],this.#u=this.#c.find(({name:e})=>e===je(ke))??V;let r=document.createElement(`div`);r.className=`toolbar`;let i=document.createElement(`h2`);i.textContent=`Map`,this.#a=document.createElement(`select`),this.#a.setAttribute(`aria-label`,`Whose blips the map shows`),this.#a.addEventListener(`change`,()=>this.#R());let a=document.createElement(`select`);a.setAttribute(`aria-label`,`How the map looks`),a.append(...this.#c.map(({name:e})=>new Option(e,e))),a.value=this.#u.name,a.addEventListener(`change`,()=>{this.use(a.value),this.#s.styled?.(a.value)});let o=document.createElement(`button`);o.type=`button`,o.textContent=`Fit`,o.addEventListener(`click`,()=>{this.#_=!1,this.#M()}),this.#o=this.#E(),this.#i=document.createElement(`span`),this.#i.className=`hint`,this.#i.textContent=`Drag a player to move them, double-click to set their waypoint`,r.append(i,this.#a,a,o,this.#o,this.#i);let s=document.createElement(`div`);s.className=`view`,this.#n=s,this.#e=document.createElement(`canvas`),this.#t=this.#e.getContext(`2d`),this.#r=document.createElement(`div`),this.#r.className=`tooltip`,this.#r.hidden=!0,s.append(this.#e,this.#r),e.append(...n===void 0?[r,s]:[s]),new ResizeObserver(()=>this.#R()).observe(s),new IntersectionObserver(([e])=>{this.#S=e?.isIntersecting??!0,this.#T()}).observe(s),n===void 0&&this.#I(),this.use(this.#u.name)}show(e,t){let n=performance.now();for(let t of e.entities){let e=this.#b.get(t.id);if(this.#u.animated&&e!==void 0&&(e[0]!==t.x||e[1]!==t.y)){let[r,i]=this.#j(t.id,e,n);this.#y.set(t.id,{fromX:r,fromY:i,toX:t.x,toY:t.y,start:n})}this.#b.set(t.id,[t.x,t.y])}if(this.#f=e,t.map(({client:e,name:t})=>`${e} ${t}`).join()!==this.#p.map(({client:e,name:t})=>`${e} ${t}`).join()){let e=this.#a.value;this.#a.replaceChildren(new Option(`Blips of every player`,``),...t.map(({client:e,name:t})=>new Option(`Blips of ${t} (${e})`,String(e)))),this.#a.value=t.some(({client:t})=>String(t)===e)?e:``}this.#p=t,this.#_?this.#R():this.#M()}use(e){this.#u=this.#c.find(t=>t.name===e)??V,this.#l===void 0&&Z(ke,this.#u.name),this.#y.clear(),this.#o.hidden=this.#u.name!==`GTA`,this.#i.hidden=this.#u.instructions===!0,this.#n.dataset.style=this.#u.name,this.#_?this.#R():this.#M(),this.#T()}#T(){if(this.#x||!this.#u.animated||!this.#S)return;this.#x=!0;let e=()=>{!this.#u.animated||!this.#S?this.#x=!1:(this.#R(),requestAnimationFrame(e))};requestAnimationFrame(e)}#E(){let e=document.createElement(`details`);e.className=`map-image`;let t=document.createElement(`summary`);t.textContent=`Map image`;let n=document.createElement(`input`);n.type=`file`,n.accept=`image/*`,n.setAttribute(`aria-label`,`An image of the world to show under the map`);let r=JSON.parse(je(Ae)??`null`)??[Y.left,Y.top,Y.right,Y.bottom],i=[`Left`,`Top`,`Right`,`Bottom`].map((e,t)=>{let n=document.createElement(`input`);return n.type=`number`,n.value=String(r[t]),n.setAttribute(`aria-label`,`The ${e.toLowerCase()} edge of the image, in metres of the world`),n.title=`${e} edge, in metres`,n}),a,o=()=>{let[e,t,n,r]=i.map(e=>Number(e.value));Z(Ae,JSON.stringify([e,t,n,r])),this.#d=a===void 0?void 0:{image:a,left:e,top:t,right:n,bottom:r},this.#R()};n.addEventListener(`change`,()=>{let e=n.files?.[0];if(e===void 0)return;let t=new Image;t.addEventListener(`load`,()=>{a=t,o()}),t.src=URL.createObjectURL(e)});for(let e of i)e.addEventListener(`change`,o);return e.append(t,n,...i),e}get#D(){let e=this.#a.value;return e===``?this.#f.blips:this.#f.blips.filter(({client:t})=>String(t)===e)}get#O(){let e=this.#a.value;return e===``?void 0:Number(e)}get#k(){return this.#p.map(({client:e,name:t})=>{let n=this.#f.entities.find(({kind:t,owner:n})=>t===`player`&&n===e)?.look;return{client:e,name:t,colour:j(e),...n===void 0?{}:{look:n}}})}get#A(){let e=this.#a.value;return e===``?this.#p.find(({state:e})=>e===`joined`)?.client:Number(e)}#j(e,t,n){let r=this.#y.get(e);if(r===void 0)return[t[0],t[1]];let i=Math.min((n-r.start)/Oe,1);i===1&&this.#y.delete(e);let a=1-(1-i)**3;return[r.fromX+(r.toX-r.fromX)*a,r.fromY+(r.toY-r.fromY)*a]}#M(){if(this.#l!==void 0)return this.#R();let e=[...this.#D,...this.#f.entities],t=this.#e.getBoundingClientRect();if(t.width===0||t.height===0)return;let n=this.#u.insets?.(t.width,t.height)??X,r=Math.max(t.width-n.left-n.right,80),i=Math.max(t.height-n.top-n.bottom,80),a=Y.left,o=Y.right,s=Y.bottom,c=Y.top;e.length>0&&(a=Math.min(...e.map(({x:e})=>e)),o=Math.max(...e.map(({x:e})=>e)),s=Math.min(...e.map(({y:e})=>e)),c=Math.max(...e.map(({y:e})=>e)));let l=Math.max(o-a,c-s,200)*.15;this.#g=Math.min(r/(o-a+2*l),i/(c-s+2*l)),this.#m=(a+o)/2-(n.left-n.right)/2/this.#g,this.#h=(s+c)/2+(n.top-n.bottom)/2/this.#g,this.#R()}#N(){return this.#l??this.#e.getBoundingClientRect()}#P(e,t){let{width:n,height:r}=this.#N();return[(e-this.#m)*this.#g+n/2,(this.#h-t)*this.#g+r/2]}#F(e,t){let{width:n,height:r}=this.#N();return[(e-n/2)/this.#g+this.#m,this.#h-(t-r/2)/this.#g]}#I(){let e=this.#e,t=t=>{let n=e.getBoundingClientRect();return[t.clientX-n.left,t.clientY-n.top]};e.addEventListener(`wheel`,e=>{e.preventDefault(),this.#_=!0;let[n,r]=t(e),[i,a]=this.#F(n,r);this.#g=Math.min(Math.max(this.#g*(e.deltaY<0?1.25:.8),.005),40);let[o,s]=this.#F(n,r);this.#m+=i-o,this.#h+=a-s,this.#R()}),e.addEventListener(`mousedown`,e=>{let[n,r]=t(e),i=this.#L(n,r);i?.kind===`entity`&&i.entity.kind===`player`&&i.entity.owner!==void 0?(this.#_=!0,this.#w={kind:`player`,client:i.entity.owner,x:n,y:r}):this.#w={kind:`pan`,x:n,y:r,cx:this.#m,cy:this.#h}}),e.addEventListener(`mousemove`,e=>{let[n,r]=t(e),i=this.#w;i?.kind===`pan`?(this.#_=!0,this.#m=i.cx-(n-i.x)/this.#g,this.#h=i.cy+(r-i.y)/this.#g):i?.kind===`player`?(i.x=n,i.y=r):this.#C=this.#L(n,r)?.key,this.#R()}),e.addEventListener(`mouseup`,e=>{let n=this.#w;if(this.#w=void 0,n?.kind===`player`){let r=this.#L(...t(e),`blip`);r?.kind===`blip`?this.#s.teleport(n.client,r.blip.x,r.blip.y,r.blip.z):this.#s.teleport(n.client,...this.#F(...t(e)))}this.#R()}),e.addEventListener(`mouseleave`,()=>{this.#w=void 0,this.#C=void 0,this.#R()}),e.addEventListener(`dblclick`,e=>{let n=this.#A;if(n===void 0)return;let[r,i]=this.#F(...t(e));this.#s.waypoint(n,r,i)})}#L(e,t,n){let r,i=12;for(let a of this.#v){if(n!==void 0&&a.kind!==n)continue;let o=Math.hypot(a.sx-e,a.sy-t);o<=i&&(i=o,r=a)}return r}#R(){let e=this.#e,t=e.getBoundingClientRect();if(t.width===0||t.height===0)return;let{width:n,height:r}=this.#N(),i=devicePixelRatio*(t.width/n);(e.width!==Math.round(t.width*devicePixelRatio)||e.height!==Math.round(t.height*devicePixelRatio))&&(e.width=Math.round(t.width*devicePixelRatio),e.height=Math.round(t.height*devicePixelRatio));let a=performance.now(),o=this.#l;if(o!==void 0){let e=this.#f.entities.find(({kind:e,owner:t})=>e===`player`&&t===o.client);e!==void 0&&([this.#m,this.#h]=this.#j(e.id,[e.x,e.y],a)),this.#g=De}e.dataset.view=`${this.#m} ${this.#h} ${this.#g}`,e.dataset.players=JSON.stringify(this.#f.entities.flatMap(({kind:e,owner:t,x:n,y:r})=>e===`player`&&t!==void 0?[[t,n,r]]:[]));let s=this.#t;s.setTransform(i,0,0,i,0,0);let c=[],l={context:s,width:n,height:r,ratio:i,bare:o!==void 0,scale:this.#g,time:a,toScreen:(e,t)=>this.#P(e,t),toWorld:(e,t)=>this.#F(e,t),claim:(e,t,n,r,i=!1)=>{let a=!c.some(([i,a,o,s])=>e<i+o&&i<e+n&&t<a+s&&a<t+r);return(a||i)&&c.push([e,t,n,r]),a||i},crowding:(e,t,n,r)=>c.reduce((i,[a,o,s,c])=>i+Math.max(0,Math.min(e+n,a+s)-Math.max(e,a))*Math.max(0,Math.min(t+r,o+c)-Math.max(t,o)),0)},u=this.#u,d=this.#D,f=o===void 0?u.insets?.(n,r)??X:X;l.claim(0,0,n,f.top,!0),l.claim(n-f.right,0,f.right,r,!0),l.claim(0,r-f.bottom,n,f.bottom,!0),l.claim(0,0,f.left,r,!0),u.background(l,d),this.#v=[];let p=this.#f.entities.map(e=>{let t=this.#y.has(e.id),[n,r]=this.#j(e.id,[e.x,e.y],a);return{entity:e,moving:t,at:this.#P(n,r)}});for(let e of d)(e.shape===`radius`||e.shape===`area`)&&u.area(l,e,...this.#P(e.x,e.y));for(let e of d){if(!e.route)continue;let t=p.find(({entity:t})=>t.kind===`player`&&t.owner===e.client);t!==void 0&&u.route(l,t.at,this.#P(e.x,e.y),A(e.colour))}for(let e of d){let[t,n]=this.#P(e.x,e.y),r=`blip ${e.client} ${e.handle}`;this.#v.push({key:r,kind:`blip`,blip:e,sx:t,sy:n}),u.blip(l,e,t,n,this.#C===r)}let m=this.#k,h=[];for(let{entity:e,moving:t,at:n}of[...p].sort((e,t)=>e.at[1]-t.at[1])){let r=e.kind===`player`&&e.owner!==void 0?m.find(({client:t})=>t===e.owner)??{client:e.owner,name:void 0,colour:j(e.owner)}:void 0,[i,a]=u.entity(l,e,...n,t,r);this.#v.push({key:`entity ${e.id}`,kind:`entity`,entity:e,sx:i,sy:a}),r?.name!==void 0&&h.push([r.name,r.colour,...n])}for(let e of h)u.tag(l,...e);let g=this.#C,_=this.#v.filter(e=>e.kind===`blip`&&(e.key===g||this.#g>=.12));_.sort((e,t)=>Number(t.key===g)-Number(e.key===g));for(let e of _)e.kind===`blip`&&e.blip.name!==void 0&&u.label(l,e.blip.name,e.sx,e.sy,e.key===g);let v=this.#w;if(v?.kind===`player`){let e=p.find(({entity:e})=>e.kind===`player`&&e.owner===v.client)?.at,t=m.find(({client:e})=>e===v.client);u.dragging!==void 0&&e!==void 0&&t!==void 0?u.dragging(l,e,[v.x,v.y],t):(s.strokeStyle=j(v.client),s.setLineDash([4,4]),s.beginPath(),s.arc(v.x,v.y,9,0,Math.PI*2),s.stroke(),s.setLineDash([]))}o===void 0&&u.overlay?.(l,d,m,this.#O),this.#z()}#z(){let e=this.#w===void 0?this.#C:void 0,t=this.#v.find(({key:t})=>t===e);if(this.#r.hidden=t===void 0,t===void 0)return;let n=e=>this.#p.find(t=>t.client===e)?.name??`nobody`,r=(e,t)=>`${e.toFixed(1)}, ${t.toFixed(1)}`;this.#r.textContent=t.kind===`blip`?`${t.blip.name??(t.blip.sprite===8?`Waypoint`:`Blip`)}\n${r(t.blip.x,t.blip.y)}\nsprite ${t.blip.sprite}, colour ${t.blip.colour}\n${t.blip.script??`the player`}, on the map of ${n(t.blip.client)}`:`${t.entity.kind} ${t.entity.id}, model 0x${(t.entity.model>>>0).toString(16)}\n${r(t.entity.x,t.entity.y)}, z ${t.entity.z.toFixed(1)}, heading ${t.entity.heading.toFixed(0)}\nowned by ${n(t.entity.owner)}`,this.#r.style.left=`${t.sx+14}px`,this.#r.style.top=`${t.sy+14}px`}},Q=1920,Ne=1080,Pe=250,Fe={Escape:`ESCAPE`,Enter:`RETURN`,Backspace:`BACK`,Tab:`TAB`,Space:`SPACE`,CapsLock:`CAPITAL`,ShiftLeft:`LSHIFT`,ShiftRight:`RSHIFT`,ControlLeft:`LCONTROL`,ControlRight:`RCONTROL`,AltLeft:`LMENU`,AltRight:`RMENU`,ArrowUp:`UP`,ArrowDown:`DOWN`,ArrowLeft:`LEFT`,ArrowRight:`RIGHT`,PageUp:`PAGEUP`,PageDown:`PAGEDOWN`,Home:`HOME`,End:`END`,Insert:`INSERT`,Delete:`DELETE`,NumpadMultiply:`MULTIPLY`,NumpadAdd:`ADD`,NumpadSubtract:`SUBTRACT`,NumpadDecimal:`DECIMAL`,NumpadDivide:`DIVIDE`};function Ie(e){return/^Key[A-Z]$/.test(e)?e.slice(3):/^Digit\d$/.test(e)?e.slice(5):/^F\d{1,2}$/.test(e)?e:/^Numpad\d$/.test(e)?`NUMPAD${e.slice(6)}`:Fe[e]}var Le=class{element;world;#e;#t;#n;#r=new Map;#i=new Map;#a=new Map;#o=0;#s=[];#c=[];#l=1;#u=new Set;constructor(e,t){this.#n=t,this.element=document.createElement(`div`),this.element.className=`screen`,this.element.tabIndex=0;let n=document.createElement(`div`);n.className=`world`,this.world=new Me(n,{teleport:()=>{},waypoint:()=>{}},{client:e,width:Q/2,height:Ne/2}),this.#e=document.createElement(`div`),this.#e.className=`fade`,this.element.append(n,this.#e),this.#t=document.createElement(`div`),this.#t.className=`viewport`,this.#t.style.width=`${Q}px`,this.#t.style.height=`${Ne}px`,this.element.append(this.#t),new ResizeObserver(()=>{this.#l=this.element.clientWidth/Q,this.#t.style.transform=`scale(${this.#l})`}).observe(this.element),this.element.addEventListener(`keydown`,e=>this.#m(e,!0)),this.element.addEventListener(`keyup`,e=>this.#m(e,!1)),this.element.addEventListener(`blur`,()=>{for(let e of this.#u)this.#n.key(e,!1);this.#u.clear()}),this.element.addEventListener(`mousedown`,()=>this.element.focus()),this.element.addEventListener(`mousemove`,e=>{let t=this.#t.getBoundingClientRect();this.#h((e.clientX-t.left)/this.#l,(e.clientY-t.top)/this.#l)})}frameOf(e){for(let[t,n]of this.#r)if(n.contentWindow===e)return t}fade(e){this.#e.style.opacity=String(e)}blur(e){this.element.classList.toggle(`blurred`,e)}cursorOver(e,t){this.#h(e,t)}async create({resource:e,url:t}){let n=++this.#o;this.#a.set(e,n),this.#i.set(e,[]);let r=this.#n.frame(t);if(await this.#n.ready(r),this.#a.get(e)!==n)return;this.#a.delete(e);let i=document.createElement(`iframe`);i.name=e,i.style.visibility=`hidden`,i.allow=`microphone *; camera *; autoplay; payment 'none'; geolocation 'none';`,i.sandbox.value=`allow-forms allow-scripts allow-same-origin`,i.src=r,i.tabIndex=-1,i.addEventListener(`load`,()=>{i.style.visibility=`visible`,setTimeout(()=>{for(let t of this.#i.get(e)??[])this.#d(i,t);this.#i.delete(e)},Pe)}),this.#r.set(e,i),this.#s.push(e);let a=document.activeElement;this.#t.append(i),a instanceof HTMLIFrameElement&&a!==i&&a.focus()}destroy(e){this.#a.delete(e),this.#i.delete(e);let t=this.#r.get(e);t!==void 0&&(this.#s=this.#s.filter(t=>t!==e),t.remove(),this.#r.delete(e))}message(e,t){let n=this.#i.get(e),r=this.#r.get(e);n===void 0?r!==void 0&&this.#d(r,t):n.push(t)}#d(e,t){e.contentWindow?.postMessage(JSON.parse(t),`*`)}frameFocus(e,t){t?this.#f(e):this.#p(e)}zIndex(e,t){let n=this.#r.get(e);n!==void 0&&(n.style.zIndex=String(t))}focus(e,t){this.element.classList.toggle(`nui-cursor`,t),this.element.classList.toggle(`nui-focus`,e);let n=document.activeElement;!e&&n instanceof HTMLIFrameElement&&this.frameOf(n.contentWindow)&&this.element.focus()}#f(e){this.#s=[...this.#s.filter(t=>t!==e),e],this.#c=[e,...this.#c.filter(t=>t!==e)],this.#s.forEach((e,t)=>{let n=this.#r.get(e);n!==void 0&&(n.style.zIndex=String(t))});let t=this.#r.get(e);t!==void 0&&(t.style.zIndex=`99999`,t.contentWindow?.focus())}#p(e){this.#c=this.#c.filter(t=>t!==e),this.#r.get(e)?.contentWindow?.blur();let[t]=this.#c;t!==void 0&&this.#f(t)}#m(e,t){let n=Ie(e.code);if(n!==void 0&&e.target===this.element&&(e.preventDefault(),!(t&&e.repeat))){if(t)this.#u.add(n);else if(!this.#u.delete(n))return;this.#n.key(n,t)}}#h(e,t){this.#n.cursor(Math.round(e),Math.round(t))}};function $(e){return document.getElementById(e)}function Re({worker:e,frames:t,project:n,watch:r}){let i=t=>e.postMessage(t),o=$(`status`),s=$(`project`),u=new c($(`console`)),f=$(`resources-list`),m=$(`player-list`),h=new d($(`events`),$(`emit`),{emit:(e,t,n)=>i({type:`emit`,name:e,args:t,target:n})}),g=$(`bags`),v=new Me($(`map`),{teleport:(e,t,n,r)=>i({type:`teleport`,client:e,x:t,y:n,...r===void 0?{}:{z:r}}),waypoint:(e,t,n)=>i({type:`waypoint`,client:e,x:t,y:n}),styled:e=>{for(let t of b.values())t.screen.world.use(e)}}),y=new _({process:$(`inspected`),resources:$(`inspected-resources`),details:$(`inspected-details`),filter:$(`convar-filter`),convars:$(`convars`),form:$(`evaluate`),code:$(`code`)},{inspect:e=>i({type:`inspect`,process:e}),evaluate:(e,t,n)=>{(e===`server`?u:w(e).console).note(`${t}> ${n}`),i({type:`evaluate`,process:e,resource:t,code:n})}}),b=new Map,x=new Map,S=0;t.listen((e,t,n,r)=>{let a=S++;x.set(a,r),i({type:`ask`,id:a,client:e,host:t,ask:n})});function C(e,t){o.textContent=e,o.className=t}function w(e){let n=b.get(e);if(n!==void 0)return n;let r=document.createElement(`article`);r.className=`player`;let a=document.createElement(`header`),o=document.createElement(`span`);o.className=`info`;let s=document.createElement(`button`);s.textContent=`Enlarge`,s.addEventListener(`click`,()=>{let e=r.classList.toggle(`large`);s.textContent=e?`Shrink`:`Enlarge`});let l=document.createElement(`button`);l.textContent=`Disconnect`,l.addEventListener(`click`,()=>i({type:`disconnect`,client:e})),a.append(o,s,l);let u=document.createElement(`div`);u.className=`card`,u.hidden=!0;let d=new Le(e,{frame:n=>t.url(n,e),ready:e=>t.ready(e),cursor:(t,n)=>i({type:`cursor`,client:e,x:t,y:n}),key:(t,n)=>i({type:`key`,client:e,key:t,down:n})}),f=document.createElement(`div`);return f.className=`console small`,r.append(a,d.element,u,f),m.append(r),n={element:r,info:o,card:u,screen:d,console:new c(f),cardJson:void 0},b.set(e,n),n}function T(e,t,n){let r=n.state===`connecting`?n.card:void 0;if(t.cardJson===r||(t.cardJson=r,t.card.replaceChildren(),t.card.hidden=r===void 0,r===void 0))return;let o=a(r,t=>i({type:`submitCard`,client:e,json:t}));if(o!==void 0){t.card.append(o);return}let s=document.createElement(`pre`);s.textContent=r;let c=document.createElement(`form`),l=document.createElement(`textarea`);l.value=`{}`,l.setAttribute(`aria-label`,`What the card submits, as JSON`);let u=document.createElement(`button`);u.textContent=`Submit card`,c.append(l,u),c.addEventListener(`submit`,t=>{t.preventDefault(),i({type:`submitCard`,client:e,json:l.value})}),t.card.append(s,c)}function ee(e){f.replaceChildren(...e.resources.map(({name:e,state:t})=>{let n=document.createElement(`li`),r=document.createElement(`span`);r.textContent=e;let a=document.createElement(`span`);a.className=`state ${t}`,a.textContent=t,n.append(r,a);for(let r of t===`started`?[`restart`,`stop`]:[`start`]){let t=document.createElement(`button`);t.textContent=r,t.addEventListener(`click`,()=>i({type:`command`,line:`${r} "${e}"`})),n.append(t)}return n})),h.players(e.players),y.players(e.players),p(g,e.bags),v.show(e.map,e.players);for(let t of e.players){let n=w(t.client),r=t.state===`dropped`||t.state===`rejected`,i=t.state===`connecting`?t.message?.trim():void 0,a=t.rejection??i;n.info.textContent=`${t.name} (id ${t.id}) ${t.state}${a?`: ${a}`:``}`,n.element.classList.toggle(`gone`,r),n.screen.world.show(e.map,e.players),n.screen.fade(t.fade??0),n.screen.blur(t.blurred===!0),T(t.client,n,t)}}function E(e,t){let{screen:n}=w(e);switch(t.type){case`create`:n.create(t.frame);break;case`destroy`:n.destroy(t.resource);break;case`message`:n.message(t.resource,t.json);break;case`frameFocus`:n.frameFocus(t.resource,t.focused);break;case`focus`:n.focus(t.focus,t.cursor);break;case`zIndex`:n.zIndex(t.resource,t.zIndex)}}function te(e){let t=/^client (\d+)$/.exec(e.process)?.[1];t===void 0?u.add(e):w(Number(t)).console.add(e)}function D(e){C(`Starting`,`starting`),u.note(e),h.note(e);for(let e of b.values())e.element.remove();b.clear();let t=n();i({type:`start`,...t===void 0?{}:{project:t}})}e.addEventListener(`message`,e=>{let t=e.data;switch(t.type){case`started`:s.textContent=t.project.name,document.title=`${t.project.name} - FiveRunner`,C(`Running`,`running`);break;case`failed`:C(`Failed: ${t.message}`,`failed`),u.note(t.message);break;case`changed`:t.restarted===null?D(`Files changed`):t.restarted.length>0&&u.note(`Files changed: restarted ${t.restarted.join(`, `)}`);break;case`event`:{let{event:e}=t;e.type===`output`?te(e.line):e.type===`state`?ee(e.state):e.type===`nui`?E(e.client,e.event):e.type===`net`?h.add(e.event):(C(`Crashed`,`failed`),u.note(e.message));break}case`inspection`:y.show(t.inspection);break;case`answer`:x.get(t.id)?.(t.answer),x.delete(t.id)}}),addEventListener(`message`,e=>{for(let t of b.values()){let n=t.screen.frameOf(e.source);if(n===void 0)continue;let r=e.data;r.type===`fiverunner:cursor`&&typeof r.x==`number`&&typeof r.y==`number`?t.screen.cursorOver(r.x,r.y):r.type===`fiverunner:invokeNative`&&t.console.note(`${n} called invokeNative('${String(r.native)}', '${String(r.arg)}')`);return}}),$(`command`).addEventListener(`submit`,e=>{e.preventDefault();let t=$(`command-line`),n=t.value;n.trim()!==``&&(O(n),u.note(`> ${n}`),i({type:`command`,line:n}),t.value=``)});let O=l($(`command-line`));$(`connect`).addEventListener(`submit`,e=>{e.preventDefault();let t=$(`player-name`).value.trim();i({type:`connect`,name:t===``?`Player`:t})}),$(`restart`).addEventListener(`click`,()=>D(`Restarted`)),r(e=>i({type:`change`,paths:e})),D(`Started`)}var ze=`fiverunner.localhost`,Be=new TextEncoder,Ve=new TextDecoder;function He({host:e,client:t,tab:n}){let r=e.replace(/[A-Z]/g,e=>e.toLowerCase());return`${/^[a-z0-9_-]+$/.test(r)?r:`${Array.from(Be.encode(r),e=>e.toString(16).padStart(2,`0`)).join(``)}.x`}.c${t}.${n}.${ze}`}function Ue(e){let t=/^(.+)\.c([1-9][0-9]*)\.([a-z0-9]+)\.fiverunner\.localhost$/.exec(e);if(t===null)return;let[,n=``,r=``,i=``]=t,a=Number(r);if(/^[a-z0-9_-]+$/.test(n))return{host:n,client:a,tab:i};let o=/^((?:[0-9a-f]{2})+)\.x$/.exec(n)?.[1];if(o===void 0)return;let s=Uint8Array.from(o.match(/../g),e=>parseInt(e,16));return{host:Ve.decode(s),client:a,tab:i}}function We(e,t,n,r){let i=/^(?:nui:\/\/|https:\/\/(?=cfx-nui-))([^/?#]*)(.*)$/i.exec(e);if(i===null)return e;let[,a=``,o=``]=i,s=o.startsWith(`/`)?o:`/${o}`;return`http://${He({host:a,client:t,tab:n})}${r===``?``:`:${r}`}${s}`}function Ge(){let e=`fiverunner:tab`;try{let t=sessionStorage.getItem(e);if(t!==null&&/^[a-z0-9]{1,16}$/.test(t))return t;let n=Math.random().toString(36).slice(2,10);return sessionStorage.setItem(e,n),n}catch{return Math.random().toString(36).slice(2,10)}}var Ke=class{#e=Ge();#t;#n=new Map;#r=new Map;#i=()=>{};constructor(e){this.#t=e,addEventListener(`message`,e=>{let t=this.#n.get(e.origin);if(t===void 0||e.source!==t.frame.contentWindow)return;let n=e.data;n.type===`fiverunner:bridge`?this.#r.get(e.origin)?.():n.type===`fiverunner:ask`&&this.#a(e.origin,t.frame,n.id,n.ask)})}url(e,t){return We(e,t,this.#e,location.port)}ready(t){let n=new URL(t);if(Ue(n.hostname)===void 0)return Promise.resolve();let{origin:r}=n,i=this.#n.get(r);if(i===void 0){let t=document.createElement(`iframe`);t.src=`${r}${e}bridge.html`,t.title=`FiveRunner NUI bridge`,i={frame:t,ready:new Promise(e=>this.#r.set(r,e))},this.#n.set(r,i),this.#t.append(t)}return i.ready}listen(e){this.#i=e}#a(e,t,n,r){let i=Ue(new URL(e).hostname);i!==void 0&&i.tab===this.#e&&this.#i(i.client,i.host,r,r=>{let i={type:`fiverunner:answer`,id:n,answer:r};t.contentWindow?.postMessage(i,e)})}};Re({worker:new Worker(new URL(`/__fiverunner/assets/worker-BfZwl0oS.js`,``+import.meta.url),{type:`module`}),frames:new Ke(document.getElementById(`bridges`)),project:()=>void 0,watch(e){new EventSource(`${t}events`).addEventListener(`change`,t=>e(JSON.parse(t.data)))}});
|
|
1
|
+
import{t as e}from"./routes-DFIWFSAi.js";var t=`/__fiverunner/api/`;new TextDecoder;function n(e,t){let n=document.createElement(`label`);return n.append(t,e),n}function r(e,t){switch(e.type){case`TextBlock`:{let t=document.createElement(`p`);return t.textContent=e.text??``,t.classList.toggle(`large`,/large/i.test(e.size??``)),t.classList.toggle(`bold`,e.weight===`Bolder`),[t]}case`Input.Text`:case`Input.Number`:{let n=document.createElement(e.isMultiline?`textarea`:`input`);return n.placeholder=e.placeholder??``,n.value=e.value??``,n.ariaLabel=e.placeholder??e.id??``,t.set(e.id??``,()=>n.value),[n]}case`Input.Toggle`:{let r=document.createElement(`input`);r.type=`checkbox`;let i=e.valueOn??`true`;return r.checked=e.value===i,t.set(e.id??``,()=>r.checked?i:e.valueOff??`false`),[n(e.title??``,r)]}case`Input.ChoiceSet`:{let n=document.createElement(`select`);n.ariaLabel=e.id??``;for(let{title:t,value:r}of e.choices??[])n.add(new Option(t,r));return n.value=e.value??n.value,t.set(e.id??``,()=>n.value),[n]}case`Container`:case`Column`:return i(e.items??[],t);case`ColumnSet`:return i(e.columns??[],t);default:return}}function i(e,t){let n=e.map(e=>r(e,t));return n.every(e=>e!==void 0)?n.flat():void 0}function a(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=new Map,a=i(n.body??[],r);if(a===void 0)return;let o=document.createElement(`form`);o.className=`adaptive`,o.addEventListener(`submit`,e=>e.preventDefault()),o.append(...a);for(let e of n.actions??[]){if(e.type!==`Action.Submit`)return;let n=document.createElement(`button`);n.textContent=e.title??`Submit`,n.addEventListener(`click`,()=>{let n=Object.fromEntries([...r].map(([e,t])=>[e,t()])),i=e.id===void 0?{}:{submitId:e.id};t(JSON.stringify({...n,...e.data,...i}))}),o.append(n)}return o}var o=[``,`red`,`green`,`yellow`,`blue`,`cyan`,`magenta`,``,`orange`,`gray`],s=2e3,c=class{element;constructor(e){this.element=e}add(e){this.entry(e.channel,e.text,`kind-${e.kind}`)}entry(e,t,n){let r=document.createElement(`div`);r.className=`line ${n}`;let i=document.createElement(`span`);i.className=`channel`,i.textContent=`[${e}] `,r.append(i,...u(t)),this.#e(r)}note(e){let t=document.createElement(`div`);t.className=`line note`,t.textContent=e,this.#e(t)}#e(e){let{element:t}=this,n=t.scrollHeight-t.scrollTop-t.clientHeight<4;for(t.append(e);t.childElementCount>s;)t.firstElementChild.remove();n&&(t.scrollTop=t.scrollHeight)}};function l(e){let t=[],n=0;return e.addEventListener(`keydown`,r=>{(r.key===`ArrowUp`||r.key===`ArrowDown`)&&(r.preventDefault(),n=Math.max(0,Math.min(t.length,n+(r.key===`ArrowUp`?-1:1))),e.value=t[n]??``)}),e=>{t.push(e),n=t.length}}function u(e){let t=[],n=``;for(let[r,i]of e.split(/\^(\d)/).entries())if(r%2==1)n=o[Number(i)]??``;else if(i!==``){let e=document.createElement(`span`);n!==``&&(e.className=`color-${n}`),e.textContent=i,t.push(e)}return t}var d=class{#e;#t;#n=new Map;constructor(e,t,n){this.#e=new c(e),this.#t=t.elements.namedItem(`target`);let r=t.elements.namedItem(`name`),i=t.elements.namedItem(`args`);t.addEventListener(`submit`,e=>{e.preventDefault();let t=f(this.#t.value);if(t===void 0||r.value.trim()===``)return;let a;try{a=JSON.parse(i.value.trim()===``?`[]`:i.value)}catch(e){this.#e.note(`The arguments are no JSON: ${String(e)}`);return}Array.isArray(a)?n.emit(r.value.trim(),a,t):this.#e.note(`The arguments are a JSON array, such as [100, "cash"]`)}),this.players([])}add({from:e,to:t,name:n,args:r}){this.#e.entry(`${this.#r(e)} -> ${this.#r(t)}`,`${n}(${r})`,`kind-event`)}note(e){this.#e.note(e)}players(e){this.#n.clear();for(let{client:t,name:n}of e)this.#n.set(t,n);let t=e.filter(({state:e})=>e===`joined`),n=[...t.map(({client:e,name:t})=>[`from:${e}`,`To the server, from ${t}`]),...t.map(({client:e,name:t})=>[`to:${e}`,`To ${t}, from the server`]),[`to:everyone`,`To every player, from the server`]],r=this.#t.value;this.#t.replaceChildren(...n.map(([e,t])=>{let n=document.createElement(`option`);return n.value=e,n.textContent=t,n})),n.some(([e])=>e===r)&&(this.#t.value=r)}#r(e){return e===`server`?`server`:this.#n.get(e)??`client ${e}`}};function f(e){let[t,n]=e.split(`:`);if(t===`to`&&n===`everyone`)return{to:`everyone`};let r=Number(n);if(!(!Number.isInteger(r)||r<1))return t===`from`?{from:r}:{to:r}}function p(e,t){if(t.length===0){let t=document.createElement(`p`);t.className=`empty`,t.textContent=`No state bag has keys.`,e.replaceChildren(t)}else e.replaceChildren(...t.map(({name:e,keys:t})=>{let n=document.createElement(`section`),r=document.createElement(`h3`);r.textContent=e;let i=document.createElement(`dl`);for(let{key:e,value:n}of t){let t=document.createElement(`dt`);t.textContent=e;let r=document.createElement(`dd`);r.textContent=n,i.append(t,r)}return n.append(r,i),n}))}var m=1e3,h=[[`Exports`,({exports:e})=>e],[`Events`,({events:e})=>e],[`NUI callbacks`,({nuiCallbacks:e})=>e],[`Commands`,({commands:e})=>e],[`Key mappings`,({keyMappings:e})=>e],[`KVP`,({kvp:e})=>e.map(({key:e,value:t})=>`${e} = ${t}`)]],g=e=>String(e),_=class{#e;#t;#n=new Map;#r;#i;#a=``;#o=``;constructor(e,t){this.#t=e,this.#e=t;let{process:n,form:r,code:i,filter:a}=e;this.players([]),n.addEventListener(`change`,()=>{this.#r=void 0,this.#c()});let o=l(i);r.addEventListener(`submit`,e=>{e.preventDefault(),i.value.trim()!==``&&this.#i!==void 0&&(t.evaluate(this.#s,this.#i,i.value),o(i.value),i.value=``)}),a.addEventListener(`input`,()=>this.#f()),setInterval(()=>this.#c(),m)}players(e){let{process:t}=this.#t,n=t.value,r=[[`server`,`Server`],...e.filter(({state:e})=>e===`joined`).map(({client:e,name:t})=>[g(e),t])];t.replaceChildren(...r.map(([e,t])=>{let n=document.createElement(`option`);return n.value=e,n.textContent=t,n})),t.value=r.some(([e])=>e===n)?n:`server`}show(e){if(e.process!==this.#s)return;this.#l(e),this.#r=e,this.#d();let t=JSON.stringify(e.convars);t!==this.#o&&(this.#o=t,this.#t.convars.replaceChildren(...e.convars.flatMap(({name:e,value:t})=>{let n=document.createElement(`dt`);n.textContent=e;let r=document.createElement(`dd`);return r.textContent=t,[n,r]})),this.#f())}get#s(){let{value:e}=this.#t.process;return e===`server`?e:Number(e)}#c(){document.hidden||this.#e.inspect(this.#s)}#l({resources:e,ticks:t}){let n=this.#t.resources,r=e.map(({name:e})=>e);r.join()!==[...this.#n.keys()].join()&&(this.#n.clear(),n.replaceChildren(...r.map(e=>this.#u(e))));let i=this.#r;for(let n of e){let e=this.#n.get(n.name);e.classList.toggle(`stopped`,n.state!==`started`),e.classList.toggle(`chosen`,n.name===this.#i);let r=i?.resources.find(({name:e})=>e===n.name),a=t-(i?.ticks??0);r!==void 0&&a>0&&(e.lastElementChild.textContent=`${((n.cpu-r.cpu)/a).toFixed(2)} ms`)}}#u(e){let t=document.createElement(`button`);t.type=`button`;let n=document.createElement(`span`);return n.textContent=e,t.append(n,document.createElement(`span`)),t.addEventListener(`click`,()=>{this.#i=e;for(let[t,n]of this.#n)n.classList.toggle(`chosen`,t===e);this.#d()}),this.#n.set(e,t),t}#d(){let e=this.#r?.resources.find(({name:e})=>e===this.#i),{details:t,code:n}=this.#t;n.disabled=e===void 0,n.placeholder=e===void 0?`Pick a resource to run code in it`:`Code to run in ${e.name}, such as GetNumResources()`;let r=JSON.stringify(e&&{...e,cpu:0});r!==this.#a&&(this.#a=r??``,e===void 0?t.textContent=`Pick a resource`:t.replaceChildren(...h.flatMap(([t,n])=>{let r=n(e);if(r.length===0)return[];let i=document.createElement(`h3`);i.textContent=`${t} (${r.length})`;let a=document.createElement(`ul`);return a.replaceChildren(...r.map(e=>{let t=document.createElement(`li`);return t.textContent=e,t})),[i,a]})))}#f(){let{convars:e,filter:t}=this.#t,n=t.value.trim().toLowerCase();for(let t of e.querySelectorAll(`dt`)){let e=!t.textContent.toLowerCase().includes(n);t.hidden=e,t.nextElementSibling.hidden=e}}},v=[657415,1708816,2497301,3351579,4140064,4994598,5914672,6834999,7755326,8675910,9662543,10649435,11570534,12360562,13085055,13743756,14336923,14864298,15326139,15721932,16051933,4004370,5382682,7023388,8729630,10370848,12078372,13393708,14251837,14914910,3874639,5580911,7485856,9523911,11894496,7149638,10231646,13184891,14899868,15765437,1780843,2311326,3106761,5215203,8830448,1003351,1407616,2073507,1923628,2787900,5749063,10802750,15255082,15769892,15232287,13185054,2829101,4474183,6250595,8158592,10263968,12369343,14343132,15987697],y=new Map([[8,`flag`],[40,`house`],[50,`car`],[52,`basket`],[56,`badge`],[59,`basket`],[60,`badge`],[61,`cross`],[67,`car`],[68,`lock`],[71,`scissors`],[72,`spray`],[73,`shirt`],[75,`heart`],[93,`bottle`],[102,`syringe`],[108,`dollar`],[110,`gun`],[198,`car`],[225,`car`],[273,`cutlery`],[326,`car`],[356,`boat`],[357,`parking`],[359,`plane`],[360,`plane`],[361,`fuel`],[366,`shirt`],[402,`wrench`],[403,`pill`],[423,`plane`],[424,`plane`],[427,`boat`],[477,`car`],[566,`anvil`],[729,`anchor`]]);function b(e){return y.get(e)}function x(e,t,n=!1){let r=0;for(let e=0;e<t.length;e+=2){let n=(e+2)%t.length;r+=t[e]*t[n+1]-t[n]*t[e+1]}let i=[...Array(t.length/2).keys()];r>0===n&&i.reverse(),i.forEach((n,r)=>{r===0?e.moveTo(t[2*n],t[2*n+1]):e.lineTo(t[2*n],t[2*n+1])}),e.closePath()}function S(e,t,n,r,i=!1){e.moveTo(t+r,n),e.arc(t,n,r,0,Math.PI*2,i),e.closePath()}function C(e,t){let n=new Path2D;return n.addPath(e,new DOMMatrix().rotate(t)),n}function w(e,t,n=0){let r=new Path2D;e(r);let i=n===0?r:C(r,n);return t===void 0?{path:i}:{path:i,width:t}}var T;function ee(){return{anchor:[w(e=>{S(e,0,-5.4,2.1),S(e,0,-5.4,1,!0),e.roundRect(-.95,-3.6,1.9,10.4,.6),e.roundRect(-3.8,-2.6,7.6,1.7,.85),x(e,[-7.4,1.2,-4.2,1.2,-5.8,3.6]),x(e,[7.4,1.2,4.2,1.2,5.8,3.6])}),w(e=>{e.moveTo(-5.8,2.4),e.quadraticCurveTo(-5,6.6,0,6.7),e.quadraticCurveTo(5,6.6,5.8,2.4)},1.7)],anvil:[w(e=>x(e,[-6.4,-4.4,4.2,-4.4,7.8,-3.4,4.6,-1.4,2.6,-1.4,2.6,1.6,4.8,4.4,4.8,6.2,-4.8,6.2,-4.8,4.4,-2.6,1.6,-2.6,-1.4,-6.4,-1.4]))],badge:[w(e=>{let t=[];for(let e=0;e<10;e++){let n=e*Math.PI/5-Math.PI/2,r=e%2==0?7.8:3.4;t.push(Math.cos(n)*r,Math.sin(n)*r+.6)}x(e,t)})],basket:[w(e=>{e.roundRect(-7.8,-2.4,15.6,2.4,1),x(e,[-6.8,-.4,6.8,-.4,5.2,6.6,-5.2,6.6]);for(let t of[-3.7,-.75,2.2])x(e,[t,1.2,t+1.5,1.2,t+1.5,5,t,5],!0)}),w(e=>{e.moveTo(-4.6,-2.4),e.arc(0,-2.4,4.6,Math.PI,Math.PI*2)},1.6)],boat:[w(e=>{x(e,[-7.6,2,7.6,2,5,6.6,-5,6.6]),x(e,[.6,-7.6,6,.8,.6,.8]),x(e,[-.6,-5.6,-.6,.8,-5,.8])})],bottle:[w(e=>{e.roundRect(-1.9,-7.8,3.8,1.6,.6),e.roundRect(-1.35,-6.6,2.7,3,.4),x(e,[-1.35,-4,1.35,-4,3.7,-1.4,-3.7,-1.4]),e.roundRect(-3.7,-2.4,7.4,10.2,1.8),x(e,[-2.3,.6,2.3,.6,2.3,4.2,-2.3,4.2],!0)})],car:[w(e=>{e.roundRect(-7.6,-1.6,15.2,5,1.8),x(e,[-4.8,-1.6,-2.9,-5.8,3.1,-5.8,5.2,-1.6]),x(e,[-2.9,-2.4,-.4,-2.4,-.4,-4.8,-2.1,-4.8],!0),x(e,[.5,-2.4,3.6,-2.4,2.6,-4.8,.5,-4.8],!0),S(e,-4.2,3.6,2.2),S(e,4.2,3.6,2.2)})],cross:[w(e=>{e.roundRect(-2.7,-7.4,5.4,14.8,1),e.roundRect(-7.4,-2.7,14.8,5.4,1)})],cutlery:[w(e=>{e.roundRect(-5.6,-3.4,5,2.6,1.3),x(e,[2,-7.6,4.9,-4.8,4.9,.6,2,.6])}),w(e=>{e.moveTo(-3.1,-1.4),e.lineTo(-3.1,7),e.moveTo(3.4,.6),e.lineTo(3.4,7)},1.9),w(e=>{for(let t of[-5,-3.1,-1.2])e.moveTo(t,-7.4),e.lineTo(t,-2.6)},1.1)],dollar:[w(e=>{e.moveTo(0,-7.6),e.lineTo(0,7.6)},1.6),w(e=>{e.moveTo(4.3,-3.9),e.bezierCurveTo(3.3,-6.3,-4.6,-6.3,-4.4,-2.6),e.bezierCurveTo(-4.2,.2,4.4,-.4,4.4,2.8),e.bezierCurveTo(4.4,6.5,-3.6,6.5,-4.6,3.8)},2.3)],flag:[w(e=>{e.roundRect(-5.4,-7.8,1.9,15.6,.9),e.moveTo(-3.8,-7.4),e.quadraticCurveTo(.8,-9.4,6.8,-6),e.quadraticCurveTo(.8,-2.4,-3.8,-1.2),e.closePath()})],fuel:[w(e=>{e.roundRect(-6.6,-7,8.6,14.4,1.6),x(e,[-5,-5.4,.4,-5.4,.4,-1.6,-5,-1.6],!0),e.roundRect(-7.6,5.6,10.6,1.8,.6)}),w(e=>{e.moveTo(2,-3.4),e.lineTo(4.6,-3.4),e.lineTo(5.8,-1.8),e.lineTo(5.8,4.2),e.quadraticCurveTo(5.8,5.4,4.6,5.2)},1.5)],gun:[w(e=>x(e,[-7.4,-4.6,7,-4.6,7,-1.4,-.4,-1.4,-1.1,1.8,-2.7,1.8,-3.6,6.6,-7.2,6.6,-5.7,-1.4,-7.4,-1.4])),w(e=>{e.moveTo(-.4,-1.4),e.quadraticCurveTo(.6,2.4,-2.4,2)},1.1)],heart:[w(e=>{S(e,-3.2,-2.4,3.8),S(e,3.2,-2.4,3.8),x(e,[-6.8,-1,6.8,-1,0,7])})],house:[w(e=>x(e,[0,-7.8,7.8,-.4,5.2,-.4,5.2,7.2,1.6,7.2,1.6,2.6,-1.6,2.6,-1.6,7.2,-5.2,7.2,-5.2,-.4,-7.8,-.4]))],lock:[w(e=>{e.moveTo(-3.7,-.6),e.lineTo(-3.7,-3.6),e.arc(0,-3.6,3.7,Math.PI,Math.PI*2),e.lineTo(3.7,-.6)},2),w(e=>{e.roundRect(-6.2,-1.8,12.4,9.4,1.8);let t=Math.sqrt(1.5**2-.6**2);e.moveTo(.6,1.8+t),e.arc(0,1.8,1.5,Math.atan2(t,.6),Math.atan2(t,-.6),!0),e.lineTo(-1,5.2),e.lineTo(1,5.2),e.closePath()})],parking:[w(e=>{e.roundRect(-7.2,-7.2,14.4,14.4,3),e.moveTo(-2.9,4.9),e.lineTo(-.8,4.9),e.lineTo(-.8,1.1),e.lineTo(.8,1.1),e.arc(.8,-1.9,3,Math.PI/2,-Math.PI/2,!0),e.lineTo(-2.9,-4.9),e.closePath(),e.moveTo(-.8,-3),e.lineTo(.7,-3),e.arc(.7,-1.9,1.1,-Math.PI/2,Math.PI/2),e.lineTo(-.8,-.8),e.closePath()})],pill:[w(e=>{e.roundRect(-3.1,-7.6,6.2,15.2,3.1),x(e,[-3.1,-.45,3.1,-.45,3.1,.45,-3.1,.45],!0)},void 0,45)],plane:[w(e=>{e.moveTo(0,-8),e.quadraticCurveTo(1.6,-7,1.6,-3),e.lineTo(8,1),e.lineTo(8,2.6),e.lineTo(1.6,.6),e.lineTo(1.1,5),e.lineTo(3.6,7),e.lineTo(3.6,8),e.lineTo(0,7),e.lineTo(-3.6,8),e.lineTo(-3.6,7),e.lineTo(-1.1,5),e.lineTo(-1.6,.6),e.lineTo(-8,2.6),e.lineTo(-8,1),e.lineTo(-1.6,-3),e.quadraticCurveTo(-1.6,-7,0,-8),e.closePath()})],scissors:[w(e=>{for(let t of[-3.5,3.5])S(e,t,4.3,2.8),S(e,t,4.3,1.35,!0);x(e,[-2.9,2,-1.3,2.5,3.9,-7.4,2.5,-7.8]),x(e,[2.9,2,1.3,2.5,-3.9,-7.4,-2.5,-7.8])})],shirt:[w(e=>{e.moveTo(-3,-7.2),e.lineTo(-7.8,-4.6),e.lineTo(-5.8,-.4),e.lineTo(-4.2,-1.4),e.lineTo(-4.2,7.2),e.lineTo(4.2,7.2),e.lineTo(4.2,-1.4),e.lineTo(5.8,-.4),e.lineTo(7.8,-4.6),e.lineTo(3,-7.2),e.quadraticCurveTo(0,-4.2,-3,-7.2),e.closePath()})],spray:[w(e=>{e.roundRect(-4.6,-3.2,7.2,11,1.6),x(e,[-3.4,0,1.4,0,1.4,3.4,-3.4,3.4],!0),e.roundRect(-3.2,-5.8,4.4,2.8,.8),e.roundRect(-1.8,-7.4,1.6,1.8,.4),S(e,2.6,-6.6,.9),S(e,4.6,-7.4,.8),S(e,4.8,-5.2,.9),S(e,6.8,-6.2,.8)})],syringe:[w(e=>{e.roundRect(-2.7,-4.2,5.4,8.2,.9),x(e,[-1.2,-2.8,1.2,-2.8,1.2,2.6,-1.2,2.6],!0),e.roundRect(-3.4,3.4,6.8,1.3,.5),e.roundRect(-.7,4.6,1.4,2.2,.3),e.roundRect(-2.6,6.6,5.2,1.3,.5),e.roundRect(-1,-5.4,2,1.4,.4),x(e,[-.55,-5.2,.55,-5.2,0,-8.4])},void 0,45)],wrench:[w(e=>{e.roundRect(-1.4,-1.4,2.8,9.4,1.4);let t=Math.sqrt(3.7**2-1.25**2);e.moveTo(1.25,-4.2-t),e.arc(0,-4.2,3.7,Math.atan2(-t,1.25),Math.atan2(-t,-1.25)+Math.PI*2),e.lineTo(-1.25,-3.5),e.lineTo(1.25,-3.5),e.closePath()},void 0,45)]}}function E(e,t,n,r=0){T??=ee();let i=T[t],a=n/16,o=e.fillStyle;if(e.save(),e.scale(a,a),e.lineJoin=`round`,e.lineCap=`round`,r>0)for(let{path:t,width:n}of i)e.lineWidth=(n??0)+r*2/a,e.stroke(t);e.strokeStyle=o;for(let{path:t,width:n}of i)n===void 0?e.fill(t):(e.lineWidth=n,e.stroke(t));e.restore()}var te=`#f0f0f0.#e04646.#6fcf6f.#5a9ef0.#f0f0f0.#f0d24a.#e57373.#b07ee0.#f080c0.#f0b070.#c8a070.#90e090.#80c8f0.#c8a0f0.#7050b0.#50d0d0.#f0e090.#f09030.#6aa8f0.#c05090.#c0a030.#d07020.#b0b0b0.#f0b0d0.#c0e050.#3a8a3a.#4060f0.#a040f0.#806050.#304090.#208080.#b09070.#90c0f0.#f0e8a0.#f0a8c0.#f08080.#e0d0a0.#f4f4f4.#3c78e0.#c0c0c0.#606060.#f06080.#4c8ce0.#a0e0a0.#f0c080.#f8f8f8.#e0b030.#f08c28.#f050a0.#d83c3c.#9070d0.#f09080.#2c7a3c.#a0d8f0.#3c6e7a.#c0c8d0.#8a5a30.#4a80e0.#4a5a8a.#e04848.#f0b040.#c04890.#d0d0d0.#3a7aa0.#c86020.#8a7a9a.#f0b440.#4a88e8.#5090e8.#58c058.#f0b848.#f0bc4c.#202020.#f0b040.#4888e0.#e04040.#a02828.#4888e8.#5090f0.#284080.#505050.#f0d840.#a0e040.#9050c0.#4878d8.#484848`.split(`.`),D=[`#f0a030`,`#4fd6e0`,`#d070f0`,`#5fd068`,`#ff5c5c`,`#5c8dff`],O=[10,25,50,100,250,500,1e3,2e3],ne=`Bahnschrift, 'Arial Narrow', 'Roboto Condensed', 'Helvetica Neue', Arial, sans-serif`,k=`'Nunito', 'Varela Round', 'Segoe UI', system-ui, sans-serif`;function re(e,t,n){let r=t*Math.min(n,1-n),i=t=>{let i=(t+e/30)%12,a=n-r*Math.max(-1,Math.min(i-3,9-i,1));return Math.round(a*255).toString(16).padStart(2,`0`)};return`#${i(0)}${i(8)}${i(4)}`}function A(e){return te[e]??re(e*137.5%360,.7,.62)}function j(e){return D[(e-1)%D.length]}function M(e){let t=Number.parseInt(e.slice(1,7),16);return[t>>16&255,t>>8&255,t&255]}function N(e,t){let[n,r,i]=M(e).map(e=>Math.round(t<0?e*(1+t):e+(255-e)*t));return`rgb(${n} ${r} ${i})`}function P(e){let[t,n,r]=M(e).map(e=>(e/255)**2.2);return .2126*t+.7152*n+.0722*r}function F(e,t,n,r=[],i=0){let{context:a,width:o,height:s}=e,c=O.find(t=>t*e.scale>=70)??O.at(-1),[l,u]=e.toWorld(0,0),[d,f]=e.toWorld(o,s);a.lineWidth=1,a.font=n,a.fillStyle=t.text,a.setLineDash(r);for(let n=Math.ceil(l/c)*c;n<=d;n+=c){let[r]=e.toScreen(n,0);a.strokeStyle=n===0?t.axis:t.line,a.beginPath(),a.moveTo(Math.round(r)+.5,0),a.lineTo(Math.round(r)+.5,s),a.stroke(),e.bare!==!0&&a.fillText(String(n),r+3,i+12)}for(let n=Math.ceil(f/c)*c;n<=u;n+=c){let[,r]=e.toScreen(0,n);a.strokeStyle=n===0?t.axis:t.line,a.beginPath(),a.moveTo(0,Math.round(r)+.5),a.lineTo(o,Math.round(r)+.5),a.stroke(),r>i+20&&e.bare!==!0&&a.fillText(String(n),3,r-3)}a.setLineDash([])}function I(e,t,n,r,i){let a=r.findIndex(([r,i])=>e.claim(r,i,t,n));if(a>=0)return a;if(!i)return;let o=r.map(([r,i])=>e.crowding(r,i,t,n)),s=o.indexOf(Math.min(...o));return e.claim(...r[s],t,n,!0),s}function L(e,t,n,r,i,a,o=!1){let{context:s}=e;s.font=a;let c=s.measureText(t).width,l=([e,,t])=>t===`center`?e-c/2:t===`right`?e-c:e,u=I(e,c+4,16,n.map(e=>[l(e)-2,e[1]-12]),o);if(u===void 0)return;let d=l(n[u]),f=n[u][1];s.lineJoin=`round`,s.lineWidth=3,s.strokeStyle=i,s.strokeText(t,d,f),s.fillStyle=r,s.fillText(t,d,f),s.lineWidth=1}var R=e=>-e.heading*Math.PI/180;function z(e,t){let n=Math.sin(e*127.1+t*311.7)*43758.5453;return n-Math.floor(n)}var ie=Float64Array.from({length:512},(e,t)=>{let n=Math.floor(t/2)/256*Math.PI*2;return t%2==0?Math.cos(n):Math.sin(n)});function ae(e,t){let n=Math.imul(e|0,668265261)^Math.imul(t|0,374761393);return n=Math.imul(n^n>>>15,2246822507),((n^n>>>13)&255)*2}function oe(e,t){let n=Math.floor(e),r=Math.floor(t),i=e=>e*e*e*(e*(e*6-15)+10),a=(n,r)=>{let i=ae(n,r);return ie[i]*(e-n)+ie[i+1]*(t-r)},o=i(e-n),s=i(t-r),c=a(n,r)+(a(n+1,r)-a(n,r))*o;return .5+(c+(a(n,r+1)+(a(n+1,r+1)-a(n,r+1))*o-c)*s)*.75}function se(e,t){return oe(e,t)*.68+oe((e*.8-t*.6)*2.1+31,(e*.6+t*.8)*2.1-7)*.32}function B(e,t){return 2**Math.round(Math.log2(t/e.scale))}function ce(e=1/0){let t,n=``;return(r,i,a=``)=>{let[o,s]=r.toWorld(0,0),c=`${r.width} ${r.height} ${r.ratio} ${o} ${s} ${r.scale} ${a}`;if(t??=document.createElement(`canvas`),c!==n){let a=Math.min(r.ratio,e),o=Math.round(r.width*a),s=Math.round(r.height*a);(t.width!==o||t.height!==s)&&(t.width=o,t.height=s);let l=t.getContext(`2d`);l.setTransform(1,0,0,1,0,0),l.clearRect(0,0,o,s),l.setTransform(a,0,0,a,0,0),i({...r,context:l,ratio:a}),n=c}r.context.drawImage(t,0,0,r.width,r.height)}}function le(e){let t=e.length;for(let{x:n,y:r}of e)t=(t*31+Math.round(n)*7+Math.round(r))%1e9;return String(t)}var V={name:`Classic`,animated:!1,background(e){e.context.clearRect(0,0,e.width,e.height),F(e,{line:`#1f232b`,axis:`#3a404c`,text:`#5a606c`},`11px ui-monospace, Consolas, monospace`)},area(e,t,n,r){let{context:i}=e;if(i.globalAlpha=t.alpha/255*.35,i.fillStyle=A(t.colour),i.beginPath(),t.shape===`radius`)i.arc(n,r,(t.radius??0)*e.scale,0,Math.PI*2);else{let a=(t.width??0)*e.scale,o=(t.height??0)*e.scale;i.rect(n-a/2,r-o/2,a,o)}i.fill(),i.globalAlpha=1},route(e,t,n,r){let{context:i}=e;i.strokeStyle=r,i.lineWidth=2,i.setLineDash([6,5]),i.beginPath(),i.moveTo(...t),i.lineTo(...n),i.stroke(),i.setLineDash([]),i.lineWidth=1},blip(e,t,n,r){let{context:i}=e;e.claim(n-6,r-6,12,12,!0),i.globalAlpha=Math.max(t.alpha/255,.25),t.sprite===8?(i.fillStyle=`#d070f0`,i.beginPath(),i.moveTo(n,r-9),i.lineTo(n+7,r),i.lineTo(n,r+9),i.lineTo(n-7,r),i.closePath(),i.fill()):t.shape!==`radius`&&t.shape!==`area`&&(i.fillStyle=A(t.colour),i.strokeStyle=`#0b0c10`,i.beginPath(),i.arc(n,r,5,0,Math.PI*2),i.fill(),i.stroke()),i.globalAlpha=1},label(e,t,n,r,i){L(e,t,[[n+8,r+4,`left`],[n-8,r+4,`right`]],`#c8ccd4`,`#0b0c10`,`12px system-ui, sans-serif`,i)},tag(e,t,n,r,i){L(e,t,[[r,i+22,`center`],[r,i-14,`center`]],n,`#0b0c10`,`12px system-ui, sans-serif`,!0)},entity(e,t,n,r,i,a){let{context:o}=e;if(t.kind===`player`){let i=a?.colour??`#d7dae0`;e.claim(n-8,r-10,16,18,!0),o.save(),o.translate(n,r),o.rotate(R(t)),o.fillStyle=i,o.strokeStyle=`#0b0c10`,o.beginPath(),o.moveTo(0,-10),o.lineTo(7,7),o.lineTo(0,3),o.lineTo(-7,7),o.closePath(),o.fill(),o.stroke(),o.restore()}else t.kind===`vehicle`?(o.save(),o.translate(n,r),o.rotate(R(t)),o.fillStyle=`#8a909c`,o.fillRect(-4,-7,8,14),o.restore()):(o.fillStyle=t.kind===`ped`?`#a8adb8`:`#5a606c`,o.beginPath(),o.arc(n,r,t.kind===`ped`?3.5:2.5,0,Math.PI*2),o.fill());return[n,r]}},H={grass:`#8fcf68`,light:[166,220,127],dark:[124,192,88],tuft:`#6eb24c`,ink:`#2b2d3a`,text:`#2d3142`},ue=[`#ef5b5b`,`#3f8efc`,`#ffc145`,`#34c38f`,`#a66cff`,`#ff8a3d`,`#f2f4f8`],U=[`#8d99ae`,`#e9c46a`,`#2a9d8f`,`#e76f51`,`#9b5de5`,`#577590`],W=[`#f8d5b5`,`#eab78e`,`#c98d62`,`#9c6644`,`#6f4630`],G=[`#3b2a20`,`#6b4423`,`#d8a93f`,`#a0522d`,`#23232b`,`#c8553d`],K=[`#3d4a6b`,`#e9c46a`,`#2a9d8f`,`#e76f51`,`#9b5de5`,`#577590`,`#f4f1de`,`#ef476f`,`#118ab2`,`#06d6a0`,`#ffd166`,`#264653`,`#8d99ae`,`#f78c6b`,`#2b2d42`,`#b5838d`],de=[`#f8d5b5`,`#f1c6a0`,`#eab78e`,`#d9a077`,`#c98d62`,`#b07650`,`#9c6644`,`#845437`,`#6f4630`];function fe(e){if(e===void 0)return;let t=([e,t],n)=>K[Math.abs(e*5+t*3+n)%K.length],n=e=>M(de[Math.abs(e)%de.length]),[r,i,a]=e.skin,[o,s]=[n(r),n(i)],c=o.map((e,t)=>Math.round(e+(s[t]-e)*a)),l=v[e.hair]??v[0];return{skin:`rgb(${c.join(` `)})`,hair:`#${l.toString(16).padStart(6,`0`)}`,top:t(e.top,1),legs:t(e.legs,0),shoes:t(e.shoes,14),long:e.hairStyle%2==1}}function q(e,t,n,r=1.6){e.lineWidth=r*2,e.strokeStyle=H.ink,e.stroke(t),e.fillStyle=n,e.fill(t)}function J(e,t,n,r,i,a=.22){e.fillStyle=`rgba(32, 70, 26, ${a})`,e.beginPath(),e.ellipse(t,n,r,i,0,0,Math.PI*2),e.fill()}function pe(e,t,n,r,i){J(e,t+4*i,n+1,12*i,4.5*i);let a=new Path2D;a.roundRect(t-2.2*i,n-9*i,4.4*i,10*i,1.6*i),q(e,a,`#9a6a45`,1.1);let o=new Path2D;if(r){for(let[e,r,a]of[[-30,7,-18],[-24,9.5,-12],[-18,11.5,-6]])o.moveTo(t,n+e*i),o.lineTo(t+r*i,n+a*i),o.lineTo(t-r*i,n+a*i),o.closePath();q(e,o,`#3f9a54`,1.1),e.fillStyle=`rgba(255, 255, 255, 0.18)`,e.beginPath(),e.moveTo(t,n-29*i),e.lineTo(t-5*i,n-20*i),e.lineTo(t-1*i,n-20*i),e.closePath(),e.fill()}else{for(let[e,r,a]of[[-6,-14,7],[6,-14,7],[0,-20,8.5]])o.moveTo(t+(e+a)*i,n+r*i),o.arc(t+e*i,n+r*i,a*i,0,Math.PI*2);q(e,o,`#4caf50`,1.1),e.fillStyle=`#7bd06b`,e.beginPath(),e.arc(t-3*i,n-22*i,3.6*i,0,Math.PI*2),e.arc(t-7.5*i,n-15.5*i,2.4*i,0,Math.PI*2),e.fill()}}function me(e,t,n,r){if(r<.12){J(e,t+2,n+1,9,3);let r=new Path2D;for(let[e,i,a]of[[-5,-4,4.6],[4.5,-4,4.6],[0,-7,5.4]])r.moveTo(t+e+a,n+i),r.arc(t+e,n+i,a,0,Math.PI*2);q(e,r,`#5cb85c`,1),e.fillStyle=`#86d176`,e.beginPath(),e.arc(t-1.5,n-8.5,2,0,Math.PI*2),e.fill()}else if(r<.19){let[i,a]=[[`#ffffff`,`#ffd23f`],[`#ff8fb1`,`#fff3b0`],[`#ffd23f`,`#f08a3c`]][Math.floor(r*1e3)%3];for(let[r,o]of[[0,0],[6,3],[-5,4]]){e.fillStyle=i,e.beginPath();for(let i=0;i<5;i++){let a=i*Math.PI*2/5;e.moveTo(t+r+Math.cos(a)*1.8+1.5,n+o+Math.sin(a)*1.8),e.arc(t+r+Math.cos(a)*1.8,n+o+Math.sin(a)*1.8,1.5,0,Math.PI*2)}e.fill(),e.fillStyle=a,e.beginPath(),e.arc(t+r,n+o,1.2,0,Math.PI*2),e.fill()}}else if(r<.215){J(e,t+2,n+1.5,7,2.5);let r=new Path2D;r.ellipse(t,n-2,6,4,0,0,Math.PI*2),q(e,r,`#c3ccd6`,1),e.fillStyle=`#e6ebf0`,e.beginPath(),e.ellipse(t-2,n-3.6,2.4,1.3,-.3,0,Math.PI*2),e.fill()}else{e.strokeStyle=H.tuft,e.lineWidth=1.8,e.lineCap=`round`,e.beginPath();for(let r of[-3,0,3])e.moveTo(t+r,n),e.quadraticCurveTo(t+r*1.1,n-3,t+r*1.7,n-6+Math.abs(r)*.4);e.stroke(),e.lineCap=`butt`}}function he(e,t){let{context:n,width:r,height:i}=e;n.fillStyle=H.grass,n.fillRect(0,0,r,i);let a=B(e,380),o=Math.ceil(r/16)+1,s=Math.ceil(i/16)+1,c=document.createElement(`canvas`);c.width=o,c.height=s;let l=c.getContext(`2d`),u=l.createImageData(o,s),[d,f]=e.toWorld(0,0);for(let t=0;t<s;t++)for(let n=0;n<o;n++){let r=se((d+n*16/e.scale)/a,(f-t*16/e.scale)/a),i=Math.min(Math.max((r-.55)/.09,0),1),s=Math.min(Math.max((.45-r)/.09,0),1),[c,l,p]=i>0?H.light:H.dark,m=i>0?i:s,h=(t*o+n)*4;u.data[h]=c,u.data[h+1]=l,u.data[h+2]=p,u.data[h+3]=Math.round(m*255)}l.putImageData(u,0,0),n.imageSmoothingQuality=`high`,n.drawImage(c,-8,-8,o*16,s*16);let p=new Set;for(let a of t){if(a.shape===`radius`||a.shape===`area`)continue;let[t,o]=e.toScreen(a.x,a.y);if(!(t<-30||o<-30||t>r+30||o>i+30)){for(let e=-1;e<=1;e++)for(let n=-1;n<=1;n++)p.add(`${Math.floor(t/30)+e} ${Math.floor(o/30)+n}`);e.scale>=.1&&a.sprite!==8&&(n.fillStyle=`rgba(244, 228, 178, 0.85)`,n.beginPath(),n.ellipse(t,o+6,19,8.5,0,0,Math.PI*2),n.fill(),n.fillStyle=`rgba(255, 246, 214, 0.7)`,n.beginPath(),n.ellipse(t,o+5,12,5,0,0,Math.PI*2),n.fill())}}let m=B(e,58),h=Math.log2(m),[g,_]=e.toWorld(-40,-40),[v,y]=e.toWorld(r+40,i+60),b=[];for(let t=Math.floor(g/m);t<=v/m;t++)for(let n=Math.floor(y/m);n<=_/m;n++){let r=z(t+h*7.3,n-h*3.1);if(r>.55)continue;let[i,a]=e.toScreen((t+.15+z(n,t+h)*.7)*m,(n+.15+z(t+3.7,n-h)*.7)*m);r<.215&&p.has(`${Math.floor(i/30)} ${Math.floor(a/30)}`)||b.push([i,a,r])}b.sort((e,t)=>e[1]-t[1]);for(let[e,t,r]of b)r<.07?pe(n,e,t,r<.025,.85+r*97%1*.35):me(n,e,t,r);F(e,{line:`rgba(255, 255, 255, 0.22)`,axis:`rgba(255, 255, 255, 0.6)`,text:`#3f6e2c`},`800 10px ${k}`,[2,6])}function ge(e){let{context:t,width:n,height:r,time:i}=e;t.fillStyle=`rgba(28, 60, 36, 0.05)`;for(let e=0;e<4;e++){let a=n+600,o=(e*.31*a+i*.012)%a-300,s=(e*.37+.12)%1*r+Math.sin(i/9e3+e)*24;t.beginPath();for(let[e,n,r,i]of[[0,0,120,52],[90,-20,90,44],[-80,14,80,38]])t.moveTo(o+e+r,s+n),t.ellipse(o+e,s+n,r,i,0,0,Math.PI*2);t.fill()}}function _e(e){return e.scale>=.1?12.5:e.scale>=.04?10.5:8.5}function ve(e){let t=P(e);return t>.8?`#5f6b7d`:t>.42?N(e,-.32):e}function ye(e,t,n,r,i,a){let{context:o}=e;o.font=`800 12px ${k}`;let s=Math.ceil(o.measureText(t).width)+16,c=r.map(([e,t])=>t?e:e-20),l=I(e,s,26,r.map(([,,e=0],t)=>[n+e-s/2,c[t]-3]),a);if(l===void 0)return;let u=c[l],[,d,f=0]=r[l],p=n+f,m=new Path2D;m.roundRect(p-s/2,u,s,20,10);let h=d?u:u+20;m.moveTo(p-5,h),m.lineTo(p,h+(d?-5:5)),m.lineTo(p+5,h),o.fillStyle=`rgba(30, 50, 30, 0.18)`,o.save(),o.translate(0,2.5),o.fill(m),o.restore(),o.fillStyle=i,o.fill(m),o.fillStyle=H.text,o.textAlign=`center`,o.fillText(t,p,u+14.5),o.textAlign=`left`}function be(e){return[`back`,`right`,`front`,`left`][Math.round((e%(Math.PI*2)+Math.PI*2)/(Math.PI/2))%4]}function xe(e,t,n,r,i,a,o=!1,s){let c=be(r),l=s?.skin??W[a%W.length],u=s?.hair??G[Math.floor(a/5)%G.length],d=s?.long??Math.floor(a/3)%2==0,f=t/105+a,p=n?Math.sin(f):0,m=n?-Math.abs(Math.sin(f))*2:Math.sin(t/420+a)*.5;o||J(e,0,.5,10-(n?Math.abs(p):0),3.6,.26),e.save(),e.translate(0,m);let h=c===`left`||c===`right`,g=c===`left`?-1:1,_=new Path2D,v=new Path2D;for(let[e,t]of[[-3,Math.max(0,p)],[3,Math.max(0,-p)]]){let n=h?p*(e<0?3:-3)*g:0,r=o?1.5:-t*2.6;_.roundRect((h?e*.35:e)-2.1+n,-8.5+r,4.2,8.5,2),v.roundRect((h?e*.35+g:e)-2.6+n,-2.8+r,5.2,3.2,1.5)}q(e,_,s?.legs??`#3d4a6b`,1.4),q(e,v,s?.shoes??`#2b2d42`,1.2);let y=new Path2D;for(let[e,t]of[[-8.2,-p],[8.2,p]]){if(h&&e*g<0)continue;let n=h?t*2.2*g:0;y.roundRect((h?1.5*g:e)-2+n,-18-(o?3:0)+t*1.2,4,8.5,2)}let b=new Path2D;b.roundRect(-7,-20,14,12.5,5),q(e,b,i,1.4),e.save(),e.clip(b),e.fillStyle=`rgba(0, 0, 0, 0.13)`,e.fillRect(h?-7*g:2,-20,h?6*g:5,13),e.restore(),q(e,y,N(i,-.08),1.4);let x=new Path2D;if(x.arc(0,-27.5,9,0,Math.PI*2),q(e,x,l,1.4),e.save(),e.clip(x),e.fillStyle=u,e.beginPath(),c===`back`?e.rect(-10,-40,20,16):h?(e.ellipse(-3*g,-32,9.5,6.5,0,0,Math.PI*2),e.rect(-10*g,-36,7*g,12)):e.ellipse(0,-33.5,11,6.5,0,0,Math.PI*2),e.fill(),e.restore(),d&&c!==`front`&&(e.fillStyle=u,e.strokeStyle=H.ink,e.lineWidth=1.4,e.beginPath(),e.roundRect(h?-9*g-2.5:-7,-28,5,10,2.5),h||e.roundRect(2,-28,5,10,2.5),e.fill(),e.stroke()),c!==`back`){let n=(t+a*977)%3800<130,r=h?[3.6*g]:[-3.2,3.2];e.fillStyle=H.ink,e.strokeStyle=H.ink,e.lineWidth=1.3;for(let t of r)e.beginPath(),n?(e.moveTo(t-1.4,-26.5),e.lineTo(t+1.4,-26.5),e.stroke()):(e.ellipse(t,-26.6,1.25,1.6,0,0,Math.PI*2),e.fill());e.fillStyle=`rgba(255, 120, 120, 0.35)`;for(let t of h?[2*g]:[-5.2,5.2])e.beginPath(),e.ellipse(t,-23.4,1.9,1.2,0,0,Math.PI*2),e.fill();h||(e.beginPath(),e.arc(0,-24,1.8,.15*Math.PI,.85*Math.PI),e.stroke())}e.restore()}function Se(e,t,n,r){let i=new Path2D;for(let[e,t]of[[-9,-11],[5.4,-11],[-9,5.5],[5.4,5.5]])i.roundRect(e,t,3.6,6.5,1.6);e.fillStyle=`#23232b`,e.fill(i);let a=new Path2D;a.roundRect(-8,-15.5,16,31,6.5),q(e,a,t,1.3),e.save(),e.clip(a),e.fillStyle=`rgba(255, 255, 255, 0.22)`,e.fillRect(-8,-15.5,4,31),e.fillStyle=`rgba(0, 0, 0, 0.12)`,e.fillRect(4.5,-15.5,4,31),e.restore();let o=e.createLinearGradient(0,-9,0,-3);o.addColorStop(0,`#d9f4ff`),o.addColorStop(1,`#7cc6ee`),e.fillStyle=o,e.strokeStyle=H.ink,e.lineWidth=1,e.beginPath(),e.roundRect(-6,-9.5,12,6,2),e.fill(),e.stroke(),e.fillStyle=N(t,.18),e.beginPath(),e.roundRect(-6,-2.5,12,9,2.5),e.fill(),e.stroke(),e.fillStyle=`#7cc6ee`,e.beginPath(),e.roundRect(-5.5,7.5,11,4,1.5),e.fill(),e.stroke(),e.strokeStyle=`rgba(255, 255, 255, 0.85)`,e.lineWidth=1.2,e.beginPath(),e.moveTo(-3.5,-8.5),e.lineTo(-1,-4.5),e.stroke();for(let[t,n,r]of[[-6,-15.4,`#ffe066`],[3.6,-15.4,`#ffe066`],[-6,13.6,`#ff6b6b`],[3.6,13.6,`#ff6b6b`]])e.fillStyle=r,e.beginPath(),e.roundRect(t,n,2.4,1.8,.8),e.fill();if(n)for(let t=0;t<3;t++){let n=(r/420+t/3)%1;e.fillStyle=`rgba(255, 255, 255, ${.55*(1-n)})`,e.beginPath(),e.arc(-3+Math.sin(t*2.1)*2,18+n*12,2+n*3,0,Math.PI*2),e.fill()}}function Ce(){let e=ce();return{name:`Cartoon`,animated:!0,background(t,n){e(t,e=>he(e,n),le(n)),ge(t)},area(e,t,n,r){let{context:i}=e,a=A(t.colour),o=new Path2D;if(t.shape===`radius`)o.arc(n,r,(t.radius??0)*e.scale,0,Math.PI*2);else{let i=(t.width??0)*e.scale,a=(t.height??0)*e.scale;o.roundRect(n-i/2,r-a/2,i,a,Math.min(16,i/4,a/4))}i.globalAlpha=t.alpha/255*.22,i.fillStyle=a,i.fill(o),i.globalAlpha=Math.max(t.alpha/255,.4),i.strokeStyle=N(a,-.15),i.lineWidth=2.5,i.setLineDash([8,6]),i.lineDashOffset=-e.time/45,i.stroke(o),i.setLineDash([]),i.lineDashOffset=0,i.globalAlpha=1,i.lineWidth=1},route(e,t,n,r){let{context:i,time:a}=e;i.strokeStyle=r,i.globalAlpha=.18,i.lineWidth=9,i.lineCap=`round`,i.beginPath(),i.moveTo(...t),i.lineTo(...n),i.stroke(),i.globalAlpha=1,i.lineCap=`butt`;let o=Math.hypot(n[0]-t[0],n[1]-t[1]),s=a/36%14;i.lineWidth=1.6,i.strokeStyle=N(r,-.25),i.fillStyle=`#ffffff`;for(let e=s;e<o-6;e+=14){let r=e/o;i.beginPath(),i.arc(t[0]+(n[0]-t[0])*r,t[1]+(n[1]-t[1])*r,3,0,Math.PI*2),i.fill(),i.stroke()}i.lineWidth=1},blip(e,t,n,r,i){let{context:a,time:o}=e,s=A(t.colour);if(a.globalAlpha=Math.max(t.alpha/255,.35),t.sprite===8){e.claim(n-3,r-30,22,32,!0);let t=o/1600%1;a.strokeStyle=`rgba(239, 71, 111, ${.7*(1-t)})`,a.lineWidth=2,a.beginPath(),a.ellipse(n,r,6+t*14,(6+t*14)*.4,0,0,Math.PI*2),a.stroke(),J(a,n+2,r,6,2.4);let i=new Path2D;i.roundRect(n-1.3,r-28,2.6,28,1.3),q(a,i,`#e8e2d4`,1);let s=new Path2D,c=e=>Math.sin(o/160-e/4)*1.6*(e/16);s.moveTo(n+1,r-27);for(let e=0;e<=16;e+=2)s.lineTo(n+1+e,r-27+c(e)+e*.06);for(let e=16;e>=0;e-=2)s.lineTo(n+1+e,r-17+c(e)-e*.06);s.closePath(),q(a,s,`#ef476f`,1)}else if(t.shape!==`radius`&&t.shape!==`area`){let c=_e(e);e.claim(n-c,r-c*1.35-1,c*2,c*2.1+2,!0);let l=i?5:0,u=Math.sin(o/700+t.handle*1.7)*1.1-l;J(a,n,r+c*.75,c*.85-l*.3,c*.32),a.save(),a.translate(n,r+u-c*.35),i&&a.scale(1.12,1.12),a.fillStyle=N(P(s)>.8?`#9aa5b4`:s,-.35),a.beginPath(),a.arc(0,2.6,c,0,Math.PI*2),a.fill(),a.fillStyle=`#ffffff`,a.beginPath(),a.arc(0,0,c,0,Math.PI*2),a.fill(),a.strokeStyle=P(s)>.8?`#9aa5b4`:s,a.lineWidth=c>10?3:2.4,a.beginPath(),a.arc(0,0,c-1.5,0,Math.PI*2),a.stroke();let d=b(t.sprite);a.fillStyle=ve(s),d===void 0?(a.font=`900 ${Math.round(c)}px ${k}`,a.textAlign=`center`,a.fillText((t.name??`•`).slice(0,1).toUpperCase(),0,c*.36),a.textAlign=`left`):E(a,d,c*1.18),a.restore()}a.globalAlpha=1,a.lineWidth=1},label(e,t,n,r,i){let a=_e(e);ye(e,t,n,[[r+a*.75+9,!0],[r-a*1.45-7,!1]],`#ffffff`,i)},tag(e,t,n,r,i){ye(e,t,r,[[i-47,!1],[i+10,!0],[i-47,!1,48],[i-47,!1,-48]],n,!0)},entity(e,t,n,r,i,a){let{context:o,time:s}=e;if(t.kind===`player`||t.kind===`ped`){let c=a?.colour??U[t.id%U.length],l=t.kind===`ped`?.86:1.08;if(e.claim(n-10*l,r-37*l,20*l,38*l,!0),a!==void 0){let e=s/2200%1;o.strokeStyle=c,o.lineWidth=2.5,o.beginPath(),o.ellipse(n,r,14,5.5,0,0,Math.PI*2),o.stroke(),o.globalAlpha=1-e,o.lineWidth=1.5,o.beginPath(),o.ellipse(n,r,14+e*12,5.5+e*4.5,0,0,Math.PI*2),o.stroke(),o.globalAlpha=1}o.save(),o.translate(n,r),o.scale(l,l);let u=fe(t.look);return xe(o,s,i,R(t),u?.top??c,(a?.client??t.id)*7,!1,u),o.restore(),[n,r-14*l]}if(t.kind===`vehicle`){let a=Math.min(Math.max(e.scale/6,.8),1.4),c=R(t),l=i?Math.sin(s/55)*.5:0;return o.save(),o.translate(n+3*a,r+4*a),o.rotate(c),o.scale(a,a),o.fillStyle=`rgba(32, 70, 26, 0.24)`,o.beginPath(),o.roundRect(-9,-15,18,31,7),o.fill(),o.restore(),o.save(),o.translate(n,r+l),o.rotate(c),o.scale(a,a),Se(o,ue[t.id%ue.length],i,s),o.restore(),o.lineWidth=1,[n,r]}J(o,n+2,r+5,8,3);let c=new Path2D;return c.roundRect(n-6,r-6,12,12,2),q(o,c,`#c8915a`,1.2),o.strokeStyle=`#8a5a30`,o.lineWidth=1.2,o.beginPath(),o.moveTo(n-4.5,r-4.5),o.lineTo(n+4.5,r+4.5),o.moveTo(n+4.5,r-4.5),o.lineTo(n-4.5,r+4.5),o.stroke(),o.lineWidth=1,[n,r]},dragging(e,t,n,r){let{context:i,time:a}=e;i.fillStyle=`#ffffff`;let o=Math.hypot(n[0]-t[0],n[1]-t[1]);for(let e=8;e<o-24;e+=12){let r=e/o;i.beginPath(),i.arc(t[0]+(n[0]-t[0])*r,t[1]+(n[1]-t[1])*r,2.2,0,Math.PI*2),i.fill()}J(i,n[0],n[1]+26,9,3.2,.3),i.save(),i.translate(n[0],n[1]+16+Math.sin(a/160)*1.5),i.rotate(Math.sin(a/240)*.08);let s=fe(r.look);xe(i,a,!1,Math.PI,s?.top??r.colour,r.client*7,!0,s),i.restore()},overlay(e){let{context:t,height:n,time:r}=e,i=n-34;t.fillStyle=`rgba(30, 50, 30, 0.2)`,t.beginPath(),t.arc(34,i+3,21,0,Math.PI*2),t.fill();let a=new Path2D;a.arc(34,i,21,0,Math.PI*2),q(t,a,`#ffffff`,1.2),t.save(),t.translate(34,i),t.rotate(Math.sin(r/900)*.07),t.fillStyle=`#ef476f`,t.beginPath(),t.moveTo(0,-15),t.lineTo(4.5,0),t.lineTo(-4.5,0),t.closePath(),t.fill(),t.fillStyle=`#b8c2cf`,t.beginPath(),t.moveTo(0,15),t.lineTo(4.5,0),t.lineTo(-4.5,0),t.closePath(),t.fill(),t.restore(),t.fillStyle=H.ink,t.beginPath(),t.arc(34,i,2,0,Math.PI*2),t.fill(),t.font=`900 9px ${k}`,t.textAlign=`center`,t.fillText(`N`,34,i-23-3);let o=[5,10,25,50,100,250,500,1e3,2500,5e3].find(t=>t*e.scale>=56)??5e3,s=o*e.scale,c=o>=1e3?`${o/1e3} km`:`${o} m`;t.font=`800 11px ${k}`;let l=Math.max(s,t.measureText(c).width)+20;t.fillStyle=`rgba(30, 50, 30, 0.2)`,t.beginPath(),t.roundRect(66,i-12+2.5,l,26,13),t.fill(),t.fillStyle=`#ffffff`,t.beginPath(),t.roundRect(66,i-12,l,26,13),t.fill(),t.fillStyle=H.text,t.fillText(c,66+l/2,i+1),t.fillStyle=H.ink,t.fillRect(66+(l-s)/2,i+6,s/2,3),t.fillStyle=`#b8c2cf`,t.fillRect(66+l/2,i+6,s/2,3),t.textAlign=`left`}}}var we=[[],[[3,2]],[[2,1]],[[3,1]],[[0,1]],[[0,3],[1,2]],[[0,2]],[[0,3]],[[0,3]],[[0,2]],[[0,1],[3,2]],[[0,1]],[[3,1]],[[1,2]],[[3,2]],[]];function Te(e){let{context:t,width:n,height:r}=e,i=B(e,520),a=Math.ceil(n/9)+1,o=Math.ceil(r/9)+1,[s,c]=e.toWorld(0,0),l=9/e.scale,u=new Float32Array(a*o);for(let e=0;e<o;e++)for(let t=0;t<a;t++)u[e*a+t]=se((s+t*l)/i,(c-e*l)/i);let d=.3,f=.04,p=Array.from({length:12},()=>new Path2D);for(let e=0;e<o-1;e++)for(let t=0;t<a-1;t++){let n=u[e*a+t],r=u[e*a+t+1],i=u[(e+1)*a+t+1],o=u[(e+1)*a+t],s=Math.max(n,r,i,o);for(let a=Math.max(Math.ceil((Math.min(n,r,i,o)-d)/f),0);a<p.length&&d+a*f<=s;a++){let s=d+a*f,c=a=>a===0?[(t+(s-n)/(r-n))*9,e*9]:a===1?[(t+1)*9,(e+(s-r)/(i-r))*9]:a===2?[(t+(s-o)/(i-o))*9,(e+1)*9]:[t*9,(e+(s-n)/(o-n))*9],l=(n>s?8:0)|(r>s?4:0)|(i>s?2:0)|o>s;for(let[e,t]of we[l])p[a].moveTo(...c(e)),p[a].lineTo(...c(t))}}t.lineWidth=1,p.forEach((e,n)=>{t.strokeStyle=n%4==3?`rgba(150, 200, 235, 0.13)`:`rgba(150, 200, 235, 0.055)`,t.stroke(e)})}function Ee(e){let t=`#c65ad8`,n=`#05080b`,r=(e,t=600)=>`semi-condensed ${t} ${e}px ${ne}`,i=e=>e>=760,a=ce(1),o=e=>{e.fillStyle=`rgba(0, 0, 0, 0.4)`,e.beginPath(),e.ellipse(0,0,4.5,1.8,0,0,Math.PI*2),e.fill();let r=new Path2D;r.moveTo(0,0),r.bezierCurveTo(-1.8,-5,-7,-8,-7,-13.5),r.arc(0,-13.5,7,Math.PI,0),r.bezierCurveTo(7,-8,1.8,-5,0,0),r.closePath(),e.lineWidth=3,e.lineJoin=`round`,e.strokeStyle=n,e.stroke(r),e.fillStyle=t,e.fill(r),e.fillStyle=`#ffffff`,e.beginPath(),e.arc(0,-13.5,2.6,0,Math.PI*2),e.fill()},s=(e,t)=>{let r=new Path2D;r.moveTo(0,-12),r.lineTo(8.5,9),r.lineTo(0,4.5),r.lineTo(-8.5,9),r.closePath(),e.lineJoin=`round`,e.lineWidth=3.5,e.strokeStyle=n,e.stroke(r),e.fillStyle=t,e.fill(r),e.fillStyle=`rgba(255, 255, 255, 0.35)`,e.beginPath(),e.moveTo(0,-12),e.lineTo(0,4.5),e.lineTo(-8.5,9),e.closePath(),e.fill()},c=(e,t,n,i)=>{e.strokeStyle=`#ffffff`,e.fillStyle=`#ffffff`,e.lineWidth=1.4,e.beginPath(),e.roundRect(t,n,11,16,5.5),e.stroke(),e.beginPath(),e.moveTo(t,n+6.5),e.lineTo(t+11,n+6.5),e.moveTo(t+5.5,n),e.lineTo(t+5.5,n+6.5),e.stroke(),e.beginPath(),i===`wheel`?e.roundRect(t+4.2,n+1.8,2.6,4,1.3):(e.moveTo(t+5.5,n+.7),e.lineTo(t+5.5,n+6.5),e.lineTo(t+.7,n+6.5),e.arc(t+5.5,n+5.5,4.8,Math.PI,Math.PI*1.5)),e.fill(),i===`twice`&&(e.font=r(9,700),e.fillText(`2`,t+13,n+6))};return{name:`GTA`,animated:!0,instructions:!0,insets:e=>({top:48,right:i(e)?260:0,bottom:42,left:0}),background(t){let{context:n,width:i,height:o}=t,s=n.createRadialGradient(i*.45,o*.55,0,i*.45,o*.55,Math.hypot(i,o)*.62);s.addColorStop(0,`#1d3448`),s.addColorStop(1,`#0c1824`),n.fillStyle=s,n.fillRect(0,0,i,o);let c=e();if(c!==void 0){let[e,r]=t.toScreen(c.left,c.top),[i,a]=t.toScreen(c.right,c.bottom);n.drawImage(c.image,e,r,i-e,a-r)}else a(t,Te);F(t,{line:`rgba(140, 180, 215, 0.09)`,axis:`rgba(140, 180, 215, 0.26)`,text:`rgba(180, 205, 228, 0.5)`},r(10),[],48);let l=n.createRadialGradient(i/2,o/2,Math.min(i,o)*.4,i/2,o/2,Math.hypot(i,o)*.6);l.addColorStop(0,`rgba(0, 0, 0, 0)`),l.addColorStop(1,`rgba(0, 0, 0, 0.45)`),n.fillStyle=l,n.fillRect(0,0,i,o)},area(e,t,n,r){let{context:i}=e,a=A(t.colour),o=new Path2D;if(t.shape===`radius`)o.arc(n,r,(t.radius??0)*e.scale,0,Math.PI*2);else{let i=(t.width??0)*e.scale,a=(t.height??0)*e.scale;o.rect(n-i/2,r-a/2,i,a)}i.globalAlpha=t.alpha/255*.3,i.fillStyle=a,i.fill(o),i.globalAlpha=Math.max(t.alpha/255,.3)*.7,i.strokeStyle=a,i.lineWidth=1.5,i.stroke(o),i.globalAlpha=1,i.lineWidth=1},route(e,n,r){let{context:i,time:a}=e;i.lineCap=`round`;for(let[e,a]of[[`#16081c`,8],[t,4.5]])i.strokeStyle=e,i.lineWidth=a,i.beginPath(),i.moveTo(...n),i.lineTo(...r),i.stroke();let o=Math.hypot(r[0]-n[0],r[1]-n[1]),s=Math.atan2(r[1]-n[1],r[0]-n[0]);i.strokeStyle=`rgba(255, 255, 255, 0.8)`,i.lineWidth=1.6;for(let e=a/24%26;e<o-14;e+=26){let t=e/o;i.save(),i.translate(n[0]+(r[0]-n[0])*t,n[1]+(r[1]-n[1])*t),i.rotate(s),i.beginPath(),i.moveTo(-1.8,-2.6),i.lineTo(1.4,0),i.lineTo(-1.8,2.6),i.stroke(),i.restore()}i.lineCap=`butt`,i.lineWidth=1},blip(e,t,r,i,a){let{context:s,time:c}=e;if(t.sprite===8?e.claim(r-8,i-22,16,24,!0):t.shape!==`radius`&&t.shape!==`area`&&e.claim(r-9,i-9,18,18,!0),s.globalAlpha=Math.max(t.alpha/255,.3),s.strokeStyle=n,s.save(),s.translate(r,i),t.sprite===8)o(s);else if(t.shape!==`radius`&&t.shape!==`area`){let e=b(t.sprite);s.fillStyle=A(t.colour),e===void 0?(s.lineWidth=3,s.beginPath(),s.arc(0,0,5.5,0,Math.PI*2),s.stroke(),s.fill()):E(s,e,17,1.6)}if(s.restore(),s.globalAlpha=1,a){let e=15+Math.sin(c/160);s.strokeStyle=`#ffffff`,s.lineWidth=2;for(let t=0;t<4;t++){let n=t*Math.PI/2+Math.PI/4;s.beginPath(),s.arc(r,i,e,n-.42,n+.42),s.stroke()}s.lineWidth=1}},label(e,t,i,a,o){L(e,t.toUpperCase(),[[i+12,a+4,`left`],[i-12,a+4,`right`],[i,a+22,`center`],[i,a-14,`center`]],`#ffffff`,n,r(11,700),o)},tag(e,t,n,i,a){let{context:o}=e;o.font=r(11,700);let s=t.toUpperCase(),c=Math.ceil(o.measureText(s).width)+15,l=[[i-c/2,a+16],[i-c/2,a-33],[i+15,a-8.5],[i-15-c,a-8.5]],u=l[I(e,c,17,l,!0)];o.fillStyle=`rgba(0, 0, 0, 0.8)`,o.fillRect(u[0],u[1],c,17),o.fillStyle=n,o.fillRect(u[0],u[1],3,17),o.fillStyle=`#ffffff`,o.fillText(s,u[0]+9,u[1]+12.5)},entity(e,t,r,i,a,o){let{context:c,time:l}=e;if(t.kind===`player`){let n=o?.colour??`#ffffff`;e.claim(r-10,i-12,20,22,!0),c.save(),c.translate(r,i),c.rotate(R(t));let a=c.createRadialGradient(0,0,0,0,0,44);a.addColorStop(0,`rgba(255, 255, 255, 0.32)`),a.addColorStop(1,`rgba(255, 255, 255, 0)`),c.fillStyle=a,c.globalAlpha=.8+Math.sin(l/500)*.2,c.beginPath(),c.moveTo(0,0),c.arc(0,0,44,-Math.PI/2-.55,-Math.PI/2+.55),c.closePath(),c.fill(),c.globalAlpha=1,s(c,n),c.restore(),c.lineWidth=1}else if(t.kind===`vehicle`){c.save(),c.translate(r,i),c.rotate(R(t));let e=new Path2D;e.roundRect(-5,-9,10,18,3),c.lineWidth=3,c.strokeStyle=n,c.stroke(e),c.fillStyle=`#dbe3ea`,c.fill(e),c.fillStyle=`#2b3743`,c.beginPath(),c.roundRect(-3.6,-5,7.2,3.4,1),c.roundRect(-3.6,3.6,7.2,2.4,1),c.fill(),c.restore(),c.lineWidth=1}else c.lineWidth=2.5,c.strokeStyle=n,c.fillStyle=t.kind===`ped`?`#c9d1d9`:`#8b98a5`,c.beginPath(),t.kind===`ped`?c.arc(r,i,3.8,0,Math.PI*2):c.rect(r-3.5,i-3.5,7,7),c.stroke(),c.fill(),c.lineWidth=1;return[r,i]},dragging(e,t,n,r){let{context:i}=e;i.strokeStyle=`rgba(255, 255, 255, 0.7)`,i.lineWidth=1.5,i.setLineDash([5,5]),i.beginPath(),i.moveTo(...t),i.lineTo(...n),i.stroke(),i.setLineDash([]),i.save(),i.translate(...n),i.globalAlpha=.7,s(i,r.colour),i.restore(),i.globalAlpha=1,i.lineWidth=1},overlay(e,t,a,o){let{context:s,width:l,height:u}=e,d=s.createLinearGradient(0,0,0,48);d.addColorStop(0,`rgba(3, 6, 9, 0.94)`),d.addColorStop(1,`rgba(3, 6, 9, 0.78)`),s.fillStyle=d,s.fillRect(0,0,l,48),s.fillStyle=`rgba(255, 255, 255, 0.12)`,s.fillRect(0,47,l,1),s.fillStyle=`#ffffff`,s.font=`italic ${r(25,700)}`,s.fillText(`FIVERUNNER`,18,33);let f=s.measureText(`FIVERUNNER`).width,p=a.find(({client:e})=>e===o)?.colour??`#f0a030`;s.font=r(13,700);let m=s.measureText(`MAP`).width+28,h=18+f+18;s.fillStyle=`#ffffff`,s.fillRect(h,12,m,26),s.fillStyle=p,s.fillRect(h,12,m,3),s.fillStyle=`#05080b`,s.fillText(`MAP`,h+14,30.5),s.textAlign=`right`;let g=l-18;s.fillStyle=`rgba(220, 230, 240, 0.7)`,s.font=r(12,600);let _=`${t.length} ${t.length===1?`BLIP`:`BLIPS`}`;s.fillText(_,g,29),g-=s.measureText(_).width+22;for(let e of[...a].reverse()){if(e.name===void 0)continue;let t=e.name.toUpperCase();s.font=r(13,700),s.fillStyle=o===void 0||o===e.client?`#ffffff`:`rgba(255, 255, 255, 0.45)`,s.fillText(t,g,29);let n=s.measureText(t).width;if(s.fillStyle=e.colour,s.beginPath(),s.arc(g-n-9,25,4,0,Math.PI*2),s.fill(),g-=n+30,g<h+m+40)break}if(s.textAlign=`left`,i(l)){let e=new Map;for(let n of t){if(n.name===void 0)continue;let t=e.get(n.name);t===void 0?e.set(n.name,{blip:n,count:1}):t.count++}if(e.size>0){let t=[...e.entries()].sort(([e],[t])=>e.localeCompare(t)),i=l-236-14,a=Math.max(Math.floor((u-62-28-30-36)/22),1),o=t.length>a?t.slice(0,a-1):t,c=t.length-o.length,d=36+(o.length+ +(c>0))*22+6;s.fillStyle=`rgba(3, 6, 9, 0.78)`,s.fillRect(i,62,236,d),s.fillStyle=p,s.fillRect(i,62,236,2),s.fillStyle=`#ffffff`,s.font=r(14,700),s.fillText(`LEGEND`,i+12,86),s.textAlign=`right`,s.fillStyle=`rgba(220, 230, 240, 0.6)`,s.font=r(12,600),s.fillText(String(e.size),i+236-12,86),s.textAlign=`left`,o.forEach(([e,{blip:t,count:a}],o)=>{let c=98+o*22;o%2==0&&(s.fillStyle=`rgba(255, 255, 255, 0.035)`,s.fillRect(i,c,236,22)),s.save(),s.translate(i+22,c+11),s.fillStyle=A(t.colour),s.strokeStyle=n;let l=b(t.sprite);l===void 0?(s.lineWidth=2.4,s.beginPath(),s.arc(0,0,4.5,0,Math.PI*2),s.stroke(),s.fill()):E(s,l,14,1.2),s.restore(),s.font=r(12,600);let u=e.toUpperCase();for(;u.length>1&&s.measureText(u).width>146;)u=u.slice(0,-1);u!==e.toUpperCase()&&(u=`${u.trimEnd()}…`),s.fillStyle=`#eef3f8`,s.fillText(u,i+40,c+15.5),s.textAlign=`right`,s.fillStyle=`rgba(200, 215, 230, 0.55)`,s.font=r(11,600),s.fillText(`×${a}`,i+236-12,c+15.5),s.textAlign=`left`}),c>0&&(s.fillStyle=`rgba(200, 215, 230, 0.6)`,s.font=r(11,700),s.fillText(`+ ${c} MORE`,i+40,98+o.length*22+15.5))}}let v=[[`left`,`MOVE PLAYER`],[`twice`,`WAYPOINT`],[`wheel`,`ZOOM`]];s.font=r(11,700);let y=v.map(([,e])=>s.measureText(e).width+36),x=l-14-y.reduce((e,t)=>e+t,0)-8,S=u-14-28;s.fillStyle=`rgba(3, 6, 9, 0.78)`,s.fillRect(x,S,l-14-x,28),x+=12,v.forEach(([e,t],n)=>{c(s,x,S+6,e),s.fillStyle=`#ffffff`,s.font=r(11,700),s.fillText(t,x+22,S+18.5),x+=y[n]}),s.lineWidth=1}}}var De=7,Y={left:-4e3,right:4500,bottom:-4e3,top:8e3},X={top:0,right:0,bottom:0,left:0},Oe=450,ke=`fiverunner:map-style`,Ae=`fiverunner:map-image`;function je(e){try{return localStorage.getItem(e)}catch{return null}}function Z(e,t){try{localStorage.setItem(e,t)}catch{}}var Me=class{element;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f={entities:[],blips:[]};#p=[];#m=(Y.left+Y.right)/2;#h=(Y.bottom+Y.top)/2;#g=.05;#_=!1;#v=[];#y=new Map;#b=new Map;#x=!1;#S=!0;#C;#w;constructor(e,t,n){this.element=e,this.#s=t,this.#l=n,this.#c=[V,Ce(),Ee(()=>this.#d)],this.#u=this.#c.find(({name:e})=>e===je(ke))??V;let r=document.createElement(`div`);r.className=`toolbar`;let i=document.createElement(`h2`);i.textContent=`Map`,this.#a=document.createElement(`select`),this.#a.setAttribute(`aria-label`,`Whose blips the map shows`),this.#a.addEventListener(`change`,()=>this.#R());let a=document.createElement(`select`);a.setAttribute(`aria-label`,`How the map looks`),a.append(...this.#c.map(({name:e})=>new Option(e,e))),a.value=this.#u.name,a.addEventListener(`change`,()=>{this.use(a.value),this.#s.styled?.(a.value)});let o=document.createElement(`button`);o.type=`button`,o.textContent=`Fit`,o.addEventListener(`click`,()=>{this.#_=!1,this.#M()}),this.#o=this.#E(),this.#i=document.createElement(`span`),this.#i.className=`hint`,this.#i.textContent=`Drag a player to move them, double-click to set their waypoint`,r.append(i,this.#a,a,o,this.#o,this.#i);let s=document.createElement(`div`);s.className=`view`,this.#n=s,this.#e=document.createElement(`canvas`),this.#t=this.#e.getContext(`2d`),this.#r=document.createElement(`div`),this.#r.className=`tooltip`,this.#r.hidden=!0,s.append(this.#e,this.#r),e.append(...n===void 0?[r,s]:[s]),new ResizeObserver(()=>this.#R()).observe(s),new IntersectionObserver(([e])=>{this.#S=e?.isIntersecting??!0,this.#T()}).observe(s),n===void 0&&this.#I(),this.use(this.#u.name)}show(e,t){let n=performance.now();for(let t of e.entities){let e=this.#b.get(t.id);if(this.#u.animated&&e!==void 0&&(e[0]!==t.x||e[1]!==t.y)){let[r,i]=this.#j(t.id,e,n);this.#y.set(t.id,{fromX:r,fromY:i,toX:t.x,toY:t.y,start:n})}this.#b.set(t.id,[t.x,t.y])}if(this.#f=e,t.map(({client:e,name:t})=>`${e} ${t}`).join()!==this.#p.map(({client:e,name:t})=>`${e} ${t}`).join()){let e=this.#a.value;this.#a.replaceChildren(new Option(`Blips of every player`,``),...t.map(({client:e,name:t})=>new Option(`Blips of ${t} (${e})`,String(e)))),this.#a.value=t.some(({client:t})=>String(t)===e)?e:``}this.#p=t,this.#_?this.#R():this.#M()}use(e){this.#u=this.#c.find(t=>t.name===e)??V,this.#l===void 0&&Z(ke,this.#u.name),this.#y.clear(),this.#o.hidden=this.#u.name!==`GTA`,this.#i.hidden=this.#u.instructions===!0,this.#n.dataset.style=this.#u.name,this.#_?this.#R():this.#M(),this.#T()}#T(){if(this.#x||!this.#u.animated||!this.#S)return;this.#x=!0;let e=()=>{!this.#u.animated||!this.#S?this.#x=!1:(this.#R(),requestAnimationFrame(e))};requestAnimationFrame(e)}#E(){let e=document.createElement(`details`);e.className=`map-image`;let t=document.createElement(`summary`);t.textContent=`Map image`;let n=document.createElement(`input`);n.type=`file`,n.accept=`image/*`,n.setAttribute(`aria-label`,`An image of the world to show under the map`);let r=JSON.parse(je(Ae)??`null`)??[Y.left,Y.top,Y.right,Y.bottom],i=[`Left`,`Top`,`Right`,`Bottom`].map((e,t)=>{let n=document.createElement(`input`);return n.type=`number`,n.value=String(r[t]),n.setAttribute(`aria-label`,`The ${e.toLowerCase()} edge of the image, in metres of the world`),n.title=`${e} edge, in metres`,n}),a,o=()=>{let[e,t,n,r]=i.map(e=>Number(e.value));Z(Ae,JSON.stringify([e,t,n,r])),this.#d=a===void 0?void 0:{image:a,left:e,top:t,right:n,bottom:r},this.#R()};n.addEventListener(`change`,()=>{let e=n.files?.[0];if(e===void 0)return;let t=new Image;t.addEventListener(`load`,()=>{a=t,o()}),t.src=URL.createObjectURL(e)});for(let e of i)e.addEventListener(`change`,o);return e.append(t,n,...i),e}get#D(){let e=this.#a.value;return e===``?this.#f.blips:this.#f.blips.filter(({client:t})=>String(t)===e)}get#O(){let e=this.#a.value;return e===``?void 0:Number(e)}get#k(){return this.#p.map(({client:e,name:t})=>{let n=this.#f.entities.find(({kind:t,owner:n})=>t===`player`&&n===e)?.look;return{client:e,name:t,colour:j(e),...n===void 0?{}:{look:n}}})}get#A(){let e=this.#a.value;return e===``?this.#p.find(({state:e})=>e===`joined`)?.client:Number(e)}#j(e,t,n){let r=this.#y.get(e);if(r===void 0)return[t[0],t[1]];let i=Math.min((n-r.start)/Oe,1);i===1&&this.#y.delete(e);let a=1-(1-i)**3;return[r.fromX+(r.toX-r.fromX)*a,r.fromY+(r.toY-r.fromY)*a]}#M(){if(this.#l!==void 0)return this.#R();let e=[...this.#D,...this.#f.entities],t=this.#e.getBoundingClientRect();if(t.width===0||t.height===0)return;let n=this.#u.insets?.(t.width,t.height)??X,r=Math.max(t.width-n.left-n.right,80),i=Math.max(t.height-n.top-n.bottom,80),a=Y.left,o=Y.right,s=Y.bottom,c=Y.top;e.length>0&&(a=Math.min(...e.map(({x:e})=>e)),o=Math.max(...e.map(({x:e})=>e)),s=Math.min(...e.map(({y:e})=>e)),c=Math.max(...e.map(({y:e})=>e)));let l=Math.max(o-a,c-s,200)*.15;this.#g=Math.min(r/(o-a+2*l),i/(c-s+2*l)),this.#m=(a+o)/2-(n.left-n.right)/2/this.#g,this.#h=(s+c)/2+(n.top-n.bottom)/2/this.#g,this.#R()}#N(){return this.#l??this.#e.getBoundingClientRect()}#P(e,t){let{width:n,height:r}=this.#N();return[(e-this.#m)*this.#g+n/2,(this.#h-t)*this.#g+r/2]}#F(e,t){let{width:n,height:r}=this.#N();return[(e-n/2)/this.#g+this.#m,this.#h-(t-r/2)/this.#g]}#I(){let e=this.#e,t=t=>{let n=e.getBoundingClientRect();return[t.clientX-n.left,t.clientY-n.top]};e.addEventListener(`wheel`,e=>{e.preventDefault(),this.#_=!0;let[n,r]=t(e),[i,a]=this.#F(n,r);this.#g=Math.min(Math.max(this.#g*(e.deltaY<0?1.25:.8),.005),40);let[o,s]=this.#F(n,r);this.#m+=i-o,this.#h+=a-s,this.#R()}),e.addEventListener(`mousedown`,e=>{let[n,r]=t(e),i=this.#L(n,r);i?.kind===`entity`&&i.entity.kind===`player`&&i.entity.owner!==void 0?(this.#_=!0,this.#w={kind:`player`,client:i.entity.owner,x:n,y:r}):this.#w={kind:`pan`,x:n,y:r,cx:this.#m,cy:this.#h}}),e.addEventListener(`mousemove`,e=>{let[n,r]=t(e),i=this.#w;i?.kind===`pan`?(this.#_=!0,this.#m=i.cx-(n-i.x)/this.#g,this.#h=i.cy+(r-i.y)/this.#g):i?.kind===`player`?(i.x=n,i.y=r):this.#C=this.#L(n,r)?.key,this.#R()}),e.addEventListener(`mouseup`,e=>{let n=this.#w;if(this.#w=void 0,n?.kind===`player`){let r=this.#L(...t(e),`blip`);r?.kind===`blip`?this.#s.teleport(n.client,r.blip.x,r.blip.y,r.blip.z):this.#s.teleport(n.client,...this.#F(...t(e)))}this.#R()}),e.addEventListener(`mouseleave`,()=>{this.#w=void 0,this.#C=void 0,this.#R()}),e.addEventListener(`dblclick`,e=>{let n=this.#A;if(n===void 0)return;let[r,i]=this.#F(...t(e));this.#s.waypoint(n,r,i)})}#L(e,t,n){let r,i=12;for(let a of this.#v){if(n!==void 0&&a.kind!==n)continue;let o=Math.hypot(a.sx-e,a.sy-t);o<=i&&(i=o,r=a)}return r}#R(){let e=this.#e,t=e.getBoundingClientRect();if(t.width===0||t.height===0)return;let{width:n,height:r}=this.#N(),i=devicePixelRatio*(t.width/n);(e.width!==Math.round(t.width*devicePixelRatio)||e.height!==Math.round(t.height*devicePixelRatio))&&(e.width=Math.round(t.width*devicePixelRatio),e.height=Math.round(t.height*devicePixelRatio));let a=performance.now(),o=this.#l;if(o!==void 0){let e=this.#f.entities.find(({kind:e,owner:t})=>e===`player`&&t===o.client);e!==void 0&&([this.#m,this.#h]=this.#j(e.id,[e.x,e.y],a)),this.#g=De}e.dataset.view=`${this.#m} ${this.#h} ${this.#g}`,e.dataset.players=JSON.stringify(this.#f.entities.flatMap(({kind:e,owner:t,x:n,y:r})=>e===`player`&&t!==void 0?[[t,n,r]]:[]));let s=this.#t;s.setTransform(i,0,0,i,0,0);let c=[],l={context:s,width:n,height:r,ratio:i,bare:o!==void 0,scale:this.#g,time:a,toScreen:(e,t)=>this.#P(e,t),toWorld:(e,t)=>this.#F(e,t),claim:(e,t,n,r,i=!1)=>{let a=!c.some(([i,a,o,s])=>e<i+o&&i<e+n&&t<a+s&&a<t+r);return(a||i)&&c.push([e,t,n,r]),a||i},crowding:(e,t,n,r)=>c.reduce((i,[a,o,s,c])=>i+Math.max(0,Math.min(e+n,a+s)-Math.max(e,a))*Math.max(0,Math.min(t+r,o+c)-Math.max(t,o)),0)},u=this.#u,d=this.#D,f=o===void 0?u.insets?.(n,r)??X:X;l.claim(0,0,n,f.top,!0),l.claim(n-f.right,0,f.right,r,!0),l.claim(0,r-f.bottom,n,f.bottom,!0),l.claim(0,0,f.left,r,!0),u.background(l,d),this.#v=[];let p=this.#f.entities.map(e=>{let t=this.#y.has(e.id),[n,r]=this.#j(e.id,[e.x,e.y],a);return{entity:e,moving:t,at:this.#P(n,r)}});for(let e of d)(e.shape===`radius`||e.shape===`area`)&&u.area(l,e,...this.#P(e.x,e.y));for(let e of d){if(!e.route)continue;let t=p.find(({entity:t})=>t.kind===`player`&&t.owner===e.client);t!==void 0&&u.route(l,t.at,this.#P(e.x,e.y),A(e.colour))}for(let e of d){let[t,n]=this.#P(e.x,e.y),r=`blip ${e.client} ${e.handle}`;this.#v.push({key:r,kind:`blip`,blip:e,sx:t,sy:n}),u.blip(l,e,t,n,this.#C===r)}let m=this.#k,h=[];for(let{entity:e,moving:t,at:n}of[...p].sort((e,t)=>e.at[1]-t.at[1])){let r=e.kind===`player`&&e.owner!==void 0?m.find(({client:t})=>t===e.owner)??{client:e.owner,name:void 0,colour:j(e.owner)}:void 0,[i,a]=u.entity(l,e,...n,t,r);this.#v.push({key:`entity ${e.id}`,kind:`entity`,entity:e,sx:i,sy:a}),r?.name!==void 0&&h.push([r.name,r.colour,...n])}for(let e of h)u.tag(l,...e);let g=this.#C,_=this.#v.filter(e=>e.kind===`blip`&&(e.key===g||this.#g>=.12));_.sort((e,t)=>Number(t.key===g)-Number(e.key===g));for(let e of _)e.kind===`blip`&&e.blip.name!==void 0&&u.label(l,e.blip.name,e.sx,e.sy,e.key===g);let v=this.#w;if(v?.kind===`player`){let e=p.find(({entity:e})=>e.kind===`player`&&e.owner===v.client)?.at,t=m.find(({client:e})=>e===v.client);u.dragging!==void 0&&e!==void 0&&t!==void 0?u.dragging(l,e,[v.x,v.y],t):(s.strokeStyle=j(v.client),s.setLineDash([4,4]),s.beginPath(),s.arc(v.x,v.y,9,0,Math.PI*2),s.stroke(),s.setLineDash([]))}o===void 0&&u.overlay?.(l,d,m,this.#O),this.#z()}#z(){let e=this.#w===void 0?this.#C:void 0,t=this.#v.find(({key:t})=>t===e);if(this.#r.hidden=t===void 0,t===void 0)return;let n=e=>this.#p.find(t=>t.client===e)?.name??`nobody`,r=(e,t)=>`${e.toFixed(1)}, ${t.toFixed(1)}`;this.#r.textContent=t.kind===`blip`?`${t.blip.name??(t.blip.sprite===8?`Waypoint`:`Blip`)}\n${r(t.blip.x,t.blip.y)}\nsprite ${t.blip.sprite}, colour ${t.blip.colour}\n${t.blip.script??`the player`}, on the map of ${n(t.blip.client)}`:`${t.entity.kind} ${t.entity.id}, model 0x${(t.entity.model>>>0).toString(16)}\n${r(t.entity.x,t.entity.y)}, z ${t.entity.z.toFixed(1)}, heading ${t.entity.heading.toFixed(0)}\nowned by ${n(t.entity.owner)}`,this.#r.style.left=`${t.sx+14}px`,this.#r.style.top=`${t.sy+14}px`}},Q=1920,Ne=1080,Pe=250,Fe={Escape:`ESCAPE`,Enter:`RETURN`,Backspace:`BACK`,Tab:`TAB`,Space:`SPACE`,CapsLock:`CAPITAL`,ShiftLeft:`LSHIFT`,ShiftRight:`RSHIFT`,ControlLeft:`LCONTROL`,ControlRight:`RCONTROL`,AltLeft:`LMENU`,AltRight:`RMENU`,ArrowUp:`UP`,ArrowDown:`DOWN`,ArrowLeft:`LEFT`,ArrowRight:`RIGHT`,PageUp:`PAGEUP`,PageDown:`PAGEDOWN`,Home:`HOME`,End:`END`,Insert:`INSERT`,Delete:`DELETE`,NumpadMultiply:`MULTIPLY`,NumpadAdd:`ADD`,NumpadSubtract:`SUBTRACT`,NumpadDecimal:`DECIMAL`,NumpadDivide:`DIVIDE`};function Ie(e){return/^Key[A-Z]$/.test(e)?e.slice(3):/^Digit\d$/.test(e)?e.slice(5):/^F\d{1,2}$/.test(e)?e:/^Numpad\d$/.test(e)?`NUMPAD${e.slice(6)}`:Fe[e]}var Le=class{element;world;#e;#t;#n;#r=new Map;#i=new Map;#a=new Map;#o=0;#s=[];#c=[];#l=1;#u=new Set;constructor(e,t){this.#n=t,this.element=document.createElement(`div`),this.element.className=`screen`,this.element.tabIndex=0;let n=document.createElement(`div`);n.className=`world`,this.world=new Me(n,{teleport:()=>{},waypoint:()=>{}},{client:e,width:Q/2,height:Ne/2}),this.#e=document.createElement(`div`),this.#e.className=`fade`,this.element.append(n,this.#e),this.#t=document.createElement(`div`),this.#t.className=`viewport`,this.#t.style.width=`${Q}px`,this.#t.style.height=`${Ne}px`,this.element.append(this.#t),new ResizeObserver(()=>{this.#l=this.element.clientWidth/Q,this.#t.style.transform=`scale(${this.#l})`}).observe(this.element),this.element.addEventListener(`keydown`,e=>this.#m(e,!0)),this.element.addEventListener(`keyup`,e=>this.#m(e,!1)),this.element.addEventListener(`blur`,()=>{for(let e of this.#u)this.#n.key(e,!1);this.#u.clear()}),this.element.addEventListener(`mousedown`,()=>this.element.focus()),this.element.addEventListener(`mousemove`,e=>{let t=this.#t.getBoundingClientRect();this.#h((e.clientX-t.left)/this.#l,(e.clientY-t.top)/this.#l)})}frameOf(e){for(let[t,n]of this.#r)if(n.contentWindow===e)return t}fade(e){this.#e.style.opacity=String(e)}blur(e){this.element.classList.toggle(`blurred`,e)}cursorOver(e,t){this.#h(e,t)}async create({resource:e,url:t}){let n=++this.#o;this.#a.set(e,n),this.#i.set(e,[]);let r=this.#n.frame(t);if(await this.#n.ready(r),this.#a.get(e)!==n)return;this.#a.delete(e);let i=document.createElement(`iframe`);i.name=e,i.style.visibility=`hidden`,i.allow=`microphone *; camera *; autoplay; payment 'none'; geolocation 'none';`,i.sandbox.value=`allow-forms allow-scripts allow-same-origin`,i.src=r,i.tabIndex=-1,i.addEventListener(`load`,()=>{i.style.visibility=`visible`,setTimeout(()=>{for(let t of this.#i.get(e)??[])this.#d(i,t);this.#i.delete(e)},Pe)}),this.#r.set(e,i),this.#s.push(e);let a=document.activeElement;this.#t.append(i),a instanceof HTMLIFrameElement&&a!==i&&a.focus()}destroy(e){this.#a.delete(e),this.#i.delete(e);let t=this.#r.get(e);t!==void 0&&(this.#s=this.#s.filter(t=>t!==e),t.remove(),this.#r.delete(e))}message(e,t){let n=this.#i.get(e),r=this.#r.get(e);n===void 0?r!==void 0&&this.#d(r,t):n.push(t)}#d(e,t){e.contentWindow?.postMessage(JSON.parse(t),`*`)}frameFocus(e,t){t?this.#f(e):this.#p(e)}zIndex(e,t){let n=this.#r.get(e);n!==void 0&&(n.style.zIndex=String(t))}focus(e,t){this.element.classList.toggle(`nui-cursor`,t),this.element.classList.toggle(`nui-focus`,e);let n=document.activeElement;!e&&n instanceof HTMLIFrameElement&&this.frameOf(n.contentWindow)&&this.element.focus()}#f(e){this.#s=[...this.#s.filter(t=>t!==e),e],this.#c=[e,...this.#c.filter(t=>t!==e)],this.#s.forEach((e,t)=>{let n=this.#r.get(e);n!==void 0&&(n.style.zIndex=String(t))});let t=this.#r.get(e);t!==void 0&&(t.style.zIndex=`99999`,t.contentWindow?.focus())}#p(e){this.#c=this.#c.filter(t=>t!==e),this.#r.get(e)?.contentWindow?.blur();let[t]=this.#c;t!==void 0&&this.#f(t)}#m(e,t){let n=Ie(e.code);if(n!==void 0&&e.target===this.element&&(e.preventDefault(),!(t&&e.repeat))){if(t)this.#u.add(n);else if(!this.#u.delete(n))return;this.#n.key(n,t)}}#h(e,t){this.#n.cursor(Math.round(e),Math.round(t))}};function $(e){return document.getElementById(e)}function Re({worker:e,frames:t,project:n,watch:r}){let i=t=>e.postMessage(t),o=$(`status`),s=$(`project`),u=new c($(`console`)),f=$(`resources-list`),m=$(`player-list`),h=new d($(`events`),$(`emit`),{emit:(e,t,n)=>i({type:`emit`,name:e,args:t,target:n})}),g=$(`bags`),v=new Me($(`map`),{teleport:(e,t,n,r)=>i({type:`teleport`,client:e,x:t,y:n,...r===void 0?{}:{z:r}}),waypoint:(e,t,n)=>i({type:`waypoint`,client:e,x:t,y:n}),styled:e=>{for(let t of b.values())t.screen.world.use(e)}}),y=new _({process:$(`inspected`),resources:$(`inspected-resources`),details:$(`inspected-details`),filter:$(`convar-filter`),convars:$(`convars`),form:$(`evaluate`),code:$(`code`)},{inspect:e=>i({type:`inspect`,process:e}),evaluate:(e,t,n)=>{(e===`server`?u:w(e).console).note(`${t}> ${n}`),i({type:`evaluate`,process:e,resource:t,code:n})}}),b=new Map,x=new Map,S=0;t.listen((e,t,n,r)=>{let a=S++;x.set(a,r),i({type:`ask`,id:a,client:e,host:t,ask:n})});function C(e,t){o.textContent=e,o.className=t}function w(e){let n=b.get(e);if(n!==void 0)return n;let r=document.createElement(`article`);r.className=`player`;let a=document.createElement(`header`),o=document.createElement(`span`);o.className=`info`;let s=document.createElement(`button`);s.textContent=`Enlarge`,s.addEventListener(`click`,()=>{let e=r.classList.toggle(`large`);s.textContent=e?`Shrink`:`Enlarge`});let l=document.createElement(`button`);l.textContent=`Disconnect`,l.addEventListener(`click`,()=>i({type:`disconnect`,client:e})),a.append(o,s,l);let u=document.createElement(`div`);u.className=`card`,u.hidden=!0;let d=new Le(e,{frame:n=>t.url(n,e),ready:e=>t.ready(e),cursor:(t,n)=>i({type:`cursor`,client:e,x:t,y:n}),key:(t,n)=>i({type:`key`,client:e,key:t,down:n})}),f=document.createElement(`div`);return f.className=`console small`,r.append(a,d.element,u,f),m.append(r),n={element:r,info:o,card:u,screen:d,console:new c(f),cardJson:void 0},b.set(e,n),n}function T(e,t,n){let r=n.state===`connecting`?n.card:void 0;if(t.cardJson===r||(t.cardJson=r,t.card.replaceChildren(),t.card.hidden=r===void 0,r===void 0))return;let o=a(r,t=>i({type:`submitCard`,client:e,json:t}));if(o!==void 0){t.card.append(o);return}let s=document.createElement(`pre`);s.textContent=r;let c=document.createElement(`form`),l=document.createElement(`textarea`);l.value=`{}`,l.setAttribute(`aria-label`,`What the card submits, as JSON`);let u=document.createElement(`button`);u.textContent=`Submit card`,c.append(l,u),c.addEventListener(`submit`,t=>{t.preventDefault(),i({type:`submitCard`,client:e,json:l.value})}),t.card.append(s,c)}function ee(e){f.replaceChildren(...e.resources.map(({name:e,state:t})=>{let n=document.createElement(`li`),r=document.createElement(`span`);r.textContent=e;let a=document.createElement(`span`);a.className=`state ${t}`,a.textContent=t,n.append(r,a);for(let r of t===`started`?[`restart`,`stop`]:[`start`]){let t=document.createElement(`button`);t.textContent=r,t.addEventListener(`click`,()=>i({type:`command`,line:`${r} "${e}"`})),n.append(t)}return n})),h.players(e.players),y.players(e.players),p(g,e.bags),v.show(e.map,e.players);for(let t of e.players){let n=w(t.client),r=t.state===`dropped`||t.state===`rejected`,i=t.state===`connecting`?t.message?.trim():void 0,a=t.rejection??i;n.info.textContent=`${t.name} (id ${t.id}) ${t.state}${a?`: ${a}`:``}`,n.element.classList.toggle(`gone`,r),n.screen.world.show(e.map,e.players),n.screen.fade(t.fade??0),n.screen.blur(t.blurred===!0),T(t.client,n,t)}}function E(e,t){let{screen:n}=w(e);switch(t.type){case`create`:n.create(t.frame);break;case`destroy`:n.destroy(t.resource);break;case`message`:n.message(t.resource,t.json);break;case`frameFocus`:n.frameFocus(t.resource,t.focused);break;case`focus`:n.focus(t.focus,t.cursor);break;case`zIndex`:n.zIndex(t.resource,t.zIndex)}}function te(e){let t=/^client (\d+)$/.exec(e.process)?.[1];t===void 0?u.add(e):w(Number(t)).console.add(e)}function D(e){C(`Starting`,`starting`),u.note(e),h.note(e);for(let e of b.values())e.element.remove();b.clear();let t=n();i({type:`start`,...t===void 0?{}:{project:t}})}e.addEventListener(`message`,e=>{let t=e.data;switch(t.type){case`started`:s.textContent=t.project.name,document.title=`${t.project.name} - FiveRunner`,C(`Running`,`running`);break;case`failed`:C(`Failed: ${t.message}`,`failed`),u.note(t.message);break;case`changed`:t.restarted===null?D(`Files changed`):t.restarted.length>0&&u.note(`Files changed: restarted ${t.restarted.join(`, `)}`);break;case`event`:{let{event:e}=t;e.type===`output`?te(e.line):e.type===`state`?ee(e.state):e.type===`nui`?E(e.client,e.event):e.type===`net`?h.add(e.event):(C(`Crashed`,`failed`),u.note(e.message));break}case`inspection`:y.show(t.inspection);break;case`answer`:x.get(t.id)?.(t.answer),x.delete(t.id)}}),addEventListener(`message`,e=>{for(let t of b.values()){let n=t.screen.frameOf(e.source);if(n===void 0)continue;let r=e.data;r.type===`fiverunner:cursor`&&typeof r.x==`number`&&typeof r.y==`number`?t.screen.cursorOver(r.x,r.y):r.type===`fiverunner:invokeNative`&&t.console.note(`${n} called invokeNative('${String(r.native)}', '${String(r.arg)}')`);return}}),$(`command`).addEventListener(`submit`,e=>{e.preventDefault();let t=$(`command-line`),n=t.value;n.trim()!==``&&(O(n),u.note(`> ${n}`),i({type:`command`,line:n}),t.value=``)});let O=l($(`command-line`));$(`connect`).addEventListener(`submit`,e=>{e.preventDefault();let t=$(`player-name`).value.trim();i({type:`connect`,name:t===``?`Player`:t})}),$(`restart`).addEventListener(`click`,()=>D(`Restarted`)),r(e=>i({type:`change`,paths:e})),D(`Started`)}var ze=`fiverunner.localhost`,Be=new TextEncoder,Ve=new TextDecoder;function He({host:e,client:t,tab:n}){let r=e.replace(/[A-Z]/g,e=>e.toLowerCase());return`${/^[a-z0-9_-]+$/.test(r)?r:`${Array.from(Be.encode(r),e=>e.toString(16).padStart(2,`0`)).join(``)}.x`}.c${t}.${n}.${ze}`}function Ue(e){let t=/^(.+)\.c([1-9][0-9]*)\.([a-z0-9]+)\.fiverunner\.localhost$/.exec(e);if(t===null)return;let[,n=``,r=``,i=``]=t,a=Number(r);if(/^[a-z0-9_-]+$/.test(n))return{host:n,client:a,tab:i};let o=/^((?:[0-9a-f]{2})+)\.x$/.exec(n)?.[1];if(o===void 0)return;let s=Uint8Array.from(o.match(/../g),e=>parseInt(e,16));return{host:Ve.decode(s),client:a,tab:i}}function We(e,t,n,r){let i=/^(?:nui:\/\/|https:\/\/(?=cfx-nui-))([^/?#]*)(.*)$/i.exec(e);if(i===null)return e;let[,a=``,o=``]=i,s=o.startsWith(`/`)?o:`/${o}`;return`http://${He({host:a,client:t,tab:n})}${r===``?``:`:${r}`}${s}`}function Ge(){let e=`fiverunner:tab`;try{let t=sessionStorage.getItem(e);if(t!==null&&/^[a-z0-9]{1,16}$/.test(t))return t;let n=Math.random().toString(36).slice(2,10);return sessionStorage.setItem(e,n),n}catch{return Math.random().toString(36).slice(2,10)}}var Ke=class{#e=Ge();#t;#n=new Map;#r=new Map;#i=()=>{};constructor(e){this.#t=e,addEventListener(`message`,e=>{let t=this.#n.get(e.origin);if(t===void 0||e.source!==t.frame.contentWindow)return;let n=e.data;n.type===`fiverunner:bridge`?this.#r.get(e.origin)?.():n.type===`fiverunner:ask`&&this.#a(e.origin,t.frame,n.id,n.ask)})}url(e,t){return We(e,t,this.#e,location.port)}ready(t){let n=new URL(t);if(Ue(n.hostname)===void 0)return Promise.resolve();let{origin:r}=n,i=this.#n.get(r);if(i===void 0){let t=document.createElement(`iframe`);t.src=`${r}${e}bridge.html`,t.title=`FiveRunner NUI bridge`,i={frame:t,ready:new Promise(e=>this.#r.set(r,e))},this.#n.set(r,i),this.#t.append(t)}return i.ready}listen(e){this.#i=e}#a(e,t,n,r){let i=Ue(new URL(e).hostname);i!==void 0&&i.tab===this.#e&&this.#i(i.client,i.host,r,r=>{let i={type:`fiverunner:answer`,id:n,answer:r};t.contentWindow?.postMessage(i,e)})}};Re({worker:new Worker(new URL(`/__fiverunner/assets/worker-BAR8L3pe.js`,``+import.meta.url),{type:`module`}),frames:new Ke(document.getElementById(`bridges`)),project:()=>void 0,watch(e){new EventSource(`${t}events`).addEventListener(`change`,t=>e(JSON.parse(t.data)))}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{t as QuickJSModuleCallbacks,n as QuickJSWASMModule,r as applyBaseRuntimeOptions,i as applyModuleEvalRuntimeOptions}from"./worker-
|
|
1
|
+
export{t as QuickJSModuleCallbacks,n as QuickJSWASMModule,r as applyBaseRuntimeOptions,i as applyModuleEvalRuntimeOptions}from"./worker-BAR8L3pe.js";
|
|
@@ -6,7 +6,7 @@ ${this._constructorStack}
|
|
|
6
6
|
Lifetime used`):new Ht(`Lifetime not alive`)}},un=class extends ln{constructor(e,t){super(e,void 0,void 0,t)}get dupable(){return!0}dup(){return this}dispose(){}},dn=class extends ln{constructor(e,t,n,r){super(e,t,n,r)}dispose(){this._alive=!1}};function fn(e,t){let n;try{e.dispose()}catch(e){n=e}if(t&&n)throw Object.assign(t,{message:`${t.message}
|
|
7
7
|
Then, failed to dispose scope: ${n.message}`,disposeError:n}),t;if(t||n)throw t||n}var pn=class e extends on{constructor(){super(...arguments),this._disposables=new ln(/* @__PURE__ */ new Set),this.manage=e=>(this._disposables.value.add(e),e)}static withScope(t){let n=new e,r;try{return t(n)}catch(e){throw r=e,e}finally{fn(n,r)}}static withScopeMaybeAsync(t,n){return rn(void 0,function*(r){let i=new e,a;try{return yield*r.of(n.call(t,r,i))}catch(e){throw a=e,e}finally{fn(i,a)}})}static async withScopeAsync(t){let n=new e,r;try{return await t(n)}catch(e){throw r=e,e}finally{fn(n,r)}}get alive(){return this._disposables.alive}dispose(){let e=Array.from(this._disposables.value.values()).reverse();for(let t of e)t.alive&&t.dispose();this._disposables.dispose()}};function mn(e){let t=e?Array.from(e):[];function n(){return t.forEach(e=>e.alive?e.dispose():void 0)}function r(){return t.some(e=>e.alive)}return Object.defineProperty(t,sn,{configurable:!0,enumerable:!1,value:n}),Object.defineProperty(t,"dispose",{configurable:!0,enumerable:!1,value:n}),Object.defineProperty(t,"alive",{configurable:!0,enumerable:!1,get:r}),t}function hn(e){return!!(e&&(typeof e==`object`||typeof e==`function`)&&`alive`in e&&typeof e.alive==`boolean`&&`dispose`in e&&typeof e.dispose==`function`)}var gn=class e extends on{static success(e){return new _n(e)}static fail(e,t){return new vn(e,t)}static is(t){return t instanceof e}},_n=class extends gn{constructor(e){super(),this.value=e}get alive(){return!hn(this.value)||this.value.alive}dispose(){hn(this.value)&&this.value.dispose()}unwrap(){return this.value}unwrapOr(e){return this.value}},vn=class extends gn{constructor(e,t){super(),this.error=e,this.onUnwrap=t}get alive(){return!hn(this.error)||this.error.alive}dispose(){hn(this.error)&&this.error.dispose()}unwrap(){throw this.onUnwrap(this),this.error}unwrapOr(e){return e}},yn=gn,bn=class extends on{constructor(e){super(),this.resolve=e=>{this.resolveHandle.alive&&(this.context.unwrapResult(this.context.callFunction(this.resolveHandle,this.context.undefined,e||this.context.undefined)).dispose(),this.disposeResolvers(),this.onSettled())},this.reject=e=>{this.rejectHandle.alive&&(this.context.unwrapResult(this.context.callFunction(this.rejectHandle,this.context.undefined,e||this.context.undefined)).dispose(),this.disposeResolvers(),this.onSettled())},this.dispose=()=>{this.handle.alive&&this.handle.dispose(),this.disposeResolvers()},this.context=e.context,this.owner=e.context.runtime,this.handle=e.promiseHandle,this.settled=new Promise(e=>{this.onSettled=e}),this.resolveHandle=e.resolveHandle,this.rejectHandle=e.rejectHandle}get alive(){return this.handle.alive||this.resolveHandle.alive||this.rejectHandle.alive}disposeResolvers(){this.resolveHandle.alive&&this.resolveHandle.dispose(),this.rejectHandle.alive&&this.rejectHandle.dispose()}},xn=class{constructor(e){this.module=e}toPointerArray(e){let t=new Int32Array(e.map(e=>e.value)),n=t.length*t.BYTES_PER_ELEMENT,r=this.module._malloc(n);return new Uint8Array(this.module.HEAPU8.buffer,r,n).set(new Uint8Array(t.buffer)),new ln(r,void 0,e=>this.module._free(e))}newTypedArray(e,t){let n=new e(Array(t).fill(0)),r=n.length*n.BYTES_PER_ELEMENT,i=this.module._malloc(r),a=new e(this.module.HEAPU8.buffer,i,t);return a.set(n),new ln({typedArray:a,ptr:i},void 0,e=>this.module._free(e.ptr))}newMutablePointerArray(e){return this.newTypedArray(Int32Array,e)}newHeapCharPointer(e){let t=this.module.lengthBytesUTF8(e),n=t+1,r=this.module._malloc(n);return this.module.stringToUTF8(e,r,n),new ln({ptr:r,strlen:t},void 0,e=>this.module._free(e.ptr))}newHeapBufferPointer(e){let t=e.byteLength,n=this.module._malloc(t);return this.module.HEAPU8.set(e,n),new ln({pointer:n,numBytes:t},void 0,e=>this.module._free(e.pointer))}consumeHeapCharPointer(e){let t=this.module.UTF8ToString(e);return this.module._free(e),t}};Object.freeze({BaseObjects:!0,Date:!0,Eval:!0,StringNormalize:!0,RegExp:!0,JSON:!0,Proxy:!0,MapSet:!0,TypedArrays:!0,Promise:!0});function Sn(e){if(!e)return 0;let t=0;for(let[n,r]of Object.entries(e)){if(!(n in Ft))throw new Jt(n);r&&(t|=Ft[n])}return t}function Cn(e){if(typeof e==`number`)return e;if(e===void 0)return 0;let{type:t,strict:n,strip:r,compileOnly:i,backtraceBarrier:a}=e,o=0;return t===`global`&&(o|=Pt.JS_EVAL_TYPE_GLOBAL),t===`module`&&(o|=Pt.JS_EVAL_TYPE_MODULE),n&&(o|=Pt.JS_EVAL_FLAG_STRICT),r&&(o|=Pt.JS_EVAL_FLAG_STRIP),i&&(o|=Pt.JS_EVAL_FLAG_COMPILE_ONLY),a&&(o|=Pt.JS_EVAL_FLAG_BACKTRACE_BARRIER),o}function wn(e){if(typeof e==`number`)return e;if(e===void 0)return 0;let{strings:t,symbols:n,quickjsPrivate:r,onlyEnumerable:i,numbers:a,numbersAsStrings:o}=e,s=0;return t&&(s|=Lt.JS_GPN_STRING_MASK),n&&(s|=Lt.JS_GPN_SYMBOL_MASK),r&&(s|=Lt.JS_GPN_PRIVATE_MASK),i&&(s|=Lt.JS_GPN_ENUM_ONLY),a&&(s|=Lt.QTS_GPN_NUMBER_MASK),o&&(s|=Lt.QTS_STANDARD_COMPLIANT_NUMBER),s}function Tn(...e){let t=[];for(let n of e)n!==void 0&&(t=t.concat(n));return t}var En=class extends on{constructor(e,t){super(),this.handle=e,this.context=t,this._isDone=!1,this.owner=t.runtime}[Symbol.iterator](){return this}next(e){if(!this.alive||this._isDone)return{done:!0,value:void 0};let t=this._next??=this.context.getProp(this.handle,`next`);return this.callIteratorMethod(t,e)}return(e){if(!this.alive)return{done:!0,value:void 0};let t=this.context.getProp(this.handle,`return`);if(t===this.context.undefined&&e===void 0)return this.dispose(),{done:!0,value:void 0};let n=this.callIteratorMethod(t,e);return t.dispose(),this.dispose(),n}throw(e){if(!this.alive)return{done:!0,value:void 0};let t=e instanceof ln?e:this.context.newError(e),n=this.context.getProp(this.handle,`throw`),r=this.callIteratorMethod(n,e);return t.alive&&t.dispose(),n.dispose(),this.dispose(),r}get alive(){return this.handle.alive}dispose(){this._isDone=!0,this.handle.dispose(),this._next?.dispose()}callIteratorMethod(e,t){let n=t?this.context.callFunction(e,this.handle,t):this.context.callFunction(e,this.handle);if(n.error)return this.dispose(),{value:n};let r=this.context.getProp(n.value,`done`).consume(e=>this.context.dump(e)),i=this.context.getProp(n.value,`value`);return n.value.dispose(),r&&this.dispose(),{value:yn.success(i),done:r}}},Dn=-2147483648,On=2147483647,kn=0;function An(e){return e>>8}var jn=class{constructor(){this.nextId=Dn,this.freelist=[],this.groups=/* @__PURE__ */ new Map}put(e){let t=this.allocateId(),n=An(t),r=this.groups.get(n);return r||(r=/* @__PURE__ */ new Map,this.groups.set(n,r)),r.set(t,e),t}get(e){if(e===kn)throw new Qt(`no host reference id defined`);let t=An(e),n=this.groups.get(t);if(!n)throw new Qt(`host reference id ${e} is not defined`);let r=n.get(e);if(!r)throw new Qt(`host reference id ${e} is not defined`);return r}delete(e){if(e===kn)throw new Qt(`no host reference id defined`);let t=An(e),n=this.groups.get(t);if(!n)throw new Qt(`host reference id ${e} is not defined`);n.delete(e),n.size===0&&this.groups.delete(t),this.freelist.push(e)}allocateId(){if(this.freelist.length>0)return this.freelist.shift();if(this.nextId===kn&&this.nextId++,this.nextId>On)throw new Zt(`HostRefMap: too many host refs created without disposing. Max simultaneous host refs: ${On-Dn}`);return this.nextId++}},Mn=class extends on{constructor(e,t,n){if(n===kn)throw new Qt(`cannot create HostRef with undefined id`);super(),this.runtime=e,this.handle=t,this.id=n}get alive(){return this.handle.alive}dispose(){this.handle.dispose()}get value(){return this.runtime.hostRefs.get(this.id)}},Nn=class extends xn{constructor(e){super(e.module),this.scope=new pn,this.copyJSValue=e=>this.ffi.QTS_DupValuePointer(this.ctx.value,e),this.freeJSValue=e=>{this.ffi.QTS_FreeValuePointer(this.ctx.value,e)},e.ownedLifetimes?.forEach(e=>this.scope.manage(e)),this.owner=e.owner,this.module=e.module,this.ffi=e.ffi,this.rt=e.rt,this.ctx=this.scope.manage(e.ctx)}get alive(){return this.scope.alive}dispose(){return this.scope.dispose()}[Symbol.dispose](){return this.dispose()}manage(e){return this.scope.manage(e)}consumeJSCharPointer(e){let t=this.module.UTF8ToString(e);return this.ffi.QTS_FreeCString(this.ctx.value,e),t}heapValueHandle(e,t){let n=t?e=>{t(),this.freeJSValue(e)}:this.freeJSValue;return new ln(e,this.copyJSValue,n,this.owner)}staticHeapValueHandle(e){return this.manage(this.heapValueHandle(e)),new un(e,this.owner)}},Pn=class extends on{constructor(e){super(),this._undefined=void 0,this._null=void 0,this._false=void 0,this._true=void 0,this._global=void 0,this._BigInt=void 0,this._Symbol=void 0,this._SymbolIterator=void 0,this._SymbolAsyncIterator=void 0,this.cToHostCallbacks={callFunction:(e,t,n,r,i)=>{if(e!==this.ctx.value)throw Error(`QuickJSContext instance received C -> JS call with mismatched ctx`);let a=this.getFunction(i);return pn.withScopeMaybeAsync(this,function*(e,i){let o=i.manage(new dn(t,this.memory.copyJSValue,this.memory.freeJSValue,this.runtime)),s=Array(n);for(let e=0;e<n;e++){let t=this.ffi.QTS_ArgvGetJSValueConstPointer(r,e);s[e]=i.manage(new dn(t,this.memory.copyJSValue,this.memory.freeJSValue,this.runtime))}try{let t=yield*e(a.apply(o,s));if(t){if(`error`in t&&t.error)throw this.runtime.debugLog(`throw error`,t.error),t.error;let e=i.manage(t instanceof ln?t:t.value);return this.ffi.QTS_DupValuePointer(this.ctx.value,e.value)}return 0}catch(e){return this.errorToHandle(e).consume(e=>this.ffi.QTS_Throw(this.ctx.value,e.value))}})}},this.runtime=e.runtime,this.module=e.module,this.ffi=e.ffi,this.rt=e.rt,this.ctx=e.ctx,this.memory=new Nn({...e,owner:this.runtime}),e.callbacks.setContextCallbacks(this.ctx.value,this.cToHostCallbacks),this.dump=this.dump.bind(this),this.getString=this.getString.bind(this),this.getNumber=this.getNumber.bind(this),this.resolvePromise=this.resolvePromise.bind(this),this.uint32Out=this.memory.manage(this.memory.newTypedArray(Uint32Array,1))}get alive(){return this.memory.alive}dispose(){this.memory.dispose()}get undefined(){if(this._undefined)return this._undefined;let e=this.ffi.QTS_GetUndefined();return this._undefined=new un(e)}get null(){if(this._null)return this._null;let e=this.ffi.QTS_GetNull();return this._null=new un(e)}get true(){if(this._true)return this._true;let e=this.ffi.QTS_GetTrue();return this._true=new un(e)}get false(){if(this._false)return this._false;let e=this.ffi.QTS_GetFalse();return this._false=new un(e)}get global(){if(this._global)return this._global;let e=this.ffi.QTS_GetGlobalObject(this.ctx.value);return this._global=this.memory.staticHeapValueHandle(e),this._global}newNumber(e){return this.memory.heapValueHandle(this.ffi.QTS_NewFloat64(this.ctx.value,e))}newString(e){let t=this.memory.newHeapCharPointer(e).consume(e=>this.ffi.QTS_NewString(this.ctx.value,e.value.ptr));return this.memory.heapValueHandle(t)}newUniqueSymbol(e){let t=(typeof e==`symbol`?e.description:e)??``,n=this.memory.newHeapCharPointer(t).consume(e=>this.ffi.QTS_NewSymbol(this.ctx.value,e.value.ptr,0));return this.memory.heapValueHandle(n)}newSymbolFor(e){let t=(typeof e==`symbol`?e.description:e)??``,n=this.memory.newHeapCharPointer(t).consume(e=>this.ffi.QTS_NewSymbol(this.ctx.value,e.value.ptr,1));return this.memory.heapValueHandle(n)}getWellKnownSymbol(e){return this._Symbol??=this.memory.manage(this.getProp(this.global,`Symbol`)),this.getProp(this._Symbol,e)}newBigInt(e){if(!this._BigInt){let e=this.getProp(this.global,`BigInt`);this.memory.manage(e),this._BigInt=new un(e.value,this.runtime)}let t=this._BigInt,n=String(e);return this.newString(n).consume(e=>this.unwrapResult(this.callFunction(t,this.undefined,e)))}newObject(e){e&&this.runtime.assertOwned(e);let t=e?this.ffi.QTS_NewObjectProto(this.ctx.value,e.value):this.ffi.QTS_NewObject(this.ctx.value);return this.memory.heapValueHandle(t)}newArray(){let e=this.ffi.QTS_NewArray(this.ctx.value);return this.memory.heapValueHandle(e)}newArrayBuffer(e){let t=new Uint8Array(e),n=this.memory.newHeapBufferPointer(t),r=this.ffi.QTS_NewArrayBuffer(this.ctx.value,n.value.pointer,t.length);return this.memory.heapValueHandle(r)}newPromise(e){let t=pn.withScope(e=>{let t=e.manage(this.memory.newMutablePointerArray(2)),n=this.ffi.QTS_NewPromiseCapability(this.ctx.value,t.value.ptr),r=this.memory.heapValueHandle(n),[i,a]=Array.from(t.value.typedArray).map(e=>this.memory.heapValueHandle(e));return new bn({context:this,promiseHandle:r,resolveHandle:i,rejectHandle:a})});return e&&typeof e==`function`&&(e=new Promise(e)),e&&Promise.resolve(e).then(t.resolve,e=>e instanceof ln?t.reject(e):this.newError(e).consume(t.reject)),t}newFunction(e,t){let n=typeof e==`function`?e:t;if(!n)throw TypeError(`Expected a function`);return this.newFunctionWithOptions({name:typeof e==`string`?e:void 0,length:n.length,isConstructor:!1,fn:n})}newConstructorFunction(e,t){let n=typeof e==`function`?e:t;if(!n)throw TypeError(`Expected a function`);return this.newFunctionWithOptions({name:typeof e==`string`?e:void 0,length:n.length,isConstructor:!0,fn:n})}newFunctionWithOptions(e){let{name:t,length:n,isConstructor:r,fn:i}=e,a=this.runtime.hostRefs.put(i);try{return this.memory.heapValueHandle(this.ffi.QTS_NewFunction(this.ctx.value,t??``,n,r,a))}catch(e){throw this.runtime.hostRefs.delete(a),e}}newError(e){let t=this.memory.heapValueHandle(this.ffi.QTS_NewError(this.ctx.value));return e&&typeof e==`object`?(e.name!==void 0&&this.newString(e.name).consume(e=>this.setProp(t,`name`,e)),e.message!==void 0&&this.newString(e.message).consume(e=>this.setProp(t,`message`,e))):typeof e==`string`?this.newString(e).consume(e=>this.setProp(t,`message`,e)):e!==void 0&&this.newString(String(e)).consume(e=>this.setProp(t,`message`,e)),t}newHostRef(e){let t=this.runtime.hostRefs.put(e);try{let e=this.memory.heapValueHandle(this.ffi.QTS_NewHostRef(this.ctx.value,t));return new Mn(this.runtime,e,t)}catch(e){throw this.runtime.hostRefs.delete(t),e}}toHostRef(e){let t=this.ffi.QTS_GetHostRefId(e.value);if(t!==0)return this.runtime.hostRefs.get(t),new Mn(this.runtime,e.dup(),t)}unwrapHostRef(e){let t=this.ffi.QTS_GetHostRefId(e.value);if(t===0)throw new Qt(`handle is not a HostRef`);return this.runtime.hostRefs.get(t)}typeof(e){return this.runtime.assertOwned(e),this.memory.consumeHeapCharPointer(this.ffi.QTS_Typeof(this.ctx.value,e.value))}getNumber(e){return this.runtime.assertOwned(e),this.ffi.QTS_GetFloat64(this.ctx.value,e.value)}getString(e){return this.runtime.assertOwned(e),this.memory.consumeJSCharPointer(this.ffi.QTS_GetString(this.ctx.value,e.value))}getSymbol(e){this.runtime.assertOwned(e);let t=this.memory.consumeJSCharPointer(this.ffi.QTS_GetSymbolDescriptionOrKey(this.ctx.value,e.value));return this.ffi.QTS_IsGlobalSymbol(this.ctx.value,e.value)?Symbol.for(t):Symbol(t)}getBigInt(e){this.runtime.assertOwned(e);let t=this.getString(e);return BigInt(t)}getArrayBuffer(e){this.runtime.assertOwned(e);let t=this.ffi.QTS_GetArrayBufferLength(this.ctx.value,e.value),n=this.ffi.QTS_GetArrayBuffer(this.ctx.value,e.value);if(!n)throw Error(`Couldn't allocate memory to get ArrayBuffer`);return new ln(this.module.HEAPU8.subarray(n,n+t),void 0,()=>this.module._free(n))}getPromiseState(e){this.runtime.assertOwned(e);let t=this.ffi.QTS_PromiseState(this.ctx.value,e.value);if(t<0)return{type:`fulfilled`,value:e,notAPromise:!0};if(t===It.Pending)return{type:`pending`,get error(){return new Yt(`Cannot unwrap a pending promise`)}};let n=this.ffi.QTS_PromiseResult(this.ctx.value,e.value),r=this.memory.heapValueHandle(n);if(t===It.Fulfilled)return{type:`fulfilled`,value:r};if(t===It.Rejected)return{type:`rejected`,error:r};throw r.dispose(),/* @__PURE__ */ Error(`Unknown JSPromiseStateEnum: ${t}`)}resolvePromise(e){this.runtime.assertOwned(e);let t=pn.withScope(t=>{let n=t.manage(this.getProp(this.global,`Promise`)),r=t.manage(this.getProp(n,`resolve`));return this.callFunction(r,n,e)});return t.error?Promise.resolve(t):new Promise(e=>{pn.withScope(n=>{let r=n.manage(this.newFunction(`resolve`,t=>{e(this.success(t&&t.dup()))})),i=n.manage(this.newFunction(`reject`,t=>{e(this.fail(t&&t.dup()))})),a=n.manage(t.value),o=n.manage(this.getProp(a,`then`));this.callFunction(o,a,r,i).unwrap().dispose()})})}isEqual(e,t,n=Rt.IsStrictlyEqual){if(e===t)return!0;this.runtime.assertOwned(e),this.runtime.assertOwned(t);let r=this.ffi.QTS_IsEqual(this.ctx.value,e.value,t.value,n);if(r===-1)throw new Ut(`WASM variant does not expose equality`);return!!r}eq(e,t){return this.isEqual(e,t,Rt.IsStrictlyEqual)}sameValue(e,t){return this.isEqual(e,t,Rt.IsSameValue)}sameValueZero(e,t){return this.isEqual(e,t,Rt.IsSameValueZero)}getProp(e,t){this.runtime.assertOwned(e);let n;return n=typeof t==`number`&&t>=0?this.ffi.QTS_GetPropNumber(this.ctx.value,e.value,t):this.borrowPropertyKey(t).consume(t=>this.ffi.QTS_GetProp(this.ctx.value,e.value,t.value)),this.memory.heapValueHandle(n)}getLength(e){if(this.runtime.assertOwned(e),!(this.ffi.QTS_GetLength(this.ctx.value,this.uint32Out.value.ptr,e.value)<0))return this.uint32Out.value.typedArray[0]}getOwnPropertyNames(e,t={strings:!0,numbersAsStrings:!0}){this.runtime.assertOwned(e),e.value;let n=wn(t);if(n===0)throw new Xt(`No options set, will return an empty array`);return pn.withScope(t=>{let r=t.manage(this.memory.newMutablePointerArray(1)),i=this.ffi.QTS_GetOwnPropertyNames(this.ctx.value,r.value.ptr,this.uint32Out.value.ptr,e.value,n);if(i)return this.fail(this.memory.heapValueHandle(i));let a=this.uint32Out.value.typedArray[0],o=r.value.typedArray[0],s=new Uint32Array(this.module.HEAP8.buffer,o,a),c=Array.from(s).map(e=>this.memory.heapValueHandle(e));return this.ffi.QTS_FreeVoidPointer(this.ctx.value,o),this.success(mn(c))})}getIterator(e){let t=this._SymbolIterator??=this.memory.manage(this.getWellKnownSymbol(`iterator`));return pn.withScope(n=>{let r=n.manage(this.getProp(e,t)),i=this.callFunction(r,e);return i.error?i:this.success(new En(i.value,this))})}setProp(e,t,n){this.runtime.assertOwned(e),this.borrowPropertyKey(t).consume(t=>this.ffi.QTS_SetProp(this.ctx.value,e.value,t.value,n.value))}defineProp(e,t,n){this.runtime.assertOwned(e),pn.withScope(r=>{let i=r.manage(this.borrowPropertyKey(t)),a=n.value||this.undefined,o=!!n.configurable,s=!!n.enumerable,c=!!n.value,l=n.get?r.manage(this.newFunction(n.get.name,n.get)):this.undefined,u=n.set?r.manage(this.newFunction(n.set.name,n.set)):this.undefined;this.ffi.QTS_DefineProp(this.ctx.value,e.value,i.value,a.value,l.value,u.value,o,s,c)})}callFunction(e,t,...n){this.runtime.assertOwned(e);let r,i=n[0];r=i===void 0||Array.isArray(i)?i??[]:n;let a=this.memory.toPointerArray(r).consume(n=>this.ffi.QTS_Call(this.ctx.value,e.value,t.value,r.length,n.value)),o=this.ffi.QTS_ResolveException(this.ctx.value,a);return o?(this.ffi.QTS_FreeValuePointer(this.ctx.value,a),this.fail(this.memory.heapValueHandle(o))):this.success(this.memory.heapValueHandle(a))}callMethod(e,t,n=[]){return this.getProp(e,t).consume(t=>this.callFunction(t,e,n))}evalCode(e,t=`eval.js`,n){let r=+(n===void 0),i=Cn(n),a=this.memory.newHeapCharPointer(e).consume(e=>this.ffi.QTS_Eval(this.ctx.value,e.value.ptr,e.value.strlen,t,r,i)),o=this.ffi.QTS_ResolveException(this.ctx.value,a);return o?(this.ffi.QTS_FreeValuePointer(this.ctx.value,a),this.fail(this.memory.heapValueHandle(o))):this.success(this.memory.heapValueHandle(a))}throw(e){return this.errorToHandle(e).consume(e=>this.ffi.QTS_Throw(this.ctx.value,e.value))}borrowPropertyKey(e){return typeof e==`number`?this.newNumber(e):typeof e==`string`?this.newString(e):new un(e.value,this.runtime)}getMemory(e){if(e===this.rt.value)return this.memory;throw Error(`Private API. Cannot get memory from a different runtime`)}dump(e){this.runtime.assertOwned(e);let t=this.typeof(e);if(t===`string`)return this.getString(e);if(t===`number`)return this.getNumber(e);if(t===`bigint`)return this.getBigInt(e);if(t===`undefined`)return;if(t===`symbol`)return this.getSymbol(e);let n=this.getPromiseState(e);if(n.type===`fulfilled`&&!n.notAPromise)return e.dispose(),{type:n.type,value:n.value.consume(this.dump)};if(n.type===`pending`)return e.dispose(),{type:n.type};if(n.type===`rejected`)return e.dispose(),{type:n.type,error:n.error.consume(this.dump)};let r=this.memory.consumeJSCharPointer(this.ffi.QTS_Dump(this.ctx.value,e.value));try{return JSON.parse(r)}catch{return r}}unwrapResult(e){if(e.error){let t=`context`in e.error?e.error.context:this,n=e.error.consume(e=>this.dump(e));if(n&&typeof n==`object`&&typeof n.message==`string`){let{message:e,name:r,stack:i,...a}=n,o=new Bt(n,t);typeof r==`string`&&(o.name=n.name),o.message=e;let s=o.stack;throw typeof i==`string`&&(o.stack=`${r}: ${e}
|
|
8
8
|
${n.stack}Host: ${s}`),Object.assign(o,a),o}throw new Bt(n)}return e.value}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.alive?`${this.constructor.name} { ctx: ${this.ctx.value} rt: ${this.rt.value} }`:`${this.constructor.name} { disposed }`}getFunction(e){let t=this.runtime.hostRefs.get(e);if(typeof t!=`function`)throw Error(`Host reference ${e} is not a function`);return t}errorToHandle(e){return e instanceof ln?e:this.newError(e)}encodeBinaryJSON(e){let t=this.ffi.QTS_bjson_encode(this.ctx.value,e.value);return this.memory.heapValueHandle(t)}decodeBinaryJSON(e){let t=this.ffi.QTS_bjson_decode(this.ctx.value,e.value);return this.memory.heapValueHandle(t)}success(e){return yn.success(e)}fail(e){return yn.fail(e,e=>this.unwrapResult(e))}},Fn=class extends on{constructor(e){super(),this.scope=new pn,this.contextMap=/* @__PURE__ */ new Map,this.hostRefs=new jn,this._debugMode=!1,this.cToHostCallbacks={freeHostRef:(e,t)=>{if(e!==this.rt.value)throw Error(`Runtime pointer mismatch`);this.hostRefs.delete(t)},shouldInterrupt:e=>{if(e!==this.rt.value)throw Error(`QuickJSContext instance received C -> JS interrupt with mismatched rt`);let t=this.interruptHandler;if(!t)throw Error(`QuickJSContext had no interrupt handler`);return+!!t(this)},loadModuleSource:nn(this,function*(e,t,n,r){let i=this.moduleLoader;if(!i)throw Error(`Runtime has no module loader`);if(t!==this.rt.value)throw Error(`Runtime pointer mismatch`);let a=this.contextMap.get(n)??this.newContext({contextPointer:n});try{let t=yield*e(i(r,a));if(typeof t==`object`&&`error`in t&&t.error)throw this.debugLog(`cToHostLoadModule: loader returned error`,t.error),t.error;let n=typeof t==`string`?t:`value`in t?t.value:t;return this.memory.newHeapCharPointer(n).value.ptr}catch(e){return this.debugLog(`cToHostLoadModule: caught error`,e),a.throw(e),0}}),normalizeModule:nn(this,function*(e,t,n,r,i){let a=this.moduleNormalizer;if(!a)throw Error(`Runtime has no module normalizer`);if(t!==this.rt.value)throw Error(`Runtime pointer mismatch`);let o=this.contextMap.get(n)??this.newContext({contextPointer:n});try{let t=yield*e(a(r,i,o));if(typeof t==`object`&&`error`in t&&t.error)throw this.debugLog(`cToHostNormalizeModule: normalizer returned error`,t.error),t.error;let n=typeof t==`string`?t:t.value;return o.getMemory(this.rt.value).newHeapCharPointer(n).value.ptr}catch(e){return this.debugLog(`normalizeModule: caught error`,e),o.throw(e),0}})},e.ownedLifetimes?.forEach(e=>this.scope.manage(e)),this.module=e.module,this.memory=new xn(this.module),this.ffi=e.ffi,this.rt=e.rt,this.callbacks=e.callbacks,this.scope.manage(this.rt),this.callbacks.setRuntimeCallbacks(this.rt.value,this.cToHostCallbacks),this.executePendingJobs=this.executePendingJobs.bind(this)}get alive(){return this.scope.alive}dispose(){return this.scope.dispose()}newContext(e={}){let t=Sn(e.intrinsics),n=new ln(e.contextPointer||this.ffi.QTS_NewContext(this.rt.value,t),void 0,e=>{this.contextMap.delete(e),this.callbacks.deleteContext(e),this.ffi.QTS_FreeContext(e)}),r=new Pn({module:this.module,ctx:n,ffi:this.ffi,rt:this.rt,ownedLifetimes:e.ownedLifetimes,runtime:this,callbacks:this.callbacks});return this.contextMap.set(n.value,r),r}setModuleLoader(e,t){this.moduleLoader=e,this.moduleNormalizer=t,this.ffi.QTS_RuntimeEnableModuleLoader(this.rt.value,+!!this.moduleNormalizer)}removeModuleLoader(){this.moduleLoader=void 0,this.ffi.QTS_RuntimeDisableModuleLoader(this.rt.value)}hasPendingJob(){return!!this.ffi.QTS_IsJobPending(this.rt.value)}setInterruptHandler(e){let t=this.interruptHandler;this.interruptHandler=e,t||this.ffi.QTS_RuntimeEnableInterruptHandler(this.rt.value)}removeInterruptHandler(){this.interruptHandler&&=(this.ffi.QTS_RuntimeDisableInterruptHandler(this.rt.value),void 0)}executePendingJobs(e=-1){let t=this.memory.newMutablePointerArray(1),n=this.ffi.QTS_ExecutePendingJob(this.rt.value,e??-1,t.value.ptr),r=t.value.typedArray[0];if(t.dispose(),r===0)return this.ffi.QTS_FreeValuePointerRuntime(this.rt.value,n),yn.success(0);let i=this.contextMap.get(r)??this.newContext({contextPointer:r}),a=i.getMemory(this.rt.value).heapValueHandle(n);if(i.typeof(a)===`number`){let e=i.getNumber(a);return a.dispose(),yn.success(e)}{let e=Object.assign(a,{context:i});return yn.fail(e,e=>i.unwrapResult(e))}}setMemoryLimit(e){if(e<0&&e!==-1)throw Error(`Cannot set memory limit to negative number. To unset, pass -1`);this.ffi.QTS_RuntimeSetMemoryLimit(this.rt.value,e)}computeMemoryUsage(){let e=this.getSystemContext().getMemory(this.rt.value);return e.heapValueHandle(this.ffi.QTS_RuntimeComputeMemoryUsage(this.rt.value,e.ctx.value))}dumpMemoryUsage(){return this.memory.consumeHeapCharPointer(this.ffi.QTS_RuntimeDumpMemoryUsage(this.rt.value))}setMaxStackSize(e){if(e<0)throw Error(`Cannot set memory limit to negative number. To unset, pass 0.`);this.ffi.QTS_RuntimeSetMaxStackSize(this.rt.value,e)}assertOwned(e){if(e.owner&&e.owner.rt!==this.rt)throw new Vt(`Handle is not owned by this runtime: ${e.owner.rt.value} != ${this.rt.value}`)}setDebugMode(e){this._debugMode=e,this.ffi.DEBUG&&this.rt.alive&&this.ffi.QTS_SetDebugLogEnabled(this.rt.value,+!!e)}isDebugMode(){return this._debugMode}debugLog(...e){this._debugMode&&console.log(`quickjs-emscripten:`,...e)}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.alive?`${this.constructor.name} { rt: ${this.rt.value} }`:`${this.constructor.name} { disposed }`}getSystemContext(){return this.context||=this.scope.manage(this.newContext()),this.context}},In=class{constructor(e){this.freeHostRef=e.freeHostRef,this.callFunction=e.callFunction,this.shouldInterrupt=e.shouldInterrupt,this.loadModuleSource=e.loadModuleSource,this.normalizeModule=e.normalizeModule}},Ln=class{constructor(e){this.contextCallbacks=/* @__PURE__ */ new Map,this.runtimeCallbacks=/* @__PURE__ */ new Map,this.suspendedCount=0,this.cToHostCallbacks=new In({freeHostRef:(e,t,n)=>{let r=this.runtimeCallbacks.get(t);if(!r)throw Error(`QuickJSRuntime(rt = ${t}) not found when trying to free HostRef(id = ${n})`);r.freeHostRef(t,n)},callFunction:(e,t,n,r,i,a)=>this.handleAsyncify(e,()=>{try{let e=this.contextCallbacks.get(t);if(!e)throw Error(`QuickJSContext(ctx = ${t}) not found for C function call "${a}"`);return e.callFunction(t,n,r,i,a)}catch(e){return console.error(`[C to host error: returning null]`,e),0}}),shouldInterrupt:(e,t)=>this.handleAsyncify(e,()=>{try{let e=this.runtimeCallbacks.get(t);if(!e)throw Error(`QuickJSRuntime(rt = ${t}) not found for C interrupt`);return e.shouldInterrupt(t)}catch(e){return console.error(`[C to host interrupt: returning error]`,e),1}}),loadModuleSource:(e,t,n,r)=>this.handleAsyncify(e,()=>{try{let e=this.runtimeCallbacks.get(t);if(!e)throw Error(`QuickJSRuntime(rt = ${t}) not found for C module loader`);let i=e.loadModuleSource;if(!i)throw Error(`QuickJSRuntime(rt = ${t}) does not support module loading`);return i(t,n,r)}catch(e){return console.error(`[C to host module loader error: returning null]`,e),0}}),normalizeModule:(e,t,n,r,i)=>this.handleAsyncify(e,()=>{try{let e=this.runtimeCallbacks.get(t);if(!e)throw Error(`QuickJSRuntime(rt = ${t}) not found for C module loader`);let a=e.normalizeModule;if(!a)throw Error(`QuickJSRuntime(rt = ${t}) does not support module loading`);return a(t,n,r,i)}catch(e){return console.error(`[C to host module loader error: returning null]`,e),0}})}),this.module=e,this.module.callbacks=this.cToHostCallbacks}setRuntimeCallbacks(e,t){this.runtimeCallbacks.set(e,t)}deleteRuntime(e){this.runtimeCallbacks.delete(e)}setContextCallbacks(e,t){this.contextCallbacks.set(e,t)}deleteContext(e){this.contextCallbacks.delete(e)}handleAsyncify(e,t){if(e)return e.handleSleep(e=>{try{let n=t();if(!(n instanceof Promise)){e(n);return}if(this.suspended)throw new Wt(`Already suspended at: ${this.suspended.stack}
|
|
9
|
-
Attempted to suspend at:`);this.suspended=new Gt(`(${this.suspendedCount++})`),this.suspended,n.then(t=>{this.suspended=void 0,e(t)},e=>{console.error(`QuickJS: cannot handle error in suspended function`,e),this.suspended=void 0})}catch(e){throw this.suspended=void 0,e}});let n=t();if(n instanceof Promise)throw Error(`Promise return value not supported in non-asyncify context.`);return n}};function Rn(e,t){t.interruptHandler&&e.setInterruptHandler(t.interruptHandler),t.maxStackSizeBytes!==void 0&&e.setMaxStackSize(t.maxStackSizeBytes),t.memoryLimitBytes!==void 0&&e.setMemoryLimit(t.memoryLimitBytes)}function zn(e,t){t.moduleLoader&&e.setModuleLoader(t.moduleLoader),t.shouldInterrupt&&e.setInterruptHandler(t.shouldInterrupt),t.memoryLimitBytes!==void 0&&e.setMemoryLimit(t.memoryLimitBytes),t.maxStackSizeBytes!==void 0&&e.setMaxStackSize(t.maxStackSizeBytes)}var Bn=class{constructor(e,t){this.module=e,this.ffi=t,this.callbacks=new Ln(e)}newRuntime(e={}){let t=new ln(this.ffi.QTS_NewRuntime(),void 0,e=>{this.ffi.QTS_FreeRuntime(e),this.callbacks.deleteRuntime(e)}),n=new Fn({module:this.module,callbacks:this.callbacks,ffi:this.ffi,rt:t});return Rn(n,e),e.moduleLoader&&n.setModuleLoader(e.moduleLoader),n}newContext(e={}){let t=this.newRuntime(),n=t.newContext({...e,ownedLifetimes:Tn(t,e.ownedLifetimes)});return t.context=n,n}evalCode(e,t={}){return pn.withScope(n=>{let r=n.manage(this.newContext());zn(r.runtime,t);let i=r.evalCode(e,`eval.js`);if(t.memoryLimitBytes!==void 0&&r.runtime.setMemoryLimit(-1),i.error)throw r.dump(n.manage(i.error));return r.dump(n.manage(i.value))})}getWasmMemory(){let e=this.module.quickjsEmscriptenInit?.(()=>{})?.getWasmMemory?.();if(!e)throw Error(`Variant does not support getting WebAssembly.Memory`);return e}getFFI(){return this.ffi}};async function Vn(e){let t=Hn(await e),[n,r,{QuickJSWASMModule:i}]=await Promise.all([t.importModuleLoader().then(Hn),t.importFFI(),import(`./module-ES6BEMUI-CruD6PV8.js`).then(Hn)]),a=await n();return a.type=`sync`,new i(a,new r(a))}function Hn(e){return e&&`default`in e&&e.default?e.default&&`default`in e.default&&e.default.default?e.default.default:e.default:e}function Un(e,t){return{...e,async importModuleLoader(){let n=Hn(await e.importModuleLoader());return async function(){let e=t.emscriptenModule?{...t.emscriptenModule}:{},r=t.log??((...e)=>([...e],void 0)),i=(e,t)=>(r(...e,t),t),a=e=>typeof e==`function`?e():e;(t.wasmLocation||t.wasmSourceMapLocation||t.locateFile)&&(e.locateFile=(e,n)=>{let r={fileName:e,relativeTo:n};if(e.endsWith(`.wasm`)&&t.wasmLocation!==void 0)return i([`locateFile .wasm: provide wasmLocation`,r],t.wasmLocation);if(e.endsWith(`.map`)){if(t.wasmSourceMapLocation!==void 0)return i([`locateFile .map: provide wasmSourceMapLocation`,r],t.wasmSourceMapLocation);if(t.wasmLocation&&!t.locateFile)return i([`locateFile .map: infer from wasmLocation`,r],t.wasmLocation+`.map`)}return t.locateFile?i([`locateFile: use provided fn`,r],t.locateFile(e,n)):i([`locateFile: unhandled, passthrough`,r],e)}),t.wasmBinary&&(e.wasmBinary=await a(t.wasmBinary)),t.wasmMemory&&(e.wasmMemory=await a(t.wasmMemory));let o=t.wasmModule,s;o&&(e.instantiateWasm=async(e,t)=>{s??=Promise.resolve(a(o));let n=await s;if(!n)throw new qt(`options.wasmModule returned ${String(n)}`);let r=await WebAssembly.instantiate(n,e);return t(r),r.exports}),e.monitorRunDependencies=e=>{r(`monitorRunDependencies:`,e)},e.quickjsEmscriptenInit=()=>Wn(r);let c=n(e),l=e.quickjsEmscriptenInit?.(r);if(o&&l?.receiveWasmOffsetConverter&&!l.existingWasmOffsetConverter){let e=await a(t.wasmBinary)??/* @__PURE__ */ new ArrayBuffer(0);s??=Promise.resolve(a(o));let n=await s;if(!n)throw new qt(`options.wasmModule returned ${String(n)}`);l.receiveWasmOffsetConverter(e,n)}if(l?.receiveSourceMapJSON){let e=await a(t.wasmSourceMapData);typeof e==`string`?l.receiveSourceMapJSON(JSON.parse(e)):e?l.receiveSourceMapJSON(e):l.receiveSourceMapJSON({version:3,names:[],sources:[],mappings:``})}return c}}}}function Wn(e){let t=`mock called, emscripten module may not be initialized yet`;return{mock:!0,removeRunDependency(n){e(`${t}: removeRunDependency called:`,n)},receiveSourceMapJSON(n){e(`${t}: receiveSourceMapJSON called:`,n)},WasmOffsetConverter:void 0,receiveWasmOffsetConverter(n,r){e(`${t}: receiveWasmOffsetConverter called:`,n,r)}}}function Gn(e){return[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function Kn(e,t,n,r){let i=e.length+1+n,a=Math.ceil(i/t)*t,o=new Uint8Array(a);o.set(e),o[e.length]=128;let s=new DataView(o.buffer),c=BigInt(e.length)*8n;return r?s.setBigUint64(a-8,c,!0):s.setBigUint64(a-8,c,!1),o}const qn=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21],Jn=Array.from({length:64},(e,t)=>Math.floor(Math.abs(Math.sin(t+1))*2**32)>>>0);function Yn(e){let t=Kn(e,64,8,!0),n=new DataView(t.buffer),r=1732584193,i=4023233417,a=2562383102,o=271733878;for(let e=0;e<t.length;e+=64){let t=r,s=i,c=a,l=o;for(let r=0;r<64;r++){let i,a;r<16?(i=s&c|~s&l,a=r):r<32?(i=l&s|~l&c,a=(5*r+1)%16):r<48?(i=s^c^l,a=(3*r+5)%16):(i=c^(s|~l),a=7*r%16);let o=qn[(r>>4)*4+r%4],u=t+i+Jn[r]+n.getUint32(e+a*4,!0)>>>0;t=l,l=c,c=s,s=s+(u<<o|u>>>32-o)>>>0}r=r+t>>>0,i=i+s>>>0,a=a+c>>>0,o=o+l>>>0}let s=/* @__PURE__ */ new Uint8Array(16),c=new DataView(s.buffer);return[r,i,a,o].forEach((e,t)=>c.setUint32(t*4,e,!0)),Gn(s)}function Xn(e,t){return(e<<t|e>>>32-t)>>>0}function Zn(e){let t=Kn(e,64,8,!1),n=new DataView(t.buffer),r=[1732584193,4023233417,2562383102,271733878,3285377520],i=/* @__PURE__ */ new Uint32Array(80);for(let e=0;e<t.length;e+=64){for(let t=0;t<16;t++)i[t]=n.getUint32(e+t*4);for(let e=16;e<80;e++)i[e]=Xn(i[e-3]^i[e-8]^i[e-14]^i[e-16],1);let[t,a,o,s,c]=r;for(let e=0;e<80;e++){let n,r;e<20?(n=a&o|~a&s,r=1518500249):e<40?(n=a^o^s,r=1859775393):e<60?(n=a&o|a&s|o&s,r=2400959708):(n=a^o^s,r=3395469782);let l=Xn(t,5)+n+c+r+i[e]>>>0;c=s,s=o,o=Xn(a,30),a=t,t=l}r[0]=r[0]+t>>>0,r[1]=r[1]+a>>>0,r[2]=r[2]+o>>>0,r[3]=r[3]+s>>>0,r[4]=r[4]+c>>>0}return r.map(e=>e.toString(16).padStart(8,`0`)).join(``)}const Qn=/* @__PURE__ */ new Uint32Array(64),$n=[];{let e=[];for(let t=2;e.length<80;t++)e.every(e=>t%e!==0)&&e.push(t);e.forEach((e,t)=>{let n=er(e,3);t<64&&(Qn[t]=Number(n>>32n)),$n.push(n)})}function er(e,t){let n=BigInt(e)<<BigInt(64*t),r=0n,i=1n<<70n;for(;r<i;){let e=r+i+1n>>1n;e**BigInt(t)<=n?r=e:i=e-1n}return r&(1n<<64n)-1n}function tr(e,t){return(e>>>t|e<<32-t)>>>0}function nr(e,t,n){let r=Kn(e,64,8,!1),i=new DataView(r.buffer),a=[...t],o=/* @__PURE__ */ new Uint32Array(64);for(let e=0;e<r.length;e+=64){for(let t=0;t<16;t++)o[t]=i.getUint32(e+t*4);for(let e=16;e<64;e++){let t=tr(o[e-15],7)^tr(o[e-15],18)^o[e-15]>>>3,n=tr(o[e-2],17)^tr(o[e-2],19)^o[e-2]>>>10;o[e]=o[e-16]+t+o[e-7]+n>>>0}let[t,n,r,s,c,l,u,d]=a;for(let e=0;e<64;e++){let i=tr(c,6)^tr(c,11)^tr(c,25),a=c&l^~c&u,f=d+i+a+Qn[e]+o[e]>>>0,p=(tr(t,2)^tr(t,13)^tr(t,22))+(t&n^t&r^n&r)>>>0;d=u,u=l,l=c,c=s+f>>>0,s=r,r=n,n=t,t=f+p>>>0}[t,n,r,s,c,l,u,d].forEach((e,t)=>a[t]=a[t]+e>>>0)}return a.slice(0,n).map(e=>e.toString(16).padStart(8,`0`)).join(``)}const rr=(1n<<64n)-1n;function ir(e,t){return(e>>t|e<<64n-t)&rr}function ar(e,t,n){let r=Kn(e,128,16,!1),i=new DataView(r.buffer),a=[...t],o=Array(80);for(let e=0;e<r.length;e+=128){for(let t=0;t<16;t++)o[t]=i.getBigUint64(e+t*8);for(let e=16;e<80;e++){let t=ir(o[e-15],1n)^ir(o[e-15],8n)^o[e-15]>>7n,n=ir(o[e-2],19n)^ir(o[e-2],61n)^o[e-2]>>6n;o[e]=o[e-16]+t+o[e-7]+n&rr}let[t,n,r,s,c,l,u,d]=a;for(let e=0;e<80;e++){let i=ir(c,14n)^ir(c,18n)^ir(c,41n),a=c&l^~c&rr&u,f=d+i+a+$n[e]+o[e]&rr,p=(ir(t,28n)^ir(t,34n)^ir(t,39n))+(t&n^t&r^n&r)&rr;d=u,u=l,l=c,c=s+f&rr,s=r,r=n,n=t,t=f+p&rr}[t,n,r,s,c,l,u,d].forEach((e,t)=>a[t]=a[t]+e&rr)}return a.map(e=>e.toString(16).padStart(16,`0`)).join(``).slice(0,n*16)}const or=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],sr=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],cr=[7640891576956012808n,13503953896175478587n,4354685564936845355n,11912009170470909681n,5840696475078001361n,11170449401992604703n,2270897969802886507n,6620516959819538809n],lr=[14680500436340154072n,7105036623409894663n,10473403895298186519n,1526699215303891257n,7436329637833083697n,10282925794625328401n,15784041429090275239n,5167115440072839076n];function ur(e,t){switch(t){case 224:return nr(e,sr,7);case 0:case 256:return nr(e,or,8);case 384:return ar(e,lr,6);case 512:return ar(e,cr,8);default:return}}const dr=Array.from({length:256},(e,t)=>{let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;return n>>>0});function fr(e){let t=4294967295;for(let n of e)t=dr[(t^n)&255]^t>>>8;return(t^4294967295)>>>0}function C(e){let t=e.replace(/^[\t-\r ]+|[\t-\r ]+$/g,``).replaceAll(`\\`,`/`),n=/^[A-Za-z]:/.exec(t)?.[0]??``,r=t.slice(n.length),i=r.startsWith(`//`)?`//`:r.startsWith(`/`)?`/`:``,a=[],o=0;for(let e of r.slice(i.length).split(`/`))e!==``&&e!==`.`&&(e===`..`&&o>0?(a.pop(),o--):e===`..`?a.push(e):(a.push(e),o++));return n+i+a.join(`/`)}function pr(e,t,n){if(n===``)return{files:[],found:!0};if(n.startsWith(`@`))return{files:[n],found:!0};let r=C(t),i={found:!0},a=[];return mr(e,`${r}/${n}`,i,a),{files:[...new Set(a)].filter(e=>e.length>=r.length+1).map(e=>e.slice(r.length+1)).sort(p),found:i.found}}function mr(e,t,n,r){let i=C(t),a=i.indexOf(`*`),o=_r(a===-1?i:i.slice(0,a)),s=a===-1?-1:i.indexOf(`/`,a),c=s===-1?``:i.slice(s+1);if(a!==-1&&i[a+1]===`*`&&(a===0||i[a-1]===`/`)){for(let t of[1,2])mr(e,i.slice(0,a)+i.slice(a+t),n,r);for(let{name:t,directory:s}of hr(e,i.slice(0,a+1),n))s&&mr(e,`${o}/${t}/${i.slice(a)}`,n,r)}else for(let{name:t,directory:a}of hr(e,s===-1?i:i.slice(0,s-1),n)){if(s!==-1&&!a)continue;let i=`${o}/${t}`;c===``?a||r.push(i):mr(e,`${i}/${c}`,n,r)}}function hr(e,t,n){let r=t.lastIndexOf(`/`),i=r===-1?t:t.slice(0,r),a=t.slice(r+1),o=e.list(i),s=gr(a);if(s===void 0)return[];let c=o===void 0?[]:o.filter(e=>e.name!==`.`&&e.name!==`..`&&s.test(e.name));return n.found&&=(o===void 0?s.test(``):c.length>0)||(a.startsWith(`*`)||a.startsWith(`.`))&&o!==void 0,c}function gr(e){let t=``;for(let n of e)n===`?`?t+=`.`:n===`*`?t+=`.*`:`\\^.$|()[]+/`.includes(n)?t+=`\\${n}`:t+=n;try{return RegExp(`^${t}$`)}catch{return}}function _r(e){let t=e.lastIndexOf(`/`);return t===-1?`.`:e.slice(0,t)}var vr=`/*
|
|
9
|
+
Attempted to suspend at:`);this.suspended=new Gt(`(${this.suspendedCount++})`),this.suspended,n.then(t=>{this.suspended=void 0,e(t)},e=>{console.error(`QuickJS: cannot handle error in suspended function`,e),this.suspended=void 0})}catch(e){throw this.suspended=void 0,e}});let n=t();if(n instanceof Promise)throw Error(`Promise return value not supported in non-asyncify context.`);return n}};function Rn(e,t){t.interruptHandler&&e.setInterruptHandler(t.interruptHandler),t.maxStackSizeBytes!==void 0&&e.setMaxStackSize(t.maxStackSizeBytes),t.memoryLimitBytes!==void 0&&e.setMemoryLimit(t.memoryLimitBytes)}function zn(e,t){t.moduleLoader&&e.setModuleLoader(t.moduleLoader),t.shouldInterrupt&&e.setInterruptHandler(t.shouldInterrupt),t.memoryLimitBytes!==void 0&&e.setMemoryLimit(t.memoryLimitBytes),t.maxStackSizeBytes!==void 0&&e.setMaxStackSize(t.maxStackSizeBytes)}var Bn=class{constructor(e,t){this.module=e,this.ffi=t,this.callbacks=new Ln(e)}newRuntime(e={}){let t=new ln(this.ffi.QTS_NewRuntime(),void 0,e=>{this.ffi.QTS_FreeRuntime(e),this.callbacks.deleteRuntime(e)}),n=new Fn({module:this.module,callbacks:this.callbacks,ffi:this.ffi,rt:t});return Rn(n,e),e.moduleLoader&&n.setModuleLoader(e.moduleLoader),n}newContext(e={}){let t=this.newRuntime(),n=t.newContext({...e,ownedLifetimes:Tn(t,e.ownedLifetimes)});return t.context=n,n}evalCode(e,t={}){return pn.withScope(n=>{let r=n.manage(this.newContext());zn(r.runtime,t);let i=r.evalCode(e,`eval.js`);if(t.memoryLimitBytes!==void 0&&r.runtime.setMemoryLimit(-1),i.error)throw r.dump(n.manage(i.error));return r.dump(n.manage(i.value))})}getWasmMemory(){let e=this.module.quickjsEmscriptenInit?.(()=>{})?.getWasmMemory?.();if(!e)throw Error(`Variant does not support getting WebAssembly.Memory`);return e}getFFI(){return this.ffi}};async function Vn(e){let t=Hn(await e),[n,r,{QuickJSWASMModule:i}]=await Promise.all([t.importModuleLoader().then(Hn),t.importFFI(),import(`./module-ES6BEMUI-B3C8EMJw.js`).then(Hn)]),a=await n();return a.type=`sync`,new i(a,new r(a))}function Hn(e){return e&&`default`in e&&e.default?e.default&&`default`in e.default&&e.default.default?e.default.default:e.default:e}function Un(e,t){return{...e,async importModuleLoader(){let n=Hn(await e.importModuleLoader());return async function(){let e=t.emscriptenModule?{...t.emscriptenModule}:{},r=t.log??((...e)=>([...e],void 0)),i=(e,t)=>(r(...e,t),t),a=e=>typeof e==`function`?e():e;(t.wasmLocation||t.wasmSourceMapLocation||t.locateFile)&&(e.locateFile=(e,n)=>{let r={fileName:e,relativeTo:n};if(e.endsWith(`.wasm`)&&t.wasmLocation!==void 0)return i([`locateFile .wasm: provide wasmLocation`,r],t.wasmLocation);if(e.endsWith(`.map`)){if(t.wasmSourceMapLocation!==void 0)return i([`locateFile .map: provide wasmSourceMapLocation`,r],t.wasmSourceMapLocation);if(t.wasmLocation&&!t.locateFile)return i([`locateFile .map: infer from wasmLocation`,r],t.wasmLocation+`.map`)}return t.locateFile?i([`locateFile: use provided fn`,r],t.locateFile(e,n)):i([`locateFile: unhandled, passthrough`,r],e)}),t.wasmBinary&&(e.wasmBinary=await a(t.wasmBinary)),t.wasmMemory&&(e.wasmMemory=await a(t.wasmMemory));let o=t.wasmModule,s;o&&(e.instantiateWasm=async(e,t)=>{s??=Promise.resolve(a(o));let n=await s;if(!n)throw new qt(`options.wasmModule returned ${String(n)}`);let r=await WebAssembly.instantiate(n,e);return t(r),r.exports}),e.monitorRunDependencies=e=>{r(`monitorRunDependencies:`,e)},e.quickjsEmscriptenInit=()=>Wn(r);let c=n(e),l=e.quickjsEmscriptenInit?.(r);if(o&&l?.receiveWasmOffsetConverter&&!l.existingWasmOffsetConverter){let e=await a(t.wasmBinary)??/* @__PURE__ */ new ArrayBuffer(0);s??=Promise.resolve(a(o));let n=await s;if(!n)throw new qt(`options.wasmModule returned ${String(n)}`);l.receiveWasmOffsetConverter(e,n)}if(l?.receiveSourceMapJSON){let e=await a(t.wasmSourceMapData);typeof e==`string`?l.receiveSourceMapJSON(JSON.parse(e)):e?l.receiveSourceMapJSON(e):l.receiveSourceMapJSON({version:3,names:[],sources:[],mappings:``})}return c}}}}function Wn(e){let t=`mock called, emscripten module may not be initialized yet`;return{mock:!0,removeRunDependency(n){e(`${t}: removeRunDependency called:`,n)},receiveSourceMapJSON(n){e(`${t}: receiveSourceMapJSON called:`,n)},WasmOffsetConverter:void 0,receiveWasmOffsetConverter(n,r){e(`${t}: receiveWasmOffsetConverter called:`,n,r)}}}function Gn(e){return[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function Kn(e,t,n,r){let i=e.length+1+n,a=Math.ceil(i/t)*t,o=new Uint8Array(a);o.set(e),o[e.length]=128;let s=new DataView(o.buffer),c=BigInt(e.length)*8n;return r?s.setBigUint64(a-8,c,!0):s.setBigUint64(a-8,c,!1),o}const qn=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21],Jn=Array.from({length:64},(e,t)=>Math.floor(Math.abs(Math.sin(t+1))*2**32)>>>0);function Yn(e){let t=Kn(e,64,8,!0),n=new DataView(t.buffer),r=1732584193,i=4023233417,a=2562383102,o=271733878;for(let e=0;e<t.length;e+=64){let t=r,s=i,c=a,l=o;for(let r=0;r<64;r++){let i,a;r<16?(i=s&c|~s&l,a=r):r<32?(i=l&s|~l&c,a=(5*r+1)%16):r<48?(i=s^c^l,a=(3*r+5)%16):(i=c^(s|~l),a=7*r%16);let o=qn[(r>>4)*4+r%4],u=t+i+Jn[r]+n.getUint32(e+a*4,!0)>>>0;t=l,l=c,c=s,s=s+(u<<o|u>>>32-o)>>>0}r=r+t>>>0,i=i+s>>>0,a=a+c>>>0,o=o+l>>>0}let s=/* @__PURE__ */ new Uint8Array(16),c=new DataView(s.buffer);return[r,i,a,o].forEach((e,t)=>c.setUint32(t*4,e,!0)),Gn(s)}function Xn(e,t){return(e<<t|e>>>32-t)>>>0}function Zn(e){let t=Kn(e,64,8,!1),n=new DataView(t.buffer),r=[1732584193,4023233417,2562383102,271733878,3285377520],i=/* @__PURE__ */ new Uint32Array(80);for(let e=0;e<t.length;e+=64){for(let t=0;t<16;t++)i[t]=n.getUint32(e+t*4);for(let e=16;e<80;e++)i[e]=Xn(i[e-3]^i[e-8]^i[e-14]^i[e-16],1);let[t,a,o,s,c]=r;for(let e=0;e<80;e++){let n,r;e<20?(n=a&o|~a&s,r=1518500249):e<40?(n=a^o^s,r=1859775393):e<60?(n=a&o|a&s|o&s,r=2400959708):(n=a^o^s,r=3395469782);let l=Xn(t,5)+n+c+r+i[e]>>>0;c=s,s=o,o=Xn(a,30),a=t,t=l}r[0]=r[0]+t>>>0,r[1]=r[1]+a>>>0,r[2]=r[2]+o>>>0,r[3]=r[3]+s>>>0,r[4]=r[4]+c>>>0}return r.map(e=>e.toString(16).padStart(8,`0`)).join(``)}const Qn=/* @__PURE__ */ new Uint32Array(64),$n=[];{let e=[];for(let t=2;e.length<80;t++)e.every(e=>t%e!==0)&&e.push(t);e.forEach((e,t)=>{let n=er(e,3);t<64&&(Qn[t]=Number(n>>32n)),$n.push(n)})}function er(e,t){let n=BigInt(e)<<BigInt(64*t),r=0n,i=1n<<70n;for(;r<i;){let e=r+i+1n>>1n;e**BigInt(t)<=n?r=e:i=e-1n}return r&(1n<<64n)-1n}function tr(e,t){return(e>>>t|e<<32-t)>>>0}function nr(e,t,n){let r=Kn(e,64,8,!1),i=new DataView(r.buffer),a=[...t],o=/* @__PURE__ */ new Uint32Array(64);for(let e=0;e<r.length;e+=64){for(let t=0;t<16;t++)o[t]=i.getUint32(e+t*4);for(let e=16;e<64;e++){let t=tr(o[e-15],7)^tr(o[e-15],18)^o[e-15]>>>3,n=tr(o[e-2],17)^tr(o[e-2],19)^o[e-2]>>>10;o[e]=o[e-16]+t+o[e-7]+n>>>0}let[t,n,r,s,c,l,u,d]=a;for(let e=0;e<64;e++){let i=tr(c,6)^tr(c,11)^tr(c,25),a=c&l^~c&u,f=d+i+a+Qn[e]+o[e]>>>0,p=(tr(t,2)^tr(t,13)^tr(t,22))+(t&n^t&r^n&r)>>>0;d=u,u=l,l=c,c=s+f>>>0,s=r,r=n,n=t,t=f+p>>>0}[t,n,r,s,c,l,u,d].forEach((e,t)=>a[t]=a[t]+e>>>0)}return a.slice(0,n).map(e=>e.toString(16).padStart(8,`0`)).join(``)}const rr=(1n<<64n)-1n;function ir(e,t){return(e>>t|e<<64n-t)&rr}function ar(e,t,n){let r=Kn(e,128,16,!1),i=new DataView(r.buffer),a=[...t],o=Array(80);for(let e=0;e<r.length;e+=128){for(let t=0;t<16;t++)o[t]=i.getBigUint64(e+t*8);for(let e=16;e<80;e++){let t=ir(o[e-15],1n)^ir(o[e-15],8n)^o[e-15]>>7n,n=ir(o[e-2],19n)^ir(o[e-2],61n)^o[e-2]>>6n;o[e]=o[e-16]+t+o[e-7]+n&rr}let[t,n,r,s,c,l,u,d]=a;for(let e=0;e<80;e++){let i=ir(c,14n)^ir(c,18n)^ir(c,41n),a=c&l^~c&rr&u,f=d+i+a+$n[e]+o[e]&rr,p=(ir(t,28n)^ir(t,34n)^ir(t,39n))+(t&n^t&r^n&r)&rr;d=u,u=l,l=c,c=s+f&rr,s=r,r=n,n=t,t=f+p&rr}[t,n,r,s,c,l,u,d].forEach((e,t)=>a[t]=a[t]+e&rr)}return a.map(e=>e.toString(16).padStart(16,`0`)).join(``).slice(0,n*16)}const or=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],sr=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],cr=[7640891576956012808n,13503953896175478587n,4354685564936845355n,11912009170470909681n,5840696475078001361n,11170449401992604703n,2270897969802886507n,6620516959819538809n],lr=[14680500436340154072n,7105036623409894663n,10473403895298186519n,1526699215303891257n,7436329637833083697n,10282925794625328401n,15784041429090275239n,5167115440072839076n];function ur(e,t){switch(t){case 224:return nr(e,sr,7);case 0:case 256:return nr(e,or,8);case 384:return ar(e,lr,6);case 512:return ar(e,cr,8);default:return}}const dr=Array.from({length:256},(e,t)=>{let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;return n>>>0});function fr(e){let t=4294967295;for(let n of e)t=dr[(t^n)&255]^t>>>8;return(t^4294967295)>>>0}function C(e){let t=e.replace(/^[\t-\r ]+|[\t-\r ]+$/g,``).replaceAll(`\\`,`/`),n=/^[A-Za-z]:/.exec(t)?.[0]??``,r=t.slice(n.length),i=r.startsWith(`//`)?`//`:r.startsWith(`/`)?`/`:``,a=[],o=0;for(let e of r.slice(i.length).split(`/`))e!==``&&e!==`.`&&(e===`..`&&o>0?(a.pop(),o--):e===`..`?a.push(e):(a.push(e),o++));return n+i+a.join(`/`)}function pr(e,t,n){if(n===``)return{files:[],found:!0};if(n.startsWith(`@`))return{files:[n],found:!0};let r=C(t),i={found:!0},a=[];return mr(e,`${r}/${n}`,i,a),{files:[...new Set(a)].filter(e=>e.length>=r.length+1).map(e=>e.slice(r.length+1)).sort(p),found:i.found}}function mr(e,t,n,r){let i=C(t),a=i.indexOf(`*`),o=_r(a===-1?i:i.slice(0,a)),s=a===-1?-1:i.indexOf(`/`,a),c=s===-1?``:i.slice(s+1);if(a!==-1&&i[a+1]===`*`&&(a===0||i[a-1]===`/`)){for(let t of[1,2])mr(e,i.slice(0,a)+i.slice(a+t),n,r);for(let{name:t,directory:s}of hr(e,i.slice(0,a+1),n))s&&mr(e,`${o}/${t}/${i.slice(a)}`,n,r)}else for(let{name:t,directory:a}of hr(e,s===-1?i:i.slice(0,s-1),n)){if(s!==-1&&!a)continue;let i=`${o}/${t}`;c===``?a||r.push(i):mr(e,`${i}/${c}`,n,r)}}function hr(e,t,n){let r=t.lastIndexOf(`/`),i=r===-1?t:t.slice(0,r),a=t.slice(r+1),o=e.list(i),s=gr(a);if(s===void 0)return[];let c=o===void 0?[]:o.filter(e=>e.name!==`.`&&e.name!==`..`&&s.test(e.name));return n.found&&=(o===void 0?s.test(``):c.length>0)||(a.startsWith(`*`)||a.startsWith(`.`))&&o!==void 0,c}function gr(e){let t=``;for(let n of e)n===`?`?t+=`.`:n===`*`?t+=`.*`:`\\^.$|()[]+/`.includes(n)?t+=`\\${n}`:t+=n;try{return RegExp(`^${t}$`)}catch{return}}function _r(e){let t=e.lastIndexOf(`/`);return t===-1?`.`:e.slice(0,t)}var vr=`/*
|
|
10
10
|
* FiveRunner's runtime of JavaScript resources, which runs in their QuickJS
|
|
11
11
|
* contexts, before their scripts: the natives, which load as scripts first
|
|
12
12
|
* name them, msgpack, function references, events, exports, timers, the
|
|
@@ -4998,6 +4998,6 @@ provide 'ghmattimysql'
|
|
|
4998
4998
|
`,"lib/MySQL.lua":Tm}}function Om(e){if(e.includes(`mysql://`)){let t=/^(?:[^:/?#.]+:)?(?:\/\/(?:[^/?#]*@)?[^/?#:]*(?::[0-9]+)?)?([^?#]+)?/.exec(e)?.[1]?.replace(/^\/+/,``);return t===void 0||t===``?void 0:decodeURIComponent(t)}let t;for(let n of e.split(`;`)){let[e,r]=n.split(`=`);e!==void 0&&/^\s*(?:database|db)\s*$/i.test(e)&&r!==void 0&&(t=r)}return t===``?void 0:t}const km=/(?:\?)|(?:(?<!["'])[:@](\d+|(?:[a-zA-Z][a-zA-Z0-9_]*)))/g;function Am(e){let t=[],n=[],r=!1,i=!1,a=0,o=0,s=0,c=0,l=0;km.lastIndex=0;for(let u=km.exec(e);u!==null;u=km.exec(e)){let d=u.index;for(let t=s;t<d;t++){let n=e.charCodeAt(t);if(n===92)i=!i;else{if(i){i=!1;continue}if(r&&n===a){if(e.charCodeAt(t+1)===a){t++;continue}r=!1}else!r&&(n===34||n===39)&&(r=!0,a=n)}}r||(t.push(e.substring(o,d)),n.push(u[0].length===1?l++:u[1]),o=d+u[0].length,c=o),s=d+u[0].length}return n.length===0?[e]:(s<e.length&&t.push(e.substring(c)),[t,n])}function jm(e){let t=e.slice(-1);return t===`:`||t===`@`?e.slice(0,-1):e}function Mm(e,t){let n=Am(e);if(n.length===1)return[e,[]];let[r,i]=n,a=jm(r[0]);for(let e=1;e<r.length;e++)/[:@]$/.test(r[e-1])&&(a+=`?`),a+=`?`,a+=jm(r[e]);r.length===i.length&&(/[:@]$/.test(r.at(-1))&&(a+=`?`),a+=`?`);for(let e of Object.keys(t))(e.startsWith(`@`)||e.startsWith(`:`))&&(t[e.slice(1)]=t[e],delete t[e]);return[a,i.map(e=>t[e]??null)]}function Nm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Pm(e){return e==null||e===!1||e===0||e===``||Number.isNaN(e)}function Fm(e,t){if(typeof e!=`string`)throw Error(`Expected query to be a string but received ${Im(e)} instead.`);let n=e,r=t;Nm(r)&&(n.includes(`:`)||n.includes(`@`))&&([n,r]=Mm(n,r)),(Pm(r)||Dc(r))&&(r=[]);let i=n.match(/\?(?!\?)/g)?.length??0;if(!Array.isArray(r)){let e=r,t=[];for(let n=0;n<i;n++)t[n]=e[n+1]??null;return[n,t]}if(i>0){let e=i-r.length;if(e>0)return[n,[...r,...Array(e).fill(null)]];if(e<0)throw Error(`Expected ${i} parameters, but received ${r.length}.`)}return[n,r]}function Im(e){return e===null?`object`:typeof e}function Lm(e){if(typeof e!=`string`)throw Error(`Expected query to be a string but received ${Im(e)} instead.`);switch(e.substring(0,e.indexOf(` `))){case`INSERT`:return`insert`;case`UPDATE`:case`DELETE`:return`update`;default:return null}}function Rm(e,t){if(Pm(t)||typeof t!=`object`||!t)return[];let n;if(Array.isArray(t))n=t;else{n=[];for(let[e,r]of Object.entries(t))n[Number.parseInt(e,10)-1]=r}return n.every(e=>Array.isArray(e))?n:n.every(e=>typeof e==`object`)?n.map(t=>{let n=Array(e);if(Array.isArray(t))n=t;else{if(t==null)throw TypeError(`Cannot convert undefined or null to object`);for(let[e,r]of Object.entries(t))n[Number.parseInt(e,10)-1]=r}for(let t=0;t<e;t++)n[t]===void 0&&(n[t]=null);return n}):[[...n]]}function zm(e,t){if(e==null)throw TypeError(`Cannot read properties of ${String(e)} (reading '${t}')`);if(typeof e==`string`||typeof e==`object`)return e[t]}function Bm(e,t){if(!Array.isArray(e))throw Error(`Transaction queries must be array, received '${Im(e)}'.`);let n=Pm(t)||Dc(t)?[]:t;return Array.isArray(e[0])?e.map(e=>{let t=zm(e,1);if(Im(t)!==`object`)throw Error(`Transaction parameters must be array or object, received '${Im(t)}'.`);let[n,r]=Fm(zm(e,0),t);return{query:n,params:r}}):e.map(e=>{let t=zm(e,`query`)!==void 0,[r,i]=Fm(t?zm(e,`query`):e,t?zm(e,`parameters`)||zm(e,`values`):n);return{query:r,params:i}})}function Vm(e,t){let n=e=>Nm(e)?e:void 0;switch(e){case`insert`:return n(t)?.insertId??null;case`update`:return n(t)?.affectedRows??null;case`single`:return(Array.isArray(t)?t[0]:void 0)??null;case`scalar`:{let e=Array.isArray(t)?n(t[0]??null):void 0;return(e&&Object.values(e)[0])??null}default:return t??null}}function Hm(e){return typeof e==`object`&&e?String(e.message):String(e??``).replace(/SCRIPT ERROR: citizen:[\w/.]+:\d+[:\s]+/,``)}function Um(e){if(typeof e!=`object`||!e)return e===void 0?void 0:String(e);let t={};for(let[n,r]of Object.entries(e))t[n]=r;return t}const Wm={given:!1,isPromise:!1};var Gm=class{#e;#t;#n;#r=!1;#i=[];#a=``;#o=[];#s=[];#c=/* @__PURE__ */ new Map;#l=1;#u;constructor(e){this.#e=e}get#d(){return`^5[${this.#a}]`}start(e){let t=this.#l++,n=this.#u,r={token:t,result:void 0};this.#u=r;let i;try{i=e(t)}finally{this.#u=n}return r.result===void 0?[t,i]:[t,!1,...r.result]}#f(e,t,n){let r=this.#u;r?.token===e?r.result=[t,n]:this.#e.complete(e,t,n)}connect(e){return this.#t===void 0?(this.#i.push(e),this.#p(),!0):(this.#e.print(`${this.#d} ^2Database server connection established!^0`),this.#f(e,!0,!0),!1)}#p(){if(this.#r)return;this.#r=!0;let e=this.#e.convar(`mysql_connection_string`,``)||`mysql://root@localhost`;this.#e.open(e).then(e=>{this.#r=!1;let t=this.#e.seeds();for(let n of e.seed(t))this.#e.diagnose(`FiveRunner's database failed to run a statement: ${n}`);t.length>0&&this.#e.diagnose(`FiveRunner's database starts empty, with the tables of the .sql files of the resources, which it ran: ${t.map(({path:e})=>e).join(`, `)}.`),this.#t=e,this.#a=e.version,this.#e.print(`${this.#d} ^2Database server connection established!^0`);let n=this.#i.splice(0);this.#o.push(()=>{for(let e of n)this.#f(e,!0,!0)})},e=>{this.#r=!1,this.#e.print(`^3Unable to establish a connection to the database!\n^1Error: ${Hm(e)}^0`)})}scriptConnection(){return this.#t===void 0?this.#p():this.#n??=this.#t.connection(),this.#n}stopped(){for(let{connection:e}of this.#c.values())e.release();this.#c.clear(),this.#o.length=0,this.#s.length=0,this.#i.length=0}tick(){let e=this.#e.now();for(let t=0;t<50;t++){for(let e of this.#o.splice(0))e();if(this.#t!==void 0&&this.#m(this.#t,e),this.#o.length===0)return}}#m(e,t){for(let n of[...this.#s]){let r=this.#s.indexOf(n);if(r===-1)continue;let i=e.connection();i.blocked(n.sql)?(i.release(),n.since??=t,t-n.since>=5e4&&(this.#s.splice(r,1),n.fail(Object.assign(/* @__PURE__ */ Error(`Lock wait timeout exceeded; try restarting transaction`),{code:`ER_LOCK_WAIT_TIMEOUT`,errno:1205,sqlState:`HY000`,sqlMessage:`Lock wait timeout exceeded; try restarting transaction`})))):(this.#s.splice(r,1),n.run(i))}}#h(e,t,n){this.#g(n=>{try{e(n)}catch(e){t(e)}finally{n.release()}},t,n)}#g(e,t,n){let r=this.#t;if(r!==void 0&&this.#s.length===0){let i=r.connection();if(!i.blocked(n)){e(i);return}i.release(),this.#s.push({since:this.#e.now(),sql:n,run:e,fail:t})}else this.#s.push({since:void 0,sql:n,run:e,fail:t})}#_(){let e=this.#e,t=!1,n=e.convar(`mysql_debug`,`false`);if(n!==`false`)try{t=JSON.parse(n)}catch{t=!0}let r=(t,n)=>{let r=Number.parseInt(e.convar(t,String(n)),10);return Number.isNaN(r)?n:r};return{debug:t,slow:r(`mysql_slow_query_warning`,200),resultSetWarning:r(`mysql_resultset_warning`,1e3)}}#v(e,t,n,r){let{debug:i,slow:a}=this.#_(),o=i!==!1&&(!Array.isArray(i)||i.includes(e));if(n>=a||o){let i=r==null?``:` ${Ec(r)}`;this.#e.print(`${this.#d} ^3${e} took ${n.toFixed(4)}ms to execute a query!\n${t}${i}^0`)}}#y(e,t,n){let r=Array.isArray(n)?n.length:0;r<this.#_().resultSetWarning||this.#e.print(`^3Warning: ${e} executed a query with an oversized result set (${r} results)!\n${t}^7`)}#b(e,t,n,r,i,a,o=!1){let s=Hm(r),c=`${t} was unable to execute a query!${i?`\nQuery: ${i}`:``}${o?`\n${Ec(a??void 0)}`:``}\n${s}`;this.#e.trigger(`oxmysql:error`,[{query:i,parameters:a,message:s,err:Um(r),resource:t}]),n.given&&n.isPromise?this.#f(e,!1,c):this.#e.print(`^1Error: ${c}^7`)}query(e,t,n,r,i,a){let o,s;try{[o,s]=Fm(r,i)}catch(t){return this.#b(e,n,a,t,typeof r==`string`?r:void 0,i),!1}let c=t=>this.#b(e,n,a,t,o,s,!0);return this.#o.push(()=>this.#h(r=>{let i=this.#e.measure(),l;try{l=r.query(o,s)}catch(e){c(e);return}this.#v(n,o,this.#e.measure()-i,s),this.#y(n,o,l),a.given&&this.#f(e,!0,Vm(t,l))},c,o)),!0}execute(e,t,n,r,i,a){let o,s,c;try{o=Lm(n),c=n.split(`?`).length-1,s=Rm(c,r)}catch(a){return this.#b(e,t,i,a,typeof n==`string`?n:void 0,r),!1}let l=n,u=n=>this.#b(e,t,i,n,l,s);return this.#o.push(()=>this.#h(n=>{let r=[];try{for(let e=0;e<Math.max(s.length,1);e++){let i=s[e];if(i!==void 0)for(let e=i.length;e<c;e++)i[e]=null;let u=this.#e.measure(),d=n.execute(l,i);r.push(a?Vm(o,d):d),this.#v(t,l,this.#e.measure()-u,i),this.#y(t,l,d)}}catch(e){u(e);return}if(i.given){if(r.length===1){let[t]=r;if(a&&o===null){let n=Array.isArray(t)?t[0]:void 0;n!=null&&Nm(n)&&Object.keys(n).length===1?this.#f(e,!0,Object.values(n)[0]??null):this.#f(e,!0,n??null)}else this.#f(e,!0,t??null)}else this.#f(e,!0,r)}},u,l)),!0}transaction(e,t,n,r,i){let a;try{a=Bm(n,r)}catch(n){return this.#b(e,t,i,n),!1}let o=t=>{i.given&&this.#f(e,!0,t)},s=e=>{let n=e,i=n.sql??`${a.map(e=>`${e.query} ${Ec(e.params)}`).join(`
|
|
4999
4999
|
`)}\n${Ec(r??void 0)}`;this.#e.print(`^1Error: ${t} was unable to complete a transaction!\n${i}\n${n.message}^7`),this.#e.trigger(`oxmysql:transaction-error`,[{query:i,parameters:r,message:n.message,err:Um(e),resource:t}]),o(!1)};return this.#o.push(()=>this.#h(e=>{try{e.query(`START TRANSACTION`);for(let{query:n,params:r}of a){let i=this.#e.measure();e.query(n,r),this.#v(t,n,this.#e.measure()-i,r)}e.query(`COMMIT`)}catch(t){try{e.query(`ROLLBACK`)}catch{}s(t);return}o(!0)},s)),!0}begin(e,t){let n=n=>{this.#b(e,t,Wm,n),this.#f(e,!1,Hm(n))};return this.#o.push(()=>this.#g(r=>{try{r.query(`START TRANSACTION`)}catch(e){r.release(),n(e);return}this.#c.set(e,{connection:r,resource:t}),this.#f(e,!0,e)},n)),!0}transactionQuery(e,t,n,r,i){let a,o;try{[a,o]=Fm(r,i)}catch(t){return this.#f(e,!1,Hm(t)),!1}let s=t=>this.#f(e,!1,`Query: ${a}\n${Ec(o)}\n${Hm(t)}`);return this.#o.push(()=>{let r=this.#c.get(t);if(n||r===void 0){s(/* @__PURE__ */ Error(`Connection used by transaction timed out after 30 seconds.`));return}let i;try{i=r.connection.query(a,o)}catch(e){s(e);return}this.#f(e,!0,i)}),!0}end(e,t,n,r){return this.#o.push(()=>{let i=this.#c.get(t);if(i===void 0){this.#f(e,!0,!1);return}this.#c.delete(t);let{connection:a,resource:o}=i,s=r;try{a.query(n&&r===void 0?`COMMIT`:`ROLLBACK`)}catch(e){s=e;try{a.query(`ROLLBACK`)}catch{}}a.release(),s!==void 0&&this.#b(e,o,Wm,s),this.#f(e,!0,s===void 0&&n)}),!0}};function Km(e){return({connectionString:t,zone:n,clock:r})=>wm.create(e,{name:Om(t)??`fiverunner`,zone:n,clock:r})}var qm=class{#e=/* @__PURE__ */ new Map;give(e,t,n){let r=this.#e.get(e);r===void 0?this.#e.set(e,/* @__PURE__ */ new Map([[n,t]])):r.set(n,t)}mayWrite(e,t){return this.#e.get(e)?.get(t)===`write`}};function Jm(e,t){let{commands:n}=e.defaultConsole,r=t=>!e.configured||(e.logWarning(`citizen-scripting-core`,`${t} is only executable before the server finished execution.\n`),!1);n.add(`add_filesystem_permission`,[`string`,`string`,`string`],(e,n,i)=>{r(`add_filesystem_permission`)&&(n===`write`||n===`read`)&&t.give(e,n,i)}),n.add(`add_unsafe_worker_permission`,[`string`],()=>{r(`add_unsafe_worker_permission`)}),n.add(`add_unsafe_child_process_permission`,[`string`],()=>{r(`add_unsafe_child_process_permission`)})}var Ym=class{#e=[];#t=[];#n=0;constructor(e){this.#r(e)}get size(){return this.#e.length}add(e){let t=this.#n;for(;t<this.#e.length&&!(this.#e[t]&128);)t++;return t===this.#e.length&&this.#r(Math.max(t+Math.trunc(t/2),t+1)),this.#n=t+1,this.#e[t]=this.#e[t]+1&127,this.#t[t]=e,t<<8|this.#e[t]}get(e){let t=e>>8;return this.#e[t]===(e&255)?this.#t[t]:void 0}set(e,t){this.#t[e>>8]=t}delete(e){let t=e>>8;this.#e[t]=this.#e[t]|128,this.#t[t]=void 0,this.#n=Math.min(this.#n,t)}#r(e){for(;this.#e.length<e;)this.#e.push(128),this.#t.push(void 0)}},Xm=class{handle=0;shape;script;x=0;y=0;z=0;sprite;colour=0;alpha=255;scale=1;display=2;shortRange=!1;category=0;route=!1;routeColour=0;rotation=0;flashes=!1;name=void 0;constructor(e,t,n){this.shape=e,this.script=t,this.sprite=n??(e.kind===`radius`?9:1)}get coords(){let{shape:e}=this;return e.kind===`entity`?[e.entity.x,e.entity.y,e.entity.z]:[this.x,this.y,this.z]}},Zm=class{#e=new Ym(0);#t=/* @__PURE__ */ new Set;#n=/* @__PURE__ */ new Map;get all(){return this.#t.values()}add(e){return e.handle=this.#e.add(e),this.#t.add(e),e.handle}get(e){return this.#e.get(e)}remove(e){this.#t.delete(e),this.#e.delete(e.handle)}ofEntity(e){for(let t of this.#t)if(t.shape.kind===`entity`&&t.shape.entity===e)return t}forget(e){for(let t of this.#t)t.shape.kind===`entity`&&t.shape.entity===e&&this.remove(t)}release(e){for(let t of this.#t)t.script===e&&this.remove(t)}get waypoint(){for(let e of this.#t)if(e.script===void 0&&e.sprite===8)return e}setWaypoint(e,t){let n=this.waypoint??new Xm({kind:`coord`},void 0,8);n.x=e,n.y=t,n.handle===0&&this.add(n)}first(e){let t=[...this.#t].filter(t=>t.sprite===e);return this.#n.set(e,{blips:t,next:1}),t[0]}next(e){let t=this.#n.get(e);if(t!==void 0)for(;t.next<t.blips.length;){let e=t.blips[t.next++];if(this.#t.has(e))return e}}};function Qm(e){return e.manager.world.blips}function $m(e,t,n=0,r=0,i=0){let a=new Xm(t,e.resource.name);return a.x=n,a.y=r,a.z=i,Qm(e).add(a)}function eh(e){if(e===`server`)return[];let t=(e,t,n,r)=>S({name:e,hash:t,result:`void`,params:[`Blip blip`,`${n} value`]},(e,t,n)=>{let i=Qm(e).get(t);i!==void 0&&(i[r]=n)}),n=(e,t,n,r)=>S({name:e,hash:t,result:n,params:[`Blip blip`]},(e,t)=>Qm(e).get(t)?.[r]??(n!==`BOOL`&&0)),r=(e,t)=>{let[n,r,i]=Qm(e).get(t)?.coords??[0,0,0];return{x:n,y:r,z:i}};return[S({name:`ADD_BLIP_FOR_COORD`,hash:6486199071725192374n,result:`Blip`,params:[`float x`,`float y`,`float z`]},(e,t,n,r)=>$m(e,{kind:`coord`},t,n,r)),S({name:`ADD_BLIP_FOR_RADIUS`,hash:5080497408466962842n,result:`Blip`,params:[`float posX`,`float posY`,`float posZ`,`float radius`]},(e,t,n,r,i)=>$m(e,{kind:`radius`,radius:i},t,n,r)),S({name:`ADD_BLIP_FOR_AREA`,hash:14870057342365184568n,result:`Blip`,params:[`float x`,`float y`,`float z`,`float width`,`float height`]},(e,t,n,r,i,a)=>$m(e,{kind:`area`,width:i,height:a},t,n,r)),S({name:`ADD_BLIP_FOR_ENTITY`,hash:6691947479759912167n,result:`Blip`,params:[`Entity entity`]},(e,t)=>{let n=e.manager.world.byHandle(t);return n===void 0?0:$m(e,{kind:`entity`,entity:n})}),S({name:`REMOVE_BLIP`,hash:9702532981073061341n,result:`void`,params:[`Blip* blip`]},(e,t)=>{let n=Qm(e).get(t.get());n!==void 0&&Qm(e).remove(n),t.set(0)}),S({name:`DOES_BLIP_EXIST`,hash:12023247411461470170n,result:`BOOL`,params:[`Blip blip`]},(e,t)=>Qm(e).get(t)!==void 0),S({name:`GET_BLIP_FROM_ENTITY`,hash:13586724326735280104n,result:`Blip`,params:[`Entity entity`]},(e,t)=>{let n=e.manager.world.byHandle(t);return n===void 0?0:Qm(e).ofEntity(n)?.handle??0}),S({name:`GET_BLIP_INFO_ID_ENTITY_INDEX`,hash:5450730304715021356n,result:`Entity`,params:[`Blip blip`]},(e,t)=>{let n=Qm(e).get(t)?.shape;return n?.kind===`entity`?n.entity.handle:0}),S({name:`GET_BLIP_COORDS`,hash:6371184173552343406n,result:`Vector3`,params:[`Blip blip`]},r),S({name:`GET_BLIP_INFO_ID_COORD`,hash:18049441090438847753n,result:`Vector3`,params:[`Blip blip`]},r),S({name:`SET_BLIP_COORDS`,hash:12550114335291799133n,result:`void`,params:[`Blip blip`,`float posX`,`float posY`,`float posZ`]},(e,t,n,r,i)=>{let a=Qm(e).get(t);a!==void 0&&(a.x=n,a.y=r,a.z=i)}),n(`GET_BLIP_SPRITE`,2290211554291153999n,`int`,`sprite`),t(`SET_BLIP_SPRITE`,16101307653538016687n,`int`,`sprite`),n(`GET_BLIP_COLOUR`,16101105946780988199n,`int`,`colour`),t(`SET_BLIP_COLOUR`,276965922061511550n,`int`,`colour`),n(`GET_BLIP_ALPHA`,10885024991924373637n,`int`,`alpha`),t(`SET_BLIP_ALPHA`,5043916472936335156n,`int`,`alpha`),t(`SET_BLIP_SCALE`,15242226327205421655n,`float`,`scale`),t(`SET_BLIP_DISPLAY`,10388030775920576808n,`int`,`display`),n(`IS_BLIP_SHORT_RANGE`,15735444228579637542n,`BOOL`,`shortRange`),t(`SET_BLIP_AS_SHORT_RANGE`,13730319670167370610n,`BOOL`,`shortRange`),t(`SET_BLIP_CATEGORY`,2543651177335553434n,`int`,`category`),t(`SET_BLIP_ROUTE`,5727886703621522409n,`BOOL`,`route`),t(`SET_BLIP_ROUTE_COLOUR`,9471445831088593417n,`int`,`routeColour`),t(`SET_BLIP_ROTATION`,17903642289297440622n,`int`,`rotation`),n(`IS_BLIP_FLASHING`,11953714324508692208n,`BOOL`,`flashes`),t(`SET_BLIP_FLASHES`,12773706319605124670n,`BOOL`,`flashes`),S({name:`GET_FIRST_BLIP_INFO_ID`,hash:2012513321047894559n,result:`Blip`,params:[`int blipSprite`]},(e,t)=>Qm(e).first(t)?.handle??0),S({name:`GET_NEXT_BLIP_INFO_ID`,hash:1511356407087087271n,result:`Blip`,params:[`int blipSprite`]},(e,t)=>Qm(e).next(t)?.handle??0),S({name:`GET_NUMBER_OF_ACTIVE_BLIPS`,hash:11114870540554220776n,result:`int`,params:[]},e=>[...Qm(e).all].length),S({name:`SET_NEW_WAYPOINT`,hash:18321547689007051516n,result:`void`,params:[`float x`,`float y`]},(e,t,n)=>Qm(e).setWaypoint(t,n)),S({name:`IS_WAYPOINT_ACTIVE`,hash:2148768492990438821n,result:`BOOL`,params:[]},e=>Qm(e).waypoint!==void 0),...[[`SET_WAYPOINT_OFF`,12098043896530100863n],[`DELETE_WAYPOINTS_FROM_THIS_PLAYER`,15629342789145110761n]].map(([e,t])=>S({name:e,hash:t,result:`void`,params:[]},e=>{let{waypoint:t}=Qm(e);t!==void 0&&Qm(e).remove(t)})),S({name:`BEGIN_TEXT_COMMAND_SET_BLIP_NAME`,hash:17947189971611575920n,result:`void`,params:[`char* textLabel`]},(e,t)=>e.manager.world.text.begin(t??``)),S({name:`END_TEXT_COMMAND_SET_BLIP_NAME`,hash:13562788859053587611n,result:`void`,params:[`Blip blip`]},(e,t)=>{let n=e.manager.world.text.end(),r=Qm(e).get(t);r!==void 0&&(r.name=n)})]}function th(e){if(e===`server`)return[];let t=e=>e.manager.world.text;return[S({name:`ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME`,hash:7789129354908300458n,result:`void`,params:[`char* text`]},(e,n)=>t(e).add(n??``)),S({name:`ADD_TEXT_COMPONENT_SUBSTRING_TEXT_LABEL`,hash:14284527218482400231n,result:`void`,params:[`char* labelName`]},(e,n)=>t(e).add(t(e).label(n??``)??`NULL`)),S({name:`ADD_TEXT_COMPONENT_INTEGER`,hash:267125040633950652n,result:`void`,params:[`int value`]},(e,n)=>t(e).add(String(n))),S({name:`ADD_TEXT_COMPONENT_FLOAT`,hash:16707428521474840942n,result:`void`,params:[`float value`,`int decimalPlaces`]},(e,n,r)=>t(e).add(n.toFixed(Math.min(Math.max(r,0),20)))),S({name:`ADD_TEXT_ENTRY`,result:`void`,params:[`char* entryKey`,`char* entryText`]},(e,n,r)=>t(e).addLabel(x(n??``),r??``)),S({name:`ADD_TEXT_ENTRY_BY_HASH`,result:`void`,params:[`Hash entryKey`,`char* entryText`]},(e,n,r)=>t(e).addLabel(n,r??``)),S({name:`GET_FILENAME_FOR_AUDIO_CONVERSATION`,hash:8886306764405083250n,result:`char*`,params:[`char* labelName`]},(e,n)=>t(e).label(n??``)??`NULL`),S({name:`DOES_TEXT_LABEL_EXIST`,hash:12396662200215159378n,result:`BOOL`,params:[`char* gxt`]},(e,n)=>t(e).label(n??``)!==void 0)]}const nh=[1,0,0,0,1,0,0,0,1],rh=[[2,1,0],[1,2,0],[2,0,1],[0,2,1],[1,0,2],[0,1,2]],ih=Math.PI/180;function ah(e){return rh[e]??rh[2]}function oh(e,t){let n=Math.cos(t*ih),r=Math.sin(t*ih);switch(e){case 0:return[1,0,0,0,n,-r,0,r,n];case 1:return[n,0,r,0,1,0,-r,0,n];default:return[n,-r,0,r,n,0,0,0,1]}}function sh(e,t){let n=[];for(let r=0;r<3;r++)for(let i=0;i<3;i++){let a=0;for(let n=0;n<3;n++)a+=e[r*3+n]*t[n*3+i];n.push(a)}return n}function ch(e,t,n,r){let i=[e,t,n],[a,o,s]=ah(r);return sh(sh(oh(a,i[a]),oh(o,i[o])),oh(s,i[s]))}function lh(e,t){let[n,r,i]=ah(t),a=(r-n+3)%3==1?1:-1,o=(t,n)=>e[t*3+n],s=[0,0,0];s[r]=Math.asin(Math.max(-1,Math.min(1,a*o(n,i)))),s[n]=Math.atan2(-a*o(r,i),o(i,i)),s[i]=Math.atan2(-a*o(n,r),o(n,n));let[c,l,u]=s.map(e=>e/ih+0);return[c,l,u]}function uh(e,t,n,r){return[e[0]*t+e[1]*n+e[2]*r,e[3]*t+e[4]*n+e[5]*r,e[6]*t+e[7]*n+e[8]*r]}function dh(e){let t=Math.atan2(-e[1],e[4])/ih;return(t<0?t+360:t)+0}function fh(e,t,n,r){return[1-2*(t*t+n*n),2*(e*t-r*n),2*(e*n+r*t),2*(e*t+r*n),1-2*(e*e+n*n),2*(t*n-r*e),2*(e*n-r*t),2*(t*n+r*e),1-2*(e*e+t*t)]}function ph(e){let[t,n,r,i,a,o,s,c,l]=e,u=t+a+l;if(u>0){let e=Math.sqrt(u+1)*2;return[(c-o)/e,(r-s)/e,(i-n)/e,e/4]}if(t>a&&t>l){let e=Math.sqrt(1+t-a-l)*2;return[e/4,(n+i)/e,(r+s)/e,(c-o)/e]}if(a>l){let e=Math.sqrt(1+a-t-l)*2;return[(n+i)/e,e/4,(o+c)/e,(r-s)/e]}let d=Math.sqrt(1+l-t-a)*2;return[(r+s)/d,(o+c)/d,d/4,(i-n)/d]}function mh(e){return oh(2,e)}var hh=class{#e=new Ym(0);#t=/* @__PURE__ */ new Set;#n=[];rendering=!1;create(e,t,n,r,i=nh,a=50){let o={handle:0,script:e,x:t,y:n,z:r,rotation:i,fov:a};return o.handle=this.#e.add(o),this.#t.add(o),o.handle}get(e){return this.#e.get(e)}isActive(e){return this.#n.includes(e)}activate(e,t){this.#n=this.#n.filter(t=>t!==e),t&&this.#n.push(e)}destroy(e){this.activate(e,!1),this.#t.delete(e),this.#e.delete(e.handle)}release(e){for(let t of this.#t)t.script===e&&this.destroy(t)}get rendered(){return this.rendering?this.#n.at(-1):void 0}};function gh(e){return e.manager.world.cameras}function _h(e,t){return gh(e).get(t)}function vh(e,t){let n=e.manager.world,r=n.cameras.rendered;if(r!==void 0){let[e,n,i]=lh(r.rotation,t);return{coords:{x:r.x,y:r.y,z:r.z},rotation:{x:e,y:n,z:i}}}let i=n.playerPed,[a,o,s]=lh(i.rotation,t);return{coords:{x:i.x,y:i.y,z:i.z},rotation:{x:a,y:o,z:s}}}function yh(e){if(e===`server`)return[];let t=(e,t,n)=>S({name:e,hash:t,result:`void`,params:n},()=>{}),n=(e,t,n,r)=>n?S({name:e,hash:t,result:`Cam`,params:[r,`float posX`,`float posY`,`float posZ`,`float rotX`,`float rotY`,`float rotZ`,`float fov`,`BOOL active`,`int rotationOrder`]},(e,t,n,r,i,a,o,s,c,l,u)=>{let d=gh(e),f=d.create(e.resource.name,n,r,i,ch(a,o,s,u),c);return d.activate(d.get(f),l),f}):S({name:e,hash:t,result:`Cam`,params:[r,`BOOL active`]},(e,t,n)=>{let r=gh(e),i=r.create(e.resource.name,0,0,0);return r.activate(r.get(i),n),i});return[n(`CREATE_CAM`,14094047806098104639n,!1,`char* camName`),n(`CREATE_CAM_WITH_PARAMS`,13047372873132765537n,!0,`char* camName`),n(`CREATE_CAMERA`,6790575688875026045n,!1,`Hash camHash`),n(`CREATE_CAMERA_WITH_PARAMS`,7692046877019140653n,!0,`Hash camHash`),S({name:`DESTROY_CAM`,hash:9680778529535173353n,result:`void`,params:[`Cam cam`,`BOOL bScriptHostCam`]},(e,t)=>{let n=_h(e,t);n!==void 0&&gh(e).destroy(n)}),S({name:`DESTROY_ALL_CAMS`,hash:10259113460775751968n,result:`void`,params:[`BOOL bScriptHostCam`]},e=>gh(e).release(e.resource.name)),S({name:`DOES_CAM_EXIST`,hash:12081242549857203470n,result:`BOOL`,params:[`Cam cam`]},(e,t)=>_h(e,t)!==void 0),S({name:`SET_CAM_ACTIVE`,hash:175562857184911236n,result:`void`,params:[`Cam cam`,`BOOL active`]},(e,t,n)=>{let r=_h(e,t);r!==void 0&&gh(e).activate(r,n)}),S({name:`IS_CAM_ACTIVE`,hash:16119145122951410996n,result:`BOOL`,params:[`Cam cam`]},(e,t)=>{let n=_h(e,t);return n!==void 0&&gh(e).isActive(n)}),S({name:`SET_CAM_ACTIVE_WITH_INTERP`,hash:11510535963658572452n,result:`void`,params:[`Cam camTo`,`Cam camFrom`,`int duration`,`int easeLocation`,`int easeRotation`]},(e,t,n)=>{let r=gh(e),i=_h(e,n);i!==void 0&&r.activate(i,!1);let a=_h(e,t);a!==void 0&&r.activate(a,!0)}),S({name:`IS_CAM_INTERPOLATING`,hash:247583394219865388n,result:`BOOL`,params:[`Cam cam`]},()=>!1),S({name:`RENDER_SCRIPT_CAMS`,hash:569060033405794044n,result:`void`,params:[`BOOL render`,`BOOL ease`,`int easeTime`]},(e,t)=>{gh(e).rendering=t}),S({name:`IS_CAM_RENDERING`,hash:210555333278735226n,result:`BOOL`,params:[`Cam cam`]},(e,t)=>{let n=_h(e,t);return n!==void 0&&gh(e).rendered===n}),S({name:`GET_RENDERING_CAM`,hash:5923634223534172858n,result:`Cam`,params:[]},e=>gh(e).rendered?.handle??-1),S({name:`SET_CAM_COORD`,hash:5566862829459727406n,result:`void`,params:[`Cam cam`,`float posX`,`float posY`,`float posZ`]},(e,t,n,r,i)=>{let a=_h(e,t);a!==void 0&&Object.assign(a,{x:n,y:r,z:i})}),S({name:`GET_CAM_COORD`,hash:13456818321258898862n,result:`Vector3`,params:[`Cam cam`]},(e,t)=>{let n=_h(e,t);return{x:n?.x??0,y:n?.y??0,z:n?.z??0}}),S({name:`SET_CAM_ROT`,hash:9626222390276852487n,result:`void`,params:[`Cam cam`,`float rotX`,`float rotY`,`float rotZ`,`int rotationOrder`]},(e,t,n,r,i,a)=>{let o=_h(e,t);o!==void 0&&(o.rotation=ch(n,r,i,a))}),S({name:`GET_CAM_ROT`,hash:9020793739271880210n,result:`Vector3`,params:[`Cam cam`,`int rotationOrder`]},(e,t,n)=>{let r=_h(e,t);if(r===void 0)return{x:0,y:0,z:0};let[i,a,o]=lh(r.rotation,n);return{x:i,y:a,z:o}}),S({name:`SET_CAM_FOV`,hash:12771105691888832583n,result:`void`,params:[`Cam cam`,`float fieldOfView`]},(e,t,n)=>{let r=_h(e,t);r!==void 0&&(r.fov=n)}),S({name:`GET_CAM_FOV`,hash:14065597356113244778n,result:`float`,params:[`Cam cam`]},(e,t)=>_h(e,t)?.fov??0),S({name:`SET_CAM_PARAMS`,hash:13823924928455167674n,result:`void`,params:[`Cam cam`,`float posX`,`float posY`,`float posZ`,`float rotX`,`float rotY`,`float rotZ`,`float fieldOfView`,`Any p8`,`int p9`,`int p10`,`int rotationOrder`]},(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{let p=_h(e,t);p!==void 0&&Object.assign(p,{x:n,y:r,z:i,fov:c,rotation:ch(a,o,s,f)})}),S({name:`GET_GAMEPLAY_CAM_COORD`,hash:1501657350880041783n,result:`Vector3`,params:[]},e=>{let{x:t,y:n,z:r}=e.manager.world.playerPed;return{x:t,y:n,z:r}}),S({name:`GET_GAMEPLAY_CAM_ROT`,hash:9473152089056669883n,result:`Vector3`,params:[`int rotationOrder`]},(e,t)=>{let[n,r,i]=lh(e.manager.world.playerPed.rotation,t);return{x:n,y:r,z:i}}),S({name:`GET_GAMEPLAY_CAM_FOV`,hash:7278264845348258099n,result:`float`,params:[]},()=>50),S({name:`GET_FINAL_RENDERED_CAM_COORD`,hash:11673588752110908488n,result:`Vector3`,params:[]},e=>vh(e,2).coords),S({name:`GET_FINAL_RENDERED_CAM_ROT`,hash:6579280224713453051n,result:`Vector3`,params:[`int rotationOrder`]},(e,t)=>vh(e,t).rotation),t(`POINT_CAM_AT_COORD`,17822036457080948739n,[`Cam cam`,`float x`,`float y`,`float z`]),t(`POINT_CAM_AT_ENTITY`,6215178559440742620n,[`Cam cam`,`Entity entity`]),t(`STOP_CAM_POINTING`,17526522486315440094n,[`Cam cam`]),t(`ATTACH_CAM_TO_ENTITY`,18364409510355558627n,[`Cam cam`,`Entity entity`]),t(`DETACH_CAM`,11743905585564462466n,[`Cam cam`]),t(`SET_CAM_DOF_STRENGTH`,6837197941419931799n,[`Cam cam`,`float dofStrength`]),t(`SET_CAM_FAR_DOF`,17138750295828967136n,[`Cam cam`,`float farDOF`]),t(`SET_CAM_NEAR_DOF`,4586000372299456044n,[`Cam cam`,`float nearDOF`]),t(`SET_CAM_USE_SHALLOW_DOF_MODE`,1632951117018387131n,[`Cam cam`,`BOOL toggle`]),t(`SHAKE_CAM`,7648559245709621282n,[`Cam cam`,`char* type`,`float amplitude`]),t(`STOP_CAM_SHAKING`,13685584137032321731n,[`Cam cam`,`BOOL p1`])]}function U(e,t){if(e===null)throw new Ke(`Argument at index ${t} was null.`);return e}function bh(){return[S({name:`TRIGGER_EVENT_INTERNAL`,result:`void`,sets:`BOOL`,params:[`char* eventName`,`buffer eventPayload`,`int payloadLength`]},(e,t,n)=>e.manager.events.trigger(U(t,0),U(n,1))),S({name:`CANCEL_EVENT`,result:`void`,params:[]},e=>{e.manager.events.cancel()}),S({name:`WAS_EVENT_CANCELED`,result:`BOOL`,params:[]},e=>e.manager.events.lastCanceled),S({name:`REGISTER_RESOURCE_AS_EVENT_HANDLER`,result:`void`,params:[`char* eventName`]},(e,t)=>{let n=e.manager.currentResource;if(n===void 0)return;let r=U(t,0);n.handledEvents.add(r),e.manager.events.register(n.name,r)})]}function xh(e,t,n){e.diagnose(`${t} was given nil for the reference, which FiveM reads as a string all the same: its behavior is undefined, and it can crash. FiveRunner ${n}.`)}function Sh(){return[S({name:`DUPLICATE_FUNCTION_REFERENCE`,result:`char*`,params:[`char* referenceIdentity`]},(e,t)=>{if(t===null)return xh(e,`DuplicateFunctionReference`,`returns nil`),null;let n=e.manager.duplicateFunctionReference(t);return n===null&&t.startsWith(`_cfx_internal:`)&&e.diagnose(`DuplicateFunctionReference was given ${t}, which names no callback that is left: FiveM would return a reference by an index it does not set. FiveRunner returns nil.`),n}),S({name:`DELETE_FUNCTION_REFERENCE`,result:`void`,params:[`char* referenceIdentity`]},(e,t)=>{t===null?xh(e,`DeleteFunctionReference`,`does nothing`):e.manager.deleteFunctionReference(t)})]}function Ch(e){return E(e.map(({name:e,resource:t,arity:n})=>({name:e,resource:t,arity:n})))}function wh(e){let t=/* @__PURE__ */ new Map,r=[S({name:`EXECUTE_COMMAND`,result:`void`,params:[`bytes commandString`]},(e,t)=>{let{manager:n,resource:r}=e;n.security.runAs(`resource.${r.name}`,()=>{let e=U(t,0),r=e.indexOf(0);n.console.execute(r===-1?e:e.subarray(0,r))})}),S({name:`REGISTER_COMMAND`,result:`void`,params:[`char* commandName`,`func handler`,`bool restricted`]},(e,r,i,a)=>{let o=U(r,0);t.set(o,U(i,1));let{manager:s,resource:c}=e,{console:l,security:u}=s;if(l.commands.has(o))return;let d=`resource.${c.name}`,f=`command.${o}`;u.addEntry(d,f,`allow`),a||u.addEntry(la,f,`allow`);let p=l.commands.register(o,c.name,({args:e,source:r})=>{let i=E([n(r),[...e],l.commands.rawCommand]);return s.invokeFunctionReference(t.get(o),i),!0});c.onStop.connect(()=>{l.commands.unregister(p),u.removeEntry(la,f,`allow`),u.removeEntry(d,f,`allow`)},2147483647)}),S({name:`GET_REGISTERED_COMMANDS`,result:`object`,params:[]},e=>Ch(e.manager.console.commands.list)),S({name:`GET_RESOURCE_COMMANDS`,result:`object`,params:[`char* resource`]},(e,t)=>{let n=U(t,0),{manager:r}=e;return r.getResource(n)===void 0?Ch([]):Ch(r.console.commands.list.filter(e=>e.resource===n))}),S({name:`IS_ACE_ALLOWED`,result:`BOOL`,params:[`char* object`]},(e,t)=>e.manager.security.check(U(t,0))),S({name:`IS_PRINCIPAL_ACE_ALLOWED`,result:`BOOL`,params:[`char* principal`,`char* object`]},(e,t,n)=>{let r=U(t,0);return e.manager.security.checkPrincipal(r,U(n,1))})];return e===`client`?r:[...r,S({name:`GET_CONSOLE_BUFFER`,result:`char*`,params:[]},e=>e.manager.consoleBuffer.text),S({name:`REGISTER_CONSOLE_LISTENER`,result:`void`,params:[`func listener`]},(e,t)=>{if(t===null){xh(e,`RegisterConsoleListener`,`adds no listener`);return}let{manager:n,resource:r}=e,i=n.consoleBuffer;i.listen(r.name,t),r.onStop.connect(()=>i.forget(r.name))})]}function Th(e){return e.manager.world.input}function Eh(e){if(e===`server`)return[];let t=(e,t,n)=>S({name:e,hash:t,result:`BOOL`,params:[`int padIndex`,`int control`]},(e,t,r)=>n(Th(e),r));return[S({name:`GET_CONTROL_INSTRUCTIONAL_BUTTON`,hash:331533201183454215n,result:`char*`,params:[`int padIndex`,`int control`,`BOOL p2`]},()=>``),S({name:`REGISTER_KEY_MAPPING`,result:`void`,params:[`char* commandString`,`char* description`,`char* defaultMapper`,`char* defaultParameter`]},(e,t,n,r,i)=>Th(e).map(e.resource.name,t??``,n??``,r??``,i??``)),t(`IS_CONTROL_PRESSED`,17555624867233159754n,(e,t)=>e.pressed(t,!1)),t(`IS_DISABLED_CONTROL_PRESSED`,16309926292945926941n,(e,t)=>e.pressed(t,!0)),t(`IS_CONTROL_RELEASED`,7245979435848464349n,(e,t)=>!e.pressed(t,!1)),t(`IS_DISABLED_CONTROL_RELEASED`,18116926263294897810n,(e,t)=>!e.pressed(t,!0)),t(`IS_CONTROL_JUST_PRESSED`,6342219533232326959n,(e,t)=>e.justPressed(t,!1)),t(`IS_DISABLED_CONTROL_JUST_PRESSED`,10497601588777486455n,(e,t)=>e.justPressed(t,!0)),t(`IS_CONTROL_JUST_RELEASED`,5834765322530865638n,(e,t)=>e.justReleased(t,!1)),t(`IS_DISABLED_CONTROL_JUST_RELEASED`,3484816125330098959n,(e,t)=>e.justReleased(t,!0)),t(`IS_CONTROL_ENABLED`,2083596516048037337n,(e,t)=>e.enabled(t)),...[[`GET_CONTROL_NORMAL`,17022651722841437539n,!1],[`GET_DISABLED_CONTROL_NORMAL`,1289816700883198844n,!0]].map(([e,t,n])=>S({name:e,hash:t,result:`float`,params:[`int padIndex`,`int control`]},(e,t,r)=>Th(e).normal(r,n))),S({name:`DISABLE_CONTROL_ACTION`,hash:18345895136465843900n,result:`void`,params:[`int padIndex`,`int control`,`BOOL disableRelatedActions`]},(e,t,n)=>Th(e).disable(n)),S({name:`ENABLE_CONTROL_ACTION`,hash:3824154378443735381n,result:`void`,params:[`int padIndex`,`int control`,`BOOL enableRelatedActions`]},(e,t,n)=>Th(e).enable(n)),S({name:`DISABLE_ALL_CONTROL_ACTIONS`,hash:6866697718202259867n,result:`void`,params:[`int padIndex`]},e=>Th(e).disableAll()),S({name:`ENABLE_ALL_CONTROL_ACTIONS`,hash:11961536079038356967n,result:`void`,params:[`int padIndex`]},e=>Th(e).enableAll()),S({name:`IS_USING_KEYBOARD`,hash:11921543228142303000n,result:`BOOL`,params:[`int padIndex`],aliases:[`IS_USING_KEYBOARD_AND_MOUSE`]},()=>!0)]}function Dh(e,t){return e.convarPermissions?.mayRead(t,e.currentResource?.name)??!0}function Oh(e,t){return(e.console.variables.flagsOf(t)&w.scriptRestricted)!==0}function kh(e,t,n){let r=U(t,0),{manager:i}=e;if(Oh(i,r))return;let a=i.console.variables.find(r);if(a===void 0)return;let o=n(a.value);return Dh(i,r)?o:void 0}function Ah(e){let t=f(e);return o(t===`true`?`1`:t===`false`?`0`:t)}function jh(e){let t=/* @__PURE__ */ new Map,n=(e,n)=>{e.console.variables.unwatch(n);let r=t.get(n);r!==void 0&&(t.delete(n),e.deleteFunctionReference(r))},r=(e,t)=>{let{security:n,console:r}=e.manager;n.runAs(`system.console`,()=>r.executeDirect(t))},i=[S({name:`GET_CONVAR`,result:`char*`,params:[`char* varName`,`char* default_`]},(e,t,n)=>kh(e,t,e=>e)??n),S({name:`GET_CONVAR_INT`,result:`int`,params:[`char* varName`,`int default_`]},(e,t,n)=>kh(e,t,Ah)??n),S({name:`GET_CONVAR_FLOAT`,result:`float`,params:[`char* varName`,`float defaultValue`]},(e,t,n)=>kh(e,t,c)??n),S({name:`GET_CONVAR_BOOL`,result:`BOOL`,params:[`char* varName`,`bool defaultValue`]},(e,t,n)=>kh(e,t,e=>{let t=Ah(e);return t===void 0?void 0:t!==0})??n),S({name:`ADD_CONVAR_CHANGE_LISTENER`,result:`int`,params:[`char* conVarFilter`,`func handler`]},(e,r,i)=>{let{manager:a,resource:o}=e,s=$i(r??`*`),c=U(i,1);a.duplicateFunctionReference(c);let l=a.console.variables.watch(e=>{Dh(a,e)&&!Oh(a,e)&&s(e)&&a.invokeFunctionReference(c,E([e,``]))});return t.set(l,c),o.onStop.connect(()=>n(a,l)),l}),S({name:`REMOVE_CONVAR_CHANGE_LISTENER`,result:`void`,params:[`int cookie`]},(e,t)=>n(e.manager,t))];if(e===`client`)return i;let a=(e,t)=>S({name:e,result:`void`,params:[`char* varName`,`char* value`]},(e,n,i)=>r(e,[t,U(n,0),U(i,1)]));return[...i,a(`SET_CONVAR`,`set`),a(`SET_CONVAR_SERVER_INFO`,`sets`),a(`SET_CONVAR_REPLICATED`,`setr`),S({name:`SET_GAME_TYPE`,result:`void`,params:[`char* gametypeName`]},(e,t)=>r(e,[`set`,`gametype`,U(t,0)])),S({name:`SET_MAP_NAME`,result:`void`,params:[`char* mapName`]},(e,t)=>r(e,[`set`,`mapname`,U(t,0)])),S({name:`ENABLE_ENHANCED_HOST_SUPPORT`,result:`void`,params:[`bool enabled`]},(e,t)=>r(e,[`set`,`sv_enhancedHostSupport`,t?`1`:`0`]))]}function Mh(e,t){return e.manager.world.doors.get(t)}function Nh(e){if(e===`server`)return[];let t=(e,t,n)=>S({name:e,hash:t,result:`void`,params:[`Hash doorHash`,n===`state`?`int state`:`float value`,`BOOL requestDoor`,`BOOL forceUpdate`]},(e,t,r)=>{let i=Mh(e,t);i!==void 0&&(i[n]=r)});return[S({name:`ADD_DOOR_TO_SYSTEM`,hash:8036736002072363558n,result:`void`,params:[`Hash doorHash`,`Hash modelHash`,`float x`,`float y`,`float z`]},(e,t,n,r,i,a)=>{e.manager.world.doors.set(t,{model:n,x:r,y:i,z:a,state:0,automaticRate:0,automaticDistance:0,openRatio:0,holdOpen:!1,springRemoved:!1})}),S({name:`REMOVE_DOOR_FROM_SYSTEM`,hash:5065861373067882468n,result:`void`,params:[`Hash doorHash`]},(e,t)=>e.manager.world.doors.delete(t)),S({name:`IS_DOOR_REGISTERED_WITH_SYSTEM`,hash:13930693845672184001n,result:`BOOL`,params:[`Hash doorHash`]},(e,t)=>Mh(e,t)!==void 0),t(`DOOR_SYSTEM_SET_DOOR_STATE`,7758457796463198035n,`state`),t(`DOOR_SYSTEM_SET_AUTOMATIC_RATE`,270917550687784578n,`automaticRate`),t(`DOOR_SYSTEM_SET_AUTOMATIC_DISTANCE`,11213965044713518631n,`automaticDistance`),t(`DOOR_SYSTEM_SET_OPEN_RATIO`,13179498064365429932n,`openRatio`),...[[`DOOR_SYSTEM_GET_DOOR_STATE`,1588259609567639992n],[`DOOR_SYSTEM_GET_DOOR_PENDING_STATE`,5459072227459966793n]].map(([e,t])=>S({name:e,hash:t,result:`int`,params:[`Hash doorHash`]},(e,t)=>Mh(e,t)?.state??0)),S({name:`DOOR_SYSTEM_GET_AUTOMATIC_DISTANCE`,hash:16740239470930114383n,result:`float`,params:[`Hash doorHash`]},(e,t)=>Mh(e,t)?.automaticDistance??0),S({name:`DOOR_SYSTEM_GET_OPEN_RATIO`,hash:7298532234928514540n,result:`float`,params:[`Hash doorHash`]},(e,t)=>Mh(e,t)?.openRatio??0),S({name:`DOOR_SYSTEM_SET_HOLD_OPEN`,hash:15688035671099450944n,result:`void`,params:[`Hash doorHash`,`BOOL toggle`]},(e,t,n)=>{let r=Mh(e,t);r!==void 0&&(r.holdOpen=n)}),S({name:`DOOR_SYSTEM_SET_SPRING_REMOVED`,hash:14160971436433045848n,result:`void`,params:[`Hash doorHash`,`BOOL removed`]},(e,t,n)=>{let r=Mh(e,t);r!==void 0&&(r.springRemoved=n)}),S({name:`IS_DOOR_CLOSED`,hash:14209400576093299017n,result:`BOOL`,params:[`Hash doorHash`]},(e,t)=>(Mh(e,t)?.openRatio??0)===0),S({name:`DOOR_SYSTEM_GET_IS_PHYSICS_LOADED`,hash:16111572506586447156n,result:`BOOL`,params:[`Any p0`]},()=>!0),S({name:`DOOR_SYSTEM_FIND_EXISTING_DOOR`,hash:6385964303556313797n,result:`BOOL`,params:[`float x`,`float y`,`float z`,`Hash modelHash`,`Hash* outDoorHash`]},(e,t,n,r,i,a)=>{for(let[o,s]of e.manager.world.doors)if(s.model===i&&Math.hypot(s.x-t,s.y-n,s.z-r)<=.5)return a.set(o),!0;return!1})]}const W={automobile:0,bike:1,boat:2,door:3,heli:4,object:5,ped:6,pickup:7,pickupPlacement:8,plane:9,submarine:10,player:11,trailer:12,train:13},Ph=/* @__PURE__ */ new Map([[`automobile`,W.automobile],[`bike`,W.bike],[`boat`,W.boat],[`heli`,W.heli],[`plane`,W.plane],[`submarine`,W.submarine],[`trailer`,W.trailer],[`train`,W.train]]),G={none:0,ped:1,vehicle:2,object:3};function K(e){switch(e){case W.automobile:case W.bike:case W.boat:case W.heli:case W.plane:case W.submarine:case W.trailer:case W.train:return G.vehicle;case W.ped:case W.player:return G.ped;case W.object:case W.door:case W.pickup:return G.object;default:return G.none}}const Fh={unknown:0,mission:7};var Ih=class{token;client;guid=0;coords=void 0;constructor(e,t){this.token=e,this.client=t}},Lh=class{type;objectId;state;#e=void 0;firstOwner=void 0;firstOwnerDropped=!1;passedFilter=!0;hasSynced=!1;wantsReassign=!1;guid;deleting=!1;finalizing=!1;routingBucket=0;onOwned=[];bag=void 0;lastVehicle=-1;lastVehicleSeat=-1;lastVehiclePedWasIn=-1;occupants=Array(32).fill(0);lastOccupants=Array(32).fill(0);constructor(e,t,n){this.type=e,this.objectId=t,this.state=n}get owner(){return this.#e}set owner(e){this.#e=e,this.bag?.own(e)}get ownedByClientScript(){return this.firstOwner!==void 0&&this.state.scriptHash!==0}get valid(){return!this.deleting&&!this.finalizing}};const q=Math.fround;function Rh(e,t,n){let r=Math.trunc(q(q(e/54)+512)),i=Math.trunc(q(q(t/54)+512)),a=Math.trunc(q(q(n+1700)/69));return{sectorX:r,sectorY:i,sectorZ:a,x:q(e-q(q(r-512)*54)),y:q(t-q(q(i-512)*54)),z:q(n-q(q(a*69)-1700))}}function zh(e){return[q(q(q(e.sectorX-512)*54)+e.x),q(q(q(e.sectorY-512)*54)+e.y),q(q(q(e.sectorZ*69)+e.z)-1700)]}function Bh(e,t,n){let r=q((1<<e)-1);return q(q(Math.trunc(q(q(n/t)*r))/r)*t)}function Vh(e,t,n){let r=q((1<<e-1)-1);return q(q(Math.trunc(q(q(n/t)*r))/r)*t)}function Hh(e,t,n){let r=Rh(e,t,n);return{...r,x:Bh(12,54,r.x),y:Bh(12,54,r.y),z:Bh(12,69,r.z)}}const Uh=q(6.28318548);function Wh(e){return Vh(8,Uh,e)}const Gh=q(-1/1.414214),Kh=q(1/1.414214);function qh(e,t,n,r){let i=q(2047),a=[q(e),q(t),q(n),q(r)],o=0;for(let e=1;e<4;e++)Math.abs(a[e])>Math.abs(a[o])&&(o=e);let s=a[o]>=0?1:-1,[c,l,u]=a.filter((e,t)=>t!==o).map(e=>q(e*s)),d=e=>Math.floor(q(q(q(q(e-Gh)/q(Kh-Gh))*i)+.5));return{largest:o,a:d(c),b:d(l),c:d(u)}}function Jh(e){let t=q(2047),n=q(1/t),r=e=>q(q(q(e*n)*q(Kh-Gh))+Gh),i=r(e.a),a=r(e.b),o=r(e.c),s=q(Math.sqrt(q(q(q(1-q(i*i))-q(a*a))-q(o*o)))),c=[i,a,o],l=[];for(let t=0;t<4;t++)l.push(t===e.largest?s:c.shift());return l}function Yh(e){let t=q(q(e*q(.01745329252))*.5);return[0,0,q(Math.sin(t)),q(Math.cos(t))]}function Xh(e,t,n,r){let i=q(e*e),a=q(t*t),o=q(n*n),s=q(e*n),c=q(e*t),l=q(t*n),u=q(r*e),d=q(r*t),f=q(r*n),p=q(1-q(2*q(a+o))),m=q(2*q(c+f)),h=q(2*q(s-d)),g=q(2*q(c-f)),_=q(1-q(2*q(i+o))),ee=q(2*q(l+u)),te=q(2*q(s+d)),ne=q(2*q(l-u)),re=q(1-q(2*q(i+a))),ie=q(Math.atan2(-g,_)),v=q(Math.sqrt(q(q(h*h)+q(re*re)))),ae=q(Math.atan2(ee,v)),y=q(Math.sin(ie)),b=q(Math.cos(ie)),oe=q(Math.atan2(q(q(b*te)+q(y*ne)),q(q(b*p)+q(y*m)))),se=e=>q(e*q(57.29577951308232));return[se(ae),se(oe),se(ie)]}const Zh=q(Math.PI);function Qh(e){return q(e*180/Zh)}var $h=class{components=/* @__PURE__ */ new Map;props=/* @__PURE__ */ new Map;overlays=/* @__PURE__ */ new Map;faceFeatures=/* @__PURE__ */ new Map;hair=0;highlight=0;eyes=0;headBlend=[0,0,0,0,0,0,0,0,0];overlay(e){let t=this.overlays.get(e);return t===void 0&&(t={value:255,opacity:0,colourType:0,firstColour:0,secondColour:0},this.overlays.set(e,t)),t}};const eg=[657415,1708816,2497301,3351579,4140064,4994598,5914672,6834999,7755326,8675910,9662543,10649435,11570534,12360562,13085055,13743756,14336923,14864298,15326139,15721932,16051933,4004370,5382682,7023388,8729630,10370848,12078372,13393708,14251837,14914910,3874639,5580911,7485856,9523911,11894496,7149638,10231646,13184891,14899868,15765437,1780843,2311326,3106761,5215203,8830448,1003351,1407616,2073507,1923628,2787900,5749063,10802750,15255082,15769892,15232287,13185054,2829101,4474183,6250595,8158592,10263968,12369343,14343132,15987697],tg=[5901588,8000032,10165034,12067642,13579079,14699612,15494519,15962776,7017528,9182539,11348578,13188474,14440593,15234984,15833280,16235222,8006164,10238492,12537638,14247221,15237196,15768683,16103311,16372148,4006937,5715242,7620922,9396045,11040611,12554365,13871768,15058615,3806784,5382232,7089267,8862095,10505896,12020669,13340625,14661347,1187146,1715307,2245007,2972595,4487628,6592477,9090538,11784692,932401,1332550,1863772,2460787,3647115,5946788,8835517,11920599,4009746,6178843,8413734,10518069,12557132,14071405,15257494,16115396],ng=/* @__PURE__ */ new Map([[0,[`V`]],[18,[`RETURN`,`SPACE`]],[19,[`LMENU`]],[20,[`Z`]],[21,[`LSHIFT`]],[22,[`SPACE`]],[23,[`F`]],[26,[`C`]],[29,[`B`]],[32,[`W`]],[33,[`S`]],[34,[`A`]],[35,[`D`]],[36,[`LCONTROL`]],[37,[`TAB`]],[38,[`E`]],[44,[`Q`]],[45,[`R`]],[46,[`E`]],[47,[`G`]],[51,[`E`]],[52,[`Q`]],[56,[`F9`]],[57,[`F10`]],[63,[`A`]],[64,[`D`]],[71,[`W`]],[72,[`S`]],[73,[`X`]],[74,[`H`]],[75,[`F`]],[76,[`SPACE`]],[140,[`R`]],[157,[`1`]],[158,[`2`]],[159,[`6`]],[160,[`3`]],[161,[`7`]],[162,[`8`]],[163,[`9`]],[164,[`4`]],[165,[`5`]],[172,[`UP`]],[173,[`DOWN`]],[174,[`LEFT`]],[175,[`RIGHT`]],[176,[`RETURN`]],[177,[`BACK`,`ESCAPE`]],[178,[`DELETE`]],[182,[`L`]],[187,[`DOWN`]],[188,[`UP`]],[189,[`LEFT`]],[190,[`RIGHT`]],[191,[`RETURN`]],[194,[`BACK`]],[199,[`P`]],[200,[`ESCAPE`]],[201,[`RETURN`]],[202,[`BACK`,`ESCAPE`]],[244,[`M`]],[245,[`T`]],[246,[`Y`]],[249,[`N`]],[288,[`F1`]],[289,[`F2`]],[303,[`U`]],[311,[`K`]],[322,[`ESCAPE`]],[344,[`F11`]]]),rg=/* @__PURE__ */ new Map([[30,[`A`,`D`]],[31,[`W`,`S`]],[59,[`A`,`D`]]]);var ig=class{#e=/* @__PURE__ */ new Set;#t=/* @__PURE__ */ new Set;#n=/* @__PURE__ */ new Set;#r=/* @__PURE__ */ new Set;#i=/* @__PURE__ */ new Set;#a=/* @__PURE__ */ new Set;#o=!1;mappings=/* @__PURE__ */ new Map;map(e,t,n,r,i){this.mappings.set(t,{resource:e,command:t,description:n,mapper:r.toLowerCase(),key:i.toUpperCase()})}keyDown(e){let t=e.toUpperCase();return this.#e.has(t)?[]:(this.#e.add(t),this.#r.add(t),this.#c(t).map(({command:e})=>e))}keyUp(e){let t=e.toUpperCase();return this.#e.delete(t)?(this.#i.add(t),this.#c(t).filter(({command:e})=>e.startsWith(`+`)).map(({command:e})=>`-${e.slice(1)}`)):[]}frame(){this.#t=new Set(this.#r),this.#n=new Set(this.#i),this.#r.clear(),this.#i.clear(),this.#a.clear(),this.#o=!1}disable(e){this.#a.add(e)}enable(e){this.#a.delete(e)}disableAll(){this.#o=!0}enableAll(){this.#o=!1,this.#a.clear()}enabled(e){return!this.#o&&!this.#a.has(e)}pressed(e,t){return(t||this.enabled(e))&&this.#s(e).some(e=>this.#e.has(e))}justPressed(e,t){return(t||this.enabled(e))&&this.#s(e).some(e=>this.#t.has(e))}justReleased(e,t){return(t||this.enabled(e))&&this.#s(e).some(e=>this.#n.has(e))}normal(e,t){if(!t&&!this.enabled(e))return 0;let n=rg.get(e);return n===void 0?+!!this.pressed(e,!0):+!!this.#e.has(n[1])-!!this.#e.has(n[0])}#s(e){return ng.get(e)??rg.get(e)??[]}#c(e){return[...this.mappings.values()].filter(t=>t.mapper===`keyboard`&&t.key===e)}};function ag(e,t,n){return e<t?Math.min(e+n,t):Math.max(e-n,t)}function og(e,t,n){let r=t.normal(30,!1),i=-t.normal(31,!1);if(r===0&&i===0||e.frozen){e.speed=0;return}e.speed=t.pressed(21,!1)?7:5;let a=e.speed*n/Math.hypot(r,i);e.rotation=mh(Math.atan2(-r,i)*180/Math.PI),e.moveTo(Math.fround(e.x+r*a),Math.fround(e.y+i*a),e.z)}function sg(e,t,n){let{parts:r}=e,i=r.engineOn&&!r.undriveable&&r.engineHealth>0&&!e.frozen,a=i&&t.pressed(71,!1),o=i&&t.pressed(72,!1),{speed:s}=e;if(s=r.handbrake?ag(s,0,14*n):a&&!o?ag(s,35,(s<0?14:6)*n):o&&!a?ag(s,-10,(s>0?14:6)*n):ag(s,0,2*n),e.speed=s,s===0)return;let c=Math.min(Math.abs(s)/5,1)*Math.sign(s),l=t.normal(59,!1)*80*c*n;e.rotation=mh(dh(e.rotation)-l);let[u,d]=uh(e.rotation,0,s*n,0);e.moveTo(Math.fround(e.x+u),Math.fround(e.y+d),e.z)}function cg(e,t,n){let{vehicle:r}=e;r===void 0?og(e,t,n):e.seat===-1&&sg(r,t,n)}var lg=class{#e=0;#t=0;#n=0;#r=0;level(e){let t=(e-this.#n)*this.#r;return this.#t>this.#e?Math.min(this.#t,this.#e+t):Math.max(this.#t,this.#e-t)}fade(e,t,n){this.#e=t>0?this.level(n):e,this.#t=e,this.#n=n,this.#r=t>0?1/t:0}fadesTo(e){return this.#t===e}};function ug(e){let t=dh(e.rotation),n=K(e.type),r=e.vehicle?.objectId;return{position:Hh(e.x,e.y,e.z),orientation:n===G.ped?{kind:`heading`,heading:Wh(Math.fround((t>180?t-360:t)*Math.PI/180))}:{kind:`quaternion`,quaternion:qh(...ph(e.rotation))},model:e.model,popType:e.type===W.player?Fh.unknown:Fh.mission,scriptHash:e.script===void 0?0:x(e.script),...n===G.ped?{health:e.health,maxHealth:e.maxHealth,armour:e.armour,vehicle:r??-1,vehicleSeat:r===void 0?-1:e.seat+2,weapon:e.weapon}:n===G.vehicle?{health:e.health,plate:e.plate,plateIndex:e.plateIndex}:{}}}function dg(e,t){return JSON.stringify(e)===JSON.stringify(t)}const fg=/* @__PURE__ */ new Map([[x(`STRING`),`~a~`],[x(`TWOSTRINGS`),`~a~~a~`],[x(`SANAND`),`San Andreas`]]);var pg=class{#e=/* @__PURE__ */ new Map;#t;addLabel(e,t){this.#e.set(e>>>0,t)}label(e){let t=x(e);return this.#e.get(t)??fg.get(t)}begin(e){this.#t={label:e,components:[]}}add(e){this.#t?.components.push(e)}end(){let e=this.#t;if(this.#t=void 0,e===void 0)return``;let t=e.components.values();return(this.label(e.label)??`NULL`).replace(/~a~|~1~/g,e=>t.next().value??e)}};const mg=86400;var hg=class{#e=43200;#t=0;#n=2e3;#r=!1;overridden=!1;seconds(e){let t=this.#r?0:Math.floor((e-this.#t)*60/this.#n);return((this.#e+t)%mg+mg)%mg}set(e,t,n,r){this.#e=(e*60+t)*60+n,this.#t=r}add(e,t,n,r){this.set(e,t,n+this.seconds(r),r)}get msPerMinute(){return this.#n}setMsPerMinute(e,t){e<=0||(this.set(0,0,this.seconds(t),t),this.#n=e)}pause(e,t){this.set(0,0,this.seconds(t),t),this.#r=e}},gg=class{#e=x(`CLEAR`);#t=this.#e;#n=0;#r=0;override;previous(e){return this.override??this.#i(e)}get next(){return this.override??this.#t}turn(e,t,n){this.#e=t>0?this.#i(n):e,this.#t=e,this.#n=n,this.#r=Math.max(t,0)}#i(e){return e-this.#n>=this.#r?this.#t:this.#e}},_g=class{engineOn=!1;autoStart=!0;engineHealth=1e3;bodyHealth=1e3;petrolTankHealth=1e3;dirtLevel=0;fuelLevel=65;oilLevel=5;primaryColour=0;secondaryColour=0;pearlescentColour=0;wheelColour=0;interiorColour=0;dashboardColour=0;customPrimary=void 0;customSecondary=void 0;tyreSmoke=[255,255,255];neonColour=[255,0,255];neonLights=/* @__PURE__ */ new Set;xenonColour=255;customXenon=void 0;windowTint=-1;wheelType=0;wheelSize=0;wheelWidth=0;livery=-1;roofLivery=-1;modKit=65535;mods=/* @__PURE__ */ new Map;toggledMods=/* @__PURE__ */ new Set;extras=/* @__PURE__ */ new Map;doorLock=0;openDoors=/* @__PURE__ */ new Set;brokenDoors=/* @__PURE__ */ new Set;smashedWindows=/* @__PURE__ */ new Set;rolledDownWindows=/* @__PURE__ */ new Set;tyresCanBurst=!0;burstTyres=/* @__PURE__ */ new Map;wheelHealth=/* @__PURE__ */ new Map;lights=0;siren=!1;alarm=!1;handbrake=!1;undriveable=!1;handling=/* @__PURE__ */ new Map;fix(){this.engineHealth=this.bodyHealth=this.petrolTankHealth=1e3,this.brokenDoors.clear(),this.smashedWindows.clear(),this.burstTyres.clear(),this.wheelHealth.clear()}};const vg=x(`WEAPON_UNARMED`),yg=x(`player_zero`),bg=new Set([`player_zero`,`mp_m_freemode_01`,`mp_f_freemode_01`,`a_m_y_skater_01`,`a_m_y_skater_02`,`a_m_y_hipster_01`,`a_m_y_hipster_02`].map(x)),xg=48271,Sg=2147483647;var Cg=class{type;model;handle=0;x=0;y=0;z=0;rotation=nh;frozen=!1;visible=!0;speed=0;alpha=255;collision=!0;attachedTo=void 0;attachments=/* @__PURE__ */ new Set;objectId=void 0;script=void 0;owner=void 0;creationToken=void 0;health;maxHealth;armour=0;configFlags=/* @__PURE__ */ new Set;appearance=new $h;weapons=/* @__PURE__ */ new Map;weapon=vg;vehicle=void 0;seat=-1;anim=void 0;secondaryAnim=void 0;lastVehicle=void 0;occupants=/* @__PURE__ */ new Map;lastOccupants=/* @__PURE__ */ new Map;parts=new _g;plate=``;plateIndex=0;syncedVehicle=void 0;constructor(e,t){this.type=e,this.model=t,this.health=this.maxHealth=K(e)===G.ped?200:1e3}moveTo(e,t,n){let[r,i,a]=[e-this.x,t-this.y,n-this.z];this.x=e,this.y=t,this.z=n;for(let r of this.occupants.values())r.moveTo(e,t,n);for(let e of this.attachments)e.moveTo(e.x+r,e.y+i,e.z+a)}face(e,t){this.rotation=mh(Math.atan2(this.x-e,t-this.y)*180/Math.PI)}attachTo(e,t,n,r){for(let t=e;t!==void 0;t=t.attachedTo)if(t===this)return;this.detach(),this.attachedTo=e,e.attachments.add(this);let[i,a,o]=uh(e.rotation,t,n,r);this.moveTo(e.x+i,e.y+a,e.z+o)}detach(){this.attachedTo?.attachments.delete(this),this.attachedTo=void 0}enterVehicle(e,t){this.leaveVehicle(),e.occupants.get(t)?.leaveVehicle(),this.vehicle=this.lastVehicle=e,this.seat=t,this.speed=0,e.occupants.set(t,this),e.lastOccupants.set(t,this),t===-1&&e.parts.autoStart&&(e.parts.engineOn=!0),this.moveTo(e.x,e.y,e.z)}leaveVehicle(){this.vehicle?.occupants.delete(this.seat),this.vehicle=void 0}take(e){this.moveTo(...zh(e.position));let{orientation:t}=e;this.rotation=t.kind===`heading`?mh(t.heading*180/Math.PI):fh(...Jh(t.quaternion)),this.model=e.model,this.health=e.health??this.health,this.maxHealth=e.maxHealth??this.maxHealth,this.armour=e.armour??this.armour,this.plate=e.plate??this.plate,this.plateIndex=e.plateIndex??this.plateIndex,this.weapon=e.weapon??this.weapon,e.vehicle!==void 0&&(this.syncedVehicle=[e.vehicle,e.vehicleSeat??-1])}};const wg={networked:()=>{},taken:()=>{},forgotten:()=>{}};var Tg=class{#e=new Ym(0);#t=/* @__PURE__ */ new Set;#n=/* @__PURE__ */ new Set;#r=/* @__PURE__ */ new Set;#i=/* @__PURE__ */ new Set;#a=/* @__PURE__ */ new Set;ipls=/* @__PURE__ */ new Set;#o=1;#s=1;#c=/* @__PURE__ */ new Map;#l=[];#u=/* @__PURE__ */ new Set;#d=!1;#f=/* @__PURE__ */ new Map;#p=[];#m=/* @__PURE__ */ new Set;#h=/* @__PURE__ */ new Map;playerPed=new Cg(W.player,yg);screen=new lg;screenBlurred=!1;blips=new Zm;text=new pg;input=new ig;doors=/* @__PURE__ */ new Map;cameras=new hh;clock=new hg;weather=new gg;tutorial=!1;playerInvincible=!1;playerControl=!0;#g=0;#_;constructor(e=wg){this.#_=e,this.add(this.playerPed)}get entities(){return this.#t.values()}get players(){return this.#h}enter(e,t,n){this.#h.set(e,{netId:t,name:n})}leave(e){let t=this.#h.get(e);this.#h.delete(e);let n=this.pedOf(t.netId);n!==void 0&&this.#x(n)}indexOf(e){for(let[t,n]of this.#h)if(n.netId===e)return t}pedOf(e){for(let t of this.#t)if(t.type===W.player&&t.owner===e)return t}add(e){e.handle=this.#e.add(e),this.#t.add(e),this.#n.add(e.model),this.#c.set(e.model,K(e.type)),K(e.type)===G.vehicle&&e.plate===``&&(e.plate=this.#v())}#v(){let e=e=>(this.#o=this.#o*xg%Sg,this.#o%e),t=()=>String(e(10)),n=()=>String.fromCharCode(65+e(26));return t()+t()+n()+n()+n()+t()+t()+t()}changePlayerModel(e){let t=this.playerPed;this.blips.forget(t),t.leaveVehicle(),t.lastVehicle=void 0,this.#e.delete(t.handle),t.handle=this.#e.add(t),t.model=e,this.#c.set(e,G.ped),t.health=t.maxHealth=200,t.armour=0,t.configFlags.clear(),t.appearance=new $h,t.weapons.clear(),t.weapon=vg}byHandle(e){return this.#e.get(e)}byObjectId(e){for(let t of this.#t)if(t.objectId===e)return t}remove(e){let t=this.#x(e),{objectId:n}=e;n!==void 0&&(t?this.#p.push(n):this.#b(n))}removedByServer(e){let t=this.byObjectId(e);t!==void 0&&(this.#x(t),this.#b(e))}removalTaken(e){this.#b(e)}receiveObjectIds(e){for(let t of e)this.#u.add(t);this.#l.push(...e),this.#d=!1}receiveClones(e,t){for(let n of e){if(n.kind===`remove`){this.removedByServer(n.objectId);continue}let e=this.byObjectId(n.objectId);n.kind===`create`&&e===void 0?(e=new Cg(n.type,n.state.model),e.objectId=n.objectId,this.add(e),this.#_.networked(e,!1),n.owner===t?this.#y(e,n.state):e.owner=n.owner,e.take(n.state)):e!==void 0&&n.owner!==t?(e.owner=n.owner,e.take(n.state)):e!==void 0&&(e.owner=void 0,this.#y(e,n.state),e.take(n.state))}for(let e of this.#t){if(e.syncedVehicle===void 0)continue;let[t,n]=e.syncedVehicle,r=t===-1?void 0:this.byObjectId(t);(r!==void 0||t===-1)&&(e.syncedVehicle=void 0,r===void 0?e.leaveVehicle():(e.vehicle!==r||e.seat!==n-2)&&e.enterVehicle(r,n-2))}}get canNetwork(){return this.#l.length>0}network(e){e.objectId=this.#l.shift(),this.#_.networked(e,!0)}creationTaken(e){let t=this.byObjectId(e);t!==void 0&&this.#_.taken(t)}release(e){for(let t of this.#t)t.script===e&&(t.script=void 0);this.blips.release(e),this.cameras.release(e)}request(e){this.#n.has(e)||this.#r.add(e)}requestAsset(e,t){let n=`${e}:${t.toLowerCase()}`;this.#i.has(n)||this.#a.add(n)}assetLoaded(e,t){return this.#i.has(`${e}:${t.toLowerCase()}`)}loaded(e){return this.#n.has(e)}kindOf(e){return this.#c.get(e)??(bg.has(e)?G.ped:G.none)}random(){return this.#s=this.#s*xg%Sg,(this.#s-1)/2147483646}seedRandom(e){let t=(e%Sg+Sg)%Sg;this.#s=t===0?1:t}tick(e,t=!0){let n=(e-this.#g)/1e3;this.#g=e;let r=this.playerPed;t&&this.playerControl&&r.health>=100?cg(r,this.input,n):r.speed=0,this.input.frame();for(let e of this.#r)this.#n.add(e);this.#r.clear();for(let e of this.#a)this.#i.add(e);this.#a.clear()}sync(){this.playerPed.objectId===void 0&&this.network(this.playerPed);let e=this.#p.splice(0).map(e=>({kind:`remove`,objectId:e}));for(let t of this.#t){let{objectId:n}=t;if(n===void 0||t.owner!==void 0)continue;let r=ug(t),i=this.#f.get(t);if(i===void 0){let{creationToken:i}=t;e.push({kind:`create`,objectId:n,type:t.type,state:r,...i===void 0?{}:{creationToken:i}})}else(this.#m.has(t)||!dg(i,r))&&e.push({kind:`sync`,objectId:n,state:r});this.#f.set(t,r)}this.#m.clear();let t=!this.#d&&this.#l.length<4;return t&&(this.#d=!0),{clones:e,requestObjectIds:t}}#y(e,t){this.#f.set(e,t),this.#m.add(e)}#b(e){this.#u.has(e)&&this.#l.push(e)}#x(e){this.#_.forgotten(e),this.blips.forget(e),e.detach();for(let t of[...e.attachments])t.detach();e.leaveVehicle();for(let t of[...e.occupants.values()])t.leaveVehicle();for(let t of this.#t){t.lastVehicle===e&&(t.lastVehicle=void 0);for(let[n,r]of t.lastOccupants)r===e&&t.lastOccupants.delete(n)}return this.#t.delete(e),this.#e.delete(e.handle),this.#f.delete(e)}};const Eg=Math.fround(.01745329252);function Dg(e,t,n,r,i,a){return{position:Rh(t,n,r),orientation:{kind:`quaternion`,quaternion:qh(...Yh(a))},model:e,popType:Fh.mission,scriptHash:i}}function Og(e,t,n,r,i,a){return{position:Rh(t,n,r),orientation:{kind:`heading`,heading:Math.fround(a*Eg)},model:e,popType:Fh.mission,scriptHash:i}}function kg(e,t,n,r,i){return{position:Rh(t,n,r),orientation:{kind:`quaternion`,quaternion:qh(...Yh(0))},model:e,popType:Fh.unknown,scriptHash:i}}function Ag(e,t,n){let r=e.register(t);return n.bag={route:e=>r.addRoutingTarget(e.slot),unroute:e=>r.removeRoutingTarget(e.slot),own:e=>{r.owner=e===void 0?-1:e.slot},remove:()=>e.remove(t)},r}const jg=new TextEncoder,Mg=new TextDecoder;var Ng=class{#e;#t;#n=/* @__PURE__ */ new Map;#r=/* @__PURE__ */ new Map;#i=!1;#a=!1;#o=!1;#s;#c;#l=`Resource prevented connection.`;constructor(e,t){this.#e=e,this.#t=t}get deferred(){return this.#n.size>0}get completed(){return this.#o}cancel(){this.#p()}respondToCard(e){let t=this.#c;if(t===void 0)return;let n=jg.encode(e);this.#e.enqueue(()=>{let e=va(n);if(e===void 0)return;let r=Ga({type:`array`,items:[e,{type:`str`,bytes:n}]});this.#e.invokeFunctionReference(t,r)})}get handover(){return new Map([...this.#r].sort(([e],[t])=>p(e,t)))}callbacks(){let e=(e,t)=>this.#e.callbacks.create(n=>{let r=this.#e.currentResource?.name;if(!(this.#o||r===void 0))try{if(n.type!==`array`)throw new ks(`arguments that are no array, which msgpack fails to convert to a vector`);t(r,n.items)}catch(t){if(!(t instanceof ks))throw t;this.#u(`deferrals.${e}`,r,t)}});return{defer:e(`defer`,e=>{this.#n.set(e,{description:e,message:`Deferring connection...`,done:!1,rejected:!1}),this.#h()}),update:e(`update`,(e,t)=>{let n=this.#d(e);t.length===1&&(n.message=js(t[0]),this.#h())}),presentCard:e(`presentCard`,(e,t)=>{this.#d(e);let n=t[0];if(n===void 0)return;let r=n.type===`str`||n.type===`bin`?Za(n):Pg(n);r!==void 0&&this.#m(r);let i=t[1];i?.type===`ext`&&[10,11].includes(i.extension.type)&&this.#f(Mg.decode(i.extension.data))}),done:e(`done`,(e,t)=>{let n=this.#d(e);if(n.done=!0,t.length===1){let e=t[0];n.message=e.type===`str`?Za(e):`Unknown error`,n.rejected=!0}this.#h()}),handover:e(`handover`,(e,t)=>{try{for(let[e,n]of Fg(t[0])){let t=Qa(n);t!==void 0&&this.#r.set(e,t)}}catch(e){if(!(e instanceof TypeError))throw e}})}}get kickReason(){return this.#l}kickReasonCallback(){return this.#e.callbacks.create(e=>{try{if(e.type!==`array`)throw new ks(`arguments that are no array, which msgpack fails to convert to a vector`);e.items.length===1&&(this.#l=js(e.items[0]))}catch(e){if(!(e instanceof ks))throw e;this.#u(`setKickReason`,this.#e.currentResource?.name??``,e)}})}ranEvents(){this.#i=!0,this.#a&&this.#h(),this.#s!==void 0&&this.#m(this.#s)}#u(e,t,n){this.#e.output.diagnose(t,`${e} was given ${n.message}: msgpack throws then, which FiveRunner does not emulate, and it ignores the call.`)}#d(e){let t=this.#n.get(e);return t===void 0&&(t={description:``,message:``,done:!1,rejected:!1},this.#n.set(e,t)),t}#f(e){this.#e.duplicateFunctionReference(e);let t=this.#c;this.#c=e,t!==void 0&&this.#e.deleteFunctionReference(t)}#p(){this.#o=!0;let e=this.#c;this.#c=void 0,e!==void 0&&this.#e.deleteFunctionReference(e)}#m(e){this.#i?this.#o||this.#t.card(e):this.#s=e}#h(){if(!this.#i){this.#a=!0;return}let e=!0,t=``;for(let[n,r]of[...this.#n].sort(([e],[t])=>p(e,t)))if(r.done||(t+=`${r.description}: ${r.message}\n`,e=!1),r.rejected){this.#p(),this.#t.reject(r.message,n);return}e?(this.#p(),this.#t.resolve()):this.#t.message(t)}};function Pg(e){try{return Qa(e)}catch(e){throw e instanceof TypeError?new ks(`a card with a map whose keys are not all of the type of its first, which FiveM fails to convert to JSON`):e}}function Fg(e){if(e?.type!==`map`)throw TypeError(`The value is no map`);let t=/* @__PURE__ */ new Map;for(let[n,r]of e.entries){let e=Za(n);if(e===void 0)throw TypeError(`A key of the map is no string`);t.set(e,r)}return[...t].sort(([e],[t])=>p(e,t))}function Ig(e=`player`){return`license:${Zn(new TextEncoder().encode(e))}`}const Lg=65535,Rg={joined:4,asked:6},zg={resource:1,client:2,server:3,clientReplaced:4,connectionTimedOut:5,connectionTimedOutWithPendingCommands:6,serverShutdown:7,stateBagRateLimit:8,netEventRateLimit:9,latentNetEventRateLimit:10,commandRateLimit:11,oneSyncTooManyMissedFrames:12,netGameEventRateLimit:13},Bg=`__cfx_internal:server`;function Vg(e){for(let t=2048;t>=0;t--)if(t!==31&&!e(t))return t;return-1}function Hg(e){return e+1===65535?1:e+1}function Ug(e,t){return{player:String(t.netId),for:String(e.netId)}}var Wg=class{session;client;temporaryNetId;name;guid;identifiers;tokens;endpoint;ping=0;firstSeen;#e;#t;#n=`connecting`;#r=!1;#i;#a;#o;#s=/* @__PURE__ */ new Map;#c;constructor(e,t,n,r){this.session=e,this.client=t,this.temporaryNetId=n,this.#e=n,this.name=r.name??`player`,this.guid=r.guid??String(n),this.identifiers=[...r.identifiers??[]],this.tokens=[...r.tokens??[]],this.endpoint=r.endpoint??`127.0.0.1`,this.firstSeen=Math.trunc(e.server.time()),this.#t=this.firstSeen}get netId(){return this.#e}get state(){return this.#n}get connected(){return this.#e<Lg}get principals(){return[...this.identifiers.map(e=>`identifier.${e}`),`player.${this.#e}`]}get lastSeen(){return this.#t}get dropping(){return this.#r}get message(){return this.#i}get card(){return this.#a}get rejection(){return this.#o}get slot(){return this.#c}get handover(){return this.#s}quit(e=`Exiting`){this.session.drop(this,e,`__cfx_internal:client`,zg.client)}submitCard(e){this.session.submitCard(this,e)}touch(){this.#t=Math.trunc(this.session.server.time())}startDropping(){let e=this.#r;return this.#r=!0,e}update(e){this.#e=e.netId??this.#e,this.#n=e.state??this.#n,this.#i=e.message??this.#i,this.#a=e.card??this.#a,this.#o=e.rejection??this.#o,this.#s=e.handover??this.#s,this.#c=e.slot??this.#c}},Gg=class{server;#e=[];#t=/* @__PURE__ */ new Map;#n=1;#r=0;#i=/* @__PURE__ */ new Map;#a=/* @__PURE__ */ new Map;#o=/* @__PURE__ */ new Map;#s=``;constructor(e){if(e.side!==`server`)throw Error(`A session needs a server`);if(e.session!==void 0)throw Error(`The server has a session already`);this.server=e,e.joinSession(this),e.console.commands.onFallback.connect((t,n,r)=>{if(r===``)return!0;let i=E([this.#s]);return e.events.trigger(`__cfx_internal:commandFallback`,i,`internal-net:${r}`)},99999)}connect(e,t={}){if(e.side!==`client`)throw Error(`Only clients connect to servers`);if(e.session!==void 0)throw Error(`The client is connected already`);let n=new Wg(this,e,65536+this.#r++,t),r=this.#e.find(({guid:e})=>e===n.guid);return r!==void 0&&this.drop(r,`Reconnecting`,Bg,zg.clientReplaced),this.#e.push(n),this.#t.set(n.netId,n),e.joinSession(this),this.server.enqueue(()=>this.#l(n)),n}get players(){return this.#e.values()}player(e){return this.#t.get(e)}drop(e,t,n=Bg,r=zg.server){if(!this.#e.includes(e)||e.startDropping())return;let i=t===``?`Dropped.`:t;this.#i.get(e)?.cancel();let a=e.connected;if(a){let t=`internal-net:${e.netId}`;this.server.events.trigger(`playerDropped`,E([i,n,r]),t)}if(this.#p(e,`dropped`),a&&!this.server.oneSync){let t=E([e.netId,e.name,-1]);for(let{client:e}of this.#c())e.events.queue(`onPlayerDropped`,t,`net:${Lg}`)}}tick(){this.server.tick();for(let{client:e}of[...this.#e])e.tick()}#c(){return this.#e.filter(({state:e})=>e===`joined`)}#l(e){if(!this.#e.includes(e))return;let{server:t}=this,n=new Ng(t,{message:t=>e.update({message:t}),card:t=>e.update({card:t}),resolve:()=>this.#u(e,n),reject:t=>this.#d(e,t)});this.#i.set(e,n);let r=E([e.name,n.kickReasonCallback(),n.callbacks()]),i=t.events.trigger(`playerConnecting`,r,`internal-net:${e.netId}`);n.ranEvents(),!n.completed&&(i?n.deferred||(n.cancel(),this.#u(e,n)):(n.cancel(),this.#d(e,n.kickReason)))}#u(e,t){e.update({handover:t.handover}),this.server.enqueue(()=>this.#f(e))}#d(e,t){this.#p(e,`rejected`),e.update({rejection:t})}#f(e){if(!this.#e.includes(e))return;for(;this.#t.has(this.#n);)this.#n=Hg(this.#n);let t=this.#n;this.#n=Hg(t),this.#t.set(t,e),e.update({netId:t,state:`joined`}),this.server.oneSync&&(this.#_(e),this.server.gameState.addClient(e),this.#m(e,Rg.joined)),e.client.joinSession(this,e),e.client.takeServerVariables(this.server.replicatedVariables()),e.client.resetResources(),this.#o.set(e,/* @__PURE__ */ new Set),this.#b(e);let{events:n,oneSync:r}=this.server;if(n.trigger(`playerJoining`,E([String(e.temporaryNetId)]),`internal-net:${t}`),e.dropping)return;let i=`net:${Lg}`,a=(e,t,n)=>{e.state===`joined`&&e.client.events.queue(`onPlayerJoining`,E([t.netId,t.name,n]),i)};if(r)a(e,e,128);else{for(let t of this.#e)a(t,e,-1);for(let t of this.#e)a(e,t,-1)}}#p(e,t){this.#e.splice(this.#e.indexOf(e),1);for(let[t,n]of this.#t)n===e&&this.#t.delete(t);this.#i.delete(e),this.#o.delete(e);let n=e.state===`joined`,{slot:r}=e;if(r!==void 0){let{states:t}=this.server;t.unregisterTarget(r),t.remove(`player:${e.netId}`),this.#a.delete(r)}this.server.oneSync&&this.server.gameState.drop(e),e.update({state:t}),e.client.leaveSession(n)}#m(e,t){let n=this.server.gameState.grantObjectIds(e,t);this.#h(e,e=>e.receiveObjectIds(n))}#h(e,t){let n=e.client.world;e.client.receive(()=>t(n))}syncWorld(e){if(!this.server.oneSync)return;let{clones:t,requestObjectIds:n}=e.client.world.sync();(t.length!==0||n)&&this.server.receive(()=>{if(e.state!==`joined`)return;let r=this.server.gameState;for(let n of t)switch(n.kind){case`create`:r.receiveCreate(e,n.objectId,n.type,n.state,n.creationToken),this.#h(e,e=>e.creationTaken(n.objectId));break;case`sync`:r.receiveSync(e,n.objectId,n.state);break;default:r.receiveRemove(e,n.objectId),this.#h(e,e=>e.removalTaken(n.objectId))}n&&this.#m(e,Rg.asked)})}enterScope(e,t,n){let r=`net:${Lg}`;this.#g(e,i=>{i.enter(n,t.netId,t.name),e.client.states.register(`player:${t.netId}`,!0),e.client.events.queue(`onPlayerJoining`,E([t.netId,t.name,n]),r)}),this.server.states.get(`player:${t.netId}`)?.addRoutingTarget(e.slot),this.server.events.queue(`playerEnteredScope`,E([Ug(e,t)]))}leaveScope(e,t,n,r){let i=`net:${Lg}`;this.#g(e,r=>{r.leave(n),e.client.states.remove(`player:${t.netId}`),e.client.events.queue(`onPlayerDropped`,E([t.netId,t.name,n]),i)}),!r&&(this.server.states.get(`player:${t.netId}`)?.removeRoutingTarget(e.slot),this.server.events.queue(`playerLeftScope`,E([Ug(e,t)])))}#g(e,t){this.#h(e,n=>{e.client.world===n&&t(n)})}sendRpc(e,t){this.#g(e,()=>e.client.rpc.receive(t))}sendClones(e,t){this.#h(e,n=>n.receiveClones(t,e.netId))}#_(e){let t=Vg(e=>this.#a.has(e));e.update({slot:t}),this.#a.set(t,e);let{states:n}=this.server,r=n.register(`player:${e.netId}`);r.owner=t,r.addRoutingTarget(t),n.registerTarget(t)}sendStateBag(e,t,n,r){let i=this.#a.get(e);if(i===void 0)return;let a=new Uint8Array(r);i.client.receive(()=>i.client.states.receive(0,t,n,a))}receiveStateBag(e,t,n,r){let i=new Uint8Array(r),{server:a}=this;a.receive(()=>{let{slot:r}=e;a.strictStateBags||r===void 0||(a.states.get(t)===void 0&&this.#v(t),a.states.receive(r,t,n,i))})}#v(e){let t=/^entity:(-?\d+)/.exec(e)?.[1],n=t===void 0?NaN:Number(t);if(!(n>=-(2**31)&&n<2**31))return;let r=this.server.gameState.byObjectId(n);r!==void 0&&Ag(this.server.states,e,r)}replicateVariables(e){for(let{client:t}of this.#c())t.takeServerVariables(e)}submitCard(e,t){this.#i.get(e)?.respondToCard(t)}command(e,t){this.server.enqueue(()=>this.#y(e,t))}#y(e,t){let{server:n}=this,r=``;if(n.printer.within(t=>`forward:${e.netId}/${t}`,e=>{r+=e},()=>n.security.runAs(e.principals,()=>{this.#s=t;try{n.console.commands.invoke(t,String(e.netId))}finally{this.#s=``}})),r!==``&&e.state===`joined`){let t=`net:${Lg}`;e.client.events.queue(`__cfx_internal:serverPrint`,E([r]),t)}}resourceStarted(e){for(let t of this.#c()){let n=this.#o.get(t);n.has(e)||(n.add(e),this.#b(t,e))}}resourceStopped(e){for(let t of this.#c()){let{client:n}=t;n.enqueue(()=>{if(n.session!==void 0&&n.player!==t)return;let r=n.getResource(e);r===void 0?n.trace(`citizen-legacy-net-resources`,`Server requested resource ${e} to be stopped, but we don't know that resource\n`):r.stop()})}}#b(e,t){let{client:n}=e;n.enqueue(()=>{if(t!==void 0&&this.#o.get(e)?.delete(t),e.state!==`joined`)return;let r=this.server.resourcesForClients().filter(({name:e})=>t===void 0||e===t),i=r.map(({name:e})=>`${e} `).join(``);n.trace(`citizen-legacy-net-resources`,`Required resources: ${i}\n`);let a=[],o;for(let e of r){let t=n.getResource(e.name);t!==void 0&&n.removeResource(t);let r=n.getResource(e.name,!1);r!==void 0&&n.removeResource(r);try{a.push(n.addResource(e.name,e.packedForClients??{files:{}}))}catch(t){if(!(t instanceof Fo))throw t;o??={name:e.name,error:t}}}o===void 0?n.enqueue(()=>{for(let e of a)n.getResource(e.name,!1)===e&&(e.start()||n.output.diagnose(e.name,`FiveM's client would stop with the error "Couldn't start resource ${e.name}.", which FiveRunner does not emulate: it goes on.`))}):n.output.diagnose(o.name,`FiveM's client would stop with the error "Couldn't load resource ${o.name}: ${o.error.message}", and start none of the resources it downloaded. FiveRunner starts none of them, but goes on.`)})}};function Kg(e,t){return e.manager.session?.player(n(U(t,0)))}function qg(e,t){return e[t]??null}function Jg(e){return e.manager.session?.server.oneSync?128:0}function Yg(e){return e.manager.player!==void 0}function Xg(e){return Yg(e)&&e.manager.session.server.oneSync}function Zg(e,t){let{player:n,world:r}=e.manager,i=t&255;if(i===Jg(e))return{netId:n?.netId,ped:r.playerPed,name:n?.name??``};let a=r.players.get(i);if(a!==void 0)return{netId:a.netId,ped:r.pedOf(a.netId),name:a.name}}function Qg(e,t){return Yg(e)?Zg(e,t):void 0}function $g(e,t){return t===-1?e.manager.world.playerPed.handle:Zg(e,t)?.ped?.handle??0}function e_(e){return e===`client`?t_():n_()}function t_(){let e=e=>Jg(e),t=e=>Yg(e);return[S({name:`PLAYER_ID`,hash:5730343094349521110n,result:`Player`,params:[]},e),S({name:`GET_PLAYER_INDEX`,hash:11956428154230912141n,result:`Player`,params:[]},e),S({name:`PLAYER_PED_ID`,hash:15567071428299294886n,result:`Ped`,params:[]},e=>e.manager.world.playerPed.handle),S({name:`GET_PLAYER_PED`,hash:4874702607714914752n,result:`Ped`,params:[`Player playerId`]},$g),S({name:`GET_PLAYER_PED_SCRIPT_INDEX`,hash:5835191375820269281n,result:`Ped`,params:[`Player player`]},$g),S({name:`GET_PLAYER_NAME`,hash:7858190532816302584n,result:`char*`,params:[`Player player`]},(e,t)=>Zg(e,t)?.name??`**Invalid**`),S({name:`GET_NUMBER_OF_PLAYERS`,hash:4646729180006083606n,result:`int`,params:[]},e=>1+e.manager.world.players.size),S({name:`IS_PLAYER_PLAYING`,hash:6815464490581856410n,result:`BOOL`,params:[`Player player`]},(e,t)=>Zg(e,t)!==void 0),S({name:`NETWORK_IS_PLAYER_ACTIVE`,hash:13321598277342454069n,result:`BOOL`,params:[`Player player`]},(e,t)=>Qg(e,t)!==void 0),S({name:`NETWORK_IS_PLAYER_CONNECTED`,hash:10654421488304384465n,result:`BOOL`,params:[`Player player`]},(e,t)=>Qg(e,t)!==void 0),S({name:`NETWORK_IS_SESSION_STARTED`,hash:11377821997192667199n,result:`BOOL`,params:[]},t),S({name:`NETWORK_START_SOLO_TUTORIAL_SESSION`,hash:1720403143394771659n,result:`void`,params:[]},e=>{e.manager.world.tutorial=!0}),S({name:`NETWORK_END_TUTORIAL_SESSION`,hash:15037431150385394423n,result:`void`,params:[]},e=>{e.manager.world.tutorial=!1}),S({name:`NETWORK_IS_IN_TUTORIAL_SESSION`,hash:12511636424984419023n,result:`BOOL`,params:[]},e=>e.manager.world.tutorial),S({name:`NETWORK_IS_SESSION_ACTIVE`,hash:15581376729331042688n,result:`BOOL`,params:[]},t),S({name:`NETWORK_IS_IN_SESSION`,hash:14598176716237453591n,result:`BOOL`,params:[]},t),S({name:`NETWORK_GET_PLAYER_INDEX_FROM_PED`,hash:7786211388227125880n,result:`Player`,params:[`Ped ped`]},(e,t)=>{let{world:n}=e.manager,r=n.byHandle(t);return!Yg(e)||r?.type!==W.player?-1:r===n.playerPed?Jg(e):n.indexOf(r.owner)??-1}),S({name:`IS_PED_A_PLAYER`,hash:1320482904327632523n,result:`BOOL`,params:[`Ped ped`]},(e,t)=>e.manager.world.byHandle(t)?.type===W.player),S({name:`GET_PLAYER_SERVER_ID`,result:`int`,params:[`Player player`]},(e,t)=>Zg(e,t)?.netId??0),S({name:`GET_PLAYER_FROM_SERVER_ID`,result:`Player`,params:[`int serverId`]},(e,t)=>Yg(e)?t===e.manager.player.netId?Jg(e):e.manager.world.indexOf(t)??-1:-1),S({name:`GET_ACTIVE_PLAYERS`,result:`object`,params:[]},e=>Yg(e)?E([...e.manager.world.players.keys(),Jg(e)].sort((e,t)=>e-t)):E([])),S({name:`GET_PLAYER_FROM_STATE_BAG_NAME`,result:`int`,params:[`char* bagName`]},(e,t)=>{let r=U(t,0),{player:i,session:a}=e.manager;if(!r.startsWith(`player:`)||i===void 0||!a.server.oneSync)return 0;let o=n(r.slice(7))&65535;return o===i.netId?128:e.manager.world.indexOf(o)??0})]}function n_(){let e=[];return[S({name:`GET_PLAYER_NAME`,result:`char*`,params:[`char* playerSrc`]},(e,t)=>Kg(e,t)?.name??null),S({name:`GET_PLAYER_PED`,result:`Entity`,params:[`char* playerSrc`]},(e,t)=>{let n=Kg(e,t);return n===void 0?0:e.manager.gameState.playerHandleOf(n)}),S({name:`DOES_PLAYER_EXIST`,result:`BOOL`,params:[`char* playerSrc`]},(e,t)=>{let r=Kg(e,t);return r!==void 0&&r.netId===n(t)}),S({name:`GET_PLAYER_ROUTING_BUCKET`,result:`int`,params:[`char* playerSrc`]},(e,t)=>{let n=Kg(e,t);return n===void 0?0:e.manager.gameState.bucketOf(n)}),S({name:`SET_PLAYER_ROUTING_BUCKET`,result:`void`,params:[`char* playerSrc`,`int bucket`]},(e,t,n)=>{let r=Kg(e,t);if(r===void 0||n<0)return;let i=e.manager.gameState,a=i.bucketOf(r);i.setBucket(r,n),e.manager.events.trigger(`onPlayerBucketChange`,E([t,n,a]))}),S({name:`GET_PLAYER_GUID`,result:`char*`,params:[`char* playerSrc`]},(e,t)=>Kg(e,t)?.guid??null),S({name:`GET_NUM_PLAYER_IDENTIFIERS`,result:`int`,params:[`char* playerSrc`]},(e,t)=>Kg(e,t)?.identifiers.length??0),S({name:`GET_PLAYER_IDENTIFIER`,result:`char*`,params:[`char* playerSrc`,`int identiferIndex`]},(e,t,n)=>{let r=Kg(e,t);return r===void 0?null:qg(r.identifiers,n)}),S({name:`GET_PLAYER_IDENTIFIER_BY_TYPE`,result:`char*`,params:[`char* playerSrc`,`char* identifierType`]},(e,t,n)=>{let r=Kg(e,t);if(r===void 0)return null;let i=U(n,1);return r.identifiers.find(e=>e.startsWith(i))??null}),S({name:`GET_NUM_PLAYER_TOKENS`,result:`int`,params:[`char* playerSrc`]},(e,t)=>Kg(e,t)?.tokens.length??0),S({name:`GET_PLAYER_TOKEN`,result:`char*`,params:[`char* playerSrc`,`int index`]},(e,t,n)=>{let r=Kg(e,t);return r===void 0?null:qg(r.tokens,n)}),S({name:`GET_PLAYER_ENDPOINT`,result:`char*`,params:[`char* playerSrc`]},(e,t)=>Kg(e,t)?.endpoint??null),S({name:`GET_PLAYER_PING`,result:`int`,params:[`char* playerSrc`]},(e,t)=>Kg(e,t)?.ping??0),S({name:`GET_PLAYER_LAST_MSG`,result:`int`,params:[`char* playerSrc`]},(e,t)=>{let n=Kg(e,t);return n===void 0?2147483647:Math.trunc(e.manager.time())-n.lastSeen}),S({name:`GET_PLAYER_TIME_ONLINE`,result:`int`,params:[`char* playerSrc`]},(e,t)=>{let n=Kg(e,t);return n===void 0?0:Math.trunc((n.lastSeen-n.firstSeen)/1e3)}),S({name:`DROP_PLAYER`,result:`void`,sets:`BOOL`,params:[`char* playerSrc`,`char* reason`]},(e,t,n)=>{let r=Kg(e,t);if(r===void 0||!r.connected)return!1;let i=e.manager.currentResource?.name??``;return r.session.drop(r,U(n,1),i,zg.resource),!0}),S({name:`IS_PLAYER_ACE_ALLOWED`,result:`BOOL`,params:[`char* playerSrc`,`char* object`]},(e,t,n)=>{let r=Kg(e,t);if(r===void 0)return!1;let i=U(n,1),{security:a}=e.manager;return r.principals.some(e=>a.checkPrincipal(e,i))}),S({name:`GET_NUM_PLAYER_INDICES`,result:`int`,params:[]},t=>(e=Array.from(t.manager.session?.players??[]).filter(({connected:e})=>e),e.length)),S({name:`GET_PLAYER_FROM_INDEX`,result:`char*`,params:[`int index`]},(t,n)=>{let r=e[n];return r===void 0||r.session.player(r.netId)!==r?null:String(r.netId)})]}function J(e,t,n){return{name:e,kind:`context`,hash:t,params:n}}function r_(e,t,n){return{name:e,kind:`create`,hash:t,params:n}}const i_=[J(`SET_ENTITY_COORDS`,469568048723526251n,[`Entity entity`,`float xPos`,`float yPos`,`float zPos`,`BOOL alive`,`BOOL deadFlag`,`BOOL ragdollFlag`,`BOOL clearArea`]),J(`SET_ENTITY_ROTATION`,9593978580461510151n,[`Entity entity`,`float pitch`,`float roll`,`float yaw`,`int rotationOrder`,`BOOL bDeadCheck`]),J(`SET_ENTITY_VELOCITY`,2060884443309461871n,[`Entity entity`,`float x`,`float y`,`float z`]),J(`SET_ENTITY_HEADING`,10242646436556216334n,[`Entity entity`,`float heading`]),J(`FREEZE_ENTITY_POSITION`,4795391166277829702n,[`Entity entity`,`BOOL toggle`]),J(`APPLY_FORCE_TO_ENTITY`,14264742704217730328n,[`Entity entity`,`int forceType`,`float x`,`float y`,`float z`,`float offX`,`float offY`,`float offZ`,`int nComponent`,`BOOL bLocalForce`,`BOOL bLocalOffset`,`BOOL bScaleByMass`,`BOOL bPlayAudio`,`BOOL bScaleByTimeWarp`]),J(`SET_PLAYER_MODEL`,45540521788082230n,[`Player player`,`Hash model`]),J(`SET_PLAYER_CONTROL`,10174252221492641954n,[`Player player`,`BOOL bHasControl`,`int flags`]),J(`SET_PLAYER_INVINCIBLE`,2564000551796991966n,[`Player player`,`BOOL bInvincible`]),J(`SET_PLAYER_WANTED_LEVEL`,4179087318742194779n,[`Player player`,`int wantedLevel`,`BOOL delayedResponse`]),J(`CLEAR_PLAYER_WANTED_LEVEL`,12898964665736385689n,[`Player player`]),r_(`CREATE_PED_INSIDE_VEHICLE`,9068377762319815988n,[`Vehicle vehicle`,`int pedType`,`Hash modelHash`,`int seat`,`BOOL isNetwork`,`BOOL bScriptHostPed`]),J(`ADD_PED_DECORATION_FROM_HASHES`,6871673233298597945n,[`Ped ped`,`Hash collection`,`Hash overlay`]),J(`SET_PED_INTO_VEHICLE`,17823854667459462717n,[`Ped ped`,`Vehicle vehicle`,`int seatIndex`]),J(`SET_PED_HEAD_BLEND_DATA`,10670401406750737150n,[`Ped ped`,`int shapeFirstID`,`int shapeSecondID`,`int shapeThirdID`,`int skinFirstID`,`int skinSecondID`,`int skinThirdID`,`float shapeMix`,`float skinMix`,`float thirdMix`,`BOOL isParent`]),J(`SET_PED_HEAD_OVERLAY`,5256907375973354526n,[`Ped ped`,`int overlayID`,`int index`,`float opacity`]),J(`SET_PED_HAIR_TINT`,5548371331445766729n,[`Ped ped`,`int colorID`,`int highlightColorID`]),J(`SET_PED_HEAD_OVERLAY_COLOR`,5295097686177659218n,[`Ped ped`,`int overlayID`,`int colorType`,`int colorID`,`int secondColorID`]),J(`SET_PED_EYE_COLOR`,5815670529632284639n,[`Ped ped`,`int index`]),J(`SET_PED_FACE_FEATURE`,8189164646475760798n,[`Ped ped`,`int index`,`float scale`]),J(`SET_PED_DEFAULT_COMPONENT_VARIATION`,5039218013098765667n,[`Ped ped`]),J(`SET_PED_RANDOM_COMPONENT_VARIATION`,14459167355187903528n,[`Ped ped`,`int p1`]),J(`SET_PED_COMPONENT_VARIATION`,2750315038012726912n,[`Ped ped`,`int componentId`,`int drawableId`,`int textureId`,`int paletteId`]),J(`CLEAR_PED_PROP`,667629751983728494n,[`Ped ped`,`int propId`]),J(`SET_PED_RANDOM_PROPS`,14144293859224031942n,[`Ped ped`]),J(`SET_PED_PROP_INDEX`,10608065531555015519n,[`Ped ped`,`int componentId`,`int drawableId`,`int textureId`,`BOOL attach`]),J(`SET_PED_ARMOUR`,14888985593447081164n,[`Ped ped`,`int amount`]),J(`SET_PED_CAN_RAGDOLL`,12765514099411209770n,[`Ped ped`,`BOOL toggle`]),J(`SET_PED_CONFIG_FLAG`,1807067481085428835n,[`Ped ped`,`int flagId`,`BOOL value`]),J(`SET_PED_RESET_FLAG`,13972597501312313842n,[`Ped ped`,`int flagId`,`BOOL doReset`]),J(`SET_PED_TO_RAGDOLL`,12581363652839441482n,[`Ped ped`,`int minTime`,`int maxTime`,`int ragdollType`,`BOOL bAbortIfInjured`,`BOOL bAbortIfDead`,`BOOL bForceScriptControl`]),J(`SET_PED_TO_RAGDOLL_WITH_FALL`,15521149076023895752n,[`Ped ped`,`int minTime`,`int maxTime`,`int nFallType`,`float dirX`,`float dirY`,`float dirZ`,`float fGroundHeight`,`float grab1X`,`float grab1Y`,`float grab1Z`,`float grab2X`,`float grab2Y`,`float grab2Z`]),J(`GIVE_WEAPON_TO_PED`,13767458866752540619n,[`Ped ped`,`Hash weaponHash`,`int ammoCount`,`BOOL isHidden`,`BOOL bForceInHand`]),J(`GIVE_WEAPON_COMPONENT_TO_PED`,15665442664280656825n,[`Ped ped`,`Hash weaponHash`,`Hash componentHash`]),J(`REMOVE_WEAPON_FROM_PED`,5231435679784720824n,[`Ped ped`,`Hash weaponHash`]),J(`REMOVE_ALL_PED_WEAPONS`,17464388802800305651n,[`Ped ped`,`BOOL p1`]),J(`REMOVE_WEAPON_COMPONENT_FROM_PED`,2201109082612124681n,[`Ped ped`,`Hash weaponHash`,`Hash componentHash`]),J(`SET_CURRENT_PED_WEAPON`,12535367907453402124n,[`Ped ped`,`Hash weaponHash`,`BOOL bForceInHand`]),J(`SET_PED_AMMO`,1505728147329083929n,[`Ped ped`,`Hash weaponHash`,`int ammo`]),J(`TASK_REACT_AND_FLEE_PED`,8271025944283959729n,[`Ped ped`,`Ped fleeTarget`]),J(`TASK_SHOOT_AT_COORD`,5090980737222598918n,[`Ped ped`,`float x`,`float y`,`float z`,`int duration`,`Hash firingPattern`]),J(`TASK_SHOOT_AT_ENTITY`,637987121588266866n,[`Entity entity`,`Entity target`,`int duration`,`Hash firingPattern`]),J(`TASK_COMBAT_PED`,17394841866481616004n,[`Ped ped`,`Ped targetPed`,`int p2`,`int p3`]),J(`TASK_DRIVE_BY`,3425815346453651825n,[`Ped driverPed`,`Ped targetPed`,`Vehicle targetVehicle`,`float targetX`,`float targetY`,`float targetZ`,`float distanceToShoot`,`int pedAccuracy`,`BOOL p8`,`Hash firingPattern`]),J(`TASK_ENTER_VEHICLE`,13983202585294707880n,[`Ped ped`,`Vehicle vehicle`,`int timeout`,`int seatIndex`,`float speed`,`int flag`,`Any p6`]),J(`TASK_WARP_PED_INTO_VEHICLE`,11132063835731916420n,[`Ped ped`,`Vehicle vehicle`,`int seatIndex`]),J(`TASK_HANDS_UP`,17503999823725459728n,[`Ped ped`,`int duration`,`Ped facingPed`,`int p3`,`BOOL p4`]),J(`TASK_PLAY_ANIM`,16881741240819145620n,[`Ped ped`,`char* animDictionary`,`char* animationName`,`float blendInSpeed`,`float blendOutSpeed`,`int duration`,`int flag`,`float playbackRate`,`BOOL lockX`,`BOOL lockY`,`BOOL lockZ`]),J(`TASK_PLAY_ANIM_ADVANCED`,9497441865609983755n,[`Ped ped`,`char* animDictionary`,`char* animationName`,`float posX`,`float posY`,`float posZ`,`float rotX`,`float rotY`,`float rotZ`,`float blendInSpeed`,`float blendOutSpeed`,`int duration`,`Any flag`,`float animTime`,`Any p14`,`Any p15`]),J(`CLEAR_PED_TASKS`,16280297226355339981n,[`Ped ped`]),J(`CLEAR_PED_TASKS_IMMEDIATELY`,12295758863867781272n,[`Ped ped`]),J(`CLEAR_PED_SECONDARY_TASK`,1687984505842882311n,[`Ped ped`]),J(`TASK_EVERYONE_LEAVE_VEHICLE`,9192806827815412338n,[`Vehicle vehicle`]),J(`TASK_LEAVE_ANY_VEHICLE`,5786374414059643463n,[`Ped ped`,`int p1`,`int flags`]),J(`TASK_LEAVE_VEHICLE`,15266022280670526978n,[`Ped ped`,`Vehicle vehicle`,`int flags`]),J(`TASK_GO_STRAIGHT_TO_COORD`,15522596972595670923n,[`Ped ped`,`float x`,`float y`,`float z`,`float speed`,`int timeout`,`float targetHeading`,`float distanceToSlide`]),J(`TASK_GO_TO_COORD_ANY_MEANS`,6612490191631957640n,[`Ped ped`,`float x`,`float y`,`float z`,`float fMoveBlendRatio`,`Vehicle vehicle`,`BOOL bUseLongRangeVehiclePathing`,`int drivingFlags`,`float fMaxRangeToShootTargets`]),J(`TASK_GO_TO_ENTITY`,7640095384362883202n,[`Entity entity`,`Entity target`,`int duration`,`float distance`,`float speed`,`float p5`,`int p6`]),r_(`CREATE_VEHICLE`,12625226732244324784n,[`Hash modelHash`,`float x`,`float y`,`float z`,`float heading`,`BOOL isNetwork`,`BOOL netMissionEntity`]),J(`SET_VEHICLE_ALARM`,14836518586668520780n,[`Vehicle vehicle`,`BOOL state`]),J(`SET_VEHICLE_BODY_HEALTH`,13221730319678876379n,[`Vehicle vehicle`,`float value`]),J(`SET_VEHICLE_COLOURS`,5700796144468248065n,[`Vehicle vehicle`,`int colorPrimary`,`int colorSecondary`]),J(`SET_VEHICLE_COLOUR_COMBINATION`,3740465110043524657n,[`Vehicle vehicle`,`int colorCombination`]),J(`SET_VEHICLE_CUSTOM_PRIMARY_COLOUR`,8160934221331913706n,[`Vehicle vehicle`,`int r`,`int g`,`int b`]),J(`SET_VEHICLE_CUSTOM_SECONDARY_COLOUR`,3949330575929153364n,[`Vehicle vehicle`,`int r`,`int g`,`int b`]),J(`SET_VEHICLE_DIRT_LEVEL`,8778559758790880907n,[`Vehicle vehicle`,`float dirtLevel`]),J(`SET_VEHICLE_DOOR_BROKEN`,15336153818213079603n,[`Vehicle vehicle`,`int doorIndex`,`BOOL deleteDoor`]),J(`SET_VEHICLE_NUMBER_PLATE_TEXT`,10784026586230086215n,[`Vehicle vehicle`,`char* plateText`]),J(`SET_VEHICLE_DOORS_LOCKED`,13142674893052018598n,[`Vehicle vehicle`,`int doorLockStatus`]),r_(`CREATE_OBJECT`,5808896370743568450n,[`Hash modelHash`,`float x`,`float y`,`float z`,`BOOL isNetwork`,`BOOL netMissionEntity`,`BOOL doorFlag`])],a_=new Map(i_.map(e=>[e.hash,e])),o_=BigInt(x(`GET_PLAYER_FROM_SERVER_ID`));var s_=class{#e;#t=[];#n=/* @__PURE__ */ new WeakMap;constructor(e){this.#e=e}receive(e){let t=a_.get(e.hash),n=this.#r(e.resource);if(t===void 0||n===void 0)return;let r=[],i=[];for(let a of e.args)a.kind===`created`&&r.push(()=>this.#o(a.token)!==void 0),!(a.kind!==`hash`||a.hash===0&&t.kind!==`create`)&&(this.#i(n,()=>this.#c(n,this.#s(10825852671273492652n),[a.hash])),r.push(()=>this.#c(n,this.#s(10999174976919095634n),[a.hash])===!0),i.push(()=>this.#c(n,this.#s(16515533089562745515n),[a.hash])));this.#i(n,()=>this.#a(n,t,e,i),()=>r.every(e=>e()))}tick(){let e=[];for(let t=this.#t.shift();t!==void 0;t=this.#t.shift())this.#e.getResource(t.resource,!1)?.state===`started`&&(t.ready()?t.run():e.push(t));this.#t.push(...e)}#r(e){let t=x(e),n;for(let e of this.#e.resources)x(e.name)===t&&(n=e);return n}#i(e,t,n=()=>!0){this.#t.push({resource:e.name,run:t,ready:n})}#a(e,t,n,r){let i=this.#e.world,a=[];for(let t of n.args)switch(t.kind){case`player`:{let n=this.#c(e,this.#s(o_),[t.netId]);if(n===-1)return;a.push(n);break}case`entity`:a.push(i.byObjectId(t.objectId)?.handle??-1);break;case`created`:a.push(this.#o(t.token).handle);break;case`hash`:a.push(t.hash);break;default:a.push(t.value)}let{natives:o}=this.#e,s=o.byHash(n.hash)??o.byName(Me(t.name)),c;try{c=this.#c(e,s,a)}catch(e){let t=e instanceof Error?e.message:String(e);this.#e.trace(`gta-net-five`,`failure executing native rpc: ${t}\n`);return}let l=n.token===void 0?void 0:i.byHandle(c);l!==void 0&&(l.creationToken=n.token);for(let e of r)e()}#o(e){for(let t of this.#e.world.entities)if(t.creationToken===e&&t.objectId!==void 0)return t}#s(e){return this.#e.natives.byHash(e)}#c(e,t,n){let r=this.#l(e);if(t.impl===null){r.unimplemented(t.name,t.hash);return}let i=t.impl;return i(new Mt(r,e),...n)}#l(e){let t=this.#n.get(e);return t===void 0&&(t=new c_(this.#e,e.name),this.#n.set(e,t)),t}},c_=class{host={instanceId:1};#e;#t;#n=/* @__PURE__ */ new Set;constructor(e,t){this.#e=e,this.#t=t}get lua(){throw Error(`Natives that servers have clients run have no Lua state.`)}deserialize(){throw Error(`Natives that servers have clients run deserialize nothing.`)}trace(e){this.#e.log(`citizen-scripting-core`,e)}diagnose(e){this.#e.output.diagnose(this.#t,e)}emitWarning(e,t){this.#e.output.warn(this.#t,`[${e}] ${t}`)}unimplemented(e,t){this.#n.has(t)||(this.#n.add(t),this.diagnose(vi(e)))}};const l_=/* @__PURE__ */ new Set([`Entity`,`Ped`,`Vehicle`]);function u_(e){return e===`server`?i_.map(d_):[]}function d_(e){let t=e.params.map(bt),n=/* @__PURE__ */ new WeakSet;return{name:e.name,hash:BigInt(x(e.name)),result:e.kind===`create`?`Entity`:`void`,params:t.map(({type:e,name:t})=>({type:e===`Player`?`char*`:e,name:t})),luaName:Me(e.name),aliases:[],impl:(t,...r)=>{if(t.manager.oneSync)return e.kind===`create`?p_(t,e,r):f_(t,e,r);n.has(t.runtime)||(n.add(t.runtime),t.diagnose(`${Me(e.name)} is one of the natives that FiveM's server has clients run, which it does with OneSync alone: without it, FiveM's server has no handler for it, so it does nothing.`))}}}function f_(e,t,n){let{manager:r}=e,i=r.session,a=r.gameState,o=__(e,t,n);if(o===void 0)return;let s={hash:t.hash,resource:e.resource.name,args:o},c=o[0];if(c.kind===`player`){i.sendRpc(i.player(c.netId),s);return}let l=b_(e,n[0]),u=a.pendingOf(l);if(u!==void 0){t.name===`SET_ENTITY_COORDS`&&(u.coords=n.slice(1,4)),m_(e,u.client,s);return}let d=a.byHandle(l),f=d.owner;f===void 0?d.onOwned.push(t=>m_(e,t,s)):m_(e,f,s)}function p_(e,t,n){let{manager:r}=e,i=r.gameState,a=[...r.session?.players??[]],o=h_(t,n),s;if(o===void 0)s=a.find(e=>i.playerHandleOf(e)!==0);else if(s=a.filter(e=>e.slot!==void 0).map(t=>({player:t,distance:g_(e,t,o)})).sort((e,t)=>e.distance-t.distance)[0]?.player,s===void 0)return 0;let c=i.nextCreationToken(),l=__(e,t,n);return l===void 0?0:(m_(e,s,{hash:t.hash,resource:e.resource.name,token:c,args:l}),i.pend(c,s))}function m_(e,t,n){let r=e.manager.session;if(r===void 0)return;let i=t===void 0?[...r.players]:[t];for(let e of i)r.sendRpc(e,n)}function h_(e,t){let n=e.params.findIndex(e=>bt(e).type===`float`);return n===-1?void 0:t.slice(n,n+3)}function g_(e,t,[n,r,i]){let a=e.manager.gameState.byHandle(e.manager.gameState.playerHandleOf(t));if(a===void 0)return 1/0;let[o,s,c]=zh(a.state.position);return(o-n)**2+(s-r)**2+(c-i)**2}function __(e,t,n){let r=[];for(let[i,a]of t.params.entries()){let t=v_(e,bt(a).type,n[i],i);if(t===void 0)return;r.push(t)}return r}function v_(e,t,n,r){if(l_.has(t)){let t=e.manager.gameState,r=b_(e,n),i=t.byHandle(r);if(i!==void 0)return{kind:`entity`,objectId:i.objectId};let a=t.pendingOf(r);return a===void 0?void 0:{kind:`created`,token:a.token}}switch(t){case`Player`:{let t=e.manager.session?.player(y_(n,r));return t===void 0?void 0:{kind:`player`,netId:t.netId}}case`Hash`:return{kind:`hash`,hash:n};case`char*`:return{kind:`value`,value:U(n,r)};default:return{kind:`value`,value:n}}}function y_(e,t){let n=U(e,t),r=o(n);if(r===void 0)throw new Ke(s(n));return r}function b_(e,t){if(t>=131072)return t;let n=e.manager.session?.player(t);return n===void 0?t:e.manager.gameState.playerHandleOf(n)}const x_=new TextEncoder,S_=/* @__PURE__ */ new Map([[`CPed`,G.ped],[`CVehicle`,G.vehicle],[`CObject`,G.object],[`CNetObject`,G.object]]),C_=/* @__PURE__ */ new Set([`strict`,`no_dummy`,`relaxed`,`inactive`]);function w_(e){return e.manager.gameState}function Y(e,t){if(t===0)return;let n=w_(e).byHandle(t);if(n===void 0)throw new Ke(`Tried to access invalid entity: ${t}`);return n}function T_(e,t){let n=Y(e,t);return n!==void 0&&K(n.type)===G.ped?n.state:void 0}function E_(e){let{orientation:t}=e.state;if(t.kind===`heading`)return{x:0,y:0,z:Qh(t.heading)};let[n,r,i]=Xh(...Jh(t.quaternion));return{x:n,y:r,z:i}}function D_(e,t){let n=w_(e),r=[];for(let e of n.entities)e.valid&&K(e.type)===t&&r.push(n.handleOf(e));return E(r)}function O_(e){return x(e.resource.name)}function k_(e,t,n){let r=w_(e),i=r.create(t,n);return i===void 0?0:r.handleOf(i)}function X(e,t){return e.manager.world.byHandle(t)}function A_([e,t,n]){return{x:e,y:t,z:n}}const j_={x:0,y:0,z:0};function M_(e){return K(e.type)===G.ped?e.health<100:e.health<=0}function N_(e){return(e?.vehicle??e)?.speed??0}function P_(e,t){let n=X(e,t);return n===void 0||K(n.type)!==G.ped||M_(n)}const F_=/* @__PURE__ */ new Map([[`CPed`,G.ped],[`CVehicle`,G.vehicle],[`CObject`,G.object],[`CNetObject`,G.object],[`CPickup`,G.none]]);function I_(e,t,n,r,[i,a,o],s,c){let l=e.manager.world;if(!l.loaded(r))return e.diagnose(`${t} was given a model that is not loaded, so it created nothing and returned 0, as GTA V does: request it with RequestModel, then wait until HasModelLoaded says it loaded.`),0;let u=c&&Xg(e);if(u&&!l.canNetwork)return e.diagnose(`${t} was asked to network the entity, but the client has no object id left to network it with, so it created nothing and returned 0: clients get 4 object ids as they join, and 6 more at their next tick each time they have fewer than 4.`),0;let d=new Cg(n,r);return d.moveTo(i,a,o),d.rotation=mh(s),d.script=e.resource.name,l.add(d),u&&l.network(d),d.handle}function L_(e){return e===`client`?R_():V_()}function R_(){let e=(e,t,n)=>S({name:e,hash:t,result:`BOOL`,params:[`Entity entity`]},(e,t)=>{let r=X(e,t);return r!==void 0&&K(r.type)===n}),t=(e,t,[n,r],[i,a])=>{let o=(e,n)=>{let r=X(e,n);return t===`Ped ped`&&r!==void 0&&K(r.type)!==G.ped?void 0:r};return[S({name:n,hash:r,result:`int`,params:[t]},(t,n)=>o(t,n)?.[e]??0),S({name:i,hash:a,result:`void`,params:[t,`int value`]},(t,n,r)=>{let i=o(t,n);i!==void 0&&(i[e]=r)})]},n=(e,t,n,r,i)=>{let a=X(e,t);a?.leaveVehicle(),a?.moveTo(n,r,i)};return[S({name:`DOES_ENTITY_EXIST`,hash:8230805619690780346n,result:`BOOL`,params:[`Entity entity`]},(e,t)=>X(e,t)!==void 0),S({name:`GET_ENTITY_COORDS`,hash:4607031842625162586n,result:`Vector3`,params:[`Entity entity`,`BOOL alive`]},(e,t)=>{let n=X(e,t);return n===void 0?j_:{x:n.x,y:n.y,z:n.z}}),S({name:`SET_ENTITY_COORDS`,hash:469568048723526251n,result:`void`,params:[`Entity entity`,`float xPos`,`float yPos`,`float zPos`,`BOOL alive`,`BOOL deadFlag`,`BOOL ragdollFlag`,`BOOL clearArea`]},n),S({name:`SET_ENTITY_COORDS_NO_OFFSET`,hash:2565419363613909893n,result:`void`,params:[`Entity entity`,`float x`,`float y`,`float z`,`BOOL keepTasks`,`BOOL keepIK`,`BOOL doWarp`]},n),S({name:`GET_ENTITY_HEADING`,hash:16734619320245782804n,result:`float`,params:[`Entity entity`]},(e,t)=>{let n=X(e,t);return n===void 0?0:dh(n.rotation)}),S({name:`SET_ENTITY_HEADING`,hash:10242646436556216334n,result:`void`,params:[`Entity entity`,`float heading`]},(e,t,n)=>{let r=X(e,t);r!==void 0&&(r.rotation=mh(n))}),S({name:`GET_ENTITY_ROTATION`,hash:12663385257975586489n,result:`Vector3`,params:[`Entity entity`,`int rotationOrder`]},(e,t,n)=>{let r=X(e,t);return r===void 0?j_:A_(lh(r.rotation,n))}),S({name:`SET_ENTITY_ROTATION`,hash:9593978580461510151n,result:`void`,params:[`Entity entity`,`float pitch`,`float roll`,`float yaw`,`int rotationOrder`,`BOOL bDeadCheck`]},(e,t,n,r,i,a)=>{let o=X(e,t);o!==void 0&&(o.rotation=ch(n,r,i,a))}),S({name:`GET_ENTITY_MODEL`,hash:11477336068289496245n,result:`Hash`,params:[`Entity entity`]},(e,t)=>X(e,t)?.model??0),S({name:`GET_ENTITY_TYPE`,hash:10001710134357738757n,result:`int`,params:[`Entity entity`]},(e,t)=>{let n=X(e,t);return n===void 0?G.none:K(n.type)}),e(`IS_ENTITY_A_PED`,5929769480716891198n,G.ped),e(`IS_ENTITY_A_VEHICLE`,7694118761768769374n,G.vehicle),e(`IS_ENTITY_AN_OBJECT`,10189615146141002062n,G.object),...t(`health`,`Entity entity`,[`GET_ENTITY_HEALTH`,17217360309205258761n],[`SET_ENTITY_HEALTH`,7743618636000454307n]),...t(`maxHealth`,`Entity entity`,[`GET_ENTITY_MAX_HEALTH`,1573822666447981628n],[`SET_ENTITY_MAX_HEALTH`,1616366714517706933n]),...t(`maxHealth`,`Ped ped`,[`GET_PED_MAX_HEALTH`,5116269594984730355n],[`SET_PED_MAX_HEALTH`,17723414459326929363n]),...t(`armour`,`Ped ped`,[`GET_PED_ARMOUR`,10701590112812511704n],[`SET_PED_ARMOUR`,14888985593447081164n]),S({name:`IS_ENTITY_DEAD`,hash:6887467227441538385n,result:`BOOL`,params:[`Entity entity`,`BOOL p1`]},(e,t)=>{let n=X(e,t);return n!==void 0&&M_(n)}),S({name:`IS_PED_INJURED`,hash:9557445016008013249n,result:`BOOL`,params:[`Ped ped`]},P_),S({name:`IS_PED_FATALLY_INJURED`,hash:15580560283690424960n,result:`BOOL`,params:[`Ped ped`]},P_),S({name:`IS_PED_DEAD_OR_DYING`,hash:3681656254872768568n,result:`BOOL`,params:[`Ped ped`,`BOOL checkMeleeDeathFlags`]},P_),S({name:`IS_PLAYER_DEAD`,hash:4777552329540785746n,result:`BOOL`,params:[`Player player`]},(e,t)=>{let n=X(e,$g(e,t));return n!==void 0&&M_(n)}),S({name:`SET_PED_CONFIG_FLAG`,hash:1807067481085428835n,result:`void`,params:[`Ped ped`,`int flagId`,`BOOL value`]},(e,t,n,r)=>{let i=X(e,t)?.configFlags;r?i?.add(n):i?.delete(n)}),S({name:`GET_PED_CONFIG_FLAG`,hash:9143768600959694099n,result:`BOOL`,params:[`Ped ped`,`int flagId`,`BOOL p2`]},(e,t,n)=>X(e,t)?.configFlags.has(n)??!1),S({name:`SET_ENABLE_HANDCUFFS`,hash:16076435279705359098n,result:`void`,params:[`Ped ped`,`BOOL toggle`]},(e,t,n)=>{let r=X(e,t)?.configFlags;n?r?.add(120):r?.delete(120)}),S({name:`IS_PED_CUFFED`,hash:8423237306564019845n,result:`BOOL`,params:[`Ped ped`]},(e,t)=>X(e,t)?.configFlags.has(120)??!1),S({name:`GET_ENTITY_SPEED`,hash:15349247917266452847n,result:`float`,params:[`Entity entity`]},(e,t)=>Math.abs(N_(X(e,t)))),S({name:`GET_ENTITY_VELOCITY`,hash:5189785806902891689n,result:`Vector3`,params:[`Entity entity`]},(e,t)=>{let n=X(e,t);return n===void 0?j_:A_(uh((n.vehicle??n).rotation,0,N_(n),0))}),...[[`IS_PED_RUNNING`,14206728153055832226n,e=>e>0&&e<7],[`IS_PED_SPRINTING`,6333283514708902248n,e=>e>=7],[`IS_PED_STILL`,12405487600806068608n,e=>e===0],[`IS_PED_STOPPED`,5983389407396798996n,e=>e===0]].map(([e,t,n])=>S({name:e,hash:t,result:`BOOL`,params:[`Ped ped`]},(e,t)=>{let r=X(e,t);return r!==void 0&&n(r.speed)})),S({name:`IS_VEHICLE_STOPPED`,hash:6278497493873644922n,result:`BOOL`,params:[`Vehicle vehicle`]},(e,t)=>X(e,t)?.speed===0),...[[`IS_PED_WALKING`,16018204685783205658n],[`IS_PED_RAGDOLL`,5180522170171546453n]].map(([e,t])=>S({name:e,hash:t,result:`BOOL`,params:[`Ped ped`]},()=>!1)),S({name:`RESURRECT_PED`,hash:8195582117541601333n,result:`void`,params:[`Ped ped`]},(e,t)=>{let n=X(e,t);n!==void 0&&K(n.type)===G.ped&&(n.health=n.maxHealth)}),S({name:`NETWORK_RESURRECT_LOCAL_PLAYER`,hash:16871544814804643067n,result:`void`,params:[`float x`,`float y`,`float z`,`float heading`]},(e,t,n,r,i)=>{let a=e.manager.world.playerPed;a.leaveVehicle(),a.moveTo(t,n,r),a.rotation=mh(i),a.health=a.maxHealth}),S({name:`FREEZE_ENTITY_POSITION`,hash:4795391166277829702n,result:`void`,params:[`Entity entity`,`BOOL toggle`]},(e,t,n)=>{let r=X(e,t);r!==void 0&&(r.frozen=n)}),S({name:`IS_ENTITY_POSITION_FROZEN`,result:`BOOL`,params:[`Entity entity`]},(e,t)=>X(e,t)?.frozen??!1),S({name:`ENSURE_ENTITY_STATE_BAG`,result:`void`,params:[`Entity entity`]},(e,t)=>{X(e,t)!==void 0&&e.manager.states.register(`localEntity:${t}`,!1)}),S({name:`SET_ENTITY_VISIBLE`,hash:16869464999882091451n,result:`void`,params:[`Entity entity`,`BOOL toggle`,`BOOL unk`]},(e,t,n)=>{let r=X(e,t);r!==void 0&&(r.visible=n)}),S({name:`IS_ENTITY_VISIBLE`,hash:5176593366545292405n,result:`BOOL`,params:[`Entity entity`]},(e,t)=>X(e,t)?.visible??!1),S({name:`GET_ENTITY_FORWARD_VECTOR`,hash:754716164444708753n,result:`Vector3`,params:[`Entity entity`]},(e,t)=>{let n=X(e,t);return n===void 0?j_:A_(uh(n.rotation,0,1,0))}),S({name:`GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS`,hash:1772715284438788168n,result:`Vector3`,params:[`Entity entity`,`float offsetX`,`float offsetY`,`float offsetZ`]},(e,t,n,r,i)=>{let a=X(e,t);if(a===void 0)return j_;let[o,s,c]=uh(a.rotation,n,r,i);return A_([a.x+o,a.y+s,a.z+c])}),S({name:`NETWORK_GET_ENTITY_OWNER`,result:`int`,params:[`Entity entity`]},(e,t)=>{let n=X(e,t);return n?.objectId===void 0?-1:n.owner===void 0?Jg(e):e.manager.world.indexOf(n.owner)??255}),S({name:`CREATE_VEHICLE`,hash:12625226732244324784n,result:`Vehicle`,params:[`Hash modelHash`,`float x`,`float y`,`float z`,`float heading`,`BOOL isNetwork`,`BOOL netMissionEntity`]},(e,t,n,r,i,a,o)=>I_(e,`CreateVehicle`,W.automobile,t,[n,r,i],a,o)),S({name:`CREATE_PED`,hash:15321134921733597150n,result:`Ped`,params:[`int pedType`,`Hash modelHash`,`float x`,`float y`,`float z`,`float heading`,`BOOL isNetwork`,`BOOL bScriptHostPed`]},(e,t,n,r,i,a,o,s)=>I_(e,`CreatePed`,W.ped,n,[r,i,a],o,s)),...[[`CREATE_OBJECT`,5808896370743568450n,`CreateObject`],[`CREATE_OBJECT_NO_OFFSET`,11108492561942820996n,`CreateObjectNoOffset`]].map(([e,t,n])=>S({name:e,hash:t,result:`Object`,params:[`Hash modelHash`,`float x`,`float y`,`float z`,`BOOL isNetwork`,`BOOL netMissionEntity`,`BOOL doorFlag`]},(e,t,r,i,a,o)=>I_(e,n,W.object,t,[r,i,a],0,o))),...[[`DELETE_ENTITY`,12555119163340016073n,`Entity* entity`,void 0,`DeleteEntity`],[`DELETE_VEHICLE`,16877355631701828943n,`Vehicle* vehicle`,G.vehicle,`DeleteVehicle`],[`DELETE_PED`,10814314362921280843n,`Ped* ped`,G.ped,`DeletePed`],[`DELETE_OBJECT`,6025265325407423391n,`Object* object`,G.object,`DeleteObject`]].map(([e,t,n,r,i])=>S({name:e,hash:t,result:`void`,params:[n]},(e,t)=>{let n=e.manager.world,a=X(e,t.get());a===void 0||r!==void 0&&K(a.type)!==r||a!==n.playerPed&&(a.owner===void 0?a.script===void 0?e.diagnose(`${i} was given an entity that is no mission entity, which GTA V does not delete: make it one with SetEntityAsMissionEntity(entity, true, true) first.`):(n.remove(a),t.set(0)):e.diagnose(`${i} was given an entity that another client owns, which GTA V does not delete until it has control of it.`))})),S({name:`SET_ENTITY_AS_MISSION_ENTITY`,hash:12498487530917625361n,result:`void`,params:[`Entity entity`,`BOOL scriptHostObject`,`BOOL bGrabFromOtherScript`]},(e,t,n,r)=>{let i=X(e,t);i===void 0||i.script!==void 0&&!r||(i.script=e.resource.name)}),S({name:`IS_ENTITY_A_MISSION_ENTITY`,hash:755240282434935612n,result:`BOOL`,params:[`Entity entity`]},(e,t)=>X(e,t)?.script!==void 0),...[[`SET_ENTITY_AS_NO_LONGER_NEEDED`,13201920304224023247n,`Entity* entity`,void 0],[`SET_VEHICLE_AS_NO_LONGER_NEEDED`,7105548214330024505n,`Vehicle* vehicle`,G.vehicle],[`SET_PED_AS_NO_LONGER_NEEDED`,2708314027382316259n,`Ped* ped`,G.ped],[`SET_OBJECT_AS_NO_LONGER_NEEDED`,4243004287814575078n,`Object* object`,G.object]].map(([e,t,n,r])=>S({name:e,hash:t,result:`void`,params:[n]},(e,t)=>{let n=X(e,t.get());n===void 0||r!==void 0&&K(n.type)!==r||n.script===e.resource.name&&(n.script=void 0)})),S({name:`GET_ENTITY_SCRIPT`,hash:12027359293266032456n,result:`char*`,params:[`Entity entity`,`ScrHandle* script`]},(e,t)=>X(e,t)?.script??null),S({name:`GET_GAME_POOL`,result:`object`,params:[`char* poolName`]},(e,t)=>{let n=U(t,0),r=F_.get(n);if(r===void 0)throw new Ke(`Invalid pool: ${n}`);let i=[];for(let t of e.manager.world.entities)K(t.type)===r&&(n!==`CNetObject`||t.objectId!==void 0)&&i.push(t.handle);return E(i)}),...B_(),...z_(),S({name:`HAS_COLLISION_LOADED_AROUND_ENTITY`,hash:16818533798995768097n,result:`BOOL`,params:[`Entity entity`]},(e,t)=>X(e,t)!==void 0)]}function z_(){let e=(e,t,n,r)=>{let i=X(e,n);return i===void 0||r!==void 0&&K(i.type)!==r?0:i.objectId===void 0?(e.diagnose(`${t} was given an entity that is not networked, which has no network id: FiveRunner returns 0.`),0):i.objectId},t=(e,t,n)=>{let r=e.manager.world.byObjectId(t);return r===void 0||n!==void 0&&K(r.type)!==n?0:r.handle},n=(e,n)=>t(e,n)!==0,r=e=>e!==void 0&&e.owner===void 0;return[S({name:`NETWORK_GET_NETWORK_ID_FROM_ENTITY`,hash:11607747012039726172n,result:`int`,params:[`Entity entity`]},(t,n)=>e(t,`NetworkGetNetworkIdFromEntity`,n)),...[[`VEH_TO_NET`,13027019417800884636n,`Vehicle vehicle`,G.vehicle,`VehToNet`],[`PED_TO_NET`,1071509001333212809n,`Ped ped`,G.ped,`PedToNet`],[`OBJ_TO_NET`,11078816139353253185n,`Object object`,G.object,`ObjToNet`]].map(([t,n,r,i,a])=>S({name:t,hash:n,result:`int`,params:[r]},(t,n)=>e(t,a,n,i))),S({name:`NETWORK_GET_ENTITY_FROM_NETWORK_ID`,hash:14865922340470912352n,result:`Entity`,params:[`int netId`]},(e,n)=>t(e,n)),...[[`NET_TO_VEH`,3925893566760105484n,`Vehicle`,G.vehicle],[`NET_TO_PED`,13676752553518992190n,`Ped`,G.ped],[`NET_TO_OBJ`,15587344650859760447n,`Object`,G.object],[`NET_TO_ENT`,13834683421016262986n,`Entity`,void 0]].map(([e,n,r,i])=>S({name:e,hash:n,result:r,params:[`int netHandle`]},(e,n)=>t(e,n,i))),S({name:`NETWORK_DOES_NETWORK_ID_EXIST`,hash:4093234165679461188n,result:`BOOL`,params:[`int netId`]},n),S({name:`NETWORK_DOES_ENTITY_EXIST_WITH_NETWORK_ID`,hash:1775681623300832616n,result:`BOOL`,params:[`int netId`]},n),S({name:`NETWORK_GET_ENTITY_IS_NETWORKED`,hash:14376186384880618616n,result:`BOOL`,params:[`Entity entity`]},(e,t)=>X(e,t)?.objectId!==void 0),S({name:`NETWORK_HAS_CONTROL_OF_ENTITY`,hash:125925576390379655n,result:`BOOL`,params:[`Entity entity`]},(e,t)=>r(X(e,t))),S({name:`NETWORK_REQUEST_CONTROL_OF_ENTITY`,hash:13155885047170474823n,result:`BOOL`,params:[`Entity entity`]},(e,t)=>r(X(e,t))),S({name:`NETWORK_HAS_CONTROL_OF_NETWORK_ID`,hash:5563642154429010310n,result:`BOOL`,params:[`int netId`]},(e,t)=>r(e.manager.world.byObjectId(t))),S({name:`NETWORK_REQUEST_CONTROL_OF_NETWORK_ID`,hash:11993283059155729360n,result:`BOOL`,params:[`int netId`]},(e,t)=>r(e.manager.world.byObjectId(t))),S({name:`NETWORK_REGISTER_ENTITY_AS_NETWORKED`,hash:502904344163126442n,result:`void`,params:[`Entity entity`]},(e,t)=>{let n=X(e,t);n!==void 0&&n.objectId===void 0&&e.manager.world.network(n)})]}function B_(){let e=[],t=(e,t)=>{let n=e.manager.world;for(;++t.index<t.entities.length;){let e=t.entities[t.index];if(n.byHandle(e.handle)===e)return e.handle}return-1};return[[`PED`,G.ped],[`VEHICLE`,G.vehicle],[`OBJECT`,G.object],[`PICKUP`,G.none]].flatMap(([n,r])=>[S({name:`FIND_FIRST_${n}`,result:`int`,params:[`Entity* outEntity`]},(n,i)=>{let a=0;for(;a<64&&e[a]!==void 0;)a++;if(a===64)return-1;let o={entities:[...n.manager.world.entities].filter(e=>K(e.type)===r),index:-1},s=t(n,o);return i.set(s),s===-1?-1:(e[a]=o,a)}),S({name:`FIND_NEXT_${n}`,result:`BOOL`,params:[`int findHandle`,`Entity* outEntity`]},(r,i,a)=>{let o=i>>>0;if(o>=64)return!1;let s=e[o];if(s===void 0)return r.diagnose(`FindNext${n[0]}${n.slice(1).toLowerCase()} was given the handle of a search that ended, which FiveM's game reads past and crashes on. FiveRunner returns false.`),!1;let c=t(r,s);return a.set(c),c!==-1}),S({name:`END_FIND_${n}`,result:`void`,params:[`int findHandle`]},(t,n)=>{let r=n>>>0;r<64&&(e[r]=void 0)})])}function V_(){return[S({name:`DOES_ENTITY_EXIST`,result:`BOOL`,params:[`Entity entity`]},(e,t)=>w_(e).byHandle(t)?.valid??!1),S({name:`ENSURE_ENTITY_STATE_BAG`,result:`void`,params:[`Entity entity`]},(e,t)=>{let n=Y(e,t);if(n===void 0||n.bag!==void 0)return;let r=Ag(e.manager.states,`entity:${n.objectId}`,n);r.addRoutingTarget(-1);for(let t of w_(e).knownBy(n))r.addRoutingTarget(t.slot);n.bag.own(n.owner)}),S({name:`NETWORK_GET_ENTITY_FROM_NETWORK_ID`,result:`Entity`,params:[`int netId`]},(e,t)=>{let n=w_(e),r=n.byObjectId(t);return r?.valid?n.handleOf(r):0}),S({name:`NETWORK_GET_NETWORK_ID_FROM_ENTITY`,result:`int`,params:[`Entity entity`]},(e,t)=>Y(e,t)?.objectId??0),S({name:`NETWORK_GET_ENTITY_OWNER`,result:`int`,params:[`Entity entity`]},(e,t)=>{let n=Y(e,t);return n===void 0?0:n.owner?.netId??-1}),S({name:`NETWORK_GET_FIRST_ENTITY_OWNER`,result:`int`,params:[`Entity entity`]},(e,t)=>{let n=Y(e,t);return n===void 0?0:n.firstOwner===void 0||n.firstOwnerDropped?-1:n.firstOwner.netId}),S({name:`GET_ENTITY_COORDS`,result:`Vector3`,params:[`Entity entity`]},(e,t)=>{let n=w_(e),r=b_(e,t);if(e.manager.oneSync&&n.byHandle(r)===void 0){let[e,t,i]=n.pendingOf(r)?.coords??[0,0,0];return{x:e,y:t,z:i}}let i=Y(e,t);if(i===void 0)return{x:0,y:0,z:0};let[a,o,s]=zh(i.state.position);return{x:a,y:o,z:s}}),S({name:`GET_ENTITY_ROTATION`,result:`Vector3`,params:[`Entity entity`]},(e,t)=>{let n=Y(e,t);return n===void 0?{x:0,y:0,z:0}:E_(n)}),S({name:`GET_ENTITY_HEADING`,result:`float`,params:[`Entity entity`]},(e,t)=>{let n=Y(e,t);if(n===void 0)return 0;let{z:r}=E_(n);return r<0?Math.fround(360+r):r}),S({name:`GET_ENTITY_POPULATION_TYPE`,result:`int`,params:[`Entity entity`]},(e,t)=>Y(e,t)?.state.popType??0),S({name:`GET_ENTITY_ROUTING_BUCKET`,result:`int`,params:[`Entity entity`]},(e,t)=>Y(e,t)?.routingBucket??0),S({name:`SET_ENTITY_ROUTING_BUCKET`,result:`void`,params:[`Entity entity`,`int bucket`]},(e,t,n)=>{let r=Y(e,t);if(r===void 0)return;let i=r.routingBucket;n>=0&&(r.routingBucket=n),e.manager.events.trigger(`onEntityBucketChange`,E([t>>>0,n,i]))}),S({name:`SET_ROUTING_BUCKET_ENTITY_LOCKDOWN_MODE`,result:`void`,params:[`int bucketId`,`char* mode`]},(e,t,n)=>{let r=U(n,1);C_.has(r)&&w_(e).setLockdown(t,r)}),S({name:`SET_ROUTING_BUCKET_POPULATION_ENABLED`,result:`void`,params:[`int bucketId`,`BOOL mode`]},()=>{}),S({name:`GET_ENTITY_MODEL`,result:`Hash`,params:[`Entity entity`]},(e,t)=>Y(e,t)?.state.model??0),S({name:`GET_ENTITY_SCRIPT`,result:`char*`,params:[`Entity entity`]},(e,t)=>{let n=Y(e,t);if(n===void 0)return null;for(let t of e.manager.resources)if(x(x_.encode(t.name).subarray(0,63))===n.state.scriptHash)return t.name;return null}),S({name:`GET_VEHICLE_TYPE`,result:`char*`,params:[`Vehicle vehicle`]},(e,t)=>{let n=Y(e,t);if(n===void 0)return null;for(let[e,t]of Ph)if(t===n.type)return e;return null}),S({name:`GET_ENTITY_TYPE`,result:`int`,params:[`Entity entity`]},(e,t)=>{let n=Y(e,t);return n===void 0?0:K(n.type)}),S({name:`GET_NET_TYPE_FROM_ENTITY`,result:`int`,params:[`Entity entity`]},(e,t)=>Y(e,t)?.type??-1),S({name:`GET_ENTITY_HEALTH`,result:`int`,params:[`Entity entity`]},(e,t)=>{let n=Y(e,t);if(n===void 0)return 0;let r=K(n.type);return r===G.ped||r===G.vehicle?n.state.health??0:0}),S({name:`GET_ENTITY_MAX_HEALTH`,result:`int`,params:[`Entity entity`]},(e,t)=>T_(e,t)?.maxHealth??0),S({name:`GET_PED_ARMOUR`,result:`int`,params:[`Ped ped`]},(e,t)=>T_(e,t)?.armour??0),S({name:`GET_GAME_POOL`,result:`object`,params:[`char* poolName`]},(e,t)=>D_(e,S_.get(U(t,0))??G.none)),S({name:`GET_ALL_PEDS`,result:`object`,params:[]},e=>D_(e,G.ped)),S({name:`GET_ALL_VEHICLES`,result:`object`,params:[]},e=>D_(e,G.vehicle)),S({name:`GET_ALL_OBJECTS`,result:`object`,params:[]},e=>D_(e,G.object)),S({name:`DELETE_ENTITY`,result:`void`,params:[`Entity entity`]},(e,t)=>{let n=Y(e,t);n!==void 0&&w_(e).delete(n)}),S({name:`CREATE_VEHICLE_SERVER_SETTER`,result:`Vehicle`,params:[`Hash modelHash`,`char* type`,`float x`,`float y`,`float z`,`float heading`]},(e,t,n,r,i,a,o)=>{let s=U(n,1),c=Ph.get(s);if(c===void 0)throw new Ke(`CREATE_VEHICLE_SERVER_SETTER: Invalid entity type ${s}`);return k_(e,c,Dg(t,r,i,a,O_(e),o))}),S({name:`CREATE_PED`,result:`Ped`,params:[`int pedType`,`Hash modelHash`,`float x`,`float y`,`float z`,`float heading`,`BOOL isNetwork`,`BOOL bScriptHostPed`]},(e,t,n,r,i,a,o)=>k_(e,W.ped,Og(n,r,i,a,O_(e),o))),S({name:`CREATE_OBJECT_NO_OFFSET`,result:`Object`,params:[`Hash modelHash`,`float x`,`float y`,`float z`,`BOOL isNetwork`,`BOOL netMissionEntity`,`BOOL doorFlag`]},(e,t,n,r,i)=>k_(e,W.object,kg(t,n,r,i,O_(e))))]}function Z(e,t,n){return S({name:e,...t===void 0?{}:{hash:t},result:`void`,params:n},()=>{})}function H_(e){if(e===`server`)return[];let t=/* @__PURE__ */ new WeakMap;return[Z(`SET_PARKED_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME`,16926459000783100701n,[`float multiplier`]),Z(`SET_PED_DENSITY_MULTIPLIER_THIS_FRAME`,10800711787831782642n,[`float multiplier`]),Z(`SET_RANDOM_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME`,12948752261143492563n,[`float multiplier`]),Z(`SET_SCENARIO_PED_DENSITY_MULTIPLIER_THIS_FRAME`,8815058788752046232n,[`float p0`,`float p1`]),Z(`SET_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME`,2619521048766764343n,[`float multiplier`]),Z(`SET_CREATE_RANDOM_COPS`,1165984467287626605n,[`BOOL toggle`]),Z(`SET_CREATE_RANDOM_COPS_NOT_ON_SCENARIOS`,9964643556797642471n,[`BOOL toggle`]),Z(`SET_CREATE_RANDOM_COPS_ON_SCENARIOS`,4921510630544283453n,[`BOOL toggle`]),Z(`SET_GARBAGE_TRUCKS`,3097765567273685773n,[`BOOL toggle`]),Z(`SET_FAR_DRAW_VEHICLES`,2752349403850161347n,[`BOOL toggle`]),Z(`REMOVE_VEHICLES_FROM_GENERATORS_IN_AREA`,5089597142388722618n,[`float x1`,`float y1`,`float z1`,`float x2`,`float y2`,`float z2`,`Any p6`]),Z(`SET_VEHICLE_MODEL_IS_SUPPRESSED`,1135708215248050196n,[`Hash model`,`BOOL suppressed`]),Z(`SET_SCENARIO_GROUP_ENABLED`,200662747229742670n,[`char* scenarioGroup`,`BOOL enabled`]),Z(`SET_SCENARIO_TYPE_ENABLED`,16953779142900023009n,[`char* scenarioType`,`BOOL toggle`]),Z(`ENABLE_DISPATCH_SERVICE`,15857035167618947158n,[`int dispatchService`,`BOOL toggle`]),Z(`DISTANT_COP_CAR_SIRENS`,6134863619627039445n,[`BOOL value`]),Z(`SET_ROADS_IN_ANGLED_AREA`,1899007354032479065n,[`float x1`,`float y1`,`float z1`,`float x2`,`float y2`,`float z2`,`float width`,`BOOL unknown1`,`BOOL unknown2`,`BOOL unknown3`]),Z(`SET_MAX_WANTED_LEVEL`,12276534250078405817n,[`int maxWantedLevel`]),Z(`SET_RELATIONSHIP_BETWEEN_GROUPS`,13773674009954236333n,[`int relationship`,`Hash group1`,`Hash group2`]),Z(`SET_DISCORD_APP_ID`,void 0,[`char* appId`]),Z(`SET_DISCORD_RICH_PRESENCE_ACTION`,void 0,[`int index`,`char* label`,`char* url`]),Z(`SET_DISCORD_RICH_PRESENCE_ASSET`,void 0,[`char* assetName`]),Z(`SET_DISCORD_RICH_PRESENCE_ASSET_SMALL`,void 0,[`char* assetName`]),Z(`SET_DISCORD_RICH_PRESENCE_ASSET_SMALL_TEXT`,void 0,[`char* text`]),Z(`SET_DISCORD_RICH_PRESENCE_ASSET_TEXT`,void 0,[`char* text`]),Z(`SET_RICH_PRESENCE`,void 0,[`char* presenceState`]),Z(`HIDE_HUD_COMPONENT_THIS_FRAME`,7495895348773880760n,[`int id`]),Z(`DISPLAY_AMMO_THIS_FRAME`,11954677266752150613n,[`BOOL display`]),Z(`_HUD_WEAPON_WHEEL_IGNORE_SELECTION`,791590050914061127n,[]),Z(`HIDE_HUD_AND_RADAR_THIS_FRAME`,8187532053442985248n,[]),...[[`TRIGGER_SCREENBLUR_FADE_IN`,11756825268821131228n,!0],[`TRIGGER_SCREENBLUR_FADE_OUT`,17270399324890869973n,!1]].map(([e,t,n])=>S({name:e,hash:t,result:`BOOL`,params:[`float transitionTime`]},e=>(e.manager.world.screenBlurred=n,!0))),S({name:`IS_SCREENBLUR_FADE_RUNNING`,hash:8872773480040538281n,result:`BOOL`,params:[]},()=>!1),Z(`DISABLE_IDLE_CAMERA`,void 0,[`BOOL state`]),Z(`DISABLE_VEHICLE_PASSENGER_IDLE_CAMERA`,void 0,[`BOOL state`]),Z(`SET_TIMECYCLE_MODIFIER`,3211975551654944577n,[`char* modifierName`]),Z(`SET_TIMECYCLE_MODIFIER_STRENGTH`,9432789202013202099n,[`float strength`]),Z(`SET_BIGMAP_ACTIVE`,2530054912743808399n,[`BOOL toggleBigMap`,`BOOL showFullMap`]),Z(`DISPLAY_RADAR`,11595565366281037459n,[`BOOL toggle`]),Z(`SET_FOLLOW_PED_CAM_VIEW_MODE`,6507594667565250308n,[`int viewMode`]),Z(`DRAW_MARKER`,2902427857584726153n,[`int type`]),Z(`DRAW_RECT`,4206795403398567152n,[`float x`,`float y`,`float width`,`float height`]),Z(`SET_SCRIPT_GFX_DRAW_ORDER`,7042254994863937538n,[`int drawOrder`]),Z(`SET_TEXT_RENDER_ID`,6851435361686548753n,[`int renderId`]),Z(`SET_USE_HI_DOF`,11617882012875573908n,[]),S({name:`IS_PAUSE_MENU_ACTIVE`,hash:12683062486377168843n,result:`BOOL`,params:[]},()=>!1),S({name:`GET_ASPECT_RATIO`,hash:17379530557664791943n,result:`float`,params:[`BOOL b`]},()=>1920/1080),Z(`SET_RAIN_LEVEL`,7223253640658701714n,[`float intensity`]),Z(`SET_SNOW_LEVEL`,9153165449383164954n,[`float level`]),Z(`SET_WIND`,12410360263898470681n,[`float speed`]),Z(`SET_WIND_SPEED`,17152501161601681404n,[`float speed`]),Z(`SET_WIND_DIRECTION`,16937831938213496104n,[`float direction`]),Z(`WATER_OVERRIDE_SET_STRENGTH`,14216184830359819280n,[`float strength`]),Z(`SET_ARTIFICIAL_LIGHTS_STATE`,1326417132894082308n,[`BOOL state`]),Z(`SET_ARTIFICIAL_LIGHTS_STATE_AFFECTS_VEHICLES`,16334986584629394738n,[`BOOL toggle`]),Z(`SET_AUDIO_FLAG`,13398162446994666074n,[`char* flagName`,`BOOL toggle`]),S({name:`START_AUDIO_SCENE`,hash:88524962657658098n,result:`BOOL`,params:[`char* scene`]},()=>!0),S({name:`CREATE_AUDIO_SUBMIX`,result:`int`,params:[`char* name`]},e=>{let n=t.get(e.manager)??0;return t.set(e.manager,n+1),n}),Z(`ADD_AUDIO_SUBMIX_OUTPUT`,void 0,[`int submixId`,`int outputSubmixId`]),Z(`SET_AUDIO_SUBMIX_EFFECT_PARAM_INT`,void 0,[`int submixId`,`int effectSlot`,`int paramIndex`,`int paramValue`]),Z(`SET_AUDIO_SUBMIX_EFFECT_RADIO_FX`,void 0,[`int submixId`,`int effectSlot`]),Z(`SET_AUDIO_SUBMIX_OUTPUT_VOLUMES`,void 0,[`int submixId`,`int outputSlot`,`float frontLeftVolume`,`float frontRightVolume`,`float rearLeftVolume`,`float rearRightVolume`,`float channel5Volume`,`float channel6Volume`]),S({name:`REQUEST_SCRIPT_AUDIO_BANK`,hash:3423943577717663365n,result:`BOOL`,params:[`char* audioBank`,`BOOL p1`,`Any p2`]},()=>!0),Z(`RELEASE_NAMED_SCRIPT_AUDIO_BANK`,8641588576275202416n,[`char* audioBank`]),Z(`STOP_ALL_ALARMS`,3420847337706966162n,[`BOOL stop`]),S({name:`PREPARE_ALARM`,hash:11345884900650014003n,result:`BOOL`,params:[`char* alarmName`]},()=>!0),Z(`SHUTDOWN_LOADING_SCREEN`,544582165167134263n,[]),Z(`SHUTDOWN_LOADING_SCREEN_NUI`,void 0,[]),Z(`SET_WEAPONS_NO_AUTORELOAD`,void 0,[`BOOL state`]),Z(`SET_WEAPONS_NO_AUTOSWAP`,void 0,[`BOOL state`]),Z(`TOGGLE_USE_PICKUPS_FOR_PLAYER`,void 0,[`int player`,`Hash pickupHash`,`BOOL toggle`]),Z(`DISABLE_PLAYER_VEHICLE_REWARDS`,13925902161512632927n,[`Player player`]),Z(`DISABLE_PLAYER_FIRING`,6804024751275371192n,[`Player player`,`BOOL toggle`]),Z(`TASK_STAND_STILL`,10492227417279764825n,[`Ped ped`,`int time`]),S({name:`GET_PED_PARACHUTE_STATE`,hash:8777473353230940598n,result:`int`,params:[`Ped ped`]},()=>-1),S({name:`IS_ENTITY_IN_WATER`,hash:14965638415315453347n,result:`BOOL`,params:[`Entity entity`]},()=>!1),S({name:`IS_PED_SWIMMING`,hash:11376980390135051458n,result:`BOOL`,params:[`Ped ped`]},()=>!1),S({name:`GET_PLAYER_SPRINT_STAMINA_REMAINING`,hash:4584408203958845143n,result:`float`,params:[`Player player`]},()=>0),S({name:`IS_PLAYER_SWITCH_IN_PROGRESS`,hash:15695836346704376671n,result:`BOOL`,params:[]},()=>!1),S({name:`IS_PLAYER_TELEPORT_ACTIVE`,hash:194031241483815023n,result:`BOOL`,params:[]},()=>!1),Z(`SET_ENTITY_INVINCIBLE`,4071836030646819540n,[`Entity entity`,`BOOL toggle`]),Z(`NETWORK_SET_FRIENDLY_FIRE_OPTION`,17872613597342980131n,[`BOOL toggle`]),Z(`SET_PLAYER_HEALTH_RECHARGE_MULTIPLIER`,6752691015583894065n,[`Player player`,`float regenRate`]),Z(`_SET_PLAYER_HEALTH_RECHARGE_LIMIT`,14089688388591795252n,[`Player player`,`float limit`]),Z(`SET_CAN_ATTACK_FRIENDLY`,12948353830549571421n,[`Ped ped`,`BOOL toggle`,`BOOL p2`]),Z(`SET_BLOCKING_OF_NON_TEMPORARY_EVENTS`,11496187148832857076n,[`Ped ped`,`BOOL toggle`]),Z(`TASK_START_SCENARIO_IN_PLACE`,1452976313881078745n,[`Ped ped`,`char* scenarioName`,`int unkDelay`,`BOOL playEnterAnim`]),S({name:`IS_PED_BEING_STUNNED`,hash:5745129553015312104n,result:`BOOL`,params:[`Ped ped`,`int p1`]},()=>!1),Z(`SET_FUEL_CONSUMPTION_RATE_MULTIPLIER`,void 0,[`float multiplier`]),Z(`SET_FUEL_CONSUMPTION_STATE`,void 0,[`BOOL state`]),S({name:`GET_GAME_BUILD_NUMBER`,result:`int`,params:[]},e=>{let t=e.manager.session?.server.console.variables.find(`sv_enforceGameBuild`);return ne(t?.value??``)||3258})]}const U_=new TextEncoder;function W_(){return new Ke(`bad cast`)}function G_(e){let t=Za(e);if(t===void 0)throw W_();return t}function K_(e){let t=/* @__PURE__ */ new Map;for(let[n,r]of e.entries)t.set(G_(n),r);return t}function q_(e,t){let n=qa(e);if(n.type!==`map`)throw new Ke(`invalid msgpack type`);let r=K_(n),i=e=>{let t=r.get(e);return t===void 0||t.type===`nil`?void 0:t},a=i(`method`),o=r.get(`headers`),s=[];if(o?.type===`map`){for(let[e,t]of K_(o))s.push([e,G_(t)]);s.sort(([e],[t])=>p(e,t))}let c=i(`url`),l=i(`data`);if(l!==void 0&&l.type!==`str`&&l.type!==`bin`)throw W_();let u=i(`followLocation`);if(u!==void 0&&u.type!==`boolean`)throw W_();let d=l?.bytes??/* @__PURE__ */ new Uint8Array;return{method:a===void 0?`GET`:G_(a),url:Cs(c===void 0?``:G_(c),t),headers:Ss(s,d.length>0),body:d,followLocation:u?.value??!1,timeout:5e3}}function J_(e){return{type:`str`,bytes:e}}function Y_(e){return{type:`positive`,value:BigInt(e)}}const X_={type:`nil`},Z_={type:`map`,entries:[]};function Q_(e){let t=/* @__PURE__ */ new Map;for(let[n,r]of e){let e=t.get(n);e===void 0?t.set(n,[r]):e.push(r)}return{type:`map`,entries:[...t.keys()].sort(p).map(e=>{let n=t.get(e).map(e=>J_(U_.encode(e)));return[J_(U_.encode(e)),n.length===1?n[0]:{type:`array`,items:n}]})}}function $_(e,t){let n;if(`code`in t)n=[Y_(e),Y_(0),X_,Z_,J_(U_.encode(bs(t)))];else if(t.status>=400){let r=U_.encode(`HTTP ${t.status}: `),i=new Uint8Array(r.length+t.body.length);i.set(r),i.set(t.body,r.length),n=[Y_(e),Y_(t.status),X_,Z_,J_(i)]}else n=[Y_(e),Y_(t.status),J_(t.body),Q_(t.headers),X_];return Ga({type:`array`,items:n})}function ev(){let e=0;return[S({name:`PERFORM_HTTP_REQUEST_INTERNAL_EX`,result:`int`,params:[`object requestData`]},(t,n)=>{let{manager:r,resource:i}=t,a=q_(U(n,0),r.primaryPort),o=e++;return r.http(a).then(e=>{r.events.queue(`__cfx_internal:httpResponse`,$_(o,e),``,i)}),o}),S({name:`SET_HTTP_HANDLER`,result:`void`,params:[`func handler`]},(e,t)=>{e.manager.httpServer?.setHandler(e.resource,U(t,0))})]}function tv(e){if(e===`server`)return[];let t=/* @__PURE__ */ new WeakMap,n=e=>{let n=t.get(e.manager);return n===void 0&&(n={entitySets:/* @__PURE__ */ new Map,targets:/* @__PURE__ */ new Map,linked:/* @__PURE__ */ new Set,nextId:2},t.set(e.manager,n)),n},r=(e,t,n,r)=>{let i=/* @__PURE__ */ new WeakSet;return S({name:e,hash:t,result:`Interior`,params:n},e=>(i.has(e.manager)||(i.add(e.manager),e.diagnose(`${r} found no interior, as FiveRunner has no map of GTA V and knows none of its interiors.`)),0))},i=(e,t)=>`${e}:${(t??``).toLowerCase()}`;return[r(`GET_INTERIOR_AT_COORDS`,12751933987834943939n,[`float x`,`float y`,`float z`],`GetInteriorAtCoords`),r(`GET_INTERIOR_AT_COORDS_WITH_TYPE`,411983278217074684n,[`float x`,`float y`,`float z`,`char* interiorType`],`GetInteriorAtCoordsWithType`),r(`GET_INTERIOR_FROM_ENTITY`,2380075781929936571n,[`Entity entity`],`GetInteriorFromEntity`),S({name:`IS_VALID_INTERIOR`,hash:2787982420646491347n,result:`BOOL`,params:[`Interior interior`]},()=>!1),S({name:`IS_INTERIOR_READY`,hash:7432836922140208910n,result:`BOOL`,params:[`Interior interior`]},()=>!0),S({name:`ACTIVATE_INTERIOR_ENTITY_SET`,hash:6190315277334034081n,result:`void`,params:[`Interior interior`,`char* entitySetName`]},(e,t,r)=>{let a=n(e).entitySets;a.set(i(t,r),a.get(i(t,r))??0)}),S({name:`DEACTIVATE_INTERIOR_ENTITY_SET`,hash:4759129920140927330n,result:`void`,params:[`Interior interior`,`char* entitySetName`]},(e,t,r)=>n(e).entitySets.delete(i(t,r))),S({name:`IS_INTERIOR_ENTITY_SET_ACTIVE`,hash:3888820095585132909n,result:`BOOL`,params:[`Interior interior`,`char* entitySetName`]},(e,t,r)=>n(e).entitySets.has(i(t,r))),S({name:`SET_INTERIOR_ENTITY_SET_COLOR`,hash:13975111697588294423n,result:`void`,params:[`Interior interior`,`char* entitySetName`,`int color`]},(e,t,r,a)=>{let o=n(e).entitySets;o.has(i(t,r))&&o.set(i(t,r),a)}),...[[`REFRESH_INTERIOR`,4752278595253525216n,[`Interior interior`]],[`CREATE_MODEL_HIDE`,9986658107151672440n,[`float x`,`float y`,`float z`,`float radius`,`Hash modelHash`]],[`REMOVE_MODEL_HIDE`,15700393205701531493n,[`float x`,`float y`,`float z`,`float radius`,`Hash modelHash`]],[`SET_ALL_PATHS_CACHE_BOUNDINGSTRUCT`,2490029257889631229n,[`BOOL toggle`]]].map(([e,t,n])=>S({name:e,hash:t,result:`void`,params:n},()=>{})),S({name:`IS_DLC_PRESENT`,hash:9306008721141064158n,result:`BOOL`,params:[`Hash dlcHash`]},()=>!0),S({name:`GET_DEFAULT_SCRIPT_RENDERTARGET_RENDER_ID`,hash:5976444026706024118n,result:`int`,params:[]},()=>1),S({name:`REGISTER_NAMED_RENDERTARGET`,hash:6330303121102888163n,result:`BOOL`,params:[`char* name`,`BOOL p1`]},(e,t)=>{let r=n(e),i=(t??``).toLowerCase();return i===``||r.targets.has(i)?!1:(r.targets.set(i,r.nextId++),!0)}),S({name:`IS_NAMED_RENDERTARGET_REGISTERED`,hash:8709077765568140980n,result:`BOOL`,params:[`char* name`]},(e,t)=>n(e).targets.has((t??``).toLowerCase())),S({name:`GET_NAMED_RENDERTARGET_RENDER_ID`,hash:1901777666213403707n,result:`int`,params:[`char* name`]},(e,t)=>n(e).targets.get((t??``).toLowerCase())??0),S({name:`RELEASE_NAMED_RENDERTARGET`,hash:16858943627931766228n,result:`BOOL`,params:[`char* name`]},(e,t)=>n(e).targets.delete((t??``).toLowerCase())),S({name:`LINK_NAMED_RENDERTARGET`,hash:17780385220993433389n,result:`void`,params:[`Hash modelHash`]},(e,t)=>n(e).linked.add(t)),S({name:`IS_NAMED_RENDERTARGET_LINKED`,hash:1240548542186197656n,result:`BOOL`,params:[`Hash modelHash`]},(e,t)=>n(e).linked.has(t)),S({name:`GET_NAME_OF_ZONE`,hash:14812450763245150666n,result:`char*`,params:[`float x`,`float y`,`float z`]},()=>`SANAND`),S({name:`GET_STREET_NAME_AT_COORD`,hash:3365332906397525184n,result:`void`,params:[`float x`,`float y`,`float z`,`Hash* streetName`,`Hash* crossingRoad`]},(e,t,n,r,i,a)=>{i.set(0),a.set(0)}),S({name:`GET_STREET_NAME_FROM_HASH_KEY`,hash:15055404454487149753n,result:`char*`,params:[`Hash hash`]},()=>``),S({name:`GET_CLOSEST_OBJECT_OF_TYPE`,hash:16232092507137524585n,result:`Object`,params:[`float x`,`float y`,`float z`,`float radius`,`Hash modelHash`]},(e,t,n,r,i,a)=>{let o=0,s=i;for(let i of e.manager.world.entities){if(K(i.type)!==G.object||i.model!==a)continue;let e=Math.hypot(i.x-t,i.y-n,i.z-r);e<=s&&(s=e,o=i.handle)}return o})]}const nv=new TextEncoder,rv=/* @__PURE__ */ new Uint8Array;function iv(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return t}function av(e){return Uint8Array.from(e,e=>e.charCodeAt(0))}function ov(e){let t=e.indexOf(0);return t===-1?e:e.subarray(0,t)}function sv(){return new Ke(`bad cast`)}function cv(e){let t=Array.from({length:64},()=>void 0),n=(e,t,n=rv)=>`res:${iv(n.length===0?nv.encode(e.resource.name):n)}:${iv(t)}`,r=t=>{let{variables:n}=t.manager.console;e===`server`&&n.find(`sv_kvsName`)===void 0&&n.define(`sv_kvsName`,w.none,`string`,`default`)},i=(e,t)=>{let n=e.manager.kvp.get(t);return n===void 0?void 0:ec(n)},a=(e,t,i)=>{r(e),e.manager.kvp.set(n(e,ov(U(t,0))),i)},o=(e,t)=>{r(e),e.manager.kvp.delete(n(e,ov(U(t,0))))},s=(e,n,r)=>{let i=t.indexOf(void 0);return i===-1?-1:(t[i]={keys:e.manager.kvp.keysWith(n),next:0,prefixLength:r},i)},c=e=>{if(e===void 0)return null;if(e.type!==`string`)throw sv();return e.bytes},l=e=>{if(e===void 0)return 0;if(e.type!==`int`)throw sv();return e.value},u=e=>{if(e===void 0)return 0;if(e.type===`string`)throw sv();return e.value},d=[...[`SET_RESOURCE_KVP`,`SET_RESOURCE_KVP_NO_SYNC`].map(e=>S({name:e,result:`void`,params:[`bytes key`,`bytes value`]},(e,t,n)=>{let r=Zs(ov(U(n,1)));a(e,t,r)})),...[`SET_RESOURCE_KVP_INT`,`SET_RESOURCE_KVP_INT_NO_SYNC`].map(e=>S({name:e,result:`void`,params:[`bytes key`,`int value`]},(e,t,n)=>a(e,t,Qs(n)))),...[`SET_RESOURCE_KVP_FLOAT`,`SET_RESOURCE_KVP_FLOAT_NO_SYNC`].map(e=>S({name:e,result:`void`,params:[`bytes key`,`float value`]},(e,t,n)=>a(e,t,$s(n)))),...[`DELETE_RESOURCE_KVP`,`DELETE_RESOURCE_KVP_NO_SYNC`].map(e=>S({name:e,result:`void`,params:[`bytes key`]},o)),S({name:`GET_RESOURCE_KVP_STRING`,result:`char*`,params:[`bytes key`]},(e,t)=>(r(e),c(i(e,n(e,ov(U(t,0))))))),S({name:`GET_RESOURCE_KVP_INT`,result:`int`,params:[`bytes key`]},(e,t)=>(r(e),l(i(e,n(e,ov(U(t,0))))))),S({name:`GET_RESOURCE_KVP_FLOAT`,result:`float`,params:[`bytes key`]},(e,t)=>(r(e),u(i(e,n(e,ov(U(t,0))))))),S({name:`START_FIND_KVP`,result:`int`,params:[`bytes prefix`]},(t,i)=>{r(t);let a=n(t,ov(U(i,0))),o=e===`client`?n(t,rv).length:void 0;return s(t,a,o)}),S({name:`FIND_KVP`,result:`char*`,params:[`int handle`]},(e,i)=>{if(r(e),i<0||i>=64)return e.diagnose(`FindKvp was given ${i}, which is no handle: FiveM sets no result, so the script reads the handle as the string, which can crash. FiveRunner returns nil.`),null;let a=t[i];if(a===void 0)return e.diagnose(`FindKvp was given handle ${i}, which no search has: FiveM reads its search all the same, and crashes. FiveRunner returns nil.`),null;let o=a.keys[a.next];if(o===void 0)return null;let s=a.prefixLength??n(e,rv).length;if(s>o.length)throw new Ke(`invalid string position`);return a.next++,av(o.slice(s))}),S({name:`END_FIND_KVP`,result:`void`,params:[`int handle`]},(e,n)=>{n>=0&&n<64&&(t[n]=void 0)})];if(e===`server`)return[...d,S({name:`FLUSH_RESOURCE_KVP`,result:`void`,params:[]},r)];let f=(e,t,r)=>{let a=ov(U(t,0));return i(e,n(e,ov(U(r,1)),a))};return[...d,S({name:`GET_EXTERNAL_KVP_STRING`,result:`char*`,params:[`bytes resource`,`bytes key`]},(e,t,n)=>c(f(e,t,n))),S({name:`GET_EXTERNAL_KVP_INT`,result:`int`,params:[`bytes resource`,`bytes key`]},(e,t,n)=>l(f(e,t,n))),S({name:`GET_EXTERNAL_KVP_FLOAT`,result:`float`,params:[`bytes resource`,`bytes key`]},(e,t,n)=>u(f(e,t,n))),S({name:`START_FIND_EXTERNAL_KVP`,result:`int`,params:[`bytes resourceName`,`bytes prefix`]},(e,t,r)=>{let i=ov(U(t,0)),a=n(e,ov(U(r,1)),i);return s(e,a,n(e,rv,i).length)})]}const lv=e=>e*Math.PI/180,uv=e=>e*180/Math.PI;function dv(e,t){return(uv(Math.atan2(-e,t))+360)%360}function fv(e){return e===`server`?[]:[S({name:`GET_RANDOM_INT_IN_RANGE`,hash:15362697152651844904n,result:`int`,params:[`int startRange`,`int endRange`]},(e,t,n)=>t+Math.floor(e.manager.world.random()*(n-t))),S({name:`GET_RANDOM_FLOAT_IN_RANGE`,hash:3547962977077129165n,result:`float`,params:[`float startRange`,`float endRange`]},(e,t,n)=>t+e.manager.world.random()*(n-t)),S({name:`SET_RANDOM_SEED`,hash:4921758165350085612n,result:`void`,params:[`int seed`]},(e,t)=>e.manager.world.seedRandom(t)),...[[`ABSF`,8346714922768581461n,Math.abs],[`SQRT`,8203653444578285572n,Math.sqrt],[`COS`,15059950717509440412n,e=>Math.cos(lv(e))],[`SIN`,841539415165780831n,e=>Math.sin(lv(e))],[`TAN`,7142997959761211025n,e=>Math.tan(lv(e))],[`ACOS`,2092125917621793974n,e=>uv(Math.acos(e))],[`ASIN`,14430384276805901543n,e=>uv(Math.asin(e))],[`ATAN`,12236695102160123491n,e=>uv(Math.atan(e))]].map(([e,t,n])=>S({name:e,hash:t,result:`float`,params:[`float value`]},(e,t)=>n(t))),...[[`FLOOR`,17532204621987346500n,Math.floor],[`CEIL`,1288057844309609610n,Math.ceil],[`ROUND`,17499705547816067449n,e=>Math.sign(e)*Math.round(Math.abs(e))]].map(([e,t,n])=>S({name:e,hash:t,result:`int`,params:[`float value`]},(e,t)=>n(t))),S({name:`ABSI`,hash:17353243276582801287n,result:`int`,params:[`int value`]},(e,t)=>Math.abs(t)),S({name:`ATAN2`,hash:9883092181120606628n,result:`float`,params:[`float p0`,`float p1`]},(e,t,n)=>uv(Math.atan2(t,n))),S({name:`POW`,hash:16384690022721388078n,result:`float`,params:[`float base`,`float exponent`]},(e,t,n)=>t**n),S({name:`SHIFT_LEFT`,hash:17138829061642276328n,result:`int`,params:[`int value`,`int bitShift`]},(e,t,n)=>t<<n),S({name:`SHIFT_RIGHT`,hash:10948002598818267253n,result:`int`,params:[`int value`,`int bitShift`]},(e,t,n)=>t>>n),...[[`VDIST`,3046839180162419877n,e=>Math.sqrt(e)],[`VDIST2`,13233308750539886151n,e=>e]].map(([e,t,n])=>S({name:e,hash:t,result:`float`,params:[`float x1`,`float y1`,`float z1`,`float x2`,`float y2`,`float z2`]},(e,t,r,i,a,o,s)=>n((a-t)**2+(o-r)**2+(s-i)**2))),...[[`VMAG`,7290534975576991276n,e=>Math.sqrt(e)],[`VMAG2`,12163849536751198296n,e=>e]].map(([e,t,n])=>S({name:e,hash:t,result:`float`,params:[`float x`,`float y`,`float z`]},(e,t,r,i)=>n(t**2+r**2+i**2))),S({name:`GET_DISTANCE_BETWEEN_COORDS`,hash:17417496221515303250n,result:`float`,params:[`float x1`,`float y1`,`float z1`,`float x2`,`float y2`,`float z2`,`BOOL useZ`]},(e,t,n,r,i,a,o,s)=>Math.hypot(i-t,a-n,s?o-r:0)),S({name:`GET_ANGLE_BETWEEN_2D_VECTORS`,hash:1760842301871889554n,result:`float`,params:[`float x1`,`float y1`,`float x2`,`float y2`]},(e,t,n,r,i)=>{let a=Math.hypot(t,n)*Math.hypot(r,i);return a===0?0:uv(Math.acos((t*r+n*i)/a))}),S({name:`GET_HEADING_FROM_VECTOR_2D`,hash:3457474934040373542n,result:`float`,params:[`float dx`,`float dy`]},(e,t,n)=>dv(t,n)),S({name:`GET_LOCAL_TIME`,hash:5820807480810575688n,result:`void`,params:[`int* year`,`int* month`,`int* day`,`int* hour`,`int* minute`,`int* second`]},(e,t,n,r,i,a,o)=>{let s=ei(Math.floor(e.manager.wallClock()/1e3),e.manager.timeZone);s!==void 0&&(t.set(s.year),n.set(s.mon+1),r.set(s.mday),i.set(s.hour),a.set(s.min),o.set(s.sec))}),S({name:`GET_NETWORK_TIME`,hash:8814819898341092168n,result:`int`,params:[]},e=>Math.trunc(e.manager.time())|0),S({name:`GET_CURRENT_SERVER_ENDPOINT`,result:`char*`,params:[]},()=>`127.0.0.1:30120`),S({name:`GET_TIME_DIFFERENCE`,hash:11729339369839329264n,result:`int`,params:[`int timeA`,`int timeB`]},(e,t,n)=>t-n),S({name:`GET_TIME_OFFSET`,hash:103592467367232771n,result:`int`,params:[`int timeA`,`int timeB`]},(e,t,n)=>t+n),S({name:`GET_ACTUAL_SCREEN_RESOLUTION`,hash:9744838726593289683n,result:`void`,params:[`int* x`,`int* y`]},(e,t,n)=>{t.set(1920),n.set(1080)}),S({name:`UPDATE_ONSCREEN_KEYBOARD`,hash:933008831334139310n,result:`int`,params:[]},()=>2)]}const pv=/* @__PURE__ */ new Uint8Array;function mv(e){return`${e} requires setr sv_enableNetEventReassembly true\n`}function hv(e,t,n,r){return n===null?(r!==0&&e.diagnose(`${t} was given no payload, but a length of ${r}: FiveM would read that many bytes from nowhere, and crash. FiveRunner sends no payload.`),pv):n}function gv(e){if(e===`client`)return[S({name:`TRIGGER_SERVER_EVENT_INTERNAL`,result:`void`,params:[`char* eventName`,`buffer eventPayload`,`int payloadLength`]},(e,t,n,r)=>{if(t===null){e.diagnose(`TriggerServerEventInternal was given no event name: FiveM would read it from nowhere, and crash. FiveRunner sends nothing.`);return}let i=hv(e,`TriggerServerEventInternal`,n,r),{player:a}=e.manager;a===void 0?e.diagnose(`TriggerServerEvent sent ${t} to no server, as FiveRunner's client is not connected to one.`):a.session.server.events.queue(t,i,`net:${a.netId}`)}),S({name:`TRIGGER_LATENT_SERVER_EVENT_INTERNAL`,result:`void`,params:[`char* eventName`,`buffer eventPayload`,`int payloadLength`,`int bps`]},(e,t,n,r,i)=>{if(!e.manager.reassembling){e.runtime.emitWarning(`natives`,mv(`TRIGGER_LATENT_SERVER_EVENT_INTERNAL`));return}if(t===null){e.diagnose(`TriggerLatentServerEventInternal was given no event name: FiveM would read it from nowhere, and crash. FiveRunner sends nothing.`);return}let a=hv(e,`TriggerLatentServerEventInternal`,n,r),{player:o}=e.manager;o===void 0&&e.diagnose(`TriggerLatentServerEvent sent ${t} to no server, as FiveRunner's client is not connected to one.`);let s=o===void 0?[]:[()=>{let e=`net:${o.netId}`;o.state===`joined`&&o.session.server.events.queue(t,a,e)}];e.manager.latent.send(t,a,i,s)})];let t,r=!1;return[S({name:`TRIGGER_CLIENT_EVENT_INTERNAL`,result:`void`,params:[`char* eventName`,`char* eventTarget`,`buffer eventPayload`,`int payloadLength`]},(e,i,a,o,s)=>{let c=U(i,0),l=U(a,1),u=hv(e,`TriggerClientEventInternal`,o,s),{manager:d}=e,f=d.time();u.length>=1e6&&(t===void 0||f-t>=5e3)&&(d.trace(`citizen-server-impl`,`Warning: sending large event ${c} (${u.length} bytes). This may cause performance issues. Consider using latent events instead.\n`),t=f);let p=d.session;if(p===void 0)return;let m=`net:${Lg}`,h=e=>{e.state===`joined`&&e.client.events.queue(c,u,m)};if(l===`-1`){for(let e of p.players)h(e);return}let g=n(l),_=p.player(g);_!==void 0&&(_.netId!==g&&!r&&(r=!0,e.runtime.emitWarning(`natives`,`TRIGGER_CLIENT_EVENT_INTERNAL: client ${_.netId} is not the same as the target ${g}. This happens when the oldId from the playerJoining event is used. Use source instead.\n`)),h(_))}),S({name:`TRIGGER_LATENT_CLIENT_EVENT_INTERNAL`,result:`void`,params:[`char* eventName`,`char* eventTarget`,`buffer eventPayload`,`int payloadLength`,`int bps`]},(e,t,n,r,i,a)=>{let{manager:c}=e;if(!c.reassembling){e.runtime.emitWarning(`natives`,mv(`TRIGGER_LATENT_CLIENT_EVENT_INTERNAL`));return}let l=U(t,0),u=U(n,1),d=hv(e,`TriggerLatentClientEventInternal`,r,i),f=o(u);if(f===void 0)throw new Ke(s(u));let p=[...c.session?.players??[]].filter(e=>e.state===`joined`&&(f===-1||e.netId===f)).map(e=>()=>{e.state===`joined`&&e.client.events.queue(l,d,`net:0`)});c.latent.send(l,d,a,p)})]}function _v(e){return e.manager.nui}function vv(){return[S({name:`SEND_NUI_MESSAGE`,result:`BOOL`,params:[`bytes jsonString`]},(e,t)=>_v(e).send(e.resource,t)),S({name:`SEND_LOADING_SCREEN_MESSAGE`,result:`BOOL`,params:[`char* jsonString`]},e=>(e.manager.trace(`nui-resources`,`SEND_LOADING_SCREEN_MESSAGE called while the loading screen was shut down
|
|
5000
5000
|
`),!1)),S({name:`REGISTER_NUI_CALLBACK`,result:`void`,params:[`char* callbackType`,`func callback`]},(e,t,n)=>{let r=U(t,0),i=U(n,1);_v(e).register(e.resource,r,{kind:`function`,ref:i})}),S({name:`REGISTER_NUI_CALLBACK_TYPE`,result:`void`,params:[`char* callbackType`]},(e,t)=>{_v(e).register(e.resource,U(t,0),{kind:`event`})}),S({name:`REGISTER_RAW_NUI_CALLBACK`,result:`void`,params:[`char* callbackType`,`func callback`]},(e,t,n)=>{let r=U(t,0),i=U(n,1);_v(e).register(e.resource,r,{kind:`raw`,ref:i})}),S({name:`UNREGISTER_RAW_NUI_CALLBACK`,result:`void`,params:[`char* callbackType`]},(e,t)=>{_v(e).unregister(e.resource,U(t,0))}),S({name:`SET_NUI_FOCUS`,result:`void`,params:[`BOOL hasFocus`,`BOOL hasCursor`]},(e,t,n)=>{_v(e).setFocus(e.resource,t,n)}),S({name:`SET_NUI_FOCUS_KEEP_INPUT`,result:`void`,params:[`BOOL keepInput`]},(e,t)=>{_v(e).setKeepInput(e.resource,t)}),S({name:`IS_NUI_FOCUSED`,result:`BOOL`,params:[]},e=>_v(e).focused),S({name:`IS_NUI_FOCUS_KEEPING_INPUT`,result:`BOOL`,params:[]},e=>_v(e).keepingInput),S({name:`SET_NUI_ZINDEX`,result:`void`,params:[`int zIndex`]},(e,t)=>{_v(e).setZIndex(e.resource,t)}),S({name:`GET_NUI_CURSOR_POSITION`,result:`void`,params:[`int* x`,`int* y`]},(e,t,n)=>{let{cursor:r}=_v(e);t.set(r.x),n.set(r.y)})]}const yv=/* @__PURE__ */ new Set([`single`,`scalar`,`insert`,`update`]);function bv(e){return typeof e==`string`?e:String(e)}function xv(){return[S({name:`FIVERUNNER_OXMYSQL`,result:`object`,params:[`char* method`,`bytes args`]},(e,t,n)=>{let{manager:r,resource:i}=e,a=r.oxmysql;if(a===void 0||!i.emulatesOxmysql)throw new Ke(`only FiveRunner's oxmysql calls FIVERUNNER_OXMYSQL`);let o=n===null?[]:Cc(qa(n)),s=e=>Array.isArray(o)?o[e]:void 0,c=(e,t)=>({given:e===!0,isPromise:!Pm(t)});return Ga(Tc(a.start(e=>{switch(t){case`connect`:return a.connect(e);case`query`:{let t=s(0),n=typeof t==`string`&&yv.has(t)?t:null;return a.query(e,n,bv(s(1)),s(2),s(3),c(s(4),s(5)))}case`execute`:return a.execute(e,bv(s(0)),s(1),s(2),c(s(3),s(4)),s(5)===!0);case`transaction`:return a.transaction(e,bv(s(0)),s(1),s(2),c(s(3),s(4)));case`begin`:return a.begin(e,bv(s(0)));case`transactionQuery`:return a.transactionQuery(e,Number(s(0)),s(1)===!0,s(2),s(3));case`end`:{let t=s(2);return a.end(e,Number(s(0)),s(1)===!0,t==null?void 0:bv(t))}default:throw new Ke(`FiveRunner's oxmysql has no operation ${String(t)}`)}})))})]}function Sv(e,t){let n=X(e,t);return n!==void 0&&K(n.type)===G.ped?n:void 0}function Q(e,t){return Sv(e,t)?.appearance}const Cv=x(`mp_f_freemode_01`),wv=/* @__PURE__ */ new Set([x(`mp_m_freemode_01`),Cv]),Tv=[46,200,80,200,150,100,110,150,200,50,150,400],Ev=[180,40,40,0,0,0,40,15];function Dv(e,t,n){return e===void 0?0:wv.has(e.model)?(n?Ev:Tv)[t]??0:+(!n&&t>=0&&t<12)}const Ov=[24,29,34,15,75,7,12,11,10,18,17,12,2],kv=1e3;function Av(e,t,n,r){return e!==void 0&&e.until>r&&e.dict===t.toLowerCase()&&e.name===n.toLowerCase()}function jv(e){if(e===`server`)return[];let t=/* @__PURE__ */ new WeakMap,n=(e,n,r,i,a,o)=>{if(!e.manager.world.assetLoaded(`anim`,r??``)){let n=t.get(e.manager)??/* @__PURE__ */ new Set;t.set(e.manager,n);let i=(r??``).toLowerCase();n.has(i)||(n.add(i),e.diagnose(`TaskPlayAnim was given the anim dict ${r??``}, which is not loaded, so the ped played nothing, as in GTA V: request it with RequestAnimDict, then wait until HasAnimDictLoaded says it loaded.`));return}let s=!!(o&3),c={dict:(r??``).toLowerCase(),name:(i??``).toLowerCase(),until:e.manager.time()+(a>0?a:s?1/0:kv)};o&32?n.secondaryAnim=c:n.anim=c};return[S({name:`SET_PED_COMPONENT_VARIATION`,hash:2750315038012726912n,result:`void`,params:[`Ped ped`,`int componentId`,`int drawableId`,`int textureId`,`int paletteId`]},(e,t,n,r,i,a)=>Q(e,t)?.components.set(n,[r,i,a])),...[[`GET_PED_DRAWABLE_VARIATION`,7490462606036423932n,0],[`GET_PED_TEXTURE_VARIATION`,334205219021784294n,1],[`GET_PED_PALETTE_VARIATION`,16419384452682359425n,2]].map(([e,t,n])=>S({name:e,hash:t,result:`int`,params:[`Ped ped`,`int componentId`]},(e,t,r)=>Q(e,t)?.components.get(r)?.[n]??0)),...[[`GET_NUMBER_OF_PED_DRAWABLE_VARIATIONS`,2834476523764480066n,`int componentId`],[`GET_NUMBER_OF_PED_PROP_DRAWABLE_VARIATIONS`,6894895945445145415n,`int propId`]].map(([e,t,n])=>S({name:e,hash:t,result:`int`,params:[`Ped ped`,n]},(e,t,r)=>Dv(Sv(e,t),r,n===`int propId`))),...[[`GET_NUMBER_OF_PED_TEXTURE_VARIATIONS`,10336137878209981357n,`int componentId`],[`GET_NUMBER_OF_PED_PROP_TEXTURE_VARIATIONS`,12026847200020783473n,`int propId`]].map(([e,t,n])=>S({name:e,hash:t,result:`int`,params:[`Ped ped`,n,`int drawableId`]},(e,t,r,i)=>{let a=Sv(e,t);return i<0||i>=Dv(a,r,n===`int propId`)?0:wv.has(a.model)?10:1})),S({name:`GET_PED_HEAD_OVERLAY_NUM`,hash:14924057702203344910n,result:`int`,params:[`int overlayID`]},(e,t)=>Ov[t]??0),S({name:`_GET_NUM_HAIR_COLORS`,hash:16555460409682481488n,result:`int`,params:[]},()=>eg.length),S({name:`_GET_NUM_MAKEUP_COLORS`,hash:15129783665620559896n,result:`int`,params:[]},()=>tg.length),...[[`_GET_PED_HAIR_RGB_COLOR`,5211505038117968821n,`int hairColorIndex`,eg],[`_GET_PED_MAKEUP_RGB_COLOR`,89611280948482951n,`int makeupColorIndex`,tg]].map(([e,t,n,r])=>S({name:e,hash:t,result:`void`,params:[n,`int* outR`,`int* outG`,`int* outB`]},(e,t,n,i,a)=>{let o=r[t]??0;n.set(o>>16),i.set(o>>8&255),a.set(o&255)})),S({name:`IS_PED_MALE`,hash:7899137457135336006n,result:`BOOL`,params:[`Ped ped`]},(e,t)=>{let n=Sv(e,t);return n!==void 0&&n.model!==Cv}),S({name:`SET_PED_DEFAULT_COMPONENT_VARIATION`,hash:5039218013098765667n,result:`void`,params:[`Ped ped`]},(e,t)=>Q(e,t)?.components.clear()),S({name:`SET_PED_PROP_INDEX`,hash:10608065531555015519n,result:`void`,params:[`Ped ped`,`int componentId`,`int drawableId`,`int textureId`,`BOOL attach`]},(e,t,n,r,i)=>Q(e,t)?.props.set(n,[r,i])),...[[`GET_PED_PROP_INDEX`,9911510248128752856n,0],[`GET_PED_PROP_TEXTURE_INDEX`,16226929629455719090n,1]].map(([e,t,n])=>S({name:e,hash:t,result:`int`,params:[`Ped ped`,`int componentId`]},(e,t,r)=>Q(e,t)?.props.get(r)?.[n]??-1)),S({name:`CLEAR_PED_PROP`,hash:667629751983728494n,result:`void`,params:[`Ped ped`,`int propId`]},(e,t,n)=>Q(e,t)?.props.delete(n)),S({name:`CLEAR_ALL_PED_PROPS`,hash:14810779206492172038n,result:`void`,params:[`Ped ped`]},(e,t)=>Q(e,t)?.props.clear()),S({name:`SET_PED_HEAD_OVERLAY`,hash:5256907375973354526n,result:`void`,params:[`Ped ped`,`int overlayID`,`int index`,`float opacity`]},(e,t,n,r,i)=>{let a=Q(e,t)?.overlay(n);a!==void 0&&Object.assign(a,{value:r,opacity:i})}),S({name:`SET_PED_HEAD_OVERLAY_COLOR`,hash:5295097686177659218n,result:`void`,params:[`Ped ped`,`int overlayID`,`int colorType`,`int colorID`,`int secondColorID`]},(e,t,n,r,i,a)=>{let o=Q(e,t)?.overlay(n);o!==void 0&&Object.assign(o,{colourType:r,firstColour:i,secondColour:a})}),S({name:`GET_PED_HEAD_OVERLAY_VALUE`,hash:11965769224155712835n,result:`int`,params:[`Ped ped`,`int overlayID`]},(e,t,n)=>Q(e,t)?.overlay(n).value??255),S({name:`GET_PED_HEAD_OVERLAY_DATA`,result:`BOOL`,params:[`Ped ped`,`int index`,`int* overlayValue`,`int* colourType`,`int* firstColour`,`int* secondColour`,`float* overlayOpacity`]},(e,t,n,r,i,a,o,s)=>{let c=Q(e,t)?.overlay(n);return c!==void 0&&(r.set(c.value),i.set(c.colourType),a.set(c.firstColour),o.set(c.secondColour),s.set(c.opacity),!0)}),S({name:`SET_PED_FACE_FEATURE`,hash:8189164646475760798n,result:`void`,params:[`Ped ped`,`int index`,`float scale`]},(e,t,n,r)=>Q(e,t)?.faceFeatures.set(n,r)),S({name:`GET_PED_FACE_FEATURE`,result:`float`,params:[`Ped ped`,`int index`]},(e,t,n)=>Q(e,t)?.faceFeatures.get(n)??0),S({name:`SET_PED_HAIR_TINT`,hash:5548371331445766729n,result:`void`,params:[`Ped ped`,`int colorID`,`int highlightColorID`]},(e,t,n,r)=>{let i=Q(e,t);i!==void 0&&Object.assign(i,{hair:n,highlight:r})}),S({name:`GET_PED_HAIR_COLOR`,result:`int`,params:[`Ped ped`]},(e,t)=>Q(e,t)?.hair??-1),S({name:`GET_PED_HAIR_HIGHLIGHT_COLOR`,result:`int`,params:[`Ped ped`]},(e,t)=>Q(e,t)?.highlight??-1),S({name:`SET_PED_EYE_COLOR`,hash:5815670529632284639n,result:`void`,params:[`Ped ped`,`int index`]},(e,t,n)=>{let r=Q(e,t);r!==void 0&&(r.eyes=n)}),S({name:`GET_PED_EYE_COLOR`,result:`int`,params:[`Ped ped`]},(e,t)=>Q(e,t)?.eyes??-1),S({name:`SET_PED_HEAD_BLEND_DATA`,hash:10670401406750737150n,result:`void`,params:[`Ped ped`,`int shapeFirstID`,`int shapeSecondID`,`int shapeThirdID`,`int skinFirstID`,`int skinSecondID`,`int skinThirdID`,`float shapeMix`,`float skinMix`,`float thirdMix`]},(e,t,...n)=>{let r=Q(e,t);r!==void 0&&(r.headBlend=n)}),S({name:`GET_PED_HEAD_BLEND_DATA`,hash:2830157900151113168n,result:`BOOL`,params:[`Ped ped`,`int* shapeFirst`,`int* shapeSecond`,`int* shapeThird`,`int* skinFirst`,`int* skinSecond`,`int* skinThird`,`float* shapeMix`,`float* skinMix`,`float* thirdMix`]},(e,t,...n)=>{let r=Q(e,t);return r!==void 0&&(n.forEach((e,t)=>e.set(r.headBlend[t])),!0)}),S({name:`ADD_PED_DECORATION_FROM_HASHES`,hash:6871673233298597945n,result:`void`,params:[`Ped ped`,`Hash collection`,`Hash overlay`]},()=>{}),S({name:`CLEAR_PED_DECORATIONS`,hash:1031733064081305144n,result:`void`,params:[`Ped ped`]},()=>{}),S({name:`SET_PED_CAN_LOSE_PROPS_ON_DAMAGE`,hash:16744894345424298680n,result:`void`,params:[`Ped ped`,`BOOL toggle`]},()=>{}),S({name:`IS_PED_FALLING`,hash:18127728484137885603n,result:`BOOL`,params:[`Ped ped`]},()=>!1),S({name:`TASK_PLAY_ANIM_ADVANCED`,hash:9497441865609983755n,result:`void`,params:[`Ped ped`,`char* animDictionary`,`char* animationName`,`float posX`,`float posY`,`float posZ`,`float rotX`,`float rotY`,`float rotZ`,`float animEnterSpeed`,`float animExitSpeed`,`int duration`,`int flag`,`float animTime`,`int rotOrder`,`int ikFlags`]},(e,t,r,i,a,o,s,c,l,u,d,f,p,m,h,g)=>{let _=Sv(e,t);_!==void 0&&(_.moveTo(a,o,s),_.rotation=ch(c,l,u,g),n(e,_,r,i,p,m))}),S({name:`TASK_TURN_PED_TO_FACE_ENTITY`,hash:6544360553900626860n,result:`void`,params:[`Ped ped`,`Entity entity`,`int duration`]},(e,t,n)=>{let r=Sv(e,t),i=e.manager.world.byHandle(n);r!==void 0&&i!==void 0&&r.face(i.x,i.y)}),S({name:`TASK_TURN_PED_TO_FACE_COORD`,hash:2151193443362375025n,result:`void`,params:[`Ped ped`,`float x`,`float y`,`float z`,`int duration`]},(e,t,n,r)=>Sv(e,t)?.face(n,r)),S({name:`GET_ANIM_DURATION`,hash:18365099070646179728n,result:`float`,params:[`char* animDict`,`char* animName`]},()=>kv/1e3),S({name:`TASK_PLAY_ANIM`,hash:16881741240819145620n,result:`void`,params:[`Ped ped`,`char* animDictionary`,`char* animationName`,`float blendInSpeed`,`float blendOutSpeed`,`int duration`,`int flag`,`float playbackRate`,`BOOL lockX`,`BOOL lockY`,`BOOL lockZ`]},(e,t,r,i,a,o,s,c)=>{let l=Sv(e,t);l!==void 0&&n(e,l,r,i,s,c)}),S({name:`IS_ENTITY_PLAYING_ANIM`,hash:2237014829242392265n,result:`BOOL`,params:[`Entity entity`,`char* animDict`,`char* animName`,`int taskFlag`]},(e,t,n,r)=>{let i=Sv(e,t),a=e.manager.time();return i!==void 0&&(Av(i.anim,n??``,r??``,a)||Av(i.secondaryAnim,n??``,r??``,a))}),S({name:`STOP_ANIM_TASK`,hash:10952532887463698442n,result:`void`,params:[`Ped ped`,`char* animDictionary`,`char* animationName`,`float animExitSpeed`]},(e,t,n,r)=>{let i=Sv(e,t);if(i===void 0)return;let a=e.manager.time();Av(i.anim,n??``,r??``,a)&&(i.anim=void 0),Av(i.secondaryAnim,n??``,r??``,a)&&(i.secondaryAnim=void 0)}),...[[`CLEAR_PED_TASKS`,16280297226355339981n,!1],[`CLEAR_PED_TASKS_IMMEDIATELY`,12295758863867781272n,!0]].map(([e,t,n])=>S({name:e,hash:t,result:`void`,params:[`Ped ped`]},(e,t)=>{let r=Sv(e,t);r!==void 0&&(r.anim=r.secondaryAnim=void 0,n&&r.leaveVehicle())})),S({name:`CLEAR_PED_SECONDARY_TASK`,hash:1687984505842882311n,result:`void`,params:[`Ped ped`]},(e,t)=>{let n=Sv(e,t);n!==void 0&&(n.secondaryAnim=void 0)}),S({name:`SET_PLAYER_MODEL`,hash:45540521788082230n,result:`void`,params:[`Player player`,`Hash model`]},(e,t,n)=>{let r=e.manager.world;t===Jg(e)&&n!==0&&(r.loaded(n)?r.changePlayerModel(n):e.diagnose(`SetPlayerModel was given a model that is not loaded, so the player kept its ped, as GTA V does: request it with RequestModel, then wait until HasModelLoaded says it loaded.`))})]}const Mv={x:0,y:0,z:0},Nv=([e,t,n])=>({x:e,y:t,z:n});function Pv(e,t,n,r,i,a,o){let s,c=a;for(let a of e.manager.world.entities){if(K(a.type)!==t||!o(a))continue;let e=Math.hypot(a.x-n,a.y-r,a.z-i);e<=c&&(c=e,s=a)}return s}function Fv(e){if(e===`server`)return[];let t=(e,t,n)=>S({name:e,hash:t,result:`BOOL`,params:[`Entity entity`]},(e,t)=>{let r=X(e,t)?.attachedTo;return r!==void 0&&K(r.type)===n}),n=(e,t)=>S({name:e,hash:t,result:`Vector3`,params:[`Entity entity`,`int boneIndex`]},(e,t)=>{let n=X(e,t);return n===void 0?Mv:Nv([n.x,n.y,n.z])});return[S({name:`ATTACH_ENTITY_TO_ENTITY`,hash:7753999234533660383n,result:`void`,params:[`Entity entity1`,`Entity entity2`,`int boneIndex`,`float xPos`,`float yPos`,`float zPos`,`float xRot`,`float yRot`,`float zRot`,`BOOL p9`,`BOOL useSoftPinning`,`BOOL collision`,`BOOL isPed`,`int rotationOrder`,`BOOL syncRot`]},(e,t,n,r,i,a,o)=>{let s=X(e,t),c=X(e,n);s!==void 0&&c!==void 0&&s.attachTo(c,i,a,o)}),S({name:`DETACH_ENTITY`,hash:10816174385029791581n,result:`void`,params:[`Entity entity`,`BOOL dynamic`,`BOOL collision`]},(e,t)=>X(e,t)?.detach()),S({name:`IS_ENTITY_ATTACHED`,hash:12918091122985027735n,result:`BOOL`,params:[`Entity entity`]},(e,t)=>X(e,t)?.attachedTo!==void 0),S({name:`IS_ENTITY_ATTACHED_TO_ENTITY`,hash:17275370056189556520n,result:`BOOL`,params:[`Entity from`,`Entity to`]},(e,t,n)=>{let r=X(e,t)?.attachedTo;return r!==void 0&&r.handle===n}),t(`IS_ENTITY_ATTACHED_TO_ANY_PED`,12782111407971274001n,G.ped),t(`IS_ENTITY_ATTACHED_TO_ANY_VEHICLE`,2786199138849258315n,G.vehicle),t(`IS_ENTITY_ATTACHED_TO_ANY_OBJECT`,14938748105593315532n,G.object),S({name:`GET_ENTITY_ATTACHED_TO`,hash:5242962755833553187n,result:`Entity`,params:[`Entity entity`]},(e,t)=>X(e,t)?.attachedTo?.handle??0),S({name:`GET_PED_BONE_INDEX`,hash:4558360841545231921n,result:`int`,params:[`Ped ped`,`int boneId`]},(e,t,n)=>X(e,t)===void 0?-1:n),S({name:`GET_ENTITY_BONE_INDEX_BY_NAME`,hash:18118288114022001850n,result:`int`,params:[`Entity entity`,`char* boneName`]},(e,t)=>X(e,t)===void 0?-1:0),n(`GET_WORLD_POSITION_OF_ENTITY_BONE`,4947482061849130808n),n(`_GET_ENTITY_BONE_POSITION_2`,5113953277438213275n),S({name:`GET_PED_BONE_COORDS`,hash:1711508347870014286n,result:`Vector3`,params:[`Ped ped`,`int boneId`,`float offsetX`,`float offsetY`,`float offsetZ`]},(e,t,n,r,i,a)=>{let o=X(e,t);if(o===void 0)return Mv;let[s,c,l]=uh(o.rotation,r,i,a);return Nv([o.x+s,o.y+c,o.z+l])}),S({name:`GET_ENTITY_MATRIX`,hash:17055972306262151479n,result:`void`,params:[`Entity entity`,`Vector3* forwardVector`,`Vector3* rightVector`,`Vector3* upVector`,`Vector3* position`]},(e,t,n,r,i,a)=>{let o=X(e,t);o!==void 0&&(n.set(new he(`vector3`,...uh(o.rotation,0,1,0))),r.set(new he(`vector3`,...uh(o.rotation,1,0,0))),i.set(new he(`vector3`,...uh(o.rotation,0,0,1))),a.set(new he(`vector3`,o.x,o.y,o.z)))}),S({name:`GET_OFFSET_FROM_ENTITY_GIVEN_WORLD_COORDS`,hash:2482816124249826099n,result:`Vector3`,params:[`Entity entity`,`float posX`,`float posY`,`float posZ`]},(e,t,n,r,i)=>{let a=X(e,t);if(a===void 0)return Mv;let[o,s,c]=[n-a.x,r-a.y,i-a.z],l=a.rotation;return Nv([l[0]*o+l[3]*s+l[6]*c,l[1]*o+l[4]*s+l[7]*c,l[2]*o+l[5]*s+l[8]*c])}),S({name:`GET_GROUND_Z_FOR_3D_COORD`,hash:14485449809187343659n,result:`BOOL`,params:[`float x`,`float y`,`float z`,`float* groundZ`,`BOOL includeWater`]},(e,t,n,r,i)=>(i.set(r),!0)),S({name:`PLACE_OBJECT_ON_GROUND_PROPERLY`,hash:6388445041372756643n,result:`BOOL`,params:[`Object object`]},(e,t)=>X(e,t)!==void 0),S({name:`GET_CLOSEST_VEHICLE`,hash:17815877436373559451n,result:`Vehicle`,params:[`float x`,`float y`,`float z`,`float radius`,`Hash modelHash`,`int flags`]},(e,t,n,r,i,a)=>Pv(e,G.vehicle,t,n,r,i,e=>a===0||e.model===a)?.handle??0),S({name:`GET_CLOSEST_PED`,hash:14067759205800968548n,result:`BOOL`,params:[`float x`,`float y`,`float z`,`float radius`,`BOOL p4`,`BOOL p5`,`Ped* outPed`,`BOOL p7`,`BOOL p8`,`int pedType`]},(e,t,n,r,i,a,o,s)=>{let{playerPed:c}=e.manager.world,l=Pv(e,G.ped,t,n,r,i,e=>e!==c);return s.set(l?.handle??0),l!==void 0}),S({name:`IS_ANY_VEHICLE_NEAR_POINT`,hash:7053161900751974118n,result:`BOOL`,params:[`float x`,`float y`,`float z`,`float radius`]},(e,t,n,r,i)=>Pv(e,G.vehicle,t,n,r,i,()=>!0)!==void 0),S({name:`GET_ENTITY_ALPHA`,hash:6505365780593284294n,result:`int`,params:[`Entity entity`]},(e,t)=>X(e,t)?.alpha??0),S({name:`SET_ENTITY_ALPHA`,hash:4945100874290747328n,result:`void`,params:[`Entity entity`,`int alphaLevel`,`BOOL skin`]},(e,t,n)=>{let r=X(e,t);r!==void 0&&(r.alpha=n)}),S({name:`RESET_ENTITY_ALPHA`,hash:11177514605217251962n,result:`void`,params:[`Entity entity`]},(e,t)=>{let n=X(e,t);n!==void 0&&(n.alpha=255)}),S({name:`SET_ENTITY_COLLISION`,hash:1914599121192125055n,result:`void`,params:[`Entity entity`,`BOOL toggle`,`BOOL keepPhysics`]},(e,t,n)=>{let r=X(e,t);r!==void 0&&(r.collision=n)}),S({name:`GET_ENTITY_COLLISION_DISABLED`,hash:14767841371638916224n,result:`BOOL`,params:[`Entity entity`]},(e,t)=>X(e,t)?.collision===!1),S({name:`SET_PLAYER_INVINCIBLE`,hash:2564000551796991966n,result:`void`,params:[`Player player`,`BOOL bInvincible`]},(e,t,n)=>{e.manager.world.playerInvincible=n}),S({name:`GET_PLAYER_INVINCIBLE`,hash:13195995625634897415n,result:`BOOL`,params:[`Player player`]},e=>e.manager.world.playerInvincible),S({name:`SET_PLAYER_CONTROL`,hash:10174252221492641954n,result:`void`,params:[`Player player`,`BOOL bHasControl`,`int flags`]},(e,t,n)=>{e.manager.world.playerControl=n}),S({name:`IS_PLAYER_CONTROL_ON`,hash:5315141875575487047n,result:`BOOL`,params:[`Player player`]},e=>e.manager.world.playerControl),S({name:`_NETWORK_GET_PLAYER_COORDS`,hash:1323615614803510740n,result:`Vector3`,params:[`Player player`]},(e,t)=>{let n=X(e,$g(e,t));return n===void 0?Mv:Nv([n.x,n.y,n.z])})]}const Iv=[`spawnmanager`,`mapmanager`,`baseevents`,`chat`,`sessionmanager`,`monitor`];function Lv(e){let t=[],n=[S({name:`GET_RESOURCE_STATE`,result:`char*`,params:[`char* resourceName`]},(e,t)=>e.manager.getResource(U(t,0))?.state??`missing`),S({name:`GET_NUM_RESOURCES`,result:`int`,params:[]},e=>(t=Array.from(e.manager.resources,e=>e.name),t.length)),S({name:`GET_RESOURCE_BY_FIND_INDEX`,result:`char*`,params:[`int findIndex`]},(e,n)=>t[n]??null),S({name:`GET_NUM_RESOURCE_METADATA`,result:`int`,params:[`char* resourceName`,`char* metadataKey`]},(e,t,n)=>{let r=e.manager.getResource(U(t,0));return r===void 0?0:r.entries(U(n,1)).length}),S({name:`GET_RESOURCE_METADATA`,result:`char*`,params:[`char* resourceName`,`char* metadataKey`,`int index`]},(e,t,n,r)=>{let i=e.manager.getResource(U(t,0));return i===void 0?null:i.entries(U(n,1))[r]??null}),S({name:`LOAD_RESOURCE_FILE`,result:`char*`,params:[`char* resourceName`,`char* fileName`]},(e,t,n)=>{let r=U(n,1),i=e.manager.getResource(U(t,0));return(i===void 0?void 0:Rv(i,r))??null})];return e===`client`?n:[...n,S({name:`SCHEDULE_RESOURCE_TICK`,result:`void`,params:[`char* resourceName`]},()=>{}),S({name:`GET_RESOURCE_PATH`,result:`char*`,params:[`char* resourceName`]},(e,t)=>e.manager.getResource(U(t,0))?.path??null),S({name:`SAVE_RESOURCE_FILE`,result:`BOOL`,params:[`char* resourceName`,`char* fileName`,`bytes data`,`int dataLength`]},(e,t,n,r,i)=>{let a=e.manager.getResource(U(t,0));if(a===void 0)return!1;let o=U(n,1);if(!zv(e,a,o))return!1;let s=Bv(e,a,o),{files:c}=e.manager;return s===void 0||!c.write(s,/* @__PURE__ */ new Uint8Array)?!1:(c.write(s,Vv(e,U(r,2),i)),!0)}),S({name:`START_RESOURCE`,result:`BOOL`,params:[`char* resourceName`]},(e,t)=>e.manager.getResource(U(t,0))?.start()??!1),S({name:`STOP_RESOURCE`,result:`BOOL`,params:[`char* resourceName`]},(e,t)=>{let n=e.manager.getResource(U(t,0));return n===void 0?!1:n===e.manager.currentResource?(e.diagnose(`StopResource cannot stop ${n.name}: FiveM keeps resources from stopping themselves.`),!1):Iv.includes(n.name)?(e.diagnose(`StopResource cannot stop ${n.name}: FiveM keeps scripts from stopping ${Iv.join(`, `)}.`),!1):n.stop()})]}function Rv(e,t){if(e.path===``||e.manager.side===`client`&&!e.path.startsWith(`resources:/`))return;let n=t.replace(/^[/\\]+/,``);if(/^[A-Za-z]:/.test(n))return;let r=C(e.path),i=C(`${r}/${n}`);if(i.startsWith(`${r}/`))return e.file(i.slice(r.length+1))}function zv(e,t,n){if(n.split(/[\\/]/).every(e=>e===``))return!1;let{currentResource:r,filesystemPermissions:i}=e.manager,a=r?.name??``;return a===t.name||i?.mayWrite(a,t.name)?!0:(e.diagnose(`SaveResourceFile cannot write ${n} in ${t.name}: FiveM lets resources write the files of others only with add_filesystem_permission.`),!1)}function Bv(e,t,n){let r=n.split(/[\\/]/).at(-1);if(r===``||r===`.`||r===`..`)return;let i=C(`${C(t.path)}/${n}`),a=Ao(i);if(e.manager.files.list(a)===void 0)e.diagnose(`SaveResourceFile cannot write ${n} in ${t.name}: there is no directory ${a}, and FiveM creates none.`);else return i}function Vv(e,t,n){if(n===0||n===-1){let e=t.indexOf(0);return e===-1?t:t.subarray(0,e)}if(n<0||n>t.length+1)return e.diagnose(`SaveResourceFile was told to write ${n} bytes of data that has ${t.length}. FiveM would write what follows the data in memory, which FiveRunner does not emulate: it writes the data.`),t;if(n<=t.length)return t.subarray(0,n);let r=new Uint8Array(n);return r.set(t),r}function Hv(e){return e.manager.world.screen}function Uv(e){if(e===`server`)return[];let t=e=>Hv(e).level(e.manager.time());return[S({name:`DO_SCREEN_FADE_OUT`,hash:9879590510830748335n,result:`void`,params:[`int duration`]},(e,t)=>Hv(e).fade(1,t,e.manager.time())),S({name:`DO_SCREEN_FADE_IN`,hash:15341760935224295475n,result:`void`,params:[`int duration`]},(e,t)=>Hv(e).fade(0,t,e.manager.time())),S({name:`IS_SCREEN_FADED_OUT`,hash:12785665044532404610n,result:`BOOL`,params:[]},e=>Hv(e).fadesTo(1)&&t(e)===1),S({name:`IS_SCREEN_FADED_IN`,hash:6522783478398879352n,result:`BOOL`,params:[]},e=>Hv(e).fadesTo(0)&&t(e)===0),S({name:`IS_SCREEN_FADING_OUT`,hash:8753528501838783119n,result:`BOOL`,params:[]},e=>Hv(e).fadesTo(1)&&t(e)<1),S({name:`IS_SCREEN_FADING_IN`,hash:6653025866621830517n,result:`BOOL`,params:[]},e=>Hv(e).fadesTo(0)&&t(e)>0)]}const Wv=S({name:`GET_HASH_KEY`,hash:15153829671144605900n,result:`Hash`,params:[`bytes string`]},(e,t)=>t===null?0:x(t)),Gv=S({name:`GET_HASH_KEY`,result:`int`,params:[`bytes model`]},(e,t)=>x(U(t,0))),Kv=S({name:`GET_GAME_TIMER`,hash:11300229656120296547n,result:`int`,params:[]},e=>Math.trunc(e.manager.time())|0),qv=S({name:`GET_GAME_TIMER`,result:`long`,params:[]},e=>Math.trunc(e.manager.time()));function Jv(e){return[S({name:`GET_CURRENT_RESOURCE_NAME`,result:`char*`,params:[]},e=>e.manager.currentResource?.name??null),S({name:`GET_INVOKING_RESOURCE`,result:`char*`,params:[]},e=>e.manager.invokingResource?.name??null),S({name:`GET_INSTANCE_ID`,result:`int`,params:[]},e=>e.runtime.host.instanceId),S({name:`IS_DUPLICITY_VERSION`,result:`BOOL`,params:[]},e=>e.manager.side===`server`),S({name:`GET_GAME_NAME`,result:`char*`,params:[]},e=>e.manager.side===`server`?`fxserver`:`fivem`),S({name:`FORMAT_STACK_TRACE`,result:`char*`,params:[`object traceData`]},(e,t)=>e.manager.formatStackTrace(t)),e===`client`?Kv:qv,e===`client`?Wv:Gv]}const Yv=new TextEncoder;function Xv(e){return{type:`str`,bytes:Yv.encode(e)}}function Zv(e){let t=/* @__PURE__ */ new Map,r=(e,n)=>{e.states.onChange.disconnect(n);let r=t.get(n);r!==void 0&&(t.delete(n),e.deleteFunctionReference(r))},i=[S({name:`GET_STATE_BAG_VALUE`,result:`object`,params:[`char* bagName`,`char* key`]},(e,t,n)=>{let r=U(t,0),i=U(n,1);return e.manager.states.get(r)?.get(i)??E(null)}),S({name:`SET_STATE_BAG_VALUE`,result:`void`,params:[`char* bagName`,`char* keyName`,`buffer valueData`,`int valueLength`,`BOOL replicated`]},(t,n,r,i,a,o)=>{let s=U(n,0),c=U(r,1),l=U(i,2),{manager:u}=t;e===`client`&&o&&u.strictStateBags?t.runtime.emitWarning(`natives`,`StateBags can't be modified from the client, because the StateBag strict mode is enabled. Disable it using setr sv_stateBagStrictMode false
|
|
5001
|
-
`):u.states.get(s)?.set(0,c,l,o)}),S({name:`ADD_STATE_BAG_CHANGE_HANDLER`,result:`int`,params:[`char* keyFilter`,`char* bagFilter`,`func handler`]},(e,n,i,a)=>{let o=n??``,s=i??``,c=U(a,2),{manager:l,resource:u}=e;l.duplicateFunctionReference(c);let d=l.states.onChange.connect((e,t,n,r,i)=>{if((o===``||n===o)&&(s===``||t===s)){let a={type:`array`,items:[Xv(t),Xv(n),r,{type:e<0?`negative`:`positive`,value:BigInt(e)},{type:`boolean`,value:i}]};l.invokeFunctionReference(c,Ga(a))}});return t.set(d,c),u.onStop.connect(()=>r(l,d)),d}),S({name:`REMOVE_STATE_BAG_CHANGE_HANDLER`,result:`void`,params:[`int cookie`]},(e,t)=>r(e.manager,t)),S({name:`STATE_BAG_HAS_KEY`,result:`BOOL`,params:[`char* bagName`,`char* key`]},(e,t,n)=>{let r=U(t,0),i=U(n,1);return e.manager.states.get(r)?.has(i)??!1}),S({name:`GET_STATE_BAG_KEYS`,result:`object`,params:[`char* bagName`]},(e,t)=>{let n=U(t,0);return E(e.manager.states.get(n)?.keys()??[])})];return e===`client`?[...i,S({name:`GET_ENTITY_FROM_STATE_BAG_NAME`,result:`int`,params:[`char* bagName`]},(e,t)=>{let r=U(t,0),i=e.manager.world;return r.startsWith(`entity:`)?i.byObjectId(n(r.slice(7)))?.handle??0:r.startsWith(`localEntity:`)?i.byHandle(n(r.slice(12)))?.handle??0:0})]:[...i,S({name:`GET_PLAYER_FROM_STATE_BAG_NAME`,result:`int`,params:[`char* bagName`]},(e,t)=>{let r=U(t,0);return r.startsWith(`player:`)?e.manager.session?.player(n(r.slice(7)))?.netId??0:0}),S({name:`GET_ENTITY_FROM_STATE_BAG_NAME`,result:`int`,params:[`char* bagName`]},(e,t)=>{let r=U(t,0);if(!r.startsWith(`entity:`))return 0;let i=e.manager.gameState,a=i.byObjectId(n(r.slice(7)));return a===void 0?0:i.handleOf(a)})]}function Qv(e,t,n){e.diagnose(`${t} was asked of the model 0x${(n>>>0).toString(16)}, of which FiveRunner knows nothing: it has no list of the models of GTA V, so it says false. Models are vehicles, peds or objects once scripts created entities of them.`)}function $v(e){if(e===`server`)return[];let t=(e,t,n,r)=>{let i=/* @__PURE__ */ new Set;return S({name:e,hash:t,result:`BOOL`,params:[`Hash model`]},(e,t)=>{let a=e.manager.world.kindOf(t);return a===G.none&&t!==0&&!i.has(t)&&(i.add(t),Qv(e,r,t)),a===n})},n=/* @__PURE__ */ new WeakMap,r=e=>{let t=n.get(e.manager)??/* @__PURE__ */ new Map;return n.set(e.manager,t),t},i=(e,t)=>S({name:e,hash:t,result:`int`,params:[`char* scaleformName`]},(e,t)=>{let n=r(e),i=n.size+1;return n.set(i,t??``),e.manager.world.requestAsset(`scaleform`,t??``),i});return[i(`REQUEST_SCALEFORM_MOVIE`,1296532278728670831n),i(`REQUEST_SCALEFORM_MOVIE_INSTANCE`,14201055364078303238n),S({name:`HAS_SCALEFORM_MOVIE_LOADED`,hash:9651244295395497742n,result:`BOOL`,params:[`int scaleformHandle`]},(e,t)=>{let n=r(e).get(t);return n!==void 0&&e.manager.world.assetLoaded(`scaleform`,n)}),S({name:`HAS_SCALEFORM_MOVIE_FILENAME_LOADED`,hash:872675186769785655n,result:`BOOL`,params:[`char* scaleformName`]},(e,t)=>e.manager.world.assetLoaded(`scaleform`,t??``)),S({name:`SET_SCALEFORM_MOVIE_AS_NO_LONGER_NEEDED`,hash:2095068147598518289n,result:`void`,params:[`int* scaleformHandle`]},(e,t)=>t.set(0)),S({name:`HAS_PTFX_ASSET_LOADED`,hash:14590989371548583963n,result:`BOOL`,params:[]},()=>!0),...[[`REQUEST_AMBIENT_AUDIO_BANK`,18303473030733143449n],[`REQUEST_MISSION_AUDIO_BANK`,8306253829043839218n]].map(([e,t])=>S({name:e,hash:t,result:`BOOL`,params:[`char* bankName`,`BOOL bOverNetwork`]},()=>!0)),S({name:`REGISTER_PEDHEADSHOT`,hash:4927612575077781622n,result:`int`,params:[`Ped ped`]},(e,t)=>e.manager.world.byHandle(t)===void 0?0:1),...[[`IS_PEDHEADSHOT_READY`,8107924672780253799n],[`IS_PEDHEADSHOT_VALID`,11576897081859713442n]].map(([e,t])=>S({name:e,hash:t,result:`BOOL`,params:[`int id`]},(e,t)=>t!==0)),S({name:`GET_PEDHEADSHOT_TXD_STRING`,hash:15802758171925831019n,result:`char*`,params:[`int id`]},()=>`CHAR_DEFAULT`),S({name:`REQUEST_MODEL`,hash:10825852671273492652n,result:`void`,params:[`Hash model`]},(e,t)=>{t!==0&&e.manager.world.request(t)}),S({name:`HAS_MODEL_LOADED`,hash:10999174976919095634n,result:`BOOL`,params:[`Hash model`]},(e,t)=>e.manager.world.loaded(t)),S({name:`IS_MODEL_IN_CDIMAGE`,hash:3871372195910563393n,result:`BOOL`,params:[`Hash model`]},(e,t)=>t!==0),S({name:`IS_MODEL_VALID`,hash:13846715278875188882n,result:`BOOL`,params:[`Hash model`]},(e,t)=>t!==0),t(`IS_MODEL_A_VEHICLE`,1849511532187010366n,G.vehicle,`IsModelAVehicle`),t(`_IS_MODEL_A_PED`,8467160340481104597n,G.ped,`IsModelAPed`),S({name:`GET_DISPLAY_NAME_FROM_VEHICLE_MODEL`,hash:12832350468514893849n,result:`char*`,params:[`Hash modelHash`]},()=>`CARNOTFOUND`),S({name:`SET_MODEL_AS_NO_LONGER_NEEDED`,hash:16515533089562745515n,result:`void`,params:[`Hash model`]},()=>{}),...ey(`anim`,`char* animDict`,{request:[`REQUEST_ANIM_DICT`,15257422121632202486n],loaded:[`HAS_ANIM_DICT_LOADED`,15001957746457249932n],remove:[`REMOVE_ANIM_DICT`,17756110238032734726n],exists:[`DOES_ANIM_DICT_EXIST`,3288925407143094625n]}),...ey(`animset`,`char* animSet`,{request:[`REQUEST_ANIM_SET`,7972635428772450029n],loaded:[`HAS_ANIM_SET_LOADED`,14189161536823175600n],remove:[`REMOVE_ANIM_SET`,1600190916137591987n]}),...ey(`clipset`,`char* clipSet`,{request:[`REQUEST_CLIP_SET`,15179134168094313033n],loaded:[`HAS_CLIP_SET_LOADED`,3567472081491954419n],remove:[`REMOVE_CLIP_SET`,141645767035637140n]}),...ey(`texture`,`char* textureDict`,{request:[`REQUEST_STREAMED_TEXTURE_DICT`,16114705809917771221n],loaded:[`HAS_STREAMED_TEXTURE_DICT_LOADED`,91750494399812324n],remove:[`SET_STREAMED_TEXTURE_DICT_AS_NO_LONGER_NEEDED`,13703517772758820869n]},[`BOOL p1`]),...ey(`ptfx`,`char* fxName`,{request:[`REQUEST_NAMED_PTFX_ASSET`,13262405284139535030n],loaded:[`HAS_NAMED_PTFX_ASSET_LOADED`,9728410087137920084n],remove:[`REMOVE_NAMED_PTFX_ASSET`,6873033708056672621n]}),...ey(`weapon`,`Hash weaponHash`,{request:[`REQUEST_WEAPON_ASSET`,6071771004139350467n],loaded:[`HAS_WEAPON_ASSET_LOADED`,3955096325251305710n],remove:[`REMOVE_WEAPON_ASSET`,12252305655226026236n]},[`int p1`,`int p2`]),S({name:`REQUEST_IPL`,hash:4734559983020792692n,result:`void`,params:[`char* iplName`]},(e,t)=>{t&&e.manager.world.ipls.add(t.toLowerCase())}),S({name:`REMOVE_IPL`,hash:17180206544770345005n,result:`void`,params:[`char* iplName`]},(e,t)=>{e.manager.world.ipls.delete((t??``).toLowerCase())}),S({name:`IS_IPL_ACTIVE`,hash:9846911559021573269n,result:`BOOL`,params:[`char* iplName`]},(e,t)=>e.manager.world.ipls.has((t??``).toLowerCase()))]}function ey(e,t,n,r=[]){let i=e=>typeof e==`number`?e===0?``:String(e>>>0):e??``,[a,o]=n.request,[s,c]=n.loaded,[l,u]=n.remove;return[S({name:a,hash:o,result:`void`,params:[t,...r]},(t,n)=>{let r=i(n);r!==``&&t.manager.world.requestAsset(e,r)}),S({name:s,hash:c,result:`BOOL`,params:[t]},(t,n)=>t.manager.world.assetLoaded(e,i(n))),S({name:l,hash:u,result:`void`,params:[t]},()=>{}),...n.exists===void 0?[]:[S({name:n.exists[0],hash:n.exists[1],result:`BOOL`,params:[t]},(e,t)=>i(t)!==``)]]}const ty=e=>e===void 0?{}:{hash:e};function $(e,t){let n=X(e,t);return n!==void 0&&K(n.type)===G.vehicle?n.parts:void 0}function ny(e,t,n,r,i){return[S({name:e,...ty(t),result:`float`,params:[`Vehicle vehicle`]},(e,t)=>$(e,t)?.[i]??0),S({name:n,...ty(r),result:`void`,params:[`Vehicle vehicle`,`float value`]},(e,t,n)=>{let r=$(e,t);r!==void 0&&(r[i]=n)})]}function ry(e,t,n,r,i){return[S({name:e,hash:t,result:`int`,params:[`Vehicle vehicle`]},(e,t)=>$(e,t)?.[i]??0),S({name:n,hash:r,result:`void`,params:[`Vehicle vehicle`,`int value`]},(e,t,n)=>{let r=$(e,t);r!==void 0&&(r[i]=n)})]}function iy(e,t,n,r,i){return[S({name:e,...ty(t),result:`BOOL`,params:[`Vehicle vehicle`]},(e,t)=>$(e,t)?.[i]??!1),S({name:n,hash:r,result:`void`,params:[`Vehicle vehicle`,`BOOL toggle`]},(e,t,n)=>{let r=$(e,t);r!==void 0&&(r[i]=n)})]}function ay(e,t,n,r,i,a){return[S({name:e,hash:t,result:`void`,params:[`Vehicle vehicle`,`int* first`,`int* second`]},(e,t,n,r)=>{let o=$(e,t);n.set(o?.[i]??0),r.set(o?.[a]??0)}),S({name:n,hash:r,result:`void`,params:[`Vehicle vehicle`,`int first`,`int second`]},(e,t,n,r)=>{let o=$(e,t);o!==void 0&&(o[i]=n,o[a]=r)})]}function oy(e,t,n,r,i){return[S({name:e,hash:t,result:`void`,params:[`Vehicle vehicle`,`int* color`]},(e,t,n)=>n.set($(e,t)?.[i]??0)),S({name:n,hash:r,result:`void`,params:[`Vehicle vehicle`,`int color`]},(e,t,n)=>{let r=$(e,t);r!==void 0&&(r[i]=n)})]}function sy(e,t,n,r,i){return[S({name:e,hash:t,result:`void`,params:[`Vehicle vehicle`,`int* r`,`int* g`,`int* b`]},(e,t,n,r,a)=>{let[o,s,c]=$(e,t)?.[i]??[0,0,0];n.set(o),r.set(s),a.set(c)}),S({name:n,hash:r,result:`void`,params:[`Vehicle vehicle`,`int r`,`int g`,`int b`]},(e,t,n,r,a)=>{let o=$(e,t);o!==void 0&&(o[i]=[n,r,a])})]}const cy=(e,t,n)=>S({name:e,hash:t,result:`int`,params:[`Vehicle vehicle`]},(e,t)=>$(e,t)===void 0?0:n);function ly(e){if(e===`server`)return[];let t=/* @__PURE__ */ new WeakSet,n=e=>{t.has(e.manager)||(t.add(e.manager),e.diagnose(`SetVehicleMod does nothing on a vehicle without a mod kit, as in GTA V: call SetVehicleModKit(vehicle, 0) first.`))};return[...ny(`GET_VEHICLE_ENGINE_HEALTH`,14149504890089024184n,`SET_VEHICLE_ENGINE_HEALTH`,5041455353683427057n,`engineHealth`),...ny(`GET_VEHICLE_BODY_HEALTH`,17469766964027330322n,`SET_VEHICLE_BODY_HEALTH`,13221730319678876379n,`bodyHealth`),...ny(`GET_VEHICLE_PETROL_TANK_HEALTH`,9033565442791362676n,`SET_VEHICLE_PETROL_TANK_HEALTH`,8132189641834549464n,`petrolTankHealth`),...ny(`GET_VEHICLE_DIRT_LEVEL`,10310917179768153643n,`SET_VEHICLE_DIRT_LEVEL`,8778559758790880907n,`dirtLevel`),...ny(`GET_VEHICLE_FUEL_LEVEL`,void 0,`SET_VEHICLE_FUEL_LEVEL`,void 0,`fuelLevel`),...ny(`GET_VEHICLE_OIL_LEVEL`,void 0,`SET_VEHICLE_OIL_LEVEL`,void 0,`oilLevel`),...ny(`GET_VEHICLE_WHEEL_SIZE`,void 0,`SET_VEHICLE_WHEEL_SIZE`,void 0,`wheelSize`),...ny(`GET_VEHICLE_WHEEL_WIDTH`,void 0,`SET_VEHICLE_WHEEL_WIDTH`,void 0,`wheelWidth`),S({name:`GET_VEHICLE_WHEEL_HEALTH`,result:`float`,params:[`Vehicle vehicle`,`int wheelIndex`]},(e,t,n)=>{let r=$(e,t);return r===void 0?0:r.wheelHealth.get(n)??1e3}),S({name:`SET_VEHICLE_WHEEL_HEALTH`,result:`void`,params:[`Vehicle vehicle`,`int wheelIndex`,`float health`]},(e,t,n,r)=>$(e,t)?.wheelHealth.set(n,r)),S({name:`SET_VEHICLE_FIXED`,hash:1249505568339610652n,result:`void`,params:[`Vehicle vehicle`]},(e,t)=>$(e,t)?.fix()),S({name:`SET_VEHICLE_ENGINE_ON`,hash:2636792098548582430n,result:`void`,params:[`Vehicle vehicle`,`BOOL value`,`BOOL instantly`,`BOOL disableAutoStart`]},(e,t,n,r,i)=>{let a=$(e,t);a!==void 0&&(a.engineOn=n,a.autoStart=!i)}),S({name:`GET_IS_VEHICLE_ENGINE_RUNNING`,hash:12552068584028443438n,result:`BOOL`,params:[`Vehicle vehicle`]},(e,t)=>$(e,t)?.engineOn??!1),...iy(`IS_VEHICLE_SIREN_ON`,5520275388034856114n,`SET_VEHICLE_SIREN`,17623225488012915581n,`siren`),...iy(`IS_VEHICLE_ALARM_ACTIVATED`,4835145494804037428n,`SET_VEHICLE_ALARM`,14836518586668520780n,`alarm`),...iy(`GET_VEHICLE_HANDBRAKE`,void 0,`SET_VEHICLE_HANDBRAKE`,7514121110102895138n,`handbrake`),...iy(`GET_VEHICLE_TYRES_CAN_BURST`,7461228425533296619n,`SET_VEHICLE_TYRES_CAN_BURST`,16977941433352285254n,`tyresCanBurst`),S({name:`SET_VEHICLE_UNDRIVEABLE`,hash:9996419924669770645n,result:`void`,params:[`Vehicle vehicle`,`BOOL toggle`]},(e,t,n)=>{let r=$(e,t);r!==void 0&&(r.undriveable=n)}),S({name:`IS_VEHICLE_DRIVEABLE`,hash:5486543479196481881n,result:`BOOL`,params:[`Vehicle vehicle`,`BOOL isOnFireCheck`]},(e,t)=>{let n=$(e,t);return n!==void 0&&!n.undriveable&&n.engineHealth>0}),S({name:`SET_VEHICLE_LIGHTS`,hash:3812034297014287450n,result:`void`,params:[`Vehicle vehicle`,`int state`]},(e,t,n)=>{let r=$(e,t);r!==void 0&&(r.lights=n)}),S({name:`GET_VEHICLE_LIGHTS_STATE`,hash:13338338421850755375n,result:`BOOL`,params:[`Vehicle vehicle`,`BOOL* lightsOn`,`BOOL* highbeamsOn`]},(e,t,n,r)=>{let i=$(e,t);return n.set(i?.lights===2),r.set(!1),i!==void 0}),...ay(`GET_VEHICLE_COLOURS`,11642990248343929260n,`SET_VEHICLE_COLOURS`,5700796144468248065n,`primaryColour`,`secondaryColour`),...ay(`GET_VEHICLE_EXTRA_COLOURS`,4306607109209941751n,`SET_VEHICLE_EXTRA_COLOURS`,2321312457832869427n,`pearlescentColour`,`wheelColour`),...oy(`_GET_VEHICLE_INTERIOR_COLOR`,9012939617897488694n,`_SET_VEHICLE_INTERIOR_COLOR`,17585947422526242585n,`interiorColour`),...oy(`_GET_VEHICLE_DASHBOARD_COLOR`,13214509638265019391n,`_SET_VEHICLE_DASHBOARD_COLOR`,6956317558672667244n,`dashboardColour`),...sy(`GET_VEHICLE_CUSTOM_PRIMARY_COLOUR`,13136141173969739602n,`SET_VEHICLE_CUSTOM_PRIMARY_COLOUR`,8160934221331913706n,`customPrimary`),...sy(`GET_VEHICLE_CUSTOM_SECONDARY_COLOUR`,9478332663426216668n,`SET_VEHICLE_CUSTOM_SECONDARY_COLOUR`,3949330575929153364n,`customSecondary`),...sy(`GET_VEHICLE_TYRE_SMOKE_COLOR`,13129463142448411587n,`SET_VEHICLE_TYRE_SMOKE_COLOR`,13094920670137621519n,`tyreSmoke`),...sy(`_GET_VEHICLE_NEON_LIGHTS_COLOUR`,8510095654457341311n,`_SET_VEHICLE_NEON_LIGHTS_COLOUR`,10235090006366889621n,`neonColour`),...[[`GET_IS_VEHICLE_PRIMARY_COLOUR_CUSTOM`,17335973723136045595n,`customPrimary`],[`GET_IS_VEHICLE_SECONDARY_COLOUR_CUSTOM`,10451221855851406700n,`customSecondary`]].map(([e,t,n])=>S({name:e,hash:t,result:`BOOL`,params:[`Vehicle vehicle`]},(e,t)=>$(e,t)?.[n]!==void 0)),...[[`CLEAR_VEHICLE_CUSTOM_PRIMARY_COLOUR`,6188458765339386935n,`customPrimary`],[`CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR`,6916366759000678409n,`customSecondary`]].map(([e,t,n])=>S({name:e,hash:t,result:`void`,params:[`Vehicle vehicle`]},(e,t)=>{let r=$(e,t);r!==void 0&&(r[n]=void 0)})),S({name:`_IS_VEHICLE_NEON_LIGHT_ENABLED`,hash:10109334683377952421n,result:`BOOL`,params:[`Vehicle vehicle`,`int index`]},(e,t,n)=>$(e,t)?.neonLights.has(n)??!1),S({name:`_SET_VEHICLE_NEON_LIGHT_ENABLED`,hash:3073461435007496809n,result:`void`,params:[`Vehicle vehicle`,`int index`,`BOOL toggle`]},(e,t,n,r)=>{let i=$(e,t)?.neonLights;r?i?.add(n):i?.delete(n)}),...ry(`_GET_VEHICLE_XENON_LIGHTS_COLOR`,4467343895069330651n,`_SET_VEHICLE_XENON_LIGHTS_COLOR`,16433691881432431111n,`xenonColour`),S({name:`GET_VEHICLE_XENON_LIGHTS_CUSTOM_COLOR`,result:`BOOL`,params:[`Vehicle vehicle`,`int* red`,`int* green`,`int* blue`]},(e,t,n,r,i)=>{let a=$(e,t)?.customXenon,[o,s,c]=a??[0,0,0];return n.set(o),r.set(s),i.set(c),a!==void 0}),S({name:`SET_VEHICLE_XENON_LIGHTS_CUSTOM_COLOR`,result:`void`,params:[`Vehicle vehicle`,`int red`,`int green`,`int blue`]},(e,t,n,r,i)=>{let a=$(e,t);a!==void 0&&(a.customXenon=[n,r,i])}),S({name:`CLEAR_VEHICLE_XENON_LIGHTS_CUSTOM_COLOR`,result:`void`,params:[`Vehicle vehicle`]},(e,t)=>{let n=$(e,t);n!==void 0&&(n.customXenon=void 0)}),...ry(`GET_VEHICLE_MOD_KIT`,7144346870170407181n,`SET_VEHICLE_MOD_KIT`,2245783831530643834n,`modKit`),S({name:`SET_VEHICLE_MOD`,hash:7705768285972510429n,result:`void`,params:[`Vehicle vehicle`,`int modType`,`int modIndex`,`BOOL customTires`]},(e,t,r,i,a)=>{let o=$(e,t);o!==void 0&&(o.modKit===65535?n(e):o.mods.set(r,{index:i,variation:a}))}),S({name:`GET_VEHICLE_MOD`,hash:8586499896144719835n,result:`int`,params:[`Vehicle vehicle`,`int modType`]},(e,t,n)=>$(e,t)?.mods.get(n)?.index??-1),S({name:`GET_VEHICLE_MOD_VARIATION`,hash:12939491323657885148n,result:`BOOL`,params:[`Vehicle vehicle`,`int modType`]},(e,t,n)=>$(e,t)?.mods.get(n)?.variation??!1),S({name:`REMOVE_VEHICLE_MOD`,hash:10580672842142417412n,result:`void`,params:[`Vehicle vehicle`,`int modType`]},(e,t,n)=>$(e,t)?.mods.delete(n)),S({name:`GET_NUM_VEHICLE_MODS`,hash:16397203146118530630n,result:`int`,params:[`Vehicle vehicle`,`int modType`]},(e,t)=>$(e,t)===void 0?0:10),S({name:`TOGGLE_VEHICLE_MOD`,hash:3035231775696334088n,result:`void`,params:[`Vehicle vehicle`,`int modType`,`BOOL toggle`]},(e,t,n,r)=>{let i=$(e,t)?.toggledMods;r?i?.add(n):i?.delete(n)}),S({name:`IS_TOGGLE_MOD_ON`,hash:9561761758880500455n,result:`BOOL`,params:[`Vehicle vehicle`,`int modType`]},(e,t,n)=>$(e,t)?.toggledMods.has(n)??!1),...ry(`GET_VEHICLE_LIVERY`,3150587921134411402n,`SET_VEHICLE_LIVERY`,6971396915951620534n,`livery`),...ry(`_GET_VEHICLE_ROOF_LIVERY`,6924566214525471270n,`_SET_VEHICLE_ROOF_LIVERY`,12021137051077784176n,`roofLivery`),...[[`GET_VEHICLE_LIVERY_COUNT`,9779071972287304998n],[`_GET_VEHICLE_ROOF_LIVERY_COUNT`,6830623794211832020n]].map(([e,t])=>S({name:e,hash:t,result:`int`,params:[`Vehicle vehicle`]},()=>-1)),...ry(`GET_VEHICLE_WINDOW_TINT`,1072440087508450453n,`SET_VEHICLE_WINDOW_TINT`,6324494699532199574n,`windowTint`),S({name:`GET_NUM_VEHICLE_WINDOW_TINTS`,hash:11318148397216196359n,result:`int`,params:[]},()=>7),...ry(`GET_VEHICLE_WHEEL_TYPE`,12965049668393645788n,`SET_VEHICLE_WHEEL_TYPE`,5223808454466558881n,`wheelType`),S({name:`DOES_EXTRA_EXIST`,hash:1324855812493050196n,result:`BOOL`,params:[`Vehicle vehicle`,`int extraId`]},(e,t,n)=>$(e,t)?.extras.has(n)??!1),S({name:`IS_VEHICLE_EXTRA_TURNED_ON`,hash:15196977125611980989n,result:`BOOL`,params:[`Vehicle vehicle`,`int extraId`]},(e,t,n)=>$(e,t)?.extras.get(n)??!1),S({name:`SET_VEHICLE_EXTRA`,hash:9143331738832080073n,result:`void`,params:[`Vehicle vehicle`,`int extraId`,`BOOL disable`]},(e,t,n,r)=>$(e,t)?.extras.set(n,!r)),...ry(`GET_VEHICLE_DOOR_LOCK_STATUS`,2719216112082266466n,`SET_VEHICLE_DOORS_LOCKED`,13142674893052018598n,`doorLock`),cy(`_GET_NUMBER_OF_VEHICLE_DOORS`,10561550669898559821n,6),S({name:`SET_VEHICLE_DOOR_OPEN`,hash:8963811182594345058n,result:`void`,params:[`Vehicle vehicle`,`int doorIndex`,`BOOL loose`,`BOOL openInstantly`]},(e,t,n)=>$(e,t)?.openDoors.add(n)),S({name:`SET_VEHICLE_DOOR_SHUT`,hash:10653754407603636709n,result:`void`,params:[`Vehicle vehicle`,`int doorIndex`,`BOOL closeInstantly`]},(e,t,n)=>$(e,t)?.openDoors.delete(n)),S({name:`SET_VEHICLE_DOORS_SHUT`,hash:8654578603176050421n,result:`void`,params:[`Vehicle vehicle`,`BOOL closeInstantly`]},(e,t)=>$(e,t)?.openDoors.clear()),S({name:`GET_VEHICLE_DOOR_ANGLE_RATIO`,hash:18320533513229773781n,result:`float`,params:[`Vehicle vehicle`,`int doorIndex`]},(e,t,n)=>+!!$(e,t)?.openDoors.has(n)),S({name:`IS_VEHICLE_DOOR_FULLY_OPEN`,hash:4509014719907044386n,result:`BOOL`,params:[`Vehicle vehicle`,`int doorIndex`]},(e,t,n)=>$(e,t)?.openDoors.has(n)??!1),S({name:`SET_VEHICLE_DOOR_BROKEN`,hash:15336153818213079603n,result:`void`,params:[`Vehicle vehicle`,`int doorIndex`,`BOOL deleteDoor`]},(e,t,n)=>{let r=$(e,t);r?.brokenDoors.add(n),r?.openDoors.delete(n)}),S({name:`IS_VEHICLE_DOOR_DAMAGED`,hash:13322071994783909159n,result:`BOOL`,params:[`Vehicle veh`,`int doorID`]},(e,t,n)=>$(e,t)?.brokenDoors.has(n)??!1),S({name:`_GET_IS_DOOR_VALID`,hash:7232582464623474226n,result:`BOOL`,params:[`Vehicle vehicle`,`int doorIndex`]},(e,t,n)=>{let r=$(e,t);return r!==void 0&&n>=0&&n<6&&!r.brokenDoors.has(n)}),S({name:`SMASH_VEHICLE_WINDOW`,hash:11410817766430417497n,result:`void`,params:[`Vehicle vehicle`,`int windowIndex`]},(e,t,n)=>$(e,t)?.smashedWindows.add(n)),S({name:`REMOVE_VEHICLE_WINDOW`,hash:12038498450811400297n,result:`void`,params:[`Vehicle vehicle`,`int windowIndex`]},(e,t,n)=>$(e,t)?.smashedWindows.add(n)),S({name:`FIX_VEHICLE_WINDOW`,hash:8584567789502981762n,result:`void`,params:[`Vehicle vehicle`,`int windowIndex`]},(e,t,n)=>$(e,t)?.smashedWindows.delete(n)),S({name:`IS_VEHICLE_WINDOW_INTACT`,hash:5108614288122905073n,result:`BOOL`,params:[`Vehicle vehicle`,`int windowIndex`]},(e,t,n)=>{let r=$(e,t);return r!==void 0&&!r.smashedWindows.has(n)&&!r.rolledDownWindows.has(n)}),S({name:`ROLL_DOWN_WINDOW`,hash:8852360316713789923n,result:`void`,params:[`Vehicle vehicle`,`int windowIndex`]},(e,t,n)=>$(e,t)?.rolledDownWindows.add(n)),S({name:`ROLL_UP_WINDOW`,hash:6930569850916064601n,result:`void`,params:[`Vehicle vehicle`,`int windowIndex`]},(e,t,n)=>$(e,t)?.rolledDownWindows.delete(n)),S({name:`SET_VEHICLE_TYRE_BURST`,hash:17035463926257943429n,result:`void`,params:[`Vehicle vehicle`,`int index`,`BOOL onRim`,`float p3`]},(e,t,n,r)=>{let i=$(e,t);i?.tyresCanBurst&&i.burstTyres.set(n,r)}),S({name:`SET_VEHICLE_TYRE_FIXED`,hash:7931960884476783901n,result:`void`,params:[`Vehicle vehicle`,`int tyreIndex`]},(e,t,n)=>$(e,t)?.burstTyres.delete(n)),S({name:`IS_VEHICLE_TYRE_BURST`,hash:13414279665309277353n,result:`BOOL`,params:[`Vehicle vehicle`,`int wheelID`,`BOOL isBurstToRim`]},(e,t,n,r)=>{let i=$(e,t)?.burstTyres.get(n);return i!==void 0&&(!r||i)}),...[[`GET_VEHICLE_HANDLING_FLOAT`,`float`],[`GET_VEHICLE_HANDLING_INT`,`int`]].map(([e,t])=>S({name:e,result:t,params:[`Vehicle vehicle`,`char* class_`,`char* fieldName`]},(e,t,n,r)=>$(e,t)?.handling.get(r??``)??0)),S({name:`SET_VEHICLE_HANDLING_FLOAT`,result:`void`,params:[`Vehicle vehicle`,`char* class_`,`char* fieldName`,`float value`]},(e,t,n,r,i)=>$(e,t)?.handling.set(r??``,i)),S({name:`SET_VEHICLE_HANDLING_INT`,result:`void`,params:[`Vehicle vehicle`,`char* class_`,`char* fieldName`,`int value`]},(e,t,n,r,i)=>$(e,t)?.handling.set(r??``,i)),S({name:`SET_VEHICLE_ON_GROUND_PROPERLY`,hash:5292642784517372369n,result:`BOOL`,params:[`Vehicle vehicle`]},(e,t)=>$(e,t)!==void 0),S({name:`IS_VEHICLE_ON_ALL_WHEELS`,hash:12755545563352728290n,result:`BOOL`,params:[`Vehicle vehicle`]},(e,t)=>$(e,t)!==void 0),cy(`GET_VEHICLE_MAX_NUMBER_OF_PASSENGERS`,12089054235866735952n,3),S({name:`GET_VEHICLE_MODEL_NUMBER_OF_SEATS`,hash:3087559591220014500n,result:`int`,params:[`Hash modelHash`]},()=>4),S({name:`GET_VEHICLE_NUMBER_OF_PASSENGERS`,hash:2651249327676063369n,result:`int`,params:[`Vehicle vehicle`]},(e,t)=>{let n=X(e,t);return n===void 0?0:[...n.occupants.keys()].filter(e=>e>=0).length}),S({name:`IS_VEHICLE_MODEL`,hash:4773408663263202697n,result:`BOOL`,params:[`Vehicle vehicle`,`Hash model`]},(e,t,n)=>X(e,t)?.model===n),S({name:`IS_THIS_MODEL_A_CAR`,hash:9182194428474387960n,result:`BOOL`,params:[`Hash model`]},(e,t)=>e.manager.world.kindOf(t)===G.vehicle)]}function uy(e,t,n){let r=X(e,t);return r!==void 0&&K(r.type)===n?r:void 0}function dy(e){return e?.handle??0}function fy(e,t,n){let r=Y(e,t);return r!==void 0&&K(r.type)===n?r:void 0}function py(e,t){let n=w_(e),r=t===0?void 0:n.byObjectId(t);return r===void 0?0:n.handleOf(r)}function my(e){return e===`server`?gy():hy()}function hy(){let e=(e,t)=>uy(e,t,G.ped),t=(e,t)=>uy(e,t,G.vehicle),n=(n,r)=>S({name:n,hash:r,result:`void`,params:[`Ped ped`,`Vehicle vehicle`,`int seatIndex`]},(n,r,i,a)=>{let o=e(n,r),s=t(n,i);if(o===void 0||s===void 0||a<-2)return;let c=a===-2?0:a;for(;a===-2&&s.occupants.has(c);)c++;o.enterVehicle(s,c)}),r=(t,n,r)=>{let i=e(t,n)?.vehicle;return i!==void 0&&(r===void 0||i.handle===r)};return[n(`SET_PED_INTO_VEHICLE`,17823854667459462717n),n(`TASK_WARP_PED_INTO_VEHICLE`,11132063835731916420n),S({name:`TASK_ENTER_VEHICLE`,hash:13983202585294707880n,result:`void`,params:[`Ped ped`,`Vehicle vehicle`,`int timeout`,`int seatIndex`,`float speed`,`int flag`,`int p6`]},(n,r,i,a,o)=>{let s=e(n,r),c=t(n,i);if(s===void 0||c===void 0||o<-2)return;let l=o===-2?0:o;for(;o===-2&&c.occupants.has(l);)l++;s.enterVehicle(c,l)}),S({name:`TASK_EVERYONE_LEAVE_VEHICLE`,hash:9192806827815412338n,result:`void`,params:[`Vehicle vehicle`]},(e,n)=>{let r=t(e,n);for(let e of[...r?.occupants.values()??[]])e.leaveVehicle()}),S({name:`TASK_LEAVE_VEHICLE`,hash:15266022280670526978n,result:`void`,params:[`Ped ped`,`Vehicle vehicle`,`int flags`]},(t,n,r)=>{let i=e(t,n);i?.vehicle!==void 0&&i.vehicle.handle===r&&i.leaveVehicle()}),S({name:`TASK_LEAVE_ANY_VEHICLE`,hash:5786374414059643463n,result:`void`,params:[`Ped ped`,`int delayTime`,`int flags`]},(t,n)=>e(t,n)?.leaveVehicle()),S({name:`SET_PED_COORDS_KEEP_VEHICLE`,hash:11168644811073104686n,result:`void`,params:[`Ped ped`,`float posX`,`float posY`,`float posZ`]},(t,n,r,i,a)=>{let o=e(t,n);(o?.vehicle??o)?.moveTo(r,i,a)}),S({name:`GET_VEHICLE_PED_IS_IN`,hash:11137703836139538195n,result:`Vehicle`,params:[`Ped ped`,`BOOL includeLastVehicle`]},(t,n,r)=>{let i=e(t,n);return dy(r?i?.lastVehicle:i?.vehicle)}),S({name:`GET_VEHICLE_PED_IS_USING`,hash:6959377544440096893n,result:`Vehicle`,params:[`Ped ped`]},(t,n)=>dy(e(t,n)?.vehicle)),S({name:`IS_PED_ON_FOOT`,hash:143805665679202738n,result:`BOOL`,params:[`Ped ped`]},(t,n)=>{let r=e(t,n);return r!==void 0&&r.vehicle===void 0}),S({name:`GET_VEHICLE_PED_IS_TRYING_TO_ENTER`,hash:9317851689464185949n,result:`Vehicle`,params:[`Ped ped`]},()=>0),S({name:`GET_VEHICLE_PED_IS_ENTERING`,hash:17953197144696923644n,result:`Vehicle`,params:[`Ped ped`]},()=>0),S({name:`IS_PED_GETTING_INTO_A_VEHICLE`,hash:13476506400098240398n,result:`BOOL`,params:[`Ped ped`]},()=>!1),S({name:`GET_PLAYERS_LAST_VEHICLE`,hash:13157682470943312064n,result:`Vehicle`,params:[]},e=>dy(e.manager.world.playerPed.lastVehicle)),S({name:`IS_PED_IN_ANY_VEHICLE`,hash:11059360085529971211n,result:`BOOL`,params:[`Ped ped`,`BOOL atGetIn`]},(e,t)=>r(e,t)),S({name:`IS_PED_IN_VEHICLE`,hash:11812460267229133275n,result:`BOOL`,params:[`Ped ped`,`Vehicle vehicle`,`BOOL atGetIn`]},(e,t,n)=>r(e,t,n)),S({name:`IS_PED_SITTING_IN_ANY_VEHICLE`,hash:9397505571394551544n,result:`BOOL`,params:[`Ped ped`]},(e,t)=>r(e,t)),...[[`IS_PED_IN_ANY_HELI`,2993646556015384325n],[`IS_PED_IN_ANY_PLANE`,6917332199840217984n]].map(([e,t])=>S({name:e,hash:t,result:`BOOL`,params:[`Ped ped`]},()=>!1)),S({name:`IS_PED_SITTING_IN_VEHICLE`,hash:12108114641748692930n,result:`BOOL`,params:[`Ped ped`,`Vehicle vehicle`]},(e,t,n)=>r(e,t,n)),S({name:`GET_PED_IN_VEHICLE_SEAT`,hash:13493027623591629670n,result:`Ped`,params:[`Vehicle vehicle`,`int seatIndex`,`BOOL p2`]},(e,n,r)=>dy(t(e,n)?.occupants.get(r))),S({name:`GET_LAST_PED_IN_VEHICLE_SEAT`,hash:9509748267553039972n,result:`Ped`,params:[`Vehicle vehicle`,`int seatIndex`]},(e,n,r)=>dy(t(e,n)?.lastOccupants.get(r))),S({name:`IS_VEHICLE_SEAT_FREE`,hash:2498470473267324521n,result:`BOOL`,params:[`Vehicle vehicle`,`int seatIndex`,`BOOL isTaskRunning`]},(e,n,r)=>{let i=t(e,n);return i!==void 0&&!i.occupants.has(r)}),S({name:`SET_VEHICLE_NUMBER_PLATE_TEXT`,hash:10784026586230086215n,result:`void`,params:[`Vehicle vehicle`,`char* plateText`]},(e,n,r)=>{let i=t(e,n);i!==void 0&&(i.plate=(r??``).slice(0,8))}),S({name:`GET_VEHICLE_NUMBER_PLATE_TEXT`,hash:8998698628399956494n,result:`char*`,params:[`Vehicle vehicle`]},(e,n)=>t(e,n)?.plate??null),S({name:`SET_VEHICLE_NUMBER_PLATE_TEXT_INDEX`,hash:10414832911214686369n,result:`void`,params:[`Vehicle vehicle`,`int plateIndex`]},(e,n,r)=>{let i=t(e,n);i!==void 0&&(i.plateIndex=r)}),S({name:`GET_VEHICLE_NUMBER_PLATE_TEXT_INDEX`,hash:17373694244543164821n,result:`int`,params:[`Vehicle vehicle`]},(e,n)=>t(e,n)?.plateIndex??0)]}function gy(){let e=(e,t)=>fy(e,t,G.ped),t=(e,t)=>fy(e,t,G.vehicle),n=(e,n)=>S({name:e,result:`Entity`,params:[`Vehicle vehicle`,`int seatIndex`]},(e,r,i)=>{let a=t(e,r),o=i+2;return a===void 0||o<0||o>=32?0:py(e,n(a)[o])});return[S({name:`GET_VEHICLE_PED_IS_IN`,result:`Entity`,params:[`Ped ped`,`BOOL lastVehicle`]},(t,n,r)=>{let i=e(t,n);if(i===void 0)return 0;let a=r?i.lastVehiclePedWasIn:i.state.vehicle??0;return a===-1?0:py(t,a)}),n(`GET_PED_IN_VEHICLE_SEAT`,e=>e.occupants),n(`GET_LAST_PED_IN_VEHICLE_SEAT`,e=>e.lastOccupants),S({name:`GET_SEAT_PED_IS_USING`,result:`int`,params:[`Ped ped`]},(t,n)=>{let r=e(t,n);return r===void 0?-3:(r.state.vehicleSeat??0)-2}),S({name:`IS_PED_IN_ANY_VEHICLE`,result:`BOOL`,params:[`Ped ped`]},(t,n)=>{let r=e(t,n);return r!==void 0&&(r.state.vehicleSeat??0)!==-1}),S({name:`IS_PED_IN_VEHICLE`,result:`BOOL`,params:[`Ped ped`,`Vehicle vehicle`]},(t,n,r)=>{let i=e(t,n);if(r===0||i===void 0)return!1;let{vehicle:a=0,vehicleSeat:o=0}=i.state;if(a===-1||a===0||o===-1)return!1;let s=w_(t).byHandle(r);return s!==void 0&&s.objectId===a}),S({name:`GET_VEHICLE_NUMBER_PLATE_TEXT`,result:`char*`,params:[`Vehicle vehicle`]},(e,n)=>t(e,n)?.state.plate??``),S({name:`GET_VEHICLE_NUMBER_PLATE_TEXT_INDEX`,result:`int`,params:[`Vehicle vehicle`]},(e,n)=>t(e,n)?.state.plateIndex??0)]}function _y(e){return e===`server`?[]:[S({name:`MUMBLE_IS_CONNECTED`,result:`BOOL`,params:[]},()=>!1),S({name:`MUMBLE_IS_PLAYER_TALKING`,result:`BOOL`,params:[`Player player`]},()=>!1),S({name:`NETWORK_IS_PLAYER_TALKING`,hash:224636770351277182n,result:`BOOL`,params:[`Player player`]},()=>!1),S({name:`MUMBLE_GET_TALKER_PROXIMITY`,result:`float`,params:[]},()=>0),S({name:`MUMBLE_GET_VOICE_CHANNEL_FROM_SERVER_ID`,result:`int`,params:[`int serverId`]},()=>0),Z(`MUMBLE_SET_TALKER_PROXIMITY`,void 0,[`float value`]),Z(`MUMBLE_SET_SERVER_ADDRESS`,void 0,[`char* address`,`int port`]),Z(`MUMBLE_SET_AUDIO_INPUT_INTENT`,void 0,[`Hash intentHash`]),Z(`MUMBLE_SET_VOICE_CHANNEL`,void 0,[`int channel`]),Z(`MUMBLE_SET_VOICE_TARGET`,void 0,[`int targetId`]),Z(`MUMBLE_CLEAR_VOICE_TARGET`,void 0,[`int targetId`]),Z(`MUMBLE_CLEAR_VOICE_TARGET_CHANNELS`,void 0,[`int targetId`]),Z(`MUMBLE_CLEAR_VOICE_TARGET_PLAYERS`,void 0,[`int targetId`]),Z(`MUMBLE_ADD_VOICE_TARGET_CHANNEL`,void 0,[`int targetId`,`int channel`]),Z(`MUMBLE_ADD_VOICE_TARGET_PLAYER_BY_SERVER_ID`,void 0,[`int targetId`,`int serverId`]),Z(`MUMBLE_ADD_VOICE_CHANNEL_LISTEN`,void 0,[`int channel`]),Z(`MUMBLE_REMOVE_VOICE_CHANNEL_LISTEN`,void 0,[`int channel`]),Z(`MUMBLE_SET_VOLUME_OVERRIDE_BY_SERVER_ID`,void 0,[`int serverId`,`float volume`]),Z(`MUMBLE_SET_SUBMIX_FOR_SERVER_ID`,void 0,[`int serverId`,`int submixId`])]}function vy(e,t){let n=X(e,t);return n!==void 0&&K(n.type)===G.ped?n:void 0}function yy(e,t,n){return vy(e,t)?.weapons.get(n)}function by(e){return e===`server`?Sy():xy()}function xy(){return[S({name:`IS_PED_ARMED`,hash:5140692576702410007n,result:`BOOL`,params:[`Ped ped`,`int typeFlags`]},(e,t)=>{let n=vy(e,t)?.weapon;return n!==void 0&&n!==vg}),S({name:`GIVE_WEAPON_TO_PED`,hash:13767458866752540619n,result:`void`,params:[`Ped ped`,`Hash weaponHash`,`int ammoCount`,`BOOL isHidden`,`BOOL bForceInHand`]},(e,t,n,r,i,a)=>{let o=vy(e,t);if(o===void 0||n===0||n===vg)return;let s=o.weapons.get(n);s===void 0?o.weapons.set(n,{ammo:r,components:/* @__PURE__ */ new Set,tint:0}):s.ammo+=r,a&&(o.weapon=n)}),S({name:`REMOVE_WEAPON_FROM_PED`,hash:5231435679784720824n,result:`void`,params:[`Ped ped`,`Hash weaponHash`]},(e,t,n)=>{let r=vy(e,t);r?.weapons.delete(n)&&r.weapon===n&&(r.weapon=vg)}),S({name:`REMOVE_ALL_PED_WEAPONS`,hash:17464388802800305651n,result:`void`,params:[`Ped ped`,`BOOL p1`]},(e,t)=>{let n=vy(e,t);n?.weapons.clear(),n!==void 0&&(n.weapon=vg)}),S({name:`SET_CURRENT_PED_WEAPON`,hash:12535367907453402124n,result:`void`,params:[`Ped ped`,`Hash weaponHash`,`BOOL bForceInHand`]},(e,t,n)=>{let r=vy(e,t);r!==void 0&&(n===vg||r.weapons.has(n))&&(r.weapon=n)}),S({name:`GET_SELECTED_PED_WEAPON`,hash:751455270629331523n,result:`Hash`,params:[`Ped ped`]},(e,t)=>vy(e,t)?.weapon??0),S({name:`GET_CURRENT_PED_WEAPON`,hash:4217590589943717204n,result:`BOOL`,params:[`Ped ped`,`Hash* weaponHash`,`BOOL doDeadCheck`]},(e,t,n)=>{let r=vy(e,t)?.weapon??0;return n.set(r),r!==0&&r!==vg}),S({name:`HAS_PED_GOT_WEAPON`,hash:10226742572059207868n,result:`BOOL`,params:[`Ped ped`,`Hash weaponHash`,`BOOL p2`]},(e,t,n)=>yy(e,t,n)!==void 0),S({name:`GET_AMMO_IN_PED_WEAPON`,hash:97480644549409105n,result:`int`,params:[`Ped ped`,`Hash weaponhash`]},(e,t,n)=>yy(e,t,n)?.ammo??0),S({name:`SET_PED_AMMO`,hash:1505728147329083929n,result:`void`,params:[`Ped ped`,`Hash weaponHash`,`int ammo`]},(e,t,n,r)=>{let i=yy(e,t,n);i!==void 0&&(i.ammo=r)}),S({name:`ADD_AMMO_TO_PED`,hash:8714538174022443552n,result:`void`,params:[`Ped ped`,`Hash weaponHash`,`int ammo`]},(e,t,n,r)=>{let i=yy(e,t,n);i!==void 0&&(i.ammo+=r)}),S({name:`GIVE_WEAPON_COMPONENT_TO_PED`,hash:15665442664280656825n,result:`void`,params:[`Ped ped`,`Hash weaponHash`,`Hash componentHash`]},(e,t,n,r)=>yy(e,t,n)?.components.add(r)),S({name:`REMOVE_WEAPON_COMPONENT_FROM_PED`,hash:2201109082612124681n,result:`void`,params:[`Ped ped`,`Hash weaponHash`,`Hash componentHash`]},(e,t,n,r)=>yy(e,t,n)?.components.delete(r)),S({name:`HAS_PED_GOT_WEAPON_COMPONENT`,hash:14236759287530185536n,result:`BOOL`,params:[`Ped ped`,`Hash weaponHash`,`Hash componentHash`]},(e,t,n,r)=>yy(e,t,n)?.components.has(r)??!1),S({name:`SET_PED_WEAPON_TINT_INDEX`,hash:5806999861877102392n,result:`void`,params:[`Ped ped`,`Hash weaponHash`,`int tintIndex`]},(e,t,n,r)=>{let i=yy(e,t,n);i!==void 0&&(i.tint=r)}),S({name:`GET_PED_WEAPON_TINT_INDEX`,hash:3143211000917945247n,result:`int`,params:[`Ped ped`,`Hash weaponHash`]},(e,t,n)=>yy(e,t,n)?.tint??-1),...[[`SET_PED_INFINITE_AMMO`,4529689184233022011n,[`Ped ped`,`BOOL toggle`]],[`SET_PED_INFINITE_AMMO_CLIP`,1746743299266654598n,[`Ped ped`,`BOOL toggle`]],[`SET_PED_CURRENT_WEAPON_VISIBLE`,514998932744280688n,[`Ped ped`,`BOOL visible`]],[`_0xF92099527DB8E2A7`,17951516694274433703n,[`int rewardType`,`BOOL suppress`]]].map(([e,t,n])=>S({name:e,hash:t,result:`void`,params:n},()=>{})),S({name:`IS_PED_SHOOTING`,hash:3774412487161016737n,result:`BOOL`,params:[`Ped ped`]},()=>!1)]}function Sy(){let e=(e,t)=>{let n=Y(e,t);return n!==void 0&&K(n.type)===G.ped?n.state.weapon??0:0};return[S({name:`GET_SELECTED_PED_WEAPON`,result:`Hash`,params:[`Ped ped`]},(t,n)=>e(t,n)),S({name:`GET_CURRENT_PED_WEAPON`,result:`Hash`,params:[`Ped ped`]},(t,n)=>e(t,n))]}function Cy(e){return e.manager.world.clock}function wy(e){return e.manager.world.weather}function Ty(e){if(e===`server`)return[];let t=(e,t,n=()=>{})=>S({name:e,hash:t,result:`void`,params:[`int hours`,`int minutes`,`int seconds`]},(e,t,r,i)=>{Cy(e).set(t,r,i,e.manager.time()),n(Cy(e))}),n=(e,t,n,r)=>S({name:e,hash:t,result:`int`,params:[]},e=>Math.floor(Cy(e).seconds(e.manager.time())/n)%r),r=(e,t,n)=>{t&&wy(e).turn(x(t),n*1e3,e.manager.time())},i=(e,t)=>S({name:e,hash:t,result:`void`,params:[`char* weatherType`]},(e,t)=>r(e,t,0));return[t(`NETWORK_OVERRIDE_CLOCK_TIME`,16607555653966641298n,e=>{e.overridden=!0}),t(`SET_CLOCK_TIME`,5171176378044663256n),t(`ADVANCE_CLOCK_TIME_TO`,14468542163779599163n),S({name:`ADD_TO_CLOCK_TIME`,hash:15498842407160086754n,result:`void`,params:[`int hours`,`int minutes`,`int seconds`]},(e,t,n,r)=>Cy(e).add(t,n,r,e.manager.time())),S({name:`NETWORK_CLEAR_CLOCK_TIME_OVERRIDE`,hash:15668831687896176238n,result:`void`,params:[]},e=>{Cy(e).overridden=!1}),S({name:`NETWORK_IS_CLOCK_TIME_OVERRIDDEN`,hash:15549061658607711522n,result:`BOOL`,params:[]},e=>Cy(e).overridden),S({name:`PAUSE_CLOCK`,hash:4635862130881195037n,result:`void`,params:[`BOOL toggle`]},(e,t)=>Cy(e).pause(t,e.manager.time())),S({name:`NETWORK_OVERRIDE_CLOCK_MILLISECONDS_PER_GAME_MINUTE`,result:`void`,params:[`int ms`]},(e,t)=>Cy(e).setMsPerMinute(t,e.manager.time())),S({name:`GET_MILLISECONDS_PER_GAME_MINUTE`,hash:3425916725698957787n,result:`int`,params:[]},e=>Cy(e).msPerMinute),n(`GET_CLOCK_HOURS`,2675767815307398015n,3600,24),n(`GET_CLOCK_MINUTES`,1428407088615670002n,60,60),n(`GET_CLOCK_SECONDS`,5282326276443980912n,1,60),i(`SET_WEATHER_TYPE_NOW_PERSIST`,17109505538612268170n),i(`SET_WEATHER_TYPE_NOW`,3005176124459292809n),i(`SET_WEATHER_TYPE_PERSIST`,8091143200275372431n),S({name:`SET_WEATHER_TYPE_OVERTIME_PERSIST`,hash:18109050757229278655n,result:`void`,params:[`char* weatherType`,`float time`]},(e,t,n)=>r(e,t,n)),S({name:`CLEAR_WEATHER_TYPE_PERSIST`,hash:14754798680422182133n,result:`void`,params:[]},()=>{}),S({name:`SET_OVERRIDE_WEATHER`,hash:11834717031454399471n,result:`void`,params:[`char* weatherType`]},(e,t)=>{t&&(wy(e).override=x(t))}),S({name:`CLEAR_OVERRIDE_WEATHER`,hash:3714676070527602768n,result:`void`,params:[]},e=>{wy(e).override=void 0}),S({name:`GET_PREV_WEATHER_TYPE_HASH_NAME`,hash:6218213562023429539n,result:`Hash`,params:[]},e=>wy(e).previous(e.manager.time())),S({name:`GET_NEXT_WEATHER_TYPE_HASH_NAME`,hash:8147899912429302114n,result:`Hash`,params:[]},e=>wy(e).next),S({name:`IS_PREV_WEATHER_TYPE`,hash:4968191145759412393n,result:`BOOL`,params:[`char* weatherType`]},(e,t)=>x(t??``)===wy(e).previous(e.manager.time())),S({name:`IS_NEXT_WEATHER_TYPE`,hash:3434621646856581725n,result:`BOOL`,params:[`char* weatherType`]},(e,t)=>x(t??``)===wy(e).next)]}function Ey(e){return[...Jv(e),...bh(),...Sh(),...Lv(e),...wh(e),...jh(e),...cv(e),...gv(e),...e_(e),...Zv(e),...L_(e),...Fv(e),...fv(e),...my(e),...ly(e),...u_(e),...$v(e),...Uv(e),...eh(e),...th(e),...Eh(e),...H_(e),...Ty(e),...yh(e),...jv(e),...by(e),...Nh(e),...tv(e),..._y(e),...e===`server`?[...ev(),...xv()]:vv()]}const Dy=`resources`;var Oy=class{#e;#t=/* @__PURE__ */ new Map;#n=/* @__PURE__ */ new Map;#r;constructor(e){this.#e=e}scan(){let e=this.#e;e.log(`resources`,`^2Scanning resources.^7
|
|
5001
|
+
`):u.states.get(s)?.set(0,c,l,o)}),S({name:`ADD_STATE_BAG_CHANGE_HANDLER`,result:`int`,params:[`char* keyFilter`,`char* bagFilter`,`func handler`]},(e,n,i,a)=>{let o=n??``,s=i??``,c=U(a,2),{manager:l,resource:u}=e;l.duplicateFunctionReference(c);let d=l.states.onChange.connect((e,t,n,r,i)=>{if((o===``||n===o)&&(s===``||t===s)){let a={type:`array`,items:[Xv(t),Xv(n),r,{type:e<0?`negative`:`positive`,value:BigInt(e)},{type:`boolean`,value:i}]};l.invokeFunctionReference(c,Ga(a))}});return t.set(d,c),u.onStop.connect(()=>r(l,d)),d}),S({name:`REMOVE_STATE_BAG_CHANGE_HANDLER`,result:`void`,params:[`int cookie`]},(e,t)=>r(e.manager,t)),S({name:`STATE_BAG_HAS_KEY`,result:`BOOL`,params:[`char* bagName`,`char* key`]},(e,t,n)=>{let r=U(t,0),i=U(n,1);return e.manager.states.get(r)?.has(i)??!1}),S({name:`GET_STATE_BAG_KEYS`,result:`object`,params:[`char* bagName`]},(e,t)=>{let n=U(t,0);return E(e.manager.states.get(n)?.keys()??[])})];return e===`client`?[...i,S({name:`GET_ENTITY_FROM_STATE_BAG_NAME`,result:`int`,params:[`char* bagName`]},(e,t)=>{let r=U(t,0),i=e.manager.world;return r.startsWith(`entity:`)?i.byObjectId(n(r.slice(7)))?.handle??0:r.startsWith(`localEntity:`)?i.byHandle(n(r.slice(12)))?.handle??0:0})]:[...i,S({name:`GET_PLAYER_FROM_STATE_BAG_NAME`,result:`int`,params:[`char* bagName`]},(e,t)=>{let r=U(t,0);return r.startsWith(`player:`)?e.manager.session?.player(n(r.slice(7)))?.netId??0:0}),S({name:`GET_ENTITY_FROM_STATE_BAG_NAME`,result:`int`,params:[`char* bagName`]},(e,t)=>{let r=U(t,0);if(!r.startsWith(`entity:`))return 0;let i=e.manager.gameState,a=i.byObjectId(n(r.slice(7)));return a===void 0?0:i.handleOf(a)})]}function Qv(e,t,n){e.diagnose(`${t} was asked of the model 0x${(n>>>0).toString(16)}, of which FiveRunner knows nothing: it has no list of the models of GTA V, so it says false. Models are vehicles, peds or objects once scripts created entities of them.`)}function $v(e){if(e===`server`)return[];let t=(e,t,n,r)=>{let i=/* @__PURE__ */ new Set;return S({name:e,hash:t,result:`BOOL`,params:[`Hash model`]},(e,t)=>{let a=e.manager.world.kindOf(t);return a===G.none&&t!==0&&!i.has(t)&&(i.add(t),Qv(e,r,t)),a===n})},n=/* @__PURE__ */ new WeakMap,r=e=>{let t=n.get(e.manager)??/* @__PURE__ */ new Map;return n.set(e.manager,t),t},i=(e,t)=>S({name:e,hash:t,result:`int`,params:[`char* scaleformName`]},(e,t)=>{let n=r(e),i=n.size+1;return n.set(i,t??``),e.manager.world.requestAsset(`scaleform`,t??``),i});return[i(`REQUEST_SCALEFORM_MOVIE`,1296532278728670831n),i(`REQUEST_SCALEFORM_MOVIE_INSTANCE`,14201055364078303238n),S({name:`HAS_SCALEFORM_MOVIE_LOADED`,hash:9651244295395497742n,result:`BOOL`,params:[`int scaleformHandle`]},(e,t)=>{let n=r(e).get(t);return n!==void 0&&e.manager.world.assetLoaded(`scaleform`,n)}),S({name:`HAS_SCALEFORM_MOVIE_FILENAME_LOADED`,hash:872675186769785655n,result:`BOOL`,params:[`char* scaleformName`]},(e,t)=>e.manager.world.assetLoaded(`scaleform`,t??``)),S({name:`SET_SCALEFORM_MOVIE_AS_NO_LONGER_NEEDED`,hash:2095068147598518289n,result:`void`,params:[`int* scaleformHandle`]},(e,t)=>t.set(0)),S({name:`HAS_PTFX_ASSET_LOADED`,hash:14590989371548583963n,result:`BOOL`,params:[]},()=>!0),...[[`REQUEST_AMBIENT_AUDIO_BANK`,18303473030733143449n],[`REQUEST_MISSION_AUDIO_BANK`,8306253829043839218n]].map(([e,t])=>S({name:e,hash:t,result:`BOOL`,params:[`char* bankName`,`BOOL bOverNetwork`]},()=>!0)),S({name:`REGISTER_PEDHEADSHOT`,hash:4927612575077781622n,result:`int`,params:[`Ped ped`]},(e,t)=>e.manager.world.byHandle(t)===void 0?0:1),...[[`IS_PEDHEADSHOT_READY`,8107924672780253799n],[`IS_PEDHEADSHOT_VALID`,11576897081859713442n]].map(([e,t])=>S({name:e,hash:t,result:`BOOL`,params:[`int id`]},(e,t)=>t!==0)),S({name:`GET_PEDHEADSHOT_TXD_STRING`,hash:15802758171925831019n,result:`char*`,params:[`int id`]},()=>`CHAR_DEFAULT`),S({name:`REQUEST_MODEL`,hash:10825852671273492652n,result:`void`,params:[`Hash model`]},(e,t)=>{t!==0&&e.manager.world.request(t)}),S({name:`HAS_MODEL_LOADED`,hash:10999174976919095634n,result:`BOOL`,params:[`Hash model`]},(e,t)=>e.manager.world.loaded(t)),S({name:`IS_MODEL_IN_CDIMAGE`,hash:3871372195910563393n,result:`BOOL`,params:[`Hash model`]},(e,t)=>t!==0),S({name:`IS_MODEL_VALID`,hash:13846715278875188882n,result:`BOOL`,params:[`Hash model`]},(e,t)=>t!==0),t(`IS_MODEL_A_VEHICLE`,1849511532187010366n,G.vehicle,`IsModelAVehicle`),t(`_IS_MODEL_A_PED`,8467160340481104597n,G.ped,`IsModelAPed`),S({name:`GET_DISPLAY_NAME_FROM_VEHICLE_MODEL`,hash:12832350468514893849n,result:`char*`,params:[`Hash modelHash`]},(e,t)=>t===0||e.manager.world.kindOf(t)===G.ped?`CARNOTFOUND`:(t>>>0).toString(16).toUpperCase().padStart(8,`0`)),S({name:`SET_MODEL_AS_NO_LONGER_NEEDED`,hash:16515533089562745515n,result:`void`,params:[`Hash model`]},()=>{}),...ey(`anim`,`char* animDict`,{request:[`REQUEST_ANIM_DICT`,15257422121632202486n],loaded:[`HAS_ANIM_DICT_LOADED`,15001957746457249932n],remove:[`REMOVE_ANIM_DICT`,17756110238032734726n],exists:[`DOES_ANIM_DICT_EXIST`,3288925407143094625n]}),...ey(`animset`,`char* animSet`,{request:[`REQUEST_ANIM_SET`,7972635428772450029n],loaded:[`HAS_ANIM_SET_LOADED`,14189161536823175600n],remove:[`REMOVE_ANIM_SET`,1600190916137591987n]}),...ey(`clipset`,`char* clipSet`,{request:[`REQUEST_CLIP_SET`,15179134168094313033n],loaded:[`HAS_CLIP_SET_LOADED`,3567472081491954419n],remove:[`REMOVE_CLIP_SET`,141645767035637140n]}),...ey(`texture`,`char* textureDict`,{request:[`REQUEST_STREAMED_TEXTURE_DICT`,16114705809917771221n],loaded:[`HAS_STREAMED_TEXTURE_DICT_LOADED`,91750494399812324n],remove:[`SET_STREAMED_TEXTURE_DICT_AS_NO_LONGER_NEEDED`,13703517772758820869n]},[`BOOL p1`]),...ey(`ptfx`,`char* fxName`,{request:[`REQUEST_NAMED_PTFX_ASSET`,13262405284139535030n],loaded:[`HAS_NAMED_PTFX_ASSET_LOADED`,9728410087137920084n],remove:[`REMOVE_NAMED_PTFX_ASSET`,6873033708056672621n]}),...ey(`weapon`,`Hash weaponHash`,{request:[`REQUEST_WEAPON_ASSET`,6071771004139350467n],loaded:[`HAS_WEAPON_ASSET_LOADED`,3955096325251305710n],remove:[`REMOVE_WEAPON_ASSET`,12252305655226026236n]},[`int p1`,`int p2`]),S({name:`REQUEST_IPL`,hash:4734559983020792692n,result:`void`,params:[`char* iplName`]},(e,t)=>{t&&e.manager.world.ipls.add(t.toLowerCase())}),S({name:`REMOVE_IPL`,hash:17180206544770345005n,result:`void`,params:[`char* iplName`]},(e,t)=>{e.manager.world.ipls.delete((t??``).toLowerCase())}),S({name:`IS_IPL_ACTIVE`,hash:9846911559021573269n,result:`BOOL`,params:[`char* iplName`]},(e,t)=>e.manager.world.ipls.has((t??``).toLowerCase()))]}function ey(e,t,n,r=[]){let i=e=>typeof e==`number`?e===0?``:String(e>>>0):e??``,[a,o]=n.request,[s,c]=n.loaded,[l,u]=n.remove;return[S({name:a,hash:o,result:`void`,params:[t,...r]},(t,n)=>{let r=i(n);r!==``&&t.manager.world.requestAsset(e,r)}),S({name:s,hash:c,result:`BOOL`,params:[t]},(t,n)=>t.manager.world.assetLoaded(e,i(n))),S({name:l,hash:u,result:`void`,params:[t]},()=>{}),...n.exists===void 0?[]:[S({name:n.exists[0],hash:n.exists[1],result:`BOOL`,params:[t]},(e,t)=>i(t)!==``)]]}const ty=e=>e===void 0?{}:{hash:e};function $(e,t){let n=X(e,t);return n!==void 0&&K(n.type)===G.vehicle?n.parts:void 0}function ny(e,t,n,r,i){return[S({name:e,...ty(t),result:`float`,params:[`Vehicle vehicle`]},(e,t)=>$(e,t)?.[i]??0),S({name:n,...ty(r),result:`void`,params:[`Vehicle vehicle`,`float value`]},(e,t,n)=>{let r=$(e,t);r!==void 0&&(r[i]=n)})]}function ry(e,t,n,r,i){return[S({name:e,hash:t,result:`int`,params:[`Vehicle vehicle`]},(e,t)=>$(e,t)?.[i]??0),S({name:n,hash:r,result:`void`,params:[`Vehicle vehicle`,`int value`]},(e,t,n)=>{let r=$(e,t);r!==void 0&&(r[i]=n)})]}function iy(e,t,n,r,i){return[S({name:e,...ty(t),result:`BOOL`,params:[`Vehicle vehicle`]},(e,t)=>$(e,t)?.[i]??!1),S({name:n,hash:r,result:`void`,params:[`Vehicle vehicle`,`BOOL toggle`]},(e,t,n)=>{let r=$(e,t);r!==void 0&&(r[i]=n)})]}function ay(e,t,n,r,i,a){return[S({name:e,hash:t,result:`void`,params:[`Vehicle vehicle`,`int* first`,`int* second`]},(e,t,n,r)=>{let o=$(e,t);n.set(o?.[i]??0),r.set(o?.[a]??0)}),S({name:n,hash:r,result:`void`,params:[`Vehicle vehicle`,`int first`,`int second`]},(e,t,n,r)=>{let o=$(e,t);o!==void 0&&(o[i]=n,o[a]=r)})]}function oy(e,t,n,r,i){return[S({name:e,hash:t,result:`void`,params:[`Vehicle vehicle`,`int* color`]},(e,t,n)=>n.set($(e,t)?.[i]??0)),S({name:n,hash:r,result:`void`,params:[`Vehicle vehicle`,`int color`]},(e,t,n)=>{let r=$(e,t);r!==void 0&&(r[i]=n)})]}function sy(e,t,n,r,i){return[S({name:e,hash:t,result:`void`,params:[`Vehicle vehicle`,`int* r`,`int* g`,`int* b`]},(e,t,n,r,a)=>{let[o,s,c]=$(e,t)?.[i]??[0,0,0];n.set(o),r.set(s),a.set(c)}),S({name:n,hash:r,result:`void`,params:[`Vehicle vehicle`,`int r`,`int g`,`int b`]},(e,t,n,r,a)=>{let o=$(e,t);o!==void 0&&(o[i]=[n,r,a])})]}const cy=(e,t,n)=>S({name:e,hash:t,result:`int`,params:[`Vehicle vehicle`]},(e,t)=>$(e,t)===void 0?0:n);function ly(e){if(e===`server`)return[];let t=/* @__PURE__ */ new WeakSet,n=e=>{t.has(e.manager)||(t.add(e.manager),e.diagnose(`SetVehicleMod does nothing on a vehicle without a mod kit, as in GTA V: call SetVehicleModKit(vehicle, 0) first.`))};return[...ny(`GET_VEHICLE_ENGINE_HEALTH`,14149504890089024184n,`SET_VEHICLE_ENGINE_HEALTH`,5041455353683427057n,`engineHealth`),...ny(`GET_VEHICLE_BODY_HEALTH`,17469766964027330322n,`SET_VEHICLE_BODY_HEALTH`,13221730319678876379n,`bodyHealth`),...ny(`GET_VEHICLE_PETROL_TANK_HEALTH`,9033565442791362676n,`SET_VEHICLE_PETROL_TANK_HEALTH`,8132189641834549464n,`petrolTankHealth`),...ny(`GET_VEHICLE_DIRT_LEVEL`,10310917179768153643n,`SET_VEHICLE_DIRT_LEVEL`,8778559758790880907n,`dirtLevel`),...ny(`GET_VEHICLE_FUEL_LEVEL`,void 0,`SET_VEHICLE_FUEL_LEVEL`,void 0,`fuelLevel`),...ny(`GET_VEHICLE_OIL_LEVEL`,void 0,`SET_VEHICLE_OIL_LEVEL`,void 0,`oilLevel`),...ny(`GET_VEHICLE_WHEEL_SIZE`,void 0,`SET_VEHICLE_WHEEL_SIZE`,void 0,`wheelSize`),...ny(`GET_VEHICLE_WHEEL_WIDTH`,void 0,`SET_VEHICLE_WHEEL_WIDTH`,void 0,`wheelWidth`),S({name:`GET_VEHICLE_WHEEL_HEALTH`,result:`float`,params:[`Vehicle vehicle`,`int wheelIndex`]},(e,t,n)=>{let r=$(e,t);return r===void 0?0:r.wheelHealth.get(n)??1e3}),S({name:`SET_VEHICLE_WHEEL_HEALTH`,result:`void`,params:[`Vehicle vehicle`,`int wheelIndex`,`float health`]},(e,t,n,r)=>$(e,t)?.wheelHealth.set(n,r)),S({name:`SET_VEHICLE_FIXED`,hash:1249505568339610652n,result:`void`,params:[`Vehicle vehicle`]},(e,t)=>$(e,t)?.fix()),S({name:`SET_VEHICLE_ENGINE_ON`,hash:2636792098548582430n,result:`void`,params:[`Vehicle vehicle`,`BOOL value`,`BOOL instantly`,`BOOL disableAutoStart`]},(e,t,n,r,i)=>{let a=$(e,t);a!==void 0&&(a.engineOn=n,a.autoStart=!i)}),S({name:`GET_IS_VEHICLE_ENGINE_RUNNING`,hash:12552068584028443438n,result:`BOOL`,params:[`Vehicle vehicle`]},(e,t)=>$(e,t)?.engineOn??!1),...iy(`IS_VEHICLE_SIREN_ON`,5520275388034856114n,`SET_VEHICLE_SIREN`,17623225488012915581n,`siren`),...iy(`IS_VEHICLE_ALARM_ACTIVATED`,4835145494804037428n,`SET_VEHICLE_ALARM`,14836518586668520780n,`alarm`),...iy(`GET_VEHICLE_HANDBRAKE`,void 0,`SET_VEHICLE_HANDBRAKE`,7514121110102895138n,`handbrake`),...iy(`GET_VEHICLE_TYRES_CAN_BURST`,7461228425533296619n,`SET_VEHICLE_TYRES_CAN_BURST`,16977941433352285254n,`tyresCanBurst`),S({name:`SET_VEHICLE_UNDRIVEABLE`,hash:9996419924669770645n,result:`void`,params:[`Vehicle vehicle`,`BOOL toggle`]},(e,t,n)=>{let r=$(e,t);r!==void 0&&(r.undriveable=n)}),S({name:`IS_VEHICLE_DRIVEABLE`,hash:5486543479196481881n,result:`BOOL`,params:[`Vehicle vehicle`,`BOOL isOnFireCheck`]},(e,t)=>{let n=$(e,t);return n!==void 0&&!n.undriveable&&n.engineHealth>0}),S({name:`SET_VEHICLE_LIGHTS`,hash:3812034297014287450n,result:`void`,params:[`Vehicle vehicle`,`int state`]},(e,t,n)=>{let r=$(e,t);r!==void 0&&(r.lights=n)}),S({name:`GET_VEHICLE_LIGHTS_STATE`,hash:13338338421850755375n,result:`BOOL`,params:[`Vehicle vehicle`,`BOOL* lightsOn`,`BOOL* highbeamsOn`]},(e,t,n,r)=>{let i=$(e,t);return n.set(i?.lights===2),r.set(!1),i!==void 0}),...ay(`GET_VEHICLE_COLOURS`,11642990248343929260n,`SET_VEHICLE_COLOURS`,5700796144468248065n,`primaryColour`,`secondaryColour`),...ay(`GET_VEHICLE_EXTRA_COLOURS`,4306607109209941751n,`SET_VEHICLE_EXTRA_COLOURS`,2321312457832869427n,`pearlescentColour`,`wheelColour`),...oy(`_GET_VEHICLE_INTERIOR_COLOR`,9012939617897488694n,`_SET_VEHICLE_INTERIOR_COLOR`,17585947422526242585n,`interiorColour`),...oy(`_GET_VEHICLE_DASHBOARD_COLOR`,13214509638265019391n,`_SET_VEHICLE_DASHBOARD_COLOR`,6956317558672667244n,`dashboardColour`),...sy(`GET_VEHICLE_CUSTOM_PRIMARY_COLOUR`,13136141173969739602n,`SET_VEHICLE_CUSTOM_PRIMARY_COLOUR`,8160934221331913706n,`customPrimary`),...sy(`GET_VEHICLE_CUSTOM_SECONDARY_COLOUR`,9478332663426216668n,`SET_VEHICLE_CUSTOM_SECONDARY_COLOUR`,3949330575929153364n,`customSecondary`),...sy(`GET_VEHICLE_TYRE_SMOKE_COLOR`,13129463142448411587n,`SET_VEHICLE_TYRE_SMOKE_COLOR`,13094920670137621519n,`tyreSmoke`),...sy(`_GET_VEHICLE_NEON_LIGHTS_COLOUR`,8510095654457341311n,`_SET_VEHICLE_NEON_LIGHTS_COLOUR`,10235090006366889621n,`neonColour`),...[[`GET_IS_VEHICLE_PRIMARY_COLOUR_CUSTOM`,17335973723136045595n,`customPrimary`],[`GET_IS_VEHICLE_SECONDARY_COLOUR_CUSTOM`,10451221855851406700n,`customSecondary`]].map(([e,t,n])=>S({name:e,hash:t,result:`BOOL`,params:[`Vehicle vehicle`]},(e,t)=>$(e,t)?.[n]!==void 0)),...[[`CLEAR_VEHICLE_CUSTOM_PRIMARY_COLOUR`,6188458765339386935n,`customPrimary`],[`CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR`,6916366759000678409n,`customSecondary`]].map(([e,t,n])=>S({name:e,hash:t,result:`void`,params:[`Vehicle vehicle`]},(e,t)=>{let r=$(e,t);r!==void 0&&(r[n]=void 0)})),S({name:`_IS_VEHICLE_NEON_LIGHT_ENABLED`,hash:10109334683377952421n,result:`BOOL`,params:[`Vehicle vehicle`,`int index`]},(e,t,n)=>$(e,t)?.neonLights.has(n)??!1),S({name:`_SET_VEHICLE_NEON_LIGHT_ENABLED`,hash:3073461435007496809n,result:`void`,params:[`Vehicle vehicle`,`int index`,`BOOL toggle`]},(e,t,n,r)=>{let i=$(e,t)?.neonLights;r?i?.add(n):i?.delete(n)}),...ry(`_GET_VEHICLE_XENON_LIGHTS_COLOR`,4467343895069330651n,`_SET_VEHICLE_XENON_LIGHTS_COLOR`,16433691881432431111n,`xenonColour`),S({name:`GET_VEHICLE_XENON_LIGHTS_CUSTOM_COLOR`,result:`BOOL`,params:[`Vehicle vehicle`,`int* red`,`int* green`,`int* blue`]},(e,t,n,r,i)=>{let a=$(e,t)?.customXenon,[o,s,c]=a??[0,0,0];return n.set(o),r.set(s),i.set(c),a!==void 0}),S({name:`SET_VEHICLE_XENON_LIGHTS_CUSTOM_COLOR`,result:`void`,params:[`Vehicle vehicle`,`int red`,`int green`,`int blue`]},(e,t,n,r,i)=>{let a=$(e,t);a!==void 0&&(a.customXenon=[n,r,i])}),S({name:`CLEAR_VEHICLE_XENON_LIGHTS_CUSTOM_COLOR`,result:`void`,params:[`Vehicle vehicle`]},(e,t)=>{let n=$(e,t);n!==void 0&&(n.customXenon=void 0)}),...ry(`GET_VEHICLE_MOD_KIT`,7144346870170407181n,`SET_VEHICLE_MOD_KIT`,2245783831530643834n,`modKit`),S({name:`SET_VEHICLE_MOD`,hash:7705768285972510429n,result:`void`,params:[`Vehicle vehicle`,`int modType`,`int modIndex`,`BOOL customTires`]},(e,t,r,i,a)=>{let o=$(e,t);o!==void 0&&(o.modKit===65535?n(e):o.mods.set(r,{index:i,variation:a}))}),S({name:`GET_VEHICLE_MOD`,hash:8586499896144719835n,result:`int`,params:[`Vehicle vehicle`,`int modType`]},(e,t,n)=>$(e,t)?.mods.get(n)?.index??-1),S({name:`GET_VEHICLE_MOD_VARIATION`,hash:12939491323657885148n,result:`BOOL`,params:[`Vehicle vehicle`,`int modType`]},(e,t,n)=>$(e,t)?.mods.get(n)?.variation??!1),S({name:`REMOVE_VEHICLE_MOD`,hash:10580672842142417412n,result:`void`,params:[`Vehicle vehicle`,`int modType`]},(e,t,n)=>$(e,t)?.mods.delete(n)),S({name:`GET_NUM_VEHICLE_MODS`,hash:16397203146118530630n,result:`int`,params:[`Vehicle vehicle`,`int modType`]},(e,t)=>$(e,t)===void 0?0:10),S({name:`TOGGLE_VEHICLE_MOD`,hash:3035231775696334088n,result:`void`,params:[`Vehicle vehicle`,`int modType`,`BOOL toggle`]},(e,t,n,r)=>{let i=$(e,t)?.toggledMods;r?i?.add(n):i?.delete(n)}),S({name:`IS_TOGGLE_MOD_ON`,hash:9561761758880500455n,result:`BOOL`,params:[`Vehicle vehicle`,`int modType`]},(e,t,n)=>$(e,t)?.toggledMods.has(n)??!1),...ry(`GET_VEHICLE_LIVERY`,3150587921134411402n,`SET_VEHICLE_LIVERY`,6971396915951620534n,`livery`),...ry(`_GET_VEHICLE_ROOF_LIVERY`,6924566214525471270n,`_SET_VEHICLE_ROOF_LIVERY`,12021137051077784176n,`roofLivery`),...[[`GET_VEHICLE_LIVERY_COUNT`,9779071972287304998n],[`_GET_VEHICLE_ROOF_LIVERY_COUNT`,6830623794211832020n]].map(([e,t])=>S({name:e,hash:t,result:`int`,params:[`Vehicle vehicle`]},()=>-1)),...ry(`GET_VEHICLE_WINDOW_TINT`,1072440087508450453n,`SET_VEHICLE_WINDOW_TINT`,6324494699532199574n,`windowTint`),S({name:`GET_NUM_VEHICLE_WINDOW_TINTS`,hash:11318148397216196359n,result:`int`,params:[]},()=>7),...ry(`GET_VEHICLE_WHEEL_TYPE`,12965049668393645788n,`SET_VEHICLE_WHEEL_TYPE`,5223808454466558881n,`wheelType`),S({name:`DOES_EXTRA_EXIST`,hash:1324855812493050196n,result:`BOOL`,params:[`Vehicle vehicle`,`int extraId`]},(e,t,n)=>$(e,t)?.extras.has(n)??!1),S({name:`IS_VEHICLE_EXTRA_TURNED_ON`,hash:15196977125611980989n,result:`BOOL`,params:[`Vehicle vehicle`,`int extraId`]},(e,t,n)=>$(e,t)?.extras.get(n)??!1),S({name:`SET_VEHICLE_EXTRA`,hash:9143331738832080073n,result:`void`,params:[`Vehicle vehicle`,`int extraId`,`BOOL disable`]},(e,t,n,r)=>$(e,t)?.extras.set(n,!r)),...ry(`GET_VEHICLE_DOOR_LOCK_STATUS`,2719216112082266466n,`SET_VEHICLE_DOORS_LOCKED`,13142674893052018598n,`doorLock`),cy(`_GET_NUMBER_OF_VEHICLE_DOORS`,10561550669898559821n,6),S({name:`SET_VEHICLE_DOOR_OPEN`,hash:8963811182594345058n,result:`void`,params:[`Vehicle vehicle`,`int doorIndex`,`BOOL loose`,`BOOL openInstantly`]},(e,t,n)=>$(e,t)?.openDoors.add(n)),S({name:`SET_VEHICLE_DOOR_SHUT`,hash:10653754407603636709n,result:`void`,params:[`Vehicle vehicle`,`int doorIndex`,`BOOL closeInstantly`]},(e,t,n)=>$(e,t)?.openDoors.delete(n)),S({name:`SET_VEHICLE_DOORS_SHUT`,hash:8654578603176050421n,result:`void`,params:[`Vehicle vehicle`,`BOOL closeInstantly`]},(e,t)=>$(e,t)?.openDoors.clear()),S({name:`GET_VEHICLE_DOOR_ANGLE_RATIO`,hash:18320533513229773781n,result:`float`,params:[`Vehicle vehicle`,`int doorIndex`]},(e,t,n)=>+!!$(e,t)?.openDoors.has(n)),S({name:`IS_VEHICLE_DOOR_FULLY_OPEN`,hash:4509014719907044386n,result:`BOOL`,params:[`Vehicle vehicle`,`int doorIndex`]},(e,t,n)=>$(e,t)?.openDoors.has(n)??!1),S({name:`SET_VEHICLE_DOOR_BROKEN`,hash:15336153818213079603n,result:`void`,params:[`Vehicle vehicle`,`int doorIndex`,`BOOL deleteDoor`]},(e,t,n)=>{let r=$(e,t);r?.brokenDoors.add(n),r?.openDoors.delete(n)}),S({name:`IS_VEHICLE_DOOR_DAMAGED`,hash:13322071994783909159n,result:`BOOL`,params:[`Vehicle veh`,`int doorID`]},(e,t,n)=>$(e,t)?.brokenDoors.has(n)??!1),S({name:`_GET_IS_DOOR_VALID`,hash:7232582464623474226n,result:`BOOL`,params:[`Vehicle vehicle`,`int doorIndex`]},(e,t,n)=>{let r=$(e,t);return r!==void 0&&n>=0&&n<6&&!r.brokenDoors.has(n)}),S({name:`SMASH_VEHICLE_WINDOW`,hash:11410817766430417497n,result:`void`,params:[`Vehicle vehicle`,`int windowIndex`]},(e,t,n)=>$(e,t)?.smashedWindows.add(n)),S({name:`REMOVE_VEHICLE_WINDOW`,hash:12038498450811400297n,result:`void`,params:[`Vehicle vehicle`,`int windowIndex`]},(e,t,n)=>$(e,t)?.smashedWindows.add(n)),S({name:`FIX_VEHICLE_WINDOW`,hash:8584567789502981762n,result:`void`,params:[`Vehicle vehicle`,`int windowIndex`]},(e,t,n)=>$(e,t)?.smashedWindows.delete(n)),S({name:`IS_VEHICLE_WINDOW_INTACT`,hash:5108614288122905073n,result:`BOOL`,params:[`Vehicle vehicle`,`int windowIndex`]},(e,t,n)=>{let r=$(e,t);return r!==void 0&&!r.smashedWindows.has(n)&&!r.rolledDownWindows.has(n)}),S({name:`ROLL_DOWN_WINDOW`,hash:8852360316713789923n,result:`void`,params:[`Vehicle vehicle`,`int windowIndex`]},(e,t,n)=>$(e,t)?.rolledDownWindows.add(n)),S({name:`ROLL_UP_WINDOW`,hash:6930569850916064601n,result:`void`,params:[`Vehicle vehicle`,`int windowIndex`]},(e,t,n)=>$(e,t)?.rolledDownWindows.delete(n)),S({name:`SET_VEHICLE_TYRE_BURST`,hash:17035463926257943429n,result:`void`,params:[`Vehicle vehicle`,`int index`,`BOOL onRim`,`float p3`]},(e,t,n,r)=>{let i=$(e,t);i?.tyresCanBurst&&i.burstTyres.set(n,r)}),S({name:`SET_VEHICLE_TYRE_FIXED`,hash:7931960884476783901n,result:`void`,params:[`Vehicle vehicle`,`int tyreIndex`]},(e,t,n)=>$(e,t)?.burstTyres.delete(n)),S({name:`IS_VEHICLE_TYRE_BURST`,hash:13414279665309277353n,result:`BOOL`,params:[`Vehicle vehicle`,`int wheelID`,`BOOL isBurstToRim`]},(e,t,n,r)=>{let i=$(e,t)?.burstTyres.get(n);return i!==void 0&&(!r||i)}),...[[`GET_VEHICLE_HANDLING_FLOAT`,`float`],[`GET_VEHICLE_HANDLING_INT`,`int`]].map(([e,t])=>S({name:e,result:t,params:[`Vehicle vehicle`,`char* class_`,`char* fieldName`]},(e,t,n,r)=>$(e,t)?.handling.get(r??``)??0)),S({name:`SET_VEHICLE_HANDLING_FLOAT`,result:`void`,params:[`Vehicle vehicle`,`char* class_`,`char* fieldName`,`float value`]},(e,t,n,r,i)=>$(e,t)?.handling.set(r??``,i)),S({name:`SET_VEHICLE_HANDLING_INT`,result:`void`,params:[`Vehicle vehicle`,`char* class_`,`char* fieldName`,`int value`]},(e,t,n,r,i)=>$(e,t)?.handling.set(r??``,i)),S({name:`SET_VEHICLE_ON_GROUND_PROPERLY`,hash:5292642784517372369n,result:`BOOL`,params:[`Vehicle vehicle`]},(e,t)=>$(e,t)!==void 0),S({name:`IS_VEHICLE_ON_ALL_WHEELS`,hash:12755545563352728290n,result:`BOOL`,params:[`Vehicle vehicle`]},(e,t)=>$(e,t)!==void 0),cy(`GET_VEHICLE_MAX_NUMBER_OF_PASSENGERS`,12089054235866735952n,3),S({name:`GET_VEHICLE_MODEL_NUMBER_OF_SEATS`,hash:3087559591220014500n,result:`int`,params:[`Hash modelHash`]},()=>4),S({name:`GET_VEHICLE_NUMBER_OF_PASSENGERS`,hash:2651249327676063369n,result:`int`,params:[`Vehicle vehicle`]},(e,t)=>{let n=X(e,t);return n===void 0?0:[...n.occupants.keys()].filter(e=>e>=0).length}),S({name:`IS_VEHICLE_MODEL`,hash:4773408663263202697n,result:`BOOL`,params:[`Vehicle vehicle`,`Hash model`]},(e,t,n)=>X(e,t)?.model===n),S({name:`IS_THIS_MODEL_A_CAR`,hash:9182194428474387960n,result:`BOOL`,params:[`Hash model`]},(e,t)=>e.manager.world.kindOf(t)===G.vehicle)]}function uy(e,t,n){let r=X(e,t);return r!==void 0&&K(r.type)===n?r:void 0}function dy(e){return e?.handle??0}function fy(e,t,n){let r=Y(e,t);return r!==void 0&&K(r.type)===n?r:void 0}function py(e,t){let n=w_(e),r=t===0?void 0:n.byObjectId(t);return r===void 0?0:n.handleOf(r)}function my(e){return e===`server`?gy():hy()}function hy(){let e=(e,t)=>uy(e,t,G.ped),t=(e,t)=>uy(e,t,G.vehicle),n=(n,r)=>S({name:n,hash:r,result:`void`,params:[`Ped ped`,`Vehicle vehicle`,`int seatIndex`]},(n,r,i,a)=>{let o=e(n,r),s=t(n,i);if(o===void 0||s===void 0||a<-2)return;let c=a===-2?0:a;for(;a===-2&&s.occupants.has(c);)c++;o.enterVehicle(s,c)}),r=(t,n,r)=>{let i=e(t,n)?.vehicle;return i!==void 0&&(r===void 0||i.handle===r)};return[n(`SET_PED_INTO_VEHICLE`,17823854667459462717n),n(`TASK_WARP_PED_INTO_VEHICLE`,11132063835731916420n),S({name:`TASK_ENTER_VEHICLE`,hash:13983202585294707880n,result:`void`,params:[`Ped ped`,`Vehicle vehicle`,`int timeout`,`int seatIndex`,`float speed`,`int flag`,`int p6`]},(n,r,i,a,o)=>{let s=e(n,r),c=t(n,i);if(s===void 0||c===void 0||o<-2)return;let l=o===-2?0:o;for(;o===-2&&c.occupants.has(l);)l++;s.enterVehicle(c,l)}),S({name:`TASK_EVERYONE_LEAVE_VEHICLE`,hash:9192806827815412338n,result:`void`,params:[`Vehicle vehicle`]},(e,n)=>{let r=t(e,n);for(let e of[...r?.occupants.values()??[]])e.leaveVehicle()}),S({name:`TASK_LEAVE_VEHICLE`,hash:15266022280670526978n,result:`void`,params:[`Ped ped`,`Vehicle vehicle`,`int flags`]},(t,n,r)=>{let i=e(t,n);i?.vehicle!==void 0&&i.vehicle.handle===r&&i.leaveVehicle()}),S({name:`TASK_LEAVE_ANY_VEHICLE`,hash:5786374414059643463n,result:`void`,params:[`Ped ped`,`int delayTime`,`int flags`]},(t,n)=>e(t,n)?.leaveVehicle()),S({name:`SET_PED_COORDS_KEEP_VEHICLE`,hash:11168644811073104686n,result:`void`,params:[`Ped ped`,`float posX`,`float posY`,`float posZ`]},(t,n,r,i,a)=>{let o=e(t,n);(o?.vehicle??o)?.moveTo(r,i,a)}),S({name:`GET_VEHICLE_PED_IS_IN`,hash:11137703836139538195n,result:`Vehicle`,params:[`Ped ped`,`BOOL includeLastVehicle`]},(t,n,r)=>{let i=e(t,n);return dy(r?i?.lastVehicle:i?.vehicle)}),S({name:`GET_VEHICLE_PED_IS_USING`,hash:6959377544440096893n,result:`Vehicle`,params:[`Ped ped`]},(t,n)=>dy(e(t,n)?.vehicle)),S({name:`IS_PED_ON_FOOT`,hash:143805665679202738n,result:`BOOL`,params:[`Ped ped`]},(t,n)=>{let r=e(t,n);return r!==void 0&&r.vehicle===void 0}),S({name:`GET_VEHICLE_PED_IS_TRYING_TO_ENTER`,hash:9317851689464185949n,result:`Vehicle`,params:[`Ped ped`]},()=>0),S({name:`GET_VEHICLE_PED_IS_ENTERING`,hash:17953197144696923644n,result:`Vehicle`,params:[`Ped ped`]},()=>0),S({name:`IS_PED_GETTING_INTO_A_VEHICLE`,hash:13476506400098240398n,result:`BOOL`,params:[`Ped ped`]},()=>!1),S({name:`GET_PLAYERS_LAST_VEHICLE`,hash:13157682470943312064n,result:`Vehicle`,params:[]},e=>dy(e.manager.world.playerPed.lastVehicle)),S({name:`IS_PED_IN_ANY_VEHICLE`,hash:11059360085529971211n,result:`BOOL`,params:[`Ped ped`,`BOOL atGetIn`]},(e,t)=>r(e,t)),S({name:`IS_PED_IN_VEHICLE`,hash:11812460267229133275n,result:`BOOL`,params:[`Ped ped`,`Vehicle vehicle`,`BOOL atGetIn`]},(e,t,n)=>r(e,t,n)),S({name:`IS_PED_SITTING_IN_ANY_VEHICLE`,hash:9397505571394551544n,result:`BOOL`,params:[`Ped ped`]},(e,t)=>r(e,t)),...[[`IS_PED_IN_ANY_HELI`,2993646556015384325n],[`IS_PED_IN_ANY_PLANE`,6917332199840217984n]].map(([e,t])=>S({name:e,hash:t,result:`BOOL`,params:[`Ped ped`]},()=>!1)),S({name:`IS_PED_SITTING_IN_VEHICLE`,hash:12108114641748692930n,result:`BOOL`,params:[`Ped ped`,`Vehicle vehicle`]},(e,t,n)=>r(e,t,n)),S({name:`GET_PED_IN_VEHICLE_SEAT`,hash:13493027623591629670n,result:`Ped`,params:[`Vehicle vehicle`,`int seatIndex`,`BOOL p2`]},(e,n,r)=>dy(t(e,n)?.occupants.get(r))),S({name:`GET_LAST_PED_IN_VEHICLE_SEAT`,hash:9509748267553039972n,result:`Ped`,params:[`Vehicle vehicle`,`int seatIndex`]},(e,n,r)=>dy(t(e,n)?.lastOccupants.get(r))),S({name:`IS_VEHICLE_SEAT_FREE`,hash:2498470473267324521n,result:`BOOL`,params:[`Vehicle vehicle`,`int seatIndex`,`BOOL isTaskRunning`]},(e,n,r)=>{let i=t(e,n);return i!==void 0&&!i.occupants.has(r)}),S({name:`SET_VEHICLE_NUMBER_PLATE_TEXT`,hash:10784026586230086215n,result:`void`,params:[`Vehicle vehicle`,`char* plateText`]},(e,n,r)=>{let i=t(e,n);i!==void 0&&(i.plate=(r??``).slice(0,8))}),S({name:`GET_VEHICLE_NUMBER_PLATE_TEXT`,hash:8998698628399956494n,result:`char*`,params:[`Vehicle vehicle`]},(e,n)=>t(e,n)?.plate??null),S({name:`SET_VEHICLE_NUMBER_PLATE_TEXT_INDEX`,hash:10414832911214686369n,result:`void`,params:[`Vehicle vehicle`,`int plateIndex`]},(e,n,r)=>{let i=t(e,n);i!==void 0&&(i.plateIndex=r)}),S({name:`GET_VEHICLE_NUMBER_PLATE_TEXT_INDEX`,hash:17373694244543164821n,result:`int`,params:[`Vehicle vehicle`]},(e,n)=>t(e,n)?.plateIndex??0)]}function gy(){let e=(e,t)=>fy(e,t,G.ped),t=(e,t)=>fy(e,t,G.vehicle),n=(e,n)=>S({name:e,result:`Entity`,params:[`Vehicle vehicle`,`int seatIndex`]},(e,r,i)=>{let a=t(e,r),o=i+2;return a===void 0||o<0||o>=32?0:py(e,n(a)[o])});return[S({name:`GET_VEHICLE_PED_IS_IN`,result:`Entity`,params:[`Ped ped`,`BOOL lastVehicle`]},(t,n,r)=>{let i=e(t,n);if(i===void 0)return 0;let a=r?i.lastVehiclePedWasIn:i.state.vehicle??0;return a===-1?0:py(t,a)}),n(`GET_PED_IN_VEHICLE_SEAT`,e=>e.occupants),n(`GET_LAST_PED_IN_VEHICLE_SEAT`,e=>e.lastOccupants),S({name:`GET_SEAT_PED_IS_USING`,result:`int`,params:[`Ped ped`]},(t,n)=>{let r=e(t,n);return r===void 0?-3:(r.state.vehicleSeat??0)-2}),S({name:`IS_PED_IN_ANY_VEHICLE`,result:`BOOL`,params:[`Ped ped`]},(t,n)=>{let r=e(t,n);return r!==void 0&&(r.state.vehicleSeat??0)!==-1}),S({name:`IS_PED_IN_VEHICLE`,result:`BOOL`,params:[`Ped ped`,`Vehicle vehicle`]},(t,n,r)=>{let i=e(t,n);if(r===0||i===void 0)return!1;let{vehicle:a=0,vehicleSeat:o=0}=i.state;if(a===-1||a===0||o===-1)return!1;let s=w_(t).byHandle(r);return s!==void 0&&s.objectId===a}),S({name:`GET_VEHICLE_NUMBER_PLATE_TEXT`,result:`char*`,params:[`Vehicle vehicle`]},(e,n)=>t(e,n)?.state.plate??``),S({name:`GET_VEHICLE_NUMBER_PLATE_TEXT_INDEX`,result:`int`,params:[`Vehicle vehicle`]},(e,n)=>t(e,n)?.state.plateIndex??0)]}function _y(e){return e===`server`?[]:[S({name:`MUMBLE_IS_CONNECTED`,result:`BOOL`,params:[]},()=>!1),S({name:`MUMBLE_IS_PLAYER_TALKING`,result:`BOOL`,params:[`Player player`]},()=>!1),S({name:`NETWORK_IS_PLAYER_TALKING`,hash:224636770351277182n,result:`BOOL`,params:[`Player player`]},()=>!1),S({name:`MUMBLE_GET_TALKER_PROXIMITY`,result:`float`,params:[]},()=>0),S({name:`MUMBLE_GET_VOICE_CHANNEL_FROM_SERVER_ID`,result:`int`,params:[`int serverId`]},()=>0),Z(`MUMBLE_SET_TALKER_PROXIMITY`,void 0,[`float value`]),Z(`MUMBLE_SET_SERVER_ADDRESS`,void 0,[`char* address`,`int port`]),Z(`MUMBLE_SET_AUDIO_INPUT_INTENT`,void 0,[`Hash intentHash`]),Z(`MUMBLE_SET_VOICE_CHANNEL`,void 0,[`int channel`]),Z(`MUMBLE_SET_VOICE_TARGET`,void 0,[`int targetId`]),Z(`MUMBLE_CLEAR_VOICE_TARGET`,void 0,[`int targetId`]),Z(`MUMBLE_CLEAR_VOICE_TARGET_CHANNELS`,void 0,[`int targetId`]),Z(`MUMBLE_CLEAR_VOICE_TARGET_PLAYERS`,void 0,[`int targetId`]),Z(`MUMBLE_ADD_VOICE_TARGET_CHANNEL`,void 0,[`int targetId`,`int channel`]),Z(`MUMBLE_ADD_VOICE_TARGET_PLAYER_BY_SERVER_ID`,void 0,[`int targetId`,`int serverId`]),Z(`MUMBLE_ADD_VOICE_CHANNEL_LISTEN`,void 0,[`int channel`]),Z(`MUMBLE_REMOVE_VOICE_CHANNEL_LISTEN`,void 0,[`int channel`]),Z(`MUMBLE_SET_VOLUME_OVERRIDE_BY_SERVER_ID`,void 0,[`int serverId`,`float volume`]),Z(`MUMBLE_SET_SUBMIX_FOR_SERVER_ID`,void 0,[`int serverId`,`int submixId`])]}function vy(e,t){let n=X(e,t);return n!==void 0&&K(n.type)===G.ped?n:void 0}function yy(e,t,n){return vy(e,t)?.weapons.get(n)}function by(e){return e===`server`?Sy():xy()}function xy(){return[S({name:`IS_PED_ARMED`,hash:5140692576702410007n,result:`BOOL`,params:[`Ped ped`,`int typeFlags`]},(e,t)=>{let n=vy(e,t)?.weapon;return n!==void 0&&n!==vg}),S({name:`GIVE_WEAPON_TO_PED`,hash:13767458866752540619n,result:`void`,params:[`Ped ped`,`Hash weaponHash`,`int ammoCount`,`BOOL isHidden`,`BOOL bForceInHand`]},(e,t,n,r,i,a)=>{let o=vy(e,t);if(o===void 0||n===0||n===vg)return;let s=o.weapons.get(n);s===void 0?o.weapons.set(n,{ammo:r,components:/* @__PURE__ */ new Set,tint:0}):s.ammo+=r,a&&(o.weapon=n)}),S({name:`REMOVE_WEAPON_FROM_PED`,hash:5231435679784720824n,result:`void`,params:[`Ped ped`,`Hash weaponHash`]},(e,t,n)=>{let r=vy(e,t);r?.weapons.delete(n)&&r.weapon===n&&(r.weapon=vg)}),S({name:`REMOVE_ALL_PED_WEAPONS`,hash:17464388802800305651n,result:`void`,params:[`Ped ped`,`BOOL p1`]},(e,t)=>{let n=vy(e,t);n?.weapons.clear(),n!==void 0&&(n.weapon=vg)}),S({name:`SET_CURRENT_PED_WEAPON`,hash:12535367907453402124n,result:`void`,params:[`Ped ped`,`Hash weaponHash`,`BOOL bForceInHand`]},(e,t,n)=>{let r=vy(e,t);r!==void 0&&(n===vg||r.weapons.has(n))&&(r.weapon=n)}),S({name:`GET_SELECTED_PED_WEAPON`,hash:751455270629331523n,result:`Hash`,params:[`Ped ped`]},(e,t)=>vy(e,t)?.weapon??0),S({name:`GET_CURRENT_PED_WEAPON`,hash:4217590589943717204n,result:`BOOL`,params:[`Ped ped`,`Hash* weaponHash`,`BOOL doDeadCheck`]},(e,t,n)=>{let r=vy(e,t)?.weapon??0;return n.set(r),r!==0&&r!==vg}),S({name:`HAS_PED_GOT_WEAPON`,hash:10226742572059207868n,result:`BOOL`,params:[`Ped ped`,`Hash weaponHash`,`BOOL p2`]},(e,t,n)=>yy(e,t,n)!==void 0),S({name:`GET_AMMO_IN_PED_WEAPON`,hash:97480644549409105n,result:`int`,params:[`Ped ped`,`Hash weaponhash`]},(e,t,n)=>yy(e,t,n)?.ammo??0),S({name:`SET_PED_AMMO`,hash:1505728147329083929n,result:`void`,params:[`Ped ped`,`Hash weaponHash`,`int ammo`]},(e,t,n,r)=>{let i=yy(e,t,n);i!==void 0&&(i.ammo=r)}),S({name:`ADD_AMMO_TO_PED`,hash:8714538174022443552n,result:`void`,params:[`Ped ped`,`Hash weaponHash`,`int ammo`]},(e,t,n,r)=>{let i=yy(e,t,n);i!==void 0&&(i.ammo+=r)}),S({name:`GIVE_WEAPON_COMPONENT_TO_PED`,hash:15665442664280656825n,result:`void`,params:[`Ped ped`,`Hash weaponHash`,`Hash componentHash`]},(e,t,n,r)=>yy(e,t,n)?.components.add(r)),S({name:`REMOVE_WEAPON_COMPONENT_FROM_PED`,hash:2201109082612124681n,result:`void`,params:[`Ped ped`,`Hash weaponHash`,`Hash componentHash`]},(e,t,n,r)=>yy(e,t,n)?.components.delete(r)),S({name:`HAS_PED_GOT_WEAPON_COMPONENT`,hash:14236759287530185536n,result:`BOOL`,params:[`Ped ped`,`Hash weaponHash`,`Hash componentHash`]},(e,t,n,r)=>yy(e,t,n)?.components.has(r)??!1),S({name:`SET_PED_WEAPON_TINT_INDEX`,hash:5806999861877102392n,result:`void`,params:[`Ped ped`,`Hash weaponHash`,`int tintIndex`]},(e,t,n,r)=>{let i=yy(e,t,n);i!==void 0&&(i.tint=r)}),S({name:`GET_PED_WEAPON_TINT_INDEX`,hash:3143211000917945247n,result:`int`,params:[`Ped ped`,`Hash weaponHash`]},(e,t,n)=>yy(e,t,n)?.tint??-1),...[[`SET_PED_INFINITE_AMMO`,4529689184233022011n,[`Ped ped`,`BOOL toggle`]],[`SET_PED_INFINITE_AMMO_CLIP`,1746743299266654598n,[`Ped ped`,`BOOL toggle`]],[`SET_PED_CURRENT_WEAPON_VISIBLE`,514998932744280688n,[`Ped ped`,`BOOL visible`]],[`_0xF92099527DB8E2A7`,17951516694274433703n,[`int rewardType`,`BOOL suppress`]]].map(([e,t,n])=>S({name:e,hash:t,result:`void`,params:n},()=>{})),S({name:`IS_PED_SHOOTING`,hash:3774412487161016737n,result:`BOOL`,params:[`Ped ped`]},()=>!1)]}function Sy(){let e=(e,t)=>{let n=Y(e,t);return n!==void 0&&K(n.type)===G.ped?n.state.weapon??0:0};return[S({name:`GET_SELECTED_PED_WEAPON`,result:`Hash`,params:[`Ped ped`]},(t,n)=>e(t,n)),S({name:`GET_CURRENT_PED_WEAPON`,result:`Hash`,params:[`Ped ped`]},(t,n)=>e(t,n))]}function Cy(e){return e.manager.world.clock}function wy(e){return e.manager.world.weather}function Ty(e){if(e===`server`)return[];let t=(e,t,n=()=>{})=>S({name:e,hash:t,result:`void`,params:[`int hours`,`int minutes`,`int seconds`]},(e,t,r,i)=>{Cy(e).set(t,r,i,e.manager.time()),n(Cy(e))}),n=(e,t,n,r)=>S({name:e,hash:t,result:`int`,params:[]},e=>Math.floor(Cy(e).seconds(e.manager.time())/n)%r),r=(e,t,n)=>{t&&wy(e).turn(x(t),n*1e3,e.manager.time())},i=(e,t)=>S({name:e,hash:t,result:`void`,params:[`char* weatherType`]},(e,t)=>r(e,t,0));return[t(`NETWORK_OVERRIDE_CLOCK_TIME`,16607555653966641298n,e=>{e.overridden=!0}),t(`SET_CLOCK_TIME`,5171176378044663256n),t(`ADVANCE_CLOCK_TIME_TO`,14468542163779599163n),S({name:`ADD_TO_CLOCK_TIME`,hash:15498842407160086754n,result:`void`,params:[`int hours`,`int minutes`,`int seconds`]},(e,t,n,r)=>Cy(e).add(t,n,r,e.manager.time())),S({name:`NETWORK_CLEAR_CLOCK_TIME_OVERRIDE`,hash:15668831687896176238n,result:`void`,params:[]},e=>{Cy(e).overridden=!1}),S({name:`NETWORK_IS_CLOCK_TIME_OVERRIDDEN`,hash:15549061658607711522n,result:`BOOL`,params:[]},e=>Cy(e).overridden),S({name:`PAUSE_CLOCK`,hash:4635862130881195037n,result:`void`,params:[`BOOL toggle`]},(e,t)=>Cy(e).pause(t,e.manager.time())),S({name:`NETWORK_OVERRIDE_CLOCK_MILLISECONDS_PER_GAME_MINUTE`,result:`void`,params:[`int ms`]},(e,t)=>Cy(e).setMsPerMinute(t,e.manager.time())),S({name:`GET_MILLISECONDS_PER_GAME_MINUTE`,hash:3425916725698957787n,result:`int`,params:[]},e=>Cy(e).msPerMinute),n(`GET_CLOCK_HOURS`,2675767815307398015n,3600,24),n(`GET_CLOCK_MINUTES`,1428407088615670002n,60,60),n(`GET_CLOCK_SECONDS`,5282326276443980912n,1,60),i(`SET_WEATHER_TYPE_NOW_PERSIST`,17109505538612268170n),i(`SET_WEATHER_TYPE_NOW`,3005176124459292809n),i(`SET_WEATHER_TYPE_PERSIST`,8091143200275372431n),S({name:`SET_WEATHER_TYPE_OVERTIME_PERSIST`,hash:18109050757229278655n,result:`void`,params:[`char* weatherType`,`float time`]},(e,t,n)=>r(e,t,n)),S({name:`CLEAR_WEATHER_TYPE_PERSIST`,hash:14754798680422182133n,result:`void`,params:[]},()=>{}),S({name:`SET_OVERRIDE_WEATHER`,hash:11834717031454399471n,result:`void`,params:[`char* weatherType`]},(e,t)=>{t&&(wy(e).override=x(t))}),S({name:`CLEAR_OVERRIDE_WEATHER`,hash:3714676070527602768n,result:`void`,params:[]},e=>{wy(e).override=void 0}),S({name:`GET_PREV_WEATHER_TYPE_HASH_NAME`,hash:6218213562023429539n,result:`Hash`,params:[]},e=>wy(e).previous(e.manager.time())),S({name:`GET_NEXT_WEATHER_TYPE_HASH_NAME`,hash:8147899912429302114n,result:`Hash`,params:[]},e=>wy(e).next),S({name:`IS_PREV_WEATHER_TYPE`,hash:4968191145759412393n,result:`BOOL`,params:[`char* weatherType`]},(e,t)=>x(t??``)===wy(e).previous(e.manager.time())),S({name:`IS_NEXT_WEATHER_TYPE`,hash:3434621646856581725n,result:`BOOL`,params:[`char* weatherType`]},(e,t)=>x(t??``)===wy(e).next)]}function Ey(e){return[...Jv(e),...bh(),...Sh(),...Lv(e),...wh(e),...jh(e),...cv(e),...gv(e),...e_(e),...Zv(e),...L_(e),...Fv(e),...fv(e),...my(e),...ly(e),...u_(e),...$v(e),...Uv(e),...eh(e),...th(e),...Eh(e),...H_(e),...Ty(e),...yh(e),...jv(e),...by(e),...Nh(e),...tv(e),..._y(e),...e===`server`?[...ev(),...xv()]:vv()]}const Dy=`resources`;var Oy=class{#e;#t=/* @__PURE__ */ new Map;#n=/* @__PURE__ */ new Map;#r;constructor(e){this.#e=e}scan(){let e=this.#e;e.log(`resources`,`^2Scanning resources.^7
|
|
5002
5002
|
`);let t={newResources:0,updatedResources:0,reloadedResources:0,resources:[],messages:[]};this.#i(Dy,t);let n=0,r=0;for(let{type:i,resource:a,text:o}of t.messages){let t=`resources:${a}`;i===`error`?(n++,e.logError(t,`${o}\n`)):(r++,e.logWarning(t,`${o}\n`))}let{newResources:i,updatedResources:a,reloadedResources:o}=t;e.log(`resources`,o>0?`^2Found ${i} new resources, and refreshed ${a}/${o} resources.^7\n`:`^2Found ${i} resources.^7\n`);let s=(e,t,n)=>`${e} ${e===1?t:n}`;if(n>0&&r>0){let t=`${s(r,`warning`,`warnings`)} and ${s(n,`error`,`errors`)}`;e.log(`resources`,`^1${t} were encountered.^7\n`)}else n>0?e.log(`resources`,`^1${s(n,`error was`,`errors were`)} encountered.^7\n`):r>0&&e.log(`resources`,`^3${s(r,`warning was`,`warnings were`)} encountered.^7\n`);for(let{name:e,path:n}of t.resources)this.#n.set(`@${e}/`,n);e.events.trigger(`onResourceListRefresh`,E([]))}resolve(e){for(let[t,n]of this.#n)if(e.startsWith(t))return`${n}/${e.slice(t.length)}`;return e}#i(e,t){let n=this.#e,{files:r,output:i}=n;this.#r??=n.console.variables.define(`resources_useSystemChat`,w.none,`bool`,!0);let a=(e,n)=>t.messages.push({type:`warning`,resource:e,text:n}),o=/* @__PURE__ */ new Map,s=/* @__PURE__ */ new Set,c=[e];for(let e=c.shift();e!==void 0;e=c.shift()){let l=[...r.list(e)??[]].sort((e,t)=>ko(e.name,t.name));for(let{name:u,directory:d}of l){if(!d)continue;let l=`${e}/${u}`;if(ls(u)){c.push(l);let e=e=>r.read(`${l}/${e}`)!==void 0||r.list(`${l}/${e}`)!==void 0;(e(`fxmanifest.lua`)||e(`__resource.lua`))&&a(u.slice(1,-1),`${u} is a category, but has a resource manifest (if this is meant to be a resource, don't use [] around the name)`);continue}let f=o.get(u);if(f!==void 0){a(u,`${u} exists in more than one place (${f} is used, the duplicate is ${l})`);continue}if(u.startsWith(`.`)||u.toLowerCase()===`txadmin`)continue;if(u===`yarn`||u===`webpack`||u===`chat`&&this.#r.rawValue){let e=u===`chat`?`, unless resources_useSystemChat is false`:``;i.diagnose(u,`FiveM's server leaves out ${l}: it has its own ${u} among its system resources, which it takes instead${e}. FiveRunner has no system resources.`);continue}o.set(u,l);let p=n.getResource(u,!1);if(p!==void 0&&(this.#t.get(u)??l)!==l&&(p.stop(),this.#n.delete(`@${u}/`),n.removeResource(p),p=void 0),p!==void 0)p.reloadMetadata(l)&&(s.add(u),t.updatedResources++),t.reloadedResources++;else{n.printer.printDeveloper(`resources`,`Found new resource ${u} in ${l}\n`),t.newResources++,s.add(u),this.#t.set(u,l);try{t.resources.push(n.addResource(u,{path:l}))}catch(e){if(!(e instanceof Fo))throw e;e.missing?a(u,`${u} does not have a resource manifest (fxmanifest.lua)`):t.messages.push({type:`error`,resource:u,text:`${u} failed to load: ${e.message}`})}}}}for(let e of n.resources){let{metadata:t,name:n}=e;zo(t,`adamant`)||Go(t,`44febabe-d386-4d18-afbe-5e627f4af937`)||s.has(n)&&e.globEntries(`client_script`).length>0&&a(n,`${n} has an outdated manifest (__resource.lua instead of fxmanifest.lua)`)}}},ky=class{name;#e;#t;#n=/* @__PURE__ */ new Map;#r=/* @__PURE__ */ new Set;#i;#a;constructor(e,t,n){this.#e=e,this.name=t,this.#t=n}get(e){return this.#n.get(e)}has(e){return this.#n.has(e)}keys(){return[...this.#n.keys()].sort(p)}get owner(){return this.#i}set owner(e){this.#i=e}set(e,t,n,r){let{onChange:i}=this.#e;if(i.connected){let a;try{a=qa(n)}catch{return}if(!i.run(e,this.name,t,a,r))return}let a=this.#n.get(t),o=n[0]===192;if(a===void 0){if(o)return;this.#n.set(t,new Uint8Array(n))}else if(o)this.#n.delete(t);else if(jy(n,a))return;else this.#n.set(t,new Uint8Array(n));r&&(this.#a===void 0?this.#o(t,n):this.#a.has(t)||this.#a.set(t,new Uint8Array(n)))}hold(){this.#a=/* @__PURE__ */ new Map}release(){let e=this.#a??/* @__PURE__ */ new Map;this.#a=void 0;for(let[t,n]of e)this.#o(t,n)}#o(e,t){let n=this.#t?this.#e.targets:this.#s();for(let r of n)this.#e.send(r,this.name,e,t)}addRoutingTarget(e){this.#r.has(e)||(this.#r.add(e),this.sendAll(e))}removeRoutingTarget(e){this.#r.delete(e)}sendAll(e){for(let t of this.keys())this.#e.send(e,this.name,t,this.#n.get(t))}sendAllInitial(e){this.#r.size>0&&!this.#r.has(e)||this.sendAll(e)}#s(){return[...this.#r].sort((e,t)=>e-t)}},Ay=class{onChange=new Ni;server;#e;#t=/* @__PURE__ */ new Map;#n=/* @__PURE__ */ new Set;#r=[];constructor(e,t){this.server=e,this.#e=t}get targets(){return[...this.#n]}get bags(){return this.#t.values()}get(e){return this.#t.get(e)}register(e,t=!1){let n=this.#t.get(e);return n===void 0&&(n=new ky(this,e,t),this.#t.set(e,n)),n}remove(e){this.#t.delete(e)}reset(){this.#t.clear()}registerTarget(e){if(!this.#n.has(e)){this.#n.add(e);for(let t of[...this.#t.values()])t.sendAllInitial(e)}}unregisterTarget(e){this.#n.delete(e);for(let t of this.#t.values())t.removeRoutingTarget(e)}addPreCreatePrefix(e,t){this.#r.push([e,t])}receive(e,t,n,r){if(t===``||n===``||r.length===0)return;let i=this.#t.get(t);if(i===void 0){let e=this.#r.find(([e])=>t.startsWith(e));if(e===void 0)return;i=this.register(t,e[1])}(i.owner===void 0||i.owner===e)&&i.set(e,n,r,this.server)}send(e,t,n,r){n!==``&&r.length>0&&this.#e(e,t,n,r)}};function jy(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}const My=4294967295;var Ny=class{#e;#t=/* @__PURE__ */ new Map;constructor(e){this.#e=e}openExisting(e,t){if(this.#e.size(e)===void 0)return;let n=this.#t.get(e);if(t!==`read`&&n!==void 0){for(let e of n)if(!e.sharesWrites)return}return this.#n(e,t,!0)}createNew(e,t){if(this.#e.size(e)===void 0&&this.#e.write(e,/* @__PURE__ */ new Uint8Array))return this.#n(e,t,!1)}inUse(e){for(let t of this.#t.keys())if(t===e||t.startsWith(`${e}/`))return!0;return!1}#n(e,t,n){let r=this.#t.get(e);r===void 0&&this.#t.set(e,r=/* @__PURE__ */ new Set);let i=r,a=new Py(this.#e,e,t,n,()=>{i.delete(a),i.size===0&&this.#t.delete(e)});return i.add(a),a}},Py=class{path;access;sharesWrites;#e;#t;#n=0;#r=!0;constructor(e,t,n,r,i){this.#e=e,this.path=t,this.access=n,this.sharesWrites=r,this.#t=i}get position(){return this.#n}length(){return this.#e.size(this.path)??0}read(e){let t=this.#e.readAt(this.path,this.#n,e)??/* @__PURE__ */ new Uint8Array;return this.#n+=t.length,t}write(e){if(this.access===`read`)return!1;let t=this.access===`append`?this.length():this.#n;return this.#e.writeAt(this.path,t,e)?(this.#n=t+e.length,!0):!1}seek(e,t){let n=(t===`set`?0:t===`cur`?this.#n:this.length())+Number(BigInt.asIntN(32,e));return n<0||n>=My?My:(this.#n=n,n)}truncate(e){return this.#n=e,this.access===`write`&&this.#e.resize(this.path,e)}flush(){return this.access!==`read`}close(){this.#r&&(this.#r=!1,this.#t())}};const Fy=131072;function Iy(e,[t,n]){let[r,i]=zh(e.state.position),a=Math.fround(r-t),o=Math.fround(i-n);return Math.fround(Math.fround(a*a)+Math.fround(o*o))<179776}var Ly=class{#e;#t;#n=/* @__PURE__ */ new Map;#r=/* @__PURE__ */ new Set;#i=/* @__PURE__ */ new Set;#a=/* @__PURE__ */ new Set;#o=/* @__PURE__ */ new Set;#s=/* @__PURE__ */ new Map;#c=/* @__PURE__ */ new Map;#l=/* @__PURE__ */ new Map;#u=/* @__PURE__ */ new Map;#d=new Ym(1500);#f=/* @__PURE__ */ new Map;#p=1;#m=/* @__PURE__ */ new Map;#h=/* @__PURE__ */ new Map;entityLockdown=`inactive`;#g=[];constructor(e,t){this.#e=e,this.#t=t}get entities(){return this.#r.values()}create(e,t){let n=this.#t?65534:8191;for(;n>=1&&(this.#i.has(n)||this.#a.has(n));)n--;if(n<1)return;this.#i.add(n),this.#o.add(n);let r=this.#C(e,n,t);return this.#e.queue(`serverEntityCreated`,[this.handleOf(r)]),r}addClient(e){this.#c.set(e,/* @__PURE__ */ new Map),this.#l.set(e,/* @__PURE__ */ new Map)}grantObjectIds(e,t){let n=this.#s.get(e)??/* @__PURE__ */ new Set;this.#s.set(e,n);let r=[];for(let e=1;e<65535&&r.length<t;e++)this.#i.has(e)||this.#a.has(e)||(this.#i.add(e),n.add(e),r.push(e));return r}receiveCreate(e,t,n,r,i){if(this.#n.has(t)||n===W.player&&this.#u.has(e))return;let a=this.#C(n,t,r);a.routingBucket=this.bucketOf(e);let o=this.#_(e,n,i),s=i===void 0?void 0:this.#f.get(i);s!==void 0&&(this.#f.delete(s.token),this.#d.set(s.guid,a),a.guid=s.guid),a.owner=e,a.firstOwner=e,a.passedFilter=n===W.player,this.#c.get(e)?.set(a,{owner:e.netId,state:JSON.stringify(r)}),n===W.player&&this.#u.set(e,a),o?this.#g.push(t):this.#e.onMainThread(()=>{a.valid&&(this.#e.trigger(`entityCreating`,[this.handleOf(a)])?(a.passedFilter=!0,this.#e.queue(`entityCreated`,[this.handleOf(a)])):n!==W.player&&this.#g.push(t))})}receiveSync(e,t,n){let r=this.#n.get(t);if(r?.owner!==e)return;let i=r.state.vehicle??0;n.vehicle===-1&&i!==0&&i!==-1&&(r.lastVehiclePedWasIn=i),r.state=n,r.hasSynced=!0}receiveRemove(e,t){let n=this.#n.get(t);n?.owner===e&&(n.owner=void 0,this.#c.get(e)?.delete(n),this.#g.push(t))}playerHandleOf(e){let t=this.#u.get(e);return t===void 0?0:this.handleOf(t)}drop(e){for(let[t,n]of this.#l){let r=n.get(e);r!==void 0&&(n.delete(e),this.#e.leaveScope(t,e,r,!0))}this.#l.delete(e);for(let t of this.#r)t.firstOwner===e&&(t.firstOwnerDropped=!0),t.owner===e&&(t.owner=void 0,this.#g.push(t.objectId));for(let t of this.#s.get(e)??[])this.#i.delete(t);this.#s.delete(e),this.#c.delete(e),this.#m.delete(e),this.#u.delete(e)}handleOf(e){return e.guid??=this.#d.add(e),e.guid+Fy}byHandle(e){let t=this.#d.get(e-Fy);return t instanceof Lh?t:void 0}pendingOf(e){let t=this.#d.get(e-Fy);return t instanceof Ih?t:void 0}nextCreationToken(){return this.#p=this.#p*48271%2147483647,this.#p}pend(e,t){let n=new Ih(e,t);return n.guid=this.#d.add(n),this.#f.set(e,n),n.guid+Fy}bucketOf(e){return this.#m.get(e)??0}setBucket(e,t){this.#m.set(e,t);let n=this.#u.get(e);n!==void 0&&(n.routingBucket=t)}setLockdown(e,t){this.#h.set(e,t)}#_(e,t,n){if(t===W.player)return!1;let r=this.#h.get(this.bucketOf(e))??this.entityLockdown;return r===`inactive`||r===`no_dummy`?!1:n===void 0||!this.#f.has(n)}knownBy(e){return[...this.#c].flatMap(([t,n])=>n.has(e)?[t]:[])}byObjectId(e){return this.#n.get(e&65535)}delete(e){e.type!==W.player&&this.#g.push(e.objectId)}tick(){for(let e of this.#r)this.#x(e);for(let e of this.#g.splice(0)){let t=this.#n.get(e);t!==void 0&&(t.deleting=!0)}for(let[e,t]of this.#c)this.#v(e,t);for(let e of this.#r)e.deleting&&this.#w(e)}#v(e,t){let n=this.#u.get(e),r=n===void 0?void 0:zh(n.state.position),i=this.#l.get(e),a=[];for(let n of this.#r){let o=t.get(n),s=n.type===W.player&&n.owner!==e?n.owner:void 0;if(!this.#b(e,n,r)||o===void 0&&s!==void 0&&!this.#y(e,i,s)){if(o===void 0)continue;if(t.delete(n),s!==void 0){let t=i.get(s);i.delete(s),this.#e.leaveScope(e,s,t,!1)}n.bag?.unroute(e),a.push({kind:`remove`,objectId:n.objectId});continue}(n.owner===void 0||n.wantsReassign&&n.owner!==e)&&(n.owner=e,n.wantsReassign=!1);let c=JSON.stringify(n.state),{objectId:l,owner:u}=n;if(o!==void 0&&u===e)for(let t of n.onOwned.splice(0))t(e);o!==void 0&&n.bag?.route(e),o===void 0?a.push({kind:`create`,objectId:l,type:n.type,state:n.state,owner:u.netId}):(o.owner!==u.netId||u!==e&&o.state!==c)&&a.push({kind:`sync`,objectId:l,state:n.state,owner:u.netId}),t.set(n,{owner:u.netId,state:c})}a.length>0&&this.#e.sendClones(e,a)}#y(e,t,n){let r=new Set(t.values()),i=127;for(;i>=0&&(i===31||r.has(i));)i--;return i<0?!1:(t.set(n,i),this.#e.enterScope(e,n,i),!0)}#b(e,t,n){if(t.deleting)return!1;let r=t.owner===e;if(!r&&!t.passedFilter)return!1;let i=t.routingBucket===this.bucketOf(e);return(i||this.#u.get(e)===t)&&n!==void 0&&Iy(t,n)?(r&&(t.wantsReassign=!1),!0):r?(t.wantsReassign=!0,(!t.hasSynced||t.ownedByClientScript)&&i):!1}#x(e){if(K(e.type)!==G.ped)return;let t=e.state.vehicle??0,n=e.state.vehicleSeat??0;if(t===e.lastVehicle&&n===e.lastVehicleSeat)return;let r=this.#S(e.lastVehicle);r!==void 0&&r.occupants[e.lastVehicleSeat]===e.objectId&&(r.occupants[e.lastVehicleSeat]=0);let i=this.#S(t);i!==void 0&&i.occupants[n]===0&&n<32&&(i.occupants[n]=i.lastOccupants[n]=e.objectId),e.lastVehicle=t,e.lastVehicleSeat=n}#S(e){let t=e===-1?void 0:this.byObjectId(e);return t!==void 0&&K(t.type)===G.vehicle?t:void 0}#C(e,t,n){let r=new Lh(e,t,n);return this.#a.add(t),this.#r.add(r),this.#n.set(t,r),r}#w(e){if(e.finalizing)return;e.finalizing=!0,e.bag?.remove();let t=K(e.type)===G.ped?e.state.vehicle:void 0,n=t===void 0?void 0:this.#S(t),r=e.state.vehicleSeat??0;n?.occupants[r]===e.objectId&&(n.occupants[r]=0),this.#e.onMainThread(()=>{let t=this.handleOf(e);this.#e.trigger(`entityRemoved`,[t]),this.#n.delete(e.objectId),this.#a.delete(e.objectId),this.#o.delete(e.objectId)&&this.#i.delete(e.objectId),this.#r.delete(e);for(let[t,n]of this.#u)n===e&&this.#u.delete(t);this.#d.delete(t-Fy)})}},Ry=class{side;lua;javascript;output;security=new ua;printer;defaultConsole;console;convarPermissions;filesystemPermissions;consoleBuffer;kvp;lines;files;openFiles;http;httpServer;nui;oneSync;gameState;natives=new xt;events=new vs(this);latent=new nc(this);states;callbacks=new So;constraints=new _;#e=new hs(this);#t;#n=[];#r=!1;#i;#a;#o=0;#s=0;timeZone;watchdog;#c=0;#l=/* @__PURE__ */ new Map;#u=/* @__PURE__ */ new Map;#d=[];#f=1;#p=!1;#m;#h;#g;#_={networked:(e,t)=>{let n=this.states.register(`entity:${e.objectId}`,!0);t&&n.hold()},taken:e=>this.states.get(`entity:${e.objectId}`)?.release(),forgotten:e=>{e.objectId!==void 0&&this.states.remove(`entity:${e.objectId}`),this.states.remove(`localEntity:${e.handle}`)}};#v;#y;#b;#x;#S;#C;#w=[];#T={created:[],modified:[]};#E;#D=[];#O=[];constructor(e){this.side=e.side,this.lua=e.lua,this.javascript=e.javascript,this.output=e.output,this.#i=e.time,this.#a=e.wallClock??Date.now,this.timeZone=e.timeZone??Zr(),this.watchdog=e.watchdog,this.kvp=e.kvp??new Xs,this.lines=e.lines,this.files=e.files??new Eo,this.openFiles=new Ny(this.files),this.http=e.http??Os,this.#y=e.side===`server`?e.database:void 0,this.oneSync=this.side===`server`&&(e.oneSync??!0),this.printer=new ra((e,t)=>this.output.write(e,t));let t=this.side===`server`;if(this.states=new Ay(t,(e,n,r,i)=>{let a=this.#h;t?this.#m?.sendStateBag(e,n,r,i):a!==void 0&&a.session.receiveStateBag(a,n,r,i)}),t){let e=new to(this);this.printer.listen((t,n)=>e.add(t,n)),this.consoleBuffer=e}else this.consoleBuffer=void 0;this.httpServer=t?new qs(this):void 0,this.gameState=t?new Ly({queue:(e,t)=>this.events.queue(e,E(t)),trigger:(e,t)=>this.events.trigger(e,E(t)),onMainThread:e=>this.enqueue(e),sendClones:(e,t)=>this.#m?.sendClones(e,t),enterScope:(e,t,n)=>this.#m?.enterScope(e,t,n),leaveScope:(e,t,n,r)=>this.#m?.leaveScope(e,t,n,r)},this.oneSync):void 0,this.nui=t?void 0:new uc(this),this.#g=t?void 0:new Tg(this.#_),this.#v=t?void 0:new s_(this);let n={security:this.security,output:this.printer,server:t,clock:()=>this.#i()};this.defaultConsole=new Gi(n),ia(this.defaultConsole,this.printer),ji(this.defaultConsole),this.security.addEntry(`system.console`,`command`,`allow`),t?(this.convarPermissions=new ea,ta(this.defaultConsole,this.convarPermissions),this.filesystemPermissions=new qm,Jm(this,this.filesystemPermissions),this.console=new Gi({...n,fallback:this.defaultConsole}),this.#t=new Oy(this),wo(this),ms(this),this.console.commands.onFallback.connect((e,t)=>!this.security.check(`command.${e}`)||this.events.trigger(`rconCommand`,E([e,t])),-100),this.#x=this.console.variables.define(`sv_enableNetEventReassembly`,w.none,`bool`,!0),this.states.register(`global`,!0).owner=-1,this.#S=this.console.variables.define(`sv_stateBagStrictMode`,w.none,`bool`,!1),this.#C=go(this,e.gameBuild??3258),this.console.variables.find(`sv_entityLockdown`).track(e=>{this.gameState.entityLockdown=e}),this.#N()):(this.security.addEntry(`system.internal`,`builtin`,`allow`),this.convarPermissions=void 0,this.filesystemPermissions=void 0,this.#t=void 0,this.console=this.defaultConsole,this.console.variables.watch(()=>{}),this.console.commands.onFallback.connect(()=>{let e=this.#h;return e===void 0||(e.session.command(e,this.console.commands.rawCommand),!1)},99999),this.#x=this.console.variables.define(`sv_enableNetEventReassembly`,w.replicated,`bool`,!0),this.#S=this.console.variables.define(`sv_stateBagStrictMode`,w.replicated,`bool`,!1),this.#C=void 0,this.states.register(`global`,!0),this.states.registerTarget(0),this.states.addPreCreatePrefix(`entity:`,!0),this.states.addPreCreatePrefix(`player:`,!0)),this.natives.register(...Ct(this.side),...Ey(this.side),...e.natives??[]),this.side===`server`&&this.#P(this.oneSync,e.gameBuild??3258)}time(){return this.#i()}clock(){return 864e8+Math.floor(this.#i()*1e3)}wallClock(){return this.#a()}nextTemporaryName(){return++this.#c}get currentResource(){return this.#n.at(-1)?.resource}get invokingResource(){return this.#n.at(-2)?.resource}addResource(e,t){if(this.#l.has(e))throw Error(`There is a resource named ${e} already`);let n=new ss(this,e,t);this.#e.attach(n),this.side===`server`?(n.onStart.connect(()=>this.#F(n),Mi),n.onStart.connect(()=>this.#I(n),99999999),n.onStop.connect(()=>this.#L(n),-1e3)):n.onStop.connect(()=>this.#g?.release(e),1e4),this.#l.set(e,n);for(let e of n.entries(`provide`)){let t=this.#u.get(e);t===void 0?this.#u.set(e,[n]):t.push(n)}return n}removeResource(e){e.stop(),e.destroy(),this.#l.delete(e.name)}resetResources(){for(let e of[...this.#l.values()])e.stop(),e.destroy();this.#l.clear(),this.#u.clear()}resourcesForClients(){let e=/* @__PURE__ */ new Set,t=[],n=n=>{n===void 0||e.has(n.name)||(e.add(n.name),(n.state===`started`||n.state===`starting`)&&n.entries(`server_only`).length===0&&t.push(n))};for(let e of this.#D)n(this.getResource(e,!1));for(let e of this.#l.values())n(e);return t}scanResources(){if(this.#t===void 0)throw Error(`Only servers scan for resources`);this.#t.scan()}readFile(e){return this.files.read(C(this.#t?.resolve(e)??e))}getResource(e,t=!0){t&&this.#y!==void 0&&Em.has(e)&&!this.#l.has(e)&&!this.#l.has(`oxmysql`)&&this.addResource(`oxmysql`,{files:Dm(),path:`citizen/system_resources/oxmysql`});let n=this.#l.get(e);if(!t||n!==void 0&&n.state!==`stopped`)return n;for(let t of this.#u.get(e)??[])if(t.state===`started`||n===void 0)return t;return n}get resources(){return this.#l.values()}resourcesInCategory(e){return Array.from(this.#l.values()).filter(t=>t.categories.includes(e)).map(e=>e.name).sort(p)}get session(){return this.#m}get world(){return this.#g}get rpc(){return this.#v}get oxmysql(){let e=this.#y;if(e!==void 0)return this.#b??=new Gm({open:t=>e({connectionString:t,zone:this.timeZone,clock:()=>this.wallClock()}),print:e=>this.log(`script:oxmysql`,`${e}\n`),trigger:(e,t)=>this.events.trigger(e,Ga(Tc(t))),complete:(e,t,n)=>{let r=this.getResource(`oxmysql`,!1);r!==void 0&&this.events.trigger(`__fiverunner_internal:oxmysqlResponse`,Ga(Tc([e,t,n])),``,r)},convar:(e,t)=>this.console.variables.find(e)?.value??t,now:()=>this.#i(),measure:()=>performance.now(),seeds:()=>this.#k(),diagnose:e=>this.output.diagnose(`oxmysql`,e)}),this.#b}#k(){let e=[],t=new TextDecoder,n=r=>{let i=[...this.files.list(r)??[]].sort((e,t)=>p(e.name,t.name));for(let{name:a,directory:o}of i){let i=`${r}/${a}`;if(o)a!==`node_modules`&&!a.startsWith(`.`)&&n(i);else if(a.toLowerCase().endsWith(`.sql`)){let n=this.files.read(i);n!==void 0&&e.push({path:i,sql:t.decode(n)})}}};n(Dy);for(let e of this.#l.values()){let t=C(e.path);t.startsWith(`resources/`)||n(t)}return e}get player(){return this.#h}joinSession(e,t){this.#A(),this.#m=e,this.#h=t,t!==void 0&&e.server.oneSync&&this.states.register(`player:${t.netId}`,!0)}leaveSession(e){this.#m=void 0,this.#h=void 0,this.#E={joined:e},this.enqueue(()=>this.#A())}#A(){let e=this.#E;e!==void 0&&(this.#E=void 0,e.joined?this.events.holdingResourceStops(()=>this.resetResources()):this.resetResources(),this.#j(),this.#g=new Tg(this.#_),e.joined&&(this.states.reset(),this.states.register(`global`,!0)))}takeServerVariables(e){let{variables:t}=this.console;this.security.runAs(`system.console`,()=>this.security.runAs(`system.internal`,()=>{for(let[n,r]of e){let e=t.find(n);if(e===void 0)this.#T.created.push(n);else{let r=t.flagsOf(n);if(r&w.userPref){this.printer.printDeveloper(`net`,`Blocked convar ${n} from being set by server.\n`);continue}(r&w.replicated)===0&&e.saveOfflineValue(),this.#T.modified.push(n)}this.console.executeDirect([`setr`,n,r])}}))}#j(){let{variables:e}=this.console,{created:t,modified:n}=this.#T;for(let n of t)e.unregisterName(n);this.security.runAs(`system.internal`,()=>{for(let t of n){let n=e.find(t);if(n===void 0)continue;let r=(e.defaultFlagsOf(t)&w.replicated)!==0;r||e.removeFlags(t,w.replicated),n.set(n.offlineValue),r&&e.removeFlags(t,w.modified)}}),this.#T={created:[],modified:[]}}replicatedVariables(){return By(this.console.variables.list(w.replicated))}#M(){let{variables:e}=this.console,t=w.replicated|w.modified,n=e.list(t).filter(({flags:e})=>(e&t)===t);for(let{name:t}of n)e.removeFlags(t,w.modified);this.#m?.replicateVariables(By(n))}get configured(){return this.#p}endInitialConfiguration(){this.#p=!0,this.side===`server`&&vo(this)}get primaryPort(){return this.#C?.primaryPort??0}lookUpRef(e){let{resource:t,instance:n,index:r}=zy(e);if(t===`_cfx_internal`)return;let i=this.getResource(t),a=i?.runtimes.find(({host:e})=>e.instanceId===n);if(i!==void 0&&a!==void 0)return{resource:i,runtime:a,index:r}}invokeFunctionReference(e,t){let{resource:n,index:r}=zy(e);if(n===`_cfx_internal`)return this.callbacks.call(r,t);let i=this.lookUpRef(e);if(i===void 0)return;let{resource:a,runtime:o,index:s}=i;return a.enter(()=>o.callRef(s,t),o)}duplicateFunctionReference(e){let{resource:t,index:n}=zy(e);if(t===`_cfx_internal`)return this.callbacks.duplicate(n);let r=this.lookUpRef(e);if(r===void 0)return null;let{resource:i,runtime:a,index:o}=r,s=i.enter(()=>a.duplicateRef(o),a);return`${i.name}:${a.host.instanceId}:${s}`}deleteFunctionReference(e){let{resource:t,index:n}=zy(e);if(t===`_cfx_internal`){this.callbacks.delete(n);return}let r=this.lookUpRef(e);if(r===void 0)return;let{resource:i,runtime:a,index:o}=r;i.enter(()=>a.deleteRef(o),a)}tick(){this.#o++,this.#h?.touch();for(let e of this.#w.splice(0))e();this.gameState?.tick(),this.#g?.tick(this.time(),!this.nui?.focused||this.nui.keepingInput),this.#v?.tick(),this.#b?.tick(),this.security.runAs(`system.console`,()=>this.console.executeBuffer()),this.events.tick();let e=this.#d.flatMap(e=>e.runtimes.map(t=>({resource:e,runtime:t})));for(let{runtime:t}of e)t.collect();for(let{resource:t,runtime:n}of e)t.runtimes.includes(n)&&t.enter(()=>n.resume(),n);this.side===`server`&&this.#M();for(let e of this.#O.splice(0))e();this.#h!==void 0&&this.#h.session.syncWorld(this.#h),this.reassembling&&this.latent.tick()}get ticks(){return this.#o}get reassembling(){return this.#x.rawValue===!0}get strictStateBags(){return this.#S.rawValue===!0}receive(e){this.#w.push(e)}enqueue(e){this.#O.push(e)}log(e,t){this.printer.print(e,t)}trace(e,t){this.printer.print(e,t.split(`\0`,1)[0])}logWarning(e,t){this.printer.printWarning(e,t)}logError(e,t){this.printer.printError(e,t)}formatStackTrace(e){if(e!==null&&this.#r)return null;this.#r=!0;let t=this.#n.at(-1);e!==null&&za(e)>0&&t!==void 0&&this.output.diagnose(t.resource.name,`FormatStackTrace was given stack frames to put first, which FiveRunner does not read yet: it leaves them out of the stack trace.`);let n=``;for(let e=this.#n.length-1;e>=0;e--){let{runtime:r,start:i,end:a}=this.#n[e];if(r!==null)try{for(let{name:e,file:t,line:o}of r.walkStack({start:i,end:a}))n+=`^3> ${e}^7 (^5${t}^7:${o})\n`}catch(e){if(!(e instanceof ue))throw e;this.log(`script:${t.resource.name}`,r.describeRoutineError(`stack trace`,e))}}return n}nativeWrapper(e){let t=this.natives.byName(e);return t===void 0?null:Dt(t,e,{direct:this.side===`client`})}#N(){let{security:e}=this;e.addEntry(`system.console`,`command`,`allow`),e.addEntry(la,`command.help`,`allow`),e.runAs(`system.console`,()=>{this.console.executeDirect([`con_addChannelFilter`,`forward:*/*`,`noprint`])}),e.addEntry(`system.console`,`webadmin`,`allow`),e.addEntry(`resource.monitor`,`command.quit`,`allow`)}#P(e,t){this.constraints.enforcing=!0,this.constraints.register(`server`,m),this.constraints.register(`onesync`,()=>e||`OneSync needs to be enabled`),this.constraints.register(`gameBuild`,e=>{let n=ne(e);return t===0||n===void 0?!1:t>=n||`sv_enforceGameBuild needs to be at least ${n} (current is ${t})`}),this.constraints.register(`native`,e=>{if(e.length<=2||!e.startsWith(`0x`))return!1;let t=r(e.slice(2));return this.natives.byHash(t)!==void 0||`native 0x${t.toString(16).toUpperCase()} isn't supported`})}#F(e){if(e.entries(`is_cfxv2`).length===0)return!0;let t=e.name,n=e.entries(`game`),r=n.includes(`common`),i=n.includes(`gta5`),a=!0;return r&&i?(this.logWarning(`resources`,`Resource ${t} specifies both \`common\` and a specific game. This is considered ill-formed.\n`),a=!1):!r&&!i&&(this.logWarning(`resources`,`Resource ${t} does not support the current game (gta5).\n`),a=!1),zo(e.metadata,`adamant`)||(this.logWarning(`resources`,`Resource ${t} does not specify an \`fx_version\` in fxmanifest.lua.\n`),a=!1),a}#I(e){let t=0;for(let n of[`client_script`,`server_script`,`shared_script`,`file`])for(let{value:r,location:i,found:a}of e.missingEntries(n)){if(a)continue;let o=i?.file??``,s=`${o.slice(o.lastIndexOf(`/`)+1)}:${i?.line??0}`;this.logWarning(`resources:${e.name}`,`could not find ${n} \`${r}\` (defined in ${s})\n`),t++}let n=t===0?``:` (${t} warning${t===1?``:`s`})`;this.log(`resources`,`Started resource ${e.name}${n}\n`),!(e.entries(`server_only`).length>0)&&(this.#D.push(e.name),this.#m?.resourceStarted(e.name))}#L(e){this.log(`resources`,`Stopping resource ${e.name}\n`),!(e.entries(`server_only`).length>0)&&(this.#D=this.#D.filter(t=>t!==e.name),this.#m?.resourceStopped(e.name))}instanceId(){return this.#f=Math.imul(this.#f,214013)+2531011>>>0,this.#f>>>16&32767}pushCall(e,t){this.#R(),this.#n.push({resource:e,runtime:t,start:null,end:null})}popCall(){this.#R(),this.#n.pop(),this.#n.length===0&&(this.#r=!1)}#R(){let e=performance.now(),t=this.#n.at(-1);t!==void 0&&(t.resource.cpuTime+=e-this.#s),this.#s=e}submitBoundary(e,t){let n=this.#n.at(-1);n!==void 0&&(n[e]=t)}addRuntime(e){this.#d.push(e)}removeRuntime(e){this.#d.splice(this.#d.indexOf(e),1)}};function zy(e){let t=e.indexOf(`:`),r=e.indexOf(`:`,t+1),i=r-t;return{resource:t===-1?e:e.slice(0,t),instance:n(i<0?e.slice(t+1):e.slice(t+1,t+1+i)),index:n(e.slice(r+1))}}function By(e){return e.map(({name:e,variable:t})=>[e,t.value]).sort(([e],[t])=>p(e,t))}const Vy={write:()=>{},warn:()=>{},diagnose:()=>{}};var Hy=class t{clock;server;session;#e;#t;#n=[];constructor(e,t,n,r){this.#e=e,this.#t=r,this.clock=t,this.server=n,this.session=new Gg(n),t.every(50,()=>n.tick())}static async create(n){let r=new e,i=await Wy(n),a=n.quickjs===void 0?void 0:await xi(n.quickjs),o=Gy(n,r,`server`,`server`,i,0,Uy(n.server,a));return new t(n,r,o,a)}get clients(){return this.#n}async connect(e={},t={}){let n=this.clock.now,r=await Wy(this.#e),i=`client ${this.#n.length+1}`,a=Gy(this.#e,this.clock,`client`,i,r,n,Uy(t,this.#t));return this.#n.push(a),this.clock.every(this.#e.clientFrameTime??16.666666666666668,()=>a.tick()),{client:a,player:this.session.connect(a,e)}}advance(e){this.clock.advance(e)}};function Uy(e={},t){return t===void 0?e:{...e,javascript:t}}function Wy(e){return Ae.create(e.cfxlua,{output:()=>{}})}function Gy(e,t,n,r,i,a,o={}){let{epoch:s}=e;return new Ry({...s===void 0?{}:{wallClock:()=>s+t.now},...o,side:n,lua:i,time:()=>t.now-a,output:e.output?.({side:n,name:r})??Vy})}var Ky=`/__fiverunner/assets/emscripten-module-uFzwHH0Y.wasm`,qy=`/__fiverunner/assets/sqlite3-Con_VOcu.wasm`;new TextEncoder,new TextDecoder;function Jy(e){return e.startsWith(`cfx-nui-`)?`https://${e}`:`nui://${e}`}function Yy(e){return e.replace(/(^|-)([a-z])/g,(e,t,n)=>t+n.toUpperCase())}async function Xy(e,t,n){if(n.kind===`file`)return{response:e.file(t,n.path)};let r=new URL(n.url),i=r.protocol===`https:`?`https`:`http`;if(!e.takes(i,r.hostname))return{network:!0};if(i===`https`&&r.hostname.startsWith(`cfx-nui-`))return{response:e.file(r.hostname,r.pathname)};let a=n.headers.filter(([e])=>e!==`origin`).map(([e,t])=>[Yy(e),t]);return{response:await e.request(r.hostname,{method:n.method,path:r.pathname,query:r.search.slice(1),headers:[...a,[`Origin`,Jy(t)]],body:n.body})}}var Zy=class{#e;#t=/* @__PURE__ */ new Map;constructor(e){this.#e=e}of(e){return{write:(t,n)=>{let r=`${e}\n${t}`,i=((this.#t.get(r)?.text??``)+n).split(`
|
|
5003
5003
|
`);this.#t.set(r,{process:e,channel:t,text:i.pop()});for(let n of i)this.#e({process:e,kind:`console`,channel:t,text:n})},warn:(t,n)=>{this.#e({process:e,kind:`warning`,channel:t,text:n})},diagnose:(t,n)=>{this.#e({process:e,kind:`diagnostic`,channel:t,text:n})}}}get unended(){return[...this.#t.values()].filter(({text:e})=>e!==``).map(({process:e,channel:t,text:n})=>({process:e,kind:`console`,channel:t,text:n}))}};const Qy=/* @__PURE__ */ new Map([[20,`vec2`],[21,`vec3`],[22,`vec4`],[23,`quat`]]),$y=/* @__PURE__ */ new Set([10,11]),eb=1e3,tb=new TextDecoder;function nb(e){return Number.isNaN(e)?`nan`:Number.isFinite(e)?Number.isInteger(e)&&Math.abs(e)<0x38d7ea4c68000?`${e}.0`:String(e):e>0?`inf`:`-inf`}function rb([e],[t]){let n=e=>e.type===`positive`||e.type===`negative`?0:e.type===`str`?1:2,r=n(e)-n(t);return r===0?(e.type===`positive`||e.type===`negative`)&&(t.type===`positive`||t.type===`negative`)?e.value<t.value?-1:+(e.value>t.value):e.type===`str`&&t.type===`str`?ib(e.bytes,t.bytes):p(ob(e),ob(t)):r}function ib(e,t){for(let n=0;n<Math.min(e.length,t.length);n++)if(e[n]!==t[n])return e[n]-t[n];return e.length-t.length}function ab(e){if(e.type===`str`){let t=tb.decode(e.bytes);if(/^[A-Za-z_][A-Za-z0-9_]*$/.test(t))return t}return`[${ob(e)}]`}function ob(e){switch(e.type){case`nil`:return`nil`;case`boolean`:return String(e.value);case`positive`:case`negative`:return String(e.value);case`float32`:return nb(Number(e.value.toPrecision(7)));case`float64`:return nb(e.value);case`str`:return JSON.stringify(tb.decode(e.bytes));case`bin`:return`<${e.bytes.length} bytes>`;case`array`:return e.items.length===0?`{}`:`{ ${e.items.map(ob).join(`, `)} }`;case`map`:return e.entries.length===0?`{}`:`{ ${[...e.entries].sort(rb).map(([e,t])=>`${ab(e)} = ${ob(t)}`).join(`, `)} }`;case`ext`:{let{type:t,data:n}=e.extension;if($y.has(t))return`<function>`;let r=Qy.get(t);if(r===void 0||n.length%4!=0)return`<extension ${t}>`;let i=new DataView(n.buffer,n.byteOffset,n.byteLength),a=Array.from({length:n.length/4},(e,t)=>Number(i.getFloat32(t*4,!0).toPrecision(7)));return`${r}(${(r===`quat`?[a.at(-1),...a.slice(0,-1)]:a).map(nb).join(`, `)})`}}}function sb(e){return e.length>eb?`${e.slice(0,eb)}...`:e}function cb(e){try{return sb(ob(qa(e)))}catch{return`<no msgpack>`}}function lb(e){if(e.length===0)return``;try{let t=qa(e);return t.type===`array`?sb(t.items.map(ob).join(`, `)):sb(ob(t))}catch{return`<no msgpack>`}}const ub=`__cfx_`;function db(e,t){let{name:n,state:r,cpuTime:i}=t,a=[...t.handledEvents].sort(),o=`${ub}export_${n}_`,s=`res:${n}:`;return{name:n,state:r,cpu:i,exports:a.filter(e=>e.startsWith(o)).map(e=>e.slice(o.length)),events:a.filter(e=>!e.startsWith(ub)),nuiCallbacks:a.filter(e=>e.startsWith(`__cfx_nui:`)).map(e=>e.slice(10)),commands:e.console.commands.list.filter(e=>e.resource===n).map(e=>e.name),keyMappings:Array.from(e.world?.input.mappings.values()??[]).filter(e=>e.resource===n).map(({key:e,command:t,description:n})=>`${e}: ${t}, ${n}`),kvp:e.kvp.keysWith(s).map(t=>({key:t.slice(s.length),value:cb(e.kvp.get(t))}))}}function fb(e,t){return{process:t,ticks:e.ticks,resources:Array.from(e.resources,t=>db(e,t)).sort((e,t)=>e.name.localeCompare(t.name)),convars:e.console.variables.list().map(({name:e,variable:t})=>({name:e,value:t.value}))}}const pb=e=>Math.round(e*100)/100;function mb(e){let t=t=>{let[n,r]=e.components.get(t)??[0,0];return[n,r]},[,,,n,r,,,i]=e.headBlend;return{hair:e.hair,hairStyle:t(2)[0],skin:[n,r,pb(i)],top:t(11),legs:t(4),shoes:t(6)}}function hb(e){let{orientation:t}=e.state;return t.kind===`heading`?Qh(t.heading):Xh(...Jh(t.quaternion))[2]}function gb(e){let t=K(e.type);return t===G.ped?`ped`:t===G.vehicle?`vehicle`:`object`}function _b(e,t,n){let r=[];t.forEach((e,t)=>{let n=e.world?.playerPed;n!==void 0&&r.push({id:n.objectId??0,kind:`player`,x:pb(n.x),y:pb(n.y),z:pb(n.z),heading:pb(dh(n.rotation)),model:n.model,owner:t+1,look:mb(n.appearance)})});for(let t of e.gameState?.entities??[]){if(!t.valid||t.type===W.player)continue;let[e,i,a]=zh(t.state.position),o=t.owner===void 0?void 0:n(t.owner.netId);r.push({id:t.objectId,kind:gb(t),x:pb(e),y:pb(i),z:pb(a),heading:pb(hb(t)),model:t.state.model,...o===void 0?{}:{owner:o}})}let i=[];return t.forEach((e,t)=>{for(let n of e.world?.blips.all??[]){let[e,r,a]=n.coords,{shape:o}=n;i.push({client:t+1,handle:n.handle,x:pb(e),y:pb(r),z:pb(a),sprite:n.sprite,colour:n.colour,alpha:n.alpha,shape:o.kind,...o.kind===`radius`?{radius:o.radius}:{},...o.kind===`area`?{width:o.width,height:o.height}:{},...n.name===void 0?{}:{name:n.name},...n.script===void 0?{}:{script:n.script},route:n.route})}}),{entities:r,blips:i}}const vb={timeoutMs:5e3},yb=3e3;var bb=class e{#e;#t;#n=[];#r=``;#i=/* @__PURE__ */ new WeakMap;#a;#o;constructor(e,t,n){this.#e=e,this.#t=t,this.#a=n}static async start(t){let n=new Zy(e=>t.onEvent({type:`output`,line:e})),r=[],i=t.sqlite===void 0?void 0:Km(t.sqlite),a=await Hy.create({cfxlua:t.cfxlua,...t.quickjs===void 0?{}:{quickjs:t.quickjs},output:({name:e})=>n.of(e),server:{files:t.project.files(),http:t.http,watchdog:t.watchdog??vb,...i===void 0?{}:{database:e=>{let t=i(e);return r.push(t),t}}}}),o=new e(a,t,r);return a.server.events.onTrigger.connect((e,t,n)=>{let r=/^net:(\d+)$/.exec(n)?.[1],i=r===void 0?void 0:o.#u(Number(r));i!==void 0&&o.#d({from:i,to:`server`,name:e,args:lb(t)})}),o.#f(()=>{let{server:e}=a;e.scanResources();for(let n of t.project.commands)e.security.runAs(`system.console`,()=>e.console.commands.invoke(n,``));e.endInitialConfiguration()}),o.#c(),o}get crash(){return this.#o}advance(e){this.#o===void 0&&(this.#f(()=>this.#e.advance(e)),this.#c())}command(e){if(this.#o!==void 0)return;let{server:t}=this.#e;this.#f(()=>{t.security.runAs(`system.console`,()=>t.console.commands.invoke(e,``))}),this.#c()}restartChanged(e){if(this.#o!==void 0)return;let t=[...this.#e.server.resources],n=/* @__PURE__ */ new Set;for(let r of e){let e=r.slice(r.lastIndexOf(`/`)+1).toLowerCase();if(e===`fxmanifest.lua`||e===`__resource.lua`||e.endsWith(`.sql`))return;let i=t.find(e=>r.startsWith(`${C(e.path)}/`));if(i===void 0)return;i.state===`started`&&n.add(i.name)}let{files:r}=this.#e.server;if(r instanceof Eo)for(let t of e)r.refresh(t);for(let e of n)this.command(`restart "${e}"`);return[...n]}async connect(e={}){for(;this.#e.clock.now<yb&&this.#o===void 0;)await Promise.allSettled(this.#a.splice(0)),this.advance(Math.min(50,yb-this.#e.clock.now));await Promise.allSettled(this.#a.splice(0));let t=this.#t.watchdog??vb,n=e.identifiers??[Ig(e.name)],{client:r,player:i}=await this.#e.connect({...e,identifiers:n},{watchdog:t});this.#n.push({manager:r,player:i});let a=this.#n.length;r.events.onTrigger.connect((e,t,n)=>{n.startsWith(`net:`)&&this.#d({from:`server`,to:a,name:e,args:lb(t)})});let o=e=>this.#t.onEvent({type:`nui`,client:a,event:e}),s=r.nui;return s.onCreate.connect(e=>o({type:`create`,frame:e})),s.onDestroy.connect(e=>o({type:`destroy`,resource:e})),s.onMessage.connect((e,t)=>o({type:`message`,resource:e,json:t})),s.onFrameFocus.connect((e,t)=>{o({type:`frameFocus`,resource:e,focused:t})}),s.onFocus.connect((e,t)=>o({type:`focus`,focus:e,cursor:t})),s.onKeepInput.connect(e=>o({type:`keepInput`,keepInput:e})),s.onZIndex.connect((e,t)=>o({type:`zIndex`,resource:e,zIndex:t})),this.#c(),a}disconnect(e,t=`Exiting`){let n=this.#n[e-1];n!==void 0&&this.#o===void 0&&(this.#f(()=>n.player.quit(t)),this.#c())}submitCard(e,t){let n=this.#n[e-1];n!==void 0&&this.#o===void 0&&(this.#f(()=>n.player.submitCard(t)),this.#c())}emit(e,t,n){if(this.#o!==void 0)return;let r=E(t);if(`from`in n){let t=this.#n[n.from-1]?.player;t!==void 0&&this.#e.server.events.queue(e,r,`net:${t.netId}`);return}let i=n.to===`everyone`?this.#n:[this.#n[n.to-1]];for(let t of i)t?.player.state===`joined`&&t.manager.events.queue(e,r,`net:${Lg}`)}teleport(e,t,n,r){let i=this.#n[e-1]?.manager.world?.playerPed;if(i===void 0||this.#o!==void 0)return;let a=i.vehicle??i;a.moveTo(Math.fround(t),Math.fround(n),r===void 0?a.z:Math.fround(r)),this.#c()}waypoint(e,t,n){let r=this.#n[e-1]?.manager.world;r!==void 0&&this.#o===void 0&&(r.blips.setWaypoint(Math.fround(t),Math.fround(n)),this.#c())}key(e,t,n){let r=this.#n[e-1]?.manager,i=r?.world?.input;if(r===void 0||i===void 0||this.#o!==void 0)return;let a=n?i.keyDown(t):i.keyUp(t);this.#f(()=>{for(let e of a)r.console.commands.invoke(e,``)}),this.#c()}inspect(e){let t=this.#s(e);return t===void 0?void 0:fb(t,e)}evaluate(e,t,n){let r=this.#s(e)?.getResource(t),i=r?.runtimes[0];r!==void 0&&i!==void 0&&this.#o===void 0&&(this.#f(()=>r.enter(()=>i.evaluate(n),i)),this.#c())}nui(e){return this.#n[e-1]?.manager.nui}#s(e){return e===`server`?this.#e.server:this.#n[e-1]?.manager}#c(){let e=[...this.#e.server.states.bags].filter(e=>e.keys().length>0),t={resources:[...this.#e.server.resources].map(({name:e,state:t})=>({name:e,state:t})),players:this.#n.map(({player:e,manager:t},n)=>{let r=Math.round((t.world?.screen.level(t.time())??0)*100)/100;return{client:n+1,name:e.name,id:e.netId,state:e.state,...e.message===void 0?{}:{message:e.message},...e.card===void 0?{}:{card:e.card},...e.rejection===void 0?{}:{rejection:e.rejection},...r>0?{fade:r}:{},...t.world?.screenBlurred===!0?{blurred:!0}:{}}}),bags:e.map(e=>({name:e.name,keys:e.keys().map(t=>({key:t,value:this.#l(e.get(t))}))})),map:_b(this.#e.server,this.#n.map(({manager:e})=>e),e=>this.#u(e))},n=JSON.stringify(t);n!==this.#r&&(this.#r=n,this.#t.onEvent({type:`state`,state:t}))}#l(e){let t=this.#i.get(e);return t===void 0&&(t=cb(e),this.#i.set(e,t)),t}#u(e){let t=this.#n.findIndex(({player:t})=>t.netId===e);return t===-1?void 0:t+1}#d(e){this.#t.onEvent({type:`net`,event:e})}#f(e){try{e()}catch(e){if(!(e instanceof pe))throw e;this.#o=`A runtime crashed, which stopped the session: ${e.message}`,this.#t.onEvent({type:`crash`,message:this.#o})}}};const xb=e=>postMessage(e);let Sb,Cb,wb,Tb,Eb=``,Db,Ob=0,kb=performance.now();function Ab(e){async function t(t){let n=++Ob,r=(Db?.players??[]).filter(e=>e.state===`connecting`||e.state===`joined`);Tb=void 0,Db=void 0;try{let{info:i,files:a}=e.project(t);Sb??=e.cfxlua(),Cb??=WebAssembly.compileStreaming(fetch(Ky)),wb??=WebAssembly.compileStreaming(fetch(qy));let o=await bb.start({cfxlua:await Sb,quickjs:await Cb,sqlite:await wb,project:{files:a,commands:i.commands},http:e.http,onEvent:e=>{n===Ob&&(e.type===`state`&&(Db=e.state),xb({type:`event`,event:e}))}});if(n!==Ob)return;xb({type:`started`,project:i}),Tb=o,Eb=i.mount,kb=performance.now();for(let{name:e}of r)await o.connect({name:e})}catch(e){n===Ob&&xb({type:`failed`,message:String(e)})}}function n(){let e=performance.now(),t=Math.min(e-kb,1e3);if(kb=e,Tb!==void 0)try{Tb.advance(t)}catch(e){Tb=void 0,xb({type:`failed`,message:String(e)})}}addEventListener(`message`,e=>{let n=e.data;switch(n.type){case`start`:t(n.project);break;case`command`:Tb?.command(n.line);break;case`change`:{let{paths:e}=n,t=e===null?void 0:Tb?.restartChanged(e.map(e=>Eb===``?e:`${Eb}/${e}`));xb({type:`changed`,restarted:t??null});break}case`connect`:Tb?.connect({name:n.name});break;case`disconnect`:Tb?.disconnect(n.client);break;case`submitCard`:Tb?.submitCard(n.client,n.json);break;case`emit`:Tb?.emit(n.name,n.args,n.target);break;case`teleport`:Tb?.teleport(n.client,n.x,n.y,n.z);break;case`waypoint`:Tb?.waypoint(n.client,n.x,n.y);break;case`key`:Tb?.key(n.client,n.key,n.down);break;case`inspect`:{let e=Tb?.inspect(n.process);e!==void 0&&xb({type:`inspection`,inspection:e});break}case`evaluate`:Tb?.evaluate(n.process,n.resource,n.code);break;case`cursor`:{let e=Tb?.nui(n.client);e!==void 0&&(e.cursor={x:n.x,y:n.y});break}case`ask`:{let{id:e,client:t,host:r,ask:i}=n,a=Tb?.nui(t);if(a===void 0){xb({type:`answer`,id:e,answer:{network:!0}});break}Xy(a,r,i).then(t=>xb({type:`answer`,id:e,answer:t}));break}}}),setInterval(n,16.666666666666668)}const jb=`/__fiverunner/api/`,Mb=`X-FiveRunner`;function Nb(e){let t=new XMLHttpRequest;return t.open(`GET`,e,!1),t.responseType=`arraybuffer`,t.setRequestHeader(Mb,`1`),t.send(),{status:t.status,body:new Uint8Array(t.response)}}const Pb=new TextDecoder;var Fb=class{#e;constructor(e){this.#e=e}list(e){return JSON.parse(Pb.decode(this.#t(`list`,e)))}read(e){return this.#t(`read`,e)}#t(e,t){let{status:n,body:r}=this.#e(`${jb}${e}?path=${encodeURIComponent(t)}`);if(n===404)return e===`list`?new TextEncoder().encode(`[]`):/* @__PURE__ */ new Uint8Array;if(n!==200)throw Error(`The dev server failed to ${e} ${t}: ${n}`);return r}};function Ib(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}function Lb(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function Rb(e){return async t=>{let n={method:t.method,url:t.url,headers:t.headers,body:Ib(t.body),followLocation:t.followLocation,timeout:t.timeout},r=JSON.parse(await e(`${jb}http`,JSON.stringify(n)));return`code`in r?r:{status:r.status,headers:r.headers,body:Lb(r.body)}}}const zb=new TextDecoder;async function Bb(e,t){return(await fetch(e,{method:`POST`,headers:{[Mb]:`1`,"Content-Type":`application/json`},body:t})).text()}Ab({cfxlua:()=>WebAssembly.compileStreaming(fetch(`${jb}cfxlua.wasm`,{headers:{[Mb]:`1`}})),project(){let e=Nb(`${jb}project`);if(e.status!==200)throw Error(zb.decode(e.body));let t=JSON.parse(zb.decode(e.body)),n=new Fb(Nb);return{info:t,files:()=>{let e=new Eo;return e.mount(t.mount,n),e}}},http:Rb(Bb)});export{zn as i,Bn as n,Rn as r,Ln as t};
|
package/dist/dev/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<title>FiveRunner</title>
|
|
7
7
|
<link rel="icon" type="image/svg+xml" href="/__fiverunner/logo.svg" />
|
|
8
|
-
<script type="module" crossorigin src="/__fiverunner/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/__fiverunner/assets/index-BUYlg8Xi.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/__fiverunner/assets/routes-DFIWFSAi.js">
|
|
10
10
|
<link rel="stylesheet" crossorigin href="/__fiverunner/assets/index-BrojKg9W.css">
|
|
11
11
|
</head>
|
package/dist/fiverunner.js
CHANGED
|
@@ -6,7 +6,7 @@ import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "nod
|
|
|
6
6
|
import { createServer } from "node:http";
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "fiverunner",
|
|
9
|
-
version: "1.2.
|
|
9
|
+
version: "1.2.2",
|
|
10
10
|
description: "Run FiveM resources (Lua, JavaScript and NUI) in your browser and in CI. No GTA V, no server, no restarts.",
|
|
11
11
|
keywords: [
|
|
12
12
|
"fivem",
|
|
@@ -98391,7 +98391,7 @@ function streamingNatives(side) {
|
|
|
98391
98391
|
hash: 12832350468514893849n,
|
|
98392
98392
|
result: "char*",
|
|
98393
98393
|
params: ["Hash modelHash"]
|
|
98394
|
-
}, () => "CARNOTFOUND"),
|
|
98394
|
+
}, (ctx, model) => model === 0 || ctx.manager.world.kindOf(model) === EntityType.ped ? "CARNOTFOUND" : (model >>> 0).toString(16).toUpperCase().padStart(8, "0")),
|
|
98395
98395
|
defineNative({
|
|
98396
98396
|
name: "SET_MODEL_AS_NO_LONGER_NEEDED",
|
|
98397
98397
|
hash: 16515533089562745515n,
|