@datamoc/mw_games 0.7.8 → 0.8.0

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 (137) hide show
  1. package/CHANGELOG.md +178 -0
  2. package/README.md +21 -0
  3. package/dist/assets/index.d.ts +1 -1
  4. package/dist/assets/index.d.ts.map +1 -1
  5. package/dist/assets/index.js +1 -1
  6. package/dist/assets/index.js.map +1 -1
  7. package/dist/assets/loader.d.ts.map +1 -1
  8. package/dist/assets/loader.js +10 -1
  9. package/dist/assets/loader.js.map +1 -1
  10. package/dist/assets/paths.d.ts +23 -0
  11. package/dist/assets/paths.d.ts.map +1 -1
  12. package/dist/assets/paths.js +29 -0
  13. package/dist/assets/paths.js.map +1 -1
  14. package/dist/core/Math.d.ts +14 -0
  15. package/dist/core/Math.d.ts.map +1 -0
  16. package/dist/core/Math.js +16 -0
  17. package/dist/core/Math.js.map +1 -0
  18. package/dist/core/index.d.ts +1 -0
  19. package/dist/core/index.d.ts.map +1 -1
  20. package/dist/core/index.js +1 -0
  21. package/dist/core/index.js.map +1 -1
  22. package/dist/mw_games.global.js +102 -102
  23. package/dist/mwl/catalog.d.ts +18 -2
  24. package/dist/mwl/catalog.d.ts.map +1 -1
  25. package/dist/mwl/catalog.js +0 -0
  26. package/dist/mwl/catalog.js.map +1 -1
  27. package/dist/mwl/content.d.ts +4 -0
  28. package/dist/mwl/content.d.ts.map +1 -1
  29. package/dist/mwl/content.js +2 -0
  30. package/dist/mwl/content.js.map +1 -1
  31. package/dist/mwl/grammar.d.ts.map +1 -1
  32. package/dist/mwl/grammar.js +37 -0
  33. package/dist/mwl/grammar.js.map +1 -1
  34. package/dist/mwl/hooks.d.ts +42 -1
  35. package/dist/mwl/hooks.d.ts.map +1 -1
  36. package/dist/mwl/hooks.js +41 -0
  37. package/dist/mwl/hooks.js.map +1 -1
  38. package/dist/mwl/index.d.ts +4 -4
  39. package/dist/mwl/index.d.ts.map +1 -1
  40. package/dist/mwl/index.js +2 -2
  41. package/dist/mwl/index.js.map +1 -1
  42. package/dist/mwl/runtime.d.ts +9 -0
  43. package/dist/mwl/runtime.d.ts.map +1 -1
  44. package/dist/mwl/runtime.js +70 -9
  45. package/dist/mwl/runtime.js.map +1 -1
  46. package/dist/mwl/schema.d.ts +33 -1
  47. package/dist/mwl/schema.d.ts.map +1 -1
  48. package/dist/mwl/schema.js +70 -10
  49. package/dist/mwl/schema.js.map +1 -1
  50. package/dist/roguelike/Targeting.d.ts +35 -0
  51. package/dist/roguelike/Targeting.d.ts.map +1 -1
  52. package/dist/roguelike/Targeting.js +72 -0
  53. package/dist/roguelike/Targeting.js.map +1 -1
  54. package/dist/roguelike/index.d.ts +2 -0
  55. package/dist/roguelike/index.d.ts.map +1 -1
  56. package/dist/roguelike/index.js +1 -0
  57. package/dist/roguelike/index.js.map +1 -1
  58. package/dist/rpg/Collision.d.ts.map +1 -1
  59. package/dist/rpg/Collision.js +1 -3
  60. package/dist/rpg/Collision.js.map +1 -1
  61. package/dist/two-d/pixi-interop.d.ts +28 -10
  62. package/dist/two-d/pixi-interop.d.ts.map +1 -1
  63. package/dist/two-d/pixi-interop.js +36 -10
  64. package/dist/two-d/pixi-interop.js.map +1 -1
  65. package/dist/two-d/render/Camera.d.ts +11 -0
  66. package/dist/two-d/render/Camera.d.ts.map +1 -1
  67. package/dist/two-d/render/Camera.js +14 -3
  68. package/dist/two-d/render/Camera.js.map +1 -1
  69. package/dist/two-d/render/ImageModifiers.d.ts +40 -0
  70. package/dist/two-d/render/ImageModifiers.d.ts.map +1 -1
  71. package/dist/two-d/render/ImageModifiers.js +47 -0
  72. package/dist/two-d/render/ImageModifiers.js.map +1 -1
  73. package/dist/two-d/render/PaletteRemap.d.ts.map +1 -1
  74. package/dist/two-d/render/PaletteRemap.js +12 -1
  75. package/dist/two-d/render/PaletteRemap.js.map +1 -1
  76. package/dist/two-d/render/Particles.d.ts +30 -9
  77. package/dist/two-d/render/Particles.d.ts.map +1 -1
  78. package/dist/two-d/render/Particles.js +42 -7
  79. package/dist/two-d/render/Particles.js.map +1 -1
  80. package/dist/two-d/render/Projectile.d.ts +16 -0
  81. package/dist/two-d/render/Projectile.d.ts.map +1 -1
  82. package/dist/two-d/render/Projectile.js +14 -0
  83. package/dist/two-d/render/Projectile.js.map +1 -1
  84. package/dist/two-d/render/ScreenEffects.d.ts +42 -4
  85. package/dist/two-d/render/ScreenEffects.d.ts.map +1 -1
  86. package/dist/two-d/render/ScreenEffects.js +64 -9
  87. package/dist/two-d/render/ScreenEffects.js.map +1 -1
  88. package/dist/two-d/render/Shape2D.d.ts +22 -2
  89. package/dist/two-d/render/Shape2D.d.ts.map +1 -1
  90. package/dist/two-d/render/Shape2D.js +31 -2
  91. package/dist/two-d/render/Shape2D.js.map +1 -1
  92. package/dist/two-d/render/SpriteSheet.d.ts +19 -3
  93. package/dist/two-d/render/SpriteSheet.d.ts.map +1 -1
  94. package/dist/two-d/render/SpriteSheet.js +26 -5
  95. package/dist/two-d/render/SpriteSheet.js.map +1 -1
  96. package/dist/two-d/render/StatusVisuals.d.ts +41 -23
  97. package/dist/two-d/render/StatusVisuals.d.ts.map +1 -1
  98. package/dist/two-d/render/StatusVisuals.js +65 -26
  99. package/dist/two-d/render/StatusVisuals.js.map +1 -1
  100. package/dist/two-d/render/index.d.ts +2 -2
  101. package/dist/two-d/render/index.d.ts.map +1 -1
  102. package/dist/two-d/render/index.js +2 -2
  103. package/dist/two-d/render/index.js.map +1 -1
  104. package/dist/two-d/ui/ListView.d.ts +9 -0
  105. package/dist/two-d/ui/ListView.d.ts.map +1 -1
  106. package/dist/two-d/ui/ListView.js +16 -6
  107. package/dist/two-d/ui/ListView.js.map +1 -1
  108. package/dist/two-d/ui/MarkupText.d.ts +14 -1
  109. package/dist/two-d/ui/MarkupText.d.ts.map +1 -1
  110. package/dist/two-d/ui/MarkupText.js +45 -11
  111. package/dist/two-d/ui/MarkupText.js.map +1 -1
  112. package/dist/two-d/ui/MessageBox.d.ts +10 -1
  113. package/dist/two-d/ui/MessageBox.d.ts.map +1 -1
  114. package/dist/two-d/ui/MessageBox.js +4 -1
  115. package/dist/two-d/ui/MessageBox.js.map +1 -1
  116. package/dist/two-d/ui/RichLabel.d.ts +7 -1
  117. package/dist/two-d/ui/RichLabel.d.ts.map +1 -1
  118. package/dist/two-d/ui/RichLabel.js +20 -9
  119. package/dist/two-d/ui/RichLabel.js.map +1 -1
  120. package/dist/two-d/ui/Window.d.ts +37 -1
  121. package/dist/two-d/ui/Window.d.ts.map +1 -1
  122. package/dist/two-d/ui/Window.js +55 -2
  123. package/dist/two-d/ui/Window.js.map +1 -1
  124. package/dist/two-d/ui/WindowStack.d.ts +24 -2
  125. package/dist/two-d/ui/WindowStack.d.ts.map +1 -1
  126. package/dist/two-d/ui/WindowStack.js +22 -1
  127. package/dist/two-d/ui/WindowStack.js.map +1 -1
  128. package/dist/two-d/ui/markup.d.ts +9 -1
  129. package/dist/two-d/ui/markup.d.ts.map +1 -1
  130. package/dist/two-d/ui/markup.js +20 -3
  131. package/dist/two-d/ui/markup.js.map +1 -1
  132. package/dist/version.d.ts +1 -1
  133. package/dist/version.js +1 -1
  134. package/package.json +5 -1
  135. package/tools/classic-html.d.mts +6 -0
  136. package/tools/classic-html.mjs +61 -0
  137. package/tools/mwl.mjs +12 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,184 @@ All notable changes to `mwg` are documented here. Format follows
