@puzzmo/sdk 1.0.68 → 1.0.70

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/index.js CHANGED
@@ -70,8 +70,9 @@ var s = (e) => {
70
70
  };
71
71
  }();
72
72
  const l = (e) => {
73
- let t = {
74
- context: e,
73
+ var n;
74
+ let r = {
75
+ context: t(t({}, e), {}, { deviceType: (n = e.deviceType) == null ? u() : n }),
75
76
  updateCount: 0,
76
77
  startTime: /* @__PURE__ */ new Date(),
77
78
  tracked: {
@@ -82,31 +83,49 @@ const l = (e) => {
82
83
  }
83
84
  };
84
85
  return {
85
- trackEvent: (e, n) => {
86
- let r = ((/* @__PURE__ */ new Date()).getTime() - t.startTime.getTime()) / 1e3;
86
+ trackEvent: (e, t) => {
87
+ let n = ((/* @__PURE__ */ new Date()).getTime() - r.startTime.getTime()) / 1e3;
87
88
  switch (e) {
88
89
  case "READY_GAME_LOADED":
89
- t.tracked.pageView || (c(t.context, "page_view"), t.tracked.pageView = !0);
90
+ r.tracked.pageView || (c(r.context, "page_view"), r.tracked.pageView = !0);
90
91
  break;
91
92
  case "UPLOAD_NEW_GAME_STATE":
92
- t.updateCount++, t.updateCount > 2 && !t.tracked.gameplayActive && (c(t.context, "gameplay_active"), t.tracked.gameplayActive = !0), r > 30 && (t.tracked.gameplayActive || (c(t.context, "gameplay_active"), t.tracked.gameplayActive = !0), t.tracked.active30s || (c(t.context, "active_30s"), t.tracked.active30s = !0));
93
+ r.updateCount++, r.updateCount > 2 && !r.tracked.gameplayActive && (c(r.context, "gameplay_active"), r.tracked.gameplayActive = !0), n > 30 && (r.tracked.gameplayActive || (c(r.context, "gameplay_active"), r.tracked.gameplayActive = !0), r.tracked.active30s || (c(r.context, "active_30s"), r.tracked.active30s = !0));
93
94
  break;
94
95
  case "GAME_COMPLETED":
95
- !t.tracked.completed && n != null && n.input && (c(t.context, "completed", {}, n.input.elapsedTimeSecs), t.tracked.completed = !0);
96
+ !r.tracked.completed && t != null && t.input && (c(r.context, "completed", {}, t.input.elapsedTimeSecs), r.tracked.completed = !0);
96
97
  break;
97
98
  }
98
99
  },
99
100
  trackLinkClick: (e) => {
100
- c(t.context, "link_click", e);
101
+ c(r.context, "link_click", e);
101
102
  }
102
103
  };
103
- }, u = (e) => {
104
- if (!g(e)) return null;
105
- let t = f();
104
+ };
105
+ /**
106
+ * The kind of device the game runs on, judged by the whole device rather than the game's frame. A copy of
107
+ * detectDeviceType in @puzzmo-com/clickhouse/deviceType, kept dependency-free for the published SDK.
108
+ */
109
+ var u = () => {
110
+ var e, t, n;
111
+ if (typeof navigator > "u" || typeof window > "u") return "unknown";
112
+ let r = navigator.userAgent;
113
+ if (/iPad/.test(r) || /Macintosh/.test(r) && navigator.maxTouchPoints > 1) return "tablet";
114
+ let i = (e = navigator.userAgentData) == null ? void 0 : e.mobile;
115
+ return /iPhone|iPod/.test(r) || i ? "mobile" : /Android/.test(r) ? /Mobile/.test(r) ? "mobile" : "tablet" : /Mobile|Windows Phone/.test(r) ? "mobile" : (t = (n = window).matchMedia) != null && t.call(n, "(pointer: coarse)").matches ? Math.min(screen.width, screen.height) < 600 ? "mobile" : "tablet" : "desktop";
116
+ };
117
+ /**
118
+ * Build the analytics tracker for a game, or null when analytics shouldn't run
119
+ * (the game doesn't bring its own runtime, no browser, running on localhost, or
120
+ * missing bootstrap data).
121
+ */
122
+ const d = (e) => {
123
+ if (!_(e)) return null;
124
+ let t = p();
106
125
  if (!t.enabled) return null;
107
- let n = p(e, t.apiRoot);
126
+ let n = m(e, t.apiRoot);
108
127
  return n ? l(n) : null;
109
- }, d = (e) => {
128
+ }, f = (e) => {
110
129
  if (typeof document > "u") return () => {};
111
130
  let t = (t) => {
112
131
  var n, r;
@@ -122,7 +141,7 @@ const l = (e) => {
122
141
  return document.addEventListener("click", t), () => document.removeEventListener("click", t);
123
142
  };
124
143
  /** Picks the events endpoint, and disables analytics entirely on localhost (dev + simulator). */
125
- var f = () => {
144
+ var p = () => {
126
145
  if (typeof window > "u" || !window.location) return {
127
146
  apiRoot: "",
128
147
  enabled: !1
@@ -135,37 +154,42 @@ var f = () => {
135
154
  apiRoot: e.includes("staging") ? "https://api-staging.puzzmo.com/" : "https://api.puzzmo.com/",
136
155
  enabled: !0
137
156
  };
138
- }, p = (e, t) => {
139
- var n, r, i, a, o, s, c, l, u;
140
- let d = e == null ? void 0 : e.session;
141
- if (!d) return null;
142
- let f = d.gameplay, p = d.puzzle, h = (n = e == null ? void 0 : e.hostContext) == null ? [] : n;
157
+ };
158
+ /** Derive the analytics context from the host's bootstrap data, or null if a game isn't present. */
159
+ const m = (e, t) => {
160
+ var n, r, i, a, o, s, c, l;
161
+ let u = e == null ? void 0 : e.session;
162
+ if (!u) return null;
163
+ let d = u.gameplay, f = u.puzzle, p = (n = e == null ? void 0 : e.hostContext) == null ? [] : n, m = p.find((e) => (e == null ? void 0 : e.type) === "embed");
143
164
  return {
144
165
  gameSlug: (e == null || (r = e.game) == null ? void 0 : r.slug) || "unknown",
145
- puzzleID: p.id,
146
- gameplayOwnerID: f.ownerID || (e == null || (i = e.userState) == null ? void 0 : i.id) || "unknown",
166
+ puzzleID: f.id,
167
+ gameplayOwnerID: d.ownerID || (e == null || (i = e.userState) == null ? void 0 : i.id) || "unknown",
147
168
  apiRoot: t,
148
- userType: m(e == null || (a = e.currentUser) == null ? void 0 : a.type),
149
- runtimeType: _(h),
169
+ userType: h(e == null || (a = e.currentUser) == null ? void 0 : a.type),
170
+ runtimeType: v(p),
150
171
  userID: e == null || (o = e.currentUser) == null ? void 0 : o.id,
151
- teamSlug: ((s = p.team) == null ? void 0 : s.slug) || void 0,
152
- partnerSlug: ((c = h.find((e) => (e == null ? void 0 : e.type) === "embed")) == null || (c = c.partner) == null ? void 0 : c.slug) || void 0,
153
- dailyDateKey: (l = p.mostRecentDaily) == null || (l = l.daily) == null ? void 0 : l.dateKey,
154
- embedID: ((u = h.find((e) => (e == null ? void 0 : e.type) === "embed")) == null ? void 0 : u.embedID) || void 0
172
+ teamSlug: ((s = f.team) == null ? void 0 : s.slug) || void 0,
173
+ partnerSlug: (m == null || (c = m.partner) == null ? void 0 : c.slug) || (e == null ? void 0 : e.partnerSlug) || void 0,
174
+ dailyDateKey: (l = f.mostRecentDaily) == null || (l = l.daily) == null ? void 0 : l.dateKey,
175
+ embedID: (m == null ? void 0 : m.embedID) || void 0
155
176
  };
156
- }, m = (e) => !e || e === "Unverified" ? "anon" : e === "Paid" ? "paid" : "user", h = 512, g = (e) => {
177
+ };
178
+ /** Map the user's subscription tier to the analytics user bucket. */
179
+ var h = (e) => !e || e === "Unverified" ? "anon" : e === "Paid" ? "paid" : "user", g = 512, _ = (e) => {
157
180
  var t, n;
158
- return (((t = e == null || (n = e.game) == null ? void 0 : n.version.flagsArr[0]) == null ? 0 : t) & h) === h;
159
- }, _ = (e) => {
160
- if (e.find((e) => (e == null ? void 0 : e.type) === "embed")) return "iframe";
161
- let t = e.find((e) => (e == null ? void 0 : e.type) === "app");
162
- return (t == null ? void 0 : t.host) === "__embed" ? "simple_embed" : (t == null ? void 0 : t.host) === "app-embed" ? "app_embed" : (t == null ? void 0 : t.host) === "ios-app" ? "ios_native" : "puzzmo_com";
163
- }, v = ["inputString"];
164
- function y(e) {
181
+ return (((t = e == null || (n = e.game) == null ? void 0 : n.version.flagsArr[0]) == null ? 0 : t) & g) === g;
182
+ }, v = (e) => {
183
+ let t = e.find((e) => (e == null ? void 0 : e.type) === "embed");
184
+ if (t) return t.host === "msn" ? "msn" : "iframe";
185
+ let n = e.find((e) => (e == null ? void 0 : e.type) === "app");
186
+ return (n == null ? void 0 : n.host) === "__embed" ? "simple_embed" : (n == null ? void 0 : n.host) === "app-embed" ? "app_embed" : (n == null ? void 0 : n.host) === "ios-app" ? "ios_native" : "puzzmo_com";
187
+ }, y = ["inputString"];
188
+ function b(e) {
165
189
  let t = e >= 3600 * 1e3;
166
190
  return new Date(e).toISOString().slice(t ? 11 : 14, -1).split(".")[0];
167
191
  }
168
- function b(e = 0, t = 0) {
192
+ function x(e = 0, t = 0) {
169
193
  let n = e, r = t, i = 0, a, o, s, c = () => {
170
194
  var e;
171
195
  if (o === void 0) return n + r;
@@ -212,11 +236,11 @@ function b(e = 0, t = 0) {
212
236
  isRunning: () => o !== void 0 && s === void 0,
213
237
  display: () => {
214
238
  let e = c() - r;
215
- return [y(Math.max(0, e)), r === 0 ? "" : y(r)];
239
+ return [b(Math.max(0, e)), r === 0 ? "" : b(r)];
216
240
  }
217
241
  };
218
242
  }
219
- function x() {
243
+ function S() {
220
244
  let e = /* @__PURE__ */ new Map();
221
245
  return typeof window < "u" && window.addEventListener("message", (t) => {
222
246
  var n;
@@ -250,9 +274,9 @@ function x() {
250
274
  * Stays "1.0" until every host supporting "1.1" is deployed: an older puzzmo.com reloads when it
251
275
  * sees a contract it doesn't know.
252
276
  */
253
- var S = "1.0", C = x();
277
+ var C = "1.0", w = S();
254
278
  /** Creates a Puzzmo SDK instance for communicating with the Puzzmo host */
255
- const w = (r = {}) => {
279
+ const T = (r = {}) => {
256
280
  var i;
257
281
  let a = null, s = null, c = () => {
258
282
  var e;
@@ -260,7 +284,7 @@ const w = (r = {}) => {
260
284
  }, l = () => {
261
285
  var e, t;
262
286
  return (e = (t = c()) == null ? void 0 : t.id) == null ? null : e;
263
- }, f = () => {
287
+ }, u = () => {
264
288
  var e, t;
265
289
  return (e = a == null || (t = a.session) == null ? void 0 : t.puzzle.puzzle) == null ? null : e;
266
290
  }, p = () => {
@@ -272,15 +296,15 @@ const w = (r = {}) => {
272
296
  }, h = () => {
273
297
  var e, t;
274
298
  return (e = (t = c()) == null ? void 0 : t.completed) == null ? !1 : e;
275
- }, g = /* @__PURE__ */ new Map(), _ = null, y = null, x = !1, w = (e, t) => {
276
- x || y == null || y.trackEvent(e, t);
277
- }, E = b(), D = null, O = null, k = () => {
299
+ }, g = /* @__PURE__ */ new Map(), _ = null, v = null, b = !1, S = (e, t) => {
300
+ b || v == null || v.trackEvent(e, t);
301
+ }, T = x(), D = null, O = null, k = () => {
278
302
  D || (D = setInterval(() => {
279
- if (E.isPaused()) return;
280
- let [e, t] = E.display();
281
- C.sendMessage("TIMER_TICK", { display: [e, t] });
303
+ if (T.isPaused()) return;
304
+ let [e, t] = T.display();
305
+ w.sendMessage("TIMER_TICK", { display: [e, t] });
282
306
  }, 500), O = setInterval(() => {
283
- E.isPaused() || C.sendMessage("TIMER_SYNC", Math.floor(E.timeWithoutPenaltySecs()));
307
+ T.isPaused() || w.sendMessage("TIMER_SYNC", Math.floor(T.timeWithoutPenaltySecs()));
284
308
  }, 1e4));
285
309
  }, A = () => {
286
310
  D && (clearInterval(D), D = null), O && (clearInterval(O), O = null);
@@ -288,21 +312,21 @@ const w = (r = {}) => {
288
312
  let n = g.get(e);
289
313
  n && n.forEach((e) => e(t));
290
314
  };
291
- C.onMessage("START_GAME", () => {
292
- E._init(), k(), j("start");
315
+ w.onMessage("START_GAME", () => {
316
+ T._init(), k(), j("start");
293
317
  });
294
318
  let M = () => {
295
- let e = E.isPaused();
296
- E._pause(), E.isPaused() !== e && j("pause");
319
+ let e = T.isPaused();
320
+ T._pause(), T.isPaused() !== e && j("pause");
297
321
  }, N = () => {
298
- let e = E.isPaused();
299
- E._resume(), E.isPaused() !== e && j("resume");
322
+ let e = T.isPaused();
323
+ T._resume(), T.isPaused() !== e && j("resume");
300
324
  };
301
- C.onMessage("PAUSE_GAME", M), C.onMessage("RESUME_GAME", N), C.onMessage("SETTINGS_UPDATE", (e) => {
325
+ w.onMessage("PAUSE_GAME", M), w.onMessage("RESUME_GAME", N), w.onMessage("SETTINGS_UPDATE", (e) => {
302
326
  _ = t(t({}, _), e), j("settingsUpdate", _);
303
- }), C.onMessage("KEYBOARD_KEY_PRESS", (e) => j("keyboardKeyPress", e)), C.onMessage("KEYBOARD_CURSOR_CHANGE", (e) => j("keyboardCursorChange", e)), C.onMessage("KEYBOARD_CURSOR_END", () => j("keyboardCursorEnd")), C.onMessage("RETRY_PUZZLE", () => {
304
- E._reset(), A(), j("retry");
305
- }), C.onMessage("READY_DATA", (e) => {
327
+ }), w.onMessage("KEYBOARD_KEY_PRESS", (e) => j("keyboardKeyPress", e)), w.onMessage("KEYBOARD_CURSOR_CHANGE", (e) => j("keyboardCursorChange", e)), w.onMessage("KEYBOARD_CURSOR_END", () => j("keyboardCursorEnd")), w.onMessage("RETRY_PUZZLE", () => {
328
+ T._reset(), A(), j("retry");
329
+ }), w.onMessage("READY_DATA", (e) => {
306
330
  var t;
307
331
  let n = o(e);
308
332
  a = n;
@@ -318,32 +342,32 @@ const w = (r = {}) => {
318
342
  _ = (c = t) == null ? {} : c;
319
343
  }
320
344
  if (r) {
321
- var l, f;
322
- let e = ((l = r.elapsedTimeSecs) == null ? 0 : l) * 1e3, t = ((f = r.additionalTimeAddedSecs) == null ? 0 : f) * 1e3;
323
- E._reset(e, t);
345
+ var l, u;
346
+ let e = ((l = r.elapsedTimeSecs) == null ? 0 : l) * 1e3, t = ((u = r.additionalTimeAddedSecs) == null ? 0 : u) * 1e3;
347
+ T._reset(e, t);
324
348
  }
325
- if (!y) {
349
+ if (!v) {
326
350
  var p;
327
- y = u(n), x = (p = r == null ? void 0 : r.completed) == null ? !1 : p, y && d((e) => y.trackLinkClick(e));
351
+ v = d(n), b = (p = r == null ? void 0 : r.completed) == null ? !1 : p, v && f((e) => v.trackLinkClick(e));
328
352
  }
329
353
  s && (s(n), s = null);
330
354
  });
331
355
  let P = {
332
- timeMs: () => E.timeMs(),
333
- timeSecs: () => E.timeSecs(),
334
- addedTimeMs: () => E.addedTimeMs(),
335
- addedTimeSecs: () => E.addedTimeSecs(),
336
- timeWithoutPenaltySecs: () => E.timeWithoutPenaltySecs(),
337
- display: () => E.display(),
338
- addPenalty: (e) => E.addPenalty(e),
339
- setPenalty: (e) => E.setPenalty(e),
340
- isPaused: () => E.isPaused(),
341
- isRunning: () => E.isRunning(),
356
+ timeMs: () => T.timeMs(),
357
+ timeSecs: () => T.timeSecs(),
358
+ addedTimeMs: () => T.addedTimeMs(),
359
+ addedTimeSecs: () => T.addedTimeSecs(),
360
+ timeWithoutPenaltySecs: () => T.timeWithoutPenaltySecs(),
361
+ display: () => T.display(),
362
+ addPenalty: (e) => T.addPenalty(e),
363
+ setPenalty: (e) => T.setPenalty(e),
364
+ isPaused: () => T.isPaused(),
365
+ isRunning: () => T.isRunning(),
342
366
  pause: M,
343
367
  resume: N
344
368
  }, F = {
345
- send: (e, t) => C.sendMessage(e, t),
346
- on: (e, t) => C.onMessage(e, t),
369
+ send: (e, t) => w.sendMessage(e, t),
370
+ on: (e, t) => w.onMessage(e, t),
347
371
  timer: P,
348
372
  bootstrap: () => a
349
373
  }, I = {};
@@ -354,10 +378,10 @@ const w = (r = {}) => {
354
378
  gameReady: function() {
355
379
  var e = n(function* () {
356
380
  var e;
357
- if (C.sendMessage("READY", { runtimeContract: S }), f()) {
381
+ if (w.sendMessage("READY", { runtimeContract: C }), u()) {
358
382
  let e = p();
359
383
  return {
360
- puzzleString: f(),
384
+ puzzleString: u(),
361
385
  inputString: e,
362
386
  boardState: e,
363
387
  theme: m(),
@@ -371,7 +395,7 @@ const w = (r = {}) => {
371
395
  s && (s = null, n(/* @__PURE__ */ Error(`Timeout waiting for READY_DATA after ${t}ms`)));
372
396
  }, t);
373
397
  });
374
- let n = f();
398
+ let n = u();
375
399
  if (!n) throw Error("READY_DATA received but no puzzle data found");
376
400
  let i = p();
377
401
  return {
@@ -388,11 +412,11 @@ const w = (r = {}) => {
388
412
  };
389
413
  }(),
390
414
  gameLoaded: (e = {}) => {
391
- C.sendMessage("READY_GAME_LOADED", {
415
+ w.sendMessage("READY_GAME_LOADED", {
392
416
  state: e,
393
- gameRuntimeContract: S,
417
+ gameRuntimeContract: C,
394
418
  embedRuntimeContract: "1.0"
395
- }), w("READY_GAME_LOADED");
419
+ }), S("READY_GAME_LOADED");
396
420
  },
397
421
  on: (e, t) => (g.has(e) || g.set(e, /* @__PURE__ */ new Set()), g.get(e).add(t), () => {
398
422
  var n;
@@ -405,23 +429,23 @@ const w = (r = {}) => {
405
429
  updateGameState: (e, t) => {
406
430
  var n, r;
407
431
  let i = l();
408
- i && (C.sendMessage("UPLOAD_NEW_GAME_STATE", {
432
+ i && (w.sendMessage("UPLOAD_NEW_GAME_STATE", {
409
433
  id: i,
410
434
  input: {
411
435
  boardState: e,
412
- elapsedTimeSecs: (n = t == null ? void 0 : t.elapsedTimeSecs) == null ? E.timeWithoutPenaltySecs() : n,
413
- additionalTimeAddedSecs: (r = t == null ? void 0 : t.additionalTimeAddedSecs) == null ? E.addedTimeSecs() : r,
436
+ elapsedTimeSecs: (n = t == null ? void 0 : t.elapsedTimeSecs) == null ? T.timeWithoutPenaltySecs() : n,
437
+ additionalTimeAddedSecs: (r = t == null ? void 0 : t.additionalTimeAddedSecs) == null ? T.addedTimeSecs() : r,
414
438
  collabUserReferences: []
415
439
  }
416
- }), w("UPLOAD_NEW_GAME_STATE"));
440
+ }), S("UPLOAD_NEW_GAME_STATE"));
417
441
  },
418
442
  gameCompleted: (n, r) => {
419
443
  var i, a, o, s, c;
420
- E._conclude(), A();
421
- let { inputString: u } = n, d = t(t({}, e(n, v)), {}, {
444
+ T._conclude(), A();
445
+ let { inputString: u } = n, d = t(t({}, e(n, y)), {}, {
422
446
  boardState: u == null ? n.boardState : u,
423
- elapsedTimeSecs: (i = n.elapsedTimeSecs) == null ? E.timeWithoutPenaltySecs() : i,
424
- additionalTimeAddedSecs: (a = n.additionalTimeAddedSecs) == null ? E.addedTimeSecs() : a
447
+ elapsedTimeSecs: (i = n.elapsedTimeSecs) == null ? T.timeWithoutPenaltySecs() : i,
448
+ additionalTimeAddedSecs: (a = n.additionalTimeAddedSecs) == null ? T.addedTimeSecs() : a
425
449
  }), f = (o = r == null ? void 0 : r.deeds) == null ? [] : o;
426
450
  f.push({
427
451
  id: "points",
@@ -431,14 +455,14 @@ const w = (r = {}) => {
431
455
  value: Math.round((s = d.elapsedTimeSecs) == null ? 0 : s) + Math.round((c = d.additionalTimeAddedSecs) == null ? 0 : c)
432
456
  });
433
457
  let p = l();
434
- p && (C.sendMessage("GAME_COMPLETED", {
458
+ p && (w.sendMessage("GAME_COMPLETED", {
435
459
  id: p,
436
460
  input: d,
437
461
  config: r
438
- }), w("GAME_COMPLETED", { input: d }));
462
+ }), S("GAME_COMPLETED", { input: d }));
439
463
  },
440
464
  showCompletionScreen: (e) => {
441
- C.sendMessage("SHOW_GAME_COMPLETE_SCREEN", {
465
+ w.sendMessage("SHOW_GAME_COMPLETE_SCREEN", {
442
466
  results: e,
443
467
  showRetry: !0
444
468
  });
@@ -447,10 +471,10 @@ const w = (r = {}) => {
447
471
  var r;
448
472
  if (!l()) return;
449
473
  let i = (r = p()) == null ? "" : r, a = {
450
- elapsedTimeSecs: E.timeWithoutPenaltySecs(),
451
- additionalTimeAddedSecs: E.addedTimeSecs()
474
+ elapsedTimeSecs: T.timeWithoutPenaltySecs(),
475
+ additionalTimeAddedSecs: T.addedTimeSecs()
452
476
  };
453
- C.sendMessage("HIT_CHECKPOINT", {
477
+ w.sendMessage("HIT_CHECKPOINT", {
454
478
  checkpointName: e,
455
479
  gameplay: {
456
480
  inputStr: i,
@@ -461,7 +485,7 @@ const w = (r = {}) => {
461
485
  });
462
486
  },
463
487
  settings: {
464
- initialize: (e) => (_ = t(t({}, T(e)), _), C.sendMessage("INITIALIZE_SETTINGS", {
488
+ initialize: (e) => (_ = t(t({}, E(e)), _), w.sendMessage("INITIALIZE_SETTINGS", {
465
489
  components: e,
466
490
  settings: _
467
491
  }), _),
@@ -469,14 +493,14 @@ const w = (r = {}) => {
469
493
  var e;
470
494
  return (e = _) == null ? {} : e;
471
495
  },
472
- update: (e) => (_ = t(t({}, _), e), C.sendMessage("UPDATE_SETTINGS_FROM_EMBED", { settings: _ }), _)
496
+ update: (e) => (_ = t(t({}, _), e), w.sendMessage("UPDATE_SETTINGS_FROM_EMBED", { settings: _ }), _)
473
497
  },
474
498
  keyboard: {
475
499
  show: (e) => {
476
- C.sendMessage("KEYBOARD_UPDATE_CONFIG", e);
500
+ w.sendMessage("KEYBOARD_UPDATE_CONFIG", e);
477
501
  },
478
502
  hide: () => {
479
- C.sendMessage("KEYBOARD_UPDATE_CONFIG", {
503
+ w.sendMessage("KEYBOARD_UPDATE_CONFIG", {
480
504
  layout: [],
481
505
  symbols: {},
482
506
  highlight: [],
@@ -489,18 +513,18 @@ const w = (r = {}) => {
489
513
  },
490
514
  haptics: { play: (e, t) => {
491
515
  var n;
492
- C.sendMessage("SENSORY_EVENT", {
516
+ w.sendMessage("SENSORY_EVENT", {
493
517
  id: (n = t == null ? void 0 : t.id) == null ? e : n,
494
518
  haptic: e
495
519
  });
496
520
  } },
497
- _hostAPI: C
521
+ _hostAPI: w
498
522
  };
499
523
  };
500
524
  /** Walks settings UI components (recursing into split groups) collecting name → defaultValue pairs */
501
- function T(e) {
525
+ function E(e) {
502
526
  let t = {};
503
- for (let n of e) n.type === "split" ? Object.assign(t, T(n.content)) : "name" in n && (t[n.name] = n.defaultValue);
527
+ for (let n of e) n.type === "split" ? Object.assign(t, E(n.content)) : "name" in n && (t[n.name] = n.defaultValue);
504
528
  return t;
505
529
  }
506
530
  /**
@@ -515,7 +539,7 @@ function T(e) {
515
539
  * // Extend with dynamic disabled letters
516
540
  * sdk.keyboard.show({ ...defaultKeyboardConfig, disabled: usedLetters })
517
541
  */
518
- const E = {
542
+ const D = {
519
543
  layout: [
520
544
  "qwertyuiop",
521
545
  "asdfghjkl",
@@ -531,7 +555,7 @@ const E = {
531
555
  xl: [],
532
556
  l: ["↵", "⌫"],
533
557
  supportsDragCursor: !1
534
- }, D = (e) => {
558
+ }, O = (e) => {
535
559
  let n = {};
536
560
  for (let a of e) for (let e of a.keys) {
537
561
  var r, i;
@@ -541,11 +565,11 @@ const E = {
541
565
  return n;
542
566
  };
543
567
  /** Custom error class for workshop import failures */
544
- var O = class extends Error {
568
+ var k = class extends Error {
545
569
  constructor(e, t, n) {
546
570
  super(t), this.type = e, this.originalError = n, this.name = "EditorImportError";
547
571
  }
548
572
  };
549
- export { O as EditorImportError, w as createPuzzmoSDK, E as defaultKeyboardConfig, D as keyStylesFromRules };
573
+ export { k as EditorImportError, T as createPuzzmoSDK, D as defaultKeyboardConfig, O as keyStylesFromRules };
550
574
 
551
575
  //# sourceMappingURL=index.js.map