@storyblok/svelte 2.4.0 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,300 +1,301 @@
1
- var ne = Object.defineProperty, oe = Object.defineProperties, ie = Object.getOwnPropertyDescriptors, q = Object.getOwnPropertySymbols, ae = Object.prototype.hasOwnProperty, ce = Object.prototype.propertyIsEnumerable, B = (r, e, t) => e in r ? ne(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, p = (r, e) => {
2
- for (var t in e || (e = {}))
3
- ae.call(e, t) && B(r, t, e[t]);
4
- if (q)
5
- for (var t of q(e))
6
- ce.call(e, t) && B(r, t, e[t]);
7
- return r;
8
- }, j = (r, e) => oe(r, ie(e));
9
- let D = !1;
10
- const F = [], le = (r) => new Promise((e, t) => {
1
+ let U = !1;
2
+ const H = [], tt = (s) => new Promise((t, e) => {
11
3
  if (typeof window > "u" || (window.storyblokRegisterEvent = (n) => {
12
4
  if (window.location === window.parent.location) {
13
5
  console.warn("You are not in Draft Mode or in the Visual Editor.");
14
6
  return;
15
7
  }
16
- D ? n() : F.push(n);
8
+ U ? n() : H.push(n);
17
9
  }, document.getElementById("storyblok-javascript-bridge")))
18
10
  return;
19
- const s = document.createElement("script");
20
- s.async = !0, s.src = r, s.id = "storyblok-javascript-bridge", s.onerror = (n) => t(n), s.onload = (n) => {
21
- F.forEach((o) => o()), D = !0, e(n);
22
- }, document.getElementsByTagName("head")[0].appendChild(s);
11
+ const r = document.createElement("script");
12
+ r.async = !0, r.src = s, r.id = "storyblok-javascript-bridge", r.onerror = (n) => e(n), r.onload = (n) => {
13
+ H.forEach((o) => o()), U = !0, t(n);
14
+ }, document.getElementsByTagName("head")[0].appendChild(r);
23
15
  });
24
- var he = Object.defineProperty, ue = (r, e, t) => e in r ? he(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, h = (r, e, t) => (ue(r, typeof e != "symbol" ? e + "" : e, t), t);
25
- function J(r) {
26
- return !(r !== r || r === 1 / 0 || r === -1 / 0);
16
+ var et = Object.defineProperty, st = (s, t, e) => t in s ? et(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, h = (s, t, e) => (st(s, typeof t != "symbol" ? t + "" : t, e), e);
17
+ function q(s) {
18
+ return !(s !== s || s === 1 / 0 || s === -1 / 0);
27
19
  }
28
- function de(r, e, t) {
29
- if (!J(e))
20
+ function rt(s, t, e) {
21
+ if (!q(t))
30
22
  throw new TypeError("Expected `limit` to be a finite number");
31
- if (!J(t))
23
+ if (!q(e))
32
24
  throw new TypeError("Expected `interval` to be a finite number");
33
- const s = [];
25
+ const r = [];
34
26
  let n = [], o = 0;
35
27
  const a = function() {
36
28
  o++;
37
29
  const c = setTimeout(function() {
38
- o--, s.length > 0 && a(), n = n.filter(function(u) {
30
+ o--, r.length > 0 && a(), n = n.filter(function(u) {
39
31
  return u !== c;
40
32
  });
41
- }, t);
33
+ }, e);
42
34
  n.indexOf(c) < 0 && n.push(c);
43
- const l = s.shift();
44
- l.resolve(r.apply(l.self, l.args));
35
+ const l = r.shift();
36
+ l.resolve(s.apply(l.self, l.args));
45
37
  }, i = function(...c) {
46
38
  const l = this;
47
39
  return new Promise(function(u, d) {
48
- s.push({
40
+ r.push({
49
41
  resolve: u,
50
42
  reject: d,
51
43
  args: c,
52
44
  self: l
53
- }), o < e && a();
45
+ }), o < t && a();
54
46
  });
55
47
  };
56
48
  return i.abort = function() {
57
- n.forEach(clearTimeout), n = [], s.forEach(function(c) {
49
+ n.forEach(clearTimeout), n = [], r.forEach(function(c) {
58
50
  c.reject(function() {
59
51
  Error.call(this, "Throttled function aborted"), this.name = "AbortError";
60
52
  });
61
- }), s.length = 0;
53
+ }), r.length = 0;
62
54
  }, i;
63
55
  }
64
- const fe = function(r, e) {
65
- const t = {};
66
- for (const s in r) {
67
- const n = r[s];
68
- e.indexOf(s) > -1 && n !== null && (t[s] = n);
56
+ const nt = function(s, t) {
57
+ const e = {};
58
+ for (const r in s) {
59
+ const n = s[r];
60
+ t.indexOf(r) > -1 && n !== null && (e[r] = n);
69
61
  }
70
- return t;
71
- }, pe = (r) => r === "email", ge = () => ({
62
+ return e;
63
+ }, ot = (s) => s === "email", it = () => ({
72
64
  singleTag: "hr"
73
- }), me = () => ({
65
+ }), at = () => ({
74
66
  tag: "blockquote"
75
- }), ye = () => ({
67
+ }), ct = () => ({
76
68
  tag: "ul"
77
- }), _e = (r) => ({
69
+ }), lt = (s) => ({
78
70
  tag: [
79
71
  "pre",
80
72
  {
81
73
  tag: "code",
82
- attrs: r.attrs
74
+ attrs: s.attrs
83
75
  }
84
76
  ]
85
- }), be = () => ({
77
+ }), ht = () => ({
86
78
  singleTag: "br"
87
- }), ke = (r) => ({
88
- tag: `h${r.attrs.level}`
89
- }), ve = (r) => ({
79
+ }), ut = (s) => ({
80
+ tag: `h${s.attrs.level}`
81
+ }), dt = (s) => ({
90
82
  singleTag: [
91
83
  {
92
84
  tag: "img",
93
- attrs: fe(r.attrs, ["src", "alt", "title"])
85
+ attrs: nt(s.attrs, ["src", "alt", "title"])
94
86
  }
95
87
  ]
96
- }), we = () => ({
88
+ }), ft = () => ({
97
89
  tag: "li"
98
- }), $e = () => ({
90
+ }), pt = () => ({
99
91
  tag: "ol"
100
- }), Te = () => ({
92
+ }), gt = () => ({
101
93
  tag: "p"
102
- }), Re = () => ({
94
+ }), mt = () => ({
103
95
  tag: "b"
104
- }), xe = () => ({
96
+ }), yt = () => ({
105
97
  tag: "strike"
106
- }), je = () => ({
98
+ }), kt = () => ({
107
99
  tag: "u"
108
- }), Pe = () => ({
100
+ }), _t = () => ({
109
101
  tag: "strong"
110
- }), Oe = () => ({
102
+ }), bt = () => ({
111
103
  tag: "code"
112
- }), Ee = () => ({
104
+ }), vt = () => ({
113
105
  tag: "i"
114
- }), Se = (r) => {
115
- const e = p({}, r.attrs), { linktype: t = "url" } = r.attrs;
116
- return pe(t) && (e.href = `mailto:${e.href}`), e.anchor && (e.href = `${e.href}#${e.anchor}`, delete e.anchor), {
106
+ }), wt = (s) => {
107
+ const t = { ...s.attrs }, { linktype: e = "url" } = s.attrs;
108
+ return ot(e) && (t.href = `mailto:${t.href}`), t.anchor && (t.href = `${t.href}#${t.anchor}`, delete t.anchor), {
117
109
  tag: [
118
110
  {
119
111
  tag: "a",
120
- attrs: e
112
+ attrs: t
121
113
  }
122
114
  ]
123
115
  };
124
- }, Ie = (r) => ({
116
+ }, $t = (s) => ({
125
117
  tag: [
126
118
  {
127
119
  tag: "span",
128
- attrs: r.attrs
120
+ attrs: s.attrs
129
121
  }
130
122
  ]
131
- }), Ce = {
123
+ }), Tt = {
132
124
  nodes: {
133
- horizontal_rule: ge,
134
- blockquote: me,
135
- bullet_list: ye,
136
- code_block: _e,
137
- hard_break: be,
138
- heading: ke,
139
- image: ve,
140
- list_item: we,
141
- ordered_list: $e,
142
- paragraph: Te
125
+ horizontal_rule: it,
126
+ blockquote: at,
127
+ bullet_list: ct,
128
+ code_block: lt,
129
+ hard_break: ht,
130
+ heading: ut,
131
+ image: dt,
132
+ list_item: ft,
133
+ ordered_list: pt,
134
+ paragraph: gt
143
135
  },
144
136
  marks: {
145
- bold: Re,
146
- strike: xe,
147
- underline: je,
148
- strong: Pe,
149
- code: Oe,
150
- italic: Ee,
151
- link: Se,
152
- styled: Ie
153
- }
154
- }, Ae = function(r) {
155
- const e = {
137
+ bold: mt,
138
+ strike: yt,
139
+ underline: kt,
140
+ strong: _t,
141
+ code: bt,
142
+ italic: vt,
143
+ link: wt,
144
+ styled: $t
145
+ }
146
+ }, Rt = function(s) {
147
+ const t = {
156
148
  "&": "&amp;",
157
149
  "<": "&lt;",
158
150
  ">": "&gt;",
159
151
  '"': "&quot;",
160
152
  "'": "&#39;"
161
- }, t = /[&<>"']/g, s = RegExp(t.source);
162
- return r && s.test(r) ? r.replace(t, (n) => e[n]) : r;
153
+ }, e = /[&<>"']/g, r = RegExp(e.source);
154
+ return s && r.test(s) ? s.replace(e, (n) => t[n]) : s;
163
155
  };
164
- class R {
165
- constructor(e) {
166
- h(this, "marks"), h(this, "nodes"), e || (e = Ce), this.marks = e.marks || [], this.nodes = e.nodes || [];
167
- }
168
- addNode(e, t) {
169
- this.nodes[e] = t;
170
- }
171
- addMark(e, t) {
172
- this.marks[e] = t;
173
- }
174
- render(e) {
175
- if (e && e.content && Array.isArray(e.content)) {
176
- let t = "";
177
- return e.content.forEach((s) => {
178
- t += this.renderNode(s);
179
- }), t;
156
+ class T {
157
+ constructor(t) {
158
+ h(this, "marks"), h(this, "nodes"), t || (t = Tt), this.marks = t.marks || [], this.nodes = t.nodes || [];
159
+ }
160
+ addNode(t, e) {
161
+ this.nodes[t] = e;
162
+ }
163
+ addMark(t, e) {
164
+ this.marks[t] = e;
165
+ }
166
+ render(t) {
167
+ if (t && t.content && Array.isArray(t.content)) {
168
+ let e = "";
169
+ return t.content.forEach((r) => {
170
+ e += this.renderNode(r);
171
+ }), e;
180
172
  }
181
- return console.warn("The render method must receive an object with a content field, which is an array"), "";
173
+ return console.warn(
174
+ "The render method must receive an object with a content field, which is an array"
175
+ ), "";
182
176
  }
183
- renderNode(e) {
184
- const t = [];
185
- e.marks && e.marks.forEach((n) => {
177
+ renderNode(t) {
178
+ const e = [];
179
+ t.marks && t.marks.forEach((n) => {
186
180
  const o = this.getMatchingMark(n);
187
- o && t.push(this.renderOpeningTag(o.tag));
181
+ o && e.push(this.renderOpeningTag(o.tag));
188
182
  });
189
- const s = this.getMatchingNode(e);
190
- return s && s.tag && t.push(this.renderOpeningTag(s.tag)), e.content ? e.content.forEach((n) => {
191
- t.push(this.renderNode(n));
192
- }) : e.text ? t.push(Ae(e.text)) : s && s.singleTag ? t.push(this.renderTag(s.singleTag, " /")) : s && s.html && t.push(s.html), s && s.tag && t.push(this.renderClosingTag(s.tag)), e.marks && e.marks.slice(0).reverse().forEach((n) => {
183
+ const r = this.getMatchingNode(t);
184
+ return r && r.tag && e.push(this.renderOpeningTag(r.tag)), t.content ? t.content.forEach((n) => {
185
+ e.push(this.renderNode(n));
186
+ }) : t.text ? e.push(Rt(t.text)) : r && r.singleTag ? e.push(this.renderTag(r.singleTag, " /")) : r && r.html && e.push(r.html), r && r.tag && e.push(this.renderClosingTag(r.tag)), t.marks && t.marks.slice(0).reverse().forEach((n) => {
193
187
  const o = this.getMatchingMark(n);
194
- o && t.push(this.renderClosingTag(o.tag));
195
- }), t.join("");
188
+ o && e.push(this.renderClosingTag(o.tag));
189
+ }), e.join("");
196
190
  }
197
- renderTag(e, t) {
198
- return e.constructor === String ? `<${e}${t}>` : e.map((s) => {
199
- if (s.constructor === String)
200
- return `<${s}${t}>`;
191
+ renderTag(t, e) {
192
+ return t.constructor === String ? `<${t}${e}>` : t.map((r) => {
193
+ if (r.constructor === String)
194
+ return `<${r}${e}>`;
201
195
  {
202
- let n = `<${s.tag}`;
203
- if (s.attrs)
204
- for (const o in s.attrs) {
205
- const a = s.attrs[o];
196
+ let n = `<${r.tag}`;
197
+ if (r.attrs)
198
+ for (const o in r.attrs) {
199
+ const a = r.attrs[o];
206
200
  a !== null && (n += ` ${o}="${a}"`);
207
201
  }
208
- return `${n}${t}>`;
202
+ return `${n}${e}>`;
209
203
  }
210
204
  }).join("");
211
205
  }
212
- renderOpeningTag(e) {
213
- return this.renderTag(e, "");
206
+ renderOpeningTag(t) {
207
+ return this.renderTag(t, "");
214
208
  }
215
- renderClosingTag(e) {
216
- return e.constructor === String ? `</${e}>` : e.slice(0).reverse().map((t) => t.constructor === String ? `</${t}>` : `</${t.tag}>`).join("");
209
+ renderClosingTag(t) {
210
+ return t.constructor === String ? `</${t}>` : t.slice(0).reverse().map((e) => e.constructor === String ? `</${e}>` : `</${e.tag}>`).join("");
217
211
  }
218
- getMatchingNode(e) {
219
- const t = this.nodes[e.type];
220
- if (typeof t == "function")
221
- return t(e);
212
+ getMatchingNode(t) {
213
+ const e = this.nodes[t.type];
214
+ if (typeof e == "function")
215
+ return e(t);
222
216
  }
223
- getMatchingMark(e) {
224
- const t = this.marks[e.type];
225
- if (typeof t == "function")
226
- return t(e);
217
+ getMatchingMark(t) {
218
+ const e = this.marks[t.type];
219
+ if (typeof e == "function")
220
+ return e(t);
227
221
  }
228
222
  }
229
- class X {
223
+ class K {
230
224
  constructor() {
231
- h(this, "isCDNUrl", (e = "") => e.indexOf("/cdn/") > -1), h(this, "getOptionsPage", (e, t = 25, s = 1) => j(p({}, e), {
232
- per_page: t,
233
- page: s
234
- })), h(this, "delay", (e) => new Promise((t) => setTimeout(t, e))), h(this, "arrayFrom", (e = 0, t) => [...Array(e)].map(t)), h(this, "range", (e = 0, t = e) => {
235
- const s = Math.abs(t - e) || 0, n = e < t ? 1 : -1;
236
- return this.arrayFrom(s, (o, a) => a * n + e);
237
- }), h(this, "asyncMap", async (e, t) => Promise.all(e.map(t))), h(this, "flatMap", (e = [], t) => e.map(t).reduce((s, n) => [...s, ...n], []));
238
- }
239
- stringify(e, t, s) {
225
+ h(this, "isCDNUrl", (t = "") => t.indexOf("/cdn/") > -1), h(this, "getOptionsPage", (t, e = 25, r = 1) => ({
226
+ ...t,
227
+ per_page: e,
228
+ page: r
229
+ })), h(this, "delay", (t) => new Promise((e) => setTimeout(e, t))), h(this, "arrayFrom", (t = 0, e) => [...Array(t)].map(e)), h(this, "range", (t = 0, e = t) => {
230
+ const r = Math.abs(e - t) || 0, n = t < e ? 1 : -1;
231
+ return this.arrayFrom(r, (o, a) => a * n + t);
232
+ }), h(this, "asyncMap", async (t, e) => Promise.all(t.map(e))), h(this, "flatMap", (t = [], e) => t.map(e).reduce((r, n) => [...r, ...n], []));
233
+ }
234
+ stringify(t, e, r) {
240
235
  const n = [];
241
- for (const o in e) {
242
- if (!Object.prototype.hasOwnProperty.call(e, o))
236
+ for (const o in t) {
237
+ if (!Object.prototype.hasOwnProperty.call(t, o))
243
238
  continue;
244
- const a = e[o], i = s ? "" : encodeURIComponent(o);
239
+ const a = t[o], i = r ? "" : encodeURIComponent(o);
245
240
  let c;
246
- typeof a == "object" ? c = this.stringify(a, t ? t + encodeURIComponent("[" + i + "]") : i, Array.isArray(a)) : c = (t ? t + encodeURIComponent("[" + i + "]") : i) + "=" + encodeURIComponent(a), n.push(c);
241
+ typeof a == "object" ? c = this.stringify(
242
+ a,
243
+ e ? e + encodeURIComponent("[" + i + "]") : i,
244
+ Array.isArray(a)
245
+ ) : c = (e ? e + encodeURIComponent("[" + i + "]") : i) + "=" + encodeURIComponent(a), n.push(c);
247
246
  }
248
247
  return n.join("&");
249
248
  }
250
249
  }
251
- class Ne {
252
- constructor(e) {
253
- h(this, "baseURL"), h(this, "timeout"), h(this, "headers"), h(this, "responseInterceptor"), h(this, "fetch"), h(this, "ejectInterceptor"), h(this, "url"), h(this, "parameters"), this.baseURL = e.baseURL, this.headers = e.headers || [], this.timeout = e.timeout ? e.timeout * 1e3 : 1e3, this.responseInterceptor = e.responseInterceptor, this.fetch = (...t) => e.fetch ? e.fetch(...t) : fetch(...t), this.ejectInterceptor = !1, this.url = "", this.parameters = {};
250
+ class xt {
251
+ constructor(t) {
252
+ h(this, "baseURL"), h(this, "timeout"), h(this, "headers"), h(this, "responseInterceptor"), h(this, "fetch"), h(this, "ejectInterceptor"), h(this, "url"), h(this, "parameters"), this.baseURL = t.baseURL, this.headers = t.headers || [], this.timeout = t != null && t.timeout ? t.timeout * 1e3 : 0, this.responseInterceptor = t.responseInterceptor, this.fetch = (...e) => t.fetch ? t.fetch(...e) : fetch(...e), this.ejectInterceptor = !1, this.url = "", this.parameters = {};
254
253
  }
255
- get(e, t) {
256
- return this.url = e, this.parameters = t, this._methodHandler("get");
254
+ get(t, e) {
255
+ return this.url = t, this.parameters = e, this._methodHandler("get");
257
256
  }
258
- post(e, t) {
259
- return this.url = e, this.parameters = t, this._methodHandler("post");
257
+ post(t, e) {
258
+ return this.url = t, this.parameters = e, this._methodHandler("post");
260
259
  }
261
- put(e, t) {
262
- return this.url = e, this.parameters = t, this._methodHandler("put");
260
+ put(t, e) {
261
+ return this.url = t, this.parameters = e, this._methodHandler("put");
263
262
  }
264
- delete(e, t) {
265
- return this.url = e, this.parameters = t, this._methodHandler("delete");
263
+ delete(t, e) {
264
+ return this.url = t, this.parameters = e, this._methodHandler("delete");
266
265
  }
267
- async _responseHandler(e) {
268
- const t = [], s = {
266
+ async _responseHandler(t) {
267
+ const e = [], r = {
269
268
  data: {},
270
269
  headers: {},
271
270
  status: 0,
272
271
  statusText: ""
273
272
  };
274
- await e.json().then((n) => {
275
- s.data = n;
273
+ t.status !== 204 && await t.json().then((n) => {
274
+ r.data = n;
276
275
  });
277
- for (const n of e.headers.entries())
278
- t[n[0]] = n[1];
279
- return s.headers = p({}, t), s.status = e.status, s.statusText = e.statusText, s;
280
- }
281
- async _methodHandler(e) {
282
- const t = new URL(`${this.baseURL}${this.url}`);
283
- let s = null;
284
- if (e === "get") {
285
- const i = new X();
286
- t.search = i.stringify(this.parameters);
276
+ for (const n of t.headers.entries())
277
+ e[n[0]] = n[1];
278
+ return r.headers = { ...e }, r.status = t.status, r.statusText = t.statusText, r;
279
+ }
280
+ async _methodHandler(t) {
281
+ const e = new URL(`${this.baseURL}${this.url}`);
282
+ let r = null;
283
+ if (t === "get") {
284
+ const i = new K();
285
+ e.search = i.stringify(this.parameters);
287
286
  } else
288
- s = JSON.stringify(this.parameters);
289
- const n = new AbortController(), { signal: o } = n, a = setTimeout(() => n.abort(), this.timeout);
287
+ r = JSON.stringify(this.parameters);
288
+ const n = new AbortController(), { signal: o } = n;
289
+ let a;
290
+ this.timeout && (a = setTimeout(() => n.abort(), this.timeout));
290
291
  try {
291
- const i = await this.fetch(`${t}`, {
292
- method: e,
292
+ const i = await this.fetch(`${e}`, {
293
+ method: t,
293
294
  headers: this.headers,
294
- body: s,
295
+ body: r,
295
296
  signal: o
296
297
  });
297
- clearTimeout(a);
298
+ this.timeout && clearTimeout(a);
298
299
  const c = await this._responseHandler(i);
299
300
  return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(c)) : this._statusHandler(c);
300
301
  } catch (i) {
@@ -304,82 +305,91 @@ class Ne {
304
305
  eject() {
305
306
  this.ejectInterceptor = !0;
306
307
  }
307
- _statusHandler(e) {
308
- if (/20[01]/g.test(`${e.status}`))
309
- return e;
308
+ _statusHandler(t) {
309
+ if (/20[01|04]/g.test(`${t.status}`))
310
+ return t;
310
311
  throw {
311
- message: new Error(e.statusText || `status: ${e.status}`),
312
- response: e
312
+ message: new Error(t.statusText || `status: ${t.status}`),
313
+ response: t
313
314
  };
314
315
  }
315
316
  }
316
- let k = {};
317
- const m = {};
318
- class Me {
319
- constructor(e, t) {
320
- if (h(this, "client"), h(this, "maxRetries"), h(this, "throttle"), h(this, "accessToken"), h(this, "cache"), h(this, "helpers"), h(this, "relations"), h(this, "links"), h(this, "richTextResolver"), h(this, "resolveNestedRelations"), !t) {
321
- const o = e.region ? `-${e.region}` : "", a = e.https === !1 ? "http" : "https";
322
- e.oauthToken ? t = `${a}://api${o}.storyblok.com/v1` : t = `${a}://api${o}.storyblok.com/v2`;
317
+ let b = {};
318
+ const g = {};
319
+ class jt {
320
+ constructor(t, e) {
321
+ if (h(this, "client"), h(this, "maxRetries"), h(this, "throttle"), h(this, "accessToken"), h(this, "cache"), h(this, "helpers"), h(this, "relations"), h(this, "links"), h(this, "richTextResolver"), h(this, "resolveNestedRelations"), !e) {
322
+ const o = t.region ? `-${t.region}` : "", a = t.https === !1 ? "http" : "https";
323
+ t.oauthToken ? e = `${a}://api${o}.storyblok.com/v1` : e = `${a}://api${o}.storyblok.com/v2`;
323
324
  }
324
- const s = new Headers();
325
- s.set("Content-Type", "application/json"), s.set("Accept", "application/json"), s.forEach((o, a) => {
326
- e.headers && e.headers[a] && s.set(a, e.headers[a]);
325
+ const r = new Headers();
326
+ r.set("Content-Type", "application/json"), r.set("Accept", "application/json"), r.forEach((o, a) => {
327
+ t.headers && t.headers[a] && r.set(a, t.headers[a]);
327
328
  });
328
329
  let n = 5;
329
- e.oauthToken && (s.set("Authorization", e.oauthToken), n = 3), e.rateLimit && (n = e.rateLimit), e.richTextSchema ? this.richTextResolver = new R(e.richTextSchema) : this.richTextResolver = new R(), e.componentResolver && this.setComponentResolver(e.componentResolver), this.maxRetries = e.maxRetries, this.throttle = de(this.throttledRequest, n, 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.helpers = new X(), this.resolveNestedRelations = !1, this.client = new Ne({
330
- baseURL: t,
331
- timeout: e.timeout || 0,
332
- headers: s,
333
- responseInterceptor: e.responseInterceptor,
334
- fetch: e.fetch
330
+ t.oauthToken && (r.set("Authorization", t.oauthToken), n = 3), t.rateLimit && (n = t.rateLimit), t.richTextSchema ? this.richTextResolver = new T(t.richTextSchema) : this.richTextResolver = new T(), t.componentResolver && this.setComponentResolver(t.componentResolver), this.maxRetries = t.maxRetries, this.throttle = rt(this.throttledRequest, n, 1e3), this.accessToken = t.accessToken || "", this.relations = {}, this.links = {}, this.cache = t.cache || { clear: "manual" }, this.helpers = new K(), this.resolveNestedRelations = !1, this.client = new xt({
331
+ baseURL: e,
332
+ timeout: t.timeout || 0,
333
+ headers: r,
334
+ responseInterceptor: t.responseInterceptor,
335
+ fetch: t.fetch
335
336
  });
336
337
  }
337
- setComponentResolver(e) {
338
- this.richTextResolver.addNode("blok", (t) => {
339
- let s = "";
340
- return t.attrs.body.forEach((n) => {
341
- s += e(n.component, n);
338
+ setComponentResolver(t) {
339
+ this.richTextResolver.addNode("blok", (e) => {
340
+ let r = "";
341
+ return e.attrs.body.forEach((n) => {
342
+ r += t(n.component, n);
342
343
  }), {
343
- html: s
344
+ html: r
344
345
  };
345
346
  });
346
347
  }
347
- parseParams(e) {
348
- return e.version || (e.version = "published"), e.token || (e.token = this.getToken()), e.cv || (e.cv = m[e.token]), Array.isArray(e.resolve_relations) && (e.resolve_relations = e.resolve_relations.join(",")), e;
348
+ parseParams(t) {
349
+ return t.version || (t.version = "published"), t.token || (t.token = this.getToken()), t.cv || (t.cv = g[t.token]), Array.isArray(t.resolve_relations) && (t.resolve_relations = t.resolve_relations.join(",")), t;
349
350
  }
350
- factoryParamOptions(e, t) {
351
- return this.helpers.isCDNUrl(e) ? this.parseParams(t) : t;
351
+ factoryParamOptions(t, e) {
352
+ return this.helpers.isCDNUrl(t) ? this.parseParams(e) : e;
352
353
  }
353
- makeRequest(e, t, s, n) {
354
- const o = this.factoryParamOptions(e, this.helpers.getOptionsPage(t, s, n));
355
- return this.cacheResponse(e, o);
354
+ makeRequest(t, e, r, n) {
355
+ const o = this.factoryParamOptions(
356
+ t,
357
+ this.helpers.getOptionsPage(e, r, n)
358
+ );
359
+ return this.cacheResponse(t, o);
356
360
  }
357
- get(e, t) {
358
- t || (t = {});
359
- const s = `/${e}`, n = this.factoryParamOptions(s, t);
360
- return this.cacheResponse(s, n);
361
+ get(t, e) {
362
+ e || (e = {});
363
+ const r = `/${t}`, n = this.factoryParamOptions(r, e);
364
+ return this.cacheResponse(r, n);
361
365
  }
362
- async getAll(e, t, s) {
363
- const n = (t == null ? void 0 : t.per_page) || 25, o = `/${e}`, a = o.split("/"), i = s || a[a.length - 1], c = 1, l = await this.makeRequest(o, t, n, c), u = l.total ? Math.ceil(l.total / n) : 1, d = await this.helpers.asyncMap(this.helpers.range(c, u), (g) => this.makeRequest(o, t, n, g + 1));
364
- return this.helpers.flatMap([l, ...d], (g) => Object.values(g.data[i]));
366
+ async getAll(t, e, r) {
367
+ const n = (e == null ? void 0 : e.per_page) || 25, o = `/${t}`, a = o.split("/"), i = r || a[a.length - 1], c = 1, l = await this.makeRequest(o, e, n, c), u = l.total ? Math.ceil(l.total / n) : 1, d = await this.helpers.asyncMap(
368
+ this.helpers.range(c, u),
369
+ (p) => this.makeRequest(o, e, n, p + 1)
370
+ );
371
+ return this.helpers.flatMap(
372
+ [l, ...d],
373
+ (p) => Object.values(p.data[i])
374
+ );
365
375
  }
366
- post(e, t) {
367
- const s = `/${e}`;
368
- return Promise.resolve(this.throttle("post", s, t));
376
+ post(t, e) {
377
+ const r = `/${t}`;
378
+ return Promise.resolve(this.throttle("post", r, e));
369
379
  }
370
- put(e, t) {
371
- const s = `/${e}`;
372
- return Promise.resolve(this.throttle("put", s, t));
380
+ put(t, e) {
381
+ const r = `/${t}`;
382
+ return Promise.resolve(this.throttle("put", r, e));
373
383
  }
374
- delete(e, t) {
375
- const s = `/${e}`;
376
- return Promise.resolve(this.throttle("delete", s, t));
384
+ delete(t, e) {
385
+ const r = `/${t}`;
386
+ return Promise.resolve(this.throttle("delete", r, e));
377
387
  }
378
- getStories(e) {
379
- return this.get("cdn/stories", e);
388
+ getStories(t) {
389
+ return this.get("cdn/stories", t);
380
390
  }
381
- getStory(e, t) {
382
- return this.get(`cdn/stories/${e}`, t);
391
+ getStory(t, e) {
392
+ return this.get(`cdn/stories/${t}`, e);
383
393
  }
384
394
  getToken() {
385
395
  return this.accessToken;
@@ -387,101 +397,107 @@ class Me {
387
397
  ejectInterceptor() {
388
398
  this.client.eject();
389
399
  }
390
- _cleanCopy(e) {
391
- return JSON.parse(JSON.stringify(e));
400
+ _cleanCopy(t) {
401
+ return JSON.parse(JSON.stringify(t));
392
402
  }
393
- _insertLinks(e, t) {
394
- const s = e[t];
395
- s && s.fieldtype == "multilink" && s.linktype == "story" && typeof s.id == "string" && this.links[s.id] ? s.story = this._cleanCopy(this.links[s.id]) : s && s.linktype === "story" && typeof s.uuid == "string" && this.links[s.uuid] && (s.story = this._cleanCopy(this.links[s.uuid]));
403
+ _insertLinks(t, e) {
404
+ const r = t[e];
405
+ r && r.fieldtype == "multilink" && r.linktype == "story" && typeof r.id == "string" && this.links[r.id] ? r.story = this._cleanCopy(this.links[r.id]) : r && r.linktype === "story" && typeof r.uuid == "string" && this.links[r.uuid] && (r.story = this._cleanCopy(this.links[r.uuid]));
396
406
  }
397
- _insertRelations(e, t, s) {
398
- if (s.indexOf(`${e.component}.${t}`) > -1) {
399
- if (typeof e[t] == "string")
400
- this.relations[e[t]] && (e[t] = this._cleanCopy(this.relations[e[t]]));
401
- else if (e[t] && e[t].constructor === Array) {
407
+ _insertRelations(t, e, r) {
408
+ if (r.indexOf(`${t.component}.${e}`) > -1) {
409
+ if (typeof t[e] == "string")
410
+ this.relations[t[e]] && (t[e] = this._cleanCopy(this.relations[t[e]]));
411
+ else if (t[e] && t[e].constructor === Array) {
402
412
  const n = [];
403
- e[t].forEach((o) => {
413
+ t[e].forEach((o) => {
404
414
  this.relations[o] && n.push(this._cleanCopy(this.relations[o]));
405
- }), e[t] = n;
415
+ }), t[e] = n;
406
416
  }
407
417
  }
408
418
  }
409
- iterateTree(e, t) {
410
- const s = (n) => {
419
+ iterateTree(t, e) {
420
+ const r = (n) => {
411
421
  if (n != null) {
412
422
  if (n.constructor === Array)
413
423
  for (let o = 0; o < n.length; o++)
414
- s(n[o]);
424
+ r(n[o]);
415
425
  else if (n.constructor === Object) {
416
426
  if (n._stopResolving)
417
427
  return;
418
428
  for (const o in n)
419
- (n.component && n._uid || n.type === "link") && (this._insertRelations(n, o, t), this._insertLinks(n, o)), s(n[o]);
429
+ (n.component && n._uid || n.type === "link") && (this._insertRelations(
430
+ n,
431
+ o,
432
+ e
433
+ ), this._insertLinks(n, o)), r(n[o]);
420
434
  }
421
435
  }
422
436
  };
423
- s(e.content);
437
+ r(t.content);
424
438
  }
425
- async resolveLinks(e, t) {
426
- let s = [];
427
- if (e.link_uuids) {
428
- const n = e.link_uuids.length, o = [], a = 50;
439
+ async resolveLinks(t, e) {
440
+ let r = [];
441
+ if (t.link_uuids) {
442
+ const n = t.link_uuids.length, o = [], a = 50;
429
443
  for (let i = 0; i < n; i += a) {
430
444
  const c = Math.min(n, i + a);
431
- o.push(e.link_uuids.slice(i, c));
445
+ o.push(t.link_uuids.slice(i, c));
432
446
  }
433
447
  for (let i = 0; i < o.length; i++)
434
448
  (await this.getStories({
435
449
  per_page: a,
436
- language: t.language,
437
- version: t.version,
450
+ language: e.language,
451
+ version: e.version,
438
452
  by_uuids: o[i].join(",")
439
- })).data.stories.forEach((c) => {
440
- s.push(c);
441
- });
453
+ })).data.stories.forEach(
454
+ (c) => {
455
+ r.push(c);
456
+ }
457
+ );
442
458
  } else
443
- s = e.links;
444
- s.forEach((n) => {
445
- this.links[n.uuid] = j(p({}, n), { _stopResolving: !0 });
459
+ r = t.links;
460
+ r.forEach((n) => {
461
+ this.links[n.uuid] = { ...n, _stopResolving: !0 };
446
462
  });
447
463
  }
448
- async resolveRelations(e, t) {
449
- let s = [];
450
- if (e.rel_uuids) {
451
- const n = e.rel_uuids.length, o = [], a = 50;
464
+ async resolveRelations(t, e) {
465
+ let r = [];
466
+ if (t.rel_uuids) {
467
+ const n = t.rel_uuids.length, o = [], a = 50;
452
468
  for (let i = 0; i < n; i += a) {
453
469
  const c = Math.min(n, i + a);
454
- o.push(e.rel_uuids.slice(i, c));
470
+ o.push(t.rel_uuids.slice(i, c));
455
471
  }
456
472
  for (let i = 0; i < o.length; i++)
457
473
  (await this.getStories({
458
474
  per_page: a,
459
- language: t.language,
460
- version: t.version,
475
+ language: e.language,
476
+ version: e.version,
461
477
  by_uuids: o[i].join(",")
462
478
  })).data.stories.forEach((c) => {
463
- s.push(c);
479
+ r.push(c);
464
480
  });
465
481
  } else
466
- s = e.rels;
467
- s && s.length > 0 && s.forEach((n) => {
468
- this.relations[n.uuid] = j(p({}, n), { _stopResolving: !0 });
482
+ r = t.rels;
483
+ r && r.length > 0 && r.forEach((n) => {
484
+ this.relations[n.uuid] = { ...n, _stopResolving: !0 };
469
485
  });
470
486
  }
471
- async resolveStories(e, t) {
472
- var s, n;
487
+ async resolveStories(t, e) {
488
+ var r, n;
473
489
  let o = [];
474
- if (typeof t.resolve_relations < "u" && t.resolve_relations.length > 0 && (typeof t.resolve_relations == "string" && (o = t.resolve_relations.split(",")), await this.resolveRelations(e, t)), t.resolve_links && ["1", "story", "url"].indexOf(t.resolve_links) > -1 && ((s = e.links) != null && s.length || (n = e.link_uuids) != null && n.length) && await this.resolveLinks(e, t), this.resolveNestedRelations)
490
+ if (typeof e.resolve_relations < "u" && e.resolve_relations.length > 0 && (typeof e.resolve_relations == "string" && (o = e.resolve_relations.split(",")), await this.resolveRelations(t, e)), e.resolve_links && ["1", "story", "url"].indexOf(e.resolve_links) > -1 && ((r = t.links) != null && r.length || (n = t.link_uuids) != null && n.length) && await this.resolveLinks(t, e), this.resolveNestedRelations)
475
491
  for (const a in this.relations)
476
492
  this.iterateTree(this.relations[a], o);
477
- e.story ? this.iterateTree(e.story, o) : e.stories.forEach((a) => {
493
+ t.story ? this.iterateTree(t.story, o) : t.stories.forEach((a) => {
478
494
  this.iterateTree(a, o);
479
495
  });
480
496
  }
481
- cacheResponse(e, t, s) {
497
+ cacheResponse(t, e, r) {
482
498
  return new Promise((n, o) => {
483
- const a = this.helpers.stringify({ url: e, params: t }), i = this.cacheProvider();
484
- if (this.cache.clear === "auto" && t.version === "draft" && this.flushCache(), t.version === "published" && e != "/cdn/spaces/me") {
499
+ const a = this.helpers.stringify({ url: t, params: e }), i = this.cacheProvider();
500
+ if (this.cache.clear === "auto" && e.version === "draft" && this.flushCache(), e.version === "published" && t != "/cdn/spaces/me") {
485
501
  const c = i.get(a);
486
502
  if (c)
487
503
  return n(c);
@@ -489,46 +505,46 @@ class Me {
489
505
  try {
490
506
  (async () => {
491
507
  var c;
492
- const l = await this.throttle("get", e, t);
508
+ const l = await this.throttle("get", t, e);
493
509
  let u = { data: l.data, headers: l.headers };
494
510
  if ((c = l.headers) != null && c["per-page"] && (u = Object.assign({}, u, {
495
511
  perPage: l.headers["per-page"] ? parseInt(l.headers["per-page"]) : 0,
496
512
  total: l.headers["per-page"] ? parseInt(l.headers.total) : 0
497
513
  })), l.status != 200)
498
514
  return o(l);
499
- (u.data.story || u.data.stories) && await this.resolveStories(u.data, t), t.version === "published" && e != "/cdn/spaces/me" && i.set(a, u), u.data.cv && t.token && (t.version == "draft" && m[t.token] != u.data.cv && this.flushCache(), m[t.token] = u.data.cv), n(u);
515
+ (u.data.story || u.data.stories) && await this.resolveStories(u.data, e), e.version === "published" && t != "/cdn/spaces/me" && i.set(a, u), u.data.cv && e.token && (e.version == "draft" && g[e.token] != u.data.cv && this.flushCache(), g[e.token] = u.data.cv), n(u);
500
516
  })();
501
517
  } catch {
502
518
  }
503
519
  });
504
520
  }
505
- throttledRequest(e, t, s) {
506
- return this.client[e](t, s);
521
+ throttledRequest(t, e, r) {
522
+ return this.client[t](e, r);
507
523
  }
508
524
  cacheVersions() {
509
- return m;
525
+ return g;
510
526
  }
511
527
  cacheVersion() {
512
- return m[this.accessToken];
528
+ return g[this.accessToken];
513
529
  }
514
- setCacheVersion(e) {
515
- this.accessToken && (m[this.accessToken] = e);
530
+ setCacheVersion(t) {
531
+ this.accessToken && (g[this.accessToken] = t);
516
532
  }
517
533
  cacheProvider() {
518
534
  switch (this.cache.type) {
519
535
  case "memory":
520
536
  return {
521
- get(e) {
522
- return k[e];
537
+ get(t) {
538
+ return b[t];
523
539
  },
524
540
  getAll() {
525
- return k;
541
+ return b;
526
542
  },
527
- set(e, t) {
528
- k[e] = t;
543
+ set(t, e) {
544
+ b[t] = e;
529
545
  },
530
546
  flush() {
531
- k = {};
547
+ b = {};
532
548
  }
533
549
  };
534
550
  default:
@@ -548,172 +564,185 @@ class Me {
548
564
  return this.cacheProvider().flush(), this;
549
565
  }
550
566
  }
551
- const it = (r = {}) => {
552
- const { apiOptions: e } = r;
553
- if (!e.accessToken) {
554
- console.error("You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication");
567
+ const Wt = (s = {}) => {
568
+ const { apiOptions: t } = s;
569
+ if (!t.accessToken) {
570
+ console.error(
571
+ "You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication"
572
+ );
555
573
  return;
556
574
  }
557
- return { storyblokApi: new Me(e) };
558
- };
559
- var Le = (r) => {
560
- if (typeof r != "object" || typeof r._editable > "u")
575
+ return { storyblokApi: new jt(t) };
576
+ }, Et = (s) => {
577
+ if (typeof s != "object" || typeof s._editable > "u")
561
578
  return {};
562
- const e = JSON.parse(r._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, ""));
579
+ const t = JSON.parse(
580
+ s._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
581
+ );
563
582
  return {
564
- "data-blok-c": JSON.stringify(e),
565
- "data-blok-uid": e.id + "-" + e.uid
583
+ "data-blok-c": JSON.stringify(t),
584
+ "data-blok-uid": t.id + "-" + t.uid
566
585
  };
567
586
  };
568
- let P;
569
- const Ue = "https://app.storyblok.com/f/storyblok-v2-latest.js", at = (r, e, t = {}) => {
587
+ let x;
588
+ const St = "https://app.storyblok.com/f/storyblok-v2-latest.js", Xt = (s, t, e = {}) => {
570
589
  if (!(typeof window > "u")) {
571
590
  if (typeof window.storyblokRegisterEvent > "u") {
572
- console.error("Storyblok Bridge is disabled. Please enable it to use it. Read https://github.com/storyblok/storyblok-js");
591
+ console.error(
592
+ "Storyblok Bridge is disabled. Please enable it to use it. Read https://github.com/storyblok/storyblok-js"
593
+ );
573
594
  return;
574
595
  }
575
- if (!r) {
596
+ if (!s) {
576
597
  console.warn("Story ID is not defined. Please provide a valid ID.");
577
598
  return;
578
599
  }
579
600
  window.storyblokRegisterEvent(() => {
580
- new window.StoryblokBridge(t).on(["input", "published", "change"], (n) => {
581
- n.action === "input" && n.story.id === r ? e(n.story) : (n.action === "change" || n.action === "published") && n.storyId === r && window.location.reload();
601
+ new window.StoryblokBridge(e).on(["input", "published", "change"], (r) => {
602
+ r.action === "input" && r.story.id === s ? t(r.story) : (r.action === "change" || r.action === "published") && r.storyId === s && window.location.reload();
582
603
  });
583
604
  });
584
605
  }
585
- }, He = (r = {}) => {
606
+ }, Pt = (s = {}) => {
586
607
  const {
587
- bridge: e,
588
- accessToken: t,
589
- use: s = [],
608
+ bridge: t,
609
+ accessToken: e,
610
+ use: r = [],
590
611
  apiOptions: n = {},
591
612
  richText: o = {}
592
- } = r;
593
- n.accessToken = n.accessToken || t;
594
- const a = { bridge: e, apiOptions: n };
613
+ } = s;
614
+ n.accessToken = n.accessToken || e;
615
+ const a = { bridge: t, apiOptions: n };
595
616
  let i = {};
596
- return s.forEach((c) => {
597
- i = p(p({}, i), c(a));
598
- }), e !== !1 && le(Ue), P = new R(o.schema), o.resolver && Z(P, o.resolver), i;
599
- }, Z = (r, e) => {
600
- r.addNode("blok", (t) => {
601
- let s = "";
602
- return t.attrs.body.forEach((n) => {
603
- s += e(n.component, n);
617
+ return r.forEach((c) => {
618
+ i = { ...i, ...c(a) };
619
+ }), t !== !1 && tt(St), x = new T(o.schema), o.resolver && G(x, o.resolver), i;
620
+ }, G = (s, t) => {
621
+ s.addNode("blok", (e) => {
622
+ let r = "";
623
+ return e.attrs.body.forEach((n) => {
624
+ r += t(n.component, n);
604
625
  }), {
605
- html: s
626
+ html: r
606
627
  };
607
628
  });
608
- }, ct = (r, e, t) => {
609
- let s = t || P;
610
- if (!s) {
611
- console.error("Please initialize the Storyblok SDK before calling the renderRichText function");
629
+ }, Zt = (s, t, e) => {
630
+ let r = e || x;
631
+ if (!r) {
632
+ console.error(
633
+ "Please initialize the Storyblok SDK before calling the renderRichText function"
634
+ );
612
635
  return;
613
636
  }
614
- return r === "" ? "" : r ? (e && (s = new R(e.schema), e.resolver && Z(s, e.resolver)), s.render(r)) : (console.warn(`${r} is not a valid Richtext object. This might be because the value of the richtext field is empty.
637
+ return s === "" ? "" : s ? (t && (r = new T(t.schema), t.resolver && G(r, t.resolver)), r.render(s)) : (console.warn(`${s} is not a valid Richtext object. This might be because the value of the richtext field is empty.
615
638
 
616
639
  For more info about the richtext object check https://github.com/storyblok/storyblok-js#rendering-rich-text`), "");
617
640
  };
618
- function O() {
641
+ function j() {
619
642
  }
620
- function E(r, e) {
621
- for (const t in e)
622
- r[t] = e[t];
623
- return r;
643
+ function E(s, t) {
644
+ for (const e in t)
645
+ s[e] = t[e];
646
+ return s;
624
647
  }
625
- function ee(r) {
626
- return r();
648
+ function Q(s) {
649
+ return s();
627
650
  }
628
- function V() {
651
+ function D() {
629
652
  return /* @__PURE__ */ Object.create(null);
630
653
  }
631
- function b(r) {
632
- r.forEach(ee);
633
- }
634
- function te(r) {
635
- return typeof r == "function";
654
+ function _(s) {
655
+ s.forEach(Q);
636
656
  }
637
- function qe(r, e) {
638
- return r != r ? e == e : r !== e || r && typeof r == "object" || typeof r == "function";
657
+ function W(s) {
658
+ return typeof s == "function";
639
659
  }
640
- function Be(r) {
641
- return Object.keys(r).length === 0;
660
+ function Ot(s, t) {
661
+ return s != s ? t == t : s !== t || s && typeof s == "object" || typeof s == "function";
642
662
  }
643
- function De(r) {
644
- const e = {};
645
- for (const t in r)
646
- t[0] !== "$" && (e[t] = r[t]);
647
- return e;
663
+ function Ct(s) {
664
+ return Object.keys(s).length === 0;
648
665
  }
649
- function z(r, e) {
666
+ function It(s) {
650
667
  const t = {};
651
- e = new Set(e);
652
- for (const s in r)
653
- !e.has(s) && s[0] !== "$" && (t[s] = r[s]);
668
+ for (const e in s)
669
+ e[0] !== "$" && (t[e] = s[e]);
654
670
  return t;
655
671
  }
656
- function Fe(r, e, t) {
657
- r.insertBefore(e, t || null);
672
+ function B(s, t) {
673
+ const e = {};
674
+ t = new Set(t);
675
+ for (const r in s)
676
+ !t.has(r) && r[0] !== "$" && (e[r] = s[r]);
677
+ return e;
678
+ }
679
+ function At(s, t, e) {
680
+ s.insertBefore(t, e || null);
658
681
  }
659
- function re(r) {
660
- r.parentNode && r.parentNode.removeChild(r);
682
+ function X(s) {
683
+ s.parentNode && s.parentNode.removeChild(s);
661
684
  }
662
- function Je(r) {
663
- return document.createTextNode(r);
685
+ function Nt(s) {
686
+ return document.createTextNode(s);
664
687
  }
665
- function Ve() {
666
- return Je("");
688
+ function Mt() {
689
+ return Nt("");
667
690
  }
668
- function ze(r) {
669
- return Array.from(r.childNodes);
691
+ function Lt(s) {
692
+ return Array.from(s.childNodes);
670
693
  }
671
- function Y(r, e) {
672
- return new r(e);
694
+ function J(s, t) {
695
+ return new s(t);
673
696
  }
674
- let L;
675
- function _(r) {
676
- L = r;
697
+ let N;
698
+ function k(s) {
699
+ N = s;
677
700
  }
678
- const y = [], K = [], w = [], Q = [], Ye = Promise.resolve();
701
+ const y = [], F = [], v = [], V = [], Ut = Promise.resolve();
679
702
  let S = !1;
680
- function Ke() {
681
- S || (S = !0, Ye.then(se));
703
+ function Ht() {
704
+ S || (S = !0, Ut.then(Z));
682
705
  }
683
- function I(r) {
684
- w.push(r);
706
+ function P(s) {
707
+ v.push(s);
685
708
  }
686
- const x = /* @__PURE__ */ new Set();
687
- let v = 0;
688
- function se() {
689
- const r = L;
709
+ const R = /* @__PURE__ */ new Set();
710
+ let m = 0;
711
+ function Z() {
712
+ if (m !== 0)
713
+ return;
714
+ const s = N;
690
715
  do {
691
- for (; v < y.length; ) {
692
- const e = y[v];
693
- v++, _(e), Qe(e.$$);
716
+ try {
717
+ for (; m < y.length; ) {
718
+ const t = y[m];
719
+ m++, k(t), qt(t.$$);
720
+ }
721
+ } catch (t) {
722
+ throw y.length = 0, m = 0, t;
694
723
  }
695
- for (_(null), y.length = 0, v = 0; K.length; )
696
- K.pop()();
697
- for (let e = 0; e < w.length; e += 1) {
698
- const t = w[e];
699
- x.has(t) || (x.add(t), t());
724
+ for (k(null), y.length = 0, m = 0; F.length; )
725
+ F.pop()();
726
+ for (let t = 0; t < v.length; t += 1) {
727
+ const e = v[t];
728
+ R.has(e) || (R.add(e), e());
700
729
  }
701
- w.length = 0;
730
+ v.length = 0;
702
731
  } while (y.length);
703
- for (; Q.length; )
704
- Q.pop()();
705
- S = !1, x.clear(), _(r);
732
+ for (; V.length; )
733
+ V.pop()();
734
+ S = !1, R.clear(), k(s);
706
735
  }
707
- function Qe(r) {
708
- if (r.fragment !== null) {
709
- r.update(), b(r.before_update);
710
- const e = r.dirty;
711
- r.dirty = [-1], r.fragment && r.fragment.p(r.ctx, e), r.after_update.forEach(I);
736
+ function qt(s) {
737
+ if (s.fragment !== null) {
738
+ s.update(), _(s.before_update);
739
+ const t = s.dirty;
740
+ s.dirty = [-1], s.fragment && s.fragment.p(s.ctx, t), s.after_update.forEach(P);
712
741
  }
713
742
  }
714
- const $ = /* @__PURE__ */ new Set();
743
+ const w = /* @__PURE__ */ new Set();
715
744
  let f;
716
- function Ge() {
745
+ function Dt() {
717
746
  f = {
718
747
  r: 0,
719
748
  c: [],
@@ -721,130 +750,130 @@ function Ge() {
721
750
  // parent group
722
751
  };
723
752
  }
724
- function We() {
725
- f.r || b(f.c), f = f.p;
753
+ function Bt() {
754
+ f.r || _(f.c), f = f.p;
726
755
  }
727
- function C(r, e) {
728
- r && r.i && ($.delete(r), r.i(e));
756
+ function O(s, t) {
757
+ s && s.i && (w.delete(s), s.i(t));
729
758
  }
730
- function G(r, e, t, s) {
731
- if (r && r.o) {
732
- if ($.has(r))
759
+ function Y(s, t, e, r) {
760
+ if (s && s.o) {
761
+ if (w.has(s))
733
762
  return;
734
- $.add(r), f.c.push(() => {
735
- $.delete(r), s && (t && r.d(1), s());
736
- }), r.o(e);
763
+ w.add(s), f.c.push(() => {
764
+ w.delete(s), r && (e && s.d(1), r());
765
+ }), s.o(t);
737
766
  } else
738
- s && s();
767
+ r && r();
739
768
  }
740
- function Xe(r, e) {
741
- const t = {}, s = {}, n = { $$scope: 1 };
742
- let o = r.length;
769
+ function Jt(s, t) {
770
+ const e = {}, r = {}, n = { $$scope: 1 };
771
+ let o = s.length;
743
772
  for (; o--; ) {
744
- const a = r[o], i = e[o];
773
+ const a = s[o], i = t[o];
745
774
  if (i) {
746
775
  for (const c in a)
747
- c in i || (s[c] = 1);
776
+ c in i || (r[c] = 1);
748
777
  for (const c in i)
749
- n[c] || (t[c] = i[c], n[c] = 1);
750
- r[o] = i;
778
+ n[c] || (e[c] = i[c], n[c] = 1);
779
+ s[o] = i;
751
780
  } else
752
781
  for (const c in a)
753
782
  n[c] = 1;
754
783
  }
755
- for (const a in s)
756
- a in t || (t[a] = void 0);
757
- return t;
784
+ for (const a in r)
785
+ a in e || (e[a] = void 0);
786
+ return e;
758
787
  }
759
- function Ze(r) {
760
- return typeof r == "object" && r !== null ? r : {};
788
+ function Ft(s) {
789
+ return typeof s == "object" && s !== null ? s : {};
761
790
  }
762
- function W(r) {
763
- r && r.c();
791
+ function z(s) {
792
+ s && s.c();
764
793
  }
765
- function A(r, e, t, s) {
766
- const { fragment: n, after_update: o } = r.$$;
767
- n && n.m(e, t), s || I(() => {
768
- const a = r.$$.on_mount.map(ee).filter(te);
769
- r.$$.on_destroy ? r.$$.on_destroy.push(...a) : b(a), r.$$.on_mount = [];
770
- }), o.forEach(I);
794
+ function C(s, t, e, r) {
795
+ const { fragment: n, after_update: o } = s.$$;
796
+ n && n.m(t, e), r || P(() => {
797
+ const a = s.$$.on_mount.map(Q).filter(W);
798
+ s.$$.on_destroy ? s.$$.on_destroy.push(...a) : _(a), s.$$.on_mount = [];
799
+ }), o.forEach(P);
771
800
  }
772
- function N(r, e) {
773
- const t = r.$$;
774
- t.fragment !== null && (b(t.on_destroy), t.fragment && t.fragment.d(e), t.on_destroy = t.fragment = null, t.ctx = []);
801
+ function I(s, t) {
802
+ const e = s.$$;
803
+ e.fragment !== null && (_(e.on_destroy), e.fragment && e.fragment.d(t), e.on_destroy = e.fragment = null, e.ctx = []);
775
804
  }
776
- function et(r, e) {
777
- r.$$.dirty[0] === -1 && (y.push(r), Ke(), r.$$.dirty.fill(0)), r.$$.dirty[e / 31 | 0] |= 1 << e % 31;
805
+ function Vt(s, t) {
806
+ s.$$.dirty[0] === -1 && (y.push(s), Ht(), s.$$.dirty.fill(0)), s.$$.dirty[t / 31 | 0] |= 1 << t % 31;
778
807
  }
779
- function tt(r, e, t, s, n, o, a, i = [-1]) {
780
- const c = L;
781
- _(r);
782
- const l = r.$$ = {
808
+ function Yt(s, t, e, r, n, o, a, i = [-1]) {
809
+ const c = N;
810
+ k(s);
811
+ const l = s.$$ = {
783
812
  fragment: null,
784
813
  ctx: [],
785
814
  // state
786
815
  props: o,
787
- update: O,
816
+ update: j,
788
817
  not_equal: n,
789
- bound: V(),
818
+ bound: D(),
790
819
  // lifecycle
791
820
  on_mount: [],
792
821
  on_destroy: [],
793
822
  on_disconnect: [],
794
823
  before_update: [],
795
824
  after_update: [],
796
- context: new Map(e.context || (c ? c.$$.context : [])),
825
+ context: new Map(t.context || (c ? c.$$.context : [])),
797
826
  // everything else
798
- callbacks: V(),
827
+ callbacks: D(),
799
828
  dirty: i,
800
829
  skip_bound: !1,
801
- root: e.target || c.$$.root
830
+ root: t.target || c.$$.root
802
831
  };
803
832
  a && a(l.root);
804
833
  let u = !1;
805
- if (l.ctx = t ? t(r, e.props || {}, (d, g, ...U) => {
806
- const H = U.length ? U[0] : g;
807
- return l.ctx && n(l.ctx[d], l.ctx[d] = H) && (!l.skip_bound && l.bound[d] && l.bound[d](H), u && et(r, d)), g;
808
- }) : [], l.update(), u = !0, b(l.before_update), l.fragment = s ? s(l.ctx) : !1, e.target) {
809
- if (e.hydrate) {
810
- const d = ze(e.target);
811
- l.fragment && l.fragment.l(d), d.forEach(re);
834
+ if (l.ctx = e ? e(s, t.props || {}, (d, p, ...M) => {
835
+ const L = M.length ? M[0] : p;
836
+ return l.ctx && n(l.ctx[d], l.ctx[d] = L) && (!l.skip_bound && l.bound[d] && l.bound[d](L), u && Vt(s, d)), p;
837
+ }) : [], l.update(), u = !0, _(l.before_update), l.fragment = r ? r(l.ctx) : !1, t.target) {
838
+ if (t.hydrate) {
839
+ const d = Lt(t.target);
840
+ l.fragment && l.fragment.l(d), d.forEach(X);
812
841
  } else
813
842
  l.fragment && l.fragment.c();
814
- e.intro && C(r.$$.fragment), A(r, e.target, e.anchor, e.customElement), se();
843
+ t.intro && O(s.$$.fragment), C(s, t.target, t.anchor, t.customElement), Z();
815
844
  }
816
- _(c);
845
+ k(c);
817
846
  }
818
- class rt {
847
+ class zt {
819
848
  $destroy() {
820
- N(this, 1), this.$destroy = O;
821
- }
822
- $on(e, t) {
823
- if (!te(t))
824
- return O;
825
- const s = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
826
- return s.push(t), () => {
827
- const n = s.indexOf(t);
828
- n !== -1 && s.splice(n, 1);
849
+ I(this, 1), this.$destroy = j;
850
+ }
851
+ $on(t, e) {
852
+ if (!W(e))
853
+ return j;
854
+ const r = this.$$.callbacks[t] || (this.$$.callbacks[t] = []);
855
+ return r.push(e), () => {
856
+ const n = r.indexOf(e);
857
+ n !== -1 && r.splice(n, 1);
829
858
  };
830
859
  }
831
- $set(e) {
832
- this.$$set && !Be(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
860
+ $set(t) {
861
+ this.$$set && !Ct(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
833
862
  }
834
863
  }
835
- function st(r) {
836
- let e, t, s;
864
+ function Kt(s) {
865
+ let t, e, r;
837
866
  const n = [
838
867
  { blok: (
839
868
  /*blok*/
840
- r[0]
869
+ s[0]
841
870
  ) },
842
871
  /*$$restProps*/
843
- r[2]
872
+ s[2]
844
873
  ];
845
874
  var o = (
846
875
  /*component*/
847
- r[1]
876
+ s[1]
848
877
  );
849
878
  function a(i) {
850
879
  let c = {};
@@ -852,102 +881,102 @@ function st(r) {
852
881
  c = E(c, n[l]);
853
882
  return { props: c };
854
883
  }
855
- return o && (e = Y(o, a())), {
884
+ return o && (t = J(o, a())), {
856
885
  c() {
857
- e && W(e.$$.fragment), t = Ve();
886
+ t && z(t.$$.fragment), e = Mt();
858
887
  },
859
888
  m(i, c) {
860
- e && A(e, i, c), Fe(i, t, c), s = !0;
889
+ t && C(t, i, c), At(i, e, c), r = !0;
861
890
  },
862
891
  p(i, [c]) {
863
892
  const l = c & /*blok, $$restProps*/
864
- 5 ? Xe(n, [
893
+ 5 ? Jt(n, [
865
894
  c & /*blok*/
866
895
  1 && { blok: (
867
896
  /*blok*/
868
897
  i[0]
869
898
  ) },
870
899
  c & /*$$restProps*/
871
- 4 && Ze(
900
+ 4 && Ft(
872
901
  /*$$restProps*/
873
902
  i[2]
874
903
  )
875
904
  ]) : {};
876
905
  if (o !== (o = /*component*/
877
906
  i[1])) {
878
- if (e) {
879
- Ge();
880
- const u = e;
881
- G(u.$$.fragment, 1, 0, () => {
882
- N(u, 1);
883
- }), We();
907
+ if (t) {
908
+ Dt();
909
+ const u = t;
910
+ Y(u.$$.fragment, 1, 0, () => {
911
+ I(u, 1);
912
+ }), Bt();
884
913
  }
885
- o ? (e = Y(o, a()), W(e.$$.fragment), C(e.$$.fragment, 1), A(e, t.parentNode, t)) : e = null;
914
+ o ? (t = J(o, a()), z(t.$$.fragment), O(t.$$.fragment, 1), C(t, e.parentNode, e)) : t = null;
886
915
  } else
887
- o && e.$set(l);
916
+ o && t.$set(l);
888
917
  },
889
918
  i(i) {
890
- s || (e && C(e.$$.fragment, i), s = !0);
919
+ r || (t && O(t.$$.fragment, i), r = !0);
891
920
  },
892
921
  o(i) {
893
- e && G(e.$$.fragment, i), s = !1;
922
+ t && Y(t.$$.fragment, i), r = !1;
894
923
  },
895
924
  d(i) {
896
- i && re(t), e && N(e, i);
925
+ i && X(e), t && I(t, i);
897
926
  }
898
927
  };
899
928
  }
900
- function nt(r, e, t) {
901
- const s = ["blok"];
902
- let n = z(e, s), o, { blok: a } = e;
903
- return a ? o = ot(a.component) : console.error("Please provide a 'blok' property to the StoryblokComponent"), r.$$set = (i) => {
904
- e = E(E({}, e), De(i)), t(2, n = z(e, s)), "blok" in i && t(0, a = i.blok);
929
+ function Gt(s, t, e) {
930
+ const r = ["blok"];
931
+ let n = B(t, r), o, { blok: a } = t;
932
+ return a ? o = Qt(a.component) : console.error("Please provide a 'blok' property to the StoryblokComponent"), s.$$set = (i) => {
933
+ t = E(E({}, t), It(i)), e(2, n = B(t, r)), "blok" in i && e(0, a = i.blok);
905
934
  }, [a, o, n];
906
935
  }
907
- class lt extends rt {
908
- constructor(e) {
909
- super(), tt(this, e, nt, st, qe, { blok: 0 });
936
+ class te extends zt {
937
+ constructor(t) {
938
+ super(), Yt(this, t, Gt, Kt, Ot, { blok: 0 });
910
939
  }
911
940
  }
912
- const ht = (r, e) => {
913
- const t = (s) => {
914
- const n = Le(s);
915
- n["data-blok-c"] && (r.setAttribute("data-blok-c", n["data-blok-c"]), r.setAttribute("data-blok-uid", n["data-blok-uid"]), r.classList.add("storyblok__outline"));
941
+ const ee = (s, t) => {
942
+ const e = (r) => {
943
+ const n = Et(r);
944
+ n["data-blok-c"] && (s.setAttribute("data-blok-c", n["data-blok-c"]), s.setAttribute("data-blok-uid", n["data-blok-uid"]), s.classList.add("storyblok__outline"));
916
945
  };
917
- return t(e), {
918
- update(s) {
919
- t(s);
946
+ return e(t), {
947
+ update(r) {
948
+ e(r);
920
949
  }
921
950
  };
922
951
  };
923
- let M = null;
924
- const ut = () => (M || console.log(
952
+ let A = null;
953
+ const se = () => (A || console.log(
925
954
  "You can't use getStoryblokApi if you're not loading apiPlugin."
926
- ), M);
927
- let T = null;
928
- const dt = (r) => {
929
- const { storyblokApi: e } = He(r);
930
- M = e, T = r.components || {};
931
- }, ot = (r) => {
932
- let e = null;
933
- return e = typeof T == "function" ? T()[r] : T[r], e || console.error(`You didn't load the ${r} component. Please load it in storyblokInit. For example:
955
+ ), A);
956
+ let $ = null;
957
+ const re = (s) => {
958
+ const { storyblokApi: t } = Pt(s);
959
+ A = t, $ = s.components || {};
960
+ }, Qt = (s) => {
961
+ let t = null;
962
+ return t = typeof $ == "function" ? $()[s] : $[s], t || console.error(`You didn't load the ${s} component. Please load it in storyblokInit. For example:
934
963
  storyblokInit({
935
964
  accessToken: "<your-token>",
936
965
  components: {
937
966
  "teaser": Teaser
938
967
  }
939
968
  })
940
- `), e;
969
+ `), t;
941
970
  };
942
971
  export {
943
- Ce as RichTextSchema,
944
- lt as StoryblokComponent,
945
- it as apiPlugin,
946
- ot as getComponent,
947
- ut as getStoryblokApi,
948
- ct as renderRichText,
949
- ht as storyblokEditable,
950
- dt as storyblokInit,
951
- ut as useStoryblokApi,
952
- at as useStoryblokBridge
972
+ Tt as RichTextSchema,
973
+ te as StoryblokComponent,
974
+ Wt as apiPlugin,
975
+ Qt as getComponent,
976
+ se as getStoryblokApi,
977
+ Zt as renderRichText,
978
+ ee as storyblokEditable,
979
+ re as storyblokInit,
980
+ se as useStoryblokApi,
981
+ Xt as useStoryblokBridge
953
982
  };