@myop/vue 0.0.25 → 0.0.26

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.js CHANGED
@@ -1,1801 +1,420 @@
1
- import { defineComponent as Gt, useAttrs as Jt, useSlots as Yt, ref as K, getCurrentInstance as Xt, onMounted as Qt, reactive as Zt, watchEffect as es, createElementBlock as ts, openBlock as ss, Fragment as ns, createElementVNode as is, renderSlot as os, createCommentVNode as rs, mergeProps as as, unref as ls } from "vue";
2
- var cs = Object.defineProperty, ds = (e, t, s) => t in e ? cs(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, p = (e, t, s) => ds(e, typeof t != "symbol" ? t + "" : t, s), U = (e, t, s) => new Promise((n, i) => {
3
- var o = (c) => {
4
- try {
5
- l(s.next(c));
6
- } catch (d) {
7
- i(d);
8
- }
9
- }, r = (c) => {
10
- try {
11
- l(s.throw(c));
12
- } catch (d) {
13
- i(d);
14
- }
15
- }, l = (c) => c.done ? n(c.value) : Promise.resolve(c.value).then(o, r);
16
- l((s = s.apply(e, t)).next());
17
- }), D = () => "10000000-1000-4000-8000-100000000000".replace(
18
- /[018]/g,
19
- (e) => (+e ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +e / 4).toString(16)
20
- ), us = class {
21
- constructor() {
22
- p(this, "id", D()), p(this, "myop", !0), p(this, "content"), p(this, "source"), p(this, "destination"), p(this, "route"), p(this, "ref"), p(this, "direction"), p(this, "cleanable", !1);
23
- }
24
- static create(...t) {
25
- return new this(...t);
26
- }
27
- isTypeof(t) {
28
- return t.messageType === this.messageType;
29
- }
30
- }, hs = class extends us {
31
- constructor(t) {
32
- super(), this.handler = t, p(this, "handlerUniqueId", D());
33
- }
34
- }, ps = "ExecuteScriptReplyMessage", fs = /(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/, ms = /\(\s*[^)]+\s*\)\s*=>\s*(.+)/, gs = (e) => {
35
- let t = e.match(fs);
36
- if (t)
37
- return t[1] || t[3];
38
- {
39
- let s = e.match(ms);
40
- if (s)
41
- return s[1].trim();
42
- }
43
- }, qe = class extends hs {
44
- constructor(t, s = () => {
45
- }, n) {
46
- super(s), this.scriptInputs = n, p(this, "replyMessageKey", ps), p(this, "messageType", "ExecuteScriptMessage"), p(this, "script", ""), this.script = t.toString(), this.content = t.toString(), this.content = gs(this.content);
47
- }
48
- };
49
- p(qe, "replierKey", "send");
50
- p(qe, "completeStreamKey", "completeStream");
51
- var Pe = class {
52
- constructor() {
53
- p(this, "_runTimeInstanceId", "runtime-instance-id-" + D()), p(this, "_runTimeId", "runtime-id-" + D()), p(this, "_runTimeName", "runtime-name-" + D()), p(this, "id", this._runTimeId), p(this, "name", this._runTimeName), p(this, "description", ""), p(this, "loader", null), p(this, "withLoader", (t) => (this.loader = t, this)), p(this, "withHTMLLoader", (t) => (t.type = "HTMLLoader", this.loader = t, this)), p(this, "build", () => this);
54
- }
55
- };
56
- p(Pe, "create", () => new Pe());
57
- var Le = class {
58
- constructor() {
59
- p(this, "_runTimeInstanceId", "runtime-instance-id-" + D()), p(this, "_runTimeId", "runtime-id-" + D()), p(this, "_runTimeName", "runtime-name-" + D()), p(this, "instance", {
60
- id: this._runTimeInstanceId,
61
- componentId: this._runTimeId,
62
- componentName: this._runTimeName,
63
- skinSelector: null
64
- }), p(this, "name", this._runTimeName), p(this, "type", {
65
- id: this._runTimeId,
66
- name: this._runTimeName,
67
- description: "",
68
- props: [],
69
- refs: [],
70
- skins: [],
71
- defaultSkin: 0
72
- }), p(this, "withInstance", (t) => (this.instance = t, this)), p(this, "withType", (t) => (this.type = t, this)), p(this, "withName", (t) => (this.name = t, this)), p(this, "withDefaultSkin", (t) => (this.type.skins.push(t), this.type.defaultSkin = this.type.skins.length - 1, this.instance.skinSelector = {
73
- type: "Dedicated",
74
- skin: {
75
- id: t.id
76
- }
77
- }, this)), p(this, "withRef", (t) => (this.type.refs.push(t), this)), p(this, "withBasicRef", (t) => {
78
- const s = {
79
- id: "",
80
- name: t,
81
- description: "",
82
- selectorType: "id-attribute",
83
- selector: t,
84
- behavior: {
85
- type: "code"
86
- }
87
- };
88
- return this.type.refs.push(s), this;
89
- }), p(this, "build", () => JSON.parse(JSON.stringify(this)));
90
- }
91
- };
92
- p(Le, "create", () => new Le());
93
- var pe = class {
94
- // private components: Record<string, Promise<IUserFlow>> = {};
95
- constructor(t = "https://cloud.myop.dev") {
96
- this._baseUrl = t, p(this, "userFlows", {});
97
- }
98
- fetchComponent(t, s) {
99
- return U(this, null, function* () {
100
- return s ? (yield this.fetchFlow(s)).components.find((i) => i.type.id === t) : (yield this.fetchAutoFlow(t)).components[0];
101
- });
102
- }
103
- fetchAutoFlow(t) {
104
- return U(this, null, function* () {
105
- return this.userFlows[t] || (this.userFlows[t] = new Promise(
106
- (s, n) => U(this, null, function* () {
107
- try {
108
- const o = yield (yield fetch(
109
- `${this._baseUrl}/flow?id=${t}&auto=true`
110
- )).json();
111
- s(o.item);
112
- } catch (i) {
113
- n(i);
114
- }
115
- })
116
- )), yield this.userFlows[t];
117
- });
118
- }
119
- fetchFlow(t) {
120
- return U(this, null, function* () {
121
- return this.userFlows[t] || (this.userFlows[t] = new Promise(
122
- (s, n) => U(this, null, function* () {
123
- try {
124
- const o = yield (yield fetch(
125
- `${this._baseUrl}/flow?id=${t}&resolve=components`
126
- )).json();
127
- s(o.item);
128
- } catch (i) {
129
- n(i);
130
- }
131
- })
132
- )), yield this.userFlows[t];
133
- });
134
- }
135
- };
136
- p(pe, "Main", new pe());
137
- var ys = pe, je = Object.defineProperty, vs = Object.defineProperties, ws = Object.getOwnPropertyDescriptors, Ae = Object.getOwnPropertySymbols, Ms = Object.prototype.hasOwnProperty, _s = Object.prototype.propertyIsEnumerable, fe = (e, t, s) => t in e ? je(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, v = (e, t) => {
138
- for (var s in t || (t = {}))
139
- Ms.call(t, s) && fe(e, s, t[s]);
140
- if (Ae)
141
- for (var s of Ae(t))
142
- _s.call(t, s) && fe(e, s, t[s]);
143
- return e;
144
- }, G = (e, t) => vs(e, ws(t)), Es = (e, t) => {
145
- for (var s in t)
146
- je(e, s, { get: t[s], enumerable: !0 });
147
- }, a = (e, t, s) => fe(e, typeof t != "symbol" ? t + "" : t, s), m = (e, t, s) => new Promise((n, i) => {
148
- var o = (c) => {
149
- try {
150
- l(s.next(c));
151
- } catch (d) {
152
- i(d);
153
- }
154
- }, r = (c) => {
155
- try {
156
- l(s.throw(c));
157
- } catch (d) {
158
- i(d);
159
- }
160
- }, l = (c) => c.done ? n(c.value) : Promise.resolve(c.value).then(o, r);
161
- l((s = s.apply(e, t)).next());
162
- }), J = "__federation__", Be = "onLoad", We = (e, t) => {
163
- window[J] && window[J][e] && window[J][e][Be] && window[J][e][Be]({ [e]: t });
164
- }, g = {
165
- //host to component
166
- InitRequest: "InitRequest",
167
- InitResponse: "InitResponse",
168
- InitMessage: "InitMessage",
169
- DisposeMessage: "DisposeMessage",
170
- ChangeTextMessage: "ChangeTextMessage",
171
- BindClickMessage: "BindClickMessage",
172
- DetectMyopRefsMessage: "DetectMyopRefsMessage",
173
- ExecuteScriptMessage: "ExecuteScriptMessage",
174
- AddEventListenerMessage: "AddEventListenerMessage",
175
- SetAttributeMessage: "SetAttributeMessage",
176
- CreateRefComponentMessage: "CreateRefComponentMessage",
177
- EnvelopedMessage: "EnvelopedMessage",
178
- GetElementValueMessage: "GetElementValueMessage",
179
- SetInnerHtml: "SetInnerHtml",
180
- //component messages
181
- ExecuteComponentMethod: "ExecuteComponentMethod",
182
- CleanupMessage: "CleanupMessage",
183
- // external to host :
184
- In: {
185
- MutationObserverMessage: "MutationObserverMessage",
186
- ResizeObserverMessage: "ResizeObserverMessage"
187
- }
188
- }, me = {};
189
- Es(me, {
190
- AddEventListenerMessage: () => Ds,
191
- BaseMyopMessage: () => w,
192
- BindClickMessage: () => xs,
193
- ChangeTextMessage: () => Rs,
194
- CleanupMessage: () => pt,
195
- CleanupReplayMessage: () => ft,
196
- ClickReplayMessage: () => Ye,
197
- CreateRefComponentMessage: () => at,
198
- CustomRefMessage: () => ge,
199
- DetectMyopRefsMessage: () => Fs,
200
- DetectedMyopRefsMessage: () => dt,
201
- DisposeMessage: () => mt,
202
- ElementValueReplayMessage: () => nt,
203
- EnvelopedMessage: () => lt,
204
- EventListenerCallbackMessage: () => tt,
205
- ExecuteComponentMethod: () => R,
206
- ExecuteScriptMessage: () => H,
207
- ExecuteScriptReplyMessage: () => Ze,
208
- GetAttributeMessage: () => Ps,
209
- GetAttributeReplayMessage: () => Ls,
210
- GetElementValueMessage: () => $s,
211
- InitMessage: () => Ce,
212
- InitRequest: () => ot,
213
- InitResponse: () => it,
214
- MessageDirection: () => b,
215
- MutationObserverMessage: () => Bs,
216
- MyopBindMessage: () => T,
217
- MyopBindReplayMessage: () => I,
218
- MyopElementMessage: () => Ts,
219
- Ref: () => z,
220
- RefComponentCreatedMessage: () => ye,
221
- ResizeObserverMessage: () => Ks,
222
- SetAttributeMessage: () => Os,
223
- SetInnerHtml: () => Ns,
224
- SetMutationObserverMessage: () => As,
225
- SetResizeObserverMessage: () => Vs,
226
- stripFunction: () => Qe
227
- });
228
- var B = () => "10000000-1000-4000-8000-100000000000".replace(
229
- /[018]/g,
230
- (e) => (+e ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +e / 4).toString(16)
231
- ), bs = (e) => {
232
- const t = [...e].map((s) => s.toString(16).padStart(2, "0")).join("");
233
- return [
234
- t.slice(0, 8),
235
- t.slice(8, 12),
236
- t.slice(12, 16),
237
- t.slice(16, 20),
238
- t.slice(20)
239
- ].join("-");
240
- }, Cs = (e) => {
241
- let t = e.replace(/-/g, "+").replace(/_/g, "/");
242
- for (; t.length % 4; ) t += "=";
243
- const s = atob(t);
244
- return Uint8Array.from(s, (n) => n.charCodeAt(0));
245
- }, Ss = (e) => {
246
- const t = Cs(e);
247
- if (t.length % 16 !== 0) throw new Error("Invalid input length");
248
- const s = [];
249
- for (let n = 0; n < t.length; n += 16)
250
- s.push(bs(t.slice(n, n + 16)));
251
- return s;
252
- }, Is = (e) => new Promise((t) => setTimeout(t, e)), b = class {
253
- };
254
- a(b, "down", "down");
255
- a(b, "up", "up");
256
- var w = class {
257
- constructor() {
258
- a(this, "id", B()), a(this, "myop", !0), a(this, "content"), a(this, "source"), a(this, "destination"), a(this, "route"), a(this, "ref"), a(this, "direction"), a(this, "cleanable", !1);
259
- }
260
- static create(...e) {
261
- return new this(...e);
262
- }
263
- isTypeof(e) {
264
- return e.messageType === this.messageType;
265
- }
266
- }, Ts = class extends w {
267
- constructor(e) {
268
- super(), this.ref = e;
269
- }
270
- }, I = class extends w {
271
- constructor(e) {
272
- super(), this.replayToHandler = e;
273
- }
274
- }, T = class extends w {
275
- constructor(e) {
276
- super(), this.handler = e, a(this, "handlerUniqueId", B());
277
- }
278
- }, z = class Ge {
279
- constructor(t, s) {
280
- this.refConfig = t, this.component = s, a(this, "myop", !0), a(this, "__nonProxied"), this.__nonProxied = G(v({}, this), {
281
- component: null
282
- // in order to be serializable
283
- });
284
- }
285
- static create(t, s, n) {
286
- let i = s;
287
- return i || (i = {
288
- id: "",
289
- name: "",
290
- description: "",
291
- selectorType: "id-attribute",
292
- selector: t,
293
- behavior: {
294
- type: "code"
295
- }
296
- }), new Ge(i, n);
297
- }
298
- }, Je = "ClickReplayMessage", xs = class extends T {
299
- constructor(e, t) {
300
- super(t), this.ref = e, a(this, "replyMessageKey", Je), a(this, "messageType", "BindClickMessage"), a(this, "cleanable", !0);
301
- }
302
- }, Ye = class extends I {
303
- constructor() {
304
- super(...arguments), a(this, "messageType", Je);
305
- }
306
- }, Rs = class extends w {
307
- constructor(e, t) {
308
- super(), this.ref = e, a(this, "messageType", "ChangeTextMessage"), this.content = t;
309
- }
310
- }, Xe = "ExecuteScriptReplyMessage", ks = /(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/, Hs = /\(\s*[^)]+\s*\)\s*=>\s*(.+)/, Qe = (e) => {
311
- let t = e.match(ks);
312
- if (t)
313
- return t[1] || t[3];
314
- {
315
- let s = e.match(Hs);
316
- if (s)
317
- return s[1].trim();
318
- }
319
- }, H = class extends T {
320
- constructor(e, t = () => {
321
- }, s) {
322
- super(t), this.scriptInputs = s, a(this, "replyMessageKey", Xe), a(this, "messageType", "ExecuteScriptMessage"), a(this, "script", ""), this.script = e.toString(), this.content = e.toString(), this.content = Qe(this.content);
323
- }
324
- };
325
- a(H, "replierKey", "send");
326
- a(H, "completeStreamKey", "completeStream");
327
- var Ze = class extends I {
328
- constructor(e, t) {
329
- super(e), this.replayToHandler = e, this.content = t, a(this, "messageType", Xe);
330
- }
331
- }, ge = class extends H {
332
- constructor(e, t, s = () => {
333
- }) {
334
- super(({ rootRef: n, elementId: i, _script: o, __scriptInputs: r }) => {
335
- const l = (n.shadowRoot || n.container).querySelectorAll(`[myop-id='${i}']`);
336
- return l.length ? (r.ref = l[0], new Function(`return (${o})(...arguments)`)(r)) : null;
337
- }, s), this.scriptInputs = t, this.scriptInputs = G(v({}, t), {
338
- //_script: stripFunction(script.toString()),
339
- _script: e.toString()
340
- });
341
- }
342
- }, et = "EventListenerCallbackMessage", Ds = class extends T {
343
- // {} // empty
344
- constructor(e, t, s) {
345
- super(s), this.ref = e, this.type = t, this.handler = s, a(this, "replyMessageKey", et), a(this, "messageType", "AddEventListenerMessage"), a(this, "cleanable", !0), a(this, "serializableSkeleton", !1);
346
- }
347
- withSerializableSkeleton(e) {
348
- return this.serializableSkeleton = e, this;
349
- }
350
- }, tt = class extends I {
351
- constructor(e, t) {
352
- super(e), this.replayToHandler = e, this.e = t, a(this, "messageType", et), this.content = {
353
- e: t
354
- };
355
- }
356
- }, Os = class extends w {
357
- constructor(e, t, s) {
358
- super(), this.ref = e, this.name = t, this.value = s, a(this, "messageType", "SetAttributeMessage");
359
- }
360
- }, st = "ElementValueReplayMessage", $s = class extends T {
361
- constructor(e, t) {
362
- super(t), this.ref = e, a(this, "replyMessageKey", st), a(this, "messageType", "GetElementValueMessage");
363
- }
364
- }, nt = class extends I {
365
- constructor(e) {
366
- super(), this.content = e, a(this, "messageType", st);
367
- }
368
- }, Ns = class extends w {
369
- constructor(e, t) {
370
- super(), this.ref = e, a(this, "messageType", "SetInnerHtml"), this.content = t;
371
- }
372
- }, Ce = class extends w {
373
- constructor(e) {
374
- super(), a(this, "messageType", "InitMessage"), this.content = { id: e };
375
- }
376
- isTypeof(e) {
377
- return e.messageType === this.messageType;
378
- }
379
- }, it = class extends Ce {
380
- constructor() {
381
- super(...arguments), a(this, "messageType", "InitResponse");
382
- }
383
- }, ot = class extends w {
384
- constructor() {
385
- super(...arguments), a(this, "messageType", "InitRequest");
386
- }
387
- }, rt = "RefComponentCreatedMessage", at = class extends T {
388
- constructor(e, t, s, n) {
389
- super(n), this.refConfig = e, this.nestedComponentConfig = t, this.options = s, a(this, "replyMessageKey", rt), a(this, "messageType", "CreateRefComponentMessage");
390
- }
391
- }, ye = class extends I {
392
- constructor(e, t, s) {
393
- super(e), this.replayToHandler = e, this.nestedRefs = t, this.failed = s, a(this, "messageType", rt);
394
- }
395
- }, lt = class extends w {
396
- constructor(e, t) {
397
- super(), this.destination = e, this.message = t, a(this, "messageType", "EnvelopedMessage");
398
- const s = t;
399
- this.route = [e, ...s.route ? s.route : []];
400
- }
401
- }, ct = "DetectedMyopRefsMessage", Fs = class extends T {
402
- constructor() {
403
- super(...arguments), a(this, "messageType", "DetectMyopRefsMessage"), a(this, "replyMessageKey", ct);
404
- }
405
- }, dt = class extends I {
406
- constructor(e, t) {
407
- super(e), this.replayToHandler = e, a(this, "messageType", ct), this.content = t;
408
- }
409
- isTypeof(e) {
410
- return e.messageType === this.messageType;
411
- }
412
- }, ut = "GetAttributeReplayMessage", Ps = class extends T {
413
- constructor(e, t, s) {
414
- super(s), this.ref = e, this.name = t, a(this, "replyMessageKey", ut), a(this, "messageType", "GetAttributeMessage");
415
- }
416
- }, Ls = class extends I {
417
- constructor(e) {
418
- super(), this.content = e, a(this, "messageType", ut);
419
- }
420
- }, R = class extends w {
421
- constructor(e) {
422
- super(), this.method = e, a(this, "messageType", "ExecuteComponentMethod");
423
- }
424
- }, As = class extends w {
425
- constructor() {
426
- super(...arguments), a(this, "messageType", "SetMutationObserverMessage");
427
- }
428
- }, Bs = class extends w {
429
- constructor() {
430
- super(...arguments), a(this, "messageType", "MutationObserverMessage");
431
- }
432
- }, ht = "CleanupReplayMessage", pt = class extends T {
433
- constructor(e, t) {
434
- super(t), this.cleanupForMessageId = e, a(this, "replyMessageKey", ht), a(this, "messageType", "CleanupMessage");
435
- }
436
- }, ft = class extends I {
437
- constructor(e) {
438
- super(), this.customCleanup = e, a(this, "messageType", ht);
439
- }
440
- }, mt = class extends w {
441
- constructor() {
442
- super(...arguments), a(this, "messageType", "DisposeMessage");
443
- }
444
- }, Vs = class extends w {
445
- constructor() {
446
- super(...arguments), a(this, "cleanable", !0), a(this, "messageType", "SetResizeObserverMessage");
447
- }
448
- }, Ks = class extends w {
449
- constructor() {
450
- super(...arguments), a(this, "messageType", "ResizeObserverMessage");
451
- }
452
- }, Se = class {
453
- constructor(e, t, s) {
454
- this.componentDefinition = e, this.container = t, a(this, "id", ""), a(this, "messageHandlers", {}), a(this, "element"), a(this, "_markedForDisposed", !1), a(this, "bind", (i, o) => {
455
- this.messageHandlers[i] || (this.messageHandlers[i] = []), this.messageHandlers[i].includes(o) || this.messageHandlers[i].push(o);
456
- }), a(this, "bindWhen", (i, o, r) => {
457
- if (!r)
458
- throw new Error("can't use component.bindWhen without an handler");
459
- this.messageHandlers[i] || (this.messageHandlers[i] = []);
460
- const l = this.messageHandlers[i], c = (d) => o(d) ? (r(d), !0) : !1;
461
- return l.push(c), () => {
462
- const d = l.indexOf(c);
463
- d > -1 && l.splice(d, 1);
464
- };
465
- }), a(this, "setInitiated", () => {
466
- this.isInitiated = !0, this._whenInitiatedResolve && this._whenInitiatedResolve();
467
- }), a(this, "isInitiated", !1), a(this, "_whenInitiatedResolve"), a(this, "_whenInitiatedReject"), a(this, "_whenInitiated", new Promise((i, o) => {
468
- this._whenInitiatedResolve = i, this._whenInitiatedReject = o;
469
- })), a(this, "initiated", () => this._whenInitiated), a(this, "props", {}), a(this, "refs", {}), this.id = (s == null ? void 0 : s.id) || oe.Instance().assignId(e);
470
- const n = s != null && s.timeout ? s == null ? void 0 : s.timeout : 5 * 1e3;
471
- setTimeout(() => {
472
- !this.isInitiated && this._whenInitiatedReject && !this._markedForDisposed && this._whenInitiatedReject(`timeout_${n} ${this.id}`);
473
- }, n), this.initiated().then(() => {
474
- window.myop.hostSDK.inspected && this.inspect();
1
+ import { defineComponent as Q, useSlots as X, computed as y, createElementBlock as A, openBlock as b, normalizeStyle as W, renderSlot as M, unref as ge, ref as p, shallowRef as lt, watch as ae, onMounted as Re, onUnmounted as at, createElementVNode as $e, createBlock as ke, createCommentVNode as pe, withCtx as Ve, markRaw as Ie, useAttrs as ct, getCurrentInstance as ut, reactive as ft, watchEffect as pt, Fragment as dt, mergeProps as mt } from "vue";
2
+ import { containerStyleObject as ht, loaderStyleObject as gt, getMyopLogoHtml as xe, fallbackStyleObject as yt, hostSDK as Te } from "@myop/sdk/host";
3
+ import { CloudRepository as Z } from "@myop/sdk/helpers";
4
+ const _t = ["innerHTML"], Ct = /* @__PURE__ */ Q({
5
+ __name: "MyopLoader",
6
+ props: {
7
+ opacity: { default: 1 },
8
+ fadeDuration: { default: 200 }
9
+ },
10
+ setup(e) {
11
+ const t = e, n = X(), o = (l) => !l || l.length === 0 ? !1 : l.some((c) => typeof c.children == "string" ? c.children.trim() !== "" : Array.isArray(c.children) ? o(c.children) : !!(c.type && typeof c.type != "symbol" || c.children)), s = y(() => {
12
+ const l = n.default;
13
+ if (!l) return !1;
14
+ const c = l();
15
+ return o(c);
16
+ }), r = y(() => ({
17
+ ...ht,
18
+ opacity: t.opacity,
19
+ transition: `opacity ${t.fadeDuration}ms ease-out`
20
+ })), i = y(() => ({
21
+ ...gt,
22
+ opacity: t.opacity,
23
+ transition: `opacity ${t.fadeDuration}ms ease-out`
24
+ })), a = xe();
25
+ return (l, c) => s.value ? (b(), A("div", {
26
+ key: 0,
27
+ style: W(r.value)
28
+ }, [
29
+ M(l.$slots, "default")
30
+ ], 4)) : (b(), A("div", {
31
+ key: 1,
32
+ style: W(i.value),
33
+ innerHTML: ge(a)
34
+ }, null, 12, _t));
35
+ }
36
+ }), vt = ["innerHTML"], Et = /* @__PURE__ */ Q({
37
+ __name: "MyopFallback",
38
+ setup(e) {
39
+ const t = X(), n = (a) => !a || a.length === 0 ? !1 : a.some((l) => typeof l.children == "string" ? l.children.trim() !== "" : Array.isArray(l.children) ? n(l.children) : !!(l.type && typeof l.type != "symbol" || l.children)), o = y(() => {
40
+ const a = t.default;
41
+ if (!a) return !1;
42
+ const l = a();
43
+ return n(l);
44
+ }), s = {
45
+ position: "absolute",
46
+ top: "0",
47
+ left: "0",
48
+ right: "0",
49
+ bottom: "0"
50
+ }, r = {
51
+ ...yt
52
+ }, i = xe();
53
+ return (a, l) => o.value ? (b(), A("div", {
54
+ key: 0,
55
+ style: s
56
+ }, [
57
+ M(a.$slots, "default")
58
+ ])) : (b(), A("div", {
59
+ key: 1,
60
+ style: r,
61
+ innerHTML: ge(i)
62
+ }, null, 8, vt));
63
+ }
64
+ }), En = /* @__PURE__ */ Q({
65
+ name: "MyopComponent",
66
+ __name: "MyopComponent",
67
+ props: {
68
+ componentId: {},
69
+ componentConfig: {},
70
+ data: {},
71
+ fadeDuration: { default: 200 },
72
+ autoSize: { type: Boolean, default: !1 },
73
+ environment: {},
74
+ preview: { type: Boolean },
75
+ on: {}
76
+ },
77
+ emits: ["load", "error", "sizeChange", "cta"],
78
+ setup(e, { expose: t, emit: n }) {
79
+ const o = X(), s = (u) => !u || u.length === 0 ? !1 : u.some((f) => typeof f.children == "string" ? f.children.trim() !== "" : Array.isArray(f.children) ? s(f.children) : !!(f.type && typeof f.type != "symbol" || f.children)), r = y(() => {
80
+ const u = o.loader;
81
+ if (!u) return !1;
82
+ const f = u();
83
+ return s(f);
475
84
  });
476
- }
477
- get markedForDisposed() {
478
- return this._markedForDisposed;
479
- }
480
- set markedForDisposed(e) {
481
- if (this._markedForDisposed)
482
- throw new Error("InvalidOperationException: The component is already in the process of being disposed. Dispose operation cannot be performed again until the current disposal process is complete.");
483
- this._markedForDisposed = e;
484
- }
485
- onMessageReceived(e) {
486
- if (e.messageType === g.ExecuteComponentMethod) {
487
- const s = e;
488
- return this[s.method] ? this[s.method](s.content) : console.log(`method not found ${s.method} on component`, this), !0;
489
- }
490
- const t = this.messageHandlers[e.messageType];
491
- if (t && t.length) {
492
- let s = !1;
493
- return t.forEach((n) => {
494
- s = s || n(e);
495
- }), s;
496
- }
497
- return !1;
498
- }
499
- sendCleanupMessage(e) {
500
- e.source = this.id, e.destination = this.id, e.direction = b.down;
501
- const t = this.bindWhen(e.replyMessageKey, (n) => n.replayToHandler === e.handlerUniqueId, (n) => {
502
- e.handler(n), t();
503
- }), s = e.handler;
504
- delete e.handler, this.send(e), e.handler = s;
505
- }
506
- send(e) {
507
- e.source || (e.source = this.id), e.destination || (e.destination = this.id), e.direction = b.down;
508
- let t;
509
- if (e.handler) {
510
- const s = e;
511
- t = this.bindWhen(s.replyMessageKey, (n) => n.replayToHandler === s.handlerUniqueId, s.handler), delete e.handler;
512
- }
513
- return e.ref && (e.ref = e.ref.__nonProxied || e.ref), e.cleanable ? () => {
514
- this.sendCleanupMessage(new pt(e.id, (s) => {
515
- })), t && t();
516
- } : () => {
517
- };
518
- }
519
- dispose() {
520
- if (this.markedForDisposed = !0, !this.isInitiated)
521
- return;
522
- console.log("disposing component", this.id), this.send(new mt());
523
- const e = this.messageHandlers.onDispose;
524
- e && e.forEach((t) => {
525
- t(null);
526
- }), this.messageHandlers = {}, this.id += "_disposed", this.isInitiated = !1;
527
- }
528
- }, Us = class {
529
- constructor(e, t, s, n, i) {
530
- this.myopId = e, this.htmlTagName = t, this.BoundingRect = s, this.offsetTop = n, this.offsetLeft = i, a(this, "type", "MyopElementRef");
531
- }
532
- }, zs = (e) => m(void 0, null, function* () {
533
- if (typeof e == "function")
534
- e();
535
- else if (e instanceof Promise) {
536
- const t = yield e;
537
- typeof t == "function" && t();
538
- }
539
- }), qs = class {
540
- //TODO : add dispose method
541
- constructor(e) {
542
- this.messageToHost = e;
543
- }
544
- }, js = class extends qs {
545
- constructor(e, t) {
546
- super(e), this.messageToHost = e, this.context = t;
547
- }
548
- }, Ws = class {
549
- //onMessageReceived: (msg: IMyopMessage) => void;
550
- constructor(e, t) {
551
- this.id = e, this.context = t, a(this, "send", (s) => {
85
+ y(() => {
86
+ const u = o.fallback;
87
+ if (!u) return !1;
88
+ const f = u();
89
+ return s(f);
552
90
  });
553
- }
554
- }, Gs = class {
555
- constructor() {
556
- a(this, "messageToHandleAfterInit", []), a(this, "components", {}), a(this, "alwaysPassEnvelopesToHost", !1), a(this, "messageCleanupCache", {});
557
- }
558
- handleIncomeMessages(e) {
559
- const t = e.data ? e.data : e.detail;
560
- if (!(!t || !t.myop)) {
561
- let s = t;
562
- if (s.direction !== b.down)
563
- return;
564
- if (s.messageType === g.DisposeMessage) {
565
- s.destination && delete this.components[s.destination];
566
- return;
567
- }
568
- if (s.messageType === g.InitMessage) {
569
- const n = s.content.id;
570
- if (this.components[n])
571
- return;
572
- this.components[n] = new Ws(n), this.messageToHost(new it(n));
573
- return;
574
- }
575
- if (s.messageType === g.EnvelopedMessage) {
576
- const n = s, i = n.message;
577
- if (s = i, this.alwaysPassEnvelopesToHost || this.components[s.destination]) {
578
- const o = myop.hostSDK.components.find((l) => l.id === i.destination);
579
- if (o) {
580
- o.send(i);
581
- return;
582
- }
583
- const r = myop.hostSDK.components.find((l) => l.id === n.destination);
584
- if (r) {
585
- r.send(i);
586
- return;
587
- }
588
- } else
91
+ const i = e, a = n, l = p(null), c = lt(null), d = i.componentId ? yn(i.componentId) : !1, g = p(!d), V = p(1), E = p(!1), F = p(!1), I = p(void 0), oe = p(!1), P = p(null), re = p(!1);
92
+ let R = null;
93
+ const se = () => {
94
+ V.value = 0, setTimeout(() => {
95
+ g.value = !1;
96
+ }, i.fadeDuration);
97
+ }, ie = (u) => {
98
+ console.error("[MyopComponent] Error:", u), se(), E.value = !0, a("error", u);
99
+ }, le = async (u) => {
100
+ var N, L;
101
+ oe.value = !0;
102
+ let f = !1;
103
+ try {
104
+ const m = JSON.parse(JSON.stringify({
105
+ componentId: u.componentId,
106
+ data: u.data,
107
+ environment: u.environment,
108
+ preview: u.preview,
109
+ autoSize: u.autoSize
110
+ }));
111
+ if (!m.componentId && !u.componentConfig) {
112
+ ie("No component configuration provided");
589
113
  return;
590
- }
591
- if (s.messageType) {
592
- if (s.messageType === g.CleanupMessage) {
593
- const n = s, i = this.messageCleanupCache[n.cleanupForMessageId], o = new ft(!!i);
594
- o.destination = s.destination, i ? (delete this.messageCleanupCache[n.cleanupForMessageId], zs(i).then(() => {
595
- this.messageToHost(o, n);
596
- }).catch(() => {
597
- })) : this.messageToHost(o, n);
114
+ }
115
+ const rt = m.preview === !0 ? !0 : void 0, st = u.componentConfig ? JSON.parse(JSON.stringify(u.componentConfig)) : await gn().fetchComponentV2(
116
+ m.componentId,
117
+ m.environment,
118
+ rt
119
+ );
120
+ if (!l.value) {
121
+ ie("Container element not found");
598
122
  return;
599
123
  }
600
- this.supportedHandlers.forEach((n) => {
601
- if (n.messageType === s.messageType) {
602
- const i = n.executor(s);
603
- if (s.cleanable && i && (this.messageCleanupCache[s.id] = i), i && !s.cleanable)
604
- throw new Error(`Cleanup handler generated for non-cleanable message.
605
- messageType - ${s.messageType}, handler executor was - ${n.executor}
606
-
607
- Please review the message definition object & message handler.
608
- To ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers.`);
609
- if (!i && s.cleanable)
610
- throw new Error(`No cleanup handler generated for a cleanable message.
611
- messageType - ${s.messageType}, handler executor was - ${n.executor}
612
-
613
- Please review the message definition object & message handler.
614
- To ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers.`);
124
+ const it = Ie({
125
+ data: m.data,
126
+ _environment: {
127
+ props: m
615
128
  }
616
- });
617
- } else
618
- console.log("unsupported message type");
619
- }
620
- }
621
- }, Ie = {
622
- IframeLoader: "IframeLoader",
623
- WebComponentLoader: "WebComponentLoader",
624
- HTMLLoader: "HTMLLoader"
625
- }, ve = {
626
- open: "open",
627
- none: "none",
628
- localFrame: "localFrame"
629
- }, Te = class {
630
- };
631
- a(Te, "code", "code");
632
- a(Te, "component", "component");
633
- var Q = {
634
- Segmented: "Segmented",
635
- Dedicated: "Dedicated",
636
- /**
637
- * This Selector Type is not yet supported but will be added in a future release.
638
- * Please check the documentation for updates.
639
- *
640
- * @type {string}
641
- */
642
- Default: "Default"
643
- }, gt = {
644
- Segment: "Segment",
645
- Promo: "Promo",
646
- AB: "AB"
647
- }, Js = class {
648
- constructor(e, t) {
649
- this.container = e, this.shadowRoot = t, a(this, "getRootDiv", () => (this.shadowRoot || this.container).querySelector("div")), a(this, "getRoot", () => this.shadowRoot || this.container);
650
- }
651
- }, we = (e) => e !== Object(e), Ys = (e) => typeof e == "function", yt = (e) => {
652
- if (we(e))
653
- return !0;
654
- if (Ys(e) || Object.getPrototypeOf(e))
655
- return !1;
656
- for (const t in e) {
657
- const s = e[t];
658
- if (typeof s == "object") {
659
- if (!yt(s))
660
- return !1;
661
- } else {
662
- if (we(s))
663
- continue;
664
- return !1;
665
- }
666
- }
667
- return !0;
668
- }, L = (e, t = {}, s = !0, n = /* @__PURE__ */ new WeakMap()) => {
669
- if (we(e))
670
- return e;
671
- if (Array.isArray(e)) {
672
- if (n.has(e))
673
- return n.get(e);
674
- const i = [];
675
- n.set(e, i);
676
- for (let o = 0; o < e.length; o++) {
677
- const r = e[o];
678
- i[o] = L(r, t, s, n);
679
- }
680
- return i;
681
- }
682
- if (e !== null && typeof e == "object") {
683
- if (n.has(e))
684
- return n.get(e);
685
- const i = {};
686
- n.set(e, i);
687
- for (const o in e) {
688
- const r = typeof t == "boolean" ? t : t[o];
689
- r && (r === !0 ? (s ? e[o] !== void 0 : e[o]) && (i[o] = L(e[o], !0, s, n)) : typeof r == "object" && (i[o] = L(e[o], r, s, n)));
690
- }
691
- return i;
692
- }
693
- return {};
694
- }, Xs = {
695
- notSerializableRefCall: (e, t) => {
696
- throw new Error(`
697
- The input provided to '${e.toString()}' is not serializable. Serialization is required to ensure that the data can be safely transferred to the skin implementation.
698
- The following types of data are considered non-serializable and cannot be processed:
699
-
700
- - Functions
701
- - DOM elements
702
- - Class instances
703
- - Circular references
704
- - Symbols
705
- - BigInt values
706
-
707
- In the following execution we detected :
708
- ~~~~~~~~
709
- ${t}
710
- ~~~~~~~~
711
- as not serializable.
712
-
713
- To resolve this issue, please ensure that all inputs passed to '${e.toString()}' are in a serializable format.
714
- This typically includes primitive types (strings, numbers, booleans), arrays, and plain objects.
715
- If you need to include complex data types, consider converting them to a serializable structure before passing them to the function.
716
- Or use Myop message that support it: CustomRefMessage, AddEventListenerMessage or ExecuteScriptMessage.
717
-
718
- Suggested Fix:
719
- 1. Remove or replace non-serializable values from your input.
720
- 2. If using objects, ensure they do not contain any functions or circular references.
721
- 3. Convert any class instances to plain objects or JSON-compatible formats.
722
- 4. Use dedicated Myop message.
723
-
724
- For more details on serialization and Myop message examples, refer to https://docs.myop.dev.
725
-
726
- `);
727
- }
728
- }, Ve = class extends Se {
729
- constructor(e, t, s) {
730
- super(e, t.container, s), this.componentDefinition = e, this.parent = t, a(this, "send", (n) => {
731
- const i = n.handler, o = super.send(n);
732
- return this.parent.send(new lt(this.id, n)), n.handler = i, o;
733
- }), a(this, "dispose", () => {
734
- this.isInitiated && this.send(new R("dispose")), super.dispose();
735
- });
736
- }
737
- hide() {
738
- this.send(new R("hide"));
739
- }
740
- show() {
741
- this.send(new R("show"));
742
- }
743
- inspect() {
744
- return this.send(new R("inspect"));
745
- }
746
- setHeightBasedOnDocumentElement() {
747
- this.send(new R("setHeightBasedOnDocumentElement"));
748
- }
749
- setHeightBasedOnScrollHeight() {
750
- this.send(new R("setHeightBasedOnScrollHeight"));
751
- }
752
- onMessageReceived(e) {
753
- return super.onMessageReceived(e);
754
- }
755
- }, Qs = (e, t, s) => {
756
- const n = document.createElement("a");
757
- return n.textContent = e, n.style.position = "relative", n.style.padding = "0 5px", n.style.fontSize = "14px", n.style.top = "0", n.style.top = `${t}px`, n.style.transform = "translateX(-50%)", n.target = "_blank", n.href = `https://dashboard.myop.dev/dashboard/component/${s.id}`, n;
758
- }, vt = (e, t, s, n, i, o) => {
759
- const r = Qs(`${o.name} : ${t}`, s, o);
760
- return n.insertBefore(r, i), i.style.border = "1px solid #007BFF", i.style.display = "block", () => {
761
- i.style.border = "unset", n.removeChild(r);
762
- };
763
- }, Zs = (e, t) => {
764
- const s = t.reduce((i, o) => G(v({}, i), {
765
- [o.name]: v({}, o)
766
- }), {}), n = {
767
- get: (i, o) => {
768
- const r = s[o];
769
- return r.mode === "output" ? new Promise((l) => {
770
- const c = [];
771
- r.behavior.ref && c.push(z.create(r.behavior.ref)), c.push((u) => {
772
- l(u);
773
- }), r.behavior.params && c.push(...r.behavior.params);
774
- const d = me[r.behavior.message];
775
- e.send(new d(...c));
776
- }) : null;
777
- },
778
- set: (i, o, r) => {
779
- const l = s[o];
780
- if (!l)
781
- throw new Error(
782
- `Error: Undefined Prop
783
-
784
- It looks like you've tried to use a prop that hasn't been defined.
785
- Please check the prop name for any typos or ensure that it is properly defined in the component's prop list.
786
-
787
- Prop Name: ${o}
788
- Component: ${e.componentDefinition.name}, ID: ${e.componentDefinition.id}
789
-
790
- For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${e.componentDefinition.id} or consult the developer guide.`
129
+ }), we = await Te.loadComponent(
130
+ st,
131
+ l.value,
132
+ it
791
133
  );
792
- if (l.mode === "input")
793
- if (l.behavior.type === "message") {
794
- const c = [];
795
- l.behavior.ref && c.push(z.create(l.behavior.ref)), c.push(r), l.behavior.params && c.push(...l.behavior.params);
796
- const d = me[l.behavior.message];
797
- return e.send(new d(...c)), !0;
798
- } else
799
- throw new Error(
800
- `Error: Unsupported Behavior
801
-
802
- The 'behavior' field provided is not supported.
803
- Component: ${e.componentDefinition.name}, ID: ${e.componentDefinition.id}
804
-
805
- Prop Name: ${o}
806
- Behavior Field: ${l.behavior.type}
807
-
808
- Check the documentation for valid behavior options.`
809
- );
810
- return !1;
811
- }
812
- };
813
- return e.props = {}, e.props = new Proxy(e.props, n), e;
814
- }, en = (e, t) => new Proxy(e, {
815
- get(s, n) {
816
- return s[n] ? s[n] : (...o) => new Promise((r) => {
817
- o.forEach((l) => {
818
- yt(l) || Xs.notSerializableRefCall(n, l);
819
- }), t.send(new ge(
820
- ({ ref: l, propName: c, functionArgs: d, makeSerializable: u }) => {
821
- if (l) {
822
- const h = l[c];
823
- return u(typeof h == "function" ? l[c](...d) : h, !0);
824
- }
825
- return null;
826
- },
827
- {
828
- //TODO : turn it to config
829
- elementId: s.refConfig.selector,
830
- propName: n,
831
- functionArgs: o
832
- },
833
- (l) => {
834
- r(l.content);
134
+ if (f) {
135
+ we.dispose();
136
+ return;
835
137
  }
836
- ));
837
- });
838
- },
839
- set(s, n, i) {
840
- return t.send(new ge(
841
- ({ ref: o, propName: r, propValue: l }) => {
842
- o && (o[r] = l);
843
- },
844
- {
845
- //TODO : fix that
846
- elementId: s.refConfig.selector,
847
- propValue: i,
848
- propName: n
849
- },
850
- (o) => {
851
- }
852
- )), !0;
853
- }
854
- }), wt = (e, t, s, n) => m(void 0, null, function* () {
855
- const i = e.component;
856
- if (!i)
857
- throw new Error("cant createRefComponent with detached ref");
858
- return new Promise((o, r) => m(void 0, null, function* () {
859
- const l = new Ve(t.type, i, n);
860
- s.push(l), yield i.initiated();
861
- const c = setTimeout(() => {
862
- r("timeout");
863
- }, 5e3);
864
- i.send(new at(
865
- e.refConfig,
866
- t,
867
- G(v({}, n || {}), {
868
- id: l.id,
869
- _hasParent: !0
870
- }),
871
- (d) => m(void 0, null, function* () {
872
- if (clearTimeout(c), d.failed) {
873
- r("CreateRefComponentMessage failed");
138
+ if (c.value = Ie(we), await c.value.initiated(), f) {
139
+ (N = c.value) == null || N.dispose();
874
140
  return;
875
141
  }
876
- const u = s.find((h) => h.id == l.id);
877
- if (u !== l) {
878
- i.refs[e.refConfig.name] = u, o(u);
142
+ if (await new Promise((j) => requestAnimationFrame(j)), f || !c.value || c.value.markedForDisposed) {
143
+ c.value && !c.value.markedForDisposed && c.value.dispose();
879
144
  return;
880
- } else
881
- l.setInitiated(), i.refs[e.refConfig.name] = l;
882
- d.nestedRefs.forEach((h) => {
883
- const f = t.instance.resolvedNestedComponents.find((M) => M.type.id === h.componentDefinitionId).type, y = new Ve(f, l);
884
- y.setInitiated(), l.refs[h.refName] = y, s.push(y);
885
- });
886
- try {
887
- yield Mt(l, t, s, !0), i.setHeightBasedOnScrollHeight && i.setHeightBasedOnScrollHeight(), o(l);
888
- } catch (h) {
889
- r(h);
890
145
  }
891
- })
892
- ));
893
- }));
894
- }), Mt = (e, t, s, n = !1) => m(void 0, null, function* () {
895
- e.refs || (e.refs = {});
896
- const i = Object.values(e.componentDefinition.refs).map((o) => new Promise((r, l) => m(void 0, null, function* () {
897
- var c;
898
- if (o.behavior.type == Te.component) {
899
- if (n) {
900
- r();
901
- return;
902
- }
903
- let d = o.behavior.componentId;
904
- d || (d = o.behavior.instance.componentId);
905
- const u = (c = t.instance.resolvedNestedComponents) == null ? void 0 : c.find((f) => f.type.id === d);
906
- if (!u)
907
- throw new Error("componentConfig provided without nestedComponentConfig check the config object");
908
- const h = z.create("", o, e);
909
- try {
910
- const f = yield wt(h, u, s);
911
- e.refs[o.name] = f, r();
912
- } catch (f) {
913
- l(f);
914
- }
915
- } else
916
- try {
917
- const d = z.create("", o, e);
918
- e.refs[o.name] = en(d, e), r();
919
- } catch {
920
- }
921
- })));
922
- try {
923
- yield Promise.all(i);
924
- } catch (o) {
925
- throw o;
926
- }
927
- }), _t = class extends Se {
928
- constructor(e, t, s, n, i) {
929
- super(e, s, i), this.componentConfig = e, this.container = s, this.IframeElement = n, a(this, "cleanupInspect"), a(this, "setHeightBasedOnDocumentElement", () => {
930
- const o = this.send(new H(() => window.document.documentElement.scrollHeight, (r) => {
931
- this.IframeElement.style.height = `${r.content}px`, o();
932
- }));
933
- }), a(this, "observeSizeBasedOnDocumentElement", () => {
934
- this.send(new H(({ send: o }) => {
935
- const { height: r, width: l } = document.documentElement.getBoundingClientRect(), c = new ResizeObserver(() => {
936
- const { height: d, width: u } = document.documentElement.getBoundingClientRect();
937
- o({ height: d, width: u });
938
- });
939
- return c.observe(document.documentElement), c.observe(document.body), { height: r, width: l };
940
- }, (o) => {
941
- this.IframeElement.style.width = `${o.content.width}px`, this.IframeElement.style.height = `${o.content.height}px`;
942
- }));
943
- }), a(this, "setSizeBasedOnDocumentElement", () => {
944
- const o = this.send(new H(() => {
945
- const { height: r, width: l } = document.documentElement.getBoundingClientRect();
946
- return { height: r, width: l };
947
- }, (r) => {
948
- this.IframeElement.style.width = `${r.content.width}px`, this.IframeElement.style.height = `${r.content.height}px`, o();
949
- }));
950
- }), a(this, "setHeightBasedOnScrollHeight", () => {
951
- const o = this.send(new H(() => {
952
- let l = 0;
953
- return l++, l--, Math.max(
954
- Math.max(
955
- window.document.body.clientHeight,
956
- window.document.body.scrollHeight
957
- ),
958
- window.document.body.offsetHeight
959
- ) + l + "px";
960
- }, (r) => {
961
- this.IframeElement.style.height = r.content, o();
962
- }));
963
- }), a(this, "send", (o) => {
964
- var r, l;
965
- let c = v({}, o);
966
- if (c.messageType === g.ExecuteComponentMethod)
967
- return this[c.method](), () => {
968
- };
969
- c.direction = b.down;
970
- const d = super.send(c);
971
- return (l = (r = this.IframeElement) == null ? void 0 : r.contentWindow) == null || l.postMessage(c, "*"), d;
972
- }), a(this, "dispose", () => {
973
- this.cleanupInspect && this.cleanupInspect(), super.dispose(), this.IframeElement.parentNode.removeChild(this.IframeElement);
974
- }), t.loader.autoHeight && this.initiated().then(() => {
975
- this.setHeightBasedOnScrollHeight();
976
- }), this.element = this.IframeElement;
977
- }
978
- inspect() {
979
- return this.cleanupInspect ? this.cleanupInspect : (this.cleanupInspect = vt(this.id, "MyopIframeComponent", 10, this.container, this.IframeElement, this.componentDefinition), () => {
980
- this.cleanupInspect(), this.cleanupInspect = void 0;
981
- });
982
- }
983
- hide() {
984
- this.IframeElement.style.opacity = "0", this.IframeElement.style.position = "absolute", this.IframeElement.style.pointerEvents = "none", this.IframeElement.style.visibility = "hidden";
985
- }
986
- show() {
987
- this.IframeElement.style.opacity = "1", this.IframeElement.style.position = "unset", this.IframeElement.style.pointerEvents = "all", this.IframeElement.style.visibility = "visible";
988
- }
989
- onMessageReceived(e) {
990
- return e.messageType === g.In.MutationObserverMessage || e.messageType === g.In.ResizeObserverMessage ? (this.setHeightBasedOnScrollHeight(), !0) : super.onMessageReceived(e);
991
- }
992
- }, xe = class {
993
- constructor() {
994
- a(this, "appendChild", (e, t, s) => {
995
- var n;
996
- if (s != null && s.relative) {
997
- if (s.relative.direction === "before")
998
- return e.insertBefore(t, s.relative.child);
999
- if (s.relative.direction === "after") {
1000
- const i = (n = s.relative.child) == null ? void 0 : n.nextSibling;
1001
- return e.insertBefore(t, i || null);
146
+ F.value = !0, i.autoSize || se(), (L = c.value) != null && L.props && (c.value.props.myop_cta_handler = (j, Oe) => {
147
+ i.on && i.on(j, Oe), a("cta", j, Oe);
148
+ }), a("load", c.value);
149
+ } catch (m) {
150
+ f || ie((m == null ? void 0 : m.message) || "Unknown error");
151
+ } finally {
152
+ if (oe.value = !1, P.value !== null && !f) {
153
+ const m = P.value;
154
+ P.value = null, await le(m);
1002
155
  }
1003
- } else
1004
- return e.appendChild(t);
1005
- });
1006
- }
1007
- }, tn = (e, t, s) => {
1008
- const n = new URL(e);
1009
- return n.searchParams.append(t, s), n.toString();
1010
- }, sn = class extends xe {
1011
- constructor() {
1012
- super(...arguments), a(this, "type", Ie.IframeLoader), a(this, "load", (e, t, s, n) => m(this, null, function* () {
1013
- let i;
1014
- const o = t.loader;
1015
- if ((s == null ? void 0 : s.nodeName) === "IFRAME")
1016
- console.log("needs to load into an exsisting Iframe...", o.url, s), i = s, i.src = o.url;
1017
- else {
1018
- const r = B(), l = `myop-comp-${r}`;
1019
- i = document.createElement("iframe"), s.querySelector('[id^="myop-comp-"]') || (s.innerHTML = ""), n != null && n.hidden && (i.style.visibility = "hidden"), i = this.appendChild(s, i, n);
1020
- let c = t.loader.url;
1021
- n != null && n._hasParent && (c = tn(c, "_myop-comp", r));
1022
- let d = "";
1023
- n != null && n.elementAttributes && (d = Object.entries(n == null ? void 0 : n.elementAttributes).map(([u, h]) => h === "" || h === null || h === void 0 ? u : `${u}="${String(h)}"`).join(" ")), i.outerHTML = `<iframe
1024
- id="${l}"
1025
- style="
1026
- padding: 0;
1027
- margin: 0;
1028
- height: ${o.autoHeight || !o.height ? "" : o.height};
1029
- width : 100%;
1030
- overflow: hidden;
1031
- border: none;
1032
- opacity: ${n != null && n.hidden ? "0" : "1"};
1033
- position: ${n != null && n.hidden ? "absolute" : "static"};
1034
- pointer-events: ${n != null && n.hidden ? "none" : "all"};
1035
- "
1036
- src="${c}"
1037
- ${d}
1038
- ></iframe>`, i = s.querySelector(`#${l}`);
1039
- }
1040
- return new _t(e, t, s, i, n);
1041
- }));
1042
- }
1043
- }, Et = {
1044
- webcomponent_message_key: "myop_webcomponent_message"
1045
- }, bt = class extends Se {
1046
- constructor(e, t, s, n, i) {
1047
- super(e, s, i), this.container = s, this.customElement = n, a(this, "cleanupInspect", () => {
1048
- }), a(this, "send", (o) => {
1049
- let r = v({}, o);
1050
- const l = super.send(r), c = new CustomEvent(Et.webcomponent_message_key, {
1051
- // @ts-ignore
1052
- detail: r
1053
- // bubbles: true,
1054
- // cancelable: false,
1055
- // composed: true
1056
- });
1057
- try {
1058
- this.customElement.dispatchEvent(c);
1059
- } catch (d) {
1060
- console.log("error while trying to dispatchEvent", d);
1061
156
  }
1062
- return l;
1063
- }), a(this, "dispose", () => {
1064
- var o;
1065
- super.dispose(), (o = this.customElement.parentNode) == null || o.removeChild(this.customElement);
1066
- }), this.element = n;
1067
- }
1068
- inspect() {
1069
- return this.cleanupInspect = vt(this.id, "MyopWebComponent", 0, this.container, this.customElement, this.componentDefinition), this.cleanupInspect;
1070
- }
1071
- hide() {
1072
- this.customElement.style.opacity = "0", this.customElement.style.position = "absolute", this.customElement.style.pointerEvents = "none", this.customElement.style.visibility = "hidden", this.customElement.style.height = "0", this.customElement.style.width = "0";
1073
- }
1074
- show() {
1075
- this.customElement.style.opacity = "1", this.customElement.style.position = "unset", this.customElement.style.pointerEvents = "all", this.customElement.style.visibility = "visible", this.customElement.style.height = "", this.customElement.style.width = "";
1076
- }
1077
- }, ce = {}, nn = class extends xe {
1078
- constructor() {
1079
- super(...arguments), a(this, "type", Ie.WebComponentLoader), a(this, "load", (e, t, s, n) => m(this, null, function* () {
1080
- const i = t.loader;
1081
- ce[i.url] ? console.log("Module alreday loaded or in loading process") : ce[i.url] = new Promise((l, c) => {
1082
- const d = i.url, u = document.createElement("script");
1083
- u.type = "module", u.src = d, u.onload = () => {
1084
- l();
1085
- }, u.onerror = () => {
1086
- c();
1087
- }, document.head.appendChild(u);
1088
- }), yield ce[i.url], yield Is(1);
1089
- let o = `myop-comp-${B()}`;
1090
- const r = document.createElement(i.tag);
1091
- return s.querySelector('[id^="myop-comp-"]') || (s.innerHTML = ""), r.id = o, n != null && n.hidden && (r.style.opacity = "0", r.style.position = "absolute", r.style.height = "0", r.style.width = "0", r.style.pointerEvents = "none", r.style.visibility = "hidden"), n != null && n._environment && (r._myopEnvironment = n == null ? void 0 : n._environment), this.appendChild(s, r, n), new bt(e, t, s, r, n);
1092
- }));
1093
- }
1094
- }, on = "0.1.42", x = class extends js {
1095
- constructor(e, t) {
1096
- super(e), this.context = t, a(this, "executor", (s) => {
1097
- if (s.destination) {
1098
- const n = s.destination;
1099
- if (this.context[n].context) {
1100
- const i = (o, r) => {
1101
- this.messageToHost(G(v({}, o), {
1102
- source: s.destination ? s.destination : s.source,
1103
- destination: s.source ? s.source : s.destination
1104
- }), r);
1105
- };
1106
- return this.innerExecutor(s, this.context[n].context, i);
1107
- } else
1108
- debugger;
1109
- } else
1110
- debugger;
1111
- });
1112
- }
1113
- }, q = {
1114
- id: "myop-id"
1115
- }, V = (e, t) => t.querySelectorAll(`[${q.id}='${e.refConfig.selector}']`), rn = class extends x {
1116
- constructor() {
1117
- super(...arguments), a(this, "messageType", g.BindClickMessage), a(this, "innerExecutor", (e, t, s) => {
1118
- const n = V(e.ref, t.shadowRoot), i = [];
1119
- return n.forEach((o) => {
1120
- const r = () => {
1121
- s(new Ye(e.handlerUniqueId));
1122
- };
1123
- o.addEventListener("click", r), i.push(() => {
1124
- o.removeEventListener("click", r);
1125
- });
1126
- }), () => {
1127
- i.forEach((o) => o());
157
+ return () => {
158
+ f = !0;
1128
159
  };
1129
- });
1130
- }
1131
- }, an = class extends x {
1132
- constructor() {
1133
- super(...arguments), a(this, "messageType", g.ChangeTextMessage), a(this, "innerExecutor", (e, t) => {
1134
- V(e.ref, t.shadowRoot).forEach((n) => {
1135
- n.textContent = e.content;
1136
- });
1137
- });
1138
- }
1139
- }, ln = class extends Js {
1140
- constructor(e, t) {
1141
- super(e, t), this.container = e, this.shadowRoot = t;
1142
- }
1143
- }, cn = class extends x {
1144
- constructor() {
1145
- super(...arguments), a(this, "innerExecutor", (e, t) => {
1146
- const s = t.shadowRoot.querySelectorAll(`[${q.id}]`);
1147
- let n = [];
1148
- s.forEach((i) => {
1149
- const o = i.getAttribute(q.id);
1150
- o && n.push(new Us(o, i.tagName, i.getBoundingClientRect(), i.offsetTop, i.offsetLeft));
1151
- }), this.messageToHost(new dt(e.handlerUniqueId, n));
1152
- }), a(this, "messageType", g.DetectMyopRefsMessage);
1153
- }
1154
- }, dn = class extends x {
1155
- constructor() {
1156
- super(...arguments), a(this, "messageType", g.SetAttributeMessage), a(this, "innerExecutor", (e, t) => {
1157
- V(e.ref, t.shadowRoot).forEach((n) => {
1158
- n.setAttribute(e.name, e.value);
1159
- });
1160
- });
1161
- }
1162
- }, un = class extends x {
1163
- constructor() {
1164
- super(...arguments), a(this, "messageType", g.AddEventListenerMessage), a(this, "innerExecutor", (e, t, s) => {
1165
- const n = V(e.ref, t.shadowRoot), i = [];
1166
- return n.forEach((o) => {
1167
- const r = (l) => {
1168
- s(new tt(e.handlerUniqueId, L(l, e.serializableSkeleton)));
1169
- };
1170
- o.addEventListener(e.type, r), i.push(() => {
1171
- o.removeEventListener(e.type, r);
1172
- });
1173
- }), () => {
1174
- i.forEach((o) => o());
1175
- };
1176
- });
1177
- }
1178
- }, hn = class extends x {
1179
- constructor() {
1180
- super(...arguments), a(this, "messageType", g.CreateRefComponentMessage), a(this, "innerExecutor", (e, t, s) => {
1181
- m(this, null, function* () {
1182
- const i = t.shadowRoot.querySelectorAll(`[${q.id}='${e.refConfig.selector}']`);
1183
- if (i.length === 1) {
1184
- const o = oe.Instance(), r = o.components.find((u) => u.id === e.options.id);
1185
- r && r.dispose();
1186
- const l = o.components.indexOf(r);
1187
- l !== -1 && o.components.splice(l, 1);
1188
- const c = yield o.loadComponent(
1189
- e.nestedComponentConfig,
1190
- i.item(0),
1191
- e.options
1192
- ), d = [];
1193
- Object.keys(c.refs).forEach((u) => {
1194
- let h = c.refs[u];
1195
- h = h.__nonProxied || h, h.componentDefinition && d.push({
1196
- refName: u,
1197
- componentDefinitionId: h.componentDefinition.id
1198
- });
1199
- }), s(new ye(e.handlerUniqueId, d));
1200
- } else {
1201
- console.error("CreateRefComponentMessageHandler - DOM element not found"), this.messageToHost(new ye(e.handlerUniqueId, [], !0));
1202
- debugger;
1203
- }
1204
- }).then();
1205
- });
1206
- }
1207
- }, pn = (e, t, s) => {
1208
- const n = e.scriptInputs ? e.scriptInputs : {};
1209
- n.makeSerializable = L, n.send = t, n.rootRef = s, n.__scriptInputs = n;
1210
- const o = new Function(`return (${e.script})(...arguments)`)(n);
1211
- t(o);
1212
- }, fn = class extends x {
1213
- constructor() {
1214
- super(...arguments), a(this, "messageType", g.ExecuteScriptMessage), a(this, "innerExecutor", (e, t, s) => {
1215
- pn(e, (i) => {
1216
- s(new Ze(e.handlerUniqueId, i));
1217
- }, t);
1218
- });
1219
- }
1220
- }, Ct = (e) => {
1221
- if (!e) return null;
1222
- if (e.tagName === "FORM") {
1223
- new FormData(e);
1224
- const t = {
1225
- formData: {},
1226
- unmappedData: []
1227
- };
1228
- return e.querySelectorAll("input, select, textarea").forEach((n) => {
1229
- if (typeof n.value == "string") {
1230
- const i = n.getAttribute(q.id);
1231
- let o = n.getAttribute("name");
1232
- const r = {
1233
- id: n.id,
1234
- name: o,
1235
- value: Ct(n),
1236
- required: n.required,
1237
- validity: L(n.validity, !0),
1238
- myopId: i
1239
- };
1240
- o ? t.formData[o] ? t.formData[o].value ? t.unmappedData.push(r) : (t.unmappedData.push(t.formData[o]), t.formData[o] = r) : t.formData[o] = r : t.unmappedData.push(r);
1241
- }
1242
- }), t;
1243
- }
1244
- return e.type === "checkbox" || e.type === "radio" ? e.checked ? e.value : null : e.tagName === "INPUT" || e.tagName === "TEXTAREA" || e.tagName === "SELECT" ? e.value : e.isContentEditable ? e.innerText || e.textContent : null;
1245
- }, mn = class extends x {
1246
- constructor() {
1247
- super(...arguments), a(this, "messageType", g.GetElementValueMessage), a(this, "innerExecutor", (e, t, s) => {
1248
- V(e.ref, t.shadowRoot).forEach((i) => {
1249
- s(new nt(Ct(i)), e);
1250
- });
1251
- });
1252
- }
1253
- }, gn = class extends x {
1254
- constructor() {
1255
- super(...arguments), a(this, "messageType", g.SetInnerHtml), a(this, "innerExecutor", (e, t) => {
1256
- V(e.ref, t.shadowRoot).forEach((n) => {
1257
- n.innerHTML = e.content;
1258
- });
1259
- });
1260
- }
1261
- }, St = class extends Gs {
1262
- constructor() {
1263
- super(...arguments), a(this, "alwaysPassEnvelopesToHost", !0), a(this, "connectedCallback", (e, t) => {
1264
- e.addEventListener(Et.webcomponent_message_key, (s) => {
1265
- const n = s.data ? s.data : s.detail;
1266
- if (!n || !n.myop) {
1267
- debugger;
1268
- throw new Error("recvied webcomponent_message with wrong type");
1269
- } else {
1270
- const i = n;
1271
- if (this.handleIncomeMessages(s), i.messageType === g.InitMessage) {
1272
- const o = i.content.id;
1273
- this.components[o].context = new ln(e, t);
1274
- }
160
+ }, tt = () => {
161
+ var f;
162
+ if (!F.value || !((f = c.value) != null && f.observeAutoSize))
163
+ return;
164
+ let u = !0;
165
+ R = c.value.observeAutoSize({
166
+ explicitWidth: void 0,
167
+ explicitHeight: void 0,
168
+ forceAutoSize: i.autoSize,
169
+ loaderMinHeight: 50,
170
+ onSizeChange: (N) => {
171
+ a("sizeChange", N), I.value = N, u && (u = !1, se());
1275
172
  }
1276
- }), setTimeout(() => {
1277
- this.messageToHost(new ot());
1278
- }, 1);
1279
- }), a(this, "messageToHost", (e, t) => {
1280
- e.direction = b.up, !e.replayToHandler && (t != null && t.handlerUniqueId) && (e.replayToHandler = t.handlerUniqueId), window.myop.hostSDK.send(e);
1281
- }), a(this, "supportedHandlers", [
1282
- new an(this.messageToHost, this.components),
1283
- new gn(this.messageToHost, this.components),
1284
- new rn(this.messageToHost, this.components),
1285
- new cn(this.messageToHost, this.components),
1286
- new dn(this.messageToHost, this.components),
1287
- new un(this.messageToHost, this.components),
1288
- new fn(this.messageToHost, this.components),
1289
- new mn(this.messageToHost, this.components),
1290
- //
1291
- new hn(this.messageToHost, this.components)
1292
- ]), a(this, "init", () => {
1293
- });
1294
- }
1295
- };
1296
- We("WebComponentSDK", St);
1297
- var Ke = [], Y, It = () => m(void 0, null, function* () {
1298
- return Y || (Y = new St(), Y.init()), Y;
1299
- });
1300
- function yn(e, t) {
1301
- return class extends HTMLElement {
1302
- connectedCallback() {
1303
- const s = t === ve.open ? "open" : "closed", n = this.attachShadow({ mode: s });
1304
- It().then((i) => {
1305
- i.connectedCallback(this, n), n.innerHTML = e;
1306
173
  });
1307
- }
1308
- };
1309
- }
1310
- var vn = (e, t, s) => {
1311
- customElements.define(e, yn(t, s)), console.log(`define('${e}') was called, web component ready to use`);
1312
- }, wn = (e) => e.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/(\d+)/g, "-$1").toLowerCase(), Mn = (e) => (e = wn(e), e.replace(/_/g, "-")), _n = class extends xe {
1313
- constructor() {
1314
- super(...arguments), a(this, "type", Ie.HTMLLoader), a(this, "load", (e, t, s, n) => m(this, null, function* () {
1315
- const i = t.loader;
1316
- let o = `myop-comp-${B()}`, r;
1317
- if (i.shadowRootMode === ve.localFrame) {
1318
- const c = `myop-comp-${B()}`;
1319
- let d = document.createElement("iframe");
1320
- s.querySelector('[id^="myop-comp-"]') || (s.innerHTML = ""), n != null && n.hidden && (d.style.visibility = "hidden"), d = this.appendChild(s, d, n), d.id = c, d.setAttribute("style", `
1321
- padding: 0;
1322
- margin: 0;
1323
- overflow: hidden;
1324
- border: none;
1325
- opacity: ${n != null && n.hidden ? "0" : "1"};
1326
- width: 100%;
1327
- height: 100%;
1328
- position: ${n != null && n.hidden ? "absolute" : "static"};
1329
- pointer-events: ${n != null && n.hidden ? "none" : "all"};
1330
- `), s.appendChild(d);
1331
- const u = d.contentDocument || d.contentWindow.document;
1332
- u.open();
1333
- let h = i.HTML;
1334
- if (n != null && n._inspection) {
1335
- const M = new DOMParser().parseFromString(i.HTML, "text/html"), Ne = M.implementation.createHTMLDocument();
1336
- Ne.body.innerHTML = `<script>
1337
- const beforeKeysWindow = new Set(Object.keys(window));
1338
- window.myopState = {
1339
- beforeKeysWindow,
1340
- };
1341
- <\/script>`;
1342
- const Fe = Ne.body.firstChild;
1343
- Fe && M.head && M.head.insertBefore(M.importNode(Fe, !0), M.head.firstChild), h = M.documentElement.outerHTML;
1344
- }
1345
- u.writeln(h), u.writeln(`<script src="${window.myop.__ROOT_SDK_PUBLIC_URL__}"><\/script>
1346
- <script>
1347
- window.__federation__ =
1348
- { ...window.__federation__,
1349
- //TODO : get from ENV at build time,
1350
- // inject value to module at build time
1351
- // today we doing so just for the CJS version
1352
- __public_path__ :'https://cdn.myop.dev/sdk/next',
1353
- ...${JSON.stringify(
1354
- // @ts-ignore
1355
- window.__federation__
1356
- )}};
1357
- const init = async () => {
1358
- const {IframeSDK} = (await window.myop.rootSDK.getIframeModule());
1359
- const sdk = new IframeSDK()
1360
- sdk.init();
1361
- }
1362
- init().then();
1363
- <\/script>`), u.close();
1364
- const f = new _t(e, t, s, d, n);
1365
- return d.onload = () => {
1366
- f.observeSizeBasedOnDocumentElement();
1367
- }, f;
1368
- }
1369
- if (i.shadowRootMode === ve.none) {
1370
- const l = document.createElement("template");
1371
- l.innerHTML = i.HTML, r = l.content.firstElementChild, It().then((c) => {
1372
- c.connectedCallback(r, r);
1373
- });
1374
- } else {
1375
- const l = Mn(e.name + t.id);
1376
- Ke.includes(l) || (vn(l, i.HTML, i.shadowRootMode), Ke.push(l)), r = document.createElement(l);
174
+ };
175
+ ae(
176
+ () => i.componentId,
177
+ async (u, f) => {
178
+ u !== f && (re.value = !1, F.value = !1, E.value = !1, g.value = !0, V.value = 1, c.value && (c.value.dispose(), c.value = null), R && (R(), R = null), oe.value ? P.value = { ...i } : await le(i));
1377
179
  }
1378
- return s.querySelector('[id^="myop-comp-"]') || (s.innerHTML = ""), r.id = o, n != null && n.hidden && (r.style.opacity = "0", r.style.position = "absolute", r.style.height = "0", r.style.width = "0", r.style.pointerEvents = "none", r.style.visibility = "hidden"), this.appendChild(s, r, n), new bt(e, t, s, r, n);
1379
- }));
1380
- }
1381
- }, Me = class {
1382
- // private components: Record<string, Promise<IUserFlow>> = {};
1383
- constructor(t = "https://cloud.myop.dev") {
1384
- this._baseUrl = t, a(this, "userFlows", {});
1385
- }
1386
- fetchComponent(t, s) {
1387
- return m(this, null, function* () {
1388
- return s ? (yield this.fetchFlow(s)).components.find((i) => i.type.id === t) : (yield this.fetchAutoFlow(t)).components[0];
1389
- });
1390
- }
1391
- fetchAutoFlow(t) {
1392
- return m(this, null, function* () {
1393
- return this.userFlows[t] || (this.userFlows[t] = new Promise(
1394
- (s, n) => m(this, null, function* () {
1395
- try {
1396
- const o = yield (yield fetch(
1397
- `${this._baseUrl}/flow?id=${t}&auto=true`
1398
- )).json();
1399
- s(o.item);
1400
- } catch (i) {
1401
- n(i);
180
+ ), ae(
181
+ () => i.data,
182
+ (u) => {
183
+ var f;
184
+ if (F.value && u !== void 0 && c.value) {
185
+ if (!re.value) {
186
+ re.value = !0;
187
+ return;
1402
188
  }
1403
- })
1404
- )), yield this.userFlows[t];
1405
- });
1406
- }
1407
- fetchFlow(t) {
1408
- return m(this, null, function* () {
1409
- return this.userFlows[t] || (this.userFlows[t] = new Promise(
1410
- (s, n) => m(this, null, function* () {
1411
- try {
1412
- const o = yield (yield fetch(
1413
- `${this._baseUrl}/flow?id=${t}&resolve=components`
1414
- )).json();
1415
- s(o.item);
1416
- } catch (i) {
1417
- n(i);
189
+ const N = (f = c.value.props) == null ? void 0 : f.myop_init_interface;
190
+ if (N) {
191
+ const L = JSON.parse(JSON.stringify(u));
192
+ N(L);
1418
193
  }
1419
- })
1420
- )), yield this.userFlows[t];
1421
- });
1422
- }
1423
- };
1424
- a(Me, "Main", new Me());
1425
- var En = Me, bn = (e) => m(void 0, null, function* () {
1426
- try {
1427
- const t = new URL(window.location.href), n = new URLSearchParams(t.search).get("myopOverride");
1428
- if (n) {
1429
- const [i, o] = Ss(n), l = (yield En.Main.fetchFlow(i)).components.find((c) => c.type.id === e.type.id);
1430
- if (l && l.instance.skinSelector.type === Q.Segmented && l.instance.resolvedExperiences) {
1431
- const c = l.instance.resolvedExperiences.find((d) => d.id === o);
1432
- if ((c == null ? void 0 : c.type) === gt.Segment) {
1433
- const d = c, h = l.instance.skinSelector.segments.find((f) => f.segmentId === d.segment.id);
1434
- if (h)
1435
- return l.instance.skinSelector = h == null ? void 0 : h.skinSelector, l;
1436
194
  }
195
+ },
196
+ { deep: !0 }
197
+ ), ae(
198
+ () => F.value,
199
+ (u) => {
200
+ u && i.autoSize && tt();
1437
201
  }
1438
- }
1439
- } catch {
1440
- return null;
1441
- }
1442
- }), Tt = "https://cdn.myop.dev/sdk/next/myop_sdk.min.js", oe = class {
1443
- constructor() {
1444
- a(this, "components2init", []), a(this, "components", []), a(this, "componentsLoaders", []), a(this, "initiated", !1), a(this, "version", on), a(this, "type2InstanceCount", {}), a(this, "assignId", (e) => (this.type2InstanceCount[e.id] || (this.type2InstanceCount[e.id] = 0), `${e.id}_${++this.type2InstanceCount[e.id]}`)), a(this, "inspected", !1), a(this, "inspect", () => {
1445
- this.inspected || (this.inspected = !0, this.components.forEach((e) => {
1446
- e.inspect && e.inspect();
1447
- }));
1448
- }), a(this, "incomingMessageHandler", (e) => {
1449
- if (e.origin, document.location.origin, e.data.myop) {
1450
- if (e.data.direction !== b.up && e.data.messageType !== g.EnvelopedMessage)
1451
- return;
1452
- const t = e.data;
1453
- if (t.messageType === g.InitRequest) {
1454
- this.components2init.forEach((n) => {
1455
- n.send(new Ce(n.id));
1456
- });
1457
- return;
1458
- }
1459
- if (t.messageType === g.InitResponse) {
1460
- this.components2init = this.components2init.filter((i) => i.id !== t.content.id);
1461
- const n = this.components.find((i) => {
1462
- var o;
1463
- return i.id === ((o = t.content) == null ? void 0 : o.id);
1464
- });
1465
- n == null || n.setInitiated();
1466
- return;
1467
- }
1468
- if (t.messageType === g.EnvelopedMessage) {
1469
- const n = t, i = this.components.find((o) => o.id === n.destination);
1470
- if (i) {
1471
- if (n.direction === b.down) {
1472
- n.message.messageType === R.name ? i.onMessageReceived(n.message) : (n.message.route = n.route, i.send(n.message));
1473
- return;
1474
- }
1475
- } else {
1476
- const o = this.components.find((r) => r.id === n.message.destination);
1477
- o && o.send(n.message);
1478
- }
1479
- return;
1480
- }
1481
- const s = this.components.find((n) => n.id === t.destination);
1482
- if (!s) {
1483
- window.myop.IframeSDK && window.myop.IframeSDK.messageToHost(t);
1484
- return;
1485
- }
1486
- if (s) {
1487
- if (s.onMessageReceived(t))
1488
- return;
1489
- window.myop.IframeSDK && window.myop.IframeSDK.messageToHost(t);
1490
- }
1491
- }
1492
- }), a(this, "send", (e) => {
1493
- const t = new MessageEvent(
1494
- "",
1495
- { data: e }
1496
- );
1497
- this.incomingMessageHandler(t);
1498
- }), a(this, "init", (e) => {
1499
- if (this.initiated)
1500
- throw new Error("hostSDK already initiated");
1501
- const t = [
1502
- new sn(),
1503
- new nn(),
1504
- new _n()
1505
- ];
1506
- if (this.componentsLoaders = [
1507
- ...t
1508
- ], e) {
1509
- const s = {};
1510
- e.forEach((n) => {
1511
- const i = new n(this.componentsLoaders);
1512
- s[i.type] = i;
1513
- }), this.componentsLoaders.forEach((n) => {
1514
- s[n.type] || (s[n.type] = n);
1515
- }), this.componentsLoaders = Object.values(s);
1516
- }
1517
- window.addEventListener(
1518
- "message",
1519
- this.incomingMessageHandler,
1520
- !1
1521
- ), console.log("myop hostSDK initiated", document.location.href), this.initiated = !0;
1522
- }), a(this, "_getSkinIdBySkinSelector", (e, ...t) => m(this, [e, ...t], function* (s, n = [], i) {
1523
- var o;
1524
- function r(l, c) {
1525
- return m(this, null, function* () {
1526
- for (const d of l)
1527
- if (yield c(d))
1528
- return d;
1529
- });
1530
- }
1531
- switch (s.type) {
1532
- // @ts-ignore
1533
- case "DedicatedSkin":
1534
- //backward compatibility
1535
- case Q.Dedicated:
1536
- return ((o = s.skin) == null ? void 0 : o.id) || s.skins[0].id;
1537
- case Q.Segmented:
1538
- {
1539
- const c = yield r(s.segments, (d) => m(this, null, function* () {
1540
- if (d.segmentId === "Default")
1541
- return !0;
1542
- const u = n.find((M) => M.type === gt.Segment ? M.segment.id === d.segmentId : !1);
1543
- if (!u)
1544
- throw new Error("experience not found");
1545
- const f = u.segment, y = (i || {})[f.function];
1546
- return y ? yield y() : (console.warn(`segmentId:${d.segmentId}, ${f.function} function not provided !`), !1);
1547
- }));
1548
- if (c)
1549
- return this._getSkinIdBySkinSelector(c.skinSelector, n);
1550
- debugger;
1551
- }
1552
- break;
1553
- default:
1554
- debugger;
1555
- }
1556
- return "";
1557
- })), a(this, "runSkinSelector", (e, t) => m(this, null, function* () {
1558
- const s = yield this._getSkinIdBySkinSelector(e.instance.skinSelector, e.instance.resolvedExperiences, t);
1559
- return e.type.skins.find((n) => n.id === s);
1560
- })), a(this, "loaderHooks"), a(this, "loadComponent", (e, t, s) => m(this, null, function* () {
1561
- var n, i, o, r;
1562
- if (!t) {
1563
- debugger;
1564
- throw new Error("no container was found for this component");
1565
- }
1566
- const l = yield bn(e);
1567
- l && (e = l);
1568
- const c = t;
1569
- if (c.myop)
1570
- if (c.component) {
1571
- e = v({}, e), e.instance = v({}, e.instance);
1572
- const f = v(v({}, (n = this.loaderHooks) != null ? n : {}), (i = s == null ? void 0 : s.hooks) != null ? i : {});
1573
- let y = yield this.runSkinSelector(e, f);
1574
- if (!y)
1575
- throw new Error("runSkinSelector failed to choose skin, check the provided config");
1576
- return (o = s == null ? void 0 : s.hooks) != null && o.afterSkinSelected && (y = yield s.hooks.afterSkinSelected(v({}, y))), e.instance.skinSelector = {
1577
- type: Q.Dedicated,
1578
- skin: y
1579
- // skins: [selectedSkin]
1580
- }, s && (s = v({}, s), delete s.hooks), yield wt(c, e, this.components, s);
1581
- } else
1582
- throw new Error("load component got a detached ref.");
1583
- t = t;
1584
- let d = yield this.runSkinSelector(e, s == null ? void 0 : s.hooks);
1585
- if (!d)
1586
- throw new Error("runSkinSelector failed to choose skin, check the provided config");
1587
- (r = s == null ? void 0 : s.hooks) != null && r.afterSkinSelected && (d = yield s.hooks.afterSkinSelected(v({}, d)));
1588
- const u = this.componentsLoaders.find((f) => f.type === d.loader.type);
1589
- if (!u) {
1590
- debugger;
1591
- throw new Error(`no loader "${d.loader.type}" was found for component`);
1592
- }
1593
- let h = yield u.load(e.type, d, t, s);
1594
- h.isInitiated || this.components2init.push(h), h.bind("onDispose", () => (this.components = this.components.filter((f) => f !== h), this.components2init = this.components2init.filter((f) => f !== h), !0)), this.components.push(h), s != null && s.connectProps && (h = Zs(h, e.type.props));
1595
- try {
1596
- yield Mt(h, e, this.components);
1597
- } catch (f) {
1598
- throw f;
1599
- }
1600
- return s != null && s.skipInit || (yield h.initiated()), h;
1601
- })), a(this, "navigate", (e, t, s) => m(this, null, function* () {
1602
- if (e.parent)
1603
- throw new Error("Navigating on remote ref components is not implemented yet");
1604
- if (s != null && s.staged) {
1605
- let n = yield this.loadComponent(t, e.container, v({
1606
- hidden: !0,
1607
- relative: { direction: "after", child: e.element }
1608
- }, s));
1609
- return s.init && (yield s.init(n)), n.show(), e.dispose(), n;
1610
- } else {
1611
- const n = e.element.nextSibling;
1612
- return e.dispose(), this.loadComponent(t, e.container, v({
1613
- relative: {
1614
- direction: "before",
1615
- child: n
1616
- }
1617
- }, s));
202
+ ), Re(async () => {
203
+ (i.componentId || i.componentConfig) && await le(i);
204
+ }), at(() => {
205
+ R && R(), c.value && c.value.dispose();
206
+ });
207
+ const Se = y(
208
+ () => {
209
+ var u, f;
210
+ return ((u = I.value) == null ? void 0 : u.autoSizingWidth) || ((f = I.value) == null ? void 0 : f.autoSizingHeight);
1618
211
  }
212
+ ), be = y(() => g.value ? 50 : void 0), nt = y(() => {
213
+ var u, f;
214
+ return {
215
+ position: "relative",
216
+ width: (u = I.value) != null && u.autoSizingWidth ? `${I.value.width}px` : "100%",
217
+ height: (f = I.value) != null && f.autoSizingHeight ? `${I.value.height}px` : "100%",
218
+ minHeight: be.value ? `${be.value}px` : void 0,
219
+ overflow: Se.value ? "hidden" : "inherit"
220
+ };
221
+ }), ot = y(() => ({
222
+ position: "absolute",
223
+ inset: "0",
224
+ overflow: Se.value ? "hidden" : void 0
1619
225
  }));
226
+ return t({
227
+ myopComponent: c,
228
+ isLoaded: F
229
+ }), (u, f) => (b(), A("div", {
230
+ style: W(nt.value)
231
+ }, [
232
+ $e("div", {
233
+ ref_key: "myopContainer",
234
+ ref: l,
235
+ style: W(ot.value)
236
+ }, null, 4),
237
+ g.value && r.value ? (b(), ke(Ct, {
238
+ key: 0,
239
+ opacity: V.value,
240
+ "fade-duration": e.fadeDuration
241
+ }, {
242
+ default: Ve(() => [
243
+ M(u.$slots, "loader")
244
+ ]),
245
+ _: 3
246
+ }, 8, ["opacity", "fade-duration"])) : pe("", !0),
247
+ E.value ? (b(), ke(Et, { key: 1 }, {
248
+ default: Ve(() => [
249
+ M(u.$slots, "fallback")
250
+ ]),
251
+ _: 3
252
+ })) : pe("", !0)
253
+ ], 4));
1620
254
  }
1621
- };
1622
- a(oe, "Instance", () => window.myop.hostSDK);
1623
- window.myop || (window.myop = {
1624
- __ROOT_SDK_PUBLIC_URL__: Tt
1625
255
  });
1626
- if (!window.myop.hostSDK) {
1627
- const e = new oe();
1628
- e.init(), window.myop || (window.myop = {
1629
- __ROOT_SDK_PUBLIC_URL__: Tt
1630
- }), window.myop.hostSDK = e;
1631
- }
1632
- var xt = window.myop.hostSDK;
1633
- We("hostSDK", xt);
1634
256
  /**
1635
- * @vue/shared v3.5.17
257
+ * @vue/shared v3.5.27
1636
258
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
1637
259
  * @license MIT
1638
260
  **/
1639
- const Cn = process.env.NODE_ENV !== "production" ? Object.freeze({}) : {};
261
+ const Nt = process.env.NODE_ENV !== "production" ? Object.freeze({}) : {};
1640
262
  process.env.NODE_ENV !== "production" && Object.freeze([]);
1641
- const Rt = () => {
1642
- }, Sn = (e) => e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && // uppercase letter
1643
- (e.charCodeAt(2) > 122 || e.charCodeAt(2) < 97), Re = Object.assign, C = Array.isArray, E = (e) => typeof e == "function", O = (e) => typeof e == "string", In = (e) => typeof e == "symbol", j = (e) => e !== null && typeof e == "object", Tn = (e) => (j(e) || E(e)) && E(e.then) && E(e.catch), kt = (e) => {
263
+ const Ae = () => {
264
+ }, St = (e) => e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && // uppercase letter
265
+ (e.charCodeAt(2) > 122 || e.charCodeAt(2) < 97), ye = Object.assign, C = Array.isArray, _ = (e) => typeof e == "function", w = (e) => typeof e == "string", bt = (e) => typeof e == "symbol", H = (e) => e !== null && typeof e == "object", wt = (e) => (H(e) || _(e)) && _(e.then) && _(e.catch), Me = (e) => {
1644
266
  const t = /* @__PURE__ */ Object.create(null);
1645
- return (s) => t[s] || (t[s] = e(s));
1646
- }, xn = kt((e) => e.charAt(0).toUpperCase() + e.slice(1)), Rn = kt(
1647
- (e) => e ? `on${xn(e)}` : ""
267
+ return ((n) => t[n] || (t[n] = e(n)));
268
+ }, Ot = Me((e) => e.charAt(0).toUpperCase() + e.slice(1)), kt = Me(
269
+ (e) => e ? `on${Ot(e)}` : ""
1648
270
  );
1649
- let Ue;
1650
- const re = () => Ue || (Ue = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {});
1651
- function ke(e) {
271
+ let De;
272
+ const ee = () => De || (De = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {});
273
+ function _e(e) {
1652
274
  if (C(e)) {
1653
275
  const t = {};
1654
- for (let s = 0; s < e.length; s++) {
1655
- const n = e[s], i = O(n) ? On(n) : ke(n);
1656
- if (i)
1657
- for (const o in i)
1658
- t[o] = i[o];
276
+ for (let n = 0; n < e.length; n++) {
277
+ const o = e[n], s = w(o) ? Ft(o) : _e(o);
278
+ if (s)
279
+ for (const r in s)
280
+ t[r] = s[r];
1659
281
  }
1660
282
  return t;
1661
- } else if (O(e) || j(e))
283
+ } else if (w(e) || H(e))
1662
284
  return e;
1663
285
  }
1664
- const kn = /;(?![^(]*\))/g, Hn = /:([^]+)/, Dn = /\/\*[^]*?\*\//g;
1665
- function On(e) {
286
+ const Vt = /;(?![^(]*\))/g, It = /:([^]+)/, Dt = /\/\*[^]*?\*\//g;
287
+ function Ft(e) {
1666
288
  const t = {};
1667
- return e.replace(Dn, "").split(kn).forEach((s) => {
1668
- if (s) {
1669
- const n = s.split(Hn);
1670
- n.length > 1 && (t[n[0].trim()] = n[1].trim());
289
+ return e.replace(Dt, "").split(Vt).forEach((n) => {
290
+ if (n) {
291
+ const o = n.split(It);
292
+ o.length > 1 && (t[o[0].trim()] = o[1].trim());
1671
293
  }
1672
294
  }), t;
1673
295
  }
1674
- function He(e) {
296
+ function Ce(e) {
1675
297
  let t = "";
1676
- if (O(e))
298
+ if (w(e))
1677
299
  t = e;
1678
300
  else if (C(e))
1679
- for (let s = 0; s < e.length; s++) {
1680
- const n = He(e[s]);
1681
- n && (t += n + " ");
301
+ for (let n = 0; n < e.length; n++) {
302
+ const o = Ce(e[n]);
303
+ o && (t += o + " ");
1682
304
  }
1683
- else if (j(e))
1684
- for (const s in e)
1685
- e[s] && (t += s + " ");
305
+ else if (H(e))
306
+ for (const n in e)
307
+ e[n] && (t += n + " ");
1686
308
  return t.trim();
1687
309
  }
1688
310
  /**
1689
- * @vue/reactivity v3.5.17
311
+ * @vue/reactivity v3.5.27
1690
312
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
1691
313
  * @license MIT
1692
314
  **/
1693
- Symbol(
1694
- process.env.NODE_ENV !== "production" ? "Object iterate" : ""
1695
- );
1696
- Symbol(
1697
- process.env.NODE_ENV !== "production" ? "Map keys iterate" : ""
1698
- );
1699
- Symbol(
1700
- process.env.NODE_ENV !== "production" ? "Array iterate" : ""
1701
- );
315
+ process.env.NODE_ENV;
316
+ process.env.NODE_ENV;
317
+ process.env.NODE_ENV;
1702
318
  new Set(
1703
- /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((e) => e !== "arguments" && e !== "caller").map((e) => Symbol[e]).filter(In)
319
+ /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((e) => e !== "arguments" && e !== "caller").map((e) => Symbol[e]).filter(bt)
1704
320
  );
1705
- function _e(e) {
321
+ // @__NO_SIDE_EFFECTS__
322
+ function de(e) {
1706
323
  return e ? !!e.__v_raw : !1;
1707
324
  }
1708
- function ee(e) {
325
+ // @__NO_SIDE_EFFECTS__
326
+ function q(e) {
1709
327
  const t = e && e.__v_raw;
1710
- return t ? ee(t) : e;
328
+ return t ? /* @__PURE__ */ q(t) : e;
1711
329
  }
1712
- function Ht(e) {
330
+ // @__NO_SIDE_EFFECTS__
331
+ function He(e) {
1713
332
  return e ? e.__v_isRef === !0 : !1;
1714
333
  }
1715
334
  /**
1716
- * @vue/runtime-core v3.5.17
335
+ * @vue/runtime-core v3.5.27
1717
336
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
1718
337
  * @license MIT
1719
338
  **/
1720
- const N = [];
1721
- function $n(e) {
1722
- N.push(e);
1723
- }
1724
- function Nn() {
1725
- N.pop();
339
+ const D = [];
340
+ function Rt(e) {
341
+ D.push(e);
1726
342
  }
1727
- let de = !1;
1728
- function $(e, ...t) {
1729
- if (de) return;
1730
- de = !0;
1731
- const s = N.length ? N[N.length - 1].component : null, n = s && s.appContext.config.warnHandler, i = Fn();
1732
- if (n)
1733
- ae(
343
+ function $t() {
344
+ D.pop();
345
+ }
346
+ let ce = !1;
347
+ function O(e, ...t) {
348
+ if (ce) return;
349
+ ce = !0;
350
+ const n = D.length ? D[D.length - 1].component : null, o = n && n.appContext.config.warnHandler, s = xt();
351
+ if (o)
352
+ te(
353
+ o,
1734
354
  n,
1735
- s,
1736
355
  11,
1737
356
  [
1738
357
  // eslint-disable-next-line no-restricted-syntax
1739
- e + t.map((o) => {
1740
- var r, l;
1741
- return (l = (r = o.toString) == null ? void 0 : r.call(o)) != null ? l : JSON.stringify(o);
358
+ e + t.map((r) => {
359
+ var i, a;
360
+ return (a = (i = r.toString) == null ? void 0 : i.call(r)) != null ? a : JSON.stringify(r);
1742
361
  }).join(""),
1743
- s && s.proxy,
1744
- i.map(
1745
- ({ vnode: o }) => `at <${jt(s, o.type)}>`
362
+ n && n.proxy,
363
+ s.map(
364
+ ({ vnode: r }) => `at <${Ze(n, r.type)}>`
1746
365
  ).join(`
1747
366
  `),
1748
- i
367
+ s
1749
368
  ]
1750
369
  );
1751
370
  else {
1752
- const o = [`[Vue warn]: ${e}`, ...t];
1753
- i.length && o.push(`
1754
- `, ...Pn(i)), console.warn(...o);
371
+ const r = [`[Vue warn]: ${e}`, ...t];
372
+ s.length && r.push(`
373
+ `, ...Tt(s)), console.warn(...r);
1755
374
  }
1756
- de = !1;
375
+ ce = !1;
1757
376
  }
1758
- function Fn() {
1759
- let e = N[N.length - 1];
377
+ function xt() {
378
+ let e = D[D.length - 1];
1760
379
  if (!e)
1761
380
  return [];
1762
381
  const t = [];
1763
382
  for (; e; ) {
1764
- const s = t[0];
1765
- s && s.vnode === e ? s.recurseCount++ : t.push({
383
+ const n = t[0];
384
+ n && n.vnode === e ? n.recurseCount++ : t.push({
1766
385
  vnode: e,
1767
386
  recurseCount: 0
1768
387
  });
1769
- const n = e.component && e.component.parent;
1770
- e = n && n.vnode;
388
+ const o = e.component && e.component.parent;
389
+ e = o && o.vnode;
1771
390
  }
1772
391
  return t;
1773
392
  }
1774
- function Pn(e) {
393
+ function Tt(e) {
1775
394
  const t = [];
1776
- return e.forEach((s, n) => {
1777
- t.push(...n === 0 ? [] : [`
1778
- `], ...Ln(s));
395
+ return e.forEach((n, o) => {
396
+ t.push(...o === 0 ? [] : [`
397
+ `], ...At(n));
1779
398
  }), t;
1780
399
  }
1781
- function Ln({ vnode: e, recurseCount: t }) {
1782
- const s = t > 0 ? `... (${t} recursive calls)` : "", n = e.component ? e.component.parent == null : !1, i = ` at <${jt(
400
+ function At({ vnode: e, recurseCount: t }) {
401
+ const n = t > 0 ? `... (${t} recursive calls)` : "", o = e.component ? e.component.parent == null : !1, s = ` at <${Ze(
1783
402
  e.component,
1784
403
  e.type,
1785
- n
1786
- )}`, o = ">" + s;
1787
- return e.props ? [i, ...An(e.props), o] : [i + o];
404
+ o
405
+ )}`, r = ">" + n;
406
+ return e.props ? [s, ...Mt(e.props), r] : [s + r];
1788
407
  }
1789
- function An(e) {
1790
- const t = [], s = Object.keys(e);
1791
- return s.slice(0, 3).forEach((n) => {
1792
- t.push(...Dt(n, e[n]));
1793
- }), s.length > 3 && t.push(" ..."), t;
408
+ function Mt(e) {
409
+ const t = [], n = Object.keys(e);
410
+ return n.slice(0, 3).forEach((o) => {
411
+ t.push(...ze(o, e[o]));
412
+ }), n.length > 3 && t.push(" ..."), t;
1794
413
  }
1795
- function Dt(e, t, s) {
1796
- return O(t) ? (t = JSON.stringify(t), s ? t : [`${e}=${t}`]) : typeof t == "number" || typeof t == "boolean" || t == null ? s ? t : [`${e}=${t}`] : Ht(t) ? (t = Dt(e, ee(t.value), !0), s ? t : [`${e}=Ref<`, t, ">"]) : E(t) ? [`${e}=fn${t.name ? `<${t.name}>` : ""}`] : (t = ee(t), s ? t : [`${e}=`, t]);
414
+ function ze(e, t, n) {
415
+ return w(t) ? (t = JSON.stringify(t), n ? t : [`${e}=${t}`]) : typeof t == "number" || typeof t == "boolean" || t == null ? n ? t : [`${e}=${t}`] : /* @__PURE__ */ He(t) ? (t = ze(e, /* @__PURE__ */ q(t.value), !0), n ? t : [`${e}=Ref<`, t, ">"]) : _(t) ? [`${e}=fn${t.name ? `<${t.name}>` : ""}`] : (t = /* @__PURE__ */ q(t), n ? t : [`${e}=`, t]);
1797
416
  }
1798
- const De = {
417
+ const ve = {
1799
418
  sp: "serverPrefetch hook",
1800
419
  bc: "beforeCreate hook",
1801
420
  c: "created hook",
@@ -1828,264 +447,264 @@ const De = {
1828
447
  15: "component update",
1829
448
  16: "app unmount cleanup function"
1830
449
  };
1831
- function ae(e, t, s, n) {
450
+ function te(e, t, n, o) {
1832
451
  try {
1833
- return n ? e(...n) : e();
1834
- } catch (i) {
1835
- Oe(i, t, s);
452
+ return o ? e(...o) : e();
453
+ } catch (s) {
454
+ Ee(s, t, n);
1836
455
  }
1837
456
  }
1838
- function Ot(e, t, s, n) {
1839
- if (E(e)) {
1840
- const i = ae(e, t, s, n);
1841
- return i && Tn(i) && i.catch((o) => {
1842
- Oe(o, t, s);
1843
- }), i;
457
+ function Pe(e, t, n, o) {
458
+ if (_(e)) {
459
+ const s = te(e, t, n, o);
460
+ return s && wt(s) && s.catch((r) => {
461
+ Ee(r, t, n);
462
+ }), s;
1844
463
  }
1845
464
  if (C(e)) {
1846
- const i = [];
1847
- for (let o = 0; o < e.length; o++)
1848
- i.push(Ot(e[o], t, s, n));
1849
- return i;
1850
- } else process.env.NODE_ENV !== "production" && $(
465
+ const s = [];
466
+ for (let r = 0; r < e.length; r++)
467
+ s.push(Pe(e[r], t, n, o));
468
+ return s;
469
+ } else process.env.NODE_ENV !== "production" && O(
1851
470
  `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof e}`
1852
471
  );
1853
472
  }
1854
- function Oe(e, t, s, n = !0) {
1855
- const i = t ? t.vnode : null, { errorHandler: o, throwUnhandledErrorInProduction: r } = t && t.appContext.config || Cn;
473
+ function Ee(e, t, n, o = !0) {
474
+ const s = t ? t.vnode : null, { errorHandler: r, throwUnhandledErrorInProduction: i } = t && t.appContext.config || Nt;
1856
475
  if (t) {
1857
- let l = t.parent;
1858
- const c = t.proxy, d = process.env.NODE_ENV !== "production" ? De[s] : `https://vuejs.org/error-reference/#runtime-${s}`;
1859
- for (; l; ) {
1860
- const u = l.ec;
1861
- if (u) {
1862
- for (let h = 0; h < u.length; h++)
1863
- if (u[h](e, c, d) === !1)
476
+ let a = t.parent;
477
+ const l = t.proxy, c = process.env.NODE_ENV !== "production" ? ve[n] : `https://vuejs.org/error-reference/#runtime-${n}`;
478
+ for (; a; ) {
479
+ const d = a.ec;
480
+ if (d) {
481
+ for (let g = 0; g < d.length; g++)
482
+ if (d[g](e, l, c) === !1)
1864
483
  return;
1865
484
  }
1866
- l = l.parent;
485
+ a = a.parent;
1867
486
  }
1868
- if (o) {
1869
- ae(o, null, 10, [
487
+ if (r) {
488
+ te(r, null, 10, [
1870
489
  e,
1871
- c,
1872
- d
490
+ l,
491
+ c
1873
492
  ]);
1874
493
  return;
1875
494
  }
1876
495
  }
1877
- Bn(e, s, i, n, r);
496
+ Ht(e, n, s, o, i);
1878
497
  }
1879
- function Bn(e, t, s, n = !0, i = !1) {
498
+ function Ht(e, t, n, o = !0, s = !1) {
1880
499
  if (process.env.NODE_ENV !== "production") {
1881
- const o = De[t];
1882
- if (s && $n(s), $(`Unhandled error${o ? ` during execution of ${o}` : ""}`), s && Nn(), n)
500
+ const r = ve[t];
501
+ if (n && Rt(n), O(`Unhandled error${r ? ` during execution of ${r}` : ""}`), n && $t(), o)
1883
502
  throw e;
1884
503
  console.error(e);
1885
504
  } else {
1886
- if (i)
505
+ if (s)
1887
506
  throw e;
1888
507
  console.error(e);
1889
508
  }
1890
509
  }
1891
- const _ = [];
1892
- let S = -1;
1893
- const A = [];
1894
- let k = null, F = 0;
1895
- const Vn = /* @__PURE__ */ Promise.resolve();
1896
- let Ee = null;
1897
- const Kn = 100;
1898
- function Un(e) {
1899
- let t = S + 1, s = _.length;
1900
- for (; t < s; ) {
1901
- const n = t + s >>> 1, i = _[n], o = W(i);
1902
- o < e || o === e && i.flags & 2 ? t = n + 1 : s = n;
510
+ const h = [];
511
+ let v = -1;
512
+ const T = [];
513
+ let S = null, $ = 0;
514
+ const zt = /* @__PURE__ */ Promise.resolve();
515
+ let me = null;
516
+ const Pt = 100;
517
+ function Lt(e) {
518
+ let t = v + 1, n = h.length;
519
+ for (; t < n; ) {
520
+ const o = t + n >>> 1, s = h[o], r = z(s);
521
+ r < e || r === e && s.flags & 2 ? t = o + 1 : n = o;
1903
522
  }
1904
523
  return t;
1905
524
  }
1906
- function zn(e) {
525
+ function jt(e) {
1907
526
  if (!(e.flags & 1)) {
1908
- const t = W(e), s = _[_.length - 1];
1909
- !s || // fast path when the job id is larger than the tail
1910
- !(e.flags & 2) && t >= W(s) ? _.push(e) : _.splice(Un(t), 0, e), e.flags |= 1, $t();
527
+ const t = z(e), n = h[h.length - 1];
528
+ !n || // fast path when the job id is larger than the tail
529
+ !(e.flags & 2) && t >= z(n) ? h.push(e) : h.splice(Lt(t), 0, e), e.flags |= 1, Le();
1911
530
  }
1912
531
  }
1913
- function $t() {
1914
- Ee || (Ee = Vn.then(Nt));
532
+ function Le() {
533
+ me || (me = zt.then(je));
1915
534
  }
1916
- function qn(e) {
1917
- C(e) ? A.push(...e) : k && e.id === -1 ? k.splice(F + 1, 0, e) : e.flags & 1 || (A.push(e), e.flags |= 1), $t();
535
+ function Ut(e) {
536
+ C(e) ? T.push(...e) : S && e.id === -1 ? S.splice($ + 1, 0, e) : e.flags & 1 || (T.push(e), e.flags |= 1), Le();
1918
537
  }
1919
- function jn(e) {
1920
- if (A.length) {
1921
- const t = [...new Set(A)].sort(
1922
- (s, n) => W(s) - W(n)
538
+ function Jt(e) {
539
+ if (T.length) {
540
+ const t = [...new Set(T)].sort(
541
+ (n, o) => z(n) - z(o)
1923
542
  );
1924
- if (A.length = 0, k) {
1925
- k.push(...t);
543
+ if (T.length = 0, S) {
544
+ S.push(...t);
1926
545
  return;
1927
546
  }
1928
- for (k = t, process.env.NODE_ENV !== "production" && (e = e || /* @__PURE__ */ new Map()), F = 0; F < k.length; F++) {
1929
- const s = k[F];
1930
- process.env.NODE_ENV !== "production" && Ft(e, s) || (s.flags & 4 && (s.flags &= -2), s.flags & 8 || s(), s.flags &= -2);
547
+ for (S = t, process.env.NODE_ENV !== "production" && (e = e || /* @__PURE__ */ new Map()), $ = 0; $ < S.length; $++) {
548
+ const n = S[$];
549
+ process.env.NODE_ENV !== "production" && Ue(e, n) || (n.flags & 4 && (n.flags &= -2), n.flags & 8 || n(), n.flags &= -2);
1931
550
  }
1932
- k = null, F = 0;
551
+ S = null, $ = 0;
1933
552
  }
1934
553
  }
1935
- const W = (e) => e.id == null ? e.flags & 2 ? -1 : 1 / 0 : e.id;
1936
- function Nt(e) {
554
+ const z = (e) => e.id == null ? e.flags & 2 ? -1 : 1 / 0 : e.id;
555
+ function je(e) {
1937
556
  process.env.NODE_ENV !== "production" && (e = e || /* @__PURE__ */ new Map());
1938
- const t = process.env.NODE_ENV !== "production" ? (s) => Ft(e, s) : Rt;
557
+ const t = process.env.NODE_ENV !== "production" ? (n) => Ue(e, n) : Ae;
1939
558
  try {
1940
- for (S = 0; S < _.length; S++) {
1941
- const s = _[S];
1942
- if (s && !(s.flags & 8)) {
1943
- if (process.env.NODE_ENV !== "production" && t(s))
559
+ for (v = 0; v < h.length; v++) {
560
+ const n = h[v];
561
+ if (n && !(n.flags & 8)) {
562
+ if (process.env.NODE_ENV !== "production" && t(n))
1944
563
  continue;
1945
- s.flags & 4 && (s.flags &= -2), ae(
1946
- s,
1947
- s.i,
1948
- s.i ? 15 : 14
1949
- ), s.flags & 4 || (s.flags &= -2);
564
+ n.flags & 4 && (n.flags &= -2), te(
565
+ n,
566
+ n.i,
567
+ n.i ? 15 : 14
568
+ ), n.flags & 4 || (n.flags &= -2);
1950
569
  }
1951
570
  }
1952
571
  } finally {
1953
- for (; S < _.length; S++) {
1954
- const s = _[S];
1955
- s && (s.flags &= -2);
572
+ for (; v < h.length; v++) {
573
+ const n = h[v];
574
+ n && (n.flags &= -2);
1956
575
  }
1957
- S = -1, _.length = 0, jn(e), Ee = null, (_.length || A.length) && Nt(e);
576
+ v = -1, h.length = 0, Jt(e), me = null, (h.length || T.length) && je(e);
1958
577
  }
1959
578
  }
1960
- function Ft(e, t) {
1961
- const s = e.get(t) || 0;
1962
- if (s > Kn) {
1963
- const n = t.i, i = n && qt(n.type);
1964
- return Oe(
1965
- `Maximum recursive updates exceeded${i ? ` in component <${i}>` : ""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
579
+ function Ue(e, t) {
580
+ const n = e.get(t) || 0;
581
+ if (n > Pt) {
582
+ const o = t.i, s = o && Xe(o.type);
583
+ return Ee(
584
+ `Maximum recursive updates exceeded${s ? ` in component <${s}>` : ""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
1966
585
  null,
1967
586
  10
1968
587
  ), !0;
1969
588
  }
1970
- return e.set(t, s + 1), !1;
589
+ return e.set(t, n + 1), !1;
1971
590
  }
1972
591
  const ue = /* @__PURE__ */ new Map();
1973
- process.env.NODE_ENV !== "production" && (re().__VUE_HMR_RUNTIME__ = {
1974
- createRecord: he(Wn),
1975
- rerender: he(Gn),
1976
- reload: he(Jn)
592
+ process.env.NODE_ENV !== "production" && (ee().__VUE_HMR_RUNTIME__ = {
593
+ createRecord: fe(Wt),
594
+ rerender: fe(qt),
595
+ reload: fe(Bt)
1977
596
  });
1978
- const te = /* @__PURE__ */ new Map();
1979
- function Wn(e, t) {
1980
- return te.has(e) ? !1 : (te.set(e, {
1981
- initialDef: se(t),
597
+ const B = /* @__PURE__ */ new Map();
598
+ function Wt(e, t) {
599
+ return B.has(e) ? !1 : (B.set(e, {
600
+ initialDef: K(t),
1982
601
  instances: /* @__PURE__ */ new Set()
1983
602
  }), !0);
1984
603
  }
1985
- function se(e) {
1986
- return Wt(e) ? e.__vccOpts : e;
604
+ function K(e) {
605
+ return et(e) ? e.__vccOpts : e;
1987
606
  }
1988
- function Gn(e, t) {
1989
- const s = te.get(e);
1990
- s && (s.initialDef.render = t, [...s.instances].forEach((n) => {
1991
- t && (n.render = t, se(n.type).render = t), n.renderCache = [], n.update();
607
+ function qt(e, t) {
608
+ const n = B.get(e);
609
+ n && (n.initialDef.render = t, [...n.instances].forEach((o) => {
610
+ t && (o.render = t, K(o.type).render = t), o.renderCache = [], o.job.flags & 8 || o.update();
1992
611
  }));
1993
612
  }
1994
- function Jn(e, t) {
1995
- const s = te.get(e);
1996
- if (!s) return;
1997
- t = se(t), ze(s.initialDef, t);
1998
- const n = [...s.instances];
1999
- for (let i = 0; i < n.length; i++) {
2000
- const o = n[i], r = se(o.type);
2001
- let l = ue.get(r);
2002
- l || (r !== s.initialDef && ze(r, t), ue.set(r, l = /* @__PURE__ */ new Set())), l.add(o), o.appContext.propsCache.delete(o.type), o.appContext.emitsCache.delete(o.type), o.appContext.optionsCache.delete(o.type), o.ceReload ? (l.add(o), o.ceReload(t.styles), l.delete(o)) : o.parent ? zn(() => {
2003
- o.parent.update(), l.delete(o);
2004
- }) : o.appContext.reload ? o.appContext.reload() : typeof window < "u" ? window.location.reload() : console.warn(
613
+ function Bt(e, t) {
614
+ const n = B.get(e);
615
+ if (!n) return;
616
+ t = K(t), Fe(n.initialDef, t);
617
+ const o = [...n.instances];
618
+ for (let s = 0; s < o.length; s++) {
619
+ const r = o[s], i = K(r.type);
620
+ let a = ue.get(i);
621
+ a || (i !== n.initialDef && Fe(i, t), ue.set(i, a = /* @__PURE__ */ new Set())), a.add(r), r.appContext.propsCache.delete(r.type), r.appContext.emitsCache.delete(r.type), r.appContext.optionsCache.delete(r.type), r.ceReload ? (a.add(r), r.ceReload(t.styles), a.delete(r)) : r.parent ? jt(() => {
622
+ r.job.flags & 8 || (r.parent.update(), a.delete(r));
623
+ }) : r.appContext.reload ? r.appContext.reload() : typeof window < "u" ? window.location.reload() : console.warn(
2005
624
  "[HMR] Root or manually mounted instance modified. Full reload required."
2006
- ), o.root.ce && o !== o.root && o.root.ce._removeChildStyle(r);
625
+ ), r.root.ce && r !== r.root && r.root.ce._removeChildStyle(i);
2007
626
  }
2008
- qn(() => {
627
+ Ut(() => {
2009
628
  ue.clear();
2010
629
  });
2011
630
  }
2012
- function ze(e, t) {
2013
- Re(e, t);
2014
- for (const s in e)
2015
- s !== "__file" && !(s in t) && delete e[s];
631
+ function Fe(e, t) {
632
+ ye(e, t);
633
+ for (const n in e)
634
+ n !== "__file" && !(n in t) && delete e[n];
2016
635
  }
2017
- function he(e) {
2018
- return (t, s) => {
636
+ function fe(e) {
637
+ return (t, n) => {
2019
638
  try {
2020
- return e(t, s);
2021
- } catch (n) {
2022
- console.error(n), console.warn(
639
+ return e(t, n);
640
+ } catch (o) {
641
+ console.error(o), console.warn(
2023
642
  "[HMR] Something went wrong during Vue component hot-reload. Full reload required."
2024
643
  );
2025
644
  }
2026
645
  };
2027
646
  }
2028
- let P, X = [];
2029
- function Pt(e, t) {
2030
- var s, n;
2031
- P = e, P ? (P.enabled = !0, X.forEach(({ event: i, args: o }) => P.emit(i, ...o)), X = []) : /* handle late devtools injection - only do this if we are in an actual */ /* browser environment to avoid the timer handle stalling test runner exit */ /* (#4815) */ typeof window < "u" && // some envs mock window but not fully
647
+ let x, U = [];
648
+ function Je(e, t) {
649
+ var n, o;
650
+ x = e, x ? (x.enabled = !0, U.forEach(({ event: s, args: r }) => x.emit(s, ...r)), U = []) : /* handle late devtools injection - only do this if we are in an actual */ /* browser environment to avoid the timer handle stalling test runner exit */ /* (#4815) */ typeof window < "u" && // some envs mock window but not fully
2032
651
  window.HTMLElement && // also exclude jsdom
2033
652
  // eslint-disable-next-line no-restricted-syntax
2034
- !((n = (s = window.navigator) == null ? void 0 : s.userAgent) != null && n.includes("jsdom")) ? ((t.__VUE_DEVTOOLS_HOOK_REPLAY__ = t.__VUE_DEVTOOLS_HOOK_REPLAY__ || []).push((o) => {
2035
- Pt(o, t);
653
+ !((o = (n = window.navigator) == null ? void 0 : n.userAgent) != null && o.includes("jsdom")) ? ((t.__VUE_DEVTOOLS_HOOK_REPLAY__ = t.__VUE_DEVTOOLS_HOOK_REPLAY__ || []).push((r) => {
654
+ Je(r, t);
2036
655
  }), setTimeout(() => {
2037
- P || (t.__VUE_DEVTOOLS_HOOK_REPLAY__ = null, X = []);
2038
- }, 3e3)) : X = [];
2039
- }
2040
- let ne = null, Yn = null;
2041
- const Xn = (e) => e.__isTeleport;
2042
- function Lt(e, t) {
2043
- e.shapeFlag & 6 && e.component ? (e.transition = t, Lt(e.component.subTree, t)) : e.shapeFlag & 128 ? (e.ssContent.transition = t.clone(e.ssContent), e.ssFallback.transition = t.clone(e.ssFallback)) : e.transition = t;
2044
- }
2045
- re().requestIdleCallback;
2046
- re().cancelIdleCallback;
2047
- function Qn(e, t, s = le, n = !1) {
2048
- if (s) {
2049
- const i = s[e] || (s[e] = []), o = t.__weh || (t.__weh = (...r) => {
2050
- const l = fi(s), c = Ot(t, s, e, r);
2051
- return l(), c;
656
+ x || (t.__VUE_DEVTOOLS_HOOK_REPLAY__ = null, U = []);
657
+ }, 3e3)) : U = [];
658
+ }
659
+ let Y = null, Kt = null;
660
+ const Yt = (e) => e.__isTeleport;
661
+ function We(e, t) {
662
+ e.shapeFlag & 6 && e.component ? (e.transition = t, We(e.component.subTree, t)) : e.shapeFlag & 128 ? (e.ssContent.transition = t.clone(e.ssContent), e.ssFallback.transition = t.clone(e.ssFallback)) : e.transition = t;
663
+ }
664
+ ee().requestIdleCallback;
665
+ ee().cancelIdleCallback;
666
+ function Gt(e, t, n = ne, o = !1) {
667
+ if (n) {
668
+ const s = n[e] || (n[e] = []), r = t.__weh || (t.__weh = (...i) => {
669
+ const a = dn(n), l = Pe(t, n, e, i);
670
+ return a(), l;
2052
671
  });
2053
- return n ? i.unshift(o) : i.push(o), o;
672
+ return o ? s.unshift(r) : s.push(r), r;
2054
673
  } else if (process.env.NODE_ENV !== "production") {
2055
- const i = Rn(De[e].replace(/ hook$/, ""));
2056
- $(
2057
- `${i} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`
674
+ const s = kt(ve[e].replace(/ hook$/, ""));
675
+ O(
676
+ `${s} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`
2058
677
  );
2059
678
  }
2060
679
  }
2061
- const Zn = (e) => (t, s = le) => {
2062
- (!zt || e === "sp") && Qn(e, (...n) => t(...n), s);
2063
- }, ei = Zn("u"), ti = Symbol.for("v-ndc"), si = {};
2064
- process.env.NODE_ENV !== "production" && (si.ownKeys = (e) => ($(
680
+ const Qt = (e) => (t, n = ne) => {
681
+ (!Qe || e === "sp") && Gt(e, (...o) => t(...o), n);
682
+ }, Xt = Qt("u"), Zt = /* @__PURE__ */ Symbol.for("v-ndc"), en = {};
683
+ process.env.NODE_ENV !== "production" && (en.ownKeys = (e) => (O(
2065
684
  "Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."
2066
685
  ), Reflect.ownKeys(e)));
2067
- const ni = {}, At = (e) => Object.getPrototypeOf(e) === ni, ii = (e) => e.__isSuspense, Bt = Symbol.for("v-fgt"), oi = Symbol.for("v-txt"), ri = Symbol.for("v-cmt");
2068
- function ai(e) {
686
+ const tn = {}, qe = (e) => Object.getPrototypeOf(e) === tn, nn = (e) => e.__isSuspense, Be = /* @__PURE__ */ Symbol.for("v-fgt"), on = /* @__PURE__ */ Symbol.for("v-txt"), rn = /* @__PURE__ */ Symbol.for("v-cmt");
687
+ function sn(e) {
2069
688
  return e ? e.__v_isVNode === !0 : !1;
2070
689
  }
2071
- const li = (...e) => Kt(
690
+ const ln = (...e) => Ye(
2072
691
  ...e
2073
- ), Vt = ({ key: e }) => e ?? null, Z = ({
692
+ ), Ke = ({ key: e }) => e ?? null, J = ({
2074
693
  ref: e,
2075
694
  ref_key: t,
2076
- ref_for: s
2077
- }) => (typeof e == "number" && (e = "" + e), e != null ? O(e) || Ht(e) || E(e) ? { i: ne, r: e, k: t, f: !!s } : e : null);
2078
- function ci(e, t = null, s = null, n = 0, i = null, o = e === Bt ? 0 : 1, r = !1, l = !1) {
2079
- const c = {
695
+ ref_for: n
696
+ }) => (typeof e == "number" && (e = "" + e), e != null ? w(e) || /* @__PURE__ */ He(e) || _(e) ? { i: Y, r: e, k: t, f: !!n } : e : null);
697
+ function an(e, t = null, n = null, o = 0, s = null, r = e === Be ? 0 : 1, i = !1, a = !1) {
698
+ const l = {
2080
699
  __v_isVNode: !0,
2081
700
  __v_skip: !0,
2082
701
  type: e,
2083
702
  props: t,
2084
- key: t && Vt(t),
2085
- ref: t && Z(t),
2086
- scopeId: Yn,
703
+ key: t && Ke(t),
704
+ ref: t && J(t),
705
+ scopeId: Kt,
2087
706
  slotScopeIds: null,
2088
- children: s,
707
+ children: n,
2089
708
  component: null,
2090
709
  suspense: null,
2091
710
  ssContent: null,
@@ -2098,67 +717,67 @@ function ci(e, t = null, s = null, n = 0, i = null, o = e === Bt ? 0 : 1, r = !1
2098
717
  targetStart: null,
2099
718
  targetAnchor: null,
2100
719
  staticCount: 0,
2101
- shapeFlag: o,
2102
- patchFlag: n,
2103
- dynamicProps: i,
720
+ shapeFlag: r,
721
+ patchFlag: o,
722
+ dynamicProps: s,
2104
723
  dynamicChildren: null,
2105
724
  appContext: null,
2106
- ctx: ne
725
+ ctx: Y
2107
726
  };
2108
- return l ? ($e(c, s), o & 128 && e.normalize(c)) : s && (c.shapeFlag |= O(s) ? 8 : 16), process.env.NODE_ENV !== "production" && c.key !== c.key && $("VNode created with invalid key (NaN). VNode type:", c.type), c;
727
+ return a ? (Ne(l, n), r & 128 && e.normalize(l)) : n && (l.shapeFlag |= w(n) ? 8 : 16), process.env.NODE_ENV !== "production" && l.key !== l.key && O("VNode created with invalid key (NaN). VNode type:", l.type), l;
2109
728
  }
2110
- const di = process.env.NODE_ENV !== "production" ? li : Kt;
2111
- function Kt(e, t = null, s = null, n = 0, i = null, o = !1) {
2112
- if ((!e || e === ti) && (process.env.NODE_ENV !== "production" && !e && $(`Invalid vnode type when creating vnode: ${e}.`), e = ri), ai(e)) {
2113
- const l = ie(
729
+ const cn = process.env.NODE_ENV !== "production" ? ln : Ye;
730
+ function Ye(e, t = null, n = null, o = 0, s = null, r = !1) {
731
+ if ((!e || e === Zt) && (process.env.NODE_ENV !== "production" && !e && O(`Invalid vnode type when creating vnode: ${e}.`), e = rn), sn(e)) {
732
+ const a = G(
2114
733
  e,
2115
734
  t,
2116
735
  !0
2117
736
  /* mergeRef: true */
2118
737
  );
2119
- return s && $e(l, s), l.patchFlag = -2, l;
738
+ return n && Ne(a, n), a.patchFlag = -2, a;
2120
739
  }
2121
- if (Wt(e) && (e = e.__vccOpts), t) {
2122
- t = ui(t);
2123
- let { class: l, style: c } = t;
2124
- l && !O(l) && (t.class = He(l)), j(c) && (_e(c) && !C(c) && (c = Re({}, c)), t.style = ke(c));
740
+ if (et(e) && (e = e.__vccOpts), t) {
741
+ t = un(t);
742
+ let { class: a, style: l } = t;
743
+ a && !w(a) && (t.class = Ce(a)), H(l) && (/* @__PURE__ */ de(l) && !C(l) && (l = ye({}, l)), t.style = _e(l));
2125
744
  }
2126
- const r = O(e) ? 1 : ii(e) ? 128 : Xn(e) ? 64 : j(e) ? 4 : E(e) ? 2 : 0;
2127
- return process.env.NODE_ENV !== "production" && r & 4 && _e(e) && (e = ee(e), $(
745
+ const i = w(e) ? 1 : nn(e) ? 128 : Yt(e) ? 64 : H(e) ? 4 : _(e) ? 2 : 0;
746
+ return process.env.NODE_ENV !== "production" && i & 4 && /* @__PURE__ */ de(e) && (e = /* @__PURE__ */ q(e), O(
2128
747
  "Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",
2129
748
  `
2130
749
  Component that was made reactive: `,
2131
750
  e
2132
- )), ci(
751
+ )), an(
2133
752
  e,
2134
753
  t,
2135
- s,
2136
754
  n,
755
+ o,
756
+ s,
2137
757
  i,
2138
758
  r,
2139
- o,
2140
759
  !0
2141
760
  );
2142
761
  }
2143
- function ui(e) {
2144
- return e ? _e(e) || At(e) ? Re({}, e) : e : null;
762
+ function un(e) {
763
+ return e ? /* @__PURE__ */ de(e) || qe(e) ? ye({}, e) : e : null;
2145
764
  }
2146
- function ie(e, t, s = !1, n = !1) {
2147
- const { props: i, ref: o, patchFlag: r, children: l, transition: c } = e, d = t ? pi(i || {}, t) : i, u = {
765
+ function G(e, t, n = !1, o = !1) {
766
+ const { props: s, ref: r, patchFlag: i, children: a, transition: l } = e, c = t ? pn(s || {}, t) : s, d = {
2148
767
  __v_isVNode: !0,
2149
768
  __v_skip: !0,
2150
769
  type: e.type,
2151
- props: d,
2152
- key: d && Vt(d),
770
+ props: c,
771
+ key: c && Ke(c),
2153
772
  ref: t && t.ref ? (
2154
773
  // #2078 in the case of <component :is="vnode" ref="extra"/>
2155
774
  // if the vnode itself already has a ref, cloneVNode will need to merge
2156
775
  // the refs so the single vnode can be set on multiple refs
2157
- s && o ? C(o) ? o.concat(Z(t)) : [o, Z(t)] : Z(t)
2158
- ) : o,
776
+ n && r ? C(r) ? r.concat(J(t)) : [r, J(t)] : J(t)
777
+ ) : r,
2159
778
  scopeId: e.scopeId,
2160
779
  slotScopeIds: e.slotScopeIds,
2161
- children: process.env.NODE_ENV !== "production" && r === -1 && C(l) ? l.map(Ut) : l,
780
+ children: process.env.NODE_ENV !== "production" && i === -1 && C(a) ? a.map(Ge) : a,
2162
781
  target: e.target,
2163
782
  targetStart: e.targetStart,
2164
783
  targetAnchor: e.targetAnchor,
@@ -2168,123 +787,124 @@ function ie(e, t, s = !1, n = !1) {
2168
787
  // existing patch flag to be reliable and need to add the FULL_PROPS flag.
2169
788
  // note: preserve flag for fragments since they use the flag for children
2170
789
  // fast paths only.
2171
- patchFlag: t && e.type !== Bt ? r === -1 ? 16 : r | 16 : r,
790
+ patchFlag: t && e.type !== Be ? i === -1 ? 16 : i | 16 : i,
2172
791
  dynamicProps: e.dynamicProps,
2173
792
  dynamicChildren: e.dynamicChildren,
2174
793
  appContext: e.appContext,
2175
794
  dirs: e.dirs,
2176
- transition: c,
795
+ transition: l,
2177
796
  // These should technically only be non-null on mounted VNodes. However,
2178
797
  // they *should* be copied for kept-alive vnodes. So we just always copy
2179
798
  // them since them being non-null during a mount doesn't affect the logic as
2180
799
  // they will simply be overwritten.
2181
800
  component: e.component,
2182
801
  suspense: e.suspense,
2183
- ssContent: e.ssContent && ie(e.ssContent),
2184
- ssFallback: e.ssFallback && ie(e.ssFallback),
802
+ ssContent: e.ssContent && G(e.ssContent),
803
+ ssFallback: e.ssFallback && G(e.ssFallback),
804
+ placeholder: e.placeholder,
2185
805
  el: e.el,
2186
806
  anchor: e.anchor,
2187
807
  ctx: e.ctx,
2188
808
  ce: e.ce
2189
809
  };
2190
- return c && n && Lt(
2191
- u,
2192
- c.clone(u)
2193
- ), u;
810
+ return l && o && We(
811
+ d,
812
+ l.clone(d)
813
+ ), d;
2194
814
  }
2195
- function Ut(e) {
2196
- const t = ie(e);
2197
- return C(e.children) && (t.children = e.children.map(Ut)), t;
815
+ function Ge(e) {
816
+ const t = G(e);
817
+ return C(e.children) && (t.children = e.children.map(Ge)), t;
2198
818
  }
2199
- function hi(e = " ", t = 0) {
2200
- return di(oi, null, e, t);
819
+ function fn(e = " ", t = 0) {
820
+ return cn(on, null, e, t);
2201
821
  }
2202
- function $e(e, t) {
2203
- let s = 0;
2204
- const { shapeFlag: n } = e;
822
+ function Ne(e, t) {
823
+ let n = 0;
824
+ const { shapeFlag: o } = e;
2205
825
  if (t == null)
2206
826
  t = null;
2207
827
  else if (C(t))
2208
- s = 16;
828
+ n = 16;
2209
829
  else if (typeof t == "object")
2210
- if (n & 65) {
2211
- const i = t.default;
2212
- i && (i._c && (i._d = !1), $e(e, i()), i._c && (i._d = !0));
830
+ if (o & 65) {
831
+ const s = t.default;
832
+ s && (s._c && (s._d = !1), Ne(e, s()), s._c && (s._d = !0));
2213
833
  return;
2214
834
  } else
2215
- s = 32, !t._ && !At(t) && (t._ctx = ne);
2216
- else E(t) ? (t = { default: t, _ctx: ne }, s = 32) : (t = String(t), n & 64 ? (s = 16, t = [hi(t)]) : s = 8);
2217
- e.children = t, e.shapeFlag |= s;
835
+ n = 32, !t._ && !qe(t) && (t._ctx = Y);
836
+ else _(t) ? (t = { default: t, _ctx: Y }, n = 32) : (t = String(t), o & 64 ? (n = 16, t = [fn(t)]) : n = 8);
837
+ e.children = t, e.shapeFlag |= n;
2218
838
  }
2219
- function pi(...e) {
839
+ function pn(...e) {
2220
840
  const t = {};
2221
- for (let s = 0; s < e.length; s++) {
2222
- const n = e[s];
2223
- for (const i in n)
2224
- if (i === "class")
2225
- t.class !== n.class && (t.class = He([t.class, n.class]));
2226
- else if (i === "style")
2227
- t.style = ke([t.style, n.style]);
2228
- else if (Sn(i)) {
2229
- const o = t[i], r = n[i];
2230
- r && o !== r && !(C(o) && o.includes(r)) && (t[i] = o ? [].concat(o, r) : r);
2231
- } else i !== "" && (t[i] = n[i]);
841
+ for (let n = 0; n < e.length; n++) {
842
+ const o = e[n];
843
+ for (const s in o)
844
+ if (s === "class")
845
+ t.class !== o.class && (t.class = Ce([t.class, o.class]));
846
+ else if (s === "style")
847
+ t.style = _e([t.style, o.style]);
848
+ else if (St(s)) {
849
+ const r = t[s], i = o[s];
850
+ i && r !== i && !(C(r) && r.includes(i)) && (t[s] = r ? [].concat(r, i) : i);
851
+ } else s !== "" && (t[s] = o[s]);
2232
852
  }
2233
853
  return t;
2234
854
  }
2235
- let le = null, be;
855
+ let ne = null, he;
2236
856
  {
2237
- const e = re(), t = (s, n) => {
2238
- let i;
2239
- return (i = e[s]) || (i = e[s] = []), i.push(n), (o) => {
2240
- i.length > 1 ? i.forEach((r) => r(o)) : i[0](o);
857
+ const e = ee(), t = (n, o) => {
858
+ let s;
859
+ return (s = e[n]) || (s = e[n] = []), s.push(o), (r) => {
860
+ s.length > 1 ? s.forEach((i) => i(r)) : s[0](r);
2241
861
  };
2242
862
  };
2243
- be = t(
863
+ he = t(
2244
864
  "__VUE_INSTANCE_SETTERS__",
2245
- (s) => le = s
865
+ (n) => ne = n
2246
866
  ), t(
2247
867
  "__VUE_SSR_SETTERS__",
2248
- (s) => zt = s
868
+ (n) => Qe = n
2249
869
  );
2250
870
  }
2251
- const fi = (e) => {
2252
- const t = le;
2253
- return be(e), e.scope.on(), () => {
2254
- e.scope.off(), be(t);
871
+ const dn = (e) => {
872
+ const t = ne;
873
+ return he(e), e.scope.on(), () => {
874
+ e.scope.off(), he(t);
2255
875
  };
2256
876
  };
2257
- let zt = !1;
877
+ let Qe = !1;
2258
878
  process.env.NODE_ENV;
2259
- const mi = /(?:^|[-_])(\w)/g, gi = (e) => e.replace(mi, (t) => t.toUpperCase()).replace(/[-_]/g, "");
2260
- function qt(e, t = !0) {
2261
- return E(e) ? e.displayName || e.name : e.name || t && e.__name;
2262
- }
2263
- function jt(e, t, s = !1) {
2264
- let n = qt(t);
2265
- if (!n && t.__file) {
2266
- const i = t.__file.match(/([^/\\]+)\.\w+$/);
2267
- i && (n = i[1]);
2268
- }
2269
- if (!n && e && e.parent) {
2270
- const i = (o) => {
2271
- for (const r in o)
2272
- if (o[r] === t)
2273
- return r;
879
+ const mn = /(?:^|[-_])\w/g, hn = (e) => e.replace(mn, (t) => t.toUpperCase()).replace(/[-_]/g, "");
880
+ function Xe(e, t = !0) {
881
+ return _(e) ? e.displayName || e.name : e.name || t && e.__name;
882
+ }
883
+ function Ze(e, t, n = !1) {
884
+ let o = Xe(t);
885
+ if (!o && t.__file) {
886
+ const s = t.__file.match(/([^/\\]+)\.\w+$/);
887
+ s && (o = s[1]);
888
+ }
889
+ if (!o && e) {
890
+ const s = (r) => {
891
+ for (const i in r)
892
+ if (r[i] === t)
893
+ return i;
2274
894
  };
2275
- n = i(
2276
- e.components || e.parent.type.components
2277
- ) || i(e.appContext.components);
895
+ o = s(e.components) || e.parent && s(
896
+ e.parent.type.components
897
+ ) || s(e.appContext.components);
2278
898
  }
2279
- return n ? gi(n) : s ? "App" : "Anonymous";
899
+ return o ? hn(o) : n ? "App" : "Anonymous";
2280
900
  }
2281
- function Wt(e) {
2282
- return E(e) && "__vccOpts" in e;
901
+ function et(e) {
902
+ return _(e) && "__vccOpts" in e;
2283
903
  }
2284
904
  process.env.NODE_ENV;
2285
905
  process.env.NODE_ENV;
2286
906
  process.env.NODE_ENV;
2287
- const Si = /* @__PURE__ */ Gt({
907
+ const Nn = /* @__PURE__ */ Q({
2288
908
  inheritAttrs: !0,
2289
909
  __name: "MyopVueComponent",
2290
910
  props: {
@@ -2293,47 +913,70 @@ const Si = /* @__PURE__ */ Gt({
2293
913
  onReady: { type: Function }
2294
914
  },
2295
915
  setup(e, { expose: t }) {
2296
- const s = e, n = Jt(), i = Yt(), o = K(null), r = K(!0), l = K(null), c = K(null), d = Xt(), u = K(null);
2297
- ei(() => {
2298
- c && c.value && c.value(n);
2299
- }), Qt(async () => {
2300
- if (o.value) {
2301
- const f = await ys.Main.fetchComponent(s.componentId, s.flowId);
2302
- l.value = await xt.loadComponent(
2303
- f,
2304
- o == null ? void 0 : o.value,
916
+ const n = e, o = ct(), s = X(), r = p(null), i = p(!0), a = p(null), l = p(null), c = ut(), d = p(null);
917
+ Xt(() => {
918
+ l && l.value && l.value(o);
919
+ }), Re(async () => {
920
+ if (r.value) {
921
+ const V = await Z.Main.fetchComponent(n.componentId, n.flowId);
922
+ a.value = await Te.loadComponent(
923
+ V,
924
+ r == null ? void 0 : r.value,
2305
925
  {
2306
926
  _environment: {
2307
927
  // inputs: { ...attrs, ...props },
2308
- props: n,
2309
- slots: i,
2310
- context: d == null ? void 0 : d.appContext,
2311
- vueContainerRef: o,
928
+ props: o,
929
+ slots: s,
930
+ context: c == null ? void 0 : c.appContext,
931
+ vueContainerRef: r,
2312
932
  //@ts-ignore
2313
- defineUpdater: (y) => {
2314
- c.value = y;
933
+ defineUpdater: (E) => {
934
+ l.value = E;
2315
935
  },
2316
936
  //@ts-ignore
2317
- defineInnerVueComponentRef: (y) => {
2318
- u.value = y.value;
937
+ defineInnerVueComponentRef: (E) => {
938
+ d.value = E.value;
2319
939
  }
2320
940
  }
2321
941
  }
2322
- ), r.value = !1, s.onReady && s.onReady(l.value, u.value);
942
+ ), i.value = !1, n.onReady && n.onReady(a.value, d.value);
2323
943
  }
2324
944
  });
2325
- const h = Zt({});
2326
- return t(h), es(() => {
2327
- Object.assign(h, u.value);
2328
- }), (f, y) => (ss(), ts(ns, null, [
2329
- is("div", as(ls(n), {
945
+ const g = ft({});
946
+ return t(g), pt(() => {
947
+ Object.assign(g, d.value);
948
+ }), (V, E) => (b(), A(dt, null, [
949
+ $e("div", mt(ge(o), {
2330
950
  ref_key: "myopContainer",
2331
- ref: o
951
+ ref: r
2332
952
  }), null, 16),
2333
- r.value ? os(f.$slots, "loading", { key: 0 }) : rs("", !0)
953
+ i.value ? M(V.$slots, "loading", { key: 0 }) : pe("", !0)
2334
954
  ], 64));
2335
955
  }
2336
956
  });
957
+ let k = Z.Main;
958
+ const gn = () => k, yn = (e, t, n) => k.isPreloaded(e, t, n), Sn = (e) => k.getPreloadedParams(e), bn = () => {
959
+ k = new Z("http://localhost:9292");
960
+ }, wn = (e) => {
961
+ k = new Z(e);
962
+ }, On = (e) => {
963
+ k = e;
964
+ }, kn = (e) => {
965
+ k.setEnvironment(e);
966
+ }, Vn = async (e, t, n) => Promise.allSettled(
967
+ e.map((o) => k.fetchComponentV2(o, t, n))
968
+ );
2337
969
  export {
2338
- Si as MyopContainer
970
+ En as MyopComponent,
971
+ Nn as MyopContainer,
972
+ Et as MyopFallback,
973
+ Ct as MyopLoader,
974
+ bn as enableLocalDev,
975
+ gn as getCloudRepository,
976
+ Sn as getPreloadedParams,
977
+ yn as isPreloaded,
978
+ Vn as preloadComponents,
979
+ On as setCloudRepository,
980
+ wn as setCloudRepositoryUrl,
981
+ kn as setEnvironment
2339
982
  };