forgeframe 0.0.9 → 0.0.12

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.
@@ -1,4 +1,4 @@
1
- const f = {
1
+ const p = {
2
2
  /** Render component in an iframe */
3
3
  IFRAME: "iframe",
4
4
  /** Render component in a popup window */
@@ -26,19 +26,19 @@ const f = {
26
26
  RESIZE: "resize",
27
27
  /** Emitted when component receives focus */
28
28
  FOCUS: "focus"
29
- }, A = {
29
+ }, z = {
30
30
  /** Default JSON serialization */
31
31
  JSON: "json",
32
32
  /** Base64 encoding for binary or large data */
33
33
  BASE64: "base64",
34
34
  /** Explicit framed-path encoding for nested objects */
35
35
  DOTIFY: "dotify"
36
- }, z = {
36
+ }, W = {
37
37
  /** Request message expecting a response */
38
38
  REQUEST: "request",
39
39
  /** Response to a previous request */
40
40
  RESPONSE: "response"
41
- }, u = {
41
+ }, l = {
42
42
  /** Host initialization complete */
43
43
  INIT: "forgeframe_init",
44
44
  /** Props update from consumer to host */
@@ -63,14 +63,14 @@ const f = {
63
63
  CONSUMER_EXPORT: "forgeframe_consumer_export",
64
64
  /** Get sibling components request */
65
65
  GET_SIBLINGS: "forgeframe_get_siblings"
66
- }, M = "__forgeframe__", se = (() => {
67
- if ("0.0.9".trim().length === 0)
66
+ }, j = "__forgeframe__", oe = (() => {
67
+ if ("0.0.12".trim().length === 0)
68
68
  throw new Error(
69
69
  "ForgeFrame VERSION injection is missing. Configure __FORGEFRAME_VERSION__ in build/test tooling."
70
70
  );
71
- return "0.0.9";
71
+ return "0.0.12";
72
72
  })();
73
- class Ie {
73
+ class Ae {
74
74
  /**
75
75
  * Internal storage for event listeners mapped by event name.
76
76
  * @internal
@@ -93,8 +93,8 @@ class Ie {
93
93
  *
94
94
  * @public
95
95
  */
96
- on(e, t) {
97
- return this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(t), () => this.off(e, t);
96
+ on(e, n) {
97
+ return this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(n), () => this.off(e, n);
98
98
  }
99
99
  /**
100
100
  * Subscribes a handler to an event that will automatically unsubscribe after the first invocation.
@@ -117,8 +117,8 @@ class Ie {
117
117
  *
118
118
  * @public
119
119
  */
120
- once(e, t) {
121
- const s = (r) => (this.off(e, s), t(r));
120
+ once(e, n) {
121
+ const s = (r) => (this.off(e, s), n(r));
122
122
  return this.on(e, s);
123
123
  }
124
124
  /**
@@ -140,12 +140,12 @@ class Ie {
140
140
  *
141
141
  * @public
142
142
  */
143
- emit(e, t) {
143
+ emit(e, n) {
144
144
  const s = this.listeners.get(e);
145
145
  if (s)
146
146
  for (const r of s)
147
147
  try {
148
- const i = r(t);
148
+ const i = r(n);
149
149
  i && typeof i == "object" && "catch" in i && typeof i.catch == "function" && i.catch((o) => {
150
150
  console.error(`Error in async event handler for "${e}":`, o);
151
151
  });
@@ -174,13 +174,13 @@ class Ie {
174
174
  *
175
175
  * @public
176
176
  */
177
- off(e, t) {
178
- if (!t) {
177
+ off(e, n) {
178
+ if (!n) {
179
179
  this.listeners.delete(e);
180
180
  return;
181
181
  }
182
182
  const s = this.listeners.get(e);
183
- s && (s.delete(t), s.size === 0 && this.listeners.delete(e));
183
+ s && (s.delete(n), s.size === 0 && this.listeners.delete(e));
184
184
  }
185
185
  /**
186
186
  * Removes all event listeners from the emitter.
@@ -221,14 +221,14 @@ class Ie {
221
221
  return this.listeners.get(e)?.size ?? 0;
222
222
  }
223
223
  }
224
- function qe() {
225
- const n = Date.now().toString(36), e = Math.random().toString(36).slice(2, 11);
226
- return `${n}_${e}`;
224
+ function tt() {
225
+ const t = Date.now().toString(36), e = Math.random().toString(36).slice(2, 11);
226
+ return `${t}_${e}`;
227
227
  }
228
- function L() {
228
+ function k() {
229
229
  return Math.random().toString(36).slice(2, 11);
230
230
  }
231
- class Je {
231
+ class nt {
232
232
  /**
233
233
  * Array of registered cleanup tasks awaiting execution.
234
234
  * @internal
@@ -265,8 +265,8 @@ class Je {
265
265
  */
266
266
  register(e) {
267
267
  if (this.cleaned) {
268
- Promise.resolve().then(() => e()).catch((t) => {
269
- console.error("Error in cleanup task:", t);
268
+ Promise.resolve().then(() => e()).catch((n) => {
269
+ console.error("Error in cleanup task:", n);
270
270
  });
271
271
  return;
272
272
  }
@@ -298,9 +298,9 @@ class Je {
298
298
  this.cleaned = !0;
299
299
  const e = this.tasks.reverse();
300
300
  this.tasks = [];
301
- for (const t of e)
301
+ for (const n of e)
302
302
  try {
303
- await t();
303
+ await n();
304
304
  } catch (s) {
305
305
  console.error("Error in cleanup task:", s);
306
306
  }
@@ -345,125 +345,125 @@ class Je {
345
345
  this.tasks = [], this.cleaned = !1;
346
346
  }
347
347
  }
348
- function Se() {
349
- let n, e;
348
+ function Le() {
349
+ let t, e;
350
350
  return { promise: new Promise((s, r) => {
351
- n = s, e = r;
352
- }), resolve: n, reject: e };
351
+ t = s, e = r;
352
+ }), resolve: t, reject: e };
353
353
  }
354
- function Ke(n, e, t = "Operation timed out") {
354
+ function st(t, e, n = "Operation timed out") {
355
355
  return new Promise((s, r) => {
356
356
  const i = setTimeout(() => {
357
- r(new Error(`${t} (${e}ms)`));
357
+ r(new Error(`${n} (${e}ms)`));
358
358
  }, e);
359
- n.then((o) => {
359
+ t.then((o) => {
360
360
  clearTimeout(i), s(o);
361
361
  }).catch((o) => {
362
362
  clearTimeout(i), r(o);
363
363
  });
364
364
  });
365
365
  }
366
- const I = /* @__PURE__ */ new Map(), Ye = 200;
367
- function Xe(n) {
368
- return n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
366
+ const I = /* @__PURE__ */ new Map(), rt = 200;
367
+ function it(t) {
368
+ return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
369
369
  }
370
- function Ge(n) {
371
- if (!n.includes("*"))
370
+ function ot(t) {
371
+ if (!t.includes("*"))
372
372
  return null;
373
- const e = I.get(n);
373
+ const e = I.get(t);
374
374
  if (e)
375
375
  return e;
376
- const t = n.split("*").map((r) => Xe(r)).join(".*"), s = new RegExp(`^${t}$`);
377
- if (I.size >= Ye) {
376
+ const n = t.split("*").map((r) => it(r)).join(".*"), s = new RegExp(`^${n}$`);
377
+ if (I.size >= rt) {
378
378
  const r = I.keys().next().value;
379
379
  r && I.delete(r);
380
380
  }
381
- return I.set(n, s), s;
381
+ return I.set(t, s), s;
382
382
  }
383
- function Ze(n, e) {
384
- return n.global || n.sticky ? new RegExp(n.source, n.flags.replace(/[gy]/g, "")).test(e) : n.test(e);
383
+ function at(t, e) {
384
+ return t.global || t.sticky ? new RegExp(t.source, t.flags.replace(/[gy]/g, "")).test(e) : t.test(e);
385
385
  }
386
- function k(n = window) {
386
+ function B(t = window) {
387
387
  try {
388
- return n.location.origin;
388
+ return t.location.origin;
389
389
  } catch {
390
390
  return "";
391
391
  }
392
392
  }
393
- function ve(n, e = window) {
393
+ function Me(t, e = window) {
394
394
  try {
395
- return n.location.origin === e.location.origin;
395
+ return t.location.origin === e.location.origin;
396
396
  } catch {
397
397
  return !1;
398
398
  }
399
399
  }
400
- function v(n, e) {
401
- if (typeof n == "string") {
402
- if (n === "*") return !0;
403
- const t = Ge(n);
404
- return t ? t.test(e) : n === e;
400
+ function U(t, e) {
401
+ if (typeof t == "string") {
402
+ if (t === "*") return !0;
403
+ const n = ot(t);
404
+ return n ? n.test(e) : t === e;
405
405
  }
406
- return n instanceof RegExp ? Ze(n, e) : Array.isArray(n) ? n.some((t) => v(t, e)) : !1;
406
+ return t instanceof RegExp ? at(t, e) : Array.isArray(t) ? t.some((n) => U(n, e)) : !1;
407
407
  }
408
- function Z(n) {
409
- if (!n) return !0;
408
+ function ne(t) {
409
+ if (!t) return !0;
410
410
  try {
411
- return n.closed;
411
+ return t.closed;
412
412
  } catch {
413
413
  return !0;
414
414
  }
415
415
  }
416
- function Qe(n = window) {
416
+ function ct(t = window) {
417
417
  try {
418
- return n.opener;
418
+ return t.opener;
419
419
  } catch {
420
420
  return null;
421
421
  }
422
422
  }
423
- function et(n = window) {
423
+ function ut(t = window) {
424
424
  try {
425
- const e = n.parent;
426
- return e && e !== n ? e : null;
425
+ const e = t.parent;
426
+ return e && e !== t ? e : null;
427
427
  } catch {
428
428
  return null;
429
429
  }
430
430
  }
431
- function tt(n = window) {
431
+ function lt(t = window) {
432
432
  try {
433
- return n.parent !== n;
433
+ return t.parent !== t;
434
434
  } catch {
435
435
  return !0;
436
436
  }
437
437
  }
438
- function nt(n = window) {
438
+ function ht(t = window) {
439
439
  try {
440
- return n.opener !== null && n.opener !== void 0;
440
+ return t.opener !== null && t.opener !== void 0;
441
441
  } catch {
442
442
  return !1;
443
443
  }
444
444
  }
445
- const _e = 100, P = /* @__PURE__ */ new Map();
446
- function st() {
447
- const n = [];
448
- for (const [e, t] of P.entries())
449
- Z(t) && n.push(e);
450
- for (const e of n)
451
- P.delete(e);
445
+ const De = 100, b = /* @__PURE__ */ new Map();
446
+ function dt() {
447
+ const t = [];
448
+ for (const [e, n] of b.entries())
449
+ ne(n) && t.push(e);
450
+ for (const e of t)
451
+ b.delete(e);
452
452
  }
453
- function rt(n, e) {
454
- if (P.size >= _e && st(), P.size >= _e) {
455
- const t = P.keys().next().value;
456
- t && P.delete(t);
453
+ function ft(t, e) {
454
+ if (b.size >= De && dt(), b.size >= De) {
455
+ const n = b.keys().next().value;
456
+ n && b.delete(n);
457
457
  }
458
- P.set(n, e);
458
+ b.set(t, e);
459
459
  }
460
- function it(n) {
461
- P.delete(n);
460
+ function pt(t) {
461
+ b.delete(t);
462
462
  }
463
- function ot(n, e) {
464
- return n.global || n.sticky ? new RegExp(n.source, n.flags.replace(/[gy]/g, "")).test(e) : n.test(e);
463
+ function mt(t, e) {
464
+ return t.global || t.sticky ? new RegExp(t.source, t.flags.replace(/[gy]/g, "")).test(e) : t.test(e);
465
465
  }
466
- class _ {
466
+ class P {
467
467
  /** @internal */
468
468
  _optional = !1;
469
469
  /** @internal */
@@ -526,11 +526,11 @@ class _ {
526
526
  * ```
527
527
  */
528
528
  default(e) {
529
- const t = this._clone();
530
- return t._default = e, t;
529
+ const n = this._clone();
530
+ return n._default = e, n;
531
531
  }
532
532
  }
533
- class re extends _ {
533
+ class ae extends P {
534
534
  /** @internal */
535
535
  _minLength;
536
536
  /** @internal */
@@ -547,26 +547,26 @@ class re extends _ {
547
547
  return {
548
548
  issues: [{ message: `Expected string, got ${typeof e}` }]
549
549
  };
550
- const t = this._trim ? e.trim() : e;
551
- return this._minLength !== void 0 && t.length < this._minLength ? {
550
+ const n = this._trim ? e.trim() : e;
551
+ return this._minLength !== void 0 && n.length < this._minLength ? {
552
552
  issues: [
553
553
  { message: `String must be at least ${this._minLength} characters` }
554
554
  ]
555
- } : this._maxLength !== void 0 && t.length > this._maxLength ? {
555
+ } : this._maxLength !== void 0 && n.length > this._maxLength ? {
556
556
  issues: [
557
557
  { message: `String must be at most ${this._maxLength} characters` }
558
558
  ]
559
- } : this._pattern && !ot(this._pattern, t) ? {
559
+ } : this._pattern && !mt(this._pattern, n) ? {
560
560
  issues: [
561
561
  {
562
562
  message: this._patternMessage || `String must match pattern ${this._pattern}`
563
563
  }
564
564
  ]
565
- } : { value: t };
565
+ } : { value: n };
566
566
  }
567
567
  /** @internal */
568
568
  _clone() {
569
- const e = new re();
569
+ const e = new ae();
570
570
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e._minLength = this._minLength, e._maxLength = this._maxLength, e._pattern = this._pattern, e._patternMessage = this._patternMessage, e._trim = this._trim, e;
571
571
  }
572
572
  /**
@@ -580,8 +580,8 @@ class re extends _ {
580
580
  * ```
581
581
  */
582
582
  min(e) {
583
- const t = this._clone();
584
- return t._minLength = e, t;
583
+ const n = this._clone();
584
+ return n._minLength = e, n;
585
585
  }
586
586
  /**
587
587
  * Requires maximum string length.
@@ -594,8 +594,8 @@ class re extends _ {
594
594
  * ```
595
595
  */
596
596
  max(e) {
597
- const t = this._clone();
598
- return t._maxLength = e, t;
597
+ const n = this._clone();
598
+ return n._maxLength = e, n;
599
599
  }
600
600
  /**
601
601
  * Requires exact string length.
@@ -608,8 +608,8 @@ class re extends _ {
608
608
  * ```
609
609
  */
610
610
  length(e) {
611
- const t = this._clone();
612
- return t._minLength = e, t._maxLength = e, t;
611
+ const n = this._clone();
612
+ return n._minLength = e, n._maxLength = e, n;
613
613
  }
614
614
  /**
615
615
  * Requires string to match a regex pattern.
@@ -622,9 +622,9 @@ class re extends _ {
622
622
  * slug: prop.string().pattern(/^[a-z0-9-]+$/, 'Invalid slug format')
623
623
  * ```
624
624
  */
625
- pattern(e, t) {
625
+ pattern(e, n) {
626
626
  const s = this._clone();
627
- return s._pattern = e, s._patternMessage = t, s;
627
+ return s._pattern = e, s._patternMessage = n, s;
628
628
  }
629
629
  /**
630
630
  * Validates as email address.
@@ -691,7 +691,7 @@ class re extends _ {
691
691
  return e._minLength = 1, e;
692
692
  }
693
693
  }
694
- class ie extends _ {
694
+ class ce extends P {
695
695
  /** @internal */
696
696
  _min;
697
697
  /** @internal */
@@ -706,7 +706,7 @@ class ie extends _ {
706
706
  }
707
707
  /** @internal */
708
708
  _clone() {
709
- const e = new ie();
709
+ const e = new ce();
710
710
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e._min = this._min, e._max = this._max, e._int = this._int, e;
711
711
  }
712
712
  /**
@@ -720,8 +720,8 @@ class ie extends _ {
720
720
  * ```
721
721
  */
722
722
  min(e) {
723
- const t = this._clone();
724
- return t._min = e, t;
723
+ const n = this._clone();
724
+ return n._min = e, n;
725
725
  }
726
726
  /**
727
727
  * Requires maximum value.
@@ -734,8 +734,8 @@ class ie extends _ {
734
734
  * ```
735
735
  */
736
736
  max(e) {
737
- const t = this._clone();
738
- return t._max = e, t;
737
+ const n = this._clone();
738
+ return n._max = e, n;
739
739
  }
740
740
  /**
741
741
  * Requires integer value.
@@ -786,7 +786,7 @@ class ie extends _ {
786
786
  return e._max = -Number.MIN_VALUE, e;
787
787
  }
788
788
  }
789
- class oe extends _ {
789
+ class ue extends P {
790
790
  /** @internal */
791
791
  _validate(e) {
792
792
  return typeof e != "boolean" ? {
@@ -795,11 +795,11 @@ class oe extends _ {
795
795
  }
796
796
  /** @internal */
797
797
  _clone() {
798
- const e = new oe();
798
+ const e = new ue();
799
799
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e;
800
800
  }
801
801
  }
802
- class ae extends _ {
802
+ class le extends P {
803
803
  /** @internal */
804
804
  _validate(e) {
805
805
  return typeof e != "function" ? {
@@ -808,11 +808,11 @@ class ae extends _ {
808
808
  }
809
809
  /** @internal */
810
810
  _clone() {
811
- const e = new ae();
811
+ const e = new le();
812
812
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e;
813
813
  }
814
814
  }
815
- class W extends _ {
815
+ class V extends P {
816
816
  /** @internal */
817
817
  _itemSchema;
818
818
  /** @internal */
@@ -838,7 +838,7 @@ class W extends _ {
838
838
  ]
839
839
  };
840
840
  if (this._itemSchema) {
841
- const t = [];
841
+ const n = [];
842
842
  for (let s = 0; s < e.length; s++) {
843
843
  const r = this._itemSchema["~standard"].validate(e[s]);
844
844
  if (r instanceof Promise)
@@ -852,15 +852,15 @@ class W extends _ {
852
852
  path: [s, ...i.path || []]
853
853
  }))
854
854
  };
855
- t.push(r.value);
855
+ n.push(r.value);
856
856
  }
857
- return { value: t };
857
+ return { value: n };
858
858
  }
859
859
  return { value: e };
860
860
  }
861
861
  /** @internal */
862
862
  _clone() {
863
- const e = new W();
863
+ const e = new V();
864
864
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e._itemSchema = this._itemSchema, e._minLength = this._minLength, e._maxLength = this._maxLength, e;
865
865
  }
866
866
  /**
@@ -876,8 +876,8 @@ class W extends _ {
876
876
  * ```
877
877
  */
878
878
  of(e) {
879
- const t = new W();
880
- return t._optional = this._optional, t._nullable = this._nullable, t._itemSchema = e, t._minLength = this._minLength, t._maxLength = this._maxLength, t;
879
+ const n = new V();
880
+ return n._optional = this._optional, n._nullable = this._nullable, n._itemSchema = e, n._minLength = this._minLength, n._maxLength = this._maxLength, n;
881
881
  }
882
882
  /**
883
883
  * Requires minimum array length.
@@ -890,8 +890,8 @@ class W extends _ {
890
890
  * ```
891
891
  */
892
892
  min(e) {
893
- const t = this._clone();
894
- return t._minLength = e, t;
893
+ const n = this._clone();
894
+ return n._minLength = e, n;
895
895
  }
896
896
  /**
897
897
  * Requires maximum array length.
@@ -904,8 +904,8 @@ class W extends _ {
904
904
  * ```
905
905
  */
906
906
  max(e) {
907
- const t = this._clone();
908
- return t._maxLength = e, t;
907
+ const n = this._clone();
908
+ return n._maxLength = e, n;
909
909
  }
910
910
  /**
911
911
  * Requires non-empty array.
@@ -919,7 +919,7 @@ class W extends _ {
919
919
  return this.min(1);
920
920
  }
921
921
  }
922
- class B extends _ {
922
+ class Y extends P {
923
923
  /** @internal */
924
924
  _shape;
925
925
  /** @internal */
@@ -934,18 +934,18 @@ class B extends _ {
934
934
  }
935
935
  ]
936
936
  };
937
- const t = e, s = {};
937
+ const n = e, s = {};
938
938
  if (this._shape) {
939
939
  if (this._strict) {
940
940
  const r = new Set(Object.keys(this._shape));
941
- for (const i of Object.keys(t))
941
+ for (const i of Object.keys(n))
942
942
  if (!r.has(i))
943
943
  return {
944
944
  issues: [{ message: `Unknown key: ${i}`, path: [i] }]
945
945
  };
946
946
  }
947
947
  for (const [r, i] of Object.entries(this._shape)) {
948
- const o = i["~standard"].validate(t[r]);
948
+ const o = i["~standard"].validate(n[r]);
949
949
  if (o instanceof Promise)
950
950
  throw new Error(
951
951
  "Async schema validation is not supported. Use synchronous schemas."
@@ -960,15 +960,15 @@ class B extends _ {
960
960
  s[r] = o.value;
961
961
  }
962
962
  if (!this._strict)
963
- for (const r of Object.keys(t))
964
- r in this._shape || (s[r] = t[r]);
963
+ for (const r of Object.keys(n))
964
+ r in this._shape || (s[r] = n[r]);
965
965
  return { value: s };
966
966
  }
967
967
  return { value: e };
968
968
  }
969
969
  /** @internal */
970
970
  _clone() {
971
- const e = new B();
971
+ const e = new Y();
972
972
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e._shape = this._shape, e._strict = this._strict, e;
973
973
  }
974
974
  /**
@@ -986,8 +986,8 @@ class B extends _ {
986
986
  * ```
987
987
  */
988
988
  shape(e) {
989
- const t = new B();
990
- return t._optional = this._optional, t._nullable = this._nullable, t._shape = e, t._strict = this._strict, t;
989
+ const n = new Y();
990
+ return n._optional = this._optional, n._nullable = this._nullable, n._shape = e, n._strict = this._strict, n;
991
991
  }
992
992
  /**
993
993
  * Rejects objects with unknown keys.
@@ -1002,7 +1002,7 @@ class B extends _ {
1002
1002
  return e._strict = !0, e;
1003
1003
  }
1004
1004
  }
1005
- class ce extends _ {
1005
+ class he extends P {
1006
1006
  /** @internal */
1007
1007
  _value;
1008
1008
  constructor(e) {
@@ -1016,11 +1016,11 @@ class ce extends _ {
1016
1016
  }
1017
1017
  /** @internal */
1018
1018
  _clone() {
1019
- const e = new ce(this._value);
1019
+ const e = new he(this._value);
1020
1020
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e;
1021
1021
  }
1022
1022
  }
1023
- class le extends _ {
1023
+ class de extends P {
1024
1024
  /** @internal */
1025
1025
  _values;
1026
1026
  /** @internal */
@@ -1033,18 +1033,18 @@ class le extends _ {
1033
1033
  return this._valueSet.has(e) ? { value: e } : {
1034
1034
  issues: [
1035
1035
  {
1036
- message: `Expected one of [${this._values.map((t) => JSON.stringify(t)).join(", ")}], got ${JSON.stringify(e)}`
1036
+ message: `Expected one of [${this._values.map((n) => JSON.stringify(n)).join(", ")}], got ${JSON.stringify(e)}`
1037
1037
  }
1038
1038
  ]
1039
1039
  };
1040
1040
  }
1041
1041
  /** @internal */
1042
1042
  _clone() {
1043
- const e = new le(this._values);
1043
+ const e = new de(this._values);
1044
1044
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e;
1045
1045
  }
1046
1046
  }
1047
- class ue extends _ {
1047
+ class fe extends P {
1048
1048
  constructor() {
1049
1049
  super(), this._nullable = !0;
1050
1050
  }
@@ -1054,11 +1054,11 @@ class ue extends _ {
1054
1054
  }
1055
1055
  /** @internal */
1056
1056
  _clone() {
1057
- const e = new ue();
1057
+ const e = new fe();
1058
1058
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e;
1059
1059
  }
1060
1060
  }
1061
- const p = {
1061
+ const f = {
1062
1062
  /**
1063
1063
  * Creates a string schema.
1064
1064
  *
@@ -1071,7 +1071,7 @@ const p = {
1071
1071
  * prop.string().pattern(/^[a-z]+$/)
1072
1072
  * ```
1073
1073
  */
1074
- string: () => new re(),
1074
+ string: () => new ae(),
1075
1075
  /**
1076
1076
  * Creates a number schema.
1077
1077
  *
@@ -1083,7 +1083,7 @@ const p = {
1083
1083
  * prop.number().positive()
1084
1084
  * ```
1085
1085
  */
1086
- number: () => new ie(),
1086
+ number: () => new ce(),
1087
1087
  /**
1088
1088
  * Creates a boolean schema.
1089
1089
  *
@@ -1093,7 +1093,7 @@ const p = {
1093
1093
  * prop.boolean().default(false)
1094
1094
  * ```
1095
1095
  */
1096
- boolean: () => new oe(),
1096
+ boolean: () => new ue(),
1097
1097
  /**
1098
1098
  * Creates a function schema.
1099
1099
  *
@@ -1106,7 +1106,7 @@ const p = {
1106
1106
  * prop.function<(data: { id: string }) => Promise<void>>()
1107
1107
  * ```
1108
1108
  */
1109
- function: () => new ae(),
1109
+ function: () => new le(),
1110
1110
  /**
1111
1111
  * Creates an array schema.
1112
1112
  *
@@ -1119,7 +1119,7 @@ const p = {
1119
1119
  * prop.array().of(prop.number()).min(1).max(10)
1120
1120
  * ```
1121
1121
  */
1122
- array: () => new W(),
1122
+ array: () => new V(),
1123
1123
  /**
1124
1124
  * Creates an object schema.
1125
1125
  *
@@ -1135,7 +1135,7 @@ const p = {
1135
1135
  * prop.object().shape({ key: prop.string() }).strict()
1136
1136
  * ```
1137
1137
  */
1138
- object: () => new B(),
1138
+ object: () => new Y(),
1139
1139
  /**
1140
1140
  * Creates a literal schema for exact value matching.
1141
1141
  *
@@ -1148,7 +1148,7 @@ const p = {
1148
1148
  * prop.literal(true)
1149
1149
  * ```
1150
1150
  */
1151
- literal: (n) => new ce(n),
1151
+ literal: (t) => new he(t),
1152
1152
  /**
1153
1153
  * Creates an enum schema for a set of allowed values.
1154
1154
  *
@@ -1160,7 +1160,7 @@ const p = {
1160
1160
  * prop.enum([1, 2, 3])
1161
1161
  * ```
1162
1162
  */
1163
- enum: (n) => new le(n),
1163
+ enum: (t) => new de(t),
1164
1164
  /**
1165
1165
  * Creates a schema that accepts any value.
1166
1166
  *
@@ -1172,93 +1172,93 @@ const p = {
1172
1172
  * prop.any()
1173
1173
  * ```
1174
1174
  */
1175
- any: () => new ue()
1176
- }, O = {
1175
+ any: () => new fe()
1176
+ }, R = {
1177
1177
  uid: {
1178
- schema: p.string().optional(),
1178
+ schema: f.string().optional(),
1179
1179
  sendToHost: !0
1180
1180
  },
1181
1181
  tag: {
1182
- schema: p.string().optional(),
1182
+ schema: f.string().optional(),
1183
1183
  sendToHost: !0
1184
1184
  },
1185
1185
  dimensions: {
1186
- schema: p.object().default(() => ({ width: "100%", height: "100%" })),
1186
+ schema: f.object().default(() => ({ width: "100%", height: "100%" })),
1187
1187
  sendToHost: !1
1188
1188
  },
1189
1189
  timeout: {
1190
- schema: p.number().default(1e4),
1190
+ schema: f.number().default(1e4),
1191
1191
  sendToHost: !1
1192
1192
  },
1193
1193
  cspNonce: {
1194
- schema: p.string().optional(),
1194
+ schema: f.string().optional(),
1195
1195
  sendToHost: !0
1196
1196
  },
1197
1197
  // Lifecycle callbacks - not sent to host (consumer-only)
1198
1198
  onDisplay: {
1199
- schema: p.function().optional(),
1199
+ schema: f.function().optional(),
1200
1200
  sendToHost: !1
1201
1201
  },
1202
1202
  onRendered: {
1203
- schema: p.function().optional(),
1203
+ schema: f.function().optional(),
1204
1204
  sendToHost: !1
1205
1205
  },
1206
1206
  onRender: {
1207
- schema: p.function().optional(),
1207
+ schema: f.function().optional(),
1208
1208
  sendToHost: !1
1209
1209
  },
1210
1210
  onPrerendered: {
1211
- schema: p.function().optional(),
1211
+ schema: f.function().optional(),
1212
1212
  sendToHost: !1
1213
1213
  },
1214
1214
  onPrerender: {
1215
- schema: p.function().optional(),
1215
+ schema: f.function().optional(),
1216
1216
  sendToHost: !1
1217
1217
  },
1218
1218
  onClose: {
1219
- schema: p.function().optional(),
1219
+ schema: f.function().optional(),
1220
1220
  sendToHost: !1
1221
1221
  },
1222
1222
  onDestroy: {
1223
- schema: p.function().optional(),
1223
+ schema: f.function().optional(),
1224
1224
  sendToHost: !1
1225
1225
  },
1226
1226
  onResize: {
1227
- schema: p.function().optional(),
1227
+ schema: f.function().optional(),
1228
1228
  sendToHost: !1
1229
1229
  },
1230
1230
  onFocus: {
1231
- schema: p.function().optional(),
1231
+ schema: f.function().optional(),
1232
1232
  sendToHost: !1
1233
1233
  },
1234
1234
  onError: {
1235
- schema: p.function().optional(),
1235
+ schema: f.function().optional(),
1236
1236
  sendToHost: !1
1237
1237
  },
1238
1238
  onProps: {
1239
- schema: p.function().optional(),
1239
+ schema: f.function().optional(),
1240
1240
  sendToHost: !1
1241
1241
  }
1242
1242
  };
1243
- function x(n) {
1244
- return typeof n == "object" && n !== null && "~standard" in n && typeof n["~standard"] == "object" && n["~standard"] !== null && n["~standard"].version === 1 && typeof n["~standard"].vendor == "string" && typeof n["~standard"].validate == "function";
1243
+ function D(t) {
1244
+ return typeof t == "object" && t !== null && "~standard" in t && typeof t["~standard"] == "object" && t["~standard"] !== null && t["~standard"].version === 1 && typeof t["~standard"].vendor == "string" && typeof t["~standard"].validate == "function";
1245
1245
  }
1246
- function at(n, e, t) {
1247
- const s = n["~standard"].validate(e);
1246
+ function gt(t, e, n) {
1247
+ const s = t["~standard"].validate(e);
1248
1248
  if (s instanceof Promise)
1249
1249
  throw new Error(
1250
- `Prop "${t}" uses an async schema. ForgeFrame only supports synchronous schema validation. Please use a synchronous schema or remove async operations (like database lookups) from your schema definition.`
1250
+ `Prop "${n}" uses an async schema. ForgeFrame only supports synchronous schema validation. Please use a synchronous schema or remove async operations (like database lookups) from your schema definition.`
1251
1251
  );
1252
1252
  if (s.issues) {
1253
- const r = s.issues.map((i) => `${ct(i.path, t)}: ${i.message}`);
1253
+ const r = s.issues.map((i) => `${yt(i.path, n)}: ${i.message}`);
1254
1254
  throw new Error(`Validation failed: ${r.join("; ")}`);
1255
1255
  }
1256
1256
  return s.value;
1257
1257
  }
1258
- function ct(n, e) {
1259
- if (!n || n.length === 0)
1258
+ function yt(t, e) {
1259
+ if (!t || t.length === 0)
1260
1260
  return e;
1261
- const t = n.map((s) => {
1261
+ const n = t.map((s) => {
1262
1262
  if (typeof s == "object" && s !== null) {
1263
1263
  if ("key" in s && s.key !== void 0)
1264
1264
  return String(s.key);
@@ -1267,104 +1267,104 @@ function ct(n, e) {
1267
1267
  }
1268
1268
  return String(s);
1269
1269
  });
1270
- return `${e}.${t.join(".")}`;
1270
+ return `${e}.${n.join(".")}`;
1271
1271
  }
1272
- function N(n) {
1273
- const e = x(n);
1274
- return { isDirectSchema: e, definition: e ? { schema: n } : n };
1272
+ function F(t) {
1273
+ const e = D(t);
1274
+ return { isDirectSchema: e, definition: e ? { schema: t } : t };
1275
1275
  }
1276
- function Pe(n, e, t) {
1276
+ function Se(t, e, n) {
1277
1277
  const s = {
1278
- ...O,
1278
+ ...R,
1279
1279
  ...e
1280
1280
  }, r = {};
1281
1281
  for (const [i, o] of Object.entries(s)) {
1282
- const { definition: a } = N(o);
1282
+ const { definition: a } = F(o);
1283
1283
  let c;
1284
- const l = a.alias, m = i in n, h = l && l in n;
1285
- if (m)
1286
- c = n[i];
1287
- else if (h)
1288
- c = n[l];
1284
+ const u = a.alias, d = i in t, m = u && u in t;
1285
+ if (d)
1286
+ c = t[i];
1287
+ else if (m)
1288
+ c = t[u];
1289
1289
  else if (a.value)
1290
- c = a.value(t);
1290
+ c = a.value(n);
1291
1291
  else if (a.default !== void 0)
1292
- c = typeof a.default == "function" ? a.default(t) : a.default;
1293
- else if (a.schema && x(a.schema)) {
1294
- const d = a.schema["~standard"].validate(void 0);
1295
- !(d instanceof Promise) && !d.issues && (c = d.value);
1292
+ c = typeof a.default == "function" ? a.default(n) : a.default;
1293
+ else if (a.schema && D(a.schema)) {
1294
+ const h = a.schema["~standard"].validate(void 0);
1295
+ !(h instanceof Promise) && !h.issues && (c = h.value);
1296
1296
  }
1297
1297
  c !== void 0 && a.decorate && (c = a.decorate({ value: c, props: r })), r[i] = c;
1298
1298
  }
1299
1299
  return r;
1300
1300
  }
1301
- function S(n, e) {
1302
- const t = {
1303
- ...O,
1301
+ function T(t, e) {
1302
+ const n = {
1303
+ ...R,
1304
1304
  ...e
1305
1305
  };
1306
- for (const [s, r] of Object.entries(t)) {
1307
- const { isDirectSchema: i, definition: o } = N(r);
1308
- let a = n[s];
1306
+ for (const [s, r] of Object.entries(n)) {
1307
+ const { isDirectSchema: i, definition: o } = F(r);
1308
+ let a = t[s];
1309
1309
  if (o.required && a === void 0)
1310
1310
  throw new Error(`Prop "${s}" is required but was not provided`);
1311
- if (o.schema && x(o.schema))
1312
- (a !== void 0 || i) && (a = at(o.schema, a, s), n[s] = a);
1311
+ if (o.schema && D(o.schema))
1312
+ (a !== void 0 || i) && (a = gt(o.schema, a, s), t[s] = a);
1313
1313
  else if (a === void 0)
1314
1314
  continue;
1315
- o.validate && o.validate({ value: a, props: n });
1315
+ o.validate && o.validate({ value: a, props: t });
1316
1316
  }
1317
1317
  }
1318
- function Ee(n, e, t, s) {
1318
+ function Ie(t, e, n, s) {
1319
1319
  const r = {
1320
- ...O,
1320
+ ...R,
1321
1321
  ...e
1322
1322
  }, i = {};
1323
1323
  for (const [o, a] of Object.entries(r)) {
1324
- const { definition: c } = N(a), l = n[o];
1324
+ const { definition: c } = F(a), u = t[o];
1325
1325
  if (c.sendToHost === !1 || c.sameDomain && !s) continue;
1326
1326
  if (c.trustedDomains) {
1327
- const h = c.trustedDomains;
1328
- if (!v(h, t)) continue;
1327
+ const m = c.trustedDomains;
1328
+ if (!U(m, n)) continue;
1329
1329
  }
1330
- let m = l;
1331
- c.hostDecorate && l !== void 0 && (m = c.hostDecorate({ value: l, props: n })), i[o] = m;
1330
+ let d = u;
1331
+ c.hostDecorate && u !== void 0 && (d = c.hostDecorate({ value: u, props: t })), i[o] = d;
1332
1332
  }
1333
1333
  return i;
1334
1334
  }
1335
- function lt(n, e) {
1336
- const t = new URLSearchParams(), s = {
1337
- ...O,
1335
+ function wt(t, e) {
1336
+ const n = new URLSearchParams(), s = {
1337
+ ...R,
1338
1338
  ...e
1339
1339
  };
1340
1340
  for (const [r, i] of Object.entries(s)) {
1341
- const { definition: o } = N(i), a = n[r];
1341
+ const { definition: o } = F(i), a = t[r];
1342
1342
  if (a === void 0 || typeof a == "function" || !o.queryParam) continue;
1343
1343
  const c = typeof o.queryParam == "string" ? o.queryParam : r;
1344
- let l;
1345
- typeof o.queryParam == "function" ? l = o.queryParam({ value: a }) : typeof a == "object" ? l = JSON.stringify(a) : l = String(a), t.set(c, l);
1344
+ let u;
1345
+ typeof o.queryParam == "function" ? u = o.queryParam({ value: a }) : typeof a == "object" ? u = JSON.stringify(a) : u = String(a), n.set(c, u);
1346
1346
  }
1347
- return t;
1347
+ return n;
1348
1348
  }
1349
- function ut(n, e) {
1350
- const t = new URLSearchParams(), s = {
1351
- ...O,
1349
+ function _t(t, e) {
1350
+ const n = new URLSearchParams(), s = {
1351
+ ...R,
1352
1352
  ...e
1353
1353
  };
1354
1354
  for (const [r, i] of Object.entries(s)) {
1355
- const { definition: o } = N(i), a = n[r];
1355
+ const { definition: o } = F(i), a = t[r];
1356
1356
  if (a === void 0 || typeof a == "function" || !o.bodyParam) continue;
1357
1357
  const c = typeof o.bodyParam == "string" ? o.bodyParam : r;
1358
- let l;
1359
- typeof o.bodyParam == "function" ? l = o.bodyParam({ value: a }) : typeof a == "object" ? l = JSON.stringify(a) : l = String(a), t.set(c, l);
1358
+ let u;
1359
+ typeof o.bodyParam == "function" ? u = o.bodyParam({ value: a }) : typeof a == "object" ? u = JSON.stringify(a) : u = String(a), n.set(c, u);
1360
1360
  }
1361
- return t;
1361
+ return n;
1362
1362
  }
1363
- const be = 500, ht = /* @__PURE__ */ new Set(["__proto__"]);
1364
- function Te(n) {
1365
- return !ht.has(n);
1363
+ const ve = 500, Pt = /* @__PURE__ */ new Set(["__proto__"]);
1364
+ function ze(t) {
1365
+ return !Pt.has(t);
1366
1366
  }
1367
- class he {
1367
+ class pe {
1368
1368
  /**
1369
1369
  * Creates a new FunctionBridge instance.
1370
1370
  *
@@ -1390,16 +1390,16 @@ class he {
1390
1390
  * @param name - Optional name for debugging
1391
1391
  * @returns A function reference that can be sent across domains
1392
1392
  */
1393
- serialize(e, t) {
1394
- if (this.localFunctions.size >= be) {
1393
+ serialize(e, n) {
1394
+ if (this.localFunctions.size >= ve) {
1395
1395
  const r = this.localFunctions.keys().next().value;
1396
1396
  r && this.localFunctions.delete(r);
1397
1397
  }
1398
- const s = L();
1398
+ const s = k();
1399
1399
  return this.localFunctions.set(s, e), this.currentBatchIds.add(s), {
1400
1400
  __type__: "function",
1401
1401
  __id__: s,
1402
- __name__: t || e.name || "anonymous"
1402
+ __name__: n || e.name || "anonymous"
1403
1403
  };
1404
1404
  }
1405
1405
  /**
@@ -1414,14 +1414,14 @@ class he {
1414
1414
  * @param targetDomain - The origin of the target window
1415
1415
  * @returns A callable wrapper function
1416
1416
  */
1417
- deserialize(e, t, s) {
1417
+ deserialize(e, n, s) {
1418
1418
  const r = `${e.__id__}`, i = this.remoteFunctions.get(r);
1419
1419
  if (i) return i;
1420
- if (this.remoteFunctions.size >= be) {
1420
+ if (this.remoteFunctions.size >= ve) {
1421
1421
  const a = this.remoteFunctions.keys().next().value;
1422
1422
  a && this.remoteFunctions.delete(a);
1423
1423
  }
1424
- const o = async (...a) => this.messenger.send(t, s, u.CALL, {
1424
+ const o = async (...a) => this.messenger.send(n, s, l.CALL, {
1425
1425
  id: e.__id__,
1426
1426
  args: a
1427
1427
  });
@@ -1445,12 +1445,12 @@ class he {
1445
1445
  */
1446
1446
  setupCallHandler() {
1447
1447
  this.messenger.on(
1448
- u.CALL,
1449
- async ({ id: e, args: t }) => {
1448
+ l.CALL,
1449
+ async ({ id: e, args: n }) => {
1450
1450
  const s = this.localFunctions.get(e);
1451
1451
  if (!s)
1452
1452
  throw new Error(`Function with id "${e}" not found`);
1453
- return s(...t);
1453
+ return s(...n);
1454
1454
  }
1455
1455
  );
1456
1456
  }
@@ -1493,8 +1493,8 @@ class he {
1493
1493
  this.currentBatchIds.clear();
1494
1494
  return;
1495
1495
  }
1496
- for (const t of this.localFunctions.keys())
1497
- this.currentBatchIds.has(t) || this.localFunctions.delete(t);
1496
+ for (const n of this.localFunctions.keys())
1497
+ this.currentBatchIds.has(n) || this.localFunctions.delete(n);
1498
1498
  this.currentBatchIds.clear();
1499
1499
  }
1500
1500
  /**
@@ -1528,163 +1528,191 @@ class he {
1528
1528
  this.localFunctions.clear(), this.remoteFunctions.clear(), this.currentBatchIds.clear();
1529
1529
  }
1530
1530
  }
1531
- function Q(n, e, t = /* @__PURE__ */ new WeakSet()) {
1532
- if (typeof n == "function")
1533
- return e.serialize(n);
1534
- if (Array.isArray(n)) {
1535
- if (t.has(n))
1531
+ function se(t, e, n = /* @__PURE__ */ new WeakSet()) {
1532
+ if (typeof t == "function")
1533
+ return e.serialize(t);
1534
+ if (Array.isArray(t)) {
1535
+ if (n.has(t))
1536
1536
  throw new Error("Circular reference detected in props - arrays cannot contain circular references");
1537
- t.add(n);
1537
+ n.add(t);
1538
1538
  try {
1539
- return n.map((s) => Q(s, e, t));
1539
+ return t.map((s) => se(s, e, n));
1540
1540
  } finally {
1541
- t.delete(n);
1541
+ n.delete(t);
1542
1542
  }
1543
1543
  }
1544
- if (typeof n == "object" && n !== null) {
1545
- if (t.has(n))
1544
+ if (typeof t == "object" && t !== null) {
1545
+ if (n.has(t))
1546
1546
  throw new Error("Circular reference detected in props - objects cannot contain circular references");
1547
- t.add(n);
1547
+ n.add(t);
1548
1548
  try {
1549
1549
  const s = {};
1550
- for (const [r, i] of Object.entries(n))
1551
- Te(r) && (s[r] = Q(i, e, t));
1550
+ for (const [r, i] of Object.entries(t))
1551
+ ze(r) && (s[r] = se(i, e, n));
1552
1552
  return s;
1553
1553
  } finally {
1554
- t.delete(n);
1554
+ n.delete(t);
1555
1555
  }
1556
1556
  }
1557
- return n;
1557
+ return t;
1558
1558
  }
1559
- function ee(n, e, t, s, r = /* @__PURE__ */ new WeakSet()) {
1560
- if (he.isFunctionRef(n))
1561
- return e.deserialize(n, t, s);
1562
- if (Array.isArray(n)) {
1563
- if (r.has(n))
1559
+ function re(t, e, n, s, r = /* @__PURE__ */ new WeakSet()) {
1560
+ if (pe.isFunctionRef(t))
1561
+ return e.deserialize(t, n, s);
1562
+ if (Array.isArray(t)) {
1563
+ if (r.has(t))
1564
1564
  throw new Error("Circular reference detected in serialized props");
1565
- r.add(n);
1565
+ r.add(t);
1566
1566
  try {
1567
- return n.map(
1568
- (i) => ee(i, e, t, s, r)
1567
+ return t.map(
1568
+ (i) => re(i, e, n, s, r)
1569
1569
  );
1570
1570
  } finally {
1571
- r.delete(n);
1571
+ r.delete(t);
1572
1572
  }
1573
1573
  }
1574
- if (typeof n == "object" && n !== null) {
1575
- if (r.has(n))
1574
+ if (typeof t == "object" && t !== null) {
1575
+ if (r.has(t))
1576
1576
  throw new Error("Circular reference detected in serialized props");
1577
- r.add(n);
1577
+ r.add(t);
1578
1578
  try {
1579
1579
  const i = {};
1580
- for (const [o, a] of Object.entries(n))
1581
- Te(o) && (i[o] = ee(a, e, t, s, r));
1580
+ for (const [o, a] of Object.entries(t))
1581
+ ze(o) && (i[o] = re(a, e, n, s, r));
1582
1582
  return i;
1583
1583
  } finally {
1584
- r.delete(n);
1584
+ r.delete(t);
1585
1585
  }
1586
1586
  }
1587
- return n;
1587
+ return t;
1588
1588
  }
1589
- const dt = /* @__PURE__ */ new Set(["__proto__"]), te = "__forgeframe.dotify_path__:";
1590
- function Ue(n) {
1591
- return !dt.has(n);
1589
+ const Et = /* @__PURE__ */ new Set(["__proto__"]), ke = "__forgeframe.dotify_path__:", J = "__forgeframe.dotify_empty_object_path__:", We = "__forgeframe.dotify_empty_object__";
1590
+ function je(t) {
1591
+ return !Et.has(t);
1592
1592
  }
1593
- function Ne(n, e = []) {
1594
- const t = [];
1595
- for (const [s, r] of Object.entries(n)) {
1596
- const i = [...e, s];
1597
- if (r !== null && typeof r == "object" && !Array.isArray(r))
1598
- t.push(Ne(r, i));
1599
- else {
1600
- const o = `${te}${encodeURIComponent(
1601
- JSON.stringify(i)
1602
- )}`, a = encodeURIComponent(JSON.stringify(r));
1603
- t.push(`${o}=${a}`);
1604
- }
1593
+ function Te(t) {
1594
+ if (t === null || typeof t != "object" || Array.isArray(t))
1595
+ return !1;
1596
+ const e = Object.getPrototypeOf(t);
1597
+ return e === Object.prototype || e === null;
1598
+ }
1599
+ function Be(t, e = ke) {
1600
+ return `${e}${encodeURIComponent(JSON.stringify(t))}`;
1601
+ }
1602
+ function bt(t) {
1603
+ return encodeURIComponent(JSON.stringify(t));
1604
+ }
1605
+ function Ct(t, e) {
1606
+ return `${Be(t)}=${bt(e)}`;
1607
+ }
1608
+ function Ot(t) {
1609
+ return `${Be(t, J)}=1`;
1610
+ }
1611
+ function Rt(t, e, n) {
1612
+ Object.defineProperty(t, e, {
1613
+ configurable: !0,
1614
+ enumerable: !0,
1615
+ writable: !0,
1616
+ value: n
1617
+ });
1618
+ }
1619
+ function Ve(t, e = []) {
1620
+ const n = Object.entries(t);
1621
+ if (n.length === 0 && Te(t))
1622
+ return e.length === 0 ? We : Ot(e);
1623
+ const s = [];
1624
+ for (const [r, i] of n) {
1625
+ if (i === void 0) continue;
1626
+ const o = [...e, r];
1627
+ Te(i) ? s.push(Ve(i, o)) : s.push(Ct(o, i));
1605
1628
  }
1606
- return t.filter(Boolean).join("&");
1629
+ return s.filter(Boolean).join("&");
1607
1630
  }
1608
- function pt(n) {
1631
+ function xt(t) {
1609
1632
  const e = {};
1610
- if (!n) return e;
1611
- const t = n.split("&");
1612
- for (const s of t) {
1633
+ if (!t || t === We) return e;
1634
+ const n = t.split("&");
1635
+ for (const s of n) {
1613
1636
  const r = s.indexOf("=");
1614
1637
  if (r === -1) continue;
1615
1638
  const i = s.slice(0, r), o = s.slice(r + 1);
1616
1639
  if (!i || o === void 0) continue;
1617
- let a;
1618
- try {
1619
- a = JSON.parse(decodeURIComponent(o));
1620
- } catch {
1621
- a = decodeURIComponent(o);
1622
- }
1623
- const c = ft(i);
1624
- if (c.some((h) => !Ue(h))) continue;
1625
- let l = e;
1626
- for (let h = 0; h < c.length - 1; h++) {
1627
- const d = c[h], C = l[d];
1628
- (!Object.prototype.hasOwnProperty.call(l, d) || typeof C != "object" || C === null || Array.isArray(C)) && (l[d] = {}), l = l[d];
1640
+ const a = i.startsWith(J);
1641
+ let c;
1642
+ if (a) {
1643
+ if (o !== "1")
1644
+ throw new Error("Invalid empty-object DOTIFY entry");
1645
+ c = {};
1646
+ } else
1647
+ try {
1648
+ c = JSON.parse(decodeURIComponent(o));
1649
+ } catch {
1650
+ c = decodeURIComponent(o);
1651
+ }
1652
+ const u = Dt(i);
1653
+ if (u.some((h) => !je(h))) continue;
1654
+ let d = e;
1655
+ for (let h = 0; h < u.length - 1; h++) {
1656
+ const E = u[h], C = d[E];
1657
+ (!Object.prototype.hasOwnProperty.call(d, E) || typeof C != "object" || C === null || Array.isArray(C)) && (d[E] = {}), d = d[E];
1629
1658
  }
1630
- const m = c[c.length - 1];
1631
- l[m] = a;
1659
+ const m = u[u.length - 1];
1660
+ Rt(d, m, c);
1632
1661
  }
1633
1662
  return e;
1634
1663
  }
1635
- function ft(n) {
1636
- if (!n.startsWith(te))
1664
+ function Dt(t) {
1665
+ const e = t.startsWith(J) ? J : ke;
1666
+ if (!t.startsWith(e))
1637
1667
  throw new Error("Invalid DOTIFY path framing");
1638
- const e = decodeURIComponent(
1639
- n.slice(te.length)
1640
- ), t = JSON.parse(e);
1641
- if (Array.isArray(t) && t.length > 0 && t.every((s) => typeof s == "string"))
1642
- return t;
1668
+ const n = decodeURIComponent(t.slice(e.length)), s = JSON.parse(n);
1669
+ if (Array.isArray(s) && s.length > 0 && s.every((r) => typeof r == "string"))
1670
+ return s;
1643
1671
  throw new Error("Invalid DOTIFY path framing");
1644
1672
  }
1645
- function mt(n) {
1646
- return typeof n == "object" && n !== null && n.__type__ === "dotify" && typeof n.__value__ == "string";
1673
+ function St(t) {
1674
+ return typeof t == "object" && t !== null && t.__type__ === "dotify" && typeof t.__value__ == "string";
1647
1675
  }
1648
- function gt(n, e, t) {
1676
+ function It(t, e, n) {
1649
1677
  const s = {
1650
- ...O,
1678
+ ...R,
1651
1679
  ...e
1652
1680
  }, r = {};
1653
- for (const [i, o] of Object.entries(n)) {
1681
+ for (const [i, o] of Object.entries(t)) {
1654
1682
  if (o === void 0) continue;
1655
1683
  const a = s[i];
1656
- r[i] = yt(o, a, t);
1684
+ r[i] = vt(o, a, n);
1657
1685
  }
1658
1686
  return r;
1659
1687
  }
1660
- function yt(n, e, t) {
1661
- if (typeof n == "function")
1662
- return t.serialize(n);
1663
- const s = e?.serialization ?? A.JSON;
1664
- if (s === A.BASE64 && typeof n == "object") {
1665
- const r = JSON.stringify(n);
1688
+ function vt(t, e, n) {
1689
+ if (typeof t == "function")
1690
+ return n.serialize(t);
1691
+ const s = e?.serialization ?? z.JSON;
1692
+ if (s === z.BASE64 && typeof t == "object") {
1693
+ const r = JSON.stringify(t);
1666
1694
  return {
1667
1695
  __type__: "base64",
1668
1696
  __value__: btoa(encodeURIComponent(r))
1669
1697
  };
1670
1698
  }
1671
- return s === A.DOTIFY && typeof n == "object" && n !== null && !Array.isArray(n) ? {
1699
+ return s === z.DOTIFY && typeof t == "object" && t !== null && !Array.isArray(t) ? {
1672
1700
  __type__: "dotify",
1673
- __value__: Ne(n)
1674
- } : Q(n, t);
1701
+ __value__: Ve(t)
1702
+ } : se(t, n);
1675
1703
  }
1676
- function Oe(n, e, t, s, r, i) {
1704
+ function Ue(t, e, n, s, r, i) {
1677
1705
  const o = {
1678
- ...O,
1706
+ ...R,
1679
1707
  ...e
1680
1708
  }, a = {};
1681
- for (const [c, l] of Object.entries(n)) {
1682
- if (!Ue(c)) continue;
1683
- const m = o[c];
1684
- a[c] = wt(
1685
- l,
1686
- m,
1687
- t,
1709
+ for (const [c, u] of Object.entries(t)) {
1710
+ if (!je(c)) continue;
1711
+ const d = o[c];
1712
+ a[c] = Tt(
1713
+ u,
1714
+ d,
1715
+ n,
1688
1716
  s,
1689
1717
  r,
1690
1718
  i
@@ -1692,30 +1720,30 @@ function Oe(n, e, t, s, r, i) {
1692
1720
  }
1693
1721
  return a;
1694
1722
  }
1695
- function wt(n, e, t, s, r, i) {
1696
- if (_t(n))
1723
+ function Tt(t, e, n, s, r, i) {
1724
+ if (Ut(t))
1697
1725
  try {
1698
- const o = decodeURIComponent(atob(n.__value__));
1726
+ const o = decodeURIComponent(atob(t.__value__));
1699
1727
  return JSON.parse(o);
1700
1728
  } catch {
1701
- return n;
1729
+ return t;
1702
1730
  }
1703
- if (mt(n))
1731
+ if (St(t))
1704
1732
  try {
1705
- return pt(n.__value__);
1733
+ return xt(t.__value__);
1706
1734
  } catch {
1707
- return n;
1735
+ return t;
1708
1736
  }
1709
- return ee(n, s, r, i);
1737
+ return re(t, s, r, i);
1710
1738
  }
1711
- function _t(n) {
1712
- return typeof n == "object" && n !== null && n.__type__ === "base64" && typeof n.__value__ == "string";
1739
+ function Ut(t) {
1740
+ return typeof t == "object" && t !== null && t.__type__ === "base64" && typeof t.__value__ == "string";
1713
1741
  }
1714
- class Pt {
1715
- constructor(e, t, s) {
1716
- this.options = e, this.createPropContext = s, this.inputProps = { ...t };
1742
+ class Ht {
1743
+ constructor(e, n, s) {
1744
+ this.options = e, this.createPropContext = s, this.inputProps = { ...n };
1717
1745
  const r = this.inputProps, i = this.createPropContext(r);
1718
- this.props = Pe(r, this.options.props, i);
1746
+ this.props = Se(r, this.options.props, i);
1719
1747
  }
1720
1748
  /** Current normalized prop snapshot. */
1721
1749
  props;
@@ -1727,17 +1755,17 @@ class Pt {
1727
1755
  * Builds and validates the next props snapshot.
1728
1756
  */
1729
1757
  buildNextProps(e) {
1730
- const t = { ...this.inputProps, ...e }, s = { ...this.props, ...e }, r = this.createPropContext(s), i = Pe(s, this.options.props, r);
1731
- return S(i, this.options.props), this.options.validate?.({ props: i }), { nextInputProps: t, nextProps: i };
1758
+ const n = { ...this.inputProps, ...e }, s = { ...this.props, ...e }, r = this.createPropContext(s), i = Se(s, this.options.props, r);
1759
+ return T(i, this.options.props), this.options.validate?.({ props: i }), { nextInputProps: n, nextProps: i };
1732
1760
  }
1733
1761
  /**
1734
1762
  * Applies a props update and synchronizes it to the host when connected.
1735
1763
  */
1736
- updateProps(e, t) {
1764
+ updateProps(e, n) {
1737
1765
  return this.queuePropsUpdate(async () => {
1738
- const { nextInputProps: s, nextProps: r } = this.buildNextProps(e), i = t.resolveUrl(r), o = t.resolveUrlOrigin(i);
1739
- t.assertStableRenderedOrigin(o), this.inputProps = s, this.props = r, t.isRendered() || t.syncTrustedDomainForUrl(i), t.shouldSendPropsToHost() && await t.sendPropsUpdateToHost(r), t.emitPropsUpdated(r);
1740
- }, t.shouldSendPropsToHost);
1766
+ const { nextInputProps: s, nextProps: r } = this.buildNextProps(e), i = n.resolveUrl(r), o = n.resolveUrlOrigin(i);
1767
+ n.assertStableRenderedOrigin(o), this.inputProps = s, this.props = r, n.isRendered() || n.syncTrustedDomainForUrl(i), n.shouldSendPropsToHost() && await n.sendPropsUpdateToHost(r), n.emitPropsUpdated(r);
1768
+ }, n.shouldSendPropsToHost);
1741
1769
  }
1742
1770
  /**
1743
1771
  * Queues a host synchronization for the current props snapshot.
@@ -1754,10 +1782,10 @@ class Pt {
1754
1782
  /**
1755
1783
  * Queues prop updates when a previous host sync is in flight.
1756
1784
  */
1757
- queuePropsUpdate(e, t) {
1785
+ queuePropsUpdate(e, n) {
1758
1786
  if (!this.pendingPropsUpdate) {
1759
1787
  const r = e();
1760
- return t() && this.trackPendingUpdate(r), r;
1788
+ return n() && this.trackPendingUpdate(r), r;
1761
1789
  }
1762
1790
  const s = this.pendingPropsUpdate.then(e, e);
1763
1791
  return this.trackPendingUpdate(s), s;
@@ -1766,87 +1794,87 @@ class Pt {
1766
1794
  * Tracks a promise as the active queued update and clears it when settled.
1767
1795
  */
1768
1796
  trackPendingUpdate(e) {
1769
- const t = e.then(
1797
+ const n = e.then(
1770
1798
  () => {
1771
1799
  },
1772
1800
  () => {
1773
1801
  }
1774
1802
  );
1775
- this.pendingPropsUpdate = t, t.finally(() => {
1776
- this.pendingPropsUpdate === t && (this.pendingPropsUpdate = null);
1803
+ this.pendingPropsUpdate = n, n.finally(() => {
1804
+ this.pendingPropsUpdate === n && (this.pendingPropsUpdate = null);
1777
1805
  });
1778
1806
  }
1779
1807
  }
1780
- function R(n, e = "100%") {
1781
- return n === void 0 ? e : typeof n == "number" ? `${n}px` : n;
1808
+ function x(t, e = "100%") {
1809
+ return t === void 0 ? e : typeof t == "number" ? `${t}px` : t;
1782
1810
  }
1783
- function j(n, e) {
1784
- if (n === void 0) return e;
1785
- if (typeof n == "number") return n;
1786
- const t = parseInt(n, 10);
1787
- return isNaN(t) ? e : t;
1811
+ function q(t, e) {
1812
+ if (t === void 0) return e;
1813
+ if (typeof t == "number") return t;
1814
+ const n = parseInt(t, 10);
1815
+ return isNaN(n) ? e : n;
1788
1816
  }
1789
- function Et(n) {
1790
- const { name: e, dimensions: t, attributes: s = {}, style: r = {} } = n, i = document.createElement("iframe");
1791
- return i.name = e, i.setAttribute("frameborder", "0"), i.setAttribute("allowtransparency", "true"), i.setAttribute("scrolling", "auto"), Fe(i, t), Dt(i, s), xt(i, r), It(i, s), i;
1817
+ function Nt(t) {
1818
+ const { name: e, dimensions: n, attributes: s = {}, style: r = {} } = t, i = document.createElement("iframe");
1819
+ return i.name = e, i.setAttribute("frameborder", "0"), i.setAttribute("allowtransparency", "true"), i.setAttribute("scrolling", "auto"), Ye(i, n), zt(i, s), Mt(i, r), kt(i, s), i;
1792
1820
  }
1793
- function bt(n) {
1821
+ function Ft(t) {
1794
1822
  try {
1795
- n.src = "about:blank", n.parentNode?.removeChild(n);
1823
+ t.src = "about:blank", t.parentNode?.removeChild(t);
1796
1824
  } catch {
1797
1825
  }
1798
1826
  }
1799
- function Ot(n, e) {
1800
- Fe(n, e);
1827
+ function $t(t, e) {
1828
+ Ye(t, e);
1801
1829
  }
1802
- function Ct(n) {
1803
- n.style.display = "", n.style.visibility = "visible";
1830
+ function At(t) {
1831
+ t.style.display = "", t.style.visibility = "visible";
1804
1832
  }
1805
- function Ce(n) {
1806
- n.style.display = "none", n.style.visibility = "hidden";
1833
+ function He(t) {
1834
+ t.style.display = "none", t.style.visibility = "hidden";
1807
1835
  }
1808
- function Rt(n) {
1836
+ function Lt(t) {
1809
1837
  try {
1810
- n.focus(), n.contentWindow?.focus();
1838
+ t.focus(), t.contentWindow?.focus();
1811
1839
  } catch {
1812
1840
  }
1813
1841
  }
1814
- function Fe(n, e) {
1815
- e.width !== void 0 && (n.style.width = R(e.width)), e.height !== void 0 && (n.style.height = R(e.height));
1842
+ function Ye(t, e) {
1843
+ e.width !== void 0 && (t.style.width = x(e.width)), e.height !== void 0 && (t.style.height = x(e.height));
1816
1844
  }
1817
- function xt(n, e) {
1818
- for (const [t, s] of Object.entries(e)) {
1845
+ function Mt(t, e) {
1846
+ for (const [n, s] of Object.entries(e)) {
1819
1847
  if (s === void 0) continue;
1820
1848
  const r = typeof s == "number" ? `${s}px` : s;
1821
- n.style.setProperty(
1822
- t.replace(/([A-Z])/g, "-$1").toLowerCase(),
1849
+ t.style.setProperty(
1850
+ n.replace(/([A-Z])/g, "-$1").toLowerCase(),
1823
1851
  r
1824
1852
  );
1825
1853
  }
1826
1854
  }
1827
- function Dt(n, e) {
1828
- for (const [t, s] of Object.entries(e))
1855
+ function zt(t, e) {
1856
+ for (const [n, s] of Object.entries(e))
1829
1857
  if (s !== void 0) {
1830
1858
  if (typeof s == "boolean") {
1831
- s && n.setAttribute(t, "");
1859
+ s && t.setAttribute(n, "");
1832
1860
  continue;
1833
1861
  }
1834
- n.setAttribute(t, s);
1862
+ t.setAttribute(n, s);
1835
1863
  }
1836
1864
  }
1837
- function It(n, e) {
1838
- e.sandbox || n.setAttribute(
1865
+ function kt(t, e) {
1866
+ e.sandbox === void 0 && t.setAttribute(
1839
1867
  "sandbox",
1840
- "allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"
1868
+ "allow-scripts allow-same-origin allow-forms allow-popups"
1841
1869
  );
1842
1870
  }
1843
- class He extends Error {
1871
+ class Je extends Error {
1844
1872
  constructor(e = "Popup blocked by browser") {
1845
1873
  super(e), this.name = "PopupOpenError";
1846
1874
  }
1847
1875
  }
1848
- function St(n) {
1849
- const { url: e, name: t, dimensions: s } = n, r = j(s.width, 500), i = j(s.height, 500), o = Math.floor(window.screenX + (window.outerWidth - r) / 2), a = Math.floor(window.screenY + (window.outerHeight - i) / 2), c = [
1876
+ function Wt(t) {
1877
+ const { url: e, name: n, dimensions: s } = t, r = q(s.width, 500), i = q(s.height, 500), o = Math.floor(window.screenX + (window.outerWidth - r) / 2), a = Math.floor(window.screenY + (window.outerHeight - i) / 2), c = [
1850
1878
  `width=${r}`,
1851
1879
  `height=${i}`,
1852
1880
  `left=${o}`,
@@ -1858,32 +1886,32 @@ function St(n) {
1858
1886
  "status=no",
1859
1887
  "resizable=yes",
1860
1888
  "scrollbars=yes"
1861
- ].join(","), l = window.open(e, t, c);
1862
- if (!l || Ut(l))
1863
- throw new He();
1864
- return l;
1889
+ ].join(","), u = window.open(e, n, c);
1890
+ if (!u || Vt(u))
1891
+ throw new Je();
1892
+ return u;
1865
1893
  }
1866
- function vt(n) {
1894
+ function jt(t) {
1867
1895
  try {
1868
- n.closed || n.close();
1896
+ t.closed || t.close();
1869
1897
  } catch {
1870
1898
  }
1871
1899
  }
1872
- function Tt(n) {
1900
+ function Bt(t) {
1873
1901
  try {
1874
- n.closed || n.focus();
1902
+ t.closed || t.focus();
1875
1903
  } catch {
1876
1904
  }
1877
1905
  }
1878
- function Ut(n) {
1879
- if (!n) return !0;
1906
+ function Vt(t) {
1907
+ if (!t) return !0;
1880
1908
  try {
1881
- return !!(n.closed || n.innerHeight === 0 || n.innerWidth === 0);
1909
+ return !!(t.closed || t.innerHeight === 0 || t.innerWidth === 0);
1882
1910
  } catch {
1883
1911
  return !0;
1884
1912
  }
1885
1913
  }
1886
- function Nt(n, e, t = {}) {
1914
+ function Yt(t, e, n = {}) {
1887
1915
  const {
1888
1916
  initialInterval: s = 100,
1889
1917
  // Start fast to catch quick closes
@@ -1891,78 +1919,78 @@ function Nt(n, e, t = {}) {
1891
1919
  // Cap at 2 seconds
1892
1920
  multiplier: i = 1.5
1893
1921
  // Exponential backoff multiplier
1894
- } = t;
1922
+ } = n;
1895
1923
  let o = s, a, c = !1;
1896
- const l = () => {
1924
+ const u = () => {
1897
1925
  try {
1898
1926
  e();
1899
- } catch (h) {
1900
- console.error("Error in popup close callback:", h);
1927
+ } catch (m) {
1928
+ console.error("Error in popup close callback:", m);
1901
1929
  }
1902
- }, m = () => {
1930
+ }, d = () => {
1903
1931
  if (!c) {
1904
1932
  try {
1905
- if (n.closed) {
1906
- l();
1933
+ if (t.closed) {
1934
+ u();
1907
1935
  return;
1908
1936
  }
1909
1937
  } catch {
1910
- l();
1938
+ u();
1911
1939
  return;
1912
1940
  }
1913
- o = Math.min(o * i, r), a = setTimeout(m, o);
1941
+ o = Math.min(o * i, r), a = setTimeout(d, o);
1914
1942
  }
1915
1943
  };
1916
- return a = setTimeout(m, o), () => {
1944
+ return a = setTimeout(d, o), () => {
1917
1945
  c = !0, clearTimeout(a);
1918
1946
  };
1919
1947
  }
1920
- function Ft(n, e) {
1948
+ function Jt(t, e) {
1921
1949
  try {
1922
- const t = j(e.width, n.outerWidth), s = j(
1950
+ const n = q(e.width, t.outerWidth), s = q(
1923
1951
  e.height,
1924
- n.outerHeight
1952
+ t.outerHeight
1925
1953
  );
1926
- n.resizeTo(t, s);
1954
+ t.resizeTo(n, s);
1927
1955
  } catch {
1928
1956
  }
1929
1957
  }
1930
- const Re = "forgeframe-spinner-style";
1931
- function Ht(n, e) {
1932
- const t = n.getElementById(Re);
1933
- if (t) {
1934
- const r = t.getAttribute("nonce");
1958
+ const Ne = "forgeframe-spinner-style";
1959
+ function qt(t, e) {
1960
+ const n = t.getElementById(Ne);
1961
+ if (n) {
1962
+ const r = n.getAttribute("nonce");
1935
1963
  if (!e || r === e)
1936
1964
  return;
1937
- t.remove();
1965
+ n.remove();
1938
1966
  }
1939
- const s = n.createElement("style");
1940
- s.id = Re, e && s.setAttribute("nonce", e), s.textContent = `
1967
+ const s = t.createElement("style");
1968
+ s.id = Ne, e && s.setAttribute("nonce", e), s.textContent = `
1941
1969
  @keyframes forgeframe-spin {
1942
1970
  to { transform: rotate(360deg); }
1943
1971
  }
1944
- `, (n.head ?? n.documentElement).appendChild(s);
1972
+ `, (t.head ?? t.documentElement).appendChild(s);
1945
1973
  }
1946
- function $t(n) {
1947
- const { doc: e, dimensions: t, uid: s, tag: r } = n, i = e.createElement("div");
1974
+ function Kt(t) {
1975
+ const { doc: e, dimensions: n, uid: s, tag: r } = t, i = e.createElement("div");
1948
1976
  return i.id = `forgeframe-container-${s}`, i.setAttribute("data-forgeframe-tag", r), Object.assign(i.style, {
1949
1977
  display: "inline-block",
1950
1978
  position: "relative",
1951
- width: R(t.width),
1952
- height: R(t.height),
1979
+ width: x(n.width),
1980
+ height: x(n.height),
1953
1981
  overflow: "hidden"
1954
1982
  }), i;
1955
1983
  }
1956
- function At(n) {
1957
- const { doc: e, dimensions: t, cspNonce: s } = n;
1958
- Ht(e, s);
1984
+ function Xt(t) {
1985
+ const { doc: e, dimensions: n, cspNonce: s } = t;
1986
+ qt(e, s);
1959
1987
  const r = e.createElement("div");
1960
1988
  Object.assign(r.style, {
1961
1989
  display: "flex",
1962
1990
  alignItems: "center",
1963
1991
  justifyContent: "center",
1964
- width: R(t.width),
1965
- height: R(t.height),
1992
+ width: x(n.width),
1993
+ height: x(n.height),
1966
1994
  backgroundColor: "#f5f5f5",
1967
1995
  position: "absolute",
1968
1996
  top: "0",
@@ -1979,22 +2007,22 @@ function At(n) {
1979
2007
  animation: "forgeframe-spin 1s linear infinite"
1980
2008
  }), r.appendChild(i), r;
1981
2009
  }
1982
- function Lt(n, e = 200) {
1983
- return new Promise((t) => {
1984
- n.style.opacity = "0", n.style.transition = `opacity ${e}ms ease-in`, n.offsetHeight, n.style.opacity = "1", setTimeout(t, e);
2010
+ function Gt(t, e = 200) {
2011
+ return new Promise((n) => {
2012
+ t.style.opacity = "0", t.style.transition = `opacity ${e}ms ease-in`, t.offsetHeight, t.style.opacity = "1", setTimeout(n, e);
1985
2013
  });
1986
2014
  }
1987
- function zt(n, e = 200) {
1988
- return new Promise((t) => {
1989
- n.style.transition = `opacity ${e}ms ease-out`, n.style.opacity = "0", setTimeout(t, e);
2015
+ function Zt(t, e = 200) {
2016
+ return new Promise((n) => {
2017
+ t.style.transition = `opacity ${e}ms ease-out`, t.style.opacity = "0", setTimeout(n, e);
1990
2018
  });
1991
2019
  }
1992
- async function Mt(n, e, t) {
1993
- e && (await zt(e, 150), e.remove()), t.style.display = "", t.style.visibility = "visible", t.style.opacity = "0", await Lt(t, 150);
2020
+ async function Qt(t, e, n) {
2021
+ e && (await Zt(e, 150), e.remove()), n.style.display = "", n.style.visibility = "visible", n.style.opacity = "0", await Gt(n, 150);
1994
2022
  }
1995
- class kt {
1996
- constructor(e, t, s, r, i) {
1997
- this.options = e, this.uid = t, this.getProps = s, this.resolveDimensions = r, this.callbacks = i, this.context = this.options.defaultContext;
2023
+ class en {
2024
+ constructor(e, n, s, r, i) {
2025
+ this.options = e, this.uid = n, this.getProps = s, this.resolveDimensions = r, this.callbacks = i, this.context = this.options.defaultContext;
1998
2026
  }
1999
2027
  /** Active rendering context. */
2000
2028
  context;
@@ -2013,26 +2041,26 @@ class kt {
2013
2041
  if (!e)
2014
2042
  throw new Error("Container is required for rendering");
2015
2043
  if (typeof e == "string") {
2016
- const t = document.querySelector(e);
2017
- if (!t)
2044
+ const n = document.querySelector(e);
2045
+ if (!n)
2018
2046
  throw new Error(`Container "${e}" not found`);
2019
- return t;
2047
+ return n;
2020
2048
  }
2021
2049
  return e;
2022
2050
  }
2023
2051
  /**
2024
2052
  * Creates and displays prerender/loading content.
2025
2053
  */
2026
- async prerender(e, t) {
2054
+ async prerender(e, n) {
2027
2055
  if (!this.container) return;
2028
2056
  const s = this.container;
2029
2057
  this.ownedContainer = null;
2030
- const r = this.getProps(), i = this.options.prerenderTemplate ?? At, o = this.options.containerTemplate ?? $t, a = this.resolveDimensions(), c = r.cspNonce;
2031
- if (this.context === f.IFRAME) {
2032
- const d = t();
2033
- this.iframe = e(d), Ce(this.iframe);
2058
+ const r = this.getProps(), i = this.options.prerenderTemplate ?? Xt, o = this.options.containerTemplate ?? Kt, a = this.resolveDimensions(), c = r.cspNonce;
2059
+ if (this.context === p.IFRAME) {
2060
+ const h = n();
2061
+ this.iframe = e(h), He(this.iframe);
2034
2062
  }
2035
- const l = {
2063
+ const u = {
2036
2064
  uid: this.uid,
2037
2065
  tag: this.options.tag,
2038
2066
  context: this.context,
@@ -2046,8 +2074,8 @@ class kt {
2046
2074
  focus: () => this.callbacks.focus(),
2047
2075
  cspNonce: c
2048
2076
  };
2049
- this.prerenderElement = i(l);
2050
- const m = {
2077
+ this.prerenderElement = i(u);
2078
+ const d = {
2051
2079
  uid: this.uid,
2052
2080
  tag: this.options.tag,
2053
2081
  context: this.context,
@@ -2060,13 +2088,13 @@ class kt {
2060
2088
  close: () => this.callbacks.close(),
2061
2089
  focus: () => this.callbacks.focus(),
2062
2090
  cspNonce: c
2063
- }, h = o(m);
2064
- if (h) {
2065
- if (h !== s) {
2066
- const d = !h.parentNode;
2067
- s.appendChild(h), d && (this.ownedContainer = h);
2091
+ }, m = o(d);
2092
+ if (m) {
2093
+ if (m !== s) {
2094
+ const h = !m.parentNode;
2095
+ s.appendChild(m), h && (this.ownedContainer = m);
2068
2096
  }
2069
- this.container = h;
2097
+ this.container = m;
2070
2098
  }
2071
2099
  this.prerenderElement && !this.prerenderElement.parentNode && this.container.appendChild(this.prerenderElement), this.iframe && !this.iframe.parentNode && this.container.appendChild(this.iframe);
2072
2100
  }
@@ -2074,10 +2102,10 @@ class kt {
2074
2102
  * Creates an iframe element without setting src (for prerender phase).
2075
2103
  */
2076
2104
  createIframeElement(e) {
2077
- const t = this.resolveDimensions(), s = this.getProps(), r = typeof this.options.attributes == "function" ? this.options.attributes(s) : this.options.attributes ?? {}, i = typeof this.options.style == "function" ? this.options.style(s) : this.options.style ?? {};
2078
- return Et({
2105
+ const n = this.resolveDimensions(), s = this.getProps(), r = typeof this.options.attributes == "function" ? this.options.attributes(s) : this.options.attributes ?? {}, i = typeof this.options.style == "function" ? this.options.style(s) : this.options.style ?? {};
2106
+ return Nt({
2079
2107
  name: e,
2080
- dimensions: t,
2108
+ dimensions: n,
2081
2109
  attributes: r,
2082
2110
  style: i
2083
2111
  });
@@ -2086,19 +2114,19 @@ class kt {
2086
2114
  * Opens host content in iframe or popup context.
2087
2115
  */
2088
2116
  open(e) {
2089
- const t = e.buildUrl(e.baseUrl), s = e.buildBodyParams(), r = s.toString().length > 0;
2090
- if (this.context === f.IFRAME) {
2117
+ const n = e.buildUrl(e.baseUrl), s = e.buildBodyParams(), r = s.toString().length > 0;
2118
+ if (this.context === p.IFRAME) {
2091
2119
  if (!this.iframe)
2092
2120
  throw new Error("Iframe not created during prerender");
2093
- return r ? e.submitBodyForm(this.iframe.name, t, s) : this.iframe.src = t, this.iframe.contentWindow;
2121
+ return r ? e.submitBodyForm(this.iframe.name, n, s) : this.iframe.src = n, this.iframe.contentWindow;
2094
2122
  }
2095
- const i = e.buildWindowName(), o = St({
2096
- url: r ? "about:blank" : t,
2123
+ const i = e.buildWindowName(), o = Wt({
2124
+ url: r ? "about:blank" : n,
2097
2125
  name: i,
2098
2126
  dimensions: this.resolveDimensions()
2099
2127
  });
2100
- r && e.submitBodyForm(i, t, s);
2101
- const a = Nt(o, () => {
2128
+ r && e.submitBodyForm(i, n, s);
2129
+ const a = Yt(o, () => {
2102
2130
  e.onPopupClose();
2103
2131
  });
2104
2132
  return e.registerCleanup(a), o;
@@ -2107,20 +2135,20 @@ class kt {
2107
2135
  * Swaps prerender content with the live iframe after host initialization.
2108
2136
  */
2109
2137
  async swapPrerenderContentIfNeeded() {
2110
- this.context === f.IFRAME && this.iframe && this.container && (await Mt(this.container, this.prerenderElement, this.iframe), this.prerenderElement = null);
2138
+ this.context === p.IFRAME && this.iframe && this.container && (await Qt(this.container, this.prerenderElement, this.iframe), this.prerenderElement = null);
2111
2139
  }
2112
2140
  /**
2113
2141
  * Submits a hidden form to navigate a target window via POST.
2114
2142
  */
2115
- submitBodyForm(e, t, s) {
2143
+ submitBodyForm(e, n, s) {
2116
2144
  const r = this.container?.ownerDocument ?? document, i = r.body ?? r.documentElement;
2117
2145
  if (!i)
2118
2146
  throw new Error("Document root is unavailable for bodyParam form submission");
2119
2147
  const o = r.createElement("form");
2120
- o.method = "POST", o.action = t, o.target = e, o.style.display = "none";
2148
+ o.method = "POST", o.action = n, o.target = e, o.style.display = "none";
2121
2149
  for (const [a, c] of s.entries()) {
2122
- const l = r.createElement("input");
2123
- l.type = "hidden", l.name = a, l.value = c, o.appendChild(l);
2150
+ const u = r.createElement("input");
2151
+ u.type = "hidden", u.name = a, u.value = c, o.appendChild(u);
2124
2152
  }
2125
2153
  i.appendChild(o);
2126
2154
  try {
@@ -2133,95 +2161,95 @@ class kt {
2133
2161
  * Focuses iframe/popup context.
2134
2162
  */
2135
2163
  focus(e) {
2136
- this.context === f.IFRAME && this.iframe ? Rt(this.iframe) : this.context === f.POPUP && e && Tt(e);
2164
+ this.context === p.IFRAME && this.iframe ? Lt(this.iframe) : this.context === p.POPUP && e && Bt(e);
2137
2165
  }
2138
2166
  /**
2139
2167
  * Resizes iframe/popup context.
2140
2168
  */
2141
- resize(e, t) {
2142
- this.context === f.IFRAME && this.iframe ? Ot(this.iframe, e) : this.context === f.POPUP && t && Ft(t, e);
2169
+ resize(e, n) {
2170
+ this.context === p.IFRAME && this.iframe ? $t(this.iframe, e) : this.context === p.POPUP && n && Jt(n, e);
2143
2171
  }
2144
2172
  /**
2145
2173
  * Shows iframe context.
2146
2174
  */
2147
2175
  show() {
2148
- this.context === f.IFRAME && this.iframe && Ct(this.iframe);
2176
+ this.context === p.IFRAME && this.iframe && At(this.iframe);
2149
2177
  }
2150
2178
  /**
2151
2179
  * Hides iframe context.
2152
2180
  */
2153
2181
  hide() {
2154
- this.context === f.IFRAME && this.iframe && Ce(this.iframe);
2182
+ this.context === p.IFRAME && this.iframe && He(this.iframe);
2155
2183
  }
2156
2184
  /**
2157
2185
  * Destroys rendered iframe/popup DOM artifacts.
2158
2186
  */
2159
2187
  destroy(e) {
2160
- this.iframe && (bt(this.iframe), this.iframe = null), this.context === f.POPUP && e && vt(e), this.prerenderElement && (this.prerenderElement.remove(), this.prerenderElement = null), this.ownedContainer && (this.ownedContainer.remove(), this.ownedContainer = null), this.container = null;
2188
+ this.iframe && (Ft(this.iframe), this.iframe = null), this.context === p.POPUP && e && jt(e), this.prerenderElement && (this.prerenderElement.remove(), this.prerenderElement = null), this.ownedContainer && (this.ownedContainer.remove(), this.ownedContainer = null), this.container = null;
2161
2189
  }
2162
2190
  }
2163
- const ne = "forgeframe:";
2164
- function Y(n) {
2165
- return ne + JSON.stringify(n);
2191
+ const ie = "forgeframe:";
2192
+ function ee(t) {
2193
+ return ie + JSON.stringify(t);
2166
2194
  }
2167
- function Wt(n) {
2168
- if (typeof n != "string" || !n.startsWith(ne)) return null;
2195
+ function tn(t) {
2196
+ if (typeof t != "string" || !t.startsWith(ie)) return null;
2169
2197
  try {
2170
- const e = n.slice(ne.length), t = JSON.parse(e);
2171
- return !t.id || !t.type || !t.name || !t.source ? null : t;
2198
+ const e = t.slice(ie.length), n = JSON.parse(e);
2199
+ return !n.id || !n.type || !n.name || !n.source ? null : n;
2172
2200
  } catch {
2173
2201
  return null;
2174
2202
  }
2175
2203
  }
2176
- function xe(n, e, t, s) {
2204
+ function Fe(t, e, n, s) {
2177
2205
  return {
2178
- id: n,
2179
- type: z.REQUEST,
2206
+ id: t,
2207
+ type: W.REQUEST,
2180
2208
  name: e,
2181
- data: t,
2209
+ data: n,
2182
2210
  source: s
2183
2211
  };
2184
2212
  }
2185
- function Bt(n, e, t, s) {
2213
+ function nn(t, e, n, s) {
2186
2214
  return {
2187
- id: n,
2188
- type: z.RESPONSE,
2215
+ id: t,
2216
+ type: W.RESPONSE,
2189
2217
  name: "response",
2190
2218
  data: e,
2191
- source: t,
2219
+ source: n,
2192
2220
  error: s ? {
2193
2221
  message: s.message,
2194
2222
  stack: s.stack
2195
2223
  } : void 0
2196
2224
  };
2197
2225
  }
2198
- function jt(n) {
2199
- return n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2226
+ function sn(t) {
2227
+ return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2200
2228
  }
2201
- function Vt(n) {
2202
- if (!n.includes("*"))
2229
+ function rn(t) {
2230
+ if (!t.includes("*"))
2203
2231
  return null;
2204
- const e = n.split("*").map((t) => jt(t)).join(".*");
2232
+ const e = t.split("*").map((n) => sn(n)).join(".*");
2205
2233
  return new RegExp(`^${e}$`);
2206
2234
  }
2207
- function qt(n, e) {
2208
- return n.global || n.sticky ? new RegExp(n.source, n.flags.replace(/[gy]/g, "")).test(e) : n.test(e);
2235
+ function on(t, e) {
2236
+ return t.global || t.sticky ? new RegExp(t.source, t.flags.replace(/[gy]/g, "")).test(e) : t.test(e);
2209
2237
  }
2210
- function Jt(n, e, t) {
2211
- return e !== n.targetWin ? !1 : n.expectedOrigin === "*" ? !0 : t === n.expectedOrigin;
2238
+ function an(t, e, n) {
2239
+ return e !== t.targetWin ? !1 : t.expectedOrigin === "*" ? !0 : n === t.expectedOrigin;
2212
2240
  }
2213
- function Kt(n, e) {
2214
- if (n === "*")
2241
+ function cn(t, e) {
2242
+ if (t === "*")
2215
2243
  return "*";
2216
- if (n === "/")
2244
+ if (t === "/")
2217
2245
  return e;
2218
2246
  try {
2219
- return new URL(n, e).origin;
2247
+ return new URL(t, e).origin;
2220
2248
  } catch {
2221
- return n;
2249
+ return t;
2222
2250
  }
2223
2251
  }
2224
- class $e {
2252
+ class qe {
2225
2253
  /**
2226
2254
  * Creates a new Messenger instance.
2227
2255
  *
@@ -2230,8 +2258,8 @@ class $e {
2230
2258
  * @param domain - The origin domain of this messenger
2231
2259
  * @param trustedDomains - Optional domains to trust for incoming messages
2232
2260
  */
2233
- constructor(e, t = window, s = window.location.origin, r) {
2234
- this.uid = e, this.win = t, this.domain = s, this.allowedOrigins.add(s), r && this.addTrustedDomain(r), this.setupListener();
2261
+ constructor(e, n = window, s = window.location.origin, r) {
2262
+ this.uid = e, this.win = n, this.domain = s, this.allowedOrigins.add(s), r && this.addTrustedDomain(r), this.setupListener();
2235
2263
  }
2236
2264
  /** @internal */
2237
2265
  pending = /* @__PURE__ */ new Map();
@@ -2256,13 +2284,13 @@ class $e {
2256
2284
  */
2257
2285
  addTrustedDomain(e) {
2258
2286
  if (Array.isArray(e))
2259
- for (const t of e)
2260
- this.addTrustedDomain(t);
2287
+ for (const n of e)
2288
+ this.addTrustedDomain(n);
2261
2289
  else if (e instanceof RegExp)
2262
2290
  this.allowedOriginPatterns.push(e);
2263
2291
  else {
2264
- const t = Vt(e);
2265
- t ? this.wildcardPatternRegistry.has(e) || (this.wildcardPatternRegistry.set(e, t), this.allowedOriginPatterns.push(t)) : this.allowedOrigins.add(e);
2292
+ const n = rn(e);
2293
+ n ? this.wildcardPatternRegistry.has(e) || (this.wildcardPatternRegistry.set(e, n), this.allowedOriginPatterns.push(n)) : this.allowedOrigins.add(e);
2266
2294
  }
2267
2295
  }
2268
2296
  /**
@@ -2272,14 +2300,14 @@ class $e {
2272
2300
  */
2273
2301
  removeTrustedDomain(e) {
2274
2302
  if (Array.isArray(e))
2275
- for (const t of e)
2276
- this.removeTrustedDomain(t);
2303
+ for (const n of e)
2304
+ this.removeTrustedDomain(n);
2277
2305
  else if (e instanceof RegExp)
2278
- this.allowedOriginPatterns = this.allowedOriginPatterns.filter((t) => t !== e);
2306
+ this.allowedOriginPatterns = this.allowedOriginPatterns.filter((n) => n !== e);
2279
2307
  else {
2280
- const t = this.wildcardPatternRegistry.get(e);
2281
- t && (this.allowedOriginPatterns = this.allowedOriginPatterns.filter(
2282
- (s) => s !== t
2308
+ const n = this.wildcardPatternRegistry.get(e);
2309
+ n && (this.allowedOriginPatterns = this.allowedOriginPatterns.filter(
2310
+ (s) => s !== n
2283
2311
  ), this.wildcardPatternRegistry.delete(e)), this.allowedOrigins.delete(e);
2284
2312
  }
2285
2313
  }
@@ -2293,8 +2321,8 @@ class $e {
2293
2321
  isOriginTrusted(e) {
2294
2322
  if (this.allowedOrigins.has(e))
2295
2323
  return !0;
2296
- for (const t of this.allowedOriginPatterns)
2297
- if (qt(t, e))
2324
+ for (const n of this.allowedOriginPatterns)
2325
+ if (on(n, e))
2298
2326
  return !0;
2299
2327
  return !1;
2300
2328
  }
@@ -2302,12 +2330,12 @@ class $e {
2302
2330
  * Resolves source identity from the browser event context.
2303
2331
  * @internal
2304
2332
  */
2305
- resolveVerifiedSource(e, t, s) {
2333
+ resolveVerifiedSource(e, n, s) {
2306
2334
  const r = e, i = this.sourceUidRegistry.get(r);
2307
2335
  if (i)
2308
- return { uid: i, domain: t };
2309
- const o = s && typeof s.uid == "string" && s.uid.length > 0 ? s.uid : L();
2310
- return this.sourceUidRegistry.set(r, o), { uid: o, domain: t };
2336
+ return { uid: i, domain: n, window: e };
2337
+ const o = s && typeof s.uid == "string" && s.uid.length > 0 ? s.uid : k();
2338
+ return this.sourceUidRegistry.set(r, o), { uid: o, domain: n, window: e };
2311
2339
  }
2312
2340
  /**
2313
2341
  * Sends a message and waits for a response.
@@ -2322,25 +2350,25 @@ class $e {
2322
2350
  * @returns Promise resolving to the response data
2323
2351
  * @throws Error if messenger is destroyed or timeout occurs
2324
2352
  */
2325
- async send(e, t, s, r, i = 1e4) {
2353
+ async send(e, n, s, r, i = 1e4) {
2326
2354
  if (this.destroyed)
2327
2355
  throw new Error("Messenger has been destroyed");
2328
- const o = L(), a = xe(o, s, r, {
2356
+ const o = k(), a = Fe(o, s, r, {
2329
2357
  uid: this.uid,
2330
2358
  domain: this.domain
2331
- }), c = Se(), l = setTimeout(() => {
2359
+ }), c = Le(), u = setTimeout(() => {
2332
2360
  this.pending.delete(o), c.reject(new Error(`Message "${s}" timed out after ${i}ms`));
2333
2361
  }, i);
2334
2362
  this.pending.set(o, {
2335
2363
  deferred: c,
2336
- timeout: l,
2364
+ timeout: u,
2337
2365
  targetWin: e,
2338
- expectedOrigin: Kt(t, this.domain)
2366
+ expectedOrigin: cn(n, this.domain)
2339
2367
  });
2340
2368
  try {
2341
- e.postMessage(Y(a), t);
2342
- } catch (m) {
2343
- throw this.pending.delete(o), clearTimeout(l), m;
2369
+ e.postMessage(ee(a), n);
2370
+ } catch (d) {
2371
+ throw this.pending.delete(o), clearTimeout(u), d;
2344
2372
  }
2345
2373
  return c.promise;
2346
2374
  }
@@ -2354,14 +2382,14 @@ class $e {
2354
2382
  * @param data - Optional data payload
2355
2383
  * @throws Error if messenger is destroyed
2356
2384
  */
2357
- post(e, t, s, r) {
2385
+ post(e, n, s, r) {
2358
2386
  if (this.destroyed)
2359
2387
  throw new Error("Messenger has been destroyed");
2360
- const i = L(), o = xe(i, s, r, {
2388
+ const i = k(), o = Fe(i, s, r, {
2361
2389
  uid: this.uid,
2362
2390
  domain: this.domain
2363
2391
  });
2364
- e.postMessage(Y(o), t);
2392
+ e.postMessage(ee(o), n);
2365
2393
  }
2366
2394
  /**
2367
2395
  * Registers a handler for incoming messages of a specific type.
@@ -2372,8 +2400,8 @@ class $e {
2372
2400
  * @param handler - The handler function
2373
2401
  * @returns Function to unregister the handler
2374
2402
  */
2375
- on(e, t) {
2376
- return this.handlers.set(e, t), () => this.handlers.delete(e);
2403
+ on(e, n) {
2404
+ return this.handlers.set(e, n), () => this.handlers.delete(e);
2377
2405
  }
2378
2406
  /**
2379
2407
  * Sets up the postMessage event listener.
@@ -2383,21 +2411,21 @@ class $e {
2383
2411
  this.listener = (e) => {
2384
2412
  if (e.source === this.win || !this.isOriginTrusted(e.origin))
2385
2413
  return;
2386
- const t = Wt(e.data);
2387
- if (!t) return;
2414
+ const n = tn(e.data);
2415
+ if (!n) return;
2388
2416
  const s = e.source;
2389
- !s || typeof s.postMessage != "function" || this.handleMessage(t, s, e.origin);
2417
+ !s || typeof s.postMessage != "function" || this.handleMessage(n, s, e.origin);
2390
2418
  }, this.win.addEventListener("message", this.listener);
2391
2419
  }
2392
2420
  /**
2393
2421
  * Processes a received message.
2394
2422
  * @internal
2395
2423
  */
2396
- async handleMessage(e, t, s) {
2397
- if (e.type === z.RESPONSE) {
2424
+ async handleMessage(e, n, s) {
2425
+ if (e.type === W.RESPONSE) {
2398
2426
  const r = this.pending.get(e.id);
2399
2427
  if (r) {
2400
- if (!Jt(r, t, s))
2428
+ if (!an(r, n, s))
2401
2429
  return;
2402
2430
  if (this.pending.delete(e.id), clearTimeout(r.timeout), e.error) {
2403
2431
  const i = new Error(e.error.message);
@@ -2407,14 +2435,14 @@ class $e {
2407
2435
  }
2408
2436
  return;
2409
2437
  }
2410
- if (e.type === z.REQUEST) {
2438
+ if (e.type === W.REQUEST) {
2411
2439
  const r = this.handlers.get(e.name);
2412
2440
  if (!r)
2413
2441
  return;
2414
2442
  let i, o;
2415
2443
  try {
2416
2444
  const c = this.resolveVerifiedSource(
2417
- t,
2445
+ n,
2418
2446
  s,
2419
2447
  e.source
2420
2448
  );
@@ -2422,14 +2450,14 @@ class $e {
2422
2450
  } catch (c) {
2423
2451
  o = c instanceof Error ? c : new Error(String(c));
2424
2452
  }
2425
- const a = Bt(
2453
+ const a = nn(
2426
2454
  e.id,
2427
2455
  i,
2428
2456
  { uid: this.uid, domain: this.domain },
2429
2457
  o
2430
2458
  );
2431
2459
  try {
2432
- t.postMessage(Y(a), s);
2460
+ n.postMessage(ee(a), s);
2433
2461
  } catch {
2434
2462
  }
2435
2463
  }
@@ -2458,7 +2486,7 @@ class $e {
2458
2486
  return this.destroyed;
2459
2487
  }
2460
2488
  }
2461
- const Yt = [
2489
+ const un = [
2462
2490
  "init",
2463
2491
  "close",
2464
2492
  "resize",
@@ -2467,96 +2495,96 @@ const Yt = [
2467
2495
  "onError",
2468
2496
  "updateProps",
2469
2497
  "export"
2470
- ], De = 32 * 1024;
2471
- function Xt(n) {
2472
- const e = nn(n);
2473
- return `${M}${e}`;
2498
+ ], $e = 32 * 1024;
2499
+ function ln(t) {
2500
+ const e = yn(t);
2501
+ return `${j}${e}`;
2474
2502
  }
2475
- function Ae(n) {
2476
- if (!n || !n.startsWith(M))
2503
+ function Ke(t) {
2504
+ if (!t || !t.startsWith(j))
2477
2505
  return null;
2478
- const e = n.slice(M.length);
2479
- return sn(e);
2506
+ const e = t.slice(j.length);
2507
+ return wn(e);
2480
2508
  }
2481
- function b(n) {
2482
- return typeof n == "object" && n !== null;
2509
+ function O(t) {
2510
+ return typeof t == "object" && t !== null;
2483
2511
  }
2484
- function Gt(n) {
2485
- return b(n);
2512
+ function hn(t) {
2513
+ return O(t);
2486
2514
  }
2487
- function Zt(n) {
2488
- return b(n) && Yt.every(
2489
- (e) => typeof n[e] == "string" && n[e].length > 0
2515
+ function dn(t) {
2516
+ return O(t) && un.every(
2517
+ (e) => typeof t[e] == "string" && t[e].length > 0
2490
2518
  );
2491
2519
  }
2492
- function Qt(n) {
2493
- if (!b(n) || typeof n.tag != "string" || n.tag.length === 0 || typeof n.url != "string" || n.url.length === 0 || n.props !== void 0 && !b(n.props) || n.defaultContext !== void 0 && n.defaultContext !== f.IFRAME && n.defaultContext !== f.POPUP)
2520
+ function fn(t) {
2521
+ if (!O(t) || typeof t.tag != "string" || t.tag.length === 0 || typeof t.url != "string" || t.url.length === 0 || t.props !== void 0 && !O(t.props) || t.defaultContext !== void 0 && t.defaultContext !== p.IFRAME && t.defaultContext !== p.POPUP)
2494
2522
  return !1;
2495
- if (n.dimensions !== void 0) {
2496
- if (!b(n.dimensions))
2523
+ if (t.dimensions !== void 0) {
2524
+ if (!O(t.dimensions))
2497
2525
  return !1;
2498
- const { width: e, height: t } = n.dimensions;
2499
- if (e !== void 0 && typeof e != "string" && typeof e != "number" || t !== void 0 && typeof t != "string" && typeof t != "number")
2526
+ const { width: e, height: n } = t.dimensions;
2527
+ if (e !== void 0 && typeof e != "string" && typeof e != "number" || n !== void 0 && typeof n != "string" && typeof n != "number")
2500
2528
  return !1;
2501
2529
  }
2502
2530
  return !0;
2503
2531
  }
2504
- function en(n) {
2505
- return b(n) ? Object.values(n).every((e) => Qt(e)) : !1;
2532
+ function pn(t) {
2533
+ return O(t) ? Object.values(t).every((e) => fn(e)) : !1;
2506
2534
  }
2507
- function tn(n) {
2508
- return !(!b(n) || typeof n.uid != "string" || n.uid.length === 0 || typeof n.tag != "string" || n.tag.length === 0 || typeof n.version != "string" || n.version.length === 0 || n.version !== se || n.context !== f.IFRAME && n.context !== f.POPUP || typeof n.consumerDomain != "string" || n.consumerDomain.length === 0 || !Gt(n.props) || !Zt(n.exports) || n.children !== void 0 && !en(n.children));
2535
+ function mn(t) {
2536
+ return !(!O(t) || typeof t.uid != "string" || t.uid.length === 0 || typeof t.tag != "string" || t.tag.length === 0 || typeof t.version != "string" || t.version.length === 0 || t.version !== oe || t.context !== p.IFRAME && t.context !== p.POPUP || typeof t.consumerDomain != "string" || t.consumerDomain.length === 0 || !hn(t.props) || !dn(t.exports) || t.children !== void 0 && !pn(t.children));
2509
2537
  }
2510
- function de(n = window) {
2538
+ function me(t = window) {
2511
2539
  try {
2512
- return n.name.startsWith(M);
2540
+ return t.name.startsWith(j);
2513
2541
  } catch {
2514
2542
  return !1;
2515
2543
  }
2516
2544
  }
2517
- function X(n, e = window) {
2518
- return Ae(e.name)?.tag === n;
2545
+ function gn(t, e = window) {
2546
+ return Ke(e.name)?.tag === t;
2519
2547
  }
2520
- function nn(n) {
2548
+ function yn(t) {
2521
2549
  try {
2522
- const e = JSON.stringify(n), t = btoa(encodeURIComponent(e)), s = new Blob([t]).size;
2523
- if (s > De)
2550
+ const e = JSON.stringify(t), n = btoa(encodeURIComponent(e)), s = n.length;
2551
+ if (s > $e)
2524
2552
  throw new Error(
2525
- `Payload size (${Math.round(s / 1024)}KB) exceeds maximum allowed size (${De / 1024}KB). Consider reducing the amount of data passed via props.`
2553
+ `Payload size (${Math.round(s / 1024)}KB) exceeds maximum allowed size (${$e / 1024}KB). Consider reducing the amount of data passed via props.`
2526
2554
  );
2527
- return t;
2555
+ return n;
2528
2556
  } catch (e) {
2529
2557
  throw e instanceof Error && e.message.includes("Payload size") ? e : new Error(`Failed to encode payload: ${e}`);
2530
2558
  }
2531
2559
  }
2532
- function sn(n) {
2560
+ function wn(t) {
2533
2561
  try {
2534
- const e = decodeURIComponent(atob(n)), t = JSON.parse(e);
2535
- return tn(t) ? t : null;
2562
+ const e = decodeURIComponent(atob(t)), n = JSON.parse(e);
2563
+ return mn(n) ? n : null;
2536
2564
  } catch {
2537
2565
  return null;
2538
2566
  }
2539
2567
  }
2540
- function rn(n) {
2568
+ function _n(t) {
2541
2569
  return {
2542
- uid: n.uid,
2543
- tag: n.tag,
2544
- version: se,
2545
- context: n.context,
2546
- consumerDomain: n.consumerDomain,
2547
- props: n.props,
2548
- exports: n.exports,
2549
- children: n.children
2570
+ uid: t.uid,
2571
+ tag: t.tag,
2572
+ version: oe,
2573
+ context: t.context,
2574
+ consumerDomain: t.consumerDomain,
2575
+ props: t.props,
2576
+ exports: t.exports,
2577
+ children: t.children
2550
2578
  };
2551
2579
  }
2552
- function on(n = window) {
2553
- return Ae(n.name);
2580
+ function Pn(t = window) {
2581
+ return Ke(t.name);
2554
2582
  }
2555
- class an {
2556
- constructor(e, t, s, r) {
2557
- this.uid = e, this.options = t, this.resolveUrl = s, this.resolveUrlOrigin = r;
2583
+ class En {
2584
+ constructor(e, n, s, r) {
2585
+ this.uid = e, this.options = n, this.resolveUrl = s, this.resolveUrlOrigin = r;
2558
2586
  const i = this.buildTrustedDomains();
2559
- this.messenger = new $e(this.uid, window, k(), i), this.bridge = new he(this.messenger);
2587
+ this.messenger = new qe(this.uid, window, B(), i), this.bridge = new pe(this.messenger);
2560
2588
  }
2561
2589
  /** Messenger for host communication. */
2562
2590
  messenger;
@@ -2576,25 +2604,25 @@ class an {
2576
2604
  * Builds trusted domains used to initialize messenger security checks.
2577
2605
  */
2578
2606
  buildTrustedDomains() {
2579
- const e = [], t = this.resolveUrlOrigin(this.resolveUrl());
2580
- if (t && (e.push(t), this.dynamicUrlTrustedOrigin = t), this.options.domain && (typeof this.options.domain == "string" ? e.push(this.options.domain) : Array.isArray(this.options.domain) ? e.push(...this.options.domain) : this.options.domain instanceof RegExp && e.push(this.options.domain)), e.length !== 0)
2607
+ const e = [], n = this.resolveUrlOrigin(this.resolveUrl());
2608
+ if (n && (e.push(n), this.dynamicUrlTrustedOrigin = n), this.options.domain && (typeof this.options.domain == "string" ? e.push(this.options.domain) : Array.isArray(this.options.domain) ? e.push(...this.options.domain) : this.options.domain instanceof RegExp && e.push(this.options.domain)), e.length !== 0)
2581
2609
  return e.length === 1 ? e[0] : e;
2582
2610
  }
2583
2611
  /**
2584
2612
  * Returns true when the domain option explicitly includes this origin.
2585
2613
  */
2586
2614
  isExplicitDomainTrust(e) {
2587
- return this.options.domain ? v(this.options.domain, e) : !1;
2615
+ return this.options.domain ? U(this.options.domain, e) : !1;
2588
2616
  }
2589
2617
  /**
2590
2618
  * Ensures the messenger trusts the origin for a resolved host URL.
2591
2619
  */
2592
2620
  syncTrustedDomainForUrl(e) {
2593
- const t = this.resolveUrlOrigin(e);
2594
- if (!t)
2621
+ const n = this.resolveUrlOrigin(e);
2622
+ if (!n)
2595
2623
  return;
2596
2624
  const s = this.dynamicUrlTrustedOrigin;
2597
- s && s !== t && !this.isExplicitDomainTrust(s) && this.messenger.removeTrustedDomain(s), this.messenger.addTrustedDomain(t), this.dynamicUrlTrustedOrigin = t;
2625
+ s && s !== n && !this.isExplicitDomainTrust(s) && this.messenger.removeTrustedDomain(s), this.messenger.addTrustedDomain(n), this.dynamicUrlTrustedOrigin = n;
2598
2626
  }
2599
2627
  /**
2600
2628
  * Returns the current host domain target used for messaging.
@@ -2606,16 +2634,16 @@ class an {
2606
2634
  * Returns true when the host window is connected and not closed.
2607
2635
  */
2608
2636
  isHostConnected() {
2609
- return !!(this.hostWindow && !Z(this.hostWindow));
2637
+ return !!(this.hostWindow && !ne(this.hostWindow));
2610
2638
  }
2611
2639
  /**
2612
2640
  * Serializes host props while keeping function bridge references in sync.
2613
2641
  */
2614
- serializePropsForHost(e, t, s) {
2642
+ serializePropsForHost(e, n, s) {
2615
2643
  this.bridge.startBatch();
2616
2644
  const r = s?.finishBatch ?? !0;
2617
2645
  try {
2618
- const i = gt(e, t, this.bridge);
2646
+ const i = It(e, n, this.bridge);
2619
2647
  return r && this.bridge.finishBatch(), i;
2620
2648
  } catch (i) {
2621
2649
  throw this.bridge.finishBatch(!0), i;
@@ -2624,24 +2652,24 @@ class an {
2624
2652
  /**
2625
2653
  * Sends the current props snapshot to the host window when available.
2626
2654
  */
2627
- async sendPropsUpdateToHost(e, t) {
2628
- if (!this.hostWindow || Z(this.hostWindow))
2655
+ async sendPropsUpdateToHost(e, n) {
2656
+ if (!this.hostWindow || ne(this.hostWindow))
2629
2657
  return;
2630
- const s = this.getHostDomain(), r = Ee(
2658
+ const s = this.getHostDomain(), r = Ie(
2631
2659
  e,
2632
- t,
2660
+ n,
2633
2661
  s,
2634
- ve(this.hostWindow)
2662
+ Me(this.hostWindow)
2635
2663
  ), i = this.serializePropsForHost(
2636
2664
  r,
2637
- t,
2665
+ n,
2638
2666
  { finishBatch: !1 }
2639
2667
  );
2640
2668
  try {
2641
2669
  await this.messenger.send(
2642
2670
  this.hostWindow,
2643
2671
  s,
2644
- u.PROPS,
2672
+ l.PROPS,
2645
2673
  i
2646
2674
  ), this.bridge.finishBatch();
2647
2675
  } catch (o) {
@@ -2652,38 +2680,38 @@ class an {
2652
2680
  * Builds the window.name payload for host initialization.
2653
2681
  */
2654
2682
  buildWindowName(e) {
2655
- const t = e.hostDomain ?? this.getHostDomain(), s = Ee(
2683
+ const n = e.hostDomain ?? this.getHostDomain(), s = Ie(
2656
2684
  e.props,
2657
2685
  e.propDefinitions,
2658
- t,
2686
+ n,
2659
2687
  !1
2660
2688
  ), r = this.serializePropsForHost(
2661
2689
  s,
2662
2690
  e.propDefinitions
2663
- ), i = rn({
2691
+ ), i = _n({
2664
2692
  uid: this.uid,
2665
2693
  tag: e.tag,
2666
2694
  context: e.context,
2667
- consumerDomain: k(),
2695
+ consumerDomain: B(),
2668
2696
  props: r,
2669
2697
  exports: e.exports,
2670
2698
  children: e.children
2671
2699
  });
2672
- return Xt(i);
2700
+ return ln(i);
2673
2701
  }
2674
2702
  /**
2675
2703
  * Waits for the host to send the initialization handshake.
2676
2704
  */
2677
- async waitForHost(e, t, s) {
2705
+ async waitForHost(e, n, s) {
2678
2706
  if (this.hostInitialized)
2679
2707
  return;
2680
- const r = Se();
2708
+ const r = Le();
2681
2709
  this.initPromise = r;
2682
2710
  try {
2683
- await Ke(
2711
+ await st(
2684
2712
  r.promise,
2685
2713
  e,
2686
- `Host component "${t}" (uid: ${this.uid}) did not initialize within ${e}ms. Check that the host page loads correctly and calls the initialization code.`
2714
+ `Host component "${n}" (uid: ${this.uid}) did not initialize within ${e}ms. Check that the host page loads correctly and calls the initialization code.`
2687
2715
  );
2688
2716
  } catch (i) {
2689
2717
  throw s(i), i;
@@ -2695,17 +2723,25 @@ class an {
2695
2723
  * Sets up host message handlers.
2696
2724
  */
2697
2725
  setupMessageHandlers(e) {
2698
- this.messenger.on(u.INIT, () => (this.hostInitialized = !0, this.initPromise && this.initPromise.resolve(), e.onInit && queueMicrotask(() => {
2699
- Promise.resolve(e.onInit?.()).catch((t) => {
2700
- e.onError(t);
2726
+ this.messenger.on(l.INIT, (n, s) => this.isHostControlSource(s) ? (this.hostInitialized = !0, this.initPromise && this.initPromise.resolve(), e.onInit && queueMicrotask(() => {
2727
+ Promise.resolve(e.onInit?.()).catch((r) => {
2728
+ e.onError(r);
2701
2729
  });
2702
- }), { success: !0 })), this.messenger.on(u.CLOSE, async () => (await e.onClose(), { success: !0 })), this.messenger.on(u.RESIZE, async (t) => (await e.onResize(t), { success: !0 })), this.messenger.on(u.FOCUS, async () => (await e.onFocus(), { success: !0 })), this.messenger.on(u.SHOW, async () => (await e.onShow(), { success: !0 })), this.messenger.on(u.HIDE, async () => (await e.onHide(), { success: !0 })), this.messenger.on(
2703
- u.ERROR,
2704
- async (t) => {
2705
- const s = new Error(t.message);
2706
- return s.stack = t.stack, e.onError(s), { success: !0 };
2730
+ }), { success: !0 }) : { success: !1 }), this.messenger.on(l.CLOSE, async (n, s) => this.isHostControlSource(s) ? (await e.onClose(), { success: !0 }) : { success: !1 }), this.messenger.on(l.RESIZE, async (n, s) => this.isHostControlSource(s) ? (await e.onResize(n), { success: !0 }) : { success: !1 }), this.messenger.on(l.FOCUS, async (n, s) => this.isHostControlSource(s) ? (await e.onFocus(), { success: !0 }) : { success: !1 }), this.messenger.on(l.SHOW, async (n, s) => this.isHostControlSource(s) ? (await e.onShow(), { success: !0 }) : { success: !1 }), this.messenger.on(l.HIDE, async (n, s) => this.isHostControlSource(s) ? (await e.onHide(), { success: !0 }) : { success: !1 }), this.messenger.on(
2731
+ l.ERROR,
2732
+ async (n, s) => {
2733
+ if (!this.isHostControlSource(s))
2734
+ return { success: !1 };
2735
+ const r = new Error(n.message);
2736
+ return r.stack = n.stack, e.onError(r), { success: !0 };
2707
2737
  }
2708
- ), this.messenger.on(u.EXPORT, async (t) => (e.onExport(t), { success: !0 })), this.messenger.on(u.CONSUMER_EXPORT, async (t) => (e.onConsumerExport(t), { success: !0 })), this.messenger.on(u.GET_SIBLINGS, async (t) => e.onGetSiblings(t));
2738
+ ), this.messenger.on(l.EXPORT, async (n, s) => this.isHostControlSource(s) ? (e.onExport(n), { success: !0 }) : { success: !1 }), this.messenger.on(l.CONSUMER_EXPORT, async (n, s) => this.isHostControlSource(s) ? (e.onConsumerExport(n), { success: !0 }) : { success: !1 }), this.messenger.on(l.GET_SIBLINGS, async (n, s) => this.isHostControlSource(s) ? e.onGetSiblings(n) : { success: !1 });
2739
+ }
2740
+ /**
2741
+ * Returns true when a lifecycle/control message came from the opened host window.
2742
+ */
2743
+ isHostControlSource(e) {
2744
+ return !!(this.hostWindow && e.window === this.hostWindow);
2709
2745
  }
2710
2746
  /**
2711
2747
  * Destroys transport resources.
@@ -2714,7 +2750,7 @@ class an {
2714
2750
  this.messenger.destroy(), this.bridge.destroy();
2715
2751
  }
2716
2752
  }
2717
- class pe {
2753
+ class ge {
2718
2754
  /** Event emitter for lifecycle events. */
2719
2755
  event;
2720
2756
  /** Arbitrary state storage for the component instance. */
@@ -2854,8 +2890,8 @@ class pe {
2854
2890
  * @param options - Component configuration options
2855
2891
  * @param props - Initial props to pass to the component
2856
2892
  */
2857
- constructor(e, t = {}) {
2858
- this._uid = qe(), this.options = this.normalizeOptions(e), this.event = new Ie(), this.cleanup = new Je(), this.renderer = new kt(
2893
+ constructor(e, n = {}) {
2894
+ this._uid = tt(), this.options = this.normalizeOptions(e), this.event = new Ae(), this.cleanup = new nt(), this.renderer = new en(
2859
2895
  this.options,
2860
2896
  this.uid,
2861
2897
  () => this.props,
@@ -2864,11 +2900,11 @@ class pe {
2864
2900
  close: () => this.close(),
2865
2901
  focus: () => this.focus()
2866
2902
  }
2867
- ), this.propsPipeline = new Pt(
2903
+ ), this.propsPipeline = new Ht(
2868
2904
  this.options,
2869
- { ...t },
2905
+ { ...n },
2870
2906
  (s) => this.createPropContext(s)
2871
- ), this.transport = new an(
2907
+ ), this.transport = new En(
2872
2908
  this.uid,
2873
2909
  this.options,
2874
2910
  () => this.resolveUrl(),
@@ -2893,14 +2929,14 @@ class pe {
2893
2929
  * await instance.render(document.getElementById('target'), 'popup');
2894
2930
  * ```
2895
2931
  */
2896
- async render(e, t) {
2932
+ async render(e, n) {
2897
2933
  if (this.destroyed)
2898
2934
  throw new Error("Component has been destroyed");
2899
2935
  if (this.rendered)
2900
2936
  throw new Error("Component has already been rendered");
2901
- this.context = t ?? this.options.defaultContext, this.checkEligibility(), S(this.props, this.options.props), this.options.validate?.({ props: this.props }), this.container = this.resolveContainer(e), this.event.emit(g.PRERENDER), this.callPropCallback("onPrerender"), await this.prerender(), this.event.emit(g.PRERENDERED), this.callPropCallback("onPrerendered"), this.event.emit(g.RENDER), this.callPropCallback("onRender");
2937
+ this.context = n ?? this.options.defaultContext, this.checkEligibility(), T(this.props, this.options.props), this.options.validate?.({ props: this.props }), this.container = this.resolveContainer(e), this.event.emit(g.PRERENDER), this.callPropCallback("onPrerender"), await this.prerender(), this.event.emit(g.PRERENDERED), this.callPropCallback("onPrerendered"), this.event.emit(g.RENDER), this.callPropCallback("onRender");
2902
2938
  try {
2903
- await this.open(), await this.waitForHost(), this.context === f.IFRAME && this.iframe && await this.renderer.swapPrerenderContentIfNeeded();
2939
+ await this.open(), await this.waitForHost(), this.context === p.IFRAME && this.iframe && await this.renderer.swapPrerenderContentIfNeeded();
2904
2940
  } catch (s) {
2905
2941
  throw await this.destroy().catch(() => {
2906
2942
  }), s;
@@ -2918,10 +2954,10 @@ class pe {
2918
2954
  * @param container - CSS selector or HTMLElement to render into
2919
2955
  * @param context - Override the default rendering context
2920
2956
  */
2921
- async renderTo(e, t, s) {
2957
+ async renderTo(e, n, s) {
2922
2958
  if (e !== window)
2923
2959
  throw new Error("Cross-window renderTo is not supported; pass the current window");
2924
- return this.render(t, s);
2960
+ return this.render(n, s);
2925
2961
  }
2926
2962
  /**
2927
2963
  * Closes and destroys the component.
@@ -2990,7 +3026,7 @@ class pe {
2990
3026
  * @internal
2991
3027
  */
2992
3028
  async applyPropsUpdate(e) {
2993
- const t = {
3029
+ const n = {
2994
3030
  resolveUrl: (s) => this.resolveUrl(s),
2995
3031
  resolveUrlOrigin: (s) => this.resolveUrlOrigin(s),
2996
3032
  assertStableRenderedOrigin: (s) => this.assertStableRenderedOrigin(s),
@@ -3000,7 +3036,7 @@ class pe {
3000
3036
  sendPropsUpdateToHost: (s) => this.sendPropsUpdateToHost(s),
3001
3037
  emitPropsUpdated: () => this.emitPropsUpdated()
3002
3038
  };
3003
- await this.propsPipeline.updateProps(e, t);
3039
+ await this.propsPipeline.updateProps(e, n);
3004
3040
  }
3005
3041
  /**
3006
3042
  * Prevents origin changes after render for security and routing consistency.
@@ -3032,7 +3068,7 @@ class pe {
3032
3068
  * @returns A new unrendered component instance with identical configuration
3033
3069
  */
3034
3070
  clone() {
3035
- const e = new pe(this.options, this.props);
3071
+ const e = new ge(this.options, this.props);
3036
3072
  return e.inputProps = { ...this.inputProps }, e;
3037
3073
  }
3038
3074
  /**
@@ -3051,7 +3087,7 @@ class pe {
3051
3087
  return {
3052
3088
  ...e,
3053
3089
  props: e.props ?? {},
3054
- defaultContext: e.defaultContext ?? f.IFRAME,
3090
+ defaultContext: e.defaultContext ?? p.IFRAME,
3055
3091
  dimensions: e.dimensions ?? { width: "100%", height: "100%" },
3056
3092
  timeout: e.timeout ?? 1e4,
3057
3093
  children: e.children
@@ -3094,8 +3130,8 @@ class pe {
3094
3130
  * @internal
3095
3131
  */
3096
3132
  syncTrustedDomainForUrl(e) {
3097
- const t = this.resolveUrlOrigin(e);
3098
- t && this.isExplicitDomainTrust(t), this.transport.syncTrustedDomainForUrl(e);
3133
+ const n = this.resolveUrlOrigin(e);
3134
+ n && this.isExplicitDomainTrust(n), this.transport.syncTrustedDomainForUrl(e);
3099
3135
  }
3100
3136
  /**
3101
3137
  * Creates the prop context passed to prop callbacks and validators.
@@ -3107,7 +3143,7 @@ class pe {
3107
3143
  state: this.state,
3108
3144
  close: () => this.close(),
3109
3145
  focus: () => this.focus(),
3110
- onError: (t) => this.handleError(t),
3146
+ onError: (n) => this.handleError(n),
3111
3147
  container: this.container,
3112
3148
  uid: this.uid,
3113
3149
  tag: this.options.tag
@@ -3156,24 +3192,24 @@ class pe {
3156
3192
  const e = this.resolveUrl();
3157
3193
  this.syncTrustedDomainForUrl(e), this.openedHostDomain = this.resolveUrlOrigin(e), this.hostWindow = this.renderer.open({
3158
3194
  baseUrl: e,
3159
- buildUrl: (t) => this.buildUrl(t),
3195
+ buildUrl: (n) => this.buildUrl(n),
3160
3196
  buildBodyParams: () => this.buildBodyParams(),
3161
3197
  buildWindowName: () => this.buildWindowName(),
3162
- submitBodyForm: (t, s, r) => this.submitBodyForm(t, s, r),
3198
+ submitBodyForm: (n, s, r) => this.submitBodyForm(n, s, r),
3163
3199
  onPopupClose: () => {
3164
3200
  this.close();
3165
3201
  },
3166
- registerCleanup: (t) => {
3167
- this.cleanup.register(t);
3202
+ registerCleanup: (n) => {
3203
+ this.cleanup.register(n);
3168
3204
  }
3169
- }), this.hostWindow && rt(this.uid, this.hostWindow);
3205
+ }), this.hostWindow && ft(this.uid, this.hostWindow);
3170
3206
  }
3171
3207
  /**
3172
3208
  * Builds the URL for the host window including query parameters.
3173
3209
  * @internal
3174
3210
  */
3175
3211
  buildUrl(e = this.resolveUrl()) {
3176
- const s = lt(this.props, this.options.props).toString();
3212
+ const s = wt(this.props, this.options.props).toString();
3177
3213
  if (!s) return e;
3178
3214
  const r = e.includes("?") ? "&" : "?";
3179
3215
  return `${e}${r}${s}`;
@@ -3183,14 +3219,14 @@ class pe {
3183
3219
  * @internal
3184
3220
  */
3185
3221
  buildBodyParams() {
3186
- return ut(this.props, this.options.props);
3222
+ return _t(this.props, this.options.props);
3187
3223
  }
3188
3224
  /**
3189
3225
  * Submits a hidden form to navigate a target window via POST.
3190
3226
  * @internal
3191
3227
  */
3192
- submitBodyForm(e, t, s) {
3193
- this.renderer.submitBodyForm(e, t, s);
3228
+ submitBodyForm(e, n, s) {
3229
+ this.renderer.submitBodyForm(e, n, s);
3194
3230
  }
3195
3231
  /**
3196
3232
  * Builds the window.name payload for the host window.
@@ -3213,16 +3249,16 @@ class pe {
3213
3249
  */
3214
3250
  buildNestedHostRefs() {
3215
3251
  if (!this.options.children) return;
3216
- const e = this.options.children({ props: this.props }), t = {};
3252
+ const e = this.options.children({ props: this.props }), n = {};
3217
3253
  for (const [s, r] of Object.entries(e)) {
3218
- const i = Pn(r);
3254
+ const i = Nn(r);
3219
3255
  if (!i)
3220
3256
  throw new Error(`Nested component "${s}" is missing component metadata`);
3221
3257
  if (typeof i.url != "string")
3222
3258
  throw new Error(
3223
3259
  `Nested component "${s}" must use a static string URL. Function URLs are not supported in children.`
3224
3260
  );
3225
- t[s] = {
3261
+ n[s] = {
3226
3262
  tag: i.tag,
3227
3263
  url: i.url,
3228
3264
  props: i.props,
@@ -3230,7 +3266,7 @@ class pe {
3230
3266
  defaultContext: i.defaultContext
3231
3267
  };
3232
3268
  }
3233
- return Object.keys(t).length > 0 ? t : void 0;
3269
+ return Object.keys(n).length > 0 ? n : void 0;
3234
3270
  }
3235
3271
  /**
3236
3272
  * Creates the exports object sent to the host.
@@ -3238,14 +3274,14 @@ class pe {
3238
3274
  */
3239
3275
  createConsumerExports() {
3240
3276
  return {
3241
- init: u.INIT,
3242
- close: u.CLOSE,
3243
- resize: u.RESIZE,
3244
- show: u.SHOW,
3245
- hide: u.HIDE,
3246
- onError: u.ERROR,
3247
- updateProps: u.PROPS,
3248
- export: u.EXPORT
3277
+ init: l.INIT,
3278
+ close: l.CLOSE,
3279
+ resize: l.RESIZE,
3280
+ show: l.SHOW,
3281
+ hide: l.HIDE,
3282
+ onError: l.ERROR,
3283
+ updateProps: l.PROPS,
3284
+ export: l.EXPORT
3249
3285
  };
3250
3286
  }
3251
3287
  /**
@@ -3293,7 +3329,7 @@ class pe {
3293
3329
  * @internal
3294
3330
  */
3295
3331
  async syncSameDomainPropsAfterInit() {
3296
- if (!(!this.hostWindow || !this.transport.isHostConnected()) && ve(this.hostWindow) && this.hasSameDomainPropDefinition())
3332
+ if (!(!this.hostWindow || !this.transport.isHostConnected()) && Me(this.hostWindow) && this.hasSameDomainPropDefinition())
3297
3333
  try {
3298
3334
  await this.propsPipeline.syncCurrentPropsToHost({
3299
3335
  shouldSendPropsToHost: () => this.transport.isHostConnected(),
@@ -3308,30 +3344,30 @@ class pe {
3308
3344
  * @internal
3309
3345
  */
3310
3346
  hasSameDomainPropDefinition() {
3311
- return Object.values(this.options.props).some((e) => !e || x(e) ? !1 : e.sameDomain === !0);
3347
+ return Object.values(this.options.props).some((e) => !e || D(e) ? !1 : e.sameDomain === !0);
3312
3348
  }
3313
3349
  /**
3314
3350
  * Gets sibling component instances for a request.
3315
3351
  * @internal
3316
3352
  */
3317
3353
  getSiblingInstances(e) {
3318
- const t = [];
3354
+ const n = [];
3319
3355
  if (e.options?.anyConsumer) {
3320
- for (const s of _n())
3321
- s.instance.uid !== e.uid && t.push({
3356
+ for (const s of Hn())
3357
+ s.instance.uid !== e.uid && n.push({
3322
3358
  uid: s.instance.uid,
3323
3359
  tag: s.tag,
3324
3360
  exports: s.instance.exports
3325
3361
  });
3326
- return t;
3362
+ return n;
3327
3363
  }
3328
- for (const s of wn(e.tag))
3329
- s.uid !== e.uid && t.push({
3364
+ for (const s of Un(e.tag))
3365
+ s.uid !== e.uid && n.push({
3330
3366
  uid: s.uid,
3331
3367
  tag: e.tag,
3332
3368
  exports: s.exports
3333
3369
  });
3334
- return t;
3370
+ return n;
3335
3371
  }
3336
3372
  /**
3337
3373
  * Registers cleanup handlers for the instance.
@@ -3339,7 +3375,7 @@ class pe {
3339
3375
  */
3340
3376
  setupCleanup() {
3341
3377
  this.cleanup.register(() => {
3342
- this.messenger.destroy(), this.bridge.destroy(), it(this.uid);
3378
+ this.messenger.destroy(), this.bridge.destroy(), pt(this.uid);
3343
3379
  });
3344
3380
  }
3345
3381
  /**
@@ -3353,11 +3389,11 @@ class pe {
3353
3389
  * Calls a prop callback if it exists.
3354
3390
  * @internal
3355
3391
  */
3356
- callPropCallback(e, ...t) {
3392
+ callPropCallback(e, ...n) {
3357
3393
  const s = this.props[e];
3358
3394
  if (typeof s == "function")
3359
3395
  try {
3360
- const r = s(...t);
3396
+ const r = s(...n);
3361
3397
  r && typeof r == "object" && "catch" in r && typeof r.catch == "function" && r.catch((i) => {
3362
3398
  console.error(`Error in async ${e} callback:`, i);
3363
3399
  });
@@ -3377,28 +3413,28 @@ class pe {
3377
3413
  ), this.initPromise = null), this.hostInitialized = !1, this.renderer.destroy(this.hostWindow), this.hostWindow = null, this.openedHostDomain = null, this.dynamicUrlTrustedOrigin = null, this.pendingPropsUpdate = null, await this.cleanup.cleanup(), this.event.emit(g.DESTROY), this.callPropCallback("onDestroy"), this.event.removeAllListeners());
3378
3414
  }
3379
3415
  }
3380
- const T = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Map();
3381
- function cn(n, e) {
3382
- const t = e;
3383
- T.get(t.uid) && Le(t.uid);
3384
- let r = U.get(n);
3385
- r || (r = /* @__PURE__ */ new Map(), U.set(n, r)), r.set(t.uid, t), T.set(t.uid, { tag: n, instance: t });
3416
+ const H = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map();
3417
+ function bn(t, e) {
3418
+ const n = e;
3419
+ H.get(n.uid) && Xe(n.uid);
3420
+ let r = N.get(t);
3421
+ r || (r = /* @__PURE__ */ new Map(), N.set(t, r)), r.set(n.uid, n), H.set(n.uid, { tag: t, instance: n });
3386
3422
  }
3387
- function Le(n) {
3388
- const e = T.get(n);
3423
+ function Xe(t) {
3424
+ const e = H.get(t);
3389
3425
  if (!e)
3390
3426
  return;
3391
- T.delete(n);
3392
- const t = U.get(e.tag);
3393
- t && (t.delete(n), t.size === 0 && U.delete(e.tag));
3427
+ H.delete(t);
3428
+ const n = N.get(e.tag);
3429
+ n && (n.delete(t), n.size === 0 && N.delete(e.tag));
3394
3430
  }
3395
- function ln(n) {
3396
- return Array.from(U.get(n)?.values() ?? []);
3431
+ function Cn(t) {
3432
+ return Array.from(N.get(t)?.values() ?? []);
3397
3433
  }
3398
- function un() {
3399
- return Array.from(T.values());
3434
+ function On() {
3435
+ return Array.from(H.values());
3400
3436
  }
3401
- const ze = "Could not resolve consumer window", G = "Could not verify consumer origin", hn = /* @__PURE__ */ new Set([
3437
+ const Ge = "Could not resolve consumer window", te = "Could not verify consumer origin", Rn = /* @__PURE__ */ new Set([
3402
3438
  "uid",
3403
3439
  "tag",
3404
3440
  "close",
@@ -3415,7 +3451,13 @@ const ze = "Could not resolve consumer window", G = "Could not verify consumer o
3415
3451
  "getPeerInstances",
3416
3452
  "children"
3417
3453
  ]);
3418
- class dn {
3454
+ function v(t) {
3455
+ const e = {};
3456
+ for (const [n, s] of Object.entries(t))
3457
+ Rn.has(n) || (e[n] = s);
3458
+ return e;
3459
+ }
3460
+ class xn {
3419
3461
  /**
3420
3462
  * Creates a new HostComponent instance.
3421
3463
  *
@@ -3424,11 +3466,11 @@ class dn {
3424
3466
  * @param allowedConsumerDomains - Optional allowlist of consumer domains
3425
3467
  * @param deferInit - Whether to defer INIT until a later explicit flush
3426
3468
  */
3427
- constructor(e, t = {}, s, r = !1) {
3428
- this.propDefinitions = t, this.allowedConsumerDomains = s, this.deferInit = r, this.uid = e.uid, this.tag = e.tag, this.event = new Ie();
3469
+ constructor(e, n = {}, s, r = !1) {
3470
+ this.propDefinitions = n, this.allowedConsumerDomains = s, this.deferInit = r, this.uid = e.uid, this.tag = e.tag, this.event = new Ae();
3429
3471
  let i = null, o = null;
3430
3472
  try {
3431
- this.consumerWindow = this.resolveConsumerWindow(), this.consumerDomain = this.resolveConsumerDomain(e.consumerDomain), o = new $e(this.uid, window, k(), this.consumerDomain), this.messenger = o, this.setupMessageHandlers(), i = new he(this.messenger), this.bridge = i, this.hostProps = this.buildHostProps(e), this.exposeHostProps(), this.deferInit || this.flushInit();
3473
+ this.consumerWindow = this.resolveConsumerWindow(), this.consumerDomain = this.resolveConsumerDomain(e.consumerDomain), o = new qe(this.uid, window, B(), this.consumerDomain), this.messenger = o, this.setupMessageHandlers(), i = new pe(this.messenger), this.bridge = i, this.hostProps = this.buildHostProps(e), this.exposeHostProps(), this.deferInit || this.flushInit();
3432
3474
  } catch (a) {
3433
3475
  throw i?.destroy(), o?.destroy(), this.event.removeAllListeners(), this.propsHandlers.clear(), a;
3434
3476
  }
@@ -3492,8 +3534,8 @@ class dn {
3492
3534
  configurable: !0,
3493
3535
  enumerable: !0,
3494
3536
  get: () => (this.deferInit && !this.initSent && !this.destroyed && this.scheduleDeferredInitFlush(), this.hostProps),
3495
- set: (t) => {
3496
- t && (this.hostProps = t);
3537
+ set: (n) => {
3538
+ n && (this.hostProps = n);
3497
3539
  }
3498
3540
  });
3499
3541
  } catch {
@@ -3508,9 +3550,9 @@ class dn {
3508
3550
  if (this.allowedConsumerDomains) {
3509
3551
  if (!this.consumerDomain)
3510
3552
  throw new Error(
3511
- `${G} for component "${this.tag}"`
3553
+ `${te} for component "${this.tag}"`
3512
3554
  );
3513
- if (!v(this.allowedConsumerDomains, this.consumerDomain))
3555
+ if (!U(this.allowedConsumerDomains, this.consumerDomain))
3514
3556
  throw new Error(
3515
3557
  `Consumer domain "${this.consumerDomain}" is not allowed for component "${this.tag}"`
3516
3558
  );
@@ -3527,16 +3569,16 @@ class dn {
3527
3569
  * Updates the tracked consumer origin and keeps trusted messaging origins in sync.
3528
3570
  * @internal
3529
3571
  */
3530
- setConsumerDomain(e, t) {
3572
+ setConsumerDomain(e, n) {
3531
3573
  const s = this.consumerDomain;
3532
- this.consumerDomain = e, this.consumerDomainVerified = t, !(!this.messenger || !s || s === e) && (this.messenger.removeTrustedDomain(s), this.messenger.addTrustedDomain(e));
3574
+ this.consumerDomain = e, this.consumerDomainVerified = n, !(!this.messenger || !s || s === e) && (this.messenger.removeTrustedDomain(s), this.messenger.addTrustedDomain(e));
3533
3575
  }
3534
3576
  /**
3535
3577
  * Applies host configuration that may arrive after deferred pre-initialization.
3536
3578
  * @internal
3537
3579
  */
3538
- applyHostConfiguration(e, t) {
3539
- t !== void 0 && (this.allowedConsumerDomains = t), e !== void 0 && (this.propDefinitions = e, S(this.consumerProps, this.getBootstrapValidationDefinitions()), Object.assign(this.hostProps, this.consumerProps), this.hostProps.consumer.props = this.consumerProps);
3580
+ applyHostConfiguration(e, n) {
3581
+ n !== void 0 && (this.allowedConsumerDomains = n), e !== void 0 && (this.propDefinitions = e, T(this.consumerProps, this.getBootstrapValidationDefinitions()), Object.assign(this.hostProps, v(this.consumerProps)), this.hostProps.consumer.props = this.consumerProps);
3540
3582
  }
3541
3583
  /**
3542
3584
  * Resolves the consumer origin from browser-provided context and falls back to the
@@ -3544,12 +3586,12 @@ class dn {
3544
3586
  * @internal
3545
3587
  */
3546
3588
  resolveConsumerDomain(e) {
3547
- const t = this.getVerifiedConsumerOrigin();
3548
- if (t)
3549
- return this.consumerDomainVerified = !0, this.consumerDomain = t, this.validateConsumerDomain(), t;
3589
+ const n = this.getVerifiedConsumerOrigin();
3590
+ if (n)
3591
+ return this.consumerDomainVerified = !0, this.consumerDomain = n, this.validateConsumerDomain(), n;
3550
3592
  if (this.consumerDomainVerified = !1, this.allowedConsumerDomains)
3551
3593
  throw new Error(
3552
- `${G} for component "${this.tag}"`
3594
+ `${te} for component "${this.tag}"`
3553
3595
  );
3554
3596
  return e;
3555
3597
  }
@@ -3558,12 +3600,12 @@ class dn {
3558
3600
  * @internal
3559
3601
  */
3560
3602
  assertAllowedConsumerDomain(e) {
3561
- const t = this.getVerifiedConsumerOrigin();
3562
- if (t && this.setConsumerDomain(t, !0), !this.consumerDomainVerified)
3603
+ const n = this.getVerifiedConsumerOrigin();
3604
+ if (n && this.setConsumerDomain(n, !0), !this.consumerDomainVerified)
3563
3605
  throw new Error(
3564
- `${G} for component "${this.tag}"`
3606
+ `${te} for component "${this.tag}"`
3565
3607
  );
3566
- if (!v(e, this.consumerDomain))
3608
+ if (!U(e, this.consumerDomain))
3567
3609
  throw new Error(
3568
3610
  `Consumer domain "${this.consumerDomain}" is not allowed for component "${this.tag}"`
3569
3611
  );
@@ -3605,22 +3647,22 @@ class dn {
3605
3647
  * @internal
3606
3648
  */
3607
3649
  resolveConsumerWindow() {
3608
- if (tt()) {
3609
- const e = et();
3650
+ if (lt()) {
3651
+ const e = ut();
3610
3652
  if (e) return e;
3611
3653
  }
3612
- if (nt()) {
3613
- const e = Qe();
3654
+ if (ht()) {
3655
+ const e = ct();
3614
3656
  if (e) return e;
3615
3657
  }
3616
- throw new Error(ze);
3658
+ throw new Error(Ge);
3617
3659
  }
3618
3660
  /**
3619
3661
  * Builds the hostProps object with deserialized props and control methods.
3620
3662
  * @internal
3621
3663
  */
3622
3664
  buildHostProps(e) {
3623
- const t = Oe(
3665
+ const n = Ue(
3624
3666
  e.props,
3625
3667
  this.propDefinitions,
3626
3668
  this.messenger,
@@ -3628,25 +3670,25 @@ class dn {
3628
3670
  this.consumerWindow,
3629
3671
  this.consumerDomain
3630
3672
  );
3631
- return S(t, this.getBootstrapValidationDefinitions()), this.consumerProps = t, {
3632
- ...t,
3673
+ return T(n, this.getBootstrapValidationDefinitions()), this.consumerProps = n, {
3674
+ ...v(n),
3633
3675
  uid: this.uid,
3634
3676
  tag: this.tag,
3635
3677
  close: () => this.close(),
3636
3678
  focus: () => this.focus(),
3637
- resize: (s) => this.resize(s),
3679
+ resize: (r) => this.resize(r),
3638
3680
  show: () => this.show(),
3639
3681
  hide: () => this.hide(),
3640
- onProps: (s) => this.onProps(s),
3641
- onError: (s) => this.onError(s),
3682
+ onProps: (r) => this.onProps(r),
3683
+ onError: (r) => this.onError(r),
3642
3684
  getConsumer: () => this.consumerWindow,
3643
3685
  getConsumerDomain: () => this.consumerDomain,
3644
- export: (s) => this.exportData(s),
3686
+ export: (r) => this.exportData(r),
3645
3687
  consumer: {
3646
3688
  props: this.consumerProps,
3647
- export: (s) => this.consumerExport(s)
3689
+ export: (r) => this.consumerExport(r)
3648
3690
  },
3649
- getPeerInstances: (s) => this.getPeerInstances(s),
3691
+ getPeerInstances: (r) => this.getPeerInstances(r),
3650
3692
  children: this.buildNestedComponents(e.children)
3651
3693
  };
3652
3694
  }
@@ -3656,18 +3698,18 @@ class dn {
3656
3698
  * @internal
3657
3699
  */
3658
3700
  getBootstrapValidationDefinitions() {
3659
- if (!this.consumerDomainVerified || this.consumerDomain !== k())
3701
+ if (!this.consumerDomainVerified || this.consumerDomain !== B())
3660
3702
  return this.propDefinitions;
3661
3703
  let e = !1;
3662
- const t = {
3704
+ const n = {
3663
3705
  ...this.propDefinitions
3664
3706
  };
3665
3707
  for (const [s, r] of Object.entries(this.propDefinitions))
3666
- !r || x(r) || !r.sameDomain || (e = !0, t[s] = {
3708
+ !r || D(r) || !r.sameDomain || (e = !0, n[s] = {
3667
3709
  ...r,
3668
3710
  required: !1
3669
3711
  });
3670
- return e ? t : this.propDefinitions;
3712
+ return e ? n : this.propDefinitions;
3671
3713
  }
3672
3714
  /**
3673
3715
  * Sends initialization message to the consumer.
@@ -3678,15 +3720,15 @@ class dn {
3678
3720
  await this.messenger.send(
3679
3721
  this.consumerWindow,
3680
3722
  this.consumerDomain,
3681
- u.INIT,
3723
+ l.INIT,
3682
3724
  { uid: this.uid, tag: this.tag }
3683
3725
  );
3684
3726
  } catch (e) {
3685
- const t = e instanceof Error ? e : new Error(String(e));
3686
- this.initError = t, this.event.emit(g.ERROR, {
3727
+ const n = e instanceof Error ? e : new Error(String(e));
3728
+ this.initError = n, this.event.emit(g.ERROR, {
3687
3729
  type: "init_failed",
3688
- message: `Failed to initialize host component: ${t.message}`,
3689
- error: t
3730
+ message: `Failed to initialize host component: ${n.message}`,
3731
+ error: n
3690
3732
  }), console.error("Failed to send init message:", e);
3691
3733
  }
3692
3734
  }
@@ -3706,7 +3748,7 @@ class dn {
3706
3748
  await this.messenger.send(
3707
3749
  this.consumerWindow,
3708
3750
  this.consumerDomain,
3709
- u.CLOSE,
3751
+ l.CLOSE,
3710
3752
  {}
3711
3753
  );
3712
3754
  }
@@ -3718,7 +3760,7 @@ class dn {
3718
3760
  window.focus(), await this.messenger.send(
3719
3761
  this.consumerWindow,
3720
3762
  this.consumerDomain,
3721
- u.FOCUS,
3763
+ l.FOCUS,
3722
3764
  {}
3723
3765
  );
3724
3766
  }
@@ -3730,7 +3772,7 @@ class dn {
3730
3772
  await this.messenger.send(
3731
3773
  this.consumerWindow,
3732
3774
  this.consumerDomain,
3733
- u.RESIZE,
3775
+ l.RESIZE,
3734
3776
  e
3735
3777
  );
3736
3778
  }
@@ -3742,7 +3784,7 @@ class dn {
3742
3784
  await this.messenger.send(
3743
3785
  this.consumerWindow,
3744
3786
  this.consumerDomain,
3745
- u.SHOW,
3787
+ l.SHOW,
3746
3788
  {}
3747
3789
  );
3748
3790
  }
@@ -3754,7 +3796,7 @@ class dn {
3754
3796
  await this.messenger.send(
3755
3797
  this.consumerWindow,
3756
3798
  this.consumerDomain,
3757
- u.HIDE,
3799
+ l.HIDE,
3758
3800
  {}
3759
3801
  );
3760
3802
  }
@@ -3775,7 +3817,7 @@ class dn {
3775
3817
  await this.messenger.send(
3776
3818
  this.consumerWindow,
3777
3819
  this.consumerDomain,
3778
- u.ERROR,
3820
+ l.ERROR,
3779
3821
  {
3780
3822
  message: e.message,
3781
3823
  stack: e.stack
@@ -3790,7 +3832,7 @@ class dn {
3790
3832
  await this.messenger.send(
3791
3833
  this.consumerWindow,
3792
3834
  this.consumerDomain,
3793
- u.EXPORT,
3835
+ l.EXPORT,
3794
3836
  e
3795
3837
  );
3796
3838
  }
@@ -3802,7 +3844,7 @@ class dn {
3802
3844
  await this.messenger.send(
3803
3845
  this.consumerWindow,
3804
3846
  this.consumerDomain,
3805
- u.CONSUMER_EXPORT,
3847
+ l.CONSUMER_EXPORT,
3806
3848
  e
3807
3849
  );
3808
3850
  }
@@ -3814,7 +3856,7 @@ class dn {
3814
3856
  return await this.messenger.send(
3815
3857
  this.consumerWindow,
3816
3858
  this.consumerDomain,
3817
- u.GET_SIBLINGS,
3859
+ l.GET_SIBLINGS,
3818
3860
  { uid: this.uid, tag: this.tag, options: e }
3819
3861
  ) ?? [];
3820
3862
  }
@@ -3824,10 +3866,10 @@ class dn {
3824
3866
  */
3825
3867
  buildNestedComponents(e) {
3826
3868
  if (!e) return;
3827
- const t = {};
3869
+ const n = {};
3828
3870
  for (const [s, r] of Object.entries(e))
3829
3871
  try {
3830
- t[s] = ke({
3872
+ n[s] = Qe({
3831
3873
  tag: r.tag,
3832
3874
  url: r.url,
3833
3875
  props: r.props,
@@ -3837,16 +3879,18 @@ class dn {
3837
3879
  } catch (i) {
3838
3880
  console.warn(`Failed to create nested component "${s}":`, i);
3839
3881
  }
3840
- return Object.keys(t).length > 0 ? t : void 0;
3882
+ return Object.keys(n).length > 0 ? n : void 0;
3841
3883
  }
3842
3884
  /**
3843
3885
  * Sets up message handlers for consumer communication.
3844
3886
  * @internal
3845
3887
  */
3846
3888
  setupMessageHandlers() {
3847
- this.messenger.on(u.PROPS, (e) => {
3889
+ this.messenger.on(l.PROPS, (e, n) => {
3890
+ if (!this.isConsumerSource(n))
3891
+ return { success: !1 };
3848
3892
  try {
3849
- const t = this.consumerProps, s = Oe(
3893
+ const s = this.consumerProps, r = Ue(
3850
3894
  e,
3851
3895
  this.propDefinitions,
3852
3896
  this.messenger,
@@ -3854,27 +3898,35 @@ class dn {
3854
3898
  this.consumerWindow,
3855
3899
  this.consumerDomain
3856
3900
  );
3857
- S(s, this.propDefinitions), this.removeStaleHostProps(t, s), this.consumerProps = s, Object.assign(this.hostProps, s), this.hostProps.consumer.props = this.consumerProps;
3858
- for (const r of this.propsHandlers)
3901
+ T(r, this.propDefinitions), this.removeStaleHostProps(s, r), this.consumerProps = r, Object.assign(this.hostProps, v(r)), this.hostProps.consumer.props = this.consumerProps;
3902
+ for (const i of this.propsHandlers)
3859
3903
  try {
3860
- r(s);
3861
- } catch (i) {
3862
- console.error("Error in props handler:", i);
3904
+ i(r);
3905
+ } catch (o) {
3906
+ console.error("Error in props handler:", o);
3863
3907
  }
3864
- return this.event.emit(g.PROPS, s), { success: !0 };
3865
- } catch (t) {
3866
- const s = t instanceof Error ? t : new Error(String(t));
3867
- throw console.error("Error deserializing props:", s), this.event.emit(g.ERROR, s), s;
3908
+ return this.event.emit(g.PROPS, r), { success: !0 };
3909
+ } catch (s) {
3910
+ const r = s instanceof Error ? s : new Error(String(s));
3911
+ throw console.error("Error deserializing props:", r), this.event.emit(g.ERROR, r), r;
3868
3912
  }
3869
3913
  });
3870
3914
  }
3915
+ /**
3916
+ * Returns true when a stateful inbound message came from the resolved consumer window.
3917
+ * @internal
3918
+ */
3919
+ isConsumerSource(e) {
3920
+ return e.window === this.consumerWindow;
3921
+ }
3871
3922
  /**
3872
3923
  * Removes stale prop keys that are no longer present in the latest consumer payload.
3873
3924
  * @internal
3874
3925
  */
3875
- removeStaleHostProps(e, t) {
3876
- for (const s of Object.keys(e))
3877
- s in t || hn.has(s) || delete this.hostProps[s];
3926
+ removeStaleHostProps(e, n) {
3927
+ const s = v(e), r = v(n);
3928
+ for (const i of Object.keys(s))
3929
+ i in r || delete this.hostProps[i];
3878
3930
  }
3879
3931
  /**
3880
3932
  * Destroys the host component and cleans up resources.
@@ -3884,179 +3936,208 @@ class dn {
3884
3936
  }
3885
3937
  }
3886
3938
  let w = null;
3887
- function fe(n, e, t = {}) {
3939
+ function ye(t, e, n = {}) {
3888
3940
  if (w) {
3889
3941
  try {
3890
3942
  w.applyHostConfiguration(
3891
- n,
3943
+ t,
3892
3944
  e
3893
3945
  ), e && w.assertAllowedConsumerDomain(e);
3894
3946
  } catch (r) {
3895
- throw gn(), r;
3947
+ throw vn(), r;
3896
3948
  }
3897
- return t.deferInit || w.flushInit(), w;
3949
+ return n.deferInit || w.flushInit(), w;
3898
3950
  }
3899
- if (!de())
3951
+ if (!me())
3900
3952
  return null;
3901
- const s = on();
3953
+ const s = Pn();
3902
3954
  if (!s)
3903
3955
  return console.error("Failed to parse ForgeFrame payload from window.name"), null;
3904
3956
  try {
3905
- w = new dn(
3957
+ w = new xn(
3906
3958
  s,
3907
- n,
3959
+ t,
3908
3960
  e,
3909
- t.deferInit ?? !1
3961
+ n.deferInit ?? !1
3910
3962
  );
3911
3963
  } catch (r) {
3912
- if (r instanceof Error && r.message === ze)
3964
+ if (r instanceof Error && r.message === Ge)
3913
3965
  return null;
3914
3966
  throw r;
3915
3967
  }
3916
3968
  return w;
3917
3969
  }
3918
- function pn() {
3919
- return de();
3970
+ function Dn() {
3971
+ return me();
3920
3972
  }
3921
- function fn() {
3922
- return de();
3973
+ function Sn() {
3974
+ return me();
3923
3975
  }
3924
- function mn() {
3976
+ function In() {
3925
3977
  return window.hostProps;
3926
3978
  }
3927
- function gn() {
3979
+ function vn() {
3928
3980
  w && (w.destroy(), w = null), delete window.hostProps;
3929
3981
  }
3930
- const V = /* @__PURE__ */ new Map(), Me = /* @__PURE__ */ Symbol("forgeframe.component.options");
3931
- function yn(n) {
3932
- if (!n.tag)
3982
+ function we() {
3983
+ return typeof window < "u" && typeof window.location < "u";
3984
+ }
3985
+ const K = /* @__PURE__ */ new Map(), Ze = /* @__PURE__ */ Symbol("forgeframe.component.options");
3986
+ function Tn(t) {
3987
+ if (!t.tag)
3933
3988
  throw new Error("Component tag is required");
3934
- if (!/^[a-z][a-z0-9-]*$/.test(n.tag))
3989
+ if (!/^[a-z][a-z0-9-]*$/.test(t.tag))
3935
3990
  throw new Error(
3936
- `Invalid component tag "${n.tag}". Must start with lowercase letter and contain only lowercase letters, numbers, and hyphens.`
3991
+ `Invalid component tag "${t.tag}". Must start with lowercase letter and contain only lowercase letters, numbers, and hyphens.`
3937
3992
  );
3938
- if (!n.url)
3993
+ if (!t.url)
3939
3994
  throw new Error("Component url is required");
3940
- if (typeof n.url == "string")
3995
+ if (typeof t.url == "string")
3941
3996
  try {
3942
- new URL(n.url, window.location.origin);
3997
+ const e = we() ? window.location.origin : "https://forgeframe.invalid";
3998
+ new URL(t.url, e);
3943
3999
  } catch {
3944
4000
  throw new Error(
3945
- `Invalid component URL "${n.url}". Must be a valid absolute or relative URL.`
4001
+ `Invalid component URL "${t.url}". Must be a valid absolute or relative URL.`
3946
4002
  );
3947
4003
  }
3948
- if (V.has(n.tag))
3949
- throw new Error(`Component "${n.tag}" is already registered`);
4004
+ if (K.has(t.tag))
4005
+ throw new Error(`Component "${t.tag}" is already registered`);
3950
4006
  }
3951
- function ke(n) {
3952
- yn(n);
4007
+ function Qe(t) {
4008
+ Tn(t);
3953
4009
  const e = [];
3954
- let t;
3955
- if (X(n.tag)) {
3956
- const r = fe(n.props, n.allowedConsumerDomains);
3957
- r && (t = r.hostProps);
3958
- }
3959
- const s = function(r = {}) {
3960
- const i = new pe(n, r);
3961
- return e.push(i), cn(n.tag, i), i.event.once("destroy", () => {
3962
- const o = e.indexOf(i);
3963
- o !== -1 && e.splice(o, 1), Le(i.uid);
3964
- }), i;
4010
+ let n;
4011
+ const s = () => we() && gn(t.tag), r = () => {
4012
+ if (n)
4013
+ return n;
4014
+ if (!s())
4015
+ return;
4016
+ const a = ye(t.props, t.allowedConsumerDomains);
4017
+ if (a)
4018
+ return n = a.hostProps, n;
4019
+ };
4020
+ r();
4021
+ const i = () => (r(), n !== void 0 || s()), o = function(a = {}) {
4022
+ const c = new ge(t, a);
4023
+ return e.push(c), bn(t.tag, c), c.event.once("destroy", () => {
4024
+ const u = e.indexOf(c);
4025
+ u !== -1 && e.splice(u, 1), Xe(c.uid);
4026
+ }), c;
3965
4027
  };
3966
- return s.instances = e, s.isHost = () => X(n.tag), s.isEmbedded = () => X(n.tag), s.hostProps = t, s[Me] = n, s.canRenderTo = async (r) => r === window, V.set(n.tag, s), s;
4028
+ return o.instances = e, o.isHost = () => i(), o.isEmbedded = () => i(), Object.defineProperty(o, "hostProps", {
4029
+ configurable: !0,
4030
+ enumerable: !0,
4031
+ get: () => r()
4032
+ }), o[Ze] = t, o.canRenderTo = async (a) => a === window, K.set(t.tag, o), o;
3967
4033
  }
3968
- function wn(n) {
3969
- return ln(n);
4034
+ function Un(t) {
4035
+ return Cn(t);
3970
4036
  }
3971
- function _n() {
3972
- return un();
4037
+ function Hn() {
4038
+ return On();
3973
4039
  }
3974
- function Pn(n) {
3975
- return n[Me];
4040
+ function Nn(t) {
4041
+ return t[Ze];
3976
4042
  }
3977
- async function En(n) {
3978
- await n.close();
4043
+ async function Fn(t) {
4044
+ await t.close();
3979
4045
  }
3980
- async function We(n) {
3981
- const e = V.get(n);
4046
+ async function et(t) {
4047
+ const e = K.get(t);
3982
4048
  if (!e) return;
3983
- const t = [...e.instances];
3984
- await Promise.all(t.map((s) => s.close()));
4049
+ const n = [...e.instances];
4050
+ await Promise.all(n.map((s) => s.close()));
3985
4051
  }
3986
- async function bn() {
3987
- const n = Array.from(V.keys());
3988
- await Promise.all(n.map((e) => We(e)));
4052
+ async function $n() {
4053
+ const t = Array.from(K.keys());
4054
+ await Promise.all(t.map((e) => et(e)));
3989
4055
  }
3990
- function On(n, e) {
3991
- const t = Object.keys(n), s = Object.keys(e);
3992
- if (t.length !== s.length)
4056
+ function An(t, e) {
4057
+ const n = Object.keys(t), s = Object.keys(e);
4058
+ if (n.length !== s.length)
3993
4059
  return !1;
3994
- for (const r of t)
3995
- if (!Object.prototype.hasOwnProperty.call(e, r) || !Object.is(n[r], e[r]))
4060
+ for (const r of n)
4061
+ if (!Object.prototype.hasOwnProperty.call(e, r) || !Object.is(t[r], e[r]))
3996
4062
  return !1;
3997
4063
  return !0;
3998
4064
  }
3999
- function Cn(n, e) {
4000
- const { React: t } = e, { createElement: s, useRef: r, useEffect: i, useState: o, forwardRef: a } = t, c = a(
4001
- function(h, d) {
4065
+ function Ln(t, e) {
4066
+ const { React: n } = e, { createElement: s, useRef: r, useEffect: i, useState: o, forwardRef: a } = n, c = a(
4067
+ function(m, h) {
4002
4068
  const {
4003
- onRendered: C,
4004
- onError: q,
4005
- onClose: me,
4006
- context: Be,
4007
- className: ge,
4008
- style: ye,
4009
- ...J
4010
- } = h, F = r(null), K = r(null), H = r(null), $ = r(q), [we, je] = o(null);
4069
+ onRendered: E,
4070
+ onError: C,
4071
+ onClose: X,
4072
+ context: _e,
4073
+ className: Pe,
4074
+ style: Ee,
4075
+ ...G
4076
+ } = m, Z = r(null), S = r(null), $ = r(null), be = r(E), A = r(C), Ce = r(X), [Oe, Re] = o(null);
4011
4077
  return i(() => {
4012
- $.current = q;
4013
- }, [q]), i(() => {
4014
- const D = F.current;
4015
- if (!D) return;
4016
- const y = n(J);
4017
- return K.current = y, H.current = J, C && y.event.once("rendered", C), me && y.event.once("close", me), y.event.on("error", (E) => {
4018
- $.current?.(E);
4019
- }), y.render(D, Be).catch((E) => {
4020
- je(E), $.current?.(E);
4078
+ be.current = E, A.current = C, Ce.current = X;
4079
+ }, [E, C, X]), i(() => {
4080
+ const _ = Z.current;
4081
+ if (!_) return;
4082
+ Re(null);
4083
+ const y = t(G);
4084
+ S.current = y, $.current = G;
4085
+ const L = y.event.once("rendered", () => {
4086
+ be.current?.();
4087
+ }), xe = y.event.once("close", () => {
4088
+ Ce.current?.();
4089
+ }), Q = y.event.on("error", (M) => {
4090
+ A.current?.(M);
4091
+ });
4092
+ return y.render(_, _e).catch((M) => {
4093
+ S.current === y && (Re(M), A.current?.(M));
4021
4094
  }), () => {
4022
4095
  y.close().catch(() => {
4023
- }), K.current = null, H.current = null;
4096
+ }), L(), xe(), Q(), S.current = null, $.current = null;
4024
4097
  };
4025
- }, []), i(() => {
4026
- const D = K.current;
4027
- if (!D) return;
4028
- const y = J, E = H.current;
4029
- E && On(E, y) || (H.current = y, D.updateProps(y).catch((Ve) => {
4030
- $.current?.(Ve);
4098
+ }, [_e]), i(() => {
4099
+ const _ = S.current;
4100
+ if (!_) return;
4101
+ const y = G, L = $.current;
4102
+ L && An(L, y) || ($.current = y, _.updateProps(y).catch((Q) => {
4103
+ S.current === _ && A.current?.(Q);
4031
4104
  }));
4032
4105
  }), i(() => {
4033
- d && typeof d == "object" && F.current && (d.current = F.current);
4034
- }, [d]), we ? s(
4106
+ const _ = Z.current;
4107
+ if (typeof h == "function")
4108
+ return h(_), () => {
4109
+ h(null);
4110
+ };
4111
+ if (h && typeof h == "object")
4112
+ return h.current = _, () => {
4113
+ h.current = null;
4114
+ };
4115
+ }, [h]), Oe ? s(
4035
4116
  "div",
4036
4117
  {
4037
- className: ge,
4038
- style: { color: "red", padding: "16px", ...ye }
4118
+ className: Pe,
4119
+ style: { color: "red", padding: "16px", ...Ee }
4039
4120
  },
4040
- `Error: ${we.message}`
4121
+ `Error: ${Oe.message}`
4041
4122
  ) : s("div", {
4042
- ref: F,
4043
- className: ge,
4123
+ ref: Z,
4124
+ className: Pe,
4044
4125
  style: {
4045
4126
  display: "inline-block",
4046
- ...ye
4127
+ ...Ee
4047
4128
  }
4048
4129
  });
4049
4130
  }
4050
- ), l = `ForgeFrame(${n.name || "Component"})`;
4051
- return c.displayName = l, c;
4131
+ ), u = `ForgeFrame(${t.name || "Component"})`;
4132
+ return c.displayName = u, c;
4052
4133
  }
4053
- function xn(n) {
4054
- return function(t) {
4055
- return Cn(t, { React: n });
4134
+ function Mn(t) {
4135
+ return function(n) {
4136
+ return Ln(n, { React: t });
4056
4137
  };
4057
4138
  }
4058
- fe(void 0, void 0, { deferInit: !0 });
4059
- const Dn = {
4139
+ we() && ye(void 0, void 0, { deferInit: !0 });
4140
+ const zn = {
4060
4141
  /**
4061
4142
  * Create a new component definition.
4062
4143
  *
@@ -4081,23 +4162,23 @@ const Dn = {
4081
4162
  * await instance.render('#container');
4082
4163
  * ```
4083
4164
  */
4084
- create: ke,
4165
+ create: Qe,
4085
4166
  /**
4086
4167
  * Destroy a single component instance.
4087
4168
  *
4088
4169
  * @param instance - The component instance to destroy
4089
4170
  */
4090
- destroy: En,
4171
+ destroy: Fn,
4091
4172
  /**
4092
4173
  * Destroy all instances of a specific component by tag.
4093
4174
  *
4094
4175
  * @param tag - The component tag name
4095
4176
  */
4096
- destroyByTag: We,
4177
+ destroyByTag: et,
4097
4178
  /**
4098
4179
  * Destroy all ForgeFrame component instances.
4099
4180
  */
4100
- destroyAll: bn,
4181
+ destroyAll: $n,
4101
4182
  /**
4102
4183
  * Check if the current window is a host component context.
4103
4184
  *
@@ -4107,7 +4188,7 @@ const Dn = {
4107
4188
  *
4108
4189
  * @returns True if running inside a ForgeFrame iframe/popup
4109
4190
  */
4110
- isHost: pn,
4191
+ isHost: Dn,
4111
4192
  /**
4112
4193
  * Check if the current window is embedded by ForgeFrame.
4113
4194
  *
@@ -4116,7 +4197,7 @@ const Dn = {
4116
4197
  *
4117
4198
  * @returns True if running inside a ForgeFrame iframe/popup
4118
4199
  */
4119
- isEmbedded: fn,
4200
+ isEmbedded: Sn,
4120
4201
  /**
4121
4202
  * Get hostProps from the current host window.
4122
4203
  *
@@ -4125,7 +4206,7 @@ const Dn = {
4125
4206
  *
4126
4207
  * @returns The hostProps object if in host context, undefined otherwise
4127
4208
  */
4128
- getHostProps: mn,
4209
+ getHostProps: In,
4129
4210
  /**
4130
4211
  * Flush host initialization in embedded contexts.
4131
4212
  *
@@ -4136,17 +4217,17 @@ const Dn = {
4136
4217
  *
4137
4218
  * @returns The host component instance if running embedded, otherwise null
4138
4219
  */
4139
- initHost: fe,
4220
+ initHost: ye,
4140
4221
  /**
4141
4222
  * Serialization strategy constants.
4142
4223
  * @see {@link PROP_SERIALIZATION}
4143
4224
  */
4144
- PROP_SERIALIZATION: A,
4225
+ PROP_SERIALIZATION: z,
4145
4226
  /**
4146
4227
  * Rendering context constants (IFRAME, POPUP).
4147
4228
  * @see {@link CONTEXT}
4148
4229
  */
4149
- CONTEXT: f,
4230
+ CONTEXT: p,
4150
4231
  /**
4151
4232
  * Lifecycle event name constants.
4152
4233
  * @see {@link EVENT}
@@ -4155,11 +4236,11 @@ const Dn = {
4155
4236
  /**
4156
4237
  * Error thrown when popup window fails to open.
4157
4238
  */
4158
- PopupOpenError: He,
4239
+ PopupOpenError: Je,
4159
4240
  /**
4160
4241
  * Current library version.
4161
4242
  */
4162
- VERSION: se,
4243
+ VERSION: oe,
4163
4244
  /**
4164
4245
  * Check if a value is a Standard Schema (Zod, Valibot, ArkType, etc.)
4165
4246
  *
@@ -4176,7 +4257,7 @@ const Dn = {
4176
4257
  * }
4177
4258
  * ```
4178
4259
  */
4179
- isStandardSchema: x,
4260
+ isStandardSchema: D,
4180
4261
  /**
4181
4262
  * Prop schema builders for defining component props.
4182
4263
  *
@@ -4199,36 +4280,36 @@ const Dn = {
4199
4280
  * });
4200
4281
  * ```
4201
4282
  */
4202
- prop: p
4283
+ prop: f
4203
4284
  };
4204
4285
  export {
4205
- ue as AnySchema,
4206
- W as ArraySchema,
4207
- oe as BooleanSchema,
4208
- f as CONTEXT,
4286
+ fe as AnySchema,
4287
+ V as ArraySchema,
4288
+ ue as BooleanSchema,
4289
+ p as CONTEXT,
4209
4290
  g as EVENT,
4210
- le as EnumSchema,
4211
- Dn as ForgeFrame,
4212
- ae as FunctionSchema,
4213
- ce as LiteralSchema,
4214
- ie as NumberSchema,
4215
- B as ObjectSchema,
4216
- A as PROP_SERIALIZATION,
4217
- He as PopupOpenError,
4218
- _ as PropSchema,
4219
- re as StringSchema,
4220
- se as VERSION,
4221
- ke as create,
4222
- Cn as createReactComponent,
4223
- Dn as default,
4224
- En as destroy,
4225
- bn as destroyAll,
4226
- We as destroyByTag,
4227
- mn as getHostProps,
4228
- fe as initHost,
4229
- fn as isEmbedded,
4230
- pn as isHost,
4231
- x as isStandardSchema,
4232
- p as prop,
4233
- xn as withReactComponent
4291
+ de as EnumSchema,
4292
+ zn as ForgeFrame,
4293
+ le as FunctionSchema,
4294
+ he as LiteralSchema,
4295
+ ce as NumberSchema,
4296
+ Y as ObjectSchema,
4297
+ z as PROP_SERIALIZATION,
4298
+ Je as PopupOpenError,
4299
+ P as PropSchema,
4300
+ ae as StringSchema,
4301
+ oe as VERSION,
4302
+ Qe as create,
4303
+ Ln as createReactComponent,
4304
+ zn as default,
4305
+ Fn as destroy,
4306
+ $n as destroyAll,
4307
+ et as destroyByTag,
4308
+ In as getHostProps,
4309
+ ye as initHost,
4310
+ Sn as isEmbedded,
4311
+ Dn as isHost,
4312
+ D as isStandardSchema,
4313
+ f as prop,
4314
+ Mn as withReactComponent
4234
4315
  };