@expofp/loader 1.0.30 → 1.0.33

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,27 +1,30 @@
1
- function _(e) {
2
- return i("assetResolver resolveRef:", e), h(e);
1
+ function k(e) {
2
+ return l("assetResolver resolveRef:", e), m(e);
3
3
  }
4
- const k = {
4
+ const _ = {
5
5
  schema: "asset",
6
- resolveRef: async (e) => _(e),
6
+ resolveRef: async (e) => k(e),
7
7
  offlineMethod: "localizeRef"
8
- }, m = /* @__PURE__ */ new Map(), j = {
8
+ }, j = {
9
9
  schema: "bundle-assets",
10
10
  // canResolve(ref: string) {
11
11
  // return canResolveRefSchema(ref, SCHEMA_PREFIX_BASE);
12
12
  // },
13
- async resolveRef(e) {
14
- if (i("bundleAssetsResolver resolveRef:", e), m.has(e))
15
- return m.get(e);
16
- const t = h(e), n = fetch(t).then(async (o) => {
17
- if (!o.ok)
13
+ async resolveRef(e, t) {
14
+ var o, a;
15
+ if (l("bundleAssetsResolver resolveRef:", e), (o = t.refCache) != null && o.has(e))
16
+ return t.refCache.get(e);
17
+ const r = m(e), n = fetch(r).then(async (s) => {
18
+ var f;
19
+ if (!s.ok)
18
20
  throw new Error(`Failed to fetch ref from ${e}`);
19
- const r = await o.json(), s = t.substring(0, t.lastIndexOf("/") + 1), a = r.map((c) => ({
20
- $ref: `asset+${s}${c}`
21
+ (f = t.fetchCallback) == null || f.call(t, r);
22
+ const i = await s.json(), w = r.substring(0, r.lastIndexOf("/") + 1), c = i.map((u) => ({
23
+ $ref: `asset+${w}${u}`
21
24
  }));
22
- return l(a), a;
25
+ return d(c), c;
23
26
  });
24
- return m.set(e, n), n;
27
+ return (a = t.refCache) == null || a.set(e, n), n;
25
28
  },
26
29
  // async *makeOfflineRef(ref: string) {
27
30
  // log('bundleAssetsResolver makeOfflineRef:', ref);
@@ -52,38 +55,39 @@ const k = {
52
55
  // yield { data, targetFilePath };
53
56
  // return { $ref: targetFilePath, [STOP_RESOLVING]: true };
54
57
  // },
55
- }, u = "https://efp-runtime.expofp.com/", v = /* @__PURE__ */ new Map(), M = {
58
+ }, F = "https://efp-runtime.expofp.com/", M = {
56
59
  schema: "expo-runtime-branch",
57
60
  // canResolve(ref: string) {
58
61
  // return canResolveRefSchema(ref, SCHEMA);
59
62
  // },
60
- async resolveRef(e) {
61
- if (i("expoRuntimeBranchResolver resolveRef:", e), v.has(e))
62
- return v.get(e);
63
- const t = h(e), n = new Promise(async (o, r) => {
63
+ async resolveRef(e, t) {
64
+ var o, a;
65
+ if (l("expoRuntimeBranchResolver resolveRef:", e), (o = t.refCache) != null && o.has(e))
66
+ return t.refCache.get(e);
67
+ const r = m(e), n = new Promise(async (s, i) => {
68
+ var w;
64
69
  try {
65
- const s = [`${u}branches/${t}.json`];
66
- t.startsWith("vite-") || s.push(`${u}branches/vite-${t}.json`), s.includes(`${u}branches/vite-main.json`) || s.push(`${u}branches/vite-main.json`), s.includes(`${u}branches/vite-next.json`) || s.push(`${u}branches/vite-next.json`);
67
- let a;
68
- for (const d of s) {
69
- i("Fetching HTTP:", d);
70
- const f = await fetch(d);
71
- if (f.ok) {
72
- a = await f.json();
70
+ const c = [`${F}branches/${r}.json`];
71
+ let f;
72
+ for (const p of c) {
73
+ l("Fetching HTTP:", p);
74
+ const h = await fetch(p);
75
+ if (h.ok) {
76
+ (w = t.fetchCallback) == null || w.call(t, p), f = await h.json();
73
77
  break;
74
78
  }
75
79
  }
76
- if (!a)
80
+ if (!f)
77
81
  throw new Error(`Failed to fetch release from ${e}`);
78
- const c = {
79
- $ref: `expo-runtime+https://efp-runtime.expofp.com/releases/${a}/`
82
+ const u = {
83
+ $ref: `expo-runtime+https://efp-runtime.expofp.com/releases/${f}/`
80
84
  };
81
- l(c), o(c);
82
- } catch (s) {
83
- r(s);
85
+ d(u), s(u);
86
+ } catch (c) {
87
+ i(c);
84
88
  }
85
89
  });
86
- return v.set(e, n), n;
90
+ return (a = t.refCache) == null || a.set(e, n), n;
87
91
  },
88
92
  // async *makeOfflineRef(ref: string) {
89
93
  // log('expoRuntimeBranchResolver makeOfflineRef:', ref);
@@ -103,26 +107,29 @@ const k = {
103
107
  // return targetFilePath;
104
108
  // },
105
109
  offlineMethod: "resolveRef"
106
- }, $ = /* @__PURE__ */ new Map(), T = {
110
+ }, A = {
107
111
  schema: "expo-runtime-get-branch",
108
112
  // canResolve(ref: string) {
109
113
  // return canResolveRefSchema(ref, SCHEMA);
110
114
  // },
111
- async resolveRef(e) {
112
- if (i("expoRuntimeGetBranchResolver resolveRef:", e), $.has(e))
113
- return $.get(e);
114
- const t = h(e), n = `https://${t}.expofp.com/get-branch`;
115
- i("Fetching HTTP:", n);
116
- const o = fetch(n).then(async (r) => {
117
- if (!r.ok)
115
+ async resolveRef(e, t) {
116
+ var a, s;
117
+ if (l("expoRuntimeGetBranchResolver resolveRef:", e), (a = t.refCache) != null && a.has(e))
118
+ return t.refCache.get(e);
119
+ const r = m(e), n = `https://${r}.expofp.com/get-branch`;
120
+ l("Fetching HTTP:", n);
121
+ const o = fetch(n).then(async (i) => {
122
+ var u;
123
+ if (!i.ok)
118
124
  throw new Error(`Failed to fetch ref from ${e}`);
119
- const a = (await r.json()).branch;
120
- if (!a)
121
- throw new Error(`Invalid response when fetching branch for expo ${t}`);
122
- const c = { $ref: `expo-runtime-branch:${a}` };
123
- return l(c), c;
125
+ (u = t.fetchCallback) == null || u.call(t, n);
126
+ const c = (await i.json()).branch;
127
+ if (!c)
128
+ throw new Error(`Invalid response when fetching branch for expo ${r}`);
129
+ const f = { $ref: `expo-runtime-branch:${c}` };
130
+ return d(f), f;
124
131
  });
125
- return $.set(e, o), o;
132
+ return (s = t.refCache) == null || s.set(e, o), o;
126
133
  },
127
134
  // async *makeOfflineRef(ref: string) {
128
135
  // log('expoRuntimeBranchResolver makeOfflineRef:', ref);
@@ -142,18 +149,18 @@ const k = {
142
149
  // return targetFilePath;
143
150
  // },
144
151
  offlineMethod: "resolveRef"
145
- }, A = {
152
+ }, T = {
146
153
  schema: "expo-runtime",
147
154
  // canResolve(ref: string) {
148
155
  // return canResolveRefSchema(ref, SCHEMA);
149
156
  // },
150
157
  async resolveRef(e) {
151
- i("expoRuntimeResolver resolveRef:", e);
152
- const t = h(e), n = {
158
+ l("expoRuntimeResolver resolveRef:", e);
159
+ const t = m(e), r = {
153
160
  entry: { $ref: `asset+${t}expofp.js` },
154
161
  assets: { $ref: `bundle-assets+${t}bundle.json` }
155
162
  };
156
- return l(n), n;
163
+ return d(r), r;
157
164
  },
158
165
  // async *makeOfflineRef(ref: string) {
159
166
  // log('expoRuntimeResolver makeOfflineRef:', ref);
@@ -173,22 +180,25 @@ const k = {
173
180
  // return targetFilePath;
174
181
  // },
175
182
  offlineMethod: "resolveRef"
176
- }, y = /* @__PURE__ */ new Map(), C = {
183
+ }, B = {
177
184
  canResolve(e) {
178
185
  return e.startsWith("http://") || e.startsWith("https://") || e.startsWith("./");
179
186
  },
180
- async resolveRef(e) {
181
- if (i("httpResolver resolveRef:", e), !this.canResolve(e)) throw new Error(`Unexpected ref in httpResolver: ${e}`);
182
- if (y.has(e))
183
- return y.get(e);
184
- i("Fetching HTTP ref:", e);
185
- const t = fetch(e).then(async (n) => {
186
- if (!n.ok)
187
+ async resolveRef(e, t) {
188
+ var n, o;
189
+ if (l("httpResolver resolveRef:", e), !this.canResolve(e)) throw new Error(`Unexpected ref in httpResolver: ${e}`);
190
+ if ((n = t.refCache) != null && n.has(e))
191
+ return t.refCache.get(e);
192
+ l("Fetching HTTP ref:", e);
193
+ const r = fetch(e).then(async (a) => {
194
+ var i;
195
+ if (!a.ok)
187
196
  throw new Error(`Failed to fetch ref from ${e}`);
188
- const o = await n.json();
189
- return l(o), o;
197
+ (i = t.fetchCallback) == null || i.call(t, e);
198
+ const s = await a.json();
199
+ return d(s), s;
190
200
  });
191
- return y.set(e, t), t;
201
+ return (o = t.refCache) == null || o.set(e, r), r;
192
202
  },
193
203
  // async *makeOfflineRef(ref) {
194
204
  // log('httpResolver makeOfflineRef:', ref);
@@ -209,33 +219,33 @@ const k = {
209
219
  // },
210
220
  offlineMethod: "resolveRef"
211
221
  };
212
- async function b(e, t = {}) {
213
- const { globalVar: n, timeoutMs: o = 1e4, pollIntervalMs: r = 10 } = t;
214
- I() ? (await B(e), n && await x(() => window[n], n, o, r)) : (await W(e), n && await x(
215
- () => globalThis[n],
222
+ async function g(e, t = {}) {
223
+ const { globalVar: r, timeoutMs: n = 1e4, pollIntervalMs: o = 10 } = t;
224
+ N() ? (await P(e), r && await R(() => window[r], r, n, o)) : (await S(e), r && await R(
225
+ () => globalThis[r],
226
+ r,
216
227
  n,
217
- o,
218
- r
228
+ o
219
229
  ));
220
230
  }
221
- function I() {
231
+ function N() {
222
232
  return typeof window < "u" && typeof document < "u";
223
233
  }
224
- function B(e) {
225
- return new Promise((t, n) => {
226
- const o = document.createElement("script");
227
- o.src = e, o.async = !0;
228
- const r = () => {
229
- o.onload = null, o.onerror = null;
234
+ function P(e) {
235
+ return new Promise((t, r) => {
236
+ const n = document.createElement("script");
237
+ n.src = e, n.async = !0;
238
+ const o = () => {
239
+ n.onload = null, n.onerror = null;
230
240
  };
231
- o.onload = () => {
232
- r(), t();
233
- }, o.onerror = () => {
234
- r(), n(new Error(`Failed to load script: ${e}`));
235
- }, document.head.appendChild(o);
241
+ n.onload = () => {
242
+ o(), t();
243
+ }, n.onerror = () => {
244
+ o(), r(new Error(`Failed to load script: ${e}`));
245
+ }, document.head.appendChild(n);
236
246
  });
237
247
  }
238
- async function W(e) {
248
+ async function S(e) {
239
249
  if (typeof fetch != "function")
240
250
  throw new Error(
241
251
  "loadAndWaitGlobal: fetch is not available. Use Node 18+ or provide a global fetch."
@@ -243,251 +253,312 @@ async function W(e) {
243
253
  const t = await fetch(e);
244
254
  if (!t.ok)
245
255
  throw new Error(`Failed to load script in Node (HTTP ${t.status}): ${e}`);
246
- const n = await t.text();
247
- (0, eval)(n);
256
+ const r = await t.text();
257
+ (0, eval)(r);
248
258
  }
249
- function x(e, t, n, o) {
250
- return new Promise((r, s) => {
251
- const a = performance.now(), c = () => {
259
+ function R(e, t, r, n) {
260
+ return new Promise((o, a) => {
261
+ const s = performance.now(), i = () => {
252
262
  try {
253
263
  if (e() !== void 0)
254
- return r();
264
+ return o();
255
265
  } catch {
256
266
  }
257
- if (performance.now() - a >= n)
258
- return s(new Error(`Timed out after ${n} ms waiting for global "${t}"`));
259
- setTimeout(c, o);
267
+ if (performance.now() - s >= r)
268
+ return a(new Error(`Timed out after ${r} ms waiting for global "${t}"`));
269
+ setTimeout(i, n);
260
270
  };
261
- c();
271
+ i();
262
272
  });
263
273
  }
264
- const g = /* @__PURE__ */ new Map(), N = {
274
+ const W = {
265
275
  schema: "legacy-data",
266
276
  // canResolve: (ref: string) => canResolveRefSchema(ref, 'legacy-data-js'),
267
- async resolveRef(e) {
268
- if (i("legacyDataResolver resolveRef:", e), g.has(e))
269
- return g.get(e);
270
- const t = (async () => {
271
- const n = h(e);
277
+ async resolveRef(e, t) {
278
+ var n, o;
279
+ if (l("legacyDataResolver resolveRef:", e), (n = t.refCache) != null && n.has(e))
280
+ return t.refCache.get(e);
281
+ const r = (async () => {
282
+ const a = m(e);
272
283
  try {
273
- await b(`${n}version.js`);
284
+ await g(`${a}version.js`);
274
285
  } catch {
275
286
  console.warn("Could not load version.js, proceeding without it");
276
287
  }
277
- const o = globalThis.__fpDataVersion || (+/* @__PURE__ */ new Date()).toString();
278
- let r = [];
288
+ const s = globalThis.__fpDataVersion || (+/* @__PURE__ */ new Date()).toString();
289
+ let i = [];
279
290
  await Promise.all([
280
291
  (async function() {
281
- const w = await fetch(`${n}files.json?v=${o}`);
282
- if (w.ok) r = await w.json();
292
+ const h = await fetch(`${a}files.json?v=${s}`);
293
+ if (h.ok) i = await h.json();
283
294
  else
284
- throw new Error(`Could not load files.json from ${n}files.json?v=${o}`);
295
+ throw new Error(`Could not load files.json from ${a}files.json?v=${s}`);
285
296
  })(),
286
- b(`${n}data.js?v=${o}`, { globalVar: "__data" })
297
+ g(`${a}data.js?v=${s}`, { globalVar: "__data" })
287
298
  // injectAndWaitForGlobal(`${dataUrlBase}data.js?v=${version}`, '__data'),
288
299
  // injectAndWaitForGlobal(`${dataUrlBase}fp.svg.js?v=${version}`, '__fp'),
289
300
  ]);
290
- const s = globalThis.__data || {}, c = [...r, "data.js"].reduce((f, w) => (f[w] = { $ref: `asset+${n}${w}?v=${o}` }, f), {}), d = {
291
- _to_remove_for_offline_to_work_dataUrlBase: n,
301
+ const w = globalThis.__data || {}, f = [...i, "data.js"].reduce((p, h) => (p[h] = { $ref: `asset+${a}${h}?v=${s}` }, p), {}), u = {
302
+ _to_remove_for_offline_to_work_dataUrlBase: a,
292
303
  // dataFiles: dataFiles.reduce((map, file) => {
293
304
  // map[file] = { $ref: `asset+${dataUrlBase}${file}?v=${version}` };
294
305
  // return map;
295
306
  // }, {} as Record<string, { $ref: string }>),
296
- "legacy-asset-urls": { ...c, ...S(n, s) }
307
+ legacyAssetUrls: { ...f, ...D(a, w) }
297
308
  };
298
- return l(d), d;
309
+ return d(u), u;
299
310
  })();
300
- return g.set(e, t), t;
311
+ return (o = t.refCache) == null || o.set(e, r), r;
301
312
  },
302
313
  offlineMethod: "resolveRef"
303
314
  };
304
- function S(e, t) {
305
- const n = /* @__PURE__ */ new Set();
306
- function o(r) {
307
- typeof r == "string" && r.length > 0 && n.add(r);
315
+ function D(e, t) {
316
+ const r = /* @__PURE__ */ new Set();
317
+ function n(o) {
318
+ typeof o == "string" && o.length > 0 && r.add(o);
308
319
  }
309
- return o(t.logo), t.exhibitors.forEach((r) => {
310
- var s;
311
- o(r.logo), (s = r.gallery) == null || s.forEach((a) => o(a));
312
- }), t.events.forEach((r) => {
313
- var s;
314
- o(r.logoFile), (s = r.speakers) == null || s.forEach((a) => {
315
- o(a.photoFile);
320
+ return n(t.logo), t.exhibitors.forEach((o) => {
321
+ var a;
322
+ n(o.logo), (a = o.gallery) == null || a.forEach((s) => n(s));
323
+ }), t.events.forEach((o) => {
324
+ var a;
325
+ n(o.logoFile), (a = o.speakers) == null || a.forEach((s) => {
326
+ n(s.photoFile);
316
327
  });
317
- }), Array.from(n).reduce((r, s) => (r[s] = { $ref: `asset+${e}${s}` }, r), {});
328
+ }), Array.from(r).reduce((o, a) => (o[a] = { $ref: `asset+${e}${a}` }, o), {});
318
329
  }
319
- const D = [
320
- C,
330
+ const I = [
331
+ B,
321
332
  j,
322
- k,
323
- A,
324
- M,
333
+ _,
325
334
  T,
335
+ M,
336
+ A,
326
337
  // expoResolver,
327
- N
328
- ];
329
- async function O(e, t) {
330
- if (i("Resolving:", t), typeof t != "string")
338
+ W
339
+ ], U = /* @__PURE__ */ new Map();
340
+ async function b(e, t, r) {
341
+ l("Resolving:", t), typeof window < "u" && (window.__lastResolveObject = e);
342
+ let n;
343
+ !r || r.refCache === "global" ? n = U : (r == null ? void 0 : r.refCache) === "temp" ? n = /* @__PURE__ */ new Map() : (r == null ? void 0 : r.refCache) === "disable" ? n = void 0 : n = r == null ? void 0 : r.refCache;
344
+ const o = {
345
+ refCache: n,
346
+ fetchCallback: r == null ? void 0 : r.fetchCallback
347
+ };
348
+ if (typeof t != "string")
331
349
  throw new Error(`Invalid JSON Pointer (not a string): ${t}`);
332
350
  if (!t.startsWith("/"))
333
351
  throw new Error(`Invalid JSON Pointer: ${t}`);
334
352
  if (t.length > 1 && t.endsWith("/"))
335
353
  throw new Error(`Invalid JSON Pointer: ${t}`);
336
- if (t === "/")
337
- return await R(e);
338
- const n = t.substring(1).split("/");
339
- if (n.some((r) => r.length === 0))
354
+ let a;
355
+ if (t === "/" ? a = [] : a = t.substring(1).split("/"), a.some((s) => s.length === 0))
340
356
  throw new Error(`Invalid JSON Pointer (empty part): ${t}`);
341
- const o = await P(e, n);
342
- return i(`Resolved ${t}:`, o), o;
357
+ if (r != null && r.mutate) {
358
+ a.unshift("root");
359
+ const s = { root: e };
360
+ await E(
361
+ s,
362
+ // 'root',
363
+ a,
364
+ 0,
365
+ o
366
+ ), V(e, s.root);
367
+ } else
368
+ return await C(e, a, 0, o);
343
369
  }
344
- typeof window < "u" && (window.__debugResolve = O);
345
- async function P(e, t) {
346
- let n = 0, o = await R(e);
347
- for (; n < t.length; ) {
348
- const r = t[n];
349
- if (typeof o != "object" || o === null)
370
+ async function E(e, t, r, n) {
371
+ const o = t[r];
372
+ if (await z(e, o, n), r != t.length - 1) {
373
+ if (e[o] === null || typeof e[o] != "object")
350
374
  throw new Error(
351
375
  `Cannot resolve path, encountered non-object at part '${t.join(
352
376
  "/"
353
- )}, index ${n}'`
377
+ )}', index ${r}'`
354
378
  );
355
- const s = o[r];
356
- o = await R(s), n++;
379
+ return await E(e[o], t, r + 1, n);
357
380
  }
358
- return o;
359
381
  }
360
- async function R(e) {
361
- i("resolveObject:", e);
362
- let t = e;
382
+ async function z(e, t, r) {
383
+ l("resolveObjectMutate:", e, t);
384
+ let n = e[t];
385
+ const o = await y(n, r);
386
+ o !== void 0 && (e[t] = o);
387
+ }
388
+ async function C(e, t, r, n) {
389
+ if (r === t.length)
390
+ return await y(e, n);
391
+ if (e === null || typeof e != "object")
392
+ throw new Error(
393
+ `Cannot resolve path, encountered non-object at part '${t.join("/")}', index ${r}'`
394
+ );
395
+ const o = t[r];
396
+ let a = e[o];
397
+ return a === void 0 && (a = (await y(e, n))[o]), await C(a, t, r + 1, n);
398
+ }
399
+ async function y(e, t) {
400
+ l("resolveObject:", e);
401
+ let r = e;
363
402
  do {
364
- if (typeof t != "object" || t === null || !("$ref" in t))
365
- return t;
366
- const n = D.filter((r) => F(r, t.$ref));
403
+ if (typeof r != "object" || r === null || !("$ref" in r))
404
+ return r;
405
+ const n = I.filter((a) => O(a, r.$ref));
367
406
  if (n.length === 0) {
368
- if (t.$ref)
369
- throw new Error(`No resolver found for ref: ${t.$ref}`);
370
- return l(t), t;
407
+ if (r.$ref)
408
+ throw new Error(`No resolver found for ref: ${r.$ref}`);
409
+ return d(r), r;
371
410
  }
372
411
  if (n.length > 1)
373
- throw new Error(`Multiple resolvers can resolve ref: ${t.$ref}`);
374
- const o = await U(n[0], t.$ref);
375
- t = H(o, t);
412
+ throw new Error(`Multiple resolvers can resolve ref: ${r.$ref}`);
413
+ const o = await J(n[0], r.$ref, t);
414
+ r = L(o, r);
376
415
  } while (!0);
377
416
  }
378
- async function U(e, t) {
379
- if (!F(e, t))
417
+ async function J(e, t, r) {
418
+ if (!O(e, t))
380
419
  throw new Error(`Unexpected ref: ${t}`);
381
- return e.resolveRef(t);
420
+ return e.resolveRef(t, r);
382
421
  }
383
- function F(e, t) {
422
+ function O(e, t) {
384
423
  if (e.canResolve)
385
424
  return e.canResolve(t);
386
425
  if (e.schema)
387
- return z(t, e.schema);
426
+ return H(t, e.schema);
388
427
  throw new Error("Resolver is missing canResolve method and schema property");
389
428
  }
390
- function z(e, t) {
391
- const n = [`${t}+`, `${t}:`];
392
- for (const o of n)
393
- if (e.startsWith(o))
429
+ function H(e, t) {
430
+ const r = [`${t}+`, `${t}:`];
431
+ for (const n of r)
432
+ if (e.startsWith(n))
394
433
  return !0;
395
434
  return !1;
396
435
  }
397
- function h(e) {
436
+ function m(e) {
398
437
  if (e.startsWith("http://") || e.startsWith("https://"))
399
438
  return e;
400
- const t = e.indexOf("+http://"), n = e.indexOf("+https://");
439
+ const t = e.indexOf("+http://"), r = e.indexOf("+https://");
401
440
  if (t !== -1)
402
441
  return e.substring(t + 1);
442
+ if (r !== -1)
443
+ return e.substring(r + 1);
444
+ const n = e.indexOf(":");
403
445
  if (n !== -1)
404
446
  return e.substring(n + 1);
405
- const o = e.indexOf(":");
406
- if (o !== -1)
407
- return e.substring(o + 1);
408
447
  throw new Error(`Error getting URL from: ${e}, no valid prefix found`);
409
448
  }
410
- function p(e) {
411
- return async (t, ...n) => {
449
+ typeof window < "u" && (window.__debugResolve = async function(t, r, n) {
450
+ let o, a, s;
451
+ return typeof t == "string" ? (o = window.__lastResolveObject, a = t, s = r) : (o = t, a = r, s = n), await b(o, a, s);
452
+ });
453
+ function v(e) {
454
+ return async (t, ...r) => {
412
455
  try {
413
- const s = (await import(await O(t, "/runtime/entry")))[e];
414
- return s(t, ...n);
415
- } catch (o) {
416
- throw console.error("efp-loader", `Error when trying to import and call "${e}":`, o), o;
456
+ const a = (await import(await b(t, "/runtime/entry")))[e];
457
+ return a(t, ...r);
458
+ } catch (n) {
459
+ throw console.error("efp-loader", `Error when trying to import and call "${e}":`, n), n;
417
460
  }
418
461
  };
419
462
  }
420
- function i(...e) {
463
+ function l(...e) {
421
464
  console.debug("efp-loader", ...e);
422
465
  }
423
- function l(e) {
466
+ function d(e) {
424
467
  if (e === null || typeof e != "object") return e;
425
468
  Object.freeze(e);
426
469
  for (const t of Object.keys(e)) {
427
- const n = e[t];
428
- typeof n == "object" && n !== null && !Object.isFrozen(n) && l(n);
470
+ const r = e[t];
471
+ typeof r == "object" && r !== null && !Object.isFrozen(r) && d(r);
429
472
  }
430
473
  return e;
431
474
  }
432
- function E(e) {
475
+ function $(e) {
433
476
  return "structuredClone" in globalThis ? globalThis.structuredClone(e) : JSON.parse(JSON.stringify(e));
434
477
  }
435
- function J(e) {
478
+ function G(e) {
436
479
  if (typeof document > "u") return;
437
480
  const t = document.createElement("link");
438
481
  t.rel = "preconnect", t.href = e, t.crossOrigin = "anonymous", document.head.appendChild(t);
439
482
  }
440
- function H(e, t) {
483
+ function L(e, t) {
441
484
  if (e === t) return;
442
485
  if (t === null || typeof t != "object")
443
486
  throw new Error("Cannot merge non-object source");
444
487
  if (Array.isArray(t))
445
488
  throw new Error("Cannot merge arrays");
446
- const n = Object.keys(t).filter((r) => r !== "$ref");
447
- if (n.length === 0) return E(e);
489
+ const r = Object.keys(t).filter((o) => o !== "$ref");
490
+ if (r.length === 0) return $(e);
448
491
  if (Array.isArray(e))
449
492
  throw new Error("Cannot merge into arrays");
450
493
  if (e === null || typeof e != "object")
451
494
  throw new Error("Cannot merge into non-object target");
452
- const o = E({ ...e });
453
- for (const r of n)
454
- o[r] = t[r];
455
- return o;
495
+ const n = $({ ...e });
496
+ for (const o of r)
497
+ n[o] = t[o];
498
+ return n;
499
+ }
500
+ function V(e, t) {
501
+ if (e !== t) {
502
+ if (t === null || typeof t != "object")
503
+ throw new Error("Cannot replace with non-object source");
504
+ if (e === null || typeof e != "object")
505
+ throw new Error("Cannot replace non-object target");
506
+ if (Array.isArray(e)) {
507
+ if (!Array.isArray(t))
508
+ throw new Error("replaceObjectFields does not support mixing arrays and objects");
509
+ e.length = 0;
510
+ for (const r of t)
511
+ e.push(r);
512
+ return;
513
+ }
514
+ for (const r of Object.keys(e))
515
+ r in t || delete e[r];
516
+ for (const r of Object.keys(t))
517
+ e[r] = t[r];
518
+ }
519
+ }
520
+ async function Z(e, t, r) {
521
+ if (r || (r = { refCache: /* @__PURE__ */ new Map(), mutate: !0 }), !r.mutate)
522
+ throw new Error("resolveContext.mutate must be true for mutateManifest");
523
+ for (const n of t)
524
+ await b(e, n, r);
456
525
  }
457
- async function G(e) {
458
- const { makeOfflineBundle: t } = await import("./makeOfflineBundle-CDWAdTIW.js");
526
+ typeof window < "u" && (window.__debugMutateManifest = Z);
527
+ async function K(e) {
528
+ const { makeOfflineBundle: t } = await import("./makeOfflineBundle-BXfViegK.js");
459
529
  return await t(e);
460
530
  }
461
- async function L(e) {
462
- const { downloadZip: t } = await import("./downloadZip-DwDnK9eb.js");
531
+ async function q(e) {
532
+ const { downloadZip: t } = await import("./downloadZip-CKCMYGtc.js");
463
533
  return await t(e);
464
534
  }
465
- async function V(e) {
466
- const { makeOffline: t } = await import("./makeOffline-bamiAsgC.js"), n = await t(e);
467
- for await (const o of (await n).files)
468
- "data" in o ? console.info(`🗳️ Put ${o.targetFilePath} <=`, o.data) : "url" in o && console.info(`🗳️ Download ${o.targetFilePath} <= ${o.url}`);
469
- console.info("Offline data: ", n.manifest);
535
+ async function Q(e) {
536
+ const { makeOffline: t } = await import("./makeOffline-CttQujH7.js"), r = await t(e);
537
+ for await (const n of (await r).files)
538
+ "data" in n ? console.info(`🗳️ Put ${n.targetFilePath} <=`, n.data) : "url" in n && console.info(`🗳️ Download ${n.targetFilePath} <= ${n.url}`);
539
+ console.info("Offline data: ", r.manifest);
470
540
  }
471
- typeof window < "u" && (window.__debugDownloadZip = L, window.__debugMakeOfflineBundle = G, window.__debugLogOfflineManifestFiles = V);
472
- const Z = p("mount"), K = p("load"), q = p("initialize");
473
- async function Q(e, t, ...n) {
474
- return await p(e)(t, ...n);
541
+ typeof window < "u" && (window.__debugDownloadZip = q, window.__debugMakeOfflineBundle = K, window.__debugLogOfflineManifestFiles = Q);
542
+ const X = v("mount"), Y = v("load"), x = v("initialize");
543
+ async function ee(e, t, ...r) {
544
+ return await v(e)(t, ...r);
475
545
  }
476
- J("https://efp-runtime.expofp.com/");
546
+ G("https://efp-runtime.expofp.com/");
477
547
  export {
478
- H as a,
479
- U as b,
480
- F as c,
481
- Q as callFunction_Experimental,
482
- E as d,
483
- L as downloadZip,
484
- q as initialize,
485
- i as l,
486
- K as load,
487
- G as makeOfflineBundle,
488
- Z as mount,
489
- h as p,
490
- D as r,
491
- O as resolve
548
+ L as a,
549
+ J as b,
550
+ O as c,
551
+ ee as callFunction_Experimental,
552
+ $ as d,
553
+ q as downloadZip,
554
+ x as initialize,
555
+ l,
556
+ Y as load,
557
+ K as makeOfflineBundle,
558
+ X as mount,
559
+ Z as mutateManifest,
560
+ m as p,
561
+ I as r,
562
+ b as resolve
492
563
  };
493
564
  //# sourceMappingURL=index.js.map