@swell/apps-sdk 1.0.186 → 1.0.188

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.js CHANGED
@@ -3529,7 +3529,15 @@
3529
3529
  }, {}),
3530
3530
  ...preset.settings || void 0
3531
3531
  },
3532
- blocks: preset.blocks?.map((block) => {
3532
+ blocks: resolveSectionBlockPresets(preset, schema)
3533
+ }));
3534
+ }
3535
+ function resolveSectionBlockPresets(preset, schema) {
3536
+ if (!preset.blocks) {
3537
+ return;
3538
+ }
3539
+ if (Array.isArray(preset.blocks)) {
3540
+ return preset.blocks.map((block) => {
3533
3541
  const blockDef = schema.blocks?.find((b) => b.type === block.type);
3534
3542
  return blockDef ? {
3535
3543
  ...block,
@@ -3543,8 +3551,9 @@
3543
3551
  ...block.settings || void 0
3544
3552
  }
3545
3553
  } : block;
3546
- })
3547
- }));
3554
+ });
3555
+ }
3556
+ return Object.values(preset.blocks);
3548
3557
  }
3549
3558
  async function getLayoutSectionGroups(allSections, renderTemplateSchema) {
3550
3559
  const allSectionsList = Array.from(allSections.values());
@@ -3621,7 +3630,15 @@
3621
3630
  };
3622
3631
  const id = sectionGroup.id ? `page__${sectionGroup.id}__${key}` : schema.id;
3623
3632
  const blockOrder = Array.isArray(section.block_order) ? section.block_order : Object.keys(section.blocks || {});
