@virtualdisplay.io/client 4.0.0-alpha.15 → 4.0.0-alpha.17

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.
Files changed (84) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/index.d.ts +1096 -0
  3. package/dist/virtualdisplay.client.cjs.js +6 -6
  4. package/dist/virtualdisplay.client.es.js +238 -217
  5. package/dist/virtualdisplay.client.umd.js +9 -9
  6. package/package.json +3 -3
  7. package/dist/src/annotations/annotations.d.ts +0 -20
  8. package/dist/src/annotations/annotations.d.ts.map +0 -1
  9. package/dist/src/annotations/index.d.ts +0 -2
  10. package/dist/src/annotations/index.d.ts.map +0 -1
  11. package/dist/src/attributes/attribute.d.ts +0 -40
  12. package/dist/src/attributes/attribute.d.ts.map +0 -1
  13. package/dist/src/attributes/attributes.d.ts +0 -45
  14. package/dist/src/attributes/attributes.d.ts.map +0 -1
  15. package/dist/src/attributes/selections.d.ts +0 -17
  16. package/dist/src/attributes/selections.d.ts.map +0 -1
  17. package/dist/src/attributes/value.d.ts +0 -13
  18. package/dist/src/attributes/value.d.ts.map +0 -1
  19. package/dist/src/camera/camera.d.ts +0 -40
  20. package/dist/src/camera/camera.d.ts.map +0 -1
  21. package/dist/src/camera/index.d.ts +0 -4
  22. package/dist/src/camera/index.d.ts.map +0 -1
  23. package/dist/src/camera/position.d.ts +0 -56
  24. package/dist/src/camera/position.d.ts.map +0 -1
  25. package/dist/src/client/client.d.ts +0 -71
  26. package/dist/src/client/client.d.ts.map +0 -1
  27. package/dist/src/client/error.d.ts +0 -23
  28. package/dist/src/client/error.d.ts.map +0 -1
  29. package/dist/src/client/events.d.ts +0 -22
  30. package/dist/src/client/events.d.ts.map +0 -1
  31. package/dist/src/client/iframe-builder.d.ts +0 -27
  32. package/dist/src/client/iframe-builder.d.ts.map +0 -1
  33. package/dist/src/client/options.d.ts +0 -19
  34. package/dist/src/client/options.d.ts.map +0 -1
  35. package/dist/src/client/ready-state-tracker.d.ts +0 -13
  36. package/dist/src/client/ready-state-tracker.d.ts.map +0 -1
  37. package/dist/src/client/types.d.ts +0 -20
  38. package/dist/src/client/types.d.ts.map +0 -1
  39. package/dist/src/configuration/configuration.d.ts +0 -113
  40. package/dist/src/configuration/configuration.d.ts.map +0 -1
  41. package/dist/src/configuration/index.d.ts +0 -2
  42. package/dist/src/configuration/index.d.ts.map +0 -1
  43. package/dist/src/configuration/resolver.d.ts +0 -16
  44. package/dist/src/configuration/resolver.d.ts.map +0 -1
  45. package/dist/src/focus/focus.d.ts +0 -43
  46. package/dist/src/focus/focus.d.ts.map +0 -1
  47. package/dist/src/focus/index.d.ts +0 -2
  48. package/dist/src/focus/index.d.ts.map +0 -1
  49. package/dist/src/index.d.ts +0 -16
  50. package/dist/src/index.d.ts.map +0 -1
  51. package/dist/src/snapshot/index.d.ts +0 -3
  52. package/dist/src/snapshot/index.d.ts.map +0 -1
  53. package/dist/src/snapshot/photo.d.ts +0 -47
  54. package/dist/src/snapshot/photo.d.ts.map +0 -1
  55. package/dist/src/snapshot/snapshot.d.ts +0 -36
  56. package/dist/src/snapshot/snapshot.d.ts.map +0 -1
  57. package/dist/src/ui/action-bar.d.ts +0 -18
  58. package/dist/src/ui/action-bar.d.ts.map +0 -1
  59. package/dist/src/ui/camera-controls.d.ts +0 -8
  60. package/dist/src/ui/camera-controls.d.ts.map +0 -1
  61. package/dist/src/ui/commerce-panel.d.ts +0 -31
  62. package/dist/src/ui/commerce-panel.d.ts.map +0 -1
  63. package/dist/src/ui/controls/attribute-group.d.ts +0 -6
  64. package/dist/src/ui/controls/attribute-group.d.ts.map +0 -1
  65. package/dist/src/ui/event-bus.d.ts +0 -12
  66. package/dist/src/ui/event-bus.d.ts.map +0 -1
  67. package/dist/src/ui/layouts/inframe-layout.d.ts +0 -13
  68. package/dist/src/ui/layouts/inframe-layout.d.ts.map +0 -1
  69. package/dist/src/ui/layouts/layout.d.ts +0 -15
  70. package/dist/src/ui/layouts/layout.d.ts.map +0 -1
  71. package/dist/src/ui/layouts/null-layout.d.ts +0 -12
  72. package/dist/src/ui/layouts/null-layout.d.ts.map +0 -1
  73. package/dist/src/ui/layouts/registry.d.ts +0 -4
  74. package/dist/src/ui/layouts/registry.d.ts.map +0 -1
  75. package/dist/src/ui/layouts/sidebar-layout.d.ts +0 -24
  76. package/dist/src/ui/layouts/sidebar-layout.d.ts.map +0 -1
  77. package/dist/src/ui/loading.d.ts +0 -43
  78. package/dist/src/ui/loading.d.ts.map +0 -1
  79. package/dist/src/ui/standard-interface.d.ts +0 -47
  80. package/dist/src/ui/standard-interface.d.ts.map +0 -1
  81. package/dist/src/ui/styles.d.ts +0 -3
  82. package/dist/src/ui/styles.d.ts.map +0 -1
  83. package/dist/src/utils/logger.d.ts +0 -11
  84. package/dist/src/utils/logger.d.ts.map +0 -1
