@metapages/metapage 1.10.6 → 1.10.7

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/README.md CHANGED
@@ -36,7 +36,7 @@ import {
36
36
  renderMetapage,
37
37
  Metapage,
38
38
  Metaframe,
39
- } from "https://cdn.jsdelivr.net/npm/@metapages/metapage@1.10.6";
39
+ } from "https://cdn.jsdelivr.net/npm/@metapages/metapage@1.10.7";
40
40
  ```
41
41
 
42
42
  ## Quick Start
@@ -82,7 +82,7 @@ The `renderMetapage` function the `react-grid-layout` layout in `metapage.json`:
82
82
  If you're building a component to use in a metapage:
83
83
 
84
84
  ```javascript
85
- import { Metaframe } from "https://cdn.jsdelivr.net/npm/@metapages/metapage@1.10.6";
85
+ import { Metaframe } from "https://cdn.jsdelivr.net/npm/@metapages/metapage@1.10.7";
86
86
 
87
87
  const metaframe = new Metaframe();
88
88
 
@@ -223,7 +223,7 @@ metaframe.onInput("file", (file) => {
223
223
  <div id="metapage-container"></div>
224
224
 
225
225
  <script type="module">
226
- import { renderMetapage } from "https://cdn.jsdelivr.net/npm/@metapages/metapage@1.10.6";
226
+ import { renderMetapage } from "https://cdn.jsdelivr.net/npm/@metapages/metapage@1.10.7";
227
227
 
228
228
  const definition = await fetch(
229
229
  "https://metapage.io/m/87ae11673508447e883b598bf7da9c5d/metapage.json",
@@ -258,7 +258,7 @@ metaframe.onInput("file", (file) => {
258
258
  ### Building a Metaframe Component
259
259
 
260
260
  ```javascript
261
- import { Metaframe } from "https://cdn.jsdelivr.net/npm/@metapages/metapage@1.10.6";
261
+ import { Metaframe } from "https://cdn.jsdelivr.net/npm/@metapages/metapage@1.10.7";
262
262
 
263
263
  const metaframe = new Metaframe();
264
264
 
@@ -335,7 +335,7 @@ Metaframes can read and write to their URL hash parameters:
335
335
  import {
336
336
  getHashParamValueJsonFromWindow,
337
337
  setHashParamValueJsonInWindow,
338
- } from "https://cdn.jsdelivr.net/npm/@metapages/metapage@1.10.6";
338
+ } from "https://cdn.jsdelivr.net/npm/@metapages/metapage@1.10.7";
339
339
 
340
340
  // Read from URL hash
341
341
  const config = getHashParamValueJsonFromWindow("config");
@@ -621,7 +621,7 @@ Example minimal metaframe:
621
621
  </head>
622
622
  <body>
623
623
  <script type="module">
624
- import { Metaframe } from "https://cdn.jsdelivr.net/npm/@metapages/metapage@1.10.6";
624
+ import { Metaframe } from "https://cdn.jsdelivr.net/npm/@metapages/metapage@1.10.7";
625
625
 
626
626
  const metaframe = new Metaframe();
627
627
 
@@ -645,7 +645,7 @@ import {
645
645
  MetapageDefinition,
646
646
  MetaframeInputMap,
647
647
  MetapageInstanceInputs,
648
- } from "https://cdn.jsdelivr.net/npm/@metapages/metapage@1.10.6";
648
+ } from "https://cdn.jsdelivr.net/npm/@metapages/metapage@1.10.7";
649
649
 
650
650
  const definition: MetapageDefinition = {
651
651
  metaframes: {
package/dist/index.js CHANGED
@@ -1017,7 +1017,7 @@ const Bn = (t) => {
1017
1017
  throw je(T(M)), O;
1018
1018
  }) : P(E);
1019
1019
  };
1020
- }, C = Bn();
1020
+ }, I = Bn();
1021
1021
  Object.prototype.constructor.toString();
1022
1022
  const Vs = (t) => {
1023
1023
  var s, n, i;
@@ -1040,7 +1040,7 @@ const Vs = (t) => {
1040
1040
  throw "Metapage definition null";
1041
1041
  if (!t.version) {
1042
1042
  const n = Vs(t);
1043
- t = C(t, (i) => {
1043
+ t = I(t, (i) => {
1044
1044
  i.version = n;
1045
1045
  });
1046
1046
  }
@@ -1067,7 +1067,7 @@ const Vs = (t) => {
1067
1067
  throw "Metapage definition null";
1068
1068
  if (!t.version) {
1069
1069
  const i = Vs(t);
1070
- t = C(t, (o) => {
1070
+ t = I(t, (o) => {
1071
1071
  o.version = i;
1072
1072
  });
1073
1073
  }
@@ -1102,17 +1102,17 @@ const Vs = (t) => {
1102
1102
  throw `Unknow version ${s} to ${e}`;
1103
1103
  }
1104
1104
  return n;
1105
- }, Wn = (t) => C(t, (e) => {
1105
+ }, Wn = (t) => I(t, (e) => {
1106
1106
  e.version = "0.3";
1107
- }), Gn = (t) => C(t, (e) => {
1107
+ }), Gn = (t) => I(t, (e) => {
1108
1108
  e.version = "0.2";
1109
- }), Jn = (t) => C(t, (e) => {
1109
+ }), Jn = (t) => I(t, (e) => {
1110
1110
  const s = e;
1111
1111
  delete s.plugins, s.version = "1";
1112
- }), Qn = (t) => C(t, (e) => (e.version = "0.3", e)), Kn = (t) => C(t, (e) => {
1112
+ }), Qn = (t) => I(t, (e) => (e.version = "0.3", e)), Kn = (t) => I(t, (e) => {
1113
1113
  var s, n;
1114
1114
  return e.version = "1", (s = e == null ? void 0 : e.meta) != null && s.tags && (e.meta.keywords = e.meta.tags, delete e.meta.tags), (n = e == null ? void 0 : e.meta) != null && n.authors && (e.meta.author = e.meta.authors[0], delete e.meta.authors), e;
1115
- }), Xn = (t) => C(t, (e) => {
1115
+ }), Xn = (t) => I(t, (e) => {
1116
1116
  var s, n;
1117
1117
  return e.version = "2", (s = e == null ? void 0 : e.meta) != null && s.keywords && (e.meta.tags = e.meta.keywords, delete e.meta.keywords), (n = e == null ? void 0 : e.meta) != null && n.author && (e.meta.authors = [e.meta.author], delete e.meta.author), e;
1118
1118
  }), wt = (t) => {
@@ -1146,7 +1146,7 @@ const Vs = (t) => {
1146
1146
  throw "Metaframe definition null";
1147
1147
  if (!t.version) {
1148
1148
  const n = Ws(t);
1149
- t = C(t, (i) => {
1149
+ t = I(t, (i) => {
1150
1150
  i.version = n;
1151
1151
  });
1152
1152
  }
@@ -1173,7 +1173,7 @@ const Vs = (t) => {
1173
1173
  throw "Metaframe definition null";
1174
1174
  if (!t.version) {
1175
1175
  const i = Ws(t);
1176
- t = C(t, (o) => {
1176
+ t = I(t, (o) => {
1177
1177
  o.version = i;
1178
1178
  });
1179
1179
  }
@@ -1221,11 +1221,11 @@ const Vs = (t) => {
1221
1221
  return;
1222
1222
  const s = await Zn(t);
1223
1223
  return s != null && s.hashParams && (s.hashParams = Yn(s.hashParams)), s;
1224
- }, ei = (t) => C(t, (e) => {
1224
+ }, ei = (t) => I(t, (e) => {
1225
1225
  e.version = "0.3", delete e.allow;
1226
- }), si = (t) => C(t, (e) => {
1226
+ }), si = (t) => I(t, (e) => {
1227
1227
  e.version = "0.4";
1228
- }), ni = (t) => C(t, (e) => {
1228
+ }), ni = (t) => I(t, (e) => {
1229
1229
  if (e.version = "0.5", !(e != null && e.metadata))
1230
1230
  return;
1231
1231
  const s = e.metadata.title;
@@ -1234,7 +1234,7 @@ const Vs = (t) => {
1234
1234
  delete e.metadata.descriptionUrl, e.metadata.description = n;
1235
1235
  const i = e.metadata.keywords;
1236
1236
  delete e.metadata.keywords, e.metadata.tags = i;
1237
- }), ii = (t) => C(t, (e) => {
1237
+ }), ii = (t) => I(t, (e) => {
1238
1238
  if (e.version = "0.4", !(e != null && e.metadata))
1239
1239
  return;
1240
1240
  const s = e.metadata.name;
@@ -1243,24 +1243,24 @@ const Vs = (t) => {
1243
1243
  delete e.metadata.description, e.metadata.descriptionUrl = n;
1244
1244
  const i = e.metadata.tags;
1245
1245
  delete e.metadata.tags, e.metadata.keywords = i;
1246
- }), ri = (t) => C(t, (e) => {
1246
+ }), ri = (t) => I(t, (e) => {
1247
1247
  var s;
1248
1248
  e.version = "1", (s = e == null ? void 0 : e.metadata) != null && s.operations && delete e.metadata.operations;
1249
- }), oi = (t) => C(t, (e) => {
1249
+ }), oi = (t) => I(t, (e) => {
1250
1250
  var s;
1251
1251
  e.version = "0.6", (s = e == null ? void 0 : e.metadata) != null && s.operations && delete e.metadata.operations;
1252
- }), ai = (t) => C(t, (e) => {
1252
+ }), ai = (t) => I(t, (e) => {
1253
1253
  var s, n;
1254
1254
  return e.version = "1", (s = e == null ? void 0 : e.metadata) != null && s.authors && (e.metadata.author = (n = e == null ? void 0 : e.metadata) == null ? void 0 : n.authors[0], delete e.metadata.authors), e;
1255
- }), ui = (t) => C(t, (e) => {
1255
+ }), ui = (t) => I(t, (e) => {
1256
1256
  var s;
1257
1257
  return e.version = "2", (s = e == null ? void 0 : e.metadata) != null && s.author && (e.metadata.authors = [
1258
1258
  e.metadata.author
1259
1259
  ], delete e.metadata.author), e;
1260
- }), ci = (t) => C(t, (e) => {
1260
+ }), ci = (t) => I(t, (e) => {
1261
1261
  var s;
1262
1262
  e.version = "0.6", (s = e == null ? void 0 : e.metadata) != null && s.operations && delete e.metadata.operations;
1263
- }), li = (t) => C(t, (e) => {
1263
+ }), li = (t) => I(t, (e) => {
1264
1264
  var s;
1265
1265
  e.version = "0.5", (s = e == null ? void 0 : e.metadata) != null && s.operations && delete e.metadata.operations;
1266
1266
  }), ot = (t) => {
@@ -2175,10 +2175,10 @@ function Li(t) {
2175
2175
  }
2176
2176
  return t;
2177
2177
  }
2178
- var I;
2178
+ var C;
2179
2179
  (function(t) {
2180
2180
  t.Inputs = "inputs", t.Outputs = "outputs", t.State = "state", t.Definition = "definition", t.DefinitionUpdate = "definitionupdate", t.Error = "error", t.Warning = "warning", t.UrlHashUpdate = "urlhashupdate", t.Message = "Message";
2181
- })(I || (I = {}));
2181
+ })(C || (C = {}));
2182
2182
  var q;
2183
2183
  (function(t) {
2184
2184
  t.InputsUpdate = "InputsUpdate", t.OutputsUpdate = "OutputsUpdate", t.SetupIframeClientRequest = "SetupIframeClientRequest", t.SetupIframeServerResponseAck = "SetupIframeServerResponseAck", t.HashParamsUpdate = "HashParamsUpdate";
@@ -2520,7 +2520,7 @@ class rr extends os.EventEmitter {
2520
2520
  return this._definition;
2521
2521
  }
2522
2522
  }
2523
- const de = (t, e) => e ? C(t, (s) => {
2523
+ const de = (t, e) => e ? I(t, (s) => {
2524
2524
  Object.keys(e).forEach((n) => {
2525
2525
  e[n] === void 0 ? delete s[n] : s[n] = e[n];
2526
2526
  });
@@ -3793,7 +3793,7 @@ class zr extends os.EventEmitter {
3793
3793
  return this._definition = s, this._definition;
3794
3794
  } catch (s) {
3795
3795
  var e = this.getDefinitionUrl();
3796
- this.emit(I.Warning, `Failed to fetch or convert: ${e}
3796
+ this.emit(C.Warning, `Failed to fetch or convert: ${e}
3797
3797
  Error: ${s != null && s.message ? s == null ? void 0 : s.message : s == null ? void 0 : s.toString()}`);
3798
3798
  }
3799
3799
  }
@@ -3807,9 +3807,9 @@ Error: ${s != null && s.message ? s == null ? void 0 : s.message : s == null ? v
3807
3807
  const s = e;
3808
3808
  if (this.inputs = de(this.inputs, e), this.inputs === s)
3809
3809
  return this;
3810
- if (this._loaded || (this._sendInputsAfterRegistration = !0), this._iframe.parentNode && this._loaded && this.sendInputs(e), this.emit(I.Inputs, this.inputs), this._metapage.listenerCount(I.Inputs) > 0) {
3810
+ if (this._loaded || (this._sendInputsAfterRegistration = !0), this._iframe.parentNode && this._loaded && this.sendInputs(e), this.emit(C.Inputs, this.inputs), this._metapage.listenerCount(C.Inputs) > 0) {
3811
3811
  var n = {};
3812
- n[this.id] = e, this._metapage.emit(I.Inputs, n);
3812
+ n[this.id] = e, this._metapage.emit(C.Inputs, n);
3813
3813
  }
3814
3814
  return this;
3815
3815
  }
@@ -3822,28 +3822,28 @@ Error: ${s != null && s.message ? s == null ? void 0 : s.message : s == null ? v
3822
3822
  const s = e;
3823
3823
  if (this.outputs = de(this.outputs, e), this.outputs === s)
3824
3824
  return this;
3825
- if (this.emit(I.Outputs, e), this._metapage.listenerCount(I.Outputs) > 0) {
3825
+ if (this.emit(C.Outputs, e), this._metapage.listenerCount(C.Outputs) > 0) {
3826
3826
  var n = {};
3827
- n[this.id] = e, this._metapage.emit(I.Outputs, n);
3827
+ n[this.id] = e, this._metapage.emit(C.Outputs, n);
3828
3828
  }
3829
3829
  }
3830
3830
  onInputs(e) {
3831
- return this.addListenerReturnDisposer(I.Inputs, e);
3831
+ return this.addListenerReturnDisposer(C.Inputs, e);
3832
3832
  }
3833
3833
  onInput(e, s) {
3834
3834
  var n = function(i) {
3835
3835
  i.hasOwnProperty(e) && s(i[e]);
3836
3836
  };
3837
- return this.addListenerReturnDisposer(I.Inputs, n);
3837
+ return this.addListenerReturnDisposer(C.Inputs, n);
3838
3838
  }
3839
3839
  onOutputs(e) {
3840
- return this.addListenerReturnDisposer(I.Outputs, e);
3840
+ return this.addListenerReturnDisposer(C.Outputs, e);
3841
3841
  }
3842
3842
  onOutput(e, s) {
3843
3843
  var n = function(i) {
3844
3844
  i.hasOwnProperty(e) && s(i[e]);
3845
3845
  };
3846
- return this.addListenerReturnDisposer(I.Outputs, n);
3846
+ return this.addListenerReturnDisposer(C.Outputs, n);
3847
3847
  }
3848
3848
  isDisposed() {
3849
3849
  return this.inputs === void 0;
@@ -3934,7 +3934,7 @@ Error: ${s != null && s.message ? s == null ? void 0 : s.message : s == null ? v
3934
3934
  }
3935
3935
  }
3936
3936
  }
3937
- const vt = C({
3937
+ const vt = I({
3938
3938
  metaframes: {
3939
3939
  inputs: {},
3940
3940
  outputs: {}
@@ -3954,7 +3954,7 @@ class nt extends rr {
3954
3954
  return n.debug = (s == null ? void 0 : s.debug) || !1, n.setDefinition(e);
3955
3955
  }
3956
3956
  constructor(e) {
3957
- super(), this._state = vt, this._metaframes = C({}, (s) => s), this.debug = Fe(), this._originalSecretHashParams = {}, this._originalSecretQueryParams = {}, this._injectedSecrets = {}, this._injectedQuerySecrets = {}, this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = C({}, (s) => s), this._inputMap = {}, this._id = e && e.id ? e.id : or(), this._consoleBackgroundColor = e && e.color ? e.color : Vr, this.addPipe = this.addPipe.bind(this), this.dispose = this.dispose.bind(this), this.addMetaframe = this.addMetaframe.bind(this), this.getInputsFromOutput = this.getInputsFromOutput.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframeIds = this.getMetaframeIds.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframes = this.getMetaframes.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.onMessageJsonRpc = this.onMessageJsonRpc.bind(this), this.removeAll = this.removeAll.bind(this), this.removeMetaframe = this.removeMetaframe.bind(this), this.setDebugFromUrlParams = this.setDebugFromUrlParams.bind(this), this.setDefinition = this.setDefinition.bind(this), this.updateDefinition = this.updateDefinition.bind(this), this.setInput = this.setInput.bind(this), this.setInputs = this.setInputs.bind(this), this.setOutputs = this.setOutputs.bind(this), this.onInputs = this.onInputs.bind(this), this.onOutputs = this.onOutputs.bind(this), this.onState = this.onState.bind(this), this.setMetaframeOutputs = this.setMetaframeOutputs.bind(this), this.setInputStateOnlyMetaframeInputValue = this.setInputStateOnlyMetaframeInputValue.bind(this), this.setInputStateOnlyMetaframeInputMap = this.setInputStateOnlyMetaframeInputMap.bind(this), this.setInputStateOnlyMetapageInstanceInputs = this.setInputStateOnlyMetapageInstanceInputs.bind(this), this.setOutputStateOnlyMetaframeInputValue = this.setOutputStateOnlyMetaframeInputValue.bind(this), this.setOutputStateOnlyMetaframeInputMap = this.setOutputStateOnlyMetaframeInputMap.bind(this), this.setOutputStateOnlyMetapageInstanceInputs = this.setOutputStateOnlyMetapageInstanceInputs.bind(this), this.setMetadata = this.setMetadata.bind(this), this.setMetaframeClientInputAndSentClientEvent = this.setMetaframeClientInputAndSentClientEvent.bind(this), this.setState = this.setState.bind(this), this.isDisposed = this.isDisposed.bind(this), this._emitDefinitionEvent = this._emitDefinitionEvent.bind(this), this._emitDefinitionUpdateEvent = this._emitDefinitionUpdateEvent.bind(this), ve().then(() => {
3957
+ super(), this._state = vt, this._metaframes = I({}, (s) => s), this.debug = Fe(), this._originalSecretHashParams = {}, this._originalSecretQueryParams = {}, this._injectedSecrets = {}, this._injectedQuerySecrets = {}, this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = I({}, (s) => s), this._inputMap = {}, this._id = e && e.id ? e.id : or(), this._consoleBackgroundColor = e && e.color ? e.color : Vr, this.addPipe = this.addPipe.bind(this), this.dispose = this.dispose.bind(this), this.addMetaframe = this.addMetaframe.bind(this), this.getInputsFromOutput = this.getInputsFromOutput.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframeIds = this.getMetaframeIds.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframes = this.getMetaframes.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.onMessageJsonRpc = this.onMessageJsonRpc.bind(this), this.removeAll = this.removeAll.bind(this), this.removeMetaframe = this.removeMetaframe.bind(this), this.setDebugFromUrlParams = this.setDebugFromUrlParams.bind(this), this.setDefinition = this.setDefinition.bind(this), this.updateDefinition = this.updateDefinition.bind(this), this.setInput = this.setInput.bind(this), this.setInputs = this.setInputs.bind(this), this.setOutputs = this.setOutputs.bind(this), this.onInputs = this.onInputs.bind(this), this.onOutputs = this.onOutputs.bind(this), this.onState = this.onState.bind(this), this.setMetaframeOutputs = this.setMetaframeOutputs.bind(this), this.setInputStateOnlyMetaframeInputValue = this.setInputStateOnlyMetaframeInputValue.bind(this), this.setInputStateOnlyMetaframeInputMap = this.setInputStateOnlyMetaframeInputMap.bind(this), this.setInputStateOnlyMetapageInstanceInputs = this.setInputStateOnlyMetapageInstanceInputs.bind(this), this.setOutputStateOnlyMetaframeInputValue = this.setOutputStateOnlyMetaframeInputValue.bind(this), this.setOutputStateOnlyMetaframeInputMap = this.setOutputStateOnlyMetaframeInputMap.bind(this), this.setOutputStateOnlyMetapageInstanceInputs = this.setOutputStateOnlyMetapageInstanceInputs.bind(this), this.setMetadata = this.setMetadata.bind(this), this.setMetaframeClientInputAndSentClientEvent = this.setMetaframeClientInputAndSentClientEvent.bind(this), this.setState = this.setState.bind(this), this.isDisposed = this.isDisposed.bind(this), this._emitDefinitionEvent = this._emitDefinitionEvent.bind(this), this._emitDefinitionUpdateEvent = this._emitDefinitionUpdateEvent.bind(this), ve().then(() => {
3958
3958
  this.isDisposed() || (window.addEventListener("message", this.onMessage), this.log("Initialized"));
3959
3959
  });
3960
3960
  }
@@ -3967,13 +3967,13 @@ class nt extends rr {
3967
3967
  };
3968
3968
  }
3969
3969
  onInputs(e) {
3970
- return this.addListenerReturnDisposer(I.Inputs, e);
3970
+ return this.addListenerReturnDisposer(C.Inputs, e);
3971
3971
  }
3972
3972
  onOutputs(e) {
3973
- return this.addListenerReturnDisposer(I.Outputs, e);
3973
+ return this.addListenerReturnDisposer(C.Outputs, e);
3974
3974
  }
3975
3975
  onState(e) {
3976
- return this.addListenerReturnDisposer(I.State, e);
3976
+ return this.addListenerReturnDisposer(C.State, e);
3977
3977
  }
3978
3978
  setDebugFromUrlParams() {
3979
3979
  const e = new URL(window.location.href);
@@ -3983,10 +3983,10 @@ class nt extends rr {
3983
3983
  return this._state;
3984
3984
  }
3985
3985
  setState(e) {
3986
- this._state = C(e, (s) => s), this.getMetaframeIds().forEach((s) => {
3986
+ this._state = I(e, (s) => s), this.getMetaframeIds().forEach((s) => {
3987
3987
  var n, i;
3988
3988
  (n = this.getMetaframe(s)) == null || n.setInputs(this._state.metaframes.inputs[s]), (i = this.getMetaframe(s)) == null || i.setOutputs(this._state.metaframes.outputs[s]);
3989
- }), this.listenerCount(I.State) > 0 && vt !== this._state && this.emit(I.State, this._state);
3989
+ }), this.listenerCount(C.State) > 0 && vt !== this._state && this.emit(C.State, this._state);
3990
3990
  }
3991
3991
  getStateMetaframes() {
3992
3992
  return this._state.metaframes;
@@ -4025,13 +4025,13 @@ class nt extends rr {
4025
4025
  }), Object.entries(this._injectedQuerySecrets[s]).forEach(([c, l]) => {
4026
4026
  const f = btoa(encodeURIComponent(l));
4027
4027
  r.searchParams.set(c, f);
4028
- }), i.url = r.href, (u = (a = this._definition) == null ? void 0 : a.metaframes) != null && u[s] && (this._definition = C(this._definition, (c) => {
4028
+ }), i.url = r.href, (u = (a = this._definition) == null ? void 0 : a.metaframes) != null && u[s] && (this._definition = I(this._definition, (c) => {
4029
4029
  c.metaframes[s].url = r.href;
4030
4030
  }));
4031
4031
  });
4032
4032
  }
4033
4033
  _getDefinitionWithoutSecrets() {
4034
- return Object.keys(this._injectedSecrets).length === 0 && Object.keys(this._injectedQuerySecrets).length === 0 ? this._definition : C(this._definition, (e) => {
4034
+ return Object.keys(this._injectedSecrets).length === 0 && Object.keys(this._injectedQuerySecrets).length === 0 ? this._definition : I(this._definition, (e) => {
4035
4035
  (/* @__PURE__ */ new Set([
4036
4036
  ...Object.keys(this._injectedSecrets),
4037
4037
  ...Object.keys(this._injectedQuerySecrets)
@@ -4085,14 +4085,22 @@ class nt extends rr {
4085
4085
  (!n.metaframes || !n.metaframes[f]) && (u[f] = this._metaframes[f]);
4086
4086
  }), Object.keys(u).forEach((f) => {
4087
4087
  this.removeMetaframe(f);
4088
- }), s && (this._state = C(s, (f) => f));
4088
+ }), s && (this._state = I(s, (f) => f));
4089
4089
  const c = {};
4090
4090
  return n.metaframes && Object.keys(n.metaframes).forEach((f) => {
4091
4091
  if (!this._metaframes.hasOwnProperty(f)) {
4092
4092
  const p = n.metaframes[f], g = this.addMetaframe(f, p);
4093
4093
  c[f] = g;
4094
4094
  }
4095
- }), (/* @__PURE__ */ new Set([
4095
+ }), n.metaframes && (Object.keys(n.metaframes).forEach((f) => {
4096
+ if (c[f])
4097
+ return;
4098
+ this._inputMap = I(this._inputMap, (g) => {
4099
+ delete g[f];
4100
+ });
4101
+ const p = n.metaframes[f];
4102
+ p.inputs && p.inputs.forEach((g) => this.addPipe(f, g));
4103
+ }), this._cachedInputLookupMap = I({}, (f) => f)), (/* @__PURE__ */ new Set([
4096
4104
  ...Object.keys(i),
4097
4105
  ...Object.keys(o)
4098
4106
  ])).forEach((f) => {
@@ -4121,7 +4129,7 @@ class nt extends rr {
4121
4129
  }), Object.entries(w).forEach(([$, D]) => {
4122
4130
  const b = btoa(encodeURIComponent(D));
4123
4131
  O.searchParams.set($, b);
4124
- }), E.url = O.href, (v = (_ = this._definition) == null ? void 0 : _.metaframes) != null && v[f] && (this._definition = C(this._definition, ($) => {
4132
+ }), E.url = O.href, (v = (_ = this._definition) == null ? void 0 : _.metaframes) != null && v[f] && (this._definition = I(this._definition, ($) => {
4125
4133
  $.metaframes[f].url = O.href;
4126
4134
  }));
4127
4135
  }
@@ -4130,7 +4138,7 @@ class nt extends rr {
4130
4138
  async setDefinition(e, s) {
4131
4139
  const n = this._definition, { newDefinition: i } = await this._applyDefinition(e, s);
4132
4140
  return this.isDisposed() ? this : (n !== ln && window.setTimeout(() => {
4133
- !this.isDisposed() && i === this._definition && (this._emitDefinitionEvent(), s && this.listenerCount(I.State) > 0 && vt !== this._state && this.emit(I.State, this._state));
4141
+ !this.isDisposed() && i === this._definition && (this._emitDefinitionEvent(), s && this.listenerCount(C.State) > 0 && vt !== this._state && this.emit(C.State, this._state));
4134
4142
  }, 0), this);
4135
4143
  }
4136
4144
  async updateDefinition(e, s) {
@@ -4139,26 +4147,26 @@ class nt extends rr {
4139
4147
  if (!this.isDisposed()) {
4140
4148
  this._emitDefinitionUpdateEvent(n, i);
4141
4149
  const o = Object.keys(n).length > 0 || Object.keys(i).length > 0;
4142
- this.listenerCount(I.State) > 0 && (o || s && vt !== this._state) && this.emit(I.State, this._state);
4150
+ this.listenerCount(C.State) > 0 && (o || s && vt !== this._state) && this.emit(C.State, this._state);
4143
4151
  }
4144
4152
  }, 0), this);
4145
4153
  }
4146
4154
  setMetadata(e) {
4147
- this._definition = C(this._definition, (s) => {
4155
+ this._definition = I(this._definition, (s) => {
4148
4156
  s.meta = e;
4149
4157
  }), this._emitDefinitionEvent();
4150
4158
  }
4151
4159
  _emitDefinitionEvent() {
4152
- if (this.listenerCount(I.Definition) > 0) {
4160
+ if (this.listenerCount(C.Definition) > 0) {
4153
4161
  const e = {
4154
4162
  definition: this._getDefinitionWithoutSecrets(),
4155
4163
  metaframes: this._metaframes
4156
4164
  };
4157
- this.emit(I.Definition, e);
4165
+ this.emit(C.Definition, e);
4158
4166
  }
4159
4167
  }
4160
4168
  _emitDefinitionUpdateEvent(e, s) {
4161
- if (this.listenerCount(I.DefinitionUpdate) > 0) {
4169
+ if (this.listenerCount(C.DefinitionUpdate) > 0) {
4162
4170
  const n = {
4163
4171
  definition: this._getDefinitionWithoutSecrets(),
4164
4172
  metaframes: {
@@ -4167,30 +4175,30 @@ class nt extends rr {
4167
4175
  removed: s
4168
4176
  }
4169
4177
  };
4170
- this.emit(I.DefinitionUpdate, n);
4178
+ this.emit(C.DefinitionUpdate, n);
4171
4179
  }
4172
4180
  }
4173
4181
  addPipe(e, s) {
4174
- this._inputMap = C(this._inputMap, (n) => {
4182
+ this._inputMap = I(this._inputMap, (n) => {
4175
4183
  n[e] || (n[e] = []), n[e].push(s);
4176
4184
  });
4177
4185
  }
4178
4186
  removeMetaframe(e) {
4179
- this._metaframes[e] && (this._metaframes[e].dispose(), this._metaframes = C(this._metaframes, (s) => {
4187
+ this._metaframes[e] && (this._metaframes[e].dispose(), this._metaframes = I(this._metaframes, (s) => {
4180
4188
  delete s[e];
4181
- }), this._state = C(this._state, (s) => {
4189
+ }), this._state = I(this._state, (s) => {
4182
4190
  delete s.metaframes.inputs[e], delete s.metaframes.outputs[e];
4183
- }), this._inputMap = C(this._inputMap, (s) => {
4191
+ }), this._inputMap = I(this._inputMap, (s) => {
4184
4192
  delete s[e], Object.keys(s).forEach((n) => {
4185
4193
  const i = s[n];
4186
4194
  let o = 0;
4187
4195
  for (; o <= i.length; )
4188
4196
  i[o] && i[o].metaframe === e ? i.splice(o, 1) : o++;
4189
4197
  });
4190
- }), delete this._injectedSecrets[e], delete this._injectedQuerySecrets[e], delete this._originalSecretHashParams[e], delete this._originalSecretQueryParams[e], this._cachedInputLookupMap = C({}, (s) => s));
4198
+ }), delete this._injectedSecrets[e], delete this._injectedQuerySecrets[e], delete this._originalSecretHashParams[e], delete this._originalSecretQueryParams[e], this._cachedInputLookupMap = I({}, (s) => s));
4191
4199
  }
4192
4200
  removeAll() {
4193
- Object.keys(this._metaframes).forEach((e) => this._metaframes[e].dispose()), this._metaframes = C({}, (e) => e), this._state = vt, this._inputMap = C({}, (e) => e), this._cachedInputLookupMap = C({}, (e) => e), this._injectedSecrets = {}, this._injectedQuerySecrets = {}, this._originalSecretHashParams = {}, this._originalSecretQueryParams = {};
4201
+ Object.keys(this._metaframes).forEach((e) => this._metaframes[e].dispose()), this._metaframes = I({}, (e) => e), this._state = vt, this._inputMap = I({}, (e) => e), this._cachedInputLookupMap = I({}, (e) => e), this._injectedSecrets = {}, this._injectedQuerySecrets = {}, this._originalSecretHashParams = {}, this._originalSecretQueryParams = {};
4194
4202
  }
4195
4203
  metaframes() {
4196
4204
  return this.getMetaframes();
@@ -4218,10 +4226,10 @@ class nt extends rr {
4218
4226
  if (!s.url)
4219
4227
  throw this.emitErrorMessage(`Metaframe definition missing url id=${e}`), `Metaframe definition missing url id=${e}`;
4220
4228
  var n = new zr(this, s.url, e, this._id, this._consoleBackgroundColor, this.debug).setMetapage(this);
4221
- return this._metaframes = C(this._metaframes, (i) => {
4229
+ return this._metaframes = I(this._metaframes, (i) => {
4222
4230
  i[e] = n;
4223
- }), n.addListener(I.Error, (i) => {
4224
- this.emit(I.Error, {
4231
+ }), n.addListener(C.Error, (i) => {
4232
+ this.emit(C.Error, {
4225
4233
  metaframeId: n.id,
4226
4234
  metaframeUrl: n.url,
4227
4235
  error: i
@@ -4238,12 +4246,12 @@ class nt extends rr {
4238
4246
  this.logInternal(e, "f00", this._consoleBackgroundColor), this.emitErrorMessage(`${e}`);
4239
4247
  }
4240
4248
  emitErrorMessage(e) {
4241
- this.emit(I.Error, e);
4249
+ this.emit(C.Error, e);
4242
4250
  }
4243
4251
  getInputsFromOutput(e, s) {
4244
- return this._cachedInputLookupMap[e] || (this._cachedInputLookupMap = C(this._cachedInputLookupMap, (n) => {
4245
- n[e] = C({}, (i) => i);
4246
- })), this._cachedInputLookupMap[e][s] || (this._cachedInputLookupMap = C(this._cachedInputLookupMap, (n) => {
4252
+ return this._cachedInputLookupMap[e] || (this._cachedInputLookupMap = I(this._cachedInputLookupMap, (n) => {
4253
+ n[e] = I({}, (i) => i);
4254
+ })), this._cachedInputLookupMap[e][s] || (this._cachedInputLookupMap = I(this._cachedInputLookupMap, (n) => {
4247
4255
  var i = [];
4248
4256
  n[e][s] = i, Object.keys(this._inputMap).forEach((o) => {
4249
4257
  o !== e && this._inputMap[o].forEach((r) => {
@@ -4268,7 +4276,7 @@ class nt extends rr {
4268
4276
  }
4269
4277
  setInput(e, s, n) {
4270
4278
  var i, o;
4271
- typeof e == "object" ? this.setInputStateOnlyMetapageInstanceInputs(e) : typeof s == "string" ? this.setInputStateOnlyMetaframeInputValue(e, s, n) : this.setInputStateOnlyMetaframeInputMap(e, s || {}), this.setMetaframeClientInputAndSentClientEvent(e, s, n), (this.listenerCount(I.State) > 0 || this.listenerCount(I.Inputs) > 0) && vt !== this._state && (this.emit(I.State, this._state), this.emit(I.Inputs, (o = (i = this._state) == null ? void 0 : i.metaframes) == null ? void 0 : o.inputs));
4279
+ typeof e == "object" ? this.setInputStateOnlyMetapageInstanceInputs(e) : typeof s == "string" ? this.setInputStateOnlyMetaframeInputValue(e, s, n) : this.setInputStateOnlyMetaframeInputMap(e, s || {}), this.setMetaframeClientInputAndSentClientEvent(e, s, n), (this.listenerCount(C.State) > 0 || this.listenerCount(C.Inputs) > 0) && vt !== this._state && (this.emit(C.State, this._state), this.emit(C.Inputs, (o = (i = this._state) == null ? void 0 : i.metaframes) == null ? void 0 : o.inputs));
4272
4280
  }
4273
4281
  setMetaframeClientInputAndSentClientEvent(e, s, n) {
4274
4282
  if (typeof e == "object") {
@@ -4315,7 +4323,7 @@ class nt extends rr {
4315
4323
  this._setStateOnlyMetaframeInputMap(!0, e, s);
4316
4324
  }
4317
4325
  _setStateOnlyMetaframeInputValue(e, s, n, i) {
4318
- this._state = C(this._state, (o) => {
4326
+ this._state = I(this._state, (o) => {
4319
4327
  if (!this._metaframes.hasOwnProperty(s))
4320
4328
  throw `No metaframe: ${s}`;
4321
4329
  o.metaframes || (o.metaframes = { inputs: {}, outputs: {} }), e ? o.metaframes.inputs || (o.metaframes.inputs = {}) : o.metaframes.outputs || (o.metaframes.outputs = {});
@@ -4324,7 +4332,7 @@ class nt extends rr {
4324
4332
  });
4325
4333
  }
4326
4334
  _setStateOnlyMetaframeInputMap(e, s, n) {
4327
- !n || Object.keys(n).length === 0 || (this._state = C(this._state, (i) => {
4335
+ !n || Object.keys(n).length === 0 || (this._state = I(this._state, (i) => {
4328
4336
  if (!this._metaframes.hasOwnProperty(s))
4329
4337
  throw `No metaframe: ${s}`;
4330
4338
  let r = e ? i.metaframes.inputs : i.metaframes.outputs;
@@ -4334,7 +4342,7 @@ class nt extends rr {
4334
4342
  }));
4335
4343
  }
4336
4344
  _setStateOnlyMetaframes(e, s) {
4337
- !s || Object.keys(s).length === 0 || (this._state = C(this._state, (n) => {
4345
+ !s || Object.keys(s).length === 0 || (this._state = I(this._state, (n) => {
4338
4346
  Object.keys(s).forEach((i) => {
4339
4347
  var o = s[i];
4340
4348
  if (typeof o != "object")
@@ -4404,13 +4412,13 @@ class nt extends rr {
4404
4412
  });
4405
4413
  }), r && (this.setInputStateOnlyMetapageInstanceInputs(l), Object.keys(l).forEach((f) => {
4406
4414
  this._metaframes[f].setInputs(l[f]);
4407
- })), this.listenerCount(I.State) > 0 && vt !== this._state && this.emit(I.State, this._state), this.debug && o.ack({ jsonrpc: e, state: this._state });
4415
+ })), this.listenerCount(C.State) > 0 && vt !== this._state && this.emit(C.State, this._state), this.debug && o.ack({ jsonrpc: e, state: this._state });
4408
4416
  } else
4409
4417
  this.error(`missing metaframe=${n}`);
4410
4418
  break;
4411
4419
  case q.InputsUpdate:
4412
4420
  var a = e.params;
4413
- this.debug && this.log(`inputs ${JSON.stringify(a)} from ${n}`), this._metaframes[n] ? (this.setInputStateOnlyMetaframeInputMap(n, a), this._metaframes[n].setInputs(a), this.listenerCount(I.State) > 0 && vt !== this._state && this.emit(I.State, this._state), this.debug && this._metaframes[n].ack({
4421
+ this.debug && this.log(`inputs ${JSON.stringify(a)} from ${n}`), this._metaframes[n] ? (this.setInputStateOnlyMetaframeInputMap(n, a), this._metaframes[n].setInputs(a), this.listenerCount(C.State) > 0 && vt !== this._state && this.emit(C.State, this._state), this.debug && this._metaframes[n].ack({
4414
4422
  jsonrpc: e,
4415
4423
  state: this._state
4416
4424
  })) : (console.error(`InputsUpdate failed no metaframe id: "${n}"`), this.error(`InputsUpdate failed no metaframe id: "${n}"`));
@@ -4454,7 +4462,7 @@ class nt extends rr {
4454
4462
  });
4455
4463
  }
4456
4464
  const g = new URL(p);
4457
- this._definition = C(this._definition, (m) => {
4465
+ this._definition = I(this._definition, (m) => {
4458
4466
  m.metaframes[l].url = g.href;
4459
4467
  }), this._emitDefinitionEvent();
4460
4468
  }
@@ -4462,7 +4470,7 @@ class nt extends rr {
4462
4470
  default:
4463
4471
  this.debug && this.log(`Unknown RPC method: "${s}"`);
4464
4472
  }
4465
- this.listenerCount(I.Message) > 0 && this.emit(I.Message, e);
4473
+ this.listenerCount(C.Message) > 0 && this.emit(C.Message, e);
4466
4474
  }
4467
4475
  }
4468
4476
  logInternal(e, s, n) {
@@ -4472,13 +4480,13 @@ class nt extends rr {
4472
4480
  }
4473
4481
  }
4474
4482
  nt.version = Ls;
4475
- nt.DEFINITION = I.Definition;
4476
- nt.DEFINITION_UPDATE = I.DefinitionUpdate;
4477
- nt.ERROR = I.Error;
4478
- nt.INPUTS = I.Inputs;
4479
- nt.MESSAGE = I.Message;
4480
- nt.OUTPUTS = I.Outputs;
4481
- nt.STATE = I.State;
4483
+ nt.DEFINITION = C.Definition;
4484
+ nt.DEFINITION_UPDATE = C.DefinitionUpdate;
4485
+ nt.ERROR = C.Error;
4486
+ nt.INPUTS = C.Inputs;
4487
+ nt.MESSAGE = C.Message;
4488
+ nt.OUTPUTS = C.Outputs;
4489
+ nt.STATE = C.State;
4482
4490
  nt.deserializeInputs = Ft;
4483
4491
  nt.serializeInputs = _e;
4484
4492
  function ds(t) {
@@ -4561,7 +4569,7 @@ async function yo(t) {
4561
4569
  throw r.dispose(), new Error(`Failed to set metapage definition: ${b}`);
4562
4570
  }
4563
4571
  const a = [];
4564
- n && a.push(r.addListenerReturnDisposer(I.Outputs, n));
4572
+ n && a.push(r.addListenerReturnDisposer(C.Outputs, n));
4565
4573
  const u = (O = (P = s == null ? void 0 : s.meta) == null ? void 0 : P.layouts) == null ? void 0 : O["react-grid-layout"], c = u == null ? void 0 : u.layout;
4566
4574
  if (!u || !c)
4567
4575
  throw new Error("No valid layout found in metapage definition");
@@ -4706,7 +4714,7 @@ export {
4706
4714
  ge as MetaframeVersionCurrent,
4707
4715
  ys as MetaframeVersionsAll,
4708
4716
  nt as Metapage,
4709
- I as MetapageEvents,
4717
+ C as MetapageEvents,
4710
4718
  Gt as MetapageHashParams,
4711
4719
  zr as MetapageIFrameRpcClient,
4712
4720
  rr as MetapageShared,