fiverunner 1.1.1 → 1.2.1
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/README.md +33 -8
- package/dist/dev/assets/{index-CA1eFb1Z.js → index-BIEQGv2-.js} +1 -1
- package/dist/dev/assets/{module-ES6BEMUI-CrHjkS6q.js → module-ES6BEMUI-CruD6PV8.js} +1 -1
- package/dist/dev/assets/{worker-GVZYVMWW.js → worker-BfZwl0oS.js} +2 -2
- package/dist/dev/badge.svg +1 -0
- package/dist/dev/index.html +1 -1
- package/dist/fiverunner.js +2 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<
|
|
2
|
+
<a href="https://dariushq.github.io/fiverunner/"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://raw.githubusercontent.com/DariusHQ/fiverunner/main/docs/media/banner.png"><img src="docs/media/banner.gif" alt="FiveRunner, your FiveM server in a browser tab: npx fiverunner dev starts a city in a browser, where the cash of a player goes to her bank and back, her phone tells her of it, and a car leaves the garage" width="100%"></picture></a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<h1 align="center">FiveRunner</h1>
|
|
6
|
-
|
|
7
5
|
<p align="center">Run FiveM resources in your browser and in CI.<br>No GTA V, no FXServer, no restarts.</p>
|
|
8
6
|
|
|
9
7
|
<p align="center">
|
|
8
|
+
<a href="https://dariushq.github.io/fiverunner/"><img src="docs/media/playground.svg" alt="Playground: try it online"></a>
|
|
10
9
|
<a href="https://www.npmjs.com/package/fiverunner"><img src="https://img.shields.io/npm/v/fiverunner" alt="Version on npm"></a>
|
|
11
10
|
<a href="https://github.com/DariusHQ/fiverunner/actions/workflows/ci.yml"><img src="https://github.com/DariusHQ/fiverunner/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
12
11
|
<a href="https://github.com/DariusHQ/fiverunner/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/fiverunner" alt="License"></a>
|
|
@@ -14,24 +13,46 @@
|
|
|
14
13
|
|
|
15
14
|
> Where a resource behaves differently than in FiveM, [tell us](https://github.com/DariusHQ/fiverunner/issues/new/choose).
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
## Quick start
|
|
18
17
|
|
|
19
|
-
**[
|
|
18
|
+
**[Try it in your browser](https://dariushq.github.io/fiverunner/)**, with nothing to install: a small city, in Lua and JavaScript, that runs in the page. Edit its files, press Run, and walk around it. Or run [a resource of GitHub](#resources-of-github-in-your-browser) in it.
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
On your machine, with Node 22 or later, in the folder of a resource or of a server, the one with `server.cfg` and `resources`:
|
|
22
21
|
|
|
23
22
|
```bash
|
|
24
|
-
npx fiverunner test
|
|
25
23
|
npx fiverunner dev
|
|
26
24
|
```
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
Open the address that it prints, connect a player, and click through your NUI, as your files change. A script that needs a framework runs in the folder of its server, next to the framework. To test it on every push, add a test and a GitHub workflow, then run it:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx fiverunner init
|
|
30
|
+
npx fiverunner test
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**[Watch the demo](https://github.com/DariusHQ/fiverunner/releases/download/v0.9.0/fiverunner.mp4)** (122 seconds, with sound): the whole Stable recipe of Qbox for txAdmin, tested, then in the dev UI, where a player registers a character, dresses her in illenium-appearance, opens ox_inventory and the bank of Renewed-Banking, and is dragged across the map to a garage, where she takes her car out.
|
|
34
|
+
|
|
35
|
+

|
|
29
36
|
|
|
30
37
|
- **Real resources, as they are released.** The 43 resources of the Stable recipe of Qbox start on your machine in seconds: its core, its inventory, its garages, its bank, and its phone, which is JavaScript.
|
|
31
38
|
- **Real NUIs.** Your pages run in a browser, and talk to your callbacks as they do in FiveM: the appearance editor, the inventory, the bank and the phone of the recipe work as players use them.
|
|
32
39
|
- **Tests in CI.** Each test gets a server of its own, players, and a database in memory, and time moves as fast as it can.
|
|
33
40
|
- **A world to look at.** Under the frames of NUI, the screen of each player shows the world round their ped, as a cartoon or in the style of GTA V, and the cartoon dresses them as your scripts do.
|
|
34
41
|
|
|
42
|
+
## Resources of GitHub, in your browser
|
|
43
|
+
|
|
44
|
+
The playground runs the resources and servers of GitHub too, which `?gh=` and the name of a repository after its address name, such as [overextended/ox_target](https://dariushq.github.io/fiverunner/?gh=overextended/ox_target), [qbcore-fivem/qb-core](https://dariushq.github.io/fiverunner/?gh=qbcore-fivem/qb-core) or [Qbox-project/qbx_core](https://dariushq.github.io/fiverunner/?gh=Qbox-project/qbx_core), with `@` and a branch or a tag after the name, and the directory of a resource after a slash. It reads them from GitHub with the resources that they need, as far as it knows where those are: ox_lib, ox_target and ox_inventory, qb-core, qb-target, qb-weapons, qb-menu and qb-input, qbx_core and qbx_vehicles, es_extended and the tables of ESX, and PolyZone. Scripts that use the exports of a framework or of a target, without their manifests naming it, get it too, and ox_inventory gets Qbox when nothing brings a framework. A link brings others with `&with=owner/repo`.
|
|
45
|
+
|
|
46
|
+
Put its button in the README of your resource, and people run it with a click:
|
|
47
|
+
|
|
48
|
+
[](https://dariushq.github.io/fiverunner/?gh=overextended/ox_target)
|
|
49
|
+
|
|
50
|
+
```markdown
|
|
51
|
+
[](https://dariushq.github.io/fiverunner/?gh=owner/repo)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The playground gives the Markdown of the button of each repository that it runs. [docs/differences.md](docs/differences.md#the-playground) tells what it leaves out.
|
|
55
|
+
|
|
35
56
|
## Testing resources
|
|
36
57
|
|
|
37
58
|
Start with a test that your resource or server starts without script errors, and a GitHub workflow that runs it on each push:
|
|
@@ -120,6 +141,10 @@ FiveRunner's scripting runtime is a clean-room implementation and contains no co
|
|
|
120
141
|
|
|
121
142
|
Resources that behave differently than in FiveM help most. [CONTRIBUTING.md](CONTRIBUTING.md) tells how to report them, how to run FiveRunner from its source, and the rules of its clean room. [CHANGELOG.md](CHANGELOG.md) tells what each version brought.
|
|
122
143
|
|
|
144
|
+
## Spread the word
|
|
145
|
+
|
|
146
|
+
If FiveRunner saves you a restart, star it on GitHub: the stars of a project are how other FiveM developers find it.
|
|
147
|
+
|
|
123
148
|
## License
|
|
124
149
|
|
|
125
150
|
[MIT](LICENSE)
|
|
@@ -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?{}:{files: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-GVZYVMWW.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-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 +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-BfZwl0oS.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-CrHjkS6q.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-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=`/*
|
|
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
|
|
@@ -5000,4 +5000,4 @@ provide 'ghmattimysql'
|
|
|
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
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
|
|
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
|
-
`);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;constructor(e,t){this.#e=e,this.#t=t}static async start(t){let n=new Zy(e=>t.onEvent({type:`output`,line:e})),r=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,...t.sqlite===void 0?{}:{database:Km(t.sqlite)}}}),i=new e(r,t);return r.server.events.onTrigger.connect((e,t,n)=>{let r=/^net:(\d+)$/.exec(n)?.[1],a=r===void 0?void 0:i.#l(Number(r));a!==void 0&&i.#u({from:a,to:`server`,name:e,args:lb(t)})}),i.#d(()=>{let{server:e}=r;e.scanResources();for(let n of t.project.commands)e.security.runAs(`system.console`,()=>e.console.commands.invoke(n,``));e.endInitialConfiguration()}),i.#s(),i}get crash(){return this.#a}advance(e){this.#a===void 0&&(this.#d(()=>this.#e.advance(e)),this.#s())}command(e){if(this.#a!==void 0)return;let{server:t}=this.#e;this.#d(()=>{t.security.runAs(`system.console`,()=>t.console.commands.invoke(e,``))}),this.#s()}restartChanged(e){if(this.#a!==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={}){let{now:t}=this.#e.clock;t<yb&&this.advance(yb-t);let n=this.#t.watchdog??vb,r=e.identifiers??[Ig(e.name)],{client:i,player:a}=await this.#e.connect({...e,identifiers:r},{watchdog:n});this.#n.push({manager:i,player:a});let o=this.#n.length;i.events.onTrigger.connect((e,t,n)=>{n.startsWith(`net:`)&&this.#u({from:`server`,to:o,name:e,args:lb(t)})});let s=e=>this.#t.onEvent({type:`nui`,client:o,event:e}),c=i.nui;return c.onCreate.connect(e=>s({type:`create`,frame:e})),c.onDestroy.connect(e=>s({type:`destroy`,resource:e})),c.onMessage.connect((e,t)=>s({type:`message`,resource:e,json:t})),c.onFrameFocus.connect((e,t)=>{s({type:`frameFocus`,resource:e,focused:t})}),c.onFocus.connect((e,t)=>s({type:`focus`,focus:e,cursor:t})),c.onKeepInput.connect(e=>s({type:`keepInput`,keepInput:e})),c.onZIndex.connect((e,t)=>s({type:`zIndex`,resource:e,zIndex:t})),this.#s(),o}disconnect(e,t=`Exiting`){let n=this.#n[e-1];n!==void 0&&this.#a===void 0&&(this.#d(()=>n.player.quit(t)),this.#s())}submitCard(e,t){let n=this.#n[e-1];n!==void 0&&this.#a===void 0&&(this.#d(()=>n.player.submitCard(t)),this.#s())}emit(e,t,n){if(this.#a!==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.#a!==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.#s()}waypoint(e,t,n){let r=this.#n[e-1]?.manager.world;r!==void 0&&this.#a===void 0&&(r.blips.setWaypoint(Math.fround(t),Math.fround(n)),this.#s())}key(e,t,n){let r=this.#n[e-1]?.manager,i=r?.world?.input;if(r===void 0||i===void 0||this.#a!==void 0)return;let a=n?i.keyDown(t):i.keyUp(t);this.#d(()=>{for(let e of a)r.console.commands.invoke(e,``)}),this.#s()}inspect(e){let t=this.#o(e);return t===void 0?void 0:fb(t,e)}evaluate(e,t,n){let r=this.#o(e)?.getResource(t),i=r?.runtimes[0];r!==void 0&&i!==void 0&&this.#a===void 0&&(this.#d(()=>r.enter(()=>i.evaluate(n),i)),this.#s())}nui(e){return this.#n[e-1]?.manager.nui}#o(e){return e===`server`?this.#e.server:this.#n[e-1]?.manager}#s(){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.#c(e.get(t))}))})),map:_b(this.#e.server,this.#n.map(({manager:e})=>e),e=>this.#l(e))},n=JSON.stringify(t);n!==this.#r&&(this.#r=n,this.#t.onEvent({type:`state`,state:t}))}#c(e){let t=this.#i.get(e);return t===void 0&&(t=cb(e),this.#i.set(e,t)),t}#l(e){let t=this.#n.findIndex(({player:t})=>t.netId===e);return t===-1?void 0:t+1}#u(e){this.#t.onEvent({type:`net`,event:e})}#d(e){try{e()}catch(e){if(!(e instanceof pe))throw e;this.#a=`A runtime crashed, which stopped the session: ${e.message}`,this.#t.onEvent({type:`crash`,message:this.#a})}}};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.files);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};
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="131" height="20" role="img" aria-label="run in: FiveRunner"><title>run in: FiveRunner</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="131" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="59" height="20" fill="#555"/><rect x="59" width="72" height="20" fill="#f0781e"/><rect width="131" height="20" fill="url(#s)"/></g><svg x="5" y="3" width="14" height="14" viewBox="0 0 100 100"><defs><linearGradient id="face" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#ffc15c"/><stop offset="1" stop-color="#f0781e"/></linearGradient></defs><rect width="100" height="100" rx="24" fill="url(#face)"/><path d="M22 22 51 50 22 78 33 50z" fill="#fff" fill-opacity=".6"/><path d="M50 22 79 50 50 78 61 50z" fill="#fff"/></svg><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="380" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="320">run in</text><text x="380" y="140" transform="scale(.1)" fill="#fff" textLength="320">run in</text><text aria-hidden="true" x="950" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="620">FiveRunner</text><text x="950" y="140" transform="scale(.1)" fill="#fff" textLength="620">FiveRunner</text></g></svg>
|
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-BIEQGv2-.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.
|
|
9
|
+
version: "1.2.1",
|
|
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",
|
|
@@ -102461,10 +102461,7 @@ jobs:
|
|
|
102461
102461
|
runs-on: ubuntu-latest
|
|
102462
102462
|
steps:
|
|
102463
102463
|
- uses: actions/checkout@v7
|
|
102464
|
-
- uses:
|
|
102465
|
-
with:
|
|
102466
|
-
node-version: 24
|
|
102467
|
-
- run: npx fiverunner test
|
|
102464
|
+
- uses: DariusHQ/fiverunner-action@v1
|
|
102468
102465
|
`;
|
|
102469
102466
|
/** Where the types of tests go, which the settings of the Lua language server name. */
|
|
102470
102467
|
var TYPES = ".fiverunner/fiverunner.lua";
|