textmode.figlet.js 1.0.2 → 1.0.3-beta.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.
Files changed (36) hide show
  1. package/README.md +73 -134
  2. package/dist/textmode.figlet.esm.js +1 -1
  3. package/dist/textmode.figlet.umd.js +1 -1
  4. package/dist/types/augmentations/index.d.ts +0 -1
  5. package/dist/types/augmentations/textmode.d.ts +2 -1
  6. package/dist/types/error/FigletError.d.ts +0 -1
  7. package/dist/types/extensions/index.d.ts +0 -1
  8. package/dist/types/extensions/textmodifier.d.ts +0 -1
  9. package/dist/types/figfont/FigFontParser.d.ts +0 -1
  10. package/dist/types/figfont/FigLayoutEngine.d.ts +0 -1
  11. package/dist/types/figfont/FigSmushRules.d.ts +0 -1
  12. package/dist/types/figfont/TextmodeFigFont.d.ts +2 -1
  13. package/dist/types/figfont/index.d.ts +0 -1
  14. package/dist/types/figfont/types.d.ts +24 -1
  15. package/dist/types/index.d.ts +40 -2
  16. package/dist/types/plugin/FigletPlugin.d.ts +2 -1
  17. package/dist/types/plugin/index.d.ts +0 -1
  18. package/dist/types/state/figletState.d.ts +0 -1
  19. package/dist/types/utils/Disposable.d.ts +0 -1
  20. package/package.json +84 -48
  21. package/dist/types/augmentations/index.d.ts.map +0 -1
  22. package/dist/types/augmentations/textmode.d.ts.map +0 -1
  23. package/dist/types/error/FigletError.d.ts.map +0 -1
  24. package/dist/types/extensions/index.d.ts.map +0 -1
  25. package/dist/types/extensions/textmodifier.d.ts.map +0 -1
  26. package/dist/types/figfont/FigFontParser.d.ts.map +0 -1
  27. package/dist/types/figfont/FigLayoutEngine.d.ts.map +0 -1
  28. package/dist/types/figfont/FigSmushRules.d.ts.map +0 -1
  29. package/dist/types/figfont/TextmodeFigFont.d.ts.map +0 -1
  30. package/dist/types/figfont/index.d.ts.map +0 -1
  31. package/dist/types/figfont/types.d.ts.map +0 -1
  32. package/dist/types/index.d.ts.map +0 -1
  33. package/dist/types/plugin/FigletPlugin.d.ts.map +0 -1
  34. package/dist/types/plugin/index.d.ts.map +0 -1
  35. package/dist/types/state/figletState.d.ts.map +0 -1
  36. package/dist/types/utils/Disposable.d.ts.map +0 -1
package/README.md CHANGED
@@ -1,166 +1,105 @@
1
- # textmode.figlet.js (✿◠‿◠)
1
+ # textmode.figlet.js
2
2
 
3
3
  <div align="center">
4
4
 
