oxc-codegen 0.144.0 → 0.146.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,75 +1,154 @@
1
1
  # oxc-codegen
2
2
 
3
- A fast JavaScript code generator from an [ESTree](https://github.com/estree/estree)-compliant AST,
4
- written in TypeScript.
3
+ Fast, synchronous code generation for JavaScript and TypeScript ASTs.
5
4
 
6
- It is a faithful port of Oxc's Rust [`oxc_codegen`](https://github.com/oxc-project/oxc/tree/main/crates/oxc_codegen)
7
- crate (pretty-printing mode). Output is byte-identical to `oxc_codegen` with default options
8
- (tab indentation, double quotes, comments off).
5
+ `oxc-codegen` turns an [ESTree](https://github.com/estree/estree) or
6
+ [TS-ESTree](https://typescript-eslint.io/packages/typescript-estree/) AST into formatted source
7
+ code. It supports JavaScript, JSX, TypeScript, and TSX.
9
8
 
10
- Unlike the rest of Oxc's JS packages, this package contains no Rust and no native bindings.
11
- It is pure JavaScript, and consumes an AST which already lives on the JS side, so doesn't need
12
- to serialize it across a JS/native boundary. This is the key to `oxc-codegen`'s speed -
13
- along with many optimizations to hit JS engines' fast paths.
9
+ The printer is a port of Oxc's Rust `oxc_codegen` crate. With the default options, both printers
10
+ produce byte-identical output: tab indentation, double-quoted strings, and no comments.
14
11
 
15
- See [DESIGN.md](https://github.com/oxc-project/oxc/blob/main/packages/codegen/DESIGN.md) for more details
16
- on the implementation, and what makes it fast.
12
+ ## Installation
17
13
 
18
- 100% tests passing against Test262, Acorn-JSX, and TypeScript conformance suites (62,000 tests in total).
14
+ ```sh
15
+ npm install oxc-codegen
16
+ ```
17
+
18
+ `oxc-codegen` is ESM-only and requires Node.js `^20.19.0` or `>=22.12.0`.
19
19
 
20
- ## Usage
20
+ ## Quick start
21
+
22
+ Pair it with [`oxc-parser`](https://www.npmjs.com/package/oxc-parser) to parse and print source code:
21
23
 
22
24
  ```js
23
- import { parseSync } from "oxc-parser";
24
25
  import { printSync } from "oxc-codegen";
26
+ import { parseSync } from "oxc-parser";
27
+
28
+ const { program } = parseSync("input.js", "const answer=6*7");
29
+ const { code } = printSync(program);
25
30
 
26
- const { program } = parseSync("foo.js", "let x = 1");
27
- console.log(printSync(program));
31
+ console.log(code);
32
+ // const answer = 6 * 7;
28
33
  ```
29
34
 
30
- ## Supported language variants
35
+ You can also print a manually constructed AST:
31
36
 
32
- - JS
33
- - JSX
34
- - TS
35
- - TSX
37
+ ```js
38
+ const program = {
39
+ type: "Program",
40
+ sourceType: "script",
41
+ body: [
42
+ {
43
+ type: "ExpressionStatement",
44
+ expression: {
45
+ type: "CallExpression",
46
+ callee: {
47
+ type: "MemberExpression",
48
+ object: { type: "Identifier", name: "console" },
49
+ property: { type: "Identifier", name: "log" },
50
+ computed: false,
51
+ optional: false,
52
+ },
53
+ arguments: [{ type: "Literal", value: "Hello!" }],
54
+ optional: false,
55
+ },
56
+ },
57
+ ],
58
+ };
59
+
60
+ console.log(printSync(program).code);
61
+ // console.log("Hello!");
62
+ ```
63
+
64
+ ### TypeScript and TSX
65
+
66
+ Set `ts` when the AST can contain TypeScript nodes. For TSX, set both `ts` and `jsx`:
67
+
68
+ ```js
69
+ const { program } = parseSync("component.tsx", "const Box = <T,>(value: T) => <div>{value}</div>");
70
+
71
+ const { code } = printSync(program, {
72
+ ts: true,
73
+ jsx: true,
74
+ });
75
+ ```
36
76
 
37
77
  ## API
38
78
 
39
79
  ### `printSync(node, options?)`
40
80
 
41
- Returns a string containing the code for the AST `node`.
81
+ ```ts
82
+ function printSync(
83
+ node: ESTree.Program | ESTree.Statement,
84
+ options?: Options,
85
+ ): {
86
+ code: string;
87
+ map: SourceMap | null;
88
+ };
89
+ ```
90
+
91
+ Prints a complete `Program` or a single statement and returns the generated source code,
92
+ and (when requested) a standard Source Map v3 object.
93
+
94
+ ```js
95
+ import { printSync } from "oxc-codegen";
96
+ import { parseSync } from "oxc-parser";
97
+
98
+ const sourceText = "const answer=6*7";
99
+ const { program } = parseSync("input.js", sourceText);
100
+ const { code, map } = printSync(program, {
101
+ sourcemap: true,
102
+ sourceFilename: "input.js",
103
+ sourceText,
104
+ });
105
+ ```
42
106
 
43
- `node` must be a whole AST (`Program` node) or a statement node.
107
+ Source-map mappings require `sourceText` and nodes with valid Oxc `start` / `end` offsets.
108
+ A manually constructed AST without offsets can still be printed, but its source map has
109
+ an empty `mappings` string.
44
110
 
45
111
  ### Options
46
112
 
47
- | Option | Type | Default | Description |
48
- | :-------------------- | :------------------- | :------ | :---------------------------------------------- |
49
- | `indent` | `string` | `"\t"` | Indentation - spaces and/or tabs only |
50
- | `startingIndentLevel` | `number` | `0` | Indent level to start from |
51
- | `jsx` | `boolean` | `false` | `.tsx` mode - lone type parameters print `<T,>` |
52
- | `ts` | `boolean` | `false` | AST may contain TypeScript syntax |
53
- | `sourceMap` | `SourceMapGenerator` | - | If present, source mappings are emitted into it |
113
+ | Option | Type | Default | Description |
114
+ | :-------------------- | :-------- | :------ | :--------------------------------------------------------------- |
115
+ | `indent` | `string` | `"\t"` | Non-empty string of spaces and/or tabs used for one indent level |
116
+ | `startingIndentLevel` | `number` | `0` | Starting indent level, from `0` to `1000` |
117
+ | `jsx` | `boolean` | `false` | Enable TSX-safe printing for ambiguous TypeScript syntax |
118
+ | `ts` | `boolean` | `false` | Select the printer that supports TypeScript nodes |
119
+ | `sourcemap` | `boolean` | `false` | Return a Source Map v3 object in `map` |
120
+ | `sourceFilename` | `string` | `""` | Original source filename recorded in the source map |
121
+ | `sourceText` | `string` | - | Original text required for source-map mappings and content |
122
+
123
+ ## Why pure JavaScript?
124
+
125
+ Most Oxc packages use native bindings. This package deliberately does not: when an AST already
126
+ lives in JavaScript, passing the entire object graph across a JS/native boundary can cost more than
127
+ printing it in place. `oxc-codegen` avoids that serialization and uses specialized printer builds
128
+ for JavaScript and TypeScript workloads.
129
+
130
+ See [DESIGN.md](https://github.com/oxc-project/oxc/blob/main/packages/codegen/DESIGN.md) for the
131
+ implementation details and performance constraints.
54
132
 
55
- ## Missing features
133
+ ## Current limitations
56
134
 
57
- - There is currently no support for printing comments.
58
- - Pretty-printing only, no compact/minified output.
59
- - Source map support is only lightly tested, and API is likely to change.
135
+ - Comments are not printed.
136
+ - Minified output is not supported.
60
137
 
61
138
  ## Benchmarks
62
139
 
63
- | fixture | bytes | Oxc |
64
- | :------------------------- | ------: | --------: |
65
- | tiny.js | 26 | 0.0001ms |
66
- | RadixUIAdoptionSection.jsx | 2518 | 0.0033ms |
67
- | react.development.js | 72141 | 0.1138ms |
68
- | binder.ts | 193077 | 0.2472ms |
69
- | App.tsx | 415340 | 0.7490ms |
70
- | lodash.js | 544096 | 0.4995ms |
71
- | kitchen-sink.tsx | 732222 | 2.5682ms |
72
- | antd.js | 6683633 | 11.3914ms |
73
-
74
- Numbers above are from one machine and are not a regression baseline - the `antd.js` figures in
75
- particular move by over 10% run to run.
140
+ Representative time per `printSync` call:
141
+
142
+ | Fixture | Bytes | Time |
143
+ | :--------------------------- | --------: | ---------: |
144
+ | `tiny.js` | 26 | 0.0001 ms |
145
+ | `RadixUIAdoptionSection.jsx` | 2,518 | 0.0033 ms |
146
+ | `react.development.js` | 72,141 | 0.1138 ms |
147
+ | `binder.ts` | 193,077 | 0.2472 ms |
148
+ | `App.tsx` | 415,340 | 0.7490 ms |
149
+ | `lodash.js` | 544,096 | 0.4995 ms |
150
+ | `kitchen-sink.tsx` | 732,222 | 2.5682 ms |
151
+ | `antd.js` | 6,683,633 | 11.3914 ms |
152
+
153
+ These figures come from one machine and are illustrative, not a regression baseline. Results—most
154
+ noticeably for large fixtures such as `antd.js`—vary between runs.
package/dist/index.d.ts CHANGED
@@ -1,30 +1,16 @@
1
1
  //#region src-js/print/options.d.ts
2
- /**
3
- * Source map generator, compatible with `SourceMapGenerator` from the `source-map` package.
4
- */
5
- interface SourceMapGenerator {
6
- addMapping(mapping: Mapping): void;
7
- file?: string;
8
- _file?: string;
9
- }
10
- /**
11
- * Source map mapping emitted through `Options["sourceMap"]`.
12
- *
13
- * Note: the `Mapping` objects passed to `addMapping` are reused across calls;
14
- * implementations must copy any values they need to retain.
15
- */
16
- interface Mapping {
17
- original: Position;
18
- generated: Position;
19
- name: string | undefined;
20
- source: string;
21
- }
22
- /**
23
- * Position in the original source, as found on a node's `loc.start`.
24
- */
25
- interface Position {
26
- line: number;
27
- column: number;
2
+ /** Standard Source Map v3 output, compatible with Rollup and other JavaScript tooling. */
3
+ interface SourceMap {
4
+ version: 3;
5
+ mappings: string;
6
+ names: string[];
7
+ sources: string[];
8
+ sourcesContent?: string[];
9
+ }
10
+ /** Result returned by `printSync`. */
11
+ interface CodegenResult {
12
+ code: string;
13
+ map: SourceMap | null;
28
14
  }
29
15
  /**
30
16
  * Code generator options.
@@ -32,11 +18,12 @@ interface Position {
32
18
  interface Options {
33
19
  /**
34
20
  * String to use for indentation, defaults to `"\t"`.
35
- * Must consist only of spaces and/or tabs - anything else falls back to a tab.
21
+ * Must be a non-empty string consisting only of spaces and/or tabs.
22
+ * Throws a `TypeError` otherwise.
36
23
  */
37
24
  indent?: string;
38
25
  /**
39
- * Indent level to start from, defaults to `0`.
26
+ * Non-negative integer indent level to start from, from `0` to `1000`. Defaults to `0`.
40
27
  */
41
28
  startingIndentLevel?: number;
42
29
  /**
@@ -50,9 +37,17 @@ interface Options {
50
37
  */
51
38
  ts?: boolean;
52
39
  /**
53
- * If present, source mappings are emitted through it.
40
+ * Generate and return a source map in `CodegenResult.map`.
41
+ */
42
+ sourcemap?: boolean;
43
+ /**
44
+ * Original source text. Required when `sourcemap` is `true`.
54
45
  */
55
- sourceMap?: SourceMapGenerator;
46
+ sourceText?: string;
47
+ /**
48
+ * Original source filename recorded in the returned source map.
49
+ */
50
+ sourceFilename?: string;
56
51
  }
57
52
  //#endregion
58
53
  //#region ../../npm/oxc-types/types.d.ts
@@ -549,7 +544,7 @@ type FunctionType = "FunctionDeclaration" | "FunctionExpression" | "TSDeclareFun
549
544
  interface FormalParameterRest extends Span {
550
545
  type: "RestElement";
551
546
  argument: BindingPattern;
552
- decorators?: [];
547
+ decorators?: Array<Decorator>;
553
548
  optional?: boolean;
554
549
  typeAnnotation?: TSTypeAnnotation | null;
555
550
  value?: null;
@@ -1356,12 +1351,12 @@ type Node = Program | IdentifierName | IdentifierReference | BindingIdentifier |
1356
1351
  //#endregion
1357
1352
  //#region src-js/index.d.ts
1358
1353
  /**
1359
- * Print `node`, returning the generated code.
1354
+ * Print `node`, returning an object including the generated code.
1360
1355
  *
1361
1356
  * @param node - AST node to print, a `Program` or a single statement
1362
1357
  * @param options - Printing options (optional)
1363
- * @returns Generated code
1358
+ * @returns Object holding the generated code
1364
1359
  */
1365
- declare function printSync(node: Node, options?: Options): string;
1360
+ declare function printSync(node: Program | Statement, options?: Options): CodegenResult;
1366
1361
  //#endregion
1367
- export { type Mapping, type Options, type Position, type SourceMapGenerator, printSync };
1362
+ export { type CodegenResult, type Options, type SourceMap, printSync };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{createRequire as e}from"node:module";let t=` `;const n=[``],r=/^[ \t]+$/;var i=class{constructor(e){this.output=``;let i=e.startingIndentLevel;typeof i!=`number`&&(i=0),this.indentLevel=i;let{indent:a}=e;(typeof a!=`string`||!r.test(a))&&(a=` `),a!==t&&(t=a,n.length=1),this.indents=n,this.indentString=a,this.isJsx=e.jsx===!0,this.pendingIndentAsSpace=!1,this.last=3,e.sourceMap==null?(this.mapOffsets=null,this.mapPositions=null,this.mapNames=null):(this.mapOffsets=[],this.mapPositions=[],this.mapNames=[])}};const a=e(import.meta.url),o={},s=[`./print_js.js`,`./print_ts.js`,`./print_js_maps.js`,`./print_ts_maps.js`],c=[null,null,null,null];function l(e,t){let n=0;t==null?t=o:(t.ts===!0&&(n=1),t.sourceMap!=null&&(n|=2));let r=c[n];return r===null&&(r=a(s[n]).printSync,c[n]=r),r(e,new i(t),t)}export{l as printSync};
1
+ import{createRequire as e}from"node:module";let t=` `;const n=[``],r=/^[ \t]+$/;var i=class{constructor(e){this.output=``;let{startingIndentLevel:i}=e;if(i===void 0)i=0;else if(!Number.isSafeInteger(i)||i<0||i>1e3)throw RangeError("`startingIndentLevel` must be a non-negative safe integer no greater than 1000");this.indentLevel=i;let{indent:a}=e,o=a;if(o===void 0)o=` `;else if(typeof o!=`string`||!r.test(o))throw TypeError("`indent` must be a non-empty string containing only spaces and tabs");o!==t&&(t=o,n.length=1),this.indents=n,this.indentString=o,this.isJsx=e.jsx===!0,this.pendingIndentAsSpace=!1,this.last=3,this.lastWasPostfixClose=!1,e.sourcemap===!0?(this.sourceText=e.sourceText,this.mapPositions=[],this.mapNames=null):(this.sourceText=null,this.mapPositions=null,this.mapNames=null)}};const a=e(import.meta.url),o={},s=[`./print_js.js`,`./print_ts.js`,`./print_js_maps.js`,`./print_ts_maps.js`],c=[null,null,null,null];function l(e,t){let n=0;if(t==null)t=o;else if(t.ts===!0&&(n=1),t.sourcemap===!0){if(typeof t.sourceText!=`string`)throw TypeError("`sourceText` must be a string when `sourcemap` is true");if(t.sourceFilename!==void 0&&typeof t.sourceFilename!=`string`)throw TypeError("`sourceFilename` must be a string when supplied");n|=2}let r=c[n];return r===null&&(r=a(s[n]).printSync,c[n]=r),r(e,new i(t),t)}export{l as printSync};
package/dist/print_js.js CHANGED
@@ -1,20 +1,20 @@
1
- const e=(e,t,n)=>{e.last=n,e.output+=t},t=(e,t)=>{e.output+=t},n={__proto__:null,"**":17,"*":16,"/":16,"%":16,"+":15,"-":15,"<<":14,">>":14,">>>":14,"<":13,">":13,"<=":13,">=":13,instanceof:13,in:13,"==":12,"!=":12,"===":12,"!==":12,"&":11,"^":10,"|":9,"&&":8,"||":7,"??":6},r={__proto__:null,"**":` ** `,"*":` * `,"/":` / `,"%":` % `,"+":` + `,"-":` - `,"<<":` << `,">>":` >> `,">>>":` >>> `,"<":` < `,">":` > `,"<=":` <= `,">=":` >= `,instanceof:` instanceof `,in:` in `,"==":` == `,"!=":` != `,"===":` === `,"!==":` !== `,"&":` & `,"^":` ^ `,"|":` | `,"&&":` && `,"||":` || `,"??":` ?? `},i={__proto__:null,"=":` = `,"+=":` += `,"-=":` -= `,"*=":` *= `,"/=":` /= `,"%=":` %= `,"**=":` **= `,"<<=":` <<= `,">>=":` >>= `,">>>=":` >>>= `,"&=":` &= `,"^=":` ^= `,"|=":` |= `,"&&=":` &&= `,"||=":` ||= `,"??=":` ??= `},a=e=>{switch(e){case`+`:return 11;case`-`:return 13;case`!`:return 9;default:return 3}},o=e=>e===`++`?12:14,s=e=>{for(;e.type===`ParenthesizedExpression`;)e=e.expression;return e},c=(e,t,n,r)=>{let i={e,precedence:n,ctx:r,leftPrecedence:0,operator:e.operator,wrap:!1,rightPrecedence:0,parent:null};for(;;){l(i,t);let e=s(i.e.left);if(e.type===`BinaryExpression`||e.type===`LogicalExpression`){if(e.type===`BinaryExpression`&&e.left.type===`PrivateIdentifier`){L(e,t,0),d(i,t);break}i={e,precedence:i.leftPrecedence,ctx:i.ctx,leftPrecedence:0,operator:i.operator,wrap:!1,rightPrecedence:0,parent:i}}else{N(i.e.left,t,i.leftPrecedence,i.ctx),d(i,t);break}}for(;(i=i.parent)!==null;)d(i,t)},l=(t,r)=>{let{e:i}=t,a=i.operator,o=n[a],c=t.precedence>=o&&(!u(t.operator)||t.precedence!==n[t.operator]);t.operator=a,t.wrap=c||a===`in`&&!!(t.ctx&1),t.wrap&&(e(r,`(`,3),t.ctx&=-2);let l=o-1;if(t.leftPrecedence=l,t.rightPrecedence=l,o===17?t.leftPrecedence=o:t.rightPrecedence=o,a===`??`){let e=s(i.left);e.type===`LogicalExpression`&&e.operator!==`??`&&(t.leftPrecedence=18);let n=s(i.right);n.type===`LogicalExpression`&&n.operator!==`??`&&(t.rightPrecedence=18)}else if(a===`**`){let e=s(i.left);(e.type===`UnaryExpression`||e.type===`AwaitExpression`||e.type===`Literal`&&(typeof e.value==`number`||e.bigint!=null))&&(t.leftPrecedence=21)}},u=e=>e===`&&`||e===`||`||e===`??`,d=(t,n)=>{e(n,r[t.operator],3),N(t.e.right,n,t.rightPrecedence,t.ctx),t.wrap&&e(n,`)`,3)},f=t=>{t.last<=2&&e(t,` `,3)},p=(e,t)=>{let n=e.last;n>=10&&ee(e,n,t)},ee=(t,n,r)=>{(n===11&&(r===11||r===12)||n===13&&(r===13||r===14)||n===10&&r===14)&&e(t,` `,3)},m=t=>{if(t.pendingIndentAsSpace){e(t,` `,3),t.pendingIndentAsSpace=!1;return}let n=t.indentLevel;if(n>0){let{indents:r}=t;e(t,n<r.length?r[n]:h(t,n),3)}},h=(e,t)=>{let{indents:n,indentString:r}=e,{length:i}=n,a=n[i-1];for(;i<=t;i++)a+=r,a.charCodeAt(0),n.push(a);return a},g=(t,n,r)=>{Number.isInteger(n)?n<1e3?e(t,String(n),1):te(t,n,r):ne(t,n,r)},te=(n,r,i)=>{let a=String(r);if(r>=1e21){if(v(n,r,a.length-1,i))return;_(n,a,a.indexOf(`e`),i);return}let{length:o}=a;if(!v(n,r,o,i)){if(a.charCodeAt(o-1)===48){let r=1;for(;a.charCodeAt(o-1-r)===48;)r++;let i=String(r);if(i.length+1<r){t(n,a.slice(0,o-r)),t(n,`e`),e(n,i,0);return}}e(n,a,1)}},ne=(n,r,i)=>{let a=String(r);if(a.charCodeAt(0)===48){if(a.charCodeAt(2)===48){let r=3;for(;a.charCodeAt(r)===48;)r++;let i=String(a.length-2);if(i.length+2<r-1){t(n,a.slice(r)),t(n,`e-`),e(n,i,0);return}}e(n,a.slice(1),0);return}let o=a.indexOf(`e`);if(o===-1){e(n,a,0);return}_(n,a,o,i)},_=(n,r,i,a)=>{let o=r.charCodeAt(i+1)===43?r.slice(i+2):r.slice(i+1);if(i>1){let a=String(Number(o)-(i-2));if(a.length<=o.length){t(n,r[0]),t(n,r.slice(2,i)),t(n,`e`),e(n,a,0);return}}t(n,r.slice(0,i+1)),e(n,o,0)},v=(n,r,i,a)=>{if(i<13)return!1;let o=BigInt(r).toString(16);return o.length+2>=i?!1:(t(n,`0x`),e(n,o,0),!0)},y=/[\0\x07\b\v\f\n\r\x1B\\"<\u2028\u2029\xA0\uD800-\uDFFF]/,b=(n,r,i)=>{t(n,`"`),y.test(r)?re(n,r):t(n,r),e(n,`"`,3)},re=(e,n)=>{let r=0,{length:i}=n;for(let a=0;a<i;a++){let o=null,s=n.charCodeAt(a);switch(s){case 0:if(a+1<i){let e=n.charCodeAt(a+1);if(e>=48&&e<=57){o=`\\x00`;break}}o=`\\0`;break;case 7:o=`\\x07`;break;case 8:o=`\\b`;break;case 11:o=`\\v`;break;case 12:o=`\\f`;break;case 10:o=`\\n`;break;case 13:o=`\\r`;break;case 27:o=`\\x1B`;break;case 92:o=`\\\\`;break;case 34:o=`\\"`;break;case 60:if(/^<\/script/i.test(n.slice(a,a+8))){o=`<\\`;break}continue;case 8232:o=`\\u2028`;break;case 8233:o=`\\u2029`;break;case 160:o=`\\xA0`;break;default:if(s>=55296&&s<=57343){if(s<=56319&&a+1<i){let e=n.charCodeAt(a+1);if(e>=56320&&e<=57343){a++;continue}}o=`\\u`+s.toString(16);break}continue}t(e,n.slice(r,a)),t(e,o),r=a+1}t(e,n.slice(r))},ie=e=>e.includes(`</`)?e.replace(/<\/(script)/gi,`<\\/$1`):e,x=(t,n,r,i)=>{let{value:a}=t;switch(typeof a){case`string`:b(n,a,t);break;case`number`:ae(t,n,r,i);break;case`boolean`:f(n),e(n,a?`true`:`false`,0);break;default:t.regex==null?t.bigint==null?(f(n),e(n,`null`,0)):se(t,n,r):oe(t,n)}},ae=(n,r,i,a)=>{let{value:o}=n;if(a&4&&n.raw!=null){let{raw:t}=n;e(r,t,t[t.length-1]===`.`?3:0);return}if(o>0&&o<1/0)f(r),g(r,o,n);else if(Number.isNaN(o))f(r),e(r,`NaN`,0);else if(Number.isFinite(o))Object.is(o,0)?(f(r),e(r,`0`,1)):i>=18?(t(r,`(-`),g(r,-o,n),e(r,`)`,3)):(p(r,13),t(r,`-`),g(r,-o,n));else{let n=o<0,a=n&&i>=18;a&&e(r,`(`,3),n?(p(r,13),t(r,`-`)):f(r),e(r,`Infinity`,0),a&&e(r,`)`,3)}},oe=(n,r)=>{t(r,`/`),t(r,n.regex.pattern);let{flags:i}=n.regex;i===``?e(r,`/`,2):(t(r,`/`),e(r,i,0))},se=(n,r,i)=>{f(r);let a=n.bigint;a.startsWith(`-`)&&i>=18?(t(r,`(`),t(r,a),e(r,`n)`,3)):(t(r,a),e(r,`n`,0))},S=(t,n)=>{let r=!1;t.type===`FunctionExpression`&&(r=(n.last|1)==7),r&&e(n,`(`,3),f(n),e(n,t.async?`async function`:`function`,0),t.generator&&e(n,`* `,3),t.id!=null&&(f(n),e(n,t.id.name,0)),C(t.params,n),t.body==null?e(n,`;`,3):(e(n,` `,3),T(t.body,n)),r&&e(n,`)`,3)},C=(t,n)=>{if(t.length===0){e(n,`()`,3);return}e(n,`(`,3),w(t,n),e(n,`)`,3)},w=(t,n)=>{let{length:r}=t;for(let i=0;i<r;i++){i>0&&e(n,`, `,3);let r=t[i],{decorators:a}=r;a!=null&&a.length>0&&D(a,n),V(r,n)}},T=(t,n)=>{let r=t.body;if(r.length===0){e(n,`{}`,3);return}e(n,`{
2
- `,3),n.indentLevel++,q(r,n),n.indentLevel--,m(n),e(n,`}`,3)},ce=(t,n)=>{if(t.length===0){e(n,`() => `,3);return}e(n,`(`,3),w(t,n),e(n,`) => `,3)},E=(t,n)=>{let r=!1;t.type===`ClassExpression`&&(r=(n.last|1)==7),r&&e(n,`(`,3);let{decorators:i}=t;i!=null&&i.length>0&&D(i,n),f(n),e(n,`class`,0),t.id!=null&&(e(n,` `,3),e(n,t.id.name,0)),t.superClass!=null&&(e(n,` extends `,3),N(t.superClass,n,19,0));let{implements:a}=t;e(n,` `,3),ue(t.body,n),r&&e(n,`)`,3)},D=(t,n)=>{let{length:r}=t;for(let i=0;i<r;i++){let r=t[i];e(n,`@`,3);let{expression:a}=r,o=le(a);o&&e(n,`(`,3),N(a,n,0,0),o&&e(n,`)`,3),e(n,` `,3)}},le=e=>{for(;;)switch(e.type){case`Identifier`:return!1;case`MemberExpression`:return e.computed;case`CallExpression`:e=e.callee;break;default:return!0}},ue=(t,n)=>{let{body:r}=t,{length:i}=r;if(i===0){e(n,`{}`,3);return}e(n,`{
3
- `,3),n.indentLevel++;for(let t=0;t<i;t++){m(n);let i=r[t];switch(i.type){case`MethodDefinition`:de(i,n),e(n,`
4
- `,3);break;case`PropertyDefinition`:fe(i,n),e(n,`;
5
- `,3);break;case`StaticBlock`:pe(i,n),e(n,`
6
- `,3);break;case`AccessorProperty`:me(i,n),e(n,`;
7
- `,3);break;default:throw Error(`Unknown class element type: ${i.type}`)}}n.indentLevel--,m(n),e(n,`}`,3)},de=(t,n)=>{let{decorators:r}=t;r!=null&&r.length>0&&D(r,n),t.static&&(f(n),e(n,`static `,3));let{kind:i}=t;i===`get`?(f(n),e(n,`get `,3)):i===`set`&&(f(n),e(n,`set `,3));let a=t.value;a.async&&(f(n),e(n,`async `,3)),a.generator&&e(n,`*`,3),t.computed?(e(n,`[`,3),N(t.key,n,1,0),e(n,`]`,3)):H(t.key,n),C(a.params,n),a.body==null?e(n,`;`,3):(e(n,` `,3),T(a.body,n))},fe=(t,n)=>{let{decorators:r}=t;r!=null&&r.length>0&&D(r,n),t.static&&(f(n),e(n,`static `,3)),t.computed?(e(n,`[`,3),N(t.key,n,1,0),e(n,`]`,3)):H(t.key,n),t.value!=null&&(e(n,` = `,3),N(t.value,n,1,0))},pe=(t,n)=>{f(n),e(n,`static `,3);let{body:r}=t,{length:i}=r;if(i===0){e(n,`{}`,3);return}e(n,`{
8
- `,3),n.indentLevel++;for(let e=0;e<i;e++)J(r[e],n);n.indentLevel--,m(n),e(n,`}`,3)},me=(t,n)=>{let{decorators:r}=t;r!=null&&r.length>0&&D(r,n),t.static&&(f(n),e(n,`static `,3)),f(n),e(n,`accessor`,0),t.computed?(e(n,` [`,3),N(t.key,n,1,0),e(n,`]`,3)):(e(n,` `,3),H(t.key,n)),t.value!=null&&(e(n,` = `,3),N(t.value,n,1,0))},O=(n,r)=>{let{openingElement:i}=n;t(r,`<`),k(i.name,r);let{attributes:a}=i,{length:o}=a;for(let n=0;n<o;n++){t(r,` `);let i=a[n];i.type===`JSXSpreadAttribute`?(e(r,`{...`,3),N(i.argument,r,1,0),t(r,`}`)):he(i,r)}let{closingElement:s}=n;if(s==null){e(r,` />`,3);return}t(r,`>`);let{children:c}=n,l=c.length;for(let e=0;e<l;e++)M(c[e],r);t(r,`</`),k(s.name,r),e(r,`>`,3)},k=(e,n)=>{switch(e.type){case`JSXIdentifier`:t(n,e.name);break;case`JSXMemberExpression`:k(e.object,n),t(n,`.`),k(e.property,n);break;case`JSXNamespacedName`:t(n,e.namespace.name),t(n,`:`),t(n,e.name.name);break;case`ThisExpression`:t(n,`this`);break;default:throw Error(`Unknown JSX name type: ${e.type}`)}},he=(e,n)=>{let{name:r}=e;r.type===`JSXNamespacedName`?(t(n,r.namespace.name),t(n,`:`),t(n,r.name.name)):t(n,r.name);let{value:i}=e;i!=null&&(t(n,`=`),ge(i,n))},ge=(e,n)=>{switch(e.type){case`Literal`:{let{raw:r}=e,i=r==null?String(e.value):r.slice(1,-1),a=i.includes(`"`)?`'`:`"`;t(n,a),t(n,i),t(n,a);break}case`JSXExpressionContainer`:A(e,n);break;case`JSXElement`:O(e,n);break;case`JSXFragment`:j(e,n);break;default:throw Error(`Unknown JSX attribute value type: ${e.type}`)}},A=(n,r)=>{e(r,`{`,3),n.expression.type!==`JSXEmptyExpression`&&N(n.expression,r,0,0),t(r,`}`)},j=(n,r)=>{t(r,`<>`);let{children:i}=n,{length:a}=i;for(let e=0;e<a;e++)M(i[e],r);e(r,`</>`,3)},M=(n,r)=>{switch(n.type){case`JSXText`:t(r,n.raw==null?n.value:n.raw);break;case`JSXExpressionContainer`:A(n,r);break;case`JSXElement`:O(n,r);break;case`JSXFragment`:j(n,r);break;case`JSXSpreadChild`:e(r,`{...`,3),N(n.expression,r,0,0),t(r,`}`);break;default:throw Error(`Unknown JSX child type: ${n.type}`)}},N=(n,r,i,a)=>{switch(n.type){case`Identifier`:f(r),e(r,n.name,0);break;case`MemberExpression`:P(n,r,a);break;case`CallExpression`:F(n,r,i,a);break;case`Literal`:x(n,r,i,a);break;case`BinaryExpression`:n.left.type===`PrivateIdentifier`?L(n,r,i):c(n,r,i,a);break;case`LogicalExpression`:c(n,r,i,a);break;case`ObjectExpression`:_e(n,r);break;case`ArrayExpression`:ve(n,r);break;case`AssignmentExpression`:ye(n,r,i,a);break;case`UpdateExpression`:be(n,r,i,a);break;case`UnaryExpression`:xe(n,r,i,a);break;case`ConditionalExpression`:Se(n,r,i,a);break;case`SequenceExpression`:Ce(n,r,i,a);break;case`ArrowFunctionExpression`:we(n,r,i,a);break;case`FunctionExpression`:S(n,r);break;case`ThisExpression`:f(r),e(r,`this`,0);break;case`Super`:f(r),e(r,`super`,0);break;case`NewExpression`:Te(n,r,i);break;case`TemplateLiteral`:z(n,r);break;case`TaggedTemplateExpression`:N(n.tag,r,19,a&2),z(n.quasi,r);break;case`ClassExpression`:E(n,r);break;case`AwaitExpression`:Ee(n,r,i,a);break;case`YieldExpression`:De(n,r,i);break;case`ImportExpression`:Oe(n,r,i,a);break;case`MetaProperty`:f(r),t(r,n.meta.name),t(r,`.`),e(r,n.property.name,0);break;case`ChainExpression`:ke(n,r,i,a);break;case`ParenthesizedExpression`:{let{expression:t}=n,o=s(t);o.type===`FunctionExpression`||o.type===`ArrowFunctionExpression`?(e(r,`(`,3),N(o,r,0,0),e(r,`)`,3)):N(t,r,i,a);break}case`JSXElement`:O(n,r);break;case`JSXFragment`:j(n,r);break;default:throw Error(`Unknown expression type: ${n.type}`)}},P=(n,r,i)=>{let{object:a}=n;if(n.computed){let t=s(a),o=t.type===`Identifier`&&t.name===`let`;o&&e(r,`(`,3),N(a,r,19,i&2),o&&e(r,`)`,3),n.optional&&e(r,`?.`,3),e(r,`[`,3),N(n.property,r,0,0),e(r,`]`,3)}else{N(a,r,19,i&2),n.optional?e(r,`?`,5):r.last===1&&e(r,` `,3),e(r,`.`,3);let{property:o}=n;o.type===`PrivateIdentifier`&&t(r,`#`),e(r,o.name,0)}},F=(n,r,i,a)=>{let o=i>=20||!!(a&2);o&&(t(r,`(`),(r.last|1)!=7&&(r.last=3)),N(n.callee,r,19,0),n.optional&&e(r,`?.`,3),I(n.arguments,r),o&&e(r,`)`,3)},I=(t,n)=>{let{length:r}=t;if(r===0){e(n,`()`,3);return}e(n,`(`,3);for(let i=0;i<r;i++){i>0&&e(n,`, `,3);let r=t[i];r.type===`SpreadElement`?(e(n,`...`,3),N(r.argument,n,1,0)):N(r,n,1,0)}e(n,`)`,3)},L=(n,r,i)=>{let a=i>=13;a&&e(r,`(`,3),t(r,`#`),e(r,n.left.name,0),e(r,` in `,3),N(n.right,r,12,1),a&&e(r,`)`,3)},_e=(t,n)=>{let r=(n.last-1|1)==7;r&&e(n,`(`,3);let{properties:i}=t,{length:a}=i,o=a>1;if(e(n,`{`,3),o){n.indentLevel++;for(let t=0;t<a;t++)e(n,t>0?`,
1
+ const e=(e,t,n)=>{e.last=n,e.output+=t},t=(e,t)=>{e.output+=t},n={__proto__:null,"**":17,"*":16,"/":16,"%":16,"+":15,"-":15,"<<":14,">>":14,">>>":14,"<":13,">":13,"<=":13,">=":13,instanceof:13,in:13,"==":12,"!=":12,"===":12,"!==":12,"&":11,"^":10,"|":9,"&&":8,"||":7,"??":6},r={__proto__:null,"**":` ** `,"*":` * `,"/":` / `,"%":` % `,"+":` + `,"-":` - `,"<<":` << `,">>":` >> `,">>>":` >>> `,"<":` < `,">":` > `,"<=":` <= `,">=":` >= `,instanceof:` instanceof `,in:` in `,"==":` == `,"!=":` != `,"===":` === `,"!==":` !== `,"&":` & `,"^":` ^ `,"|":` | `,"&&":` && `,"||":` || `,"??":` ?? `},i={__proto__:null,"=":` = `,"+=":` += `,"-=":` -= `,"*=":` *= `,"/=":` /= `,"%=":` %= `,"**=":` **= `,"<<=":` <<= `,">>=":` >>= `,">>>=":` >>>= `,"&=":` &= `,"^=":` ^= `,"|=":` |= `,"&&=":` &&= `,"||=":` ||= `,"??=":` ??= `},a=e=>{switch(e){case`+`:return 11;case`-`:return 13;case`!`:return 9;default:return 3}},o=e=>e===`++`?12:14,s=e=>{for(;e.type===`ParenthesizedExpression`;)e=e.expression;return e},c=(e,t,n,r)=>{let i={e,precedence:n,ctx:r,leftPrecedence:0,operator:e.operator,wrap:!1,rightPrecedence:0,parent:null};for(;;){l(i,t);let e=s(i.e.left);if(e.type===`BinaryExpression`||e.type===`LogicalExpression`){if(e.type===`BinaryExpression`&&e.left.type===`PrivateIdentifier`){L(e,t,0),d(i,t);break}i={e,precedence:i.leftPrecedence,ctx:i.ctx,leftPrecedence:0,operator:i.operator,wrap:!1,rightPrecedence:0,parent:i}}else{N(i.e.left,t,i.leftPrecedence,i.ctx),d(i,t);break}}for(;(i=i.parent)!==null;)d(i,t)},l=(t,r)=>{let{e:i}=t,a=i.operator,o=n[a],c=t.precedence>=o&&(!u(t.operator)||t.precedence!==n[t.operator]);t.operator=a,t.wrap=c||a===`in`&&!!(t.ctx&1),t.wrap&&(e(r,`(`,3),t.ctx&=-2);let l=o-1;if(t.leftPrecedence=l,t.rightPrecedence=l,o===17?t.leftPrecedence=o:t.rightPrecedence=o,a===`??`){let e=s(i.left);e.type===`LogicalExpression`&&e.operator!==`??`&&(t.leftPrecedence=18);let n=s(i.right);n.type===`LogicalExpression`&&n.operator!==`??`&&(t.rightPrecedence=18)}else if(a===`**`){let e=s(i.left);(e.type===`UnaryExpression`||e.type===`AwaitExpression`||e.type===`Literal`&&(typeof e.value==`number`||e.bigint!=null))&&(t.leftPrecedence=21)}},u=e=>e===`&&`||e===`||`||e===`??`,d=(t,n)=>{e(n,r[t.operator],3),N(t.e.right,n,t.rightPrecedence,t.ctx),t.wrap&&e(n,`)`,3)},f=t=>{t.last<=2&&e(t,` `,3)},p=(e,t)=>{let n=e.last;n>=10&&ee(e,n,t)},ee=(t,n,r)=>{(n===11&&(r===11||r===12)||n===13&&(r===13||r===14)||n===10&&r===14)&&e(t,` `,3)},m=t=>{if(t.pendingIndentAsSpace){e(t,` `,3),t.pendingIndentAsSpace=!1;return}let n=t.indentLevel;if(n>0){let{indents:r}=t;e(t,n<r.length?r[n]:h(t,n),3)}},h=(e,t)=>{let{indents:n,indentString:r}=e,{length:i}=n,a=n[i-1];for(;i<=t;i++)a+=r,a.charCodeAt(0),n.push(a);return a},g=(t,n,r)=>{Number.isInteger(n)?n<1e3?e(t,String(n),1):te(t,n,r):ne(t,n,r)},te=(n,r,i)=>{let a=String(r);if(r>=1e21){if(v(n,r,a.length-1,i))return;_(n,a,a.indexOf(`e`),i);return}let{length:o}=a;if(!v(n,r,o,i)){if(a.charCodeAt(o-1)===48){let r=1;for(;a.charCodeAt(o-1-r)===48;)r++;let i=String(r);if(i.length+1<r){t(n,a.slice(0,o-r)),t(n,`e`),e(n,i,0);return}}e(n,a,1)}},ne=(n,r,i)=>{let a=String(r);if(a.charCodeAt(0)===48){if(a.charCodeAt(2)===48){let r=3;for(;a.charCodeAt(r)===48;)r++;let i=String(a.length-2);if(i.length+2<r-1){t(n,a.slice(r)),t(n,`e-`),e(n,i,0);return}}e(n,a.slice(1),0);return}let o=a.indexOf(`e`);if(o===-1){e(n,a,0);return}_(n,a,o,i)},_=(n,r,i,a)=>{let o=r.charCodeAt(i+1)===43?r.slice(i+2):r.slice(i+1);if(i>1){let a=String(Number(o)-(i-2));if(a.length<=o.length){t(n,r[0]),t(n,r.slice(2,i)),t(n,`e`),e(n,a,0);return}}t(n,r.slice(0,i+1)),e(n,o,0)},v=(n,r,i,a)=>{if(i<13)return!1;let o=BigInt(r).toString(16);return o.length+2>=i?!1:(t(n,`0x`),e(n,o,0),!0)},y=/[\0\x07\b\v\f\n\r\x1B\\"\u2028\u2029\xA0\uD800-\uDFFF]|<\/script/i,b=(n,r,i)=>{t(n,`"`),y.test(r)?re(n,r):t(n,r),e(n,`"`,3)},re=(e,n)=>{let r=0,{length:i}=n;for(let a=0;a<i;a++){let o=null,s=n.charCodeAt(a);switch(s){case 0:if(a+1<i){let e=n.charCodeAt(a+1);if(e>=48&&e<=57){o=`\\x00`;break}}o=`\\0`;break;case 7:o=`\\x07`;break;case 8:o=`\\b`;break;case 11:o=`\\v`;break;case 12:o=`\\f`;break;case 10:o=`\\n`;break;case 13:o=`\\r`;break;case 27:o=`\\x1B`;break;case 92:o=`\\\\`;break;case 34:o=`\\"`;break;case 60:if(/^<\/script/i.test(n.slice(a,a+8))){o=`<\\`;break}continue;case 8232:o=`\\u2028`;break;case 8233:o=`\\u2029`;break;case 160:o=`\\xA0`;break;default:if(s>=55296&&s<=57343){if(s<=56319&&a+1<i){let e=n.charCodeAt(a+1);if(e>=56320&&e<=57343){a++;continue}}o=`\\u`+s.toString(16);break}continue}t(e,n.slice(r,a)),t(e,o),r=a+1}t(e,n.slice(r))},ie=e=>e.includes(`</`)?e.replace(/<\/(script)/gi,`<\\/$1`):e,x=(t,n,r,i)=>{let{value:a}=t;switch(typeof a){case`string`:b(n,a,t);break;case`number`:ae(t,n,r,i);break;case`boolean`:f(n),e(n,a?`true`:`false`,0);break;default:t.regex==null?t.bigint==null?(f(n),e(n,`null`,0)):se(t,n,r):oe(t,n)}},ae=(n,r,i,a)=>{let{value:o}=n;if(a&4&&n.raw!=null){let{raw:t}=n;e(r,t,t[t.length-1]===`.`?3:0);return}if(o>0&&o<1/0)f(r),g(r,o,n);else if(Number.isNaN(o))f(r),e(r,`NaN`,0);else if(Number.isFinite(o))Object.is(o,0)?(f(r),e(r,`0`,1)):i>=18?(t(r,`(-`),g(r,-o,n),e(r,`)`,3)):(p(r,13),t(r,`-`),g(r,-o,n));else{let n=o<0,a=n&&i>=18;a&&e(r,`(`,3),n?(p(r,13),t(r,`-`)):f(r),e(r,`Infinity`,0),a&&e(r,`)`,3)}},oe=(n,r)=>{t(r,`/`),t(r,n.regex.pattern);let{flags:i}=n.regex;i===``?e(r,`/`,2):(t(r,`/`),e(r,i,0))},se=(n,r,i)=>{f(r);let a=n.bigint;a.startsWith(`-`)&&i>=18?(t(r,`(`),t(r,a),e(r,`n)`,3)):(t(r,a),e(r,`n`,0))},S=(t,n)=>{let r=!1;t.type===`FunctionExpression`&&(r=(n.last|1)==7),r&&e(n,`(`,3),f(n),e(n,t.async?`async function`:`function`,0),t.generator&&e(n,`* `,3),t.id!=null&&(f(n),e(n,t.id.name,0)),C(t.params,n),t.body==null?e(n,`;`,3):(e(n,` `,3),T(t.body,n)),r&&e(n,`)`,3)},C=(t,n)=>{if(t.length===0){e(n,`()`,3);return}e(n,`(`,3),w(t,n),e(n,`)`,3)},w=(t,n)=>{let{length:r}=t;for(let i=0;i<r;i++){i>0&&e(n,`, `,3);let r=t[i],{decorators:a}=r;a!=null&&a.length>0&&D(a,n),V(r,n)}},T=(n,r)=>{let i=n.body;if(i.length===0){t(r,`{`),e(r,`}`,3);return}e(r,`{
2
+ `,3),r.indentLevel++,q(i,r),r.indentLevel--,m(r),e(r,`}`,3)},ce=(t,n)=>{if(t.length===0){e(n,`() => `,3);return}e(n,`(`,3),w(t,n),e(n,`) => `,3)},E=(t,n)=>{let r=!1;t.type===`ClassExpression`&&(r=(n.last|1)==7),r&&e(n,`(`,3);let{decorators:i}=t;i!=null&&i.length>0&&D(i,n),f(n),e(n,`class`,0),t.id!=null&&(e(n,` `,3),e(n,t.id.name,0)),t.superClass!=null&&(e(n,` extends `,3),N(t.superClass,n,19,0));let{implements:a}=t;e(n,` `,3),ue(t.body,n),r&&e(n,`)`,3)},D=(t,n)=>{let{length:r}=t;for(let i=0;i<r;i++){let r=t[i];e(n,`@`,3);let{expression:a}=r,o=le(a);o&&e(n,`(`,3),N(a,n,0,0),o&&e(n,`)`,3),e(n,` `,3)}},le=e=>{for(;;)switch(e.type){case`Identifier`:return!1;case`MemberExpression`:return e.computed;case`CallExpression`:e=e.callee;break;default:return!0}},ue=(n,r)=>{let{body:i}=n,{length:a}=i;if(a===0){t(r,`{`),e(r,`}`,3);return}e(r,`{
3
+ `,3),r.indentLevel++;for(let t=0;t<a;t++){m(r);let n=i[t];switch(n.type){case`MethodDefinition`:de(n,r),e(r,`
4
+ `,3);break;case`PropertyDefinition`:fe(n,r),e(r,`;
5
+ `,3);break;case`StaticBlock`:pe(n,r),e(r,`
6
+ `,3);break;case`AccessorProperty`:me(n,r),e(r,`;
7
+ `,3);break;default:throw Error(`Unknown class element type: ${n.type}`)}}r.indentLevel--,m(r),e(r,`}`,3)},de=(t,n)=>{let{decorators:r}=t;r!=null&&r.length>0&&D(r,n),t.static&&(f(n),e(n,`static `,3));let{kind:i}=t;i===`get`?(f(n),e(n,`get `,3)):i===`set`&&(f(n),e(n,`set `,3));let a=t.value;a.async&&(f(n),e(n,`async `,3)),a.generator&&e(n,`*`,3),t.computed?(e(n,`[`,3),N(t.key,n,1,0),e(n,`]`,3)):H(t.key,n),C(a.params,n),a.body==null?e(n,`;`,3):(e(n,` `,3),T(a.body,n))},fe=(t,n)=>{let{decorators:r}=t;r!=null&&r.length>0&&D(r,n),t.static&&(f(n),e(n,`static `,3)),t.computed?(e(n,`[`,3),N(t.key,n,1,0),e(n,`]`,3)):H(t.key,n),t.value!=null&&(e(n,` = `,3),N(t.value,n,1,0))},pe=(n,r)=>{f(r),e(r,`static `,3);let{body:i}=n,{length:a}=i;if(a===0){t(r,`{`),e(r,`}`,3);return}e(r,`{
8
+ `,3),r.indentLevel++;for(let e=0;e<a;e++)J(i[e],r);r.indentLevel--,m(r),e(r,`}`,3)},me=(t,n)=>{let{decorators:r}=t;r!=null&&r.length>0&&D(r,n),t.static&&(f(n),e(n,`static `,3)),f(n),e(n,`accessor`,0),t.computed?(e(n,` [`,3),N(t.key,n,1,0),e(n,`]`,3)):(e(n,` `,3),H(t.key,n)),t.value!=null&&(e(n,` = `,3),N(t.value,n,1,0))},O=(n,r)=>{let{openingElement:i}=n;t(r,`<`),k(i.name,r);let{attributes:a}=i,{length:o}=a;for(let n=0;n<o;n++){t(r,` `);let i=a[n];i.type===`JSXSpreadAttribute`?(e(r,`{...`,3),N(i.argument,r,1,0),e(r,`}`,3)):he(i,r)}let{closingElement:s}=n;if(s==null){e(r,` />`,3);return}t(r,`>`);let{children:c}=n,l=c.length;for(let e=0;e<l;e++)M(c[e],r);t(r,`</`),k(s.name,r),e(r,`>`,3)},k=(e,n)=>{switch(e.type){case`JSXIdentifier`:t(n,e.name);break;case`JSXMemberExpression`:k(e.object,n),t(n,`.`),k(e.property,n);break;case`JSXNamespacedName`:t(n,e.namespace.name),t(n,`:`),t(n,e.name.name);break;case`ThisExpression`:t(n,`this`);break;default:throw Error(`Unknown JSX name type: ${e.type}`)}},he=(e,n)=>{let{name:r}=e;r.type===`JSXNamespacedName`?(t(n,r.namespace.name),t(n,`:`),t(n,r.name.name)):t(n,r.name);let{value:i}=e;i!=null&&(t(n,`=`),ge(i,n))},ge=(e,n)=>{switch(e.type){case`Literal`:{let{raw:r}=e,i=r==null?String(e.value):r.slice(1,-1),a=i.includes(`"`)?`'`:`"`;t(n,a),t(n,i),t(n,a);break}case`JSXExpressionContainer`:A(e,n);break;case`JSXElement`:O(e,n);break;case`JSXFragment`:j(e,n);break;default:throw Error(`Unknown JSX attribute value type: ${e.type}`)}},A=(n,r)=>{e(r,`{`,3),n.expression.type!==`JSXEmptyExpression`&&N(n.expression,r,0,0),t(r,`}`)},j=(n,r)=>{t(r,`<>`);let{children:i}=n,{length:a}=i;for(let e=0;e<a;e++)M(i[e],r);e(r,`</>`,3)},M=(n,r)=>{switch(n.type){case`JSXText`:t(r,n.raw==null?n.value:n.raw);break;case`JSXExpressionContainer`:A(n,r);break;case`JSXElement`:O(n,r);break;case`JSXFragment`:j(n,r);break;case`JSXSpreadChild`:e(r,`{...`,3),N(n.expression,r,0,0),t(r,`}`);break;default:throw Error(`Unknown JSX child type: ${n.type}`)}},N=(n,r,i,a)=>{switch(n.type){case`Identifier`:f(r),e(r,n.name,0);break;case`MemberExpression`:P(n,r,a);break;case`CallExpression`:F(n,r,i,a);break;case`Literal`:x(n,r,i,a);break;case`BinaryExpression`:n.left.type===`PrivateIdentifier`?L(n,r,i):c(n,r,i,a);break;case`LogicalExpression`:c(n,r,i,a);break;case`ObjectExpression`:_e(n,r);break;case`ArrayExpression`:ve(n,r);break;case`AssignmentExpression`:ye(n,r,i,a);break;case`UpdateExpression`:be(n,r,i,a);break;case`UnaryExpression`:xe(n,r,i,a);break;case`ConditionalExpression`:Se(n,r,i,a);break;case`SequenceExpression`:Ce(n,r,i,a);break;case`ArrowFunctionExpression`:we(n,r,i,a);break;case`FunctionExpression`:S(n,r);break;case`ThisExpression`:f(r),e(r,`this`,0);break;case`Super`:f(r),e(r,`super`,0);break;case`NewExpression`:Te(n,r,i);break;case`TemplateLiteral`:z(n,r);break;case`TaggedTemplateExpression`:N(n.tag,r,19,a&2),z(n.quasi,r);break;case`ClassExpression`:E(n,r);break;case`AwaitExpression`:Ee(n,r,i,a);break;case`YieldExpression`:De(n,r,i);break;case`ImportExpression`:Oe(n,r,i,a);break;case`MetaProperty`:f(r),t(r,n.meta.name),t(r,`.`),e(r,n.property.name,0);break;case`ChainExpression`:ke(n,r,i,a);break;case`ParenthesizedExpression`:{let{expression:t}=n,o=s(t);o.type===`FunctionExpression`||o.type===`ArrowFunctionExpression`?(e(r,`(`,3),N(o,r,0,0),e(r,`)`,3)):N(t,r,i,a);break}case`JSXElement`:O(n,r);break;case`JSXFragment`:j(n,r);break;default:throw Error(`Unknown expression type: ${n.type}`)}},P=(n,r,i)=>{let{object:a}=n;if(n.computed){let t=s(a),o=t.type===`Identifier`&&t.name===`let`;o&&e(r,`(`,3),N(a,r,19,i&2),o&&e(r,`)`,3),n.optional&&e(r,`?.`,3),e(r,`[`,3),N(n.property,r,0,0),e(r,`]`,3)}else{N(a,r,19,i&2),n.optional?e(r,`?`,5):r.last===1&&e(r,` `,3),e(r,`.`,3);let{property:o}=n;o.type===`PrivateIdentifier`&&t(r,`#`),e(r,o.name,0)}},F=(n,r,i,a)=>{let o=i>=20||!!(a&2);o&&(t(r,`(`),(r.last|1)!=7&&(r.last=3)),N(n.callee,r,19,0),n.optional&&e(r,`?.`,3),I(n,n.arguments,r),o&&e(r,`)`,3)},I=(n,r,i)=>{let{length:a}=r;if(a===0){t(i,`(`),e(i,`)`,3);return}e(i,`(`,3);for(let t=0;t<a;t++){t>0&&e(i,`, `,3);let n=r[t];n.type===`SpreadElement`?(e(i,`...`,3),N(n.argument,i,1,0)):N(n,i,1,0)}e(i,`)`,3)},L=(n,r,i)=>{let a=i>=13;a&&e(r,`(`,3),t(r,`#`),e(r,n.left.name,0),e(r,` in `,3),N(n.right,r,12,1),a&&e(r,`)`,3)},_e=(t,n)=>{let r=(n.last-1|1)==7;r&&e(n,`(`,3);let{properties:i}=t,{length:a}=i,o=a>1;if(e(n,`{`,3),o){n.indentLevel++;for(let t=0;t<a;t++)e(n,t>0?`,
9
9
  `:`
10
10
  `,3),m(n),R(i[t],n);e(n,`
11
11
  `,3),n.indentLevel--,m(n)}else a===1&&(e(n,` `,3),R(i[0],n),e(n,` `,3));e(n,`}`,3),r&&e(n,`)`,3)},R=(t,n)=>{if(t.type===`SpreadElement`){e(n,`...`,3),N(t.argument,n,1,0);return}let{key:r,value:i}=t;if(i.type===`FunctionExpression`){let{kind:a}=t,o=a===`get`,s=o||a===`set`;if(s&&e(n,o?`get `:`set `,3),t.method||s){i.async&&(f(n),e(n,`async `,3)),i.generator&&e(n,`*`,3),t.computed?(e(n,`[`,3),N(r,n,1,0),e(n,`]`,3)):H(r,n),C(i.params,n),i.body!=null&&(e(n,` `,3),T(i.body,n));return}}let a=!1,o=null;if(!t.computed&&r.type===`Identifier`){if(r.name===`__proto__`)a=t.shorthand;else{let e=s(i);e.type===`Identifier`&&r.name===e.name&&(a=!0,o=e)}}let{computed:c}=t;!c&&r.type===`Literal`&&typeof r.value==`number`&&(r.value<0||Object.is(r.value,-0)||!Number.isFinite(r.value))&&(c=!0),a?o===null?N(s(i),n,1,0):(f(n),e(n,o.name,0)):(c?(e(n,`[`,3),N(r,n,1,0),e(n,`]`,3)):H(r,n),e(n,`: `,3),N(i,n,1,0))},ve=(t,n)=>{let{elements:r}=t,{length:i}=r,a=i>2;e(n,`[`,3),a&&n.indentLevel++;for(let t=0;t<i;t++){a?(e(n,t===0?`
12
12
  `:`,
13
13
  `,3),m(n)):t!==0&&e(n,`, `,3);let o=r[t];o!=null&&(o.type===`SpreadElement`?(e(n,`...`,3),N(o.argument,n,1,0)):N(o,n,1,0)),t===i-1&&o==null&&e(n,`,`,3)}a&&(e(n,`
14
- `,3),n.indentLevel--,m(n)),e(n,`]`,3)},ye=(t,n,r,a)=>{let{left:o}=t,s=r>=4;!s&&o.type===`ObjectPattern`&&(s=(n.last-1|1)==7),s&&e(n,`(`,3),U(o,n),e(n,i[t.operator],3),N(t.right,n,1,a),s&&e(n,`)`,3)},be=(t,n,r,i)=>{let a=r>=(t.prefix?18:19);a&&e(n,`(`,3);let s=o(t.operator);t.prefix?(p(n,s),e(n,t.operator,s),N(t.argument,n,18,i)):(N(t.argument,n,19,i),p(n,s),e(n,t.operator,s)),a&&e(n,`)`,3)},xe=(t,n,r,i)=>{let o=r>=18;o&&e(n,`(`,3);let{operator:s}=t,c=!1;if(s.length>1)f(n),e(n,s,0),e(n,` `,3),c=s===`delete`&&t.argument.type===`Literal`&&t.argument.value===1/0;else{let t=a(s);p(n,t),t===9&&n.last===4&&(t=10),e(n,s,t)}c&&e(n,`(0, `,3),N(t.argument,n,17,i),c&&e(n,`)`,3),o&&e(n,`)`,3)},Se=(t,n,r,i)=>{let a=r>=5,o=0;a?e(n,`(`,3):o=i&1,N(t.test,n,5,o),e(n,` ? `,3),N(t.consequent,n,3,0),e(n,` : `,3),N(t.alternate,n,3,o),a&&e(n,`)`,3)},Ce=(t,n,r,i)=>{let a=r>=1;a&&e(n,`(`,3);let o=i&-3,{expressions:s}=t,{length:c}=s;for(let t=0;t<c;t++)t>0&&e(n,`, `,3),N(s[t],n,0,o);a&&e(n,`)`,3)},we=(t,n,r,i)=>{let a=r>=4,o=a?i&-2:i;a&&e(n,`(`,3),t.async&&(f(n),e(n,`async `,3));let{returnType:s}=t;ce(t.params,n);let{body:c}=t;c.type===`BlockStatement`?T(c,n):(n.last=8,N(c,n,1,o)),a&&e(n,`)`,3)},Te=(t,n,r)=>{let i=r>=21;i&&e(n,`(`,3),f(n),e(n,`new `,3),N(t.callee,n,20,2),I(t.arguments,n),i&&e(n,`)`,3)},z=(n,r)=>{t(r,"`");let{quasis:i,expressions:a}=n,{length:o}=a,s=i[0];t(r,B(s));for(let n=0;n<o;n++){e(r,"${",3),N(a[n],r,0,0),t(r,`}`);let o=i[n+1];t(r,B(o))}e(r,"`",3)},B=e=>{let{raw:t}=e.value;return t.includes(`\r`)&&(t=t.replace(/\r\n?/g,`
14
+ `,3),n.indentLevel--,m(n)),e(n,`]`,3)},ye=(t,n,r,a)=>{let{left:o}=t,s=r>=4;!s&&o.type===`ObjectPattern`&&(s=(n.last-1|1)==7),s&&e(n,`(`,3),U(o,n),e(n,i[t.operator],3),N(t.right,n,1,a),s&&e(n,`)`,3)},be=(t,n,r,i)=>{let a=r>=(t.prefix?18:19);a&&e(n,`(`,3);let s=o(t.operator);t.prefix?(p(n,s),e(n,t.operator,s),N(t.argument,n,18,i)):(N(t.argument,n,19,i),p(n,s),e(n,t.operator,s)),a&&e(n,`)`,3)},xe=(t,n,r,i)=>{let o=r>=18;o&&e(n,`(`,3);let{operator:s}=t,c=!1;if(s.length>1)f(n),e(n,s,0),e(n,` `,3),c=s===`delete`&&t.argument.type===`Literal`&&t.argument.value===1/0;else{let t=a(s);p(n,t),t===9&&n.last===4&&(t=10),e(n,s,t)}c&&e(n,`(0, `,3),N(t.argument,n,17,i),c&&e(n,`)`,3),o&&e(n,`)`,3)},Se=(t,n,r,i)=>{let a=r>=5,o=0;a?e(n,`(`,3):o=i&1,N(t.test,n,5,o),e(n,` ? `,3),N(t.consequent,n,3,0),e(n,` : `,3),N(t.alternate,n,3,o),a&&e(n,`)`,3)},Ce=(t,n,r,i)=>{let a=r>=1;a&&e(n,`(`,3);let o=i&-3,{expressions:s}=t,{length:c}=s;for(let t=0;t<c;t++)t>0&&e(n,`, `,3),N(s[t],n,0,o);a&&e(n,`)`,3)},we=(t,n,r,i)=>{let a=r>=4,o=a?i&-2:i;a&&e(n,`(`,3),t.async&&(f(n),e(n,`async `,3));let{returnType:s}=t;ce(t.params,n);let{body:c}=t;c.type===`BlockStatement`?T(c,n):(n.last=8,N(c,n,1,o)),a&&e(n,`)`,3)},Te=(t,n,r)=>{let i=r>=21;i&&e(n,`(`,3),f(n),e(n,`new `,3),N(t.callee,n,20,2),I(t,t.arguments,n),i&&e(n,`)`,3)},z=(n,r)=>{t(r,"`");let{quasis:i,expressions:a}=n,{length:o}=a,s=i[0];t(r,B(s));for(let n=0;n<o;n++){e(r,"${",3),N(a[n],r,0,0),t(r,`}`);let o=i[n+1],s=B(o);s.length,t(r,s)}e(r,"`",3)},B=e=>{let{raw:t}=e.value;return t.includes(`\r`)&&(t=t.replace(/\r\n?/g,`
15
15
  `)),ie(t)},Ee=(t,n,r,i)=>{let a=r>=18;a&&e(n,`(`,3),f(n),e(n,`await `,3),N(t.argument,n,17,i),a&&e(n,`)`,3)},De=(t,n,r)=>{let i=r>=4;i&&e(n,`(`,3),f(n),e(n,`yield`,0),t.delegate&&e(n,`*`,3),t.argument!=null&&(e(n,` `,3),N(t.argument,n,3,0)),i&&e(n,`)`,3)},Oe=(n,r,i,a)=>{let o=i>=20||!!(a&2);o&&e(r,`(`,3),f(r),e(r,`import`,0),n.phase!=null&&(t(r,`.`),e(r,n.phase,0)),e(r,`(`,3),N(n.source,r,1,0),n.options!=null&&(e(r,`, `,3),N(n.options,r,1,0)),e(r,`)`,3),o&&e(r,`)`,3)},ke=(t,n,r,i)=>{r>=19||i&2?(e(n,`(`,3),N(t.expression,n,0,0),e(n,`)`,3)):N(t.expression,n,r,i)},V=(t,n)=>{switch(t.type){case`Identifier`:f(n),e(n,t.name,0);break;case`ObjectPattern`:Ae(t,n);break;case`ArrayPattern`:Me(t,n);break;case`AssignmentPattern`:V(t.left,n),e(n,` = `,3),N(t.right,n,1,0);break;case`RestElement`:e(n,`...`,3),V(t.argument,n);break;default:throw Error(`Unknown binding pattern type: ${t.type}`)}},Ae=(t,n)=>{let{properties:r}=t,{length:i}=r;if(i===0){e(n,`{}`,3);return}e(n,`{ `,3);for(let t=0;t<i;t++){t>0&&e(n,`, `,3);let i=r[t];i.type===`RestElement`?(e(n,`...`,3),V(i.argument,n)):je(i,n)}e(n,` }`,3)},je=(t,n)=>{let{key:r,value:i}=t,a=!1;!t.computed&&r.type===`Identifier`&&(i.type===`Identifier`&&r.name===i.name||i.type===`AssignmentPattern`&&i.left.type===`Identifier`&&r.name===i.left.name)&&(a=!0),a||(t.computed?(e(n,`[`,3),N(r,n,1,0),e(n,`]`,3)):H(r,n),e(n,`: `,3)),V(i,n)},H=(n,r)=>{switch(n.type){case`Identifier`:f(r),e(r,n.name,0);break;case`PrivateIdentifier`:t(r,`#`),e(r,n.name,0);break;case`Literal`:typeof n.value==`string`?b(r,n.value,n):x(n,r,1,0);break;default:N(n,r,1,0)}},Me=(t,n)=>{let{elements:r}=t,{length:i}=r,a=null;if(i>0){let e=r[i-1];e!=null&&e.type===`RestElement`&&(a=e,i--)}e(n,`[`,3);for(let t=0;t<i;t++){t!==0&&e(n,`, `,3);let o=r[t];o!=null&&V(o,n),t===i-1&&(o==null||a!==null)&&e(n,`,`,3)}a!==null&&(e(n,` `,3),V(a,n)),e(n,`]`,3)},U=(t,n)=>{switch(t.type){case`Identifier`:f(n),e(n,t.name,0);break;case`MemberExpression`:P(t,n,0);break;case`ObjectPattern`:Ne(t,n);break;case`ArrayPattern`:Fe(t,n);break;default:N(t,n,1,0)}},Ne=(t,n)=>{e(n,`{`,3);let{properties:r}=t,{length:i}=r;for(let t=0;t<i;t++){t>0&&e(n,`, `,3);let i=r[t];i.type===`RestElement`?(e(n,`...`,3),U(i.argument,n)):Pe(i,n)}e(n,`}`,3)},Pe=(t,n)=>{if(t.shorthand){let{value:r}=t;r.type===`AssignmentPattern`?(f(n),e(n,r.left.name,0),e(n,` = `,3),N(r.right,n,1,0)):(f(n),e(n,r.name,0))}else{let{key:r}=t;t.computed?(e(n,`[`,3),N(r,n,1,0),e(n,`]`,3)):H(r,n),e(n,`: `,3),W(t.value,n)}},W=(t,n)=>{t.type===`AssignmentPattern`?(U(t.left,n),e(n,` = `,3),N(t.right,n,1,0)):U(t,n)},Fe=(t,n)=>{let{elements:r}=t,{length:i}=r,a=null;if(i>0){let e=r[i-1];e!=null&&e.type===`RestElement`&&(a=e,i--)}e(n,`[`,3);for(let t=0;t<i;t++){t!==0&&e(n,`, `,3);let o=r[t];o!=null&&W(o,n),t===i-1&&(o==null||a!==null)&&e(n,`,`,3)}a!==null&&(i>0&&e(n,` `,3),e(n,`...`,3),U(a.argument,n)),e(n,`]`,3)},Ie=(n,r)=>{m(r),f(r),e(r,`import`,0),n.phase!=null&&(t(r,` `),e(r,n.phase,0));let{specifiers:i}=n,{length:a}=i;if(a===0){e(r,` `,3),b(r,n.source.value,n.source),G(n.attributes,r),e(r,`;
16
16
  `,3);return}let o=!1;for(let t=0;t<a;t++){let n=i[t];switch(n.type){case`ImportDefaultSpecifier`:o?(e(r,` },`,3),o=!1):t===0?e(r,` `,3):e(r,`, `,3),f(r),e(r,n.local.name,0),t===a-1&&e(r,` `,3);break;case`ImportNamespaceSpecifier`:o?(e(r,` },`,3),o=!1):t===0?e(r,` `,3):e(r,`, `,3),e(r,`* as `,3),e(r,n.local.name,0),e(r,` `,3);break;default:{o?e(r,`, `,3):(t!==0&&e(r,`,`,3),o=!0,e(r,` { `,3));let i=K(n.imported,r),{local:a}=n;i!==a.name&&(e(r,` as `,3),e(r,a.name,0));break}}}e(r,o?` } from `:`from `,3),b(r,n.source.value,n.source),G(n.attributes,r),e(r,`;
17
- `,3)},G=(t,n)=>{if(t==null)return;let{length:r}=t;if(r!==0){e(n,` with { `,3);for(let i=0;i<r;i++){i>0&&e(n,`, `,3);let r=t[i],{key:a}=r;a.type===`Identifier`?e(n,a.name,0):b(n,a.value,a),e(n,`: `,3),b(n,r.value.value,r.value)}e(n,` }`,3)}},K=(t,n)=>t.type===`Identifier`?(f(n),e(n,t.name,0),t.name):(b(n,t.value,t),t.value),Le=(t,n)=>{m(n),e(n,`export `,3);let{declaration:r}=t;if(r!=null){switch(r.type){case`VariableDeclaration`:Y(r,n,0),e(n,`;
17
+ `,3)},G=(n,r)=>{if(n==null)return;let{length:i}=n;if(i!==0){t(r,` `),e(r,`with { `,3);for(let t=0;t<i;t++){t>0&&e(r,`, `,3);let i=n[t],{key:a}=i;a.type===`Identifier`?e(r,a.name,0):b(r,a.value,a),e(r,`: `,3),b(r,i.value.value,i.value)}e(r,` }`,3)}},K=(t,n)=>t.type===`Identifier`?(f(n),e(n,t.name,0),t.name):(b(n,t.value,t),t.value),Le=(t,n)=>{m(n),e(n,`export `,3);let{declaration:r}=t;if(r!=null){switch(r.type){case`VariableDeclaration`:Y(r,n,0),e(n,`;
18
18
  `,3);break;case`FunctionDeclaration`:S(r,n),e(n,`
19
19
  `,3);break;case`ClassDeclaration`:E(r,n),e(n,`
20
20
  `,3);break;default:throw Error(`Unknown export declaration type: ${r.type}`)}return}e(n,`{`,3);let{specifiers:i}=t,{length:a}=i;if(a>0){e(n,` `,3);for(let t=0;t<a;t++){t>0&&e(n,`, `,3);let r=i[t];K(r.local,n)!==(r.exported.type===`Identifier`?r.exported.name:r.exported.value)&&(e(n,` as `,3),K(r.exported,n))}e(n,` `,3)}e(n,`}`,3),t.source!=null&&(e(n,` from `,3),b(n,t.source.value,t.source),G(t.attributes,n)),e(n,`;
@@ -23,7 +23,7 @@ const e=(e,t,n)=>{e.last=n,e.output+=t},t=(e,t)=>{e.output+=t},n={__proto__:null
23
23
  `,3);break;case`ClassDeclaration`:E(r,n),e(n,`
24
24
  `,3);break;default:n.last=6,N(r,n,1,0),e(n,`;
25
25
  `,3)}},Be=(n,r)=>{n.hashbang!=null&&(t(r,`#!`),t(r,n.hashbang.value),e(r,`
26
- `,3)),q(n.body,r)},q=(n,r)=>{let{length:i}=n;if(i===0)return;let a=0,o=n[0];for(;o.type===`ExpressionStatement`;)if(o.directive!=null){if(Ve(o,r),++a>=i)return;o=n[a]}else{let n=s(o.expression);n.type===`Literal`&&typeof n.value==`string`&&(m(r),t(r,`(`),b(r,n.value,n),e(r,`);
26
+ `,3)),q(n.body,r)},q=(n,r)=>{let{length:i}=n;if(i===0)return;let a=0,o=n[0];for(;o.type===`ExpressionStatement`;)if(o.directive!=null){if(Ve(o,r),++a>=i)return;o=n[a]}else{let n=s(o.expression);n.type===`Literal`&&typeof n.value==`string`&&(r.indentLevel>0||r.pendingIndentAsSpace,m(r),t(r,`(`),b(r,n.value,n),e(r,`);
27
27
  `,3),a++);break}for(;a<i;a++)J(n[a],r)},Ve=(n,r)=>{m(r);let{directive:i}=n,a=`"`,{length:o}=i;for(let e=0;e<o;e++){let t=i[e];if(t===`"`){a=`'`;break}if(t===`'`)break;t===`\\`&&e++}t(r,a),t(r,i),t(r,a),e(r,`;
28
28
  `,3)},J=(t,n)=>{switch(t.type){case`ExpressionStatement`:He(t,n);break;case`VariableDeclaration`:m(n),Y(t,n,0),e(n,`;
29
29
  `,3);break;case`BlockStatement`:m(n),X(t,n),e(n,`
@@ -34,21 +34,21 @@ const e=(e,t,n)=>{e.last=n,e.output+=t},t=(e,t)=>{e.output+=t},n={__proto__:null
34
34
  `,3);break;case`ForInStatement`:Xe(t,n);break;case`ForOfStatement`:Ze(t,n);break;case`ClassDeclaration`:m(n),E(t,n),e(n,`
35
35
  `,3);break;case`LabeledStatement`:m(n),f(n),e(n,t.label.name,0),e(n,`:`,3),$(t.body,n);break;case`EmptyStatement`:m(n),e(n,`;
36
36
  `,3);break;case`ImportDeclaration`:Ie(t,n);break;case`ExportNamedDeclaration`:Le(t,n);break;case`ExportDefaultDeclaration`:ze(t,n);break;case`ExportAllDeclaration`:Re(t,n);break;case`WithStatement`:m(n),f(n),e(n,`with(`,3),N(t.object,n,0,0),e(n,`)`,3),$(t.body,n);break;case`DebuggerStatement`:m(n),f(n),e(n,`debugger;
37
- `,3);break;default:throw Error(`Unknown statement type: ${t.type}`)}},He=(t,n)=>{m(n),n.last=7,N(t.expression,n,0,0),e(n,`;
38
- `,3)},Y=(t,n,r)=>{f(n),e(n,t.kind,0);let{declarations:i}=t,{length:a}=i;a>0&&e(n,` `,3);for(let t=0;t<a;t++){t>0&&e(n,`, `,3);let a=i[t],{id:o}=a;V(o,n),a.init!=null&&(e(n,` = `,3),N(a.init,n,1,r))}},X=(t,n)=>{let{body:r}=t,{length:i}=r;if(i===0){e(n,`{}`,3);return}e(n,`{
39
- `,3),n.indentLevel++;for(let e=0;e<i;e++)J(r[e],n);n.indentLevel--,m(n),e(n,`}`,3)},Z=(t,n)=>{f(n),e(n,`if (`,3),N(t.test,n,0,0);let{consequent:r,alternate:i}=t;r.type===`BlockStatement`?(e(n,`) `,3),X(r,n),e(n,i==null?`
40
- `:` `,3)):Q(r)?(e(n,`) {
41
- `,3),n.indentLevel++,J(r,n),n.indentLevel--,m(n),e(n,`}`,3),e(n,i==null?`
42
- `:` `,3)):(e(n,`)`,3),$(r,n),i!=null&&m(n)),i!=null&&(f(n),e(n,`else`,0),i.type===`BlockStatement`?(e(n,` `,3),X(i,n),e(n,`
43
- `,3)):i.type===`IfStatement`?(e(n,` `,3),Z(i,n)):$(i,n))},Q=e=>{for(;;)switch(e.type){case`IfStatement`:if(e.alternate==null)return!0;e=e.alternate;break;case`ForStatement`:case`ForOfStatement`:case`ForInStatement`:case`WhileStatement`:case`WithStatement`:case`LabeledStatement`:e=e.body;break;default:return!1}},Ue=(t,n)=>{m(n),f(n);let{argument:r}=t;r==null?e(n,`return`,0):(e(n,`return `,3),N(r,n,0,0)),e(n,`;
37
+ `,3);break;default:throw Error(`Unknown statement type: ${t.type}`)}},He=(t,n)=>{n.indentLevel>0||n.pendingIndentAsSpace,m(n),n.last=7,N(t.expression,n,0,0),e(n,`;
38
+ `,3)},Y=(t,n,r)=>{f(n),e(n,t.kind,0);let{declarations:i}=t,{length:a}=i;a>0&&e(n,` `,3);for(let t=0;t<a;t++){t>0&&e(n,`, `,3);let a=i[t],{id:o}=a;V(o,n),a.init!=null&&(e(n,` = `,3),N(a.init,n,1,r))}},X=(n,r)=>{let{body:i}=n,{length:a}=i;if(a===0){t(r,`{`),e(r,`}`,3);return}e(r,`{
39
+ `,3),r.indentLevel++;for(let e=0;e<a;e++)J(i[e],r);r.indentLevel--,m(r),e(r,`}`,3)},Z=(n,r)=>{f(r),e(r,`if (`,3),N(n.test,r,0,0);let{consequent:i,alternate:a}=n;i.type===`BlockStatement`?(e(r,`) `,3),X(i,r),e(r,a==null?`
40
+ `:` `,3)):Q(i)?(t(r,`) `),e(r,`{
41
+ `,3),r.indentLevel++,J(i,r),r.indentLevel--,m(r),e(r,`}`,3),e(r,a==null?`
42
+ `:` `,3)):(e(r,`)`,3),$(i,r),a!=null&&m(r)),a!=null&&(f(r),e(r,`else`,0),a.type===`BlockStatement`?(e(r,` `,3),X(a,r),e(r,`
43
+ `,3)):a.type===`IfStatement`?(e(r,` `,3),Z(a,r)):$(a,r))},Q=e=>{for(;;)switch(e.type){case`IfStatement`:if(e.alternate==null)return!0;e=e.alternate;break;case`ForStatement`:case`ForOfStatement`:case`ForInStatement`:case`WhileStatement`:case`WithStatement`:case`LabeledStatement`:e=e.body;break;default:return!1}},Ue=(t,n)=>{m(n),f(n);let{argument:r}=t;r==null?e(n,`return`,0):(e(n,`return `,3),N(r,n,0,0)),e(n,`;
44
44
  `,3)},We=(t,n)=>{m(n),f(n),e(n,`try `,3),X(t.block,n);let{handler:r}=t;r!=null&&(e(n,` catch`,0),r.param!=null&&(e(n,` (`,3),V(r.param,n),e(n,`)`,3)),e(n,` `,3),X(r.body,n)),t.finalizer!=null&&(e(n,` finally `,3),X(t.finalizer,n)),e(n,`
45
- `,3)},Ge=(t,n)=>{m(n),f(n),e(n,`switch (`,3),N(t.discriminant,n,0,0),e(n,`) `,3);let{cases:r}=t,{length:i}=r;if(i===0){e(n,`{}
46
- `,3);return}e(n,`{
47
- `,3),n.indentLevel++;for(let e=0;e<i;e++)Ke(r[e],n);n.indentLevel--,m(n),e(n,`}
45
+ `,3)},Ge=(n,r)=>{m(r),f(r),e(r,`switch (`,3),N(n.discriminant,r,0,0),e(r,`) `,3);let{cases:i}=n,{length:a}=i;if(a===0){t(r,`{`),e(r,`}
46
+ `,3);return}e(r,`{
47
+ `,3),r.indentLevel++;for(let e=0;e<a;e++)Ke(i[e],r);r.indentLevel--,m(r),e(r,`}
48
48
  `,3)},Ke=(t,n)=>{m(n),t.test==null?e(n,`default`,0):(e(n,`case `,3),N(t.test,n,0,0)),e(n,`:`,3);let{consequent:r}=t,{length:i}=r;if(i===1){$(r[0],n);return}e(n,`
49
49
  `,3),n.indentLevel++;for(let e=0;e<i;e++)J(r[e],n);n.indentLevel--},qe=(t,n)=>{m(n),f(n),e(n,`while (`,3),N(t.test,n,0,0),e(n,`)`,3),$(t.body,n)},Je=(t,n)=>{m(n),f(n),e(n,`do`,0);let{body:r}=t;r.type===`BlockStatement`?(e(n,` `,3),X(r,n),e(n,` `,3)):r.type===`EmptyStatement`?(m(n),e(n,`;
50
50
  `,3)):(e(n,`
51
51
  `,3),n.indentLevel++,J(r,n),n.indentLevel--,m(n)),e(n,`while (`,3),N(t.test,n,0,0),e(n,`);
52
52
  `,3)},Ye=(t,n)=>{m(n),f(n),e(n,`for (`,3);let{init:r}=t;r!=null&&(r.type===`VariableDeclaration`?Y(r,n,1):N(r,n,0,1));let{test:i,update:a}=t;i==null?e(n,`;`,3):(e(n,`; `,3),N(i,n,0,0)),a==null?e(n,`;)`,3):(e(n,`; `,3),N(a,n,0,0),e(n,`)`,3)),$(t.body,n)},Xe=(t,n)=>{m(n),f(n),e(n,`for (`,3);let{left:r}=t;r.type===`VariableDeclaration`?Y(r,n,1):U(r,n),e(n,` in `,3),N(t.right,n,0,0),e(n,`)`,3),$(t.body,n)},Ze=(t,n)=>{m(n),f(n),e(n,`for`,0),t.await&&e(n,` await`,0),e(n,` (`,3);let{left:r}=t;if(r.type===`VariableDeclaration`)Y(r,n,0);else{let i=s(r),a=Qe(r)||!t.await&&i.type===`Identifier`&&i.name===`async`;a&&e(n,`(`,3),U(r,n),a&&e(n,`)`,3)}e(n,` of `,3),N(t.right,n,1,0),e(n,`)`,3),$(t.body,n)},Qe=e=>{for(;;)switch(e.type){case`Identifier`:return e.name===`let`;case`MemberExpression`:if(e.computed){let t=s(e.object);if(t.type===`Identifier`&&t.name===`let`)return!1}e=e.object;break;case`ParenthesizedExpression`:e=e.expression;break;default:return!1}},$=(t,n)=>{t.type===`BlockStatement`?(e(n,` `,3),X(t,n),e(n,`
53
53
  `,3)):t.type===`EmptyStatement`?e(n,`;
54
- `,3):(n.pendingIndentAsSpace=!0,J(t,n))},$e=(e,t,n)=>(e.type===`Program`?Be(e,t):J(e,t),t.output);export{$e as printSync};
54
+ `,3):(n.pendingIndentAsSpace=!0,J(t,n))},$e=(e,t,n)=>(e.type===`Program`?Be(e,t):J(e,t),{code:t.output,map:null});export{$e as printSync};