@doodle-engine/react 0.0.8 → 0.0.9

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 Fe } from "@doodle-engine/core";
3
+ import de, { createContext as me, useState as T, useEffect as L, useCallback as j, useContext as he, useRef as U } from "react";
4
4
  var Z = { exports: {} }, z = {};
5
5
  /**
6
6
  * @license React
@@ -11,27 +11,27 @@ 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;
18
- var n = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment");
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) {
22
- o = {};
23
- for (var h in l)
24
- h !== "key" && (o[h] = l[h]);
25
- } else o = l;
26
- return l = o.ref, {
14
+ var se;
15
+ function ve() {
16
+ if (se) return z;
17
+ se = 1;
18
+ var n = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
19
+ function r(a, o, c) {
20
+ var d = null;
21
+ if (c !== void 0 && (d = "" + c), o.key !== void 0 && (d = "" + o.key), "key" in o) {
22
+ c = {};
23
+ for (var m in o)
24
+ m !== "key" && (c[m] = o[m]);
25
+ } else c = o;
26
+ return o = c.ref, {
27
27
  $$typeof: n,
28
28
  type: a,
29
- key: m,
30
- ref: l !== void 0 ? l : null,
31
- props: o
29
+ key: d,
30
+ ref: o !== void 0 ? o : null,
31
+ props: c
32
32
  };
33
33
  }
34
- return z.Fragment = s, z.jsx = r, z.jsxs = r, z;
34
+ return z.Fragment = t, z.jsx = r, z.jsxs = r, z;
35
35
  }
36
36
  var B = {};
37
37
  /**
@@ -44,433 +44,437 @@ var B = {};
44
44
  * LICENSE file in the root directory of this source tree.
45
45
  */
46
46
  var ne;