5
5
  [Semantic Versioning](https://semver.org/) as of this first release - a 0.y.z version means
6
6
  the public API may still change between minor versions.
7
7
 
8
+ ## [Unreleased]
9
+
10
+ ## [0.8.0] - 2026-09-12
11
+
12
+ ### Added
13
+
14
+ - `MwlHookDeclaration` and `validateHookAttributes` (item 321), plus `validAttributeValue`/
15
+ `attributeTypeDescription`: a hook declares the attributes its own `[hook]` calls carry, and
16
+ `validateCatalog`'s `hooks` option takes that declaration where a bare `type:name` id used to
17
+ be the only accepted shape. A typo in a hook attribute is now a compile-time `MWL_VALUE` or
18
+ `MWL_UNKNOWN_ATTRIBUTE` instead of a throw mid-scenario. The tag schema's own value check now
19
+ calls the same two exported functions, so the two cannot disagree.
20
+ - `HookWorld.variableAt(path)` (item 319): the read that matches `Emit.setVariable`'s write, both
21
+ resolving a nested variable through the same walker `[variable] name=` uses, so a hook no
22
+ longer has to cast away `Readonly` and walk paths itself (which produced flat dotted keys no
23
+ reader finds). `Emit.setVariable` is documented as the write half. Any game implementing its
24
+ own `HookWorld` must now provide the method; only the runtime constructs one today.
25
+ - `[set_variable] path=` (item 318), on both spellings: the computed target a converter needs for
26
+ a dynamic name, expanded from `$name`/`$(expression)` references before the same path walker a
27
+ literal `name=` uses resolves it. `name=`/`target=` keep their literal meaning.
28
+ - `[set_variable] mode=literal|number|expression` (item 316), on both spellings of the effect
29
+ (`[set_variable]` and `[command] name="set_variable"`): content declares what its own `value=`
30
+ means instead of `MwlRuntime` inferring it from the text. `literal` keeps the text exactly as
31
+ written, `number` parses it and throws on anything that is not one, `expression` evaluates it
32
+ through the same context `[if] test=` uses. A value with no `mode` is inferred as before, so
33
+ hand-authored content is unaffected.
34
+ - `mwl.MwlAttributeType` (item 316): a schema attribute's type may be the closed list of values
35
+ it accepts, not only one of the shared value types. A value outside the list is a compile-time
36
+ `MWL_VALUE` diagnostic naming the alternatives.
37
+ - `key="""..."""` attribute values (item 317): the one form that may span lines, taken exactly
38
+ as written, so wrapped message, objective and option-label text no longer needs a converter to
39
+ collapse its whitespace. The `_` gettext marker applies to it as to any other value.
40
+ - `roguelike.coneSector` (item 322): a circular sector aimed at an angle. Rays are cast every 0.5
41
+ degrees across an arc of `degrees`, each clamped to `range` and stopped by the first wall, so a
42
+ wall shadows the part of the cone behind it while the rest still reaches. `coneCells` snaps the
43
+ aim to one of the eight directions and sprays linearly from there; a sector keeps the angle it
44
+ was aimed at, which is what a breath weapon, a searchlight or a gas cloud wants. It needs the
45
+ level - that is what stops its rays - so it is a function rather than one of `AreaShape`'s kinds,
46
+ whose resolver works without one. Ray offsets round away from zero, so a sector aimed along an
47
+ axis is exactly symmetric rather than a cell wider on one side. Six tests in
48
+ `tests/targeting-shapes.test.ts`.
49
+ - `ParticleEmitter` colour ranges, curves and flicker (item 323): `tint` takes a `[from, to]` pair
50
+ each particle draws its own colour from (mixed channel by channel, where interpolating the packed
51
+ value would carry from one channel into the next), `scale`/`alpha` take a `ParticleCurve` of the
52
+ particle's own age instead of only the birth-to-death pair, and `flicker` multiplies the scale by
53
+ a seeded draw every frame, which is a torch's wobble rather than its fade. Each of those draws
54
+ happens only when its option is used, so an existing seeded spray is unchanged, and reduced
55
+ motion drops the flicker along with the travel. Five tests in `tests/particles.test.ts`.
56
+ - `Window({ blocker: true })` (item 324): a full-viewport child under the window's chrome that
57
+ swallows clicks, so a window over a map or a toolbar stops passing them to what is underneath,
58
+ and dismisses the window when the click lands outside it. A window's own widgets are hit first,
59
+ and a click on the frame or an empty part of the body is swallowed without dismissing, so the
60
+ body is never a close button by accident. `handleOutsideClick(x, y)` is that decision on its own,
61
+ headless-testable the way `handleAction` is. Off by default: it changes what the whole screen
62
+ answers to. Seven tests in `tests/window-blocker.test.ts`.
63
+ - `WindowStack.handleAction(action)` is public (item 325): a scene with its own keyboard handling
64
+ can now ask the windows before acting, instead of discovering that registration order decided it.
65
+ `Input.onAction` offers an action to the most recently registered listener first, and the stack
66
+ registers in its constructor, so a scene that builds its stack in `create()` and registers a
67
+ handler after it is offered every key before the open window is, and returning true for one takes
68
+ it away from the window. The class doc spells the race out and gives the one-line chain
69
+ (`stack.handleAction(action) || myOwnHandling(action)`), and the same doc now says what a scene
70
+ that does not chain has to do instead. `Window`'s own doc gains the other half: its frame and
71
+ empty body are not clickable, which `blocker` is the option that changes. Three tests in
72
+ `tests/window-stack-routing.test.ts`.
73
+ - `SpriteSheet.rect(index, x, y, width, height)` (item 326): arbitrary rectangles for the sheets
74
+ that are not grids - a hand-packed icon atlas, a strip of bar segments, a nine-patch's corners,
75
+ an item whose art is smaller than its cell. A rect is cached under its index exactly like a grid
76
+ frame, so `get`/`region`/`name`/`pick` treat it as one and asking twice returns the same
77
+ `Texture`, where the hand-written path built a fresh one per site (about twenty of them in the
78
+ port, plus its own helper). Declaring a rect over a grid index replaces that frame, which is what
79
+ a tightened sub-rect is. `grid`/`fromTexture` now take no frame size at all, leaving a sheet with
80
+ no grid and only the rects declared on it. Five tests in `tests/sprite-sheet-rects.test.ts`.
81
+
82
+ ### Changed
83
+
84
+ - `MessageBox` swallows clicks by default (item 324), through the same `blocker` layer: a box with
85
+ a page still to read, or a choice to answer, is not something a click on the world should be able
86
+ to act past. It is not closable, so this can only ever swallow a click, never dismiss the box,
87
+ and `blocker: false` is the opt-out for a box the player is meant to click past (the same case
88
+ `dims: false` is for). `examples/interface` uses both new halves: its bag window takes
89
+ `blocker: true`, and its map handler now asks `windows.handleAction` rather than relying on
90
+ having registered before the stack did.
91
+ - `sbom.cdx.json` carries a `serialNumber` (item 315): a version-5 UUID over the document's own
92
+ content, so it stays stable for a given lockfile and changes when the dependency set does, which
93
+ keeps the drift check and gives the serial the meaning CycloneDX asks of it. `metadata.timestamp`
94
+ stays absent on purpose: a generation time stamped into a committed file is one stale moment
95
+ every later read is dated to, and `CHANGELOG.md` already dates each version.
96
+
97
+ ## [0.7.9] - 2026-09-12
98
+
99
+ ### Added
100
+
101
+ - `tools/sbom.mjs` with `npm run sbom`/`npm run sbom:check` (item 315): a CycloneDX 1.6 SBOM
102
+ (`sbom.cdx.json`) for the framework, built from `package.json` and `package-lock.json` alone
103
+ with no network access or added dependency, and checked in CI so a dependency change moves the
104
+ supply-chain document with it.
105
+ - `core.clamp`, replacing two byte-identical private `clamp` helpers in `rpg.Collision` and
106
+ `two-d.render.Camera`.
107
+ - `two-d/pixi-interop`'s `registerBuiltinPipes()` (item 297), plus re-exporting
108
+ `TilingSpritePipe`/`NineSliceSpritePipe` themselves, for a consumer bundler that tree-shook
109
+ a built-in Pixi pipe away despite importing the full `pixi.js` package.
110
+ - `ui.ListView.tapRow(index)` (item 299), the `IconGrid.tapCell`-shaped public method for the
111
+ select-and-confirm-in-one-step tap a row's own `pointerdown` handler already did.
112
+ - `assets.setAssetMap(map)` (item 300): hands `resolve`/`has`/`paths`/`isCompiled` a game's
113
+ own path-to-URI map directly, taking priority over `window.__MWG_ASSETS__` while set, for a
114
+ game whose own bundler compiles assets a different way than `tools/compile-resources`.
115
+ - `two-d.render.StatusVisuals.flash(color, strength, duration)` (item 301): a one-shot,
116
+ linearly-decaying additive pulse layered on top of whatever statuses are active.
117
+ - `two-d.render.ScreenEffects.sequence(steps)` and a new `hold` phase (item 302): chains
118
+ fade/hold/flash steps end to end as one call, for the hold-then-fade-back transition
119
+ `fadeOut`/`fadeIn`/`flash` alone cannot express; `update` keeps returning false at every
120
+ step boundary, true only once the whole sequence finishes.
121
+ - `two-d.render.Camera.shakeScreen(intensity, duration)` (item 303): `shake` taking screen
122
+ pixels instead of world units.
123
+ - `mwl.MwlValidationOptions.rowIdScope` (item 304): `'file'` scopes `MWL_DUPLICATE_ID`'s
124
+ `tag:id` key per source file instead of the whole compiled catalog, for a game whose id
125
+ convention reuses ids across files on purpose.
126
+ - `two-d.render.spriteColorMatrix(sprite, matrix)` (item 309): attaches any of
127
+ `blendMatrix`/`channelScaleMatrix`/`channelSwapMatrix`/`colorShiftMatrix` (or a game's own
128
+ matrix) to a sprite as a `ColorMatrixFilter`, without needing a direct `pixi.js` import just
129
+ to construct that one class.
130
+ - `assets.load` now supplies Pixi's `Assets.add` a `format` hint (the original path's own
131
+ extension) whenever the resolved `src` is a compiled build's `data:` URI (item 308), since
132
+ the URI itself carries no extension for Pixi's resolver to pick a parser from. No new
133
+ argument: a game still calls `load(['tiles.png'])` exactly as before.
134
+ - `[item]` accepts `image`/`icon` (item 307), carried through
135
+ `MwlItemDefinition.image`/`.icon`; both were already recognised as asset attributes by the
136
+ manifest scanner, so this closes the schema gate that was blocking them.
137
+ - `tools/classic-html.mjs`'s `toClassicScript(html)` (item 306), shipped in the npm package:
138
+ rewrites a bundler build's `<script type="module">` entry tag to a classic deferred one, so
139
+ the page opens via `file://`. `tools/emit-page.mjs` now uses it too, instead of its own copy
140
+ of the same rewrite.
141
+ - `two-d.render.applyAllImageModifiers(sprite, parsed, probe?, scale?)` (item 310): runs
142
+ `applyTextureModifiers`'s exact pixel-level baking and `applyImageModifiers`'s sprite-level
143
+ modifiers in the order a caller with a `~BLEND`/`~ROTATE` path needs, so the two no longer
144
+ have to be driven by hand.
145
+ - `two-d.render.createLayers(parent, names)` (item 312): builds one labeled `Node2D` per name,
146
+ attached to `parent` in the order given and returned keyed by name, for the conventionally
147
+ ordered layer stack (terrain, units, effects, UI, ...) a game otherwise hand-wires.
148
+ - `ui.RichLabel`/`ui.MarkupText` take `tagStyles` (item 313), the same custom-inline-tag option a
149
+ bare `Text2D` takes. `markup.parseMarkup` gained `MarkupOptions.tags` and a `MarkupSpan.tag`
150
+ field so the parser stays renderer-neutral: `MarkupText` applies each tag's Pixi style to its
151
+ run and measures under it, while `RichLabel` keeps a registered tag as a real element for
152
+ `HTMLText` and still escapes an unregistered one.
153
+ - `two-d.render.Projectile` takes an optional `animation` (item 311): the projectile advances
154
+ the flight frames with its own elapsed time and reports the current one through
155
+ `frame`/`frameOffset`, so a missile with `[missile_frame]` art no longer needs a parallel
156
+ animation and clock kept in step by the game.
157
+
158
+ ### Changed
159
+
160
+ - **Breaking:** `two-d.render.StatusVisuals` now composes every active status's colour
161
+ additively (each channel clipping at 1) instead of one status winning by declaration order,
162
+ and never writes the multiply `tint` any more, so a sprite's own identity tint survives
163
+ underneath (item 301). `TintTarget` is now just `{ colorAdd: number }`; `lerpTint`/
164
+ `resetColor` are no longer part of its contract.
165
+
166
+ ### Fixed
167
+
168
+ - Documented, in `tools/mwl.mjs` and README's MWL section, that a game needing more than
169
+ `mwl build`'s three standard files should write its own build script against the public MWL
170
+ library API rather than look for a CLI flag (item 305).
171
+ - Corrected two contradictory doc comments (item 298): `Shape2D.ts` claimed `Container2D` was
172
+ a type alias a game could not `new`, when it is a value re-export and always was; and
173
+ `pixi-interop.ts`'s "no registration needed" guarantee is `pixi.js`'s own `sideEffects` list
174
+ surviving the consumer's own bundler, not a universal property.
175
+ - `withTextureCanvas`'s pixel-level modifiers (`~BLIT`/`~MASK`/`~BLEND`/`~ROTATE` in
176
+ `applyTextureModifiers`, and `recolorTexture`) called a real
177
+ `CanvasRenderingContext2D.putImageData` with a plain `{data, width, height}` object, which a
178
+ real browser rejects (it needs an actual `ImageData`); a test-supplied `probe.createCanvas`
179
+ never hit the real canvas path, so the bug had no unit-test coverage. `withTextureCanvas` now
180
+ wraps the real context's `putImageData` to build a proper `ImageData` itself, so every
181
+ pixel-level modifier keeps writing the same plain object.
182
+ - `[filter]`/`[have_unit]` `x`/`y` now accept the comma-separated lists and inclusive ranges
183
+ (`x=1,2,4-5`) a moveto event's own `x`/`y` already did (item 314); the schema types them
184
+ `coordinate` and `unitMatchesFilter` reads them through the one `coordinateMatches`.
185
+
8
186
  ## [0.7.8] - 2026-09-12
