@metapages/metapage 0.13.11 → 0.13.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.
package/dist/index.mjs CHANGED
@@ -880,63 +880,100 @@ var kt;
880
880
  o.State = "metapage/state";
881
881
  })(kt || (kt = {}));
882
882
  const rt = "metapage/definition", ft = "metapage/state", Qt = zt[zt.length - 1], ae = Ft[Ft.length - 1];
883
- function Ot(o, t) {
884
- const n = Et(o), a = Et(t), d = n.pop(), m = a.pop(), b = Pt(n, a);
885
- return b !== 0 ? b : d && m ? Pt(d.split("."), m.split(".")) : d || m ? d ? -1 : 1 : 0;
886
- }
887
- const ue = (o) => typeof o == "string" && /^[v\d]/.test(o) && Zt.test(o), lt = (o, t, n) => {
888
- le(n);
889
- const a = Ot(o, t);
890
- return te[n].includes(a);
891
- }, fe = (o, t) => {
892
- const n = t.match(/^([<>=~^]+)/), a = n ? n[1] : "=";
893
- if (a !== "^" && a !== "~")
894
- return lt(o, t, a);
895
- const [d, m, b] = Et(o), [I, M, S] = Et(t);
896
- return It(d, I) !== 0 ? !1 : a === "^" ? Pt([m, b], [M, S]) >= 0 : It(m, M) !== 0 ? !1 : It(b, S) >= 0;
883
+ var lt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", dt = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
884
+ for (var _t = 0; _t < lt.length; _t++)
885
+ dt[lt.charCodeAt(_t)] = _t;
886
+ var wt = function(o) {
887
+ var t = new Uint8Array(o), n, a = t.length, d = "";
888
+ for (n = 0; n < a; n += 3)
889
+ d += lt[t[n] >> 2], d += lt[(t[n] & 3) << 4 | t[n + 1] >> 4], d += lt[(t[n + 1] & 15) << 2 | t[n + 2] >> 6], d += lt[t[n + 2] & 63];
890
+ return a % 3 === 2 ? d = d.substring(0, d.length - 1) + "=" : a % 3 === 1 && (d = d.substring(0, d.length - 2) + "=="), d;
891
+ }, vt = function(o) {
892
+ var t = o.length * 0.75, n = o.length, a, d = 0, m, b, I, M;
893
+ o[o.length - 1] === "=" && (t--, o[o.length - 2] === "=" && t--);
894
+ var S = new ArrayBuffer(t), A = new Uint8Array(S);
895
+ for (a = 0; a < n; a += 4)
896
+ m = dt[o.charCodeAt(a)], b = dt[o.charCodeAt(a + 1)], I = dt[o.charCodeAt(a + 2)], M = dt[o.charCodeAt(a + 3)], A[d++] = m << 2 | b >> 4, A[d++] = (b & 15) << 4 | I >> 2, A[d++] = (I & 3) << 6 | M & 63;
897
+ return S;
897
898
  };
898
- Ot.validate = ue;
899
- Ot.compare = lt;
900
- Ot.satisfies = fe;
901
- const Zt = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Et = (o) => {
902
- if (typeof o != "string")
903
- throw new TypeError("Invalid argument expected string");
904
- const t = o.match(Zt);
905
- if (!t)
906
- throw new Error(`Invalid argument not valid semver ('${o}' received)`);
907
- return t.shift(), t;
908
- }, qt = (o) => o === "*" || o === "x" || o === "X", Jt = (o) => {
909
- const t = parseInt(o, 10);
910
- return isNaN(t) ? o : t;
911
- }, he = (o, t) => typeof o != typeof t ? [String(o), String(t)] : [o, t], It = (o, t) => {
912
- if (qt(o) || qt(t))
913
- return 0;
914
- const [n, a] = he(Jt(o), Jt(t));
915
- return n > a ? 1 : n < a ? -1 : 0;
916
- }, Pt = (o, t) => {
917
- for (let n = 0; n < Math.max(o.length, t.length); n++) {
918
- const a = It(o[n] || 0, t[n] || 0);
919
- if (a !== 0)
920
- return a;
899
+ const Ot = async (o) => {
900
+ for (const t of Object.keys(o)) {
901
+ const n = await ue(o[t]);
902
+ o[t] = n;
921
903
  }
922
- return 0;
923
- }, te = {
924
- ">": [1],
925
- ">=": [0, 1],
926
- "=": [0],
927
- "<=": [-1, 0],
928
- "<": [-1]
929
- }, Wt = Object.keys(te), le = (o) => {
930
- if (typeof o != "string")
931
- throw new TypeError(
932
- `Invalid operator type, expected string but got ${typeof o}`
933
- );
934
- if (Wt.indexOf(o) === -1)
935
- throw new Error(
936
- `Invalid operator, expected one of ${Wt.join("|")}`
937
- );
904
+ return o;
905
+ }, gt = async (o) => {
906
+ for (const t of Object.keys(o)) {
907
+ const n = await fe(o[t]);
908
+ o[t] = n;
909
+ }
910
+ return o;
911
+ }, ue = async (o) => {
912
+ if (o instanceof Int8Array || o instanceof Uint8Array || o instanceof Uint8ClampedArray || o instanceof Int16Array || o instanceof Uint16Array || o instanceof Int32Array || o instanceof Uint32Array || o instanceof Float32Array || o instanceof Float64Array) {
913
+ const t = o, n = {
914
+ _s: !0,
915
+ _c: o.constructor.name,
916
+ value: wt(t.buffer),
917
+ byteLength: t.byteLength,
918
+ byteOffset: t.byteOffset,
919
+ size: t.byteLength
920
+ };
921
+ return Promise.resolve(n);
922
+ } else if (o instanceof File) {
923
+ const t = o, n = await t.arrayBuffer();
924
+ return {
925
+ _s: !0,
926
+ _c: File.name,
927
+ value: wt(n),
928
+ name: t.name,
929
+ fileType: t.type,
930
+ lastModified: t.lastModified,
931
+ size: n.byteLength
932
+ };
933
+ } else if (o instanceof Blob) {
934
+ const t = o, n = await t.arrayBuffer();
935
+ return {
936
+ _s: !0,
937
+ _c: Blob.name,
938
+ value: wt(n),
939
+ fileType: t.type,
940
+ size: n.byteLength
941
+ };
942
+ } else if (o instanceof ArrayBuffer) {
943
+ const t = o, n = {
944
+ _s: !0,
945
+ _c: ArrayBuffer.name,
946
+ value: wt(t),
947
+ size: t.byteLength
948
+ };
949
+ return Promise.resolve(n);
950
+ }
951
+ return Promise.resolve(o);
952
+ }, fe = (o) => {
953
+ if (!(o && typeof o == "object" && o._s === !0))
954
+ return o;
955
+ const t = o, n = t._c;
956
+ if (n === Blob.name) {
957
+ const b = o;
958
+ return new Blob([vt(t.value)], {
959
+ type: b.fileType
960
+ });
961
+ } else if (n === File.name) {
962
+ const b = o;
963
+ return new File([vt(t.value)], b.name, {
964
+ type: b.fileType,
965
+ lastModified: b.lastModified
966
+ });
967
+ } else if (n === ArrayBuffer.name)
968
+ return vt(t.value);
969
+ const a = o, d = vt(a.value), m = a._c;
970
+ try {
971
+ return new globalThis[m](d);
972
+ } catch {
973
+ }
974
+ return o;
938
975
  };
939
- var ee = { exports: {} };
976
+ var Zt = { exports: {} };
940
977
  (function(o) {
941
978
  var t = Object.prototype.hasOwnProperty, n = "~";
942
979
  function a() {
@@ -1046,12 +1083,69 @@ var ee = { exports: {} };
1046
1083
  var A;
1047
1084
  return S ? (A = n ? n + S : S, this._events[A] && b(this, A)) : (this._events = new a(), this._eventsCount = 0), this;
1048
1085
  }, I.prototype.off = I.prototype.removeListener, I.prototype.addListener = I.prototype.on, I.prefixed = n, I.EventEmitter = I, o.exports = I;
1049
- })(ee);
1050
- var Dt = ee.exports, mt;
1086
+ })(Zt);
1087
+ var Dt = Zt.exports;
1088
+ function Mt(o, t) {
1089
+ const n = Et(o), a = Et(t), d = n.pop(), m = a.pop(), b = Pt(n, a);
1090
+ return b !== 0 ? b : d && m ? Pt(d.split("."), m.split(".")) : d || m ? d ? -1 : 1 : 0;
1091
+ }
1092
+ const he = (o) => typeof o == "string" && /^[v\d]/.test(o) && te.test(o), ct = (o, t, n) => {
1093
+ de(n);
1094
+ const a = Mt(o, t);
1095
+ return ee[n].includes(a);
1096
+ }, le = (o, t) => {
1097
+ const n = t.match(/^([<>=~^]+)/), a = n ? n[1] : "=";
1098
+ if (a !== "^" && a !== "~")
1099
+ return ct(o, t, a);
1100
+ const [d, m, b] = Et(o), [I, M, S] = Et(t);
1101
+ return It(d, I) !== 0 ? !1 : a === "^" ? Pt([m, b], [M, S]) >= 0 : It(m, M) !== 0 ? !1 : It(b, S) >= 0;
1102
+ };
1103
+ Mt.validate = he;
1104
+ Mt.compare = ct;
1105
+ Mt.satisfies = le;
1106
+ const te = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Et = (o) => {
1107
+ if (typeof o != "string")
1108
+ throw new TypeError("Invalid argument expected string");
1109
+ const t = o.match(te);
1110
+ if (!t)
1111
+ throw new Error(`Invalid argument not valid semver ('${o}' received)`);
1112
+ return t.shift(), t;
1113
+ }, qt = (o) => o === "*" || o === "x" || o === "X", Jt = (o) => {
1114
+ const t = parseInt(o, 10);
1115
+ return isNaN(t) ? o : t;
1116
+ }, ce = (o, t) => typeof o != typeof t ? [String(o), String(t)] : [o, t], It = (o, t) => {
1117
+ if (qt(o) || qt(t))
1118
+ return 0;
1119
+ const [n, a] = ce(Jt(o), Jt(t));
1120
+ return n > a ? 1 : n < a ? -1 : 0;
1121
+ }, Pt = (o, t) => {
1122
+ for (let n = 0; n < Math.max(o.length, t.length); n++) {
1123
+ const a = It(o[n] || 0, t[n] || 0);
1124
+ if (a !== 0)
1125
+ return a;
1126
+ }
1127
+ return 0;
1128
+ }, ee = {
1129
+ ">": [1],
1130
+ ">=": [0, 1],
1131
+ "=": [0],
1132
+ "<=": [-1, 0],
1133
+ "<": [-1]
1134
+ }, Wt = Object.keys(ee), de = (o) => {
1135
+ if (typeof o != "string")
1136
+ throw new TypeError(
1137
+ `Invalid operator type, expected string but got ${typeof o}`
1138
+ );
1139
+ if (Wt.indexOf(o) === -1)
1140
+ throw new Error(
1141
+ `Invalid operator, expected one of ${Wt.join("|")}`
1142
+ );
1143
+ };
1144
+ var mt;
1051
1145
  (function(o) {
1052
1146
  o.mp_debug = "mp_debug";
1053
1147
  })(mt || (mt = {}));
1054
- const ce = () => {
1148
+ const pe = () => {
1055
1149
  try {
1056
1150
  return window !== window.top;
1057
1151
  } catch {
@@ -1061,7 +1155,7 @@ const ce = () => {
1061
1155
  version: pt,
1062
1156
  metaframes: {}
1063
1157
  };
1064
- class de extends Dt.EventEmitter {
1158
+ class ge extends Dt.EventEmitter {
1065
1159
  constructor() {
1066
1160
  super(), this._definition = ne, this.getDefinition = this.getDefinition.bind(this);
1067
1161
  }
@@ -1087,7 +1181,7 @@ ${o}`;
1087
1181
  let t;
1088
1182
  switch (re(o.version)) {
1089
1183
  case st.V0_2: {
1090
- t = ie(me(o));
1184
+ t = ie(be(o));
1091
1185
  break;
1092
1186
  }
1093
1187
  case st.V0_3: {
@@ -1105,9 +1199,9 @@ ${o}`;
1105
1199
  case void 0:
1106
1200
  case it.V0_3:
1107
1201
  case it.V0_4:
1108
- return se(pe(o));
1202
+ return se(me(o));
1109
1203
  case it.V0_5:
1110
- return ge(o);
1204
+ return ye(o);
1111
1205
  case it.V0_6:
1112
1206
  return o;
1113
1207
  default:
@@ -1119,7 +1213,7 @@ ${window.location.href}`;
1119
1213
  ${JSON.stringify(o)}
1120
1214
  ${window.location.href}`), o;
1121
1215
  }
1122
- }, pe = (o) => {
1216
+ }, me = (o) => {
1123
1217
  const { version: t, inputs: n, outputs: a, allow: d, metadata: m, ...b } = o, I = m, { title: M, author: S, image: A, descriptionUrl: P, keywords: T, iconUrl: V, ...y } = I, C = {
1124
1218
  name: M,
1125
1219
  author: S,
@@ -1136,7 +1230,7 @@ ${window.location.href}`), o;
1136
1230
  metadata: C,
1137
1231
  ...b
1138
1232
  };
1139
- }, ge = (o) => {
1233
+ }, ye = (o) => {
1140
1234
  const { metadata: t, ...n } = o, a = {
1141
1235
  ...n,
1142
1236
  version: it.V0_6
@@ -1170,7 +1264,7 @@ ${window.location.href}`), o;
1170
1264
  }
1171
1265
  }
1172
1266
  return a;
1173
- }, me = (o) => (o.version = st.V0_3, o), St = (o, t) => {
1267
+ }, be = (o) => (o.version = st.V0_3, o), St = (o, t) => {
1174
1268
  if (!t)
1175
1269
  return !1;
1176
1270
  let n = !1;
@@ -1180,13 +1274,13 @@ ${window.location.href}`), o;
1180
1274
  }, re = (o) => {
1181
1275
  if (o === "latest")
1182
1276
  return pt;
1183
- if (lt(o, "0.2", "<"))
1277
+ if (ct(o, "0.2", "<"))
1184
1278
  throw `Unknown version: ${o}`;
1185
- return lt(o, "0.2", ">=") && lt(o, st.V0_3, "<") ? st.V0_2 : lt(o, "0.3", ">=") ? st.V0_3 : (console.log(`Could not match version=${o} to any known version, assuming ${pt}`), pt);
1279
+ return ct(o, "0.2", ">=") && ct(o, st.V0_3, "<") ? st.V0_2 : ct(o, "0.3", ">=") ? st.V0_3 : (console.log(`Could not match version=${o} to any known version, assuming ${pt}`), pt);
1186
1280
  }, Ue = (o) => window.location.search ? new URLSearchParams(window.location.search).get(o) : null, ke = () => new URLSearchParams(window.location.search).has(mt.mp_debug), Ct = () => {
1187
1281
  const o = new URLSearchParams(window.location.search).get(mt.mp_debug);
1188
1282
  return o === "true" || o === "1";
1189
- }, ye = (o) => o.filter((n) => new URLSearchParams(window.location.search).has(n)).length > 0, Pe = (o = 8) => Bt(o), be = (o = 8) => Bt(o), Ce = (o = 8) => Bt(o), Yt = "abcdefghijklmnopqrstuvwxyz0123456789", Bt = (o = 8) => {
1283
+ }, _e = (o) => o.filter((n) => new URLSearchParams(window.location.search).has(n)).length > 0, Pe = (o = 8) => Bt(o), we = (o = 8) => Bt(o), Ce = (o = 8) => Bt(o), Yt = "abcdefghijklmnopqrstuvwxyz0123456789", Bt = (o = 8) => {
1190
1284
  for (var t = "", n = Yt.length, a = 0; a < o; a++)
1191
1285
  t += Yt.charAt(Math.floor(Math.random() * n));
1192
1286
  return t;
@@ -1198,12 +1292,12 @@ ${window.location.href}`), o;
1198
1292
  n && (d = `${d}; background: #${n}`), a = `%c${a}`, window.console.log(a, d);
1199
1293
  } else