47
- function ve() {
47
+ function pe() {
48
48
  return ne || (ne = 1, process.env.NODE_ENV !== "production" && (function() {
49
- function n(t) {
50
- if (t == null) return null;
51
- if (typeof t == "function")
52
- return t.$$typeof === y ? null : t.displayName || t.name || null;
53
- if (typeof t == "string") return t;
54
- switch (t) {
49
+ function n(s) {
50
+ if (s == null) return null;
51
+ if (typeof s == "function")
52
+ return s.$$typeof === N ? null : s.displayName || s.name || null;
53
+ if (typeof s == "string") return s;
54
+ switch (s) {
55
55
  case u:
56
56
  return "Fragment";
57
- case G:
57
+ case $:
58
58
  return "Profiler";
59
- case _:
59
+ case h:
60
60
  return "StrictMode";
61
- case A:
61
+ case W:
62
62
  return "Suspense";
63
- case F:
63
+ case R:
64
64
  return "SuspenseList";
65
- case v:
65
+ case p:
66
66
  return "Activity";
67
67
  }
68
- if (typeof t == "object")
69
- switch (typeof t.tag == "number" && console.error(
68
+ if (typeof s == "object")
69
+ switch (typeof s.tag == "number" && console.error(
70
70
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
71
- ), t.$$typeof) {
72
- case i:
71
+ ), s.$$typeof) {
72
+ case S:
73
73
  return "Portal";
74
- case W:
75
- return t.displayName || "Context";
76
- case D:
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;
74
+ case q:
75
+ return s.displayName || "Context";
76
+ case M:
77
+ return (s._context.displayName || "Context") + ".Consumer";
78
+ case Y:
79
+ var i = s.render;
80
+ return s = s.displayName, s || (s = i.displayName || i.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
81
+ case I:
82
+ return i = s.displayName || null, i !== null ? i : n(s.type) || "Memo";
83
+ case l:
84
+ i = s._payload, s = s._init;
85
85
  try {
86
- return n(t(c));
86
+ return n(s(i));
87
87
  } catch {
88
88
  }
89
89
  }
90
90
  return null;
91
91
  }
92
- function s(t) {
93
- return "" + t;
92
+ function t(s) {
93
+ return "" + s;
94
94
  }
95
- function r(t) {
95
+ function r(s) {
96
96
  try {
97
- s(t);
98
- var c = !1;
97
+ t(s);
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 f = i.error, k = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
105
+ return f.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
109
- ), s(t);
108
+ k
109
+ ), t(s);
110
110
  }
111
111
  }
112
- function a(t) {
113
- if (t === u) return "<>";
114
- if (typeof t == "object" && t !== null && t.$$typeof === d)
112
+ function a(s) {
113
+ if (s === u) return "<>";
114
+ if (typeof s == "object" && s !== null && s.$$typeof === l)
115
115
  return "<...>";
116
116
  try {
117
- var c = n(t);
118
- return c ? "<" + c + ">" : "<...>";
117
+ var i = n(s);
118
+ return i ? "<" + i + ">" : "<...>";
119
119
  } catch {
120
120
  return "<...>";
121
121
  }
122
122
  }
123
- function l() {
124
- var t = O.A;
125
- return t === null ? null : t.getOwner();
126
- }
127
123
  function o() {
124
+ var s = A.A;
125
+ return s === null ? null : s.getOwner();
126
+ }
127
+ function c() {
128
128
  return Error("react-stack-top-frame");
129
129
  }
130
- function m(t) {
131
- if (M.call(t, "key")) {
132
- var c = Object.getOwnPropertyDescriptor(t, "key").get;
133
- if (c && c.isReactWarning) return !1;
130
+ function d(s) {
131
+ if (V.call(s, "key")) {
132
+ var i = Object.getOwnPropertyDescriptor(s, "key").get;
133
+ if (i && i.isReactWarning) return !1;
134
134
  }
135
- return t.key !== void 0;
135
+ return s.key !== void 0;
136
136
  }
137
- function h(t, c) {
138
- function j() {
137
+ function m(s, i) {
138
+ function f() {
139
139
  P || (P = !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
+ f.isReactWarning = !0, Object.defineProperty(s, "key", {
145
+ get: f,
146
146
  configurable: !0
147
147
  });
148
148
  }
149
- function f() {
150
- var t = n(this.type);
151
- return I[t] || (I[t] = !0, console.error(
149
+ function v() {
150
+ var s = n(this.type);
151
+ return D[s] || (D[s] = !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
- )), t = this.props.ref, t !== void 0 ? t : null;
153
+ )), s = this.props.ref, s !== void 0 ? s : null;
154
154
  }
155
- function g(t, c, j, S, H, K) {
156
- var k = j.ref;
157
- return t = {
155
+ function b(s, i, f, k, H, K) {
156
+ var y = f.ref;
157
+ return s = {
158
158
  $$typeof: w,
159
- type: t,
160
- key: c,
161
- props: j,
162
- _owner: S
163
- }, (k !== void 0 ? k : null) !== null ? Object.defineProperty(t, "ref", {
159
+ type: s,
160
+ key: i,
161
+ props: f,
162
+ _owner: k
163
+ }, (y !== void 0 ? y : null) !== null ? Object.defineProperty(s, "ref", {
164
164
  enumerable: !1,
165
- get: f
166
- }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
165
+ get: v
166
+ }) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
167
167
  configurable: !1,
168
168
  enumerable: !1,
169
169
  writable: !0,
170
170
  value: 0
171
- }), Object.defineProperty(t, "_debugInfo", {
171
+ }), Object.defineProperty(s, "_debugInfo", {
172
172
  configurable: !1,
173
173
  enumerable: !1,
174
174
  writable: !0,
175
175
  value: null
176
- }), Object.defineProperty(t, "_debugStack", {
176
+ }), Object.defineProperty(s, "_debugStack", {
177
177
  configurable: !1,
178
178
  enumerable: !1,
179
179
  writable: !0,
180
180
  value: H
181
- }), Object.defineProperty(t, "_debugTask", {
181
+ }), Object.defineProperty(s, "_debugTask", {
182
182
  configurable: !1,
183
183
  enumerable: !1,
184
184
  writable: !0,
185
185
  value: K
186
- }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
186
+ }), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
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 x(s, i, f, k, H, K) {
189
+ var y = i.children;
190
+ if (y !== void 0)
191
+ if (k)
192
+ if (G(y)) {
193
+ for (k = 0; k < y.length; k++)
194
+ _(y[k]);
195
+ Object.freeze && Object.freeze(y);
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 _(y);
201
+ if (V.call(i, "key")) {
202
+ y = n(s);
203
+ var J = 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
+ k = 0 < J.length ? "{key: someKey, " + J.join(": ..., ") + ": ...}" : "{key: someKey}", g[y + k] || (J = 0 < J.length ? "{" + J.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
213
  k,
215
- U,
216
- k
217
- ), V[k + S] = !0);
214
+ y,
215
+ J,
216
+ y
217
+ ), g[y + k] = !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,
226
- typeof t == "function" ? t.displayName || t.name || "Unknown" : t
227
- ), g(
228
- t,
229
- k,
230
- j,
231
- l(),
219
+ if (y = null, f !== void 0 && (r(f), y = "" + f), d(i) && (r(i.key), y = "" + i.key), "key" in i) {
220
+ f = {};
221
+ for (var ee in i)
222
+ ee !== "key" && (f[ee] = i[ee]);
223
+ } else f = i;
224
+ return y && m(
225
+ f,
226
+ typeof s == "function" ? s.displayName || s.name || "Unknown" : s
227
+ ), b(
228
+ s,
229
+ y,
230
+ f,
231
+ o(),
232
232
  H,
233
233
  K
234
234
  );
235
235
  }
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));
236
+ function _(s) {
237
+ C(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof === l && (s._payload.status === "fulfilled" ? C(s._payload.value) && s._payload.value._store && (s._payload.value._store.validated = 1) : s._store && (s._store.validated = 1));
238
238
  }
239
- function T(t) {
240
- return typeof t == "object" && t !== null && t.$$typeof === w;
239
+ function C(s) {
240
+ return typeof s == "object" && s !== null && s.$$typeof === w;
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 E = de, w = Symbol.for("react.transitional.element"), S = Symbol.for("react.portal"), u = Symbol.for("react.fragment"), h = Symbol.for("react.strict_mode"), $ = Symbol.for("react.profiler"), M = Symbol.for("react.consumer"), q = Symbol.for("react.context"), Y = Symbol.for("react.forward_ref"), W = Symbol.for("react.suspense"), R = Symbol.for("react.suspense_list"), I = Symbol.for("react.memo"), l = Symbol.for("react.lazy"), p = Symbol.for("react.activity"), N = Symbol.for("react.client.reference"), A = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, V = Object.prototype.hasOwnProperty, G = Array.isArray, O = console.createTask ? console.createTask : function() {
243
243
  return null;
244
244
  };
245
245
  E = {
246
- react_stack_bottom_frame: function(t) {
247
- return t();
246
+ react_stack_bottom_frame: function(s) {
247
+ return s();
248
248
  }
249
249
  };
250
- var P, I = {}, X = E.react_stack_bottom_frame.bind(
250
+ var P, D = {}, F = E.react_stack_bottom_frame.bind(
251
251
  E,
252
- o
253
- )(), b = $(a(o)), V = {};
254
- B.Fragment = u, B.jsx = function(t, c, j) {
255
- var S = 1e4 > O.recentlyCreatedOwnerStacks++;
252
+ c
253
+ )(), X = O(a(c)), g = {};
254
+ B.Fragment = u, B.jsx = function(s, i, f) {
255
+ var k = 1e4 > A.recentlyCreatedOwnerStacks++;
256
256
  return x(
257
- t,
258
- c,
259
- j,
257
+ s,
258
+ i,
259
+ f,
260
260
  !1,
261
- S ? Error("react-stack-top-frame") : X,
262
- S ? $(a(t)) : b
261
+ k ? Error("react-stack-top-frame") : F,
262
+ k ? O(a(s)) : X
263
263
  );
264
- }, B.jsxs = function(t, c, j) {
265
- var S = 1e4 > O.recentlyCreatedOwnerStacks++;
264
+ }, B.jsxs = function(s, i, f) {
265
+ var k = 1e4 > A.recentlyCreatedOwnerStacks++;
266
266
  return x(
267
- t,
268
- c,
269
- j,
267
+ s,
268
+ i,
269
+ f,
270
270
  !0,
271
- S ? Error("react-stack-top-frame") : X,
272
- S ? $(a(t)) : b
271
+ k ? Error("react-stack-top-frame") : F,
272
+ k ? O(a(s)) : X
273
273
  );
274
274
  };
275
275
  })()), B;
276
276
  }
277
- var se;
278
- function pe() {
279
- return se || (se = 1, process.env.NODE_ENV === "production" ? Z.exports = he() : Z.exports = ve()), Z.exports;
277
+ var te;
278
+ function fe() {
279
+ return te || (te = 1, process.env.NODE_ENV === "production" ? Z.exports = ve() : 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);
281
+ var e = fe();
282
+ const ae = me(null);
283
+ function xe({ engine: n, initialSnapshot: t, children: r, devTools: a = !1 }) {
284
+ const [o, c] = T(t);
285
285
  L(() => {
286
- }, [n]);
287
- const o = N(
288
- (i) => {
289
- const u = n.selectChoice(i);
290
- l(u);
286
+ if (a)
287
+ return ie(n, () => c(n.getSnapshot())), () => {
288
+ delete window.doodle;
289
+ };
290
+ }, [n, a]);
291
+ const d = j(
292
+ (u) => {
293
+ const h = n.selectChoice(u);
294
+ c(h);
291
295
  },
292
296
  [n]
293
- ), m = N(
294
- (i) => {
295
- const u = n.talkTo(i);
296
- l(u);
297
+ ), m = j(
298
+ (u) => {
299
+ const h = n.talkTo(u);
300
+ c(h);
297
301
  },
298
302
  [n]
299
- ), h = N(
300
- (i) => {
301
- const u = n.takeItem(i);
302
- l(u);
303
+ ), v = j(
304
+ (u) => {
305
+ const h = n.takeItem(u);
306
+ c(h);
303
307
  },
304
308
  [n]
305
- ), f = N(
306
- (i) => {
307
- const u = n.travelTo(i);
308
- l(u);
309
+ ), b = j(
310
+ (u) => {
311
+ const h = n.travelTo(u);
312
+ c(h);
309
313
  },
310
314
  [n]
311
- ), g = N(
312
- (i, u) => {
313
- const _ = n.writeNote(i, u);
314
- l(_);
315
+ ), x = j(
316
+ (u, h) => {
317
+ const $ = n.writeNote(u, h);
318
+ c($);
315
319
  },
316
320
  [n]
317
- ), x = N(
318
- (i) => {
319
- const u = n.deleteNote(i);
320
- l(u);
321
+ ), _ = j(
322
+ (u) => {
323
+ const h = n.deleteNote(u);
324
+ c(h);
321
325
  },
322
326
  [n]
323
- ), R = N(
324
- (i) => {
325
- const u = n.setLocale(i);
326
- l(u);
327
+ ), C = j(
328
+ (u) => {
329
+ const h = n.setLocale(u);
330
+ c(h);
327
331
  },
328
332
  [n]
329
- ), T = N(() => n.saveGame(), [n]), E = N(
330
- (i) => {
331
- const u = n.loadGame(i);
332
- l(u);
333
+ ), E = j(() => n.saveGame(), [n]), w = j(
334
+ (u) => {
335
+ const h = n.loadGame(u);
336
+ c(h);
333
337
  },
334
338
  [n]
335
- ), w = {
336
- snapshot: a,
339
+ ), S = {
340
+ snapshot: o,
337
341
  actions: {
338
- selectChoice: o,
342
+ selectChoice: d,
339
343
  talkTo: m,
340
- takeItem: h,
341
- travelTo: f,
342
- writeNote: g,
343
- deleteNote: x,
344
- setLocale: R,
345
- saveGame: T,
346
- loadGame: E
344
+ takeItem: v,
345
+ travelTo: b,
346
+ writeNote: x,
347
+ deleteNote: _,
348
+ setLocale: C,
349
+ saveGame: E,
350
+ loadGame: w
347
351
  }
348
352
  };
349
- return /* @__PURE__ */ e.jsx(ae.Provider, { value: w, children: r });
353
+ return /* @__PURE__ */ e.jsx(ae.Provider, { value: S, children: r });
350
354
  }
351
355
  function re() {
352
- const n = me(ae);
356
+ const n = he(ae);
353
357
  if (!n)
354
358
  throw new Error("useGame must be used within a GameProvider");
355
359
  return n;
356
360
  }
357
- function le(n, s = {}) {
358
- var p;
361
+ function le(n, t = {}) {
362
+ var I;
359
363
  const {
360
364
  audioBasePath: r = "/audio",
361
365
  masterVolume: a = 1,
362
- musicVolume: l = 0.7,
363
- 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);
366
+ musicVolume: o = 0.7,
367
+ soundVolume: c = 0.8,
368
+ voiceVolume: d = 1,
369
+ crossfadeDuration: m = 1e3
370
+ } = t, [v, b] = T(a), [x, _] = T(o), [C, E] = T(c), [w, S] = T(d), u = U(null), h = U(null), $ = U(null), M = U(null);
367
371
  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 = "";
372
+ const l = new Audio();
373
+ l.loop = !0, u.current = l;
374
+ const p = new Audio();
375
+ return h.current = p, () => {
376
+ M.current && clearInterval(M.current), l.pause(), p.pause(), l.src = "", p.src = "";
373
377
  };
374
378
  }, []), 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);
379
+ const l = u.current;
380
+ if (!l) return;
381
+ const p = n.music;
382
+ if (p !== $.current)
383
+ if ($.current = p, !p)
384
+ Y(l, m);
381
385
  else {
382
- const y = `${r}/music/${v}`;
383
- W(d, y, h);
386
+ const N = `${r}/music/${p}`;
387
+ q(l, N, m);
384
388
  }
385
- d.volume = f * x;
386
- }, [n.music, f, x, r, h]), L(() => {
387
- 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) => {
392
- console.warn("Voice playback failed:", O);
389
+ l.volume = v * x;
390
+ }, [n.music, v, x, r, m]), L(() => {
391
+ var N;
392
+ const l = h.current;
393
+ if (!l) return;
394
+ const p = (N = n.dialogue) == null ? void 0 : N.voice;
395
+ p && (l.pause(), l.currentTime = 0, l.src = `${r}/voice/${p}`, l.volume = v * w, l.play().catch((A) => {
396
+ console.warn("Voice playback failed:", A);
393
397
  }));
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) => {
398
- console.warn("Sound playback failed:", y);
398
+ }, [(I = n.dialogue) == null ? void 0 : I.voice, v, w, r]), L(() => {
399
+ n.pendingSounds.length !== 0 && n.pendingSounds.forEach((l) => {
400
+ const p = new Audio(`${r}/sfx/${l}`);
401
+ p.volume = v * C, p.play().catch((N) => {
402
+ console.warn("Sound playback failed:", N);
399
403
  });
400
404
  });
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);
406
- }).catch((O) => {
407
- console.warn("Music playback failed:", O);
405
+ }, [n.pendingSounds, v, C, r]);
406
+ const q = (l, p, N) => {
407
+ Y(l, N / 2).then(() => {
408
+ l.src = p, l.load(), l.volume = 0, l.play().then(() => {
409
+ W(l, N / 2, v * x);
410
+ }).catch((A) => {
411
+ console.warn("Music playback failed:", A);
408
412
  });
409
413
  });
410
- }, J = (d, v) => new Promise((y) => {
411
- const O = d.volume, M = 20, Y = v / M, $ = O / M;
414
+ }, Y = (l, p) => new Promise((N) => {
415
+ const A = l.volume, V = 20, G = p / V, O = A / V;
412
416
  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());
415
- }, Y);
416
- D.current = I;
417
- }), A = (d, v, y) => {
418
- const M = v / 20, Y = y / 20;
419
- let $ = 0;
417
+ const D = setInterval(() => {
418
+ P++, l.volume = Math.max(0, A - O * P), P >= V && (clearInterval(D), l.pause(), l.currentTime = 0, N());
419
+ }, G);
420
+ M.current = D;
421
+ }), W = (l, p, N) => {
422
+ const V = p / 20, G = N / 20;
423
+ let O = 0;
420
424
  const P = setInterval(() => {
421
- $++, d.volume = Math.min(y, Y * $), $ >= 20 && clearInterval(P);
422
- }, M);
423
- D.current = P;
425
+ O++, l.volume = Math.min(N, G * O), O >= 20 && clearInterval(P);
426
+ }, V);
427
+ M.current = P;
424
428
  };
425
429
  return {
426
- setMasterVolume: g,
427
- setMusicVolume: R,
430
+ setMasterVolume: b,
431
+ setMusicVolume: _,
428
432
  setSoundVolume: E,
429
- setVoiceVolume: i,
433
+ setVoiceVolume: S,
430
434
  stopAll: () => {
431
- u.current && (u.current.pause(), u.current.currentTime = 0), _.current && (_.current.pause(), _.current.currentTime = 0);
435
+ u.current && (u.current.pause(), u.current.currentTime = 0), h.current && (h.current.pause(), h.current.currentTime = 0);
432
436
  }
433
437
  };
434
438
  }
435
- const xe = {
439
+ const je = {
436
440
  click: "click.ogg",
437
441
  menuOpen: "menu_open.ogg",
438
442
  menuClose: "menu_close.ogg"
439
443
  };
440
- function je(n = {}) {
444
+ function Ne(n = {}) {
441
445
  const {
442
- enabled: s = !0,
446
+ enabled: t = !0,
443
447
  basePath: r = "/audio/ui",
444
448
  volume: a = 0.5,
445
- 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(() => {
449
+ sounds: o = {}
450
+ } = n, [c, d] = T(t), [m, v] = T(a), b = U({ ...je, ...o }), x = j(
451
+ (S) => {
452
+ if (!c || !S) return;
453
+ const u = new Audio(`${r}/${S}`);
454
+ u.volume = m, u.play().catch(() => {
451
455
  });
452
456
  },
453
- [o, h, r]
454
- ), R = N(
455
- (i) => {
456
- const u = g.current[i];
457
+ [c, m, r]
458
+ ), _ = j(
459
+ (S) => {
460
+ const u = b.current[S];
457
461
  u && x(u);
458
462
  },
459
463
  [x]
460
- ), T = N(() => x(g.current.click), [x]), E = N(() => x(g.current.menuOpen), [x]), w = N(() => x(g.current.menuClose), [x]);
464
+ ), C = j(() => x(b.current.click), [x]), E = j(() => x(b.current.menuOpen), [x]), w = j(() => x(b.current.menuClose), [x]);
461
465
  return {
462
- playClick: T,
466
+ playClick: C,
463
467
  playMenuOpen: E,
464
468
  playMenuClose: w,
465
- playSound: R,
466
- setEnabled: m,
467
- setVolume: f,
468
- enabled: o,
469
- volume: h
469
+ playSound: _,
470
+ setEnabled: d,
471
+ setVolume: v,
472
+ enabled: c,
473
+ volume: m
470
474
  };
471
475
  }
472
- function Ne({ dialogue: n, className: s = "" }) {
473
- return /* @__PURE__ */ e.jsxs("div", { className: `dialogue-box ${s}`, children: [
476
+ function ge({ dialogue: n, className: t = "" }) {
477
+ return /* @__PURE__ */ e.jsxs("div", { className: `dialogue-box ${t}`, children: [
474
478
  n.portrait && /* @__PURE__ */ e.jsx("div", { className: "dialogue-portrait", children: /* @__PURE__ */ e.jsx("img", { src: n.portrait, alt: n.speakerName }) }),
475
479
  /* @__PURE__ */ e.jsxs("div", { className: "dialogue-content", children: [
476
480
  /* @__PURE__ */ e.jsx("div", { className: "dialogue-speaker", children: n.speakerName }),
@@ -478,19 +482,19 @@ function Ne({ dialogue: n, className: s = "" }) {
478
482
  ] })
479
483
  ] });
480
484
  }
481
- function be({ choices: n, onSelectChoice: s, className: r = "" }) {
485
+ function be({ choices: n, onSelectChoice: t, className: r = "" }) {
482
486
  return n.length === 0 ? null : /* @__PURE__ */ e.jsx("div", { className: `choice-list ${r}`, children: n.map((a) => /* @__PURE__ */ e.jsx(
483
487
  "button",
484
488
  {
485
489
  className: "choice-button",
486
- onClick: () => s(a.id),
490
+ onClick: () => t(a.id),
487
491
  children: a.text
488
492
  },
489
493
  a.id
490
494
  )) });
491
495
  }
492
- function ge({ location: n, className: s = "" }) {
493
- return /* @__PURE__ */ e.jsxs("div", { className: `location-view ${s}`, children: [
496
+ function Se({ location: n, className: t = "" }) {
497
+ return /* @__PURE__ */ e.jsxs("div", { className: `location-view ${t}`, children: [
494
498
  n.banner && /* @__PURE__ */ e.jsx("div", { className: "location-banner", children: /* @__PURE__ */ e.jsx("img", { src: n.banner, alt: n.name }) }),
495
499
  /* @__PURE__ */ e.jsxs("div", { className: "location-content", children: [
496
500
  /* @__PURE__ */ e.jsx("h1", { className: "location-name", children: n.name }),
@@ -498,9 +502,9 @@ function ge({ location: n, className: s = "" }) {
498
502
  ] })
499
503
  ] });
500
504
  }
501
- function Se({
505
+ function ke({
502
506
  characters: n,
503
- onTalkTo: s,
507
+ onTalkTo: t,
504
508
  className: r = ""
505
509
  }) {
506
510
  return n.length === 0 ? null : /* @__PURE__ */ e.jsxs("div", { className: `character-list ${r}`, children: [
@@ -509,7 +513,7 @@ function Se({
509
513
  "button",
510
514
  {
511
515
  className: "character-card",
512
- onClick: () => s(a.id),
516
+ onClick: () => t(a.id),
513
517
  children: [
514
518
  a.portrait && /* @__PURE__ */ e.jsx(
515
519
  "img",
@@ -526,23 +530,23 @@ function Se({
526
530
  )) })
527
531
  ] });
528
532
  }
529
- function ke({ items: n, className: s = "" }) {
530
- const [r, a] = C(null);
531
- return /* @__PURE__ */ e.jsxs("div", { className: `inventory ${s}`, children: [
533
+ function ye({ items: n, className: t = "" }) {
534
+ const [r, a] = T(null);
535
+ return /* @__PURE__ */ e.jsxs("div", { className: `inventory ${t}`, children: [
532
536
  /* @__PURE__ */ e.jsx("h2", { children: "Inventory" }),
533
- n.length === 0 ? /* @__PURE__ */ e.jsx("p", { className: "inventory-empty", children: "No items" }) : /* @__PURE__ */ e.jsx("div", { className: "inventory-grid", children: n.map((l) => /* @__PURE__ */ e.jsxs(
537
+ n.length === 0 ? /* @__PURE__ */ e.jsx("p", { className: "inventory-empty", children: "No items" }) : /* @__PURE__ */ e.jsx("div", { className: "inventory-grid", children: n.map((o) => /* @__PURE__ */ e.jsxs(
534
538
  "div",
535
539
  {
536
540
  className: "inventory-item",
537
- onClick: () => a(l),
541
+ onClick: () => a(o),
538
542
  children: [
539
- l.icon && /* @__PURE__ */ e.jsx("img", { src: l.icon, alt: l.name, className: "item-icon" }),
540
- /* @__PURE__ */ e.jsx("div", { className: "item-name", children: l.name })
543
+ o.icon && /* @__PURE__ */ e.jsx("img", { src: o.icon, alt: o.name, className: "item-icon" }),
544
+ /* @__PURE__ */ e.jsx("div", { className: "item-name", children: o.name })
541
545
  ]
542
546
  },
543
- l.id
547
+ o.id
544
548
  )) }),
545
- r && /* @__PURE__ */ e.jsx("div", { className: "item-modal-overlay", onClick: () => a(null), children: /* @__PURE__ */ e.jsxs("div", { className: "item-modal", onClick: (l) => l.stopPropagation(), children: [
549
+ r && /* @__PURE__ */ e.jsx("div", { className: "item-modal-overlay", onClick: () => a(null), children: /* @__PURE__ */ e.jsxs("div", { className: "item-modal", onClick: (o) => o.stopPropagation(), children: [
546
550
  r.image && /* @__PURE__ */ e.jsx("img", { src: r.image, alt: r.name, className: "item-modal-image" }),
547
551
  /* @__PURE__ */ e.jsx("h3", { className: "item-modal-name", children: r.name }),
548
552
  /* @__PURE__ */ e.jsx("p", { className: "item-modal-description", children: r.description }),
@@ -550,7 +554,7 @@ function ke({ items: n, className: s = "" }) {
550
554
  ] }) })
551
555
  ] });
552
556
  }
553
- function ye({ quests: n, entries: s, className: r = "" }) {
557
+ function Ee({ quests: n, entries: t, className: r = "" }) {
554
558
  return /* @__PURE__ */ e.jsxs("div", { className: `journal ${r}`, children: [
555
559
  /* @__PURE__ */ e.jsx("h2", { children: "Journal" }),
556
560
  n.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "journal-quests", children: [
@@ -561,17 +565,17 @@ function ye({ quests: n, entries: s, className: r = "" }) {
561
565
  /* @__PURE__ */ e.jsx("div", { className: "quest-stage", children: a.currentStageDescription })
562
566
  ] }, a.id))
563
567
  ] }),
564
- s.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "journal-entries", children: [
568
+ t.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "journal-entries", children: [
565
569
  /* @__PURE__ */ e.jsx("h3", { children: "Entries" }),
566
- s.map((a) => /* @__PURE__ */ e.jsxs("div", { className: `journal-entry journal-category-${a.category}`, children: [
570
+ t.map((a) => /* @__PURE__ */ e.jsxs("div", { className: `journal-entry journal-category-${a.category}`, children: [
567
571
  /* @__PURE__ */ e.jsx("div", { className: "entry-title", children: a.title }),
568
572
  /* @__PURE__ */ e.jsx("div", { className: "entry-text", children: a.text })
569
573
  ] }, a.id))
570
574
  ] }),
571
- n.length === 0 && s.length === 0 && /* @__PURE__ */ e.jsx("p", { className: "journal-empty", children: "No entries yet" })
575
+ n.length === 0 && t.length === 0 && /* @__PURE__ */ e.jsx("p", { className: "journal-empty", children: "No entries yet" })
572
576
  ] });
573
577
  }
574
- function Ee({ map: n, onTravelTo: s, className: r = "" }) {
578
+ function we({ map: n, onTravelTo: t, className: r = "" }) {
575
579
  return n ? /* @__PURE__ */ e.jsxs("div", { className: `map-view ${r}`, children: [
576
580
  /* @__PURE__ */ e.jsx("h2", { children: n.name }),
577
581
  /* @__PURE__ */ e.jsxs("div", { className: "map-container", style: { position: "relative" }, children: [
@@ -585,7 +589,7 @@ function Ee({ map: n, onTravelTo: s, className: r = "" }) {
585
589
  left: `${a.x}px`,
586
590
  top: `${a.y}px`
587
591
  },
588
- onClick: () => !a.isCurrent && s(a.id),
592
+ onClick: () => !a.isCurrent && t(a.id),
589
593
  disabled: a.isCurrent,
590
594
  title: a.name,
591
595
  children: a.name
@@ -597,139 +601,139 @@ function Ee({ map: n, onTravelTo: s, className: r = "" }) {
597
601
  }
598
602
  function Te({
599
603
  notifications: n,
600
- className: s = ""
604
+ className: t = ""
601
605
  }) {
602
- 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)) });
606
+ return n.length === 0 ? null : /* @__PURE__ */ e.jsx("div", { className: `notification-area ${t}`, children: n.map((r, a) => /* @__PURE__ */ e.jsx("div", { className: "notification", children: r }, a)) });
603
607
  }
604
- function we({
608
+ function _e({
605
609
  onSave: n,
606
- onLoad: s,
610
+ onLoad: t,
607
611
  storageKey: r = "doodle-engine-save",
608
612
  className: a = ""
609
613
  }) {
610
- const [l, o] = C(""), m = () => {
611
- const g = n();
612
- localStorage.setItem(r, JSON.stringify(g)), o("Saved!"), setTimeout(() => o(""), 2e3);
613
- }, h = () => {
614
- const g = localStorage.getItem(r);
615
- if (!g) {
616
- o("No save found"), setTimeout(() => o(""), 2e3);
614
+ const [o, c] = T(""), d = () => {
615
+ const b = n();
616
+ localStorage.setItem(r, JSON.stringify(b)), c("Saved!"), setTimeout(() => c(""), 2e3);
617
+ }, m = () => {
618
+ const b = localStorage.getItem(r);
619
+ if (!b) {
620
+ c("No save found"), setTimeout(() => c(""), 2e3);
617
621
  return;
618
622
  }
619
- const x = JSON.parse(g);
620
- s(x), o("Loaded!"), setTimeout(() => o(""), 2e3);
621
- }, f = localStorage.getItem(r) !== null;
623
+ const x = JSON.parse(b);
624
+ t(x), c("Loaded!"), setTimeout(() => c(""), 2e3);
625
+ }, v = localStorage.getItem(r) !== null;
622
626
  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" }),
625
- l && /* @__PURE__ */ e.jsx("span", { className: "save-load-message", children: l })
627
+ /* @__PURE__ */ e.jsx("button", { className: "save-button", onClick: d, children: "Save" }),
628
+ /* @__PURE__ */ e.jsx("button", { className: "load-button", onClick: m, disabled: !v, children: "Load" }),
629
+ o && /* @__PURE__ */ e.jsx("span", { className: "save-load-message", children: o })
626
630
  ] });
627
631
  }
628
- function _e({ className: n = "" }) {
629
- const { snapshot: s, actions: r } = re();
630
- le(s);
631
- const a = Object.entries(s.variables).filter(([l]) => !l.startsWith("_"));
632
+ function Ce({ className: n = "" }) {
633
+ const { snapshot: t, actions: r } = re();
634
+ le(t);
635
+ const a = Object.entries(t.variables).filter(([o]) => !o.startsWith("_"));
632
636
  return /* @__PURE__ */ e.jsxs("div", { className: `game-renderer ${n}`, children: [
633
- /* @__PURE__ */ e.jsx(Te, { notifications: s.notifications }),
637
+ /* @__PURE__ */ e.jsx(Te, { notifications: t.notifications }),
634
638
  /* @__PURE__ */ e.jsxs("div", { className: "game-main", children: [
635
- /* @__PURE__ */ e.jsx(ge, { location: s.location }),
636
- s.dialogue && /* @__PURE__ */ e.jsxs("div", { className: "dialogue-container", children: [
637
- /* @__PURE__ */ e.jsx(Ne, { dialogue: s.dialogue }),
638
- /* @__PURE__ */ e.jsx(be, { choices: s.choices, onSelectChoice: r.selectChoice })
639
+ /* @__PURE__ */ e.jsx(Se, { location: t.location }),
640
+ t.dialogue && /* @__PURE__ */ e.jsxs("div", { className: "dialogue-container", children: [
641
+ /* @__PURE__ */ e.jsx(ge, { dialogue: t.dialogue }),
642
+ /* @__PURE__ */ e.jsx(be, { choices: t.choices, onSelectChoice: r.selectChoice })
639
643
  ] }),
640
- !s.dialogue && /* @__PURE__ */ e.jsx(
641
- Se,
644
+ !t.dialogue && /* @__PURE__ */ e.jsx(
645
+ ke,
642
646
  {
643
- characters: s.charactersHere,
647
+ characters: t.charactersHere,
644
648
  onTalkTo: r.talkTo
645
649
  }
646
650
  )
647
651
  ] }),
648
652
  /* @__PURE__ */ e.jsxs("div", { className: "game-sidebar", children: [
649
- /* @__PURE__ */ e.jsx(we, { onSave: r.saveGame, onLoad: r.loadGame }),
653
+ /* @__PURE__ */ e.jsx(_e, { onSave: r.saveGame, onLoad: r.loadGame }),
650
654
  a.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "resources", children: [
651
655
  /* @__PURE__ */ e.jsx("h2", { children: "Resources" }),
652
- /* @__PURE__ */ e.jsx("ul", { className: "resources-list", children: a.map(([l, o]) => /* @__PURE__ */ e.jsxs("li", { className: "resource-entry", children: [
653
- /* @__PURE__ */ e.jsx("span", { className: "resource-name", children: l }),
654
- /* @__PURE__ */ e.jsx("span", { className: "resource-value", children: o })
655
- ] }, l)) })
656
+ /* @__PURE__ */ e.jsx("ul", { className: "resources-list", children: a.map(([o, c]) => /* @__PURE__ */ e.jsxs("li", { className: "resource-entry", children: [
657
+ /* @__PURE__ */ e.jsx("span", { className: "resource-name", children: o }),
658
+ /* @__PURE__ */ e.jsx("span", { className: "resource-value", children: c })
659
+ ] }, o)) })
656
660
  ] }),
657
- s.party.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "party", children: [
661
+ t.party.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "party", children: [
658
662
  /* @__PURE__ */ e.jsx("h2", { children: "Party" }),
659
- /* @__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)) })
663
+ /* @__PURE__ */ e.jsx("ul", { className: "party-list", children: t.party.map((o) => /* @__PURE__ */ e.jsx("li", { className: "party-member", children: /* @__PURE__ */ e.jsx("span", { className: "party-member-name", children: o.name }) }, o.id)) })
660
664
  ] }),
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 })
665
+ /* @__PURE__ */ e.jsx(ye, { items: t.inventory }),
666
+ /* @__PURE__ */ e.jsx(Ee, { quests: t.quests, entries: t.journal }),
667
+ t.map && /* @__PURE__ */ e.jsx(we, { map: t.map, onTravelTo: r.travelTo })
664
668
  ] })
665
669
  ] });
666
670
  }
667
- function Ce({
671
+ function Re({
668
672
  logoSrc: n,
669
- title: s,
673
+ title: t,
670
674
  onComplete: r,
671
675
  duration: a = 2e3,
672
- className: l = ""
676
+ className: o = ""
673
677
  }) {
674
678
  return L(() => {
675
- const o = setTimeout(r, a);
676
- return () => clearTimeout(o);
677
- }, [r, a]), /* @__PURE__ */ e.jsxs("div", { className: `splash-screen ${l}`, onClick: r, children: [
678
- n && /* @__PURE__ */ e.jsx("img", { src: n, alt: s || "", className: "splash-logo" }),
679
- s && /* @__PURE__ */ e.jsx("h1", { className: "splash-title", children: s }),
679
+ const c = setTimeout(r, a);
680
+ return () => clearTimeout(c);
681
+ }, [r, a]), /* @__PURE__ */ e.jsxs("div", { className: `splash-screen ${o}`, onClick: r, children: [
682
+ n && /* @__PURE__ */ e.jsx("img", { src: n, alt: t || "", className: "splash-logo" }),
683
+ t && /* @__PURE__ */ e.jsx("h1", { className: "splash-title", children: t }),
680
684
  /* @__PURE__ */ e.jsx("div", { className: "splash-loading", children: "Loading..." })
681
685
  ] });
682
686
  }
683
- function Re({
687
+ function Ae({
684
688
  title: n = "Doodle Engine",
685
- subtitle: s,
689
+ subtitle: t,
686
690
  logoSrc: r,
687
691
  hasSaveData: a,
688
- onNewGame: l,
689
- onContinue: o,
690
- onSettings: m,
691
- className: h = ""
692
+ onNewGame: o,
693
+ onContinue: c,
694
+ onSettings: d,
695
+ className: m = ""
692
696
  }) {
693
- return /* @__PURE__ */ e.jsxs("div", { className: `title-screen ${h}`, children: [
697
+ return /* @__PURE__ */ e.jsxs("div", { className: `title-screen ${m}`, children: [
694
698
  r && /* @__PURE__ */ e.jsx("img", { src: r, alt: n, className: "title-logo" }),
695
699
  /* @__PURE__ */ e.jsx("h1", { className: "title-heading", children: n }),
696
- s && /* @__PURE__ */ e.jsx("p", { className: "title-subtitle", children: s }),
700
+ t && /* @__PURE__ */ e.jsx("p", { className: "title-subtitle", children: t }),
697
701
  /* @__PURE__ */ e.jsxs("div", { className: "title-menu", children: [
698
- /* @__PURE__ */ e.jsx("button", { className: "title-button", onClick: l, children: "New Game" }),
699
- a && /* @__PURE__ */ e.jsx("button", { className: "title-button", onClick: o, children: "Continue" }),
700
- /* @__PURE__ */ e.jsx("button", { className: "title-button", onClick: m, children: "Settings" })
702
+ /* @__PURE__ */ e.jsx("button", { className: "title-button", onClick: o, children: "New Game" }),
703
+ a && /* @__PURE__ */ e.jsx("button", { className: "title-button", onClick: c, children: "Continue" }),
704
+ /* @__PURE__ */ e.jsx("button", { className: "title-button", onClick: d, children: "Settings" })
701
705
  ] })
702
706
  ] });
703
707
  }
704
- function Ae({
708
+ function Oe({
705
709
  onResume: n,
706
- onSave: s,
710
+ onSave: t,
707
711
  onLoad: r,
708
712
  onSettings: a,
709
- onQuitToTitle: l,
710
- className: o = ""
713
+ onQuitToTitle: o,
714
+ className: c = ""
711
715
  }) {
712
- return /* @__PURE__ */ e.jsx("div", { className: `pause-menu-overlay ${o}`, children: /* @__PURE__ */ e.jsxs("div", { className: "pause-menu", children: [
716
+ return /* @__PURE__ */ e.jsx("div", { className: `pause-menu-overlay ${c}`, children: /* @__PURE__ */ e.jsxs("div", { className: "pause-menu", children: [
713
717
  /* @__PURE__ */ e.jsx("h2", { className: "pause-title", children: "Paused" }),
714
718
  /* @__PURE__ */ e.jsxs("div", { className: "pause-buttons", children: [
715
719
  /* @__PURE__ */ e.jsx("button", { className: "pause-button", onClick: n, children: "Resume" }),
716
- /* @__PURE__ */ e.jsx("button", { className: "pause-button", onClick: s, children: "Save" }),
720
+ /* @__PURE__ */ e.jsx("button", { className: "pause-button", onClick: t, children: "Save" }),
717
721
  /* @__PURE__ */ e.jsx("button", { className: "pause-button", onClick: r, children: "Load" }),
718
722
  /* @__PURE__ */ e.jsx("button", { className: "pause-button", onClick: a, children: "Settings" }),
719
- /* @__PURE__ */ e.jsx("button", { className: "pause-button pause-button-quit", onClick: l, children: "Quit to Title" })
723
+ /* @__PURE__ */ e.jsx("button", { className: "pause-button pause-button-quit", onClick: o, children: "Quit to Title" })
720
724
  ] })
721
725
  ] }) });
722
726
  }
723
727
  function oe({
724
728
  audioControls: n,
725
- uiSoundControls: s,
729
+ uiSoundControls: t,
726
730
  availableLocales: r,
727
731
  currentLocale: a,
728
- onLocaleChange: l,
729
- onBack: o,
730
- className: m = ""
732
+ onLocaleChange: o,
733
+ onBack: c,
734
+ className: d = ""
731
735
  }) {
732
- return /* @__PURE__ */ e.jsxs("div", { className: `settings-panel ${m}`, children: [
736
+ return /* @__PURE__ */ e.jsxs("div", { className: `settings-panel ${d}`, children: [
733
737
  /* @__PURE__ */ e.jsx("h2", { className: "settings-title", children: "Settings" }),
734
738
  /* @__PURE__ */ e.jsxs("div", { className: "settings-section", children: [
735
739
  /* @__PURE__ */ e.jsx("h3", { children: "Audio" }),
@@ -765,33 +769,33 @@ function oe({
765
769
  onChange: n.setVoiceVolume
766
770
  }
767
771
  ),
768
- s && /* @__PURE__ */ e.jsx(
772
+ t && /* @__PURE__ */ e.jsx(
769
773
  Q,
770
774
  {
771
775
  label: "UI Sounds",
772
- value: s.volume,
773
- onChange: s.setVolume
776
+ value: t.volume,
777
+ onChange: t.setVolume
774
778
  }
775
779
  )
776
780
  ] }),
777
- r && r.length > 1 && l && /* @__PURE__ */ e.jsxs("div", { className: "settings-section", children: [
781
+ r && r.length > 1 && o && /* @__PURE__ */ e.jsxs("div", { className: "settings-section", children: [
778
782
  /* @__PURE__ */ e.jsx("h3", { children: "Language" }),
779
783
  /* @__PURE__ */ e.jsx(
780
784
  "select",
781
785
  {
782
786
  className: "settings-locale-select",
783
787
  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))
788
+ onChange: (m) => o(m.target.value),
789
+ children: r.map((m) => /* @__PURE__ */ e.jsx("option", { value: m.code, children: m.label }, m.code))
786
790
  }
787
791
  )
788
792
  ] }),
789
- /* @__PURE__ */ e.jsx("button", { className: "settings-back-button", onClick: o, children: "Back" })
793
+ /* @__PURE__ */ e.jsx("button", { className: "settings-back-button", onClick: c, children: "Back" })
790
794
  ] });
791
795
  }
792
796
  function Q({
793
797
  label: n,
794
- value: s,
798
+ value: t,
795
799
  onChange: r
796
800
  }) {
797
801
  return /* @__PURE__ */ e.jsxs("div", { className: "volume-slider", children: [
@@ -803,31 +807,31 @@ function Q({
803
807
  min: "0",
804
808
  max: "1",
805
809
  step: "0.05",
806
- defaultValue: s,
810
+ defaultValue: t,
807
811
  onChange: (a) => r(parseFloat(a.target.value)),
808
812
  className: "volume-input"
809
813
  }
810
814
  )
811
815
  ] });
812
816
  }
813
- function Oe({
817
+ function Pe({
814
818
  src: n,
815
- basePath: s = "/video",
819
+ basePath: t = "/video",
816
820
  onComplete: r,
817
821
  className: a = ""
818
822
  }) {
819
- const l = q(null);
823
+ const o = U(null);
820
824
  return L(() => {
821
- const o = (m) => {
822
- (m.key === "Escape" || m.key === " " || m.key === "Enter") && (m.preventDefault(), r());
825
+ const c = (d) => {
826
+ (d.key === "Escape" || d.key === " " || d.key === "Enter") && (d.preventDefault(), r());
823
827
  };
824
- return window.addEventListener("keydown", o), () => window.removeEventListener("keydown", o);
828
+ return window.addEventListener("keydown", c), () => window.removeEventListener("keydown", c);
825
829
  }, [r]), /* @__PURE__ */ e.jsxs("div", { className: `video-player-overlay ${a}`, children: [
826
830
  /* @__PURE__ */ e.jsx(
827
831
  "video",
828
832
  {
829
- ref: l,
830
- src: `${s}/${n}`,
833
+ ref: o,
834
+ src: `${t}/${n}`,
831
835
  autoPlay: !0,
832
836
  onEnded: r,
833
837
  className: "video-player-video"
@@ -843,29 +847,30 @@ function Oe({
843
847
  )
844
848
  ] });
845
849
  }
846
- function Me({
850
+ function Ie({
847
851
  registry: n,
848
- config: s,
852
+ config: t,
849
853
  title: r = "Doodle Engine",
850
854
  subtitle: a,
851
- logoSrc: l,
852
- splashDuration: o = 2e3,
853
- uiSounds: m,
854
- audioOptions: h,
855
- storageKey: f = "doodle-engine-save",
856
- availableLocales: g,
855
+ logoSrc: o,
856
+ splashDuration: c = 2e3,
857
+ uiSounds: d,
858
+ audioOptions: m,
859
+ storageKey: v = "doodle-engine-save",
860
+ availableLocales: b,
857
861
  videoBasePath: x = "/video",
858
- className: R = ""
862
+ className: _ = "",
863
+ devTools: C = !1
859
864
  }) {
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 = {
864
- currentLocation: s.startLocation,
865
- currentTime: { ...s.startTime },
866
- flags: { ...s.startFlags },
867
- variables: { ...s.startVariables },
868
- inventory: [...s.startInventory],
865
+ const [E, w] = T(c > 0 ? "splash" : "title"), [S, u] = T(!1), [h, $] = T(!1), [M, q] = T("title"), [Y, W] = T(null), [R, I] = T(null), l = Ne(
866
+ d === !1 ? { enabled: !1 } : d
867
+ ), p = localStorage.getItem(v) !== null, N = j(() => {
868
+ const g = {
869
+ currentLocation: t.startLocation,
870
+ currentTime: { ...t.startTime },
871
+ flags: { ...t.startFlags },
872
+ variables: { ...t.startVariables },
873
+ inventory: [...t.startInventory],
869
874
  questProgress: {},
870
875
  unlockedJournalEntries: [],
871
876
  playerNotes: [],
@@ -878,42 +883,42 @@ function Me({
878
883
  pendingVideo: null,
879
884
  currentLocale: "en"
880
885
  };
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]);
886
+ return new ue(n, g);
887
+ }, [n, t]), A = j(() => {
888
+ l.playClick();
889
+ const g = N(), s = g.newGame(t);
890
+ I({ engine: g, snapshot: s }), w("playing");
891
+ }, [N, t, l]), V = j(() => {
892
+ l.playClick();
893
+ const g = localStorage.getItem(v);
894
+ if (!g) return;
895
+ const s = JSON.parse(g), i = N(), f = i.loadGame(s);
896
+ I({ engine: i, snapshot: f }), w("playing");
897
+ }, [N, v, l]), G = j(() => {
898
+ if (!R) return;
899
+ l.playClick();
900
+ const g = R.engine.saveGame();
901
+ localStorage.setItem(v, JSON.stringify(g)), u(!1);
902
+ }, [R, v, l]), O = j(() => {
903
+ const g = localStorage.getItem(v);
904
+ if (!g || !R) return;
905
+ l.playClick();
906
+ const s = JSON.parse(g), i = R.engine.loadGame(s);
907
+ I({ engine: R.engine, snapshot: i }), u(!1);
908
+ }, [R, v, l]), P = j(() => {
909
+ l.playClick(), u(!1), $(!1), I(null), w("title");
910
+ }, [l]), D = j((g) => {
911
+ l.playMenuOpen(), q(g), $(!0), g === "pause" && u(!1);
912
+ }, [l]), F = j(() => {
913
+ l.playMenuClose(), $(!1), M === "pause" && u(!0);
914
+ }, [M, l]);
910
915
  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)));
916
+ if (E !== "playing") return;
917
+ const g = (s) => {
918
+ s.key === "Escape" && (s.preventDefault(), h ? F() : (S ? l.playMenuClose() : l.playMenuOpen(), u((i) => !i)));
914
919
  };
915
- return window.addEventListener("keydown", b), () => window.removeEventListener("keydown", b);
916
- }, [T, w, u, I, p]);
920
+ return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
921
+ }, [E, S, h, F, l]);
917
922
  const X = {
918
923
  setMasterVolume: () => {
919
924
  },
@@ -926,141 +931,148 @@ function Me({
926
931
  stopAll: () => {
927
932
  }
928
933
  };
929
- return T === "splash" ? /* @__PURE__ */ e.jsx("div", { className: `game-shell ${R}`, children: /* @__PURE__ */ e.jsx(
930
- Ce,
934
+ return E === "splash" ? /* @__PURE__ */ e.jsx("div", { className: `game-shell ${_}`, children: /* @__PURE__ */ e.jsx(
935
+ Re,
931
936
  {
932
- logoSrc: l,
937
+ logoSrc: o,
933
938
  title: r,
934
- onComplete: () => E("title"),
935
- duration: o
939
+ onComplete: () => w("title"),
940
+ duration: c
936
941
  }
937
- ) }) : T === "title" ? /* @__PURE__ */ e.jsx("div", { className: `game-shell ${R}`, children: u ? /* @__PURE__ */ e.jsx(
942
+ ) }) : E === "title" ? /* @__PURE__ */ e.jsx("div", { className: `game-shell ${_}`, children: h ? /* @__PURE__ */ e.jsx(
938
943
  oe,
939
944
  {
940
945
  audioControls: X,
941
- uiSoundControls: m !== !1 ? p : void 0,
942
- availableLocales: g,
943
- onBack: I
946
+ uiSoundControls: d !== !1 ? l : void 0,
947
+ availableLocales: b,
948
+ onBack: F
944
949
  }
945
950
  ) : /* @__PURE__ */ e.jsx(
946
- Re,
951
+ Ae,
947
952
  {
948
953
  title: r,
949
954
  subtitle: a,
950
- logoSrc: l,
951
- hasSaveData: d,
952
- onNewGame: y,
953
- onContinue: O,
954
- onSettings: () => P("title")
955
+ logoSrc: o,
956
+ hasSaveData: p,
957
+ onNewGame: A,
958
+ onContinue: V,
959
+ onSettings: () => D("title")
955
960
  }
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,
961
+ ) }) : R ? /* @__PURE__ */ e.jsx("div", { className: `game-shell ${_}`, children: /* @__PURE__ */ e.jsx(xe, { engine: R.engine, initialSnapshot: R.snapshot, devTools: C, children: /* @__PURE__ */ e.jsx(
962
+ $e,
958
963
  {
959
- audioOptions: h,
960
- uiSoundControls: m !== !1 ? p : void 0,
961
- showPauseMenu: w,
962
- showSettings: u,
963
- availableLocales: g,
964
+ audioOptions: m,
965
+ uiSoundControls: d !== !1 ? l : void 0,
966
+ showPauseMenu: S,
967
+ showSettings: h,
968
+ availableLocales: b,
964
969
  videoBasePath: x,
965
- pendingVideo: W,
966
- setPendingVideo: J,
970
+ pendingVideo: Y,
971
+ setPendingVideo: W,
967
972
  onPause: () => {
968
- p.playMenuOpen(), i(!0);
973
+ l.playMenuOpen(), u(!0);
969
974
  },
970
975
  onResume: () => {
971
- p.playMenuClose(), i(!1);
976
+ l.playMenuClose(), u(!1);
972
977
  },
973
- onSave: M,
974
- onLoad: Y,
975
- onSettings: () => P("pause"),
976
- onQuitToTitle: $,
977
- onCloseSettings: I
978
+ onSave: G,
979
+ onLoad: O,
980
+ onSettings: () => D("pause"),
981
+ onQuitToTitle: P,
982
+ onCloseSettings: F
978
983
  }
979
984
  ) }) }) : null;
980
985
  }
981
- function Pe({
986
+ function $e({
982
987
  audioOptions: n,
983
- uiSoundControls: s,
988
+ uiSoundControls: t,
984
989
  showPauseMenu: r,
985
990
  showSettings: a,
986
- availableLocales: l,
987
- videoBasePath: o,
988
- pendingVideo: m,
989
- setPendingVideo: h,
990
- onPause: f,
991
- onResume: g,
991
+ availableLocales: o,
992
+ videoBasePath: c,
993
+ pendingVideo: d,
994
+ setPendingVideo: m,
995
+ onPause: v,
996
+ onResume: b,
992
997
  onSave: x,
993
- onLoad: R,
994
- onSettings: T,
998
+ onLoad: _,
999
+ onSettings: C,
995
1000
  onQuitToTitle: E,
996
1001
  onCloseSettings: w
997
1002
  }) {
998
- const { snapshot: i, actions: u } = re(), _ = le(i, n);
1003
+ const { snapshot: S, actions: u } = re(), h = le(S, n);
999
1004
  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,
1005
+ S.pendingVideo && m(S.pendingVideo);
1006
+ }, [S.pendingVideo, m]), /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1007
+ d && /* @__PURE__ */ e.jsx(
1008
+ Pe,
1004
1009
  {
1005
- src: m,
1006
- basePath: o,
1007
- onComplete: () => h(null)
1010
+ src: d,
1011
+ basePath: c,
1012
+ onComplete: () => m(null)
1008
1013
  }
1009
1014
  ),
1010
- /* @__PURE__ */ e.jsx(_e, {}),
1011
- !r && !a && !m && /* @__PURE__ */ e.jsx(
1015
+ /* @__PURE__ */ e.jsx(Ce, {}),
1016
+ !r && !a && !d && /* @__PURE__ */ e.jsx(
1012
1017
  "button",
1013
1018
  {
1014
1019
  className: "game-shell-menu-button",
1015
- onClick: f,
1020
+ onClick: v,
1016
1021
  "aria-label": "Menu",
1017
1022
  children: "Menu"
1018
1023
  }
1019
1024
  ),
1020
1025
  r && /* @__PURE__ */ e.jsx(
1021
- Ae,
1026
+ Oe,
1022
1027
  {
1023
- onResume: g,
1028
+ onResume: b,
1024
1029
  onSave: x,
1025
- onLoad: R,
1026
- onSettings: T,
1030
+ onLoad: _,
1031
+ onSettings: C,
1027
1032
  onQuitToTitle: E
1028
1033
  }
1029
1034
  ),
1030
1035
  a && /* @__PURE__ */ e.jsx(
1031
1036
  oe,
1032
1037
  {
1033
- audioControls: _,
1034
- uiSoundControls: s,
1035
- availableLocales: l,
1036
- currentLocale: (i.time, void 0),
1038
+ audioControls: h,
1039
+ uiSoundControls: t,
1040
+ availableLocales: o,
1041
+ currentLocale: (S.time, void 0),
1037
1042
  onLocaleChange: u.setLocale,
1038
1043
  onBack: w
1039
1044
  }
1040
1045
  )
1041
1046
  ] });
1042
1047
  }
1048
+ function Le({ message: n = "Loading...", className: t = "" }) {
1049
+ return /* @__PURE__ */ e.jsx("div", { className: `loading-screen ${t}`, children: /* @__PURE__ */ e.jsxs("div", { className: "loading-screen-content", children: [
1050
+ /* @__PURE__ */ e.jsx("div", { className: "loading-screen-spinner" }),
1051
+ /* @__PURE__ */ e.jsx("p", { className: "loading-screen-message", children: n })
1052
+ ] }) });
1053
+ }
1043
1054
  export {
1044
- Se as CharacterList,
1055
+ ke as CharacterList,
1045
1056
  be as ChoiceList,
1046
- Ne as DialogueBox,
1057
+ ge as DialogueBox,
1047
1058
  ae as GameContext,
1048
- fe as GameProvider,
1049
- _e as GameRenderer,
1050
- Me as GameShell,
1051
- ke as Inventory,
1052
- ye as Journal,
1053
- ge as LocationView,
1054
- Ee as MapView,
1059
+ xe as GameProvider,
1060
+ Ce as GameRenderer,
1061
+ Ie as GameShell,
1062
+ ye as Inventory,
1063
+ Ee as Journal,
1064
+ Le as LoadingScreen,
1065
+ Se as LocationView,
1066
+ we as MapView,
1055
1067
  Te as NotificationArea,
1056
- Ae as PauseMenu,
1057
- we as SaveLoadPanel,
1068
+ Oe as PauseMenu,
1069
+ _e as SaveLoadPanel,
1058
1070
  oe as SettingsPanel,
1059
- Ce as SplashScreen,
1060
- Re as TitleScreen,
1061
- De as VERSION,
1062
- Oe as VideoPlayer,
1071
+ Re as SplashScreen,
1072
+ Ae as TitleScreen,
1073
+ Fe as VERSION,
1074
+ Pe as VideoPlayer,
1063
1075
  le as useAudioManager,
1064
1076
  re as useGame,
1065
- je as useUISounds
1077
+ Ne as useUISounds
1066
1078
  };