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