forgeframe 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,14 +26,14 @@ 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 */
@@ -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__", ae = (() => {
67
+ if ("0.0.10".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.10";
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 S = /* @__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 = S.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) {
378
- const r = I.keys().next().value;
379
- r && I.delete(r);
376
+ const n = t.split("*").map((r) => it(r)).join(".*"), s = new RegExp(`^${n}$`);
377
+ if (S.size >= rt) {
378
+ const r = S.keys().next().value;
379
+ r && S.delete(r);
380
380
  }
381
- return I.set(n, s), s;
381
+ return S.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 se(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 lt(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 ut(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
+ se(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 pt(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 ft(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 ce 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 ce();
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 le 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 le();
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 he 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 he();
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 de 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 de(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 pe 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 pe(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,7 +1054,7 @@ 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
  }
@@ -1071,7 +1071,7 @@ const p = {
1071
1071
  * prop.string().pattern(/^[a-z]+$/)
1072
1072
  * ```
1073
1073
  */
1074
- string: () => new re(),
1074
+ string: () => new ce(),
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 le(),
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 he(),
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 de(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 pe(t),
1164
1164
  /**
1165
1165
  * Creates a schema that accepts any value.
1166
1166
  *
@@ -1172,8 +1172,8 @@ 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
1178
  schema: p.string().optional(),
1179
1179
  sendToHost: !0
@@ -1240,25 +1240,25 @@ const p = {
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 H(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 Ie(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 } = H(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 l = a.alias, d = i in t, m = l && l in t;
1285
+ if (d)
1286
+ c = t[i];
1287
+ else if (m)
1288
+ c = t[l];
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 } = H(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 Se(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 } = H(a), l = 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 = l;
1331
+ c.hostDecorate && l !== void 0 && (d = c.hostDecorate({ value: l, 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 } = H(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
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);
1345
+ typeof o.queryParam == "function" ? l = o.queryParam({ value: a }) : typeof a == "object" ? l = JSON.stringify(a) : l = String(a), n.set(c, l);
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 } = H(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
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);
1359
+ typeof o.bodyParam == "function" ? l = o.bodyParam({ value: a }) : typeof a == "object" ? l = JSON.stringify(a) : l = String(a), n.set(c, l);
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 me {
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, u.CALL, {
1425
1425
  id: e.__id__,
1426
1426
  args: a
1427
1427
  });
@@ -1446,11 +1446,11 @@ class he {
1446
1446
  setupCallHandler() {
1447
1447
  this.messenger.on(
1448
1448
  u.CALL,
1449
- async ({ id: e, args: t }) => {
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 re(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) => re(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] = re(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 ie(t, e, n, s, r = /* @__PURE__ */ new WeakSet()) {
1560
+ if (me.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) => ie(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] = ie(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 Ot(t, e) {
1606
+ return `${Be(t)}=${bt(e)}`;
1607
+ }
1608
+ function Ct(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 : Ct(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(Ot(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 l = Dt(i);
1653
+ if (l.some((h) => !je(h))) continue;
1654
+ let d = e;
1655
+ for (let h = 0; h < l.length - 1; h++) {
1656
+ const E = l[h], O = d[E];
1657
+ (!Object.prototype.hasOwnProperty.call(d, E) || typeof O != "object" || O === null || Array.isArray(O)) && (d[E] = {}), d = d[E];
1629
1658
  }
1630
- const m = c[c.length - 1];
1631
- l[m] = a;
1659
+ const m = l[l.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 It(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 St(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
+ } : re(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(
1709
+ for (const [c, l] of Object.entries(t)) {
1710
+ if (!je(c)) continue;
1711
+ const d = o[c];
1712
+ a[c] = Tt(
1685
1713
  l,
1686
- m,
1687
- t,
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 (It(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 ie(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 Nt {
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 = Ie(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 = Ie(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 Ft(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 Ht(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 Ne(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();
1889
+ ].join(","), l = window.open(e, n, c);
1890
+ if (!l || Vt(l))
1891
+ throw new Je();
1864
1892
  return l;
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,18 +1919,18 @@ 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
1924
  const l = () => {
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) {
1933
+ if (t.closed) {
1906
1934
  l();
1907
1935
  return;
1908
1936
  }
@@ -1910,59 +1938,59 @@ function Nt(n, e, t = {}) {
1910
1938
  l();
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 Fe = "forgeframe-spinner-style";
1959
+ function qt(t, e) {
1960
+ const n = t.getElementById(Fe);
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 = Fe, 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,24 +2041,24 @@ 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;
2058
+ const r = this.getProps(), i = this.options.prerenderTemplate ?? Xt, o = this.options.containerTemplate ?? Kt, a = this.resolveDimensions(), c = r.cspNonce;
2031
2059
  if (this.context === f.IFRAME) {
2032
- const d = t();
2033
- this.iframe = e(d), Ce(this.iframe);
2060
+ const h = n();
2061
+ this.iframe = e(h), Ne(this.iframe);
2034
2062
  }
2035
2063
  const l = {
2036
2064
  uid: this.uid,
@@ -2047,7 +2075,7 @@ class kt {
2047
2075
  cspNonce: c
2048
2076
  };
2049
2077
  this.prerenderElement = i(l);
2050
- const m = {
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 Ft({
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;
2117
+ const n = e.buildUrl(e.baseUrl), s = e.buildBodyParams(), r = s.toString().length > 0;
2090
2118
  if (this.context === f.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,17 +2135,17 @@ 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 === f.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
2150
  const l = r.createElement("input");
2123
2151
  l.type = "hidden", l.name = a, l.value = c, o.appendChild(l);
@@ -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 === f.IFRAME && this.iframe ? Lt(this.iframe) : this.context === f.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 === f.IFRAME && this.iframe ? $t(this.iframe, e) : this.context === f.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 === f.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 === f.IFRAME && this.iframe && Ne(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 && (Ht(this.iframe), this.iframe = null), this.context === f.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 oe = "forgeframe:";
2192
+ function ee(t) {
2193
+ return oe + 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(oe)) 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(oe.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 He(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 };
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 };
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 = He(o, s, r, {
2329
2357
  uid: this.uid,
2330
2358
  domain: this.domain
2331
- }), c = Se(), l = setTimeout(() => {
2359
+ }), c = Le(), l = 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
2364
  timeout: l,
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(l), 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 = He(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 ln = [
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 un(t) {
2500
+ const e = gn(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 yn(e);
2480
2508
  }
2481
- function b(n) {
2482
- return typeof n == "object" && n !== null;
2509
+ function C(t) {
2510
+ return typeof t == "object" && t !== null;
2483
2511
  }
2484
- function Gt(n) {
2485
- return b(n);
2512
+ function hn(t) {
2513
+ return C(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 C(t) && ln.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 pn(t) {
2521
+ if (!C(t) || typeof t.tag != "string" || t.tag.length === 0 || typeof t.url != "string" || t.url.length === 0 || t.props !== void 0 && !C(t.props) || t.defaultContext !== void 0 && t.defaultContext !== f.IFRAME && t.defaultContext !== f.POPUP)
2494
2522
  return !1;
2495
- if (n.dimensions !== void 0) {
2496
- if (!b(n.dimensions))
2523
+ if (t.dimensions !== void 0) {
2524
+ if (!C(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 fn(t) {
2533
+ return C(t) ? Object.values(t).every((e) => pn(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 !(!C(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 !== ae || t.context !== f.IFRAME && t.context !== f.POPUP || typeof t.consumerDomain != "string" || t.consumerDomain.length === 0 || !hn(t.props) || !dn(t.exports) || t.children !== void 0 && !fn(t.children));
2509
2537
  }
2510
- function de(n = window) {
2538
+ function ge(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 te(t, e = window) {
2546
+ return Ke(e.name)?.tag === t;
2519
2547
  }
2520
- function nn(n) {
2548
+ function gn(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 = new Blob([n]).size;
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 yn(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 wn(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: ae,
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 _n(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 Pn {
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 me(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 && !se(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 = St(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,17 +2652,17 @@ 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 || se(this.hostWindow))
2629
2657
  return;
2630
- const s = this.getHostDomain(), r = Ee(
2658
+ const s = this.getHostDomain(), r = Se(
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 {
@@ -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 = Se(
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 = wn({
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 un(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;
@@ -2696,16 +2724,16 @@ class an {
2696
2724
  */
2697
2725
  setupMessageHandlers(e) {
2698
2726
  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);
2727
+ Promise.resolve(e.onInit?.()).catch((n) => {
2728
+ e.onError(n);
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(
2730
+ }), { success: !0 })), this.messenger.on(u.CLOSE, async () => (await e.onClose(), { success: !0 })), this.messenger.on(u.RESIZE, async (n) => (await e.onResize(n), { 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
2731
  u.ERROR,
2704
- async (t) => {
2705
- const s = new Error(t.message);
2706
- return s.stack = t.stack, e.onError(s), { success: !0 };
2732
+ async (n) => {
2733
+ const s = new Error(n.message);
2734
+ return s.stack = n.stack, e.onError(s), { success: !0 };
2707
2735
  }
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));
2736
+ ), this.messenger.on(u.EXPORT, async (n) => (e.onExport(n), { success: !0 })), this.messenger.on(u.CONSUMER_EXPORT, async (n) => (e.onConsumerExport(n), { success: !0 })), this.messenger.on(u.GET_SIBLINGS, async (n) => e.onGetSiblings(n));
2709
2737
  }
2710
2738
  /**
2711
2739
  * Destroys transport resources.
@@ -2714,7 +2742,7 @@ class an {
2714
2742
  this.messenger.destroy(), this.bridge.destroy();
2715
2743
  }
2716
2744
  }
2717
- class pe {
2745
+ class ye {
2718
2746
  /** Event emitter for lifecycle events. */
2719
2747
  event;
2720
2748
  /** Arbitrary state storage for the component instance. */
@@ -2854,8 +2882,8 @@ class pe {
2854
2882
  * @param options - Component configuration options
2855
2883
  * @param props - Initial props to pass to the component
2856
2884
  */
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(
2885
+ constructor(e, n = {}) {
2886
+ this._uid = tt(), this.options = this.normalizeOptions(e), this.event = new Ae(), this.cleanup = new nt(), this.renderer = new en(
2859
2887
  this.options,
2860
2888
  this.uid,
2861
2889
  () => this.props,
@@ -2864,11 +2892,11 @@ class pe {
2864
2892
  close: () => this.close(),
2865
2893
  focus: () => this.focus()
2866
2894
  }
2867
- ), this.propsPipeline = new Pt(
2895
+ ), this.propsPipeline = new Nt(
2868
2896
  this.options,
2869
- { ...t },
2897
+ { ...n },
2870
2898
  (s) => this.createPropContext(s)
2871
- ), this.transport = new an(
2899
+ ), this.transport = new Pn(
2872
2900
  this.uid,
2873
2901
  this.options,
2874
2902
  () => this.resolveUrl(),
@@ -2893,12 +2921,12 @@ class pe {
2893
2921
  * await instance.render(document.getElementById('target'), 'popup');
2894
2922
  * ```
2895
2923
  */
2896
- async render(e, t) {
2924
+ async render(e, n) {
2897
2925
  if (this.destroyed)
2898
2926
  throw new Error("Component has been destroyed");
2899
2927
  if (this.rendered)
2900
2928
  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");
2929
+ 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
2930
  try {
2903
2931
  await this.open(), await this.waitForHost(), this.context === f.IFRAME && this.iframe && await this.renderer.swapPrerenderContentIfNeeded();
2904
2932
  } catch (s) {
@@ -2918,10 +2946,10 @@ class pe {
2918
2946
  * @param container - CSS selector or HTMLElement to render into
2919
2947
  * @param context - Override the default rendering context
2920
2948
  */
2921
- async renderTo(e, t, s) {
2949
+ async renderTo(e, n, s) {
2922
2950
  if (e !== window)
2923
2951
  throw new Error("Cross-window renderTo is not supported; pass the current window");
2924
- return this.render(t, s);
2952
+ return this.render(n, s);
2925
2953
  }
2926
2954
  /**
2927
2955
  * Closes and destroys the component.
@@ -2990,7 +3018,7 @@ class pe {
2990
3018
  * @internal
2991
3019
  */
2992
3020
  async applyPropsUpdate(e) {
2993
- const t = {
3021
+ const n = {
2994
3022
  resolveUrl: (s) => this.resolveUrl(s),
2995
3023
  resolveUrlOrigin: (s) => this.resolveUrlOrigin(s),
2996
3024
  assertStableRenderedOrigin: (s) => this.assertStableRenderedOrigin(s),
@@ -3000,7 +3028,7 @@ class pe {
3000
3028
  sendPropsUpdateToHost: (s) => this.sendPropsUpdateToHost(s),
3001
3029
  emitPropsUpdated: () => this.emitPropsUpdated()
3002
3030
  };
3003
- await this.propsPipeline.updateProps(e, t);
3031
+ await this.propsPipeline.updateProps(e, n);
3004
3032
  }
3005
3033
  /**
3006
3034
  * Prevents origin changes after render for security and routing consistency.
@@ -3032,7 +3060,7 @@ class pe {
3032
3060
  * @returns A new unrendered component instance with identical configuration
3033
3061
  */
3034
3062
  clone() {
3035
- const e = new pe(this.options, this.props);
3063
+ const e = new ye(this.options, this.props);
3036
3064
  return e.inputProps = { ...this.inputProps }, e;
3037
3065
  }
3038
3066
  /**
@@ -3094,8 +3122,8 @@ class pe {
3094
3122
  * @internal
3095
3123
  */
3096
3124
  syncTrustedDomainForUrl(e) {
3097
- const t = this.resolveUrlOrigin(e);
3098
- t && this.isExplicitDomainTrust(t), this.transport.syncTrustedDomainForUrl(e);
3125
+ const n = this.resolveUrlOrigin(e);
3126
+ n && this.isExplicitDomainTrust(n), this.transport.syncTrustedDomainForUrl(e);
3099
3127
  }
3100
3128
  /**
3101
3129
  * Creates the prop context passed to prop callbacks and validators.
@@ -3107,7 +3135,7 @@ class pe {
3107
3135
  state: this.state,
3108
3136
  close: () => this.close(),
3109
3137
  focus: () => this.focus(),
3110
- onError: (t) => this.handleError(t),
3138
+ onError: (n) => this.handleError(n),
3111
3139
  container: this.container,
3112
3140
  uid: this.uid,
3113
3141
  tag: this.options.tag
@@ -3156,24 +3184,24 @@ class pe {
3156
3184
  const e = this.resolveUrl();
3157
3185
  this.syncTrustedDomainForUrl(e), this.openedHostDomain = this.resolveUrlOrigin(e), this.hostWindow = this.renderer.open({
3158
3186
  baseUrl: e,
3159
- buildUrl: (t) => this.buildUrl(t),
3187
+ buildUrl: (n) => this.buildUrl(n),
3160
3188
  buildBodyParams: () => this.buildBodyParams(),
3161
3189
  buildWindowName: () => this.buildWindowName(),
3162
- submitBodyForm: (t, s, r) => this.submitBodyForm(t, s, r),
3190
+ submitBodyForm: (n, s, r) => this.submitBodyForm(n, s, r),
3163
3191
  onPopupClose: () => {
3164
3192
  this.close();
3165
3193
  },
3166
- registerCleanup: (t) => {
3167
- this.cleanup.register(t);
3194
+ registerCleanup: (n) => {
3195
+ this.cleanup.register(n);
3168
3196
  }
3169
- }), this.hostWindow && rt(this.uid, this.hostWindow);
3197
+ }), this.hostWindow && pt(this.uid, this.hostWindow);
3170
3198
  }
3171
3199
  /**
3172
3200
  * Builds the URL for the host window including query parameters.
3173
3201
  * @internal
3174
3202
  */
3175
3203
  buildUrl(e = this.resolveUrl()) {
3176
- const s = lt(this.props, this.options.props).toString();
3204
+ const s = wt(this.props, this.options.props).toString();
3177
3205
  if (!s) return e;
3178
3206
  const r = e.includes("?") ? "&" : "?";
3179
3207
  return `${e}${r}${s}`;
@@ -3183,14 +3211,14 @@ class pe {
3183
3211
  * @internal
3184
3212
  */
3185
3213
  buildBodyParams() {
3186
- return ut(this.props, this.options.props);
3214
+ return _t(this.props, this.options.props);
3187
3215
  }
3188
3216
  /**
3189
3217
  * Submits a hidden form to navigate a target window via POST.
3190
3218
  * @internal
3191
3219
  */
3192
- submitBodyForm(e, t, s) {
3193
- this.renderer.submitBodyForm(e, t, s);
3220
+ submitBodyForm(e, n, s) {
3221
+ this.renderer.submitBodyForm(e, n, s);
3194
3222
  }
3195
3223
  /**
3196
3224
  * Builds the window.name payload for the host window.
@@ -3213,16 +3241,16 @@ class pe {
3213
3241
  */
3214
3242
  buildNestedHostRefs() {
3215
3243
  if (!this.options.children) return;
3216
- const e = this.options.children({ props: this.props }), t = {};
3244
+ const e = this.options.children({ props: this.props }), n = {};
3217
3245
  for (const [s, r] of Object.entries(e)) {
3218
- const i = Pn(r);
3246
+ const i = Nn(r);
3219
3247
  if (!i)
3220
3248
  throw new Error(`Nested component "${s}" is missing component metadata`);
3221
3249
  if (typeof i.url != "string")
3222
3250
  throw new Error(
3223
3251
  `Nested component "${s}" must use a static string URL. Function URLs are not supported in children.`
3224
3252
  );
3225
- t[s] = {
3253
+ n[s] = {
3226
3254
  tag: i.tag,
3227
3255
  url: i.url,
3228
3256
  props: i.props,
@@ -3230,7 +3258,7 @@ class pe {
3230
3258
  defaultContext: i.defaultContext
3231
3259
  };
3232
3260
  }
3233
- return Object.keys(t).length > 0 ? t : void 0;
3261
+ return Object.keys(n).length > 0 ? n : void 0;
3234
3262
  }
3235
3263
  /**
3236
3264
  * Creates the exports object sent to the host.
@@ -3293,7 +3321,7 @@ class pe {
3293
3321
  * @internal
3294
3322
  */
3295
3323
  async syncSameDomainPropsAfterInit() {
3296
- if (!(!this.hostWindow || !this.transport.isHostConnected()) && ve(this.hostWindow) && this.hasSameDomainPropDefinition())
3324
+ if (!(!this.hostWindow || !this.transport.isHostConnected()) && Me(this.hostWindow) && this.hasSameDomainPropDefinition())
3297
3325
  try {
3298
3326
  await this.propsPipeline.syncCurrentPropsToHost({
3299
3327
  shouldSendPropsToHost: () => this.transport.isHostConnected(),
@@ -3308,30 +3336,30 @@ class pe {
3308
3336
  * @internal
3309
3337
  */
3310
3338
  hasSameDomainPropDefinition() {
3311
- return Object.values(this.options.props).some((e) => !e || x(e) ? !1 : e.sameDomain === !0);
3339
+ return Object.values(this.options.props).some((e) => !e || D(e) ? !1 : e.sameDomain === !0);
3312
3340
  }
3313
3341
  /**
3314
3342
  * Gets sibling component instances for a request.
3315
3343
  * @internal
3316
3344
  */
3317
3345
  getSiblingInstances(e) {
3318
- const t = [];
3346
+ const n = [];
3319
3347
  if (e.options?.anyConsumer) {
3320
- for (const s of _n())
3321
- s.instance.uid !== e.uid && t.push({
3348
+ for (const s of Un())
3349
+ s.instance.uid !== e.uid && n.push({
3322
3350
  uid: s.instance.uid,
3323
3351
  tag: s.tag,
3324
3352
  exports: s.instance.exports
3325
3353
  });
3326
- return t;
3354
+ return n;
3327
3355
  }
3328
- for (const s of wn(e.tag))
3329
- s.uid !== e.uid && t.push({
3356
+ for (const s of Tn(e.tag))
3357
+ s.uid !== e.uid && n.push({
3330
3358
  uid: s.uid,
3331
3359
  tag: e.tag,
3332
3360
  exports: s.exports
3333
3361
  });
3334
- return t;
3362
+ return n;
3335
3363
  }
3336
3364
  /**
3337
3365
  * Registers cleanup handlers for the instance.
@@ -3339,7 +3367,7 @@ class pe {
3339
3367
  */
3340
3368
  setupCleanup() {
3341
3369
  this.cleanup.register(() => {
3342
- this.messenger.destroy(), this.bridge.destroy(), it(this.uid);
3370
+ this.messenger.destroy(), this.bridge.destroy(), ft(this.uid);
3343
3371
  });
3344
3372
  }
3345
3373
  /**
@@ -3353,11 +3381,11 @@ class pe {
3353
3381
  * Calls a prop callback if it exists.
3354
3382
  * @internal
3355
3383
  */
3356
- callPropCallback(e, ...t) {
3384
+ callPropCallback(e, ...n) {
3357
3385
  const s = this.props[e];
3358
3386
  if (typeof s == "function")
3359
3387
  try {
3360
- const r = s(...t);
3388
+ const r = s(...n);
3361
3389
  r && typeof r == "object" && "catch" in r && typeof r.catch == "function" && r.catch((i) => {
3362
3390
  console.error(`Error in async ${e} callback:`, i);
3363
3391
  });
@@ -3377,28 +3405,28 @@ class pe {
3377
3405
  ), 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
3406
  }
3379
3407
  }
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 });
3408
+ const N = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map();
3409
+ function En(t, e) {
3410
+ const n = e;
3411
+ N.get(n.uid) && Xe(n.uid);
3412
+ let r = F.get(t);
3413
+ r || (r = /* @__PURE__ */ new Map(), F.set(t, r)), r.set(n.uid, n), N.set(n.uid, { tag: t, instance: n });
3386
3414
  }
3387
- function Le(n) {
3388
- const e = T.get(n);
3415
+ function Xe(t) {
3416
+ const e = N.get(t);
3389
3417
  if (!e)
3390
3418
  return;
3391
- T.delete(n);
3392
- const t = U.get(e.tag);
3393
- t && (t.delete(n), t.size === 0 && U.delete(e.tag));
3419
+ N.delete(t);
3420
+ const n = F.get(e.tag);
3421
+ n && (n.delete(t), n.size === 0 && F.delete(e.tag));
3394
3422
  }
3395
- function ln(n) {
3396
- return Array.from(U.get(n)?.values() ?? []);
3423
+ function bn(t) {
3424
+ return Array.from(F.get(t)?.values() ?? []);
3397
3425
  }
3398
- function un() {
3399
- return Array.from(T.values());
3426
+ function On() {
3427
+ return Array.from(N.values());
3400
3428
  }
3401
- const ze = "Could not resolve consumer window", G = "Could not verify consumer origin", hn = /* @__PURE__ */ new Set([
3429
+ const Ge = "Could not resolve consumer window", ne = "Could not verify consumer origin", Cn = /* @__PURE__ */ new Set([
3402
3430
  "uid",
3403
3431
  "tag",
3404
3432
  "close",
@@ -3415,7 +3443,13 @@ const ze = "Could not resolve consumer window", G = "Could not verify consumer o
3415
3443
  "getPeerInstances",
3416
3444
  "children"
3417
3445
  ]);
3418
- class dn {
3446
+ function v(t) {
3447
+ const e = {};
3448
+ for (const [n, s] of Object.entries(t))
3449
+ Cn.has(n) || (e[n] = s);
3450
+ return e;
3451
+ }
3452
+ class Rn {
3419
3453
  /**
3420
3454
  * Creates a new HostComponent instance.
3421
3455
  *
@@ -3424,11 +3458,11 @@ class dn {
3424
3458
  * @param allowedConsumerDomains - Optional allowlist of consumer domains
3425
3459
  * @param deferInit - Whether to defer INIT until a later explicit flush
3426
3460
  */
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();
3461
+ constructor(e, n = {}, s, r = !1) {
3462
+ this.propDefinitions = n, this.allowedConsumerDomains = s, this.deferInit = r, this.uid = e.uid, this.tag = e.tag, this.event = new Ae();
3429
3463
  let i = null, o = null;
3430
3464
  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();
3465
+ 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 me(this.messenger), this.bridge = i, this.hostProps = this.buildHostProps(e), this.exposeHostProps(), this.deferInit || this.flushInit();
3432
3466
  } catch (a) {
3433
3467
  throw i?.destroy(), o?.destroy(), this.event.removeAllListeners(), this.propsHandlers.clear(), a;
3434
3468
  }
@@ -3492,8 +3526,8 @@ class dn {
3492
3526
  configurable: !0,
3493
3527
  enumerable: !0,
3494
3528
  get: () => (this.deferInit && !this.initSent && !this.destroyed && this.scheduleDeferredInitFlush(), this.hostProps),
3495
- set: (t) => {
3496
- t && (this.hostProps = t);
3529
+ set: (n) => {
3530
+ n && (this.hostProps = n);
3497
3531
  }
3498
3532
  });
3499
3533
  } catch {
@@ -3508,9 +3542,9 @@ class dn {
3508
3542
  if (this.allowedConsumerDomains) {
3509
3543
  if (!this.consumerDomain)
3510
3544
  throw new Error(
3511
- `${G} for component "${this.tag}"`
3545
+ `${ne} for component "${this.tag}"`
3512
3546
  );
3513
- if (!v(this.allowedConsumerDomains, this.consumerDomain))
3547
+ if (!U(this.allowedConsumerDomains, this.consumerDomain))
3514
3548
  throw new Error(
3515
3549
  `Consumer domain "${this.consumerDomain}" is not allowed for component "${this.tag}"`
3516
3550
  );
@@ -3527,16 +3561,16 @@ class dn {
3527
3561
  * Updates the tracked consumer origin and keeps trusted messaging origins in sync.
3528
3562
  * @internal
3529
3563
  */
3530
- setConsumerDomain(e, t) {
3564
+ setConsumerDomain(e, n) {
3531
3565
  const s = this.consumerDomain;
3532
- this.consumerDomain = e, this.consumerDomainVerified = t, !(!this.messenger || !s || s === e) && (this.messenger.removeTrustedDomain(s), this.messenger.addTrustedDomain(e));
3566
+ this.consumerDomain = e, this.consumerDomainVerified = n, !(!this.messenger || !s || s === e) && (this.messenger.removeTrustedDomain(s), this.messenger.addTrustedDomain(e));
3533
3567
  }
3534
3568
  /**
3535
3569
  * Applies host configuration that may arrive after deferred pre-initialization.
3536
3570
  * @internal
3537
3571
  */
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);
3572
+ applyHostConfiguration(e, n) {
3573
+ 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
3574
  }
3541
3575
  /**
3542
3576
  * Resolves the consumer origin from browser-provided context and falls back to the
@@ -3544,12 +3578,12 @@ class dn {
3544
3578
  * @internal
3545
3579
  */
3546
3580
  resolveConsumerDomain(e) {
3547
- const t = this.getVerifiedConsumerOrigin();
3548
- if (t)
3549
- return this.consumerDomainVerified = !0, this.consumerDomain = t, this.validateConsumerDomain(), t;
3581
+ const n = this.getVerifiedConsumerOrigin();
3582
+ if (n)
3583
+ return this.consumerDomainVerified = !0, this.consumerDomain = n, this.validateConsumerDomain(), n;
3550
3584
  if (this.consumerDomainVerified = !1, this.allowedConsumerDomains)
3551
3585
  throw new Error(
3552
- `${G} for component "${this.tag}"`
3586
+ `${ne} for component "${this.tag}"`
3553
3587
  );
3554
3588
  return e;
3555
3589
  }
@@ -3558,12 +3592,12 @@ class dn {
3558
3592
  * @internal
3559
3593
  */
3560
3594
  assertAllowedConsumerDomain(e) {
3561
- const t = this.getVerifiedConsumerOrigin();
3562
- if (t && this.setConsumerDomain(t, !0), !this.consumerDomainVerified)
3595
+ const n = this.getVerifiedConsumerOrigin();
3596
+ if (n && this.setConsumerDomain(n, !0), !this.consumerDomainVerified)
3563
3597
  throw new Error(
3564
- `${G} for component "${this.tag}"`
3598
+ `${ne} for component "${this.tag}"`
3565
3599
  );
3566
- if (!v(e, this.consumerDomain))
3600
+ if (!U(e, this.consumerDomain))
3567
3601
  throw new Error(
3568
3602
  `Consumer domain "${this.consumerDomain}" is not allowed for component "${this.tag}"`
3569
3603
  );
@@ -3605,22 +3639,22 @@ class dn {
3605
3639
  * @internal
3606
3640
  */
3607
3641
  resolveConsumerWindow() {
3608
- if (tt()) {
3609
- const e = et();
3642
+ if (ut()) {
3643
+ const e = lt();
3610
3644
  if (e) return e;
3611
3645
  }
3612
- if (nt()) {
3613
- const e = Qe();
3646
+ if (ht()) {
3647
+ const e = ct();
3614
3648
  if (e) return e;
3615
3649
  }
3616
- throw new Error(ze);
3650
+ throw new Error(Ge);
3617
3651
  }
3618
3652
  /**
3619
3653
  * Builds the hostProps object with deserialized props and control methods.
3620
3654
  * @internal
3621
3655
  */
3622
3656
  buildHostProps(e) {
3623
- const t = Oe(
3657
+ const n = Ue(
3624
3658
  e.props,
3625
3659
  this.propDefinitions,
3626
3660
  this.messenger,
@@ -3628,25 +3662,25 @@ class dn {
3628
3662
  this.consumerWindow,
3629
3663
  this.consumerDomain
3630
3664
  );
3631
- return S(t, this.getBootstrapValidationDefinitions()), this.consumerProps = t, {
3632
- ...t,
3665
+ return T(n, this.getBootstrapValidationDefinitions()), this.consumerProps = n, {
3666
+ ...v(n),
3633
3667
  uid: this.uid,
3634
3668
  tag: this.tag,
3635
3669
  close: () => this.close(),
3636
3670
  focus: () => this.focus(),
3637
- resize: (s) => this.resize(s),
3671
+ resize: (r) => this.resize(r),
3638
3672
  show: () => this.show(),
3639
3673
  hide: () => this.hide(),
3640
- onProps: (s) => this.onProps(s),
3641
- onError: (s) => this.onError(s),
3674
+ onProps: (r) => this.onProps(r),
3675
+ onError: (r) => this.onError(r),
3642
3676
  getConsumer: () => this.consumerWindow,
3643
3677
  getConsumerDomain: () => this.consumerDomain,
3644
- export: (s) => this.exportData(s),
3678
+ export: (r) => this.exportData(r),
3645
3679
  consumer: {
3646
3680
  props: this.consumerProps,
3647
- export: (s) => this.consumerExport(s)
3681
+ export: (r) => this.consumerExport(r)
3648
3682
  },
3649
- getPeerInstances: (s) => this.getPeerInstances(s),
3683
+ getPeerInstances: (r) => this.getPeerInstances(r),
3650
3684
  children: this.buildNestedComponents(e.children)
3651
3685
  };
3652
3686
  }
@@ -3656,18 +3690,18 @@ class dn {
3656
3690
  * @internal
3657
3691
  */
3658
3692
  getBootstrapValidationDefinitions() {
3659
- if (!this.consumerDomainVerified || this.consumerDomain !== k())
3693
+ if (!this.consumerDomainVerified || this.consumerDomain !== B())
3660
3694
  return this.propDefinitions;
3661
3695
  let e = !1;
3662
- const t = {
3696
+ const n = {
3663
3697
  ...this.propDefinitions
3664
3698
  };
3665
3699
  for (const [s, r] of Object.entries(this.propDefinitions))
3666
- !r || x(r) || !r.sameDomain || (e = !0, t[s] = {
3700
+ !r || D(r) || !r.sameDomain || (e = !0, n[s] = {
3667
3701
  ...r,
3668
3702
  required: !1
3669
3703
  });
3670
- return e ? t : this.propDefinitions;
3704
+ return e ? n : this.propDefinitions;
3671
3705
  }
3672
3706
  /**
3673
3707
  * Sends initialization message to the consumer.
@@ -3682,11 +3716,11 @@ class dn {
3682
3716
  { uid: this.uid, tag: this.tag }
3683
3717
  );
3684
3718
  } catch (e) {
3685
- const t = e instanceof Error ? e : new Error(String(e));
3686
- this.initError = t, this.event.emit(g.ERROR, {
3719
+ const n = e instanceof Error ? e : new Error(String(e));
3720
+ this.initError = n, this.event.emit(g.ERROR, {
3687
3721
  type: "init_failed",
3688
- message: `Failed to initialize host component: ${t.message}`,
3689
- error: t
3722
+ message: `Failed to initialize host component: ${n.message}`,
3723
+ error: n
3690
3724
  }), console.error("Failed to send init message:", e);
3691
3725
  }
3692
3726
  }
@@ -3824,10 +3858,10 @@ class dn {
3824
3858
  */
3825
3859
  buildNestedComponents(e) {
3826
3860
  if (!e) return;
3827
- const t = {};
3861
+ const n = {};
3828
3862
  for (const [s, r] of Object.entries(e))
3829
3863
  try {
3830
- t[s] = ke({
3864
+ n[s] = Qe({
3831
3865
  tag: r.tag,
3832
3866
  url: r.url,
3833
3867
  props: r.props,
@@ -3837,7 +3871,7 @@ class dn {
3837
3871
  } catch (i) {
3838
3872
  console.warn(`Failed to create nested component "${s}":`, i);
3839
3873
  }
3840
- return Object.keys(t).length > 0 ? t : void 0;
3874
+ return Object.keys(n).length > 0 ? n : void 0;
3841
3875
  }
3842
3876
  /**
3843
3877
  * Sets up message handlers for consumer communication.
@@ -3846,7 +3880,7 @@ class dn {
3846
3880
  setupMessageHandlers() {
3847
3881
  this.messenger.on(u.PROPS, (e) => {
3848
3882
  try {
3849
- const t = this.consumerProps, s = Oe(
3883
+ const n = this.consumerProps, s = Ue(
3850
3884
  e,
3851
3885
  this.propDefinitions,
3852
3886
  this.messenger,
@@ -3854,7 +3888,7 @@ class dn {
3854
3888
  this.consumerWindow,
3855
3889
  this.consumerDomain
3856
3890
  );
3857
- S(s, this.propDefinitions), this.removeStaleHostProps(t, s), this.consumerProps = s, Object.assign(this.hostProps, s), this.hostProps.consumer.props = this.consumerProps;
3891
+ T(s, this.propDefinitions), this.removeStaleHostProps(n, s), this.consumerProps = s, Object.assign(this.hostProps, v(s)), this.hostProps.consumer.props = this.consumerProps;
3858
3892
  for (const r of this.propsHandlers)
3859
3893
  try {
3860
3894
  r(s);
@@ -3862,8 +3896,8 @@ class dn {
3862
3896
  console.error("Error in props handler:", i);
3863
3897
  }
3864
3898
  return this.event.emit(g.PROPS, s), { success: !0 };
3865
- } catch (t) {
3866
- const s = t instanceof Error ? t : new Error(String(t));
3899
+ } catch (n) {
3900
+ const s = n instanceof Error ? n : new Error(String(n));
3867
3901
  throw console.error("Error deserializing props:", s), this.event.emit(g.ERROR, s), s;
3868
3902
  }
3869
3903
  });
@@ -3872,9 +3906,10 @@ class dn {
3872
3906
  * Removes stale prop keys that are no longer present in the latest consumer payload.
3873
3907
  * @internal
3874
3908
  */
3875
- removeStaleHostProps(e, t) {
3876
- for (const s of Object.keys(e))
3877
- s in t || hn.has(s) || delete this.hostProps[s];
3909
+ removeStaleHostProps(e, n) {
3910
+ const s = v(e), r = v(n);
3911
+ for (const i of Object.keys(s))
3912
+ i in r || delete this.hostProps[i];
3878
3913
  }
3879
3914
  /**
3880
3915
  * Destroys the host component and cleans up resources.
@@ -3884,179 +3919,194 @@ class dn {
3884
3919
  }
3885
3920
  }
3886
3921
  let w = null;
3887
- function fe(n, e, t = {}) {
3922
+ function we(t, e, n = {}) {
3888
3923
  if (w) {
3889
3924
  try {
3890
3925
  w.applyHostConfiguration(
3891
- n,
3926
+ t,
3892
3927
  e
3893
3928
  ), e && w.assertAllowedConsumerDomain(e);
3894
3929
  } catch (r) {
3895
- throw gn(), r;
3930
+ throw Sn(), r;
3896
3931
  }
3897
- return t.deferInit || w.flushInit(), w;
3932
+ return n.deferInit || w.flushInit(), w;
3898
3933
  }
3899
- if (!de())
3934
+ if (!ge())
3900
3935
  return null;
3901
- const s = on();
3936
+ const s = _n();
3902
3937
  if (!s)
3903
3938
  return console.error("Failed to parse ForgeFrame payload from window.name"), null;
3904
3939
  try {
3905
- w = new dn(
3940
+ w = new Rn(
3906
3941
  s,
3907
- n,
3942
+ t,
3908
3943
  e,
3909
- t.deferInit ?? !1
3944
+ n.deferInit ?? !1
3910
3945
  );
3911
3946
  } catch (r) {
3912
- if (r instanceof Error && r.message === ze)
3947
+ if (r instanceof Error && r.message === Ge)
3913
3948
  return null;
3914
3949
  throw r;
3915
3950
  }
3916
3951
  return w;
3917
3952
  }
3918
- function pn() {
3919
- return de();
3953
+ function xn() {
3954
+ return ge();
3920
3955
  }
3921
- function fn() {
3922
- return de();
3956
+ function Dn() {
3957
+ return ge();
3923
3958
  }
3924
- function mn() {
3959
+ function In() {
3925
3960
  return window.hostProps;
3926
3961
  }
3927
- function gn() {
3962
+ function Sn() {
3928
3963
  w && (w.destroy(), w = null), delete window.hostProps;
3929
3964
  }
3930
- const V = /* @__PURE__ */ new Map(), Me = /* @__PURE__ */ Symbol("forgeframe.component.options");
3931
- function yn(n) {
3932
- if (!n.tag)
3965
+ const K = /* @__PURE__ */ new Map(), Ze = /* @__PURE__ */ Symbol("forgeframe.component.options");
3966
+ function vn(t) {
3967
+ if (!t.tag)
3933
3968
  throw new Error("Component tag is required");
3934
- if (!/^[a-z][a-z0-9-]*$/.test(n.tag))
3969
+ if (!/^[a-z][a-z0-9-]*$/.test(t.tag))
3935
3970
  throw new Error(
3936
- `Invalid component tag "${n.tag}". Must start with lowercase letter and contain only lowercase letters, numbers, and hyphens.`
3971
+ `Invalid component tag "${t.tag}". Must start with lowercase letter and contain only lowercase letters, numbers, and hyphens.`
3937
3972
  );
3938
- if (!n.url)
3973
+ if (!t.url)
3939
3974
  throw new Error("Component url is required");
3940
- if (typeof n.url == "string")
3975
+ if (typeof t.url == "string")
3941
3976
  try {
3942
- new URL(n.url, window.location.origin);
3977
+ new URL(t.url, window.location.origin);
3943
3978
  } catch {
3944
3979
  throw new Error(
3945
- `Invalid component URL "${n.url}". Must be a valid absolute or relative URL.`
3980
+ `Invalid component URL "${t.url}". Must be a valid absolute or relative URL.`
3946
3981
  );
3947
3982
  }
3948
- if (V.has(n.tag))
3949
- throw new Error(`Component "${n.tag}" is already registered`);
3983
+ if (K.has(t.tag))
3984
+ throw new Error(`Component "${t.tag}" is already registered`);
3950
3985
  }
3951
- function ke(n) {
3952
- yn(n);
3986
+ function Qe(t) {
3987
+ vn(t);
3953
3988
  const e = [];
3954
- let t;
3955
- if (X(n.tag)) {
3956
- const r = fe(n.props, n.allowedConsumerDomains);
3957
- r && (t = r.hostProps);
3989
+ let n;
3990
+ if (te(t.tag)) {
3991
+ const r = we(t.props, t.allowedConsumerDomains);
3992
+ r && (n = r.hostProps);
3958
3993
  }
3959
3994
  const s = function(r = {}) {
3960
- const i = new pe(n, r);
3961
- return e.push(i), cn(n.tag, i), i.event.once("destroy", () => {
3995
+ const i = new ye(t, r);
3996
+ return e.push(i), En(t.tag, i), i.event.once("destroy", () => {
3962
3997
  const o = e.indexOf(i);
3963
- o !== -1 && e.splice(o, 1), Le(i.uid);
3998
+ o !== -1 && e.splice(o, 1), Xe(i.uid);
3964
3999
  }), i;
3965
4000
  };
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;
4001
+ return s.instances = e, s.isHost = () => te(t.tag), s.isEmbedded = () => te(t.tag), s.hostProps = n, s[Ze] = t, s.canRenderTo = async (r) => r === window, K.set(t.tag, s), s;
3967
4002
  }
3968
- function wn(n) {
3969
- return ln(n);
4003
+ function Tn(t) {
4004
+ return bn(t);
3970
4005
  }
3971
- function _n() {
3972
- return un();
4006
+ function Un() {
4007
+ return On();
3973
4008
  }
3974
- function Pn(n) {
3975
- return n[Me];
4009
+ function Nn(t) {
4010
+ return t[Ze];
3976
4011
  }
3977
- async function En(n) {
3978
- await n.close();
4012
+ async function Fn(t) {
4013
+ await t.close();
3979
4014
  }
3980
- async function We(n) {
3981
- const e = V.get(n);
4015
+ async function et(t) {
4016
+ const e = K.get(t);
3982
4017
  if (!e) return;
3983
- const t = [...e.instances];
3984
- await Promise.all(t.map((s) => s.close()));
4018
+ const n = [...e.instances];
4019
+ await Promise.all(n.map((s) => s.close()));
3985
4020
  }
3986
- async function bn() {
3987
- const n = Array.from(V.keys());
3988
- await Promise.all(n.map((e) => We(e)));
4021
+ async function Hn() {
4022
+ const t = Array.from(K.keys());
4023
+ await Promise.all(t.map((e) => et(e)));
3989
4024
  }
3990
- function On(n, e) {
3991
- const t = Object.keys(n), s = Object.keys(e);
3992
- if (t.length !== s.length)
4025
+ function $n(t, e) {
4026
+ const n = Object.keys(t), s = Object.keys(e);
4027
+ if (n.length !== s.length)
3993
4028
  return !1;
3994
- for (const r of t)
3995
- if (!Object.prototype.hasOwnProperty.call(e, r) || !Object.is(n[r], e[r]))
4029
+ for (const r of n)
4030
+ if (!Object.prototype.hasOwnProperty.call(e, r) || !Object.is(t[r], e[r]))
3996
4031
  return !1;
3997
4032
  return !0;
3998
4033
  }
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) {
4034
+ function An(t, e) {
4035
+ const { React: n } = e, { createElement: s, useRef: r, useEffect: i, useState: o, forwardRef: a } = n, c = a(
4036
+ function(m, h) {
4002
4037
  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);
4038
+ onRendered: E,
4039
+ onError: O,
4040
+ onClose: X,
4041
+ context: _e,
4042
+ className: Pe,
4043
+ style: Ee,
4044
+ ...G
4045
+ } = m, Z = r(null), I = r(null), $ = r(null), be = r(E), A = r(O), Oe = r(X), [Ce, Re] = o(null);
4011
4046
  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);
4047
+ be.current = E, A.current = O, Oe.current = X;
4048
+ }, [E, O, X]), i(() => {
4049
+ const _ = Z.current;
4050
+ if (!_) return;
4051
+ Re(null);
4052
+ const y = t(G);
4053
+ I.current = y, $.current = G;
4054
+ const L = y.event.once("rendered", () => {
4055
+ be.current?.();
4056
+ }), xe = y.event.once("close", () => {
4057
+ Oe.current?.();
4058
+ }), Q = y.event.on("error", (M) => {
4059
+ A.current?.(M);
4060
+ });
4061
+ return y.render(_, _e).catch((M) => {
4062
+ I.current === y && (Re(M), A.current?.(M));
4021
4063
  }), () => {
4022
4064
  y.close().catch(() => {
4023
- }), K.current = null, H.current = null;
4065
+ }), L(), xe(), Q(), I.current = null, $.current = null;
4024
4066
  };
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);
4067
+ }, [_e]), i(() => {
4068
+ const _ = I.current;
4069
+ if (!_) return;
4070
+ const y = G, L = $.current;
4071
+ L && $n(L, y) || ($.current = y, _.updateProps(y).catch((Q) => {
4072
+ I.current === _ && A.current?.(Q);
4031
4073
  }));
4032
4074
  }), i(() => {
4033
- d && typeof d == "object" && F.current && (d.current = F.current);
4034
- }, [d]), we ? s(
4075
+ const _ = Z.current;
4076
+ if (typeof h == "function")
4077
+ return h(_), () => {
4078
+ h(null);
4079
+ };
4080
+ if (h && typeof h == "object")
4081
+ return h.current = _, () => {
4082
+ h.current = null;
4083
+ };
4084
+ }, [h]), Ce ? s(
4035
4085
  "div",
4036
4086
  {
4037
- className: ge,
4038
- style: { color: "red", padding: "16px", ...ye }
4087
+ className: Pe,
4088
+ style: { color: "red", padding: "16px", ...Ee }
4039
4089
  },
4040
- `Error: ${we.message}`
4090
+ `Error: ${Ce.message}`
4041
4091
  ) : s("div", {
4042
- ref: F,
4043
- className: ge,
4092
+ ref: Z,
4093
+ className: Pe,
4044
4094
  style: {
4045
4095
  display: "inline-block",
4046
- ...ye
4096
+ ...Ee
4047
4097
  }
4048
4098
  });
4049
4099
  }
4050
- ), l = `ForgeFrame(${n.name || "Component"})`;
4100
+ ), l = `ForgeFrame(${t.name || "Component"})`;
4051
4101
  return c.displayName = l, c;
4052
4102
  }
4053
- function xn(n) {
4054
- return function(t) {
4055
- return Cn(t, { React: n });
4103
+ function Ln(t) {
4104
+ return function(n) {
4105
+ return An(n, { React: t });
4056
4106
  };
4057
4107
  }
4058
- fe(void 0, void 0, { deferInit: !0 });
4059
- const Dn = {
4108
+ we(void 0, void 0, { deferInit: !0 });
4109
+ const Mn = {
4060
4110
  /**
4061
4111
  * Create a new component definition.
4062
4112
  *
@@ -4081,23 +4131,23 @@ const Dn = {
4081
4131
  * await instance.render('#container');
4082
4132
  * ```
4083
4133
  */
4084
- create: ke,
4134
+ create: Qe,
4085
4135
  /**
4086
4136
  * Destroy a single component instance.
4087
4137
  *
4088
4138
  * @param instance - The component instance to destroy
4089
4139
  */
4090
- destroy: En,
4140
+ destroy: Fn,
4091
4141
  /**
4092
4142
  * Destroy all instances of a specific component by tag.
4093
4143
  *
4094
4144
  * @param tag - The component tag name
4095
4145
  */
4096
- destroyByTag: We,
4146
+ destroyByTag: et,
4097
4147
  /**
4098
4148
  * Destroy all ForgeFrame component instances.
4099
4149
  */
4100
- destroyAll: bn,
4150
+ destroyAll: Hn,
4101
4151
  /**
4102
4152
  * Check if the current window is a host component context.
4103
4153
  *
@@ -4107,7 +4157,7 @@ const Dn = {
4107
4157
  *
4108
4158
  * @returns True if running inside a ForgeFrame iframe/popup
4109
4159
  */
4110
- isHost: pn,
4160
+ isHost: xn,
4111
4161
  /**
4112
4162
  * Check if the current window is embedded by ForgeFrame.
4113
4163
  *
@@ -4116,7 +4166,7 @@ const Dn = {
4116
4166
  *
4117
4167
  * @returns True if running inside a ForgeFrame iframe/popup
4118
4168
  */
4119
- isEmbedded: fn,
4169
+ isEmbedded: Dn,
4120
4170
  /**
4121
4171
  * Get hostProps from the current host window.
4122
4172
  *
@@ -4125,7 +4175,7 @@ const Dn = {
4125
4175
  *
4126
4176
  * @returns The hostProps object if in host context, undefined otherwise
4127
4177
  */
4128
- getHostProps: mn,
4178
+ getHostProps: In,
4129
4179
  /**
4130
4180
  * Flush host initialization in embedded contexts.
4131
4181
  *
@@ -4136,12 +4186,12 @@ const Dn = {
4136
4186
  *
4137
4187
  * @returns The host component instance if running embedded, otherwise null
4138
4188
  */
4139
- initHost: fe,
4189
+ initHost: we,
4140
4190
  /**
4141
4191
  * Serialization strategy constants.
4142
4192
  * @see {@link PROP_SERIALIZATION}
4143
4193
  */
4144
- PROP_SERIALIZATION: A,
4194
+ PROP_SERIALIZATION: z,
4145
4195
  /**
4146
4196
  * Rendering context constants (IFRAME, POPUP).
4147
4197
  * @see {@link CONTEXT}
@@ -4155,11 +4205,11 @@ const Dn = {
4155
4205
  /**
4156
4206
  * Error thrown when popup window fails to open.
4157
4207
  */
4158
- PopupOpenError: He,
4208
+ PopupOpenError: Je,
4159
4209
  /**
4160
4210
  * Current library version.
4161
4211
  */
4162
- VERSION: se,
4212
+ VERSION: ae,
4163
4213
  /**
4164
4214
  * Check if a value is a Standard Schema (Zod, Valibot, ArkType, etc.)
4165
4215
  *
@@ -4176,7 +4226,7 @@ const Dn = {
4176
4226
  * }
4177
4227
  * ```
4178
4228
  */
4179
- isStandardSchema: x,
4229
+ isStandardSchema: D,
4180
4230
  /**
4181
4231
  * Prop schema builders for defining component props.
4182
4232
  *
@@ -4202,33 +4252,33 @@ const Dn = {
4202
4252
  prop: p
4203
4253
  };
4204
4254
  export {
4205
- ue as AnySchema,
4206
- W as ArraySchema,
4207
- oe as BooleanSchema,
4255
+ fe as AnySchema,
4256
+ V as ArraySchema,
4257
+ ue as BooleanSchema,
4208
4258
  f as CONTEXT,
4209
4259
  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,
4260
+ pe as EnumSchema,
4261
+ Mn as ForgeFrame,
4262
+ he as FunctionSchema,
4263
+ de as LiteralSchema,
4264
+ le as NumberSchema,
4265
+ Y as ObjectSchema,
4266
+ z as PROP_SERIALIZATION,
4267
+ Je as PopupOpenError,
4268
+ P as PropSchema,
4269
+ ce as StringSchema,
4270
+ ae as VERSION,
4271
+ Qe as create,
4272
+ An as createReactComponent,
4273
+ Mn as default,
4274
+ Fn as destroy,
4275
+ Hn as destroyAll,
4276
+ et as destroyByTag,
4277
+ In as getHostProps,
4278
+ we as initHost,
4279
+ Dn as isEmbedded,
4280
+ xn as isHost,
4281
+ D as isStandardSchema,
4232
4282
  p as prop,
4233
- xn as withReactComponent
4283
+ Ln as withReactComponent
4234
4284
  };