@rpgjs/client 5.0.0-alpha.43 → 5.0.0-alpha.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Game/AnimationManager.js +25 -24
- package/dist/Game/AnimationManager.js.map +1 -1
- package/dist/Game/Event.js +11 -10
- package/dist/Game/Event.js.map +1 -1
- package/dist/Game/Map.js +78 -94
- package/dist/Game/Map.js.map +1 -1
- package/dist/Game/Object.js +182 -216
- package/dist/Game/Object.js.map +1 -1
- package/dist/Game/Player.js +11 -10
- package/dist/Game/Player.js.map +1 -1
- package/dist/Gui/Gui.js +440 -473
- package/dist/Gui/Gui.js.map +1 -1
- package/dist/Gui/NotificationManager.js +48 -50
- package/dist/Gui/NotificationManager.js.map +1 -1
- package/dist/Resource.js +132 -113
- package/dist/Resource.js.map +1 -1
- package/dist/RpgClientEngine.js +1333 -1486
- package/dist/RpgClientEngine.js.map +1 -1
- package/dist/Sound.js +162 -92
- package/dist/Sound.js.map +1 -1
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/decorate.js +9 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/decorateMetadata.js +6 -0
- package/dist/components/animations/animation.ce.js +22 -19
- package/dist/components/animations/animation.ce.js.map +1 -1
- package/dist/components/animations/hit.ce.js +67 -68
- package/dist/components/animations/hit.ce.js.map +1 -1
- package/dist/components/animations/index.js +9 -8
- package/dist/components/animations/index.js.map +1 -1
- package/dist/components/character.ce.js +390 -314
- package/dist/components/character.ce.js.map +1 -1
- package/dist/components/dynamics/parse-value.js +42 -52
- package/dist/components/dynamics/parse-value.js.map +1 -1
- package/dist/components/dynamics/text.ce.js +71 -139
- package/dist/components/dynamics/text.ce.js.map +1 -1
- package/dist/components/gui/box.ce.js +26 -25
- package/dist/components/gui/box.ce.js.map +1 -1
- package/dist/components/gui/dialogbox/index.ce.js +202 -149
- package/dist/components/gui/dialogbox/index.ce.js.map +1 -1
- package/dist/components/gui/gameover.ce.js +190 -138
- package/dist/components/gui/gameover.ce.js.map +1 -1
- package/dist/components/gui/hud/hud.ce.js +90 -33
- package/dist/components/gui/hud/hud.ce.js.map +1 -1
- package/dist/components/gui/index.js +14 -0
- package/dist/components/gui/menu/equip-menu.ce.js +478 -346
- package/dist/components/gui/menu/equip-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/exit-menu.ce.js +52 -33
- package/dist/components/gui/menu/exit-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/items-menu.ce.js +341 -226
- package/dist/components/gui/menu/items-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/main-menu.ce.js +414 -205
- package/dist/components/gui/menu/main-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/options-menu.ce.js +46 -26
- package/dist/components/gui/menu/options-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/skills-menu.ce.js +104 -50
- package/dist/components/gui/menu/skills-menu.ce.js.map +1 -1
- package/dist/components/gui/mobile/index.js +18 -21
- package/dist/components/gui/mobile/index.js.map +1 -1
- package/dist/components/gui/mobile/mobile.ce.js +76 -15
- package/dist/components/gui/mobile/mobile.ce.js.map +1 -1
- package/dist/components/gui/notification/notification.ce.js +62 -36
- package/dist/components/gui/notification/notification.ce.js.map +1 -1
- package/dist/components/gui/save-load.ce.js +386 -239
- package/dist/components/gui/save-load.ce.js.map +1 -1
- package/dist/components/gui/shop/shop.ce.js +649 -319
- package/dist/components/gui/shop/shop.ce.js.map +1 -1
- package/dist/components/gui/title-screen.ce.js +187 -145
- package/dist/components/gui/title-screen.ce.js.map +1 -1
- package/dist/components/index.js +4 -0
- package/dist/components/prebuilt/hp-bar.ce.js +114 -104
- package/dist/components/prebuilt/hp-bar.ce.js.map +1 -1
- package/dist/components/prebuilt/index.js +2 -0
- package/dist/components/prebuilt/light-halo.ce.js +92 -74
- package/dist/components/prebuilt/light-halo.ce.js.map +1 -1
- package/dist/components/scenes/canvas.ce.js +58 -42
- package/dist/components/scenes/canvas.ce.js.map +1 -1
- package/dist/components/scenes/draw-map.ce.js +87 -64
- package/dist/components/scenes/draw-map.ce.js.map +1 -1
- package/dist/components/scenes/event-layer.ce.js +26 -16
- package/dist/components/scenes/event-layer.ce.js.map +1 -1
- package/dist/core/inject.js +11 -10
- package/dist/core/inject.js.map +1 -1
- package/dist/core/setup.js +13 -13
- package/dist/core/setup.js.map +1 -1
- package/dist/index.js +44 -41
- package/dist/module.js +169 -168
- package/dist/module.js.map +1 -1
- package/dist/node_modules/.pnpm/@signe_di@2.8.3/node_modules/@signe/di/dist/index.js +209 -298
- package/dist/node_modules/.pnpm/@signe_di@2.8.3/node_modules/@signe/di/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@signe_reactive@2.8.3/node_modules/@signe/reactive/dist/index.js +430 -507
- package/dist/node_modules/.pnpm/@signe_reactive@2.8.3/node_modules/@signe/reactive/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@signe_room@2.8.3/node_modules/@signe/room/dist/index.js +2062 -2571
- package/dist/node_modules/.pnpm/@signe_room@2.8.3/node_modules/@signe/room/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@signe_sync@2.8.3/node_modules/@signe/sync/dist/chunk-7QVYU63E.js +8 -3
- package/dist/node_modules/.pnpm/@signe_sync@2.8.3/node_modules/@signe/sync/dist/chunk-7QVYU63E.js.map +1 -1
- package/dist/node_modules/.pnpm/@signe_sync@2.8.3/node_modules/@signe/sync/dist/client/index.js +78 -101
- package/dist/node_modules/.pnpm/@signe_sync@2.8.3/node_modules/@signe/sync/dist/client/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@signe_sync@2.8.3/node_modules/@signe/sync/dist/index.js +264 -401
- package/dist/node_modules/.pnpm/@signe_sync@2.8.3/node_modules/@signe/sync/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/dset@3.1.4/node_modules/dset/dist/index.js +9 -7
- package/dist/node_modules/.pnpm/dset@3.1.4/node_modules/dset/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js +106 -165
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js.map +1 -1
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js +361 -461
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js.map +1 -1
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/index.js +2 -0
- package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js +3633 -4280
- package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js.map +1 -1
- package/dist/presets/animation.js +37 -25
- package/dist/presets/animation.js.map +1 -1
- package/dist/presets/faceset.js +49 -22
- package/dist/presets/faceset.js.map +1 -1
- package/dist/presets/icon.js +13 -13
- package/dist/presets/icon.js.map +1 -1
- package/dist/presets/index.js +15 -14
- package/dist/presets/index.js.map +1 -1
- package/dist/presets/lpc.js +96 -93
- package/dist/presets/lpc.js.map +1 -1
- package/dist/presets/rmspritesheet.js +40 -39
- package/dist/presets/rmspritesheet.js.map +1 -1
- package/dist/services/AbstractSocket.js +10 -8
- package/dist/services/AbstractSocket.js.map +1 -1
- package/dist/services/keyboardControls.js +20 -18
- package/dist/services/keyboardControls.js.map +1 -1
- package/dist/services/loadMap.js +120 -36
- package/dist/services/loadMap.js.map +1 -1
- package/dist/services/mmorpg.js +128 -136
- package/dist/services/mmorpg.js.map +1 -1
- package/dist/services/save.js +74 -66
- package/dist/services/save.js.map +1 -1
- package/dist/services/standalone.js +165 -167
- package/dist/services/standalone.js.map +1 -1
- package/dist/utils/getEntityProp.js +49 -51
- package/dist/utils/getEntityProp.js.map +1 -1
- package/package.json +8 -8
- package/src/components/character.ce +1 -1
- package/src/components/scenes/draw-map.ce +3 -1
- package/dist/index.js.map +0 -1
package/dist/services/save.js
CHANGED
|
@@ -1,69 +1,77 @@
|
|
|
1
|
-
import { inject } from
|
|
2
|
-
import { WebSocketToken } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
1
|
+
import { inject } from "../core/inject.js";
|
|
2
|
+
import { WebSocketToken } from "./AbstractSocket.js";
|
|
3
|
+
//#region src/services/save.ts
|
|
4
|
+
var SaveClientToken = "SaveClientToken";
|
|
5
|
+
var SaveClientService = class {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.webSocket = inject(WebSocketToken);
|
|
8
|
+
this.pending = /* @__PURE__ */ new Map();
|
|
9
|
+
this.requestCounter = 0;
|
|
10
|
+
}
|
|
11
|
+
initialize() {
|
|
12
|
+
const saveListResult = (data) => this.resolveRequest(data.requestId, data);
|
|
13
|
+
const saveSaveResult = (data) => this.resolveRequest(data.requestId, data);
|
|
14
|
+
const saveLoadResult = (data) => this.resolveRequest(data.requestId, data);
|
|
15
|
+
const saveErrorResult = (data) => this.rejectRequest(data.requestId, data.message);
|
|
16
|
+
this.webSocket.off("save.list.result", saveListResult);
|
|
17
|
+
this.webSocket.off("save.save.result", saveSaveResult);
|
|
18
|
+
this.webSocket.off("save.load.result", saveLoadResult);
|
|
19
|
+
this.webSocket.off("save.error", saveErrorResult);
|
|
20
|
+
this.webSocket.on("save.list.result", saveListResult);
|
|
21
|
+
this.webSocket.on("save.save.result", saveSaveResult);
|
|
22
|
+
this.webSocket.on("save.load.result", saveLoadResult);
|
|
23
|
+
this.webSocket.on("save.error", saveErrorResult);
|
|
24
|
+
}
|
|
25
|
+
listSlots() {
|
|
26
|
+
return this.request("save.list", {}).then((result) => result.slots);
|
|
27
|
+
}
|
|
28
|
+
saveSlot(index, meta = {}) {
|
|
29
|
+
return this.request("save.save", {
|
|
30
|
+
index,
|
|
31
|
+
meta
|
|
32
|
+
}).then((result) => result.slots);
|
|
33
|
+
}
|
|
34
|
+
loadSlot(index) {
|
|
35
|
+
return this.request("save.load", { index }).then((result) => result.ok);
|
|
36
|
+
}
|
|
37
|
+
request(event, payload) {
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
if (!this.webSocket) this.initialize();
|
|
40
|
+
const requestId = this.nextRequestId();
|
|
41
|
+
this.pending.set(requestId, {
|
|
42
|
+
resolve,
|
|
43
|
+
reject
|
|
44
|
+
});
|
|
45
|
+
this.webSocket?.emit(event, {
|
|
46
|
+
requestId,
|
|
47
|
+
...payload
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
resolveRequest(requestId, result) {
|
|
52
|
+
const pending = this.pending.get(requestId);
|
|
53
|
+
if (!pending) return;
|
|
54
|
+
this.pending.delete(requestId);
|
|
55
|
+
pending.resolve(result);
|
|
56
|
+
}
|
|
57
|
+
rejectRequest(requestId, message) {
|
|
58
|
+
const pending = this.pending.get(requestId);
|
|
59
|
+
if (!pending) return;
|
|
60
|
+
this.pending.delete(requestId);
|
|
61
|
+
pending.reject(new Error(message));
|
|
62
|
+
}
|
|
63
|
+
nextRequestId() {
|
|
64
|
+
this.requestCounter += 1;
|
|
65
|
+
return `${Date.now()}-${this.requestCounter}`;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
61
68
|
function provideSaveClient() {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
69
|
+
return {
|
|
70
|
+
provide: SaveClientService,
|
|
71
|
+
useClass: SaveClientService
|
|
72
|
+
};
|
|
66
73
|
}
|
|
67
|
-
|
|
74
|
+
//#endregion
|
|
68
75
|
export { SaveClientService, SaveClientToken, provideSaveClient };
|
|
69
|
-
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=save.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"save.js","sources":["../../src/services/save.ts"],"sourcesContent":["import type { SaveSlotList, SaveSlotMeta } from \"@rpgjs/common\";\nimport { inject } from \"../core/inject\";\nimport { AbstractWebsocket, WebSocketToken } from \"./AbstractSocket\";\n\nexport const SaveClientToken = \"SaveClientToken\";\n\ntype SaveListResult = {\n requestId: string;\n slots: SaveSlotList;\n};\n\ntype SaveSaveResult = {\n requestId: string;\n index: number;\n slots: SaveSlotList;\n};\n\ntype SaveLoadResult = {\n requestId: string;\n index: number;\n ok: boolean;\n slot?: SaveSlotMeta;\n};\n\ntype SaveErrorResult = {\n requestId: string;\n message: string;\n};\n\ntype PendingRequest = {\n resolve: (value: any) => void;\n reject: (error: Error) => void;\n};\n\nexport class SaveClientService {\n private webSocket: AbstractWebsocket = inject(WebSocketToken);\n private pending: Map<string, PendingRequest> = new Map();\n private requestCounter = 0;\n\n initialize() {\n const saveListResult = (data: SaveListResult) => this.resolveRequest(data.requestId, data);\n const saveSaveResult = (data: SaveSaveResult) => this.resolveRequest(data.requestId, data);\n const saveLoadResult = (data: SaveLoadResult) => this.resolveRequest(data.requestId, data);\n const saveErrorResult = (data: SaveErrorResult) => this.rejectRequest(data.requestId, data.message);\n this.webSocket.off(\"save.list.result\", saveListResult);\n this.webSocket.off(\"save.save.result\", saveSaveResult);\n this.webSocket.off(\"save.load.result\", saveLoadResult);\n this.webSocket.off(\"save.error\", saveErrorResult);\n this.webSocket.on(\"save.list.result\", saveListResult);\n this.webSocket.on(\"save.save.result\", saveSaveResult);\n this.webSocket.on(\"save.load.result\", saveLoadResult);\n this.webSocket.on(\"save.error\", saveErrorResult);\n }\n\n listSlots(): Promise<SaveSlotList> {\n return this.request<SaveListResult>(\"save.list\", {}).then((result) => result.slots);\n }\n\n saveSlot(index: number, meta: SaveSlotMeta = {}): Promise<SaveSlotList> {\n return this.request<SaveSaveResult>(\"save.save\", { index, meta }).then((result) => result.slots);\n }\n\n loadSlot(index: number): Promise<boolean> {\n return this.request<SaveLoadResult>(\"save.load\", { index }).then((result) => result.ok);\n }\n\n private request<T>(event: string, payload: Record<string, any>): Promise<T> {\n return new Promise((resolve, reject) => {\n if (!this.webSocket) {\n this.initialize();\n }\n const requestId = this.nextRequestId();\n this.pending.set(requestId, { resolve, reject });\n this.webSocket?.emit(event, { requestId, ...payload });\n });\n }\n\n private resolveRequest(requestId: string, result: any) {\n const pending = this.pending.get(requestId);\n if (!pending) return;\n this.pending.delete(requestId);\n pending.resolve(result);\n }\n\n private rejectRequest(requestId: string, message: string) {\n const pending = this.pending.get(requestId);\n if (!pending) return;\n this.pending.delete(requestId);\n pending.reject(new Error(message));\n }\n\n private nextRequestId(): string {\n this.requestCounter += 1;\n return `${Date.now()}-${this.requestCounter}`;\n }\n}\n\nexport function provideSaveClient() {\n return {\n provide: SaveClientService,\n useClass: SaveClientService,\n };\n}\n"],"
|
|
1
|
+
{"version":3,"file":"save.js","names":[],"sources":["../../src/services/save.ts"],"sourcesContent":["import type { SaveSlotList, SaveSlotMeta } from \"@rpgjs/common\";\nimport { inject } from \"../core/inject\";\nimport { AbstractWebsocket, WebSocketToken } from \"./AbstractSocket\";\n\nexport const SaveClientToken = \"SaveClientToken\";\n\ntype SaveListResult = {\n requestId: string;\n slots: SaveSlotList;\n};\n\ntype SaveSaveResult = {\n requestId: string;\n index: number;\n slots: SaveSlotList;\n};\n\ntype SaveLoadResult = {\n requestId: string;\n index: number;\n ok: boolean;\n slot?: SaveSlotMeta;\n};\n\ntype SaveErrorResult = {\n requestId: string;\n message: string;\n};\n\ntype PendingRequest = {\n resolve: (value: any) => void;\n reject: (error: Error) => void;\n};\n\nexport class SaveClientService {\n private webSocket: AbstractWebsocket = inject(WebSocketToken);\n private pending: Map<string, PendingRequest> = new Map();\n private requestCounter = 0;\n\n initialize() {\n const saveListResult = (data: SaveListResult) => this.resolveRequest(data.requestId, data);\n const saveSaveResult = (data: SaveSaveResult) => this.resolveRequest(data.requestId, data);\n const saveLoadResult = (data: SaveLoadResult) => this.resolveRequest(data.requestId, data);\n const saveErrorResult = (data: SaveErrorResult) => this.rejectRequest(data.requestId, data.message);\n this.webSocket.off(\"save.list.result\", saveListResult);\n this.webSocket.off(\"save.save.result\", saveSaveResult);\n this.webSocket.off(\"save.load.result\", saveLoadResult);\n this.webSocket.off(\"save.error\", saveErrorResult);\n this.webSocket.on(\"save.list.result\", saveListResult);\n this.webSocket.on(\"save.save.result\", saveSaveResult);\n this.webSocket.on(\"save.load.result\", saveLoadResult);\n this.webSocket.on(\"save.error\", saveErrorResult);\n }\n\n listSlots(): Promise<SaveSlotList> {\n return this.request<SaveListResult>(\"save.list\", {}).then((result) => result.slots);\n }\n\n saveSlot(index: number, meta: SaveSlotMeta = {}): Promise<SaveSlotList> {\n return this.request<SaveSaveResult>(\"save.save\", { index, meta }).then((result) => result.slots);\n }\n\n loadSlot(index: number): Promise<boolean> {\n return this.request<SaveLoadResult>(\"save.load\", { index }).then((result) => result.ok);\n }\n\n private request<T>(event: string, payload: Record<string, any>): Promise<T> {\n return new Promise((resolve, reject) => {\n if (!this.webSocket) {\n this.initialize();\n }\n const requestId = this.nextRequestId();\n this.pending.set(requestId, { resolve, reject });\n this.webSocket?.emit(event, { requestId, ...payload });\n });\n }\n\n private resolveRequest(requestId: string, result: any) {\n const pending = this.pending.get(requestId);\n if (!pending) return;\n this.pending.delete(requestId);\n pending.resolve(result);\n }\n\n private rejectRequest(requestId: string, message: string) {\n const pending = this.pending.get(requestId);\n if (!pending) return;\n this.pending.delete(requestId);\n pending.reject(new Error(message));\n }\n\n private nextRequestId(): string {\n this.requestCounter += 1;\n return `${Date.now()}-${this.requestCounter}`;\n }\n}\n\nexport function provideSaveClient() {\n return {\n provide: SaveClientService,\n useClass: SaveClientService,\n };\n}\n"],"mappings":";;;AAIA,IAAa,kBAAkB;AA8B/B,IAAa,oBAAb,MAA+B;;mBACU,OAAO,eAAe;iCACd,IAAI,KAAK;wBAC/B;;CAEzB,aAAa;EACX,MAAM,kBAAkB,SAAyB,KAAK,eAAe,KAAK,WAAW,KAAK;EAC1F,MAAM,kBAAkB,SAAyB,KAAK,eAAe,KAAK,WAAW,KAAK;EAC1F,MAAM,kBAAkB,SAAyB,KAAK,eAAe,KAAK,WAAW,KAAK;EAC1F,MAAM,mBAAmB,SAA0B,KAAK,cAAc,KAAK,WAAW,KAAK,QAAQ;AACnG,OAAK,UAAU,IAAI,oBAAoB,eAAe;AACtD,OAAK,UAAU,IAAI,oBAAoB,eAAe;AACtD,OAAK,UAAU,IAAI,oBAAoB,eAAe;AACtD,OAAK,UAAU,IAAI,cAAc,gBAAgB;AACjD,OAAK,UAAU,GAAG,oBAAoB,eAAe;AACrD,OAAK,UAAU,GAAG,oBAAoB,eAAe;AACrD,OAAK,UAAU,GAAG,oBAAoB,eAAe;AACrD,OAAK,UAAU,GAAG,cAAc,gBAAgB;;CAGlD,YAAmC;AACjC,SAAO,KAAK,QAAwB,aAAa,EAAE,CAAC,CAAC,MAAM,WAAW,OAAO,MAAM;;CAGrF,SAAS,OAAe,OAAqB,EAAE,EAAyB;AACtE,SAAO,KAAK,QAAwB,aAAa;GAAE;GAAO;GAAM,CAAC,CAAC,MAAM,WAAW,OAAO,MAAM;;CAGlG,SAAS,OAA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
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
await this.server.onRequest(req);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
1
|
+
import { AbstractWebsocket, WebSocketToken } from "./AbstractSocket.js";
|
|
2
|
+
import { provideSaveClient } from "./save.js";
|
|
3
|
+
import { RpgGui } from "../Gui/Gui.js";
|
|
4
|
+
import { RpgClientEngine } from "../RpgClientEngine.js";
|
|
5
|
+
import { ClientIo, ServerIo } from "../node_modules/.pnpm/@signe_room@2.8.3/node_modules/@signe/room/dist/index.js";
|
|
6
|
+
import { provideKeyboardControls } from "./keyboardControls.js";
|
|
7
|
+
import { UpdateMapService, UpdateMapToken } from "@rpgjs/common";
|
|
8
|
+
//#region src/services/standalone.ts
|
|
9
|
+
var BridgeWebsocket = class extends AbstractWebsocket {
|
|
10
|
+
constructor(context, server, options = {}) {
|
|
11
|
+
super(context);
|
|
12
|
+
this.context = context;
|
|
13
|
+
this.server = server;
|
|
14
|
+
this.pendingOn = [];
|
|
15
|
+
this.rooms = {
|
|
16
|
+
partyFn: async (roomId) => {
|
|
17
|
+
this.room = new ServerIo(roomId, this.rooms);
|
|
18
|
+
const server = new this.server(this.room);
|
|
19
|
+
await server.onStart();
|
|
20
|
+
await server.subRoom.onStart();
|
|
21
|
+
this.context.set("server", server);
|
|
22
|
+
return server;
|
|
23
|
+
},
|
|
24
|
+
env: {}
|
|
25
|
+
};
|
|
26
|
+
this.rooms.env = options.env || {};
|
|
27
|
+
this.room = new ServerIo("lobby-1", this.rooms);
|
|
28
|
+
}
|
|
29
|
+
async connection(listeners) {
|
|
30
|
+
this.serverInstance = new this.server(this.room);
|
|
31
|
+
await this.serverInstance.onStart();
|
|
32
|
+
await this.serverInstance.subRoom.onStart();
|
|
33
|
+
this.context.set("server", this.serverInstance);
|
|
34
|
+
return this._connection(listeners);
|
|
35
|
+
}
|
|
36
|
+
async _connection(listeners) {
|
|
37
|
+
this.serverInstance = this.context.get("server");
|
|
38
|
+
this.socket = new ClientIo(this.serverInstance, "player-client-id");
|
|
39
|
+
const url = new URL("http://localhost");
|
|
40
|
+
const request = new Request(url.toString(), {
|
|
41
|
+
method: "GET",
|
|
42
|
+
headers: { "Content-Type": "application/json" }
|
|
43
|
+
});
|
|
44
|
+
listeners?.(this.socket);
|
|
45
|
+
await this.serverInstance.onConnect(this.socket.conn, { request });
|
|
46
|
+
this.room.clients.set(this.socket.id, this.socket);
|
|
47
|
+
this.pendingOn.forEach(({ event, callback }) => this.socket.addEventListener(event, callback));
|
|
48
|
+
this.pendingOn = [];
|
|
49
|
+
return this.socket;
|
|
50
|
+
}
|
|
51
|
+
on(key, callback) {
|
|
52
|
+
const handler = (event) => {
|
|
53
|
+
const object = JSON.parse(event);
|
|
54
|
+
if (object.type === key) callback(object.value);
|
|
55
|
+
};
|
|
56
|
+
if (!this.socket) {
|
|
57
|
+
this.pendingOn.push({
|
|
58
|
+
event: "message",
|
|
59
|
+
callback: handler
|
|
60
|
+
});
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
this.socket.addEventListener("message", handler);
|
|
64
|
+
}
|
|
65
|
+
off(event, callback) {
|
|
66
|
+
if (!this.socket) return;
|
|
67
|
+
this.socket.removeEventListener(event, callback);
|
|
68
|
+
}
|
|
69
|
+
emit(event, data) {
|
|
70
|
+
this.socket.send({
|
|
71
|
+
action: event,
|
|
72
|
+
value: data
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Update underlying connection properties before a reconnect
|
|
77
|
+
*
|
|
78
|
+
* Design
|
|
79
|
+
* - Dynamically register a factory for the requested room to ensure a fresh server instance
|
|
80
|
+
* - Swap the internal ServerIo to target the new room
|
|
81
|
+
*
|
|
82
|
+
* @param params - Properties to update
|
|
83
|
+
* @param params.room - The target room id (e.g. `map-simplemap2`)
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* websocket.updateProperties({ room: 'map-simplemap2' })
|
|
88
|
+
* await websocket.reconnect()
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
updateProperties(_params) {}
|
|
92
|
+
/**
|
|
93
|
+
* Reconnect the client to the current Party room
|
|
94
|
+
*
|
|
95
|
+
* Design
|
|
96
|
+
* - Must be called after `updateProperties()` when switching rooms
|
|
97
|
+
* - Rebuilds the client <-> server bridge and re-triggers connection listeners
|
|
98
|
+
*
|
|
99
|
+
* @param listeners - Optional callback to re-bind event handlers on the new socket
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* websocket.updateProperties({ room: 'map-dungeon' })
|
|
104
|
+
* await websocket.reconnect((socket) => {
|
|
105
|
+
* // re-bind events here
|
|
106
|
+
* })
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
async reconnect(listeners) {
|
|
110
|
+
await this._connection((socket) => {
|
|
111
|
+
listeners?.(socket);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
getServer() {
|
|
115
|
+
return this.serverInstance;
|
|
116
|
+
}
|
|
117
|
+
getSocket() {
|
|
118
|
+
return this.socket;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
var UpdateMapStandaloneService = class extends UpdateMapService {
|
|
122
|
+
/**
|
|
123
|
+
* Update the current room map data on the server side
|
|
124
|
+
*
|
|
125
|
+
* Design
|
|
126
|
+
* - Uses the in-memory server instance stored in context (standalone mode)
|
|
127
|
+
* - Builds a local HTTP-like request to the current Party room endpoint
|
|
128
|
+
*
|
|
129
|
+
* @param map - The map payload to apply on the server
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```ts
|
|
133
|
+
* await updateMapService.update({ width: 1024, height: 768, events: [] })
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
async update(map) {
|
|
137
|
+
this.server = this.context.get("server");
|
|
138
|
+
const req = {
|
|
139
|
+
url: `http://localhost/parties/main/${this.server?.room?.id ?? "lobby-1"}/map/update`,
|
|
140
|
+
method: "POST",
|
|
141
|
+
headers: new Headers({}),
|
|
142
|
+
json: async () => {
|
|
143
|
+
return map;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
await this.server.onRequest(req);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
152
149
|
function provideRpg(server, options = {}) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
150
|
+
return [
|
|
151
|
+
{
|
|
152
|
+
provide: WebSocketToken,
|
|
153
|
+
useFactory: (context) => new BridgeWebsocket(context, server, options)
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
provide: UpdateMapToken,
|
|
157
|
+
useClass: UpdateMapStandaloneService
|
|
158
|
+
},
|
|
159
|
+
provideKeyboardControls(),
|
|
160
|
+
provideSaveClient(),
|
|
161
|
+
RpgGui,
|
|
162
|
+
RpgClientEngine
|
|
163
|
+
];
|
|
167
164
|
}
|
|
168
|
-
|
|
165
|
+
//#endregion
|
|
169
166
|
export { provideRpg };
|
|
170
|
-
|
|
167
|
+
|
|
168
|
+
//# sourceMappingURL=standalone.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standalone.js","sources":["../../src/services/standalone.ts"],"sourcesContent":["import { AbstractWebsocket, SocketUpdateProperties, WebSocketToken } from \"./AbstractSocket\";\nimport { ClientIo, ServerIo } from \"@signe/room\";\nimport { Context } from \"@signe/di\";\nimport { RpgClientEngine } from \"../RpgClientEngine\";\nimport { UpdateMapService, UpdateMapToken } from \"@rpgjs/common\";\nimport { LoadMapToken } from \"./loadMap\";\nimport { RpgGui } from \"../Gui/Gui\";\nimport { provideKeyboardControls } from \"./keyboardControls\";\nimport { provideSaveClient } from \"./save\";\n\ntype ServerIo = any;\ntype ClientIo = any;\n\ninterface StandaloneOptions {\n env?: Record<string, any>;\n}\n\nclass BridgeWebsocket extends AbstractWebsocket {\n private room: ServerIo;\n private socket: ClientIo;\n private pendingOn: Array<{ event: string; callback: (data: any) => void }> = [];\n private rooms = {\n partyFn: async (roomId: string) => {\n this.room = new ServerIo(roomId, this.rooms);\n const server = new this.server(this.room)\n await server.onStart();\n await server.subRoom.onStart()\n this.context.set('server', server)\n return server\n },\n env: {}\n }\n private serverInstance: any;\n\n constructor(protected context: Context, private server: any, options: StandaloneOptions = {}) {\n super(context);\n // fake room\n this.rooms.env = options.env || {};\n this.room = new ServerIo(\"lobby-1\", this.rooms);\n }\n\n async connection(listeners?: (data: any) => void) {\n this.serverInstance = new this.server(this.room);\n await this.serverInstance.onStart();\n await this.serverInstance.subRoom.onStart()\n this.context.set('server', this.serverInstance)\n return this._connection(listeners)\n }\n\n private async _connection(listeners?: (data: any) => void) {\n this.serverInstance = this.context.get('server')\n this.socket = new ClientIo(this.serverInstance, 'player-client-id');\n const url = new URL('http://localhost')\n const request = new Request(url.toString(), {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json'\n }\n })\n listeners?.(this.socket)\n await this.serverInstance.onConnect(this.socket.conn as any, { request } as any);\n this.room.clients.set(this.socket.id, this.socket);\n this.pendingOn.forEach(({ event, callback }) => this.socket.addEventListener(event, callback));\n this.pendingOn = [];\n return this.socket\n }\n\n on(key: string, callback: (data: any) => void) {\n const handler = (event) => {\n const object = JSON.parse(event);\n if (object.type === key) {\n callback(object.value);\n }\n };\n if (!this.socket) {\n this.pendingOn.push({ event: \"message\", callback: handler });\n return;\n }\n this.socket.addEventListener(\"message\", handler);\n }\n\n off(event: string, callback: (data: any) => void) {\n if (!this.socket) return;\n this.socket.removeEventListener(event, callback);\n }\n\n emit(event: string, data: any) {\n this.socket.send({\n action: event,\n value: data,\n });\n }\n\n /**\n * Update underlying connection properties before a reconnect\n *\n * Design\n * - Dynamically register a factory for the requested room to ensure a fresh server instance\n * - Swap the internal ServerIo to target the new room\n *\n * @param params - Properties to update\n * @param params.room - The target room id (e.g. `map-simplemap2`)\n *\n * @example\n * ```ts\n * websocket.updateProperties({ room: 'map-simplemap2' })\n * await websocket.reconnect()\n * ```\n */\n updateProperties(_params: SocketUpdateProperties) {\n // empty\n }\n\n /**\n * Reconnect the client to the current Party room\n *\n * Design\n * - Must be called after `updateProperties()` when switching rooms\n * - Rebuilds the client <-> server bridge and re-triggers connection listeners\n *\n * @param listeners - Optional callback to re-bind event handlers on the new socket\n *\n * @example\n * ```ts\n * websocket.updateProperties({ room: 'map-dungeon' })\n * await websocket.reconnect((socket) => {\n * // re-bind events here\n * })\n * ```\n */\n async reconnect(listeners?: (data: any) => void): Promise<void> {\n await this._connection((socket) => {\n listeners?.(socket)\n })\n }\n\n getServer() {\n return this.serverInstance\n }\n\n getSocket() {\n return this.socket\n }\n}\n\nclass UpdateMapStandaloneService extends UpdateMapService {\n private server: any;\n\n /**\n * Update the current room map data on the server side\n *\n * Design\n * - Uses the in-memory server instance stored in context (standalone mode)\n * - Builds a local HTTP-like request to the current Party room endpoint\n *\n * @param map - The map payload to apply on the server\n *\n * @example\n * ```ts\n * await updateMapService.update({ width: 1024, height: 768, events: [] })\n * ```\n */\n async update(map: any) {\n this.server = this.context.get('server')\n const roomId = this.server?.room?.id ?? 'lobby-1'\n const req = {\n url: `http://localhost/parties/main/${roomId}/map/update`,\n method: 'POST',\n headers: new Headers({}),\n json: async () => {\n return map;\n }\n };\n await this.server.onRequest(req)\n }\n}\n\nexport function provideRpg(server: any, options: StandaloneOptions = {}) {\n return [\n {\n provide: WebSocketToken,\n useFactory: (context: Context) => new BridgeWebsocket(context, server, options),\n },\n {\n provide: UpdateMapToken,\n useClass: UpdateMapStandaloneService,\n },\n provideKeyboardControls(),\n provideSaveClient(),\n RpgGui,\n RpgClientEngine,\n ];\n}\n"],"
|
|
1
|
+
{"version":3,"file":"standalone.js","names":[],"sources":["../../src/services/standalone.ts"],"sourcesContent":["import { AbstractWebsocket, SocketUpdateProperties, WebSocketToken } from \"./AbstractSocket\";\nimport { ClientIo, ServerIo } from \"@signe/room\";\nimport { Context } from \"@signe/di\";\nimport { RpgClientEngine } from \"../RpgClientEngine\";\nimport { UpdateMapService, UpdateMapToken } from \"@rpgjs/common\";\nimport { LoadMapToken } from \"./loadMap\";\nimport { RpgGui } from \"../Gui/Gui\";\nimport { provideKeyboardControls } from \"./keyboardControls\";\nimport { provideSaveClient } from \"./save\";\n\ntype ServerIo = any;\ntype ClientIo = any;\n\ninterface StandaloneOptions {\n env?: Record<string, any>;\n}\n\nclass BridgeWebsocket extends AbstractWebsocket {\n private room: ServerIo;\n private socket: ClientIo;\n private pendingOn: Array<{ event: string; callback: (data: any) => void }> = [];\n private rooms = {\n partyFn: async (roomId: string) => {\n this.room = new ServerIo(roomId, this.rooms);\n const server = new this.server(this.room)\n await server.onStart();\n await server.subRoom.onStart()\n this.context.set('server', server)\n return server\n },\n env: {}\n }\n private serverInstance: any;\n\n constructor(protected context: Context, private server: any, options: StandaloneOptions = {}) {\n super(context);\n // fake room\n this.rooms.env = options.env || {};\n this.room = new ServerIo(\"lobby-1\", this.rooms);\n }\n\n async connection(listeners?: (data: any) => void) {\n this.serverInstance = new this.server(this.room);\n await this.serverInstance.onStart();\n await this.serverInstance.subRoom.onStart()\n this.context.set('server', this.serverInstance)\n return this._connection(listeners)\n }\n\n private async _connection(listeners?: (data: any) => void) {\n this.serverInstance = this.context.get('server')\n this.socket = new ClientIo(this.serverInstance, 'player-client-id');\n const url = new URL('http://localhost')\n const request = new Request(url.toString(), {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json'\n }\n })\n listeners?.(this.socket)\n await this.serverInstance.onConnect(this.socket.conn as any, { request } as any);\n this.room.clients.set(this.socket.id, this.socket);\n this.pendingOn.forEach(({ event, callback }) => this.socket.addEventListener(event, callback));\n this.pendingOn = [];\n return this.socket\n }\n\n on(key: string, callback: (data: any) => void) {\n const handler = (event) => {\n const object = JSON.parse(event);\n if (object.type === key) {\n callback(object.value);\n }\n };\n if (!this.socket) {\n this.pendingOn.push({ event: \"message\", callback: handler });\n return;\n }\n this.socket.addEventListener(\"message\", handler);\n }\n\n off(event: string, callback: (data: any) => void) {\n if (!this.socket) return;\n this.socket.removeEventListener(event, callback);\n }\n\n emit(event: string, data: any) {\n this.socket.send({\n action: event,\n value: data,\n });\n }\n\n /**\n * Update underlying connection properties before a reconnect\n *\n * Design\n * - Dynamically register a factory for the requested room to ensure a fresh server instance\n * - Swap the internal ServerIo to target the new room\n *\n * @param params - Properties to update\n * @param params.room - The target room id (e.g. `map-simplemap2`)\n *\n * @example\n * ```ts\n * websocket.updateProperties({ room: 'map-simplemap2' })\n * await websocket.reconnect()\n * ```\n */\n updateProperties(_params: SocketUpdateProperties) {\n // empty\n }\n\n /**\n * Reconnect the client to the current Party room\n *\n * Design\n * - Must be called after `updateProperties()` when switching rooms\n * - Rebuilds the client <-> server bridge and re-triggers connection listeners\n *\n * @param listeners - Optional callback to re-bind event handlers on the new socket\n *\n * @example\n * ```ts\n * websocket.updateProperties({ room: 'map-dungeon' })\n * await websocket.reconnect((socket) => {\n * // re-bind events here\n * })\n * ```\n */\n async reconnect(listeners?: (data: any) => void): Promise<void> {\n await this._connection((socket) => {\n listeners?.(socket)\n })\n }\n\n getServer() {\n return this.serverInstance\n }\n\n getSocket() {\n return this.socket\n }\n}\n\nclass UpdateMapStandaloneService extends UpdateMapService {\n private server: any;\n\n /**\n * Update the current room map data on the server side\n *\n * Design\n * - Uses the in-memory server instance stored in context (standalone mode)\n * - Builds a local HTTP-like request to the current Party room endpoint\n *\n * @param map - The map payload to apply on the server\n *\n * @example\n * ```ts\n * await updateMapService.update({ width: 1024, height: 768, events: [] })\n * ```\n */\n async update(map: any) {\n this.server = this.context.get('server')\n const roomId = this.server?.room?.id ?? 'lobby-1'\n const req = {\n url: `http://localhost/parties/main/${roomId}/map/update`,\n method: 'POST',\n headers: new Headers({}),\n json: async () => {\n return map;\n }\n };\n await this.server.onRequest(req)\n }\n}\n\nexport function provideRpg(server: any, options: StandaloneOptions = {}) {\n return [\n {\n provide: WebSocketToken,\n useFactory: (context: Context) => new BridgeWebsocket(context, server, options),\n },\n {\n provide: UpdateMapToken,\n useClass: UpdateMapStandaloneService,\n },\n provideKeyboardControls(),\n provideSaveClient(),\n RpgGui,\n RpgClientEngine,\n ];\n}\n"],"mappings":";;;;;;;;AAiBA,IAAM,kBAAN,cAA8B,kBAAkB;CAiB9C,YAAY,SAA4B,QAAqB,UAA6B,EAAE,EAAE;AAC5F,QAAM,QAAQ;AADM,OAAA,UAAA;AAA0B,OAAA,SAAA;mBAd6B,EAAE;eAC/D;GACd,SAAS,OAAO,WAAmB;AACjC,SAAK,OAAO,IAAI,SAAS,QAAQ,KAAK,MAAM;IAC5C,MAAM,SAAS,IAAI,KAAK,OAAO,KAAK,KAAK;AACzC,UAAM,OAAO,SAAS;AACtB,UAAM,OAAO,QAAQ,SAAS;AAC9B,SAAK,QAAQ,IAAI,UAAU,OAAO;AAClC,WAAO;;GAET,KAAK,EAAE;GACR;AAMC,OAAK,MAAM,MAAM,QAAQ,OAAO,EAAE;AAClC,OAAK,OAAO,IAAI,SAAS,WAAW,KAAK,MAAM;;CAGjD,MAAM,WAAW,WAAiC;AAChD,OAAK,iBAAiB,IAAI,KAAK,OAAO,KAAK,KAAK;AAChD,QAAM,KAAK,eAAe,SAAS;AACnC,QAAM,KAAK,eAAe,QAAQ,SAAS;AAC3C,OAAK,QAAQ,IAAI,UAAU,KAAK,eAAe;AAC/C,SAAO,KAAK,YAAY,UAAU;;CAGpC,MAAc,YAAY,WAAiC;AACzD,OAAK,iBAAiB,KAAK,QAAQ,IAAI,SAAS;AAChD,OAAK,SAAS,IAAI,SA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