@mlightcad/mtext-parser 1.0.0 → 1.0.1

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.
@@ -0,0 +1,707 @@
1
+ var x = /* @__PURE__ */ ((s) => (s[s.NONE = 0] = "NONE", s[s.WORD = 1] = "WORD", s[s.STACK = 2] = "STACK", s[s.SPACE = 3] = "SPACE", s[s.NBSP = 4] = "NBSP", s[s.TABULATOR = 5] = "TABULATOR", s[s.NEW_PARAGRAPH = 6] = "NEW_PARAGRAPH", s[s.NEW_COLUMN = 7] = "NEW_COLUMN", s[s.WRAP_AT_DIMLINE = 8] = "WRAP_AT_DIMLINE", s[s.PROPERTIES_CHANGED = 9] = "PROPERTIES_CHANGED", s))(x || {}), g = /* @__PURE__ */ ((s) => (s[s.BOTTOM = 0] = "BOTTOM", s[s.MIDDLE = 1] = "MIDDLE", s[s.TOP = 2] = "TOP", s))(g || {}), E = /* @__PURE__ */ ((s) => (s[s.DEFAULT = 0] = "DEFAULT", s[s.LEFT = 1] = "LEFT", s[s.RIGHT = 2] = "RIGHT", s[s.CENTER = 3] = "CENTER", s[s.JUSTIFIED = 4] = "JUSTIFIED", s[s.DISTRIBUTED = 5] = "DISTRIBUTED", s))(E || {}), m = /* @__PURE__ */ ((s) => (s[s.NONE = 0] = "NONE", s[s.UNDERLINE = 1] = "UNDERLINE", s[s.OVERLINE = 2] = "OVERLINE", s[s.STRIKE_THROUGH = 4] = "STRIKE_THROUGH", s))(m || {});
2
+ const b = {
3
+ c: "Ø",
4
+ d: "°",
5
+ p: "±"
6
+ }, w = {
7
+ l: 1,
8
+ r: 2,
9
+ c: 3,
10
+ j: 4,
11
+ d: 5
12
+ /* DISTRIBUTED */
13
+ };
14
+ function I(s) {
15
+ const [e, t, r] = s;
16
+ return r << 16 | t << 8 | e;
17
+ }
18
+ function _(s) {
19
+ const e = s & 255, t = s >> 8 & 255, r = s >> 16 & 255;
20
+ return [e, t, r];
21
+ }
22
+ function S(s) {
23
+ return s.replace(/\^(.)/g, (e, t) => {
24
+ const r = t.charCodeAt(0);
25
+ return r === 32 ? "^" : r === 73 ? " " : r === 74 ? `
26
+ ` : r === 77 ? "" : "▯";
27
+ });
28
+ }
29
+ function F(s) {
30
+ return s.replace(/\r\n|\r|\n/g, "\\P");
31
+ }
32
+ function C(s) {
33
+ return s.replace(/\\P/g, "").replace(/\\~/g, "").includes("\\");
34
+ }
35
+ class N {
36
+ /**
37
+ * Creates a new MTextParser instance
38
+ * @param content - The MText content to parse
39
+ * @param ctx - Optional initial MText context
40
+ * @param yieldPropertyCommands - Whether to yield property change commands
41
+ */
42
+ constructor(e, t, r = !1) {
43
+ this.ctxStack = [], this.continueStroke = !1, this.scanner = new p(S(e)), this.ctx = t ?? new d(), this.yieldPropertyCommands = r, this.decoder = new TextDecoder("gbk");
44
+ }
45
+ /**
46
+ * Decode multi-byte character from hex code
47
+ * @param hex - Hex code string (e.g. "C4E3")
48
+ * @returns Decoded character or empty square if invalid
49
+ */
50
+ decodeMultiByteChar(e) {
51
+ try {
52
+ const t = new Uint8Array([
53
+ parseInt(e.substr(0, 2), 16),
54
+ parseInt(e.substr(2, 2), 16)
55
+ ]);
56
+ return this.decoder.decode(t);
57
+ } catch {
58
+ return "▯";
59
+ }
60
+ }
61
+ /**
62
+ * Push current context onto the stack
63
+ */
64
+ pushCtx() {
65
+ this.ctxStack.push(this.ctx);
66
+ }
67
+ /**
68
+ * Pop context from the stack
69
+ */
70
+ popCtx() {
71
+ this.ctxStack.length > 0 && (this.ctx = this.ctxStack.pop());
72
+ }
73
+ /**
74
+ * Parse stacking expression (numerator/denominator)
75
+ * @returns Tuple of [TokenType.STACK, [numerator, denominator, type]]
76
+ */
77
+ parseStacking() {
78
+ const e = new p(this.extractExpression(!0));
79
+ let t = "", r = "", a = "";
80
+ const n = () => {
81
+ let i = e.peek(), o = !1;
82
+ return i.charCodeAt(0) < 32 && (i = " "), i === "\\" && (o = !0, e.consume(1), i = e.peek()), e.consume(1), [i, o];
83
+ }, c = () => {
84
+ let i = "";
85
+ for (; e.hasData; ) {
86
+ const [o, h] = n();
87
+ if (!h && "^/#".includes(o))
88
+ return [i, o];
89
+ i += o;
90
+ }
91
+ return [i, ""];
92
+ }, l = () => {
93
+ let i = "";
94
+ for (; e.hasData; ) {
95
+ const [o, h] = n();
96
+ h && o === ";" ? i += ";" : i += o;
97
+ }
98
+ return i;
99
+ };
100
+ return [t, a] = c(), a && (r = l()), [2, [t, r, a]];
101
+ }
102
+ /**
103
+ * Parse MText properties
104
+ * @param cmd - The property command to parse
105
+ */
106
+ parseProperties(e) {
107
+ const t = this.ctx.copy();
108
+ switch (e) {
109
+ case "L":
110
+ t.underline = !0, this.continueStroke = !0;
111
+ break;
112
+ case "l":
113
+ t.underline = !1, t.hasAnyStroke || (this.continueStroke = !1);
114
+ break;
115
+ case "O":
116
+ t.overline = !0, this.continueStroke = !0;
117
+ break;
118
+ case "o":
119
+ t.overline = !1, t.hasAnyStroke || (this.continueStroke = !1);
120
+ break;
121
+ case "K":
122
+ t.strikeThrough = !0, this.continueStroke = !0;
123
+ break;
124
+ case "k":
125
+ t.strikeThrough = !1, t.hasAnyStroke || (this.continueStroke = !1);
126
+ break;
127
+ case "A":
128
+ this.parseAlign(t);
129
+ break;
130
+ case "C":
131
+ this.parseAciColor(t);
132
+ break;
133
+ case "c":
134
+ this.parseRgbColor(t);
135
+ break;
136
+ case "H":
137
+ this.parseHeight(t);
138
+ break;
139
+ case "W":
140
+ this.parseWidth(t);
141
+ break;
142
+ case "Q":
143
+ this.parseOblique(t);
144
+ break;
145
+ case "T":
146
+ this.parseCharTracking(t);
147
+ break;
148
+ case "p":
149
+ this.parseParagraphProperties(t);
150
+ break;
151
+ case "f":
152
+ case "F":
153
+ this.parseFontProperties(t);
154
+ break;
155
+ default:
156
+ throw new Error(`Unknown command: ${e}`);
157
+ }
158
+ t.continueStroke = this.continueStroke, this.ctx = t;
159
+ }
160
+ /**
161
+ * Parse alignment property
162
+ * @param ctx - The context to update
163
+ */
164
+ parseAlign(e) {
165
+ const t = this.scanner.get();
166
+ "012".includes(t) ? e.align = parseInt(t) : e.align = 0, this.consumeOptionalTerminator();
167
+ }
168
+ /**
169
+ * Parse height property
170
+ * @param ctx - The context to update
171
+ */
172
+ parseHeight(e) {
173
+ const t = this.extractFloatExpression(!0);
174
+ if (t)
175
+ try {
176
+ t.endsWith("x") ? e.capHeight = Math.abs(parseFloat(t.slice(0, -1))) : e.capHeight = Math.abs(parseFloat(t));
177
+ } catch {
178
+ this.scanner.consume(-t.length);
179
+ return;
180
+ }
181
+ this.consumeOptionalTerminator();
182
+ }
183
+ /**
184
+ * Parse width property
185
+ * @param ctx - The context to update
186
+ */
187
+ parseWidth(e) {
188
+ const t = this.extractFloatExpression(!0);
189
+ if (t)
190
+ try {
191
+ t.endsWith("x") ? e.widthFactor = Math.abs(parseFloat(t.slice(0, -1))) : e.widthFactor = Math.abs(parseFloat(t));
192
+ } catch {
193
+ this.scanner.consume(-t.length);
194
+ return;
195
+ }
196
+ this.consumeOptionalTerminator();
197
+ }
198
+ /**
199
+ * Parse character tracking property
200
+ * @param ctx - The context to update
201
+ */
202
+ parseCharTracking(e) {
203
+ const t = this.extractFloatExpression(!0);
204
+ if (t)
205
+ try {
206
+ t.endsWith("x") ? e.charTrackingFactor = Math.abs(parseFloat(t.slice(0, -1))) : e.charTrackingFactor = Math.abs(parseFloat(t));
207
+ } catch {
208
+ this.scanner.consume(-t.length);
209
+ return;
210
+ }
211
+ this.consumeOptionalTerminator();
212
+ }
213
+ /**
214
+ * Parse float value or factor
215
+ * @param value - Current value to apply factor to
216
+ * @returns New value
217
+ */
218
+ parseFloatValueOrFactor(e) {
219
+ const t = this.extractFloatExpression(!0);
220
+ if (t)
221
+ if (t.endsWith("x")) {
222
+ const r = parseFloat(t.slice(0, -1));
223
+ e *= Math.abs(r);
224
+ } else
225
+ e = Math.abs(parseFloat(t));
226
+ return e;
227
+ }
228
+ /**
229
+ * Parse oblique angle property
230
+ * @param ctx - The context to update
231
+ */
232
+ parseOblique(e) {
233
+ const t = this.extractFloatExpression(!1);
234
+ t && (e.oblique = parseFloat(t)), this.consumeOptionalTerminator();
235
+ }
236
+ /**
237
+ * Parse ACI color property
238
+ * @param ctx - The context to update
239
+ */
240
+ parseAciColor(e) {
241
+ const t = this.extractIntExpression();
242
+ if (t) {
243
+ const r = parseInt(t);
244
+ r < 257 && (e.aci = r, e.rgb = null);
245
+ }
246
+ this.consumeOptionalTerminator();
247
+ }
248
+ /**
249
+ * Parse RGB color property
250
+ * @param ctx - The context to update
251
+ */
252
+ parseRgbColor(e) {
253
+ const t = this.extractIntExpression();
254
+ if (t) {
255
+ const r = parseInt(t) & 16777215, [a, n, c] = _(r);
256
+ e.rgb = [c, n, a];
257
+ }
258
+ this.consumeOptionalTerminator();
259
+ }
260
+ /**
261
+ * Extract float expression from scanner
262
+ * @param relative - Whether to allow relative values (ending in 'x')
263
+ * @returns Extracted expression
264
+ */
265
+ extractFloatExpression(e = !1) {
266
+ const t = e ? /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?x?/ : /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?/, r = this.scanner.tail.match(t);
267
+ if (r) {
268
+ const a = r[0];
269
+ return this.scanner.consume(a.length), a;
270
+ }
271
+ return "";
272
+ }
273
+ /**
274
+ * Extract integer expression from scanner
275
+ * @returns Extracted expression
276
+ */
277
+ extractIntExpression() {
278
+ const e = this.scanner.tail.match(/^\d+/);
279
+ if (e) {
280
+ const t = e[0];
281
+ return this.scanner.consume(t.length), t;
282
+ }
283
+ return "";
284
+ }
285
+ /**
286
+ * Extract expression until semicolon or end
287
+ * @param escape - Whether to handle escaped semicolons
288
+ * @returns Extracted expression
289
+ */
290
+ extractExpression(e = !1) {
291
+ const t = this.scanner.find(";", e);
292
+ if (t < 0) {
293
+ const c = this.scanner.tail;
294
+ return this.scanner.consume(c.length), c;
295
+ }
296
+ const a = this.scanner.peek(t - this.scanner.currentIndex - 1) === "\\", n = this.scanner.tail.slice(0, t - this.scanner.currentIndex + (a ? 1 : 0));
297
+ return this.scanner.consume(n.length + 1), n;
298
+ }
299
+ /**
300
+ * Parse font properties
301
+ * @param ctx - The context to update
302
+ */
303
+ parseFontProperties(e) {
304
+ const t = this.extractExpression().split("|");
305
+ if (t.length > 0 && t[0]) {
306
+ const r = t[0];
307
+ let a = "Regular", n = 400;
308
+ for (const c of t.slice(1))
309
+ c.startsWith("b1") ? n = 700 : c.startsWith("i1") && (a = "Italic");
310
+ e.fontFace = {
311
+ family: r,
312
+ style: a,
313
+ weight: n
314
+ };
315
+ }
316
+ }
317
+ /**
318
+ * Parse paragraph properties from the MText content
319
+ * Handles properties like indentation, alignment, and tab stops
320
+ * @param ctx - The context to update
321
+ */
322
+ parseParagraphProperties(e) {
323
+ const t = new p(this.extractExpression());
324
+ let r = e.paragraph.indent, a = e.paragraph.left, n = e.paragraph.right, c = e.paragraph.align, l = [];
325
+ const i = () => {
326
+ const o = t.tail.match(/^[+-]?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?/);
327
+ if (o) {
328
+ const h = parseFloat(o[0]);
329
+ for (t.consume(o[0].length); t.peek() === ","; )
330
+ t.consume(1);
331
+ return h;
332
+ }
333
+ return 0;
334
+ };
335
+ for (; t.hasData; )
336
+ switch (t.get()) {
337
+ case "i":
338
+ r = i();
339
+ break;
340
+ case "l":
341
+ a = i();
342
+ break;
343
+ case "r":
344
+ n = i();
345
+ break;
346
+ case "x":
347
+ break;
348
+ case "q": {
349
+ const h = t.get();
350
+ for (c = w[h] || 0; t.peek() === ","; )
351
+ t.consume(1);
352
+ break;
353
+ }
354
+ case "t":
355
+ for (l = []; t.hasData; ) {
356
+ const h = t.peek();
357
+ if (h === "r" || h === "c") {
358
+ t.consume(1);
359
+ const u = i();
360
+ l.push(h + u.toString());
361
+ } else {
362
+ const u = i();
363
+ isNaN(u) ? t.consume(1) : l.push(u);
364
+ }
365
+ }
366
+ break;
367
+ }
368
+ e.paragraph = {
369
+ indent: r,
370
+ left: a,
371
+ right: n,
372
+ align: c,
373
+ tab_stops: l
374
+ };
375
+ }
376
+ /**
377
+ * Consume optional terminator (semicolon)
378
+ */
379
+ consumeOptionalTerminator() {
380
+ this.scanner.peek() === ";" && this.scanner.consume(1);
381
+ }
382
+ /**
383
+ * Parse MText content into tokens
384
+ * @yields MTextToken objects
385
+ */
386
+ *parse() {
387
+ let r = null;
388
+ const a = () => {
389
+ var c;
390
+ let n = "";
391
+ for (; this.scanner.hasData; ) {
392
+ let l = !1, i = this.scanner.peek();
393
+ const o = this.scanner.currentIndex;
394
+ if (i.charCodeAt(0) < 32) {
395
+ if (this.scanner.consume(1), i === " ")
396
+ return [5, null];
397
+ if (i === `
398
+ `)
399
+ return [6, null];
400
+ i = " ";
401
+ }
402
+ if (i === "\\")
403
+ if ("\\{}".includes(this.scanner.peek(1)))
404
+ l = !0, this.scanner.consume(1), i = this.scanner.peek();
405
+ else {
406
+ if (n)
407
+ return [1, n];
408
+ this.scanner.consume(1);
409
+ const h = this.scanner.get();
410
+ switch (h) {
411
+ case "~":
412
+ return [4, null];
413
+ case "P":
414
+ return [6, null];
415
+ case "N":
416
+ return [7, null];
417
+ case "X":
418
+ return [8, null];
419
+ case "S":
420
+ return this.parseStacking();
421
+ case "m":
422
+ case "M":
423
+ if (this.scanner.peek() === "+") {
424
+ this.scanner.consume(1);
425
+ const u = (c = this.scanner.tail.match(/^[0-9A-Fa-f]{4}/)) == null ? void 0 : c[0];
426
+ if (u) {
427
+ this.scanner.consume(4);
428
+ const k = this.decodeMultiByteChar(u);
429
+ return n ? [1, n] : [1, k];
430
+ }
431
+ this.scanner.consume(-1);
432
+ }
433
+ n += "\\M";
434
+ continue;
435
+ default:
436
+ if (h)
437
+ try {
438
+ if (this.parseProperties(h), this.yieldPropertyCommands)
439
+ return [
440
+ 9,
441
+ this.scanner.tail.slice(o, this.scanner.currentIndex)
442
+ ];
443
+ continue;
444
+ } catch {
445
+ const u = this.scanner.tail.slice(
446
+ o,
447
+ this.scanner.currentIndex
448
+ );
449
+ n += u;
450
+ }
451
+ }
452
+ continue;
453
+ }
454
+ if (i === "%" && this.scanner.peek(1) === "%") {
455
+ const h = this.scanner.peek(2).toLowerCase(), u = b[h];
456
+ if (u) {
457
+ this.scanner.consume(3), n += u;
458
+ continue;
459
+ } else {
460
+ this.scanner.consume(3);
461
+ continue;
462
+ }
463
+ }
464
+ if (i === " ")
465
+ return n ? (this.scanner.consume(1), r = 3, [1, n]) : (this.scanner.consume(1), [3, null]);
466
+ if (!l) {
467
+ if (i === "{") {
468
+ if (n)
469
+ return [1, n];
470
+ this.scanner.consume(1), this.pushCtx();
471
+ continue;
472
+ } else if (i === "}") {
473
+ if (n)
474
+ return [1, n];
475
+ this.scanner.consume(1), this.popCtx();
476
+ continue;
477
+ }
478
+ }
479
+ this.scanner.consume(1), i.charCodeAt(0) >= 32 && (n += i);
480
+ }
481
+ return n ? [1, n] : [0, null];
482
+ };
483
+ for (; ; ) {
484
+ const [n, c] = a();
485
+ if (n)
486
+ yield new f(n, this.ctx, c), r && (yield new f(r, this.ctx, null), r = null);
487
+ else
488
+ break;
489
+ }
490
+ }
491
+ }
492
+ class p {
493
+ /**
494
+ * Create a new text scanner
495
+ * @param text - The text to scan
496
+ */
497
+ constructor(e) {
498
+ this.text = e, this.textLen = e.length, this._index = 0;
499
+ }
500
+ /**
501
+ * Get the current index in the text
502
+ */
503
+ get currentIndex() {
504
+ return this._index;
505
+ }
506
+ /**
507
+ * Check if the scanner has reached the end of the text
508
+ */
509
+ get isEmpty() {
510
+ return this._index >= this.textLen;
511
+ }
512
+ /**
513
+ * Check if there is more text to scan
514
+ */
515
+ get hasData() {
516
+ return this._index < this.textLen;
517
+ }
518
+ /**
519
+ * Get the next character and advance the index
520
+ * @returns The next character, or empty string if at end
521
+ */
522
+ get() {
523
+ if (this.isEmpty)
524
+ return "";
525
+ const e = this.text[this._index];
526
+ return this._index++, e;
527
+ }
528
+ /**
529
+ * Advance the index by the specified count
530
+ * @param count - Number of characters to advance
531
+ */
532
+ consume(e = 1) {
533
+ this._index = Math.max(0, Math.min(this._index + e, this.textLen));
534
+ }
535
+ /**
536
+ * Look at a character without advancing the index
537
+ * @param offset - Offset from current position
538
+ * @returns The character at the offset position, or empty string if out of bounds
539
+ */
540
+ peek(e = 0) {
541
+ const t = this._index + e;
542
+ return t >= this.textLen || t < 0 ? "" : this.text[t];
543
+ }
544
+ /**
545
+ * Find the next occurrence of a character
546
+ * @param char - The character to find
547
+ * @param escape - Whether to handle escaped characters
548
+ * @returns Index of the character, or -1 if not found
549
+ */
550
+ find(e, t = !1) {
551
+ let r = this._index;
552
+ for (; r < this.textLen; ) {
553
+ if (t && this.text[r] === "\\") {
554
+ if (r + 1 < this.textLen) {
555
+ if (this.text[r + 1] === e)
556
+ return r + 1;
557
+ r += 2;
558
+ continue;
559
+ }
560
+ r++;
561
+ continue;
562
+ }
563
+ if (this.text[r] === e)
564
+ return r;
565
+ r++;
566
+ }
567
+ return -1;
568
+ }
569
+ /**
570
+ * Get the remaining text from the current position
571
+ */
572
+ get tail() {
573
+ return this.text.slice(this._index);
574
+ }
575
+ /**
576
+ * Check if the next character is a space
577
+ */
578
+ isNextSpace() {
579
+ return this.peek() === " ";
580
+ }
581
+ /**
582
+ * Consume spaces until a non-space character is found
583
+ * @returns Number of spaces consumed
584
+ */
585
+ consumeSpaces() {
586
+ let e = 0;
587
+ for (; this.isNextSpace(); )
588
+ this.consume(), e++;
589
+ return e;
590
+ }
591
+ }
592
+ class d {
593
+ constructor() {
594
+ this._stroke = 0, this.continueStroke = !1, this._aci = 7, this.rgb = null, this.align = 0, this.fontFace = { family: "", style: "Regular", weight: 400 }, this.capHeight = 1, this.widthFactor = 1, this.charTrackingFactor = 1, this.oblique = 0, this.paragraph = {
595
+ indent: 0,
596
+ left: 0,
597
+ right: 0,
598
+ align: 0,
599
+ tab_stops: []
600
+ };
601
+ }
602
+ /**
603
+ * Get the ACI color value
604
+ */
605
+ get aci() {
606
+ return this._aci;
607
+ }
608
+ /**
609
+ * Set the ACI color value
610
+ * @param value - ACI color value (0-256)
611
+ * @throws Error if value is out of range
612
+ */
613
+ set aci(e) {
614
+ if (e >= 0 && e <= 256)
615
+ this._aci = e, this.rgb = null;
616
+ else
617
+ throw new Error("ACI not in range [0, 256]");
618
+ }
619
+ /**
620
+ * Get whether text is underlined
621
+ */
622
+ get underline() {
623
+ return !!(this._stroke & 1);
624
+ }
625
+ /**
626
+ * Set whether text is underlined
627
+ * @param value - Whether to underline
628
+ */
629
+ set underline(e) {
630
+ this._setStrokeState(1, e);
631
+ }
632
+ /**
633
+ * Get whether text has strike-through
634
+ */
635
+ get strikeThrough() {
636
+ return !!(this._stroke & 4);
637
+ }
638
+ /**
639
+ * Set whether text has strike-through
640
+ * @param value - Whether to strike through
641
+ */
642
+ set strikeThrough(e) {
643
+ this._setStrokeState(4, e);
644
+ }
645
+ /**
646
+ * Get whether text has overline
647
+ */
648
+ get overline() {
649
+ return !!(this._stroke & 2);
650
+ }
651
+ /**
652
+ * Set whether text has overline
653
+ * @param value - Whether to overline
654
+ */
655
+ set overline(e) {
656
+ this._setStrokeState(2, e);
657
+ }
658
+ /**
659
+ * Check if any stroke formatting is active
660
+ */
661
+ get hasAnyStroke() {
662
+ return !!this._stroke;
663
+ }
664
+ /**
665
+ * Set the state of a stroke type
666
+ * @param stroke - The stroke type to set
667
+ * @param state - Whether to enable or disable the stroke
668
+ */
669
+ _setStrokeState(e, t = !0) {
670
+ t ? this._stroke |= e : this._stroke &= ~e;
671
+ }
672
+ /**
673
+ * Create a copy of this context
674
+ * @returns A new context with the same properties
675
+ */
676
+ copy() {
677
+ const e = new d();
678
+ return e._stroke = this._stroke, e.continueStroke = this.continueStroke, e._aci = this._aci, e.rgb = this.rgb, e.align = this.align, e.fontFace = { ...this.fontFace }, e.capHeight = this.capHeight, e.widthFactor = this.widthFactor, e.charTrackingFactor = this.charTrackingFactor, e.oblique = this.oblique, e.paragraph = { ...this.paragraph }, e;
679
+ }
680
+ }
681
+ class f {
682
+ /**
683
+ * Create a new MText token
684
+ * @param type - The token type
685
+ * @param ctx - The text context at this token
686
+ * @param data - Optional token data
687
+ */
688
+ constructor(e, t, r) {
689
+ this.type = e, this.ctx = t, this.data = r;
690
+ }
691
+ }
692
+ export {
693
+ d as MTextContext,
694
+ g as MTextLineAlignment,
695
+ E as MTextParagraphAlignment,
696
+ N as MTextParser,
697
+ m as MTextStroke,
698
+ f as MTextToken,
699
+ p as TextScanner,
700
+ x as TokenType,
701
+ S as caretDecode,
702
+ F as escapeDxfLineEndings,
703
+ C as hasInlineFormattingCodes,
704
+ _ as int2rgb,
705
+ I as rgb2int
706
+ };
707
+ //# sourceMappingURL=parser.es.js.map