diff --git a/packages/bruno-cli/src/runner/run-single-request.js b/packages/bruno-cli/src/runner/run-single-request.js index 7ebad6b2f..f7e55afb1 100644 --- a/packages/bruno-cli/src/runner/run-single-request.js +++ b/packages/bruno-cli/src/runner/run-single-request.js @@ -42,7 +42,7 @@ const runSingleRequest = async function ( // todo: allow to override from cli args // we will default to vm2 (developer-mode) for 1.x version for backward compatibility // 2.x will default to isolated-vm (safe mode) - scriptingConfig.runtime = 'isolated-vm'; + scriptingConfig.runtime = 'quickjs'; // make axios work in node using form data // reference: https://github.com/axios/axios/issues/1006#issuecomment-320165427 diff --git a/packages/bruno-js/src/bundle-browser-rollup.js b/packages/bruno-js/src/bundle-browser-rollup.js new file mode 100644 index 000000000..0a7802e6c --- /dev/null +++ b/packages/bruno-js/src/bundle-browser-rollup.js @@ -0,0 +1,491 @@ + + const getBundledCode = () => { + return function(){ + !function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){if(this instanceof e){var n=[null];return n.push.apply(n,arguments),new(Function.bind.apply(t,n))}return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}var r={},o={get exports(){return r},set exports(e){r=e}},i={}; +/*! + * assertion-error + * Copyright(c) 2013 Jake Luer + * MIT Licensed + */ +/*! + * Return a function that will copy properties from + * one object to another excluding any originally + * listed. Returned function will create a new `{}`. + * + * @param {String} excluded properties ... + * @return {Function} + */ +function s(){var e=[].slice.call(arguments);function t(t,n){Object.keys(n).forEach((function(r){~e.indexOf(r)||(t[r]=n[r])}))}return function(){for(var e=[].slice.call(arguments),n=0,r={};n1?f(e,n,n.length-1):e,name:r.p||r.i,value:f(e,n)};return o.exists=l(o.parent,o.name),o}var p={hasProperty:l,getPathInfo:d,getPathValue:function(e,t){return d(e,t).value},setPathValue:function(e,t,n){return function(e,t,n){for(var r=e,o=n.length,i=null,s=0;s + * MIT Licensed + */({get exports(){return w},set exports(e){w=e}}).exports=function(){var e="function"==typeof Promise,t=function(e){if("object"==typeof globalThis)return globalThis;Object.defineProperty(e,"typeDetectGlobalObject",{get:function(){return this},configurable:!0});var t=typeDetectGlobalObject;return delete e.typeDetectGlobalObject,t}(Object.prototype),n="undefined"!=typeof Symbol,r="undefined"!=typeof Map,o="undefined"!=typeof Set,i="undefined"!=typeof WeakMap,s="undefined"!=typeof WeakSet,a="undefined"!=typeof DataView,u=n&&void 0!==Symbol.iterator,c=n&&void 0!==Symbol.toStringTag,l=o&&"function"==typeof Set.prototype.entries,h=r&&"function"==typeof Map.prototype.entries,f=l&&Object.getPrototypeOf((new Set).entries()),d=h&&Object.getPrototypeOf((new Map).entries()),p=u&&"function"==typeof Array.prototype[Symbol.iterator],y=p&&Object.getPrototypeOf([][Symbol.iterator]()),m=u&&"function"==typeof String.prototype[Symbol.iterator],g=m&&Object.getPrototypeOf(""[Symbol.iterator]()),w=8,b=-1;function v(n){var u=typeof n;if("object"!==u)return u;if(null===n)return"null";if(n===t)return"global";if(Array.isArray(n)&&(!1===c||!(Symbol.toStringTag in n)))return"Array";if("object"==typeof window&&null!==window){if("object"==typeof window.location&&n===window.location)return"Location";if("object"==typeof window.document&&n===window.document)return"Document";if("object"==typeof window.navigator){if("object"==typeof window.navigator.mimeTypes&&n===window.navigator.mimeTypes)return"MimeTypeArray";if("object"==typeof window.navigator.plugins&&n===window.navigator.plugins)return"PluginArray"}if(("function"==typeof window.HTMLElement||"object"==typeof window.HTMLElement)&&n instanceof window.HTMLElement){if("BLOCKQUOTE"===n.tagName)return"HTMLQuoteElement";if("TD"===n.tagName)return"HTMLTableDataCellElement";if("TH"===n.tagName)return"HTMLTableHeaderCellElement"}}var l=c&&n[Symbol.toStringTag];if("string"==typeof l)return l;var h=Object.getPrototypeOf(n);return h===RegExp.prototype?"RegExp":h===Date.prototype?"Date":e&&h===Promise.prototype?"Promise":o&&h===Set.prototype?"Set":r&&h===Map.prototype?"Map":s&&h===WeakSet.prototype?"WeakSet":i&&h===WeakMap.prototype?"WeakMap":a&&h===DataView.prototype?"DataView":r&&h===d?"Map Iterator":o&&h===f?"Set Iterator":p&&h===y?"Array Iterator":m&&h===g?"String Iterator":null===h?"Object":Object.prototype.toString.call(n).slice(w,b)}return v}(); +/*! + * Chai - expectTypes utility + * Copyright(c) 2012-2014 Jake Luer + * MIT Licensed + */ +var b=a,v=y,_=w,M=function(e,t){var n=v(e,"message"),r=v(e,"ssfi");n=n?n+": ":"",e=v(e,"object"),(t=t.map((function(e){return e.toLowerCase()}))).sort();var o=t.map((function(e,n){var r=~["a","e","i","o","u"].indexOf(e.charAt(0))?"an":"a";return(t.length>1&&n===t.length-1?"or ":"")+r+" "+e})).join(", "),i=_(e).toLowerCase();if(!t.some((function(e){return i===e})))throw new b(n+"object tested must be "+o+", but "+i+" given",void 0,r)},S=function(e,t){return t.length>4?t[4]:e._obj},O=Function.prototype.toString,k=/\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/;var x=function(e){if("function"!=typeof e)return null;var t="";if(void 0===Function.prototype.name&&void 0===e.name){var n=O.call(e);if(n.indexOf("(")>512)return t;var r=n.match(k);r&&(t=r[1])}else t=e.name;return t};const D={bold:["1","22"],dim:["2","22"],italic:["3","23"],underline:["4","24"],inverse:["7","27"],hidden:["8","28"],strike:["9","29"],black:["30","39"],red:["31","39"],green:["32","39"],yellow:["33","39"],blue:["34","39"],magenta:["35","39"],cyan:["36","39"],white:["37","39"],brightblack:["30;1","39"],brightred:["31;1","39"],brightgreen:["32;1","39"],brightyellow:["33;1","39"],brightblue:["34;1","39"],brightmagenta:["35;1","39"],brightcyan:["36;1","39"],brightwhite:["37;1","39"],grey:["90","39"]},N={special:"cyan",number:"yellow",bigint:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",symbol:"green",date:"magenta",regexp:"red"},T="…";function E(e,t){const n=D[N[t]]||D[t];return n?`[${n[0]}m${String(e)}[${n[1]}m`:String(e)}function P(e,t,n=T){e=String(e);const r=n.length,o=e.length;return r>t&&o>r?n:o>t&&o>r?`${e.slice(0,t-r)}${n}`:e}function Y(e,t,n,r=", "){n=n||t.inspect;const o=e.length;if(0===o)return"";const i=t.truncate;let s="",a="",u="";for(let c=0;ci&&s.length+u.length<=i)break;if(!o&&!l&&p>i)break;if(a=o?"":n(e[c+1],t)+(l?"":r),!o&&l&&p>i&&d+a.length>i)break;if(s+=f,!o&&!l&&d+a.length>=i){u=`${T}(${e.length-c-1})`;break}u=""}return`${s}${u}`}function j([e,t],n){return n.truncate-=2,"string"==typeof e?e=function(e){return e.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)?e:JSON.stringify(e).replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'")}(e):"number"!=typeof e&&(e=`[${n.inspect(e,n)}]`),n.truncate-=e.length,`${e}: ${t=n.inspect(t,n)}`}function A(e,t){const n=(e=>"function"==typeof Buffer&&e instanceof Buffer?"Buffer":e[Symbol.toStringTag]?e[Symbol.toStringTag]:x(e.constructor))(e);t.truncate-=n.length+4;const r=Object.keys(e).slice(e.length);if(!e.length&&!r.length)return`${n}[]`;let o="";for(let n=0;n[t,e[t]])),t,j)),`${n}[ ${o}${i?`, ${i}`:""} ]`}function C(e,t){const n=x(e);return n?t.stylize(`[Function ${P(n,t.truncate-11)}]`,"special"):t.stylize("[Function]","special")}function U([e,t],n){return n.truncate-=4,e=n.inspect(e,n),n.truncate-=e.length,`${e} => ${t=n.inspect(t,n)}`}const I=Number.isNaN||(e=>e!=e);function L(e,t){return I(e)?t.stylize("NaN","number"):e===1/0?t.stylize("Infinity","number"):e===-1/0?t.stylize("-Infinity","number"):0===e?t.stylize(1/e==1/0?"+0":"-0","number"):t.stylize(P(e,t.truncate),"number")}function R(e,t){let n=P(e.toString(),t.truncate-1);return n!==T&&(n+="n"),t.stylize(n,"bigint")}const B=new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]","g"),W={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","'":"\\'","\\":"\\\\"},F=16,H=4;function z(e){return W[e]||`\\u${`0000${e.charCodeAt(0).toString(F)}`.slice(-H)}`}function V(e,t){return B.test(e)&&(e=e.replace(B,z)),t.stylize(`'${P(e,t.truncate-2)}'`,"string")}function q(e){return"description"in Symbol.prototype?e.description?`Symbol(${e.description})`:"Symbol()":e.toString()}let $=()=>"Promise{…}";try{const{getPromiseDetails:e,kPending:t,kRejected:n}=process.binding("util");Array.isArray(e(Promise.resolve()))&&($=(r,o)=>{const[i,s]=e(r);return i===t?"Promise{}":`Promise${i===n?"!":""}{${o.inspect(s,o)}}`})}catch(e){}var G=$;function Z(e,t){const n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[];if(0===n.length&&0===r.length)return"{}";if(t.truncate-=4,t.seen=t.seen||[],t.seen.indexOf(e)>=0)return"[Circular]";t.seen.push(e);const o=Y(n.map((t=>[t,e[t]])),t,j),i=Y(r.map((t=>[t,e[t]])),t,j);t.seen.pop();let s="";return o&&i&&(s=", "),`{ ${o}${s}${i} }`}const K=!("undefined"==typeof Symbol||!Symbol.toStringTag)&&Symbol.toStringTag;const J=["stack","line","column","name","message","fileName","lineNumber","columnNumber","number","description"];function Q([e,t],n){return n.truncate-=3,t?`${n.stylize(e,"yellow")}=${n.stylize(`"${t}"`,"string")}`:`${n.stylize(e,"yellow")}`}function X(e,t){return Y(e,t,ee,"\n")}function ee(e,t){const n=e.getAttributeNames(),r=e.tagName.toLowerCase(),o=t.stylize(`<${r}`,"special"),i=t.stylize(">","special"),s=t.stylize(``,"special");t.truncate-=2*r.length+5;let a="";n.length>0&&(a+=" ",a+=Y(n.map((t=>[t,e.getAttribute(t)])),t,Q," ")),t.truncate-=a.length;const u=t.truncate;let c=X(e.children,t);return c&&c.length>u&&(c=`${T}(${e.children.length})`),`${o}${a}${i}${c}${s}`}const te="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("chai/inspect"):"@@chai/inspect";let ne=!1;try{const e=require("util");ne=!!e.inspect&&e.inspect.custom}catch(e){ne=!1}function re(){this.key="chai/loupe__"+Math.random()+Date.now()}re.prototype={get:function(e){return e[this.key]},has:function(e){return this.key in e},set:function(e,t){Object.isExtensible(e)&&Object.defineProperty(e,this.key,{value:t,configurable:!0})}};const oe=new("function"==typeof WeakMap?WeakMap:re),ie={},se={undefined:(e,t)=>t.stylize("undefined","undefined"),null:(e,t)=>t.stylize(null,"null"),boolean:(e,t)=>t.stylize(e,"boolean"),Boolean:(e,t)=>t.stylize(e,"boolean"),number:L,Number:L,bigint:R,BigInt:R,string:V,String:V,function:C,Function:C,symbol:q,Symbol:q,Array:function(e,t){const n=Object.keys(e).slice(e.length);if(!e.length&&!n.length)return"[]";t.truncate-=4;const r=Y(e,t);t.truncate-=r.length;let o="";return n.length&&(o=Y(n.map((t=>[t,e[t]])),t,j)),`[ ${r}${o?`, ${o}`:""} ]`},Date:function(e,t){const n=e.toJSON();if(null===n)return"Invalid Date";const r=n.split("T"),o=r[0];return t.stylize(`${o}T${P(r[1],t.truncate-o.length-1)}`,"date")},Map:function(e,t){return e.size-1<=0?"Map{}":(t.truncate-=7,`Map{ ${Y(function(e){const t=[];return e.forEach(((e,n)=>{t.push([n,e])})),t}(e),t,U)} }`)},Set:function(e,t){return 0===e.size?"Set{}":(t.truncate-=7,`Set{ ${Y(function(e){const t=[];return e.forEach((e=>{t.push(e)})),t}(e),t)} }`)},RegExp:function(e,t){const n=e.toString().split("/")[2],r=t.truncate-(2+n.length),o=e.source;return t.stylize(`/${P(o,r)}/${n}`,"regexp")},Promise:G,WeakSet:(e,t)=>t.stylize("WeakSet{…}","special"),WeakMap:(e,t)=>t.stylize("WeakMap{…}","special"),Arguments:function(e,t){return 0===e.length?"Arguments[]":(t.truncate-=13,`Arguments[ ${Y(e,t)} ]`)},Int8Array:A,Uint8Array:A,Uint8ClampedArray:A,Int16Array:A,Uint16Array:A,Int32Array:A,Uint32Array:A,Float32Array:A,Float64Array:A,Generator:()=>"",DataView:()=>"",ArrayBuffer:()=>"",Error:function(e,t){const n=Object.getOwnPropertyNames(e).filter((e=>-1===J.indexOf(e))),r=e.name;t.truncate-=r.length;let o="";"string"==typeof e.message?o=P(e.message,t.truncate):n.unshift("message"),o=o?`: ${o}`:"",t.truncate-=o.length+5;const i=Y(n.map((t=>[t,e[t]])),t,j);return`${r}${o}${i?` { ${i} }`:""}`},HTMLCollection:X,NodeList:X},ae=Object.prototype.toString;function ue(e,t){t=function({showHidden:e=!1,depth:t=2,colors:n=!1,customInspect:r=!0,showProxy:o=!1,maxArrayLength:i=1/0,breakLength:s=1/0,seen:a=[],truncate:u=1/0,stylize:c=String}={}){const l={showHidden:Boolean(e),depth:Number(t),colors:Boolean(n),customInspect:Boolean(r),showProxy:Boolean(o),maxArrayLength:Number(i),breakLength:Number(s),truncate:Number(u),seen:a,stylize:c};return l.colors&&(l.stylize=E),l}(t),t.inspect=ue;const{customInspect:n}=t;let r=null===e?"null":typeof e;if("object"===r&&(r=ae.call(e).slice(8,-1)),se[r])return se[r](e,t);if(n&&e){const n=((e,t,n)=>te in e&&"function"==typeof e[te]?e[te](t):ne&&ne in e&&"function"==typeof e[ne]?e[ne](t.depth,t):"inspect"in e&&"function"==typeof e.inspect?e.inspect(t.depth,t):"constructor"in e&&oe.has(e.constructor)?oe.get(e.constructor)(e,t):ie[n]?ie[n](e,t):"")(e,t,r);if(n)return"string"==typeof n?n:ue(n,t)}const o=!!e&&Object.getPrototypeOf(e);return o===Object.prototype||null===o?Z(e,t):e&&"function"==typeof HTMLElement&&e instanceof HTMLElement?ee(e,t):"constructor"in e?e.constructor!==Object?function(e,t){let n="";return K&&K in e&&(n=e[K]),n=n||x(e.constructor),n&&"_class"!==n||(n=""),t.truncate-=n.length,`${n}${Z(e,t)}`}(e,t):Z(e,t):e===Object(e)?Z(e,t):t.stylize(String(e),r)}const ce=te;var le={includeStack:!1,showDiff:!0,truncateThreshold:40,useProxy:!0,proxyExcludedKeys:["then","catch","inspect","toJSON"],deepEqual:null},he=n(Object.freeze({__proto__:null,inspect:ue,registerConstructor:function(e,t){return!oe.has(e)&&(oe.set(e,t),!0)},registerStringTag:function(e,t){return!(e in ie)&&(ie[e]=t,!0)},custom:ce,default:ue})),fe=le,de=function(e,t,n,r){var o={colors:r,depth:void 0===n?2:n,showHidden:t,truncate:fe.truncateThreshold?fe.truncateThreshold:1/0};return he.inspect(e,o)} +/*! + * Chai - flag utility + * Copyright(c) 2012-2014 Jake Luer + * MIT Licensed + */ +/*! + * Module dependencies + */;var pe=de,ye=le,me=function(e){var t=pe(e),n=Object.prototype.toString.call(e);if(ye.truncateThreshold&&t.length>=ye.truncateThreshold){if("[object Function]"===n)return e.name&&""!==e.name?"[Function: "+e.name+"]":"[Function]";if("[object Array]"===n)return"[ Array("+e.length+") ]";if("[object Object]"===n){var r=Object.keys(e);return"{ Object ("+(r.length>2?r.splice(0,2).join(", ")+", ...":r.join(", "))+") }"}return t}return t},ge=y,we=S,be=me,ve=function(e,t){var n=ge(e,"negate"),r=ge(e,"object"),o=t[3],i=we(e,t),s=n?t[2]:t[1],a=ge(e,"message");return"function"==typeof s&&(s=s()),s=(s=s||"").replace(/#\{this\}/g,(function(){return be(r)})).replace(/#\{act\}/g,(function(){return be(i)})).replace(/#\{exp\}/g,(function(){return be(o)})),a?a+": "+s:s},_e=function(e,t,n){var r=e.__flags||(e.__flags=Object.create(null));for(var o in t.__flags||(t.__flags=Object.create(null)),n=3!==arguments.length||n,r)(n||"object"!==o&&"ssfi"!==o&&"lockSsfi"!==o&&"message"!=o)&&(t.__flags[o]=r[o])},Me={},Se={get exports(){return Me},set exports(e){Me=e}},Oe={};!function(t){t.exports=function(){var t="function"==typeof Promise,n="object"==typeof self?self:e,r="undefined"!=typeof Symbol,o="undefined"!=typeof Map,i="undefined"!=typeof Set,s="undefined"!=typeof WeakMap,a="undefined"!=typeof WeakSet,u="undefined"!=typeof DataView,c=r&&void 0!==Symbol.iterator,l=r&&void 0!==Symbol.toStringTag,h=i&&"function"==typeof Set.prototype.entries,f=o&&"function"==typeof Map.prototype.entries,d=h&&Object.getPrototypeOf((new Set).entries()),p=f&&Object.getPrototypeOf((new Map).entries()),y=c&&"function"==typeof Array.prototype[Symbol.iterator],m=y&&Object.getPrototypeOf([][Symbol.iterator]()),g=c&&"function"==typeof String.prototype[Symbol.iterator],w=g&&Object.getPrototypeOf(""[Symbol.iterator]()),b=8,v=-1;function _(e){var r=typeof e;if("object"!==r)return r;if(null===e)return"null";if(e===n)return"global";if(Array.isArray(e)&&(!1===l||!(Symbol.toStringTag in e)))return"Array";if("object"==typeof window&&null!==window){if("object"==typeof window.location&&e===window.location)return"Location";if("object"==typeof window.document&&e===window.document)return"Document";if("object"==typeof window.navigator){if("object"==typeof window.navigator.mimeTypes&&e===window.navigator.mimeTypes)return"MimeTypeArray";if("object"==typeof window.navigator.plugins&&e===window.navigator.plugins)return"PluginArray"}if(("function"==typeof window.HTMLElement||"object"==typeof window.HTMLElement)&&e instanceof window.HTMLElement){if("BLOCKQUOTE"===e.tagName)return"HTMLQuoteElement";if("TD"===e.tagName)return"HTMLTableDataCellElement";if("TH"===e.tagName)return"HTMLTableHeaderCellElement"}}var c=l&&e[Symbol.toStringTag];if("string"==typeof c)return c;var h=Object.getPrototypeOf(e);return h===RegExp.prototype?"RegExp":h===Date.prototype?"Date":t&&h===Promise.prototype?"Promise":i&&h===Set.prototype?"Set":o&&h===Map.prototype?"Map":a&&h===WeakSet.prototype?"WeakSet":s&&h===WeakMap.prototype?"WeakMap":u&&h===DataView.prototype?"DataView":o&&h===p?"Map Iterator":i&&h===d?"Set Iterator":y&&h===m?"Array Iterator":g&&h===w?"String Iterator":null===h?"Object":Object.prototype.toString.call(e).slice(b,v)}return _}()}({get exports(){return Oe},set exports(e){Oe=e}}); +/*! + * deep-eql + * Copyright(c) 2013 Jake Luer + * MIT Licensed + */ +var ke=Oe;function xe(){this._key="chai/deep-eql__"+Math.random()+Date.now()}xe.prototype={get:function(e){return e[this._key]},set:function(e,t){Object.isExtensible(e)&&Object.defineProperty(e,this._key,{value:t,configurable:!0})}};var De="function"==typeof WeakMap?WeakMap:xe; +/*! + * Check to see if the MemoizeMap has recorded a result of the two operands + * + * @param {Mixed} leftHandOperand + * @param {Mixed} rightHandOperand + * @param {MemoizeMap} memoizeMap + * @returns {Boolean|null} result + */function Ne(e,t,n){if(!n||Be(e)||Be(t))return null;var r=n.get(e);if(r){var o=r.get(t);if("boolean"==typeof o)return o}return null} +/*! + * Set the result of the equality into the MemoizeMap + * + * @param {Mixed} leftHandOperand + * @param {Mixed} rightHandOperand + * @param {MemoizeMap} memoizeMap + * @param {Boolean} result + */function Te(e,t,n,r){if(n&&!Be(e)&&!Be(t)){var o=n.get(e);o?o.set(t,r):((o=new De).set(t,r),n.set(e,o))}} +/*! + * Primary Export + */function Ee(e,t,n){if(n&&n.comparator)return Ye(e,t,n);var r=Pe(e,t);return null!==r?r:Ye(e,t,n)}function Pe(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t||!Be(e)&&!Be(t)&&null} +/*! + * The main logic of the `deepEqual` function. + * + * @param {Mixed} leftHandOperand + * @param {Mixed} rightHandOperand + * @param {Object} [options] (optional) Additional options + * @param {Array} [options.comparator] (optional) Override default algorithm, determining custom equality. + * @param {Array} [options.memoize] (optional) Provide a custom memoization object which will cache the results of + complex objects for a speed boost. By passing `false` you can disable memoization, but this will cause circular + references to blow the stack. + * @return {Boolean} equal match + */function Ye(e,t,n){(n=n||{}).memoize=!1!==n.memoize&&(n.memoize||new De);var r=n&&n.comparator,o=Ne(e,t,n.memoize);if(null!==o)return o;var i=Ne(t,e,n.memoize);if(null!==i)return i;if(r){var s=r(e,t);if(!1===s||!0===s)return Te(e,t,n.memoize,s),s;var a=Pe(e,t);if(null!==a)return a}var u=ke(e);if(u!==ke(t))return Te(e,t,n.memoize,!1),!1;Te(e,t,n.memoize,!0);var c=function(e,t,n,r){switch(n){case"String":case"Number":case"Boolean":case"Date":return Ee(e.valueOf(),t.valueOf());case"Promise":case"Symbol":case"function":case"WeakMap":case"WeakSet":return e===t;case"Error":return Re(e,t,["name","message","code"],r);case"Arguments":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"Array":return Ae(e,t,r);case"RegExp": +/*! + * Compare two Regular Expressions for equality. + * + * @param {RegExp} leftHandOperand + * @param {RegExp} rightHandOperand + * @return {Boolean} result + */ +return function(e,t){return e.toString()===t.toString()} +/*! + * Compare two Sets/Maps for equality. Faster than other equality functions. + * + * @param {Set} leftHandOperand + * @param {Set} rightHandOperand + * @param {Object} [options] (Optional) + * @return {Boolean} result + */(e,t);case"Generator": +/*! + * Simple equality for generator objects such as those returned by generator functions. + * + * @param {Iterable} leftHandOperand + * @param {Iterable} rightHandOperand + * @param {Object} [options] (Optional) + * @return {Boolean} result + */ +return function(e,t,n){return Ae(Ue(e),Ue(t),n)} +/*! + * Determine if the given object has an @@iterator function. + * + * @param {Object} target + * @return {Boolean} `true` if the object has an @@iterator function. + */(e,t,r);case"DataView":return Ae(new Uint8Array(e.buffer),new Uint8Array(t.buffer),r);case"ArrayBuffer":return Ae(new Uint8Array(e),new Uint8Array(t),r);case"Set":case"Map":return je(e,t,r);case"Temporal.PlainDate":case"Temporal.PlainTime":case"Temporal.PlainDateTime":case"Temporal.Instant":case"Temporal.ZonedDateTime":case"Temporal.PlainYearMonth":case"Temporal.PlainMonthDay":return e.equals(t);case"Temporal.Duration":return e.total("nanoseconds")===t.total("nanoseconds");case"Temporal.TimeZone":case"Temporal.Calendar":return e.toString()===t.toString();default: +/*! + * Recursively check the equality of two Objects. Once basic sameness has been established it will defer to `deepEqual` + * for each enumerable key in the object. + * + * @param {Mixed} leftHandOperand + * @param {Mixed} rightHandOperand + * @param {Object} [options] (Optional) + * @return {Boolean} result + */ +return function(e,t,n){var r=Ie(e),o=Ie(t),i=Le(e),s=Le(t);if(r=r.concat(i),o=o.concat(s),r.length&&r.length===o.length)return!1!==Ae(We(r).sort(),We(o).sort())&&Re(e,t,r,n);var a=Ce(e),u=Ce(t);if(a.length&&a.length===u.length)return a.sort(),u.sort(),Ae(a,u,n);if(0===r.length&&0===a.length&&0===o.length&&0===u.length)return!0;return!1} +/*! + * Returns true if the argument is a primitive. + * + * This intentionally returns true for all objects that can be compared by reference, + * including functions and symbols. + * + * @param {Mixed} value + * @return {Boolean} result + */(e,t,r)}}(e,t,u,n);return Te(e,t,n.memoize,c),c}function je(e,t,n){try{if(e.size!==t.size)return!1;if(0===e.size)return!0}catch(e){return!1}var r=[],o=[];return e.forEach((function(e,t){r.push([e,t])})),t.forEach((function(e,t){o.push([e,t])})),Ae(r.sort(),o.sort(),n)} +/*! + * Simple equality for flat iterable objects such as Arrays, TypedArrays or Node.js buffers. + * + * @param {Iterable} leftHandOperand + * @param {Iterable} rightHandOperand + * @param {Object} [options] (Optional) + * @return {Boolean} result + */function Ae(e,t,n){var r=e.length;if(r!==t.length)return!1;if(0===r)return!0;for(var o=-1;++o + * MIT Licensed + */var qe,$e,Ge,Ze,Ke,Je,Qe,Xe,et,tt,nt=Object.getOwnPropertyDescriptor((function(){}),"length"),rt=function(e,t,n){return nt.configurable?(Object.defineProperty(e,"length",{get:function(){if(n)throw Error("Invalid Chai property: "+t+'.length. Due to a compatibility issue, "length" cannot directly follow "'+t+'". Use "'+t+'.lengthOf" instead.');throw Error("Invalid Chai property: "+t+'.length. See docs for proper usage of "'+t+'".')}}),e):e},ot=le,it=y,st=function(e){var t=Object.getOwnPropertyNames(e);function n(e){-1===t.indexOf(e)&&t.push(e)}for(var r=Object.getPrototypeOf(e);null!==r;)Object.getOwnPropertyNames(r).forEach(n),r=Object.getPrototypeOf(r);return t},at=Ve,ut=["__flags","__methods","_obj","assert"],ct=function(e,t){return at()?new Proxy(e,{get:function e(n,r){if("string"==typeof r&&-1===ot.proxyExcludedKeys.indexOf(r)&&!Reflect.has(n,r)){if(t)throw Error("Invalid Chai property: "+t+"."+r+'. See docs for proper usage of "'+t+'".');var o=null,i=4;throw st(n).forEach((function(e){if(!Object.prototype.hasOwnProperty(e)&&-1===ut.indexOf(e)){var t=function(e,t,n){if(Math.abs(e.length-t.length)>=n)return n;for(var r=[],o=0;o<=e.length;o++)r[o]=Array(t.length+1).fill(0),r[o][0]=o;for(var i=0;i=n?r[o][i]=n:r[o][i]=Math.min(r[o-1][i]+1,r[o][i-1]+1,r[o-1][i-1]+(s===t.charCodeAt(i-1)?0:1))}return r[e.length][t.length]} +/*! + * Chai - addMethod utility + * Copyright(c) 2012-2014 Jake Luer + * MIT Licensed + */(r,e,i);t + * MIT Licensed + */ +/*! + * Chai - compareByInspect utility + * Copyright(c) 2011-2016 Jake Luer + * MIT Licensed + */ +/*! + * Module dependencies + */ +var lt=de,ht=function(e,t){return lt(e) + * MIT Licensed + */var gt=Number.isNaN||function(e){return e!=e},wt=w,bt=y;var vt,_t=function(e,t){var n=bt(e,"operator"),r=bt(e,"negate"),o=t[3],i=r?t[2]:t[1];if(n)return n;if("function"==typeof i&&(i=i()),(i=i||"")&&!/\shave\s/.test(i)){var s=function(e){var t=wt(e);return-1!==["Array","Object","function"].indexOf(t)}(o);return/\snot\s/.test(i)?s?"notDeepStrictEqual":"notStrictEqual":s?"deepStrictEqual":"strictEqual"}}; +/*! + * chai + * Copyright(c) 2011 Jake Luer + * MIT Licensed + */function Mt(){if(vt)return c;vt=1; +/*! + * Dependencies that are used for multiple exports are required here only once + */ +var e=p; +/*! + * test utility + */return c.test=g, +/*! + * type utility + */ +c.type=w, +/*! + * expectTypes utility + */ +c.expectTypes=M, +/*! + * message utility + */ +c.getMessage=ve, +/*! + * actual utility + */ +c.getActual=S, +/*! + * Inspect util + */ +c.inspect=de, +/*! + * Object Display util + */ +c.objDisplay=me, +/*! + * Flag utility + */ +c.flag=y, +/*! + * Flag transferring utility + */ +c.transferFlags=_e, +/*! + * Deep equal utility + */ +c.eql=Me, +/*! + * Deep path info + */ +c.getPathInfo=e.getPathInfo, +/*! + * Check if a property exists + */ +c.hasProperty=e.hasProperty, +/*! + * Function name + */ +c.getName=x, +/*! + * add Property + */ +c.addProperty=function(){if(He)return Fe;He=1;var e=Et(),t=y,n=Ve,r=_e;return Fe=function(o,i,s){s=void 0===s?function(){}:s,Object.defineProperty(o,i,{get:function o(){n()||t(this,"lockSsfi")||t(this,"ssfi",o);var i=s.call(this);if(void 0!==i)return i;var a=new e.Assertion;return r(this,a),a},configurable:!0})}}(), +/*! + * add Method + */ +c.addMethod=function(){if($e)return qe;$e=1;var e=rt,t=Et(),n=y,r=ct,o=_e;return qe=function(i,s,a){var u=function(){n(this,"lockSsfi")||n(this,"ssfi",u);var e=a.apply(this,arguments);if(void 0!==e)return e;var r=new t.Assertion;return o(this,r),r};e(u,s,!1),i[s]=r(u,s)},qe} +/*! + * Chai - overwriteProperty utility + * Copyright(c) 2012-2014 Jake Luer + * MIT Licensed + */(), +/*! + * overwrite Property + */ +c.overwriteProperty=function(){if(Ze)return Ge;Ze=1;var e=Et(),t=y,n=Ve,r=_e;return Ge=function(o,i,s){var a=Object.getOwnPropertyDescriptor(o,i),u=function(){};a&&"function"==typeof a.get&&(u=a.get),Object.defineProperty(o,i,{get:function o(){n()||t(this,"lockSsfi")||t(this,"ssfi",o);var i=t(this,"lockSsfi");t(this,"lockSsfi",!0);var a=s(u).call(this);if(t(this,"lockSsfi",i),void 0!==a)return a;var c=new e.Assertion;return r(this,c),c},configurable:!0})}} +/*! + * Chai - overwriteMethod utility + * Copyright(c) 2012-2014 Jake Luer + * MIT Licensed + */(), +/*! + * overwrite Method + */ +c.overwriteMethod=function(){if(Je)return Ke;Je=1;var e=rt,t=Et(),n=y,r=ct,o=_e;return Ke=function(i,s,a){var u=i[s],c=function(){throw new Error(s+" is not a function")};u&&"function"==typeof u&&(c=u);var l=function(){n(this,"lockSsfi")||n(this,"ssfi",l);var e=n(this,"lockSsfi");n(this,"lockSsfi",!0);var r=a(c).apply(this,arguments);if(n(this,"lockSsfi",e),void 0!==r)return r;var i=new t.Assertion;return o(this,i),i};e(l,s,!1),i[s]=r(l,s)},Ke} +/*! + * Chai - addChainingMethod utility + * Copyright(c) 2012-2014 Jake Luer + * MIT Licensed + */(), +/*! + * Add a chainable method + */ +c.addChainableMethod=function(){if(Xe)return Qe;Xe=1; +/*! + * Module dependencies + */ +var e=rt,t=Et(),n=y,r=ct,o=_e,i="function"==typeof Object.setPrototypeOf,s=function(){},a=Object.getOwnPropertyNames(s).filter((function(e){var t=Object.getOwnPropertyDescriptor(s,e);return"object"!=typeof t||!t.configurable})),u=Function.prototype.call,c=Function.prototype.apply;return Qe=function(s,l,h,f){"function"!=typeof f&&(f=function(){});var d={method:h,chainingBehavior:f};s.__methods||(s.__methods={}),s.__methods[l]=d,Object.defineProperty(s,l,{get:function(){d.chainingBehavior.call(this);var h=function(){n(this,"lockSsfi")||n(this,"ssfi",h);var e=d.method.apply(this,arguments);if(void 0!==e)return e;var r=new t.Assertion;return o(this,r),r};if(e(h,l,!0),i){var f=Object.create(this);f.call=u,f.apply=c,Object.setPrototypeOf(h,f)}else Object.getOwnPropertyNames(s).forEach((function(e){if(-1===a.indexOf(e)){var t=Object.getOwnPropertyDescriptor(s,e);Object.defineProperty(h,e,t)}}));return o(this,h),r(h)},configurable:!0})},Qe} +/*! + * Chai - overwriteChainableMethod utility + * Copyright(c) 2012-2014 Jake Luer + * MIT Licensed + */(), +/*! + * Overwrite chainable method + */ +c.overwriteChainableMethod=function(){if(tt)return et;tt=1;var e=Et(),t=_e;return et=function(n,r,o,i){var s=n.__methods[r],a=s.chainingBehavior;s.chainingBehavior=function(){var n=i(a).call(this);if(void 0!==n)return n;var r=new e.Assertion;return t(this,r),r};var u=s.method;s.method=function(){var n=o(u).apply(this,arguments);if(void 0!==n)return n;var r=new e.Assertion;return t(this,r),r}},et}(), +/*! + * Compare by inspect method + */ +c.compareByInspect=ht, +/*! + * Get own enumerable property symbols method + */ +c.getOwnEnumerablePropertySymbols=ft, +/*! + * Get own enumerable properties method + */ +c.getOwnEnumerableProperties=pt, +/*! + * Checks error against a given set of criteria + */ +c.checkError=mt, +/*! + * Proxify util + */ +c.proxify=ct, +/*! + * addLengthGuard util + */ +c.addLengthGuard=rt, +/*! + * isProxyEnabled helper + */ +c.isProxyEnabled=Ve, +/*! + * isNaN method + */ +c.isNaN=gt, +/*! + * getOperator method + */ +c.getOperator=_t,c} +/*! + * chai + * http://chaijs.com + * Copyright(c) 2011-2014 Jake Luer + * MIT Licensed + */var St,Ot=le,kt=function(e,t){ +/*! + * Module dependencies. + */ +var n=e.AssertionError,r=t.flag; +/*! + * Module export. + */ +/*! + * Assertion Constructor + * + * Creates object for chaining. + * + * `Assertion` objects contain metadata in the form of flags. Three flags can + * be assigned during instantiation by passing arguments to this constructor: + * + * - `object`: This flag contains the target of the assertion. For example, in + * the assertion `expect(numKittens).to.equal(7);`, the `object` flag will + * contain `numKittens` so that the `equal` assertion can reference it when + * needed. + * + * - `message`: This flag contains an optional custom error message to be + * prepended to the error message that's generated by the assertion when it + * fails. + * + * - `ssfi`: This flag stands for "start stack function indicator". It + * contains a function reference that serves as the starting point for + * removing frames from the stack trace of the error that's created by the + * assertion when it fails. The goal is to provide a cleaner stack trace to + * end users by removing Chai's internal functions. Note that it only works + * in environments that support `Error.captureStackTrace`, and only when + * `Chai.config.includeStack` hasn't been set to `false`. + * + * - `lockSsfi`: This flag controls whether or not the given `ssfi` flag + * should retain its current value, even as assertions are chained off of + * this object. This is usually set to `true` when creating a new assertion + * from within another assertion. It's also temporarily set to `true` before + * an overwritten assertion gets called by the overwriting assertion. + * + * - `eql`: This flag contains the deepEqual function to be used by the assertion. + * + * @param {Mixed} obj target of the assertion + * @param {String} msg (optional) custom error message + * @param {Function} ssfi (optional) starting point for removing stack frames + * @param {Boolean} lockSsfi (optional) whether or not the ssfi flag is locked + * @api private + */ +function o(e,n,i,s){return r(this,"ssfi",i||o),r(this,"lockSsfi",s),r(this,"object",e),r(this,"message",n),r(this,"eql",Ot.deepEqual||t.eql),t.proxify(this)}e.Assertion=o,Object.defineProperty(o,"includeStack",{get:function(){return console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),Ot.includeStack},set:function(e){console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),Ot.includeStack=e}}),Object.defineProperty(o,"showDiff",{get:function(){return console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),Ot.showDiff},set:function(e){console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),Ot.showDiff=e}}),o.addProperty=function(e,n){t.addProperty(this.prototype,e,n)},o.addMethod=function(e,n){t.addMethod(this.prototype,e,n)},o.addChainableMethod=function(e,n,r){t.addChainableMethod(this.prototype,e,n,r)},o.overwriteProperty=function(e,n){t.overwriteProperty(this.prototype,e,n)},o.overwriteMethod=function(e,n){t.overwriteMethod(this.prototype,e,n)},o.overwriteChainableMethod=function(e,n,r){t.overwriteChainableMethod(this.prototype,e,n,r)},o.prototype.assert=function(e,o,i,s,a,u){var c=t.test(this,arguments);if(!1!==u&&(u=!0),void 0===s&&void 0===a&&(u=!1),!0!==Ot.showDiff&&(u=!1),!c){o=t.getMessage(this,arguments);var l={actual:t.getActual(this,arguments),expected:s,showDiff:u},h=t.getOperator(this,arguments);throw h&&(l.operator=h),new n(o,l,Ot.includeStack?this.assert:r(this,"ssfi"))}}, +/*! + * ### ._obj + * + * Quick reference to stored `actual` value for plugin developers. + * + * @api private + */ +Object.defineProperty(o.prototype,"_obj",{get:function(){return r(this,"object")},set:function(e){r(this,"object",e)}})},xt=function(e,t){var n=e.Assertion,r=e.AssertionError,o=t.flag;function i(e,n){n&&o(this,"message",n),e=e.toLowerCase();var r=o(this,"object"),i=~["a","e","i","o","u"].indexOf(e.charAt(0))?"an ":"a ";this.assert(e===t.type(r).toLowerCase(),"expected #{this} to be "+i+e,"expected #{this} not to be "+i+e)}function s(e,n){return t.isNaN(e)&&t.isNaN(n)||e===n}function a(){o(this,"contains",!0)}function u(e,i){i&&o(this,"message",i);var a=o(this,"object"),u=t.type(a).toLowerCase(),c=o(this,"message"),l=o(this,"negate"),h=o(this,"ssfi"),f=o(this,"deep"),d=f?"deep ":"",p=f?o(this,"eql"):s;c=c?c+": ":"";var y=!1;switch(u){case"string":y=-1!==a.indexOf(e);break;case"weakset":if(f)throw new r(c+"unable to use .deep.include with WeakSet",void 0,h);y=a.has(e);break;case"map":a.forEach((function(t){y=y||p(t,e)}));break;case"set":f?a.forEach((function(t){y=y||p(t,e)})):y=a.has(e);break;case"array":y=f?a.some((function(t){return p(t,e)})):-1!==a.indexOf(e);break;default:if(e!==Object(e))throw new r(c+"the given combination of arguments ("+u+" and "+t.type(e).toLowerCase()+") is invalid for this assertion. You can use an array, a map, an object, a set, a string, or a weakset instead of a "+t.type(e).toLowerCase(),void 0,h);var m=Object.keys(e),g=null,w=0;if(m.forEach((function(i){var s=new n(a);if(t.transferFlags(this,s,!0),o(s,"lockSsfi",!0),l&&1!==m.length)try{s.property(i,e[i])}catch(e){if(!t.checkError.compatibleConstructor(e,r))throw e;null===g&&(g=e),w++}else s.property(i,e[i])}),this),l&&m.length>1&&w===m.length)throw g;return}this.assert(y,"expected #{this} to "+d+"include "+t.inspect(e),"expected #{this} to not "+d+"include "+t.inspect(e))}function c(){var e=o(this,"object");this.assert(null!=e,"expected #{this} to exist","expected #{this} to not exist")}function l(){var e=o(this,"object"),n=t.type(e);this.assert("Arguments"===n,"expected #{this} to be arguments but got "+n,"expected #{this} to not be arguments")}function h(e,t){t&&o(this,"message",t);var n=o(this,"object");if(o(this,"deep")){var r=o(this,"lockSsfi");o(this,"lockSsfi",!0),this.eql(e),o(this,"lockSsfi",r)}else this.assert(e===n,"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",e,this._obj,!0)}function f(e,t){t&&o(this,"message",t);var n=o(this,"eql");this.assert(n(e,o(this,"object")),"expected #{this} to deeply equal #{exp}","expected #{this} to not deeply equal #{exp}",e,this._obj,!0)}function d(e,i){i&&o(this,"message",i);var s,a=o(this,"object"),u=o(this,"doLength"),c=o(this,"message"),l=c?c+": ":"",h=o(this,"ssfi"),f=t.type(a).toLowerCase(),d=t.type(e).toLowerCase(),p=!0;if(u&&"map"!==f&&"set"!==f&&new n(a,c,h,!0).to.have.property("length"),u||"date"!==f||"date"===d)if("number"===d||!u&&"number"!==f)if(u||"date"===f||"number"===f)p=!1;else{s=l+"expected "+("string"===f?"'"+a+"'":a)+" to be a number or a date"}else s=l+"the argument to above must be a number";else s=l+"the argument to above must be a date";if(p)throw new r(s,void 0,h);if(u){var y,m="length";"map"===f||"set"===f?(m="size",y=a.size):y=a.length,this.assert(y>e,"expected #{this} to have a "+m+" above #{exp} but got #{act}","expected #{this} to not have a "+m+" above #{exp}",e,y)}else this.assert(a>e,"expected #{this} to be above #{exp}","expected #{this} to be at most #{exp}",e)}function p(e,i){i&&o(this,"message",i);var s,a=o(this,"object"),u=o(this,"doLength"),c=o(this,"message"),l=c?c+": ":"",h=o(this,"ssfi"),f=t.type(a).toLowerCase(),d=t.type(e).toLowerCase(),p=!0;if(u&&"map"!==f&&"set"!==f&&new n(a,c,h,!0).to.have.property("length"),u||"date"!==f||"date"===d)if("number"===d||!u&&"number"!==f)if(u||"date"===f||"number"===f)p=!1;else{s=l+"expected "+("string"===f?"'"+a+"'":a)+" to be a number or a date"}else s=l+"the argument to least must be a number";else s=l+"the argument to least must be a date";if(p)throw new r(s,void 0,h);if(u){var y,m="length";"map"===f||"set"===f?(m="size",y=a.size):y=a.length,this.assert(y>=e,"expected #{this} to have a "+m+" at least #{exp} but got #{act}","expected #{this} to have a "+m+" below #{exp}",e,y)}else this.assert(a>=e,"expected #{this} to be at least #{exp}","expected #{this} to be below #{exp}",e)}function y(e,i){i&&o(this,"message",i);var s,a=o(this,"object"),u=o(this,"doLength"),c=o(this,"message"),l=c?c+": ":"",h=o(this,"ssfi"),f=t.type(a).toLowerCase(),d=t.type(e).toLowerCase(),p=!0;if(u&&"map"!==f&&"set"!==f&&new n(a,c,h,!0).to.have.property("length"),u||"date"!==f||"date"===d)if("number"===d||!u&&"number"!==f)if(u||"date"===f||"number"===f)p=!1;else{s=l+"expected "+("string"===f?"'"+a+"'":a)+" to be a number or a date"}else s=l+"the argument to below must be a number";else s=l+"the argument to below must be a date";if(p)throw new r(s,void 0,h);if(u){var y,m="length";"map"===f||"set"===f?(m="size",y=a.size):y=a.length,this.assert(ye===t,w="";d&&(w+="deep "),a&&(w+="own "),s&&(w+="nested "),w+="property ",f=a?Object.prototype.hasOwnProperty.call(c,e):s?y.exists:t.hasProperty(c,e),p&&1!==arguments.length||this.assert(f,"expected #{this} to have "+w+t.inspect(e),"expected #{this} to not have "+w+t.inspect(e)),arguments.length>1&&this.assert(f&&g(n,m),"expected #{this} to have "+w+t.inspect(e)+" of #{exp}, but got #{act}","expected #{this} to not have "+w+t.inspect(e)+" of #{act}",n,m),o(this,"object",m)}function b(e,t,n){o(this,"own",!0),w.apply(this,arguments)}function v(e,n,r){"string"==typeof n&&(r=n,n=null),r&&o(this,"message",r);var i=o(this,"object"),s=Object.getOwnPropertyDescriptor(Object(i),e),a=o(this,"eql");s&&n?this.assert(a(n,s),"expected the own property descriptor for "+t.inspect(e)+" on #{this} to match "+t.inspect(n)+", got "+t.inspect(s),"expected the own property descriptor for "+t.inspect(e)+" on #{this} to not match "+t.inspect(n),n,s,!0):this.assert(s,"expected #{this} to have an own property descriptor for "+t.inspect(e),"expected #{this} to not have an own property descriptor for "+t.inspect(e)),o(this,"object",s)}function _(){o(this,"doLength",!0)}function M(e,r){r&&o(this,"message",r);var i,s=o(this,"object"),a=t.type(s).toLowerCase(),u=o(this,"message"),c=o(this,"ssfi"),l="length";switch(a){case"map":case"set":l="size",i=s.size;break;default:new n(s,u,c,!0).to.have.property("length"),i=s.length}this.assert(i==e,"expected #{this} to have a "+l+" of #{exp} but got #{act}","expected #{this} to not have a "+l+" of #{act}",e,i)}function S(e,t){t&&o(this,"message",t);var n=o(this,"object");this.assert(e.exec(n),"expected #{this} to match "+e,"expected #{this} not to match "+e)}function O(e){var n,i,s=o(this,"object"),a=t.type(s),u=t.type(e),c=o(this,"ssfi"),l=o(this,"deep"),h="",f=!0,d=o(this,"message"),p=(d=d?d+": ":"")+"when testing keys against an object or an array you must give a single Array|Object|String argument or multiple String arguments";if("Map"===a||"Set"===a)h=l?"deeply ":"",i=[],s.forEach((function(e,t){i.push(t)})),"Array"!==u&&(e=Array.prototype.slice.call(arguments));else{switch(i=t.getOwnEnumerableProperties(s),u){case"Array":if(arguments.length>1)throw new r(p,void 0,c);break;case"Object":if(arguments.length>1)throw new r(p,void 0,c);e=Object.keys(e);break;default:e=Array.prototype.slice.call(arguments)}e=e.map((function(e){return"symbol"==typeof e?e:String(e)}))}if(!e.length)throw new r(d+"keys required",void 0,c);var y=e.length,m=o(this,"any"),g=o(this,"all"),w=e,b=l?o(this,"eql"):(e,t)=>e===t;if(m||g||(g=!0),m&&(f=w.some((function(e){return i.some((function(t){return b(e,t)}))}))),g&&(f=w.every((function(e){return i.some((function(t){return b(e,t)}))})),o(this,"contains")||(f=f&&e.length==i.length)),y>1){var v=(e=e.map((function(e){return t.inspect(e)}))).pop();g&&(n=e.join(", ")+", and "+v),m&&(n=e.join(", ")+", or "+v)}else n=t.inspect(e[0]);n=(y>1?"keys ":"key ")+n,n=(o(this,"contains")?"contain ":"have ")+n,this.assert(f,"expected #{this} to "+h+n,"expected #{this} to not "+h+n,w.slice(0).sort(t.compareByInspect),i.sort(t.compareByInspect),!0)}function k(e,r,i){i&&o(this,"message",i);var s,a=o(this,"object"),u=o(this,"ssfi"),c=o(this,"message"),l=o(this,"negate")||!1;new n(a,c,u,!0).is.a("function"),(e instanceof RegExp||"string"==typeof e)&&(r=e,e=null);try{a()}catch(e){s=e}var h=void 0===e&&void 0===r,f=Boolean(e&&r),d=!1,p=!1;if(h||!h&&!l){var y="an error";e instanceof Error?y="#{exp}":e&&(y=t.checkError.getConstructorName(e)),this.assert(s,"expected #{this} to throw "+y,"expected #{this} to not throw an error but #{act} was thrown",e&&e.toString(),s instanceof Error?s.toString():"string"==typeof s?s:s&&t.checkError.getConstructorName(s))}if(e&&s){if(e instanceof Error)t.checkError.compatibleInstance(s,e)===l&&(f&&l?d=!0:this.assert(l,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}"+(s&&!l?" but #{act} was thrown":""),e.toString(),s.toString()));t.checkError.compatibleConstructor(s,e)===l&&(f&&l?d=!0:this.assert(l,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}"+(s?" but #{act} was thrown":""),e instanceof Error?e.toString():e&&t.checkError.getConstructorName(e),s instanceof Error?s.toString():s&&t.checkError.getConstructorName(s)))}if(s&&null!=r){var m="including";r instanceof RegExp&&(m="matching"),t.checkError.compatibleMessage(s,r)===l&&(f&&l?p=!0:this.assert(l,"expected #{this} to throw error "+m+" #{exp} but got #{act}","expected #{this} to throw error not "+m+" #{exp}",r,t.checkError.getMessage(s)))}d&&p&&this.assert(l,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}"+(s?" but #{act} was thrown":""),e instanceof Error?e.toString():e&&t.checkError.getConstructorName(e),s instanceof Error?s.toString():s&&t.checkError.getConstructorName(s)),o(this,"object",s)}function x(e,n){n&&o(this,"message",n);var r=o(this,"object"),i=o(this,"itself"),s="function"!=typeof r||i?r[e]:r.prototype[e];this.assert("function"==typeof s,"expected #{this} to respond to "+t.inspect(e),"expected #{this} to not respond to "+t.inspect(e))}function D(e,n){n&&o(this,"message",n);var r=e(o(this,"object"));this.assert(r,"expected #{this} to satisfy "+t.objDisplay(e),"expected #{this} to not satisfy"+t.objDisplay(e),!o(this,"negate"),r)}function N(e,t,i){i&&o(this,"message",i);var s=o(this,"object"),a=o(this,"message"),u=o(this,"ssfi");if(new n(s,a,u,!0).is.a("number"),"number"!=typeof e||"number"!=typeof t)throw new r((a=a?a+": ":"")+"the arguments to closeTo or approximately must be numbers"+(void 0===t?", and a delta is required":""),void 0,u);this.assert(Math.abs(s-e)<=t,"expected #{this} to be close to "+e+" +/- "+t,"expected #{this} not to be close to "+e+" +/- "+t)}function T(e,t,r){r&&o(this,"message",r);var i,s=o(this,"object"),a=o(this,"message"),u=o(this,"ssfi");new n(s,a,u,!0).is.a("function"),t?(new n(e,a,u,!0).to.have.property(t),i=e[t]):(new n(e,a,u,!0).is.a("function"),i=e()),s();var c=null==t?e():e[t],l=null==t?i:"."+t;o(this,"deltaMsgObj",l),o(this,"initialDeltaValue",i),o(this,"finalDeltaValue",c),o(this,"deltaBehavior","change"),o(this,"realDelta",c!==i),this.assert(i!==c,"expected "+l+" to change","expected "+l+" to not change")}function E(e,t,r){r&&o(this,"message",r);var i,s=o(this,"object"),a=o(this,"message"),u=o(this,"ssfi");new n(s,a,u,!0).is.a("function"),t?(new n(e,a,u,!0).to.have.property(t),i=e[t]):(new n(e,a,u,!0).is.a("function"),i=e()),new n(i,a,u,!0).is.a("number"),s();var c=null==t?e():e[t],l=null==t?i:"."+t;o(this,"deltaMsgObj",l),o(this,"initialDeltaValue",i),o(this,"finalDeltaValue",c),o(this,"deltaBehavior","increase"),o(this,"realDelta",c-i),this.assert(c-i>0,"expected "+l+" to increase","expected "+l+" to not increase")}function P(e,t,r){r&&o(this,"message",r);var i,s=o(this,"object"),a=o(this,"message"),u=o(this,"ssfi");new n(s,a,u,!0).is.a("function"),t?(new n(e,a,u,!0).to.have.property(t),i=e[t]):(new n(e,a,u,!0).is.a("function"),i=e()),new n(i,a,u,!0).is.a("number"),s();var c=null==t?e():e[t],l=null==t?i:"."+t;o(this,"deltaMsgObj",l),o(this,"initialDeltaValue",i),o(this,"finalDeltaValue",c),o(this,"deltaBehavior","decrease"),o(this,"realDelta",i-c),this.assert(c-i<0,"expected "+l+" to decrease","expected "+l+" to not decrease")}["to","be","been","is","and","has","have","with","that","which","at","of","same","but","does","still","also"].forEach((function(e){n.addProperty(e)})),n.addProperty("not",(function(){o(this,"negate",!0)})),n.addProperty("deep",(function(){o(this,"deep",!0)})),n.addProperty("nested",(function(){o(this,"nested",!0)})),n.addProperty("own",(function(){o(this,"own",!0)})),n.addProperty("ordered",(function(){o(this,"ordered",!0)})),n.addProperty("any",(function(){o(this,"any",!0),o(this,"all",!1)})),n.addProperty("all",(function(){o(this,"all",!0),o(this,"any",!1)})),n.addChainableMethod("an",i),n.addChainableMethod("a",i),n.addChainableMethod("include",u,a),n.addChainableMethod("contain",u,a),n.addChainableMethod("contains",u,a),n.addChainableMethod("includes",u,a),n.addProperty("ok",(function(){this.assert(o(this,"object"),"expected #{this} to be truthy","expected #{this} to be falsy")})),n.addProperty("true",(function(){this.assert(!0===o(this,"object"),"expected #{this} to be true","expected #{this} to be false",!o(this,"negate"))})),n.addProperty("false",(function(){this.assert(!1===o(this,"object"),"expected #{this} to be false","expected #{this} to be true",!!o(this,"negate"))})),n.addProperty("null",(function(){this.assert(null===o(this,"object"),"expected #{this} to be null","expected #{this} not to be null")})),n.addProperty("undefined",(function(){this.assert(void 0===o(this,"object"),"expected #{this} to be undefined","expected #{this} not to be undefined")})),n.addProperty("NaN",(function(){this.assert(t.isNaN(o(this,"object")),"expected #{this} to be NaN","expected #{this} not to be NaN")})),n.addProperty("exist",c),n.addProperty("exists",c),n.addProperty("empty",(function(){var e,n=o(this,"object"),i=o(this,"ssfi"),s=o(this,"message");switch(s=s?s+": ":"",t.type(n).toLowerCase()){case"array":case"string":e=n.length;break;case"map":case"set":e=n.size;break;case"weakmap":case"weakset":throw new r(s+".empty was passed a weak collection",void 0,i);case"function":var a=s+".empty was passed a function "+t.getName(n);throw new r(a.trim(),void 0,i);default:if(n!==Object(n))throw new r(s+".empty was passed non-string primitive "+t.inspect(n),void 0,i);e=Object.keys(n).length}this.assert(0===e,"expected #{this} to be empty","expected #{this} not to be empty")})),n.addProperty("arguments",l),n.addProperty("Arguments",l),n.addMethod("equal",h),n.addMethod("equals",h),n.addMethod("eq",h),n.addMethod("eql",f),n.addMethod("eqls",f),n.addMethod("above",d),n.addMethod("gt",d),n.addMethod("greaterThan",d),n.addMethod("least",p),n.addMethod("gte",p),n.addMethod("greaterThanOrEqual",p),n.addMethod("below",y),n.addMethod("lt",y),n.addMethod("lessThan",y),n.addMethod("most",m),n.addMethod("lte",m),n.addMethod("lessThanOrEqual",m),n.addMethod("within",(function(e,i,s){s&&o(this,"message",s);var a,u=o(this,"object"),c=o(this,"doLength"),l=o(this,"message"),h=l?l+": ":"",f=o(this,"ssfi"),d=t.type(u).toLowerCase(),p=t.type(e).toLowerCase(),y=t.type(i).toLowerCase(),m=!0,g="date"===p&&"date"===y?e.toISOString()+".."+i.toISOString():e+".."+i;if(c&&"map"!==d&&"set"!==d&&new n(u,l,f,!0).to.have.property("length"),c||"date"!==d||"date"===p&&"date"===y)if("number"===p&&"number"===y||!c&&"number"!==d)if(c||"date"===d||"number"===d)m=!1;else{a=h+"expected "+("string"===d?"'"+u+"'":u)+" to be a number or a date"}else a=h+"the arguments to within must be numbers";else a=h+"the arguments to within must be dates";if(m)throw new r(a,void 0,f);if(c){var w,b="length";"map"===d||"set"===d?(b="size",w=u.size):w=u.length,this.assert(w>=e&&w<=i,"expected #{this} to have a "+b+" within "+g,"expected #{this} to not have a "+b+" within "+g)}else this.assert(u>=e&&u<=i,"expected #{this} to be within "+g,"expected #{this} to not be within "+g)})),n.addMethod("instanceof",g),n.addMethod("instanceOf",g),n.addMethod("property",w),n.addMethod("ownProperty",b),n.addMethod("haveOwnProperty",b),n.addMethod("ownPropertyDescriptor",v),n.addMethod("haveOwnPropertyDescriptor",v),n.addChainableMethod("length",M,_),n.addChainableMethod("lengthOf",M,_),n.addMethod("match",S),n.addMethod("matches",S),n.addMethod("string",(function(e,r){r&&o(this,"message",r);var i=o(this,"object"),s=o(this,"message"),a=o(this,"ssfi");new n(i,s,a,!0).is.a("string"),this.assert(~i.indexOf(e),"expected #{this} to contain "+t.inspect(e),"expected #{this} to not contain "+t.inspect(e))})),n.addMethod("keys",O),n.addMethod("key",O),n.addMethod("throw",k),n.addMethod("throws",k),n.addMethod("Throw",k),n.addMethod("respondTo",x),n.addMethod("respondsTo",x),n.addProperty("itself",(function(){o(this,"itself",!0)})),n.addMethod("satisfy",D),n.addMethod("satisfies",D),n.addMethod("closeTo",N),n.addMethod("approximately",N),n.addMethod("members",(function(e,t){t&&o(this,"message",t);var r=o(this,"object"),i=o(this,"message"),s=o(this,"ssfi");new n(r,i,s,!0).to.be.an("array"),new n(e,i,s,!0).to.be.an("array");var a,u,c,l=o(this,"contains"),h=o(this,"ordered");l?(u="expected #{this} to be "+(a=h?"an ordered superset":"a superset")+" of #{exp}",c="expected #{this} to not be "+a+" of #{exp}"):(u="expected #{this} to have the same "+(a=h?"ordered members":"members")+" as #{exp}",c="expected #{this} to not have the same "+a+" as #{exp}");var f=o(this,"deep")?o(this,"eql"):void 0;this.assert(function(e,t,n,r,o){if(!r){if(e.length!==t.length)return!1;t=t.slice()}return e.every((function(e,i){if(o)return n?n(e,t[i]):e===t[i];if(!n){var s=t.indexOf(e);return-1!==s&&(r||t.splice(s,1),!0)}return t.some((function(o,i){return!!n(e,o)&&(r||t.splice(i,1),!0)}))}))}(e,r,f,l,h),u,c,e,r,!0)})),n.addMethod("oneOf",(function(e,t){t&&o(this,"message",t);var r=o(this,"object"),i=o(this,"message"),s=o(this,"ssfi"),a=o(this,"contains"),u=o(this,"deep"),c=o(this,"eql");new n(e,i,s,!0).to.be.an("array"),a?this.assert(e.some((function(e){return r.indexOf(e)>-1})),"expected #{this} to contain one of #{exp}","expected #{this} to not contain one of #{exp}",e,r):u?this.assert(e.some((function(e){return c(r,e)})),"expected #{this} to deeply equal one of #{exp}","expected #{this} to deeply equal one of #{exp}",e,r):this.assert(e.indexOf(r)>-1,"expected #{this} to be one of #{exp}","expected #{this} to not be one of #{exp}",e,r)})),n.addMethod("change",T),n.addMethod("changes",T),n.addMethod("increase",E),n.addMethod("increases",E),n.addMethod("decrease",P),n.addMethod("decreases",P),n.addMethod("by",(function(e,t){t&&o(this,"message",t);var n,r=o(this,"deltaMsgObj"),i=o(this,"initialDeltaValue"),s=o(this,"finalDeltaValue"),a=o(this,"deltaBehavior"),u=o(this,"realDelta");n="change"===a?Math.abs(s-i)===Math.abs(e):u===Math.abs(e),this.assert(n,"expected "+r+" to "+a+" by "+e,"expected "+r+" to not "+a+" by "+e)})),n.addProperty("extensible",(function(){var e=o(this,"object"),t=e===Object(e)&&Object.isExtensible(e);this.assert(t,"expected #{this} to be extensible","expected #{this} to not be extensible")})),n.addProperty("sealed",(function(){var e=o(this,"object"),t=e!==Object(e)||Object.isSealed(e);this.assert(t,"expected #{this} to be sealed","expected #{this} to not be sealed")})),n.addProperty("frozen",(function(){var e=o(this,"object"),t=e!==Object(e)||Object.isFrozen(e);this.assert(t,"expected #{this} to be frozen","expected #{this} to not be frozen")})),n.addProperty("finite",(function(e){var t=o(this,"object");this.assert("number"==typeof t&&isFinite(t),"expected #{this} to be a finite number","expected #{this} to not be a finite number")}))},Dt=function(e,t){e.expect=function(t,n){return new e.Assertion(t,n)},e.expect.fail=function(t,n,r,o){throw arguments.length<2&&(r=t,t=void 0),r=r||"expect.fail()",new e.AssertionError(r,{actual:t,expected:n,operator:o},e.expect.fail)}},Nt=function(e,t){var n=e.Assertion;function r(){Object.defineProperty(Object.prototype,"should",{set:function(e){Object.defineProperty(this,"should",{value:e,enumerable:!0,configurable:!0,writable:!0})},get:function e(){return this instanceof String||this instanceof Number||this instanceof Boolean||"function"==typeof Symbol&&this instanceof Symbol||"function"==typeof BigInt&&this instanceof BigInt?new n(this.valueOf(),null,e):new n(this,null,e)},configurable:!0});var t={fail:function(n,r,o,i){throw arguments.length<2&&(o=n,n=void 0),o=o||"should.fail()",new e.AssertionError(o,{actual:n,expected:r,operator:i},t.fail)},equal:function(e,t,r){new n(e,r).to.equal(t)},Throw:function(e,t,r,o){new n(e,o).to.Throw(t,r)},exist:function(e,t){new n(e,t).to.exist},not:{}};return t.not.equal=function(e,t,r){new n(e,r).to.not.equal(t)},t.not.Throw=function(e,t,r,o){new n(e,o).to.not.Throw(t,r)},t.not.exist=function(e,t){new n(e,t).to.not.exist},t.throw=t.Throw,t.not.throw=t.not.Throw,t}e.should=r,e.Should=r},Tt=function(e,t){ +/*! + * Chai dependencies. + */ +var n=e.Assertion,r=t.flag,o=e.assert=function(t,r){new n(null,null,e.assert,!0).assert(t,r,"[ negation message unavailable ]")}; +/*! + * Module export. + */o.fail=function(t,n,r,i){throw arguments.length<2&&(r=t,t=void 0),r=r||"assert.fail()",new e.AssertionError(r,{actual:t,expected:n,operator:i},o.fail)},o.isOk=function(e,t){new n(e,t,o.isOk,!0).is.ok},o.isNotOk=function(e,t){new n(e,t,o.isNotOk,!0).is.not.ok},o.equal=function(e,t,i){var s=new n(e,i,o.equal,!0);s.assert(t==r(s,"object"),"expected #{this} to equal #{exp}","expected #{this} to not equal #{act}",t,e,!0)},o.notEqual=function(e,t,i){var s=new n(e,i,o.notEqual,!0);s.assert(t!=r(s,"object"),"expected #{this} to not equal #{exp}","expected #{this} to equal #{act}",t,e,!0)},o.strictEqual=function(e,t,r){new n(e,r,o.strictEqual,!0).to.equal(t)},o.notStrictEqual=function(e,t,r){new n(e,r,o.notStrictEqual,!0).to.not.equal(t)},o.deepEqual=o.deepStrictEqual=function(e,t,r){new n(e,r,o.deepEqual,!0).to.eql(t)},o.notDeepEqual=function(e,t,r){new n(e,r,o.notDeepEqual,!0).to.not.eql(t)},o.isAbove=function(e,t,r){new n(e,r,o.isAbove,!0).to.be.above(t)},o.isAtLeast=function(e,t,r){new n(e,r,o.isAtLeast,!0).to.be.least(t)},o.isBelow=function(e,t,r){new n(e,r,o.isBelow,!0).to.be.below(t)},o.isAtMost=function(e,t,r){new n(e,r,o.isAtMost,!0).to.be.most(t)},o.isTrue=function(e,t){new n(e,t,o.isTrue,!0).is.true},o.isNotTrue=function(e,t){new n(e,t,o.isNotTrue,!0).to.not.equal(!0)},o.isFalse=function(e,t){new n(e,t,o.isFalse,!0).is.false},o.isNotFalse=function(e,t){new n(e,t,o.isNotFalse,!0).to.not.equal(!1)},o.isNull=function(e,t){new n(e,t,o.isNull,!0).to.equal(null)},o.isNotNull=function(e,t){new n(e,t,o.isNotNull,!0).to.not.equal(null)},o.isNaN=function(e,t){new n(e,t,o.isNaN,!0).to.be.NaN},o.isNotNaN=function(e,t){new n(e,t,o.isNotNaN,!0).not.to.be.NaN},o.exists=function(e,t){new n(e,t,o.exists,!0).to.exist},o.notExists=function(e,t){new n(e,t,o.notExists,!0).to.not.exist},o.isUndefined=function(e,t){new n(e,t,o.isUndefined,!0).to.equal(void 0)},o.isDefined=function(e,t){new n(e,t,o.isDefined,!0).to.not.equal(void 0)},o.isFunction=function(e,t){new n(e,t,o.isFunction,!0).to.be.a("function")},o.isNotFunction=function(e,t){new n(e,t,o.isNotFunction,!0).to.not.be.a("function")},o.isObject=function(e,t){new n(e,t,o.isObject,!0).to.be.a("object")},o.isNotObject=function(e,t){new n(e,t,o.isNotObject,!0).to.not.be.a("object")},o.isArray=function(e,t){new n(e,t,o.isArray,!0).to.be.an("array")},o.isNotArray=function(e,t){new n(e,t,o.isNotArray,!0).to.not.be.an("array")},o.isString=function(e,t){new n(e,t,o.isString,!0).to.be.a("string")},o.isNotString=function(e,t){new n(e,t,o.isNotString,!0).to.not.be.a("string")},o.isNumber=function(e,t){new n(e,t,o.isNumber,!0).to.be.a("number")},o.isNotNumber=function(e,t){new n(e,t,o.isNotNumber,!0).to.not.be.a("number")},o.isFinite=function(e,t){new n(e,t,o.isFinite,!0).to.be.finite},o.isBoolean=function(e,t){new n(e,t,o.isBoolean,!0).to.be.a("boolean")},o.isNotBoolean=function(e,t){new n(e,t,o.isNotBoolean,!0).to.not.be.a("boolean")},o.typeOf=function(e,t,r){new n(e,r,o.typeOf,!0).to.be.a(t)},o.notTypeOf=function(e,t,r){new n(e,r,o.notTypeOf,!0).to.not.be.a(t)},o.instanceOf=function(e,t,r){new n(e,r,o.instanceOf,!0).to.be.instanceOf(t)},o.notInstanceOf=function(e,t,r){new n(e,r,o.notInstanceOf,!0).to.not.be.instanceOf(t)},o.include=function(e,t,r){new n(e,r,o.include,!0).include(t)},o.notInclude=function(e,t,r){new n(e,r,o.notInclude,!0).not.include(t)},o.deepInclude=function(e,t,r){new n(e,r,o.deepInclude,!0).deep.include(t)},o.notDeepInclude=function(e,t,r){new n(e,r,o.notDeepInclude,!0).not.deep.include(t)},o.nestedInclude=function(e,t,r){new n(e,r,o.nestedInclude,!0).nested.include(t)},o.notNestedInclude=function(e,t,r){new n(e,r,o.notNestedInclude,!0).not.nested.include(t)},o.deepNestedInclude=function(e,t,r){new n(e,r,o.deepNestedInclude,!0).deep.nested.include(t)},o.notDeepNestedInclude=function(e,t,r){new n(e,r,o.notDeepNestedInclude,!0).not.deep.nested.include(t)},o.ownInclude=function(e,t,r){new n(e,r,o.ownInclude,!0).own.include(t)},o.notOwnInclude=function(e,t,r){new n(e,r,o.notOwnInclude,!0).not.own.include(t)},o.deepOwnInclude=function(e,t,r){new n(e,r,o.deepOwnInclude,!0).deep.own.include(t)},o.notDeepOwnInclude=function(e,t,r){new n(e,r,o.notDeepOwnInclude,!0).not.deep.own.include(t)},o.match=function(e,t,r){new n(e,r,o.match,!0).to.match(t)},o.notMatch=function(e,t,r){new n(e,r,o.notMatch,!0).to.not.match(t)},o.property=function(e,t,r){new n(e,r,o.property,!0).to.have.property(t)},o.notProperty=function(e,t,r){new n(e,r,o.notProperty,!0).to.not.have.property(t)},o.propertyVal=function(e,t,r,i){new n(e,i,o.propertyVal,!0).to.have.property(t,r)},o.notPropertyVal=function(e,t,r,i){new n(e,i,o.notPropertyVal,!0).to.not.have.property(t,r)},o.deepPropertyVal=function(e,t,r,i){new n(e,i,o.deepPropertyVal,!0).to.have.deep.property(t,r)},o.notDeepPropertyVal=function(e,t,r,i){new n(e,i,o.notDeepPropertyVal,!0).to.not.have.deep.property(t,r)},o.ownProperty=function(e,t,r){new n(e,r,o.ownProperty,!0).to.have.own.property(t)},o.notOwnProperty=function(e,t,r){new n(e,r,o.notOwnProperty,!0).to.not.have.own.property(t)},o.ownPropertyVal=function(e,t,r,i){new n(e,i,o.ownPropertyVal,!0).to.have.own.property(t,r)},o.notOwnPropertyVal=function(e,t,r,i){new n(e,i,o.notOwnPropertyVal,!0).to.not.have.own.property(t,r)},o.deepOwnPropertyVal=function(e,t,r,i){new n(e,i,o.deepOwnPropertyVal,!0).to.have.deep.own.property(t,r)},o.notDeepOwnPropertyVal=function(e,t,r,i){new n(e,i,o.notDeepOwnPropertyVal,!0).to.not.have.deep.own.property(t,r)},o.nestedProperty=function(e,t,r){new n(e,r,o.nestedProperty,!0).to.have.nested.property(t)},o.notNestedProperty=function(e,t,r){new n(e,r,o.notNestedProperty,!0).to.not.have.nested.property(t)},o.nestedPropertyVal=function(e,t,r,i){new n(e,i,o.nestedPropertyVal,!0).to.have.nested.property(t,r)},o.notNestedPropertyVal=function(e,t,r,i){new n(e,i,o.notNestedPropertyVal,!0).to.not.have.nested.property(t,r)},o.deepNestedPropertyVal=function(e,t,r,i){new n(e,i,o.deepNestedPropertyVal,!0).to.have.deep.nested.property(t,r)},o.notDeepNestedPropertyVal=function(e,t,r,i){new n(e,i,o.notDeepNestedPropertyVal,!0).to.not.have.deep.nested.property(t,r)},o.lengthOf=function(e,t,r){new n(e,r,o.lengthOf,!0).to.have.lengthOf(t)},o.hasAnyKeys=function(e,t,r){new n(e,r,o.hasAnyKeys,!0).to.have.any.keys(t)},o.hasAllKeys=function(e,t,r){new n(e,r,o.hasAllKeys,!0).to.have.all.keys(t)},o.containsAllKeys=function(e,t,r){new n(e,r,o.containsAllKeys,!0).to.contain.all.keys(t)},o.doesNotHaveAnyKeys=function(e,t,r){new n(e,r,o.doesNotHaveAnyKeys,!0).to.not.have.any.keys(t)},o.doesNotHaveAllKeys=function(e,t,r){new n(e,r,o.doesNotHaveAllKeys,!0).to.not.have.all.keys(t)},o.hasAnyDeepKeys=function(e,t,r){new n(e,r,o.hasAnyDeepKeys,!0).to.have.any.deep.keys(t)},o.hasAllDeepKeys=function(e,t,r){new n(e,r,o.hasAllDeepKeys,!0).to.have.all.deep.keys(t)},o.containsAllDeepKeys=function(e,t,r){new n(e,r,o.containsAllDeepKeys,!0).to.contain.all.deep.keys(t)},o.doesNotHaveAnyDeepKeys=function(e,t,r){new n(e,r,o.doesNotHaveAnyDeepKeys,!0).to.not.have.any.deep.keys(t)},o.doesNotHaveAllDeepKeys=function(e,t,r){new n(e,r,o.doesNotHaveAllDeepKeys,!0).to.not.have.all.deep.keys(t)},o.throws=function(e,t,i,s){("string"==typeof t||t instanceof RegExp)&&(i=t,t=null);var a=new n(e,s,o.throws,!0).to.throw(t,i);return r(a,"object")},o.doesNotThrow=function(e,t,r,i){("string"==typeof t||t instanceof RegExp)&&(r=t,t=null),new n(e,i,o.doesNotThrow,!0).to.not.throw(t,r)},o.operator=function(i,s,a,u){var c;switch(s){case"==":c=i==a;break;case"===":c=i===a;break;case">":c=i>a;break;case">=":c=i>=a;break;case"<":c=i0?o-4:o;for(n=0;n>16&255,s[a++]=t>>8&255,s[a++]=255&t;2===i&&(t=It[e.charCodeAt(n)]<<2|It[e.charCodeAt(n+1)]>>4,s[a++]=255&t);1===i&&(t=It[e.charCodeAt(n)]<<10|It[e.charCodeAt(n+1)]<<4|It[e.charCodeAt(n+2)]>>2,s[a++]=t>>8&255,s[a++]=255&t);return s},fromByteArray:function(e){for(var t,n=e.length,r=n%3,o=[],i=16383,s=0,a=n-r;sa?a:s+i));1===r?(t=e[n-1],o.push(Ut[t>>2]+Ut[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],o.push(Ut[t>>10]+Ut[t>>4&63]+Ut[t<<2&63]+"="));return o.join("")}},Ut=[],It=[],Lt="undefined"!=typeof Uint8Array?Uint8Array:Array,Rt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Bt=0;Bt<64;++Bt)Ut[Bt]=Rt[Bt],It[Rt.charCodeAt(Bt)]=Bt;function Wt(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function Ft(e,t,n){for(var r,o,i=[],s=t;s>18&63]+Ut[o>>12&63]+Ut[o>>6&63]+Ut[63&o]);return i.join("")}It["-".charCodeAt(0)]=62,It["_".charCodeAt(0)]=63;var Ht={}; +/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */function zt(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}Ht.read=function(e,t,n,r,o){var i,s,a=8*o-r-1,u=(1<>1,l=-7,h=n?o-1:0,f=n?-1:1,d=e[t+h];for(h+=f,i=d&(1<<-l)-1,d>>=-l,l+=a;l>0;i=256*i+e[t+h],h+=f,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=r;l>0;s=256*s+e[t+h],h+=f,l-=8);if(0===i)i=1-c;else{if(i===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),i-=c}return(d?-1:1)*s*Math.pow(2,i-r)},Ht.write=function(e,t,n,r,o,i){var s,a,u,c=8*i-o-1,l=(1<>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,p=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(t*u-1)*Math.pow(2,o),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;e[n+d]=255&a,d+=p,a/=256,o-=8);for(s=s<0;e[n+d]=255&s,d+=p,s/=256,c-=8);e[n+d-p]|=128*y}, +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +function(e){var t=Ct,n=Ht,r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=function(e){+e!=e&&(e=0);return s.alloc(+e)},e.INSPECT_MAX_BYTES=50;var o=2147483647;function i(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return a(e,t,n)}function a(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|d(e,t),r=i(n),o=r.write(e,t);o!==n&&(r=r.slice(0,o));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(R(e,Uint8Array)){var t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return l(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(R(e,ArrayBuffer)||e&&R(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(R(e,SharedArrayBuffer)||e&&R(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return s.from(r,t,n);var o=function(e){if(s.isBuffer(e)){var t=0|f(e.length),n=i(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||B(e.length)?i(0):l(e);if("Buffer"===e.type&&Array.isArray(e.data))return l(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),i(e<0?0:0|f(e))}function l(e){for(var t=e.length<0?0:0|f(e.length),n=i(t),r=0;r=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function d(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||R(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return I(e).length;default:if(o)return r?-1:U(e).length;t=(""+t).toLowerCase(),o=!0}}function p(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return N(this,t,n);case"utf8":case"utf-8":return O(this,t,n);case"ascii":return x(this,t,n);case"latin1":case"binary":return D(this,t,n);case"base64":return S(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function m(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),B(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=s.from(t,r)),s.isBuffer(t))return 0===t.length?-1:g(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):g(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function g(e,t,n,r,o){var i,s=1,a=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var l=-1;for(i=n;ia&&(n=a-u),i=n;i>=0;i--){for(var h=!0,f=0;fo&&(r=o):r=o;var i=t.length;r>i/2&&(r=i/2);for(var s=0;s>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function S(e,n,r){return 0===n&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function O(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:c>223?3:c>191?2:1;if(o+h<=n)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(i=e[o+1]))&&(u=(31&c)<<6|63&i)>127&&(l=u);break;case 3:i=e[o+1],s=e[o+2],128==(192&i)&&128==(192&s)&&(u=(15&c)<<12|(63&i)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=e[o+1],s=e[o+2],a=e[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),o+=h}return function(e){var t=e.length;if(t<=k)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rr.length?s.from(i).copy(r,o):Uint8Array.prototype.set.call(r,i,o);else{if(!s.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(r,o)}o+=i.length}return r},s.byteLength=d,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tn&&(t+=" ... "),""},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,o){if(R(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),u=Math.min(i,a),c=this.slice(r,o),l=e.slice(t,n),h=0;h>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return b(this,e,t,n);case"ascii":case"latin1":case"binary":return v(this,e,t,n);case"base64":return _(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function x(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;or)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,r,o,i){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function Y(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(e,t,r,o,i){return t=+t,r>>>=0,i||Y(e,0,r,4),n.write(e,t,r,o,23,4),r+4}function A(e,t,r,o,i){return t=+t,r>>>=0,i||Y(e,0,r,8),n.write(e,t,r,o,52,8),r+8}s.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||E(e,t,this.length);for(var r=this[e],o=1,i=0;++i>>=0,t>>>=0,n||E(e,t,this.length);for(var r=this[e+--t],o=1;t>0&&(o*=256);)r+=this[e+--t]*o;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||E(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||E(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||E(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||E(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||E(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||E(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||E(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},s.prototype.readInt8=function(e,t){return e>>>=0,t||E(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||E(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||E(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||E(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||E(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||E(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||E(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||E(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||E(e,8,this.length),n.read(this,e,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t>>>=0,n>>>=0,r)||P(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i>>=0,n>>>=0,r)||P(this,e,t,n,Math.pow(2,8*n)-1,0);var o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var o=Math.pow(2,8*n-1);P(this,e,t,n,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i>>=0,!r){var o=Math.pow(2,8*n-1);P(this,e,t,n,o-1,-o)}var i=n-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s|0)-a&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,n){return j(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return j(this,e,t,!1,n)},s.prototype.writeDoubleLE=function(e,t,n){return A(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return A(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function I(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(C,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function L(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function B(e){return e!=e}var W=function(){for(var e="0123456789abcdef",t=new Array(256),n=0;n<16;++n)for(var r=16*n,o=0;o<16;++o)t[r+o]=e[n]+e[o];return t}()}(At);var Vt={};!function(e){e.exports=function(){var t,n;function r(){return t.apply(null,arguments)}function o(e){t=e}function i(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function s(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function a(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function u(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(a(e,t))return!1;return!0}function c(e){return void 0===e}function l(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function h(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function f(e,t){var n,r=[],o=e.length;for(n=0;n>>0;for(t=0;t0)for(n=0;n=0?n?"+":"":"-")+Math.pow(10,Math.max(0,o)).toString().substr(1)+r}var U=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,I=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,L={},R={};function B(e,t,n,r){var o=r;"string"==typeof r&&(o=function(){return this[r]()}),e&&(R[e]=o),t&&(R[t[0]]=function(){return C(o.apply(this,arguments),t[1],t[2])}),n&&(R[n]=function(){return this.localeData().ordinal(o.apply(this,arguments),e)})}function W(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function F(e){var t,n,r=e.match(U);for(t=0,n=r.length;t=0&&I.test(e);)e=e.replace(I,r),I.lastIndex=0,n-=1;return e}var V={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function q(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(U).map((function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e})).join(""),this._longDateFormat[e])}var $="Invalid date";function G(){return this._invalidDate}var Z="%d",K=/\d{1,2}/;function J(e){return this._ordinal.replace("%d",e)}var Q={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function X(e,t,n,r){var o=this._relativeTime[n];return T(o)?o(e,t,n,r):o.replace(/%d/i,e)}function ee(e,t){var n=this._relativeTime[e>0?"future":"past"];return T(n)?n(t):n.replace(/%s/i,t)}var te={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function ne(e){return"string"==typeof e?te[e]||te[e.toLowerCase()]:void 0}function re(e){var t,n,r={};for(n in e)a(e,n)&&(t=ne(n))&&(r[t]=e[n]);return r}var oe={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function ie(e){var t,n=[];for(t in e)a(e,t)&&n.push({unit:t,priority:oe[t]});return n.sort((function(e,t){return e.priority-t.priority})),n}var se,ae=/\d/,ue=/\d\d/,ce=/\d{3}/,le=/\d{4}/,he=/[+-]?\d{6}/,fe=/\d\d?/,de=/\d\d\d\d?/,pe=/\d\d\d\d\d\d?/,ye=/\d{1,3}/,me=/\d{1,4}/,ge=/[+-]?\d{1,6}/,we=/\d+/,be=/[+-]?\d+/,ve=/Z|[+-]\d\d:?\d\d/gi,_e=/Z|[+-]\d\d(?::?\d\d)?/gi,Me=/[+-]?\d+(\.\d{1,3})?/,Se=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,Oe=/^[1-9]\d?/,ke=/^([1-9]\d|\d)/;function xe(e,t,n){se[e]=T(t)?t:function(e,r){return e&&n?n:t}}function De(e,t){return a(se,e)?se[e](t._strict,t._locale):new RegExp(Ne(e))}function Ne(e){return Te(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,(function(e,t,n,r,o){return t||n||r||o})))}function Te(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Ee(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function Pe(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=Ee(t)),n}se={};var Ye={};function je(e,t){var n,r,o=t;for("string"==typeof e&&(e=[e]),l(t)&&(o=function(e,n){n[t]=Pe(e)}),r=e.length,n=0;n68?1900:2e3)};var $e,Ge=Ke("FullYear",!0);function Ze(){return Ue(this.year())}function Ke(e,t){return function(n){return null!=n?(Qe(this,e,n),r.updateOffset(this,t),this):Je(this,e)}}function Je(e,t){if(!e.isValid())return NaN;var n=e._d,r=e._isUTC;switch(t){case"Milliseconds":return r?n.getUTCMilliseconds():n.getMilliseconds();case"Seconds":return r?n.getUTCSeconds():n.getSeconds();case"Minutes":return r?n.getUTCMinutes():n.getMinutes();case"Hours":return r?n.getUTCHours():n.getHours();case"Date":return r?n.getUTCDate():n.getDate();case"Day":return r?n.getUTCDay():n.getDay();case"Month":return r?n.getUTCMonth():n.getMonth();case"FullYear":return r?n.getUTCFullYear():n.getFullYear();default:return NaN}}function Qe(e,t,n){var r,o,i,s,a;if(e.isValid()&&!isNaN(n)){switch(r=e._d,o=e._isUTC,t){case"Milliseconds":return void(o?r.setUTCMilliseconds(n):r.setMilliseconds(n));case"Seconds":return void(o?r.setUTCSeconds(n):r.setSeconds(n));case"Minutes":return void(o?r.setUTCMinutes(n):r.setMinutes(n));case"Hours":return void(o?r.setUTCHours(n):r.setHours(n));case"Date":return void(o?r.setUTCDate(n):r.setDate(n));case"FullYear":break;default:return}i=n,s=e.month(),a=29!==(a=e.date())||1!==s||Ue(i)?a:28,o?r.setUTCFullYear(i,s,a):r.setFullYear(i,s,a)}}function Xe(e){return T(this[e=ne(e)])?this[e]():this}function et(e,t){if("object"==typeof e){var n,r=ie(e=re(e)),o=r.length;for(n=0;n=0?(a=new Date(e+400,t,n,r,o,i,s),isFinite(a.getFullYear())&&a.setFullYear(e)):a=new Date(e,t,n,r,o,i,s),a}function bt(e){var t,n;return e<100&&e>=0?((n=Array.prototype.slice.call(arguments))[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function vt(e,t,n){var r=7+t-n;return-(7+bt(e,0,r).getUTCDay()-t)%7+r-1}function _t(e,t,n,r,o){var i,s,a=1+7*(t-1)+(7+n-r)%7+vt(e,r,o);return a<=0?s=qe(i=e-1)+a:a>qe(e)?(i=e+1,s=a-qe(e)):(i=e,s=a),{year:i,dayOfYear:s}}function Mt(e,t,n){var r,o,i=vt(e.year(),t,n),s=Math.floor((e.dayOfYear()-i-1)/7)+1;return s<1?r=s+St(o=e.year()-1,t,n):s>St(e.year(),t,n)?(r=s-St(e.year(),t,n),o=e.year()+1):(o=e.year(),r=s),{week:r,year:o}}function St(e,t,n){var r=vt(e,t,n),o=vt(e+1,t,n);return(qe(e)-r+o)/7}function Ot(e){return Mt(e,this._week.dow,this._week.doy).week}B("w",["ww",2],"wo","week"),B("W",["WW",2],"Wo","isoWeek"),xe("w",fe,Oe),xe("ww",fe,ue),xe("W",fe,Oe),xe("WW",fe,ue),Ae(["w","ww","W","WW"],(function(e,t,n,r){t[r.substr(0,1)]=Pe(e)}));var kt={dow:0,doy:6};function xt(){return this._week.dow}function Dt(){return this._week.doy}function Nt(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")}function Tt(e){var t=Mt(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")}function Et(e,t){return"string"!=typeof e?e:isNaN(e)?"number"==typeof(e=t.weekdaysParse(e))?e:null:parseInt(e,10)}function Pt(e,t){return"string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function Yt(e,t){return e.slice(t,7).concat(e.slice(0,t))}B("d",0,"do","day"),B("dd",0,0,(function(e){return this.localeData().weekdaysMin(this,e)})),B("ddd",0,0,(function(e){return this.localeData().weekdaysShort(this,e)})),B("dddd",0,0,(function(e){return this.localeData().weekdays(this,e)})),B("e",0,0,"weekday"),B("E",0,0,"isoWeekday"),xe("d",fe),xe("e",fe),xe("E",fe),xe("dd",(function(e,t){return t.weekdaysMinRegex(e)})),xe("ddd",(function(e,t){return t.weekdaysShortRegex(e)})),xe("dddd",(function(e,t){return t.weekdaysRegex(e)})),Ae(["dd","ddd","dddd"],(function(e,t,n,r){var o=n._locale.weekdaysParse(e,r,n._strict);null!=o?t.d=o:m(n).invalidWeekday=e})),Ae(["d","e","E"],(function(e,t,n,r){t[r]=Pe(e)}));var jt="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),At="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Ct="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Ut=Se,It=Se,Lt=Se;function Rt(e,t){var n=i(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?Yt(n,this._week.dow):e?n[e.day()]:n}function Bt(e){return!0===e?Yt(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function Wt(e){return!0===e?Yt(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function Ft(e,t,n){var r,o,i,s=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)i=p([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(i,"").toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(i,"").toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(i,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(o=$e.call(this._weekdaysParse,s))?o:null:"ddd"===t?-1!==(o=$e.call(this._shortWeekdaysParse,s))?o:null:-1!==(o=$e.call(this._minWeekdaysParse,s))?o:null:"dddd"===t?-1!==(o=$e.call(this._weekdaysParse,s))||-1!==(o=$e.call(this._shortWeekdaysParse,s))||-1!==(o=$e.call(this._minWeekdaysParse,s))?o:null:"ddd"===t?-1!==(o=$e.call(this._shortWeekdaysParse,s))||-1!==(o=$e.call(this._weekdaysParse,s))||-1!==(o=$e.call(this._minWeekdaysParse,s))?o:null:-1!==(o=$e.call(this._minWeekdaysParse,s))||-1!==(o=$e.call(this._weekdaysParse,s))||-1!==(o=$e.call(this._shortWeekdaysParse,s))?o:null}function Ht(e,t,n){var r,o,i;if(this._weekdaysParseExact)return Ft.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++){if(o=p([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(o,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(o,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(o,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[r]||(i="^"+this.weekdays(o,"")+"|^"+this.weekdaysShort(o,"")+"|^"+this.weekdaysMin(o,""),this._weekdaysParse[r]=new RegExp(i.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[r].test(e))return r;if(n&&"ddd"===t&&this._shortWeekdaysParse[r].test(e))return r;if(n&&"dd"===t&&this._minWeekdaysParse[r].test(e))return r;if(!n&&this._weekdaysParse[r].test(e))return r}}function Vt(e){if(!this.isValid())return null!=e?this:NaN;var t=Je(this,"Day");return null!=e?(e=Et(e,this.localeData()),this.add(e-t,"d")):t}function qt(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")}function $t(e){if(!this.isValid())return null!=e?this:NaN;if(null!=e){var t=Pt(e,this.localeData());return this.day(this.day()%7?t:t-7)}return this.day()||7}function Gt(e){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||Jt.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(a(this,"_weekdaysRegex")||(this._weekdaysRegex=Ut),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function Zt(e){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||Jt.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(a(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=It),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Kt(e){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||Jt.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(a(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Lt),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Jt(){function e(e,t){return t.length-e.length}var t,n,r,o,i,s=[],a=[],u=[],c=[];for(t=0;t<7;t++)n=p([2e3,1]).day(t),r=Te(this.weekdaysMin(n,"")),o=Te(this.weekdaysShort(n,"")),i=Te(this.weekdays(n,"")),s.push(r),a.push(o),u.push(i),c.push(r),c.push(o),c.push(i);s.sort(e),a.sort(e),u.sort(e),c.sort(e),this._weekdaysRegex=new RegExp("^("+c.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+s.join("|")+")","i")}function Qt(){return this.hours()%12||12}function Xt(){return this.hours()||24}function en(e,t){B(e,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)}))}function tn(e,t){return t._meridiemParse}function nn(e){return"p"===(e+"").toLowerCase().charAt(0)}B("H",["HH",2],0,"hour"),B("h",["hh",2],0,Qt),B("k",["kk",2],0,Xt),B("hmm",0,0,(function(){return""+Qt.apply(this)+C(this.minutes(),2)})),B("hmmss",0,0,(function(){return""+Qt.apply(this)+C(this.minutes(),2)+C(this.seconds(),2)})),B("Hmm",0,0,(function(){return""+this.hours()+C(this.minutes(),2)})),B("Hmmss",0,0,(function(){return""+this.hours()+C(this.minutes(),2)+C(this.seconds(),2)})),en("a",!0),en("A",!1),xe("a",tn),xe("A",tn),xe("H",fe,ke),xe("h",fe,Oe),xe("k",fe,Oe),xe("HH",fe,ue),xe("hh",fe,ue),xe("kk",fe,ue),xe("hmm",de),xe("hmmss",pe),xe("Hmm",de),xe("Hmmss",pe),je(["H","HH"],Be),je(["k","kk"],(function(e,t,n){var r=Pe(e);t[Be]=24===r?0:r})),je(["a","A"],(function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e})),je(["h","hh"],(function(e,t,n){t[Be]=Pe(e),m(n).bigHour=!0})),je("hmm",(function(e,t,n){var r=e.length-2;t[Be]=Pe(e.substr(0,r)),t[We]=Pe(e.substr(r)),m(n).bigHour=!0})),je("hmmss",(function(e,t,n){var r=e.length-4,o=e.length-2;t[Be]=Pe(e.substr(0,r)),t[We]=Pe(e.substr(r,2)),t[Fe]=Pe(e.substr(o)),m(n).bigHour=!0})),je("Hmm",(function(e,t,n){var r=e.length-2;t[Be]=Pe(e.substr(0,r)),t[We]=Pe(e.substr(r))})),je("Hmmss",(function(e,t,n){var r=e.length-4,o=e.length-2;t[Be]=Pe(e.substr(0,r)),t[We]=Pe(e.substr(r,2)),t[Fe]=Pe(e.substr(o))}));var rn=/[ap]\.?m?\.?/i,on=Ke("Hours",!0);function sn(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"}var an,un={calendar:j,longDateFormat:V,invalidDate:$,ordinal:Z,dayOfMonthOrdinalParse:K,relativeTime:Q,months:rt,monthsShort:ot,week:kt,weekdays:jt,weekdaysMin:Ct,weekdaysShort:At,meridiemParse:rn},cn={},ln={};function hn(e,t){var n,r=Math.min(e.length,t.length);for(n=0;n0;){if(r=yn(o.slice(0,t).join("-")))return r;if(n&&n.length>=t&&hn(o,n)>=t-1)break;t--}i++}return an}function pn(e){return!(!e||!e.match("^[^/\\\\]*$"))}function yn(t){var n=null;if(void 0===cn[t]&&e&&e.exports&&pn(t))try{n=an._abbr,zt("./locale/"+t),mn(n)}catch(e){cn[t]=null}return cn[t]}function mn(e,t){var n;return e&&((n=c(t)?bn(e):gn(e,t))?an=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),an._abbr}function gn(e,t){if(null!==t){var n,r=un;if(t.abbr=e,null!=cn[e])N("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),r=cn[e]._config;else if(null!=t.parentLocale)if(null!=cn[t.parentLocale])r=cn[t.parentLocale]._config;else{if(null==(n=yn(t.parentLocale)))return ln[t.parentLocale]||(ln[t.parentLocale]=[]),ln[t.parentLocale].push({name:e,config:t}),null;r=n._config}return cn[e]=new Y(P(r,t)),ln[e]&&ln[e].forEach((function(e){gn(e.name,e.config)})),mn(e),cn[e]}return delete cn[e],null}function wn(e,t){if(null!=t){var n,r,o=un;null!=cn[e]&&null!=cn[e].parentLocale?cn[e].set(P(cn[e]._config,t)):(null!=(r=yn(e))&&(o=r._config),t=P(o,t),null==r&&(t.abbr=e),(n=new Y(t)).parentLocale=cn[e],cn[e]=n),mn(e)}else null!=cn[e]&&(null!=cn[e].parentLocale?(cn[e]=cn[e].parentLocale,e===mn()&&mn(e)):null!=cn[e]&&delete cn[e]);return cn[e]}function bn(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return an;if(!i(e)){if(t=yn(e))return t;e=[e]}return dn(e)}function vn(){return x(cn)}function _n(e){var t,n=e._a;return n&&-2===m(e).overflow&&(t=n[Le]<0||n[Le]>11?Le:n[Re]<1||n[Re]>nt(n[Ie],n[Le])?Re:n[Be]<0||n[Be]>24||24===n[Be]&&(0!==n[We]||0!==n[Fe]||0!==n[He])?Be:n[We]<0||n[We]>59?We:n[Fe]<0||n[Fe]>59?Fe:n[He]<0||n[He]>999?He:-1,m(e)._overflowDayOfYear&&(tRe)&&(t=Re),m(e)._overflowWeeks&&-1===t&&(t=ze),m(e)._overflowWeekday&&-1===t&&(t=Ve),m(e).overflow=t),e}var Mn=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Sn=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,On=/Z|[+-]\d\d(?::?\d\d)?/,kn=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],xn=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Dn=/^\/?Date\((-?\d+)/i,Nn=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Tn={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function En(e){var t,n,r,o,i,s,a=e._i,u=Mn.exec(a)||Sn.exec(a),c=kn.length,l=xn.length;if(u){for(m(e).iso=!0,t=0,n=c;tqe(i)||0===e._dayOfYear)&&(m(e)._overflowDayOfYear=!0),n=bt(i,0,e._dayOfYear),e._a[Le]=n.getUTCMonth(),e._a[Re]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=s[t]=r[t];for(;t<7;t++)e._a[t]=s[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[Be]&&0===e._a[We]&&0===e._a[Fe]&&0===e._a[He]&&(e._nextDay=!0,e._a[Be]=0),e._d=(e._useUTC?bt:wt).apply(null,s),o=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Be]=24),e._w&&void 0!==e._w.d&&e._w.d!==o&&(m(e).weekdayMismatch=!0)}}function Wn(e){var t,n,r,o,i,s,a,u,c;null!=(t=e._w).GG||null!=t.W||null!=t.E?(i=1,s=4,n=Ln(t.GG,e._a[Ie],Mt(Kn(),1,4).year),r=Ln(t.W,1),((o=Ln(t.E,1))<1||o>7)&&(u=!0)):(i=e._locale._week.dow,s=e._locale._week.doy,c=Mt(Kn(),i,s),n=Ln(t.gg,e._a[Ie],c.year),r=Ln(t.w,c.week),null!=t.d?((o=t.d)<0||o>6)&&(u=!0):null!=t.e?(o=t.e+i,(t.e<0||t.e>6)&&(u=!0)):o=i),r<1||r>St(n,i,s)?m(e)._overflowWeeks=!0:null!=u?m(e)._overflowWeekday=!0:(a=_t(n,r,o,i,s),e._a[Ie]=a.year,e._dayOfYear=a.dayOfYear)}function Fn(e){if(e._f!==r.ISO_8601)if(e._f!==r.RFC_2822){e._a=[],m(e).empty=!0;var t,n,o,i,s,a,u,c=""+e._i,l=c.length,h=0;for(u=(o=z(e._f,e._locale).match(U)||[]).length,t=0;t0&&m(e).unusedInput.push(s),c=c.slice(c.indexOf(n)+n.length),h+=n.length),R[i]?(n?m(e).empty=!1:m(e).unusedTokens.push(i),Ce(i,n,e)):e._strict&&!n&&m(e).unusedTokens.push(i);m(e).charsLeftOver=l-h,c.length>0&&m(e).unusedInput.push(c),e._a[Be]<=12&&!0===m(e).bigHour&&e._a[Be]>0&&(m(e).bigHour=void 0),m(e).parsedDateParts=e._a.slice(0),m(e).meridiem=e._meridiem,e._a[Be]=Hn(e._locale,e._a[Be],e._meridiem),null!==(a=m(e).era)&&(e._a[Ie]=e._locale.erasConvertYear(a,e._a[Ie])),Bn(e),_n(e)}else Un(e);else En(e)}function Hn(e,t,n){var r;return null==n?t:null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?((r=e.isPM(n))&&t<12&&(t+=12),r||12!==t||(t=0),t):t}function zn(e){var t,n,r,o,i,s,a=!1,u=e._f.length;if(0===u)return m(e).invalidFormat=!0,void(e._d=new Date(NaN));for(o=0;othis?this:e:w()}));function Xn(e,t){var n,r;if(1===t.length&&i(t[0])&&(t=t[0]),!t.length)return Kn();for(n=t[0],r=1;rthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Sr(){if(!c(this._isDSTShifted))return this._isDSTShifted;var e,t={};return _(t,this),(t=$n(t))._a?(e=t._isUTC?p(t._a):Kn(t._a),this._isDSTShifted=this.isValid()&&lr(t._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Or(){return!!this.isValid()&&!this._isUTC}function kr(){return!!this.isValid()&&this._isUTC}function xr(){return!!this.isValid()&&this._isUTC&&0===this._offset}r.updateOffset=function(){};var Dr=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Nr=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Tr(e,t){var n,r,o,i=e,s=null;return ur(e)?i={ms:e._milliseconds,d:e._days,M:e._months}:l(e)||!isNaN(+e)?(i={},t?i[t]=+e:i.milliseconds=+e):(s=Dr.exec(e))?(n="-"===s[1]?-1:1,i={y:0,d:Pe(s[Re])*n,h:Pe(s[Be])*n,m:Pe(s[We])*n,s:Pe(s[Fe])*n,ms:Pe(cr(1e3*s[He]))*n}):(s=Nr.exec(e))?(n="-"===s[1]?-1:1,i={y:Er(s[2],n),M:Er(s[3],n),w:Er(s[4],n),d:Er(s[5],n),h:Er(s[6],n),m:Er(s[7],n),s:Er(s[8],n)}):null==i?i={}:"object"==typeof i&&("from"in i||"to"in i)&&(o=Yr(Kn(i.from),Kn(i.to)),(i={}).ms=o.milliseconds,i.M=o.months),r=new ar(i),ur(e)&&a(e,"_locale")&&(r._locale=e._locale),ur(e)&&a(e,"_isValid")&&(r._isValid=e._isValid),r}function Er(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function Pr(e,t){var n={};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function Yr(e,t){var n;return e.isValid()&&t.isValid()?(t=pr(t,e),e.isBefore(t)?n=Pr(e,t):((n=Pr(t,e)).milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function jr(e,t){return function(n,r){var o;return null===r||isNaN(+r)||(N(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),o=n,n=r,r=o),Ar(this,Tr(n,r),e),this}}function Ar(e,t,n,o){var i=t._milliseconds,s=cr(t._days),a=cr(t._months);e.isValid()&&(o=null==o||o,a&&ft(e,Je(e,"Month")+a*n),s&&Qe(e,"Date",Je(e,"Date")+s*n),i&&e._d.setTime(e._d.valueOf()+i*n),o&&r.updateOffset(e,s||a))}Tr.fn=ar.prototype,Tr.invalid=sr;var Cr=jr(1,"add"),Ur=jr(-1,"subtract");function Ir(e){return"string"==typeof e||e instanceof String}function Lr(e){return S(e)||h(e)||Ir(e)||l(e)||Br(e)||Rr(e)||null==e}function Rr(e){var t,n,r=s(e)&&!u(e),o=!1,i=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],c=i.length;for(t=0;tn.valueOf():n.valueOf()9999?H(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):T(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",H(n,"Z")):H(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function to(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e,t,n,r,o="moment",i="";return this.isLocal()||(o=0===this.utcOffset()?"moment.utc":"moment.parseZone",i="Z"),e="["+o+'("]',t=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",n="-MM-DD[T]HH:mm:ss.SSS",r=i+'[")]',this.format(e+t+n+r)}function no(e){e||(e=this.isUtc()?r.defaultFormatUtc:r.defaultFormat);var t=H(this,e);return this.localeData().postformat(t)}function ro(e,t){return this.isValid()&&(S(e)&&e.isValid()||Kn(e).isValid())?Tr({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function oo(e){return this.from(Kn(),e)}function io(e,t){return this.isValid()&&(S(e)&&e.isValid()||Kn(e).isValid())?Tr({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function so(e){return this.to(Kn(),e)}function ao(e){var t;return void 0===e?this._locale._abbr:(null!=(t=bn(e))&&(this._locale=t),this)}r.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",r.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var uo=k("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",(function(e){return void 0===e?this.localeData():this.locale(e)}));function co(){return this._locale}var lo=1e3,ho=60*lo,fo=60*ho,po=3506328*fo;function yo(e,t){return(e%t+t)%t}function mo(e,t,n){return e<100&&e>=0?new Date(e+400,t,n)-po:new Date(e,t,n).valueOf()}function go(e,t,n){return e<100&&e>=0?Date.UTC(e+400,t,n)-po:Date.UTC(e,t,n)}function wo(e){var t,n;if(void 0===(e=ne(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?go:mo,e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=yo(t+(this._isUTC?0:this.utcOffset()*ho),fo);break;case"minute":t=this._d.valueOf(),t-=yo(t,ho);break;case"second":t=this._d.valueOf(),t-=yo(t,lo)}return this._d.setTime(t),r.updateOffset(this,!0),this}function bo(e){var t,n;if(void 0===(e=ne(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?go:mo,e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=fo-yo(t+(this._isUTC?0:this.utcOffset()*ho),fo)-1;break;case"minute":t=this._d.valueOf(),t+=ho-yo(t,ho)-1;break;case"second":t=this._d.valueOf(),t+=lo-yo(t,lo)-1}return this._d.setTime(t),r.updateOffset(this,!0),this}function vo(){return this._d.valueOf()-6e4*(this._offset||0)}function _o(){return Math.floor(this.valueOf()/1e3)}function Mo(){return new Date(this.valueOf())}function So(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function Oo(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function ko(){return this.isValid()?this.toISOString():null}function xo(){return g(this)}function Do(){return d({},m(this))}function No(){return m(this).overflow}function To(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Eo(e,t){var n,o,i,s=this._eras||bn("en")._eras;for(n=0,o=s.length;n=0)return u[r]}function Yo(e,t){var n=e.since<=e.until?1:-1;return void 0===t?r(e.since).year():r(e.since).year()+(t-e.offset)*n}function jo(){var e,t,n,r=this.localeData().eras();for(e=0,t=r.length;e(i=St(e,r,o))&&(t=i),Xo.call(this,e,t,n,r,o))}function Xo(e,t,n,r,o){var i=_t(e,t,n,r,o),s=bt(i.year,0,i.dayOfYear);return this.year(s.getUTCFullYear()),this.month(s.getUTCMonth()),this.date(s.getUTCDate()),this}function ei(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)}B("N",0,0,"eraAbbr"),B("NN",0,0,"eraAbbr"),B("NNN",0,0,"eraAbbr"),B("NNNN",0,0,"eraName"),B("NNNNN",0,0,"eraNarrow"),B("y",["y",1],"yo","eraYear"),B("y",["yy",2],0,"eraYear"),B("y",["yyy",3],0,"eraYear"),B("y",["yyyy",4],0,"eraYear"),xe("N",Bo),xe("NN",Bo),xe("NNN",Bo),xe("NNNN",Wo),xe("NNNNN",Fo),je(["N","NN","NNN","NNNN","NNNNN"],(function(e,t,n,r){var o=n._locale.erasParse(e,r,n._strict);o?m(n).era=o:m(n).invalidEra=e})),xe("y",we),xe("yy",we),xe("yyy",we),xe("yyyy",we),xe("yo",Ho),je(["y","yy","yyy","yyyy"],Ie),je(["yo"],(function(e,t,n,r){var o;n._locale._eraYearOrdinalRegex&&(o=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[Ie]=n._locale.eraYearOrdinalParse(e,o):t[Ie]=parseInt(e,10)})),B(0,["gg",2],0,(function(){return this.weekYear()%100})),B(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),Vo("gggg","weekYear"),Vo("ggggg","weekYear"),Vo("GGGG","isoWeekYear"),Vo("GGGGG","isoWeekYear"),xe("G",be),xe("g",be),xe("GG",fe,ue),xe("gg",fe,ue),xe("GGGG",me,le),xe("gggg",me,le),xe("GGGGG",ge,he),xe("ggggg",ge,he),Ae(["gggg","ggggg","GGGG","GGGGG"],(function(e,t,n,r){t[r.substr(0,2)]=Pe(e)})),Ae(["gg","GG"],(function(e,t,n,o){t[o]=r.parseTwoDigitYear(e)})),B("Q",0,"Qo","quarter"),xe("Q",ae),je("Q",(function(e,t){t[Le]=3*(Pe(e)-1)})),B("D",["DD",2],"Do","date"),xe("D",fe,Oe),xe("DD",fe,ue),xe("Do",(function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient})),je(["D","DD"],Re),je("Do",(function(e,t){t[Re]=Pe(e.match(fe)[0])}));var ti=Ke("Date",!0);function ni(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")}B("DDD",["DDDD",3],"DDDo","dayOfYear"),xe("DDD",ye),xe("DDDD",ce),je(["DDD","DDDD"],(function(e,t,n){n._dayOfYear=Pe(e)})),B("m",["mm",2],0,"minute"),xe("m",fe,ke),xe("mm",fe,ue),je(["m","mm"],We);var ri=Ke("Minutes",!1);B("s",["ss",2],0,"second"),xe("s",fe,ke),xe("ss",fe,ue),je(["s","ss"],Fe);var oi,ii,si=Ke("Seconds",!1);for(B("S",0,0,(function(){return~~(this.millisecond()/100)})),B(0,["SS",2],0,(function(){return~~(this.millisecond()/10)})),B(0,["SSS",3],0,"millisecond"),B(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),B(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),B(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),B(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),B(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),B(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),xe("S",ye,ae),xe("SS",ye,ue),xe("SSS",ye,ce),oi="SSSS";oi.length<=9;oi+="S")xe(oi,we);function ai(e,t){t[He]=Pe(1e3*("0."+e))}for(oi="S";oi.length<=9;oi+="S")je(oi,ai);function ui(){return this._isUTC?"UTC":""}function ci(){return this._isUTC?"Coordinated Universal Time":""}ii=Ke("Milliseconds",!1),B("z",0,0,"zoneAbbr"),B("zz",0,0,"zoneName");var li=M.prototype;function hi(e){return Kn(1e3*e)}function fi(){return Kn.apply(null,arguments).parseZone()}function di(e){return e}li.add=Cr,li.calendar=Hr,li.clone=zr,li.diff=Jr,li.endOf=bo,li.format=no,li.from=ro,li.fromNow=oo,li.to=io,li.toNow=so,li.get=Xe,li.invalidAt=No,li.isAfter=Vr,li.isBefore=qr,li.isBetween=$r,li.isSame=Gr,li.isSameOrAfter=Zr,li.isSameOrBefore=Kr,li.isValid=xo,li.lang=uo,li.locale=ao,li.localeData=co,li.max=Qn,li.min=Jn,li.parsingFlags=Do,li.set=et,li.startOf=wo,li.subtract=Ur,li.toArray=So,li.toObject=Oo,li.toDate=Mo,li.toISOString=eo,li.inspect=to,"undefined"!=typeof Symbol&&null!=Symbol.for&&(li[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),li.toJSON=ko,li.toString=Xr,li.unix=_o,li.valueOf=vo,li.creationData=To,li.eraName=jo,li.eraNarrow=Ao,li.eraAbbr=Co,li.eraYear=Uo,li.year=Ge,li.isLeapYear=Ze,li.weekYear=qo,li.isoWeekYear=$o,li.quarter=li.quarters=ei,li.month=dt,li.daysInMonth=pt,li.week=li.weeks=Nt,li.isoWeek=li.isoWeeks=Tt,li.weeksInYear=Ko,li.weeksInWeekYear=Jo,li.isoWeeksInYear=Go,li.isoWeeksInISOWeekYear=Zo,li.date=ti,li.day=li.days=Vt,li.weekday=qt,li.isoWeekday=$t,li.dayOfYear=ni,li.hour=li.hours=on,li.minute=li.minutes=ri,li.second=li.seconds=si,li.millisecond=li.milliseconds=ii,li.utcOffset=mr,li.utc=wr,li.local=br,li.parseZone=vr,li.hasAlignedHourOffset=_r,li.isDST=Mr,li.isLocal=Or,li.isUtcOffset=kr,li.isUtc=xr,li.isUTC=xr,li.zoneAbbr=ui,li.zoneName=ci,li.dates=k("dates accessor is deprecated. Use date instead.",ti),li.months=k("months accessor is deprecated. Use month instead",dt),li.years=k("years accessor is deprecated. Use year instead",Ge),li.zone=k("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",gr),li.isDSTShifted=k("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Sr);var pi=Y.prototype;function yi(e,t,n,r){var o=bn(),i=p().set(r,t);return o[n](i,e)}function mi(e,t,n){if(l(e)&&(t=e,e=void 0),e=e||"",null!=t)return yi(e,t,n,"month");var r,o=[];for(r=0;r<12;r++)o[r]=yi(e,r,n,"month");return o}function gi(e,t,n,r){"boolean"==typeof e?(l(t)&&(n=t,t=void 0),t=t||""):(n=t=e,e=!1,l(t)&&(n=t,t=void 0),t=t||"");var o,i=bn(),s=e?i._week.dow:0,a=[];if(null!=n)return yi(t,(n+s)%7,r,"day");for(o=0;o<7;o++)a[o]=yi(t,(o+s)%7,r,"day");return a}function wi(e,t){return mi(e,t,"months")}function bi(e,t){return mi(e,t,"monthsShort")}function vi(e,t,n){return gi(e,t,n,"weekdays")}function _i(e,t,n){return gi(e,t,n,"weekdaysShort")}function Mi(e,t,n){return gi(e,t,n,"weekdaysMin")}pi.calendar=A,pi.longDateFormat=q,pi.invalidDate=G,pi.ordinal=J,pi.preparse=di,pi.postformat=di,pi.relativeTime=X,pi.pastFuture=ee,pi.set=E,pi.eras=Eo,pi.erasParse=Po,pi.erasConvertYear=Yo,pi.erasAbbrRegex=Lo,pi.erasNameRegex=Io,pi.erasNarrowRegex=Ro,pi.months=ut,pi.monthsShort=ct,pi.monthsParse=ht,pi.monthsRegex=mt,pi.monthsShortRegex=yt,pi.week=Ot,pi.firstDayOfYear=Dt,pi.firstDayOfWeek=xt,pi.weekdays=Rt,pi.weekdaysMin=Wt,pi.weekdaysShort=Bt,pi.weekdaysParse=Ht,pi.weekdaysRegex=Gt,pi.weekdaysShortRegex=Zt,pi.weekdaysMinRegex=Kt,pi.isPM=nn,pi.meridiem=sn,mn("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===Pe(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),r.lang=k("moment.lang is deprecated. Use moment.locale instead.",mn),r.langData=k("moment.langData is deprecated. Use moment.localeData instead.",bn);var Si=Math.abs;function Oi(){var e=this._data;return this._milliseconds=Si(this._milliseconds),this._days=Si(this._days),this._months=Si(this._months),e.milliseconds=Si(e.milliseconds),e.seconds=Si(e.seconds),e.minutes=Si(e.minutes),e.hours=Si(e.hours),e.months=Si(e.months),e.years=Si(e.years),this}function ki(e,t,n,r){var o=Tr(t,n);return e._milliseconds+=r*o._milliseconds,e._days+=r*o._days,e._months+=r*o._months,e._bubble()}function xi(e,t){return ki(this,e,t,1)}function Di(e,t){return ki(this,e,t,-1)}function Ni(e){return e<0?Math.floor(e):Math.ceil(e)}function Ti(){var e,t,n,r,o,i=this._milliseconds,s=this._days,a=this._months,u=this._data;return i>=0&&s>=0&&a>=0||i<=0&&s<=0&&a<=0||(i+=864e5*Ni(Pi(a)+s),s=0,a=0),u.milliseconds=i%1e3,e=Ee(i/1e3),u.seconds=e%60,t=Ee(e/60),u.minutes=t%60,n=Ee(t/60),u.hours=n%24,s+=Ee(n/24),a+=o=Ee(Ei(s)),s-=Ni(Pi(o)),r=Ee(a/12),a%=12,u.days=s,u.months=a,u.years=r,this}function Ei(e){return 4800*e/146097}function Pi(e){return 146097*e/4800}function Yi(e){if(!this.isValid())return NaN;var t,n,r=this._milliseconds;if("month"===(e=ne(e))||"quarter"===e||"year"===e)switch(t=this._days+r/864e5,n=this._months+Ei(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(Pi(this._months)),e){case"week":return t/7+r/6048e5;case"day":return t+r/864e5;case"hour":return 24*t+r/36e5;case"minute":return 1440*t+r/6e4;case"second":return 86400*t+r/1e3;case"millisecond":return Math.floor(864e5*t)+r;default:throw new Error("Unknown unit "+e)}}function ji(e){return function(){return this.as(e)}}var Ai=ji("ms"),Ci=ji("s"),Ui=ji("m"),Ii=ji("h"),Li=ji("d"),Ri=ji("w"),Bi=ji("M"),Wi=ji("Q"),Fi=ji("y"),Hi=Ai;function zi(){return Tr(this)}function Vi(e){return e=ne(e),this.isValid()?this[e+"s"]():NaN}function qi(e){return function(){return this.isValid()?this._data[e]:NaN}}var $i=qi("milliseconds"),Gi=qi("seconds"),Zi=qi("minutes"),Ki=qi("hours"),Ji=qi("days"),Qi=qi("months"),Xi=qi("years");function es(){return Ee(this.days()/7)}var ts=Math.round,ns={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function rs(e,t,n,r,o){return o.relativeTime(t||1,!!n,e,r)}function os(e,t,n,r){var o=Tr(e).abs(),i=ts(o.as("s")),s=ts(o.as("m")),a=ts(o.as("h")),u=ts(o.as("d")),c=ts(o.as("M")),l=ts(o.as("w")),h=ts(o.as("y")),f=i<=n.ss&&["s",i]||i0,f[4]=r,rs.apply(null,f)}function is(e){return void 0===e?ts:"function"==typeof e&&(ts=e,!0)}function ss(e,t){return void 0!==ns[e]&&(void 0===t?ns[e]:(ns[e]=t,"s"===e&&(ns.ss=t-1),!0))}function as(e,t){if(!this.isValid())return this.localeData().invalidDate();var n,r,o=!1,i=ns;return"object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(o=e),"object"==typeof t&&(i=Object.assign({},ns,t),null!=t.s&&null==t.ss&&(i.ss=t.s-1)),r=os(this,!o,i,n=this.localeData()),o&&(r=n.pastFuture(+this,r)),n.postformat(r)}var us=Math.abs;function cs(e){return(e>0)-(e<0)||+e}function ls(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n,r,o,i,s,a,u=us(this._milliseconds)/1e3,c=us(this._days),l=us(this._months),h=this.asSeconds();return h?(e=Ee(u/60),t=Ee(e/60),u%=60,e%=60,n=Ee(l/12),l%=12,r=u?u.toFixed(3).replace(/\.?0+$/,""):"",o=h<0?"-":"",i=cs(this._months)!==cs(h)?"-":"",s=cs(this._days)!==cs(h)?"-":"",a=cs(this._milliseconds)!==cs(h)?"-":"",o+"P"+(n?i+n+"Y":"")+(l?i+l+"M":"")+(c?s+c+"D":"")+(t||e||u?"T":"")+(t?a+t+"H":"")+(e?a+e+"M":"")+(u?a+r+"S":"")):"P0D"}var hs=ar.prototype;return hs.isValid=ir,hs.abs=Oi,hs.add=xi,hs.subtract=Di,hs.as=Yi,hs.asMilliseconds=Ai,hs.asSeconds=Ci,hs.asMinutes=Ui,hs.asHours=Ii,hs.asDays=Li,hs.asWeeks=Ri,hs.asMonths=Bi,hs.asQuarters=Wi,hs.asYears=Fi,hs.valueOf=Hi,hs._bubble=Ti,hs.clone=zi,hs.get=Vi,hs.milliseconds=$i,hs.seconds=Gi,hs.minutes=Zi,hs.hours=Ki,hs.days=Ji,hs.weeks=es,hs.months=Qi,hs.years=Xi,hs.humanize=as,hs.toISOString=ls,hs.toString=ls,hs.toJSON=ls,hs.locale=ao,hs.localeData=co,hs.toIsoString=k("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",ls),hs.lang=uo,B("X",0,0,"unix"),B("x",0,0,"valueOf"),xe("x",be),xe("X",Me),je("X",(function(e,t,n){n._d=new Date(1e3*parseFloat(e))})),je("x",(function(e,t,n){n._d=new Date(Pe(e))})), +//! moment.js +r.version="2.30.1",o(Kn),r.fn=li,r.min=er,r.max=tr,r.now=nr,r.utc=p,r.unix=hi,r.months=wi,r.isDate=h,r.locale=mn,r.invalid=w,r.duration=Tr,r.isMoment=S,r.weekdays=vi,r.parseZone=fi,r.localeData=bn,r.isDuration=ur,r.monthsShort=bi,r.weekdaysMin=Mi,r.defineLocale=gn,r.updateLocale=wn,r.locales=vn,r.weekdaysShort=_i,r.normalizeUnits=ne,r.relativeTimeRounding=is,r.relativeTimeThreshold=ss,r.calendarFormat=Fr,r.prototype=li,r.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},r}()}({get exports(){return Vt},set exports(e){Vt=e}});var qt=Vt,$t={};function Gt(e){return Buffer.from(e,"base64").toString("binary")}({get exports(){return $t},set exports(e){$t=e}}).exports=function(e){return(e instanceof Buffer?e:Buffer.from(e.toString(),"binary")).toString("base64")};var Zt=Gt.atob=Gt;globalThis.expect=Yt,globalThis.assert=jt,globalThis.moment=qt,globalThis.btoa=$t,globalThis.atob=Zt,globalThis.Buffer=At.Buffer,globalThis.requireObject={chai:{expect:Yt,assert:jt},moment:qt,buffer:{Buffer:At.Buffer},btoa:$t,atob:Zt}}(); + + }() + } + module.exports = getBundledCode; + \ No newline at end of file diff --git a/packages/bruno-js/src/runtime/assert-runtime.js b/packages/bruno-js/src/runtime/assert-runtime.js index bd902d34c..5b904dee4 100644 --- a/packages/bruno-js/src/runtime/assert-runtime.js +++ b/packages/bruno-js/src/runtime/assert-runtime.js @@ -5,7 +5,7 @@ const Bru = require('../bru'); const BrunoRequest = require('../bruno-request'); const { evaluateJsTemplateLiteral, evaluateJsExpression, createResponseParser } = require('../utils'); const { interpolateString } = require('../interpolate-string'); -const { executeInIsolatedVMStrict } = require('../sandbox/isolatedvm'); +const { executeQuickJsVm } = require('../sandbox/quickjs'); const { expect } = chai; chai.use(require('chai-string')); @@ -163,8 +163,8 @@ const isUnaryOperator = (operator) => { }; const evaluateJsTemplateLiteralBasedOnRuntime = (literal, context, runtime) => { - if(runtime === 'isolated-vm') { - return executeInIsolatedVMStrict({ + if (runtime === 'quickjs') { + return executeQuickJsVm({ script: literal, context, scriptType: 'template-literal' @@ -175,8 +175,8 @@ const evaluateJsTemplateLiteralBasedOnRuntime = (literal, context, runtime) => { }; const evaluateJsExpressionBasedOnRuntime = (expr, context, runtime) => { - if(runtime === 'isolated-vm') { - return executeInIsolatedVMStrict({ + if (runtime === 'quickjs') { + return executeQuickJsVm({ script: expr, context, scriptType: 'expression' @@ -184,7 +184,7 @@ const evaluateJsExpressionBasedOnRuntime = (expr, context, runtime) => { } return evaluateJsExpression(expr, context); -} +}; const evaluateRhsOperand = (rhsOperand, operator, context, runtime) => { if (isUnaryOperator(operator)) { @@ -207,11 +207,7 @@ const evaluateRhsOperand = (rhsOperand, operator, context, runtime) => { return rhsOperand .split(',') .map((v) => - evaluateJsTemplateLiteralBasedOnRuntime( - interpolateString(v.trim(), interpolationContext), - context, - runtime - ) + evaluateJsTemplateLiteralBasedOnRuntime(interpolateString(v.trim(), interpolationContext), context, runtime) ); } @@ -219,11 +215,7 @@ const evaluateRhsOperand = (rhsOperand, operator, context, runtime) => { const [lhs, rhs] = rhsOperand .split(',') .map((v) => - evaluateJsTemplateLiteralBasedOnRuntime( - interpolateString(v.trim(), interpolationContext), - context, - runtime - ) + evaluateJsTemplateLiteralBasedOnRuntime(interpolateString(v.trim(), interpolationContext), context, runtime) ); return [lhs, rhs]; } @@ -237,11 +229,7 @@ const evaluateRhsOperand = (rhsOperand, operator, context, runtime) => { return interpolateString(rhsOperand, interpolationContext); } - return evaluateJsTemplateLiteralBasedOnRuntime( - interpolateString(rhsOperand, interpolationContext), - context, - runtime - ); + return evaluateJsTemplateLiteralBasedOnRuntime(interpolateString(rhsOperand, interpolationContext), context, runtime); }; class AssertRuntime { diff --git a/packages/bruno-js/src/runtime/script-runtime.js b/packages/bruno-js/src/runtime/script-runtime.js index 4f370e408..2584cecf1 100644 --- a/packages/bruno-js/src/runtime/script-runtime.js +++ b/packages/bruno-js/src/runtime/script-runtime.js @@ -28,7 +28,7 @@ const fetch = require('node-fetch'); const chai = require('chai'); const CryptoJS = require('crypto-js'); const NodeVault = require('node-vault'); -const { executeInIsolatedVMAsync } = require('../sandbox/isolatedvm'); +const { executeQuickJsVmAsync } = require('../sandbox/quickjs'); class ScriptRuntime { constructor(props) { @@ -89,22 +89,22 @@ class ScriptRuntime { }; } - if (this.runtime === 'isolated-vm') { - await executeInIsolatedVMAsync({ + if (this.runtime === 'quickjs') { + await executeQuickJsVmAsync({ script: script, context: context, modules: {}, scriptType: 'jsScript' }); - - return { - request, - envVariables: cleanJson(envVariables), - runtimeVariables: cleanJson(runtimeVariables), - nextRequestName: bru.nextRequest - }; } + return { + request, + envVariables: cleanJson(envVariables), + runtimeVariables: cleanJson(runtimeVariables), + nextRequestName: bru.nextRequest + }; + // default runtime is vm2 const vm = new NodeVM({ sandbox: context, @@ -202,8 +202,8 @@ class ScriptRuntime { }; } - if (this.runtime === 'isolated-vm') { - await executeInIsolatedVMAsync({ + if (this.runtime === 'quickjs') { + await executeQuickJsVmAsync({ script: script, context: context, modules: {}, diff --git a/packages/bruno-js/src/runtime/test-runtime.js b/packages/bruno-js/src/runtime/test-runtime.js index 01b85a972..a7aa6d2c5 100644 --- a/packages/bruno-js/src/runtime/test-runtime.js +++ b/packages/bruno-js/src/runtime/test-runtime.js @@ -30,7 +30,6 @@ const axios = require('axios'); const fetch = require('node-fetch'); const CryptoJS = require('crypto-js'); const NodeVault = require('node-vault'); -const { executeInIsolatedVMAsync } = require('../sandbox/isolatedvm'); const { executeQuickJsVmAsync } = require('../sandbox/quickjs'); class TestRuntime { @@ -109,18 +108,13 @@ class TestRuntime { }; } - if (this.runtime === 'isolated-vm') { - await executeInIsolatedVMAsync({ + if (this.runtime === 'quickjs') { + await executeQuickJsVmAsync({ script: testsFile, context: context, modules: {}, scriptType: 'jsScript' }); - } else if(this.runtime === 'quickjs') { - await executeQuickJsVmAsync({ - script: testsFile, - context: context - }); } else { // default runtime is vm2 const vm = new NodeVM({ diff --git a/packages/bruno-js/src/runtime/vars-runtime.js b/packages/bruno-js/src/runtime/vars-runtime.js index 6b1865620..4f4bd3719 100644 --- a/packages/bruno-js/src/runtime/vars-runtime.js +++ b/packages/bruno-js/src/runtime/vars-runtime.js @@ -3,11 +3,11 @@ const Bru = require('../bru'); const BrunoRequest = require('../bruno-request'); const { evaluateJsTemplateLiteral, evaluateJsExpression, createResponseParser } = require('../utils'); -const { executeInIsolatedVMStrict } = require('../sandbox/isolatedvm'); +const { executeQuickJsVm } = require('../sandbox/quickjs'); const evaluateJsTemplateLiteralBasedOnRuntime = (literal, context, runtime) => { - if(runtime === 'isolated-vm') { - return executeInIsolatedVMStrict({ + if (runtime === 'quickjs') { + return executeQuickJsVm({ script: literal, context, scriptType: 'template-literal' @@ -18,8 +18,8 @@ const evaluateJsTemplateLiteralBasedOnRuntime = (literal, context, runtime) => { }; const evaluateJsExpressionBasedOnRuntime = (expr, context, runtime, mode) => { - if(runtime === 'isolated-vm') { - return executeInIsolatedVMStrict({ + if (runtime === 'quickjs') { + return executeQuickJsVm({ script: expr, context, scriptType: 'expression' diff --git a/packages/bruno-js/src/sandbox/isolatedvm/shims/test.js b/packages/bruno-js/src/sandbox/isolatedvm/shims/test.js index 126f9b346..20547a7b5 100644 --- a/packages/bruno-js/src/sandbox/isolatedvm/shims/test.js +++ b/packages/bruno-js/src/sandbox/isolatedvm/shims/test.js @@ -8,16 +8,15 @@ const addTestShimToContext = async (context, __brunoTestResults) => { }); context.evalSync(` - global.expect = require('chai').expect; - global.assert = require('chai').assert; + globalThis.expect = require('chai').expect; + globalThis.assert = require('chai').assert; - global.__brunoTestResults = { - addResult: global.addResult, - getResults: global.getResults, + globalThis.__brunoTestResults = { + addResult: globalThis.__bruno__addResult, + getResults: globalThis.__bruno__getResults, } - - global.DummyChaiAssertionError = class DummyChaiAssertionError extends Error { + globalThis.DummyChaiAssertionError = class DummyChaiAssertionError extends Error { constructor(message, props, ssf) { super(message); this.name = "AssertionError"; @@ -25,7 +24,7 @@ const addTestShimToContext = async (context, __brunoTestResults) => { } } - global.Test = (__brunoTestResults) => async (description, callback) => { + globalThis.Test = (__brunoTestResults) => async (description, callback) => { try { await callback(); __brunoTestResults.addResult({ description, status: "pass" }); @@ -40,17 +39,17 @@ const addTestShimToContext = async (context, __brunoTestResults) => { expected, }); } else { - __brunoTestResults.addResult({ + globalThis.__bruno__addResult({ description, status: "fail", error: error.message || "An unexpected error occurred.", }); } - console.log(error); + // console.log(error); } }; - - global.test = Test(__brunoTestResults); + + globalThis.test = Test(__brunoTestResults); `); }; diff --git a/packages/bruno-js/src/sandbox/quickjs/index.js b/packages/bruno-js/src/sandbox/quickjs/index.js index dea71d525..5f09ffe99 100644 --- a/packages/bruno-js/src/sandbox/quickjs/index.js +++ b/packages/bruno-js/src/sandbox/quickjs/index.js @@ -1,79 +1,89 @@ -const ivm = require('isolated-vm'); const addBruShimToContext = require('./shims/bru'); const addBrunoRequestShimToContext = require('./shims/bruno-request'); +const addConsoleShimToContext = require('./shims/console'); const addBrunoResponseShimToContext = require('./shims/bruno-response'); const addTestShimToContext = require('./shims/test'); -const { newQuickJSAsyncWASMModule } = require('quickjs-emscripten'); +const addLibraryShimsToContext = require('./shims/lib'); +const { newQuickJSWASMModule, memoizePromiseFactory } = require('quickjs-emscripten'); // execute `npm run build:isolated-vm:inbuilt-modules` if the below file doesn't exist -const getBundledCode = require('../bundle-browser-rollup'); +const getBundledCode = require('../../bundle-browser-rollup'); + +let QuickJSSyncContext; +const loader = memoizePromiseFactory(() => newQuickJSWASMModule()); +const getContext = (opts) => loader().then((mod) => (QuickJSSyncContext = mod.newContext(opts))); +getContext(); const toNumber = (value) => { const num = Number(value); return Number.isInteger(num) ? parseInt(value, 10) : parseFloat(value); }; -const executeQuickJsVm = ({ script: externalScript, context: externalContext }) => { +const executeQuickJsVm = ({ script: externalScript, context: externalContext, scriptType = 'script' }) => { if (!isNaN(Number(externalScript))) { return Number(externalScript); } - let result; - const isolate = new ivm.Isolate(); - try { - const context = isolate.createContextSync(); - context.global.setSync('global', context.global.derefInto()); + const vm = QuickJSSyncContext; + + try { const { bru, req, res } = externalContext; - context.evalSync(` - let bru = {}; - let req = {}; - let res = {}; - `); + bru && addBruShimToContext(vm, bru); + req && addBrunoRequestShimToContext(vm, req); + res && addBrunoResponseShimToContext(vm, res); - bru && addBruShimToContext(context, bru); - req && addBrunoRequestShimToContext(context, req); - res && addBrunoResponseShimToContext(context, res); + //////////////////////////////////////////////////////////////////////////////// - context.global.setSync('setResult', function (arg) { - result = arg; + const logHandle = vm.newFunction('log', (...args) => { + const nativeArgs = args.map(vm.dump); + console.log(...nativeArgs); }); + vm.setProp(vm.global, 'log', logHandle); + logHandle.dispose(); - const templateLiteralText = ` - let value = \`${externalScript}\`; - setResult(value); - `; + //////////////////////////////////////////////////////////////////////////////// - const jsExpressionText = ` - let value = ${externalScript}; - setResult(value); - `; + const templateLiteralText = `\`${externalScript}\`;`; + + const jsExpressionText = `${externalScript};`; let scriptText = scriptType === 'template-literal' ? templateLiteralText : jsExpressionText; - const script = isolate.compileScriptSync(scriptText); - script.runSync(context); - return result; + const result = vm.evalCode(scriptText); + if (result.error) { + let e = vm.dump(result.error); + result.error.dispose(); + return e; + } else { + let v = vm.dump(result.value); + let vString = v.toString(); + result.value.dispose(); + return v; + } } catch (error) { console.error('Error executing the script!', error); } - isolate.dispose(); + // }); }; const executeQuickJsVmAsync = async ({ script: externalScript, - context: externalContext + context: externalContext, + modules = {}, + scriptType = 'script' }) => { if (!isNaN(Number(externalScript))) { return toNumber(externalScript); } try { - const module = await newQuickJSAsyncWASMModule() - const runtime = module.newRuntime() - const vm = runtime.newContext() - + const module = await newQuickJSWASMModule(); + const vm = module.newContext(); + const bundledCode = getBundledCode?.toString() || ''; - let bundledScript = `(${bundledCode})()`; + let bundledScript = ` + (${bundledCode})() + `; bundledScript += ` globalThis.require = (module) => { @@ -81,117 +91,104 @@ const executeQuickJsVmAsync = async ({ } `; - bundledScript += ` - let bru = { - cwd: __bruno__cwd, - getEnvName: __bruno__getEnvName, - getProcessEnv: __bruno__getProcessEnv, - getEnvVar: __bruno__getEnvVar, - setEnvVar: __bruno__setEnvVar, - getVar: __bruno__getVar, - setVar: __bruno__setVar, - setNextRequest: __bruno__setNextRequest, - visualize: __bruno__visualize, - getSecretVar: __bruno__getSecretVar - }; - let req = { - url: __bruno__req__url, - method: __bruno__req__method, - headers: __bruno__req__headers, - body: __bruno__req__body, - timeout: __bruno__req__timeout, - getUrl: __bruno__req__getUrl, - setUrl: __bruno__req__setUrl, - getMethod: __bruno__req__getMethod, - setMethod: __bruno__req__setMethod, - getAuthMode: __bruno__req__getAuthMode, - getHeaders: __bruno__req__getHeaders, - setHeaders: __bruno__req__setHeaders, - getHeader: __bruno__req__getHeader, - setHeader: __bruno__req__setHeader, - getBody: __bruno__req__getBody, - setBody: __bruno__req__setBody, - setMaxRedirects: __bruno__req__setMaxRedirects, - getTimeout: __bruno__req__getTimeout, - setTimeout: __bruno__req__setTimeout - }; - let res = { - status: globalThis.__bruno__res__status, - headers: globalThis.__bruno__res__headers, - body: globalThis.__bruno__res__body, - responseTime: globalThis.__bruno__res__responseTime, - getStatus: globalThis.__bruno__res__getStatus, - getHeader: globalThis.__bruno__res__getHeader, - getHeaders: globalThis.__bruno__res__getHeaders, - getBody: globalThis.__bruno__res__getBody, - getResponseTime: globalThis.__bruno__res__getResponseTime - }; - `; - const { bru, req, res, test, __brunoTestResults, console: consoleFn } = externalContext; bru && addBruShimToContext(vm, bru); req && addBrunoRequestShimToContext(vm, req); res && addBrunoResponseShimToContext(vm, res); + consoleFn && addConsoleShimToContext(vm, consoleFn); + + // await addLibraryShimsToContext(context); test && __brunoTestResults && addTestShimToContext(vm, __brunoTestResults); bundledScript += ` - globalThis.expect = require('chai').expect; - globalThis.assert = require('chai').assert; + globalThis.expect = require('chai').expect; + globalThis.assert = require('chai').assert; - globalThis.__brunoTestResults = { - addResult: globalThis.__bruno__addResult, - getResults: globalThis.__bruno__getResults, + globalThis.__brunoTestResults = { + addResult: globalThis.__bruno__addResult, + getResults: globalThis.__bruno__getResults, + } + + globalThis.DummyChaiAssertionError = class DummyChaiAssertionError extends Error { + constructor(message, props, ssf) { + super(message); + this.name = "AssertionError"; + Object.assign(this, props); } + } - globalThis.DummyChaiAssertionError = class DummyChaiAssertionError extends Error { - constructor(message, props, ssf) { - super(message); - this.name = "AssertionError"; - Object.assign(this, props); + globalThis.Test = (__brunoTestResults) => async (description, callback) => { + try { + await callback(); + __brunoTestResults.addResult({ description, status: "pass" }); + } catch (error) { + if (error instanceof DummyChaiAssertionError) { + const { message, actual, expected } = error; + __brunoTestResults.addResult({ + description, + status: "fail", + error: message, + actual, + expected, + }); + } else { + globalThis.__bruno__addResult({ + description, + status: "fail", + error: error.message || "An unexpected error occurred.", + }); } } + }; - globalThis.Test = (__brunoTestResults) => (description, callback) => { + globalThis.test = Test(__brunoTestResults); + `; + + //////////////////////////////////////////////////////////////////////////////// + + const sleep = vm.newFunction('sleep', (timer) => { + const t = vm.getString(timer); + const promise = vm.newPromise(); + setTimeout(() => { + promise.resolve(vm.newString('slept')); + }, t); + promise.settled.then(vm.runtime.executePendingJobs); + return promise.handle; + }); + sleep.consume((handle) => vm.setProp(vm.global, 'sleep', handle)); + + //////////////////////////////////////////////////////////////////////////////// + + const script = ` + ${bundledScript} + (async () => { + const setTimeout = async(fn, timer) => { + v = await sleep(timer); + fn.apply(); + } + await sleep(0); + console?.debug && console.debug('quick-js:execution-start:'); try { - callback(); - __brunoTestResults.addResult({ description, status: "pass" }); - } catch (error) { - if (error instanceof DummyChaiAssertionError) { - const { message, actual, expected } = error; - __brunoTestResults.addResult({ - description, - status: "fail", - error: message, - actual, - expected, - }); - } else { - __brunoTestResults.addResult({ - description, - status: "fail", - error: error.message || "An unexpected error occurred.", - }); - } - // console.log(error); + ${externalScript} } - }; - - globalThis.test = Test(__brunoTestResults); + catch(error) { + console?.debug && console.debug('quick-js:execution-end:with-error', error?.message); + } + console?.debug && console.debug('quick-js:execution-end:'); + return 'done'; + })() `; - bundledScript += externalScript; - - const result = await vm.evalCodeAsync(bundledScript); - if (result.error) { - console.log("Execution failed:", vm.dump(result.error)) - result.error.dispose() - } else { - result.value.dispose(); - } - vm.dispose(); - return result; + const result = vm.evalCode(script); + const promiseHandle = vm.unwrapResult(result); + const resolvedResult = await vm.resolvePromise(promiseHandle); + promiseHandle.dispose(); + const resolvedHandle = vm.unwrapResult(resolvedResult); + resolvedHandle.dispose(); + // vm.dispose(); + return 'foo'; } catch (error) { console.error('Error executing the script!', error); } diff --git a/packages/bruno-js/src/sandbox/quickjs/shims/bru.js b/packages/bruno-js/src/sandbox/quickjs/shims/bru.js index dd29c8435..5add1032e 100644 --- a/packages/bruno-js/src/sandbox/quickjs/shims/bru.js +++ b/packages/bruno-js/src/sandbox/quickjs/shims/bru.js @@ -1,65 +1,70 @@ const { marshallToVm } = require('../utils'); const addBruShimToContext = (vm, bru) => { + const bruObject = vm.newObject(); + let cwd = vm.newFunction('cwd', function () { return marshallToVm(bru.cwd(), vm); }); - vm.setProp(vm.global, "__bruno__cwd", cwd) + vm.setProp(bruObject, 'cwd', cwd); cwd.dispose(); let getEnvName = vm.newFunction('getEnvName', function () { return marshallToVm(bru.getEnvName(), vm); }); - vm.setProp(vm.global, "__bruno__getEnvName", getEnvName); + vm.setProp(bruObject, 'getEnvName', getEnvName); getEnvName.dispose(); let getProcessEnv = vm.newFunction('getProcessEnv', function (key) { return marshallToVm(bru.getProcessEnv(vm.dump(key)), vm); }); - vm.setProp(vm.global, "__bruno__getProcessEnv", getProcessEnv); + vm.setProp(bruObject, 'getProcessEnv', getProcessEnv); getProcessEnv.dispose(); let getEnvVar = vm.newFunction('getEnvVar', function (key) { return marshallToVm(bru.getEnvVar(vm.dump(key)), vm); }); - vm.setProp(vm.global, "__bruno__getEnvVar", getEnvVar); + vm.setProp(bruObject, 'getEnvVar', getEnvVar); getEnvVar.dispose(); let setEnvVar = vm.newFunction('setEnvVar', function (key, value) { bru.setEnvVar(vm.dump(key), vm.dump(value)); }); - vm.setProp(vm.global, "__bruno__setEnvVar", setEnvVar); + vm.setProp(bruObject, 'setEnvVar', setEnvVar); setEnvVar.dispose(); let getVar = vm.newFunction('getVar', function (key) { return marshallToVm(bru.getVar(vm.dump(key)), vm); }); - vm.setProp(vm.global, "__bruno__getVar", getVar); + vm.setProp(bruObject, 'getVar', getVar); getVar.dispose(); let setVar = vm.newFunction('setVar', function (key, value) { bru.setVar(vm.dump(key), vm.dump(value)); }); - vm.setProp(vm.global, "__bruno__setVar", setVar); + vm.setProp(bruObject, 'setVar', setVar); setVar.dispose(); let setNextRequest = vm.newFunction('setNextRequest', function (nextRequest) { bru.setNextRequest(vm.dump(nextRequest)); }); - vm.setProp(vm.global, "__bruno__setNextRequest", setNextRequest); + vm.setProp(bruObject, 'setNextRequest', setNextRequest); setNextRequest.dispose(); let visualize = vm.newFunction('visualize', function (htmlString) { bru.visualize(vm.dump(htmlString)); }); - vm.setProp(vm.global, "__bruno__visualize", visualize); + vm.setProp(bruObject, 'visualize', visualize); visualize.dispose(); let getSecretVar = vm.newFunction('getSecretVar', function (key) { return marshallToVm(bru.getSecretVar(vm.dump(key)), vm); }); - vm.setProp(vm.global, "__bruno__getSecretVar", getSecretVar); + vm.setProp(bruObject, 'getSecretVar', getSecretVar); getSecretVar.dispose(); + + vm.setProp(vm.global, 'bru', bruObject); + bruObject.dispose(); }; module.exports = addBruShimToContext; diff --git a/packages/bruno-js/src/sandbox/quickjs/shims/bruno-request.js b/packages/bruno-js/src/sandbox/quickjs/shims/bruno-request.js index 509097a25..9be27fae7 100644 --- a/packages/bruno-js/src/sandbox/quickjs/shims/bruno-request.js +++ b/packages/bruno-js/src/sandbox/quickjs/shims/bruno-request.js @@ -1,17 +1,19 @@ const { marshallToVm } = require('../utils'); const addBrunoRequestShimToContext = (vm, req) => { + const reqObject = vm.newObject(); + const url = marshallToVm(req.getUrl(), vm); const method = marshallToVm(req.getMethod(), vm); const headers = marshallToVm(req.getHeaders(), vm); const body = marshallToVm(req.getBody(), vm); const timeout = marshallToVm(req.getTimeout(), vm); - vm.setProp(vm.global, '__bruno__req__url', url); - vm.setProp(vm.global, '__bruno__req__method', method); - vm.setProp(vm.global, '__bruno__req__headers', headers); - vm.setProp(vm.global, '__bruno__req__body', body); - vm.setProp(vm.global, '__bruno__req__timeout', timeout); + vm.setProp(reqObject, 'url', url); + vm.setProp(reqObject, 'method', method); + vm.setProp(reqObject, 'headers', headers); + vm.setProp(reqObject, 'body', body); + vm.setProp(reqObject, 'timeout', timeout); url.dispose(); method.dispose(); @@ -22,86 +24,89 @@ const addBrunoRequestShimToContext = (vm, req) => { let getUrl = vm.newFunction('getUrl', function () { return marshallToVm(req.getUrl(), vm); }); - vm.setProp(vm.global, '__bruno__req__getUrl', getUrl); + vm.setProp(reqObject, 'getUrl', getUrl); getUrl.dispose(); let setUrl = vm.newFunction('setUrl', function (url) { req.setUrl(vm.dump(url)); }); - vm.setProp(vm.global, '__bruno__req__setUrl', setUrl); + vm.setProp(reqObject, 'setUrl', setUrl); setUrl.dispose(); let getMethod = vm.newFunction('getMethod', function () { return marshallToVm(req.getMethod(), vm); }); - vm.setProp(vm.global, '__bruno__req__getMethod', getMethod); + vm.setProp(reqObject, 'getMethod', getMethod); getMethod.dispose(); let getAuthMode = vm.newFunction('getAuthMode', function () { return marshallToVm(req.getAuthMode(), vm); }); - vm.setProp(vm.global, '__bruno__req__getAuthMode', getAuthMode); + vm.setProp(reqObject, 'getAuthMode', getAuthMode); getAuthMode.dispose(); let setMethod = vm.newFunction('setMethod', function (method) { req.setMethod(vm.dump(method)); }); - vm.setProp(vm.global, '__bruno__req__setMethod', setMethod); + vm.setProp(reqObject, 'setMethod', setMethod); setMethod.dispose(); let getHeaders = vm.newFunction('getHeaders', function () { return marshallToVm(req.getHeaders(), vm); }); - vm.setProp(vm.global, '__bruno__req__getHeaders', getHeaders); + vm.setProp(reqObject, 'getHeaders', getHeaders); getHeaders.dispose(); let setHeaders = vm.newFunction('setHeaders', function (headers) { req.setHeaders(vm.dump(headers)); }); - vm.setProp(vm.global, '__bruno__req__setHeaders', setHeaders); + vm.setProp(reqObject, 'setHeaders', setHeaders); setHeaders.dispose(); let getHeader = vm.newFunction('getHeader', function (name) { return marshallToVm(req.getHeader(vm.dump(name)), vm); }); - vm.setProp(vm.global, '__bruno__req__getHeader', getHeader); + vm.setProp(reqObject, 'getHeader', getHeader); getHeader.dispose(); let setHeader = vm.newFunction('setHeader', function (name, value) { req.setHeader(vm.dump(name), vm.dump(value)); }); - vm.setProp(vm.global, '__bruno__req__setHeader', setHeader); + vm.setProp(reqObject, 'setHeader', setHeader); setHeader.dispose(); let getBody = vm.newFunction('getBody', function () { return marshallToVm(req.getBody(), vm); }); - vm.setProp(vm.global, '__bruno__req__getBody', getBody); + vm.setProp(reqObject, 'getBody', getBody); getBody.dispose(); let setBody = vm.newFunction('setBody', function (data) { req.setBody(vm.dump(data)); }); - vm.setProp(vm.global, '__bruno__req__setBody', setBody); + vm.setProp(reqObject, 'setBody', setBody); setBody.dispose(); let setMaxRedirects = vm.newFunction('setMaxRedirects', function (maxRedirects) { req.setMaxRedirects(vm.dump(maxRedirects)); }); - vm.setProp(vm.global, '__bruno__req__setMaxRedirects', setMaxRedirects); + vm.setProp(reqObject, 'setMaxRedirects', setMaxRedirects); setMaxRedirects.dispose(); let getTimeout = vm.newFunction('getTimeout', function () { return marshallToVm(req.getTimeout(), vm); }); - vm.setProp(vm.global, '__bruno__req__getTimeout', getTimeout); + vm.setProp(reqObject, 'getTimeout', getTimeout); getTimeout.dispose(); let setTimeout = vm.newFunction('setTimeout', function (timeout) { req.setTimeout(vm.dump(timeout)); }); - vm.setProp(vm.global, '__bruno__req__setTimeout', setTimeout); + vm.setProp(reqObject, 'setTimeout', setTimeout); setTimeout.dispose(); + + vm.setProp(vm.global, 'req', reqObject); + reqObject.dispose(); }; module.exports = addBrunoRequestShimToContext; diff --git a/packages/bruno-js/src/sandbox/quickjs/shims/bruno-response.js b/packages/bruno-js/src/sandbox/quickjs/shims/bruno-response.js index c7909b2c6..40736d342 100644 --- a/packages/bruno-js/src/sandbox/quickjs/shims/bruno-response.js +++ b/packages/bruno-js/src/sandbox/quickjs/shims/bruno-response.js @@ -1,16 +1,17 @@ - const { marshallToVm } = require('../utils'); const addBrunoResponseShimToContext = (vm, res) => { + const resObject = vm.newObject(); + const status = marshallToVm(res?.status, vm); const headers = marshallToVm(res?.headers, vm); const body = marshallToVm(res?.body, vm); const responseTime = marshallToVm(res?.responseTime, vm); - vm.setProp(vm.global, '__bruno__res__status', status); - vm.setProp(vm.global, '__bruno__res__headers', headers); - vm.setProp(vm.global, '__bruno__res__body', body); - vm.setProp(vm.global, '__bruno__res__responseTime', responseTime); + vm.setProp(resObject, 'status', status); + vm.setProp(resObject, 'headers', headers); + vm.setProp(resObject, 'body', body); + vm.setProp(resObject, 'responseTime', responseTime); status.dispose(); headers.dispose(); @@ -20,32 +21,35 @@ const addBrunoResponseShimToContext = (vm, res) => { let getStatus = vm.newFunction('getStatus', function () { return marshallToVm(res.getStatus(), vm); }); - vm.setProp(vm.global, '__bruno__res__getStatus', getStatus); + vm.setProp(resObject, 'getStatus', getStatus); getStatus.dispose(); let getHeader = vm.newFunction('getHeader', function (name) { return marshallToVm(res.getHeader(vm.dump(name)), vm); }); - vm.setProp(vm.global, '__bruno__res__getHeader', getHeader); + vm.setProp(resObject, 'getHeader', getHeader); getHeader.dispose(); let getHeaders = vm.newFunction('getHeaders', function () { return marshallToVm(res.getHeaders(), vm); }); - vm.setProp(vm.global, '__bruno__res__getHeaders', getHeaders); + vm.setProp(resObject, 'getHeaders', getHeaders); getHeaders.dispose(); let getBody = vm.newFunction('getBody', function () { return marshallToVm(res.getBody(), vm); }); - vm.setProp(vm.global, '__bruno__res__getBody', getBody); + vm.setProp(resObject, 'getBody', getBody); getBody.dispose(); let getResponseTime = vm.newFunction('getResponseTime', function () { return marshallToVm(res.getResponseTime(), vm); }); - vm.setProp(vm.global, '__bruno__res__getResponseTime', getResponseTime); + vm.setProp(resObject, 'getResponseTime', getResponseTime); getResponseTime.dispose(); + + vm.setProp(vm.global, 'res', resObject); + resObject.dispose(); }; module.exports = addBrunoResponseShimToContext; diff --git a/packages/bruno-js/src/sandbox/quickjs/shims/console.js b/packages/bruno-js/src/sandbox/quickjs/shims/console.js new file mode 100644 index 000000000..432ff3b12 --- /dev/null +++ b/packages/bruno-js/src/sandbox/quickjs/shims/console.js @@ -0,0 +1,44 @@ +const addConsoleShimToContext = (vm, console) => { + const consoleHandle = vm.newObject(); + + const logHandle = vm.newFunction('log', (...args) => { + const nativeArgs = args.map(vm.dump); + console?.log && console.log(...nativeArgs); + }); + + const debugHandle = vm.newFunction('debug', (...args) => { + const nativeArgs = args.map(vm.dump); + console?.debug && console.debug(...nativeArgs); + }); + + const infoHandle = vm.newFunction('info', (...args) => { + const nativeArgs = args.map(vm.dump); + console?.info && console.info(...nativeArgs); + }); + + const warnHandle = vm.newFunction('warn', (...args) => { + const nativeArgs = args.map(vm.dump); + console?.warn && console.warn(...nativeArgs); + }); + + const errorHandle = vm.newFunction('error', (...args) => { + const nativeArgs = args.map(vm.dump); + console?.error && console.error(...nativeArgs); + }); + + vm.setProp(consoleHandle, 'log', logHandle); + vm.setProp(consoleHandle, 'debug', debugHandle); + vm.setProp(consoleHandle, 'info', infoHandle); + vm.setProp(consoleHandle, 'warn', warnHandle); + vm.setProp(consoleHandle, 'error', errorHandle); + + vm.setProp(vm.global, 'console', consoleHandle); + consoleHandle.dispose(); + logHandle.dispose(); + debugHandle.dispose(); + infoHandle.dispose(); + warnHandle.dispose(); + errorHandle.dispose(); +}; + +module.exports = addConsoleShimToContext; diff --git a/packages/bruno-js/src/sandbox/quickjs/shims/lib/index.js b/packages/bruno-js/src/sandbox/quickjs/shims/lib/index.js new file mode 100644 index 000000000..f15d1ef6e --- /dev/null +++ b/packages/bruno-js/src/sandbox/quickjs/shims/lib/index.js @@ -0,0 +1,7 @@ +const addNanoidShimToContext = require('./nanoid'); + +const addLibraryShimsToContext = async (context) => { + await addNanoidShimToContext(context); +}; + +module.exports = addLibraryShimsToContext; diff --git a/packages/bruno-js/src/sandbox/quickjs/shims/lib/nanoid.js b/packages/bruno-js/src/sandbox/quickjs/shims/lib/nanoid.js new file mode 100644 index 000000000..04107bb75 --- /dev/null +++ b/packages/bruno-js/src/sandbox/quickjs/shims/lib/nanoid.js @@ -0,0 +1,5 @@ +const { nanoid } = require('nanoid'); + +const addNanoidShimToContext = async (context) => {}; + +module.exports = addNanoidShimToContext; diff --git a/packages/bruno-js/src/sandbox/quickjs/shims/test.js b/packages/bruno-js/src/sandbox/quickjs/shims/test.js index 38d2971a6..f7a928101 100644 --- a/packages/bruno-js/src/sandbox/quickjs/shims/test.js +++ b/packages/bruno-js/src/sandbox/quickjs/shims/test.js @@ -4,14 +4,62 @@ const addBruShimToContext = (vm, __brunoTestResults) => { let addResult = vm.newFunction('addResult', function (v) { __brunoTestResults.addResult(vm.dump(v)); }); - vm.setProp(vm.global, "__bruno__addResult", addResult); + vm.setProp(vm.global, '__bruno__addResult', addResult); addResult.dispose(); let getResults = vm.newFunction('getResults', function () { return marshallToVm(__brunoTestResults.getResults(), vm); }); - vm.setProp(vm.global, "__bruno__getResults", getResults); + vm.setProp(vm.global, '__bruno__getResults', getResults); getResults.dispose(); + + // vm.evalCode( + // ` + // globalThis.expect = require('chai').expect; + // globalThis.assert = require('chai').assert; + + // globalThis.__brunoTestResults = { + // addResult: globalThis.addResult, + // getResults: globalThis.getResults, + // } + + // globalThis.DummyChaiAssertionError = class DummyChaiAssertionError extends Error { + // constructor(message, props, ssf) { + // super(message); + // this.name = "AssertionError"; + // Object.assign(this, props); + // } + // } + + // globalThis.Test = (__brunoTestResults) => async (description, callback) => { + // try { + // await callback(); + // __brunoTestResults.addResult({ description, status: "pass" }); + // } catch (error) { + // if (error instanceof DummyChaiAssertionError) { + // const { message, actual, expected } = error; + // __brunoTestResults.addResult({ + // description, + // status: "fail", + // error: message, + // actual, + // expected, + // }); + // } else { + // __brunoTestResults.addResult({ + // description, + // status: "fail", + // error: error.message || "An unexpected error occurred.", + // }); + // } + // console.log(error); + // } + // }; + // let foobar = 'foobar3000'; + // log("from test shim"); + // globalThis.test = Test(__brunoTestResults); + // ` + // ); }; module.exports = addBruShimToContext; diff --git a/packages/bruno-js/src/sandbox/quickjs/utils/index.js b/packages/bruno-js/src/sandbox/quickjs/utils/index.js index 22ea7d922..ccbd85d82 100644 --- a/packages/bruno-js/src/sandbox/quickjs/utils/index.js +++ b/packages/bruno-js/src/sandbox/quickjs/utils/index.js @@ -2,18 +2,16 @@ const marshallToVm = (value, vm) => { if (value === undefined) { return vm.undefined; } - if (value === null) { return vm.null; } - - if (typeof value === "string") { + if (typeof value === 'string') { return vm.newString(value); - } else if (typeof value === "number") { + } else if (typeof value === 'number') { return vm.newNumber(value); - } else if (typeof value === "boolean") { + } else if (typeof value === 'boolean') { return vm.newBoolean(value); - } else if (typeof value === "object") { + } else if (typeof value === 'object') { if (Array.isArray(value)) { const arr = vm.newArray(); for (let i = 0; i < value.length; i++) {