@gmb/bitmark-parser-generator 5.4.0 → 5.6.0

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
@@ -489,6 +489,7 @@ var BitType = {
489
489
  pageHero: "page-hero",
490
490
  pageOpenBook: "page-open-book",
491
491
  pageOpenBookList: "page-open-book-list",
492
+ printBook: "print-book",
492
493
  openBookChapter: "open-book-chapter",
493
494
  pagePerson: "page-person",
494
495
  pageProduct: "page-product",
@@ -1198,6 +1199,7 @@ var propertyKeys = {
1198
1199
  property_ageRange: "@ageRange",
1199
1200
  property_aiGenerated: "@aiGenerated",
1200
1201
  property_allowedBit: "@allowedBit",
1202
+ property_allowPrint: "@allowPrint",
1201
1203
  property_allowSubtitles: "@allowSubtitles",
1202
1204
  property_alt: "@alt",
1203
1205
  property_altLangTag: "@altLangTag",
@@ -1302,6 +1304,7 @@ var propertyKeys = {
1302
1304
  property_internalPrintPdf: "@internalPrintPdf",
1303
1305
  property_hasPrintRestriction: "@hasPrintRestriction",
1304
1306
  property_enforceUpdateOverUserInput: "@enforceUpdateOverUserInput",
1307
+ property_extractorExtractionTimestamp: "@extractorExtractionTimestamp",
1305
1308
  property_isCaseSensitive: "@isCaseSensitive",
1306
1309
  property_isInfoOnly: "@isInfoOnly",
1307
1310
  property_isPublic: "@isPublic",
@@ -1339,6 +1342,7 @@ var propertyKeys = {
1339
1342
  property_mute: "@mute",
1340
1343
  property_padletId: "@padletId",
1341
1344
  property_page: "@page",
1345
+ property_printParentChapterLevel: "@printParentChapterLevel",
1342
1346
  property_pageNo: "@pageNo",
1343
1347
  property_partialAnswer: "@partialAnswer",
1344
1348
  property_partner: "@partner",
@@ -3467,6 +3471,12 @@ var GROUPS = {
3467
3471
  description: "Url of the internal print PDF for the book",
3468
3472
  format: TagFormat.plainText
3469
3473
  },
3474
+ {
3475
+ key: ConfigKey.property_allowPrint,
3476
+ description: "If true, the book allows printing",
3477
+ format: TagFormat.boolean,
3478
+ defaultValue: "false"
3479
+ },
3470
3480
  {
3471
3481
  key: ConfigKey.property_hasPrintRestriction,
3472
3482
  description: "If true, the book has print restrictions",
@@ -3478,6 +3488,12 @@ var GROUPS = {
3478
3488
  description: "If true, prioritize new content over legacy content from the instance API",
3479
3489
  format: TagFormat.boolean,
3480
3490
  defaultValue: "false"
3491
+ },
3492
+ {
3493
+ key: ConfigKey.property_extractorExtractionTimestamp,
3494
+ description: "Extraction timestamps for book conversion",
3495
+ format: TagFormat.plainText,
3496
+ maxCount: Count.infinity
3481
3497
  }
3482
3498
  ]
3483
3499
  },
@@ -6874,6 +6890,12 @@ var BITS = {
6874
6890
  key: ConfigKey.property_buttonCaption,
6875
6891
  description: "The caption of the print button",
6876
6892
  format: TagFormat.plainText
6893
+ },
6894
+ {
6895
+ key: ConfigKey.property_printParentChapterLevel,
6896
+ description: "The parent chapter level to print",
6897
+ format: TagFormat.number,
6898
+ defaultValue: "-1"
6877
6899
  }
6878
6900
  ]
6879
6901
  },
@@ -7454,6 +7476,39 @@ var BITS = {
7454
7476
  }
7455
7477
  ]
7456
7478
  },
