@doodle-engine/react 0.0.8 → 0.0.10

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/react.js CHANGED
@@ -1,6 +1,6 @@
1
- import { Engine as ie } from "@doodle-engine/core";
2
- import { VERSION as De } from "@doodle-engine/core";
3
- import ue, { createContext as de, useState as C, useEffect as L, useCallback as N, useContext as me, useRef as q } from "react";
1
+ import { enableDevTools as ie, Engine as ue } from "@doodle-engine/core";
2
+ import { VERSION as Ye } from "@doodle-engine/core";
3
+ import de, { createContext as me, useState as C, useEffect as $, useCallback as N, useContext as he, useRef as L } from "react";
4
4
  var Z = { exports: {} }, z = {};
5
5
  /**
6
6
  * @license React
@@ -11,22 +11,22 @@ var Z = { exports: {} }, z = {};
11
11
  * This source code is licensed under the MIT license found in the
12
12
  * LICENSE file in the root directory of this source tree.
13
13
  */
14
- var te;
15
- function he() {
16
- if (te) return z;
17
- te = 1;
14
+ var ne;
15
+ function fe() {
16
+ if (ne) return z;
17
+ ne = 1;
18
18
  var n = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment");
19
19
  function r(a, l, o) {
20
- var m = null;
21
- if (o !== void 0 && (m = "" + o), l.key !== void 0 && (m = "" + l.key), "key" in l) {
20
+ var d = null;
21
+ if (o !== void 0 && (d = "" + o), l.key !== void 0 && (d = "" + l.key), "key" in l) {
22
22
  o = {};
23
- for (var h in l)
24
- h !== "key" && (o[h] = l[h]);
23
+ for (var m in l)
24
+ m !== "key" && (o[m] = l[m]);
25
25
  } else o = l;
26
26
  return l = o.ref, {
27
27
  $$typeof: n,
28
28
  type: a,
29
- key: m,
29
+ key: d,
30
30
  ref: l !== void 0 ? l : null,
31
31
  props: o
32
32
  };
@@ -43,47 +43,47 @@ var B = {};
43
43
  * This source code is licensed under the MIT license found in the
44
44
  * LICENSE file in the root directory of this source tree.
45
45
  */
46
- var ne;
47
- function ve() {
48
- return ne || (ne = 1, process.env.NODE_ENV !== "production" && (function() {
46
+ var te;
47
+ function pe() {
48
+ return te || (te = 1, process.env.NODE_ENV !== "production" && (function() {
49
49
  function n(t) {
50
50
  if (t == null) return null;
51
51
  if (typeof t == "function")
52
52
  return t.$$typeof === y ? null : t.displayName || t.name || null;
53
53
  if (typeof t == "string") return t;
54
54
  switch (t) {
55
- case u:
55
+ case p:
56
56
  return "Fragment";
57
- case G:
57
+ case x:
58
58
  return "Profiler";
59
- case _:
59
+ case u:
60
60
  return "StrictMode";
61
- case A:
61
+ case W:
62
62
  return "Suspense";
63
- case F:
63
+ case P:
64
64
  return "SuspenseList";
65
- case v:
65
+ case b:
66
66
  return "Activity";
67
67
  }
68
68
  if (typeof t == "object")
69
69
  switch (typeof t.tag == "number" && console.error(
70
70
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
71
71
  ), t.$$typeof) {
72
- case i:
72
+ case f:
73
73
  return "Portal";
74
- case W:
74
+ case F:
75
75
  return t.displayName || "Context";
76
- case D:
76
+ case A:
77
77
  return (t._context.displayName || "Context") + ".Consumer";
78
- case J:
79
- var c = t.render;
80
- return t = t.displayName, t || (t = c.displayName || c.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
81
- case p:
82
- return c = t.displayName || null, c !== null ? c : n(t.type) || "Memo";
83
- case d:
84
- c = t._payload, t = t._init;
78
+ case U:
79
+ var i = t.render;
80
+ return t = t.displayName, t || (t = i.displayName || i.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
81
+ case D:
82
+ return i = t.displayName || null, i !== null ? i : n(t.type) || "Memo";
83
+ case c:
84
+ i = t._payload, t = t._init;
85
85
  try {
86
- return n(t(c));
86
+ return n(t(i));
87
87
  } catch {
88
88
  }
89
89
  }
@@ -95,27 +95,27 @@ function ve() {
95
95
  function r(t) {
96
96
  try {
97
97
  s(t);
98
- var c = !1;
98
+ var i = !1;
99
99
  } catch {
100
- c = !0;
100
+ i = !0;
101
101
  }
102
- if (c) {
103
- c = console;
104
- var j = c.error, S = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
105
- return j.call(
106
- c,
102
+ if (i) {
103
+ i = console;
104
+ var k = i.error, w = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
105
+ return k.call(
106
+ i,
107
107
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
108
- S
108
+ w
109
109
  ), s(t);
110
110
  }
111
111
  }
112
112
  function a(t) {
113
- if (t === u) return "<>";
114
- if (typeof t == "object" && t !== null && t.$$typeof === d)
113
+ if (t === p) return "<>";
114
+ if (typeof t == "object" && t !== null && t.$$typeof === c)
115
115
  return "<...>";
116
116
  try {
117
- var c = n(t);
118
- return c ? "<" + c + ">" : "<...>";
117
+ var i = n(t);
118
+ return i ? "<" + i + ">" : "<...>";
119
119
  } catch {
120
120
  return "<...>";
121
121
  }
@@ -127,42 +127,42 @@ function ve() {
127
127
  function o() {
128
128
  return Error("react-stack-top-frame");
129
129
  }
130
- function m(t) {
130
+ function d(t) {
131
131
  if (M.call(t, "key")) {
132
- var c = Object.getOwnPropertyDescriptor(t, "key").get;
133
- if (c && c.isReactWarning) return !1;
132
+ var i = Object.getOwnPropertyDescriptor(t, "key").get;
133
+ if (i && i.isReactWarning) return !1;
134
134
  }
135
135
  return t.key !== void 0;
136
136
  }
137
- function h(t, c) {
138
- function j() {
139
- P || (P = !0, console.error(
137
+ function m(t, i) {
138
+ function k() {
139
+ I || (I = !0, console.error(
140
140
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
141
- c
141
+ i
142
142
  ));
143
143
  }
144
- j.isReactWarning = !0, Object.defineProperty(t, "key", {
145
- get: j,
144
+ k.isReactWarning = !0, Object.defineProperty(t, "key", {
145
+ get: k,
146
146
  configurable: !0
147
147
  });
148
148
  }
149
- function f() {
149
+ function v() {
150
150
  var t = n(this.type);
151
- return I[t] || (I[t] = !0, console.error(
151
+ return G[t] || (G[t] = !0, console.error(
152
152
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
153
153
  )), t = this.props.ref, t !== void 0 ? t : null;
154
154
  }
155
- function g(t, c, j, S, H, K) {
156
- var k = j.ref;
155
+ function g(t, i, k, w, X, K) {
156
+ var T = k.ref;
157
157
  return t = {
158
- $$typeof: w,
158
+ $$typeof: h,
159
159
  type: t,
160
- key: c,
161
- props: j,
162
- _owner: S
163
- }, (k !== void 0 ? k : null) !== null ? Object.defineProperty(t, "ref", {
160
+ key: i,
161
+ props: k,
162
+ _owner: w
163
+ }, (T !== void 0 ? T : null) !== null ? Object.defineProperty(t, "ref", {
164
164
  enumerable: !1,
165
- get: f
165
+ get: v
166
166
  }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
167
167
  configurable: !1,
168
168
  enumerable: !1,
@@ -177,7 +177,7 @@ function ve() {
177
177
  configurable: !1,
178
178
  enumerable: !1,
179
179
  writable: !0,
180
- value: H
180
+ value: X
181
181
  }), Object.defineProperty(t, "_debugTask", {
182
182
  configurable: !1,
183
183
  enumerable: !1,
@@ -185,291 +185,298 @@ function ve() {
185
185
  value: K
186
186
  }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
187
187
  }
188
- function x(t, c, j, S, H, K) {
189
- var k = c.children;
190
- if (k !== void 0)
191
- if (S)
192
- if (Y(k)) {
193
- for (S = 0; S < k.length; S++)
194
- R(k[S]);
195
- Object.freeze && Object.freeze(k);
188
+ function j(t, i, k, w, X, K) {
189
+ var T = i.children;
190
+ if (T !== void 0)
191
+ if (w)
192
+ if (Y(T)) {
193
+ for (w = 0; w < T.length; w++)
194
+ R(T[w]);
195
+ Object.freeze && Object.freeze(T);
196
196
  } else
197
197
  console.error(
198
198
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
199
199
  );
200
- else R(k);
201
- if (M.call(c, "key")) {
202
- k = n(t);
203
- var U = Object.keys(c).filter(function(ce) {
200
+ else R(T);
201
+ if (M.call(i, "key")) {
202
+ T = n(t);
203
+ var q = Object.keys(i).filter(function(ce) {
204
204
  return ce !== "key";
205
205
  });
206
- S = 0 < U.length ? "{key: someKey, " + U.join(": ..., ") + ": ...}" : "{key: someKey}", V[k + S] || (U = 0 < U.length ? "{" + U.join(": ..., ") + ": ...}" : "{}", console.error(
206
+ w = 0 < q.length ? "{key: someKey, " + q.join(": ..., ") + ": ...}" : "{key: someKey}", E[T + w] || (q = 0 < q.length ? "{" + q.join(": ..., ") + ": ...}" : "{}", console.error(
207
207
  `A props object containing a "key" prop is being spread into JSX:
208
208
  let props = %s;
209
209
  <%s {...props} />
210
210
  React keys must be passed directly to JSX without using spread:
211
211
  let props = %s;
212
212
  <%s key={someKey} {...props} />`,
213
- S,
214
- k,
215
- U,
216
- k
217
- ), V[k + S] = !0);
213
+ w,
214
+ T,
215
+ q,
216
+ T
217
+ ), E[T + w] = !0);
218
218
  }
219
- if (k = null, j !== void 0 && (r(j), k = "" + j), m(c) && (r(c.key), k = "" + c.key), "key" in c) {
220
- j = {};
221
- for (var ee in c)
222
- ee !== "key" && (j[ee] = c[ee]);
223
- } else j = c;
224
- return k && h(
225
- j,
219
+ if (T = null, k !== void 0 && (r(k), T = "" + k), d(i) && (r(i.key), T = "" + i.key), "key" in i) {
220
+ k = {};
221
+ for (var ee in i)
222
+ ee !== "key" && (k[ee] = i[ee]);
223
+ } else k = i;
224
+ return T && m(
225
+ k,
226
226
  typeof t == "function" ? t.displayName || t.name || "Unknown" : t
227
227
  ), g(
228
228
  t,
229
+ T,
229
230
  k,
230
- j,
231
231
  l(),
232
- H,
232
+ X,
233
233
  K
234
234
  );
235
235
  }
236
236
  function R(t) {
237
- T(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === d && (t._payload.status === "fulfilled" ? T(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
237
+ _(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === c && (t._payload.status === "fulfilled" ? _(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
238
238
  }
239
- function T(t) {
240
- return typeof t == "object" && t !== null && t.$$typeof === w;
239
+ function _(t) {
240
+ return typeof t == "object" && t !== null && t.$$typeof === h;
241
241
  }
242
- var E = ue, w = Symbol.for("react.transitional.element"), i = Symbol.for("react.portal"), u = Symbol.for("react.fragment"), _ = Symbol.for("react.strict_mode"), G = Symbol.for("react.profiler"), D = Symbol.for("react.consumer"), W = Symbol.for("react.context"), J = Symbol.for("react.forward_ref"), A = Symbol.for("react.suspense"), F = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), d = Symbol.for("react.lazy"), v = Symbol.for("react.activity"), y = Symbol.for("react.client.reference"), O = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, M = Object.prototype.hasOwnProperty, Y = Array.isArray, $ = console.createTask ? console.createTask : function() {
242
+ var S = de, h = Symbol.for("react.transitional.element"), f = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), u = Symbol.for("react.strict_mode"), x = Symbol.for("react.profiler"), A = Symbol.for("react.consumer"), F = Symbol.for("react.context"), U = Symbol.for("react.forward_ref"), W = Symbol.for("react.suspense"), P = Symbol.for("react.suspense_list"), D = Symbol.for("react.memo"), c = Symbol.for("react.lazy"), b = Symbol.for("react.activity"), y = Symbol.for("react.client.reference"), O = S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, M = Object.prototype.hasOwnProperty, Y = Array.isArray, V = console.createTask ? console.createTask : function() {
243
243
  return null;
244
244
  };
245
- E = {
245
+ S = {
246
246
  react_stack_bottom_frame: function(t) {
247
247
  return t();
248
248
  }
249
249
  };
250
- var P, I = {}, X = E.react_stack_bottom_frame.bind(
251
- E,
250
+ var I, G = {}, J = S.react_stack_bottom_frame.bind(
251
+ S,
252
252
  o
253
- )(), b = $(a(o)), V = {};
254
- B.Fragment = u, B.jsx = function(t, c, j) {
255
- var S = 1e4 > O.recentlyCreatedOwnerStacks++;
256
- return x(
253
+ )(), Q = V(a(o)), E = {};
254
+ B.Fragment = p, B.jsx = function(t, i, k) {
255
+ var w = 1e4 > O.recentlyCreatedOwnerStacks++;
256
+ return j(
257
257
  t,
258
- c,
259
- j,
258
+ i,
259
+ k,
260
260
  !1,
261
- S ? Error("react-stack-top-frame") : X,
262
- S ? $(a(t)) : b
261
+ w ? Error("react-stack-top-frame") : J,
262
+ w ? V(a(t)) : Q
263
263
  );
264
- }, B.jsxs = function(t, c, j) {
265
- var S = 1e4 > O.recentlyCreatedOwnerStacks++;
266
- return x(
264
+ }, B.jsxs = function(t, i, k) {
265
+ var w = 1e4 > O.recentlyCreatedOwnerStacks++;
266
+ return j(
267
267
  t,
268
- c,
269
- j,
268
+ i,
269
+ k,
270
270
  !0,
271
- S ? Error("react-stack-top-frame") : X,
272
- S ? $(a(t)) : b
271
+ w ? Error("react-stack-top-frame") : J,
272
+ w ? V(a(t)) : Q
273
273
  );
274
274
  };
275
275
  })()), B;
276
276
  }
277
277
  var se;
278
- function pe() {
279
- return se || (se = 1, process.env.NODE_ENV === "production" ? Z.exports = he() : Z.exports = ve()), Z.exports;
278
+ function ve() {
279
+ return se || (se = 1, process.env.NODE_ENV === "production" ? Z.exports = fe() : Z.exports = pe()), Z.exports;
280
280
  }
281
- var e = pe();
282
- const ae = de(null);
283
- function fe({ engine: n, initialSnapshot: s, children: r }) {
284
- const [a, l] = C(s);
285
- L(() => {
286
- }, [n]);
287
- const o = N(
288
- (i) => {
289
- const u = n.selectChoice(i);
290
- l(u);
281
+ var e = ve();
282
+ const ae = me(null);
283
+ function xe({ engine: n, initialSnapshot: s, children: r, devTools: a = !1 }) {
284
+ const [l, o] = C(s);
285
+ $(() => {
286
+ if (a)
287
+ return ie(n, () => o(n.getSnapshot())), () => {
288
+ delete window.doodle;
289
+ };
290
+ }, [n, a]);
291
+ const d = N(
292
+ (u) => {
293
+ const x = n.selectChoice(u);
294
+ o(x);
291
295
  },
292
296
  [n]
293
297
  ), m = N(
294
- (i) => {
295
- const u = n.talkTo(i);
296
- l(u);
297
- },
298
- [n]
299
- ), h = N(
300
- (i) => {
301
- const u = n.takeItem(i);
302
- l(u);
298
+ (u) => {
299
+ const x = n.talkTo(u);
300
+ o(x);
303
301
  },
304
302
  [n]
305
- ), f = N(
306
- (i) => {
307
- const u = n.travelTo(i);
308
- l(u);
303
+ ), v = N(
304
+ (u) => {
305
+ const x = n.takeItem(u);
306
+ o(x);
309
307
  },
310
308
  [n]
311
309
  ), g = N(
312
- (i, u) => {
313
- const _ = n.writeNote(i, u);
314
- l(_);
310
+ (u) => {
311
+ const x = n.travelTo(u);
312
+ o(x);
315
313
  },
316
314
  [n]
317
- ), x = N(
318
- (i) => {
319
- const u = n.deleteNote(i);
320
- l(u);
315
+ ), j = N(
316
+ (u, x) => {
317
+ const A = n.writeNote(u, x);
318
+ o(A);
321
319
  },
322
320
  [n]
323
321
  ), R = N(
324
- (i) => {
325
- const u = n.setLocale(i);
326
- l(u);
322
+ (u) => {
323
+ const x = n.deleteNote(u);
324
+ o(x);
327
325
  },
328
326
  [n]
329
- ), T = N(() => n.saveGame(), [n]), E = N(
330
- (i) => {
331
- const u = n.loadGame(i);
332
- l(u);
327
+ ), _ = N(
328
+ (u) => {
329
+ const x = n.setLocale(u);
330
+ o(x);
333
331
  },
334
332
  [n]
335
- ), w = {
336
- snapshot: a,
333
+ ), S = N(() => n.saveGame(), [n]), h = N(
334
+ (u) => {
335
+ const x = n.loadGame(u);
336
+ o(x);
337
+ },
338
+ [n]
339
+ ), f = N(() => {
340
+ o(n.getSnapshot());
341
+ }, [n]), p = {
342
+ snapshot: l,
337
343
  actions: {
338
- selectChoice: o,
344
+ selectChoice: d,
339
345
  talkTo: m,
340
- takeItem: h,
341
- travelTo: f,
342
- writeNote: g,
343
- deleteNote: x,
344
- setLocale: R,
345
- saveGame: T,
346
- loadGame: E
346
+ takeItem: v,
347
+ travelTo: g,
348
+ writeNote: j,
349
+ deleteNote: R,
350
+ setLocale: _,
351
+ saveGame: S,
352
+ loadGame: h,
353
+ dismissInterlude: f
347
354
  }
348
355
  };
349
- return /* @__PURE__ */ e.jsx(ae.Provider, { value: w, children: r });
356
+ return /* @__PURE__ */ e.jsx(ae.Provider, { value: p, children: r });
350
357
  }
351
358
  function re() {
352
- const n = me(ae);
359
+ const n = he(ae);
353
360
  if (!n)
354
361
  throw new Error("useGame must be used within a GameProvider");
355
362
  return n;
356
363
  }
357
364
  function le(n, s = {}) {
358
- var p;
365
+ var D;
359
366
  const {
360
367
  audioBasePath: r = "/audio",
361
368
  masterVolume: a = 1,
362
369
  musicVolume: l = 0.7,
363
370
  soundVolume: o = 0.8,
364
- voiceVolume: m = 1,
365
- crossfadeDuration: h = 1e3
366
- } = s, [f, g] = C(a), [x, R] = C(l), [T, E] = C(o), [w, i] = C(m), u = q(null), _ = q(null), G = q(null), D = q(null);
367
- L(() => {
368
- const d = new Audio();
369
- d.loop = !0, u.current = d;
370
- const v = new Audio();
371
- return _.current = v, () => {
372
- D.current && clearInterval(D.current), d.pause(), v.pause(), d.src = "", v.src = "";
371
+ voiceVolume: d = 1,
372
+ crossfadeDuration: m = 1e3
373
+ } = s, [v, g] = C(a), [j, R] = C(l), [_, S] = C(o), [h, f] = C(d), p = L(null), u = L(null), x = L(null), A = L(null);
374
+ $(() => {
375
+ const c = new Audio();
376
+ c.loop = !0, p.current = c;
377
+ const b = new Audio();
378
+ return u.current = b, () => {
379
+ A.current && clearInterval(A.current), c.pause(), b.pause(), c.src = "", b.src = "";
373
380
  };
374
- }, []), L(() => {
375
- const d = u.current;
376
- if (!d) return;
377
- const v = n.music;
378
- if (v !== G.current)
379
- if (G.current = v, !v)
380
- J(d, h);
381
+ }, []), $(() => {
382
+ const c = p.current;
383
+ if (!c) return;
384
+ const b = n.music;
385
+ if (b !== x.current)
386
+ if (x.current = b, !b)
387
+ U(c, m);
381
388
  else {
382
- const y = `${r}/music/${v}`;
383
- W(d, y, h);
389
+ const y = `${r}/music/${b}`;
390
+ F(c, y, m);
384
391
  }
385
- d.volume = f * x;
386
- }, [n.music, f, x, r, h]), L(() => {
392
+ c.volume = v * j;
393
+ }, [n.music, v, j, r, m]), $(() => {
387
394
  var y;
388
- const d = _.current;
389
- if (!d) return;
390
- const v = (y = n.dialogue) == null ? void 0 : y.voice;
391
- v && (d.pause(), d.currentTime = 0, d.src = `${r}/voice/${v}`, d.volume = f * w, d.play().catch((O) => {
395
+ const c = u.current;
396
+ if (!c) return;
397
+ const b = (y = n.dialogue) == null ? void 0 : y.voice;
398
+ b && (c.pause(), c.currentTime = 0, c.src = `${r}/voice/${b}`, c.volume = v * h, c.play().catch((O) => {
392
399
  console.warn("Voice playback failed:", O);
393
400
  }));
394
- }, [(p = n.dialogue) == null ? void 0 : p.voice, f, w, r]), L(() => {
395
- n.pendingSounds.length !== 0 && n.pendingSounds.forEach((d) => {
396
- const v = new Audio(`${r}/sfx/${d}`);
397
- v.volume = f * T, v.play().catch((y) => {
401
+ }, [(D = n.dialogue) == null ? void 0 : D.voice, v, h, r]), $(() => {
402
+ n.pendingSounds.length !== 0 && n.pendingSounds.forEach((c) => {
403
+ const b = new Audio(`${r}/sfx/${c}`);
404
+ b.volume = v * _, b.play().catch((y) => {
398
405
  console.warn("Sound playback failed:", y);
399
406
  });
400
407
  });
401
- }, [n.pendingSounds, f, T, r]);
402
- const W = (d, v, y) => {
403
- J(d, y / 2).then(() => {
404
- d.src = v, d.load(), d.volume = 0, d.play().then(() => {
405
- A(d, y / 2, f * x);
408
+ }, [n.pendingSounds, v, _, r]);
409
+ const F = (c, b, y) => {
410
+ U(c, y / 2).then(() => {
411
+ c.src = b, c.load(), c.volume = 0, c.play().then(() => {
412
+ W(c, y / 2, v * j);
406
413
  }).catch((O) => {
407
414
  console.warn("Music playback failed:", O);
408
415
  });
409
416
  });
410
- }, J = (d, v) => new Promise((y) => {
411
- const O = d.volume, M = 20, Y = v / M, $ = O / M;
412
- let P = 0;
413
- const I = setInterval(() => {
414
- P++, d.volume = Math.max(0, O - $ * P), P >= M && (clearInterval(I), d.pause(), d.currentTime = 0, y());
417
+ }, U = (c, b) => new Promise((y) => {
418
+ const O = c.volume, M = 20, Y = b / M, V = O / M;
419
+ let I = 0;
420
+ const G = setInterval(() => {
421
+ I++, c.volume = Math.max(0, O - V * I), I >= M && (clearInterval(G), c.pause(), c.currentTime = 0, y());
415
422
  }, Y);
416
- D.current = I;
417
- }), A = (d, v, y) => {
418
- const M = v / 20, Y = y / 20;
419
- let $ = 0;
420
- const P = setInterval(() => {
421
- $++, d.volume = Math.min(y, Y * $), $ >= 20 && clearInterval(P);
423
+ A.current = G;
424
+ }), W = (c, b, y) => {
425
+ const M = b / 20, Y = y / 20;
426
+ let V = 0;
427
+ const I = setInterval(() => {
428
+ V++, c.volume = Math.min(y, Y * V), V >= 20 && clearInterval(I);
422
429
  }, M);
423
- D.current = P;
430
+ A.current = I;
424
431
  };
425
432
  return {
426
433
  setMasterVolume: g,
427
434
  setMusicVolume: R,
428
- setSoundVolume: E,
429
- setVoiceVolume: i,
435
+ setSoundVolume: S,
436
+ setVoiceVolume: f,
430
437
  stopAll: () => {
431
- u.current && (u.current.pause(), u.current.currentTime = 0), _.current && (_.current.pause(), _.current.currentTime = 0);
438
+ p.current && (p.current.pause(), p.current.currentTime = 0), u.current && (u.current.pause(), u.current.currentTime = 0);
432
439
  }
433
440
  };
434
441
  }
435
- const xe = {
442
+ const je = {
436
443
  click: "click.ogg",
437
444
  menuOpen: "menu_open.ogg",
438
445
  menuClose: "menu_close.ogg"
439
446
  };
440
- function je(n = {}) {
447
+ function Ne(n = {}) {
441
448
  const {
442
449
  enabled: s = !0,
443
450
  basePath: r = "/audio/ui",
444
451
  volume: a = 0.5,
445
452
  sounds: l = {}
446
- } = n, [o, m] = C(s), [h, f] = C(a), g = q({ ...xe, ...l }), x = N(
447
- (i) => {
448
- if (!o || !i) return;
449
- const u = new Audio(`${r}/${i}`);
450
- u.volume = h, u.play().catch(() => {
453
+ } = n, [o, d] = C(s), [m, v] = C(a), g = L({ ...je, ...l }), j = N(
454
+ (f) => {
455
+ if (!o || !f) return;
456
+ const p = new Audio(`${r}/${f}`);
457
+ p.volume = m, p.play().catch(() => {
451
458
  });
452
459
  },
453
- [o, h, r]
460
+ [o, m, r]
454
461
  ), R = N(
455
- (i) => {
456
- const u = g.current[i];
457
- u && x(u);
462
+ (f) => {
463
+ const p = g.current[f];
464
+ p && j(p);
458
465
  },
459
- [x]
460
- ), T = N(() => x(g.current.click), [x]), E = N(() => x(g.current.menuOpen), [x]), w = N(() => x(g.current.menuClose), [x]);
466
+ [j]
467
+ ), _ = N(() => j(g.current.click), [j]), S = N(() => j(g.current.menuOpen), [j]), h = N(() => j(g.current.menuClose), [j]);
461
468
  return {
462
- playClick: T,
463
- playMenuOpen: E,
464
- playMenuClose: w,
469
+ playClick: _,
470
+ playMenuOpen: S,
471
+ playMenuClose: h,
465
472
  playSound: R,
466
- setEnabled: m,
467
- setVolume: f,
473
+ setEnabled: d,
474
+ setVolume: v,
468
475
  enabled: o,
469
- volume: h
476
+ volume: m
470
477
  };
471
478
  }
472
- function Ne({ dialogue: n, className: s = "" }) {
479
+ function ge({ dialogue: n, className: s = "" }) {
473
480
  return /* @__PURE__ */ e.jsxs("div", { className: `dialogue-box ${s}`, children: [
474
481
  n.portrait && /* @__PURE__ */ e.jsx("div", { className: "dialogue-portrait", children: /* @__PURE__ */ e.jsx("img", { src: n.portrait, alt: n.speakerName }) }),
475
482
  /* @__PURE__ */ e.jsxs("div", { className: "dialogue-content", children: [
@@ -489,7 +496,7 @@ function be({ choices: n, onSelectChoice: s, className: r = "" }) {
489
496
  a.id
490
497
  )) });
491
498
  }
492
- function ge({ location: n, className: s = "" }) {
499
+ function ke({ location: n, className: s = "" }) {
493
500
  return /* @__PURE__ */ e.jsxs("div", { className: `location-view ${s}`, children: [
494
501
  n.banner && /* @__PURE__ */ e.jsx("div", { className: "location-banner", children: /* @__PURE__ */ e.jsx("img", { src: n.banner, alt: n.name }) }),
495
502
  /* @__PURE__ */ e.jsxs("div", { className: "location-content", children: [
@@ -526,7 +533,7 @@ function Se({
526
533
  )) })
527
534
  ] });
528
535
  }
529
- function ke({ items: n, className: s = "" }) {
536
+ function ye({ items: n, className: s = "" }) {
530
537
  const [r, a] = C(null);
531
538
  return /* @__PURE__ */ e.jsxs("div", { className: `inventory ${s}`, children: [
532
539
  /* @__PURE__ */ e.jsx("h2", { children: "Inventory" }),
@@ -550,7 +557,7 @@ function ke({ items: n, className: s = "" }) {
550
557
  ] }) })
551
558
  ] });
552
559
  }
553
- function ye({ quests: n, entries: s, className: r = "" }) {
560
+ function Ee({ quests: n, entries: s, className: r = "" }) {
554
561
  return /* @__PURE__ */ e.jsxs("div", { className: `journal ${r}`, children: [
555
562
  /* @__PURE__ */ e.jsx("h2", { children: "Journal" }),
556
563
  n.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "journal-quests", children: [
@@ -571,7 +578,7 @@ function ye({ quests: n, entries: s, className: r = "" }) {
571
578
  n.length === 0 && s.length === 0 && /* @__PURE__ */ e.jsx("p", { className: "journal-empty", children: "No entries yet" })
572
579
  ] });
573
580
  }
574
- function Ee({ map: n, onTravelTo: s, className: r = "" }) {
581
+ function we({ map: n, onTravelTo: s, className: r = "" }) {
575
582
  return n ? /* @__PURE__ */ e.jsxs("div", { className: `map-view ${r}`, children: [
576
583
  /* @__PURE__ */ e.jsx("h2", { children: n.name }),
577
584
  /* @__PURE__ */ e.jsxs("div", { className: "map-container", style: { position: "relative" }, children: [
@@ -601,40 +608,99 @@ function Te({
601
608
  }) {
602
609
  return n.length === 0 ? null : /* @__PURE__ */ e.jsx("div", { className: `notification-area ${s}`, children: n.map((r, a) => /* @__PURE__ */ e.jsx("div", { className: "notification", children: r }, a)) });
603
610
  }
604
- function we({
611
+ function Re({
605
612
  onSave: n,
606
613
  onLoad: s,
607
614
  storageKey: r = "doodle-engine-save",
608
615
  className: a = ""
609
616
  }) {
610
- const [l, o] = C(""), m = () => {
617
+ const [l, o] = C(""), d = () => {
611
618
  const g = n();
612
619
  localStorage.setItem(r, JSON.stringify(g)), o("Saved!"), setTimeout(() => o(""), 2e3);
613
- }, h = () => {
620
+ }, m = () => {
614
621
  const g = localStorage.getItem(r);
615
622
  if (!g) {
616
623
  o("No save found"), setTimeout(() => o(""), 2e3);
617
624
  return;
618
625
  }
619
- const x = JSON.parse(g);
620
- s(x), o("Loaded!"), setTimeout(() => o(""), 2e3);
621
- }, f = localStorage.getItem(r) !== null;
626
+ const j = JSON.parse(g);
627
+ s(j), o("Loaded!"), setTimeout(() => o(""), 2e3);
628
+ }, v = localStorage.getItem(r) !== null;
622
629
  return /* @__PURE__ */ e.jsxs("div", { className: `save-load-panel ${a}`, children: [
623
- /* @__PURE__ */ e.jsx("button", { className: "save-button", onClick: m, children: "Save" }),
624
- /* @__PURE__ */ e.jsx("button", { className: "load-button", onClick: h, disabled: !f, children: "Load" }),
630
+ /* @__PURE__ */ e.jsx("button", { className: "save-button", onClick: d, children: "Save" }),
631
+ /* @__PURE__ */ e.jsx("button", { className: "load-button", onClick: m, disabled: !v, children: "Load" }),
625
632
  l && /* @__PURE__ */ e.jsx("span", { className: "save-load-message", children: l })
626
633
  ] });
627
634
  }
635
+ function Ce({ interlude: n, onDismiss: s }) {
636
+ const r = L(null), a = L(null), l = L(null), o = L(null), [d, m] = C(!1), [v, g] = C(0), j = n.scrollSpeed, R = n.scroll;
637
+ $(() => {
638
+ if (!R || d) {
639
+ l.current !== null && (cancelAnimationFrame(l.current), l.current = null), o.current = null;
640
+ return;
641
+ }
642
+ const h = (f) => {
643
+ o.current === null && (o.current = f);
644
+ const p = (f - o.current) / 1e3;
645
+ o.current = f, g((u) => {
646
+ const x = r.current, A = a.current;
647
+ if (!x || !A) return u;
648
+ const F = x.scrollHeight - A.clientHeight;
649
+ return u >= F ? u : u + j * p;
650
+ }), l.current = requestAnimationFrame(h);
651
+ };
652
+ return l.current = requestAnimationFrame(h), () => {
653
+ l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
654
+ };
655
+ }, [R, d, j]), $(() => {
656
+ a.current && (a.current.scrollTop = v);
657
+ }, [v]);
658
+ const _ = N((h) => {
659
+ m(!0), g((f) => Math.max(0, f + h.deltaY));
660
+ }, []), S = N((h) => {
661
+ (h.key === "ArrowDown" || h.key === "ArrowUp") && (m(!0), g((f) => Math.max(0, f + (h.key === "ArrowDown" ? 40 : -40)))), (h.key === " " || h.key === "Enter" || h.key === "Escape") && (h.preventDefault(), s());
662
+ }, [s]);
663
+ return $(() => (window.addEventListener("keydown", S), () => window.removeEventListener("keydown", S)), [S]), /* @__PURE__ */ e.jsxs(
664
+ "div",
665
+ {
666
+ className: "interlude-overlay",
667
+ style: { backgroundImage: `url(${n.background})` },
668
+ onClick: s,
669
+ children: [
670
+ n.banner && /* @__PURE__ */ e.jsx("img", { className: "interlude-banner", src: n.banner, alt: "", "aria-hidden": "true" }),
671
+ /* @__PURE__ */ e.jsx(
672
+ "div",
673
+ {
674
+ ref: a,
675
+ className: "interlude-scroll-container",
676
+ onWheel: _,
677
+ onClick: (h) => h.stopPropagation(),
678
+ children: /* @__PURE__ */ e.jsx("div", { ref: r, className: "interlude-text", children: n.text.split(`
679
+ `).map((h, f) => /* @__PURE__ */ e.jsx("p", { children: h || " " }, f)) })
680
+ }
681
+ ),
682
+ /* @__PURE__ */ e.jsx("button", { className: "interlude-skip-button", onClick: s, children: "Skip »" })
683
+ ]
684
+ }
685
+ );
686
+ }
628
687
  function _e({ className: n = "" }) {
629
688
  const { snapshot: s, actions: r } = re();
630
689
  le(s);
631
690
  const a = Object.entries(s.variables).filter(([l]) => !l.startsWith("_"));
632
691
  return /* @__PURE__ */ e.jsxs("div", { className: `game-renderer ${n}`, children: [
692
+ s.pendingInterlude && /* @__PURE__ */ e.jsx(
693
+ Ce,
694
+ {
695
+ interlude: s.pendingInterlude,
696
+ onDismiss: r.dismissInterlude
697
+ }
698
+ ),
633
699
  /* @__PURE__ */ e.jsx(Te, { notifications: s.notifications }),
634
700
  /* @__PURE__ */ e.jsxs("div", { className: "game-main", children: [
635
- /* @__PURE__ */ e.jsx(ge, { location: s.location }),
701
+ /* @__PURE__ */ e.jsx(ke, { location: s.location }),
636
702
  s.dialogue && /* @__PURE__ */ e.jsxs("div", { className: "dialogue-container", children: [
637
- /* @__PURE__ */ e.jsx(Ne, { dialogue: s.dialogue }),
703
+ /* @__PURE__ */ e.jsx(ge, { dialogue: s.dialogue }),
638
704
  /* @__PURE__ */ e.jsx(be, { choices: s.choices, onSelectChoice: r.selectChoice })
639
705
  ] }),
640
706
  !s.dialogue && /* @__PURE__ */ e.jsx(
@@ -646,7 +712,7 @@ function _e({ className: n = "" }) {
646
712
  )
647
713
  ] }),
648
714
  /* @__PURE__ */ e.jsxs("div", { className: "game-sidebar", children: [
649
- /* @__PURE__ */ e.jsx(we, { onSave: r.saveGame, onLoad: r.loadGame }),
715
+ /* @__PURE__ */ e.jsx(Re, { onSave: r.saveGame, onLoad: r.loadGame }),
650
716
  a.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "resources", children: [
651
717
  /* @__PURE__ */ e.jsx("h2", { children: "Resources" }),
652
718
  /* @__PURE__ */ e.jsx("ul", { className: "resources-list", children: a.map(([l, o]) => /* @__PURE__ */ e.jsxs("li", { className: "resource-entry", children: [
@@ -658,20 +724,20 @@ function _e({ className: n = "" }) {
658
724
  /* @__PURE__ */ e.jsx("h2", { children: "Party" }),
659
725
  /* @__PURE__ */ e.jsx("ul", { className: "party-list", children: s.party.map((l) => /* @__PURE__ */ e.jsx("li", { className: "party-member", children: /* @__PURE__ */ e.jsx("span", { className: "party-member-name", children: l.name }) }, l.id)) })
660
726
  ] }),
661
- /* @__PURE__ */ e.jsx(ke, { items: s.inventory }),
662
- /* @__PURE__ */ e.jsx(ye, { quests: s.quests, entries: s.journal }),
663
- s.map && /* @__PURE__ */ e.jsx(Ee, { map: s.map, onTravelTo: r.travelTo })
727
+ /* @__PURE__ */ e.jsx(ye, { items: s.inventory }),
728
+ /* @__PURE__ */ e.jsx(Ee, { quests: s.quests, entries: s.journal }),
729
+ s.map && /* @__PURE__ */ e.jsx(we, { map: s.map, onTravelTo: r.travelTo })
664
730
  ] })
665
731
  ] });
666
732
  }
667
- function Ce({
733
+ function Ae({
668
734
  logoSrc: n,
669
735
  title: s,
670
736
  onComplete: r,
671
737
  duration: a = 2e3,
672
738
  className: l = ""
673
739
  }) {
674
- return L(() => {
740
+ return $(() => {
675
741
  const o = setTimeout(r, a);
676
742
  return () => clearTimeout(o);
677
743
  }, [r, a]), /* @__PURE__ */ e.jsxs("div", { className: `splash-screen ${l}`, onClick: r, children: [
@@ -680,28 +746,28 @@ function Ce({
680
746
  /* @__PURE__ */ e.jsx("div", { className: "splash-loading", children: "Loading..." })
681
747
  ] });
682
748
  }
683
- function Re({
749
+ function Pe({
684
750
  title: n = "Doodle Engine",
685
751
  subtitle: s,
686
752
  logoSrc: r,
687
753
  hasSaveData: a,
688
754
  onNewGame: l,
689
755
  onContinue: o,
690
- onSettings: m,
691
- className: h = ""
756
+ onSettings: d,
757
+ className: m = ""
692
758
  }) {
693
- return /* @__PURE__ */ e.jsxs("div", { className: `title-screen ${h}`, children: [
759
+ return /* @__PURE__ */ e.jsxs("div", { className: `title-screen ${m}`, children: [
694
760
  r && /* @__PURE__ */ e.jsx("img", { src: r, alt: n, className: "title-logo" }),
695
761
  /* @__PURE__ */ e.jsx("h1", { className: "title-heading", children: n }),
696
762
  s && /* @__PURE__ */ e.jsx("p", { className: "title-subtitle", children: s }),
697
763
  /* @__PURE__ */ e.jsxs("div", { className: "title-menu", children: [
698
764
  /* @__PURE__ */ e.jsx("button", { className: "title-button", onClick: l, children: "New Game" }),
699
765
  a && /* @__PURE__ */ e.jsx("button", { className: "title-button", onClick: o, children: "Continue" }),
700
- /* @__PURE__ */ e.jsx("button", { className: "title-button", onClick: m, children: "Settings" })
766
+ /* @__PURE__ */ e.jsx("button", { className: "title-button", onClick: d, children: "Settings" })
701
767
  ] })
702
768
  ] });
703
769
  }
704
- function Ae({
770
+ function Oe({
705
771
  onResume: n,
706
772
  onSave: s,
707
773
  onLoad: r,
@@ -727,14 +793,14 @@ function oe({
727
793
  currentLocale: a,
728
794
  onLocaleChange: l,
729
795
  onBack: o,
730
- className: m = ""
796
+ className: d = ""
731
797
  }) {
732
- return /* @__PURE__ */ e.jsxs("div", { className: `settings-panel ${m}`, children: [
798
+ return /* @__PURE__ */ e.jsxs("div", { className: `settings-panel ${d}`, children: [
733
799
  /* @__PURE__ */ e.jsx("h2", { className: "settings-title", children: "Settings" }),
734
800
  /* @__PURE__ */ e.jsxs("div", { className: "settings-section", children: [
735
801
  /* @__PURE__ */ e.jsx("h3", { children: "Audio" }),
736
802
  /* @__PURE__ */ e.jsx(
737
- Q,
803
+ H,
738
804
  {
739
805
  label: "Master",
740
806
  value: 1,
@@ -742,7 +808,7 @@ function oe({
742
808
  }
743
809
  ),
744
810
  /* @__PURE__ */ e.jsx(
745
- Q,
811
+ H,
746
812
  {
747
813
  label: "Music",
748
814
  value: 0.7,
@@ -750,7 +816,7 @@ function oe({
750
816
  }
751
817
  ),
752
818
  /* @__PURE__ */ e.jsx(
753
- Q,
819
+ H,
754
820
  {
755
821
  label: "Sound Effects",
756
822
  value: 0.8,
@@ -758,7 +824,7 @@ function oe({
758
824
  }
759
825
  ),
760
826
  /* @__PURE__ */ e.jsx(
761
- Q,
827
+ H,
762
828
  {
763
829
  label: "Voice",
764
830
  value: 1,
@@ -766,7 +832,7 @@ function oe({
766
832
  }
767
833
  ),
768
834
  s && /* @__PURE__ */ e.jsx(
769
- Q,
835
+ H,
770
836
  {
771
837
  label: "UI Sounds",
772
838
  value: s.volume,
@@ -781,15 +847,15 @@ function oe({
781
847
  {
782
848
  className: "settings-locale-select",
783
849
  value: a,
784
- onChange: (h) => l(h.target.value),
785
- children: r.map((h) => /* @__PURE__ */ e.jsx("option", { value: h.code, children: h.label }, h.code))
850
+ onChange: (m) => l(m.target.value),
851
+ children: r.map((m) => /* @__PURE__ */ e.jsx("option", { value: m.code, children: m.label }, m.code))
786
852
  }
787
853
  )
788
854
  ] }),
789
855
  /* @__PURE__ */ e.jsx("button", { className: "settings-back-button", onClick: o, children: "Back" })
790
856
  ] });
791
857
  }
792
- function Q({
858
+ function H({
793
859
  label: n,
794
860
  value: s,
795
861
  onChange: r
@@ -810,16 +876,16 @@ function Q({
810
876
  )
811
877
  ] });
812
878
  }
813
- function Oe({
879
+ function $e({
814
880
  src: n,
815
881
  basePath: s = "/video",
816
882
  onComplete: r,
817
883
  className: a = ""
818
884
  }) {
819
- const l = q(null);
820
- return L(() => {
821
- const o = (m) => {
822
- (m.key === "Escape" || m.key === " " || m.key === "Enter") && (m.preventDefault(), r());
885
+ const l = L(null);
886
+ return $(() => {
887
+ const o = (d) => {
888
+ (d.key === "Escape" || d.key === " " || d.key === "Enter") && (d.preventDefault(), r());
823
889
  };
824
890
  return window.addEventListener("keydown", o), () => window.removeEventListener("keydown", o);
825
891
  }, [r]), /* @__PURE__ */ e.jsxs("div", { className: `video-player-overlay ${a}`, children: [
@@ -843,24 +909,25 @@ function Oe({
843
909
  )
844
910
  ] });
845
911
  }
846
- function Me({
912
+ function Le({
847
913
  registry: n,
848
914
  config: s,
849
915
  title: r = "Doodle Engine",
850
916
  subtitle: a,
851
917
  logoSrc: l,
852
918
  splashDuration: o = 2e3,
853
- uiSounds: m,
854
- audioOptions: h,
855
- storageKey: f = "doodle-engine-save",
919
+ uiSounds: d,
920
+ audioOptions: m,
921
+ storageKey: v = "doodle-engine-save",
856
922
  availableLocales: g,
857
- videoBasePath: x = "/video",
858
- className: R = ""
923
+ videoBasePath: j = "/video",
924
+ className: R = "",
925
+ devTools: _ = !1
859
926
  }) {
860
- const [T, E] = C(o > 0 ? "splash" : "title"), [w, i] = C(!1), [u, _] = C(!1), [G, D] = C("title"), [W, J] = C(null), [A, F] = C(null), p = je(
861
- m === !1 ? { enabled: !1 } : m
862
- ), d = localStorage.getItem(f) !== null, v = N(() => {
863
- const b = {
927
+ const [S, h] = C(o > 0 ? "splash" : "title"), [f, p] = C(!1), [u, x] = C(!1), [A, F] = C("title"), [U, W] = C(null), [P, D] = C(null), c = Ne(
928
+ d === !1 ? { enabled: !1 } : d
929
+ ), b = localStorage.getItem(v) !== null, y = N(() => {
930
+ const E = {
864
931
  currentLocation: s.startLocation,
865
932
  currentTime: { ...s.startTime },
866
933
  flags: { ...s.startFlags },
@@ -876,45 +943,46 @@ function Me({
876
943
  notifications: [],
877
944
  pendingSounds: [],
878
945
  pendingVideo: null,
946
+ pendingInterlude: null,
879
947
  currentLocale: "en"
880
948
  };
881
- return new ie(n, b);
882
- }, [n, s]), y = N(() => {
883
- p.playClick();
884
- const b = v(), V = b.newGame(s);
885
- F({ engine: b, snapshot: V }), E("playing");
886
- }, [v, s, p]), O = N(() => {
887
- p.playClick();
888
- const b = localStorage.getItem(f);
889
- if (!b) return;
890
- const V = JSON.parse(b), t = v(), c = t.loadGame(V);
891
- F({ engine: t, snapshot: c }), E("playing");
892
- }, [v, f, p]), M = N(() => {
893
- if (!A) return;
894
- p.playClick();
895
- const b = A.engine.saveGame();
896
- localStorage.setItem(f, JSON.stringify(b)), i(!1);
897
- }, [A, f, p]), Y = N(() => {
898
- const b = localStorage.getItem(f);
899
- if (!b || !A) return;
900
- p.playClick();
901
- const V = JSON.parse(b), t = A.engine.loadGame(V);
902
- F({ engine: A.engine, snapshot: t }), i(!1);
903
- }, [A, f, p]), $ = N(() => {
904
- p.playClick(), i(!1), _(!1), F(null), E("title");
905
- }, [p]), P = N((b) => {
906
- p.playMenuOpen(), D(b), _(!0), b === "pause" && i(!1);
907
- }, [p]), I = N(() => {
908
- p.playMenuClose(), _(!1), G === "pause" && i(!0);
909
- }, [G, p]);
910
- L(() => {
911
- if (T !== "playing") return;
912
- const b = (V) => {
913
- V.key === "Escape" && (V.preventDefault(), u ? I() : (w ? p.playMenuClose() : p.playMenuOpen(), i((t) => !t)));
949
+ return new ue(n, E);
950
+ }, [n, s]), O = N(() => {
951
+ c.playClick();
952
+ const E = y(), t = E.newGame(s);
953
+ D({ engine: E, snapshot: t }), h("playing");
954
+ }, [y, s, c]), M = N(() => {
955
+ c.playClick();
956
+ const E = localStorage.getItem(v);
957
+ if (!E) return;
958
+ const t = JSON.parse(E), i = y(), k = i.loadGame(t);
959
+ D({ engine: i, snapshot: k }), h("playing");
960
+ }, [y, v, c]), Y = N(() => {
961
+ if (!P) return;
962
+ c.playClick();
963
+ const E = P.engine.saveGame();
964
+ localStorage.setItem(v, JSON.stringify(E)), p(!1);
965
+ }, [P, v, c]), V = N(() => {
966
+ const E = localStorage.getItem(v);
967
+ if (!E || !P) return;
968
+ c.playClick();
969
+ const t = JSON.parse(E), i = P.engine.loadGame(t);
970
+ D({ engine: P.engine, snapshot: i }), p(!1);
971
+ }, [P, v, c]), I = N(() => {
972
+ c.playClick(), p(!1), x(!1), D(null), h("title");
973
+ }, [c]), G = N((E) => {
974
+ c.playMenuOpen(), F(E), x(!0), E === "pause" && p(!1);
975
+ }, [c]), J = N(() => {
976
+ c.playMenuClose(), x(!1), A === "pause" && p(!0);
977
+ }, [A, c]);
978
+ $(() => {
979
+ if (S !== "playing") return;
980
+ const E = (t) => {
981
+ t.key === "Escape" && (t.preventDefault(), u ? J() : (f ? c.playMenuClose() : c.playMenuOpen(), p((i) => !i)));
914
982
  };
915
- return window.addEventListener("keydown", b), () => window.removeEventListener("keydown", b);
916
- }, [T, w, u, I, p]);
917
- const X = {
983
+ return window.addEventListener("keydown", E), () => window.removeEventListener("keydown", E);
984
+ }, [S, f, u, J, c]);
985
+ const Q = {
918
986
  setMasterVolume: () => {
919
987
  },
920
988
  setMusicVolume: () => {
@@ -926,141 +994,149 @@ function Me({
926
994
  stopAll: () => {
927
995
  }
928
996
  };
929
- return T === "splash" ? /* @__PURE__ */ e.jsx("div", { className: `game-shell ${R}`, children: /* @__PURE__ */ e.jsx(
930
- Ce,
997
+ return S === "splash" ? /* @__PURE__ */ e.jsx("div", { className: `game-shell ${R}`, children: /* @__PURE__ */ e.jsx(
998
+ Ae,
931
999
  {
932
1000
  logoSrc: l,
933
1001
  title: r,
934
- onComplete: () => E("title"),
1002
+ onComplete: () => h("title"),
935
1003
  duration: o
936
1004
  }
937
- ) }) : T === "title" ? /* @__PURE__ */ e.jsx("div", { className: `game-shell ${R}`, children: u ? /* @__PURE__ */ e.jsx(
1005
+ ) }) : S === "title" ? /* @__PURE__ */ e.jsx("div", { className: `game-shell ${R}`, children: u ? /* @__PURE__ */ e.jsx(
938
1006
  oe,
939
1007
  {
940
- audioControls: X,
941
- uiSoundControls: m !== !1 ? p : void 0,
1008
+ audioControls: Q,
1009
+ uiSoundControls: d !== !1 ? c : void 0,
942
1010
  availableLocales: g,
943
- onBack: I
1011
+ onBack: J
944
1012
  }
945
1013
  ) : /* @__PURE__ */ e.jsx(
946
- Re,
1014
+ Pe,
947
1015
  {
948
1016
  title: r,
949
1017
  subtitle: a,
950
1018
  logoSrc: l,
951
- hasSaveData: d,
952
- onNewGame: y,
953
- onContinue: O,
954
- onSettings: () => P("title")
1019
+ hasSaveData: b,
1020
+ onNewGame: O,
1021
+ onContinue: M,
1022
+ onSettings: () => G("title")
955
1023
  }
956
- ) }) : A ? /* @__PURE__ */ e.jsx("div", { className: `game-shell ${R}`, children: /* @__PURE__ */ e.jsx(fe, { engine: A.engine, initialSnapshot: A.snapshot, children: /* @__PURE__ */ e.jsx(
957
- Pe,
1024
+ ) }) : P ? /* @__PURE__ */ e.jsx("div", { className: `game-shell ${R}`, children: /* @__PURE__ */ e.jsx(xe, { engine: P.engine, initialSnapshot: P.snapshot, devTools: _, children: /* @__PURE__ */ e.jsx(
1025
+ Ve,
958
1026
  {
959
- audioOptions: h,
960
- uiSoundControls: m !== !1 ? p : void 0,
961
- showPauseMenu: w,
1027
+ audioOptions: m,
1028
+ uiSoundControls: d !== !1 ? c : void 0,
1029
+ showPauseMenu: f,
962
1030
  showSettings: u,
963
1031
  availableLocales: g,
964
- videoBasePath: x,
965
- pendingVideo: W,
966
- setPendingVideo: J,
1032
+ videoBasePath: j,
1033
+ pendingVideo: U,
1034
+ setPendingVideo: W,
967
1035
  onPause: () => {
968
- p.playMenuOpen(), i(!0);
1036
+ c.playMenuOpen(), p(!0);
969
1037
  },
970
1038
  onResume: () => {
971
- p.playMenuClose(), i(!1);
1039
+ c.playMenuClose(), p(!1);
972
1040
  },
973
- onSave: M,
974
- onLoad: Y,
975
- onSettings: () => P("pause"),
976
- onQuitToTitle: $,
977
- onCloseSettings: I
1041
+ onSave: Y,
1042
+ onLoad: V,
1043
+ onSettings: () => G("pause"),
1044
+ onQuitToTitle: I,
1045
+ onCloseSettings: J
978
1046
  }
979
1047
  ) }) }) : null;
980
1048
  }
981
- function Pe({
1049
+ function Ve({
982
1050
  audioOptions: n,
983
1051
  uiSoundControls: s,
984
1052
  showPauseMenu: r,
985
1053
  showSettings: a,
986
1054
  availableLocales: l,
987
1055
  videoBasePath: o,
988
- pendingVideo: m,
989
- setPendingVideo: h,
990
- onPause: f,
1056
+ pendingVideo: d,
1057
+ setPendingVideo: m,
1058
+ onPause: v,
991
1059
  onResume: g,
992
- onSave: x,
1060
+ onSave: j,
993
1061
  onLoad: R,
994
- onSettings: T,
995
- onQuitToTitle: E,
996
- onCloseSettings: w
1062
+ onSettings: _,
1063
+ onQuitToTitle: S,
1064
+ onCloseSettings: h
997
1065
  }) {
998
- const { snapshot: i, actions: u } = re(), _ = le(i, n);
999
- return L(() => {
1000
- i.pendingVideo && h(i.pendingVideo);
1001
- }, [i.pendingVideo, h]), /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1002
- m && /* @__PURE__ */ e.jsx(
1003
- Oe,
1066
+ const { snapshot: f, actions: p } = re(), u = le(f, n);
1067
+ return $(() => {
1068
+ f.pendingVideo && m(f.pendingVideo);
1069
+ }, [f.pendingVideo, m]), /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1070
+ d && /* @__PURE__ */ e.jsx(
1071
+ $e,
1004
1072
  {
1005
- src: m,
1073
+ src: d,
1006
1074
  basePath: o,
1007
- onComplete: () => h(null)
1075
+ onComplete: () => m(null)
1008
1076
  }
1009
1077
  ),
1010
1078
  /* @__PURE__ */ e.jsx(_e, {}),
1011
- !r && !a && !m && /* @__PURE__ */ e.jsx(
1079
+ !r && !a && !d && /* @__PURE__ */ e.jsx(
1012
1080
  "button",
1013
1081
  {
1014
1082
  className: "game-shell-menu-button",
1015
- onClick: f,
1083
+ onClick: v,
1016
1084
  "aria-label": "Menu",
1017
1085
  children: "Menu"
1018
1086
  }
1019
1087
  ),
1020
1088
  r && /* @__PURE__ */ e.jsx(
1021
- Ae,
1089
+ Oe,
1022
1090
  {
1023
1091
  onResume: g,
1024
- onSave: x,
1092
+ onSave: j,
1025
1093
  onLoad: R,
1026
- onSettings: T,
1027
- onQuitToTitle: E
1094
+ onSettings: _,
1095
+ onQuitToTitle: S
1028
1096
  }
1029
1097
  ),
1030
1098
  a && /* @__PURE__ */ e.jsx(
1031
1099
  oe,
1032
1100
  {
1033
- audioControls: _,
1101
+ audioControls: u,
1034
1102
  uiSoundControls: s,
1035
1103
  availableLocales: l,
1036
- currentLocale: (i.time, void 0),
1037
- onLocaleChange: u.setLocale,
1038
- onBack: w
1104
+ currentLocale: (f.time, void 0),
1105
+ onLocaleChange: p.setLocale,
1106
+ onBack: h
1039
1107
  }
1040
1108
  )
1041
1109
  ] });
1042
1110
  }
1111
+ function De({ message: n = "Loading...", className: s = "" }) {
1112
+ return /* @__PURE__ */ e.jsx("div", { className: `loading-screen ${s}`, children: /* @__PURE__ */ e.jsxs("div", { className: "loading-screen-content", children: [
1113
+ /* @__PURE__ */ e.jsx("div", { className: "loading-screen-spinner" }),
1114
+ /* @__PURE__ */ e.jsx("p", { className: "loading-screen-message", children: n })
1115
+ ] }) });
1116
+ }
1043
1117
  export {
1044
1118
  Se as CharacterList,
1045
1119
  be as ChoiceList,
1046
- Ne as DialogueBox,
1120
+ ge as DialogueBox,
1047
1121
  ae as GameContext,
1048
- fe as GameProvider,
1122
+ xe as GameProvider,
1049
1123
  _e as GameRenderer,
1050
- Me as GameShell,
1051
- ke as Inventory,
1052
- ye as Journal,
1053
- ge as LocationView,
1054
- Ee as MapView,
1124
+ Le as GameShell,
1125
+ Ce as Interlude,
1126
+ ye as Inventory,
1127
+ Ee as Journal,
1128
+ De as LoadingScreen,
1129
+ ke as LocationView,
1130
+ we as MapView,
1055
1131
  Te as NotificationArea,
1056
- Ae as PauseMenu,
1057
- we as SaveLoadPanel,
1132
+ Oe as PauseMenu,
1133
+ Re as SaveLoadPanel,
1058
1134
  oe as SettingsPanel,
1059
- Ce as SplashScreen,
1060
- Re as TitleScreen,
1061
- De as VERSION,
1062
- Oe as VideoPlayer,
1135
+ Ae as SplashScreen,
1136
+ Pe as TitleScreen,
1137
+ Ye as VERSION,
1138
+ $e as VideoPlayer,
1063
1139
  le as useAudioManager,
1064
1140
  re as useGame,
1065
- je as useUISounds
1141
+ Ne as useUISounds
1066
1142
  };