@@ -204,7 +204,7 @@ let mt = !1, C = ht(dt("client", { isDev: !1 }));
204
204
  function Pt() {
205
205
  mt = !0, C = ht(dt("client", { isDev: !0 }));
206
206
  }
207
- function Vi() {
207
+ function ji() {
208
208
  return mt;
209
209
  }
210
210
  class Ft {
@@ -223,8 +223,135 @@ class Ft {
223
223
  this.ready = !1;
224
224
  }
225
225
  }
226
+ const O = {
227
+ /** Attribute selection requested (cancelable). `detail`: `{ attribute, value }`. */
228
+ SELECT: "ui:select",
229
+ /** Attribute selection applied. `detail`: `{ attribute, value }`. */
230
+ SELECTED: "ui:selected",
231
+ /** Focus changed (bubbles). `detail`: `{ component, attributes }`, or `null` for the overview. */
232
+ FOCUS_CHANGE: "vd:focus-change",
233
+ /** Resolved configuration changed (bubbles). `detail`: the resolved configuration, or `null` when nothing matches. */
234
+ CONFIGURATION_CHANGE: "vd:configuration-change",
235
+ /** Configuration submitted (bubbles). `detail`: the resolved configuration handed to the host. */
236
+ CONFIGURATION_SUBMIT: "vd:configuration-submit"
237
+ };
238
+ class $t {
239
+ constructor(t, e) {
240
+ this.value = t, this.attribute = e;
241
+ }
242
+ value;
243
+ attribute;
244
+ isSelectedValue = !1;
245
+ get isSelected() {
246
+ return this.isSelectedValue;
247
+ }
248
+ setSelected(t) {
249
+ this.isSelectedValue = t;
250
+ }
251
+ }
252
+ class Dt {
253
+ name;
254
+ defaultValue;
255
+ values;
256
+ onSelect;
257
+ onChangeCallback;
258
+ constructor(t) {
259
+ this.name = t.name, this.defaultValue = t.defaultValue, this.onSelect = t.onSelect, this.values = this.createValues(t.values);
260
+ }
261
+ /**
262
+ * Select a value for this attribute
263
+ * @throws {VirtualdisplayError} When value not found
264
+ */
265
+ select(t) {
266
+ if (!this.values.has(t))
267
+ throw f.valueNotFound(this.name, t);
268
+ this.onSelect(this.name, t);
269
+ }
270
+ getValues() {
271
+ return Array.from(this.values.values());
272
+ }
273
+ getValue(t) {
274
+ return this.values.get(t);
275
+ }
276
+ /** The currently selected value, or undefined before any selection lands. */
277
+ get selected() {
278
+ for (const t of this.values.values())
279
+ if (t.isSelected)
280
+ return t.value;
281
+ }
282
+ /**
283
+ * Register callback that fires when selection changes
284
+ * Receives the newly selected AttributeValue
285
+ */
286
+ onChange(t) {
287
+ this.onChangeCallback = t;
288
+ }
289
+ /**
290
+ * Update selection state from server mutation result
291
+ * Direct value comparison - no source/target translation
292
+ */
293
+ handleResult(t) {
294
+ let e;
295
+ for (const i of this.values.values()) {
296
+ const o = i.value === t;
297
+ i.setSelected(o), o && (e = i);
298
+ }
299
+ e !== void 0 && this.onChangeCallback !== void 0 && this.onChangeCallback(e);
300
+ }
301
+ createValues(t) {
302
+ const e = /* @__PURE__ */ new Map();
303
+ for (const i of t) {
304
+ const o = new $t(i, this.name);
305
+ i === this.defaultValue && o.setSelected(!0), e.set(i, o);
306
+ }
307
+ return e;
308
+ }
309
+ }
310
+ class Bt {
311
+ attributes = /* @__PURE__ */ new Map();
312
+ constructor(t, e, i) {
313
+ for (const o of t) {
314
+ const s = this.buildOptions(o, e);
315
+ this.attributes.set(o.name, new Dt(s));
316
+ }
317
+ this.onMutationFailed = i;
318
+ }
319
+ onMutationFailed;
320
+ get(t) {
321
+ return this.attributes.get(t);
322
+ }
323
+ /** The current selection as attribute name→value pairs, skipping unset attributes. */
324
+ getSelection() {
325
+ const t = {};
326
+ for (const [e, i] of this.attributes) {
327
+ const o = i.selected;
328
+ o !== void 0 && (t[e] = o);
329
+ }
330
+ return t;
331
+ }
332
+ handleResults(t) {
333
+ for (const e of t) {
334
+ if (!e.success) {
335
+ this.onMutationFailed?.(e.name, e.value);
336
+ continue;
337
+ }
338
+ this.get(e.name)?.handleResult(e.value);
339
+ }
340
+ }
341
+ buildOptions(t, e) {
342
+ const i = {
343
+ name: t.name,
344
+ values: t.values,
345
+ onSelect: (o, s) => {
346
+ e([{ name: o, value: s }], !1);
347
+ }
348
+ };
349
+ return t.defaultValue !== void 0 ? { ...i, defaultValue: t.defaultValue } : i;
350
+ }
351
+ }
226
352
  const c = {
227
353
  HANDSHAKE: "handshake",
354
+ SESSION: "session",
228
355
  MUTATION: "mutation",
229
356
  STATE: "state",
230
357
  LOADING_INDICATOR: "loading_indicator",
@@ -241,59 +368,63 @@ const c = {
241
368
  }, X = {
242
369
  FOCUS: "focus",
243
370
  UNFOCUS: "unfocus"
244
- }, $t = {
371
+ }, Ut = {
245
372
  FOCUSED: "focused"
246
- }, Dt = {
373
+ }, Vt = {
247
374
  /** Behaves exactly like an unpriced combination: no price, no button. */
248
375
  HIDDEN: "hidden"
249
- }, Bt = new Set(Object.values(c));
250
- function Ut(n) {
376
+ }, jt = new Set(Object.values(c));
377
+ function Ht(n) {
251
378
  if (typeof n != "object" || n === null)
252
379
  return !1;
253
380
  const t = n;
254
- return typeof t.target == "string" ? !1 : typeof t.type == "string" && Bt.has(t.type);
381
+ return typeof t.target == "string" ? !1 : typeof t.type == "string" && jt.has(t.type);
255
382
  }
256
- function Vt(n) {
257
- const t = k(n);
383
+ function Gt(n) {
384
+ const t = w(n);
258
385
  return t !== null && t.type === c.HANDSHAKE;
259
386
  }
260
- function jt(n) {
261
- const t = k(n);
387
+ function qt(n) {
388
+ const t = w(n);
389
+ return t !== null && t.type === c.SESSION && typeof t.sessionId == "string";
390
+ }
391
+ function Zt(n) {
392
+ const t = w(n);
262
393
  return t !== null && t.type === c.MUTATION && Array.isArray(t.results);
263
394
  }
264
- function Ht(n) {
265
- const t = k(n);
395
+ function Wt(n) {
396
+ const t = w(n);
266
397
  return t !== null && t.type === c.SNAPSHOT && ("data" in t || "error" in t);
267
398
  }
268
- function Gt(n) {
269
- const t = k(n);
399
+ function Yt(n) {
400
+ const t = w(n);
270
401
  return t !== null && t.type === c.CAMERA && Array.isArray(t.transforms);
271
402
  }
272
- function qt(n) {
273
- const t = k(n);
403
+ function Xt(n) {
404
+ const t = w(n);
274
405
  return t !== null && t.type === c.MAPPING && Array.isArray(t.attributes);
275
406
  }
276
- function Zt(n) {
277
- const t = k(n);
407
+ function Kt(n) {
408
+ const t = w(n);
278
409
  return t !== null && t.type === c.LOADING_INDICATOR && typeof t.progress == "number";
279
410
  }
280
- function Wt(n) {
281
- const t = k(n);
411
+ function Qt(n) {
412
+ const t = w(n);
282
413
  return t !== null && t.type === c.CONFIG && typeof t.viewerSettings == "object";
283
414
  }
284
- function Yt(n) {
285
- const t = k(n);
415
+ function Jt(n) {
416
+ const t = w(n);
286
417
  return t !== null && t.type === c.ANNOTATION_PLACED && typeof t.position == "object" && t.position !== null;
287
418
  }
288
- function Xt(n) {
289
- const t = k(n);
419
+ function te(n) {
420
+ const t = w(n);
290
421
  return t !== null && t.type === c.FOCUS && typeof t.state == "string";
291
422
  }
292
- function Kt(n) {
293
- const t = k(n);
423
+ function ee(n) {
424
+ const t = w(n);
294
425
  return t !== null && t.type === c.PRICING && typeof t.pricing == "object" && t.pricing !== null;
295
426
  }
296
- function k(n) {
427
+ function w(n) {
297
428
  return typeof n != "object" || n === null ? null : n;
298
429
  }
299
430
  class K {
@@ -343,7 +474,7 @@ class K {
343
474
  this.pending.length = 0;
344
475
  }
345
476
  }
346
- class Qt {
477
+ class ne {
347
478
  constructor(t, e) {
348
479
  this.getTarget = t, this.sourceId = `vd-${Math.random().toString(36).slice(2, 8)}`, this.targetOrigin = e?.targetOrigin ?? "*", this.publisher = new K((i) => this.post(i)), this.consumer = new K((i) => this.routeToHandler(i)), this.shouldBuffer = e?.shouldBuffer ?? null, e?.bufferIncoming !== !0 && this.consumer.markReady();
349
480
  }
@@ -406,7 +537,7 @@ class Qt {
406
537
  start() {
407
538
  this.listener === null && (this.listener = (t) => {
408
539
  const { data: e } = t;
409
- if (!Ut(e) || e._source === this.sourceId)
540
+ if (!Ht(e) || e._source === this.sourceId)
410
541
  return;
411
542
  const i = this.getTarget();
412
543
  if (i !== null && t.source !== null && t.source !== i)
@@ -452,153 +583,6 @@ class Qt {
452
583
  });
453
584
  }
454
585
  }
455
- class Jt {
456
- constructor(t) {
457
- this.send = t;
458
- }
459
- send;
460
- placedCallbacks = [];
461
- setEnabled(t) {
462
- this.send({
463
- type: c.ANNOTATION_TOGGLE,
464
- enabled: t
465
- });
466
- }
467
- startPlacing() {
468
- this.send({
469
- type: c.ANNOTATION_PLACE_MODE,
470
- enabled: !0
471
- });
472
- }
473
- stopPlacing() {
474
- this.send({
475
- type: c.ANNOTATION_PLACE_MODE,
476
- enabled: !1
477
- });
478
- }
479
- onPlaced(t) {
480
- this.placedCallbacks.push(t);
481
- }
482
- /** Called by the client when an ANNOTATION_PLACED message is received. */
483
- handlePlaced(t) {
484
- for (const e of this.placedCallbacks)
485
- e(t);
486
- }
487
- }
488
- class te {
489
- constructor(t, e) {
490
- this.value = t, this.attribute = e;
491
- }
492
- value;
493
- attribute;
494
- isSelectedValue = !1;
495
- get isSelected() {
496
- return this.isSelectedValue;
497
- }
498
- setSelected(t) {
499
- this.isSelectedValue = t;
500
- }
501
- }
502
- class ee {
503
- name;
504
- defaultValue;
505
- values;
506
- onSelect;
507
- onChangeCallback;
508
- constructor(t) {
509
- this.name = t.name, this.defaultValue = t.defaultValue, this.onSelect = t.onSelect, this.values = this.createValues(t.values);
510
- }
511
- /**
512
- * Select a value for this attribute
513
- * @throws {VirtualdisplayError} When value not found
514
- */
515
- select(t) {
516
- if (!this.values.has(t))
517
- throw f.valueNotFound(this.name, t);
518
- this.onSelect(this.name, t);
519
- }
520
- getValues() {
521
- return Array.from(this.values.values());
522
- }
523
- getValue(t) {
524
- return this.values.get(t);
525
- }
526
- /** The currently selected value, or undefined before any selection lands. */
527
- get selected() {
528
- for (const t of this.values.values())
529
- if (t.isSelected)
530
- return t.value;
531
- }
532
- /**
533
- * Register callback that fires when selection changes
534
- * Receives the newly selected AttributeValue
535
- */
536
- onChange(t) {
537
- this.onChangeCallback = t;
538
- }
539
- /**
540
- * Update selection state from server mutation result
541
- * Direct value comparison - no source/target translation
542
- */
543
- handleResult(t) {
544
- let e;
545
- for (const i of this.values.values()) {
546
- const o = i.value === t;
547
- i.setSelected(o), o && (e = i);
548
- }
549
- e !== void 0 && this.onChangeCallback !== void 0 && this.onChangeCallback(e);
550
- }
551
- createValues(t) {
552
- const e = /* @__PURE__ */ new Map();
553
- for (const i of t) {
554
- const o = new te(i, this.name);
555
- i === this.defaultValue && o.setSelected(!0), e.set(i, o);
556
- }
557
- return e;
558
- }
559
- }
560
- class ne {
561
- attributes = /* @__PURE__ */ new Map();
562
- constructor(t, e, i) {
563
- for (const o of t) {
564
- const s = this.buildOptions(o, e);
565
- this.attributes.set(o.name, new ee(s));
566
- }
567
- this.onMutationFailed = i;
568
- }
569
- onMutationFailed;
570
- get(t) {
571
- return this.attributes.get(t);
572
- }
573
- /** The current selection as attribute name→value pairs, skipping unset attributes. */
574
- getSelection() {
575
- const t = {};
576
- for (const [e, i] of this.attributes) {
577
- const o = i.selected;
578
- o !== void 0 && (t[e] = o);
579
- }
580
- return t;
581
- }
582
- handleResults(t) {
583
- for (const e of t) {
584
- if (!e.success) {
585
- this.onMutationFailed?.(e.name, e.value);
586
- continue;
587
- }
588
- this.get(e.name)?.handleResult(e.value);
589
- }
590
- }
591
- buildOptions(t, e) {
592
- const i = {
593
- name: t.name,
594
- values: t.values,
595
- onSelect: (o, s) => {
596
- e([{ name: o, value: s }], !1);
597
- }
598
- };
599
- return t.defaultValue !== void 0 ? { ...i, defaultValue: t.defaultValue } : i;
600
- }
601
- }
602
586
  class ie {
603
587
  constructor(t, e) {
604
588
  this.send = t, this.onMutationFailed = e;
@@ -613,7 +597,7 @@ class ie {
613
597
  handleMappingReceived(t) {
614
598
  C.debug("Initializing from server mapping", {
615
599
  attributeCount: t.attributes.length
616
- }), this.registry = new ne(
600
+ }), this.registry = new Bt(
617
601
  t.attributes,
618
602
  (e, i) => this.sendMutation(e, i),
619
603
  this.onMutationFailed
@@ -829,18 +813,6 @@ class se {
829
813
  }
830
814
  }
831
815
  }
832
- const O = {
833
- /** Attribute selection requested (cancelable). `detail`: `{ attribute, value }`. */
834
- SELECT: "ui:select",
835
- /** Attribute selection applied. `detail`: `{ attribute, value }`. */
836
- SELECTED: "ui:selected",
837
- /** Focus changed (bubbles). `detail`: `{ component, attributes }`, or `null` for the overview. */
838
- FOCUS_CHANGE: "vd:focus-change",
839
- /** Resolved configuration changed (bubbles). `detail`: the resolved configuration, or `null` when nothing matches. */
840
- CONFIGURATION_CHANGE: "vd:configuration-change",
841
- /** Configuration submitted (bubbles). `detail`: the resolved configuration handed to the host. */
842
- CONFIGURATION_SUBMIT: "vd:configuration-submit"
843
- };
844
816
  class re {
845
817
  constructor(t, e) {
846
818
  this.send = t, this.dispatch = e;
@@ -878,7 +850,7 @@ class re {
878
850
  }
879
851
  /** Called by the client when a FocusStateMessage is received from the viewer. */
880
852
  handleStateReceived(t) {
881
- t.state === $t.FOCUSED && t.component !== void 0 ? (this.focused = t.component, this.attributes = t.attributes ?? []) : (this.focused = null, this.attributes = []);
853
+ t.state === Ut.FOCUSED && t.component !== void 0 ? (this.focused = t.component, this.attributes = t.attributes ?? []) : (this.focused = null, this.attributes = []);
882
854
  const e = this.focused !== null ? { component: this.focused, attributes: this.attributes } : null;
883
855
  for (const i of this.changeCallbacks)
884
856
  i(e);
@@ -1009,7 +981,7 @@ class ce {
1009
981
  if (this.pricing === void 0)
1010
982
  return;
1011
983
  const t = ae(this.pricing.rules, this.selection);
1012
- if (!(t === void 0 || t.availability === Dt.HIDDEN))
984
+ if (!(t === void 0 || t.availability === Vt.HIDDEN))
1013
985
  return {
1014
986
  attributes: { ...this.selection },
1015
987
  reference: t.reference,
@@ -1521,7 +1493,7 @@ const ye = (
1521
1493
  /** @type {(inputs: Controls_Configurator_OpenInputs) => LocalizedString} */
1522
1494
  () => (
1523
1495
  /** @type {LocalizedString} */
1524
- "Configureer"
1496
+ "Configureren"
1525
1497
  )
1526
1498
  ), nn = (
1527
1499
  /** @type {(inputs: Controls_Configurator_OpenInputs) => LocalizedString} */
@@ -2392,7 +2364,7 @@ function st(n) {
2392
2364
  return t * t * (3 - 2 * t);
2393
2365
  }
2394
2366
  function bi(n, t, e, i, o, s) {
2395
- const [r, l, d] = n, u = Math.cos(t), p = Math.sin(t), v = u * r + p * d, E = -p * r + u * d, S = Math.cos(e), w = Math.sin(e), R = S * l - w * E, M = w * l + S * E, Y = 0.55;
2367
+ const [r, l, d] = n, u = Math.cos(t), p = Math.sin(t), v = u * r + p * d, E = -p * r + u * d, S = Math.cos(e), k = Math.sin(e), R = S * l - k * E, M = k * l + S * E, Y = 0.55;
2396
2368
  return [i + v * s * Y, o - R * s * Y, M];
2397
2369
  }
2398
2370
  function vi(n, t, e) {
@@ -2541,14 +2513,14 @@ class wi {
2541
2513
  return;
2542
2514
  const t = this.canvas.width / Math.min(devicePixelRatio, 2), e = this.canvas.height / Math.min(devicePixelRatio, 2), i = (performance.now() - this.startTime) / 1e3;
2543
2515
  this.ctx.fillStyle = "#fff", this.ctx.fillRect(0, 0, t, e);
2544
- const o = t / 2, s = e * 0.44, r = Math.min(t, e) * 0.08, l = 0.785, d = 0.615, u = (w) => bi(w, l, d, o, s, r), p = 6, v = i % p / p, E = rt.length;
2516
+ const o = t / 2, s = e * 0.44, r = Math.min(t, e) * 0.08, l = 0.785, d = 0.615, u = (k) => bi(k, l, d, o, s, r), p = 6, v = i % p / p, E = rt.length;
2545
2517
  let S;
2546
2518
  v < 0.35 ? S = st(v / 0.35) * E : v < 0.55 ? S = E : v < 0.9 ? S = (1 - st((v - 0.55) / 0.35)) * E : S = 0, this.ctx.shadowBlur = 5, this.ctx.shadowColor = "rgba(30,30,30,0.08)";
2547
- for (let w = 0; w < E && !(w >= S); w++) {
2548
- const R = rt[w];
2519
+ for (let k = 0; k < E && !(k >= S); k++) {
2520
+ const R = rt[k];
2549
2521
  if (R === void 0)
2550
2522
  continue;
2551
- const M = Math.min(1, S - w);
2523
+ const M = Math.min(1, S - k);
2552
2524
  yi(this.ctx, u, R[0], R[1], M);
2553
2525
  }
2554
2526
  this.ctx.shadowBlur = 0;
@@ -3146,7 +3118,40 @@ class Ui {
3146
3118
  this.screenshotBtn === null || this.slots.topRight === null || (this.cameraControls !== null ? this.cameraControls.element.appendChild(this.screenshotBtn.element) : this.slots.topRight.appendChild(this.screenshotBtn.element));
3147
3119
  }
3148
3120
  }
3149
- class Hi {
3121
+ class Vi {
3122
+ constructor(t) {
3123
+ this.send = t;
3124
+ }
3125
+ send;
3126
+ placedCallbacks = [];
3127
+ setEnabled(t) {
3128
+ this.send({
3129
+ type: c.ANNOTATION_TOGGLE,
3130
+ enabled: t
3131
+ });
3132
+ }
3133
+ startPlacing() {
3134
+ this.send({
3135
+ type: c.ANNOTATION_PLACE_MODE,
3136
+ enabled: !0
3137
+ });
3138
+ }
3139
+ stopPlacing() {
3140
+ this.send({
3141
+ type: c.ANNOTATION_PLACE_MODE,
3142
+ enabled: !1
3143
+ });
3144
+ }
3145
+ onPlaced(t) {
3146
+ this.placedCallbacks.push(t);
3147
+ }
3148
+ /** Called by the client when an ANNOTATION_PLACED message is received. */
3149
+ handlePlaced(t) {
3150
+ for (const e of this.placedCallbacks)
3151
+ e(t);
3152
+ }
3153
+ }
3154
+ class Gi {
3150
3155
  attributes;
3151
3156
  readyStateTracker;
3152
3157
  messenger;
@@ -3162,17 +3167,18 @@ class Hi {
3162
3167
  options;
3163
3168
  iframe;
3164
3169
  container;
3170
+ viewerSessionId;
3165
3171
  readyCallbacks = [];
3166
3172
  mutationFailedCallbacks = [];
3167
3173
  constructor(t) {
3168
- this.options = t, this.initializeLogging(), this.messenger = new Qt(() => this.iframe?.contentWindow ?? null);
3174
+ this.options = t, this.initializeLogging(), this.messenger = new ne(() => this.iframe?.contentWindow ?? null);
3169
3175
  const e = (i) => {
3170
3176
  this.messenger.send(i);
3171
3177
  };
3172
3178
  this.attributes = new ie(e, (i, o) => {
3173
3179
  for (const s of this.mutationFailedCallbacks)
3174
3180
  s({ attribute: i, value: o });
3175
- }), this.snapshotApi = new de(e), this.annotationsApi = new Jt(e), this.cameraApi = new oe(e), this.cameraPositionApi = new se(), this.focusApi = new re(e, (i) => {
3181
+ }), this.snapshotApi = new de(e), this.annotationsApi = new Vi(e), this.cameraApi = new oe(e), this.cameraPositionApi = new se(), this.focusApi = new re(e, (i) => {
3176
3182
  this.dispatchFocusChange(i);
3177
3183
  }), this.configurationApi = new ce(
3178
3184
  (i) => {
@@ -3201,30 +3207,36 @@ class Hi {
3201
3207
  }), this.registerHandlers(), this.messenger.start(), this.createAndConnectIframe();
3202
3208
  }
3203
3209
  registerHandlers() {
3204
- this.messenger.on(c.HANDSHAKE, (t) => {
3205
- Vt(t) && (C.info("Server handshake received, flushing publisher queue"), this.messenger.markReady());
3206
- }), this.messenger.on(c.MUTATION, (t) => {
3207
- jt(t) && (this.attributes.handleMutationResult(t), this.configurationApi.handleSelectionChanged(this.attributes.getSelection()));
3210
+ this.registerLifecycleHandlers(), this.messenger.on(c.MUTATION, (t) => {
3211
+ Zt(t) && (this.attributes.handleMutationResult(t), this.configurationApi.handleSelectionChanged(this.attributes.getSelection()));
3208
3212
  }), this.messenger.on(c.SNAPSHOT, (t) => {
3209
- Ht(t) && this.snapshotApi.handleSnapshotResult(t);
3213
+ Wt(t) && this.snapshotApi.handleSnapshotResult(t);
3210
3214
  }), this.messenger.on(c.CAMERA, (t) => {
3211
- Gt(t) && this.cameraPositionApi.handlePositionUpdate(t);
3215
+ Yt(t) && this.cameraPositionApi.handlePositionUpdate(t);
3212
3216
  }), this.messenger.on(c.LOADING_INDICATOR, (t) => {
3213
- Zt(t) && (t.error !== void 0 ? this.ui.showError(t.error) : this.ui.updateProgress(t.progress, t.phase));
3217
+ Kt(t) && (t.error !== void 0 ? this.ui.showError(t.error) : this.ui.updateProgress(t.progress, t.phase));
3214
3218
  }), this.messenger.on(c.CONFIG, (t) => {
3215
- Wt(t) && this.handleConfig(t);
3219
+ Qt(t) && this.handleConfig(t);
3216
3220
  }), this.messenger.on(c.ANNOTATION_PLACED, (t) => {
3217
- Yt(t) && this.annotationsApi.handlePlaced(t.position);
3221
+ Jt(t) && this.annotationsApi.handlePlaced(t.position);
3218
3222
  }), this.messenger.on(c.MAPPING, (t) => {
3219
- qt(t) && (this.attributes.handleMappingReceived(t), this.configurationApi.handleSelectionChanged(this.attributes.getSelection()), this.ui.renderAttributeControls(this.attributes, t.attributes), this.readyStateTracker.handleMappingReceived());
3223
+ Xt(t) && (this.attributes.handleMappingReceived(t), this.configurationApi.handleSelectionChanged(this.attributes.getSelection()), this.ui.renderAttributeControls(this.attributes, t.attributes), this.readyStateTracker.handleMappingReceived());
3220
3224
  }), this.registerFacadeStateHandlers();
3221
3225
  }
3226
+ /** Lifecycle handlers: the handshake (queue flush) and the tracking session id. */
3227
+ registerLifecycleHandlers() {
3228
+ this.messenger.on(c.HANDSHAKE, (t) => {
3229
+ Gt(t) && (C.info("Server handshake received, flushing publisher queue"), this.messenger.markReady());
3230
+ }), this.messenger.on(c.SESSION, (t) => {
3231
+ qt(t) && (this.viewerSessionId = t.sessionId);
3232
+ });
3233
+ }
3222
3234
  /** Handlers that feed viewer-reported state into the facades (focus, pricing). */
3223
3235
  registerFacadeStateHandlers() {
3224
3236
  this.messenger.on(c.FOCUS, (t) => {
3225
- Xt(t) && this.focusApi.handleStateReceived(t);
3237
+ te(t) && this.focusApi.handleStateReceived(t);
3226
3238
  }), this.messenger.on(c.PRICING, (t) => {
3227
- Kt(t) && this.configurationApi.handlePricingReceived(t.pricing);
3239
+ ee(t) && this.configurationApi.handlePricingReceived(t.pricing);
3228
3240
  });
3229
3241
  }
3230
3242
  /**
@@ -3334,14 +3346,23 @@ class Hi {
3334
3346
  get viewerSettings() {
3335
3347
  return this.ui.viewerSettings;
3336
3348
  }
3349
+ /**
3350
+ * The viewer's tracking session id, once the viewer has established it (the id
3351
+ * is generated inside the iframe and announced to the client). `undefined`
3352
+ * until then. A host page can use it to correlate its own actions, e.g. a
3353
+ * configurator conversion, with the viewer session.
3354
+ */
3355
+ get sessionId() {
3356
+ return this.viewerSessionId;
3357
+ }
3337
3358
  destroy() {
3338
3359
  this.readyStateTracker.clear(), this.readyCallbacks = [], this.mutationFailedCallbacks.length = 0, this.snapshotApi.clear(), this.messenger.destroy(), this.qrModal.hide(), this.ui.destroy(), this.container?.parentElement !== null && this.container?.parentElement !== void 0 && this.container.parentElement.removeChild(this.container), this.container = void 0, this.iframe = void 0;
3339
3360
  }
3340
3361
  }
3341
3362
  export {
3342
- Jt as Annotations,
3343
- ee as Attribute,
3344
- te as AttributeValue,
3363
+ Vi as Annotations,
3364
+ Dt as Attribute,
3365
+ $t as AttributeValue,
3345
3366
  oe as Camera,
3346
3367
  ce as Configuration,
3347
3368
  A as ERROR_CODES,
@@ -3349,9 +3370,9 @@ export {
3349
3370
  ue as Photo,
3350
3371
  de as Snapshot,
3351
3372
  O as VD_EVENTS,
3352
- Hi as VirtualdisplayClient,
3373
+ Gi as VirtualdisplayClient,
3353
3374
  f as VirtualdisplayError,
3354
3375
  Pt as enableDebugMode,
3355
- Vi as isDebugMode,
3376
+ ji as isDebugMode,
3356
3377
  C as logger
3357
3378
  };