solorice/vscodium/extensions/mechatroner.rainbow-csv-2.3.0/dist/web/test/suite/index.js
Kristofers Solo 314bc1f53f Minor changes
2022-05-04 23:29:01 +03:00

2 lines
130 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*! For license information please see index.js.LICENSE.txt */
(()=>{var __webpack_modules__={9282:(e,t,r)=>{"use strict";var n=r(4155);function i(e){return i="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},i(e)}var o,a,s=r(2136).codes,l=s.ERR_AMBIGUOUS_ARGUMENT,c=s.ERR_INVALID_ARG_TYPE,u=s.ERR_INVALID_ARG_VALUE,p=s.ERR_INVALID_RETURN_VALUE,_=s.ERR_MISSING_ARGS,f=r(5961),h=r(9539).inspect,d=r(9539).types,g=d.isPromise,y=d.isRegExp,m=Object.assign?Object.assign:r(8091).assign,b=Object.is?Object.is:r(609);function w(){var e=r(9158);o=e.isDeepEqual,a=e.isDeepStrictEqual}new Map;var x=!1,v=e.exports=S,E={};function O(e){if(e.message instanceof Error)throw e.message;throw new f(e)}function j(e,t,r,n){if(!r){var i=!1;if(0===t)i=!0,n="No value argument passed to `assert.ok()`";else if(n instanceof Error)throw n;var o=new f({actual:r,expected:!0,message:n,operator:"==",stackStartFn:e});throw o.generatedMessage=i,o}}function S(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];j.apply(void 0,[S,t.length].concat(t))}v.fail=function e(t,r,i,o,a){var s,l=arguments.length;if(0===l)s="Failed";else if(1===l)i=t,t=void 0;else{if(!1===x){x=!0;var c=n.emitWarning?n.emitWarning:console.warn.bind(console);c("assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.","DeprecationWarning","DEP0094")}2===l&&(o="!=")}if(i instanceof Error)throw i;var u={actual:t,expected:r,operator:void 0===o?"fail":o,stackStartFn:a||e};void 0!==i&&(u.message=i);var p=new f(u);throw s&&(p.message=s,p.generatedMessage=!0),p},v.AssertionError=f,v.ok=S,v.equal=function e(t,r,n){if(arguments.length<2)throw new _("actual","expected");t!=r&&O({actual:t,expected:r,message:n,operator:"==",stackStartFn:e})},v.notEqual=function e(t,r,n){if(arguments.length<2)throw new _("actual","expected");t==r&&O({actual:t,expected:r,message:n,operator:"!=",stackStartFn:e})},v.deepEqual=function e(t,r,n){if(arguments.length<2)throw new _("actual","expected");void 0===o&&w(),o(t,r)||O({actual:t,expected:r,message:n,operator:"deepEqual",stackStartFn:e})},v.notDeepEqual=function e(t,r,n){if(arguments.length<2)throw new _("actual","expected");void 0===o&&w(),o(t,r)&&O({actual:t,expected:r,message:n,operator:"notDeepEqual",stackStartFn:e})},v.deepStrictEqual=function e(t,r,n){if(arguments.length<2)throw new _("actual","expected");void 0===o&&w(),a(t,r)||O({actual:t,expected:r,message:n,operator:"deepStrictEqual",stackStartFn:e})},v.notDeepStrictEqual=function e(t,r,n){if(arguments.length<2)throw new _("actual","expected");void 0===o&&w(),a(t,r)&&O({actual:t,expected:r,message:n,operator:"notDeepStrictEqual",stackStartFn:e})},v.strictEqual=function e(t,r,n){if(arguments.length<2)throw new _("actual","expected");b(t,r)||O({actual:t,expected:r,message:n,operator:"strictEqual",stackStartFn:e})},v.notStrictEqual=function e(t,r,n){if(arguments.length<2)throw new _("actual","expected");b(t,r)&&O({actual:t,expected:r,message:n,operator:"notStrictEqual",stackStartFn:e})};var R=function e(t,r,n){var i=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r.forEach((function(e){e in t&&(void 0!==n&&"string"==typeof n[e]&&y(t[e])&&t[e].test(n[e])?i[e]=n[e]:i[e]=t[e])}))};function A(e,t,r,n,i,o){if(!(r in e)||!a(e[r],t[r])){if(!n){var s=new R(e,i),l=new R(t,i,e),c=new f({actual:s,expected:l,operator:"deepStrictEqual",stackStartFn:o});throw c.actual=e,c.expected=t,c.operator=o.name,c}O({actual:e,expected:t,message:n,operator:o.name,stackStartFn:o})}}function q(e,t,r,n){if("function"!=typeof t){if(y(t))return t.test(e);if(2===arguments.length)throw new c("expected",["Function","RegExp"],t);if("object"!==i(e)||null===e){var a=new f({actual:e,expected:t,message:r,operator:"deepStrictEqual",stackStartFn:n});throw a.operator=n.name,a}var s=Object.keys(t);if(t instanceof Error)s.push("name","message");else if(0===s.length)throw new u("error",t,"may not be an empty object");return void 0===o&&w(),s.forEach((function(i){"string"==typeof e[i]&&y(t[i])&&t[i].test(e[i])||A(e,t,i,r,s,n)})),!0}return void 0!==t.prototype&&e instanceof t||!Error.isPrototypeOf(t)&&!0===t.call({},e)}function T(e){if("function"!=typeof e)throw new c("fn","Function",e);try{e()}catch(e){return e}return E}function k(e){return g(e)||null!==e&&"object"===i(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function P(e){return Promise.resolve().then((function(){var t;if("function"==typeof e){if(!k(t=e()))throw new p("instance of Promise","promiseFn",t)}else{if(!k(e))throw new c("promiseFn",["Function","Promise"],e);t=e}return Promise.resolve().then((function(){return t})).then((function(){return E})).catch((function(e){return e}))}))}function I(e,t,r,n){if("string"==typeof r){if(4===arguments.length)throw new c("error",["Object","Error","Function","RegExp"],r);if("object"===i(t)&&null!==t){if(t.message===r)throw new l("error/message",'The error message "'.concat(t.message,'" is identical to the message.'))}else if(t===r)throw new l("error/message",'The error "'.concat(t,'" is identical to the message.'));n=r,r=void 0}else if(null!=r&&"object"!==i(r)&&"function"!=typeof r)throw new c("error",["Object","Error","Function","RegExp"],r);if(t===E){var o="";r&&r.name&&(o+=" (".concat(r.name,")")),o+=n?": ".concat(n):".";var a="rejects"===e.name?"rejection":"exception";O({actual:void 0,expected:r,operator:e.name,message:"Missing expected ".concat(a).concat(o),stackStartFn:e})}if(r&&!q(t,r,n,e))throw t}function N(e,t,r,n){if(t!==E){if("string"==typeof r&&(n=r,r=void 0),!r||q(t,r)){var i=n?": ".concat(n):".",o="doesNotReject"===e.name?"rejection":"exception";O({actual:t,expected:r,operator:e.name,message:"Got unwanted ".concat(o).concat(i,"\n")+'Actual message: "'.concat(t&&t.message,'"'),stackStartFn:e})}throw t}}function L(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];j.apply(void 0,[L,t.length].concat(t))}v.throws=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];I.apply(void 0,[e,T(t)].concat(n))},v.rejects=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return P(t).then((function(t){return I.apply(void 0,[e,t].concat(n))}))},v.doesNotThrow=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];N.apply(void 0,[e,T(t)].concat(n))},v.doesNotReject=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return P(t).then((function(t){return N.apply(void 0,[e,t].concat(n))}))},v.ifError=function e(t){if(null!=t){var r="ifError got unwanted exception: ";"object"===i(t)&&"string"==typeof t.message?0===t.message.length&&t.constructor?r+=t.constructor.name:r+=t.message:r+=h(t);var n=new f({actual:t,expected:null,operator:"ifError",message:r,stackStartFn:e}),o=t.stack;if("string"==typeof o){var a=o.split("\n");a.shift();for(var s=n.stack.split("\n"),l=0;l<a.length;l++){var c=s.indexOf(a[l]);if(-1!==c){s=s.slice(0,c);break}}n.stack="".concat(s.join("\n"),"\n").concat(a.join("\n"))}throw n}},v.strict=m(L,v,{equal:v.strictEqual,deepEqual:v.deepStrictEqual,notEqual:v.notStrictEqual,notDeepEqual:v.notDeepStrictEqual}),v.strict.strict=v.strict},5961:(e,t,r)=>{"use strict";var n=r(4155);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t){return!t||"object"!==f(t)&&"function"!=typeof t?s(e):t}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){var t="function"==typeof Map?new Map:void 0;return l=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return u(e,arguments,_(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),p(n,e)},l(e)}function c(){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}}function u(e,t,r){return u=c()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&p(i,r.prototype),i},u.apply(null,arguments)}function p(e,t){return p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},p(e,t)}function _(e){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},_(e)}function f(e){return f="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},f(e)}var h=r(9539).inspect,d=r(2136).codes.ERR_INVALID_ARG_TYPE;function g(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}var y="",m="",b="",w="",x={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"};function v(e){var t=Object.keys(e),r=Object.create(Object.getPrototypeOf(e));return t.forEach((function(t){r[t]=e[t]})),Object.defineProperty(r,"message",{value:e.message}),r}function E(e){return h(e,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}var O=function(e){function t(e){var r;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),"object"!==f(e)||null===e)throw new d("options","Object",e);var i=e.message,o=e.operator,l=e.stackStartFn,c=e.actual,u=e.expected,p=Error.stackTraceLimit;if(Error.stackTraceLimit=0,null!=i)r=a(this,_(t).call(this,String(i)));else if(n.stderr&&n.stderr.isTTY&&(n.stderr&&n.stderr.getColorDepth&&1!==n.stderr.getColorDepth()?(y="",m="",w="",b=""):(y="",m="",w="",b="")),"object"===f(c)&&null!==c&&"object"===f(u)&&null!==u&&"stack"in c&&c instanceof Error&&"stack"in u&&u instanceof Error&&(c=v(c),u=v(u)),"deepStrictEqual"===o||"strictEqual"===o)r=a(this,_(t).call(this,function(e,t,r){var i="",o="",a=0,s="",l=!1,c=E(e),u=c.split("\n"),p=E(t).split("\n"),_=0,h="";if("strictEqual"===r&&"object"===f(e)&&"object"===f(t)&&null!==e&&null!==t&&(r="strictEqualObject"),1===u.length&&1===p.length&&u[0]!==p[0]){var d=u[0].length+p[0].length;if(d<=10){if(!("object"===f(e)&&null!==e||"object"===f(t)&&null!==t||0===e&&0===t))return"".concat(x[r],"\n\n")+"".concat(u[0]," !== ").concat(p[0],"\n")}else if("strictEqualObject"!==r&&d<(n.stderr&&n.stderr.isTTY?n.stderr.columns:80)){for(;u[0][_]===p[0][_];)_++;_>2&&(h="\n ".concat(function(e,t){if(t=Math.floor(t),0==e.length||0==t)return"";var r=e.length*t;for(t=Math.floor(Math.log(t)/Math.log(2));t;)e+=e,t--;return e+e.substring(0,r-e.length)}(" ",_),"^"),_=0)}}for(var v=u[u.length-1],O=p[p.length-1];v===O&&(_++<2?s="\n ".concat(v).concat(s):i=v,u.pop(),p.pop(),0!==u.length&&0!==p.length);)v=u[u.length-1],O=p[p.length-1];var j=Math.max(u.length,p.length);if(0===j){var S=c.split("\n");if(S.length>30)for(S[26]="".concat(y,"...").concat(w);S.length>27;)S.pop();return"".concat(x.notIdentical,"\n\n").concat(S.join("\n"),"\n")}_>3&&(s="\n".concat(y,"...").concat(w).concat(s),l=!0),""!==i&&(s="\n ".concat(i).concat(s),i="");var R=0,A=x[r]+"\n".concat(m,"+ actual").concat(w," ").concat(b,"- expected").concat(w),q=" ".concat(y,"...").concat(w," Lines skipped");for(_=0;_<j;_++){var T=_-a;if(u.length<_+1)T>1&&_>2&&(T>4?(o+="\n".concat(y,"...").concat(w),l=!0):T>3&&(o+="\n ".concat(p[_-2]),R++),o+="\n ".concat(p[_-1]),R++),a=_,i+="\n".concat(b,"-").concat(w," ").concat(p[_]),R++;else if(p.length<_+1)T>1&&_>2&&(T>4?(o+="\n".concat(y,"...").concat(w),l=!0):T>3&&(o+="\n ".concat(u[_-2]),R++),o+="\n ".concat(u[_-1]),R++),a=_,o+="\n".concat(m,"+").concat(w," ").concat(u[_]),R++;else{var k=p[_],P=u[_],I=P!==k&&(!g(P,",")||P.slice(0,-1)!==k);I&&g(k,",")&&k.slice(0,-1)===P&&(I=!1,P+=","),I?(T>1&&_>2&&(T>4?(o+="\n".concat(y,"...").concat(w),l=!0):T>3&&(o+="\n ".concat(u[_-2]),R++),o+="\n ".concat(u[_-1]),R++),a=_,o+="\n".concat(m,"+").concat(w," ").concat(P),i+="\n".concat(b,"-").concat(w," ").concat(k),R+=2):(o+=i,i="",1!==T&&0!==_||(o+="\n ".concat(P),R++))}if(R>20&&_<j-2)return"".concat(A).concat(q,"\n").concat(o,"\n").concat(y,"...").concat(w).concat(i,"\n")+"".concat(y,"...").concat(w)}return"".concat(A).concat(l?q:"","\n").concat(o).concat(i).concat(s).concat(h)}(c,u,o)));else if("notDeepStrictEqual"===o||"notStrictEqual"===o){var h=x[o],O=E(c).split("\n");if("notStrictEqual"===o&&"object"===f(c)&&null!==c&&(h=x.notStrictEqualObject),O.length>30)for(O[26]="".concat(y,"...").concat(w);O.length>27;)O.pop();r=1===O.length?a(this,_(t).call(this,"".concat(h," ").concat(O[0]))):a(this,_(t).call(this,"".concat(h,"\n\n").concat(O.join("\n"),"\n")))}else{var j=E(c),S="",R=x[o];"notDeepEqual"===o||"notEqual"===o?(j="".concat(x[o],"\n\n").concat(j)).length>1024&&(j="".concat(j.slice(0,1021),"...")):(S="".concat(E(u)),j.length>512&&(j="".concat(j.slice(0,509),"...")),S.length>512&&(S="".concat(S.slice(0,509),"...")),"deepEqual"===o||"equal"===o?j="".concat(R,"\n\n").concat(j,"\n\nshould equal\n\n"):S=" ".concat(o," ").concat(S)),r=a(this,_(t).call(this,"".concat(j).concat(S)))}return Error.stackTraceLimit=p,r.generatedMessage=!i,Object.defineProperty(s(r),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),r.code="ERR_ASSERTION",r.actual=c,r.expected=u,r.operator=o,Error.captureStackTrace&&Error.captureStackTrace(s(r),l),r.stack,r.name="AssertionError",a(r)}var r,l;return 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&&p(e,t)}(t,e),r=t,l=[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:h.custom,value:function(e,t){return h(this,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){i(e,t,r[t])}))}return e}({},t,{customInspect:!1,depth:0}))}}],l&&o(r.prototype,l),t}(l(Error));e.exports=O},2136:(e,t,r)=>{"use strict";function n(e){return n="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},n(e)}function i(e){return i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},i(e)}function o(e,t){return o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},o(e,t)}var a,s,l={};function c(e,t,r){r||(r=Error);var a=function(r){function a(r,o,s){var l,c,u;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),c=this,u=i(a).call(this,function(e,r,n){return"string"==typeof t?t:t(e,r,n)}(r,o,s)),l=!u||"object"!==n(u)&&"function"!=typeof u?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(c):u,l.code=e,l}return 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&&o(e,t)}(a,r),a}(r);l[e]=a}function u(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}c("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),c("ERR_INVALID_ARG_TYPE",(function(e,t,i){var o,s,l,c,p;if(void 0===a&&(a=r(9282)),a("string"==typeof e,"'name' must be a string"),"string"==typeof t&&(s="not ",t.substr(0,s.length)===s)?(o="must not be",t=t.replace(/^not /,"")):o="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))l="The ".concat(e," ").concat(o," ").concat(u(t,"type"));else{var _=("number"!=typeof p&&(p=0),p+".".length>(c=e).length||-1===c.indexOf(".",p)?"argument":"property");l='The "'.concat(e,'" ').concat(_," ").concat(o," ").concat(u(t,"type"))}return l+". Received type ".concat(n(i))}),TypeError),c("ERR_INVALID_ARG_VALUE",(function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"is invalid";void 0===s&&(s=r(9539));var i=s.inspect(t);return i.length>128&&(i="".concat(i.slice(0,128),"...")),"The argument '".concat(e,"' ").concat(n,". Received ").concat(i)}),TypeError,RangeError),c("ERR_INVALID_RETURN_VALUE",(function(e,t,r){var i;return i=r&&r.constructor&&r.constructor.name?"instance of ".concat(r.constructor.name):"type ".concat(n(r)),"Expected ".concat(e,' to be returned from the "').concat(t,'"')+" function but got ".concat(i,".")}),TypeError),c("ERR_MISSING_ARGS",(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];void 0===a&&(a=r(9282)),a(t.length>0,"At least one arg needs to be specified");var i="The ",o=t.length;switch(t=t.map((function(e){return'"'.concat(e,'"')})),o){case 1:i+="".concat(t[0]," argument");break;case 2:i+="".concat(t[0]," and ").concat(t[1]," arguments");break;default:i+=t.slice(0,o-1).join(", "),i+=", and ".concat(t[o-1]," arguments")}return"".concat(i," must be specified")}),TypeError),e.exports.codes=l},9158:(e,t,r)=>{"use strict";function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function i(e){return i="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},i(e)}var o=void 0!==/a/g.flags,a=function(e){var t=[];return e.forEach((function(e){return t.push(e)})),t},s=function(e){var t=[];return e.forEach((function(e,r){return t.push([r,e])})),t},l=Object.is?Object.is:r(609),c=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols:function(){return[]},u=Number.isNaN?Number.isNaN:r(360);function p(e){return e.call.bind(e)}var _=p(Object.prototype.hasOwnProperty),f=p(Object.prototype.propertyIsEnumerable),h=p(Object.prototype.toString),d=r(9539).types,g=d.isAnyArrayBuffer,y=d.isArrayBufferView,m=d.isDate,b=d.isMap,w=d.isRegExp,x=d.isSet,v=d.isNativeError,E=d.isBoxedPrimitive,O=d.isNumberObject,j=d.isStringObject,S=d.isBooleanObject,R=d.isBigIntObject,A=d.isSymbolObject,q=d.isFloat32Array,T=d.isFloat64Array;function k(e){if(0===e.length||e.length>10)return!0;for(var t=0;t<e.length;t++){var r=e.charCodeAt(t);if(r<48||r>57)return!0}return 10===e.length&&e>=Math.pow(2,32)}function P(e){return Object.keys(e).filter(k).concat(c(e).filter(Object.prototype.propertyIsEnumerable.bind(e)))}function I(e,t){if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0}function N(e,t,r,n){if(e===t)return 0!==e||!r||l(e,t);if(r){if("object"!==i(e))return"number"==typeof e&&u(e)&&u(t);if("object"!==i(t)||null===e||null===t)return!1;if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1}else{if(null===e||"object"!==i(e))return(null===t||"object"!==i(t))&&e==t;if(null===t||"object"!==i(t))return!1}var a,s,c,p,_=h(e);if(_!==h(t))return!1;if(Array.isArray(e)){if(e.length!==t.length)return!1;var f=P(e),d=P(t);return f.length===d.length&&U(e,t,r,n,1,f)}if("[object Object]"===_&&(!b(e)&&b(t)||!x(e)&&x(t)))return!1;if(m(e)){if(!m(t)||Date.prototype.getTime.call(e)!==Date.prototype.getTime.call(t))return!1}else if(w(e)){if(!w(t)||(c=e,p=t,!(o?c.source===p.source&&c.flags===p.flags:RegExp.prototype.toString.call(c)===RegExp.prototype.toString.call(p))))return!1}else if(v(e)||e instanceof Error){if(e.message!==t.message||e.name!==t.name)return!1}else{if(y(e)){if(r||!q(e)&&!T(e)){if(!function(e,t){return e.byteLength===t.byteLength&&0===I(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}(e,t))return!1}else if(!function(e,t){if(e.byteLength!==t.byteLength)return!1;for(var r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}(e,t))return!1;var k=P(e),N=P(t);return k.length===N.length&&U(e,t,r,n,0,k)}if(x(e))return!(!x(t)||e.size!==t.size)&&U(e,t,r,n,2);if(b(e))return!(!b(t)||e.size!==t.size)&&U(e,t,r,n,3);if(g(e)){if(s=t,(a=e).byteLength!==s.byteLength||0!==I(new Uint8Array(a),new Uint8Array(s)))return!1}else if(E(e)&&!function(e,t){return O(e)?O(t)&&l(Number.prototype.valueOf.call(e),Number.prototype.valueOf.call(t)):j(e)?j(t)&&String.prototype.valueOf.call(e)===String.prototype.valueOf.call(t):S(e)?S(t)&&Boolean.prototype.valueOf.call(e)===Boolean.prototype.valueOf.call(t):R(e)?R(t)&&BigInt.prototype.valueOf.call(e)===BigInt.prototype.valueOf.call(t):A(t)&&Symbol.prototype.valueOf.call(e)===Symbol.prototype.valueOf.call(t)}(e,t))return!1}return U(e,t,r,n,0)}function L(e,t){return t.filter((function(t){return f(e,t)}))}function U(e,t,r,n,i,o){if(5===arguments.length){o=Object.keys(e);var a=Object.keys(t);if(o.length!==a.length)return!1}for(var s=0;s<o.length;s++)if(!_(t,o[s]))return!1;if(r&&5===arguments.length){var l=c(e);if(0!==l.length){var u=0;for(s=0;s<l.length;s++){var p=l[s];if(f(e,p)){if(!f(t,p))return!1;o.push(p),u++}else if(f(t,p))return!1}var h=c(t);if(l.length!==h.length&&L(t,h).length!==u)return!1}else{var d=c(t);if(0!==d.length&&0!==L(t,d).length)return!1}}if(0===o.length&&(0===i||1===i&&0===e.length||0===e.size))return!0;if(void 0===n)n={val1:new Map,val2:new Map,position:0};else{var g=n.val1.get(e);if(void 0!==g){var y=n.val2.get(t);if(void 0!==y)return g===y}n.position++}n.val1.set(e,n.position),n.val2.set(t,n.position);var m=F(e,t,r,o,n,i);return n.val1.delete(e),n.val2.delete(t),m}function C(e,t,r,n){for(var i=a(e),o=0;o<i.length;o++){var s=i[o];if(N(t,s,r,n))return e.delete(s),!0}return!1}function $(e){switch(i(e)){case"undefined":return null;case"object":return;case"symbol":return!1;case"string":e=+e;case"number":if(u(e))return!1}return!0}function B(e,t,r){var n=$(r);return null!=n?n:t.has(n)&&!e.has(n)}function D(e,t,r,n,i){var o=$(r);if(null!=o)return o;var a=t.get(o);return!(void 0===a&&!t.has(o)||!N(n,a,!1,i))&&!e.has(o)&&N(n,a,!1,i)}function M(e,t,r,n,i,o){for(var s=a(e),l=0;l<s.length;l++){var c=s[l];if(N(r,c,i,o)&&N(n,t.get(c),i,o))return e.delete(c),!0}return!1}function F(e,t,r,o,l,c){var u=0;if(2===c){if(!function(e,t,r,n){for(var o=null,s=a(e),l=0;l<s.length;l++){var c=s[l];if("object"===i(c)&&null!==c)null===o&&(o=new Set),o.add(c);else if(!t.has(c)){if(r)return!1;if(!B(e,t,c))return!1;null===o&&(o=new Set),o.add(c)}}if(null!==o){for(var u=a(t),p=0;p<u.length;p++){var _=u[p];if("object"===i(_)&&null!==_){if(!C(o,_,r,n))return!1}else if(!r&&!e.has(_)&&!C(o,_,r,n))return!1}return 0===o.size}return!0}(e,t,r,l))return!1}else if(3===c){if(!function(e,t,r,o){for(var a=null,l=s(e),c=0;c<l.length;c++){var u=n(l[c],2),p=u[0],_=u[1];if("object"===i(p)&&null!==p)null===a&&(a=new Set),a.add(p);else{var f=t.get(p);if(void 0===f&&!t.has(p)||!N(_,f,r,o)){if(r)return!1;if(!D(e,t,p,_,o))return!1;null===a&&(a=new Set),a.add(p)}}}if(null!==a){for(var h=s(t),d=0;d<h.length;d++){var g=n(h[d],2),y=(p=g[0],g[1]);if("object"===i(p)&&null!==p){if(!M(a,e,p,y,r,o))return!1}else if(!(r||e.has(p)&&N(e.get(p),y,!1,o)||M(a,e,p,y,!1,o)))return!1}return 0===a.size}return!0}(e,t,r,l))return!1}else if(1===c)for(;u<e.length;u++){if(!_(e,u)){if(_(t,u))return!1;for(var p=Object.keys(e);u<p.length;u++){var f=p[u];if(!_(t,f)||!N(e[f],t[f],r,l))return!1}return p.length===Object.keys(t).length}if(!_(t,u)||!N(e[u],t[u],r,l))return!1}for(u=0;u<o.length;u++){var h=o[u];if(!N(e[h],t[h],r,l))return!1}return!0}e.exports={isDeepEqual:function(e,t){return N(e,t,!1)},isDeepStrictEqual:function(e,t){return N(e,t,!0)}}},1924:(e,t,r)=>{"use strict";var n=r(210),i=r(5559),o=i(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"==typeof r&&o(e,".prototype.")>-1?i(r):r}},5559:(e,t,r)=>{"use strict";var n=r(8612),i=r(210),o=i("%Function.prototype.apply%"),a=i("%Function.prototype.call%"),s=i("%Reflect.apply%",!0)||n.call(a,o),l=i("%Object.getOwnPropertyDescriptor%",!0),c=i("%Object.defineProperty%",!0),u=i("%Math.max%");if(c)try{c({},"a",{value:1})}catch(e){c=null}e.exports=function(e){var t=s(n,a,arguments);if(l&&c){var r=l(t,"length");r.configurable&&c(t,"length",{value:1+u(0,e.length-(arguments.length-1))})}return t};var p=function(){return s(n,o,arguments)};c?c(e.exports,"apply",{value:p}):e.exports.apply=p},4289:(e,t,r)=>{"use strict";var n=r(2215),i="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,a=Array.prototype.concat,s=Object.defineProperty,l=r(1044)(),c=s&&l,u=function(e,t,r,n){var i;(!(t in e)||"function"==typeof(i=n)&&"[object Function]"===o.call(i)&&n())&&(c?s(e,t,{configurable:!0,enumerable:!1,value:r,writable:!0}):e[t]=r)},p=function(e,t){var r=arguments.length>2?arguments[2]:{},o=n(t);i&&(o=a.call(o,Object.getOwnPropertySymbols(t)));for(var s=0;s<o.length;s+=1)u(e,o[s],t[o[s]],r[o[s]])};p.supportsDescriptors=!!c,e.exports=p},8091:e=>{"use strict";function t(e,t){if(null==e)throw new TypeError("Cannot convert first argument to object");for(var r=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var o=Object.keys(Object(i)),a=0,s=o.length;a<s;a++){var l=o[a],c=Object.getOwnPropertyDescriptor(i,l);void 0!==c&&c.enumerable&&(r[l]=i[l])}}return r}e.exports={assign:t,polyfill:function(){Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:t})}}},9804:e=>{var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString;e.exports=function(e,n,i){if("[object Function]"!==r.call(n))throw new TypeError("iterator must be a function");var o=e.length;if(o===+o)for(var a=0;a<o;a++)n.call(i,e[a],a,e);else for(var s in e)t.call(e,s)&&n.call(i,e[s],s,e)}},7648:e=>{"use strict";var t="Function.prototype.bind called on incompatible ",r=Array.prototype.slice,n=Object.prototype.toString,i="[object Function]";e.exports=function(e){var o=this;if("function"!=typeof o||n.call(o)!==i)throw new TypeError(t+o);for(var a,s=r.call(arguments,1),l=function(){if(this instanceof a){var t=o.apply(this,s.concat(r.call(arguments)));return Object(t)===t?t:this}return o.apply(e,s.concat(r.call(arguments)))},c=Math.max(0,o.length-s.length),u=[],p=0;p<c;p++)u.push("$"+p);if(a=Function("binder","return function ("+u.join(",")+"){ return binder.apply(this,arguments); }")(l),o.prototype){var _=function(){};_.prototype=o.prototype,a.prototype=new _,_.prototype=null}return a}},8612:(e,t,r)=>{"use strict";var n=r(7648);e.exports=Function.prototype.bind||n},210:(e,t,r)=>{"use strict";var n,i=SyntaxError,o=Function,a=TypeError,s=function(e){try{return o('"use strict"; return ('+e+").constructor;")()}catch(e){}},l=Object.getOwnPropertyDescriptor;if(l)try{l({},"")}catch(e){l=null}var c=function(){throw new a},u=l?function(){try{return c}catch(e){try{return l(arguments,"callee").get}catch(e){return c}}}():c,p=r(1405)(),_=Object.getPrototypeOf||function(e){return e.__proto__},f={},h="undefined"==typeof Uint8Array?n:_(Uint8Array),d={"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":p?_([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":f,"%AsyncGenerator%":f,"%AsyncGeneratorFunction%":f,"%AsyncIteratorPrototype%":f,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":f,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":p?_(_([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&p?_((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&p?_((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":p?_(""[Symbol.iterator]()):n,"%Symbol%":p?Symbol:n,"%SyntaxError%":i,"%ThrowTypeError%":u,"%TypedArray%":h,"%TypeError%":a,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet},g=function e(t){var r;if("%AsyncFunction%"===t)r=s("async function () {}");else if("%GeneratorFunction%"===t)r=s("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=s("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var i=e("%AsyncGenerator%");i&&(r=_(i.prototype))}return d[t]=r,r},y={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},m=r(8612),b=r(7642),w=m.call(Function.call,Array.prototype.concat),x=m.call(Function.apply,Array.prototype.splice),v=m.call(Function.call,String.prototype.replace),E=m.call(Function.call,String.prototype.slice),O=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,j=/\\(\\)?/g,S=function(e){var t=E(e,0,1),r=E(e,-1);if("%"===t&&"%"!==r)throw new i("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new i("invalid intrinsic syntax, expected opening `%`");var n=[];return v(e,O,(function(e,t,r,i){n[n.length]=r?v(i,j,"$1"):t||e})),n},R=function(e,t){var r,n=e;if(b(y,n)&&(n="%"+(r=y[n])[0]+"%"),b(d,n)){var o=d[n];if(o===f&&(o=g(n)),void 0===o&&!t)throw new a("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:o}}throw new i("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new a("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new a('"allowMissing" argument must be a boolean');var r=S(e),n=r.length>0?r[0]:"",o=R("%"+n+"%",t),s=o.name,c=o.value,u=!1,p=o.alias;p&&(n=p[0],x(r,w([0,1],p)));for(var _=1,f=!0;_<r.length;_+=1){var h=r[_],g=E(h,0,1),y=E(h,-1);if(('"'===g||"'"===g||"`"===g||'"'===y||"'"===y||"`"===y)&&g!==y)throw new i("property names with quotes must have matching quotes");if("constructor"!==h&&f||(u=!0),b(d,s="%"+(n+="."+h)+"%"))c=d[s];else if(null!=c){if(!(h in c)){if(!t)throw new a("base intrinsic for "+e+" exists, but the property is not available.");return}if(l&&_+1>=r.length){var m=l(c,h);c=(f=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:c[h]}else f=b(c,h),c=c[h];f&&!u&&(d[s]=c)}}return c}},1044:(e,t,r)=>{"use strict";var n=r(210)("%Object.defineProperty%",!0),i=function(){if(n)try{return n({},"a",{value:1}),!0}catch(e){return!1}return!1};i.hasArrayLengthDefineBug=function(){if(!i())return null;try{return 1!==n([],"length",{value:1}).length}catch(e){return!0}},e.exports=i},1405:(e,t,r)=>{"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=r(5419);e.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&i()}},5419:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},6410:(e,t,r)=>{"use strict";var n=r(5419);e.exports=function(){return n()&&!!Symbol.toStringTag}},7642:(e,t,r)=>{"use strict";var n=r(8612);e.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},5717:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},2584:(e,t,r)=>{"use strict";var n=r(6410)(),i=r(1924)("Object.prototype.toString"),o=function(e){return!(n&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===i(e)},a=function(e){return!!o(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==i(e)&&"[object Function]"===i(e.callee)},s=function(){return o(arguments)}();o.isLegacyArguments=a,e.exports=s?o:a},8662:(e,t,r)=>{"use strict";var n,i=Object.prototype.toString,o=Function.prototype.toString,a=/^\s*(?:function)?\*/,s=r(6410)(),l=Object.getPrototypeOf;e.exports=function(e){if("function"!=typeof e)return!1;if(a.test(o.call(e)))return!0;if(!s)return"[object GeneratorFunction]"===i.call(e);if(!l)return!1;if(void 0===n){var t=function(){if(!s)return!1;try{return Function("return function*() {}")()}catch(e){}}();n=!!t&&l(t)}return l(e)===n}},8611:e=>{"use strict";e.exports=function(e){return e!=e}},360:(e,t,r)=>{"use strict";var n=r(5559),i=r(4289),o=r(8611),a=r(9415),s=r(3194),l=n(a(),Number);i(l,{getPolyfill:a,implementation:o,shim:s}),e.exports=l},9415:(e,t,r)=>{"use strict";var n=r(8611);e.exports=function(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:n}},3194:(e,t,r)=>{"use strict";var n=r(4289),i=r(9415);e.exports=function(){var e=i();return n(Number,{isNaN:e},{isNaN:function(){return Number.isNaN!==e}}),e}},5692:(e,t,r)=>{"use strict";var n=r(9804),i=r(3083),o=r(1924),a=o("Object.prototype.toString"),s=r(6410)(),l="undefined"==typeof globalThis?r.g:globalThis,c=i(),u=o("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r<e.length;r+=1)if(e[r]===t)return r;return-1},p=o("String.prototype.slice"),_={},f=r(882),h=Object.getPrototypeOf;s&&f&&h&&n(c,(function(e){var t=new l[e];if(Symbol.toStringTag in t){var r=h(t),n=f(r,Symbol.toStringTag);if(!n){var i=h(r);n=f(i,Symbol.toStringTag)}_[e]=n.get}})),e.exports=function(e){if(!e||"object"!=typeof e)return!1;if(!s||!(Symbol.toStringTag in e)){var t=p(a(e),8,-1);return u(c,t)>-1}return!!f&&function(e){var t=!1;return n(_,(function(r,n){if(!t)try{t=r.call(e)===n}catch(e){}})),t}(e)}},4244:e=>{"use strict";var t=function(e){return e!=e};e.exports=function(e,r){return 0===e&&0===r?1/e==1/r:e===r||!(!t(e)||!t(r))}},609:(e,t,r)=>{"use strict";var n=r(4289),i=r(5559),o=r(4244),a=r(5624),s=r(2281),l=i(a(),Object);n(l,{getPolyfill:a,implementation:o,shim:s}),e.exports=l},5624:(e,t,r)=>{"use strict";var n=r(4244);e.exports=function(){return"function"==typeof Object.is?Object.is:n}},2281:(e,t,r)=>{"use strict";var n=r(5624),i=r(4289);e.exports=function(){var e=n();return i(Object,{is:e},{is:function(){return Object.is!==e}}),e}},8987:(e,t,r)=>{"use strict";var n;if(!Object.keys){var i=Object.prototype.hasOwnProperty,o=Object.prototype.toString,a=r(1414),s=Object.prototype.propertyIsEnumerable,l=!s.call({toString:null},"toString"),c=s.call((function(){}),"prototype"),u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],p=function(e){var t=e.constructor;return t&&t.prototype===e},_={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!_["$"+e]&&i.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{p(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();n=function(e){var t=null!==e&&"object"==typeof e,r="[object Function]"===o.call(e),n=a(e),s=t&&"[object String]"===o.call(e),_=[];if(!t&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var h=c&&r;if(s&&e.length>0&&!i.call(e,0))for(var d=0;d<e.length;++d)_.push(String(d));if(n&&e.length>0)for(var g=0;g<e.length;++g)_.push(String(g));else for(var y in e)h&&"prototype"===y||!i.call(e,y)||_.push(String(y));if(l)for(var m=function(e){if("undefined"==typeof window||!f)return p(e);try{return p(e)}catch(e){return!1}}(e),b=0;b<u.length;++b)m&&"constructor"===u[b]||!i.call(e,u[b])||_.push(u[b]);return _}}e.exports=n},2215:(e,t,r)=>{"use strict";var n=Array.prototype.slice,i=r(1414),o=Object.keys,a=o?function(e){return o(e)}:r(8987),s=Object.keys;a.shim=function(){if(Object.keys){var e=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);e||(Object.keys=function(e){return i(e)?s(n.call(e)):s(e)})}else Object.keys=a;return Object.keys||a},e.exports=a},1414:e=>{"use strict";var t=Object.prototype.toString;e.exports=function(e){var r=t.call(e),n="[object Arguments]"===r;return n||(n="[object Array]"!==r&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===t.call(e.callee)),n}},4155:e=>{var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var s,l=[],c=!1,u=-1;function p(){c&&s&&(c=!1,s.length?l=s.concat(l):u=-1,l.length&&_())}function _(){if(!c){var e=a(p);c=!0;for(var t=l.length;t;){for(s=l,l=[];++u<t;)s&&s[u].run();u=-1,t=l.length}s=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function h(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];l.push(new f(e,t)),1!==l.length||c||a(_)},f.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=h,n.addListener=h,n.once=h,n.off=h,n.removeListener=h,n.removeAllListeners=h,n.emit=h,n.prependListener=h,n.prependOnceListener=h,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},384:e=>{e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},5955:(e,t,r)=>{"use strict";var n=r(2584),i=r(8662),o=r(6430),a=r(5692);function s(e){return e.call.bind(e)}var l="undefined"!=typeof BigInt,c="undefined"!=typeof Symbol,u=s(Object.prototype.toString),p=s(Number.prototype.valueOf),_=s(String.prototype.valueOf),f=s(Boolean.prototype.valueOf);if(l)var h=s(BigInt.prototype.valueOf);if(c)var d=s(Symbol.prototype.valueOf);function g(e,t){if("object"!=typeof e)return!1;try{return t(e),!0}catch(e){return!1}}function y(e){return"[object Map]"===u(e)}function m(e){return"[object Set]"===u(e)}function b(e){return"[object WeakMap]"===u(e)}function w(e){return"[object WeakSet]"===u(e)}function x(e){return"[object ArrayBuffer]"===u(e)}function v(e){return"undefined"!=typeof ArrayBuffer&&(x.working?x(e):e instanceof ArrayBuffer)}function E(e){return"[object DataView]"===u(e)}function O(e){return"undefined"!=typeof DataView&&(E.working?E(e):e instanceof DataView)}t.isArgumentsObject=n,t.isGeneratorFunction=i,t.isTypedArray=a,t.isPromise=function(e){return"undefined"!=typeof Promise&&e instanceof Promise||null!==e&&"object"==typeof e&&"function"==typeof e.then&&"function"==typeof e.catch},t.isArrayBufferView=function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):a(e)||O(e)},t.isUint8Array=function(e){return"Uint8Array"===o(e)},t.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===o(e)},t.isUint16Array=function(e){return"Uint16Array"===o(e)},t.isUint32Array=function(e){return"Uint32Array"===o(e)},t.isInt8Array=function(e){return"Int8Array"===o(e)},t.isInt16Array=function(e){return"Int16Array"===o(e)},t.isInt32Array=function(e){return"Int32Array"===o(e)},t.isFloat32Array=function(e){return"Float32Array"===o(e)},t.isFloat64Array=function(e){return"Float64Array"===o(e)},t.isBigInt64Array=function(e){return"BigInt64Array"===o(e)},t.isBigUint64Array=function(e){return"BigUint64Array"===o(e)},y.working="undefined"!=typeof Map&&y(new Map),t.isMap=function(e){return"undefined"!=typeof Map&&(y.working?y(e):e instanceof Map)},m.working="undefined"!=typeof Set&&m(new Set),t.isSet=function(e){return"undefined"!=typeof Set&&(m.working?m(e):e instanceof Set)},b.working="undefined"!=typeof WeakMap&&b(new WeakMap),t.isWeakMap=function(e){return"undefined"!=typeof WeakMap&&(b.working?b(e):e instanceof WeakMap)},w.working="undefined"!=typeof WeakSet&&w(new WeakSet),t.isWeakSet=function(e){return w(e)},x.working="undefined"!=typeof ArrayBuffer&&x(new ArrayBuffer),t.isArrayBuffer=v,E.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&E(new DataView(new ArrayBuffer(1),0,1)),t.isDataView=O;var j="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function S(e){return"[object SharedArrayBuffer]"===u(e)}function R(e){return void 0!==j&&(void 0===S.working&&(S.working=S(new j)),S.working?S(e):e instanceof j)}function A(e){return g(e,p)}function q(e){return g(e,_)}function T(e){return g(e,f)}function k(e){return l&&g(e,h)}function P(e){return c&&g(e,d)}t.isSharedArrayBuffer=R,t.isAsyncFunction=function(e){return"[object AsyncFunction]"===u(e)},t.isMapIterator=function(e){return"[object Map Iterator]"===u(e)},t.isSetIterator=function(e){return"[object Set Iterator]"===u(e)},t.isGeneratorObject=function(e){return"[object Generator]"===u(e)},t.isWebAssemblyCompiledModule=function(e){return"[object WebAssembly.Module]"===u(e)},t.isNumberObject=A,t.isStringObject=q,t.isBooleanObject=T,t.isBigIntObject=k,t.isSymbolObject=P,t.isBoxedPrimitive=function(e){return A(e)||q(e)||T(e)||k(e)||P(e)},t.isAnyArrayBuffer=function(e){return"undefined"!=typeof Uint8Array&&(v(e)||R(e))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(e){Object.defineProperty(t,e,{enumerable:!1,value:function(){throw new Error(e+" is not supported in userland")}})}))},9539:(e,t,r)=>{var n=r(4155),i=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++)r[t[n]]=Object.getOwnPropertyDescriptor(e,t[n]);return r},o=/%[sdj%]/g;t.format=function(e){if(!b(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(c(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,i=n.length,a=String(e).replace(o,(function(e){if("%%"===e)return"%";if(r>=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),s=n[r];r<i;s=n[++r])y(s)||!v(s)?a+=" "+s:a+=" "+c(s);return a},t.deprecate=function(e,r){if(void 0!==n&&!0===n.noDeprecation)return e;if(void 0===n)return function(){return t.deprecate(e,r).apply(this,arguments)};var i=!1;return function(){if(!i){if(n.throwDeprecation)throw new Error(r);n.traceDeprecation?console.trace(r):console.error(r),i=!0}return e.apply(this,arguments)}};var a={},s=/^$/;if(n.env.NODE_DEBUG){var l=n.env.NODE_DEBUG;l=l.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),s=new RegExp("^"+l+"$","i")}function c(e,r){var n={seen:[],stylize:p};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),g(r)?n.showHidden=r:r&&t._extend(n,r),w(n.showHidden)&&(n.showHidden=!1),w(n.depth)&&(n.depth=2),w(n.colors)&&(n.colors=!1),w(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),_(n,e,n.depth)}function u(e,t){var r=c.styles[t];return r?"["+c.colors[r][0]+"m"+e+"["+c.colors[r][1]+"m":e}function p(e,t){return e}function _(e,r,n){if(e.customInspect&&r&&j(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return b(i)||(i=_(e,i,n)),i}var o=function(e,t){if(w(t))return e.stylize("undefined","undefined");if(b(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return m(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):y(t)?e.stylize("null","null"):void 0}(e,r);if(o)return o;var a=Object.keys(r),s=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(r)),O(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return f(r);if(0===a.length){if(j(r)){var l=r.name?": "+r.name:"";return e.stylize("[Function"+l+"]","special")}if(x(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(E(r))return e.stylize(Date.prototype.toString.call(r),"date");if(O(r))return f(r)}var c,u="",p=!1,v=["{","}"];return d(r)&&(p=!0,v=["[","]"]),j(r)&&(u=" [Function"+(r.name?": "+r.name:"")+"]"),x(r)&&(u=" "+RegExp.prototype.toString.call(r)),E(r)&&(u=" "+Date.prototype.toUTCString.call(r)),O(r)&&(u=" "+f(r)),0!==a.length||p&&0!=r.length?n<0?x(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),c=p?function(e,t,r,n,i){for(var o=[],a=0,s=t.length;a<s;++a)T(t,String(a))?o.push(h(e,t,r,n,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(h(e,t,r,n,i,!0))})),o}(e,r,n,s,a):a.map((function(t){return h(e,r,n,s,t,p)})),e.seen.pop(),function(e,t,r){return e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}(c,u,v)):v[0]+u+v[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,r,n,i,o){var a,s,l;if((l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(s=e.stylize("[Setter]","special")),T(n,i)||(a="["+i+"]"),s||(e.seen.indexOf(l.value)<0?(s=y(r)?_(e,l.value,null):_(e,l.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),w(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function d(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function y(e){return null===e}function m(e){return"number"==typeof e}function b(e){return"string"==typeof e}function w(e){return void 0===e}function x(e){return v(e)&&"[object RegExp]"===S(e)}function v(e){return"object"==typeof e&&null!==e}function E(e){return v(e)&&"[object Date]"===S(e)}function O(e){return v(e)&&("[object Error]"===S(e)||e instanceof Error)}function j(e){return"function"==typeof e}function S(e){return Object.prototype.toString.call(e)}function R(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(e=e.toUpperCase(),!a[e])if(s.test(e)){var r=n.pid;a[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else a[e]=function(){};return a[e]},t.inspect=c,c.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},c.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.types=r(5955),t.isArray=d,t.isBoolean=g,t.isNull=y,t.isNullOrUndefined=function(e){return null==e},t.isNumber=m,t.isString=b,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=w,t.isRegExp=x,t.types.isRegExp=x,t.isObject=v,t.isDate=E,t.types.isDate=E,t.isError=O,t.types.isNativeError=O,t.isFunction=j,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(384);var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function q(){var e=new Date,t=[R(e.getHours()),R(e.getMinutes()),R(e.getSeconds())].join(":");return[e.getDate(),A[e.getMonth()],t].join(" ")}function T(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",q(),t.format.apply(t,arguments))},t.inherits=r(5717),t._extend=function(e,t){if(!t||!v(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var k="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function P(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(k&&e[k]){var t;if("function"!=typeof(t=e[k]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,k,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,n=new Promise((function(e,n){t=e,r=n})),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push((function(e,n){e?r(e):t(n)}));try{e.apply(this,i)}catch(e){r(e)}return n}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),k&&Object.defineProperty(t,k,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,i(e))},t.promisify.custom=k,t.callbackify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function t(){for(var t=[],r=0;r<arguments.length;r++)t.push(arguments[r]);var i=t.pop();if("function"!=typeof i)throw new TypeError("The last argument must be of type Function");var o=this,a=function(){return i.apply(o,arguments)};e.apply(this,t).then((function(e){n.nextTick(a.bind(null,null,e))}),(function(e){n.nextTick(P.bind(null,e,a))}))}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,i(e)),t}},6430:(e,t,r)=>{"use strict";var n=r(9804),i=r(3083),o=r(1924),a=o("Object.prototype.toString"),s=r(6410)(),l="undefined"==typeof globalThis?r.g:globalThis,c=i(),u=o("String.prototype.slice"),p={},_=r(882),f=Object.getPrototypeOf;s&&_&&f&&n(c,(function(e){if("function"==typeof l[e]){var t=new l[e];if(Symbol.toStringTag in t){var r=f(t),n=_(r,Symbol.toStringTag);if(!n){var i=f(r);n=_(i,Symbol.toStringTag)}p[e]=n.get}}}));var h=r(5692);e.exports=function(e){return!!h(e)&&(s&&Symbol.toStringTag in e?function(e){var t=!1;return n(p,(function(r,n){if(!t)try{var i=r.call(e);i===n&&(t=i)}catch(e){}})),t}(e):u(a(e),8,-1))}},45:(e,t,r)=>{var n=r(4155);const i=r(4949),o=r(5174),a=r(7857),s=r(6987),l=r(371),c=r(8594),u=/^([0-9]+)(\.[0-9]+)?$/;class p extends Error{}function _(e,t,r){if(e.length>r[0]&&(r[0]=e.length),-1==r[1])return;let n=u.exec(e);if(null===n)return void(!t&&e.length&&(r[1]=-1,r[2]=-1));let i=n[1].length;r[1]=Math.max(r[1],i);let o=void 0===n[2]?0:n[2].length;r[2]=Math.max(r[2],o)}function f(e,t,r,n){if(e=e.trim(),-1==r[1]){let t=Math.max(r[0]-e.length,0);return n?e:e+" ".repeat(t+1)}if(t&&null===u.exec(e)){let t=Math.max(r[0]-e.length,0);return n?e:e+" ".repeat(t+1)}let i=e.indexOf("."),o=-1==i?e.length:i,a=-1==i?0:e.length-i,s=Math.max(r[1]-o,0),l=Math.max(r[2]-a),c=n?"":" ".repeat(l+1);return" ".repeat(s)+e+c}function h(e){return"rbql_table_name:"+e}function d(e,t,r){var n,s="~"===(n=r).charAt(0)?a.join(i.homedir(),n.slice(1)):n;if(o.existsSync(s))return s;if(t&&!a.isAbsolute(s)&&(s=a.join(t,s),o.existsSync(s)))return s;let l=e?e.get(h(r)):null;return l&&o.existsSync(l)?l:null}function g(e,t){const r=e.lineCount;for(let n=0;n<r;++n){const r=e.lineAt(n).text;if(!t||!r.startsWith(t))return r}return null}class y extends Error{}class m extends s.RBQLInputIterator{constructor(e,t,r,n=!1,i=null,o="input",a="a"){super(),this.document=e,this.delim=t,this.policy=r,this.has_header=n,this.comment_prefix=i,this.table_name=o,this.variable_prefix=a,this.NR=0,this.NL=0,this.fields_info=new Object,this.first_defective_line=null,this.first_record=this.get_first_record()}stop(){}get_first_record(){let e=g(this.document,this.comment_prefix);return c.smart_split(e,this.delim,this.policy,!1)[0]}async get_variables_map(e){let t=new Object;s.parse_basic_variables(e,this.variable_prefix,t),s.parse_array_variables(e,this.variable_prefix,t);let r=g(this.document,this.comment_prefix),n=c.smart_split(r,this.delim,this.policy,!1)[0];return this.has_header&&(s.parse_attribute_variables(e,this.variable_prefix,n,"CSV header line",t),s.parse_dictionary_variables(e,this.variable_prefix,n,t)),t}async get_header(){return this.has_header?this.first_record:null}get_line_rfc(){let e=[];const t=this.document.lineCount;for(;this.NL<t;){let r=this.document.lineAt(this.NL).text;if(this.NL+=1,this.NL==t&&0==r.length)return null;let n=c.accumulate_rfc_line_into_record(e,r,this.comment_prefix);if(null!==n)return n}return null}get_line_simple(){const e=this.document.lineCount;for(;this.NL<e;){let t=this.document.lineAt(this.NL).text;if(this.NL+=1,this.NL==e&&0==t.length)return null;if(null===this.comment_prefix||!t.startsWith(this.comment_prefix))return t}return null}do_get_record(){let e="quoted_rfc"==this.policy?this.get_line_rfc():this.get_line_simple();if(null===e)return null;let[t,r]=c.smart_split(e,this.delim,this.policy,!1);if(r&&null===this.first_defective_line&&(this.first_defective_line=this.NL,"quoted_rfc"==this.policy))throw new y(`Inconsistent double quote escaping in ${this.table_name} table at record ${this.NR}, line ${this.NL}`);let n=t.length;return this.fields_info.hasOwnProperty(n)||(this.fields_info[n]=this.NR),t}async get_record(){return 0==this.NR&&this.has_header&&this.do_get_record(),this.NR+=1,this.do_get_record()}get_warnings(){let e=[];return null!==this.first_defective_line&&e.push(`Inconsistent double quote escaping in ${this.table_name} table. E.g. at line ${this.first_defective_line}`),Object.keys(this.fields_info).length>1&&e.push(function(e,t){let r=Object.keys(t),n=[];for(let e=0;e<r.length;e++){let i=r[e],o=t[i];n.push([o,i])}n.sort((function(e,t){return e[0]-t[0]})),function(e,t=null){if(!e)throw t||(t="Assertion error"),new p(t)}(n.length>1);let[i,o]=n[0],[a,s]=n[1],l=`Number of fields in "${e}" table is not consistent: `;return l+=`e.g. record ${i} -> ${o} fields, record ${a} -> ${s} fields`,l}(this.table_name,this.fields_info)),e}}class b extends s.RBQLOutputWriter{constructor(e,t){if(super(),this.delim=e,this.policy=t,this.header_len=null,this.null_in_output=!1,this.delim_in_simple_output=!1,this.output_lines=[],"simple"==t)this.polymorphic_join=this.simple_join;else if("quoted"==t)this.polymorphic_join=this.quoted_join;else if("quoted_rfc"==t)this.polymorphic_join=this.quoted_join_rfc;else if("monocolumn"==t)this.polymorphic_join=this.mono_join;else{if("whitespace"!=t)throw new y("Unknown output csv policy");this.polymorphic_join=this.simple_join}}set_header(e){null!==e&&(this.header_len=e.length,this.write(e))}quoted_join(e){let t=this.delim;return e.map((function(e){return c.quote_field(String(e),t)})).join(this.delim)}quoted_join_rfc(e){let t=this.delim;return e.map((function(e){return c.rfc_quote_field(String(e),t)})).join(this.delim)}mono_join(e){if(e.length>1)throw new y('Unable to use "Monocolumn" output format: some records have more than one field');return e[0]}simple_join(e){var t=e.join(this.delim);return-1!=e.join("").indexOf(this.delim)&&(this.delim_in_simple_output=!0),t}normalize_fields(e){for(var t=0;t<e.length;t++)null==e[t]?(this.null_in_output=!0,e[t]=""):Array.isArray(e[t])&&(this.normalize_fields(e[t]),e[t]=e[t].join(this.sub_array_delim))}write(e){if(null!==this.header_len&&e.length!=this.header_len)throw new y(`Inconsistent number of columns in output header and the current record: ${this.header_len} != ${e.length}`);return this.normalize_fields(e),this.output_lines.push(this.polymorphic_join(e)),!0}async finish(){}get_warnings(){let e=[];return this.null_in_output&&e.push("null values in output were replaced by empty strings"),this.delim_in_simple_output&&e.push("Some output fields contain separator"),e}}class w{constructor(){}get_iterator_by_table_id(e){throw new y("JOIN queries are currently not supported in vscode.dev web version.")}get_warnings(){return[]}}class x extends s.RBQLTableRegistry{constructor(e,t,r,n,i,o=!1,a=null,s=null){super(),this.vscode_global_state=e,this.input_file_dir=t,this.delim=r,this.policy=n,this.encoding=i,this.has_header=o,this.comment_prefix=a,this.stream=null,this.record_iterator=null,this.options=s,this.bulk_input_path=null,this.table_path=null}get_iterator_by_table_id(e){if(this.table_path=d(this.vscode_global_state,this.input_file_dir,e),null===this.table_path)throw new y(`Unable to find join table "${e}"`);return this.options&&this.options.bulk_read?this.bulk_input_path=this.table_path:this.stream=o.createReadStream(this.table_path),this.record_iterator=new l.CSVRecordIterator(this.stream,this.bulk_input_path,this.encoding,this.delim,this.policy,this.has_header,this.comment_prefix,e,"b"),this.record_iterator}get_warnings(e){this.record_iterator&&this.has_header&&e.push(`The first record in JOIN file ${a.basename(this.table_path)} was also treated as header (and skipped)`)}}e.exports.make_table_name_key=h,e.exports.find_table_path=d,e.exports.read_header=async function(e,t){"latin-1"==t&&(t="binary");let n=r(8391).createInterface({input:o.createReadStream(e,{encoding:t})}),i=!1,a=null,s=null,l=new Promise((function(e,t){a=e,s=t}));return n.on("line",(e=>{i||(i=!0,n.close(),a(e))})),n.on("error",(e=>{s(e)})),l},e.exports.rbql_query_web=async function(e,t,r,n,i,o,a,l,c=null){let u=new w,p=new m(t,r,n,l,c),_=new b(i,o);return await s.query(e,p,_,a,u,""),_.output_lines},e.exports.rbql_query_node=async function(e,t,r,c,u,p,_,f,h,d,g=!1,m=null,b="",w=null){let v=null,E=null;w&&w.bulk_read&&r?E=r:v=null===r?n.stdin:o.createReadStream(r);let[O,j]=null===p?[n.stdout,!1]:[o.createWriteStream(p),!0];if('"'==c&&"quoted"==u)throw new y('Double quote delimiter is incompatible with "quoted" policy');if("latin-1"==h&&(h="binary"),!l.is_ascii(t)&&"binary"==h)throw new y("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");if(!(l.is_ascii(c)&&l.is_ascii(_)||"binary"!=h))throw new y("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");let S=a.join(i.homedir(),".rbql_init_source.js");""==b&&o.existsSync(S)&&(b=l.read_user_init_code(S));let R=r?a.dirname(r):null,A=new x(e,R,c,u,h,g,m,w),q=new l.CSVRecordIterator(v,E,h,c,u,g,m),T=new l.CSVWriter(O,j,h,_,f);await s.query(t,q,T,d,A,b),A.get_warnings(d)},e.exports.get_header_line=g,e.exports.populate_optimistic_rfc_csv_record_map=function(e,t,r,n=null){let i=e.lineCount,o=null;var a;for(let s=r.length?(a=r,a[a.length-1])[1]:0;s<i&&r.length<t;++s){let t=e.lineAt(s).text;if(s+1>=i&&""==t)break;if(n&&t.startsWith(n))continue;let a=t.match(/"/g),l=a&&a.length%2==1;if(null!==o||l)if(null===o&&l)o=s;else{if(!l)continue;r.push([o,s+1]),o=null}else r.push([s,s+1])}null!==o&&r.push([o,i])},e.exports.get_default_js_udf_content=function(){return"// This file can be used to store RBQL UDFs. Example:\n //\n // function foo(value) {\n // return 'foo ' + String(value.length);\n // }\n // \n // Functions defined in this file can be used in RBQL queries e.g. \n // SELECT foo(a1), a2 WHERE foo(a3) != 'foo 5' LIMIT 10\n //\n // Don't forget to save this file after editing!\n //\n // Write your own functions bellow this line:\n ".replace(new RegExp(/^ */,"mg"),"")},e.exports.get_default_python_udf_content=function(){return"# This file can be used to store RBQL UDFs. Example:\n #\n # def foo(value):\n # return 'foo ' + str(len(value))\n # \n # \n # Functions defined in this file can be used in RBQL queries e.g. \n # SELECT foo(a1), a2 WHERE foo(a3) != 'foo 5' LIMIT 10\n #\n # Don't forget to save this file after editing!\n #\n # Write your own functions bellow this line:\n ".replace(new RegExp(/^ */,"mg"),"")},e.exports.align_columns=function(e,t,r,n,i){let o=[],a=e.lineCount,s=!1,l=!0;for(let u=0;u<a;u++){let p=e.lineAt(u).text;if(n&&p.startsWith(n)){o.push(p);continue}if(u+1==a&&""==p){o.push(p);continue}let _=c.smart_split(p,t,r,!0)[0];for(let e=0;e<_.length&&!(e>=i.length);e++){let t=e+1==i.length,r=f(_[e],l,i[e],t);_[e]!=r&&(_[e]=r,s=!0)}l=!1,o.push(_.join(t))}return s?o.join("\n"):null},e.exports.shrink_columns=function(e,t,r,n){let i=[],o=e.lineCount,a=!1;for(let s=0;s<o;s++){let o=e.lineAt(s).text;if(n&&o.startsWith(n)){i.push(o);continue}let[l,u]=c.smart_split(o,t,r,!0);if(u)return[null,s+1];for(let e=0;e<l.length;e++){let t=l[e].trim();l[e].length!=t.length&&(l[e]=t,a=!0)}i.push(l.join(t))}return a?[i.join("\n"),null]:[null,null]},e.exports.calc_column_stats=function(e,t,r,n){let i=[],o=e.lineCount,a=!0;for(let s=0;s<o;s++){let o=e.lineAt(s).text;if(n&&o.startsWith(n))continue;let[l,u]=c.smart_split(o,t,r,!0);if(u)return[null,s+1];for(let e=0;e<l.length;e++){let t=l[e].trim();i.length<=e&&i.push([0,0,0]),_(t,a,i[e])}a=!1}return[i,null]},e.exports.adjust_column_stats=function(e){let t=[];for(let r of e){if(r[1]<=0&&(r[1]=-1,r[2]=-1),r[1]>0&&(r[1]+r[2]>r[0]&&(r[0]=r[1]+r[2]),r[0]-r[2]>r[1]&&(r[1]=r[0]-r[2]),r[0]!=r[1]+r[2]))return null;t.push(r)}return t},e.exports.update_subcomponent_stats=_,e.exports.align_field=f},8594:e=>{let t=new RegExp('^"((?:[^"]*"")*[^"]*)"'),r=new RegExp('^ *"((?:[^"]*"")*[^"]*)" *');function n(e,n,i,o,a,s){var l=!1;let c=e.substring(a),u=(o?r:t).exec(c);if(null!==u){let t=u[0].length;if(a+t==e.length||e[a+t]==n)return i?s.push(u[0]):s.push(u[1].replace(/""/g,'"')),[a+t+1,!1];l=!0}var p=e.indexOf(n,a);-1==p&&(p=e.length);var _=e.substring(a,p);return l=l||-1!=_.indexOf('"'),s.push(_),[p+1,l]}function i(e,t,r=!1){if(-1==e.indexOf('"'))return[e.split(t),!1];var i=[],o=0,a=!1;let s=" "!=t;for(;o<e.length;){var l=n(e,t,r,s,o,i);o=l[0],a=a||l[1]}return e.charAt(e.length-1)==t&&i.push(""),[i,a]}function o(e){let t=new RegExp('^ *"((?:[^"]*"")*[^"]*)" *$').exec(e);return null!==t?t[1].replace(/""/g,'"'):e}function a(e,t=!1){var r=t?new RegExp(" *[^ ]+ *","g"):new RegExp("[^ ]+","g");let n=[],i=null;for(;null!==(i=r.exec(e));)n.push(i[0]);if(t)for(let e=0;e<n.length-1;e++)n[e]=n[e].slice(0,-1);return n}e.exports.split_quoted_str=i,e.exports.split_whitespace_separated_str=a,e.exports.smart_split=function(e,t,r,n){return"simple"===r?[e.split(t),!1]:"whitespace"===r?[a(e,n),!1]:"monocolumn"===r?[[e],!1]:i(e,t,n)},e.exports.quote_field=function(e,t){return-1!=e.indexOf(t)||-1!=e.indexOf('"')?`"${e.replace(/"/g,'""')}"`:e},e.exports.rfc_quote_field=function(e,t){return-1!=e.indexOf(t)||-1!=e.indexOf('"')||-1!=e.indexOf("\n")||-1!=e.indexOf("\r")?`"${e.replace(/"/g,'""')}"`:e},e.exports.unquote_field=o,e.exports.unquote_fields=function(e){return e.map(o)},e.exports.split_lines=function(e){return e.split(/\r\n|\r|\n/)},e.exports.accumulate_rfc_line_into_record=function(e,t,r=null){if(null!==r&&0==e.length&&t.startsWith(r))return null;let n=t.match(/"/g),i=n&&n.length%2==1;if(0==e.length&&!i)return t;if(0==e.length&&i)e.push(t);else{if(i){e.push(t);let r=e.join("\n");return e.splice(0,e.length),r}e.push(t)}return null}},6987:(__unused_webpack_module,exports)=>{(function(exports){class RbqlParsingError extends Error{}class RbqlRuntimeError extends Error{}class AssertionError extends Error{}class RbqlIOHandlingError extends Error{}class InternalBadFieldError extends Error{constructor(e,...t){super(...t),this.bad_idx=e}}function assert(e,t=null){if(!e)throw t||(t="Assertion error"),new AssertionError(t)}function replace_all(e,t,r){return e.split(t).join(r)}class RBQLContext{constructor(e,t,r,n){this.query_text=e,this.input_iterator=t,this.writer=r,this.user_init_code=n,this.unnest_list=null,this.top_count=null,this.like_regex_cache=new Map,this.sort_key_expression=null,this.aggregation_stage=0,this.aggregation_key_expression=null,this.functional_aggregators=[],this.join_map_impl=null,this.join_map=null,this.lhs_join_var_expression=null,this.where_expression=null,this.select_expression=null,this.update_expressions=null,this.variables_init_code=null}}var query_context=null;const wrong_aggregation_usage_error="Usage of RBQL aggregation functions inside JavaScript expressions is not allowed, see the docs",RBQL_VERSION="0.25.0";function check_if_brackets_match(e,t){return"["==e&&"]"==t||"("==e&&")"==t||"{"==e&&"}"==t}function parse_root_bracket_level_text_spans(e){let t=[],r=0,n=[];for(let i=0;i<e.length;i++){let o=e[i];if(","==o&&0==n.length)t.push(e.substring(r,i)),r=i+1;else if(-1!=["[","{","("].indexOf(o))n.push(o);else if(-1!=["]","}",")"].indexOf(o)){if(!n.length||!check_if_brackets_match(n[n.length-1],o))throw new RbqlParsingError(`Unable to parse column headers in SELECT expression: No matching opening bracket for closing "${o}"`);n.pop()}}if(n.length)throw new RbqlParsingError(`Unable to parse column headers in SELECT expression: No matching closing bracket for opening "${n[0]}"`);return t.push(e.substring(r,e.length)),t=t.map((e=>e.trim())),t}function unquote_string(e){return!e||e.length<2?null:"'"==e[0]&&"'"==e[e.length-1]?e.substring(1,e.length-1).replace(/\\'/g,"'").replace(/\\\\/g,"\\"):'"'==e[0]&&'"'==e[e.length-1]?e.substring(1,e.length-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"):null}function column_info_from_text_span(e,t){e=e.trim();let r="__RBQL_INTERNAL_STAR",n=/^[_a-zA-Z][_a-zA-Z0-9]*$/.exec(e),i=/^([ab])\.([_a-zA-Z][_a-zA-Z0-9]*)$/.exec(e),o=/^([ab])\[([0-9]+)\]$/.exec(e),a=/^([ab])\[___RBQL_STRING_LITERAL([0-9]+)___\]$/.exec(e);if(null!==n){if(e==r)return{table_name:null,column_index:null,column_name:null,is_star:!0};if(e.startsWith("___RBQL_STRING_LITERAL"))return null;let t=/^([ab])([0-9]+)$/.exec(e);return null!==t?{table_name:t[1],column_index:parseInt(t[2])-1,column_name:null,is_star:!1}:{table_name:null,column_index:null,column_name:e,is_star:!1}}if(null!==i){let e=i[1],t=i[2];return t==r?{table_name:e,column_index:null,column_name:null,is_star:!0}:{table_name:null,column_index:null,column_name:t,is_star:!1}}if(null!=o)return{table_name:o[1],column_index:parseInt(o[2])-1,column_name:null,is_star:!1};if(null!=a){a[1];let e=a[2];if(e<t.length){let r=unquote_string(t[e]);if(null!=r)return{table_name:null,column_index:null,column_name:r,is_star:!1}}}return null}function adhoc_parse_select_expression_to_column_infos(e,t){return parse_root_bracket_level_text_spans(e).map((e=>column_info_from_text_span(e,t)))}function stable_compare(e,t){for(var r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1}function safe_get(e,t){return t<e.length?e[t]:null}function safe_join_get(e,t){if(t<e.length)return e[t];throw new InternalBadFieldError(t)}function safe_set(e,t,r){if(!(t<e.length))throw new InternalBadFieldError(t);e[t]=r}function regexp_escape(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function like_to_regex(e){let t=0,r=0,n="";for(;r<e.length;)"_"!=e.charAt(r)&&"%"!=e.charAt(r)||(n+=regexp_escape(e.substring(t,r)),t=r+1,"_"==e.charAt(r)?n+=".":n+=".*"),r+=1;return n+=regexp_escape(e.substring(t,r)),"^"+n+"$"}function like(e,t){let r=query_context.like_regex_cache.get(t);return void 0===r&&(r=new RegExp(like_to_regex(t)),query_context.like_regex_cache.set(t,r)),r.test(e)}const LIKE=like;class RBQLAggregationToken{constructor(e,t){this.marker_id=e,this.value=t}toString(){throw new RbqlParsingError(wrong_aggregation_usage_error)}}class UnnestMarker{}function UNNEST(e){if(null!==query_context.unnest_list)throw new RbqlParsingError("Only one UNNEST is allowed per query");return query_context.unnest_list=e,new UnnestMarker}const unnest=UNNEST,Unnest=UNNEST,UNFOLD=UNNEST;function parse_number(e){let t=Number(e);if(isNaN(t))throw new RbqlRuntimeError(`Unable to convert value "${e}" to a number. MIN, MAX, SUM, AVG, MEDIAN and VARIANCE aggregate functions convert their string arguments to numeric values`);return t}class MinAggregator{constructor(){this.stats=new Map}increment(e,t){t=parse_number(t);var r=this.stats.get(e);void 0===r?this.stats.set(e,t):this.stats.set(e,Math.min(r,t))}get_final(e){return this.stats.get(e)}}class MaxAggregator{constructor(){this.stats=new Map}increment(e,t){t=parse_number(t);var r=this.stats.get(e);void 0===r?this.stats.set(e,t):this.stats.set(e,Math.max(r,t))}get_final(e){return this.stats.get(e)}}class SumAggregator{constructor(){this.stats=new Map}increment(e,t){t=parse_number(t);var r=this.stats.get(e);void 0===r?this.stats.set(e,t):this.stats.set(e,r+t)}get_final(e){return this.stats.get(e)}}class AvgAggregator{constructor(){this.stats=new Map}increment(e,t){t=parse_number(t);var r=this.stats.get(e);if(void 0===r)this.stats.set(e,[t,1]);else{var n=r[0],i=r[1];this.stats.set(e,[n+t,i+1])}}get_final(e){var t=this.stats.get(e);return t[0]/t[1]}}class VarianceAggregator{constructor(){this.stats=new Map}increment(e,t){t=parse_number(t);var r=this.stats.get(e);if(void 0===r)this.stats.set(e,[t,t*t,1]);else{var n=r[0],i=r[1],o=r[2];this.stats.set(e,[n+t,i+t*t,o+1])}}get_final(e){var t=this.stats.get(e),r=t[0],n=t[1],i=t[2],o=r/i;return n/i-o*o}}class MedianAggregator{constructor(){this.stats=new Map}increment(e,t){t=parse_number(t);var r=this.stats.get(e);void 0===r?this.stats.set(e,[t]):r.push(t)}get_final(e){var t=this.stats.get(e);t.sort((function(e,t){return e-t}));var r=Math.floor(t.length/2);return t.length%2?t[r]:(t[r-1]+t[r])/2}}class CountAggregator{constructor(){this.stats=new Map}increment(e,t){var r=this.stats.get(e);void 0===r?this.stats.set(e,1):this.stats.set(e,r+1)}get_final(e){return this.stats.get(e)}}class ArrayAggAggregator{constructor(e=null){this.post_proc=e,this.stats=new Map}increment(e,t){let r=this.stats.get(e);void 0===r?this.stats.set(e,[t]):r.push(t)}get_final(e){let t=this.stats.get(e);return null===this.post_proc?t:this.post_proc(t)}}class ConstGroupVerifier{constructor(e){this.output_index=e,this.const_values=new Map}increment(e,t){var r=this.const_values.get(e);if(void 0===r)this.const_values.set(e,t);else if(r!=t)throw new RbqlRuntimeError(`Invalid aggregate expression: non-constant values in output column ${this.output_index+1}. E.g. "${r}" and "${t}"`)}get_final(e){return this.const_values.get(e)}}function init_aggregator(e,t,r=null){query_context.aggregation_stage=1;var n=new RBQLAggregationToken(query_context.functional_aggregators.length,t);return null===r?query_context.functional_aggregators.push(new e):query_context.functional_aggregators.push(new e(r)),n}function MIN(e){return query_context.aggregation_stage<2?init_aggregator(MinAggregator,e):e}const min=MIN,Min=MIN;function MAX(e){return query_context.aggregation_stage<2?init_aggregator(MaxAggregator,e):e}const max=MAX,Max=MAX;function COUNT(e){return query_context.aggregation_stage<2?init_aggregator(CountAggregator,1):1}const count=COUNT,Count=COUNT;function SUM(e){return query_context.aggregation_stage<2?init_aggregator(SumAggregator,e):e}const sum=SUM,Sum=SUM;function AVG(e){return query_context.aggregation_stage<2?init_aggregator(AvgAggregator,e):e}const avg=AVG,Avg=AVG;function VARIANCE(e){return query_context.aggregation_stage<2?init_aggregator(VarianceAggregator,e):e}const variance=VARIANCE,Variance=VARIANCE;function MEDIAN(e){return query_context.aggregation_stage<2?init_aggregator(MedianAggregator,e):e}const median=MEDIAN,Median=MEDIAN;function ARRAY_AGG(e,t=null){return query_context.aggregation_stage<2?init_aggregator(ArrayAggAggregator,e,t):e}const array_agg=ARRAY_AGG,FOLD=ARRAY_AGG;function add_to_set(e,t){var r=e.size;return e.add(t),r!=e.size}class TopWriter{constructor(e,t){this.subwriter=e,this.NW=0,this.top_count=t}async write(e){return!(null!==this.top_count&&this.NW>=this.top_count||(await this.subwriter.write(e),this.NW+=1,0))}async finish(){await this.subwriter.finish()}}class UniqWriter{constructor(e){this.subwriter=e,this.seen=new Set}async write(e){return!add_to_set(this.seen,JSON.stringify(e))||!!await this.subwriter.write(e)}async finish(){await this.subwriter.finish()}}class UniqCountWriter{constructor(e){this.subwriter=e,this.records=new Map}async write(e){var t=JSON.stringify(e),r=this.records.get(t);return r?r[0]+=1:this.records.set(t,[1,e]),!0}async finish(){for(var[e,t]of this.records){let[e,r]=t;if(r.unshift(e),!await this.subwriter.write(r))break}await this.subwriter.finish()}}class SortedWriter{constructor(e,t){this.subwriter=e,this.reverse_sort=t,this.unsorted_entries=[]}async write(e){return this.unsorted_entries.push(e),!0}async finish(){var e=this.unsorted_entries;e.sort(stable_compare),this.reverse_sort&&e.reverse();for(var t=0;t<e.length;t++){var r=e[t];if(!await this.subwriter.write(r[r.length-1]))break}await this.subwriter.finish()}}class AggregateWriter{constructor(e){this.subwriter=e,this.aggregators=[],this.aggregation_keys=new Set}async finish(){var e=Array.from(this.aggregation_keys);e.sort();for(var t=0;t<e.length;t++){var r=e[t],n=[];for(var i of this.aggregators)n.push(i.get_final(r));if(!await this.subwriter.write(n))break}await this.subwriter.finish()}}class InnerJoiner{constructor(e){this.join_map=e}get_rhs(e){return this.join_map.get_join_records(e)}}class LeftJoiner{constructor(e){this.join_map=e,this.null_record=[[null,e.max_record_len,Array(e.max_record_len).fill(null)]]}get_rhs(e){let t=this.join_map.get_join_records(e);return 0==t.length?this.null_record:t}}class StrictLeftJoiner{constructor(e){this.join_map=e}get_rhs(e){let t=this.join_map.get_join_records(e);if(1!=t.length)throw new RbqlRuntimeError('In "STRICT LEFT JOIN" each key in A must have exactly one match in B. Bad A key: "'+e+'"');return t}}function select_except(e,t){let r=[];for(let n=0;n<e.length;n++)-1==t.indexOf(n)&&r.push(e[n]);return r}async function select_simple(e,t,r){if(null!==query_context.sort_key_expression){var n=e.concat([t,r]);if(!await query_context.writer.write(n))return!1}else if(!await query_context.writer.write(r))return!1;return!0}function select_aggregated(e,t){if(null!==e&&(e=JSON.stringify(e)),1===query_context.aggregation_stage){if(!(query_context.writer instanceof TopWriter))throw new RbqlParsingError('"ORDER BY", "UPDATE" and "DISTINCT" keywords are not allowed in aggregate queries');query_context.writer=new AggregateWriter(query_context.writer);let i=0;for(var r=0;r<t.length;r++)(n=t[r])instanceof RBQLAggregationToken?(query_context.writer.aggregators.push(query_context.functional_aggregators[n.marker_id]),query_context.writer.aggregators[query_context.writer.aggregators.length-1].increment(e,n.value),i+=1):(query_context.writer.aggregators.push(new ConstGroupVerifier(query_context.writer.aggregators.length)),query_context.writer.aggregators[query_context.writer.aggregators.length-1].increment(e,n));if(i!=query_context.functional_aggregators.length)throw new RbqlParsingError(wrong_aggregation_usage_error);query_context.aggregation_stage=2}else for(r=0;r<t.length;r++){var n=t[r];query_context.writer.aggregators[r].increment(e,n)}query_context.writer.aggregation_keys.add(e)}async function select_unnested(e,t,r){let n=r.slice(),i=r.findIndex((e=>e instanceof UnnestMarker));for(var o=0;o<query_context.unnest_list.length;o++)if(n[i]=query_context.unnest_list[o],!await select_simple(e,t,n.slice()))return!1;return!0}const PROCESS_SELECT_COMMON="\n__RBQLMP__variables_init_code\nif (__RBQLMP__where_expression) {\n let out_fields = __RBQLMP__select_expression;\n if (query_context.aggregation_stage > 0) {\n let key = __RBQLMP__aggregation_key_expression;\n select_aggregated(key, out_fields);\n } else {\n let sort_key = [__RBQLMP__sort_key_expression];\n if (query_context.unnest_list !== null) {\n if (!await select_unnested(sort_key, NR, out_fields))\n stop_flag = true;\n } else {\n if (!await select_simple(sort_key, NR, out_fields))\n stop_flag = true;\n }\n }\n}\n",PROCESS_SELECT_SIMPLE="\nlet star_fields = record_a;\n__CODE__\n",PROCESS_SELECT_JOIN="\nlet join_matches = query_context.join_map.get_rhs(__RBQLMP__lhs_join_var_expression);\nfor (let join_match of join_matches) {\n let [bNR, bNF, record_b] = join_match;\n let star_fields = record_a.concat(record_b);\n __CODE__\n if (stop_flag)\n break;\n}\n",PROCESS_UPDATE_JOIN="\nlet join_matches = query_context.join_map.get_rhs(__RBQLMP__lhs_join_var_expression);\nif (join_matches.length > 1)\n throw new RbqlRuntimeError('More than one record in UPDATE query matched a key from the input table in the join table');\nlet record_b = null;\nlet bNR = null;\nlet bNF = null;\nif (join_matches.length == 1)\n [bNR, bNF, record_b] = join_matches[0];\nlet up_fields = record_a;\n__RBQLMP__variables_init_code\nif (join_matches.length == 1 && (__RBQLMP__where_expression)) {\n NU += 1;\n __RBQLMP__update_expressions\n}\nif (!await query_context.writer.write(up_fields))\n stop_flag = true;\n",PROCESS_UPDATE_SIMPLE="\nlet up_fields = record_a;\n__RBQLMP__variables_init_code\nif (__RBQLMP__where_expression) {\n NU += 1;\n __RBQLMP__update_expressions\n}\nif (!await query_context.writer.write(up_fields))\n stop_flag = true;\n",MAIN_LOOP_BODY="\n__USER_INIT_CODE__\n\nlet NU = 0;\nlet NR = 0;\n\nlet stop_flag = false;\nwhile (!stop_flag) {\n let record_a = await query_context.input_iterator.get_record();\n if (record_a === null)\n break;\n NR += 1;\n let NF = record_a.length;\n query_context.unnest_list = null; // TODO optimize, don't need to set this every iteration\n try {\n __CODE__\n } catch (e) {\n if (e.constructor.name === 'InternalBadFieldError') {\n throw new RbqlRuntimeError(`No \"a${e.bad_idx + 1}\" field at record ${NR}`);\n } else if (e.constructor.name === 'RbqlParsingError') {\n throw(e);\n } else {\n throw new RbqlRuntimeError(`At record ${NR}, Details: ${e.message}`);\n }\n }\n}\n";function embed_expression(e,t,r){return replace_all(e,t,r)}function embed_code(e,t,r){let n=e.split("\n"),i=r.split("\n");for(let e=0;e<n.length;e++){let r=n[e].indexOf(t);if(-1==r)continue;assert(r%4==0);let o=n[e].substring(0,r);return i=i.map((e=>o+e)),n.slice(0,e).concat(i).concat(n.slice(e+1)).join("\n")+"\n"}assert(!1)}function generate_main_loop_code(e){let t=null!==e.select_expression,r=null!==e.join_map,n=null===e.where_expression?"true":e.where_expression,i=null===e.aggregation_key_expression?"null":e.aggregation_key_expression,o=null===e.sort_key_expression?"null":e.sort_key_expression,a=embed_code(MAIN_LOOP_BODY,"__USER_INIT_CODE__",e.user_init_code);return t?(r?(a=embed_code(embed_code(a,"__CODE__",PROCESS_SELECT_JOIN),"__CODE__",PROCESS_SELECT_COMMON),a=embed_expression(a,"__RBQLMP__lhs_join_var_expression",e.lhs_join_var_expression)):a=embed_code(embed_code(a,"__CODE__",PROCESS_SELECT_SIMPLE),"__CODE__",PROCESS_SELECT_COMMON),a=embed_code(a,"__RBQLMP__variables_init_code",e.variables_init_code),a=embed_expression(a,"__RBQLMP__select_expression",e.select_expression),a=embed_expression(a,"__RBQLMP__where_expression",n),a=embed_expression(a,"__RBQLMP__aggregation_key_expression",i),a=embed_expression(a,"__RBQLMP__sort_key_expression",o)):(r?(a=embed_code(a,"__CODE__",PROCESS_UPDATE_JOIN),a=embed_expression(a,"__RBQLMP__lhs_join_var_expression",e.lhs_join_var_expression)):a=embed_code(a,"__CODE__",PROCESS_UPDATE_SIMPLE),a=embed_code(a,"__RBQLMP__variables_init_code",e.variables_init_code),a=embed_code(a,"__RBQLMP__update_expressions",e.update_expressions),a=embed_expression(a,"__RBQLMP__where_expression",n)),"(async () => {"+a+"})()"}async function compile_and_run(query_context){let main_loop_body=generate_main_loop_code(query_context);try{let main_loop_promise=eval(main_loop_body);await main_loop_promise}catch(e){if(e instanceof SyntaxError){let t=query_context.query_text.toLowerCase();if(-1!=t.indexOf(" having "))throw new SyntaxError(e.message+'\nRBQL doesn\'t support "HAVING" keyword');if(-1!=t.indexOf(" like "))throw new SyntaxError(e.message+"\nRBQL doesn't support \"LIKE\" operator, use like() function instead e.g. ... WHERE like(a1, 'foo%bar') ... ");if(-1!=t.indexOf(" from "))throw new SyntaxError(e.message+'\nTip: If input table is defined by the environment, RBQL query should not have "FROM" keyword');if(e&&e.message&&-1!=String(e.message).toLowerCase().indexOf("unexpected identifier")){if(-1!=t.indexOf(" and "))throw new SyntaxError(e.message+"\nDid you use 'and' keyword in your query?\nJavaScript backend doesn't support 'and' keyword, use '&&' operator instead!");if(-1!=t.indexOf(" or "))throw new SyntaxError(e.message+"\nDid you use 'or' keyword in your query?\nJavaScript backend doesn't support 'or' keyword, use '||' operator instead!")}}if(e&&e.message&&-1!=e.message.indexOf("Received an instance of RBQLAggregationToken"))throw new RbqlParsingError(wrong_aggregation_usage_error);throw e}}const GROUP_BY="GROUP BY",UPDATE="UPDATE",SELECT="SELECT",JOIN="JOIN",INNER_JOIN="INNER JOIN",LEFT_JOIN="LEFT JOIN",LEFT_OUTER_JOIN="LEFT OUTER JOIN",STRICT_LEFT_JOIN="STRICT LEFT JOIN",ORDER_BY="ORDER BY",WHERE="WHERE",LIMIT="LIMIT",EXCEPT="EXCEPT",WITH="WITH";function get_ambiguous_error_msg(e){return`Ambiguous variable name: "${e}" is present both in input and in join tables`}function get_all_matches(e,t){var r=[];let n=null;for(;null!==(n=e.exec(t));)r.push(n);return r}function str_strip(e){return e.replace(/^ +| +$/g,"")}function strip_comments(e){return(e=e.trim()).startsWith("//")?"":e}function combine_string_literals(e,t){for(var r=0;r<t.length;r++)e=replace_all(e,`___RBQL_STRING_LITERAL${r}___`,t[r]);return e}function parse_basic_variables(e,t,r){assert("a"==t||"b"==t);let n=get_all_matches(new RegExp(`(?:^|[^_a-zA-Z0-9])${t}([1-9][0-9]*)(?:$|(?=[^_a-zA-Z0-9]))`,"g"),e);for(let e=0;e<n.length;e++){let i=parseInt(n[e][1]);r[t+String(i)]={initialize:!0,index:i-1}}}function parse_array_variables(e,t,r){assert("a"==t||"b"==t);let n=get_all_matches(new RegExp(`(?:^|[^_a-zA-Z0-9])${t}\\[([1-9][0-9]*)\\]`,"g"),e);for(let e=0;e<n.length;e++){let i=parseInt(n[e][1]);r[`${t}[${i}]`]={initialize:!0,index:i-1}}}function js_string_escape_column_name(e,t){return e=(e=(e=(e=e.replace(/\\/g,"\\\\")).replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace(/\t/g,"\\t"),"'"===t?e.replace(/'/g,"\\'"):'"'===t?e.replace(/"/g,'\\"'):(assert("`"===t),e.replace(/`/g,"\\`"))}function query_probably_has_dictionary_variable(e,t){let r=get_all_matches(new RegExp("[-a-zA-Z0-9_:;+=!.,()%^#@&* ]+","g"),t);for(let t of r)if(-1==e.indexOf(t))return!1;return!0}function parse_dictionary_variables(e,t,r,n){assert("a"===t||"b"===t);let i=new RegExp(`(?:^|[^_a-zA-Z0-9])${t}\\[`);if(-1!=e.search(i))for(let i=0;i<r.length;i++){let o=r[i];if(query_probably_has_dictionary_variable(e,o)){let e=js_string_escape_column_name(o,'"');n[`${t}["${e}"]`]={initialize:!0,index:i},e=js_string_escape_column_name(o,"'"),n[`${t}['${e}']`]={initialize:!1,index:i},e=js_string_escape_column_name(o,"`"),n[`${t}[\`${e}\`]`]={initialize:!1,index:i}}}}function parse_attribute_variables(e,t,r,n,i){assert("a"===t||"b"===t);let o=get_all_matches(new RegExp(`(?:^|[^_a-zA-Z0-9])${t}\\.([_a-zA-Z][_a-zA-Z0-9]*)`,"g"),e).map((e=>e[1]));for(let e of o){let o=r.indexOf(e);if(-1==o)throw new RbqlParsingError(`Unable to find column "${e}" in ${"a"==t?"input":"join"} ${n}`);i[`${t}.${e}`]={initialize:!0,index:o}}}function map_variables_directly(e,t,r){for(let n=0;n<t.length;n++){let i=t[n];if(null===/^[_a-zA-Z][_a-zA-Z0-9]*$/.exec(i))throw new RbqlIOHandlingError(`Unable to use column name "${i}" as RBQL/JS variable`);-1!=e.indexOf(i)&&(r[i]={initialize:!0,index:n})}}function ensure_no_ambiguous_variables(e,t,r){let n=new Set(r);for(let r of t)if(n.has(r)&&-1!=e.indexOf(r))throw new RbqlParsingError(get_ambiguous_error_msg(r))}function parse_join_expression(e){e=str_strip(e);const t="Invalid join syntax. Valid syntax: <JOIN> /path/to/B/table on a... == b... [and a... == b... [and ... ]]";let r=/^ *([^ ]+) +on +/i.exec(e);if(null===r)throw new RbqlParsingError(t);let n=r[1];e=e.substr(r[0].length);let i=[];for(var o=/^([^ =]+) *==? *([^ =]+)/,a=/^ +(and|&&) +/i;;){if(r=o.exec(e),null===r)throw new RbqlParsingError(t);if(i.push([r[1],r[2]]),!(e=e.substr(r[0].length)).length)break;if(r=a.exec(e),null===r)throw new RbqlParsingError(t);e=e.substr(r[0].length)}return[n,i]}function resolve_join_variables(e,t,r,n){let i=[],o=[];const a="Valid JOIN syntax: <JOIN> /path/to/B/table on a... == b... [and a... == b... [and ... ]]";for(let s of r){let[r,l]=s;if(r=combine_string_literals(r,n),l=combine_string_literals(l,n),e.hasOwnProperty(r)&&t.hasOwnProperty(r))throw new RbqlParsingError(get_ambiguous_error_msg(r));if(e.hasOwnProperty(l)&&t.hasOwnProperty(l))throw new RbqlParsingError(get_ambiguous_error_msg(l));e.hasOwnProperty(l)&&([r,l]=[l,r]);let[c,u]=[null,null];if(-1!=["NR","a.NR","aNR"].indexOf(r))c=-1;else{if(!e.hasOwnProperty(r))throw new RbqlParsingError(`Unable to parse JOIN expression: Input table does not have field "${r}"\n${a}`);c=e[r].index}if(-1!=["b.NR","bNR"].indexOf(l))u=-1;else{if(!t.hasOwnProperty(l))throw new RbqlParsingError(`Unable to parse JOIN expression: Join table does not have field "${l}"\n${a}`);u=t[l].index}let p=-1==c?"NR":`safe_join_get(record_a, ${c})`;o.push(u),i.push(p)}return[i,o]}function generate_common_init_code(e,t){assert("a"==t||"b"==t);let r=[];r.push(`${t} = new Object();`);let n="a"==t?"NR":"bNR",i=`${t}.NR`;return-1!=e.indexOf(i)&&r.push(`${i} = ${n};`),"a"==t&&-1!=e.indexOf("aNR")&&r.push("aNR = NR;"),r}function generate_init_statements(e,t,r,n){let i=generate_common_init_code(e,"a"),o=/^[_0-9a-zA-Z]+$/;for(const[e,r]of Object.entries(t))if(r.initialize){let t=o.exec(e)?"var ":"";i.push(`${t}${e} = safe_get(record_a, ${r.index});`)}if(r){i=i.concat(generate_common_init_code(e,"b"));for(const[e,t]of Object.entries(r))if(t.initialize){let r=o.exec(e)?"var ":"";i.push(`${r}${e} = record_b === null ? null : safe_get(record_b, ${t.index});`)}}for(let e=1;e<i.length;e++)i[e]=n+i[e];return i.join("\n")}function replace_star_count(e){return str_strip(e.replace(/(^|,) *COUNT\( *\* *\) *(?:$|(?=,))/gi,"$1 COUNT(1)"))}function replace_star_vars(e){let t=get_all_matches(/(?:^|,) *(\*|a\.\*|b\.\*) *(?=$|,)/g,e),r=0,n="";for(let i of t){let t="]).concat("+{"*":"star_fields","a.*":"record_a","b.*":"record_b"}[i[1]]+").concat([";r<i.index&&(n+=e.substring(r,i.index)),n+=t,r=i.index+i[0].length+1}return n+=e.substring(r),n}function replace_star_vars_for_header_parsing(e){let t=get_all_matches(/(?:(?<=^)|(?<=,)) *(\*|a\.\*|b\.\*) *(?=$|,)/g,e),r=0,n="";for(let i of t){let t={"*":"__RBQL_INTERNAL_STAR","a.*":"a.__RBQL_INTERNAL_STAR","b.*":"b.__RBQL_INTERNAL_STAR"}[i[1]];r<i.index&&(n+=e.substring(r,i.index)),n+=t,r=i.index+i[0].length}return n+=e.substring(r),n}function translate_update_expression(e,t,r,n){let i=`Unable to parse "UPDATE" expression: the expression must start with assignment, but "${str_strip(e.split("=")[0])}" does not look like an assignable field name`,o=/(?:^|,) *(a[.#a-zA-Z0-9\[\]_]*) *=(?=[^=])/g,a=[],s=0;for(;;){let l=o.exec(e);if(0==a.length&&(null===l||0!=l.index))throw new RbqlParsingError(i);if(null===l){a[a.length-1]+=str_strip(e.substr(s))+");";break}a.length&&(a[a.length-1]+=str_strip(e.substring(s,l.index))+");");let c=combine_string_literals(str_strip(l[1]),r);if(!t.hasOwnProperty(c))throw new RbqlParsingError(`Unable to parse "UPDATE" expression: Unknown field name: "${c}"`);let u=t[c].index,p=a.length?n:"";a.push(`${p}safe_set(up_fields, ${u}, `),s=l.index+l[0].length}return combine_string_literals(a.join("\n"),r)}function translate_select_expression(e){let t=replace_star_count(e),r=str_strip(replace_star_vars(t)),n=str_strip(replace_star_vars_for_header_parsing(t));if(!r.length)throw new RbqlParsingError('"SELECT" expression is empty');return[`[].concat([${r}])`,n]}function separate_string_literals(e){for(var t=/('(\\(\\\\)*'|[^'])*')|("(\\(\\\\)*"|[^"])*")|(`(\\(\\\\)*`|[^`])*`)/g,r=null,n=[],i=[],o=0;null!==(r=t.exec(e));){var a=i.length,s=r[0];i.push(s);var l=r.index;n.push(e.substring(o,l)),n.push(`___RBQL_STRING_LITERAL${a}___`),o=t.lastIndex}n.push(e.substring(o));var c=n.join("");return[c=c.replace(/\t/g," "),i]}function locate_statements(e){let t=[];t.push([STRICT_LEFT_JOIN,LEFT_OUTER_JOIN,LEFT_JOIN,INNER_JOIN,JOIN]),t.push([SELECT]),t.push([ORDER_BY]),t.push([WHERE]),t.push([UPDATE]),t.push([GROUP_BY]),t.push([LIMIT]),t.push([EXCEPT]);for(var r=[],n=0;n<t.length;n++)for(var i=0;i<t[n].length;i++){var o=t[n][i],a=get_all_matches(new RegExp("(?:^| )"+replace_all(o," "," *")+"(?= )","ig"),e);if(a.length){if(a.length>1)throw new RbqlParsingError(`More than one "${o}" statements found`);assert(1==a.length);var s=a[0],l=s[0];r.push([s.index,s.index+l.length,o]);break}}return r.sort((function(e,t){return e[0]-t[0]})),r}function separate_actions(e){e=str_strip(e);var t={};let r=/^(.*) *[Ww][Ii][Tt][Hh] *\(([a-z]{4,20})\) *$/.exec(e);null!==r&&(e=r[1],t[WITH]=r[2]);for(var n=locate_statements(e),i=0;i<n.length;i++){var o=n[i][0],a=n[i][1],s=n[i][2],l=i+1<n.length?n[i+1][0]:e.length;assert(o<a),assert(a<=l);var c=e.substring(a,l),u={};if(-1!=[STRICT_LEFT_JOIN,LEFT_OUTER_JOIN,LEFT_JOIN,INNER_JOIN,JOIN].indexOf(s)&&(u.join_subtype=s,s=JOIN),s==UPDATE){if(0!=o)throw new RbqlParsingError("UPDATE keyword must be at the beginning of the query");c=c.replace(/^ *SET/i,"")}if(s==ORDER_BY){var p=(c=c.replace(/ ASC *$/i,"")).replace(/ DESC *$/i,"");p!=c?(c=p,u.reverse=!0):u.reverse=!1}if(s==SELECT){if(0!=o)throw new RbqlParsingError("SELECT keyword must be at the beginning of the query");let e=/^ *TOP *([0-9]+) /i.exec(c);null!==e&&(u.top=parseInt(e[1]),c=c.substr(e.index+e[0].length)),e=/^ *DISTINCT *(COUNT)? /i.exec(c),null!==e&&(u.distinct=!0,e[1]&&(u.distinct_count=!0),c=c.substr(e.index+e[0].length))}u.text=str_strip(c),t[s]=u}if(!t.hasOwnProperty(SELECT)&&!t.hasOwnProperty(UPDATE))throw new RbqlParsingError("Query must contain either SELECT or UPDATE statement");return assert(t.hasOwnProperty(SELECT)!=t.hasOwnProperty(UPDATE)),t}function find_top(e){if(e.hasOwnProperty(LIMIT)){if(null===/^[0-9]+$/.exec(e[LIMIT].text))throw new RbqlParsingError("LIMIT keyword must be followed by an integer");return parseInt(e[LIMIT].text)}var t=e[SELECT];return t&&t.hasOwnProperty("top")?t.top:null}function translate_except_expression(e,t,r,n){let i=e.split(",");i=i.map(str_strip);let o=[];for(let e of i){if(e=combine_string_literals(e,r),!t.hasOwnProperty(e))throw new RbqlParsingError(`Unknown field in EXCEPT expression: "${e}"`);o.push(t[e].index)}return o=o.sort(((e,t)=>e-t)),[null===n?null:select_except(n,o),`select_except(record_a, [${o.join(",")}])`]}class HashJoinMap{constructor(e,t){this.max_record_len=0,this.hash_map=new Map,this.record_iterator=e,this.nr=0,1==t.length?(this.key_index=t[0],this.key_indices=null,this.polymorphic_get_key=this.get_single_key):(this.key_index=null,this.key_indices=t,this.polymorphic_get_key=this.get_multi_key)}get_single_key(e,t){if(this.key_index>=t.length)throw new RbqlRuntimeError(`No field with index ${this.key_index+1} at record ${this.nr} in "B" table`);return-1===this.key_index?this.nr:t[this.key_index]}get_multi_key(e,t){let r=[];for(let e of this.key_indices){if(e>=t.length)throw new RbqlRuntimeError(`No field with index ${e+1} at record ${this.nr} in "B" table`);r.push(-1===e?this.nr:t[e])}return JSON.stringify(r)}async build(){for(;;){let e=await this.record_iterator.get_record();if(null===e)break;this.nr+=1;let t=e.length;this.max_record_len=Math.max(this.max_record_len,t);let r=this.polymorphic_get_key(this.nr,e),n=this.hash_map.get(r);void 0===n?this.hash_map.set(r,[[this.nr,t,e]]):n.push([this.nr,t,e])}}get_join_records(e){let t=this.hash_map.get(e);return void 0===t?[]:t}get_warnings(){return this.record_iterator.get_warnings()}}function cleanup_query(e){return e.split("\n").map(strip_comments).filter((e=>e.length)).join(" ").replace(/;+$/g,"")}function remove_redundant_table_name(e){return e=str_strip(e.replace(/ +from +a(?: +|$)/gi," ")),str_strip(e.replace(/^ *update +a +set /gi,"update "))}function select_output_header(e,t,r){if(null===e&&null===t)return null;null===e&&(e=[]),null===t&&(t=[]);let n=[];for(let i of r)null===i?n.push("col"+(n.length+1)):i.is_star?null===i.table_name?n=n.concat(e).concat(t):"a"===i.table_name?n=n.concat(e):"b"===i.table_name&&(n=n.concat(t)):null!==i.column_name?n.push(i.column_name):null!==i.column_index?"a"==i.table_name&&i.column_index<e.length?n.push(e[i.column_index]):"b"==i.table_name&&i.column_index<t.length?n.push(t[i.column_index]):n.push("col"+(n.length+1)):n.push("col"+(n.length+1));return n}function make_inconsistent_num_fields_warning(e,t){let r=Object.keys(t),n=[];for(let e=0;e<r.length;e++){let i=r[e],o=t[i];n.push([o,i])}n.sort((function(e,t){return e[0]-t[0]})),assert(n.length>1);let[i,o]=n[0],[a,s]=n[1],l=`Number of fields in "${e}" table is not consistent: `;return l+=`e.g. record ${i} -> ${o} fields, record ${a} -> ${s} fields`,l}class RBQLInputIterator{constructor(){}stop(){throw new Error("Unable to call the interface method")}async get_variables_map(e){throw new Error("Unable to call the interface method")}async get_record(){throw new Error("Unable to call the interface method")}handle_query_modifier(){}get_warnings(){return[]}async get_header(){return null}}class RBQLOutputWriter{constructor(){}async write(e){throw new Error("Unable to call the interface method")}async finish(){}get_warnings(){return[]}set_header(){}}class RBQLTableRegistry{constructor(){}get_iterator_by_table_id(e){throw new Error("Unable to call the interface method")}get_warnings(){return[]}}class TableIterator extends RBQLInputIterator{constructor(e,t=null,r=!0,n="a"){super(),this.table=e,this.column_names=t,this.normalize_column_names=r,this.variable_prefix=n,this.nr=0,this.fields_info=new Object,this.stopped=!1}stop(){this.stopped=!0}async get_variables_map(e){let t=new Object;if(parse_basic_variables(e,this.variable_prefix,t),parse_array_variables(e,this.variable_prefix,t),null!==this.column_names){if(this.table.length&&this.column_names.length!=this.table[0].length)throw new RbqlIOHandlingError("List of column names and table records have different lengths");this.normalize_column_names?(parse_dictionary_variables(e,this.variable_prefix,this.column_names,t),parse_attribute_variables(e,this.variable_prefix,this.column_names,"column names list",t)):map_variables_directly(e,this.column_names,t)}return t}async get_record(){if(this.stopped)return null;if(this.nr>=this.table.length)return null;let e=this.table[this.nr];this.nr+=1;let t=e.length;return this.fields_info.hasOwnProperty(t)||(this.fields_info[t]=this.nr),e}get_warnings(){return Object.keys(this.fields_info).length>1?[make_inconsistent_num_fields_warning("input",this.fields_info)]:[]}async get_header(){return this.column_names}}class TableWriter extends RBQLOutputWriter{constructor(e){super(),this.table=e,this.header=null}async write(e){return this.table.push(e),!0}set_header(e){this.header=e}}class SingleTableRegistry extends RBQLTableRegistry{constructor(e,t=null,r=!0,n="b"){super(),this.table=e,this.table_id=n,this.column_names=t,this.normalize_column_names=r}get_iterator_by_table_id(e){if(e.toLowerCase()!==this.table_id)throw new RbqlIOHandlingError(`Unable to find join table: "${e}"`);return new TableIterator(this.table,this.column_names,this.normalize_column_names,"b")}}async function shallow_parse_input_query(e,t,r,n){e=cleanup_query(e);var[i,o]=separate_string_literals(e),a=separate_actions(i=remove_redundant_table_name(i));a.hasOwnProperty(WITH)&&t.handle_query_modifier(a[WITH]);var s=await t.get_variables_map(e);if(a.hasOwnProperty(ORDER_BY)&&a.hasOwnProperty(UPDATE))throw new RbqlParsingError('"ORDER BY" is not allowed in "UPDATE" queries');if(a.hasOwnProperty(GROUP_BY)){if(a.hasOwnProperty(ORDER_BY)||a.hasOwnProperty(UPDATE))throw new RbqlParsingError('"ORDER BY", "UPDATE" and "DISTINCT" keywords are not allowed in aggregate queries');n.aggregation_key_expression="["+combine_string_literals(a[GROUP_BY].text,o)+"]"}let l=null,c=null;if(a.hasOwnProperty(JOIN)){var[u,p]=parse_join_expression(a[JOIN].text);if(null===r)throw new RbqlParsingError("JOIN operations are not supported by the application");let t=r.get_iterator_by_table_id(u);if(!t)throw new RbqlParsingError(`Unable to find join table: "${u}"`);a.hasOwnProperty(WITH)&&t.handle_query_modifier(a[WITH]),l=await t.get_variables_map(e),c=await t.get_header();let[i,_]=resolve_join_variables(s,l,p,o),f={JOIN:InnerJoiner,"INNER JOIN":InnerJoiner,"LEFT JOIN":LeftJoiner,"LEFT OUTER JOIN":LeftJoiner,"STRICT LEFT JOIN":StrictLeftJoiner}[a[JOIN].join_subtype];n.lhs_join_var_expression=1==i.length?i[0]:"JSON.stringify(["+i.join(",")+"])",n.join_map_impl=new HashJoinMap(t,_),await n.join_map_impl.build(),n.join_map=new f(n.join_map_impl)}if(n.variables_init_code=combine_string_literals(generate_init_statements(i,s,l," ".repeat(4)),o),a.hasOwnProperty(WHERE)){var _=a[WHERE].text;if(/[^><!=]=[^=]/.exec(_))throw new RbqlParsingError('Assignments "=" are not allowed in "WHERE" expressions. For equality test use "==" or "==="');n.where_expression=combine_string_literals(_,o)}let f=await t.get_header();if(a.hasOwnProperty(UPDATE)){var h=translate_update_expression(a[UPDATE].text,s,o," ".repeat(8));n.update_expressions=combine_string_literals(h,o),n.writer.set_header(f)}if(a.hasOwnProperty(SELECT)){if(n.top_count=find_top(a),a.hasOwnProperty(EXCEPT)){let[e,t]=translate_except_expression(a[EXCEPT].text,s,o,f);n.select_expression=t,n.writer.set_header(e)}else{let[e,t]=translate_select_expression(a[SELECT].text);n.select_expression=combine_string_literals(e,o);let r=select_output_header(f,c,adhoc_parse_select_expression_to_column_infos(t,o));n.writer.set_header(r)}n.writer=new TopWriter(n.writer,n.top_count),a[SELECT].hasOwnProperty("distinct_count")?n.writer=new UniqCountWriter(n.writer):a[SELECT].hasOwnProperty("distinct")&&(n.writer=new UniqWriter(n.writer))}if(a.hasOwnProperty(ORDER_BY)){n.sort_key_expression=combine_string_literals(a[ORDER_BY].text,o);let e=a[ORDER_BY].reverse;n.writer=new SortedWriter(n.writer,e)}}async function query(e,t,r,n,i=null,o=""){query_context=new RBQLContext(e,t,r,o),await shallow_parse_input_query(e,t,i,query_context),await compile_and_run(query_context),await query_context.writer.finish(),n.push(...t.get_warnings()),query_context.join_map_impl&&n.push(...query_context.join_map_impl.get_warnings()),n.push(...r.get_warnings())}async function query_table(e,t,r,n,i=null,o=null,a=null,s=null,l=!0,c=""){l||null===o||null===a||ensure_no_ambiguous_variables(e,o,a);let u=new TableIterator(t,o,l),p=new TableWriter(r),_=null===i?null:new SingleTableRegistry(i,a,l);if(await query(e,u,p,n,_,c),null!==s&&(assert(0==s.length,"`output_column_names` param must be an empty list or null"),null!==p.header))for(let e of p.header)s.push(e)}function exception_to_error_info(e){let t={RbqlRuntimeError:"query execution",RbqlParsingError:"query parsing",SyntaxError:"JS syntax error",RbqlIOHandlingError:"IO handling"},r="unexpected";return e.constructor&&e.constructor.name&&t.hasOwnProperty(e.constructor.name)&&(r=t[e.constructor.name]),[r,e.hasOwnProperty("message")?e.message:String(e)]}exports.query=query,exports.query_table=query_table,exports.RBQLInputIterator=RBQLInputIterator,exports.RBQLOutputWriter=RBQLOutputWriter,exports.RBQLTableRegistry=RBQLTableRegistry,exports.version=RBQL_VERSION,exports.TableIterator=TableIterator,exports.TableWriter=TableWriter,exports.SingleTableRegistry=SingleTableRegistry,exports.exception_to_error_info=exception_to_error_info,exports.parse_basic_variables=parse_basic_variables,exports.parse_array_variables=parse_array_variables,exports.parse_dictionary_variables=parse_dictionary_variables,exports.parse_attribute_variables=parse_attribute_variables,exports.get_all_matches=get_all_matches,exports.strip_comments=strip_comments,exports.separate_actions=separate_actions,exports.separate_string_literals=separate_string_literals,exports.combine_string_literals=combine_string_literals,exports.parse_join_expression=parse_join_expression,exports.resolve_join_variables=resolve_join_variables,exports.translate_update_expression=translate_update_expression,exports.translate_select_expression=translate_select_expression,exports.translate_except_expression=translate_except_expression,exports.like_to_regex=like_to_regex,exports.adhoc_parse_select_expression_to_column_infos=adhoc_parse_select_expression_to_column_infos,exports.replace_star_count=replace_star_count,exports.replace_star_vars_for_header_parsing=replace_star_vars_for_header_parsing,exports.select_output_header=select_output_header})(exports)},371:(e,t,r)=>{var n=r(4155);const i=r(1606),o=r(4704),a=r(9426),s=r(9539),l=r(6987),c=r(8594),u="Unable to decode input table as UTF-8. Use binary (latin-1) encoding instead";class p extends Error{}class _ extends Error{}function f(e,t=null){if(!e)throw t||(t="Assertion error"),new _(t)}function h(e){return/^[\x00-\x7F]*$/.test(e)}function d(e){return i.readFileSync(e,"utf-8")}function g(e,t){var r,n="~"===(r=t).charAt(0)?a.join(o.homedir(),r.slice(1)):r;if(i.existsSync(n))return n;if(e&&!a.isAbsolute(n)&&(n=a.join(e,n),i.existsSync(n)))return n;var s=function(e,t){for(var r=function(e){var t=null;try{t=i.readFileSync(e,"utf-8")}catch(e){return[]}for(var r=t.split("\n"),n=[],o=0;o<r.length;o++)if(r[o]){var a=r[o].split("\t");n.push(a)}return n}(e),n=0;n<r.length;n++)if(r[n].length&&r[n][0]==t)return r[n];return null}(a.join(o.homedir(),".rbql_table_names"),t);return s&&s.length>1&&i.existsSync(s[1])?s[1]:null}class y{constructor(){this.push_stack=[],this.pull_stack=[]}enqueue(e){this.push_stack.push(e)}dequeue(){if(!this.pull_stack.length){if(!this.push_stack.length)return null;this.pull_stack=this.push_stack,this.pull_stack.reverse(),this.push_stack=[]}return this.pull_stack.pop()}}class m extends l.RBQLInputIterator{constructor(e,t,r,n,i,o=!1,a=null,l="input",c="a"){super(),this.stream=e,this.csv_path=t,f(null===this.stream!=(null===this.csv_path)),this.encoding=r,this.delim=n,this.policy=i,this.has_header=o,this.first_record=null,this.first_record_should_be_emitted=!o,this.header_preread_complete=!1,this.table_name=l,this.variable_prefix=c,this.comment_prefix=null!==a&&a.length?a:null,this.decoder=null,"utf-8"==r&&null===this.csv_path&&(this.decoder=new s.TextDecoder(r,{fatal:!0,stream:!0})),this.input_exhausted=!1,this.started=!1,this.utf8_bom_removed=!1,this.first_defective_line=null,this.fields_info=new Object,this.NR=0,this.NL=0,this.rfc_line_buffer=[],this.partially_decoded_line="",this.partially_decoded_line_ends_with_cr=!1,this.resolve_current_record=null,this.reject_current_record=null,this.current_exception=null,this.produced_records_queue=new y,this.process_line_polymorphic="quoted_rfc"==i?this.process_partial_rfc_record_line:this.process_record_line}handle_query_modifier(e){-1!=["header","headers"].indexOf(e)&&(this.has_header=!0,this.first_record_should_be_emitted=!1),-1!=["noheader","noheaders"].indexOf(e)&&(this.has_header=!1,this.first_record_should_be_emitted=!0)}reset_external_callbacks(){this.reject_current_record=null,this.resolve_current_record=null}try_propagate_exception(){if(this.current_exception&&this.reject_current_record){let e=this.reject_current_record,t=this.current_exception;this.reset_external_callbacks(),this.current_exception=null,e(t)}}store_or_propagate_exception(e){null===this.current_exception&&(this.current_exception=e),this.try_propagate_exception()}async preread_first_record(){this.header_preread_complete||(this.first_record=await this.get_record(),this.header_preread_complete=!0,null!==this.first_record&&(this.stream&&this.stream.pause(),this.first_record=this.first_record.slice()))}async get_variables_map(e){let t=new Object;return l.parse_basic_variables(e,this.variable_prefix,t),l.parse_array_variables(e,this.variable_prefix,t),await this.preread_first_record(),this.has_header&&this.first_record&&(l.parse_attribute_variables(e,this.variable_prefix,this.first_record,"CSV header line",t),l.parse_dictionary_variables(e,this.variable_prefix,this.first_record,t)),t}async get_header(){return await this.preread_first_record(),this.has_header?this.first_record:null}try_resolve_next_record(){if(this.try_propagate_exception(),null===this.resolve_current_record)return;let e=null;if(this.first_record_should_be_emitted&&this.header_preread_complete?(this.first_record_should_be_emitted=!1,e=this.first_record):e=this.produced_records_queue.dequeue(),null===e&&!this.input_exhausted)return;let t=this.resolve_current_record;this.reset_external_callbacks(),t(e)}async get_record(){this.started||await this.start(),this.stream&&this.stream.isPaused()&&this.stream.resume();let e=this,t=new Promise((function(t,r){e.resolve_current_record=t,e.reject_current_record=r}));return this.try_resolve_next_record(),t}async get_all_records(e=null){let t=[];for(;;){let r=await this.get_record();if(null===r)break;if(t.push(r),e&&t.length>=e){this.stop();break}}return t}process_record_line(e){if(null!==this.comment_prefix&&e.startsWith(this.comment_prefix))return;this.NR+=1;var[t,r]=c.smart_split(e,this.delim,this.policy,!1);r&&null===this.first_defective_line&&(this.first_defective_line=this.NL,"quoted_rfc"==this.policy&&this.store_or_propagate_exception(new p(`Inconsistent double quote escaping in ${this.table_name} table at record ${this.NR}, line ${this.NL}`)));let n=t.length;this.fields_info.hasOwnProperty(n)||(this.fields_info[n]=this.NR),this.produced_records_queue.enqueue(t),this.try_resolve_next_record()}process_partial_rfc_record_line(e){let t=c.accumulate_rfc_line_into_record(this.rfc_line_buffer,e,this.comment_prefix);null!==t&&this.process_record_line(t)}process_line(e){if(this.NL+=1,1===this.NL){var t=function(e,t){return"binary"==t&&e.length>=3&&239===e.charCodeAt(0)&&187===e.charCodeAt(1)&&191===e.charCodeAt(2)?e.substring(3):"utf-8"==t&&e.length>=1&&65279===e.charCodeAt(0)?e.substring(1):e}(e,this.encoding);t!=e&&(e=t,this.utf8_bom_removed=!0)}this.process_line_polymorphic(e)}process_data_stream_chunk(e){let t=null;if(this.decoder)try{t=this.decoder.decode(e)}catch(e){return void(e instanceof TypeError?this.store_or_propagate_exception(new p(u)):this.store_or_propagate_exception(e))}else t=e.toString(this.encoding);let r=t.length&&"\n"==t[0]&&this.partially_decoded_line_ends_with_cr?1:0;this.partially_decoded_line_ends_with_cr=t.length&&"\r"==t[t.length-1];let n=c.split_lines(t);n[0]=this.partially_decoded_line+n[0],f(0==r||0==n[0].length),this.partially_decoded_line=n.pop();for(let e=r;e<n.length;e++)this.process_line(n[e])}process_data_bulk(e){let t=e.toString(this.encoding);if("utf-8"==this.encoding){let r=Buffer.from(t,"utf-8");if(0!=Buffer.compare(e,r))return void this.store_or_propagate_exception(new p(u))}let r=c.split_lines(t);r.length&&0==r[r.length-1].length&&r.pop();for(let e=0;e<r.length;e++)this.process_line(r[e]);this.rfc_line_buffer.length>0&&this.process_record_line(this.rfc_line_buffer.join("\n")),this.input_exhausted=!0,this.try_resolve_next_record()}process_data_stream_end(){if(this.input_exhausted=!0,this.partially_decoded_line.length){let e=this.partially_decoded_line;this.partially_decoded_line="",this.process_line(e)}this.rfc_line_buffer.length>0&&this.process_record_line(this.rfc_line_buffer.join("\n")),this.try_resolve_next_record()}stop(){this.stream&&this.stream.destroy()}async start(){if(!this.started){if(this.started=!0,!this.stream){let e=this;return new Promise((function(t,r){i.readFile(e.csv_path,((n,i)=>{n?r(n):(e.process_data_bulk(i),t())}))}))}this.stream.on("data",(e=>{this.process_data_stream_chunk(e)})),this.stream.on("end",(()=>{this.process_data_stream_end()}))}}get_warnings(){let e=[];return null!==this.first_defective_line&&e.push(`Inconsistent double quote escaping in ${this.table_name} table. E.g. at line ${this.first_defective_line}`),this.utf8_bom_removed&&e.push(`UTF-8 Byte Order Mark (BOM) was found and skipped in ${this.table_name} table`),Object.keys(this.fields_info).length>1&&e.push(function(e,t){let r=Object.keys(t),n=[];for(let e=0;e<r.length;e++){let i=r[e],o=t[i];n.push([o,i])}n.sort((function(e,t){return e[0]-t[0]})),f(n.length>1);let[i,o]=n[0],[a,s]=n[1],l=`Number of fields in "${e}" table is not consistent: `;return l+=`e.g. record ${i} -> ${o} fields, record ${a} -> ${s} fields`,l}(this.table_name,this.fields_info)),e}}class b extends l.RBQLOutputWriter{constructor(e,t,r,n,i,o="\n"){if(super(),this.stream=e,this.encoding=r,r&&this.stream.setDefaultEncoding(r),this.stream.on("error",(e=>{this.store_first_error(e)})),this.delim=n,this.policy=i,this.line_separator=o,this.sub_array_delim="|"==n?";":"|",this.close_stream_on_finish=t,this.null_in_output=!1,this.delim_in_simple_output=!1,this.header_len=null,this.first_error=null,"simple"==i)this.polymorphic_join=this.simple_join;else if("quoted"==i)this.polymorphic_join=this.quoted_join;else if("quoted_rfc"==i)this.polymorphic_join=this.quoted_join_rfc;else if("monocolumn"==i)this.polymorphic_join=this.mono_join;else{if("whitespace"!=i)throw new p("Unknown output csv policy");this.polymorphic_join=this.simple_join}}store_first_error(e){null===this.first_error&&(this.first_error=e)}set_header(e){null!==e&&(this.header_len=e.length,this.write(e))}quoted_join(e){let t=this.delim;return e.map((function(e){return c.quote_field(String(e),t)})).join(this.delim)}quoted_join_rfc(e){let t=this.delim;return e.map((function(e){return c.rfc_quote_field(String(e),t)})).join(this.delim)}mono_join(e){if(e.length>1)throw new p('Unable to use "Monocolumn" output format: some records have more than one field');return e[0]}simple_join(e){var t=e.join(this.delim);return-1!=e.join("").indexOf(this.delim)&&(this.delim_in_simple_output=!0),t}normalize_fields(e){for(var t=0;t<e.length;t++)null==e[t]?(this.null_in_output=!0,e[t]=""):Array.isArray(e[t])&&(this.normalize_fields(e[t]),e[t]=e[t].join(this.sub_array_delim))}async write(e){if(null!==this.header_len&&e.length!=this.header_len)throw new p(`Inconsistent number of columns in output header and the current record: ${this.header_len} != ${e.length}`);this.normalize_fields(e),this.stream.write(this.polymorphic_join(e)),this.stream.write(this.line_separator);let t=this.first_error;return new Promise((function(e,r){null!==t?r(t):e(!0)}))}_write_all(e){for(let t=0;t<e.length;t++)this.write(e[t])}async finish(){let e=this.close_stream_on_finish,t=this.stream,r=this.encoding,n=this.first_error;return new Promise((function(i,o){null!==n&&o(n),e?t.end("",r,(()=>{i()})):setTimeout((()=>{i()}),0)}))}get_warnings(){let e=[];return this.null_in_output&&e.push("null values in output were replaced by empty strings"),this.delim_in_simple_output&&e.push("Some output fields contain separator"),e}}class w extends l.RBQLTableRegistry{constructor(e,t,r,n,i=!1,o=null,a=null){super(),this.input_file_dir=e,this.delim=t,this.policy=r,this.encoding=n,this.has_header=i,this.comment_prefix=o,this.stream=null,this.record_iterator=null,this.options=a,this.bulk_input_path=null,this.table_path=null}get_iterator_by_table_id(e){if(this.table_path=g(this.input_file_dir,e),null===this.table_path)throw new p(`Unable to find join table "${e}"`);return this.options&&this.options.bulk_read?this.bulk_input_path=this.table_path:this.stream=i.createReadStream(this.table_path),this.record_iterator=new m(this.stream,this.bulk_input_path,this.encoding,this.delim,this.policy,this.has_header,this.comment_prefix,e,"b"),this.record_iterator}get_warnings(e){this.record_iterator&&this.has_header&&e.push(`The first record in JOIN file ${a.basename(this.table_path)} was also treated as header (and skipped)`)}}e.exports.is_ascii=h,e.exports.CSVRecordIterator=m,e.exports.CSVWriter=b,e.exports.FileSystemCSVRegistry=w,e.exports.interpret_named_csv_format=function(e){if("monocolumn"==(e=e.toLowerCase()))return["","monocolumn"];if("csv"==e)return[",","quoted"];if("tsv"==e)return["\t","simple"];throw new p(`Unknown format name: "${e}"`)},e.exports.read_user_init_code=d,e.exports.query_csv=async function(e,t,r,s,c,u,_,f,g,y=!1,x=null,v="",E=null){let O=null,j=null;E&&E.bulk_read&&t?j=t:O=null===t?n.stdin:i.createReadStream(t);let[S,R]=null===c?[n.stdout,!1]:[i.createWriteStream(c),!0];if('"'==r&&"quoted"==s)throw new p('Double quote delimiter is incompatible with "quoted" policy');if("latin-1"==f&&(f="binary"),!h(e)&&"binary"==f)throw new p("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");if(!(h(r)&&h(u)||"binary"!=f))throw new p("To use non-ascii characters in query enable UTF-8 encoding instead of latin-1/binary");let A=a.join(o.homedir(),".rbql_init_source.js");""==v&&i.existsSync(A)&&(v=d(A));let q=t?a.dirname(t):null,T=new w(q,r,s,f,y,x,E),k=new m(O,j,f,r,s,y,x),P=new b(S,R,f,u,_);await l.query(e,k,P,g,T,v),T.get_warnings(g)},e.exports.RecordQueue=y,e.exports.exception_to_error_info=l.exception_to_error_info},9496:e=>{"use strict";e.exports=require("vscode")},1606:()=>{},4704:()=>{},9426:()=>{},7666:()=>{},5174:()=>{},4949:()=>{},7857:()=>{},8391:()=>{},3083:(e,t,r)=>{"use strict";var n=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],i="undefined"==typeof globalThis?r.g:globalThis;e.exports=function(){for(var e=[],t=0;t<n.length;t++)"function"==typeof i[n[t]]&&(e[e.length]=n[t]);return e}},882:(e,t,r)=>{"use strict";var n=r(210)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(e){n=null}e.exports=n}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](r,r.exports,__webpack_require__),r.exports}__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();var __webpack_exports__={};(()=>{var e=__webpack_exports__;const t=__webpack_require__(9282),r=__webpack_require__(7666),n=__webpack_require__(9496),i=__webpack_require__(45),o=void 0===r.homedir,a=6e3;function s(e){return new Promise((t=>setTimeout(t,e)))}function l(e){console.log("###RAINBOW_CSV_UNIT_TEST_MESSAGE### "+e)}e.run=async function(){try{l("Starting tests"),t.equal(-1,[1,2,3].indexOf(0)),t(n.workspace.workspaceFolders),t.equal(1,n.workspace.workspaceFolders.length);let e=n.workspace.workspaceFolders[0].uri;if(await(function(){let e="foobar",r=0,n=[5,2,3];i.update_subcomponent_stats(e,r,n),t.deepEqual(n,[6,-1,-1]),e="foobar",r=1,n=[0,0,0],i.update_subcomponent_stats(e,r,n),t.deepEqual(n,[6,0,0]),e="100000",r=0,n=[2,-1,-1],i.update_subcomponent_stats(e,r,n),t.deepEqual(n,[6,-1,-1]),e="",r=0,n=[5,2,3],i.update_subcomponent_stats(e,r,n),t.deepEqual(n,[5,2,3]),e="100.3",r=0,n=[7,4,3],i.update_subcomponent_stats(e,r,n),t.deepEqual(n,[7,4,3]),e="100000",r=0,n=[5,2,3],i.update_subcomponent_stats(e,r,n),t.deepEqual(n,[6,6,3]),e="1000.23",r=0,n=[3,3,0],i.update_subcomponent_stats(e,r,n),t.deepEqual(n,[7,4,3])}(),function(){let e="foobar",r=0,n=[10,-1,-1];n=i.adjust_column_stats([n])[0];let o=0,a=i.align_field(e,r,n,o);t.deepEqual("foobar ",a),e="foobar",r=0,n=[10,-1,-1],n=i.adjust_column_stats([n])[0],o=1,a=i.align_field(e,r,n,o),t.deepEqual("foobar",a),e="foobar",r=1,n=[10,4,6],n=i.adjust_column_stats([n])[0],o=0,a=i.align_field(e,r,n,o),t.deepEqual("foobar ",a),e="10.1",r=1,n=[10,4,6],n=i.adjust_column_stats([n])[0],o=0,a=i.align_field(e,r,n,o),t.deepEqual(" 10.1 ",a),e="10.1",r=1,n=[10,-1,-1],n=i.adjust_column_stats([n])[0],o=0,a=i.align_field(e,r,n,o),t.deepEqual("10.1 ",a),e="10.1",r=0,n=[10,-1,-1],n=i.adjust_column_stats([n])[0],o=0,a=i.align_field(e,r,n,o),t.deepEqual("10.1 ",a),e="10.1",r=0,n=[10,4,6],n=i.adjust_column_stats([n])[0],o=0,a=i.align_field(e,r,n,o),t.deepEqual(" 10.1 ",a),e="10.1",r=0,n=[10,4,6],n=i.adjust_column_stats([n])[0],o=1,a=i.align_field(e,r,n,o),t.deepEqual(" 10.1",a),e="1000",r=0,n=[10,4,6],n=i.adjust_column_stats([n])[0],o=0,a=i.align_field(e,r,n,o),t.deepEqual("1000 ",a),e="1000",r=0,n=[10,4,6],n=i.adjust_column_stats([n])[0],o=1,a=i.align_field(e,r,n,o),t.deepEqual("1000",a),e="1000",r=0,n=[4,4,0],n=i.adjust_column_stats([n])[0],o=0,a=i.align_field(e,r,n,o),t.deepEqual("1000 ",a),e="1000",r=0,n=[6,4,0],n=i.adjust_column_stats([n])[0],o=0,a=i.align_field(e,r,n,o),t.deepEqual(" 1000 ",a),e="10.1",r=0,n=[12,4,6],n=i.adjust_column_stats([n])[0],o=0,a=i.align_field(e,r,n,o),t.deepEqual(" 10.1 ",a)}(),void function(){let e=[10,-1,-1],r=i.adjust_column_stats([e])[0];t.deepEqual([10,-1,-1],r),e=[10,0,0],r=i.adjust_column_stats([e])[0],t.deepEqual([10,-1,-1],r),e=[5,4,3],r=i.adjust_column_stats([e])[0],t.deepEqual([7,4,3],r),e=[10,4,3],r=i.adjust_column_stats([e])[0],t.deepEqual([10,7,3],r)}()),await async function(e){let r=n.Uri.joinPath(e,"test","csv_files","lorem_ipsum.txt"),i=await n.workspace.openTextDocument(r);l(`languageId for lorem_ipsum.txt: ${i.languageId}`),t.equal(i.languageId,"plaintext");let o=await n.window.showTextDocument(i);await s(1e3),r=n.Uri.joinPath(e,"test","suite","index.js"),i=await n.workspace.openTextDocument(r),l(`languageId for index.js: ${i.languageId}`),t.equal(i.languageId,"javascript"),o=await n.window.showTextDocument(i),await s(1e3),r=n.Uri.joinPath(e,"test","csv_files","lorem_ipsum"),i=await n.workspace.openTextDocument(r),l(`languageId for lorem_ipsum: ${i.languageId}`),t.equal(i.languageId,"plaintext"),o=await n.window.showTextDocument(i),await s(1e3)}(e),!o){let e=await n.commands.executeCommand("rainbow-csv.InternalTest",{check_initialization_state:!0});t(e.initialized),t(!e.lazy_loaded)}if(await async function(e){let r=n.Uri.joinPath(e,"test","csv_files","university_ranking_semicolon.txt"),i=await n.workspace.openTextDocument(r);await n.window.showTextDocument(i),l(`languageId for university_ranking_semicolon.txt: ${i.languageId}`),t.equal(i.languageId,"csv (semicolon)"),await s(1e3)}(e),await async function(e){let r=n.Uri.joinPath(e,"test","csv_files","small_movies.pipe"),i=await n.workspace.openTextDocument(r);l(`languageId for small_movies.pipe: ${i.languageId}`),t.equal(i.languageId,"plaintext"),await n.window.showTextDocument(i),await s(1e3);for(let e=0;e<6;e++)await n.commands.executeCommand("cursorRight");await n.commands.executeCommand("cursorRightSelect"),await s(1e3),await n.commands.executeCommand("rainbow-csv.RainbowSeparator"),await s(2e3),l(`languageId for small_movies.pipe after RainbowSeparator: ${i.languageId}`),t.equal(i.languageId,"csv (pipe)"),await n.commands.executeCommand("rainbow-csv.RainbowSeparatorOff"),await s(2e3),l(`languageId for small_movies.pipe after RainbowSeparatorOff: ${i.languageId}`),t.equal(i.languageId,"plaintext"),await s(1e3)}(e),!o){let e=await n.commands.executeCommand("rainbow-csv.InternalTest",{check_initialization_state:!0});t(e.initialized),t(!e.lazy_loaded)}if(o?await async function(e){let r=n.Uri.joinPath(e,"test","csv_files","university_ranking.csv"),i=await n.workspace.openTextDocument(r),o=await n.window.showTextDocument(i);await s(1e3);let c={rbql_backend:"js",with_headers:!0,rbql_query:"select top 20 a1, Math.ceil(parseFloat(a.total_score) * 100), a['university_name'], null, 'foo bar' order by a2"};await n.commands.executeCommand("rainbow-csv.RBQL",c),await s(a);let u=await n.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_warnings:!0});t.equal('["null values in output were replaced by empty strings"]',JSON.stringify(u.warnings)),i=n.window.activeTextEditor.document;let p=i.getText().length;l(`Length after first js query: ${p}`),t.equal(846,p),c={rbql_backend:"js",rbql_query:"select a2 * 10, a3, a3.length where NR > 1 order by a3.length limit 10"},await n.commands.executeCommand("rainbow-csv.RBQL",c),await s(a),i=n.window.activeTextEditor.document,p=i.getText().length,l(`Length after second js query: ${p}`),t.equal(267,p),c={rbql_backend:"js",rbql_query:"select nonexistent_function(a1)"},await n.commands.executeCommand("rainbow-csv.RBQL",c),await s(a),u=await n.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_report:!0}),t.equal("query execution",u.error_type),t.equal("At record 1, Details: nonexistent_function is not defined",u.error_msg),l("Starting multiline records test"),r=n.Uri.joinPath(e,"test","csv_files","synthetic_rfc_newline_data.csv"),i=await n.workspace.openTextDocument(r),o=await n.window.showTextDocument(i),await s(1e3),c={rbql_backend:"js",rbql_query:"select '<<<<<', a3, a2, a1, '>>>>> NR: ' + NR",enable_rfc_newlines:!0},await n.commands.executeCommand("rainbow-csv.RBQL",c),await s(a),i=n.window.activeTextEditor.document,p=i.getText().length,l(`Length after js multiline-record query: ${p}`),t.equal(644,p)}(e):await async function(e){let r=n.Uri.joinPath(e,"test","csv_files","university_ranking.csv"),i=await n.workspace.openTextDocument(r),o=await n.window.showTextDocument(i);await s(1e3);let c={rbql_backend:"python",with_headers:!0,rbql_query:"select top 20 a1, math.ceil(float(a.total_score) * 100), a['university_name'], None, 'foo bar' order by a2"};await n.commands.executeCommand("rainbow-csv.RBQL",c),await s(a);let u=await n.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_warnings:!0});t.equal('["None values in output were replaced by empty strings"]',JSON.stringify(u.warnings)),i=n.window.activeTextEditor.document;let p=i.getText().length;l(`Length after python query: ${p}`),t.equal(868,p),c={rbql_backend:"js",rbql_query:"select a2 * 10, a3, a3.length where NR > 1 order by a3.length limit 10"},await n.commands.executeCommand("rainbow-csv.RBQL",c),await s(a),i=n.window.activeTextEditor.document,p=i.getText().length,l(`Length after js query: ${p}`),t.equal(268,p),c={rbql_backend:"python",rbql_query:"select nonexistent_function(a1)"},await n.commands.executeCommand("rainbow-csv.RBQL",c),await s(a),u=await n.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_report:!0}),t.equal("query execution",u.error_type),t.equal("At record 1, Details: name 'nonexistent_function' is not defined",u.error_msg),r=n.Uri.joinPath(e,"test","csv_files","synthetic_rfc_newline_data.csv"),i=await n.workspace.openTextDocument(r),o=await n.window.showTextDocument(i),await s(1e3),c={rbql_backend:"js",rbql_query:"select '<<<<<', a3, a2, a1, '>>>>> NR: ' + NR",enable_rfc_newlines:!0},await n.commands.executeCommand("rainbow-csv.RBQL",c),await s(a),i=n.window.activeTextEditor.document,p=i.getText().length,l(`Length after js multiline-record query: ${p}`),t.equal(645,p),r=n.Uri.joinPath(e,"test","csv_files","university_ranking.csv"),i=await n.workspace.openTextDocument(r),o=await n.window.showTextDocument(i),await s(1e3),c={rbql_backend:"python",with_headers:!0,rbql_query:"select a.university_name, b.Country, b.Population, b['GDP per capita'] JOIN countries.csv on a.country == b.Country order by int(b.Population) desc"},await n.commands.executeCommand("rainbow-csv.RBQL",c),await s(a),u=await n.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_warnings:!0}),t.equal('["The first record in JOIN file countries.csv was also treated as header (and skipped)"]',JSON.stringify(u.warnings)),i=n.window.activeTextEditor.document,p=i.getText().length,l(`Length after join query: ${p}`),t.equal(11592,p),t.equal(202,i.lineCount),r=n.Uri.joinPath(e,"test","csv_files","countries.csv"),i=await n.workspace.openTextDocument(r);let _=i.fileName,f=i.getText().length;o=await n.window.showTextDocument(i),t(-1==i.getText().indexOf("oceania")),t(i.getText().indexOf("OCEANIA")>0),await s(1e3),c={rbql_backend:"python",with_headers:!0,rbql_query:"UPDATE set a.Region = a.Region.lower()"},await n.commands.executeCommand("rainbow-csv.RBQL",c),await s(a),u=await n.commands.executeCommand("rainbow-csv.InternalTest",{check_last_rbql_warnings:!0}),t.equal("[]",JSON.stringify(u.warnings)),i=n.window.activeTextEditor.document,i.fileName,p=i.getText().length,l(`Length after update query: ${p}`),t.equal(f,p-i.lineCount+1),t(-1==i.getText().indexOf("OCEANIA")),t(i.getText().indexOf("oceania")>0),await s(1e3),await n.commands.executeCommand("rainbow-csv.CopyBack"),await s(1e3),i=await n.workspace.openTextDocument(r);let h=i.fileName;t.equal(_,h),t(-1==i.getText().indexOf("OCEANIA")),t(i.getText().indexOf("oceania")>0)}(e),!o){let e=await n.commands.executeCommand("rainbow-csv.InternalTest",{check_initialization_state:!0});t(e.initialized),t(e.lazy_loaded)}await async function(e){let r=n.Uri.joinPath(e,"test","csv_files","university_ranking.csv"),i=await n.workspace.openTextDocument(r),o=(await n.window.showTextDocument(i),i.getText().length);l(`Original length: ${o}`),t.equal(12538,o),await s(2e3),await n.commands.executeCommand("rainbow-csv.Align");let a=i.getText().length;l(`Aligned length: ${a}`),t.equal(25896,a),t(a>o);let c=await n.commands.executeCommand("rainbow-csv.CSVLint");t.equal(c,"OK"),await s(2e3),await n.commands.executeCommand("rainbow-csv.Shrink");let u=i.getText().length;l(`Shrinked length: ${u}`),t.equal(o,u),await s(500);let p="foobar,";await n.commands.executeCommand("default:type",{text:p}),c=await n.commands.executeCommand("rainbow-csv.CSVLint"),t(-1!=c.indexOf("Number of fields is not consistent")),await s(500);for(let e=0;e<p.length;e++)await n.commands.executeCommand("deleteLeft");await s(500)}(e),await async function(e){let r=n.Uri.joinPath(e,"test","csv_files","movies.txt"),i=await n.workspace.openTextDocument(r),o=(await n.window.showTextDocument(i),i.getText().length);t.equal(9986,o);for(let e=0;e<10;e++)await n.commands.executeCommand("cursorRight");await s(1e3),await n.commands.executeCommand("rainbow-csv.ColumnEditAfter"),await s(1e3);let a="foobar,";await n.commands.executeCommand("default:type",{text:a});let l=i.getText().length;t.equal(o+i.lineCount*a.length,l),await s(1e3);for(let e=0;e<a.length;e++)await n.commands.executeCommand("deleteLeft");await s(1e3);let c=i.getText().length;t.equal(o,c)}(e),l("Finishing tests")}catch(e){l("Error: tests have failed. Exception:"),l(String(e)),l(String(e.stack))}}})();var __webpack_export_target__=exports;for(var i in __webpack_exports__)__webpack_export_target__[i]=__webpack_exports__[i];__webpack_exports__.__esModule&&Object.defineProperty(__webpack_export_target__,"__esModule",{value:!0})})();