5
- <table>
6
- <tr>
7
- <td align="center">
8
- <a href="https://www.typescriptlang.org/"><img alt="TypeScript badge" src="https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white" /></a>&nbsp;<a href="https://vitejs.dev/"><img alt="Vite badge" src="https://img.shields.io/badge/Vite-646CFF?logo=vite&logoColor=white" /></a>&nbsp;<a href="http://www.figlet.org/"><img alt="FIGlet badge" src="https://img.shields.io/badge/FIGlet-111111" /></a>
9
- </td>
10
- <td align="center">
11
- <a href="https://code.textmode.art/"><img alt="docs badge" src="https://img.shields.io/badge/docs-vitepress-646cff?logo=vitepress&logoColor=white" /></a>&nbsp;<a href="https://discord.gg/sjrw8QXNks"><img alt="Discord badge" src="https://img.shields.io/discord/1357070706181017691?color=5865F2&label=Discord&logo=discord&logoColor=white" /></a>
12
- </td>
13
- <td align="center">
14
- <a href="https://ko-fi.com/V7V8JG2FY"><img alt="Ko-fi badge" src="https://shields.io/badge/ko--fi-donate-ff5f5f?logo=ko-fi" /></a>&nbsp;<a href="https://github.com/sponsors/humanbydefinition"><img alt="GitHub Sponsors badge" src="https://img.shields.io/badge/sponsor-30363D?logo=GitHub-Sponsors&logoColor=%23EA4AAA" /></a>
15
- </td>
16
- </tr>
17
- </table>
18
-
19
- </div>
20
-
21
- `textmode.figlet.js` is an add-on library for `textmode.js` that provides FIGlet / FIGfont support. It includes a FIGfont parser, layout engine, and rendering API that integrates with the `Textmodifier` system in `textmode.js`, allowing you to draw FIGlet text with configurable layout behavior and measurement helpers.
22
-
23
- ## Features
24
-
25
- - Parse raw `.flf` sources into reusable `TextmodeFigFont` instances
26
- - Load FIGfonts at runtime with `loadFigFont()`
27
- - Draw FIGlet text with configurable horizontal and vertical layout behavior
28
- - Measure rendered output with width, height, and bounds helpers before drawing
29
- - Store alignment and baseline preferences per `Textmodifier` instance
30
-
31
- ## Installation
32
-
33
- ### Prerequisites
34
-
35
- To get started with `textmode.figlet.js`, you'll need:
36
-
37
- - `textmode.js` `0.11.0` or newer
38
- - A modern browser with the same runtime requirements as `textmode.js`
39
- - Node.js `20.8.1+` and `npm` (optional, for ESM installation)
40
-
41
- ### UMD
42
-
43
- To use `textmode.figlet.js` in a browser without a bundler, load the UMD builds for both `textmode.js` and this add-on. `textmode.js` must be loaded first so the FIGlet add-on can attach to the expected global runtime.
44
-
45
- ```html
46
- <!doctype html>
47
- <html lang="en">
48
- <head>
49
- <meta charset="utf-8" />
50
- <title>textmode.figlet.js sketch</title>
5
+ <img alt="textmode.figlet.js — draw FIGlet in textmode" src=".github/assets/readme-og.png" />
51
6
 
52
- <script src="https://cdn.jsdelivr.net/npm/textmode.js@latest/dist/textmode.umd.js"></script>
53
- <script src="https://cdn.jsdelivr.net/npm/textmode.figlet.js@latest/dist/textmode.figlet.umd.js"></script>
54
- </head>
55
- <body>
56
- <script src="./sketch.js"></script>
57
- </body>
58
- </html>
59
- ```
7
+ | [![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/) [![Vite](https://img.shields.io/badge/Vite-646CFF?logo=vite&logoColor=white)](https://vitejs.dev/) | [![API](https://img.shields.io/badge/API-typedoc-3178c6?logo=typescript&logoColor=white)](https://code.textmode.art/api/textmode.figlet.js/) [![docs](https://img.shields.io/badge/docs-vitepress-646cff?logo=vitepress&logoColor=white)](https://code.textmode.art/) [![Discord](https://img.shields.io/discord/1357070706181017691?color=5865F2&label=Discord&logo=discord&logoColor=white)](https://discord.gg/sjrw8QXNks) | [![ko-fi](https://shields.io/badge/ko--fi-donate-ff5f5f?logo=ko-fi)](https://ko-fi.com/V7V8JG2FY) [![GitHub-sponsors](https://img.shields.io/badge/sponsor-30363D?logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/humanbydefinition) |
8
+ |:---|:---|:---|
60
9
 
61
- ```js
62
- const t = textmode.create({
63
- width: window.innerWidth,
64
- height: window.innerHeight,
65
- fontSize: 16,
66
- plugins: [FigletPlugin],
67
- });
68
-
69
- t.setup(async () => {
70
- const bulbhead = await t.loadFigFont('https://cdn.jsdelivr.net/gh/xero/figlet-fonts@master/Bulbhead.flf');
71
-
72
- t.figFont(bulbhead);
73
- t.figTextAlign('center');
74
- t.figTextBaseline('center');
75
- });
76
-
77
- t.draw(() => {
78
- t.background(8, 12, 24);
79
- t.charColor(255, 220, 120);
80
- t.figText('FIGLET', 0, 0, {
81
- horizontalLayout: 'fitted',
82
- });
83
- });
84
-
85
- t.windowResized(() => {
86
- t.resizeCanvas(window.innerWidth, window.innerHeight);
87
- });
88
- ```
89
-
90
- The UMD bundle exposes `FigletPlugin` globally, along with the other runtime exports such as `TextmodeFigFont` and `FigFontParser`.
10
+ </div>
91
11
 
92
- ### ESM
12
+ `textmode.figlet.js` is a FIGlet and FIGfont add-on for [`textmode.js`](https://github.com/humanbydefinition/textmode.js) for giving a sketch bold display typography. Its FIGfont parser, layout engine, and rendering API work with the core `Textmodifier` system to load, measure, and draw large text with configurable horizontal and vertical layout behavior.
93
13
 
94
- Install the core library and the FIGlet add-on together:
14
+ FIGlet text needs more than a font file: fitting, smushing, direction, and placement all shape the final composition. Whether you are setting those rules or positioning a title precisely within a scene, `textmode.figlet.js` provides clear helpers for rendering, alignment, baselines, and bounds.
95
15
 
96
- ```bash
97
- npm install textmode.js textmode.figlet.js
98
- ```
16
+ ## Features
99
17
 
100
- Then import both packages in your sketch or application code:
18
+ - **FIGfont loading and parsing** - Load `.flf` files from URLs or parse raw data with metadata and Unicode character access
19
+ - **Standards-aware layout** - Full-width, fitted, and smushed horizontal and vertical layouts with FIGlet smushing rules
20
+ - **Multiline wrapping** - Explicit line breaks plus word and character wrapping within configurable column limits
21
+ - **Bidirectional rendering** - Respect font-defined direction or explicitly render left-to-right and right-to-left text
22
+ - **textmode-native drawing** - Draw through `Textmodifier` with alignment, baseline, and per-cell foreground/background styling
23
+ - **Planning and measurement** - Generate render plans or grids and calculate width, height, and bounds without drawing
101
24
 
102
- ```ts
103
- import { textmode } from 'textmode.js';
104
- import { FigletPlugin } from 'textmode.figlet.js';
105
- ```
25
+ ## Try it online first
106
26
 
107
- Importing `textmode.figlet.js` provides the TypeScript augmentation. Installing `FigletPlugin` enables the runtime FIGlet methods on that `Textmodifier` instance.
27
+ Open [editor.textmode.art](https://editor.textmode.art/), a browser-based live-coding environment for the
28
+ complete official `textmode.js` ecosystem. Sketches run as you edit, with no local toolchain required.
108
29
 
109
- ## Plugin setup
30
+ The editor includes `textmode.js` and all four official add-ons: `textmode.export.js`, `textmode.filters.js`,
31
+ `textmode.figlet.js`, and `textmode.synth.js`.
110
32
 
111
- ```ts
112
- import { textmode } from 'textmode.js';
113
- import { FigletPlugin } from 'textmode.figlet.js';
33
+ - Write with Monaco-powered completions, hover documentation, and diagnostics.
34
+ - Start with a blank sketch, an included example, or a community gallery sketch.
35
+ - Keep code and preferences saved in the browser, then share sketches through URL-based links.
36
+ - Use microphone or line-input analysis for audio-reactive work, and create on desktop or mobile.
114
37
 
115
- const t = textmode.create({
116
- width: 800,
117
- height: 600,
118
- plugins: [FigletPlugin],
119
- });
120
- ```
38
+ Use it to load and render FIGlet fonts while you iterate on a sketch.
121
39
 
122
- The plugin installs the FIGlet drawing and measurement API during setup and removes it again if the plugin is uninstalled.
40
+ ## Installation
123
41
 
124
- ## Loading `.flf` fonts
42
+ Follow the [official installation guide](https://code.textmode.art/docs/installation) to install
43
+ `textmode.figlet.js` alongside `textmode.js` with npm or browser-ready UMD bundles.
125
44
 
126
- ```ts
127
- const bulbhead = await t.loadFigFont('https://cdn.jsdelivr.net/gh/xero/figlet-fonts@master/Bulbhead.flf');
45
+ ## Next steps
128
46
 
129
- t.figFont(bulbhead);
47
+ - **[Read the documentation](https://code.textmode.art/)** for core concepts and plugin workflows.
48
+ - **[Browse the API reference](https://code.textmode.art/api/textmode.figlet.js/)** for the complete FIGfont and rendering API.
49
+ - **[Explore the examples](./examples/)** to see font loading, layout, and rendering patterns in action.
50
+ - **[Try the live editor](https://editor.textmode.art/)** to experiment with FIGlet text in the browser.
130
51
 
131
- const custom = t.parseFigFont('Custom', figFontSource);
132
- ```
52
+ ## Contributing
133
53
 
134
- Any CORS-enabled `.flf` URL works for runtime loading.
54
+ Thank you for considering contributing to this project! (✿◠‿◠)
135
55
 
136
- ## Drawing and measuring text
56
+ Please read the [Contributing Guide](./CONTRIBUTING.md) to get started.
137
57
 
138
- ```ts
139
- t.figTextAlign('center');
140
- t.figTextBaseline('center');
58
+ <!-- TEXTMODE-CONTRIBUTORS:START -->
59
+ <!-- prettier-ignore-start -->
60
+ <!-- Generated from https://github.com/humanbydefinition/code.textmode.art/blob/main/.vitepress/data/contributors.json and https://github.com/humanbydefinition/code.textmode.art/blob/main/.vitepress/data/contribution-types.json. Do not edit this section directly. -->
61
+ ## Contributors
141
62
 
142
- t.figText('HELLO', 0, 0, {
143
- horizontalLayout: 'fitted',
144
- });
63
+ Thanks to the people who contribute code, documentation, design, examples, ideas, infrastructure, and care
64
+ across the textmode.js ecosystem.
145
65
 
146
- const width = t.figTextWidth('HELLO');
147
- const height = t.figTextHeight('HELLO');
148
- const bounds = t.figTextBounds('HELLO');
149
- ```
66
+ <!-- markdownlint-disable MD033 -->
67
+ <table>
68
+ <tbody>
69
+ <tr>
70
+ <td align="center" valign="top" width="14.28%">
71
+ <a href="https://github.com/humanbydefinition">
72
+ <img src="https://github.com/humanbydefinition.png?s=100" width="100px" alt="humanbydefinition avatar" />
73
+ <br /><sub><b>humanbydefinition</b></sub>
74
+ </a>
75
+ <br /><span title="Code: Commits and pull requests" aria-label="Code: Commits and pull requests">💻</span> <span title="Documentation: README, guides, and API documentation" aria-label="Documentation: README, guides, and API documentation">📖</span> <span title="Design: User experience, branding, and visual design" aria-label="Design: User experience, branding, and visual design">🎨</span> <span title="Examples: Usage examples and creative sketches" aria-label="Examples: Usage examples and creative sketches">💡</span> <span title="Ideas and planning: Feature proposals, planning, and feedback" aria-label="Ideas and planning: Feature proposals, planning, and feedback">🤔</span> <span title="Maintenance: Refactoring and project upkeep" aria-label="Maintenance: Refactoring and project upkeep">🚧</span> <span title="Infrastructure: Continuous integration, hosting, and build systems" aria-label="Infrastructure: Continuous integration, hosting, and build systems">🚇</span> <span title="Tools: Developer and community tooling" aria-label="Tools: Developer and community tooling">🔧</span> <span title="Plugins and libraries: Plugin and utility library development" aria-label="Plugins and libraries: Plugin and utility library development">🔌</span> <span title="Code review: Reviewing pull requests" aria-label="Code review: Reviewing pull requests">👀</span>
76
+ </td>
77
+ <td align="center" valign="top" width="14.28%">
78
+ <a href="https://github.com/trintlermint">
79
+ <img src="https://github.com/trintlermint.png?s=100" width="100px" alt="trintlermint avatar" />
80
+ <br /><sub><b>trintlermint</b></sub>
81
+ </a>
82
+ <br /><span title="Design: User experience, branding, and visual design" aria-label="Design: User experience, branding, and visual design">🎨</span> <span title="Examples: Usage examples and creative sketches" aria-label="Examples: Usage examples and creative sketches">💡</span>
83
+ </td>
84
+ </tr>
85
+ </tbody>
86
+ </table>
87
+ <!-- markdownlint-enable MD033 -->
150
88
 
151
- Use the measurement helpers when you need to position FIGlet text precisely before rendering it.
89
+ Contribution details and profile links are maintained on the [textmode.js contributors page](https://code.textmode.art/docs/contributors).
90
+ <!-- prettier-ignore-end -->
91
+ <!-- TEXTMODE-CONTRIBUTORS:END -->
152
92
 
153
- ## Alignment and baseline
93
+ ## License
154
94
 
155
- - `figTextAlign('left' | 'center' | 'right')`
156
- - `figTextBaseline('top' | 'center' | 'baseline' | 'bottom')`
95
+ `textmode.figlet.js` is licensed under the [MIT License](./LICENSE).
157
96
 
158
- These settings are stored in plugin-owned state per `Textmodifier` instance and apply to subsequent `figText()` calls until changed.
97
+ ---
159
98
 
160
- ## Next steps
99
+ <div align="center">
161
100
 
162
- Visit the `textmode.js` documentation at [code.textmode.art](https://code.textmode.art/) for broader library guides and API reference, then use the local examples in this package to validate your FIGlet setup and rendering behavior.
101
+ <br />
163
102
 
164
- ## License
103
+ **[↑ back to top](#textmodefigletjs)**
165
104
 
166
- `textmode.figlet.js` is licensed under the MIT License.
105
+ </div>
@@ -1 +1 @@
1
- var t=Object.defineProperty,e=(e,n,r)=>((e,n,r)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r)(e,"symbol"!=typeof n?n+"":n,r);import{color as n}from"textmode.js";class r extends Error{constructor(t,e){super(r.formatMessage(t,e)),this.name="FigletError"}static formatMessage(t,e){if(!e||0===Object.keys(e).length)return t;return`${t}\n\nContext:${Object.entries(e).map(([t,e])=>`\n - ${t}: ${r.formatValue(e)}`).join("")}`}static formatValue(t){return null===t?"null":void 0===t?"undefined":"string"==typeof t?`"${t}"`:"number"==typeof t||"boolean"==typeof t?t+"":Array.isArray(t)?`[${t.map(t=>r.formatValue(t)).join(", ")}]`:"object"==typeof t?JSON.stringify(t):t+""}}const i=[...Array.from({length:95},(t,e)=>e+32),196,214,220,228,246,252,223];class s{static t(t){if(0===t.length)throw new r("Cannot parse an empty FIGfont file.");const e=t.replace(/\r\n?/g,"\n").split("\n"),n=e[0];if(!n)throw new r("Missing FIGfont header line.");const i=this.i(n);let s=1+i.commentLines;if(s>e.length)throw new r("FIGfont comment line count exceeds file length.",{commentLines:i.commentLines,totalLines:e.length});const o=new Map;return s=this.o(e,s,i,o),this.l(e,s,i,o),{header:i,characters:o}}static i(t){const e=t.trim().split(/\s+/),n=e[0]??"";if(n.length<6)throw new r("Invalid FIGfont header token.",{headerToken:n});const i=n.slice(0,5),s=n.slice(5);if("flf2a"!==i)throw new r("Unsupported FIGfont signature.",{signature:i});if(1!==s.length)throw new r("FIGfont hardblank must be a single character.",{hardblank:s});if(e.length<6)throw new r("Incomplete FIGfont header.",{headerLine:t});return{signature:i,hardblank:s,height:this.u(e[1],"height"),baseline:this.u(e[2],"baseline"),maxLength:this.u(e[3],"maxLength"),oldLayout:this.u(e[4],"oldLayout"),commentLines:this.u(e[5],"commentLines"),printDirection:this.u(e[6]??"0","printDirection"),fullLayout:this.u(e[7]??"0","fullLayout"),codetagCount:this.u(e[8]??"0","codetagCount")}}static o(t,e,n,r){let s=e;for(const e of i){const i=this.h(t,s,n.height,e);r.set(e,i),s+=n.height}return s}static l(t,e,n,r){var i;let s=e;for(;s<t.length;){const e=(null==(i=t[s])?void 0:i.trim())??"";if(0===e.length){s+=1;continue}const o=this._(e);s+=1;const a=this.h(t,s,n.height,o);r.set(o,a),s+=n.height}}static h(t,e,n,i){if(e+n>t.length)throw new r("Unexpected end of FIGfont character data.",{codePoint:i,startIndex:e,height:n,totalLines:t.length});const s=[];let o=0;for(let a=0;a<n;a+=1){const n=t[e+a]??"";if(0===n.length)throw new r("Encountered an empty FIGcharacter row.",{codePoint:i,row:a,startIndex:e});const l=n.at(-1);if(!l)throw new r("Failed to determine FIGcharacter endmark.",{codePoint:i,row:a});const c=n.replace(RegExp(this.escapeForRegExp(l)+"+$"),"");s.push(c),o=Math.max(o,c.length)}return{code:i,lines:s,width:o}}static _(t){const e=t.split(/\s+/,1)[0];if(/^[-+]?0x[0-9a-f]+$/i.test(e))return Number.parseInt(e,16);if(/^[-+]?0[0-7]+$/.test(e))return Number.parseInt(e,8);if(/^[-+]?\d+$/.test(e))return Number.parseInt(e,10);throw new r("Invalid FIGfont code tag.",{codetagLine:t})}static u(t,e){if(!/^-?\d+$/.test(t))throw new r("Invalid FIGfont header value.",{field:e,token:t});return Number.parseInt(t,10)}static escapeForRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}}class o{static p(t){return 0!==t.fullLayout?63&t.fullLayout:t.oldLayout>0?63&t.oldLayout:0}static m(t){return 7936&t.fullLayout}static I(t,e,n,r){return" "===t?e:" "===e?t:0===r?this.v(t,e,n):(0!==(r&this.RULE_EQUAL_CHARACTER)?this.L(t,e,n):null)??(0!==(r&this.RULE_UNDERSCORE)?this.C(t,e):null)??(0!==(r&this.RULE_HIERARCHY)?this.R(t,e):null)??(0!==(r&this.RULE_OPPOSITE_PAIR)?this.F(t,e):null)??(0!==(r&this.RULE_BIG_X)?this.A(t,e):null)??(0!==(r&this.RULE_HARDBLANK)?this.T(t,e,n):null)}static v(t,e,n){return" "===t?e:" "===e?t:e}static U(t,e,n){return" "===t?e:" "===e?t:0===n?this.v(t,e," "):(0!==(n&this.VERTICAL_RULE_EQUAL_CHARACTER)?this.L(t,e," "):null)??(0!==(n&this.VERTICAL_RULE_UNDERSCORE)?this.C(t,e):null)??(0!==(n&this.VERTICAL_RULE_HIERARCHY)?this.R(t,e):null)??(0!==(n&this.VERTICAL_RULE_HORIZONTAL_LINE)?this.H(t,e):null)??(0!==(n&this.VERTICAL_RULE_VERTICAL_LINE_SUPERSMUSH)?this.S(t,e):null)}static L(t,e,n){return t===e&&t!==n?t:null}static C(t,e){const n="|/\\[]{}()<>";return"_"===t&&n.includes(e)?e:"_"===e&&n.includes(t)?t:null}static R(t,e){const n=["|","/\\","[]","{}","()","<>"],r=n.findIndex(e=>e.includes(t)),i=n.findIndex(t=>t.includes(e));return-1===r||-1===i||r===i?null:r>i?t:e}static F(t,e){return["[]","][","{}","}{","()",")("].includes(`${t}${e}`)?"|":null}static A(t,e){const n=`${t}${e}`;return"/\\"===n?"|":"\\/"===n?"Y":"><"===n?"X":null}static T(t,e,n){return t===n&&e===n?n:null}static H(t,e){const n=`${t}${e}`;return"-_"===n||"_-"===n?"=":null}static S(t,e){return"|"===t&&"|"===e?"|":null}}e(o,"RULE_EQUAL_CHARACTER",1),e(o,"RULE_UNDERSCORE",2),e(o,"RULE_HIERARCHY",4),e(o,"RULE_OPPOSITE_PAIR",8),e(o,"RULE_BIG_X",16),e(o,"RULE_HARDBLANK",32),e(o,"VERTICAL_RULE_EQUAL_CHARACTER",256),e(o,"VERTICAL_RULE_UNDERSCORE",512),e(o,"VERTICAL_RULE_HIERARCHY",1024),e(o,"VERTICAL_RULE_HORIZONTAL_LINE",2048),e(o,"VERTICAL_RULE_VERTICAL_LINE_SUPERSMUSH",4096);class a{constructor(t){e(this,"_header"),e(this,"_horizontalRuleMask"),e(this,"_verticalRuleMask"),this.$=t,this.k=o.p(t),this.M=o.m(t)}O(t,e){const n=t.map((t,e)=>({inputIndex:e,inputChar:String.fromCodePoint(t.code)})),r=this.G(t,n,e,0),i=Array.from({length:r.rows},()=>Array.from({length:r.cols},()=>" "));for(const t of r.cells)i[t.row][t.col]=t.char;return i}G(t,e,n,r){if(0===t.length)return{lineIndex:r,cells:[],cols:0,rows:this.$.height};let i=this.N(t[0],e[0],r),s=t[0].width;for(let a=1;a<t.length;a+=1){const l=t[a],c=e[a]??{inputIndex:a,inputChar:String.fromCodePoint(l.code)},u=s-this.P(i,s,l,n),h=Math.max(s,u+l.width),f=i.map(t=>Array.from({length:h},(e,n)=>t[n]));for(let t=0;t<this.$.height;t+=1){const e=l.lines[t]??"",n=f[t];for(let i=0;i<l.width;i+=1){const s=e[i]??" ";if(" "===s)continue;const a=u+i,h=n[a],f=this.V(a,t,i,r,l,c,s);if(!h){n[a]=f;continue}const d=o.I(h.char,s,this.$.hardblank,this.k);n[a]=this.D(h,f,d??s)}}i=f,s=h}return this.B(i,s,r)}j(t,e){var n;if(0===t.length)return{cells:[],lines:[],cols:0,rows:0};let r=this.W(t[0]),i=t[0].cols,s=t[0].rows;const a=[this.q(t[0],0)];for(let l=1;l<t.length;l+=1){const c=t[l],u=s-this.X(r,s,i,c,e),h=Math.max(i,c.cols),f=Math.max(s,u+c.rows),d=Array.from({length:f},(t,e)=>Array.from({length:h},(t,n)=>{var i;return null==(i=r[e])?void 0:i[n]}));for(const t of c.cells){const e=u+t.row,r=t.col,i=null==(n=d[e])?void 0:n[r];if(!i){d[e][r]={...t,row:e};continue}const s=o.U(i.char,t.char,this.M);d[e][r]=this.D(i,{...t,row:e},s??t.char)}r=d,i=h,s=f,a.push(this.q(c,u))}return this.Y(r,i,s,a)}P(t,e,n,r){var i;if("full"===r)return 0;for(let s=e;s>=0;s-=1){let o=!0;for(let a=0;a<this.$.height&&o;a+=1){const l=t[a]??[],c=n.lines[a]??"";for(let t=0;t<s;t+=1){const n=(null==(i=l[e-s+t])?void 0:i.char)??" ",a=c[t]??" ";if(!this.J(n,a,r)){o=!1;break}}}if(o)return s}return 0}J(t,e,n){return" "===t||" "===e||"fitted"!==n&&null!==o.I(t,e,this.$.hardblank,this.k)}N(t,e={inputIndex:0,inputChar:String.fromCodePoint(t.code)},n=0){return Array.from({length:this.$.height},(r,i)=>{const s=t.lines[i]??"";return Array.from({length:t.width},(r,o)=>{const a=s[o]??" ";return" "===a?void 0:this.V(o,i,o,n,t,e,a)})})}V(t,e,n,r,i,s,o){return{char:o,col:t,row:e,inputIndex:s.inputIndex,inputChar:s.inputChar,figCharCode:i.code,subRow:e,subCol:n,lineIndex:r}}D(t,e,n){return n===t.char?t:{...e,char:n}}B(t,e,n){const r=[];for(let i=0;i<this.$.height;i+=1){const s=t[i]??[];for(let t=0;t<e;t+=1){const e=s[t];!e||e.char===this.$.hardblank||r.push({...e,col:t,row:i,lineIndex:n})}}return{lineIndex:n,cells:r,cols:e,rows:this.$.height}}X(t,e,n,r,i){var s,o;if("full"===i)return 0;const a=this.W(r),l=Math.min(e,r.rows),c=Math.max(n,r.cols);for(let n=l;n>=0;n-=1){let r=!0;for(let l=0;l<n&&r;l+=1){const u=t[e-n+l]??[],h=a[l]??[];for(let t=0;t<c;t+=1){const e=(null==(s=u[t])?void 0:s.char)??" ",n=(null==(o=h[t])?void 0:o.char)??" ";if(!this.K(e,n,i)){r=!1;break}}}if(r)return n}return 0}K(t,e,n){return" "===t||" "===e||"fitted"!==n&&null!==o.U(t,e,this.M)}W(t){const e=Array.from({length:t.rows},()=>Array.from({length:t.cols},()=>{}));for(const n of t.cells)e[n.row][n.col]=n;return e}q(t,e){return{...t,cells:t.cells.map(t=>({...t,row:t.row+e}))}}Y(t,e,n,r){var i;const s=[];for(let r=0;r<n;r+=1)for(let n=0;n<e;n+=1){const e=null==(i=t[r])?void 0:i[n];e&&s.push({...e,row:r,col:n})}return{cells:s,lines:r,cols:e,rows:n}}}class l{constructor(){e(this,"_onDisposeCallbacks",new Set)}Z(t){this.tt.add(t)}dispose(){for(const t of this.tt)t();this.tt.clear()}}class c extends l{constructor(t,n,r){super(),e(this,"_name"),e(this,"_header"),e(this,"_characters"),e(this,"_layoutEngine"),this.et=t,this.$=n,this.nt=r,this.rt=new a(n)}static async it(t){const e=await fetch(t);if(!e.ok)throw new r("Failed to load FIGfont file.",{source:t+"",status:e.status,statusText:e.statusText});const n=await e.text();return this.st(this.ot(t),n)}static st(t,e){const n=s.t(e);return new c(t,n.header,n.characters)}getCharacter(t){var e;const n="number"==typeof t?t:null==(e=Array.from(t)[0])?void 0:e.codePointAt(0);if(void 0!==n)return u(this.nt.get(n))}planText(t,e={}){const n=e.horizontalLayout??this.defaultLayout,r=e.verticalLayout??this.defaultVerticalLayout,i=this.lt(e.direction),s=this.ct(t).map(t=>this.ut(t,i)).flatMap(t=>this.ht(t,n,e)).map((t,e)=>{const r=this.ft(t);return this.rt.G(r.map(t=>t.figChar),r.map(({inputChar:t,inputIndex:e})=>({inputChar:t,inputIndex:e})),n,e)}),o=this.rt.j(s,r);return{cells:o.cells,lines:o.lines,cols:o.cols,rows:o.rows,direction:i}}renderText(t,e={}){const n=this.planText(t,e),r=Array.from({length:n.rows},()=>Array.from({length:n.cols},()=>" "));for(const t of n.cells)r[t.row][t.col]=t.char;return{grid:r,cols:n.cols,rows:n.rows}}measureText(t,e={}){const n=this.planText(t,e);return{cols:n.cols,rows:n.rows}}get name(){return this.et}get header(){return{...this.$}}get characters(){return new Map(Array.from(this.nt,([t,e])=>[t,u(e)]))}get hardblank(){return this.$.hardblank}get height(){return this.$.height}get baseline(){return this.$.baseline}get defaultLayout(){return 128&this.$.fullLayout?"smushed":64&this.$.fullLayout?"fitted":-1===this.$.oldLayout?"full":0===this.$.oldLayout?"fitted":this.$.oldLayout>0?"smushed":"full"}get defaultPrintDirection(){return 1===this.$.printDirection?"rtl":"ltr"}get defaultVerticalLayout(){return 16384&this.$.fullLayout?"smushed":8192&this.$.fullLayout?"fitted":"full"}static ot(t){const e=t instanceof URL?t.pathname:t,n=(e.split(/[?#]/,1)[0]??e).split("/").filter(Boolean).pop()??"figfont";return n.toLowerCase().endsWith(".flf")?n.slice(0,-4)||"figfont":n}ct(t){const e=[[]];for(const[n,r]of Array.from(t).entries())"\n"!==r?e[e.length-1].push({character:r,inputIndex:n}):e.push([]);return e}ut(t,e){return"rtl"===e?[...t].reverse():t}ft(t){const e=t.map(({character:t,inputIndex:e})=>({figChar:this.getCharacter(t)??this.getCharacter(32),inputChar:t,inputIndex:e})),n=e.find(t=>void 0===t.figChar);if(n)throw new r("FIGfont is missing a required character for layout.",{character:n.inputChar,index:n.inputIndex});return e}ht(t,e,n){const r="number"==typeof n.maxCols&&Number.isFinite(n.maxCols)?Math.floor(n.maxCols):void 0,i=n.wrap??"none";return 0===t.length||!r||r<1||"none"===i?[t]:"char"===i?this.dt(t,e,r):this.gt(t,e,r)}gt(t,e,n){const r=this._t(t);if(!r.some(t=>!t.isWhitespace))return[t];const i=[];let s=[],o=[];for(const t of r){if(t.isWhitespace){s.length>0&&(o=t.characters);continue}const r=0===s.length?t.characters:s.concat(o,t.characters);s.length>0&&this.wt(r,e)>n?(i.push(s),s=t.characters.slice()):s=r,o=[]}return 0===s.length?[[]]:(i.push(s),i)}dt(t,e,n){const r=[];let i=[];for(const s of t){const t=i.concat(s);i.length>0&&this.wt(t,e)>n?(r.push(i),i=[s]):i=t}return 0===i.length?[[]]:(r.push(i),r)}wt(t,e){const n=this.ft(t);return this.rt.G(n.map(t=>t.figChar),n.map(({inputChar:t,inputIndex:e})=>({inputChar:t,inputIndex:e})),e,0).cols}_t(t){const e=[];for(const n of t){const t=/\s/u.test(n.character),r=e[e.length-1];r&&r.isWhitespace===t?r.characters.push(n):e.push({isWhitespace:t,characters:[n]})}return e}lt(t){return"ltr"===t||"rtl"===t?t:this.defaultPrintDirection}}function u(t){if(t)return{...t,lines:[...t.lines]}}const h="textmode.figlet.js",f="1.0.2",d=Symbol.for("textmode.figlet.state");function g(t){const e=t;return e[d]||(e[d]={activeFont:void 0,align:"left",baseline:"baseline"}),e[d]}const _=["loadFigFont","parseFigFont","figFont","figText","figTextWidth","figTextHeight","figTextBounds","figTextAlign","figTextBaseline"];function p(t,e){if(void 0!==t)return"function"==typeof t?t(e):t}function w(t,e,r){return r instanceof n.TextmodeColor||"string"==typeof r||"number"==typeof r?"charColor"===e?void t.charColor(r):void t.cellColor(r):4===r.length?"charColor"===e?void t.charColor(r[0],r[1],r[2],r[3]):void t.cellColor(r[0],r[1],r[2],r[3]):void("charColor"!==e?t.cellColor(r[0],r[1],r[2]):t.charColor(r[0],r[1],r[2]))}function m(t){const e=g(t).activeFont;if(!e)throw new r("No FIGlet font is active. Call figFont() first.");return e}function I(t,e){var n;null==(n=t.It)||n.call(t,e)}function v(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0,enumerable:!1})}function L(t){v(t,"loadFigFont",async function(t){const e=await c.it(t);return I(this,e),e}),v(t,"parseFigFont",function(t,e){const n=c.st(t,e);return I(this,n),n}),v(t,"figFont",function(t){const e=g(this);if(void 0===t)return e.activeFont;e.activeFont=t}),v(t,"figText",function(t,e,n,r={}){const i=m(this),s=i.planText(t,r),o=g(this),a=e+function(t,e){return"center"===e?-Math.floor(t/2):"right"===e?-(t-1):0}(s.cols,o.align),l=n+function(t,e,n){return"top"===n?0:"center"===n?-Math.floor(t/2):"bottom"===n?-(t-1):-(e-1)}(s.rows,i.baseline,o.baseline);this.push(),this.translate(a,l,0);for(const t of s.cells){this.push(),this.translate(t.col,t.row,0);const e=p(r.charColor,t),n=p(r.cellColor,t);this.char(t.char),void 0!==e&&w(this,"charColor",e),void 0!==n&&w(this,"cellColor",n),this.point(),this.pop()}this.pop()}),v(t,"figTextWidth",function(t,e={}){return m(this).measureText(t,e).cols}),v(t,"figTextHeight",function(t,e={}){return m(this).measureText(t,e).rows}),v(t,"figTextBounds",function(t,e={}){return m(this).measureText(t,e)}),v(t,"figTextAlign",function(t){const e=g(this);if(void 0===t)return e.align;e.align=t}),v(t,"figTextBaseline",function(t){const e=g(this);if(void 0===t)return e.baseline;e.baseline=t})}function y(t){for(const e of _)delete t[e];!function(t){delete t[d]}(t)}const C={name:h,version:f,install(t,e){L(t)},uninstall(t,e){y(t)}};if(typeof window<"u"){const t=window;t.FigletPlugin=C,t.TextmodeFigFont=c,t.FigFontParser=s,t.FigLayoutEngine=a,t.FigSmushRules=o,t.FIGFONT_REQUIRED_CODEPOINTS=i}export{i as FIGFONT_REQUIRED_CODEPOINTS,s as FigFontParser,a as FigLayoutEngine,o as FigSmushRules,C as FigletPlugin,c as TextmodeFigFont};
1
+ import{color as t}from"textmode.js";var e=class t extends Error{constructor(e,n){super(t.formatMessage(e,n)),this.name="FigletError"}static formatMessage(e,n){return n&&0!==Object.keys(n).length?`${e}\n\nContext:${Object.entries(n).map(([e,n])=>`\n - ${e}: ${t.formatValue(n)}`).join("")}`:e}static formatValue(e){return null===e?"null":void 0===e?"undefined":"string"==typeof e?`"${e}"`:"number"==typeof e||"boolean"==typeof e?String(e):Array.isArray(e)?`[${e.map(e=>t.formatValue(e)).join(", ")}]`:"object"==typeof e?JSON.stringify(e):String(e)}},n=[...Array.from({length:95},(t,e)=>e+32),196,214,220,228,246,252,223],r=class{static t(t){if(0===t.length)throw new e("Cannot parse an empty FIGfont file.");const n=t.replace(/\r\n?/g,"\n").split("\n"),r=n[0];if(!r)throw new e("Missing FIGfont header line.");const i=this.i(r);let s=1+i.commentLines;if(s>n.length)throw new e("FIGfont comment line count exceeds file length.",{commentLines:i.commentLines,totalLines:n.length});const o=/* @__PURE__ */new Map;return s=this.o(n,s,i,o),this.l(n,s,i,o),{header:i,characters:o}}static i(t){const n=t.trim().split(/\s+/),r=n[0]??"";if(r.length<6)throw new e("Invalid FIGfont header token.",{headerToken:r});const i=r.slice(0,5),s=r.slice(5);if("flf2a"!==i)throw new e("Unsupported FIGfont signature.",{signature:i});if(1!==s.length)throw new e("FIGfont hardblank must be a single character.",{hardblank:s});if(n.length<6)throw new e("Incomplete FIGfont header.",{headerLine:t});return{signature:i,hardblank:s,height:this.h(n[1],"height"),baseline:this.h(n[2],"baseline"),maxLength:this.h(n[3],"maxLength"),oldLayout:this.h(n[4],"oldLayout"),commentLines:this.h(n[5],"commentLines"),printDirection:this.h(n[6]??"0","printDirection"),fullLayout:this.h(n[7]??"0","fullLayout"),codetagCount:this.h(n[8]??"0","codetagCount")}}static o(t,e,r,i){let s=e;for(const o of n){const e=this.u(t,s,r.height,o);i.set(o,e),s+=r.height}return s}static l(t,e,n,r){let i=e;for(;i<t.length;){const e=t[i]?.trim()??"";if(0===e.length){i+=1;continue}const s=this._(e);i+=1;const o=this.u(t,i,n.height,s);r.set(s,o),i+=n.height}}static u(t,n,r,i){if(n+r>t.length)throw new e("Unexpected end of FIGfont character data.",{codePoint:i,startIndex:n,height:r,totalLines:t.length});const s=[];let o=0;for(let a=0;a<r;a+=1){const r=t[n+a]??"";if(0===r.length)throw new e("Encountered an empty FIGcharacter row.",{codePoint:i,row:a,startIndex:n});const c=r.at(-1);if(!c)throw new e("Failed to determine FIGcharacter endmark.",{codePoint:i,row:a});const l=r.replace(new RegExp(`${this.escapeForRegExp(c)}+$`),"");s.push(l),o=Math.max(o,l.length)}return{code:i,lines:s,width:o}}static _(t){const n=t.split(/\s+/,1)[0];if(/^[-+]?0x[0-9a-f]+$/i.test(n))return Number.parseInt(n,16);if(/^[-+]?0[0-7]+$/.test(n))return Number.parseInt(n,8);if(/^[-+]?\d+$/.test(n))return Number.parseInt(n,10);throw new e("Invalid FIGfont code tag.",{codetagLine:t})}static h(t,n){if(!/^-?\d+$/.test(t))throw new e("Invalid FIGfont header value.",{field:n,token:t});return Number.parseInt(t,10)}static escapeForRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}},i=class{static RULE_EQUAL_CHARACTER=1;static RULE_UNDERSCORE=2;static RULE_HIERARCHY=4;static RULE_OPPOSITE_PAIR=8;static RULE_BIG_X=16;static RULE_HARDBLANK=32;static VERTICAL_RULE_EQUAL_CHARACTER=256;static VERTICAL_RULE_UNDERSCORE=512;static VERTICAL_RULE_HIERARCHY=1024;static VERTICAL_RULE_HORIZONTAL_LINE=2048;static VERTICAL_RULE_VERTICAL_LINE_SUPERSMUSH=4096;static p(t){return 0!==t.fullLayout?63&t.fullLayout:t.oldLayout>0?63&t.oldLayout:0}static m(t){return 7936&t.fullLayout}static I(t,e,n,r){return" "===t?e:" "===e?t:0===r?this.L(t,e,n):(0!==(r&this.RULE_EQUAL_CHARACTER)?this.C(t,e,n):null)??(0!==(r&this.RULE_UNDERSCORE)?this.R(t,e):null)??(0!==(r&this.RULE_HIERARCHY)?this.v(t,e):null)??(0!==(r&this.RULE_OPPOSITE_PAIR)?this.A(t,e):null)??(0!==(r&this.RULE_BIG_X)?this.F(t,e):null)??(0!==(r&this.RULE_HARDBLANK)?this.T(t,e,n):null)}static L(t,e,n){return" "===t?e:" "===e?t:e}static U(t,e,n){return" "===t?e:" "===e?t:0===n?this.L(t,e," "):(0!==(n&this.VERTICAL_RULE_EQUAL_CHARACTER)?this.C(t,e," "):null)??(0!==(n&this.VERTICAL_RULE_UNDERSCORE)?this.R(t,e):null)??(0!==(n&this.VERTICAL_RULE_HIERARCHY)?this.v(t,e):null)??(0!==(n&this.VERTICAL_RULE_HORIZONTAL_LINE)?this.S(t,e):null)??(0!==(n&this.VERTICAL_RULE_VERTICAL_LINE_SUPERSMUSH)?this.$(t,e):null)}static C(t,e,n){return t===e&&t!==n?t:null}static R(t,e){const n="|/\\[]{}()<>";return"_"===t&&n.includes(e)?e:"_"===e&&n.includes(t)?t:null}static v(t,e){const n=["|","/\\","[]","{}","()","<>"],r=n.findIndex(e=>e.includes(t)),i=n.findIndex(t=>t.includes(e));return-1===r||-1===i||r===i?null:r>i?t:e}static A(t,e){return["[]","][","{}","}{","()",")("].includes(`${t}${e}`)?"|":null}static F(t,e){const n=`${t}${e}`;return"/\\"===n?"|":"\\/"===n?"Y":"><"===n?"X":null}static T(t,e,n){return t===n&&e===n?n:null}static S(t,e){const n=`${t}${e}`;return"-_"===n||"_-"===n?"=":null}static $(t,e){return"|"===t&&"|"===e?"|":null}},s=class{H;k;M;constructor(t){this.H=t,this.k=i.p(t),this.M=i.m(t)}G(t,e){const n=t.map((t,e)=>({inputIndex:e,inputChar:String.fromCodePoint(t.code)})),r=this.N(t,n,e,0),i=Array.from({length:r.rows},()=>Array.from({length:r.cols},()=>" "));for(const s of r.cells)i[s.row][s.col]=s.char;return i}N(t,e,n,r){if(0===t.length)return{lineIndex:r,cells:[],cols:0,rows:this.H.height};let s=this.O(t[0],e[0],r),o=t[0].width;for(let a=1;a<t.length;a+=1){const c=t[a],l=e[a]??{inputIndex:a,inputChar:String.fromCodePoint(c.code)},h=o-this.V(s,o,c,n),u=Math.max(o,h+c.width),f=s.map(t=>Array.from({length:u},(e,n)=>t[n]));for(let t=0;t<this.H.height;t+=1){const e=c.lines[t]??"",n=f[t];for(let s=0;s<c.width;s+=1){const o=e[s]??" ";if(" "===o)continue;const a=h+s,u=n[a],f=this.P(a,t,s,r,c,l,o);if(!u){n[a]=f;continue}const d=i.I(u.char,o,this.H.hardblank,this.k);n[a]=this.B(u,f,d??o)}}s=f,o=u}return this.D(s,o,r)}j(t,e){if(0===t.length)return{cells:[],lines:[],cols:0,rows:0};let n=this.W(t[0]),r=t[0].cols,s=t[0].rows;const o=[this.q(t[0],0)];for(let a=1;a<t.length;a+=1){const c=t[a],l=s-this.X(n,s,r,c,e),h=Math.max(r,c.cols),u=Math.max(s,l+c.rows),f=Array.from({length:u},(t,e)=>Array.from({length:h},(t,r)=>n[e]?.[r]));for(const t of c.cells){const e=l+t.row,n=t.col,r=f[e]?.[n];if(!r){f[e][n]={...t,row:e};continue}const s=i.U(r.char,t.char,this.M);f[e][n]=this.B(r,{...t,row:e},s??t.char)}n=f,r=h,s=u,o.push(this.q(c,l))}return this.Y(n,r,s,o)}V(t,e,n,r){if("full"===r)return 0;for(let i=e;i>=0;i-=1){let s=!0;for(let o=0;o<this.H.height&&s;o+=1){const a=t[o]??[],c=n.lines[o]??"";for(let t=0;t<i;t+=1){const n=a[e-i+t]?.char??" ",o=c[t]??" ";if(!this.J(n,o,r)){s=!1;break}}}if(s)return i}return 0}J(t,e,n){return" "===t||" "===e||"fitted"!==n&&null!==i.I(t,e,this.H.hardblank,this.k)}O(t,e={inputIndex:0,inputChar:String.fromCodePoint(t.code)},n=0){return Array.from({length:this.H.height},(r,i)=>{const s=t.lines[i]??"";return Array.from({length:t.width},(r,o)=>{const a=s[o]??" ";return" "===a?void 0:this.P(o,i,o,n,t,e,a)})})}P(t,e,n,r,i,s,o){return{char:o,col:t,row:e,inputIndex:s.inputIndex,inputChar:s.inputChar,figCharCode:i.code,subRow:e,subCol:n,lineIndex:r}}B(t,e,n){return n===t.char?t:{...e,char:n}}D(t,e,n){const r=[];for(let i=0;i<this.H.height;i+=1){const s=t[i]??[];for(let t=0;t<e;t+=1){const e=s[t];e&&e.char!==this.H.hardblank&&r.push({...e,col:t,row:i,lineIndex:n})}}return{lineIndex:n,cells:r,cols:e,rows:this.H.height}}X(t,e,n,r,i){if("full"===i)return 0;const s=this.W(r),o=Math.min(e,r.rows),a=Math.max(n,r.cols);for(let c=o;c>=0;c-=1){let n=!0;for(let r=0;r<c&&n;r+=1){const o=t[e-c+r]??[],l=s[r]??[];for(let t=0;t<a;t+=1){const e=o[t]?.char??" ",r=l[t]?.char??" ";if(!this.K(e,r,i)){n=!1;break}}}if(n)return c}return 0}K(t,e,n){return" "===t||" "===e||"fitted"!==n&&null!==i.U(t,e,this.M)}W(t){const e=Array.from({length:t.rows},()=>Array.from({length:t.cols},()=>{}));for(const n of t.cells)e[n.row][n.col]=n;return e}q(t,e){return{...t,cells:t.cells.map(t=>({...t,row:t.row+e}))}}Y(t,e,n,r){const i=[];for(let s=0;s<n;s+=1)for(let n=0;n<e;n+=1){const e=t[s]?.[n];e&&i.push({...e,row:s,col:n})}return{cells:i,lines:r,cols:e,rows:n}}},o=class{Z=/* @__PURE__ */new Set;tt(t){this.Z.add(t)}dispose(){for(const t of this.Z)t();this.Z.clear()}},a=class t extends o{et;H;nt;rt;constructor(t,e,n){super(),this.et=t,this.H=e,this.nt=n,this.rt=new s(e)}static async it(t){const n=await fetch(t);if(!n.ok)throw new e("Failed to load FIGfont file.",{source:String(t),status:n.status,statusText:n.statusText});const r=await n.text();return this.st(this.ot(t),r)}static st(e,n){const i=r.t(n);return new t(e,i.header,i.characters)}getCharacter(t){const e="number"==typeof t?t:Array.from(t)[0]?.codePointAt(0);if(void 0!==e)return c(this.nt.get(e))}planText(t,e={}){const n=e.horizontalLayout??this.defaultLayout,r=e.verticalLayout??this.defaultVerticalLayout,i=this.ct(e.direction),s=this.lt(t).map(t=>this.ht(t,i)).flatMap(t=>this.ut(t,n,e)).map((t,e)=>{const r=this.ft(t);return this.rt.N(r.map(t=>t.figChar),r.map(({inputChar:t,inputIndex:e})=>({inputChar:t,inputIndex:e})),n,e)}),o=this.rt.j(s,r);return{cells:o.cells,lines:o.lines,cols:o.cols,rows:o.rows,direction:i}}renderText(t,e={}){const n=this.planText(t,e),r=Array.from({length:n.rows},()=>Array.from({length:n.cols},()=>" "));for(const i of n.cells)r[i.row][i.col]=i.char;return{grid:r,cols:n.cols,rows:n.rows}}measureText(t,e={}){const n=this.planText(t,e);return{cols:n.cols,rows:n.rows}}get name(){return this.et}get header(){return{...this.H}}get characters(){return new Map(Array.from(this.nt,([t,e])=>[t,c(e)]))}get hardblank(){return this.H.hardblank}get height(){return this.H.height}get baseline(){return this.H.baseline}get defaultLayout(){return 128&this.H.fullLayout?"smushed":64&this.H.fullLayout?"fitted":-1===this.H.oldLayout?"full":0===this.H.oldLayout?"fitted":this.H.oldLayout>0?"smushed":"full"}get defaultPrintDirection(){return 1===this.H.printDirection?"rtl":"ltr"}get defaultVerticalLayout(){return 16384&this.H.fullLayout?"smushed":8192&this.H.fullLayout?"fitted":"full"}static ot(t){const e=t instanceof URL?t.pathname:t,n=(e.split(/[?#]/,1)[0]??e).split("/").filter(Boolean).pop()??"figfont";return n.toLowerCase().endsWith(".flf")?n.slice(0,-4)||"figfont":n}lt(t){const e=[[]];for(const[n,r]of Array.from(t).entries())"\n"!==r?e[e.length-1].push({character:r,inputIndex:n}):e.push([]);return e}ht(t,e){return"rtl"===e?[...t].reverse():t}ft(t){const n=t.map(({character:t,inputIndex:e})=>({figChar:this.getCharacter(t)??this.getCharacter(32),inputChar:t,inputIndex:e})),r=n.find(t=>void 0===t.figChar);if(r)throw new e("FIGfont is missing a required character for layout.",{character:r.inputChar,index:r.inputIndex});return n}ut(t,e,n){const r="number"==typeof n.maxCols&&Number.isFinite(n.maxCols)?Math.floor(n.maxCols):void 0,i=n.wrap??"none";return 0===t.length||!r||r<1||"none"===i?[t]:"char"===i?this.dt(t,e,r):this.gt(t,e,r)}gt(t,e,n){const r=this._t(t);if(!r.some(t=>!t.isWhitespace))return[t];const i=[];let s=[],o=[];for(const a of r){if(a.isWhitespace){s.length>0&&(o=a.characters);continue}const t=0===s.length?a.characters:s.concat(o,a.characters);s.length>0&&this.wt(t,e)>n?(i.push(s),s=a.characters.slice()):s=t,o=[]}return 0===s.length?[[]]:(i.push(s),i)}dt(t,e,n){const r=[];let i=[];for(const s of t){const t=i.concat(s);i.length>0&&this.wt(t,e)>n?(r.push(i),i=[s]):i=t}return 0===i.length?[[]]:(r.push(i),r)}wt(t,e){const n=this.ft(t);return this.rt.N(n.map(t=>t.figChar),n.map(({inputChar:t,inputIndex:e})=>({inputChar:t,inputIndex:e})),e,0).cols}_t(t){const e=[];for(const n of t){const t=/\s/u.test(n.character),r=e[e.length-1];r&&r.isWhitespace===t?r.characters.push(n):e.push({isWhitespace:t,characters:[n]})}return e}ct(t){return"ltr"===t||"rtl"===t?t:this.defaultPrintDirection}};function c(t){if(t)return{...t,lines:[...t.lines]}}var l=Symbol.for("textmode.figlet.state");function h(t){const e=t;return e[l]||(e[l]={activeFont:void 0,align:"left",baseline:"baseline"}),e[l]}var u=["loadFigFont","parseFigFont","figFont","figText","figTextWidth","figTextHeight","figTextBounds","figTextAlign","figTextBaseline"];function f(t,e){if(void 0!==t)return"function"==typeof t?t(e):t}function d(e,n,r){return r instanceof t.TextmodeColor||"string"==typeof r||"number"==typeof r?"charColor"===n?void e.charColor(r):void e.cellColor(r):4===r.length?"charColor"===n?void e.charColor(r[0],r[1],r[2],r[3]):void e.cellColor(r[0],r[1],r[2],r[3]):void("charColor"!==n?e.cellColor(r[0],r[1],r[2]):e.charColor(r[0],r[1],r[2]))}function g(t){const n=h(t).activeFont;if(!n)throw new e("No FIGlet font is active. Call figFont() first.");return n}function _(t,e){t.It?.(e)}function p(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0,enumerable:!1})}var w={name:"textmode.figlet.js",version:"1.0.3-beta.1",install(t,e){!function(t){p(t,"loadFigFont",async function(t){const e=await a.it(t);return _(this,e),e}),p(t,"parseFigFont",function(t,e){const n=a.st(t,e);return _(this,n),n}),p(t,"figFont",function(t){const e=h(this);if(void 0===t)return e.activeFont;e.activeFont=t}),p(t,"figText",function(t,e,n,r={}){const i=g(this),s=i.planText(t,r),o=h(this),a=e+(c=s.cols,"center"===(l=o.align)?-Math.floor(c/2):"right"===l?-(c-1):0);var c,l;const u=n+(_=s.rows,p=i.baseline,"top"===(w=o.baseline)?0:"center"===w?-Math.floor(_/2):"bottom"===w?-(_-1):-(p-1));var _,p,w;this.push(),this.translate(a,u,0);for(const h of s.cells){this.push(),this.translate(h.col,h.row,0);const t=f(r.charColor,h),e=f(r.cellColor,h);this.char(h.char),void 0!==t&&d(this,"charColor",t),void 0!==e&&d(this,"cellColor",e),this.point(),this.pop()}this.pop()}),p(t,"figTextWidth",function(t,e={}){return g(this).measureText(t,e).cols}),p(t,"figTextHeight",function(t,e={}){return g(this).measureText(t,e).rows}),p(t,"figTextBounds",function(t,e={}){return g(this).measureText(t,e)}),p(t,"figTextAlign",function(t){const e=h(this);if(void 0===t)return e.align;e.align=t}),p(t,"figTextBaseline",function(t){const e=h(this);if(void 0===t)return e.baseline;e.baseline=t})}(t)},uninstall(t,e){!function(t){for(const e of u)delete t[e];!function(t){delete t[l]}(t)}(t)}};if("undefined"!=typeof window){const t=window;t.FigletPlugin=w,t.TextmodeFigFont=a,t.FigFontParser=r,t.FigLayoutEngine=s,t.FigSmushRules=i,t.FIGFONT_REQUIRED_CODEPOINTS=n}export{n as FIGFONT_REQUIRED_CODEPOINTS,r as FigFontParser,s as FigLayoutEngine,i as FigSmushRules,w as FigletPlugin,a as TextmodeFigFont};
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&typeof module<"u"?e(exports,require("textmode.js")):"function"==typeof define&&define.amd?define(["exports","textmode.js"],e):e((t=typeof globalThis<"u"?globalThis:t||self).TextmodeFiglet={},t.textmode)}(this,function(t,e){"use strict";var n=Object.defineProperty,r=(t,e,r)=>((t,e,r)=>e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r);class i extends Error{constructor(t,e){super(i.formatMessage(t,e)),this.name="FigletError"}static formatMessage(t,e){if(!e||0===Object.keys(e).length)return t;return`${t}\n\nContext:${Object.entries(e).map(([t,e])=>`\n - ${t}: ${i.formatValue(e)}`).join("")}`}static formatValue(t){return null===t?"null":void 0===t?"undefined":"string"==typeof t?`"${t}"`:"number"==typeof t||"boolean"==typeof t?String(t):Array.isArray(t)?`[${t.map(t=>i.formatValue(t)).join(", ")}]`:"object"==typeof t?JSON.stringify(t):String(t)}}const s=[...Array.from({length:95},(t,e)=>e+32),196,214,220,228,246,252,223];class o{static t(t){if(0===t.length)throw new i("Cannot parse an empty FIGfont file.");const e=t.replace(/\r\n?/g,"\n").split("\n"),n=e[0];if(!n)throw new i("Missing FIGfont header line.");const r=this.i(n);let s=1+r.commentLines;if(s>e.length)throw new i("FIGfont comment line count exceeds file length.",{commentLines:r.commentLines,totalLines:e.length});const o=new Map;return s=this.o(e,s,r,o),this.l(e,s,r,o),{header:r,characters:o}}static i(t){const e=t.trim().split(/\s+/),n=e[0]??"";if(n.length<6)throw new i("Invalid FIGfont header token.",{headerToken:n});const r=n.slice(0,5),s=n.slice(5);if("flf2a"!==r)throw new i("Unsupported FIGfont signature.",{signature:r});if(1!==s.length)throw new i("FIGfont hardblank must be a single character.",{hardblank:s});if(e.length<6)throw new i("Incomplete FIGfont header.",{headerLine:t});return{signature:r,hardblank:s,height:this.u(e[1],"height"),baseline:this.u(e[2],"baseline"),maxLength:this.u(e[3],"maxLength"),oldLayout:this.u(e[4],"oldLayout"),commentLines:this.u(e[5],"commentLines"),printDirection:this.u(e[6]??"0","printDirection"),fullLayout:this.u(e[7]??"0","fullLayout"),codetagCount:this.u(e[8]??"0","codetagCount")}}static o(t,e,n,r){let i=e;for(const e of s){const s=this.h(t,i,n.height,e);r.set(e,s),i+=n.height}return i}static l(t,e,n,r){var i;let s=e;for(;s<t.length;){const e=(null==(i=t[s])?void 0:i.trim())??"";if(0===e.length){s+=1;continue}const o=this.p(e);s+=1;const a=this.h(t,s,n.height,o);r.set(o,a),s+=n.height}}static h(t,e,n,r){if(e+n>t.length)throw new i("Unexpected end of FIGfont character data.",{codePoint:r,startIndex:e,height:n,totalLines:t.length});const s=[];let o=0;for(let a=0;a<n;a+=1){const n=t[e+a]??"";if(0===n.length)throw new i("Encountered an empty FIGcharacter row.",{codePoint:r,row:a,startIndex:e});const l=n.at(-1);if(!l)throw new i("Failed to determine FIGcharacter endmark.",{codePoint:r,row:a});const c=n.replace(new RegExp(`${this.escapeForRegExp(l)}+$`),"");s.push(c),o=Math.max(o,c.length)}return{code:r,lines:s,width:o}}static p(t){const e=t.split(/\s+/,1)[0];if(/^[-+]?0x[0-9a-f]+$/i.test(e))return Number.parseInt(e,16);if(/^[-+]?0[0-7]+$/.test(e))return Number.parseInt(e,8);if(/^[-+]?\d+$/.test(e))return Number.parseInt(e,10);throw new i("Invalid FIGfont code tag.",{codetagLine:t})}static u(t,e){if(!/^-?\d+$/.test(t))throw new i("Invalid FIGfont header value.",{field:e,token:t});return Number.parseInt(t,10)}static escapeForRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}}class a{static _(t){return 0!==t.fullLayout?63&t.fullLayout:t.oldLayout>0?63&t.oldLayout:0}static m(t){return 7936&t.fullLayout}static I(t,e,n,r){return" "===t?e:" "===e?t:0===r?this.v(t,e,n):(0!==(r&this.RULE_EQUAL_CHARACTER)?this.L(t,e,n):null)??(0!==(r&this.RULE_UNDERSCORE)?this.C(t,e):null)??(0!==(r&this.RULE_HIERARCHY)?this.R(t,e):null)??(0!==(r&this.RULE_OPPOSITE_PAIR)?this.A(t,e):null)??(0!==(r&this.RULE_BIG_X)?this.F(t,e):null)??(0!==(r&this.RULE_HARDBLANK)?this.T(t,e,n):null)}static v(t,e,n){return" "===t?e:" "===e?t:e}static U(t,e,n){return" "===t?e:" "===e?t:0===n?this.v(t,e," "):(0!==(n&this.VERTICAL_RULE_EQUAL_CHARACTER)?this.L(t,e," "):null)??(0!==(n&this.VERTICAL_RULE_UNDERSCORE)?this.C(t,e):null)??(0!==(n&this.VERTICAL_RULE_HIERARCHY)?this.R(t,e):null)??(0!==(n&this.VERTICAL_RULE_HORIZONTAL_LINE)?this.S(t,e):null)??(0!==(n&this.VERTICAL_RULE_VERTICAL_LINE_SUPERSMUSH)?this.$(t,e):null)}static L(t,e,n){return t===e&&t!==n?t:null}static C(t,e){const n="|/\\[]{}()<>";return"_"===t&&n.includes(e)?e:"_"===e&&n.includes(t)?t:null}static R(t,e){const n=["|","/\\","[]","{}","()","<>"],r=n.findIndex(e=>e.includes(t)),i=n.findIndex(t=>t.includes(e));return-1===r||-1===i||r===i?null:r>i?t:e}static A(t,e){return["[]","][","{}","}{","()",")("].includes(`${t}${e}`)?"|":null}static F(t,e){const n=`${t}${e}`;return"/\\"===n?"|":"\\/"===n?"Y":"><"===n?"X":null}static T(t,e,n){return t===n&&e===n?n:null}static S(t,e){const n=`${t}${e}`;return"-_"===n||"_-"===n?"=":null}static $(t,e){return"|"===t&&"|"===e?"|":null}}r(a,"RULE_EQUAL_CHARACTER",1),r(a,"RULE_UNDERSCORE",2),r(a,"RULE_HIERARCHY",4),r(a,"RULE_OPPOSITE_PAIR",8),r(a,"RULE_BIG_X",16),r(a,"RULE_HARDBLANK",32),r(a,"VERTICAL_RULE_EQUAL_CHARACTER",256),r(a,"VERTICAL_RULE_UNDERSCORE",512),r(a,"VERTICAL_RULE_HIERARCHY",1024),r(a,"VERTICAL_RULE_HORIZONTAL_LINE",2048),r(a,"VERTICAL_RULE_VERTICAL_LINE_SUPERSMUSH",4096);class l{constructor(t){r(this,"_header"),r(this,"_horizontalRuleMask"),r(this,"_verticalRuleMask"),this.H=t,this.M=a._(t),this.k=a.m(t)}G(t,e){const n=t.map((t,e)=>({inputIndex:e,inputChar:String.fromCodePoint(t.code)})),r=this.O(t,n,e,0),i=Array.from({length:r.rows},()=>Array.from({length:r.cols},()=>" "));for(const t of r.cells)i[t.row][t.col]=t.char;return i}O(t,e,n,r){if(0===t.length)return{lineIndex:r,cells:[],cols:0,rows:this.H.height};let i=this.N(t[0],e[0],r),s=t[0].width;for(let o=1;o<t.length;o+=1){const l=t[o],c=e[o]??{inputIndex:o,inputChar:String.fromCodePoint(l.code)},u=s-this.V(i,s,l,n),h=Math.max(s,u+l.width),f=i.map(t=>Array.from({length:h},(e,n)=>t[n]));for(let t=0;t<this.H.height;t+=1){const e=l.lines[t]??"",n=f[t];for(let i=0;i<l.width;i+=1){const s=e[i]??" ";if(" "===s)continue;const o=u+i,h=n[o],f=this.P(o,t,i,r,l,c,s);if(!h){n[o]=f;continue}const d=a.I(h.char,s,this.H.hardblank,this.M);n[o]=this.B(h,f,d??s)}}i=f,s=h}return this.j(i,s,r)}D(t,e){var n;if(0===t.length)return{cells:[],lines:[],cols:0,rows:0};let r=this.W(t[0]),i=t[0].cols,s=t[0].rows;const o=[this.q(t[0],0)];for(let l=1;l<t.length;l+=1){const c=t[l],u=s-this.X(r,s,i,c,e),h=Math.max(i,c.cols),f=Math.max(s,u+c.rows),d=Array.from({length:f},(t,e)=>Array.from({length:h},(t,n)=>{var i;return null==(i=r[e])?void 0:i[n]}));for(const t of c.cells){const e=u+t.row,r=t.col,i=null==(n=d[e])?void 0:n[r];if(!i){d[e][r]={...t,row:e};continue}const s=a.U(i.char,t.char,this.k);d[e][r]=this.B(i,{...t,row:e},s??t.char)}r=d,i=h,s=f,o.push(this.q(c,u))}return this.Y(r,i,s,o)}V(t,e,n,r){var i;if("full"===r)return 0;for(let s=e;s>=0;s-=1){let o=!0;for(let a=0;a<this.H.height&&o;a+=1){const l=t[a]??[],c=n.lines[a]??"";for(let t=0;t<s;t+=1){const n=(null==(i=l[e-s+t])?void 0:i.char)??" ",a=c[t]??" ";if(!this.J(n,a,r)){o=!1;break}}}if(o)return s}return 0}J(t,e,n){return" "===t||" "===e||"fitted"!==n&&null!==a.I(t,e,this.H.hardblank,this.M)}N(t,e={inputIndex:0,inputChar:String.fromCodePoint(t.code)},n=0){return Array.from({length:this.H.height},(r,i)=>{const s=t.lines[i]??"";return Array.from({length:t.width},(r,o)=>{const a=s[o]??" ";return" "===a?void 0:this.P(o,i,o,n,t,e,a)})})}P(t,e,n,r,i,s,o){return{char:o,col:t,row:e,inputIndex:s.inputIndex,inputChar:s.inputChar,figCharCode:i.code,subRow:e,subCol:n,lineIndex:r}}B(t,e,n){return n===t.char?t:{...e,char:n}}j(t,e,n){const r=[];for(let i=0;i<this.H.height;i+=1){const s=t[i]??[];for(let t=0;t<e;t+=1){const e=s[t];!e||e.char===this.H.hardblank||r.push({...e,col:t,row:i,lineIndex:n})}}return{lineIndex:n,cells:r,cols:e,rows:this.H.height}}X(t,e,n,r,i){var s,o;if("full"===i)return 0;const a=this.W(r),l=Math.min(e,r.rows),c=Math.max(n,r.cols);for(let n=l;n>=0;n-=1){let r=!0;for(let l=0;l<n&&r;l+=1){const u=t[e-n+l]??[],h=a[l]??[];for(let t=0;t<c;t+=1){const e=(null==(s=u[t])?void 0:s.char)??" ",n=(null==(o=h[t])?void 0:o.char)??" ";if(!this.K(e,n,i)){r=!1;break}}}if(r)return n}return 0}K(t,e,n){return" "===t||" "===e||"fitted"!==n&&null!==a.U(t,e,this.k)}W(t){const e=Array.from({length:t.rows},()=>Array.from({length:t.cols},()=>{}));for(const n of t.cells)e[n.row][n.col]=n;return e}q(t,e){return{...t,cells:t.cells.map(t=>({...t,row:t.row+e}))}}Y(t,e,n,r){var i;const s=[];for(let r=0;r<n;r+=1)for(let n=0;n<e;n+=1){const e=null==(i=t[r])?void 0:i[n];e&&s.push({...e,row:r,col:n})}return{cells:s,lines:r,cols:e,rows:n}}}class c{constructor(){r(this,"_onDisposeCallbacks",new Set)}Z(t){this.tt.add(t)}dispose(){for(const t of this.tt)t();this.tt.clear()}}class u extends c{constructor(t,e,n){super(),r(this,"_name"),r(this,"_header"),r(this,"_characters"),r(this,"_layoutEngine"),this.et=t,this.H=e,this.nt=n,this.rt=new l(e)}static async it(t){const e=await fetch(t);if(!e.ok)throw new i("Failed to load FIGfont file.",{source:String(t),status:e.status,statusText:e.statusText});const n=await e.text();return this.st(this.ot(t),n)}static st(t,e){const n=o.t(e);return new u(t,n.header,n.characters)}getCharacter(t){var e;const n="number"==typeof t?t:null==(e=Array.from(t)[0])?void 0:e.codePointAt(0);if(void 0!==n)return h(this.nt.get(n))}planText(t,e={}){const n=e.horizontalLayout??this.defaultLayout,r=e.verticalLayout??this.defaultVerticalLayout,i=this.lt(e.direction),s=this.ct(t).map(t=>this.ut(t,i)).flatMap(t=>this.ht(t,n,e)).map((t,e)=>{const r=this.ft(t);return this.rt.O(r.map(t=>t.figChar),r.map(({inputChar:t,inputIndex:e})=>({inputChar:t,inputIndex:e})),n,e)}),o=this.rt.D(s,r);return{cells:o.cells,lines:o.lines,cols:o.cols,rows:o.rows,direction:i}}renderText(t,e={}){const n=this.planText(t,e),r=Array.from({length:n.rows},()=>Array.from({length:n.cols},()=>" "));for(const t of n.cells)r[t.row][t.col]=t.char;return{grid:r,cols:n.cols,rows:n.rows}}measureText(t,e={}){const n=this.planText(t,e);return{cols:n.cols,rows:n.rows}}get name(){return this.et}get header(){return{...this.H}}get characters(){return new Map(Array.from(this.nt,([t,e])=>[t,h(e)]))}get hardblank(){return this.H.hardblank}get height(){return this.H.height}get baseline(){return this.H.baseline}get defaultLayout(){return 128&this.H.fullLayout?"smushed":64&this.H.fullLayout?"fitted":-1===this.H.oldLayout?"full":0===this.H.oldLayout?"fitted":this.H.oldLayout>0?"smushed":"full"}get defaultPrintDirection(){return 1===this.H.printDirection?"rtl":"ltr"}get defaultVerticalLayout(){return 16384&this.H.fullLayout?"smushed":8192&this.H.fullLayout?"fitted":"full"}static ot(t){const e=t instanceof URL?t.pathname:t,n=(e.split(/[?#]/,1)[0]??e).split("/").filter(Boolean).pop()??"figfont";return n.toLowerCase().endsWith(".flf")?n.slice(0,-4)||"figfont":n}ct(t){const e=[[]];for(const[n,r]of Array.from(t).entries())"\n"!==r?e[e.length-1].push({character:r,inputIndex:n}):e.push([]);return e}ut(t,e){return"rtl"===e?[...t].reverse():t}ft(t){const e=t.map(({character:t,inputIndex:e})=>({figChar:this.getCharacter(t)??this.getCharacter(32),inputChar:t,inputIndex:e})),n=e.find(t=>void 0===t.figChar);if(n)throw new i("FIGfont is missing a required character for layout.",{character:n.inputChar,index:n.inputIndex});return e}ht(t,e,n){const r="number"==typeof n.maxCols&&Number.isFinite(n.maxCols)?Math.floor(n.maxCols):void 0,i=n.wrap??"none";return 0===t.length||!r||r<1||"none"===i?[t]:"char"===i?this.dt(t,e,r):this.gt(t,e,r)}gt(t,e,n){const r=this._t(t);if(!r.some(t=>!t.isWhitespace))return[t];const i=[];let s=[],o=[];for(const t of r){if(t.isWhitespace){s.length>0&&(o=t.characters);continue}const r=0===s.length?t.characters:s.concat(o,t.characters);s.length>0&&this.wt(r,e)>n?(i.push(s),s=t.characters.slice()):s=r,o=[]}return 0===s.length?[[]]:(i.push(s),i)}dt(t,e,n){const r=[];let i=[];for(const s of t){const t=i.concat(s);i.length>0&&this.wt(t,e)>n?(r.push(i),i=[s]):i=t}return 0===i.length?[[]]:(r.push(i),r)}wt(t,e){const n=this.ft(t);return this.rt.O(n.map(t=>t.figChar),n.map(({inputChar:t,inputIndex:e})=>({inputChar:t,inputIndex:e})),e,0).cols}_t(t){const e=[];for(const n of t){const t=/\s/u.test(n.character),r=e[e.length-1];r&&r.isWhitespace===t?r.characters.push(n):e.push({isWhitespace:t,characters:[n]})}return e}lt(t){return"ltr"===t||"rtl"===t?t:this.defaultPrintDirection}}function h(t){if(t)return{...t,lines:[...t.lines]}}const f="textmode.figlet.js",d="1.0.2",g=Symbol.for("textmode.figlet.state");function p(t){const e=t;return e[g]||(e[g]={activeFont:void 0,align:"left",baseline:"baseline"}),e[g]}const _=["loadFigFont","parseFigFont","figFont","figText","figTextWidth","figTextHeight","figTextBounds","figTextAlign","figTextBaseline"];function w(t,e){if(void 0!==t)return"function"==typeof t?t(e):t}function m(t,n,r){return r instanceof e.color.TextmodeColor||"string"==typeof r||"number"==typeof r?"charColor"===n?void t.charColor(r):void t.cellColor(r):4===r.length?"charColor"===n?void t.charColor(r[0],r[1],r[2],r[3]):void t.cellColor(r[0],r[1],r[2],r[3]):void("charColor"!==n?t.cellColor(r[0],r[1],r[2]):t.charColor(r[0],r[1],r[2]))}function I(t){const e=p(t).activeFont;if(!e)throw new i("No FIGlet font is active. Call figFont() first.");return e}function y(t,e){var n;null==(n=t.It)||n.call(t,e)}function v(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0,enumerable:!1})}function x(t){v(t,"loadFigFont",async function(t){const e=await u.it(t);return y(this,e),e}),v(t,"parseFigFont",function(t,e){const n=u.st(t,e);return y(this,n),n}),v(t,"figFont",function(t){const e=p(this);if(void 0===t)return e.activeFont;e.activeFont=t}),v(t,"figText",function(t,e,n,r={}){const i=I(this),s=i.planText(t,r),o=p(this),a=e+function(t,e){return"center"===e?-Math.floor(t/2):"right"===e?-(t-1):0}(s.cols,o.align),l=n+function(t,e,n){return"top"===n?0:"center"===n?-Math.floor(t/2):"bottom"===n?-(t-1):-(e-1)}(s.rows,i.baseline,o.baseline);this.push(),this.translate(a,l,0);for(const t of s.cells){this.push(),this.translate(t.col,t.row,0);const e=w(r.charColor,t),n=w(r.cellColor,t);this.char(t.char),void 0!==e&&m(this,"charColor",e),void 0!==n&&m(this,"cellColor",n),this.point(),this.pop()}this.pop()}),v(t,"figTextWidth",function(t,e={}){return I(this).measureText(t,e).cols}),v(t,"figTextHeight",function(t,e={}){return I(this).measureText(t,e).rows}),v(t,"figTextBounds",function(t,e={}){return I(this).measureText(t,e)}),v(t,"figTextAlign",function(t){const e=p(this);if(void 0===t)return e.align;e.align=t}),v(t,"figTextBaseline",function(t){const e=p(this);if(void 0===t)return e.baseline;e.baseline=t})}function L(t){for(const e of _)delete t[e];!function(t){delete t[g]}(t)}const C={name:f,version:d,install(t,e){x(t)},uninstall(t,e){L(t)}};if(typeof window<"u"){const t=window;t.FigletPlugin=C,t.TextmodeFigFont=u,t.FigFontParser=o,t.FigLayoutEngine=l,t.FigSmushRules=a,t.FIGFONT_REQUIRED_CODEPOINTS=s}t.FIGFONT_REQUIRED_CODEPOINTS=s,t.FigFontParser=o,t.FigLayoutEngine=l,t.FigSmushRules=a,t.FigletPlugin=C,t.TextmodeFigFont=u,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("textmode.js")):"function"==typeof define&&define.amd?define(["exports","textmode.js"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).TextmodeFiglet={},t.textmode)}(this,function(t,e){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});var n=class t extends Error{constructor(e,n){super(t.formatMessage(e,n)),this.name="FigletError"}static formatMessage(e,n){return n&&0!==Object.keys(n).length?`${e}\n\nContext:${Object.entries(n).map(([e,n])=>`\n - ${e}: ${t.formatValue(n)}`).join("")}`:e}static formatValue(e){return null===e?"null":void 0===e?"undefined":"string"==typeof e?`"${e}"`:"number"==typeof e||"boolean"==typeof e?String(e):Array.isArray(e)?`[${e.map(e=>t.formatValue(e)).join(", ")}]`:"object"==typeof e?JSON.stringify(e):String(e)}},r=[...Array.from({length:95},(t,e)=>e+32),196,214,220,228,246,252,223],i=class{static t(t){if(0===t.length)throw new n("Cannot parse an empty FIGfont file.");const e=t.replace(/\r\n?/g,"\n").split("\n"),r=e[0];if(!r)throw new n("Missing FIGfont header line.");const i=this.i(r);let s=1+i.commentLines;if(s>e.length)throw new n("FIGfont comment line count exceeds file length.",{commentLines:i.commentLines,totalLines:e.length});const o=new Map;return s=this.o(e,s,i,o),this.l(e,s,i,o),{header:i,characters:o}}static i(t){const e=t.trim().split(/\s+/),r=e[0]??"";if(r.length<6)throw new n("Invalid FIGfont header token.",{headerToken:r});const i=r.slice(0,5),s=r.slice(5);if("flf2a"!==i)throw new n("Unsupported FIGfont signature.",{signature:i});if(1!==s.length)throw new n("FIGfont hardblank must be a single character.",{hardblank:s});if(e.length<6)throw new n("Incomplete FIGfont header.",{headerLine:t});return{signature:i,hardblank:s,height:this.u(e[1],"height"),baseline:this.u(e[2],"baseline"),maxLength:this.u(e[3],"maxLength"),oldLayout:this.u(e[4],"oldLayout"),commentLines:this.u(e[5],"commentLines"),printDirection:this.u(e[6]??"0","printDirection"),fullLayout:this.u(e[7]??"0","fullLayout"),codetagCount:this.u(e[8]??"0","codetagCount")}}static o(t,e,n,i){let s=e;for(const o of r){const e=this.h(t,s,n.height,o);i.set(o,e),s+=n.height}return s}static l(t,e,n,r){let i=e;for(;i<t.length;){const e=t[i]?.trim()??"";if(0===e.length){i+=1;continue}const s=this.p(e);i+=1;const o=this.h(t,i,n.height,s);r.set(s,o),i+=n.height}}static h(t,e,r,i){if(e+r>t.length)throw new n("Unexpected end of FIGfont character data.",{codePoint:i,startIndex:e,height:r,totalLines:t.length});const s=[];let o=0;for(let a=0;a<r;a+=1){const r=t[e+a]??"";if(0===r.length)throw new n("Encountered an empty FIGcharacter row.",{codePoint:i,row:a,startIndex:e});const c=r.at(-1);if(!c)throw new n("Failed to determine FIGcharacter endmark.",{codePoint:i,row:a});const l=r.replace(new RegExp(`${this.escapeForRegExp(c)}+$`),"");s.push(l),o=Math.max(o,l.length)}return{code:i,lines:s,width:o}}static p(t){const e=t.split(/\s+/,1)[0];if(/^[-+]?0x[0-9a-f]+$/i.test(e))return Number.parseInt(e,16);if(/^[-+]?0[0-7]+$/.test(e))return Number.parseInt(e,8);if(/^[-+]?\d+$/.test(e))return Number.parseInt(e,10);throw new n("Invalid FIGfont code tag.",{codetagLine:t})}static u(t,e){if(!/^-?\d+$/.test(t))throw new n("Invalid FIGfont header value.",{field:e,token:t});return Number.parseInt(t,10)}static escapeForRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}},s=class{static RULE_EQUAL_CHARACTER=1;static RULE_UNDERSCORE=2;static RULE_HIERARCHY=4;static RULE_OPPOSITE_PAIR=8;static RULE_BIG_X=16;static RULE_HARDBLANK=32;static VERTICAL_RULE_EQUAL_CHARACTER=256;static VERTICAL_RULE_UNDERSCORE=512;static VERTICAL_RULE_HIERARCHY=1024;static VERTICAL_RULE_HORIZONTAL_LINE=2048;static VERTICAL_RULE_VERTICAL_LINE_SUPERSMUSH=4096;static _(t){return 0!==t.fullLayout?63&t.fullLayout:t.oldLayout>0?63&t.oldLayout:0}static m(t){return 7936&t.fullLayout}static I(t,e,n,r){return" "===t?e:" "===e?t:0===r?this.L(t,e,n):(0!==(r&this.RULE_EQUAL_CHARACTER)?this.C(t,e,n):null)??(0!==(r&this.RULE_UNDERSCORE)?this.R(t,e):null)??(0!==(r&this.RULE_HIERARCHY)?this.v(t,e):null)??(0!==(r&this.RULE_OPPOSITE_PAIR)?this.A(t,e):null)??(0!==(r&this.RULE_BIG_X)?this.F(t,e):null)??(0!==(r&this.RULE_HARDBLANK)?this.T(t,e,n):null)}static L(t,e,n){return" "===t?e:" "===e?t:e}static U(t,e,n){return" "===t?e:" "===e?t:0===n?this.L(t,e," "):(0!==(n&this.VERTICAL_RULE_EQUAL_CHARACTER)?this.C(t,e," "):null)??(0!==(n&this.VERTICAL_RULE_UNDERSCORE)?this.R(t,e):null)??(0!==(n&this.VERTICAL_RULE_HIERARCHY)?this.v(t,e):null)??(0!==(n&this.VERTICAL_RULE_HORIZONTAL_LINE)?this.S(t,e):null)??(0!==(n&this.VERTICAL_RULE_VERTICAL_LINE_SUPERSMUSH)?this.$(t,e):null)}static C(t,e,n){return t===e&&t!==n?t:null}static R(t,e){const n="|/\\[]{}()<>";return"_"===t&&n.includes(e)?e:"_"===e&&n.includes(t)?t:null}static v(t,e){const n=["|","/\\","[]","{}","()","<>"],r=n.findIndex(e=>e.includes(t)),i=n.findIndex(t=>t.includes(e));return-1===r||-1===i||r===i?null:r>i?t:e}static A(t,e){return["[]","][","{}","}{","()",")("].includes(`${t}${e}`)?"|":null}static F(t,e){const n=`${t}${e}`;return"/\\"===n?"|":"\\/"===n?"Y":"><"===n?"X":null}static T(t,e,n){return t===n&&e===n?n:null}static S(t,e){const n=`${t}${e}`;return"-_"===n||"_-"===n?"=":null}static $(t,e){return"|"===t&&"|"===e?"|":null}},o=class{H;M;k;constructor(t){this.H=t,this.M=s._(t),this.k=s.m(t)}G(t,e){const n=t.map((t,e)=>({inputIndex:e,inputChar:String.fromCodePoint(t.code)})),r=this.O(t,n,e,0),i=Array.from({length:r.rows},()=>Array.from({length:r.cols},()=>" "));for(const s of r.cells)i[s.row][s.col]=s.char;return i}O(t,e,n,r){if(0===t.length)return{lineIndex:r,cells:[],cols:0,rows:this.H.height};let i=this.N(t[0],e[0],r),o=t[0].width;for(let a=1;a<t.length;a+=1){const c=t[a],l=e[a]??{inputIndex:a,inputChar:String.fromCodePoint(c.code)},u=o-this.V(i,o,c,n),h=Math.max(o,u+c.width),f=i.map(t=>Array.from({length:h},(e,n)=>t[n]));for(let t=0;t<this.H.height;t+=1){const e=c.lines[t]??"",n=f[t];for(let i=0;i<c.width;i+=1){const o=e[i]??" ";if(" "===o)continue;const a=u+i,h=n[a],f=this.P(a,t,i,r,c,l,o);if(!h){n[a]=f;continue}const d=s.I(h.char,o,this.H.hardblank,this.M);n[a]=this.B(h,f,d??o)}}i=f,o=h}return this.D(i,o,r)}j(t,e){if(0===t.length)return{cells:[],lines:[],cols:0,rows:0};let n=this.W(t[0]),r=t[0].cols,i=t[0].rows;const o=[this.q(t[0],0)];for(let a=1;a<t.length;a+=1){const c=t[a],l=i-this.X(n,i,r,c,e),u=Math.max(r,c.cols),h=Math.max(i,l+c.rows),f=Array.from({length:h},(t,e)=>Array.from({length:u},(t,r)=>n[e]?.[r]));for(const t of c.cells){const e=l+t.row,n=t.col,r=f[e]?.[n];if(!r){f[e][n]={...t,row:e};continue}const i=s.U(r.char,t.char,this.k);f[e][n]=this.B(r,{...t,row:e},i??t.char)}n=f,r=u,i=h,o.push(this.q(c,l))}return this.Y(n,r,i,o)}V(t,e,n,r){if("full"===r)return 0;for(let i=e;i>=0;i-=1){let s=!0;for(let o=0;o<this.H.height&&s;o+=1){const a=t[o]??[],c=n.lines[o]??"";for(let t=0;t<i;t+=1){const n=a[e-i+t]?.char??" ",o=c[t]??" ";if(!this.J(n,o,r)){s=!1;break}}}if(s)return i}return 0}J(t,e,n){return" "===t||" "===e||"fitted"!==n&&null!==s.I(t,e,this.H.hardblank,this.M)}N(t,e={inputIndex:0,inputChar:String.fromCodePoint(t.code)},n=0){return Array.from({length:this.H.height},(r,i)=>{const s=t.lines[i]??"";return Array.from({length:t.width},(r,o)=>{const a=s[o]??" ";return" "===a?void 0:this.P(o,i,o,n,t,e,a)})})}P(t,e,n,r,i,s,o){return{char:o,col:t,row:e,inputIndex:s.inputIndex,inputChar:s.inputChar,figCharCode:i.code,subRow:e,subCol:n,lineIndex:r}}B(t,e,n){return n===t.char?t:{...e,char:n}}D(t,e,n){const r=[];for(let i=0;i<this.H.height;i+=1){const s=t[i]??[];for(let t=0;t<e;t+=1){const e=s[t];e&&e.char!==this.H.hardblank&&r.push({...e,col:t,row:i,lineIndex:n})}}return{lineIndex:n,cells:r,cols:e,rows:this.H.height}}X(t,e,n,r,i){if("full"===i)return 0;const s=this.W(r),o=Math.min(e,r.rows),a=Math.max(n,r.cols);for(let c=o;c>=0;c-=1){let n=!0;for(let r=0;r<c&&n;r+=1){const o=t[e-c+r]??[],l=s[r]??[];for(let t=0;t<a;t+=1){const e=o[t]?.char??" ",r=l[t]?.char??" ";if(!this.K(e,r,i)){n=!1;break}}}if(n)return c}return 0}K(t,e,n){return" "===t||" "===e||"fitted"!==n&&null!==s.U(t,e,this.k)}W(t){const e=Array.from({length:t.rows},()=>Array.from({length:t.cols},()=>{}));for(const n of t.cells)e[n.row][n.col]=n;return e}q(t,e){return{...t,cells:t.cells.map(t=>({...t,row:t.row+e}))}}Y(t,e,n,r){const i=[];for(let s=0;s<n;s+=1)for(let n=0;n<e;n+=1){const e=t[s]?.[n];e&&i.push({...e,row:s,col:n})}return{cells:i,lines:r,cols:e,rows:n}}},a=class{Z=new Set;tt(t){this.Z.add(t)}dispose(){for(const t of this.Z)t();this.Z.clear()}},c=class t extends a{et;H;nt;rt;constructor(t,e,n){super(),this.et=t,this.H=e,this.nt=n,this.rt=new o(e)}static async it(t){const e=await fetch(t);if(!e.ok)throw new n("Failed to load FIGfont file.",{source:String(t),status:e.status,statusText:e.statusText});const r=await e.text();return this.st(this.ot(t),r)}static st(e,n){const r=i.t(n);return new t(e,r.header,r.characters)}getCharacter(t){const e="number"==typeof t?t:Array.from(t)[0]?.codePointAt(0);if(void 0!==e)return l(this.nt.get(e))}planText(t,e={}){const n=e.horizontalLayout??this.defaultLayout,r=e.verticalLayout??this.defaultVerticalLayout,i=this.ct(e.direction),s=this.lt(t).map(t=>this.ut(t,i)).flatMap(t=>this.ht(t,n,e)).map((t,e)=>{const r=this.ft(t);return this.rt.O(r.map(t=>t.figChar),r.map(({inputChar:t,inputIndex:e})=>({inputChar:t,inputIndex:e})),n,e)}),o=this.rt.j(s,r);return{cells:o.cells,lines:o.lines,cols:o.cols,rows:o.rows,direction:i}}renderText(t,e={}){const n=this.planText(t,e),r=Array.from({length:n.rows},()=>Array.from({length:n.cols},()=>" "));for(const i of n.cells)r[i.row][i.col]=i.char;return{grid:r,cols:n.cols,rows:n.rows}}measureText(t,e={}){const n=this.planText(t,e);return{cols:n.cols,rows:n.rows}}get name(){return this.et}get header(){return{...this.H}}get characters(){return new Map(Array.from(this.nt,([t,e])=>[t,l(e)]))}get hardblank(){return this.H.hardblank}get height(){return this.H.height}get baseline(){return this.H.baseline}get defaultLayout(){return 128&this.H.fullLayout?"smushed":64&this.H.fullLayout?"fitted":-1===this.H.oldLayout?"full":0===this.H.oldLayout?"fitted":this.H.oldLayout>0?"smushed":"full"}get defaultPrintDirection(){return 1===this.H.printDirection?"rtl":"ltr"}get defaultVerticalLayout(){return 16384&this.H.fullLayout?"smushed":8192&this.H.fullLayout?"fitted":"full"}static ot(t){const e=t instanceof URL?t.pathname:t,n=(e.split(/[?#]/,1)[0]??e).split("/").filter(Boolean).pop()??"figfont";return n.toLowerCase().endsWith(".flf")?n.slice(0,-4)||"figfont":n}lt(t){const e=[[]];for(const[n,r]of Array.from(t).entries())"\n"!==r?e[e.length-1].push({character:r,inputIndex:n}):e.push([]);return e}ut(t,e){return"rtl"===e?[...t].reverse():t}ft(t){const e=t.map(({character:t,inputIndex:e})=>({figChar:this.getCharacter(t)??this.getCharacter(32),inputChar:t,inputIndex:e})),r=e.find(t=>void 0===t.figChar);if(r)throw new n("FIGfont is missing a required character for layout.",{character:r.inputChar,index:r.inputIndex});return e}ht(t,e,n){const r="number"==typeof n.maxCols&&Number.isFinite(n.maxCols)?Math.floor(n.maxCols):void 0,i=n.wrap??"none";return 0===t.length||!r||r<1||"none"===i?[t]:"char"===i?this.dt(t,e,r):this.gt(t,e,r)}gt(t,e,n){const r=this._t(t);if(!r.some(t=>!t.isWhitespace))return[t];const i=[];let s=[],o=[];for(const a of r){if(a.isWhitespace){s.length>0&&(o=a.characters);continue}const t=0===s.length?a.characters:s.concat(o,a.characters);s.length>0&&this.wt(t,e)>n?(i.push(s),s=a.characters.slice()):s=t,o=[]}return 0===s.length?[[]]:(i.push(s),i)}dt(t,e,n){const r=[];let i=[];for(const s of t){const t=i.concat(s);i.length>0&&this.wt(t,e)>n?(r.push(i),i=[s]):i=t}return 0===i.length?[[]]:(r.push(i),r)}wt(t,e){const n=this.ft(t);return this.rt.O(n.map(t=>t.figChar),n.map(({inputChar:t,inputIndex:e})=>({inputChar:t,inputIndex:e})),e,0).cols}_t(t){const e=[];for(const n of t){const t=/\s/u.test(n.character),r=e[e.length-1];r&&r.isWhitespace===t?r.characters.push(n):e.push({isWhitespace:t,characters:[n]})}return e}ct(t){return"ltr"===t||"rtl"===t?t:this.defaultPrintDirection}};function l(t){if(t)return{...t,lines:[...t.lines]}}var u=Symbol.for("textmode.figlet.state");function h(t){const e=t;return e[u]||(e[u]={activeFont:void 0,align:"left",baseline:"baseline"}),e[u]}var f=["loadFigFont","parseFigFont","figFont","figText","figTextWidth","figTextHeight","figTextBounds","figTextAlign","figTextBaseline"];function d(t,e){if(void 0!==t)return"function"==typeof t?t(e):t}function g(t,n,r){return r instanceof e.color.TextmodeColor||"string"==typeof r||"number"==typeof r?"charColor"===n?void t.charColor(r):void t.cellColor(r):4===r.length?"charColor"===n?void t.charColor(r[0],r[1],r[2],r[3]):void t.cellColor(r[0],r[1],r[2],r[3]):void("charColor"!==n?t.cellColor(r[0],r[1],r[2]):t.charColor(r[0],r[1],r[2]))}function p(t){const e=h(t).activeFont;if(!e)throw new n("No FIGlet font is active. Call figFont() first.");return e}function _(t,e){t.It?.(e)}function w(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0,enumerable:!1})}var m={name:"textmode.figlet.js",version:"1.0.3-beta.1",install(t,e){!function(t){w(t,"loadFigFont",async function(t){const e=await c.it(t);return _(this,e),e}),w(t,"parseFigFont",function(t,e){const n=c.st(t,e);return _(this,n),n}),w(t,"figFont",function(t){const e=h(this);if(void 0===t)return e.activeFont;e.activeFont=t}),w(t,"figText",function(t,e,n,r={}){const i=p(this),s=i.planText(t,r),o=h(this),a=e+(c=s.cols,"center"===(l=o.align)?-Math.floor(c/2):"right"===l?-(c-1):0);var c,l;const u=n+(f=s.rows,_=i.baseline,"top"===(w=o.baseline)?0:"center"===w?-Math.floor(f/2):"bottom"===w?-(f-1):-(_-1));var f,_,w;this.push(),this.translate(a,u,0);for(const h of s.cells){this.push(),this.translate(h.col,h.row,0);const t=d(r.charColor,h),e=d(r.cellColor,h);this.char(h.char),void 0!==t&&g(this,"charColor",t),void 0!==e&&g(this,"cellColor",e),this.point(),this.pop()}this.pop()}),w(t,"figTextWidth",function(t,e={}){return p(this).measureText(t,e).cols}),w(t,"figTextHeight",function(t,e={}){return p(this).measureText(t,e).rows}),w(t,"figTextBounds",function(t,e={}){return p(this).measureText(t,e)}),w(t,"figTextAlign",function(t){const e=h(this);if(void 0===t)return e.align;e.align=t}),w(t,"figTextBaseline",function(t){const e=h(this);if(void 0===t)return e.baseline;e.baseline=t})}(t)},uninstall(t,e){!function(t){for(const e of f)delete t[e];!function(t){delete t[u]}(t)}(t)}};if("undefined"!=typeof window){const t=window;t.FigletPlugin=m,t.TextmodeFigFont=c,t.FigFontParser=i,t.FigLayoutEngine=o,t.FigSmushRules=s,t.FIGFONT_REQUIRED_CODEPOINTS=r}t.FIGFONT_REQUIRED_CODEPOINTS=r,t.FigFontParser=i,t.FigLayoutEngine=o,t.FigSmushRules=s,t.FigletPlugin=m,t.TextmodeFigFont=c});
@@ -3,4 +3,3 @@
3
3
  */
4
4
  import './textmode';
5
5
  export type { TextmodifierFigletExtensions } from './textmode';
6
- //# sourceMappingURL=index.d.ts.map
@@ -7,6 +7,8 @@ import type { FigTextAlign, FigTextBaseline, FigTextOptions } from '../figfont';
7
7
  * FIGlet methods added to the `textmode.js` `Textmodifier` API when
8
8
  * {@link FigletPlugin} is installed.
9
9
  *
10
+ * @category Textmodifier extensions
11
+ *
10
12
  * @see {@link https://code.textmode.art/api/textmode.figlet.js/interfaces/TextmodifierFigletExtensions | TextmodifierFigletExtensions API reference}
11
13
  */
12
14
  export interface TextmodifierFigletExtensions {
@@ -153,4 +155,3 @@ declare module 'textmode.js' {
153
155
  interface Textmodifier extends TextmodifierFigletExtensions {
154
156
  }
155
157
  }
156
- //# sourceMappingURL=textmode.d.ts.map
@@ -12,4 +12,3 @@ export declare class FigletError extends Error {
12
12
  private static formatMessage;
13
13
  private static formatValue;
14
14
  }
15
- //# sourceMappingURL=FigletError.d.ts.map
@@ -2,4 +2,3 @@
2
2
  * Textmodifier extension exports.
3
3
  */
4
4
  export { installTextmodifierFigletExtensions, uninstallTextmodifierFigletExtensions } from './textmodifier';
5
- //# sourceMappingURL=index.d.ts.map
@@ -11,4 +11,3 @@ export declare function installTextmodifierFigletExtensions(textmodifier: Textmo
11
11
  * @param textmodifier Target instance.
12
12
  */
13
13
  export declare function uninstallTextmodifierFigletExtensions(textmodifier: Textmodifier): void;
14
- //# sourceMappingURL=textmodifier.d.ts.map
@@ -26,4 +26,3 @@ export declare class FigFontParser {
26
26
  private static _parseIntegerToken;
27
27
  private static escapeForRegExp;
28
28
  }
29
- //# sourceMappingURL=FigFontParser.d.ts.map
@@ -43,4 +43,3 @@ export declare class FigLayoutEngine {
43
43
  private _materializePlan;
44
44
  }
45
45
  export {};
46
- //# sourceMappingURL=FigLayoutEngine.d.ts.map
@@ -49,4 +49,3 @@ export declare class FigSmushRules {
49
49
  static _verticalRule4HorizontalLine(top: string, bottom: string): string | null;
50
50
  static _verticalRule5VerticalLineSupersmush(top: string, bottom: string): string | null;
51
51
  }
52
- //# sourceMappingURL=FigSmushRules.d.ts.map
@@ -3,6 +3,8 @@ import type { FigCharacter, FigFontHeader, FigHorizontalLayout, FigRenderPlan, F
3
3
  /**
4
4
  * Parsed FIGfont resource used by `figText()` rendering.
5
5
  *
6
+ * @category FIGfont resources
7
+ *
6
8
  * @see {@link https://code.textmode.art/api/textmode.figlet.js/classes/TextmodeFigFont | TextmodeFigFont API reference}
7
9
  */
8
10
  export declare class TextmodeFigFont extends Disposable {
@@ -164,4 +166,3 @@ export declare class TextmodeFigFont extends Disposable {
164
166
  private _tokenizeByWhitespace;
165
167
  private _resolveDirection;
166
168
  }
167
- //# sourceMappingURL=TextmodeFigFont.d.ts.map
@@ -4,4 +4,3 @@ export { FigSmushRules } from './FigSmushRules';
4
4
  export { TextmodeFigFont } from './TextmodeFigFont';
5
5
  export type { FigCharacter, FigFontHeader, FigHorizontalLayout, FigPrintDirection, FigRenderCell, FigRenderLine, FigRenderPlan, FigTextAlign, FigTextBaseline, FigTextCellContext, FigTextColorResolver, FigTextColorValue, FigTextOptions, FigTextResult, FigVerticalLayout, FigWrapMode, ParsedFigFontData, } from './types';
6
6
  export { FIGFONT_REQUIRED_CODEPOINTS } from './types';
7
- //# sourceMappingURL=index.d.ts.map
@@ -9,6 +9,8 @@ export declare const FIGFONT_REQUIRED_CODEPOINTS: readonly number[];
9
9
  /**
10
10
  * Parsed FIGfont header metadata from the `.flf` header line.
11
11
  *
12
+ * @category FIGfont resources
13
+ *
12
14
  * @see {@link https://code.textmode.art/api/textmode.figlet.js/interfaces/FigFontHeader | FigFontHeader API reference}
13
15
  */
14
16
  export interface FigFontHeader {
@@ -76,6 +78,8 @@ export interface FigFontHeader {
76
78
  /**
77
79
  * A single parsed FIGcharacter from a FIGfont.
78
80
  *
81
+ * @category FIGfont resources
82
+ *
79
83
  * @see {@link https://code.textmode.art/api/textmode.figlet.js/interfaces/FigCharacter | FigCharacter API reference}
80
84
  */
81
85
  export interface FigCharacter {
@@ -110,36 +114,48 @@ export interface ParsedFigFontData {
110
114
  /**
111
115
  * Supported horizontal layout modes for FIGlet rendering.
112
116
  *
117
+ * @category Layout and rendering
118
+ *
113
119
  * @see {@link https://code.textmode.art/api/textmode.figlet.js/type-aliases/FigHorizontalLayout | FigHorizontalLayout API reference}
114
120
  */
115
121
  export type FigHorizontalLayout = 'full' | 'fitted' | 'smushed';
116
122
  /**
117
123
  * Supported vertical layout modes for multi-line FIGlet rendering.
118
124
  *
125
+ * @category Layout and rendering
126
+ *
119
127
  * @see {@link https://code.textmode.art/api/textmode.figlet.js/type-aliases/FigVerticalLayout | FigVerticalLayout API reference}
120
128
  */
121
129
  export type FigVerticalLayout = 'full' | 'fitted' | 'smushed';
122
130
  /**
123
131
  * Supported wrap modes for FIGlet text layout.
124
132
  *
133
+ * @category Layout and rendering
134
+ *
125
135
  * @see {@link https://code.textmode.art/api/textmode.figlet.js/type-aliases/FigWrapMode | FigWrapMode API reference}
126
136
  */
127
137
  export type FigWrapMode = 'none' | 'word' | 'char';
128
138
  /**
129
139
  * Supported print directions for FIGlet text layout.
130
140
  *
141
+ * @category Layout and rendering
142
+ *
131
143
  * @see {@link https://code.textmode.art/api/textmode.figlet.js/type-aliases/FigPrintDirection | FigPrintDirection API reference}
132
144
  */
133
145
  export type FigPrintDirection = 'font' | 'ltr' | 'rtl';
134
146
  /**
135
147
  * Accepted color input for per-cell FIGlet styling.
136
148
  *
149
+ * @category Styling
150
+ *
137
151
  * @see {@link https://code.textmode.art/api/textmode.figlet.js/type-aliases/FigTextColorValue | FigTextColorValue API reference}
138
152
  */
139
153
  export type FigTextColorValue = number | string | color.TextmodeColor | [number, number, number] | [number, number, number, number];
140
154
  /**
141
155
  * Public cell metadata exposed to FIGlet styling callbacks.
142
156
  *
157
+ * @category Styling
158
+ *
143
159
  * @see {@link https://code.textmode.art/api/textmode.figlet.js/interfaces/FigTextCellContext | FigTextCellContext API reference}
144
160
  */
145
161
  export interface FigTextCellContext {
@@ -201,12 +217,16 @@ export interface FigTextCellContext {
201
217
  /**
202
218
  * Resolver for per-cell FIGlet colors.
203
219
  *
220
+ * @category Styling
221
+ *
204
222
  * @see {@link https://code.textmode.art/api/textmode.figlet.js/type-aliases/FigTextColorResolver | FigTextColorResolver API reference}
205
223
  */
206
224
  export type FigTextColorResolver = FigTextColorValue | ((cell: FigTextCellContext) => FigTextColorValue | undefined);
207
225
  /**
208
226
  * Layout options for rendering FIGlet text.
209
227
  *
228
+ * @category Layout and rendering
229
+ *
210
230
  * @see {@link https://code.textmode.art/api/textmode.figlet.js/interfaces/FigTextOptions | FigTextOptions API reference}
211
231
  */
212
232
  export interface FigTextOptions {
@@ -307,13 +327,16 @@ export interface FigTextResult {
307
327
  /**
308
328
  * Horizontal alignment options for `figText()` placement.
309
329
  *
330
+ * @category Layout and rendering
331
+ *
310
332
  * @see {@link https://code.textmode.art/api/textmode.figlet.js/type-aliases/FigTextAlign | FigTextAlign API reference}
311
333
  */
312
334
  export type FigTextAlign = 'left' | 'center' | 'right';
313
335
  /**
314
336
  * Vertical alignment options for `figText()` placement.
315
337
  *
338
+ * @category Layout and rendering
339
+ *
316
340
  * @see {@link https://code.textmode.art/api/textmode.figlet.js/type-aliases/FigTextBaseline | FigTextBaseline API reference}
317
341
  */
318
342
  export type FigTextBaseline = 'top' | 'center' | 'bottom' | 'baseline';
319
- //# sourceMappingURL=types.d.ts.map
@@ -1,8 +1,46 @@
1
1
  /**
2
- * `textmode.figlet.js` package entrypoint.
2
+ * @packageDocumentation
3
+ *
4
+ * Add FIGlet display typography to a textmode.js sketch.
5
+ *
6
+ * Install {@link FigletPlugin} to add FIGfont loading, selection, drawing, and
7
+ * measurement helpers to the sketch's `Textmodifier`. Use
8
+ * {@link TextmodeFigFont} when you need to inspect a parsed font, plan its
9
+ * layout, or render it without drawing to the canvas.
10
+ *
11
+ * ## Sketch workflow
12
+ *
13
+ * 1. Add {@link FigletPlugin} to the sketch's plugins.
14
+ * 2. Load a `.flf` file with {@link TextmodifierFigletExtensions.loadFigFont}
15
+ * or parse raw font data with {@link TextmodifierFigletExtensions.parseFigFont}.
16
+ * 3. Select the returned font with {@link TextmodifierFigletExtensions.figFont}.
17
+ * 4. Draw with {@link TextmodifierFigletExtensions.figText}, or measure first
18
+ * with its width, height, and bounds helpers.
19
+ *
20
+ * {@link FigTextOptions} controls layout, wrapping, direction, and per-cell
21
+ * colors. Use {@link TextmodeFigFont} for reusable FIGfont resources and
22
+ * lower-level planning.
23
+ *
24
+ * @categoryDescription FIGfont resources
25
+ * Parsed FIGfont resources and metadata for inspecting characters and
26
+ * font-defined defaults.
27
+ *
28
+ * @categoryDescription Layout and rendering
29
+ * Options and value types that control FIGlet composition, wrapping,
30
+ * direction, and placement.
31
+ *
32
+ * @categoryDescription Styling
33
+ * Per-cell color values and callback context for styling rendered FIGlet text.
34
+ *
35
+ * @categoryDescription Textmodifier extensions
36
+ * Methods that {@link FigletPlugin} adds to a textmode.js sketch.
37
+ *
38
+ * @categoryDescription Workflow
39
+ * The plugin entrypoint that enables the FIGlet sketch workflow.
40
+ *
41
+ * @showCategories
3
42
  */
4
43
  import './augmentations';
5
44
  export { FigletPlugin } from './plugin';
6
45
  export type { TextmodifierFigletExtensions } from './augmentations';
7
46
  export * from './figfont';
8
- //# sourceMappingURL=index.d.ts.map
@@ -2,10 +2,11 @@ import type { TextmodePlugin } from 'textmode.js';
2
2
  /**
3
3
  * Plugin entrypoint for the FIGlet add-on.
4
4
  *
5
+ * @category Workflow
6
+ *
5
7
  * @example
6
8
  * {@includeCode ../../examples/FigletPlugin/init/sketch.js}
7
9
  *
8
10
  * @see {@link https://code.textmode.art/api/textmode.figlet.js/variables/FigletPlugin | FigletPlugin API reference}
9
11
  */
10
12
  export declare const FigletPlugin: TextmodePlugin;
11
- //# sourceMappingURL=FigletPlugin.d.ts.map
@@ -2,4 +2,3 @@
2
2
  * Plugin module exports.
3
3
  */
4
4
  export { FigletPlugin } from './FigletPlugin';
5
- //# sourceMappingURL=index.d.ts.map
@@ -26,4 +26,3 @@ export declare function getFigletState(textmodifier: Textmodifier): FigletPlugin
26
26
  * @param textmodifier Target instance.
27
27
  */
28
28
  export declare function clearFigletState(textmodifier: Textmodifier): void;
29
- //# sourceMappingURL=figletState.d.ts.map
@@ -14,4 +14,3 @@ export declare class Disposable {
14
14
  */
15
15
  dispose(): void;
16
16
  }
17
- //# sourceMappingURL=Disposable.d.ts.map
package/package.json CHANGED
@@ -1,8 +1,20 @@
1
1
  {
2
2
  "name": "textmode.figlet.js",
3
- "version": "1.0.2",
3
+ "version": "1.0.3-beta.1",
4
4
  "description": "FIGlet font support for textmode.js",
5
5
  "type": "module",
6
+ "devEngines": {
7
+ "runtime": {
8
+ "name": "node",
9
+ "version": "^24.0.0",
10
+ "onFail": "error"
11
+ },
12
+ "packageManager": {
13
+ "name": "npm",
14
+ "version": "^11.0.0",
15
+ "onFail": "error"
16
+ }
17
+ },
6
18
  "main": "./dist/textmode.figlet.umd.js",
7
19
  "module": "./dist/textmode.figlet.esm.js",
8
20
  "types": "./dist/types/index.d.ts",
@@ -23,64 +35,58 @@
23
35
  "scripts": {
24
36
  "dev": "vite --port 5175 --host",
25
37
  "build:bundle": "vite build",
26
- "build:types": "tsc",
38
+ "build:types": "textmode-types build",
27
39
  "build": "npm run build:bundle && npm run build:types",
28
- "check": "npm run check:format && npm run lint && npm run lint:md && npm run check:types && npm run check:api-docs && npm run check:examples && npm run test && npm run build",
29
- "docs:links:add": "node ./scripts/add-api-doc-links.mjs",
30
- "check:api-docs": "node ./scripts/check-public-api-docs.mjs",
31
- "check:examples": "node ./scripts/check-examples.mjs",
32
- "dev:docs": "typedoc --watch",
33
- "build:docs": "typedoc",
40
+ "check": "textmode-project check",
41
+ "docs:links:add": "textmode-docs links add",
42
+ "docs:api:check": "textmode-docs api-check",
43
+ "docs:check": "textmode-docs check",
44
+ "docs:dev": "textmode-docs watch",
45
+ "docs:build": "textmode-docs build",
34
46
  "preview": "vite preview",
35
47
  "test": "vitest run",
36
48
  "test:watch": "vitest",
37
- "test:ui": "vitest --ui",
38
- "test:coverage": "vitest --coverage",
39
49
  "test:unit": "vitest run --project unit",
40
50
  "test:integration": "vitest run --project integration",
41
- "format": "prettier --write .",
42
- "check:format": "prettier --check .",
43
- "check:types": "tsc --noEmit",
44
- "lint:md": "markdownlint-cli2",
45
- "lint:md:fix": "markdownlint-cli2 --fix",
46
- "lint": "eslint src --config eslint.config.js",
47
- "prepare": "husky"
51
+ "format": "prettier --write . --ignore-unknown",
52
+ "format:check": "prettier --check . --ignore-unknown",
53
+ "typecheck": "textmode-types check",
54
+ "types:verify": "textmode-types verify",
55
+ "lint:markdown": "markdownlint-cli2 --config package.json --configPointer /markdownlint-cli2",
56
+ "lint:markdown:fix": "markdownlint-cli2 --config package.json --configPointer /markdownlint-cli2 --fix",
57
+ "lint": "eslint src",
58
+ "prepare": "install-git-hooks",
59
+ "prepack": "textmode-project prepack",
60
+ "release": "semantic-release"
48
61
  },
49
62
  "peerDependencies": {
50
- "textmode.js": ">=0.11.0"
63
+ "textmode.js": ">=0.16.0"
51
64
  },
52
65
  "devDependencies": {
53
- "@commitlint/cli": "^20.5.0",
54
- "@commitlint/config-conventional": "^20.5.0",
55
- "@eslint/js": "^9.39.4",
56
- "@rollup/plugin-terser": "^0.4.4",
57
- "@semantic-release/commit-analyzer": "^13.0.1",
58
- "@semantic-release/exec": "^7.1.0",
59
- "@semantic-release/git": "^10.0.1",
60
- "@semantic-release/github": "^12.0.6",
61
- "@semantic-release/npm": "^13.1.5",
62
- "@semantic-release/release-notes-generator": "^14.1.0",
63
- "@types/node": "^24.0.13",
64
- "@vitest/ui": "^3.1.2",
65
- "eslint": "^9.39.2",
66
- "eslint-plugin-jsdoc": "^62.9.0",
67
- "globals": "^17.5.0",
68
- "husky": "^9.1.7",
69
- "jsdom": "^26.1.0",
70
- "lint-staged": "^16.4.0",
66
+ "@commitlint/cli": "^21.2.1",
67
+ "@textmode/commitlint-config": "^0.1.1",
68
+ "@textmode/docs": "^0.2.2",
69
+ "@textmode/eslint-config": "^0.2.0",
70
+ "@textmode/markdownlint-config": "^0.1.1",
71
+ "@textmode/prettier-config": "^0.1.0",
72
+ "@textmode/release-config": "^0.1.2",
73
+ "@textmode/tooling-scripts": "^0.5.0",
74
+ "@textmode/tsconfig": "^0.2.0",
75
+ "@textmode/vite-config": "^0.1.0",
76
+ "@textmode/vitest-config": "^0.2.1",
77
+ "@types/node": "^24.0.0",
78
+ "@vitest/ui": "^4.1.10",
79
+ "eslint": "^10.6.0",
80
+ "jsdom": "^30.0.0",
81
+ "lint-staged": "^17.0.8",
71
82
  "markdownlint-cli2": "^0.22.1",
72
- "markdownlint-cli2-formatter-default": "^0.0.6",
73
- "prettier": "^3.8.3",
74
- "semantic-release": "^25.0.3",
75
- "textmode.js": "^0.16.0",
76
- "typedoc": "^0.28.19",
77
- "typedoc-plugin-frontmatter": "^1.3.1",
78
- "typedoc-plugin-markdown": "^4.11.0",
79
- "typedoc-vitepress-theme": "^1.1.2",
80
- "typescript": "^5.9.2",
81
- "typescript-eslint": "^8.59.0",
82
- "vite": "^6.3.4",
83
- "vitest": "^3.1.2"
83
+ "prettier": "^3.9.4",
84
+ "semantic-release": "^25.0.5",
85
+ "terser": "^5.46.1",
86
+ "textmode.js": "^0.17.0-beta.2",
87
+ "typescript": "^6.0.3",
88
+ "vite": "^8.1.3",
89
+ "vitest": "^4.1.10"
84
90
  },
85
91
  "keywords": [
86
92
  "ascii",
@@ -96,11 +102,41 @@
96
102
  "lint-staged": {
97
103
  "*": "prettier --ignore-unknown --write"
98
104
  },
105
+ "prettier": "@textmode/prettier-config",
106
+ "commitlint": {
107
+ "extends": [
108
+ "@textmode/commitlint-config"
109
+ ]
110
+ },
99
111
  "repository": {
100
112
  "type": "git",
101
113
  "url": "git+https://github.com/humanbydefinition/textmode.figlet.js.git"
102
114
  },
103
115
  "bugs": {
104
116
  "url": "https://github.com/humanbydefinition/textmode.figlet.js/issues"
117
+ },
118
+ "markdownlint-cli2": {
119
+ "globs": [
120
+ "**/*.md"
121
+ ],
122
+ "ignores": [
123
+ "api/**",
124
+ "node_modules/**",
125
+ "dist/**",
126
+ "examples/**/*.md",
127
+ "**/CHANGELOG.md"
128
+ ],
129
+ "fix": false,
130
+ "outputFormatters": [
131
+ [
132
+ "markdownlint-cli2-formatter-default"
133
+ ]
134
+ ],
135
+ "config": {
136
+ "extends": "@textmode/markdownlint-config"
137
+ }
138
+ },
139
+ "release": {
140
+ "extends": "@textmode/release-config"
105
141
  }
106
142
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/augmentations/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,YAAY,CAAC;AAEpB,YAAY,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"textmode.d.ts","sourceRoot":"","sources":["../../../src/augmentations/textmode.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEhF;;;;;GAKG;AACH,MAAM,WAAW,4BAA4B;IAC5C;;;;;;;;;;OAUG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAE5D;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,eAAe,CAAC;IAE1D;;;;;;;;;OASG;IACH,OAAO,IAAI,eAAe,GAAG,SAAS,CAAC;IAEvC;;;;;;OAMG;IACH,OAAO,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,CAAC;IAErC;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAEhF;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;IAE7D;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;IAE9D;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAEtF;;;;;;;;;OASG;IACH,YAAY,IAAI,YAAY,CAAC;IAE7B;;;;;;OAMG;IACH,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IAExC;;;;;;;;;OASG;IACH,eAAe,IAAI,eAAe,CAAC;IAEnC;;;;;;OAMG;IACH,eAAe,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;CACjD;AAED,OAAO,QAAQ,aAAa,CAAC;IAC5B,UAAU,YAAa,SAAQ,4BAA4B;KAAG;CAC9D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"FigletError.d.ts","sourceRoot":"","sources":["../../../src/error/FigletError.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACrC;;;;;OAKG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAK9D,OAAO,CAAC,MAAM,CAAC,aAAa;IAY5B,OAAO,CAAC,MAAM,CAAC,WAAW;CAgB1B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mCAAmC,EAAE,qCAAqC,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"textmodifier.d.ts","sourceRoot":"","sources":["../../../src/extensions/textmodifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAqIhD;;;;GAIG;AACH,wBAAgB,mCAAmC,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAyGpF;AAED;;;;GAIG;AACH,wBAAgB,qCAAqC,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAMtF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"FigFontParser.d.ts","sourceRoot":"","sources":["../../../src/figfont/FigFontParser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA+B,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG9E;;;;GAIG;AACH,qBAAa,aAAa;IACzB;;;;;OAKG;WACW,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB;IA+BrD;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;IA8C3B,OAAO,CAAC,MAAM,CAAC,wBAAwB;IAiBvC,OAAO,CAAC,MAAM,CAAC,0BAA0B;IAwBzC,OAAO,CAAC,MAAM,CAAC,cAAc;IAgD7B,OAAO,CAAC,MAAM,CAAC,aAAa;IAkB5B,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAQjC,OAAO,CAAC,MAAM,CAAC,eAAe;CAG9B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"FigLayoutEngine.d.ts","sourceRoot":"","sources":["../../../src/figfont/FigLayoutEngine.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,MAAM,SAAS,CAAC;AAEjB,UAAU,cAAc;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAA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AE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,YAAY,EACX,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,aAAa,EACb,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,iBAAiB,GACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/figfont/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,SAAS,MAAM,EASxD,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC7B;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC5B;;;;O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AE,CAAC;IACjB,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEvD;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,iBAAiB,CAAC;AAKzB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,YAAY,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AACpE,cAAc,WAAW,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"FigletPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugin/FigletPlugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAyB,MAAM,aAAa,CAAC;AAKzE;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,EAAE,cAW1B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugin/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"figletState.d.ts","sourceRoot":"","sources":["../../../src/state/figletState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,gBAAgB,eAAsC,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,eAAe,CAAC;CAC1B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,YAAY,EAAE,YAAY,GAAG,iBAAiB,CAc5E;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAEjE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Disposable.d.ts","sourceRoot":"","sources":["../../../src/utils/Disposable.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,UAAU;IACtB,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAyB;IAE7D;;;;OAIG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAIhD;;OAEG;IACI,OAAO,IAAI,IAAI;CAOtB"}