1200
1294
  window.console.log(a);
1201
- }, oe = (o) => we(_e(o)), _e = (o) => {
1295
+ }, oe = (o) => Ie(ve(o)), ve = (o) => {
1202
1296
  var t = 0;
1203
1297
  for (let n = 0; n < o.length; n++)
1204
1298
  t = o.charCodeAt(n) + ((t << 5) - t);
1205
1299
  return t;
1206
- }, we = (o) => {
1300
+ }, Ie = (o) => {
1207
1301
  var t = (o & 16777215).toString(16).toUpperCase();
1208
1302
  return "00000".substring(0, 6 - t.length) + t;
1209
1303
  }, Ut = () => document.readyState == "complete" || document.readyState == "interactive", jt = async () => Ut() ? Promise.resolve() : new Promise((o) => {
@@ -1218,99 +1312,6 @@ ${window.location.href}`), o;
1218
1312
  !t && Ut() && (t = !0, o());
1219
1313
  }, 200);
1220
1314
  });
1221
- var ct = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", dt = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
1222
- for (var _t = 0; _t < ct.length; _t++)
1223
- dt[ct.charCodeAt(_t)] = _t;
1224
- var wt = function(o) {
1225
- var t = new Uint8Array(o), n, a = t.length, d = "";
1226
- for (n = 0; n < a; n += 3)
1227
- d += ct[t[n] >> 2], d += ct[(t[n] & 3) << 4 | t[n + 1] >> 4], d += ct[(t[n + 1] & 15) << 2 | t[n + 2] >> 6], d += ct[t[n + 2] & 63];
1228
- return a % 3 === 2 ? d = d.substring(0, d.length - 1) + "=" : a % 3 === 1 && (d = d.substring(0, d.length - 2) + "=="), d;
1229
- }, vt = function(o) {
1230
- var t = o.length * 0.75, n = o.length, a, d = 0, m, b, I, M;
1231
- o[o.length - 1] === "=" && (t--, o[o.length - 2] === "=" && t--);
1232
- var S = new ArrayBuffer(t), A = new Uint8Array(S);
1233
- for (a = 0; a < n; a += 4)
1234
- m = dt[o.charCodeAt(a)], b = dt[o.charCodeAt(a + 1)], I = dt[o.charCodeAt(a + 2)], M = dt[o.charCodeAt(a + 3)], A[d++] = m << 2 | b >> 4, A[d++] = (b & 15) << 4 | I >> 2, A[d++] = (I & 3) << 6 | M & 63;
1235
- return S;
1236
- };
1237
- const Mt = async (o) => {
1238
- for (const t of Object.keys(o)) {
1239
- const n = await ve(o[t]);
1240
- o[t] = n;
1241
- }
1242
- return o;
1243
- }, gt = async (o) => {
1244
- for (const t of Object.keys(o)) {
1245
- const n = await Ie(o[t]);
1246
- o[t] = n;
1247
- }
1248
- return o;
1249
- }, ve = async (o) => {
1250
- if (o instanceof Int8Array || o instanceof Uint8Array || o instanceof Uint8ClampedArray || o instanceof Int16Array || o instanceof Uint16Array || o instanceof Int32Array || o instanceof Uint32Array || o instanceof Float32Array || o instanceof Float64Array) {
1251
- const t = o, n = {
1252
- _s: !0,
1253
- _c: o.constructor.name,
1254
- value: wt(t.buffer),
1255
- byteLength: t.byteLength,
1256
- byteOffset: t.byteOffset,
1257
- size: t.byteLength
1258
- };
1259
- return Promise.resolve(n);
1260
- } else if (o instanceof File) {
1261
- const t = o, n = await t.arrayBuffer();
1262
- return {
1263
- _s: !0,
1264
- _c: File.name,
1265
- value: wt(n),
1266
- name: t.name,
1267
- fileType: t.type,
1268
- lastModified: t.lastModified,
1269
- size: n.byteLength
1270
- };
1271
- } else if (o instanceof Blob) {
1272
- const t = o, n = await t.arrayBuffer();
1273
- return {
1274
- _s: !0,
1275
- _c: Blob.name,
1276
- value: wt(n),
1277
- fileType: t.type,
1278
- size: n.byteLength
1279
- };
1280
- } else if (o instanceof ArrayBuffer) {
1281
- const t = o, n = {
1282
- _s: !0,
1283
- _c: ArrayBuffer.name,
1284
- value: wt(t),
1285
- size: t.byteLength
1286
- };
1287
- return Promise.resolve(n);
1288
- }
1289
- return Promise.resolve(o);
1290
- }, Ie = (o) => {
1291
- if (!(o && typeof o == "object" && o._s === !0))
1292
- return o;
1293
- const t = o, n = t._c;
1294
- if (n === Blob.name) {
1295
- const b = o;
1296
- return new Blob([vt(t.value)], {
1297
- type: b.fileType
1298
- });
1299
- } else if (n === File.name) {
1300
- const b = o;
1301
- return new File([vt(t.value)], b.name, {
1302
- type: b.fileType,
1303
- lastModified: b.lastModified
1304
- });
1305
- } else if (n === ArrayBuffer.name)
1306
- return vt(t.value);
1307
- const a = o, d = vt(a.value), m = a._c;
1308
- try {
1309
- return new globalThis[m](d);
1310
- } catch {
1311
- }
1312
- return o;
1313
- };
1314
1315
  class Ht extends Dt.EventEmitter {
1315
1316
  constructor(t, n, a, d, m, b = !1) {
1316
1317
  if (super(), this.inputs = {}, this.outputs = {}, this._disposables = [], this._rpcListeners = [], this._loaded = !1, this._onLoaded = [], this._sendInputsAfterRegistration = !1, this._plugin = !1, this._cachedEventInputsUpdate = {
@@ -1455,7 +1456,7 @@ Error: ${n}`);
1455
1456
  }
