@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.
- package/dist/storyblok-svelte.js +3 -3
- package/dist/storyblok-svelte.mjs +553 -524
- package/package.json +2 -2
|
@@ -1,300 +1,301 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
8
|
+
U ? n() : H.push(n);
|
|
17
9
|
}, document.getElementById("storyblok-javascript-bridge")))
|
|
18
10
|
return;
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}, document.getElementsByTagName("head")[0].appendChild(
|
|
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
|
|
25
|
-
function
|
|
26
|
-
return !(
|
|
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
|
|
29
|
-
if (!
|
|
20
|
+
function rt(s, t, e) {
|
|
21
|
+
if (!q(t))
|
|
30
22
|
throw new TypeError("Expected `limit` to be a finite number");
|
|
31
|
-
if (!
|
|
23
|
+
if (!q(e))
|
|
32
24
|
throw new TypeError("Expected `interval` to be a finite number");
|
|
33
|
-
const
|
|
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--,
|
|
30
|
+
o--, r.length > 0 && a(), n = n.filter(function(u) {
|
|
39
31
|
return u !== c;
|
|
40
32
|
});
|
|
41
|
-
},
|
|
33
|
+
}, e);
|
|
42
34
|
n.indexOf(c) < 0 && n.push(c);
|
|
43
|
-
const l =
|
|
44
|
-
l.resolve(
|
|
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
|
-
|
|
40
|
+
r.push({
|
|
49
41
|
resolve: u,
|
|
50
42
|
reject: d,
|
|
51
43
|
args: c,
|
|
52
44
|
self: l
|
|
53
|
-
}), o <
|
|
45
|
+
}), o < t && a();
|
|
54
46
|
});
|
|
55
47
|
};
|
|
56
48
|
return i.abort = function() {
|
|
57
|
-
n.forEach(clearTimeout), n = [],
|
|
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
|
-
}),
|
|
53
|
+
}), r.length = 0;
|
|
62
54
|
}, i;
|
|
63
55
|
}
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
for (const
|
|
67
|
-
const n = r
|
|
68
|
-
|
|
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
|
|
71
|
-
},
|
|
62
|
+
return e;
|
|
63
|
+
}, ot = (s) => s === "email", it = () => ({
|
|
72
64
|
singleTag: "hr"
|
|
73
|
-
}),
|
|
65
|
+
}), at = () => ({
|
|
74
66
|
tag: "blockquote"
|
|
75
|
-
}),
|
|
67
|
+
}), ct = () => ({
|
|
76
68
|
tag: "ul"
|
|
77
|
-
}),
|
|
69
|
+
}), lt = (s) => ({
|
|
78
70
|
tag: [
|
|
79
71
|
"pre",
|
|
80
72
|
{
|
|
81
73
|
tag: "code",
|
|
82
|
-
attrs:
|
|
74
|
+
attrs: s.attrs
|
|
83
75
|
}
|
|
84
76
|
]
|
|
85
|
-
}),
|
|
77
|
+
}), ht = () => ({
|
|
86
78
|
singleTag: "br"
|
|
87
|
-
}),
|
|
88
|
-
tag: `h${
|
|
89
|
-
}),
|
|
79
|
+
}), ut = (s) => ({
|
|
80
|
+
tag: `h${s.attrs.level}`
|
|
81
|
+
}), dt = (s) => ({
|
|
90
82
|
singleTag: [
|
|
91
83
|
{
|
|
92
84
|
tag: "img",
|
|
93
|
-
attrs:
|
|
85
|
+
attrs: nt(s.attrs, ["src", "alt", "title"])
|
|
94
86
|
}
|
|
95
87
|
]
|
|
96
|
-
}),
|
|
88
|
+
}), ft = () => ({
|
|
97
89
|
tag: "li"
|
|
98
|
-
}),
|
|
90
|
+
}), pt = () => ({
|
|
99
91
|
tag: "ol"
|
|
100
|
-
}),
|
|
92
|
+
}), gt = () => ({
|
|
101
93
|
tag: "p"
|
|
102
|
-
}),
|
|
94
|
+
}), mt = () => ({
|
|
103
95
|
tag: "b"
|
|
104
|
-
}),
|
|
96
|
+
}), yt = () => ({
|
|
105
97
|
tag: "strike"
|
|
106
|
-
}),
|
|
98
|
+
}), kt = () => ({
|
|
107
99
|
tag: "u"
|
|
108
|
-
}),
|
|
100
|
+
}), _t = () => ({
|
|
109
101
|
tag: "strong"
|
|
110
|
-
}),
|
|
102
|
+
}), bt = () => ({
|
|
111
103
|
tag: "code"
|
|
112
|
-
}),
|
|
104
|
+
}), vt = () => ({
|
|
113
105
|
tag: "i"
|
|
114
|
-
}),
|
|
115
|
-
const
|
|
116
|
-
return
|
|
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:
|
|
112
|
+
attrs: t
|
|
121
113
|
}
|
|
122
114
|
]
|
|
123
115
|
};
|
|
124
|
-
},
|
|
116
|
+
}, $t = (s) => ({
|
|
125
117
|
tag: [
|
|
126
118
|
{
|
|
127
119
|
tag: "span",
|
|
128
|
-
attrs:
|
|
120
|
+
attrs: s.attrs
|
|
129
121
|
}
|
|
130
122
|
]
|
|
131
|
-
}),
|
|
123
|
+
}), Tt = {
|
|
132
124
|
nodes: {
|
|
133
|
-
horizontal_rule:
|
|
134
|
-
blockquote:
|
|
135
|
-
bullet_list:
|
|
136
|
-
code_block:
|
|
137
|
-
hard_break:
|
|
138
|
-
heading:
|
|
139
|
-
image:
|
|
140
|
-
list_item:
|
|
141
|
-
ordered_list:
|
|
142
|
-
paragraph:
|
|
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:
|
|
146
|
-
strike:
|
|
147
|
-
underline:
|
|
148
|
-
strong:
|
|
149
|
-
code:
|
|
150
|
-
italic:
|
|
151
|
-
link:
|
|
152
|
-
styled:
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
const
|
|
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
|
"&": "&",
|
|
157
149
|
"<": "<",
|
|
158
150
|
">": ">",
|
|
159
151
|
'"': """,
|
|
160
152
|
"'": "'"
|
|
161
|
-
},
|
|
162
|
-
return
|
|
153
|
+
}, e = /[&<>"']/g, r = RegExp(e.source);
|
|
154
|
+
return s && r.test(s) ? s.replace(e, (n) => t[n]) : s;
|
|
163
155
|
};
|
|
164
|
-
class
|
|
165
|
-
constructor(
|
|
166
|
-
h(this, "marks"), h(this, "nodes"),
|
|
167
|
-
}
|
|
168
|
-
addNode(
|
|
169
|
-
this.nodes[
|
|
170
|
-
}
|
|
171
|
-
addMark(
|
|
172
|
-
this.marks[
|
|
173
|
-
}
|
|
174
|
-
render(
|
|
175
|
-
if (
|
|
176
|
-
let
|
|
177
|
-
return
|
|
178
|
-
|
|
179
|
-
}),
|
|
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(
|
|
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(
|
|
184
|
-
const
|
|
185
|
-
|
|
177
|
+
renderNode(t) {
|
|
178
|
+
const e = [];
|
|
179
|
+
t.marks && t.marks.forEach((n) => {
|
|
186
180
|
const o = this.getMatchingMark(n);
|
|
187
|
-
o &&
|
|
181
|
+
o && e.push(this.renderOpeningTag(o.tag));
|
|
188
182
|
});
|
|
189
|
-
const
|
|
190
|
-
return
|
|
191
|
-
|
|
192
|
-
}) :
|
|
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 &&
|
|
195
|
-
}),
|
|
188
|
+
o && e.push(this.renderClosingTag(o.tag));
|
|
189
|
+
}), e.join("");
|
|
196
190
|
}
|
|
197
|
-
renderTag(
|
|
198
|
-
return
|
|
199
|
-
if (
|
|
200
|
-
return `<${
|
|
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 = `<${
|
|
203
|
-
if (
|
|
204
|
-
for (const o in
|
|
205
|
-
const a =
|
|
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}${
|
|
202
|
+
return `${n}${e}>`;
|
|
209
203
|
}
|
|
210
204
|
}).join("");
|
|
211
205
|
}
|
|
212
|
-
renderOpeningTag(
|
|
213
|
-
return this.renderTag(
|
|
206
|
+
renderOpeningTag(t) {
|
|
207
|
+
return this.renderTag(t, "");
|
|
214
208
|
}
|
|
215
|
-
renderClosingTag(
|
|
216
|
-
return
|
|
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(
|
|
219
|
-
const
|
|
220
|
-
if (typeof
|
|
221
|
-
return t
|
|
212
|
+
getMatchingNode(t) {
|
|
213
|
+
const e = this.nodes[t.type];
|
|
214
|
+
if (typeof e == "function")
|
|
215
|
+
return e(t);
|
|
222
216
|
}
|
|
223
|
-
getMatchingMark(
|
|
224
|
-
const
|
|
225
|
-
if (typeof
|
|
226
|
-
return t
|
|
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
|
|
223
|
+
class K {
|
|
230
224
|
constructor() {
|
|
231
|
-
h(this, "isCDNUrl", (
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
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
|
|
242
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
236
|
+
for (const o in t) {
|
|
237
|
+
if (!Object.prototype.hasOwnProperty.call(t, o))
|
|
243
238
|
continue;
|
|
244
|
-
const a =
|
|
239
|
+
const a = t[o], i = r ? "" : encodeURIComponent(o);
|
|
245
240
|
let c;
|
|
246
|
-
typeof a == "object" ? c = this.stringify(
|
|
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
|
|
252
|
-
constructor(
|
|
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 =
|
|
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(
|
|
256
|
-
return this.url =
|
|
254
|
+
get(t, e) {
|
|
255
|
+
return this.url = t, this.parameters = e, this._methodHandler("get");
|
|
257
256
|
}
|
|
258
|
-
post(
|
|
259
|
-
return this.url =
|
|
257
|
+
post(t, e) {
|
|
258
|
+
return this.url = t, this.parameters = e, this._methodHandler("post");
|
|
260
259
|
}
|
|
261
|
-
put(
|
|
262
|
-
return this.url =
|
|
260
|
+
put(t, e) {
|
|
261
|
+
return this.url = t, this.parameters = e, this._methodHandler("put");
|
|
263
262
|
}
|
|
264
|
-
delete(
|
|
265
|
-
return this.url =
|
|
263
|
+
delete(t, e) {
|
|
264
|
+
return this.url = t, this.parameters = e, this._methodHandler("delete");
|
|
266
265
|
}
|
|
267
|
-
async _responseHandler(
|
|
268
|
-
const
|
|
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
|
|
275
|
-
|
|
273
|
+
t.status !== 204 && await t.json().then((n) => {
|
|
274
|
+
r.data = n;
|
|
276
275
|
});
|
|
277
|
-
for (const n of
|
|
278
|
-
|
|
279
|
-
return
|
|
280
|
-
}
|
|
281
|
-
async _methodHandler(
|
|
282
|
-
const
|
|
283
|
-
let
|
|
284
|
-
if (
|
|
285
|
-
const i = new
|
|
286
|
-
|
|
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
|
-
|
|
289
|
-
const n = new AbortController(), { signal: o } = n
|
|
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(`${
|
|
292
|
-
method:
|
|
292
|
+
const i = await this.fetch(`${e}`, {
|
|
293
|
+
method: t,
|
|
293
294
|
headers: this.headers,
|
|
294
|
-
body:
|
|
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(
|
|
308
|
-
if (/20[01]/g.test(`${
|
|
309
|
-
return
|
|
308
|
+
_statusHandler(t) {
|
|
309
|
+
if (/20[01|04]/g.test(`${t.status}`))
|
|
310
|
+
return t;
|
|
310
311
|
throw {
|
|
311
|
-
message: new Error(
|
|
312
|
-
response:
|
|
312
|
+
message: new Error(t.statusText || `status: ${t.status}`),
|
|
313
|
+
response: t
|
|
313
314
|
};
|
|
314
315
|
}
|
|
315
316
|
}
|
|
316
|
-
let
|
|
317
|
-
const
|
|
318
|
-
class
|
|
319
|
-
constructor(
|
|
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"), !
|
|
321
|
-
const o =
|
|
322
|
-
|
|
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
|
|
325
|
-
|
|
326
|
-
|
|
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
|
-
|
|
330
|
-
baseURL:
|
|
331
|
-
timeout:
|
|
332
|
-
headers:
|
|
333
|
-
responseInterceptor:
|
|
334
|
-
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(
|
|
338
|
-
this.richTextResolver.addNode("blok", (
|
|
339
|
-
let
|
|
340
|
-
return
|
|
341
|
-
|
|
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:
|
|
344
|
+
html: r
|
|
344
345
|
};
|
|
345
346
|
});
|
|
346
347
|
}
|
|
347
|
-
parseParams(
|
|
348
|
-
return
|
|
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(
|
|
351
|
-
return this.helpers.isCDNUrl(
|
|
351
|
+
factoryParamOptions(t, e) {
|
|
352
|
+
return this.helpers.isCDNUrl(t) ? this.parseParams(e) : e;
|
|
352
353
|
}
|
|
353
|
-
makeRequest(
|
|
354
|
-
const o = this.factoryParamOptions(
|
|
355
|
-
|
|
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(
|
|
358
|
-
|
|
359
|
-
const
|
|
360
|
-
return this.cacheResponse(
|
|
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(
|
|
363
|
-
const n = (
|
|
364
|
-
|
|
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(
|
|
367
|
-
const
|
|
368
|
-
return Promise.resolve(this.throttle("post",
|
|
376
|
+
post(t, e) {
|
|
377
|
+
const r = `/${t}`;
|
|
378
|
+
return Promise.resolve(this.throttle("post", r, e));
|
|
369
379
|
}
|
|
370
|
-
put(
|
|
371
|
-
const
|
|
372
|
-
return Promise.resolve(this.throttle("put",
|
|
380
|
+
put(t, e) {
|
|
381
|
+
const r = `/${t}`;
|
|
382
|
+
return Promise.resolve(this.throttle("put", r, e));
|
|
373
383
|
}
|
|
374
|
-
delete(
|
|
375
|
-
const
|
|
376
|
-
return Promise.resolve(this.throttle("delete",
|
|
384
|
+
delete(t, e) {
|
|
385
|
+
const r = `/${t}`;
|
|
386
|
+
return Promise.resolve(this.throttle("delete", r, e));
|
|
377
387
|
}
|
|
378
|
-
getStories(
|
|
379
|
-
return this.get("cdn/stories",
|
|
388
|
+
getStories(t) {
|
|
389
|
+
return this.get("cdn/stories", t);
|
|
380
390
|
}
|
|
381
|
-
getStory(
|
|
382
|
-
return this.get(`cdn/stories/${
|
|
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(
|
|
391
|
-
return JSON.parse(JSON.stringify(
|
|
400
|
+
_cleanCopy(t) {
|
|
401
|
+
return JSON.parse(JSON.stringify(t));
|
|
392
402
|
}
|
|
393
|
-
_insertLinks(
|
|
394
|
-
const
|
|
395
|
-
|
|
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(
|
|
398
|
-
if (
|
|
399
|
-
if (typeof e
|
|
400
|
-
this.relations[e
|
|
401
|
-
else if (e
|
|
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
|
|
413
|
+
t[e].forEach((o) => {
|
|
404
414
|
this.relations[o] && n.push(this._cleanCopy(this.relations[o]));
|
|
405
|
-
}), e
|
|
415
|
+
}), t[e] = n;
|
|
406
416
|
}
|
|
407
417
|
}
|
|
408
418
|
}
|
|
409
|
-
iterateTree(
|
|
410
|
-
const
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
437
|
+
r(t.content);
|
|
424
438
|
}
|
|
425
|
-
async resolveLinks(
|
|
426
|
-
let
|
|
427
|
-
if (
|
|
428
|
-
const n =
|
|
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(
|
|
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:
|
|
437
|
-
version:
|
|
450
|
+
language: e.language,
|
|
451
|
+
version: e.version,
|
|
438
452
|
by_uuids: o[i].join(",")
|
|
439
|
-
})).data.stories.forEach(
|
|
440
|
-
|
|
441
|
-
|
|
453
|
+
})).data.stories.forEach(
|
|
454
|
+
(c) => {
|
|
455
|
+
r.push(c);
|
|
456
|
+
}
|
|
457
|
+
);
|
|
442
458
|
} else
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
this.links[n.uuid] =
|
|
459
|
+
r = t.links;
|
|
460
|
+
r.forEach((n) => {
|
|
461
|
+
this.links[n.uuid] = { ...n, _stopResolving: !0 };
|
|
446
462
|
});
|
|
447
463
|
}
|
|
448
|
-
async resolveRelations(
|
|
449
|
-
let
|
|
450
|
-
if (
|
|
451
|
-
const n =
|
|
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(
|
|
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:
|
|
460
|
-
version:
|
|
475
|
+
language: e.language,
|
|
476
|
+
version: e.version,
|
|
461
477
|
by_uuids: o[i].join(",")
|
|
462
478
|
})).data.stories.forEach((c) => {
|
|
463
|
-
|
|
479
|
+
r.push(c);
|
|
464
480
|
});
|
|
465
481
|
} else
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
this.relations[n.uuid] =
|
|
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(
|
|
472
|
-
var
|
|
487
|
+
async resolveStories(t, e) {
|
|
488
|
+
var r, n;
|
|
473
489
|
let o = [];
|
|
474
|
-
if (typeof
|
|
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
|
-
|
|
493
|
+
t.story ? this.iterateTree(t.story, o) : t.stories.forEach((a) => {
|
|
478
494
|
this.iterateTree(a, o);
|
|
479
495
|
});
|
|
480
496
|
}
|
|
481
|
-
cacheResponse(
|
|
497
|
+
cacheResponse(t, e, r) {
|
|
482
498
|
return new Promise((n, o) => {
|
|
483
|
-
const a = this.helpers.stringify({ url:
|
|
484
|
-
if (this.cache.clear === "auto" &&
|
|
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",
|
|
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,
|
|
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(
|
|
506
|
-
return this.client[
|
|
521
|
+
throttledRequest(t, e, r) {
|
|
522
|
+
return this.client[t](e, r);
|
|
507
523
|
}
|
|
508
524
|
cacheVersions() {
|
|
509
|
-
return
|
|
525
|
+
return g;
|
|
510
526
|
}
|
|
511
527
|
cacheVersion() {
|
|
512
|
-
return
|
|
528
|
+
return g[this.accessToken];
|
|
513
529
|
}
|
|
514
|
-
setCacheVersion(
|
|
515
|
-
this.accessToken && (
|
|
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(
|
|
522
|
-
return
|
|
537
|
+
get(t) {
|
|
538
|
+
return b[t];
|
|
523
539
|
},
|
|
524
540
|
getAll() {
|
|
525
|
-
return
|
|
541
|
+
return b;
|
|
526
542
|
},
|
|
527
|
-
set(
|
|
528
|
-
|
|
543
|
+
set(t, e) {
|
|
544
|
+
b[t] = e;
|
|
529
545
|
},
|
|
530
546
|
flush() {
|
|
531
|
-
|
|
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
|
|
552
|
-
const { apiOptions:
|
|
553
|
-
if (!
|
|
554
|
-
console.error(
|
|
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
|
|
558
|
-
}
|
|
559
|
-
|
|
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
|
|
579
|
+
const t = JSON.parse(
|
|
580
|
+
s._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
|
|
581
|
+
);
|
|
563
582
|
return {
|
|
564
|
-
"data-blok-c": JSON.stringify(
|
|
565
|
-
"data-blok-uid":
|
|
583
|
+
"data-blok-c": JSON.stringify(t),
|
|
584
|
+
"data-blok-uid": t.id + "-" + t.uid
|
|
566
585
|
};
|
|
567
586
|
};
|
|
568
|
-
let
|
|
569
|
-
const
|
|
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(
|
|
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 (!
|
|
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(
|
|
581
|
-
|
|
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
|
-
},
|
|
606
|
+
}, Pt = (s = {}) => {
|
|
586
607
|
const {
|
|
587
|
-
bridge:
|
|
588
|
-
accessToken:
|
|
589
|
-
use:
|
|
608
|
+
bridge: t,
|
|
609
|
+
accessToken: e,
|
|
610
|
+
use: r = [],
|
|
590
611
|
apiOptions: n = {},
|
|
591
612
|
richText: o = {}
|
|
592
|
-
} =
|
|
593
|
-
n.accessToken = n.accessToken ||
|
|
594
|
-
const a = { bridge:
|
|
613
|
+
} = s;
|
|
614
|
+
n.accessToken = n.accessToken || e;
|
|
615
|
+
const a = { bridge: t, apiOptions: n };
|
|
595
616
|
let i = {};
|
|
596
|
-
return
|
|
597
|
-
i =
|
|
598
|
-
}),
|
|
599
|
-
},
|
|
600
|
-
|
|
601
|
-
let
|
|
602
|
-
return
|
|
603
|
-
|
|
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:
|
|
626
|
+
html: r
|
|
606
627
|
};
|
|
607
628
|
});
|
|
608
|
-
},
|
|
609
|
-
let
|
|
610
|
-
if (!
|
|
611
|
-
console.error(
|
|
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
|
|
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
|
|
641
|
+
function j() {
|
|
619
642
|
}
|
|
620
|
-
function E(
|
|
621
|
-
for (const
|
|
622
|
-
|
|
623
|
-
return
|
|
643
|
+
function E(s, t) {
|
|
644
|
+
for (const e in t)
|
|
645
|
+
s[e] = t[e];
|
|
646
|
+
return s;
|
|
624
647
|
}
|
|
625
|
-
function
|
|
626
|
-
return
|
|
648
|
+
function Q(s) {
|
|
649
|
+
return s();
|
|
627
650
|
}
|
|
628
|
-
function
|
|
651
|
+
function D() {
|
|
629
652
|
return /* @__PURE__ */ Object.create(null);
|
|
630
653
|
}
|
|
631
|
-
function
|
|
632
|
-
|
|
633
|
-
}
|
|
634
|
-
function te(r) {
|
|
635
|
-
return typeof r == "function";
|
|
654
|
+
function _(s) {
|
|
655
|
+
s.forEach(Q);
|
|
636
656
|
}
|
|
637
|
-
function
|
|
638
|
-
return
|
|
657
|
+
function W(s) {
|
|
658
|
+
return typeof s == "function";
|
|
639
659
|
}
|
|
640
|
-
function
|
|
641
|
-
return
|
|
660
|
+
function Ot(s, t) {
|
|
661
|
+
return s != s ? t == t : s !== t || s && typeof s == "object" || typeof s == "function";
|
|
642
662
|
}
|
|
643
|
-
function
|
|
644
|
-
|
|
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
|
|
666
|
+
function It(s) {
|
|
650
667
|
const t = {};
|
|
651
|
-
e
|
|
652
|
-
|
|
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
|
|
657
|
-
|
|
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
|
|
660
|
-
|
|
682
|
+
function X(s) {
|
|
683
|
+
s.parentNode && s.parentNode.removeChild(s);
|
|
661
684
|
}
|
|
662
|
-
function
|
|
663
|
-
return document.createTextNode(
|
|
685
|
+
function Nt(s) {
|
|
686
|
+
return document.createTextNode(s);
|
|
664
687
|
}
|
|
665
|
-
function
|
|
666
|
-
return
|
|
688
|
+
function Mt() {
|
|
689
|
+
return Nt("");
|
|
667
690
|
}
|
|
668
|
-
function
|
|
669
|
-
return Array.from(
|
|
691
|
+
function Lt(s) {
|
|
692
|
+
return Array.from(s.childNodes);
|
|
670
693
|
}
|
|
671
|
-
function
|
|
672
|
-
return new
|
|
694
|
+
function J(s, t) {
|
|
695
|
+
return new s(t);
|
|
673
696
|
}
|
|
674
|
-
let
|
|
675
|
-
function
|
|
676
|
-
|
|
697
|
+
let N;
|
|
698
|
+
function k(s) {
|
|
699
|
+
N = s;
|
|
677
700
|
}
|
|
678
|
-
const y = [],
|
|
701
|
+
const y = [], F = [], v = [], V = [], Ut = Promise.resolve();
|
|
679
702
|
let S = !1;
|
|
680
|
-
function
|
|
681
|
-
S || (S = !0,
|
|
703
|
+
function Ht() {
|
|
704
|
+
S || (S = !0, Ut.then(Z));
|
|
682
705
|
}
|
|
683
|
-
function
|
|
684
|
-
|
|
706
|
+
function P(s) {
|
|
707
|
+
v.push(s);
|
|
685
708
|
}
|
|
686
|
-
const
|
|
687
|
-
let
|
|
688
|
-
function
|
|
689
|
-
|
|
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
|
-
|
|
692
|
-
|
|
693
|
-
|
|
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 (
|
|
696
|
-
|
|
697
|
-
for (let
|
|
698
|
-
const
|
|
699
|
-
|
|
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
|
-
|
|
730
|
+
v.length = 0;
|
|
702
731
|
} while (y.length);
|
|
703
|
-
for (;
|
|
704
|
-
|
|
705
|
-
S = !1,
|
|
732
|
+
for (; V.length; )
|
|
733
|
+
V.pop()();
|
|
734
|
+
S = !1, R.clear(), k(s);
|
|
706
735
|
}
|
|
707
|
-
function
|
|
708
|
-
if (
|
|
709
|
-
|
|
710
|
-
const
|
|
711
|
-
|
|
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
|
|
743
|
+
const w = /* @__PURE__ */ new Set();
|
|
715
744
|
let f;
|
|
716
|
-
function
|
|
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
|
|
725
|
-
f.r ||
|
|
753
|
+
function Bt() {
|
|
754
|
+
f.r || _(f.c), f = f.p;
|
|
726
755
|
}
|
|
727
|
-
function
|
|
728
|
-
|
|
756
|
+
function O(s, t) {
|
|
757
|
+
s && s.i && (w.delete(s), s.i(t));
|
|
729
758
|
}
|
|
730
|
-
function
|
|
731
|
-
if (
|
|
732
|
-
if (
|
|
759
|
+
function Y(s, t, e, r) {
|
|
760
|
+
if (s && s.o) {
|
|
761
|
+
if (w.has(s))
|
|
733
762
|
return;
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
}),
|
|
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
|
-
|
|
767
|
+
r && r();
|
|
739
768
|
}
|
|
740
|
-
function
|
|
741
|
-
const
|
|
742
|
-
let o =
|
|
769
|
+
function Jt(s, t) {
|
|
770
|
+
const e = {}, r = {}, n = { $$scope: 1 };
|
|
771
|
+
let o = s.length;
|
|
743
772
|
for (; o--; ) {
|
|
744
|
-
const a =
|
|
773
|
+
const a = s[o], i = t[o];
|
|
745
774
|
if (i) {
|
|
746
775
|
for (const c in a)
|
|
747
|
-
c in i || (
|
|
776
|
+
c in i || (r[c] = 1);
|
|
748
777
|
for (const c in i)
|
|
749
|
-
n[c] || (
|
|
750
|
-
|
|
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
|
|
756
|
-
a in
|
|
757
|
-
return
|
|
784
|
+
for (const a in r)
|
|
785
|
+
a in e || (e[a] = void 0);
|
|
786
|
+
return e;
|
|
758
787
|
}
|
|
759
|
-
function
|
|
760
|
-
return typeof
|
|
788
|
+
function Ft(s) {
|
|
789
|
+
return typeof s == "object" && s !== null ? s : {};
|
|
761
790
|
}
|
|
762
|
-
function
|
|
763
|
-
|
|
791
|
+
function z(s) {
|
|
792
|
+
s && s.c();
|
|
764
793
|
}
|
|
765
|
-
function
|
|
766
|
-
const { fragment: n, after_update: o } =
|
|
767
|
-
n && n.m(
|
|
768
|
-
const a =
|
|
769
|
-
|
|
770
|
-
}), o.forEach(
|
|
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
|
|
773
|
-
const
|
|
774
|
-
|
|
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
|
|
777
|
-
|
|
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
|
|
780
|
-
const c =
|
|
781
|
-
|
|
782
|
-
const l =
|
|
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:
|
|
816
|
+
update: j,
|
|
788
817
|
not_equal: n,
|
|
789
|
-
bound:
|
|
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(
|
|
825
|
+
context: new Map(t.context || (c ? c.$$.context : [])),
|
|
797
826
|
// everything else
|
|
798
|
-
callbacks:
|
|
827
|
+
callbacks: D(),
|
|
799
828
|
dirty: i,
|
|
800
829
|
skip_bound: !1,
|
|
801
|
-
root:
|
|
830
|
+
root: t.target || c.$$.root
|
|
802
831
|
};
|
|
803
832
|
a && a(l.root);
|
|
804
833
|
let u = !1;
|
|
805
|
-
if (l.ctx =
|
|
806
|
-
const
|
|
807
|
-
return l.ctx && n(l.ctx[d], l.ctx[d] =
|
|
808
|
-
}) : [], l.update(), u = !0,
|
|
809
|
-
if (
|
|
810
|
-
const d =
|
|
811
|
-
l.fragment && l.fragment.l(d), d.forEach(
|
|
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
|
-
|
|
843
|
+
t.intro && O(s.$$.fragment), C(s, t.target, t.anchor, t.customElement), Z();
|
|
815
844
|
}
|
|
816
|
-
|
|
845
|
+
k(c);
|
|
817
846
|
}
|
|
818
|
-
class
|
|
847
|
+
class zt {
|
|
819
848
|
$destroy() {
|
|
820
|
-
|
|
821
|
-
}
|
|
822
|
-
$on(
|
|
823
|
-
if (!
|
|
824
|
-
return
|
|
825
|
-
const
|
|
826
|
-
return
|
|
827
|
-
const n =
|
|
828
|
-
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(
|
|
832
|
-
this.$$set && !
|
|
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
|
|
836
|
-
let
|
|
864
|
+
function Kt(s) {
|
|
865
|
+
let t, e, r;
|
|
837
866
|
const n = [
|
|
838
867
|
{ blok: (
|
|
839
868
|
/*blok*/
|
|
840
|
-
|
|
869
|
+
s[0]
|
|
841
870
|
) },
|
|
842
871
|
/*$$restProps*/
|
|
843
|
-
|
|
872
|
+
s[2]
|
|
844
873
|
];
|
|
845
874
|
var o = (
|
|
846
875
|
/*component*/
|
|
847
|
-
|
|
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 && (
|
|
884
|
+
return o && (t = J(o, a())), {
|
|
856
885
|
c() {
|
|
857
|
-
|
|
886
|
+
t && z(t.$$.fragment), e = Mt();
|
|
858
887
|
},
|
|
859
888
|
m(i, c) {
|
|
860
|
-
|
|
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 ?
|
|
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 &&
|
|
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 (
|
|
879
|
-
|
|
880
|
-
const u =
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
}),
|
|
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 ? (
|
|
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 &&
|
|
916
|
+
o && t.$set(l);
|
|
888
917
|
},
|
|
889
918
|
i(i) {
|
|
890
|
-
|
|
919
|
+
r || (t && O(t.$$.fragment, i), r = !0);
|
|
891
920
|
},
|
|
892
921
|
o(i) {
|
|
893
|
-
|
|
922
|
+
t && Y(t.$$.fragment, i), r = !1;
|
|
894
923
|
},
|
|
895
924
|
d(i) {
|
|
896
|
-
i &&
|
|
925
|
+
i && X(e), t && I(t, i);
|
|
897
926
|
}
|
|
898
927
|
};
|
|
899
928
|
}
|
|
900
|
-
function
|
|
901
|
-
const
|
|
902
|
-
let n =
|
|
903
|
-
return a ? o =
|
|
904
|
-
|
|
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
|
|
908
|
-
constructor(
|
|
909
|
-
super(),
|
|
936
|
+
class te extends zt {
|
|
937
|
+
constructor(t) {
|
|
938
|
+
super(), Yt(this, t, Gt, Kt, Ot, { blok: 0 });
|
|
910
939
|
}
|
|
911
940
|
}
|
|
912
|
-
const
|
|
913
|
-
const
|
|
914
|
-
const n =
|
|
915
|
-
n["data-blok-c"] && (
|
|
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
|
|
918
|
-
update(
|
|
919
|
-
|
|
946
|
+
return e(t), {
|
|
947
|
+
update(r) {
|
|
948
|
+
e(r);
|
|
920
949
|
}
|
|
921
950
|
};
|
|
922
951
|
};
|
|
923
|
-
let
|
|
924
|
-
const
|
|
952
|
+
let A = null;
|
|
953
|
+
const se = () => (A || console.log(
|
|
925
954
|
"You can't use getStoryblokApi if you're not loading apiPlugin."
|
|
926
|
-
),
|
|
927
|
-
let
|
|
928
|
-
const
|
|
929
|
-
const { storyblokApi:
|
|
930
|
-
|
|
931
|
-
},
|
|
932
|
-
let
|
|
933
|
-
return
|
|
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
|
-
`),
|
|
969
|
+
`), t;
|
|
941
970
|
};
|
|
942
971
|
export {
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
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
|
};
|