7479
+ [BitType.printBook]: {
7480
+ since: "5.5.0",
7481
+ baseBitType: BitType.article,
7482
+ description: "Print book bit, used to create pages that open books without author information in articles or books",
7483
+ tags: [
7484
+ {
7485
+ key: ConfigKey.property_slug,
7486
+ description: "Slug for the book, used to identify the book in the system",
7487
+ format: TagFormat.plainText
7488
+ },
7489
+ {
7490
+ key: ConfigKey.property_book,
7491
+ description: "Book reference for the page, used to link to a specific book",
7492
+ format: TagFormat.plainText,
7493
+ chain: [
7494
+ {
7495
+ key: ConfigKey.tag_reference,
7496
+ description: "Reference tag for the book, used to link to the book in the system",
7497
+ maxCount: 2
7498
+ }
7499
+ ]
7500
+ },
7501
+ {
7502
+ /* Allow incorrectly chained reference tag */
7503
+ key: ConfigKey.tag_reference,
7504
+ description: "Reference tag for the book, used to link to the book in the system"
7505
+ },
7506
+ {
7507
+ key: ConfigKey.property_buttonCaption,
7508
+ description: "Caption for the button, used to define the text displayed on the button"
7509
+ }
7510
+ ]
7511
+ },
7457
7512
  [BitType.openBookChapter]: {
7458
7513
  since: "4.16.0",
7459
7514
  baseBitType: BitType.pageOpenBook,
@@ -10349,7 +10404,7 @@ var instance2 = new Config();
10349
10404
  // src/generated/package_info.ts
10350
10405
  var PACKAGE_INFO = {
10351
10406
  "name": "@gmb/bitmark-parser-generator",
10352
- "version": "5.4.0",
10407
+ "version": "5.6.0",
10353
10408
  "author": "Get More Brain Ltd",
10354
10409
  "license": "ISC",
10355
10410
  "description": "A bitmark parser and generator using Peggy.js"
@@ -10710,6 +10765,8 @@ var NodeType = {
10710
10765
  alignment: "alignment",
10711
10766
  allowedBit: "allowedBit",
10712
10767
  allowedBitValue: "allowedBitValue",
10768
+ allowPrint: "allowPrint",
10769
+ allowPrintValue: "allowPrintValue",
10713
10770
  alt: "alt",
10714
10771
  alternativeAnswers: "alternativeAnswers",
10715
10772
  alternativeAnswersValue: "alternativeAnswersValue",
@@ -10972,6 +11029,8 @@ var NodeType = {
10972
11029
  hasPrintRestrictionValue: "hasPrintRestrictionValue",
10973
11030
  enforceUpdateOverUserInput: "enforceUpdateOverUserInput",
10974
11031
  enforceUpdateOverUserInputValue: "enforceUpdateOverUserInputValue",
11032
+ extractorExtractionTimestamp: "extractorExtractionTimestamp",
11033
+ extractorExtractionTimestampValue: "extractorExtractionTimestampValue",
10975
11034
  isCaseSensitive: "isCaseSensitive",
10976
11035
  isCommented: "isCommented",
10977
11036
  isCorrect: "isCorrect",
@@ -11075,6 +11134,8 @@ var NodeType = {
11075
11134
  pageNumber: "pageNumber",
11076
11135
  pageNumberValue: "pageNumberValue",
11077
11136
  pageValue: "pageValue",
11137
+ printParentChapterLevel: "printParentChapterLevel",
11138
+ printParentChapterLevelValue: "printParentChapterLevelValue",
11078
11139
  pairs: "pairs",
11079
11140
  pairsValue: "pairsValue",
11080
11141
  parent: "parent",
@@ -24854,6 +24915,12 @@ var Builder = class extends BaseBuilder {
24854
24915
  data.enforceUpdateOverUserInput,
24855
24916
  options
24856
24917
  ),
24918
+ extractorExtractionTimestamp: this.toAstProperty(
24919
+ bitType,
24920
+ ConfigKey.property_extractorExtractionTimestamp,
24921
+ data.extractorExtractionTimestamp,
24922
+ options
24923
+ ),
24857
24924
  tocResource: this.toAstProperty(
24858
24925
  bitType,
24859
24926
  ConfigKey.property_tocResource,
@@ -24867,6 +24934,18 @@ var Builder = class extends BaseBuilder {
24867
24934
  options
24868
24935
  ),
24869
24936
  page: this.toAstProperty(bitType, ConfigKey.property_page, data.page, options),
24937
+ allowPrint: this.toAstProperty(
24938
+ bitType,
24939
+ ConfigKey.property_allowPrint,
24940
+ data.allowPrint,
24941
+ options
24942
+ ),
24943
+ printParentChapterLevel: this.toAstProperty(
24944
+ bitType,
24945
+ ConfigKey.property_printParentChapterLevel,
24946
+ data.printParentChapterLevel,
24947
+ options
24948
+ ),
24870
24949
  platformBrandTarget: this.toAstProperty(
24871
24950
  bitType,
24872
24951
  ConfigKey.property_platformBrandTarget,
@@ -30537,6 +30616,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
30537
30616
  BitType.pageFooter,
30538
30617
  BitType.pageOpenBook,
30539
30618
  BitType.pagePerson,
30619
+ BitType.printBook,
30540
30620
  BitType.pageProduct,
30541
30621
  BitType.pageProductList,
30542
30622
  BitType.pageProductVideo,
@@ -30557,8 +30637,12 @@ var JsonGenerator = class extends AstWalkerGenerator {
30557
30637
  if (instance2.isOfBitType(bitType, BitType.tocContent)) {
30558
30638
  if (bitJson.tocContent == null) bitJson.tocContent = [];
30559
30639
  }
30640
+ if (instance2.isOfBitType(bitType, BitType.printThisChapter)) {
30641
+ if (bitJson.printParentChapterLevel == null) bitJson.printParentChapterLevel = -1;
30642
+ }
30560
30643
  if (instance2.isOfBitType(bitType, BitType.book)) {
30561
30644
  if (bitJson.maxTocChapterLevel == null) bitJson.maxTocChapterLevel = -1;
30645
+ if (bitJson.allowPrint == null) bitJson.allowPrint = false;
30562
30646
  if (bitJson.hasPrintRestriction == null) bitJson.hasPrintRestriction = true;
30563
30647
  if (bitJson.enforceUpdateOverUserInput == null) bitJson.enforceUpdateOverUserInput = false;
30564
30648
  if (bitJson.hasMarkAsDone == null) bitJson.hasMarkAsDone = false;
@@ -39028,6 +39112,7 @@ var JsonFileGenerator = class {
39028
39112
  var import_node_path3 = __toESM(require("path"), 1);
39029
39113
  var import_superenum50 = require("@ncoderz/superenum");
39030
39114
  var import_fs_extra3 = __toESM(require("fs-extra"), 1);
39115
+ var normalizeCardKey = (cardSetKey) => stringUtils.camelToKebab(cardSetKey);
39031
39116
  var ConfigBuilder = class {
39032
39117
  build(options) {
39033
39118
  const opts = Object.assign({}, options);
@@ -39068,8 +39153,10 @@ var ConfigBuilder = class {
39068
39153
  const outputFolder = opts.outputDir ?? "assets/config";
39069
39154
  const outputFolderBits = import_node_path3.default.join(outputFolder, "bits");
39070
39155
  const outputFolderGroups = import_node_path3.default.join(outputFolder, "partials");
39156
+ const outputFolderCards = import_node_path3.default.join(outputFolder, "cards");
39071
39157
  import_fs_extra3.default.ensureDirSync(outputFolderBits);
39072
39158
  import_fs_extra3.default.ensureDirSync(outputFolderGroups);
39159
+ import_fs_extra3.default.ensureDirSync(outputFolderCards);
39073
39160
  const bitsFiles = import_fs_extra3.default.readdirSync(outputFolderBits).filter((f) => f.endsWith(".jsonc"));
39074
39161
  for (const file of bitsFiles) {
39075
39162
  import_fs_extra3.default.removeSync(import_node_path3.default.join(outputFolderBits, file));
@@ -39078,7 +39165,18 @@ var ConfigBuilder = class {
39078
39165
  for (const file of partialsFiles) {
39079
39166
  import_fs_extra3.default.removeSync(import_node_path3.default.join(outputFolderGroups, file));
39080
39167
  }
39168
+ const cardsFiles = import_fs_extra3.default.readdirSync(outputFolderCards).filter((f) => f.endsWith(".jsonc"));
39169
+ for (const file of cardsFiles) {
39170
+ import_fs_extra3.default.removeSync(import_node_path3.default.join(outputFolderCards, file));
39171
+ }
39081
39172
  const fileWrites = [];
39173
+ const tagEntriesTypeOrder = [
39174
+ BitTagConfigKeyType.tag,
39175
+ BitTagConfigKeyType.property,
39176
+ BitTagConfigKeyType.resource,
39177
+ BitTagConfigKeyType.group,
39178
+ BitTagConfigKeyType.unknown
39179
+ ];
39082
39180
  const resolveGroupReferences = (groupKey) => {
39083
39181
  if (squashedGroups.has(groupKey)) {
39084
39182
  const replacements = squashedGroups.get(groupKey);
@@ -39183,6 +39281,38 @@ var ConfigBuilder = class {
39183
39281
  tags2.push(t);
39184
39282
  return tags2;
39185
39283
  };
39284
+ const serializeCardSet = (cardSetKey) => {
39285
+ const cardSetConfig = CARDSETS[cardSetKey];
39286
+ if (!cardSetConfig) return void 0;
39287
+ const normalizedKey = normalizeCardKey(cardSetKey);
39288
+ const sides = cardSetConfig.variants.map((variantList) => {
39289
+ const variants = variantList.map((variant) => {
39290
+ const variantTags = [];
39291
+ const variantTagEntries = Object.entries(variant.tags ?? []).sort((a, b) => {
39292
+ const tagA = a[1];
39293
+ const tagB = b[1];
39294
+ const typeA = typeFromConfigKey(tagA.key);
39295
+ const typeB = typeFromConfigKey(tagB.key);
39296
+ const typeOrder = tagEntriesTypeOrder.indexOf(typeA) - tagEntriesTypeOrder.indexOf(typeB);
39297
+ return typeOrder;
39298
+ });
39299
+ for (const [, variantTag] of variantTagEntries) {
39300
+ variantTags.push(...processTagEntries(variantTag, []));
39301
+ }
39302
+ return {
39303
+ tags: variantTags,
39304
+ repeatCount: variant.repeatCount ?? 1,
39305
+ bodyAllowed: variant.bodyAllowed ?? true,
39306
+ bodyRequired: variant.bodyRequired ?? false
39307
+ };
39308
+ });
39309
+ return { variants };
39310
+ });
39311
+ return {
39312
+ key: normalizedKey,
39313
+ sides
39314
+ };
39315
+ };
39186
39316
  for (const bt of bitGroupConfigKeys) {
39187
39317
  const bitType = instance2.getBitType(bt);
39188
39318
  const _bitConfig = BITS[bitType];
@@ -39215,13 +39345,6 @@ var ConfigBuilder = class {
39215
39345
  for (const b of bitConfigs) {
39216
39346
  const resolvedBitConfig = instance2.getBitConfig(b.bitType);
39217
39347
  const tags2 = [];
39218
- const tagEntriesTypeOrder = [
39219
- BitTagConfigKeyType.tag,
39220
- BitTagConfigKeyType.property,
39221
- BitTagConfigKeyType.resource,
39222
- BitTagConfigKeyType.group,
39223
- BitTagConfigKeyType.unknown
39224
- ];
39225
39348
  const tagEntries = Object.entries(b.tags ?? []).sort((a, b2) => {
39226
39349
  const tagA = a[1];
39227
39350
  const tagB = b2[1];
@@ -39253,6 +39376,10 @@ var ConfigBuilder = class {
39253
39376
  tags2.push(...processTagEntries(tag, []));
39254
39377
  }
39255
39378
  }
39379
+ let cardRef;
39380
+ if (b.cardSet && CARDSETS[b.cardSet]) {
39381
+ cardRef = normalizeCardKey(b.cardSet);
39382
+ }
39256
39383
  const bitJson = {
39257
39384
  name: b.bitType,
39258
39385
  description: b.description ?? "",
@@ -39270,7 +39397,8 @@ var ConfigBuilder = class {
39270
39397
  footerAllowed: resolvedBitConfig.footerAllowed ?? true,
39271
39398
  footerRequired: resolvedBitConfig.footerRequired ?? false,
39272
39399
  resourceAttachmentAllowed: resolvedBitConfig.resourceAttachmentAllowed ?? true,
39273
- tags: tags2
39400
+ tags: tags2,
39401
+ ...cardRef ? { card: cardRef } : {}
39274
39402
  };
39275
39403
  const output = import_node_path3.default.join(outputFolderBits, `${b.bitType}.jsonc`);
39276
39404
  const str = JSON.stringify(bitJson, null, 2);
@@ -39280,7 +39408,7 @@ var ConfigBuilder = class {
39280
39408
  for (const g of groupConfigs2) {
39281
39409
  const tags2 = [];
39282
39410
  const groupKey = stringUtils.camelToKebab(g.key);
39283
- const tagEntriesTypeOrder = [
39411
+ const tagEntriesTypeOrder2 = [
39284
39412
  BitTagConfigKeyType.tag,
39285
39413
  BitTagConfigKeyType.property,
39286
39414
  BitTagConfigKeyType.resource,
@@ -39289,7 +39417,7 @@ var ConfigBuilder = class {
39289
39417
  const tagEntries = Object.entries(g.tags ?? []).sort((a, b) => {
39290
39418
  const tagA = a[1];
39291
39419
  const tagB = b[1];
39292
- const typeOrder = tagEntriesTypeOrder.indexOf(tagA.type) - tagEntriesTypeOrder.indexOf(tagB.type);
39420
+ const typeOrder = tagEntriesTypeOrder2.indexOf(tagA.type) - tagEntriesTypeOrder2.indexOf(tagB.type);
39293
39421
  return typeOrder;
39294
39422
  });
39295
39423
  for (const [_tagKey, tag] of tagEntries) {
@@ -39337,6 +39465,15 @@ var ConfigBuilder = class {
39337
39465
  }
39338
39466
  };
39339
39467
  writeGroupConfigs(groupConfigs);
39468
+ const writeCardConfigs = () => {
39469
+ for (const cardSetKey of Object.keys(CARDSETS)) {
39470
+ const cardJson = serializeCardSet(cardSetKey);
39471
+ if (!cardJson) continue;
39472
+ const output = import_node_path3.default.join(outputFolderCards, `${cardJson.key}.jsonc`);
39473
+ const str = JSON.stringify(cardJson, null, 2);
39474
+ fileWrites.push(import_fs_extra3.default.writeFile(output, str));
39475
+ }
39476
+ };
39340
39477
  const writeBitsAsGroupConfigs = (bitsAsGroupConfigs) => {
39341
39478
  for (const b of bitsAsGroupConfigs) {
39342
39479
  const groupKey = `group-${b.bitType}`;
@@ -39353,13 +39490,6 @@ var ConfigBuilder = class {
39353
39490
  });
39354
39491
  }
39355
39492
  }
39356
- const tagEntriesTypeOrder = [
39357
- BitTagConfigKeyType.tag,
39358
- BitTagConfigKeyType.property,
39359
- BitTagConfigKeyType.resource,
39360
- BitTagConfigKeyType.group,
39361
- BitTagConfigKeyType.unknown
39362
- ];
39363
39493
  const tagEntries = Object.entries(b.tags ?? []).sort((a, b2) => {
39364
39494
  const tagA = a[1];
39365
39495
  const tagB = b2[1];
@@ -39390,6 +39520,7 @@ var ConfigBuilder = class {
39390
39520
  }
39391
39521
  };
39392
39522
  writeBitsAsGroupConfigs(bitGroupConfigs);
39523
+ writeCardConfigs();
39393
39524
  Promise.all(fileWrites).then(() => {
39394
39525
  const validationErrors = this.validateConfigTree(outputFolder);
39395
39526
  if (validationErrors.length > 0) {
@@ -39415,6 +39546,7 @@ var ConfigBuilder = class {
39415
39546
  const errors = [];
39416
39547
  const outputFolderBits = import_node_path3.default.join(outputFolder, "bits");
39417
39548
  const outputFolderGroups = import_node_path3.default.join(outputFolder, "partials");
39549
+ const outputFolderCards = import_node_path3.default.join(outputFolder, "cards");
39418
39550
  const availableGroups = /* @__PURE__ */ new Set();
39419
39551
  if (import_fs_extra3.default.existsSync(outputFolderGroups)) {
39420
39552
  const groupFiles = import_fs_extra3.default.readdirSync(outputFolderGroups).filter((f) => f.endsWith(".jsonc"));
@@ -39423,16 +39555,22 @@ var ConfigBuilder = class {
39423
39555
  availableGroups.add(groupName);
39424
39556
  }
39425
39557
  }
39558
+ const availableCards = /* @__PURE__ */ new Set();
39559
+ const cardFiles = import_fs_extra3.default.existsSync(outputFolderCards) ? import_fs_extra3.default.readdirSync(outputFolderCards).filter((f) => f.endsWith(".jsonc")) : [];
39560
+ for (const file of cardFiles) {
39561
+ const cardName = file.replace(".jsonc", "");
39562
+ availableCards.add(cardName);
39563
+ }
39426
39564
  const checkTags = (tags2, filePath, lineOffset) => {
39427
39565
  for (let i = 0; i < tags2.length; i++) {
39428
39566
  const tag = tags2[i];
39429
- if (tag.type === "group") {
39567
+ if (tag?.type === "group" && tag.key) {
39430
39568
  if (!availableGroups.has(tag.key)) {
39431
39569
  const line = lineOffset + i + 1;
39432
39570
  errors.push(`Missing group reference '${tag.key}' in ${filePath}:${line}`);
39433
39571
  }
39434
39572
  }
39435
- if (tag.tags && Array.isArray(tag.tags)) {
39573
+ if (Array.isArray(tag?.tags)) {
39436
39574
  checkTags(tag.tags, filePath, lineOffset + i + 1);
39437
39575
  }
39438
39576
  }
@@ -39447,6 +39585,27 @@ var ConfigBuilder = class {
39447
39585
  if (config.tags && Array.isArray(config.tags)) {
39448
39586
  checkTags(config.tags, `bits/${file}`, 15);
39449
39587
  }
39588
+ if (typeof config.card === "string") {
39589
+ if (!availableCards.has(config.card)) {
39590
+ errors.push(`Missing card file '${config.card}' referenced in bits/${file}`);
39591
+ }
39592
+ } else if (config.card?.sides && Array.isArray(config.card.sides)) {
39593
+ config.card.sides.forEach((side, sideIdx) => {
39594
+ const variants = side.variants;
39595
+ if (Array.isArray(variants)) {
39596
+ variants.forEach((variant, variantIdx) => {
39597
+ const variantTags = variant.tags;
39598
+ if (Array.isArray(variantTags)) {
39599
+ checkTags(
39600
+ variantTags,
39601
+ `bits/${file} (card side ${sideIdx}, variant ${variantIdx})`,
39602
+ 15
39603
+ );
39604
+ }
39605
+ });
39606
+ }
39607
+ });
39608
+ }
39450
39609
  } catch (err) {
39451
39610
  errors.push(`Failed to parse ${file}: ${err}`);
39452
39611
  }
@@ -39467,6 +39626,38 @@ var ConfigBuilder = class {
39467
39626
  }
39468
39627
  }
39469
39628
  }
39629
+ if (cardFiles.length > 0) {
39630
+ for (const file of cardFiles) {
39631
+ const filePath = import_node_path3.default.join(outputFolderCards, file);
39632
+ try {
39633
+ const content = import_fs_extra3.default.readFileSync(filePath, "utf-8");
39634
+ const config = JSON.parse(content);
39635
+ const expectedKey = file.replace(".jsonc", "");
39636
+ if (config.key && config.key !== expectedKey) {
39637
+ errors.push(`Card key mismatch in cards/${file}: expected '${expectedKey}'`);
39638
+ }
39639
+ if (Array.isArray(config.sides)) {
39640
+ config.sides.forEach((side, sideIdx) => {
39641
+ const variants = side.variants;
39642
+ if (Array.isArray(variants)) {
39643
+ variants.forEach((variant, variantIdx) => {
39644
+ const variantTags = variant.tags;
39645
+ if (Array.isArray(variantTags)) {
39646
+ checkTags(
39647
+ variantTags,
39648
+ `cards/${file} (side ${sideIdx}, variant ${variantIdx})`,
39649
+ 10
39650
+ );
39651
+ }
39652
+ });
39653
+ }
39654
+ });
39655
+ }
39656
+ } catch (err) {
39657
+ errors.push(`Failed to parse cards/${file}: ${err}`);
39658
+ }
39659
+ }
39660
+ }
39470
39661
  return errors;
39471
39662
  }
39472
39663
  // Build flat bit configs
@@ -39561,6 +39752,11 @@ var ConfigBuilder = class {
39561
39752
  for (const [_tagKey, tag] of tagEntries) {
39562
39753
  tags2.push(...processTagEntries(tag));
39563
39754
  }
39755
+ let cardRef;
39756
+ const cardSetKey = b.cardSet?.configKey;
39757
+ if (cardSetKey && CARDSETS[cardSetKey]) {
39758
+ cardRef = normalizeCardKey(cardSetKey);
39759
+ }
39564
39760
  const bitJson = {
39565
39761
  name: b.bitType,
39566
39762
  description: "",
@@ -39578,7 +39774,8 @@ var ConfigBuilder = class {
39578
39774
  footerAllowed: b.footerAllowed ?? true,
39579
39775
  footerRequired: b.footerRequired ?? false,
39580
39776
  resourceAttachmentAllowed: b.resourceAttachmentAllowed ?? true,
39581
- tags: tags2
39777
+ tags: tags2,
39778
+ ...cardRef ? { card: cardRef } : {}
39582
39779
  };
39583
39780
  const output = import_node_path3.default.join(outputFolderBits, `${b.bitType}.jsonc`);
39584
39781
  const str = JSON.stringify(bitJson, null, 2);