1456
1457
  }
1457
1458
  async sendInputs(t) {
1458
- t = await Mt(t), this.sendRpc(at.InputsUpdate, {
1459
+ t = await Ot(t), this.sendRpc(at.InputsUpdate, {
1459
1460
  inputs: t,
1460
1461
  parentId: this._parentId
1461
1462
  });
@@ -1527,9 +1528,9 @@ const Kt = () => ({
1527
1528
  outputs: {}
1528
1529
  }
1529
1530
  }), De = (o) => re(o), Ee = (o, t) => !t || t === "*" || o === t ? !0 : t.endsWith("*") ? o.startsWith(t.slice(0, -1)) : t.startsWith("*") ? o.endsWith(t.slice(1)) : !1, Se = "bcbcbc";
1530
- class tt extends de {
1531
+ class tt extends ge {
1531
1532
  constructor(t) {
1532
- super(), this._state = Kt(), this._metaframes = {}, this._plugins = {}, this._pluginOrder = [], this.debug = Ct(), this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = {}, this._inputMap = {}, this._id = t && t.id ? t.id : be(), this._consoleBackgroundColor = t && t.color ? t.color : Se, this.addPipe = this.addPipe.bind(this), this.dispose = this.dispose.bind(this), this.addMetaframe = this.addMetaframe.bind(this), this.addPlugin = this.addPlugin.bind(this), this.getInputsFromOutput = this.getInputsFromOutput.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframeIds = this.getMetaframeIds.bind(this), this.getMetaframeOrPlugin = this.getMetaframeOrPlugin.bind(this), this.getMetaframes = this.getMetaframes.bind(this), this.getPlugin = this.getPlugin.bind(this), this.getPluginIds = this.getPluginIds.bind(this), this.getState = this.getState.bind(this), this.getStateMetaframes = this.getStateMetaframes.bind(this), this.isValidJSONRpcMessage = this.isValidJSONRpcMessage.bind(this), this.log = this.log.bind(this), this.logInternal = this.logInternal.bind(this), this.metaframeIds = this.metaframeIds.bind(this), this.metaframes = this.metaframes.bind(this), this.onMessage = this.onMessage.bind(this), this.pluginIds = this.pluginIds.bind(this), this.plugins = this.plugins.bind(this), this.removeAll = this.removeAll.bind(this), this.removeMetaframe = this.removeMetaframe.bind(this), this.removePlugin = this.removePlugin.bind(this), this.setDebugFromUrlParams = this.setDebugFromUrlParams.bind(this), this.setDefinition = this.setDefinition.bind(this), this.setInput = this.setInput.bind(this), this.setInputs = this.setInputs.bind(this), this.setInputStateOnly = this.setInputStateOnly.bind(this), this.setMetaframeClientInputAndSentClientEvent = this.setMetaframeClientInputAndSentClientEvent.bind(this), this.setOutputStateOnly = this.setOutputStateOnly.bind(this), this.setState = this.setState.bind(this), this.isDisposed = this.isDisposed.bind(this), this.updatePluginsWithDefinition = this.updatePluginsWithDefinition.bind(this), this._emitDefinitionEvent = this._emitDefinitionEvent.bind(this), jt().then(() => {
1533
+ super(), this._state = Kt(), this._metaframes = {}, this._plugins = {}, this._pluginOrder = [], this.debug = Ct(), this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = {}, this._inputMap = {}, this._id = t && t.id ? t.id : we(), this._consoleBackgroundColor = t && t.color ? t.color : Se, this.addPipe = this.addPipe.bind(this), this.dispose = this.dispose.bind(this), this.addMetaframe = this.addMetaframe.bind(this), this.addPlugin = this.addPlugin.bind(this), this.getInputsFromOutput = this.getInputsFromOutput.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframeIds = this.getMetaframeIds.bind(this), this.getMetaframeOrPlugin = this.getMetaframeOrPlugin.bind(this), this.getMetaframes = this.getMetaframes.bind(this), this.getPlugin = this.getPlugin.bind(this), this.getPluginIds = this.getPluginIds.bind(this), this.getState = this.getState.bind(this), this.getStateMetaframes = this.getStateMetaframes.bind(this), this.isValidJSONRpcMessage = this.isValidJSONRpcMessage.bind(this), this.log = this.log.bind(this), this.logInternal = this.logInternal.bind(this), this.metaframeIds = this.metaframeIds.bind(this), this.metaframes = this.metaframes.bind(this), this.onMessage = this.onMessage.bind(this), this.pluginIds = this.pluginIds.bind(this), this.plugins = this.plugins.bind(this), this.removeAll = this.removeAll.bind(this), this.removeMetaframe = this.removeMetaframe.bind(this), this.removePlugin = this.removePlugin.bind(this), this.setDebugFromUrlParams = this.setDebugFromUrlParams.bind(this), this.setDefinition = this.setDefinition.bind(this), this.setInput = this.setInput.bind(this), this.setInputs = this.setInputs.bind(this), this.setInputStateOnly = this.setInputStateOnly.bind(this), this.setMetaframeClientInputAndSentClientEvent = this.setMetaframeClientInputAndSentClientEvent.bind(this), this.setOutputStateOnly = this.setOutputStateOnly.bind(this), this.setState = this.setState.bind(this), this.isDisposed = this.isDisposed.bind(this), this.updatePluginsWithDefinition = this.updatePluginsWithDefinition.bind(this), this._emitDefinitionEvent = this._emitDefinitionEvent.bind(this), jt().then(() => {
1533
1534
  this.isDisposed() || (window.addEventListener("message", this.onMessage), this.log("Initialized"));
1534
1535
  });
1535
1536
  }
@@ -1554,7 +1555,7 @@ class tt extends de {
1554
1555
  };
1555
1556
  }
1556
1557
  setDebugFromUrlParams() {
1557
- return this.debug = ye(["MP_DEBUG", "DEBUG", "debug", "mp_debug"]), this;
1558
+ return this.debug = _e(["MP_DEBUG", "DEBUG", "debug", "mp_debug"]), this;
1558
1559
  }
1559
1560
  getState() {
1560
1561
  return this._state;
@@ -1648,10 +1649,10 @@ class tt extends de {
1648
1649
  return this._pluginOrder.slice(0);
1649
1650
  }
1650
1651
  getMetaframe(t) {
1651
- return this._metaframes[t];
1652
+ return this?._metaframes[t];
1652
1653
  }
1653
1654
  getPlugin(t) {
1654
- return this._plugins[t];
1655
+ return this?._plugins?.[t];
1655
1656
  }
1656
1657
  addMetaframe(t, n) {
1657
1658
  if (!t)
@@ -1885,7 +1886,7 @@ tt.MESSAGE = N.Message;
1885
1886
  tt.OUTPUTS = N.Outputs;
1886
1887
  tt.STATE = N.State;
1887
1888
  tt.deserializeInputs = gt;
1888
- tt.serializeInputs = Mt;
1889
+ tt.serializeInputs = Ot;
1889
1890
  const Oe = async (o, t) => {
1890
1891
  try {
1891
1892
  const d = await t.getDefinition();
@@ -1929,7 +1930,7 @@ var G;
1929
1930
  })(G || (G = {}));
1930
1931
  class nt extends Dt.EventEmitter {
1931
1932
  constructor(t) {
1932
- if (super(), this._inputPipeValues = {}, this._outputPipeValues = {}, this._state = ut.WaitingForPageLoad, this._messageSendCount = 0, this.debug = Ct(), this.isInputOutputBlobSerialization = !0, this.id = window.name, this.debug = Ct(), this._isIframe = ce(), this.addListener = this.addListener.bind(this), this.dispose = this.dispose.bind(this), this.error = this.error.bind(this), this.getInput = this.getInput.bind(this), this.getInputs = this.getInputs.bind(this), this.log = this.log.bind(this), this.logInternal = this.logInternal.bind(this), this.onInput = this.onInput.bind(this), this.onInputs = this.onInputs.bind(this), this.onMessage = this.onMessage.bind(this), this.sendRpc = this.sendRpc.bind(this), this.setInput = this.setInput.bind(this), this.setInputs = this.setInputs.bind(this), this.setInternalInputsAndNotify = this.setInternalInputsAndNotify.bind(this), this.setOutput = this.setOutput.bind(this), this.setOutputs = this.setOutputs.bind(this), this.warn = this.warn.bind(this), this._resolveSetupIframeServerResponse = this._resolveSetupIframeServerResponse.bind(this), this.addListenerReturnDisposer = this.addListenerReturnDisposer.bind(this), this.connected = this.connected.bind(this), this.disableNotifyOnHashUrlChange = this.disableNotifyOnHashUrlChange.bind(this), this._onHashUrlChange = this._onHashUrlChange.bind(this), !this._isIframe) {
1933
+ if (super(), this._inputPipeValues = {}, this._outputPipeValues = {}, this._state = ut.WaitingForPageLoad, this._messageSendCount = 0, this.debug = Ct(), this.isInputOutputBlobSerialization = !0, this.id = window.name, this.debug = Ct(), this._isIframe = pe(), this.addListener = this.addListener.bind(this), this.dispose = this.dispose.bind(this), this.error = this.error.bind(this), this.getInput = this.getInput.bind(this), this.getInputs = this.getInputs.bind(this), this.log = this.log.bind(this), this.logInternal = this.logInternal.bind(this), this.onInput = this.onInput.bind(this), this.onInputs = this.onInputs.bind(this), this.onMessage = this.onMessage.bind(this), this.sendRpc = this.sendRpc.bind(this), this.setInput = this.setInput.bind(this), this.setInputs = this.setInputs.bind(this), this.setInternalInputsAndNotify = this.setInternalInputsAndNotify.bind(this), this.setOutput = this.setOutput.bind(this), this.setOutputs = this.setOutputs.bind(this), this.warn = this.warn.bind(this), this._resolveSetupIframeServerResponse = this._resolveSetupIframeServerResponse.bind(this), this.addListenerReturnDisposer = this.addListenerReturnDisposer.bind(this), this.connected = this.connected.bind(this), this.disableNotifyOnHashUrlChange = this.disableNotifyOnHashUrlChange.bind(this), this._onHashUrlChange = this._onHashUrlChange.bind(this), !this._isIframe) {
1933
1934
  this.log("Not an iframe, metaframe code disabled");
1934
1935
  return;
1935
1936
  }
@@ -2012,7 +2013,7 @@ class nt extends Dt.EventEmitter {
2012
2013
  a[t] = n, this.setOutputs(a);
2013
2014
  }
2014
2015
  async setOutputs(t) {
2015
- this.isInputOutputBlobSerialization && (t = await Mt(t)), St(this._outputPipeValues, t) && this.sendRpc(X.OutputsUpdate, t);
2016
+ this.isInputOutputBlobSerialization && (t = await Ot(t)), St(this._outputPipeValues, t) && this.sendRpc(X.OutputsUpdate, t);
2016
2017
  }
2017
2018
  disableNotifyOnHashUrlChange() {
2018
2019
  window.removeEventListener("hashchange", this._onHashUrlChange);
@@ -2075,7 +2076,7 @@ nt.INPUT = G.Input;
2075
2076
  nt.INPUTS = G.Inputs;
2076
2077
  nt.MESSAGE = G.Message;
2077
2078
  nt.deserializeInputs = gt;
2078
- nt.serializeInputs = Mt;
2079
+ nt.serializeInputs = Ot;
2079
2080
  class Ae {
2080
2081
  constructor(t) {
2081
2082
  this._metaframe = t, this.requestState = this.requestState.bind(this), this.onState = this.onState.bind(this), this.getState = this.getState.bind(this), this.setState = this.setState.bind(this), this.onDefinition = this.onDefinition.bind(this), this.getDefinition = this.getDefinition.bind(this), this.setDefinition = this.setDefinition.bind(this);
@@ -2123,7 +2124,7 @@ export {
2123
2124
  N as MetapageEvents,
2124
2125
  mt as MetapageHashParams,
2125
2126
  Ht as MetapageIFrameRpcClient,
2126
- de as MetapageShared,
2127
+ ge as MetapageShared,
2127
2128
  pt as MetapageVersionCurrent,
2128
2129
  zt as MetapageVersionsAll,
2129
2130
  it as VersionsMetaframe,
@@ -2131,27 +2132,27 @@ export {
2131
2132
  se as convertMetaframeJsonToCurrentVersion,
2132
2133
  ie as convertMetapageDefinitionToCurrentVersion,
2133
2134
  gt as deserializeInputs,
2134
- ye as existsAnyUrlParam,
2135
+ _e as existsAnyUrlParam,
2135
2136
  Bt as generateId,
2136
2137
  Pe as generateMetaframeId,
2137
- be as generateMetapageId,
2138
+ we as generateMetapageId,
2138
2139
  Ce as generateNonce,
2139
2140
  De as getLibraryVersionMatching,
2140
2141
  re as getMatchingVersion,
2141
2142
  Ue as getUrlParam,
2142
2143
  ke as getUrlParamDebug,
2143
- _e as hashCode,
2144
- we as intToRGB,
2144
+ ve as hashCode,
2145
+ Ie as intToRGB,
2145
2146
  Ct as isDebugFromUrlsParams,
2146
- ce as isIframe,
2147
+ pe as isIframe,
2147
2148
  Ut as isPageLoaded,
2148
2149
  Rt as log,
2149
2150
  Ee as matchPipe,
2150
2151
  St as merge,
2151
2152
  jt as pageLoaded,
2152
- Ie as possiblyDeserializeDatarefToValue,
2153
- ve as possiblySerializeValueToDataref,
2154
- Mt as serializeInputs,
2153
+ fe as possiblyDeserializeDatarefToValue,
2154
+ ue as possiblySerializeValueToDataref,
2155
+ Ot as serializeInputs,
2155
2156
  oe as stringToRgb
2156
2157
  };
2157
2158
  //# sourceMappingURL=index.mjs.map