9
187
 
10
188
  ### Added
package/README.md CHANGED
@@ -145,6 +145,16 @@ is synchronous. Game code never awaits an asset. The developer-side scripts behi
145
145
  and the other workflows (translation editing, benchmarks, packaging) are listed in
146
146
  [tools.md](https://github.com/datamoc/mwg/blob/main/tools.md).
147
147
 
148
+ A game built with its own bundler (Vite, say, rather than this repo's own `vite.lib.config.ts`
149
+ IIFE) hits the same ES-module block on its own entry tag - a bundler's default output is
150
+ `<script type="module" crossorigin src="...">`, which `file://` refuses the same way. Rather
151
+ than every such game reinventing that one rewrite (item 306),
152
+ `tools/classic-html.mjs`'s `toClassicScript(html)` does it: given the built page's HTML, it
153
+ returns the same HTML with that tag rewritten to `<script defer src="...">`, or `null` when it
154
+ finds no such tag - the guard against running it against an unbuilt dev template by mistake.
155
+ The bundle itself still has to already be a classic script (an IIFE or UMD build, not further
156
+ ES module output); this only rewrites the tag pointing at it.
157
+
148
158
  ## Capability spec
149
159
 
150
160
  The definition of done for 1.0, drawn from what each of the nine references actually
@@ -425,6 +435,17 @@ saves. Asset attributes such as `image`, `image_icon`, `profile`, `icon`, `file`
425
435
  sound lists, Wesnoth sound ranges such as `human-hit-[1~5].ogg`, and image
426
436
  modifiers. Nested transform arguments are not mistaken for separate assets.
427
437
  Item slots, formulas, hooks, and business rules remain defined by the game.
438
+ `[item]` itself carries `image`/`icon` (item 307), so an inventory item can author its own
439
+ sprite or icon the same way `[monster]`/`[unit_type]`/`[object]`/`[story]` already could; the
440
+ manifest scanner recognised these names on any node before the schema let `[item]` use them,
441
+ so this only closes that one gate rather than adding new asset-collection behaviour.
442
+
443
+ A game needing more than `mwl build`'s three standard files - its own extra generated module,
444
+ or a cross-table check this CLI has no flag for - should not look for a flag to add: every
445
+ function that command calls (`compileSources`, `emitArtifacts`, `validateCatalog`,
446
+ `contentReport`) is public from `@datamoc/mw_games/mwl`, so that game's own small Node build
447
+ script, written against the same library API `tools/mwl.mjs` itself uses, is the extension
448
+ point (item 305).
428
449
 
429
450
  Campaign metadata can be authored with a `[campaign]` tag inside `[game]`. It requires an
430
451
  `id` and accepts `name`, `title`, `description`, and `start_scene`; scenario and extension
@@ -10,7 +10,7 @@
10
10
  * `@datamoc/mw_games/assets/paths` or `@datamoc/mw_games/assets/binary` instead and pays
11
11
  * nothing for Pixi.
12
12
  */
13
- export { setBase, isCompiled, paths, has, resolve } from './paths.ts';
13
+ export { setBase, setAssetMap, isCompiled, paths, has, resolve } from './paths.ts';
14
14
  export type { AssetProgress } from './paths.ts';
15
15
  export { load, texture, get, isLoaded, release } from './loader.ts';
16
16
  export { loadBinary, getBinary, isBinaryLoaded, releaseBinary } from './binary.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/assets/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACtE,YAAY,EAAE,aAAa,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@
10
10
  * `@datamoc/mw_games/assets/paths` or `@datamoc/mw_games/assets/binary` instead and pays
11
11
  * nothing for Pixi.
12
12
  */
13
- export { setBase, isCompiled, paths, has, resolve } from './paths.js';
13
+ export { setBase, setAssetMap, isCompiled, paths, has, resolve } from './paths.js';
14
14
  export { load, texture, get, isLoaded, release } from './loader.js';
15
15
  export { loadBinary, getBinary, isBinaryLoaded, releaseBinary } from './binary.js';
16
16
  export { AssetStream } from './Streaming.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/assets/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGtE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGnF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/assets/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGnF,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGnF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/assets/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,OAAO,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAW,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAEzD;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,iBAAiB;IACjC,2EAA2E;IAC3E,UAAU,CAAC,EAAE,aAAa,CAAC;IAE3B;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAE7B,6FAA6F;IAC7F,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACnD;AASD;;;;;;GAMG;AACH,wBAAsB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,aAAa,GAAG,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsC1G;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAMjE;AAED,wGAAwG;AACxG,wBAAgB,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,CAMpD;AAED,uFAAuF;AACvF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE9C;AAED;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAI5D"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/assets/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,OAAO,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAW,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAEzD;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,iBAAiB;IACjC,2EAA2E;IAC3E,UAAU,CAAC,EAAE,aAAa,CAAC;IAE3B;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAE7B,6FAA6F;IAC7F,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACnD;AAWD;;;;;;GAMG;AACH,wBAAsB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,aAAa,GAAG,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8C1G;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAMjE;AAED,wGAAwG;AACxG,wBAAgB,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,CAMpD;AAED,uFAAuF;AACvF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE9C;AAED;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAI5D"}
@@ -16,9 +16,18 @@ export async function load(paths, options = {}) {
16
16
  const requiredPending = pending.filter((path) => !optionalPaths.has(path));
17
17
  const optionalPending = pending.filter((path) => optionalPaths.has(path));
18
18
  const add = (path) => {
19
- const descriptor = { alias: path, src: resolve(path) };
19
+ const src = resolve(path);
20
+ const descriptor = { alias: path, src };
20
21
  if (resolution !== undefined)
21
22
  descriptor.data = { resolution };
23
+ //a compiled build's `src` is a `data:` URI, which carries no extension for Pixi's
24
+ //resolver to pick a parser from - `path` still does, so it is supplied explicitly
25
+ //instead of a game having to pass its own {src, parser} descriptor to Assets directly
26
+ if (src.startsWith('data:')) {
27
+ const extension = /\.([a-z0-9]+)$/i.exec(path)?.[1];
28
+ if (extension)
29
+ descriptor.format = extension;
30
+ }
22
31
  Assets.add(descriptor);
23
32
  };
24
33
  if (optionalPending.length === 0 && requiredPending.length === 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/assets/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAsB,MAAM,YAAY,CAAC;AAsDzD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,KAAe,EAAE,OAAO,GAAsC,EAAE;IAC1F,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,GACpD,OAAO,OAAO,KAAK,UAAU;QAC5B,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE;QAC3F,CAAC,CAAC,OAAO,CAAC;IAEZ,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAChE,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3E,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,C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CAAC,CAAC;AAC7B,CAAC"}
@@ -32,6 +32,29 @@ declare global {
32
32
  }
33
33
  /** points dev-mode lookups at the folder assets are served from */
34
34
  export declare function setBase(path: string): void;
35
+ /**
36
+ * Hands `resolve`/`has`/`paths` a game's own path-to-URI map, in place of
37
+ * `tools/compile-resources`'s `window.__MWG_ASSETS__` convention.
38
+ *
39
+ * A game bundled by its own tool (Vite, say) that compiles its assets into `data:` URIs a
40
+ * different way still wants `resolve`'s single lookup and `isCompiled`'s dev/build branch,
41
+ * without also adopting `window.__MWG_ASSETS__` as the wire format. Passing the map here
42
+ * makes this file agnostic to *how* the map was built, only to its shape - `{ path: uri }`,
43
+ * the same shape `window.__MWG_ASSETS__` already is. `undefined` reverts to reading
44
+ * `window.__MWG_ASSETS__` (or dev-server mode, if that is unset too).
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * import { setAssetMap, isCompiled, resolve } from '@datamoc/mw_games/assets/paths';
49
+ *
50
+ * setAssetMap({ 'tiles.png': 'data:image/png;base64,...' });
51
+ * console.log(isCompiled()); // true
52
+ * console.log(resolve('tiles.png')); // the data: URI handed in above
53
+ *
54
+ * setAssetMap(undefined); // back to window.__MWG_ASSETS__ / dev-server mode
55
+ * ```
56
+ */
57
+ export declare function setAssetMap(map: Record<string, string> | undefined): void;
35
58
  /** true when running against a compiled bundle rather than a dev server */
36
59
  export declare function isCompiled(): boolean;
37
60
  export declare function paths(): string[];
@@ -1 +1 @@
1
- {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/assets/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACxC;CACD;AAKD,mEAAmE;AACnE,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE1C;AAMD,2EAA2E;AAC3E,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED,wBAAgB,KAAK,IAAI,MAAM,EAAE,CAEhC;AAED,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGzC;AAED,wEAAwE;AACxE,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAW5C;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC"}
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/assets/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACxC;CACD;AAKD,mEAAmE;AACnE,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE1C;AAKD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,IAAI,CAEzE;AAOD,2EAA2E;AAC3E,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED,wBAAgB,KAAK,IAAI,MAAM,EAAE,CAEhC;AAED,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGzC;AAED,wEAAwE;AACxE,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAW5C;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC"}
@@ -31,7 +31,36 @@ let base = '';
31
31
  export function setBase(path) {
32
32
  base = path.endsWith('/') || path === '' ? path : path + '/';
33
33
  }
34
+ /** a path-to-URI map handed in directly, taking priority over `window.__MWG_ASSETS__` */
35
+ let assetMap;
36
+ /**
37
+ * Hands `resolve`/`has`/`paths` a game's own path-to-URI map, in place of
38
+ * `tools/compile-resources`'s `window.__MWG_ASSETS__` convention.
39
+ *
40
+ * A game bundled by its own tool (Vite, say) that compiles its assets into `data:` URIs a
41
+ * different way still wants `resolve`'s single lookup and `isCompiled`'s dev/build branch,
42
+ * without also adopting `window.__MWG_ASSETS__` as the wire format. Passing the map here
43
+ * makes this file agnostic to *how* the map was built, only to its shape - `{ path: uri }`,
44
+ * the same shape `window.__MWG_ASSETS__` already is. `undefined` reverts to reading
45
+ * `window.__MWG_ASSETS__` (or dev-server mode, if that is unset too).
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * import { setAssetMap, isCompiled, resolve } from '@datamoc/mw_games/assets/paths';
50
+ *
51
+ * setAssetMap({ 'tiles.png': 'data:image/png;base64,...' });
52
+ * console.log(isCompiled()); // true
53
+ * console.log(resolve('tiles.png')); // the data: URI handed in above
54
+ *
55
+ * setAssetMap(undefined); // back to window.__MWG_ASSETS__ / dev-server mode
56
+ * ```
57
+ */
58
+ export function setAssetMap(map) {
59
+ assetMap = map;
60
+ }
34
61
  function compiled() {
62
+ if (assetMap)
63
+ return assetMap;
35
64
  return typeof window === 'undefined' ? undefined : window.__MWG_ASSETS__;
36
65
  }
37
66
  /** true when running against a compiled bundle rather than a dev server */
@@ -1 +1 @@
1
- {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/assets/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAQH,kFAAkF;AAClF,IAAI,IAAI,GAAG,EAAE,CAAC;AAEd,mEAAmE;AACnE,MAAM,UAAU,OAAO,CAAC,IAAY;IACnC,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC;AAC9D,CAAC;AA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clamp(-5, 0, 10); // 0
10
+ * clamp(5, 0, 10); // 5
11
+ * ```
12
+ */
13
+ export declare function clamp(value: number, min: number, max: number): number;
14
+ //# sourceMappingURL=Math.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Math.d.ts","sourceRoot":"","sources":["../../src/core/Math.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAErE"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * `value` restricted to `[min, max]`.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * import { clamp } from '@datamoc/mw_games/core';
7
+ *
8
+ * clamp(15, 0, 10); // 10
9
+ * clamp(-5, 0, 10); // 0
10
+ * clamp(5, 0, 10); // 5
11
+ * ```
12
+ */
13
+ export function clamp(value, min, max) {
14
+ return value < min ? min : value > max ? max : value;
15
+ }
16
+ //# sourceMappingURL=Math.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Math.js","sourceRoot":"","sources":["../../src/core/Math.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW;IAC5D,OAAO,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;AACtD,CAAC"}
@@ -72,4 +72,5 @@ export type { PresentationQueueOptions } from './Presentation.ts';
72
72
  export { SyncGuard, stateChecksum } from './SyncGuard.ts';
73
73
  export { parseCSV } from './Csv.ts';
74
74
  export type { CsvOptions, CsvColumnType } from './Csv.ts';
75
+ export { clamp } from './Math.ts';
75
76
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"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CAAC;AACpC,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC"}
@@ -38,4 +38,5 @@ export { EntityRegistry } from './Entity.js';
38
38
  export { PresentationQueue } from './Presentation.js';
39
39
  export { SyncGuard, stateChecksum } from './SyncGuard.js';
40
40
  export { parseCSV } from './Csv.js';
41
+ export { clamp } from './Math.js';
41
42
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,M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