forgeframe 0.0.10 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- const f = {
1
+ const p = {
2
2
  /** Render component in an iframe */
3
3
  IFRAME: "iframe",
4
4
  /** Render component in a popup window */
@@ -38,7 +38,7 @@ const f = {
38
38
  REQUEST: "request",
39
39
  /** Response to a previous request */
40
40
  RESPONSE: "response"
41
- }, u = {
41
+ }, l = {
42
42
  /** Host initialization complete */
43
43
  INIT: "forgeframe_init",
44
44
  /** Props update from consumer to host */
@@ -63,12 +63,12 @@ const f = {
63
63
  CONSUMER_EXPORT: "forgeframe_consumer_export",
64
64
  /** Get sibling components request */
65
65
  GET_SIBLINGS: "forgeframe_get_siblings"
66
- }, j = "__forgeframe__", ae = (() => {
67
- if ("0.0.10".trim().length === 0)
66
+ }, j = "__forgeframe__", oe = (() => {
67
+ if ("0.0.12".trim().length === 0)
68
68
  throw new Error(
69
69
  "ForgeFrame VERSION injection is missing. Configure __FORGEFRAME_VERSION__ in build/test tooling."
70
70
  );
71
- return "0.0.10";
71
+ return "0.0.12";
72
72
  })();
73
73
  class Ae {
74
74
  /**
@@ -363,22 +363,22 @@ function st(t, e, n = "Operation timed out") {
363
363
  });
364
364
  });
365
365
  }
366
- const S = /* @__PURE__ */ new Map(), rt = 200;
366
+ const I = /* @__PURE__ */ new Map(), rt = 200;
367
367
  function it(t) {
368
368
  return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
369
369
  }
370
370
  function ot(t) {
371
371
  if (!t.includes("*"))
372
372
  return null;
373
- const e = S.get(t);
373
+ const e = I.get(t);
374
374
  if (e)
375
375
  return e;
376
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);
377
+ if (I.size >= rt) {
378
+ const r = I.keys().next().value;
379
+ r && I.delete(r);
380
380
  }
381
- return S.set(t, s), s;
381
+ return I.set(t, s), s;
382
382
  }
383
383
  function at(t, e) {
384
384
  return t.global || t.sticky ? new RegExp(t.source, t.flags.replace(/[gy]/g, "")).test(e) : t.test(e);
@@ -405,7 +405,7 @@ function U(t, e) {
405
405
  }
406
406
  return t instanceof RegExp ? at(t, e) : Array.isArray(t) ? t.some((n) => U(n, e)) : !1;
407
407
  }
408
- function se(t) {
408
+ function ne(t) {
409
409
  if (!t) return !0;
410
410
  try {
411
411
  return t.closed;
@@ -420,7 +420,7 @@ function ct(t = window) {
420
420
  return null;
421
421
  }
422
422
  }
423
- function lt(t = window) {
423
+ function ut(t = window) {
424
424
  try {
425
425
  const e = t.parent;
426
426
  return e && e !== t ? e : null;
@@ -428,7 +428,7 @@ function lt(t = window) {
428
428
  return null;
429
429
  }
430
430
  }
431
- function ut(t = window) {
431
+ function lt(t = window) {
432
432
  try {
433
433
  return t.parent !== t;
434
434
  } catch {
@@ -446,18 +446,18 @@ const De = 100, b = /* @__PURE__ */ new Map();
446
446
  function dt() {
447
447
  const t = [];
448
448
  for (const [e, n] of b.entries())
449
- se(n) && t.push(e);
449
+ ne(n) && t.push(e);
450
450
  for (const e of t)
451
451
  b.delete(e);
452
452
  }
453
- function pt(t, e) {
453
+ function ft(t, e) {
454
454
  if (b.size >= De && dt(), b.size >= De) {
455
455
  const n = b.keys().next().value;
456
456
  n && b.delete(n);
457
457
  }
458
458
  b.set(t, e);
459
459
  }
460
- function ft(t) {
460
+ function pt(t) {
461
461
  b.delete(t);
462
462
  }
463
463
  function mt(t, e) {
@@ -530,7 +530,7 @@ class P {
530
530
  return n._default = e, n;
531
531
  }
532
532
  }
533
- class ce extends P {
533
+ class ae extends P {
534
534
  /** @internal */
535
535
  _minLength;
536
536
  /** @internal */
@@ -566,7 +566,7 @@ class ce extends P {
566
566
  }
567
567
  /** @internal */
568
568
  _clone() {
569
- const e = new ce();
569
+ const e = new ae();
570
570
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e._minLength = this._minLength, e._maxLength = this._maxLength, e._pattern = this._pattern, e._patternMessage = this._patternMessage, e._trim = this._trim, e;
571
571
  }
572
572
  /**
@@ -691,7 +691,7 @@ class ce extends P {
691
691
  return e._minLength = 1, e;
692
692
  }
693
693
  }
694
- class le extends P {
694
+ class ce extends P {
695
695
  /** @internal */
696
696
  _min;
697
697
  /** @internal */
@@ -706,7 +706,7 @@ class le extends P {
706
706
  }
707
707
  /** @internal */
708
708
  _clone() {
709
- const e = new le();
709
+ const e = new ce();
710
710
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e._min = this._min, e._max = this._max, e._int = this._int, e;
711
711
  }
712
712
  /**
@@ -799,7 +799,7 @@ class ue extends P {
799
799
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e;
800
800
  }
801
801
  }
802
- class he extends P {
802
+ class le extends P {
803
803
  /** @internal */
804
804
  _validate(e) {
805
805
  return typeof e != "function" ? {
@@ -808,7 +808,7 @@ class he extends P {
808
808
  }
809
809
  /** @internal */
810
810
  _clone() {
811
- const e = new he();
811
+ const e = new le();
812
812
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e;
813
813
  }
814
814
  }
@@ -1002,7 +1002,7 @@ class Y extends P {
1002
1002
  return e._strict = !0, e;
1003
1003
  }
1004
1004
  }
1005
- class de extends P {
1005
+ class he extends P {
1006
1006
  /** @internal */
1007
1007
  _value;
1008
1008
  constructor(e) {
@@ -1016,11 +1016,11 @@ class de extends P {
1016
1016
  }
1017
1017
  /** @internal */
1018
1018
  _clone() {
1019
- const e = new de(this._value);
1019
+ const e = new he(this._value);
1020
1020
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e;
1021
1021
  }
1022
1022
  }
1023
- class pe extends P {
1023
+ class de extends P {
1024
1024
  /** @internal */
1025
1025
  _values;
1026
1026
  /** @internal */
@@ -1040,7 +1040,7 @@ class pe extends P {
1040
1040
  }
1041
1041
  /** @internal */
1042
1042
  _clone() {
1043
- const e = new pe(this._values);
1043
+ const e = new de(this._values);
1044
1044
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e;
1045
1045
  }
1046
1046
  }
@@ -1058,7 +1058,7 @@ class fe extends P {
1058
1058
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e;
1059
1059
  }
1060
1060
  }
1061
- const p = {
1061
+ const f = {
1062
1062
  /**
1063
1063
  * Creates a string schema.
1064
1064
  *
@@ -1071,7 +1071,7 @@ const p = {
1071
1071
  * prop.string().pattern(/^[a-z]+$/)
1072
1072
  * ```
1073
1073
  */
1074
- string: () => new ce(),
1074
+ string: () => new ae(),
1075
1075
  /**
1076
1076
  * Creates a number schema.
1077
1077
  *
@@ -1083,7 +1083,7 @@ const p = {
1083
1083
  * prop.number().positive()
1084
1084
  * ```
1085
1085
  */
1086
- number: () => new le(),
1086
+ number: () => new ce(),
1087
1087
  /**
1088
1088
  * Creates a boolean schema.
1089
1089
  *
@@ -1106,7 +1106,7 @@ const p = {
1106
1106
  * prop.function<(data: { id: string }) => Promise<void>>()
1107
1107
  * ```
1108
1108
  */
1109
- function: () => new he(),
1109
+ function: () => new le(),
1110
1110
  /**
1111
1111
  * Creates an array schema.
1112
1112
  *
@@ -1148,7 +1148,7 @@ const p = {
1148
1148
  * prop.literal(true)
1149
1149
  * ```
1150
1150
  */
1151
- literal: (t) => new de(t),
1151
+ literal: (t) => new he(t),
1152
1152
  /**
1153
1153
  * Creates an enum schema for a set of allowed values.
1154
1154
  *
@@ -1160,7 +1160,7 @@ const p = {
1160
1160
  * prop.enum([1, 2, 3])
1161
1161
  * ```
1162
1162
  */
1163
- enum: (t) => new pe(t),
1163
+ enum: (t) => new de(t),
1164
1164
  /**
1165
1165
  * Creates a schema that accepts any value.
1166
1166
  *
@@ -1175,68 +1175,68 @@ const p = {
1175
1175
  any: () => new fe()
1176
1176
  }, R = {
1177
1177
  uid: {
1178
- schema: p.string().optional(),
1178
+ schema: f.string().optional(),
1179
1179
  sendToHost: !0
1180
1180
  },
1181
1181
  tag: {
1182
- schema: p.string().optional(),
1182
+ schema: f.string().optional(),
1183
1183
  sendToHost: !0
1184
1184
  },
1185
1185
  dimensions: {
1186
- schema: p.object().default(() => ({ width: "100%", height: "100%" })),
1186
+ schema: f.object().default(() => ({ width: "100%", height: "100%" })),
1187
1187
  sendToHost: !1
1188
1188
  },
1189
1189
  timeout: {
1190
- schema: p.number().default(1e4),
1190
+ schema: f.number().default(1e4),
1191
1191
  sendToHost: !1
1192
1192
  },
1193
1193
  cspNonce: {
1194
- schema: p.string().optional(),
1194
+ schema: f.string().optional(),
1195
1195
  sendToHost: !0
1196
1196
  },
1197
1197
  // Lifecycle callbacks - not sent to host (consumer-only)
1198
1198
  onDisplay: {
1199
- schema: p.function().optional(),
1199
+ schema: f.function().optional(),
1200
1200
  sendToHost: !1
1201
1201
  },
1202
1202
  onRendered: {
1203
- schema: p.function().optional(),
1203
+ schema: f.function().optional(),
1204
1204
  sendToHost: !1
1205
1205
  },
1206
1206
  onRender: {
1207
- schema: p.function().optional(),
1207
+ schema: f.function().optional(),
1208
1208
  sendToHost: !1
1209
1209
  },
1210
1210
  onPrerendered: {
1211
- schema: p.function().optional(),
1211
+ schema: f.function().optional(),
1212
1212
  sendToHost: !1
1213
1213
  },
1214
1214
  onPrerender: {
1215
- schema: p.function().optional(),
1215
+ schema: f.function().optional(),
1216
1216
  sendToHost: !1
1217
1217
  },
1218
1218
  onClose: {
1219
- schema: p.function().optional(),
1219
+ schema: f.function().optional(),
1220
1220
  sendToHost: !1
1221
1221
  },
1222
1222
  onDestroy: {
1223
- schema: p.function().optional(),
1223
+ schema: f.function().optional(),
1224
1224
  sendToHost: !1
1225
1225
  },
1226
1226
  onResize: {
1227
- schema: p.function().optional(),
1227
+ schema: f.function().optional(),
1228
1228
  sendToHost: !1
1229
1229
  },
1230
1230
  onFocus: {
1231
- schema: p.function().optional(),
1231
+ schema: f.function().optional(),
1232
1232
  sendToHost: !1
1233
1233
  },
1234
1234
  onError: {
1235
- schema: p.function().optional(),
1235
+ schema: f.function().optional(),
1236
1236
  sendToHost: !1
1237
1237
  },
1238
1238
  onProps: {
1239
- schema: p.function().optional(),
1239
+ schema: f.function().optional(),
1240
1240
  sendToHost: !1
1241
1241
  }
1242
1242
  };
@@ -1269,23 +1269,23 @@ function yt(t, e) {
1269
1269
  });
1270
1270
  return `${e}.${n.join(".")}`;
1271
1271
  }
1272
- function H(t) {
1272
+ function F(t) {
1273
1273
  const e = D(t);
1274
1274
  return { isDirectSchema: e, definition: e ? { schema: t } : t };
1275
1275
  }
1276
- function Ie(t, e, n) {
1276
+ function Se(t, e, n) {
1277
1277
  const s = {
1278
1278
  ...R,
1279
1279
  ...e
1280
1280
  }, r = {};
1281
1281
  for (const [i, o] of Object.entries(s)) {
1282
- const { definition: a } = H(o);
1282
+ const { definition: a } = F(o);
1283
1283
  let c;
1284
- const l = a.alias, d = i in t, m = l && l in t;
1284
+ const u = a.alias, d = i in t, m = u && u in t;
1285
1285
  if (d)
1286
1286
  c = t[i];
1287
1287
  else if (m)
1288
- c = t[l];
1288
+ c = t[u];
1289
1289
  else if (a.value)
1290
1290
  c = a.value(n);
1291
1291
  else if (a.default !== void 0)
@@ -1304,7 +1304,7 @@ function T(t, e) {
1304
1304
  ...e
1305
1305
  };
1306
1306
  for (const [s, r] of Object.entries(n)) {
1307
- const { isDirectSchema: i, definition: o } = H(r);
1307
+ const { isDirectSchema: i, definition: o } = F(r);
1308
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`);
@@ -1315,20 +1315,20 @@ function T(t, e) {
1315
1315
  o.validate && o.validate({ value: a, props: t });
1316
1316
  }
1317
1317
  }
1318
- function Se(t, e, n, s) {
1318
+ function Ie(t, e, n, s) {
1319
1319
  const r = {
1320
1320
  ...R,
1321
1321
  ...e
1322
1322
  }, i = {};
1323
1323
  for (const [o, a] of Object.entries(r)) {
1324
- const { definition: c } = H(a), l = t[o];
1324
+ const { definition: c } = F(a), u = t[o];
1325
1325
  if (c.sendToHost === !1 || c.sameDomain && !s) continue;
1326
1326
  if (c.trustedDomains) {
1327
1327
  const m = c.trustedDomains;
1328
1328
  if (!U(m, n)) continue;
1329
1329
  }
1330
- let d = l;
1331
- c.hostDecorate && l !== void 0 && (d = c.hostDecorate({ value: l, props: t })), i[o] = d;
1330
+ let d = u;
1331
+ c.hostDecorate && u !== void 0 && (d = c.hostDecorate({ value: u, props: t })), i[o] = d;
1332
1332
  }
1333
1333
  return i;
1334
1334
  }
@@ -1338,11 +1338,11 @@ function wt(t, e) {
1338
1338
  ...e
1339
1339
  };
1340
1340
  for (const [r, i] of Object.entries(s)) {
1341
- const { definition: o } = H(i), a = t[r];
1341
+ const { definition: o } = F(i), a = t[r];
1342
1342
  if (a === void 0 || typeof a == "function" || !o.queryParam) continue;
1343
1343
  const c = typeof o.queryParam == "string" ? o.queryParam : r;
1344
- let l;
1345
- typeof o.queryParam == "function" ? l = o.queryParam({ value: a }) : typeof a == "object" ? l = JSON.stringify(a) : l = String(a), n.set(c, l);
1344
+ let u;
1345
+ typeof o.queryParam == "function" ? u = o.queryParam({ value: a }) : typeof a == "object" ? u = JSON.stringify(a) : u = String(a), n.set(c, u);
1346
1346
  }
1347
1347
  return n;
1348
1348
  }
@@ -1352,11 +1352,11 @@ function _t(t, e) {
1352
1352
  ...e
1353
1353
  };
1354
1354
  for (const [r, i] of Object.entries(s)) {
1355
- const { definition: o } = H(i), a = t[r];
1355
+ const { definition: o } = F(i), a = t[r];
1356
1356
  if (a === void 0 || typeof a == "function" || !o.bodyParam) continue;
1357
1357
  const c = typeof o.bodyParam == "string" ? o.bodyParam : r;
1358
- let l;
1359
- typeof o.bodyParam == "function" ? l = o.bodyParam({ value: a }) : typeof a == "object" ? l = JSON.stringify(a) : l = String(a), n.set(c, l);
1358
+ let u;
1359
+ typeof o.bodyParam == "function" ? u = o.bodyParam({ value: a }) : typeof a == "object" ? u = JSON.stringify(a) : u = String(a), n.set(c, u);
1360
1360
  }
1361
1361
  return n;
1362
1362
  }
@@ -1364,7 +1364,7 @@ const ve = 500, Pt = /* @__PURE__ */ new Set(["__proto__"]);
1364
1364
  function ze(t) {
1365
1365
  return !Pt.has(t);
1366
1366
  }
1367
- class me {
1367
+ class pe {
1368
1368
  /**
1369
1369
  * Creates a new FunctionBridge instance.
1370
1370
  *
@@ -1421,7 +1421,7 @@ class me {
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(n, s, u.CALL, {
1424
+ const o = async (...a) => this.messenger.send(n, s, l.CALL, {
1425
1425
  id: e.__id__,
1426
1426
  args: a
1427
1427
  });
@@ -1445,7 +1445,7 @@ class me {
1445
1445
  */
1446
1446
  setupCallHandler() {
1447
1447
  this.messenger.on(
1448
- u.CALL,
1448
+ l.CALL,
1449
1449
  async ({ id: e, args: n }) => {
1450
1450
  const s = this.localFunctions.get(e);
1451
1451
  if (!s)
@@ -1528,7 +1528,7 @@ class me {
1528
1528
  this.localFunctions.clear(), this.remoteFunctions.clear(), this.currentBatchIds.clear();
1529
1529
  }
1530
1530
  }
1531
- function re(t, e, n = /* @__PURE__ */ new WeakSet()) {
1531
+ function se(t, e, n = /* @__PURE__ */ new WeakSet()) {
1532
1532
  if (typeof t == "function")
1533
1533
  return e.serialize(t);
1534
1534
  if (Array.isArray(t)) {
@@ -1536,7 +1536,7 @@ function re(t, e, n = /* @__PURE__ */ new WeakSet()) {
1536
1536
  throw new Error("Circular reference detected in props - arrays cannot contain circular references");
1537
1537
  n.add(t);
1538
1538
  try {
1539
- return t.map((s) => re(s, e, n));
1539
+ return t.map((s) => se(s, e, n));
1540
1540
  } finally {
1541
1541
  n.delete(t);
1542
1542
  }
@@ -1548,7 +1548,7 @@ function re(t, e, n = /* @__PURE__ */ new WeakSet()) {
1548
1548
  try {
1549
1549
  const s = {};
1550
1550
  for (const [r, i] of Object.entries(t))
1551
- ze(r) && (s[r] = re(i, e, n));
1551
+ ze(r) && (s[r] = se(i, e, n));
1552
1552
  return s;
1553
1553
  } finally {
1554
1554
  n.delete(t);
@@ -1556,8 +1556,8 @@ function re(t, e, n = /* @__PURE__ */ new WeakSet()) {
1556
1556
  }
1557
1557
  return t;
1558
1558
  }
1559
- function ie(t, e, n, s, r = /* @__PURE__ */ new WeakSet()) {
1560
- if (me.isFunctionRef(t))
1559
+ function re(t, e, n, s, r = /* @__PURE__ */ new WeakSet()) {
1560
+ if (pe.isFunctionRef(t))
1561
1561
  return e.deserialize(t, n, s);
1562
1562
  if (Array.isArray(t)) {
1563
1563
  if (r.has(t))
@@ -1565,7 +1565,7 @@ function ie(t, e, n, s, r = /* @__PURE__ */ new WeakSet()) {
1565
1565
  r.add(t);
1566
1566
  try {
1567
1567
  return t.map(
1568
- (i) => ie(i, e, n, s, r)
1568
+ (i) => re(i, e, n, s, r)
1569
1569
  );
1570
1570
  } finally {
1571
1571
  r.delete(t);
@@ -1578,7 +1578,7 @@ function ie(t, e, n, s, r = /* @__PURE__ */ new WeakSet()) {
1578
1578
  try {
1579
1579
  const i = {};
1580
1580
  for (const [o, a] of Object.entries(t))
1581
- ze(o) && (i[o] = ie(a, e, n, s, r));
1581
+ ze(o) && (i[o] = re(a, e, n, s, r));
1582
1582
  return i;
1583
1583
  } finally {
1584
1584
  r.delete(t);
@@ -1602,10 +1602,10 @@ function Be(t, e = ke) {
1602
1602
  function bt(t) {
1603
1603
  return encodeURIComponent(JSON.stringify(t));
1604
1604
  }
1605
- function Ot(t, e) {
1605
+ function Ct(t, e) {
1606
1606
  return `${Be(t)}=${bt(e)}`;
1607
1607
  }
1608
- function Ct(t) {
1608
+ function Ot(t) {
1609
1609
  return `${Be(t, J)}=1`;
1610
1610
  }
1611
1611
  function Rt(t, e, n) {
@@ -1619,12 +1619,12 @@ function Rt(t, e, n) {
1619
1619
  function Ve(t, e = []) {
1620
1620
  const n = Object.entries(t);
1621
1621
  if (n.length === 0 && Te(t))
1622
- return e.length === 0 ? We : Ct(e);
1622
+ return e.length === 0 ? We : Ot(e);
1623
1623
  const s = [];
1624
1624
  for (const [r, i] of n) {
1625
1625
  if (i === void 0) continue;
1626
1626
  const o = [...e, r];
1627
- Te(i) ? s.push(Ve(i, o)) : s.push(Ot(o, i));
1627
+ Te(i) ? s.push(Ve(i, o)) : s.push(Ct(o, i));
1628
1628
  }
1629
1629
  return s.filter(Boolean).join("&");
1630
1630
  }
@@ -1649,14 +1649,14 @@ function xt(t) {
1649
1649
  } catch {
1650
1650
  c = decodeURIComponent(o);
1651
1651
  }
1652
- const l = Dt(i);
1653
- if (l.some((h) => !je(h))) continue;
1652
+ const u = Dt(i);
1653
+ if (u.some((h) => !je(h))) continue;
1654
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];
1655
+ for (let h = 0; h < u.length - 1; h++) {
1656
+ const E = u[h], C = d[E];
1657
+ (!Object.prototype.hasOwnProperty.call(d, E) || typeof C != "object" || C === null || Array.isArray(C)) && (d[E] = {}), d = d[E];
1658
1658
  }
1659
- const m = l[l.length - 1];
1659
+ const m = u[u.length - 1];
1660
1660
  Rt(d, m, c);
1661
1661
  }
1662
1662
  return e;
@@ -1670,10 +1670,10 @@ function Dt(t) {
1670
1670
  return s;
1671
1671
  throw new Error("Invalid DOTIFY path framing");
1672
1672
  }
1673
- function It(t) {
1673
+ function St(t) {
1674
1674
  return typeof t == "object" && t !== null && t.__type__ === "dotify" && typeof t.__value__ == "string";
1675
1675
  }
1676
- function St(t, e, n) {
1676
+ function It(t, e, n) {
1677
1677
  const s = {
1678
1678
  ...R,
1679
1679
  ...e
@@ -1699,18 +1699,18 @@ function vt(t, e, n) {
1699
1699
  return s === z.DOTIFY && typeof t == "object" && t !== null && !Array.isArray(t) ? {
1700
1700
  __type__: "dotify",
1701
1701
  __value__: Ve(t)
1702
- } : re(t, n);
1702
+ } : se(t, n);
1703
1703
  }
1704
1704
  function Ue(t, e, n, s, r, i) {
1705
1705
  const o = {
1706
1706
  ...R,
1707
1707
  ...e
1708
1708
  }, a = {};
1709
- for (const [c, l] of Object.entries(t)) {
1709
+ for (const [c, u] of Object.entries(t)) {
1710
1710
  if (!je(c)) continue;
1711
1711
  const d = o[c];
1712
1712
  a[c] = Tt(
1713
- l,
1713
+ u,
1714
1714
  d,
1715
1715
  n,
1716
1716
  s,
@@ -1728,22 +1728,22 @@ function Tt(t, e, n, s, r, i) {
1728
1728
  } catch {
1729
1729
  return t;
1730
1730
  }
1731
- if (It(t))
1731
+ if (St(t))
1732
1732
  try {
1733
1733
  return xt(t.__value__);
1734
1734
  } catch {
1735
1735
  return t;
1736
1736
  }
1737
- return ie(t, s, r, i);
1737
+ return re(t, s, r, i);
1738
1738
  }
1739
1739
  function Ut(t) {
1740
1740
  return typeof t == "object" && t !== null && t.__type__ === "base64" && typeof t.__value__ == "string";
1741
1741
  }
1742
- class Nt {
1742
+ class Ht {
1743
1743
  constructor(e, n, s) {
1744
1744
  this.options = e, this.createPropContext = s, this.inputProps = { ...n };
1745
1745
  const r = this.inputProps, i = this.createPropContext(r);
1746
- this.props = Ie(r, this.options.props, i);
1746
+ this.props = Se(r, this.options.props, i);
1747
1747
  }
1748
1748
  /** Current normalized prop snapshot. */
1749
1749
  props;
@@ -1755,7 +1755,7 @@ class Nt {
1755
1755
  * Builds and validates the next props snapshot.
1756
1756
  */
1757
1757
  buildNextProps(e) {
1758
- const n = { ...this.inputProps, ...e }, s = { ...this.props, ...e }, r = this.createPropContext(s), i = Ie(s, this.options.props, r);
1758
+ const n = { ...this.inputProps, ...e }, s = { ...this.props, ...e }, r = this.createPropContext(s), i = Se(s, this.options.props, r);
1759
1759
  return T(i, this.options.props), this.options.validate?.({ props: i }), { nextInputProps: n, nextProps: i };
1760
1760
  }
1761
1761
  /**
@@ -1814,11 +1814,11 @@ function q(t, e) {
1814
1814
  const n = parseInt(t, 10);
1815
1815
  return isNaN(n) ? e : n;
1816
1816
  }
1817
- function Ft(t) {
1817
+ function Nt(t) {
1818
1818
  const { name: e, dimensions: n, attributes: s = {}, style: r = {} } = t, i = document.createElement("iframe");
1819
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;
1820
1820
  }
1821
- function Ht(t) {
1821
+ function Ft(t) {
1822
1822
  try {
1823
1823
  t.src = "about:blank", t.parentNode?.removeChild(t);
1824
1824
  } catch {
@@ -1830,7 +1830,7 @@ function $t(t, e) {
1830
1830
  function At(t) {
1831
1831
  t.style.display = "", t.style.visibility = "visible";
1832
1832
  }
1833
- function Ne(t) {
1833
+ function He(t) {
1834
1834
  t.style.display = "none", t.style.visibility = "hidden";
1835
1835
  }
1836
1836
  function Lt(t) {
@@ -1886,10 +1886,10 @@ function Wt(t) {
1886
1886
  "status=no",
1887
1887
  "resizable=yes",
1888
1888
  "scrollbars=yes"
1889
- ].join(","), l = window.open(e, n, c);
1890
- if (!l || Vt(l))
1889
+ ].join(","), u = window.open(e, n, c);
1890
+ if (!u || Vt(u))
1891
1891
  throw new Je();
1892
- return l;
1892
+ return u;
1893
1893
  }
1894
1894
  function jt(t) {
1895
1895
  try {
@@ -1921,7 +1921,7 @@ function Yt(t, e, n = {}) {
1921
1921
  // Exponential backoff multiplier
1922
1922
  } = n;
1923
1923
  let o = s, a, c = !1;
1924
- const l = () => {
1924
+ const u = () => {
1925
1925
  try {
1926
1926
  e();
1927
1927
  } catch (m) {
@@ -1931,11 +1931,11 @@ function Yt(t, e, n = {}) {
1931
1931
  if (!c) {
1932
1932
  try {
1933
1933
  if (t.closed) {
1934
- l();
1934
+ u();
1935
1935
  return;
1936
1936
  }
1937
1937
  } catch {
1938
- l();
1938
+ u();
1939
1939
  return;
1940
1940
  }
1941
1941
  o = Math.min(o * i, r), a = setTimeout(d, o);
@@ -1955,9 +1955,9 @@ function Jt(t, e) {
1955
1955
  } catch {
1956
1956
  }
1957
1957
  }
1958
- const Fe = "forgeframe-spinner-style";
1958
+ const Ne = "forgeframe-spinner-style";
1959
1959
  function qt(t, e) {
1960
- const n = t.getElementById(Fe);
1960
+ const n = t.getElementById(Ne);
1961
1961
  if (n) {
1962
1962
  const r = n.getAttribute("nonce");
1963
1963
  if (!e || r === e)
@@ -1965,7 +1965,7 @@ function qt(t, e) {
1965
1965
  n.remove();
1966
1966
  }
1967
1967
  const s = t.createElement("style");
1968
- s.id = Fe, e && s.setAttribute("nonce", e), s.textContent = `
1968
+ s.id = Ne, e && s.setAttribute("nonce", e), s.textContent = `
1969
1969
  @keyframes forgeframe-spin {
1970
1970
  to { transform: rotate(360deg); }
1971
1971
  }
@@ -2056,11 +2056,11 @@ class en {
2056
2056
  const s = this.container;
2057
2057
  this.ownedContainer = null;
2058
2058
  const r = this.getProps(), i = this.options.prerenderTemplate ?? Xt, o = this.options.containerTemplate ?? Kt, a = this.resolveDimensions(), c = r.cspNonce;
2059
- if (this.context === f.IFRAME) {
2059
+ if (this.context === p.IFRAME) {
2060
2060
  const h = n();
2061
- this.iframe = e(h), Ne(this.iframe);
2061
+ this.iframe = e(h), He(this.iframe);
2062
2062
  }
2063
- const l = {
2063
+ const u = {
2064
2064
  uid: this.uid,
2065
2065
  tag: this.options.tag,
2066
2066
  context: this.context,
@@ -2074,7 +2074,7 @@ class en {
2074
2074
  focus: () => this.callbacks.focus(),
2075
2075
  cspNonce: c
2076
2076
  };
2077
- this.prerenderElement = i(l);
2077
+ this.prerenderElement = i(u);
2078
2078
  const d = {
2079
2079
  uid: this.uid,
2080
2080
  tag: this.options.tag,
@@ -2103,7 +2103,7 @@ class en {
2103
2103
  */
2104
2104
  createIframeElement(e) {
2105
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({
2106
+ return Nt({
2107
2107
  name: e,
2108
2108
  dimensions: n,
2109
2109
  attributes: r,
@@ -2115,7 +2115,7 @@ class en {
2115
2115
  */
2116
2116
  open(e) {
2117
2117
  const n = e.buildUrl(e.baseUrl), s = e.buildBodyParams(), r = s.toString().length > 0;
2118
- if (this.context === f.IFRAME) {
2118
+ if (this.context === p.IFRAME) {
2119
2119
  if (!this.iframe)
2120
2120
  throw new Error("Iframe not created during prerender");
2121
2121
  return r ? e.submitBodyForm(this.iframe.name, n, s) : this.iframe.src = n, this.iframe.contentWindow;
@@ -2135,7 +2135,7 @@ class en {
2135
2135
  * Swaps prerender content with the live iframe after host initialization.
2136
2136
  */
2137
2137
  async swapPrerenderContentIfNeeded() {
2138
- this.context === f.IFRAME && this.iframe && this.container && (await Qt(this.container, this.prerenderElement, this.iframe), this.prerenderElement = null);
2138
+ this.context === p.IFRAME && this.iframe && this.container && (await Qt(this.container, this.prerenderElement, this.iframe), this.prerenderElement = null);
2139
2139
  }
2140
2140
  /**
2141
2141
  * Submits a hidden form to navigate a target window via POST.
@@ -2147,8 +2147,8 @@ class en {
2147
2147
  const o = r.createElement("form");
2148
2148
  o.method = "POST", o.action = n, o.target = e, o.style.display = "none";
2149
2149
  for (const [a, c] of s.entries()) {
2150
- const l = r.createElement("input");
2151
- l.type = "hidden", l.name = a, l.value = c, o.appendChild(l);
2150
+ const u = r.createElement("input");
2151
+ u.type = "hidden", u.name = a, u.value = c, o.appendChild(u);
2152
2152
  }
2153
2153
  i.appendChild(o);
2154
2154
  try {
@@ -2161,47 +2161,47 @@ class en {
2161
2161
  * Focuses iframe/popup context.
2162
2162
  */
2163
2163
  focus(e) {
2164
- this.context === f.IFRAME && this.iframe ? Lt(this.iframe) : this.context === f.POPUP && e && Bt(e);
2164
+ this.context === p.IFRAME && this.iframe ? Lt(this.iframe) : this.context === p.POPUP && e && Bt(e);
2165
2165
  }
2166
2166
  /**
2167
2167
  * Resizes iframe/popup context.
2168
2168
  */
2169
2169
  resize(e, n) {
2170
- this.context === f.IFRAME && this.iframe ? $t(this.iframe, e) : this.context === f.POPUP && n && Jt(n, e);
2170
+ this.context === p.IFRAME && this.iframe ? $t(this.iframe, e) : this.context === p.POPUP && n && Jt(n, e);
2171
2171
  }
2172
2172
  /**
2173
2173
  * Shows iframe context.
2174
2174
  */
2175
2175
  show() {
2176
- this.context === f.IFRAME && this.iframe && At(this.iframe);
2176
+ this.context === p.IFRAME && this.iframe && At(this.iframe);
2177
2177
  }
2178
2178
  /**
2179
2179
  * Hides iframe context.
2180
2180
  */
2181
2181
  hide() {
2182
- this.context === f.IFRAME && this.iframe && Ne(this.iframe);
2182
+ this.context === p.IFRAME && this.iframe && He(this.iframe);
2183
2183
  }
2184
2184
  /**
2185
2185
  * Destroys rendered iframe/popup DOM artifacts.
2186
2186
  */
2187
2187
  destroy(e) {
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;
2188
+ this.iframe && (Ft(this.iframe), this.iframe = null), this.context === p.POPUP && e && jt(e), this.prerenderElement && (this.prerenderElement.remove(), this.prerenderElement = null), this.ownedContainer && (this.ownedContainer.remove(), this.ownedContainer = null), this.container = null;
2189
2189
  }
2190
2190
  }
2191
- const oe = "forgeframe:";
2191
+ const ie = "forgeframe:";
2192
2192
  function ee(t) {
2193
- return oe + JSON.stringify(t);
2193
+ return ie + JSON.stringify(t);
2194
2194
  }
2195
2195
  function tn(t) {
2196
- if (typeof t != "string" || !t.startsWith(oe)) return null;
2196
+ if (typeof t != "string" || !t.startsWith(ie)) return null;
2197
2197
  try {
2198
- const e = t.slice(oe.length), n = JSON.parse(e);
2198
+ const e = t.slice(ie.length), n = JSON.parse(e);
2199
2199
  return !n.id || !n.type || !n.name || !n.source ? null : n;
2200
2200
  } catch {
2201
2201
  return null;
2202
2202
  }
2203
2203
  }
2204
- function He(t, e, n, s) {
2204
+ function Fe(t, e, n, s) {
2205
2205
  return {
2206
2206
  id: t,
2207
2207
  type: W.REQUEST,
@@ -2333,9 +2333,9 @@ class qe {
2333
2333
  resolveVerifiedSource(e, n, s) {
2334
2334
  const r = e, i = this.sourceUidRegistry.get(r);
2335
2335
  if (i)
2336
- return { uid: i, domain: n };
2336
+ return { uid: i, domain: n, window: e };
2337
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 };
2338
+ return this.sourceUidRegistry.set(r, o), { uid: o, domain: n, window: e };
2339
2339
  }
2340
2340
  /**
2341
2341
  * Sends a message and waits for a response.
@@ -2353,22 +2353,22 @@ class qe {
2353
2353
  async send(e, n, s, r, i = 1e4) {
2354
2354
  if (this.destroyed)
2355
2355
  throw new Error("Messenger has been destroyed");
2356
- const o = k(), a = He(o, s, r, {
2356
+ const o = k(), a = Fe(o, s, r, {
2357
2357
  uid: this.uid,
2358
2358
  domain: this.domain
2359
- }), c = Le(), l = setTimeout(() => {
2359
+ }), c = Le(), u = setTimeout(() => {
2360
2360
  this.pending.delete(o), c.reject(new Error(`Message "${s}" timed out after ${i}ms`));
2361
2361
  }, i);
2362
2362
  this.pending.set(o, {
2363
2363
  deferred: c,
2364
- timeout: l,
2364
+ timeout: u,
2365
2365
  targetWin: e,
2366
2366
  expectedOrigin: cn(n, this.domain)
2367
2367
  });
2368
2368
  try {
2369
2369
  e.postMessage(ee(a), n);
2370
2370
  } catch (d) {
2371
- throw this.pending.delete(o), clearTimeout(l), d;
2371
+ throw this.pending.delete(o), clearTimeout(u), d;
2372
2372
  }
2373
2373
  return c.promise;
2374
2374
  }
@@ -2385,7 +2385,7 @@ class qe {
2385
2385
  post(e, n, s, r) {
2386
2386
  if (this.destroyed)
2387
2387
  throw new Error("Messenger has been destroyed");
2388
- const i = k(), o = He(i, s, r, {
2388
+ const i = k(), o = Fe(i, s, r, {
2389
2389
  uid: this.uid,
2390
2390
  domain: this.domain
2391
2391
  });
@@ -2486,7 +2486,7 @@ class qe {
2486
2486
  return this.destroyed;
2487
2487
  }
2488
2488
  }
2489
- const ln = [
2489
+ const un = [
2490
2490
  "init",
2491
2491
  "close",
2492
2492
  "resize",
@@ -2496,32 +2496,32 @@ const ln = [
2496
2496
  "updateProps",
2497
2497
  "export"
2498
2498
  ], $e = 32 * 1024;
2499
- function un(t) {
2500
- const e = gn(t);
2499
+ function ln(t) {
2500
+ const e = yn(t);
2501
2501
  return `${j}${e}`;
2502
2502
  }
2503
2503
  function Ke(t) {
2504
2504
  if (!t || !t.startsWith(j))
2505
2505
  return null;
2506
2506
  const e = t.slice(j.length);
2507
- return yn(e);
2507
+ return wn(e);
2508
2508
  }
2509
- function C(t) {
2509
+ function O(t) {
2510
2510
  return typeof t == "object" && t !== null;
2511
2511
  }
2512
2512
  function hn(t) {
2513
- return C(t);
2513
+ return O(t);
2514
2514
  }
2515
2515
  function dn(t) {
2516
- return C(t) && ln.every(
2516
+ return O(t) && un.every(
2517
2517
  (e) => typeof t[e] == "string" && t[e].length > 0
2518
2518
  );
2519
2519
  }
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)
2520
+ function fn(t) {
2521
+ if (!O(t) || typeof t.tag != "string" || t.tag.length === 0 || typeof t.url != "string" || t.url.length === 0 || t.props !== void 0 && !O(t.props) || t.defaultContext !== void 0 && t.defaultContext !== p.IFRAME && t.defaultContext !== p.POPUP)
2522
2522
  return !1;
2523
2523
  if (t.dimensions !== void 0) {
2524
- if (!C(t.dimensions))
2524
+ if (!O(t.dimensions))
2525
2525
  return !1;
2526
2526
  const { width: e, height: n } = t.dimensions;
2527
2527
  if (e !== void 0 && typeof e != "string" && typeof e != "number" || n !== void 0 && typeof n != "string" && typeof n != "number")
@@ -2529,25 +2529,25 @@ function pn(t) {
2529
2529
  }
2530
2530
  return !0;
2531
2531
  }
2532
- function fn(t) {
2533
- return C(t) ? Object.values(t).every((e) => pn(e)) : !1;
2532
+ function pn(t) {
2533
+ return O(t) ? Object.values(t).every((e) => fn(e)) : !1;
2534
2534
  }
2535
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));
2536
+ return !(!O(t) || typeof t.uid != "string" || t.uid.length === 0 || typeof t.tag != "string" || t.tag.length === 0 || typeof t.version != "string" || t.version.length === 0 || t.version !== oe || t.context !== p.IFRAME && t.context !== p.POPUP || typeof t.consumerDomain != "string" || t.consumerDomain.length === 0 || !hn(t.props) || !dn(t.exports) || t.children !== void 0 && !pn(t.children));
2537
2537
  }
2538
- function ge(t = window) {
2538
+ function me(t = window) {
2539
2539
  try {
2540
2540
  return t.name.startsWith(j);
2541
2541
  } catch {
2542
2542
  return !1;
2543
2543
  }
2544
2544
  }
2545
- function te(t, e = window) {
2545
+ function gn(t, e = window) {
2546
2546
  return Ke(e.name)?.tag === t;
2547
2547
  }
2548
- function gn(t) {
2548
+ function yn(t) {
2549
2549
  try {
2550
- const e = JSON.stringify(t), n = btoa(encodeURIComponent(e)), s = new Blob([n]).size;
2550
+ const e = JSON.stringify(t), n = btoa(encodeURIComponent(e)), s = n.length;
2551
2551
  if (s > $e)
2552
2552
  throw new Error(
2553
2553
  `Payload size (${Math.round(s / 1024)}KB) exceeds maximum allowed size (${$e / 1024}KB). Consider reducing the amount of data passed via props.`
@@ -2557,7 +2557,7 @@ function gn(t) {
2557
2557
  throw e instanceof Error && e.message.includes("Payload size") ? e : new Error(`Failed to encode payload: ${e}`);
2558
2558
  }
2559
2559
  }
2560
- function yn(t) {
2560
+ function wn(t) {
2561
2561
  try {
2562
2562
  const e = decodeURIComponent(atob(t)), n = JSON.parse(e);
2563
2563
  return mn(n) ? n : null;
@@ -2565,11 +2565,11 @@ function yn(t) {
2565
2565
  return null;
2566
2566
  }
2567
2567
  }
2568
- function wn(t) {
2568
+ function _n(t) {
2569
2569
  return {
2570
2570
  uid: t.uid,
2571
2571
  tag: t.tag,
2572
- version: ae,
2572
+ version: oe,
2573
2573
  context: t.context,
2574
2574
  consumerDomain: t.consumerDomain,
2575
2575
  props: t.props,
@@ -2577,14 +2577,14 @@ function wn(t) {
2577
2577
  children: t.children
2578
2578
  };
2579
2579
  }
2580
- function _n(t = window) {
2580
+ function Pn(t = window) {
2581
2581
  return Ke(t.name);
2582
2582
  }
2583
- class Pn {
2583
+ class En {
2584
2584
  constructor(e, n, s, r) {
2585
2585
  this.uid = e, this.options = n, this.resolveUrl = s, this.resolveUrlOrigin = r;
2586
2586
  const i = this.buildTrustedDomains();
2587
- this.messenger = new qe(this.uid, window, B(), i), this.bridge = new me(this.messenger);
2587
+ this.messenger = new qe(this.uid, window, B(), i), this.bridge = new pe(this.messenger);
2588
2588
  }
2589
2589
  /** Messenger for host communication. */
2590
2590
  messenger;
@@ -2634,7 +2634,7 @@ class Pn {
2634
2634
  * Returns true when the host window is connected and not closed.
2635
2635
  */
2636
2636
  isHostConnected() {
2637
- return !!(this.hostWindow && !se(this.hostWindow));
2637
+ return !!(this.hostWindow && !ne(this.hostWindow));
2638
2638
  }
2639
2639
  /**
2640
2640
  * Serializes host props while keeping function bridge references in sync.
@@ -2643,7 +2643,7 @@ class Pn {
2643
2643
  this.bridge.startBatch();
2644
2644
  const r = s?.finishBatch ?? !0;
2645
2645
  try {
2646
- const i = St(e, n, this.bridge);
2646
+ const i = It(e, n, this.bridge);
2647
2647
  return r && this.bridge.finishBatch(), i;
2648
2648
  } catch (i) {
2649
2649
  throw this.bridge.finishBatch(!0), i;
@@ -2653,9 +2653,9 @@ class Pn {
2653
2653
  * Sends the current props snapshot to the host window when available.
2654
2654
  */
2655
2655
  async sendPropsUpdateToHost(e, n) {
2656
- if (!this.hostWindow || se(this.hostWindow))
2656
+ if (!this.hostWindow || ne(this.hostWindow))
2657
2657
  return;
2658
- const s = this.getHostDomain(), r = Se(
2658
+ const s = this.getHostDomain(), r = Ie(
2659
2659
  e,
2660
2660
  n,
2661
2661
  s,
@@ -2669,7 +2669,7 @@ class Pn {
2669
2669
  await this.messenger.send(
2670
2670
  this.hostWindow,
2671
2671
  s,
2672
- u.PROPS,
2672
+ l.PROPS,
2673
2673
  i
2674
2674
  ), this.bridge.finishBatch();
2675
2675
  } catch (o) {
@@ -2680,7 +2680,7 @@ class Pn {
2680
2680
  * Builds the window.name payload for host initialization.
2681
2681
  */
2682
2682
  buildWindowName(e) {
2683
- const n = e.hostDomain ?? this.getHostDomain(), s = Se(
2683
+ const n = e.hostDomain ?? this.getHostDomain(), s = Ie(
2684
2684
  e.props,
2685
2685
  e.propDefinitions,
2686
2686
  n,
@@ -2688,7 +2688,7 @@ class Pn {
2688
2688
  ), r = this.serializePropsForHost(
2689
2689
  s,
2690
2690
  e.propDefinitions
2691
- ), i = wn({
2691
+ ), i = _n({
2692
2692
  uid: this.uid,
2693
2693
  tag: e.tag,
2694
2694
  context: e.context,
@@ -2697,7 +2697,7 @@ class Pn {
2697
2697
  exports: e.exports,
2698
2698
  children: e.children
2699
2699
  });
2700
- return un(i);
2700
+ return ln(i);
2701
2701
  }
2702
2702
  /**
2703
2703
  * Waits for the host to send the initialization handshake.
@@ -2723,17 +2723,25 @@ class Pn {
2723
2723
  * Sets up host message handlers.
2724
2724
  */
2725
2725
  setupMessageHandlers(e) {
2726
- this.messenger.on(u.INIT, () => (this.hostInitialized = !0, this.initPromise && this.initPromise.resolve(), e.onInit && queueMicrotask(() => {
2727
- Promise.resolve(e.onInit?.()).catch((n) => {
2728
- e.onError(n);
2726
+ this.messenger.on(l.INIT, (n, s) => this.isHostControlSource(s) ? (this.hostInitialized = !0, this.initPromise && this.initPromise.resolve(), e.onInit && queueMicrotask(() => {
2727
+ Promise.resolve(e.onInit?.()).catch((r) => {
2728
+ e.onError(r);
2729
2729
  });
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(
2731
- u.ERROR,
2732
- async (n) => {
2733
- const s = new Error(n.message);
2734
- return s.stack = n.stack, e.onError(s), { success: !0 };
2730
+ }), { success: !0 }) : { success: !1 }), this.messenger.on(l.CLOSE, async (n, s) => this.isHostControlSource(s) ? (await e.onClose(), { success: !0 }) : { success: !1 }), this.messenger.on(l.RESIZE, async (n, s) => this.isHostControlSource(s) ? (await e.onResize(n), { success: !0 }) : { success: !1 }), this.messenger.on(l.FOCUS, async (n, s) => this.isHostControlSource(s) ? (await e.onFocus(), { success: !0 }) : { success: !1 }), this.messenger.on(l.SHOW, async (n, s) => this.isHostControlSource(s) ? (await e.onShow(), { success: !0 }) : { success: !1 }), this.messenger.on(l.HIDE, async (n, s) => this.isHostControlSource(s) ? (await e.onHide(), { success: !0 }) : { success: !1 }), this.messenger.on(
2731
+ l.ERROR,
2732
+ async (n, s) => {
2733
+ if (!this.isHostControlSource(s))
2734
+ return { success: !1 };
2735
+ const r = new Error(n.message);
2736
+ return r.stack = n.stack, e.onError(r), { success: !0 };
2735
2737
  }
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));
2738
+ ), this.messenger.on(l.EXPORT, async (n, s) => this.isHostControlSource(s) ? (e.onExport(n), { success: !0 }) : { success: !1 }), this.messenger.on(l.CONSUMER_EXPORT, async (n, s) => this.isHostControlSource(s) ? (e.onConsumerExport(n), { success: !0 }) : { success: !1 }), this.messenger.on(l.GET_SIBLINGS, async (n, s) => this.isHostControlSource(s) ? e.onGetSiblings(n) : { success: !1 });
2739
+ }
2740
+ /**
2741
+ * Returns true when a lifecycle/control message came from the opened host window.
2742
+ */
2743
+ isHostControlSource(e) {
2744
+ return !!(this.hostWindow && e.window === this.hostWindow);
2737
2745
  }
2738
2746
  /**
2739
2747
  * Destroys transport resources.
@@ -2742,7 +2750,7 @@ class Pn {
2742
2750
  this.messenger.destroy(), this.bridge.destroy();
2743
2751
  }
2744
2752
  }
2745
- class ye {
2753
+ class ge {
2746
2754
  /** Event emitter for lifecycle events. */
2747
2755
  event;
2748
2756
  /** Arbitrary state storage for the component instance. */
@@ -2892,11 +2900,11 @@ class ye {
2892
2900
  close: () => this.close(),
2893
2901
  focus: () => this.focus()
2894
2902
  }
2895
- ), this.propsPipeline = new Nt(
2903
+ ), this.propsPipeline = new Ht(
2896
2904
  this.options,
2897
2905
  { ...n },
2898
2906
  (s) => this.createPropContext(s)
2899
- ), this.transport = new Pn(
2907
+ ), this.transport = new En(
2900
2908
  this.uid,
2901
2909
  this.options,
2902
2910
  () => this.resolveUrl(),
@@ -2928,7 +2936,7 @@ class ye {
2928
2936
  throw new Error("Component has already been rendered");
2929
2937
  this.context = n ?? this.options.defaultContext, this.checkEligibility(), T(this.props, this.options.props), this.options.validate?.({ props: this.props }), this.container = this.resolveContainer(e), this.event.emit(g.PRERENDER), this.callPropCallback("onPrerender"), await this.prerender(), this.event.emit(g.PRERENDERED), this.callPropCallback("onPrerendered"), this.event.emit(g.RENDER), this.callPropCallback("onRender");
2930
2938
  try {
2931
- await this.open(), await this.waitForHost(), this.context === f.IFRAME && this.iframe && await this.renderer.swapPrerenderContentIfNeeded();
2939
+ await this.open(), await this.waitForHost(), this.context === p.IFRAME && this.iframe && await this.renderer.swapPrerenderContentIfNeeded();
2932
2940
  } catch (s) {
2933
2941
  throw await this.destroy().catch(() => {
2934
2942
  }), s;
@@ -3060,7 +3068,7 @@ class ye {
3060
3068
  * @returns A new unrendered component instance with identical configuration
3061
3069
  */
3062
3070
  clone() {
3063
- const e = new ye(this.options, this.props);
3071
+ const e = new ge(this.options, this.props);
3064
3072
  return e.inputProps = { ...this.inputProps }, e;
3065
3073
  }
3066
3074
  /**
@@ -3079,7 +3087,7 @@ class ye {
3079
3087
  return {
3080
3088
  ...e,
3081
3089
  props: e.props ?? {},
3082
- defaultContext: e.defaultContext ?? f.IFRAME,
3090
+ defaultContext: e.defaultContext ?? p.IFRAME,
3083
3091
  dimensions: e.dimensions ?? { width: "100%", height: "100%" },
3084
3092
  timeout: e.timeout ?? 1e4,
3085
3093
  children: e.children
@@ -3194,7 +3202,7 @@ class ye {
3194
3202
  registerCleanup: (n) => {
3195
3203
  this.cleanup.register(n);
3196
3204
  }
3197
- }), this.hostWindow && pt(this.uid, this.hostWindow);
3205
+ }), this.hostWindow && ft(this.uid, this.hostWindow);
3198
3206
  }
3199
3207
  /**
3200
3208
  * Builds the URL for the host window including query parameters.
@@ -3266,14 +3274,14 @@ class ye {
3266
3274
  */
3267
3275
  createConsumerExports() {
3268
3276
  return {
3269
- init: u.INIT,
3270
- close: u.CLOSE,
3271
- resize: u.RESIZE,
3272
- show: u.SHOW,
3273
- hide: u.HIDE,
3274
- onError: u.ERROR,
3275
- updateProps: u.PROPS,
3276
- export: u.EXPORT
3277
+ init: l.INIT,
3278
+ close: l.CLOSE,
3279
+ resize: l.RESIZE,
3280
+ show: l.SHOW,
3281
+ hide: l.HIDE,
3282
+ onError: l.ERROR,
3283
+ updateProps: l.PROPS,
3284
+ export: l.EXPORT
3277
3285
  };
3278
3286
  }
3279
3287
  /**
@@ -3345,7 +3353,7 @@ class ye {
3345
3353
  getSiblingInstances(e) {
3346
3354
  const n = [];
3347
3355
  if (e.options?.anyConsumer) {
3348
- for (const s of Un())
3356
+ for (const s of Hn())
3349
3357
  s.instance.uid !== e.uid && n.push({
3350
3358
  uid: s.instance.uid,
3351
3359
  tag: s.tag,
@@ -3353,7 +3361,7 @@ class ye {
3353
3361
  });
3354
3362
  return n;
3355
3363
  }
3356
- for (const s of Tn(e.tag))
3364
+ for (const s of Un(e.tag))
3357
3365
  s.uid !== e.uid && n.push({
3358
3366
  uid: s.uid,
3359
3367
  tag: e.tag,
@@ -3367,7 +3375,7 @@ class ye {
3367
3375
  */
3368
3376
  setupCleanup() {
3369
3377
  this.cleanup.register(() => {
3370
- this.messenger.destroy(), this.bridge.destroy(), ft(this.uid);
3378
+ this.messenger.destroy(), this.bridge.destroy(), pt(this.uid);
3371
3379
  });
3372
3380
  }
3373
3381
  /**
@@ -3405,28 +3413,28 @@ class ye {
3405
3413
  ), this.initPromise = null), this.hostInitialized = !1, this.renderer.destroy(this.hostWindow), this.hostWindow = null, this.openedHostDomain = null, this.dynamicUrlTrustedOrigin = null, this.pendingPropsUpdate = null, await this.cleanup.cleanup(), this.event.emit(g.DESTROY), this.callPropCallback("onDestroy"), this.event.removeAllListeners());
3406
3414
  }
3407
3415
  }
3408
- const N = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map();
3409
- function En(t, e) {
3416
+ const H = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map();
3417
+ function bn(t, e) {
3410
3418
  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 });
3419
+ H.get(n.uid) && Xe(n.uid);
3420
+ let r = N.get(t);
3421
+ r || (r = /* @__PURE__ */ new Map(), N.set(t, r)), r.set(n.uid, n), H.set(n.uid, { tag: t, instance: n });
3414
3422
  }
3415
3423
  function Xe(t) {
3416
- const e = N.get(t);
3424
+ const e = H.get(t);
3417
3425
  if (!e)
3418
3426
  return;
3419
- N.delete(t);
3420
- const n = F.get(e.tag);
3421
- n && (n.delete(t), n.size === 0 && F.delete(e.tag));
3427
+ H.delete(t);
3428
+ const n = N.get(e.tag);
3429
+ n && (n.delete(t), n.size === 0 && N.delete(e.tag));
3422
3430
  }
3423
- function bn(t) {
3424
- return Array.from(F.get(t)?.values() ?? []);
3431
+ function Cn(t) {
3432
+ return Array.from(N.get(t)?.values() ?? []);
3425
3433
  }
3426
3434
  function On() {
3427
- return Array.from(N.values());
3435
+ return Array.from(H.values());
3428
3436
  }
3429
- const Ge = "Could not resolve consumer window", ne = "Could not verify consumer origin", Cn = /* @__PURE__ */ new Set([
3437
+ const Ge = "Could not resolve consumer window", te = "Could not verify consumer origin", Rn = /* @__PURE__ */ new Set([
3430
3438
  "uid",
3431
3439
  "tag",
3432
3440
  "close",
@@ -3446,10 +3454,10 @@ const Ge = "Could not resolve consumer window", ne = "Could not verify consumer
3446
3454
  function v(t) {
3447
3455
  const e = {};
3448
3456
  for (const [n, s] of Object.entries(t))
3449
- Cn.has(n) || (e[n] = s);
3457
+ Rn.has(n) || (e[n] = s);
3450
3458
  return e;
3451
3459
  }
3452
- class Rn {
3460
+ class xn {
3453
3461
  /**
3454
3462
  * Creates a new HostComponent instance.
3455
3463
  *
@@ -3462,7 +3470,7 @@ class Rn {
3462
3470
  this.propDefinitions = n, this.allowedConsumerDomains = s, this.deferInit = r, this.uid = e.uid, this.tag = e.tag, this.event = new Ae();
3463
3471
  let i = null, o = null;
3464
3472
  try {
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();
3473
+ this.consumerWindow = this.resolveConsumerWindow(), this.consumerDomain = this.resolveConsumerDomain(e.consumerDomain), o = new qe(this.uid, window, B(), this.consumerDomain), this.messenger = o, this.setupMessageHandlers(), i = new pe(this.messenger), this.bridge = i, this.hostProps = this.buildHostProps(e), this.exposeHostProps(), this.deferInit || this.flushInit();
3466
3474
  } catch (a) {
3467
3475
  throw i?.destroy(), o?.destroy(), this.event.removeAllListeners(), this.propsHandlers.clear(), a;
3468
3476
  }
@@ -3542,7 +3550,7 @@ class Rn {
3542
3550
  if (this.allowedConsumerDomains) {
3543
3551
  if (!this.consumerDomain)
3544
3552
  throw new Error(
3545
- `${ne} for component "${this.tag}"`
3553
+ `${te} for component "${this.tag}"`
3546
3554
  );
3547
3555
  if (!U(this.allowedConsumerDomains, this.consumerDomain))
3548
3556
  throw new Error(
@@ -3583,7 +3591,7 @@ class Rn {
3583
3591
  return this.consumerDomainVerified = !0, this.consumerDomain = n, this.validateConsumerDomain(), n;
3584
3592
  if (this.consumerDomainVerified = !1, this.allowedConsumerDomains)
3585
3593
  throw new Error(
3586
- `${ne} for component "${this.tag}"`
3594
+ `${te} for component "${this.tag}"`
3587
3595
  );
3588
3596
  return e;
3589
3597
  }
@@ -3595,7 +3603,7 @@ class Rn {
3595
3603
  const n = this.getVerifiedConsumerOrigin();
3596
3604
  if (n && this.setConsumerDomain(n, !0), !this.consumerDomainVerified)
3597
3605
  throw new Error(
3598
- `${ne} for component "${this.tag}"`
3606
+ `${te} for component "${this.tag}"`
3599
3607
  );
3600
3608
  if (!U(e, this.consumerDomain))
3601
3609
  throw new Error(
@@ -3639,8 +3647,8 @@ class Rn {
3639
3647
  * @internal
3640
3648
  */
3641
3649
  resolveConsumerWindow() {
3642
- if (ut()) {
3643
- const e = lt();
3650
+ if (lt()) {
3651
+ const e = ut();
3644
3652
  if (e) return e;
3645
3653
  }
3646
3654
  if (ht()) {
@@ -3712,7 +3720,7 @@ class Rn {
3712
3720
  await this.messenger.send(
3713
3721
  this.consumerWindow,
3714
3722
  this.consumerDomain,
3715
- u.INIT,
3723
+ l.INIT,
3716
3724
  { uid: this.uid, tag: this.tag }
3717
3725
  );
3718
3726
  } catch (e) {
@@ -3740,7 +3748,7 @@ class Rn {
3740
3748
  await this.messenger.send(
3741
3749
  this.consumerWindow,
3742
3750
  this.consumerDomain,
3743
- u.CLOSE,
3751
+ l.CLOSE,
3744
3752
  {}
3745
3753
  );
3746
3754
  }
@@ -3752,7 +3760,7 @@ class Rn {
3752
3760
  window.focus(), await this.messenger.send(
3753
3761
  this.consumerWindow,
3754
3762
  this.consumerDomain,
3755
- u.FOCUS,
3763
+ l.FOCUS,
3756
3764
  {}
3757
3765
  );
3758
3766
  }
@@ -3764,7 +3772,7 @@ class Rn {
3764
3772
  await this.messenger.send(
3765
3773
  this.consumerWindow,
3766
3774
  this.consumerDomain,
3767
- u.RESIZE,
3775
+ l.RESIZE,
3768
3776
  e
3769
3777
  );
3770
3778
  }
@@ -3776,7 +3784,7 @@ class Rn {
3776
3784
  await this.messenger.send(
3777
3785
  this.consumerWindow,
3778
3786
  this.consumerDomain,
3779
- u.SHOW,
3787
+ l.SHOW,
3780
3788
  {}
3781
3789
  );
3782
3790
  }
@@ -3788,7 +3796,7 @@ class Rn {
3788
3796
  await this.messenger.send(
3789
3797
  this.consumerWindow,
3790
3798
  this.consumerDomain,
3791
- u.HIDE,
3799
+ l.HIDE,
3792
3800
  {}
3793
3801
  );
3794
3802
  }
@@ -3809,7 +3817,7 @@ class Rn {
3809
3817
  await this.messenger.send(
3810
3818
  this.consumerWindow,
3811
3819
  this.consumerDomain,
3812
- u.ERROR,
3820
+ l.ERROR,
3813
3821
  {
3814
3822
  message: e.message,
3815
3823
  stack: e.stack
@@ -3824,7 +3832,7 @@ class Rn {
3824
3832
  await this.messenger.send(
3825
3833
  this.consumerWindow,
3826
3834
  this.consumerDomain,
3827
- u.EXPORT,
3835
+ l.EXPORT,
3828
3836
  e
3829
3837
  );
3830
3838
  }
@@ -3836,7 +3844,7 @@ class Rn {
3836
3844
  await this.messenger.send(
3837
3845
  this.consumerWindow,
3838
3846
  this.consumerDomain,
3839
- u.CONSUMER_EXPORT,
3847
+ l.CONSUMER_EXPORT,
3840
3848
  e
3841
3849
  );
3842
3850
  }
@@ -3848,7 +3856,7 @@ class Rn {
3848
3856
  return await this.messenger.send(
3849
3857
  this.consumerWindow,
3850
3858
  this.consumerDomain,
3851
- u.GET_SIBLINGS,
3859
+ l.GET_SIBLINGS,
3852
3860
  { uid: this.uid, tag: this.tag, options: e }
3853
3861
  ) ?? [];
3854
3862
  }
@@ -3878,9 +3886,11 @@ class Rn {
3878
3886
  * @internal
3879
3887
  */
3880
3888
  setupMessageHandlers() {
3881
- this.messenger.on(u.PROPS, (e) => {
3889
+ this.messenger.on(l.PROPS, (e, n) => {
3890
+ if (!this.isConsumerSource(n))
3891
+ return { success: !1 };
3882
3892
  try {
3883
- const n = this.consumerProps, s = Ue(
3893
+ const s = this.consumerProps, r = Ue(
3884
3894
  e,
3885
3895
  this.propDefinitions,
3886
3896
  this.messenger,
@@ -3888,20 +3898,27 @@ class Rn {
3888
3898
  this.consumerWindow,
3889
3899
  this.consumerDomain
3890
3900
  );
3891
- T(s, this.propDefinitions), this.removeStaleHostProps(n, s), this.consumerProps = s, Object.assign(this.hostProps, v(s)), this.hostProps.consumer.props = this.consumerProps;
3892
- for (const r of this.propsHandlers)
3901
+ T(r, this.propDefinitions), this.removeStaleHostProps(s, r), this.consumerProps = r, Object.assign(this.hostProps, v(r)), this.hostProps.consumer.props = this.consumerProps;
3902
+ for (const i of this.propsHandlers)
3893
3903
  try {
3894
- r(s);
3895
- } catch (i) {
3896
- console.error("Error in props handler:", i);
3904
+ i(r);
3905
+ } catch (o) {
3906
+ console.error("Error in props handler:", o);
3897
3907
  }
3898
- return this.event.emit(g.PROPS, s), { success: !0 };
3899
- } catch (n) {
3900
- const s = n instanceof Error ? n : new Error(String(n));
3901
- throw console.error("Error deserializing props:", s), this.event.emit(g.ERROR, s), s;
3908
+ return this.event.emit(g.PROPS, r), { success: !0 };
3909
+ } catch (s) {
3910
+ const r = s instanceof Error ? s : new Error(String(s));
3911
+ throw console.error("Error deserializing props:", r), this.event.emit(g.ERROR, r), r;
3902
3912
  }
3903
3913
  });
3904
3914
  }
3915
+ /**
3916
+ * Returns true when a stateful inbound message came from the resolved consumer window.
3917
+ * @internal
3918
+ */
3919
+ isConsumerSource(e) {
3920
+ return e.window === this.consumerWindow;
3921
+ }
3905
3922
  /**
3906
3923
  * Removes stale prop keys that are no longer present in the latest consumer payload.
3907
3924
  * @internal
@@ -3919,7 +3936,7 @@ class Rn {
3919
3936
  }
3920
3937
  }
3921
3938
  let w = null;
3922
- function we(t, e, n = {}) {
3939
+ function ye(t, e, n = {}) {
3923
3940
  if (w) {
3924
3941
  try {
3925
3942
  w.applyHostConfiguration(
@@ -3927,17 +3944,17 @@ function we(t, e, n = {}) {
3927
3944
  e
3928
3945
  ), e && w.assertAllowedConsumerDomain(e);
3929
3946
  } catch (r) {
3930
- throw Sn(), r;
3947
+ throw vn(), r;
3931
3948
  }
3932
3949
  return n.deferInit || w.flushInit(), w;
3933
3950
  }
3934
- if (!ge())
3951
+ if (!me())
3935
3952
  return null;
3936
- const s = _n();
3953
+ const s = Pn();
3937
3954
  if (!s)
3938
3955
  return console.error("Failed to parse ForgeFrame payload from window.name"), null;
3939
3956
  try {
3940
- w = new Rn(
3957
+ w = new xn(
3941
3958
  s,
3942
3959
  t,
3943
3960
  e,
@@ -3950,20 +3967,23 @@ function we(t, e, n = {}) {
3950
3967
  }
3951
3968
  return w;
3952
3969
  }
3953
- function xn() {
3954
- return ge();
3955
- }
3956
3970
  function Dn() {
3957
- return ge();
3971
+ return me();
3972
+ }
3973
+ function Sn() {
3974
+ return me();
3958
3975
  }
3959
3976
  function In() {
3960
3977
  return window.hostProps;
3961
3978
  }
3962
- function Sn() {
3979
+ function vn() {
3963
3980
  w && (w.destroy(), w = null), delete window.hostProps;
3964
3981
  }
3982
+ function we() {
3983
+ return typeof window < "u" && typeof window.location < "u";
3984
+ }
3965
3985
  const K = /* @__PURE__ */ new Map(), Ze = /* @__PURE__ */ Symbol("forgeframe.component.options");
3966
- function vn(t) {
3986
+ function Tn(t) {
3967
3987
  if (!t.tag)
3968
3988
  throw new Error("Component tag is required");
3969
3989
  if (!/^[a-z][a-z0-9-]*$/.test(t.tag))
@@ -3974,7 +3994,8 @@ function vn(t) {
3974
3994
  throw new Error("Component url is required");
3975
3995
  if (typeof t.url == "string")
3976
3996
  try {
3977
- new URL(t.url, window.location.origin);
3997
+ const e = we() ? window.location.origin : "https://forgeframe.invalid";
3998
+ new URL(t.url, e);
3978
3999
  } catch {
3979
4000
  throw new Error(
3980
4001
  `Invalid component URL "${t.url}". Must be a valid absolute or relative URL.`
@@ -3984,26 +4005,36 @@ function vn(t) {
3984
4005
  throw new Error(`Component "${t.tag}" is already registered`);
3985
4006
  }
3986
4007
  function Qe(t) {
3987
- vn(t);
4008
+ Tn(t);
3988
4009
  const e = [];
3989
4010
  let n;
3990
- if (te(t.tag)) {
3991
- const r = we(t.props, t.allowedConsumerDomains);
3992
- r && (n = r.hostProps);
3993
- }
3994
- const s = function(r = {}) {
3995
- const i = new ye(t, r);
3996
- return e.push(i), En(t.tag, i), i.event.once("destroy", () => {
3997
- const o = e.indexOf(i);
3998
- o !== -1 && e.splice(o, 1), Xe(i.uid);
3999
- }), i;
4011
+ const s = () => we() && gn(t.tag), r = () => {
4012
+ if (n)
4013
+ return n;
4014
+ if (!s())
4015
+ return;
4016
+ const a = ye(t.props, t.allowedConsumerDomains);
4017
+ if (a)
4018
+ return n = a.hostProps, n;
4000
4019
  };
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;
4020
+ r();
4021
+ const i = () => (r(), n !== void 0 || s()), o = function(a = {}) {
4022
+ const c = new ge(t, a);
4023
+ return e.push(c), bn(t.tag, c), c.event.once("destroy", () => {
4024
+ const u = e.indexOf(c);
4025
+ u !== -1 && e.splice(u, 1), Xe(c.uid);
4026
+ }), c;
4027
+ };
4028
+ return o.instances = e, o.isHost = () => i(), o.isEmbedded = () => i(), Object.defineProperty(o, "hostProps", {
4029
+ configurable: !0,
4030
+ enumerable: !0,
4031
+ get: () => r()
4032
+ }), o[Ze] = t, o.canRenderTo = async (a) => a === window, K.set(t.tag, o), o;
4002
4033
  }
4003
- function Tn(t) {
4004
- return bn(t);
4034
+ function Un(t) {
4035
+ return Cn(t);
4005
4036
  }
4006
- function Un() {
4037
+ function Hn() {
4007
4038
  return On();
4008
4039
  }
4009
4040
  function Nn(t) {
@@ -4018,11 +4049,11 @@ async function et(t) {
4018
4049
  const n = [...e.instances];
4019
4050
  await Promise.all(n.map((s) => s.close()));
4020
4051
  }
4021
- async function Hn() {
4052
+ async function $n() {
4022
4053
  const t = Array.from(K.keys());
4023
4054
  await Promise.all(t.map((e) => et(e)));
4024
4055
  }
4025
- function $n(t, e) {
4056
+ function An(t, e) {
4026
4057
  const n = Object.keys(t), s = Object.keys(e);
4027
4058
  if (n.length !== s.length)
4028
4059
  return !1;
@@ -4031,45 +4062,45 @@ function $n(t, e) {
4031
4062
  return !1;
4032
4063
  return !0;
4033
4064
  }
4034
- function An(t, e) {
4065
+ function Ln(t, e) {
4035
4066
  const { React: n } = e, { createElement: s, useRef: r, useEffect: i, useState: o, forwardRef: a } = n, c = a(
4036
4067
  function(m, h) {
4037
4068
  const {
4038
4069
  onRendered: E,
4039
- onError: O,
4070
+ onError: C,
4040
4071
  onClose: X,
4041
4072
  context: _e,
4042
4073
  className: Pe,
4043
4074
  style: Ee,
4044
4075
  ...G
4045
- } = m, Z = r(null), I = r(null), $ = r(null), be = r(E), A = r(O), Oe = r(X), [Ce, Re] = o(null);
4076
+ } = m, Z = r(null), S = r(null), $ = r(null), be = r(E), A = r(C), Ce = r(X), [Oe, Re] = o(null);
4046
4077
  return i(() => {
4047
- be.current = E, A.current = O, Oe.current = X;
4048
- }, [E, O, X]), i(() => {
4078
+ be.current = E, A.current = C, Ce.current = X;
4079
+ }, [E, C, X]), i(() => {
4049
4080
  const _ = Z.current;
4050
4081
  if (!_) return;
4051
4082
  Re(null);
4052
4083
  const y = t(G);
4053
- I.current = y, $.current = G;
4084
+ S.current = y, $.current = G;
4054
4085
  const L = y.event.once("rendered", () => {
4055
4086
  be.current?.();
4056
4087
  }), xe = y.event.once("close", () => {
4057
- Oe.current?.();
4088
+ Ce.current?.();
4058
4089
  }), Q = y.event.on("error", (M) => {
4059
4090
  A.current?.(M);
4060
4091
  });
4061
4092
  return y.render(_, _e).catch((M) => {
4062
- I.current === y && (Re(M), A.current?.(M));
4093
+ S.current === y && (Re(M), A.current?.(M));
4063
4094
  }), () => {
4064
4095
  y.close().catch(() => {
4065
- }), L(), xe(), Q(), I.current = null, $.current = null;
4096
+ }), L(), xe(), Q(), S.current = null, $.current = null;
4066
4097
  };
4067
4098
  }, [_e]), i(() => {
4068
- const _ = I.current;
4099
+ const _ = S.current;
4069
4100
  if (!_) return;
4070
4101
  const y = G, L = $.current;
4071
- L && $n(L, y) || ($.current = y, _.updateProps(y).catch((Q) => {
4072
- I.current === _ && A.current?.(Q);
4102
+ L && An(L, y) || ($.current = y, _.updateProps(y).catch((Q) => {
4103
+ S.current === _ && A.current?.(Q);
4073
4104
  }));
4074
4105
  }), i(() => {
4075
4106
  const _ = Z.current;
@@ -4081,13 +4112,13 @@ function An(t, e) {
4081
4112
  return h.current = _, () => {
4082
4113
  h.current = null;
4083
4114
  };
4084
- }, [h]), Ce ? s(
4115
+ }, [h]), Oe ? s(
4085
4116
  "div",
4086
4117
  {
4087
4118
  className: Pe,
4088
4119
  style: { color: "red", padding: "16px", ...Ee }
4089
4120
  },
4090
- `Error: ${Ce.message}`
4121
+ `Error: ${Oe.message}`
4091
4122
  ) : s("div", {
4092
4123
  ref: Z,
4093
4124
  className: Pe,
@@ -4097,16 +4128,16 @@ function An(t, e) {
4097
4128
  }
4098
4129
  });
4099
4130
  }
4100
- ), l = `ForgeFrame(${t.name || "Component"})`;
4101
- return c.displayName = l, c;
4131
+ ), u = `ForgeFrame(${t.name || "Component"})`;
4132
+ return c.displayName = u, c;
4102
4133
  }
4103
- function Ln(t) {
4134
+ function Mn(t) {
4104
4135
  return function(n) {
4105
- return An(n, { React: t });
4136
+ return Ln(n, { React: t });
4106
4137
  };
4107
4138
  }
4108
- we(void 0, void 0, { deferInit: !0 });
4109
- const Mn = {
4139
+ we() && ye(void 0, void 0, { deferInit: !0 });
4140
+ const zn = {
4110
4141
  /**
4111
4142
  * Create a new component definition.
4112
4143
  *
@@ -4147,7 +4178,7 @@ const Mn = {
4147
4178
  /**
4148
4179
  * Destroy all ForgeFrame component instances.
4149
4180
  */
4150
- destroyAll: Hn,
4181
+ destroyAll: $n,
4151
4182
  /**
4152
4183
  * Check if the current window is a host component context.
4153
4184
  *
@@ -4157,7 +4188,7 @@ const Mn = {
4157
4188
  *
4158
4189
  * @returns True if running inside a ForgeFrame iframe/popup
4159
4190
  */
4160
- isHost: xn,
4191
+ isHost: Dn,
4161
4192
  /**
4162
4193
  * Check if the current window is embedded by ForgeFrame.
4163
4194
  *
@@ -4166,7 +4197,7 @@ const Mn = {
4166
4197
  *
4167
4198
  * @returns True if running inside a ForgeFrame iframe/popup
4168
4199
  */
4169
- isEmbedded: Dn,
4200
+ isEmbedded: Sn,
4170
4201
  /**
4171
4202
  * Get hostProps from the current host window.
4172
4203
  *
@@ -4186,7 +4217,7 @@ const Mn = {
4186
4217
  *
4187
4218
  * @returns The host component instance if running embedded, otherwise null
4188
4219
  */
4189
- initHost: we,
4220
+ initHost: ye,
4190
4221
  /**
4191
4222
  * Serialization strategy constants.
4192
4223
  * @see {@link PROP_SERIALIZATION}
@@ -4196,7 +4227,7 @@ const Mn = {
4196
4227
  * Rendering context constants (IFRAME, POPUP).
4197
4228
  * @see {@link CONTEXT}
4198
4229
  */
4199
- CONTEXT: f,
4230
+ CONTEXT: p,
4200
4231
  /**
4201
4232
  * Lifecycle event name constants.
4202
4233
  * @see {@link EVENT}
@@ -4209,7 +4240,7 @@ const Mn = {
4209
4240
  /**
4210
4241
  * Current library version.
4211
4242
  */
4212
- VERSION: ae,
4243
+ VERSION: oe,
4213
4244
  /**
4214
4245
  * Check if a value is a Standard Schema (Zod, Valibot, ArkType, etc.)
4215
4246
  *
@@ -4249,36 +4280,36 @@ const Mn = {
4249
4280
  * });
4250
4281
  * ```
4251
4282
  */
4252
- prop: p
4283
+ prop: f
4253
4284
  };
4254
4285
  export {
4255
4286
  fe as AnySchema,
4256
4287
  V as ArraySchema,
4257
4288
  ue as BooleanSchema,
4258
- f as CONTEXT,
4289
+ p as CONTEXT,
4259
4290
  g as EVENT,
4260
- pe as EnumSchema,
4261
- Mn as ForgeFrame,
4262
- he as FunctionSchema,
4263
- de as LiteralSchema,
4264
- le as NumberSchema,
4291
+ de as EnumSchema,
4292
+ zn as ForgeFrame,
4293
+ le as FunctionSchema,
4294
+ he as LiteralSchema,
4295
+ ce as NumberSchema,
4265
4296
  Y as ObjectSchema,
4266
4297
  z as PROP_SERIALIZATION,
4267
4298
  Je as PopupOpenError,
4268
4299
  P as PropSchema,
4269
- ce as StringSchema,
4270
- ae as VERSION,
4300
+ ae as StringSchema,
4301
+ oe as VERSION,
4271
4302
  Qe as create,
4272
- An as createReactComponent,
4273
- Mn as default,
4303
+ Ln as createReactComponent,
4304
+ zn as default,
4274
4305
  Fn as destroy,
4275
- Hn as destroyAll,
4306
+ $n as destroyAll,
4276
4307
  et as destroyByTag,
4277
4308
  In as getHostProps,
4278
- we as initHost,
4279
- Dn as isEmbedded,
4280
- xn as isHost,
4309
+ ye as initHost,
4310
+ Sn as isEmbedded,
4311
+ Dn as isHost,
4281
4312
  D as isStandardSchema,
4282
- p as prop,
4283
- Ln as withReactComponent
4313
+ f as prop,
4314
+ Mn as withReactComponent
4284
4315
  };