@gmb/bitmark-parser-generator 4.19.0 → 5.0.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/bin/run +4 -0
- package/dist/browser/bitmark-parser-generator.min.js +1 -1
- package/dist/browser/bundle-report.html +6 -5
- package/dist/browser/cjs/index.cjs +243 -135
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +1886 -3721
- package/dist/browser/esm/index.d.ts +1886 -3721
- package/dist/browser/esm/index.js +255 -149
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/cli/main.js +39514 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/index.cjs +246 -137
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1886 -3721
- package/dist/index.d.ts +1886 -3721
- package/dist/index.js +258 -151
- package/dist/index.js.map +1 -1
- package/package.json +29 -23
package/dist/index.cjs
CHANGED
|
@@ -57,13 +57,18 @@ __export(index_exports, {
|
|
|
57
57
|
ResourceBuilder: () => ResourceBuilder,
|
|
58
58
|
StreamWriter: () => StreamWriter,
|
|
59
59
|
StringWriter: () => StringWriter,
|
|
60
|
+
TextMarkType: () => TextMarkType,
|
|
61
|
+
TextNodeType: () => TextNodeType,
|
|
60
62
|
bitmarkTextParse: () => parse
|
|
61
63
|
});
|
|
62
64
|
module.exports = __toCommonJS(index_exports);
|
|
63
65
|
|
|
66
|
+
// src/config/Config.ts
|
|
67
|
+
var import_superenum16 = require("@ncoderz/superenum");
|
|
68
|
+
|
|
64
69
|
// src/model/enum/BitType.ts
|
|
65
70
|
var import_superenum = require("@ncoderz/superenum");
|
|
66
|
-
var BitType =
|
|
71
|
+
var BitType = {
|
|
67
72
|
_error: "_error",
|
|
68
73
|
// Used for error handling to indicate a bit type that is not supported or a bit parse error
|
|
69
74
|
_comment: "_comment",
|
|
@@ -452,6 +457,7 @@ var BitType = (0, import_superenum.superenum)({
|
|
|
452
457
|
multipleResponse: "multiple-response",
|
|
453
458
|
multipleResponse1: "multiple-response-1",
|
|
454
459
|
newspaperArticle: "newspaper-article",
|
|
460
|
+
nonProductionPrototypeIframe: "non-production-prototype-iframe",
|
|
455
461
|
note: "note",
|
|
456
462
|
noteAi: "note-ai",
|
|
457
463
|
noteAlt: "note-alt",
|
|
@@ -664,6 +670,7 @@ var BitType = (0, import_superenum.superenum)({
|
|
|
664
670
|
vendorJupyterCellRaw: "vendor-jupyter-cell-raw",
|
|
665
671
|
vendorJupyterIpynb: "vendor-jupyter-ipynb",
|
|
666
672
|
vendorJupyterOutput: "vendor-jupyter-output",
|
|
673
|
+
vendorLearndashEmbed: "vendor-learndash-embed",
|
|
667
674
|
vendorPadletEmbed: "vendor-padlet-embed",
|
|
668
675
|
vendorStripePricingTable: "vendor-stripe-pricing-table",
|
|
669
676
|
vendorStripePricingTableExternal: "vendor-stripe-pricing-table-external",
|
|
@@ -682,24 +689,24 @@ var BitType = (0, import_superenum.superenum)({
|
|
|
682
689
|
warningCollapsible: "warning-collapsible",
|
|
683
690
|
websiteLink: "website-link",
|
|
684
691
|
workbookArticle: "workbook-article"
|
|
685
|
-
}
|
|
692
|
+
};
|
|
686
693
|
|
|
687
694
|
// src/model/enum/Count.ts
|
|
688
695
|
var import_superenum2 = require("@ncoderz/superenum");
|
|
689
|
-
var Count =
|
|
696
|
+
var Count = {
|
|
690
697
|
infinity: "infinity"
|
|
691
|
-
}
|
|
698
|
+
};
|
|
692
699
|
|
|
693
700
|
// src/model/enum/ExampleType.ts
|
|
694
701
|
var import_superenum3 = require("@ncoderz/superenum");
|
|
695
|
-
var ExampleType =
|
|
702
|
+
var ExampleType = {
|
|
696
703
|
none: "none",
|
|
697
704
|
// Example is not allowed
|
|
698
705
|
string: "string",
|
|
699
706
|
// Example is a string value
|
|
700
707
|
boolean: "boolean"
|
|
701
708
|
// Example is a boolean value
|
|
702
|
-
}
|
|
709
|
+
};
|
|
703
710
|
|
|
704
711
|
// src/model/enum/Tag.ts
|
|
705
712
|
var import_superenum4 = require("@ncoderz/superenum");
|
|
@@ -718,11 +725,11 @@ var tags = {
|
|
|
718
725
|
tag_mark: "=",
|
|
719
726
|
tag_resource: "&"
|
|
720
727
|
};
|
|
721
|
-
var Tag =
|
|
728
|
+
var Tag = tags;
|
|
722
729
|
|
|
723
730
|
// src/model/enum/TagFormat.ts
|
|
724
731
|
var import_superenum5 = require("@ncoderz/superenum");
|
|
725
|
-
var TagFormat =
|
|
732
|
+
var TagFormat = {
|
|
726
733
|
none: "none",
|
|
727
734
|
// The property does not have a value
|
|
728
735
|
plainText: "plainText",
|
|
@@ -735,11 +742,11 @@ var TagFormat = (0, import_superenum5.superenum)({
|
|
|
735
742
|
// If the value is treated as a boolean
|
|
736
743
|
invertedBoolean: "invertedBoolean"
|
|
737
744
|
// If the value is treated as a boolean with the value inverted (e.g. isLongAnswer ==> isShortAnswer = false)
|
|
738
|
-
}
|
|
745
|
+
};
|
|
739
746
|
|
|
740
747
|
// src/model/enum/TextFormat.ts
|
|
741
748
|
var import_superenum6 = require("@ncoderz/superenum");
|
|
742
|
-
var TextFormat =
|
|
749
|
+
var TextFormat = {
|
|
743
750
|
// plain text
|
|
744
751
|
plainText: "text",
|
|
745
752
|
latex: "latex",
|
|
@@ -751,11 +758,11 @@ var TextFormat = (0, import_superenum6.superenum)({
|
|
|
751
758
|
// bitmarkText
|
|
752
759
|
// bitmarkText in the body is bitmark++ and bitmarkText in a tag is bitmark+
|
|
753
760
|
bitmarkText: "bitmark++"
|
|
754
|
-
}
|
|
761
|
+
};
|
|
755
762
|
|
|
756
763
|
// src/model/config/enum/CardSetConfigKey.ts
|
|
757
764
|
var import_superenum7 = require("@ncoderz/superenum");
|
|
758
|
-
var CardSetConfigKey =
|
|
765
|
+
var CardSetConfigKey = {
|
|
759
766
|
flashcard: "flashcard",
|
|
760
767
|
definitionList: "definitionList",
|
|
761
768
|
elements: "elements",
|
|
@@ -777,22 +784,22 @@ var CardSetConfigKey = (0, import_superenum7.superenum)({
|
|
|
777
784
|
// DEPRECATED - TO BE REMOVED IN THE FUTURE
|
|
778
785
|
// captionDefinitionsList: 'captionDefinitionsList',
|
|
779
786
|
bookReferenceList: "bookReferenceList"
|
|
780
|
-
}
|
|
787
|
+
};
|
|
781
788
|
|
|
782
789
|
// src/model/config/enum/GroupConfigType.ts
|
|
783
790
|
var import_superenum8 = require("@ncoderz/superenum");
|
|
784
|
-
var GroupConfigType =
|
|
791
|
+
var GroupConfigType = {
|
|
785
792
|
standard: "standard",
|
|
786
793
|
// Any ordinary group
|
|
787
794
|
resource: "resource",
|
|
788
795
|
// A resource group
|
|
789
796
|
comboResource: "comboResource"
|
|
790
797
|
// A combo resource group
|
|
791
|
-
}
|
|
798
|
+
};
|
|
792
799
|
|
|
793
800
|
// src/model/enum/BitTagConfigKeyType.ts
|
|
794
801
|
var import_superenum9 = require("@ncoderz/superenum");
|
|
795
|
-
var BitTagConfigKeyType =
|
|
802
|
+
var BitTagConfigKeyType = {
|
|
796
803
|
unknown: "unknown",
|
|
797
804
|
// Unknown tag type, used for error handling
|
|
798
805
|
tag: "tag",
|
|
@@ -804,7 +811,7 @@ var BitTagConfigKeyType = (0, import_superenum9.superenum)({
|
|
|
804
811
|
//
|
|
805
812
|
group: "group"
|
|
806
813
|
// A reusable group of tags
|
|
807
|
-
}
|
|
814
|
+
};
|
|
808
815
|
|
|
809
816
|
// src/model/config/AbstractTagConfig.ts
|
|
810
817
|
var AbstractTagConfig = class {
|
|
@@ -1173,7 +1180,6 @@ var groupKeys = {
|
|
|
1173
1180
|
group_previewImages: "group_previewImages",
|
|
1174
1181
|
group_previewVideos: "group_previewVideos"
|
|
1175
1182
|
};
|
|
1176
|
-
var GroupKey = (0, import_superenum10.superenum)(groupKeys);
|
|
1177
1183
|
|
|
1178
1184
|
// src/model/enum/PropertyKey.ts
|
|
1179
1185
|
var import_superenum11 = require("@ncoderz/superenum");
|
|
@@ -1280,6 +1286,8 @@ var propertyKeys = {
|
|
|
1280
1286
|
property_icon: "@icon",
|
|
1281
1287
|
property_iconTag: "@iconTag",
|
|
1282
1288
|
property_id: "@id",
|
|
1289
|
+
property_iframeSrc: "@iframeSrc",
|
|
1290
|
+
property_iframeName: "@iframeName",
|
|
1283
1291
|
property_imageFirst: "@imageFirst",
|
|
1284
1292
|
property_imageSource: "@imageSource",
|
|
1285
1293
|
property_index: "@index",
|
|
@@ -1446,7 +1454,7 @@ var propertyKeys = {
|
|
|
1446
1454
|
property_y: "@y",
|
|
1447
1455
|
property_zoomDisabled: "@zoomDisabled"
|
|
1448
1456
|
};
|
|
1449
|
-
var PropertyKey =
|
|
1457
|
+
var PropertyKey = propertyKeys;
|
|
1450
1458
|
|
|
1451
1459
|
// src/model/enum/ResourceKey.ts
|
|
1452
1460
|
var import_superenum12 = require("@ncoderz/superenum");
|
|
@@ -1485,7 +1493,6 @@ var resourceKeys = {
|
|
|
1485
1493
|
resource_previewVideo: "&previewVideo",
|
|
1486
1494
|
resource_coverImage: "&coverImage"
|
|
1487
1495
|
};
|
|
1488
|
-
var ResourceKey = (0, import_superenum12.superenum)(resourceKeys);
|
|
1489
1496
|
|
|
1490
1497
|
// src/model/enum/ResourceType.ts
|
|
1491
1498
|
var import_superenum13 = require("@ncoderz/superenum");
|
|
@@ -1679,7 +1686,7 @@ var StringUtils = class {
|
|
|
1679
1686
|
var stringUtils = new StringUtils();
|
|
1680
1687
|
|
|
1681
1688
|
// src/model/enum/ResourceType.ts
|
|
1682
|
-
var ResourceType =
|
|
1689
|
+
var ResourceType = {
|
|
1683
1690
|
unknown: "unknown",
|
|
1684
1691
|
image: "image",
|
|
1685
1692
|
imageResponsive: "image-responsive",
|
|
@@ -1715,13 +1722,13 @@ var ResourceType = (0, import_superenum13.superenum)({
|
|
|
1715
1722
|
previewImage: "previewImage",
|
|
1716
1723
|
previewVideo: "previewVideo",
|
|
1717
1724
|
coverImage: "coverImage"
|
|
1718
|
-
}
|
|
1725
|
+
};
|
|
1719
1726
|
function resourceTypeToConfigKey(type) {
|
|
1720
1727
|
return `&${stringUtils.kebabToCamel(type)}`;
|
|
1721
1728
|
}
|
|
1722
1729
|
|
|
1723
1730
|
// src/model/config/enum/ConfigKey.ts
|
|
1724
|
-
var ConfigKey =
|
|
1731
|
+
var ConfigKey = {
|
|
1725
1732
|
// Internal
|
|
1726
1733
|
_unknown: "_unknown",
|
|
1727
1734
|
// Tags
|
|
@@ -1732,7 +1739,7 @@ var ConfigKey = (0, import_superenum14.superenum)({
|
|
|
1732
1739
|
...propertyKeys,
|
|
1733
1740
|
// Groups
|
|
1734
1741
|
...groupKeys
|
|
1735
|
-
}
|
|
1742
|
+
};
|
|
1736
1743
|
function typeFromConfigKey(tagKey) {
|
|
1737
1744
|
if (!tagKey) return BitTagConfigKeyType.unknown;
|
|
1738
1745
|
if (tagKey.startsWith("@")) return BitTagConfigKeyType.property;
|
|
@@ -1744,7 +1751,7 @@ function configKeyToPropertyType(configKey) {
|
|
|
1744
1751
|
return configKey.replace(/^@/, "");
|
|
1745
1752
|
}
|
|
1746
1753
|
function configKeyToResourceType(configKey) {
|
|
1747
|
-
return ResourceType.fromKey(configKey.replace(/^&/, ""));
|
|
1754
|
+
return (0, import_superenum14.Enum)(ResourceType).fromKey(configKey.replace(/^&/, ""));
|
|
1748
1755
|
}
|
|
1749
1756
|
|
|
1750
1757
|
// src/model/config/ResourcesConfig.ts
|
|
@@ -2136,6 +2143,9 @@ var ObjectUtils = class {
|
|
|
2136
2143
|
};
|
|
2137
2144
|
var objectUtils = new ObjectUtils();
|
|
2138
2145
|
|
|
2146
|
+
// src/config/ConfigHydrator.ts
|
|
2147
|
+
var import_superenum15 = require("@ncoderz/superenum");
|
|
2148
|
+
|
|
2139
2149
|
// src/config/raw/cardSets.ts
|
|
2140
2150
|
var CARDSETS = {
|
|
2141
2151
|
[CardSetConfigKey.definitionList]: {
|
|
@@ -4374,9 +4384,9 @@ var ConfigHydrator = class {
|
|
|
4374
4384
|
}
|
|
4375
4385
|
hydrateTagConfig(_tag) {
|
|
4376
4386
|
const { key: _configKey, maxCount, minCount, chain: _chain, deprecated } = _tag;
|
|
4377
|
-
const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
|
|
4387
|
+
const configKey = (0, import_superenum15.Enum)(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
|
|
4378
4388
|
if (!configKey) throw new Error(`No tag key found for config key '${configKey}'`);
|
|
4379
|
-
const tag = Tag.fromValue(configKey);
|
|
4389
|
+
const tag = (0, import_superenum15.Enum)(Tag).fromValue(configKey);
|
|
4380
4390
|
if (!tag) throw new Error(`No tag found for tag config key '${configKey}'`);
|
|
4381
4391
|
let chain;
|
|
4382
4392
|
if (_chain) {
|
|
@@ -4407,7 +4417,7 @@ var ConfigHydrator = class {
|
|
|
4407
4417
|
defaultValue,
|
|
4408
4418
|
jsonKey
|
|
4409
4419
|
} = _tag;
|
|
4410
|
-
const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
|
|
4420
|
+
const configKey = (0, import_superenum15.Enum)(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
|
|
4411
4421
|
if (!configKey) throw new Error(`No property key found for config key '${configKey}'`);
|
|
4412
4422
|
const tag = _configKey.substring(1);
|
|
4413
4423
|
let chain;
|
|
@@ -4433,7 +4443,7 @@ var ConfigHydrator = class {
|
|
|
4433
4443
|
}
|
|
4434
4444
|
hydrateResourceTagConfig(_tag) {
|
|
4435
4445
|
const { key: _configKey, maxCount, minCount, chain: _chain, deprecated, jsonKey } = _tag;
|
|
4436
|
-
const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
|
|
4446
|
+
const configKey = (0, import_superenum15.Enum)(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
|
|
4437
4447
|
if (!configKey) throw new Error(`No resource key found for config key '${configKey}'`);
|
|
4438
4448
|
const tag = _configKey.substring(1);
|
|
4439
4449
|
let chain;
|
|
@@ -4457,7 +4467,7 @@ var ConfigHydrator = class {
|
|
|
4457
4467
|
}
|
|
4458
4468
|
hydrateTagGroupConfig(_tag) {
|
|
4459
4469
|
const { key: _configKey } = _tag;
|
|
4460
|
-
const configKey = ConfigKey.fromValue(_configKey) || ConfigKey._unknown;
|
|
4470
|
+
const configKey = (0, import_superenum15.Enum)(ConfigKey).fromValue(_configKey) || ConfigKey._unknown;
|
|
4461
4471
|
if (!configKey) throw new Error(`No group key found for config key '${configKey}'`);
|
|
4462
4472
|
const _groupConfig = GROUPS[configKey];
|
|
4463
4473
|
if (!_groupConfig) throw new Error(`No config found for group config key '${_configKey}'`);
|
|
@@ -9901,6 +9911,27 @@ var BITS = {
|
|
|
9901
9911
|
}
|
|
9902
9912
|
],
|
|
9903
9913
|
resourceAttachmentAllowed: false
|
|
9914
|
+
},
|
|
9915
|
+
[BitType.nonProductionPrototypeIframe]: {
|
|
9916
|
+
since: "4.20.0",
|
|
9917
|
+
baseBitType: BitType._standard,
|
|
9918
|
+
description: "A non-production prototype iframe bit, used to embed prototype iframes",
|
|
9919
|
+
tags: [
|
|
9920
|
+
{
|
|
9921
|
+
key: ConfigKey.property_iframeSrc,
|
|
9922
|
+
description: "Iframe source URL, used to define the source of the iframe"
|
|
9923
|
+
},
|
|
9924
|
+
{
|
|
9925
|
+
key: ConfigKey.property_iframeName,
|
|
9926
|
+
description: "Iframe name, used to define the name of the iframe",
|
|
9927
|
+
minCount: 1
|
|
9928
|
+
}
|
|
9929
|
+
]
|
|
9930
|
+
},
|
|
9931
|
+
[BitType.vendorLearndashEmbed]: {
|
|
9932
|
+
since: "5.0.0",
|
|
9933
|
+
baseBitType: BitType.nonProductionPrototypeIframe,
|
|
9934
|
+
description: "Learndash embed bit, used to embed Learndash content in an iframe"
|
|
9904
9935
|
}
|
|
9905
9936
|
};
|
|
9906
9937
|
|
|
@@ -9923,7 +9954,7 @@ var Config = class {
|
|
|
9923
9954
|
*/
|
|
9924
9955
|
getBitType(bitType) {
|
|
9925
9956
|
if (bitType?.startsWith("|")) bitType = bitType.substring(1);
|
|
9926
|
-
return BitType.fromValue(bitType) ?? BitType._error;
|
|
9957
|
+
return (0, import_superenum16.Enum)(BitType).fromValue(bitType) ?? BitType._error;
|
|
9927
9958
|
}
|
|
9928
9959
|
/**
|
|
9929
9960
|
* Check if a bit type is and instance of the given root bit type.
|
|
@@ -10243,15 +10274,15 @@ var instance2 = new Config();
|
|
|
10243
10274
|
// src/generated/package_info.ts
|
|
10244
10275
|
var PACKAGE_INFO = {
|
|
10245
10276
|
"name": "@gmb/bitmark-parser-generator",
|
|
10246
|
-
"version": "
|
|
10277
|
+
"version": "5.0.0",
|
|
10247
10278
|
"author": "Get More Brain Ltd",
|
|
10248
10279
|
"license": "ISC",
|
|
10249
10280
|
"description": "A bitmark parser and generator using Peggy.js"
|
|
10250
10281
|
};
|
|
10251
10282
|
|
|
10252
10283
|
// src/utils/env/Environment.ts
|
|
10253
|
-
var
|
|
10254
|
-
var Environment =
|
|
10284
|
+
var import_superenum17 = require("@ncoderz/superenum");
|
|
10285
|
+
var Environment = {
|
|
10255
10286
|
unknown: "",
|
|
10256
10287
|
node: "node",
|
|
10257
10288
|
chrome: "chrome",
|
|
@@ -10259,18 +10290,18 @@ var Environment = (0, import_superenum15.superenum)({
|
|
|
10259
10290
|
firefox: "firefox",
|
|
10260
10291
|
edge: "edge",
|
|
10261
10292
|
ie: "ie"
|
|
10262
|
-
}
|
|
10293
|
+
};
|
|
10263
10294
|
|
|
10264
10295
|
// src/utils/env/Os.ts
|
|
10265
|
-
var
|
|
10266
|
-
var Os =
|
|
10296
|
+
var import_superenum18 = require("@ncoderz/superenum");
|
|
10297
|
+
var Os = {
|
|
10267
10298
|
unknown: "",
|
|
10268
10299
|
macos: "macos",
|
|
10269
10300
|
windows: "windows",
|
|
10270
10301
|
linux: "linux",
|
|
10271
10302
|
android: "android",
|
|
10272
10303
|
ios: "ios"
|
|
10273
|
-
}
|
|
10304
|
+
};
|
|
10274
10305
|
|
|
10275
10306
|
// src/utils/env/userAgent.ts
|
|
10276
10307
|
function parseUserAgent() {
|
|
@@ -10478,8 +10509,11 @@ function init() {
|
|
|
10478
10509
|
initialised = true;
|
|
10479
10510
|
}
|
|
10480
10511
|
|
|
10512
|
+
// src/ast/Ast.ts
|
|
10513
|
+
var import_superenum23 = require("@ncoderz/superenum");
|
|
10514
|
+
|
|
10481
10515
|
// src/model/enum/BodyBitType.ts
|
|
10482
|
-
var
|
|
10516
|
+
var import_superenum19 = require("@ncoderz/superenum");
|
|
10483
10517
|
var BodyBitTypeRaw = {
|
|
10484
10518
|
text: "text",
|
|
10485
10519
|
gap: "gap",
|
|
@@ -10487,11 +10521,11 @@ var BodyBitTypeRaw = {
|
|
|
10487
10521
|
select: "select",
|
|
10488
10522
|
highlight: "highlight"
|
|
10489
10523
|
};
|
|
10490
|
-
var BodyBitType =
|
|
10524
|
+
var BodyBitType = BodyBitTypeRaw;
|
|
10491
10525
|
|
|
10492
10526
|
// src/model/enum/TextMarkType.ts
|
|
10493
|
-
var
|
|
10494
|
-
var TextMarkType =
|
|
10527
|
+
var import_superenum20 = require("@ncoderz/superenum");
|
|
10528
|
+
var TextMarkType = {
|
|
10495
10529
|
// Styles
|
|
10496
10530
|
bold: "bold",
|
|
10497
10531
|
light: "light",
|
|
@@ -10538,11 +10572,11 @@ var TextMarkType = (0, import_superenum18.superenum)({
|
|
|
10538
10572
|
duration: "duration",
|
|
10539
10573
|
color: "color",
|
|
10540
10574
|
comment: "comment"
|
|
10541
|
-
}
|
|
10575
|
+
};
|
|
10542
10576
|
|
|
10543
10577
|
// src/model/enum/TextNodeType.ts
|
|
10544
|
-
var
|
|
10545
|
-
var TextNodeType =
|
|
10578
|
+
var import_superenum21 = require("@ncoderz/superenum");
|
|
10579
|
+
var TextNodeType = {
|
|
10546
10580
|
// Text
|
|
10547
10581
|
text: "text",
|
|
10548
10582
|
// Blocks
|
|
@@ -10570,11 +10604,11 @@ var TextNodeType = (0, import_superenum19.superenum)({
|
|
|
10570
10604
|
select: "select",
|
|
10571
10605
|
highlight: "highlight",
|
|
10572
10606
|
mark: "mark"
|
|
10573
|
-
}
|
|
10607
|
+
};
|
|
10574
10608
|
|
|
10575
10609
|
// src/model/ast/NodeType.ts
|
|
10576
|
-
var
|
|
10577
|
-
var NodeType =
|
|
10610
|
+
var import_superenum22 = require("@ncoderz/superenum");
|
|
10611
|
+
var NodeType = {
|
|
10578
10612
|
unknown: "unknown",
|
|
10579
10613
|
// unknown
|
|
10580
10614
|
__isDefaultExample: "__isDefaultExample",
|
|
@@ -10837,6 +10871,8 @@ var NodeType = (0, import_superenum20.superenum)({
|
|
|
10837
10871
|
iconValue: "iconValue",
|
|
10838
10872
|
id: "id",
|
|
10839
10873
|
idValue: "idValue",
|
|
10874
|
+
iframeSrc: "iframeSrc",
|
|
10875
|
+
iframeName: "iframeName",
|
|
10840
10876
|
image: "image",
|
|
10841
10877
|
imageFirst: "imageFirst",
|
|
10842
10878
|
imageFirstValue: "imageFirstValue",
|
|
@@ -11255,7 +11291,7 @@ var NodeType = (0, import_superenum20.superenum)({
|
|
|
11255
11291
|
y: "y",
|
|
11256
11292
|
yValue: "yValue",
|
|
11257
11293
|
zoomDisabled: "zoomDisabled"
|
|
11258
|
-
}
|
|
11294
|
+
};
|
|
11259
11295
|
|
|
11260
11296
|
// src/ast/Ast.ts
|
|
11261
11297
|
var Ast = class {
|
|
@@ -11438,7 +11474,7 @@ var Ast = class {
|
|
|
11438
11474
|
if (isParentArray && parentKey) {
|
|
11439
11475
|
astKey = `${parentKey}Value`;
|
|
11440
11476
|
}
|
|
11441
|
-
return NodeType.fromKey(astKey) || `unknown(${astKey})`;
|
|
11477
|
+
return (0, import_superenum23.Enum)(NodeType).fromKey(astKey) || `unknown(${astKey})`;
|
|
11442
11478
|
}
|
|
11443
11479
|
isArray(x) {
|
|
11444
11480
|
return Array.isArray(x);
|
|
@@ -11451,16 +11487,19 @@ var Ast = class {
|
|
|
11451
11487
|
}
|
|
11452
11488
|
};
|
|
11453
11489
|
|
|
11490
|
+
// src/ast/Builder.ts
|
|
11491
|
+
var import_superenum30 = require("@ncoderz/superenum");
|
|
11492
|
+
|
|
11454
11493
|
// src/model/enum/TextLocation.ts
|
|
11455
|
-
var
|
|
11456
|
-
var TextLocation =
|
|
11494
|
+
var import_superenum24 = require("@ncoderz/superenum");
|
|
11495
|
+
var TextLocation = {
|
|
11457
11496
|
tag: "tag",
|
|
11458
11497
|
body: "body"
|
|
11459
|
-
}
|
|
11498
|
+
};
|
|
11460
11499
|
|
|
11461
11500
|
// src/model/enum/BodyTextFormat.ts
|
|
11462
|
-
var
|
|
11463
|
-
var BodyTextFormat =
|
|
11501
|
+
var import_superenum25 = require("@ncoderz/superenum");
|
|
11502
|
+
var BodyTextFormat = {
|
|
11464
11503
|
plainText: "text",
|
|
11465
11504
|
// plain text
|
|
11466
11505
|
latex: "latex",
|
|
@@ -11471,7 +11510,7 @@ var BodyTextFormat = (0, import_superenum22.superenum)({
|
|
|
11471
11510
|
// xml
|
|
11472
11511
|
// bitmark++ text
|
|
11473
11512
|
bitmarkPlusPlus: "bitmark++"
|
|
11474
|
-
}
|
|
11513
|
+
};
|
|
11475
11514
|
|
|
11476
11515
|
// src/breakscaping/RegexConfigs.ts
|
|
11477
11516
|
var REGEX_MARKS = /([*`_!=])(?=\1)/;
|
|
@@ -11720,11 +11759,11 @@ var Breakscape2 = class {
|
|
|
11720
11759
|
var instance3 = new Breakscape2();
|
|
11721
11760
|
|
|
11722
11761
|
// src/model/enum/DeprecatedTextFormat.ts
|
|
11723
|
-
var
|
|
11724
|
-
var DeprecatedTextFormat =
|
|
11762
|
+
var import_superenum26 = require("@ncoderz/superenum");
|
|
11763
|
+
var DeprecatedTextFormat = {
|
|
11725
11764
|
bitmarkMinusMinus: "bitmark--"
|
|
11726
11765
|
// bitmark-- text format, deprecated
|
|
11727
|
-
}
|
|
11766
|
+
};
|
|
11728
11767
|
|
|
11729
11768
|
// src/parser/json/TableUtils.ts
|
|
11730
11769
|
function isTableBasicFormat(table) {
|
|
@@ -11883,14 +11922,14 @@ var ArrayUtils = class {
|
|
|
11883
11922
|
var instance4 = new ArrayUtils();
|
|
11884
11923
|
|
|
11885
11924
|
// src/generator/text/TextGenerator.ts
|
|
11886
|
-
var
|
|
11925
|
+
var import_superenum28 = require("@ncoderz/superenum");
|
|
11887
11926
|
|
|
11888
11927
|
// src/model/enum/BitmarkVersion.ts
|
|
11889
|
-
var
|
|
11890
|
-
var BitmarkVersion =
|
|
11928
|
+
var import_superenum27 = require("@ncoderz/superenum");
|
|
11929
|
+
var BitmarkVersion = {
|
|
11891
11930
|
v2: 2,
|
|
11892
11931
|
v3: 3
|
|
11893
|
-
}
|
|
11932
|
+
};
|
|
11894
11933
|
var DEFAULT_BITMARK_VERSION = BitmarkVersion.v3;
|
|
11895
11934
|
|
|
11896
11935
|
// src/generator/AstWalkerGenerator.ts
|
|
@@ -12077,7 +12116,7 @@ var TextGenerator = class extends AstWalkerGenerator {
|
|
|
12077
12116
|
__publicField(this, "preTextIndexTemp", -1);
|
|
12078
12117
|
__publicField(this, "havePreText", false);
|
|
12079
12118
|
__publicField(this, "preTextIndex", -1);
|
|
12080
|
-
this.bitmarkVersion = BitmarkVersion.fromValue(bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
12119
|
+
this.bitmarkVersion = (0, import_superenum28.Enum)(BitmarkVersion).fromValue(bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
12081
12120
|
this.options = {
|
|
12082
12121
|
...DEFAULT_OPTIONS,
|
|
12083
12122
|
...options
|
|
@@ -22262,6 +22301,9 @@ var BitUtils = class {
|
|
|
22262
22301
|
};
|
|
22263
22302
|
var instance7 = new BitUtils();
|
|
22264
22303
|
|
|
22304
|
+
// src/ast/ResourceBuilder.ts
|
|
22305
|
+
var import_superenum29 = require("@ncoderz/superenum");
|
|
22306
|
+
|
|
22265
22307
|
// src/utils/UrlUtils.ts
|
|
22266
22308
|
var UrlUtils = class {
|
|
22267
22309
|
fileExtensionFromUrl(url) {
|
|
@@ -22501,11 +22543,11 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22501
22543
|
const nodes = [];
|
|
22502
22544
|
if (!Array.isArray(resource)) resource = [resource];
|
|
22503
22545
|
for (const thisResource of resource) {
|
|
22504
|
-
let type = ResourceType.fromValue(thisResource.type);
|
|
22546
|
+
let type = (0, import_superenum29.Enum)(ResourceType).fromValue(thisResource.type);
|
|
22505
22547
|
if (!type) return void 0;
|
|
22506
|
-
const resourceKey = ResourceType.keyFromValue(type);
|
|
22548
|
+
const resourceKey = (0, import_superenum29.Enum)(ResourceType).keyFromValue(type);
|
|
22507
22549
|
if (!resourceKey) return void 0;
|
|
22508
|
-
const __typeAlias = ResourceType.fromValue(thisResource.__typeAlias);
|
|
22550
|
+
const __typeAlias = (0, import_superenum29.Enum)(ResourceType).fromValue(thisResource.__typeAlias);
|
|
22509
22551
|
type = __typeAlias ?? type;
|
|
22510
22552
|
let data;
|
|
22511
22553
|
if (type === ResourceType.imageResponsive) {
|
|
@@ -22541,7 +22583,7 @@ var ResourceBuilder = class extends BaseBuilder {
|
|
|
22541
22583
|
}
|
|
22542
22584
|
resourceFromResourceDataJson(context, type, data) {
|
|
22543
22585
|
if (!data) return void 0;
|
|
22544
|
-
type = ResourceType.fromValue(type);
|
|
22586
|
+
type = (0, import_superenum29.Enum)(ResourceType).fromValue(type);
|
|
22545
22587
|
if (!type) return void 0;
|
|
22546
22588
|
const dataAsString = stringUtils.isString(data) ? data : void 0;
|
|
22547
22589
|
const url = data.url || data.src || data.body || dataAsString;
|
|
@@ -23654,8 +23696,8 @@ var Builder = class extends BaseBuilder {
|
|
|
23654
23696
|
data = structuredClone(data);
|
|
23655
23697
|
const bitType = data.bitType;
|
|
23656
23698
|
const bitConfig = instance2.getBitConfig(bitType);
|
|
23657
|
-
const deprecatedTextFormat = DeprecatedTextFormat.fromValue(data.textFormat);
|
|
23658
|
-
let textFormat = TextFormat.fromValue(data.textFormat) ?? bitConfig.textFormatDefault;
|
|
23699
|
+
const deprecatedTextFormat = (0, import_superenum30.Enum)(DeprecatedTextFormat).fromValue(data.textFormat);
|
|
23700
|
+
let textFormat = (0, import_superenum30.Enum)(TextFormat).fromValue(data.textFormat) ?? bitConfig.textFormatDefault;
|
|
23659
23701
|
if (deprecatedTextFormat === DeprecatedTextFormat.bitmarkMinusMinus) {
|
|
23660
23702
|
textFormat = TextFormat.bitmarkText;
|
|
23661
23703
|
}
|
|
@@ -23678,7 +23720,7 @@ var Builder = class extends BaseBuilder {
|
|
|
23678
23720
|
bitType,
|
|
23679
23721
|
bitLevel: data.bitLevel,
|
|
23680
23722
|
textFormat,
|
|
23681
|
-
resourceType: ResourceType.fromValue(data.resourceType),
|
|
23723
|
+
resourceType: (0, import_superenum30.Enum)(ResourceType).fromValue(data.resourceType),
|
|
23682
23724
|
isCommented: data.isCommented,
|
|
23683
23725
|
// Properties
|
|
23684
23726
|
id: this.toAstProperty(bitType, ConfigKey.property_id, data.id, options),
|
|
@@ -23826,6 +23868,13 @@ var Builder = class extends BaseBuilder {
|
|
|
23826
23868
|
data.releaseDate,
|
|
23827
23869
|
options
|
|
23828
23870
|
),
|
|
23871
|
+
iframeSrc: this.toAstProperty(bitType, ConfigKey.property_iframeSrc, data.iframeSrc, options),
|
|
23872
|
+
iframeName: this.toAstProperty(
|
|
23873
|
+
bitType,
|
|
23874
|
+
ConfigKey.property_iframeName,
|
|
23875
|
+
data.iframeName,
|
|
23876
|
+
options
|
|
23877
|
+
),
|
|
23829
23878
|
book: this.buildBooks(context, data.book),
|
|
23830
23879
|
ageRange: this.toAstProperty(bitType, ConfigKey.property_ageRange, data.ageRange, options),
|
|
23831
23880
|
lang: this.toAstProperty(bitType, ConfigKey.property_lang, data.lang, options),
|
|
@@ -24996,14 +25045,14 @@ var Builder = class extends BaseBuilder {
|
|
|
24996
25045
|
response: data.response ?? "",
|
|
24997
25046
|
reaction: data.reaction ?? "",
|
|
24998
25047
|
feedback: data.feedback ?? "",
|
|
24999
|
-
item:
|
|
25048
|
+
item: data.item ?? "",
|
|
25000
25049
|
lead: this.handleJsonText(context, TextLocation.tag, data.lead),
|
|
25001
25050
|
hint: this.handleJsonText(context, TextLocation.tag, data.hint)
|
|
25002
25051
|
};
|
|
25003
25052
|
objectUtils.removeUnwantedProperties(node, {
|
|
25004
|
-
ignoreEmptyString: ["response", "reaction", "feedback"],
|
|
25053
|
+
ignoreEmptyString: ["response", "reaction", "feedback", "item"],
|
|
25005
25054
|
ignoreAllFalse: true,
|
|
25006
|
-
ignoreEmptyArrays: [
|
|
25055
|
+
ignoreEmptyArrays: [],
|
|
25007
25056
|
ignoreUndefined: ["example"]
|
|
25008
25057
|
});
|
|
25009
25058
|
return node;
|
|
@@ -26621,14 +26670,17 @@ var StringWriter = class {
|
|
|
26621
26670
|
};
|
|
26622
26671
|
|
|
26623
26672
|
// src/BitmarkParserGenerator.ts
|
|
26624
|
-
var
|
|
26673
|
+
var import_superenum51 = require("@ncoderz/superenum");
|
|
26674
|
+
|
|
26675
|
+
// src/generator/bitmark/BitmarkGenerator.ts
|
|
26676
|
+
var import_superenum32 = require("@ncoderz/superenum");
|
|
26625
26677
|
|
|
26626
26678
|
// src/model/enum/CardSetVersion.ts
|
|
26627
|
-
var
|
|
26628
|
-
var CardSetVersion =
|
|
26679
|
+
var import_superenum31 = require("@ncoderz/superenum");
|
|
26680
|
+
var CardSetVersion = {
|
|
26629
26681
|
v1: 1,
|
|
26630
26682
|
v2: 2
|
|
26631
|
-
}
|
|
26683
|
+
};
|
|
26632
26684
|
|
|
26633
26685
|
// src/generator/bitmark/BitmarkGenerator.ts
|
|
26634
26686
|
var DEFAULT_OPTIONS2 = {
|
|
@@ -26683,7 +26735,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
26683
26735
|
this.leaf = this.leaf.bind(this);
|
|
26684
26736
|
this.write = this.write.bind(this);
|
|
26685
26737
|
this.bodyBitCallback = this.bodyBitCallback.bind(this);
|
|
26686
|
-
this.bitmarkVersion = BitmarkVersion.fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
26738
|
+
this.bitmarkVersion = (0, import_superenum32.Enum)(BitmarkVersion).fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
26687
26739
|
this.options = {
|
|
26688
26740
|
...DEFAULT_OPTIONS2,
|
|
26689
26741
|
...options?.bitmarkOptions
|
|
@@ -27245,7 +27297,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
27245
27297
|
this.inTag = true;
|
|
27246
27298
|
}
|
|
27247
27299
|
bodyBitCallback(bodyBit, _index, _route) {
|
|
27248
|
-
const nodeType = NodeType.fromValue(bodyBit.type) ?? NodeType.bodyBit;
|
|
27300
|
+
const nodeType = (0, import_superenum32.Enum)(NodeType).fromValue(bodyBit.type) ?? NodeType.bodyBit;
|
|
27249
27301
|
this.ast.walk(bodyBit, nodeType, this, void 0);
|
|
27250
27302
|
return "";
|
|
27251
27303
|
}
|
|
@@ -27790,6 +27842,15 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
27790
27842
|
between_cardBits(_node, _left, _right, _route) {
|
|
27791
27843
|
this.writeCardSetCardDivider();
|
|
27792
27844
|
}
|
|
27845
|
+
// bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> item
|
|
27846
|
+
leaf_item(node, route) {
|
|
27847
|
+
const parent = this.getParentNode(route);
|
|
27848
|
+
if (parent?.key !== NodeType.botResponsesValue) return;
|
|
27849
|
+
this.writeNL();
|
|
27850
|
+
this.writeOPC();
|
|
27851
|
+
this.writeTextOrValue(node.value, TextFormat.plainText, TextLocation.tag);
|
|
27852
|
+
this.writeCL();
|
|
27853
|
+
}
|
|
27793
27854
|
// bitmarkAst -> bits -> bitsValue -> cardNode -> botResponses -> botResponsesValue -> response
|
|
27794
27855
|
leaf_response(node, route) {
|
|
27795
27856
|
const parent = this.getParentNode(route);
|
|
@@ -28451,8 +28512,8 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28451
28512
|
* Generate the handlers for resources, as they are mostly the same, but not quite
|
|
28452
28513
|
*/
|
|
28453
28514
|
generateResourceHandlers() {
|
|
28454
|
-
for (const tag of ResourceType.keys()) {
|
|
28455
|
-
if (tag === ResourceType.keyFromValue(ResourceType.unknown)) continue;
|
|
28515
|
+
for (const tag of (0, import_superenum32.Enum)(ResourceType).keys()) {
|
|
28516
|
+
if (tag === (0, import_superenum32.Enum)(ResourceType).keyFromValue(ResourceType.unknown)) continue;
|
|
28456
28517
|
const enterFuncName = `enter_${tag}`;
|
|
28457
28518
|
if (typeof this[enterFuncName] === "function") {
|
|
28458
28519
|
continue;
|
|
@@ -28462,8 +28523,8 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28462
28523
|
if (resource == null) return false;
|
|
28463
28524
|
const parent = this.getParentNode(route);
|
|
28464
28525
|
if (parent?.key !== NodeType.resourcesValue) return true;
|
|
28465
|
-
const alias = ResourceType.fromValue(parent
|
|
28466
|
-
const type = alias ?? ResourceType.fromValue(parent
|
|
28526
|
+
const alias = (0, import_superenum32.Enum)(ResourceType).fromValue(parent?.value.__typeAlias);
|
|
28527
|
+
const type = alias ?? (0, import_superenum32.Enum)(ResourceType).fromValue(parent?.value.type);
|
|
28467
28528
|
if (!type) return false;
|
|
28468
28529
|
const url = resource.url || resource.src || resource.body || "";
|
|
28469
28530
|
this.writeNL();
|
|
@@ -28477,7 +28538,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28477
28538
|
* Generate the handlers for properties, as they are mostly the same, but not quite
|
|
28478
28539
|
*/
|
|
28479
28540
|
generatePropertyHandlers() {
|
|
28480
|
-
for (const propertyConfigKey of PropertyKey.values()) {
|
|
28541
|
+
for (const propertyConfigKey of (0, import_superenum32.Enum)(PropertyKey).values()) {
|
|
28481
28542
|
const propertyTag = configKeyToPropertyType(propertyConfigKey);
|
|
28482
28543
|
const funcNames = [`enter_${propertyTag}`, `leaf_${propertyTag}`];
|
|
28483
28544
|
for (const funcName of funcNames) {
|
|
@@ -28827,7 +28888,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28827
28888
|
}
|
|
28828
28889
|
writePropertyStyleResource(key, resource, deprecated_writeAsProperty = false) {
|
|
28829
28890
|
if (key && resource) {
|
|
28830
|
-
const resourceTag = ResourceType.keyFromValue(resource.type) ?? "";
|
|
28891
|
+
const resourceTag = (0, import_superenum32.Enum)(ResourceType).keyFromValue(resource.type) ?? "";
|
|
28831
28892
|
const resourceData = resource[resourceTag];
|
|
28832
28893
|
const src = resourceData ? resourceData.src || resourceData.url || resourceData.body || "" : "";
|
|
28833
28894
|
if (deprecated_writeAsProperty) {
|
|
@@ -28912,7 +28973,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
|
|
|
28912
28973
|
return true;
|
|
28913
28974
|
}
|
|
28914
28975
|
isWriteTextFormat(bitsValue, textFormatDefault) {
|
|
28915
|
-
const isDefault = TextFormat.fromValue(bitsValue) === textFormatDefault;
|
|
28976
|
+
const isDefault = (0, import_superenum32.Enum)(TextFormat).fromValue(bitsValue) === textFormatDefault;
|
|
28916
28977
|
const writeFormat = !isDefault || this.options.explicitTextFormat;
|
|
28917
28978
|
return !!writeFormat;
|
|
28918
28979
|
}
|
|
@@ -29004,6 +29065,7 @@ var BitmarkStringGenerator = class {
|
|
|
29004
29065
|
};
|
|
29005
29066
|
|
|
29006
29067
|
// src/generator/json/JsonGenerator.ts
|
|
29068
|
+
var import_superenum33 = require("@ncoderz/superenum");
|
|
29007
29069
|
var MOVE_BODY_RECURSION_LIMIT = 5e3;
|
|
29008
29070
|
var DEFAULT_OPTIONS3 = {
|
|
29009
29071
|
// debugGenerationInline: true,
|
|
@@ -29040,7 +29102,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
29040
29102
|
this.exit = this.exit.bind(this);
|
|
29041
29103
|
this.leaf = this.leaf.bind(this);
|
|
29042
29104
|
this.bodyBitCallback = this.bodyBitCallback.bind(this);
|
|
29043
|
-
this.bitmarkVersion = BitmarkVersion.fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
29105
|
+
this.bitmarkVersion = (0, import_superenum33.Enum)(BitmarkVersion).fromValue(options?.bitmarkVersion) ?? DEFAULT_BITMARK_VERSION;
|
|
29044
29106
|
this.textParserVersion = this.textParser.version();
|
|
29045
29107
|
this.options = {
|
|
29046
29108
|
...DEFAULT_OPTIONS3,
|
|
@@ -29394,7 +29456,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
29394
29456
|
throw new Error("Recursion limit exceeded");
|
|
29395
29457
|
}
|
|
29396
29458
|
for (const node of nodes) {
|
|
29397
|
-
if (node.type !== BodyBitType.text && BodyBitType.values().includes(node.type)) {
|
|
29459
|
+
if (node.type !== BodyBitType.text && (0, import_superenum33.Enum)(BodyBitType).values().includes(node.type)) {
|
|
29398
29460
|
const bodyBit = node;
|
|
29399
29461
|
bodyBit.attrs = {};
|
|
29400
29462
|
for (const [key, value] of Object.entries(bodyBit)) {
|
|
@@ -29681,7 +29743,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
29681
29743
|
* Generate the handlers for properties, as they are mostly the same, but not quite
|
|
29682
29744
|
*/
|
|
29683
29745
|
generatePropertyHandlers() {
|
|
29684
|
-
for (const propertyConfigKey of PropertyKey.values()) {
|
|
29746
|
+
for (const propertyConfigKey of (0, import_superenum33.Enum)(PropertyKey).values()) {
|
|
29685
29747
|
const propertyTag = configKeyToPropertyType(propertyConfigKey);
|
|
29686
29748
|
const funcNames = [`enter_${propertyTag}`, `leaf_${propertyTag}`];
|
|
29687
29749
|
for (const funcName of funcNames) {
|
|
@@ -29797,7 +29859,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
29797
29859
|
for (const node of route) {
|
|
29798
29860
|
if (node.key === NodeType.bitsValue) {
|
|
29799
29861
|
const n = node.value;
|
|
29800
|
-
return TextFormat.fromValue(n?.textFormat) ?? bitConfig.textFormatDefault;
|
|
29862
|
+
return (0, import_superenum33.Enum)(TextFormat).fromValue(n?.textFormat) ?? bitConfig.textFormatDefault;
|
|
29801
29863
|
}
|
|
29802
29864
|
}
|
|
29803
29865
|
}
|
|
@@ -30346,12 +30408,13 @@ var JsonObjectGenerator = class {
|
|
|
30346
30408
|
};
|
|
30347
30409
|
|
|
30348
30410
|
// src/info/InfoBuilder.ts
|
|
30411
|
+
var import_superenum34 = require("@ncoderz/superenum");
|
|
30349
30412
|
var InfoBuilder = class {
|
|
30350
30413
|
getSupportedBits(options) {
|
|
30351
30414
|
const includeNonDeprecated = options?.includeNonDeprecated ?? true;
|
|
30352
30415
|
const includeDeprecated = options?.includeDeprecated ?? false;
|
|
30353
30416
|
const supportedBits = [];
|
|
30354
|
-
for (const bt of BitType.values()) {
|
|
30417
|
+
for (const bt of (0, import_superenum34.Enum)(BitType).values()) {
|
|
30355
30418
|
if (bt === BitType._error || bt === BitType._comment) continue;
|
|
30356
30419
|
const bitType = instance2.getBitType(bt);
|
|
30357
30420
|
const bitConfig = instance2.getBitConfig(bitType);
|
|
@@ -30370,7 +30433,7 @@ var InfoBuilder = class {
|
|
|
30370
30433
|
}
|
|
30371
30434
|
getSupportedBitConfigs() {
|
|
30372
30435
|
const res = [];
|
|
30373
|
-
for (const bt of BitType.values()) {
|
|
30436
|
+
for (const bt of (0, import_superenum34.Enum)(BitType).values()) {
|
|
30374
30437
|
if (bt === BitType._error || bt === BitType._comment) continue;
|
|
30375
30438
|
const bitType = instance2.getBitType(bt);
|
|
30376
30439
|
const config = instance2.getBitConfig(bitType);
|
|
@@ -30381,22 +30444,22 @@ var InfoBuilder = class {
|
|
|
30381
30444
|
};
|
|
30382
30445
|
|
|
30383
30446
|
// src/model/enum/BitmarkParserType.ts
|
|
30384
|
-
var
|
|
30385
|
-
var BitmarkParserType =
|
|
30447
|
+
var import_superenum35 = require("@ncoderz/superenum");
|
|
30448
|
+
var BitmarkParserType = {
|
|
30386
30449
|
peggy: "peggy"
|
|
30387
|
-
}
|
|
30450
|
+
};
|
|
30388
30451
|
|
|
30389
30452
|
// src/model/info/enum/InfoFormat.ts
|
|
30390
|
-
var
|
|
30391
|
-
var InfoFormat =
|
|
30453
|
+
var import_superenum36 = require("@ncoderz/superenum");
|
|
30454
|
+
var InfoFormat = {
|
|
30392
30455
|
text: "text",
|
|
30393
30456
|
json: "json",
|
|
30394
30457
|
pojo: "pojo"
|
|
30395
|
-
}
|
|
30458
|
+
};
|
|
30396
30459
|
|
|
30397
30460
|
// src/model/info/enum/InfoType.ts
|
|
30398
|
-
var
|
|
30399
|
-
var InfoType =
|
|
30461
|
+
var import_superenum37 = require("@ncoderz/superenum");
|
|
30462
|
+
var InfoType = {
|
|
30400
30463
|
list: "list",
|
|
30401
30464
|
// List non-deprecated bits
|
|
30402
30465
|
deprecated: "deprecated",
|
|
@@ -30405,9 +30468,10 @@ var InfoType = (0, import_superenum29.superenum)({
|
|
|
30405
30468
|
// List all bits
|
|
30406
30469
|
bit: "bit"
|
|
30407
30470
|
// Get information for a bit
|
|
30408
|
-
}
|
|
30471
|
+
};
|
|
30409
30472
|
|
|
30410
30473
|
// src/parser/json/JsonParser.ts
|
|
30474
|
+
var import_superenum38 = require("@ncoderz/superenum");
|
|
30411
30475
|
var builder = new Builder();
|
|
30412
30476
|
var JsonParser = class {
|
|
30413
30477
|
/**
|
|
@@ -30509,8 +30573,8 @@ var JsonParser = class {
|
|
|
30509
30573
|
const isCommented = bit.type === BitType._comment && bit.originalType !== void 0;
|
|
30510
30574
|
const bitType = instance2.getBitType(isCommented ? bit.originalType : bit.type);
|
|
30511
30575
|
const bitConfig = instance2.getBitConfig(bitType);
|
|
30512
|
-
const deprecatedTextFormat = DeprecatedTextFormat.fromValue(bit.format);
|
|
30513
|
-
let _textFormat = TextFormat.fromValue(bit.format) ?? bitConfig.textFormatDefault;
|
|
30576
|
+
const deprecatedTextFormat = (0, import_superenum38.Enum)(DeprecatedTextFormat).fromValue(bit.format);
|
|
30577
|
+
let _textFormat = (0, import_superenum38.Enum)(TextFormat).fromValue(bit.format) ?? bitConfig.textFormatDefault;
|
|
30514
30578
|
if (deprecatedTextFormat === DeprecatedTextFormat.bitmarkMinusMinus) {
|
|
30515
30579
|
_textFormat = TextFormat.bitmarkText;
|
|
30516
30580
|
}
|
|
@@ -30587,7 +30651,7 @@ var JsonParser = class {
|
|
|
30587
30651
|
}
|
|
30588
30652
|
getResourceType(resource) {
|
|
30589
30653
|
if (resource) {
|
|
30590
|
-
const resourceKey = ResourceType.fromValue(resource.type);
|
|
30654
|
+
const resourceKey = (0, import_superenum38.Enum)(ResourceType).fromValue(resource.type);
|
|
30591
30655
|
return resourceKey;
|
|
30592
30656
|
}
|
|
30593
30657
|
return void 0;
|
|
@@ -30659,7 +30723,7 @@ var JsonParser = class {
|
|
|
30659
30723
|
};
|
|
30660
30724
|
|
|
30661
30725
|
// src/parser/bitmark/peg/BitmarkPegParserTypes.ts
|
|
30662
|
-
var
|
|
30726
|
+
var import_superenum39 = require("@ncoderz/superenum");
|
|
30663
30727
|
|
|
30664
30728
|
// src/parser/bitmark/peg/PeggyGrammarLocation.ts
|
|
30665
30729
|
var PeggyGrammarLocation = class {
|
|
@@ -30739,7 +30803,7 @@ var CARD_VARIANT_DIVIDER_V2 = "++";
|
|
|
30739
30803
|
var CARD_DIVIDER_V1 = "===";
|
|
30740
30804
|
var CARD_SIDE_DIVIDER_V1 = "==";
|
|
30741
30805
|
var CARD_VARIANT_DIVIDER_V1 = "--";
|
|
30742
|
-
var TypeKey =
|
|
30806
|
+
var TypeKey = {
|
|
30743
30807
|
// Bit header
|
|
30744
30808
|
TextFormat: "TextFormat",
|
|
30745
30809
|
ResourceType: "ResourceType",
|
|
@@ -30774,14 +30838,15 @@ var TypeKey = (0, import_superenum30.superenum)({
|
|
|
30774
30838
|
// Dividers
|
|
30775
30839
|
PlainTextDivider: "PlainTextDivider",
|
|
30776
30840
|
FooterDivider: "FooterDivider"
|
|
30777
|
-
}
|
|
30778
|
-
var ContentDepth =
|
|
30841
|
+
};
|
|
30842
|
+
var ContentDepth = {
|
|
30779
30843
|
Bit: "Bit",
|
|
30780
30844
|
Card: "Card",
|
|
30781
30845
|
Chain: "Chain"
|
|
30782
|
-
}
|
|
30846
|
+
};
|
|
30783
30847
|
|
|
30784
30848
|
// src/parser/bitmark/peg/BitmarkPegParserHelper.ts
|
|
30849
|
+
var import_superenum40 = require("@ncoderz/superenum");
|
|
30785
30850
|
var ENABLE_DEBUG = true;
|
|
30786
30851
|
var DEBUG_DATA = true;
|
|
30787
30852
|
var DEBUG_DATA_INCLUDE_PARSER = false;
|
|
@@ -30875,7 +30940,7 @@ var BitmarkPegParserHelper = class {
|
|
|
30875
30940
|
if (DEBUG_TRACE_TAGS) this.debugPrint(type, { value });
|
|
30876
30941
|
return {
|
|
30877
30942
|
type,
|
|
30878
|
-
key: Tag.fromValue(type),
|
|
30943
|
+
key: (0, import_superenum40.Enum)(Tag).fromValue(type),
|
|
30879
30944
|
value,
|
|
30880
30945
|
parser: {
|
|
30881
30946
|
text: this.parserText(),
|
|
@@ -31270,7 +31335,7 @@ var BitmarkPegParserHelper = class {
|
|
|
31270
31335
|
if (!value) return false;
|
|
31271
31336
|
const { type } = value;
|
|
31272
31337
|
if (!validType) {
|
|
31273
|
-
return !!TypeKey.fromValue(type);
|
|
31338
|
+
return !!(0, import_superenum40.Enum)(TypeKey).fromValue(type);
|
|
31274
31339
|
}
|
|
31275
31340
|
if (Array.isArray(validType)) {
|
|
31276
31341
|
return validType.indexOf(type) >= 0;
|
|
@@ -31354,7 +31419,11 @@ var BitmarkPegParserHelper = class {
|
|
|
31354
31419
|
}
|
|
31355
31420
|
};
|
|
31356
31421
|
|
|
31422
|
+
// src/parser/bitmark/peg/BitmarkPegParserProcessor.ts
|
|
31423
|
+
var import_superenum49 = require("@ncoderz/superenum");
|
|
31424
|
+
|
|
31357
31425
|
// src/parser/bitmark/peg/BitmarkPegParserValidator.ts
|
|
31426
|
+
var import_superenum41 = require("@ncoderz/superenum");
|
|
31358
31427
|
var COMMON_MISTAKE_STRINGS = [
|
|
31359
31428
|
// Card divider errors
|
|
31360
31429
|
"----",
|
|
@@ -31526,7 +31595,7 @@ var BitmarkPegParserValidator = class {
|
|
|
31526
31595
|
const content = dataOrNull[i];
|
|
31527
31596
|
if (!content) continue;
|
|
31528
31597
|
const { type, key } = content;
|
|
31529
|
-
let typeKey = TypeKey.fromValue(type);
|
|
31598
|
+
let typeKey = (0, import_superenum41.Enum)(TypeKey).fromValue(type);
|
|
31530
31599
|
if (!typeKey) continue;
|
|
31531
31600
|
let validTypeKey = typeKey;
|
|
31532
31601
|
if (typeKey === TypeKey.Property || typeKey === TypeKey.Resource) {
|
|
@@ -31949,7 +32018,7 @@ var BitmarkPegParserValidator = class {
|
|
|
31949
32018
|
} else if (tagValidationData.isResource) {
|
|
31950
32019
|
res.set(v.configKey, tagValidationData);
|
|
31951
32020
|
} else {
|
|
31952
|
-
const typeKey = TypeKey.fromValue(v.tag);
|
|
32021
|
+
const typeKey = (0, import_superenum41.Enum)(TypeKey).fromValue(v.tag);
|
|
31953
32022
|
if (typeKey) {
|
|
31954
32023
|
res.set(typeKey, tagValidationData);
|
|
31955
32024
|
}
|
|
@@ -32962,12 +33031,19 @@ function parseBotActionResponses(_context, _bitType, cardSet) {
|
|
|
32962
33031
|
for (const card of cardSet.cards) {
|
|
32963
33032
|
for (const side of card.sides) {
|
|
32964
33033
|
for (const content of side.variants) {
|
|
32965
|
-
const {
|
|
33034
|
+
const {
|
|
33035
|
+
__instructionString,
|
|
33036
|
+
__itemString,
|
|
33037
|
+
reaction,
|
|
33038
|
+
cardBodyStr: feedback,
|
|
33039
|
+
...tags2
|
|
33040
|
+
} = content.data;
|
|
32966
33041
|
const botResponse = {
|
|
32967
33042
|
response: __instructionString ?? instance3.EMPTY_STRING,
|
|
32968
33043
|
reaction: reaction ?? instance3.EMPTY_STRING,
|
|
32969
33044
|
feedback: feedback ?? instance3.EMPTY_STRING,
|
|
32970
|
-
...tags2
|
|
33045
|
+
...tags2,
|
|
33046
|
+
item: __itemString ?? instance3.EMPTY_STRING
|
|
32971
33047
|
};
|
|
32972
33048
|
if (botResponse) botResponses.push(botResponse);
|
|
32973
33049
|
}
|
|
@@ -33203,6 +33279,9 @@ var FooterContentProcessor = class {
|
|
|
33203
33279
|
};
|
|
33204
33280
|
var instance12 = new FooterContentProcessor();
|
|
33205
33281
|
|
|
33282
|
+
// src/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.ts
|
|
33283
|
+
var import_superenum42 = require("@ncoderz/superenum");
|
|
33284
|
+
|
|
33206
33285
|
// src/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.ts
|
|
33207
33286
|
var textParser4 = new TextParser();
|
|
33208
33287
|
function clozeTagContentProcessor(context, _contentDepth, _tagsConfig, content, target) {
|
|
@@ -33238,7 +33317,7 @@ function gapChainContentProcessor(context, contentDepth, tagsConfig, content, ta
|
|
|
33238
33317
|
}
|
|
33239
33318
|
function buildGap(context, _contentDepth, tagsConfig, content) {
|
|
33240
33319
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("gap content", content);
|
|
33241
|
-
const gapConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
|
|
33320
|
+
const gapConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum42.Enum)(Tag).fromValue(content.type));
|
|
33242
33321
|
const chainContent = [content, ...content.chain ?? []];
|
|
33243
33322
|
const chainTags = context.bitContentProcessor(
|
|
33244
33323
|
ContentDepth.Chain,
|
|
@@ -33253,6 +33332,9 @@ function buildGap(context, _contentDepth, tagsConfig, content) {
|
|
|
33253
33332
|
return gap;
|
|
33254
33333
|
}
|
|
33255
33334
|
|
|
33335
|
+
// src/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.ts
|
|
33336
|
+
var import_superenum43 = require("@ncoderz/superenum");
|
|
33337
|
+
|
|
33256
33338
|
// src/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.ts
|
|
33257
33339
|
function itemLeadTagContentProcessor(context, _contentDepth, _tagsConfig, content, target) {
|
|
33258
33340
|
const { textFormat } = context;
|
|
@@ -33265,6 +33347,13 @@ function itemLeadTagContentProcessor(context, _contentDepth, _tagsConfig, conten
|
|
|
33265
33347
|
location: TextLocation.tag
|
|
33266
33348
|
});
|
|
33267
33349
|
target.itemLead.push(text);
|
|
33350
|
+
if (!target.__itemLeadString) target.__itemLeadString = [];
|
|
33351
|
+
target.__itemLeadString.push(
|
|
33352
|
+
instance3.unbreakscape(trimmedStringValue, {
|
|
33353
|
+
format: TextFormat.bitmarkText,
|
|
33354
|
+
location: TextLocation.tag
|
|
33355
|
+
})
|
|
33356
|
+
);
|
|
33268
33357
|
}
|
|
33269
33358
|
|
|
33270
33359
|
// src/parser/bitmark/peg/contentProcessors/ItemLeadChainContentProcessor.ts
|
|
@@ -33277,7 +33366,7 @@ function itemLeadChainContentProcessor(context, contentDepth, tagsConfig, conten
|
|
|
33277
33366
|
}
|
|
33278
33367
|
function buildItemLead(context, _contentDepth, tagsConfig, content, target) {
|
|
33279
33368
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("item lead content", content);
|
|
33280
|
-
const itemLeadConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
|
|
33369
|
+
const itemLeadConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum43.Enum)(Tag).fromValue(content.type));
|
|
33281
33370
|
const chainContent = [content, ...content.chain ?? []];
|
|
33282
33371
|
const chainTags = context.bitContentProcessor(
|
|
33283
33372
|
ContentDepth.Chain,
|
|
@@ -33286,8 +33375,12 @@ function buildItemLead(context, _contentDepth, tagsConfig, content, target) {
|
|
|
33286
33375
|
);
|
|
33287
33376
|
if (context.DEBUG_CHAIN_TAGS) context.debugPrint("item lead TAGS", chainTags);
|
|
33288
33377
|
target.itemLead = chainTags.itemLead;
|
|
33378
|
+
target.__itemLeadString = chainTags.__itemLeadString;
|
|
33289
33379
|
}
|
|
33290
33380
|
|
|
33381
|
+
// src/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.ts
|
|
33382
|
+
var import_superenum44 = require("@ncoderz/superenum");
|
|
33383
|
+
|
|
33291
33384
|
// src/parser/bitmark/peg/contentProcessors/MarkTagContentProcessor.ts
|
|
33292
33385
|
function markTagContentProcessor(_context, _contentDepth, content, target) {
|
|
33293
33386
|
const { value } = content;
|
|
@@ -33312,7 +33405,7 @@ function markChainContentProcessor(context, contentDepth, tagsConfig, content, t
|
|
|
33312
33405
|
}
|
|
33313
33406
|
function buildMark(context, _contentDepth, tagsConfig, content) {
|
|
33314
33407
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("mark content", content);
|
|
33315
|
-
const markConfig = instance2.getTagConfigForTag(tagsConfig, Tag.fromValue(content.type));
|
|
33408
|
+
const markConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum44.Enum)(Tag).fromValue(content.type));
|
|
33316
33409
|
const tags2 = context.bitContentProcessor(ContentDepth.Chain, tagsConfig, [content]);
|
|
33317
33410
|
const chainTags = context.bitContentProcessor(
|
|
33318
33411
|
ContentDepth.Chain,
|
|
@@ -33331,6 +33424,9 @@ function buildMark(context, _contentDepth, tagsConfig, content) {
|
|
|
33331
33424
|
return mark;
|
|
33332
33425
|
}
|
|
33333
33426
|
|
|
33427
|
+
// src/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.ts
|
|
33428
|
+
var import_superenum47 = require("@ncoderz/superenum");
|
|
33429
|
+
|
|
33334
33430
|
// src/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.ts
|
|
33335
33431
|
function bookChainContentProcessor(context, contentDepth, tagsConfig, content, target) {
|
|
33336
33432
|
if (contentDepth === ContentDepth.Chain) {
|
|
@@ -33505,6 +33601,7 @@ function groupTagChainContentProcessor(context, _contentDepth, tagsConfig, conte
|
|
|
33505
33601
|
}
|
|
33506
33602
|
|
|
33507
33603
|
// src/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.ts
|
|
33604
|
+
var import_superenum45 = require("@ncoderz/superenum");
|
|
33508
33605
|
function imageSourceChainContentProcessor(context, contentDepth, tagsConfig, content, target) {
|
|
33509
33606
|
if (contentDepth === ContentDepth.Chain) {
|
|
33510
33607
|
imageSourceTagContentProcessor(context, contentDepth, tagsConfig, content, target);
|
|
@@ -33523,7 +33620,7 @@ function imageSourceTagContentProcessor(_context, _contentDepth, _tagsConfig, co
|
|
|
33523
33620
|
function buildImageSource(context, _contentDepth, tagsConfig, content, target) {
|
|
33524
33621
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("imageSource content", content);
|
|
33525
33622
|
const { key: tag } = content;
|
|
33526
|
-
const imageSourceConfig = instance2.getTagConfigForTag(tagsConfig, ConfigKey.fromValue(tag));
|
|
33623
|
+
const imageSourceConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum45.Enum)(ConfigKey).fromValue(tag));
|
|
33527
33624
|
const tags2 = context.bitContentProcessor(ContentDepth.Chain, tagsConfig, [content]);
|
|
33528
33625
|
const chainTags = context.bitContentProcessor(
|
|
33529
33626
|
ContentDepth.Chain,
|
|
@@ -33557,12 +33654,13 @@ function commentTagContentProcessor(_context, _contentDepth, content, target) {
|
|
|
33557
33654
|
}
|
|
33558
33655
|
|
|
33559
33656
|
// src/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.ts
|
|
33657
|
+
var import_superenum46 = require("@ncoderz/superenum");
|
|
33560
33658
|
function markConfigChainContentProcessor(context, _contentDepth, tagsConfig, content, target) {
|
|
33561
33659
|
const { key: tag } = content;
|
|
33562
33660
|
if (context.DEBUG_CHAIN_CONTENT) context.debugPrint("mark content", content);
|
|
33563
33661
|
const markConfig = target.markConfig;
|
|
33564
33662
|
if (!markConfig) return;
|
|
33565
|
-
const markTagConfig = instance2.getTagConfigForTag(tagsConfig, ConfigKey.fromValue(tag));
|
|
33663
|
+
const markTagConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum46.Enum)(ConfigKey).fromValue(tag));
|
|
33566
33664
|
const { mark: _ignoreMark, ...tags2 } = context.bitContentProcessor(
|
|
33567
33665
|
ContentDepth.Chain,
|
|
33568
33666
|
markTagConfig?.chain,
|
|
@@ -33695,7 +33793,7 @@ function propertyContentProcessor(context, contentDepth, tagsConfig, content, ta
|
|
|
33695
33793
|
const { value } = content;
|
|
33696
33794
|
const { key: keyIn } = content;
|
|
33697
33795
|
const isChain = contentDepth === ContentDepth.Chain;
|
|
33698
|
-
const propertyConfig = instance2.getTagConfigForTag(tagsConfig, PropertyKey.fromValue(keyIn));
|
|
33796
|
+
const propertyConfig = instance2.getTagConfigForTag(tagsConfig, (0, import_superenum47.Enum)(PropertyKey).fromValue(keyIn));
|
|
33699
33797
|
const configKey = propertyConfig ? propertyConfig.configKey : void 0;
|
|
33700
33798
|
let property = configKeyToPropertyType(keyIn);
|
|
33701
33799
|
if (configKey === ConfigKey.property_internalComment) {
|
|
@@ -33852,12 +33950,13 @@ function referenceTagContentProcessor(_context, _contentDepth, _tagsConfig, cont
|
|
|
33852
33950
|
}
|
|
33853
33951
|
|
|
33854
33952
|
// src/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.ts
|
|
33953
|
+
var import_superenum48 = require("@ncoderz/superenum");
|
|
33855
33954
|
var resourceBuilder = new ResourceBuilder();
|
|
33856
33955
|
function buildResources(context, resourceTypeAttachment, resources) {
|
|
33857
33956
|
const { bitType } = context;
|
|
33858
33957
|
const filteredResources = [];
|
|
33859
33958
|
const excessResources = [];
|
|
33860
|
-
const validatedResourceTypeAttachemnt = ResourceType.fromValue(resourceTypeAttachment);
|
|
33959
|
+
const validatedResourceTypeAttachemnt = (0, import_superenum48.Enum)(ResourceType).fromValue(resourceTypeAttachment);
|
|
33861
33960
|
const resourcesConfig = instance2.getBitResourcesConfig(bitType, validatedResourceTypeAttachemnt);
|
|
33862
33961
|
const resourceAttachmentAllowed = resourcesConfig.resourceAttachmentAllowed;
|
|
33863
33962
|
const countsMin = resourcesConfig.getCountsMin();
|
|
@@ -33901,9 +34000,9 @@ function resourceContentProcessor(context, _contentDepth, tagsConfig, content, t
|
|
|
33901
34000
|
const { type: _ignoreType, key, value, chain } = content;
|
|
33902
34001
|
const resources = target.resources;
|
|
33903
34002
|
if (!resources) return;
|
|
33904
|
-
const configKey = ConfigKey.fromValue(key);
|
|
34003
|
+
const configKey = (0, import_superenum48.Enum)(ConfigKey).fromValue(key);
|
|
33905
34004
|
if (!configKey) return;
|
|
33906
|
-
const resourceType = ResourceType.fromKey(configKey.replace(/^&/, "")) ?? ResourceType.unknown;
|
|
34005
|
+
const resourceType = (0, import_superenum48.Enum)(ResourceType).fromKey(configKey.replace(/^&/, "")) ?? ResourceType.unknown;
|
|
33907
34006
|
const resourceConfig = instance2.getTagConfigForTag(tagsConfig, configKey);
|
|
33908
34007
|
const { posterImage, ...tags2 } = context.bitContentProcessor(
|
|
33909
34008
|
ContentDepth.Chain,
|
|
@@ -34399,14 +34498,14 @@ var BitmarkPegParserProcessor = class {
|
|
|
34399
34498
|
);
|
|
34400
34499
|
bitLevel = instance2.bitLevelMin;
|
|
34401
34500
|
}
|
|
34402
|
-
let textFormat = TextFormat.fromValue(textFormatAndResourceType.textFormat);
|
|
34501
|
+
let textFormat = (0, import_superenum49.Enum)(TextFormat).fromValue(textFormatAndResourceType.textFormat);
|
|
34403
34502
|
const isInvalidTextFormat = textFormatAndResourceType.textFormat && !textFormat;
|
|
34404
34503
|
if (isInvalidTextFormat) {
|
|
34405
34504
|
this.addWarning(
|
|
34406
34505
|
`Invalid text format '${textFormatAndResourceType.textFormat}', defaulting to '${BodyTextFormat.bitmarkPlusPlus}'`
|
|
34407
34506
|
);
|
|
34408
34507
|
}
|
|
34409
|
-
const deprecatedTextFormat = DeprecatedTextFormat.fromValue(
|
|
34508
|
+
const deprecatedTextFormat = (0, import_superenum49.Enum)(DeprecatedTextFormat).fromValue(
|
|
34410
34509
|
textFormatAndResourceType.textFormat
|
|
34411
34510
|
);
|
|
34412
34511
|
if (deprecatedTextFormat) {
|
|
@@ -34416,7 +34515,7 @@ var BitmarkPegParserProcessor = class {
|
|
|
34416
34515
|
);
|
|
34417
34516
|
}
|
|
34418
34517
|
textFormat = textFormat ?? bitConfig.textFormatDefault;
|
|
34419
|
-
const resourceType = ResourceType.fromValue(textFormatAndResourceType.resourceType);
|
|
34518
|
+
const resourceType = (0, import_superenum49.Enum)(ResourceType).fromValue(textFormatAndResourceType.resourceType);
|
|
34420
34519
|
if (textFormatAndResourceType.resourceType && !resourceType) {
|
|
34421
34520
|
this.addWarning(
|
|
34422
34521
|
`Invalid resource type '${textFormatAndResourceType.resourceType}', it will be ignored`
|
|
@@ -34670,6 +34769,13 @@ var BitmarkPegParserProcessor = class {
|
|
|
34670
34769
|
if (l > 2) result.pageNumber = result.itemLead[2];
|
|
34671
34770
|
if (l > 3) result.marginNumber = result.itemLead[l - 1];
|
|
34672
34771
|
}
|
|
34772
|
+
if (result.__itemLeadString) {
|
|
34773
|
+
const l = result.__itemLeadString.length;
|
|
34774
|
+
if (l > 0) result.__itemString = result.__itemLeadString[0];
|
|
34775
|
+
if (l > 1) result.__leadString = result.__itemLeadString[1];
|
|
34776
|
+
if (l > 2) result.__pageNumberString = result.__itemLeadString[2];
|
|
34777
|
+
if (l > 3) result.__marginNumberString = result.__itemLeadString[l - 1];
|
|
34778
|
+
}
|
|
34673
34779
|
if (inBit) {
|
|
34674
34780
|
result.body = instance11.process(
|
|
34675
34781
|
this.context,
|
|
@@ -38558,6 +38664,7 @@ var JsonFileGenerator = class {
|
|
|
38558
38664
|
|
|
38559
38665
|
// src/info/ConfigBuilder.ts
|
|
38560
38666
|
var import_node_path3 = __toESM(require("path"), 1);
|
|
38667
|
+
var import_superenum50 = require("@ncoderz/superenum");
|
|
38561
38668
|
var import_fs_extra3 = __toESM(require("fs-extra"), 1);
|
|
38562
38669
|
var ConfigBuilder = class {
|
|
38563
38670
|
build(options) {
|
|
@@ -38567,7 +38674,7 @@ var ConfigBuilder = class {
|
|
|
38567
38674
|
const groupConfigs = [];
|
|
38568
38675
|
const bitGroupConfigKeys = [];
|
|
38569
38676
|
const bitGroupConfigs = [];
|
|
38570
|
-
for (const bt of BitType.values()) {
|
|
38677
|
+
for (const bt of (0, import_superenum50.Enum)(BitType).values()) {
|
|
38571
38678
|
const bitType = instance2.getBitType(bt);
|
|
38572
38679
|
const _bitConfig = BITS[bitType];
|
|
38573
38680
|
if (_bitConfig) {
|
|
@@ -38849,7 +38956,7 @@ var ConfigBuilder = class {
|
|
|
38849
38956
|
buildFlat(options) {
|
|
38850
38957
|
const opts = Object.assign({}, options);
|
|
38851
38958
|
const bitConfigs = [];
|
|
38852
|
-
for (const bt of BitType.values()) {
|
|
38959
|
+
for (const bt of (0, import_superenum50.Enum)(BitType).values()) {
|
|
38853
38960
|
const bitType = instance2.getBitType(bt);
|
|
38854
38961
|
const bitConfig = instance2.getBitConfig(bitType);
|
|
38855
38962
|
if (bitConfig) bitConfigs.push(bitConfig);
|
|
@@ -38960,7 +39067,7 @@ var ConfigBuilder = class {
|
|
|
38960
39067
|
};
|
|
38961
39068
|
|
|
38962
39069
|
// src/BitmarkParserGenerator.ts
|
|
38963
|
-
var Input =
|
|
39070
|
+
var Input = {
|
|
38964
39071
|
/**
|
|
38965
39072
|
* Input is as a string
|
|
38966
39073
|
*/
|
|
@@ -38969,8 +39076,8 @@ var Input = (0, import_superenum31.superenum)({
|
|
|
38969
39076
|
* Input is as a file path
|
|
38970
39077
|
*/
|
|
38971
39078
|
file: "file"
|
|
38972
|
-
}
|
|
38973
|
-
var Output =
|
|
39079
|
+
};
|
|
39080
|
+
var Output = {
|
|
38974
39081
|
/**
|
|
38975
39082
|
* Output bitmark string
|
|
38976
39083
|
*/
|
|
@@ -38983,7 +39090,7 @@ var Output = (0, import_superenum31.superenum)({
|
|
|
38983
39090
|
* Output AST as a plain JS object, or a file
|
|
38984
39091
|
*/
|
|
38985
39092
|
ast: "ast"
|
|
38986
|
-
}
|
|
39093
|
+
};
|
|
38987
39094
|
var BitmarkParserGenerator = class {
|
|
38988
39095
|
constructor() {
|
|
38989
39096
|
__publicField(this, "ast", new Ast());
|
|
@@ -39368,7 +39475,7 @@ var BitmarkParserGenerator = class {
|
|
|
39368
39475
|
const opts = Object.assign({}, options);
|
|
39369
39476
|
const fileOptions = Object.assign({}, opts.fileOptions);
|
|
39370
39477
|
const jsonOptions = Object.assign({}, opts.jsonOptions);
|
|
39371
|
-
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
39478
|
+
const textFormat = (0, import_superenum51.Enum)(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
39372
39479
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
39373
39480
|
let inStr = input;
|
|
39374
39481
|
const inputIsString = typeof input === "string";
|
|
@@ -39436,7 +39543,7 @@ var BitmarkParserGenerator = class {
|
|
|
39436
39543
|
if (!input) return input;
|
|
39437
39544
|
const opts = Object.assign({}, options);
|
|
39438
39545
|
const fileOptions = Object.assign({}, opts.fileOptions);
|
|
39439
|
-
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
39546
|
+
const textFormat = (0, import_superenum51.Enum)(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
39440
39547
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
39441
39548
|
let inStr = input;
|
|
39442
39549
|
const inputIsString = typeof input === "string";
|
|
@@ -39489,7 +39596,7 @@ var BitmarkParserGenerator = class {
|
|
|
39489
39596
|
if (!input) return input;
|
|
39490
39597
|
const opts = Object.assign({}, options);
|
|
39491
39598
|
const fileOptions = Object.assign({}, opts.fileOptions);
|
|
39492
|
-
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
39599
|
+
const textFormat = (0, import_superenum51.Enum)(TextFormat).fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
39493
39600
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
39494
39601
|
let inStr = input;
|
|
39495
39602
|
const inputIsString = typeof input === "string";
|
|
@@ -39600,6 +39707,8 @@ init();
|
|
|
39600
39707
|
ResourceBuilder,
|
|
39601
39708
|
StreamWriter,
|
|
39602
39709
|
StringWriter,
|
|
39710
|
+
TextMarkType,
|
|
39711
|
+
TextNodeType,
|
|
39603
39712
|
bitmarkTextParse
|
|
39604
39713
|
});
|
|
39605
39714
|
//# sourceMappingURL=index.cjs.map
|