@almadar/ui 5.85.0 → 5.87.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.
@@ -4350,10 +4350,10 @@ var init_ModuleCard = __esm({
4350
4350
  ] })
4351
4351
  ] }, trait.name);
4352
4352
  }),
4353
- pages.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 py-1.5 flex items-center gap-2 flex-wrap", children: pages.map((p2) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-0.5", children: [
4353
+ pages.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 py-1.5 flex items-center gap-2 flex-wrap", children: pages.map((p) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-0.5", children: [
4354
4354
  /* @__PURE__ */ jsxRuntime.jsx("svg", { width: 10, height: 10, viewBox: "0 0 12 12", children: /* @__PURE__ */ jsxRuntime.jsx(exports.AvlPage, { x: 6, y: 6, size: 5 }) }),
4355
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-mono text-[var(--color-muted-foreground)]", children: p2.route })
4356
- ] }, p2.name)) })
4355
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-mono text-[var(--color-muted-foreground)]", children: p.route })
4356
+ ] }, p.name)) })
4357
4357
  ]
4358
4358
  }
4359
4359
  );
@@ -4532,12 +4532,12 @@ function kebabToPascal(name) {
4532
4532
  }).join("");
4533
4533
  }
4534
4534
  function loadLib(key, importer) {
4535
- let p2 = libPromises.get(key);
4536
- if (!p2) {
4537
- p2 = importer();
4538
- libPromises.set(key, p2);
4535
+ let p = libPromises.get(key);
4536
+ if (!p) {
4537
+ p = importer();
4538
+ libPromises.set(key, p);
4539
4539
  }
4540
- return p2;
4540
+ return p;
4541
4541
  }
4542
4542
  function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
4543
4543
  const Lazy = React104__namespace.default.lazy(async () => {
@@ -9623,28 +9623,28 @@ var init_ConfettiEffect = __esm({
9623
9623
  ),
9624
9624
  "aria-hidden": "true",
9625
9625
  children: [
9626
- particles.map((p2) => {
9627
- const rad = p2.angle * Math.PI / 180;
9628
- const tx = Math.cos(rad) * p2.distance;
9629
- const ty = Math.sin(rad) * p2.distance - 20;
9626
+ particles.map((p) => {
9627
+ const rad = p.angle * Math.PI / 180;
9628
+ const tx = Math.cos(rad) * p.distance;
9629
+ const ty = Math.sin(rad) * p.distance - 20;
9630
9630
  return /* @__PURE__ */ jsxRuntime.jsx(
9631
9631
  Box,
9632
9632
  {
9633
9633
  className: "absolute rounded-sm",
9634
9634
  style: {
9635
- left: `${p2.left}%`,
9635
+ left: `${p.left}%`,
9636
9636
  top: "50%",
9637
- width: p2.size,
9638
- height: p2.size,
9639
- backgroundColor: p2.color,
9640
- animation: `confetti-burst ${duration - p2.delay}ms ease-out ${p2.delay}ms forwards`,
9637
+ width: p.size,
9638
+ height: p.size,
9639
+ backgroundColor: p.color,
9640
+ animation: `confetti-burst ${duration - p.delay}ms ease-out ${p.delay}ms forwards`,
9641
9641
  opacity: 0,
9642
9642
  "--confetti-tx": `${tx}px`,
9643
9643
  "--confetti-ty": `${ty}px`,
9644
- "--confetti-rotate": `${p2.rotation}deg`
9644
+ "--confetti-rotate": `${p.rotation}deg`
9645
9645
  }
9646
9646
  },
9647
- p2.id
9647
+ p.id
9648
9648
  );
9649
9649
  }),
9650
9650
  /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
@@ -10555,8 +10555,8 @@ var init_AnimatedGraphic = __esm({
10555
10555
  const el = containerRef.current;
10556
10556
  if (!el || !strokeColor) return;
10557
10557
  const paths = el.querySelectorAll("path, line, polyline, polygon, circle, ellipse, rect");
10558
- paths.forEach((p2) => {
10559
- p2.style.stroke = strokeColor;
10558
+ paths.forEach((p) => {
10559
+ p.style.stroke = strokeColor;
10560
10560
  });
10561
10561
  }, [resolvedSvg, strokeColor]);
10562
10562
  React104.useEffect(() => {
@@ -10564,23 +10564,23 @@ var init_AnimatedGraphic = __esm({
10564
10564
  if (!el || !resolvedSvg) return;
10565
10565
  if (animation === "draw" || animation === "fill") {
10566
10566
  const paths = el.querySelectorAll("path, line, polyline, polygon, circle, ellipse, rect");
10567
- paths.forEach((p2) => {
10568
- if ("getTotalLength" in p2 && typeof p2.getTotalLength === "function") {
10569
- const len = p2.getTotalLength();
10570
- p2.style.strokeDasharray = `${len}`;
10571
- p2.style.strokeDashoffset = `${len}`;
10567
+ paths.forEach((p) => {
10568
+ if ("getTotalLength" in p && typeof p.getTotalLength === "function") {
10569
+ const len = p.getTotalLength();
10570
+ p.style.strokeDasharray = `${len}`;
10571
+ p.style.strokeDashoffset = `${len}`;
10572
10572
  }
10573
10573
  if (animation === "fill") {
10574
- p2.style.fillOpacity = "0";
10574
+ p.style.fillOpacity = "0";
10575
10575
  }
10576
10576
  });
10577
10577
  }
10578
10578
  if (animation === "morph") {
10579
10579
  const paths = el.querySelectorAll("path, circle, ellipse, rect, polygon");
10580
- paths.forEach((p2) => {
10581
- p2.style.transform = "scale(0)";
10582
- p2.style.transformOrigin = "center";
10583
- p2.style.opacity = "0";
10580
+ paths.forEach((p) => {
10581
+ p.style.transform = "scale(0)";
10582
+ p.style.transformOrigin = "center";
10583
+ p.style.opacity = "0";
10584
10584
  });
10585
10585
  }
10586
10586
  }, [resolvedSvg, animation]);
@@ -10685,14 +10685,8 @@ var init_TraitFrame = __esm({
10685
10685
  });
10686
10686
 
10687
10687
  // components/game/shared/effects.ts
10688
- var EMPTY_EFFECT_STATE;
10689
10688
  var init_effects = __esm({
10690
10689
  "components/game/shared/effects.ts"() {
10691
- EMPTY_EFFECT_STATE = {
10692
- particles: [],
10693
- sequences: [],
10694
- overlays: []
10695
- };
10696
10690
  }
10697
10691
  });
10698
10692
 
@@ -11100,1021 +11094,12 @@ var init_spriteAnimation = __esm({
11100
11094
  }
11101
11095
  });
11102
11096
 
11103
- // components/game/shared/combatPresets.ts
11104
- function p(manifest, key) {
11105
- const particles = manifest.particles;
11106
- if (!particles) return [];
11107
- const val = particles[key];
11108
- if (Array.isArray(val)) return val.map((v) => `${manifest.baseUrl}/${v}`);
11109
- if (typeof val === "string") return [`${manifest.baseUrl}/${val}`];
11110
- return [];
11111
- }
11112
- function anim(manifest, key) {
11113
- const animations = manifest.animations;
11114
- if (!animations) return [];
11115
- const val = animations[key];
11116
- if (Array.isArray(val)) return val.map((v) => `${manifest.baseUrl}/${v}`);
11117
- return [];
11118
- }
11119
- function createCombatPresets(manifest) {
11120
- return {
11121
- // =====================================================================
11122
- // MELEE — slash (red) + dirt + scratch + flash sequence
11123
- // =====================================================================
11124
- melee: (originX, originY) => {
11125
- const particles = [
11126
- {
11127
- spriteUrls: p(manifest, "slash"),
11128
- count: 6,
11129
- originX,
11130
- originY,
11131
- spread: 8,
11132
- velocityMin: 40,
11133
- velocityMax: 120,
11134
- angleMin: -PI2 * 0.8,
11135
- angleMax: -PI2 * 0.2,
11136
- gravity: 0,
11137
- tint: { r: 255, g: 60, b: 40 },
11138
- scaleMin: 0.3,
11139
- scaleMax: 0.6,
11140
- lifetimeMin: 300,
11141
- lifetimeMax: 500,
11142
- fadeRate: -2.5
11143
- },
11144
- {
11145
- spriteUrls: p(manifest, "dirt"),
11146
- count: 4,
11147
- originX,
11148
- originY: originY + 10,
11149
- spread: 12,
11150
- velocityMin: 20,
11151
- velocityMax: 60,
11152
- angleMin: -PI2 * 0.9,
11153
- angleMax: -PI2 * 0.1,
11154
- gravity: 120,
11155
- tint: { r: 180, g: 140, b: 90 },
11156
- scaleMin: 0.15,
11157
- scaleMax: 0.3,
11158
- lifetimeMin: 400,
11159
- lifetimeMax: 700,
11160
- fadeRate: -1.8
11161
- },
11162
- {
11163
- spriteUrls: p(manifest, "scratch"),
11164
- count: 2,
11165
- originX,
11166
- originY,
11167
- spread: 5,
11168
- velocityMin: 10,
11169
- velocityMax: 30,
11170
- angleMin: -PI2 * 0.7,
11171
- angleMax: -PI2 * 0.3,
11172
- gravity: 0,
11173
- tint: { r: 255, g: 200, b: 150 },
11174
- scaleMin: 0.25,
11175
- scaleMax: 0.4,
11176
- lifetimeMin: 200,
11177
- lifetimeMax: 400,
11178
- fadeRate: -3
11179
- }
11180
- ];
11181
- const sequences = [];
11182
- const flashFrames = anim(manifest, "flash");
11183
- if (flashFrames.length > 0) {
11184
- sequences.push({
11185
- frameUrls: flashFrames,
11186
- originX,
11187
- originY,
11188
- frameDuration: 35,
11189
- scale: 0.4
11190
- });
11191
- }
11192
- return {
11193
- particles: particles.filter((pc) => pc.spriteUrls.length > 0),
11194
- sequences,
11195
- overlays: [],
11196
- screenShake: 4,
11197
- screenFlash: null
11198
- };
11199
- },
11200
- // =====================================================================
11201
- // RANGED — muzzle + trace + smoke + explosion sequence
11202
- // =====================================================================
11203
- ranged: (originX, originY) => {
11204
- const particles = [
11205
- {
11206
- spriteUrls: p(manifest, "muzzle"),
11207
- count: 3,
11208
- originX,
11209
- originY,
11210
- spread: 4,
11211
- velocityMin: 60,
11212
- velocityMax: 150,
11213
- angleMin: -PI2 * 0.6,
11214
- angleMax: -PI2 * 0.4,
11215
- gravity: 0,
11216
- tint: { r: 255, g: 220, b: 100 },
11217
- scaleMin: 0.2,
11218
- scaleMax: 0.4,
11219
- lifetimeMin: 200,
11220
- lifetimeMax: 400,
11221
- fadeRate: -3
11222
- },
11223
- {
11224
- spriteUrls: p(manifest, "trace"),
11225
- count: 5,
11226
- originX,
11227
- originY,
11228
- spread: 3,
11229
- velocityMin: 100,
11230
- velocityMax: 200,
11231
- angleMin: -PI2 * 0.55,
11232
- angleMax: -PI2 * 0.45,
11233
- gravity: 0,
11234
- tint: { r: 255, g: 200, b: 80 },
11235
- scaleMin: 0.15,
11236
- scaleMax: 0.3,
11237
- lifetimeMin: 150,
11238
- lifetimeMax: 300,
11239
- fadeRate: -4
11240
- },
11241
- {
11242
- spriteUrls: p(manifest, "smoke").slice(0, 3),
11243
- count: 3,
11244
- originX,
11245
- originY: originY + 5,
11246
- spread: 6,
11247
- velocityMin: 10,
11248
- velocityMax: 30,
11249
- angleMin: -PI2 * 0.8,
11250
- angleMax: -PI2 * 0.2,
11251
- gravity: -20,
11252
- tint: { r: 200, g: 200, b: 200 },
11253
- scaleMin: 0.2,
11254
- scaleMax: 0.35,
11255
- lifetimeMin: 500,
11256
- lifetimeMax: 800,
11257
- fadeRate: -1.5
11258
- }
11259
- ];
11260
- const sequences = [];
11261
- const explosionFrames = anim(manifest, "smokeExplosion");
11262
- if (explosionFrames.length > 0) {
11263
- sequences.push({
11264
- frameUrls: explosionFrames,
11265
- originX,
11266
- originY,
11267
- frameDuration: 50,
11268
- scale: 0.35
11269
- });
11270
- }
11271
- return {
11272
- particles: particles.filter((pc) => pc.spriteUrls.length > 0),
11273
- sequences,
11274
- overlays: [],
11275
- screenShake: 2,
11276
- screenFlash: null
11277
- };
11278
- },
11279
- // =====================================================================
11280
- // MAGIC — twirl (purple) + spark (purple) + star
11281
- // =====================================================================
11282
- magic: (originX, originY) => {
11283
- const particles = [
11284
- {
11285
- spriteUrls: p(manifest, "twirl"),
11286
- count: 5,
11287
- originX,
11288
- originY,
11289
- spread: 15,
11290
- velocityMin: 20,
11291
- velocityMax: 80,
11292
- angleMin: 0,
11293
- angleMax: PI2 * 2,
11294
- gravity: -30,
11295
- tint: { r: 180, g: 80, b: 255 },
11296
- scaleMin: 0.2,
11297
- scaleMax: 0.5,
11298
- lifetimeMin: 500,
11299
- lifetimeMax: 900,
11300
- fadeRate: -1.2,
11301
- blendMode: "lighter",
11302
- rotationSpeedMin: -4,
11303
- rotationSpeedMax: 4
11304
- },
11305
- {
11306
- spriteUrls: p(manifest, "spark"),
11307
- count: 8,
11308
- originX,
11309
- originY,
11310
- spread: 20,
11311
- velocityMin: 30,
11312
- velocityMax: 100,
11313
- angleMin: 0,
11314
- angleMax: PI2 * 2,
11315
- gravity: -15,
11316
- tint: { r: 200, g: 120, b: 255 },
11317
- scaleMin: 0.1,
11318
- scaleMax: 0.25,
11319
- lifetimeMin: 300,
11320
- lifetimeMax: 600,
11321
- fadeRate: -2,
11322
- blendMode: "lighter"
11323
- },
11324
- {
11325
- spriteUrls: p(manifest, "star"),
11326
- count: 4,
11327
- originX,
11328
- originY,
11329
- spread: 10,
11330
- velocityMin: 15,
11331
- velocityMax: 50,
11332
- angleMin: -PI2,
11333
- angleMax: 0,
11334
- gravity: -40,
11335
- tint: { r: 220, g: 180, b: 255 },
11336
- scaleMin: 0.15,
11337
- scaleMax: 0.3,
11338
- lifetimeMin: 600,
11339
- lifetimeMax: 1e3,
11340
- fadeRate: -1,
11341
- blendMode: "lighter"
11342
- }
11343
- ];
11344
- const overlays = [];
11345
- const circleUrls = p(manifest, "circle");
11346
- if (circleUrls.length > 0) {
11347
- overlays.push({
11348
- spriteUrl: circleUrls[0],
11349
- originX,
11350
- originY,
11351
- alpha: 0.5,
11352
- fadeRate: -0.6,
11353
- pulseAmplitude: 0.2,
11354
- pulseFrequency: 3,
11355
- scale: 0.5,
11356
- blendMode: "lighter",
11357
- lifetime: 1200
11358
- });
11359
- }
11360
- return {
11361
- particles: particles.filter((pc) => pc.spriteUrls.length > 0),
11362
- sequences: [],
11363
- overlays,
11364
- screenShake: 0,
11365
- screenFlash: null
11366
- };
11367
- },
11368
- // =====================================================================
11369
- // HEAL — circle (green) + star (green) + light (green, pulse)
11370
- // =====================================================================
11371
- heal: (originX, originY) => {
11372
- const particles = [
11373
- {
11374
- spriteUrls: p(manifest, "circle"),
11375
- count: 6,
11376
- originX,
11377
- originY,
11378
- spread: 15,
11379
- velocityMin: 10,
11380
- velocityMax: 40,
11381
- angleMin: -PI2,
11382
- angleMax: -PI2 * 0.3,
11383
- gravity: -50,
11384
- tint: { r: 80, g: 255, b: 120 },
11385
- scaleMin: 0.15,
11386
- scaleMax: 0.35,
11387
- lifetimeMin: 600,
11388
- lifetimeMax: 1e3,
11389
- fadeRate: -0.8,
11390
- blendMode: "lighter"
11391
- },
11392
- {
11393
- spriteUrls: p(manifest, "star"),
11394
- count: 5,
11395
- originX,
11396
- originY,
11397
- spread: 12,
11398
- velocityMin: 15,
11399
- velocityMax: 50,
11400
- angleMin: -PI2 * 0.9,
11401
- angleMax: -PI2 * 0.1,
11402
- gravity: -60,
11403
- tint: { r: 100, g: 255, b: 140 },
11404
- scaleMin: 0.1,
11405
- scaleMax: 0.2,
11406
- lifetimeMin: 500,
11407
- lifetimeMax: 800,
11408
- fadeRate: -1.2,
11409
- blendMode: "lighter"
11410
- }
11411
- ];
11412
- const overlays = [];
11413
- const lightUrls = p(manifest, "light");
11414
- if (lightUrls.length > 0) {
11415
- overlays.push({
11416
- spriteUrl: lightUrls[0],
11417
- originX,
11418
- originY,
11419
- alpha: 0.6,
11420
- fadeRate: -0.4,
11421
- pulseAmplitude: 0.25,
11422
- pulseFrequency: 2.5,
11423
- scale: 0.6,
11424
- blendMode: "lighter",
11425
- lifetime: 1500
11426
- });
11427
- }
11428
- return {
11429
- particles: particles.filter((pc) => pc.spriteUrls.length > 0),
11430
- sequences: [],
11431
- overlays,
11432
- screenShake: 0,
11433
- screenFlash: null
11434
- };
11435
- },
11436
- // =====================================================================
11437
- // DEFEND / SHIELD — star (blue) + circle (blue, pulse)
11438
- // =====================================================================
11439
- defend: (originX, originY) => {
11440
- const particles = [
11441
- {
11442
- spriteUrls: p(manifest, "star"),
11443
- count: 8,
11444
- originX,
11445
- originY,
11446
- spread: 18,
11447
- velocityMin: 10,
11448
- velocityMax: 35,
11449
- angleMin: 0,
11450
- angleMax: PI2 * 2,
11451
- gravity: 0,
11452
- tint: { r: 80, g: 160, b: 255 },
11453
- scaleMin: 0.12,
11454
- scaleMax: 0.25,
11455
- lifetimeMin: 600,
11456
- lifetimeMax: 1e3,
11457
- fadeRate: -0.8,
11458
- blendMode: "lighter",
11459
- rotationSpeedMin: -1,
11460
- rotationSpeedMax: 1
11461
- }
11462
- ];
11463
- const overlays = [];
11464
- const circleUrls = p(manifest, "circle");
11465
- if (circleUrls.length > 0) {
11466
- overlays.push({
11467
- spriteUrl: circleUrls[0],
11468
- originX,
11469
- originY,
11470
- alpha: 0.6,
11471
- fadeRate: -0.3,
11472
- pulseAmplitude: 0.2,
11473
- pulseFrequency: 2,
11474
- scale: 0.6,
11475
- blendMode: "lighter",
11476
- lifetime: 1500
11477
- });
11478
- }
11479
- return {
11480
- particles: particles.filter((pc) => pc.spriteUrls.length > 0),
11481
- sequences: [],
11482
- overlays,
11483
- screenShake: 0,
11484
- screenFlash: null
11485
- };
11486
- },
11487
- // shield aliases to defend
11488
- shield: (originX, originY) => {
11489
- const particles = [
11490
- {
11491
- spriteUrls: p(manifest, "star"),
11492
- count: 10,
11493
- originX,
11494
- originY,
11495
- spread: 20,
11496
- velocityMin: 8,
11497
- velocityMax: 30,
11498
- angleMin: 0,
11499
- angleMax: PI2 * 2,
11500
- gravity: 0,
11501
- tint: { r: 60, g: 180, b: 255 },
11502
- scaleMin: 0.1,
11503
- scaleMax: 0.22,
11504
- lifetimeMin: 700,
11505
- lifetimeMax: 1200,
11506
- fadeRate: -0.7,
11507
- blendMode: "lighter",
11508
- rotationSpeedMin: -0.8,
11509
- rotationSpeedMax: 0.8
11510
- }
11511
- ];
11512
- const overlays = [];
11513
- const circleUrls = p(manifest, "circle");
11514
- if (circleUrls.length > 0) {
11515
- overlays.push({
11516
- spriteUrl: circleUrls[0],
11517
- originX,
11518
- originY,
11519
- alpha: 0.7,
11520
- fadeRate: -0.25,
11521
- pulseAmplitude: 0.25,
11522
- pulseFrequency: 1.8,
11523
- scale: 0.7,
11524
- blendMode: "lighter",
11525
- lifetime: 1800
11526
- });
11527
- }
11528
- return {
11529
- particles: particles.filter((pc) => pc.spriteUrls.length > 0),
11530
- sequences: [],
11531
- overlays,
11532
- screenShake: 0,
11533
- screenFlash: null
11534
- };
11535
- },
11536
- // =====================================================================
11537
- // HIT — spark (orange) + flash (5 frames) + screen shake/flash
11538
- // =====================================================================
11539
- hit: (originX, originY) => {
11540
- const particles = [
11541
- {
11542
- spriteUrls: p(manifest, "spark"),
11543
- count: 10,
11544
- originX,
11545
- originY,
11546
- spread: 8,
11547
- velocityMin: 50,
11548
- velocityMax: 150,
11549
- angleMin: 0,
11550
- angleMax: PI2 * 2,
11551
- gravity: 80,
11552
- tint: { r: 255, g: 180, b: 50 },
11553
- scaleMin: 0.08,
11554
- scaleMax: 0.2,
11555
- lifetimeMin: 200,
11556
- lifetimeMax: 500,
11557
- fadeRate: -2.5
11558
- }
11559
- ];
11560
- const sequences = [];
11561
- const flashFrames = anim(manifest, "flash");
11562
- if (flashFrames.length > 0) {
11563
- sequences.push({
11564
- frameUrls: flashFrames.slice(0, 5),
11565
- originX,
11566
- originY,
11567
- frameDuration: 40,
11568
- scale: 0.3
11569
- });
11570
- }
11571
- return {
11572
- particles: particles.filter((pc) => pc.spriteUrls.length > 0),
11573
- sequences,
11574
- overlays: [],
11575
- screenShake: 3,
11576
- screenFlash: { r: 255, g: 50, b: 50, duration: 150 }
11577
- };
11578
- },
11579
- // critical aliases to hit with bigger shake
11580
- critical: (originX, originY) => {
11581
- const particles = [
11582
- {
11583
- spriteUrls: p(manifest, "flame"),
11584
- count: 8,
11585
- originX,
11586
- originY,
11587
- spread: 12,
11588
- velocityMin: 60,
11589
- velocityMax: 180,
11590
- angleMin: 0,
11591
- angleMax: PI2 * 2,
11592
- gravity: 60,
11593
- tint: { r: 255, g: 120, b: 30 },
11594
- scaleMin: 0.15,
11595
- scaleMax: 0.4,
11596
- lifetimeMin: 300,
11597
- lifetimeMax: 600,
11598
- fadeRate: -2
11599
- },
11600
- {
11601
- spriteUrls: p(manifest, "spark"),
11602
- count: 12,
11603
- originX,
11604
- originY,
11605
- spread: 10,
11606
- velocityMin: 80,
11607
- velocityMax: 200,
11608
- angleMin: 0,
11609
- angleMax: PI2 * 2,
11610
- gravity: 100,
11611
- tint: { r: 255, g: 200, b: 60 },
11612
- scaleMin: 0.06,
11613
- scaleMax: 0.18,
11614
- lifetimeMin: 200,
11615
- lifetimeMax: 400,
11616
- fadeRate: -3
11617
- }
11618
- ];
11619
- const sequences = [];
11620
- const flashFrames = anim(manifest, "flash");
11621
- if (flashFrames.length > 0) {
11622
- sequences.push({
11623
- frameUrls: flashFrames,
11624
- originX,
11625
- originY,
11626
- frameDuration: 30,
11627
- scale: 0.5
11628
- });
11629
- }
11630
- return {
11631
- particles: particles.filter((pc) => pc.spriteUrls.length > 0),
11632
- sequences,
11633
- overlays: [],
11634
- screenShake: 6,
11635
- screenFlash: { r: 255, g: 80, b: 0, duration: 200 }
11636
- };
11637
- },
11638
- // =====================================================================
11639
- // DEATH — dirt (gray) + explosion + black smoke + scorch (ground)
11640
- // =====================================================================
11641
- death: (originX, originY) => {
11642
- const particles = [
11643
- {
11644
- spriteUrls: p(manifest, "dirt"),
11645
- count: 8,
11646
- originX,
11647
- originY,
11648
- spread: 10,
11649
- velocityMin: 30,
11650
- velocityMax: 100,
11651
- angleMin: 0,
11652
- angleMax: PI2 * 2,
11653
- gravity: 100,
11654
- tint: { r: 140, g: 140, b: 140 },
11655
- scaleMin: 0.15,
11656
- scaleMax: 0.35,
11657
- lifetimeMin: 500,
11658
- lifetimeMax: 900,
11659
- fadeRate: -1.2
11660
- }
11661
- ];
11662
- const sequences = [];
11663
- const explosionFrames = anim(manifest, "explosion");
11664
- if (explosionFrames.length > 0) {
11665
- sequences.push({
11666
- frameUrls: explosionFrames,
11667
- originX,
11668
- originY,
11669
- frameDuration: 60,
11670
- scale: 0.5
11671
- });
11672
- }
11673
- const blackSmokeFrames = anim(manifest, "blackSmoke");
11674
- if (blackSmokeFrames.length > 0) {
11675
- sequences.push({
11676
- frameUrls: blackSmokeFrames,
11677
- originX,
11678
- originY: originY - 10,
11679
- frameDuration: 50,
11680
- scale: 0.4,
11681
- alpha: 0.7
11682
- });
11683
- }
11684
- const overlays = [];
11685
- const scorchUrls = p(manifest, "scorch");
11686
- if (scorchUrls.length > 0) {
11687
- overlays.push({
11688
- spriteUrl: scorchUrls[0],
11689
- originX,
11690
- originY: originY + 10,
11691
- alpha: 0.6,
11692
- fadeRate: -0.15,
11693
- scale: 0.4,
11694
- lifetime: 4e3
11695
- });
11696
- }
11697
- return {
11698
- particles: particles.filter((pc) => pc.spriteUrls.length > 0),
11699
- sequences,
11700
- overlays,
11701
- screenShake: 0,
11702
- screenFlash: null
11703
- };
11704
- },
11705
- // =====================================================================
11706
- // BUFF — star (gold) + symbol + flare (gold, pulse)
11707
- // =====================================================================
11708
- buff: (originX, originY) => {
11709
- const particles = [
11710
- {
11711
- spriteUrls: p(manifest, "star"),
11712
- count: 6,
11713
- originX,
11714
- originY,
11715
- spread: 15,
11716
- velocityMin: 15,
11717
- velocityMax: 50,
11718
- angleMin: -PI2,
11719
- angleMax: 0,
11720
- gravity: -30,
11721
- tint: { r: 255, g: 215, b: 50 },
11722
- scaleMin: 0.12,
11723
- scaleMax: 0.25,
11724
- lifetimeMin: 600,
11725
- lifetimeMax: 1e3,
11726
- fadeRate: -0.8,
11727
- blendMode: "lighter"
11728
- },
11729
- {
11730
- spriteUrls: p(manifest, "symbol"),
11731
- count: 2,
11732
- originX,
11733
- originY: originY - 10,
11734
- spread: 8,
11735
- velocityMin: 5,
11736
- velocityMax: 20,
11737
- angleMin: -PI2 * 0.7,
11738
- angleMax: -PI2 * 0.3,
11739
- gravity: -20,
11740
- tint: { r: 255, g: 230, b: 100 },
11741
- scaleMin: 0.2,
11742
- scaleMax: 0.35,
11743
- lifetimeMin: 800,
11744
- lifetimeMax: 1200,
11745
- fadeRate: -0.6,
11746
- blendMode: "lighter"
11747
- }
11748
- ];
11749
- const overlays = [];
11750
- const flareUrls = p(manifest, "flare");
11751
- if (flareUrls.length > 0) {
11752
- overlays.push({
11753
- spriteUrl: flareUrls[0],
11754
- originX,
11755
- originY,
11756
- alpha: 0.5,
11757
- fadeRate: -0.3,
11758
- pulseAmplitude: 0.3,
11759
- pulseFrequency: 2,
11760
- scale: 0.5,
11761
- blendMode: "lighter",
11762
- lifetime: 1500
11763
- });
11764
- }
11765
- return {
11766
- particles: particles.filter((pc) => pc.spriteUrls.length > 0),
11767
- sequences: [],
11768
- overlays,
11769
- screenShake: 0,
11770
- screenFlash: null
11771
- };
11772
- },
11773
- // =====================================================================
11774
- // DEBUFF — scorch (dark) + smoke (purple tint)
11775
- // =====================================================================
11776
- debuff: (originX, originY) => {
11777
- const particles = [
11778
- {
11779
- spriteUrls: p(manifest, "scorch"),
11780
- count: 4,
11781
- originX,
11782
- originY,
11783
- spread: 12,
11784
- velocityMin: 15,
11785
- velocityMax: 40,
11786
- angleMin: -PI2,
11787
- angleMax: 0,
11788
- gravity: -20,
11789
- tint: { r: 120, g: 40, b: 160 },
11790
- scaleMin: 0.15,
11791
- scaleMax: 0.3,
11792
- lifetimeMin: 500,
11793
- lifetimeMax: 800,
11794
- fadeRate: -1
11795
- },
11796
- {
11797
- spriteUrls: p(manifest, "smoke").slice(0, 3),
11798
- count: 3,
11799
- originX,
11800
- originY,
11801
- spread: 10,
11802
- velocityMin: 8,
11803
- velocityMax: 25,
11804
- angleMin: -PI2 * 0.8,
11805
- angleMax: -PI2 * 0.2,
11806
- gravity: -15,
11807
- tint: { r: 100, g: 50, b: 140 },
11808
- scaleMin: 0.2,
11809
- scaleMax: 0.35,
11810
- lifetimeMin: 600,
11811
- lifetimeMax: 1e3,
11812
- fadeRate: -0.8
11813
- }
11814
- ];
11815
- const overlays = [];
11816
- const circleUrls = p(manifest, "circle");
11817
- if (circleUrls.length > 0) {
11818
- overlays.push({
11819
- spriteUrl: circleUrls[0],
11820
- originX,
11821
- originY,
11822
- alpha: 0.4,
11823
- fadeRate: -0.4,
11824
- pulseAmplitude: 0.15,
11825
- pulseFrequency: 2,
11826
- scale: 0.45,
11827
- lifetime: 1200
11828
- });
11829
- }
11830
- return {
11831
- particles: particles.filter((pc) => pc.spriteUrls.length > 0),
11832
- sequences: [],
11833
- overlays,
11834
- screenShake: 0,
11835
- screenFlash: null
11836
- };
11837
- },
11838
- // =====================================================================
11839
- // AOE — explosion (large) + flame + spark (radial) + screen shake
11840
- // =====================================================================
11841
- aoe: (originX, originY) => {
11842
- const particles = [
11843
- {
11844
- spriteUrls: p(manifest, "flame"),
11845
- count: 10,
11846
- originX,
11847
- originY,
11848
- spread: 20,
11849
- velocityMin: 40,
11850
- velocityMax: 140,
11851
- angleMin: 0,
11852
- angleMax: PI2 * 2,
11853
- gravity: 40,
11854
- tint: { r: 255, g: 140, b: 30 },
11855
- scaleMin: 0.2,
11856
- scaleMax: 0.5,
11857
- lifetimeMin: 400,
11858
- lifetimeMax: 800,
11859
- fadeRate: -1.5
11860
- },
11861
- {
11862
- spriteUrls: p(manifest, "spark"),
11863
- count: 15,
11864
- originX,
11865
- originY,
11866
- spread: 15,
11867
- velocityMin: 60,
11868
- velocityMax: 200,
11869
- angleMin: 0,
11870
- angleMax: PI2 * 2,
11871
- gravity: 60,
11872
- tint: { r: 255, g: 180, b: 60 },
11873
- scaleMin: 0.06,
11874
- scaleMax: 0.15,
11875
- lifetimeMin: 200,
11876
- lifetimeMax: 500,
11877
- fadeRate: -2.5
11878
- }
11879
- ];
11880
- const sequences = [];
11881
- const explosionFrames = anim(manifest, "explosion");
11882
- if (explosionFrames.length > 0) {
11883
- sequences.push({
11884
- frameUrls: explosionFrames,
11885
- originX,
11886
- originY,
11887
- frameDuration: 50,
11888
- scale: 0.6
11889
- });
11890
- }
11891
- return {
11892
- particles: particles.filter((pc) => pc.spriteUrls.length > 0),
11893
- sequences,
11894
- overlays: [],
11895
- screenShake: 5,
11896
- screenFlash: { r: 255, g: 160, b: 0, duration: 180 }
11897
- };
11898
- }
11899
- };
11900
- }
11901
- var PI2;
11902
- var init_combatPresets = __esm({
11903
- "components/game/shared/combatPresets.ts"() {
11904
- PI2 = Math.PI;
11905
- }
11906
- });
11907
-
11908
- // components/game/shared/canvasEffects.ts
11909
- function getOffscreenCtx(w, h) {
11910
- if (!_offscreen) {
11911
- if (typeof OffscreenCanvas !== "undefined") {
11912
- _offscreen = new OffscreenCanvas(w, h);
11913
- } else {
11914
- _offscreen = document.createElement("canvas");
11915
- }
11916
- }
11917
- if (_offscreen.width < w) _offscreen.width = w;
11918
- if (_offscreen.height < h) _offscreen.height = h;
11919
- if (!_offCtx) {
11920
- _offCtx = _offscreen.getContext("2d");
11921
- }
11922
- return _offCtx;
11923
- }
11924
- function drawTintedImage(ctx, img, x, y, w, h, tint, alpha, blendMode = "source-over") {
11925
- if (w <= 0 || h <= 0) return;
11926
- const oc = getOffscreenCtx(w, h);
11927
- oc.clearRect(0, 0, w, h);
11928
- oc.globalCompositeOperation = "source-over";
11929
- oc.drawImage(img, 0, 0, w, h);
11930
- oc.globalCompositeOperation = "source-atop";
11931
- oc.fillStyle = `rgb(${tint.r}, ${tint.g}, ${tint.b})`;
11932
- oc.fillRect(0, 0, w, h);
11933
- const prevAlpha = ctx.globalAlpha;
11934
- const prevBlend = ctx.globalCompositeOperation;
11935
- ctx.globalAlpha = alpha;
11936
- ctx.globalCompositeOperation = blendMode;
11937
- ctx.drawImage(_offscreen, 0, 0, w, h, x, y, w, h);
11938
- ctx.globalAlpha = prevAlpha;
11939
- ctx.globalCompositeOperation = prevBlend;
11940
- }
11941
- function randRange(min, max) {
11942
- return min + Math.random() * (max - min);
11943
- }
11944
- function spawnParticles(config, animTime) {
11945
- const particles = [];
11946
- for (let i = 0; i < config.count; i++) {
11947
- const angle = randRange(config.angleMin, config.angleMax);
11948
- const speed = randRange(config.velocityMin, config.velocityMax);
11949
- const spriteUrl = config.spriteUrls[Math.floor(Math.random() * config.spriteUrls.length)];
11950
- particles.push({
11951
- spriteUrl,
11952
- x: config.originX + randRange(-config.spread, config.spread),
11953
- y: config.originY + randRange(-config.spread, config.spread),
11954
- vx: Math.cos(angle) * speed,
11955
- vy: Math.sin(angle) * speed,
11956
- gravity: config.gravity,
11957
- rotation: Math.random() * Math.PI * 2,
11958
- rotationSpeed: randRange(config.rotationSpeedMin ?? -2, config.rotationSpeedMax ?? 2),
11959
- scale: randRange(config.scaleMin, config.scaleMax),
11960
- scaleSpeed: config.scaleSpeed ?? 0,
11961
- alpha: config.alpha ?? 1,
11962
- fadeRate: config.fadeRate ?? -1.5,
11963
- tint: { ...config.tint },
11964
- blendMode: config.blendMode ?? "source-over",
11965
- spawnTime: animTime,
11966
- lifetime: randRange(config.lifetimeMin, config.lifetimeMax)
11967
- });
11968
- }
11969
- return particles;
11970
- }
11971
- function spawnSequence(config, animTime) {
11972
- return {
11973
- frameUrls: config.frameUrls,
11974
- x: config.originX,
11975
- y: config.originY,
11976
- frameDuration: config.frameDuration,
11977
- startTime: animTime,
11978
- loop: config.loop ?? false,
11979
- scale: config.scale ?? 1,
11980
- tint: config.tint ?? null,
11981
- alpha: config.alpha ?? 1,
11982
- blendMode: config.blendMode ?? "source-over"
11983
- };
11984
- }
11985
- function spawnOverlay(config, animTime) {
11986
- return {
11987
- spriteUrl: config.spriteUrl,
11988
- x: config.originX,
11989
- y: config.originY,
11990
- alpha: config.alpha ?? 0.8,
11991
- fadeRate: config.fadeRate ?? -0.5,
11992
- pulseAmplitude: config.pulseAmplitude ?? 0,
11993
- pulseFrequency: config.pulseFrequency ?? 2,
11994
- scale: config.scale ?? 1,
11995
- blendMode: config.blendMode ?? "source-over",
11996
- spawnTime: animTime,
11997
- lifetime: config.lifetime ?? 2e3
11998
- };
11999
- }
12000
- function updateEffectState(state, animTime, deltaMs) {
12001
- const dt = deltaMs / 1e3;
12002
- const particles = state.particles.map((p2) => ({
12003
- ...p2,
12004
- x: p2.x + p2.vx * dt,
12005
- y: p2.y + p2.vy * dt,
12006
- vy: p2.vy + p2.gravity * dt,
12007
- rotation: p2.rotation + p2.rotationSpeed * dt,
12008
- scale: Math.max(0, p2.scale + p2.scaleSpeed * dt),
12009
- alpha: Math.max(0, p2.alpha + p2.fadeRate * dt)
12010
- })).filter((p2) => p2.alpha > 0.01 && animTime - p2.spawnTime < p2.lifetime);
12011
- const sequences = state.sequences.filter((s) => {
12012
- const elapsed = animTime - s.startTime;
12013
- const totalDuration = s.frameUrls.length * s.frameDuration;
12014
- return s.loop || elapsed < totalDuration;
12015
- });
12016
- const overlays = state.overlays.map((o) => ({
12017
- ...o,
12018
- alpha: Math.max(0, o.alpha + o.fadeRate * dt)
12019
- })).filter((o) => o.alpha > 0.01 && animTime - o.spawnTime < o.lifetime);
12020
- return { particles, sequences, overlays };
12021
- }
12022
- function drawEffectState(ctx, state, animTime, getImage) {
12023
- for (const o of state.overlays) {
12024
- const img = getImage(o.spriteUrl);
12025
- if (!img) continue;
12026
- let alpha = o.alpha;
12027
- if (o.pulseAmplitude > 0) {
12028
- const elapsed = (animTime - o.spawnTime) / 1e3;
12029
- alpha += Math.sin(elapsed * o.pulseFrequency * Math.PI * 2) * o.pulseAmplitude;
12030
- alpha = Math.max(0, Math.min(1, alpha));
12031
- }
12032
- const w = img.naturalWidth * o.scale;
12033
- const h = img.naturalHeight * o.scale;
12034
- const prevAlpha = ctx.globalAlpha;
12035
- const prevBlend = ctx.globalCompositeOperation;
12036
- ctx.globalAlpha = alpha;
12037
- ctx.globalCompositeOperation = o.blendMode;
12038
- ctx.drawImage(img, o.x - w / 2, o.y - h / 2, w, h);
12039
- ctx.globalAlpha = prevAlpha;
12040
- ctx.globalCompositeOperation = prevBlend;
12041
- }
12042
- for (const s of state.sequences) {
12043
- const elapsed = animTime - s.startTime;
12044
- let frameIndex = Math.floor(elapsed / s.frameDuration);
12045
- if (s.loop) {
12046
- frameIndex = frameIndex % s.frameUrls.length;
12047
- } else if (frameIndex >= s.frameUrls.length) {
12048
- continue;
12049
- }
12050
- const img = getImage(s.frameUrls[frameIndex]);
12051
- if (!img) continue;
12052
- const w = img.naturalWidth * s.scale;
12053
- const h = img.naturalHeight * s.scale;
12054
- if (s.tint) {
12055
- drawTintedImage(ctx, img, s.x - w / 2, s.y - h / 2, w, h, s.tint, s.alpha, s.blendMode);
12056
- } else {
12057
- const prevAlpha = ctx.globalAlpha;
12058
- const prevBlend = ctx.globalCompositeOperation;
12059
- ctx.globalAlpha = s.alpha;
12060
- ctx.globalCompositeOperation = s.blendMode;
12061
- ctx.drawImage(img, s.x - w / 2, s.y - h / 2, w, h);
12062
- ctx.globalAlpha = prevAlpha;
12063
- ctx.globalCompositeOperation = prevBlend;
12064
- }
12065
- }
12066
- for (const p2 of state.particles) {
12067
- const img = getImage(p2.spriteUrl);
12068
- if (!img) continue;
12069
- const w = img.naturalWidth * p2.scale;
12070
- const h = img.naturalHeight * p2.scale;
12071
- ctx.save();
12072
- ctx.translate(p2.x, p2.y);
12073
- ctx.rotate(p2.rotation);
12074
- drawTintedImage(ctx, img, -w / 2, -h / 2, w, h, p2.tint, p2.alpha, p2.blendMode);
12075
- ctx.restore();
12076
- }
12077
- }
12078
- function hasActiveEffects(state) {
12079
- return state.particles.length > 0 || state.sequences.length > 0 || state.overlays.length > 0;
12080
- }
12081
- function getAllEffectSpriteUrls(manifest) {
12082
- const urls = [];
12083
- const base = manifest.baseUrl;
12084
- if (manifest.particles) {
12085
- for (const value of Object.values(manifest.particles)) {
12086
- if (Array.isArray(value)) {
12087
- value.forEach((v) => urls.push(`${base}/${v}`));
12088
- } else if (typeof value === "string") {
12089
- urls.push(`${base}/${value}`);
12090
- }
12091
- }
12092
- }
12093
- if (manifest.animations) {
12094
- for (const frames of Object.values(manifest.animations)) {
12095
- if (Array.isArray(frames)) {
12096
- frames.forEach((f3) => urls.push(`${base}/${f3}`));
12097
- }
12098
- }
12099
- }
12100
- return urls;
12101
- }
12102
- var _offscreen, _offCtx;
12103
- var init_canvasEffects = __esm({
12104
- "components/game/shared/canvasEffects.ts"() {
12105
- _offscreen = null;
12106
- _offCtx = null;
12107
- }
12108
- });
12109
-
12110
11097
  // components/game/shared/index.ts
12111
11098
  var init_shared = __esm({
12112
11099
  "components/game/shared/index.ts"() {
12113
11100
  init_effects();
12114
11101
  init_boardEntity();
12115
11102
  init_makeAsset();
12116
- init_combatPresets();
12117
- init_canvasEffects();
12118
11103
  }
12119
11104
  });
12120
11105
  function GameIcon({ assetUrl, icon, size = "md", alt, className }) {
@@ -14449,13 +13434,13 @@ function useRenderInterpolation(options = {}) {
14449
13434
  const prevMap = /* @__PURE__ */ new Map();
14450
13435
  for (const e of prev.entities) prevMap.set(e.id, e);
14451
13436
  for (const c of curr.entities) {
14452
- const p2 = prevMap.get(c.id);
14453
- if (!p2) {
13437
+ const p = prevMap.get(c.id);
13438
+ if (!p) {
14454
13439
  out.set(c.id, { x: c.x, y: c.y });
14455
13440
  } else {
14456
13441
  out.set(c.id, {
14457
- x: p2.x + (c.x - p2.x) * alpha,
14458
- y: p2.y + (c.y - p2.y) * alpha
13442
+ x: p.x + (c.x - p.x) * alpha,
13443
+ y: p.y + (c.y - p.y) * alpha
14459
13444
  });
14460
13445
  }
14461
13446
  }
@@ -15020,8 +14005,8 @@ function Canvas2D({
15020
14005
  if (isFree) return 0;
15021
14006
  return (gridHeight - 1) * (scaledTileWidth / 2);
15022
14007
  }, [isFree, gridHeight, scaledTileWidth]);
15023
- const validMoveSet = React104.useMemo(() => new Set(validMoves.map((p2) => `${p2.x},${p2.y}`)), [validMoves]);
15024
- const attackTargetSet = React104.useMemo(() => new Set(attackTargets.map((p2) => `${p2.x},${p2.y}`)), [attackTargets]);
14008
+ const validMoveSet = React104.useMemo(() => new Set(validMoves.map((p) => `${p.x},${p.y}`)), [validMoves]);
14009
+ const attackTargetSet = React104.useMemo(() => new Set(attackTargets.map((p) => `${p.x},${p.y}`)), [attackTargets]);
15025
14010
  const spriteUrls = React104.useMemo(() => {
15026
14011
  const urls = [];
15027
14012
  for (const tile of sortedTiles) {
@@ -15738,264 +14723,6 @@ var init_Canvas2D = __esm({
15738
14723
  Canvas2D.displayName = "Canvas2D";
15739
14724
  }
15740
14725
  });
15741
- function CanvasEffectEngine({
15742
- actionType,
15743
- x,
15744
- y,
15745
- duration = 2e3,
15746
- intensity = 1,
15747
- onComplete,
15748
- className,
15749
- assetManifest,
15750
- width = 400,
15751
- height = 300
15752
- }) {
15753
- const canvasRef = React104.useRef(null);
15754
- const stateRef = React104.useRef({ ...EMPTY_EFFECT_STATE });
15755
- const lastTimeRef = React104.useRef(0);
15756
- const rafRef = React104.useRef(0);
15757
- const imageCacheRef = React104.useRef(/* @__PURE__ */ new Map());
15758
- const [shakeOffset, setShakeOffset] = React104.useState({ x: 0, y: 0 });
15759
- const [flash, setFlash] = React104.useState(null);
15760
- const shakeRef = React104.useRef({ x: 0, y: 0, intensity: 0 });
15761
- const presets = React104.useMemo(() => createCombatPresets(assetManifest), [assetManifest]);
15762
- const spriteUrls = React104.useMemo(() => getAllEffectSpriteUrls(assetManifest), [assetManifest]);
15763
- React104.useEffect(() => {
15764
- const cache = imageCacheRef.current;
15765
- for (const url of spriteUrls) {
15766
- if (!cache.has(url)) {
15767
- const img = new Image();
15768
- img.crossOrigin = "anonymous";
15769
- img.src = url;
15770
- cache.set(url, img);
15771
- }
15772
- }
15773
- }, [spriteUrls]);
15774
- const getImage = React104.useCallback((url) => {
15775
- const img = imageCacheRef.current.get(url);
15776
- return img?.complete ? img : void 0;
15777
- }, []);
15778
- React104.useEffect(() => {
15779
- const now2 = performance.now();
15780
- const effectX = x || width / 2;
15781
- const effectY = y || height / 2;
15782
- const preset = presets[actionType](effectX, effectY);
15783
- const state = stateRef.current;
15784
- for (const emitter of preset.particles) {
15785
- const scaledEmitter = { ...emitter, count: Math.round(emitter.count * intensity) };
15786
- state.particles.push(...spawnParticles(scaledEmitter, now2));
15787
- }
15788
- for (const seqConfig of preset.sequences) {
15789
- state.sequences.push(spawnSequence(seqConfig, now2));
15790
- }
15791
- for (const ovConfig of preset.overlays) {
15792
- state.overlays.push(spawnOverlay(ovConfig, now2));
15793
- }
15794
- if (preset.screenShake > 0) {
15795
- shakeRef.current.intensity = preset.screenShake * intensity;
15796
- }
15797
- if (preset.screenFlash) {
15798
- const { r: r2, g, b, duration: flashDur } = preset.screenFlash;
15799
- setFlash({ color: `rgb(${r2}, ${g}, ${b})`, alpha: 0.3 });
15800
- setTimeout(() => setFlash(null), flashDur);
15801
- }
15802
- const timer = setTimeout(() => {
15803
- onComplete?.();
15804
- }, duration);
15805
- return () => clearTimeout(timer);
15806
- }, []);
15807
- React104.useEffect(() => {
15808
- const canvas = canvasRef.current;
15809
- if (!canvas) return;
15810
- const ctx = canvas.getContext("2d");
15811
- if (!ctx) return;
15812
- function loop(animTime) {
15813
- const delta = lastTimeRef.current > 0 ? animTime - lastTimeRef.current : 16;
15814
- lastTimeRef.current = animTime;
15815
- stateRef.current = updateEffectState(stateRef.current, animTime, delta);
15816
- if (shakeRef.current.intensity > 0.2) {
15817
- const i = shakeRef.current.intensity;
15818
- shakeRef.current.x = (Math.random() - 0.5) * i * 2;
15819
- shakeRef.current.y = (Math.random() - 0.5) * i * 2;
15820
- shakeRef.current.intensity *= 0.85;
15821
- setShakeOffset({ x: shakeRef.current.x, y: shakeRef.current.y });
15822
- } else if (shakeRef.current.intensity > 0) {
15823
- shakeRef.current = { x: 0, y: 0, intensity: 0 };
15824
- setShakeOffset({ x: 0, y: 0 });
15825
- }
15826
- ctx.clearRect(0, 0, width, height);
15827
- drawEffectState(ctx, stateRef.current, animTime, getImage);
15828
- if (hasActiveEffects(stateRef.current)) {
15829
- rafRef.current = requestAnimationFrame(loop);
15830
- }
15831
- }
15832
- rafRef.current = requestAnimationFrame(loop);
15833
- return () => cancelAnimationFrame(rafRef.current);
15834
- }, [width, height, getImage]);
15835
- const shakeStyle = shakeOffset.x !== 0 || shakeOffset.y !== 0 ? { transform: `translate(${shakeOffset.x}px, ${shakeOffset.y}px)` } : {};
15836
- return /* @__PURE__ */ jsxRuntime.jsxs(
15837
- Box,
15838
- {
15839
- className: cn("absolute inset-0 pointer-events-none z-10", className),
15840
- style: shakeStyle,
15841
- children: [
15842
- flash && /* @__PURE__ */ jsxRuntime.jsx(
15843
- Box,
15844
- {
15845
- className: "absolute inset-0 z-20 pointer-events-none rounded-container",
15846
- style: { backgroundColor: flash.color, opacity: flash.alpha }
15847
- }
15848
- ),
15849
- /* @__PURE__ */ jsxRuntime.jsx(
15850
- "canvas",
15851
- {
15852
- ref: canvasRef,
15853
- width,
15854
- height,
15855
- className: "absolute inset-0 w-full h-full",
15856
- style: { imageRendering: "pixelated" }
15857
- }
15858
- )
15859
- ]
15860
- }
15861
- );
15862
- }
15863
- function EmojiEffect({
15864
- actionType,
15865
- x,
15866
- y,
15867
- duration = 800,
15868
- intensity = 1,
15869
- onComplete,
15870
- className,
15871
- effectSpriteUrl,
15872
- assetBaseUrl
15873
- }) {
15874
- const [visible, setVisible] = React104.useState(true);
15875
- const [phase, setPhase] = React104.useState("enter");
15876
- React104.useEffect(() => {
15877
- const enterTimer = setTimeout(() => setPhase("active"), 100);
15878
- const exitTimer = setTimeout(() => setPhase("exit"), duration * 0.7);
15879
- const doneTimer = setTimeout(() => {
15880
- setVisible(false);
15881
- onComplete?.();
15882
- }, duration);
15883
- return () => {
15884
- clearTimeout(enterTimer);
15885
- clearTimeout(exitTimer);
15886
- clearTimeout(doneTimer);
15887
- };
15888
- }, [duration, onComplete]);
15889
- if (!visible) return null;
15890
- const config = ACTION_EMOJI[actionType] ?? ACTION_EMOJI.melee;
15891
- const scaleVal = phase === "enter" ? 0.3 : phase === "active" ? intensity : 0.5;
15892
- const opacity = phase === "exit" ? 0 : 1;
15893
- const resolvedSpriteUrl = effectSpriteUrl ? effectSpriteUrl.startsWith("http") || effectSpriteUrl.startsWith("/") ? effectSpriteUrl : assetBaseUrl ? `${assetBaseUrl.replace(/\/$/, "")}/${effectSpriteUrl}` : effectSpriteUrl : void 0;
15894
- return /* @__PURE__ */ jsxRuntime.jsxs(
15895
- Box,
15896
- {
15897
- className: cn(
15898
- "fixed pointer-events-none z-50 flex items-center justify-center",
15899
- "transition-all ease-out",
15900
- className
15901
- ),
15902
- style: {
15903
- left: x,
15904
- top: y,
15905
- transform: `translate(-50%, -50%) scale(${scaleVal})`,
15906
- opacity,
15907
- transitionDuration: phase === "enter" ? "100ms" : "300ms"
15908
- },
15909
- children: [
15910
- /* @__PURE__ */ jsxRuntime.jsx(
15911
- Box,
15912
- {
15913
- className: "absolute rounded-pill animate-ping",
15914
- style: {
15915
- width: 48 * intensity,
15916
- height: 48 * intensity,
15917
- backgroundColor: config.color,
15918
- opacity: 0.25
15919
- }
15920
- }
15921
- ),
15922
- resolvedSpriteUrl ? /* @__PURE__ */ jsxRuntime.jsx(
15923
- "img",
15924
- {
15925
- src: resolvedSpriteUrl,
15926
- alt: config.label,
15927
- className: "relative drop-shadow-lg",
15928
- style: {
15929
- width: `${3 * intensity}rem`,
15930
- height: `${3 * intensity}rem`,
15931
- objectFit: "contain",
15932
- imageRendering: "pixelated"
15933
- }
15934
- }
15935
- ) : /* @__PURE__ */ jsxRuntime.jsx(
15936
- "span",
15937
- {
15938
- className: "relative text-3xl drop-shadow-lg",
15939
- style: { fontSize: `${2 * intensity}rem` },
15940
- role: "img",
15941
- "aria-label": config.label,
15942
- children: config.emoji
15943
- }
15944
- )
15945
- ]
15946
- }
15947
- );
15948
- }
15949
- function CanvasEffect({
15950
- effectSpriteUrl,
15951
- assetBaseUrl,
15952
- ...props
15953
- }) {
15954
- const eventBus = useEventBus();
15955
- const mergedProps = { effectSpriteUrl, assetBaseUrl, ...props };
15956
- const { completeEvent, onComplete, ...rest } = mergedProps;
15957
- const handleComplete = React104.useCallback(() => {
15958
- if (completeEvent) eventBus.emit(`UI:${completeEvent}`, {});
15959
- onComplete?.();
15960
- }, [completeEvent, eventBus, onComplete]);
15961
- const enhancedProps = { ...rest, onComplete: handleComplete };
15962
- if (rest.assetManifest) {
15963
- return /* @__PURE__ */ jsxRuntime.jsx(CanvasEffectEngine, { ...enhancedProps, assetManifest: rest.assetManifest });
15964
- }
15965
- return /* @__PURE__ */ jsxRuntime.jsx(EmojiEffect, { ...enhancedProps });
15966
- }
15967
- var ACTION_EMOJI;
15968
- var init_CanvasEffect = __esm({
15969
- "components/game/2d/organisms/CanvasEffect.tsx"() {
15970
- "use client";
15971
- init_cn();
15972
- init_useEventBus();
15973
- init_Box();
15974
- init_effects();
15975
- init_canvasEffects();
15976
- init_combatPresets();
15977
- ACTION_EMOJI = {
15978
- melee: { emoji: "\u2694\uFE0F", color: "var(--color-error)", label: "Slash" },
15979
- ranged: { emoji: "\u{1F3F9}", color: "var(--color-warning)", label: "Arrow" },
15980
- magic: { emoji: "\u2728", color: "var(--color-primary)", label: "Spell" },
15981
- heal: { emoji: "\u{1F49A}", color: "var(--color-success)", label: "Heal" },
15982
- buff: { emoji: "\u2B06\uFE0F", color: "var(--color-info)", label: "Buff" },
15983
- debuff: { emoji: "\u2B07\uFE0F", color: "var(--color-warning)", label: "Debuff" },
15984
- shield: { emoji: "\u{1F6E1}\uFE0F", color: "var(--color-info)", label: "Shield" },
15985
- aoe: { emoji: "\u{1F4A5}", color: "var(--color-error)", label: "Explosion" },
15986
- critical: { emoji: "\u{1F525}", color: "var(--color-error)", label: "Critical" },
15987
- defend: { emoji: "\u{1F6E1}\uFE0F", color: "var(--color-info)", label: "Defend" },
15988
- hit: { emoji: "\u{1F4A5}", color: "var(--color-error)", label: "Hit" },
15989
- death: { emoji: "\u{1F480}", color: "var(--color-error)", label: "Death" }
15990
- };
15991
- CanvasEffect.displayName = "CanvasEffect";
15992
- }
15993
- });
15994
- var init_useCanvasEffects = __esm({
15995
- "components/game/shared/hooks/useCanvasEffects.ts"() {
15996
- "use client";
15997
- }
15998
- });
15999
14726
  var init_useGameAudio = __esm({
16000
14727
  "components/game/shared/hooks/useGameAudio.ts"() {
16001
14728
  "use client";
@@ -18615,7 +17342,7 @@ function NegotiatorBoard({
18615
17342
  React104.useEffect(() => {
18616
17343
  if (currentRound > prevRoundRef.current && lastPlayerAction) {
18617
17344
  const opponentPayoffEntry = payoffMatrix.find(
18618
- (p2) => p2.playerAction === lastPlayerAction && p2.opponentAction === lastOpponentAction
17345
+ (p) => p.playerAction === lastPlayerAction && p.opponentAction === lastOpponentAction
18619
17346
  );
18620
17347
  setHistory((prev) => [
18621
17348
  ...prev,
@@ -18901,14 +17628,14 @@ function SimulationCanvas({
18901
17628
  const ctx = canvas.getContext("2d");
18902
17629
  if (!ctx) return;
18903
17630
  const bodies = bodiesRef.current;
18904
- const p2 = presetRef.current;
17631
+ const p = presetRef.current;
18905
17632
  const w = widthRef.current;
18906
17633
  const h = heightRef.current;
18907
17634
  ctx.clearRect(0, 0, w, h);
18908
- ctx.fillStyle = p2.backgroundColor ?? "#1a1a2e";
17635
+ ctx.fillStyle = p.backgroundColor ?? "#1a1a2e";
18909
17636
  ctx.fillRect(0, 0, w, h);
18910
- if (p2.constraints) {
18911
- for (const c of p2.constraints) {
17637
+ if (p.constraints) {
17638
+ for (const c of p.constraints) {
18912
17639
  const a = bodies[c.bodyA];
18913
17640
  const b = bodies[c.bodyB];
18914
17641
  if (a && b) {
@@ -18931,7 +17658,7 @@ function SimulationCanvas({
18931
17658
  ctx.arc(pos.x, pos.y, body.radius, 0, Math.PI * 2);
18932
17659
  ctx.fillStyle = body.color ?? "#e94560";
18933
17660
  ctx.fill();
18934
- if (p2.showVelocity) {
17661
+ if (p.showVelocity) {
18935
17662
  ctx.beginPath();
18936
17663
  ctx.moveTo(pos.x, pos.y);
18937
17664
  ctx.lineTo(pos.x + body.vx * 0.1, pos.y + body.vy * 0.1);
@@ -19190,7 +17917,6 @@ var init_GameShell = __esm({
19190
17917
  var init_molecules = __esm({
19191
17918
  "components/game/2d/molecules/index.ts"() {
19192
17919
  init_shared();
19193
- init_useCanvasEffects();
19194
17920
  init_puzzleObject();
19195
17921
  }
19196
17922
  });
@@ -19231,8 +17957,8 @@ function shapeBounds(shape) {
19231
17957
  case "polygon":
19232
17958
  if (!shape.points || shape.points.length === 0) return null;
19233
17959
  {
19234
- const xs = shape.points.map((p2) => p2.x);
19235
- const ys = shape.points.map((p2) => p2.y);
17960
+ const xs = shape.points.map((p) => p.x);
17961
+ const ys = shape.points.map((p) => p.y);
19236
17962
  const minX = Math.min(...xs);
19237
17963
  const minY = Math.min(...ys);
19238
17964
  return {
@@ -19358,13 +18084,13 @@ function drawShape(ctx, shape, width, height) {
19358
18084
  }
19359
18085
  case "path": {
19360
18086
  if (!shape.path) break;
19361
- const p2 = new Path2D(shape.path);
18087
+ const p = new Path2D(shape.path);
19362
18088
  if (fill) {
19363
18089
  ctx.fillStyle = fill;
19364
- ctx.fill(p2);
18090
+ ctx.fill(p);
19365
18091
  }
19366
18092
  ctx.strokeStyle = stroke;
19367
- ctx.stroke(p2);
18093
+ ctx.stroke(p);
19368
18094
  break;
19369
18095
  }
19370
18096
  case "text": {
@@ -24047,7 +22773,7 @@ function renderStateMachineToDomData(stateMachine, options = {}, config = DEFAUL
24047
22773
  }
24048
22774
  let domOutputs;
24049
22775
  if (outputs.length > 0) {
24050
- const maxX = Math.max(...Object.values(positions).map((p2) => p2.x));
22776
+ const maxX = Math.max(...Object.values(positions).map((p) => p.x));
24051
22777
  const maxOutputLength = Math.max(...outputs.map((o) => o.length));
24052
22778
  const boxWidth = Math.max(200, maxOutputLength * 7 + 30);
24053
22779
  const lineHeight = 22;
@@ -25029,7 +23755,7 @@ var init_BookViewer = __esm({
25029
23755
  }
25030
23756
  });
25031
23757
  function BoxPattern({
25032
- p: p2,
23758
+ p,
25033
23759
  m,
25034
23760
  bg = "transparent",
25035
23761
  border = false,
@@ -25042,7 +23768,7 @@ function BoxPattern({
25042
23768
  return /* @__PURE__ */ jsxRuntime.jsx(
25043
23769
  Box,
25044
23770
  {
25045
- padding: p2,
23771
+ padding: p,
25046
23772
  margin: m,
25047
23773
  bg,
25048
23774
  border,
@@ -26811,10 +25537,10 @@ var init_Chart = __esm({
26811
25537
  const set = [];
26812
25538
  const seen = /* @__PURE__ */ new Set();
26813
25539
  for (const s of series) {
26814
- for (const p2 of s.data) {
26815
- if (!seen.has(p2.label)) {
26816
- seen.add(p2.label);
26817
- set.push(p2.label);
25540
+ for (const p of s.data) {
25541
+ if (!seen.has(p.label)) {
25542
+ seen.add(p.label);
25543
+ set.push(p.label);
26818
25544
  }
26819
25545
  }
26820
25546
  }
@@ -26822,8 +25548,8 @@ var init_Chart = __esm({
26822
25548
  }, [series]);
26823
25549
  const valueAt = React104.useCallback(
26824
25550
  (s, label) => {
26825
- const p2 = s.data.find((d) => d.label === label);
26826
- return p2 ? p2.value : 0;
25551
+ const p = s.data.find((d) => d.label === label);
25552
+ return p ? p.value : 0;
26827
25553
  },
26828
25554
  []
26829
25555
  );
@@ -26840,7 +25566,7 @@ var init_Chart = __esm({
26840
25566
  }
26841
25567
  let m = 1;
26842
25568
  for (const s of series) {
26843
- for (const p2 of s.data) if (p2.value > m) m = p2.value;
25569
+ for (const p of s.data) if (p.value > m) m = p.value;
26844
25570
  }
26845
25571
  return m;
26846
25572
  }, [series, stack, columnTotals]);
@@ -27100,10 +25826,10 @@ var init_Chart = __esm({
27100
25826
  const seen = /* @__PURE__ */ new Set();
27101
25827
  const out = [];
27102
25828
  for (const s of series) {
27103
- for (const p2 of s.data) {
27104
- if (!seen.has(p2.label)) {
27105
- seen.add(p2.label);
27106
- out.push(p2.label);
25829
+ for (const p of s.data) {
25830
+ if (!seen.has(p.label)) {
25831
+ seen.add(p.label);
25832
+ out.push(p.label);
27107
25833
  }
27108
25834
  }
27109
25835
  }
@@ -27112,7 +25838,7 @@ var init_Chart = __esm({
27112
25838
  const maxValue = React104.useMemo(() => {
27113
25839
  let m = 1;
27114
25840
  for (const s of series) {
27115
- for (const p2 of s.data) if (p2.value > m) m = p2.value;
25841
+ for (const p of s.data) if (p.value > m) m = p.value;
27116
25842
  }
27117
25843
  return m;
27118
25844
  }, [series]);
@@ -27159,7 +25885,7 @@ var init_Chart = __esm({
27159
25885
  label
27160
25886
  };
27161
25887
  });
27162
- const linePath = points.map((p2, i) => `${i === 0 ? "M" : "L"} ${p2.x} ${p2.y}`).join(" ");
25888
+ const linePath = points.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ");
27163
25889
  const areaPath = `${linePath} L ${points[points.length - 1]?.x ?? 0} ${padding.top + chartHeight} L ${padding.left} ${padding.top + chartHeight} Z`;
27164
25890
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
27165
25891
  fill && /* @__PURE__ */ jsxRuntime.jsx(
@@ -27182,19 +25908,19 @@ var init_Chart = __esm({
27182
25908
  strokeDasharray: s.dashed ? "6 4" : void 0
27183
25909
  }
27184
25910
  ),
27185
- points.map((p2, idx) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
25911
+ points.map((p, idx) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
27186
25912
  /* @__PURE__ */ jsxRuntime.jsx(
27187
25913
  "circle",
27188
25914
  {
27189
- cx: p2.x,
27190
- cy: p2.y,
25915
+ cx: p.x,
25916
+ cy: p.y,
27191
25917
  r: "4",
27192
25918
  fill: "var(--color-card)",
27193
25919
  stroke: color,
27194
25920
  strokeWidth: "2",
27195
25921
  className: "cursor-pointer",
27196
25922
  onClick: () => onPointClick?.(
27197
- { label: p2.label, value: p2.value, color },
25923
+ { label: p.label, value: p.value, color },
27198
25924
  s.name
27199
25925
  )
27200
25926
  }
@@ -27202,13 +25928,13 @@ var init_Chart = __esm({
27202
25928
  showValues && series.length === 1 && /* @__PURE__ */ jsxRuntime.jsx(
27203
25929
  "text",
27204
25930
  {
27205
- x: p2.x,
27206
- y: p2.y - 10,
25931
+ x: p.x,
25932
+ y: p.y - 10,
27207
25933
  textAnchor: "middle",
27208
25934
  fill: "var(--color-foreground)",
27209
25935
  fontSize: "10",
27210
25936
  fontWeight: "500",
27211
- children: p2.value
25937
+ children: p.value
27212
25938
  }
27213
25939
  )
27214
25940
  ] }, idx))
@@ -27243,11 +25969,11 @@ var init_Chart = __esm({
27243
25969
  let mxX = data[0].x;
27244
25970
  let mnY = data[0].y;
27245
25971
  let mxY = data[0].y;
27246
- for (const p2 of data) {
27247
- if (p2.x < mnX) mnX = p2.x;
27248
- if (p2.x > mxX) mxX = p2.x;
27249
- if (p2.y < mnY) mnY = p2.y;
27250
- if (p2.y > mxY) mxY = p2.y;
25972
+ for (const p of data) {
25973
+ if (p.x < mnX) mnX = p.x;
25974
+ if (p.x > mxX) mxX = p.x;
25975
+ if (p.y < mnY) mnY = p.y;
25976
+ if (p.y > mxY) mxY = p.y;
27251
25977
  }
27252
25978
  return { minX: mnX, maxX: mxX, minY: mnY, maxY: mxY };
27253
25979
  }, [data]);
@@ -27277,11 +26003,11 @@ var init_Chart = __esm({
27277
26003
  frac
27278
26004
  );
27279
26005
  }),
27280
- data.map((p2, idx) => {
27281
- const cx = padding.left + (p2.x - minX) / rangeX * chartWidth;
27282
- const cy = padding.top + chartHeight - (p2.y - minY) / rangeY * chartHeight;
27283
- const r2 = p2.size ?? 5;
27284
- const color = p2.color ?? CHART_COLORS[idx % CHART_COLORS.length];
26006
+ data.map((p, idx) => {
26007
+ const cx = padding.left + (p.x - minX) / rangeX * chartWidth;
26008
+ const cy = padding.top + chartHeight - (p.y - minY) / rangeY * chartHeight;
26009
+ const r2 = p.size ?? 5;
26010
+ const color = p.color ?? CHART_COLORS[idx % CHART_COLORS.length];
27285
26011
  return /* @__PURE__ */ jsxRuntime.jsx(
27286
26012
  "circle",
27287
26013
  {
@@ -27293,13 +26019,13 @@ var init_Chart = __esm({
27293
26019
  className: "cursor-pointer hover:opacity-100",
27294
26020
  onClick: () => onPointClick?.(
27295
26021
  {
27296
- label: p2.label ?? `(${p2.x}, ${p2.y})`,
27297
- value: p2.y,
26022
+ label: p.label ?? `(${p.x}, ${p.y})`,
26023
+ value: p.y,
27298
26024
  color
27299
26025
  },
27300
26026
  "default"
27301
26027
  ),
27302
- children: /* @__PURE__ */ jsxRuntime.jsx("title", { children: p2.label ?? `(${p2.x}, ${p2.y})` })
26028
+ children: /* @__PURE__ */ jsxRuntime.jsx("title", { children: p.label ?? `(${p.x}, ${p.y})` })
27303
26029
  },
27304
26030
  idx
27305
26031
  );
@@ -33457,7 +32183,7 @@ var init_LineChart = __esm({
33457
32183
  }, [sortedData, width, height]);
33458
32184
  const linePath = React104.useMemo(() => {
33459
32185
  if (points.length === 0) return "";
33460
- return points.map((p2, i) => `${i === 0 ? "M" : "L"} ${p2.x} ${p2.y}`).join(" ");
32186
+ return points.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ");
33461
32187
  }, [points]);
33462
32188
  const areaPath = React104.useMemo(() => {
33463
32189
  if (points.length === 0 || !showArea) return "";
@@ -33657,18 +32383,18 @@ var init_MathCanvas = __esm({
33657
32383
  });
33658
32384
  }
33659
32385
  }
33660
- for (const p2 of points) {
33661
- if (p2.x < xMin || p2.x > xMax || p2.y < yMin || p2.y > yMax) continue;
32386
+ for (const p of points) {
32387
+ if (p.x < xMin || p.x > xMax || p.y < yMin || p.y > yMax) continue;
33662
32388
  out.push({
33663
32389
  type: "circle",
33664
- x: mapX(p2.x),
33665
- y: mapY(p2.y),
33666
- radius: p2.radius ?? 4,
33667
- color: p2.color ?? "#dc2626",
33668
- fill: p2.color ?? "#dc2626"
32390
+ x: mapX(p.x),
32391
+ y: mapY(p.y),
32392
+ radius: p.radius ?? 4,
32393
+ color: p.color ?? "#dc2626",
32394
+ fill: p.color ?? "#dc2626"
33669
32395
  });
33670
- if (p2.label) {
33671
- out.push({ type: "text", x: mapX(p2.x) + 8, y: mapY(p2.y) - 8, text: p2.label, color: "#111827", fontSize: 12 });
32396
+ if (p.label) {
32397
+ out.push({ type: "text", x: mapX(p.x) + 8, y: mapY(p.y) - 8, text: p.label, color: "#111827", fontSize: 12 });
33672
32398
  }
33673
32399
  }
33674
32400
  for (const v of vectors) {
@@ -34187,13 +32913,13 @@ var init_MapView = __esm({
34187
32913
  shadowSize: [41, 41]
34188
32914
  });
34189
32915
  L.Marker.prototype.options.icon = defaultIcon;
34190
- const { useEffect: useEffect72, useRef: useRef69, useCallback: useCallback107, useState: useState107 } = React104__namespace.default;
32916
+ const { useEffect: useEffect71, useRef: useRef67, useCallback: useCallback105, useState: useState105 } = React104__namespace.default;
34191
32917
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
34192
32918
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
34193
32919
  function MapUpdater({ centerLat, centerLng, zoom }) {
34194
32920
  const map = useMap();
34195
- const prevRef = useRef69({ centerLat, centerLng, zoom });
34196
- useEffect72(() => {
32921
+ const prevRef = useRef67({ centerLat, centerLng, zoom });
32922
+ useEffect71(() => {
34197
32923
  const prev = prevRef.current;
34198
32924
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
34199
32925
  map.setView([centerLat, centerLng], zoom);
@@ -34204,7 +32930,7 @@ var init_MapView = __esm({
34204
32930
  }
34205
32931
  function MapClickHandler({ onMapClick }) {
34206
32932
  const map = useMap();
34207
- useEffect72(() => {
32933
+ useEffect71(() => {
34208
32934
  if (!onMapClick) return;
34209
32935
  const handler = (e) => {
34210
32936
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -34232,8 +32958,8 @@ var init_MapView = __esm({
34232
32958
  showAttribution = true
34233
32959
  }) {
34234
32960
  const eventBus = useEventBus2();
34235
- const [clickedPosition, setClickedPosition] = useState107(null);
34236
- const handleMapClick = useCallback107((lat, lng) => {
32961
+ const [clickedPosition, setClickedPosition] = useState105(null);
32962
+ const handleMapClick = useCallback105((lat, lng) => {
34237
32963
  if (showClickedPin) {
34238
32964
  setClickedPosition({ lat, lng });
34239
32965
  }
@@ -34242,7 +32968,7 @@ var init_MapView = __esm({
34242
32968
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
34243
32969
  }
34244
32970
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
34245
- const handleMarkerClick = useCallback107((marker) => {
32971
+ const handleMarkerClick = useCallback105((marker) => {
34246
32972
  onMarkerClick?.(marker);
34247
32973
  if (markerClickEvent) {
34248
32974
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -35315,7 +34041,7 @@ function TableView({
35315
34041
  children: [
35316
34042
  header,
35317
34043
  dnd.wrapContainer(body),
35318
- hasMore && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", size: "sm", onClick: () => setVisibleCount((p2) => p2 + (pageSize || 5)), children: [
34044
+ hasMore && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", size: "sm", onClick: () => setVisibleCount((p) => p + (pageSize || 5)), children: [
35319
34045
  /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
35320
34046
  t("common.showMore"),
35321
34047
  " (",
@@ -38037,7 +36763,7 @@ var init_QrScanner = __esm({
38037
36763
  setCurrentFacing((f3) => f3 === "environment" ? "user" : "environment");
38038
36764
  }, []);
38039
36765
  const togglePause = React104.useCallback(() => {
38040
- setIsPaused((p2) => !p2);
36766
+ setIsPaused((p) => !p);
38041
36767
  }, []);
38042
36768
  const handleMockScan = React104.useCallback(() => {
38043
36769
  const result = {
@@ -42089,12 +40815,12 @@ var init_DocumentViewer = __esm({
42089
40815
  const handleZoomIn = React104.useCallback(() => setZoom((z) => Math.min(z + 25, 200)), []);
42090
40816
  const handleZoomOut = React104.useCallback(() => setZoom((z) => Math.max(z - 25, 50)), []);
42091
40817
  const handlePagePrev = React104.useCallback(() => {
42092
- setCurrentPage((p2) => Math.max(p2 - 1, 1));
40818
+ setCurrentPage((p) => Math.max(p - 1, 1));
42093
40819
  eventBus.emit("UI:DOCUMENT_PAGE_CHANGE", { page: currentPage - 1 });
42094
40820
  }, [eventBus, currentPage]);
42095
40821
  const handlePageNext = React104.useCallback(() => {
42096
40822
  if (totalPages) {
42097
- setCurrentPage((p2) => Math.min(p2 + 1, totalPages));
40823
+ setCurrentPage((p) => Math.min(p + 1, totalPages));
42098
40824
  eventBus.emit("UI:DOCUMENT_PAGE_CHANGE", { page: currentPage + 1 });
42099
40825
  }
42100
40826
  }, [totalPages, eventBus, currentPage]);
@@ -46196,7 +44922,7 @@ function WalkMinimap() {
46196
44922
  const graphH = 120;
46197
44923
  const nodeR = 10;
46198
44924
  const positions = activeTrait ? layoutGraph(activeTrait.states, activeTrait.transitions, activeTrait.initialState, graphW, graphH) : [];
46199
- const posMap = new Map(positions.map((p2) => [p2.state, p2]));
44925
+ const posMap = new Map(positions.map((p) => [p.state, p]));
46200
44926
  const visitedStates = new Set(
46201
44927
  coveredEdges.filter((e) => e.trait === walkStep.traitName).flatMap((e) => [e.from, e.to])
46202
44928
  );
@@ -49466,7 +48192,6 @@ var init_component_registry_generated = __esm({
49466
48192
  init_CTABanner();
49467
48193
  init_CalendarGrid();
49468
48194
  init_Canvas2D();
49469
- init_CanvasEffect();
49470
48195
  init_Card();
49471
48196
  init_CardGrid();
49472
48197
  init_Carousel();
@@ -49765,7 +48490,6 @@ var init_component_registry_generated = __esm({
49765
48490
  "CTABanner": CTABanner,
49766
48491
  "CalendarGrid": CalendarGrid,
49767
48492
  "Canvas2D": Canvas2D,
49768
- "CanvasEffect": CanvasEffect,
49769
48493
  "Card": Card,
49770
48494
  "CardGrid": CardGrid,
49771
48495
  "Carousel": Carousel,
@@ -52946,10 +51670,10 @@ function getTraits(orbital) {
52946
51670
  }
52947
51671
  function getPages(orbital) {
52948
51672
  if (!orbital.pages) return [];
52949
- return orbital.pages.map((p2) => {
52950
- if (typeof p2 === "string") return { name: p2, path: `/${p2.toLowerCase()}` };
52951
- if ("ref" in p2 && !("path" in p2)) return { name: p2.ref, path: `/${p2.ref.toLowerCase()}` };
52952
- return p2;
51673
+ return orbital.pages.map((p) => {
51674
+ if (typeof p === "string") return { name: p, path: `/${p.toLowerCase()}` };
51675
+ if ("ref" in p && !("path" in p)) return { name: p.ref, path: `/${p.ref.toLowerCase()}` };
51676
+ return p;
52953
51677
  });
52954
51678
  }
52955
51679
  function getStateMachine(trait) {
@@ -53025,7 +51749,7 @@ function parseApplicationLevel(schema) {
53025
51749
  fieldCount: entity.fields.length,
53026
51750
  persistence: entity.persistence,
53027
51751
  traitNames: traits2.map((t) => t.name ?? ""),
53028
- pageNames: pages.map((p2) => p2.name ?? ""),
51752
+ pageNames: pages.map((p) => p.name ?? ""),
53029
51753
  position: {
53030
51754
  x: originX + i % cols * spacing,
53031
51755
  y: originY + Math.floor(i / cols) * spacing
@@ -53087,9 +51811,9 @@ function parseOrbitalLevel(schema, orbitalName) {
53087
51811
  listens: getListens(t)
53088
51812
  };
53089
51813
  });
53090
- const pageInfos = pages.map((p2) => ({
53091
- name: p2.name ?? "",
53092
- route: p2.path ?? `/${(p2.name ?? "").toLowerCase()}`
51814
+ const pageInfos = pages.map((p) => ({
51815
+ name: p.name ?? "",
51816
+ route: p.path ?? `/${(p.name ?? "").toLowerCase()}`
53093
51817
  }));
53094
51818
  const externalLinks = [];
53095
51819
  const thisTraitEmits = traits2.flatMap((t) => getEmits(t).map((e) => ({ trait: t.name ?? "", event: e })));
@@ -53296,7 +52020,7 @@ var SystemNode = ({ data }) => {
53296
52020
  i < stateChain.length - 1 && /* @__PURE__ */ jsxRuntime.jsx("line", { x1: i * 14 + 12, y1: 5, x2: i * 14 + 15, y2: 5, stroke: "var(--color-border)", strokeWidth: 0.5 })
53297
52021
  ] }, s.name);
53298
52022
  }) }),
53299
- pageDots.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("svg", { width: pageDots.length * 10, height: 10, viewBox: `0 0 ${pageDots.length * 10} 10`, children: pageDots.map((p2, i) => /* @__PURE__ */ jsxRuntime.jsx(exports.AvlPage, { x: i * 10 + 4, y: 4, size: 5 }, p2.name)) })
52023
+ pageDots.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("svg", { width: pageDots.length * 10, height: 10, viewBox: `0 0 ${pageDots.length * 10} 10`, children: pageDots.map((p, i) => /* @__PURE__ */ jsxRuntime.jsx(exports.AvlPage, { x: i * 10 + 4, y: 4, size: 5 }, p.name)) })
53300
52024
  ] })
53301
52025
  ]
53302
52026
  }
@@ -53699,10 +52423,10 @@ function getEntityInfo(orbital) {
53699
52423
  }
53700
52424
  function getPages2(orbital) {
53701
52425
  if (!orbital.pages) return [];
53702
- return orbital.pages.map((p2) => {
53703
- if (typeof p2 === "string") return `/${p2.toLowerCase()}`;
53704
- if ("ref" in p2) return p2.path ?? `/${p2.ref}`.toLowerCase();
53705
- return p2.path ?? `/${p2.name}`.toLowerCase();
52426
+ return orbital.pages.map((p) => {
52427
+ if (typeof p === "string") return `/${p.toLowerCase()}`;
52428
+ if ("ref" in p) return p.path ?? `/${p.ref}`.toLowerCase();
52429
+ return p.path ?? `/${p.name}`.toLowerCase();
53706
52430
  });
53707
52431
  }
53708
52432
  function getEmits2(trait) {
@@ -53903,10 +52627,10 @@ function schemaToOverviewGraph(schema, mockData, behaviorMeta, layoutHint, orbit
53903
52627
  const smEvents = trait.stateMachine?.events ?? [];
53904
52628
  const matchingEvent = smEvents.find((ev) => ev.key === source.event);
53905
52629
  if (matchingEvent?.payloadSchema && Array.isArray(matchingEvent.payloadSchema)) {
53906
- source.payloadFields = matchingEvent.payloadSchema.map((p2) => ({
53907
- name: p2.name ?? "",
53908
- type: p2.type ?? "string",
53909
- ...p2.required ? { required: true } : {}
52630
+ source.payloadFields = matchingEvent.payloadSchema.map((p) => ({
52631
+ name: p.name ?? "",
52632
+ type: p.type ?? "string",
52633
+ ...p.required ? { required: true } : {}
53910
52634
  }));
53911
52635
  break;
53912
52636
  }
@@ -54402,12 +53126,12 @@ function isFnFormLambda(value) {
54402
53126
  return false;
54403
53127
  }
54404
53128
  const params = arr[1];
54405
- return typeof params === "string" || Array.isArray(params) && params.length > 0 && params.every((p2) => typeof p2 === "string");
53129
+ return typeof params === "string" || Array.isArray(params) && params.length > 0 && params.every((p) => typeof p === "string");
54406
53130
  }
54407
53131
  function fnFormParams(value) {
54408
- const p2 = value[1];
54409
- if (typeof p2 === "string") return [p2];
54410
- if (Array.isArray(p2)) return p2.filter((x) => typeof x === "string");
53132
+ const p = value[1];
53133
+ if (typeof p === "string") return [p];
53134
+ if (Array.isArray(p)) return p.filter((x) => typeof x === "string");
54411
53135
  return [];
54412
53136
  }
54413
53137
  function resolveLambdaBindings(body, params, item, index) {
@@ -55750,9 +54474,9 @@ function SchemaRunner({ schema, serverUrl, transport, mockData, pageName, onNavi
55750
54474
  const orbitalsByTrait = React104.useMemo(
55751
54475
  () => buildOrbitalsByTrait(
55752
54476
  schema,
55753
- ir ? Array.from(ir.pages.values()).map((p2) => ({
55754
- path: p2.path,
55755
- traitNames: p2.traits.map((b) => b.trait.name)
54477
+ ir ? Array.from(ir.pages.values()).map((p) => ({
54478
+ path: p.path,
54479
+ traitNames: p.traits.map((b) => b.trait.name)
55756
54480
  })) : []
55757
54481
  ),
55758
54482
  [schema, ir]
@@ -55941,7 +54665,7 @@ function OrbPreview({
55941
54665
  navLog.debug("handleNavigate", () => ({
55942
54666
  path,
55943
54667
  matched: match?.page.name ?? null,
55944
- availablePaths: pages.map((p2) => p2.page.path)
54668
+ availablePaths: pages.map((p) => p.page.path)
55945
54669
  }));
55946
54670
  if (match) {
55947
54671
  setCurrentPage(match.page.name);
@@ -55985,7 +54709,7 @@ function OrbPreview({
55985
54709
  handleNavigate(href);
55986
54710
  };
55987
54711
  el.addEventListener("click", handler, true);
55988
- navLog.info("interceptor:installed", { pageCount: pages.length, paths: pages.map((p2) => p2.page.path) });
54712
+ navLog.info("interceptor:installed", { pageCount: pages.length, paths: pages.map((p) => p.page.path) });
55989
54713
  return () => el.removeEventListener("click", handler, true);
55990
54714
  }, [pages, handleNavigate]);
55991
54715
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -58327,9 +57051,9 @@ function FlowCanvasInner({
58327
57051
  const [selectedPattern, setSelectedPattern] = React104.useState(null);
58328
57052
  const patternSelectionValue = React104.useMemo(() => ({
58329
57053
  selected: selectedPattern,
58330
- select: (p2) => {
58331
- setSelectedPattern(p2);
58332
- if (p2) setSelectedNode(p2.nodeData);
57054
+ select: (p) => {
57055
+ setSelectedPattern(p);
57056
+ if (p) setSelectedNode(p.nodeData);
58333
57057
  }
58334
57058
  }), [selectedPattern]);
58335
57059
  const [atBehaviorLevel, setAtBehaviorLevel] = React104.useState(composeLevel === "behavior");
@@ -58601,7 +57325,7 @@ function FlowCanvasInner({
58601
57325
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", className: "text-muted-foreground", children: level === "overview" ? t("canvas.modulesCount", { count: nodes.length }) : t("canvas.screensCount", { count: nodes.length }) })
58602
57326
  ] }),
58603
57327
  /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "flex items-center gap-1 px-2 py-1 rounded-md bg-card/80 border border-border/40 backdrop-blur-sm", children: screenSizeKeys.map((size) => {
58604
- const p2 = SCREEN_SIZE_PRESETS[size];
57328
+ const p = SCREEN_SIZE_PRESETS[size];
58605
57329
  const active = screenSize === size;
58606
57330
  return /* @__PURE__ */ jsxRuntime.jsx(
58607
57331
  "button",
@@ -58613,9 +57337,9 @@ function FlowCanvasInner({
58613
57337
  });
58614
57338
  },
58615
57339
  className: `px-2 py-1 text-xs font-medium rounded cursor-pointer border-none transition-colors ${active ? "bg-primary text-primary-foreground" : "bg-transparent text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,
58616
- title: `${p2.label} (${p2.width}px)`,
58617
- "aria-label": t("canvas.switchToView", { label: p2.label }),
58618
- children: p2.label
57340
+ title: `${p.label} (${p.width}px)`,
57341
+ "aria-label": t("canvas.switchToView", { label: p.label }),
57342
+ children: p.label
58619
57343
  },
58620
57344
  size
58621
57345
  );