@crowdedkingdoms/crowdyjs 17.13.0-dev.1 → 18.0.0-dev.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.
Files changed (284) hide show
  1. package/MIGRATION.md +163 -1
  2. package/README.md +142 -146
  3. package/dist/crowdy-client.d.ts +12 -31
  4. package/dist/crowdy-client.d.ts.map +1 -1
  5. package/dist/crowdy-client.js +15 -37
  6. package/dist/crowdy-dsh/bridge.d.ts.map +1 -1
  7. package/dist/crowdy-dsh/bridge.js +3 -6
  8. package/dist/crowdy-studio/controller.d.ts +59 -57
  9. package/dist/crowdy-studio/controller.d.ts.map +1 -1
  10. package/dist/crowdy-studio/controller.js +268 -206
  11. package/dist/crowdy-studio/diagnostics.d.ts +3 -12
  12. package/dist/crowdy-studio/diagnostics.d.ts.map +1 -1
  13. package/dist/crowdy-studio/dom-shell.d.ts +2 -4
  14. package/dist/crowdy-studio/dom-shell.d.ts.map +1 -1
  15. package/dist/crowdy-studio/dom-shell.js +16 -47
  16. package/dist/crowdy-studio/embed/hud-layer.d.ts +1 -1
  17. package/dist/crowdy-studio/embed/panel.d.ts +3 -12
  18. package/dist/crowdy-studio/embed/panel.d.ts.map +1 -1
  19. package/dist/crowdy-studio/embed/panel.js +3 -6
  20. package/dist/crowdy-studio/index.d.ts +1 -3
  21. package/dist/crowdy-studio/index.d.ts.map +1 -1
  22. package/dist/crowdy-studio/index.js +0 -2
  23. package/dist/crowdy-studio/models.d.ts +3 -4
  24. package/dist/crowdy-studio/models.d.ts.map +1 -1
  25. package/dist/crowdy-studio/starter-projects.d.ts +8 -4
  26. package/dist/crowdy-studio/starter-projects.d.ts.map +1 -1
  27. package/dist/crowdy-studio/starter-projects.js +83 -100
  28. package/dist/domains/appAccess.d.ts +14 -1
  29. package/dist/domains/appAccess.d.ts.map +1 -1
  30. package/dist/domains/appAccess.js +37 -1
  31. package/dist/domains/exec.d.ts +162 -15
  32. package/dist/domains/exec.d.ts.map +1 -1
  33. package/dist/domains/exec.js +180 -18
  34. package/dist/domains/host.d.ts +3 -3
  35. package/dist/domains/host.js +3 -3
  36. package/dist/domains/marketplace.d.ts +9 -58
  37. package/dist/domains/marketplace.d.ts.map +1 -1
  38. package/dist/domains/marketplace.js +9 -106
  39. package/dist/domains/playerWallet.d.ts +6 -12
  40. package/dist/domains/playerWallet.d.ts.map +1 -1
  41. package/dist/domains/playerWallet.js +6 -21
  42. package/dist/errors.d.ts +7 -13
  43. package/dist/errors.d.ts.map +1 -1
  44. package/dist/errors.js +6 -10
  45. package/dist/generated/graphql.d.ts +1384 -7977
  46. package/dist/generated/graphql.d.ts.map +1 -1
  47. package/dist/generated/graphql.js +22 -321
  48. package/dist/grid-mods/exec-client-halves.d.ts +156 -0
  49. package/dist/grid-mods/exec-client-halves.d.ts.map +1 -0
  50. package/dist/grid-mods/exec-client-halves.js +356 -0
  51. package/dist/grid-mods/grid-host-calls.d.ts +29 -15
  52. package/dist/grid-mods/grid-host-calls.d.ts.map +1 -1
  53. package/dist/grid-mods/grid-host-calls.js +40 -44
  54. package/dist/grid-mods/index.d.ts +1 -0
  55. package/dist/grid-mods/index.d.ts.map +1 -1
  56. package/dist/grid-mods/index.js +1 -0
  57. package/dist/grid-mods/mod-runtime.d.ts +21 -6
  58. package/dist/grid-mods/mod-runtime.d.ts.map +1 -1
  59. package/dist/grid-mods/mod-runtime.js +6 -2
  60. package/dist/grid-scope.d.ts +0 -188
  61. package/dist/grid-scope.d.ts.map +1 -1
  62. package/dist/grid-scope.js +0 -69
  63. package/dist/index.d.ts +12 -18
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +11 -16
  66. package/dist/kit/actions.d.ts +5 -9
  67. package/dist/kit/actions.d.ts.map +1 -1
  68. package/dist/kit/actions.js +5 -9
  69. package/dist/kit/index.d.ts +2 -33
  70. package/dist/kit/index.d.ts.map +1 -1
  71. package/dist/kit/index.js +1 -32
  72. package/dist/kit/kit.d.ts +8 -208
  73. package/dist/kit/kit.d.ts.map +1 -1
  74. package/dist/kit/kit.js +5 -163
  75. package/dist/kit/social.d.ts +1 -3
  76. package/dist/kit/social.d.ts.map +1 -1
  77. package/dist/kit/social.js +1 -3
  78. package/dist/kit/wire.d.ts +16 -5
  79. package/dist/kit/wire.d.ts.map +1 -1
  80. package/dist/kit/wire.js +19 -5
  81. package/dist/live-coding/assets/browser-authoring-index.json +1 -1
  82. package/dist/live-coding/assets/manifest.json +1 -1
  83. package/dist/live-coding/browser-authoring-index.generated.d.ts.map +1 -1
  84. package/dist/live-coding/browser-authoring-index.generated.js +1496 -4386
  85. package/dist/live-coding/rust-analysis.d.ts.map +1 -1
  86. package/dist/live-coding/rust-analysis.js +31 -23
  87. package/dist/player-runtime/client-host-calls.d.ts +8 -0
  88. package/dist/player-runtime/client-host-calls.d.ts.map +1 -0
  89. package/dist/player-runtime/client-host-calls.js +28 -0
  90. package/dist/player-runtime/glue-runtime.d.ts +27 -10
  91. package/dist/player-runtime/glue-runtime.d.ts.map +1 -1
  92. package/dist/player-runtime/glue-runtime.js +40 -45
  93. package/dist/player-runtime/glue-sab.d.ts +2 -2
  94. package/dist/player-runtime/glue-sab.js +2 -2
  95. package/dist/player-runtime/player-code-broker.d.ts +80 -24
  96. package/dist/player-runtime/player-code-broker.d.ts.map +1 -1
  97. package/dist/player-runtime/player-code-broker.js +169 -41
  98. package/dist/player-runtime/player-glue-worker.d.ts +8 -8
  99. package/dist/player-runtime/player-glue-worker.d.ts.map +1 -1
  100. package/dist/player-runtime/player-glue-worker.js +26 -9
  101. package/dist/stores/actors.d.ts +12 -2
  102. package/dist/stores/actors.d.ts.map +1 -1
  103. package/dist/stores/actors.js +43 -18
  104. package/dist/stores/chunks.d.ts +12 -0
  105. package/dist/stores/chunks.d.ts.map +1 -1
  106. package/dist/stores/chunks.js +112 -39
  107. package/dist/stores/durable.d.ts.map +1 -1
  108. package/dist/stores/durable.js +2 -1
  109. package/dist/stores/inbox.d.ts +1 -1
  110. package/dist/stores/inbox.d.ts.map +1 -1
  111. package/dist/stores/index.d.ts +0 -11
  112. package/dist/stores/index.d.ts.map +1 -1
  113. package/dist/stores/index.js +0 -4
  114. package/dist/stores/session.d.ts +0 -2
  115. package/dist/stores/session.d.ts.map +1 -1
  116. package/package.json +1 -1
  117. package/dist/crowdy-studio/model-lint-log.d.ts +0 -76
  118. package/dist/crowdy-studio/model-lint-log.d.ts.map +0 -1
  119. package/dist/crowdy-studio/model-lint-log.js +0 -93
  120. package/dist/crowdy-studio/model-lint.d.ts +0 -61
  121. package/dist/crowdy-studio/model-lint.d.ts.map +0 -1
  122. package/dist/crowdy-studio/model-lint.js +0 -45
  123. package/dist/domains/compute.d.ts +0 -208
  124. package/dist/domains/compute.d.ts.map +0 -1
  125. package/dist/domains/compute.js +0 -274
  126. package/dist/domains/controlPlane.d.ts +0 -38
  127. package/dist/domains/controlPlane.d.ts.map +0 -1
  128. package/dist/domains/controlPlane.js +0 -43
  129. package/dist/domains/gameModel.d.ts +0 -1174
  130. package/dist/domains/gameModel.d.ts.map +0 -1
  131. package/dist/domains/gameModel.js +0 -1333
  132. package/dist/domains/playerCompute.d.ts +0 -91
  133. package/dist/domains/playerCompute.d.ts.map +0 -1
  134. package/dist/domains/playerCompute.js +0 -136
  135. package/dist/domains/playerModel.d.ts +0 -20
  136. package/dist/domains/playerModel.d.ts.map +0 -1
  137. package/dist/domains/playerModel.js +0 -54
  138. package/dist/kit/abilities.d.ts +0 -66
  139. package/dist/kit/abilities.d.ts.map +0 -1
  140. package/dist/kit/abilities.js +0 -71
  141. package/dist/kit/blueprints/combat.d.ts +0 -81
  142. package/dist/kit/blueprints/combat.d.ts.map +0 -1
  143. package/dist/kit/blueprints/combat.js +0 -357
  144. package/dist/kit/blueprints/core.d.ts +0 -222
  145. package/dist/kit/blueprints/core.d.ts.map +0 -1
  146. package/dist/kit/blueprints/core.js +0 -185
  147. package/dist/kit/blueprints/decks.d.ts +0 -50
  148. package/dist/kit/blueprints/decks.d.ts.map +0 -1
  149. package/dist/kit/blueprints/decks.js +0 -163
  150. package/dist/kit/blueprints/economy.d.ts +0 -88
  151. package/dist/kit/blueprints/economy.d.ts.map +0 -1
  152. package/dist/kit/blueprints/economy.js +0 -533
  153. package/dist/kit/blueprints/guild.d.ts +0 -51
  154. package/dist/kit/blueprints/guild.d.ts.map +0 -1
  155. package/dist/kit/blueprints/guild.js +0 -50
  156. package/dist/kit/blueprints/index.d.ts +0 -23
  157. package/dist/kit/blueprints/index.d.ts.map +0 -1
  158. package/dist/kit/blueprints/index.js +0 -22
  159. package/dist/kit/blueprints/inventory.d.ts +0 -84
  160. package/dist/kit/blueprints/inventory.d.ts.map +0 -1
  161. package/dist/kit/blueprints/inventory.js +0 -257
  162. package/dist/kit/blueprints/leaderboards.d.ts +0 -49
  163. package/dist/kit/blueprints/leaderboards.d.ts.map +0 -1
  164. package/dist/kit/blueprints/leaderboards.js +0 -126
  165. package/dist/kit/blueprints/liveops.d.ts +0 -42
  166. package/dist/kit/blueprints/liveops.d.ts.map +0 -1
  167. package/dist/kit/blueprints/liveops.js +0 -170
  168. package/dist/kit/blueprints/locks.d.ts +0 -82
  169. package/dist/kit/blueprints/locks.d.ts.map +0 -1
  170. package/dist/kit/blueprints/locks.js +0 -155
  171. package/dist/kit/blueprints/loot.d.ts +0 -90
  172. package/dist/kit/blueprints/loot.d.ts.map +0 -1
  173. package/dist/kit/blueprints/loot.js +0 -229
  174. package/dist/kit/blueprints/matches.d.ts +0 -84
  175. package/dist/kit/blueprints/matches.d.ts.map +0 -1
  176. package/dist/kit/blueprints/matches.js +0 -349
  177. package/dist/kit/blueprints/moderation.d.ts +0 -32
  178. package/dist/kit/blueprints/moderation.d.ts.map +0 -1
  179. package/dist/kit/blueprints/moderation.js +0 -140
  180. package/dist/kit/blueprints/npcs.d.ts +0 -78
  181. package/dist/kit/blueprints/npcs.d.ts.map +0 -1
  182. package/dist/kit/blueprints/npcs.js +0 -125
  183. package/dist/kit/blueprints/plots.d.ts +0 -63
  184. package/dist/kit/blueprints/plots.d.ts.map +0 -1
  185. package/dist/kit/blueprints/plots.js +0 -151
  186. package/dist/kit/blueprints/progression.d.ts +0 -68
  187. package/dist/kit/blueprints/progression.d.ts.map +0 -1
  188. package/dist/kit/blueprints/progression.js +0 -324
  189. package/dist/kit/blueprints/quests.d.ts +0 -72
  190. package/dist/kit/blueprints/quests.d.ts.map +0 -1
  191. package/dist/kit/blueprints/quests.js +0 -285
  192. package/dist/kit/blueprints/worldsim.d.ts +0 -91
  193. package/dist/kit/blueprints/worldsim.d.ts.map +0 -1
  194. package/dist/kit/blueprints/worldsim.js +0 -468
  195. package/dist/kit/combat.d.ts +0 -141
  196. package/dist/kit/combat.d.ts.map +0 -1
  197. package/dist/kit/combat.js +0 -196
  198. package/dist/kit/decks.d.ts +0 -157
  199. package/dist/kit/decks.d.ts.map +0 -1
  200. package/dist/kit/decks.js +0 -186
  201. package/dist/kit/director.d.ts +0 -88
  202. package/dist/kit/director.d.ts.map +0 -1
  203. package/dist/kit/director.js +0 -86
  204. package/dist/kit/economy.d.ts +0 -289
  205. package/dist/kit/economy.d.ts.map +0 -1
  206. package/dist/kit/economy.js +0 -427
  207. package/dist/kit/engine.d.ts +0 -48
  208. package/dist/kit/engine.d.ts.map +0 -1
  209. package/dist/kit/engine.js +0 -113
  210. package/dist/kit/features.d.ts +0 -60
  211. package/dist/kit/features.d.ts.map +0 -1
  212. package/dist/kit/features.js +0 -65
  213. package/dist/kit/instances.d.ts +0 -52
  214. package/dist/kit/instances.d.ts.map +0 -1
  215. package/dist/kit/instances.js +0 -60
  216. package/dist/kit/inventory.d.ts +0 -129
  217. package/dist/kit/inventory.d.ts.map +0 -1
  218. package/dist/kit/inventory.js +0 -200
  219. package/dist/kit/leaderboards.d.ts +0 -86
  220. package/dist/kit/leaderboards.d.ts.map +0 -1
  221. package/dist/kit/leaderboards.js +0 -133
  222. package/dist/kit/liveops.d.ts +0 -112
  223. package/dist/kit/liveops.d.ts.map +0 -1
  224. package/dist/kit/liveops.js +0 -183
  225. package/dist/kit/loot.d.ts +0 -128
  226. package/dist/kit/loot.d.ts.map +0 -1
  227. package/dist/kit/loot.js +0 -160
  228. package/dist/kit/matches.d.ts +0 -301
  229. package/dist/kit/matches.d.ts.map +0 -1
  230. package/dist/kit/matches.js +0 -458
  231. package/dist/kit/matchmaking.d.ts +0 -57
  232. package/dist/kit/matchmaking.d.ts.map +0 -1
  233. package/dist/kit/matchmaking.js +0 -59
  234. package/dist/kit/minigames.d.ts +0 -30
  235. package/dist/kit/minigames.d.ts.map +0 -1
  236. package/dist/kit/minigames.js +0 -38
  237. package/dist/kit/mobs.d.ts +0 -90
  238. package/dist/kit/mobs.d.ts.map +0 -1
  239. package/dist/kit/mobs.js +0 -98
  240. package/dist/kit/moderation.d.ts +0 -73
  241. package/dist/kit/moderation.d.ts.map +0 -1
  242. package/dist/kit/moderation.js +0 -103
  243. package/dist/kit/movement.d.ts +0 -78
  244. package/dist/kit/movement.d.ts.map +0 -1
  245. package/dist/kit/movement.js +0 -103
  246. package/dist/kit/notifications.d.ts +0 -45
  247. package/dist/kit/notifications.d.ts.map +0 -1
  248. package/dist/kit/notifications.js +0 -67
  249. package/dist/kit/npcs.d.ts +0 -226
  250. package/dist/kit/npcs.d.ts.map +0 -1
  251. package/dist/kit/npcs.js +0 -141
  252. package/dist/kit/objects.d.ts +0 -116
  253. package/dist/kit/objects.d.ts.map +0 -1
  254. package/dist/kit/objects.js +0 -119
  255. package/dist/kit/pets.d.ts +0 -85
  256. package/dist/kit/pets.d.ts.map +0 -1
  257. package/dist/kit/pets.js +0 -96
  258. package/dist/kit/plots.d.ts +0 -85
  259. package/dist/kit/plots.d.ts.map +0 -1
  260. package/dist/kit/plots.js +0 -113
  261. package/dist/kit/progression.d.ts +0 -181
  262. package/dist/kit/progression.d.ts.map +0 -1
  263. package/dist/kit/progression.js +0 -265
  264. package/dist/kit/quests.d.ts +0 -171
  265. package/dist/kit/quests.d.ts.map +0 -1
  266. package/dist/kit/quests.js +0 -237
  267. package/dist/kit/racing.d.ts +0 -85
  268. package/dist/kit/racing.d.ts.map +0 -1
  269. package/dist/kit/racing.js +0 -99
  270. package/dist/kit/shared.d.ts +0 -73
  271. package/dist/kit/shared.d.ts.map +0 -1
  272. package/dist/kit/shared.js +0 -101
  273. package/dist/kit/telemetry.d.ts +0 -66
  274. package/dist/kit/telemetry.d.ts.map +0 -1
  275. package/dist/kit/telemetry.js +0 -133
  276. package/dist/kit/territory.d.ts +0 -97
  277. package/dist/kit/territory.d.ts.map +0 -1
  278. package/dist/kit/territory.js +0 -114
  279. package/dist/kit/worldsim.d.ts +0 -263
  280. package/dist/kit/worldsim.d.ts.map +0 -1
  281. package/dist/kit/worldsim.js +0 -268
  282. package/dist/stores/model.d.ts +0 -81
  283. package/dist/stores/model.d.ts.map +0 -1
  284. package/dist/stores/model.js +0 -163
