ya-bbcode 3.1.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/README.md CHANGED
@@ -32,13 +32,8 @@ parser.registerTag('url', {
32
32
  parser.clearTags();
33
33
  ```
34
34
 
35
- ### Why another BBCode Parser?
36
- - Supports nested BBCode
37
- - Has no dependencies
38
- - All BBCode is replaced in a nested format, meaning that parent nodes are parsed before children.
39
- - Allows custom tags to be replaced or added.
40
-
41
- #### Roadmap
42
- - Performance improvements
43
- - Clean code up for improved readability
44
- - Improve docs
35
+ ### Why ya-bbcode?
36
+ - **Supports nested BBCode**: Properly handles complex nested structures
37
+ - **Zero dependencies**: Lightweight with no external dependencies
38
+ - **Correct parsing**: Parent nodes are parsed before children in nested format
39
+ - **Customizable**: Easy to add or override tags
@@ -0,0 +1,453 @@
1
+
2
+ //#region src/ya-bbcode.ts
3
+ /**
4
+ * Escapes HTML attribute values to prevent XSS
5
+ * Encodes quotes, angle brackets, and other special characters
6
+ */
7
+ function escapeHtmlAttr(value) {
8
+ const attrEntities = {
9
+ "&": "&",
10
+ "<": "&lt;",
11
+ ">": "&gt;",
12
+ "\"": "&quot;",
13
+ "'": "&#39;"
14
+ };
15
+ return String(value).replaceAll(/["&'<>]/g, (char) => attrEntities[char] || char);
16
+ }
17
+ /**
18
+ * Validates and sanitizes URLs to prevent javascript: and data: URL attacks
19
+ * Only allows safe URL schemes based on the allowedSchemes list
20
+ */
21
+ function sanitizeUrl(url, allowedSchemes) {
22
+ const trimmed = String(url).trim();
23
+ if (!trimmed) return "#";
24
+ if (/^\.{0,2}\//.test(trimmed)) return trimmed;
25
+ if (trimmed.startsWith("#")) return trimmed;
26
+ const schemeMatch = /^([a-z][\d+.a-z-]*):/.exec(trimmed.toLowerCase());
27
+ if (schemeMatch) {
28
+ const scheme = schemeMatch[1] ?? "";
29
+ if (!allowedSchemes.includes(scheme)) return "#";
30
+ }
31
+ return trimmed;
32
+ }
33
+ /**
34
+ * Parse tag attributes from a tag string
35
+ * Supports both formats:
36
+ * - [tag=value] → { attr: 'value', attrs: {} }
37
+ * - [tag key=value flag] → { attr: 'value', attrs: { key: 'value', flag: true } }
38
+ */
39
+ function parseTagAttributes(tagContent) {
40
+ const firstSpace = tagContent.indexOf(" ");
41
+ const firstEquals = tagContent.indexOf("=");
42
+ if (firstSpace === -1 || firstEquals !== -1 && firstEquals < firstSpace) return {
43
+ attr: tagContent.split("=").slice(1).join("="),
44
+ attrs: {}
45
+ };
46
+ const parts = tagContent.split(/\s+/);
47
+ const attrs = Object.create(null);
48
+ let firstValue = "";
49
+ const dangerousKeys = new Set([
50
+ "__proto__",
51
+ "constructor",
52
+ "prototype"
53
+ ]);
54
+ for (let i = 1; i < parts.length; i++) {
55
+ const part = parts[i];
56
+ if (!part) continue;
57
+ if (part.includes("=")) {
58
+ const eqIndex = part.indexOf("=");
59
+ const key = part.slice(0, eqIndex);
60
+ const value = part.slice(eqIndex + 1);
61
+ if (dangerousKeys.has(key.toLowerCase())) continue;
62
+ attrs[key] = value;
63
+ if (!firstValue && value) firstValue = value;
64
+ } else {
65
+ if (dangerousKeys.has(part.toLowerCase())) continue;
66
+ attrs[part] = true;
67
+ }
68
+ }
69
+ return {
70
+ attr: firstValue,
71
+ attrs
72
+ };
73
+ }
74
+ var yabbcode = class {
75
+ tags = {
76
+ "url": {
77
+ type: "replace",
78
+ open: (attr) => `<a href="${escapeHtmlAttr(sanitizeUrl(attr, this.config.allowedSchemes ?? [
79
+ "http",
80
+ "https",
81
+ "mailto",
82
+ "ftp",
83
+ "ftps"
84
+ ]))}">`,
85
+ close: "</a>"
86
+ },
87
+ "quote": {
88
+ type: "replace",
89
+ open: (attr) => `<blockquote author="${escapeHtmlAttr(attr)}">`,
90
+ close: "</blockquote>"
91
+ },
92
+ "b": {
93
+ type: "replace",
94
+ open: "<strong>",
95
+ close: "</strong>"
96
+ },
97
+ "u": {
98
+ type: "replace",
99
+ open: "<u>",
100
+ close: "</u>"
101
+ },
102
+ "i": {
103
+ type: "replace",
104
+ open: "<i>",
105
+ close: "</i>"
106
+ },
107
+ "h1": {
108
+ type: "replace",
109
+ open: "<h1>",
110
+ close: "</h1>"
111
+ },
112
+ "h2": {
113
+ type: "replace",
114
+ open: "<h2>",
115
+ close: "</h2>"
116
+ },
117
+ "h3": {
118
+ type: "replace",
119
+ open: "<h3>",
120
+ close: "</h3>"
121
+ },
122
+ "h4": {
123
+ type: "replace",
124
+ open: "<h4>",
125
+ close: "</h4>"
126
+ },
127
+ "h5": {
128
+ type: "replace",
129
+ open: "<h5>",
130
+ close: "</h5>"
131
+ },
132
+ "h6": {
133
+ type: "replace",
134
+ open: "<h6>",
135
+ close: "</h6>"
136
+ },
137
+ "code": {
138
+ type: "replace",
139
+ open: "<code>",
140
+ close: "</code>"
141
+ },
142
+ "strike": {
143
+ type: "replace",
144
+ open: "<span class=\"yabbcode-strike\">",
145
+ close: "</span>"
146
+ },
147
+ "spoiler": {
148
+ type: "replace",
149
+ open: "<span class=\"yabbcode-spoiler\">",
150
+ close: "</span>"
151
+ },
152
+ "list": {
153
+ type: "replace",
154
+ open: "<ul>",
155
+ close: "</ul>"
156
+ },
157
+ "olist": {
158
+ type: "replace",
159
+ open: "<ol>",
160
+ close: "</ol>"
161
+ },
162
+ "*": {
163
+ type: "replace",
164
+ open: "<li>",
165
+ close: null
166
+ },
167
+ "img": {
168
+ type: "content",
169
+ replace: (attr, content) => {
170
+ if (!content) return "";
171
+ return `<img src="${escapeHtmlAttr(content)}" alt="${escapeHtmlAttr(attr)}"/>`;
172
+ }
173
+ },
174
+ "noparse": { type: "ignore" }
175
+ };
176
+ regex = {
177
+ tags: /(\[[^\]^]+])/g,
178
+ newline: /\r\n|\r|\n/g,
179
+ placeholders: /\[TAG-[1-9]+]/g
180
+ };
181
+ config;
182
+ contentModules = {
183
+ replace: (tag, module$1, content) => {
184
+ let open = module$1.open;
185
+ let close = module$1.close;
186
+ if (typeof open === "function") open = open(tag.attr, tag.attrs);
187
+ if (typeof close === "function") close = close(tag.attr, tag.attrs);
188
+ if (open && !tag.isClosing) content = content.replace("[TAG-" + tag.index + "]", open);
189
+ if (close && tag.closing) content = content.replace("[TAG-" + tag.closing.index + "]", close);
190
+ return content;
191
+ },
192
+ content: (tag, module$1, content) => {
193
+ if (!tag.closing) return content;
194
+ const openTag = "[TAG-" + tag.index + "]";
195
+ const closeTag = "[TAG-" + tag.closing.index + "]";
196
+ const start = content.indexOf(openTag);
197
+ const end = content.indexOf(closeTag);
198
+ let replace = module$1.replace;
199
+ const innerContent = content.slice(start + openTag.length, end);
200
+ if (typeof replace === "function") replace = replace(tag.attr, innerContent, tag.attrs);
201
+ const contentStart = content.slice(0, Math.max(0, start));
202
+ const contentEnd = content.slice(end + closeTag.length);
203
+ return contentStart + replace + contentEnd;
204
+ },
205
+ ignore: (tag, _module, content) => {
206
+ const openTag = "[TAG-" + tag.index + "]";
207
+ const start = content.indexOf(openTag);
208
+ let closeTag = "";
209
+ let end = content.length;
210
+ if (tag.closing) {
211
+ closeTag = "[TAG-" + tag.closing.index + "]";
212
+ end = content.indexOf(closeTag);
213
+ }
214
+ let innerContent = content.slice(start + openTag.length, end);
215
+ innerContent = this.#ignoreLoop(tag.children, innerContent);
216
+ const contentStart = content.slice(0, Math.max(0, start));
217
+ const contentEnd = content.slice(end + closeTag.length);
218
+ return contentStart + innerContent + contentEnd;
219
+ }
220
+ };
221
+ constructor(config = {}) {
222
+ this.config = {
223
+ newline: true,
224
+ paragraph: false,
225
+ cleanUnmatchable: true,
226
+ sanitizeHtml: true,
227
+ allowedSchemes: [
228
+ "http",
229
+ "https",
230
+ "mailto",
231
+ "ftp",
232
+ "ftps"
233
+ ]
234
+ };
235
+ if (config.newline !== void 0) this.config.newline = config.newline;
236
+ if (config.paragraph !== void 0) this.config.paragraph = config.paragraph;
237
+ if (config.cleanUnmatchable !== void 0) this.config.cleanUnmatchable = config.cleanUnmatchable;
238
+ if (config.sanitizeHtml !== void 0) this.config.sanitizeHtml = config.sanitizeHtml;
239
+ if (config.allowedSchemes !== void 0) this.config.allowedSchemes = config.allowedSchemes;
240
+ }
241
+ #ignoreLoop(tagsMap, content) {
242
+ for (const tag of tagsMap) {
243
+ content = content.replace("[TAG-" + tag.index + "]", tag.raw);
244
+ if (tag.closing) content = content.replace("[TAG-" + tag.closing.index + "]", tag.closing.raw);
245
+ if (tag.children.length > 0) content = this.#ignoreLoop(tag.children, content);
246
+ }
247
+ return content;
248
+ }
249
+ #contentLoop(tagsMap, content) {
250
+ if (tagsMap.length > 50) {
251
+ if (!tagsMap.some((tag) => {
252
+ const module$1 = this.tags[tag.module];
253
+ return module$1 && (module$1.type === "content" || module$1.type === "ignore");
254
+ })) return this.#contentLoopOptimized(tagsMap, content);
255
+ }
256
+ for (const tag of tagsMap) {
257
+ let module$1 = this.tags[tag.module];
258
+ if (!module$1) module$1 = {
259
+ type: "replace",
260
+ open: tag.raw,
261
+ close: tag.closing ? tag.closing.raw : ""
262
+ };
263
+ if (!this.contentModules[module$1.type]) throw new Error("Cannot parse content block. Invalid block type [" + module$1.type + "] provided for tag [" + tag.module + "]");
264
+ if (module$1.type === "replace") content = this.contentModules.replace(tag, module$1, content);
265
+ else if (module$1.type === "content") content = this.contentModules.content(tag, module$1, content);
266
+ else if (module$1.type === "ignore") content = this.contentModules.ignore(tag, module$1, content);
267
+ if (tag.children.length > 0 && module$1.type !== "ignore") content = this.#contentLoop(tag.children, content);
268
+ }
269
+ return content;
270
+ }
271
+ #contentLoopOptimized(tagsMap, content) {
272
+ const replacements = /* @__PURE__ */ new Map();
273
+ const processTag = (tag) => {
274
+ let module$1 = this.tags[tag.module];
275
+ if (!module$1) module$1 = {
276
+ type: "replace",
277
+ open: tag.raw,
278
+ close: tag.closing ? tag.closing.raw : ""
279
+ };
280
+ if (module$1.type !== "replace") return;
281
+ let open = module$1.open;
282
+ let close = module$1.close;
283
+ if (typeof open === "function") open = open(tag.attr, tag.attrs);
284
+ if (typeof close === "function") close = close(tag.attr, tag.attrs);
285
+ if (open && !tag.isClosing) replacements.set("[TAG-" + tag.index + "]", open);
286
+ if (close && tag.closing) replacements.set("[TAG-" + tag.closing.index + "]", close);
287
+ if (tag.children.length > 0) for (const child of tag.children) processTag(child);
288
+ };
289
+ for (const tag of tagsMap) processTag(tag);
290
+ return content.replaceAll(/\[TAG-(\d+)]/g, (match) => replacements.get(match) || "");
291
+ }
292
+ #tagLoop(tagsMap, parent) {
293
+ const stack = [];
294
+ const processed = /* @__PURE__ */ new Set();
295
+ for (let i = 0; i < tagsMap.length; i++) {
296
+ const tag = tagsMap[i];
297
+ if (!tag) continue;
298
+ if (tag.isClosing) for (let stackIndex = stack.length - 1; stackIndex >= 0; stackIndex--) {
299
+ const openTag = stack[stackIndex];
300
+ if (!openTag) continue;
301
+ if (openTag.module === tag.module && !processed.has(openTag.index)) {
302
+ openTag.matchTag = tag.index;
303
+ openTag.closing = tag;
304
+ tag.matchTag = openTag.index;
305
+ processed.add(openTag.index);
306
+ const childStart = (openTag.stackIndex ?? 0) + 1;
307
+ if (childStart < i) {
308
+ openTag.children = [];
309
+ for (let childIndex = childStart; childIndex < i; childIndex++) {
310
+ const childTag = tagsMap[childIndex];
311
+ if (childTag && !childTag.isClosing && childTag.parent === null) {
312
+ childTag.parent = openTag.index;
313
+ openTag.children.push(childTag);
314
+ }
315
+ }
316
+ }
317
+ stack.splice(stackIndex, 1);
318
+ break;
319
+ }
320
+ }
321
+ else {
322
+ tag.stackIndex = i;
323
+ stack.push(tag);
324
+ }
325
+ }
326
+ for (const tag of stack) {
327
+ tag.matchTag = false;
328
+ const childStart = (tag.stackIndex ?? 0) + 1;
329
+ if (childStart < tagsMap.length) {
330
+ tag.children = [];
331
+ for (let childIndex = childStart; childIndex < tagsMap.length; childIndex++) {
332
+ const childTag = tagsMap[childIndex];
333
+ if (childTag && !childTag.isClosing && childTag.parent === null) {
334
+ childTag.parent = tag.index;
335
+ tag.children.push(childTag);
336
+ }
337
+ }
338
+ }
339
+ }
340
+ const result = [];
341
+ for (const tag of tagsMap) if (!tag.isClosing) {
342
+ if (parent === void 0 && tag.parent === null || parent !== void 0 && tag.parent === parent) {
343
+ if (tag.children.length > 0) tag.children = this.#tagLoop(tag.children, tag.index);
344
+ result.push(tag);
345
+ }
346
+ }
347
+ return result;
348
+ }
349
+ clearTags() {
350
+ this.tags = {};
351
+ return this;
352
+ }
353
+ registerTag(tag, options) {
354
+ const tagName = String(tag).toLowerCase();
355
+ if ([
356
+ "__proto__",
357
+ "constructor",
358
+ "prototype"
359
+ ].includes(tagName)) throw new Error(`Cannot register tag with dangerous name: ${tagName}`);
360
+ this.tags[tagName] = options;
361
+ return this;
362
+ }
363
+ parse(bbcInput) {
364
+ if (typeof bbcInput === "boolean" || typeof bbcInput !== "string" && Number.isNaN(Number(bbcInput))) return "";
365
+ let input = String(bbcInput);
366
+ if (this.config.sanitizeHtml) {
367
+ const htmlEntities = {
368
+ "&": "&amp;",
369
+ "<": "&lt;",
370
+ ">": "&gt;",
371
+ "\"": "&quot;",
372
+ "'": "&#39;"
373
+ };
374
+ input = input.replaceAll(/["&'<>]/g, (char) => htmlEntities[char]);
375
+ }
376
+ let tagsMap = [];
377
+ const tags = String(input).match(this.regex.tags);
378
+ if (this.config.newline) if (this.config.paragraph) input = input.replace(this.regex.newline, "</p><p>");
379
+ else input = input.replace(this.regex.newline, "<br/>");
380
+ if (this.config.paragraph) input = "<p>" + input + "</p>";
381
+ if (!tags || tags.length === 0) return input;
382
+ for (const [i, tag] of tags.entries()) {
383
+ const tagContent = tag.slice(1, -1);
384
+ const isClosing = tagContent.startsWith("/");
385
+ const contentToParse = isClosing ? tagContent.slice(1) : tagContent;
386
+ const spaceIndex = contentToParse.indexOf(" ");
387
+ const equalsIndex = contentToParse.indexOf("=");
388
+ let moduleName;
389
+ let parsedAttrs;
390
+ if (spaceIndex === -1 && equalsIndex === -1) {
391
+ moduleName = contentToParse.toLowerCase();
392
+ parsedAttrs = {
393
+ attr: "",
394
+ attrs: {}
395
+ };
396
+ } else if (spaceIndex === -1 || equalsIndex !== -1 && equalsIndex < spaceIndex) {
397
+ moduleName = (contentToParse.split("=")[0] ?? "").toLowerCase();
398
+ parsedAttrs = parseTagAttributes(contentToParse);
399
+ } else {
400
+ moduleName = (contentToParse.split(/\s+/)[0] ?? "").toLowerCase();
401
+ parsedAttrs = parseTagAttributes(contentToParse);
402
+ }
403
+ const item = {
404
+ index: i,
405
+ module: moduleName,
406
+ isClosing,
407
+ raw: tag,
408
+ attr: parsedAttrs.attr,
409
+ attrs: parsedAttrs.attrs,
410
+ children: [],
411
+ parent: null,
412
+ matchTag: null
413
+ };
414
+ tagsMap.push(item);
415
+ }
416
+ if (tags.length <= 3) for (const [i, tag] of tags.entries()) input = input.replace(tag, "[TAG-" + i + "]");
417
+ else {
418
+ const tagPositions = [];
419
+ let lastIndex = 0;
420
+ for (const [i, tag] of tags.entries()) {
421
+ const pos = input.indexOf(tag, lastIndex);
422
+ if (pos !== -1) {
423
+ tagPositions.push({
424
+ pos,
425
+ tag,
426
+ placeholder: "[TAG-" + i + "]"
427
+ });
428
+ lastIndex = pos + tag.length;
429
+ }
430
+ }
431
+ if (tagPositions.length > 0) {
432
+ const parts = [];
433
+ let lastPos = 0;
434
+ for (const { pos, tag, placeholder } of tagPositions) {
435
+ parts.push(input.slice(lastPos, pos));
436
+ parts.push(placeholder);
437
+ lastPos = pos + tag.length;
438
+ }
439
+ parts.push(input.slice(lastPos));
440
+ input = parts.join("");
441
+ }
442
+ }
443
+ tagsMap = this.#tagLoop(tagsMap);
444
+ input = this.#contentLoop(tagsMap, input);
445
+ if (this.config.cleanUnmatchable) input = input.replace(this.regex.placeholders, "");
446
+ return input;
447
+ }
448
+ };
449
+ var ya_bbcode_default = yabbcode;
450
+
451
+ //#endregion
452
+ module.exports = ya_bbcode_default;
453
+ //# sourceMappingURL=ya-bbcode.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ya-bbcode.cjs","names":["attrEntities: { [key: string]: string; }","attrs: TagAttributes","module","#ignoreLoop","#contentLoopOptimized","#contentLoop","#tagLoop","tagsMap: TagItem[]","moduleName: string","parsedAttrs: { attr: string; attrs: TagAttributes; }","item: TagItem"],"sources":["../src/ya-bbcode.ts"],"sourcesContent":["// Type definitions\ninterface Config {\n\tnewline?: boolean;\n\tparagraph?: boolean;\n\tcleanUnmatchable?: boolean;\n\tsanitizeHtml?: boolean;\n\tallowedSchemes?: string[];\n}\n\n// Parsed attributes from tags like [code lang=javascript skip-lint]\ninterface TagAttributes {\n\t[key: string]: string | boolean;\n}\n\ninterface ReplaceTag {\n\ttype: 'replace';\n\topen: ((attr: string, attrs: TagAttributes) => string) | string;\n\tclose: ((attr: string, attrs: TagAttributes) => string) | string | null;\n}\n\ninterface ContentTag {\n\ttype: 'content';\n\treplace: ((attr: string, content: string, attrs: TagAttributes) => string) | string;\n}\n\ninterface IgnoreTag {\n\ttype: 'ignore';\n}\n\ntype TagDefinition = ReplaceTag | ContentTag | IgnoreTag;\n\ninterface TagsMap {\n\t[key: string]: TagDefinition;\n}\n\ninterface TagItem {\n\tindex: number;\n\tmodule: string;\n\traw: string;\n\tattr: string; // Backward compat: first value or empty\n\tattrs: TagAttributes; // Parsed attributes\n\tisClosing: boolean;\n\tmatchTag: number | false | null;\n\tclosing?: TagItem;\n\tchildren: TagItem[];\n\tparent: number | null;\n\tstackIndex?: number;\n}\n\n/**\n * Escapes HTML attribute values to prevent XSS\n * Encodes quotes, angle brackets, and other special characters\n */\nfunction escapeHtmlAttr(value: string): string {\n\tconst attrEntities: { [key: string]: string; } = {\n\t\t'&': '&amp;',\n\t\t'<': '&lt;',\n\t\t'>': '&gt;',\n\t\t'\"': '&quot;',\n\t\t'\\'': '&#39;',\n\t};\n\treturn String(value).replaceAll(/[\"&'<>]/g, (char: string) => attrEntities[char] || char);\n}\n\n/**\n * Validates and sanitizes URLs to prevent javascript: and data: URL attacks\n * Only allows safe URL schemes based on the allowedSchemes list\n */\nfunction sanitizeUrl(url: string, allowedSchemes: string[]): string {\n\tconst trimmed = String(url).trim();\n\tif (!trimmed) { return '#'; }\n\n\t// Allow relative URLs (starting with /, ./, or ../)\n\tif (/^\\.{0,2}\\//.test(trimmed)) {\n\t\treturn trimmed;\n\t}\n\n\t// Allow fragment identifiers\n\tif (trimmed.startsWith('#')) {\n\t\treturn trimmed;\n\t}\n\n\t// Check for scheme\n\tconst schemeMatch = /^([a-z][\\d+.a-z-]*):/.exec(trimmed.toLowerCase());\n\tif (schemeMatch) {\n\t\tconst scheme = schemeMatch[1] ?? '';\n\t\tif (!allowedSchemes.includes(scheme)) {\n\t\t\t// Dangerous scheme detected (javascript:, data:, vbscript:, etc.)\n\t\t\treturn '#';\n\t\t}\n\t}\n\n\treturn trimmed;\n}\n\n/**\n * Parse tag attributes from a tag string\n * Supports both formats:\n * - [tag=value] → { attr: 'value', attrs: {} }\n * - [tag key=value flag] → { attr: 'value', attrs: { key: 'value', flag: true } }\n */\nfunction parseTagAttributes(tagContent: string): { attr: string; attrs: TagAttributes; } {\n\t// Check if tag has spaces (space-separated) or = (simple attribute)\n\tconst firstSpace = tagContent.indexOf(' ');\n\tconst firstEquals = tagContent.indexOf('=');\n\n\t// Simple attribute format: [tag=value] or [tag] (no attributes)\n\tif (firstSpace === -1 || (firstEquals !== -1 && firstEquals < firstSpace)) {\n\t\tconst parts = tagContent.split('=');\n\t\treturn {\n\t\t\tattr: parts.slice(1).join('='), // Everything after first =\n\t\t\tattrs: {},\n\t\t};\n\t}\n\n\t// Space-separated attributes format: [tag attr1 key=value attr2]\n\tconst parts = tagContent.split(/\\s+/);\n\t// Use Object.create(null) to prevent prototype pollution\n\tconst attrs: TagAttributes = Object.create(null) as TagAttributes;\n\tlet firstValue = '';\n\n\t// Dangerous keys that could lead to prototype pollution\n\tconst dangerousKeys = new Set(['__proto__', 'constructor', 'prototype']);\n\n\tfor (let i = 1; i < parts.length; i++) {\n\t\tconst part = parts[i];\n\t\tif (!part) { continue; }\n\n\t\tif (part.includes('=')) {\n\t\t\tconst eqIndex = part.indexOf('=');\n\t\t\tconst key = part.slice(0, eqIndex);\n\t\t\tconst value = part.slice(eqIndex + 1);\n\n\t\t\t// Prevent prototype pollution\n\t\t\tif (dangerousKeys.has(key.toLowerCase())) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tattrs[key] = value;\n\t\t\t// First key=value becomes the attr for backward compat\n\t\t\tif (!firstValue && value) {\n\t\t\t\tfirstValue = value;\n\t\t\t}\n\t\t} else {\n\t\t\t// Boolean flag - also check for dangerous keys\n\t\t\tif (dangerousKeys.has(part.toLowerCase())) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tattrs[part] = true;\n\t\t}\n\t}\n\n\treturn { attr: firstValue, attrs };\n}\n\nclass yabbcode {\n\ttags: TagsMap = {\n\t\t'url': {\n\t\t\ttype: 'replace',\n\t\t\topen: attr => `<a href=\"${escapeHtmlAttr(sanitizeUrl(attr, this.config.allowedSchemes ?? ['http', 'https', 'mailto', 'ftp', 'ftps']))}\">`,\n\t\t\tclose: '</a>',\n\t\t},\n\t\t'quote': {\n\t\t\ttype: 'replace',\n\t\t\topen: attr => `<blockquote author=\"${escapeHtmlAttr(attr)}\">`,\n\t\t\tclose: '</blockquote>',\n\t\t},\n\t\t'b': {\n\t\t\ttype: 'replace',\n\t\t\topen: '<strong>',\n\t\t\tclose: '</strong>',\n\t\t},\n\t\t'u': {\n\t\t\ttype: 'replace',\n\t\t\topen: '<u>',\n\t\t\tclose: '</u>',\n\t\t},\n\t\t'i': {\n\t\t\ttype: 'replace',\n\t\t\topen: '<i>',\n\t\t\tclose: '</i>',\n\t\t},\n\t\t'h1': {\n\t\t\ttype: 'replace',\n\t\t\topen: '<h1>',\n\t\t\tclose: '</h1>',\n\t\t},\n\t\t'h2': {\n\t\t\ttype: 'replace',\n\t\t\topen: '<h2>',\n\t\t\tclose: '</h2>',\n\t\t},\n\t\t'h3': {\n\t\t\ttype: 'replace',\n\t\t\topen: '<h3>',\n\t\t\tclose: '</h3>',\n\t\t},\n\t\t'h4': {\n\t\t\ttype: 'replace',\n\t\t\topen: '<h4>',\n\t\t\tclose: '</h4>',\n\t\t},\n\t\t'h5': {\n\t\t\ttype: 'replace',\n\t\t\topen: '<h5>',\n\t\t\tclose: '</h5>',\n\t\t},\n\t\t'h6': {\n\t\t\ttype: 'replace',\n\t\t\topen: '<h6>',\n\t\t\tclose: '</h6>',\n\t\t},\n\t\t'code': {\n\t\t\ttype: 'replace',\n\t\t\topen: '<code>',\n\t\t\tclose: '</code>',\n\t\t},\n\t\t'strike': {\n\t\t\ttype: 'replace',\n\t\t\topen: '<span class=\"yabbcode-strike\">',\n\t\t\tclose: '</span>',\n\t\t},\n\t\t'spoiler': {\n\t\t\ttype: 'replace',\n\t\t\topen: '<span class=\"yabbcode-spoiler\">',\n\t\t\tclose: '</span>',\n\t\t},\n\t\t'list': {\n\t\t\ttype: 'replace',\n\t\t\topen: '<ul>',\n\t\t\tclose: '</ul>',\n\t\t},\n\t\t'olist': {\n\t\t\ttype: 'replace',\n\t\t\topen: '<ol>',\n\t\t\tclose: '</ol>',\n\t\t},\n\t\t'*': {\n\t\t\ttype: 'replace',\n\t\t\topen: '<li>',\n\t\t\tclose: null,\n\t\t},\n\t\t'img': {\n\t\t\ttype: 'content',\n\t\t\treplace: (attr, content) => {\n\t\t\t\tif (!content) {\n\t\t\t\t\treturn '';\n\t\t\t\t}\n\t\t\t\treturn `<img src=\"${escapeHtmlAttr(content)}\" alt=\"${escapeHtmlAttr(attr)}\"/>`;\n\t\t\t},\n\t\t},\n\t\t'noparse': {\n\t\t\ttype: 'ignore',\n\t\t},\n\t};\n\n\tregex = {\n\t\ttags: /(\\[[^\\]^]+])/g,\n\t\tnewline: /\\r\\n|\\r|\\n/g,\n\t\tplaceholders: /\\[TAG-[1-9]+]/g,\n\t};\n\n\tconfig: Config;\n\n\tcontentModules = {\n\t\treplace: (tag: TagItem, module: ReplaceTag, content: string): string => {\n\t\t\tlet open = module.open;\n\t\t\tlet close = module.close;\n\t\t\tif (typeof(open) === 'function') {\n\t\t\t\topen = open(tag.attr, tag.attrs);\n\t\t\t}\n\t\t\tif (typeof(close) === 'function') {\n\t\t\t\tclose = close(tag.attr, tag.attrs);\n\t\t\t}\n\t\t\t// do the replace\n\t\t\tif (open && !tag.isClosing) {\n\t\t\t\t//content = content\n\t\t\t\tcontent = content.replace('[TAG-' + tag.index + ']', open);\n\t\t\t}\n\t\t\tif (close && tag.closing) {\n\t\t\t\tcontent = content.replace('[TAG-' + tag.closing.index + ']', close);\n\t\t\t}\n\t\t\treturn content;\n\t\t},\n\t\tcontent: (tag: TagItem, module: ContentTag, content: string): string => {\n\t\t\tif (!tag.closing) { return content; }\n\t\t\tconst openTag = '[TAG-' + tag.index + ']';\n\t\t\tconst closeTag = '[TAG-' + tag.closing.index + ']';\n\t\t\tconst start = content.indexOf(openTag);\n\t\t\tconst end = content.indexOf(closeTag);\n\t\t\tlet replace = module.replace;\n\n\t\t\tconst innerContent = content.slice(start + openTag.length, end);\n\t\t\tif (typeof(replace) === 'function') {\n\t\t\t\treplace = replace(tag.attr, innerContent, tag.attrs);\n\t\t\t}\n\n\t\t\tconst contentStart = content.slice(0, Math.max(0, start));\n\t\t\tconst contentEnd = content.slice(end + closeTag.length);\n\n\t\t\treturn contentStart + replace + contentEnd;\n\t\t},\n\t\tignore: (tag: TagItem, _module: IgnoreTag, content: string): string => {\n\t\t\tconst openTag = '[TAG-' + tag.index + ']';\n\t\t\tconst start = content.indexOf(openTag);\n\t\t\tlet closeTag = '';\n\t\t\tlet end = content.length;\n\t\t\tif (tag.closing) {\n\t\t\t\tcloseTag = '[TAG-' + tag.closing.index + ']';\n\t\t\t\tend = content.indexOf(closeTag);\n\t\t\t}\n\t\t\tlet innerContent = content.slice(start + openTag.length, end);\n\t\t\tinnerContent = this.#ignoreLoop(tag.children, innerContent);\n\t\t\tconst contentStart = content.slice(0, Math.max(0, start));\n\t\t\tconst contentEnd = content.slice(end + closeTag.length);\n\t\t\treturn contentStart + innerContent + contentEnd;\n\t\t},\n\t};\n\n\tconstructor(config: Config = {}) {\n\t\tthis.config = {\n\t\t\tnewline: true,\n\t\t\tparagraph: false,\n\t\t\tcleanUnmatchable: true,\n\t\t\tsanitizeHtml: true,\n\t\t\tallowedSchemes: ['http', 'https', 'mailto', 'ftp', 'ftps'],\n\t\t};\n\t\tif (config.newline !== undefined) {\n\t\t\tthis.config.newline = config.newline;\n\t\t}\n\t\tif (config.paragraph !== undefined) {\n\t\t\tthis.config.paragraph = config.paragraph;\n\t\t}\n\t\tif (config.cleanUnmatchable !== undefined) {\n\t\t\tthis.config.cleanUnmatchable = config.cleanUnmatchable;\n\t\t}\n\t\tif (config.sanitizeHtml !== undefined) {\n\t\t\tthis.config.sanitizeHtml = config.sanitizeHtml;\n\t\t}\n\t\tif (config.allowedSchemes !== undefined) {\n\t\t\tthis.config.allowedSchemes = config.allowedSchemes;\n\t\t}\n\t}\n\n\t#ignoreLoop(tagsMap: TagItem[], content: string): string {\n\t\tfor (const tag of tagsMap) {\n\t\t\tcontent = content.replace('[TAG-' + tag.index + ']', tag.raw);\n\t\t\tif (tag.closing) {\n\t\t\t\tcontent = content.replace('[TAG-' + tag.closing.index + ']', tag.closing.raw);\n\t\t\t}\n\t\t\tif (tag.children.length > 0) {\n\t\t\t\tcontent = this.#ignoreLoop(tag.children, content);\n\t\t\t}\n\t\t}\n\t\treturn content;\n\t}\n\n\t#contentLoop(tagsMap: TagItem[], content: string): string {\n\t\t// Adaptive threshold: use optimized path for large documents (>50 tags)\n\t\t// Only optimize when all tags are replace-type (most common case for large docs)\n\t\tif (tagsMap.length > 50) {\n\t\t\t// Check if we have any content or ignore type tags\n\t\t\tconst hasSpecialTypes = tagsMap.some((tag) => {\n\t\t\t\tconst module = this.tags[tag.module];\n\t\t\t\treturn module && (module.type === 'content' || module.type === 'ignore');\n\t\t\t});\n\n\t\t\t// If only replace-type tags, use optimized single-pass approach\n\t\t\tif (!hasSpecialTypes) {\n\t\t\t\treturn this.#contentLoopOptimized(tagsMap, content);\n\t\t\t}\n\t\t}\n\n\t\tfor (const tag of tagsMap) {\n\t\t\tlet module = this.tags[tag.module];\n\t\t\tif (!module) {\n\t\t\t\t// ignore invalid BBCode\n\t\t\t\tmodule = {\n\t\t\t\t\ttype: 'replace',\n\t\t\t\t\topen: tag.raw,\n\t\t\t\t\tclose: tag.closing ? tag.closing.raw : '',\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (!this.contentModules[module.type]) {\n\t\t\t\tthrow new Error('Cannot parse content block. Invalid block type [' + module.type + '] provided for tag [' + tag.module + ']');\n\t\t\t}\n\t\t\tif (module.type === 'replace') {\n\t\t\t\tcontent = this.contentModules.replace(tag, module, content);\n\t\t\t} else if (module.type === 'content') {\n\t\t\t\tcontent = this.contentModules.content(tag, module, content);\n\t\t\t} else if (module.type === 'ignore') {\n\t\t\t\tcontent = this.contentModules.ignore(tag, module, content);\n\t\t\t}\n\t\t\tif (tag.children.length > 0 && module.type !== 'ignore') {\n\t\t\t\tcontent = this.#contentLoop(tag.children, content);\n\t\t\t}\n\t\t}\n\n\t\treturn content;\n\t}\n\n\t#contentLoopOptimized(tagsMap: TagItem[], content: string): string {\n\t\t// Optimized single-pass replacement for replace-type tags only\n\t\t// Build replacement map for all placeholders\n\t\tconst replacements = new Map<string, string>();\n\n\t\tconst processTag = (tag: TagItem) => {\n\t\t\tlet module = this.tags[tag.module];\n\t\t\tif (!module) {\n\t\t\t\tmodule = {\n\t\t\t\t\ttype: 'replace',\n\t\t\t\t\topen: tag.raw,\n\t\t\t\t\tclose: tag.closing ? tag.closing.raw : '',\n\t\t\t\t} as ReplaceTag;\n\t\t\t}\n\n\t\t\t// Only handle replace type (this function is only called when all tags are replace type)\n\t\t\tif (module.type !== 'replace') { return; }\n\n\t\t\tlet open = module.open;\n\t\t\tlet close = module.close;\n\t\t\tif (typeof(open) === 'function') {\n\t\t\t\topen = open(tag.attr, tag.attrs);\n\t\t\t}\n\t\t\tif (typeof(close) === 'function') {\n\t\t\t\tclose = close(tag.attr, tag.attrs);\n\t\t\t}\n\t\t\tif (open && !tag.isClosing) {\n\t\t\t\treplacements.set('[TAG-' + tag.index + ']', open);\n\t\t\t}\n\t\t\tif (close && tag.closing) {\n\t\t\t\treplacements.set('[TAG-' + tag.closing.index + ']', close);\n\t\t\t}\n\n\t\t\t// Process children recursively\n\t\t\tif (tag.children.length > 0) {\n\t\t\t\tfor (const child of tag.children) {\n\t\t\t\t\tprocessTag(child);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t// Build replacement map for all tags\n\t\tfor (const tag of tagsMap) {\n\t\t\tprocessTag(tag);\n\t\t}\n\n\t\t// Single-pass replacement using regex\n\t\tconst placeholderRegex = /\\[TAG-(\\d+)]/g;\n\t\treturn content.replaceAll(placeholderRegex, (match: string) => replacements.get(match) || '');\n\t}\n\n\t#tagLoop(tagsMap: TagItem[], parent?: number): TagItem[] {\n\t\t// Use stack-based algorithm - O(n) instead of O(n²)\n\t\tconst stack = [];\n\t\tconst processed = new Set();\n\n\t\tfor (let i = 0; i < tagsMap.length; i++) {\n\t\t\tconst tag = tagsMap[i];\n\t\t\tif (!tag) { continue; }\n\n\t\t\tif (tag.isClosing) {\n\t\t\t\t// Find matching opening tag on stack (search backwards for proper nesting)\n\t\t\t\tfor (let stackIndex = stack.length - 1; stackIndex >= 0; stackIndex--) {\n\t\t\t\t\tconst openTag = stack[stackIndex];\n\t\t\t\t\tif (!openTag) { continue; }\n\t\t\t\t\tif (openTag.module === tag.module && !processed.has(openTag.index)) {\n\t\t\t\t\t\t// Match found\n\t\t\t\t\t\topenTag.matchTag = tag.index;\n\t\t\t\t\t\topenTag.closing = tag;\n\t\t\t\t\t\ttag.matchTag = openTag.index;\n\t\t\t\t\t\tprocessed.add(openTag.index);\n\n\t\t\t\t\t\t// Set children for the opening tag\n\t\t\t\t\t\tconst childStart = (openTag.stackIndex ?? 0) + 1;\n\t\t\t\t\t\tif (childStart < i) {\n\t\t\t\t\t\t\topenTag.children = [];\n\t\t\t\t\t\t\tfor (let childIndex = childStart; childIndex < i; childIndex++) {\n\t\t\t\t\t\t\t\tconst childTag = tagsMap[childIndex];\n\t\t\t\t\t\t\t\tif (childTag && !childTag.isClosing && childTag.parent === null) {\n\t\t\t\t\t\t\t\t\tchildTag.parent = openTag.index;\n\t\t\t\t\t\t\t\t\topenTag.children.push(childTag);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Remove matched opening tag from stack\n\t\t\t\t\t\tstack.splice(stackIndex, 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Opening tag - add to stack\n\t\t\t\ttag.stackIndex = i;\n\t\t\t\tstack.push(tag);\n\t\t\t}\n\t\t}\n\n\t\t// Handle unmatched opening tags - assign all remaining tags as children\n\t\tfor (const tag of stack) {\n\t\t\ttag.matchTag = false;\n\t\t\tconst childStart = (tag.stackIndex ?? 0) + 1;\n\t\t\tif (childStart < tagsMap.length) {\n\t\t\t\ttag.children = [];\n\t\t\t\tfor (let childIndex = childStart; childIndex < tagsMap.length; childIndex++) {\n\t\t\t\t\tconst childTag = tagsMap[childIndex];\n\t\t\t\t\tif (childTag && !childTag.isClosing && childTag.parent === null) {\n\t\t\t\t\t\tchildTag.parent = tag.index;\n\t\t\t\t\t\ttag.children.push(childTag);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Filter and process recursively\n\t\tconst result = [];\n\t\tfor (const tag of tagsMap) {\n\t\t\tif (!tag.isClosing) {\n\t\t\t\tconst shouldInclude = (parent === undefined && tag.parent === null) ||\n\t\t\t\t\t(parent !== undefined && tag.parent === parent);\n\t\t\t\tif (shouldInclude) {\n\t\t\t\t\tif (tag.children.length > 0) {\n\t\t\t\t\t\ttag.children = this.#tagLoop(tag.children, tag.index);\n\t\t\t\t\t}\n\t\t\t\t\tresult.push(tag);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tclearTags(): this {\n\t\tthis.tags = {};\n\t\treturn this;\n\t}\n\n\tregisterTag(tag: string, options: TagDefinition): this {\n\t\tconst tagName = String(tag).toLowerCase();\n\n\t\t// Prevent prototype pollution\n\t\tconst dangerousKeys = ['__proto__', 'constructor', 'prototype'];\n\t\tif (dangerousKeys.includes(tagName)) {\n\t\t\tthrow new Error(`Cannot register tag with dangerous name: ${tagName}`);\n\t\t}\n\n\t\tthis.tags[tagName] = options;\n\t\treturn this;\n\t}\n\n\tparse(bbcInput: string | number | boolean): string {\n\t\tif (\n\t\t\ttypeof(bbcInput) === 'boolean'\n\t\t\t|| (typeof(bbcInput) !== 'string' && Number.isNaN(Number(bbcInput)))\n\t\t) { return ''; }\n\t\tlet input = String(bbcInput);\n\t\tif (this.config.sanitizeHtml) {\n\t\t\t// Batch HTML entity replacement for better performance\n\t\t\tconst htmlEntities = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '\"': '&quot;', '\\'': '&#39;' };\n\t\t\tinput = input.replaceAll(/[\"&'<>]/g, (char: string) => htmlEntities[char as keyof typeof htmlEntities]);\n\t\t}\n\n\t\t// reset\n\t\tlet tagsMap: TagItem[] = [];\n\t\t// split input into tags by index\n\t\tconst tags = String(input).match(this.regex.tags);\n\n\t\tif (this.config.newline) {\n\t\t\tif (this.config.paragraph) {\n\t\t\t\tinput = input.replace(this.regex.newline, '</p><p>');\n\t\t\t} else {\n\t\t\t\tinput = input.replace(this.regex.newline, '<br/>');\n\t\t\t}\n\t\t}\n\t\tif (this.config.paragraph) {\n\t\t\tinput = '<p>' + input + '</p>';\n\t\t}\n\n\t\t// handle when no tags are present\n\t\tif (!tags || tags.length === 0) {\n\t\t\treturn input;\n\t\t}\n\t\t// Build tag map and replace with placeholders\n\t\tfor (const [i, tag] of tags.entries()) {\n\t\t\tconst tagContent = tag.slice(1, -1); // Remove [ ]\n\t\t\tconst isClosing = tagContent.startsWith('/');\n\t\t\tconst contentToParse = isClosing ? tagContent.slice(1) : tagContent;\n\n\t\t\t// Parse module name and attributes\n\t\t\tconst spaceIndex = contentToParse.indexOf(' ');\n\t\t\tconst equalsIndex = contentToParse.indexOf('=');\n\t\t\tlet moduleName: string;\n\t\t\tlet parsedAttrs: { attr: string; attrs: TagAttributes; };\n\n\t\t\t// Extract module name (before space or =)\n\t\t\tif (spaceIndex === -1 && equalsIndex === -1) {\n\t\t\t\t// No attributes: [tag]\n\t\t\t\tmoduleName = contentToParse.toLowerCase();\n\t\t\t\tparsedAttrs = { attr: '', attrs: {} };\n\t\t\t} else if (spaceIndex === -1 || (equalsIndex !== -1 && equalsIndex < spaceIndex)) {\n\t\t\t\t// Old format: [tag=value]\n\t\t\t\tmoduleName = (contentToParse.split('=')[0] ?? '').toLowerCase();\n\t\t\t\tparsedAttrs = parseTagAttributes(contentToParse);\n\t\t\t} else {\n\t\t\t\t// New format: [tag attr1 key=value]\n\t\t\t\tmoduleName = (contentToParse.split(/\\s+/)[0] ?? '').toLowerCase();\n\t\t\t\tparsedAttrs = parseTagAttributes(contentToParse);\n\t\t\t}\n\n\t\t\tconst item: TagItem = {\n\t\t\t\tindex: i,\n\t\t\t\tmodule: moduleName,\n\t\t\t\tisClosing,\n\t\t\t\traw: tag,\n\t\t\t\tattr: parsedAttrs.attr,\n\t\t\t\tattrs: parsedAttrs.attrs,\n\t\t\t\tchildren: [],\n\t\t\t\tparent: null,\n\t\t\t\tmatchTag: null,\n\t\t\t};\n\n\t\t\ttagsMap.push(item);\n\t\t}\n\n\t\t// Replace tags with placeholders - optimized for different input sizes\n\t\tif (tags.length <= 3) {\n\t\t\t// Fast path for few tags - direct replacement is faster\n\t\t\tfor (const [i, tag] of tags.entries()) {\n\t\t\t\tinput = input.replace(tag, '[TAG-' + i + ']');\n\t\t\t}\n\t\t} else {\n\t\t\t// Batch replacement for many tags\n\t\t\tconst tagPositions = [];\n\t\t\tlet lastIndex = 0;\n\t\t\tfor (const [i, tag] of tags.entries()) {\n\t\t\t\tconst pos = input.indexOf(tag, lastIndex);\n\t\t\t\tif (pos !== -1) {\n\t\t\t\t\ttagPositions.push({ pos, tag: tag, placeholder: '[TAG-' + i + ']' });\n\t\t\t\t\tlastIndex = pos + tag.length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (tagPositions.length > 0) {\n\t\t\t\tconst parts = [];\n\t\t\t\tlet lastPos = 0;\n\t\t\t\tfor (const { pos, tag, placeholder } of tagPositions) {\n\t\t\t\t\tparts.push(input.slice(lastPos, pos));\n\t\t\t\t\tparts.push(placeholder);\n\t\t\t\t\tlastPos = pos + tag.length;\n\t\t\t\t}\n\t\t\t\tparts.push(input.slice(lastPos));\n\t\t\t\tinput = parts.join('');\n\t\t\t}\n\t\t}\n\t\t// loop through each tag to create nested elements\n\t\ttagsMap = this.#tagLoop(tagsMap);\n\t\t// put back all non-found matches?\n\t\tinput = this.#contentLoop(tagsMap, input);\n\t\tif (this.config.cleanUnmatchable) {\n\t\t\tinput = input.replace(this.regex.placeholders, '');\n\t\t}\n\t\treturn input;\n\t}\n}\n\n// Export types for users\nexport type { Config, TagAttributes, ReplaceTag, ContentTag, IgnoreTag, TagDefinition };\n\n// Default export for both CJS and ESM\nexport default yabbcode;\n"],"mappings":";;;;;;AAqDA,SAAS,eAAe,OAAuB;CAC9C,MAAMA,eAA2C;EAChD,KAAK;EACL,KAAK;EACL,KAAK;EACL,MAAK;EACL,KAAM;EACN;AACD,QAAO,OAAO,MAAM,CAAC,WAAW,aAAa,SAAiB,aAAa,SAAS,KAAK;;;;;;AAO1F,SAAS,YAAY,KAAa,gBAAkC;CACnE,MAAM,UAAU,OAAO,IAAI,CAAC,MAAM;AAClC,KAAI,CAAC,QAAW,QAAO;AAGvB,KAAI,aAAa,KAAK,QAAQ,CAC7B,QAAO;AAIR,KAAI,QAAQ,WAAW,IAAI,CAC1B,QAAO;CAIR,MAAM,cAAc,uBAAuB,KAAK,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D,WAAM,KAAK,MAAM,MAAM,SAAS,IAAI,CAAC;AACrC,WAAM,KAAK,YAAY;AACvB,eAAU,MAAM,IAAI;;AAErB,UAAM,KAAK,MAAM,MAAM,QAAQ,CAAC;AAChC,YAAQ,MAAM,KAAK,GAAG;;;AAIxB,YAAU,MAAKJ,QAAS,QAAQ;AAEhC,UAAQ,MAAKD,YAAa,SAAS,MAAM;AACzC,MAAI,KAAK,OAAO,iBACf,SAAQ,MAAM,QAAQ,KAAK,MAAM,cAAc,GAAG;AAEnD,SAAO;;;AAQT,wBAAe"}
@@ -0,0 +1,62 @@
1
+ //#region src/ya-bbcode.d.ts
2
+ interface Config {
3
+ newline?: boolean;
4
+ paragraph?: boolean;
5
+ cleanUnmatchable?: boolean;
6
+ sanitizeHtml?: boolean;
7
+ allowedSchemes?: string[];
8
+ }
9
+ interface TagAttributes {
10
+ [key: string]: string | boolean;
11
+ }
12
+ interface ReplaceTag {
13
+ type: 'replace';
14
+ open: ((attr: string, attrs: TagAttributes) => string) | string;
15
+ close: ((attr: string, attrs: TagAttributes) => string) | string | null;
16
+ }
17
+ interface ContentTag {
18
+ type: 'content';
19
+ replace: ((attr: string, content: string, attrs: TagAttributes) => string) | string;
20
+ }
21
+ interface IgnoreTag {
22
+ type: 'ignore';
23
+ }
24
+ type TagDefinition = ReplaceTag | ContentTag | IgnoreTag;
25
+ interface TagsMap {
26
+ [key: string]: TagDefinition;
27
+ }
28
+ interface TagItem {
29
+ index: number;
30
+ module: string;
31
+ raw: string;
32
+ attr: string;
33
+ attrs: TagAttributes;
34
+ isClosing: boolean;
35
+ matchTag: number | false | null;
36
+ closing?: TagItem;
37
+ children: TagItem[];
38
+ parent: number | null;
39
+ stackIndex?: number;
40
+ }
41
+ declare class yabbcode {
42
+ #private;
43
+ tags: TagsMap;
44
+ regex: {
45
+ tags: RegExp;
46
+ newline: RegExp;
47
+ placeholders: RegExp;
48
+ };
49
+ config: Config;
50
+ contentModules: {
51
+ replace: (tag: TagItem, module: ReplaceTag, content: string) => string;
52
+ content: (tag: TagItem, module: ContentTag, content: string) => string;
53
+ ignore: (tag: TagItem, _module: IgnoreTag, content: string) => string;
54
+ };
55
+ constructor(config?: Config);
56
+ clearTags(): this;
57
+ registerTag(tag: string, options: TagDefinition): this;
58
+ parse(bbcInput: string | number | boolean): string;
59
+ }
60
+ //#endregion
61
+ export { type Config, type ContentTag, type IgnoreTag, type ReplaceTag, type TagAttributes, type TagDefinition, yabbcode as default };
62
+ //# sourceMappingURL=ya-bbcode.d.cts.map
@@ -0,0 +1,62 @@
1
+ //#region src/ya-bbcode.d.ts
2
+ interface Config {
3
+ newline?: boolean;
4
+ paragraph?: boolean;
5
+ cleanUnmatchable?: boolean;
6
+ sanitizeHtml?: boolean;
7
+ allowedSchemes?: string[];
8
+ }
9
+ interface TagAttributes {
10
+ [key: string]: string | boolean;
11
+ }
12
+ interface ReplaceTag {
13
+ type: 'replace';
14
+ open: ((attr: string, attrs: TagAttributes) => string) | string;
15
+ close: ((attr: string, attrs: TagAttributes) => string) | string | null;
16
+ }
17
+ interface ContentTag {
18
+ type: 'content';
19
+ replace: ((attr: string, content: string, attrs: TagAttributes) => string) | string;
20
+ }
21
+ interface IgnoreTag {
22
+ type: 'ignore';
23
+ }
24
+ type TagDefinition = ReplaceTag | ContentTag | IgnoreTag;
25
+ interface TagsMap {
26
+ [key: string]: TagDefinition;
27
+ }
28
+ interface TagItem {
29
+ index: number;
30
+ module: string;
31
+ raw: string;
32
+ attr: string;
33
+ attrs: TagAttributes;
34
+ isClosing: boolean;
35
+ matchTag: number | false | null;
36
+ closing?: TagItem;
37
+ children: TagItem[];
38
+ parent: number | null;
39
+ stackIndex?: number;
40
+ }
41
+ declare class yabbcode {
42
+ #private;
43
+ tags: TagsMap;
44
+ regex: {
45
+ tags: RegExp;
46
+ newline: RegExp;
47
+ placeholders: RegExp;
48
+ };
49
+ config: Config;
50
+ contentModules: {
51
+ replace: (tag: TagItem, module: ReplaceTag, content: string) => string;
52
+ content: (tag: TagItem, module: ContentTag, content: string) => string;
53
+ ignore: (tag: TagItem, _module: IgnoreTag, content: string) => string;
54
+ };
55
+ constructor(config?: Config);
56
+ clearTags(): this;
57
+ registerTag(tag: string, options: TagDefinition): this;
58
+ parse(bbcInput: string | number | boolean): string;
59
+ }
60
+ //#endregion
61
+ export { type Config, type ContentTag, type IgnoreTag, type ReplaceTag, type TagAttributes, type TagDefinition, yabbcode as default };
62
+ //# sourceMappingURL=ya-bbcode.d.mts.map