3624
- const blocks = blockOrder.map((key2) => section.blocks?.[key2]).filter(Boolean);
3633
+ const blocks = blockOrder.map((key2) => {
3634
+ const block = section.blocks?.[key2];
3635
+ if (block) {
3636
+ return {
3637
+ ...block,
3638
+ id: `${schema.id}__${key2}`
3639
+ };
3640
+ }
3641
+ }).filter(Boolean);
3625
3642
  const settings = {
3626
3643
  section: {
3627
3644
  id,
@@ -4843,12 +4860,17 @@
4843
4860
  var SwellVariant = class extends SwellStorefrontRecord {
4844
4861
  product;
4845
4862
  constructor(swell, product, id, query) {
4863
+ const params = swell.queryParams;
4846
4864
  super(swell, "products:variants", id, query, async function() {
4847
4865
  const variant = await this._swell.get(
4848
- "/products:variants/{id}",
4849
- { id: this._id }
4866
+ "/products:variants/:last",
4867
+ { $or: [{ id: this._id }, { sku: this._id }] }
4868
+ );
4869
+ return transformSwellVariant(
4870
+ params,
4871
+ product instanceof SwellStorefrontRecord ? await product.resolve() : product,
4872
+ variant
4850
4873
  );
4851
- return variant ?? null;
4852
4874
  });
4853
4875
  this.product = product;
4854
4876
  }
@@ -5615,7 +5637,7 @@ ${formattedMessage}`;
5615
5637
  // TODO: figure out how to make this work, doesn't work for collections normally
5616
5638
  defaultValue: section.presets?.reduce(
5617
5639
  (acc, preset, index) => {
5618
- if (!preset.blocks) {
5640
+ if (!preset.blocks || !Array.isArray(preset.blocks)) {
5619
5641
  return acc;
5620
5642
  }
5621
5643
  return preset.blocks.reduce(
@@ -5822,7 +5844,7 @@ ${formattedMessage}`;
5822
5844
  custom_css: preset.settings?.["custom_css"] || "",
5823
5845
  ...processFields(section.fields, preset.settings),
5824
5846
  // Process blocks inside the preset
5825
- Blocks: (preset.blocks || []).map((block) => {
5847
+ Blocks: (Array.isArray(preset.blocks) ? preset.blocks : []).map((block) => {
5826
5848
  const blockSchema = section.blocks?.find(
5827
5849
  ({ type }) => type === block.type
5828
5850
  );
@@ -6282,11 +6304,11 @@ ${formattedMessage}`;
6282
6304
  }
6283
6305
 
6284
6306
  // src/menus.ts
6285
- var import_lodash_es15 = __require("lodash-es");
6307
+ var import_lodash_es17 = __require("lodash-es");
6286
6308
 
6287
6309
  // src/theme.ts
6288
6310
  var import_json56 = __toESM(__require("json5"), 1);
6289
- var import_lodash_es14 = __require("lodash-es");
6311
+ var import_lodash_es16 = __require("lodash-es");
6290
6312
 
6291
6313
  // src/compatibility/shopify.ts
6292
6314
  var import_lodash_es7 = __require("lodash-es");
@@ -11581,16 +11603,16 @@ ${formattedMessage}`;
11581
11603
  if (!Array.isArray(blogs?.results)) {
11582
11604
  return [];
11583
11605
  }
11584
- const set3 = blogs.results.reduce(
11585
- (set4, blog) => {
11606
+ const set4 = blogs.results.reduce(
11607
+ (set5, blog) => {
11586
11608
  for (const tag of blog.tags || []) {
11587
- set4.add(tag);
11609
+ set5.add(tag);
11588
11610
  }
11589
- return set4;
11611
+ return set5;
11590
11612
  },
11591
11613
  /* @__PURE__ */ new Set()
11592
11614
  );
11593
- return Array.from(set3.values());
11615
+ return Array.from(set4.values());
11594
11616
  });
11595
11617
  return new ShopifyResource({
11596
11618
  all_tags: allTags,
@@ -11974,18 +11996,18 @@ ${formattedMessage}`;
11974
11996
  if (!resolved) {
11975
11997
  return [];
11976
11998
  }
11977
- const set3 = /* @__PURE__ */ new Set();
11999
+ const set4 = /* @__PURE__ */ new Set();
11978
12000
  await Promise.all(
11979
12001
  resolved.results.map(async (product) => {
11980
12002
  const tags2 = await Promise.resolve().then(() => product.tags);
11981
12003
  if (Array.isArray(tags2)) {
11982
12004
  for (const tag of tags2) {
11983
- set3.add(tag);
12005
+ set4.add(tag);
11984
12006
  }
11985
12007
  }
11986
12008
  })
11987
12009
  );
11988
- return Array.from(set3.values());
12010
+ return Array.from(set4.values());
11989
12011
  }),
11990
12012
  all_types: defer(async () => {
11991
12013
  const products = await resolveProducts();
@@ -14573,6 +14595,8 @@ ${injects.join("\n")}<\/script>`;
14573
14595
  return `templates/${this.getPageType(name)}`;
14574
14596
  case "sections":
14575
14597
  return `sections/${name}`;
14598
+ case "blocks":
14599
+ return `blocks/${name}`;
14576
14600
  default:
14577
14601
  throw new Error(`Theme file type not supported: ${type}`);
14578
14602
  }
@@ -14746,7 +14770,7 @@ ${injects.join("\n")}<\/script>`;
14746
14770
  };
14747
14771
 
14748
14772
  // src/liquid/index.ts
14749
- var import_liquidjs35 = __require("liquidjs");
14773
+ var import_liquidjs40 = __require("liquidjs");
14750
14774
 
14751
14775
  // src/utils/escape.ts
14752
14776
  function replacerUnescape(match) {
@@ -14919,14 +14943,161 @@ ${injects.join("\n")}<\/script>`;
14919
14943
  };
14920
14944
  }
14921
14945
 
14922
- // src/liquid/tags/for.ts
14946
+ // src/liquid/tags/content_for.ts
14947
+ var import_liquidjs22 = __require("liquidjs");
14948
+ var import_lodash_es10 = __require("lodash-es");
14949
+
14950
+ // src/liquid/hash.ts
14951
+ var import_lodash_es9 = __require("lodash-es");
14952
+ var import_liquidjs21 = __require("liquidjs");
14953
+
14954
+ // src/liquid/tokienizer.ts
14955
+ var import_liquidjs20 = __require("liquidjs");
14956
+
14957
+ // src/liquid/tokens/identifier-token.ts
14923
14958
  var import_liquidjs19 = __require("liquidjs");
14959
+ var IdentifierToken = class extends import_liquidjs19.Token {
14960
+ constructor(input, begin, end, file) {
14961
+ super(import_liquidjs19.TokenKind.Word, input, begin, end, file);
14962
+ this.input = input;
14963
+ this.begin = begin;
14964
+ this.end = end;
14965
+ this.file = file;
14966
+ this.content = this.getText();
14967
+ }
14968
+ content;
14969
+ };
14970
+
14971
+ // src/liquid/tokienizer.ts
14972
+ var isNumber2 = (c) => c >= "0" && c <= "9";
14973
+ var isCharacter = (c) => c >= "a" && c <= "z" || c >= "A" && c <= "Z";
14974
+ var isWord = (c) => "_-?".includes(c) || isCharacter(c) || isNumber2(c);
14975
+ var TokenizerSwell = class extends import_liquidjs20.Tokenizer {
14976
+ readIdentifier() {
14977
+ this.skipBlank();
14978
+ const begin = this.p;
14979
+ while (!this.end()) {
14980
+ const char = this.peek();
14981
+ if (isWord(char) || char === ".") {
14982
+ this.p++;
14983
+ } else {
14984
+ break;
14985
+ }
14986
+ }
14987
+ return new IdentifierToken(this.input, begin, this.p, this.file);
14988
+ }
14989
+ };
14990
+
14991
+ // src/liquid/hash.ts
14992
+ var HashSwell = class extends import_liquidjs21.Hash {
14993
+ constructor(input, jekyllStyle) {
14994
+ super(input, jekyllStyle);
14995
+ const tokenizer = input instanceof import_liquidjs21.Tokenizer ? input : new TokenizerSwell(input, {});
14996
+ for (const hash of tokenizer.readHashes(jekyllStyle)) {
14997
+ this.hash[hash.name.content] = hash.value;
14998
+ }
14999
+ }
15000
+ *render(ctx) {
15001
+ const hash = {};
15002
+ for (const key of Object.keys(this.hash)) {
15003
+ const token = this.hash[key];
15004
+ if (token !== void 0) {
15005
+ const value = yield (0, import_liquidjs21.evalToken)(token, ctx);
15006
+ (0, import_lodash_es9.set)(hash, key, value);
15007
+ }
15008
+ }
15009
+ return hash;
15010
+ }
15011
+ };
15012
+
15013
+ // src/liquid/tags/content_for.ts
15014
+ function bind4(liquidSwell) {
15015
+ return class ContentForTag extends import_liquidjs22.Tag {
15016
+ name;
15017
+ hash;
15018
+ constructor(token, remainTokens, liquid) {
15019
+ super(token, remainTokens, liquid);
15020
+ const tokenizer = token.tokenizer;
15021
+ this.name = tokenizer.readValue()?.content;
15022
+ this.hash = new HashSwell(tokenizer.remaining());
15023
+ }
15024
+ *render(ctx, emitter) {
15025
+ const section = yield ctx._get(["section"]);
15026
+ const block = yield ctx._get(["block"]);
15027
+ const hash = yield this.hash.render(ctx);
15028
+ const blocks = this.getBlocks(section, block, hash);
15029
+ for (const block2 of blocks) {
15030
+ if (!isObject2(block2) || typeof block2.type !== "string") {
15031
+ continue;
15032
+ }
15033
+ const blockPath = yield liquidSwell.getThemeBlockPath(
15034
+ block2.type
15035
+ );
15036
+ if (!blockPath) {
15037
+ continue;
15038
+ }
15039
+ const childCtx = ctx.spawn();
15040
+ const scope = childCtx.bottom();
15041
+ (0, import_lodash_es10.assign)(scope, { section });
15042
+ (0, import_lodash_es10.assign)(scope, { block: block2 });
15043
+ (0, import_lodash_es10.assign)(scope, hash);
15044
+ const templates = yield this.liquid._parseFile(
15045
+ blockPath,
15046
+ childCtx.sync
15047
+ );
15048
+ yield this.liquid.renderer.renderTemplates(
15049
+ templates,
15050
+ childCtx,
15051
+ emitter
15052
+ );
15053
+ }
15054
+ }
15055
+ getBlocks(section, block, hash) {
15056
+ const blockConfigs = this.getBlockConfigs(section, block);
15057
+ if (!isObject2(hash) || !hash.type) {
15058
+ return blockConfigs;
15059
+ }
15060
+ const blockConfig = blockConfigs.find(
15061
+ (blockConfig2) => isObject2(blockConfig2) && blockConfig2.type === hash.type
15062
+ );
15063
+ return blockConfig ? [blockConfig] : [];
15064
+ }
15065
+ getBlockConfigs(section, block) {
15066
+ if (isObject2(block) && block.blocks) {
15067
+ return Object.values(block.blocks);
15068
+ }
15069
+ if (isObject2(section) && Array.isArray(section.blocks)) {
15070
+ return section.blocks;
15071
+ }
15072
+ return [];
15073
+ }
15074
+ };
15075
+ }
15076
+
15077
+ // src/liquid/tags/doc.ts
15078
+ var import_liquidjs23 = __require("liquidjs");
15079
+ function bind5() {
15080
+ return class DocTag extends import_liquidjs23.Tag {
15081
+ constructor(token, remainTokens, liquid, parser) {
15082
+ super(token, remainTokens, liquid);
15083
+ const stream = parser.parseStream(remainTokens).on("tag:enddoc", () => {
15084
+ stream.stop();
15085
+ });
15086
+ stream.start();
15087
+ }
15088
+ render() {
15089
+ }
15090
+ };
15091
+ }
15092
+
15093
+ // src/liquid/tags/for.ts
15094
+ var import_liquidjs24 = __require("liquidjs");
14924
15095
  var MODIFIERS = Object.freeze(["offset", "limit", "reversed"]);
14925
- function bind4(_liquidSwell) {
14926
- return class ForTag extends import_liquidjs19.ForTag {
15096
+ function bind6(_liquidSwell) {
15097
+ return class ForTag extends import_liquidjs24.ForTag {
14927
15098
  *render(ctx, emitter) {
14928
15099
  const r = this.liquid.renderer;
14929
- let collection = yield (0, import_liquidjs19.evalToken)(this.collection, ctx);
15100
+ let collection = yield (0, import_liquidjs24.evalToken)(this.collection, ctx);
14930
15101
  collection = yield resolveEnumerable(collection);
14931
15102
  if (!collection.length) {
14932
15103
  yield r.renderTemplates(this.elseTemplates, ctx, emitter);
@@ -14993,10 +15164,10 @@ ${injects.join("\n")}<\/script>`;
14993
15164
  }
14994
15165
 
14995
15166
  // src/liquid/tags/form.ts
14996
- var import_liquidjs20 = __require("liquidjs");
15167
+ var import_liquidjs25 = __require("liquidjs");
14997
15168
  var IGNORED_SHOPIFY_FORMS = Object.freeze(["new_comment", "guest_login"]);
14998
- function bind5(liquidSwell) {
14999
- return class FormTag extends import_liquidjs20.Tag {
15169
+ function bind7(liquidSwell) {
15170
+ return class FormTag extends import_liquidjs25.Tag {
15000
15171
  formType;
15001
15172
  formConfig;
15002
15173
  templates;
@@ -15009,10 +15180,10 @@ ${injects.join("\n")}<\/script>`;
15009
15180
  this.formConfig = liquidSwell.theme.getFormConfig(this.formType);
15010
15181
  this.arg = tokenizer.readValue();
15011
15182
  this.templates = [];
15012
- this.hash = new import_liquidjs20.Hash(this.tokenizer.remaining());
15183
+ this.hash = new import_liquidjs25.Hash(this.tokenizer.remaining());
15013
15184
  while (remainTokens.length > 0) {
15014
15185
  const token2 = remainTokens.shift();
15015
- if (import_liquidjs20.TypeGuards.isTagToken(token2) && token2.name === "endform") {
15186
+ if (import_liquidjs25.TypeGuards.isTagToken(token2) && token2.name === "endform") {
15016
15187
  return;
15017
15188
  }
15018
15189
  this.templates.push(parser.parseToken(token2, remainTokens));
@@ -15030,7 +15201,7 @@ ${injects.join("\n")}<\/script>`;
15030
15201
  return;
15031
15202
  }
15032
15203
  const r = this.liquid.renderer;
15033
- const arg = yield (0, import_liquidjs20.evalToken)(this.arg, ctx);
15204
+ const arg = yield (0, import_liquidjs25.evalToken)(this.arg, ctx);
15034
15205
  const hash = yield this.hash.render(ctx);
15035
15206
  const scope = ctx.getAll();
15036
15207
  const attrs = " " + Object.entries({ id: `${this.formConfig.id}_form`, ...hash }).reduce((acc, [key, value]) => {
@@ -15091,9 +15262,9 @@ ${injects.join("\n")}<\/script>`;
15091
15262
  }
15092
15263
 
15093
15264
  // src/liquid/tags/if.ts
15094
- var import_liquidjs21 = __require("liquidjs");
15095
- function bind6(_liquidSwell) {
15096
- return class IfTag extends import_liquidjs21.Tag {
15265
+ var import_liquidjs26 = __require("liquidjs");
15266
+ function bind8(_liquidSwell) {
15267
+ return class IfTag extends import_liquidjs26.Tag {
15097
15268
  branches = [];
15098
15269
  elseTemplates;
15099
15270
  constructor(tagToken, remainTokens, liquid, parser) {
@@ -15102,22 +15273,22 @@ ${injects.join("\n")}<\/script>`;
15102
15273
  parser.parseStream(remainTokens).on(
15103
15274
  "start",
15104
15275
  () => this.branches.push({
15105
- value: new import_liquidjs21.Value(
15276
+ value: new import_liquidjs26.Value(
15106
15277
  tagToken.tokenizer.readFilteredValue(),
15107
15278
  this.liquid
15108
15279
  ),
15109
15280
  templates: p = []
15110
15281
  })
15111
15282
  ).on("tag:elsif", (token) => {
15112
- (0, import_liquidjs21.assert)(!this.elseTemplates, "unexpected elsif after else");
15283
+ (0, import_liquidjs26.assert)(!this.elseTemplates, "unexpected elsif after else");
15113
15284
  this.branches.push({
15114
- value: new import_liquidjs21.Value(token.tokenizer.readFilteredValue(), this.liquid),
15285
+ value: new import_liquidjs26.Value(token.tokenizer.readFilteredValue(), this.liquid),
15115
15286
  templates: p = []
15116
15287
  });
15117
15288
  }).on("tag:else", (tag) => {
15118
15289
  if (tag.args.length > 0) {
15119
15290
  this.branches.push({
15120
- value: new import_liquidjs21.Value(tag.tokenizer.readFilteredValue(), this.liquid),
15291
+ value: new import_liquidjs26.Value(tag.tokenizer.readFilteredValue(), this.liquid),
15121
15292
  templates: p = []
15122
15293
  });
15123
15294
  } else {
@@ -15135,7 +15306,7 @@ ${injects.join("\n")}<\/script>`;
15135
15306
  const r = this.liquid.renderer;
15136
15307
  for (const { value, templates } of this.branches) {
15137
15308
  const v = yield value.value(ctx, ctx.opts.lenientIf);
15138
- if ((0, import_liquidjs21.isTruthy)(v, ctx)) {
15309
+ if ((0, import_liquidjs26.isTruthy)(v, ctx)) {
15139
15310
  yield r.renderTemplates(templates, ctx, emitter);
15140
15311
  return;
15141
15312
  }
@@ -15156,20 +15327,20 @@ ${injects.join("\n")}<\/script>`;
15156
15327
  };
15157
15328
  }
15158
15329
  function assertEmpty(predicate, message = `unexpected ${JSON.stringify(predicate)}`) {
15159
- (0, import_liquidjs21.assert)(!predicate, message);
15330
+ (0, import_liquidjs26.assert)(!predicate, message);
15160
15331
  }
15161
15332
 
15162
15333
  // src/liquid/tags/javascript.ts
15163
- var import_liquidjs22 = __require("liquidjs");
15164
- function bind7(_liquidSwell) {
15165
- return class JavascriptTag extends import_liquidjs22.Tag {
15334
+ var import_liquidjs27 = __require("liquidjs");
15335
+ function bind9(_liquidSwell) {
15336
+ return class JavascriptTag extends import_liquidjs27.Tag {
15166
15337
  templates;
15167
15338
  constructor(token, remainTokens, liquid, parser) {
15168
15339
  super(token, remainTokens, liquid);
15169
15340
  this.templates = [];
15170
15341
  while (remainTokens.length > 0) {
15171
15342
  const token2 = remainTokens.shift();
15172
- if (import_liquidjs22.TypeGuards.isTagToken(token2) && token2.name === "endjavascript") {
15343
+ if (import_liquidjs27.TypeGuards.isTagToken(token2) && token2.name === "endjavascript") {
15173
15344
  return;
15174
15345
  }
15175
15346
  this.templates.push(parser.parseToken(token2, remainTokens));
@@ -15187,9 +15358,9 @@ ${injects.join("\n")}<\/script>`;
15187
15358
  }
15188
15359
 
15189
15360
  // src/liquid/tags/layout.ts
15190
- var import_liquidjs23 = __require("liquidjs");
15191
- function bind8(liquidSwell) {
15192
- return class LayoutTag extends import_liquidjs23.Tag {
15361
+ var import_liquidjs28 = __require("liquidjs");
15362
+ function bind10(liquidSwell) {
15363
+ return class LayoutTag extends import_liquidjs28.Tag {
15193
15364
  fileName;
15194
15365
  constructor(token, remainTokens, liquid, _parser) {
15195
15366
  super(token, remainTokens, liquid);
@@ -15205,9 +15376,9 @@ ${injects.join("\n")}<\/script>`;
15205
15376
  }
15206
15377
 
15207
15378
  // src/liquid/tags/paginate.ts
15208
- var import_liquidjs24 = __require("liquidjs");
15209
- function bind9(liquidSwell) {
15210
- return class PaginateTag extends import_liquidjs24.Tag {
15379
+ var import_liquidjs29 = __require("liquidjs");
15380
+ function bind11(liquidSwell) {
15381
+ return class PaginateTag extends import_liquidjs29.Tag {
15211
15382
  collection;
15212
15383
  pageSize;
15213
15384
  templates;
@@ -15222,7 +15393,7 @@ ${injects.join("\n")}<\/script>`;
15222
15393
  }
15223
15394
  this.templates = [];
15224
15395
  this.collection = collection;
15225
- this.hash = new import_liquidjs24.Hash(this.tokenizer.remaining());
15396
+ this.hash = new import_liquidjs29.Hash(this.tokenizer.remaining());
15226
15397
  const stream = parser.parseStream(remainTokens).on("tag:endpaginate", () => stream.stop()).on("template", (tpl) => {
15227
15398
  this.templates.push(tpl);
15228
15399
  }).on("end", () => {
@@ -15232,8 +15403,8 @@ ${injects.join("\n")}<\/script>`;
15232
15403
  }
15233
15404
  *render(ctx, emitter) {
15234
15405
  const r = this.liquid.renderer;
15235
- const collection = yield (0, import_liquidjs24.evalToken)(this.collection, ctx);
15236
- const pageSize = Number(yield (0, import_liquidjs24.evalToken)(this.pageSize, ctx));
15406
+ const collection = yield (0, import_liquidjs29.evalToken)(this.collection, ctx);
15407
+ const pageSize = Number(yield (0, import_liquidjs29.evalToken)(this.pageSize, ctx));
15237
15408
  const hash = yield this.hash.render(ctx);
15238
15409
  if (!Number.isNaN(pageSize) && collection instanceof SwellStorefrontCollection && collection.limit !== pageSize) {
15239
15410
  yield collection._get({
@@ -15259,10 +15430,10 @@ ${injects.join("\n")}<\/script>`;
15259
15430
  }
15260
15431
 
15261
15432
  // src/liquid/tags/render.ts
15262
- var import_lodash_es9 = __require("lodash-es");
15263
- var import_liquidjs25 = __require("liquidjs");
15264
- function bind10(liquidSwell) {
15265
- return class RenderTag extends import_liquidjs25.RenderTag {
15433
+ var import_lodash_es11 = __require("lodash-es");
15434
+ var import_liquidjs30 = __require("liquidjs");
15435
+ function bind12(liquidSwell) {
15436
+ return class RenderTag extends import_liquidjs30.RenderTag {
15266
15437
  *render(ctx, emitter) {
15267
15438
  const self = this;
15268
15439
  const { liquid } = this;
@@ -15272,23 +15443,26 @@ ${injects.join("\n")}<\/script>`;
15272
15443
  ctx,
15273
15444
  liquid
15274
15445
  );
15275
- (0, import_liquidjs25.assert)(filename, () => `illegal file path "${filename}"`);
15446
+ (0, import_liquidjs30.assert)(filename, () => `illegal file path "${filename}"`);
15276
15447
  const configPath = yield liquidSwell.getComponentPath(
15277
15448
  filename
15278
15449
  );
15279
15450
  const childCtx = ctx.spawn();
15280
15451
  const scope = childCtx.bottom();
15281
- (0, import_lodash_es9.assign)(scope, yield hash.render(ctx));
15452
+ (0, import_lodash_es11.assign)(scope, ctx.bottom());
15282
15453
  const parentSection = yield ctx._get(["section"]);
15283
- if (parentSection) (0, import_lodash_es9.assign)(scope, { section: parentSection });
15454
+ if (parentSection) (0, import_lodash_es11.assign)(scope, { section: parentSection });
15455
+ const parentBlock = yield ctx._get(["block"]);
15456
+ if (parentBlock) (0, import_lodash_es11.assign)(scope, { block: parentBlock });
15457
+ (0, import_lodash_es11.assign)(scope, yield hash.render(ctx));
15284
15458
  if (self["with"]) {
15285
15459
  const { value, alias } = self["with"];
15286
15460
  const aliasName = alias || filename;
15287
- scope[aliasName] = yield (0, import_liquidjs25.evalToken)(value, ctx);
15461
+ scope[aliasName] = yield (0, import_liquidjs30.evalToken)(value, ctx);
15288
15462
  }
15289
15463
  if (self["for"]) {
15290
15464
  const { value, alias } = self["for"];
15291
- let collection = yield (0, import_liquidjs25.evalToken)(value, ctx);
15465
+ let collection = yield (0, import_liquidjs30.evalToken)(value, ctx);
15292
15466
  collection = yield resolveEnumerable(collection);
15293
15467
  scope["forloop"] = new ForloopDrop(
15294
15468
  collection.length,
@@ -15331,13 +15505,13 @@ ${injects.join("\n")}<\/script>`;
15331
15505
  default:
15332
15506
  break;
15333
15507
  }
15334
- return yield (0, import_liquidjs25.evalToken)(file, ctx);
15508
+ return yield (0, import_liquidjs30.evalToken)(file, ctx);
15335
15509
  }
15336
15510
 
15337
15511
  // src/liquid/tags/section.ts
15338
- var import_liquidjs26 = __require("liquidjs");
15339
- function bind11(liquidSwell) {
15340
- return class SectionTag extends import_liquidjs26.Tag {
15512
+ var import_liquidjs31 = __require("liquidjs");
15513
+ function bind13(liquidSwell) {
15514
+ return class SectionTag extends import_liquidjs31.Tag {
15341
15515
  fileName;
15342
15516
  constructor(token, remainTokens, liquid, _parser) {
15343
15517
  super(token, remainTokens, liquid);
@@ -15388,10 +15562,10 @@ ${injects.join("\n")}<\/script>`;
15388
15562
  }
15389
15563
 
15390
15564
  // src/liquid/tags/sections.ts
15391
- var import_liquidjs27 = __require("liquidjs");
15565
+ var import_liquidjs32 = __require("liquidjs");
15392
15566
  var import_json54 = __toESM(__require("json5"), 1);
15393
- function bind12(liquidSwell) {
15394
- return class SectionsTag extends import_liquidjs27.Tag {
15567
+ function bind14(liquidSwell) {
15568
+ return class SectionsTag extends import_liquidjs32.Tag {
15395
15569
  fileName;
15396
15570
  constructor(token, remainTokens, liquid, _parser) {
15397
15571
  super(token, remainTokens, liquid);
@@ -15431,9 +15605,9 @@ ${injects.join("\n")}<\/script>`;
15431
15605
  }
15432
15606
 
15433
15607
  // src/liquid/tags/style.ts
15434
- var import_liquidjs28 = __require("liquidjs");
15435
- function bind13(_liquidSwell) {
15436
- return class StyleTag extends import_liquidjs28.Tag {
15608
+ var import_liquidjs33 = __require("liquidjs");
15609
+ function bind15(_liquidSwell) {
15610
+ return class StyleTag extends import_liquidjs33.Tag {
15437
15611
  templates;
15438
15612
  hash;
15439
15613
  constructor(token, remainTokens, liquid, parser) {
@@ -15442,7 +15616,7 @@ ${injects.join("\n")}<\/script>`;
15442
15616
  const tagBegin = token.begin;
15443
15617
  while (remainTokens.length > 0) {
15444
15618
  const token2 = remainTokens.shift();
15445
- if (import_liquidjs28.TypeGuards.isTagToken(token2) && token2.name === "endstyle") {
15619
+ if (import_liquidjs33.TypeGuards.isTagToken(token2) && token2.name === "endstyle") {
15446
15620
  this.hash = md5(token2.input.slice(tagBegin, token2.end));
15447
15621
  return;
15448
15622
  }
@@ -15465,16 +15639,16 @@ ${injects.join("\n")}<\/script>`;
15465
15639
  }
15466
15640
 
15467
15641
  // src/liquid/tags/stylesheet.ts
15468
- var import_liquidjs29 = __require("liquidjs");
15469
- function bind14(_liquidSwell) {
15470
- return class StyleSheetTag extends import_liquidjs29.Tag {
15642
+ var import_liquidjs34 = __require("liquidjs");
15643
+ function bind16(_liquidSwell) {
15644
+ return class StyleSheetTag extends import_liquidjs34.Tag {
15471
15645
  templates;
15472
15646
  constructor(token, remainTokens, liquid, parser) {
15473
15647
  super(token, remainTokens, liquid);
15474
15648
  this.templates = [];
15475
15649
  while (remainTokens.length > 0) {
15476
15650
  const token2 = remainTokens.shift();
15477
- if (import_liquidjs29.TypeGuards.isTagToken(token2) && token2.name === "endstylesheet") {
15651
+ if (import_liquidjs34.TypeGuards.isTagToken(token2) && token2.name === "endstylesheet") {
15478
15652
  return;
15479
15653
  }
15480
15654
  this.templates.push(parser.parseToken(token2, remainTokens));
@@ -15490,9 +15664,9 @@ ${injects.join("\n")}<\/script>`;
15490
15664
  }
15491
15665
 
15492
15666
  // src/liquid/tags/shopify/include.ts
15493
- var import_liquidjs30 = __require("liquidjs");
15494
- function bind15(liquidSwell) {
15495
- return class IncludeTag extends import_liquidjs30.IncludeTag {
15667
+ var import_liquidjs35 = __require("liquidjs");
15668
+ function bind17(liquidSwell) {
15669
+ return class IncludeTag extends import_liquidjs35.IncludeTag {
15496
15670
  *render(ctx, emitter) {
15497
15671
  const { hash } = this;
15498
15672
  const filepath = yield renderFilePath(
@@ -15500,13 +15674,13 @@ ${injects.join("\n")}<\/script>`;
15500
15674
  ctx,
15501
15675
  this.liquid
15502
15676
  );
15503
- (0, import_liquidjs30.assert)(filepath, () => `illegal file path "${filepath}"`);
15677
+ (0, import_liquidjs35.assert)(filepath, () => `illegal file path "${filepath}"`);
15504
15678
  const saved = ctx.saveRegister("blocks", "blockMode");
15505
15679
  ctx.setRegister("blocks", {});
15506
15680
  ctx.setRegister("blockMode", 0);
15507
15681
  const scope = yield hash.render(ctx);
15508
15682
  if (this.withVar) {
15509
- scope[filepath] = yield (0, import_liquidjs30.evalToken)(this.withVar, ctx);
15683
+ scope[filepath] = yield (0, import_liquidjs35.evalToken)(this.withVar, ctx);
15510
15684
  }
15511
15685
  ctx.push(ctx.opts.jekyllInclude ? { include: scope } : scope);
15512
15686
  const output = yield liquidSwell.getComponentPath(filepath).then((path) => liquidSwell.getThemeConfig(path)).then((themeConfig) => liquidSwell.renderTemplate(themeConfig, ctx));
@@ -15518,10 +15692,10 @@ ${injects.join("\n")}<\/script>`;
15518
15692
  }
15519
15693
 
15520
15694
  // src/liquid/tags/shopify/schema.ts
15521
- var import_liquidjs31 = __require("liquidjs");
15695
+ var import_liquidjs36 = __require("liquidjs");
15522
15696
  var import_json55 = __toESM(__require("json5"), 1);
15523
- function bind16(liquidSwell) {
15524
- return class SchemaTag extends import_liquidjs31.Tag {
15697
+ function bind18(liquidSwell) {
15698
+ return class SchemaTag extends import_liquidjs36.Tag {
15525
15699
  templates;
15526
15700
  constructor(token, remainTokens, liquid, parser) {
15527
15701
  super(token, remainTokens, liquid);
@@ -15543,6 +15717,7 @@ ${injects.join("\n")}<\/script>`;
15543
15717
  liquidSwell.lastSchema = void 0;
15544
15718
  if (typeof jsonOutput === "string") {
15545
15719
  liquidSwell.lastSchema = import_json55.default.parse(jsonOutput);
15720
+ expandThemeBlocks(liquidSwell);
15546
15721
  }
15547
15722
  } catch (err) {
15548
15723
  console.warn(err);
@@ -15552,11 +15727,22 @@ ${injects.join("\n")}<\/script>`;
15552
15727
  }
15553
15728
  };
15554
15729
  }
15730
+ function expandThemeBlocks(liquidSwell) {
15731
+ const blocks = liquidSwell.lastSchema?.blocks;
15732
+ if (!Array.isArray(blocks)) {
15733
+ return;
15734
+ }
15735
+ for (let i = 0; i < blocks.length; i++) {
15736
+ if (blocks[i].type === "@theme") {
15737
+ blocks.splice(i, 1, ...liquidSwell.theme.getAllThemeBlockSchemas());
15738
+ }
15739
+ }
15740
+ }
15555
15741
 
15556
15742
  // src/liquid/tags/inline_editable.ts
15557
- var import_liquidjs32 = __require("liquidjs");
15558
- function bind17(_liquidSwell) {
15559
- return class InlineEditableTag extends import_liquidjs32.Tag {
15743
+ var import_liquidjs37 = __require("liquidjs");
15744
+ function bind19(_liquidSwell) {
15745
+ return class InlineEditableTag extends import_liquidjs37.Tag {
15560
15746
  key;
15561
15747
  value;
15562
15748
  constructor(token, remainTokens, liquid, _parser) {
@@ -15584,129 +15770,131 @@ ${injects.join("\n")}<\/script>`;
15584
15770
  assign: bind,
15585
15771
  case: bind2,
15586
15772
  comment: bind3,
15587
- for: bind4,
15588
- form: bind5,
15589
- if: bind6,
15590
- javascript: bind7,
15591
- layout: bind8,
15592
- paginate: bind9,
15593
- render: bind10,
15594
- section: bind11,
15595
- sections: bind12,
15596
- style: bind13,
15773
+ content_for: bind4,
15774
+ doc: bind5,
15775
+ for: bind6,
15776
+ form: bind7,
15777
+ if: bind8,
15778
+ javascript: bind9,
15779
+ layout: bind10,
15780
+ paginate: bind11,
15781
+ render: bind12,
15782
+ section: bind13,
15783
+ sections: bind14,
15784
+ style: bind15,
15597
15785
  // Shopify compatibility only
15598
- include: bind15,
15599
- schema: bind16,
15600
- stylesheet: bind14,
15786
+ include: bind17,
15787
+ schema: bind18,
15788
+ stylesheet: bind16,
15601
15789
  // Swell only
15602
- inline_editable: bind17
15790
+ inline_editable: bind19
15603
15791
  };
15604
15792
  function bindTags(liquidSwell) {
15605
15793
  Object.entries(tags).forEach(
15606
- ([tag, bind67]) => liquidSwell.registerTag(tag, bind67(liquidSwell))
15794
+ ([tag, bind70]) => liquidSwell.registerTag(tag, bind70(liquidSwell))
15607
15795
  );
15608
15796
  }
15609
15797
 
15610
15798
  // src/liquid/filters/asset_url.ts
15611
- function bind18(liquidSwell) {
15799
+ function bind20(liquidSwell) {
15612
15800
  return function filterAssetUrl(assetPath) {
15613
15801
  return liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
15614
15802
  };
15615
15803
  }
15616
15804
 
15617
15805
  // src/liquid/filters/brightness_difference.ts
15618
- function bind19(_liquidSwell) {
15806
+ function bind21(_liquidSwell) {
15619
15807
  return (color1, color2) => {
15620
15808
  return ThemeColor.get(color1).brightnessDifference(ThemeColor.get(color2));
15621
15809
  };
15622
15810
  }
15623
15811
 
15624
15812
  // src/liquid/filters/color_brightness.ts
15625
- function bind20(_liquidSwell) {
15813
+ function bind22(_liquidSwell) {
15626
15814
  return (color) => {
15627
15815
  return ThemeColor.get(color).brightness();
15628
15816
  };
15629
15817
  }
15630
15818
 
15631
15819
  // src/liquid/filters/color_contrast.ts
15632
- function bind21(_liquidSwell) {
15820
+ function bind23(_liquidSwell) {
15633
15821
  return (color1, color2) => {
15634
15822
  return ThemeColor.get(color1).contrast(ThemeColor.get(color2));
15635
15823
  };
15636
15824
  }
15637
15825
 
15638
15826
  // src/liquid/filters/color_darken.ts
15639
- function bind22(_liquidSwell) {
15827
+ function bind24(_liquidSwell) {
15640
15828
  return (color, percent) => {
15641
15829
  return ThemeColor.get(color).darken(percent);
15642
15830
  };
15643
15831
  }
15644
15832
 
15645
15833
  // src/liquid/filters/color_desaturate.ts
15646
- function bind23(_liquidSwell) {
15834
+ function bind25(_liquidSwell) {
15647
15835
  return (color, value) => {
15648
15836
  return ThemeColor.get(color).desaturate(value);
15649
15837
  };
15650
15838
  }
15651
15839
 
15652
15840
  // src/liquid/filters/color_difference.ts
15653
- function bind24(_liquidSwell) {
15841
+ function bind26(_liquidSwell) {
15654
15842
  return (color1, color2) => {
15655
15843
  return ThemeColor.get(color1).difference(ThemeColor.get(color2));
15656
15844
  };
15657
15845
  }
15658
15846
 
15659
15847
  // src/liquid/filters/color_extract.ts
15660
- function bind25(_liquidSwell) {
15848
+ function bind27(_liquidSwell) {
15661
15849
  return (color, field) => {
15662
15850
  return ThemeColor.get(color).extract(field);
15663
15851
  };
15664
15852
  }
15665
15853
 
15666
15854
  // src/liquid/filters/color_lighten.ts
15667
- function bind26(_liquidSwell) {
15855
+ function bind28(_liquidSwell) {
15668
15856
  return (color, percent) => {
15669
15857
  return ThemeColor.get(color).lighten(percent);
15670
15858
  };
15671
15859
  }
15672
15860
 
15673
15861
  // src/liquid/filters/color_mix.ts
15674
- function bind27(_liquidSwell) {
15862
+ function bind29(_liquidSwell) {
15675
15863
  return (color1, color2, ratio) => {
15676
15864
  return ThemeColor.get(color1).mix(ThemeColor.get(color2), ratio);
15677
15865
  };
15678
15866
  }
15679
15867
 
15680
15868
  // src/liquid/filters/color_modify.ts
15681
- function bind28(_liquidSwell) {
15869
+ function bind30(_liquidSwell) {
15682
15870
  return function filterColorModify(color, field, value) {
15683
15871
  return ThemeColor.get(color).modify(field, Number(value) || 0);
15684
15872
  };
15685
15873
  }
15686
15874
 
15687
15875
  // src/liquid/filters/color_saturate.ts
15688
- function bind29(_liquidSwell) {
15876
+ function bind31(_liquidSwell) {
15689
15877
  return (color, value) => {
15690
15878
  return ThemeColor.get(color).saturate(value);
15691
15879
  };
15692
15880
  }
15693
15881
 
15694
15882
  // src/liquid/filters/color_to_hex.ts
15695
- function bind30(_liquidSwell) {
15883
+ function bind32(_liquidSwell) {
15696
15884
  return (color) => {
15697
15885
  return ThemeColor.get(color).hex();
15698
15886
  };
15699
15887
  }
15700
15888
 
15701
15889
  // src/liquid/filters/color_to_hsl.ts
15702
- function bind31(_liquidSwell) {
15890
+ function bind33(_liquidSwell) {
15703
15891
  return (color) => {
15704
15892
  return ThemeColor.get(color).hsl();
15705
15893
  };
15706
15894
  }
15707
15895
 
15708
15896
  // src/liquid/filters/color_to_rgb.ts
15709
- function bind32(_liquidSwell) {
15897
+ function bind34(_liquidSwell) {
15710
15898
  return (color, alpha) => {
15711
15899
  return alpha !== void 0 ? ThemeColor.get(color).rgba(alpha) : ThemeColor.get(color).rgb();
15712
15900
  };
@@ -15714,7 +15902,7 @@ ${injects.join("\n")}<\/script>`;
15714
15902
 
15715
15903
  // src/liquid/filters/date.ts
15716
15904
  var import_strftime = __toESM(__require("strftime"), 1);
15717
- function bind33(_liquidSwell) {
15905
+ function bind35(_liquidSwell) {
15718
15906
  return (dateValue, ...params) => {
15719
15907
  const date = ensureDate(dateValue);
15720
15908
  const { format } = getDateFilterParams(params);
@@ -15772,7 +15960,7 @@ ${injects.join("\n")}<\/script>`;
15772
15960
  }
15773
15961
 
15774
15962
  // src/liquid/filters/date_next_interval.ts
15775
- function bind34(_liquidSwell) {
15963
+ function bind36(_liquidSwell) {
15776
15964
  return (dateValue, interval, intervalCount) => {
15777
15965
  const date = ensureDate(dateValue);
15778
15966
  const result = getNextIntervalDate(date, interval, Number(intervalCount));
@@ -15824,7 +16012,7 @@ ${injects.join("\n")}<\/script>`;
15824
16012
  }
15825
16013
 
15826
16014
  // src/liquid/filters/default_errors.ts
15827
- function bind35(_liquidSwell) {
16015
+ function bind37(_liquidSwell) {
15828
16016
  return async function filterDefaultError(errors) {
15829
16017
  if (!errors) {
15830
16018
  return "";
@@ -15850,7 +16038,7 @@ ${injects.join("\n")}<\/script>`;
15850
16038
  }
15851
16039
 
15852
16040
  // src/liquid/filters/divided_by.ts
15853
- function bind36(_liquidSwell) {
16041
+ function bind38(_liquidSwell) {
15854
16042
  return (dividend, divisor, integerArithmetic) => {
15855
16043
  if (!isNumber(dividend) || !isNumber(divisor)) {
15856
16044
  return dividend;
@@ -15860,20 +16048,20 @@ ${injects.join("\n")}<\/script>`;
15860
16048
  }
15861
16049
 
15862
16050
  // src/liquid/filters/embedded_content.ts
15863
- var import_lodash_es10 = __require("lodash-es");
15864
- function bind37(_liquidSwell) {
16051
+ var import_lodash_es12 = __require("lodash-es");
16052
+ function bind39(_liquidSwell) {
15865
16053
  return (value, tag = "iframe") => {
15866
16054
  const escapeIframes = value.replaceAll(`<${tag}`, `&lt;${tag}`).replaceAll(`</${tag}`, `&lt;/${tag}`);
15867
16055
  const removeTags = escapeIframes.replaceAll(/<(.*?)>/gi, "");
15868
- const unescaped = (0, import_lodash_es10.unescape)(removeTags);
16056
+ const unescaped = (0, import_lodash_es12.unescape)(removeTags);
15869
16057
  const replaceSpaces = unescaped.replaceAll("&nbsp;", " ");
15870
16058
  return replaceSpaces;
15871
16059
  };
15872
16060
  }
15873
16061
 
15874
16062
  // src/liquid/filters/escape.ts
15875
- var import_lodash_es11 = __require("lodash-es");
15876
- function bind38(_liquidSwell) {
16063
+ var import_lodash_es13 = __require("lodash-es");
16064
+ function bind40(_liquidSwell) {
15877
16065
  return function escapeTag(input) {
15878
16066
  if (!input?.startsWith) {
15879
16067
  return input;
@@ -15881,12 +16069,12 @@ ${injects.join("\n")}<\/script>`;
15881
16069
  if (input.startsWith("<img") || input.startsWith("<video")) {
15882
16070
  return input;
15883
16071
  }
15884
- return (0, import_lodash_es11.escape)(input);
16072
+ return (0, import_lodash_es13.escape)(input);
15885
16073
  };
15886
16074
  }
15887
16075
 
15888
16076
  // src/liquid/filters/font_face.ts
15889
- function bind39(_liquidSwell) {
16077
+ function bind41(_liquidSwell) {
15890
16078
  return (fontSetting, ...params) => {
15891
16079
  if (!fontSetting) {
15892
16080
  return null;
@@ -15898,14 +16086,14 @@ ${injects.join("\n")}<\/script>`;
15898
16086
  }
15899
16087
 
15900
16088
  // src/liquid/filters/font_modify.ts
15901
- function bind40(_liquidSwell) {
16089
+ function bind42(_liquidSwell) {
15902
16090
  return (fontSetting, prop, value) => {
15903
16091
  return ThemeFont.clone(fontSetting).modify(prop, value);
15904
16092
  };
15905
16093
  }
15906
16094
 
15907
16095
  // src/liquid/filters/font_url.ts
15908
- function bind41(_liquidSwell) {
16096
+ function bind43(_liquidSwell) {
15909
16097
  return (fontSetting) => {
15910
16098
  return ThemeFont.get(fontSetting).url();
15911
16099
  };
@@ -15954,15 +16142,15 @@ ${injects.join("\n")}<\/script>`;
15954
16142
  };
15955
16143
 
15956
16144
  // src/liquid/filters/handleize.ts
15957
- var import_lodash_es12 = __require("lodash-es");
15958
- function bind42(_liquidSwell) {
16145
+ var import_lodash_es14 = __require("lodash-es");
16146
+ function bind44(_liquidSwell) {
15959
16147
  return function filterHandleize(handle) {
15960
- return (0, import_lodash_es12.kebabCase)(handle);
16148
+ return (0, import_lodash_es14.kebabCase)(handle);
15961
16149
  };
15962
16150
  }
15963
16151
 
15964
16152
  // src/liquid/filters/image_tag.ts
15965
- function bind43(_liquidSwell) {
16153
+ function bind45(_liquidSwell) {
15966
16154
  return function filterImageTag(imageUrl, ...params) {
15967
16155
  imageUrl = String(imageUrl || "");
15968
16156
  let {
@@ -16126,7 +16314,7 @@ ${injects.join("\n")}<\/script>`;
16126
16314
  var image_url_default = filterDefinition;
16127
16315
 
16128
16316
  // src/liquid/filters/inline_asset_content.ts
16129
- function bind44(liquidSwell) {
16317
+ function bind46(liquidSwell) {
16130
16318
  return async (assetPath) => {
16131
16319
  const config = await liquidSwell.theme.getThemeConfig(
16132
16320
  `theme/assets/${assetPath}`
@@ -16136,14 +16324,14 @@ ${injects.join("\n")}<\/script>`;
16136
16324
  }
16137
16325
 
16138
16326
  // src/liquid/filters/json.ts
16139
- function bind45(_liquidSwell) {
16327
+ function bind47(_liquidSwell) {
16140
16328
  return async function filterJson(input, space = 0) {
16141
16329
  return jsonStringifyAsync(input, space);
16142
16330
  };
16143
16331
  }
16144
16332
 
16145
16333
  // src/liquid/filters/json_pretty.ts
16146
- function bind46(_liquidSwell) {
16334
+ function bind48(_liquidSwell) {
16147
16335
  return async function filterJsonPretty(input, space = 2) {
16148
16336
  const output = await jsonStringifyAsync(input, space);
16149
16337
  return `<pre>${output}</pre>`;
@@ -16153,7 +16341,7 @@ ${injects.join("\n")}<\/script>`;
16153
16341
  // src/liquid/filters/locale_flag.ts
16154
16342
  var import_country_flag_icons = __require("country-flag-icons");
16155
16343
  var flags = __toESM(__require("country-flag-icons/string/1x1"), 1);
16156
- function bind47(_liquidSwell) {
16344
+ function bind49(_liquidSwell) {
16157
16345
  return (localeCode) => {
16158
16346
  if (typeof localeCode !== "string") {
16159
16347
  return flags.US;
@@ -16164,7 +16352,7 @@ ${injects.join("\n")}<\/script>`;
16164
16352
  }
16165
16353
 
16166
16354
  // src/liquid/filters/minus.ts
16167
- function bind48(_liquidSwell) {
16355
+ function bind50(_liquidSwell) {
16168
16356
  return (first, second) => {
16169
16357
  const firstValue = isNumber(first) ? first : 0;
16170
16358
  const secondValue = isNumber(second) ? second : 0;
@@ -16173,7 +16361,7 @@ ${injects.join("\n")}<\/script>`;
16173
16361
  }
16174
16362
 
16175
16363
  // src/liquid/filters/money.ts
16176
- function bind49(liquidSwell) {
16364
+ function bind51(liquidSwell) {
16177
16365
  return function filterMoney(value) {
16178
16366
  const amount = getMoneyAmount(liquidSwell, value);
16179
16367
  return liquidSwell.renderCurrency(amount);
@@ -16190,7 +16378,7 @@ ${injects.join("\n")}<\/script>`;
16190
16378
  }
16191
16379
 
16192
16380
  // src/liquid/filters/money_with_currency.ts
16193
- function bind50(liquidSwell) {
16381
+ function bind52(liquidSwell) {
16194
16382
  return function filterMoneyWithCurrency(value) {
16195
16383
  const { currency } = liquidSwell.theme.swell.getStorefrontLocalization();
16196
16384
  const amount = getMoneyAmount(liquidSwell, value);
@@ -16199,7 +16387,7 @@ ${injects.join("\n")}<\/script>`;
16199
16387
  }
16200
16388
 
16201
16389
  // src/liquid/filters/money_without_currency.ts
16202
- function bind51(liquidSwell) {
16390
+ function bind53(liquidSwell) {
16203
16391
  return function filterMoneyWithoutCurrency(value) {
16204
16392
  const amount = getMoneyAmount(liquidSwell, value);
16205
16393
  return liquidSwell.renderCurrency(amount).replace(/[^0-9.,]/g, "");
@@ -16207,30 +16395,45 @@ ${injects.join("\n")}<\/script>`;
16207
16395
  }
16208
16396
 
16209
16397
  // src/liquid/filters/money_without_trailing_zeros.ts
16210
- function bind52(liquidSwell) {
16398
+ function bind54(liquidSwell) {
16211
16399
  return function filterMoneyWithoutTrailingZeros(value) {
16212
16400
  const amount = getMoneyAmount(liquidSwell, value);
16213
16401
  return liquidSwell.renderCurrency(amount).split(".")[0].split(",")[0];
16214
16402
  };
16215
16403
  }
16216
16404
 
16405
+ // src/liquid/filters/preload_tag.ts
16406
+ function bind55(_liquidSwell) {
16407
+ return function filterPreloadTag(assetUrl, ...params) {
16408
+ if (!assetUrl) {
16409
+ return "";
16410
+ }
16411
+ const { as } = paramsToProps(params);
16412
+ let attributes = "";
16413
+ if (typeof as === "string" && as) {
16414
+ attributes += `as="${as}"`;
16415
+ }
16416
+ return `<link href="${assetUrl}" rel="preload" ${attributes} />`;
16417
+ };
16418
+ }
16419
+
16217
16420
  // src/liquid/filters/script_tag.ts
16218
- function bind53(_liquidSwell) {
16421
+ function bind56(_liquidSwell) {
16219
16422
  return function filterScriptTag(assetUrl) {
16220
16423
  return `<script src="${assetUrl}" type="text/javascript"><\/script>`;
16221
16424
  };
16222
16425
  }
16223
16426
 
16224
16427
  // src/liquid/filters/stylesheet_tag.ts
16225
- function bind54(_liquidSwell) {
16428
+ function bind57(_liquidSwell) {
16226
16429
  return function filterStyleSheetTag(assetUrl) {
16227
16430
  return `<link href="${assetUrl}" rel="stylesheet" type="text/css" media="all" />`;
16228
16431
  };
16229
16432
  }
16230
16433
 
16231
16434
  // src/liquid/filters/time_tag.ts
16232
- function bind55(_liquidSwell) {
16233
- const dateFilter = bind33(_liquidSwell);
16435
+ function bind58(_liquidSwell) {
16436
+ const dateFilter = bind35(_liquidSwell);
16234
16437
  return (dateValue, ...params) => {
16235
16438
  const date = ensureDate(dateValue);
16236
16439
  const formattedDate = dateFilter(dateValue, ...params);
@@ -16240,7 +16443,7 @@ ${injects.join("\n")}<\/script>`;
16240
16443
  }
16241
16444
 
16242
16445
  // src/liquid/filters/translate.ts
16243
- function bind56(liquidSwell) {
16446
+ function bind59(liquidSwell) {
16244
16447
  return async function filterTranslate(key, params) {
16245
16448
  const props = params && paramsToProps(params);
16246
16449
  const str = await liquidSwell.renderTranslation(key, props);
@@ -16249,7 +16452,7 @@ ${injects.join("\n")}<\/script>`;
16249
16452
  }
16250
16453
 
16251
16454
  // src/liquid/filters/where.ts
16252
- function bind57(_liquidSwell) {
16455
+ function bind60(_liquidSwell) {
16253
16456
  return function* filterWhere(arr, property, expected) {
16254
16457
  const results = [];
16255
16458
  const list = yield resolveEnumerable(arr);
@@ -16303,7 +16506,7 @@ ${injects.join("\n")}<\/script>`;
16303
16506
  height: height ? Number(height) : void 0
16304
16507
  };
16305
16508
  }
16306
- function bind58(liquidSwell) {
16509
+ function bind61(liquidSwell) {
16307
16510
  return async function filterAssetImgUrl(assetPath, size = "small") {
16308
16511
  const imageUrl = await liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
16309
16512
  const sizes = getSizesFromParam(size);
@@ -16319,14 +16522,14 @@ ${injects.join("\n")}<\/script>`;
16319
16522
  }
16320
16523
 
16321
16524
  // src/liquid/filters/shopify/hex_to_rgba.ts
16322
- function bind59(_liquidSwell) {
16525
+ function bind62(_liquidSwell) {
16323
16526
  return (color, alpha) => {
16324
16527
  return ThemeColor.get(color).rgba(alpha || 1);
16325
16528
  };
16326
16529
  }
16327
16530
 
16328
16531
  // src/liquid/filters/shopify/img_url.ts
16329
- function bind60(liquidSwell) {
16532
+ function bind63(liquidSwell) {
16330
16533
  return async function filterImgUrl(input, ...params) {
16331
16534
  const url = await getImageUrlFromInput(input, liquidSwell);
16332
16535
  if (typeof url !== "string" || url === "") {
@@ -16364,14 +16567,14 @@ ${injects.join("\n")}<\/script>`;
16364
16567
  };
16365
16568
 
16366
16569
  // src/liquid/filters/shopify/payment_button.ts
16367
- function bind61(_liquidSwell) {
16570
+ function bind64(_liquidSwell) {
16368
16571
  return (form) => {
16369
16572
  return `<button style="display: block; visibility: hidden;"></button>`;
16370
16573
  };
16371
16574
  }
16372
16575
 
16373
16576
  // src/liquid/filters/shopify/payment_terms.ts
16374
- function bind62(_liquidSwell) {
16577
+ function bind65(_liquidSwell) {
16375
16578
  return (form) => {
16376
16579
  return null;
16377
16580
  };
@@ -16473,7 +16676,7 @@ ${injects.join("\n")}<\/script>`;
16473
16676
  var placeholder_svgs_default = svgs;
16474
16677
 
16475
16678
  // src/liquid/filters/shopify/placeholder_svg_tag.ts
16476
- function bind63(_liquidSwell) {
16679
+ function bind66(_liquidSwell) {
16477
16680
  return function filterPlaceholderSvgTag(name, className) {
16478
16681
  const svg = placeholder_svgs_default[name];
16479
16682
  if (typeof svg === "object" && svg !== null) {
@@ -16484,7 +16687,7 @@ ${injects.join("\n")}<\/script>`;
16484
16687
  }
16485
16688
 
16486
16689
  // src/liquid/filters/shopify/shopify_asset_url.ts
16487
- function bind64(_liquidSwell) {
16690
+ function bind67(_liquidSwell) {
16488
16691
  return function filterShopifyAssetUrl(input) {
16489
16692
  if (typeof input === "string") {
16490
16693
  switch (input) {
@@ -16509,7 +16712,7 @@ ${injects.join("\n")}<\/script>`;
16509
16712
  }
16510
16713
 
16511
16714
  // src/liquid/filters/shopify/structured_data.ts
16512
- function bind65(_liquidSwell) {
16715
+ function bind68(_liquidSwell) {
16513
16716
  return async function filterStructuredData(input) {
16514
16717
  let value = input;
16515
16718
  if (value instanceof StorefrontResource) {
@@ -16587,7 +16790,7 @@ ${injects.join("\n")}<\/script>`;
16587
16790
  }
16588
16791
 
16589
16792
  // src/liquid/filters/inline_editable.ts
16590
- function bind66(_liquidSwell) {
16793
+ function bind69(_liquidSwell) {
16591
16794
  return (value, key) => {
16592
16795
  if (typeof value === "object" && "value" in value) {
16593
16796
  value = value.value;
@@ -16598,64 +16801,65 @@ ${injects.join("\n")}<\/script>`;
16598
16801
 
16599
16802
  // src/liquid/filters/index.ts
16600
16803
  var filters = {
16601
- asset_url: bind18,
16602
- brightness_difference: bind19,
16603
- color_brightness: bind20,
16604
- color_contrast: bind21,
16605
- color_darken: bind22,
16606
- color_desaturate: bind23,
16607
- color_difference: bind24,
16608
- color_extract: bind25,
16609
- color_lighten: bind26,
16610
- color_mix: bind27,
16611
- color_modify: bind28,
16612
- color_saturate: bind29,
16613
- color_to_hex: bind30,
16614
- color_to_hsl: bind31,
16615
- color_to_rgb: bind32,
16616
- date_next_interval: bind34,
16617
- date: bind33,
16618
- default_errors: bind35,
16619
- divided_by: bind36,
16620
- embedded_content: bind37,
16621
- escape: bind38,
16622
- font_face: bind39,
16623
- font_modify: bind40,
16624
- font_url: bind41,
16804
+ asset_url: bind20,
16805
+ brightness_difference: bind21,
16806
+ color_brightness: bind22,
16807
+ color_contrast: bind23,
16808
+ color_darken: bind24,
16809
+ color_desaturate: bind25,
16810
+ color_difference: bind26,
16811
+ color_extract: bind27,
16812
+ color_lighten: bind28,
16813
+ color_mix: bind29,
16814
+ color_modify: bind30,
16815
+ color_saturate: bind31,
16816
+ color_to_hex: bind32,
16817
+ color_to_hsl: bind33,
16818
+ color_to_rgb: bind34,
16819
+ date_next_interval: bind36,
16820
+ date: bind35,
16821
+ default_errors: bind37,
16822
+ divided_by: bind38,
16823
+ embedded_content: bind39,
16824
+ escape: bind40,
16825
+ font_face: bind41,
16826
+ font_modify: bind42,
16827
+ font_url: bind43,
16625
16828
  format_address: format_address_default,
16626
- handle: bind42,
16829
+ handle: bind44,
16627
16830
  // alias
16628
- handleize: bind42,
16629
- image_tag: bind43,
16831
+ handleize: bind44,
16832
+ image_tag: bind45,
16630
16833
  image_url: image_url_default,
16631
- inline_asset_content: bind44,
16632
- json: bind45,
16633
- json_pretty: bind46,
16634
- locale_flag: bind47,
16635
- minus: bind48,
16636
- money: bind49,
16637
- money_with_currency: bind50,
16638
- money_without_currency: bind51,
16639
- money_without_trailing_zeros: bind52,
16640
- script_tag: bind53,
16641
- stylesheet_tag: bind54,
16642
- time_tag: bind55,
16643
- translate: bind56,
16644
- t: bind56,
16834
+ inline_asset_content: bind46,
16835
+ json: bind47,
16836
+ json_pretty: bind48,
16837
+ locale_flag: bind49,
16838
+ minus: bind50,
16839
+ money: bind51,
16840
+ money_with_currency: bind52,
16841
+ money_without_currency: bind53,
16842
+ money_without_trailing_zeros: bind54,
16843
+ preload_tag: bind55,
16844
+ script_tag: bind56,
16845
+ stylesheet_tag: bind57,
16846
+ time_tag: bind58,
16847
+ translate: bind59,
16848
+ t: bind59,
16645
16849
  // alias
16646
- where: bind57,
16850
+ where: bind60,
16647
16851
  // Shopify compatibility only
16648
- asset_img_url: bind58,
16649
- hex_to_rgba: bind59,
16650
- img_url: bind60,
16852
+ asset_img_url: bind61,
16853
+ hex_to_rgba: bind62,
16854
+ img_url: bind63,
16651
16855
  item_count_for_variant: item_count_for_variant_default,
16652
- payment_button: bind61,
16653
- payment_terms: bind62,
16654
- placeholder_svg_tag: bind63,
16655
- shopify_asset_url: bind64,
16656
- structured_data: bind65,
16856
+ payment_button: bind64,
16857
+ payment_terms: bind65,
16858
+ placeholder_svg_tag: bind66,
16859
+ shopify_asset_url: bind67,
16860
+ structured_data: bind68,
16657
16861
  // Swell only
16658
- inline_editable: bind66
16862
+ inline_editable: bind69
16659
16863
  };
16660
16864
  function bindFilters(liquidSwell) {
16661
16865
  for (const [tag, handler] of Object.entries(filters)) {
@@ -16669,8 +16873,8 @@ ${injects.join("\n")}<\/script>`;
16669
16873
  }
16670
16874
  }
16671
16875
  }
16672
- function bindWithResolvedProps(liquidSwell, bind67, resolve = []) {
16673
- const handler = bind67(liquidSwell);
16876
+ function bindWithResolvedProps(liquidSwell, bind70, resolve = []) {
16877
+ const handler = bind70(liquidSwell);
16674
16878
  if (!Array.isArray(resolve)) {
16675
16879
  return handler;
16676
16880
  }
@@ -16722,9 +16926,9 @@ ${injects.join("\n")}<\/script>`;
16722
16926
  }
16723
16927
 
16724
16928
  // src/liquid/operators.ts
16725
- var import_liquidjs33 = __require("liquidjs");
16929
+ var import_liquidjs38 = __require("liquidjs");
16726
16930
  var swellOperators = {
16727
- ...import_liquidjs33.defaultOperators,
16931
+ ...import_liquidjs38.defaultOperators,
16728
16932
  "==": equal,
16729
16933
  "!=": (l, r) => !equal(l, r),
16730
16934
  contains: (l, r) => {
@@ -16752,8 +16956,8 @@ ${injects.join("\n")}<\/script>`;
16752
16956
 
16753
16957
  // src/liquid/color.ts
16754
16958
  var import_color = __toESM(__require("color"), 1);
16755
- var import_liquidjs34 = __require("liquidjs");
16756
- var ThemeColor = class _ThemeColor extends import_liquidjs34.Drop {
16959
+ var import_liquidjs39 = __require("liquidjs");
16960
+ var ThemeColor = class _ThemeColor extends import_liquidjs39.Drop {
16757
16961
  color;
16758
16962
  colorValues;
16759
16963
  red;
@@ -16797,10 +17001,16 @@ ${injects.join("\n")}<\/script>`;
16797
17001
  return this.color.darken(percent / 100).hex().toLowerCase();
16798
17002
  }
16799
17003
  rgb() {
16800
- return this.color.rgb().toString();
17004
+ return `${this.red} ${this.green} ${this.blue}`;
16801
17005
  }
16802
17006
  rgba(alpha) {
16803
- return this.color.alpha(alpha).rgb().toString();
17007
+ const colorValues = this.color.object();
17008
+ const alphaValue = alpha || colorValues.alpha;
17009
+ const rgb = this.rgb();
17010
+ if (alphaValue === void 0) {
17011
+ return rgb;
17012
+ }
17013
+ return `${rgb} / ${Number(alphaValue).toFixed(2)}`;
16804
17014
  }
16805
17015
  hsl() {
16806
17016
  return this.color.hsl().round().toString();
@@ -16888,7 +17098,7 @@ ${injects.join("\n")}<\/script>`;
16888
17098
  }
16889
17099
 
16890
17100
  // src/liquid/index.ts
16891
- var LiquidSwell31 = class extends import_liquidjs35.Liquid {
17101
+ var LiquidSwell31 = class extends import_liquidjs40.Liquid {
16892
17102
  theme;
16893
17103
  getThemeConfig;
16894
17104
  getThemeTemplateConfigByType;
@@ -16905,6 +17115,7 @@ ${injects.join("\n")}<\/script>`;
16905
17115
  extName;
16906
17116
  componentsDir;
16907
17117
  sectionsDir;
17118
+ blocksDir;
16908
17119
  lastSchema;
16909
17120
  constructor({
16910
17121
  theme,
@@ -16922,7 +17133,8 @@ ${injects.join("\n")}<\/script>`;
16922
17133
  layoutName,
16923
17134
  extName,
16924
17135
  componentsDir,
16925
- sectionsDir
17136
+ sectionsDir,
17137
+ blocksDir
16926
17138
  }) {
16927
17139
  getThemeConfig = getThemeConfig || theme.getThemeConfig.bind(theme);
16928
17140
  extName = extName || "liquid";
@@ -16951,6 +17163,7 @@ ${injects.join("\n")}<\/script>`;
16951
17163
  this.extName = extName;
16952
17164
  this.componentsDir = componentsDir || "components";
16953
17165
  this.sectionsDir = sectionsDir || "sections";
17166
+ this.blocksDir = blocksDir || "blocks";
16954
17167
  this.lastSchema = void 0;
16955
17168
  bindTags(this);
16956
17169
  bindFilters(this);
@@ -16973,6 +17186,9 @@ ${injects.join("\n")}<\/script>`;
16973
17186
  async getSectionGroupPath(sectionName) {
16974
17187
  return await this.resolveFilePathByType("sections", `${sectionName}.json`) || resolveFilePath(`${this.sectionsDir}/${sectionName}`, "json");
16975
17188
  }
17189
+ async getThemeBlockPath(blockName) {
17190
+ return await this.resolveFilePathByType("blocks", blockName) || resolveFilePath(`${this.blocksDir}/${blockName}`, this.extName);
17191
+ }
16976
17192
  };
16977
17193
  function resolveFilePath(fileName, extName) {
16978
17194
  return `theme/${fileName}.${extName}`;
@@ -17372,11 +17588,11 @@ ${injects.join("\n")}<\/script>`;
17372
17588
  };
17373
17589
 
17374
17590
  // src/globals.ts
17375
- var import_lodash_es13 = __require("lodash-es");
17591
+ var import_lodash_es15 = __require("lodash-es");
17376
17592
 
17377
17593
  // src/compatibility/drops/robots-rule.ts
17378
- var import_liquidjs36 = __require("liquidjs");
17379
- var RobotsRule = class _RobotsRule extends import_liquidjs36.Drop {
17594
+ var import_liquidjs41 = __require("liquidjs");
17595
+ var RobotsRule = class _RobotsRule extends import_liquidjs41.Drop {
17380
17596
  constructor(directive, value) {
17381
17597
  super();
17382
17598
  this.directive = directive;
@@ -17472,7 +17688,7 @@ ${injects.join("\n")}<\/script>`;
17472
17688
  }).filter(Boolean).join("\n");
17473
17689
  }
17474
17690
  function getRobotsGlobals(canonicalUrl) {
17475
- const sitemapUrl = `${(0, import_lodash_es13.trimEnd)(canonicalUrl, "/")}/sitemap.xml`;
17691
+ const sitemapUrl = `${(0, import_lodash_es15.trimEnd)(canonicalUrl, "/")}/sitemap.xml`;
17476
17692
  const defaultRules = [
17477
17693
  { directive: "Disallow", value: "/admin" },
17478
17694
  { directive: "Disallow", value: "/cart" },
@@ -17967,7 +18183,7 @@ ${injects.join("\n")}<\/script>`;
17967
18183
  return languageConfig;
17968
18184
  }
17969
18185
  const localeShortCode = locale.split("-")[0];
17970
- return (0, import_lodash_es14.reduce)(
18186
+ return (0, import_lodash_es16.reduce)(
17971
18187
  languageConfig,
17972
18188
  (acc, value, key) => {
17973
18189
  if (isObject2(value)) {
@@ -17991,15 +18207,15 @@ ${injects.join("\n")}<\/script>`;
17991
18207
  const translationEnd = translationParts.pop();
17992
18208
  const translationPath = translationParts.join(".");
17993
18209
  const translationConfigGlobal = this.globals.language;
17994
- acc[key] = (0, import_lodash_es14.get)(
18210
+ acc[key] = (0, import_lodash_es16.get)(
17995
18211
  translationConfigGlobal,
17996
18212
  `${translationPath}.$locale.${locale}.${translationEnd}`
17997
- ) || (0, import_lodash_es14.get)(
18213
+ ) || (0, import_lodash_es16.get)(
17998
18214
  translationConfigGlobal,
17999
18215
  `${translationPath}.$locale.${localeShortCode}.${translationEnd}`
18000
- ) || (0, import_lodash_es14.get)(translationConfigGlobal, translationKey) || value;
18216
+ ) || (0, import_lodash_es16.get)(translationConfigGlobal, translationKey) || value;
18001
18217
  } else {
18002
- acc[key] = (0, import_lodash_es14.get)(languageConfig, `$locale.${locale}.${key}`) || (0, import_lodash_es14.get)(languageConfig, `$locale.${localeShortCode}.${key}`) || value;
18218
+ acc[key] = (0, import_lodash_es16.get)(languageConfig, `$locale.${locale}.${key}`) || (0, import_lodash_es16.get)(languageConfig, `$locale.${localeShortCode}.${key}`) || value;
18003
18219
  }
18004
18220
  }
18005
18221
  return acc;
@@ -18684,6 +18900,30 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18684
18900
  const configs = this.getThemeConfigsByPath("theme/sections/");
18685
18901
  return getAllSections(configs, this.getTemplateSchema.bind(this));
18686
18902
  }
18903
+ /**
18904
+ * Returns all theme block schemas from /blocks folder.
18905
+ */
18906
+ getAllThemeBlockSchemas() {
18907
+ const schemas = [];
18908
+ const configs = this.getThemeConfigsByPath("theme/blocks/");
18909
+ for (const config of configs.values()) {
18910
+ const { name, file_path: filePath, file_data: fileData } = config;
18911
+ const rawSchema = extractSchemaTag(fileData, true);
18912
+ if (!rawSchema) {
18913
+ continue;
18914
+ }
18915
+ try {
18916
+ const schema = import_json56.default.parse(rawSchema);
18917
+ if (!schema.type) {
18918
+ schema.type = name;
18919
+ }
18920
+ schemas.push(schema);
18921
+ } catch (error) {
18922
+ console.warn(`Invalid schema in block: ${filePath}`, error);
18923
+ }
18924
+ }
18925
+ return schemas;
18926
+ }
18687
18927
  async getPageSections(sectionGroup, resolveSettings = true) {
18688
18928
  const sectionConfigs = await getPageSections(
18689
18929
  sectionGroup,
@@ -18835,8 +19075,8 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18835
19075
  const keyParts = key?.split(".") || [];
18836
19076
  const keyName = keyParts.pop() || "";
18837
19077
  const keyPath = keyParts.join(".");
18838
- const langObject = (0, import_lodash_es14.get)(langConfig, keyPath);
18839
- let localeValue = (0, import_lodash_es14.get)(langObject?.[localeCode], keyName) || (0, import_lodash_es14.get)(langObject?.[localeCode.split("-")[0]], keyName) || langObject?.[keyName];
19078
+ const langObject = (0, import_lodash_es16.get)(langConfig, keyPath);
19079
+ let localeValue = (0, import_lodash_es16.get)(langObject?.[localeCode], keyName) || (0, import_lodash_es16.get)(langObject?.[localeCode.split("-")[0]], keyName) || langObject?.[keyName];
18840
19080
  if (data?.count !== void 0 && localeValue?.one) {
18841
19081
  localeValue = data.count === 1 ? localeValue.one : localeValue.other;
18842
19082
  }
@@ -18916,7 +19156,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18916
19156
  }
18917
19157
  }
18918
19158
  function resolveThemeSettings(theme, themeSettings, editorSchemaSettings) {
18919
- const settings = (0, import_lodash_es14.cloneDeep)(themeSettings);
19159
+ const settings = (0, import_lodash_es16.cloneDeep)(themeSettings);
18920
19160
  if (settings.$locale) {
18921
19161
  const { locale } = theme.swell.getStorefrontLocalization();
18922
19162
  const localeConfig = settings.$locale[locale] || {};
@@ -18926,16 +19166,16 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18926
19166
  }
18927
19167
  }
18928
19168
  }
18929
- (0, import_lodash_es14.each)(settings, (value, key) => {
19169
+ (0, import_lodash_es16.each)(settings, (value, key) => {
18930
19170
  const setting = (editorSchemaSettings && findEditorSetting(editorSchemaSettings, key)) ?? null;
18931
19171
  if (isObject2(value) && !(value instanceof StorefrontResource)) {
18932
19172
  switch (setting?.type) {
18933
19173
  case "color_scheme_group": {
18934
- (0, import_lodash_es14.each)(value, (scheme, schemeId) => {
19174
+ (0, import_lodash_es16.each)(value, (scheme, schemeId) => {
18935
19175
  if (isObject2(scheme) && typeof scheme.settings === "object" && scheme.settings) {
18936
19176
  const settings2 = scheme.settings;
18937
- (0, import_lodash_es14.each)(settings2, (colorValue, colorId) => {
18938
- const fieldDef = (0, import_lodash_es14.find)(setting.fields, { id: colorId });
19177
+ (0, import_lodash_es16.each)(settings2, (colorValue, colorId) => {
19178
+ const fieldDef = (0, import_lodash_es16.find)(setting.fields, { id: colorId });
18939
19179
  if (fieldDef?.type === "color" && colorValue) {
18940
19180
  scheme.id = schemeId;
18941
19181
  settings2[colorId] = new ThemeColor(colorValue);
@@ -18986,7 +19226,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18986
19226
  }
18987
19227
  function findThemeSettingsByType(type, themeSettings, editorSchemaSettings) {
18988
19228
  const foundSettings = [];
18989
- (0, import_lodash_es14.each)(themeSettings, (value, key) => {
19229
+ (0, import_lodash_es16.each)(themeSettings, (value, key) => {
18990
19230
  if (isObject2(value) && !(value instanceof ThemeFont) && !(value instanceof StorefrontResource)) {
18991
19231
  foundSettings.push(
18992
19232
  ...findThemeSettingsByType(type, value, editorSchemaSettings)
@@ -19044,14 +19284,14 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
19044
19284
  return {};
19045
19285
  }
19046
19286
  }
19047
- function extractSchemaTag(template) {
19287
+ function extractSchemaTag(template, inner = false) {
19048
19288
  const list = template.match(
19049
19289
  /\{%-?\s*schema\s*-?%\}(.*)\{%-?\s*endschema\s*-?%\}/s
19050
19290
  );
19051
19291
  if (list === null) {
19052
19292
  return template;
19053
19293
  }
19054
- return list[0];
19294
+ return inner ? list[1] : list[0];
19055
19295
  }
19056
19296
  function withSuffix(path, suffix) {
19057
19297
  return suffix ? `${path}.${suffix}` : path;
@@ -19160,7 +19400,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
19160
19400
  }
19161
19401
  function getMenuItemValueId(value) {
19162
19402
  const fallback = typeof value === "string" ? value : "";
19163
- const slug = (0, import_lodash_es15.get)(value, "id", (0, import_lodash_es15.get)(value, "slug", fallback)) || "";
19403
+ const slug = (0, import_lodash_es17.get)(value, "id", (0, import_lodash_es17.get)(value, "slug", fallback)) || "";
19164
19404
  return slug;
19165
19405
  }
19166
19406
  async function getMenuItemUrlAndResource(theme, menuItem) {