@@ -1,90 +0,0 @@
1
- import type { GameModelAPI } from '../domains/gameModel.js';
2
- import type { Scalars } from '../generated/graphql.js';
3
- import type { EngineDetector, EngineInvokeResult } from './engine.js';
4
- import { type ContactDamageEvent } from './wire.js';
5
- /** Options for {@link MobsKit}. Must match the deployed mob engine. */
6
- export interface MobsKitOptions {
7
- /** The compute module serving `attack_mob`/`status`. Defaults to `'mob-engine'`. */
8
- moduleName?: string;
9
- /** The mob-definition container type. Defaults to `'MobDef'`. */
10
- defTypeName?: string;
11
- /** The mob slot container type. Defaults to `'Mob'`. */
12
- slotTypeName?: string;
13
- }
14
- /** A parsed mob definition container. */
15
- export interface KitMobDef {
16
- containerId: string;
17
- displayName: string;
18
- mobId: string;
19
- maxHealth: number;
20
- damage: number;
21
- speed: number;
22
- hostile: boolean;
23
- spawnTime: string;
24
- properties: Record<string, unknown>;
25
- }
26
- /** A parsed mob slot container (durable state; live poses ride the mob lane). */
27
- export interface KitMobSlot {
28
- containerId: string;
29
- displayName: string;
30
- mobId: string;
31
- actorUuid: string;
32
- health: number;
33
- x: number;
34
- y: number;
35
- z: number;
36
- /** health > 0 — the slot is live and being simulated. */
37
- alive: boolean;
38
- properties: Record<string, unknown>;
39
- }
40
- /** The referee's verdict for an accepted/denied attack. */
41
- export interface KitAttackResult {
42
- success: boolean;
43
- /** Remaining health after an accepted hit. */
44
- health?: number;
45
- killed?: boolean;
46
- /** The referee's denial reason ("out of range", "mob not live", ...). */
47
- reason?: string;
48
- }
49
- /**
50
- * Runtime helpers for compute-module mob engines (the Wave 1 `mob-engine`
51
- * template / BWF's `bwf-mobs`): definition + slot reads off the model, the
52
- * refereed `attack_mob` invoke, and the type-77 contact-damage event parser.
53
- *
54
- * Live mob poses arrive on the actor stream (FLAG_MOB, container-id
55
- * suffix) — decode them with `kit/wire`'s {@link engineLanes} +
56
- * `enginePoseCodec` in your world session; this kit reads the durable side.
57
- *
58
- * Obtained via `client.kit(appId).mobs`.
59
- */
60
- export declare class MobsKit {
61
- private readonly appId;
62
- private readonly gameModel;
63
- private readonly engines;
64
- private readonly moduleName;
65
- private readonly defTypeName;
66
- private readonly slotTypeName;
67
- constructor(appId: Scalars['BigInt']['input'], gameModel: GameModelAPI, engines: EngineDetector, options?: MobsKitOptions);
68
- /** Is the mob engine deployed + enabled (cached per session)? */
69
- engineAvailable(): Promise<boolean>;
70
- /**
71
- * Attack a live mob slot through the server referee: presence, range and
72
- * damage clamps are validated engine-side before health moves. Denials
73
- * resolve with `success: false` and the referee's `reason`.
74
- */
75
- attack(containerId: string, amount?: number): Promise<KitAttackResult>;
76
- /** The engine's `status` snapshot (mob/def counts, tick counter). */
77
- status(): Promise<EngineInvokeResult>;
78
- /** List mob definitions with parsed stats. */
79
- defs(): Promise<KitMobDef[]>;
80
- /** List mob slots (durable positions/health; `alive` = health > 0). */
81
- slots(): Promise<KitMobSlot[]>;
82
- /**
83
- * Parse a server-event payload as engine contact damage (type 77), or
84
- * null when it is another event type. Feed it your world session's
85
- * server-event stream and apply the damage to your own player when
86
- * `targetUuid` matches your actor uuid.
87
- */
88
- parseContactDamage(payload: Uint8Array): ContactDamageEvent | null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
4
- * Runtime helpers for compute-module mob engines (the Wave 1 `mob-engine`
5
- * template / BWF's `bwf-mobs`): definition + slot reads off the model, the
6
- * refereed `attack_mob` invoke, and the type-77 contact-damage event parser.
7
- *
8
- * Live mob poses arrive on the actor stream (FLAG_MOB, container-id
9
- * suffix) — decode them with `kit/wire`'s {@link engineLanes} +
10
- * `enginePoseCodec` in your world session; this kit reads the durable side.
11
- *
12
- * Obtained via `client.kit(appId).mobs`.
13
- */
14
- export class MobsKit {
15
- constructor(appId, gameModel, engines, options = {}) {
16
- this.appId = appId;
17
- this.gameModel = gameModel;
18
- this.engines = engines;
19
- this.moduleName = options.moduleName ?? 'mob-engine';
20
- this.defTypeName = options.defTypeName ?? 'MobDef';
21
- this.slotTypeName = options.slotTypeName ?? 'Mob';
22
- }
23
- /** Is the mob engine deployed + enabled (cached per session)? */
24
- engineAvailable() {
25
- return this.engines.has(this.moduleName);
26
- }
27
- /**
28
- * Attack a live mob slot through the server referee: presence, range and
29
- * damage clamps are validated engine-side before health moves. Denials
30
- * resolve with `success: false` and the referee's `reason`.
31
- */
32
- async attack(containerId, amount = 1) {
33
- const result = await this.engines.invoke(this.moduleName, 'attack_mob', { containerId, amount });
34
- return {
35
- success: result.success,
36
- health: typeof result.body.health === 'number' ? result.body.health : undefined,
37
- killed: typeof result.body.killed === 'boolean' ? result.body.killed : undefined,
38
- reason: result.reason,
39
- };
40
- }
41
- /** The engine's `status` snapshot (mob/def counts, tick counter). */
42
- async status() {
43
- return this.engines.invoke(this.moduleName, 'status');
44
- }
45
- /** List mob definitions with parsed stats. */
46
- async defs() {
47
- const containers = await this.gameModel.containers({
48
- appId: this.appId,
49
- typeName: this.defTypeName,
50
- });
51
- return Promise.all(containers.map(async (c) => {
52
- const props = await kitContainerProperties(this.gameModel, String(this.appId), c.containerId);
53
- return {
54
- containerId: c.containerId,
55
- displayName: c.displayName,
56
- mobId: String(props.mob_id ?? ''),
57
- maxHealth: Number(props.max_health ?? 0),
58
- damage: Number(props.damage ?? 0),
59
- speed: Number(props.speed ?? 0),
60
- hostile: props.hostile === true || props.hostile === 'true',
61
- spawnTime: String(props.spawn_time ?? 'any'),
62
- properties: props,
63
- };
64
- }));
65
- }
66
- /** List mob slots (durable positions/health; `alive` = health > 0). */
67
- async slots() {
68
- const containers = await this.gameModel.containers({
69
- appId: this.appId,
70
- typeName: this.slotTypeName,
71
- });
72
- return Promise.all(containers.map(async (c) => {
73
- const props = await kitContainerProperties(this.gameModel, String(this.appId), c.containerId);
74
- const health = Number(props.health ?? 0);
75
- return {
76
- containerId: c.containerId,
77
- displayName: c.displayName,
78
- mobId: String(props.mob_id ?? ''),
79
- actorUuid: String(props.actor_uuid ?? ''),
80
- health,
81
- x: Number(props.x ?? 0),
82
- y: Number(props.y ?? 0),
83
- z: Number(props.z ?? 0),
84
- alive: health > 0,
85
- properties: props,
86
- };
87
- }));
88
- }
89
- /**
90
- * Parse a server-event payload as engine contact damage (type 77), or
91
- * null when it is another event type. Feed it your world session's
92
- * server-event stream and apply the damage to your own player when
93
- * `targetUuid` matches your actor uuid.
94
- */
95
- parseContactDamage(payload) {
96
- return parseContactDamage(payload);
97
- }
98
- }
@@ -1,73 +0,0 @@
1
- import type { GameModelAPI } from '../domains/gameModel.js';
2
- import type { Scalars } from '../generated/graphql.js';
3
- /** Options for {@link ModerationKit}. */
4
- export interface ModerationKitOptions {
5
- /** The `typePrefix` the moderation blueprint was deployed with. */
6
- typePrefix?: string;
7
- }
8
- /** A parsed report row. */
9
- export interface KitModReport {
10
- containerId: string;
11
- reporterUserId: string;
12
- subjectUserId: string;
13
- reason: string;
14
- detail: string;
15
- status: string;
16
- resolution: string;
17
- filedAtMs: number;
18
- }
19
- /**
20
- * Runtime helpers for the moderation blueprint: file reports, read the
21
- * admin escalation queue, resolve reports, and manage the caller's personal
22
- * mute list (client-enforced chat filtering). Enforcement stays on platform
23
- * surfaces — tier revocation and grid permissions.
24
- *
25
- * Obtained via `client.kit(appId).moderation`.
26
- */
27
- export declare class ModerationKit {
28
- private readonly appId;
29
- private readonly gameModel;
30
- private readonly names;
31
- constructor(appId: Scalars['BigInt']['input'], gameModel: GameModelAPI, options?: ModerationKitOptions);
32
- /** File a report (creates the caller's report row in the queue). */
33
- report(input: {
34
- reporterUserId: string;
35
- subjectUserId: string;
36
- reason: string;
37
- detail?: string;
38
- }): Promise<{
39
- __typename?: "GmContainer";
40
- containerId: string;
41
- appId: string;
42
- sessionId: string | null;
43
- typeName: string;
44
- displayName: string;
45
- description: string | null;
46
- ownerUserId: string | null;
47
- metadataJson: string;
48
- }>;
49
- /** The escalation queue (admins; filter by status, default `'open'`). */
50
- queue(status?: string): Promise<KitModReport[]>;
51
- /** ADMIN — resolve a report with a disposition. */
52
- resolve(reportContainerId: string, status: 'actioned' | 'dismissed', resolution: string): Promise<import("./shared.js").KitInvokeResult<string>>;
53
- /** Mute a player (adds to YOUR client-enforced mute list). */
54
- mute(ownerUserId: string, mutedUserId: string): Promise<{
55
- __typename?: "GmContainer";
56
- containerId: string;
57
- appId: string;
58
- sessionId: string | null;
59
- typeName: string;
60
- displayName: string;
61
- description: string | null;
62
- ownerUserId: string | null;
63
- metadataJson: string;
64
- }>;
65
- /** Unmute: delete the matching mute row. */
66
- unmute(ownerUserId: string, mutedUserId: string): Promise<boolean>;
67
- /** The caller's mute list (feed it to your chat renderer). */
68
- mutes(ownerUserId: string): Promise<Array<{
69
- containerId: string;
70
- mutedUserId: string;
71
- }>>;
72
- }
73
- //# sourceMappingURL=moderation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"moderation.d.ts","sourceRoot":"","sources":["../../src/kit/moderation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAIvD,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACnC,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;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AE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAmB/F"}
@@ -1,103 +0,0 @@
1
- import { moderationNames } from './blueprints/moderation.js';
2
- import { kitContainerProperties, kitInvoke } from './shared.js';
3
- /**
4
- * Runtime helpers for the moderation blueprint: file reports, read the
5
- * admin escalation queue, resolve reports, and manage the caller's personal
6
- * mute list (client-enforced chat filtering). Enforcement stays on platform
7
- * surfaces — tier revocation and grid permissions.
8
- *
9
- * Obtained via `client.kit(appId).moderation`.
10
- */
11
- export class ModerationKit {
12
- constructor(appId, gameModel, options = {}) {
13
- this.appId = appId;
14
- this.gameModel = gameModel;
15
- this.names = moderationNames(options.typePrefix ?? '');
16
- }
17
- /** File a report (creates the caller's report row in the queue). */
18
- async report(input) {
19
- return this.gameModel.createContainer({
20
- appId: this.appId,
21
- typeName: this.names.reportType,
22
- displayName: `report ${input.reason} vs ${input.subjectUserId}`,
23
- properties: [
24
- { key: 'reporter_user_id', valueType: 'string', valueJson: JSON.stringify(input.reporterUserId) },
25
- { key: 'subject_user_id', valueType: 'string', valueJson: JSON.stringify(input.subjectUserId) },
26
- { key: 'reason', valueType: 'string', valueJson: JSON.stringify(input.reason) },
27
- { key: 'detail', valueType: 'string', valueJson: JSON.stringify((input.detail ?? '').slice(0, 500)) },
28
- { key: 'filed_at_ms', valueType: 'int', valueJson: String(Date.now()) },
29
- ],
30
- });
31
- }
32
- /** The escalation queue (admins; filter by status, default `'open'`). */
33
- async queue(status = 'open') {
34
- const containers = await this.gameModel.containers({
35
- appId: this.appId,
36
- typeName: this.names.reportType,
37
- });
38
- const rows = await Promise.all(containers.map(async (c) => {
39
- const props = await kitContainerProperties(this.gameModel, String(this.appId), c.containerId);
40
- return {
41
- containerId: c.containerId,
42
- reporterUserId: String(props.reporter_user_id ?? ''),
43
- subjectUserId: String(props.subject_user_id ?? ''),
44
- reason: String(props.reason ?? ''),
45
- detail: String(props.detail ?? ''),
46
- status: String(props.status ?? 'open'),
47
- resolution: String(props.resolution ?? ''),
48
- filedAtMs: Number(props.filed_at_ms ?? 0),
49
- };
50
- }));
51
- return rows
52
- .filter((r) => !status || r.status === status)
53
- .sort((a, b) => a.filedAtMs - b.filedAtMs);
54
- }
55
- /** ADMIN — resolve a report with a disposition. */
56
- async resolve(reportContainerId, status, resolution) {
57
- return kitInvoke(this.gameModel, {
58
- appId: String(this.appId),
59
- functionName: this.names.resolveReportFn,
60
- selfContainerId: reportContainerId,
61
- params: { status, resolution },
62
- });
63
- }
64
- /** Mute a player (adds to YOUR client-enforced mute list). */
65
- async mute(ownerUserId, mutedUserId) {
66
- return this.gameModel.createContainer({
67
- appId: this.appId,
68
- typeName: this.names.muteType,
69
- displayName: `mute ${mutedUserId}`,
70
- properties: [
71
- { key: 'owner_user_id', valueType: 'string', valueJson: JSON.stringify(ownerUserId) },
72
- { key: 'muted_user_id', valueType: 'string', valueJson: JSON.stringify(mutedUserId) },
73
- ],
74
- });
75
- }
76
- /** Unmute: delete the matching mute row. */
77
- async unmute(ownerUserId, mutedUserId) {
78
- const mutes = await this.mutes(ownerUserId);
79
- const row = mutes.find((m) => m.mutedUserId === mutedUserId);
80
- if (!row)
81
- return false;
82
- await this.gameModel.deleteContainer({ appId: this.appId, containerId: row.containerId });
83
- return true;
84
- }
85
- /** The caller's mute list (feed it to your chat renderer). */
86
- async mutes(ownerUserId) {
87
- const containers = await this.gameModel.containers({
88
- appId: this.appId,
89
- typeName: this.names.muteType,
90
- });
91
- const rows = await Promise.all(containers.map(async (c) => {
92
- const props = await kitContainerProperties(this.gameModel, String(this.appId), c.containerId);
93
- return {
94
- containerId: c.containerId,
95
- ownerUserId: String(props.owner_user_id ?? ''),
96
- mutedUserId: String(props.muted_user_id ?? ''),
97
- };
98
- }));
99
- return rows
100
- .filter((r) => r.ownerUserId === String(ownerUserId))
101
- .map(({ containerId, mutedUserId }) => ({ containerId, mutedUserId }));
102
- }
103
- }
@@ -1,78 +0,0 @@
1
- import type { GameModelAPI } from '../domains/gameModel.js';
2
- import type { Scalars } from '../generated/graphql.js';
3
- import type { EngineDetector } from './engine.js';
4
- import { type MovementViolationEvent } from './wire.js';
5
- /** Options for {@link MovementKit}. */
6
- export interface MovementKitOptions {
7
- /** The warden module name. Defaults to `'movement-warden'`. */
8
- moduleName?: string;
9
- /** The warden-config container type. Defaults to `'WardenConfig'`. */
10
- configTypeName?: string;
11
- }
12
- /** A user's violation book as the warden reports it. */
13
- export interface KitViolations {
14
- userId: string;
15
- speed: number;
16
- teleport: number;
17
- bounds: number;
18
- log: Array<{
19
- atMs: number;
20
- kind: string;
21
- detail: string;
22
- }>;
23
- }
24
- /**
25
- * Runtime helpers for the movement-warden (Wave 3, observe/flag posture):
26
- * read violation books, inspect the live envelope config, and parse type-95
27
- * violation events. The warden never corrects or kicks — client prediction
28
- * stays exactly as it is; games decide what flags mean (scoreboard shame,
29
- * moderation reports, tournament DQs).
30
- *
31
- * Client-prediction guidance: keep your movement client-authoritative and
32
- * SMOOTH — the envelopes are generous (speed tolerance + one-sample jitter
33
- * forgiveness) so honest clients never flag; teleports (fast travel,
34
- * respawns) should be paired with game-known context you can correlate
35
- * against the violation log.
36
- *
37
- * Obtained via `client.kit(appId).movement`.
38
- */
39
- export declare class MovementKit {
40
- private readonly appId;
41
- private readonly gameModel;
42
- private readonly engines;
43
- private readonly moduleName;
44
- private readonly configTypeName;
45
- constructor(appId: Scalars['BigInt']['input'], gameModel: GameModelAPI, engines: EngineDetector, options?: MovementKitOptions);
46
- /** Is the warden deployed + enabled (cached per session)? */
47
- engineAvailable(): Promise<boolean>;
48
- /** A user's violation book (your own without an argument). */
49
- violations(userId?: string): Promise<KitViolations>;
50
- /** The live envelope configuration (posture is always `'observe'` v1). */
51
- config(): Promise<Record<string, unknown>>;
52
- /** Warden totals (watched actors, flagged users, samples). */
53
- status(): Promise<Record<string, unknown>>;
54
- /** STUDIO (admin) — create/adjust the WardenConfig container. */
55
- defineConfig(input: {
56
- displayName?: string;
57
- chunk?: [number, number, number];
58
- radiusXz?: number;
59
- maxSpeed?: number;
60
- maxTeleport?: number;
61
- bounds?: [number, number, number, number];
62
- tolerancePct?: number;
63
- }): Promise<{
64
- __typename?: "GmContainer";
65
- containerId: string;
66
- appId: string;
67
- sessionId: string | null;
68
- typeName: string;
69
- displayName: string;
70
- description: string | null;
71
- ownerUserId: string | null;
72
- metadataJson: string;
73
- }>;
74
- /** Parse a type-95 movement-violation server event. */
75
- parseViolation(bytes: Uint8Array): MovementViolationEvent | null;
76
- private invoke;
77
- }
78
- //# sourceMappingURL=movement.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"movement.d.ts","sourceRoot":"","sources":["../../src/kit/movement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAA0B,KAAK,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAEhF,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IACjC,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sEAAsE;IACtE,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wDAAwD;AACxD,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC5D;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,WAAW;IAKpB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAN1B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;gBAGrB,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,EACjC,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,cAAc,EACxC,OAAO,GAAE,kBAAuB;IAMlC,6DAA6D;IAC7D,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IAInC,8DAA8D;IACxD,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAiBzD,0EAA0E;IACpE,MAAM;IAIZ,8DAA8D;IACxD,MAAM;IAIZ,iEAAiE;IAC3D,YAAY,CAAC,KAAK,EAAE;QACxB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB;;;;;;;;;;;IAsCD,uDAAuD;IACvD,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,sBAAsB,GAAG,IAAI;YAIlD,MAAM;CAOrB"}
@@ -1,103 +0,0 @@
1
- import { parseMovementViolation } from './wire.js';
2
- /**
3
- * Runtime helpers for the movement-warden (Wave 3, observe/flag posture):
4
- * read violation books, inspect the live envelope config, and parse type-95
5
- * violation events. The warden never corrects or kicks — client prediction
6
- * stays exactly as it is; games decide what flags mean (scoreboard shame,
7
- * moderation reports, tournament DQs).
8
- *
9
- * Client-prediction guidance: keep your movement client-authoritative and
10
- * SMOOTH — the envelopes are generous (speed tolerance + one-sample jitter
11
- * forgiveness) so honest clients never flag; teleports (fast travel,
12
- * respawns) should be paired with game-known context you can correlate
13
- * against the violation log.
14
- *
15
- * Obtained via `client.kit(appId).movement`.
16
- */
17
- export class MovementKit {
18
- constructor(appId, gameModel, engines, options = {}) {
19
- this.appId = appId;
20
- this.gameModel = gameModel;
21
- this.engines = engines;
22
- this.moduleName = options.moduleName ?? 'movement-warden';
23
- this.configTypeName = options.configTypeName ?? 'WardenConfig';
24
- }
25
- /** Is the warden deployed + enabled (cached per session)? */
26
- engineAvailable() {
27
- return this.engines.has(this.moduleName);
28
- }
29
- /** A user's violation book (your own without an argument). */
30
- async violations(userId) {
31
- const body = await this.invoke('violations', userId ? { userId } : {});
32
- return {
33
- userId: String(body.userId ?? ''),
34
- speed: Number(body.speed ?? 0),
35
- teleport: Number(body.teleport ?? 0),
36
- bounds: Number(body.bounds ?? 0),
37
- log: Array.isArray(body.log)
38
- ? body.log.map((entry) => ({
39
- atMs: Number(entry.atMs ?? 0),
40
- kind: String(entry.kind ?? ''),
41
- detail: String(entry.detail ?? ''),
42
- }))
43
- : [],
44
- };
45
- }
46
- /** The live envelope configuration (posture is always `'observe'` v1). */
47
- async config() {
48
- return this.invoke('config', {});
49
- }
50
- /** Warden totals (watched actors, flagged users, samples). */
51
- async status() {
52
- return this.invoke('status', {});
53
- }
54
- /** STUDIO (admin) — create/adjust the WardenConfig container. */
55
- async defineConfig(input) {
56
- const properties = [
57
- ...(input.chunk
58
- ? [
59
- { key: 'chunk_x', valueType: 'int', valueJson: String(input.chunk[0]) },
60
- { key: 'chunk_y', valueType: 'int', valueJson: String(input.chunk[1]) },
61
- { key: 'chunk_z', valueType: 'int', valueJson: String(input.chunk[2]) },
62
- ]
63
- : []),
64
- ...(input.radiusXz !== undefined
65
- ? [{ key: 'radius_xz', valueType: 'int', valueJson: String(input.radiusXz) }]
66
- : []),
67
- ...(input.maxSpeed !== undefined
68
- ? [{ key: 'max_speed', valueType: 'int', valueJson: String(input.maxSpeed) }]
69
- : []),
70
- ...(input.maxTeleport !== undefined
71
- ? [{ key: 'max_teleport', valueType: 'int', valueJson: String(input.maxTeleport) }]
72
- : []),
73
- ...(input.bounds
74
- ? [
75
- { key: 'min_x', valueType: 'int', valueJson: String(input.bounds[0]) },
76
- { key: 'max_x', valueType: 'int', valueJson: String(input.bounds[1]) },
77
- { key: 'min_z', valueType: 'int', valueJson: String(input.bounds[2]) },
78
- { key: 'max_z', valueType: 'int', valueJson: String(input.bounds[3]) },
79
- ]
80
- : []),
81
- ...(input.tolerancePct !== undefined
82
- ? [{ key: 'tolerance_pct', valueType: 'int', valueJson: String(input.tolerancePct) }]
83
- : []),
84
- ];
85
- return this.gameModel.createContainer({
86
- appId: this.appId,
87
- typeName: this.configTypeName,
88
- displayName: input.displayName ?? 'warden-config',
89
- properties,
90
- });
91
- }
92
- /** Parse a type-95 movement-violation server event. */
93
- parseViolation(bytes) {
94
- return parseMovementViolation(bytes);
95
- }
96
- async invoke(exportName, params) {
97
- const result = await this.engines.invoke(this.moduleName, exportName, params);
98
- if (!result.success) {
99
- throw new Error(`movement.${exportName} failed: ${result.reason ?? 'unknown'}`);
100
- }
101
- return result.body;
102
- }
103
- }
@@ -1,45 +0,0 @@
1
- import type { FunctionNotificationInput } from '../generated/graphql.js';
2
- /**
3
- * Builders for a model function's `notifications`, so the non-staleable shape is the easy
4
- * one to reach for.
5
- *
6
- * WHY THESE EXIST AT ALL, given the input is three lines of JSON. A channel notification
7
- * can name its target two ways, and only one of them survives the app being recreated or
8
- * moved between organizations. Membership is scoped to the app, so a function naming a
9
- * channel that belongs to a DIFFERENT app produces a notification that is built, signed,
10
- * sent to every server and then dropped for want of a recipient -- while the invoke
11
- * succeeds and the run records success, because emission is best-effort and never fails a
12
- * function. The only symptom is silence.
13
- *
14
- * That is not hypothetical: it is what a copied game model does, and the server now reports
15
- * it as the `notification_channel_foreign` lint error. A NAME is resolved per-invocation
16
- * against the app that is running, so it cannot go stale the way an id copied between apps
17
- * does. `sessionChannel` is the shape to prefer.
18
- */
19
- /**
20
- * Notify every client in the app's default session channel.
21
- *
22
- * `$session_channel_name` is injected by the server from the app the function is RUNNING
23
- * in, so this expression is correct in any app that ever holds this definition -- which is
24
- * the whole point. It is also the channel every SDK client joins on connect, so this is
25
- * "tell everyone playing" with nothing to configure and nothing to keep in sync.
26
- */
27
- export declare function sessionChannelNotification(payloadExpression: string): FunctionNotificationInput;
28
- /**
29
- * Notify a channel named by NAME rather than by id.
30
- *
31
- * Use this when the channel is not the session channel but is still derivable -- a lobby
32
- * per app, say, as `concat("lobby-", $app_id)`. Same property as above: resolved against
33
- * the running app, so a copied model addresses its new home.
34
- */
35
- export declare function namedChannelNotification(channelNameExpression: string, payloadExpression: string): FunctionNotificationInput;
36
- /**
37
- * Notify a channel named by id.
38
- *
39
- * Correct when the id is READ FROM MODEL STATE -- `self.channel_id` on a container that
40
- * owns its own channel is the shape the matches blueprint uses, and it is app-portable
41
- * because the property travels with the row. A LITERAL id is the one to avoid, and the
42
- * server's `notification_channel_foreign` lint error exists to catch it.
43
- */
44
- export declare function channelIdNotification(channelIdExpression: string, payloadExpression: string): FunctionNotificationInput;
45
- //# sourceMappingURL=notifications.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../src/kit/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEzE;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,iBAAiB,EAAE,MAAM,GACxB,yBAAyB,CAQ3B;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,qBAAqB,EAAE,MAAM,EAC7B,iBAAiB,EAAE,MAAM,GACxB,yBAAyB,CAQ3B;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,mBAAmB,EAAE,MAAM,EAC3B,iBAAiB,EAAE,MAAM,GACxB,yBAAyB,CAQ3B"}