@tomsher/cms-theme-kit 0.1.6 → 0.1.10
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/bin.js +46 -21
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-PEG6K5NX.js → chunk-MHTCCMQU.js} +2 -2
- package/dist/{chunk-VY553LTO.js → chunk-NLFY255A.js} +61 -166
- package/dist/chunk-NLFY255A.js.map +1 -0
- package/dist/chunk-RR53HSKJ.js +158 -0
- package/dist/chunk-RR53HSKJ.js.map +1 -0
- package/dist/{chunk-OATE235V.js → chunk-VA6IQPFX.js} +27 -26
- package/dist/chunk-VA6IQPFX.js.map +1 -0
- package/dist/{chunk-VDICVCKJ.js → chunk-Z7WA4YHH.js} +1810 -251
- package/dist/chunk-Z7WA4YHH.js.map +1 -0
- package/dist/data-source-IVR7NX5Z.js +18 -0
- package/dist/{server-PV5PFQ7A.js → server-OIS3KTQY.js} +23 -14
- package/dist/server-OIS3KTQY.js.map +1 -0
- package/dist/{static-server-7NG4AY2E.js → static-server-LFDHJZB6.js} +7 -6
- package/dist/static-server-LFDHJZB6.js.map +1 -0
- package/package.json +2 -2
- package/dist/chunk-OATE235V.js.map +0 -1
- package/dist/chunk-UMGL5N53.js +0 -1761
- package/dist/chunk-UMGL5N53.js.map +0 -1
- package/dist/chunk-VDICVCKJ.js.map +0 -1
- package/dist/chunk-VY553LTO.js.map +0 -1
- package/dist/data-source-I5BXXWXI.js +0 -16
- package/dist/server-PV5PFQ7A.js.map +0 -1
- package/dist/static-server-7NG4AY2E.js.map +0 -1
- /package/dist/{chunk-PEG6K5NX.js.map → chunk-MHTCCMQU.js.map} +0 -0
- /package/dist/{data-source-I5BXXWXI.js.map → data-source-IVR7NX5Z.js.map} +0 -0
|
@@ -1,62 +1,1117 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
buildBlockList,
|
|
5
|
-
buildCustomCssBlock,
|
|
6
|
-
buildPreviewHeader,
|
|
7
|
-
buildSectionScope,
|
|
8
|
-
buildStorefrontDropsContext,
|
|
9
|
-
containsLiquidExpression,
|
|
10
|
-
escapeHtml,
|
|
11
|
-
extractThemeStylesheets,
|
|
12
|
-
inlinePreviewAssets,
|
|
13
|
-
isExternalLiquidAssetUrl,
|
|
14
|
-
isGalleryLiquidAssetUrl,
|
|
15
|
-
layoutKey,
|
|
16
|
-
loadGlobalSettings,
|
|
17
|
-
localizeStorefrontUrl,
|
|
18
|
-
normalizeLiquidAssetValue,
|
|
19
|
-
parseJson,
|
|
20
|
-
publicContext,
|
|
21
|
-
publicValue,
|
|
22
|
-
require_get,
|
|
23
|
-
resolveEntityBindings,
|
|
24
|
-
resolveLiquidAssetUrl,
|
|
25
|
-
resolveLiquidMediaUrl,
|
|
26
|
-
resolveMarkupKey,
|
|
27
|
-
resolveSectionSettings,
|
|
28
|
-
resolveTemplatePath,
|
|
29
|
-
sanitizeRichtext,
|
|
30
|
-
sectionKey,
|
|
31
|
-
stripSectionSchema,
|
|
32
|
-
templateErrorHtml,
|
|
33
|
-
trustedHtml
|
|
34
|
-
} from "./chunk-UMGL5N53.js";
|
|
35
|
-
import {
|
|
36
|
-
CliError,
|
|
3
|
+
__commonJS,
|
|
37
4
|
__toESM,
|
|
38
|
-
|
|
39
|
-
allowedTags,
|
|
40
|
-
customCssKey,
|
|
5
|
+
customFieldTypeConstants,
|
|
41
6
|
defaultLanguageCode,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
7
|
+
entityKinds,
|
|
8
|
+
liquidEntityQueryOptionPattern,
|
|
9
|
+
liquidEntityQueryPattern,
|
|
45
10
|
liquidTemplateLimits,
|
|
46
11
|
liquidThemeConfigFilePaths,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
maxOutputBytes,
|
|
50
|
-
maxPackageChars,
|
|
51
|
-
maxRenderMs,
|
|
52
|
-
maxTemplateChars,
|
|
12
|
+
liquidThemeFolderNames,
|
|
13
|
+
liquidThemeTemplatePaths,
|
|
53
14
|
queryKeys,
|
|
54
15
|
staticThemeFolderNames,
|
|
55
|
-
|
|
56
|
-
|
|
16
|
+
themeAssetUrlPatterns,
|
|
17
|
+
themeCustomizerLocaleNamespace,
|
|
18
|
+
themeCustomizerLocalizedSettingTypes,
|
|
19
|
+
themeEntityBindingSource,
|
|
20
|
+
themeFileExtensions,
|
|
21
|
+
themeLinkTargetKinds,
|
|
22
|
+
themeSettingTypeConstants,
|
|
23
|
+
themeTemplateCategories,
|
|
24
|
+
themeTemplateCategoryKeys
|
|
25
|
+
} from "./chunk-NLFY255A.js";
|
|
26
|
+
|
|
27
|
+
// ../node_modules/lodash/isArray.js
|
|
28
|
+
var require_isArray = __commonJS({
|
|
29
|
+
"../node_modules/lodash/isArray.js"(exports, module) {
|
|
30
|
+
"use strict";
|
|
31
|
+
var isArray2 = Array.isArray;
|
|
32
|
+
module.exports = isArray2;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// ../node_modules/lodash/_freeGlobal.js
|
|
37
|
+
var require_freeGlobal = __commonJS({
|
|
38
|
+
"../node_modules/lodash/_freeGlobal.js"(exports, module) {
|
|
39
|
+
"use strict";
|
|
40
|
+
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
41
|
+
module.exports = freeGlobal;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// ../node_modules/lodash/_root.js
|
|
46
|
+
var require_root = __commonJS({
|
|
47
|
+
"../node_modules/lodash/_root.js"(exports, module) {
|
|
48
|
+
"use strict";
|
|
49
|
+
var freeGlobal = require_freeGlobal();
|
|
50
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
51
|
+
var root = freeGlobal || freeSelf || Function("return this")();
|
|
52
|
+
module.exports = root;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// ../node_modules/lodash/_Symbol.js
|
|
57
|
+
var require_Symbol = __commonJS({
|
|
58
|
+
"../node_modules/lodash/_Symbol.js"(exports, module) {
|
|
59
|
+
"use strict";
|
|
60
|
+
var root = require_root();
|
|
61
|
+
var Symbol2 = root.Symbol;
|
|
62
|
+
module.exports = Symbol2;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// ../node_modules/lodash/_getRawTag.js
|
|
67
|
+
var require_getRawTag = __commonJS({
|
|
68
|
+
"../node_modules/lodash/_getRawTag.js"(exports, module) {
|
|
69
|
+
"use strict";
|
|
70
|
+
var Symbol2 = require_Symbol();
|
|
71
|
+
var objectProto = Object.prototype;
|
|
72
|
+
var hasOwnProperty2 = objectProto.hasOwnProperty;
|
|
73
|
+
var nativeObjectToString = objectProto.toString;
|
|
74
|
+
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
|
75
|
+
function getRawTag(value) {
|
|
76
|
+
var isOwn = hasOwnProperty2.call(value, symToStringTag), tag = value[symToStringTag];
|
|
77
|
+
try {
|
|
78
|
+
value[symToStringTag] = void 0;
|
|
79
|
+
var unmasked = true;
|
|
80
|
+
} catch (e) {
|
|
81
|
+
}
|
|
82
|
+
var result = nativeObjectToString.call(value);
|
|
83
|
+
if (unmasked) {
|
|
84
|
+
if (isOwn) {
|
|
85
|
+
value[symToStringTag] = tag;
|
|
86
|
+
} else {
|
|
87
|
+
delete value[symToStringTag];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
module.exports = getRawTag;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// ../node_modules/lodash/_objectToString.js
|
|
97
|
+
var require_objectToString = __commonJS({
|
|
98
|
+
"../node_modules/lodash/_objectToString.js"(exports, module) {
|
|
99
|
+
"use strict";
|
|
100
|
+
var objectProto = Object.prototype;
|
|
101
|
+
var nativeObjectToString = objectProto.toString;
|
|
102
|
+
function objectToString(value) {
|
|
103
|
+
return nativeObjectToString.call(value);
|
|
104
|
+
}
|
|
105
|
+
module.exports = objectToString;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// ../node_modules/lodash/_baseGetTag.js
|
|
110
|
+
var require_baseGetTag = __commonJS({
|
|
111
|
+
"../node_modules/lodash/_baseGetTag.js"(exports, module) {
|
|
112
|
+
"use strict";
|
|
113
|
+
var Symbol2 = require_Symbol();
|
|
114
|
+
var getRawTag = require_getRawTag();
|
|
115
|
+
var objectToString = require_objectToString();
|
|
116
|
+
var nullTag = "[object Null]";
|
|
117
|
+
var undefinedTag = "[object Undefined]";
|
|
118
|
+
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
|
119
|
+
function baseGetTag(value) {
|
|
120
|
+
if (value == null) {
|
|
121
|
+
return value === void 0 ? undefinedTag : nullTag;
|
|
122
|
+
}
|
|
123
|
+
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
124
|
+
}
|
|
125
|
+
module.exports = baseGetTag;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// ../node_modules/lodash/isObjectLike.js
|
|
130
|
+
var require_isObjectLike = __commonJS({
|
|
131
|
+
"../node_modules/lodash/isObjectLike.js"(exports, module) {
|
|
132
|
+
"use strict";
|
|
133
|
+
function isObjectLike(value) {
|
|
134
|
+
return value != null && typeof value == "object";
|
|
135
|
+
}
|
|
136
|
+
module.exports = isObjectLike;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
// ../node_modules/lodash/isSymbol.js
|
|
141
|
+
var require_isSymbol = __commonJS({
|
|
142
|
+
"../node_modules/lodash/isSymbol.js"(exports, module) {
|
|
143
|
+
"use strict";
|
|
144
|
+
var baseGetTag = require_baseGetTag();
|
|
145
|
+
var isObjectLike = require_isObjectLike();
|
|
146
|
+
var symbolTag = "[object Symbol]";
|
|
147
|
+
function isSymbol(value) {
|
|
148
|
+
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
149
|
+
}
|
|
150
|
+
module.exports = isSymbol;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// ../node_modules/lodash/_isKey.js
|
|
155
|
+
var require_isKey = __commonJS({
|
|
156
|
+
"../node_modules/lodash/_isKey.js"(exports, module) {
|
|
157
|
+
"use strict";
|
|
158
|
+
var isArray2 = require_isArray();
|
|
159
|
+
var isSymbol = require_isSymbol();
|
|
160
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
|
|
161
|
+
var reIsPlainProp = /^\w*$/;
|
|
162
|
+
function isKey(value, object) {
|
|
163
|
+
if (isArray2(value)) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
var type = typeof value;
|
|
167
|
+
if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
|
|
171
|
+
}
|
|
172
|
+
module.exports = isKey;
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// ../node_modules/lodash/isObject.js
|
|
177
|
+
var require_isObject = __commonJS({
|
|
178
|
+
"../node_modules/lodash/isObject.js"(exports, module) {
|
|
179
|
+
"use strict";
|
|
180
|
+
function isObject2(value) {
|
|
181
|
+
var type = typeof value;
|
|
182
|
+
return value != null && (type == "object" || type == "function");
|
|
183
|
+
}
|
|
184
|
+
module.exports = isObject2;
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
// ../node_modules/lodash/isFunction.js
|
|
189
|
+
var require_isFunction = __commonJS({
|
|
190
|
+
"../node_modules/lodash/isFunction.js"(exports, module) {
|
|
191
|
+
"use strict";
|
|
192
|
+
var baseGetTag = require_baseGetTag();
|
|
193
|
+
var isObject2 = require_isObject();
|
|
194
|
+
var asyncTag = "[object AsyncFunction]";
|
|
195
|
+
var funcTag = "[object Function]";
|
|
196
|
+
var genTag = "[object GeneratorFunction]";
|
|
197
|
+
var proxyTag = "[object Proxy]";
|
|
198
|
+
function isFunction2(value) {
|
|
199
|
+
if (!isObject2(value)) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
var tag = baseGetTag(value);
|
|
203
|
+
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
204
|
+
}
|
|
205
|
+
module.exports = isFunction2;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// ../node_modules/lodash/_coreJsData.js
|
|
210
|
+
var require_coreJsData = __commonJS({
|
|
211
|
+
"../node_modules/lodash/_coreJsData.js"(exports, module) {
|
|
212
|
+
"use strict";
|
|
213
|
+
var root = require_root();
|
|
214
|
+
var coreJsData = root["__core-js_shared__"];
|
|
215
|
+
module.exports = coreJsData;
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
// ../node_modules/lodash/_isMasked.js
|
|
220
|
+
var require_isMasked = __commonJS({
|
|
221
|
+
"../node_modules/lodash/_isMasked.js"(exports, module) {
|
|
222
|
+
"use strict";
|
|
223
|
+
var coreJsData = require_coreJsData();
|
|
224
|
+
var maskSrcKey = (function() {
|
|
225
|
+
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
|
|
226
|
+
return uid ? "Symbol(src)_1." + uid : "";
|
|
227
|
+
})();
|
|
228
|
+
function isMasked(func) {
|
|
229
|
+
return !!maskSrcKey && maskSrcKey in func;
|
|
230
|
+
}
|
|
231
|
+
module.exports = isMasked;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
// ../node_modules/lodash/_toSource.js
|
|
236
|
+
var require_toSource = __commonJS({
|
|
237
|
+
"../node_modules/lodash/_toSource.js"(exports, module) {
|
|
238
|
+
"use strict";
|
|
239
|
+
var funcProto = Function.prototype;
|
|
240
|
+
var funcToString = funcProto.toString;
|
|
241
|
+
function toSource(func) {
|
|
242
|
+
if (func != null) {
|
|
243
|
+
try {
|
|
244
|
+
return funcToString.call(func);
|
|
245
|
+
} catch (e) {
|
|
246
|
+
}
|
|
247
|
+
try {
|
|
248
|
+
return func + "";
|
|
249
|
+
} catch (e) {
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return "";
|
|
253
|
+
}
|
|
254
|
+
module.exports = toSource;
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
// ../node_modules/lodash/_baseIsNative.js
|
|
259
|
+
var require_baseIsNative = __commonJS({
|
|
260
|
+
"../node_modules/lodash/_baseIsNative.js"(exports, module) {
|
|
261
|
+
"use strict";
|
|
262
|
+
var isFunction2 = require_isFunction();
|
|
263
|
+
var isMasked = require_isMasked();
|
|
264
|
+
var isObject2 = require_isObject();
|
|
265
|
+
var toSource = require_toSource();
|
|
266
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
267
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
268
|
+
var funcProto = Function.prototype;
|
|
269
|
+
var objectProto = Object.prototype;
|
|
270
|
+
var funcToString = funcProto.toString;
|
|
271
|
+
var hasOwnProperty2 = objectProto.hasOwnProperty;
|
|
272
|
+
var reIsNative = RegExp(
|
|
273
|
+
"^" + funcToString.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
274
|
+
);
|
|
275
|
+
function baseIsNative(value) {
|
|
276
|
+
if (!isObject2(value) || isMasked(value)) {
|
|
277
|
+
return false;
|
|
278
|
+
}
|
|
279
|
+
var pattern = isFunction2(value) ? reIsNative : reIsHostCtor;
|
|
280
|
+
return pattern.test(toSource(value));
|
|
281
|
+
}
|
|
282
|
+
module.exports = baseIsNative;
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
// ../node_modules/lodash/_getValue.js
|
|
287
|
+
var require_getValue = __commonJS({
|
|
288
|
+
"../node_modules/lodash/_getValue.js"(exports, module) {
|
|
289
|
+
"use strict";
|
|
290
|
+
function getValue(object, key) {
|
|
291
|
+
return object == null ? void 0 : object[key];
|
|
292
|
+
}
|
|
293
|
+
module.exports = getValue;
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
// ../node_modules/lodash/_getNative.js
|
|
298
|
+
var require_getNative = __commonJS({
|
|
299
|
+
"../node_modules/lodash/_getNative.js"(exports, module) {
|
|
300
|
+
"use strict";
|
|
301
|
+
var baseIsNative = require_baseIsNative();
|
|
302
|
+
var getValue = require_getValue();
|
|
303
|
+
function getNative(object, key) {
|
|
304
|
+
var value = getValue(object, key);
|
|
305
|
+
return baseIsNative(value) ? value : void 0;
|
|
306
|
+
}
|
|
307
|
+
module.exports = getNative;
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
// ../node_modules/lodash/_nativeCreate.js
|
|
312
|
+
var require_nativeCreate = __commonJS({
|
|
313
|
+
"../node_modules/lodash/_nativeCreate.js"(exports, module) {
|
|
314
|
+
"use strict";
|
|
315
|
+
var getNative = require_getNative();
|
|
316
|
+
var nativeCreate = getNative(Object, "create");
|
|
317
|
+
module.exports = nativeCreate;
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
// ../node_modules/lodash/_hashClear.js
|
|
322
|
+
var require_hashClear = __commonJS({
|
|
323
|
+
"../node_modules/lodash/_hashClear.js"(exports, module) {
|
|
324
|
+
"use strict";
|
|
325
|
+
var nativeCreate = require_nativeCreate();
|
|
326
|
+
function hashClear() {
|
|
327
|
+
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
328
|
+
this.size = 0;
|
|
329
|
+
}
|
|
330
|
+
module.exports = hashClear;
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
// ../node_modules/lodash/_hashDelete.js
|
|
335
|
+
var require_hashDelete = __commonJS({
|
|
336
|
+
"../node_modules/lodash/_hashDelete.js"(exports, module) {
|
|
337
|
+
"use strict";
|
|
338
|
+
function hashDelete(key) {
|
|
339
|
+
var result = this.has(key) && delete this.__data__[key];
|
|
340
|
+
this.size -= result ? 1 : 0;
|
|
341
|
+
return result;
|
|
342
|
+
}
|
|
343
|
+
module.exports = hashDelete;
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
// ../node_modules/lodash/_hashGet.js
|
|
348
|
+
var require_hashGet = __commonJS({
|
|
349
|
+
"../node_modules/lodash/_hashGet.js"(exports, module) {
|
|
350
|
+
"use strict";
|
|
351
|
+
var nativeCreate = require_nativeCreate();
|
|
352
|
+
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
353
|
+
var objectProto = Object.prototype;
|
|
354
|
+
var hasOwnProperty2 = objectProto.hasOwnProperty;
|
|
355
|
+
function hashGet(key) {
|
|
356
|
+
var data = this.__data__;
|
|
357
|
+
if (nativeCreate) {
|
|
358
|
+
var result = data[key];
|
|
359
|
+
return result === HASH_UNDEFINED ? void 0 : result;
|
|
360
|
+
}
|
|
361
|
+
return hasOwnProperty2.call(data, key) ? data[key] : void 0;
|
|
362
|
+
}
|
|
363
|
+
module.exports = hashGet;
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
// ../node_modules/lodash/_hashHas.js
|
|
368
|
+
var require_hashHas = __commonJS({
|
|
369
|
+
"../node_modules/lodash/_hashHas.js"(exports, module) {
|
|
370
|
+
"use strict";
|
|
371
|
+
var nativeCreate = require_nativeCreate();
|
|
372
|
+
var objectProto = Object.prototype;
|
|
373
|
+
var hasOwnProperty2 = objectProto.hasOwnProperty;
|
|
374
|
+
function hashHas(key) {
|
|
375
|
+
var data = this.__data__;
|
|
376
|
+
return nativeCreate ? data[key] !== void 0 : hasOwnProperty2.call(data, key);
|
|
377
|
+
}
|
|
378
|
+
module.exports = hashHas;
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
// ../node_modules/lodash/_hashSet.js
|
|
383
|
+
var require_hashSet = __commonJS({
|
|
384
|
+
"../node_modules/lodash/_hashSet.js"(exports, module) {
|
|
385
|
+
"use strict";
|
|
386
|
+
var nativeCreate = require_nativeCreate();
|
|
387
|
+
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
388
|
+
function hashSet(key, value) {
|
|
389
|
+
var data = this.__data__;
|
|
390
|
+
this.size += this.has(key) ? 0 : 1;
|
|
391
|
+
data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
|
|
392
|
+
return this;
|
|
393
|
+
}
|
|
394
|
+
module.exports = hashSet;
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
// ../node_modules/lodash/_Hash.js
|
|
399
|
+
var require_Hash = __commonJS({
|
|
400
|
+
"../node_modules/lodash/_Hash.js"(exports, module) {
|
|
401
|
+
"use strict";
|
|
402
|
+
var hashClear = require_hashClear();
|
|
403
|
+
var hashDelete = require_hashDelete();
|
|
404
|
+
var hashGet = require_hashGet();
|
|
405
|
+
var hashHas = require_hashHas();
|
|
406
|
+
var hashSet = require_hashSet();
|
|
407
|
+
function Hash2(entries) {
|
|
408
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
409
|
+
this.clear();
|
|
410
|
+
while (++index < length) {
|
|
411
|
+
var entry = entries[index];
|
|
412
|
+
this.set(entry[0], entry[1]);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
Hash2.prototype.clear = hashClear;
|
|
416
|
+
Hash2.prototype["delete"] = hashDelete;
|
|
417
|
+
Hash2.prototype.get = hashGet;
|
|
418
|
+
Hash2.prototype.has = hashHas;
|
|
419
|
+
Hash2.prototype.set = hashSet;
|
|
420
|
+
module.exports = Hash2;
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
// ../node_modules/lodash/_listCacheClear.js
|
|
425
|
+
var require_listCacheClear = __commonJS({
|
|
426
|
+
"../node_modules/lodash/_listCacheClear.js"(exports, module) {
|
|
427
|
+
"use strict";
|
|
428
|
+
function listCacheClear() {
|
|
429
|
+
this.__data__ = [];
|
|
430
|
+
this.size = 0;
|
|
431
|
+
}
|
|
432
|
+
module.exports = listCacheClear;
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
// ../node_modules/lodash/eq.js
|
|
437
|
+
var require_eq = __commonJS({
|
|
438
|
+
"../node_modules/lodash/eq.js"(exports, module) {
|
|
439
|
+
"use strict";
|
|
440
|
+
function eq(value, other) {
|
|
441
|
+
return value === other || value !== value && other !== other;
|
|
442
|
+
}
|
|
443
|
+
module.exports = eq;
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
// ../node_modules/lodash/_assocIndexOf.js
|
|
448
|
+
var require_assocIndexOf = __commonJS({
|
|
449
|
+
"../node_modules/lodash/_assocIndexOf.js"(exports, module) {
|
|
450
|
+
"use strict";
|
|
451
|
+
var eq = require_eq();
|
|
452
|
+
function assocIndexOf(array, key) {
|
|
453
|
+
var length = array.length;
|
|
454
|
+
while (length--) {
|
|
455
|
+
if (eq(array[length][0], key)) {
|
|
456
|
+
return length;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return -1;
|
|
460
|
+
}
|
|
461
|
+
module.exports = assocIndexOf;
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
// ../node_modules/lodash/_listCacheDelete.js
|
|
466
|
+
var require_listCacheDelete = __commonJS({
|
|
467
|
+
"../node_modules/lodash/_listCacheDelete.js"(exports, module) {
|
|
468
|
+
"use strict";
|
|
469
|
+
var assocIndexOf = require_assocIndexOf();
|
|
470
|
+
var arrayProto = Array.prototype;
|
|
471
|
+
var splice = arrayProto.splice;
|
|
472
|
+
function listCacheDelete(key) {
|
|
473
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
474
|
+
if (index < 0) {
|
|
475
|
+
return false;
|
|
476
|
+
}
|
|
477
|
+
var lastIndex = data.length - 1;
|
|
478
|
+
if (index == lastIndex) {
|
|
479
|
+
data.pop();
|
|
480
|
+
} else {
|
|
481
|
+
splice.call(data, index, 1);
|
|
482
|
+
}
|
|
483
|
+
--this.size;
|
|
484
|
+
return true;
|
|
485
|
+
}
|
|
486
|
+
module.exports = listCacheDelete;
|
|
487
|
+
}
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
// ../node_modules/lodash/_listCacheGet.js
|
|
491
|
+
var require_listCacheGet = __commonJS({
|
|
492
|
+
"../node_modules/lodash/_listCacheGet.js"(exports, module) {
|
|
493
|
+
"use strict";
|
|
494
|
+
var assocIndexOf = require_assocIndexOf();
|
|
495
|
+
function listCacheGet(key) {
|
|
496
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
497
|
+
return index < 0 ? void 0 : data[index][1];
|
|
498
|
+
}
|
|
499
|
+
module.exports = listCacheGet;
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
|
|
503
|
+
// ../node_modules/lodash/_listCacheHas.js
|
|
504
|
+
var require_listCacheHas = __commonJS({
|
|
505
|
+
"../node_modules/lodash/_listCacheHas.js"(exports, module) {
|
|
506
|
+
"use strict";
|
|
507
|
+
var assocIndexOf = require_assocIndexOf();
|
|
508
|
+
function listCacheHas(key) {
|
|
509
|
+
return assocIndexOf(this.__data__, key) > -1;
|
|
510
|
+
}
|
|
511
|
+
module.exports = listCacheHas;
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
|
|
515
|
+
// ../node_modules/lodash/_listCacheSet.js
|
|
516
|
+
var require_listCacheSet = __commonJS({
|
|
517
|
+
"../node_modules/lodash/_listCacheSet.js"(exports, module) {
|
|
518
|
+
"use strict";
|
|
519
|
+
var assocIndexOf = require_assocIndexOf();
|
|
520
|
+
function listCacheSet(key, value) {
|
|
521
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
522
|
+
if (index < 0) {
|
|
523
|
+
++this.size;
|
|
524
|
+
data.push([key, value]);
|
|
525
|
+
} else {
|
|
526
|
+
data[index][1] = value;
|
|
527
|
+
}
|
|
528
|
+
return this;
|
|
529
|
+
}
|
|
530
|
+
module.exports = listCacheSet;
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
// ../node_modules/lodash/_ListCache.js
|
|
535
|
+
var require_ListCache = __commonJS({
|
|
536
|
+
"../node_modules/lodash/_ListCache.js"(exports, module) {
|
|
537
|
+
"use strict";
|
|
538
|
+
var listCacheClear = require_listCacheClear();
|
|
539
|
+
var listCacheDelete = require_listCacheDelete();
|
|
540
|
+
var listCacheGet = require_listCacheGet();
|
|
541
|
+
var listCacheHas = require_listCacheHas();
|
|
542
|
+
var listCacheSet = require_listCacheSet();
|
|
543
|
+
function ListCache(entries) {
|
|
544
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
545
|
+
this.clear();
|
|
546
|
+
while (++index < length) {
|
|
547
|
+
var entry = entries[index];
|
|
548
|
+
this.set(entry[0], entry[1]);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
ListCache.prototype.clear = listCacheClear;
|
|
552
|
+
ListCache.prototype["delete"] = listCacheDelete;
|
|
553
|
+
ListCache.prototype.get = listCacheGet;
|
|
554
|
+
ListCache.prototype.has = listCacheHas;
|
|
555
|
+
ListCache.prototype.set = listCacheSet;
|
|
556
|
+
module.exports = ListCache;
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
// ../node_modules/lodash/_Map.js
|
|
561
|
+
var require_Map = __commonJS({
|
|
562
|
+
"../node_modules/lodash/_Map.js"(exports, module) {
|
|
563
|
+
"use strict";
|
|
564
|
+
var getNative = require_getNative();
|
|
565
|
+
var root = require_root();
|
|
566
|
+
var Map2 = getNative(root, "Map");
|
|
567
|
+
module.exports = Map2;
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
// ../node_modules/lodash/_mapCacheClear.js
|
|
572
|
+
var require_mapCacheClear = __commonJS({
|
|
573
|
+
"../node_modules/lodash/_mapCacheClear.js"(exports, module) {
|
|
574
|
+
"use strict";
|
|
575
|
+
var Hash2 = require_Hash();
|
|
576
|
+
var ListCache = require_ListCache();
|
|
577
|
+
var Map2 = require_Map();
|
|
578
|
+
function mapCacheClear() {
|
|
579
|
+
this.size = 0;
|
|
580
|
+
this.__data__ = {
|
|
581
|
+
"hash": new Hash2(),
|
|
582
|
+
"map": new (Map2 || ListCache)(),
|
|
583
|
+
"string": new Hash2()
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
module.exports = mapCacheClear;
|
|
587
|
+
}
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
// ../node_modules/lodash/_isKeyable.js
|
|
591
|
+
var require_isKeyable = __commonJS({
|
|
592
|
+
"../node_modules/lodash/_isKeyable.js"(exports, module) {
|
|
593
|
+
"use strict";
|
|
594
|
+
function isKeyable(value) {
|
|
595
|
+
var type = typeof value;
|
|
596
|
+
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
|
|
597
|
+
}
|
|
598
|
+
module.exports = isKeyable;
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
|
|
602
|
+
// ../node_modules/lodash/_getMapData.js
|
|
603
|
+
var require_getMapData = __commonJS({
|
|
604
|
+
"../node_modules/lodash/_getMapData.js"(exports, module) {
|
|
605
|
+
"use strict";
|
|
606
|
+
var isKeyable = require_isKeyable();
|
|
607
|
+
function getMapData(map2, key) {
|
|
608
|
+
var data = map2.__data__;
|
|
609
|
+
return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
|
|
610
|
+
}
|
|
611
|
+
module.exports = getMapData;
|
|
612
|
+
}
|
|
613
|
+
});
|
|
614
|
+
|
|
615
|
+
// ../node_modules/lodash/_mapCacheDelete.js
|
|
616
|
+
var require_mapCacheDelete = __commonJS({
|
|
617
|
+
"../node_modules/lodash/_mapCacheDelete.js"(exports, module) {
|
|
618
|
+
"use strict";
|
|
619
|
+
var getMapData = require_getMapData();
|
|
620
|
+
function mapCacheDelete(key) {
|
|
621
|
+
var result = getMapData(this, key)["delete"](key);
|
|
622
|
+
this.size -= result ? 1 : 0;
|
|
623
|
+
return result;
|
|
624
|
+
}
|
|
625
|
+
module.exports = mapCacheDelete;
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
|
|
629
|
+
// ../node_modules/lodash/_mapCacheGet.js
|
|
630
|
+
var require_mapCacheGet = __commonJS({
|
|
631
|
+
"../node_modules/lodash/_mapCacheGet.js"(exports, module) {
|
|
632
|
+
"use strict";
|
|
633
|
+
var getMapData = require_getMapData();
|
|
634
|
+
function mapCacheGet(key) {
|
|
635
|
+
return getMapData(this, key).get(key);
|
|
636
|
+
}
|
|
637
|
+
module.exports = mapCacheGet;
|
|
638
|
+
}
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
// ../node_modules/lodash/_mapCacheHas.js
|
|
642
|
+
var require_mapCacheHas = __commonJS({
|
|
643
|
+
"../node_modules/lodash/_mapCacheHas.js"(exports, module) {
|
|
644
|
+
"use strict";
|
|
645
|
+
var getMapData = require_getMapData();
|
|
646
|
+
function mapCacheHas(key) {
|
|
647
|
+
return getMapData(this, key).has(key);
|
|
648
|
+
}
|
|
649
|
+
module.exports = mapCacheHas;
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
// ../node_modules/lodash/_mapCacheSet.js
|
|
654
|
+
var require_mapCacheSet = __commonJS({
|
|
655
|
+
"../node_modules/lodash/_mapCacheSet.js"(exports, module) {
|
|
656
|
+
"use strict";
|
|
657
|
+
var getMapData = require_getMapData();
|
|
658
|
+
function mapCacheSet(key, value) {
|
|
659
|
+
var data = getMapData(this, key), size2 = data.size;
|
|
660
|
+
data.set(key, value);
|
|
661
|
+
this.size += data.size == size2 ? 0 : 1;
|
|
662
|
+
return this;
|
|
663
|
+
}
|
|
664
|
+
module.exports = mapCacheSet;
|
|
665
|
+
}
|
|
666
|
+
});
|
|
667
|
+
|
|
668
|
+
// ../node_modules/lodash/_MapCache.js
|
|
669
|
+
var require_MapCache = __commonJS({
|
|
670
|
+
"../node_modules/lodash/_MapCache.js"(exports, module) {
|
|
671
|
+
"use strict";
|
|
672
|
+
var mapCacheClear = require_mapCacheClear();
|
|
673
|
+
var mapCacheDelete = require_mapCacheDelete();
|
|
674
|
+
var mapCacheGet = require_mapCacheGet();
|
|
675
|
+
var mapCacheHas = require_mapCacheHas();
|
|
676
|
+
var mapCacheSet = require_mapCacheSet();
|
|
677
|
+
function MapCache(entries) {
|
|
678
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
679
|
+
this.clear();
|
|
680
|
+
while (++index < length) {
|
|
681
|
+
var entry = entries[index];
|
|
682
|
+
this.set(entry[0], entry[1]);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
MapCache.prototype.clear = mapCacheClear;
|
|
686
|
+
MapCache.prototype["delete"] = mapCacheDelete;
|
|
687
|
+
MapCache.prototype.get = mapCacheGet;
|
|
688
|
+
MapCache.prototype.has = mapCacheHas;
|
|
689
|
+
MapCache.prototype.set = mapCacheSet;
|
|
690
|
+
module.exports = MapCache;
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
|
|
694
|
+
// ../node_modules/lodash/memoize.js
|
|
695
|
+
var require_memoize = __commonJS({
|
|
696
|
+
"../node_modules/lodash/memoize.js"(exports, module) {
|
|
697
|
+
"use strict";
|
|
698
|
+
var MapCache = require_MapCache();
|
|
699
|
+
var FUNC_ERROR_TEXT = "Expected a function";
|
|
700
|
+
function memoize(func, resolver) {
|
|
701
|
+
if (typeof func != "function" || resolver != null && typeof resolver != "function") {
|
|
702
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
703
|
+
}
|
|
704
|
+
var memoized = function() {
|
|
705
|
+
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
|
|
706
|
+
if (cache.has(key)) {
|
|
707
|
+
return cache.get(key);
|
|
708
|
+
}
|
|
709
|
+
var result = func.apply(this, args);
|
|
710
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
711
|
+
return result;
|
|
712
|
+
};
|
|
713
|
+
memoized.cache = new (memoize.Cache || MapCache)();
|
|
714
|
+
return memoized;
|
|
715
|
+
}
|
|
716
|
+
memoize.Cache = MapCache;
|
|
717
|
+
module.exports = memoize;
|
|
718
|
+
}
|
|
719
|
+
});
|
|
720
|
+
|
|
721
|
+
// ../node_modules/lodash/_memoizeCapped.js
|
|
722
|
+
var require_memoizeCapped = __commonJS({
|
|
723
|
+
"../node_modules/lodash/_memoizeCapped.js"(exports, module) {
|
|
724
|
+
"use strict";
|
|
725
|
+
var memoize = require_memoize();
|
|
726
|
+
var MAX_MEMOIZE_SIZE = 500;
|
|
727
|
+
function memoizeCapped(func) {
|
|
728
|
+
var result = memoize(func, function(key) {
|
|
729
|
+
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
730
|
+
cache.clear();
|
|
731
|
+
}
|
|
732
|
+
return key;
|
|
733
|
+
});
|
|
734
|
+
var cache = result.cache;
|
|
735
|
+
return result;
|
|
736
|
+
}
|
|
737
|
+
module.exports = memoizeCapped;
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
|
|
741
|
+
// ../node_modules/lodash/_stringToPath.js
|
|
742
|
+
var require_stringToPath = __commonJS({
|
|
743
|
+
"../node_modules/lodash/_stringToPath.js"(exports, module) {
|
|
744
|
+
"use strict";
|
|
745
|
+
var memoizeCapped = require_memoizeCapped();
|
|
746
|
+
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
747
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
748
|
+
var stringToPath = memoizeCapped(function(string) {
|
|
749
|
+
var result = [];
|
|
750
|
+
if (string.charCodeAt(0) === 46) {
|
|
751
|
+
result.push("");
|
|
752
|
+
}
|
|
753
|
+
string.replace(rePropName, function(match, number, quote, subString) {
|
|
754
|
+
result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
|
|
755
|
+
});
|
|
756
|
+
return result;
|
|
757
|
+
});
|
|
758
|
+
module.exports = stringToPath;
|
|
759
|
+
}
|
|
760
|
+
});
|
|
761
|
+
|
|
762
|
+
// ../node_modules/lodash/_arrayMap.js
|
|
763
|
+
var require_arrayMap = __commonJS({
|
|
764
|
+
"../node_modules/lodash/_arrayMap.js"(exports, module) {
|
|
765
|
+
"use strict";
|
|
766
|
+
function arrayMap(array, iteratee) {
|
|
767
|
+
var index = -1, length = array == null ? 0 : array.length, result = Array(length);
|
|
768
|
+
while (++index < length) {
|
|
769
|
+
result[index] = iteratee(array[index], index, array);
|
|
770
|
+
}
|
|
771
|
+
return result;
|
|
772
|
+
}
|
|
773
|
+
module.exports = arrayMap;
|
|
774
|
+
}
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
// ../node_modules/lodash/_baseToString.js
|
|
778
|
+
var require_baseToString = __commonJS({
|
|
779
|
+
"../node_modules/lodash/_baseToString.js"(exports, module) {
|
|
780
|
+
"use strict";
|
|
781
|
+
var Symbol2 = require_Symbol();
|
|
782
|
+
var arrayMap = require_arrayMap();
|
|
783
|
+
var isArray2 = require_isArray();
|
|
784
|
+
var isSymbol = require_isSymbol();
|
|
785
|
+
var INFINITY = 1 / 0;
|
|
786
|
+
var symbolProto = Symbol2 ? Symbol2.prototype : void 0;
|
|
787
|
+
var symbolToString = symbolProto ? symbolProto.toString : void 0;
|
|
788
|
+
function baseToString(value) {
|
|
789
|
+
if (typeof value == "string") {
|
|
790
|
+
return value;
|
|
791
|
+
}
|
|
792
|
+
if (isArray2(value)) {
|
|
793
|
+
return arrayMap(value, baseToString) + "";
|
|
794
|
+
}
|
|
795
|
+
if (isSymbol(value)) {
|
|
796
|
+
return symbolToString ? symbolToString.call(value) : "";
|
|
797
|
+
}
|
|
798
|
+
var result = value + "";
|
|
799
|
+
return result == "0" && 1 / value == -INFINITY ? "-0" : result;
|
|
800
|
+
}
|
|
801
|
+
module.exports = baseToString;
|
|
802
|
+
}
|
|
803
|
+
});
|
|
804
|
+
|
|
805
|
+
// ../node_modules/lodash/toString.js
|
|
806
|
+
var require_toString = __commonJS({
|
|
807
|
+
"../node_modules/lodash/toString.js"(exports, module) {
|
|
808
|
+
"use strict";
|
|
809
|
+
var baseToString = require_baseToString();
|
|
810
|
+
function toString2(value) {
|
|
811
|
+
return value == null ? "" : baseToString(value);
|
|
812
|
+
}
|
|
813
|
+
module.exports = toString2;
|
|
814
|
+
}
|
|
815
|
+
});
|
|
816
|
+
|
|
817
|
+
// ../node_modules/lodash/_castPath.js
|
|
818
|
+
var require_castPath = __commonJS({
|
|
819
|
+
"../node_modules/lodash/_castPath.js"(exports, module) {
|
|
820
|
+
"use strict";
|
|
821
|
+
var isArray2 = require_isArray();
|
|
822
|
+
var isKey = require_isKey();
|
|
823
|
+
var stringToPath = require_stringToPath();
|
|
824
|
+
var toString2 = require_toString();
|
|
825
|
+
function castPath(value, object) {
|
|
826
|
+
if (isArray2(value)) {
|
|
827
|
+
return value;
|
|
828
|
+
}
|
|
829
|
+
return isKey(value, object) ? [value] : stringToPath(toString2(value));
|
|
830
|
+
}
|
|
831
|
+
module.exports = castPath;
|
|
832
|
+
}
|
|
833
|
+
});
|
|
834
|
+
|
|
835
|
+
// ../node_modules/lodash/_toKey.js
|
|
836
|
+
var require_toKey = __commonJS({
|
|
837
|
+
"../node_modules/lodash/_toKey.js"(exports, module) {
|
|
838
|
+
"use strict";
|
|
839
|
+
var isSymbol = require_isSymbol();
|
|
840
|
+
var INFINITY = 1 / 0;
|
|
841
|
+
function toKey(value) {
|
|
842
|
+
if (typeof value == "string" || isSymbol(value)) {
|
|
843
|
+
return value;
|
|
844
|
+
}
|
|
845
|
+
var result = value + "";
|
|
846
|
+
return result == "0" && 1 / value == -INFINITY ? "-0" : result;
|
|
847
|
+
}
|
|
848
|
+
module.exports = toKey;
|
|
849
|
+
}
|
|
850
|
+
});
|
|
851
|
+
|
|
852
|
+
// ../node_modules/lodash/_baseGet.js
|
|
853
|
+
var require_baseGet = __commonJS({
|
|
854
|
+
"../node_modules/lodash/_baseGet.js"(exports, module) {
|
|
855
|
+
"use strict";
|
|
856
|
+
var castPath = require_castPath();
|
|
857
|
+
var toKey = require_toKey();
|
|
858
|
+
function baseGet(object, path) {
|
|
859
|
+
path = castPath(path, object);
|
|
860
|
+
var index = 0, length = path.length;
|
|
861
|
+
while (object != null && index < length) {
|
|
862
|
+
object = object[toKey(path[index++])];
|
|
863
|
+
}
|
|
864
|
+
return index && index == length ? object : void 0;
|
|
865
|
+
}
|
|
866
|
+
module.exports = baseGet;
|
|
867
|
+
}
|
|
868
|
+
});
|
|
869
|
+
|
|
870
|
+
// ../node_modules/lodash/get.js
|
|
871
|
+
var require_get = __commonJS({
|
|
872
|
+
"../node_modules/lodash/get.js"(exports, module) {
|
|
873
|
+
"use strict";
|
|
874
|
+
var baseGet = require_baseGet();
|
|
875
|
+
function get5(object, path, defaultValue) {
|
|
876
|
+
var result = object == null ? void 0 : baseGet(object, path);
|
|
877
|
+
return result === void 0 ? defaultValue : result;
|
|
878
|
+
}
|
|
879
|
+
module.exports = get5;
|
|
880
|
+
}
|
|
881
|
+
});
|
|
882
|
+
|
|
883
|
+
// ../cms-core/dist/chunk-DEIRZ7XQ.js
|
|
884
|
+
var setTranslatableArrayFieldPathValue = (target, schemaFields, fieldPath, value, isTranslatable) => {
|
|
885
|
+
const path = fieldPath.split(".");
|
|
886
|
+
const rootField = schemaFields.find((field) => field.type === customFieldTypeConstants.array && String(field.id ?? field.key ?? field.name) === path[0]);
|
|
887
|
+
if (!rootField || path.length < 3 || path.length % 2 !== 1) return false;
|
|
888
|
+
let targetValue = target[rootField.id ?? rootField.key ?? rootField.name ?? ""];
|
|
889
|
+
let nestedFields = rootField.settings?.fields || rootField.fields || [];
|
|
890
|
+
for (let index = 1; index < path.length; index += 2) {
|
|
891
|
+
const arrayIndex = Number(path[index]);
|
|
892
|
+
const fieldId = path[index + 1];
|
|
893
|
+
const nestedField = nestedFields.find((field) => String(field.name ?? field.key ?? field.id) === fieldId);
|
|
894
|
+
if (!Number.isInteger(arrayIndex) || !nestedField || !Array.isArray(targetValue) || !targetValue[arrayIndex]) return false;
|
|
895
|
+
if (index === path.length - 2) {
|
|
896
|
+
if (!isTranslatable(nestedField)) return false;
|
|
897
|
+
targetValue[arrayIndex][fieldId] = value;
|
|
898
|
+
return true;
|
|
899
|
+
}
|
|
900
|
+
if (nestedField.type !== customFieldTypeConstants.array) return false;
|
|
901
|
+
targetValue = targetValue[arrayIndex][fieldId];
|
|
902
|
+
nestedFields = nestedField.settings?.fields || nestedField.fields || [];
|
|
903
|
+
}
|
|
904
|
+
return false;
|
|
905
|
+
};
|
|
906
|
+
var hasTranslatableFields = (schemaFields, componentsMap = {}, isFieldTranslatable = (field) => Boolean(field.settings?.isTranslatable)) => {
|
|
907
|
+
if (!Array.isArray(schemaFields)) return false;
|
|
908
|
+
return schemaFields.some((f) => {
|
|
909
|
+
if (isFieldTranslatable(f)) return true;
|
|
910
|
+
const nestedFields = f.settings?.fields || f.fields;
|
|
911
|
+
if (Array.isArray(nestedFields)) {
|
|
912
|
+
return hasTranslatableFields(nestedFields, componentsMap, isFieldTranslatable);
|
|
913
|
+
}
|
|
914
|
+
if (f.type === customFieldTypeConstants.component) {
|
|
915
|
+
const nestedCompId = f.settings?.componentId || f.validations?.componentId;
|
|
916
|
+
const nestedComp = componentsMap[nestedCompId];
|
|
917
|
+
if (nestedComp?.schema) {
|
|
918
|
+
return hasTranslatableFields(nestedComp.schema, componentsMap, isFieldTranslatable);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
return false;
|
|
922
|
+
});
|
|
923
|
+
};
|
|
924
|
+
var buildStorefrontLocalePrefix = ({ countryCode, languageCode, includeCountry, includeLanguage }) => [
|
|
925
|
+
...includeCountry && countryCode ? [countryCode.toLowerCase()] : [],
|
|
926
|
+
...includeLanguage && languageCode ? [languageCode.toLowerCase()] : []
|
|
927
|
+
];
|
|
928
|
+
var findStorefrontLanguage = (languages, languageCode) => {
|
|
929
|
+
if (!languageCode) return void 0;
|
|
930
|
+
const normalizedCode = languageCode.toLowerCase();
|
|
931
|
+
return languages.find((language) => language.languageCode.toLowerCase() === normalizedCode);
|
|
932
|
+
};
|
|
933
|
+
var getStorefrontLocalePrefix = (localization) => {
|
|
934
|
+
if (!localization) return [];
|
|
935
|
+
return buildStorefrontLocalePrefix({
|
|
936
|
+
countryCode: localization.country?.countryCode,
|
|
937
|
+
languageCode: localization.language?.languageCode,
|
|
938
|
+
includeCountry: localization.availableCountries.length > 1,
|
|
939
|
+
includeLanguage: localization.availableLanguages.length > 1
|
|
940
|
+
});
|
|
941
|
+
};
|
|
942
|
+
var localizeStorefrontUrl = (url, localization) => {
|
|
943
|
+
const value = String(url || "/");
|
|
944
|
+
if (/^(?:[a-z]+:)?\/\//i.test(value) || value.startsWith("mailto:") || value.startsWith("tel:") || value.startsWith("#") || value.startsWith("?")) return value;
|
|
945
|
+
const prefix = getStorefrontLocalePrefix(localization);
|
|
946
|
+
if (!prefix.length) return value;
|
|
947
|
+
const match = value.match(/^([^?#]*)([?#].*)?$/);
|
|
948
|
+
const path = match?.[1] || "/";
|
|
949
|
+
const suffix = match?.[2] || "";
|
|
950
|
+
const segments = path.split("/").filter(Boolean);
|
|
951
|
+
const alreadyLocalized = prefix.every((segment, index) => segments[index]?.toLowerCase() === segment);
|
|
952
|
+
if (alreadyLocalized) return value;
|
|
953
|
+
const targetCountry = localization?.availableCountries.find((country) => country.countryCode.toLowerCase() === segments[0]?.toLowerCase());
|
|
954
|
+
if (targetCountry) {
|
|
955
|
+
const targetLanguages = targetCountry.languages || [];
|
|
956
|
+
if (targetLanguages.length <= 1 || findStorefrontLanguage(targetLanguages, segments[1])) return value;
|
|
957
|
+
} else if (localization?.availableCountries.length === 1 && findStorefrontLanguage(localization.availableLanguages, segments[0])) {
|
|
958
|
+
return value;
|
|
959
|
+
}
|
|
960
|
+
return `/${[...prefix, ...segments].join("/")}${suffix}` || "/";
|
|
961
|
+
};
|
|
962
|
+
var localizeStorefrontRoutes = (routes, localization) => Object.fromEntries(Object.entries(routes).map(([key, value]) => [key, typeof value === "string" ? localizeStorefrontUrl(value, localization) : value]));
|
|
963
|
+
var getThemeEntityQueryKey = (query) => `${query.type}:${query.handle}:${query.as || ""}`;
|
|
964
|
+
var hasNonEmptyString = (value) => typeof value === "string" && value.trim().length > 0;
|
|
965
|
+
var isSafeExternalThemeUrl = (value) => {
|
|
966
|
+
if (typeof value !== "string") return false;
|
|
967
|
+
try {
|
|
968
|
+
const url = new URL(value);
|
|
969
|
+
return url.protocol === "https:" && Boolean(url.hostname) && !url.username && !url.password;
|
|
970
|
+
} catch {
|
|
971
|
+
return false;
|
|
972
|
+
}
|
|
973
|
+
};
|
|
974
|
+
var isThemeLinkTargetReference = (value) => {
|
|
975
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
976
|
+
const reference = value;
|
|
977
|
+
if (reference.kind === themeLinkTargetKinds.external) return isSafeExternalThemeUrl(reference.url);
|
|
978
|
+
if (!hasNonEmptyString(reference.provider)) return false;
|
|
979
|
+
if (!hasNonEmptyString(reference.entityId)) return false;
|
|
980
|
+
if (reference.kind === themeLinkTargetKinds.single || reference.kind === themeLinkTargetKinds.listing) return true;
|
|
981
|
+
return reference.kind === themeLinkTargetKinds.entry && hasNonEmptyString(reference.entryId);
|
|
982
|
+
};
|
|
983
|
+
var normalizeThemeLinkTargetReference = (value) => {
|
|
984
|
+
if (!isThemeLinkTargetReference(value)) return null;
|
|
985
|
+
if (value.kind === themeLinkTargetKinds.external) {
|
|
986
|
+
return {
|
|
987
|
+
kind: value.kind,
|
|
988
|
+
url: value.url.trim()
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
if (value.kind === themeLinkTargetKinds.entry) {
|
|
992
|
+
return {
|
|
993
|
+
kind: value.kind,
|
|
994
|
+
provider: value.provider.trim(),
|
|
995
|
+
entityId: value.entityId.trim(),
|
|
996
|
+
entryId: value.entryId.trim()
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
return {
|
|
1000
|
+
kind: value.kind,
|
|
1001
|
+
provider: value.provider.trim(),
|
|
1002
|
+
entityId: value.entityId.trim()
|
|
1003
|
+
};
|
|
1004
|
+
};
|
|
1005
|
+
var getThemeLinkTargetReferenceKey = (value) => {
|
|
1006
|
+
const reference = normalizeThemeLinkTargetReference(value);
|
|
1007
|
+
return reference ? JSON.stringify(reference) : null;
|
|
1008
|
+
};
|
|
1009
|
+
var collectThemeLinkTargetReferences = (value) => {
|
|
1010
|
+
const references = /* @__PURE__ */ new Map();
|
|
1011
|
+
const visit = (current) => {
|
|
1012
|
+
if (Array.isArray(current)) {
|
|
1013
|
+
current.forEach(visit);
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
if (!current || typeof current !== "object") return;
|
|
1017
|
+
if (current.kind === themeLinkTargetKinds.external) return;
|
|
1018
|
+
const reference = normalizeThemeLinkTargetReference(current);
|
|
1019
|
+
const key = reference && getThemeLinkTargetReferenceKey(reference);
|
|
1020
|
+
if (reference && key) {
|
|
1021
|
+
references.set(key, reference);
|
|
1022
|
+
return;
|
|
1023
|
+
}
|
|
1024
|
+
Object.values(current).forEach(visit);
|
|
1025
|
+
};
|
|
1026
|
+
visit(value);
|
|
1027
|
+
return [...references.values()];
|
|
1028
|
+
};
|
|
1029
|
+
var safeDecodeAssetPath = (path) => {
|
|
1030
|
+
try {
|
|
1031
|
+
return decodeURIComponent(path);
|
|
1032
|
+
} catch {
|
|
1033
|
+
return path;
|
|
1034
|
+
}
|
|
1035
|
+
};
|
|
1036
|
+
var findThemeAssetUrl = (assetUrls, assetPath) => {
|
|
1037
|
+
const candidates = [.../* @__PURE__ */ new Set([assetPath, safeDecodeAssetPath(assetPath)])];
|
|
1038
|
+
for (const candidate of candidates) {
|
|
1039
|
+
if (assetUrls[candidate]) return assetUrls[candidate];
|
|
1040
|
+
}
|
|
1041
|
+
return void 0;
|
|
1042
|
+
};
|
|
1043
|
+
var findThemeAssetUrlBySuffix = (assetUrls, assetPath) => {
|
|
1044
|
+
const candidates = [.../* @__PURE__ */ new Set([assetPath, safeDecodeAssetPath(assetPath)])].map((candidate) => candidate.toLowerCase());
|
|
1045
|
+
return Object.entries(assetUrls).find(([path]) => {
|
|
1046
|
+
const lowerPath = path.toLowerCase();
|
|
1047
|
+
return candidates.some((candidate) => lowerPath.endsWith(`/${candidate}`));
|
|
1048
|
+
})?.[1];
|
|
1049
|
+
};
|
|
1050
|
+
var rewriteThemeCssAssetUrls = (content, assetUrls) => content.replace(/url\(\s*(['"]?)(?!data:|https?:|blob:|\/)([^'"\)]+)\1\s*\)/gi, (match, quote, assetPath) => {
|
|
1051
|
+
const normalizedPath = assetPath.trim().replace(/^\.\//, "");
|
|
1052
|
+
const assetUrl = findThemeAssetUrl(assetUrls, normalizedPath) || findThemeAssetUrlBySuffix(assetUrls, normalizedPath);
|
|
1053
|
+
return assetUrl ? `url(${quote}${assetUrl}${quote})` : match;
|
|
1054
|
+
});
|
|
1055
|
+
var rewriteThemeHtmlAssetUrls = (content, assetUrls) => content.replace(/\b(src|href|poster)=(['"])(\.\/)?assets\/([^'"]+)\2/gi, (match, attribute, quote, _relativePrefix, assetPath) => {
|
|
1056
|
+
const normalizedPath = assetPath.split(/[?#]/, 1)[0];
|
|
1057
|
+
const assetUrl = findThemeAssetUrl(assetUrls, normalizedPath);
|
|
1058
|
+
return assetUrl ? `${attribute}=${quote}${assetUrl}${assetPath.slice(normalizedPath.length)}${quote}` : match;
|
|
1059
|
+
});
|
|
1060
|
+
var isThemeMarkupFile = (filename) => filename.startsWith(`${liquidThemeFolderNames.layout}/`) || filename.startsWith(`${liquidThemeFolderNames.sections}/`) || filename.startsWith(`${liquidThemeFolderNames.snippets}/`);
|
|
1061
|
+
var rewriteLiquidThemeAssetBuffers = (buffers, assetUrls) => {
|
|
1062
|
+
const rewrittenBuffers = { ...buffers };
|
|
1063
|
+
for (const [filename, content] of Object.entries(buffers)) {
|
|
1064
|
+
if (!content) continue;
|
|
1065
|
+
if (filename.endsWith(".css")) rewrittenBuffers[filename] = rewriteThemeCssAssetUrls(content, assetUrls);
|
|
1066
|
+
if (isThemeMarkupFile(filename)) rewrittenBuffers[filename] = rewriteThemeHtmlAssetUrls(content, assetUrls);
|
|
1067
|
+
}
|
|
1068
|
+
return rewrittenBuffers;
|
|
1069
|
+
};
|
|
1070
|
+
var unsafeAssetPathCharacterPattern = /%(?![0-9a-f]{2})|[^a-z0-9._~:/@!$*+,;=%-]/giu;
|
|
1071
|
+
var encodeAssetPathCharacters = (path) => path.replace(unsafeAssetPathCharacterPattern, (character) => encodeURIComponent(character));
|
|
1072
|
+
var encodeThemeAssetUrl = (url) => {
|
|
1073
|
+
if (/^(?:data|blob):/i.test(url)) return url;
|
|
1074
|
+
const suffixStart = url.search(/[?#]/);
|
|
1075
|
+
if (suffixStart === -1) return encodeAssetPathCharacters(url);
|
|
1076
|
+
return `${encodeAssetPathCharacters(url.slice(0, suffixStart))}${url.slice(suffixStart).replace(/ /g, "%20")}`;
|
|
1077
|
+
};
|
|
1078
|
+
var getThemeAssetUrls = (files, rootDirectory, resolveMediaUrl) => Object.fromEntries(files.flatMap((file) => {
|
|
1079
|
+
const filename = file.path || file.filename;
|
|
1080
|
+
if (!filename || !file.fileUrl || !filename.startsWith(`${rootDirectory}/`)) return [];
|
|
1081
|
+
const paths = [filename, filename.slice(rootDirectory.length + 1)];
|
|
1082
|
+
const url = encodeThemeAssetUrl(resolveMediaUrl(file.fileUrl));
|
|
1083
|
+
return paths.map((path) => [path, url]);
|
|
1084
|
+
}));
|
|
1085
|
+
var createThemeMediaUrlResolver = (mediaBaseUrl) => {
|
|
1086
|
+
const base = mediaBaseUrl.replace(/\/$/, "");
|
|
1087
|
+
return (value) => {
|
|
1088
|
+
const normalized = String(value || "").trim();
|
|
1089
|
+
if (!normalized || /^blob:/i.test(normalized) || themeAssetUrlPatterns.safeExternalUrl.test(normalized) || themeAssetUrlPatterns.safeDataUrl.test(normalized)) return normalized;
|
|
1090
|
+
return `${base}${normalized.startsWith("/") ? normalized : `/${normalized}`}`;
|
|
1091
|
+
};
|
|
1092
|
+
};
|
|
1093
|
+
var decodeHtmlAttribute = (value) => value.replace(/"/g, '"').replace(/�*39;/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
1094
|
+
var extractThemeStylesheets = (html) => {
|
|
1095
|
+
const stylesheets = /* @__PURE__ */ new Set();
|
|
1096
|
+
const content = html.replace(/<link\b[^>]*\brel=(['"])stylesheet\1[^>]*>/gi, (link) => {
|
|
1097
|
+
const href = link.match(/\bhref=(['"])(.*?)\1/i)?.[2];
|
|
1098
|
+
if (href) stylesheets.add(decodeHtmlAttribute(href));
|
|
1099
|
+
return "";
|
|
1100
|
+
});
|
|
1101
|
+
return { html: content, stylesheets: [...stylesheets] };
|
|
1102
|
+
};
|
|
1103
|
+
var renderThemeHtmlWithStylesheets = ({ html, stylesheets }) => {
|
|
1104
|
+
if (!stylesheets.length) return html;
|
|
1105
|
+
const links = stylesheets.map((href) => `<link rel="stylesheet" href="${href.replace(/&/g, "&").replace(/"/g, """)}">`).join("");
|
|
1106
|
+
return /<head\b[^>]*>/i.test(html) ? html.replace(/<head\b[^>]*>/i, (head) => `${head}${links}`) : `${links}${html}`;
|
|
1107
|
+
};
|
|
1108
|
+
var ensureThemeStylesheetsBeforeContent = (html) => renderThemeHtmlWithStylesheets(extractThemeStylesheets(html));
|
|
57
1109
|
|
|
58
|
-
// ../cms-core/dist/
|
|
1110
|
+
// ../cms-core/dist/renderer/index.js
|
|
59
1111
|
var import_get = __toESM(require_get(), 1);
|
|
1112
|
+
var import_get2 = __toESM(require_get(), 1);
|
|
1113
|
+
var import_get3 = __toESM(require_get(), 1);
|
|
1114
|
+
import sanitizeHtml from "sanitize-html";
|
|
60
1115
|
|
|
61
1116
|
// ../node_modules/liquidjs/dist/liquid.node.mjs
|
|
62
1117
|
import { PassThrough } from "stream";
|
|
@@ -112,9 +1167,9 @@ function isIterator(val) {
|
|
|
112
1167
|
}
|
|
113
1168
|
function promisify(fn) {
|
|
114
1169
|
return function(...args) {
|
|
115
|
-
return new Promise((
|
|
1170
|
+
return new Promise((resolve2, reject2) => {
|
|
116
1171
|
fn(...args, (err, result) => {
|
|
117
|
-
err ? reject2(err) :
|
|
1172
|
+
err ? reject2(err) : resolve2(result);
|
|
118
1173
|
});
|
|
119
1174
|
});
|
|
120
1175
|
};
|
|
@@ -610,11 +1665,11 @@ var __assign = function() {
|
|
|
610
1665
|
};
|
|
611
1666
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
612
1667
|
function adopt(value) {
|
|
613
|
-
return value instanceof P ? value : new P(function(
|
|
614
|
-
|
|
1668
|
+
return value instanceof P ? value : new P(function(resolve2) {
|
|
1669
|
+
resolve2(value);
|
|
615
1670
|
});
|
|
616
1671
|
}
|
|
617
|
-
return new (P || (P = Promise))(function(
|
|
1672
|
+
return new (P || (P = Promise))(function(resolve2, reject2) {
|
|
618
1673
|
function fulfilled(value) {
|
|
619
1674
|
try {
|
|
620
1675
|
step(generator.next(value));
|
|
@@ -630,7 +1685,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
630
1685
|
}
|
|
631
1686
|
}
|
|
632
1687
|
function step(result) {
|
|
633
|
-
result.done ?
|
|
1688
|
+
result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
634
1689
|
}
|
|
635
1690
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
636
1691
|
});
|
|
@@ -2199,8 +3254,8 @@ var Tokenizer = class {
|
|
|
2199
3254
|
return;
|
|
2200
3255
|
let value;
|
|
2201
3256
|
this.skipBlank();
|
|
2202
|
-
const
|
|
2203
|
-
if (this.peek() ===
|
|
3257
|
+
const sep2 = isString(jekyllStyle) ? jekyllStyle : jekyllStyle ? "=" : ":";
|
|
3258
|
+
if (this.peek() === sep2) {
|
|
2204
3259
|
++this.p;
|
|
2205
3260
|
value = this.readValue();
|
|
2206
3261
|
}
|
|
@@ -2837,9 +3892,9 @@ var Loader = class {
|
|
|
2837
3892
|
var _a, _b, _c, _d;
|
|
2838
3893
|
this.options = options;
|
|
2839
3894
|
if (options.relativeReference) {
|
|
2840
|
-
const
|
|
2841
|
-
assert(
|
|
2842
|
-
const prefixes = ["." +
|
|
3895
|
+
const sep2 = options.fs.sep;
|
|
3896
|
+
assert(sep2, "`fs.sep` is required for relative reference");
|
|
3897
|
+
const prefixes = ["." + sep2, ".." + sep2, "./", "../"];
|
|
2843
3898
|
this.shouldLoadRelative = (referencedFile) => prefixes.some((prefix) => referencedFile.startsWith(prefix));
|
|
2844
3899
|
} else {
|
|
2845
3900
|
this.shouldLoadRelative = (_referencedFile) => false;
|
|
@@ -2870,13 +3925,13 @@ var Loader = class {
|
|
|
2870
3925
|
throw this.lookupError(file, dirs);
|
|
2871
3926
|
}
|
|
2872
3927
|
*candidates(file, dirs, currentFile) {
|
|
2873
|
-
const { fs: fs2, extname:
|
|
3928
|
+
const { fs: fs2, extname: extname2 } = this.options;
|
|
2874
3929
|
if (this.shouldLoadRelative(file) && currentFile) {
|
|
2875
|
-
const referenced = fs2.resolve(this.dirname(currentFile), file,
|
|
3930
|
+
const referenced = fs2.resolve(this.dirname(currentFile), file, extname2);
|
|
2876
3931
|
yield referenced;
|
|
2877
3932
|
}
|
|
2878
3933
|
for (const dir of dirs) {
|
|
2879
|
-
const referenced = fs2.resolve(dir, file,
|
|
3934
|
+
const referenced = fs2.resolve(dir, file, extname2);
|
|
2880
3935
|
yield referenced;
|
|
2881
3936
|
}
|
|
2882
3937
|
if (fs2.fallback !== void 0) {
|
|
@@ -3254,12 +4309,12 @@ var urlFilters = /* @__PURE__ */ Object.freeze({
|
|
|
3254
4309
|
});
|
|
3255
4310
|
var join = argumentsToValue(function(v, arg) {
|
|
3256
4311
|
const array = toArray(v);
|
|
3257
|
-
const
|
|
3258
|
-
let outputSize =
|
|
4312
|
+
const sep2 = isNil(arg) ? " " : stringify(arg);
|
|
4313
|
+
let outputSize = sep2.length * Math.max(array.length - 1, 0);
|
|
3259
4314
|
for (let i = 0; i < array.length; i++)
|
|
3260
4315
|
outputSize += String(array[i]).length;
|
|
3261
4316
|
this.context.memoryLimit.use(outputSize);
|
|
3262
|
-
return Array.prototype.join.call(array,
|
|
4317
|
+
return Array.prototype.join.call(array, sep2);
|
|
3263
4318
|
});
|
|
3264
4319
|
var last = argumentsToValue(function(v) {
|
|
3265
4320
|
return isArrayLike(v) ? readArrayElement(v, -1, this.context.ownPropertyOnly) : "";
|
|
@@ -4523,14 +5578,14 @@ var BlockTag = class extends Tag {
|
|
|
4523
5578
|
}
|
|
4524
5579
|
}
|
|
4525
5580
|
getBlockRender(ctx) {
|
|
4526
|
-
const
|
|
5581
|
+
const self2 = this;
|
|
4527
5582
|
const { liquid, templates } = this;
|
|
4528
5583
|
const renderChild = ctx.getRegister("blocks", {})[this.block];
|
|
4529
5584
|
const renderCurrent = function* (superBlock, emitter) {
|
|
4530
5585
|
const stack = ctx.getRegister("blockStack", []);
|
|
4531
|
-
if (stack.includes(
|
|
5586
|
+
if (stack.includes(self2))
|
|
4532
5587
|
throw new Error("block tag cannot be nested");
|
|
4533
|
-
stack.push(
|
|
5588
|
+
stack.push(self2);
|
|
4534
5589
|
ctx.push(createScope({ block: superBlock }));
|
|
4535
5590
|
yield liquid.renderer.renderTemplates(templates, ctx, emitter);
|
|
4536
5591
|
ctx.pop();
|
|
@@ -4884,17 +5939,17 @@ var Liquid = class _Liquid {
|
|
|
4884
5939
|
return plugin.call(this, _Liquid);
|
|
4885
5940
|
}
|
|
4886
5941
|
express() {
|
|
4887
|
-
const
|
|
5942
|
+
const self2 = this;
|
|
4888
5943
|
let firstCall = true;
|
|
4889
5944
|
return function(filePath, ctx, callback) {
|
|
4890
5945
|
if (firstCall) {
|
|
4891
5946
|
firstCall = false;
|
|
4892
5947
|
const dirs = normalizeDirectoryList(this.root);
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
5948
|
+
self2.options.root.unshift(...dirs);
|
|
5949
|
+
self2.options.layouts.unshift(...dirs);
|
|
5950
|
+
self2.options.partials.unshift(...dirs);
|
|
4896
5951
|
}
|
|
4897
|
-
|
|
5952
|
+
self2.renderFile(filePath, ctx).then((html) => callback(null, html), callback);
|
|
4898
5953
|
};
|
|
4899
5954
|
}
|
|
4900
5955
|
analyze(template, options = {}) {
|
|
@@ -4987,8 +6042,651 @@ var Liquid = class _Liquid {
|
|
|
4987
6042
|
}
|
|
4988
6043
|
};
|
|
4989
6044
|
|
|
4990
|
-
// ../cms-core/dist/
|
|
4991
|
-
var
|
|
6045
|
+
// ../cms-core/dist/renderer/index.js
|
|
6046
|
+
var import_get4 = __toESM(require_get(), 1);
|
|
6047
|
+
var liquidAssetUrlPatterns = {
|
|
6048
|
+
themeAssetPrefix: /^assets\//i
|
|
6049
|
+
};
|
|
6050
|
+
var maxRenderMs = 3e3;
|
|
6051
|
+
var maxOutputBytes = 1024 * 1024;
|
|
6052
|
+
var maxTemplateChars = 128 * 1024;
|
|
6053
|
+
var maxPackageChars = 4 * 1024 * 1024;
|
|
6054
|
+
var maxIterations = 1e6;
|
|
6055
|
+
var maxIncludeDepth = 8;
|
|
6056
|
+
var maxContextDepth = 12;
|
|
6057
|
+
var maxContextArray = 1e3;
|
|
6058
|
+
var maxContextKeys = 500;
|
|
6059
|
+
var publicContextKeys = /* @__PURE__ */ new Set(["shop", "settings", "routes", "page", "collection", "contentCollections", "linkTargets", "localization", "search", "entities", "forms", "contentLoading", "contentError", "pageTitle", "section", "item"]);
|
|
6060
|
+
var privateField = /^(?:__proto__|prototype|constructor|password|secret|token|access[_-]?token|refresh[_-]?token|api[_-]?key|private[_-]?key|notification[_-]?emails|internal[_-]?notes)$/i;
|
|
6061
|
+
var allowedTags = /* @__PURE__ */ new Set(["assign", "for", "capture", "case", "comment", "cycle", "if", "unless", "break", "continue", "echo", "raw", "liquid", "#", "tablerow", "increment", "decrement", "render", "section"]);
|
|
6062
|
+
var allowedFilters = /* @__PURE__ */ new Set([
|
|
6063
|
+
"abs",
|
|
6064
|
+
"append",
|
|
6065
|
+
"at_least",
|
|
6066
|
+
"at_most",
|
|
6067
|
+
"capitalize",
|
|
6068
|
+
"ceil",
|
|
6069
|
+
"compact",
|
|
6070
|
+
"concat",
|
|
6071
|
+
"date",
|
|
6072
|
+
"default",
|
|
6073
|
+
"divided_by",
|
|
6074
|
+
"downcase",
|
|
6075
|
+
"escape",
|
|
6076
|
+
"escape_once",
|
|
6077
|
+
"first",
|
|
6078
|
+
"floor",
|
|
6079
|
+
"join",
|
|
6080
|
+
"last",
|
|
6081
|
+
"lstrip",
|
|
6082
|
+
"map",
|
|
6083
|
+
"minus",
|
|
6084
|
+
"modulo",
|
|
6085
|
+
"newline_to_br",
|
|
6086
|
+
"plus",
|
|
6087
|
+
"prepend",
|
|
6088
|
+
"remove",
|
|
6089
|
+
"remove_first",
|
|
6090
|
+
"replace",
|
|
6091
|
+
"replace_first",
|
|
6092
|
+
"reverse",
|
|
6093
|
+
"round",
|
|
6094
|
+
"rstrip",
|
|
6095
|
+
"size",
|
|
6096
|
+
"slice",
|
|
6097
|
+
"sort",
|
|
6098
|
+
"sort_natural",
|
|
6099
|
+
"split",
|
|
6100
|
+
"strip",
|
|
6101
|
+
"strip_html",
|
|
6102
|
+
"strip_newlines",
|
|
6103
|
+
"times",
|
|
6104
|
+
"truncate",
|
|
6105
|
+
"truncatewords",
|
|
6106
|
+
"uniq",
|
|
6107
|
+
"upcase",
|
|
6108
|
+
"url_encode",
|
|
6109
|
+
"where",
|
|
6110
|
+
"assetUrl",
|
|
6111
|
+
"stylesheetTag",
|
|
6112
|
+
"scriptTag",
|
|
6113
|
+
"t",
|
|
6114
|
+
"json",
|
|
6115
|
+
"imageUrl",
|
|
6116
|
+
"richtext",
|
|
6117
|
+
"localizeUrl"
|
|
6118
|
+
]);
|
|
6119
|
+
var defaultTemplate = liquidThemeTemplatePaths.index;
|
|
6120
|
+
var defaultLayout = "theme";
|
|
6121
|
+
var isSafePartialName = (name) => /^[a-zA-Z0-9][a-zA-Z0-9/_-]{0,127}(?:\.liquid|\.html)?$/.test(name) && !name.includes("//");
|
|
6122
|
+
var blockTagPatterns = [
|
|
6123
|
+
/\{%\s*schema\s*%\}[\s\S]*?\{%\s*endschema\s*%\}/gi,
|
|
6124
|
+
/\{%\s*stylesheet\s*%\}[\s\S]*?\{%\s*endstylesheet\s*%\}/gi,
|
|
6125
|
+
/\{%\s*javascript\s*%\}[\s\S]*?\{%\s*endjavascript\s*%\}/gi,
|
|
6126
|
+
/\{%\s*entityQuery\b[^%]*%\}/gi
|
|
6127
|
+
];
|
|
6128
|
+
var themePostMessageEvents = {
|
|
6129
|
+
select: "THEME_CUSTOMIZER_SELECT",
|
|
6130
|
+
navigate: "THEME_CUSTOMIZER_NAVIGATE"
|
|
6131
|
+
};
|
|
6132
|
+
var customCssKey = "customCss";
|
|
6133
|
+
function extractSectionSchema(liquidSource) {
|
|
6134
|
+
if (!liquidSource) return null;
|
|
6135
|
+
const match = liquidSource.match(/\{%\s*schema\s*%\}([\s\S]*?)\{%\s*endschema\s*%\}/i);
|
|
6136
|
+
if (!match || !match[1]) return null;
|
|
6137
|
+
try {
|
|
6138
|
+
const parsed = JSON.parse(match[1].trim());
|
|
6139
|
+
return parsed;
|
|
6140
|
+
} catch (err) {
|
|
6141
|
+
console.error("Failed to parse Liquid section schema JSON:", err);
|
|
6142
|
+
return null;
|
|
6143
|
+
}
|
|
6144
|
+
}
|
|
6145
|
+
var localizedSettingTypes = new Set(Object.values(themeCustomizerLocalizedSettingTypes));
|
|
6146
|
+
var isThemeCustomizerSettingLocalized = (setting) => {
|
|
6147
|
+
return hasTranslatableFields([setting], {}, (field) => Boolean(field.settings?.isTranslatable) && localizedSettingTypes.has(String(field.type)));
|
|
6148
|
+
};
|
|
6149
|
+
var getLocalePath = (languageCode) => `${liquidThemeFolderNames.locales}/${languageCode.toLowerCase()}.json`;
|
|
6150
|
+
var parseObject = (raw2) => {
|
|
6151
|
+
if (!raw2) return {};
|
|
6152
|
+
const parsed = JSON.parse(raw2);
|
|
6153
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("Locale file must contain a JSON object");
|
|
6154
|
+
return parsed;
|
|
6155
|
+
};
|
|
6156
|
+
var mergeAllowedSettings = (target, translated, schemaSettings = []) => {
|
|
6157
|
+
const allowedSettings = new Set(
|
|
6158
|
+
schemaSettings.filter(isThemeCustomizerSettingLocalized).filter((setting) => setting.type !== "array").map((setting) => String(setting.id))
|
|
6159
|
+
);
|
|
6160
|
+
for (const [settingId, value] of Object.entries(translated)) {
|
|
6161
|
+
if (allowedSettings.has(settingId)) {
|
|
6162
|
+
target[settingId] = value;
|
|
6163
|
+
continue;
|
|
6164
|
+
}
|
|
6165
|
+
setTranslatableArrayFieldPathValue(target, schemaSettings, settingId, value, isThemeCustomizerSettingLocalized);
|
|
6166
|
+
}
|
|
6167
|
+
};
|
|
6168
|
+
var parseTemplate = (raw2) => {
|
|
6169
|
+
try {
|
|
6170
|
+
const parsed = JSON.parse(raw2);
|
|
6171
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
6172
|
+
} catch {
|
|
6173
|
+
return null;
|
|
6174
|
+
}
|
|
6175
|
+
};
|
|
6176
|
+
var applyTemplateOverrides = (buffers, templatePath, templateOverrides) => {
|
|
6177
|
+
const template = parseTemplate(buffers[templatePath] || "");
|
|
6178
|
+
if (!template || !templateOverrides || typeof templateOverrides !== "object") return;
|
|
6179
|
+
for (const [sectionKey2, sectionOverride] of Object.entries(templateOverrides.sections || {})) {
|
|
6180
|
+
const section = template.sections?.[sectionKey2];
|
|
6181
|
+
if (!section || !sectionOverride || typeof sectionOverride !== "object") continue;
|
|
6182
|
+
const sectionType = String(section.type || sectionKey2);
|
|
6183
|
+
const schema = extractSectionSchema(buffers[`${liquidThemeFolderNames.sections}/${sectionType}${themeFileExtensions.liquid}`] || "");
|
|
6184
|
+
if (!schema) continue;
|
|
6185
|
+
const sectionSettings = sectionOverride.settings;
|
|
6186
|
+
if (sectionSettings && typeof sectionSettings === "object") {
|
|
6187
|
+
section.settings ||= {};
|
|
6188
|
+
mergeAllowedSettings(section.settings, sectionSettings, schema.settings);
|
|
6189
|
+
}
|
|
6190
|
+
for (const [blockId, blockOverride] of Object.entries(sectionOverride.blocks || {})) {
|
|
6191
|
+
const block = section.blocks?.[blockId];
|
|
6192
|
+
if (!block || !blockOverride || typeof blockOverride !== "object") continue;
|
|
6193
|
+
const blockSchema = schema.blocks?.find((item) => item.type === block.type);
|
|
6194
|
+
if (blockSchema && blockOverride.settings && typeof blockOverride.settings === "object") {
|
|
6195
|
+
block.settings ||= {};
|
|
6196
|
+
mergeAllowedSettings(block.settings, blockOverride.settings, blockSchema.settings);
|
|
6197
|
+
}
|
|
6198
|
+
}
|
|
6199
|
+
}
|
|
6200
|
+
buffers[templatePath] = JSON.stringify(template, null, 2);
|
|
6201
|
+
};
|
|
6202
|
+
var applyGlobalOverrides = (buffers, overrides) => {
|
|
6203
|
+
const settingsPath = liquidThemeConfigFilePaths.settingsData;
|
|
6204
|
+
const data = parseTemplate(buffers[settingsPath] || "");
|
|
6205
|
+
if (!data || !data.current || typeof data.current !== "object") return;
|
|
6206
|
+
let schema = [];
|
|
6207
|
+
try {
|
|
6208
|
+
const parsed = JSON.parse(buffers[liquidThemeConfigFilePaths.settingsSchema] || "[]");
|
|
6209
|
+
schema = Array.isArray(parsed) ? parsed : [];
|
|
6210
|
+
} catch {
|
|
6211
|
+
return;
|
|
6212
|
+
}
|
|
6213
|
+
const settings = schema.flatMap((group) => group.settings || []);
|
|
6214
|
+
mergeAllowedSettings(data.current, overrides, settings);
|
|
6215
|
+
buffers[settingsPath] = JSON.stringify(data, null, 2);
|
|
6216
|
+
};
|
|
6217
|
+
var applyThemeCustomizerLocaleOverrides = (fileBuffers, languageCode, defaultLanguageCode2) => {
|
|
6218
|
+
if (!languageCode || languageCode.toLowerCase() === defaultLanguageCode2.toLowerCase()) return fileBuffers;
|
|
6219
|
+
const localePath = getLocalePath(languageCode);
|
|
6220
|
+
let locale;
|
|
6221
|
+
try {
|
|
6222
|
+
locale = parseObject(fileBuffers[localePath]);
|
|
6223
|
+
} catch {
|
|
6224
|
+
return fileBuffers;
|
|
6225
|
+
}
|
|
6226
|
+
const customizer = locale[themeCustomizerLocaleNamespace];
|
|
6227
|
+
if (!customizer || typeof customizer !== "object" || Array.isArray(customizer)) return fileBuffers;
|
|
6228
|
+
const result = { ...fileBuffers };
|
|
6229
|
+
const templates = customizer.templates;
|
|
6230
|
+
if (templates && typeof templates === "object" && !Array.isArray(templates)) {
|
|
6231
|
+
for (const [templatePath, templateOverrides] of Object.entries(templates)) {
|
|
6232
|
+
applyTemplateOverrides(result, templatePath, templateOverrides);
|
|
6233
|
+
}
|
|
6234
|
+
}
|
|
6235
|
+
if (customizer.global && typeof customizer.global === "object" && !Array.isArray(customizer.global)) {
|
|
6236
|
+
applyGlobalOverrides(result, customizer.global);
|
|
6237
|
+
}
|
|
6238
|
+
return result;
|
|
6239
|
+
};
|
|
6240
|
+
var getLiquidThemeEntitySources = (fileBuffers = {}, selectedTemplate) => Object.entries(fileBuffers).filter(([path]) => path === selectedTemplate || path === liquidThemeConfigFilePaths.settingsData || path.startsWith(`${liquidThemeFolderNames.sections}/`) || path.startsWith(`${liquidThemeFolderNames.snippets}/`)).map(([, content]) => content);
|
|
6241
|
+
var markupReferencePattern = /\{%\s*(render|include|section)\s+['"]([^'"]+)['"]/gi;
|
|
6242
|
+
var hasFile = (fileBuffers, path) => Object.prototype.hasOwnProperty.call(fileBuffers, path);
|
|
6243
|
+
var resolveMarkupPath = (fileBuffers, directory, name) => {
|
|
6244
|
+
const baseName = name.replace(/\.(?:liquid|html)$/i, "");
|
|
6245
|
+
const liquidPath = `${directory}/${baseName}.liquid`;
|
|
6246
|
+
return hasFile(fileBuffers, liquidPath) ? liquidPath : `${directory}/${baseName}.html`;
|
|
6247
|
+
};
|
|
6248
|
+
var getLiquidThemeReachableBuffers = (fileBuffers = {}, selectedTemplate) => {
|
|
6249
|
+
const reachable = {};
|
|
6250
|
+
if (!selectedTemplate || !hasFile(fileBuffers, selectedTemplate)) return reachable;
|
|
6251
|
+
let template = {};
|
|
6252
|
+
try {
|
|
6253
|
+
template = JSON.parse(fileBuffers[selectedTemplate] || "{}");
|
|
6254
|
+
} catch {
|
|
6255
|
+
template = {};
|
|
6256
|
+
}
|
|
6257
|
+
const layoutName = typeof template.layout === "string" && template.layout !== "none" ? template.layout : "theme";
|
|
6258
|
+
const pending = [
|
|
6259
|
+
selectedTemplate,
|
|
6260
|
+
liquidThemeConfigFilePaths.settingsData,
|
|
6261
|
+
resolveMarkupPath(fileBuffers, liquidThemeFolderNames.layout, layoutName)
|
|
6262
|
+
];
|
|
6263
|
+
for (const section of Object.values(template.sections || {})) {
|
|
6264
|
+
if (typeof section?.type === "string") pending.push(resolveMarkupPath(fileBuffers, liquidThemeFolderNames.sections, section.type));
|
|
6265
|
+
}
|
|
6266
|
+
while (pending.length) {
|
|
6267
|
+
const path = pending.pop();
|
|
6268
|
+
if (path in reachable || !hasFile(fileBuffers, path)) continue;
|
|
6269
|
+
const content = fileBuffers[path] || "";
|
|
6270
|
+
reachable[path] = content;
|
|
6271
|
+
for (const match of content.matchAll(markupReferencePattern)) {
|
|
6272
|
+
const directory = match[1].toLowerCase() === "section" ? liquidThemeFolderNames.sections : liquidThemeFolderNames.snippets;
|
|
6273
|
+
pending.push(resolveMarkupPath(fileBuffers, directory, match[2]));
|
|
6274
|
+
}
|
|
6275
|
+
}
|
|
6276
|
+
return reachable;
|
|
6277
|
+
};
|
|
6278
|
+
var requiresCurrentEntry = (query) => query.relationTarget === "current" || query.excludeCurrent === true;
|
|
6279
|
+
var getLiquidThemeEntityQueries = (fileBuffers = {}, selectedTemplate) => {
|
|
6280
|
+
const source = getLiquidThemeEntitySources(fileBuffers, selectedTemplate).join("\n");
|
|
6281
|
+
const queries = /* @__PURE__ */ new Map();
|
|
6282
|
+
for (const match of source.matchAll(liquidEntityQueryPattern)) {
|
|
6283
|
+
const query = { type: match[1], handle: match[2] };
|
|
6284
|
+
for (const option of match[3].matchAll(liquidEntityQueryOptionPattern)) {
|
|
6285
|
+
const key2 = option[1];
|
|
6286
|
+
const value = option[2] ?? option[3] ?? option[4];
|
|
6287
|
+
if (key2 === "as") {
|
|
6288
|
+
query.as = value;
|
|
6289
|
+
} else if (key2 === queryKeys.page || key2 === queryKeys.limit) {
|
|
6290
|
+
const numberValue = Number(value);
|
|
6291
|
+
if (!Number.isInteger(numberValue) || numberValue <= 0) throw new Error(`Invalid entityQuery declaration: ${key2} must be a positive integer.`);
|
|
6292
|
+
query[key2] = numberValue;
|
|
6293
|
+
} else if (key2 === queryKeys.populate) {
|
|
6294
|
+
query.populate = value === "true" || value === "false" ? value === "true" : value;
|
|
6295
|
+
} else if (key2 === queryKeys.fields) {
|
|
6296
|
+
if (value.length > 1024 || !/^[a-zA-Z][a-zA-Z0-9]*(,[a-zA-Z][a-zA-Z0-9]*)*$/.test(value)) {
|
|
6297
|
+
throw new Error(`Invalid entityQuery declaration: ${key2} is invalid.`);
|
|
6298
|
+
}
|
|
6299
|
+
query.fields = value;
|
|
6300
|
+
} else if (key2 === queryKeys.themeSortBy) {
|
|
6301
|
+
query.sortBy = value;
|
|
6302
|
+
} else if (key2 === queryKeys.themeSortOrder && (value === "asc" || value === "desc")) {
|
|
6303
|
+
query.sortOrder = value;
|
|
6304
|
+
} else if (key2 === queryKeys.relationField) {
|
|
6305
|
+
query.relationField = value;
|
|
6306
|
+
} else if (key2 === queryKeys.relationTarget && value === "current") {
|
|
6307
|
+
query.relationTarget = "current";
|
|
6308
|
+
} else if (key2 === queryKeys.excludeCurrent && (value === "true" || value === "false")) {
|
|
6309
|
+
query.excludeCurrent = value === "true";
|
|
6310
|
+
} else {
|
|
6311
|
+
throw new Error(`Invalid entityQuery declaration: unsupported option '${key2}'.`);
|
|
6312
|
+
}
|
|
6313
|
+
}
|
|
6314
|
+
if (!/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(query.type) || !/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(query.handle)) {
|
|
6315
|
+
throw new Error("Invalid entityQuery declaration: type and handle are invalid.");
|
|
6316
|
+
}
|
|
6317
|
+
if (query.as !== void 0 && !/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(query.as)) {
|
|
6318
|
+
throw new Error("Invalid entityQuery declaration: alias is invalid.");
|
|
6319
|
+
}
|
|
6320
|
+
if (query.sortOrder !== void 0 && !["asc", "desc"].includes(query.sortOrder)) {
|
|
6321
|
+
throw new Error("Invalid entityQuery declaration: sortOrder must be asc or desc.");
|
|
6322
|
+
}
|
|
6323
|
+
if (query.relationField === void 0 !== (query.relationTarget === void 0)) {
|
|
6324
|
+
throw new Error("Invalid entityQuery declaration: relationField and relationTarget must be provided together.");
|
|
6325
|
+
}
|
|
6326
|
+
if (query.relationField !== void 0 && !/^[a-z][a-zA-Z0-9]*$/.test(query.relationField)) {
|
|
6327
|
+
throw new Error("Invalid entityQuery declaration: relationField is invalid.");
|
|
6328
|
+
}
|
|
6329
|
+
const key = getThemeEntityQueryKey(query);
|
|
6330
|
+
const existing = queries.get(key);
|
|
6331
|
+
const canonicalQuery = (value) => JSON.stringify(
|
|
6332
|
+
Object.fromEntries(Object.entries(value).sort(([left], [right]) => left.localeCompare(right)))
|
|
6333
|
+
);
|
|
6334
|
+
if (existing && canonicalQuery(existing) !== canonicalQuery(query)) {
|
|
6335
|
+
throw new Error(`Multiple entityQuery declarations target '${query.type}.${query.handle}' with the same result key. Add distinct 'as' aliases.`);
|
|
6336
|
+
}
|
|
6337
|
+
queries.set(key, query);
|
|
6338
|
+
}
|
|
6339
|
+
const addBindingQueries = (value) => {
|
|
6340
|
+
if (!value || typeof value !== "object") return;
|
|
6341
|
+
const binding = value;
|
|
6342
|
+
if (binding.source === themeEntityBindingSource && typeof binding.entityType === "string" && typeof binding.handle === "string") {
|
|
6343
|
+
const query = { type: binding.entityType, handle: binding.handle };
|
|
6344
|
+
const key = getThemeEntityQueryKey(query);
|
|
6345
|
+
if (!queries.has(key)) queries.set(key, query);
|
|
6346
|
+
}
|
|
6347
|
+
Object.values(binding).forEach(addBindingQueries);
|
|
6348
|
+
};
|
|
6349
|
+
try {
|
|
6350
|
+
addBindingQueries(JSON.parse(fileBuffers[selectedTemplate || ""] || "{}"));
|
|
6351
|
+
addBindingQueries(JSON.parse(fileBuffers[liquidThemeConfigFilePaths.settingsData] || "{}"));
|
|
6352
|
+
} catch {
|
|
6353
|
+
}
|
|
6354
|
+
return [...queries.values()];
|
|
6355
|
+
};
|
|
6356
|
+
var getLiquidThemeCollectionHandles = (fileBuffers = {}, selectedTemplate) => {
|
|
6357
|
+
let template;
|
|
6358
|
+
try {
|
|
6359
|
+
template = JSON.parse(fileBuffers[selectedTemplate || ""] || "{}");
|
|
6360
|
+
} catch {
|
|
6361
|
+
return [];
|
|
6362
|
+
}
|
|
6363
|
+
const handles = /* @__PURE__ */ new Set();
|
|
6364
|
+
for (const section of Object.values(template.sections || {})) {
|
|
6365
|
+
const sectionSchema = extractSectionSchema(fileBuffers[`sections/${section?.type || ""}${themeFileExtensions.liquid}`] || "");
|
|
6366
|
+
for (const setting of sectionSchema?.settings || []) {
|
|
6367
|
+
if (setting.type !== themeSettingTypeConstants.collection) continue;
|
|
6368
|
+
const handle = section.settings?.[setting.id];
|
|
6369
|
+
if (typeof handle === "string" && handle.trim()) handles.add(handle.trim());
|
|
6370
|
+
}
|
|
6371
|
+
for (const blockSchema of sectionSchema?.blocks || []) {
|
|
6372
|
+
for (const setting of blockSchema.settings || []) {
|
|
6373
|
+
if (setting.type !== themeSettingTypeConstants.collection) continue;
|
|
6374
|
+
for (const block of Object.values(section.blocks || {})) {
|
|
6375
|
+
if (block?.type !== blockSchema.type) continue;
|
|
6376
|
+
const handle = block.settings?.[setting.id];
|
|
6377
|
+
if (typeof handle === "string" && handle.trim()) handles.add(handle.trim());
|
|
6378
|
+
}
|
|
6379
|
+
}
|
|
6380
|
+
}
|
|
6381
|
+
}
|
|
6382
|
+
return [...handles].slice(0, 20);
|
|
6383
|
+
};
|
|
6384
|
+
var getLiquidThemeTemplateCategory = (path) => {
|
|
6385
|
+
if (path === liquidThemeTemplatePaths.index) return themeTemplateCategoryKeys.pages;
|
|
6386
|
+
if (path === liquidThemeTemplatePaths.collection) return themeTemplateCategoryKeys.collections;
|
|
6387
|
+
if (path === liquidThemeTemplatePaths.entityDetails) return themeTemplateCategoryKeys.details;
|
|
6388
|
+
if (path === liquidThemeTemplatePaths.notFound) return themeTemplateCategoryKeys.system;
|
|
6389
|
+
for (const category of Object.keys(themeTemplateCategories)) {
|
|
6390
|
+
const prefix = themeTemplateCategories[category].prefix;
|
|
6391
|
+
if (!prefix) continue;
|
|
6392
|
+
const categoryPrefix = `${liquidThemeFolderNames.templates}/${prefix}`;
|
|
6393
|
+
const name = path.startsWith(categoryPrefix) ? path.slice(categoryPrefix.length) : "";
|
|
6394
|
+
if (/^[a-z0-9][a-z0-9_-]*\.json$/.test(name)) return category;
|
|
6395
|
+
}
|
|
6396
|
+
return null;
|
|
6397
|
+
};
|
|
6398
|
+
var resolveMarkupKey = (fileBuffers, directory, name) => {
|
|
6399
|
+
const baseName = [themeFileExtensions.liquid, themeFileExtensions.html].reduce((value, extension) => value.toLowerCase().endsWith(extension) ? value.slice(0, -extension.length) : value, name);
|
|
6400
|
+
const liquidPath = `${directory}/${baseName}${themeFileExtensions.liquid}`;
|
|
6401
|
+
const htmlPath = `${directory}/${baseName}${themeFileExtensions.html}`;
|
|
6402
|
+
return fileBuffers[liquidPath] !== void 0 ? liquidPath : fileBuffers[htmlPath] !== void 0 ? htmlPath : liquidPath;
|
|
6403
|
+
};
|
|
6404
|
+
var sectionKey = (fileBuffers, name) => resolveMarkupKey(fileBuffers, "sections", name);
|
|
6405
|
+
var layoutKey = (fileBuffers, name) => resolveMarkupKey(fileBuffers, "layout", name);
|
|
6406
|
+
var parseJson = (raw2, fallback2) => {
|
|
6407
|
+
if (!raw2) return fallback2;
|
|
6408
|
+
try {
|
|
6409
|
+
return JSON.parse(raw2);
|
|
6410
|
+
} catch {
|
|
6411
|
+
return fallback2;
|
|
6412
|
+
}
|
|
6413
|
+
};
|
|
6414
|
+
var resolveTemplatePath = (fileBuffers, templatePath) => {
|
|
6415
|
+
if (fileBuffers[templatePath]) return templatePath;
|
|
6416
|
+
const keys = Object.keys(fileBuffers);
|
|
6417
|
+
return keys.find((k) => k === defaultTemplate) || keys.find((k) => k.startsWith("templates/")) || keys.find((k) => k.startsWith("sections/")) || templatePath;
|
|
6418
|
+
};
|
|
6419
|
+
var previewBridgeScript = `
|
|
6420
|
+
<script>
|
|
6421
|
+
window.cms = window.cms || { theme: { name: 'Theme' } };
|
|
6422
|
+
|
|
6423
|
+
if (!window.__cmsPreviewBridge) {
|
|
6424
|
+
window.__cmsPreviewBridge = true;
|
|
6425
|
+
document.addEventListener('click', function(e) {
|
|
6426
|
+
var linkEl = e.target.closest('a[href]');
|
|
6427
|
+
var href = linkEl ? linkEl.getAttribute('href') || '' : '';
|
|
6428
|
+
|
|
6429
|
+
// Links must not navigate the preview frame: the editor would keep editing a page that is no longer shown.
|
|
6430
|
+
if (linkEl && href.charAt(0) !== '#' && !/^(mailto:|tel:|javascript:)/i.test(href)) {
|
|
6431
|
+
e.preventDefault();
|
|
6432
|
+
|
|
6433
|
+
if (href.indexOf('http://') === 0 || href.indexOf('https://') === 0) {
|
|
6434
|
+
window.open(href, '_blank', 'noopener');
|
|
6435
|
+
} else {
|
|
6436
|
+
window.parent.postMessage({ type: '${themePostMessageEvents.navigate}', href: href }, '*');
|
|
6437
|
+
}
|
|
6438
|
+
|
|
6439
|
+
return;
|
|
6440
|
+
}
|
|
6441
|
+
|
|
6442
|
+
var blockEl = e.target.closest('[data-editor-block]');
|
|
6443
|
+
var sectionEl = e.target.closest('[data-section-id]');
|
|
6444
|
+
|
|
6445
|
+
if (sectionEl) {
|
|
6446
|
+
var sectionId = sectionEl.getAttribute('data-section-id');
|
|
6447
|
+
var blockId = blockEl ? blockEl.getAttribute('data-editor-block') : null;
|
|
6448
|
+
|
|
6449
|
+
window.parent.postMessage({
|
|
6450
|
+
type: '${themePostMessageEvents.select}',
|
|
6451
|
+
sectionId: sectionId,
|
|
6452
|
+
blockId: blockId
|
|
6453
|
+
}, '*');
|
|
6454
|
+
}
|
|
6455
|
+
}, true);
|
|
6456
|
+
}
|
|
6457
|
+
</script>
|
|
6458
|
+
`;
|
|
6459
|
+
var FORBIDDEN_CSS_PATTERNS = [/<\/style/gi, /@import[^;]*;?/gi];
|
|
6460
|
+
var sanitizeCustomCss = (css) => {
|
|
6461
|
+
if (!css) return "";
|
|
6462
|
+
let sanitized = css;
|
|
6463
|
+
let previous = "";
|
|
6464
|
+
while (sanitized !== previous) {
|
|
6465
|
+
previous = sanitized;
|
|
6466
|
+
FORBIDDEN_CSS_PATTERNS.forEach((pattern) => {
|
|
6467
|
+
sanitized = sanitized.replace(pattern, "");
|
|
6468
|
+
});
|
|
6469
|
+
}
|
|
6470
|
+
return sanitized;
|
|
6471
|
+
};
|
|
6472
|
+
var normalizeAssetName = (value) => value.replace(/^\/+/, "").replace(liquidAssetUrlPatterns.themeAssetPrefix, "");
|
|
6473
|
+
var normalizeLiquidAssetValue = (value) => String(value || "").trim();
|
|
6474
|
+
var isExternalLiquidAssetUrl = (value) => themeAssetUrlPatterns.safeExternalUrl.test(value) || themeAssetUrlPatterns.safeDataUrl.test(value);
|
|
6475
|
+
var isGalleryLiquidAssetUrl = (value) => {
|
|
6476
|
+
const normalized = normalizeLiquidAssetValue(value);
|
|
6477
|
+
return normalized.startsWith("/uploads/") || normalized.startsWith("uploads/");
|
|
6478
|
+
};
|
|
6479
|
+
var keepMediaUrl = (value) => String(value || "").trim();
|
|
6480
|
+
var resolveLiquidAssetUrl = (value, options = {}) => {
|
|
6481
|
+
const normalized = normalizeLiquidAssetValue(value);
|
|
6482
|
+
if (!normalized) return "";
|
|
6483
|
+
if (isExternalLiquidAssetUrl(normalized)) return normalized;
|
|
6484
|
+
if (normalized.startsWith("/") || isGalleryLiquidAssetUrl(normalized)) return (options.resolveMediaUrl ?? keepMediaUrl)(normalized);
|
|
6485
|
+
const assetName = normalizeAssetName(normalized);
|
|
6486
|
+
const mappedUrl = options.themeAssetUrls?.get(assetName);
|
|
6487
|
+
return mappedUrl || "";
|
|
6488
|
+
};
|
|
6489
|
+
var sanitizeContent = (value, key = "") => {
|
|
6490
|
+
if (Array.isArray(value)) return value.map((item) => sanitizeContent(item, key));
|
|
6491
|
+
if (value && typeof value === "object") {
|
|
6492
|
+
return Object.fromEntries(Object.entries(value).map(([childKey, childValue]) => [childKey, sanitizeContent(childValue, childKey)]));
|
|
6493
|
+
}
|
|
6494
|
+
if (typeof value !== "string") return value;
|
|
6495
|
+
if (/^(url|href|src|action|link)$/i.test(key) && /^\s*javascript:/i.test(value)) return "#";
|
|
6496
|
+
return value.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, "").replace(/\son\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, "").replace(/javascript\s*:/gi, "");
|
|
6497
|
+
};
|
|
6498
|
+
var localizeLinkTargets = (targets, localization) => targets && Object.fromEntries(
|
|
6499
|
+
targets && Object.entries(targets)?.map(([key, target]) => [
|
|
6500
|
+
key,
|
|
6501
|
+
target.external || !target.available ? target : { ...target, url: localizeStorefrontUrl(target.url, localization) }
|
|
6502
|
+
])
|
|
6503
|
+
);
|
|
6504
|
+
function buildStorefrontDropsContext(rawCmsData) {
|
|
6505
|
+
const { entities = {}, forms = {}, settings = {}, routes = {}, page, collection, contentCollections = {}, linkTargets = {}, localization, search: search2 = { results: [], terms: "", performed: false }, contentLoading = false, contentError } = rawCmsData;
|
|
6506
|
+
const safeEntities = sanitizeContent(entities);
|
|
6507
|
+
const safeForms = sanitizeContent(forms);
|
|
6508
|
+
const formsProxy = new Proxy(safeForms, {
|
|
6509
|
+
get(target, prop) {
|
|
6510
|
+
if (typeof prop !== "string") return void 0;
|
|
6511
|
+
return target[prop] || { handle: prop, name: prop };
|
|
6512
|
+
}
|
|
6513
|
+
});
|
|
6514
|
+
return {
|
|
6515
|
+
settings: sanitizeContent(settings),
|
|
6516
|
+
routes: localizeStorefrontRoutes(routes, localization),
|
|
6517
|
+
...page ? { page: sanitizeContent(page) } : {},
|
|
6518
|
+
...collection ? { collection: sanitizeContent(collection) } : {},
|
|
6519
|
+
contentCollections: sanitizeContent(contentCollections),
|
|
6520
|
+
linkTargets: localizeLinkTargets(linkTargets, localization),
|
|
6521
|
+
...localization ? { localization: sanitizeContent(localization) } : {},
|
|
6522
|
+
search: sanitizeContent(search2),
|
|
6523
|
+
entities: safeEntities,
|
|
6524
|
+
forms: formsProxy,
|
|
6525
|
+
contentLoading,
|
|
6526
|
+
contentError
|
|
6527
|
+
};
|
|
6528
|
+
}
|
|
6529
|
+
var trustedHtml = /* @__PURE__ */ new WeakSet();
|
|
6530
|
+
var asTrustedHtml = (html) => {
|
|
6531
|
+
const value = { toString: () => html };
|
|
6532
|
+
trustedHtml.add(value);
|
|
6533
|
+
return value;
|
|
6534
|
+
};
|
|
6535
|
+
var publicValue = (value, depth = 0, seen = /* @__PURE__ */ new WeakSet()) => {
|
|
6536
|
+
if (value && typeof value === "object" && trustedHtml.has(value)) return value;
|
|
6537
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return value;
|
|
6538
|
+
if (typeof value === "number") return Number.isFinite(value) ? value : null;
|
|
6539
|
+
if (!value || typeof value !== "object" || depth >= maxContextDepth || seen.has(value)) return null;
|
|
6540
|
+
seen.add(value);
|
|
6541
|
+
try {
|
|
6542
|
+
if (Array.isArray(value)) return value.slice(0, maxContextArray).map((child) => publicValue(child, depth + 1, seen));
|
|
6543
|
+
if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) return null;
|
|
6544
|
+
return Object.fromEntries(Object.entries(value).slice(0, maxContextKeys).filter(([key]) => !privateField.test(key)).map(([key, child]) => [key, publicValue(child, depth + 1, seen)]));
|
|
6545
|
+
} finally {
|
|
6546
|
+
seen.delete(value);
|
|
6547
|
+
}
|
|
6548
|
+
};
|
|
6549
|
+
var publicContext = (context = {}) => Object.fromEntries(
|
|
6550
|
+
Object.entries(context).filter(([key]) => publicContextKeys.has(key)).map(([key, value]) => [key, publicValue(value)])
|
|
6551
|
+
);
|
|
6552
|
+
var escapeHtml = (value) => String(value ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
6553
|
+
var containsLiquidExpression = (value) => /\{[{%]/.test(value);
|
|
6554
|
+
var buildBlockList = (sectionBlocks, blockOrder) => blockOrder.filter((id) => !(0, import_get.default)(sectionBlocks, `${id}.disabled`)).map((id) => ({
|
|
6555
|
+
id,
|
|
6556
|
+
type: (0, import_get.default)(sectionBlocks, `${id}.type`, "block"),
|
|
6557
|
+
settings: (0, import_get.default)(sectionBlocks, `${id}.settings`, {}),
|
|
6558
|
+
attributes: `data-editor-block="${id}"`
|
|
6559
|
+
}));
|
|
6560
|
+
var buildCustomCssBlock = (sectionId, customCss) => {
|
|
6561
|
+
if (typeof customCss !== "string") return "";
|
|
6562
|
+
const css = sanitizeCustomCss(customCss);
|
|
6563
|
+
if (!css.trim()) return "";
|
|
6564
|
+
return `
|
|
6565
|
+
<style data-section-custom-css="${sectionId}">
|
|
6566
|
+
#cms-section-${sectionId} {
|
|
6567
|
+
${css}
|
|
6568
|
+
}
|
|
6569
|
+
</style>`;
|
|
6570
|
+
};
|
|
6571
|
+
var templateErrorHtml = (path) => `<div style="padding: 24px; color: #dc2626; font-family: sans-serif;"><h3>Template Error</h3><p>Could not parse template: <code>${escapeHtml(path)}</code></p></div>`;
|
|
6572
|
+
var collectDefaults = (items) => Object.fromEntries(
|
|
6573
|
+
items.map((setting) => ({
|
|
6574
|
+
id: setting?.id || setting?.key || setting?.name,
|
|
6575
|
+
value: setting?.default !== void 0 ? setting.default : setting?.settings?.defaultValue
|
|
6576
|
+
})).filter((setting) => setting.id && setting.value !== void 0).map((setting) => [setting.id, setting.value])
|
|
6577
|
+
);
|
|
6578
|
+
function preprocessLiquidTemplate(content) {
|
|
6579
|
+
if (!content) return "";
|
|
6580
|
+
return content.replace(
|
|
6581
|
+
/\{\{\s*([^|{}]+?)\s*\?\s*([^|{}]+?)\s*:\s*([^|{}]+?)\s*\}\}/g,
|
|
6582
|
+
(_, cond, trueVal, falseVal) => `{% if ${cond.trim()} %}{{ ${trueVal.trim()} }}{% else %}{{ ${falseVal.trim()} }}{% endif %}`
|
|
6583
|
+
);
|
|
6584
|
+
}
|
|
6585
|
+
function stripSectionSchema(content) {
|
|
6586
|
+
if (!content) return "";
|
|
6587
|
+
return blockTagPatterns.reduce((result, pattern) => result.replace(pattern, ""), preprocessLiquidTemplate(content));
|
|
6588
|
+
}
|
|
6589
|
+
var getSchemaDefaults = (rawSectionCode) => {
|
|
6590
|
+
const schema = extractSectionSchema(rawSectionCode);
|
|
6591
|
+
return collectDefaults(Array.isArray(schema?.settings) ? schema.settings : []);
|
|
6592
|
+
};
|
|
6593
|
+
var getSavedSectionSettings = (fileBuffers, sectionName) => {
|
|
6594
|
+
const data = parseJson(fileBuffers[liquidThemeConfigFilePaths.settingsData], {});
|
|
6595
|
+
return (0, import_get2.default)(data, `current.sections.${sectionName}.settings`, {});
|
|
6596
|
+
};
|
|
6597
|
+
var resolveSectionSettings = (fileBuffers, sectionName, rawSectionCode, activeSettings = {}) => ({
|
|
6598
|
+
...getSchemaDefaults(rawSectionCode),
|
|
6599
|
+
...getSavedSectionSettings(fileBuffers, sectionName),
|
|
6600
|
+
...activeSettings
|
|
6601
|
+
});
|
|
6602
|
+
var buildSectionScope = (context, sectionName, settings) => {
|
|
6603
|
+
const active = context.section || {};
|
|
6604
|
+
return {
|
|
6605
|
+
...context,
|
|
6606
|
+
section: {
|
|
6607
|
+
id: active.id || sectionName,
|
|
6608
|
+
type: active.type || sectionName,
|
|
6609
|
+
settings: resolveEntityBindings(settings, context),
|
|
6610
|
+
blocks: active.blocks || []
|
|
6611
|
+
}
|
|
6612
|
+
};
|
|
6613
|
+
};
|
|
6614
|
+
var getSettingsSchemaDefaults = (fileBuffers) => {
|
|
6615
|
+
const groups = parseJson(fileBuffers[liquidThemeConfigFilePaths.settingsSchema], []);
|
|
6616
|
+
if (!Array.isArray(groups)) return {};
|
|
6617
|
+
return collectDefaults(groups.flatMap((g) => Array.isArray(g?.settings) ? g.settings : []));
|
|
6618
|
+
};
|
|
6619
|
+
var loadGlobalSettings = (fileBuffers, contextSettings = {}) => {
|
|
6620
|
+
const saved = parseJson(fileBuffers[liquidThemeConfigFilePaths.settingsData], {});
|
|
6621
|
+
return {
|
|
6622
|
+
...getSettingsSchemaDefaults(fileBuffers),
|
|
6623
|
+
...contextSettings,
|
|
6624
|
+
...saved.current || {}
|
|
6625
|
+
};
|
|
6626
|
+
};
|
|
6627
|
+
var resolveEntityBindings = (value, context) => {
|
|
6628
|
+
if (Array.isArray(value)) return value.map((item) => resolveEntityBindings(item, context));
|
|
6629
|
+
if (!value || typeof value !== "object") return value;
|
|
6630
|
+
const linkTargetKey = getThemeLinkTargetReferenceKey(value);
|
|
6631
|
+
if (linkTargetKey) {
|
|
6632
|
+
return context.linkTargets?.[linkTargetKey] ?? {
|
|
6633
|
+
url: "",
|
|
6634
|
+
title: "",
|
|
6635
|
+
external: false,
|
|
6636
|
+
available: false
|
|
6637
|
+
};
|
|
6638
|
+
}
|
|
6639
|
+
if (value.source === themeEntityBindingSource && value.entityType && value.handle) {
|
|
6640
|
+
const entity = context.entities?.[value.entityType]?.[value.handle];
|
|
6641
|
+
const resolvedEntity = entity?.kind === entityKinds.collection ? entity.items : entity?.item;
|
|
6642
|
+
if (!value.field) return resolvedEntity;
|
|
6643
|
+
if (typeof value.field !== "string" || value.field.split(".").some((segment) => privateField.test(segment))) return "";
|
|
6644
|
+
if (Array.isArray(entity?.items)) return entity.items.map((item) => (0, import_get2.default)(item, value.field, ""));
|
|
6645
|
+
return (0, import_get2.default)(resolvedEntity, value.field, "");
|
|
6646
|
+
}
|
|
6647
|
+
return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, resolveEntityBindings(child, context)]));
|
|
6648
|
+
};
|
|
6649
|
+
var richtextAllowedTags = [
|
|
6650
|
+
"p",
|
|
6651
|
+
"br",
|
|
6652
|
+
"strong",
|
|
6653
|
+
"b",
|
|
6654
|
+
"em",
|
|
6655
|
+
"i",
|
|
6656
|
+
"u",
|
|
6657
|
+
"a",
|
|
6658
|
+
"ul",
|
|
6659
|
+
"ol",
|
|
6660
|
+
"li",
|
|
6661
|
+
"h1",
|
|
6662
|
+
"h2",
|
|
6663
|
+
"h3",
|
|
6664
|
+
"h4",
|
|
6665
|
+
"h5",
|
|
6666
|
+
"h6",
|
|
6667
|
+
"blockquote",
|
|
6668
|
+
"img",
|
|
6669
|
+
"figure",
|
|
6670
|
+
"figcaption",
|
|
6671
|
+
"span",
|
|
6672
|
+
"div",
|
|
6673
|
+
"hr"
|
|
6674
|
+
];
|
|
6675
|
+
var richtextSanitizeOptions = {
|
|
6676
|
+
allowedTags: richtextAllowedTags,
|
|
6677
|
+
allowedAttributes: {
|
|
6678
|
+
a: ["href", "rel", "target"],
|
|
6679
|
+
img: ["src", "alt"]
|
|
6680
|
+
},
|
|
6681
|
+
allowedSchemes: ["http", "https", "mailto"],
|
|
6682
|
+
allowedSchemesAppliedToAttributes: ["href", "src"],
|
|
6683
|
+
allowProtocolRelative: false,
|
|
6684
|
+
nonTextTags: ["script", "style", "iframe", "textarea", "option"]
|
|
6685
|
+
};
|
|
6686
|
+
var sanitizeRichtext = (html) => {
|
|
6687
|
+
if (html === null || html === void 0) return "";
|
|
6688
|
+
return sanitizeHtml(String(html), richtextSanitizeOptions);
|
|
6689
|
+
};
|
|
4992
6690
|
var LOCALE_FILE_CANDIDATES = (locale) => {
|
|
4993
6691
|
const normalized = locale.trim().replace(/_/g, "-");
|
|
4994
6692
|
const baseLocale = normalized.split("-")[0];
|
|
@@ -5022,11 +6720,11 @@ var interpolate = (template, params) => Object.entries(params).reduce(
|
|
|
5022
6720
|
template
|
|
5023
6721
|
);
|
|
5024
6722
|
var createLiquidFilters = (options = {}) => {
|
|
5025
|
-
const { fileBuffers = {}, activeLocale = defaultLanguageCode } = options;
|
|
6723
|
+
const { fileBuffers = {}, activeLocale = defaultLanguageCode, resolveMediaUrl = keepMediaUrl } = options;
|
|
5026
6724
|
const localeDict = options.locales && Object.keys(options.locales).length > 0 ? options.locales : loadLocaleDict(fileBuffers, activeLocale);
|
|
5027
6725
|
const filters2 = {
|
|
5028
6726
|
t: (key, params = {}) => {
|
|
5029
|
-
const translation = (0,
|
|
6727
|
+
const translation = (0, import_get3.default)(localeDict, key, key);
|
|
5030
6728
|
if (typeof translation === "string" && params && typeof params === "object") {
|
|
5031
6729
|
return interpolate(translation, params);
|
|
5032
6730
|
}
|
|
@@ -5039,7 +6737,7 @@ var createLiquidFilters = (options = {}) => {
|
|
|
5039
6737
|
return "{}";
|
|
5040
6738
|
}
|
|
5041
6739
|
},
|
|
5042
|
-
imageUrl: (url, _size) =>
|
|
6740
|
+
imageUrl: (url, _size) => resolveMediaUrl(url),
|
|
5043
6741
|
richtext: (html) => asTrustedHtml(sanitizeRichtext(html)),
|
|
5044
6742
|
localizeUrl: (url) => {
|
|
5045
6743
|
const value = String(url || "/");
|
|
@@ -5048,7 +6746,7 @@ var createLiquidFilters = (options = {}) => {
|
|
|
5048
6746
|
};
|
|
5049
6747
|
return filters2;
|
|
5050
6748
|
};
|
|
5051
|
-
function createLiquidEngine(fileBuffers, customFilters = {}, assetBaseUrl = "",
|
|
6749
|
+
function createLiquidEngine(fileBuffers, customFilters = {}, assetBaseUrl = "", inlineThemeStyles = false, inlineThemeScripts = false, configuredThemeAssetUrls = {}, resolveMediaUrl = keepMediaUrl) {
|
|
5052
6750
|
const packageChars = Object.values(fileBuffers).reduce((total, content) => total + content.length, 0);
|
|
5053
6751
|
if (packageChars > maxPackageChars) throw new Error("Liquid theme package exceeds the render limit");
|
|
5054
6752
|
const startedAt = performance.now();
|
|
@@ -5131,12 +6829,12 @@ function createLiquidEngine(fileBuffers, customFilters = {}, assetBaseUrl = "",
|
|
|
5131
6829
|
Object.entries(fileBuffers).filter(([path, value]) => {
|
|
5132
6830
|
const normalized = normalizeLiquidAssetValue(value);
|
|
5133
6831
|
return path.startsWith("assets/") && (isExternalLiquidAssetUrl(normalized) || isGalleryLiquidAssetUrl(normalized));
|
|
5134
|
-
}).map(([path, value]) => [path.replace(/^assets\//, ""),
|
|
6832
|
+
}).map(([path, value]) => [path.replace(/^assets\//, ""), resolveMediaUrl(value)])
|
|
5135
6833
|
);
|
|
5136
6834
|
const previewThemeAssetUrls = new Map(
|
|
5137
6835
|
Object.keys(fileBuffers).filter((path) => path.startsWith("assets/")).map((path) => [path.replace(/^assets\//, ""), `assets/${path.replace(/^assets\//, "")}`])
|
|
5138
6836
|
);
|
|
5139
|
-
const configuredAssetUrls = new Map(Object.entries(configuredThemeAssetUrls).map(([path, url]) => [path,
|
|
6837
|
+
const configuredAssetUrls = new Map(Object.entries(configuredThemeAssetUrls).map(([path, url]) => [path, resolveMediaUrl(url)]));
|
|
5140
6838
|
const approvedAssetUrls = new Map([...previewThemeAssetUrls, ...storedThemeAssetUrls, ...configuredAssetUrls].map(([path, url]) => [url, path]));
|
|
5141
6839
|
const getApprovedAssetKey = (url) => {
|
|
5142
6840
|
const approvedPath = approvedAssetUrls.get(url) || "";
|
|
@@ -5145,7 +6843,8 @@ function createLiquidEngine(fileBuffers, customFilters = {}, assetBaseUrl = "",
|
|
|
5145
6843
|
engine2.registerFilter(
|
|
5146
6844
|
"assetUrl",
|
|
5147
6845
|
(fileName) => resolveLiquidAssetUrl(fileName, {
|
|
5148
|
-
themeAssetUrls: assetBaseUrl ? new Map([...storedThemeAssetUrls, ...configuredAssetUrls]) : new Map([...previewThemeAssetUrls, ...configuredAssetUrls])
|
|
6846
|
+
themeAssetUrls: assetBaseUrl ? new Map([...storedThemeAssetUrls, ...configuredAssetUrls]) : new Map([...previewThemeAssetUrls, ...configuredAssetUrls]),
|
|
6847
|
+
resolveMediaUrl
|
|
5149
6848
|
})
|
|
5150
6849
|
);
|
|
5151
6850
|
engine2.registerFilter("stylesheetTag", (url) => {
|
|
@@ -5244,20 +6943,20 @@ ${html}
|
|
|
5244
6943
|
if (templateContent.startsWith("{")) return { html: templateErrorHtml(resolvedPath), layoutName: defaultLayout };
|
|
5245
6944
|
return { html: await renderLiquid(templateContent, context), layoutName: defaultLayout };
|
|
5246
6945
|
}
|
|
5247
|
-
const layoutName = (0,
|
|
6946
|
+
const layoutName = (0, import_get4.default)(json2, "layout", defaultLayout);
|
|
5248
6947
|
if (typeof layoutName !== "string" || !isSafePartialName(layoutName)) throw new Error("Unsafe Liquid layout reference");
|
|
5249
|
-
const sectionsMap = (0,
|
|
5250
|
-
const order = (0,
|
|
6948
|
+
const sectionsMap = (0, import_get4.default)(json2, "sections", {});
|
|
6949
|
+
const order = (0, import_get4.default)(json2, "order", Object.keys(sectionsMap));
|
|
5251
6950
|
if (!Array.isArray(order) || order.length > maxIterations) throw new Error("Liquid section iteration limit exceeded");
|
|
5252
6951
|
const rendered = [];
|
|
5253
6952
|
for (const sectionId of order) {
|
|
5254
6953
|
checkDeadline();
|
|
5255
|
-
const def = (0,
|
|
6954
|
+
const def = (0, import_get4.default)(sectionsMap, sectionId, {});
|
|
5256
6955
|
if (def.disabled === true) continue;
|
|
5257
|
-
const sectionType = (0,
|
|
6956
|
+
const sectionType = (0, import_get4.default)(def, "type", sectionId);
|
|
5258
6957
|
if (typeof sectionId !== "string" || !isSafePartialName(sectionId) || typeof sectionType !== "string" || !isSafePartialName(sectionType)) throw new Error("Unsafe Liquid section identifier");
|
|
5259
|
-
const sectionBlocks = (0,
|
|
5260
|
-
const blockOrder = (0,
|
|
6958
|
+
const sectionBlocks = (0, import_get4.default)(def, "blocks", {});
|
|
6959
|
+
const blockOrder = (0, import_get4.default)(def, "blockOrder", Object.keys(sectionBlocks));
|
|
5261
6960
|
if (!Array.isArray(blockOrder) || blockOrder.length > maxIterations) throw new Error("Invalid Liquid block order");
|
|
5262
6961
|
const blocks = buildBlockList(sectionBlocks, blockOrder).map((block) => ({
|
|
5263
6962
|
...block,
|
|
@@ -5268,11 +6967,11 @@ ${html}
|
|
|
5268
6967
|
section: {
|
|
5269
6968
|
id: sectionId,
|
|
5270
6969
|
type: sectionType,
|
|
5271
|
-
settings: (0,
|
|
6970
|
+
settings: (0, import_get4.default)(def, "settings", {}),
|
|
5272
6971
|
blocks
|
|
5273
6972
|
}
|
|
5274
6973
|
});
|
|
5275
|
-
const cssBlock = buildCustomCssBlock(sectionId, (0,
|
|
6974
|
+
const cssBlock = buildCustomCssBlock(sectionId, (0, import_get4.default)(def, customCssKey, ""));
|
|
5276
6975
|
rendered.push(
|
|
5277
6976
|
`<div id="cms-section-${sectionId}" class="cms-section" data-section-id="${sectionId}" data-section-type="${sectionType}">${cssBlock}
|
|
5278
6977
|
${html}
|
|
@@ -5292,17 +6991,15 @@ ${html}
|
|
|
5292
6991
|
...routes ? { routes } : {}
|
|
5293
6992
|
}));
|
|
5294
6993
|
contextDrops.settings = publicValue(resolveEntityBindings(settings, contextDrops));
|
|
5295
|
-
const resolvedSettings = contextDrops.settings;
|
|
5296
6994
|
const { html: bodyHtml, layoutName } = await renderTemplate(templatePath, contextDrops);
|
|
5297
6995
|
const rawLayout = fileBuffers[layoutKey(fileBuffers, layoutName)] || "{{ contentForLayout }}";
|
|
5298
6996
|
const fullContext = {
|
|
5299
6997
|
...contextDrops,
|
|
5300
|
-
contentForHeader: asTrustedHtml(
|
|
6998
|
+
contentForHeader: asTrustedHtml(""),
|
|
5301
6999
|
contentForLayout: asTrustedHtml(bodyHtml),
|
|
5302
7000
|
pageTitle: safeContext.pageTitle || "CMS"
|
|
5303
7001
|
};
|
|
5304
|
-
|
|
5305
|
-
return chargeOutput(options.includePreviewChrome === false ? finalHtml : inlinePreviewAssets(finalHtml, fileBuffers));
|
|
7002
|
+
return chargeOutput(await renderLiquid(stripSectionSchema(rawLayout), fullContext));
|
|
5306
7003
|
};
|
|
5307
7004
|
return { engine: engine2, renderSection, renderSnippet, renderTemplate, renderThemeBundle };
|
|
5308
7005
|
}
|
|
@@ -5311,10 +7008,10 @@ async function renderLiquidThemeBundle(fileBuffers, options = {}) {
|
|
|
5311
7008
|
fileBuffers,
|
|
5312
7009
|
options.customFilters || {},
|
|
5313
7010
|
options.assetBaseUrl,
|
|
5314
|
-
options.includePreviewChrome !== false,
|
|
5315
7011
|
options.inlineThemeStyles,
|
|
5316
7012
|
options.inlineThemeScripts,
|
|
5317
|
-
options.themeAssetUrls
|
|
7013
|
+
options.themeAssetUrls,
|
|
7014
|
+
options.resolveMediaUrl
|
|
5318
7015
|
);
|
|
5319
7016
|
return liquidEngine.renderThemeBundle(options);
|
|
5320
7017
|
}
|
|
@@ -5487,159 +7184,21 @@ var renderStaticHtmlTheme = (theme) => {
|
|
|
5487
7184
|
return { html: `${extractedHead.html}${scripts.join("")}${body}`, stylesheets: extractedHead.stylesheets, documentHtml, documentTitle: title, languageCode, direction };
|
|
5488
7185
|
};
|
|
5489
7186
|
|
|
5490
|
-
// src/lib/dev/server-shared.ts
|
|
5491
|
-
import { readFile as readFile2 } from "fs/promises";
|
|
5492
|
-
import { createServer } from "http";
|
|
5493
|
-
import { extname as extname2, resolve as resolve2, sep as sep2 } from "path";
|
|
5494
|
-
var contentTypes = {
|
|
5495
|
-
".css": "text/css; charset=utf-8",
|
|
5496
|
-
".js": "application/javascript; charset=utf-8",
|
|
5497
|
-
".json": "application/json; charset=utf-8",
|
|
5498
|
-
".svg": "image/svg+xml",
|
|
5499
|
-
".txt": "text/plain; charset=utf-8",
|
|
5500
|
-
".png": "image/png",
|
|
5501
|
-
".jpg": "image/jpeg",
|
|
5502
|
-
".jpeg": "image/jpeg",
|
|
5503
|
-
".webp": "image/webp",
|
|
5504
|
-
".gif": "image/gif",
|
|
5505
|
-
".mp4": "video/mp4",
|
|
5506
|
-
".woff": "font/woff",
|
|
5507
|
-
".woff2": "font/woff2",
|
|
5508
|
-
".ttf": "font/ttf"
|
|
5509
|
-
};
|
|
5510
|
-
var reloadScript = [
|
|
5511
|
-
"<script>",
|
|
5512
|
-
"(function () {",
|
|
5513
|
-
' var source = new EventSource("/__events");',
|
|
5514
|
-
' source.addEventListener("reload", function () { location.reload(); });',
|
|
5515
|
-
"})();",
|
|
5516
|
-
"</script>"
|
|
5517
|
-
].join("\n");
|
|
5518
|
-
var injectReloadScript = (html) => {
|
|
5519
|
-
if (/<\/body>/i.test(html)) {
|
|
5520
|
-
return html.replace(/<\/body>/i, (tag) => `${reloadScript}${tag}`);
|
|
5521
|
-
}
|
|
5522
|
-
return `${html}${reloadScript}`;
|
|
5523
|
-
};
|
|
5524
|
-
var safeDecode = (value) => {
|
|
5525
|
-
try {
|
|
5526
|
-
return decodeURIComponent(value);
|
|
5527
|
-
} catch {
|
|
5528
|
-
return null;
|
|
5529
|
-
}
|
|
5530
|
-
};
|
|
5531
|
-
var escapeHtml2 = (value) => {
|
|
5532
|
-
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5533
|
-
};
|
|
5534
|
-
var sendResponse = (response, status, headers, body) => {
|
|
5535
|
-
response.writeHead(status, { ...headers, "Cache-Control": "no-store" });
|
|
5536
|
-
response.end(body);
|
|
5537
|
-
};
|
|
5538
|
-
var sendHtml = (response, status, html) => {
|
|
5539
|
-
sendResponse(response, status, { "Content-Type": "text/html; charset=utf-8" }, injectReloadScript(html));
|
|
5540
|
-
};
|
|
5541
|
-
var linkListHtml = (title, links) => {
|
|
5542
|
-
const items = links.map((link) => `<li><a href="${escapeHtml2(link.href)}">${escapeHtml2(link.label)}</a></li>`).join("");
|
|
5543
|
-
return `<!DOCTYPE html><html><head><meta charset="utf-8"><title>${escapeHtml2(title)}</title></head><body style="font-family:sans-serif;padding:32px;"><h1>${escapeHtml2(title)}</h1><ul>${items}</ul></body></html>`;
|
|
5544
|
-
};
|
|
5545
|
-
var notFoundHtml = (message) => {
|
|
5546
|
-
return `<!DOCTYPE html><html><body style="font-family:sans-serif;padding:32px;"><h2>Not found</h2><p>${escapeHtml2(message)}</p></body></html>`;
|
|
5547
|
-
};
|
|
5548
|
-
var renderErrorPage = (error) => {
|
|
5549
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
5550
|
-
const stack = error instanceof Error ? error.stack ?? "" : "";
|
|
5551
|
-
return `<!DOCTYPE html><html><body style="font-family:sans-serif;padding:32px;color:#dc2626;background:#fff1f2;"><h2 style="margin-top:0;">Theme Preview Rendering Error</h2><p style="color:#991b1b;">${escapeHtml2(message)}</p><pre style="background:#fee2e2;padding:16px;border-radius:8px;overflow:auto;">${escapeHtml2(stack)}</pre></body></html>`;
|
|
5552
|
-
};
|
|
5553
|
-
var serveFile = async (response, rootDir, encodedPath) => {
|
|
5554
|
-
const relativePath = safeDecode(encodedPath);
|
|
5555
|
-
const filePath = relativePath === null ? "" : resolve2(rootDir, relativePath);
|
|
5556
|
-
if (!filePath.startsWith(`${rootDir}${sep2}`)) {
|
|
5557
|
-
sendResponse(response, 404, { "Content-Type": "text/plain; charset=utf-8" }, "Not found");
|
|
5558
|
-
return;
|
|
5559
|
-
}
|
|
5560
|
-
try {
|
|
5561
|
-
const bytes = await readFile2(filePath);
|
|
5562
|
-
const contentType = contentTypes[extname2(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
5563
|
-
sendResponse(response, 200, { "Content-Type": contentType }, bytes);
|
|
5564
|
-
} catch {
|
|
5565
|
-
sendResponse(response, 404, { "Content-Type": "text/plain; charset=utf-8" }, "Not found");
|
|
5566
|
-
}
|
|
5567
|
-
};
|
|
5568
|
-
var createReloadHub = () => {
|
|
5569
|
-
const clients = /* @__PURE__ */ new Set();
|
|
5570
|
-
return {
|
|
5571
|
-
open: (request, response) => {
|
|
5572
|
-
response.writeHead(200, {
|
|
5573
|
-
"Content-Type": "text/event-stream",
|
|
5574
|
-
"Cache-Control": "no-cache",
|
|
5575
|
-
Connection: "keep-alive"
|
|
5576
|
-
});
|
|
5577
|
-
response.write("retry: 1000\n\n");
|
|
5578
|
-
clients.add(response);
|
|
5579
|
-
request.on("close", () => {
|
|
5580
|
-
clients.delete(response);
|
|
5581
|
-
});
|
|
5582
|
-
},
|
|
5583
|
-
broadcast: () => {
|
|
5584
|
-
for (const client of clients) {
|
|
5585
|
-
client.write("event: reload\ndata: 1\n\n");
|
|
5586
|
-
}
|
|
5587
|
-
},
|
|
5588
|
-
close: () => {
|
|
5589
|
-
for (const client of clients) {
|
|
5590
|
-
client.end();
|
|
5591
|
-
}
|
|
5592
|
-
clients.clear();
|
|
5593
|
-
}
|
|
5594
|
-
};
|
|
5595
|
-
};
|
|
5596
|
-
var createRouteServer = (route) => {
|
|
5597
|
-
return createServer((request, response) => {
|
|
5598
|
-
route(request, response).catch((error) => {
|
|
5599
|
-
if (!response.headersSent) {
|
|
5600
|
-
sendHtml(response, 500, renderErrorPage(error));
|
|
5601
|
-
}
|
|
5602
|
-
});
|
|
5603
|
-
});
|
|
5604
|
-
};
|
|
5605
|
-
var listenOnLocalhost = (server, port) => {
|
|
5606
|
-
return new Promise((resolveListen, rejectListen) => {
|
|
5607
|
-
server.once("error", (error) => {
|
|
5608
|
-
if (error.code === "EADDRINUSE") {
|
|
5609
|
-
rejectListen(new CliError(`Port ${port} is already in use. Pass --port <n>.`));
|
|
5610
|
-
return;
|
|
5611
|
-
}
|
|
5612
|
-
rejectListen(error);
|
|
5613
|
-
});
|
|
5614
|
-
server.listen(port, "localhost", () => {
|
|
5615
|
-
resolveListen();
|
|
5616
|
-
});
|
|
5617
|
-
});
|
|
5618
|
-
};
|
|
5619
|
-
var closeServer = (server, reload) => {
|
|
5620
|
-
reload.close();
|
|
5621
|
-
return new Promise((resolveClose) => {
|
|
5622
|
-
server.close(() => {
|
|
5623
|
-
resolveClose();
|
|
5624
|
-
});
|
|
5625
|
-
server.closeAllConnections();
|
|
5626
|
-
});
|
|
5627
|
-
};
|
|
5628
|
-
|
|
5629
7187
|
export {
|
|
7188
|
+
collectThemeLinkTargetReferences,
|
|
7189
|
+
rewriteLiquidThemeAssetBuffers,
|
|
7190
|
+
getThemeAssetUrls,
|
|
7191
|
+
createThemeMediaUrlResolver,
|
|
7192
|
+
ensureThemeStylesheetsBeforeContent,
|
|
7193
|
+
applyThemeCustomizerLocaleOverrides,
|
|
7194
|
+
getLiquidThemeEntitySources,
|
|
7195
|
+
getLiquidThemeReachableBuffers,
|
|
7196
|
+
requiresCurrentEntry,
|
|
7197
|
+
getLiquidThemeEntityQueries,
|
|
7198
|
+
getLiquidThemeCollectionHandles,
|
|
7199
|
+
getLiquidThemeTemplateCategory,
|
|
5630
7200
|
createLiquidFilters,
|
|
5631
7201
|
renderLiquidThemeBundle,
|
|
5632
|
-
renderStaticHtmlTheme
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
sendHtml,
|
|
5636
|
-
linkListHtml,
|
|
5637
|
-
notFoundHtml,
|
|
5638
|
-
renderErrorPage,
|
|
5639
|
-
serveFile,
|
|
5640
|
-
createReloadHub,
|
|
5641
|
-
createRouteServer,
|
|
5642
|
-
listenOnLocalhost,
|
|
5643
|
-
closeServer
|
|
5644
|
-
};
|
|
5645
|
-
//# sourceMappingURL=chunk-VDICVCKJ.js.map
|
|
7202
|
+
renderStaticHtmlTheme
|
|
7203
|
+
};
|
|
7204
|
+
//# sourceMappingURL=chunk-Z7WA4YHH.js.map
|