pixel-react 1.20.19 → 1.20.20

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.
@@ -4,7 +4,7 @@ export interface ButtonProps {
4
4
  /**
5
5
  * Variant of the button
6
6
  */
7
- variant: 'primary' | 'secondary' | 'tertiary' | 'delete' | 'warning' | 'custom' | 'danger';
7
+ variant: 'primary' | 'secondary' | 'tertiary' | 'delete' | 'warning' | 'custom' | 'danger' | string;
8
8
  /**
9
9
  * What background color to use
10
10
  */
@@ -3,7 +3,7 @@ export interface BtnPropsCommon {
3
3
  /**
4
4
  * Variant of the button
5
5
  */
6
- variant?: 'primary' | 'secondary' | 'tertiary' | 'delete' | 'warning' | 'custom' | 'danger';
6
+ variant?: 'primary' | 'secondary' | 'tertiary' | 'delete' | 'warning' | 'custom' | 'danger' | string;
7
7
  /**
8
8
  * Label for the button
9
9
  */
package/lib/index.d.ts CHANGED
@@ -106,7 +106,7 @@ interface ButtonProps {
106
106
  /**
107
107
  * Variant of the button
108
108
  */
109
- variant: 'primary' | 'secondary' | 'tertiary' | 'delete' | 'warning' | 'custom' | 'danger';
109
+ variant: 'primary' | 'secondary' | 'tertiary' | 'delete' | 'warning' | 'custom' | 'danger' | string;
110
110
  /**
111
111
  * What background color to use
112
112
  */
@@ -218,7 +218,7 @@ interface BtnPropsCommon {
218
218
  /**
219
219
  * Variant of the button
220
220
  */
221
- variant?: 'primary' | 'secondary' | 'tertiary' | 'delete' | 'warning' | 'custom' | 'danger';
221
+ variant?: 'primary' | 'secondary' | 'tertiary' | 'delete' | 'warning' | 'custom' | 'danger' | string;
222
222
  /**
223
223
  * Label for the button
224
224
  */
@@ -1 +1 @@
1
- import{__exports as t}from"../../../../../_virtual/beautifier2.js";import{__require as i}from"./options.js";import{__require as e}from"../core/output.js";import{__require as s}from"../core/inputscanner.js";import{__require as h}from"../core/directives.js";var _;function n(){if(_)return t;_=1;var n=i().Options,p=e().Output,r=s().InputScanner,o=new(0,h().Directives)(/\/\*/,/\*\//),u=/\r\n|[\r\n]/,a=/\r\n|[\r\n]/g,c=/\s/,l=/(?:\s|\n)+/g,d=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,f=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function g(t,i){this._source_text=t||"",this._options=new n(i),this._ch=null,this._input=null,this.NESTED_AT_RULE={page:!0,"font-face":!0,keyframes:!0,media:!0,supports:!0,document:!0},this.CONDITIONAL_GROUP_RULE={media:!0,supports:!0,document:!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}return g.prototype.eatString=function(t){var i="";for(this._ch=this._input.next();this._ch;){if(i+=this._ch,"\\"===this._ch)i+=this._input.next();else if(-1!==t.indexOf(this._ch)||"\n"===this._ch)break;this._ch=this._input.next()}return i},g.prototype.eatWhitespace=function(t){for(var i=c.test(this._input.peek()),e=0;c.test(this._input.peek());)this._ch=this._input.next(),t&&"\n"===this._ch&&(0===e||e<this._options.max_preserve_newlines)&&(e++,this._output.add_new_line(!0));return i},g.prototype.foundNestedPseudoClass=function(){for(var t=0,i=1,e=this._input.peek(i);e;){if("{"===e)return!0;if("("===e)t+=1;else if(")"===e){if(0===t)return!1;t-=1}else if(";"===e||"}"===e)return!1;i++,e=this._input.peek(i)}return!1},g.prototype.print_string=function(t){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(t)},g.prototype.preserveSingleSpace=function(t){t&&(this._output.space_before_token=!0)},g.prototype.indent=function(){this._indentLevel++},g.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},g.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var t=this._source_text,i=this._options.eol;"auto"===i&&(i="\n",t&&u.test(t||"")&&(i=t.match(u)[0]));var e=(t=t.replace(a,"\n")).match(/^[\t ]*/)[0];this._output=new p(this._options,e),this._input=new r(t),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var s,h,_=0,n=!1,g=!1,k=!1,v=!1,S=!1,b=this._ch,w=!1;s=""!==this._input.read(l),h=b,this._ch=this._input.next(),"\\"===this._ch&&this._input.hasNext()&&(this._ch+=this._input.next()),b=this._ch,this._ch;)if("/"===this._ch&&"*"===this._input.peek()){this._output.add_new_line(),this._input.back();var m=this._input.read(d),L=o.get_directives(m);L&&"start"===L.ignore&&(m+=o.readIgnored(this._input)),this.print_string(m),this.eatWhitespace(!0),this._output.add_new_line()}else if("/"===this._ch&&"/"===this._input.peek())this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(f)),this.eatWhitespace(!0);else if("$"===this._ch){this.preserveSingleSpace(s),this.print_string(this._ch);var N=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);N.match(/[ :]$/)&&(N=this.eatString(": ").replace(/\s+$/,""),this.print_string(N),this._output.space_before_token=!0),0===_&&-1!==N.indexOf(":")&&(g=!0,this.indent())}else if("@"===this._ch)if(this.preserveSingleSpace(s),"{"===this._input.peek())this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var O=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);O.match(/[ :]$/)&&(O=this.eatString(": ").replace(/\s+$/,""),this.print_string(O),this._output.space_before_token=!0),0===_&&-1!==O.indexOf(":")?(g=!0,this.indent()):O in this.NESTED_AT_RULE?(this._nestedLevel+=1,O in this.CONDITIONAL_GROUP_RULE&&(k=!0)):0!==_||g||(v=!0)}else if("#"===this._ch&&"{"===this._input.peek())this.preserveSingleSpace(s),this.print_string(this._ch+this.eatString("}"));else if("{"===this._ch)g&&(g=!1,this.outdent()),v=!1,k?(k=!1,n=this._indentLevel>=this._nestedLevel):n=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&n&&this._output.previous_line&&"{"!==this._output.previous_line.item(-1)&&this._output.ensure_empty_line_above("/",","),this._output.space_before_token=!0,"expand"===this._options.brace_style?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):("("===h?this._output.space_before_token=!1:","!==h&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if("}"===this._ch)this.outdent(),this._output.add_new_line(),"{"===h&&this._output.trim(!0),g&&(this.outdent(),g=!1),this.print_string(this._ch),n=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&"}"!==this._input.peek()&&this._output.add_new_line(!0),")"===this._input.peek()&&(this._output.trim(!0),"expand"===this._options.brace_style&&this._output.add_new_line(!0));else if(":"===this._ch){for(var x=0;x<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;x++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[x])){w=!0;break}!n&&!k||this._input.lookBack("&")||this.foundNestedPseudoClass()||this._input.lookBack("(")||v||0!==_?(this._input.lookBack(" ")&&(this._output.space_before_token=!0),":"===this._input.peek()?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":")):(this.print_string(":"),g||(g=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent()))}else if('"'===this._ch||"'"===this._ch){var E='"'===h||"'"===h;this.preserveSingleSpace(E||s),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(";"===this._ch)w=!1,0===_?(g&&(this.outdent(),g=!1),v=!1,this.print_string(this._ch),this.eatWhitespace(!0),"/"!==this._input.peek()&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if("("===this._ch)if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),_++,this.indent(),this._ch=this._input.next(),")"===this._ch||'"'===this._ch||"'"===this._ch?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),_&&(_--,this.outdent()));else{var W=!1;this._input.lookBack("with")&&(W=!0),this.preserveSingleSpace(s||W),this.print_string(this._ch),g&&"$"===h&&this._options.selector_separator_newline?(this._output.add_new_line(),S=!0):(this.eatWhitespace(),_++,this.indent())}else if(")"===this._ch)_&&(_--,this.outdent()),S&&";"===this._input.peek()&&this._options.selector_separator_newline&&(S=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(","===this._ch)this.print_string(this._ch),this.eatWhitespace(!0),!this._options.selector_separator_newline||g&&!S||0!==_||v?this._output.space_before_token=!0:this._output.add_new_line();else if(">"!==this._ch&&"+"!==this._ch&&"~"!==this._ch||g||0!==_)if("]"===this._ch)this.print_string(this._ch);else if("["===this._ch)this.preserveSingleSpace(s),this.print_string(this._ch);else if("="===this._ch)this.eatWhitespace(),this.print_string("="),c.test(this._ch)&&(this._ch="");else if("!"!==this._ch||this._input.lookBack("\\")){var y='"'===h||"'"===h;this.preserveSingleSpace(y||s),this.print_string(this._ch),!this._output.just_added_newline()&&"\n"===this._input.peek()&&w&&this._output.add_new_line()}else this._output.space_before_token=!0,this.print_string(this._ch);else this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&c.test(this._ch)&&(this._ch=""));return this._output.get_code(i)},t.Beautifier=g,t}export{n as __require};
1
+ import{__exports as t}from"../../../../../_virtual/beautifier3.js";import{__require as i}from"./options.js";import{__require as e}from"../core/output.js";import{__require as s}from"../core/inputscanner.js";import{__require as h}from"../core/directives.js";var _;function n(){if(_)return t;_=1;var n=i().Options,p=e().Output,r=s().InputScanner,o=new(0,h().Directives)(/\/\*/,/\*\//),u=/\r\n|[\r\n]/,a=/\r\n|[\r\n]/g,c=/\s/,l=/(?:\s|\n)+/g,d=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,f=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function g(t,i){this._source_text=t||"",this._options=new n(i),this._ch=null,this._input=null,this.NESTED_AT_RULE={page:!0,"font-face":!0,keyframes:!0,media:!0,supports:!0,document:!0},this.CONDITIONAL_GROUP_RULE={media:!0,supports:!0,document:!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}return g.prototype.eatString=function(t){var i="";for(this._ch=this._input.next();this._ch;){if(i+=this._ch,"\\"===this._ch)i+=this._input.next();else if(-1!==t.indexOf(this._ch)||"\n"===this._ch)break;this._ch=this._input.next()}return i},g.prototype.eatWhitespace=function(t){for(var i=c.test(this._input.peek()),e=0;c.test(this._input.peek());)this._ch=this._input.next(),t&&"\n"===this._ch&&(0===e||e<this._options.max_preserve_newlines)&&(e++,this._output.add_new_line(!0));return i},g.prototype.foundNestedPseudoClass=function(){for(var t=0,i=1,e=this._input.peek(i);e;){if("{"===e)return!0;if("("===e)t+=1;else if(")"===e){if(0===t)return!1;t-=1}else if(";"===e||"}"===e)return!1;i++,e=this._input.peek(i)}return!1},g.prototype.print_string=function(t){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(t)},g.prototype.preserveSingleSpace=function(t){t&&(this._output.space_before_token=!0)},g.prototype.indent=function(){this._indentLevel++},g.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},g.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var t=this._source_text,i=this._options.eol;"auto"===i&&(i="\n",t&&u.test(t||"")&&(i=t.match(u)[0]));var e=(t=t.replace(a,"\n")).match(/^[\t ]*/)[0];this._output=new p(this._options,e),this._input=new r(t),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var s,h,_=0,n=!1,g=!1,k=!1,v=!1,S=!1,b=this._ch,w=!1;s=""!==this._input.read(l),h=b,this._ch=this._input.next(),"\\"===this._ch&&this._input.hasNext()&&(this._ch+=this._input.next()),b=this._ch,this._ch;)if("/"===this._ch&&"*"===this._input.peek()){this._output.add_new_line(),this._input.back();var m=this._input.read(d),L=o.get_directives(m);L&&"start"===L.ignore&&(m+=o.readIgnored(this._input)),this.print_string(m),this.eatWhitespace(!0),this._output.add_new_line()}else if("/"===this._ch&&"/"===this._input.peek())this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(f)),this.eatWhitespace(!0);else if("$"===this._ch){this.preserveSingleSpace(s),this.print_string(this._ch);var N=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);N.match(/[ :]$/)&&(N=this.eatString(": ").replace(/\s+$/,""),this.print_string(N),this._output.space_before_token=!0),0===_&&-1!==N.indexOf(":")&&(g=!0,this.indent())}else if("@"===this._ch)if(this.preserveSingleSpace(s),"{"===this._input.peek())this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var O=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);O.match(/[ :]$/)&&(O=this.eatString(": ").replace(/\s+$/,""),this.print_string(O),this._output.space_before_token=!0),0===_&&-1!==O.indexOf(":")?(g=!0,this.indent()):O in this.NESTED_AT_RULE?(this._nestedLevel+=1,O in this.CONDITIONAL_GROUP_RULE&&(k=!0)):0!==_||g||(v=!0)}else if("#"===this._ch&&"{"===this._input.peek())this.preserveSingleSpace(s),this.print_string(this._ch+this.eatString("}"));else if("{"===this._ch)g&&(g=!1,this.outdent()),v=!1,k?(k=!1,n=this._indentLevel>=this._nestedLevel):n=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&n&&this._output.previous_line&&"{"!==this._output.previous_line.item(-1)&&this._output.ensure_empty_line_above("/",","),this._output.space_before_token=!0,"expand"===this._options.brace_style?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):("("===h?this._output.space_before_token=!1:","!==h&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if("}"===this._ch)this.outdent(),this._output.add_new_line(),"{"===h&&this._output.trim(!0),g&&(this.outdent(),g=!1),this.print_string(this._ch),n=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&"}"!==this._input.peek()&&this._output.add_new_line(!0),")"===this._input.peek()&&(this._output.trim(!0),"expand"===this._options.brace_style&&this._output.add_new_line(!0));else if(":"===this._ch){for(var x=0;x<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;x++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[x])){w=!0;break}!n&&!k||this._input.lookBack("&")||this.foundNestedPseudoClass()||this._input.lookBack("(")||v||0!==_?(this._input.lookBack(" ")&&(this._output.space_before_token=!0),":"===this._input.peek()?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":")):(this.print_string(":"),g||(g=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent()))}else if('"'===this._ch||"'"===this._ch){var E='"'===h||"'"===h;this.preserveSingleSpace(E||s),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(";"===this._ch)w=!1,0===_?(g&&(this.outdent(),g=!1),v=!1,this.print_string(this._ch),this.eatWhitespace(!0),"/"!==this._input.peek()&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if("("===this._ch)if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),_++,this.indent(),this._ch=this._input.next(),")"===this._ch||'"'===this._ch||"'"===this._ch?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),_&&(_--,this.outdent()));else{var W=!1;this._input.lookBack("with")&&(W=!0),this.preserveSingleSpace(s||W),this.print_string(this._ch),g&&"$"===h&&this._options.selector_separator_newline?(this._output.add_new_line(),S=!0):(this.eatWhitespace(),_++,this.indent())}else if(")"===this._ch)_&&(_--,this.outdent()),S&&";"===this._input.peek()&&this._options.selector_separator_newline&&(S=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(","===this._ch)this.print_string(this._ch),this.eatWhitespace(!0),!this._options.selector_separator_newline||g&&!S||0!==_||v?this._output.space_before_token=!0:this._output.add_new_line();else if(">"!==this._ch&&"+"!==this._ch&&"~"!==this._ch||g||0!==_)if("]"===this._ch)this.print_string(this._ch);else if("["===this._ch)this.preserveSingleSpace(s),this.print_string(this._ch);else if("="===this._ch)this.eatWhitespace(),this.print_string("="),c.test(this._ch)&&(this._ch="");else if("!"!==this._ch||this._input.lookBack("\\")){var y='"'===h||"'"===h;this.preserveSingleSpace(y||s),this.print_string(this._ch),!this._output.just_added_newline()&&"\n"===this._input.peek()&&w&&this._output.add_new_line()}else this._output.space_before_token=!0,this.print_string(this._ch);else this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&c.test(this._ch)&&(this._ch=""));return this._output.get_code(i)},t.Beautifier=g,t}export{n as __require};
@@ -1 +1 @@
1
- import{__exports as t}from"../../../../../_virtual/options2.js";import{__require as e}from"../core/options.js";var i;function n(){if(i)return t;i=1;var n=e().Options;function r(t){n.call(this,t,"html"),1===this.templating.length&&"auto"===this.templating[0]&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_min_attrs=this._get_number("wrap_attributes_min_attrs",2),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.inline_custom_elements=this._get_boolean("inline_custom_elements",!0),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}return r.prototype=new n,t.Options=r,t}export{n as __require};
1
+ import{__exports as t}from"../../../../../_virtual/options.js";import{__require as e}from"../core/options.js";var i;function n(){if(i)return t;i=1;var n=e().Options;function r(t){n.call(this,t,"html"),1===this.templating.length&&"auto"===this.templating[0]&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_min_attrs=this._get_number("wrap_attributes_min_attrs",2),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.inline_custom_elements=this._get_boolean("inline_custom_elements",!0),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}return r.prototype=new n,t.Options=r,t}export{n as __require};
@@ -1 +1 @@
1
- import{__exports as t}from"../../../../../_virtual/beautifier3.js";import{__require as e}from"../core/output.js";import{__require as s}from"../core/token.js";import{__require as _}from"./acorn.js";import{__require as i}from"./options.js";import{__require as n}from"./tokenizer.js";var o;function a(){if(o)return t;o=1;var a=e().Output,l=s().Token,h=_(),r=i().Options,p=n().Tokenizer,f=n().line_starters,u=n().positionable_operators,d=n().TOKEN;function g(t,e){return-1!==e.indexOf(t)}function k(t){return t.replace(/^\s+/g,"")}function c(t,e){return t&&t.type===d.RESERVED&&t.text===e}function m(t,e){return t&&t.type===d.RESERVED&&g(t.text,e)}var w=["case","return","do","if","throw","else","await","break","continue","async"],y=function(t){for(var e={},s=0;s<t.length;s++)e[t[s].replace(/-/g,"_")]=t[s];return e}(["before-newline","after-newline","preserve-newline"]),x=[y.before_newline,y.preserve_newline],b="BlockStatement",v="Statement",E="ObjectLiteral",R="ArrayLiteral",O="ForInitializer",T="Conditional",A="Expression";function S(t,e){e.multiline_frame||e.mode===O||e.mode===T||t.remove_indent(e.start_line_index)}function D(t){return t===R}function N(t){return g(t,[A,O,T])}function P(t,e){e=e||{},this._source_text=t||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new r(e)}P.prototype.create_flags=function(t,e){var s=0;return t&&(s=t.indentation_level,!this._output.just_added_newline()&&t.line_indent_level>s&&(s=t.line_indent_level)),{mode:e,parent:t,last_token:t?t.last_token:new l(d.START_BLOCK,""),last_word:t?t.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:s,alignment:0,line_indent_level:t?t.line_indent_level:s,start_line_index:this._output.get_line_number(),ternary_depth:0}},P.prototype._reset=function(t){var e=t.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new a(this._options,e),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(b);var s=new p(t,this._options);return this._tokens=s.tokenize(),t},P.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var t=this._reset(this._source_text),e=this._options.eol;"auto"===this._options.eol&&(e="\n",t&&h.lineBreak.test(t||"")&&(e=t.match(h.lineBreak)[0]));for(var s=this._tokens.next();s;)this.handle_token(s),this._last_last_text=this._flags.last_token.text,this._flags.last_token=s,s=this._tokens.next();return this._output.get_code(e)},P.prototype.handle_token=function(t,e){t.type===d.START_EXPR?this.handle_start_expr(t):t.type===d.END_EXPR?this.handle_end_expr(t):t.type===d.START_BLOCK?this.handle_start_block(t):t.type===d.END_BLOCK?this.handle_end_block(t):t.type===d.WORD||t.type===d.RESERVED?this.handle_word(t):t.type===d.SEMICOLON?this.handle_semicolon(t):t.type===d.STRING?this.handle_string(t):t.type===d.EQUALS?this.handle_equals(t):t.type===d.OPERATOR?this.handle_operator(t):t.type===d.COMMA?this.handle_comma(t):t.type===d.BLOCK_COMMENT?this.handle_block_comment(t,e):t.type===d.COMMENT?this.handle_comment(t,e):t.type===d.DOT?this.handle_dot(t):t.type===d.EOF?this.handle_eof(t):(t.type,d.UNKNOWN,this.handle_unknown(t,e))},P.prototype.handle_whitespace_and_comments=function(t,e){var s=t.newlines,_=this._options.keep_array_indentation&&D(this._flags.mode);if(t.comments_before)for(var i=t.comments_before.next();i;)this.handle_whitespace_and_comments(i,e),this.handle_token(i,e),i=t.comments_before.next();if(_)for(var n=0;n<s;n+=1)this.print_newline(n>0,e);else if(this._options.max_preserve_newlines&&s>this._options.max_preserve_newlines&&(s=this._options.max_preserve_newlines),this._options.preserve_newlines&&s>1){this.print_newline(!1,e);for(var o=1;o<s;o+=1)this.print_newline(!0,e)}};var C=["async","break","continue","return","throw","yield"];return P.prototype.allow_wrap_or_preserved_newline=function(t,e){if(e=void 0!==e&&e,!this._output.just_added_newline()){var s=this._options.preserve_newlines&&t.newlines||e;if(g(this._flags.last_token.text,u)||g(t.text,u)){var _=g(this._flags.last_token.text,u)&&g(this._options.operator_position,x)||g(t.text,u);s=s&&_}if(s)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(m(this._flags.last_token,C))return;this._output.set_wrap_point()}}},P.prototype.print_newline=function(t,e){if(!e&&";"!==this._flags.last_token.text&&","!==this._flags.last_token.text&&"="!==this._flags.last_token.text&&(this._flags.last_token.type!==d.OPERATOR||"--"===this._flags.last_token.text||"++"===this._flags.last_token.text))for(var s=this._tokens.peek();!(this._flags.mode!==v||this._flags.if_block&&c(s,"else")||this._flags.do_block);)this.restore_mode();this._output.add_new_line(t)&&(this._flags.multiline_frame=!0)},P.prototype.print_token_line_indentation=function(t){this._output.just_added_newline()&&(this._options.keep_array_indentation&&t.newlines&&("["===t.text||D(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(t.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},P.prototype.print_token=function(t){if(this._output.raw)this._output.add_raw_token(t);else{if(this._options.comma_first&&t.previous&&t.previous.type===d.COMMA&&this._output.just_added_newline()&&","===this._output.previous_line.last()){var e=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(e),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(t),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(t),this._output.non_breaking_space=!0,this._output.add_token(t.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)}},P.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},P.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},P.prototype.set_mode=function(t){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,t),this._flags=this.create_flags(this._previous_flags,t),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},P.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===v&&S(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},P.prototype.start_of_object_property=function(){return this._flags.parent.mode===E&&this._flags.mode===v&&(":"===this._flags.last_token.text&&0===this._flags.ternary_depth||m(this._flags.last_token,["get","set"]))},P.prototype.start_of_statement=function(t){var e=!1;return!!(e=(e=(e=(e=(e=(e=(e=e||m(this._flags.last_token,["var","let","const"])&&t.type===d.WORD)||c(this._flags.last_token,"do"))||!(this._flags.parent.mode===E&&this._flags.mode===v)&&m(this._flags.last_token,C)&&!t.newlines)||c(this._flags.last_token,"else")&&!(c(t,"if")&&!t.comments_before))||this._flags.last_token.type===d.END_EXPR&&(this._previous_flags.mode===O||this._previous_flags.mode===T))||this._flags.last_token.type===d.WORD&&this._flags.mode===b&&!this._flags.in_case&&!("--"===t.text||"++"===t.text)&&"function"!==this._last_last_text&&t.type!==d.WORD&&t.type!==d.RESERVED)||this._flags.mode===E&&(":"===this._flags.last_token.text&&0===this._flags.ternary_depth||m(this._flags.last_token,["get","set"])))&&(this.set_mode(v),this.indent(),this.handle_whitespace_and_comments(t,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(t,m(t,["do","for","if","while"])),!0)},P.prototype.handle_start_expr=function(t){this.start_of_statement(t)||this.handle_whitespace_and_comments(t);var e=A;if("["===t.text){if(this._flags.last_token.type===d.WORD||")"===this._flags.last_token.text)return m(this._flags.last_token,f)&&(this._output.space_before_token=!0),this.print_token(t),this.set_mode(e),this.indent(),void(this._options.space_in_paren&&(this._output.space_before_token=!0));e=R,D(this._flags.mode)&&("["!==this._flags.last_token.text&&(","!==this._flags.last_token.text||"]"!==this._last_last_text&&"}"!==this._last_last_text)||this._options.keep_array_indentation||this.print_newline()),g(this._flags.last_token.type,[d.START_EXPR,d.END_EXPR,d.WORD,d.OPERATOR,d.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===d.RESERVED)"for"===this._flags.last_token.text?(this._output.space_before_token=this._options.space_before_conditional,e=O):g(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,e=T):g(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:"import"===this._flags.last_token.text&&""===t.whitespace_before?this._output.space_before_token=!1:(g(this._flags.last_token.text,f)||"catch"===this._flags.last_token.text)&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===d.EQUALS||this._flags.last_token.type===d.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(t);else if(this._flags.last_token.type===d.WORD){this._output.space_before_token=!1;var s=this._tokens.peek(-3);if(this._options.space_after_named_function&&s){var _=this._tokens.peek(-4);m(s,["async","function"])||"*"===s.text&&m(_,["async","function"])?this._output.space_before_token=!0:this._flags.mode===E?"{"!==s.text&&","!==s.text&&("*"!==s.text||"{"!==_.text&&","!==_.text)||(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(t);(this._flags.last_token.type===d.RESERVED&&("function"===this._flags.last_word||"typeof"===this._flags.last_word)||"*"===this._flags.last_token.text&&(g(this._last_last_text,["function","yield"])||this._flags.mode===E&&g(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}";"===this._flags.last_token.text||this._flags.last_token.type===d.START_BLOCK?this.print_newline():this._flags.last_token.type!==d.END_EXPR&&this._flags.last_token.type!==d.START_EXPR&&this._flags.last_token.type!==d.END_BLOCK&&"."!==this._flags.last_token.text&&this._flags.last_token.type!==d.COMMA||this.allow_wrap_or_preserved_newline(t,t.newlines),this.print_token(t),this.set_mode(e),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},P.prototype.handle_end_expr=function(t){for(;this._flags.mode===v;)this.restore_mode();this.handle_whitespace_and_comments(t),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(t,"]"===t.text&&D(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type!==d.START_EXPR||this._options.space_in_empty_paren?this._output.space_before_token=!0:(this._output.trim(),this._output.space_before_token=!1)),this.deindent(),this.print_token(t),this.restore_mode(),S(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===T&&(this._previous_flags.mode=A,this._flags.do_block=!1,this._flags.do_while=!1)},P.prototype.handle_start_block=function(t){this.handle_whitespace_and_comments(t);var e=this._tokens.peek(),s=this._tokens.peek(1);"switch"===this._flags.last_word&&this._flags.last_token.type===d.END_EXPR?(this.set_mode(b),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(b):s&&(g(s.text,[":",","])&&g(e.type,[d.STRING,d.WORD,d.RESERVED])||g(e.text,["get","set","..."])&&g(s.type,[d.WORD,d.RESERVED]))?g(this._last_last_text,["class","interface"])&&!g(s.text,[":",","])?this.set_mode(b):this.set_mode(E):this._flags.last_token.type===d.OPERATOR&&"=>"===this._flags.last_token.text?this.set_mode(b):g(this._flags.last_token.type,[d.EQUALS,d.START_EXPR,d.COMMA,d.OPERATOR])||m(this._flags.last_token,["return","throw","import","default"])?this.set_mode(E):this.set_mode(b),this._flags.last_token&&m(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var _=!e.comments_before&&"}"===e.text,i=_&&"function"===this._flags.last_word&&this._flags.last_token.type===d.END_EXPR;if(this._options.brace_preserve_inline){var n=0,o=null;this._flags.inline_frame=!0;do{if(n+=1,(o=this._tokens.peek(n-1)).newlines){this._flags.inline_frame=!1;break}}while(o.type!==d.EOF&&(o.type!==d.END_BLOCK||o.opened!==t))}("expand"===this._options.brace_style||"none"===this._options.brace_style&&t.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==d.OPERATOR&&(i||this._flags.last_token.type===d.EQUALS||m(this._flags.last_token,w)&&"else"!==this._flags.last_token.text)?this._output.space_before_token=!0:this.print_newline(!1,!0):(!D(this._previous_flags.mode)||this._flags.last_token.type!==d.START_EXPR&&this._flags.last_token.type!==d.COMMA||((this._flags.last_token.type===d.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===d.COMMA||this._flags.last_token.type===d.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(t),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==d.OPERATOR&&this._flags.last_token.type!==d.START_EXPR&&(g(this._flags.last_token.type,[d.START_BLOCK,d.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(t),this.indent(),_||this._options.brace_preserve_inline&&this._flags.inline_frame||this.print_newline()},P.prototype.handle_end_block=function(t){for(this.handle_whitespace_and_comments(t);this._flags.mode===v;)this.restore_mode();var e=this._flags.last_token.type===d.START_BLOCK;this._flags.inline_frame&&!e?this._output.space_before_token=!0:"expand"===this._options.brace_style?e||this.print_newline():e||(D(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(t)},P.prototype.handle_word=function(t){if(t.type===d.RESERVED)if(g(t.text,["set","get"])&&this._flags.mode!==E)t.type=d.WORD;else if("import"===t.text&&g(this._tokens.peek().text,["(","."]))t.type=d.WORD;else if(g(t.text,["as","from"])&&!this._flags.import_block)t.type=d.WORD;else if(this._flags.mode===E){":"===this._tokens.peek().text&&(t.type=d.WORD)}if(this.start_of_statement(t)?m(this._flags.last_token,["var","let","const"])&&t.type===d.WORD&&(this._flags.declaration_statement=!0):!t.newlines||N(this._flags.mode)||this._flags.last_token.type===d.OPERATOR&&"--"!==this._flags.last_token.text&&"++"!==this._flags.last_token.text||this._flags.last_token.type===d.EQUALS||!this._options.preserve_newlines&&m(this._flags.last_token,["var","let","const","set","get"])?this.handle_whitespace_and_comments(t):(this.handle_whitespace_and_comments(t),this.print_newline()),this._flags.do_block&&!this._flags.do_while){if(c(t,"while"))return this._output.space_before_token=!0,this.print_token(t),this._output.space_before_token=!0,void(this._flags.do_while=!0);this.print_newline(),this._flags.do_block=!1}if(this._flags.if_block)if(!this._flags.else_block&&c(t,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===v;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&m(t,["case","default"]))return this.print_newline(),this._flags.case_block||!this._flags.case_body&&!this._options.jslint_happy||this.deindent(),this._flags.case_body=!1,this.print_token(t),void(this._flags.in_case=!0);if(this._flags.last_token.type!==d.COMMA&&this._flags.last_token.type!==d.START_EXPR&&this._flags.last_token.type!==d.EQUALS&&this._flags.last_token.type!==d.OPERATOR||this.start_of_object_property()||g(this._flags.last_token.text,["+","-"])&&":"===this._last_last_text&&this._flags.parent.mode===E||this.allow_wrap_or_preserved_newline(t),c(t,"function"))return(g(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!g(this._flags.last_token.text,["(","[","{",":","=",","])&&this._flags.last_token.type!==d.OPERATOR)&&(this._output.just_added_blankline()||t.comments_before||(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===d.RESERVED||this._flags.last_token.type===d.WORD?m(this._flags.last_token,["get","set","new","export"])||m(this._flags.last_token,C)||c(this._flags.last_token,"default")&&"export"===this._last_last_text||"declare"===this._flags.last_token.text?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===d.OPERATOR||"="===this._flags.last_token.text?this._output.space_before_token=!0:(this._flags.multiline_frame||!N(this._flags.mode)&&!D(this._flags.mode))&&this.print_newline(),this.print_token(t),void(this._flags.last_word=t.text);var e="NONE";(this._flags.last_token.type===d.END_BLOCK?this._previous_flags.inline_frame?e="SPACE":m(t,["else","catch","finally","from"])?"expand"===this._options.brace_style||"end-expand"===this._options.brace_style||"none"===this._options.brace_style&&t.newlines?e="NEWLINE":(e="SPACE",this._output.space_before_token=!0):e="NEWLINE":this._flags.last_token.type===d.SEMICOLON&&this._flags.mode===b?e="NEWLINE":this._flags.last_token.type===d.SEMICOLON&&N(this._flags.mode)?e="SPACE":this._flags.last_token.type===d.STRING?e="NEWLINE":this._flags.last_token.type===d.RESERVED||this._flags.last_token.type===d.WORD||"*"===this._flags.last_token.text&&(g(this._last_last_text,["function","yield"])||this._flags.mode===E&&g(this._last_last_text,["{",","]))?e="SPACE":this._flags.last_token.type===d.START_BLOCK?e=this._flags.inline_frame?"SPACE":"NEWLINE":this._flags.last_token.type===d.END_EXPR&&(this._output.space_before_token=!0,e="NEWLINE"),m(t,f)&&")"!==this._flags.last_token.text&&(e=this._flags.inline_frame||"else"===this._flags.last_token.text||"export"===this._flags.last_token.text?"SPACE":"NEWLINE"),m(t,["else","catch","finally"]))?(this._flags.last_token.type!==d.END_BLOCK||this._previous_flags.mode!==b||"expand"===this._options.brace_style||"end-expand"===this._options.brace_style||"none"===this._options.brace_style&&t.newlines)&&!this._flags.inline_frame?this.print_newline():(this._output.trim(!0),"}"!==this._output.current_line.last()&&this.print_newline(),this._output.space_before_token=!0):"NEWLINE"===e?m(this._flags.last_token,w)||"declare"===this._flags.last_token.text&&m(t,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==d.END_EXPR?this._flags.last_token.type===d.START_EXPR&&m(t,["var","let","const"])||":"===this._flags.last_token.text||(c(t,"if")&&c(t.previous,"else")?this._output.space_before_token=!0:this.print_newline()):m(t,f)&&")"!==this._flags.last_token.text&&this.print_newline():this._flags.multiline_frame&&D(this._flags.mode)&&","===this._flags.last_token.text&&"}"===this._last_last_text?this.print_newline():"SPACE"===e&&(this._output.space_before_token=!0);!t.previous||t.previous.type!==d.WORD&&t.previous.type!==d.RESERVED||(this._output.space_before_token=!0),this.print_token(t),this._flags.last_word=t.text,t.type===d.RESERVED&&("do"===t.text?this._flags.do_block=!0:"if"===t.text?this._flags.if_block=!0:"import"===t.text?this._flags.import_block=!0:this._flags.import_block&&c(t,"from")&&(this._flags.import_block=!1))},P.prototype.handle_semicolon=function(t){this.start_of_statement(t)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(t);for(var e=this._tokens.peek();!(this._flags.mode!==v||this._flags.if_block&&c(e,"else")||this._flags.do_block);)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(t)},P.prototype.handle_string=function(t){(!t.text.startsWith("`")||0!==t.newlines||""!==t.whitespace_before||")"!==t.previous.text&&this._flags.last_token.type!==d.WORD)&&(this.start_of_statement(t)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(t),this._flags.last_token.type===d.RESERVED||this._flags.last_token.type===d.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===d.COMMA||this._flags.last_token.type===d.START_EXPR||this._flags.last_token.type===d.EQUALS||this._flags.last_token.type===d.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(t):!t.text.startsWith("`")||this._flags.last_token.type!==d.END_EXPR||"]"!==t.previous.text&&")"!==t.previous.text||0!==t.newlines?this.print_newline():this._output.space_before_token=!0)),this.print_token(t)},P.prototype.handle_equals=function(t){this.start_of_statement(t)||this.handle_whitespace_and_comments(t),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(t),this._output.space_before_token=!0},P.prototype.handle_comma=function(t){this.handle_whitespace_and_comments(t,!0),this.print_token(t),this._output.space_before_token=!0,this._flags.declaration_statement?(N(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(t)):this._flags.mode===E||this._flags.mode===v&&this._flags.parent.mode===E?(this._flags.mode===v&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(t)},P.prototype.handle_operator=function(t){var e="*"===t.text&&(m(this._flags.last_token,["function","yield"])||g(this._flags.last_token.type,[d.START_BLOCK,d.COMMA,d.END_BLOCK,d.SEMICOLON])),s=g(t.text,["-","+"])&&(g(this._flags.last_token.type,[d.START_BLOCK,d.START_EXPR,d.EQUALS,d.OPERATOR])||g(this._flags.last_token.text,f)||","===this._flags.last_token.text);if(this.start_of_statement(t));else{var _=!e;this.handle_whitespace_and_comments(t,_)}if("*"!==t.text||this._flags.last_token.type!==d.DOT)if("::"!==t.text)if(g(t.text,["-","+"])&&this.start_of_object_property())this.print_token(t);else{if(this._flags.last_token.type===d.OPERATOR&&g(this._options.operator_position,x)&&this.allow_wrap_or_preserved_newline(t),":"===t.text&&this._flags.in_case)return this.print_token(t),this._flags.in_case=!1,this._flags.case_body=!0,void(this._tokens.peek().type!==d.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0));var i=!0,n=!0,o=!1;if(":"===t.text?0===this._flags.ternary_depth?i=!1:(this._flags.ternary_depth-=1,o=!0):"?"===t.text&&(this._flags.ternary_depth+=1),!s&&!e&&this._options.preserve_newlines&&g(t.text,u)){var a=":"===t.text,l=a&&o,h=a&&!o;switch(this._options.operator_position){case y.before_newline:return this._output.space_before_token=!h,this.print_token(t),a&&!l||this.allow_wrap_or_preserved_newline(t),void(this._output.space_before_token=!0);case y.after_newline:return this._output.space_before_token=!0,!a||l?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(t):this._output.space_before_token=!1,this.print_token(t),void(this._output.space_before_token=!0);case y.preserve_newline:return h||this.allow_wrap_or_preserved_newline(t),i=!(this._output.just_added_newline()||h),this._output.space_before_token=i,this.print_token(t),void(this._output.space_before_token=!0)}}if(e){this.allow_wrap_or_preserved_newline(t),i=!1;var r=this._tokens.peek();n=r&&g(r.type,[d.WORD,d.RESERVED])}else if("..."===t.text)this.allow_wrap_or_preserved_newline(t),i=this._flags.last_token.type===d.START_BLOCK,n=!1;else if(g(t.text,["--","++","!","~"])||s){if(this._flags.last_token.type!==d.COMMA&&this._flags.last_token.type!==d.START_EXPR||this.allow_wrap_or_preserved_newline(t),i=!1,n=!1,t.newlines&&("--"===t.text||"++"===t.text||"~"===t.text)){var p=m(this._flags.last_token,w)&&t.newlines;p&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(p,!0)}";"===this._flags.last_token.text&&N(this._flags.mode)&&(i=!0),this._flags.last_token.type===d.RESERVED?i=!0:this._flags.last_token.type===d.END_EXPR?i=!("]"===this._flags.last_token.text&&("--"===t.text||"++"===t.text)):this._flags.last_token.type===d.OPERATOR&&(i=g(t.text,["--","-","++","+"])&&g(this._flags.last_token.text,["--","-","++","+"]),g(t.text,["+","-"])&&g(this._flags.last_token.text,["--","++"])&&(n=!0)),(this._flags.mode!==b||this._flags.inline_frame)&&this._flags.mode!==v||"{"!==this._flags.last_token.text&&";"!==this._flags.last_token.text||this.print_newline()}this._output.space_before_token=this._output.space_before_token||i,this.print_token(t),this._output.space_before_token=n}else this.print_token(t);else this.print_token(t)},P.prototype.handle_block_comment=function(t,e){return this._output.raw?(this._output.add_raw_token(t),void(t.directives&&"end"===t.directives.preserve&&(this._output.raw=this._options.test_output_raw))):t.directives?(this.print_newline(!1,e),this.print_token(t),"start"===t.directives.preserve&&(this._output.raw=!0),void this.print_newline(!1,!0)):h.newline.test(t.text)||t.newlines?void this.print_block_commment(t,e):(this._output.space_before_token=!0,this.print_token(t),void(this._output.space_before_token=!0))},P.prototype.print_block_commment=function(t,e){var s,_=function(t){for(var e=[],s=(t=t.replace(h.allLineBreaks,"\n")).indexOf("\n");-1!==s;)e.push(t.substring(0,s)),s=(t=t.substring(s+1)).indexOf("\n");return t.length&&e.push(t),e}(t.text),i=!1,n=!1,o=t.whitespace_before,a=o.length;if(this.print_newline(!1,e),this.print_token_line_indentation(t),this._output.add_token(_[0]),this.print_newline(!1,e),_.length>1){for(i=function(t,e){for(var s=0;s<t.length;s++)if(t[s].trim().charAt(0)!==e)return!1;return!0}(_=_.slice(1),"*"),n=function(t,e){for(var s,_=0,i=t.length;_<i;_++)if((s=t[_])&&0!==s.indexOf(e))return!1;return!0}(_,o),i&&(this._flags.alignment=1),s=0;s<_.length;s++)i?(this.print_token_line_indentation(t),this._output.add_token(k(_[s]))):n&&_[s]?(this.print_token_line_indentation(t),this._output.add_token(_[s].substring(a))):(this._output.current_line.set_indent(-1),this._output.add_token(_[s])),this.print_newline(!1,e);this._flags.alignment=0}},P.prototype.handle_comment=function(t,e){t.newlines?this.print_newline(!1,e):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(t),this.print_newline(!1,e)},P.prototype.handle_dot=function(t){this.start_of_statement(t)||this.handle_whitespace_and_comments(t,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),m(this._flags.last_token,w)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(t,")"===this._flags.last_token.text&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(t)},P.prototype.handle_unknown=function(t,e){this.print_token(t),"\n"===t.text[t.text.length-1]&&this.print_newline(!1,e)},P.prototype.handle_eof=function(t){for(;this._flags.mode===v;)this.restore_mode();this.handle_whitespace_and_comments(t)},t.Beautifier=P,t}export{a as __require};
1
+ import{__exports as t}from"../../../../../_virtual/beautifier2.js";import{__require as e}from"../core/output.js";import{__require as s}from"../core/token.js";import{__require as _}from"./acorn.js";import{__require as i}from"./options.js";import{__require as n}from"./tokenizer.js";var o;function a(){if(o)return t;o=1;var a=e().Output,l=s().Token,h=_(),r=i().Options,p=n().Tokenizer,f=n().line_starters,u=n().positionable_operators,d=n().TOKEN;function g(t,e){return-1!==e.indexOf(t)}function k(t){return t.replace(/^\s+/g,"")}function c(t,e){return t&&t.type===d.RESERVED&&t.text===e}function m(t,e){return t&&t.type===d.RESERVED&&g(t.text,e)}var w=["case","return","do","if","throw","else","await","break","continue","async"],y=function(t){for(var e={},s=0;s<t.length;s++)e[t[s].replace(/-/g,"_")]=t[s];return e}(["before-newline","after-newline","preserve-newline"]),x=[y.before_newline,y.preserve_newline],b="BlockStatement",v="Statement",E="ObjectLiteral",R="ArrayLiteral",O="ForInitializer",T="Conditional",A="Expression";function S(t,e){e.multiline_frame||e.mode===O||e.mode===T||t.remove_indent(e.start_line_index)}function D(t){return t===R}function N(t){return g(t,[A,O,T])}function P(t,e){e=e||{},this._source_text=t||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new r(e)}P.prototype.create_flags=function(t,e){var s=0;return t&&(s=t.indentation_level,!this._output.just_added_newline()&&t.line_indent_level>s&&(s=t.line_indent_level)),{mode:e,parent:t,last_token:t?t.last_token:new l(d.START_BLOCK,""),last_word:t?t.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:s,alignment:0,line_indent_level:t?t.line_indent_level:s,start_line_index:this._output.get_line_number(),ternary_depth:0}},P.prototype._reset=function(t){var e=t.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new a(this._options,e),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(b);var s=new p(t,this._options);return this._tokens=s.tokenize(),t},P.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var t=this._reset(this._source_text),e=this._options.eol;"auto"===this._options.eol&&(e="\n",t&&h.lineBreak.test(t||"")&&(e=t.match(h.lineBreak)[0]));for(var s=this._tokens.next();s;)this.handle_token(s),this._last_last_text=this._flags.last_token.text,this._flags.last_token=s,s=this._tokens.next();return this._output.get_code(e)},P.prototype.handle_token=function(t,e){t.type===d.START_EXPR?this.handle_start_expr(t):t.type===d.END_EXPR?this.handle_end_expr(t):t.type===d.START_BLOCK?this.handle_start_block(t):t.type===d.END_BLOCK?this.handle_end_block(t):t.type===d.WORD||t.type===d.RESERVED?this.handle_word(t):t.type===d.SEMICOLON?this.handle_semicolon(t):t.type===d.STRING?this.handle_string(t):t.type===d.EQUALS?this.handle_equals(t):t.type===d.OPERATOR?this.handle_operator(t):t.type===d.COMMA?this.handle_comma(t):t.type===d.BLOCK_COMMENT?this.handle_block_comment(t,e):t.type===d.COMMENT?this.handle_comment(t,e):t.type===d.DOT?this.handle_dot(t):t.type===d.EOF?this.handle_eof(t):(t.type,d.UNKNOWN,this.handle_unknown(t,e))},P.prototype.handle_whitespace_and_comments=function(t,e){var s=t.newlines,_=this._options.keep_array_indentation&&D(this._flags.mode);if(t.comments_before)for(var i=t.comments_before.next();i;)this.handle_whitespace_and_comments(i,e),this.handle_token(i,e),i=t.comments_before.next();if(_)for(var n=0;n<s;n+=1)this.print_newline(n>0,e);else if(this._options.max_preserve_newlines&&s>this._options.max_preserve_newlines&&(s=this._options.max_preserve_newlines),this._options.preserve_newlines&&s>1){this.print_newline(!1,e);for(var o=1;o<s;o+=1)this.print_newline(!0,e)}};var C=["async","break","continue","return","throw","yield"];return P.prototype.allow_wrap_or_preserved_newline=function(t,e){if(e=void 0!==e&&e,!this._output.just_added_newline()){var s=this._options.preserve_newlines&&t.newlines||e;if(g(this._flags.last_token.text,u)||g(t.text,u)){var _=g(this._flags.last_token.text,u)&&g(this._options.operator_position,x)||g(t.text,u);s=s&&_}if(s)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(m(this._flags.last_token,C))return;this._output.set_wrap_point()}}},P.prototype.print_newline=function(t,e){if(!e&&";"!==this._flags.last_token.text&&","!==this._flags.last_token.text&&"="!==this._flags.last_token.text&&(this._flags.last_token.type!==d.OPERATOR||"--"===this._flags.last_token.text||"++"===this._flags.last_token.text))for(var s=this._tokens.peek();!(this._flags.mode!==v||this._flags.if_block&&c(s,"else")||this._flags.do_block);)this.restore_mode();this._output.add_new_line(t)&&(this._flags.multiline_frame=!0)},P.prototype.print_token_line_indentation=function(t){this._output.just_added_newline()&&(this._options.keep_array_indentation&&t.newlines&&("["===t.text||D(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(t.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},P.prototype.print_token=function(t){if(this._output.raw)this._output.add_raw_token(t);else{if(this._options.comma_first&&t.previous&&t.previous.type===d.COMMA&&this._output.just_added_newline()&&","===this._output.previous_line.last()){var e=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(e),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(t),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(t),this._output.non_breaking_space=!0,this._output.add_token(t.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)}},P.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},P.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},P.prototype.set_mode=function(t){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,t),this._flags=this.create_flags(this._previous_flags,t),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},P.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===v&&S(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},P.prototype.start_of_object_property=function(){return this._flags.parent.mode===E&&this._flags.mode===v&&(":"===this._flags.last_token.text&&0===this._flags.ternary_depth||m(this._flags.last_token,["get","set"]))},P.prototype.start_of_statement=function(t){var e=!1;return!!(e=(e=(e=(e=(e=(e=(e=e||m(this._flags.last_token,["var","let","const"])&&t.type===d.WORD)||c(this._flags.last_token,"do"))||!(this._flags.parent.mode===E&&this._flags.mode===v)&&m(this._flags.last_token,C)&&!t.newlines)||c(this._flags.last_token,"else")&&!(c(t,"if")&&!t.comments_before))||this._flags.last_token.type===d.END_EXPR&&(this._previous_flags.mode===O||this._previous_flags.mode===T))||this._flags.last_token.type===d.WORD&&this._flags.mode===b&&!this._flags.in_case&&!("--"===t.text||"++"===t.text)&&"function"!==this._last_last_text&&t.type!==d.WORD&&t.type!==d.RESERVED)||this._flags.mode===E&&(":"===this._flags.last_token.text&&0===this._flags.ternary_depth||m(this._flags.last_token,["get","set"])))&&(this.set_mode(v),this.indent(),this.handle_whitespace_and_comments(t,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(t,m(t,["do","for","if","while"])),!0)},P.prototype.handle_start_expr=function(t){this.start_of_statement(t)||this.handle_whitespace_and_comments(t);var e=A;if("["===t.text){if(this._flags.last_token.type===d.WORD||")"===this._flags.last_token.text)return m(this._flags.last_token,f)&&(this._output.space_before_token=!0),this.print_token(t),this.set_mode(e),this.indent(),void(this._options.space_in_paren&&(this._output.space_before_token=!0));e=R,D(this._flags.mode)&&("["!==this._flags.last_token.text&&(","!==this._flags.last_token.text||"]"!==this._last_last_text&&"}"!==this._last_last_text)||this._options.keep_array_indentation||this.print_newline()),g(this._flags.last_token.type,[d.START_EXPR,d.END_EXPR,d.WORD,d.OPERATOR,d.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===d.RESERVED)"for"===this._flags.last_token.text?(this._output.space_before_token=this._options.space_before_conditional,e=O):g(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,e=T):g(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:"import"===this._flags.last_token.text&&""===t.whitespace_before?this._output.space_before_token=!1:(g(this._flags.last_token.text,f)||"catch"===this._flags.last_token.text)&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===d.EQUALS||this._flags.last_token.type===d.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(t);else if(this._flags.last_token.type===d.WORD){this._output.space_before_token=!1;var s=this._tokens.peek(-3);if(this._options.space_after_named_function&&s){var _=this._tokens.peek(-4);m(s,["async","function"])||"*"===s.text&&m(_,["async","function"])?this._output.space_before_token=!0:this._flags.mode===E?"{"!==s.text&&","!==s.text&&("*"!==s.text||"{"!==_.text&&","!==_.text)||(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(t);(this._flags.last_token.type===d.RESERVED&&("function"===this._flags.last_word||"typeof"===this._flags.last_word)||"*"===this._flags.last_token.text&&(g(this._last_last_text,["function","yield"])||this._flags.mode===E&&g(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}";"===this._flags.last_token.text||this._flags.last_token.type===d.START_BLOCK?this.print_newline():this._flags.last_token.type!==d.END_EXPR&&this._flags.last_token.type!==d.START_EXPR&&this._flags.last_token.type!==d.END_BLOCK&&"."!==this._flags.last_token.text&&this._flags.last_token.type!==d.COMMA||this.allow_wrap_or_preserved_newline(t,t.newlines),this.print_token(t),this.set_mode(e),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},P.prototype.handle_end_expr=function(t){for(;this._flags.mode===v;)this.restore_mode();this.handle_whitespace_and_comments(t),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(t,"]"===t.text&&D(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type!==d.START_EXPR||this._options.space_in_empty_paren?this._output.space_before_token=!0:(this._output.trim(),this._output.space_before_token=!1)),this.deindent(),this.print_token(t),this.restore_mode(),S(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===T&&(this._previous_flags.mode=A,this._flags.do_block=!1,this._flags.do_while=!1)},P.prototype.handle_start_block=function(t){this.handle_whitespace_and_comments(t);var e=this._tokens.peek(),s=this._tokens.peek(1);"switch"===this._flags.last_word&&this._flags.last_token.type===d.END_EXPR?(this.set_mode(b),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(b):s&&(g(s.text,[":",","])&&g(e.type,[d.STRING,d.WORD,d.RESERVED])||g(e.text,["get","set","..."])&&g(s.type,[d.WORD,d.RESERVED]))?g(this._last_last_text,["class","interface"])&&!g(s.text,[":",","])?this.set_mode(b):this.set_mode(E):this._flags.last_token.type===d.OPERATOR&&"=>"===this._flags.last_token.text?this.set_mode(b):g(this._flags.last_token.type,[d.EQUALS,d.START_EXPR,d.COMMA,d.OPERATOR])||m(this._flags.last_token,["return","throw","import","default"])?this.set_mode(E):this.set_mode(b),this._flags.last_token&&m(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var _=!e.comments_before&&"}"===e.text,i=_&&"function"===this._flags.last_word&&this._flags.last_token.type===d.END_EXPR;if(this._options.brace_preserve_inline){var n=0,o=null;this._flags.inline_frame=!0;do{if(n+=1,(o=this._tokens.peek(n-1)).newlines){this._flags.inline_frame=!1;break}}while(o.type!==d.EOF&&(o.type!==d.END_BLOCK||o.opened!==t))}("expand"===this._options.brace_style||"none"===this._options.brace_style&&t.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==d.OPERATOR&&(i||this._flags.last_token.type===d.EQUALS||m(this._flags.last_token,w)&&"else"!==this._flags.last_token.text)?this._output.space_before_token=!0:this.print_newline(!1,!0):(!D(this._previous_flags.mode)||this._flags.last_token.type!==d.START_EXPR&&this._flags.last_token.type!==d.COMMA||((this._flags.last_token.type===d.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===d.COMMA||this._flags.last_token.type===d.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(t),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==d.OPERATOR&&this._flags.last_token.type!==d.START_EXPR&&(g(this._flags.last_token.type,[d.START_BLOCK,d.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(t),this.indent(),_||this._options.brace_preserve_inline&&this._flags.inline_frame||this.print_newline()},P.prototype.handle_end_block=function(t){for(this.handle_whitespace_and_comments(t);this._flags.mode===v;)this.restore_mode();var e=this._flags.last_token.type===d.START_BLOCK;this._flags.inline_frame&&!e?this._output.space_before_token=!0:"expand"===this._options.brace_style?e||this.print_newline():e||(D(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(t)},P.prototype.handle_word=function(t){if(t.type===d.RESERVED)if(g(t.text,["set","get"])&&this._flags.mode!==E)t.type=d.WORD;else if("import"===t.text&&g(this._tokens.peek().text,["(","."]))t.type=d.WORD;else if(g(t.text,["as","from"])&&!this._flags.import_block)t.type=d.WORD;else if(this._flags.mode===E){":"===this._tokens.peek().text&&(t.type=d.WORD)}if(this.start_of_statement(t)?m(this._flags.last_token,["var","let","const"])&&t.type===d.WORD&&(this._flags.declaration_statement=!0):!t.newlines||N(this._flags.mode)||this._flags.last_token.type===d.OPERATOR&&"--"!==this._flags.last_token.text&&"++"!==this._flags.last_token.text||this._flags.last_token.type===d.EQUALS||!this._options.preserve_newlines&&m(this._flags.last_token,["var","let","const","set","get"])?this.handle_whitespace_and_comments(t):(this.handle_whitespace_and_comments(t),this.print_newline()),this._flags.do_block&&!this._flags.do_while){if(c(t,"while"))return this._output.space_before_token=!0,this.print_token(t),this._output.space_before_token=!0,void(this._flags.do_while=!0);this.print_newline(),this._flags.do_block=!1}if(this._flags.if_block)if(!this._flags.else_block&&c(t,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===v;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&m(t,["case","default"]))return this.print_newline(),this._flags.case_block||!this._flags.case_body&&!this._options.jslint_happy||this.deindent(),this._flags.case_body=!1,this.print_token(t),void(this._flags.in_case=!0);if(this._flags.last_token.type!==d.COMMA&&this._flags.last_token.type!==d.START_EXPR&&this._flags.last_token.type!==d.EQUALS&&this._flags.last_token.type!==d.OPERATOR||this.start_of_object_property()||g(this._flags.last_token.text,["+","-"])&&":"===this._last_last_text&&this._flags.parent.mode===E||this.allow_wrap_or_preserved_newline(t),c(t,"function"))return(g(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!g(this._flags.last_token.text,["(","[","{",":","=",","])&&this._flags.last_token.type!==d.OPERATOR)&&(this._output.just_added_blankline()||t.comments_before||(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===d.RESERVED||this._flags.last_token.type===d.WORD?m(this._flags.last_token,["get","set","new","export"])||m(this._flags.last_token,C)||c(this._flags.last_token,"default")&&"export"===this._last_last_text||"declare"===this._flags.last_token.text?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===d.OPERATOR||"="===this._flags.last_token.text?this._output.space_before_token=!0:(this._flags.multiline_frame||!N(this._flags.mode)&&!D(this._flags.mode))&&this.print_newline(),this.print_token(t),void(this._flags.last_word=t.text);var e="NONE";(this._flags.last_token.type===d.END_BLOCK?this._previous_flags.inline_frame?e="SPACE":m(t,["else","catch","finally","from"])?"expand"===this._options.brace_style||"end-expand"===this._options.brace_style||"none"===this._options.brace_style&&t.newlines?e="NEWLINE":(e="SPACE",this._output.space_before_token=!0):e="NEWLINE":this._flags.last_token.type===d.SEMICOLON&&this._flags.mode===b?e="NEWLINE":this._flags.last_token.type===d.SEMICOLON&&N(this._flags.mode)?e="SPACE":this._flags.last_token.type===d.STRING?e="NEWLINE":this._flags.last_token.type===d.RESERVED||this._flags.last_token.type===d.WORD||"*"===this._flags.last_token.text&&(g(this._last_last_text,["function","yield"])||this._flags.mode===E&&g(this._last_last_text,["{",","]))?e="SPACE":this._flags.last_token.type===d.START_BLOCK?e=this._flags.inline_frame?"SPACE":"NEWLINE":this._flags.last_token.type===d.END_EXPR&&(this._output.space_before_token=!0,e="NEWLINE"),m(t,f)&&")"!==this._flags.last_token.text&&(e=this._flags.inline_frame||"else"===this._flags.last_token.text||"export"===this._flags.last_token.text?"SPACE":"NEWLINE"),m(t,["else","catch","finally"]))?(this._flags.last_token.type!==d.END_BLOCK||this._previous_flags.mode!==b||"expand"===this._options.brace_style||"end-expand"===this._options.brace_style||"none"===this._options.brace_style&&t.newlines)&&!this._flags.inline_frame?this.print_newline():(this._output.trim(!0),"}"!==this._output.current_line.last()&&this.print_newline(),this._output.space_before_token=!0):"NEWLINE"===e?m(this._flags.last_token,w)||"declare"===this._flags.last_token.text&&m(t,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==d.END_EXPR?this._flags.last_token.type===d.START_EXPR&&m(t,["var","let","const"])||":"===this._flags.last_token.text||(c(t,"if")&&c(t.previous,"else")?this._output.space_before_token=!0:this.print_newline()):m(t,f)&&")"!==this._flags.last_token.text&&this.print_newline():this._flags.multiline_frame&&D(this._flags.mode)&&","===this._flags.last_token.text&&"}"===this._last_last_text?this.print_newline():"SPACE"===e&&(this._output.space_before_token=!0);!t.previous||t.previous.type!==d.WORD&&t.previous.type!==d.RESERVED||(this._output.space_before_token=!0),this.print_token(t),this._flags.last_word=t.text,t.type===d.RESERVED&&("do"===t.text?this._flags.do_block=!0:"if"===t.text?this._flags.if_block=!0:"import"===t.text?this._flags.import_block=!0:this._flags.import_block&&c(t,"from")&&(this._flags.import_block=!1))},P.prototype.handle_semicolon=function(t){this.start_of_statement(t)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(t);for(var e=this._tokens.peek();!(this._flags.mode!==v||this._flags.if_block&&c(e,"else")||this._flags.do_block);)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(t)},P.prototype.handle_string=function(t){(!t.text.startsWith("`")||0!==t.newlines||""!==t.whitespace_before||")"!==t.previous.text&&this._flags.last_token.type!==d.WORD)&&(this.start_of_statement(t)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(t),this._flags.last_token.type===d.RESERVED||this._flags.last_token.type===d.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===d.COMMA||this._flags.last_token.type===d.START_EXPR||this._flags.last_token.type===d.EQUALS||this._flags.last_token.type===d.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(t):!t.text.startsWith("`")||this._flags.last_token.type!==d.END_EXPR||"]"!==t.previous.text&&")"!==t.previous.text||0!==t.newlines?this.print_newline():this._output.space_before_token=!0)),this.print_token(t)},P.prototype.handle_equals=function(t){this.start_of_statement(t)||this.handle_whitespace_and_comments(t),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(t),this._output.space_before_token=!0},P.prototype.handle_comma=function(t){this.handle_whitespace_and_comments(t,!0),this.print_token(t),this._output.space_before_token=!0,this._flags.declaration_statement?(N(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(t)):this._flags.mode===E||this._flags.mode===v&&this._flags.parent.mode===E?(this._flags.mode===v&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(t)},P.prototype.handle_operator=function(t){var e="*"===t.text&&(m(this._flags.last_token,["function","yield"])||g(this._flags.last_token.type,[d.START_BLOCK,d.COMMA,d.END_BLOCK,d.SEMICOLON])),s=g(t.text,["-","+"])&&(g(this._flags.last_token.type,[d.START_BLOCK,d.START_EXPR,d.EQUALS,d.OPERATOR])||g(this._flags.last_token.text,f)||","===this._flags.last_token.text);if(this.start_of_statement(t));else{var _=!e;this.handle_whitespace_and_comments(t,_)}if("*"!==t.text||this._flags.last_token.type!==d.DOT)if("::"!==t.text)if(g(t.text,["-","+"])&&this.start_of_object_property())this.print_token(t);else{if(this._flags.last_token.type===d.OPERATOR&&g(this._options.operator_position,x)&&this.allow_wrap_or_preserved_newline(t),":"===t.text&&this._flags.in_case)return this.print_token(t),this._flags.in_case=!1,this._flags.case_body=!0,void(this._tokens.peek().type!==d.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0));var i=!0,n=!0,o=!1;if(":"===t.text?0===this._flags.ternary_depth?i=!1:(this._flags.ternary_depth-=1,o=!0):"?"===t.text&&(this._flags.ternary_depth+=1),!s&&!e&&this._options.preserve_newlines&&g(t.text,u)){var a=":"===t.text,l=a&&o,h=a&&!o;switch(this._options.operator_position){case y.before_newline:return this._output.space_before_token=!h,this.print_token(t),a&&!l||this.allow_wrap_or_preserved_newline(t),void(this._output.space_before_token=!0);case y.after_newline:return this._output.space_before_token=!0,!a||l?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(t):this._output.space_before_token=!1,this.print_token(t),void(this._output.space_before_token=!0);case y.preserve_newline:return h||this.allow_wrap_or_preserved_newline(t),i=!(this._output.just_added_newline()||h),this._output.space_before_token=i,this.print_token(t),void(this._output.space_before_token=!0)}}if(e){this.allow_wrap_or_preserved_newline(t),i=!1;var r=this._tokens.peek();n=r&&g(r.type,[d.WORD,d.RESERVED])}else if("..."===t.text)this.allow_wrap_or_preserved_newline(t),i=this._flags.last_token.type===d.START_BLOCK,n=!1;else if(g(t.text,["--","++","!","~"])||s){if(this._flags.last_token.type!==d.COMMA&&this._flags.last_token.type!==d.START_EXPR||this.allow_wrap_or_preserved_newline(t),i=!1,n=!1,t.newlines&&("--"===t.text||"++"===t.text||"~"===t.text)){var p=m(this._flags.last_token,w)&&t.newlines;p&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(p,!0)}";"===this._flags.last_token.text&&N(this._flags.mode)&&(i=!0),this._flags.last_token.type===d.RESERVED?i=!0:this._flags.last_token.type===d.END_EXPR?i=!("]"===this._flags.last_token.text&&("--"===t.text||"++"===t.text)):this._flags.last_token.type===d.OPERATOR&&(i=g(t.text,["--","-","++","+"])&&g(this._flags.last_token.text,["--","-","++","+"]),g(t.text,["+","-"])&&g(this._flags.last_token.text,["--","++"])&&(n=!0)),(this._flags.mode!==b||this._flags.inline_frame)&&this._flags.mode!==v||"{"!==this._flags.last_token.text&&";"!==this._flags.last_token.text||this.print_newline()}this._output.space_before_token=this._output.space_before_token||i,this.print_token(t),this._output.space_before_token=n}else this.print_token(t);else this.print_token(t)},P.prototype.handle_block_comment=function(t,e){return this._output.raw?(this._output.add_raw_token(t),void(t.directives&&"end"===t.directives.preserve&&(this._output.raw=this._options.test_output_raw))):t.directives?(this.print_newline(!1,e),this.print_token(t),"start"===t.directives.preserve&&(this._output.raw=!0),void this.print_newline(!1,!0)):h.newline.test(t.text)||t.newlines?void this.print_block_commment(t,e):(this._output.space_before_token=!0,this.print_token(t),void(this._output.space_before_token=!0))},P.prototype.print_block_commment=function(t,e){var s,_=function(t){for(var e=[],s=(t=t.replace(h.allLineBreaks,"\n")).indexOf("\n");-1!==s;)e.push(t.substring(0,s)),s=(t=t.substring(s+1)).indexOf("\n");return t.length&&e.push(t),e}(t.text),i=!1,n=!1,o=t.whitespace_before,a=o.length;if(this.print_newline(!1,e),this.print_token_line_indentation(t),this._output.add_token(_[0]),this.print_newline(!1,e),_.length>1){for(i=function(t,e){for(var s=0;s<t.length;s++)if(t[s].trim().charAt(0)!==e)return!1;return!0}(_=_.slice(1),"*"),n=function(t,e){for(var s,_=0,i=t.length;_<i;_++)if((s=t[_])&&0!==s.indexOf(e))return!1;return!0}(_,o),i&&(this._flags.alignment=1),s=0;s<_.length;s++)i?(this.print_token_line_indentation(t),this._output.add_token(k(_[s]))):n&&_[s]?(this.print_token_line_indentation(t),this._output.add_token(_[s].substring(a))):(this._output.current_line.set_indent(-1),this._output.add_token(_[s])),this.print_newline(!1,e);this._flags.alignment=0}},P.prototype.handle_comment=function(t,e){t.newlines?this.print_newline(!1,e):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(t),this.print_newline(!1,e)},P.prototype.handle_dot=function(t){this.start_of_statement(t)||this.handle_whitespace_and_comments(t,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),m(this._flags.last_token,w)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(t,")"===this._flags.last_token.text&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(t)},P.prototype.handle_unknown=function(t,e){this.print_token(t),"\n"===t.text[t.text.length-1]&&this.print_newline(!1,e)},P.prototype.handle_eof=function(t){for(;this._flags.mode===v;)this.restore_mode();this.handle_whitespace_and_comments(t)},t.Beautifier=P,t}export{a as __require};
@@ -1 +1 @@
1
- import{__exports as e}from"../../../../../_virtual/options.js";import{__require as t}from"../core/options.js";var n;function i(){if(n)return e;n=1;var i=t().Options,_=["before-newline","after-newline","preserve-newline"];function s(e){i.call(this,e,"js");var t=this.raw_options.brace_style||null;"expand-strict"===t?this.raw_options.brace_style="expand":"collapse-preserve-inline"===t?this.raw_options.brace_style="collapse,preserve-inline":void 0!==this.raw_options.braces_on_own_line&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var n=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var s=0;s<n.length;s++)"preserve-inline"===n[s]?this.brace_preserve_inline=!0:this.brace_style=n[s];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",_),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}return s.prototype=new i,e.Options=s,e}export{i as __require};
1
+ import{__exports as e}from"../../../../../_virtual/options2.js";import{__require as t}from"../core/options.js";var n;function i(){if(n)return e;n=1;var i=t().Options,_=["before-newline","after-newline","preserve-newline"];function s(e){i.call(this,e,"js");var t=this.raw_options.brace_style||null;"expand-strict"===t?this.raw_options.brace_style="expand":"collapse-preserve-inline"===t?this.raw_options.brace_style="collapse,preserve-inline":void 0!==this.raw_options.braces_on_own_line&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var n=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var s=0;s<n.length;s++)"preserve-inline"===n[s]?this.brace_preserve_inline=!0:this.brace_style=n[s];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",_),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}return s.prototype=new i,e.Options=s,e}export{i as __require};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pixel-react",
3
3
  "description": "Great for pixel-perfect, design-focused components in React",
4
- "version": "1.20.19",
4
+ "version": "1.20.20",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.js",
7
7
  "types": "lib/index.d.ts",