Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gwax/sql-formatter

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gwax/sql-formatter - npm Package Compare versions

Comparing version 3.0.0-alpha.0 to 3.0.0-alpha.1

2

dist/sql-formatter.min.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.sqlFormatter=t():e.sqlFormatter=t()}(window,(function(){return function(e){var t={};function E(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,E),r.l=!0,r.exports}return E.m=e,E.c=t,E.d=function(e,t,n){E.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},E.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},E.t=function(e,t){if(1&t&&(e=E(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(E.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)E.d(n,r,function(t){return e[t]}.bind(null,r));return n},E.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return E.d(t,"a",t),t},E.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},E.p="",E(E.s=64)}([function(e,t,E){var n=E(10),r="object"==typeof self&&self&&self.Object===Object&&self,o=n||r||Function("return this")();e.exports=o},function(e,t,E){var n=E(8),r=E(33),o=E(34),T=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":T&&T in Object(e)?r(e):o(e)}},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},function(e,t,E){var n=E(56),r=E(59);e.exports=function(e,t){var E=r(e,t);return n(E)?E:void 0}},function(e,t,E){var n=E(22),r=/[\\^$.*+?()[\]{}|]/g,o=RegExp(r.source);e.exports=function(e){return(e=n(e))&&o.test(e)?e.replace(r,"\\$&"):e}},function(e,t,E){var n=E(9),r=E(11);e.exports=function(e){return null!=e&&r(e.length)&&!n(e)}},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t){var E=Array.isArray;e.exports=E},function(e,t,E){var n=E(0).Symbol;e.exports=n},function(e,t,E){var n=E(1),r=E(6);e.exports=function(e){if(!r(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},function(e,t,E){(function(t){var E="object"==typeof t&&t&&t.Object===Object&&t;e.exports=E}).call(this,E(32))},function(e,t){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},function(e,t,E){var n=E(36);e.exports=function(e){var t=n(e),E=t%1;return t==t?E?t-E:t:0}},function(e,t,E){var n=E(1),r=E(2);e.exports=function(e){return"symbol"==typeof e||r(e)&&"[object Symbol]"==n(e)}},function(e,t){e.exports=function(e,t){for(var E=-1,n=null==e?0:e.length,r=Array(n);++E<n;)r[E]=t(e[E],E,e);return r}},function(e,t,E){var n=E(43),r=E(2),o=Object.prototype,T=o.hasOwnProperty,R=o.propertyIsEnumerable,i=n(function(){return arguments}())?n:function(e){return r(e)&&T.call(e,"callee")&&!R.call(e,"callee")};e.exports=i},function(e,t,E){(function(e){var n=E(0),r=E(44),o=t&&!t.nodeType&&t,T=o&&"object"==typeof e&&e&&!e.nodeType&&e,R=T&&T.exports===o?n.Buffer:void 0,i=(R?R.isBuffer:void 0)||r;e.exports=i}).call(this,E(17)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t){var E=/^(?:0|[1-9]\d*)$/;e.exports=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&E.test(e))&&e>-1&&e%1==0&&e<t}},function(e,t,E){var n=E(45),r=E(46),o=E(47),T=o&&o.isTypedArray,R=T?r(T):n;e.exports=R},function(e,t,E){var n=E(21),r=E(48),o=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return r(e);var t=[];for(var E in Object(e))o.call(e,E)&&"constructor"!=E&&t.push(E);return t}},function(e,t){var E=Object.prototype;e.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||E)}},function(e,t,E){var n=E(53);e.exports=function(e){return null==e?"":n(e)}},function(e,t){var E=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return E.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},function(e,t,E){var n=E(28),r=E(5),o=E(35),T=E(12),R=E(38),i=Math.max;e.exports=function(e,t,E,N){e=r(e)?e:R(e),E=E&&!N?T(E):0;var A=e.length;return E<0&&(E=i(A+E,0)),o(e)?E<=A&&e.indexOf(t,E)>-1:!!A&&n(e,t,E)>-1}},function(e,t,E){var n=E(50),r=E(51),o=E(12),T=E(22);e.exports=function(e,t,E){return t=(E?r(e,t,E):void 0===t)?1:o(t),n(T(e),t)}},function(e,t){e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},function(e,t,E){var n=E(20),r=E(54),o=E(15),T=E(7),R=E(5),i=E(16),N=E(21),A=E(19),O=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(R(e)&&(T(e)||"string"==typeof e||"function"==typeof e.splice||i(e)||A(e)||o(e)))return!e.length;var t=r(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(N(e))return!n(e).length;for(var E in e)if(O.call(e,E))return!1;return!0}},function(e,t,E){var n=E(29),r=E(30),o=E(31);e.exports=function(e,t,E){return t==t?o(e,t,E):n(e,r,E)}},function(e,t){e.exports=function(e,t,E,n){for(var r=e.length,o=E+(n?1:-1);n?o--:++o<r;)if(t(e[o],o,e))return o;return-1}},function(e,t){e.exports=function(e){return e!=e}},function(e,t){e.exports=function(e,t,E){for(var n=E-1,r=e.length;++n<r;)if(e[n]===t)return n;return-1}},function(e,t){var E;E=function(){return this}();try{E=E||new Function("return this")()}catch(e){"object"==typeof window&&(E=window)}e.exports=E},function(e,t,E){var n=E(8),r=Object.prototype,o=r.hasOwnProperty,T=r.toString,R=n?n.toStringTag:void 0;e.exports=function(e){var t=o.call(e,R),E=e[R];try{e[R]=void 0;var n=!0}catch(e){}var r=T.call(e);return n&&(t?e[R]=E:delete e[R]),r}},function(e,t){var E=Object.prototype.toString;e.exports=function(e){return E.call(e)}},function(e,t,E){var n=E(1),r=E(7),o=E(2);e.exports=function(e){return"string"==typeof e||!r(e)&&o(e)&&"[object String]"==n(e)}},function(e,t,E){var n=E(37);e.exports=function(e){return e?(e=n(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},function(e,t,E){var n=E(6),r=E(13),o=/^\s+|\s+$/g,T=/^[-+]0x[0-9a-f]+$/i,R=/^0b[01]+$/i,i=/^0o[0-7]+$/i,N=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(r(e))return NaN;if(n(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=n(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(o,"");var E=R.test(e);return E||i.test(e)?N(e.slice(2),E?2:8):T.test(e)?NaN:+e}},function(e,t,E){var n=E(39),r=E(40);e.exports=function(e){return null==e?[]:n(e,r(e))}},function(e,t,E){var n=E(14);e.exports=function(e,t){return n(t,(function(t){return e[t]}))}},function(e,t,E){var n=E(41),r=E(20),o=E(5);e.exports=function(e){return o(e)?n(e):r(e)}},function(e,t,E){var n=E(42),r=E(15),o=E(7),T=E(16),R=E(18),i=E(19),N=Object.prototype.hasOwnProperty;e.exports=function(e,t){var E=o(e),A=!E&&r(e),O=!E&&!A&&T(e),u=!E&&!A&&!O&&i(e),I=E||A||O||u,S=I?n(e.length,String):[],c=S.length;for(var L in e)!t&&!N.call(e,L)||I&&("length"==L||O&&("offset"==L||"parent"==L)||u&&("buffer"==L||"byteLength"==L||"byteOffset"==L)||R(L,c))||S.push(L);return S}},function(e,t){e.exports=function(e,t){for(var E=-1,n=Array(e);++E<e;)n[E]=t(E);return n}},function(e,t,E){var n=E(1),r=E(2);e.exports=function(e){return r(e)&&"[object Arguments]"==n(e)}},function(e,t){e.exports=function(){return!1}},function(e,t,E){var n=E(1),r=E(11),o=E(2),T={};T["[object Float32Array]"]=T["[object Float64Array]"]=T["[object Int8Array]"]=T["[object Int16Array]"]=T["[object Int32Array]"]=T["[object Uint8Array]"]=T["[object Uint8ClampedArray]"]=T["[object Uint16Array]"]=T["[object Uint32Array]"]=!0,T["[object Arguments]"]=T["[object Array]"]=T["[object ArrayBuffer]"]=T["[object Boolean]"]=T["[object DataView]"]=T["[object Date]"]=T["[object Error]"]=T["[object Function]"]=T["[object Map]"]=T["[object Number]"]=T["[object Object]"]=T["[object RegExp]"]=T["[object Set]"]=T["[object String]"]=T["[object WeakMap]"]=!1,e.exports=function(e){return o(e)&&r(e.length)&&!!T[n(e)]}},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,E){(function(e){var n=E(10),r=t&&!t.nodeType&&t,o=r&&"object"==typeof e&&e&&!e.nodeType&&e,T=o&&o.exports===r&&n.process,R=function(){try{var e=o&&o.require&&o.require("util").types;return e||T&&T.binding&&T.binding("util")}catch(e){}}();e.exports=R}).call(this,E(17)(e))},function(e,t,E){var n=E(49)(Object.keys,Object);e.exports=n},function(e,t){e.exports=function(e,t){return function(E){return e(t(E))}}},function(e,t){var E=Math.floor;e.exports=function(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=E(t/2))&&(e+=e)}while(t);return n}},function(e,t,E){var n=E(52),r=E(5),o=E(18),T=E(6);e.exports=function(e,t,E){if(!T(E))return!1;var R=typeof t;return!!("number"==R?r(E)&&o(t,E.length):"string"==R&&t in E)&&n(E[t],e)}},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,E){var n=E(8),r=E(14),o=E(7),T=E(13),R=n?n.prototype:void 0,i=R?R.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(o(t))return r(t,e)+"";if(T(t))return i?i.call(t):"";var E=t+"";return"0"==E&&1/t==-1/0?"-0":E}},function(e,t,E){var n=E(55),r=E(60),o=E(61),T=E(62),R=E(63),i=E(1),N=E(23),A=N(n),O=N(r),u=N(o),I=N(T),S=N(R),c=i;(n&&"[object DataView]"!=c(new n(new ArrayBuffer(1)))||r&&"[object Map]"!=c(new r)||o&&"[object Promise]"!=c(o.resolve())||T&&"[object Set]"!=c(new T)||R&&"[object WeakMap]"!=c(new R))&&(c=function(e){var t=i(e),E="[object Object]"==t?e.constructor:void 0,n=E?N(E):"";if(n)switch(n){case A:return"[object DataView]";case O:return"[object Map]";case u:return"[object Promise]";case I:return"[object Set]";case S:return"[object WeakMap]"}return t}),e.exports=c},function(e,t,E){var n=E(3)(E(0),"DataView");e.exports=n},function(e,t,E){var n=E(9),r=E(57),o=E(6),T=E(23),R=/^\[object .+?Constructor\]$/,i=Function.prototype,N=Object.prototype,A=i.toString,O=N.hasOwnProperty,u=RegExp("^"+A.call(O).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!o(e)||r(e))&&(n(e)?u:R).test(T(e))}},function(e,t,E){var n,r=E(58),o=(n=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";e.exports=function(e){return!!o&&o in e}},function(e,t,E){var n=E(0)["__core-js_shared__"];e.exports=n},function(e,t){e.exports=function(e,t){return null==e?void 0:e[t]}},function(e,t,E){var n=E(3)(E(0),"Map");e.exports=n},function(e,t,E){var n=E(3)(E(0),"Promise");e.exports=n},function(e,t,E){var n=E(3)(E(0),"Set");e.exports=n},function(e,t,E){var n=E(3)(E(0),"WeakMap");e.exports=n},function(e,t,E){"use strict";E.r(t),E.d(t,"format",(function(){return se}));var n=E(24),r=E.n(n),o={WHITESPACE:"whitespace",WORD:"word",STRING:"string",RESERVED:"reserved",RESERVED_TOP_LEVEL:"reserved-top-level",RESERVED_TOP_LEVEL_NO_INDENT:"reserved-top-level-no-indent",RESERVED_NEWLINE:"reserved-newline",OPERATOR:"operator",OPEN_PAREN:"open-paren",CLOSE_PAREN:"close-paren",LINE_COMMENT:"line-comment",BLOCK_COMMENT:"block-comment",NUMBER:"number",PLACEHOLDER:"placeholder"},T=E(25),R=E.n(T),i=E(26),N=E.n(i);function A(e,t){for(var E=0;E<t.length;E++){var n=t[E];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var O=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.indent=t||" ",this.indentTypes=[]}var t,E,n;return t=e,(E=[{key:"getIndent",value:function(){return R()(this.indent,this.indentTypes.length)}},{key:"increaseTopLevel",value:function(){this.indentTypes.push("top-level")}},{key:"increaseBlockLevel",value:function(){this.indentTypes.push("block-level")}},{key:"decreaseTopLevel",value:function(){"top-level"===N()(this.indentTypes)&&this.indentTypes.pop()}},{key:"decreaseBlockLevel",value:function(){for(;this.indentTypes.length>0&&"top-level"===this.indentTypes.pop(););}},{key:"resetIndentation",value:function(){this.indentTypes=[]}}])&&A(t.prototype,E),n&&A(t,n),e}();function u(e,t){for(var E=0;E<t.length;E++){var n=t[E];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var I=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.level=0}var t,E,n;return t=e,(E=[{key:"beginIfPossible",value:function(e,t){0===this.level&&this.isInlineBlock(e,t)?this.level=1:this.level>0?this.level++:this.level=0}},{key:"end",value:function(){this.level--}},{key:"isActive",value:function(){return this.level>0}},{key:"isInlineBlock",value:function(e,t){for(var E=0,n=0,r=t;r<e.length;r++){var T=e[r];if((E+=T.value.length)>50)return!1;if(T.type===o.OPEN_PAREN)n++;else if(T.type===o.CLOSE_PAREN&&0==--n)return!0;if(this.isForbiddenToken(T))return!1}return!1}},{key:"isForbiddenToken",value:function(e){var t=e.type,E=e.value;return t===o.RESERVED_TOP_LEVEL||t===o.RESERVED_NEWLINE||t===o.COMMENT||t===o.BLOCK_COMMENT||";"===E}}])&&u(t.prototype,E),n&&u(t,n),e}();function S(e,t){for(var E=0;E<t.length;E++){var n=t[E];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var c=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.params=t,this.index=0}var t,E,n;return t=e,(E=[{key:"get",value:function(e){var t=e.key,E=e.value;return this.params?t?this.params[t]:this.params[this.index++]:E}}])&&S(t.prototype,E),n&&S(t,n),e}(),L=E(27),a=E.n(L),s=E(4),f=E.n(s);function C(e,t){for(var E=0;E<t.length;E++){var n=t[E];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.WHITESPACE_REGEX=/^([\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]+)/,this.NUMBER_REGEX=/^((\x2D[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)?[0-9]+(\.[0-9]+)?([Ee]\x2D?[0-9]+(\.[0-9]+)?)?|0x[0-9A-Fa-f]+|0b[01]+)\b/,this.OPERATOR_REGEX=/^(!=|<<|>>|<>|==|<=|>=|!<|!>|\|\|\/|\|\/|\|\||::|\x2D>>|\x2D>|~~\*|~~|!~~\*|!~~|~\*|!~\*|!~|@|:=|(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))/,this.BLOCK_COMMENT_REGEX=/^(\/\*(?:[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?(?:\*\/|$))/,this.LINE_COMMENT_REGEX=this.createLineCommentRegex(t.lineCommentTypes),this.RESERVED_TOP_LEVEL_REGEX=this.createReservedWordRegex(t.reservedTopLevelWords),this.RESERVED_TOP_LEVEL_NO_INDENT_REGEX=this.createReservedWordRegex(t.reservedTopLevelWordsNoIndent),this.RESERVED_NEWLINE_REGEX=this.createReservedWordRegex(t.reservedNewlineWords),this.RESERVED_PLAIN_REGEX=this.createReservedWordRegex(t.reservedWords),this.WORD_REGEX=this.createWordRegex(t.specialWordChars),this.STRING_REGEX=this.createStringRegex(t.stringTypes),this.OPEN_PAREN_REGEX=this.createParenRegex(t.openParens),this.CLOSE_PAREN_REGEX=this.createParenRegex(t.closeParens),this.INDEXED_PLACEHOLDER_REGEX=this.createPlaceholderRegex(t.indexedPlaceholderTypes,"[0-9]*"),this.IDENT_NAMED_PLACEHOLDER_REGEX=this.createPlaceholderRegex(t.namedPlaceholderTypes,"[a-zA-Z0-9._$]+"),this.STRING_NAMED_PLACEHOLDER_REGEX=this.createPlaceholderRegex(t.namedPlaceholderTypes,this.createStringPattern(t.stringTypes))}var t,E,n;return t=e,(E=[{key:"createLineCommentRegex",value:function(e){return new RegExp("^((?:".concat(e.map((function(e){return f()(e)})).join("|"),").*?(?:\r\n|\r|\n|$))"),"u")}},{key:"createReservedWordRegex",value:function(e){if(0===e.length)return new RegExp("^\b$","u");var t=(e=e.sort((function(e,t){return t.length-e.length||e.localeCompare(t)}))).join("|").replace(/ /g,"\\s+");return new RegExp("^(".concat(t,")\\b"),"iu")}},{key:"createWordRegex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return new RegExp("^([\\p{Alphabetic}\\p{Mark}\\p{Decimal_Number}\\p{Connector_Punctuation}\\p{Join_Control}".concat(e.join(""),"]+)"),"u")}},{key:"createStringRegex",value:function(e){return new RegExp("^("+this.createStringPattern(e)+")","u")}},{key:"createStringPattern",value:function(e){var t={"``":"((`[^`]*($|`))+)","{}":"((\\{[^\\}]*($|\\}))+)","[]":"((\\[[^\\]]*($|\\]))(\\][^\\]]*($|\\]))*)",'""':'(("[^"\\\\]*(?:\\\\.[^"\\\\]*)*("|$))+)',"''":"(('[^'\\\\]*(?:\\\\.[^'\\\\]*)*('|$))+)","N''":"((N'[^N'\\\\]*(?:\\\\.[^N'\\\\]*)*('|$))+)"};return e.map((function(e){return t[e]})).join("|")}},{key:"createParenRegex",value:function(e){var t=this;return new RegExp("^("+e.map((function(e){return t.escapeParen(e)})).join("|")+")","iu")}},{key:"escapeParen",value:function(e){return 1===e.length?f()(e):"\\b"+e+"\\b"}},{key:"createPlaceholderRegex",value:function(e,t){if(a()(e))return!1;var E=e.map(f.a).join("|");return new RegExp("^((?:".concat(E,")(?:").concat(t,"))"),"u")}},{key:"tokenize",value:function(e){if(!e)return[];for(var t,E=[];e.length;)t=this.getNextToken(e,t),e=e.substring(t.value.length),E.push(t);return E}},{key:"getNextToken",value:function(e,t){return this.getWhitespaceToken(e)||this.getCommentToken(e)||this.getStringToken(e)||this.getOpenParenToken(e)||this.getCloseParenToken(e)||this.getPlaceholderToken(e)||this.getNumberToken(e)||this.getReservedWordToken(e,t)||this.getWordToken(e)||this.getOperatorToken(e)}},{key:"getWhitespaceToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:o.WHITESPACE,regex:this.WHITESPACE_REGEX})}},{key:"getCommentToken",value:function(e){return this.getLineCommentToken(e)||this.getBlockCommentToken(e)}},{key:"getLineCommentToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:o.LINE_COMMENT,regex:this.LINE_COMMENT_REGEX})}},{key:"getBlockCommentToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:o.BLOCK_COMMENT,regex:this.BLOCK_COMMENT_REGEX})}},{key:"getStringToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:o.STRING,regex:this.STRING_REGEX})}},{key:"getOpenParenToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:o.OPEN_PAREN,regex:this.OPEN_PAREN_REGEX})}},{key:"getCloseParenToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:o.CLOSE_PAREN,regex:this.CLOSE_PAREN_REGEX})}},{key:"getPlaceholderToken",value:function(e){return this.getIdentNamedPlaceholderToken(e)||this.getStringNamedPlaceholderToken(e)||this.getIndexedPlaceholderToken(e)}},{key:"getIdentNamedPlaceholderToken",value:function(e){return this.getPlaceholderTokenWithKey({input:e,regex:this.IDENT_NAMED_PLACEHOLDER_REGEX,parseKey:function(e){return e.slice(1)}})}},{key:"getStringNamedPlaceholderToken",value:function(e){var t=this;return this.getPlaceholderTokenWithKey({input:e,regex:this.STRING_NAMED_PLACEHOLDER_REGEX,parseKey:function(e){return t.getEscapedPlaceholderKey({key:e.slice(2,-1),quoteChar:e.slice(-1)})}})}},{key:"getIndexedPlaceholderToken",value:function(e){return this.getPlaceholderTokenWithKey({input:e,regex:this.INDEXED_PLACEHOLDER_REGEX,parseKey:function(e){return e.slice(1)}})}},{key:"getPlaceholderTokenWithKey",value:function(e){var t=e.input,E=e.regex,n=e.parseKey,r=this.getTokenOnFirstMatch({input:t,regex:E,type:o.PLACEHOLDER});return r&&(r.key=n(r.value)),r}},{key:"getEscapedPlaceholderKey",value:function(e){var t=e.key,E=e.quoteChar;return t.replace(new RegExp(f()("\\"+E),"gu"),E)}},{key:"getNumberToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:o.NUMBER,regex:this.NUMBER_REGEX})}},{key:"getOperatorToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:o.OPERATOR,regex:this.OPERATOR_REGEX})}},{key:"getReservedWordToken",value:function(e,t){if(!t||!t.value||"."!==t.value)return this.getTopLevelReservedToken(e)||this.getNewlineReservedToken(e)||this.getTopLevelReservedTokenNoIndent(e)||this.getPlainReservedToken(e)}},{key:"getTopLevelReservedToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:o.RESERVED_TOP_LEVEL,regex:this.RESERVED_TOP_LEVEL_REGEX})}},{key:"getNewlineReservedToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:o.RESERVED_NEWLINE,regex:this.RESERVED_NEWLINE_REGEX})}},{key:"getTopLevelReservedTokenNoIndent",value:function(e){return this.getTokenOnFirstMatch({input:e,type:o.RESERVED_TOP_LEVEL_NO_INDENT,regex:this.RESERVED_TOP_LEVEL_NO_INDENT_REGEX})}},{key:"getPlainReservedToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:o.RESERVED,regex:this.RESERVED_PLAIN_REGEX})}},{key:"getWordToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:o.WORD,regex:this.WORD_REGEX})}},{key:"getTokenOnFirstMatch",value:function(e){var t=e.input,E=e.type,n=e.regex,r=t.match(n);if(r)return{type:E,value:r[1]}}}])&&C(t.prototype,E),n&&C(t,n),e}();function p(e,t){for(var E=0;E<t.length;E++){var n=t[E];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var D,P,U,M=function(e){return e.replace(/[\t ]+$/,"")},y=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.cfg=t||{},this.indentation=new O(this.cfg.indent),this.inlineBlock=new I,this.params=new c(this.cfg.params),this.previousReservedToken={},this.tokens=[],this.index=0}var t,E,n;return t=e,(E=[{key:"tokenOverride",value:function(){}},{key:"format",value:function(e){return this.tokens=this.constructor.tokenizer.tokenize(e),this.getFormattedQueryFromTokens().trim()}},{key:"getFormattedQueryFromTokens",value:function(){var e=this,t="";return this.tokens.forEach((function(E,n){e.index=n,(E=e.tokenOverride(E)||E).type===o.WHITESPACE||(E.type===o.LINE_COMMENT?t=e.formatLineComment(E,t):E.type===o.BLOCK_COMMENT?t=e.formatBlockComment(E,t):E.type===o.RESERVED_TOP_LEVEL?(t=e.formatTopLevelReservedWord(E,t),e.previousReservedToken=E):E.type===o.RESERVED_TOP_LEVEL_NO_INDENT?(t=e.formatTopLevelReservedWordNoIndent(E,t),e.previousReservedToken=E):E.type===o.RESERVED_NEWLINE?(t=e.formatNewlineReservedWord(E,t),e.previousReservedToken=E):E.type===o.RESERVED?(t=e.formatWithSpaces(E,t),e.previousReservedToken=E):t=E.type===o.OPEN_PAREN?e.formatOpeningParentheses(E,t):E.type===o.CLOSE_PAREN?e.formatClosingParentheses(E,t):E.type===o.PLACEHOLDER?e.formatPlaceholder(E,t):","===E.value?e.formatComma(E,t):":"===E.value?e.formatWithSpaceAfter(E,t):"."===E.value?e.formatWithoutSpaces(E,t):";"===E.value?e.formatQuerySeparator(E,t):e.formatWithSpaces(E,t))})),t}},{key:"formatLineComment",value:function(e,t){return this.addNewline(t+e.value)}},{key:"formatBlockComment",value:function(e,t){return this.addNewline(this.addNewline(t)+this.indentComment(e.value))}},{key:"indentComment",value:function(e){return e.replace(/\n[\t ]*/g,"\n"+this.indentation.getIndent()+" ")}},{key:"formatTopLevelReservedWordNoIndent",value:function(e,t){return this.indentation.decreaseTopLevel(),t=this.addNewline(t)+this.equalizeWhitespace(this.formatReservedWord(e.value)),this.addNewline(t)}},{key:"formatTopLevelReservedWord",value:function(e,t){return this.indentation.decreaseTopLevel(),t=this.addNewline(t),this.indentation.increaseTopLevel(),t+=this.equalizeWhitespace(this.formatReservedWord(e.value)),this.addNewline(t)}},{key:"formatNewlineReservedWord",value:function(e,t){return this.addNewline(t)+this.equalizeWhitespace(this.formatReservedWord(e.value))+" "}},{key:"equalizeWhitespace",value:function(e){return e.replace(/[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]+/g," ")}},{key:"formatOpeningParentheses",value:function(e,t){var E=[o.WHITESPACE,o.OPEN_PAREN,o.LINE_COMMENT,o.OPERATOR];return r()(E,this.previousToken().type)||(t=M(t)),t+=this.cfg.uppercase?e.value.toUpperCase():e.value,this.inlineBlock.beginIfPossible(this.tokens,this.index),this.inlineBlock.isActive()||(this.indentation.increaseBlockLevel(),t=this.addNewline(t)),t}},{key:"formatClosingParentheses",value:function(e,t){return e.value=this.cfg.uppercase?e.value.toUpperCase():e.value,this.inlineBlock.isActive()?(this.inlineBlock.end(),this.formatWithSpaceAfter(e,t)):(this.indentation.decreaseBlockLevel(),this.formatWithSpaces(e,this.addNewline(t)))}},{key:"formatPlaceholder",value:function(e,t){return t+this.params.get(e)+" "}},{key:"formatComma",value:function(e,t){return t=M(t)+e.value+" ",this.inlineBlock.isActive()||/^LIMIT$/i.test(this.previousReservedToken.value)?t:this.addNewline(t)}},{key:"formatWithSpaceAfter",value:function(e,t){return M(t)+e.value+" "}},{key:"formatWithoutSpaces",value:function(e,t){return M(t)+e.value}},{key:"formatWithSpaces",value:function(e,t){return t+("reserved"===e.type?this.formatReservedWord(e.value):e.value)+" "}},{key:"formatReservedWord",value:function(e){return this.cfg.uppercase?e.toUpperCase():e}},{key:"formatQuerySeparator",value:function(e,t){return this.indentation.resetIndentation(),M(t)+e.value+"\n".repeat(this.cfg.linesBetweenQueries||1)}},{key:"addNewline",value:function(e){return(e=M(e)).endsWith("\n")||(e+="\n"),e+this.indentation.getIndent()}},{key:"previousToken",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.tokens[this.index-e]||{}}},{key:"tokenLookBack",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=Math.max(0,this.index-e),E=this.index;return this.tokens.slice(t,E).reverse()}},{key:"tokenLookAhead",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=this.index+1,E=this.index+e+1;return this.tokens.slice(t,E)}}])&&p(t.prototype,E),n&&p(t,n),e}();function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var E,n=b(e);if(t){var r=b(this).constructor;E=Reflect.construct(n,arguments,r)}else E=n.apply(this,arguments);return F(this,E)}}function F(e,t){return!t||"object"!==v(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}D=y,P="tokenizer",U=new l({reservedWords:[],reservedTopLevelWords:[],reservedNewlineWords:[],reservedTopLevelWordsNoIndent:[],stringTypes:[],openParens:[],closeParens:[],indexedPlaceholderTypes:[],namedPlaceholderTypes:[],lineCommentTypes:[],specialWordChars:[]}),P in D?Object.defineProperty(D,P,{value:U,enumerable:!0,configurable:!0,writable:!0}):D[P]=U;var G=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}(E,e);var t=_(E);function E(){return h(this,E),t.apply(this,arguments)}return E}(y);function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function B(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function H(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var E,n=k(e);if(t){var r=k(this).constructor;E=Reflect.construct(n,arguments,r)}else E=n.apply(this,arguments);return W(this,E)}}function W(e,t){return!t||"object"!==g(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function k(e){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,t,E){t in e?Object.defineProperty(e,t,{value:E,enumerable:!0,configurable:!0,writable:!0}):e[t]=E}(G,"tokenizer",new l({reservedWords:["ABS","ACTIVATE","ALIAS","ALL","ALLOCATE","ALLOW","ALTER","ANY","ARE","ARRAY","AS","ASC","ASENSITIVE","ASSOCIATE","ASUTIME","ASYMMETRIC","AT","ATOMIC","ATTRIBUTES","AUDIT","AUTHORIZATION","AUX","AUXILIARY","AVG","BEFORE","BEGIN","BETWEEN","BIGINT","BINARY","BLOB","BOOLEAN","BOTH","BUFFERPOOL","BY","CACHE","CALL","CALLED","CAPTURE","CARDINALITY","CASCADED","CASE","CAST","CCSID","CEIL","CEILING","CHAR","CHARACTER","CHARACTER_LENGTH","CHAR_LENGTH","CHECK","CLOB","CLONE","CLOSE","CLUSTER","COALESCE","COLLATE","COLLECT","COLLECTION","COLLID","COLUMN","COMMENT","COMMIT","CONCAT","CONDITION","CONNECT","CONNECTION","CONSTRAINT","CONTAINS","CONTINUE","CONVERT","CORR","CORRESPONDING","COUNT","COUNT_BIG","COVAR_POP","COVAR_SAMP","CREATE","CROSS","CUBE","CUME_DIST","CURRENT","CURRENT_DATE","CURRENT_DEFAULT_TRANSFORM_GROUP","CURRENT_LC_CTYPE","CURRENT_PATH","CURRENT_ROLE","CURRENT_SCHEMA","CURRENT_SERVER","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_TIMEZONE","CURRENT_TRANSFORM_GROUP_FOR_TYPE","CURRENT_USER","CURSOR","CYCLE","DATA","DATABASE","DATAPARTITIONNAME","DATAPARTITIONNUM","DATE","DAY","DAYS","DB2GENERAL","DB2GENRL","DB2SQL","DBINFO","DBPARTITIONNAME","DBPARTITIONNUM","DEALLOCATE","DEC","DECIMAL","DECLARE","DEFAULT","DEFAULTS","DEFINITION","DELETE","DENSERANK","DENSE_RANK","DEREF","DESCRIBE","DESCRIPTOR","DETERMINISTIC","DIAGNOSTICS","DISABLE","DISALLOW","DISCONNECT","DISTINCT","DO","DOCUMENT","DOUBLE","DROP","DSSIZE","DYNAMIC","EACH","EDITPROC","ELEMENT","ELSE","ELSEIF","ENABLE","ENCODING","ENCRYPTION","END","END-EXEC","ENDING","ERASE","ESCAPE","EVERY","EXCEPTION","EXCLUDING","EXCLUSIVE","EXEC","EXECUTE","EXISTS","EXIT","EXP","EXPLAIN","EXTENDED","EXTERNAL","EXTRACT","FALSE","FENCED","FETCH","FIELDPROC","FILE","FILTER","FINAL","FIRST","FLOAT","FLOOR","FOR","FOREIGN","FREE","FULL","FUNCTION","FUSION","GENERAL","GENERATED","GET","GLOBAL","GOTO","GRANT","GRAPHIC","GROUP","GROUPING","HANDLER","HASH","HASHED_VALUE","HINT","HOLD","HOUR","HOURS","IDENTITY","IF","IMMEDIATE","IN","INCLUDING","INCLUSIVE","INCREMENT","INDEX","INDICATOR","INDICATORS","INF","INFINITY","INHERIT","INNER","INOUT","INSENSITIVE","INSERT","INT","INTEGER","INTEGRITY","INTERSECTION","INTERVAL","INTO","IS","ISOBID","ISOLATION","ITERATE","JAR","JAVA","KEEP","KEY","LABEL","LANGUAGE","LARGE","LATERAL","LC_CTYPE","LEADING","LEAVE","LEFT","LIKE","LINKTYPE","LN","LOCAL","LOCALDATE","LOCALE","LOCALTIME","LOCALTIMESTAMP","LOCATOR","LOCATORS","LOCK","LOCKMAX","LOCKSIZE","LONG","LOOP","LOWER","MAINTAINED","MATCH","MATERIALIZED","MAX","MAXVALUE","MEMBER","MERGE","METHOD","MICROSECOND","MICROSECONDS","MIN","MINUTE","MINUTES","MINVALUE","MOD","MODE","MODIFIES","MODULE","MONTH","MONTHS","MULTISET","NAN","NATIONAL","NATURAL","NCHAR","NCLOB","NEW","NEW_TABLE","NEXTVAL","NO","NOCACHE","NOCYCLE","NODENAME","NODENUMBER","NOMAXVALUE","NOMINVALUE","NONE","NOORDER","NORMALIZE","NORMALIZED","NOT","NULL","NULLIF","NULLS","NUMERIC","NUMPARTS","OBID","OCTET_LENGTH","OF","OFFSET","OLD","OLD_TABLE","ON","ONLY","OPEN","OPTIMIZATION","OPTIMIZE","OPTION","ORDER","OUT","OUTER","OVER","OVERLAPS","OVERLAY","OVERRIDING","PACKAGE","PADDED","PAGESIZE","PARAMETER","PART","PARTITION","PARTITIONED","PARTITIONING","PARTITIONS","PASSWORD","PATH","PERCENTILE_CONT","PERCENTILE_DISC","PERCENT_RANK","PIECESIZE","PLAN","POSITION","POWER","PRECISION","PREPARE","PREVVAL","PRIMARY","PRIQTY","PRIVILEGES","PROCEDURE","PROGRAM","PSID","PUBLIC","QUERY","QUERYNO","RANGE","RANK","READ","READS","REAL","RECOVERY","RECURSIVE","REF","REFERENCES","REFERENCING","REFRESH","REGR_AVGX","REGR_AVGY","REGR_COUNT","REGR_INTERCEPT","REGR_R2","REGR_SLOPE","REGR_SXX","REGR_SXY","REGR_SYY","RELEASE","RENAME","REPEAT","RESET","RESIGNAL","RESTART","RESTRICT","RESULT","RESULT_SET_LOCATOR","RETURN","RETURNS","REVOKE","RIGHT","ROLE","ROLLBACK","ROLLUP","ROUND_CEILING","ROUND_DOWN","ROUND_FLOOR","ROUND_HALF_DOWN","ROUND_HALF_EVEN","ROUND_HALF_UP","ROUND_UP","ROUTINE","ROW","ROWNUMBER","ROWS","ROWSET","ROW_NUMBER","RRN","RUN","SAVEPOINT","SCHEMA","SCOPE","SCRATCHPAD","SCROLL","SEARCH","SECOND","SECONDS","SECQTY","SECURITY","SENSITIVE","SEQUENCE","SESSION","SESSION_USER","SIGNAL","SIMILAR","SIMPLE","SMALLINT","SNAN","SOME","SOURCE","SPECIFIC","SPECIFICTYPE","SQL","SQLEXCEPTION","SQLID","SQLSTATE","SQLWARNING","SQRT","STACKED","STANDARD","START","STARTING","STATEMENT","STATIC","STATMENT","STAY","STDDEV_POP","STDDEV_SAMP","STOGROUP","STORES","STYLE","SUBMULTISET","SUBSTRING","SUM","SUMMARY","SYMMETRIC","SYNONYM","SYSFUN","SYSIBM","SYSPROC","SYSTEM","SYSTEM_USER","TABLE","TABLESAMPLE","TABLESPACE","THEN","TIME","TIMESTAMP","TIMEZONE_HOUR","TIMEZONE_MINUTE","TO","TRAILING","TRANSACTION","TRANSLATE","TRANSLATION","TREAT","TRIGGER","TRIM","TRUE","TRUNCATE","TYPE","UESCAPE","UNDO","UNIQUE","UNKNOWN","UNNEST","UNTIL","UPPER","USAGE","USER","USING","VALIDPROC","VALUE","VARCHAR","VARIABLE","VARIANT","VARYING","VAR_POP","VAR_SAMP","VCAT","VERSION","VIEW","VOLATILE","VOLUMES","WHEN","WHENEVER","WHILE","WIDTH_BUCKET","WINDOW","WITH","WITHIN","WITHOUT","WLM","WRITE","XMLELEMENT","XMLEXISTS","XMLNAMESPACES","YEAR","YEARS"],reservedTopLevelWords:["ADD","AFTER","ALTER COLUMN","ALTER TABLE","DELETE FROM","EXCEPT","FETCH FIRST","FROM","GROUP BY","GO","HAVING","INSERT INTO","INTERSECT","LIMIT","ORDER BY","SELECT","SET CURRENT SCHEMA","SET SCHEMA","SET","UPDATE","VALUES","WHERE"],reservedNewlineWords:["AND","CROSS JOIN","INNER JOIN","JOIN","LEFT JOIN","LEFT OUTER JOIN","OR","OUTER JOIN","RIGHT JOIN","RIGHT OUTER JOIN"],reservedTopLevelWordsNoIndent:["INTERSECT","INTERSECT ALL","MINUS","UNION","UNION ALL"],stringTypes:['""',"''","``","[]"],openParens:["("],closeParens:[")"],indexedPlaceholderTypes:["?"],namedPlaceholderTypes:[":"],lineCommentTypes:["--"],specialWordChars:["#","@"]}));var Y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&m(e,t)}(E,e);var t=H(E);function E(){return B(this,E),t.apply(this,arguments)}return E}(y);function V(e){return(V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function x(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(e,t){for(var E=0;E<t.length;E++){var n=t[E];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function X(e,t){return(X=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function j(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var E,n=J(e);if(t){var r=J(this).constructor;E=Reflect.construct(n,arguments,r)}else E=n.apply(this,arguments);return K(this,E)}}function K(e,t){return!t||"object"!==V(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function J(e){return(J=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,t,E){t in e?Object.defineProperty(e,t,{value:E,enumerable:!0,configurable:!0,writable:!0}):e[t]=E}(Y,"tokenizer",new l({reservedWords:["ALL","ALTER","ANALYZE","AND","ANY","ARRAY","AS","ASC","BEGIN","BETWEEN","BINARY","BOOLEAN","BREAK","BUCKET","BUILD","BY","CALL","CASE","CAST","CLUSTER","COLLATE","COLLECTION","COMMIT","CONNECT","CONTINUE","CORRELATE","COVER","CREATE","DATABASE","DATASET","DATASTORE","DECLARE","DECREMENT","DELETE","DERIVED","DESC","DESCRIBE","DISTINCT","DO","DROP","EACH","ELEMENT","ELSE","END","EVERY","EXCEPT","EXCLUDE","EXECUTE","EXISTS","EXPLAIN","FALSE","FETCH","FIRST","FLATTEN","FOR","FORCE","FROM","FUNCTION","GRANT","GROUP","GSI","HAVING","IF","IGNORE","ILIKE","IN","INCLUDE","INCREMENT","INDEX","INFER","INLINE","INNER","INSERT","INTERSECT","INTO","IS","JOIN","KEY","KEYS","KEYSPACE","KNOWN","LAST","LEFT","LET","LETTING","LIKE","LIMIT","LSM","MAP","MAPPING","MATCHED","MATERIALIZED","MERGE","MISSING","NAMESPACE","NEST","NOT","NULL","NUMBER","OBJECT","OFFSET","ON","OPTION","OR","ORDER","OUTER","OVER","PARSE","PARTITION","PASSWORD","PATH","POOL","PREPARE","PRIMARY","PRIVATE","PRIVILEGE","PROCEDURE","PUBLIC","RAW","REALM","REDUCE","RENAME","RETURN","RETURNING","REVOKE","RIGHT","ROLE","ROLLBACK","SATISFIES","SCHEMA","SELECT","SELF","SEMI","SET","SHOW","SOME","START","STATISTICS","STRING","SYSTEM","THEN","TO","TRANSACTION","TRIGGER","TRUE","TRUNCATE","UNDER","UNION","UNIQUE","UNKNOWN","UNNEST","UNSET","UPDATE","UPSERT","USE","USER","USING","VALIDATE","VALUE","VALUED","VALUES","VIA","VIEW","WHEN","WHERE","WHILE","WITH","WITHIN","WORK","XOR"],reservedTopLevelWords:["DELETE FROM","EXCEPT ALL","EXCEPT","EXPLAIN DELETE FROM","EXPLAIN UPDATE","EXPLAIN UPSERT","FROM","GROUP BY","HAVING","INFER","INSERT INTO","LET","LIMIT","MERGE","NEST","ORDER BY","PREPARE","SELECT","SET CURRENT SCHEMA","SET SCHEMA","SET","UNNEST","UPDATE","UPSERT","USE KEYS","VALUES","WHERE"],reservedNewlineWords:["AND","INNER JOIN","JOIN","LEFT JOIN","LEFT OUTER JOIN","OR","OUTER JOIN","RIGHT JOIN","RIGHT OUTER JOIN","XOR"],reservedTopLevelWordsNoIndent:["INTERSECT","INTERSECT ALL","MINUS","UNION","UNION ALL"],stringTypes:['""',"''","``"],openParens:["(","[","{"],closeParens:[")","]","}"],namedPlaceholderTypes:["$"],lineCommentTypes:["#","--"]}));var Q=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&X(e,t)}(T,e);var t,E,n,r=j(T);function T(){return x(this,T),r.apply(this,arguments)}return t=T,(E=[{key:"tokenOverride",value:function(e){if(e.type===o.RESERVED_TOP_LEVEL&&"SET"===e.value.toUpperCase()&&"BY"===this.previousReservedToken.value.toUpperCase())return e.type=o.RESERVED,e}}])&&w(t.prototype,E),n&&w(t,n),T}(y);function Z(e){return(Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function $(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z(e,t){return(z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function q(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var E,n=te(e);if(t){var r=te(this).constructor;E=Reflect.construct(n,arguments,r)}else E=n.apply(this,arguments);return ee(this,E)}}function ee(e,t){return!t||"object"!==Z(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function te(e){return(te=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,t,E){t in e?Object.defineProperty(e,t,{value:E,enumerable:!0,configurable:!0,writable:!0}):e[t]=E}(Q,"tokenizer",new l({reservedWords:["A","ACCESSIBLE","AGENT","AGGREGATE","ALL","ALTER","ANY","ARRAY","AS","ASC","AT","ATTRIBUTE","AUTHID","AVG","BETWEEN","BFILE_BASE","BINARY_INTEGER","BINARY","BLOB_BASE","BLOCK","BODY","BOOLEAN","BOTH","BOUND","BREADTH","BULK","BY","BYTE","C","CALL","CALLING","CASCADE","CASE","CHAR_BASE","CHAR","CHARACTER","CHARSET","CHARSETFORM","CHARSETID","CHECK","CLOB_BASE","CLONE","CLOSE","CLUSTER","CLUSTERS","COALESCE","COLAUTH","COLLECT","COLUMNS","COMMENT","COMMIT","COMMITTED","COMPILED","COMPRESS","CONNECT","CONSTANT","CONSTRUCTOR","CONTEXT","CONTINUE","CONVERT","COUNT","CRASH","CREATE","CREDENTIAL","CURRENT","CURRVAL","CURSOR","CUSTOMDATUM","DANGLING","DATA","DATE_BASE","DATE","DAY","DECIMAL","DEFAULT","DEFINE","DELETE","DEPTH","DESC","DETERMINISTIC","DIRECTORY","DISTINCT","DO","DOUBLE","DROP","DURATION","ELEMENT","ELSIF","EMPTY","END","ESCAPE","EXCEPTIONS","EXCLUSIVE","EXECUTE","EXISTS","EXIT","EXTENDS","EXTERNAL","EXTRACT","FALSE","FETCH","FINAL","FIRST","FIXED","FLOAT","FOR","FORALL","FORCE","FROM","FUNCTION","GENERAL","GOTO","GRANT","GROUP","HASH","HEAP","HIDDEN","HOUR","IDENTIFIED","IF","IMMEDIATE","IN","INCLUDING","INDEX","INDEXES","INDICATOR","INDICES","INFINITE","INSTANTIABLE","INT","INTEGER","INTERFACE","INTERVAL","INTO","INVALIDATE","IS","ISOLATION","JAVA","LANGUAGE","LARGE","LEADING","LENGTH","LEVEL","LIBRARY","LIKE","LIKE2","LIKE4","LIKEC","LIMITED","LOCAL","LOCK","LONG","MAP","MAX","MAXLEN","MEMBER","MERGE","MIN","MINUTE","MLSLABEL","MOD","MODE","MONTH","MULTISET","NAME","NAN","NATIONAL","NATIVE","NATURAL","NATURALN","NCHAR","NEW","NEXTVAL","NOCOMPRESS","NOCOPY","NOT","NOWAIT","NULL","NULLIF","NUMBER_BASE","NUMBER","OBJECT","OCICOLL","OCIDATE","OCIDATETIME","OCIDURATION","OCIINTERVAL","OCILOBLOCATOR","OCINUMBER","OCIRAW","OCIREF","OCIREFCURSOR","OCIROWID","OCISTRING","OCITYPE","OF","OLD","ON","ONLY","OPAQUE","OPEN","OPERATOR","OPTION","ORACLE","ORADATA","ORDER","ORGANIZATION","ORLANY","ORLVARY","OTHERS","OUT","OVERLAPS","OVERRIDING","PACKAGE","PARALLEL_ENABLE","PARAMETER","PARAMETERS","PARENT","PARTITION","PASCAL","PCTFREE","PIPE","PIPELINED","PLS_INTEGER","PLUGGABLE","POSITIVE","POSITIVEN","PRAGMA","PRECISION","PRIOR","PRIVATE","PROCEDURE","PUBLIC","RAISE","RANGE","RAW","READ","REAL","RECORD","REF","REFERENCE","RELEASE","RELIES_ON","REM","REMAINDER","RENAME","RESOURCE","RESULT_CACHE","RESULT","RETURN","RETURNING","REVERSE","REVOKE","ROLLBACK","ROW","ROWID","ROWNUM","ROWTYPE","SAMPLE","SAVE","SAVEPOINT","SB1","SB2","SB4","SEARCH","SECOND","SEGMENT","SELF","SEPARATE","SEQUENCE","SERIALIZABLE","SHARE","SHORT","SIZE_T","SIZE","SMALLINT","SOME","SPACE","SPARSE","SQL","SQLCODE","SQLDATA","SQLERRM","SQLNAME","SQLSTATE","STANDARD","START","STATIC","STDDEV","STORED","STRING","STRUCT","STYLE","SUBMULTISET","SUBPARTITION","SUBSTITUTABLE","SUBTYPE","SUCCESSFUL","SUM","SYNONYM","SYSDATE","TABAUTH","TABLE","TDO","THE","THEN","TIME","TIMESTAMP","TIMEZONE_ABBR","TIMEZONE_HOUR","TIMEZONE_MINUTE","TIMEZONE_REGION","TO","TRAILING","TRANSACTION","TRANSACTIONAL","TRIGGER","TRUE","TRUSTED","TYPE","UB1","UB2","UB4","UID","UNDER","UNIQUE","UNPLUG","UNSIGNED","UNTRUSTED","USE","USER","USING","VALIDATE","VALIST","VALUE","VARCHAR","VARCHAR2","VARIABLE","VARIANCE","VARRAY","VARYING","VIEW","VIEWS","VOID","WHENEVER","WHILE","WITH","WORK","WRAPPED","WRITE","YEAR","ZONE"],reservedTopLevelWords:["ADD","ALTER COLUMN","ALTER TABLE","BEGIN","CONNECT BY","DECLARE","DELETE FROM","DELETE","END","EXCEPT","EXCEPTION","FETCH FIRST","FROM","GROUP BY","HAVING","INSERT INTO","INSERT","LIMIT","LOOP","MODIFY","ORDER BY","SELECT","SET CURRENT SCHEMA","SET SCHEMA","SET","START WITH","UPDATE","VALUES","WHERE"],reservedNewlineWords:["AND","CROSS APPLY","CROSS JOIN","ELSE","END","INNER JOIN","JOIN","LEFT JOIN","LEFT OUTER JOIN","OR","OUTER APPLY","OUTER JOIN","RIGHT JOIN","RIGHT OUTER JOIN","WHEN","XOR"],reservedTopLevelWordsNoIndent:["INTERSECT","INTERSECT ALL","MINUS","UNION","UNION ALL"],stringTypes:['""',"N''","''","``"],openParens:["(","CASE"],closeParens:[")","END"],indexedPlaceholderTypes:["?"],namedPlaceholderTypes:[":"],lineCommentTypes:["--"],specialWordChars:["_","$","#",".","@"]}));var Ee=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&z(e,t)}(E,e);var t=q(E);function E(){return $(this,E),t.apply(this,arguments)}return E}(y);function ne(e){return(ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oe(e,t){for(var E=0;E<t.length;E++){var n=t[E];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Te(e,t){return(Te=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Re(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var E,n=Ne(e);if(t){var r=Ne(this).constructor;E=Reflect.construct(n,arguments,r)}else E=n.apply(this,arguments);return ie(this,E)}}function ie(e,t){return!t||"object"!==ne(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Ne(e){return(Ne=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,t,E){t in e?Object.defineProperty(e,t,{value:E,enumerable:!0,configurable:!0,writable:!0}):e[t]=E}(Ee,"tokenizer",new l({reservedWords:["AES128","AES256","ALLOWOVERWRITE","ANALYSE","ARRAY","AS","ASC","AUTHORIZATION","BACKUP","BINARY","BLANKSASNULL","BOTH","BYTEDICT","BZIP2","CAST","CHECK","COLLATE","COLUMN","CONSTRAINT","CREATE","CREDENTIALS","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","CURRENT_USER_ID","DEFAULT","DEFERRABLE","DEFLATE","DEFRAG","DELTA","DELTA32K","DESC","DISABLE","DISTINCT","DO","ELSE","EMPTYASNULL","ENABLE","ENCODE","ENCRYPT","ENCRYPTION","END","EXPLICIT","FALSE","FOR","FOREIGN","FREEZE","FULL","GLOBALDICT256","GLOBALDICT64K","GRANT","GZIP","IDENTITY","IGNORE","ILIKE","INITIALLY","INTO","LEADING","LOCALTIME","LOCALTIMESTAMP","LUN","LUNS","LZO","LZOP","MINUS","MOSTLY13","MOSTLY32","MOSTLY8","NATURAL","NEW","NULLS","OFF","OFFLINE","OFFSET","OLD","ON","ONLY","OPEN","ORDER","OVERLAPS","PARALLEL","PARTITION","PERCENT","PERMISSIONS","PLACING","PRIMARY","RAW","READRATIO","RECOVER","REFERENCES","REJECTLOG","RESORT","RESTORE","SESSION_USER","SIMILAR","SYSDATE","SYSTEM","TABLE","TAG","TDES","TEXT255","TEXT32K","THEN","TIMESTAMP","TO","TOP","TRAILING","TRUE","TRUNCATECOLUMNS","UNIQUE","USER","USING","VERBOSE","WALLET","WHEN","WITH","WITHOUT","PREDICATE","COLUMNS","COMPROWS","COMPRESSION","COPY","FORMAT","DELIMITER","FIXEDWIDTH","AVRO","JSON","ENCRYPTED","BZIP2","GZIP","LZOP","PARQUET","ORC","ACCEPTANYDATE","ACCEPTINVCHARS","BLANKSASNULL","DATEFORMAT","EMPTYASNULL","ENCODING","ESCAPE","EXPLICIT_IDS","FILLRECORD","IGNOREBLANKLINES","IGNOREHEADER","NULL AS","REMOVEQUOTES","ROUNDEC","TIMEFORMAT","TRIMBLANKS","TRUNCATECOLUMNS","COMPROWS","COMPUPDATE","MAXERROR","NOLOAD","STATUPDATE","MANIFEST","REGION","IAM_ROLE","MASTER_SYMMETRIC_KEY","SSH","ACCEPTANYDATE","ACCEPTINVCHARS","ACCESS_KEY_ID","SECRET_ACCESS_KEY","AVRO","BLANKSASNULL","BZIP2","COMPROWS","COMPUPDATE","CREDENTIALS","DATEFORMAT","DELIMITER","EMPTYASNULL","ENCODING","ENCRYPTED","ESCAPE","EXPLICIT_IDS","FILLRECORD","FIXEDWIDTH","FORMAT","IAM_ROLE","GZIP","IGNOREBLANKLINES","IGNOREHEADER","JSON","LZOP","MANIFEST","MASTER_SYMMETRIC_KEY","MAXERROR","NOLOAD","NULL AS","READRATIO","REGION","REMOVEQUOTES","ROUNDEC","SSH","STATUPDATE","TIMEFORMAT","SESSION_TOKEN","TRIMBLANKS","TRUNCATECOLUMNS","EXTERNAL","DATA CATALOG","HIVE METASTORE","CATALOG_ROLE","VACUUM","COPY","UNLOAD","EVEN","ALL"],reservedTopLevelWords:["ADD","AFTER","ALTER COLUMN","ALTER TABLE","DELETE FROM","EXCEPT","FROM","GROUP BY","HAVING","INSERT INTO","INSERT","INTERSECT","TOP","LIMIT","MODIFY","ORDER BY","SELECT","SET CURRENT SCHEMA","SET SCHEMA","SET","UNION ALL","UNION","UPDATE","VALUES","WHERE","VACUUM","COPY","UNLOAD","ANALYZE","ANALYSE","DISTKEY","SORTKEY","COMPOUND","INTERLEAVED","FORMAT","DELIMITER","FIXEDWIDTH","AVRO","JSON","ENCRYPTED","BZIP2","GZIP","LZOP","PARQUET","ORC","ACCEPTANYDATE","ACCEPTINVCHARS","BLANKSASNULL","DATEFORMAT","EMPTYASNULL","ENCODING","ESCAPE","EXPLICIT_IDS","FILLRECORD","IGNOREBLANKLINES","IGNOREHEADER","NULL AS","REMOVEQUOTES","ROUNDEC","TIMEFORMAT","TRIMBLANKS","TRUNCATECOLUMNS","COMPROWS","COMPUPDATE","MAXERROR","NOLOAD","STATUPDATE","MANIFEST","REGION","IAM_ROLE","MASTER_SYMMETRIC_KEY","SSH","ACCEPTANYDATE","ACCEPTINVCHARS","ACCESS_KEY_ID","SECRET_ACCESS_KEY","AVRO","BLANKSASNULL","BZIP2","COMPROWS","COMPUPDATE","CREDENTIALS","DATEFORMAT","DELIMITER","EMPTYASNULL","ENCODING","ENCRYPTED","ESCAPE","EXPLICIT_IDS","FILLRECORD","FIXEDWIDTH","FORMAT","IAM_ROLE","GZIP","IGNOREBLANKLINES","IGNOREHEADER","JSON","LZOP","MANIFEST","MASTER_SYMMETRIC_KEY","MAXERROR","NOLOAD","NULL AS","READRATIO","REGION","REMOVEQUOTES","ROUNDEC","SSH","STATUPDATE","TIMEFORMAT","SESSION_TOKEN","TRIMBLANKS","TRUNCATECOLUMNS","EXTERNAL","DATA CATALOG","HIVE METASTORE","CATALOG_ROLE"],reservedNewlineWords:["AND","CROSS JOIN","ELSE","INNER JOIN","JOIN","LEFT JOIN","LEFT OUTER JOIN","OR","OUTER APPLY","OUTER JOIN","RIGHT JOIN","RIGHT OUTER JOIN","WHEN","VACUUM","COPY","UNLOAD","ANALYZE","ANALYSE","DISTKEY","SORTKEY","COMPOUND","INTERLEAVED"],reservedTopLevelWordsNoIndent:[],stringTypes:['""',"''","``"],openParens:["("],closeParens:[")"],indexedPlaceholderTypes:["?"],namedPlaceholderTypes:["@","#","$"],lineCommentTypes:["--"]}));var Ae=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Te(e,t)}(T,e);var t,E,n,r=Re(T);function T(){return re(this,T),r.apply(this,arguments)}return t=T,(E=[{key:"tokenOverride",value:function(e){if(e.type===o.RESERVED_TOP_LEVEL&&"WINDOW"===e.value.toUpperCase())for(var t=this.tokenLookAhead(),E=0;E<t.length;E++)return t[E].type===o.OPEN_PAREN&&(e.type=o.RESERVED),e;if(e.type===o.CLOSE_PAREN&&"END"===e.value.toUpperCase())for(var n=this.tokenLookBack(),r=0;r<n.length;r++){var T=n[r];return T.type===o.OPERATOR&&"."===T.value&&(e.type=o.WORD),e}}}])&&oe(t.prototype,E),n&&oe(t,n),T}(y);function Oe(e){return(Oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ie(e,t){return(Ie=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Se(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var E,n=Le(e);if(t){var r=Le(this).constructor;E=Reflect.construct(n,arguments,r)}else E=n.apply(this,arguments);return ce(this,E)}}function ce(e,t){return!t||"object"!==Oe(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Le(e){return(Le=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,t,E){t in e?Object.defineProperty(e,t,{value:E,enumerable:!0,configurable:!0,writable:!0}):e[t]=E}(Ae,"tokenizer",new l({reservedWords:["ALL","ALTER","ANALYSE","ANALYZE","ARRAY_ZIP","ARRAY","AS","ASC","AVG","BETWEEN","CASCADE","CASE","CAST","COALESCE","COLLECT_LIST","COLLECT_SET","COLUMN","COLUMNS","COMMENT","CONSTRAINT","CONTAINS","CONVERT","COUNT","CUME_DIST","CURRENT ROW","CURRENT_DATE","CURRENT_TIMESTAMP","DATABASE","DATABASES","DATE_ADD","DATE_SUB","DATE_TRUNC","DAY_HOUR","DAY_MINUTE","DAY_SECOND","DAY","DAYS","DECODE","DEFAULT","DELETE","DENSE_RANK","DESC","DESCRIBE","DISTINCT","DISTINCTROW","DIV","DROP","ELSE","ENCODE","END","EXISTS","EXPLAIN","EXPLODE_OUTER","EXPLODE","FILTER","FIRST_VALUE","FIRST","FIXED","FLATTEN","FOLLOWING","FROM_UNIXTIME","FULL","GREATEST","GROUP_CONCAT","HOUR_MINUTE","HOUR_SECOND","HOUR","HOURS","IF","IFNULL","IN","INSERT","INTERVAL","INTO","IS","LAG","LAST_VALUE","LAST","LEAD","LEADING","LEAST","LEVEL","LIKE","MAX","MERGE","MIN","MINUTE_SECOND","MINUTE","MONTH","NATURAL","NOT","NOW()","NTILE","NULL","NULLIF","OFFSET","ON DELETE","ON UPDATE","ON","ONLY","OPTIMIZE","OVER","PERCENT_RANK","PRECEDING","RANGE","RANK","REGEXP","RENAME","RLIKE","ROW","ROWS","SECOND","SEPARATOR","SEQUENCE","SIZE","STRING","STRUCT","SUM","TABLE","TABLES","TEMPORARY","THEN","TO_DATE","TO_JSON","TO","TRAILING","TRANSFORM","TRUE","TRUNCATE","TYPE","TYPES","UNBOUNDED","UNIQUE","UNIX_TIMESTAMP","UNLOCK","UNSIGNED","USING","VARIABLES","VIEW","WHEN","WITH","YEAR_MONTH"],reservedTopLevelWords:["ADD","AFTER","ALTER COLUMN","ALTER DATABASE","ALTER SCHEMA","ALTER TABLE","CLUSTER BY","CLUSTERED BY","DELETE FROM","DISTRIBUTE BY","FROM","GROUP BY","HAVING","INSERT INTO","INSERT","LIMIT","OPTIONS","ORDER BY","PARTITION BY","PARTITIONED BY","RANGE","ROWS","SELECT","SET CURRENT SCHEMA","SET SCHEMA","SET","TBLPROPERTIES","UPDATE","USING","VALUES","WHERE","WINDOW"],reservedNewlineWords:["AND","ANTI JOIN","CREATE OR","CREATE","CROSS JOIN","ELSE","FULL OUTER JOIN","INNER JOIN","JOIN","LATERAL VIEW","LEFT ANTI JOIN","LEFT JOIN","LEFT OUTER JOIN","LEFT SEMI JOIN","NATURAL ANTI JOIN","NATURAL FULL OUTER JOIN","NATURAL INNER JOIN","NATURAL JOIN","NATURAL LEFT ANTI JOIN","NATURAL LEFT OUTER JOIN","NATURAL LEFT SEMI JOIN","NATURAL OUTER JOIN","NATURAL RIGHT OUTER JOIN","NATURAL RIGHT SEMI JOIN","NATURAL SEMI JOIN","OR","OUTER APPLY","OUTER JOIN","RIGHT JOIN","RIGHT OUTER JOIN","RIGHT SEMI JOIN","SEMI JOIN","WHEN","XOR"],reservedTopLevelWordsNoIndent:["EXCEPT ALL","EXCEPT","INTERSECT ALL","INTERSECT","UNION ALL","UNION"],stringTypes:['""',"''","``","{}"],openParens:["(","CASE"],closeParens:[")","END"],indexedPlaceholderTypes:["?"],namedPlaceholderTypes:["$"],lineCommentTypes:["--"]}));var ae=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ie(e,t)}(E,e);var t=Se(E);function E(){return ue(this,E),t.apply(this,arguments)}return E}(y);!function(e,t,E){t in e?Object.defineProperty(e,t,{value:E,enumerable:!0,configurable:!0,writable:!0}):e[t]=E}(ae,"tokenizer",new l({reservedWords:["ACCESSIBLE","ACTION","AGAINST","AGGREGATE","ALGORITHM","ALL","ALTER","ANALYSE","ANALYZE","AS","ASC","AUTOCOMMIT","AUTO_INCREMENT","BACKUP","BEGIN","BETWEEN","BINLOG","BOTH","CASCADE","CHANGE","CHANGED","CHARACTER SET","CHARSET","CHECK","CHECKSUM","COLLATE","COLLATION","COLUMN","COLUMNS","COMMENT","COMMIT","COMMITTED","COMPRESSED","CONCURRENT","CONSTRAINT","CONTAINS","CONVERT","CREATE","CROSS","CURRENT_TIMESTAMP","DATABASE","DATABASES","DAY","DAY_HOUR","DAY_MINUTE","DAY_SECOND","DEFAULT","DEFINER","DELAYED","DELETE","DESC","DESCRIBE","DETERMINISTIC","DISTINCT","DISTINCTROW","DIV","DO","DROP","DUMPFILE","DUPLICATE","DYNAMIC","ELSE","ENCLOSED","ENGINE","ENGINES","ENGINE_TYPE","ESCAPE","ESCAPED","EVENTS","EXEC","EXECUTE","EXISTS","EXPLAIN","EXTENDED","FAST","FETCH","FIELDS","FILE","FIRST","FIXED","FLUSH","FOR","FORCE","FOREIGN","FULL","FULLTEXT","FUNCTION","GLOBAL","GRANT","GRANTS","GROUP_CONCAT","HEAP","HIGH_PRIORITY","HOSTS","HOUR","HOUR_MINUTE","HOUR_SECOND","IDENTIFIED","IF","IFNULL","IGNORE","IN","INDEX","INDEXES","INFILE","INSERT","INSERT_ID","INSERT_METHOD","INTERVAL","INTO","INVOKER","IS","ISOLATION","KEY","KEYS","KILL","LAST_INSERT_ID","LEADING","LEVEL","LIKE","LINEAR","LINES","LOAD","LOCAL","LOCK","LOCKS","LOGS","LOW_PRIORITY","MARIA","MASTER","MASTER_CONNECT_RETRY","MASTER_HOST","MASTER_LOG_FILE","MATCH","MAX_CONNECTIONS_PER_HOUR","MAX_QUERIES_PER_HOUR","MAX_ROWS","MAX_UPDATES_PER_HOUR","MAX_USER_CONNECTIONS","MEDIUM","MERGE","MINUTE","MINUTE_SECOND","MIN_ROWS","MODE","MODIFY","MONTH","MRG_MYISAM","MYISAM","NAMES","NATURAL","NOT","NOW()","NULL","OFFSET","ON DELETE","ON UPDATE","ON","ONLY","OPEN","OPTIMIZE","OPTION","OPTIONALLY","OUTFILE","PACK_KEYS","PAGE","PARTIAL","PARTITION","PARTITIONS","PASSWORD","PRIMARY","PRIVILEGES","PROCEDURE","PROCESS","PROCESSLIST","PURGE","QUICK","RAID0","RAID_CHUNKS","RAID_CHUNKSIZE","RAID_TYPE","RANGE","READ","READ_ONLY","READ_WRITE","REFERENCES","REGEXP","RELOAD","RENAME","REPAIR","REPEATABLE","REPLACE","REPLICATION","RESET","RESTORE","RESTRICT","RETURN","RETURNS","REVOKE","RLIKE","ROLLBACK","ROW","ROWS","ROW_FORMAT","SECOND","SECURITY","SEPARATOR","SERIALIZABLE","SESSION","SHARE","SHOW","SHUTDOWN","SLAVE","SONAME","SOUNDS","SQL","SQL_AUTO_IS_NULL","SQL_BIG_RESULT","SQL_BIG_SELECTS","SQL_BIG_TABLES","SQL_BUFFER_RESULT","SQL_CACHE","SQL_CALC_FOUND_ROWS","SQL_LOG_BIN","SQL_LOG_OFF","SQL_LOG_UPDATE","SQL_LOW_PRIORITY_UPDATES","SQL_MAX_JOIN_SIZE","SQL_NO_CACHE","SQL_QUOTE_SHOW_CREATE","SQL_SAFE_UPDATES","SQL_SELECT_LIMIT","SQL_SLAVE_SKIP_COUNTER","SQL_SMALL_RESULT","SQL_WARNINGS","START","STARTING","STATUS","STOP","STORAGE","STRAIGHT_JOIN","STRING","STRIPED","SUPER","TABLE","TABLES","TEMPORARY","TERMINATED","THEN","TO","TRAILING","TRANSACTIONAL","TRUE","TRUNCATE","TYPE","TYPES","UNCOMMITTED","UNIQUE","UNLOCK","UNSIGNED","USAGE","USE","USING","VARIABLES","VIEW","WITH","WORK","WRITE","YEAR_MONTH"],reservedTopLevelWords:["ADD","AFTER","ALTER COLUMN","ALTER TABLE","CASE","DELETE FROM","END","EXCEPT","FETCH FIRST","FROM","GROUP BY","GO","HAVING","INSERT INTO","INSERT","LIMIT","MODIFY","ORDER BY","SELECT","SET CURRENT SCHEMA","SET SCHEMA","SET","UPDATE","VALUES","WHERE"],reservedNewlineWords:["AND","CROSS APPLY","CROSS JOIN","ELSE","INNER JOIN","JOIN","LEFT JOIN","LEFT OUTER JOIN","OR","OUTER APPLY","OUTER JOIN","RIGHT JOIN","RIGHT OUTER JOIN","WHEN","XOR"],reservedTopLevelWordsNoIndent:["INTERSECT","INTERSECT ALL","MINUS","UNION","UNION ALL"],stringTypes:['""',"N''","''","``","[]"],openParens:["(","CASE"],closeParens:[")","END"],indexedPlaceholderTypes:["?"],namedPlaceholderTypes:["@",":"],lineCommentTypes:["#","--"]}));var se=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(t.language){case"db2":return new G(t).format(e);case"n1ql":return new Y(t).format(e);case"pl/sql":return new Q(t).format(e);case"redshift":return new Ee(t).format(e);case"spark":return new Ae(t).format(e);case"sql":case void 0:return new ae(t).format(e);default:throw Error("Unsupported SQL dialect: ".concat(t.language))}};t.default={format:se}}])}));
!function(e,E){"object"==typeof exports&&"object"==typeof module?module.exports=E():"function"==typeof define&&define.amd?define([],E):"object"==typeof exports?exports.sqlFormatter=E():e.sqlFormatter=E()}(window,(function(){return function(e){var E={};function t(n){if(E[n])return E[n].exports;var T=E[n]={i:n,l:!1,exports:{}};return e[n].call(T.exports,T,T.exports,t),T.l=!0,T.exports}return t.m=e,t.c=E,t.d=function(e,E,n){t.o(e,E)||Object.defineProperty(e,E,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,E){if(1&E&&(e=t(e)),8&E)return e;if(4&E&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&E&&"string"!=typeof e)for(var T in e)t.d(n,T,function(E){return e[E]}.bind(null,T));return n},t.n=function(e){var E=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(E,"a",E),E},t.o=function(e,E){return Object.prototype.hasOwnProperty.call(e,E)},t.p="",t(t.s=0)}([function(e,E,t){"use strict";t.r(E),t.d(E,"format",(function(){return Oe}));var n={WHITESPACE:"whitespace",WORD:"word",STRING:"string",RESERVED:"reserved",RESERVED_TOP_LEVEL:"reserved-top-level",RESERVED_TOP_LEVEL_NO_INDENT:"reserved-top-level-no-indent",RESERVED_NEWLINE:"reserved-newline",OPERATOR:"operator",OPEN_PAREN:"open-paren",CLOSE_PAREN:"close-paren",LINE_COMMENT:"line-comment",BLOCK_COMMENT:"block-comment",NUMBER:"number",PLACEHOLDER:"placeholder"};function T(e,E){for(var t=0;t<E.length;t++){var n=E[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var r=function(){function e(E){!function(e,E){if(!(e instanceof E))throw new TypeError("Cannot call a class as a function")}(this,e),this.indent=E||" ",this.indentTypes=[]}var E,t,n;return E=e,(t=[{key:"getIndent",value:function(){return this.indent.repeat(this.indentTypes.length)}},{key:"increaseTopLevel",value:function(){this.indentTypes.push("top-level")}},{key:"increaseBlockLevel",value:function(){this.indentTypes.push("block-level")}},{key:"decreaseTopLevel",value:function(){this.indentTypes.length>0&&"top-level"===this.indentTypes[this.indentTypes.length-1]&&this.indentTypes.pop()}},{key:"decreaseBlockLevel",value:function(){for(;this.indentTypes.length>0&&"top-level"===this.indentTypes.pop(););}},{key:"resetIndentation",value:function(){this.indentTypes=[]}}])&&T(E.prototype,t),n&&T(E,n),e}();function R(e,E){for(var t=0;t<E.length;t++){var n=E[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var N=function(){function e(){!function(e,E){if(!(e instanceof E))throw new TypeError("Cannot call a class as a function")}(this,e),this.level=0}var E,t,T;return E=e,(t=[{key:"beginIfPossible",value:function(e,E){0===this.level&&this.isInlineBlock(e,E)?this.level=1:this.level>0?this.level++:this.level=0}},{key:"end",value:function(){this.level--}},{key:"isActive",value:function(){return this.level>0}},{key:"isInlineBlock",value:function(e,E){for(var t=0,T=0,r=E;r<e.length;r++){var R=e[r];if((t+=R.value.length)>50)return!1;if(R.type===n.OPEN_PAREN)T++;else if(R.type===n.CLOSE_PAREN&&0==--T)return!0;if(this.isForbiddenToken(R))return!1}return!1}},{key:"isForbiddenToken",value:function(e){var E=e.type,t=e.value;return E===n.RESERVED_TOP_LEVEL||E===n.RESERVED_NEWLINE||E===n.COMMENT||E===n.BLOCK_COMMENT||";"===t}}])&&R(E.prototype,t),T&&R(E,T),e}();function o(e,E){for(var t=0;t<E.length;t++){var n=E[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var A=function(){function e(E){!function(e,E){if(!(e instanceof E))throw new TypeError("Cannot call a class as a function")}(this,e),this.params=E,this.index=0}var E,t,n;return E=e,(t=[{key:"get",value:function(e){var E=e.key,t=e.value;return this.params?E?this.params[E]:this.params[this.index++]:t}}])&&o(E.prototype,t),n&&o(E,n),e}();function O(e,E){for(var t=0;t<E.length;t++){var n=E[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function I(e){return e.replace(/[\$\(-\+\.\?\[-\^\{-\}]/g,"\\$&")}var S=function(){function e(E){!function(e,E){if(!(e instanceof E))throw new TypeError("Cannot call a class as a function")}(this,e),this.WHITESPACE_REGEX=/^([\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]+)/,this.NUMBER_REGEX=/^((\x2D[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)?[0-9]+(\.[0-9]+)?([Ee]\x2D?[0-9]+(\.[0-9]+)?)?|0x[0-9A-Fa-f]+|0b[01]+)\b/,this.OPERATOR_REGEX=/^(!=|<<|>>|<>|==|<=|>=|!<|!>|\|\|\/|\|\/|\|\||::|\x2D>>|\x2D>|~~\*|~~|!~~\*|!~~|~\*|!~\*|!~|@|:=|(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))/,this.BLOCK_COMMENT_REGEX=/^(\/\*(?:[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?(?:\*\/|$))/,this.LINE_COMMENT_REGEX=this.createLineCommentRegex(E.lineCommentTypes),this.RESERVED_TOP_LEVEL_REGEX=this.createReservedWordRegex(E.reservedTopLevelWords),this.RESERVED_TOP_LEVEL_NO_INDENT_REGEX=this.createReservedWordRegex(E.reservedTopLevelWordsNoIndent),this.RESERVED_NEWLINE_REGEX=this.createReservedWordRegex(E.reservedNewlineWords),this.RESERVED_PLAIN_REGEX=this.createReservedWordRegex(E.reservedWords),this.WORD_REGEX=this.createWordRegex(E.specialWordChars),this.STRING_REGEX=this.createStringRegex(E.stringTypes),this.OPEN_PAREN_REGEX=this.createParenRegex(E.openParens),this.CLOSE_PAREN_REGEX=this.createParenRegex(E.closeParens),this.INDEXED_PLACEHOLDER_REGEX=this.createPlaceholderRegex(E.indexedPlaceholderTypes,"[0-9]*"),this.IDENT_NAMED_PLACEHOLDER_REGEX=this.createPlaceholderRegex(E.namedPlaceholderTypes,"[a-zA-Z0-9._$]+"),this.STRING_NAMED_PLACEHOLDER_REGEX=this.createPlaceholderRegex(E.namedPlaceholderTypes,this.createStringPattern(E.stringTypes))}var E,t,T;return E=e,(t=[{key:"createLineCommentRegex",value:function(e){return new RegExp("^((?:".concat(e.map((function(e){return I(e)})).join("|"),").*?(?:\r\n|\r|\n|$))"),"u")}},{key:"createReservedWordRegex",value:function(e){if(0===e.length)return new RegExp("^\b$","u");var E=(e=e.sort((function(e,E){return E.length-e.length||e.localeCompare(E)}))).join("|").replace(/ /g,"\\s+");return new RegExp("^(".concat(E,")\\b"),"iu")}},{key:"createWordRegex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return new RegExp("^([\\p{Alphabetic}\\p{Mark}\\p{Decimal_Number}\\p{Connector_Punctuation}\\p{Join_Control}".concat(e.join(""),"]+)"),"u")}},{key:"createStringRegex",value:function(e){return new RegExp("^("+this.createStringPattern(e)+")","u")}},{key:"createStringPattern",value:function(e){var E={"``":"((`[^`]*($|`))+)","{}":"((\\{[^\\}]*($|\\}))+)","[]":"((\\[[^\\]]*($|\\]))(\\][^\\]]*($|\\]))*)",'""':'(("[^"\\\\]*(?:\\\\.[^"\\\\]*)*("|$))+)',"''":"(('[^'\\\\]*(?:\\\\.[^'\\\\]*)*('|$))+)","N''":"((N'[^N'\\\\]*(?:\\\\.[^N'\\\\]*)*('|$))+)"};return e.map((function(e){return E[e]})).join("|")}},{key:"createParenRegex",value:function(e){var E=this;return new RegExp("^("+e.map((function(e){return E.escapeParen(e)})).join("|")+")","iu")}},{key:"escapeParen",value:function(e){return 1===e.length?I(e):"\\b"+e+"\\b"}},{key:"createPlaceholderRegex",value:function(e,E){if(t=e,!Array.isArray(t)||0===t.length)return!1;var t,n=e.map(I).join("|");return new RegExp("^((?:".concat(n,")(?:").concat(E,"))"),"u")}},{key:"tokenize",value:function(e){if(!e)return[];for(var E,t=[];e.length;)E=this.getNextToken(e,E),e=e.substring(E.value.length),t.push(E);return t}},{key:"getNextToken",value:function(e,E){return this.getWhitespaceToken(e)||this.getCommentToken(e)||this.getStringToken(e)||this.getOpenParenToken(e)||this.getCloseParenToken(e)||this.getPlaceholderToken(e)||this.getNumberToken(e)||this.getReservedWordToken(e,E)||this.getWordToken(e)||this.getOperatorToken(e)}},{key:"getWhitespaceToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:n.WHITESPACE,regex:this.WHITESPACE_REGEX})}},{key:"getCommentToken",value:function(e){return this.getLineCommentToken(e)||this.getBlockCommentToken(e)}},{key:"getLineCommentToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:n.LINE_COMMENT,regex:this.LINE_COMMENT_REGEX})}},{key:"getBlockCommentToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:n.BLOCK_COMMENT,regex:this.BLOCK_COMMENT_REGEX})}},{key:"getStringToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:n.STRING,regex:this.STRING_REGEX})}},{key:"getOpenParenToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:n.OPEN_PAREN,regex:this.OPEN_PAREN_REGEX})}},{key:"getCloseParenToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:n.CLOSE_PAREN,regex:this.CLOSE_PAREN_REGEX})}},{key:"getPlaceholderToken",value:function(e){return this.getIdentNamedPlaceholderToken(e)||this.getStringNamedPlaceholderToken(e)||this.getIndexedPlaceholderToken(e)}},{key:"getIdentNamedPlaceholderToken",value:function(e){return this.getPlaceholderTokenWithKey({input:e,regex:this.IDENT_NAMED_PLACEHOLDER_REGEX,parseKey:function(e){return e.slice(1)}})}},{key:"getStringNamedPlaceholderToken",value:function(e){var E=this;return this.getPlaceholderTokenWithKey({input:e,regex:this.STRING_NAMED_PLACEHOLDER_REGEX,parseKey:function(e){return E.getEscapedPlaceholderKey({key:e.slice(2,-1),quoteChar:e.slice(-1)})}})}},{key:"getIndexedPlaceholderToken",value:function(e){return this.getPlaceholderTokenWithKey({input:e,regex:this.INDEXED_PLACEHOLDER_REGEX,parseKey:function(e){return e.slice(1)}})}},{key:"getPlaceholderTokenWithKey",value:function(e){var E=e.input,t=e.regex,T=e.parseKey,r=this.getTokenOnFirstMatch({input:E,regex:t,type:n.PLACEHOLDER});return r&&(r.key=T(r.value)),r}},{key:"getEscapedPlaceholderKey",value:function(e){var E=e.key,t=e.quoteChar;return E.replace(new RegExp(I("\\"+t),"gu"),t)}},{key:"getNumberToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:n.NUMBER,regex:this.NUMBER_REGEX})}},{key:"getOperatorToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:n.OPERATOR,regex:this.OPERATOR_REGEX})}},{key:"getReservedWordToken",value:function(e,E){if(!E||!E.value||"."!==E.value)return this.getTopLevelReservedToken(e)||this.getNewlineReservedToken(e)||this.getTopLevelReservedTokenNoIndent(e)||this.getPlainReservedToken(e)}},{key:"getTopLevelReservedToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:n.RESERVED_TOP_LEVEL,regex:this.RESERVED_TOP_LEVEL_REGEX})}},{key:"getNewlineReservedToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:n.RESERVED_NEWLINE,regex:this.RESERVED_NEWLINE_REGEX})}},{key:"getTopLevelReservedTokenNoIndent",value:function(e){return this.getTokenOnFirstMatch({input:e,type:n.RESERVED_TOP_LEVEL_NO_INDENT,regex:this.RESERVED_TOP_LEVEL_NO_INDENT_REGEX})}},{key:"getPlainReservedToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:n.RESERVED,regex:this.RESERVED_PLAIN_REGEX})}},{key:"getWordToken",value:function(e){return this.getTokenOnFirstMatch({input:e,type:n.WORD,regex:this.WORD_REGEX})}},{key:"getTokenOnFirstMatch",value:function(e){var E=e.input,t=e.type,n=e.regex,T=E.match(n);if(T)return{type:t,value:T[1]}}}])&&O(E.prototype,t),T&&O(E,T),e}();function i(e,E){for(var t=0;t<E.length;t++){var n=E[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function L(e,E,t){return E in e?Object.defineProperty(e,E,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[E]=t,e}var u=function(e){return e.replace(/[\t ]+$/,"")},C=function(){function e(E){!function(e,E){if(!(e instanceof E))throw new TypeError("Cannot call a class as a function")}(this,e),this.cfg=E||{},this.indentation=new r(this.cfg.indent),this.inlineBlock=new N,this.params=new A(this.cfg.params),this.previousReservedToken={},this.tokens=[],this.index=0}var E,t,T;return E=e,(t=[{key:"tokenOverride",value:function(){}},{key:"format",value:function(e){return this.tokens=this.constructor.tokenizer.tokenize(e),this.getFormattedQueryFromTokens().trim()}},{key:"getFormattedQueryFromTokens",value:function(){var e=this,E="";return this.tokens.forEach((function(t,T){e.index=T,(t=e.tokenOverride(t)||t).type===n.WHITESPACE||(t.type===n.LINE_COMMENT?E=e.formatLineComment(t,E):t.type===n.BLOCK_COMMENT?E=e.formatBlockComment(t,E):t.type===n.RESERVED_TOP_LEVEL?(E=e.formatTopLevelReservedWord(t,E),e.previousReservedToken=t):t.type===n.RESERVED_TOP_LEVEL_NO_INDENT?(E=e.formatTopLevelReservedWordNoIndent(t,E),e.previousReservedToken=t):t.type===n.RESERVED_NEWLINE?(E=e.formatNewlineReservedWord(t,E),e.previousReservedToken=t):t.type===n.RESERVED?(E=e.formatWithSpaces(t,E),e.previousReservedToken=t):E=t.type===n.OPEN_PAREN?e.formatOpeningParentheses(t,E):t.type===n.CLOSE_PAREN?e.formatClosingParentheses(t,E):t.type===n.PLACEHOLDER?e.formatPlaceholder(t,E):","===t.value?e.formatComma(t,E):":"===t.value?e.formatWithSpaceAfter(t,E):"."===t.value?e.formatWithoutSpaces(t,E):";"===t.value?e.formatQuerySeparator(t,E):e.formatWithSpaces(t,E))})),E}},{key:"formatLineComment",value:function(e,E){return this.addNewline(E+e.value)}},{key:"formatBlockComment",value:function(e,E){return this.addNewline(this.addNewline(E)+this.indentComment(e.value))}},{key:"indentComment",value:function(e){return e.replace(/\n[\t ]*/g,"\n"+this.indentation.getIndent()+" ")}},{key:"formatTopLevelReservedWordNoIndent",value:function(e,E){return this.indentation.decreaseTopLevel(),E=this.addNewline(E)+this.equalizeWhitespace(this.formatReservedWord(e.value)),this.addNewline(E)}},{key:"formatTopLevelReservedWord",value:function(e,E){return this.indentation.decreaseTopLevel(),E=this.addNewline(E),this.indentation.increaseTopLevel(),E+=this.equalizeWhitespace(this.formatReservedWord(e.value)),this.addNewline(E)}},{key:"formatNewlineReservedWord",value:function(e,E){return this.addNewline(E)+this.equalizeWhitespace(this.formatReservedWord(e.value))+" "}},{key:"equalizeWhitespace",value:function(e){return e.replace(/[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]+/g," ")}},{key:"formatOpeningParentheses",value:function(e,E){var t;return(L(t={},n.WHITESPACE,!0),L(t,n.OPEN_PAREN,!0),L(t,n.LINE_COMMENT,!0),L(t,n.OPERATOR,!0),t)[this.previousToken().type]||(E=u(E)),E+=this.cfg.uppercase?e.value.toUpperCase():e.value,this.inlineBlock.beginIfPossible(this.tokens,this.index),this.inlineBlock.isActive()||(this.indentation.increaseBlockLevel(),E=this.addNewline(E)),E}},{key:"formatClosingParentheses",value:function(e,E){return e.value=this.cfg.uppercase?e.value.toUpperCase():e.value,this.inlineBlock.isActive()?(this.inlineBlock.end(),this.formatWithSpaceAfter(e,E)):(this.indentation.decreaseBlockLevel(),this.formatWithSpaces(e,this.addNewline(E)))}},{key:"formatPlaceholder",value:function(e,E){return E+this.params.get(e)+" "}},{key:"formatComma",value:function(e,E){return E=u(E)+e.value+" ",this.inlineBlock.isActive()||/^LIMIT$/i.test(this.previousReservedToken.value)?E:this.addNewline(E)}},{key:"formatWithSpaceAfter",value:function(e,E){return u(E)+e.value+" "}},{key:"formatWithoutSpaces",value:function(e,E){return u(E)+e.value}},{key:"formatWithSpaces",value:function(e,E){return E+("reserved"===e.type?this.formatReservedWord(e.value):e.value)+" "}},{key:"formatReservedWord",value:function(e){return this.cfg.uppercase?e.toUpperCase():e}},{key:"formatQuerySeparator",value:function(e,E){return this.indentation.resetIndentation(),u(E)+e.value+"\n".repeat(this.cfg.linesBetweenQueries||1)}},{key:"addNewline",value:function(e){return(e=u(e)).endsWith("\n")||(e+="\n"),e+this.indentation.getIndent()}},{key:"previousToken",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.tokens[this.index-e]||{}}},{key:"tokenLookBack",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,E=Math.max(0,this.index-e),t=this.index;return this.tokens.slice(E,t).reverse()}},{key:"tokenLookAhead",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,E=this.index+1,t=this.index+e+1;return this.tokens.slice(E,t)}}])&&i(E.prototype,t),T&&i(E,T),e}();function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,E){if(!(e instanceof E))throw new TypeError("Cannot call a class as a function")}function c(e,E){return(c=Object.setPrototypeOf||function(e,E){return e.__proto__=E,e})(e,E)}function l(e){var E=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,n=f(e);if(E){var T=f(this).constructor;t=Reflect.construct(n,arguments,T)}else t=n.apply(this,arguments);return D(this,t)}}function D(e,E){return!E||"object"!==a(E)&&"function"!=typeof E?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):E}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}L(C,"tokenizer",new S({reservedWords:[],reservedTopLevelWords:[],reservedNewlineWords:[],reservedTopLevelWordsNoIndent:[],stringTypes:[],openParens:[],closeParens:[],indexedPlaceholderTypes:[],namedPlaceholderTypes:[],lineCommentTypes:[],specialWordChars:[]}));var P,U,p,M=function(e){!function(e,E){if("function"!=typeof E&&null!==E)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(E&&E.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),E&&c(e,E)}(t,e);var E=l(t);function t(){return s(this,t),E.apply(this,arguments)}return t}(C);function y(e){return(y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function h(e,E){if(!(e instanceof E))throw new TypeError("Cannot call a class as a function")}function _(e,E){return(_=Object.setPrototypeOf||function(e,E){return e.__proto__=E,e})(e,E)}function d(e){var E=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,n=F(e);if(E){var T=F(this).constructor;t=Reflect.construct(n,arguments,T)}else t=n.apply(this,arguments);return v(this,t)}}function v(e,E){return!E||"object"!==y(E)&&"function"!=typeof E?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):E}function F(e){return(F=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}P=M,U="tokenizer",p=new S({reservedWords:["ABS","ACTIVATE","ALIAS","ALL","ALLOCATE","ALLOW","ALTER","ANY","ARE","ARRAY","AS","ASC","ASENSITIVE","ASSOCIATE","ASUTIME","ASYMMETRIC","AT","ATOMIC","ATTRIBUTES","AUDIT","AUTHORIZATION","AUX","AUXILIARY","AVG","BEFORE","BEGIN","BETWEEN","BIGINT","BINARY","BLOB","BOOLEAN","BOTH","BUFFERPOOL","BY","CACHE","CALL","CALLED","CAPTURE","CARDINALITY","CASCADED","CASE","CAST","CCSID","CEIL","CEILING","CHAR","CHARACTER","CHARACTER_LENGTH","CHAR_LENGTH","CHECK","CLOB","CLONE","CLOSE","CLUSTER","COALESCE","COLLATE","COLLECT","COLLECTION","COLLID","COLUMN","COMMENT","COMMIT","CONCAT","CONDITION","CONNECT","CONNECTION","CONSTRAINT","CONTAINS","CONTINUE","CONVERT","CORR","CORRESPONDING","COUNT","COUNT_BIG","COVAR_POP","COVAR_SAMP","CREATE","CROSS","CUBE","CUME_DIST","CURRENT","CURRENT_DATE","CURRENT_DEFAULT_TRANSFORM_GROUP","CURRENT_LC_CTYPE","CURRENT_PATH","CURRENT_ROLE","CURRENT_SCHEMA","CURRENT_SERVER","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_TIMEZONE","CURRENT_TRANSFORM_GROUP_FOR_TYPE","CURRENT_USER","CURSOR","CYCLE","DATA","DATABASE","DATAPARTITIONNAME","DATAPARTITIONNUM","DATE","DAY","DAYS","DB2GENERAL","DB2GENRL","DB2SQL","DBINFO","DBPARTITIONNAME","DBPARTITIONNUM","DEALLOCATE","DEC","DECIMAL","DECLARE","DEFAULT","DEFAULTS","DEFINITION","DELETE","DENSERANK","DENSE_RANK","DEREF","DESCRIBE","DESCRIPTOR","DETERMINISTIC","DIAGNOSTICS","DISABLE","DISALLOW","DISCONNECT","DISTINCT","DO","DOCUMENT","DOUBLE","DROP","DSSIZE","DYNAMIC","EACH","EDITPROC","ELEMENT","ELSE","ELSEIF","ENABLE","ENCODING","ENCRYPTION","END","END-EXEC","ENDING","ERASE","ESCAPE","EVERY","EXCEPTION","EXCLUDING","EXCLUSIVE","EXEC","EXECUTE","EXISTS","EXIT","EXP","EXPLAIN","EXTENDED","EXTERNAL","EXTRACT","FALSE","FENCED","FETCH","FIELDPROC","FILE","FILTER","FINAL","FIRST","FLOAT","FLOOR","FOR","FOREIGN","FREE","FULL","FUNCTION","FUSION","GENERAL","GENERATED","GET","GLOBAL","GOTO","GRANT","GRAPHIC","GROUP","GROUPING","HANDLER","HASH","HASHED_VALUE","HINT","HOLD","HOUR","HOURS","IDENTITY","IF","IMMEDIATE","IN","INCLUDING","INCLUSIVE","INCREMENT","INDEX","INDICATOR","INDICATORS","INF","INFINITY","INHERIT","INNER","INOUT","INSENSITIVE","INSERT","INT","INTEGER","INTEGRITY","INTERSECTION","INTERVAL","INTO","IS","ISOBID","ISOLATION","ITERATE","JAR","JAVA","KEEP","KEY","LABEL","LANGUAGE","LARGE","LATERAL","LC_CTYPE","LEADING","LEAVE","LEFT","LIKE","LINKTYPE","LN","LOCAL","LOCALDATE","LOCALE","LOCALTIME","LOCALTIMESTAMP","LOCATOR","LOCATORS","LOCK","LOCKMAX","LOCKSIZE","LONG","LOOP","LOWER","MAINTAINED","MATCH","MATERIALIZED","MAX","MAXVALUE","MEMBER","MERGE","METHOD","MICROSECOND","MICROSECONDS","MIN","MINUTE","MINUTES","MINVALUE","MOD","MODE","MODIFIES","MODULE","MONTH","MONTHS","MULTISET","NAN","NATIONAL","NATURAL","NCHAR","NCLOB","NEW","NEW_TABLE","NEXTVAL","NO","NOCACHE","NOCYCLE","NODENAME","NODENUMBER","NOMAXVALUE","NOMINVALUE","NONE","NOORDER","NORMALIZE","NORMALIZED","NOT","NULL","NULLIF","NULLS","NUMERIC","NUMPARTS","OBID","OCTET_LENGTH","OF","OFFSET","OLD","OLD_TABLE","ON","ONLY","OPEN","OPTIMIZATION","OPTIMIZE","OPTION","ORDER","OUT","OUTER","OVER","OVERLAPS","OVERLAY","OVERRIDING","PACKAGE","PADDED","PAGESIZE","PARAMETER","PART","PARTITION","PARTITIONED","PARTITIONING","PARTITIONS","PASSWORD","PATH","PERCENTILE_CONT","PERCENTILE_DISC","PERCENT_RANK","PIECESIZE","PLAN","POSITION","POWER","PRECISION","PREPARE","PREVVAL","PRIMARY","PRIQTY","PRIVILEGES","PROCEDURE","PROGRAM","PSID","PUBLIC","QUERY","QUERYNO","RANGE","RANK","READ","READS","REAL","RECOVERY","RECURSIVE","REF","REFERENCES","REFERENCING","REFRESH","REGR_AVGX","REGR_AVGY","REGR_COUNT","REGR_INTERCEPT","REGR_R2","REGR_SLOPE","REGR_SXX","REGR_SXY","REGR_SYY","RELEASE","RENAME","REPEAT","RESET","RESIGNAL","RESTART","RESTRICT","RESULT","RESULT_SET_LOCATOR","RETURN","RETURNS","REVOKE","RIGHT","ROLE","ROLLBACK","ROLLUP","ROUND_CEILING","ROUND_DOWN","ROUND_FLOOR","ROUND_HALF_DOWN","ROUND_HALF_EVEN","ROUND_HALF_UP","ROUND_UP","ROUTINE","ROW","ROWNUMBER","ROWS","ROWSET","ROW_NUMBER","RRN","RUN","SAVEPOINT","SCHEMA","SCOPE","SCRATCHPAD","SCROLL","SEARCH","SECOND","SECONDS","SECQTY","SECURITY","SENSITIVE","SEQUENCE","SESSION","SESSION_USER","SIGNAL","SIMILAR","SIMPLE","SMALLINT","SNAN","SOME","SOURCE","SPECIFIC","SPECIFICTYPE","SQL","SQLEXCEPTION","SQLID","SQLSTATE","SQLWARNING","SQRT","STACKED","STANDARD","START","STARTING","STATEMENT","STATIC","STATMENT","STAY","STDDEV_POP","STDDEV_SAMP","STOGROUP","STORES","STYLE","SUBMULTISET","SUBSTRING","SUM","SUMMARY","SYMMETRIC","SYNONYM","SYSFUN","SYSIBM","SYSPROC","SYSTEM","SYSTEM_USER","TABLE","TABLESAMPLE","TABLESPACE","THEN","TIME","TIMESTAMP","TIMEZONE_HOUR","TIMEZONE_MINUTE","TO","TRAILING","TRANSACTION","TRANSLATE","TRANSLATION","TREAT","TRIGGER","TRIM","TRUE","TRUNCATE","TYPE","UESCAPE","UNDO","UNIQUE","UNKNOWN","UNNEST","UNTIL","UPPER","USAGE","USER","USING","VALIDPROC","VALUE","VARCHAR","VARIABLE","VARIANT","VARYING","VAR_POP","VAR_SAMP","VCAT","VERSION","VIEW","VOLATILE","VOLUMES","WHEN","WHENEVER","WHILE","WIDTH_BUCKET","WINDOW","WITH","WITHIN","WITHOUT","WLM","WRITE","XMLELEMENT","XMLEXISTS","XMLNAMESPACES","YEAR","YEARS"],reservedTopLevelWords:["ADD","AFTER","ALTER COLUMN","ALTER TABLE","DELETE FROM","EXCEPT","FETCH FIRST","FROM","GROUP BY","GO","HAVING","INSERT INTO","INTERSECT","LIMIT","ORDER BY","SELECT","SET CURRENT SCHEMA","SET SCHEMA","SET","UPDATE","VALUES","WHERE"],reservedNewlineWords:["AND","CROSS JOIN","INNER JOIN","JOIN","LEFT JOIN","LEFT OUTER JOIN","OR","OUTER JOIN","RIGHT JOIN","RIGHT OUTER JOIN"],reservedTopLevelWordsNoIndent:["INTERSECT","INTERSECT ALL","MINUS","UNION","UNION ALL"],stringTypes:['""',"''","``","[]"],openParens:["("],closeParens:[")"],indexedPlaceholderTypes:["?"],namedPlaceholderTypes:[":"],lineCommentTypes:["--"],specialWordChars:["#","@"]}),U in P?Object.defineProperty(P,U,{value:p,enumerable:!0,configurable:!0,writable:!0}):P[U]=p;var G=function(e){!function(e,E){if("function"!=typeof E&&null!==E)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(E&&E.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),E&&_(e,E)}(t,e);var E=d(t);function t(){return h(this,t),E.apply(this,arguments)}return t}(C);function B(e){return(B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function H(e,E){if(!(e instanceof E))throw new TypeError("Cannot call a class as a function")}function g(e,E){for(var t=0;t<E.length;t++){var n=E[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function W(e,E){return(W=Object.setPrototypeOf||function(e,E){return e.__proto__=E,e})(e,E)}function m(e){var E=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,n=b(e);if(E){var T=b(this).constructor;t=Reflect.construct(n,arguments,T)}else t=n.apply(this,arguments);return Y(this,t)}}function Y(e,E){return!E||"object"!==B(E)&&"function"!=typeof E?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):E}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,E,t){E in e?Object.defineProperty(e,E,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[E]=t}(G,"tokenizer",new S({reservedWords:["ALL","ALTER","ANALYZE","AND","ANY","ARRAY","AS","ASC","BEGIN","BETWEEN","BINARY","BOOLEAN","BREAK","BUCKET","BUILD","BY","CALL","CASE","CAST","CLUSTER","COLLATE","COLLECTION","COMMIT","CONNECT","CONTINUE","CORRELATE","COVER","CREATE","DATABASE","DATASET","DATASTORE","DECLARE","DECREMENT","DELETE","DERIVED","DESC","DESCRIBE","DISTINCT","DO","DROP","EACH","ELEMENT","ELSE","END","EVERY","EXCEPT","EXCLUDE","EXECUTE","EXISTS","EXPLAIN","FALSE","FETCH","FIRST","FLATTEN","FOR","FORCE","FROM","FUNCTION","GRANT","GROUP","GSI","HAVING","IF","IGNORE","ILIKE","IN","INCLUDE","INCREMENT","INDEX","INFER","INLINE","INNER","INSERT","INTERSECT","INTO","IS","JOIN","KEY","KEYS","KEYSPACE","KNOWN","LAST","LEFT","LET","LETTING","LIKE","LIMIT","LSM","MAP","MAPPING","MATCHED","MATERIALIZED","MERGE","MISSING","NAMESPACE","NEST","NOT","NULL","NUMBER","OBJECT","OFFSET","ON","OPTION","OR","ORDER","OUTER","OVER","PARSE","PARTITION","PASSWORD","PATH","POOL","PREPARE","PRIMARY","PRIVATE","PRIVILEGE","PROCEDURE","PUBLIC","RAW","REALM","REDUCE","RENAME","RETURN","RETURNING","REVOKE","RIGHT","ROLE","ROLLBACK","SATISFIES","SCHEMA","SELECT","SELF","SEMI","SET","SHOW","SOME","START","STATISTICS","STRING","SYSTEM","THEN","TO","TRANSACTION","TRIGGER","TRUE","TRUNCATE","UNDER","UNION","UNIQUE","UNKNOWN","UNNEST","UNSET","UPDATE","UPSERT","USE","USER","USING","VALIDATE","VALUE","VALUED","VALUES","VIA","VIEW","WHEN","WHERE","WHILE","WITH","WITHIN","WORK","XOR"],reservedTopLevelWords:["DELETE FROM","EXCEPT ALL","EXCEPT","EXPLAIN DELETE FROM","EXPLAIN UPDATE","EXPLAIN UPSERT","FROM","GROUP BY","HAVING","INFER","INSERT INTO","LET","LIMIT","MERGE","NEST","ORDER BY","PREPARE","SELECT","SET CURRENT SCHEMA","SET SCHEMA","SET","UNNEST","UPDATE","UPSERT","USE KEYS","VALUES","WHERE"],reservedNewlineWords:["AND","INNER JOIN","JOIN","LEFT JOIN","LEFT OUTER JOIN","OR","OUTER JOIN","RIGHT JOIN","RIGHT OUTER JOIN","XOR"],reservedTopLevelWordsNoIndent:["INTERSECT","INTERSECT ALL","MINUS","UNION","UNION ALL"],stringTypes:['""',"''","``"],openParens:["(","[","{"],closeParens:[")","]","}"],namedPlaceholderTypes:["$"],lineCommentTypes:["#","--"]}));var k=function(e){!function(e,E){if("function"!=typeof E&&null!==E)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(E&&E.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),E&&W(e,E)}(R,e);var E,t,T,r=m(R);function R(){return H(this,R),r.apply(this,arguments)}return E=R,(t=[{key:"tokenOverride",value:function(e){if(e.type===n.RESERVED_TOP_LEVEL&&"SET"===e.value.toUpperCase()&&"BY"===this.previousReservedToken.value.toUpperCase())return e.type=n.RESERVED,e}}])&&g(E.prototype,t),T&&g(E,T),R}(C);function V(e){return(V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function X(e,E){if(!(e instanceof E))throw new TypeError("Cannot call a class as a function")}function w(e,E){return(w=Object.setPrototypeOf||function(e,E){return e.__proto__=E,e})(e,E)}function K(e){var E=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,n=J(e);if(E){var T=J(this).constructor;t=Reflect.construct(n,arguments,T)}else t=n.apply(this,arguments);return x(this,t)}}function x(e,E){return!E||"object"!==V(E)&&"function"!=typeof E?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):E}function J(e){return(J=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,E,t){E in e?Object.defineProperty(e,E,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[E]=t}(k,"tokenizer",new S({reservedWords:["A","ACCESSIBLE","AGENT","AGGREGATE","ALL","ALTER","ANY","ARRAY","AS","ASC","AT","ATTRIBUTE","AUTHID","AVG","BETWEEN","BFILE_BASE","BINARY_INTEGER","BINARY","BLOB_BASE","BLOCK","BODY","BOOLEAN","BOTH","BOUND","BREADTH","BULK","BY","BYTE","C","CALL","CALLING","CASCADE","CASE","CHAR_BASE","CHAR","CHARACTER","CHARSET","CHARSETFORM","CHARSETID","CHECK","CLOB_BASE","CLONE","CLOSE","CLUSTER","CLUSTERS","COALESCE","COLAUTH","COLLECT","COLUMNS","COMMENT","COMMIT","COMMITTED","COMPILED","COMPRESS","CONNECT","CONSTANT","CONSTRUCTOR","CONTEXT","CONTINUE","CONVERT","COUNT","CRASH","CREATE","CREDENTIAL","CURRENT","CURRVAL","CURSOR","CUSTOMDATUM","DANGLING","DATA","DATE_BASE","DATE","DAY","DECIMAL","DEFAULT","DEFINE","DELETE","DEPTH","DESC","DETERMINISTIC","DIRECTORY","DISTINCT","DO","DOUBLE","DROP","DURATION","ELEMENT","ELSIF","EMPTY","END","ESCAPE","EXCEPTIONS","EXCLUSIVE","EXECUTE","EXISTS","EXIT","EXTENDS","EXTERNAL","EXTRACT","FALSE","FETCH","FINAL","FIRST","FIXED","FLOAT","FOR","FORALL","FORCE","FROM","FUNCTION","GENERAL","GOTO","GRANT","GROUP","HASH","HEAP","HIDDEN","HOUR","IDENTIFIED","IF","IMMEDIATE","IN","INCLUDING","INDEX","INDEXES","INDICATOR","INDICES","INFINITE","INSTANTIABLE","INT","INTEGER","INTERFACE","INTERVAL","INTO","INVALIDATE","IS","ISOLATION","JAVA","LANGUAGE","LARGE","LEADING","LENGTH","LEVEL","LIBRARY","LIKE","LIKE2","LIKE4","LIKEC","LIMITED","LOCAL","LOCK","LONG","MAP","MAX","MAXLEN","MEMBER","MERGE","MIN","MINUTE","MLSLABEL","MOD","MODE","MONTH","MULTISET","NAME","NAN","NATIONAL","NATIVE","NATURAL","NATURALN","NCHAR","NEW","NEXTVAL","NOCOMPRESS","NOCOPY","NOT","NOWAIT","NULL","NULLIF","NUMBER_BASE","NUMBER","OBJECT","OCICOLL","OCIDATE","OCIDATETIME","OCIDURATION","OCIINTERVAL","OCILOBLOCATOR","OCINUMBER","OCIRAW","OCIREF","OCIREFCURSOR","OCIROWID","OCISTRING","OCITYPE","OF","OLD","ON","ONLY","OPAQUE","OPEN","OPERATOR","OPTION","ORACLE","ORADATA","ORDER","ORGANIZATION","ORLANY","ORLVARY","OTHERS","OUT","OVERLAPS","OVERRIDING","PACKAGE","PARALLEL_ENABLE","PARAMETER","PARAMETERS","PARENT","PARTITION","PASCAL","PCTFREE","PIPE","PIPELINED","PLS_INTEGER","PLUGGABLE","POSITIVE","POSITIVEN","PRAGMA","PRECISION","PRIOR","PRIVATE","PROCEDURE","PUBLIC","RAISE","RANGE","RAW","READ","REAL","RECORD","REF","REFERENCE","RELEASE","RELIES_ON","REM","REMAINDER","RENAME","RESOURCE","RESULT_CACHE","RESULT","RETURN","RETURNING","REVERSE","REVOKE","ROLLBACK","ROW","ROWID","ROWNUM","ROWTYPE","SAMPLE","SAVE","SAVEPOINT","SB1","SB2","SB4","SEARCH","SECOND","SEGMENT","SELF","SEPARATE","SEQUENCE","SERIALIZABLE","SHARE","SHORT","SIZE_T","SIZE","SMALLINT","SOME","SPACE","SPARSE","SQL","SQLCODE","SQLDATA","SQLERRM","SQLNAME","SQLSTATE","STANDARD","START","STATIC","STDDEV","STORED","STRING","STRUCT","STYLE","SUBMULTISET","SUBPARTITION","SUBSTITUTABLE","SUBTYPE","SUCCESSFUL","SUM","SYNONYM","SYSDATE","TABAUTH","TABLE","TDO","THE","THEN","TIME","TIMESTAMP","TIMEZONE_ABBR","TIMEZONE_HOUR","TIMEZONE_MINUTE","TIMEZONE_REGION","TO","TRAILING","TRANSACTION","TRANSACTIONAL","TRIGGER","TRUE","TRUSTED","TYPE","UB1","UB2","UB4","UID","UNDER","UNIQUE","UNPLUG","UNSIGNED","UNTRUSTED","USE","USER","USING","VALIDATE","VALIST","VALUE","VARCHAR","VARCHAR2","VARIABLE","VARIANCE","VARRAY","VARYING","VIEW","VIEWS","VOID","WHENEVER","WHILE","WITH","WORK","WRAPPED","WRITE","YEAR","ZONE"],reservedTopLevelWords:["ADD","ALTER COLUMN","ALTER TABLE","BEGIN","CONNECT BY","DECLARE","DELETE FROM","DELETE","END","EXCEPT","EXCEPTION","FETCH FIRST","FROM","GROUP BY","HAVING","INSERT INTO","INSERT","LIMIT","LOOP","MODIFY","ORDER BY","SELECT","SET CURRENT SCHEMA","SET SCHEMA","SET","START WITH","UPDATE","VALUES","WHERE"],reservedNewlineWords:["AND","CROSS APPLY","CROSS JOIN","ELSE","END","INNER JOIN","JOIN","LEFT JOIN","LEFT OUTER JOIN","OR","OUTER APPLY","OUTER JOIN","RIGHT JOIN","RIGHT OUTER JOIN","WHEN","XOR"],reservedTopLevelWordsNoIndent:["INTERSECT","INTERSECT ALL","MINUS","UNION","UNION ALL"],stringTypes:['""',"N''","''","``"],openParens:["(","CASE"],closeParens:[")","END"],indexedPlaceholderTypes:["?"],namedPlaceholderTypes:[":"],lineCommentTypes:["--"],specialWordChars:["_","$","#",".","@"]}));var j=function(e){!function(e,E){if("function"!=typeof E&&null!==E)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(E&&E.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),E&&w(e,E)}(t,e);var E=K(t);function t(){return X(this,t),E.apply(this,arguments)}return t}(C);function Q(e){return(Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Z(e,E){if(!(e instanceof E))throw new TypeError("Cannot call a class as a function")}function $(e,E){for(var t=0;t<E.length;t++){var n=E[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function z(e,E){return(z=Object.setPrototypeOf||function(e,E){return e.__proto__=E,e})(e,E)}function q(e){var E=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,n=Ee(e);if(E){var T=Ee(this).constructor;t=Reflect.construct(n,arguments,T)}else t=n.apply(this,arguments);return ee(this,t)}}function ee(e,E){return!E||"object"!==Q(E)&&"function"!=typeof E?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):E}function Ee(e){return(Ee=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,E,t){E in e?Object.defineProperty(e,E,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[E]=t}(j,"tokenizer",new S({reservedWords:["AES128","AES256","ALLOWOVERWRITE","ANALYSE","ARRAY","AS","ASC","AUTHORIZATION","BACKUP","BINARY","BLANKSASNULL","BOTH","BYTEDICT","BZIP2","CAST","CHECK","COLLATE","COLUMN","CONSTRAINT","CREATE","CREDENTIALS","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","CURRENT_USER_ID","DEFAULT","DEFERRABLE","DEFLATE","DEFRAG","DELTA","DELTA32K","DESC","DISABLE","DISTINCT","DO","ELSE","EMPTYASNULL","ENABLE","ENCODE","ENCRYPT","ENCRYPTION","END","EXPLICIT","FALSE","FOR","FOREIGN","FREEZE","FULL","GLOBALDICT256","GLOBALDICT64K","GRANT","GZIP","IDENTITY","IGNORE","ILIKE","INITIALLY","INTO","LEADING","LOCALTIME","LOCALTIMESTAMP","LUN","LUNS","LZO","LZOP","MINUS","MOSTLY13","MOSTLY32","MOSTLY8","NATURAL","NEW","NULLS","OFF","OFFLINE","OFFSET","OLD","ON","ONLY","OPEN","ORDER","OVERLAPS","PARALLEL","PARTITION","PERCENT","PERMISSIONS","PLACING","PRIMARY","RAW","READRATIO","RECOVER","REFERENCES","REJECTLOG","RESORT","RESTORE","SESSION_USER","SIMILAR","SYSDATE","SYSTEM","TABLE","TAG","TDES","TEXT255","TEXT32K","THEN","TIMESTAMP","TO","TOP","TRAILING","TRUE","TRUNCATECOLUMNS","UNIQUE","USER","USING","VERBOSE","WALLET","WHEN","WITH","WITHOUT","PREDICATE","COLUMNS","COMPROWS","COMPRESSION","COPY","FORMAT","DELIMITER","FIXEDWIDTH","AVRO","JSON","ENCRYPTED","BZIP2","GZIP","LZOP","PARQUET","ORC","ACCEPTANYDATE","ACCEPTINVCHARS","BLANKSASNULL","DATEFORMAT","EMPTYASNULL","ENCODING","ESCAPE","EXPLICIT_IDS","FILLRECORD","IGNOREBLANKLINES","IGNOREHEADER","NULL AS","REMOVEQUOTES","ROUNDEC","TIMEFORMAT","TRIMBLANKS","TRUNCATECOLUMNS","COMPROWS","COMPUPDATE","MAXERROR","NOLOAD","STATUPDATE","MANIFEST","REGION","IAM_ROLE","MASTER_SYMMETRIC_KEY","SSH","ACCEPTANYDATE","ACCEPTINVCHARS","ACCESS_KEY_ID","SECRET_ACCESS_KEY","AVRO","BLANKSASNULL","BZIP2","COMPROWS","COMPUPDATE","CREDENTIALS","DATEFORMAT","DELIMITER","EMPTYASNULL","ENCODING","ENCRYPTED","ESCAPE","EXPLICIT_IDS","FILLRECORD","FIXEDWIDTH","FORMAT","IAM_ROLE","GZIP","IGNOREBLANKLINES","IGNOREHEADER","JSON","LZOP","MANIFEST","MASTER_SYMMETRIC_KEY","MAXERROR","NOLOAD","NULL AS","READRATIO","REGION","REMOVEQUOTES","ROUNDEC","SSH","STATUPDATE","TIMEFORMAT","SESSION_TOKEN","TRIMBLANKS","TRUNCATECOLUMNS","EXTERNAL","DATA CATALOG","HIVE METASTORE","CATALOG_ROLE","VACUUM","COPY","UNLOAD","EVEN","ALL"],reservedTopLevelWords:["ADD","AFTER","ALTER COLUMN","ALTER TABLE","DELETE FROM","EXCEPT","FROM","GROUP BY","HAVING","INSERT INTO","INSERT","INTERSECT","TOP","LIMIT","MODIFY","ORDER BY","SELECT","SET CURRENT SCHEMA","SET SCHEMA","SET","UNION ALL","UNION","UPDATE","VALUES","WHERE","VACUUM","COPY","UNLOAD","ANALYZE","ANALYSE","DISTKEY","SORTKEY","COMPOUND","INTERLEAVED","FORMAT","DELIMITER","FIXEDWIDTH","AVRO","JSON","ENCRYPTED","BZIP2","GZIP","LZOP","PARQUET","ORC","ACCEPTANYDATE","ACCEPTINVCHARS","BLANKSASNULL","DATEFORMAT","EMPTYASNULL","ENCODING","ESCAPE","EXPLICIT_IDS","FILLRECORD","IGNOREBLANKLINES","IGNOREHEADER","NULL AS","REMOVEQUOTES","ROUNDEC","TIMEFORMAT","TRIMBLANKS","TRUNCATECOLUMNS","COMPROWS","COMPUPDATE","MAXERROR","NOLOAD","STATUPDATE","MANIFEST","REGION","IAM_ROLE","MASTER_SYMMETRIC_KEY","SSH","ACCEPTANYDATE","ACCEPTINVCHARS","ACCESS_KEY_ID","SECRET_ACCESS_KEY","AVRO","BLANKSASNULL","BZIP2","COMPROWS","COMPUPDATE","CREDENTIALS","DATEFORMAT","DELIMITER","EMPTYASNULL","ENCODING","ENCRYPTED","ESCAPE","EXPLICIT_IDS","FILLRECORD","FIXEDWIDTH","FORMAT","IAM_ROLE","GZIP","IGNOREBLANKLINES","IGNOREHEADER","JSON","LZOP","MANIFEST","MASTER_SYMMETRIC_KEY","MAXERROR","NOLOAD","NULL AS","READRATIO","REGION","REMOVEQUOTES","ROUNDEC","SSH","STATUPDATE","TIMEFORMAT","SESSION_TOKEN","TRIMBLANKS","TRUNCATECOLUMNS","EXTERNAL","DATA CATALOG","HIVE METASTORE","CATALOG_ROLE"],reservedNewlineWords:["AND","CROSS JOIN","ELSE","INNER JOIN","JOIN","LEFT JOIN","LEFT OUTER JOIN","OR","OUTER APPLY","OUTER JOIN","RIGHT JOIN","RIGHT OUTER JOIN","WHEN","VACUUM","COPY","UNLOAD","ANALYZE","ANALYSE","DISTKEY","SORTKEY","COMPOUND","INTERLEAVED"],reservedTopLevelWordsNoIndent:[],stringTypes:['""',"''","``"],openParens:["("],closeParens:[")"],indexedPlaceholderTypes:["?"],namedPlaceholderTypes:["@","#","$"],lineCommentTypes:["--"]}));var te=function(e){!function(e,E){if("function"!=typeof E&&null!==E)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(E&&E.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),E&&z(e,E)}(R,e);var E,t,T,r=q(R);function R(){return Z(this,R),r.apply(this,arguments)}return E=R,(t=[{key:"tokenOverride",value:function(e){if(e.type===n.RESERVED_TOP_LEVEL&&"WINDOW"===e.value.toUpperCase())for(var E=this.tokenLookAhead(),t=0;t<E.length;t++)return E[t].type===n.OPEN_PAREN&&(e.type=n.RESERVED),e;if(e.type===n.CLOSE_PAREN&&"END"===e.value.toUpperCase())for(var T=this.tokenLookBack(),r=0;r<T.length;r++){var R=T[r];return R.type===n.OPERATOR&&"."===R.value&&(e.type=n.WORD),e}}}])&&$(E.prototype,t),T&&$(E,T),R}(C);function ne(e){return(ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Te(e,E){if(!(e instanceof E))throw new TypeError("Cannot call a class as a function")}function re(e,E){return(re=Object.setPrototypeOf||function(e,E){return e.__proto__=E,e})(e,E)}function Re(e){var E=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,n=oe(e);if(E){var T=oe(this).constructor;t=Reflect.construct(n,arguments,T)}else t=n.apply(this,arguments);return Ne(this,t)}}function Ne(e,E){return!E||"object"!==ne(E)&&"function"!=typeof E?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):E}function oe(e){return(oe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,E,t){E in e?Object.defineProperty(e,E,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[E]=t}(te,"tokenizer",new S({reservedWords:["ALL","ALTER","ANALYSE","ANALYZE","ARRAY_ZIP","ARRAY","AS","ASC","AVG","BETWEEN","CASCADE","CASE","CAST","COALESCE","COLLECT_LIST","COLLECT_SET","COLUMN","COLUMNS","COMMENT","CONSTRAINT","CONTAINS","CONVERT","COUNT","CUME_DIST","CURRENT ROW","CURRENT_DATE","CURRENT_TIMESTAMP","DATABASE","DATABASES","DATE_ADD","DATE_SUB","DATE_TRUNC","DAY_HOUR","DAY_MINUTE","DAY_SECOND","DAY","DAYS","DECODE","DEFAULT","DELETE","DENSE_RANK","DESC","DESCRIBE","DISTINCT","DISTINCTROW","DIV","DROP","ELSE","ENCODE","END","EXISTS","EXPLAIN","EXPLODE_OUTER","EXPLODE","FILTER","FIRST_VALUE","FIRST","FIXED","FLATTEN","FOLLOWING","FROM_UNIXTIME","FULL","GREATEST","GROUP_CONCAT","HOUR_MINUTE","HOUR_SECOND","HOUR","HOURS","IF","IFNULL","IN","INSERT","INTERVAL","INTO","IS","LAG","LAST_VALUE","LAST","LEAD","LEADING","LEAST","LEVEL","LIKE","MAX","MERGE","MIN","MINUTE_SECOND","MINUTE","MONTH","NATURAL","NOT","NOW()","NTILE","NULL","NULLIF","OFFSET","ON DELETE","ON UPDATE","ON","ONLY","OPTIMIZE","OVER","PERCENT_RANK","PRECEDING","RANGE","RANK","REGEXP","RENAME","RLIKE","ROW","ROWS","SECOND","SEPARATOR","SEQUENCE","SIZE","STRING","STRUCT","SUM","TABLE","TABLES","TEMPORARY","THEN","TO_DATE","TO_JSON","TO","TRAILING","TRANSFORM","TRUE","TRUNCATE","TYPE","TYPES","UNBOUNDED","UNIQUE","UNIX_TIMESTAMP","UNLOCK","UNSIGNED","USING","VARIABLES","VIEW","WHEN","WITH","YEAR_MONTH"],reservedTopLevelWords:["ADD","AFTER","ALTER COLUMN","ALTER DATABASE","ALTER SCHEMA","ALTER TABLE","CLUSTER BY","CLUSTERED BY","DELETE FROM","DISTRIBUTE BY","FROM","GROUP BY","HAVING","INSERT INTO","INSERT","LIMIT","OPTIONS","ORDER BY","PARTITION BY","PARTITIONED BY","RANGE","ROWS","SELECT","SET CURRENT SCHEMA","SET SCHEMA","SET","TBLPROPERTIES","UPDATE","USING","VALUES","WHERE","WINDOW"],reservedNewlineWords:["AND","ANTI JOIN","CREATE OR","CREATE","CROSS JOIN","ELSE","FULL OUTER JOIN","INNER JOIN","JOIN","LATERAL VIEW","LEFT ANTI JOIN","LEFT JOIN","LEFT OUTER JOIN","LEFT SEMI JOIN","NATURAL ANTI JOIN","NATURAL FULL OUTER JOIN","NATURAL INNER JOIN","NATURAL JOIN","NATURAL LEFT ANTI JOIN","NATURAL LEFT OUTER JOIN","NATURAL LEFT SEMI JOIN","NATURAL OUTER JOIN","NATURAL RIGHT OUTER JOIN","NATURAL RIGHT SEMI JOIN","NATURAL SEMI JOIN","OR","OUTER APPLY","OUTER JOIN","RIGHT JOIN","RIGHT OUTER JOIN","RIGHT SEMI JOIN","SEMI JOIN","WHEN","XOR"],reservedTopLevelWordsNoIndent:["EXCEPT ALL","EXCEPT","INTERSECT ALL","INTERSECT","UNION ALL","UNION"],stringTypes:['""',"''","``","{}"],openParens:["(","CASE"],closeParens:[")","END"],indexedPlaceholderTypes:["?"],namedPlaceholderTypes:["$"],lineCommentTypes:["--"]}));var Ae=function(e){!function(e,E){if("function"!=typeof E&&null!==E)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(E&&E.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),E&&re(e,E)}(t,e);var E=Re(t);function t(){return Te(this,t),E.apply(this,arguments)}return t}(C);!function(e,E,t){E in e?Object.defineProperty(e,E,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[E]=t}(Ae,"tokenizer",new S({reservedWords:["ACCESSIBLE","ACTION","AGAINST","AGGREGATE","ALGORITHM","ALL","ALTER","ANALYSE","ANALYZE","AS","ASC","AUTOCOMMIT","AUTO_INCREMENT","BACKUP","BEGIN","BETWEEN","BINLOG","BOTH","CASCADE","CHANGE","CHANGED","CHARACTER SET","CHARSET","CHECK","CHECKSUM","COLLATE","COLLATION","COLUMN","COLUMNS","COMMENT","COMMIT","COMMITTED","COMPRESSED","CONCURRENT","CONSTRAINT","CONTAINS","CONVERT","CREATE","CROSS","CURRENT_TIMESTAMP","DATABASE","DATABASES","DAY","DAY_HOUR","DAY_MINUTE","DAY_SECOND","DEFAULT","DEFINER","DELAYED","DELETE","DESC","DESCRIBE","DETERMINISTIC","DISTINCT","DISTINCTROW","DIV","DO","DROP","DUMPFILE","DUPLICATE","DYNAMIC","ELSE","ENCLOSED","ENGINE","ENGINES","ENGINE_TYPE","ESCAPE","ESCAPED","EVENTS","EXEC","EXECUTE","EXISTS","EXPLAIN","EXTENDED","FAST","FETCH","FIELDS","FILE","FIRST","FIXED","FLUSH","FOR","FORCE","FOREIGN","FULL","FULLTEXT","FUNCTION","GLOBAL","GRANT","GRANTS","GROUP_CONCAT","HEAP","HIGH_PRIORITY","HOSTS","HOUR","HOUR_MINUTE","HOUR_SECOND","IDENTIFIED","IF","IFNULL","IGNORE","IN","INDEX","INDEXES","INFILE","INSERT","INSERT_ID","INSERT_METHOD","INTERVAL","INTO","INVOKER","IS","ISOLATION","KEY","KEYS","KILL","LAST_INSERT_ID","LEADING","LEVEL","LIKE","LINEAR","LINES","LOAD","LOCAL","LOCK","LOCKS","LOGS","LOW_PRIORITY","MARIA","MASTER","MASTER_CONNECT_RETRY","MASTER_HOST","MASTER_LOG_FILE","MATCH","MAX_CONNECTIONS_PER_HOUR","MAX_QUERIES_PER_HOUR","MAX_ROWS","MAX_UPDATES_PER_HOUR","MAX_USER_CONNECTIONS","MEDIUM","MERGE","MINUTE","MINUTE_SECOND","MIN_ROWS","MODE","MODIFY","MONTH","MRG_MYISAM","MYISAM","NAMES","NATURAL","NOT","NOW()","NULL","OFFSET","ON DELETE","ON UPDATE","ON","ONLY","OPEN","OPTIMIZE","OPTION","OPTIONALLY","OUTFILE","PACK_KEYS","PAGE","PARTIAL","PARTITION","PARTITIONS","PASSWORD","PRIMARY","PRIVILEGES","PROCEDURE","PROCESS","PROCESSLIST","PURGE","QUICK","RAID0","RAID_CHUNKS","RAID_CHUNKSIZE","RAID_TYPE","RANGE","READ","READ_ONLY","READ_WRITE","REFERENCES","REGEXP","RELOAD","RENAME","REPAIR","REPEATABLE","REPLACE","REPLICATION","RESET","RESTORE","RESTRICT","RETURN","RETURNS","REVOKE","RLIKE","ROLLBACK","ROW","ROWS","ROW_FORMAT","SECOND","SECURITY","SEPARATOR","SERIALIZABLE","SESSION","SHARE","SHOW","SHUTDOWN","SLAVE","SONAME","SOUNDS","SQL","SQL_AUTO_IS_NULL","SQL_BIG_RESULT","SQL_BIG_SELECTS","SQL_BIG_TABLES","SQL_BUFFER_RESULT","SQL_CACHE","SQL_CALC_FOUND_ROWS","SQL_LOG_BIN","SQL_LOG_OFF","SQL_LOG_UPDATE","SQL_LOW_PRIORITY_UPDATES","SQL_MAX_JOIN_SIZE","SQL_NO_CACHE","SQL_QUOTE_SHOW_CREATE","SQL_SAFE_UPDATES","SQL_SELECT_LIMIT","SQL_SLAVE_SKIP_COUNTER","SQL_SMALL_RESULT","SQL_WARNINGS","START","STARTING","STATUS","STOP","STORAGE","STRAIGHT_JOIN","STRING","STRIPED","SUPER","TABLE","TABLES","TEMPORARY","TERMINATED","THEN","TO","TRAILING","TRANSACTIONAL","TRUE","TRUNCATE","TYPE","TYPES","UNCOMMITTED","UNIQUE","UNLOCK","UNSIGNED","USAGE","USE","USING","VARIABLES","VIEW","WITH","WORK","WRITE","YEAR_MONTH"],reservedTopLevelWords:["ADD","AFTER","ALTER COLUMN","ALTER TABLE","CASE","DELETE FROM","END","EXCEPT","FETCH FIRST","FROM","GROUP BY","GO","HAVING","INSERT INTO","INSERT","LIMIT","MODIFY","ORDER BY","SELECT","SET CURRENT SCHEMA","SET SCHEMA","SET","UPDATE","VALUES","WHERE"],reservedNewlineWords:["AND","CROSS APPLY","CROSS JOIN","ELSE","INNER JOIN","JOIN","LEFT JOIN","LEFT OUTER JOIN","OR","OUTER APPLY","OUTER JOIN","RIGHT JOIN","RIGHT OUTER JOIN","WHEN","XOR"],reservedTopLevelWordsNoIndent:["INTERSECT","INTERSECT ALL","MINUS","UNION","UNION ALL"],stringTypes:['""',"N''","''","``","[]"],openParens:["(","CASE"],closeParens:[")","END"],indexedPlaceholderTypes:["?"],namedPlaceholderTypes:["@",":"],lineCommentTypes:["#","--"]}));var Oe=function(e){var E=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(E.language){case"db2":return new M(E).format(e);case"n1ql":return new G(E).format(e);case"pl/sql":return new k(E).format(e);case"redshift":return new j(E).format(e);case"spark":return new te(E).format(e);case"sql":case void 0:return new Ae(E).format(e);default:throw Error("Unsupported SQL dialect: ".concat(E.language))}};E.default={format:Oe}}])}));

@@ -8,4 +8,2 @@ "use strict";

var _includes = _interopRequireDefault(require("lodash/includes"));
var _tokenTypes = _interopRequireDefault(require("./tokenTypes"));

@@ -183,7 +181,9 @@

value: function formatOpeningParentheses(token, query) {
var _preserveWhitespaceFo;
// Take out the preceding space unless there was whitespace there in the original query
// or another opening parens or line comment
var preserveWhitespaceFor = [_tokenTypes["default"].WHITESPACE, _tokenTypes["default"].OPEN_PAREN, _tokenTypes["default"].LINE_COMMENT, _tokenTypes["default"].OPERATOR];
var preserveWhitespaceFor = (_preserveWhitespaceFo = {}, _defineProperty(_preserveWhitespaceFo, _tokenTypes["default"].WHITESPACE, true), _defineProperty(_preserveWhitespaceFo, _tokenTypes["default"].OPEN_PAREN, true), _defineProperty(_preserveWhitespaceFo, _tokenTypes["default"].LINE_COMMENT, true), _defineProperty(_preserveWhitespaceFo, _tokenTypes["default"].OPERATOR, true), _preserveWhitespaceFo);
if (!(0, _includes["default"])(preserveWhitespaceFor, this.previousToken().type)) {
if (!preserveWhitespaceFor[this.previousToken().type]) {
query = trimSpacesEnd(query);

@@ -190,0 +190,0 @@ }

@@ -8,8 +8,2 @@ "use strict";

var _repeat = _interopRequireDefault(require("lodash/repeat"));
var _last = _interopRequireDefault(require("lodash/last"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -51,3 +45,3 @@

value: function getIndent() {
return (0, _repeat["default"])(this.indent, this.indentTypes.length);
return this.indent.repeat(this.indentTypes.length);
}

@@ -80,3 +74,3 @@ /**

value: function decreaseTopLevel() {
if ((0, _last["default"])(this.indentTypes) === INDENT_TYPE_TOP_LEVEL) {
if (this.indentTypes.length > 0 && this.indentTypes[this.indentTypes.length - 1] === INDENT_TYPE_TOP_LEVEL) {
this.indentTypes.pop();

@@ -83,0 +77,0 @@ }

@@ -8,6 +8,2 @@ "use strict";

var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
var _escapeRegExp = _interopRequireDefault(require("lodash/escapeRegExp"));
var _tokenTypes = _interopRequireDefault(require("./tokenTypes"));

@@ -23,2 +19,10 @@

function isEmpty(arr) {
return !Array.isArray(arr) || arr.length === 0;
}
function escapeRegExp(string) {
return string.replace(/[\$\(-\+\.\?\[-\^\{-\}]/g, '\\$&');
}
var Tokenizer = /*#__PURE__*/function () {

@@ -64,3 +68,3 @@ /**

return new RegExp("^((?:".concat(lineCommentTypes.map(function (c) {
return (0, _escapeRegExp["default"])(c);
return escapeRegExp(c);
}).join('|'), ").*?(?:\r\n|\r|\n|$))"), 'u');

@@ -124,3 +128,3 @@ }

// A single punctuation character
return (0, _escapeRegExp["default"])(paren);
return escapeRegExp(paren);
} else {

@@ -134,7 +138,7 @@ // longer word

value: function createPlaceholderRegex(types, pattern) {
if ((0, _isEmpty["default"])(types)) {
if (isEmpty(types)) {
return false;
}
var typesRegex = types.map(_escapeRegExp["default"]).join('|');
var typesRegex = types.map(escapeRegExp).join('|');
return new RegExp("^((?:".concat(typesRegex, ")(?:").concat(pattern, "))"), 'u');

@@ -299,3 +303,3 @@ }

quoteChar = _ref2.quoteChar;
return key.replace(new RegExp((0, _escapeRegExp["default"])('\\' + quoteChar), 'gu'), quoteChar);
return key.replace(new RegExp(escapeRegExp('\\' + quoteChar), 'gu'), quoteChar);
} // Decimal, binary, or hex numbers

@@ -302,0 +306,0 @@

{
"name": "@gwax/sql-formatter",
"version": "3.0.0-alpha.0",
"description": "Formats whitespaces in a SQL query to make it more readable",
"version": "3.0.0-alpha.1",
"description": "Format whitespace in a SQL query to make it more readable",
"license": "MIT",

@@ -12,2 +12,4 @@ "main": "lib/sqlFormatter.js",

"n1ql",
"redshift",
"spark",
"whitespace"

@@ -35,5 +37,5 @@ ],

"build:commonjs": "babel src --out-dir lib",
"build:umd": "webpack --mode=\"development\" --output=\"dist/sql-formatter.js\" src/sqlFormatter.js",
"build:umd:min": "webpack --mode=\"production\" --output=\"dist/sql-formatter.min.js\" src/sqlFormatter.js",
"prepublish": "npm run clean && npm run check && npm run build"
"build:umd": "webpack --mode=\"development\"",
"build:umd:min": "webpack --mode=\"production\"",
"prepare": "npm run clean && npm run check && npm run build"
},

@@ -47,5 +49,2 @@ "repository": {

},
"dependencies": {
"lodash": "^4.17.15"
},
"devDependencies": {

@@ -52,0 +51,0 @@ "@babel/cli": "^7.10.4",

@@ -1,9 +0,15 @@

# SQL Formatter [![NPM version](https://img.shields.io/npm/v/sql-formatter.svg)](https://npmjs.com/package/sql-formatter) [![Build Status](https://travis-ci.org/zeroturnaround/sql-formatter.svg?branch=master)](https://travis-ci.org/zeroturnaround/sql-formatter) [![Coverage Status](https://coveralls.io/repos/github/zeroturnaround/sql-formatter/badge.svg?branch=master)](https://coveralls.io/github/zeroturnaround/sql-formatter?branch=master)
# SQL Formatter [![NPM version](https://img.shields.io/npm/v/@gwax/sql-formatter.svg)](https://npmjs.com/package/@gwax/sql-formatter) [![Build Status](https://travis-ci.com/gwax/sql-formatter.svg?branch=master)](https://travis-ci.com/gwax/sql-formatter) [![Coverage Status](https://coveralls.io/repos/github/gwax/sql-formatter/badge.svg?branch=master)](https://coveralls.io/github/gwax/sql-formatter?branch=master)
**SQL Formatter** is a JavaScript library for pretty-printing SQL queries.
It started as a port of a [PHP Library][], but has since considerably diverged.
It supports [Standard SQL][], [Couchbase N1QL][], [IBM DB2][] and [Oracle PL/SQL][] dialects.
It started as a Javascript port of a [PHP Library][], but has diverged
considerably, and been forked/joined multiple times in the past. The current
formatter (@gwax/sql-formatter) forked from [zeroturnaround/sql-formatter](https://github.com/zeroturnaround/sql-formatter)
with code consolidated from [kufii/sql-formatter-plus](https://github.com/kufii/sql-formatter-plus)
and a number of other forks scattered around GitHub.
&rarr; [Try the demo.](https://zeroturnaround.github.io/sql-formatter/)
SQL Formatter supports [Standard SQL][], [Couchbase N1QL][], [IBM DB2][],
[Oracle PL/SQL][], [Amazon Redshift][], and [Spark][] dialects.
&rarr; [Try the demo.](https://gwax.github.io/sql-formatter/)
## Install

@@ -20,3 +26,3 @@

```js
import sqlFormatter from 'sql-formatter';
import sqlFormatter from '@gwax/sql-formatter';

@@ -28,3 +34,3 @@ console.log(sqlFormatter.format('SELECT * FROM table1'));

```
```sql
SELECT

@@ -45,3 +51,3 @@ *

Currently just four SQL dialects are supported:
Currently just six SQL dialects are supported:

@@ -52,2 +58,4 @@ - **sql** - [Standard SQL][]

- **pl/sql** - [Oracle PL/SQL][]
- **redshift** - [Amazon Redshift][]
- **spark** - [Spark][]

@@ -58,10 +66,10 @@ ### Placeholders replacement

// Named placeholders
sqlFormatter.format("SELECT * FROM tbl WHERE foo = @foo", {
params: {foo: "'bar'"}
}));
sqlFormatter.format('SELECT * FROM tbl WHERE foo = @foo', {
params: { foo: "'bar'" },
});
// Indexed placeholders
sqlFormatter.format("SELECT * FROM tbl WHERE foo = ?", {
params: ["'bar'"]
}));
sqlFormatter.format('SELECT * FROM tbl WHERE foo = ?', {
params: ["'bar'"],
});
```

@@ -71,3 +79,3 @@

```
```sql
SELECT

@@ -97,3 +105,3 @@ *

[MIT](https://github.com/zeroturnaround/sql-formatter/blob/master/LICENSE)
[MIT](https://github.com/gwax/sql-formatter/blob/master/LICENSE)

@@ -105,1 +113,3 @@ [php library]: https://github.com/jdorn/sql-formatter

[oracle pl/sql]: http://www.oracle.com/technetwork/database/features/plsql/index.html
[amazon redshift]: https://docs.aws.amazon.com/redshift/latest/dg/cm_chap_SQLCommandRef.html
[spark]: https://spark.apache.org/docs/latest/api/sql/index.html

@@ -1,2 +0,1 @@

import includes from 'lodash/includes';
import tokenTypes from './tokenTypes';

@@ -165,9 +164,9 @@ import Indentation from './Indentation';

// or another opening parens or line comment
const preserveWhitespaceFor = [
tokenTypes.WHITESPACE,
tokenTypes.OPEN_PAREN,
tokenTypes.LINE_COMMENT,
tokenTypes.OPERATOR,
];
if (!includes(preserveWhitespaceFor, this.previousToken().type)) {
const preserveWhitespaceFor = {
[tokenTypes.WHITESPACE]: true,
[tokenTypes.OPEN_PAREN]: true,
[tokenTypes.LINE_COMMENT]: true,
[tokenTypes.OPERATOR]: true,
};
if (!preserveWhitespaceFor[this.previousToken().type]) {
query = trimSpacesEnd(query);

@@ -174,0 +173,0 @@ }

@@ -1,4 +0,1 @@

import repeat from 'lodash/repeat';
import last from 'lodash/last';
const INDENT_TYPE_TOP_LEVEL = 'top-level';

@@ -29,3 +26,3 @@ const INDENT_TYPE_BLOCK_LEVEL = 'block-level';

getIndent() {
return repeat(this.indent, this.indentTypes.length);
return this.indent.repeat(this.indentTypes.length);
}

@@ -52,3 +49,6 @@

decreaseTopLevel() {
if (last(this.indentTypes) === INDENT_TYPE_TOP_LEVEL) {
if (
this.indentTypes.length > 0 &&
this.indentTypes[this.indentTypes.length - 1] === INDENT_TYPE_TOP_LEVEL
) {
this.indentTypes.pop();

@@ -55,0 +55,0 @@ }

@@ -1,5 +0,11 @@

import isEmpty from 'lodash/isEmpty';
import escapeRegExp from 'lodash/escapeRegExp';
import tokenTypes from './tokenTypes';
function isEmpty(arr) {
return !Array.isArray(arr) || arr.length === 0;
}
function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
}
export default class Tokenizer {

@@ -6,0 +12,0 @@ /**

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc