@swell/apps-sdk 1.0.186 → 1.0.187

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -3652,7 +3652,15 @@ function resolveSectionPresets(schema) {
3652
3652
  }, {}),
3653
3653
  ...preset.settings || void 0
3654
3654
  },
3655
- blocks: preset.blocks?.map((block) => {
3655
+ blocks: resolveSectionBlockPresets(preset, schema)
3656
+ }));
3657
+ }
3658
+ function resolveSectionBlockPresets(preset, schema) {
3659
+ if (!preset.blocks) {
3660
+ return;
3661
+ }
3662
+ if (Array.isArray(preset.blocks)) {
3663
+ return preset.blocks.map((block) => {
3656
3664
  const blockDef = schema.blocks?.find((b) => b.type === block.type);
3657
3665
  return blockDef ? {
3658
3666
  ...block,
@@ -3666,8 +3674,9 @@ function resolveSectionPresets(schema) {
3666
3674
  ...block.settings || void 0
3667
3675
  }
3668
3676
  } : block;
3669
- })
3670
- }));
3677
+ });
3678
+ }
3679
+ return Object.values(preset.blocks);
3671
3680
  }
3672
3681
  async function getLayoutSectionGroups(allSections, renderTemplateSchema) {
3673
3682
  const allSectionsList = Array.from(allSections.values());
@@ -3744,7 +3753,15 @@ async function getPageSections(sectionGroup, getSchema) {
3744
3753
  };
3745
3754
  const id = sectionGroup.id ? `page__${sectionGroup.id}__${key}` : schema.id;
3746
3755
  const blockOrder = Array.isArray(section.block_order) ? section.block_order : Object.keys(section.blocks || {});
3747
- const blocks = blockOrder.map((key2) => section.blocks?.[key2]).filter(Boolean);
3756
+ const blocks = blockOrder.map((key2) => {
3757
+ const block = section.blocks?.[key2];
3758
+ if (block) {
3759
+ return {
3760
+ ...block,
3761
+ id: `${schema.id}__${key2}`
3762
+ };
3763
+ }
3764
+ }).filter(Boolean);
3748
3765
  const settings = {
3749
3766
  section: {
3750
3767
  id,
@@ -5738,7 +5755,7 @@ function getAllSectionComponents(allSections) {
5738
5755
  // TODO: figure out how to make this work, doesn't work for collections normally
5739
5756
  defaultValue: section.presets?.reduce(
5740
5757
  (acc, preset, index) => {
5741
- if (!preset.blocks) {
5758
+ if (!preset.blocks || !Array.isArray(preset.blocks)) {
5742
5759
  return acc;
5743
5760
  }
5744
5761
  return preset.blocks.reduce(
@@ -5945,7 +5962,7 @@ function getAllSectionComponentTemplates(allSections) {
5945
5962
  custom_css: preset.settings?.["custom_css"] || "",
5946
5963
  ...processFields(section.fields, preset.settings),
5947
5964
  // Process blocks inside the preset
5948
- Blocks: (preset.blocks || []).map((block) => {
5965
+ Blocks: (Array.isArray(preset.blocks) ? preset.blocks : []).map((block) => {
5949
5966
  const blockSchema = section.blocks?.find(
5950
5967
  ({ type }) => type === block.type
5951
5968
  );
@@ -6405,11 +6422,11 @@ function getRandomId() {
6405
6422
  }
6406
6423
 
6407
6424
  // src/menus.ts
6408
- var import_lodash_es15 = require("lodash-es");
6425
+ var import_lodash_es17 = require("lodash-es");
6409
6426
 
6410
6427
  // src/theme.ts
6411
6428
  var import_json56 = __toESM(require("json5"), 1);
6412
- var import_lodash_es14 = require("lodash-es");
6429
+ var import_lodash_es16 = require("lodash-es");
6413
6430
 
6414
6431
  // src/compatibility/shopify.ts
6415
6432
  var import_lodash_es7 = require("lodash-es");
@@ -11704,16 +11721,16 @@ function ShopifyBlog(instance, blogCategory) {
11704
11721
  if (!Array.isArray(blogs?.results)) {
11705
11722
  return [];
11706
11723
  }
11707
- const set3 = blogs.results.reduce(
11708
- (set4, blog) => {
11724
+ const set4 = blogs.results.reduce(
11725
+ (set5, blog) => {
11709
11726
  for (const tag of blog.tags || []) {
11710
- set4.add(tag);
11727
+ set5.add(tag);
11711
11728
  }
11712
- return set4;
11729
+ return set5;
11713
11730
  },
11714
11731
  /* @__PURE__ */ new Set()
11715
11732
  );
11716
- return Array.from(set3.values());
11733
+ return Array.from(set4.values());
11717
11734
  });
11718
11735
  return new ShopifyResource({
11719
11736
  all_tags: allTags,
@@ -12097,18 +12114,18 @@ function ShopifyCollection(instance, category) {
12097
12114
  if (!resolved) {
12098
12115
  return [];
12099
12116
  }
12100
- const set3 = /* @__PURE__ */ new Set();
12117
+ const set4 = /* @__PURE__ */ new Set();
12101
12118
  await Promise.all(
12102
12119
  resolved.results.map(async (product) => {
12103
12120
  const tags2 = await Promise.resolve().then(() => product.tags);
12104
12121
  if (Array.isArray(tags2)) {
12105
12122
  for (const tag of tags2) {
12106
- set3.add(tag);
12123
+ set4.add(tag);
12107
12124
  }
12108
12125
  }
12109
12126
  })
12110
12127
  );
12111
- return Array.from(set3.values());
12128
+ return Array.from(set4.values());
12112
12129
  }),
12113
12130
  all_types: defer(async () => {
12114
12131
  const products = await resolveProducts();
@@ -14696,6 +14713,8 @@ ${injects.join("\n")}</script>`;
14696
14713
  return `templates/${this.getPageType(name)}`;
14697
14714
  case "sections":
14698
14715
  return `sections/${name}`;
14716
+ case "blocks":
14717
+ return `blocks/${name}`;
14699
14718
  default:
14700
14719
  throw new Error(`Theme file type not supported: ${type}`);
14701
14720
  }
@@ -14869,7 +14888,7 @@ var RenderDrop = class extends import_liquidjs15.Drop {
14869
14888
  };
14870
14889
 
14871
14890
  // src/liquid/index.ts
14872
- var import_liquidjs35 = require("liquidjs");
14891
+ var import_liquidjs40 = require("liquidjs");
14873
14892
 
14874
14893
  // src/utils/escape.ts
14875
14894
  function replacerUnescape(match) {
@@ -15042,14 +15061,161 @@ function bind3(_liquidSwell) {
15042
15061
  };
15043
15062
  }
15044
15063
 
15045
- // src/liquid/tags/for.ts
15064
+ // src/liquid/tags/content_for.ts
15065
+ var import_liquidjs22 = require("liquidjs");
15066
+ var import_lodash_es10 = require("lodash-es");
15067
+
15068
+ // src/liquid/hash.ts
15069
+ var import_lodash_es9 = require("lodash-es");
15070
+ var import_liquidjs21 = require("liquidjs");
15071
+
15072
+ // src/liquid/tokienizer.ts
15073
+ var import_liquidjs20 = require("liquidjs");
15074
+
15075
+ // src/liquid/tokens/identifier-token.ts
15046
15076
  var import_liquidjs19 = require("liquidjs");
15077
+ var IdentifierToken = class extends import_liquidjs19.Token {
15078
+ constructor(input, begin, end, file) {
15079
+ super(import_liquidjs19.TokenKind.Word, input, begin, end, file);
15080
+ this.input = input;
15081
+ this.begin = begin;
15082
+ this.end = end;
15083
+ this.file = file;
15084
+ this.content = this.getText();
15085
+ }
15086
+ content;
15087
+ };
15088
+
15089
+ // src/liquid/tokienizer.ts
15090
+ var isNumber2 = (c) => c >= "0" && c <= "9";
15091
+ var isCharacter = (c) => c >= "a" && c <= "z" || c >= "A" && c <= "Z";
15092
+ var isWord = (c) => "_-?".includes(c) || isCharacter(c) || isNumber2(c);
15093
+ var TokenizerSwell = class extends import_liquidjs20.Tokenizer {
15094
+ readIdentifier() {
15095
+ this.skipBlank();
15096
+ const begin = this.p;
15097
+ while (!this.end()) {
15098
+ const char = this.peek();
15099
+ if (isWord(char) || char === ".") {
15100
+ this.p++;
15101
+ } else {
15102
+ break;
15103
+ }
15104
+ }
15105
+ return new IdentifierToken(this.input, begin, this.p, this.file);
15106
+ }
15107
+ };
15108
+
15109
+ // src/liquid/hash.ts
15110
+ var HashSwell = class extends import_liquidjs21.Hash {
15111
+ constructor(input, jekyllStyle) {
15112
+ super(input, jekyllStyle);
15113
+ const tokenizer = input instanceof import_liquidjs21.Tokenizer ? input : new TokenizerSwell(input, {});
15114
+ for (const hash of tokenizer.readHashes(jekyllStyle)) {
15115
+ this.hash[hash.name.content] = hash.value;
15116
+ }
15117
+ }
15118
+ *render(ctx) {
15119
+ const hash = {};
15120
+ for (const key of Object.keys(this.hash)) {
15121
+ const token = this.hash[key];
15122
+ if (token !== void 0) {
15123
+ const value = yield (0, import_liquidjs21.evalToken)(token, ctx);
15124
+ (0, import_lodash_es9.set)(hash, key, value);
15125
+ }
15126
+ }
15127
+ return hash;
15128
+ }
15129
+ };
15130
+
15131
+ // src/liquid/tags/content_for.ts
15132
+ function bind4(liquidSwell) {
15133
+ return class ContentForTag extends import_liquidjs22.Tag {
15134
+ name;
15135
+ hash;
15136
+ constructor(token, remainTokens, liquid) {
15137
+ super(token, remainTokens, liquid);
15138
+ const tokenizer = token.tokenizer;
15139
+ this.name = tokenizer.readValue()?.content;
15140
+ this.hash = new HashSwell(tokenizer.remaining());
15141
+ }
15142
+ *render(ctx, emitter) {
15143
+ const section = yield ctx._get(["section"]);
15144
+ const block = yield ctx._get(["block"]);
15145
+ const hash = yield this.hash.render(ctx);
15146
+ const blocks = this.getBlocks(section, block, hash);
15147
+ for (const block2 of blocks) {
15148
+ if (!isObject2(block2) || typeof block2.type !== "string") {
15149
+ continue;
15150
+ }
15151
+ const blockPath = yield liquidSwell.getThemeBlockPath(
15152
+ block2.type
15153
+ );
15154
+ if (!blockPath) {
15155
+ continue;
15156
+ }
15157
+ const childCtx = ctx.spawn();
15158
+ const scope = childCtx.bottom();
15159
+ (0, import_lodash_es10.assign)(scope, { section });
15160
+ (0, import_lodash_es10.assign)(scope, { block: block2 });
15161
+ (0, import_lodash_es10.assign)(scope, hash);
15162
+ const templates = yield this.liquid._parseFile(
15163
+ blockPath,
15164
+ childCtx.sync
15165
+ );
15166
+ yield this.liquid.renderer.renderTemplates(
15167
+ templates,
15168
+ childCtx,
15169
+ emitter
15170
+ );
15171
+ }
15172
+ }
15173
+ getBlocks(section, block, hash) {
15174
+ const blockConfigs = this.getBlockConfigs(section, block);
15175
+ if (!isObject2(hash) || !hash.type) {
15176
+ return blockConfigs;
15177
+ }
15178
+ const blockConfig = blockConfigs.find(
15179
+ (blockConfig2) => isObject2(blockConfig2) && blockConfig2.type === hash.type
15180
+ );
15181
+ return blockConfig ? [blockConfig] : [];
15182
+ }
15183
+ getBlockConfigs(section, block) {
15184
+ if (isObject2(block) && block.blocks) {
15185
+ return Object.values(block.blocks);
15186
+ }
15187
+ if (isObject2(section) && Array.isArray(section.blocks)) {
15188
+ return section.blocks;
15189
+ }
15190
+ return [];
15191
+ }
15192
+ };
15193
+ }
15194
+
15195
+ // src/liquid/tags/doc.ts
15196
+ var import_liquidjs23 = require("liquidjs");
15197
+ function bind5() {
15198
+ return class DocTag extends import_liquidjs23.Tag {
15199
+ constructor(token, remainTokens, liquid, parser) {
15200
+ super(token, remainTokens, liquid);
15201
+ const stream = parser.parseStream(remainTokens).on("tag:enddoc", () => {
15202
+ stream.stop();
15203
+ });
15204
+ stream.start();
15205
+ }
15206
+ render() {
15207
+ }
15208
+ };
15209
+ }
15210
+
15211
+ // src/liquid/tags/for.ts
15212
+ var import_liquidjs24 = require("liquidjs");
15047
15213
  var MODIFIERS = Object.freeze(["offset", "limit", "reversed"]);
15048
- function bind4(_liquidSwell) {
15049
- return class ForTag extends import_liquidjs19.ForTag {
15214
+ function bind6(_liquidSwell) {
15215
+ return class ForTag extends import_liquidjs24.ForTag {
15050
15216
  *render(ctx, emitter) {
15051
15217
  const r = this.liquid.renderer;
15052
- let collection = yield (0, import_liquidjs19.evalToken)(this.collection, ctx);
15218
+ let collection = yield (0, import_liquidjs24.evalToken)(this.collection, ctx);
15053
15219
  collection = yield resolveEnumerable(collection);
15054
15220
  if (!collection.length) {
15055
15221
  yield r.renderTemplates(this.elseTemplates, ctx, emitter);
@@ -15116,10 +15282,10 @@ function limit(arr, count) {
15116
15282
  }
15117
15283
 
15118
15284
  // src/liquid/tags/form.ts
15119
- var import_liquidjs20 = require("liquidjs");
15285
+ var import_liquidjs25 = require("liquidjs");
15120
15286
  var IGNORED_SHOPIFY_FORMS = Object.freeze(["new_comment", "guest_login"]);
15121
- function bind5(liquidSwell) {
15122
- return class FormTag extends import_liquidjs20.Tag {
15287
+ function bind7(liquidSwell) {
15288
+ return class FormTag extends import_liquidjs25.Tag {
15123
15289
  formType;
15124
15290
  formConfig;
15125
15291
  templates;
@@ -15132,10 +15298,10 @@ function bind5(liquidSwell) {
15132
15298
  this.formConfig = liquidSwell.theme.getFormConfig(this.formType);
15133
15299
  this.arg = tokenizer.readValue();
15134
15300
  this.templates = [];
15135
- this.hash = new import_liquidjs20.Hash(this.tokenizer.remaining());
15301
+ this.hash = new import_liquidjs25.Hash(this.tokenizer.remaining());
15136
15302
  while (remainTokens.length > 0) {
15137
15303
  const token2 = remainTokens.shift();
15138
- if (import_liquidjs20.TypeGuards.isTagToken(token2) && token2.name === "endform") {
15304
+ if (import_liquidjs25.TypeGuards.isTagToken(token2) && token2.name === "endform") {
15139
15305
  return;
15140
15306
  }
15141
15307
  this.templates.push(parser.parseToken(token2, remainTokens));
@@ -15153,7 +15319,7 @@ function bind5(liquidSwell) {
15153
15319
  return;
15154
15320
  }
15155
15321
  const r = this.liquid.renderer;
15156
- const arg = yield (0, import_liquidjs20.evalToken)(this.arg, ctx);
15322
+ const arg = yield (0, import_liquidjs25.evalToken)(this.arg, ctx);
15157
15323
  const hash = yield this.hash.render(ctx);
15158
15324
  const scope = ctx.getAll();
15159
15325
  const attrs = " " + Object.entries({ id: `${this.formConfig.id}_form`, ...hash }).reduce((acc, [key, value]) => {
@@ -15214,9 +15380,9 @@ function bind5(liquidSwell) {
15214
15380
  }
15215
15381
 
15216
15382
  // src/liquid/tags/if.ts
15217
- var import_liquidjs21 = require("liquidjs");
15218
- function bind6(_liquidSwell) {
15219
- return class IfTag extends import_liquidjs21.Tag {
15383
+ var import_liquidjs26 = require("liquidjs");
15384
+ function bind8(_liquidSwell) {
15385
+ return class IfTag extends import_liquidjs26.Tag {
15220
15386
  branches = [];
15221
15387
  elseTemplates;
15222
15388
  constructor(tagToken, remainTokens, liquid, parser) {
@@ -15225,22 +15391,22 @@ function bind6(_liquidSwell) {
15225
15391
  parser.parseStream(remainTokens).on(
15226
15392
  "start",
15227
15393
  () => this.branches.push({
15228
- value: new import_liquidjs21.Value(
15394
+ value: new import_liquidjs26.Value(
15229
15395
  tagToken.tokenizer.readFilteredValue(),
15230
15396
  this.liquid
15231
15397
  ),
15232
15398
  templates: p = []
15233
15399
  })
15234
15400
  ).on("tag:elsif", (token) => {
15235
- (0, import_liquidjs21.assert)(!this.elseTemplates, "unexpected elsif after else");
15401
+ (0, import_liquidjs26.assert)(!this.elseTemplates, "unexpected elsif after else");
15236
15402
  this.branches.push({
15237
- value: new import_liquidjs21.Value(token.tokenizer.readFilteredValue(), this.liquid),
15403
+ value: new import_liquidjs26.Value(token.tokenizer.readFilteredValue(), this.liquid),
15238
15404
  templates: p = []
15239
15405
  });
15240
15406
  }).on("tag:else", (tag) => {
15241
15407
  if (tag.args.length > 0) {
15242
15408
  this.branches.push({
15243
- value: new import_liquidjs21.Value(tag.tokenizer.readFilteredValue(), this.liquid),
15409
+ value: new import_liquidjs26.Value(tag.tokenizer.readFilteredValue(), this.liquid),
15244
15410
  templates: p = []
15245
15411
  });
15246
15412
  } else {
@@ -15258,7 +15424,7 @@ function bind6(_liquidSwell) {
15258
15424
  const r = this.liquid.renderer;
15259
15425
  for (const { value, templates } of this.branches) {
15260
15426
  const v = yield value.value(ctx, ctx.opts.lenientIf);
15261
- if ((0, import_liquidjs21.isTruthy)(v, ctx)) {
15427
+ if ((0, import_liquidjs26.isTruthy)(v, ctx)) {
15262
15428
  yield r.renderTemplates(templates, ctx, emitter);
15263
15429
  return;
15264
15430
  }
@@ -15279,20 +15445,20 @@ function bind6(_liquidSwell) {
15279
15445
  };
15280
15446
  }
15281
15447
  function assertEmpty(predicate, message = `unexpected ${JSON.stringify(predicate)}`) {
15282
- (0, import_liquidjs21.assert)(!predicate, message);
15448
+ (0, import_liquidjs26.assert)(!predicate, message);
15283
15449
  }
15284
15450
 
15285
15451
  // src/liquid/tags/javascript.ts
15286
- var import_liquidjs22 = require("liquidjs");
15287
- function bind7(_liquidSwell) {
15288
- return class JavascriptTag extends import_liquidjs22.Tag {
15452
+ var import_liquidjs27 = require("liquidjs");
15453
+ function bind9(_liquidSwell) {
15454
+ return class JavascriptTag extends import_liquidjs27.Tag {
15289
15455
  templates;
15290
15456
  constructor(token, remainTokens, liquid, parser) {
15291
15457
  super(token, remainTokens, liquid);
15292
15458
  this.templates = [];
15293
15459
  while (remainTokens.length > 0) {
15294
15460
  const token2 = remainTokens.shift();
15295
- if (import_liquidjs22.TypeGuards.isTagToken(token2) && token2.name === "endjavascript") {
15461
+ if (import_liquidjs27.TypeGuards.isTagToken(token2) && token2.name === "endjavascript") {
15296
15462
  return;
15297
15463
  }
15298
15464
  this.templates.push(parser.parseToken(token2, remainTokens));
@@ -15310,9 +15476,9 @@ function bind7(_liquidSwell) {
15310
15476
  }
15311
15477
 
15312
15478
  // src/liquid/tags/layout.ts
15313
- var import_liquidjs23 = require("liquidjs");
15314
- function bind8(liquidSwell) {
15315
- return class LayoutTag extends import_liquidjs23.Tag {
15479
+ var import_liquidjs28 = require("liquidjs");
15480
+ function bind10(liquidSwell) {
15481
+ return class LayoutTag extends import_liquidjs28.Tag {
15316
15482
  fileName;
15317
15483
  constructor(token, remainTokens, liquid, _parser) {
15318
15484
  super(token, remainTokens, liquid);
@@ -15328,9 +15494,9 @@ function bind8(liquidSwell) {
15328
15494
  }
15329
15495
 
15330
15496
  // src/liquid/tags/paginate.ts
15331
- var import_liquidjs24 = require("liquidjs");
15332
- function bind9(liquidSwell) {
15333
- return class PaginateTag extends import_liquidjs24.Tag {
15497
+ var import_liquidjs29 = require("liquidjs");
15498
+ function bind11(liquidSwell) {
15499
+ return class PaginateTag extends import_liquidjs29.Tag {
15334
15500
  collection;
15335
15501
  pageSize;
15336
15502
  templates;
@@ -15345,7 +15511,7 @@ function bind9(liquidSwell) {
15345
15511
  }
15346
15512
  this.templates = [];
15347
15513
  this.collection = collection;
15348
- this.hash = new import_liquidjs24.Hash(this.tokenizer.remaining());
15514
+ this.hash = new import_liquidjs29.Hash(this.tokenizer.remaining());
15349
15515
  const stream = parser.parseStream(remainTokens).on("tag:endpaginate", () => stream.stop()).on("template", (tpl) => {
15350
15516
  this.templates.push(tpl);
15351
15517
  }).on("end", () => {
@@ -15355,8 +15521,8 @@ function bind9(liquidSwell) {
15355
15521
  }
15356
15522
  *render(ctx, emitter) {
15357
15523
  const r = this.liquid.renderer;
15358
- const collection = yield (0, import_liquidjs24.evalToken)(this.collection, ctx);
15359
- const pageSize = Number(yield (0, import_liquidjs24.evalToken)(this.pageSize, ctx));
15524
+ const collection = yield (0, import_liquidjs29.evalToken)(this.collection, ctx);
15525
+ const pageSize = Number(yield (0, import_liquidjs29.evalToken)(this.pageSize, ctx));
15360
15526
  const hash = yield this.hash.render(ctx);
15361
15527
  if (!Number.isNaN(pageSize) && collection instanceof SwellStorefrontCollection && collection.limit !== pageSize) {
15362
15528
  yield collection._get({
@@ -15382,10 +15548,10 @@ function bind9(liquidSwell) {
15382
15548
  }
15383
15549
 
15384
15550
  // src/liquid/tags/render.ts
15385
- var import_lodash_es9 = require("lodash-es");
15386
- var import_liquidjs25 = require("liquidjs");
15387
- function bind10(liquidSwell) {
15388
- return class RenderTag extends import_liquidjs25.RenderTag {
15551
+ var import_lodash_es11 = require("lodash-es");
15552
+ var import_liquidjs30 = require("liquidjs");
15553
+ function bind12(liquidSwell) {
15554
+ return class RenderTag extends import_liquidjs30.RenderTag {
15389
15555
  *render(ctx, emitter) {
15390
15556
  const self = this;
15391
15557
  const { liquid } = this;
@@ -15395,23 +15561,26 @@ function bind10(liquidSwell) {
15395
15561
  ctx,
15396
15562
  liquid
15397
15563
  );
15398
- (0, import_liquidjs25.assert)(filename, () => `illegal file path "${filename}"`);
15564
+ (0, import_liquidjs30.assert)(filename, () => `illegal file path "${filename}"`);
15399
15565
  const configPath = yield liquidSwell.getComponentPath(
15400
15566
  filename
15401
15567
  );
15402
15568
  const childCtx = ctx.spawn();
15403
15569
  const scope = childCtx.bottom();
15404
- (0, import_lodash_es9.assign)(scope, yield hash.render(ctx));
15570
+ (0, import_lodash_es11.assign)(scope, ctx.bottom());
15405
15571
  const parentSection = yield ctx._get(["section"]);
15406
- if (parentSection) (0, import_lodash_es9.assign)(scope, { section: parentSection });
15572
+ if (parentSection) (0, import_lodash_es11.assign)(scope, { section: parentSection });
15573
+ const parentBlock = yield ctx._get(["block"]);
15574
+ if (parentBlock) (0, import_lodash_es11.assign)(scope, { block: parentBlock });
15575
+ (0, import_lodash_es11.assign)(scope, yield hash.render(ctx));
15407
15576
  if (self["with"]) {
15408
15577
  const { value, alias } = self["with"];
15409
15578
  const aliasName = alias || filename;
15410
- scope[aliasName] = yield (0, import_liquidjs25.evalToken)(value, ctx);
15579
+ scope[aliasName] = yield (0, import_liquidjs30.evalToken)(value, ctx);
15411
15580
  }
15412
15581
  if (self["for"]) {
15413
15582
  const { value, alias } = self["for"];
15414
- let collection = yield (0, import_liquidjs25.evalToken)(value, ctx);
15583
+ let collection = yield (0, import_liquidjs30.evalToken)(value, ctx);
15415
15584
  collection = yield resolveEnumerable(collection);
15416
15585
  scope["forloop"] = new ForloopDrop(
15417
15586
  collection.length,
@@ -15454,13 +15623,13 @@ function* renderFilePath(file, ctx, liquid) {
15454
15623
  default:
15455
15624
  break;
15456
15625
  }
15457
- return yield (0, import_liquidjs25.evalToken)(file, ctx);
15626
+ return yield (0, import_liquidjs30.evalToken)(file, ctx);
15458
15627
  }
15459
15628
 
15460
15629
  // src/liquid/tags/section.ts
15461
- var import_liquidjs26 = require("liquidjs");
15462
- function bind11(liquidSwell) {
15463
- return class SectionTag extends import_liquidjs26.Tag {
15630
+ var import_liquidjs31 = require("liquidjs");
15631
+ function bind13(liquidSwell) {
15632
+ return class SectionTag extends import_liquidjs31.Tag {
15464
15633
  fileName;
15465
15634
  constructor(token, remainTokens, liquid, _parser) {
15466
15635
  super(token, remainTokens, liquid);
@@ -15511,10 +15680,10 @@ function bind11(liquidSwell) {
15511
15680
  }
15512
15681
 
15513
15682
  // src/liquid/tags/sections.ts
15514
- var import_liquidjs27 = require("liquidjs");
15683
+ var import_liquidjs32 = require("liquidjs");
15515
15684
  var import_json54 = __toESM(require("json5"), 1);
15516
- function bind12(liquidSwell) {
15517
- return class SectionsTag extends import_liquidjs27.Tag {
15685
+ function bind14(liquidSwell) {
15686
+ return class SectionsTag extends import_liquidjs32.Tag {
15518
15687
  fileName;
15519
15688
  constructor(token, remainTokens, liquid, _parser) {
15520
15689
  super(token, remainTokens, liquid);
@@ -15554,9 +15723,9 @@ function bind12(liquidSwell) {
15554
15723
  }
15555
15724
 
15556
15725
  // src/liquid/tags/style.ts
15557
- var import_liquidjs28 = require("liquidjs");
15558
- function bind13(_liquidSwell) {
15559
- return class StyleTag extends import_liquidjs28.Tag {
15726
+ var import_liquidjs33 = require("liquidjs");
15727
+ function bind15(_liquidSwell) {
15728
+ return class StyleTag extends import_liquidjs33.Tag {
15560
15729
  templates;
15561
15730
  hash;
15562
15731
  constructor(token, remainTokens, liquid, parser) {
@@ -15565,7 +15734,7 @@ function bind13(_liquidSwell) {
15565
15734
  const tagBegin = token.begin;
15566
15735
  while (remainTokens.length > 0) {
15567
15736
  const token2 = remainTokens.shift();
15568
- if (import_liquidjs28.TypeGuards.isTagToken(token2) && token2.name === "endstyle") {
15737
+ if (import_liquidjs33.TypeGuards.isTagToken(token2) && token2.name === "endstyle") {
15569
15738
  this.hash = md5(token2.input.slice(tagBegin, token2.end));
15570
15739
  return;
15571
15740
  }
@@ -15588,16 +15757,16 @@ function bind13(_liquidSwell) {
15588
15757
  }
15589
15758
 
15590
15759
  // src/liquid/tags/stylesheet.ts
15591
- var import_liquidjs29 = require("liquidjs");
15592
- function bind14(_liquidSwell) {
15593
- return class StyleSheetTag extends import_liquidjs29.Tag {
15760
+ var import_liquidjs34 = require("liquidjs");
15761
+ function bind16(_liquidSwell) {
15762
+ return class StyleSheetTag extends import_liquidjs34.Tag {
15594
15763
  templates;
15595
15764
  constructor(token, remainTokens, liquid, parser) {
15596
15765
  super(token, remainTokens, liquid);
15597
15766
  this.templates = [];
15598
15767
  while (remainTokens.length > 0) {
15599
15768
  const token2 = remainTokens.shift();
15600
- if (import_liquidjs29.TypeGuards.isTagToken(token2) && token2.name === "endstylesheet") {
15769
+ if (import_liquidjs34.TypeGuards.isTagToken(token2) && token2.name === "endstylesheet") {
15601
15770
  return;
15602
15771
  }
15603
15772
  this.templates.push(parser.parseToken(token2, remainTokens));
@@ -15613,9 +15782,9 @@ function bind14(_liquidSwell) {
15613
15782
  }
15614
15783
 
15615
15784
  // src/liquid/tags/shopify/include.ts
15616
- var import_liquidjs30 = require("liquidjs");
15617
- function bind15(liquidSwell) {
15618
- return class IncludeTag extends import_liquidjs30.IncludeTag {
15785
+ var import_liquidjs35 = require("liquidjs");
15786
+ function bind17(liquidSwell) {
15787
+ return class IncludeTag extends import_liquidjs35.IncludeTag {
15619
15788
  *render(ctx, emitter) {
15620
15789
  const { hash } = this;
15621
15790
  const filepath = yield renderFilePath(
@@ -15623,13 +15792,13 @@ function bind15(liquidSwell) {
15623
15792
  ctx,
15624
15793
  this.liquid
15625
15794
  );
15626
- (0, import_liquidjs30.assert)(filepath, () => `illegal file path "${filepath}"`);
15795
+ (0, import_liquidjs35.assert)(filepath, () => `illegal file path "${filepath}"`);
15627
15796
  const saved = ctx.saveRegister("blocks", "blockMode");
15628
15797
  ctx.setRegister("blocks", {});
15629
15798
  ctx.setRegister("blockMode", 0);
15630
15799
  const scope = yield hash.render(ctx);
15631
15800
  if (this.withVar) {
15632
- scope[filepath] = yield (0, import_liquidjs30.evalToken)(this.withVar, ctx);
15801
+ scope[filepath] = yield (0, import_liquidjs35.evalToken)(this.withVar, ctx);
15633
15802
  }
15634
15803
  ctx.push(ctx.opts.jekyllInclude ? { include: scope } : scope);
15635
15804
  const output = yield liquidSwell.getComponentPath(filepath).then((path) => liquidSwell.getThemeConfig(path)).then((themeConfig) => liquidSwell.renderTemplate(themeConfig, ctx));
@@ -15641,10 +15810,10 @@ function bind15(liquidSwell) {
15641
15810
  }
15642
15811
 
15643
15812
  // src/liquid/tags/shopify/schema.ts
15644
- var import_liquidjs31 = require("liquidjs");
15813
+ var import_liquidjs36 = require("liquidjs");
15645
15814
  var import_json55 = __toESM(require("json5"), 1);
15646
- function bind16(liquidSwell) {
15647
- return class SchemaTag extends import_liquidjs31.Tag {
15815
+ function bind18(liquidSwell) {
15816
+ return class SchemaTag extends import_liquidjs36.Tag {
15648
15817
  templates;
15649
15818
  constructor(token, remainTokens, liquid, parser) {
15650
15819
  super(token, remainTokens, liquid);
@@ -15666,6 +15835,7 @@ function bind16(liquidSwell) {
15666
15835
  liquidSwell.lastSchema = void 0;
15667
15836
  if (typeof jsonOutput === "string") {
15668
15837
  liquidSwell.lastSchema = import_json55.default.parse(jsonOutput);
15838
+ expandThemeBlocks(liquidSwell);
15669
15839
  }
15670
15840
  } catch (err) {
15671
15841
  console.warn(err);
@@ -15675,11 +15845,22 @@ function bind16(liquidSwell) {
15675
15845
  }
15676
15846
  };
15677
15847
  }
15848
+ function expandThemeBlocks(liquidSwell) {
15849
+ const blocks = liquidSwell.lastSchema?.blocks;
15850
+ if (!Array.isArray(blocks)) {
15851
+ return;
15852
+ }
15853
+ for (let i = 0; i < blocks.length; i++) {
15854
+ if (blocks[i].type === "@theme") {
15855
+ blocks.splice(i, 1, ...liquidSwell.theme.getAllThemeBlockSchemas());
15856
+ }
15857
+ }
15858
+ }
15678
15859
 
15679
15860
  // src/liquid/tags/inline_editable.ts
15680
- var import_liquidjs32 = require("liquidjs");
15681
- function bind17(_liquidSwell) {
15682
- return class InlineEditableTag extends import_liquidjs32.Tag {
15861
+ var import_liquidjs37 = require("liquidjs");
15862
+ function bind19(_liquidSwell) {
15863
+ return class InlineEditableTag extends import_liquidjs37.Tag {
15683
15864
  key;
15684
15865
  value;
15685
15866
  constructor(token, remainTokens, liquid, _parser) {
@@ -15707,129 +15888,131 @@ var tags = {
15707
15888
  assign: bind,
15708
15889
  case: bind2,
15709
15890
  comment: bind3,
15710
- for: bind4,
15711
- form: bind5,
15712
- if: bind6,
15713
- javascript: bind7,
15714
- layout: bind8,
15715
- paginate: bind9,
15716
- render: bind10,
15717
- section: bind11,
15718
- sections: bind12,
15719
- style: bind13,
15891
+ content_for: bind4,
15892
+ doc: bind5,
15893
+ for: bind6,
15894
+ form: bind7,
15895
+ if: bind8,
15896
+ javascript: bind9,
15897
+ layout: bind10,
15898
+ paginate: bind11,
15899
+ render: bind12,
15900
+ section: bind13,
15901
+ sections: bind14,
15902
+ style: bind15,
15720
15903
  // Shopify compatibility only
15721
- include: bind15,
15722
- schema: bind16,
15723
- stylesheet: bind14,
15904
+ include: bind17,
15905
+ schema: bind18,
15906
+ stylesheet: bind16,
15724
15907
  // Swell only
15725
- inline_editable: bind17
15908
+ inline_editable: bind19
15726
15909
  };
15727
15910
  function bindTags(liquidSwell) {
15728
15911
  Object.entries(tags).forEach(
15729
- ([tag, bind67]) => liquidSwell.registerTag(tag, bind67(liquidSwell))
15912
+ ([tag, bind70]) => liquidSwell.registerTag(tag, bind70(liquidSwell))
15730
15913
  );
15731
15914
  }
15732
15915
 
15733
15916
  // src/liquid/filters/asset_url.ts
15734
- function bind18(liquidSwell) {
15917
+ function bind20(liquidSwell) {
15735
15918
  return function filterAssetUrl(assetPath) {
15736
15919
  return liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
15737
15920
  };
15738
15921
  }
15739
15922
 
15740
15923
  // src/liquid/filters/brightness_difference.ts
15741
- function bind19(_liquidSwell) {
15924
+ function bind21(_liquidSwell) {
15742
15925
  return (color1, color2) => {
15743
15926
  return ThemeColor.get(color1).brightnessDifference(ThemeColor.get(color2));
15744
15927
  };
15745
15928
  }
15746
15929
 
15747
15930
  // src/liquid/filters/color_brightness.ts
15748
- function bind20(_liquidSwell) {
15931
+ function bind22(_liquidSwell) {
15749
15932
  return (color) => {
15750
15933
  return ThemeColor.get(color).brightness();
15751
15934
  };
15752
15935
  }
15753
15936
 
15754
15937
  // src/liquid/filters/color_contrast.ts
15755
- function bind21(_liquidSwell) {
15938
+ function bind23(_liquidSwell) {
15756
15939
  return (color1, color2) => {
15757
15940
  return ThemeColor.get(color1).contrast(ThemeColor.get(color2));
15758
15941
  };
15759
15942
  }
15760
15943
 
15761
15944
  // src/liquid/filters/color_darken.ts
15762
- function bind22(_liquidSwell) {
15945
+ function bind24(_liquidSwell) {
15763
15946
  return (color, percent) => {
15764
15947
  return ThemeColor.get(color).darken(percent);
15765
15948
  };
15766
15949
  }
15767
15950
 
15768
15951
  // src/liquid/filters/color_desaturate.ts
15769
- function bind23(_liquidSwell) {
15952
+ function bind25(_liquidSwell) {
15770
15953
  return (color, value) => {
15771
15954
  return ThemeColor.get(color).desaturate(value);
15772
15955
  };
15773
15956
  }
15774
15957
 
15775
15958
  // src/liquid/filters/color_difference.ts
15776
- function bind24(_liquidSwell) {
15959
+ function bind26(_liquidSwell) {
15777
15960
  return (color1, color2) => {
15778
15961
  return ThemeColor.get(color1).difference(ThemeColor.get(color2));
15779
15962
  };
15780
15963
  }
15781
15964
 
15782
15965
  // src/liquid/filters/color_extract.ts
15783
- function bind25(_liquidSwell) {
15966
+ function bind27(_liquidSwell) {
15784
15967
  return (color, field) => {
15785
15968
  return ThemeColor.get(color).extract(field);
15786
15969
  };
15787
15970
  }
15788
15971
 
15789
15972
  // src/liquid/filters/color_lighten.ts
15790
- function bind26(_liquidSwell) {
15973
+ function bind28(_liquidSwell) {
15791
15974
  return (color, percent) => {
15792
15975
  return ThemeColor.get(color).lighten(percent);
15793
15976
  };
15794
15977
  }
15795
15978
 
15796
15979
  // src/liquid/filters/color_mix.ts
15797
- function bind27(_liquidSwell) {
15980
+ function bind29(_liquidSwell) {
15798
15981
  return (color1, color2, ratio) => {
15799
15982
  return ThemeColor.get(color1).mix(ThemeColor.get(color2), ratio);
15800
15983
  };
15801
15984
  }
15802
15985
 
15803
15986
  // src/liquid/filters/color_modify.ts
15804
- function bind28(_liquidSwell) {
15987
+ function bind30(_liquidSwell) {
15805
15988
  return function filterColorModify(color, field, value) {
15806
15989
  return ThemeColor.get(color).modify(field, Number(value) || 0);
15807
15990
  };
15808
15991
  }
15809
15992
 
15810
15993
  // src/liquid/filters/color_saturate.ts
15811
- function bind29(_liquidSwell) {
15994
+ function bind31(_liquidSwell) {
15812
15995
  return (color, value) => {
15813
15996
  return ThemeColor.get(color).saturate(value);
15814
15997
  };
15815
15998
  }
15816
15999
 
15817
16000
  // src/liquid/filters/color_to_hex.ts
15818
- function bind30(_liquidSwell) {
16001
+ function bind32(_liquidSwell) {
15819
16002
  return (color) => {
15820
16003
  return ThemeColor.get(color).hex();
15821
16004
  };
15822
16005
  }
15823
16006
 
15824
16007
  // src/liquid/filters/color_to_hsl.ts
15825
- function bind31(_liquidSwell) {
16008
+ function bind33(_liquidSwell) {
15826
16009
  return (color) => {
15827
16010
  return ThemeColor.get(color).hsl();
15828
16011
  };
15829
16012
  }
15830
16013
 
15831
16014
  // src/liquid/filters/color_to_rgb.ts
15832
- function bind32(_liquidSwell) {
16015
+ function bind34(_liquidSwell) {
15833
16016
  return (color, alpha) => {
15834
16017
  return alpha !== void 0 ? ThemeColor.get(color).rgba(alpha) : ThemeColor.get(color).rgb();
15835
16018
  };
@@ -15837,7 +16020,7 @@ function bind32(_liquidSwell) {
15837
16020
 
15838
16021
  // src/liquid/filters/date.ts
15839
16022
  var import_strftime = __toESM(require("strftime"), 1);
15840
- function bind33(_liquidSwell) {
16023
+ function bind35(_liquidSwell) {
15841
16024
  return (dateValue, ...params) => {
15842
16025
  const date = ensureDate(dateValue);
15843
16026
  const { format } = getDateFilterParams(params);
@@ -15895,7 +16078,7 @@ function applyStrftimeFormat(format, date) {
15895
16078
  }
15896
16079
 
15897
16080
  // src/liquid/filters/date_next_interval.ts
15898
- function bind34(_liquidSwell) {
16081
+ function bind36(_liquidSwell) {
15899
16082
  return (dateValue, interval, intervalCount) => {
15900
16083
  const date = ensureDate(dateValue);
15901
16084
  const result = getNextIntervalDate(date, interval, Number(intervalCount));
@@ -15947,7 +16130,7 @@ function time(date) {
15947
16130
  }
15948
16131
 
15949
16132
  // src/liquid/filters/default_errors.ts
15950
- function bind35(_liquidSwell) {
16133
+ function bind37(_liquidSwell) {
15951
16134
  return async function filterDefaultError(errors) {
15952
16135
  if (!errors) {
15953
16136
  return "";
@@ -15973,7 +16156,7 @@ function bind35(_liquidSwell) {
15973
16156
  }
15974
16157
 
15975
16158
  // src/liquid/filters/divided_by.ts
15976
- function bind36(_liquidSwell) {
16159
+ function bind38(_liquidSwell) {
15977
16160
  return (dividend, divisor, integerArithmetic) => {
15978
16161
  if (!isNumber(dividend) || !isNumber(divisor)) {
15979
16162
  return dividend;
@@ -15983,20 +16166,20 @@ function bind36(_liquidSwell) {
15983
16166
  }
15984
16167
 
15985
16168
  // src/liquid/filters/embedded_content.ts
15986
- var import_lodash_es10 = require("lodash-es");
15987
- function bind37(_liquidSwell) {
16169
+ var import_lodash_es12 = require("lodash-es");
16170
+ function bind39(_liquidSwell) {
15988
16171
  return (value, tag = "iframe") => {
15989
16172
  const escapeIframes = value.replaceAll(`<${tag}`, `&lt;${tag}`).replaceAll(`</${tag}`, `&lt;/${tag}`);
15990
16173
  const removeTags = escapeIframes.replaceAll(/<(.*?)>/gi, "");
15991
- const unescaped = (0, import_lodash_es10.unescape)(removeTags);
16174
+ const unescaped = (0, import_lodash_es12.unescape)(removeTags);
15992
16175
  const replaceSpaces = unescaped.replaceAll("&nbsp;", " ");
15993
16176
  return replaceSpaces;
15994
16177
  };
15995
16178
  }
15996
16179
 
15997
16180
  // src/liquid/filters/escape.ts
15998
- var import_lodash_es11 = require("lodash-es");
15999
- function bind38(_liquidSwell) {
16181
+ var import_lodash_es13 = require("lodash-es");
16182
+ function bind40(_liquidSwell) {
16000
16183
  return function escapeTag(input) {
16001
16184
  if (!input?.startsWith) {
16002
16185
  return input;
@@ -16004,12 +16187,12 @@ function bind38(_liquidSwell) {
16004
16187
  if (input.startsWith("<img") || input.startsWith("<video")) {
16005
16188
  return input;
16006
16189
  }
16007
- return (0, import_lodash_es11.escape)(input);
16190
+ return (0, import_lodash_es13.escape)(input);
16008
16191
  };
16009
16192
  }
16010
16193
 
16011
16194
  // src/liquid/filters/font_face.ts
16012
- function bind39(_liquidSwell) {
16195
+ function bind41(_liquidSwell) {
16013
16196
  return (fontSetting, ...params) => {
16014
16197
  if (!fontSetting) {
16015
16198
  return null;
@@ -16021,14 +16204,14 @@ function bind39(_liquidSwell) {
16021
16204
  }
16022
16205
 
16023
16206
  // src/liquid/filters/font_modify.ts
16024
- function bind40(_liquidSwell) {
16207
+ function bind42(_liquidSwell) {
16025
16208
  return (fontSetting, prop, value) => {
16026
16209
  return ThemeFont.clone(fontSetting).modify(prop, value);
16027
16210
  };
16028
16211
  }
16029
16212
 
16030
16213
  // src/liquid/filters/font_url.ts
16031
- function bind41(_liquidSwell) {
16214
+ function bind43(_liquidSwell) {
16032
16215
  return (fontSetting) => {
16033
16216
  return ThemeFont.get(fontSetting).url();
16034
16217
  };
@@ -16077,15 +16260,15 @@ var format_address_default = {
16077
16260
  };
16078
16261
 
16079
16262
  // src/liquid/filters/handleize.ts
16080
- var import_lodash_es12 = require("lodash-es");
16081
- function bind42(_liquidSwell) {
16263
+ var import_lodash_es14 = require("lodash-es");
16264
+ function bind44(_liquidSwell) {
16082
16265
  return function filterHandleize(handle) {
16083
- return (0, import_lodash_es12.kebabCase)(handle);
16266
+ return (0, import_lodash_es14.kebabCase)(handle);
16084
16267
  };
16085
16268
  }
16086
16269
 
16087
16270
  // src/liquid/filters/image_tag.ts
16088
- function bind43(_liquidSwell) {
16271
+ function bind45(_liquidSwell) {
16089
16272
  return function filterImageTag(imageUrl, ...params) {
16090
16273
  imageUrl = String(imageUrl || "");
16091
16274
  let {
@@ -16249,7 +16432,7 @@ var filterDefinition = {
16249
16432
  var image_url_default = filterDefinition;
16250
16433
 
16251
16434
  // src/liquid/filters/inline_asset_content.ts
16252
- function bind44(liquidSwell) {
16435
+ function bind46(liquidSwell) {
16253
16436
  return async (assetPath) => {
16254
16437
  const config = await liquidSwell.theme.getThemeConfig(
16255
16438
  `theme/assets/${assetPath}`
@@ -16259,14 +16442,14 @@ function bind44(liquidSwell) {
16259
16442
  }
16260
16443
 
16261
16444
  // src/liquid/filters/json.ts
16262
- function bind45(_liquidSwell) {
16445
+ function bind47(_liquidSwell) {
16263
16446
  return async function filterJson(input, space = 0) {
16264
16447
  return jsonStringifyAsync(input, space);
16265
16448
  };
16266
16449
  }
16267
16450
 
16268
16451
  // src/liquid/filters/json_pretty.ts
16269
- function bind46(_liquidSwell) {
16452
+ function bind48(_liquidSwell) {
16270
16453
  return async function filterJsonPretty(input, space = 2) {
16271
16454
  const output = await jsonStringifyAsync(input, space);
16272
16455
  return `<pre>${output}</pre>`;
@@ -16276,7 +16459,7 @@ function bind46(_liquidSwell) {
16276
16459
  // src/liquid/filters/locale_flag.ts
16277
16460
  var import_country_flag_icons = require("country-flag-icons");
16278
16461
  var flags = __toESM(require("country-flag-icons/string/1x1"), 1);
16279
- function bind47(_liquidSwell) {
16462
+ function bind49(_liquidSwell) {
16280
16463
  return (localeCode) => {
16281
16464
  if (typeof localeCode !== "string") {
16282
16465
  return flags.US;
@@ -16287,7 +16470,7 @@ function bind47(_liquidSwell) {
16287
16470
  }
16288
16471
 
16289
16472
  // src/liquid/filters/minus.ts
16290
- function bind48(_liquidSwell) {
16473
+ function bind50(_liquidSwell) {
16291
16474
  return (first, second) => {
16292
16475
  const firstValue = isNumber(first) ? first : 0;
16293
16476
  const secondValue = isNumber(second) ? second : 0;
@@ -16296,7 +16479,7 @@ function bind48(_liquidSwell) {
16296
16479
  }
16297
16480
 
16298
16481
  // src/liquid/filters/money.ts
16299
- function bind49(liquidSwell) {
16482
+ function bind51(liquidSwell) {
16300
16483
  return function filterMoney(value) {
16301
16484
  const amount = getMoneyAmount(liquidSwell, value);
16302
16485
  return liquidSwell.renderCurrency(amount);
@@ -16313,7 +16496,7 @@ function getMoneyAmount(liquidSwell, value) {
16313
16496
  }
16314
16497
 
16315
16498
  // src/liquid/filters/money_with_currency.ts
16316
- function bind50(liquidSwell) {
16499
+ function bind52(liquidSwell) {
16317
16500
  return function filterMoneyWithCurrency(value) {
16318
16501
  const { currency } = liquidSwell.theme.swell.getStorefrontLocalization();
16319
16502
  const amount = getMoneyAmount(liquidSwell, value);
@@ -16322,7 +16505,7 @@ function bind50(liquidSwell) {
16322
16505
  }
16323
16506
 
16324
16507
  // src/liquid/filters/money_without_currency.ts
16325
- function bind51(liquidSwell) {
16508
+ function bind53(liquidSwell) {
16326
16509
  return function filterMoneyWithoutCurrency(value) {
16327
16510
  const amount = getMoneyAmount(liquidSwell, value);
16328
16511
  return liquidSwell.renderCurrency(amount).replace(/[^0-9.,]/g, "");
@@ -16330,30 +16513,45 @@ function bind51(liquidSwell) {
16330
16513
  }
16331
16514
 
16332
16515
  // src/liquid/filters/money_without_trailing_zeros.ts
16333
- function bind52(liquidSwell) {
16516
+ function bind54(liquidSwell) {
16334
16517
  return function filterMoneyWithoutTrailingZeros(value) {
16335
16518
  const amount = getMoneyAmount(liquidSwell, value);
16336
16519
  return liquidSwell.renderCurrency(amount).split(".")[0].split(",")[0];
16337
16520
  };
16338
16521
  }
16339
16522
 
16523
+ // src/liquid/filters/preload_tag.ts
16524
+ function bind55(_liquidSwell) {
16525
+ return function filterPreloadTag(assetUrl, ...params) {
16526
+ if (!assetUrl) {
16527
+ return "";
16528
+ }
16529
+ const { as } = paramsToProps(params);
16530
+ let attributes = "";
16531
+ if (typeof as === "string" && as) {
16532
+ attributes += `as="${as}"`;
16533
+ }
16534
+ return `<link href="${assetUrl}" rel="preload" ${attributes} />`;
16535
+ };
16536
+ }
16537
+
16340
16538
  // src/liquid/filters/script_tag.ts
16341
- function bind53(_liquidSwell) {
16539
+ function bind56(_liquidSwell) {
16342
16540
  return function filterScriptTag(assetUrl) {
16343
16541
  return `<script src="${assetUrl}" type="text/javascript"></script>`;
16344
16542
  };
16345
16543
  }
16346
16544
 
16347
16545
  // src/liquid/filters/stylesheet_tag.ts
16348
- function bind54(_liquidSwell) {
16546
+ function bind57(_liquidSwell) {
16349
16547
  return function filterStyleSheetTag(assetUrl) {
16350
16548
  return `<link href="${assetUrl}" rel="stylesheet" type="text/css" media="all" />`;
16351
16549
  };
16352
16550
  }
16353
16551
 
16354
16552
  // src/liquid/filters/time_tag.ts
16355
- function bind55(_liquidSwell) {
16356
- const dateFilter = bind33(_liquidSwell);
16553
+ function bind58(_liquidSwell) {
16554
+ const dateFilter = bind35(_liquidSwell);
16357
16555
  return (dateValue, ...params) => {
16358
16556
  const date = ensureDate(dateValue);
16359
16557
  const formattedDate = dateFilter(dateValue, ...params);
@@ -16363,7 +16561,7 @@ function bind55(_liquidSwell) {
16363
16561
  }
16364
16562
 
16365
16563
  // src/liquid/filters/translate.ts
16366
- function bind56(liquidSwell) {
16564
+ function bind59(liquidSwell) {
16367
16565
  return async function filterTranslate(key, params) {
16368
16566
  const props = params && paramsToProps(params);
16369
16567
  const str = await liquidSwell.renderTranslation(key, props);
@@ -16372,7 +16570,7 @@ function bind56(liquidSwell) {
16372
16570
  }
16373
16571
 
16374
16572
  // src/liquid/filters/where.ts
16375
- function bind57(_liquidSwell) {
16573
+ function bind60(_liquidSwell) {
16376
16574
  return function* filterWhere(arr, property, expected) {
16377
16575
  const results = [];
16378
16576
  const list = yield resolveEnumerable(arr);
@@ -16426,7 +16624,7 @@ function getSizesFromParam(param) {
16426
16624
  height: height ? Number(height) : void 0
16427
16625
  };
16428
16626
  }
16429
- function bind58(liquidSwell) {
16627
+ function bind61(liquidSwell) {
16430
16628
  return async function filterAssetImgUrl(assetPath, size = "small") {
16431
16629
  const imageUrl = await liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
16432
16630
  const sizes = getSizesFromParam(size);
@@ -16442,14 +16640,14 @@ function bind58(liquidSwell) {
16442
16640
  }
16443
16641
 
16444
16642
  // src/liquid/filters/shopify/hex_to_rgba.ts
16445
- function bind59(_liquidSwell) {
16643
+ function bind62(_liquidSwell) {
16446
16644
  return (color, alpha) => {
16447
16645
  return ThemeColor.get(color).rgba(alpha || 1);
16448
16646
  };
16449
16647
  }
16450
16648
 
16451
16649
  // src/liquid/filters/shopify/img_url.ts
16452
- function bind60(liquidSwell) {
16650
+ function bind63(liquidSwell) {
16453
16651
  return async function filterImgUrl(input, ...params) {
16454
16652
  const url = await getImageUrlFromInput(input, liquidSwell);
16455
16653
  if (typeof url !== "string" || url === "") {
@@ -16487,14 +16685,14 @@ var item_count_for_variant_default = {
16487
16685
  };
16488
16686
 
16489
16687
  // src/liquid/filters/shopify/payment_button.ts
16490
- function bind61(_liquidSwell) {
16688
+ function bind64(_liquidSwell) {
16491
16689
  return (form) => {
16492
16690
  return `<button style="display: block; visibility: hidden;"></button>`;
16493
16691
  };
16494
16692
  }
16495
16693
 
16496
16694
  // src/liquid/filters/shopify/payment_terms.ts
16497
- function bind62(_liquidSwell) {
16695
+ function bind65(_liquidSwell) {
16498
16696
  return (form) => {
16499
16697
  return null;
16500
16698
  };
@@ -16596,7 +16794,7 @@ var svgs = {
16596
16794
  var placeholder_svgs_default = svgs;
16597
16795
 
16598
16796
  // src/liquid/filters/shopify/placeholder_svg_tag.ts
16599
- function bind63(_liquidSwell) {
16797
+ function bind66(_liquidSwell) {
16600
16798
  return function filterPlaceholderSvgTag(name, className) {
16601
16799
  const svg = placeholder_svgs_default[name];
16602
16800
  if (typeof svg === "object" && svg !== null) {
@@ -16607,7 +16805,7 @@ function bind63(_liquidSwell) {
16607
16805
  }
16608
16806
 
16609
16807
  // src/liquid/filters/shopify/shopify_asset_url.ts
16610
- function bind64(_liquidSwell) {
16808
+ function bind67(_liquidSwell) {
16611
16809
  return function filterShopifyAssetUrl(input) {
16612
16810
  if (typeof input === "string") {
16613
16811
  switch (input) {
@@ -16632,7 +16830,7 @@ function bind64(_liquidSwell) {
16632
16830
  }
16633
16831
 
16634
16832
  // src/liquid/filters/shopify/structured_data.ts
16635
- function bind65(_liquidSwell) {
16833
+ function bind68(_liquidSwell) {
16636
16834
  return async function filterStructuredData(input) {
16637
16835
  let value = input;
16638
16836
  if (value instanceof StorefrontResource) {
@@ -16710,7 +16908,7 @@ function convertToSchemaOrgProductGroup(product) {
16710
16908
  }
16711
16909
 
16712
16910
  // src/liquid/filters/inline_editable.ts
16713
- function bind66(_liquidSwell) {
16911
+ function bind69(_liquidSwell) {
16714
16912
  return (value, key) => {
16715
16913
  if (typeof value === "object" && "value" in value) {
16716
16914
  value = value.value;
@@ -16721,64 +16919,65 @@ function bind66(_liquidSwell) {
16721
16919
 
16722
16920
  // src/liquid/filters/index.ts
16723
16921
  var filters = {
16724
- asset_url: bind18,
16725
- brightness_difference: bind19,
16726
- color_brightness: bind20,
16727
- color_contrast: bind21,
16728
- color_darken: bind22,
16729
- color_desaturate: bind23,
16730
- color_difference: bind24,
16731
- color_extract: bind25,
16732
- color_lighten: bind26,
16733
- color_mix: bind27,
16734
- color_modify: bind28,
16735
- color_saturate: bind29,
16736
- color_to_hex: bind30,
16737
- color_to_hsl: bind31,
16738
- color_to_rgb: bind32,
16739
- date_next_interval: bind34,
16740
- date: bind33,
16741
- default_errors: bind35,
16742
- divided_by: bind36,
16743
- embedded_content: bind37,
16744
- escape: bind38,
16745
- font_face: bind39,
16746
- font_modify: bind40,
16747
- font_url: bind41,
16922
+ asset_url: bind20,
16923
+ brightness_difference: bind21,
16924
+ color_brightness: bind22,
16925
+ color_contrast: bind23,
16926
+ color_darken: bind24,
16927
+ color_desaturate: bind25,
16928
+ color_difference: bind26,
16929
+ color_extract: bind27,
16930
+ color_lighten: bind28,
16931
+ color_mix: bind29,
16932
+ color_modify: bind30,
16933
+ color_saturate: bind31,
16934
+ color_to_hex: bind32,
16935
+ color_to_hsl: bind33,
16936
+ color_to_rgb: bind34,
16937
+ date_next_interval: bind36,
16938
+ date: bind35,
16939
+ default_errors: bind37,
16940
+ divided_by: bind38,
16941
+ embedded_content: bind39,
16942
+ escape: bind40,
16943
+ font_face: bind41,
16944
+ font_modify: bind42,
16945
+ font_url: bind43,
16748
16946
  format_address: format_address_default,
16749
- handle: bind42,
16947
+ handle: bind44,
16750
16948
  // alias
16751
- handleize: bind42,
16752
- image_tag: bind43,
16949
+ handleize: bind44,
16950
+ image_tag: bind45,
16753
16951
  image_url: image_url_default,
16754
- inline_asset_content: bind44,
16755
- json: bind45,
16756
- json_pretty: bind46,
16757
- locale_flag: bind47,
16758
- minus: bind48,
16759
- money: bind49,
16760
- money_with_currency: bind50,
16761
- money_without_currency: bind51,
16762
- money_without_trailing_zeros: bind52,
16763
- script_tag: bind53,
16764
- stylesheet_tag: bind54,
16765
- time_tag: bind55,
16766
- translate: bind56,
16767
- t: bind56,
16952
+ inline_asset_content: bind46,
16953
+ json: bind47,
16954
+ json_pretty: bind48,
16955
+ locale_flag: bind49,
16956
+ minus: bind50,
16957
+ money: bind51,
16958
+ money_with_currency: bind52,
16959
+ money_without_currency: bind53,
16960
+ money_without_trailing_zeros: bind54,
16961
+ preload_tag: bind55,
16962
+ script_tag: bind56,
16963
+ stylesheet_tag: bind57,
16964
+ time_tag: bind58,
16965
+ translate: bind59,
16966
+ t: bind59,
16768
16967
  // alias
16769
- where: bind57,
16968
+ where: bind60,
16770
16969
  // Shopify compatibility only
16771
- asset_img_url: bind58,
16772
- hex_to_rgba: bind59,
16773
- img_url: bind60,
16970
+ asset_img_url: bind61,
16971
+ hex_to_rgba: bind62,
16972
+ img_url: bind63,
16774
16973
  item_count_for_variant: item_count_for_variant_default,
16775
- payment_button: bind61,
16776
- payment_terms: bind62,
16777
- placeholder_svg_tag: bind63,
16778
- shopify_asset_url: bind64,
16779
- structured_data: bind65,
16974
+ payment_button: bind64,
16975
+ payment_terms: bind65,
16976
+ placeholder_svg_tag: bind66,
16977
+ shopify_asset_url: bind67,
16978
+ structured_data: bind68,
16780
16979
  // Swell only
16781
- inline_editable: bind66
16980
+ inline_editable: bind69
16782
16981
  };
16783
16982
  function bindFilters(liquidSwell) {
16784
16983
  for (const [tag, handler] of Object.entries(filters)) {
@@ -16792,8 +16991,8 @@ function bindFilters(liquidSwell) {
16792
16991
  }
16793
16992
  }
16794
16993
  }
16795
- function bindWithResolvedProps(liquidSwell, bind67, resolve = []) {
16796
- const handler = bind67(liquidSwell);
16994
+ function bindWithResolvedProps(liquidSwell, bind70, resolve = []) {
16995
+ const handler = bind70(liquidSwell);
16797
16996
  if (!Array.isArray(resolve)) {
16798
16997
  return handler;
16799
16998
  }
@@ -16845,9 +17044,9 @@ async function resolveAsyncProps(propArg, resolveProps) {
16845
17044
  }
16846
17045
 
16847
17046
  // src/liquid/operators.ts
16848
- var import_liquidjs33 = require("liquidjs");
17047
+ var import_liquidjs38 = require("liquidjs");
16849
17048
  var swellOperators = {
16850
- ...import_liquidjs33.defaultOperators,
17049
+ ...import_liquidjs38.defaultOperators,
16851
17050
  "==": equal,
16852
17051
  "!=": (l, r) => !equal(l, r),
16853
17052
  contains: (l, r) => {
@@ -16875,8 +17074,8 @@ function arrayEqual(lhs, rhs) {
16875
17074
 
16876
17075
  // src/liquid/color.ts
16877
17076
  var import_color = __toESM(require("color"), 1);
16878
- var import_liquidjs34 = require("liquidjs");
16879
- var ThemeColor = class _ThemeColor extends import_liquidjs34.Drop {
17077
+ var import_liquidjs39 = require("liquidjs");
17078
+ var ThemeColor = class _ThemeColor extends import_liquidjs39.Drop {
16880
17079
  color;
16881
17080
  colorValues;
16882
17081
  red;
@@ -16920,10 +17119,16 @@ var ThemeColor = class _ThemeColor extends import_liquidjs34.Drop {
16920
17119
  return this.color.darken(percent / 100).hex().toLowerCase();
16921
17120
  }
16922
17121
  rgb() {
16923
- return this.color.rgb().toString();
17122
+ return `${this.red} ${this.green} ${this.blue}`;
16924
17123
  }
16925
17124
  rgba(alpha) {
16926
- return this.color.alpha(alpha).rgb().toString();
17125
+ const colorValues = this.color.object();
17126
+ const alphaValue = alpha || colorValues.alpha;
17127
+ const rgb = this.rgb();
17128
+ if (alphaValue === void 0) {
17129
+ return rgb;
17130
+ }
17131
+ return `${rgb} / ${Number(alphaValue).toFixed(2)}`;
16927
17132
  }
16928
17133
  hsl() {
16929
17134
  return this.color.hsl().round().toString();
@@ -17011,7 +17216,7 @@ function isThemeColorLike(value) {
17011
17216
  }
17012
17217
 
17013
17218
  // src/liquid/index.ts
17014
- var LiquidSwell31 = class extends import_liquidjs35.Liquid {
17219
+ var LiquidSwell31 = class extends import_liquidjs40.Liquid {
17015
17220
  theme;
17016
17221
  getThemeConfig;
17017
17222
  getThemeTemplateConfigByType;
@@ -17028,6 +17233,7 @@ var LiquidSwell31 = class extends import_liquidjs35.Liquid {
17028
17233
  extName;
17029
17234
  componentsDir;
17030
17235
  sectionsDir;
17236
+ blocksDir;
17031
17237
  lastSchema;
17032
17238
  constructor({
17033
17239
  theme,
@@ -17045,7 +17251,8 @@ var LiquidSwell31 = class extends import_liquidjs35.Liquid {
17045
17251
  layoutName,
17046
17252
  extName,
17047
17253
  componentsDir,
17048
- sectionsDir
17254
+ sectionsDir,
17255
+ blocksDir
17049
17256
  }) {
17050
17257
  getThemeConfig = getThemeConfig || theme.getThemeConfig.bind(theme);
17051
17258
  extName = extName || "liquid";
@@ -17074,6 +17281,7 @@ var LiquidSwell31 = class extends import_liquidjs35.Liquid {
17074
17281
  this.extName = extName;
17075
17282
  this.componentsDir = componentsDir || "components";
17076
17283
  this.sectionsDir = sectionsDir || "sections";
17284
+ this.blocksDir = blocksDir || "blocks";
17077
17285
  this.lastSchema = void 0;
17078
17286
  bindTags(this);
17079
17287
  bindFilters(this);
@@ -17096,6 +17304,9 @@ var LiquidSwell31 = class extends import_liquidjs35.Liquid {
17096
17304
  async getSectionGroupPath(sectionName) {
17097
17305
  return await this.resolveFilePathByType("sections", `${sectionName}.json`) || resolveFilePath(`${this.sectionsDir}/${sectionName}`, "json");
17098
17306
  }
17307
+ async getThemeBlockPath(blockName) {
17308
+ return await this.resolveFilePathByType("blocks", blockName) || resolveFilePath(`${this.blocksDir}/${blockName}`, this.extName);
17309
+ }
17099
17310
  };
17100
17311
  function resolveFilePath(fileName, extName) {
17101
17312
  return `theme/${fileName}.${extName}`;
@@ -17495,11 +17706,11 @@ var ThemeLoader = class _ThemeLoader {
17495
17706
  };
17496
17707
 
17497
17708
  // src/globals.ts
17498
- var import_lodash_es13 = require("lodash-es");
17709
+ var import_lodash_es15 = require("lodash-es");
17499
17710
 
17500
17711
  // src/compatibility/drops/robots-rule.ts
17501
- var import_liquidjs36 = require("liquidjs");
17502
- var RobotsRule = class _RobotsRule extends import_liquidjs36.Drop {
17712
+ var import_liquidjs41 = require("liquidjs");
17713
+ var RobotsRule = class _RobotsRule extends import_liquidjs41.Drop {
17503
17714
  constructor(directive, value) {
17504
17715
  super();
17505
17716
  this.directive = directive;
@@ -17595,7 +17806,7 @@ function getAllCountryOptionTags(geoSettings) {
17595
17806
  }).filter(Boolean).join("\n");
17596
17807
  }
17597
17808
  function getRobotsGlobals(canonicalUrl) {
17598
- const sitemapUrl = `${(0, import_lodash_es13.trimEnd)(canonicalUrl, "/")}/sitemap.xml`;
17809
+ const sitemapUrl = `${(0, import_lodash_es15.trimEnd)(canonicalUrl, "/")}/sitemap.xml`;
17599
17810
  const defaultRules = [
17600
17811
  { directive: "Disallow", value: "/admin" },
17601
17812
  { directive: "Disallow", value: "/cart" },
@@ -18090,7 +18301,7 @@ var SwellTheme3 = class {
18090
18301
  return languageConfig;
18091
18302
  }
18092
18303
  const localeShortCode = locale.split("-")[0];
18093
- return (0, import_lodash_es14.reduce)(
18304
+ return (0, import_lodash_es16.reduce)(
18094
18305
  languageConfig,
18095
18306
  (acc, value, key) => {
18096
18307
  if (isObject2(value)) {
@@ -18114,15 +18325,15 @@ var SwellTheme3 = class {
18114
18325
  const translationEnd = translationParts.pop();
18115
18326
  const translationPath = translationParts.join(".");
18116
18327
  const translationConfigGlobal = this.globals.language;
18117
- acc[key] = (0, import_lodash_es14.get)(
18328
+ acc[key] = (0, import_lodash_es16.get)(
18118
18329
  translationConfigGlobal,
18119
18330
  `${translationPath}.$locale.${locale}.${translationEnd}`
18120
- ) || (0, import_lodash_es14.get)(
18331
+ ) || (0, import_lodash_es16.get)(
18121
18332
  translationConfigGlobal,
18122
18333
  `${translationPath}.$locale.${localeShortCode}.${translationEnd}`
18123
- ) || (0, import_lodash_es14.get)(translationConfigGlobal, translationKey) || value;
18334
+ ) || (0, import_lodash_es16.get)(translationConfigGlobal, translationKey) || value;
18124
18335
  } else {
18125
- acc[key] = (0, import_lodash_es14.get)(languageConfig, `$locale.${locale}.${key}`) || (0, import_lodash_es14.get)(languageConfig, `$locale.${localeShortCode}.${key}`) || value;
18336
+ acc[key] = (0, import_lodash_es16.get)(languageConfig, `$locale.${locale}.${key}`) || (0, import_lodash_es16.get)(languageConfig, `$locale.${localeShortCode}.${key}`) || value;
18126
18337
  }
18127
18338
  }
18128
18339
  return acc;
@@ -18807,6 +19018,30 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18807
19018
  const configs = this.getThemeConfigsByPath("theme/sections/");
18808
19019
  return getAllSections(configs, this.getTemplateSchema.bind(this));
18809
19020
  }
19021
+ /**
19022
+ * Returns all theme block schemas from /blocks folder.
19023
+ */
19024
+ getAllThemeBlockSchemas() {
19025
+ const schemas = [];
19026
+ const configs = this.getThemeConfigsByPath("theme/blocks/");
19027
+ for (const config of configs.values()) {
19028
+ const { name, file_path: filePath, file_data: fileData } = config;
19029
+ const rawSchema = extractSchemaTag(fileData, true);
19030
+ if (!rawSchema) {
19031
+ continue;
19032
+ }
19033
+ try {
19034
+ const schema = import_json56.default.parse(rawSchema);
19035
+ if (!schema.type) {
19036
+ schema.type = name;
19037
+ }
19038
+ schemas.push(schema);
19039
+ } catch (error) {
19040
+ console.warn(`Invalid schema in block: ${filePath}`, error);
19041
+ }
19042
+ }
19043
+ return schemas;
19044
+ }
18810
19045
  async getPageSections(sectionGroup, resolveSettings = true) {
18811
19046
  const sectionConfigs = await getPageSections(
18812
19047
  sectionGroup,
@@ -18958,8 +19193,8 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18958
19193
  const keyParts = key?.split(".") || [];
18959
19194
  const keyName = keyParts.pop() || "";
18960
19195
  const keyPath = keyParts.join(".");
18961
- const langObject = (0, import_lodash_es14.get)(langConfig, keyPath);
18962
- let localeValue = (0, import_lodash_es14.get)(langObject?.[localeCode], keyName) || (0, import_lodash_es14.get)(langObject?.[localeCode.split("-")[0]], keyName) || langObject?.[keyName];
19196
+ const langObject = (0, import_lodash_es16.get)(langConfig, keyPath);
19197
+ let localeValue = (0, import_lodash_es16.get)(langObject?.[localeCode], keyName) || (0, import_lodash_es16.get)(langObject?.[localeCode.split("-")[0]], keyName) || langObject?.[keyName];
18963
19198
  if (data?.count !== void 0 && localeValue?.one) {
18964
19199
  localeValue = data.count === 1 ? localeValue.one : localeValue.other;
18965
19200
  }
@@ -19039,7 +19274,7 @@ function fillDefaultThemeSettings(themeSettings, editorSchemaSettings) {
19039
19274
  }
19040
19275
  }
19041
19276
  function resolveThemeSettings(theme, themeSettings, editorSchemaSettings) {
19042
- const settings = (0, import_lodash_es14.cloneDeep)(themeSettings);
19277
+ const settings = (0, import_lodash_es16.cloneDeep)(themeSettings);
19043
19278
  if (settings.$locale) {
19044
19279
  const { locale } = theme.swell.getStorefrontLocalization();
19045
19280
  const localeConfig = settings.$locale[locale] || {};
@@ -19049,16 +19284,16 @@ function resolveThemeSettings(theme, themeSettings, editorSchemaSettings) {
19049
19284
  }
19050
19285
  }
19051
19286
  }
19052
- (0, import_lodash_es14.each)(settings, (value, key) => {
19287
+ (0, import_lodash_es16.each)(settings, (value, key) => {
19053
19288
  const setting = (editorSchemaSettings && findEditorSetting(editorSchemaSettings, key)) ?? null;
19054
19289
  if (isObject2(value) && !(value instanceof StorefrontResource)) {
19055
19290
  switch (setting?.type) {
19056
19291
  case "color_scheme_group": {
19057
- (0, import_lodash_es14.each)(value, (scheme, schemeId) => {
19292
+ (0, import_lodash_es16.each)(value, (scheme, schemeId) => {
19058
19293
  if (isObject2(scheme) && typeof scheme.settings === "object" && scheme.settings) {
19059
19294
  const settings2 = scheme.settings;
19060
- (0, import_lodash_es14.each)(settings2, (colorValue, colorId) => {
19061
- const fieldDef = (0, import_lodash_es14.find)(setting.fields, { id: colorId });
19295
+ (0, import_lodash_es16.each)(settings2, (colorValue, colorId) => {
19296
+ const fieldDef = (0, import_lodash_es16.find)(setting.fields, { id: colorId });
19062
19297
  if (fieldDef?.type === "color" && colorValue) {
19063
19298
  scheme.id = schemeId;
19064
19299
  settings2[colorId] = new ThemeColor(colorValue);
@@ -19109,7 +19344,7 @@ function resolveThemeSettings(theme, themeSettings, editorSchemaSettings) {
19109
19344
  }
19110
19345
  function findThemeSettingsByType(type, themeSettings, editorSchemaSettings) {
19111
19346
  const foundSettings = [];
19112
- (0, import_lodash_es14.each)(themeSettings, (value, key) => {
19347
+ (0, import_lodash_es16.each)(themeSettings, (value, key) => {
19113
19348
  if (isObject2(value) && !(value instanceof ThemeFont) && !(value instanceof StorefrontResource)) {
19114
19349
  foundSettings.push(
19115
19350
  ...findThemeSettingsByType(type, value, editorSchemaSettings)
@@ -19167,14 +19402,14 @@ function parseJsonConfig(config) {
19167
19402
  return {};
19168
19403
  }
19169
19404
  }
19170
- function extractSchemaTag(template) {
19405
+ function extractSchemaTag(template, inner = false) {
19171
19406
  const list = template.match(
19172
19407
  /\{%-?\s*schema\s*-?%\}(.*)\{%-?\s*endschema\s*-?%\}/s
19173
19408
  );
19174
19409
  if (list === null) {
19175
19410
  return template;
19176
19411
  }
19177
- return list[0];
19412
+ return inner ? list[1] : list[0];
19178
19413
  }
19179
19414
  function withSuffix(path, suffix) {
19180
19415
  return suffix ? `${path}.${suffix}` : path;
@@ -19283,7 +19518,7 @@ function isChildItemActive(items) {
19283
19518
  }
19284
19519
  function getMenuItemValueId(value) {
19285
19520
  const fallback = typeof value === "string" ? value : "";
19286
- const slug = (0, import_lodash_es15.get)(value, "id", (0, import_lodash_es15.get)(value, "slug", fallback)) || "";
19521
+ const slug = (0, import_lodash_es17.get)(value, "id", (0, import_lodash_es17.get)(value, "slug", fallback)) || "";
19287
19522
  return slug;
19288
19523
  }
19289
19524
  async function getMenuItemUrlAndResource(theme, menuItem) {