@crowdedkingdoms/crowdyjs 17.14.0-dev.1 → 18.0.1-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 (289) hide show
  1. package/MIGRATION.md +129 -1
  2. package/README.md +97 -164
  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 +34 -59
  9. package/dist/crowdy-studio/controller.d.ts.map +1 -1
  10. package/dist/crowdy-studio/controller.js +96 -225
  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 -49
  16. package/dist/crowdy-studio/embed/hud-layer.d.ts +1 -2
  17. package/dist/crowdy-studio/embed/hud-layer.d.ts.map +1 -1
  18. package/dist/crowdy-studio/embed/panel.d.ts +3 -13
  19. package/dist/crowdy-studio/embed/panel.d.ts.map +1 -1
  20. package/dist/crowdy-studio/embed/panel.js +3 -6
  21. package/dist/crowdy-studio/index.d.ts +1 -3
  22. package/dist/crowdy-studio/index.d.ts.map +1 -1
  23. package/dist/crowdy-studio/index.js +0 -2
  24. package/dist/crowdy-studio/models.d.ts +3 -4
  25. package/dist/crowdy-studio/models.d.ts.map +1 -1
  26. package/dist/crowdy-studio/starter-projects.d.ts +8 -12
  27. package/dist/crowdy-studio/starter-projects.d.ts.map +1 -1
  28. package/dist/crowdy-studio/starter-projects.js +12 -103
  29. package/dist/domains/appAccess.d.ts +14 -1
  30. package/dist/domains/appAccess.d.ts.map +1 -1
  31. package/dist/domains/appAccess.js +37 -1
  32. package/dist/domains/apps.d.ts +1 -10
  33. package/dist/domains/apps.d.ts.map +1 -1
  34. package/dist/domains/apps.js +1 -16
  35. package/dist/domains/host.d.ts +3 -3
  36. package/dist/domains/host.js +3 -3
  37. package/dist/domains/hosting.d.ts +0 -6
  38. package/dist/domains/hosting.d.ts.map +1 -1
  39. package/dist/domains/hosting.js +1 -16
  40. package/dist/domains/marketplace.d.ts +9 -70
  41. package/dist/domains/marketplace.d.ts.map +1 -1
  42. package/dist/domains/marketplace.js +9 -120
  43. package/dist/domains/organizations.d.ts +1 -9
  44. package/dist/domains/organizations.d.ts.map +1 -1
  45. package/dist/domains/organizations.js +1 -15
  46. package/dist/domains/payments.d.ts +5 -48
  47. package/dist/domains/payments.d.ts.map +1 -1
  48. package/dist/domains/payments.js +5 -57
  49. package/dist/domains/playerWallet.d.ts +6 -12
  50. package/dist/domains/playerWallet.d.ts.map +1 -1
  51. package/dist/domains/playerWallet.js +6 -21
  52. package/dist/domains/quotas.d.ts +20 -7
  53. package/dist/domains/quotas.d.ts.map +1 -1
  54. package/dist/domains/quotas.js +15 -6
  55. package/dist/domains/users.d.ts +7 -74
  56. package/dist/domains/users.d.ts.map +1 -1
  57. package/dist/domains/users.js +7 -105
  58. package/dist/errors.d.ts +7 -13
  59. package/dist/errors.d.ts.map +1 -1
  60. package/dist/errors.js +6 -10
  61. package/dist/generated/graphql.d.ts +955 -8272
  62. package/dist/generated/graphql.d.ts.map +1 -1
  63. package/dist/generated/graphql.js +5 -329
  64. package/dist/grid-mods/exec-client-halves.d.ts +19 -3
  65. package/dist/grid-mods/exec-client-halves.d.ts.map +1 -1
  66. package/dist/grid-mods/exec-client-halves.js +17 -2
  67. package/dist/grid-mods/grid-host-calls.d.ts +29 -17
  68. package/dist/grid-mods/grid-host-calls.d.ts.map +1 -1
  69. package/dist/grid-mods/grid-host-calls.js +40 -46
  70. package/dist/grid-mods/mod-runtime.d.ts +18 -11
  71. package/dist/grid-mods/mod-runtime.d.ts.map +1 -1
  72. package/dist/grid-mods/mod-runtime.js +4 -2
  73. package/dist/grid-scope.d.ts +0 -189
  74. package/dist/grid-scope.d.ts.map +1 -1
  75. package/dist/grid-scope.js +0 -70
  76. package/dist/index.d.ts +12 -18
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +10 -16
  79. package/dist/kit/actions.d.ts +5 -9
  80. package/dist/kit/actions.d.ts.map +1 -1
  81. package/dist/kit/actions.js +5 -9
  82. package/dist/kit/index.d.ts +2 -33
  83. package/dist/kit/index.d.ts.map +1 -1
  84. package/dist/kit/index.js +1 -32
  85. package/dist/kit/kit.d.ts +8 -208
  86. package/dist/kit/kit.d.ts.map +1 -1
  87. package/dist/kit/kit.js +5 -163
  88. package/dist/kit/social.d.ts +1 -3
  89. package/dist/kit/social.d.ts.map +1 -1
  90. package/dist/kit/social.js +1 -3
  91. package/dist/kit/wire.d.ts +16 -5
  92. package/dist/kit/wire.d.ts.map +1 -1
  93. package/dist/kit/wire.js +19 -5
  94. package/dist/live-coding/assets/browser-authoring-index.json +1 -1
  95. package/dist/live-coding/assets/manifest.json +1 -1
  96. package/dist/live-coding/browser-authoring-index.generated.d.ts.map +1 -1
  97. package/dist/live-coding/browser-authoring-index.generated.js +1496 -4386
  98. package/dist/live-coding/rust-analysis.d.ts.map +1 -1
  99. package/dist/live-coding/rust-analysis.js +30 -34
  100. package/dist/player-runtime/client-host-calls.d.ts +8 -0
  101. package/dist/player-runtime/client-host-calls.d.ts.map +1 -0
  102. package/dist/player-runtime/client-host-calls.js +28 -0
  103. package/dist/player-runtime/glue-runtime.d.ts +24 -20
  104. package/dist/player-runtime/glue-runtime.d.ts.map +1 -1
  105. package/dist/player-runtime/glue-runtime.js +26 -55
  106. package/dist/player-runtime/glue-sab.d.ts +2 -2
  107. package/dist/player-runtime/glue-sab.js +2 -2
  108. package/dist/player-runtime/player-code-broker.d.ts +70 -43
  109. package/dist/player-runtime/player-code-broker.d.ts.map +1 -1
  110. package/dist/player-runtime/player-code-broker.js +159 -64
  111. package/dist/player-runtime/player-glue-worker.d.ts +8 -9
  112. package/dist/player-runtime/player-glue-worker.d.ts.map +1 -1
  113. package/dist/player-runtime/player-glue-worker.js +26 -11
  114. package/dist/stores/inbox.d.ts +1 -1
  115. package/dist/stores/inbox.d.ts.map +1 -1
  116. package/dist/stores/index.d.ts +0 -11
  117. package/dist/stores/index.d.ts.map +1 -1
  118. package/dist/stores/index.js +0 -4
  119. package/dist/stores/session.d.ts +0 -2
  120. package/dist/stores/session.d.ts.map +1 -1
  121. package/package.json +1 -1
  122. package/dist/crowdy-studio/model-lint-log.d.ts +0 -76
  123. package/dist/crowdy-studio/model-lint-log.d.ts.map +0 -1
  124. package/dist/crowdy-studio/model-lint-log.js +0 -93
  125. package/dist/crowdy-studio/model-lint.d.ts +0 -61
  126. package/dist/crowdy-studio/model-lint.d.ts.map +0 -1
  127. package/dist/crowdy-studio/model-lint.js +0 -45
  128. package/dist/domains/compute.d.ts +0 -208
  129. package/dist/domains/compute.d.ts.map +0 -1
  130. package/dist/domains/compute.js +0 -274
  131. package/dist/domains/controlPlane.d.ts +0 -38
  132. package/dist/domains/controlPlane.d.ts.map +0 -1
  133. package/dist/domains/controlPlane.js +0 -43
  134. package/dist/domains/gameModel.d.ts +0 -1174
  135. package/dist/domains/gameModel.d.ts.map +0 -1
  136. package/dist/domains/gameModel.js +0 -1333
  137. package/dist/domains/playerCompute.d.ts +0 -91
  138. package/dist/domains/playerCompute.d.ts.map +0 -1
  139. package/dist/domains/playerCompute.js +0 -136
  140. package/dist/domains/playerModel.d.ts +0 -20
  141. package/dist/domains/playerModel.d.ts.map +0 -1
  142. package/dist/domains/playerModel.js +0 -54
  143. package/dist/kit/abilities.d.ts +0 -66
  144. package/dist/kit/abilities.d.ts.map +0 -1
  145. package/dist/kit/abilities.js +0 -71
  146. package/dist/kit/blueprints/combat.d.ts +0 -81
  147. package/dist/kit/blueprints/combat.d.ts.map +0 -1
  148. package/dist/kit/blueprints/combat.js +0 -357
  149. package/dist/kit/blueprints/core.d.ts +0 -222
  150. package/dist/kit/blueprints/core.d.ts.map +0 -1
  151. package/dist/kit/blueprints/core.js +0 -185
  152. package/dist/kit/blueprints/decks.d.ts +0 -50
  153. package/dist/kit/blueprints/decks.d.ts.map +0 -1
  154. package/dist/kit/blueprints/decks.js +0 -163
  155. package/dist/kit/blueprints/economy.d.ts +0 -88
  156. package/dist/kit/blueprints/economy.d.ts.map +0 -1
  157. package/dist/kit/blueprints/economy.js +0 -533
  158. package/dist/kit/blueprints/guild.d.ts +0 -51
  159. package/dist/kit/blueprints/guild.d.ts.map +0 -1
  160. package/dist/kit/blueprints/guild.js +0 -50
  161. package/dist/kit/blueprints/index.d.ts +0 -23
  162. package/dist/kit/blueprints/index.d.ts.map +0 -1
  163. package/dist/kit/blueprints/index.js +0 -22
  164. package/dist/kit/blueprints/inventory.d.ts +0 -84
  165. package/dist/kit/blueprints/inventory.d.ts.map +0 -1
  166. package/dist/kit/blueprints/inventory.js +0 -257
  167. package/dist/kit/blueprints/leaderboards.d.ts +0 -49
  168. package/dist/kit/blueprints/leaderboards.d.ts.map +0 -1
  169. package/dist/kit/blueprints/leaderboards.js +0 -126
  170. package/dist/kit/blueprints/liveops.d.ts +0 -42
  171. package/dist/kit/blueprints/liveops.d.ts.map +0 -1
  172. package/dist/kit/blueprints/liveops.js +0 -170
  173. package/dist/kit/blueprints/locks.d.ts +0 -82
  174. package/dist/kit/blueprints/locks.d.ts.map +0 -1
  175. package/dist/kit/blueprints/locks.js +0 -155
  176. package/dist/kit/blueprints/loot.d.ts +0 -90
  177. package/dist/kit/blueprints/loot.d.ts.map +0 -1
  178. package/dist/kit/blueprints/loot.js +0 -229
  179. package/dist/kit/blueprints/matches.d.ts +0 -84
  180. package/dist/kit/blueprints/matches.d.ts.map +0 -1
  181. package/dist/kit/blueprints/matches.js +0 -349
  182. package/dist/kit/blueprints/moderation.d.ts +0 -32
  183. package/dist/kit/blueprints/moderation.d.ts.map +0 -1
  184. package/dist/kit/blueprints/moderation.js +0 -140
  185. package/dist/kit/blueprints/npcs.d.ts +0 -78
  186. package/dist/kit/blueprints/npcs.d.ts.map +0 -1
  187. package/dist/kit/blueprints/npcs.js +0 -125
  188. package/dist/kit/blueprints/plots.d.ts +0 -63
  189. package/dist/kit/blueprints/plots.d.ts.map +0 -1
  190. package/dist/kit/blueprints/plots.js +0 -151
  191. package/dist/kit/blueprints/progression.d.ts +0 -68
  192. package/dist/kit/blueprints/progression.d.ts.map +0 -1
  193. package/dist/kit/blueprints/progression.js +0 -324
  194. package/dist/kit/blueprints/quests.d.ts +0 -72
  195. package/dist/kit/blueprints/quests.d.ts.map +0 -1
  196. package/dist/kit/blueprints/quests.js +0 -285
  197. package/dist/kit/blueprints/worldsim.d.ts +0 -91
  198. package/dist/kit/blueprints/worldsim.d.ts.map +0 -1
  199. package/dist/kit/blueprints/worldsim.js +0 -468
  200. package/dist/kit/combat.d.ts +0 -141
  201. package/dist/kit/combat.d.ts.map +0 -1
  202. package/dist/kit/combat.js +0 -196
  203. package/dist/kit/decks.d.ts +0 -157
  204. package/dist/kit/decks.d.ts.map +0 -1
  205. package/dist/kit/decks.js +0 -186
  206. package/dist/kit/director.d.ts +0 -88
  207. package/dist/kit/director.d.ts.map +0 -1
  208. package/dist/kit/director.js +0 -86
  209. package/dist/kit/economy.d.ts +0 -289
  210. package/dist/kit/economy.d.ts.map +0 -1
  211. package/dist/kit/economy.js +0 -427
  212. package/dist/kit/engine.d.ts +0 -48
  213. package/dist/kit/engine.d.ts.map +0 -1
  214. package/dist/kit/engine.js +0 -113
  215. package/dist/kit/features.d.ts +0 -60
  216. package/dist/kit/features.d.ts.map +0 -1
  217. package/dist/kit/features.js +0 -65
  218. package/dist/kit/instances.d.ts +0 -52
  219. package/dist/kit/instances.d.ts.map +0 -1
  220. package/dist/kit/instances.js +0 -60
  221. package/dist/kit/inventory.d.ts +0 -129
  222. package/dist/kit/inventory.d.ts.map +0 -1
  223. package/dist/kit/inventory.js +0 -200
  224. package/dist/kit/leaderboards.d.ts +0 -86
  225. package/dist/kit/leaderboards.d.ts.map +0 -1
  226. package/dist/kit/leaderboards.js +0 -133
  227. package/dist/kit/liveops.d.ts +0 -112
  228. package/dist/kit/liveops.d.ts.map +0 -1
  229. package/dist/kit/liveops.js +0 -183
  230. package/dist/kit/loot.d.ts +0 -128
  231. package/dist/kit/loot.d.ts.map +0 -1
  232. package/dist/kit/loot.js +0 -160
  233. package/dist/kit/matches.d.ts +0 -301
  234. package/dist/kit/matches.d.ts.map +0 -1
  235. package/dist/kit/matches.js +0 -458
  236. package/dist/kit/matchmaking.d.ts +0 -57
  237. package/dist/kit/matchmaking.d.ts.map +0 -1
  238. package/dist/kit/matchmaking.js +0 -59
  239. package/dist/kit/minigames.d.ts +0 -30
  240. package/dist/kit/minigames.d.ts.map +0 -1
  241. package/dist/kit/minigames.js +0 -38
  242. package/dist/kit/mobs.d.ts +0 -90
  243. package/dist/kit/mobs.d.ts.map +0 -1
  244. package/dist/kit/mobs.js +0 -98
  245. package/dist/kit/moderation.d.ts +0 -73
  246. package/dist/kit/moderation.d.ts.map +0 -1
  247. package/dist/kit/moderation.js +0 -103
  248. package/dist/kit/movement.d.ts +0 -78
  249. package/dist/kit/movement.d.ts.map +0 -1
  250. package/dist/kit/movement.js +0 -103
  251. package/dist/kit/notifications.d.ts +0 -45
  252. package/dist/kit/notifications.d.ts.map +0 -1
  253. package/dist/kit/notifications.js +0 -67
  254. package/dist/kit/npcs.d.ts +0 -226
  255. package/dist/kit/npcs.d.ts.map +0 -1
  256. package/dist/kit/npcs.js +0 -141
  257. package/dist/kit/objects.d.ts +0 -116
  258. package/dist/kit/objects.d.ts.map +0 -1
  259. package/dist/kit/objects.js +0 -119
  260. package/dist/kit/pets.d.ts +0 -85
  261. package/dist/kit/pets.d.ts.map +0 -1
  262. package/dist/kit/pets.js +0 -96
  263. package/dist/kit/plots.d.ts +0 -85
  264. package/dist/kit/plots.d.ts.map +0 -1
  265. package/dist/kit/plots.js +0 -113
  266. package/dist/kit/progression.d.ts +0 -181
  267. package/dist/kit/progression.d.ts.map +0 -1
  268. package/dist/kit/progression.js +0 -265
  269. package/dist/kit/quests.d.ts +0 -171
  270. package/dist/kit/quests.d.ts.map +0 -1
  271. package/dist/kit/quests.js +0 -237
  272. package/dist/kit/racing.d.ts +0 -85
  273. package/dist/kit/racing.d.ts.map +0 -1
  274. package/dist/kit/racing.js +0 -99
  275. package/dist/kit/shared.d.ts +0 -73
  276. package/dist/kit/shared.d.ts.map +0 -1
  277. package/dist/kit/shared.js +0 -101
  278. package/dist/kit/telemetry.d.ts +0 -66
  279. package/dist/kit/telemetry.d.ts.map +0 -1
  280. package/dist/kit/telemetry.js +0 -133
  281. package/dist/kit/territory.d.ts +0 -97
  282. package/dist/kit/territory.d.ts.map +0 -1
  283. package/dist/kit/territory.js +0 -114
  284. package/dist/kit/worldsim.d.ts +0 -263
  285. package/dist/kit/worldsim.d.ts.map +0 -1
  286. package/dist/kit/worldsim.js +0 -268
  287. package/dist/stores/model.d.ts +0 -81
  288. package/dist/stores/model.d.ts.map +0 -1
  289. 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;
89
- }
90
- //# sourceMappingURL=mobs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mobs.d.ts","sourceRoot":"","sources":["../../src/kit/mobs.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,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtE,OAAO,EAAsB,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAExE,uEAAuE;AACvE,MAAM,WAAW,cAAc;IAC7B,oFAAoF;IACpF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,yCAAyC;AACzC,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED,iFAAiF;AACjF,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,E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,OAAO,EAAE,UAAU,GAAG,kBAAkB,GAAG,IAAI;CAGnE"}
package/dist/kit/mobs.js DELETED
@@ -1,98 +0,0 @@
1
- import { kitContainerProperties } from './shared.js';
2
- import { parseContactDamage } from './wire.js';
3
- /**
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;AA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AM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQxE,8DAA8D;IACxD,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;QAAE,WAAW,EAAE,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,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
- * 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"}