easter-egg-quest 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/easter-egg-quest.es.js +145 -133
- package/dist/easter-egg-quest.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _a, _b;
|
|
1
2
|
const DEFAULT_SCRIPT = {
|
|
2
3
|
// ── Stage 0: Hidden entry hints (shown in escalating order) ───────────
|
|
3
4
|
hiddenEntryHints: [
|
|
@@ -134,13 +135,13 @@ const DEFAULT_EXCLUDE_SELECTORS = [
|
|
|
134
135
|
"[data-no-easter]"
|
|
135
136
|
];
|
|
136
137
|
function resolveConfig(raw = {}) {
|
|
137
|
-
var
|
|
138
|
-
const prefersReduced = typeof window !== "undefined" && ((
|
|
138
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
139
|
+
const prefersReduced = typeof window !== "undefined" && ((_a2 = window.matchMedia) == null ? void 0 : _a2.call(window, "(prefers-reduced-motion: reduce)").matches);
|
|
139
140
|
const theme = resolveTheme(raw.theme);
|
|
140
141
|
return {
|
|
141
142
|
theme,
|
|
142
143
|
hiddenEntry: {
|
|
143
|
-
mode: ((
|
|
144
|
+
mode: ((_b2 = raw.hiddenEntry) == null ? void 0 : _b2.mode) ?? "auto",
|
|
144
145
|
selector: (_c = raw.hiddenEntry) == null ? void 0 : _c.selector,
|
|
145
146
|
excludeSelectors: [
|
|
146
147
|
...DEFAULT_EXCLUDE_SELECTORS,
|
|
@@ -190,12 +191,12 @@ class EventBus {
|
|
|
190
191
|
this.listeners.get(event).add(fn);
|
|
191
192
|
}
|
|
192
193
|
off(event, fn) {
|
|
193
|
-
var
|
|
194
|
-
(
|
|
194
|
+
var _a2;
|
|
195
|
+
(_a2 = this.listeners.get(event)) == null ? void 0 : _a2.delete(fn);
|
|
195
196
|
}
|
|
196
197
|
emit(event, ...args) {
|
|
197
|
-
var
|
|
198
|
-
(
|
|
198
|
+
var _a2;
|
|
199
|
+
(_a2 = this.listeners.get(event)) == null ? void 0 : _a2.forEach((fn) => {
|
|
199
200
|
try {
|
|
200
201
|
fn(...args);
|
|
201
202
|
} catch {
|
|
@@ -236,7 +237,7 @@ class StateMachine {
|
|
|
236
237
|
}
|
|
237
238
|
/** Attempt a transition. Returns true if valid, false otherwise. */
|
|
238
239
|
transitionTo(next) {
|
|
239
|
-
var
|
|
240
|
+
var _a2;
|
|
240
241
|
const allowed = VALID_TRANSITIONS[this._state];
|
|
241
242
|
if (!allowed || !allowed.includes(next)) {
|
|
242
243
|
console.warn(`[EasterEggQuest] Invalid transition: ${this._state} → ${next}`);
|
|
@@ -244,7 +245,7 @@ class StateMachine {
|
|
|
244
245
|
}
|
|
245
246
|
const prev = this._state;
|
|
246
247
|
this._state = next;
|
|
247
|
-
(
|
|
248
|
+
(_a2 = this._onTransition) == null ? void 0 : _a2.call(this, prev, next);
|
|
248
249
|
return true;
|
|
249
250
|
}
|
|
250
251
|
/** Force-reset to idle (used for restart / destroy). */
|
|
@@ -545,7 +546,7 @@ class HiddenEntry {
|
|
|
545
546
|
this._startHintEscalation();
|
|
546
547
|
}
|
|
547
548
|
cleanup() {
|
|
548
|
-
var
|
|
549
|
+
var _a2, _b2, _c, _d;
|
|
549
550
|
this._destroyed = true;
|
|
550
551
|
for (const t of this.hintTimers) clearTimeout(t);
|
|
551
552
|
this.hintTimers = [];
|
|
@@ -556,9 +557,9 @@ class HiddenEntry {
|
|
|
556
557
|
this.targetElement.style.removeProperty("animation");
|
|
557
558
|
this.targetElement.classList.remove("eeq-entry-target");
|
|
558
559
|
}
|
|
559
|
-
(
|
|
560
|
+
(_a2 = this._injectedElement) == null ? void 0 : _a2.remove();
|
|
560
561
|
this._injectedElement = null;
|
|
561
|
-
(
|
|
562
|
+
(_b2 = this.hintContainer) == null ? void 0 : _b2.remove();
|
|
562
563
|
(_c = this.shimmerStyle) == null ? void 0 : _c.remove();
|
|
563
564
|
(_d = this.fallbackButton) == null ? void 0 : _d.remove();
|
|
564
565
|
}
|
|
@@ -574,8 +575,8 @@ class HiddenEntry {
|
|
|
574
575
|
"p, li, figcaption, blockquote, h4, h3, h2, h1, header a, nav a, nav button"
|
|
575
576
|
)
|
|
576
577
|
).filter((el) => {
|
|
577
|
-
var
|
|
578
|
-
const text = ((
|
|
578
|
+
var _a2;
|
|
579
|
+
const text = ((_a2 = el.textContent) == null ? void 0 : _a2.trim()) ?? "";
|
|
579
580
|
const rect = el.getBoundingClientRect();
|
|
580
581
|
return text.length >= 2 && rect.width > 0 && rect.height > 0 && !el.closest("[data-eeq]");
|
|
581
582
|
});
|
|
@@ -589,8 +590,8 @@ class HiddenEntry {
|
|
|
589
590
|
});
|
|
590
591
|
const prints = sorted.map(
|
|
591
592
|
(el) => {
|
|
592
|
-
var
|
|
593
|
-
return `${el.tagName}:${(((
|
|
593
|
+
var _a2;
|
|
594
|
+
return `${el.tagName}:${(((_a2 = el.textContent) == null ? void 0 : _a2.trim()) ?? "").slice(0, 30)}`;
|
|
594
595
|
}
|
|
595
596
|
);
|
|
596
597
|
const HISTORY_KEY = "eeq_trigger_history";
|
|
@@ -622,8 +623,8 @@ class HiddenEntry {
|
|
|
622
623
|
];
|
|
623
624
|
const rotatedPrints = rotated.map(
|
|
624
625
|
(el) => {
|
|
625
|
-
var
|
|
626
|
-
return `${el.tagName}:${(((
|
|
626
|
+
var _a2;
|
|
627
|
+
return `${el.tagName}:${(((_a2 = el.textContent) == null ? void 0 : _a2.trim()) ?? "").slice(0, 30)}`;
|
|
627
628
|
}
|
|
628
629
|
);
|
|
629
630
|
const unused = rotated.filter((_, i) => !usedSet.has(rotatedPrints[i]));
|
|
@@ -674,10 +675,10 @@ class HiddenEntry {
|
|
|
674
675
|
* Returns true if inserted without layout shift.
|
|
675
676
|
*/
|
|
676
677
|
_tryInsertBetweenWords(host, span) {
|
|
677
|
-
var
|
|
678
|
+
var _a2;
|
|
678
679
|
const textNodes = [];
|
|
679
680
|
for (const node of host.childNodes) {
|
|
680
|
-
if (node.nodeType === Node.TEXT_NODE && (((
|
|
681
|
+
if (node.nodeType === Node.TEXT_NODE && (((_a2 = node.textContent) == null ? void 0 : _a2.trim().length) ?? 0) > 5) {
|
|
681
682
|
textNodes.push(node);
|
|
682
683
|
}
|
|
683
684
|
}
|
|
@@ -977,9 +978,9 @@ class NarrativeRenderer {
|
|
|
977
978
|
}
|
|
978
979
|
/** Remove all DOM. */
|
|
979
980
|
destroy() {
|
|
980
|
-
var
|
|
981
|
+
var _a2;
|
|
981
982
|
this.clear();
|
|
982
|
-
(
|
|
983
|
+
(_a2 = this.host) == null ? void 0 : _a2.remove();
|
|
983
984
|
this.host = null;
|
|
984
985
|
this.shadow = null;
|
|
985
986
|
this.container = null;
|
|
@@ -1124,15 +1125,15 @@ class ShrineRenderer {
|
|
|
1124
1125
|
inner.className = "eeq-egg-inner";
|
|
1125
1126
|
slot.appendChild(inner);
|
|
1126
1127
|
slot.addEventListener("click", () => {
|
|
1127
|
-
var
|
|
1128
|
+
var _a2;
|
|
1128
1129
|
if (this._activeSlot === i) {
|
|
1129
|
-
(
|
|
1130
|
+
(_a2 = this._onEggClick) == null ? void 0 : _a2.call(this, i);
|
|
1130
1131
|
}
|
|
1131
1132
|
});
|
|
1132
1133
|
slot.addEventListener("keydown", (e) => {
|
|
1133
|
-
var
|
|
1134
|
+
var _a2;
|
|
1134
1135
|
if (e.key === "Enter" && this._activeSlot === i) {
|
|
1135
|
-
(
|
|
1136
|
+
(_a2 = this._onEggClick) == null ? void 0 : _a2.call(this, i);
|
|
1136
1137
|
}
|
|
1137
1138
|
});
|
|
1138
1139
|
container.appendChild(slot);
|
|
@@ -1190,8 +1191,8 @@ class ShrineRenderer {
|
|
|
1190
1191
|
}
|
|
1191
1192
|
}
|
|
1192
1193
|
destroy() {
|
|
1193
|
-
var
|
|
1194
|
-
(
|
|
1194
|
+
var _a2;
|
|
1195
|
+
(_a2 = this.host) == null ? void 0 : _a2.remove();
|
|
1195
1196
|
this.host = null;
|
|
1196
1197
|
this.shadow = null;
|
|
1197
1198
|
this.slots = [];
|
|
@@ -1558,8 +1559,8 @@ class ThreeRenderer {
|
|
|
1558
1559
|
}
|
|
1559
1560
|
/** Reset renderer state for game restart (preserves WebGL context). */
|
|
1560
1561
|
resetForRestart() {
|
|
1561
|
-
var
|
|
1562
|
-
(
|
|
1562
|
+
var _a2, _b2, _c, _d, _e, _f, _g;
|
|
1563
|
+
(_a2 = this._greetingOverlay) == null ? void 0 : _a2.remove();
|
|
1563
1564
|
this._greetingOverlay = null;
|
|
1564
1565
|
this.stopRenderLoop();
|
|
1565
1566
|
for (let i = 0; i < 3; i++) {
|
|
@@ -1581,7 +1582,7 @@ class ThreeRenderer {
|
|
|
1581
1582
|
this._finaleT = 0;
|
|
1582
1583
|
this.disableInteraction();
|
|
1583
1584
|
for (const p of [...this._trailParticles, ...this._ambientParticles, ...this._revealParticles, ...this._vortexParticles, ...this._emberParticles]) {
|
|
1584
|
-
(
|
|
1585
|
+
(_b2 = this.scene) == null ? void 0 : _b2.remove(p.mesh);
|
|
1585
1586
|
(_c = p.mesh.geometry) == null ? void 0 : _c.dispose();
|
|
1586
1587
|
(_d = p.mesh.material) == null ? void 0 : _d.dispose();
|
|
1587
1588
|
}
|
|
@@ -1703,14 +1704,14 @@ class ThreeRenderer {
|
|
|
1703
1704
|
}
|
|
1704
1705
|
/** Re-draw the festive (3rd) egg texture with a specific seed for uniqueness. */
|
|
1705
1706
|
setFestiveEggSeed(seed) {
|
|
1706
|
-
var
|
|
1707
|
+
var _a2;
|
|
1707
1708
|
const body = this.eggBodies[2];
|
|
1708
1709
|
if (!body || !this.THREE) return;
|
|
1709
1710
|
const T = this.THREE;
|
|
1710
1711
|
const newTex = new T.CanvasTexture(this._drawFestivePattern(seed));
|
|
1711
1712
|
newTex.colorSpace = T.SRGBColorSpace;
|
|
1712
1713
|
newTex.wrapS = T.RepeatWrapping;
|
|
1713
|
-
(
|
|
1714
|
+
(_a2 = body.material.map) == null ? void 0 : _a2.dispose();
|
|
1714
1715
|
body.material.map = newTex;
|
|
1715
1716
|
body.material.needsUpdate = true;
|
|
1716
1717
|
}
|
|
@@ -1723,7 +1724,7 @@ class ThreeRenderer {
|
|
|
1723
1724
|
setOverlayIntensity(_progress) {
|
|
1724
1725
|
}
|
|
1725
1726
|
destroy() {
|
|
1726
|
-
var
|
|
1727
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
1727
1728
|
this._disposed = true;
|
|
1728
1729
|
this.stopRenderLoop();
|
|
1729
1730
|
this.disableInteraction();
|
|
@@ -1746,8 +1747,8 @@ class ThreeRenderer {
|
|
|
1746
1747
|
...this._emberParticles
|
|
1747
1748
|
];
|
|
1748
1749
|
for (const p of disposeList) {
|
|
1749
|
-
(
|
|
1750
|
-
(
|
|
1750
|
+
(_a2 = this.scene) == null ? void 0 : _a2.remove(p.mesh);
|
|
1751
|
+
(_b2 = p.mesh.geometry) == null ? void 0 : _b2.dispose();
|
|
1751
1752
|
(_c = p.mesh.material) == null ? void 0 : _c.dispose();
|
|
1752
1753
|
}
|
|
1753
1754
|
this._trailParticles = [];
|
|
@@ -2460,7 +2461,7 @@ class ThreeRenderer {
|
|
|
2460
2461
|
}
|
|
2461
2462
|
/** Update vortex particles — orbit, spiral inward, fade in then out. */
|
|
2462
2463
|
_updateVortexParticles(dt, collectProgress) {
|
|
2463
|
-
var
|
|
2464
|
+
var _a2;
|
|
2464
2465
|
for (let i = this._vortexParticles.length - 1; i >= 0; i--) {
|
|
2465
2466
|
const p = this._vortexParticles[i];
|
|
2466
2467
|
if (collectProgress < p.delay) continue;
|
|
@@ -2480,7 +2481,7 @@ class ThreeRenderer {
|
|
|
2480
2481
|
}
|
|
2481
2482
|
p.mesh.scale.setScalar(0.8 + Math.sin(p.angle * 3) * 0.3);
|
|
2482
2483
|
if (localP >= 1) {
|
|
2483
|
-
(
|
|
2484
|
+
(_a2 = this.scene) == null ? void 0 : _a2.remove(p.mesh);
|
|
2484
2485
|
p.mesh.geometry.dispose();
|
|
2485
2486
|
p.mesh.material.dispose();
|
|
2486
2487
|
this._vortexParticles.splice(i, 1);
|
|
@@ -2489,7 +2490,7 @@ class ThreeRenderer {
|
|
|
2489
2490
|
}
|
|
2490
2491
|
/** Update ember particles — drift up, sway, flicker, fade. */
|
|
2491
2492
|
_updateEmberParticles(dt) {
|
|
2492
|
-
var
|
|
2493
|
+
var _a2;
|
|
2493
2494
|
for (let i = this._emberParticles.length - 1; i >= 0; i--) {
|
|
2494
2495
|
const p = this._emberParticles[i];
|
|
2495
2496
|
p.life -= dt * 0.4;
|
|
@@ -2504,7 +2505,7 @@ class ThreeRenderer {
|
|
|
2504
2505
|
p.mesh.material.opacity = Math.max(0, p.life * flick);
|
|
2505
2506
|
p.mesh.scale.setScalar(0.5 + p.life * 0.5);
|
|
2506
2507
|
if (p.life <= 0) {
|
|
2507
|
-
(
|
|
2508
|
+
(_a2 = this.scene) == null ? void 0 : _a2.remove(p.mesh);
|
|
2508
2509
|
p.mesh.geometry.dispose();
|
|
2509
2510
|
p.mesh.material.dispose();
|
|
2510
2511
|
this._emberParticles.splice(i, 1);
|
|
@@ -2512,7 +2513,7 @@ class ThreeRenderer {
|
|
|
2512
2513
|
}
|
|
2513
2514
|
}
|
|
2514
2515
|
_cancelLongPress() {
|
|
2515
|
-
var
|
|
2516
|
+
var _a2;
|
|
2516
2517
|
this._longPressActive = false;
|
|
2517
2518
|
this._holdProgress = 0;
|
|
2518
2519
|
if (this._interactiveEgg !== null) {
|
|
@@ -2522,7 +2523,7 @@ class ThreeRenderer {
|
|
|
2522
2523
|
egg.rotation.z = 0;
|
|
2523
2524
|
}
|
|
2524
2525
|
const body = this.eggBodies[this._interactiveEgg];
|
|
2525
|
-
if (((
|
|
2526
|
+
if (((_a2 = body == null ? void 0 : body.material) == null ? void 0 : _a2.emissiveIntensity) !== void 0) {
|
|
2526
2527
|
body.material.emissiveIntensity = 0.05;
|
|
2527
2528
|
}
|
|
2528
2529
|
}
|
|
@@ -2548,7 +2549,7 @@ class ThreeRenderer {
|
|
|
2548
2549
|
return this.camera.position.clone().add(dir.multiplyScalar(dist));
|
|
2549
2550
|
}
|
|
2550
2551
|
_updateEggs(dt) {
|
|
2551
|
-
var
|
|
2552
|
+
var _a2, _b2;
|
|
2552
2553
|
if (!this.THREE) return;
|
|
2553
2554
|
for (let i = 0; i < 3; i++) {
|
|
2554
2555
|
const group = this.eggs[i];
|
|
@@ -2565,7 +2566,7 @@ class ThreeRenderer {
|
|
|
2565
2566
|
group.rotation.y = state.t * 1.2;
|
|
2566
2567
|
group.position.y = Math.sin(state.t * 2) * 0.06 * (1 - p);
|
|
2567
2568
|
const body = this.eggBodies[i];
|
|
2568
|
-
if (((
|
|
2569
|
+
if (((_a2 = body == null ? void 0 : body.material) == null ? void 0 : _a2.emissiveIntensity) !== void 0) {
|
|
2569
2570
|
body.material.emissiveIntensity = 0.15 + Math.sin(state.t * 4) * 0.1;
|
|
2570
2571
|
}
|
|
2571
2572
|
if (p >= 1) {
|
|
@@ -2580,7 +2581,7 @@ class ThreeRenderer {
|
|
|
2580
2581
|
}
|
|
2581
2582
|
group.position.y = Math.sin(state.t * 0.7) * 0.04;
|
|
2582
2583
|
const body = this.eggBodies[i];
|
|
2583
|
-
if (((
|
|
2584
|
+
if (((_b2 = body == null ? void 0 : body.material) == null ? void 0 : _b2.emissiveIntensity) !== void 0) {
|
|
2584
2585
|
body.material.emissiveIntensity = 0.05 + Math.sin(state.t * 1.5) * 0.04;
|
|
2585
2586
|
}
|
|
2586
2587
|
break;
|
|
@@ -2601,7 +2602,7 @@ class ThreeRenderer {
|
|
|
2601
2602
|
}
|
|
2602
2603
|
}
|
|
2603
2604
|
_updateHoldRing() {
|
|
2604
|
-
var
|
|
2605
|
+
var _a2;
|
|
2605
2606
|
if (!this._longPressActive || this._interactiveEgg === null) return;
|
|
2606
2607
|
const elapsed = Date.now() - this._longPressStartTime;
|
|
2607
2608
|
const holdDuration = 1200;
|
|
@@ -2622,7 +2623,7 @@ class ThreeRenderer {
|
|
|
2622
2623
|
const idx = this._interactiveEgg;
|
|
2623
2624
|
this._spawnMiniEggBurst(idx);
|
|
2624
2625
|
this._cancelLongPress();
|
|
2625
|
-
(
|
|
2626
|
+
(_a2 = this._onCollectEgg) == null ? void 0 : _a2.call(this, idx);
|
|
2626
2627
|
}
|
|
2627
2628
|
}
|
|
2628
2629
|
/** Spawn a burst of shards flying outward from the collected egg, in the egg's own colour. */
|
|
@@ -2685,7 +2686,7 @@ class ThreeRenderer {
|
|
|
2685
2686
|
}
|
|
2686
2687
|
}
|
|
2687
2688
|
_updateMiniEggs(dt) {
|
|
2688
|
-
var
|
|
2689
|
+
var _a2, _b2;
|
|
2689
2690
|
for (let i = this._miniEggs.length - 1; i >= 0; i--) {
|
|
2690
2691
|
const p = this._miniEggs[i];
|
|
2691
2692
|
p.life -= dt * 1.2;
|
|
@@ -2699,14 +2700,14 @@ class ThreeRenderer {
|
|
|
2699
2700
|
p.mesh.material.opacity = fade;
|
|
2700
2701
|
p.mesh.scale.multiplyScalar(1 - dt * 0.5);
|
|
2701
2702
|
if (p.life <= 0) {
|
|
2702
|
-
(
|
|
2703
|
-
(
|
|
2703
|
+
(_a2 = this.scene) == null ? void 0 : _a2.remove(p.mesh);
|
|
2704
|
+
(_b2 = p.mesh.material) == null ? void 0 : _b2.dispose();
|
|
2704
2705
|
this._miniEggs.splice(i, 1);
|
|
2705
2706
|
}
|
|
2706
2707
|
}
|
|
2707
2708
|
}
|
|
2708
2709
|
_updateFinale(dt) {
|
|
2709
|
-
var
|
|
2710
|
+
var _a2;
|
|
2710
2711
|
if (!this._finaleActive || !this.THREE) return;
|
|
2711
2712
|
this._finaleT += dt;
|
|
2712
2713
|
const angle = this._finaleT * 0.35;
|
|
@@ -2728,7 +2729,7 @@ class ThreeRenderer {
|
|
|
2728
2729
|
group.scale.x + (eggScale - group.scale.x) * 0.04
|
|
2729
2730
|
);
|
|
2730
2731
|
const body = this.eggBodies[i];
|
|
2731
|
-
if (((
|
|
2732
|
+
if (((_a2 = body == null ? void 0 : body.material) == null ? void 0 : _a2.emissiveIntensity) !== void 0) {
|
|
2732
2733
|
const glow = 0.15 + Math.sin(this._finaleT * 2 + i * 1.5) * 0.08;
|
|
2733
2734
|
body.material.emissiveIntensity += (glow - body.material.emissiveIntensity) * 0.05;
|
|
2734
2735
|
}
|
|
@@ -2887,8 +2888,8 @@ class FallbackRenderer {
|
|
|
2887
2888
|
setOverlayIntensity(_progress) {
|
|
2888
2889
|
}
|
|
2889
2890
|
destroy() {
|
|
2890
|
-
var
|
|
2891
|
-
(
|
|
2891
|
+
var _a2;
|
|
2892
|
+
(_a2 = this.host) == null ? void 0 : _a2.remove();
|
|
2892
2893
|
this.host = null;
|
|
2893
2894
|
this.shadow = null;
|
|
2894
2895
|
this.container = null;
|
|
@@ -3073,8 +3074,8 @@ class OverlayManager {
|
|
|
3073
3074
|
this.overlay.style.WebkitBackdropFilter = "none";
|
|
3074
3075
|
}
|
|
3075
3076
|
destroy() {
|
|
3076
|
-
var
|
|
3077
|
-
(
|
|
3077
|
+
var _a2;
|
|
3078
|
+
(_a2 = this.overlay) == null ? void 0 : _a2.remove();
|
|
3078
3079
|
this.overlay = null;
|
|
3079
3080
|
}
|
|
3080
3081
|
}
|
|
@@ -3086,7 +3087,7 @@ const _ResultsRenderer = class _ResultsRenderer {
|
|
|
3086
3087
|
this.config = config;
|
|
3087
3088
|
}
|
|
3088
3089
|
show(score, onFinish) {
|
|
3089
|
-
var
|
|
3090
|
+
var _a2, _b2;
|
|
3090
3091
|
this._onFinish = onFinish;
|
|
3091
3092
|
this.host = document.createElement("div");
|
|
3092
3093
|
this.host.id = "eeq-results-host";
|
|
@@ -3116,15 +3117,15 @@ const _ResultsRenderer = class _ResultsRenderer {
|
|
|
3116
3117
|
panel.classList.add("eeq-results-visible");
|
|
3117
3118
|
});
|
|
3118
3119
|
});
|
|
3119
|
-
(
|
|
3120
|
-
var
|
|
3121
|
-
return (
|
|
3120
|
+
(_a2 = this.shadow.querySelector(".eeq-btn-finish")) == null ? void 0 : _a2.addEventListener("click", () => {
|
|
3121
|
+
var _a3;
|
|
3122
|
+
return (_a3 = this._onFinish) == null ? void 0 : _a3.call(this);
|
|
3122
3123
|
});
|
|
3123
|
-
(
|
|
3124
|
+
(_b2 = this.shadow.querySelector(".eeq-btn-share")) == null ? void 0 : _b2.addEventListener("click", () => this._copyShareImage(score));
|
|
3124
3125
|
}
|
|
3125
3126
|
destroy() {
|
|
3126
|
-
var
|
|
3127
|
-
(
|
|
3127
|
+
var _a2;
|
|
3128
|
+
(_a2 = this.host) == null ? void 0 : _a2.remove();
|
|
3128
3129
|
this.host = null;
|
|
3129
3130
|
this.shadow = null;
|
|
3130
3131
|
}
|
|
@@ -3396,12 +3397,12 @@ const _ResultsRenderer = class _ResultsRenderer {
|
|
|
3396
3397
|
_copyShareImage(s) {
|
|
3397
3398
|
const canvas = this._renderCard(s);
|
|
3398
3399
|
canvas.toBlob((blob) => {
|
|
3399
|
-
var
|
|
3400
|
+
var _a2;
|
|
3400
3401
|
if (!blob) return;
|
|
3401
3402
|
const isMobile = /Android|iPhone|iPad|iPod/i.test(navigator.userAgent) && window.innerWidth < 768;
|
|
3402
3403
|
if (isMobile && navigator.share) {
|
|
3403
3404
|
const file = new File([blob], "easter-egg-quest.png", { type: "image/png" });
|
|
3404
|
-
if ((
|
|
3405
|
+
if ((_a2 = navigator.canShare) == null ? void 0 : _a2.call(navigator, { files: [file] })) {
|
|
3405
3406
|
navigator.share({
|
|
3406
3407
|
files: [file],
|
|
3407
3408
|
title: "Easter Egg Quest",
|
|
@@ -3527,8 +3528,8 @@ const _ResultsRenderer = class _ResultsRenderer {
|
|
|
3527
3528
|
}
|
|
3528
3529
|
// ─── Helpers ───────────────────────────────────────────────────────────
|
|
3529
3530
|
_flashButton(selector, text) {
|
|
3530
|
-
var
|
|
3531
|
-
const span = (
|
|
3531
|
+
var _a2;
|
|
3532
|
+
const span = (_a2 = this.shadow) == null ? void 0 : _a2.querySelector(`${selector} span`);
|
|
3532
3533
|
if (!span) return;
|
|
3533
3534
|
const orig = span.textContent;
|
|
3534
3535
|
span.textContent = text;
|
|
@@ -4256,21 +4257,21 @@ class PageReactor {
|
|
|
4256
4257
|
}
|
|
4257
4258
|
}
|
|
4258
4259
|
destroy() {
|
|
4259
|
-
var
|
|
4260
|
+
var _a2;
|
|
4260
4261
|
document.querySelectorAll(`.${this._reactClass}`).forEach((el) => {
|
|
4261
4262
|
el.className = el.className.replace(/\beeq-react-\S+/g, "").trim();
|
|
4262
4263
|
});
|
|
4263
|
-
(
|
|
4264
|
+
(_a2 = this._styleEl) == null ? void 0 : _a2.remove();
|
|
4264
4265
|
this._styleEl = null;
|
|
4265
4266
|
}
|
|
4266
4267
|
_findCandidates() {
|
|
4267
|
-
var
|
|
4268
|
+
var _a2;
|
|
4268
4269
|
const all = document.querySelectorAll(
|
|
4269
4270
|
"p, h1, h2, h3, h4, h5, li, a, img, button, blockquote, figcaption, td, th"
|
|
4270
4271
|
);
|
|
4271
4272
|
const result = [];
|
|
4272
4273
|
for (const el of all) {
|
|
4273
|
-
if ((
|
|
4274
|
+
if ((_a2 = el.id) == null ? void 0 : _a2.startsWith("eeq-")) continue;
|
|
4274
4275
|
if (el.closest('[id^="eeq-"]')) continue;
|
|
4275
4276
|
const rect = el.getBoundingClientRect();
|
|
4276
4277
|
if (rect.width === 0 || rect.height === 0) continue;
|
|
@@ -4375,11 +4376,11 @@ class PageBreather {
|
|
|
4375
4376
|
return this._inSync;
|
|
4376
4377
|
}
|
|
4377
4378
|
stop() {
|
|
4378
|
-
var
|
|
4379
|
+
var _a2;
|
|
4379
4380
|
if (!this._active) return;
|
|
4380
4381
|
this._active = false;
|
|
4381
4382
|
cancelAnimationFrame(this._rafId);
|
|
4382
|
-
(
|
|
4383
|
+
(_a2 = this._overlay) == null ? void 0 : _a2.remove();
|
|
4383
4384
|
this._overlay = null;
|
|
4384
4385
|
this._intensity = 0;
|
|
4385
4386
|
this._targetIntensity = 0;
|
|
@@ -4417,7 +4418,7 @@ class GameController {
|
|
|
4417
4418
|
this._tremorClass = "eeq-tremor";
|
|
4418
4419
|
this._lastFrameTime = 0;
|
|
4419
4420
|
this._gameLoop = () => {
|
|
4420
|
-
var
|
|
4421
|
+
var _a2;
|
|
4421
4422
|
if (!this._running || this._destroyed) return;
|
|
4422
4423
|
this._updateRaf = requestAnimationFrame(this._gameLoop);
|
|
4423
4424
|
if (this.state.isPaused) return;
|
|
@@ -4425,7 +4426,7 @@ class GameController {
|
|
|
4425
4426
|
const dt = (now - this._lastFrameTime) / 1e3;
|
|
4426
4427
|
this._lastFrameTime = now;
|
|
4427
4428
|
this.scoring.analyseFrame(this.input.snapshot);
|
|
4428
|
-
(
|
|
4429
|
+
(_a2 = this.hud) == null ? void 0 : _a2.update(this.state, this.fsm.label);
|
|
4429
4430
|
if (this.activeStage) {
|
|
4430
4431
|
const status = this.activeStage.update(dt);
|
|
4431
4432
|
if (status === "complete") {
|
|
@@ -4460,26 +4461,26 @@ class GameController {
|
|
|
4460
4461
|
}
|
|
4461
4462
|
// ─── Lifecycle ─────────────────────────────────────────────────────────
|
|
4462
4463
|
async init() {
|
|
4463
|
-
var
|
|
4464
|
+
var _a2, _b2;
|
|
4464
4465
|
this.fsm.onTransition((from, to) => this._onTransition(from, to));
|
|
4465
4466
|
this.bus.on("narrative:show", (text) => {
|
|
4466
|
-
var
|
|
4467
|
-
return (
|
|
4467
|
+
var _a3;
|
|
4468
|
+
return (_a3 = this.narrative) == null ? void 0 : _a3.showLine(text);
|
|
4468
4469
|
});
|
|
4469
4470
|
this.bus.on("narrative:clear", () => {
|
|
4470
|
-
var
|
|
4471
|
-
return (
|
|
4471
|
+
var _a3;
|
|
4472
|
+
return (_a3 = this.narrative) == null ? void 0 : _a3.clear();
|
|
4472
4473
|
});
|
|
4473
4474
|
this.bus.on("egg:reveal", (index) => this._handleEggReveal(index));
|
|
4474
4475
|
this.bus.on("stage:progress", (p) => this._handleStageProgress(p));
|
|
4475
4476
|
this.bus.on("motion:trail", (data) => {
|
|
4476
|
-
var
|
|
4477
|
-
(
|
|
4477
|
+
var _a3;
|
|
4478
|
+
(_a3 = this.eggRenderer) == null ? void 0 : _a3.addTrail(data.x, data.y, data.velocity);
|
|
4478
4479
|
});
|
|
4479
4480
|
this.bus.on("rhythm:breathe", (data) => {
|
|
4480
|
-
var
|
|
4481
|
-
(
|
|
4482
|
-
(
|
|
4481
|
+
var _a3, _b3, _c;
|
|
4482
|
+
(_a3 = this.eggRenderer) == null ? void 0 : _a3.setBreathIntensity(data.accuracy);
|
|
4483
|
+
(_b3 = this.pageBreather) == null ? void 0 : _b3.update(data.accuracy, data.isMoving);
|
|
4483
4484
|
if (((_c = this.pageBreather) == null ? void 0 : _c.isInSync()) && this.threeRenderer) {
|
|
4484
4485
|
this.threeRenderer.showProgressParticles(0.6 + data.accuracy * 0.4);
|
|
4485
4486
|
}
|
|
@@ -4497,7 +4498,7 @@ class GameController {
|
|
|
4497
4498
|
});
|
|
4498
4499
|
}
|
|
4499
4500
|
this.scoring.start();
|
|
4500
|
-
(
|
|
4501
|
+
(_b2 = (_a2 = this.config.callbacks).onInit) == null ? void 0 : _b2.call(_a2);
|
|
4501
4502
|
window.addEventListener("pagehide", this._onPageHide);
|
|
4502
4503
|
window.addEventListener("beforeunload", this._onPageHide);
|
|
4503
4504
|
const checkpoint = this.persistence.loadProgress();
|
|
@@ -4508,14 +4509,14 @@ class GameController {
|
|
|
4508
4509
|
}
|
|
4509
4510
|
}
|
|
4510
4511
|
pause() {
|
|
4511
|
-
var
|
|
4512
|
+
var _a2;
|
|
4512
4513
|
this.state.isPaused = true;
|
|
4513
|
-
(
|
|
4514
|
+
(_a2 = this.hud) == null ? void 0 : _a2.pause();
|
|
4514
4515
|
}
|
|
4515
4516
|
resume() {
|
|
4516
|
-
var
|
|
4517
|
+
var _a2;
|
|
4517
4518
|
this.state.isPaused = false;
|
|
4518
|
-
(
|
|
4519
|
+
(_a2 = this.hud) == null ? void 0 : _a2.resume();
|
|
4519
4520
|
}
|
|
4520
4521
|
async restart() {
|
|
4521
4522
|
this._cleanup();
|
|
@@ -4537,13 +4538,13 @@ class GameController {
|
|
|
4537
4538
|
this.fsm.transitionTo("entry");
|
|
4538
4539
|
}
|
|
4539
4540
|
destroy() {
|
|
4540
|
-
var
|
|
4541
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
4541
4542
|
this._destroyed = true;
|
|
4542
4543
|
window.removeEventListener("pagehide", this._onPageHide);
|
|
4543
4544
|
window.removeEventListener("beforeunload", this._onPageHide);
|
|
4544
4545
|
this._cleanup();
|
|
4545
|
-
(
|
|
4546
|
-
(
|
|
4546
|
+
(_a2 = this.narrative) == null ? void 0 : _a2.destroy();
|
|
4547
|
+
(_b2 = this.hud) == null ? void 0 : _b2.destroy();
|
|
4547
4548
|
(_c = this.shrine) == null ? void 0 : _c.destroy();
|
|
4548
4549
|
(_d = this.threeRenderer) == null ? void 0 : _d.destroy();
|
|
4549
4550
|
(_e = this.fallbackRenderer) == null ? void 0 : _e.destroy();
|
|
@@ -4569,10 +4570,10 @@ class GameController {
|
|
|
4569
4570
|
}
|
|
4570
4571
|
// ─── FSM Transition Handler ────────────────────────────────────────────
|
|
4571
4572
|
async _onTransition(from, to) {
|
|
4572
|
-
var
|
|
4573
|
+
var _a2;
|
|
4573
4574
|
this.state.stage = to;
|
|
4574
4575
|
this.state.stageStartTime = Date.now();
|
|
4575
|
-
(
|
|
4576
|
+
(_a2 = this.hud) == null ? void 0 : _a2.update(this.state, this.fsm.label);
|
|
4576
4577
|
const checkpointStages = [
|
|
4577
4578
|
"stage1-intro",
|
|
4578
4579
|
"stage2-intro",
|
|
@@ -4635,7 +4636,7 @@ class GameController {
|
|
|
4635
4636
|
});
|
|
4636
4637
|
}
|
|
4637
4638
|
_resumeFromCheckpoint(cp) {
|
|
4638
|
-
var
|
|
4639
|
+
var _a2, _b2;
|
|
4639
4640
|
const validResumeStages = [
|
|
4640
4641
|
"stage1-intro",
|
|
4641
4642
|
"stage2-intro",
|
|
@@ -4652,36 +4653,36 @@ class GameController {
|
|
|
4652
4653
|
for (let i = 0; i < 3; i++) {
|
|
4653
4654
|
this.state.eggs[i].found = cp.eggsState[i];
|
|
4654
4655
|
}
|
|
4655
|
-
(
|
|
4656
|
+
(_a2 = this.shrine) == null ? void 0 : _a2.show();
|
|
4656
4657
|
for (let i = 0; i < cp.eggsFound; i++) {
|
|
4657
|
-
(
|
|
4658
|
+
(_b2 = this.shrine) == null ? void 0 : _b2.fillSlot(i);
|
|
4658
4659
|
}
|
|
4659
4660
|
this.fsm.forceState(cp.stage);
|
|
4660
4661
|
this._onTransition("idle", cp.stage);
|
|
4661
4662
|
}
|
|
4662
4663
|
// ─── Entry ─────────────────────────────────────────────────────────────
|
|
4663
4664
|
async _startEntry() {
|
|
4664
|
-
var
|
|
4665
|
+
var _a2;
|
|
4665
4666
|
try {
|
|
4666
4667
|
if (localStorage.getItem("eeq_optout") === "1") return;
|
|
4667
4668
|
} catch {
|
|
4668
4669
|
}
|
|
4669
4670
|
this.state.startTime = Date.now();
|
|
4670
|
-
(
|
|
4671
|
+
(_a2 = this.hud) == null ? void 0 : _a2.startTimer();
|
|
4671
4672
|
this.hiddenEntry = new HiddenEntry(this.config, this.script, () => {
|
|
4672
|
-
var
|
|
4673
|
+
var _a3, _b2;
|
|
4673
4674
|
this.scoring.recordEntryFound();
|
|
4674
|
-
(
|
|
4675
|
+
(_b2 = (_a3 = this.config.callbacks).onEntryFound) == null ? void 0 : _b2.call(_a3);
|
|
4675
4676
|
this._onEntryFound();
|
|
4676
4677
|
});
|
|
4677
4678
|
this.hiddenEntry.start();
|
|
4678
4679
|
}
|
|
4679
4680
|
async _onEntryFound() {
|
|
4680
|
-
var
|
|
4681
|
-
(
|
|
4681
|
+
var _a2, _b2, _c, _d;
|
|
4682
|
+
(_a2 = this.hiddenEntry) == null ? void 0 : _a2.cleanup();
|
|
4682
4683
|
this.hiddenEntry = null;
|
|
4683
4684
|
this._startAnticipationTremor();
|
|
4684
|
-
(
|
|
4685
|
+
(_b2 = this.shrine) == null ? void 0 : _b2.show();
|
|
4685
4686
|
await ((_c = this.narrative) == null ? void 0 : _c.showSequence(this.script.entryConfirmation, 1500));
|
|
4686
4687
|
(_d = this.narrative) == null ? void 0 : _d.clear();
|
|
4687
4688
|
this._stopAnticipationTremor();
|
|
@@ -4714,12 +4715,12 @@ class GameController {
|
|
|
4714
4715
|
);
|
|
4715
4716
|
let count = 0;
|
|
4716
4717
|
candidates.forEach((el) => {
|
|
4717
|
-
var
|
|
4718
|
+
var _a2;
|
|
4718
4719
|
const rect = el.getBoundingClientRect();
|
|
4719
4720
|
if (rect.width > 300 || rect.height > 100) return;
|
|
4720
4721
|
if (rect.width === 0 || rect.height === 0) return;
|
|
4721
4722
|
if (rect.bottom < 0 || rect.top > window.innerHeight) return;
|
|
4722
|
-
if ((
|
|
4723
|
+
if ((_a2 = el.id) == null ? void 0 : _a2.startsWith("eeq-")) return;
|
|
4723
4724
|
if (el.closest('[id^="eeq-"]')) return;
|
|
4724
4725
|
const delay = Math.random() * 800;
|
|
4725
4726
|
const htmlEl = el;
|
|
@@ -4731,17 +4732,17 @@ class GameController {
|
|
|
4731
4732
|
});
|
|
4732
4733
|
}
|
|
4733
4734
|
_stopAnticipationTremor() {
|
|
4734
|
-
var
|
|
4735
|
+
var _a2;
|
|
4735
4736
|
document.querySelectorAll(`.${this._tremorClass}`).forEach((el) => {
|
|
4736
4737
|
el.classList.remove(this._tremorClass);
|
|
4737
4738
|
});
|
|
4738
|
-
(
|
|
4739
|
+
(_a2 = this._tremorStyle) == null ? void 0 : _a2.remove();
|
|
4739
4740
|
this._tremorStyle = null;
|
|
4740
4741
|
}
|
|
4741
4742
|
// ─── Stage 1: Stillness ────────────────────────────────────────────────
|
|
4742
4743
|
async _startStage1() {
|
|
4743
|
-
var
|
|
4744
|
-
(
|
|
4744
|
+
var _a2, _b2, _c, _d;
|
|
4745
|
+
(_b2 = (_a2 = this.config.callbacks).onStageStart) == null ? void 0 : _b2.call(_a2, "stage1-intro");
|
|
4745
4746
|
(_c = this.hud) == null ? void 0 : _c.update(this.state, this.fsm.label);
|
|
4746
4747
|
(_d = this.eggRenderer) == null ? void 0 : _d.startRenderLoop();
|
|
4747
4748
|
const stage = new StillnessStage(this.config, this.script, this.input, this.bus);
|
|
@@ -4751,8 +4752,8 @@ class GameController {
|
|
|
4751
4752
|
}
|
|
4752
4753
|
// ─── Stage 2: Motion ───────────────────────────────────────────────────
|
|
4753
4754
|
async _startStage2() {
|
|
4754
|
-
var
|
|
4755
|
-
(
|
|
4755
|
+
var _a2, _b2, _c;
|
|
4756
|
+
(_b2 = (_a2 = this.config.callbacks).onStageStart) == null ? void 0 : _b2.call(_a2, "stage2-intro");
|
|
4756
4757
|
(_c = this.hud) == null ? void 0 : _c.update(this.state, this.fsm.label);
|
|
4757
4758
|
const stage = new MotionStage(this.config, this.script, this.input, this.bus);
|
|
4758
4759
|
this.activeStage = stage;
|
|
@@ -4761,8 +4762,8 @@ class GameController {
|
|
|
4761
4762
|
}
|
|
4762
4763
|
// ─── Stage 3: Rhythm ──────────────────────────────────────────────────
|
|
4763
4764
|
async _startStage3() {
|
|
4764
|
-
var
|
|
4765
|
-
(
|
|
4765
|
+
var _a2, _b2, _c;
|
|
4766
|
+
(_b2 = (_a2 = this.config.callbacks).onStageStart) == null ? void 0 : _b2.call(_a2, "stage3-intro");
|
|
4766
4767
|
(_c = this.hud) == null ? void 0 : _c.update(this.state, this.fsm.label);
|
|
4767
4768
|
const stage = new RhythmStage(this.config, this.script, this.input, this.bus);
|
|
4768
4769
|
this.activeStage = stage;
|
|
@@ -4780,22 +4781,22 @@ class GameController {
|
|
|
4780
4781
|
}
|
|
4781
4782
|
// ─── Egg Reveal ────────────────────────────────────────────────────────
|
|
4782
4783
|
_handleEggReveal(index) {
|
|
4783
|
-
var
|
|
4784
|
+
var _a2, _b2, _c, _d;
|
|
4784
4785
|
this.state.eggs[index].found = true;
|
|
4785
4786
|
this.state.eggs[index].foundTime = Date.now();
|
|
4786
4787
|
this.state.eggsFound++;
|
|
4787
|
-
(
|
|
4788
|
-
(
|
|
4788
|
+
(_a2 = this.eggRenderer) == null ? void 0 : _a2.revealEgg(index);
|
|
4789
|
+
(_b2 = this.hud) == null ? void 0 : _b2.flashEggFound(index);
|
|
4789
4790
|
(_d = (_c = this.config.callbacks).onEggFound) == null ? void 0 : _d.call(_c, index);
|
|
4790
4791
|
}
|
|
4791
4792
|
async _handleStageSuccess(eggIndex) {
|
|
4792
|
-
var
|
|
4793
|
+
var _a2, _b2, _c, _d, _e, _f, _g;
|
|
4793
4794
|
if (this.activeStage) {
|
|
4794
4795
|
const result = this.activeStage.getResult();
|
|
4795
4796
|
this.scoring.recordStageResult(result);
|
|
4796
4797
|
this.activeStage.cleanup();
|
|
4797
4798
|
this.activeStage = null;
|
|
4798
|
-
(
|
|
4799
|
+
(_b2 = (_a2 = this.config.callbacks).onStageComplete) == null ? void 0 : _b2.call(_a2, this.fsm.state, result);
|
|
4799
4800
|
}
|
|
4800
4801
|
const successLines = eggIndex === 0 ? this.script.stage1Success : eggIndex === 1 ? this.script.stage2Success : this.script.stage3Success;
|
|
4801
4802
|
await ((_c = this.narrative) == null ? void 0 : _c.showSequence(successLines, 1500));
|
|
@@ -4817,8 +4818,8 @@ class GameController {
|
|
|
4817
4818
|
}
|
|
4818
4819
|
// ─── Shrine Click (advance to next stage) ──────────────────────────────
|
|
4819
4820
|
_onShrineEggClick(eggIndex) {
|
|
4820
|
-
var
|
|
4821
|
-
(
|
|
4821
|
+
var _a2;
|
|
4822
|
+
(_a2 = this.shrine) == null ? void 0 : _a2.deactivateSlot(eggIndex);
|
|
4822
4823
|
if (eggIndex === 0) {
|
|
4823
4824
|
this.fsm.transitionTo("stage2-intro");
|
|
4824
4825
|
} else if (eggIndex === 1) {
|
|
@@ -4827,9 +4828,9 @@ class GameController {
|
|
|
4827
4828
|
}
|
|
4828
4829
|
// ─── Long-press collect (3D egg interaction) ───────────────────────────
|
|
4829
4830
|
async _onEggLongPressCollect(eggIndex) {
|
|
4830
|
-
var
|
|
4831
|
-
(
|
|
4832
|
-
(
|
|
4831
|
+
var _a2, _b2, _c, _d, _e;
|
|
4832
|
+
(_a2 = this.eggRenderer) == null ? void 0 : _a2.collectEgg(eggIndex);
|
|
4833
|
+
(_b2 = this.shrine) == null ? void 0 : _b2.fillSlot(eggIndex);
|
|
4833
4834
|
if (eggIndex === 2) {
|
|
4834
4835
|
(_c = this.pageBreather) == null ? void 0 : _c.destroy();
|
|
4835
4836
|
this.pageBreather = null;
|
|
@@ -4874,8 +4875,8 @@ class GameController {
|
|
|
4874
4875
|
}
|
|
4875
4876
|
// ─── Finale ────────────────────────────────────────────────────────────
|
|
4876
4877
|
async _startFinale() {
|
|
4877
|
-
var
|
|
4878
|
-
(
|
|
4878
|
+
var _a2, _b2, _c, _d, _e, _f;
|
|
4879
|
+
(_b2 = (_a2 = this.config.callbacks).onFinaleStart) == null ? void 0 : _b2.call(_a2);
|
|
4879
4880
|
(_c = this.shrine) == null ? void 0 : _c.hideAll();
|
|
4880
4881
|
await this._wait(1e3);
|
|
4881
4882
|
(_d = this.eggRenderer) == null ? void 0 : _d.startFinale();
|
|
@@ -4886,7 +4887,7 @@ class GameController {
|
|
|
4886
4887
|
}
|
|
4887
4888
|
// ─── Results ───────────────────────────────────────────────────────────
|
|
4888
4889
|
_showResults() {
|
|
4889
|
-
var
|
|
4890
|
+
var _a2, _b2, _c;
|
|
4890
4891
|
const snap = this.input.snapshot;
|
|
4891
4892
|
const score = this.scoring.computeFinalScore({
|
|
4892
4893
|
totalClicks: snap.totalClicks,
|
|
@@ -4904,7 +4905,7 @@ class GameController {
|
|
|
4904
4905
|
this.config.scoring.leaderboardAdapter.submitScore(score).catch(() => {
|
|
4905
4906
|
});
|
|
4906
4907
|
}
|
|
4907
|
-
(
|
|
4908
|
+
(_a2 = this.eggRenderer) == null ? void 0 : _a2.stopRenderLoop();
|
|
4908
4909
|
this.results = new ResultsRenderer(this.config);
|
|
4909
4910
|
this.results.show(
|
|
4910
4911
|
score,
|
|
@@ -4912,7 +4913,7 @@ class GameController {
|
|
|
4912
4913
|
this.destroy();
|
|
4913
4914
|
}
|
|
4914
4915
|
);
|
|
4915
|
-
(_c = (
|
|
4916
|
+
(_c = (_b2 = this.config.callbacks).onComplete) == null ? void 0 : _c.call(_b2, score);
|
|
4916
4917
|
}
|
|
4917
4918
|
// ─── Renderer Init ─────────────────────────────────────────────────────
|
|
4918
4919
|
async _initEggRenderer() {
|
|
@@ -4932,11 +4933,11 @@ class GameController {
|
|
|
4932
4933
|
}
|
|
4933
4934
|
// ─── Helpers ───────────────────────────────────────────────────────────
|
|
4934
4935
|
_cleanup() {
|
|
4935
|
-
var
|
|
4936
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h;
|
|
4936
4937
|
this._running = false;
|
|
4937
4938
|
if (this._updateRaf) cancelAnimationFrame(this._updateRaf);
|
|
4938
|
-
(
|
|
4939
|
-
(
|
|
4939
|
+
(_a2 = this.hiddenEntry) == null ? void 0 : _a2.cleanup();
|
|
4940
|
+
(_b2 = this.activeStage) == null ? void 0 : _b2.cleanup();
|
|
4940
4941
|
this.activeStage = null;
|
|
4941
4942
|
(_c = this.shrine) == null ? void 0 : _c.reset();
|
|
4942
4943
|
(_d = this.narrative) == null ? void 0 : _d.clear();
|
|
@@ -4992,6 +4993,17 @@ const EasterEggQuest = {
|
|
|
4992
4993
|
_instance = null;
|
|
4993
4994
|
}
|
|
4994
4995
|
};
|
|
4996
|
+
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
4997
|
+
const isScript = typeof globalThis.EasterEggQuest !== "undefined" || ((_b = (_a = document.currentScript) == null ? void 0 : _a.getAttribute("src")) == null ? void 0 : _b.includes("easter-egg-quest"));
|
|
4998
|
+
if (isScript) {
|
|
4999
|
+
const autoInit = () => EasterEggQuest.init();
|
|
5000
|
+
if (document.readyState === "loading") {
|
|
5001
|
+
document.addEventListener("DOMContentLoaded", autoInit, { once: true });
|
|
5002
|
+
} else {
|
|
5003
|
+
autoInit();
|
|
5004
|
+
}
|
|
5005
|
+
}
|
|
5006
|
+
}
|
|
4995
5007
|
export {
|
|
4996
5008
|
EasterEggQuest
|
|
4997
5009
|
};
|