fable 3.1.31 → 3.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fable.js +469 -373
- package/dist/fable.js.map +1 -1
- package/dist/fable.min.js +2 -2
- package/dist/fable.min.js.map +1 -1
- package/example_applications/mathematical_playground/README.md +27 -0
- package/package.json +2 -2
- package/source/Fable.js +0 -1
- package/source/services/Fable-Service-CSVParser.js +177 -177
- package/source/services/Fable-Service-DataFormat.js +22 -22
- package/source/services/Fable-Service-DataGeneration.js +161 -161
- package/source/services/Fable-Service-DateManipulation.js +209 -209
- package/source/services/Fable-Service-EnvironmentData-Web.js +3 -3
- package/source/services/Fable-Service-EnvironmentData.js +3 -3
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ExpressionTokenizer-DirectiveMutation.js +136 -0
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ExpressionTokenizer.js +6 -0
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-FunctionMap.json +39 -0
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Postfix.js +5 -0
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-SolvePostfixedExpression.js +2 -2
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-TokenMap.json +9 -0
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ValueMarshal.js +2 -2
- package/source/services/Fable-Service-ExpressionParser.js +124 -22
- package/source/services/Fable-Service-FilePersistence.js +2 -2
- package/source/services/Fable-Service-Logic.js +1 -1
- package/source/services/Fable-Service-Math.js +293 -57
- package/source/services/Fable-Service-MetaTemplate.js +2 -2
- package/source/services/Fable-Service-Operation.js +7 -7
- package/source/services/Fable-Service-ProgressTime.js +3 -3
- package/source/services/Fable-Service-RestClient.js +2 -2
- package/source/services/Fable-Service-Template.js +4 -4
- package/source/services/Fable-Service-Utility.js +6 -6
- package/test/ExpressionParser_tests.js +698 -637
- package/test/Math_test.js +81 -1
package/dist/fable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";function _defineProperty2(
|
|
1
|
+
"use strict";function _defineProperty2(e,r,t){return(r=_toPropertyKey2(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}function _toPropertyKey2(t){var i=_toPrimitive2(t,"string");return"symbol"==typeof i?i:i+"";}function _toPrimitive2(t,r){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f();}else if(typeof define==="function"&&define.amd){define([],f);}else{var g;if(typeof window!=="undefined"){g=window;}else if(typeof global!=="undefined"){g=global;}else if(typeof self!=="undefined"){g=self;}else{g=this;}g.Fable=f();}})(function(){var define,module,exports;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a;}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r);},p,p.exports,r,e,n,t);}return n[i].exports;}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o;}return r;}()({1:[function(require,module,exports){'use strict';var eachOfLimit=require('async.util.eachoflimit');var withoutIndex=require('async.util.withoutindex');module.exports=function eachLimit(arr,limit,iterator,cb){return eachOfLimit(limit)(arr,withoutIndex(iterator),cb);};},{"async.util.eachoflimit":3,"async.util.withoutindex":14}],2:[function(require,module,exports){'use strict';module.exports=function(tasks){function makeCallback(index){function fn(){if(tasks.length){tasks[index].apply(null,arguments);}return fn.next();}fn.next=function(){return index<tasks.length-1?makeCallback(index+1):null;};return fn;}return makeCallback(0);};},{}],3:[function(require,module,exports){var once=require('async.util.once');var noop=require('async.util.noop');var onlyOnce=require('async.util.onlyonce');var keyIterator=require('async.util.keyiterator');module.exports=function eachOfLimit(limit){return function(obj,iterator,cb){cb=once(cb||noop);obj=obj||[];var nextKey=keyIterator(obj);if(limit<=0){return cb(null);}var done=false;var running=0;var errored=false;(function replenish(){if(done&&running<=0){return cb(null);}while(running<limit&&!errored){var key=nextKey();if(key===null){done=true;if(running<=0){cb(null);}return;}running+=1;iterator(obj[key],key,onlyOnce(function(err){running-=1;if(err){cb(err);errored=true;}else{replenish();}}));}})();};};},{"async.util.keyiterator":7,"async.util.noop":9,"async.util.once":10,"async.util.onlyonce":11}],4:[function(require,module,exports){'use strict';var setImmediate=require('async.util.setimmediate');var restParam=require('async.util.restparam');module.exports=function(fn){return restParam(function(args){var callback=args.pop();args.push(function(){var innerArgs=arguments;if(sync){setImmediate(function(){callback.apply(null,innerArgs);});}else{callback.apply(null,innerArgs);}});var sync=true;fn.apply(this,args);sync=false;});};},{"async.util.restparam":12,"async.util.setimmediate":13}],5:[function(require,module,exports){'use strict';module.exports=Array.isArray||function isArray(obj){return Object.prototype.toString.call(obj)==='[object Array]';};},{}],6:[function(require,module,exports){'use strict';var isArray=require('async.util.isarray');module.exports=function isArrayLike(arr){return isArray(arr)||// has a positive integer length property
|
|
2
2
|
typeof arr.length==='number'&&arr.length>=0&&arr.length%1===0;};},{"async.util.isarray":5}],7:[function(require,module,exports){'use strict';var _keys=require('async.util.keys');var isArrayLike=require('async.util.isarraylike');module.exports=function keyIterator(coll){var i=-1;var len;var keys;if(isArrayLike(coll)){len=coll.length;return function next(){i++;return i<len?i:null;};}else{keys=_keys(coll);len=keys.length;return function next(){i++;return i<len?keys[i]:null;};}};},{"async.util.isarraylike":6,"async.util.keys":8}],8:[function(require,module,exports){'use strict';module.exports=Object.keys||function keys(obj){var _keys=[];for(var k in obj){if(obj.hasOwnProperty(k)){_keys.push(k);}}return _keys;};},{}],9:[function(require,module,exports){'use strict';module.exports=function noop(){};},{}],10:[function(require,module,exports){'use strict';module.exports=function once(fn){return function(){if(fn===null)return;fn.apply(this,arguments);fn=null;};};},{}],11:[function(require,module,exports){'use strict';module.exports=function only_once(fn){return function(){if(fn===null)throw new Error('Callback was already called.');fn.apply(this,arguments);fn=null;};};},{}],12:[function(require,module,exports){'use strict';module.exports=function restParam(func,startIndex){startIndex=startIndex==null?func.length-1:+startIndex;return function(){var length=Math.max(arguments.length-startIndex,0);var rest=new Array(length);for(var index=0;index<length;index++){rest[index]=arguments[index+startIndex];}switch(startIndex){case 0:return func.call(this,rest);case 1:return func.call(this,arguments[0],rest);}};};},{}],13:[function(require,module,exports){(function(setImmediate){(function(){'use strict';var _setImmediate=typeof setImmediate==='function'&&setImmediate;var fallback=function(fn){setTimeout(fn,0);};module.exports=function setImmediate(fn){// not a direct alias for IE10 compatibility
|
|
3
|
-
return(_setImmediate||fallback)(fn);};}).call(this);}).call(this,require("timers").setImmediate);},{"timers":
|
|
3
|
+
return(_setImmediate||fallback)(fn);};}).call(this);}).call(this,require("timers").setImmediate);},{"timers":144}],14:[function(require,module,exports){'use strict';module.exports=function withoutIndex(iterator){return function(value,index,callback){return iterator(value,callback);};};},{}],15:[function(require,module,exports){'use strict';var once=require('async.util.once');var noop=require('async.util.noop');var isArray=require('async.util.isarray');var restParam=require('async.util.restparam');var ensureAsync=require('async.util.ensureasync');var iterator=require('async.iterator');module.exports=function(tasks,cb){cb=once(cb||noop);if(!isArray(tasks))return cb(new Error('First argument to waterfall must be an array of functions'));if(!tasks.length)return cb();function wrapIterator(iterator){return restParam(function(err,args){if(err){cb.apply(null,[err].concat(args));}else{var next=iterator.next();if(next){args.push(wrapIterator(next));}else{args.push(cb);}ensureAsync(iterator).apply(null,args);}});}wrapIterator(iterator(tasks))();};},{"async.iterator":2,"async.util.ensureasync":4,"async.util.isarray":5,"async.util.noop":9,"async.util.once":10,"async.util.restparam":12}],16:[function(require,module,exports){'use strict';exports.byteLength=byteLength;exports.toByteArray=toByteArray;exports.fromByteArray=fromByteArray;var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=='undefined'?Uint8Array:Array;var code='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';for(var i=0,len=code.length;i<len;++i){lookup[i]=code[i];revLookup[code.charCodeAt(i)]=i;}// Support decoding URL-safe base64 strings, as Node.js does.
|
|
4
4
|
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
|
|
5
5
|
revLookup['-'.charCodeAt(0)]=62;revLookup['_'.charCodeAt(0)]=63;function getLens(b64){var len=b64.length;if(len%4>0){throw new Error('Invalid string. Length must be a multiple of 4');}// Trim off extra bytes after placeholder bytes are found
|
|
6
6
|
// See: https://github.com/beatgammit/base64-js/issues/42
|
|
@@ -15,7 +15,7 @@ if(extraBytes===1){tmp=uint8[len-1];parts.push(lookup[tmp>>2]+lookup[tmp<<4&0x3F
|
|
|
15
15
|
* A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
|
|
16
16
|
* Copyright (c) 2025 Michael Mclaughlin
|
|
17
17
|
* https://github.com/MikeMcl/big.js/LICENCE.md
|
|
18
|
-
*/;(function(GLOBAL){'use strict';var Big,/************************************** EDITABLE DEFAULTS
|
|
18
|
+
*/;(function(GLOBAL){'use strict';var Big,/************************************** EDITABLE DEFAULTS *****************************************/// The default values below must be integers within the stated ranges.
|
|
19
19
|
/*
|
|
20
20
|
* The maximum number of decimal places (DP) of the results of operations involving division:
|
|
21
21
|
* div and sqrt, and pow with negative exponents.
|
|
@@ -47,7 +47,7 @@ MAX_POWER=1E6,// 1 to 1000000
|
|
|
47
47
|
* or if valueOf is called, or if toNumber is called on a Big which cannot be converted to a
|
|
48
48
|
* primitive number without a loss of precision.
|
|
49
49
|
*/STRICT=false,// true or false
|
|
50
|
-
|
|
50
|
+
/**************************************************************************************************/// Error messages.
|
|
51
51
|
NAME='[big.js] ',INVALID=NAME+'Invalid ',INVALID_DP=INVALID+'decimal places',INVALID_RM=INVALID+'rounding mode',DIV_BY_ZERO=NAME+'Division by zero',// The shared prototype object.
|
|
52
52
|
P={},UNDEFINED=void 0,NUMERIC=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;/*
|
|
53
53
|
* Create and return a Big constructor.
|
|
@@ -258,7 +258,7 @@ if(typeof define==='function'&&define.amd){define(function(){return Big;});// No
|
|
|
258
258
|
*
|
|
259
259
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
260
260
|
* @license MIT
|
|
261
|
-
|
|
261
|
+
*//* eslint-disable no-proto */'use strict';var base64=require('base64-js');var ieee754=require('ieee754');exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;var K_MAX_LENGTH=0x7fffffff;exports.kMaxLength=K_MAX_LENGTH;/**
|
|
262
262
|
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
|
263
263
|
* === true Use Uint8Array implementation (fastest)
|
|
264
264
|
* === false Print warning and recommend using `buffer` v4.x which has an Object
|
|
@@ -396,7 +396,7 @@ byteArray.push(str.charCodeAt(i)&0xFF);}return byteArray;}function utf16leToByte
|
|
|
396
396
|
// See: https://github.com/feross/buffer/issues/166
|
|
397
397
|
function isInstance(obj,type){return obj instanceof type||obj!=null&&obj.constructor!=null&&obj.constructor.name!=null&&obj.constructor.name===type.name;}function numberIsNaN(obj){// For IE11 support
|
|
398
398
|
return obj!==obj;// eslint-disable-line no-self-compare
|
|
399
|
-
}}).call(this);}).call(this,require("buffer").Buffer);},{"base64-js":16,"buffer":20,"ieee754":
|
|
399
|
+
}}).call(this);}).call(this,require("buffer").Buffer);},{"base64-js":16,"buffer":20,"ieee754":79}],21:[function(require,module,exports){module.exports={"100":"Continue","101":"Switching Protocols","102":"Processing","200":"OK","201":"Created","202":"Accepted","203":"Non-Authoritative Information","204":"No Content","205":"Reset Content","206":"Partial Content","207":"Multi-Status","208":"Already Reported","226":"IM Used","300":"Multiple Choices","301":"Moved Permanently","302":"Found","303":"See Other","304":"Not Modified","305":"Use Proxy","307":"Temporary Redirect","308":"Permanent Redirect","400":"Bad Request","401":"Unauthorized","402":"Payment Required","403":"Forbidden","404":"Not Found","405":"Method Not Allowed","406":"Not Acceptable","407":"Proxy Authentication Required","408":"Request Timeout","409":"Conflict","410":"Gone","411":"Length Required","412":"Precondition Failed","413":"Payload Too Large","414":"URI Too Long","415":"Unsupported Media Type","416":"Range Not Satisfiable","417":"Expectation Failed","418":"I'm a teapot","421":"Misdirected Request","422":"Unprocessable Entity","423":"Locked","424":"Failed Dependency","425":"Unordered Collection","426":"Upgrade Required","428":"Precondition Required","429":"Too Many Requests","431":"Request Header Fields Too Large","451":"Unavailable For Legal Reasons","500":"Internal Server Error","501":"Not Implemented","502":"Bad Gateway","503":"Service Unavailable","504":"Gateway Timeout","505":"HTTP Version Not Supported","506":"Variant Also Negotiates","507":"Insufficient Storage","508":"Loop Detected","509":"Bandwidth Limit Exceeded","510":"Not Extended","511":"Network Authentication Required"};},{}],22:[function(require,module,exports){/**
|
|
400
400
|
* Cache data structure with:
|
|
401
401
|
* - enumerable items
|
|
402
402
|
* - unique hash item access (if none is passed in, one is generated)
|
|
@@ -442,12 +442,12 @@ prune(fComplete){let tmpRemovedRecords=[];// If there are no cached records, we
|
|
|
442
442
|
if(this._List.length<1){return fComplete(tmpRemovedRecords);}// Now prune based on expiration time
|
|
443
443
|
this.pruneBasedOnExpiration(fExpirationPruneComplete=>{// Now prune based on length, then return the removed records in the callback.
|
|
444
444
|
this.pruneBasedOnLength(fComplete,tmpRemovedRecords);},tmpRemovedRecords);}// Get a low level node (including metadata statistics) by hash from the cache
|
|
445
|
-
getNode(pHash){if(!this._HashMap.hasOwnProperty(pHash))return false;return this._HashMap[pHash];}}module.exports=CashMoney;},{"./LinkedList.js":24,"fable-serviceproviderbase":
|
|
445
|
+
getNode(pHash){if(!this._HashMap.hasOwnProperty(pHash))return false;return this._HashMap[pHash];}}module.exports=CashMoney;},{"./LinkedList.js":24,"fable-serviceproviderbase":59}],23:[function(require,module,exports){/**
|
|
446
446
|
* Double Linked List Node
|
|
447
447
|
*
|
|
448
448
|
* @author Steven Velozo <steven@velozo.com>
|
|
449
449
|
* @module CashMoney
|
|
450
|
-
|
|
450
|
+
*//**
|
|
451
451
|
* Linked List Node Prototype
|
|
452
452
|
*
|
|
453
453
|
* @class LinkedListNode
|
|
@@ -493,8 +493,7 @@ else tmpNode=tmpNode.RightNode;// Call the actual action
|
|
|
493
493
|
// I hate this pattern because long tails eventually cause stack overflows.
|
|
494
494
|
fAction(tmpNode.Datum,tmpNode.Hash,fIterator);};// Now kick off the iterator
|
|
495
495
|
return fIterator();}// Seek a specific node, 0 is the index of the first node.
|
|
496
|
-
seek(pNodeIndex){if(!pNodeIndex)return false;if(this.length<1)return false;if(pNodeIndex>=this.length)return false;let tmpNode=this.head;for(let i=0;i<pNodeIndex;i++){tmpNode=tmpNode.RightNode;}return tmpNode;}}module.exports=LinkedList;},{"./LinkedList-Node.js":23}],25:[function(require,module,exports){'use strict';var
|
|
497
|
-
$defineProperty=null;}}module.exports=function callBind(originalFunction){if(typeof originalFunction!=='function'){throw new $TypeError('a function is required');}var func=$reflectApply(bind,$call,arguments);return setFunctionLength(func,1+$max(0,originalFunction.length-(arguments.length-1)),true);};var applyBind=function applyBind(){return $reflectApply(bind,$apply,arguments);};if($defineProperty){$defineProperty(module.exports,'apply',{value:applyBind});}else{module.exports.apply=applyBind;}},{"es-errors/type":42,"function-bind":62,"get-intrinsic":63,"set-function-length":102}],27:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.parse=parse;exports.serialize=serialize;/**
|
|
496
|
+
seek(pNodeIndex){if(!pNodeIndex)return false;if(this.length<1)return false;if(pNodeIndex>=this.length)return false;let tmpNode=this.head;for(let i=0;i<pNodeIndex;i++){tmpNode=tmpNode.RightNode;}return tmpNode;}}module.exports=LinkedList;},{"./LinkedList-Node.js":23}],25:[function(require,module,exports){'use strict';var bind=require('function-bind');var $apply=require('./functionApply');var $call=require('./functionCall');var $reflectApply=require('./reflectApply');/** @type {import('./actualApply')} */module.exports=$reflectApply||bind.call($call,$apply);},{"./functionApply":26,"./functionCall":27,"./reflectApply":29,"function-bind":68}],26:[function(require,module,exports){'use strict';/** @type {import('./functionApply')} */module.exports=Function.prototype.apply;},{}],27:[function(require,module,exports){'use strict';/** @type {import('./functionCall')} */module.exports=Function.prototype.call;},{}],28:[function(require,module,exports){'use strict';var bind=require('function-bind');var $TypeError=require('es-errors/type');var $call=require('./functionCall');var $actualApply=require('./actualApply');/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */module.exports=function callBindBasic(args){if(args.length<1||typeof args[0]!=='function'){throw new $TypeError('a function is required');}return $actualApply(bind,$call,args);};},{"./actualApply":25,"./functionCall":27,"es-errors/type":47,"function-bind":68}],29:[function(require,module,exports){'use strict';/** @type {import('./reflectApply')} */module.exports=typeof Reflect!=='undefined'&&Reflect&&Reflect.apply;},{}],30:[function(require,module,exports){'use strict';var GetIntrinsic=require('get-intrinsic');var callBindBasic=require('call-bind-apply-helpers');/** @type {(thisArg: string, searchString: string, position?: number) => number} */var $indexOf=callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]);/** @type {import('.')} */module.exports=function callBoundIntrinsic(name,allowMissing){/* eslint no-extra-parens: 0 */var intrinsic=/** @type {(this: unknown, ...args: unknown[]) => unknown} */GetIntrinsic(name,!!allowMissing);if(typeof intrinsic==='function'&&$indexOf(name,'.prototype.')>-1){return callBindBasic(/** @type {const} */[intrinsic]);}return intrinsic;};},{"call-bind-apply-helpers":28,"get-intrinsic":69}],31:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.parse=parse;exports.serialize=serialize;/**
|
|
498
497
|
* RegExp to match cookie-name in RFC 6265 sec 4.1.1
|
|
499
498
|
* This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
|
|
500
499
|
* which has been replaced by the token definition in RFC 7230 appendix B.
|
|
@@ -567,10 +566,11 @@ if(obj[key]===undefined){let valStartIdx=startIndex(str,eqIdx+1,endIdx);let valE
|
|
|
567
566
|
* URL-decode string value. Optimized to skip native call when no %.
|
|
568
567
|
*/function decode(str){if(str.indexOf("%")===-1)return str;try{return decodeURIComponent(str);}catch(e){return str;}}/**
|
|
569
568
|
* Determine if value is a Date.
|
|
570
|
-
*/function isDate(val){return __toString.call(val)==="[object Date]";}},{}],28:[function(require,module,exports){!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs=e();}(this,function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]";}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t;},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0");},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return+(-(r+(n-i)/(s?i-u:u-i))||0);},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t);},p:function(t){return{M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"");},u:function(t){return void 0===t;}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p]);},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0]);}else{var a=e.name;D[a]=e,i=a;}return!r&&i&&(g=i),i||!r&&g;},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n);},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset});};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date();if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s);}}return new Date(e);}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b;},m.isValid=function(){return!(this.$d.toString()===l);},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e);},m.isAfter=function(t,e){return O(t)<this.startOf(e);},m.isBefore=function(t,e){return this.endOf(e)<O(t);},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t);},m.unix=function(){return Math.floor(this.valueOf()/1e3);},m.valueOf=function(){return this.$d.getTime();},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a);},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n);},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone();}},m.endOf=function(t){return this.startOf(t,!1);},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this;},m.set=function(t,e){return this.clone().$set(t,e);},m.get=function(t){return this[b.p(t)]();},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l);};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this);},m.subtract=function(t,e){return this.add(-1*t,e);},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s);},d=function(t){return b.s(s%12||12,t,"0");},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r;};return r.replace(y,function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i;}return null;}(t)||i.replace(":","");});},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15);},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m);};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($);},m.daysInMonth=function(){return this.endOf(c).$D;},m.$locale=function(){return D[this.$L];},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n;},m.clone=function(){return b.w(this.$d,this);},m.toDate=function(){return new Date(this.valueOf());},m.toJSON=function(){return this.isValid()?this.toISOString():null;},m.toISOString=function(){return this.$d.toISOString();},m.toString=function(){return this.$d.toUTCString();},M;}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach(function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1]);};}),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O;},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t);},O.en=D[g],O.Ls=D,O.p={},O;});},{}],29:[function(require,module,exports){!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).dayjs_plugin_advancedFormat=t();}(this,function(){"use strict";return function(e,t){var r=t.prototype,n=r.format;r.format=function(e){var t=this,r=this.$locale();if(!this.isValid())return n.bind(this)(e);var s=this.$utils(),a=(e||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(e){switch(e){case"Q":return Math.ceil((t.$M+1)/3);case"Do":return r.ordinal(t.$D);case"gggg":return t.weekYear();case"GGGG":return t.isoWeekYear();case"wo":return r.ordinal(t.week(),"W");case"w":case"ww":return s.s(t.week(),"w"===e?1:2,"0");case"W":case"WW":return s.s(t.isoWeek(),"W"===e?1:2,"0");case"k":case"kk":return s.s(String(0===t.$H?24:t.$H),"k"===e?1:2,"0");case"X":return Math.floor(t.$d.getTime()/1e3);case"x":return t.$d.getTime();case"z":return"["+t.offsetName()+"]";case"zzz":return"["+t.offsetName("long")+"]";default:return e;}});return n.bind(this)(a);};};});},{}],30:[function(require,module,exports){!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).dayjs_plugin_isoWeek=t();}(this,function(){"use strict";var e="day";return function(t,i,s){var a=function(t){return t.add(4-t.isoWeekday(),e);},d=i.prototype;d.isoWeekYear=function(){return a(this).year();},d.isoWeek=function(t){if(!this.$utils().u(t))return this.add(7*(t-this.isoWeek()),e);var i,d,n,o,r=a(this),u=(i=this.isoWeekYear(),d=this.$u,n=(d?s.utc:s)().year(i).startOf("year"),o=4-n.isoWeekday(),n.isoWeekday()>4&&(o+=7),n.add(o,e));return r.diff(u,"week")+1;},d.isoWeekday=function(e){return this.$utils().u(e)?this.day()||7:this.day(this.day()%7?e:e-7);};var n=d.startOf;d.startOf=function(e,t){var i=this.$utils(),s=!!i.u(t)||t;return"isoweek"===i.p(e)?s?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):n.bind(this)(e,t);};};});},{}],31:[function(require,module,exports){!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(r="undefined"!=typeof globalThis?globalThis:r||self).dayjs_plugin_relativeTime=e();}(this,function(){"use strict";return function(r,e,t){r=r||{};var n=e.prototype,o={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function i(r,e,t,o){return n.fromToBase(r,e,t,o);}t.en.relativeTime=o,n.fromToBase=function(e,n,i,d,u){for(var f,a,s,l=i.$locale().relativeTime||o,h=r.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],m=h.length,c=0;c<m;c+=1){var y=h[c];y.d&&(f=d?t(e).diff(i,y.d,!0):i.diff(e,y.d,!0));var p=(r.rounding||Math.round)(Math.abs(f));if(s=f>0,p<=y.r||!y.r){p<=1&&c>0&&(y=h[c-1]);var v=l[y.l];u&&(p=u(""+p)),a="string"==typeof v?v.replace("%d",p):v(p,n,y.l,s);break;}}if(n)return a;var M=s?l.future:l.past;return"function"==typeof M?M(a):M.replace("%s",a);},n.to=function(r,e){return i(r,e,this,!0);},n.from=function(r,e){return i(r,e,this);};var d=function(r){return r.$u?t.utc():t();};n.toNow=function(r){return this.to(d(this),r);},n.fromNow=function(r){return this.from(d(this),r);};};});},{}],32:[function(require,module,exports){!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs_plugin_timezone=e();}(this,function(){"use strict";var t={year:0,month:1,day:2,hour:3,minute:4,second:5},e={};return function(n,i,o){var r,a=function(t,n,i){void 0===i&&(i={});var o=new Date(t),r=function(t,n){void 0===n&&(n={});var i=n.timeZoneName||"short",o=t+"|"+i,r=e[o];return r||(r=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:i}),e[o]=r),r;}(n,i);return r.formatToParts(o);},u=function(e,n){for(var i=a(e,n),r=[],u=0;u<i.length;u+=1){var f=i[u],s=f.type,m=f.value,c=t[s];c>=0&&(r[c]=parseInt(m,10));}var d=r[3],l=24===d?0:d,h=r[0]+"-"+r[1]+"-"+r[2]+" "+l+":"+r[4]+":"+r[5]+":000",v=+e;return(o.utc(h).valueOf()-(v-=v%1e3))/6e4;},f=i.prototype;f.tz=function(t,e){void 0===t&&(t=r);var n,i=this.utcOffset(),a=this.toDate(),u=a.toLocaleString("en-US",{timeZone:t}),f=Math.round((a-new Date(u))/1e3/60),s=15*-Math.round(a.getTimezoneOffset()/15)-f;if(!Number(s))n=this.utcOffset(0,e);else if(n=o(u,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(s,!0),e){var m=n.utcOffset();n=n.add(i-m,"minute");}return n.$x.$timezone=t,n;},f.offsetName=function(t){var e=this.$x.$timezone||o.tz.guess(),n=a(this.valueOf(),e,{timeZoneName:t}).find(function(t){return"timezonename"===t.type.toLowerCase();});return n&&n.value;};var s=f.startOf;f.startOf=function(t,e){if(!this.$x||!this.$x.$timezone)return s.call(this,t,e);var n=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return s.call(n,t,e).tz(this.$x.$timezone,!0);},o.tz=function(t,e,n){var i=n&&e,a=n||e||r,f=u(+o(),a);if("string"!=typeof t)return o(t).tz(a);var s=function(t,e,n){var i=t-60*e*1e3,o=u(i,n);if(e===o)return[i,e];var r=u(i-=60*(o-e)*1e3,n);return o===r?[i,o]:[t-60*Math.min(o,r)*1e3,Math.max(o,r)];}(o.utc(t,i).valueOf(),f,a),m=s[0],c=s[1],d=o(m).utcOffset(c);return d.$x.$timezone=a,d;},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone;},o.tz.setDefault=function(t){r=t;};};});},{}],33:[function(require,module,exports){!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs_plugin_utc=i();}(this,function(){"use strict";var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t){var i={date:t,utc:!0,args:arguments};return new f(i);},u.utc=function(i){var e=n(this.toDate(),{locale:this.$L,utc:!0});return i?e.add(this.utcOffset(),t):e;},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:!1});};var r=u.parse;u.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),r.call(this,t);};var o=u.init;u.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds();}else o.call(this);};var a=u.utcOffset;u.utcOffset=function(s,f){var n=this.$utils().u;if(n(s))return this.$u?0:n(this.$offset)?a.call(this):this.$offset;if("string"==typeof s&&(s=function(t){void 0===t&&(t="");var s=t.match(i);if(!s)return null;var f=(""+s[0]).match(e)||["-",0,0],n=f[0],u=60*+f[1]+ +f[2];return 0===u?0:"+"===n?u:-u;}(s),null===s))return this;var u=Math.abs(s)<=16?60*s:s;if(0===u)return this.utc(f);var r=this.clone();if(f)return r.$offset=u,r.$u=!1,r;var o=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(r=this.local().add(u+o,t)).$offset=u,r.$x.$localOffset=o,r;};var h=u.format;u.format=function(t){var i=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,i);},u.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t;},u.isUTC=function(){return!!this.$u;},u.toISOString=function(){return this.toDate().toISOString();},u.toString=function(){return this.toDate().toUTCString();};var l=u.toDate;u.toDate=function(t){return"s"===t&&this.$offset?n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this);};var c=u.diff;u.diff=function(t,i,e){if(t&&this.$u===t.$u)return c.call(this,t,i,e);var s=this.local(),f=n(t).local();return c.call(s,f,i,e);};};});},{}],34:[function(require,module,exports){!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).dayjs_plugin_weekOfYear=t();}(this,function(){"use strict";var e="week",t="year";return function(i,n,r){var f=n.prototype;f.week=function(i){if(void 0===i&&(i=null),null!==i)return this.add(7*(i-this.week()),"day");var n=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var f=r(this).startOf(t).add(1,t).date(n),s=r(this).endOf(e);if(f.isBefore(s))return 1;}var a=r(this).startOf(t).date(n).startOf(e).subtract(1,"millisecond"),o=this.diff(a,e,!0);return o<0?r(this).startOf("week").week():Math.ceil(o);},f.weeks=function(e){return void 0===e&&(e=null),this.week(e);};};});},{}],35:[function(require,module,exports){!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).dayjs_plugin_weekday=t();}(this,function(){"use strict";return function(e,t){t.prototype.weekday=function(e){var t=this.$locale().weekStart||0,i=this.$W,n=(i<t?i+7:i)-t;return this.$utils().u(e)?n:this.subtract(n,"day").add(e,"day");};};});},{}],36:[function(require,module,exports){'use strict';var hasPropertyDescriptors=require('has-property-descriptors')();var GetIntrinsic=require('get-intrinsic');var $defineProperty=hasPropertyDescriptors&&GetIntrinsic('%Object.defineProperty%',true);if($defineProperty){try{$defineProperty({},'a',{value:1});}catch(e){// IE 8 has a broken defineProperty
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
569
|
+
*/function isDate(val){return __toString.call(val)==="[object Date]";}},{}],32:[function(require,module,exports){!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs=e();}(this,function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]";}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t;},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0");},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return+(-(r+(n-i)/(s?i-u:u-i))||0);},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t);},p:function(t){return{M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"");},u:function(t){return void 0===t;}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p]);},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0]);}else{var a=e.name;D[a]=e,i=a;}return!r&&i&&(g=i),i||!r&&g;},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n);},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset});};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date();if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s);}}return new Date(e);}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b;},m.isValid=function(){return!(this.$d.toString()===l);},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e);},m.isAfter=function(t,e){return O(t)<this.startOf(e);},m.isBefore=function(t,e){return this.endOf(e)<O(t);},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t);},m.unix=function(){return Math.floor(this.valueOf()/1e3);},m.valueOf=function(){return this.$d.getTime();},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a);},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n);},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone();}},m.endOf=function(t){return this.startOf(t,!1);},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this;},m.set=function(t,e){return this.clone().$set(t,e);},m.get=function(t){return this[b.p(t)]();},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l);};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this);},m.subtract=function(t,e){return this.add(-1*t,e);},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s);},d=function(t){return b.s(s%12||12,t,"0");},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r;};return r.replace(y,function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i;}return null;}(t)||i.replace(":","");});},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15);},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m);};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($);},m.daysInMonth=function(){return this.endOf(c).$D;},m.$locale=function(){return D[this.$L];},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n;},m.clone=function(){return b.w(this.$d,this);},m.toDate=function(){return new Date(this.valueOf());},m.toJSON=function(){return this.isValid()?this.toISOString():null;},m.toISOString=function(){return this.$d.toISOString();},m.toString=function(){return this.$d.toUTCString();},M;}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach(function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1]);};}),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O;},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t);},O.en=D[g],O.Ls=D,O.p={},O;});},{}],33:[function(require,module,exports){!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).dayjs_plugin_advancedFormat=t();}(this,function(){"use strict";return function(e,t){var r=t.prototype,n=r.format;r.format=function(e){var t=this,r=this.$locale();if(!this.isValid())return n.bind(this)(e);var s=this.$utils(),a=(e||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(e){switch(e){case"Q":return Math.ceil((t.$M+1)/3);case"Do":return r.ordinal(t.$D);case"gggg":return t.weekYear();case"GGGG":return t.isoWeekYear();case"wo":return r.ordinal(t.week(),"W");case"w":case"ww":return s.s(t.week(),"w"===e?1:2,"0");case"W":case"WW":return s.s(t.isoWeek(),"W"===e?1:2,"0");case"k":case"kk":return s.s(String(0===t.$H?24:t.$H),"k"===e?1:2,"0");case"X":return Math.floor(t.$d.getTime()/1e3);case"x":return t.$d.getTime();case"z":return"["+t.offsetName()+"]";case"zzz":return"["+t.offsetName("long")+"]";default:return e;}});return n.bind(this)(a);};};});},{}],34:[function(require,module,exports){!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).dayjs_plugin_isoWeek=t();}(this,function(){"use strict";var e="day";return function(t,i,s){var a=function(t){return t.add(4-t.isoWeekday(),e);},d=i.prototype;d.isoWeekYear=function(){return a(this).year();},d.isoWeek=function(t){if(!this.$utils().u(t))return this.add(7*(t-this.isoWeek()),e);var i,d,n,o,r=a(this),u=(i=this.isoWeekYear(),d=this.$u,n=(d?s.utc:s)().year(i).startOf("year"),o=4-n.isoWeekday(),n.isoWeekday()>4&&(o+=7),n.add(o,e));return r.diff(u,"week")+1;},d.isoWeekday=function(e){return this.$utils().u(e)?this.day()||7:this.day(this.day()%7?e:e-7);};var n=d.startOf;d.startOf=function(e,t){var i=this.$utils(),s=!!i.u(t)||t;return"isoweek"===i.p(e)?s?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):n.bind(this)(e,t);};};});},{}],35:[function(require,module,exports){!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(r="undefined"!=typeof globalThis?globalThis:r||self).dayjs_plugin_relativeTime=e();}(this,function(){"use strict";return function(r,e,t){r=r||{};var n=e.prototype,o={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function i(r,e,t,o){return n.fromToBase(r,e,t,o);}t.en.relativeTime=o,n.fromToBase=function(e,n,i,d,u){for(var f,a,s,l=i.$locale().relativeTime||o,h=r.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],m=h.length,c=0;c<m;c+=1){var y=h[c];y.d&&(f=d?t(e).diff(i,y.d,!0):i.diff(e,y.d,!0));var p=(r.rounding||Math.round)(Math.abs(f));if(s=f>0,p<=y.r||!y.r){p<=1&&c>0&&(y=h[c-1]);var v=l[y.l];u&&(p=u(""+p)),a="string"==typeof v?v.replace("%d",p):v(p,n,y.l,s);break;}}if(n)return a;var M=s?l.future:l.past;return"function"==typeof M?M(a):M.replace("%s",a);},n.to=function(r,e){return i(r,e,this,!0);},n.from=function(r,e){return i(r,e,this);};var d=function(r){return r.$u?t.utc():t();};n.toNow=function(r){return this.to(d(this),r);},n.fromNow=function(r){return this.from(d(this),r);};};});},{}],36:[function(require,module,exports){!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs_plugin_timezone=e();}(this,function(){"use strict";var t={year:0,month:1,day:2,hour:3,minute:4,second:5},e={};return function(n,i,o){var r,a=function(t,n,i){void 0===i&&(i={});var o=new Date(t),r=function(t,n){void 0===n&&(n={});var i=n.timeZoneName||"short",o=t+"|"+i,r=e[o];return r||(r=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:i}),e[o]=r),r;}(n,i);return r.formatToParts(o);},u=function(e,n){for(var i=a(e,n),r=[],u=0;u<i.length;u+=1){var f=i[u],s=f.type,m=f.value,c=t[s];c>=0&&(r[c]=parseInt(m,10));}var d=r[3],l=24===d?0:d,h=r[0]+"-"+r[1]+"-"+r[2]+" "+l+":"+r[4]+":"+r[5]+":000",v=+e;return(o.utc(h).valueOf()-(v-=v%1e3))/6e4;},f=i.prototype;f.tz=function(t,e){void 0===t&&(t=r);var n,i=this.utcOffset(),a=this.toDate(),u=a.toLocaleString("en-US",{timeZone:t}),f=Math.round((a-new Date(u))/1e3/60),s=15*-Math.round(a.getTimezoneOffset()/15)-f;if(!Number(s))n=this.utcOffset(0,e);else if(n=o(u,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(s,!0),e){var m=n.utcOffset();n=n.add(i-m,"minute");}return n.$x.$timezone=t,n;},f.offsetName=function(t){var e=this.$x.$timezone||o.tz.guess(),n=a(this.valueOf(),e,{timeZoneName:t}).find(function(t){return"timezonename"===t.type.toLowerCase();});return n&&n.value;};var s=f.startOf;f.startOf=function(t,e){if(!this.$x||!this.$x.$timezone)return s.call(this,t,e);var n=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return s.call(n,t,e).tz(this.$x.$timezone,!0);},o.tz=function(t,e,n){var i=n&&e,a=n||e||r,f=u(+o(),a);if("string"!=typeof t)return o(t).tz(a);var s=function(t,e,n){var i=t-60*e*1e3,o=u(i,n);if(e===o)return[i,e];var r=u(i-=60*(o-e)*1e3,n);return o===r?[i,o]:[t-60*Math.min(o,r)*1e3,Math.max(o,r)];}(o.utc(t,i).valueOf(),f,a),m=s[0],c=s[1],d=o(m).utcOffset(c);return d.$x.$timezone=a,d;},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone;},o.tz.setDefault=function(t){r=t;};};});},{}],37:[function(require,module,exports){!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs_plugin_utc=i();}(this,function(){"use strict";var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t){var i={date:t,utc:!0,args:arguments};return new f(i);},u.utc=function(i){var e=n(this.toDate(),{locale:this.$L,utc:!0});return i?e.add(this.utcOffset(),t):e;},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:!1});};var r=u.parse;u.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),r.call(this,t);};var o=u.init;u.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds();}else o.call(this);};var a=u.utcOffset;u.utcOffset=function(s,f){var n=this.$utils().u;if(n(s))return this.$u?0:n(this.$offset)?a.call(this):this.$offset;if("string"==typeof s&&(s=function(t){void 0===t&&(t="");var s=t.match(i);if(!s)return null;var f=(""+s[0]).match(e)||["-",0,0],n=f[0],u=60*+f[1]+ +f[2];return 0===u?0:"+"===n?u:-u;}(s),null===s))return this;var u=Math.abs(s)<=16?60*s:s;if(0===u)return this.utc(f);var r=this.clone();if(f)return r.$offset=u,r.$u=!1,r;var o=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(r=this.local().add(u+o,t)).$offset=u,r.$x.$localOffset=o,r;};var h=u.format;u.format=function(t){var i=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,i);},u.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t;},u.isUTC=function(){return!!this.$u;},u.toISOString=function(){return this.toDate().toISOString();},u.toString=function(){return this.toDate().toUTCString();};var l=u.toDate;u.toDate=function(t){return"s"===t&&this.$offset?n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this);};var c=u.diff;u.diff=function(t,i,e){if(t&&this.$u===t.$u)return c.call(this,t,i,e);var s=this.local(),f=n(t).local();return c.call(s,f,i,e);};};});},{}],38:[function(require,module,exports){!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).dayjs_plugin_weekOfYear=t();}(this,function(){"use strict";var e="week",t="year";return function(i,n,r){var f=n.prototype;f.week=function(i){if(void 0===i&&(i=null),null!==i)return this.add(7*(i-this.week()),"day");var n=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var f=r(this).startOf(t).add(1,t).date(n),s=r(this).endOf(e);if(f.isBefore(s))return 1;}var a=r(this).startOf(t).date(n).startOf(e).subtract(1,"millisecond"),o=this.diff(a,e,!0);return o<0?r(this).startOf("week").week():Math.ceil(o);},f.weeks=function(e){return void 0===e&&(e=null),this.week(e);};};});},{}],39:[function(require,module,exports){!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).dayjs_plugin_weekday=t();}(this,function(){"use strict";return function(e,t){t.prototype.weekday=function(e){var t=this.$locale().weekStart||0,i=this.$W,n=(i<t?i+7:i)-t;return this.$utils().u(e)?n:this.subtract(n,"day").add(e,"day");};};});},{}],40:[function(require,module,exports){'use strict';var callBind=require('call-bind-apply-helpers');var gOPD=require('gopd');var hasProtoAccessor;try{// eslint-disable-next-line no-extra-parens, no-proto
|
|
570
|
+
hasProtoAccessor=/** @type {{ __proto__?: typeof Array.prototype }} */[].__proto__===Array.prototype;}catch(e){if(!e||typeof e!=='object'||!('code'in e)||e.code!=='ERR_PROTO_ACCESS'){throw e;}}// eslint-disable-next-line no-extra-parens
|
|
571
|
+
var desc=!!hasProtoAccessor&&gOPD&&gOPD(Object.prototype,/** @type {keyof typeof Object.prototype} */'__proto__');var $Object=Object;var $getPrototypeOf=$Object.getPrototypeOf;/** @type {import('./get')} */module.exports=desc&&typeof desc.get==='function'?callBind([desc.get]):typeof $getPrototypeOf==='function'?/** @type {import('./get')} */function getDunder(value){// eslint-disable-next-line eqeqeq
|
|
572
|
+
return $getPrototypeOf(value==null?value:$Object(value));}:false;},{"call-bind-apply-helpers":28,"gopd":74}],41:[function(require,module,exports){'use strict';/** @type {import('.')} */var $defineProperty=Object.defineProperty||false;if($defineProperty){try{$defineProperty({},'a',{value:1});}catch(e){// IE 8 has a broken defineProperty
|
|
573
|
+
$defineProperty=false;}}module.exports=$defineProperty;},{}],42:[function(require,module,exports){'use strict';/** @type {import('./eval')} */module.exports=EvalError;},{}],43:[function(require,module,exports){'use strict';/** @type {import('.')} */module.exports=Error;},{}],44:[function(require,module,exports){'use strict';/** @type {import('./range')} */module.exports=RangeError;},{}],45:[function(require,module,exports){'use strict';/** @type {import('./ref')} */module.exports=ReferenceError;},{}],46:[function(require,module,exports){'use strict';/** @type {import('./syntax')} */module.exports=SyntaxError;},{}],47:[function(require,module,exports){'use strict';/** @type {import('./type')} */module.exports=TypeError;},{}],48:[function(require,module,exports){'use strict';/** @type {import('./uri')} */module.exports=URIError;},{}],49:[function(require,module,exports){'use strict';/** @type {import('.')} */module.exports=Object;},{}],50:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
574
574
|
//
|
|
575
575
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
576
576
|
// copy of this software and associated documentation files (the
|
|
@@ -619,7 +619,7 @@ for(i=listeners.length-1;i>=0;i--){this.removeListener(type,listeners[i]);}}retu
|
|
|
619
619
|
// EventEmitters, we do not listen for `error` events here.
|
|
620
620
|
emitter.addEventListener(name,function wrapListener(arg){// IE does not have builtin `{ once: true }` support so we
|
|
621
621
|
// have to do it manually.
|
|
622
|
-
if(flags.once){emitter.removeEventListener(name,wrapListener);}listener(arg);});}else{throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof emitter);}}},{}],
|
|
622
|
+
if(flags.once){emitter.removeEventListener(name,wrapListener);}listener(arg);});}else{throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof emitter);}}},{}],51:[function(require,module,exports){module.exports={"name":"fable-log","version":"3.0.16","description":"A simple logging wrapper.","main":"source/Fable-Log.js","scripts":{"start":"node source/Fable-Log.js","coverage":"./node_modules/.bin/nyc --reporter=lcov --reporter=text-lcov ./node_modules/mocha/bin/_mocha -- -u tdd -R spec","test":"./node_modules/.bin/mocha -u tdd -R spec","tests":"npx mocha -u tdd --exit -R spec --grep"},"mocha":{"diff":true,"extension":["js"],"package":"./package.json","reporter":"spec","slow":"75","timeout":"5000","ui":"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},"browser":{"./source/Fable-Log-DefaultProviders-Node.js":"./source/Fable-Log-DefaultProviders-Web.js"},"repository":{"type":"git","url":"https://github.com/stevenvelozo/fable-log.git"},"keywords":["logging"],"author":"Steven Velozo <steven@velozo.com> (http://velozo.com/)","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/fable-log/issues"},"homepage":"https://github.com/stevenvelozo/fable-log","devDependencies":{"quackage":"^1.0.33"},"dependencies":{"fable-serviceproviderbase":"^3.0.15"}};},{}],52:[function(require,module,exports){/**
|
|
623
623
|
* Base Logger Class
|
|
624
624
|
*
|
|
625
625
|
*
|
|
@@ -635,18 +635,18 @@ generateInsecureUUID(){let tmpDate=new Date().getTime();let tmpUUID='LOGSTREAM-x
|
|
|
635
635
|
// ..but good enough for unique log stream identifiers
|
|
636
636
|
let tmpRandomData=(tmpDate+Math.random()*16)%16|0;tmpDate=Math.floor(tmpDate/16);return(pCharacter=='x'?tmpRandomData:tmpRandomData&0x3|0x8).toString(16);});return tmpUUID;}initialize(){// No operation.
|
|
637
637
|
}trace(pLogText,pLogObject){this.write("trace",pLogText,pLogObject);}debug(pLogText,pLogObject){this.write("debug",pLogText,pLogObject);}info(pLogText,pLogObject){this.write("info",pLogText,pLogObject);}warn(pLogText,pLogObject){this.write("warn",pLogText,pLogObject);}error(pLogText,pLogObject){this.write("error",pLogText,pLogObject);}fatal(pLogText,pLogObject){this.write("fatal",pLogText,pLogObject);}write(pLogLevel,pLogText,pLogObject){// The base logger does nothing.
|
|
638
|
-
return true;}}module.exports=BaseLogger;},{"fable-serviceproviderbase":
|
|
638
|
+
return true;}}module.exports=BaseLogger;},{"fable-serviceproviderbase":59}],53:[function(require,module,exports){/**
|
|
639
639
|
* Default Logger Provider Function
|
|
640
640
|
*
|
|
641
641
|
*
|
|
642
642
|
* @author Steven Velozo <steven@velozo.com>
|
|
643
|
-
|
|
644
|
-
var getDefaultProviders=()=>{let tmpDefaultProviders={};tmpDefaultProviders.console=require('./Fable-Log-Logger-Console.js');tmpDefaultProviders.default=tmpDefaultProviders.console;return tmpDefaultProviders;};module.exports=getDefaultProviders();},{"./Fable-Log-Logger-Console.js":
|
|
643
|
+
*/// Return the providers that are available without extensions loaded
|
|
644
|
+
var getDefaultProviders=()=>{let tmpDefaultProviders={};tmpDefaultProviders.console=require('./Fable-Log-Logger-Console.js');tmpDefaultProviders.default=tmpDefaultProviders.console;return tmpDefaultProviders;};module.exports=getDefaultProviders();},{"./Fable-Log-Logger-Console.js":55}],54:[function(require,module,exports){module.exports=[{"loggertype":"console","streamtype":"console","level":"trace"}];},{}],55:[function(require,module,exports){let libBaseLogger=require('./Fable-Log-BaseLogger.js');class ConsoleLogger extends libBaseLogger{constructor(pLogStreamSettings,pFableLog){super(pLogStreamSettings);this._ShowTimeStamps='showtimestamps'in this._Settings?this._Settings.showtimestamps==true:true;this._FormattedTimeStamps='formattedtimestamps'in this._Settings?this._Settings.formattedtimestamps==true:true;this._ContextMessage='Context'in this._Settings?`(${this._Settings.Context})`:'Product'in pFableLog._Settings?`(${pFableLog._Settings.Product})`:'Unnamed_Log_Context';// Allow the user to decide what gets output to the console
|
|
645
645
|
this._OutputLogLinesToConsole='outputloglinestoconsole'in this._Settings?this._Settings.outputloglinestoconsole:true;this._OutputObjectsToConsole='outputobjectstoconsole'in this._Settings?this._Settings.outputobjectstoconsole:true;// Precompute the prefix for each level
|
|
646
646
|
this.prefixCache={};for(let i=0;i<=this.levels.length;i++){this.prefixCache[this.levels[i]]=`[${this.levels[i]}] ${this._ContextMessage}: `;if(this._ShowTimeStamps){// If there is a timestamp we need a to prepend space before the prefixcache string, since the timestamp comes first
|
|
647
647
|
this.prefixCache[this.levels[i]]=' '+this.prefixCache[this.levels[i]];}}}write(pLevel,pLogText,pObject){let tmpTimeStamp='';if(this._ShowTimeStamps&&this._FormattedTimeStamps){tmpTimeStamp=new Date().toISOString();}else if(this._ShowTimeStamps){tmpTimeStamp=+new Date();}let tmpLogLine=`${tmpTimeStamp}${this.prefixCache[pLevel]}${pLogText}`;if(this._OutputLogLinesToConsole){console.log(tmpLogLine);}// Write out the object on a separate line if it is passed in
|
|
648
648
|
if(this._OutputObjectsToConsole&&typeof pObject!=='undefined'){console.log(JSON.stringify(pObject,null,2));}// Provide an easy way to be overridden and be consistent
|
|
649
|
-
return tmpLogLine;}}module.exports=ConsoleLogger;},{"./Fable-Log-BaseLogger.js":
|
|
649
|
+
return tmpLogLine;}}module.exports=ConsoleLogger;},{"./Fable-Log-BaseLogger.js":52}],56:[function(require,module,exports){const libConsoleLog=require('./Fable-Log-Logger-Console.js');const libFS=require('fs');const libPath=require('path');class SimpleFlatFileLogger extends libConsoleLog{constructor(pLogStreamSettings,pFableLog){super(pLogStreamSettings,pFableLog);// If a path isn't provided for the logfile, it tries to use the ProductName or Context
|
|
650
650
|
this.logFileRawPath=this._Settings.hasOwnProperty('path')?this._Settings.path:`./${this._ContextMessage}.log`;this.logFilePath=libPath.normalize(this.logFileRawPath);this.logFileStreamOptions=this._Settings.hasOwnProperty('fileStreamoptions')?this._Settings.fileStreamOptions:{"flags":"a","encoding":"utf8"};this.fileWriter=libFS.createWriteStream(this.logFilePath,this.logFileStreamOptions);this.activelyWriting=false;this.logLineStrings=[];this.logObjectStrings=[];this.defaultWriteCompleteCallback=()=>{};this.defaultBufferFlushCallback=()=>{};}closeWriter(fCloseComplete){let tmpCloseComplete=typeof fCloseComplete=='function'?fCloseComplete:()=>{};if(this.fileWriter){this.fileWriter.end('\n');return this.fileWriter.once('finish',tmpCloseComplete.bind(this));}}completeBufferFlushToLogFile(fFlushComplete){this.activelyWriting=false;let tmpFlushComplete=typeof fFlushComplete=='function'?fFlushComplete:this.defaultBufferFlushCallback;if(this.logLineStrings.length>0){this.flushBufferToLogFile(tmpFlushComplete);}else{return tmpFlushComplete();}}flushBufferToLogFile(fFlushComplete){if(!this.activelyWriting){// Only want to be writing one thing at a time....
|
|
651
651
|
this.activelyWriting=true;let tmpFlushComplete=typeof fFlushComplete=='function'?fFlushComplete:this.defaultBufferFlushCallback;// Get the current buffer arrays. These should always have matching number of elements.
|
|
652
652
|
let tmpLineStrings=this.logLineStrings;let tmpObjectStrings=this.logObjectStrings;// Reset these to be filled while we process this queue...
|
|
@@ -655,7 +655,7 @@ let tmpConstructedBufferOutputString='';for(let i=0;i<tmpLineStrings.length;i++)
|
|
|
655
655
|
tmpConstructedBufferOutputString+=`${tmpLineStrings[i]}\n`;if(tmpObjectStrings[i]!==false){tmpConstructedBufferOutputString+=`${tmpObjectStrings[i]}\n`;}}if(!this.fileWriter.write(tmpConstructedBufferOutputString,'utf8')){// If the streamwriter returns false, we need to wait for it to drain.
|
|
656
656
|
this.fileWriter.once('drain',this.completeBufferFlushToLogFile.bind(this,tmpFlushComplete));}else{return this.completeBufferFlushToLogFile(tmpFlushComplete);}}}write(pLevel,pLogText,pObject){let tmpLogLine=super.write(pLevel,pLogText,pObject);// Use a very simple array as the write buffer
|
|
657
657
|
this.logLineStrings.push(tmpLogLine);// Write out the object on a separate line if it is passed in
|
|
658
|
-
if(typeof pObject!=='undefined'){this.logObjectStrings.push(JSON.stringify(pObject,null,4));}else{this.logObjectStrings.push(false);}this.flushBufferToLogFile();}}module.exports=SimpleFlatFileLogger;},{"./Fable-Log-Logger-Console.js":
|
|
658
|
+
if(typeof pObject!=='undefined'){this.logObjectStrings.push(JSON.stringify(pObject,null,4));}else{this.logObjectStrings.push(false);}this.flushBufferToLogFile();}}module.exports=SimpleFlatFileLogger;},{"./Fable-Log-Logger-Console.js":55,"fs":19,"path":103}],57:[function(require,module,exports){/**
|
|
659
659
|
* Fable Logging Service
|
|
660
660
|
*/const libFableServiceProviderBase=require('fable-serviceproviderbase').CoreServiceProviderBase;const libPackage=require('../package.json');class FableLog extends libFableServiceProviderBase{constructor(pSettings,pServiceHash){super(pSettings,pServiceHash);this.serviceType='Logging';/** @type {Object} */this._Package=libPackage;let tmpSettings=typeof pSettings==='object'?pSettings:{};this._Settings=tmpSettings;this._Providers=require('./Fable-Log-DefaultProviders-Node.js');this._StreamDefinitions='LogStreams'in tmpSettings?tmpSettings.LogStreams:require('./Fable-Log-DefaultStreams.json');this.logStreams=[];// This object gets decorated for one-time instantiated providers that
|
|
661
661
|
// have multiple outputs, such as bunyan.
|
|
@@ -667,7 +667,7 @@ switch(pLevel){case'trace':this.logStreamsTrace.push(pLogger);case'debug':this.l
|
|
|
667
667
|
for(let i=0;i<this._StreamDefinitions.length;i++){let tmpStreamDefinition=Object.assign({loggertype:'default',streamtype:'console',level:'info'},this._StreamDefinitions[i]);if(!(tmpStreamDefinition.loggertype in this._Providers)){console.log(`Error initializing log stream: bad loggertype in stream definition ${JSON.stringify(tmpStreamDefinition)}`);}else{this.addLogger(new this._Providers[tmpStreamDefinition.loggertype](tmpStreamDefinition,this),tmpStreamDefinition.level);}}// Now initialize each one.
|
|
668
668
|
for(let i=0;i<this.logStreams.length;i++){this.logStreams[i].initialize();}}logTime(pMessage,pDatum){let tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time';let tmpTime=new Date();this.info(`${tmpMessage} ${tmpTime} (epoch ${+tmpTime})`,pDatum);}// Get a timestamp
|
|
669
669
|
getTimeStamp(){return+new Date();}getTimeDelta(pTimeStamp){let tmpEndTime=+new Date();return tmpEndTime-pTimeStamp;}// Log the delta between a timestamp, and now with a message
|
|
670
|
-
logTimeDelta(pTimeDelta,pMessage,pDatum){let tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time Measurement';let tmpDatum=typeof pDatum==='object'?pDatum:{};let tmpEndTime=+new Date();this.info(`${tmpMessage} logged at (epoch ${+tmpEndTime}) took (${pTimeDelta}ms)`,pDatum);}logTimeDeltaHuman(pTimeDelta,pMessage,pDatum){let tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time Measurement';let tmpEndTime=+new Date();let tmpMs=parseInt(pTimeDelta%1000);let tmpSeconds=parseInt(pTimeDelta/1000%60);let tmpMinutes=parseInt(pTimeDelta/(1000*60)%60);let tmpHours=parseInt(pTimeDelta/(1000*60*60));tmpMs=tmpMs<10?"00"+tmpMs:tmpMs<100?"0"+tmpMs:tmpMs;tmpSeconds=tmpSeconds<10?"0"+tmpSeconds:tmpSeconds;tmpMinutes=tmpMinutes<10?"0"+tmpMinutes:tmpMinutes;tmpHours=tmpHours<10?"0"+tmpHours:tmpHours;this.info(`${tmpMessage} logged at (epoch ${+tmpEndTime}) took (${pTimeDelta}ms) or (${tmpHours}:${tmpMinutes}:${tmpSeconds}.${tmpMs})`,pDatum);}logTimeDeltaRelative(pStartTime,pMessage,pDatum){this.logTimeDelta(this.getTimeDelta(pStartTime),pMessage,pDatum);}logTimeDeltaRelativeHuman(pStartTime,pMessage,pDatum){this.logTimeDeltaHuman(this.getTimeDelta(pStartTime),pMessage,pDatum);}}module.exports=FableLog;module.exports.LogProviderBase=require('./Fable-Log-BaseLogger.js');module.exports.LogProviderConsole=require('./Fable-Log-Logger-Console.js');module.exports.LogProviderFlatfile=require('./Fable-Log-Logger-SimpleFlatFile.js');},{"../package.json":
|
|
670
|
+
logTimeDelta(pTimeDelta,pMessage,pDatum){let tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time Measurement';let tmpDatum=typeof pDatum==='object'?pDatum:{};let tmpEndTime=+new Date();this.info(`${tmpMessage} logged at (epoch ${+tmpEndTime}) took (${pTimeDelta}ms)`,pDatum);}logTimeDeltaHuman(pTimeDelta,pMessage,pDatum){let tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time Measurement';let tmpEndTime=+new Date();let tmpMs=parseInt(pTimeDelta%1000);let tmpSeconds=parseInt(pTimeDelta/1000%60);let tmpMinutes=parseInt(pTimeDelta/(1000*60)%60);let tmpHours=parseInt(pTimeDelta/(1000*60*60));tmpMs=tmpMs<10?"00"+tmpMs:tmpMs<100?"0"+tmpMs:tmpMs;tmpSeconds=tmpSeconds<10?"0"+tmpSeconds:tmpSeconds;tmpMinutes=tmpMinutes<10?"0"+tmpMinutes:tmpMinutes;tmpHours=tmpHours<10?"0"+tmpHours:tmpHours;this.info(`${tmpMessage} logged at (epoch ${+tmpEndTime}) took (${pTimeDelta}ms) or (${tmpHours}:${tmpMinutes}:${tmpSeconds}.${tmpMs})`,pDatum);}logTimeDeltaRelative(pStartTime,pMessage,pDatum){this.logTimeDelta(this.getTimeDelta(pStartTime),pMessage,pDatum);}logTimeDeltaRelativeHuman(pStartTime,pMessage,pDatum){this.logTimeDeltaHuman(this.getTimeDelta(pStartTime),pMessage,pDatum);}}module.exports=FableLog;module.exports.LogProviderBase=require('./Fable-Log-BaseLogger.js');module.exports.LogProviderConsole=require('./Fable-Log-Logger-Console.js');module.exports.LogProviderFlatfile=require('./Fable-Log-Logger-SimpleFlatFile.js');},{"../package.json":51,"./Fable-Log-BaseLogger.js":52,"./Fable-Log-DefaultProviders-Node.js":53,"./Fable-Log-DefaultStreams.json":54,"./Fable-Log-Logger-Console.js":55,"./Fable-Log-Logger-SimpleFlatFile.js":56,"fable-serviceproviderbase":59}],58:[function(require,module,exports){module.exports={"name":"fable-serviceproviderbase","version":"3.0.15","description":"Simple base classes for fable services.","main":"source/Fable-ServiceProviderBase.js","scripts":{"start":"node source/Fable-ServiceProviderBase.js","test":"npx mocha -u tdd -R spec","tests":"npx mocha -u tdd --exit -R spec --grep","coverage":"npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec","build":"npx quack build"},"mocha":{"diff":true,"extension":["js"],"package":"./package.json","reporter":"spec","slow":"75","timeout":"5000","ui":"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},"repository":{"type":"git","url":"https://github.com/stevenvelozo/fable-serviceproviderbase.git"},"keywords":["entity","behavior"],"author":"Steven Velozo <steven@velozo.com> (http://velozo.com/)","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/fable-serviceproviderbase/issues"},"homepage":"https://github.com/stevenvelozo/fable-serviceproviderbase","devDependencies":{"fable":"^3.0.143","quackage":"^1.0.33"}};},{}],59:[function(require,module,exports){/**
|
|
671
671
|
* Fable Service Base
|
|
672
672
|
* @author <steven@velozo.com>
|
|
673
673
|
*/const libPackage=require('../package.json');class FableServiceProviderBase{// The constructor can be used in two ways:
|
|
@@ -681,7 +681,7 @@ if(this.fable){this.UUID=pFable.getUUID();this.options=typeof pOptions==='object
|
|
|
681
681
|
this.options=typeof pFable==='object'&&!pFable.isFable?pFable:typeof pOptions==='object'?pOptions:{};this.UUID=`CORE-SVC-${Math.floor(Math.random()*(99999-10000)+10000)}`;}// It's expected that the deriving class will set this
|
|
682
682
|
this.serviceType=`Unknown-${this.UUID}`;// The service hash is used to identify the specific instantiation of the service in the services map
|
|
683
683
|
this.Hash=typeof pServiceHash==='string'?pServiceHash:!this.fable&&typeof pOptions==='string'?pOptions:`${this.UUID}`;}connectFable(pFable){if(typeof pFable!=='object'||!pFable.isFable){let tmpErrorMessage=`Fable Service Provider Base: Cannot connect to Fable, invalid Fable object passed in. The pFable parameter was a [${typeof pFable}].}`;console.log(tmpErrorMessage);return new Error(tmpErrorMessage);}if(!this.fable){this.fable=pFable;}if(!this.log){this.log=this.fable.Logging;}if(!this.services){this.services=this.fable.services;}if(!this.servicesMap){this.servicesMap=this.fable.servicesMap;}return true;}}_defineProperty2(FableServiceProviderBase,"isFableService",true);module.exports=FableServiceProviderBase;// This is left here in case we want to go back to having different code/base class for "core" services
|
|
684
|
-
module.exports.CoreServiceProviderBase=FableServiceProviderBase;},{"../package.json":
|
|
684
|
+
module.exports.CoreServiceProviderBase=FableServiceProviderBase;},{"../package.json":58}],60:[function(require,module,exports){module.exports={"name":"fable-settings","version":"3.0.12","description":"A simple, tolerant configuration chain.","main":"source/Fable-Settings.js","scripts":{"start":"node source/Fable-Settings.js","coverage":"./node_modules/.bin/nyc --reporter=lcov --reporter=text-lcov ./node_modules/mocha/bin/_mocha -- -u tdd -R spec","test":"./node_modules/.bin/mocha -u tdd -R spec","build":"./node_modules/.bin/gulp build","docker-dev-build-image":"docker build ./ -f Dockerfile_LUXURYCode -t retold/fable-settings:local","docker-dev-run":"docker run -it -d --name retold-fable-settings-dev -p 30003:8080 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/fable-settings\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" retold/fable-settings:local"},"mocha":{"diff":true,"extension":["js"],"package":"./package.json","reporter":"spec","slow":"75","timeout":"5000","ui":"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},"repository":{"type":"git","url":"https://github.com/stevenvelozo/fable-settings.git"},"keywords":["configuration"],"author":"Steven Velozo <steven@velozo.com> (http://velozo.com/)","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/fable-settings/issues"},"homepage":"https://github.com/stevenvelozo/fable-settings","devDependencies":{"quackage":"^1.0.33"},"dependencies":{"fable-serviceproviderbase":"^3.0.15","precedent":"^1.0.15"}};},{}],61:[function(require,module,exports){module.exports={"Product":"ApplicationNameHere","ProductVersion":"0.0.0","ConfigFile":false,"LogStreams":[{"level":"trace"}]};},{}],62:[function(require,module,exports){(function(process){(function(){/**
|
|
685
685
|
* Fable Settings Template Processor
|
|
686
686
|
*
|
|
687
687
|
* This class allows environment variables to come in via templated expressions, and defaults to be set.
|
|
@@ -691,7 +691,7 @@ module.exports.CoreServiceProviderBase=FableServiceProviderBase;},{"../package.j
|
|
|
691
691
|
* @module Fable Settings
|
|
692
692
|
*/const libPrecedent=require('precedent');class FableSettingsTemplateProcessor{constructor(pDependencies){// Use a no-dependencies templating engine to parse out environment variables
|
|
693
693
|
this.templateProcessor=new libPrecedent();// TODO: Make the environment variable wrap expression demarcation characters configurable?
|
|
694
|
-
this.templateProcessor.addPattern('${','}',pTemplateValue=>{let tmpTemplateValue=pTemplateValue.trim();let tmpSeparatorIndex=tmpTemplateValue.indexOf('|');const tmpDefaultValue=tmpSeparatorIndex>=0?tmpTemplateValue.substring(tmpSeparatorIndex+1):'';let tmpEnvironmentVariableName=tmpSeparatorIndex>-1?tmpTemplateValue.substring(0,tmpSeparatorIndex):tmpTemplateValue;if(tmpEnvironmentVariableName in process.env){return process.env[tmpEnvironmentVariableName];}else{return tmpDefaultValue;}});}parseSetting(pString){return this.templateProcessor.parseString(pString);}}module.exports=FableSettingsTemplateProcessor;}).call(this);}).call(this,require('_process'));},{"_process":
|
|
694
|
+
this.templateProcessor.addPattern('${','}',pTemplateValue=>{let tmpTemplateValue=pTemplateValue.trim();let tmpSeparatorIndex=tmpTemplateValue.indexOf('|');const tmpDefaultValue=tmpSeparatorIndex>=0?tmpTemplateValue.substring(tmpSeparatorIndex+1):'';let tmpEnvironmentVariableName=tmpSeparatorIndex>-1?tmpTemplateValue.substring(0,tmpSeparatorIndex):tmpTemplateValue;if(tmpEnvironmentVariableName in process.env){return process.env[tmpEnvironmentVariableName];}else{return tmpDefaultValue;}});}parseSetting(pString){return this.templateProcessor.parseString(pString);}}module.exports=FableSettingsTemplateProcessor;}).call(this);}).call(this,require('_process'));},{"_process":107,"precedent":104}],63:[function(require,module,exports){/**
|
|
695
695
|
* Fable Settings Add-on
|
|
696
696
|
*
|
|
697
697
|
*
|
|
@@ -725,12 +725,12 @@ this._configureEnvTemplating(tmpSettingsTo);return tmpSettingsTo;}// Fill in set
|
|
|
725
725
|
fill(pSettingsFrom){// If an invalid settings from object is passed in (e.g. object constructor without passing in anything) this should still work
|
|
726
726
|
let tmpSettingsFrom=typeof pSettingsFrom==='object'?pSettingsFrom:{};// do not mutate the From object property values
|
|
727
727
|
let tmpSettingsFromCopy=JSON.parse(JSON.stringify(tmpSettingsFrom));this.settings=this._deepMergeObjects(tmpSettingsFromCopy,this.settings);return this.settings;}};// This is for backwards compatibility
|
|
728
|
-
function autoConstruct(pSettings){return new FableSettings(pSettings);}module.exports=FableSettings;module.exports.new=autoConstruct;},{"../package.json":
|
|
728
|
+
function autoConstruct(pSettings){return new FableSettings(pSettings);}module.exports=FableSettings;module.exports.new=autoConstruct;},{"../package.json":60,"./Fable-Settings-Default":61,"./Fable-Settings-TemplateProcessor.js":62,"fable-serviceproviderbase":59}],64:[function(require,module,exports){module.exports={"name":"fable-uuid","version":"3.0.11","description":"A simple UUID Generator.","main":"source/Fable-UUID.js","scripts":{"start":"node source/Fable-UUID.js","coverage":"./node_modules/.bin/nyc --reporter=lcov --reporter=text-lcov ./node_modules/mocha/bin/_mocha -- -u tdd -R spec","test":"./node_modules/.bin/mocha -u tdd -R spec","build":"./node_modules/.bin/gulp build","docker-dev-build-image":"docker build ./ -f Dockerfile_LUXURYCode -t retold/fable-uuid:local","docker-dev-run":"docker run -it -d --name retold-fable-uuid-dev -p 30002:8080 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/fable-uuid\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" retold/fable-uuid:local"},"mocha":{"diff":true,"extension":["js"],"package":"./package.json","reporter":"spec","slow":"75","timeout":"5000","ui":"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},"repository":{"type":"git","url":"https://github.com/stevenvelozo/fable-uuid.git"},"keywords":["logging"],"author":"Steven Velozo <steven@velozo.com> (http://velozo.com/)","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/fable-uuid/issues"},"browser":{"./source/Fable-UUID-Random.js":"./source/Fable-UUID-Random-Browser.js"},"homepage":"https://github.com/stevenvelozo/fable-uuid","devDependencies":{"quackage":"^1.0.33"},"dependencies":{"fable-serviceproviderbase":"^3.0.15"}};},{}],65:[function(require,module,exports){/**
|
|
729
729
|
* Random Byte Generator - Browser version
|
|
730
730
|
*
|
|
731
731
|
*
|
|
732
732
|
* @author Steven Velozo <steven@velozo.com>
|
|
733
|
-
|
|
733
|
+
*/// Adapted from node-uuid (https://github.com/kelektiv/node-uuid)
|
|
734
734
|
// Unique ID creation requires a high quality random # generator. In the
|
|
735
735
|
// browser this is a little complicated due to unknown quality of Math.random()
|
|
736
736
|
// and inconsistent support for the `crypto` API. We do the best we can via
|
|
@@ -743,7 +743,7 @@ this.getRandomValues(tmpBuffer);return tmpBuffer;}// Math.random()-based (RNG)
|
|
|
743
743
|
generateRandomBytes(){// If all else fails, use Math.random(). It's fast, but is of unspecified
|
|
744
744
|
// quality.
|
|
745
745
|
let tmpBuffer=new Uint8Array(16);// eslint-disable-line no-undef
|
|
746
|
-
for(let i=0,tmpValue;i<16;i++){if((i&0x03)===0){tmpValue=Math.random()*0x100000000;}tmpBuffer[i]=tmpValue>>>((i&0x03)<<3)&0xff;}return tmpBuffer;}generate(){if(this.getRandomValues){return this.generateWhatWGBytes();}else{return this.generateRandomBytes();}}}module.exports=RandomBytes;},{}],
|
|
746
|
+
for(let i=0,tmpValue;i<16;i++){if((i&0x03)===0){tmpValue=Math.random()*0x100000000;}tmpBuffer[i]=tmpValue>>>((i&0x03)<<3)&0xff;}return tmpBuffer;}generate(){if(this.getRandomValues){return this.generateWhatWGBytes();}else{return this.generateRandomBytes();}}}module.exports=RandomBytes;},{}],66:[function(require,module,exports){/**
|
|
747
747
|
* Fable UUID Generator
|
|
748
748
|
*/const libFableServiceProviderBase=require('fable-serviceproviderbase').CoreServiceProviderBase;0;const libRandomByteGenerator=require('./Fable-UUID-Random.js');const libPackage=require('../package.json');class FableUUID extends libFableServiceProviderBase{constructor(pSettings,pServiceHash){super(pSettings,pServiceHash);this.serviceType='UUID';/** @type {Object} */this._Package=libPackage;// Determine if the module is in "Random UUID Mode" which means just use the random character function rather than the v4 random UUID spec.
|
|
749
749
|
// Note this allows UUIDs of various lengths (including very short ones) although guaranteed uniqueness goes downhill fast.
|
|
@@ -758,36 +758,35 @@ generateUUIDv4(){let tmpBuffer=new Array(16);var tmpRandomBytes=this.randomByteG
|
|
|
758
758
|
tmpRandomBytes[6]=tmpRandomBytes[6]&0x0f|0x40;tmpRandomBytes[8]=tmpRandomBytes[8]&0x3f|0x80;return this.bytesToUUID(tmpRandomBytes);}// Simple random UUID generation
|
|
759
759
|
generateRandom(){let tmpUUID='';for(let i=0;i<this._UUIDLength;i++){tmpUUID+=this._UUIDRandomDictionary.charAt(Math.floor(Math.random()*(this._UUIDRandomDictionary.length-1)));}return tmpUUID;}// Adapted from node-uuid (https://github.com/kelektiv/node-uuid)
|
|
760
760
|
getUUID(){if(this._UUIDModeRandom){return this.generateRandom();}else{return this.generateUUIDv4();}}}// This is for backwards compatibility
|
|
761
|
-
function autoConstruct(pSettings){return new FableUUID(pSettings);}module.exports=FableUUID;module.exports.new=autoConstruct;},{"../package.json":
|
|
762
|
-
var getEvalledConstructor=function(expressionSyntax){try{return $Function('"use strict"; return ('+expressionSyntax+').constructor;')();}catch(e){}};var $gOPD=
|
|
763
|
-
}}var throwTypeError=function(){throw new $TypeError();};var ThrowTypeError=$gOPD?function(){try{// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
|
|
761
|
+
function autoConstruct(pSettings){return new FableUUID(pSettings);}module.exports=FableUUID;module.exports.new=autoConstruct;},{"../package.json":64,"./Fable-UUID-Random.js":65,"fable-serviceproviderbase":59}],67:[function(require,module,exports){'use strict';/* eslint no-invalid-this: 1 */var ERROR_MESSAGE='Function.prototype.bind called on incompatible ';var toStr=Object.prototype.toString;var max=Math.max;var funcType='[object Function]';var concatty=function concatty(a,b){var arr=[];for(var i=0;i<a.length;i+=1){arr[i]=a[i];}for(var j=0;j<b.length;j+=1){arr[j+a.length]=b[j];}return arr;};var slicy=function slicy(arrLike,offset){var arr=[];for(var i=offset||0,j=0;i<arrLike.length;i+=1,j+=1){arr[j]=arrLike[i];}return arr;};var joiny=function(arr,joiner){var str='';for(var i=0;i<arr.length;i+=1){str+=arr[i];if(i+1<arr.length){str+=joiner;}}return str;};module.exports=function bind(that){var target=this;if(typeof target!=='function'||toStr.apply(target)!==funcType){throw new TypeError(ERROR_MESSAGE+target);}var args=slicy(arguments,1);var bound;var binder=function(){if(this instanceof bound){var result=target.apply(this,concatty(args,arguments));if(Object(result)===result){return result;}return this;}return target.apply(that,concatty(args,arguments));};var boundLength=max(0,target.length-args.length);var boundArgs=[];for(var i=0;i<boundLength;i++){boundArgs[i]='$'+i;}bound=Function('binder','return function ('+joiny(boundArgs,',')+'){ return binder.apply(this,arguments); }')(binder);if(target.prototype){var Empty=function Empty(){};Empty.prototype=target.prototype;bound.prototype=new Empty();Empty.prototype=null;}return bound;};},{}],68:[function(require,module,exports){'use strict';var implementation=require('./implementation');module.exports=Function.prototype.bind||implementation;},{"./implementation":67}],69:[function(require,module,exports){'use strict';var undefined;var $Object=require('es-object-atoms');var $Error=require('es-errors');var $EvalError=require('es-errors/eval');var $RangeError=require('es-errors/range');var $ReferenceError=require('es-errors/ref');var $SyntaxError=require('es-errors/syntax');var $TypeError=require('es-errors/type');var $URIError=require('es-errors/uri');var abs=require('math-intrinsics/abs');var floor=require('math-intrinsics/floor');var max=require('math-intrinsics/max');var min=require('math-intrinsics/min');var pow=require('math-intrinsics/pow');var round=require('math-intrinsics/round');var sign=require('math-intrinsics/sign');var $Function=Function;// eslint-disable-next-line consistent-return
|
|
762
|
+
var getEvalledConstructor=function(expressionSyntax){try{return $Function('"use strict"; return ('+expressionSyntax+').constructor;')();}catch(e){}};var $gOPD=require('gopd');var $defineProperty=require('es-define-property');var throwTypeError=function(){throw new $TypeError();};var ThrowTypeError=$gOPD?function(){try{// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
|
|
764
763
|
arguments.callee;// IE 8 does not throw here
|
|
765
764
|
return throwTypeError;}catch(calleeThrows){try{// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
|
|
766
|
-
return $gOPD(arguments,'callee').get;}catch(gOPDthrows){return throwTypeError;}}}():throwTypeError;var hasSymbols=require('has-symbols')();var
|
|
767
|
-
:
|
|
768
|
-
'%EvalError%':$EvalError,'%Float32Array%':typeof Float32Array==='undefined'?undefined:Float32Array,'%Float64Array%':typeof Float64Array==='undefined'?undefined:Float64Array,'%FinalizationRegistry%':typeof FinalizationRegistry==='undefined'?undefined:FinalizationRegistry,'%Function%':$Function,'%GeneratorFunction%':needsEval,'%Int8Array%':typeof Int8Array==='undefined'?undefined:Int8Array,'%Int16Array%':typeof Int16Array==='undefined'?undefined:Int16Array,'%Int32Array%':typeof Int32Array==='undefined'?undefined:Int32Array,'%isFinite%':isFinite,'%isNaN%':isNaN,'%IteratorPrototype%':hasSymbols&&getProto?getProto(getProto([][Symbol.iterator]())):undefined,'%JSON%':typeof JSON==='object'?JSON:undefined,'%Map%':typeof Map==='undefined'?undefined:Map,'%MapIteratorPrototype%':typeof Map==='undefined'||!hasSymbols||!getProto?undefined:getProto(new Map()[Symbol.iterator]()),'%Math%':Math,'%Number%':Number,'%Object%':Object,'%parseFloat%':parseFloat,'%parseInt%':parseInt,'%Promise%':typeof Promise==='undefined'?undefined:Promise,'%Proxy%':typeof Proxy==='undefined'?undefined:Proxy,'%RangeError%':$RangeError,'%ReferenceError%':$ReferenceError,'%Reflect%':typeof Reflect==='undefined'?undefined:Reflect,'%RegExp%':RegExp,'%Set%':typeof Set==='undefined'?undefined:Set,'%SetIteratorPrototype%':typeof Set==='undefined'||!hasSymbols||!getProto?undefined:getProto(new Set()[Symbol.iterator]()),'%SharedArrayBuffer%':typeof SharedArrayBuffer==='undefined'?undefined:SharedArrayBuffer,'%String%':String,'%StringIteratorPrototype%':hasSymbols&&getProto?getProto(''[Symbol.iterator]()):undefined,'%Symbol%':hasSymbols?Symbol:undefined,'%SyntaxError%':$SyntaxError,'%ThrowTypeError%':ThrowTypeError,'%TypedArray%':TypedArray,'%TypeError%':$TypeError,'%Uint8Array%':typeof Uint8Array==='undefined'?undefined:Uint8Array,'%Uint8ClampedArray%':typeof Uint8ClampedArray==='undefined'?undefined:Uint8ClampedArray,'%Uint16Array%':typeof Uint16Array==='undefined'?undefined:Uint16Array,'%Uint32Array%':typeof Uint32Array==='undefined'?undefined:Uint32Array,'%URIError%':$URIError,'%WeakMap%':typeof WeakMap==='undefined'?undefined:WeakMap,'%WeakRef%':typeof WeakRef==='undefined'?undefined:WeakRef,'%WeakSet%':typeof WeakSet==='undefined'?undefined:WeakSet};if(getProto){try{null.error;// eslint-disable-line no-unused-expressions
|
|
765
|
+
return $gOPD(arguments,'callee').get;}catch(gOPDthrows){return throwTypeError;}}}():throwTypeError;var hasSymbols=require('has-symbols')();var getProto=require('get-proto');var $ObjectGPO=require('get-proto/Object.getPrototypeOf');var $ReflectGPO=require('get-proto/Reflect.getPrototypeOf');var $apply=require('call-bind-apply-helpers/functionApply');var $call=require('call-bind-apply-helpers/functionCall');var needsEval={};var TypedArray=typeof Uint8Array==='undefined'||!getProto?undefined:getProto(Uint8Array);var INTRINSICS={__proto__:null,'%AggregateError%':typeof AggregateError==='undefined'?undefined:AggregateError,'%Array%':Array,'%ArrayBuffer%':typeof ArrayBuffer==='undefined'?undefined:ArrayBuffer,'%ArrayIteratorPrototype%':hasSymbols&&getProto?getProto([][Symbol.iterator]()):undefined,'%AsyncFromSyncIteratorPrototype%':undefined,'%AsyncFunction%':needsEval,'%AsyncGenerator%':needsEval,'%AsyncGeneratorFunction%':needsEval,'%AsyncIteratorPrototype%':needsEval,'%Atomics%':typeof Atomics==='undefined'?undefined:Atomics,'%BigInt%':typeof BigInt==='undefined'?undefined:BigInt,'%BigInt64Array%':typeof BigInt64Array==='undefined'?undefined:BigInt64Array,'%BigUint64Array%':typeof BigUint64Array==='undefined'?undefined:BigUint64Array,'%Boolean%':Boolean,'%DataView%':typeof DataView==='undefined'?undefined:DataView,'%Date%':Date,'%decodeURI%':decodeURI,'%decodeURIComponent%':decodeURIComponent,'%encodeURI%':encodeURI,'%encodeURIComponent%':encodeURIComponent,'%Error%':$Error,'%eval%':eval,// eslint-disable-line no-eval
|
|
766
|
+
'%EvalError%':$EvalError,'%Float16Array%':typeof Float16Array==='undefined'?undefined:Float16Array,'%Float32Array%':typeof Float32Array==='undefined'?undefined:Float32Array,'%Float64Array%':typeof Float64Array==='undefined'?undefined:Float64Array,'%FinalizationRegistry%':typeof FinalizationRegistry==='undefined'?undefined:FinalizationRegistry,'%Function%':$Function,'%GeneratorFunction%':needsEval,'%Int8Array%':typeof Int8Array==='undefined'?undefined:Int8Array,'%Int16Array%':typeof Int16Array==='undefined'?undefined:Int16Array,'%Int32Array%':typeof Int32Array==='undefined'?undefined:Int32Array,'%isFinite%':isFinite,'%isNaN%':isNaN,'%IteratorPrototype%':hasSymbols&&getProto?getProto(getProto([][Symbol.iterator]())):undefined,'%JSON%':typeof JSON==='object'?JSON:undefined,'%Map%':typeof Map==='undefined'?undefined:Map,'%MapIteratorPrototype%':typeof Map==='undefined'||!hasSymbols||!getProto?undefined:getProto(new Map()[Symbol.iterator]()),'%Math%':Math,'%Number%':Number,'%Object%':$Object,'%Object.getOwnPropertyDescriptor%':$gOPD,'%parseFloat%':parseFloat,'%parseInt%':parseInt,'%Promise%':typeof Promise==='undefined'?undefined:Promise,'%Proxy%':typeof Proxy==='undefined'?undefined:Proxy,'%RangeError%':$RangeError,'%ReferenceError%':$ReferenceError,'%Reflect%':typeof Reflect==='undefined'?undefined:Reflect,'%RegExp%':RegExp,'%Set%':typeof Set==='undefined'?undefined:Set,'%SetIteratorPrototype%':typeof Set==='undefined'||!hasSymbols||!getProto?undefined:getProto(new Set()[Symbol.iterator]()),'%SharedArrayBuffer%':typeof SharedArrayBuffer==='undefined'?undefined:SharedArrayBuffer,'%String%':String,'%StringIteratorPrototype%':hasSymbols&&getProto?getProto(''[Symbol.iterator]()):undefined,'%Symbol%':hasSymbols?Symbol:undefined,'%SyntaxError%':$SyntaxError,'%ThrowTypeError%':ThrowTypeError,'%TypedArray%':TypedArray,'%TypeError%':$TypeError,'%Uint8Array%':typeof Uint8Array==='undefined'?undefined:Uint8Array,'%Uint8ClampedArray%':typeof Uint8ClampedArray==='undefined'?undefined:Uint8ClampedArray,'%Uint16Array%':typeof Uint16Array==='undefined'?undefined:Uint16Array,'%Uint32Array%':typeof Uint32Array==='undefined'?undefined:Uint32Array,'%URIError%':$URIError,'%WeakMap%':typeof WeakMap==='undefined'?undefined:WeakMap,'%WeakRef%':typeof WeakRef==='undefined'?undefined:WeakRef,'%WeakSet%':typeof WeakSet==='undefined'?undefined:WeakSet,'%Function.prototype.call%':$call,'%Function.prototype.apply%':$apply,'%Object.defineProperty%':$defineProperty,'%Object.getPrototypeOf%':$ObjectGPO,'%Math.abs%':abs,'%Math.floor%':floor,'%Math.max%':max,'%Math.min%':min,'%Math.pow%':pow,'%Math.round%':round,'%Math.sign%':sign,'%Reflect.getPrototypeOf%':$ReflectGPO};if(getProto){try{null.error;// eslint-disable-line no-unused-expressions
|
|
769
767
|
}catch(e){// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
|
|
770
|
-
var errorProto=getProto(getProto(e));INTRINSICS['%Error.prototype%']=errorProto;}}var doEval=function doEval(name){var value;if(name==='%AsyncFunction%'){value=getEvalledConstructor('async function () {}');}else if(name==='%GeneratorFunction%'){value=getEvalledConstructor('function* () {}');}else if(name==='%AsyncGeneratorFunction%'){value=getEvalledConstructor('async function* () {}');}else if(name==='%AsyncGenerator%'){var fn=doEval('%AsyncGeneratorFunction%');if(fn){value=fn.prototype;}}else if(name==='%AsyncIteratorPrototype%'){var gen=doEval('%AsyncGenerator%');if(gen&&getProto){value=getProto(gen.prototype);}}INTRINSICS[name]=value;return value;};var LEGACY_ALIASES={__proto__:null,'%ArrayBufferPrototype%':['ArrayBuffer','prototype'],'%ArrayPrototype%':['Array','prototype'],'%ArrayProto_entries%':['Array','prototype','entries'],'%ArrayProto_forEach%':['Array','prototype','forEach'],'%ArrayProto_keys%':['Array','prototype','keys'],'%ArrayProto_values%':['Array','prototype','values'],'%AsyncFunctionPrototype%':['AsyncFunction','prototype'],'%AsyncGenerator%':['AsyncGeneratorFunction','prototype'],'%AsyncGeneratorPrototype%':['AsyncGeneratorFunction','prototype','prototype'],'%BooleanPrototype%':['Boolean','prototype'],'%DataViewPrototype%':['DataView','prototype'],'%DatePrototype%':['Date','prototype'],'%ErrorPrototype%':['Error','prototype'],'%EvalErrorPrototype%':['EvalError','prototype'],'%Float32ArrayPrototype%':['Float32Array','prototype'],'%Float64ArrayPrototype%':['Float64Array','prototype'],'%FunctionPrototype%':['Function','prototype'],'%Generator%':['GeneratorFunction','prototype'],'%GeneratorPrototype%':['GeneratorFunction','prototype','prototype'],'%Int8ArrayPrototype%':['Int8Array','prototype'],'%Int16ArrayPrototype%':['Int16Array','prototype'],'%Int32ArrayPrototype%':['Int32Array','prototype'],'%JSONParse%':['JSON','parse'],'%JSONStringify%':['JSON','stringify'],'%MapPrototype%':['Map','prototype'],'%NumberPrototype%':['Number','prototype'],'%ObjectPrototype%':['Object','prototype'],'%ObjProto_toString%':['Object','prototype','toString'],'%ObjProto_valueOf%':['Object','prototype','valueOf'],'%PromisePrototype%':['Promise','prototype'],'%PromiseProto_then%':['Promise','prototype','then'],'%Promise_all%':['Promise','all'],'%Promise_reject%':['Promise','reject'],'%Promise_resolve%':['Promise','resolve'],'%RangeErrorPrototype%':['RangeError','prototype'],'%ReferenceErrorPrototype%':['ReferenceError','prototype'],'%RegExpPrototype%':['RegExp','prototype'],'%SetPrototype%':['Set','prototype'],'%SharedArrayBufferPrototype%':['SharedArrayBuffer','prototype'],'%StringPrototype%':['String','prototype'],'%SymbolPrototype%':['Symbol','prototype'],'%SyntaxErrorPrototype%':['SyntaxError','prototype'],'%TypedArrayPrototype%':['TypedArray','prototype'],'%TypeErrorPrototype%':['TypeError','prototype'],'%Uint8ArrayPrototype%':['Uint8Array','prototype'],'%Uint8ClampedArrayPrototype%':['Uint8ClampedArray','prototype'],'%Uint16ArrayPrototype%':['Uint16Array','prototype'],'%Uint32ArrayPrototype%':['Uint32Array','prototype'],'%URIErrorPrototype%':['URIError','prototype'],'%WeakMapPrototype%':['WeakMap','prototype'],'%WeakSetPrototype%':['WeakSet','prototype']};var bind=require('function-bind');var hasOwn=require('hasown');var $concat=bind.call(
|
|
768
|
+
var errorProto=getProto(getProto(e));INTRINSICS['%Error.prototype%']=errorProto;}}var doEval=function doEval(name){var value;if(name==='%AsyncFunction%'){value=getEvalledConstructor('async function () {}');}else if(name==='%GeneratorFunction%'){value=getEvalledConstructor('function* () {}');}else if(name==='%AsyncGeneratorFunction%'){value=getEvalledConstructor('async function* () {}');}else if(name==='%AsyncGenerator%'){var fn=doEval('%AsyncGeneratorFunction%');if(fn){value=fn.prototype;}}else if(name==='%AsyncIteratorPrototype%'){var gen=doEval('%AsyncGenerator%');if(gen&&getProto){value=getProto(gen.prototype);}}INTRINSICS[name]=value;return value;};var LEGACY_ALIASES={__proto__:null,'%ArrayBufferPrototype%':['ArrayBuffer','prototype'],'%ArrayPrototype%':['Array','prototype'],'%ArrayProto_entries%':['Array','prototype','entries'],'%ArrayProto_forEach%':['Array','prototype','forEach'],'%ArrayProto_keys%':['Array','prototype','keys'],'%ArrayProto_values%':['Array','prototype','values'],'%AsyncFunctionPrototype%':['AsyncFunction','prototype'],'%AsyncGenerator%':['AsyncGeneratorFunction','prototype'],'%AsyncGeneratorPrototype%':['AsyncGeneratorFunction','prototype','prototype'],'%BooleanPrototype%':['Boolean','prototype'],'%DataViewPrototype%':['DataView','prototype'],'%DatePrototype%':['Date','prototype'],'%ErrorPrototype%':['Error','prototype'],'%EvalErrorPrototype%':['EvalError','prototype'],'%Float32ArrayPrototype%':['Float32Array','prototype'],'%Float64ArrayPrototype%':['Float64Array','prototype'],'%FunctionPrototype%':['Function','prototype'],'%Generator%':['GeneratorFunction','prototype'],'%GeneratorPrototype%':['GeneratorFunction','prototype','prototype'],'%Int8ArrayPrototype%':['Int8Array','prototype'],'%Int16ArrayPrototype%':['Int16Array','prototype'],'%Int32ArrayPrototype%':['Int32Array','prototype'],'%JSONParse%':['JSON','parse'],'%JSONStringify%':['JSON','stringify'],'%MapPrototype%':['Map','prototype'],'%NumberPrototype%':['Number','prototype'],'%ObjectPrototype%':['Object','prototype'],'%ObjProto_toString%':['Object','prototype','toString'],'%ObjProto_valueOf%':['Object','prototype','valueOf'],'%PromisePrototype%':['Promise','prototype'],'%PromiseProto_then%':['Promise','prototype','then'],'%Promise_all%':['Promise','all'],'%Promise_reject%':['Promise','reject'],'%Promise_resolve%':['Promise','resolve'],'%RangeErrorPrototype%':['RangeError','prototype'],'%ReferenceErrorPrototype%':['ReferenceError','prototype'],'%RegExpPrototype%':['RegExp','prototype'],'%SetPrototype%':['Set','prototype'],'%SharedArrayBufferPrototype%':['SharedArrayBuffer','prototype'],'%StringPrototype%':['String','prototype'],'%SymbolPrototype%':['Symbol','prototype'],'%SyntaxErrorPrototype%':['SyntaxError','prototype'],'%TypedArrayPrototype%':['TypedArray','prototype'],'%TypeErrorPrototype%':['TypeError','prototype'],'%Uint8ArrayPrototype%':['Uint8Array','prototype'],'%Uint8ClampedArrayPrototype%':['Uint8ClampedArray','prototype'],'%Uint16ArrayPrototype%':['Uint16Array','prototype'],'%Uint32ArrayPrototype%':['Uint32Array','prototype'],'%URIErrorPrototype%':['URIError','prototype'],'%WeakMapPrototype%':['WeakMap','prototype'],'%WeakSetPrototype%':['WeakSet','prototype']};var bind=require('function-bind');var hasOwn=require('hasown');var $concat=bind.call($call,Array.prototype.concat);var $spliceApply=bind.call($apply,Array.prototype.splice);var $replace=bind.call($call,String.prototype.replace);var $strSlice=bind.call($call,String.prototype.slice);var $exec=bind.call($call,RegExp.prototype.exec);/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */var rePropName=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;var reEscapeChar=/\\(\\)?/g;/** Used to match backslashes in property paths. */var stringToPath=function stringToPath(string){var first=$strSlice(string,0,1);var last=$strSlice(string,-1);if(first==='%'&&last!=='%'){throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');}else if(last==='%'&&first!=='%'){throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');}var result=[];$replace(string,rePropName,function(match,number,quote,subString){result[result.length]=quote?$replace(subString,reEscapeChar,'$1'):number||match;});return result;};/* end adaptation */var getBaseIntrinsic=function getBaseIntrinsic(name,allowMissing){var intrinsicName=name;var alias;if(hasOwn(LEGACY_ALIASES,intrinsicName)){alias=LEGACY_ALIASES[intrinsicName];intrinsicName='%'+alias[0]+'%';}if(hasOwn(INTRINSICS,intrinsicName)){var value=INTRINSICS[intrinsicName];if(value===needsEval){value=doEval(intrinsicName);}if(typeof value==='undefined'&&!allowMissing){throw new $TypeError('intrinsic '+name+' exists, but is not available. Please file an issue!');}return{alias:alias,name:intrinsicName,value:value};}throw new $SyntaxError('intrinsic '+name+' does not exist!');};module.exports=function GetIntrinsic(name,allowMissing){if(typeof name!=='string'||name.length===0){throw new $TypeError('intrinsic name must be a non-empty string');}if(arguments.length>1&&typeof allowMissing!=='boolean'){throw new $TypeError('"allowMissing" argument must be a boolean');}if($exec(/^%?[^%]*%?$/,name)===null){throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');}var parts=stringToPath(name);var intrinsicBaseName=parts.length>0?parts[0]:'';var intrinsic=getBaseIntrinsic('%'+intrinsicBaseName+'%',allowMissing);var intrinsicRealName=intrinsic.name;var value=intrinsic.value;var skipFurtherCaching=false;var alias=intrinsic.alias;if(alias){intrinsicBaseName=alias[0];$spliceApply(parts,$concat([0,1],alias));}for(var i=1,isOwn=true;i<parts.length;i+=1){var part=parts[i];var first=$strSlice(part,0,1);var last=$strSlice(part,-1);if((first==='"'||first==="'"||first==='`'||last==='"'||last==="'"||last==='`')&&first!==last){throw new $SyntaxError('property names with quotes must have matching quotes');}if(part==='constructor'||!isOwn){skipFurtherCaching=true;}intrinsicBaseName+='.'+part;intrinsicRealName='%'+intrinsicBaseName+'%';if(hasOwn(INTRINSICS,intrinsicRealName)){value=INTRINSICS[intrinsicRealName];}else if(value!=null){if(!(part in value)){if(!allowMissing){throw new $TypeError('base intrinsic for '+name+' exists, but the property is not available.');}return void undefined;}if($gOPD&&i+1>=parts.length){var desc=$gOPD(value,part);isOwn=!!desc;// By convention, when a data property is converted to an accessor
|
|
771
769
|
// property to emulate a data property that does not suffer from
|
|
772
770
|
// the override mistake, that accessor's getter is marked with
|
|
773
771
|
// an `originalValue` property. Here, when we detect this, we
|
|
774
772
|
// uphold the illusion by pretending to see that original data
|
|
775
773
|
// property, i.e., returning the value rather than the getter
|
|
776
774
|
// itself.
|
|
777
|
-
if(isOwn&&'get'in desc&&!('originalValue'in desc.get)){value=desc.get;}else{value=value[part];}}else{isOwn=hasOwn(value,part);value=value[part];}if(isOwn&&!skipFurtherCaching){INTRINSICS[intrinsicRealName]=value;}}}return value;};},{"es-errors":
|
|
778
|
-
|
|
779
|
-
return
|
|
780
|
-
|
|
781
|
-
|
|
775
|
+
if(isOwn&&'get'in desc&&!('originalValue'in desc.get)){value=desc.get;}else{value=value[part];}}else{isOwn=hasOwn(value,part);value=value[part];}if(isOwn&&!skipFurtherCaching){INTRINSICS[intrinsicRealName]=value;}}}return value;};},{"call-bind-apply-helpers/functionApply":26,"call-bind-apply-helpers/functionCall":27,"es-define-property":41,"es-errors":43,"es-errors/eval":42,"es-errors/range":44,"es-errors/ref":45,"es-errors/syntax":46,"es-errors/type":47,"es-errors/uri":48,"es-object-atoms":49,"function-bind":68,"get-proto":72,"get-proto/Object.getPrototypeOf":70,"get-proto/Reflect.getPrototypeOf":71,"gopd":74,"has-symbols":75,"hasown":77,"math-intrinsics/abs":93,"math-intrinsics/floor":94,"math-intrinsics/max":96,"math-intrinsics/min":97,"math-intrinsics/pow":98,"math-intrinsics/round":99,"math-intrinsics/sign":100}],70:[function(require,module,exports){'use strict';var $Object=require('es-object-atoms');/** @type {import('./Object.getPrototypeOf')} */module.exports=$Object.getPrototypeOf||null;},{"es-object-atoms":49}],71:[function(require,module,exports){'use strict';/** @type {import('./Reflect.getPrototypeOf')} */module.exports=typeof Reflect!=='undefined'&&Reflect.getPrototypeOf||null;},{}],72:[function(require,module,exports){'use strict';var reflectGetProto=require('./Reflect.getPrototypeOf');var originalGetProto=require('./Object.getPrototypeOf');var getDunderProto=require('dunder-proto/get');/** @type {import('.')} */module.exports=reflectGetProto?function getProto(O){// @ts-expect-error TS can't narrow inside a closure, for some reason
|
|
776
|
+
return reflectGetProto(O);}:originalGetProto?function getProto(O){if(!O||typeof O!=='object'&&typeof O!=='function'){throw new TypeError('getProto: not an object');}// @ts-expect-error TS can't narrow inside a closure, for some reason
|
|
777
|
+
return originalGetProto(O);}:getDunderProto?function getProto(O){// @ts-expect-error TS can't narrow inside a closure, for some reason
|
|
778
|
+
return getDunderProto(O);}:null;},{"./Object.getPrototypeOf":70,"./Reflect.getPrototypeOf":71,"dunder-proto/get":40}],73:[function(require,module,exports){'use strict';/** @type {import('./gOPD')} */module.exports=Object.getOwnPropertyDescriptor;},{}],74:[function(require,module,exports){'use strict';/** @type {import('.')} */var $gOPD=require('./gOPD');if($gOPD){try{$gOPD([],'length');}catch(e){// IE 8 has a broken gOPD
|
|
779
|
+
$gOPD=null;}}module.exports=$gOPD;},{"./gOPD":73}],75:[function(require,module,exports){'use strict';var origSymbol=typeof Symbol!=='undefined'&&Symbol;var hasSymbolSham=require('./shams');/** @type {import('.')} */module.exports=function hasNativeSymbols(){if(typeof origSymbol!=='function'){return false;}if(typeof Symbol!=='function'){return false;}if(typeof origSymbol('foo')!=='symbol'){return false;}if(typeof Symbol('bar')!=='symbol'){return false;}return hasSymbolSham();};},{"./shams":76}],76:[function(require,module,exports){'use strict';/** @type {import('./shams')} *//* eslint complexity: [2, 18], max-statements: [2, 33] */module.exports=function hasSymbols(){if(typeof Symbol!=='function'||typeof Object.getOwnPropertySymbols!=='function'){return false;}if(typeof Symbol.iterator==='symbol'){return true;}/** @type {{ [k in symbol]?: unknown }} */var obj={};var sym=Symbol('test');var symObj=Object(sym);if(typeof sym==='string'){return false;}if(Object.prototype.toString.call(sym)!=='[object Symbol]'){return false;}if(Object.prototype.toString.call(symObj)!=='[object Symbol]'){return false;}// temp disabled per https://github.com/ljharb/object.assign/issues/17
|
|
782
780
|
// if (sym instanceof Symbol) { return false; }
|
|
783
781
|
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
|
|
784
782
|
// if (!(symObj instanceof Symbol)) { return false; }
|
|
785
783
|
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
|
|
786
784
|
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
|
|
787
|
-
var symVal=42;obj[sym]=symVal;for(
|
|
788
|
-
if(typeof Object.keys==='function'&&Object.keys(obj).length!==0){return false;}if(typeof Object.getOwnPropertyNames==='function'&&Object.getOwnPropertyNames(obj).length!==0){return false;}var syms=Object.getOwnPropertySymbols(obj);if(syms.length!==1||syms[0]!==sym){return false;}if(!Object.prototype.propertyIsEnumerable.call(obj,sym)){return false;}if(typeof Object.getOwnPropertyDescriptor==='function'){
|
|
785
|
+
var symVal=42;obj[sym]=symVal;for(var _ in obj){return false;}// eslint-disable-line no-restricted-syntax, no-unreachable-loop
|
|
786
|
+
if(typeof Object.keys==='function'&&Object.keys(obj).length!==0){return false;}if(typeof Object.getOwnPropertyNames==='function'&&Object.getOwnPropertyNames(obj).length!==0){return false;}var syms=Object.getOwnPropertySymbols(obj);if(syms.length!==1||syms[0]!==sym){return false;}if(!Object.prototype.propertyIsEnumerable.call(obj,sym)){return false;}if(typeof Object.getOwnPropertyDescriptor==='function'){// eslint-disable-next-line no-extra-parens
|
|
787
|
+
var descriptor=/** @type {PropertyDescriptor} */Object.getOwnPropertyDescriptor(obj,sym);if(descriptor.value!==symVal||descriptor.enumerable!==true){return false;}}return true;};},{}],77:[function(require,module,exports){'use strict';var call=Function.prototype.call;var $hasOwn=Object.prototype.hasOwnProperty;var bind=require('function-bind');/** @type {import('.')} */module.exports=bind.call(call,$hasOwn);},{"function-bind":68}],78:[function(require,module,exports){var http=require('http');var url=require('url');var https=module.exports;for(var key in http){if(http.hasOwnProperty(key))https[key]=http[key];}https.request=function(params,cb){params=validateParams(params);return http.request.call(this,params,cb);};https.get=function(params,cb){params=validateParams(params);return http.get.call(this,params,cb);};function validateParams(params){if(typeof params==='string'){params=url.parse(params);}if(!params.protocol){params.protocol='https:';}if(params.protocol!=='https:'){throw new Error('Protocol "'+params.protocol+'" not supported. Expected "https:"');}return params;}},{"http":124,"url":145}],79:[function(require,module,exports){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias;}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity;}else{m=m+Math.pow(2,mLen);e=e-eBias;}return(s?-1:1)*m*Math.pow(2,e-mLen);};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax;}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2;}if(e+eBias>=1){value+=rt/c;}else{value+=rt*Math.pow(2,1-eBias);}if(value*c>=2){e++;c/=2;}if(e+eBias>=eMax){m=0;e=eMax;}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias;}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0;}}for(;mLen>=8;buffer[offset+i]=m&0xff,i+=d,m/=256,mLen-=8){}e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&0xff,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128;};},{}],80:[function(require,module,exports){if(typeof Object.create==='function'){// implementation from standard node.js 'util' module
|
|
789
788
|
module.exports=function inherits(ctor,superCtor){if(superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}});}};}else{// old school shim for old browsers
|
|
790
|
-
module.exports=function inherits(ctor,superCtor){if(superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor();ctor.prototype.constructor=ctor;}};}},{}],
|
|
789
|
+
module.exports=function inherits(ctor,superCtor){if(superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor();ctor.prototype.constructor=ctor;}};}},{}],81:[function(require,module,exports){// When a boxed property is passed in, it should have quotes of some
|
|
791
790
|
// kind around it.
|
|
792
791
|
//
|
|
793
792
|
// For instance:
|
|
@@ -802,7 +801,7 @@ module.exports=function inherits(ctor,superCtor){if(superCtor){ctor.super_=super
|
|
|
802
801
|
//
|
|
803
802
|
// TODO: Should template literals be processed? If so what state do they have access to? That should happen here if so.
|
|
804
803
|
// TODO: Make a simple class include library with these
|
|
805
|
-
const cleanWrapCharacters=(pCharacter,pString)=>{if(pString.startsWith(pCharacter)&&pString.endsWith(pCharacter)){return pString.substring(1,pString.length-1);}else{return pString;}};module.exports=cleanWrapCharacters;},{}],
|
|
804
|
+
const cleanWrapCharacters=(pCharacter,pString)=>{if(pString.startsWith(pCharacter)&&pString.endsWith(pCharacter)){return pString.substring(1,pString.length-1);}else{return pString;}};module.exports=cleanWrapCharacters;},{}],82:[function(require,module,exports){/**
|
|
806
805
|
* @author <steven@velozo.com>
|
|
807
806
|
*/let libSimpleLog=require('./Manyfest-LogToConsole.js');/**
|
|
808
807
|
* Hash Translation
|
|
@@ -824,11 +823,11 @@ this.logInfo=typeof pInfoLog==='function'?pInfoLog:libSimpleLog;this.logError=ty
|
|
|
824
823
|
if(typeof pTranslation!='object'){this.logError(`Hash translation addTranslation expected a translation be type object but was passed in ${typeof pTranslation}`);return false;}let tmpTranslationSources=Object.keys(pTranslation);tmpTranslationSources.forEach(pTranslationSource=>{if(typeof pTranslation[pTranslationSource]!='string'){this.logError(`Hash translation addTranslation expected a translation destination hash for [${pTranslationSource}] to be a string but the referrant was a ${typeof pTranslation[pTranslationSource]}`);}else{this.translationTable[pTranslationSource]=pTranslation[pTranslationSource];}});}removeTranslationHash(pTranslationHash){if(pTranslationHash in this.translationTable){delete this.translationTable[pTranslationHash];}}// This removes translations.
|
|
825
824
|
// If passed a string, just removes the single one.
|
|
826
825
|
// If passed an object, it does all the source keys.
|
|
827
|
-
removeTranslation(pTranslation){if(typeof pTranslation=='string'){this.removeTranslationHash(pTranslation);return true;}else if(typeof pTranslation=='object'){let tmpTranslationSources=Object.keys(pTranslation);tmpTranslationSources.forEach(pTranslationSource=>{this.removeTranslation(pTranslationSource);});return true;}else{this.logError(`Hash translation removeTranslation expected either a string or an object but the passed-in translation was type ${typeof pTranslation}`);return false;}}clearTranslations(){this.translationTable={};}translate(pTranslation){if(pTranslation in this.translationTable){return this.translationTable[pTranslation];}else{return pTranslation;}}}module.exports=ManyfestHashTranslation;},{"./Manyfest-LogToConsole.js":
|
|
826
|
+
removeTranslation(pTranslation){if(typeof pTranslation=='string'){this.removeTranslationHash(pTranslation);return true;}else if(typeof pTranslation=='object'){let tmpTranslationSources=Object.keys(pTranslation);tmpTranslationSources.forEach(pTranslationSource=>{this.removeTranslation(pTranslationSource);});return true;}else{this.logError(`Hash translation removeTranslation expected either a string or an object but the passed-in translation was type ${typeof pTranslation}`);return false;}}clearTranslations(){this.translationTable={};}translate(pTranslation){if(pTranslation in this.translationTable){return this.translationTable[pTranslation];}else{return pTranslation;}}}module.exports=ManyfestHashTranslation;},{"./Manyfest-LogToConsole.js":83}],83:[function(require,module,exports){/**
|
|
828
827
|
* @author <steven@velozo.com>
|
|
829
|
-
|
|
828
|
+
*//**
|
|
830
829
|
* Manyfest simple logging shim (for browser and dependency-free running)
|
|
831
|
-
*/const logToConsole=(pLogLine,pLogObject)=>{let tmpLogLine=typeof pLogLine==='string'?pLogLine:'';console.log(`[Manyfest] ${tmpLogLine}`);if(pLogObject)console.log(JSON.stringify(pLogObject));};module.exports=logToConsole;},{}],
|
|
830
|
+
*/const logToConsole=(pLogLine,pLogObject)=>{let tmpLogLine=typeof pLogLine==='string'?pLogLine:'';console.log(`[Manyfest] ${tmpLogLine}`);if(pLogObject)console.log(JSON.stringify(pLogObject));};module.exports=logToConsole;},{}],84:[function(require,module,exports){/**
|
|
832
831
|
* @author <steven@velozo.com>
|
|
833
832
|
*/const libSimpleLog=require('./Manyfest-LogToConsole.js');// This is for resolving functions mid-address
|
|
834
833
|
const libGetObjectValue=require('./Manyfest-ObjectAddress-GetValue.js');// TODO: Just until this is a fable service.
|
|
@@ -973,7 +972,7 @@ return this.checkAddressExists(pObject[tmpBoxedPropertyName][tmpBoxedPropertyNum
|
|
|
973
972
|
// then the system can't set the value in there. Error and abort!
|
|
974
973
|
if(tmpSubObjectName in pObject&&typeof pObject[tmpSubObjectName]!=='object'){return false;}else if(tmpSubObjectName in pObject){// If there is already a subobject pass that to the recursive thingy
|
|
975
974
|
return this.checkAddressExists(pObject[tmpSubObjectName],tmpNewAddress,tmpRootObject);}else{// Create a subobject and then pass that
|
|
976
|
-
pObject[tmpSubObjectName]={};return this.checkAddressExists(pObject[tmpSubObjectName],tmpNewAddress,tmpRootObject);}}}};module.exports=ManyfestObjectAddressResolverCheckAddressExists;},{"./Manyfest-LogToConsole.js":
|
|
975
|
+
pObject[tmpSubObjectName]={};return this.checkAddressExists(pObject[tmpSubObjectName],tmpNewAddress,tmpRootObject);}}}};module.exports=ManyfestObjectAddressResolverCheckAddressExists;},{"./Manyfest-LogToConsole.js":83,"./Manyfest-ObjectAddress-GetValue.js":86,"./Manyfest-ObjectAddress-Parser.js":87}],85:[function(require,module,exports){/**
|
|
977
976
|
* @author <steven@velozo.com>
|
|
978
977
|
*/let libSimpleLog=require('./Manyfest-LogToConsole.js');let fCleanWrapCharacters=require('./Manyfest-CleanWrapCharacters.js');let fParseConditionals=require(`../source/Manyfest-ParseConditionals.js`);/**
|
|
979
978
|
* Object Address Resolver - DeleteValue
|
|
@@ -1100,7 +1099,7 @@ if(tmpSubObjectName in pObject&&typeof pObject[tmpSubObjectName]!=='object'){ret
|
|
|
1100
1099
|
// Continue to manage the parent address for recursion
|
|
1101
1100
|
tmpParentAddress=`${tmpParentAddress}${tmpParentAddress.length>0?'.':''}${tmpSubObjectName}`;return this.deleteValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,tmpParentAddress);}else{// Create a subobject and then pass that
|
|
1102
1101
|
// Continue to manage the parent address for recursion
|
|
1103
|
-
tmpParentAddress=`${tmpParentAddress}${tmpParentAddress.length>0?'.':''}${tmpSubObjectName}`;pObject[tmpSubObjectName]={};return this.deleteValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,tmpParentAddress);}}}};module.exports=ManyfestObjectAddressResolverDeleteValue;},{"../source/Manyfest-ParseConditionals.js":
|
|
1102
|
+
tmpParentAddress=`${tmpParentAddress}${tmpParentAddress.length>0?'.':''}${tmpSubObjectName}`;pObject[tmpSubObjectName]={};return this.deleteValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,tmpParentAddress);}}}};module.exports=ManyfestObjectAddressResolverDeleteValue;},{"../source/Manyfest-ParseConditionals.js":90,"./Manyfest-CleanWrapCharacters.js":81,"./Manyfest-LogToConsole.js":83}],86:[function(require,module,exports){/**
|
|
1104
1103
|
* @author <steven@velozo.com>
|
|
1105
1104
|
*/let libSimpleLog=require('./Manyfest-LogToConsole.js');let fCleanWrapCharacters=require('./Manyfest-CleanWrapCharacters.js');let fParseConditionals=require(`../source/Manyfest-ParseConditionals.js`);let _MockFable={DataFormat:require('./Manyfest-ObjectAddress-Parser.js')};/**
|
|
1106
1105
|
* Object Address Resolver - GetValue
|
|
@@ -1292,7 +1291,7 @@ if(tmpSubObjectName in pObject&&typeof pObject[tmpSubObjectName]!=='object'){ret
|
|
|
1292
1291
|
// Continue to manage the parent address for recursion
|
|
1293
1292
|
tmpParentAddress=`${tmpParentAddress}${tmpParentAddress.length>0?'.':''}${tmpSubObjectName}`;return this.getValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,tmpParentAddress,tmpRootObject);}else{// Create a subobject and then pass that
|
|
1294
1293
|
// Continue to manage the parent address for recursion
|
|
1295
|
-
tmpParentAddress=`${tmpParentAddress}${tmpParentAddress.length>0?'.':''}${tmpSubObjectName}`;pObject[tmpSubObjectName]={};return this.getValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,tmpParentAddress,tmpRootObject);}}}};module.exports=ManyfestObjectAddressResolverGetValue;},{"../source/Manyfest-ParseConditionals.js":
|
|
1294
|
+
tmpParentAddress=`${tmpParentAddress}${tmpParentAddress.length>0?'.':''}${tmpSubObjectName}`;pObject[tmpSubObjectName]={};return this.getValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,tmpParentAddress,tmpRootObject);}}}};module.exports=ManyfestObjectAddressResolverGetValue;},{"../source/Manyfest-ParseConditionals.js":90,"./Manyfest-CleanWrapCharacters.js":81,"./Manyfest-LogToConsole.js":83,"./Manyfest-ObjectAddress-Parser.js":87}],87:[function(require,module,exports){// TODO: This is an inelegant solution to delay the rewrite of Manyfest.
|
|
1296
1295
|
// Fable 3.0 has a service for data formatting that deals well with nested enclosures.
|
|
1297
1296
|
// The Manyfest library predates fable 3.0 and the services structure of it, so the functions
|
|
1298
1297
|
// are more or less pure javascript and as functional as they can be made to be.
|
|
@@ -1372,7 +1371,7 @@ if(tmpEnclosureDepth==1){tmpEnclosureCount++;if(tmpEnclosureIndexToGet==tmpEnclo
|
|
|
1372
1371
|
tmpMatchedEnclosureIndex=true;tmpEnclosedValueStartIndex=i;}}}// This is the end of an enclosure
|
|
1373
1372
|
else if(tmpString[i]==tmpEnclosureEnd){tmpEnclosureDepth--;// Again, only count enclosures at depth 1, but still this parses both pairs of all of them.
|
|
1374
1373
|
if(tmpEnclosureDepth==0&&tmpMatchedEnclosureIndex&&tmpEnclosedValueEndIndex<=tmpEnclosedValueStartIndex){tmpEnclosedValueEndIndex=i;tmpMatchedEnclosureIndex=false;}}}if(tmpEnclosureCount<=tmpEnclosureIndexToGet){// Return an empty string if the enclosure is not found
|
|
1375
|
-
return'';}if(tmpEnclosedValueEndIndex>0&&tmpEnclosedValueEndIndex>tmpEnclosedValueStartIndex){return tmpString.substring(tmpEnclosedValueStartIndex+1,tmpEnclosedValueEndIndex);}else{return tmpString.substring(tmpEnclosedValueStartIndex+1);}}};},{}],
|
|
1374
|
+
return'';}if(tmpEnclosedValueEndIndex>0&&tmpEnclosedValueEndIndex>tmpEnclosedValueStartIndex){return tmpString.substring(tmpEnclosedValueStartIndex+1,tmpEnclosedValueEndIndex);}else{return tmpString.substring(tmpEnclosedValueStartIndex+1);}}};},{}],88:[function(require,module,exports){/**
|
|
1376
1375
|
* @author <steven@velozo.com>
|
|
1377
1376
|
*/let libSimpleLog=require('./Manyfest-LogToConsole.js');let fCleanWrapCharacters=require('./Manyfest-CleanWrapCharacters.js');/**
|
|
1378
1377
|
* Object Address Resolver - SetValue
|
|
@@ -1467,7 +1466,7 @@ return this.setValueAtAddress(pObject[tmpBoxedPropertyName][tmpBoxedPropertyNumb
|
|
|
1467
1466
|
if(tmpSubObjectName in pObject&&typeof pObject[tmpSubObjectName]!=='object'){if(!('__ERROR'in pObject))pObject['__ERROR']={};// Put it in an error object so data isn't lost
|
|
1468
1467
|
pObject['__ERROR'][pAddress]=pValue;return false;}else if(tmpSubObjectName in pObject){// If there is already a subobject pass that to the recursive thingy
|
|
1469
1468
|
return this.setValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,pValue);}else{// Create a subobject and then pass that
|
|
1470
|
-
pObject[tmpSubObjectName]={};return this.setValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,pValue);}}}};module.exports=ManyfestObjectAddressSetValue;},{"./Manyfest-CleanWrapCharacters.js":
|
|
1469
|
+
pObject[tmpSubObjectName]={};return this.setValueAtAddress(pObject[tmpSubObjectName],tmpNewAddress,pValue);}}}};module.exports=ManyfestObjectAddressSetValue;},{"./Manyfest-CleanWrapCharacters.js":81,"./Manyfest-LogToConsole.js":83}],89:[function(require,module,exports){/**
|
|
1471
1470
|
* @author <steven@velozo.com>
|
|
1472
1471
|
*/let libSimpleLog=require('./Manyfest-LogToConsole.js');/**
|
|
1473
1472
|
* Object Address Generation
|
|
@@ -1502,7 +1501,7 @@ this.logInfo=typeof pInfoLog=='function'?pInfoLog:libSimpleLog;this.logError=typ
|
|
|
1502
1501
|
// permutations and default values (when not an object) and everything else.
|
|
1503
1502
|
generateAddressses(pObject,pBaseAddress,pSchema){let tmpBaseAddress=typeof pBaseAddress=='string'?pBaseAddress:'';let tmpSchema=typeof pSchema=='object'?pSchema:{};let tmpObjectType=typeof pObject;let tmpSchemaObjectEntry={Address:tmpBaseAddress,Hash:tmpBaseAddress,Name:tmpBaseAddress,// This is so scripts and UI controls can force a developer to opt-in.
|
|
1504
1503
|
InSchema:false};if(tmpObjectType=='object'&&pObject==null){tmpObjectType='null';}switch(tmpObjectType){case'string':tmpSchemaObjectEntry.DataType='String';tmpSchemaObjectEntry.Default=pObject;tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;break;case'number':case'bigint':tmpSchemaObjectEntry.DataType='Number';tmpSchemaObjectEntry.Default=pObject;tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;break;case'undefined':case'null':tmpSchemaObjectEntry.DataType='Any';tmpSchemaObjectEntry.Default=pObject;tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;break;case'object':if(Array.isArray(pObject)){tmpSchemaObjectEntry.DataType='Array';if(tmpBaseAddress!=''){tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;}for(let i=0;i<pObject.length;i++){this.generateAddressses(pObject[i],`${tmpBaseAddress}[${i}]`,tmpSchema);}}else{tmpSchemaObjectEntry.DataType='Object';if(tmpBaseAddress!=''){tmpSchema[tmpBaseAddress]=tmpSchemaObjectEntry;tmpBaseAddress+='.';}let tmpObjectProperties=Object.keys(pObject);for(let i=0;i<tmpObjectProperties.length;i++){this.generateAddressses(pObject[tmpObjectProperties[i]],`${tmpBaseAddress}${tmpObjectProperties[i]}`,tmpSchema);}}break;case'symbol':case'function':// Symbols and functions neither recurse nor get added to the schema
|
|
1505
|
-
break;}return tmpSchema;}};module.exports=ManyfestObjectAddressGeneration;},{"./Manyfest-LogToConsole.js":
|
|
1504
|
+
break;}return tmpSchema;}};module.exports=ManyfestObjectAddressGeneration;},{"./Manyfest-LogToConsole.js":83}],90:[function(require,module,exports){// Given a string, parse out any conditional expressions and set whether or not to keep the record.
|
|
1506
1505
|
//
|
|
1507
1506
|
// For instance:
|
|
1508
1507
|
// 'files[]<<~?format,==,Thumbnail?~>>'
|
|
@@ -1536,7 +1535,7 @@ case'!=':return pManyfest.getValueAtAddress(pRecord,pSearchAddress)!=pValue;brea
|
|
|
1536
1535
|
let tmpSearchAddress=tmpMagicComparisonPatternSet[0];// The copmparison expression (EXISTS as default)
|
|
1537
1536
|
let tmpSearchComparator='EXISTS';if(tmpMagicComparisonPatternSet.length>1){tmpSearchComparator=tmpMagicComparisonPatternSet[1];}// The value to search for
|
|
1538
1537
|
let tmpSearchValue=false;if(tmpMagicComparisonPatternSet.length>2){tmpSearchValue=tmpMagicComparisonPatternSet[2];}// Process the piece
|
|
1539
|
-
tmpKeepRecord=tmpKeepRecord&&testCondition(pManyfest,pRecord,tmpSearchAddress,tmpSearchComparator,tmpSearchValue);tmpStartIndex=pAddress.indexOf(_ConditionalStanzaStart,tmpStopIndex+_ConditionalStanzaEndLength);}else{tmpStartIndex=-1;}}return tmpKeepRecord;};module.exports=parseConditionals;},{}],
|
|
1538
|
+
tmpKeepRecord=tmpKeepRecord&&testCondition(pManyfest,pRecord,tmpSearchAddress,tmpSearchComparator,tmpSearchValue);tmpStartIndex=pAddress.indexOf(_ConditionalStanzaStart,tmpStopIndex+_ConditionalStanzaEndLength);}else{tmpStartIndex=-1;}}return tmpKeepRecord;};module.exports=parseConditionals;},{}],91:[function(require,module,exports){/**
|
|
1540
1539
|
* @author <steven@velozo.com>
|
|
1541
1540
|
*/let libSimpleLog=require('./Manyfest-LogToConsole.js');/**
|
|
1542
1541
|
* Schema Manipulation Functions
|
|
@@ -1569,7 +1568,7 @@ if(tmpOldDescriptorAddress){tmpDescriptor=pManyfestSchemaDescriptors[tmpOldDescr
|
|
|
1569
1568
|
tmpDescriptor={Hash:pInputAddress};}// Now re-add the descriptor to the manyfest schema
|
|
1570
1569
|
pManyfestSchemaDescriptors[tmpNewDescriptorAddress]=tmpDescriptor;});return true;}safeResolveAddressMappings(pManyfestSchemaDescriptors,pAddressMapping){// This returns the descriptors as a new object, safely remapping without mutating the original schema Descriptors
|
|
1571
1570
|
let tmpManyfestSchemaDescriptors=JSON.parse(JSON.stringify(pManyfestSchemaDescriptors));this.resolveAddressMappings(tmpManyfestSchemaDescriptors,pAddressMapping);return tmpManyfestSchemaDescriptors;}mergeAddressMappings(pManyfestSchemaDescriptorsDestination,pManyfestSchemaDescriptorsSource){if(typeof pManyfestSchemaDescriptorsSource!='object'||typeof pManyfestSchemaDescriptorsDestination!='object'){this.logError(`Attempted to merge two schema descriptors but both were not objects.`);return false;}let tmpSource=JSON.parse(JSON.stringify(pManyfestSchemaDescriptorsSource));let tmpNewManyfestSchemaDescriptors=JSON.parse(JSON.stringify(pManyfestSchemaDescriptorsDestination));// The first passed-in set of descriptors takes precedence.
|
|
1572
|
-
let tmpDescriptorAddresses=Object.keys(tmpSource);tmpDescriptorAddresses.forEach(pDescriptorAddress=>{if(!(pDescriptorAddress in tmpNewManyfestSchemaDescriptors)){tmpNewManyfestSchemaDescriptors[pDescriptorAddress]=tmpSource[pDescriptorAddress];}});return tmpNewManyfestSchemaDescriptors;}}module.exports=ManyfestSchemaManipulation;},{"./Manyfest-LogToConsole.js":
|
|
1571
|
+
let tmpDescriptorAddresses=Object.keys(tmpSource);tmpDescriptorAddresses.forEach(pDescriptorAddress=>{if(!(pDescriptorAddress in tmpNewManyfestSchemaDescriptors)){tmpNewManyfestSchemaDescriptors[pDescriptorAddress]=tmpSource[pDescriptorAddress];}});return tmpNewManyfestSchemaDescriptors;}}module.exports=ManyfestSchemaManipulation;},{"./Manyfest-LogToConsole.js":83}],92:[function(require,module,exports){/**
|
|
1573
1572
|
* @author <steven@velozo.com>
|
|
1574
1573
|
*/const libFableServiceProviderBase=require('fable-serviceproviderbase');let libSimpleLog=require('./Manyfest-LogToConsole.js');let libHashTranslation=require('./Manyfest-HashTranslation.js');let libObjectAddressCheckAddressExists=require('./Manyfest-ObjectAddress-CheckAddressExists.js');let libObjectAddressGetValue=require('./Manyfest-ObjectAddress-GetValue.js');let libObjectAddressSetValue=require('./Manyfest-ObjectAddress-SetValue.js');let libObjectAddressDeleteValue=require('./Manyfest-ObjectAddress-DeleteValue.js');let libObjectAddressGeneration=require('./Manyfest-ObjectAddressGeneration.js');let libSchemaManipulation=require('./Manyfest-SchemaManipulation.js');const _DefaultConfiguration={Scope:'DEFAULT',Descriptors:{}};/**
|
|
1575
1574
|
* @typedef {{
|
|
@@ -1581,7 +1580,7 @@ let tmpDescriptorAddresses=Object.keys(tmpSource);tmpDescriptorAddresses.forEach
|
|
|
1581
1580
|
* Description?: string,
|
|
1582
1581
|
* [key: string]: any,
|
|
1583
1582
|
* }} ManifestDescriptor
|
|
1584
|
-
|
|
1583
|
+
*//**
|
|
1585
1584
|
* Manyfest object address-based descriptions and manipulations.
|
|
1586
1585
|
*
|
|
1587
1586
|
* @class Manyfest
|
|
@@ -1589,7 +1588,7 @@ let tmpDescriptorAddresses=Object.keys(tmpSource);tmpDescriptorAddresses.forEach
|
|
|
1589
1588
|
this.logInfo=libSimpleLog;this.logError=libSimpleLog;// Create an object address resolver and map in the functions
|
|
1590
1589
|
this.objectAddressCheckAddressExists=new libObjectAddressCheckAddressExists(this.logInfo,this.logError);this.objectAddressGetValue=new libObjectAddressGetValue(this.logInfo,this.logError);this.objectAddressSetValue=new libObjectAddressSetValue(this.logInfo,this.logError);this.objectAddressDeleteValue=new libObjectAddressDeleteValue(this.logInfo,this.logError);if(!('defaultValues'in this.options)){this.options.defaultValues={"String":"","Number":0,"Float":0.0,"Integer":0,"PreciseNumber":"0.0","Boolean":false,"Binary":0,"DateTime":0,"Array":[],"Object":{},"Null":null};}if(!('strict'in this.options)){this.options.strict=false;}this.scope=undefined;this.elementAddresses=undefined;this.elementHashes=undefined;this.elementDescriptors=undefined;this.reset();if(typeof this.options==='object'){this.loadManifest(this.options);}this.schemaManipulations=new libSchemaManipulation(this.logInfo,this.logError);this.objectAddressGeneration=new libObjectAddressGeneration(this.logInfo,this.logError);this.hashTranslations=new libHashTranslation(this.logInfo,this.logError);this.numberRegex=/^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/;}/*************************************************************************
|
|
1591
1590
|
* Schema Manifest Loading, Reading, Manipulation and Serialization Functions
|
|
1592
|
-
|
|
1591
|
+
*/// Reset critical manifest properties
|
|
1593
1592
|
reset(){this.scope='DEFAULT';this.elementAddresses=[];this.elementHashes={};this.elementDescriptors={};}clone(){// Make a copy of the options in-place
|
|
1594
1593
|
let tmpNewOptions=JSON.parse(JSON.stringify(this.options));let tmpNewManyfest=new Manyfest(this.getManifest(),this.logInfo,this.logError,tmpNewOptions);// Import the hash translations
|
|
1595
1594
|
tmpNewManyfest.hashTranslations.addTranslation(this.hashTranslations.translationTable);return tmpNewManyfest;}// Deserialize a Manifest from a string
|
|
@@ -1620,10 +1619,10 @@ this.elementHashes[pDescriptor.Hash]=pAddress;}else{pDescriptor.Hash=pAddress;}r
|
|
|
1620
1619
|
* @param {(d: ManifestDescriptor) => void} fAction - The action function to execute for each descriptor.
|
|
1621
1620
|
*/eachDescriptor(fAction){let tmpDescriptorAddresses=Object.keys(this.elementDescriptors);for(let i=0;i<tmpDescriptorAddresses.length;i++){fAction(this.elementDescriptors[tmpDescriptorAddresses[i]]);}}/*************************************************************************
|
|
1622
1621
|
* Beginning of Object Manipulation (read & write) Functions
|
|
1623
|
-
|
|
1622
|
+
*/// Check if an element exists by its hash
|
|
1624
1623
|
checkAddressExistsByHash(pObject,pHash){return this.checkAddressExists(pObject,this.resolveHashAddress(pHash));}// Check if an element exists at an address
|
|
1625
1624
|
checkAddressExists(pObject,pAddress){return this.objectAddressCheckAddressExists.checkAddressExists(pObject,pAddress);}// Turn a hash into an address, factoring in the translation table.
|
|
1626
|
-
resolveHashAddress(pHash){let tmpAddress=undefined;let tmpInElementHashTable=
|
|
1625
|
+
resolveHashAddress(pHash){let tmpAddress=undefined;let tmpInElementHashTable=pHash in this.elementHashes;let tmpInTranslationTable=pHash in this.hashTranslations.translationTable;// The most straightforward: the hash exists, no translations.
|
|
1627
1626
|
if(tmpInElementHashTable&&!tmpInTranslationTable){tmpAddress=this.elementHashes[pHash];}// There is a translation from one hash to another, and, the elementHashes contains the pointer end
|
|
1628
1627
|
else if(tmpInTranslationTable&&this.hashTranslations.translate(pHash)in this.elementHashes){tmpAddress=this.elementHashes[this.hashTranslations.translate(pHash)];}// Use the level of indirection only in the Translation Table
|
|
1629
1628
|
else if(tmpInTranslationTable){tmpAddress=this.hashTranslations.translate(pHash);}// Just treat the hash as an address.
|
|
@@ -1662,24 +1661,24 @@ let tmpOverwriteProperties=typeof pOverwriteProperties=='undefined'?false:pOverw
|
|
|
1662
1661
|
// The default filter function just returns true, populating everything.
|
|
1663
1662
|
let tmpFilterFunction=typeof fFilter=='function'?fFilter:pDescriptor=>{return true;};this.elementAddresses.forEach(pAddress=>{let tmpDescriptor=this.getDescriptor(pAddress);// Check the filter function to see if this is an address we want to set the value for.
|
|
1664
1663
|
if(tmpFilterFunction(tmpDescriptor)){// If we are overwriting properties OR the property does not exist
|
|
1665
|
-
if(tmpOverwriteProperties||!this.checkAddressExists(tmpObject,pAddress)){this.setValueAtAddress(tmpObject,pAddress,this.getDefaultValue(tmpDescriptor));}}});return tmpObject;}};module.exports=Manyfest;},{"./Manyfest-HashTranslation.js":
|
|
1664
|
+
if(tmpOverwriteProperties||!this.checkAddressExists(tmpObject,pAddress)){this.setValueAtAddress(tmpObject,pAddress,this.getDefaultValue(tmpDescriptor));}}});return tmpObject;}};module.exports=Manyfest;},{"./Manyfest-HashTranslation.js":82,"./Manyfest-LogToConsole.js":83,"./Manyfest-ObjectAddress-CheckAddressExists.js":84,"./Manyfest-ObjectAddress-DeleteValue.js":85,"./Manyfest-ObjectAddress-GetValue.js":86,"./Manyfest-ObjectAddress-SetValue.js":88,"./Manyfest-ObjectAddressGeneration.js":89,"./Manyfest-SchemaManipulation.js":91,"fable-serviceproviderbase":59}],93:[function(require,module,exports){'use strict';/** @type {import('./abs')} */module.exports=Math.abs;},{}],94:[function(require,module,exports){'use strict';/** @type {import('./floor')} */module.exports=Math.floor;},{}],95:[function(require,module,exports){'use strict';/** @type {import('./isNaN')} */module.exports=Number.isNaN||function isNaN(a){return a!==a;};},{}],96:[function(require,module,exports){'use strict';/** @type {import('./max')} */module.exports=Math.max;},{}],97:[function(require,module,exports){'use strict';/** @type {import('./min')} */module.exports=Math.min;},{}],98:[function(require,module,exports){'use strict';/** @type {import('./pow')} */module.exports=Math.pow;},{}],99:[function(require,module,exports){'use strict';/** @type {import('./round')} */module.exports=Math.round;},{}],100:[function(require,module,exports){'use strict';var $isNaN=require('./isNaN');/** @type {import('./sign')} */module.exports=function sign(number){if($isNaN(number)||number===0){return number;}return number<0?-1:+1;};},{"./isNaN":95}],101:[function(require,module,exports){(function(global){(function(){var hasMap=typeof Map==='function'&&Map.prototype;var mapSizeDescriptor=Object.getOwnPropertyDescriptor&&hasMap?Object.getOwnPropertyDescriptor(Map.prototype,'size'):null;var mapSize=hasMap&&mapSizeDescriptor&&typeof mapSizeDescriptor.get==='function'?mapSizeDescriptor.get:null;var mapForEach=hasMap&&Map.prototype.forEach;var hasSet=typeof Set==='function'&&Set.prototype;var setSizeDescriptor=Object.getOwnPropertyDescriptor&&hasSet?Object.getOwnPropertyDescriptor(Set.prototype,'size'):null;var setSize=hasSet&&setSizeDescriptor&&typeof setSizeDescriptor.get==='function'?setSizeDescriptor.get:null;var setForEach=hasSet&&Set.prototype.forEach;var hasWeakMap=typeof WeakMap==='function'&&WeakMap.prototype;var weakMapHas=hasWeakMap?WeakMap.prototype.has:null;var hasWeakSet=typeof WeakSet==='function'&&WeakSet.prototype;var weakSetHas=hasWeakSet?WeakSet.prototype.has:null;var hasWeakRef=typeof WeakRef==='function'&&WeakRef.prototype;var weakRefDeref=hasWeakRef?WeakRef.prototype.deref:null;var booleanValueOf=Boolean.prototype.valueOf;var objectToString=Object.prototype.toString;var functionToString=Function.prototype.toString;var $match=String.prototype.match;var $slice=String.prototype.slice;var $replace=String.prototype.replace;var $toUpperCase=String.prototype.toUpperCase;var $toLowerCase=String.prototype.toLowerCase;var $test=RegExp.prototype.test;var $concat=Array.prototype.concat;var $join=Array.prototype.join;var $arrSlice=Array.prototype.slice;var $floor=Math.floor;var bigIntValueOf=typeof BigInt==='function'?BigInt.prototype.valueOf:null;var gOPS=Object.getOwnPropertySymbols;var symToString=typeof Symbol==='function'&&typeof Symbol.iterator==='symbol'?Symbol.prototype.toString:null;var hasShammedSymbols=typeof Symbol==='function'&&typeof Symbol.iterator==='object';// ie, `has-tostringtag/shams
|
|
1666
1665
|
var toStringTag=typeof Symbol==='function'&&Symbol.toStringTag&&(typeof Symbol.toStringTag===hasShammedSymbols?'object':'symbol')?Symbol.toStringTag:null;var isEnumerable=Object.prototype.propertyIsEnumerable;var gPO=(typeof Reflect==='function'?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype// eslint-disable-line no-proto
|
|
1667
1666
|
?function(O){return O.__proto__;// eslint-disable-line no-proto
|
|
1668
1667
|
}:null);function addNumericSeparator(num,str){if(num===Infinity||num===-Infinity||num!==num||num&&num>-1000&&num<1000||$test.call(/e/,str)){return str;}var sepRegex=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof num==='number'){var int=num<0?-$floor(-num):$floor(num);// trunc(num)
|
|
1669
|
-
if(int!==num){var intStr=String(int);var dec=$slice.call(str,intStr.length+1);return $replace.call(intStr,sepRegex,'$&_')+'.'+$replace.call($replace.call(dec,/([0-9]{3})/g,'$&_'),/_$/,'');}}return $replace.call(str,sepRegex,'$&_');}var utilInspect=require('./util.inspect');var inspectCustom=utilInspect.custom;var inspectSymbol=isSymbol(inspectCustom)?inspectCustom:null;module.exports=function inspect_(obj,options,depth,seen){var opts=options||{};if(has(opts,'quoteStyle')
|
|
1668
|
+
if(int!==num){var intStr=String(int);var dec=$slice.call(str,intStr.length+1);return $replace.call(intStr,sepRegex,'$&_')+'.'+$replace.call($replace.call(dec,/([0-9]{3})/g,'$&_'),/_$/,'');}}return $replace.call(str,sepRegex,'$&_');}var utilInspect=require('./util.inspect');var inspectCustom=utilInspect.custom;var inspectSymbol=isSymbol(inspectCustom)?inspectCustom:null;var quotes={__proto__:null,'double':'"',single:"'"};var quoteREs={__proto__:null,'double':/(["\\])/g,single:/(['\\])/g};module.exports=function inspect_(obj,options,depth,seen){var opts=options||{};if(has(opts,'quoteStyle')&&!has(quotes,opts.quoteStyle)){throw new TypeError('option "quoteStyle" must be "single" or "double"');}if(has(opts,'maxStringLength')&&(typeof opts.maxStringLength==='number'?opts.maxStringLength<0&&opts.maxStringLength!==Infinity:opts.maxStringLength!==null)){throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');}var customInspect=has(opts,'customInspect')?opts.customInspect:true;if(typeof customInspect!=='boolean'&&customInspect!=='symbol'){throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');}if(has(opts,'indent')&&opts.indent!==null&&opts.indent!=='\t'&&!(parseInt(opts.indent,10)===opts.indent&&opts.indent>0)){throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');}if(has(opts,'numericSeparator')&&typeof opts.numericSeparator!=='boolean'){throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');}var numericSeparator=opts.numericSeparator;if(typeof obj==='undefined'){return'undefined';}if(obj===null){return'null';}if(typeof obj==='boolean'){return obj?'true':'false';}if(typeof obj==='string'){return inspectString(obj,opts);}if(typeof obj==='number'){if(obj===0){return Infinity/obj>0?'0':'-0';}var str=String(obj);return numericSeparator?addNumericSeparator(obj,str):str;}if(typeof obj==='bigint'){var bigIntStr=String(obj)+'n';return numericSeparator?addNumericSeparator(obj,bigIntStr):bigIntStr;}var maxDepth=typeof opts.depth==='undefined'?5:opts.depth;if(typeof depth==='undefined'){depth=0;}if(depth>=maxDepth&&maxDepth>0&&typeof obj==='object'){return isArray(obj)?'[Array]':'[Object]';}var indent=getIndent(opts,depth);if(typeof seen==='undefined'){seen=[];}else if(indexOf(seen,obj)>=0){return'[Circular]';}function inspect(value,from,noIndent){if(from){seen=$arrSlice.call(seen);seen.push(from);}if(noIndent){var newOpts={depth:opts.depth};if(has(opts,'quoteStyle')){newOpts.quoteStyle=opts.quoteStyle;}return inspect_(value,newOpts,depth+1,seen);}return inspect_(value,opts,depth+1,seen);}if(typeof obj==='function'&&!isRegExp(obj)){// in older engines, regexes are callable
|
|
1670
1669
|
var name=nameOf(obj);var keys=arrObjKeys(obj,inspect);return'[Function'+(name?': '+name:' (anonymous)')+']'+(keys.length>0?' { '+$join.call(keys,', ')+' }':'');}if(isSymbol(obj)){var symString=hasShammedSymbols?$replace.call(String(obj),/^(Symbol\(.*\))_[^)]*$/,'$1'):symToString.call(obj);return typeof obj==='object'&&!hasShammedSymbols?markBoxed(symString):symString;}if(isElement(obj)){var s='<'+$toLowerCase.call(String(obj.nodeName));var attrs=obj.attributes||[];for(var i=0;i<attrs.length;i++){s+=' '+attrs[i].name+'='+wrapQuotes(quote(attrs[i].value),'double',opts);}s+='>';if(obj.childNodes&&obj.childNodes.length){s+='...';}s+='</'+$toLowerCase.call(String(obj.nodeName))+'>';return s;}if(isArray(obj)){if(obj.length===0){return'[]';}var xs=arrObjKeys(obj,inspect);if(indent&&!singleLineValues(xs)){return'['+indentedJoin(xs,indent)+']';}return'[ '+$join.call(xs,', ')+' ]';}if(isError(obj)){var parts=arrObjKeys(obj,inspect);if(!('cause'in Error.prototype)&&'cause'in obj&&!isEnumerable.call(obj,'cause')){return'{ ['+String(obj)+'] '+$join.call($concat.call('[cause]: '+inspect(obj.cause),parts),', ')+' }';}if(parts.length===0){return'['+String(obj)+']';}return'{ ['+String(obj)+'] '+$join.call(parts,', ')+' }';}if(typeof obj==='object'&&customInspect){if(inspectSymbol&&typeof obj[inspectSymbol]==='function'&&utilInspect){return utilInspect(obj,{depth:maxDepth-depth});}else if(customInspect!=='symbol'&&typeof obj.inspect==='function'){return obj.inspect();}}if(isMap(obj)){var mapParts=[];if(mapForEach){mapForEach.call(obj,function(value,key){mapParts.push(inspect(key,obj,true)+' => '+inspect(value,obj));});}return collectionOf('Map',mapSize.call(obj),mapParts,indent);}if(isSet(obj)){var setParts=[];if(setForEach){setForEach.call(obj,function(value){setParts.push(inspect(value,obj));});}return collectionOf('Set',setSize.call(obj),setParts,indent);}if(isWeakMap(obj)){return weakCollectionOf('WeakMap');}if(isWeakSet(obj)){return weakCollectionOf('WeakSet');}if(isWeakRef(obj)){return weakCollectionOf('WeakRef');}if(isNumber(obj)){return markBoxed(inspect(Number(obj)));}if(isBigInt(obj)){return markBoxed(inspect(bigIntValueOf.call(obj)));}if(isBoolean(obj)){return markBoxed(booleanValueOf.call(obj));}if(isString(obj)){return markBoxed(inspect(String(obj)));}// note: in IE 8, sometimes `global !== window` but both are the prototypes of each other
|
|
1671
|
-
/* eslint-env browser */if(typeof window!=='undefined'&&obj===window){return'{ [object Window] }';}if(obj===global){return'{ [object globalThis] }';}if(!isDate(obj)&&!isRegExp(obj)){var ys=arrObjKeys(obj,inspect);var isPlainObject=gPO?gPO(obj)===Object.prototype:obj instanceof Object||obj.constructor===Object;var protoTag=obj instanceof Object?'':'null prototype';var stringTag=!isPlainObject&&toStringTag&&Object(obj)===obj&&toStringTag in obj?$slice.call(toStr(obj),8,-1):protoTag?'Object':'';var constructorTag=isPlainObject||typeof obj.constructor!=='function'?'':obj.constructor.name?obj.constructor.name+' ':'';var tag=constructorTag+(stringTag||protoTag?'['+$join.call($concat.call([],stringTag||[],protoTag||[]),': ')+'] ':'');if(ys.length===0){return tag+'{}';}if(indent){return tag+'{'+indentedJoin(ys,indent)+'}';}return tag+'{ '+$join.call(ys,', ')+' }';}return String(obj);};function wrapQuotes(s,defaultStyle,opts){var
|
|
1670
|
+
/* eslint-env browser */if(typeof window!=='undefined'&&obj===window){return'{ [object Window] }';}if(typeof globalThis!=='undefined'&&obj===globalThis||typeof global!=='undefined'&&obj===global){return'{ [object globalThis] }';}if(!isDate(obj)&&!isRegExp(obj)){var ys=arrObjKeys(obj,inspect);var isPlainObject=gPO?gPO(obj)===Object.prototype:obj instanceof Object||obj.constructor===Object;var protoTag=obj instanceof Object?'':'null prototype';var stringTag=!isPlainObject&&toStringTag&&Object(obj)===obj&&toStringTag in obj?$slice.call(toStr(obj),8,-1):protoTag?'Object':'';var constructorTag=isPlainObject||typeof obj.constructor!=='function'?'':obj.constructor.name?obj.constructor.name+' ':'';var tag=constructorTag+(stringTag||protoTag?'['+$join.call($concat.call([],stringTag||[],protoTag||[]),': ')+'] ':'');if(ys.length===0){return tag+'{}';}if(indent){return tag+'{'+indentedJoin(ys,indent)+'}';}return tag+'{ '+$join.call(ys,', ')+' }';}return String(obj);};function wrapQuotes(s,defaultStyle,opts){var style=opts.quoteStyle||defaultStyle;var quoteChar=quotes[style];return quoteChar+s+quoteChar;}function quote(s){return $replace.call(String(s),/"/g,'"');}function canTrustToString(obj){return!toStringTag||!(typeof obj==='object'&&(toStringTag in obj||typeof obj[toStringTag]!=='undefined'));}function isArray(obj){return toStr(obj)==='[object Array]'&&canTrustToString(obj);}function isDate(obj){return toStr(obj)==='[object Date]'&&canTrustToString(obj);}function isRegExp(obj){return toStr(obj)==='[object RegExp]'&&canTrustToString(obj);}function isError(obj){return toStr(obj)==='[object Error]'&&canTrustToString(obj);}function isString(obj){return toStr(obj)==='[object String]'&&canTrustToString(obj);}function isNumber(obj){return toStr(obj)==='[object Number]'&&canTrustToString(obj);}function isBoolean(obj){return toStr(obj)==='[object Boolean]'&&canTrustToString(obj);}// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
|
|
1672
1671
|
function isSymbol(obj){if(hasShammedSymbols){return obj&&typeof obj==='object'&&obj instanceof Symbol;}if(typeof obj==='symbol'){return true;}if(!obj||typeof obj!=='object'||!symToString){return false;}try{symToString.call(obj);return true;}catch(e){}return false;}function isBigInt(obj){if(!obj||typeof obj!=='object'||!bigIntValueOf){return false;}try{bigIntValueOf.call(obj);return true;}catch(e){}return false;}var hasOwn=Object.prototype.hasOwnProperty||function(key){return key in this;};function has(obj,key){return hasOwn.call(obj,key);}function toStr(obj){return objectToString.call(obj);}function nameOf(f){if(f.name){return f.name;}var m=$match.call(functionToString.call(f),/^function\s*([\w$]+)/);if(m){return m[1];}return null;}function indexOf(xs,x){if(xs.indexOf){return xs.indexOf(x);}for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x){return i;}}return-1;}function isMap(x){if(!mapSize||!x||typeof x!=='object'){return false;}try{mapSize.call(x);try{setSize.call(x);}catch(s){return true;}return x instanceof Map;// core-js workaround, pre-v2.5.0
|
|
1673
1672
|
}catch(e){}return false;}function isWeakMap(x){if(!weakMapHas||!x||typeof x!=='object'){return false;}try{weakMapHas.call(x,weakMapHas);try{weakSetHas.call(x,weakSetHas);}catch(s){return true;}return x instanceof WeakMap;// core-js workaround, pre-v2.5.0
|
|
1674
1673
|
}catch(e){}return false;}function isWeakRef(x){if(!weakRefDeref||!x||typeof x!=='object'){return false;}try{weakRefDeref.call(x);return true;}catch(e){}return false;}function isSet(x){if(!setSize||!x||typeof x!=='object'){return false;}try{setSize.call(x);try{mapSize.call(x);}catch(m){return true;}return x instanceof Set;// core-js workaround, pre-v2.5.0
|
|
1675
1674
|
}catch(e){}return false;}function isWeakSet(x){if(!weakSetHas||!x||typeof x!=='object'){return false;}try{weakSetHas.call(x,weakSetHas);try{weakMapHas.call(x,weakMapHas);}catch(s){return true;}return x instanceof WeakSet;// core-js workaround, pre-v2.5.0
|
|
1676
|
-
}catch(e){}return false;}function isElement(x){if(!x||typeof x!=='object'){return false;}if(typeof HTMLElement!=='undefined'&&x instanceof HTMLElement){return true;}return typeof x.nodeName==='string'&&typeof x.getAttribute==='function';}function inspectString(str,opts){if(str.length>opts.maxStringLength){var remaining=str.length-opts.maxStringLength;var trailer='... '+remaining+' more character'+(remaining>1?'s':'');return inspectString($slice.call(str,0,opts.maxStringLength),opts)+trailer;}
|
|
1677
|
-
var s=$replace.call($replace.call(str
|
|
1675
|
+
}catch(e){}return false;}function isElement(x){if(!x||typeof x!=='object'){return false;}if(typeof HTMLElement!=='undefined'&&x instanceof HTMLElement){return true;}return typeof x.nodeName==='string'&&typeof x.getAttribute==='function';}function inspectString(str,opts){if(str.length>opts.maxStringLength){var remaining=str.length-opts.maxStringLength;var trailer='... '+remaining+' more character'+(remaining>1?'s':'');return inspectString($slice.call(str,0,opts.maxStringLength),opts)+trailer;}var quoteRE=quoteREs[opts.quoteStyle||'single'];quoteRE.lastIndex=0;// eslint-disable-next-line no-control-regex
|
|
1676
|
+
var s=$replace.call($replace.call(str,quoteRE,'\\$1'),/[\x00-\x1f]/g,lowbyte);return wrapQuotes(s,'single',opts);}function lowbyte(c){var n=c.charCodeAt(0);var x={8:'b',9:'t',10:'n',12:'f',13:'r'}[n];if(x){return'\\'+x;}return'\\x'+(n<0x10?'0':'')+$toUpperCase.call(n.toString(16));}function markBoxed(str){return'Object('+str+')';}function weakCollectionOf(type){return type+' { ? }';}function collectionOf(type,size,entries,indent){var joinedEntries=indent?indentedJoin(entries,indent):$join.call(entries,', ');return type+' ('+size+') {'+joinedEntries+'}';}function singleLineValues(xs){for(var i=0;i<xs.length;i++){if(indexOf(xs[i],'\n')>=0){return false;}}return true;}function getIndent(opts,depth){var baseIndent;if(opts.indent==='\t'){baseIndent='\t';}else if(typeof opts.indent==='number'&&opts.indent>0){baseIndent=$join.call(Array(opts.indent+1),' ');}else{return null;}return{base:baseIndent,prev:$join.call(Array(depth+1),baseIndent)};}function indentedJoin(xs,indent){if(xs.length===0){return'';}var lineJoiner='\n'+indent.prev+indent.base;return lineJoiner+$join.call(xs,','+lineJoiner)+'\n'+indent.prev;}function arrObjKeys(obj,inspect){var isArr=isArray(obj);var xs=[];if(isArr){xs.length=obj.length;for(var i=0;i<obj.length;i++){xs[i]=has(obj,i)?inspect(obj[i],obj):'';}}var syms=typeof gOPS==='function'?gOPS(obj):[];var symMap;if(hasShammedSymbols){symMap={};for(var k=0;k<syms.length;k++){symMap['$'+syms[k]]=syms[k];}}for(var key in obj){// eslint-disable-line no-restricted-syntax
|
|
1678
1677
|
if(!has(obj,key)){continue;}// eslint-disable-line no-restricted-syntax, no-continue
|
|
1679
1678
|
if(isArr&&String(Number(key))===key&&key<obj.length){continue;}// eslint-disable-line no-restricted-syntax, no-continue
|
|
1680
1679
|
if(hasShammedSymbols&&symMap['$'+key]instanceof Symbol){// this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
|
|
1681
1680
|
continue;// eslint-disable-line no-restricted-syntax, no-continue
|
|
1682
|
-
}else if($test.call(/[^\w$]/,key)){xs.push(inspect(key,obj)+': '+inspect(obj[key],obj));}else{xs.push(key+': '+inspect(obj[key],obj));}}if(typeof gOPS==='function'){for(var j=0;j<syms.length;j++){if(isEnumerable.call(obj,syms[j])){xs.push('['+inspect(syms[j])+']: '+inspect(obj[syms[j]],obj));}}}return xs;}}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"./util.inspect":18}],
|
|
1681
|
+
}else if($test.call(/[^\w$]/,key)){xs.push(inspect(key,obj)+': '+inspect(obj[key],obj));}else{xs.push(key+': '+inspect(obj[key],obj));}}if(typeof gOPS==='function'){for(var j=0;j<syms.length;j++){if(isEnumerable.call(obj,syms[j])){xs.push('['+inspect(syms[j])+']: '+inspect(obj[syms[j]],obj));}}}return xs;}}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"./util.inspect":18}],102:[function(require,module,exports){var wrappy=require('wrappy');module.exports=wrappy(once);module.exports.strict=wrappy(onceStrict);once.proto=once(function(){Object.defineProperty(Function.prototype,'once',{value:function(){return once(this);},configurable:true});Object.defineProperty(Function.prototype,'onceStrict',{value:function(){return onceStrict(this);},configurable:true});});function once(fn){var f=function(){if(f.called)return f.value;f.called=true;return f.value=fn.apply(this,arguments);};f.called=false;return f;}function onceStrict(fn){var f=function(){if(f.called)throw new Error(f.onceError);f.called=true;return f.value=fn.apply(this,arguments);};var name=fn.name||'Function wrapped with `once`';f.onceError=name+" shouldn't be called more than once";f.called=false;return f;}},{"wrappy":147}],103:[function(require,module,exports){(function(process){(function(){// 'path' module extracted from Node.js v8.11.1 (only the posix part)
|
|
1683
1682
|
// transplited with Babel
|
|
1684
1683
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
1685
1684
|
//
|
|
@@ -1761,7 +1760,7 @@ if(startDot===-1)startDot=i;else if(preDotState!==1)preDotState=1;}else if(start
|
|
|
1761
1760
|
// have a good chance at having a non-empty extension
|
|
1762
1761
|
preDotState=-1;}}if(startDot===-1||end===-1||// We saw a non-dot character immediately before the dot
|
|
1763
1762
|
preDotState===0||// The (right-most) trimmed path component is exactly '..'
|
|
1764
|
-
preDotState===1&&startDot===end-1&&startDot===startPart+1){if(end!==-1){if(startPart===0&&isAbsolute)ret.base=ret.name=path.slice(1,end);else ret.base=ret.name=path.slice(startPart,end);}}else{if(startPart===0&&isAbsolute){ret.name=path.slice(1,startDot);ret.base=path.slice(1,end);}else{ret.name=path.slice(startPart,startDot);ret.base=path.slice(startPart,end);}ret.ext=path.slice(startDot,end);}if(startPart>0)ret.dir=path.slice(0,startPart-1);else if(isAbsolute)ret.dir='/';return ret;},sep:'/',delimiter:':',win32:null,posix:null};posix.posix=posix;module.exports=posix;}).call(this);}).call(this,require('_process'));},{"_process":
|
|
1763
|
+
preDotState===1&&startDot===end-1&&startDot===startPart+1){if(end!==-1){if(startPart===0&&isAbsolute)ret.base=ret.name=path.slice(1,end);else ret.base=ret.name=path.slice(startPart,end);}}else{if(startPart===0&&isAbsolute){ret.name=path.slice(1,startDot);ret.base=path.slice(1,end);}else{ret.name=path.slice(startPart,startDot);ret.base=path.slice(startPart,end);}ret.ext=path.slice(startDot,end);}if(startPart>0)ret.dir=path.slice(0,startPart-1);else if(isAbsolute)ret.dir='/';return ret;},sep:'/',delimiter:':',win32:null,posix:null};posix.posix=posix;module.exports=posix;}).call(this);}).call(this,require('_process'));},{"_process":107}],104:[function(require,module,exports){/**
|
|
1765
1764
|
* Precedent Meta-Templating
|
|
1766
1765
|
*
|
|
1767
1766
|
* @license MIT
|
|
@@ -1784,7 +1783,7 @@ preDotState===1&&startDot===end-1&&startDot===startPart+1){if(end!==-1){if(start
|
|
|
1784
1783
|
* @param {string} pString - The string to parse
|
|
1785
1784
|
* @param {object} pData - Data to pass in as the second argument
|
|
1786
1785
|
* @return {string} The result from the parser
|
|
1787
|
-
*/parseString(pString,pData){return this.StringParser.parseString(pString,this.ParseTree,pData);}}module.exports=Precedent;},{"./StringParser.js":
|
|
1786
|
+
*/parseString(pString,pData){return this.StringParser.parseString(pString,this.ParseTree,pData);}}module.exports=Precedent;},{"./StringParser.js":105,"./WordTree.js":106}],105:[function(require,module,exports){/**
|
|
1788
1787
|
* String Parser
|
|
1789
1788
|
* @author Steven Velozo <steven@velozo.com>
|
|
1790
1789
|
* @description Parse a string, properly processing each matched token in the word tree.
|
|
@@ -1837,7 +1836,7 @@ this.resetOutputBuffer(pParserState);this.appendOutputBuffer(pCharacter,pParserS
|
|
|
1837
1836
|
* @param {string} pString - The string to parse.
|
|
1838
1837
|
* @param {Object} pParseTree - The parse tree to begin parsing from (usually root)
|
|
1839
1838
|
* @param {Object} pData - The data to pass to the function as a second parameter
|
|
1840
|
-
*/parseString(pString,pParseTree,pData){let tmpParserState=this.newParserState(pParseTree);for(var i=0;i<pString.length;i++){this.parseCharacter(pString[i],tmpParserState,pData);}this.flushOutputBuffer(tmpParserState);return tmpParserState.Output;}}module.exports=StringParser;},{}],
|
|
1839
|
+
*/parseString(pString,pParseTree,pData){let tmpParserState=this.newParserState(pParseTree);for(var i=0;i<pString.length;i++){this.parseCharacter(pString[i],tmpParserState,pData);}this.flushOutputBuffer(tmpParserState);return tmpParserState.Output;}}module.exports=StringParser;},{}],106:[function(require,module,exports){/**
|
|
1841
1840
|
* Word Tree
|
|
1842
1841
|
* @author Steven Velozo <steven@velozo.com>
|
|
1843
1842
|
* @description Create a tree (directed graph) of Javascript objects, one character per object.
|
|
@@ -1864,7 +1863,7 @@ this.resetOutputBuffer(pParserState);this.appendOutputBuffer(pCharacter,pParserS
|
|
|
1864
1863
|
* @param {function} fParser - The function to parse if this is the matched pattern, once the Pattern End is met. If this is a string, a simple replacement occurs.
|
|
1865
1864
|
* @return {bool} True if adding the pattern was successful
|
|
1866
1865
|
*/addPattern(pPatternStart,pPatternEnd,fParser){if(pPatternStart.length<1){return false;}if(typeof pPatternEnd==='string'&&pPatternEnd.length<1){return false;}let tmpLeaf=this.ParseTree;// Add the tree of leaves iteratively
|
|
1867
|
-
for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternStart[i],i);}if(!tmpLeaf.hasOwnProperty('PatternEnd')){tmpLeaf.PatternEnd={};}let tmpPatternEnd=typeof pPatternEnd==='string'?pPatternEnd:pPatternStart;for(let i=0;i<tmpPatternEnd.length;i++){tmpLeaf=this.addEndChild(tmpLeaf,tmpPatternEnd[i],i);}tmpLeaf.PatternStartString=pPatternStart;tmpLeaf.PatternEndString=tmpPatternEnd;tmpLeaf.Parse=typeof fParser==='function'?fParser:typeof fParser==='string'?()=>{return fParser;}:pData=>{return pData;};return true;}}module.exports=WordTree;},{}],
|
|
1866
|
+
for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternStart[i],i);}if(!tmpLeaf.hasOwnProperty('PatternEnd')){tmpLeaf.PatternEnd={};}let tmpPatternEnd=typeof pPatternEnd==='string'?pPatternEnd:pPatternStart;for(let i=0;i<tmpPatternEnd.length;i++){tmpLeaf=this.addEndChild(tmpLeaf,tmpPatternEnd[i],i);}tmpLeaf.PatternStartString=pPatternStart;tmpLeaf.PatternEndString=tmpPatternEnd;tmpLeaf.Parse=typeof fParser==='function'?fParser:typeof fParser==='string'?()=>{return fParser;}:pData=>{return pData;};return true;}}module.exports=WordTree;},{}],107:[function(require,module,exports){// shim for using process in browser
|
|
1868
1867
|
var process=module.exports={};// cached from whatever global is present so that test runners that stub it
|
|
1869
1868
|
// don't break things. But we need to wrap it in a try catch in case it is
|
|
1870
1869
|
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
|
@@ -1882,7 +1881,7 @@ return cachedClearTimeout.call(null,marker);}catch(e){// same as above but when
|
|
|
1882
1881
|
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
|
1883
1882
|
return cachedClearTimeout.call(this,marker);}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return;}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue);}else{queueIndex=-1;}if(queue.length){drainQueue();}}function drainQueue(){if(draining){return;}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run();}}queueIndex=-1;len=queue.length;}currentQueue=null;draining=false;runClearTimeout(timeout);}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i];}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue);}};// v8 likes predictible objects
|
|
1884
1883
|
function Item(fun,array){this.fun=fun;this.array=array;}Item.prototype.run=function(){this.fun.apply(null,this.array);};process.title='browser';process.browser=true;process.env={};process.argv=[];process.version='';// empty string to avoid regexp issues
|
|
1885
|
-
process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[];};process.binding=function(name){throw new Error('process.binding is not supported');};process.cwd=function(){return'/';};process.chdir=function(dir){throw new Error('process.chdir is not supported');};process.umask=function(){return 0;};},{}],
|
|
1884
|
+
process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[];};process.binding=function(name){throw new Error('process.binding is not supported');};process.cwd=function(){return'/';};process.chdir=function(dir){throw new Error('process.chdir is not supported');};process.umask=function(){return 0;};},{}],108:[function(require,module,exports){(function(global){(function(){/*! https://mths.be/punycode v1.4.1 by @mathias */;(function(root){/** Detect free variables */var freeExports=typeof exports=='object'&&exports&&!exports.nodeType&&exports;var freeModule=typeof module=='object'&&module&&!module.nodeType&&module;var freeGlobal=typeof global=='object'&&global;if(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal||freeGlobal.self===freeGlobal){root=freeGlobal;}/**
|
|
1886
1885
|
* The `punycode` object.
|
|
1887
1886
|
* @name punycode
|
|
1888
1887
|
* @type Object
|
|
@@ -1891,7 +1890,7 @@ process.versions={};function noop(){}process.on=noop;process.addListener=noop;pr
|
|
|
1891
1890
|
delimiter='-',// '\x2D'
|
|
1892
1891
|
/** Regular expressions */regexPunycode=/^xn--/,regexNonASCII=/[^\x20-\x7E]/,// unprintable ASCII chars + non-ASCII chars
|
|
1893
1892
|
regexSeparators=/[\x2E\u3002\uFF0E\uFF61]/g,// RFC 3490 separators
|
|
1894
|
-
/** Error messages */errors={'overflow':'Overflow: input needs wider integers to process','not-basic':'Illegal input >= 0x80 (not a basic code point)','invalid-input':'Invalid input'},/** Convenience shortcuts */baseMinusTMin=base-tMin,floor=Math.floor,stringFromCharCode=String.fromCharCode,/** Temporary variable */key
|
|
1893
|
+
/** Error messages */errors={'overflow':'Overflow: input needs wider integers to process','not-basic':'Illegal input >= 0x80 (not a basic code point)','invalid-input':'Invalid input'},/** Convenience shortcuts */baseMinusTMin=base-tMin,floor=Math.floor,stringFromCharCode=String.fromCharCode,/** Temporary variable */key;/*--------------------------------------------------------------------------*//**
|
|
1895
1894
|
* A generic error utility function.
|
|
1896
1895
|
* @private
|
|
1897
1896
|
* @param {String} type The error type.
|
|
@@ -2022,7 +2021,7 @@ for/* no condition */(q=delta,k=base;;k+=base){t=k<=bias?tMin:k>=bias+tMax?tMax:
|
|
|
2022
2021
|
* Unicode string.
|
|
2023
2022
|
* @returns {String} The Punycode representation of the given domain name or
|
|
2024
2023
|
* email address.
|
|
2025
|
-
*/function toASCII(input){return mapDomain(input,function(string){return regexNonASCII.test(string)?'xn--'+encode(string):string;});}
|
|
2024
|
+
*/function toASCII(input){return mapDomain(input,function(string){return regexNonASCII.test(string)?'xn--'+encode(string):string;});}/*--------------------------------------------------------------------------*//** Define the public API */punycode={/**
|
|
2026
2025
|
* A string representing the current Punycode.js version number.
|
|
2027
2026
|
* @memberOf punycode
|
|
2028
2027
|
* @type String
|
|
@@ -2032,12 +2031,12 @@ for/* no condition */(q=delta,k=base;;k+=base){t=k<=bias?tMin:k>=bias+tMax?tMax:
|
|
|
2032
2031
|
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
|
2033
2032
|
* @memberOf punycode
|
|
2034
2033
|
* @type Object
|
|
2035
|
-
*/'ucs2':{'decode':ucs2decode,'encode':ucs2encode},'decode':decode,'encode':encode,'toASCII':toASCII,'toUnicode':toUnicode};/** Expose `punycode`
|
|
2034
|
+
*/'ucs2':{'decode':ucs2decode,'encode':ucs2encode},'decode':decode,'encode':encode,'toASCII':toASCII,'toUnicode':toUnicode};/** Expose `punycode` */// Some AMD build optimizers, like r.js, check for specific condition patterns
|
|
2036
2035
|
// like the following:
|
|
2037
2036
|
if(typeof define=='function'&&typeof define.amd=='object'&&define.amd){define('punycode',function(){return punycode;});}else if(freeExports&&freeModule){if(module.exports==freeExports){// in Node.js, io.js, or RingoJS v0.8.0+
|
|
2038
2037
|
freeModule.exports=punycode;}else{// in Narwhal or RingoJS v0.7.0-
|
|
2039
2038
|
for(key in punycode){punycode.hasOwnProperty(key)&&(freeExports[key]=punycode[key]);}}}else{// in Rhino or a web browser
|
|
2040
|
-
root.punycode=punycode;}})(this);}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],
|
|
2039
|
+
root.punycode=punycode;}})(this);}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],109:[function(require,module,exports){'use strict';var replace=String.prototype.replace;var percentTwenties=/%20/g;var Format={RFC1738:'RFC1738',RFC3986:'RFC3986'};module.exports={'default':Format.RFC3986,formatters:{RFC1738:function(value){return replace.call(value,percentTwenties,'+');},RFC3986:function(value){return String(value);}},RFC1738:Format.RFC1738,RFC3986:Format.RFC3986};},{}],110:[function(require,module,exports){'use strict';var stringify=require('./stringify');var parse=require('./parse');var formats=require('./formats');module.exports={formats:formats,parse:parse,stringify:stringify};},{"./formats":109,"./parse":111,"./stringify":112}],111:[function(require,module,exports){'use strict';var utils=require('./utils');var has=Object.prototype.hasOwnProperty;var isArray=Array.isArray;var defaults={allowDots:false,allowEmptyArrays:false,allowPrototypes:false,allowSparse:false,arrayLimit:20,charset:'utf-8',charsetSentinel:false,comma:false,decodeDotInKeys:false,decoder:utils.decode,delimiter:'&',depth:5,duplicates:'combine',ignoreQueryPrefix:false,interpretNumericEntities:false,parameterLimit:1000,parseArrays:true,plainObjects:false,strictDepth:false,strictNullHandling:false,throwOnLimitExceeded:false};var interpretNumericEntities=function(str){return str.replace(/&#(\d+);/g,function($0,numberStr){return String.fromCharCode(parseInt(numberStr,10));});};var parseArrayValue=function(val,options,currentArrayLength){if(val&&typeof val==='string'&&options.comma&&val.indexOf(',')>-1){return val.split(',');}if(options.throwOnLimitExceeded&¤tArrayLength>=options.arrayLimit){throw new RangeError('Array limit exceeded. Only '+options.arrayLimit+' element'+(options.arrayLimit===1?'':'s')+' allowed in an array.');}return val;};// This is what browsers will submit when the ✓ character occurs in an
|
|
2041
2040
|
// application/x-www-form-urlencoded body and the encoding of the page containing
|
|
2042
2041
|
// the form is iso-8859-1, or when the submitted form has an accept-charset
|
|
2043
2042
|
// attribute of iso-8859-1. Presumably also with other charsets that do not contain
|
|
@@ -2045,28 +2044,28 @@ root.punycode=punycode;}})(this);}).call(this);}).call(this,typeof global!=="und
|
|
|
2045
2044
|
var isoSentinel='utf8=%26%2310003%3B';// encodeURIComponent('✓')
|
|
2046
2045
|
// These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
|
|
2047
2046
|
var charsetSentinel='utf8=%E2%9C%93';// encodeURIComponent('✓')
|
|
2048
|
-
var parseValues=function parseQueryStringValues(str,options){var obj={__proto__:null};var cleanStr=options.ignoreQueryPrefix?str.replace(/^\?/,''):str;var limit=options.parameterLimit===Infinity?undefined:options.parameterLimit;var parts=cleanStr.split(options.delimiter,limit);var skipIndex=-1;// Keep track of where the utf8 sentinel was found
|
|
2047
|
+
var parseValues=function parseQueryStringValues(str,options){var obj={__proto__:null};var cleanStr=options.ignoreQueryPrefix?str.replace(/^\?/,''):str;cleanStr=cleanStr.replace(/%5B/gi,'[').replace(/%5D/gi,']');var limit=options.parameterLimit===Infinity?undefined:options.parameterLimit;var parts=cleanStr.split(options.delimiter,options.throwOnLimitExceeded?limit+1:limit);if(options.throwOnLimitExceeded&&parts.length>limit){throw new RangeError('Parameter limit exceeded. Only '+limit+' parameter'+(limit===1?'':'s')+' allowed.');}var skipIndex=-1;// Keep track of where the utf8 sentinel was found
|
|
2049
2048
|
var i;var charset=options.charset;if(options.charsetSentinel){for(i=0;i<parts.length;++i){if(parts[i].indexOf('utf8=')===0){if(parts[i]===charsetSentinel){charset='utf-8';}else if(parts[i]===isoSentinel){charset='iso-8859-1';}skipIndex=i;i=parts.length;// The eslint settings do not allow break;
|
|
2050
|
-
}}}for(i=0;i<parts.length;++i){if(i===skipIndex){continue;}var part=parts[i];var bracketEqualsPos=part.indexOf(']=');var pos=bracketEqualsPos===-1?part.indexOf('='):bracketEqualsPos+1;var key
|
|
2049
|
+
}}}for(i=0;i<parts.length;++i){if(i===skipIndex){continue;}var part=parts[i];var bracketEqualsPos=part.indexOf(']=');var pos=bracketEqualsPos===-1?part.indexOf('='):bracketEqualsPos+1;var key;var val;if(pos===-1){key=options.decoder(part,defaults.decoder,charset,'key');val=options.strictNullHandling?null:'';}else{key=options.decoder(part.slice(0,pos),defaults.decoder,charset,'key');val=utils.maybeMap(parseArrayValue(part.slice(pos+1),options,isArray(obj[key])?obj[key].length:0),function(encodedVal){return options.decoder(encodedVal,defaults.decoder,charset,'value');});}if(val&&options.interpretNumericEntities&&charset==='iso-8859-1'){val=interpretNumericEntities(String(val));}if(part.indexOf('[]=')>-1){val=isArray(val)?[val]:val;}var existing=has.call(obj,key);if(existing&&options.duplicates==='combine'){obj[key]=utils.combine(obj[key],val);}else if(!existing||options.duplicates==='last'){obj[key]=val;}}return obj;};var parseObject=function(chain,val,options,valuesParsed){var currentArrayLength=0;if(chain.length>0&&chain[chain.length-1]==='[]'){var parentKey=chain.slice(0,-1).join('');currentArrayLength=Array.isArray(val)&&val[parentKey]?val[parentKey].length:0;}var leaf=valuesParsed?val:parseArrayValue(val,options,currentArrayLength);for(var i=chain.length-1;i>=0;--i){var obj;var root=chain[i];if(root==='[]'&&options.parseArrays){obj=options.allowEmptyArrays&&(leaf===''||options.strictNullHandling&&leaf===null)?[]:utils.combine([],leaf);}else{obj=options.plainObjects?{__proto__:null}:{};var cleanRoot=root.charAt(0)==='['&&root.charAt(root.length-1)===']'?root.slice(1,-1):root;var decodedRoot=options.decodeDotInKeys?cleanRoot.replace(/%2E/g,'.'):cleanRoot;var index=parseInt(decodedRoot,10);if(!options.parseArrays&&decodedRoot===''){obj={0:leaf};}else if(!isNaN(index)&&root!==decodedRoot&&String(index)===decodedRoot&&index>=0&&options.parseArrays&&index<=options.arrayLimit){obj=[];obj[index]=leaf;}else if(decodedRoot!=='__proto__'){obj[decodedRoot]=leaf;}}leaf=obj;}return leaf;};var parseKeys=function parseQueryStringKeys(givenKey,val,options,valuesParsed){if(!givenKey){return;}// Transform dot notation to bracket notation
|
|
2051
2050
|
var key=options.allowDots?givenKey.replace(/\.([^.[]+)/g,'[$1]'):givenKey;// The regex chunks
|
|
2052
2051
|
var brackets=/(\[[^[\]]*])/;var child=/(\[[^[\]]*])/g;// Get the parent
|
|
2053
2052
|
var segment=options.depth>0&&brackets.exec(key);var parent=segment?key.slice(0,segment.index):key;// Stash the parent if it exists
|
|
2054
2053
|
var keys=[];if(parent){// If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
|
|
2055
2054
|
if(!options.plainObjects&&has.call(Object.prototype,parent)){if(!options.allowPrototypes){return;}}keys.push(parent);}// Loop through children appending to the array until we hit depth
|
|
2056
|
-
var i=0;while(options.depth>0&&(segment=child.exec(key))!==null&&i<options.depth){i+=1;if(!options.plainObjects&&has.call(Object.prototype,segment[1].slice(1,-1))){if(!options.allowPrototypes){return;}}keys.push(segment[1]);}// If there's a remainder, just add whatever is left
|
|
2057
|
-
if(segment){keys.push('['+key.slice(segment.index)+']');}return parseObject(keys,val,options,valuesParsed);};var normalizeParseOptions=function normalizeParseOptions(opts){if(!opts){return defaults;}if(opts.decoder!==null&&opts.decoder!==undefined&&typeof opts.decoder!=='function'){throw new TypeError('Decoder has to be a function.');}if(typeof opts.charset!=='undefined'&&opts.charset!=='utf-8'&&opts.charset!=='iso-8859-1'){throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');}var charset=typeof opts.charset==='undefined'?defaults.charset:opts.charset;
|
|
2058
|
-
depth:typeof opts.depth==='number'||opts.depth===false?+opts.depth:defaults.depth,ignoreQueryPrefix:opts.ignoreQueryPrefix===true,interpretNumericEntities:typeof opts.interpretNumericEntities==='boolean'?opts.interpretNumericEntities:defaults.interpretNumericEntities,parameterLimit:typeof opts.parameterLimit==='number'?opts.parameterLimit:defaults.parameterLimit,parseArrays:opts.parseArrays!==false,plainObjects:typeof opts.plainObjects==='boolean'?opts.plainObjects:defaults.plainObjects,strictNullHandling:typeof opts.strictNullHandling==='boolean'?opts.strictNullHandling:defaults.strictNullHandling};};module.exports=function(str,opts){var options=normalizeParseOptions(opts);if(str===''||str===null||typeof str==='undefined'){return options.plainObjects?
|
|
2059
|
-
var keys=Object.keys(tempObj);for(var i=0;i<keys.length;++i){var key=keys[i];var newObj=parseKeys(key,tempObj[key],options,typeof str==='string');obj=utils.merge(obj,newObj,options);}if(options.allowSparse===true){return obj;}return utils.compact(obj);};},{"./utils":
|
|
2060
|
-
indices:false,serializeDate:function serializeDate(date){return toISO.call(date);},skipNulls:false,strictNullHandling:false};var isNonNullishPrimitive=function isNonNullishPrimitive(v){return typeof v==='string'||typeof v==='number'||typeof v==='boolean'||typeof v==='symbol'||typeof v==='bigint';};var sentinel={};var stringify=function stringify(object,prefix,generateArrayPrefix,commaRoundTrip,strictNullHandling,skipNulls,encoder,filter,sort,allowDots,serializeDate,format,formatter,encodeValuesOnly,charset,sideChannel){var obj=object;var tmpSc=sideChannel;var step=0;var findFlag=false;while((tmpSc=tmpSc.get(sentinel))!==void undefined&&!findFlag){// Where object last appeared in the ref tree
|
|
2055
|
+
var i=0;while(options.depth>0&&(segment=child.exec(key))!==null&&i<options.depth){i+=1;if(!options.plainObjects&&has.call(Object.prototype,segment[1].slice(1,-1))){if(!options.allowPrototypes){return;}}keys.push(segment[1]);}// If there's a remainder, check strictDepth option for throw, else just add whatever is left
|
|
2056
|
+
if(segment){if(options.strictDepth===true){throw new RangeError('Input depth exceeded depth option of '+options.depth+' and strictDepth is true');}keys.push('['+key.slice(segment.index)+']');}return parseObject(keys,val,options,valuesParsed);};var normalizeParseOptions=function normalizeParseOptions(opts){if(!opts){return defaults;}if(typeof opts.allowEmptyArrays!=='undefined'&&typeof opts.allowEmptyArrays!=='boolean'){throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');}if(typeof opts.decodeDotInKeys!=='undefined'&&typeof opts.decodeDotInKeys!=='boolean'){throw new TypeError('`decodeDotInKeys` option can only be `true` or `false`, when provided');}if(opts.decoder!==null&&typeof opts.decoder!=='undefined'&&typeof opts.decoder!=='function'){throw new TypeError('Decoder has to be a function.');}if(typeof opts.charset!=='undefined'&&opts.charset!=='utf-8'&&opts.charset!=='iso-8859-1'){throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');}if(typeof opts.throwOnLimitExceeded!=='undefined'&&typeof opts.throwOnLimitExceeded!=='boolean'){throw new TypeError('`throwOnLimitExceeded` option must be a boolean');}var charset=typeof opts.charset==='undefined'?defaults.charset:opts.charset;var duplicates=typeof opts.duplicates==='undefined'?defaults.duplicates:opts.duplicates;if(duplicates!=='combine'&&duplicates!=='first'&&duplicates!=='last'){throw new TypeError('The duplicates option must be either combine, first, or last');}var allowDots=typeof opts.allowDots==='undefined'?opts.decodeDotInKeys===true?true:defaults.allowDots:!!opts.allowDots;return{allowDots:allowDots,allowEmptyArrays:typeof opts.allowEmptyArrays==='boolean'?!!opts.allowEmptyArrays:defaults.allowEmptyArrays,allowPrototypes:typeof opts.allowPrototypes==='boolean'?opts.allowPrototypes:defaults.allowPrototypes,allowSparse:typeof opts.allowSparse==='boolean'?opts.allowSparse:defaults.allowSparse,arrayLimit:typeof opts.arrayLimit==='number'?opts.arrayLimit:defaults.arrayLimit,charset:charset,charsetSentinel:typeof opts.charsetSentinel==='boolean'?opts.charsetSentinel:defaults.charsetSentinel,comma:typeof opts.comma==='boolean'?opts.comma:defaults.comma,decodeDotInKeys:typeof opts.decodeDotInKeys==='boolean'?opts.decodeDotInKeys:defaults.decodeDotInKeys,decoder:typeof opts.decoder==='function'?opts.decoder:defaults.decoder,delimiter:typeof opts.delimiter==='string'||utils.isRegExp(opts.delimiter)?opts.delimiter:defaults.delimiter,// eslint-disable-next-line no-implicit-coercion, no-extra-parens
|
|
2057
|
+
depth:typeof opts.depth==='number'||opts.depth===false?+opts.depth:defaults.depth,duplicates:duplicates,ignoreQueryPrefix:opts.ignoreQueryPrefix===true,interpretNumericEntities:typeof opts.interpretNumericEntities==='boolean'?opts.interpretNumericEntities:defaults.interpretNumericEntities,parameterLimit:typeof opts.parameterLimit==='number'?opts.parameterLimit:defaults.parameterLimit,parseArrays:opts.parseArrays!==false,plainObjects:typeof opts.plainObjects==='boolean'?opts.plainObjects:defaults.plainObjects,strictDepth:typeof opts.strictDepth==='boolean'?!!opts.strictDepth:defaults.strictDepth,strictNullHandling:typeof opts.strictNullHandling==='boolean'?opts.strictNullHandling:defaults.strictNullHandling,throwOnLimitExceeded:typeof opts.throwOnLimitExceeded==='boolean'?opts.throwOnLimitExceeded:false};};module.exports=function(str,opts){var options=normalizeParseOptions(opts);if(str===''||str===null||typeof str==='undefined'){return options.plainObjects?{__proto__:null}:{};}var tempObj=typeof str==='string'?parseValues(str,options):str;var obj=options.plainObjects?{__proto__:null}:{};// Iterate over the keys and setup the new object
|
|
2058
|
+
var keys=Object.keys(tempObj);for(var i=0;i<keys.length;++i){var key=keys[i];var newObj=parseKeys(key,tempObj[key],options,typeof str==='string');obj=utils.merge(obj,newObj,options);}if(options.allowSparse===true){return obj;}return utils.compact(obj);};},{"./utils":113}],112:[function(require,module,exports){'use strict';var getSideChannel=require('side-channel');var utils=require('./utils');var formats=require('./formats');var has=Object.prototype.hasOwnProperty;var arrayPrefixGenerators={brackets:function brackets(prefix){return prefix+'[]';},comma:'comma',indices:function indices(prefix,key){return prefix+'['+key+']';},repeat:function repeat(prefix){return prefix;}};var isArray=Array.isArray;var push=Array.prototype.push;var pushToArray=function(arr,valueOrArray){push.apply(arr,isArray(valueOrArray)?valueOrArray:[valueOrArray]);};var toISO=Date.prototype.toISOString;var defaultFormat=formats['default'];var defaults={addQueryPrefix:false,allowDots:false,allowEmptyArrays:false,arrayFormat:'indices',charset:'utf-8',charsetSentinel:false,commaRoundTrip:false,delimiter:'&',encode:true,encodeDotInKeys:false,encoder:utils.encode,encodeValuesOnly:false,filter:void undefined,format:defaultFormat,formatter:formats.formatters[defaultFormat],// deprecated
|
|
2059
|
+
indices:false,serializeDate:function serializeDate(date){return toISO.call(date);},skipNulls:false,strictNullHandling:false};var isNonNullishPrimitive=function isNonNullishPrimitive(v){return typeof v==='string'||typeof v==='number'||typeof v==='boolean'||typeof v==='symbol'||typeof v==='bigint';};var sentinel={};var stringify=function stringify(object,prefix,generateArrayPrefix,commaRoundTrip,allowEmptyArrays,strictNullHandling,skipNulls,encodeDotInKeys,encoder,filter,sort,allowDots,serializeDate,format,formatter,encodeValuesOnly,charset,sideChannel){var obj=object;var tmpSc=sideChannel;var step=0;var findFlag=false;while((tmpSc=tmpSc.get(sentinel))!==void undefined&&!findFlag){// Where object last appeared in the ref tree
|
|
2061
2060
|
var pos=tmpSc.get(object);step+=1;if(typeof pos!=='undefined'){if(pos===step){throw new RangeError('Cyclic object value');}else{findFlag=true;// Break while
|
|
2062
2061
|
}}if(typeof tmpSc.get(sentinel)==='undefined'){step=0;}}if(typeof filter==='function'){obj=filter(prefix,obj);}else if(obj instanceof Date){obj=serializeDate(obj);}else if(generateArrayPrefix==='comma'&&isArray(obj)){obj=utils.maybeMap(obj,function(value){if(value instanceof Date){return serializeDate(value);}return value;});}if(obj===null){if(strictNullHandling){return encoder&&!encodeValuesOnly?encoder(prefix,defaults.encoder,charset,'key',format):prefix;}obj='';}if(isNonNullishPrimitive(obj)||utils.isBuffer(obj)){if(encoder){var keyValue=encodeValuesOnly?prefix:encoder(prefix,defaults.encoder,charset,'key',format);return[formatter(keyValue)+'='+formatter(encoder(obj,defaults.encoder,charset,'value',format))];}return[formatter(prefix)+'='+formatter(String(obj))];}var values=[];if(typeof obj==='undefined'){return values;}var objKeys;if(generateArrayPrefix==='comma'&&isArray(obj)){// we need to join elements in
|
|
2063
|
-
if(encodeValuesOnly&&encoder){obj=utils.maybeMap(obj,encoder);}objKeys=[{value:obj.length>0?obj.join(',')||null:void undefined}];}else if(isArray(filter)){objKeys=filter;}else{var keys=Object.keys(obj);objKeys=sort?keys.sort(sort):keys;}var adjustedPrefix=commaRoundTrip&&isArray(obj)&&obj.length===1?
|
|
2062
|
+
if(encodeValuesOnly&&encoder){obj=utils.maybeMap(obj,encoder);}objKeys=[{value:obj.length>0?obj.join(',')||null:void undefined}];}else if(isArray(filter)){objKeys=filter;}else{var keys=Object.keys(obj);objKeys=sort?keys.sort(sort):keys;}var encodedPrefix=encodeDotInKeys?String(prefix).replace(/\./g,'%2E'):String(prefix);var adjustedPrefix=commaRoundTrip&&isArray(obj)&&obj.length===1?encodedPrefix+'[]':encodedPrefix;if(allowEmptyArrays&&isArray(obj)&&obj.length===0){return adjustedPrefix+'[]';}for(var j=0;j<objKeys.length;++j){var key=objKeys[j];var value=typeof key==='object'&&key&&typeof key.value!=='undefined'?key.value:obj[key];if(skipNulls&&value===null){continue;}var encodedKey=allowDots&&encodeDotInKeys?String(key).replace(/\./g,'%2E'):String(key);var keyPrefix=isArray(obj)?typeof generateArrayPrefix==='function'?generateArrayPrefix(adjustedPrefix,encodedKey):adjustedPrefix:adjustedPrefix+(allowDots?'.'+encodedKey:'['+encodedKey+']');sideChannel.set(object,step);var valueSideChannel=getSideChannel();valueSideChannel.set(sentinel,sideChannel);pushToArray(values,stringify(value,keyPrefix,generateArrayPrefix,commaRoundTrip,allowEmptyArrays,strictNullHandling,skipNulls,encodeDotInKeys,generateArrayPrefix==='comma'&&encodeValuesOnly&&isArray(obj)?null:encoder,filter,sort,allowDots,serializeDate,format,formatter,encodeValuesOnly,charset,valueSideChannel));}return values;};var normalizeStringifyOptions=function normalizeStringifyOptions(opts){if(!opts){return defaults;}if(typeof opts.allowEmptyArrays!=='undefined'&&typeof opts.allowEmptyArrays!=='boolean'){throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');}if(typeof opts.encodeDotInKeys!=='undefined'&&typeof opts.encodeDotInKeys!=='boolean'){throw new TypeError('`encodeDotInKeys` option can only be `true` or `false`, when provided');}if(opts.encoder!==null&&typeof opts.encoder!=='undefined'&&typeof opts.encoder!=='function'){throw new TypeError('Encoder has to be a function.');}var charset=opts.charset||defaults.charset;if(typeof opts.charset!=='undefined'&&opts.charset!=='utf-8'&&opts.charset!=='iso-8859-1'){throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');}var format=formats['default'];if(typeof opts.format!=='undefined'){if(!has.call(formats.formatters,opts.format)){throw new TypeError('Unknown format option provided.');}format=opts.format;}var formatter=formats.formatters[format];var filter=defaults.filter;if(typeof opts.filter==='function'||isArray(opts.filter)){filter=opts.filter;}var arrayFormat;if(opts.arrayFormat in arrayPrefixGenerators){arrayFormat=opts.arrayFormat;}else if('indices'in opts){arrayFormat=opts.indices?'indices':'repeat';}else{arrayFormat=defaults.arrayFormat;}if('commaRoundTrip'in opts&&typeof opts.commaRoundTrip!=='boolean'){throw new TypeError('`commaRoundTrip` must be a boolean, or absent');}var allowDots=typeof opts.allowDots==='undefined'?opts.encodeDotInKeys===true?true:defaults.allowDots:!!opts.allowDots;return{addQueryPrefix:typeof opts.addQueryPrefix==='boolean'?opts.addQueryPrefix:defaults.addQueryPrefix,allowDots:allowDots,allowEmptyArrays:typeof opts.allowEmptyArrays==='boolean'?!!opts.allowEmptyArrays:defaults.allowEmptyArrays,arrayFormat:arrayFormat,charset:charset,charsetSentinel:typeof opts.charsetSentinel==='boolean'?opts.charsetSentinel:defaults.charsetSentinel,commaRoundTrip:!!opts.commaRoundTrip,delimiter:typeof opts.delimiter==='undefined'?defaults.delimiter:opts.delimiter,encode:typeof opts.encode==='boolean'?opts.encode:defaults.encode,encodeDotInKeys:typeof opts.encodeDotInKeys==='boolean'?opts.encodeDotInKeys:defaults.encodeDotInKeys,encoder:typeof opts.encoder==='function'?opts.encoder:defaults.encoder,encodeValuesOnly:typeof opts.encodeValuesOnly==='boolean'?opts.encodeValuesOnly:defaults.encodeValuesOnly,filter:filter,format:format,formatter:formatter,serializeDate:typeof opts.serializeDate==='function'?opts.serializeDate:defaults.serializeDate,skipNulls:typeof opts.skipNulls==='boolean'?opts.skipNulls:defaults.skipNulls,sort:typeof opts.sort==='function'?opts.sort:null,strictNullHandling:typeof opts.strictNullHandling==='boolean'?opts.strictNullHandling:defaults.strictNullHandling};};module.exports=function(object,opts){var obj=object;var options=normalizeStringifyOptions(opts);var objKeys;var filter;if(typeof options.filter==='function'){filter=options.filter;obj=filter('',obj);}else if(isArray(options.filter)){filter=options.filter;objKeys=filter;}var keys=[];if(typeof obj!=='object'||obj===null){return'';}var generateArrayPrefix=arrayPrefixGenerators[options.arrayFormat];var commaRoundTrip=generateArrayPrefix==='comma'&&options.commaRoundTrip;if(!objKeys){objKeys=Object.keys(obj);}if(options.sort){objKeys.sort(options.sort);}var sideChannel=getSideChannel();for(var i=0;i<objKeys.length;++i){var key=objKeys[i];var value=obj[key];if(options.skipNulls&&value===null){continue;}pushToArray(keys,stringify(value,key,generateArrayPrefix,commaRoundTrip,options.allowEmptyArrays,options.strictNullHandling,options.skipNulls,options.encodeDotInKeys,options.encode?options.encoder:null,options.filter,options.sort,options.allowDots,options.serializeDate,options.format,options.formatter,options.encodeValuesOnly,options.charset,sideChannel));}var joined=keys.join(options.delimiter);var prefix=options.addQueryPrefix===true?'?':'';if(options.charsetSentinel){if(options.charset==='iso-8859-1'){// encodeURIComponent('✓'), the "numeric entity" representation of a checkmark
|
|
2064
2063
|
prefix+='utf8=%26%2310003%3B&';}else{// encodeURIComponent('✓')
|
|
2065
|
-
prefix+='utf8=%E2%9C%93&';}}return joined.length>0?prefix+joined:'';};},{"./formats":
|
|
2064
|
+
prefix+='utf8=%E2%9C%93&';}}return joined.length>0?prefix+joined:'';};},{"./formats":109,"./utils":113,"side-channel":121}],113:[function(require,module,exports){'use strict';var formats=require('./formats');var has=Object.prototype.hasOwnProperty;var isArray=Array.isArray;var hexTable=function(){var array=[];for(var i=0;i<256;++i){array.push('%'+((i<16?'0':'')+i.toString(16)).toUpperCase());}return array;}();var compactQueue=function compactQueue(queue){while(queue.length>1){var item=queue.pop();var obj=item.obj[item.prop];if(isArray(obj)){var compacted=[];for(var j=0;j<obj.length;++j){if(typeof obj[j]!=='undefined'){compacted.push(obj[j]);}}item.obj[item.prop]=compacted;}}};var arrayToObject=function arrayToObject(source,options){var obj=options&&options.plainObjects?{__proto__:null}:{};for(var i=0;i<source.length;++i){if(typeof source[i]!=='undefined'){obj[i]=source[i];}}return obj;};var merge=function merge(target,source,options){/* eslint no-param-reassign: 0 */if(!source){return target;}if(typeof source!=='object'&&typeof source!=='function'){if(isArray(target)){target.push(source);}else if(target&&typeof target==='object'){if(options&&(options.plainObjects||options.allowPrototypes)||!has.call(Object.prototype,source)){target[source]=true;}}else{return[target,source];}return target;}if(!target||typeof target!=='object'){return[target].concat(source);}var mergeTarget=target;if(isArray(target)&&!isArray(source)){mergeTarget=arrayToObject(target,options);}if(isArray(target)&&isArray(source)){source.forEach(function(item,i){if(has.call(target,i)){var targetItem=target[i];if(targetItem&&typeof targetItem==='object'&&item&&typeof item==='object'){target[i]=merge(targetItem,item,options);}else{target.push(item);}}else{target[i]=item;}});return target;}return Object.keys(source).reduce(function(acc,key){var value=source[key];if(has.call(acc,key)){acc[key]=merge(acc[key],value,options);}else{acc[key]=value;}return acc;},mergeTarget);};var assign=function assignSingleSource(target,source){return Object.keys(source).reduce(function(acc,key){acc[key]=source[key];return acc;},target);};var decode=function(str,defaultDecoder,charset){var strWithoutPlus=str.replace(/\+/g,' ');if(charset==='iso-8859-1'){// unescape never throws, no try...catch needed:
|
|
2066
2065
|
return strWithoutPlus.replace(/%[0-9a-f]{2}/gi,unescape);}// utf-8
|
|
2067
|
-
try{return decodeURIComponent(strWithoutPlus);}catch(e){return strWithoutPlus;}};var encode=function encode(str,defaultEncoder,charset,kind,format){// This code was originally written by Brian White (mscdex) for the io.js core querystring library.
|
|
2066
|
+
try{return decodeURIComponent(strWithoutPlus);}catch(e){return strWithoutPlus;}};var limit=1024;/* eslint operator-linebreak: [2, "before"] */var encode=function encode(str,defaultEncoder,charset,kind,format){// This code was originally written by Brian White (mscdex) for the io.js core querystring library.
|
|
2068
2067
|
// It has been adapted here for stricter adherence to RFC 3986
|
|
2069
|
-
if(str.length===0){return str;}var string=str;if(typeof str==='symbol'){string=Symbol.prototype.toString.call(str);}else if(typeof str!=='string'){string=String(str);}if(charset==='iso-8859-1'){return escape(string).replace(/%u[0-9a-f]{4}/gi,function($0){return'%26%23'+parseInt($0.slice(2),16)+'%3B';});}var out='';for(var i=0;i<
|
|
2068
|
+
if(str.length===0){return str;}var string=str;if(typeof str==='symbol'){string=Symbol.prototype.toString.call(str);}else if(typeof str!=='string'){string=String(str);}if(charset==='iso-8859-1'){return escape(string).replace(/%u[0-9a-f]{4}/gi,function($0){return'%26%23'+parseInt($0.slice(2),16)+'%3B';});}var out='';for(var j=0;j<string.length;j+=limit){var segment=string.length>=limit?string.slice(j,j+limit):string;var arr=[];for(var i=0;i<segment.length;++i){var c=segment.charCodeAt(i);if(c===0x2D// -
|
|
2070
2069
|
||c===0x2E// .
|
|
2071
2070
|
||c===0x5F// _
|
|
2072
2071
|
||c===0x7E// ~
|
|
@@ -2074,7 +2073,7 @@ if(str.length===0){return str;}var string=str;if(typeof str==='symbol'){string=S
|
|
|
2074
2073
|
||c>=0x41&&c<=0x5A// a-z
|
|
2075
2074
|
||c>=0x61&&c<=0x7A// A-Z
|
|
2076
2075
|
||format===formats.RFC1738&&(c===0x28||c===0x29)// ( )
|
|
2077
|
-
){
|
|
2076
|
+
){arr[arr.length]=segment.charAt(i);continue;}if(c<0x80){arr[arr.length]=hexTable[c];continue;}if(c<0x800){arr[arr.length]=hexTable[0xC0|c>>6]+hexTable[0x80|c&0x3F];continue;}if(c<0xD800||c>=0xE000){arr[arr.length]=hexTable[0xE0|c>>12]+hexTable[0x80|c>>6&0x3F]+hexTable[0x80|c&0x3F];continue;}i+=1;c=0x10000+((c&0x3FF)<<10|segment.charCodeAt(i)&0x3FF);arr[arr.length]=hexTable[0xF0|c>>18]+hexTable[0x80|c>>12&0x3F]+hexTable[0x80|c>>6&0x3F]+hexTable[0x80|c&0x3F];}out+=arr.join('');}return out;};var compact=function compact(value){var queue=[{obj:{o:value},prop:'o'}];var refs=[];for(var i=0;i<queue.length;++i){var item=queue[i];var obj=item.obj[item.prop];var keys=Object.keys(obj);for(var j=0;j<keys.length;++j){var key=keys[j];var val=obj[key];if(typeof val==='object'&&val!==null&&refs.indexOf(val)===-1){queue.push({obj:obj,prop:key});refs.push(val);}}}compactQueue(queue);return value;};var isRegExp=function isRegExp(obj){return Object.prototype.toString.call(obj)==='[object RegExp]';};var isBuffer=function isBuffer(obj){if(!obj||typeof obj!=='object'){return false;}return!!(obj.constructor&&obj.constructor.isBuffer&&obj.constructor.isBuffer(obj));};var combine=function combine(a,b){return[].concat(a,b);};var maybeMap=function maybeMap(val,fn){if(isArray(val)){var mapped=[];for(var i=0;i<val.length;i+=1){mapped.push(fn(val[i]));}return mapped;}return fn(val);};module.exports={arrayToObject:arrayToObject,assign:assign,combine:combine,compact:compact,decode:decode,encode:encode,isBuffer:isBuffer,isRegExp:isRegExp,maybeMap:maybeMap,merge:merge};},{"./formats":109}],114:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
2078
2077
|
//
|
|
2079
2078
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2080
2079
|
// copy of this software and associated documentation files (the
|
|
@@ -2098,7 +2097,7 @@ if(str.length===0){return str;}var string=str;if(typeof str==='symbol'){string=S
|
|
|
2098
2097
|
// obj.hasOwnProperty(prop) will break.
|
|
2099
2098
|
// See: https://github.com/joyent/node/issues/1707
|
|
2100
2099
|
function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop);}module.exports=function(qs,sep,eq,options){sep=sep||'&';eq=eq||'=';var obj={};if(typeof qs!=='string'||qs.length===0){return obj;}var regexp=/\+/g;qs=qs.split(sep);var maxKeys=1000;if(options&&typeof options.maxKeys==='number'){maxKeys=options.maxKeys;}var len=qs.length;// maxKeys <= 0 means that we should not limit keys count
|
|
2101
|
-
if(maxKeys>0&&len>maxKeys){len=maxKeys;}for(var i=0;i<len;++i){var x=qs[i].replace(regexp,'%20'),idx=x.indexOf(eq),kstr,vstr,k,v;if(idx>=0){kstr=x.substr(0,idx);vstr=x.substr(idx+1);}else{kstr=x;vstr='';}k=decodeURIComponent(kstr);v=decodeURIComponent(vstr);if(!hasOwnProperty(obj,k)){obj[k]=v;}else if(isArray(obj[k])){obj[k].push(v);}else{obj[k]=[obj[k],v];}}return obj;};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==='[object Array]';};},{}],
|
|
2100
|
+
if(maxKeys>0&&len>maxKeys){len=maxKeys;}for(var i=0;i<len;++i){var x=qs[i].replace(regexp,'%20'),idx=x.indexOf(eq),kstr,vstr,k,v;if(idx>=0){kstr=x.substr(0,idx);vstr=x.substr(idx+1);}else{kstr=x;vstr='';}k=decodeURIComponent(kstr);v=decodeURIComponent(vstr);if(!hasOwnProperty(obj,k)){obj[k]=v;}else if(isArray(obj[k])){obj[k].push(v);}else{obj[k]=[obj[k],v];}}return obj;};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==='[object Array]';};},{}],115:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
2102
2101
|
//
|
|
2103
2102
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2104
2103
|
// copy of this software and associated documentation files (the
|
|
@@ -2118,22 +2117,31 @@ if(maxKeys>0&&len>maxKeys){len=maxKeys;}for(var i=0;i<len;++i){var x=qs[i].repla
|
|
|
2118
2117
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
2119
2118
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
2120
2119
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
2121
|
-
'use strict';var stringifyPrimitive=function(v){switch(typeof v){case'string':return v;case'boolean':return v?'true':'false';case'number':return isFinite(v)?v:'';default:return'';}};module.exports=function(obj,sep,eq,name){sep=sep||'&';eq=eq||'=';if(obj===null){obj=undefined;}if(typeof obj==='object'){return map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;if(isArray(obj[k])){return map(obj[k],function(v){return ks+encodeURIComponent(stringifyPrimitive(v));}).join(sep);}else{return ks+encodeURIComponent(stringifyPrimitive(obj[k]));}}).join(sep);}if(!name)return'';return encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj));};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==='[object Array]';};function map(xs,f){if(xs.map)return xs.map(f);var res=[];for(var i=0;i<xs.length;i++){res.push(f(xs[i],i));}return res;}var objectKeys=Object.keys||function(obj){var res=[];for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))res.push(key);}return res;};},{}],
|
|
2120
|
+
'use strict';var stringifyPrimitive=function(v){switch(typeof v){case'string':return v;case'boolean':return v?'true':'false';case'number':return isFinite(v)?v:'';default:return'';}};module.exports=function(obj,sep,eq,name){sep=sep||'&';eq=eq||'=';if(obj===null){obj=undefined;}if(typeof obj==='object'){return map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;if(isArray(obj[k])){return map(obj[k],function(v){return ks+encodeURIComponent(stringifyPrimitive(v));}).join(sep);}else{return ks+encodeURIComponent(stringifyPrimitive(obj[k]));}}).join(sep);}if(!name)return'';return encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj));};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==='[object Array]';};function map(xs,f){if(xs.map)return xs.map(f);var res=[];for(var i=0;i<xs.length;i++){res.push(f(xs[i],i));}return res;}var objectKeys=Object.keys||function(obj){var res=[];for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))res.push(key);}return res;};},{}],116:[function(require,module,exports){'use strict';exports.decode=exports.parse=require('./decode');exports.encode=exports.stringify=require('./encode');},{"./decode":114,"./encode":115}],117:[function(require,module,exports){/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *//* eslint-disable node/no-deprecated-api */var buffer=require('buffer');var Buffer=buffer.Buffer;// alternative to using Object.keys for old browsers
|
|
2122
2121
|
function copyProps(src,dst){for(var key in src){dst[key]=src[key];}}if(Buffer.from&&Buffer.alloc&&Buffer.allocUnsafe&&Buffer.allocUnsafeSlow){module.exports=buffer;}else{// Copy properties from require('buffer')
|
|
2123
2122
|
copyProps(buffer,exports);exports.Buffer=SafeBuffer;}function SafeBuffer(arg,encodingOrOffset,length){return Buffer(arg,encodingOrOffset,length);}SafeBuffer.prototype=Object.create(Buffer.prototype);// Copy static methods from Buffer
|
|
2124
|
-
copyProps(Buffer,SafeBuffer);SafeBuffer.from=function(arg,encodingOrOffset,length){if(typeof arg==='number'){throw new TypeError('Argument must not be a number');}return Buffer(arg,encodingOrOffset,length);};SafeBuffer.alloc=function(size,fill,encoding){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}var buf=Buffer(size);if(fill!==undefined){if(typeof encoding==='string'){buf.fill(fill,encoding);}else{buf.fill(fill);}}else{buf.fill(0);}return buf;};SafeBuffer.allocUnsafe=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return Buffer(size);};SafeBuffer.allocUnsafeSlow=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return buffer.SlowBuffer(size);};},{"buffer":20}],
|
|
2123
|
+
copyProps(Buffer,SafeBuffer);SafeBuffer.from=function(arg,encodingOrOffset,length){if(typeof arg==='number'){throw new TypeError('Argument must not be a number');}return Buffer(arg,encodingOrOffset,length);};SafeBuffer.alloc=function(size,fill,encoding){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}var buf=Buffer(size);if(fill!==undefined){if(typeof encoding==='string'){buf.fill(fill,encoding);}else{buf.fill(fill);}}else{buf.fill(0);}return buf;};SafeBuffer.allocUnsafe=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return Buffer(size);};SafeBuffer.allocUnsafeSlow=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return buffer.SlowBuffer(size);};},{"buffer":20}],118:[function(require,module,exports){'use strict';var inspect=require('object-inspect');var $TypeError=require('es-errors/type');/*
|
|
2125
2124
|
* This function traverses the list returning the node corresponding to the given key.
|
|
2126
2125
|
*
|
|
2127
|
-
* That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list.
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2126
|
+
* That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list.
|
|
2127
|
+
* By doing so, all the recently used nodes can be accessed relatively quickly.
|
|
2128
|
+
*//** @type {import('./list.d.ts').listGetNode} */// eslint-disable-next-line consistent-return
|
|
2129
|
+
var listGetNode=function(list,key,isDelete){/** @type {typeof list | NonNullable<(typeof list)['next']>} */var prev=list;/** @type {(typeof list)['next']} */var curr;// eslint-disable-next-line eqeqeq
|
|
2130
|
+
for(;(curr=prev.next)!=null;prev=curr){if(curr.key===key){prev.next=curr.next;if(!isDelete){// eslint-disable-next-line no-extra-parens
|
|
2131
|
+
curr.next=/** @type {NonNullable<typeof list.next>} */list.next;list.next=curr;// eslint-disable-line no-param-reassign
|
|
2132
|
+
}return curr;}}};/** @type {import('./list.d.ts').listGet} */var listGet=function(objects,key){if(!objects){return void undefined;}var node=listGetNode(objects,key);return node&&node.value;};/** @type {import('./list.d.ts').listSet} */var listSet=function(objects,key,value){var node=listGetNode(objects,key);if(node){node.value=value;}else{// Prepend the new node to the beginning of the list
|
|
2133
|
+
objects.next=/** @type {import('./list.d.ts').ListNode<typeof value, typeof key>} */{// eslint-disable-line no-param-reassign, no-extra-parens
|
|
2134
|
+
key:key,next:objects.next,value:value};}};/** @type {import('./list.d.ts').listHas} */var listHas=function(objects,key){if(!objects){return false;}return!!listGetNode(objects,key);};/** @type {import('./list.d.ts').listDelete} */// eslint-disable-next-line consistent-return
|
|
2135
|
+
var listDelete=function(objects,key){if(objects){return listGetNode(objects,key,true);}};/** @type {import('.')} */module.exports=function getSideChannelList(){/** @typedef {ReturnType<typeof getSideChannelList>} Channel *//** @typedef {Parameters<Channel['get']>[0]} K *//** @typedef {Parameters<Channel['set']>[1]} V *//** @type {import('./list.d.ts').RootNode<V, K> | undefined} */var $o;/** @type {Channel} */var channel={assert:function(key){if(!channel.has(key)){throw new $TypeError('Side channel does not contain '+inspect(key));}},'delete':function(key){var root=$o&&$o.next;var deletedNode=listDelete($o,key);if(deletedNode&&root&&root===deletedNode){$o=void undefined;}return!!deletedNode;},get:function(key){return listGet($o,key);},has:function(key){return listHas($o,key);},set:function(key,value){if(!$o){// Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head
|
|
2136
|
+
$o={next:void undefined};}// eslint-disable-next-line no-extra-parens
|
|
2137
|
+
listSet(/** @type {NonNullable<typeof $o>} */$o,key,value);}};// @ts-expect-error TODO: figure out why this is erroring
|
|
2138
|
+
return channel;};},{"es-errors/type":47,"object-inspect":101}],119:[function(require,module,exports){'use strict';var GetIntrinsic=require('get-intrinsic');var callBound=require('call-bound');var inspect=require('object-inspect');var $TypeError=require('es-errors/type');var $Map=GetIntrinsic('%Map%',true);/** @type {<K, V>(thisArg: Map<K, V>, key: K) => V} */var $mapGet=callBound('Map.prototype.get',true);/** @type {<K, V>(thisArg: Map<K, V>, key: K, value: V) => void} */var $mapSet=callBound('Map.prototype.set',true);/** @type {<K, V>(thisArg: Map<K, V>, key: K) => boolean} */var $mapHas=callBound('Map.prototype.has',true);/** @type {<K, V>(thisArg: Map<K, V>, key: K) => boolean} */var $mapDelete=callBound('Map.prototype.delete',true);/** @type {<K, V>(thisArg: Map<K, V>) => number} */var $mapSize=callBound('Map.prototype.size',true);/** @type {import('.')} */module.exports=!!$Map&&/** @type {Exclude<import('.'), false>} */function getSideChannelMap(){/** @typedef {ReturnType<typeof getSideChannelMap>} Channel *//** @typedef {Parameters<Channel['get']>[0]} K *//** @typedef {Parameters<Channel['set']>[1]} V *//** @type {Map<K, V> | undefined} */var $m;/** @type {Channel} */var channel={assert:function(key){if(!channel.has(key)){throw new $TypeError('Side channel does not contain '+inspect(key));}},'delete':function(key){if($m){var result=$mapDelete($m,key);if($mapSize($m)===0){$m=void undefined;}return result;}return false;},get:function(key){// eslint-disable-line consistent-return
|
|
2139
|
+
if($m){return $mapGet($m,key);}},has:function(key){if($m){return $mapHas($m,key);}return false;},set:function(key,value){if(!$m){// @ts-expect-error TS can't handle narrowing a variable inside a closure
|
|
2140
|
+
$m=new $Map();}$mapSet($m,key,value);}};// @ts-expect-error TODO: figure out why TS is erroring here
|
|
2141
|
+
return channel;};},{"call-bound":30,"es-errors/type":47,"get-intrinsic":69,"object-inspect":101}],120:[function(require,module,exports){'use strict';var GetIntrinsic=require('get-intrinsic');var callBound=require('call-bound');var inspect=require('object-inspect');var getSideChannelMap=require('side-channel-map');var $TypeError=require('es-errors/type');var $WeakMap=GetIntrinsic('%WeakMap%',true);/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => V} */var $weakMapGet=callBound('WeakMap.prototype.get',true);/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K, value: V) => void} */var $weakMapSet=callBound('WeakMap.prototype.set',true);/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => boolean} */var $weakMapHas=callBound('WeakMap.prototype.has',true);/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => boolean} */var $weakMapDelete=callBound('WeakMap.prototype.delete',true);/** @type {import('.')} */module.exports=$WeakMap?/** @type {Exclude<import('.'), false>} */function getSideChannelWeakMap(){/** @typedef {ReturnType<typeof getSideChannelWeakMap>} Channel *//** @typedef {Parameters<Channel['get']>[0]} K *//** @typedef {Parameters<Channel['set']>[1]} V *//** @type {WeakMap<K & object, V> | undefined} */var $wm;/** @type {Channel | undefined} */var $m;/** @type {Channel} */var channel={assert:function(key){if(!channel.has(key)){throw new $TypeError('Side channel does not contain '+inspect(key));}},'delete':function(key){if($WeakMap&&key&&(typeof key==='object'||typeof key==='function')){if($wm){return $weakMapDelete($wm,key);}}else if(getSideChannelMap){if($m){return $m['delete'](key);}}return false;},get:function(key){if($WeakMap&&key&&(typeof key==='object'||typeof key==='function')){if($wm){return $weakMapGet($wm,key);}}return $m&&$m.get(key);},has:function(key){if($WeakMap&&key&&(typeof key==='object'||typeof key==='function')){if($wm){return $weakMapHas($wm,key);}}return!!$m&&$m.has(key);},set:function(key,value){if($WeakMap&&key&&(typeof key==='object'||typeof key==='function')){if(!$wm){$wm=new $WeakMap();}$weakMapSet($wm,key,value);}else if(getSideChannelMap){if(!$m){$m=getSideChannelMap();}// eslint-disable-next-line no-extra-parens
|
|
2142
|
+
/** @type {NonNullable<typeof $m>} */$m.set(key,value);}}};// @ts-expect-error TODO: figure out why this is erroring
|
|
2143
|
+
return channel;}:getSideChannelMap;},{"call-bound":30,"es-errors/type":47,"get-intrinsic":69,"object-inspect":101,"side-channel-map":119}],121:[function(require,module,exports){'use strict';var $TypeError=require('es-errors/type');var inspect=require('object-inspect');var getSideChannelList=require('side-channel-list');var getSideChannelMap=require('side-channel-map');var getSideChannelWeakMap=require('side-channel-weakmap');var makeChannel=getSideChannelWeakMap||getSideChannelMap||getSideChannelList;/** @type {import('.')} */module.exports=function getSideChannel(){/** @typedef {ReturnType<typeof getSideChannel>} Channel *//** @type {Channel | undefined} */var $channelData;/** @type {Channel} */var channel={assert:function(key){if(!channel.has(key)){throw new $TypeError('Side channel does not contain '+inspect(key));}},'delete':function(key){return!!$channelData&&$channelData['delete'](key);},get:function(key){return $channelData&&$channelData.get(key);},has:function(key){return!!$channelData&&$channelData.has(key);},set:function(key,value){if(!$channelData){$channelData=makeChannel();}$channelData.set(key,value);}};// @ts-expect-error TODO: figure out why this is erroring
|
|
2144
|
+
return channel;};},{"es-errors/type":47,"object-inspect":101,"side-channel-list":118,"side-channel-map":119,"side-channel-weakmap":120}],122:[function(require,module,exports){(function(Buffer){(function(){/*! simple-concat. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */module.exports=function(stream,cb){var chunks=[];stream.on('data',function(chunk){chunks.push(chunk);});stream.once('end',function(){if(cb)cb(null,Buffer.concat(chunks));cb=null;});stream.once('error',function(err){if(cb)cb(err);cb=null;});};}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":20}],123:[function(require,module,exports){(function(Buffer){(function(){/*! simple-get. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */module.exports=simpleGet;const concat=require('simple-concat');const decompressResponse=require('decompress-response');// excluded from browser build
|
|
2137
2145
|
const http=require('http');const https=require('https');const once=require('once');const querystring=require('querystring');const url=require('url');const isStream=o=>o!==null&&typeof o==='object'&&typeof o.pipe==='function';function simpleGet(opts,cb){opts=Object.assign({maxRedirects:10},typeof opts==='string'?{url:opts}:opts);cb=once(cb);if(opts.url){const{hostname,port,protocol,auth,path}=url.parse(opts.url);// eslint-disable-line node/no-deprecated-api
|
|
2138
2146
|
delete opts.url;if(!hostname&&!port&&!protocol&&!auth)opts.path=path;// Relative redirect
|
|
2139
2147
|
else Object.assign(opts,{hostname,port,protocol,auth,path});// Absolute redirect
|
|
@@ -2145,13 +2153,13 @@ res.resume();// Discard response
|
|
|
2145
2153
|
const redirectHost=url.parse(opts.url).hostname;// eslint-disable-line node/no-deprecated-api
|
|
2146
2154
|
// If redirected host is different than original host, drop headers to prevent cookie leak (#73)
|
|
2147
2155
|
if(redirectHost!==null&&redirectHost!==originalHost){delete opts.headers.cookie;delete opts.headers.authorization;}if(opts.method==='POST'&&[301,302].includes(res.statusCode)){opts.method='GET';// On 301/302 redirect, change POST to GET (see #35)
|
|
2148
|
-
delete opts.headers['content-length'];delete opts.headers['content-type'];}if(opts.maxRedirects--===0)return cb(new Error('too many redirects'));else return simpleGet(opts,cb);}const tryUnzip=typeof decompressResponse==='function'&&opts.method!=='HEAD';cb(null,tryUnzip?decompressResponse(res):res);});req.on('timeout',()=>{req.abort();cb(new Error('Request timed out'));});req.on('error',cb);if(isStream(body))body.on('error',cb).pipe(req);else req.end(body);return req;}simpleGet.concat=(opts,cb)=>{return simpleGet(opts,(err,res)=>{if(err)return cb(err);concat(res,(err,data)=>{if(err)return cb(err);if(opts.json){try{data=JSON.parse(data.toString());}catch(err){return cb(err,res,data);}}cb(null,res,data);});});};['get','post','put','patch','head','delete'].forEach(method=>{simpleGet[method]=(opts,cb)=>{if(typeof opts==='string')opts={url:opts};return simpleGet(Object.assign({method:method.toUpperCase()},opts),cb);};});}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":20,"decompress-response":18,"http":
|
|
2156
|
+
delete opts.headers['content-length'];delete opts.headers['content-type'];}if(opts.maxRedirects--===0)return cb(new Error('too many redirects'));else return simpleGet(opts,cb);}const tryUnzip=typeof decompressResponse==='function'&&opts.method!=='HEAD';cb(null,tryUnzip?decompressResponse(res):res);});req.on('timeout',()=>{req.abort();cb(new Error('Request timed out'));});req.on('error',cb);if(isStream(body))body.on('error',cb).pipe(req);else req.end(body);return req;}simpleGet.concat=(opts,cb)=>{return simpleGet(opts,(err,res)=>{if(err)return cb(err);concat(res,(err,data)=>{if(err)return cb(err);if(opts.json){try{data=JSON.parse(data.toString());}catch(err){return cb(err,res,data);}}cb(null,res,data);});});};['get','post','put','patch','head','delete'].forEach(method=>{simpleGet[method]=(opts,cb)=>{if(typeof opts==='string')opts={url:opts};return simpleGet(Object.assign({method:method.toUpperCase()},opts),cb);};});}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":20,"decompress-response":18,"http":124,"https":78,"once":102,"querystring":116,"simple-concat":122,"url":145}],124:[function(require,module,exports){(function(global){(function(){var ClientRequest=require('./lib/request');var response=require('./lib/response');var extend=require('xtend');var statusCodes=require('builtin-status-codes');var url=require('url');var http=exports;http.request=function(opts,cb){if(typeof opts==='string')opts=url.parse(opts);else opts=extend(opts);// Normally, the page is loaded from http or https, so not specifying a protocol
|
|
2149
2157
|
// will result in a (valid) protocol-relative url. However, this won't work if
|
|
2150
2158
|
// the protocol is something else, like 'file:'
|
|
2151
2159
|
var defaultProtocol=global.location.protocol.search(/^https?:$/)===-1?'http:':'';var protocol=opts.protocol||defaultProtocol;var host=opts.hostname||opts.host;var port=opts.port;var path=opts.path||'/';// Necessary for IPv6 addresses
|
|
2152
2160
|
if(host&&host.indexOf(':')!==-1)host='['+host+']';// This may be a relative url. The browser should always be able to interpret it correctly.
|
|
2153
2161
|
opts.url=(host?protocol+'//'+host:'')+(port?':'+port:'')+path;opts.method=(opts.method||'GET').toUpperCase();opts.headers=opts.headers||{};// Also valid opts.auth, opts.mode
|
|
2154
|
-
var req=new ClientRequest(opts);if(cb)req.on('response',cb);return req;};http.get=function get(opts,cb){var req=http.request(opts,cb);req.end();return req;};http.ClientRequest=ClientRequest;http.IncomingMessage=response.IncomingMessage;http.Agent=function(){};http.Agent.defaultMaxSockets=4;http.globalAgent=new http.Agent();http.STATUS_CODES=statusCodes;http.METHODS=['CHECKOUT','CONNECT','COPY','DELETE','GET','HEAD','LOCK','M-SEARCH','MERGE','MKACTIVITY','MKCOL','MOVE','NOTIFY','OPTIONS','PATCH','POST','PROPFIND','PROPPATCH','PURGE','PUT','REPORT','SEARCH','SUBSCRIBE','TRACE','UNLOCK','UNSUBSCRIBE'];}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"./lib/request":
|
|
2162
|
+
var req=new ClientRequest(opts);if(cb)req.on('response',cb);return req;};http.get=function get(opts,cb){var req=http.request(opts,cb);req.end();return req;};http.ClientRequest=ClientRequest;http.IncomingMessage=response.IncomingMessage;http.Agent=function(){};http.Agent.defaultMaxSockets=4;http.globalAgent=new http.Agent();http.STATUS_CODES=statusCodes;http.METHODS=['CHECKOUT','CONNECT','COPY','DELETE','GET','HEAD','LOCK','M-SEARCH','MERGE','MKACTIVITY','MKCOL','MOVE','NOTIFY','OPTIONS','PATCH','POST','PROPFIND','PROPPATCH','PURGE','PUT','REPORT','SEARCH','SUBSCRIBE','TRACE','UNLOCK','UNSUBSCRIBE'];}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"./lib/request":126,"./lib/response":127,"builtin-status-codes":21,"url":145,"xtend":148}],125:[function(require,module,exports){(function(global){(function(){exports.fetch=isFunction(global.fetch)&&isFunction(global.ReadableStream);exports.writableStream=isFunction(global.WritableStream);exports.abortController=isFunction(global.AbortController);// The xhr request to example.com may violate some restrictive CSP configurations,
|
|
2155
2163
|
// so if we're running in a browser that supports `fetch`, avoid calling getXHR()
|
|
2156
2164
|
// and assume support for certain features below.
|
|
2157
2165
|
var xhr;function getXHR(){// Cache the xhr value
|
|
@@ -2166,7 +2174,7 @@ exports.arraybuffer=exports.fetch||checkTypeSupport('arraybuffer');// These next
|
|
|
2166
2174
|
exports.msstream=!exports.fetch&&checkTypeSupport('ms-stream');exports.mozchunkedarraybuffer=!exports.fetch&&checkTypeSupport('moz-chunked-arraybuffer');// If fetch is supported, then overrideMimeType will be supported too. Skip calling
|
|
2167
2175
|
// getXHR().
|
|
2168
2176
|
exports.overrideMimeType=exports.fetch||(getXHR()?isFunction(getXHR().overrideMimeType):false);function isFunction(value){return typeof value==='function';}xhr=null;// Help gc
|
|
2169
|
-
}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],
|
|
2177
|
+
}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],126:[function(require,module,exports){(function(process,global,Buffer){(function(){var capability=require('./capability');var inherits=require('inherits');var response=require('./response');var stream=require('readable-stream');var IncomingMessage=response.IncomingMessage;var rStates=response.readyStates;function decideMode(preferBinary,useFetch){if(capability.fetch&&useFetch){return'fetch';}else if(capability.mozchunkedarraybuffer){return'moz-chunked-arraybuffer';}else if(capability.msstream){return'ms-stream';}else if(capability.arraybuffer&&preferBinary){return'arraybuffer';}else{return'text';}}var ClientRequest=module.exports=function(opts){var self=this;stream.Writable.call(self);self._opts=opts;self._body=[];self._headers={};if(opts.auth)self.setHeader('Authorization','Basic '+Buffer.from(opts.auth).toString('base64'));Object.keys(opts.headers).forEach(function(name){self.setHeader(name,opts.headers[name]);});var preferBinary;var useFetch=true;if(opts.mode==='disable-fetch'||'requestTimeout'in opts&&!capability.abortController){// If the use of XHR should be preferred. Not typically needed.
|
|
2170
2178
|
useFetch=false;preferBinary=true;}else if(opts.mode==='prefer-streaming'){// If streaming is a high priority but binary compatibility and
|
|
2171
2179
|
// the accuracy of the 'content-type' header aren't
|
|
2172
2180
|
preferBinary=false;}else if(opts.mode==='allow-wrong-content-type'){// If streaming is more important than preserving the 'content-type' header
|
|
@@ -2183,7 +2191,7 @@ if(self._mode==='moz-chunked-arraybuffer'){xhr.onprogress=function(){self._onXHR
|
|
|
2183
2191
|
* Even though the spec says it should be available in readyState 3,
|
|
2184
2192
|
* accessing it throws an exception in IE8
|
|
2185
2193
|
*/function statusValid(xhr){try{var status=xhr.status;return status!==null&&status!==0;}catch(e){return false;}}ClientRequest.prototype._onXHRProgress=function(){var self=this;self._resetTimers(false);if(!statusValid(self._xhr)||self._destroyed)return;if(!self._response)self._connect();self._response._onXHRProgress(self._resetTimers.bind(self));};ClientRequest.prototype._connect=function(){var self=this;if(self._destroyed)return;self._response=new IncomingMessage(self._xhr,self._fetchResponse,self._mode,self._resetTimers.bind(self));self._response.on('error',function(err){self.emit('error',err);});self.emit('response',self._response);};ClientRequest.prototype._write=function(chunk,encoding,cb){var self=this;self._body.push(chunk);cb();};ClientRequest.prototype._resetTimers=function(done){var self=this;global.clearTimeout(self._socketTimer);self._socketTimer=null;if(done){global.clearTimeout(self._fetchTimer);self._fetchTimer=null;}else if(self._socketTimeout){self._socketTimer=global.setTimeout(function(){self.emit('timeout');},self._socketTimeout);}};ClientRequest.prototype.abort=ClientRequest.prototype.destroy=function(err){var self=this;self._destroyed=true;self._resetTimers(true);if(self._response)self._response._destroyed=true;if(self._xhr)self._xhr.abort();else if(self._fetchAbortController)self._fetchAbortController.abort();if(err)self.emit('error',err);};ClientRequest.prototype.end=function(data,encoding,cb){var self=this;if(typeof data==='function'){cb=data;data=undefined;}stream.Writable.prototype.end.call(self,data,encoding,cb);};ClientRequest.prototype.setTimeout=function(timeout,cb){var self=this;if(cb)self.once('timeout',cb);self._socketTimeout=timeout;self._resetTimers(false);};ClientRequest.prototype.flushHeaders=function(){};ClientRequest.prototype.setNoDelay=function(){};ClientRequest.prototype.setSocketKeepAlive=function(){};// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method
|
|
2186
|
-
var unsafeHeaders=['accept-charset','accept-encoding','access-control-request-headers','access-control-request-method','connection','content-length','cookie','cookie2','date','dnt','expect','host','keep-alive','origin','referer','te','trailer','transfer-encoding','upgrade','via'];}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":
|
|
2194
|
+
var unsafeHeaders=['accept-charset','accept-encoding','access-control-request-headers','access-control-request-method','connection','content-length','cookie','cookie2','date','dnt','expect','host','keep-alive','origin','referer','te','trailer','transfer-encoding','upgrade','via'];}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":125,"./response":127,"_process":107,"buffer":20,"inherits":80,"readable-stream":142}],127:[function(require,module,exports){(function(process,global,Buffer){(function(){var capability=require('./capability');var inherits=require('inherits');var stream=require('readable-stream');var rStates=exports.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4};var IncomingMessage=exports.IncomingMessage=function(xhr,response,mode,resetTimers){var self=this;stream.Readable.call(self);self._mode=mode;self.headers={};self.rawHeaders=[];self.trailers={};self.rawTrailers=[];// Fake the 'close' event, but only once 'end' fires
|
|
2187
2195
|
self.on('end',function(){// The nextTick is necessary to prevent the 'request' module from causing an infinite loop
|
|
2188
2196
|
process.nextTick(function(){self.emit('close');});});if(mode==='fetch'){self._fetchResponse=response;self.url=response.url;self.statusCode=response.status;self.statusMessage=response.statusText;response.headers.forEach(function(header,key){self.headers[key.toLowerCase()]=header;self.rawHeaders.push(key,header);});if(capability.writableStream){var writable=new WritableStream({write:function(chunk){resetTimers(false);return new Promise(function(resolve,reject){if(self._destroyed){reject();}else if(self.push(Buffer.from(chunk))){resolve();}else{self._resumeFetch=resolve;}});},close:function(){resetTimers(true);if(!self._destroyed)self.push(null);},abort:function(err){resetTimers(true);if(!self._destroyed)self.emit('error',err);}});try{response.body.pipeTo(writable).catch(function(err){resetTimers(true);if(!self._destroyed)self.emit('error',err);});return;}catch(e){}// pipeTo method isn't defined. Can't find a better way to feature test this
|
|
2189
2197
|
}// fallback for when writableStream or pipeTo aren't available
|
|
@@ -2191,13 +2199,13 @@ var reader=response.body.getReader();function read(){reader.read().then(function
|
|
|
2191
2199
|
}}};inherits(IncomingMessage,stream.Readable);IncomingMessage.prototype._read=function(){var self=this;var resolve=self._resumeFetch;if(resolve){self._resumeFetch=null;resolve();}};IncomingMessage.prototype._onXHRProgress=function(resetTimers){var self=this;var xhr=self._xhr;var response=null;switch(self._mode){case'text':response=xhr.responseText;if(response.length>self._pos){var newData=response.substr(self._pos);if(self._charset==='x-user-defined'){var buffer=Buffer.alloc(newData.length);for(var i=0;i<newData.length;i++)buffer[i]=newData.charCodeAt(i)&0xff;self.push(buffer);}else{self.push(newData,self._charset);}self._pos=response.length;}break;case'arraybuffer':if(xhr.readyState!==rStates.DONE||!xhr.response)break;response=xhr.response;self.push(Buffer.from(new Uint8Array(response)));break;case'moz-chunked-arraybuffer':// take whole
|
|
2192
2200
|
response=xhr.response;if(xhr.readyState!==rStates.LOADING||!response)break;self.push(Buffer.from(new Uint8Array(response)));break;case'ms-stream':response=xhr.response;if(xhr.readyState!==rStates.LOADING)break;var reader=new global.MSStreamReader();reader.onprogress=function(){if(reader.result.byteLength>self._pos){self.push(Buffer.from(new Uint8Array(reader.result.slice(self._pos))));self._pos=reader.result.byteLength;}};reader.onload=function(){resetTimers(true);self.push(null);};// reader.onerror = ??? // TODO: this
|
|
2193
2201
|
reader.readAsArrayBuffer(response);break;}// The ms-stream case handles end separately in reader.onload()
|
|
2194
|
-
if(self._xhr.readyState===rStates.DONE&&self._mode!=='ms-stream'){resetTimers(true);self.push(null);}};}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":
|
|
2202
|
+
if(self._xhr.readyState===rStates.DONE&&self._mode!=='ms-stream'){resetTimers(true);self.push(null);}};}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":125,"_process":107,"buffer":20,"inherits":80,"readable-stream":142}],128:[function(require,module,exports){'use strict';function _inheritsLoose(subClass,superClass){subClass.prototype=Object.create(superClass.prototype);subClass.prototype.constructor=subClass;subClass.__proto__=superClass;}var codes={};function createErrorType(code,message,Base){if(!Base){Base=Error;}function getMessage(arg1,arg2,arg3){if(typeof message==='string'){return message;}else{return message(arg1,arg2,arg3);}}var NodeError=/*#__PURE__*/function(_Base){_inheritsLoose(NodeError,_Base);function NodeError(arg1,arg2,arg3){return _Base.call(this,getMessage(arg1,arg2,arg3))||this;}return NodeError;}(Base);NodeError.prototype.name=Base.name;NodeError.prototype.code=code;codes[code]=NodeError;}// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
|
|
2195
2203
|
function oneOf(expected,thing){if(Array.isArray(expected)){var len=expected.length;expected=expected.map(function(i){return String(i);});if(len>2){return"one of ".concat(thing," ").concat(expected.slice(0,len-1).join(', '),", or ")+expected[len-1];}else if(len===2){return"one of ".concat(thing," ").concat(expected[0]," or ").concat(expected[1]);}else{return"of ".concat(thing," ").concat(expected[0]);}}else{return"of ".concat(thing," ").concat(String(expected));}}// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
|
|
2196
2204
|
function startsWith(str,search,pos){return str.substr(!pos||pos<0?0:+pos,search.length)===search;}// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
|
|
2197
2205
|
function endsWith(str,search,this_len){if(this_len===undefined||this_len>str.length){this_len=str.length;}return str.substring(this_len-search.length,this_len)===search;}// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
|
|
2198
2206
|
function includes(str,search,start){if(typeof start!=='number'){start=0;}if(start+search.length>str.length){return false;}else{return str.indexOf(search,start)!==-1;}}createErrorType('ERR_INVALID_OPT_VALUE',function(name,value){return'The value "'+value+'" is invalid for option "'+name+'"';},TypeError);createErrorType('ERR_INVALID_ARG_TYPE',function(name,expected,actual){// determiner: 'must be' or 'must not be'
|
|
2199
2207
|
var determiner;if(typeof expected==='string'&&startsWith(expected,'not ')){determiner='must not be';expected=expected.replace(/^not /,'');}else{determiner='must be';}var msg;if(endsWith(name,' argument')){// For cases like 'first argument'
|
|
2200
|
-
msg="The ".concat(name," ").concat(determiner," ").concat(oneOf(expected,'type'));}else{var type=includes(name,'.')?'property':'argument';msg="The \"".concat(name,"\" ").concat(type," ").concat(determiner," ").concat(oneOf(expected,'type'));}msg+=". Received type ".concat(typeof actual);return msg;},TypeError);createErrorType('ERR_STREAM_PUSH_AFTER_EOF','stream.push() after EOF');createErrorType('ERR_METHOD_NOT_IMPLEMENTED',function(name){return'The '+name+' method is not implemented';});createErrorType('ERR_STREAM_PREMATURE_CLOSE','Premature close');createErrorType('ERR_STREAM_DESTROYED',function(name){return'Cannot call '+name+' after a stream was destroyed';});createErrorType('ERR_MULTIPLE_CALLBACK','Callback called multiple times');createErrorType('ERR_STREAM_CANNOT_PIPE','Cannot pipe, not readable');createErrorType('ERR_STREAM_WRITE_AFTER_END','write after end');createErrorType('ERR_STREAM_NULL_VALUES','May not write null values to stream',TypeError);createErrorType('ERR_UNKNOWN_ENCODING',function(arg){return'Unknown encoding: '+arg;},TypeError);createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT','stream.unshift() after end event');module.exports.codes=codes;},{}],
|
|
2208
|
+
msg="The ".concat(name," ").concat(determiner," ").concat(oneOf(expected,'type'));}else{var type=includes(name,'.')?'property':'argument';msg="The \"".concat(name,"\" ").concat(type," ").concat(determiner," ").concat(oneOf(expected,'type'));}msg+=". Received type ".concat(typeof actual);return msg;},TypeError);createErrorType('ERR_STREAM_PUSH_AFTER_EOF','stream.push() after EOF');createErrorType('ERR_METHOD_NOT_IMPLEMENTED',function(name){return'The '+name+' method is not implemented';});createErrorType('ERR_STREAM_PREMATURE_CLOSE','Premature close');createErrorType('ERR_STREAM_DESTROYED',function(name){return'Cannot call '+name+' after a stream was destroyed';});createErrorType('ERR_MULTIPLE_CALLBACK','Callback called multiple times');createErrorType('ERR_STREAM_CANNOT_PIPE','Cannot pipe, not readable');createErrorType('ERR_STREAM_WRITE_AFTER_END','write after end');createErrorType('ERR_STREAM_NULL_VALUES','May not write null values to stream',TypeError);createErrorType('ERR_UNKNOWN_ENCODING',function(arg){return'Unknown encoding: '+arg;},TypeError);createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT','stream.unshift() after end event');module.exports.codes=codes;},{}],129:[function(require,module,exports){(function(process){(function(){// Copyright Joyent, Inc. and other Node contributors.
|
|
2201
2209
|
//
|
|
2202
2210
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2203
2211
|
// copy of this software and associated documentation files (the
|
|
@@ -2242,7 +2250,7 @@ enumerable:false,get:function get(){if(this._readableState===undefined||this._wr
|
|
|
2242
2250
|
// has not been initialized yet
|
|
2243
2251
|
if(this._readableState===undefined||this._writableState===undefined){return;}// backward compatibility, the user is explicitly
|
|
2244
2252
|
// managing destroyed
|
|
2245
|
-
this._readableState.destroyed=value;this._writableState.destroyed=value;}});}).call(this);}).call(this,require('_process'));},{"./_stream_readable":
|
|
2253
|
+
this._readableState.destroyed=value;this._writableState.destroyed=value;}});}).call(this);}).call(this,require('_process'));},{"./_stream_readable":131,"./_stream_writable":133,"_process":107,"inherits":80}],130:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
2246
2254
|
//
|
|
2247
2255
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2248
2256
|
// copy of this software and associated documentation files (the
|
|
@@ -2265,7 +2273,7 @@ this._readableState.destroyed=value;this._writableState.destroyed=value;}});}).c
|
|
|
2265
2273
|
// a passthrough stream.
|
|
2266
2274
|
// basically just the most minimal sort of Transform stream.
|
|
2267
2275
|
// Every written chunk gets output as-is.
|
|
2268
|
-
'use strict';module.exports=PassThrough;var Transform=require('./_stream_transform');require('inherits')(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options);}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk);};},{"./_stream_transform":
|
|
2276
|
+
'use strict';module.exports=PassThrough;var Transform=require('./_stream_transform');require('inherits')(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options);}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk);};},{"./_stream_transform":132,"inherits":80}],131:[function(require,module,exports){(function(process,global){(function(){// Copyright Joyent, Inc. and other Node contributors.
|
|
2269
2277
|
//
|
|
2270
2278
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2271
2279
|
// copy of this software and associated documentation files (the
|
|
@@ -2285,7 +2293,7 @@ this._readableState.destroyed=value;this._writableState.destroyed=value;}});}).c
|
|
|
2285
2293
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
2286
2294
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
2287
2295
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
2288
|
-
'use strict';module.exports=Readable;/*<replacement>*/var Duplex;/*</replacement>*/Readable.ReadableState=ReadableState;/*<replacement>*/var EE=require('events').EventEmitter;var EElistenerCount=function EElistenerCount(emitter,type){return emitter.listeners(type).length;};/*</replacement
|
|
2296
|
+
'use strict';module.exports=Readable;/*<replacement>*/var Duplex;/*</replacement>*/Readable.ReadableState=ReadableState;/*<replacement>*/var EE=require('events').EventEmitter;var EElistenerCount=function EElistenerCount(emitter,type){return emitter.listeners(type).length;};/*</replacement>*//*<replacement>*/var Stream=require('./internal/streams/stream');/*</replacement>*/var Buffer=require('buffer').Buffer;var OurUint8Array=(typeof global!=='undefined'?global:typeof window!=='undefined'?window:typeof self!=='undefined'?self:{}).Uint8Array||function(){};function _uint8ArrayToBuffer(chunk){return Buffer.from(chunk);}function _isUint8Array(obj){return Buffer.isBuffer(obj)||obj instanceof OurUint8Array;}/*<replacement>*/var debugUtil=require('util');var debug;if(debugUtil&&debugUtil.debuglog){debug=debugUtil.debuglog('stream');}else{debug=function debug(){};}/*</replacement>*/var BufferList=require('./internal/streams/buffer_list');var destroyImpl=require('./internal/streams/destroy');var _require=require('./internal/streams/state'),getHighWaterMark=_require.getHighWaterMark;var _require$codes=require('../errors').codes,ERR_INVALID_ARG_TYPE=_require$codes.ERR_INVALID_ARG_TYPE,ERR_STREAM_PUSH_AFTER_EOF=_require$codes.ERR_STREAM_PUSH_AFTER_EOF,ERR_METHOD_NOT_IMPLEMENTED=_require$codes.ERR_METHOD_NOT_IMPLEMENTED,ERR_STREAM_UNSHIFT_AFTER_END_EVENT=_require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;// Lazy loaded to improve the startup performance.
|
|
2289
2297
|
var StringDecoder;var createReadableStreamAsyncIterator;var from;require('inherits')(Readable,Stream);var errorOrDestroy=destroyImpl.errorOrDestroy;var kProxyEvents=['error','close','destroy','pause','resume'];function prependListener(emitter,event,fn){// Sadly this is not cacheable as some libraries bundle their own
|
|
2290
2298
|
// event emitter implementation with them.
|
|
2291
2299
|
if(typeof emitter.prependListener==='function')return emitter.prependListener(event,fn);// This is a hack to make sure that our error handler is attached before any
|
|
@@ -2517,7 +2525,7 @@ if(state.decoder)ret=state.buffer.join('');else if(state.buffer.length===1)ret=s
|
|
|
2517
2525
|
ret=state.buffer.consume(n,state.decoder);}return ret;}function endReadable(stream){var state=stream._readableState;debug('endReadable',state.endEmitted);if(!state.endEmitted){state.ended=true;process.nextTick(endReadableNT,state,stream);}}function endReadableNT(state,stream){debug('endReadableNT',state.endEmitted,state.length);// Check that we didn't get one last unshift.
|
|
2518
2526
|
if(!state.endEmitted&&state.length===0){state.endEmitted=true;stream.readable=false;stream.emit('end');if(state.autoDestroy){// In case of duplex streams we need a way to detect
|
|
2519
2527
|
// if the writable side is ready for autoDestroy as well
|
|
2520
|
-
var wState=stream._writableState;if(!wState||wState.autoDestroy&&wState.finished){stream.destroy();}}}}if(typeof Symbol==='function'){Readable.from=function(iterable,opts){if(from===undefined){from=require('./internal/streams/from');}return from(Readable,iterable,opts);};}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x)return i;}return-1;}}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"../errors":
|
|
2528
|
+
var wState=stream._writableState;if(!wState||wState.autoDestroy&&wState.finished){stream.destroy();}}}}if(typeof Symbol==='function'){Readable.from=function(iterable,opts){if(from===undefined){from=require('./internal/streams/from');}return from(Readable,iterable,opts);};}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x)return i;}return-1;}}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"../errors":128,"./_stream_duplex":129,"./internal/streams/async_iterator":134,"./internal/streams/buffer_list":135,"./internal/streams/destroy":136,"./internal/streams/from":138,"./internal/streams/state":140,"./internal/streams/stream":141,"_process":107,"buffer":20,"events":50,"inherits":80,"string_decoder/":143,"util":18}],132:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
2521
2529
|
//
|
|
2522
2530
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2523
2531
|
// copy of this software and associated documentation files (the
|
|
@@ -2603,7 +2611,7 @@ ts.needTransform=true;}};Transform.prototype._destroy=function(err,cb){Duplex.pr
|
|
|
2603
2611
|
stream.push(data);// TODO(BridgeAR): Write a test for these two error cases
|
|
2604
2612
|
// if there's nothing in the write buffer, then that means
|
|
2605
2613
|
// that nothing more will ever be provided
|
|
2606
|
-
if(stream._writableState.length)throw new ERR_TRANSFORM_WITH_LENGTH_0();if(stream._transformState.transforming)throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();return stream.push(null);}},{"../errors":
|
|
2614
|
+
if(stream._writableState.length)throw new ERR_TRANSFORM_WITH_LENGTH_0();if(stream._transformState.transforming)throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();return stream.push(null);}},{"../errors":128,"./_stream_duplex":129,"inherits":80}],133:[function(require,module,exports){(function(process,global){(function(){// Copyright Joyent, Inc. and other Node contributors.
|
|
2607
2615
|
//
|
|
2608
2616
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2609
2617
|
// copy of this software and associated documentation files (the
|
|
@@ -2628,7 +2636,7 @@ if(stream._writableState.length)throw new ERR_TRANSFORM_WITH_LENGTH_0();if(strea
|
|
|
2628
2636
|
// the drain event emission and buffering.
|
|
2629
2637
|
'use strict';module.exports=Writable;/* <replacement> */function WriteReq(chunk,encoding,cb){this.chunk=chunk;this.encoding=encoding;this.callback=cb;this.next=null;}// It seems a linked list but it is not
|
|
2630
2638
|
// there will be only 2 of these for each stream
|
|
2631
|
-
function CorkedRequest(state){var _this=this;this.next=null;this.entry=null;this.finish=function(){onCorkedFinish(_this,state);};}/* </replacement>
|
|
2639
|
+
function CorkedRequest(state){var _this=this;this.next=null;this.entry=null;this.finish=function(){onCorkedFinish(_this,state);};}/* </replacement> *//*<replacement>*/var Duplex;/*</replacement>*/Writable.WritableState=WritableState;/*<replacement>*/var internalUtil={deprecate:require('util-deprecate')};/*</replacement>*//*<replacement>*/var Stream=require('./internal/streams/stream');/*</replacement>*/var Buffer=require('buffer').Buffer;var OurUint8Array=(typeof global!=='undefined'?global:typeof window!=='undefined'?window:typeof self!=='undefined'?self:{}).Uint8Array||function(){};function _uint8ArrayToBuffer(chunk){return Buffer.from(chunk);}function _isUint8Array(obj){return Buffer.isBuffer(obj)||obj instanceof OurUint8Array;}var destroyImpl=require('./internal/streams/destroy');var _require=require('./internal/streams/state'),getHighWaterMark=_require.getHighWaterMark;var _require$codes=require('../errors').codes,ERR_INVALID_ARG_TYPE=_require$codes.ERR_INVALID_ARG_TYPE,ERR_METHOD_NOT_IMPLEMENTED=_require$codes.ERR_METHOD_NOT_IMPLEMENTED,ERR_MULTIPLE_CALLBACK=_require$codes.ERR_MULTIPLE_CALLBACK,ERR_STREAM_CANNOT_PIPE=_require$codes.ERR_STREAM_CANNOT_PIPE,ERR_STREAM_DESTROYED=_require$codes.ERR_STREAM_DESTROYED,ERR_STREAM_NULL_VALUES=_require$codes.ERR_STREAM_NULL_VALUES,ERR_STREAM_WRITE_AFTER_END=_require$codes.ERR_STREAM_WRITE_AFTER_END,ERR_UNKNOWN_ENCODING=_require$codes.ERR_UNKNOWN_ENCODING;var errorOrDestroy=destroyImpl.errorOrDestroy;require('inherits')(Writable,Stream);function nop(){}function WritableState(options,stream,isDuplex){Duplex=Duplex||require('./_stream_duplex');options=options||{};// Duplex streams are both readable and writable, but share
|
|
2632
2640
|
// the same options object.
|
|
2633
2641
|
// However, some cases require setting options to different
|
|
2634
2642
|
// values for the readable and the writable sides of the duplex stream,
|
|
@@ -2738,7 +2746,7 @@ enumerable:false,get:function get(){if(this._writableState===undefined){return f
|
|
|
2738
2746
|
// has not been initialized yet
|
|
2739
2747
|
if(!this._writableState){return;}// backward compatibility, the user is explicitly
|
|
2740
2748
|
// managing destroyed
|
|
2741
|
-
this._writableState.destroyed=value;}});Writable.prototype.destroy=destroyImpl.destroy;Writable.prototype._undestroy=destroyImpl.undestroy;Writable.prototype._destroy=function(err,cb){cb(err);};}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"../errors":
|
|
2749
|
+
this._writableState.destroyed=value;}});Writable.prototype.destroy=destroyImpl.destroy;Writable.prototype._undestroy=destroyImpl.undestroy;Writable.prototype._destroy=function(err,cb){cb(err);};}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"../errors":128,"./_stream_duplex":129,"./internal/streams/destroy":136,"./internal/streams/state":140,"./internal/streams/stream":141,"_process":107,"buffer":20,"inherits":80,"util-deprecate":146}],134:[function(require,module,exports){(function(process){(function(){'use strict';var _Object$setPrototypeO;function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key==="symbol"?key:String(key);}function _toPrimitive(input,hint){if(typeof input!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(typeof res!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}var finished=require('./end-of-stream');var kLastResolve=Symbol('lastResolve');var kLastReject=Symbol('lastReject');var kError=Symbol('error');var kEnded=Symbol('ended');var kLastPromise=Symbol('lastPromise');var kHandlePromise=Symbol('handlePromise');var kStream=Symbol('stream');function createIterResult(value,done){return{value:value,done:done};}function readAndResolve(iter){var resolve=iter[kLastResolve];if(resolve!==null){var data=iter[kStream].read();// we defer if data is null
|
|
2742
2750
|
// we can be expecting either 'end' or
|
|
2743
2751
|
// 'error'
|
|
2744
2752
|
if(data!==null){iter[kLastPromise]=null;iter[kLastResolve]=null;iter[kLastReject]=null;resolve(createIterResult(data,false));}}}function onReadable(iter){// we wait for the next tick, because it might
|
|
@@ -2760,7 +2768,7 @@ var data=this[kStream].read();if(data!==null){return Promise.resolve(createIterR
|
|
|
2760
2768
|
// Readable class this is attached to
|
|
2761
2769
|
return new Promise(function(resolve,reject){_this2[kStream].destroy(null,function(err){if(err){reject(err);return;}resolve(createIterResult(undefined,true));});});}),_Object$setPrototypeO),AsyncIteratorPrototype);var createReadableStreamAsyncIterator=function createReadableStreamAsyncIterator(stream){var _Object$create;var iterator=Object.create(ReadableStreamAsyncIteratorPrototype,(_Object$create={},_defineProperty(_Object$create,kStream,{value:stream,writable:true}),_defineProperty(_Object$create,kLastResolve,{value:null,writable:true}),_defineProperty(_Object$create,kLastReject,{value:null,writable:true}),_defineProperty(_Object$create,kError,{value:null,writable:true}),_defineProperty(_Object$create,kEnded,{value:stream._readableState.endEmitted,writable:true}),_defineProperty(_Object$create,kHandlePromise,{value:function value(resolve,reject){var data=iterator[kStream].read();if(data){iterator[kLastPromise]=null;iterator[kLastResolve]=null;iterator[kLastReject]=null;resolve(createIterResult(data,false));}else{iterator[kLastResolve]=resolve;iterator[kLastReject]=reject;}},writable:true}),_Object$create));iterator[kLastPromise]=null;finished(stream,function(err){if(err&&err.code!=='ERR_STREAM_PREMATURE_CLOSE'){var reject=iterator[kLastReject];// reject if we are waiting for data in the Promise
|
|
2762
2770
|
// returned by next() and store the error
|
|
2763
|
-
if(reject!==null){iterator[kLastPromise]=null;iterator[kLastResolve]=null;iterator[kLastReject]=null;reject(err);}iterator[kError]=err;return;}var resolve=iterator[kLastResolve];if(resolve!==null){iterator[kLastPromise]=null;iterator[kLastResolve]=null;iterator[kLastReject]=null;resolve(createIterResult(undefined,true));}iterator[kEnded]=true;});stream.on('readable',onReadable.bind(null,iterator));return iterator;};module.exports=createReadableStreamAsyncIterator;}).call(this);}).call(this,require('_process'));},{"./end-of-stream":
|
|
2771
|
+
if(reject!==null){iterator[kLastPromise]=null;iterator[kLastResolve]=null;iterator[kLastReject]=null;reject(err);}iterator[kError]=err;return;}var resolve=iterator[kLastResolve];if(resolve!==null){iterator[kLastPromise]=null;iterator[kLastResolve]=null;iterator[kLastReject]=null;resolve(createIterResult(undefined,true));}iterator[kEnded]=true;});stream.on('readable',onReadable.bind(null,iterator));return iterator;};module.exports=createReadableStreamAsyncIterator;}).call(this);}).call(this,require('_process'));},{"./end-of-stream":137,"_process":107}],135:[function(require,module,exports){'use strict';function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target;}function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key==="symbol"?key:String(key);}function _toPrimitive(input,hint){if(typeof input!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(typeof res!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}var _require=require('buffer'),Buffer=_require.Buffer;var _require2=require('util'),inspect=_require2.inspect;var custom=inspect&&inspect.custom||'inspect';function copyBuffer(src,target,offset){Buffer.prototype.copy.call(src,target,offset);}module.exports=/*#__PURE__*/function(){function BufferList(){_classCallCheck(this,BufferList);this.head=null;this.tail=null;this.length=0;}_createClass(BufferList,[{key:"push",value:function push(v){var entry={data:v,next:null};if(this.length>0)this.tail.next=entry;else this.head=entry;this.tail=entry;++this.length;}},{key:"unshift",value:function unshift(v){var entry={data:v,next:this.head};if(this.length===0)this.tail=entry;this.head=entry;++this.length;}},{key:"shift",value:function shift(){if(this.length===0)return;var ret=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return ret;}},{key:"clear",value:function clear(){this.head=this.tail=null;this.length=0;}},{key:"join",value:function join(s){if(this.length===0)return'';var p=this.head;var ret=''+p.data;while(p=p.next)ret+=s+p.data;return ret;}},{key:"concat",value:function concat(n){if(this.length===0)return Buffer.alloc(0);var ret=Buffer.allocUnsafe(n>>>0);var p=this.head;var i=0;while(p){copyBuffer(p.data,ret,i);i+=p.data.length;p=p.next;}return ret;}// Consumes a specified amount of bytes or characters from the buffered data.
|
|
2764
2772
|
},{key:"consume",value:function consume(n,hasStrings){var ret;if(n<this.head.data.length){// `slice` is the same for buffers and strings.
|
|
2765
2773
|
ret=this.head.data.slice(0,n);this.head.data=this.head.data.slice(n);}else if(n===this.head.data.length){// First chunk is a perfect match.
|
|
2766
2774
|
ret=this.shift();}else{// Result spans more than one buffer.
|
|
@@ -2769,7 +2777,7 @@ ret=hasStrings?this._getString(n):this._getBuffer(n);}return ret;}},{key:"first"
|
|
|
2769
2777
|
},{key:"_getBuffer",value:function _getBuffer(n){var ret=Buffer.allocUnsafe(n);var p=this.head;var c=1;p.data.copy(ret);n-=p.data.length;while(p=p.next){var buf=p.data;var nb=n>buf.length?buf.length:n;buf.copy(ret,ret.length-n,0,nb);n-=nb;if(n===0){if(nb===buf.length){++c;if(p.next)this.head=p.next;else this.head=this.tail=null;}else{this.head=p;p.data=buf.slice(nb);}break;}++c;}this.length-=c;return ret;}// Make sure the linked list only shows the minimal necessary information.
|
|
2770
2778
|
},{key:custom,value:function value(_,options){return inspect(this,_objectSpread(_objectSpread({},options),{},{// Only inspect one level.
|
|
2771
2779
|
depth:0,// It should not recurse.
|
|
2772
|
-
customInspect:false}));}}]);return BufferList;}();},{"buffer":20,"util":18}],
|
|
2780
|
+
customInspect:false}));}}]);return BufferList;}();},{"buffer":20,"util":18}],136:[function(require,module,exports){(function(process){(function(){'use strict';// undocumented cb() API, needed for core, not for public API
|
|
2773
2781
|
function destroy(err,cb){var _this=this;var readableDestroyed=this._readableState&&this._readableState.destroyed;var writableDestroyed=this._writableState&&this._writableState.destroyed;if(readableDestroyed||writableDestroyed){if(cb){cb(err);}else if(err){if(!this._writableState){process.nextTick(emitErrorNT,this,err);}else if(!this._writableState.errorEmitted){this._writableState.errorEmitted=true;process.nextTick(emitErrorNT,this,err);}}return this;}// we set destroyed to true before firing error callbacks in order
|
|
2774
2782
|
// to make it re-entrance safe in case destroy() is called within callbacks
|
|
2775
2783
|
if(this._readableState){this._readableState.destroyed=true;}// if this is a duplex stream mark the writable part as destroyed as well
|
|
@@ -2778,15 +2786,15 @@ if(this._writableState){this._writableState.destroyed=true;}this._destroy(err||n
|
|
|
2778
2786
|
// For now when you opt-in to autoDestroy we allow
|
|
2779
2787
|
// the error to be emitted nextTick. In a future
|
|
2780
2788
|
// semver major update we should change the default to this.
|
|
2781
|
-
var rState=stream._readableState;var wState=stream._writableState;if(rState&&rState.autoDestroy||wState&&wState.autoDestroy)stream.destroy(err);else stream.emit('error',err);}module.exports={destroy:destroy,undestroy:undestroy,errorOrDestroy:errorOrDestroy};}).call(this);}).call(this,require('_process'));},{"_process":
|
|
2789
|
+
var rState=stream._readableState;var wState=stream._writableState;if(rState&&rState.autoDestroy||wState&&wState.autoDestroy)stream.destroy(err);else stream.emit('error',err);}module.exports={destroy:destroy,undestroy:undestroy,errorOrDestroy:errorOrDestroy};}).call(this);}).call(this,require('_process'));},{"_process":107}],137:[function(require,module,exports){// Ported from https://github.com/mafintosh/end-of-stream with
|
|
2782
2790
|
// permission from the author, Mathias Buus (@mafintosh).
|
|
2783
2791
|
'use strict';var ERR_STREAM_PREMATURE_CLOSE=require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;function once(callback){var called=false;return function(){if(called)return;called=true;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}callback.apply(this,args);};}function noop(){}function isRequest(stream){return stream.setHeader&&typeof stream.abort==='function';}function eos(stream,opts,callback){if(typeof opts==='function')return eos(stream,null,opts);if(!opts)opts={};callback=once(callback||noop);var readable=opts.readable||opts.readable!==false&&stream.readable;var writable=opts.writable||opts.writable!==false&&stream.writable;var onlegacyfinish=function onlegacyfinish(){if(!stream.writable)onfinish();};var writableEnded=stream._writableState&&stream._writableState.finished;var onfinish=function onfinish(){writable=false;writableEnded=true;if(!readable)callback.call(stream);};var readableEnded=stream._readableState&&stream._readableState.endEmitted;var onend=function onend(){readable=false;readableEnded=true;if(!writable)callback.call(stream);};var onerror=function onerror(err){callback.call(stream,err);};var onclose=function onclose(){var err;if(readable&&!readableEnded){if(!stream._readableState||!stream._readableState.ended)err=new ERR_STREAM_PREMATURE_CLOSE();return callback.call(stream,err);}if(writable&&!writableEnded){if(!stream._writableState||!stream._writableState.ended)err=new ERR_STREAM_PREMATURE_CLOSE();return callback.call(stream,err);}};var onrequest=function onrequest(){stream.req.on('finish',onfinish);};if(isRequest(stream)){stream.on('complete',onfinish);stream.on('abort',onclose);if(stream.req)onrequest();else stream.on('request',onrequest);}else if(writable&&!stream._writableState){// legacy streams
|
|
2784
|
-
stream.on('end',onlegacyfinish);stream.on('close',onlegacyfinish);}stream.on('end',onend);stream.on('finish',onfinish);if(opts.error!==false)stream.on('error',onerror);stream.on('close',onclose);return function(){stream.removeListener('complete',onfinish);stream.removeListener('abort',onclose);stream.removeListener('request',onrequest);if(stream.req)stream.req.removeListener('finish',onfinish);stream.removeListener('end',onlegacyfinish);stream.removeListener('close',onlegacyfinish);stream.removeListener('finish',onfinish);stream.removeListener('end',onend);stream.removeListener('error',onerror);stream.removeListener('close',onclose);};}module.exports=eos;},{"../../../errors":
|
|
2792
|
+
stream.on('end',onlegacyfinish);stream.on('close',onlegacyfinish);}stream.on('end',onend);stream.on('finish',onfinish);if(opts.error!==false)stream.on('error',onerror);stream.on('close',onclose);return function(){stream.removeListener('complete',onfinish);stream.removeListener('abort',onclose);stream.removeListener('request',onrequest);if(stream.req)stream.req.removeListener('finish',onfinish);stream.removeListener('end',onlegacyfinish);stream.removeListener('close',onlegacyfinish);stream.removeListener('finish',onfinish);stream.removeListener('end',onend);stream.removeListener('error',onerror);stream.removeListener('close',onclose);};}module.exports=eos;},{"../../../errors":128}],138:[function(require,module,exports){module.exports=function(){throw new Error('Readable.from is not available in the browser');};},{}],139:[function(require,module,exports){// Ported from https://github.com/mafintosh/pump with
|
|
2785
2793
|
// permission from the author, Mathias Buus (@mafintosh).
|
|
2786
2794
|
'use strict';var eos;function once(callback){var called=false;return function(){if(called)return;called=true;callback.apply(void 0,arguments);};}var _require$codes=require('../../../errors').codes,ERR_MISSING_ARGS=_require$codes.ERR_MISSING_ARGS,ERR_STREAM_DESTROYED=_require$codes.ERR_STREAM_DESTROYED;function noop(err){// Rethrow the error if it exists to avoid swallowing it
|
|
2787
2795
|
if(err)throw err;}function isRequest(stream){return stream.setHeader&&typeof stream.abort==='function';}function destroyer(stream,reading,writing,callback){callback=once(callback);var closed=false;stream.on('close',function(){closed=true;});if(eos===undefined)eos=require('./end-of-stream');eos(stream,{readable:reading,writable:writing},function(err){if(err)return callback(err);closed=true;callback();});var destroyed=false;return function(err){if(closed)return;if(destroyed)return;destroyed=true;// request.destroy just do .end - .abort is what we want
|
|
2788
|
-
if(isRequest(stream))return stream.abort();if(typeof stream.destroy==='function')return stream.destroy();callback(err||new ERR_STREAM_DESTROYED('pipe'));};}function call(fn){fn();}function pipe(from,to){return from.pipe(to);}function popCallback(streams){if(!streams.length)return noop;if(typeof streams[streams.length-1]!=='function')return noop;return streams.pop();}function pipeline(){for(var _len=arguments.length,streams=new Array(_len),_key=0;_key<_len;_key++){streams[_key]=arguments[_key];}var callback=popCallback(streams);if(Array.isArray(streams[0]))streams=streams[0];if(streams.length<2){throw new ERR_MISSING_ARGS('streams');}var error;var destroys=streams.map(function(stream,i){var reading=i<streams.length-1;var writing=i>0;return destroyer(stream,reading,writing,function(err){if(!error)error=err;if(err)destroys.forEach(call);if(reading)return;destroys.forEach(call);callback(error);});});return streams.reduce(pipe);}module.exports=pipeline;},{"../../../errors":
|
|
2789
|
-
return state.objectMode?16:16*1024;}module.exports={getHighWaterMark:getHighWaterMark};},{"../../../errors":
|
|
2796
|
+
if(isRequest(stream))return stream.abort();if(typeof stream.destroy==='function')return stream.destroy();callback(err||new ERR_STREAM_DESTROYED('pipe'));};}function call(fn){fn();}function pipe(from,to){return from.pipe(to);}function popCallback(streams){if(!streams.length)return noop;if(typeof streams[streams.length-1]!=='function')return noop;return streams.pop();}function pipeline(){for(var _len=arguments.length,streams=new Array(_len),_key=0;_key<_len;_key++){streams[_key]=arguments[_key];}var callback=popCallback(streams);if(Array.isArray(streams[0]))streams=streams[0];if(streams.length<2){throw new ERR_MISSING_ARGS('streams');}var error;var destroys=streams.map(function(stream,i){var reading=i<streams.length-1;var writing=i>0;return destroyer(stream,reading,writing,function(err){if(!error)error=err;if(err)destroys.forEach(call);if(reading)return;destroys.forEach(call);callback(error);});});return streams.reduce(pipe);}module.exports=pipeline;},{"../../../errors":128,"./end-of-stream":137}],140:[function(require,module,exports){'use strict';var ERR_INVALID_OPT_VALUE=require('../../../errors').codes.ERR_INVALID_OPT_VALUE;function highWaterMarkFrom(options,isDuplex,duplexKey){return options.highWaterMark!=null?options.highWaterMark:isDuplex?options[duplexKey]:null;}function getHighWaterMark(state,options,duplexKey,isDuplex){var hwm=highWaterMarkFrom(options,isDuplex,duplexKey);if(hwm!=null){if(!(isFinite(hwm)&&Math.floor(hwm)===hwm)||hwm<0){var name=isDuplex?duplexKey:'highWaterMark';throw new ERR_INVALID_OPT_VALUE(name,hwm);}return Math.floor(hwm);}// Default value
|
|
2797
|
+
return state.objectMode?16:16*1024;}module.exports={getHighWaterMark:getHighWaterMark};},{"../../../errors":128}],141:[function(require,module,exports){module.exports=require('events').EventEmitter;},{"events":50}],142:[function(require,module,exports){exports=module.exports=require('./lib/_stream_readable.js');exports.Stream=exports;exports.Readable=exports;exports.Writable=require('./lib/_stream_writable.js');exports.Duplex=require('./lib/_stream_duplex.js');exports.Transform=require('./lib/_stream_transform.js');exports.PassThrough=require('./lib/_stream_passthrough.js');exports.finished=require('./lib/internal/streams/end-of-stream.js');exports.pipeline=require('./lib/internal/streams/pipeline.js');},{"./lib/_stream_duplex.js":129,"./lib/_stream_passthrough.js":130,"./lib/_stream_readable.js":131,"./lib/_stream_transform.js":132,"./lib/_stream_writable.js":133,"./lib/internal/streams/end-of-stream.js":137,"./lib/internal/streams/pipeline.js":139}],143:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
2790
2798
|
//
|
|
2791
2799
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2792
2800
|
// copy of this software and associated documentation files (the
|
|
@@ -2840,13 +2848,13 @@ function utf8End(buf){var r=buf&&buf.length?this.write(buf):'';if(this.lastNeed)
|
|
|
2840
2848
|
function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString('utf16le',i);if(r){var c=r.charCodeAt(r.length-1);if(c>=0xD800&&c<=0xDBFF){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1);}}return r;}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString('utf16le',i,buf.length-1);}// For UTF-16LE we do not explicitly append special replacement characters if we
|
|
2841
2849
|
// end on a partial character, we simply let v8 handle that.
|
|
2842
2850
|
function utf16End(buf){var r=buf&&buf.length?this.write(buf):'';if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString('utf16le',0,end);}return r;}function base64Text(buf,i){var n=(buf.length-i)%3;if(n===0)return buf.toString('base64',i);this.lastNeed=3-n;this.lastTotal=3;if(n===1){this.lastChar[0]=buf[buf.length-1];}else{this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];}return buf.toString('base64',i,buf.length-n);}function base64End(buf){var r=buf&&buf.length?this.write(buf):'';if(this.lastNeed)return r+this.lastChar.toString('base64',0,3-this.lastNeed);return r;}// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
|
|
2843
|
-
function simpleWrite(buf){return buf.toString(this.encoding);}function simpleEnd(buf){return buf&&buf.length?this.write(buf):'';}},{"safe-buffer":
|
|
2851
|
+
function simpleWrite(buf){return buf.toString(this.encoding);}function simpleEnd(buf){return buf&&buf.length?this.write(buf):'';}},{"safe-buffer":117}],144:[function(require,module,exports){(function(setImmediate,clearImmediate){(function(){var nextTick=require('process/browser.js').nextTick;var apply=Function.prototype.apply;var slice=Array.prototype.slice;var immediateIds={};var nextImmediateId=0;// DOM APIs, for completeness
|
|
2844
2852
|
exports.setTimeout=function(){return new Timeout(apply.call(setTimeout,window,arguments),clearTimeout);};exports.setInterval=function(){return new Timeout(apply.call(setInterval,window,arguments),clearInterval);};exports.clearTimeout=exports.clearInterval=function(timeout){timeout.close();};function Timeout(id,clearFn){this._id=id;this._clearFn=clearFn;}Timeout.prototype.unref=Timeout.prototype.ref=function(){};Timeout.prototype.close=function(){this._clearFn.call(window,this._id);};// Does not start the time, just sets up the members needed.
|
|
2845
2853
|
exports.enroll=function(item,msecs){clearTimeout(item._idleTimeoutId);item._idleTimeout=msecs;};exports.unenroll=function(item){clearTimeout(item._idleTimeoutId);item._idleTimeout=-1;};exports._unrefActive=exports.active=function(item){clearTimeout(item._idleTimeoutId);var msecs=item._idleTimeout;if(msecs>=0){item._idleTimeoutId=setTimeout(function onTimeout(){if(item._onTimeout)item._onTimeout();},msecs);}};// That's not how node.js implements it but the exposed api is the same.
|
|
2846
2854
|
exports.setImmediate=typeof setImmediate==="function"?setImmediate:function(fn){var id=nextImmediateId++;var args=arguments.length<2?false:slice.call(arguments,1);immediateIds[id]=true;nextTick(function onNextTick(){if(immediateIds[id]){// fn.call() is faster so we optimize for the common use-case
|
|
2847
2855
|
// @see http://jsperf.com/call-apply-segu
|
|
2848
2856
|
if(args){fn.apply(null,args);}else{fn.call(null);}// Prevent ids from leaking
|
|
2849
|
-
exports.clearImmediate(id);}});return id;};exports.clearImmediate=typeof clearImmediate==="function"?clearImmediate:function(id){delete immediateIds[id];};}).call(this);}).call(this,require("timers").setImmediate,require("timers").clearImmediate);},{"process/browser.js":
|
|
2857
|
+
exports.clearImmediate(id);}});return id;};exports.clearImmediate=typeof clearImmediate==="function"?clearImmediate:function(id){delete immediateIds[id];};}).call(this);}).call(this,require("timers").setImmediate,require("timers").clearImmediate);},{"process/browser.js":107,"timers":144}],145:[function(require,module,exports){/*
|
|
2850
2858
|
* Copyright Joyent, Inc. and other Node contributors.
|
|
2851
2859
|
*
|
|
2852
2860
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
@@ -2867,7 +2875,7 @@ exports.clearImmediate(id);}});return id;};exports.clearImmediate=typeof clearIm
|
|
|
2867
2875
|
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
2868
2876
|
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
2869
2877
|
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
2870
|
-
*/'use strict';var punycode=require('punycode');function Url(){this.protocol=null;this.slashes=null;this.auth=null;this.host=null;this.port=null;this.hostname=null;this.hash=null;this.search=null;this.query=null;this.pathname=null;this.path=null;this.href=null;}// Reference: RFC 3986, RFC 1808, RFC 2396
|
|
2878
|
+
*/'use strict';var punycode=require('punycode/');function Url(){this.protocol=null;this.slashes=null;this.auth=null;this.host=null;this.port=null;this.hostname=null;this.hash=null;this.search=null;this.query=null;this.pathname=null;this.path=null;this.href=null;}// Reference: RFC 3986, RFC 1808, RFC 2396
|
|
2871
2879
|
/*
|
|
2872
2880
|
* define these here so at least they only have to be
|
|
2873
2881
|
* compiled once on the first module load.
|
|
@@ -2910,10 +2918,10 @@ var simplePath=simplePathPattern.exec(rest);if(simplePath){this.path=rest;this.h
|
|
|
2910
2918
|
* ex:
|
|
2911
2919
|
* http://a@b@c/ => user:a@b host:c
|
|
2912
2920
|
* http://a@b?@c => user:a host:c path:/?@c
|
|
2913
|
-
|
|
2921
|
+
*//*
|
|
2914
2922
|
* v0.12 TODO(isaacs): This is not quite how Chrome does things.
|
|
2915
2923
|
* Review our test case against browsers more comprehensively.
|
|
2916
|
-
|
|
2924
|
+
*/// find the first instance of any hostEndingChars
|
|
2917
2925
|
var hostEnd=-1;for(var i=0;i<hostEndingChars.length;i++){var hec=rest.indexOf(hostEndingChars[i]);if(hec!==-1&&(hostEnd===-1||hec<hostEnd)){hostEnd=hec;}}/*
|
|
2918
2926
|
* at this point, either we have an explicit point where the
|
|
2919
2927
|
* auth portion cannot go past, or the last @ char is the decider.
|
|
@@ -3024,7 +3032,7 @@ if(psychotic){result.hostname=isAbsolute?'':srcPath.length?srcPath.shift():'';re
|
|
|
3024
3032
|
* this especially happens in cases like
|
|
3025
3033
|
* url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
|
3026
3034
|
*/var authInHost=result.host&&result.host.indexOf('@')>0?result.host.split('@'):false;if(authInHost){result.auth=authInHost.shift();result.hostname=authInHost.shift();result.host=result.hostname;}}mustEndAbs=mustEndAbs||result.host&&srcPath.length;if(mustEndAbs&&!isAbsolute){srcPath.unshift('');}if(srcPath.length>0){result.pathname=srcPath.join('/');}else{result.pathname=null;result.path=null;}// to support request.http
|
|
3027
|
-
if(result.pathname!==null||result.search!==null){result.path=(result.pathname?result.pathname:'')+(result.search?result.search:'');}result.auth=relative.auth||result.auth;result.slashes=result.slashes||relative.slashes;result.href=result.format();return result;};Url.prototype.parseHost=function(){var host=this.host;var port=portPattern.exec(host);if(port){port=port[0];if(port!==':'){this.port=port.substr(1);}host=host.substr(0,host.length-port.length);}if(host){this.hostname=host;}};exports.parse=urlParse;exports.resolve=urlResolve;exports.resolveObject=urlResolveObject;exports.format=urlFormat;exports.Url=Url;},{"punycode":
|
|
3035
|
+
if(result.pathname!==null||result.search!==null){result.path=(result.pathname?result.pathname:'')+(result.search?result.search:'');}result.auth=relative.auth||result.auth;result.slashes=result.slashes||relative.slashes;result.href=result.format();return result;};Url.prototype.parseHost=function(){var host=this.host;var port=portPattern.exec(host);if(port){port=port[0];if(port!==':'){this.port=port.substr(1);}host=host.substr(0,host.length-port.length);}if(host){this.hostname=host;}};exports.parse=urlParse;exports.resolve=urlResolve;exports.resolveObject=urlResolveObject;exports.format=urlFormat;exports.Url=Url;},{"punycode/":108,"qs":110}],146:[function(require,module,exports){(function(global){(function(){/**
|
|
3028
3036
|
* Module exports.
|
|
3029
3037
|
*/module.exports=deprecate;/**
|
|
3030
3038
|
* Mark that a method should not be used.
|
|
@@ -3049,15 +3057,15 @@ if(result.pathname!==null||result.search!==null){result.path=(result.pathname?re
|
|
|
3049
3057
|
* @returns {Boolean}
|
|
3050
3058
|
* @api private
|
|
3051
3059
|
*/function config(name){// accessing global.localStorage can trigger a DOMException in sandboxed iframes
|
|
3052
|
-
try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==='true';}}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],
|
|
3060
|
+
try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==='true';}}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],147:[function(require,module,exports){// Returns a wrapper function that returns a wrapped callback
|
|
3053
3061
|
// The wrapper function should do some stuff, and return a
|
|
3054
3062
|
// presumably different callback function.
|
|
3055
3063
|
// This makes sure that own properties are retained, so that
|
|
3056
3064
|
// decorations and such are not lost along the way.
|
|
3057
|
-
module.exports=wrappy;function wrappy(fn,cb){if(fn&&cb)return wrappy(fn)(cb);if(typeof fn!=='function')throw new TypeError('need wrapper function');Object.keys(fn).forEach(function(k){wrapper[k]=fn[k];});return wrapper;function wrapper(){var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i];}var ret=fn.apply(this,args);var cb=args[args.length-1];if(typeof ret==='function'&&ret!==cb){Object.keys(cb).forEach(function(k){ret[k]=cb[k];});}return ret;}}},{}],
|
|
3065
|
+
module.exports=wrappy;function wrappy(fn,cb){if(fn&&cb)return wrappy(fn)(cb);if(typeof fn!=='function')throw new TypeError('need wrapper function');Object.keys(fn).forEach(function(k){wrapper[k]=fn[k];});return wrapper;function wrapper(){var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i];}var ret=fn.apply(this,args);var cb=args[args.length-1];if(typeof ret==='function'&&ret!==cb){Object.keys(cb).forEach(function(k){ret[k]=cb[k];});}return ret;}}},{}],148:[function(require,module,exports){module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(){var target={};for(var i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;}},{}],149:[function(require,module,exports){module.exports={"name":"fable","version":"3.1.33","description":"A service dependency injection, configuration and logging library.","main":"source/Fable.js","scripts":{"start":"node source/Fable.js","coverage":"./node_modules/.bin/nyc --reporter=lcov --reporter=text-lcov ./node_modules/mocha/bin/_mocha -- -u tdd -R spec","test":"./node_modules/.bin/mocha -u tdd -R spec","build":"npx quack build","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t fable-image:local","docker-dev-run":"docker run -it -d --name fable-dev -p 30001:8080 -p 38086:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/fable\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" fable-image:local","docker-dev-shell":"docker exec -it fable-dev /bin/bash","tests":"./node_modules/mocha/bin/_mocha -u tdd --exit -R spec --grep"},"mocha":{"diff":true,"extension":["js"],"package":"./package.json","reporter":"spec","slow":"75","timeout":"5000","ui":"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},"browser":{"./source/service/Fable-Service-EnvironmentData.js":"./source/service/Fable-Service-EnvironmentData-Web.js","./source/service/Fable-Service-FilePersistence.js":"./source/service/Fable-Service-FilePersistence-Web.js"},"repository":{"type":"git","url":"https://github.com/stevenvelozo/fable.git"},"keywords":["entity","behavior"],"author":"Steven Velozo <steven@velozo.com> (http://velozo.com/)","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/fable/issues"},"homepage":"https://github.com/stevenvelozo/fable","devDependencies":{"quackage":"^1.0.45"},"dependencies":{"async.eachlimit":"^0.5.2","async.waterfall":"^0.5.2","big.js":"^7.0.1","cachetrax":"^1.0.4","cookie":"^1.0.2","data-arithmatic":"^1.0.7","dayjs":"^1.11.18","fable-log":"^3.0.16","fable-serviceproviderbase":"^3.0.15","fable-settings":"^3.0.12","fable-uuid":"^3.0.11","manyfest":"^1.0.42","simple-get":"^4.0.1"}};},{}],150:[function(require,module,exports){/**
|
|
3058
3066
|
* Fable Application Services Support Library
|
|
3059
3067
|
* @author <steven@velozo.com>
|
|
3060
|
-
|
|
3068
|
+
*/// Pre-init services
|
|
3061
3069
|
const libFableSettings=require('fable-settings');const libFableUUID=require('fable-uuid');const libFableLog=require('fable-log');const libPackage=require('../package.json');const libFableServiceBase=require('fable-serviceproviderbase');class Fable extends libFableServiceBase.CoreServiceProviderBase{constructor(pSettings){super(pSettings);// Initialization Phase 0: Set up the lowest level state (fable is a utility service manager at heart)
|
|
3062
3070
|
this.serviceType='ServiceManager';/** @type {Object} */this._Package=libPackage;// An array of the types of services available
|
|
3063
3071
|
this.serviceTypes=[];// A map of instantiated services
|
|
@@ -3113,7 +3121,7 @@ if(pServiceHash in this.servicesMap[pServiceType]){if(!(pServiceType in this)||t
|
|
|
3113
3121
|
* @param {Date} pDate - An optional javascript Date object to generate a datestamp for.
|
|
3114
3122
|
* @returns {string} - A string formatted as YYYY-MM-DD-HH-MM-SS
|
|
3115
3123
|
*/static generateFileNameDateStamp(pDate){const tmpDate=pDate||new Date();const tmpYear=tmpDate.getFullYear();const tmpMonth=String(tmpDate.getMonth()+1).padStart(2,'0');const tmpDay=String(tmpDate.getDate()).padStart(2,'0');const tmpHour=String(tmpDate.getHours()).padStart(2,'0');const tmpMinute=String(tmpDate.getMinutes()).padStart(2,'0');const tmpSecond=String(tmpDate.getSeconds()).padStart(2,'0');return`${tmpYear}-${tmpMonth}-${tmpDay}-${tmpHour}-${tmpMinute}-${tmpSecond}`;}}// This is for backwards compatibility
|
|
3116
|
-
function autoConstruct(pSettings){return new Fable(pSettings);}module.exports=Fable;module.exports.new=autoConstruct;module.exports.LogProviderBase=libFableLog.LogProviderBase;module.exports.ServiceProviderBase=libFableServiceBase;module.exports.CoreServiceProviderBase=libFableServiceBase.CoreServiceProviderBase;module.exports.precedent=libFableSettings.precedent;},{"../package.json":
|
|
3124
|
+
function autoConstruct(pSettings){return new Fable(pSettings);}module.exports=Fable;module.exports.new=autoConstruct;module.exports.LogProviderBase=libFableLog.LogProviderBase;module.exports.ServiceProviderBase=libFableServiceBase;module.exports.CoreServiceProviderBase=libFableServiceBase.CoreServiceProviderBase;module.exports.precedent=libFableSettings.precedent;},{"../package.json":149,"./services/Fable-Service-Anticipate.js":151,"./services/Fable-Service-CSVParser.js":152,"./services/Fable-Service-DataFormat.js":153,"./services/Fable-Service-DataGeneration.js":155,"./services/Fable-Service-DateManipulation.js":156,"./services/Fable-Service-EnvironmentData.js":157,"./services/Fable-Service-ExpressionParser.js":158,"./services/Fable-Service-FilePersistence.js":169,"./services/Fable-Service-Logic.js":170,"./services/Fable-Service-Math.js":171,"./services/Fable-Service-MetaTemplate.js":172,"./services/Fable-Service-Operation.js":176,"./services/Fable-Service-ProgressTime.js":177,"./services/Fable-Service-ProgressTrackerSet.js":179,"./services/Fable-Service-RestClient.js":180,"./services/Fable-Service-Template.js":181,"./services/Fable-Service-Utility.js":182,"cachetrax":22,"fable-log":57,"fable-serviceproviderbase":59,"fable-settings":63,"fable-uuid":66,"manyfest":92}],151:[function(require,module,exports){const libFableServiceBase=require('fable-serviceproviderbase');class FableServiceAnticipate extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='AsyncAnticipate';// The queue of operations waiting to run.
|
|
3117
3125
|
this.operationQueue=[];this.erroredOperations=[];this.executingOperationCount=0;this.completedOperationCount=0;this.callDepth=0;this.maxOperations=1;this.lastError=undefined;this.waitingFunctions=[];}checkQueue(){// This could be combined with the last else if stanza but the logic for errors and non-errors would be blended and more complex to follow so keeping it unrolled.
|
|
3118
3126
|
if(this.lastError){// If there are no operations left, and we have waiting functions, call them.
|
|
3119
3127
|
for(let i=0;i<this.waitingFunctions.length;i++){//this.log.trace('Calling waiting function.')
|
|
@@ -3127,14 +3135,14 @@ anticipate(fAsynchronousFunction){//this.log.trace('Adding a function...')
|
|
|
3127
3135
|
this.operationQueue.push(fAsynchronousFunction);this.checkQueue();}buildAnticipatorCallback(){// This uses closure-scoped state to track the callback state
|
|
3128
3136
|
let tmpCallbackState={Called:false,Error:undefined,OperationSet:this};return hoistedCallback.bind(this);function hoistedCallback(pError){if(tmpCallbackState.Called){// If they call the callback twice, throw an error
|
|
3129
3137
|
throw new Error("Anticipation async callback called twice...");}tmpCallbackState.Called=true;this.lastError=pError;tmpCallbackState.OperationSet.executingOperationCount-=1;tmpCallbackState.OperationSet.completedOperationCount+=1;tmpCallbackState.OperationSet.callDepth++;// TODO: Figure out a better pattern for chaining templates so the call stack doesn't get abused.
|
|
3130
|
-
if(tmpCallbackState.OperationSet.callDepth>400){tmpCallbackState.OperationSet.callDepth=0;setTimeout(tmpCallbackState.OperationSet.checkQueue.bind(this),0);}else{tmpCallbackState.OperationSet.checkQueue();}}}wait(fCallback){this.waitingFunctions.push(fCallback);this.checkQueue();}}module.exports=FableServiceAnticipate;},{"fable-serviceproviderbase":
|
|
3138
|
+
if(tmpCallbackState.OperationSet.callDepth>400){tmpCallbackState.OperationSet.callDepth=0;setTimeout(tmpCallbackState.OperationSet.checkQueue.bind(this),0);}else{tmpCallbackState.OperationSet.checkQueue();}}}wait(fCallback){this.waitingFunctions.push(fCallback);this.checkQueue();}}module.exports=FableServiceAnticipate;},{"fable-serviceproviderbase":59}],152:[function(require,module,exports){const libFableServiceProviderBase=require('fable-serviceproviderbase');/**
|
|
3131
3139
|
* Parsing CSVs. Why? Because it's a thing that needs to be done.
|
|
3132
3140
|
*
|
|
3133
3141
|
* 1. And the other node CSV parsers had issues with the really messy files we had.
|
|
3134
|
-
*
|
|
3142
|
+
*
|
|
3135
3143
|
*
|
|
3136
3144
|
* 2. None of the CSV parsers dealt with and multi-line quoted string columns
|
|
3137
|
-
*
|
|
3145
|
+
* which are apparently a-ok according to the official spec.
|
|
3138
3146
|
* Plus a lot of them are asynchronous because apparently that's the best way to
|
|
3139
3147
|
* do anything; unfortunately some files have a sequence issue with that.
|
|
3140
3148
|
*
|
|
@@ -3150,7 +3158,7 @@ if(!this.InQuote){// Push the last remaining column from the buffer to the curre
|
|
|
3150
3158
|
this.pushLine();// Check to see if there is a header -- and if so, if this is the header row
|
|
3151
3159
|
if(this.HasHeader&&!this.HasSetHeader&&this.RowsEmitted==this.HeaderLineIndex){this.HasSetHeader=true;// Override the format as json bit
|
|
3152
3160
|
this.setHeader(this.emitRow(false));// No matter what, formatting this as JSON is silly and we don't want to go there anyway.
|
|
3153
|
-
if(this.EmitHeader){return this.Header;}else{return false;}}else{return this.emitRow();}}else{return false;}}}module.exports=CSVParser;},{"fable-serviceproviderbase":
|
|
3161
|
+
if(this.EmitHeader){return this.Header;}else{return false;}}else{return this.emitRow();}}else{return false;}}}module.exports=CSVParser;},{"fable-serviceproviderbase":59}],153:[function(require,module,exports){const libFableServiceProviderBase=require('fable-serviceproviderbase');/**
|
|
3154
3162
|
* Data Formatting and Translation Functions
|
|
3155
3163
|
*
|
|
3156
3164
|
* @class DataFormat
|
|
@@ -3175,7 +3183,7 @@ this._Regex_formatterAddCommasToNumber=/^([-+]?)(0?)(\d+)(.?)(\d+)$/g;this._Rege
|
|
|
3175
3183
|
// TODO: Use locale data for this if it's defaults all the way down.
|
|
3176
3184
|
this._Value_MoneySign_Currency='$';this._Value_NaN_Currency='--';this._Value_GroupSeparator_Number=',';this._Value_Prefix_StringHash='HSH';this._Value_Clean_formatterCleanNonAlpha='';this._UseEngineStringStartsWith=typeof String.prototype.startsWith==='function';this._UseEngineStringEndsWith=typeof String.prototype.endsWith==='function';this._SanitizeObjectKeyRegex=/[^a-zA-Z0-9_]/gi;this._SanitizeObjectKeyReplacement='_';this._SanitizeObjectKeyInvalid='INVALID';}/*************************************************************************
|
|
3177
3185
|
* String Manipulation and Comparison Functions
|
|
3178
|
-
|
|
3186
|
+
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*//**
|
|
3179
3187
|
* Reverse a string
|
|
3180
3188
|
*
|
|
3181
3189
|
* @param {string} pString - The string to reverse
|
|
@@ -3293,7 +3301,7 @@ if(pString.startsWith(pWrapCharacter)&&pString.endsWith(pWrapCharacter)){return
|
|
|
3293
3301
|
* @return {string} the cleaned string, or a placeholder if the input is invalid
|
|
3294
3302
|
*/sanitizeObjectKey(pString){if(typeof pString!=='string'||pString.length<1){return this._SanitizeObjectKeyInvalid;}return pString.replace(this._SanitizeObjectKeyRegex,this._SanitizeObjectKeyReplacement);}/*************************************************************************
|
|
3295
3303
|
* Number Formatting Functions
|
|
3296
|
-
|
|
3304
|
+
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*//**
|
|
3297
3305
|
* Insert commas every 3 characters from the right. Used by formatterAddCommasToNumber().
|
|
3298
3306
|
*
|
|
3299
3307
|
* @param {*} pString
|
|
@@ -3322,7 +3330,7 @@ return`$${this.formatterAddCommasToNumber(tmpDollarAmount)}`;}/**
|
|
|
3322
3330
|
* @param {number} pDigits
|
|
3323
3331
|
* @returns {string}
|
|
3324
3332
|
*/formatterRoundNumber(pValue,pDigits){let tmpDigits=typeof pDigits=='undefined'?2:pDigits;if(isNaN(pValue)){let tmpZed=0;return tmpZed.toFixed(tmpDigits);}if(pValue===null||pValue===undefined){return'';}let tmpAmountArbitrary=this.fable.Utility.bigNumber(pValue);let tmpValue=tmpAmountArbitrary.toFixed(tmpDigits);if(isNaN(tmpValue)){let tmpZed=0;return tmpZed.toFixed(tmpDigits);}else{return tmpValue;}}/**
|
|
3325
|
-
* Generate a reapeating padding string to be appended before or after depending on
|
|
3333
|
+
* Generate a reapeating padding string to be appended before or after depending on
|
|
3326
3334
|
* which padding function it uses.
|
|
3327
3335
|
*
|
|
3328
3336
|
* @param {*} pString
|
|
@@ -3331,20 +3339,20 @@ return`$${this.formatterAddCommasToNumber(tmpDollarAmount)}`;}/**
|
|
|
3331
3339
|
*/stringGeneratePaddingString(pString,pTargetLength,pPadString){let tmpTargetLength=pTargetLength>>0;let tmpPadString=String(typeof pPadString!=='undefined'?pPadString:' ');if(pString.length>pTargetLength){// No padding string if the source string is already longer than the target length, return an empty string
|
|
3332
3340
|
return'';}else{let tmpPadLength=pTargetLength-pString.length;if(tmpPadLength>tmpPadString.length){tmpPadString+=tmpPadString.repeat(tmpTargetLength/tmpPadString.length);}return tmpPadString.slice(0,tmpPadLength);}}/*************************************************************************
|
|
3333
3341
|
* Time Formatting Functions (milliseconds)
|
|
3334
|
-
|
|
3342
|
+
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*//**
|
|
3335
3343
|
* Format a time length in milliseconds into a human readable string.
|
|
3336
|
-
* @param {number} pTimeSpan
|
|
3344
|
+
* @param {number} pTimeSpan
|
|
3337
3345
|
* @returns {string} - HH:MM:SS.mmm
|
|
3338
3346
|
*/formatTimeSpan(pTimeSpan){if(typeof pTimeSpan!='number'){return'';}let tmpMs=parseInt(pTimeSpan%1000);let tmpSeconds=parseInt(pTimeSpan/1000%60);let tmpMinutes=parseInt(pTimeSpan/(1000*60)%60);let tmpHours=parseInt(pTimeSpan/(1000*60*60));return`${this.stringPadStart(tmpHours,2,'0')}:${this.stringPadStart(tmpMinutes,2,'0')}:${this.stringPadStart(tmpSeconds,2,'0')}.${this.stringPadStart(tmpMs,3,'0')}`;}/**
|
|
3339
3347
|
* Format the time delta between two times in milliseconds into a human readable string.
|
|
3340
|
-
*
|
|
3341
|
-
* @param {number} pTimeStart
|
|
3342
|
-
* @param {number} pTimeEnd
|
|
3348
|
+
*
|
|
3349
|
+
* @param {number} pTimeStart
|
|
3350
|
+
* @param {number} pTimeEnd
|
|
3343
3351
|
* @returns {string} - HH:MM:SS.mmm
|
|
3344
3352
|
*/formatTimeDelta(pTimeStart,pTimeEnd){if(typeof pTimeStart!='number'||typeof pTimeEnd!='number'){return'';}return this.formatTimeSpan(pTimeEnd-pTimeStart);}// THE FOLLOWING TERRIBLE FUNCTIONS ARE FOR QT / WKHTMLTOPDF when luxon and moment don't work so well
|
|
3345
3353
|
getMonthFromDate(pJavascriptDate){var tmpMonths=["January","February","March","April","May","June","July","August","September","October","November","December"];return tmpMonths[pJavascriptDate.getMonth()];}getMonthAbbreviatedFromDate(pJavascriptDate){var tmpMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return tmpMonths[pJavascriptDate.getMonth()];}formatMonthDayYearFromDate(pJavascriptDate,pStrict){let tmpStrict=typeof pStrict!=='undefined'?pStrict:false;let tmpMonth=pJavascriptDate.getMonth()+1;let tmpDay=pJavascriptDate.getDate();let tmpYear=pJavascriptDate.getFullYear();if(tmpStrict){tmpMonth=this.stringPadStart(tmpMonth,2,'0');tmpDay=this.stringPadStart(tmpDay,2,'0');tmpYear=this.stringPadStart(tmpYear,4,'0');}return`${tmpMonth}/${tmpDay}/${tmpYear}`;}formatSortableStringFromDate(pDate){return pDate.getFullYear()+this.stringPadStart(pDate.getMonth(),2,'0')+this.stringPadStart(pDate.getDate(),2,'0');}/*************************************************************************
|
|
3346
3354
|
* String Tokenization Functions
|
|
3347
|
-
|
|
3355
|
+
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*//**
|
|
3348
3356
|
* Return the string before the matched substring.
|
|
3349
3357
|
*
|
|
3350
3358
|
* If the substring is not found, the entire string is returned. This only deals with the *first* match.
|
|
@@ -3362,11 +3370,11 @@ getMonthFromDate(pJavascriptDate){var tmpMonths=["January","February","March","A
|
|
|
3362
3370
|
* @returns {string}
|
|
3363
3371
|
*/stringAfterMatch(pString,pMatch){let tmpStringSplitLocation=pString.indexOf(pMatch);if(tmpStringSplitLocation<0||tmpStringSplitLocation+pMatch.length>=pString.length){return'';}return pString.substring(tmpStringSplitLocation+pMatch.length);}/**
|
|
3364
3372
|
* Count the number of segments in a string, respecting enclosures
|
|
3365
|
-
*
|
|
3366
|
-
* @param {string} pString
|
|
3367
|
-
* @param {string} pSeparator
|
|
3368
|
-
* @param {object} pEnclosureStartSymbolMap
|
|
3369
|
-
* @param {object} pEnclosureEndSymbolMap
|
|
3373
|
+
*
|
|
3374
|
+
* @param {string} pString
|
|
3375
|
+
* @param {string} pSeparator
|
|
3376
|
+
* @param {object} pEnclosureStartSymbolMap
|
|
3377
|
+
* @param {object} pEnclosureEndSymbolMap
|
|
3370
3378
|
* @returns the count of segments in the string as a number
|
|
3371
3379
|
*/stringCountSegments(pString,pSeparator,pEnclosureStartSymbolMap,pEnclosureEndSymbolMap){let tmpString=typeof pString=='string'?pString:'';let tmpSeparator=typeof pSeparator=='string'?pSeparator:'.';let tmpEnclosureStartSymbolMap=typeof pEnclosureStartSymbolMap=='object'?pEnclosureStart:{'{':0,'[':1,'(':2};let tmpEnclosureEndSymbolMap=typeof pEnclosureEndSymbolMap=='object'?pEnclosureEnd:{'}':0,']':1,')':2};if(pString.length<1){return 0;}let tmpSegmentCount=1;let tmpEnclosureStack=[];for(let i=0;i<tmpString.length;i++){// IF This is the start of a segment
|
|
3372
3380
|
if(tmpString[i]==tmpSeparator// AND we are not in a nested portion of the string
|
|
@@ -3378,11 +3386,11 @@ else if(tmpString[i]in tmpEnclosureEndSymbolMap// AND it matches the current nes
|
|
|
3378
3386
|
&&tmpEnclosureEndSymbolMap[tmpString[i]]==tmpEnclosureStack[tmpEnclosureStack.length-1]){// Pop it off the stack!
|
|
3379
3387
|
tmpEnclosureStack.pop();}}return tmpSegmentCount;}/**
|
|
3380
3388
|
* Get all segments in a string, respecting enclosures
|
|
3381
|
-
*
|
|
3382
|
-
* @param {string} pString
|
|
3383
|
-
* @param {string} pSeparator
|
|
3384
|
-
* @param {object} pEnclosureStartSymbolMap
|
|
3385
|
-
* @param {object} pEnclosureEndSymbolMap
|
|
3389
|
+
*
|
|
3390
|
+
* @param {string} pString
|
|
3391
|
+
* @param {string} pSeparator
|
|
3392
|
+
* @param {object} pEnclosureStartSymbolMap
|
|
3393
|
+
* @param {object} pEnclosureEndSymbolMap
|
|
3386
3394
|
* @returns the first segment in the string as a string
|
|
3387
3395
|
*/stringGetSegments(pString,pSeparator,pEnclosureStartSymbolMap,pEnclosureEndSymbolMap){let tmpString=typeof pString=='string'?pString:'';let tmpSeparator=typeof pSeparator=='string'?pSeparator:'.';let tmpEnclosureStartSymbolMap=typeof pEnclosureStartSymbolMap=='object'?pEnclosureStart:{'{':0,'[':1,'(':2,'"':3,"'":4};let tmpEnclosureEndSymbolMap=typeof pEnclosureEndSymbolMap=='object'?pEnclosureEnd:{'}':0,']':1,')':2,'"':3,"'":4};let tmpCurrentSegmentStart=0;let tmpSegmentList=[];if(pString.length<1){return tmpSegmentList;}let tmpEnclosureStack=[];for(let i=0;i<tmpString.length;i++){// IF This is the start of a segment
|
|
3388
3396
|
if(tmpString[i]==tmpSeparator// AND we are not in a nested portion of the string
|
|
@@ -3394,11 +3402,11 @@ else if(tmpString[i]in tmpEnclosureEndSymbolMap// AND it matches the current nes
|
|
|
3394
3402
|
&&tmpEnclosureEndSymbolMap[tmpString[i]]==tmpEnclosureStack[tmpEnclosureStack.length-1]){// Pop it off the stack!
|
|
3395
3403
|
tmpEnclosureStack.pop();}}if(tmpCurrentSegmentStart<tmpString.length){tmpSegmentList.push(tmpString.substring(tmpCurrentSegmentStart));}return tmpSegmentList;}/**
|
|
3396
3404
|
* Get the first segment in a string, respecting enclosures
|
|
3397
|
-
*
|
|
3398
|
-
* @param {string} pString
|
|
3399
|
-
* @param {string} pSeparator
|
|
3400
|
-
* @param {object} pEnclosureStartSymbolMap
|
|
3401
|
-
* @param {object} pEnclosureEndSymbolMap
|
|
3405
|
+
*
|
|
3406
|
+
* @param {string} pString
|
|
3407
|
+
* @param {string} pSeparator
|
|
3408
|
+
* @param {object} pEnclosureStartSymbolMap
|
|
3409
|
+
* @param {object} pEnclosureEndSymbolMap
|
|
3402
3410
|
* @returns the first segment in the string as a string
|
|
3403
3411
|
*/stringGetFirstSegment(pString,pSeparator,pEnclosureStartSymbolMap,pEnclosureEndSymbolMap){let tmpString=typeof pString=='string'?pString:'';let tmpSeparator=typeof pSeparator=='string'?pSeparator:'.';let tmpEnclosureStartSymbolMap=typeof pEnclosureStartSymbolMap=='object'?pEnclosureStart:{'{':0,'[':1,'(':2};let tmpEnclosureEndSymbolMap=typeof pEnclosureEndSymbolMap=='object'?pEnclosureEnd:{'}':0,']':1,')':2};if(pString.length<1){return 0;}let tmpEnclosureStack=[];for(let i=0;i<tmpString.length;i++){// IF This is the start of a segment
|
|
3404
3412
|
if(tmpString[i]==tmpSeparator// AND we are not in a nested portion of the string
|
|
@@ -3470,67 +3478,67 @@ return'';}if(tmpEnclosedValueEndIndex>0&&tmpEnclosedValueEndIndex>tmpEnclosedVal
|
|
|
3470
3478
|
* @param {number} pEnclosureEnd
|
|
3471
3479
|
* @returns {string}
|
|
3472
3480
|
*/stringRemoveEnclosureByIndex(pString,pEnclosureIndexToRemove,pEnclosureStart,pEnclosureEnd){let tmpString=typeof pString=='string'?pString:'';let tmpEnclosureIndexToRemove=typeof pEnclosureIndexToRemove=='number'?pEnclosureIndexToRemove:0;let tmpEnclosureStart=typeof pEnclosureStart=='string'?pEnclosureStart:'(';let tmpEnclosureEnd=typeof pEnclosureEnd=='string'?pEnclosureEnd:')';let tmpEnclosureCount=0;let tmpEnclosureDepth=0;let tmpMatchedEnclosureIndex=false;let tmpEnclosureStartIndex=0;let tmpEnclosureEndIndex=0;for(let i=0;i<tmpString.length;i++){// This is the start of an enclosure
|
|
3473
|
-
if(tmpString[i]==tmpEnclosureStart){tmpEnclosureDepth++;if(tmpEnclosureDepth==1){tmpEnclosureCount++;if(tmpEnclosureIndexToRemove==tmpEnclosureCount-1){tmpMatchedEnclosureIndex=true;tmpEnclosureStartIndex=i;}}}else if(tmpString[i]==tmpEnclosureEnd){tmpEnclosureDepth--;if(tmpEnclosureDepth==0&&tmpMatchedEnclosureIndex&&tmpEnclosureEndIndex<=tmpEnclosureStartIndex){tmpEnclosureEndIndex=i;tmpMatchedEnclosureIndex=false;}}}if(tmpEnclosureCount<=tmpEnclosureIndexToRemove){return tmpString;}let tmpReturnString='';if(tmpEnclosureStartIndex>1){tmpReturnString=tmpString.substring(0,tmpEnclosureStartIndex);}if(tmpString.length>tmpEnclosureEndIndex+1&&tmpEnclosureEndIndex>tmpEnclosureStartIndex){tmpReturnString+=tmpString.substring(tmpEnclosureEndIndex+1);}return tmpReturnString;}}module.exports=DataFormat;},{"fable-serviceproviderbase":
|
|
3481
|
+
if(tmpString[i]==tmpEnclosureStart){tmpEnclosureDepth++;if(tmpEnclosureDepth==1){tmpEnclosureCount++;if(tmpEnclosureIndexToRemove==tmpEnclosureCount-1){tmpMatchedEnclosureIndex=true;tmpEnclosureStartIndex=i;}}}else if(tmpString[i]==tmpEnclosureEnd){tmpEnclosureDepth--;if(tmpEnclosureDepth==0&&tmpMatchedEnclosureIndex&&tmpEnclosureEndIndex<=tmpEnclosureStartIndex){tmpEnclosureEndIndex=i;tmpMatchedEnclosureIndex=false;}}}if(tmpEnclosureCount<=tmpEnclosureIndexToRemove){return tmpString;}let tmpReturnString='';if(tmpEnclosureStartIndex>1){tmpReturnString=tmpString.substring(0,tmpEnclosureStartIndex);}if(tmpString.length>tmpEnclosureEndIndex+1&&tmpEnclosureEndIndex>tmpEnclosureStartIndex){tmpReturnString+=tmpString.substring(tmpEnclosureEndIndex+1);}return tmpReturnString;}}module.exports=DataFormat;},{"fable-serviceproviderbase":59}],154:[function(require,module,exports){module.exports={"DefaultIntegerMinimum":0,"DefaultIntegerMaximum":9999999,"DefaultNumericStringLength":10,"MonthSet":["January","February","March","April","May","June","July","August","September","October","November","December"],"WeekDaySet":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"ColorSet":["Red","Orange","Yellow","Green","Blue","Indigo","Violet","Pink","Purple","Turquoise","Gold","Lime","Maroon","Navy","Coral","Teal","Brown","White","Black","Sky","Berry","Grey","Straw","Silver","Sapphire"],"SurNameSet":["Smith","Johnson","Williams","Brown","Jones","Miller","Davis","Garcia","Rodriguez","Wilson","Martinez","Anderson","Taylor","Thomas","Hernandez","Moore","Martin","Jackson","Thompson","White","Lopez","Lee","Gonzalez","Harris","Clark","Lewis","Robinson","Walker","Perez","Hall","Young","Allen","Sanchez","Wright","King","Scott","Green","Baker","Adams","Nelson","Hill","Ramirez","Campbell","Mitchell","Roberts","Carter","Phillips","Evans","Turner","Torres","Parker","Collins","Edwards","Stewart","Flores","Morris","Nguyen","Murphy","Rivera","Cook","Rogers","Morgan","Peterson","Cooper","Reed","Bailey","Bell","Gomez","Kelly","Howard","Ward","Cox","Diaz","Richardson","Wood","Watson","Brooks","Bennett","Gray","James","Reyes","Cruz","Hughes","Price","Myers","Long","Foster","Sanders","Ross","Morales","Powell","Sullivan","Russell","Ortiz","Jenkins","Gutierrez","Perry","Butler","Barnes","Fisher"],"NameSet":["Mary","Patricia","Jennifer","Linda","Elizabeth","Barbara","Susan","Jessica","Sarah","Karen","Lisa","Nancy","Betty","Sandra","Margaret","Ashley","Kimberly","Emily","Donna","Michelle","Carol","Amanda","Melissa","Deborah","Stephanie","Dorothy","Rebecca","Sharon","Laura","Cynthia","Amy","Kathleen","Angela","Shirley","Brenda","Emma","Anna","Pamela","Nicole","Samantha","Katherine","Christine","Helen","Debra","Rachel","Carolyn","Janet","Maria","Catherine","Heather","Diane","Olivia","Julie","Joyce","Victoria","Ruth","Virginia","Lauren","Kelly","Christina","Joan","Evelyn","Judith","Andrea","Hannah","Megan","Cheryl","Jacqueline","Martha","Madison","Teresa","Gloria","Sara","Janice","Ann","Kathryn","Abigail","Sophia","Frances","Jean","Alice","Judy","Isabella","Julia","Grace","Amber","Denise","Danielle","Marilyn","Beverly","Charlotte","Natalie","Theresa","Diana","Brittany","Doris","Kayla","Alexis","Lori","Marie","James","Robert","John","Michael","David","William","Richard","Joseph","Thomas","Christopher","Charles","Daniel","Matthew","Anthony","Mark","Donald","Steven","Andrew","Paul","Joshua","Kenneth","Kevin","Brian","George","Timothy","Ronald","Jason","Edward","Jeffrey","Ryan","Jacob","Gary","Nicholas","Eric","Jonathan","Stephen","Larry","Justin","Scott","Brandon","Benjamin","Samuel","Gregory","Alexander","Patrick","Frank","Raymond","Jack","Dennis","Jerry","Tyler","Aaron","Jose","Adam","Nathan","Henry","Zachary","Douglas","Peter","Kyle","Noah","Ethan","Jeremy","Walter","Christian","Keith","Roger","Terry","Austin","Sean","Gerald","Carl","Harold","Dylan","Arthur","Lawrence","Jordan","Jesse","Bryan","Billy","Bruce","Gabriel","Joe","Logan","Alan","Juan","Albert","Willie","Elijah","Wayne","Randy","Vincent","Mason","Roy","Ralph","Bobby","Russell","Bradley","Philip","Eugene"]};},{}],155:[function(require,module,exports){const libFableServiceBase=require('fable-serviceproviderbase');/**
|
|
3474
3482
|
* FableServiceDataGeneration class provides various methods for generating random data.
|
|
3475
|
-
*
|
|
3483
|
+
*
|
|
3476
3484
|
* @extends libFableServiceBase
|
|
3477
3485
|
*/class FableServiceDataGeneration extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='DataGeneration';this.defaultData=require('./Fable-Service-DataGeneration-DefaultValues.json');}/**
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3486
|
+
* Generates a random integer between the specified minimum and maximum values.
|
|
3487
|
+
*
|
|
3488
|
+
* @param {number} pMinimum - The minimum value (inclusive).
|
|
3489
|
+
* @param {number} pMaximum - The maximum value (exclusive).
|
|
3490
|
+
* @returns {number} A random integer between pMinimum and pMaximum.
|
|
3491
|
+
*/randomIntegerBetween(pMinimum,pMaximum){try{let tmpMinimum=parseInt(pMinimum,10);let tmpMaximum=parseInt(pMaximum,10);return Math.floor(Math.random()*(tmpMaximum-tmpMinimum))+tmpMinimum;}catch(pError){this.fable.log.error('Error in randomIntegerBetween',pError,{'Minimum':pMinimum,'Maximum':pMaximum});return NaN;}}/**
|
|
3492
|
+
* Generates a random integer between 0 (inclusive) and the specified maximum value (exclusive).
|
|
3493
|
+
*
|
|
3494
|
+
* @param {number} pMaximum - The maximum value (exclusive).
|
|
3495
|
+
* @returns {number} A random integer between 0 and pMaximum.
|
|
3496
|
+
*/randomIntegerUpTo(pMaximum){return this.randomIntegerBetween(0,pMaximum);}/**
|
|
3497
|
+
* Generates a random integer between 0 (inclusive) and the default maximum value.
|
|
3498
|
+
*
|
|
3499
|
+
* @returns {number} A random integer between 0 and the default maximum value.
|
|
3500
|
+
*/randomInteger(){return Math.floor(Math.random()*this.defaultData.DefaultIntegerMaximum);}/**
|
|
3501
|
+
* Generates a random float between the specified minimum and maximum values.
|
|
3502
|
+
*
|
|
3503
|
+
* @param {number} pMinimum - The minimum value (inclusive).
|
|
3504
|
+
* @param {number} pMaximum - The maximum value (exclusive).
|
|
3505
|
+
* @returns {number} A random float between pMinimum and pMaximum.
|
|
3506
|
+
*/randomFloatBetween(pMinimum,pMaximum){try{let tmpMinimum=parseFloat(pMinimum);let tmpMaximum=parseFloat(pMaximum);return this.fable.Math.addPrecise(this.fable.Math.multiplyPrecise(Math.random(),this.fable.Math.subtractPrecise(tmpMaximum,tmpMinimum)),tmpMinimum);}catch(pError){this.fable.log.error('Error in randomFloatBetween',pError,{'Minimum':pMinimum,'Maximum':pMaximum});return NaN;}}/**
|
|
3507
|
+
* Generates a random float between 0 (inclusive) and the specified maximum value (exclusive).
|
|
3508
|
+
*
|
|
3509
|
+
* @param {number} pMaximum - The maximum value (exclusive).
|
|
3510
|
+
* @returns {number} A random float between 0 and pMaximum.
|
|
3511
|
+
*/randomFloatUpTo(pMaximum){return this.randomFloatBetween(0,pMaximum);}/**
|
|
3512
|
+
* Generates a random float between 0 (inclusive) and 1 (exclusive).
|
|
3513
|
+
*
|
|
3514
|
+
* @returns {number} A random float between 0 and 1.
|
|
3515
|
+
*/randomFloat(){return Math.random();}/**
|
|
3516
|
+
* Generates a random numeric string of the specified length.
|
|
3517
|
+
*
|
|
3518
|
+
* @param {number} pLength - The length of the numeric string.
|
|
3519
|
+
* @param {number} pMaxNumber - The maximum number to generate.
|
|
3520
|
+
* @returns {string} A random numeric string of the specified length.
|
|
3521
|
+
*/randomNumericString(pLength,pMaxNumber){let tmpLength=typeof pLength==='undefined'?10:pLength;let tmpMaxNumber=typeof pMaxNumber==='undefined'?9999999999:pMaxNumber;return this.services.DataFormat.stringPadStart(this.randomIntegerUpTo(tmpMaxNumber),pLength,'0');}/**
|
|
3522
|
+
* Generates a random month from the default month set.
|
|
3523
|
+
*
|
|
3524
|
+
* @returns {string} A random month.
|
|
3525
|
+
*/randomMonth(){return this.defaultData.MonthSet[this.randomIntegerUpTo(this.defaultData.MonthSet.length-1)];}/**
|
|
3526
|
+
* Generates a random day of the week from the default week day set.
|
|
3527
|
+
*
|
|
3528
|
+
* @returns {string} A random day of the week.
|
|
3529
|
+
*/randomDayOfWeek(){return this.defaultData.WeekDaySet[this.randomIntegerUpTo(this.defaultData.WeekDaySet.length-1)];}/**
|
|
3530
|
+
* Generates a random color from the default color set.
|
|
3531
|
+
*
|
|
3532
|
+
* @returns {string} A random color.
|
|
3533
|
+
*/randomColor(){return this.defaultData.ColorSet[this.randomIntegerUpTo(this.defaultData.ColorSet.length-1)];}/**
|
|
3534
|
+
* Generates a random name from the default name set.
|
|
3535
|
+
*
|
|
3536
|
+
* @returns {string} A random name.
|
|
3537
|
+
*/randomName(){return this.defaultData.NameSet[this.randomIntegerUpTo(this.defaultData.NameSet.length-1)];}/**
|
|
3538
|
+
* Generates a random surname from the default surname set.
|
|
3539
|
+
*
|
|
3540
|
+
* @returns {string} A random surname.
|
|
3541
|
+
*/randomSurname(){return this.defaultData.SurNameSet[this.randomIntegerUpTo(this.defaultData.SurNameSet.length-1)];}}module.exports=FableServiceDataGeneration;},{"./Fable-Service-DataGeneration-DefaultValues.json":154,"fable-serviceproviderbase":59}],156:[function(require,module,exports){const libFableServiceProviderBase=require('fable-serviceproviderbase');/**
|
|
3534
3542
|
* Date management a la Moment using days.js
|
|
3535
3543
|
*
|
|
3536
3544
|
* @class DateManipulation
|
|
@@ -3546,79 +3554,79 @@ this.plugin_advancedFormat=require('dayjs/plugin/advancedFormat');this.dayJS.ext
|
|
|
3546
3554
|
// const localeDE = require('dayjs/locale/de');
|
|
3547
3555
|
// _Fable.Dates.dayJS.locale('de');
|
|
3548
3556
|
}/**
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3557
|
+
* Calculates the difference in milliseconds between two dates.
|
|
3558
|
+
*
|
|
3559
|
+
* @param {string|Date|number} pDateStart - The start date. Can be a string, Date object, or timestamp.
|
|
3560
|
+
* @param {string|Date|number} pDateEnd - The end date. Can be a string, Date object, or timestamp. Defaults to the current date if not provided.
|
|
3561
|
+
* @param {boolean} pRequireEndDate - If true, the end date must be provided; otherwise, it defaults to the current date.
|
|
3562
|
+
* @returns {number} The difference in milliseconds between the start and end dates. Returns NaN if the start date is invalid.
|
|
3563
|
+
*/dateMillisecondDifference(pDateStart,pDateEnd){let pRequireEndDate=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(pDateStart===undefined||pDateStart===null||pDateStart===''){return NaN;}if((pRequireEndDate||pRequireEndDate==1||pRequireEndDate=='1')&&(pDateEnd===undefined||pDateEnd===null||pDateEnd==='')){return NaN;}let tmpStartDate=this.dayJS(pDateStart);let tmpEndDate=this.dayJS(pDateEnd);return tmpEndDate.diff(tmpStartDate,'millisecond');}/**
|
|
3564
|
+
* Calculates the difference in seconds between two dates.
|
|
3565
|
+
*
|
|
3566
|
+
* @param {string|Date|number} pDateStart - The start date. Can be a string, Date object, or timestamp.
|
|
3567
|
+
* @param {string|Date|number} pDateEnd - The end date. Can be a string, Date object, or timestamp. Defaults to the current date if not provided.
|
|
3568
|
+
* @param {boolean} pRequireEndDate - If true, the end date must be provided; otherwise, it defaults to the current date.
|
|
3569
|
+
* @returns {number} The difference in seconds between the start and end dates. Returns NaN if the start date is invalid.
|
|
3570
|
+
*/dateSecondDifference(pDateStart,pDateEnd){let pRequireEndDate=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(pDateStart===undefined||pDateStart===null||pDateStart===''){return NaN;}if((pRequireEndDate||pRequireEndDate==1||pRequireEndDate=='1')&&(pDateEnd===undefined||pDateEnd===null||pDateEnd==='')){return NaN;}let tmpStartDate=this.dayJS(pDateStart);let tmpEndDate=this.dayJS(pDateEnd);return tmpEndDate.diff(tmpStartDate,'second');}/**
|
|
3571
|
+
* Calculates the difference in minutes between two dates.
|
|
3572
|
+
*
|
|
3573
|
+
* @param {string|Date|number} pDateStart - The start date. Can be a string, Date object, or timestamp.
|
|
3574
|
+
* @param {string|Date|number} pDateEnd - The end date. Can be a string, Date object, or timestamp. Defaults to the current date if not provided.
|
|
3575
|
+
* @param {boolean} pRequireEndDate - If true, the end date must be provided; otherwise, it defaults to the current date.
|
|
3576
|
+
* @returns {number} The difference in minutes between the start and end dates. Returns NaN if the start date is invalid.
|
|
3577
|
+
*/dateMinuteDifference(pDateStart,pDateEnd){let pRequireEndDate=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(pDateStart===undefined||pDateStart===null||pDateStart===''){return NaN;}if((pRequireEndDate||pRequireEndDate==1||pRequireEndDate=='1')&&(pDateEnd===undefined||pDateEnd===null||pDateEnd==='')){return NaN;}let tmpStartDate=this.dayJS(pDateStart);let tmpEndDate=this.dayJS(pDateEnd);return tmpEndDate.diff(tmpStartDate,'minute');}/**
|
|
3578
|
+
* Calculates the difference in hours between two dates.
|
|
3579
|
+
*
|
|
3580
|
+
* @param {string|Date|number} pDateStart - The start date. Can be a string, Date object, or timestamp.
|
|
3581
|
+
* @param {string|Date|number} pDateEnd - The end date. Can be a string, Date object, or timestamp. Defaults to the current date if not provided.
|
|
3582
|
+
* @param {boolean} pRequireEndDate - If true, the end date must be provided; otherwise, it defaults to the current date.
|
|
3583
|
+
* @returns {number} The difference in hours between the start and end dates. Returns NaN if the start date is invalid.
|
|
3584
|
+
*/dateHourDifference(pDateStart,pDateEnd){let pRequireEndDate=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(pDateStart===undefined||pDateStart===null||pDateStart===''){return NaN;}if((pRequireEndDate||pRequireEndDate==1||pRequireEndDate=='1')&&(pDateEnd===undefined||pDateEnd===null||pDateEnd==='')){return NaN;}let tmpStartDate=this.dayJS(pDateStart);let tmpEndDate=this.dayJS(pDateEnd);return tmpEndDate.diff(tmpStartDate,'hour');}/**
|
|
3585
|
+
* Calculates the difference in days between two dates.
|
|
3586
|
+
*
|
|
3587
|
+
* @param {string|Date|number} pDateStart - The start date. Can be a string, Date object, or timestamp.
|
|
3588
|
+
* @param {string|Date|number} pDateEnd - The end date. Can be a string, Date object, or timestamp. Defaults to the current date if not provided.
|
|
3589
|
+
* @param {boolean} pRequireEndDate - If true, the end date must be provided; otherwise, it defaults to the current date.
|
|
3590
|
+
* @returns {number} The difference in days between the start and end dates. Returns NaN if the start date is invalid.
|
|
3591
|
+
*/dateDayDifference(pDateStart,pDateEnd){let pRequireEndDate=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(pDateStart===undefined||pDateStart===null||pDateStart===''){return NaN;}if((pRequireEndDate||pRequireEndDate==1||pRequireEndDate=='1')&&(pDateEnd===undefined||pDateEnd===null||pDateEnd==='')){return NaN;}let tmpStartDate=this.dayJS(pDateStart);let tmpEndDate=this.dayJS(pDateEnd);return tmpEndDate.diff(tmpStartDate,'day');}/**
|
|
3592
|
+
* Calculates the difference in weeks between two dates.
|
|
3593
|
+
*
|
|
3594
|
+
* @param {string|Date|number} pDateStart - The start date. Can be a string, Date object, or timestamp.
|
|
3595
|
+
* @param {string|Date|number} pDateEnd - The end date. Can be a string, Date object, or timestamp. Defaults to the current date if not provided.
|
|
3596
|
+
* @param {boolean} pRequireEndDate - If true, the end date must be provided; otherwise, it defaults to the current date.
|
|
3597
|
+
* @returns {number} The difference in weeks between the two dates. Returns NaN if the start date is invalid.
|
|
3598
|
+
*/dateWeekDifference(pDateStart,pDateEnd){let pRequireEndDate=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(pDateStart===undefined||pDateStart===null||pDateStart===''){return NaN;}if((pRequireEndDate||pRequireEndDate==1||pRequireEndDate=='1')&&(pDateEnd===undefined||pDateEnd===null||pDateEnd==='')){return NaN;}let tmpStartDate=this.dayJS(pDateStart);let tmpEndDate=this.dayJS(pDateEnd);return tmpEndDate.diff(tmpStartDate,'week');}/**
|
|
3599
|
+
* Calculates the difference in months between two dates.
|
|
3600
|
+
*
|
|
3601
|
+
* @param {string|Date|number} pDateStart - The start date. Can be a string, Date object, or timestamp.
|
|
3602
|
+
* @param {string|Date|number} pDateEnd - The end date. Can be a string, Date object, or timestamp. Defaults to the current date if not provided.
|
|
3603
|
+
* @param {boolean} pRequireEndDate - If true, the end date must be provided; otherwise, it defaults to the current date.
|
|
3604
|
+
* @returns {number} The difference in months between the two dates. Returns NaN if the start date is invalid.
|
|
3605
|
+
*/dateMonthDifference(pDateStart,pDateEnd){let pRequireEndDate=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(pDateStart===undefined||pDateStart===null||pDateStart===''){return NaN;}if((pRequireEndDate||pRequireEndDate==1||pRequireEndDate=='1')&&(pDateEnd===undefined||pDateEnd===null||pDateEnd==='')){return NaN;}let tmpStartDate=this.dayJS(pDateStart);let tmpEndDate=this.dayJS(pDateEnd);return tmpEndDate.diff(tmpStartDate,'month');}/**
|
|
3606
|
+
* Calculates the difference in years between two dates.
|
|
3607
|
+
*
|
|
3608
|
+
* @param {string|Date|number} pDateStart - The start date. Can be a string, Date object, or timestamp.
|
|
3609
|
+
* @param {string|Date|number} pDateEnd - The end date. Can be a string, Date object, or timestamp. Defaults to the current date if not provided.
|
|
3610
|
+
* @param {boolean} pRequireEndDate - If true, the end date must be provided; otherwise, it defaults to the current date.
|
|
3611
|
+
* @returns {number} The difference in years between the two dates. Returns NaN if the start date is invalid.
|
|
3612
|
+
*/dateYearDifference(pDateStart,pDateEnd){let pRequireEndDate=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(pDateStart===undefined||pDateStart===null||pDateStart===''){return NaN;}if((pRequireEndDate||pRequireEndDate==1||pRequireEndDate=='1')&&(pDateEnd===undefined||pDateEnd===null||pDateEnd==='')){return NaN;}let tmpStartDate=this.dayJS(pDateStart);let tmpEndDate=this.dayJS(pDateEnd);return tmpEndDate.diff(tmpStartDate,'year');}dateAddMilliseconds(pDate,pAmount){return this.dateMath(pDate,pAmount,'millisecond','add');}dateAddSeconds(pDate,pAmount){return this.dateMath(pDate,pAmount,'second','add');}dateAddMinutes(pDate,pAmount){return this.dateMath(pDate,pAmount,'minute','add');}dateAddHours(pDate,pAmount){return this.dateMath(pDate,pAmount,'hour','add');}dateAddDays(pDate,pAmount){return this.dateMath(pDate,pAmount,'day','add');}dateAddWeeks(pDate,pAmount){return this.dateMath(pDate,pAmount,'week','add');}dateAddMonths(pDate,pAmount){return this.dateMath(pDate,pAmount,'month','add');}dateAddYears(pDate,pAmount){return this.dateMath(pDate,pAmount,'year','add');}dateMath(pDate,pAmount,pUnit,pOperation){try{let tmpDate=this.dayJS.utc(pDate);if(pOperation==='add'){tmpDate=tmpDate.add(pAmount,pUnit);}else if(pOperation==='subtract'){tmpDate=tmpDate.subtract(pAmount,pUnit);}return this.dayJS.utc(tmpDate).toISOString();}catch(pError){return undefined;}}dateFromParts(pYear,pMonth,pDay){let pHour=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;let pMinute=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;let pSecond=arguments.length>5&&arguments[5]!==undefined?arguments[5]:0;let pMillisecond=arguments.length>6&&arguments[6]!==undefined?arguments[6]:0;try{let tmpDate=this.dayJS.utc().year(pYear).month(pMonth-1).date(pDay).hour(pHour).minute(pMinute).second(pSecond).millisecond(pMillisecond);return tmpDate.toISOString();}catch(pError){return undefined;}}}module.exports=DateManipulation;},{"dayjs":32,"dayjs/plugin/advancedFormat":33,"dayjs/plugin/isoWeek":34,"dayjs/plugin/relativeTime":35,"dayjs/plugin/timezone":36,"dayjs/plugin/utc":37,"dayjs/plugin/weekOfYear":38,"dayjs/plugin/weekday":39,"fable-serviceproviderbase":59}],157:[function(require,module,exports){const libFableServiceBase=require('fable-serviceproviderbase');class FableServiceEnvironmentData extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='EnvironmentData';this.Environment=`node.js`;}}module.exports=FableServiceEnvironmentData;},{"fable-serviceproviderbase":59}],158:[function(require,module,exports){const libFableServiceBase=require('fable-serviceproviderbase');/* Trying a different pattern for this service ...
|
|
3605
3613
|
*
|
|
3606
3614
|
* This service is a simple expression parser that can handle math expressions, with magic(tm) lookup of addresses with a manifest.
|
|
3607
|
-
*
|
|
3615
|
+
*
|
|
3608
3616
|
* Each method works multiple ways.
|
|
3609
|
-
*
|
|
3617
|
+
*
|
|
3610
3618
|
* 1. You can pass in a results object, and, it will put the state for that step outcome into the results object.
|
|
3611
3619
|
* 2. It always returns the state, and works without the results object.
|
|
3612
|
-
*
|
|
3613
|
-
*
|
|
3620
|
+
*
|
|
3621
|
+
*
|
|
3614
3622
|
* Learned a lot from this npm package: https://www.npmjs.com/package/math-expression-evaluator
|
|
3615
3623
|
* And its related code at github: https://github.com/bugwheels94/math-expression-evaluator
|
|
3616
|
-
*
|
|
3624
|
+
*
|
|
3617
3625
|
* There were two problems with the codebase above...
|
|
3618
|
-
*
|
|
3626
|
+
*
|
|
3619
3627
|
* First, the code was very unreadable and determining it was correct or extending it
|
|
3620
3628
|
* was out of the question.
|
|
3621
|
-
*
|
|
3629
|
+
*
|
|
3622
3630
|
* Second, and this is a larger issue, is that we need the expressions to be parsed as
|
|
3623
3631
|
* arbitrary precision. When I determined that extending the library to use string-based
|
|
3624
3632
|
* numbers and an arbitrary precision library as the back-end would have taken a significantly
|
|
@@ -3628,15 +3636,15 @@ this.plugin_advancedFormat=require('dayjs/plugin/advancedFormat');this.dayJS.ext
|
|
|
3628
3636
|
* @param {Object} pFable - The Fable object.
|
|
3629
3637
|
* @param {Object} pOptions - The options for the service.
|
|
3630
3638
|
* @param {string} pServiceHash - The hash of the service.
|
|
3631
|
-
*/constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);// The configuration for tokens that the solver recognizes, with precedence and friendly names.
|
|
3639
|
+
*/constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);/** @type {import('../Fable.js') & { Math: import('./Fable-Service-Math.js') }} */this.fable;/** @type {any} */this.log;// The configuration for tokens that the solver recognizes, with precedence and friendly names.
|
|
3632
3640
|
this.tokenMap=require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-TokenMap.json');// Keep track of maximum token precedence
|
|
3633
3641
|
this.tokenMaxPrecedence=4;// This isn't exactly a radix tree but close enough. It's a map of the first character of the token to the token.
|
|
3634
3642
|
this.tokenRadix={};let tmpTokenKeys=Object.keys(this.tokenMap);for(let i=0;i<tmpTokenKeys.length;i++){let tmpTokenKey=tmpTokenKeys[i];let tmpToken=this.tokenMap[tmpTokenKey];tmpToken.Token=tmpTokenKey;tmpToken.Length=tmpTokenKey.length;let tmpTokenStartCharacter=tmpToken.Token[0];if(!(tmpTokenStartCharacter in this.tokenRadix)){// With a token count of 1 and a literal of true, we can assume it being in the radix is the token.
|
|
3635
3643
|
this.tokenRadix[tmpTokenStartCharacter]={TokenCount:0,Literal:false,TokenKeys:[],TokenMap:{}};}this.tokenRadix[tmpTokenStartCharacter].TokenCount++;if(tmpTokenKey==tmpTokenStartCharacter){this.tokenRadix[tmpTokenStartCharacter].Literal=true;}this.tokenRadix[tmpTokenStartCharacter].TokenMap[tmpToken.Token]=tmpToken;this.tokenRadix[tmpTokenStartCharacter].TokenKeys.push(tmpTokenKey);this.tokenRadix[tmpTokenStartCharacter].TokenKeys.sort((pLeft,pRight)=>pRight.length-pLeft.length);if(this.tokenMaxPrecedence<tmpToken.Precedence){this.tokenMaxPrecedence=tmpToken.Precedence;}}// The configuration for which functions are available to the solver.
|
|
3636
3644
|
this.functionMap=require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-FunctionMap.json');this.serviceType='ExpressionParser';// These are sub-services for the tokenizer, linter, compiler, marshaler and solver.
|
|
3637
|
-
this.fable.addServiceTypeIfNotExists('ExpressionParser-Tokenizer',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ExpressionTokenizer.js'));this.fable.addServiceTypeIfNotExists('ExpressionParser-Linter',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Linter.js'));this.fable.addServiceTypeIfNotExists('ExpressionParser-Postfix',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Postfix.js'));this.fable.addServiceTypeIfNotExists('ExpressionParser-ValueMarshal',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ValueMarshal.js'));this.fable.addServiceTypeIfNotExists('ExpressionParser-Solver',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-SolvePostfixedExpression.js'));// And the sub-service for the friendly user messaging
|
|
3645
|
+
this.fable.addServiceTypeIfNotExists('ExpressionParser-Tokenizer',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ExpressionTokenizer.js'));this.fable.addServiceTypeIfNotExists('ExpressionParser-TokenizerDirectiveMutation',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ExpressionTokenizer-DirectiveMutation.js'));this.fable.addServiceTypeIfNotExists('ExpressionParser-Linter',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Linter.js'));this.fable.addServiceTypeIfNotExists('ExpressionParser-Postfix',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Postfix.js'));this.fable.addServiceTypeIfNotExists('ExpressionParser-ValueMarshal',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ValueMarshal.js'));this.fable.addServiceTypeIfNotExists('ExpressionParser-Solver',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-SolvePostfixedExpression.js'));// And the sub-service for the friendly user messaging
|
|
3638
3646
|
this.fable.addServiceTypeIfNotExists('ExpressionParser-Messaging',require('./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Messaging.js'));// This code instantitates these fable services to child objects of this service, but does not pollute the main fable with them.
|
|
3639
|
-
this.Tokenizer=this.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-Tokenizer');this.Linter=this.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-Linter');this.Postfix=this.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-Postfix');this.ValueMarshal=this.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-ValueMarshal');this.Solver=this.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-Solver');this.Messaging=this.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-Messaging');// Wire each sub service into this instance of the solver.
|
|
3647
|
+
this.Tokenizer=this.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-Tokenizer');this.Tokenizer.TokenizerDirectiveMutation=this.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-TokenizerDirectiveMutation');this.Linter=this.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-Linter');this.Postfix=this.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-Postfix');this.ValueMarshal=this.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-ValueMarshal');this.Solver=this.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-Solver');this.Messaging=this.fable.instantiateServiceProviderWithoutRegistration('ExpressionParser-Messaging');// Wire each sub service into this instance of the solver.
|
|
3640
3648
|
this.Tokenizer.connectExpressionParser(this);this.Linter.connectExpressionParser(this);this.Postfix.connectExpressionParser(this);this.ValueMarshal.connectExpressionParser(this);this.Solver.connectExpressionParser(this);this.Messaging.connectExpressionParser(this);this.GenericManifest=this.fable.newManyfest();// This will look for a LogNoisiness on fable (or one that falls in from pict) and if it doesn't exist, set one for this service.
|
|
3641
3649
|
this.LogNoisiness='LogNoisiness'in this.fable?this.fable.LogNoisiness:0;}/**
|
|
3642
3650
|
* Tokenizes the given mathematical expression string.
|
|
@@ -3658,7 +3666,7 @@ this.LogNoisiness='LogNoisiness'in this.fable?this.fable.LogNoisiness:0;}/**
|
|
|
3658
3666
|
* @returns {Array} The postfix solve list.
|
|
3659
3667
|
*/buildPostfixedSolveList(pTokenizedExpression,pResultObject){return this.Postfix.buildPostfixedSolveList(pTokenizedExpression,pResultObject);}/**
|
|
3660
3668
|
* Substitutes values in tokenized objects.
|
|
3661
|
-
*
|
|
3669
|
+
*
|
|
3662
3670
|
* This means marshaling data from pDataSource into the array of objects with the passed in Manifest (or a generic manifest) to prepare for solving.
|
|
3663
3671
|
*
|
|
3664
3672
|
* @param {Array} pTokenizedObjects - The array of tokenized objects.
|
|
@@ -3676,20 +3684,45 @@ this.LogNoisiness='LogNoisiness'in this.fable?this.fable.LogNoisiness:0;}/**
|
|
|
3676
3684
|
* @returns {any} The result of the solved expression.
|
|
3677
3685
|
*/solvePostfixedExpression(pPostfixedExpression,pDataDestinationObject,pResultObject,pManifest){return this.Solver.solvePostfixedExpression(pPostfixedExpression,pDataDestinationObject,pResultObject,pManifest);}/**
|
|
3678
3686
|
* Solves the given expression using the provided data and manifest.
|
|
3679
|
-
*
|
|
3687
|
+
*
|
|
3680
3688
|
* @param {string} pExpression - The expression to solve.
|
|
3681
|
-
* @param {
|
|
3682
|
-
* @param {
|
|
3683
|
-
* @param {
|
|
3684
|
-
* @param {
|
|
3689
|
+
* @param {Record<string, any>} [pDataSourceObject] - (optional) The data source object (e.g. AppData).
|
|
3690
|
+
* @param {Record<string, any>} [pResultObject] - (optional) The result object containing the full postfix expression list, internal variables and solver history.
|
|
3691
|
+
* @param {import('manyfest')} [pManifest] - (optional) The manifest object for dereferencing variables.
|
|
3692
|
+
* @param {Record<string, any>} [pDataDestinationObject] - (optional) The data destination object for where to marshal the result into.
|
|
3685
3693
|
* @returns {any} - The result of solving the expression.
|
|
3686
3694
|
*/solve(pExpression,pDataSourceObject,pResultObject,pManifest,pDataDestinationObject){let tmpResultsObject=typeof pResultObject==='object'?pResultObject:{};let tmpDataSourceObject=typeof pDataSourceObject==='object'?pDataSourceObject:{};let tmpDataDestinationObject=typeof pDataDestinationObject==='object'?pDataDestinationObject:{};// This is technically a "pre-compile" and we can keep this Results Object around to reuse for better performance. Not required.
|
|
3687
|
-
this.tokenize(pExpression,tmpResultsObject)
|
|
3695
|
+
this.tokenize(pExpression,tmpResultsObject);// Lint the tokenized expression to make sure it's valid
|
|
3696
|
+
this.lintTokenizedExpression(tmpResultsObject.RawTokens,tmpResultsObject);this.buildPostfixedSolveList(tmpResultsObject.RawTokens,tmpResultsObject);if(tmpResultsObject.SolverDirectives.Code=='SERIES'){// Make sure tmpResultsObject.SolverDirective values for From: null, To: null, Step: null are all numeric and non-zero where applicable
|
|
3697
|
+
let tmpFrom=this.fable.Math.parsePrecise(tmpResultsObject.SolverDirectives.From,NaN);let tmpTo=this.fable.Math.parsePrecise(tmpResultsObject.SolverDirectives.To,NaN);let tmpStep=this.fable.Math.parsePrecise(tmpResultsObject.SolverDirectives.Step,NaN);if(isNaN(tmpStep)){tmpStep='1';}if(isNaN(tmpFrom)||isNaN(tmpTo)){tmpResultsObject.ExpressionParserLog.push(`ExpressionParser.solve detected invalid SERIES directive parameters. FROM, TO must be numeric.`);this.log.warn(tmpResultsObject.ExpressionParserLog[tmpResultsObject.ExpressionParserLog.length-1]);return null;}// Make sure from/to are not equal
|
|
3698
|
+
if(this.fable.Math.comparePrecise(tmpFrom,tmpTo)==0){tmpResultsObject.ExpressionParserLog.push(`ExpressionParser.solve detected invalid SERIES directive parameters. FROM and TO cannot be equal.`);this.log.warn(tmpResultsObject.ExpressionParserLog[tmpResultsObject.ExpressionParserLog.length-1]);return null;}// Make sure that Step is the correct positive/negative based on From and To
|
|
3699
|
+
if(this.fable.Math.comparePrecise(tmpStep,'0')==0){tmpResultsObject.ExpressionParserLog.push(`ExpressionParser.solve detected invalid SERIES directive parameters. STEP cannot be zero.`);this.log.warn(tmpResultsObject.ExpressionParserLog[tmpResultsObject.ExpressionParserLog.length-1]);return null;}if(this.fable.Math.comparePrecise(tmpFrom,tmpTo)<0){// From < To so Step must be positive
|
|
3700
|
+
if(this.fable.Math.comparePrecise(tmpStep,'0')<0){tmpResultsObject.ExpressionParserLog.push(`ExpressionParser.solve detected invalid SERIES directive parameters. STEP must be positive when FROM < TO.`);this.log.warn(tmpResultsObject.ExpressionParserLog[tmpResultsObject.ExpressionParserLog.length-1]);return null;}}else{// From >= To so Step must be negative
|
|
3701
|
+
if(this.fable.Math.comparePrecise(tmpStep,'0')>0){tmpResultsObject.ExpressionParserLog.push(`ExpressionParser.solve detected invalid SERIES directive parameters. STEP must be negative when FROM >= TO.`);this.log.warn(tmpResultsObject.ExpressionParserLog[tmpResultsObject.ExpressionParserLog.length-1]);return null;}}// Get the number of iterations we need to perform
|
|
3702
|
+
let tmpIterations=parseInt(this.fable.Math.floorPrecise(this.fable.Math.dividePrecise(this.fable.Math.subtractPrecise(tmpTo,tmpFrom),tmpStep)));let tmpValueArray=[];for(let i=0;i<=tmpIterations;i++){let tmpCurrentValueOfN=this.fable.Math.addPrecise(tmpFrom,this.fable.Math.multiplyPrecise(tmpStep,i.toString()));// Jimmy up the data source with the current N value, stepIndex and all the other data from the source object
|
|
3703
|
+
// This generates a data source object every time on purpose so we can remarshal in values that changed in the destination
|
|
3704
|
+
let tmpSeriesStepDataSourceObject=Object.assign({},tmpDataSourceObject);tmpSeriesStepDataSourceObject.n=tmpCurrentValueOfN;tmpSeriesStepDataSourceObject.stepIndex=i;let tmpMutatedValues=this.substituteValuesInTokenizedObjects(tmpResultsObject.PostfixTokenObjects,tmpSeriesStepDataSourceObject,tmpResultsObject,pManifest);tmpValueArray.push(this.solvePostfixedExpression(tmpResultsObject.PostfixSolveList,tmpDataDestinationObject,tmpResultsObject,pManifest));for(let j=0;j<tmpMutatedValues.length;j++){tmpMutatedValues[j].Resolved=false;}}// Do the assignment
|
|
3705
|
+
let tmpAssignmentManifestHash=tmpResultsObject.PostfixedAssignmentAddress;if(tmpResultsObject.OriginalRawTokens[1]==='='&&typeof tmpResultsObject.OriginalRawTokens[0]==='string'&&tmpResultsObject.OriginalRawTokens[0].length>0){tmpAssignmentManifestHash=tmpResultsObject.OriginalRawTokens[0];}let tmpManifest=typeof pManifest==='object'?pManifest:this.fable.newManyfest();tmpManifest.setValueByHash(tmpDataDestinationObject,tmpAssignmentManifestHash,tmpValueArray);return tmpValueArray;}else// For 'SOLVE' or anything else that didn't work
|
|
3706
|
+
{// This is where the data from variables gets marshaled into their symbols (from AppData or the like)
|
|
3688
3707
|
this.substituteValuesInTokenizedObjects(tmpResultsObject.PostfixTokenObjects,tmpDataSourceObject,tmpResultsObject,pManifest);// Finally this is the expr solving method, which returns a string and also marshals it into tmpDataDestinationObject
|
|
3689
|
-
return this.solvePostfixedExpression(tmpResultsObject.PostfixSolveList,tmpDataDestinationObject,tmpResultsObject,pManifest);}}module.exports=FableServiceExpressionParser;},{"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ExpressionTokenizer.js":
|
|
3708
|
+
return this.solvePostfixedExpression(tmpResultsObject.PostfixSolveList,tmpDataDestinationObject,tmpResultsObject,pManifest);}}}module.exports=FableServiceExpressionParser;},{"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ExpressionTokenizer-DirectiveMutation.js":160,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ExpressionTokenizer.js":161,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-FunctionMap.json":162,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Linter.js":163,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Messaging.js":164,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Postfix.js":165,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-SolvePostfixedExpression.js":166,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-TokenMap.json":167,"./Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ValueMarshal.js":168,"fable-serviceproviderbase":59}],159:[function(require,module,exports){const libFableServiceProviderBase=require('fable-serviceproviderbase');class ExpressionParserOperationBase extends libFableServiceProviderBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='ExpressionParserOperationBase';this.numberTest=/^-{0,1}\d*\.{0,1}\d+$/;this.ExpressionParser=false;}connectExpressionParser(pExpressionParser){this.ExpressionParser=pExpressionParser;}getTokenType(pToken){if(pToken in this.ExpressionParser.tokenMap){return`Token.${this.ExpressionParser.tokenMap[pToken].Type}`;}else if(pToken.length>2&&pToken[0]==='{'&&pToken[pToken.length-1]==='}'){return'Token.StateAddress';}else if(pToken.length>2&&pToken[0]==='"'&&pToken[pToken.length-1]==='"'){return'Token.String';}else if(this.numberTest.test(pToken)){return'Token.Constant';}else{return'Token.Symbol';}// Just for documentation sake:
|
|
3690
3709
|
// There is a fifth token type, VirtualSymbol
|
|
3691
3710
|
// This is a value that's added during solve and looked up by address in the VirtualSymbol object.
|
|
3692
|
-
}getTokenContainerObject(pToken,pTokenType){return{Token:pToken,Type:typeof pTokenType==='undefined'?this.getTokenType(pToken):pTokenType,Descriptor:pToken in this.ExpressionParser.tokenMap?this.ExpressionParser.tokenMap[pToken]:false};}}module.exports=ExpressionParserOperationBase;},{"fable-serviceproviderbase":
|
|
3711
|
+
}getTokenContainerObject(pToken,pTokenType){return{Token:pToken,Type:typeof pTokenType==='undefined'?this.getTokenType(pToken):pTokenType,Descriptor:pToken in this.ExpressionParser.tokenMap?this.ExpressionParser.tokenMap[pToken]:false};}}module.exports=ExpressionParserOperationBase;},{"fable-serviceproviderbase":59}],160:[function(require,module,exports){const libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');class ExpressionTokenizerDirectiveMutation extends libExpressionParserOperationBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='ExpressionParser-TokenizerDirectiveMutation';this.directiveTypes={'SOLVE':{Name:'Solve Expression',Code:'SOLVE'},'SERIES':{Name:'Series',Code:'SERIES',From:null,To:null,Step:null},'MONTECARLO':{Name:'Monte Carlo Simulation',Code:'MONTECARLO',Iterations:null,Values:{}}};this.defaultDirective=this.directiveTypes.SOLVE;}parseSeriesDirective(pTokens){// This isn't a fancy real parse it's just taking words and stealing values after them.
|
|
3712
|
+
let tmpNewSeriesDirectiveDescription=Object.assign({},this.directiveTypes.SERIES);for(let i=0;i<pTokens.length;i++){let tmpToken=pTokens[i].toUpperCase();switch(tmpToken){case'FROM':if(i+1<pTokens.length){tmpNewSeriesDirectiveDescription.From=pTokens[i+1];}break;case'TO':if(i+1<pTokens.length){tmpNewSeriesDirectiveDescription.To=pTokens[i+1];}break;case'STEP':if(i+1<pTokens.length){tmpNewSeriesDirectiveDescription.Step=pTokens[i+1];}break;default:// Ignore other tokens
|
|
3713
|
+
break;}}return tmpNewSeriesDirectiveDescription;}parseDirectives(pResultObject){let tmpResults=typeof pResultObject==='object'?pResultObject:{ExpressionParserLog:[]};tmpResults.SolverDirectives=this.defaultDirective;tmpResults.SolverDirectiveTokens=[];if(tmpResults.RawTokens.length<2){tmpResults.ExpressionParserLog.push(`ExpressionParser.tokenizeDirectiveMutation postprocessor received insufficient tokens to process directives.`);this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return tmpResults.SolverDirectives;}// Enumerate each of the tmpResults.RawTokens to see if one of the values in the directiveTypeMap exists and is either at the beginning or after the assignment (= or ?=) operator
|
|
3714
|
+
for(let i=0;i<tmpResults.RawTokens.length;i++){let tmpToken=tmpResults.RawTokens[i].toUpperCase();if(tmpToken in this.directiveTypes){// Check if it's at the beginning or after an assignment operator
|
|
3715
|
+
// FIXME: This is hard coded assignment operators which is bad juju
|
|
3716
|
+
if(i===0||tmpResults.RawTokens[i-1]==='='||tmpResults.RawTokens[i-1]==='?='){// We have a directive!
|
|
3717
|
+
tmpResults.SolverDirectives.Type=this.directiveTypes[tmpToken];tmpResults.ExpressionParserLog.push(`ExpressionParser.tokenizeDirectiveMutation identified solver directive: ${tmpToken}`);this.log.info(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);// Extract the Directive name and everything else from it up until the : token
|
|
3718
|
+
let tmpDirectiveTokenStartIndex=i;let tmpDirectiveTokenEndIndex=-1;for(let j=tmpDirectiveTokenStartIndex+1;j<tmpResults.RawTokens.length;j++){if(tmpResults.RawTokens[j]===':'){tmpDirectiveTokenEndIndex=j;break;}}// If the directive token end is not in the expression we don't know what to do
|
|
3719
|
+
if(tmpDirectiveTokenEndIndex===-1){tmpResults.ExpressionParserLog.push(`ExpressionParser.tokenizeDirectiveMutation could not find the end of the directive token set for directive: ${tmpToken}`);this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);continue;}// Set the tmpResults.SolverDirectiveTokens to the slice of tokens that represent the directive
|
|
3720
|
+
tmpResults.SolverDirectiveTokens=tmpResults.RawTokens.slice(tmpDirectiveTokenStartIndex,tmpDirectiveTokenEndIndex);// Remove the directive tokens and the assignment to the left of it from the array of raw tokens
|
|
3721
|
+
// the colonoscopy if you will
|
|
3722
|
+
tmpResults.RawTokens.splice(0,tmpDirectiveTokenEndIndex+1);// Further parsing based on directive type could go here
|
|
3723
|
+
// e.g. parseSeriesDirective for SERIES, etc.
|
|
3724
|
+
switch(tmpToken){case'SERIES':tmpResults.SolverDirectives=this.parseSeriesDirective(tmpResults.SolverDirectiveTokens);break;default:// No further parsing needed
|
|
3725
|
+
break;}}}}return tmpResults.SolverDirectives;}}module.exports=ExpressionTokenizerDirectiveMutation;},{"./Fable-Service-ExpressionParser-Base.js":159}],161:[function(require,module,exports){const libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');class ExpressionTokenizer extends libExpressionParserOperationBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='ExpressionParser-Tokenizer';}tokenize(pExpression,pResultObject){let tmpResults=typeof pResultObject==='object'?pResultObject:{ExpressionParserLog:[]};tmpResults.RawExpression=pExpression;tmpResults.SolverDirectives={};tmpResults.RawTokens=[];tmpResults.ExpressionParserLog=[];if(typeof pExpression!=='string'){this.log.warn('ExpressionParser.tokenize was passed a non-string expression.');return tmpResults.RawTokens;}/* Tokenize the expression
|
|
3693
3726
|
*
|
|
3694
3727
|
* Current token types:
|
|
3695
3728
|
* - Value
|
|
@@ -3722,7 +3755,7 @@ for(let j=0;j<tmpTokenRadix.TokenKeys.length;j++){let tmpTokenKey=tmpTokenRadix.
|
|
|
3722
3755
|
/* Per this stack overflow article: https://stackoverflow.com/questions/4434076/best-way-to-alphanumeric-check-in-javascript
|
|
3723
3756
|
* We could use a regex but it is slower than the charCodeAt method.
|
|
3724
3757
|
* This also doesn't solve the problem of unicode characters, but we won't support those for now.
|
|
3725
|
-
|
|
3758
|
+
*/// if (pExpression.charAt(i) == '.')
|
|
3726
3759
|
// {
|
|
3727
3760
|
// console.log('Found a period')
|
|
3728
3761
|
// }
|
|
@@ -3742,7 +3775,8 @@ tmpCurrentTokenType='Value';tmpCurrentToken+=tmpCharacter;// continue;
|
|
|
3742
3775
|
// }
|
|
3743
3776
|
// tmpResults.ExpressionParserLog.push(`ExpressionParser.tokenize found an unknown character code ${tmpCharCode} character ${tmpCharacter} in the expression: ${pExpression} at index ${i}`);
|
|
3744
3777
|
// this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);
|
|
3745
|
-
}if(tmpCurrentTokenType&&tmpCurrentToken.length>0){tmpResults.RawTokens.push(tmpCurrentToken);}
|
|
3778
|
+
}if(tmpCurrentTokenType&&tmpCurrentToken.length>0){tmpResults.RawTokens.push(tmpCurrentToken);}tmpResults.OriginalRawTokens=Array.from(tmpResults.RawTokens);// Potentially mutate the tokens based on directives in the tokenized expression
|
|
3779
|
+
this.TokenizerDirectiveMutation.parseDirectives(tmpResults);return tmpResults.RawTokens;}}module.exports=ExpressionTokenizer;},{"./Fable-Service-ExpressionParser-Base.js":159}],162:[function(require,module,exports){module.exports={"sqrt":{"Name":"Square Root","Address":"fable.Math.sqrtPrecise"},"percent":{"Name":"Compute Percent (in IS over OF format)","Address":"fable.Math.percentagePrecise"},"compare":{"Name":"Compare","Address":"fable.Math.comparePrecise"},"abs":{"Name":"Absolute Value","Address":"fable.Math.absPrecise"},"floor":{"Name":"Floor Value","Address":"fable.Math.floorPrecise"},"ceil":{"Name":"Ceiling Value","Address":"fable.Math.ceilPrecise"},"rad":{"Name":"Degrees to Radians","Address":"fable.Math.radPrecise"},"pi":{"Name":"Pi","Address":"fable.Math.piPrecise"},"euler":{"Name":"Euler","Address":"fable.Math.eulerPrecise"},"log":{"Name":"Logarithm","Address":"fable.Math.logPrecise"},"exp":{"Name":"Eulers Number to the Power Of N","Address":"fable.Math.expPrecise"},"sin":{"Name":"Sine","Address":"fable.Math.sin"},"cos":{"Name":"Cosine","Address":"fable.Math.cos"},"tan":{"Name":"Tangent","Address":"fable.Math.tan"},"count":{"Name":"Count Set Elements","Address":"fable.Math.countSetElements"},"countset":{"Name":"Count Set Elements","Address":"fable.Math.countSetElements"},"sortset":{"Name":"Sort Set","Address":"fable.Math.sortSetPrecise"},"bucketset":{"Name":"Bucket Set","Address":"fable.Math.bucketSetPrecise"},"sorthistogram":{"Name":"Sort Histogram","Address":"fable.Math.sortHistogramPrecise"},"sorthistogrambykeys":{"Name":"Sort Histogram by Keys","Address":"fable.Math.sortHistogramByKeys"},"max":{"Name":"Maximum","Address":"fable.Math.maxPrecise"},"min":{"Name":"Minimum","Address":"fable.Math.minPrecise"},"sum":{"Name":"Sum","Address":"fable.Math.sumPrecise"},"avg":{"Name":"Average","Address":"fable.Math.averagePrecise"},"mean":{"Name":"Mean","Address":"fable.Math.meanPrecise"},"median":{"Name":"Median","Address":"fable.Math.medianPrecise"},"mode":{"Name":"Mode","Address":"fable.Math.modePrecise"},"round":{"Name":"Round","Address":"fable.Math.roundPrecise"},"tofixed":{"Name":"To Fixed","Address":"fable.Math.toFixedPrecise"},"cumulativesummation":{"Name":"Sum each value in a Histogram or Value Map cumulatively, creating or setting a property with the result on each row","Address":"fable.Math.cumulativeSummation"},"subtractingsummation":{"Name":"Subtract each subsequent value in a Histogram or Value Map cumulatively (by default from the first row), creating or setting a property with the result on each row.","Address":"fable.Math.subtractingSummation"},"iterativeseries":{"Name":"Perform an Iterative Series of Mathematical Operations on Set Elements","Address":"fable.Math.iterativeSeries"},"countsetelements":{"Name":"Count Set Elements in a Histogram or Value Map","Address":"fable.Math.countSetElements"},"getvalue":{"Name":"Get Value from Application State or Services (AppData, etc.)","Address":"fable.Utility.getInternalValueByHash"},"objectkeystoarray":{"Name":"Get Array of an Object's keys","Address":"fable.Utility.objectKeysToArray"},"objectvaluestoarray":{"Name":"Get Array of an Object's values","Address":"fable.Utility.objectValuesToArray"},"generatearrayofobjectsfromsets":{"Name":"Generate Array of Objects from Sets","Address":"fable.Utility.generateArrayOfObjectsFromSets"},"objectvaluessortbyexternalobjectarray":{"Name":"Get Array of an Object's values sorted by an external array","Address":"fable.Utility.objectValuesSortByExternalArray"},"setkeystoarray":{"Name":"Get Array of an Object's keys","Address":"fable.Utility.objectKeysToArray"},"setvaluestoarray":{"Name":"Get Array of an Object's values","Address":"fable.Utility.objectValuesToArray"},"histogramkeystoarray":{"Name":"Get Array of an Object's keys","Address":"fable.Utility.objectKeysToArray"},"histogramvaluestoarray":{"Name":"Get Array of an Object's values","Address":"fable.Utility.objectValuesToArray"},"createarrayfromabsolutevalues":{"Name":"Create Array from Absolute Values","Address":"fable.Utility.createArrayFromAbsoluteValues"},"flatten":{"Name":"flatten an array of values","Address":"fable.Utility.flattenArrayOfSolverInputs"},"findfirstvaluebyexactmatch":{"Name":"find + map on array of objects","Address":"fable.Utility.findFirstValueByExactMatchInternal"},"findfirstvaluebystringincludes":{"Name":"find + map on array of objects","Address":"fable.Utility.findFirstValueByStringIncludesInternal"},"resolvehtmlentities":{"Name":"resolve HTML entities","Address":"fable.DataFormat.resolveHtmlEntities"},"concat":{"Name":"concatenate an array of values and output a string","Address":"fable.DataFormat.concatenateStringsInternal"},"concatraw":{"Name":"concatenate an array of values and output a string","Address":"fable.DataFormat.concatenateStringsRawInternal"},"join":{"Name":"join an array of values and output a string","Address":"fable.DataFormat.joinStringsInternal"},"joinraw":{"Name":"join an array of values and output a string","Address":"fable.DataFormat.joinStringsRawInternal"},"if":{"Name":"perform a conditional operator on two values, and choose one of two outcomes based on the result","Address":"fable.Logic.checkIf"},"when":{"Name":"perform a 'truthy' check on one value, and return one of two outcomes based on the result","Address":"fable.Logic.when"},"entryinset":{"Name":"Entry in Set","Address":"fable.Math.entryInSet"},"smallestinset":{"Name":"Smallest in Set","Address":"fable.Math.smallestInSet"},"largestinset":{"Name":"Largest in Set","Address":"fable.Math.largestInSet"},"aggregationhistogram":{"Name":"Generate a Histogram by Exact Value Aggregation","Address":"fable.Math.histogramAggregationByExactValueFromInternalState"},"aggregationhistogrambyobject":{"Name":"Generate a Histogram by Exact Value Aggregation from Object Property","Address":"fable.Math.histogramAggregationByExactValue"},"distributionhistogram":{"Name":"Generate a Histogram Based on Value Distribution","Address":"fable.Math.histogramDistributionByExactValueFromInternalState"},"distributionhistogrambyobject":{"Name":"Generate a Histogram Based on Value Distribution from Object Property","Address":"fable.Math.histogramDistributionByExactValue"},"setconcatenate":{"Name":"Set Concatenate","Address":"fable.Math.setConcatenate"},"getvaluearray":{"Name":"Get Value Array from Application State or Services (AppData, etc.)","Address":"fable.Utility.createValueArrayByHashParametersFromInternal"},"getvalueobject":{"Name":"Get Value Object from Application State or Services (AppData, etc.)","Address":"fable.Utility.createValueObjectByHashParametersFromInternal"},"cleanvaluearray":{"Name":"Clean Value Array","Address":"fable.Math.cleanValueArray"},"cleanvalueobject":{"Name":"Clean Value Object","Address":"fable.Math.cleanValueObject"},"polynomialregression":{"Name":"Perform an nth degree Polynomial Regression on a Set of X and Y Values","Address":"fable.Math.polynomialRegression"},"randominteger":{"Name":"Random Integer","Address":"fable.DataGeneration.randomInteger"},"randomintegerbetween":{"Name":"Random Integer Between Two Numbers","Address":"fable.DataGeneration.randomIntegerBetween"},"randomintegerupto":{"Name":"Random Integer","Address":"fable.DataGeneration.randomIntegerUpTo"},"randomfloat":{"Name":"Random Float","Address":"fable.DataGeneration.randomFloat"},"randomfloatbetween":{"Name":"Random Float","Address":"fable.DataGeneration.randomFloatBetween"},"randomfloatupto":{"Name":"Random Float","Address":"fable.DataGeneration.randomFloatUpTo"},"datemilliseconddifference":{"Name":"Date Difference in Milliseconds","Address":"fable.Dates.dateMillisecondDifference"},"dateseconddifference":{"Name":"Date Difference in Seconds","Address":"fable.Dates.dateSecondDifference"},"dateminutedifference":{"Name":"Date Difference in Minutes","Address":"fable.Dates.dateMinuteDifference"},"datehourdifference":{"Name":"Date Difference in Hours","Address":"fable.Dates.dateHourDifference"},"datedaydifference":{"Name":"Date Difference in Days","Address":"fable.Dates.dateDayDifference"},"dateweekdifference":{"Name":"Date Difference in Weeks","Address":"fable.Dates.dateWeekDifference"},"datemonthdifference":{"Name":"Date Difference in Months","Address":"fable.Dates.dateMonthDifference"},"dateyeardifference":{"Name":"Date Difference in Years","Address":"fable.Dates.dateYearDifference"},"datemathadd":{"Name":"Date Math Add","Address":"fable.Dates.dateMath"},"dateaddmilliseconds":{"Name":"Date Add Milliseconds","Address":"fable.Dates.dateAddMilliseconds"},"dateaddseconds":{"Name":"Date Add Seconds","Address":"fable.Dates.dateAddSeconds"},"dateaddminutes":{"Name":"Date Add Minutes","Address":"fable.Dates.dateAddMinutes"},"dateaddhours":{"Name":"Date Add Hours","Address":"fable.Dates.dateAddHours"},"dateadddays":{"Name":"Date Add Days","Address":"fable.Dates.dateAddDays"},"dateaddweeks":{"Name":"Date Add Weeks","Address":"fable.Dates.dateAddWeeks"},"dateaddmonths":{"Name":"Date Add Months","Address":"fable.Dates.dateAddMonths"},"dateaddyears":{"Name":"Date Add Years","Address":"fable.Dates.dateAddYears"},"datefromparts":{"Name":"Date From Parts","Address":"fable.Dates.dateFromParts"},"createvalueobjectbyhashes":{"Name":"Create Value Object by Hashes","Address":"fable.Utility.createValueObjectByHashes"},"polynomialregression":{"Name":"Perform an nth degree Polynomial Regression on a Set of X and Y Values","Address":"fable.Math.polynomialRegression"},"leastsquares":{"Name":"Perform a Least Squares Regression on a Set of Independent Variable Vectors and a Dependent Variable Vector","Address":"fable.Math.leastSquares"},"linest":{"Name":"Perform a Least Squares Regression on a Set of Independent Variable Vectors and a Dependent Variable Vector","Address":"fable.Math.leastSquares"},"matrixtranspose":{"Name":"Transpose a Matrix","Address":"fable.Math.matrixTranspose"},"matrixmultiply":{"Name":"Multiply Two Matrices","Address":"fable.Math.matrixMultiply"},"matrixvectormultiply":{"Name":"Multiply a Matrix by a Vector","Address":"fable.Math.matrixVectorMultiply"},"matrixinverse":{"Name":"Inverse a Matrix","Address":"fable.Math.matrixInverse"},"gaussianelimination":{"Name":"Solve a System of Linear Equations using Gaussian Elimination","Address":"fable.Math.gaussianElimination"}};},{}],163:[function(require,module,exports){const libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');class ExpressionParserLinter extends libExpressionParserOperationBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='ExpressionParser-Linter';}lintTokenizedExpression(pTokenizedExpression,pResultObject){let tmpResults=typeof pResultObject==='object'?pResultObject:{ExpressionParserLog:[]};tmpResults.LinterResults=[];// Guard against bad data being passed in
|
|
3746
3780
|
if(!Array.isArray(pTokenizedExpression)){tmpResults.ExpressionParserLog.push(`ERROR: ExpressionParser.lintTokenizedExpression was passed a non-array tokenized expression.`);tmpResults.LinterResults.push(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return pTokenizedExpression;}if(pTokenizedExpression.length<1){tmpResults.ExpressionParserLog.push(`ERROR: ExpressionParser.lintTokenizedExpression was passed an empty tokenized expression.`);tmpResults.LinterResults.push(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return pTokenizedExpression;}// 1. Check for balanced parenthesis
|
|
3747
3781
|
let tmpParenthesisDepth=0;// If it is in a state address, we don't care about the parenthesis
|
|
3748
3782
|
// State addresses are between squiggly brackets
|
|
@@ -3761,7 +3795,7 @@ this.getTokenType(pTokenizedExpression[0])==='Token.StateAddress'||this.getToken
|
|
|
3761
3795
|
){tmpResults.ExpressionParserLog.push(`WARNING: ExpressionParser.lintTokenizedExpression found a single equality assignment in the tokenized expression with no assignable address on the left side of the assignment.`);tmpResults.LinterResults.push(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);}}}// 5. Check that there are no operators adjacent to each other
|
|
3762
3796
|
// This is a simple lint check, not a full-blown syntax check
|
|
3763
3797
|
let tmpTokenPrevious=false;for(let i=0;i<pTokenizedExpression.length-1;i++){if(pTokenizedExpression[i]in this.ExpressionParser.tokenMap&&this.ExpressionParser.tokenMap[pTokenizedExpression[i]].Type!='Parenthesis'&&!tmpTokenPrevious){tmpTokenPrevious=true;}else if(pTokenizedExpression[i]in this.ExpressionParser.tokenMap&&this.ExpressionParser.tokenMap[pTokenizedExpression[i]].Type!='Parenthesis'){// If this isn't a + or - positivity/negativity multiplier, it's an error.
|
|
3764
|
-
if(pTokenizedExpression[i]!=='+'&&pTokenizedExpression[i]!=='-'){tmpResults.ExpressionParserLog.push(`ERROR: ExpressionParser.lintTokenizedExpression found an ${pTokenizedExpression[i]} operator adjacent to another operator in the tokenized expression at token index ${i}`);tmpResults.LinterResults.push(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);}}else{tmpTokenPrevious=false;}}return tmpResults.LinterResults;}}module.exports=ExpressionParserLinter;},{"./Fable-Service-ExpressionParser-Base.js":
|
|
3798
|
+
if(pTokenizedExpression[i]!=='+'&&pTokenizedExpression[i]!=='-'){tmpResults.ExpressionParserLog.push(`ERROR: ExpressionParser.lintTokenizedExpression found an ${pTokenizedExpression[i]} operator adjacent to another operator in the tokenized expression at token index ${i}`);tmpResults.LinterResults.push(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);}}else{tmpTokenPrevious=false;}}return tmpResults.LinterResults;}}module.exports=ExpressionParserLinter;},{"./Fable-Service-ExpressionParser-Base.js":159}],164:[function(require,module,exports){const{PE}=require('big.js');const libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');/**
|
|
3765
3799
|
* Represents a user-friendly messaging service for the ExpressionParser compiler output.
|
|
3766
3800
|
* @class ExpressionParserMessaging
|
|
3767
3801
|
* @extends libExpressionParserOperationBase
|
|
@@ -3769,7 +3803,7 @@ if(pTokenizedExpression[i]!=='+'&&pTokenizedExpression[i]!=='-'){tmpResults.Expr
|
|
|
3769
3803
|
return`${tmpOperationVirtualSymbol} = ${tmpOperationLeftValue}`;}if(tmpVirtualSymbolPrefix==='VFE'){// Virtual Function Expression
|
|
3770
3804
|
return`${tmpOperationVirtualSymbol} = ${tmpOperationSymbol}(${tmpOperationLeftValue})`;}return`${tmpOperationVirtualSymbol} = ${tmpOperationLeftValue} ${tmpOperationSymbol} ${tmpOperationRightValue}`;}getOperationValueMessage(pOperation,pResultObject){if(!pOperation){return'INVALID_OPERATION';}let tmpOperationVirtualSymbol=this.getOperationVirtualSymbolName(pOperation);let tmpOperationLeftValue=this.getVirtualTokenValue(pOperation.LeftValue,pResultObject);let tmpOperationSymbol=this.getTokenSymbolString(pOperation.Operation);let tmpOperationRightValue=this.getVirtualTokenValue(pOperation.RightValue,pResultObject);let tmpVirtualSymbolPrefix=tmpOperationVirtualSymbol.substring(0,3);if(tmpOperationSymbol==='='){// Assignment operators are special
|
|
3771
3805
|
return`${tmpOperationVirtualSymbol} = ${tmpOperationLeftValue}`;}if(tmpVirtualSymbolPrefix==='VFE'){// Virtual Function Expression
|
|
3772
|
-
return`${tmpOperationVirtualSymbol} = ${tmpOperationSymbol}(${tmpOperationLeftValue})`;}return`${tmpOperationVirtualSymbol} = ${tmpOperationLeftValue} ${tmpOperationSymbol} ${tmpOperationRightValue}`;}getOperationOutcomeMessage(pToken,pOperationResults){if(!pToken){return'INVALID_TOKEN';}let tmpOperationVirtualSymbol=this.getOperationVirtualSymbolName(pToken);let tmpOperationOutcomeValue=this.getVirtualTokenValue(pToken,pOperationResults);return`${tmpOperationVirtualSymbol} = ${tmpOperationOutcomeValue}`;}logFunctionOutcome(pResultObject){if(typeof pResultObject!=='object'){this.log.error(`Solver results object was not an object. Cannot log outcome.`);return;}let tmpAssignmentAddress='PostfixedAssignmentAddress'in pResultObject?pResultObject.PostfixedAssignmentAddress:'NO_ASSIGNMENT_ADDRESS_FOUND';let tmpRawExpression='RawExpression'in pResultObject?pResultObject.RawExpression:'NO_EXPRESSION_FOUND';let tmpRawResult='RawResult'in pResultObject?pResultObject.RawResult:'NO_RESULT_FOUND';this.log.info(`Solved f(${tmpAssignmentAddress}) = {${tmpRawExpression}}`);for(let i=0;i<pResultObject.PostfixSolveList.length;i++){let tmpToken=pResultObject.PostfixSolveList[i];let tmpTokenSymbolMessage=this.getOperationSymbolMessage(tmpToken);this.log.info(`${i} Symbols: ${tmpTokenSymbolMessage}`);let tmpTokenValueMessage=this.getOperationValueMessage(tmpToken,pResultObject);this.log.info(`${i} Values: ${tmpTokenValueMessage}`);let tmpTokenOutcome=this.getOperationOutcomeMessage(tmpToken,pResultObject);this.log.info(`${i} Outcome: ${tmpTokenOutcome}`);}this.log.info(`{${tmpRawExpression}} = ${tmpRawResult}`);}logFunctionSolve(pResultObject){if(typeof pResultObject!=='object'){this.log.error(`Solver results object was not an object. Cannot log the solve.`);return;}if(!('PostfixSolveList'in pResultObject)||!Array.isArray(pResultObject.PostfixSolveList)){this.log.error(`Solver results object did not contain a PostfixSolveList array. Cannot log the solve.`);return;}for(let i=0;i<pResultObject.PostfixSolveList.length;i++){let tmpToken=pResultObject.PostfixSolveList[i];console.log(`${i}: ${tmpToken.VirtualSymbolName} = (${tmpToken.LeftValue.Token}::${tmpToken.LeftValue.Value}) ${tmpToken.Operation.Token} (${tmpToken.RightValue.Token}::${tmpToken.RightValue.Value}) `);}this.logFunctionOutcome(pResultObject);}}module.exports=ExpressionParserMessaging;},{"./Fable-Service-ExpressionParser-Base.js":
|
|
3806
|
+
return`${tmpOperationVirtualSymbol} = ${tmpOperationSymbol}(${tmpOperationLeftValue})`;}return`${tmpOperationVirtualSymbol} = ${tmpOperationLeftValue} ${tmpOperationSymbol} ${tmpOperationRightValue}`;}getOperationOutcomeMessage(pToken,pOperationResults){if(!pToken){return'INVALID_TOKEN';}let tmpOperationVirtualSymbol=this.getOperationVirtualSymbolName(pToken);let tmpOperationOutcomeValue=this.getVirtualTokenValue(pToken,pOperationResults);return`${tmpOperationVirtualSymbol} = ${tmpOperationOutcomeValue}`;}logFunctionOutcome(pResultObject){if(typeof pResultObject!=='object'){this.log.error(`Solver results object was not an object. Cannot log outcome.`);return;}let tmpAssignmentAddress='PostfixedAssignmentAddress'in pResultObject?pResultObject.PostfixedAssignmentAddress:'NO_ASSIGNMENT_ADDRESS_FOUND';let tmpRawExpression='RawExpression'in pResultObject?pResultObject.RawExpression:'NO_EXPRESSION_FOUND';let tmpRawResult='RawResult'in pResultObject?pResultObject.RawResult:'NO_RESULT_FOUND';this.log.info(`Solved f(${tmpAssignmentAddress}) = {${tmpRawExpression}}`);for(let i=0;i<pResultObject.PostfixSolveList.length;i++){let tmpToken=pResultObject.PostfixSolveList[i];let tmpTokenSymbolMessage=this.getOperationSymbolMessage(tmpToken);this.log.info(`${i} Symbols: ${tmpTokenSymbolMessage}`);let tmpTokenValueMessage=this.getOperationValueMessage(tmpToken,pResultObject);this.log.info(`${i} Values: ${tmpTokenValueMessage}`);let tmpTokenOutcome=this.getOperationOutcomeMessage(tmpToken,pResultObject);this.log.info(`${i} Outcome: ${tmpTokenOutcome}`);}this.log.info(`{${tmpRawExpression}} = ${tmpRawResult}`);}logFunctionSolve(pResultObject){if(typeof pResultObject!=='object'){this.log.error(`Solver results object was not an object. Cannot log the solve.`);return;}if(!('PostfixSolveList'in pResultObject)||!Array.isArray(pResultObject.PostfixSolveList)){this.log.error(`Solver results object did not contain a PostfixSolveList array. Cannot log the solve.`);return;}for(let i=0;i<pResultObject.PostfixSolveList.length;i++){let tmpToken=pResultObject.PostfixSolveList[i];console.log(`${i}: ${tmpToken.VirtualSymbolName} = (${tmpToken.LeftValue.Token}::${tmpToken.LeftValue.Value}) ${tmpToken.Operation.Token} (${tmpToken.RightValue.Token}::${tmpToken.RightValue.Value}) `);}this.logFunctionOutcome(pResultObject);}}module.exports=ExpressionParserMessaging;},{"./Fable-Service-ExpressionParser-Base.js":159,"big.js":17}],165:[function(require,module,exports){const libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');class ExpressionParserPostfix extends libExpressionParserOperationBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='ExpressionParser-Postfix';}getPosfixSolveListOperation(pOperation,pLeftValue,pRightValue,pDepthSolveList,pDepthSolveIndex){let tmpOperation={VirtualSymbolName:pOperation.VirtualSymbolName,Operation:pOperation,LeftValue:pLeftValue,RightValue:pRightValue};let tmpDepthSolveList=Array.isArray(pDepthSolveList)?pDepthSolveList:false;/* These two if blocks are very complex -- they basically provide a
|
|
3773
3807
|
* way to deal with recursion that can be expressed to the user in
|
|
3774
3808
|
* a meaningful way.
|
|
3775
3809
|
*
|
|
@@ -3862,7 +3896,7 @@ tmpDecreasingPrecedenceStack[j].LeftVirtualSymbolName=tmpToken.VirtualSymbolName
|
|
|
3862
3896
|
for(let tmpSolveLayerIndex=0;tmpSolveLayerIndex<tmpSolveLayerKeys.length;tmpSolveLayerIndex++){let tmpSolveLayerTokens=tmpSolveLayerMap[tmpSolveLayerKeys[tmpSolveLayerIndex]];// If this is a layer with one value, presume it's an assignment.
|
|
3863
3897
|
if(tmpSolveLayerTokens.length===1){// TODO: I think this is correct but with the addition of multiple assignment operators it's less clear.
|
|
3864
3898
|
let tmpAbstractAssignToken=this.getTokenContainerObject('=');tmpAbstractAssignToken.VirtualSymbolName=tmpResults.PostfixLayerstackMap[tmpSolveLayerTokens[0].SolveLayerStack];// If this doesn't have a matching solvelayerstack, get the virtual symbol name from the parenthesis group it's in
|
|
3865
|
-
if(!tmpAbstractAssignToken.VirtualSymbolName){for(let i=0;i<tmpResults.PostfixTokenObjects.length;i++){if(tmpResults.PostfixTokenObjects[i].ParenthesisStack===tmpSolveLayerTokens[0].SolveLayerStack){tmpAbstractAssignToken.VirtualSymbolName=tmpResults.PostfixTokenObjects[i].VirtualSymbolName;break;}}}tmpResults.PostfixSolveList.push(this.getPosfixSolveListOperation(tmpAbstractAssignToken,tmpSolveLayerTokens[0],this.getTokenContainerObject('0.0')));continue;}// For each precedence level in the layer
|
|
3899
|
+
if(!tmpAbstractAssignToken.VirtualSymbolName){for(let i=0;i<tmpResults.PostfixTokenObjects.length;i++){if(tmpResults.PostfixTokenObjects[i].ParenthesisStack===tmpSolveLayerTokens[0].SolveLayerStack){tmpAbstractAssignToken.VirtualSymbolName=tmpResults.PostfixTokenObjects[i].VirtualSymbolName;break;}}}if(!tmpAbstractAssignToken.VirtualSymbolName){tmpAbstractAssignToken.VirtualSymbolName=`V_SingleValue_${tmpVirtualSymbolIndex}`;tmpVirtualSymbolIndex++;}tmpResults.PostfixSolveList.push(this.getPosfixSolveListOperation(tmpAbstractAssignToken,tmpSolveLayerTokens[0],this.getTokenContainerObject('0.0')));continue;}// For each precedence level in the layer
|
|
3866
3900
|
for(let tmpPrecedence=0;tmpPrecedence<=this.ExpressionParser.tokenMaxPrecedence;tmpPrecedence++){// Enumerate all tokens in a layer's expression.
|
|
3867
3901
|
// There is a recursive way to do this, but given the short length of even the most complex equations we're favoring readability.
|
|
3868
3902
|
for(let i=0;i<tmpSolveLayerTokens.length;i++){// If the token is an operator and at the current precedence, add it to the postfix solve list and mutate the array.
|
|
@@ -3877,8 +3911,8 @@ else if(i>0&&tmpToken.Token=='+'&&(tmpSolveLayerTokens[i-1].Type==='Token.Operat
|
|
|
3877
3911
|
else{tmpResults.PostfixSolveList.push(this.getPosfixSolveListOperation(tmpToken,tmpSolveLayerTokens[i-1],tmpSolveLayerTokens[i+1],tmpSolveLayerTokens,i));}}else if(tmpSolveLayerTokens[i].Type==='Token.Function'&&tmpPrecedence===0){let tmpToken=tmpSolveLayerTokens[i];tmpResults.PostfixSolveList.push(this.getPosfixSolveListOperation(tmpToken,tmpSolveLayerTokens[i+1],this.getTokenContainerObject('0.0')));}}}}// 7. Lastly set the assignment address.
|
|
3878
3912
|
let tmpAbstractAssignToken='PostfixedAssignmentOperator'in tmpResults?this.getTokenContainerObject(tmpResults.PostfixedAssignmentOperator.Token):this.getTokenContainerObject('=');// The address we are assigning to
|
|
3879
3913
|
tmpAbstractAssignToken.VirtualSymbolName=tmpResults.PostfixedAssignmentAddress;// The address it's coming from
|
|
3880
|
-
let tmpSolveResultToken=this.getTokenContainerObject('Result','Token.LastResult');let tmpFinalAssignmentInstruction=this.getPosfixSolveListOperation(tmpAbstractAssignToken,tmpSolveResultToken,this.getTokenContainerObject('SolverMarshal','Token.SolverMarshal'));tmpResults.PostfixSolveList.push(tmpFinalAssignmentInstruction);return tmpResults.PostfixSolveList;}}module.exports=ExpressionParserPostfix;},{"./Fable-Service-ExpressionParser-Base.js":
|
|
3881
|
-
let tmpPassedInFable=
|
|
3914
|
+
let tmpSolveResultToken=this.getTokenContainerObject('Result','Token.LastResult');let tmpFinalAssignmentInstruction=this.getPosfixSolveListOperation(tmpAbstractAssignToken,tmpSolveResultToken,this.getTokenContainerObject('SolverMarshal','Token.SolverMarshal'));tmpResults.PostfixSolveList.push(tmpFinalAssignmentInstruction);return tmpResults.PostfixSolveList;}}module.exports=ExpressionParserPostfix;},{"./Fable-Service-ExpressionParser-Base.js":159}],166:[function(require,module,exports){const libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');const libSetConcatArray=require('../Fable-SetConcatArray.js');class ExpressionParserSolver extends libExpressionParserOperationBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='ExpressionParser-Solver';}solvePostfixedExpression(pPostfixedExpression,pDataDestinationObject,pResultObject,pManifest){let tmpResults=typeof pResultObject==='object'?pResultObject:{ExpressionParserLog:[]};let tmpManifest=typeof pManifest==='object'?pManifest:this.fable.newManyfest();let tmpDataDestinationObject=typeof pDataDestinationObject==='object'?pDataDestinationObject:{};// If there was a fable passed in (e.g. the results object was a service or such), we won't decorate
|
|
3915
|
+
let tmpPassedInFable='fable'in tmpResults;if(!tmpPassedInFable){tmpResults.fable=this.fable;}if(!Array.isArray(pPostfixedExpression)){tmpResults.ExpressionParserLog.push(`ERROR: ExpressionParser.solvePostfixedExpression was passed a non-array postfixed expression.`);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return false;}if(pPostfixedExpression.length<1){tmpResults.ExpressionParserLog.push(`ERROR: ExpressionParser.solvePostfixedExpression was passed an empty postfixed expression.`);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return false;}// This is how the user communication magic happens.
|
|
3882
3916
|
tmpResults.VirtualSymbols={};for(let i=0;i<pPostfixedExpression.length;i++){// X = SUM(15, SUM(SIN(25), 10), (5 + 2), 3)
|
|
3883
3917
|
if(pPostfixedExpression[i].Operation.Type==='Token.SolverInstruction'){continue;}let tmpStepResultObject={ExpressionStep:pPostfixedExpression[i],ExpressionStepIndex:i,ResultsObject:tmpResults,Manifest:tmpManifest};if(tmpStepResultObject.ExpressionStep.LeftValue.Type==='Token.LastResult'){tmpStepResultObject.ExpressionStep.LeftValue.Value=tmpResults.LastResult;}if(tmpStepResultObject.ExpressionStep.RightValue.Type==='Token.LastResult'){tmpStepResultObject.ExpressionStep.RightValue.Value=tmpResults.LastResult;}if(tmpStepResultObject.ExpressionStep.LeftValue.Type==='Token.VirtualSymbol'){tmpStepResultObject.ExpressionStep.LeftValue.Value=tmpManifest.getValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.LeftValue.Token);}if(tmpStepResultObject.ExpressionStep.RightValue.Type==='Token.VirtualSymbol'){tmpStepResultObject.ExpressionStep.RightValue.Value=tmpManifest.getValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.RightValue.Token);}// Resolve the parenthesis to their actual values
|
|
3884
3918
|
if(tmpStepResultObject.ExpressionStep.LeftValue.Type==='Token.Parenthesis'){tmpStepResultObject.ExpressionStep.LeftValue.Value=tmpManifest.getValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.LeftValue.VirtualSymbolName);}if(tmpStepResultObject.ExpressionStep.RightValue.Type==='Token.Parenthesis'){tmpStepResultObject.ExpressionStep.RightValue.Value=tmpManifest.getValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.RightValue.VirtualSymbolName);}// Virtual Constants
|
|
@@ -3886,18 +3920,18 @@ if(tmpStepResultObject.ExpressionStep.LeftValue.Type==='Token.Constant'&&!('Valu
|
|
|
3886
3920
|
// An operator always has a left and right value.
|
|
3887
3921
|
let tmpFunctionAddress;// Note: There are easier, passive ways of managing this state. But this is complex.
|
|
3888
3922
|
let tmpIsFunction=false;if(tmpStepResultObject.ExpressionStep.Operation.Token in this.ExpressionParser.tokenMap){tmpFunctionAddress=`ResultsObject.${tmpStepResultObject.ExpressionStep.Operation.Descriptor.Function}`;}else if(tmpStepResultObject.ExpressionStep.Operation.Token.toLowerCase()in this.ExpressionParser.functionMap){tmpIsFunction=true;tmpFunctionAddress=`ResultsObject.${this.ExpressionParser.functionMap[tmpStepResultObject.ExpressionStep.Operation.Token.toLowerCase()].Address}`;}if(tmpIsFunction){try{let tmpResult;const tmpFunction=tmpManifest.getValueAtAddress(tmpStepResultObject,tmpFunctionAddress);if(typeof tmpFunction==='function'){let tmpFunctionBinding=null;if(tmpFunctionAddress.includes('.')){tmpFunctionBinding=tmpManifest.getValueAtAddress(tmpStepResultObject,tmpFunctionAddress.split('.').slice(0,-1).join('.'));}let tmpArguments=tmpStepResultObject.ExpressionStep.LeftValue.Value;if(!(tmpArguments instanceof libSetConcatArray)){tmpArguments=[tmpArguments];}else{tmpArguments=tmpArguments.values;}tmpResult=tmpFunction.apply(tmpFunctionBinding,tmpArguments);}tmpManifest.setValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.VirtualSymbolName,tmpResult);tmpResults.LastResult=tmpManifest.getValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.VirtualSymbolName);//this.log.trace(` ---> Step ${i}: ${tmpResults.VirtualSymbols[tmpStepResultObject.ExpressionStep.VirtualSymbolName]}`)
|
|
3889
|
-
}catch(pError){tmpResults.ExpressionParserLog.push(`ERROR: ExpressionParser.solvePostfixedExpression failed to solve step ${i} with function ${tmpStepResultObject.ExpressionStep.Operation.Token}: ${pError}`);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return false;}}else{try{//this.log.trace(`Solving Step ${i} [${tmpStepResultObject.ExpressionStep.VirtualSymbolName}] --> [${tmpStepResultObject.ExpressionStep.Operation.Token}]: ( ${tmpStepResultObject.ExpressionStep.LeftValue.Value} , ${tmpStepResultObject.ExpressionStep.RightValue.Value} )`);
|
|
3923
|
+
}catch(pError){tmpResults.ExpressionParserLog.push(`ERROR: ExpressionParser.solvePostfixedExpression failed to solve step ${i} with function ${tmpStepResultObject.ExpressionStep.Operation.Token}: ${pError}`);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1],{Stack:pError.stack});return false;}}else{try{//this.log.trace(`Solving Step ${i} [${tmpStepResultObject.ExpressionStep.VirtualSymbolName}] --> [${tmpStepResultObject.ExpressionStep.Operation.Token}]: ( ${tmpStepResultObject.ExpressionStep.LeftValue.Value} , ${tmpStepResultObject.ExpressionStep.RightValue.Value} )`);
|
|
3890
3924
|
tmpManifest.setValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.VirtualSymbolName,tmpManifest.getValueAtAddress(tmpStepResultObject,`${tmpFunctionAddress}(ExpressionStep.LeftValue.Value,ExpressionStep.RightValue.Value)`));tmpResults.LastResult=tmpManifest.getValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.VirtualSymbolName);//this.log.trace(` ---> Step ${i}: ${tmpResults.VirtualSymbols[tmpStepResultObject.ExpressionStep.VirtualSymbolName]}`)
|
|
3891
|
-
}catch(pError){tmpResults.ExpressionParserLog.push(`ERROR: ExpressionParser.solvePostfixedExpression failed to solve step ${i} with function ${tmpStepResultObject.ExpressionStep.Operation.Token}: ${pError}`);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return false;}}// Equations don't always solve in virtual symbol order.
|
|
3925
|
+
}catch(pError){tmpResults.ExpressionParserLog.push(`ERROR: ExpressionParser.solvePostfixedExpression failed to solve step ${i} with function ${tmpStepResultObject.ExpressionStep.Operation.Token}: ${pError}`);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1],{Stack:pError.stack});return false;}}// Equations don't always solve in virtual symbol order.
|
|
3892
3926
|
tmpResults.SolverFinalVirtualSymbol=tmpStepResultObject.ExpressionStep.VirtualSymbolName;}}let tmpSolverResultValue=tmpManifest.getValueAtAddress(tmpResults,`VirtualSymbols.${tmpResults.SolverFinalVirtualSymbol}`);// Now deal with final assignment(s)
|
|
3893
3927
|
for(let i=0;i<pPostfixedExpression.length;i++){if(pPostfixedExpression[i].RightValue.Type==='Token.SolverMarshal'){// Set the result in the virtual symbols
|
|
3894
3928
|
tmpManifest.setValueAtAddress(tmpResults.VirtualSymbols,pPostfixedExpression[i].VirtualSymbolName,tmpSolverResultValue);// Set the value in the destination object
|
|
3895
3929
|
if(pPostfixedExpression[i].Operation.Descriptor.OnlyEmpty){// If it is only on "empty" values, check if the value is empty before assigning
|
|
3896
3930
|
if(this.fable.Utility.addressIsNullOrEmpty(tmpDataDestinationObject,pPostfixedExpression[i].VirtualSymbolName)){tmpManifest.setValueByHash(tmpDataDestinationObject,pPostfixedExpression[i].VirtualSymbolName,tmpSolverResultValue);}}else{// Otherwise, just assign it.
|
|
3897
3931
|
tmpManifest.setValueByHash(tmpDataDestinationObject,pPostfixedExpression[i].VirtualSymbolName,tmpSolverResultValue);}}}tmpResults.RawResult=tmpSolverResultValue;// Clean up the fable reference if we added it to the object.
|
|
3898
|
-
if(!tmpPassedInFable){delete tmpResults.fable;}if(typeof tmpSolverResultValue==='object'){return tmpSolverResultValue;}else if(typeof tmpSolverResultValue!=='undefined'){return tmpSolverResultValue.toString();}else{return tmpSolverResultValue;}}}module.exports=ExpressionParserSolver;},{"../Fable-SetConcatArray.js":
|
|
3932
|
+
if(!tmpPassedInFable){delete tmpResults.fable;}if(typeof tmpSolverResultValue==='object'){return tmpSolverResultValue;}else if(typeof tmpSolverResultValue!=='undefined'){return tmpSolverResultValue.toString();}else{return tmpSolverResultValue;}}}module.exports=ExpressionParserSolver;},{"../Fable-SetConcatArray.js":183,"./Fable-Service-ExpressionParser-Base.js":159}],167:[function(require,module,exports){module.exports={"=":{"Name":"Assign Value","Token":"=","Function":"fable.Math.assignValue","Precedence":0,"Type":"Assignment"},":":{"Name":"Expression Begin","Token":":","Function":"fable.Math.expressionBegin","Precedence":0,"Type":"Assignment"},"?=":{"Name":"Null or Empty Coalescing Assign Value","Token":"?=","Function":"fable.Math.assignValue","OnlyEmpty":true,"Precedence":0,"Type":"Assignment"},"(":{"Name":"Left Parenthesis","Token":"(","Precedence":0,"Type":"Parenthesis"},")":{"Name":"Right Parenthesis","Token":")","Precedence":0,"Type":"Parenthesis"},",":{"Name":"Set Concatenate","Token":",","Function":"fable.Math.setConcatenate","Precedence":4,"Type":"Operator"},"*":{"Name":"Multiply","Token":"*","Function":"fable.Math.multiplyPrecise","Precedence":3,"Type":"Operator"},"/":{"Name":"Divide","Token":"/","Function":"fable.Math.dividePrecise","Precedence":3,"Type":"Operator"},"^":{"Name":"Exponent","Token":"^","Function":"fable.Math.powerPrecise","Precedence":2,"Type":"Operator"},"%":{"Name":"Modulus","Token":"%","Function":"fable.Math.modPrecise","Precedence":3,"Type":"Operator"},"+":{"Name":"Add","Token":"+","Function":"fable.Math.addPrecise","Precedence":4,"Type":"Operator"},"-":{"Name":"Subtract","Token":"-","Function":"fable.Math.subtractPrecise","Precedence":4,"Type":"Operator"}};},{}],168:[function(require,module,exports){const libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');class ExpressionParserValueMarshal extends libExpressionParserOperationBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='ExpressionParser-ValueMarshal';}/**
|
|
3899
3933
|
* Substitutes values in tokenized objects based on the provided data source and manifest.
|
|
3900
|
-
*
|
|
3934
|
+
*
|
|
3901
3935
|
* TODO: Move this to its own file in the "Fable-Service-ExpressionParser" directory.
|
|
3902
3936
|
*
|
|
3903
3937
|
* @param {Array} pTokenizedObjects - The array of tokenized objects.
|
|
@@ -3916,7 +3950,7 @@ if(Array.isArray(tmpValue)||typeof tmpValue==='object'){tmpToken.Resolved=true;t
|
|
|
3916
3950
|
let tmpValue=tmpManifest.getValueAtAddress(tmpDataSource,tmpToken.Token);if(!tmpValue){tmpResults.ExpressionParserLog.push(`WARNING: ExpressionParser.substituteValuesInTokenizedObjects found no value for the state address ${tmpToken.Token} at index ${i}`);this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);continue;}else{//tmpResults.ExpressionParserLog.push(`INFO: ExpressionParser.substituteValuesInTokenizedObjects found a value [${tmpValue}] for the state address ${tmpToken.Token} at index ${i}`);
|
|
3917
3951
|
this.log.info(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);try{let tmpValueParsed=new this.fable.Utility.bigNumber(tmpValue);tmpToken.Resolved=true;tmpToken.Value=tmpValueParsed.toString();}catch(pError){tmpResults.ExpressionParserLog.push(`ERROR: ExpressionParser.substituteValuesInTokenizedObjects found a non-numeric value for the state address ${tmpToken.Token} at index ${i}`);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);tmpToken.Resolved=false;}}}if(pTokenizedObjects[i].Type==='Token.String'&&!tmpToken.Resolved){tmpResults.ExpressionParserLog.push(`INFO: ExpressionParser.substituteValuesInTokenizedObjects found a value [${tmpToken.Token}] for the string ${tmpToken.Token} at index ${i}`);if(this.LogNoisiness>1)this.log.info(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);tmpToken.Resolved=true;// Take the quotes off the string
|
|
3918
3952
|
tmpToken.Value=tmpToken.Token.substring(1,tmpToken.Token.length-1);}if(pTokenizedObjects[i].Type==='Token.Constant'&&!tmpToken.Resolved){tmpResults.ExpressionParserLog.push(`INFO: ExpressionParser.substituteValuesInTokenizedObjects found a value [${tmpToken.Token}] for the constant ${tmpToken.Token} at index ${i}`);if(this.LogNoisiness>1)this.log.info(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);try{let tmpValueParsed=new this.fable.Utility.bigNumber(tmpToken.Token);tmpToken.Resolved=true;tmpToken.Value=tmpValueParsed.toString();}catch(pError){// This constant has the right symbols but apparently isn't a parsable number.
|
|
3919
|
-
tmpResults.ExpressionParserLog.push(`ERROR: ExpressionParser.substituteValuesInTokenizedObjects found a non-numeric value for the state address ${tmpToken.Token} at index ${i}`);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);tmpToken.Resolved=false;}}}return pTokenizedObjects;}}module.exports=ExpressionParserValueMarshal;},{"./Fable-Service-ExpressionParser-Base.js":
|
|
3953
|
+
tmpResults.ExpressionParserLog.push(`ERROR: ExpressionParser.substituteValuesInTokenizedObjects found a non-numeric value for the state address ${tmpToken.Token} at index ${i}`);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);tmpToken.Resolved=false;}}}return pTokenizedObjects;}}module.exports=ExpressionParserValueMarshal;},{"./Fable-Service-ExpressionParser-Base.js":159}],169:[function(require,module,exports){(function(process){(function(){const libFableServiceBase=require('fable-serviceproviderbase');const libFS=require('fs');const libPath=require('path');const libReadline=require('readline');class FableServiceFilePersistence extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='FilePersistence';if(!('Mode'in this.options)){this.options.Mode=parseInt('0777',8)&~process.umask();}this.libFS=libFS;this.libPath=libPath;this.libReadline=libReadline;}joinPath(){// TODO: Fix anything that's using this before changing this to the new true node join
|
|
3920
3954
|
// return libPath.join(...pPathArray);
|
|
3921
3955
|
return libPath.resolve(...arguments);}resolvePath(){return libPath.resolve(...arguments);}existsSync(pPath){return libFS.existsSync(pPath);}exists(pPath,fCallback){let tmpFileExists=this.existsSync(pPath);return fCallback(null,tmpFileExists);}deleteFileSync(pFileName){return libFS.unlinkSync(pFileName);}deleteFolderSync(pFileName){return libFS.rmdirSync(pFileName);}readFileSync(pFilePath,pOptions){let tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.readFileSync(pFilePath,tmpOptions);}readFile(pFilePath,pOptions,fCallback){let tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.readFile(pFilePath,tmpOptions,fCallback);}readFileCSV(pFilePath,pOptions,fRecordFunction,fCompleteFunction,fErrorFunction){let tmpCSVParser=this.fable.instantiateServiceProviderWithoutRegistration('CSVParser',pOptions);let tmpRecordFunction=typeof fRecordFunction==='function'?fRecordFunction:pRecord=>{this.fable.log.trace(`CSV Reader received line ${pRecord}`);};let tmpCompleteFunction=typeof fCompleteFunction==='function'?fCompleteFunction:()=>{this.fable.log.info(`CSV Read of ${pFilePath} complete.`);};let tmpErrorFunction=typeof fErrorFunction==='function'?fErrorFunction:pError=>{this.fable.log.error(`CSV Read of ${pFilePath} Error: ${pError}`,pError);};return this.lineReaderFactory(pFilePath,pLine=>{let tmpRecord=tmpCSVParser.parseCSVLine(pLine);if(tmpRecord){tmpRecordFunction(tmpRecord,pLine);}},tmpCompleteFunction,tmpErrorFunction);}appendFileSync(pFileName,pAppendContent,pOptions){let tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.appendFileSync(pFileName,pAppendContent,tmpOptions);}writeFileSync(pFileName,pFileContent,pOptions){let tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.writeFileSync(pFileName,pFileContent,tmpOptions);}writeFileSyncFromObject(pFileName,pObject){return this.writeFileSync(pFileName,JSON.stringify(pObject,null,4));}writeFileSyncFromArray(pFileName,pFileArray){if(!Array.isArray(pFileArray)){this.log.error(`File Persistence Service attempted to write ${pFileName} from array but the expected array was not an array (it was a ${typeof pFileArray}).`);return Error('Attempted to write ${pFileName} from array but the expected array was not an array (it was a ${typeof(pFileArray)}).');}else{for(let i=0;i<pFileArray.length;i++){return this.appendFileSync(pFileName,`${pFileArray[i]}\n`);}}}writeFile(pFileName,pFileContent,pOptions,fCallback){let tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.writeFile(pFileName,pFileContent,tmpOptions,fCallback);}lineReaderFactory(pFilePath,fOnLine,fOnComplete,fOnError){let tmpLineReader={};if(typeof pFilePath!='string'){return false;}tmpLineReader.filePath=pFilePath;tmpLineReader.fileStream=libFS.createReadStream(tmpLineReader.filePath);tmpLineReader.reader=libReadline.createInterface({input:tmpLineReader.fileStream,crlfDelay:Infinity});if(typeof fOnError==='function'){tmpLineReader.reader.on('error',fOnError);}tmpLineReader.reader.on('line',typeof fOnLine==='function'?fOnLine:()=>{});if(typeof fOnComplete==='function'){tmpLineReader.reader.on('close',fOnComplete);}return tmpLineReader;}// Folder management
|
|
3922
3956
|
makeFolderRecursive(pParameters,fCallback){let tmpParameters=pParameters;if(typeof pParameters=='string'){tmpParameters={Path:pParameters};}else if(typeof pParameters!=='object'){fCallback(new Error('Parameters object or string not properly passed to recursive folder create.'));return false;}if(typeof tmpParameters.Path!=='string'){fCallback(new Error('Parameters object needs a path to run the folder create operation.'));return false;}if(!('Mode'in tmpParameters)){tmpParameters.Mode=this.options.Mode;}// Check if we are just starting .. if so, build the initial state for our recursive function
|
|
@@ -3928,7 +3962,7 @@ tmpParameters.CurrentPathIndex++;}// Check if the path is fully complete
|
|
|
3928
3962
|
if(tmpParameters.CurrentPathIndex>=tmpParameters.ActualPathParts.length){return fCallback(null);}// Check if the path exists (and is a folder)
|
|
3929
3963
|
libFS.open(tmpParameters.CurrentPath+libPath.sep+tmpParameters.ActualPathParts[tmpParameters.CurrentPathIndex],'r',(pError,pFileDescriptor)=>{if(pFileDescriptor){libFS.closeSync(pFileDescriptor);}if(pError&&pError.code=='ENOENT'){/* Path doesn't exist, create it */libFS.mkdir(tmpParameters.CurrentPath+libPath.sep+tmpParameters.ActualPathParts[tmpParameters.CurrentPathIndex],tmpParameters.Mode,pCreateError=>{if(!pCreateError){// We have now created our folder and there was no error -- continue.
|
|
3930
3964
|
return this.makeFolderRecursive(tmpParameters,fCallback);}else if(pCreateError.code=='EEXIST'){// The folder exists -- our dev might be running this in parallel/async/whatnot.
|
|
3931
|
-
return this.makeFolderRecursive(tmpParameters,fCallback);}else{console.log(pCreateError.code);return fCallback(pCreateError);}});}else{return this.makeFolderRecursive(tmpParameters,fCallback);}});}}module.exports=FableServiceFilePersistence;}).call(this);}).call(this,require('_process'));},{"_process":
|
|
3965
|
+
return this.makeFolderRecursive(tmpParameters,fCallback);}else{console.log(pCreateError.code);return fCallback(pCreateError);}});}else{return this.makeFolderRecursive(tmpParameters,fCallback);}});}}module.exports=FableServiceFilePersistence;}).call(this);}).call(this,require('_process'));},{"_process":107,"fable-serviceproviderbase":59,"fs":19,"path":103,"readline":19}],170:[function(require,module,exports){const libFableServiceBase=require('fable-serviceproviderbase');class FableServiceLogic extends libFableServiceBase{/**
|
|
3932
3966
|
* @param {import('../Fable.js')} pFable - The fable object
|
|
3933
3967
|
* @param {Record<string, any>} [pOptions] - The options object
|
|
3934
3968
|
* @param {string} [pServiceHash] - The hash of the service
|
|
@@ -3950,7 +3984,7 @@ let tmpMathLeft=this.fable.Math.parsePrecise(pLeft,null);let tmpMathRight=this.f
|
|
|
3950
3984
|
* @param {any} pOnTrue - The value to return if the object is truthy
|
|
3951
3985
|
* @param {any} [pOnFalse = ''] - The value to return if the object is falsy
|
|
3952
3986
|
* @return {any} - The value from the object
|
|
3953
|
-
*/when(pCheckForTruthy,pOnTrue){let pOnFalse=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'';if(!pCheckForTruthy){return pOnFalse;}if(Array.isArray(pCheckForTruthy)&&pCheckForTruthy.length<1){return pOnFalse;}if(typeof pCheckForTruthy==='object'&&Object.keys(pCheckForTruthy).length<1){return pOnFalse;}return pOnTrue;}}module.exports=FableServiceLogic;},{"fable-serviceproviderbase":
|
|
3987
|
+
*/when(pCheckForTruthy,pOnTrue){let pOnFalse=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'';if(!pCheckForTruthy){return pOnFalse;}if(Array.isArray(pCheckForTruthy)&&pCheckForTruthy.length<1){return pOnFalse;}if(typeof pCheckForTruthy==='object'&&Object.keys(pCheckForTruthy).length<1){return pOnFalse;}return pOnTrue;}}module.exports=FableServiceLogic;},{"fable-serviceproviderbase":59}],171:[function(require,module,exports){/**
|
|
3954
3988
|
* @file Fable-Service-Math.js
|
|
3955
3989
|
* @description This file contains the implementation of the FableServiceMath class, which provides simple functions for performing arbitrary precision math operations.
|
|
3956
3990
|
* @module FableServiceMath
|
|
@@ -3965,7 +3999,7 @@ let tmpMathLeft=this.fable.Math.parsePrecise(pLeft,null);let tmpMathRight=this.f
|
|
|
3965
3999
|
this.euler='2.7182818284590452353602874713526624977572470936999595749669676277240766303535475945713821785251664';// this.manifest = this.fable.newManyfest();
|
|
3966
4000
|
this.bigNumber=this.fable.Utility.bigNumber;this.ln2Cache=new Map();}/*
|
|
3967
4001
|
Pass-through Rounding Method Constants
|
|
3968
|
-
|
|
4002
|
+
|
|
3969
4003
|
Property Value BigDecimal Equiv Description
|
|
3970
4004
|
---------- ----- ---------------- -----------
|
|
3971
4005
|
roundDown 0 ROUND_DOWN Rounds towards zero. (_I.e. truncate, no rounding._)
|
|
@@ -3986,6 +4020,10 @@ tmpNumber=typeof pNonNumberValue==='undefined'?"0.0":pNonNumberValue;}return tmp
|
|
|
3986
4020
|
* @param {*} pValue - The value to be assigned.
|
|
3987
4021
|
* @returns {*} The assigned value.
|
|
3988
4022
|
*/assignValue(pValue){return pValue;}/**
|
|
4023
|
+
* Begins an expression with the given value. For performing colon operations in the solver.
|
|
4024
|
+
* @param {*} pValue - The value to begin the expression with.
|
|
4025
|
+
* @returns {*} The begun expression value.
|
|
4026
|
+
*/expressionBegin(pValue){return pValue;}/**
|
|
3989
4027
|
* Calculates the precise percentage of a given value compared to another value.
|
|
3990
4028
|
*
|
|
3991
4029
|
* @param {number} pIs - The value to calculate the percentage of.
|
|
@@ -3993,9 +4031,9 @@ tmpNumber=typeof pNonNumberValue==='undefined'?"0.0":pNonNumberValue;}return tmp
|
|
|
3993
4031
|
* @returns {string} The precise percentage as a string.
|
|
3994
4032
|
*/percentagePrecise(pIs,pOf){let tmpLeftValue=isNaN(pIs)?0:pIs;let tmpRightValue=isNaN(pOf)?0:pOf;if(tmpRightValue==0){return'0';}let tmpLeftArbitraryValue=new this.bigNumber(tmpLeftValue);let tmpResult=tmpLeftArbitraryValue.div(tmpRightValue);tmpResult=tmpResult.times(100);return tmpResult.toString();}/**
|
|
3995
4033
|
* Concatenates two value sets and returns the result as a string.
|
|
3996
|
-
*
|
|
4034
|
+
*
|
|
3997
4035
|
* Value sets are comma separated.
|
|
3998
|
-
*
|
|
4036
|
+
*
|
|
3999
4037
|
* Used for arbitrary precision set generation.
|
|
4000
4038
|
*
|
|
4001
4039
|
* @param {any} pLeftValue - The left value to append.
|
|
@@ -4010,7 +4048,7 @@ tmpNumber=typeof pNonNumberValue==='undefined'?"0.0":pNonNumberValue;}return tmp
|
|
|
4010
4048
|
* @returns {string} - The rounded value as a string.
|
|
4011
4049
|
*/roundPrecise(pValue,pDecimals,pRoundingMethod){let tmpValue=isNaN(pValue)?0:pValue;let tmpDecimals=isNaN(pDecimals)?0:parseInt(pDecimals,10);let tmpRoundingMethod=typeof pRoundingMethod==='undefined'?this.roundHalfUp:parseInt(pRoundingMethod,10);let tmpArbitraryValue=new this.bigNumber(tmpValue);let tmpResult=tmpArbitraryValue.round(tmpDecimals,tmpRoundingMethod);return tmpResult.toString();}/**
|
|
4012
4050
|
* Returns a string representation of a number with a specified number of decimals.
|
|
4013
|
-
*
|
|
4051
|
+
*
|
|
4014
4052
|
* @param {number} pValue - The number to be formatted.
|
|
4015
4053
|
* @param {number} pDecimals - The number of decimals to include in the formatted string.
|
|
4016
4054
|
* @param {string} [pRoundingMethod] - The rounding method to use. Defaults to 'roundHalfUp'.
|
|
@@ -4028,7 +4066,7 @@ tmpNumber=typeof pNonNumberValue==='undefined'?"0.0":pNonNumberValue;}return tmp
|
|
|
4028
4066
|
* @returns {string} The result of the subtraction as a string.
|
|
4029
4067
|
*/subtractPrecise(pLeftValue,pRightValue){let tmpLeftValue=isNaN(pLeftValue)?0:pLeftValue;let tmpRightValue=isNaN(pRightValue)?0:pRightValue;let tmpLeftArbitraryValue=new this.bigNumber(tmpLeftValue);let tmpResult=tmpLeftArbitraryValue.minus(tmpRightValue);return tmpResult.toString();}/**
|
|
4030
4068
|
* Calculates the precise power of two numbers.
|
|
4031
|
-
*
|
|
4069
|
+
*
|
|
4032
4070
|
* @param {number} pLeftValue - The base value.
|
|
4033
4071
|
* @param {number} pRightValue - The exponent value.
|
|
4034
4072
|
* @returns {string} The result of raising the base value to the exponent value.
|
|
@@ -4036,40 +4074,40 @@ tmpNumber=typeof pNonNumberValue==='undefined'?"0.0":pNonNumberValue;}return tmp
|
|
|
4036
4074
|
tmpResult=Math.pow(tmpLeftValue,Number(pRightValue));}return tmpResult.toString();}/**
|
|
4037
4075
|
* Multiplies two values precisely.
|
|
4038
4076
|
*
|
|
4039
|
-
* @param {number} pLeftValue - The left value to multiply.
|
|
4040
|
-
* @param {number} pRightValue - The right value to multiply.
|
|
4077
|
+
* @param {number|string} pLeftValue - The left value to multiply.
|
|
4078
|
+
* @param {number|string} pRightValue - The right value to multiply.
|
|
4041
4079
|
* @returns {string} The result of the multiplication as a string.
|
|
4042
4080
|
*/multiplyPrecise(pLeftValue,pRightValue){let tmpLeftValue=isNaN(pLeftValue)?0:pLeftValue;let tmpRightValue=isNaN(pRightValue)?0:pRightValue;let tmpLeftArbitraryValue=new this.bigNumber(tmpLeftValue);let tmpResult=tmpLeftArbitraryValue.times(tmpRightValue);return tmpResult.toString();}/**
|
|
4043
4081
|
* Divides two values precisely.
|
|
4044
4082
|
*
|
|
4045
|
-
* @param {number} pLeftValue - The left value to be divided.
|
|
4046
|
-
* @param {number} pRightValue - The right value to divide by.
|
|
4083
|
+
* @param {number|string} pLeftValue - The left value to be divided.
|
|
4084
|
+
* @param {number|string} pRightValue - The right value to divide by.
|
|
4047
4085
|
* @returns {string} The result of the division as a string.
|
|
4048
4086
|
*/dividePrecise(pLeftValue,pRightValue){let tmpLeftValue=isNaN(pLeftValue)?0:pLeftValue;let tmpRightValue=isNaN(pRightValue)?0:pRightValue;let tmpLeftArbitraryValue=new this.bigNumber(tmpLeftValue);let tmpResult=tmpLeftArbitraryValue.div(tmpRightValue);return tmpResult.toString();}/**
|
|
4049
4087
|
* Calculates the modulus of two values with precision.
|
|
4050
4088
|
*
|
|
4051
|
-
* @param {number} pLeftValue - The left value.
|
|
4052
|
-
* @param {number} pRightValue - The right value.
|
|
4089
|
+
* @param {number|string} pLeftValue - The left value.
|
|
4090
|
+
* @param {number|string} pRightValue - The right value.
|
|
4053
4091
|
* @returns {string} The result of the modulus operation as a string.
|
|
4054
4092
|
*/modPrecise(pLeftValue,pRightValue){let tmpLeftValue=isNaN(pLeftValue)?0:pLeftValue;let tmpRightValue=isNaN(pRightValue)?0:pRightValue;let tmpLeftArbitraryValue=new this.bigNumber(tmpLeftValue);let tmpResult=tmpLeftArbitraryValue.mod(tmpRightValue);return tmpResult.toString();}/**
|
|
4055
4093
|
* Calculates the square root of a number with precise decimal places.
|
|
4056
4094
|
*
|
|
4057
|
-
* @param {number} pValue - The number to calculate the square root of.
|
|
4095
|
+
* @param {number|string} pValue - The number to calculate the square root of.
|
|
4058
4096
|
* @returns {string} The square root of the input number as a string.
|
|
4059
4097
|
*/sqrtPrecise(pValue){let tmpValue=isNaN(pValue)?0:pValue;let tmpLeftArbitraryValue=new this.bigNumber(tmpValue);let tmpResult=tmpLeftArbitraryValue.sqrt();return tmpResult.toString();}/**
|
|
4060
4098
|
* Calculates the absolute value of a number precisely.
|
|
4061
4099
|
*
|
|
4062
|
-
* @param {number} pValue - The number to calculate the absolute value of.
|
|
4100
|
+
* @param {number|string} pValue - The number to calculate the absolute value of.
|
|
4063
4101
|
* @returns {string} The absolute value of the input number as a string.
|
|
4064
4102
|
*/absPrecise(pValue){let tmpValue=isNaN(pValue)?0:pValue;let tmpLeftArbitraryValue=new this.bigNumber(tmpValue);let tmpResult=tmpLeftArbitraryValue.abs();return tmpResult.toString();}/**
|
|
4065
4103
|
* Calculates the floor of a number precisely.
|
|
4066
4104
|
*
|
|
4067
|
-
* @param {number} pValue - The number to calculate the floor value of.
|
|
4105
|
+
* @param {string|number} pValue - The number to calculate the floor value of.
|
|
4068
4106
|
* @returns {string} The floor value of the input number as a string.
|
|
4069
4107
|
*/floorPrecise(pValue){let tmpValue=isNaN(pValue)?0:pValue;let tmpResult=Math.floor(tmpValue);return tmpResult.toString();}/**
|
|
4070
4108
|
* Calculates the ceiling of a number precisely.
|
|
4071
4109
|
*
|
|
4072
|
-
* @param {number} pValue - The number to calculate the ceiling value of.
|
|
4110
|
+
* @param {number|string} pValue - The number to calculate the ceiling value of.
|
|
4073
4111
|
* @returns {string} The ceiling value of the input number as a string.
|
|
4074
4112
|
*/ceilPrecise(pValue){let tmpValue=isNaN(pValue)?0:pValue;let tmpResult=Math.ceil(tmpValue);return tmpResult.toString();}/**
|
|
4075
4113
|
* Compares two values precisely.
|
|
@@ -4087,45 +4125,45 @@ tmpResult=Math.pow(tmpLeftValue,Number(pRightValue));}return tmpResult.toString(
|
|
|
4087
4125
|
*/comparePreciseWithin(pLeftValue,pRightValue,pEpsilon){let tmpLeftValue=isNaN(pLeftValue)?0:pLeftValue;let tmpRightValue=isNaN(pRightValue)?0:pRightValue;let tmpLeftArbitraryValue=new this.bigNumber(tmpLeftValue);const diff=tmpLeftArbitraryValue.minus(tmpRightValue).abs();if(diff.lte(pEpsilon)){return 0;}if(tmpLeftArbitraryValue.lt(tmpRightValue)){return-1;}return 1;}/**
|
|
4088
4126
|
* Determines if the left value is greater than the right value precisely.
|
|
4089
4127
|
*
|
|
4090
|
-
* @param {number} pLeftValue - The left value to compare.
|
|
4091
|
-
* @param {number} pRightValue - The right value to compare.
|
|
4128
|
+
* @param {number|string} pLeftValue - The left value to compare.
|
|
4129
|
+
* @param {number|string} pRightValue - The right value to compare.
|
|
4092
4130
|
* @returns {boolean} - Returns true if the left value is greater than the right value, otherwise returns false.
|
|
4093
4131
|
*/gtPrecise(pLeftValue,pRightValue){let tmpLeftValue=isNaN(pLeftValue)?0:pLeftValue;let tmpRightValue=isNaN(pRightValue)?0:pRightValue;let tmpLeftArbitraryValue=new this.bigNumber(tmpLeftValue);return tmpLeftArbitraryValue.gt(tmpRightValue);}/**
|
|
4094
4132
|
* Checks if the left value is greater than or equal to the right value.
|
|
4095
4133
|
* If either value is not a number, it is treated as 0.
|
|
4096
4134
|
*
|
|
4097
|
-
* @param {number} pLeftValue - The left value to compare.
|
|
4098
|
-
* @param {number} pRightValue - The right value to compare.
|
|
4135
|
+
* @param {number|string} pLeftValue - The left value to compare.
|
|
4136
|
+
* @param {number|string} pRightValue - The right value to compare.
|
|
4099
4137
|
* @returns {boolean} - True if the left value is greater than or equal to the right value, false otherwise.
|
|
4100
4138
|
*/gtePrecise(pLeftValue,pRightValue){let tmpLeftValue=isNaN(pLeftValue)?0:pLeftValue;let tmpRightValue=isNaN(pRightValue)?0:pRightValue;let tmpLeftArbitraryValue=new this.bigNumber(tmpLeftValue);return tmpLeftArbitraryValue.gte(tmpRightValue);}/**
|
|
4101
4139
|
* Determines if the left value is less than the right value precisely.
|
|
4102
4140
|
*
|
|
4103
|
-
* @param {number} pLeftValue - The left value to compare.
|
|
4104
|
-
* @param {number} pRightValue - The right value to compare.
|
|
4141
|
+
* @param {number|string} pLeftValue - The left value to compare.
|
|
4142
|
+
* @param {number|string} pRightValue - The right value to compare.
|
|
4105
4143
|
* @returns {boolean} - Returns true if the left value is less than the right value, otherwise returns false.
|
|
4106
4144
|
*/ltPrecise(pLeftValue,pRightValue){let tmpLeftValue=isNaN(pLeftValue)?0:pLeftValue;let tmpRightValue=isNaN(pRightValue)?0:pRightValue;let tmpLeftArbitraryValue=new this.bigNumber(tmpLeftValue);return tmpLeftArbitraryValue.lt(tmpRightValue);}/**
|
|
4107
4145
|
* Determines if the left value is less than or equal to the right value.
|
|
4108
4146
|
*
|
|
4109
|
-
* @param {number} pLeftValue - The left value to compare.
|
|
4110
|
-
* @param {number} pRightValue - The right value to compare.
|
|
4147
|
+
* @param {number|string} pLeftValue - The left value to compare.
|
|
4148
|
+
* @param {number|string} pRightValue - The right value to compare.
|
|
4111
4149
|
* @returns {boolean} - Returns true if the left value is less than or equal to the right value, otherwise returns false.
|
|
4112
4150
|
*/ltePrecise(pLeftValue,pRightValue){let tmpLeftValue=isNaN(pLeftValue)?0:pLeftValue;let tmpRightValue=isNaN(pRightValue)?0:pRightValue;let tmpLeftArbitraryValue=new this.bigNumber(tmpLeftValue);return tmpLeftArbitraryValue.lte(tmpRightValue);}/**
|
|
4113
4151
|
* Converts degrees to radians with arbitrary precision.
|
|
4114
|
-
*
|
|
4115
|
-
* @param {number} pDegrees - The degrees to convert to radians.
|
|
4152
|
+
*
|
|
4153
|
+
* @param {number|string} pDegrees - The degrees to convert to radians.
|
|
4116
4154
|
* @returns {string} - The converted radians as a string.
|
|
4117
4155
|
*/radPrecise(pDegrees){let tmpDegrees=isNaN(pDegrees)?0:pDegrees;let tmpDegreesArbitraryValue=new this.bigNumber(tmpDegrees);// TODO: Const for pi in arbitrary precision?
|
|
4118
4156
|
let tmpResult=tmpDegreesArbitraryValue.times(Math.PI).div(180);return tmpResult.toString();}/**
|
|
4119
4157
|
* Calculates the value of pi with the specified precision.
|
|
4120
4158
|
* If no precision is provided, returns 100 digits after the decimal.
|
|
4121
4159
|
*
|
|
4122
|
-
* @param {number} [pPrecision] - The precision to use for calculating pi.
|
|
4160
|
+
* @param {number|string} [pPrecision] - The precision to use for calculating pi.
|
|
4123
4161
|
* @returns {number} - The calculated value of pi.
|
|
4124
4162
|
*/piPrecise(pPrecision){if(typeof pPrecision==='undefined'){return this.pi;}else{return this.roundPrecise(this.pi,pPrecision);}}/**
|
|
4125
4163
|
* Calculates the value of euler with the specified precision.
|
|
4126
4164
|
*
|
|
4127
|
-
* @param {number} [pPrecision] - The precision to use for calculating E.
|
|
4128
|
-
* @returns {
|
|
4165
|
+
* @param {number|string} [pPrecision] - The precision to use for calculating E.
|
|
4166
|
+
* @returns {string} - The calculated value of E.
|
|
4129
4167
|
*/eulerPrecise(pPrecision){if(typeof pPrecision==='undefined'){return this.euler;}else{return this.roundPrecise(this.euler,pPrecision);}}/**
|
|
4130
4168
|
* Calculates the sine of the given angle in radians.
|
|
4131
4169
|
*
|
|
@@ -4133,7 +4171,7 @@ let tmpResult=tmpDegreesArbitraryValue.times(Math.PI).div(180);return tmpResult.
|
|
|
4133
4171
|
* @returns {number} The sine of the angle.
|
|
4134
4172
|
*/sin(pRadians){let tmpRadians=isNaN(pRadians)?0:pRadians;return Math.sin(tmpRadians);}/**
|
|
4135
4173
|
* Calculates the cosine of the given angle in radians.
|
|
4136
|
-
*
|
|
4174
|
+
*
|
|
4137
4175
|
* @param {number} pRadians - The angle in radians.
|
|
4138
4176
|
* @returns {number} The cosine of the angle.
|
|
4139
4177
|
*/cos(pRadians){let tmpRadians=isNaN(pRadians)?0:pRadians;return Math.cos(tmpRadians);}/**
|
|
@@ -4146,9 +4184,9 @@ let tmpResult=tmpDegreesArbitraryValue.times(Math.PI).div(180);return tmpResult.
|
|
|
4146
4184
|
* These are meant to work fine with arrays and more complex set descriptions returned by Manyfest.
|
|
4147
4185
|
* Manyfest sometimes returns values as arrays and sometimes as a map of addresses with values depending
|
|
4148
4186
|
* on what was requested.
|
|
4149
|
-
*
|
|
4187
|
+
*
|
|
4150
4188
|
* The following functions will likely be broken into their own service.
|
|
4151
|
-
|
|
4189
|
+
*//**
|
|
4152
4190
|
* Counts the number of elements in a set.
|
|
4153
4191
|
*
|
|
4154
4192
|
* @param {Array|Object|any} pValueSet - The set to count the elements of.
|
|
@@ -4156,28 +4194,28 @@ let tmpResult=tmpDegreesArbitraryValue.times(Math.PI).div(180);return tmpResult.
|
|
|
4156
4194
|
*/countSetElements(pValueSet){if(Array.isArray(pValueSet)){return pValueSet.length;}else if(typeof pValueSet==='object'){return Object.keys(pValueSet).length;}else if(pValueSet){// This is controversial. Discuss with colleagues!
|
|
4157
4195
|
return 1;}return 0;}/**
|
|
4158
4196
|
* Sorts the elements in the given value set in ascending order using the precise parsing and comparison.
|
|
4159
|
-
*
|
|
4197
|
+
*
|
|
4160
4198
|
* @param {Array|Object} pValueSet - The value set to be sorted.
|
|
4161
4199
|
* @returns {Array} - The sorted value set.
|
|
4162
4200
|
*/sortSetPrecise(pValueSet){let tmpSortedSet=[];if(Array.isArray(pValueSet)){for(let i=0;i<pValueSet.length;i++){tmpSortedSet.push(this.parsePrecise(pValueSet[i],NaN));}}else if(typeof pValueSet==='object'){let tmpKeys=Object.keys(pValueSet);for(let i=0;i<tmpKeys.length;i++){tmpSortedSet.push(this.parsePrecise(pValueSet[tmpKeys[i]],NaN));}}tmpSortedSet.sort((pLeft,pRight)=>{return this.comparePrecise(pLeft,pRight);});return tmpSortedSet;}/**
|
|
4163
4201
|
* Bucketizes a set of values based on a specified bucket size.
|
|
4164
4202
|
*
|
|
4165
4203
|
* @param {Array|Object} pValueSet - The set of values to be bucketized.
|
|
4166
|
-
* @param {number} pBucketSize - The size of each bucket. Optional - If NaN, the values will be bucketized by their value.
|
|
4204
|
+
* @param {number} [pBucketSize] - The size of each bucket. Optional - If NaN, the values will be bucketized by their value.
|
|
4167
4205
|
* @returns {Object} - The bucketized set of values.
|
|
4168
4206
|
*/bucketSetPrecise(pValueSet,pBucketSize){let tmpBucketedSet={};let tmpBucketSize=this.parsePrecise(pBucketSize,NaN);if(Array.isArray(pValueSet)){for(let i=0;i<pValueSet.length;i++){let tmpValue=this.parsePrecise(pValueSet[i],NaN);let tmpBucket=tmpValue.toString();if(!isNaN(tmpBucketSize)){tmpBucket=this.dividePrecise(pValueSet[i],tmpBucketSize);}if(!(tmpBucket in tmpBucketedSet)){tmpBucketedSet[tmpBucket]=0;}tmpBucketedSet[tmpBucket]=tmpBucketedSet[tmpBucket]+1;}}else if(typeof pValueSet==='object'){let tmpKeys=Object.keys(pValueSet);for(let i=0;i<tmpKeys.length;i++){let tmpValue=this.parsePrecise(pValueSet[tmpKeys[i]],NaN);let tmpBucket=tmpValue.toString();if(!isNaN(tmpBucketSize)){tmpBucket=this.dividePrecise(pValueSet[i],tmpBucketSize);}if(!(tmpBucket in tmpBucketedSet)){tmpBucketedSet[tmpBucket]=0;}tmpBucketedSet[tmpBucket]=tmpBucketedSet[tmpBucket]+1;}}return tmpBucketedSet;}/**
|
|
4169
4207
|
* Calculates the histogram using precise bucket set for the given pValueSet.
|
|
4170
|
-
*
|
|
4208
|
+
*
|
|
4171
4209
|
* @param {Array<number>} pValueSet - The array of p-values.
|
|
4172
4210
|
* @returns {Array<number>} The histogram of the p-values.
|
|
4173
4211
|
*/histogramPrecise(pValueSet){return this.bucketSetPrecise(pValueSet);}/**
|
|
4174
4212
|
* Sorts the histogram object in ascending order based on the frequencies of the buckets.
|
|
4175
|
-
*
|
|
4213
|
+
*
|
|
4176
4214
|
* @param {Object} pHistogram - The histogram object to be sorted.
|
|
4177
4215
|
* @returns {Object} - The sorted histogram object.
|
|
4178
4216
|
*/sortHistogramPrecise(pHistogram){let tmpSortedHistogram={};let tmpKeys=Object.keys(pHistogram);tmpKeys.sort((pLeft,pRight)=>{return pHistogram[pLeft]-pHistogram[pRight];});for(let i=0;i<tmpKeys.length;i++){tmpSortedHistogram[tmpKeys[i]]=pHistogram[tmpKeys[i]];}return tmpSortedHistogram;}/**
|
|
4179
4217
|
* Sorts the histogram object in ascending order based on the keys.
|
|
4180
|
-
*
|
|
4218
|
+
*
|
|
4181
4219
|
* @param {Object} pHistogram - The histogram object to be sorted.
|
|
4182
4220
|
* @returns {Object} - The sorted histogram object.
|
|
4183
4221
|
*/sortHistogramByKeys(pHistogram,pDescending){let tmpSortedHistogram={};let tmpKeys=Object.keys(pHistogram);let tmpDescending=typeof pDescending==='undefined'?false:pDescending;// Sort tmpKeys by the string comparison
|
|
@@ -4185,15 +4223,15 @@ tmpKeys.sort();if(tmpDescending){tmpKeys=tmpKeys.reverse();}for(let i=0;i<tmpKey
|
|
|
4185
4223
|
* Calculate the natural log of 2 to a specific precision, for use in the Taylor series.
|
|
4186
4224
|
* Cache outcome so it only runs once per precision.
|
|
4187
4225
|
* @param {number} pPrecision - The decimal precision to calculate ln(2) to.
|
|
4188
|
-
* @returns
|
|
4226
|
+
* @returns
|
|
4189
4227
|
*/arbitraryNaturalLogOfTwo(pPrecision){const tmpPrecisionKey=pPrecision|0;const tmpPrecision=new this.bigNumber(tmpPrecisionKey);if(this.ln2Cache.has(tmpPrecisionKey)){return this.ln2Cache.get(tmpPrecisionKey);}const tmpTwoConstant=new this.bigNumber(2);const y=tmpTwoConstant.minus(1).div(tmpTwoConstant.plus(1));// 1/3
|
|
4190
4228
|
const y2=y.mul(y);let tmpSummation=new this.bigNumber(0);let tmpTermination=y;let tmpDenominator=1;// Use a slightly larger precision for this to prevent numeric drift for larger log requirements
|
|
4191
4229
|
const tmpEpsilon=this.powerPrecise(10,-tmpPrecision.add(8));// target tail < 10^-(precision+8)
|
|
4192
4230
|
for(let i=0;i<200000;i++){tmpSummation=tmpSummation.plus(tmpTermination.div(tmpDenominator));tmpTermination=tmpTermination.mul(y2);tmpDenominator+=2;if(tmpTermination.abs().div(tmpDenominator).lt(tmpEpsilon)){break;}}const tmpNaturalLogOfTwo=tmpSummation.mul(2);this.ln2Cache.set(tmpPrecisionKey,tmpNaturalLogOfTwo);return tmpNaturalLogOfTwo;}/**
|
|
4193
4231
|
* Calculate the natural log of a number to a specific precision using arbitrary precision numbers.
|
|
4194
|
-
* @param {number} pNumberToCompute
|
|
4195
|
-
* @param {number} pPrecision
|
|
4196
|
-
* @returns
|
|
4232
|
+
* @param {number} pNumberToCompute
|
|
4233
|
+
* @param {number} pPrecision
|
|
4234
|
+
* @returns
|
|
4197
4235
|
*/arbitraryNaturalLog(pNumberToCompute,pPrecision){let tmpNumberToCompute=new this.bigNumber(pNumberToCompute);let tmpPrecision=new this.bigNumber(pPrecision);if(tmpNumberToCompute.lte(0))throw new Error('ln undefined for non-positive values.');if(tmpNumberToCompute.eq(1))return new this.bigNumber(0);// Reduce x to m in ~[0.75, 1.5] by multiplying/dividing by 2
|
|
4198
4236
|
const TWO=new this.bigNumber(2);let k=0;let m=tmpNumberToCompute;const tmpUpperBounds=new this.bigNumber('1.5');const tmpLowerBounds=new this.bigNumber('0.75');while(m.gt(tmpUpperBounds)){m=m.div(TWO);k+=1;}while(m.lt(tmpLowerBounds)){m=m.mul(TWO);k-=1;}// ln(m) via atanh/Taylor
|
|
4199
4237
|
const y=m.minus(1).div(m.plus(1));// |y| < 1
|
|
@@ -4208,7 +4246,7 @@ const tmpPrecisionNaturalLog=this.arbitraryNaturalLogOfTwo(tmpPrecision);return
|
|
|
4208
4246
|
* - atanh series: ln(m) = 2 * sum_{j>=0} y^(2j+1)/(2j+1), y=(m-1)/(m+1), |y|<1
|
|
4209
4247
|
*
|
|
4210
4248
|
* Converges rapidly when m is close to 1 with arbitrary precision numbers.
|
|
4211
|
-
*
|
|
4249
|
+
*
|
|
4212
4250
|
* @param {number} pNumberToGenerateLogarithmFor - The number to generate the logarithm for.
|
|
4213
4251
|
* @param {number} [pBase] - The base of the logarithm. Defaults to 10.
|
|
4214
4252
|
* @param {number} [pPrecision] - The precision of the result. Defaults to 9 decimal places.
|
|
@@ -4244,12 +4282,12 @@ let tmpTwoToThePowerOfAbsoluteK=tmpAbsoluteValueOfK===0?new this.bigNumber(1):tm
|
|
|
4244
4282
|
this.bigNumber.DP=tmpSavedBigDecimalPrecision;return tmpResult.round(tmpDecimalPrecision).toString();}cleanValueObject(pValueObject){if(typeof pValueObject!=='object'){return{};}//TODO: is this right?
|
|
4245
4283
|
let tmpCleanedObject={};let tmpKeys=Object.keys(pValueObject);for(let i=0;i<tmpKeys.length;i++){let tmpValue=this.parsePrecise(pValueObject[tmpKeys[i]],NaN);if(!isNaN(tmpValue)){tmpCleanedObject[tmpKeys[i]]=tmpValue;}}return tmpCleanedObject;}/**
|
|
4246
4284
|
* Make a histogram of representative counts for exact values (.tostring() is the keys to count)
|
|
4247
|
-
* @param {Array} pValueSet
|
|
4248
|
-
* @param {string} pValueAddress
|
|
4285
|
+
* @param {Array} pValueSet
|
|
4286
|
+
* @param {string} pValueAddress
|
|
4249
4287
|
*/histogramDistributionByExactValue(pValueObjectSet,pValueAddress,pManifest){if(!Array.isArray(pValueObjectSet)){return pValueObjectSet;}if(!pValueAddress){return{};}let tmpHistogram={};for(let i=0;i<pValueObjectSet.length;i++){let tmpValue=this.fable.Utility.getValueByHash(pValueObjectSet[i],pValueAddress,pManifest).toString();if(!(tmpValue in tmpHistogram)){tmpHistogram[tmpValue]=0;}tmpHistogram[tmpValue]=tmpHistogram[tmpValue]+1;}return tmpHistogram;}histogramDistributionByExactValueFromInternalState(pValueObjectSetAddress,pValueAddress){if(!pValueObjectSetAddress){return{};}let tmpValueObjectSet=this.fable.Utility.getInternalValueByHash(pValueObjectSetAddress);return this.histogramDistributionByExactValue(tmpValueObjectSet,pValueAddress);}/**
|
|
4250
4288
|
* Make a histogram of representative counts for exact values (.tostring() is the keys to count)
|
|
4251
|
-
* @param {Array} pValueSet
|
|
4252
|
-
* @param {string} pValueAddress
|
|
4289
|
+
* @param {Array} pValueSet
|
|
4290
|
+
* @param {string} pValueAddress
|
|
4253
4291
|
*/histogramAggregationByExactValue(pValueObjectSet,pValueAddress,pValueAmountAddress,pManifest){if(!Array.isArray(pValueObjectSet)){return pValueObjectSet;}if(!pValueAddress||!pValueAmountAddress){return{};}let tmpHistogram={};for(let i=0;i<pValueObjectSet.length;i++){let tmpValue=this.fable.Utility.getValueByHash(pValueObjectSet[i],pValueAddress,pManifest).toString();let tmpAmount=this.parsePrecise(this.fable.Utility.getValueByHash(pValueObjectSet[i],pValueAmountAddress,pManifest),NaN);if(!(tmpValue in tmpHistogram)){tmpHistogram[tmpValue]=0;}if(!isNaN(tmpAmount)){tmpHistogram[tmpValue]=this.addPrecise(tmpHistogram[tmpValue],tmpAmount);}}return tmpHistogram;}/**
|
|
4254
4292
|
* Aggregates a histogram by exact value from an internal state object.
|
|
4255
4293
|
*
|
|
@@ -4258,11 +4296,11 @@ let tmpCleanedObject={};let tmpKeys=Object.keys(pValueObject);for(let i=0;i<tmpK
|
|
|
4258
4296
|
* @param {string} pValueAmountAddress - The address of the amount to aggregate.
|
|
4259
4297
|
* @returns {Object} The aggregated histogram object. Returns an empty object if the value object set address is not provided.
|
|
4260
4298
|
*/histogramAggregationByExactValueFromInternalState(pValueObjectSetAddress,pValueAddress,pValueAmountAddress){if(!pValueObjectSetAddress){return{};}let tmpValueObjectSet=this.fable.Utility.getInternalValueByHash(pValueObjectSetAddress);return this.histogramAggregationByExactValue(tmpValueObjectSet,pValueAddress,pValueAmountAddress);}/**
|
|
4261
|
-
* Given a value object set (an array of objects), find a specific entry when
|
|
4299
|
+
* Given a value object set (an array of objects), find a specific entry when
|
|
4262
4300
|
* sorted by a specific value address. Supports -1 syntax for last entry.
|
|
4263
|
-
* @param {Array} pValueObjectSet
|
|
4264
|
-
* @param {string} pValueAddress
|
|
4265
|
-
* @param {Object} pManifest
|
|
4301
|
+
* @param {Array} pValueObjectSet
|
|
4302
|
+
* @param {string} pValueAddress
|
|
4303
|
+
* @param {Object} pManifest
|
|
4266
4304
|
*/entryInSet(pValueObjectSet,pValueAddress,pEntryIndex){const tmpEntryIndex=typeof pEntryIndex==='number'?pEntryIndex:parseInt(pEntryIndex);if(!Array.isArray(pValueObjectSet)){return pValueObjectSet;}if(!pValueAddress){return false;}if(isNaN(tmpEntryIndex)||tmpEntryIndex>=pValueObjectSet.length){return false;}let tmpValueArray=pValueObjectSet.toSorted((pLeft,pRight)=>{return this.comparePrecise(pLeft[pValueAddress],pRight[pValueAddress]);});let tmpIndex=tmpEntryIndex<0?tmpValueArray.length+tmpEntryIndex:tmpEntryIndex;return tmpValueArray[tmpIndex];}/**
|
|
4267
4305
|
* Finds the smallest value in a set of objects based on a specified value address.
|
|
4268
4306
|
*
|
|
@@ -4276,18 +4314,18 @@ let tmpCleanedObject={};let tmpKeys=Object.keys(pValueObject);for(let i=0;i<tmpK
|
|
|
4276
4314
|
* @param {string} pValueAddress - The address (key or path) within each object to compare values.
|
|
4277
4315
|
* @returns {*} The largest value found at the specified address in the set of objects.
|
|
4278
4316
|
*/largestInSet(pValueObjectSet,pValueAddress){return this.entryInSet(pValueObjectSet,pValueAddress,-1);}/**
|
|
4279
|
-
* Expects an array of objects, and an address in each object to sum. Expects
|
|
4317
|
+
* Expects an array of objects, and an address in each object to sum. Expects
|
|
4280
4318
|
* an address to put the cumulative summation as well.
|
|
4281
|
-
*
|
|
4319
|
+
*
|
|
4282
4320
|
* @param {Array} pValueObjectSet - The array of objects to perform a cumulative summation on
|
|
4283
4321
|
* @param {string} pValueAddress - The address of the column in each object to sum
|
|
4284
4322
|
* @param {string} pCumulationResultAddress - The address in each object to put the cumulative summation result
|
|
4285
4323
|
* @param {Object} pManifest - The manifest to use for value retrieval and setting
|
|
4286
4324
|
* @returns {Array} The updated value object set with cumulative summation results.
|
|
4287
4325
|
*/cumulativeSummation(pValueObjectSet,pValueAddress,pCumulationResultAddress,pManifest){return this.iterativeSeries(pValueObjectSet,pValueAddress,pCumulationResultAddress,"1.0","add","0.0",true,pManifest);}/**
|
|
4288
|
-
* Expects an array of objects, and an address in each object to sum. Expects
|
|
4326
|
+
* Expects an array of objects, and an address in each object to sum. Expects
|
|
4289
4327
|
* an address to put the cumulative summation as well.
|
|
4290
|
-
*
|
|
4328
|
+
*
|
|
4291
4329
|
* @param {Array} pValueObjectSet - The array of objects to perform a cumulative summation on
|
|
4292
4330
|
* @param {string} pValueAddress - The address of the column in each object to sum
|
|
4293
4331
|
* @param {string} pCumulationResultAddress - The address in each object to put the cumulative summation result
|
|
@@ -4305,18 +4343,18 @@ if(typeof pStartingValue==='undefined'||pStartingValue===null){tmpProcessFirstRo
|
|
|
4305
4343
|
* @param {string} pCumulationResultAddress - The address in each object to put the cumulative summation result
|
|
4306
4344
|
* @param {string} pStartingValue - The address of the value to process from; defaults to the first row
|
|
4307
4345
|
* @param {boolean} pProcessFirstRowWithAValue - Whether to process the first row's value from all subsequent rows
|
|
4308
|
-
* @param {Object} pManifest - The manifest to
|
|
4346
|
+
* @param {Object} pManifest - The manifest to
|
|
4309
4347
|
* @returns {Array} The updated value object set with cumulative summation results.
|
|
4310
4348
|
*/iterativeSeries(pValueObjectSet,pValueAddress,pCumulationResultAddress,pValueMultiplier,pSummationOperation,pStartingValue,pProcessFirstRowWithAValue,pManifest){if(!Array.isArray(pValueObjectSet)){return pValueObjectSet;}if(!pValueAddress||!pCumulationResultAddress){return pValueObjectSet;}// By default don't subtract the first row from the value
|
|
4311
4349
|
let tmpProcessFirstRow=typeof pProcessFirstRowWithAValue==='undefined'?false:pProcessFirstRowWithAValue;let tmpValueMultiplier;if(pValueMultiplier&&pValueMultiplier!==''){tmpValueMultiplier=this.parsePrecise(pValueMultiplier);}if(isNaN(tmpValueMultiplier)){tmpValueMultiplier=this.parsePrecise("1.0");}// Default to start from the current value address
|
|
4312
4350
|
let tmpSummationValue;// This logic ensures we don't default to 0 when pStartingValue is an empty string
|
|
4313
|
-
if(pStartingValue||pStartingValue!==''){tmpSummationValue=this.parsePrecise(pStartingValue);}if(isNaN(tmpSummationValue)||typeof pStartingValue==='undefined'||pStartingValue===null){tmpSummationValue='';}for(let i=0;i<pValueObjectSet.length;i++){let tmpValue=this.parsePrecise(this.fable.Utility.getValueByHash(pValueObjectSet[i],pValueAddress,pManifest));// Since summation might start on a row after the first,
|
|
4351
|
+
if(pStartingValue||pStartingValue!==''){tmpSummationValue=this.parsePrecise(pStartingValue);}if(isNaN(tmpSummationValue)||typeof pStartingValue==='undefined'||pStartingValue===null){tmpSummationValue='';}for(let i=0;i<pValueObjectSet.length;i++){let tmpValue=this.parsePrecise(this.fable.Utility.getValueByHash(pValueObjectSet[i],pValueAddress,pManifest));// Since summation might start on a row after the first,
|
|
4314
4352
|
let tmpFirstRowWithValue=false;if(tmpSummationValue===''&&tmpValue&&!isNaN(tmpSummationValue)){// Try to grab the summation value from the first row with a value
|
|
4315
4353
|
tmpSummationValue=tmpValue;tmpFirstRowWithValue=true;}// Continue on with the values as they are if the current row doesn't have a change
|
|
4316
4354
|
if(isNaN(tmpValue)){this.fable.Utility.setValueByHash(pValueObjectSet[i],pCumulationResultAddress,tmpSummationValue,pManifest);continue;}tmpValue=this.multiplyPrecise(tmpValue,tmpValueMultiplier);// Now perform the operation
|
|
4317
4355
|
if(!tmpFirstRowWithValue||tmpProcessFirstRow){switch(pSummationOperation){case'+':case'add':case'plus':case'addition':tmpSummationValue=this.addPrecise(tmpSummationValue,tmpValue);break;case'-':case'sub':case'minus':case'subtract':tmpSummationValue=this.subtractPrecise(tmpSummationValue,tmpValue);break;case'*':case'mul':case'times':case'multiply':tmpSummationValue=this.multiplyPrecise(tmpSummationValue,tmpValue);break;case'-':case'div':case'over':case'divide':tmpSummationValue=this.dividePrecise(tmpSummationValue,tmpValue);break;}}this.fable.Utility.setValueByHash(pValueObjectSet[i],pCumulationResultAddress,tmpSummationValue,pManifest);}return pValueObjectSet;}/**
|
|
4318
4356
|
* Finds the maximum value from a set of precise values.
|
|
4319
|
-
*
|
|
4357
|
+
*
|
|
4320
4358
|
* @param {Array|Object} pValueSet - The set of values to find the maximum from.
|
|
4321
4359
|
* @returns {number} - The maximum value from the set.
|
|
4322
4360
|
*/maxPrecise(pValueSet){let tmpMaxValue=NaN;if(Array.isArray(pValueSet)){for(let i=0;i<pValueSet.length;i++){if(!tmpMaxValue){tmpMaxValue=this.parsePrecise(pValueSet[i],NaN);}else{let tmpComparisonValue=this.parsePrecise(pValueSet[i],NaN);if(this.gtPrecise(tmpComparisonValue,tmpMaxValue)){tmpMaxValue=tmpComparisonValue;}}}}else if(typeof pValueSet==='object'){let tmpKeys=Object.keys(pValueSet);for(let i=0;i<tmpKeys.length;i++){if(!tmpMaxValue){tmpMaxValue=this.parsePrecise(pValueSet[tmpKeys[i]],NaN);}else{let tmpComparisonValue=this.parsePrecise(pValueSet[tmpKeys[i]],NaN);if(this.gtPrecise(tmpComparisonValue,tmpMaxValue)){tmpMaxValue=tmpComparisonValue;}}}}return tmpMaxValue;}/**
|
|
@@ -4326,7 +4364,7 @@ if(!tmpFirstRowWithValue||tmpProcessFirstRow){switch(pSummationOperation){case'+
|
|
|
4326
4364
|
* @returns {number} The minimum value from the set.
|
|
4327
4365
|
*/minPrecise(pValueSet){let tmpMinValue=NaN;if(Array.isArray(pValueSet)){for(let i=0;i<pValueSet.length;i++){if(!tmpMinValue){tmpMinValue=this.parsePrecise(pValueSet[i],NaN);}else{let tmpComparisonValue=this.parsePrecise(pValueSet[i],NaN);if(!isNaN(tmpComparisonValue)&&this.ltPrecise(tmpComparisonValue,tmpMinValue)){tmpMinValue=tmpComparisonValue;}}}}else if(typeof pValueSet==='object'){let tmpKeys=Object.keys(pValueSet);for(let i=0;i<tmpKeys.length;i++){if(!tmpMinValue){tmpMinValue=this.parsePrecise(pValueSet[tmpKeys[i]],NaN);}else{let tmpComparisonValue=this.parsePrecise(pValueSet[tmpKeys[i]],NaN);if(!isNaN(tmpComparisonValue)&&this.ltPrecise(tmpComparisonValue,tmpMinValue)){tmpMinValue=tmpComparisonValue;}}}}return tmpMinValue;}/**
|
|
4328
4366
|
* Calculates the precise sum of values in the given value set.
|
|
4329
|
-
*
|
|
4367
|
+
*
|
|
4330
4368
|
* @param {Array|Object} pValueSet - The value set to calculate the sum from.
|
|
4331
4369
|
* @returns {string} The precise sum value as a string.
|
|
4332
4370
|
*/sumPrecise(pValueSet){let tmpSumValue="0.0";if(Array.isArray(pValueSet)){for(let i=0;i<pValueSet.length;i++){let tmpComparisonValue=this.parsePrecise(pValueSet[i],NaN);if(!isNaN(tmpComparisonValue)){tmpSumValue=this.addPrecise(tmpSumValue,tmpComparisonValue);}}}else if(typeof pValueSet==='object'){let tmpKeys=Object.keys(pValueSet);for(let i=0;i<tmpKeys.length;i++){let tmpComparisonValue=this.parsePrecise(pValueSet[tmpKeys[i]],NaN);if(!isNaN(tmpComparisonValue)){tmpSumValue=this.addPrecise(tmpSumValue,tmpComparisonValue);}}}return tmpSumValue;}/**
|
|
@@ -4349,11 +4387,66 @@ if(tmpCount==0){return'0.0';}let tmpSortedValueSet=this.sortSetPrecise(pValueSet
|
|
|
4349
4387
|
if(tmpCount%2==1){return tmpSortedValueSet[tmpMiddleElement];}// If the count is even, return the average of the two middle elements
|
|
4350
4388
|
else{let tmpLeftMiddleValue=tmpSortedValueSet[tmpMiddleElement-1];let tmpRightMiddleValue=tmpSortedValueSet[tmpMiddleElement];return this.dividePrecise(this.addPrecise(tmpLeftMiddleValue,tmpRightMiddleValue),2);}}/**
|
|
4351
4389
|
* Calculates the mode (most frequently occurring value) of a given value set using precise mode calculation.
|
|
4352
|
-
*
|
|
4390
|
+
*
|
|
4353
4391
|
* @param {Array} pValueSet - The array of values to calculate the mode from.
|
|
4354
4392
|
* @returns {Array} - An array containing the mode value(s) from the given value set.
|
|
4355
4393
|
*/modePrecise(pValueSet){let tmpHistogram=this.bucketSetPrecise(pValueSet);let tmpMaxCount=0;// Philosophical question about whether the values should be returned sorted.
|
|
4356
|
-
let tmpHistogramValueSet=Object.keys(tmpHistogram);let tmpModeValueSet=[];for(let i=0;i<tmpHistogramValueSet.length;i++){if(tmpHistogram[tmpHistogramValueSet[i]]>tmpMaxCount){tmpMaxCount=tmpHistogram[tmpHistogramValueSet[i]];tmpModeValueSet=[tmpHistogramValueSet[i]];}else if(tmpHistogram[tmpHistogramValueSet[i]]==tmpMaxCount){tmpModeValueSet.push(tmpHistogramValueSet[i]);}}return tmpModeValueSet;}
|
|
4394
|
+
let tmpHistogramValueSet=Object.keys(tmpHistogram);let tmpModeValueSet=[];for(let i=0;i<tmpHistogramValueSet.length;i++){if(tmpHistogram[tmpHistogramValueSet[i]]>tmpMaxCount){tmpMaxCount=tmpHistogram[tmpHistogramValueSet[i]];tmpModeValueSet=[tmpHistogramValueSet[i]];}else if(tmpHistogram[tmpHistogramValueSet[i]]==tmpMaxCount){tmpModeValueSet.push(tmpHistogramValueSet[i]);}}return tmpModeValueSet;}/**
|
|
4395
|
+
* Performs an nth degree polynomial regression on the given data points.
|
|
4396
|
+
*
|
|
4397
|
+
* @param {Array<number|string>} pXVector - The x-coordinates of the data points.
|
|
4398
|
+
* @param {Array<number|string>} pYVector - The y-coordinates of the data points.
|
|
4399
|
+
* @param {number} [pDegree=2] - The degree of the polynomial to fit.
|
|
4400
|
+
*
|
|
4401
|
+
* @return {Array<number|string>} The coefficients of the fitted polynomial, starting from the constant term.
|
|
4402
|
+
*/polynomialRegression(pXVector,pYVector){let pDegree=arguments.length>2&&arguments[2]!==undefined?arguments[2]:2;const n=pDegree;const tmpXMatrix=[];const tmpYVector=pYVector;// Build Vandermonde matrix
|
|
4403
|
+
for(let i=0;i<pXVector.length;++i){const row=[];for(let j=0;j<=n;j++){row.push(this.powerPrecise(pXVector[i],j));}tmpXMatrix.push(row);}// Compute coefficients
|
|
4404
|
+
const X_T=this.matrixTranspose(tmpXMatrix);const XTX=this.matrixMultiply(X_T,tmpXMatrix);const XTY=this.matrixMultiply(X_T,tmpYVector.map(v=>[v]));const XTX_inv=this.matrixInverse(XTX);const A=this.matrixMultiply(XTX_inv,XTY);// Flatten coefficients
|
|
4405
|
+
return A.map(row=>row[0]);}/**
|
|
4406
|
+
* Compute least squares regression coefficients for multivariable linear interpolation.
|
|
4407
|
+
*
|
|
4408
|
+
* @param {Array<Array<number|string>> | Array<number|string>} pIndependentVariableVectors - array of arrays [[x11, x12, ...], [x21, x22, ...], ...] or single array for single variable.
|
|
4409
|
+
* @param {Array<number|string>} pDependentVariableVector - array of target values [y1, y2, ...]
|
|
4410
|
+
*
|
|
4411
|
+
* @return {Array<number|string>} - linear coefficients [b0, b1, ..., bn] where y = b0 + b1*x1 + b2*x2 + ... + bn*xn
|
|
4412
|
+
*/leastSquares(pIndependentVariableVectors,pDependentVariableVector){const tmpIndependentVariableVectors=Array.isArray(pIndependentVariableVectors[0])?pIndependentVariableVectors:pIndependentVariableVectors.map(value=>[value]);// Add bias term (intercept)
|
|
4413
|
+
const tmpIndependentVariableMatrixWithBiasTerm=tmpIndependentVariableVectors.map(row=>[1,...row]);// Compute X^T * X
|
|
4414
|
+
const tmpIndependentTermTranpose=this.matrixTranspose(tmpIndependentVariableMatrixWithBiasTerm);const tmpDependentTransposeMultiplication=this.matrixMultiply(tmpIndependentTermTranpose,tmpIndependentVariableMatrixWithBiasTerm);// Compute X^T * y
|
|
4415
|
+
const tmpIndependentTransposeMultiplication=this.matrixVectorMultiply(tmpIndependentTermTranpose,pDependentVariableVector);// Solve (XtX) * beta = Xty
|
|
4416
|
+
const tmpLinearCoefficients=this.gaussianElimination(tmpDependentTransposeMultiplication,tmpIndependentTransposeMultiplication);return tmpLinearCoefficients;}/**
|
|
4417
|
+
* Helper function to transpose a matrix
|
|
4418
|
+
*
|
|
4419
|
+
* @param {Array<Array<number|string>>} pInputMatrix - matrix to transpose
|
|
4420
|
+
*
|
|
4421
|
+
* @return {Array<Array<number|string>>} - transposed matrix
|
|
4422
|
+
*/matrixTranspose(pInputMatrix){return pInputMatrix[0].map((_,i)=>pInputMatrix.map(row=>row[i]));}matrixMultiply(pLHSMatrix,pRHSMatrix){const result=Array(pLHSMatrix.length).fill(0).map(()=>Array(pRHSMatrix[0].length).fill(0));for(let i=0;i<pLHSMatrix.length;++i){for(let j=0;j<pRHSMatrix[0].length;++j){for(let k=0;k<pRHSMatrix.length;++k){result[i][j]=this.addPrecise(result[i][j],this.multiplyPrecise(pLHSMatrix[i][k],pRHSMatrix[k][j]));}}}return result;}/**
|
|
4423
|
+
* @param {Array<Array<number|string>>} pMatrix - matrix to multiply
|
|
4424
|
+
* @param {Array<number|string>} pVector - vector to multiply
|
|
4425
|
+
*
|
|
4426
|
+
* @return {Array<number|string>} - result vector
|
|
4427
|
+
*/matrixVectorMultiply(pMatrix,pVector){const result=Array(pMatrix.length).fill(0);for(let i=0;i<pMatrix.length;++i){for(let j=0;j<pMatrix[0].length;++j){result[i]=this.addPrecise(result[i],this.multiplyPrecise(pMatrix[i][j],pVector[j]));}}return result;}/**
|
|
4428
|
+
* Matrix inverse (using Gaussian elimination)
|
|
4429
|
+
*
|
|
4430
|
+
* @param {Array<Array<number|string>>} pMatrix - matrix to invert
|
|
4431
|
+
*
|
|
4432
|
+
* @return {Array<Array<number|string>>} - inverted matrix
|
|
4433
|
+
*/matrixInverse(pMatrix){const n=pMatrix.length;const tmpIdentityMatrix=pMatrix.map((row,i)=>row.map((_,j)=>i===j?1:0));const tmpAugmentedMatrix=pMatrix.map((row,i)=>row.concat(tmpIdentityMatrix[i]));for(let i=0;i<n;++i){// Pivot
|
|
4434
|
+
let maxRow=i;for(let k=i+1;k<n;++k){if(this.gtPrecise(this.absPrecise(tmpAugmentedMatrix[k][i]),this.absPrecise(tmpAugmentedMatrix[maxRow][i]))){maxRow=k;}}[tmpAugmentedMatrix[i],tmpAugmentedMatrix[maxRow]]=[tmpAugmentedMatrix[maxRow],tmpAugmentedMatrix[i]];// divide by pivot
|
|
4435
|
+
const tmpPivotValue=tmpAugmentedMatrix[i][i];for(let j=0;j<2*n;++j){tmpAugmentedMatrix[i][j]=this.dividePrecise(tmpAugmentedMatrix[i][j],tmpPivotValue);}// Eliminate other rows
|
|
4436
|
+
for(let k=0;k<n;++k){if(k===i){continue;}const tmpFactor=tmpAugmentedMatrix[k][i];for(let j=0;j<2*n;++j){tmpAugmentedMatrix[k][j]=this.subtractPrecise(tmpAugmentedMatrix[k][j],this.multiplyPrecise(tmpFactor,tmpAugmentedMatrix[i][j]));}}}// Extract right half (inverse)
|
|
4437
|
+
return tmpAugmentedMatrix.map(row=>row.slice(n));}/**
|
|
4438
|
+
* Compute solution to linear system using Gaussian elimination.
|
|
4439
|
+
*
|
|
4440
|
+
* @param {Array<Array<number|string>>} pCoefficientMatrix - Coefficient matrix
|
|
4441
|
+
* @param {Array<number|string>} pVector - Right-hand side vector
|
|
4442
|
+
*
|
|
4443
|
+
* @return {Array<number|string>} - Solution vector x
|
|
4444
|
+
*/gaussianElimination(pCoefficientMatrix,pVector){// Solve A*x = b using Gaussian elimination
|
|
4445
|
+
const n=pCoefficientMatrix.length;const tmpAugmentedMatrix=pCoefficientMatrix.map((row,i)=>[...row,pVector[i]]);for(let i=0;i<n;++i){// Pivot
|
|
4446
|
+
let maxRow=i;for(let k=i+1;k<n;++k){if(this.gtPrecise(this.absPrecise(tmpAugmentedMatrix[k][i]),this.absPrecise(tmpAugmentedMatrix[maxRow][i]))){maxRow=k;}}const tmpSwapValue=tmpAugmentedMatrix[i];tmpAugmentedMatrix[i]=tmpAugmentedMatrix[maxRow];tmpAugmentedMatrix[maxRow]=tmpSwapValue;// Normalize pivot row
|
|
4447
|
+
const tmpPivotValue=tmpAugmentedMatrix[i][i];if(this.comparePrecise(tmpPivotValue,0)==0){throw new Error('Matrix not invertible');}for(let j=i;j<=n;++j){tmpAugmentedMatrix[i][j]=this.dividePrecise(tmpAugmentedMatrix[i][j],tmpPivotValue);}// Eliminate other rows
|
|
4448
|
+
for(let k=0;k<n;++k){if(k===i){continue;}const tmpFactor=tmpAugmentedMatrix[k][i];for(let j=i;j<=n;++j){tmpAugmentedMatrix[k][j]=this.subtractPrecise(tmpAugmentedMatrix[k][j],this.multiplyPrecise(tmpFactor,tmpAugmentedMatrix[i][j]));}}}// Extract solution
|
|
4449
|
+
return tmpAugmentedMatrix.map(row=>row[n]);}}module.exports=FableServiceMath;},{"./Fable-SetConcatArray.js":183,"fable-serviceproviderbase":59}],172:[function(require,module,exports){const libFableServiceBase=require('fable-serviceproviderbase');/**
|
|
4357
4450
|
* Precedent Meta-Templating
|
|
4358
4451
|
* @author Steven Velozo <steven@velozo.com>
|
|
4359
4452
|
* @description Process text stream trie and postfix tree, parsing out meta-template expression functions.
|
|
@@ -4367,7 +4460,7 @@ let tmpHistogramValueSet=Object.keys(tmpHistogram);let tmpModeValueSet=[];for(le
|
|
|
4367
4460
|
* @param {any} [pScope] - A sticky scope that can be used to carry state and simplify template
|
|
4368
4461
|
* @param {any} [pState] - A catchall state object for plumbing data through template processing.
|
|
4369
4462
|
* @return {string} The result from the parser
|
|
4370
|
-
*/parseString(pString,pData,fCallback,pDataContext,pScope,pState){if(this.LogNoisiness>4){this.fable.log.trace(`Metatemplate parsing template string [${pString}] where the callback is a ${typeof fCallback}`,{TemplateData:pData});}return this.StringParser.parseString(pString,this.ParseTree,pData,fCallback,pDataContext,pScope,pState);}}module.exports=FableServiceMetaTemplate;},{"./Fable-Service-MetaTemplate/MetaTemplate-StringParser.js":
|
|
4463
|
+
*/parseString(pString,pData,fCallback,pDataContext,pScope,pState){if(this.LogNoisiness>4){this.fable.log.trace(`Metatemplate parsing template string [${pString}] where the callback is a ${typeof fCallback}`,{TemplateData:pData});}return this.StringParser.parseString(pString,this.ParseTree,pData,fCallback,pDataContext,pScope,pState);}}module.exports=FableServiceMetaTemplate;},{"./Fable-Service-MetaTemplate/MetaTemplate-StringParser.js":173,"./Fable-Service-MetaTemplate/MetaTemplate-WordTree.js":174,"fable-serviceproviderbase":59}],173:[function(require,module,exports){/**
|
|
4371
4464
|
* String Parser
|
|
4372
4465
|
* @author Steven Velozo <steven@velozo.com>
|
|
4373
4466
|
* @description Parse a string, properly processing each matched token in the word tree.
|
|
@@ -4469,7 +4562,7 @@ return fCallback();}/**
|
|
|
4469
4562
|
let tmpPreviousDataContext=Array.isArray(pDataContext)?pDataContext:[];let tmpDataContext=Array.from(tmpPreviousDataContext);tmpDataContext.push(pData);if(typeof fCallback!=='function'){let tmpParserState=this.newParserState(pParseTree);for(var i=0;i<pString.length;i++){// TODO: This is not fast.
|
|
4470
4563
|
this.parseCharacter(pString[i],tmpParserState,pData,tmpDataContext,pScope,pState);}this.flushOutputBuffer(tmpParserState);return tmpParserState.Output;}else{// This is the async mode
|
|
4471
4564
|
let tmpParserState=this.newParserState(pParseTree);tmpParserState.Asynchronous=true;let tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');for(let i=0;i<pString.length;i++){tmpAnticipate.anticipate(fCallback=>{this.parseCharacterAsync(pString[i],tmpParserState,pData,fCallback,tmpDataContext,pScope,pState);});}tmpAnticipate.wait(pError=>{// Flush the remaining data
|
|
4472
|
-
this.flushOutputBuffer(tmpParserState);return fCallback(pError,tmpParserState.Output);});}}}module.exports=StringParser;},{}],
|
|
4565
|
+
this.flushOutputBuffer(tmpParserState);return fCallback(pError,tmpParserState.Output);});}}}module.exports=StringParser;},{}],174:[function(require,module,exports){/**
|
|
4473
4566
|
* Word Tree
|
|
4474
4567
|
* @author Steven Velozo <steven@velozo.com>
|
|
4475
4568
|
* @description Create a tree (directed graph) of Javascript objects, one character per object.
|
|
@@ -4505,11 +4598,11 @@ if(pParserContext){tmpLeaf.ParserContext=pParserContext;}tmpLeaf.isAsync=true;re
|
|
|
4505
4598
|
* @param {string} pPatternEnd - The ending string for the pattern (e.g. "}")
|
|
4506
4599
|
* @param {function} fParser - The function to parse if this is the matched pattern, once the Pattern End is met. If this is a string, a simple replacement occurs.
|
|
4507
4600
|
* @param {Object} pParserContext - The context to pass to the parser function
|
|
4508
|
-
*/addPattern(pPatternStart,pPatternEnd,fParser,pParserContext){return this.addPatternBoth(pPatternStart,pPatternEnd,fParser,null,pParserContext);}}module.exports=WordTree;},{}],
|
|
4601
|
+
*/addPattern(pPatternStart,pPatternEnd,fParser,pParserContext){return this.addPatternBoth(pPatternStart,pPatternEnd,fParser,null,pParserContext);}}module.exports=WordTree;},{}],175:[function(require,module,exports){module.exports={"Metadata":{"UUID":false,"Hash":false,"Name":"","Summary":"","Version":0},"Status":{"Completed":false,"StepCount":1},"Steps":[],"Errors":[],"Log":[]};},{}],176:[function(require,module,exports){const{PE}=require('big.js');const libFableServiceBase=require('fable-serviceproviderbase');const _OperationStatePrototypeString=JSON.stringify(require('./Fable-Service-Operation-DefaultSettings.js'));class FableOperation extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);// Timestamps will just be the long ints
|
|
4509
4602
|
this.timeStamps={};this.serviceType='PhasedOperation';this.state=JSON.parse(_OperationStatePrototypeString);this.stepMap={};this.stepFunctions={};// Match the service instantiation to the operation.
|
|
4510
4603
|
this.state.Metadata.Hash=this.Hash;this.state.Metadata.UUID=this.UUID;this.state.Metadata.Name=typeof this.options.Name=='string'?this.options.Name:`Unnamed Operation ${this.state.Metadata.UUID}`;this.name=this.state.Metadata.Name;this.progressTrackerSet=this.fable.instantiateServiceProviderWithoutRegistration('ProgressTrackerSet');this.state.OverallProgressTracker=this.progressTrackerSet.createProgressTracker(`Overall-${this.state.Metadata.UUID}`);// This is here to use the pass-through logging functions in the operation itself.
|
|
4511
4604
|
this.log=this;}execute(fExecutionCompleteCallback){// TODO: Should the same operation be allowed to execute more than one time?
|
|
4512
|
-
if(this.state.OverallProgressTracker.StartTimeStamp>0){return fExecutionCompleteCallback(new Error(`Operation [${this.state.Metadata.UUID}] ${this.state.Metadata.Name} has already been executed!`));}let tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');this.progressTrackerSet.setProgressTrackerTotalOperations(this.state.OverallProgressTracker.Hash,this.state.Status.StepCount);this.progressTrackerSet.startProgressTracker(this.state.OverallProgressTracker.Hash);this.info(`Operation [${this.state.Metadata.UUID}] ${this.state.Metadata.Name} starting...`);for(let i=0;i<this.state.Steps.length;i++){tmpAnticipate.anticipate(function(fNext){this.fable.log.info(`Step #${i} [${this.state.Steps[i].GUIDStep}] ${this.state.Steps[i].Name} starting...`);this.progressTrackerSet.startProgressTracker(this.state.Steps[i].ProgressTracker.Hash);return fNext();}.bind(this));// Steps are executed in a custom context with
|
|
4605
|
+
if(this.state.OverallProgressTracker.StartTimeStamp>0){return fExecutionCompleteCallback(new Error(`Operation [${this.state.Metadata.UUID}] ${this.state.Metadata.Name} has already been executed!`));}let tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');this.progressTrackerSet.setProgressTrackerTotalOperations(this.state.OverallProgressTracker.Hash,this.state.Status.StepCount);this.progressTrackerSet.startProgressTracker(this.state.OverallProgressTracker.Hash);this.info(`Operation [${this.state.Metadata.UUID}] ${this.state.Metadata.Name} starting...`);for(let i=0;i<this.state.Steps.length;i++){tmpAnticipate.anticipate(function(fNext){this.fable.log.info(`Step #${i} [${this.state.Steps[i].GUIDStep}] ${this.state.Steps[i].Name} starting...`);this.progressTrackerSet.startProgressTracker(this.state.Steps[i].ProgressTracker.Hash);return fNext();}.bind(this));// Steps are executed in a custom context with
|
|
4513
4606
|
tmpAnticipate.anticipate(this.stepFunctions[this.state.Steps[i].GUIDStep].bind({log:this,fable:this.fable,options:this.state.Steps[i].Metadata,metadata:this.state.Steps[i].Metadata,ProgressTracker:this.progressTrackerSet.getProgressTracker(this.state.Steps[i].ProgressTracker.Hash),logProgressTrackerStatus:function(){return this.log.info(`Step #${i} [${this.state.Steps[i].GUIDStep}]: ${this.progressTrackerSet.getProgressTrackerStatusString(this.state.Steps[i].ProgressTracker.Hash)}`);}.bind(this),OperationState:this.state,StepState:this.state.Steps[i]}));tmpAnticipate.anticipate(function(fNext){this.progressTrackerSet.endProgressTracker(this.state.Steps[i].ProgressTracker.Hash);let tmpStepTimingMessage=this.progressTrackerSet.getProgressTrackerStatusString(this.state.Steps[i].ProgressTracker.Hash);this.fable.log.info(`Step #${i} [${this.state.Steps[i].GUIDStep}] ${this.state.Steps[i].Name} complete.`);this.fable.log.info(`Step #${i} [${this.state.Steps[i].GUIDStep}] ${this.state.Steps[i].Name} ${tmpStepTimingMessage}.`);this.progressTrackerSet.incrementProgressTracker(this.state.OverallProgressTracker.Hash,1);let tmpOperationTimingMessage=this.progressTrackerSet.getProgressTrackerStatusString(this.state.OverallProgressTracker.Hash);this.fable.log.info(`Operation [${this.state.Metadata.UUID}] ${tmpOperationTimingMessage}.`);return fNext();}.bind(this));}// Wait for the anticipation to complete
|
|
4514
4607
|
tmpAnticipate.wait(pError=>{if(pError){this.fable.log.error(`Operation [${this.state.Metadata.UUID}] ${this.state.Metadata.Name} had an error: ${pError}`,pError);return fExecutionCompleteCallback(pError);}this.info(`Operation [${this.state.Metadata.UUID}] ${this.state.Metadata.Name} complete.`);let tmpOperationTimingMessage=this.progressTrackerSet.getProgressTrackerStatusString(this.state.OverallProgressTracker.Hash);this.progressTrackerSet.endProgressTracker(this.state.OverallProgressTracker.Hash);this.fable.log.info(`Operation [${this.state.Metadata.UUID}] ${tmpOperationTimingMessage}.`);return fExecutionCompleteCallback();});}// There are three ways to add steps:
|
|
4515
4608
|
// 1. As a basic javascript function
|
|
@@ -4520,9 +4613,9 @@ tmpAnticipate.wait(pError=>{if(pError){this.fable.log.error(`Operation [${this.s
|
|
|
4520
4613
|
addStep(fStepFunction,pStepMetadata,pStepName,pStepDescription,pGUIDStep){let tmpStep={};// GUID is optional
|
|
4521
4614
|
tmpStep.GUIDStep=typeof pGUIDStep!=='undefined'?pGUIDStep:`STEP-${this.state.Steps.length}-${this.fable.DataGeneration.randomNumericString()}`;// Name is optional
|
|
4522
4615
|
tmpStep.Name=typeof pStepName!=='undefined'?pStepName:`Step [${tmpStep.GUIDStep}]`;tmpStep.Description=typeof pStepDescription!=='undefined'?pStepDescription:`Step execution of ${tmpStep.Name}.`;tmpStep.ProgressTracker=this.progressTrackerSet.createProgressTracker(tmpStep.GUIDStep);tmpStep.Metadata=typeof pStepMetadata==='object'?pStepMetadata:{};// There is an array of steps, in the Operation State itself ... push a step there
|
|
4523
|
-
this.state.Steps.push(tmpStep);this.stepMap[tmpStep.GUIDStep]=tmpStep;this.stepFunctions[tmpStep.GUIDStep]=typeof fStepFunction=='function'?fStepFunction:function(fDone){return fDone();};this.state.Status.StepCount++;return tmpStep;}setStepTotalOperations(pGUIDStep,pTotalOperationCount){if(!(pGUIDStep in this.stepMap)){return new Error(`Step [${pGUIDStep}] does not exist in operation [${this.state.Metadata.UUID}] ${this.state.Metadata.Name} when attempting to set total operations to ${pTotalOperationCount}.`);}this.progressTrackerSet.setProgressTrackerTotalOperations(this.stepMap[pGUIDStep].ProgressTracker.Hash,pTotalOperationCount);}writeOperationLog(pLogLevel,pLogText,pLogObject){this.state.Log.push(`[${new Date().toUTCString()}]-[${pLogLevel}]: ${pLogText}`);if(typeof pLogObject=='object'){this.state.Log.push(JSON.stringify(pLogObject));}}writeOperationErrors(pLogText,pLogObject){this.state.Errors.push(`${pLogText}`);if(typeof pLogObject=='object'){this.state.Errors.push(JSON.stringify(pLogObject));}}trace(pLogText,pLogObject){this.writeOperationLog('TRACE',pLogText,pLogObject);this.fable.log.trace(pLogText,pLogObject);}debug(pLogText,pLogObject){this.writeOperationLog('DEBUG',pLogText,pLogObject);this.fable.log.debug(pLogText,pLogObject);}info(pLogText,pLogObject){this.writeOperationLog('INFO',pLogText,pLogObject);this.fable.log.info(pLogText,pLogObject);}warn(pLogText,pLogObject){this.writeOperationLog('WARN',pLogText,pLogObject);this.fable.log.warn(pLogText,pLogObject);}error(pLogText,pLogObject){this.writeOperationLog('ERROR',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.error(pLogText,pLogObject);}fatal(pLogText,pLogObject){this.writeOperationLog('FATAL',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.fatal(pLogText,pLogObject);}}module.exports=FableOperation;},{"./Fable-Service-Operation-DefaultSettings.js":
|
|
4616
|
+
this.state.Steps.push(tmpStep);this.stepMap[tmpStep.GUIDStep]=tmpStep;this.stepFunctions[tmpStep.GUIDStep]=typeof fStepFunction=='function'?fStepFunction:function(fDone){return fDone();};this.state.Status.StepCount++;return tmpStep;}setStepTotalOperations(pGUIDStep,pTotalOperationCount){if(!(pGUIDStep in this.stepMap)){return new Error(`Step [${pGUIDStep}] does not exist in operation [${this.state.Metadata.UUID}] ${this.state.Metadata.Name} when attempting to set total operations to ${pTotalOperationCount}.`);}this.progressTrackerSet.setProgressTrackerTotalOperations(this.stepMap[pGUIDStep].ProgressTracker.Hash,pTotalOperationCount);}writeOperationLog(pLogLevel,pLogText,pLogObject){this.state.Log.push(`[${new Date().toUTCString()}]-[${pLogLevel}]: ${pLogText}`);if(typeof pLogObject=='object'){this.state.Log.push(JSON.stringify(pLogObject));}}writeOperationErrors(pLogText,pLogObject){this.state.Errors.push(`${pLogText}`);if(typeof pLogObject=='object'){this.state.Errors.push(JSON.stringify(pLogObject));}}trace(pLogText,pLogObject){this.writeOperationLog('TRACE',pLogText,pLogObject);this.fable.log.trace(pLogText,pLogObject);}debug(pLogText,pLogObject){this.writeOperationLog('DEBUG',pLogText,pLogObject);this.fable.log.debug(pLogText,pLogObject);}info(pLogText,pLogObject){this.writeOperationLog('INFO',pLogText,pLogObject);this.fable.log.info(pLogText,pLogObject);}warn(pLogText,pLogObject){this.writeOperationLog('WARN',pLogText,pLogObject);this.fable.log.warn(pLogText,pLogObject);}error(pLogText,pLogObject){this.writeOperationLog('ERROR',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.error(pLogText,pLogObject);}fatal(pLogText,pLogObject){this.writeOperationLog('FATAL',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.fatal(pLogText,pLogObject);}}module.exports=FableOperation;},{"./Fable-Service-Operation-DefaultSettings.js":175,"big.js":17,"fable-serviceproviderbase":59}],177:[function(require,module,exports){const libFableServiceBase=require('fable-serviceproviderbase');class FableServiceProgressTime extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='ProgressTime';this.timeStamps={};}formatTimeDuration(pTimeDurationInMilliseconds){let tmpTimeDuration=typeof pTimeDurationInMilliseconds=='number'?pTimeDurationInMilliseconds:0;if(pTimeDurationInMilliseconds<0){return'unknown';}let tmpTimeDurationString='';if(tmpTimeDuration>3600000){tmpTimeDurationString+=Math.floor(tmpTimeDuration/3600000)+'h ';tmpTimeDuration=tmpTimeDuration%3600000;}if(tmpTimeDuration>60000){tmpTimeDurationString+=Math.floor(tmpTimeDuration/60000)+'m ';tmpTimeDuration=tmpTimeDuration%60000;}if(tmpTimeDuration>1000){tmpTimeDurationString+=Math.floor(tmpTimeDuration/1000)+'s ';tmpTimeDuration=tmpTimeDuration%1000;}tmpTimeDurationString+=Math.round(tmpTimeDuration)+'ms';return tmpTimeDurationString;}createTimeStamp(pTimeStampHash){let tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';this.timeStamps[tmpTimeStampHash]=+new Date();return this.timeStamps[tmpTimeStampHash];}getTimeStampValue(pTimeStampHash){let tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';return tmpTimeStampHash in this.timeStamps?this.timeStamps[tmpTimeStampHash]:-1;}updateTimeStampValue(pTimeStampHash,pReferenceTime){let tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';let tmpReferenceTime=false;// This function allows the user to pass in either a reference time in ms, or, a hash of a timestamp.
|
|
4524
4617
|
if(typeof pReferenceTime=='string'){tmpReferenceTime=tmpReference in this.timeStamps?this.timeStamps[tmpReference]:false;}else if(typeof pReferenceTime=='number'){tmpReferenceTime=pReferenceTime;}else{tmpReferenceTime=+new Date();}if(tmpTimeStampHash in this.timeStamps&&tmpReferenceTime){this.timeStamps[tmpTimeStampHash]=tmpReferenceTime;return this.timeStamps[tmpTimeStampHash];}else{return-1;}}removeTimeStamp(pTimeStampHash){let tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';if(tmpTimeStampHash in this.timeStamps){delete this.timeStamps[tmpTimeStampHash];return true;}else{return false;}}getTimeStampDelta(pTimeStampHash,pReferenceTime){let tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';let tmpReferenceTime=false;// This function allows the user to pass in either a reference time in ms, or, a hash of a timestamp.
|
|
4525
|
-
if(typeof pReferenceTime=='string'){tmpReferenceTime=tmpReference in this.timeStamps?this.timeStamps[tmpReference]:false;}else if(typeof pReferenceTime=='number'){tmpReferenceTime=pReferenceTime;}else{tmpReferenceTime=+new Date();}if(tmpTimeStampHash in this.timeStamps&&tmpReferenceTime){return tmpReferenceTime-this.timeStamps[tmpTimeStampHash];}else{return-1;}}getDurationBetweenTimestamps(pTimeStampHashStart,pTimeStampHashEnd){let tmpTimeStampHashStart=typeof pTimeStampHashStart=='string'?pTimeStampHashStart:'Default';let tmpTimeStampHashEnd=typeof pTimeStampHashEnd=='string'?pTimeStampHashEnd:'Default';if(tmpTimeStampHashStart in this.timeStamps&&tmpTimeStampHashEnd in this.timeStamps){return this.timeStamps[tmpTimeStampHashEnd]-this.timeStamps[tmpTimeStampHashStart];}else{return-1;}}getTimeStampDeltaMessage(pTimeStampHash,pMessage,pReferenceTime){let tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';let tmpMessage=typeof pMessage!=='undefined'?pMessage:`Elapsed for ${tmpTimeStampHash}: `;let tmpOperationTime=this.getTimeStampDelta(tmpTimeStampHash,pReferenceTime);return`${tmpMessage} ${this.formatTimeDuration(tmpOperationTime)}`;}logTimeStampDelta(pTimeStampHash,pMessage,pReferenceTime){this.fable.log.info(this.getTimeStampDeltaMessage(pTimeStampHash,pMessage,pReferenceTime));}}module.exports=FableServiceProgressTime;},{"fable-serviceproviderbase":
|
|
4618
|
+
if(typeof pReferenceTime=='string'){tmpReferenceTime=tmpReference in this.timeStamps?this.timeStamps[tmpReference]:false;}else if(typeof pReferenceTime=='number'){tmpReferenceTime=pReferenceTime;}else{tmpReferenceTime=+new Date();}if(tmpTimeStampHash in this.timeStamps&&tmpReferenceTime){return tmpReferenceTime-this.timeStamps[tmpTimeStampHash];}else{return-1;}}getDurationBetweenTimestamps(pTimeStampHashStart,pTimeStampHashEnd){let tmpTimeStampHashStart=typeof pTimeStampHashStart=='string'?pTimeStampHashStart:'Default';let tmpTimeStampHashEnd=typeof pTimeStampHashEnd=='string'?pTimeStampHashEnd:'Default';if(tmpTimeStampHashStart in this.timeStamps&&tmpTimeStampHashEnd in this.timeStamps){return this.timeStamps[tmpTimeStampHashEnd]-this.timeStamps[tmpTimeStampHashStart];}else{return-1;}}getTimeStampDeltaMessage(pTimeStampHash,pMessage,pReferenceTime){let tmpTimeStampHash=typeof pTimeStampHash=='string'?pTimeStampHash:'Default';let tmpMessage=typeof pMessage!=='undefined'?pMessage:`Elapsed for ${tmpTimeStampHash}: `;let tmpOperationTime=this.getTimeStampDelta(tmpTimeStampHash,pReferenceTime);return`${tmpMessage} ${this.formatTimeDuration(tmpOperationTime)}`;}logTimeStampDelta(pTimeStampHash,pMessage,pReferenceTime){this.fable.log.info(this.getTimeStampDeltaMessage(pTimeStampHash,pMessage,pReferenceTime));}}module.exports=FableServiceProgressTime;},{"fable-serviceproviderbase":59}],178:[function(require,module,exports){class ProgressTracker{constructor(pProgressTrackerSet,pProgressTrackerHash){this.progressTrackerSet=pProgressTrackerSet;this.progressTrackerHash=pProgressTrackerHash;this.data=this.progressTrackerSet.getProgressTrackerData(this.progressTrackerHash);}updateProgressTracker(pProgressAmount){return this.progressTrackerSet.updateProgressTracker(this.progressTrackerHash,pProgressAmount);}incrementProgressTracker(pProgressIncrementAmount){return this.progressTrackerSet.incrementProgressTracker(this.progressTrackerHash,pProgressIncrementAmount);}setProgressTrackerTotalOperations(pTotalOperationCount){return this.progressTrackerSet.setProgressTrackerTotalOperations(this.progressTrackerHash,pTotalOperationCount);}getProgressTrackerStatusString(){return this.progressTrackerSet.getProgressTrackerStatusString(this.progressTrackerHash);}}module.exports=ProgressTracker;},{}],179:[function(require,module,exports){const libFableServiceBase=require('fable-serviceproviderbase');const libProgressTrackerClass=require('./Fable-Service-ProgressTracker/ProgressTracker.js');class FableServiceProgressTrackerSet extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='ProgressTrackerSet';this.progressTrackers={};// Create an internal PorgressTime service to track timestamps
|
|
4526
4619
|
this.progressTimes=this.fable.instantiateServiceProviderWithoutRegistration('ProgressTime');// This timestamp is used and updated by *all* progress trackers.
|
|
4527
4620
|
this.progressTimes.createTimeStamp('CurrentTime');}getProgressTracker(pProgressTrackerHash){let tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';if(!(tmpProgressTrackerHash in this.progressTrackers)){this.fable.log.warn(`ProgressTracker ${tmpProgressTrackerHash} does not exist! Creating a new tracker...`);this.createProgressTracker(tmpProgressTrackerHash,100);}return new libProgressTrackerClass(this,pProgressTrackerHash);}getProgressTrackerData(pProgressTrackerHash){let tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';if(!(tmpProgressTrackerHash in this.progressTrackers)){this.fable.log.warn(`ProgressTracker ${tmpProgressTrackerHash} does not exist! Creating a new tracker...`);this.createProgressTracker(tmpProgressTrackerHash,100);}return this.progressTrackers[tmpProgressTrackerHash];}createProgressTracker(pProgressTrackerHash,pTotalOperations){let tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';let tmpTotalOperations=typeof pTotalOperations=='number'?pTotalOperations:100;let tmpProgressTracker={Hash:tmpProgressTrackerHash,StartTimeHash:`${tmpProgressTrackerHash}-Start`,StartTimeStamp:-1,CurrentTimeStamp:-1,EndTimeHash:`${tmpProgressTrackerHash}-End`,EndTimeStamp:-1,PercentComplete:-1,// If this is set to true, PercentComplete will be calculated as CurrentCount / TotalCount even if it goes over 100%
|
|
4528
4621
|
AllowTruePercentComplete:false,ElapsedTime:-1,AverageOperationTime:-1,EstimatedCompletionTime:-1,TotalCount:tmpTotalOperations,CurrentCount:-1};if(tmpProgressTrackerHash in this.progressTrackers){this.fable.log.warn(`ProgressTracker ${tmpProgressTrackerHash} already exists! Overwriting with a new tracker...`);this.progressTimes.removeTimeStamp(tmpProgressTracker.StartTimeHash);this.progressTimes.removeTimeStamp(tmpProgressTracker.EndTimeHash);}this.progressTrackers[tmpProgressTrackerHash]=tmpProgressTracker;return tmpProgressTracker;}setProgressTrackerTotalOperations(pProgressTrackerHash,pTotalOperations){let tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';let tmpTotalOperations=typeof pTotalOperations=='number'?pTotalOperations:100;if(!(tmpProgressTrackerHash in this.progressTrackers)){this.fable.log.warn(`Attempted to set the total operations of ProgressTracker ${tmpProgressTrackerHash} but it does not exist! Creating a new tracker...`);this.createProgressTracker(tmpProgressTrackerHash,tmpTotalOperations);}this.progressTrackers[tmpProgressTrackerHash].TotalCount=tmpTotalOperations;return this.progressTrackers[tmpProgressTrackerHash];}startProgressTracker(pProgressTrackerHash){let tmpProgressTrackerHash=typeof pProgressTrackerHash=='string'?pProgressTrackerHash:'Default';// This is the only method to lazily create ProgressTrackers now
|
|
@@ -4545,7 +4638,7 @@ this.solveProgressTrackerStatus(tmpProgressTrackerHash);if(!(tmpProgressTrackerH
|
|
|
4545
4638
|
if(tmpProgressTracker.StartTimeStamp<1){return`ProgressTracker ${tmpProgressTracker.Hash} has not been started yet.`;}// 2. Started, but no operations completed
|
|
4546
4639
|
if(tmpProgressTracker.CurrentCount<1&&tmpProgressTracker.EndTimeStamp<1){return`ProgressTracker ${tmpProgressTracker.Hash} has no completed operations. ${this.progressTimes.formatTimeDuration(tmpProgressTracker.ElapsedTime)} have elapsed since it was started.`;}// 3. Started, some operations completed
|
|
4547
4640
|
else if(tmpProgressTracker.EndTimeStamp<1){return`ProgressTracker ${tmpProgressTracker.Hash} is ${tmpProgressTracker.PercentComplete.toFixed(3)}% completed - ${tmpProgressTracker.CurrentCount} / ${tmpProgressTracker.TotalCount} operations over ${this.progressTimes.formatTimeDuration(tmpProgressTracker.ElapsedTime)} (median ${this.progressTimes.formatTimeDuration(tmpProgressTracker.AverageOperationTime)} per). Estimated completion: ${this.progressTimes.formatTimeDuration(tmpProgressTracker.EstimatedCompletionTime)}`;}// 4. Done
|
|
4548
|
-
else{return`ProgressTracker ${tmpProgressTracker.Hash} is done. ${tmpProgressTracker.CurrentCount} / ${tmpProgressTracker.TotalCount} operations were completed in ${this.progressTimes.formatTimeDuration(tmpProgressTracker.ElapsedTime)} (median ${this.progressTimes.formatTimeDuration(tmpProgressTracker.AverageOperationTime)} per).`;}}}logProgressTrackerStatus(pProgressTrackerHash){this.fable.log.info(this.getProgressTrackerStatusString(pProgressTrackerHash));}}module.exports=FableServiceProgressTrackerSet;},{"./Fable-Service-ProgressTracker/ProgressTracker.js":
|
|
4641
|
+
else{return`ProgressTracker ${tmpProgressTracker.Hash} is done. ${tmpProgressTracker.CurrentCount} / ${tmpProgressTracker.TotalCount} operations were completed in ${this.progressTimes.formatTimeDuration(tmpProgressTracker.ElapsedTime)} (median ${this.progressTimes.formatTimeDuration(tmpProgressTracker.AverageOperationTime)} per).`;}}}logProgressTrackerStatus(pProgressTrackerHash){this.fable.log.info(this.getProgressTrackerStatusString(pProgressTrackerHash));}}module.exports=FableServiceProgressTrackerSet;},{"./Fable-Service-ProgressTracker/ProgressTracker.js":178,"fable-serviceproviderbase":59}],180:[function(require,module,exports){(function(Buffer){(function(){const libFableServiceBase=require('fable-serviceproviderbase');const libSimpleGet=require('simple-get');const libCookie=require('cookie');class FableServiceRestClient extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.TraceLog=false;if(this.options.TraceLog||this.fable.TraceLog){this.TraceLog=true;}this.dataFormat=this.fable.services.DataFormat;this.serviceType='RestClient';this.cookie=false;// This is a function that can be overridden, to allow the management
|
|
4549
4642
|
// of the request options before they are passed to the request library.
|
|
4550
4643
|
this.prepareRequestOptions=pOptions=>{return pOptions;};}get simpleGet(){return libSimpleGet;}prepareCookies(pRequestOptions){if(this.cookie){let tmpCookieObject=this.cookie;if(!('headers'in pRequestOptions)){pRequestOptions.headers={};}let tmpCookieKeys=Object.keys(tmpCookieObject);if(tmpCookieKeys.length>0){// Only grab the first for now.
|
|
4551
4644
|
pRequestOptions.headers.cookie=libCookie.serialize(tmpCookieKeys[0],tmpCookieObject[tmpCookieKeys[0]]);}}return pRequestOptions;}preRequest(pOptions){// Validate the options object
|
|
@@ -4558,7 +4651,7 @@ if(!tmpDataBuffer){tmpDataBuffer=Buffer.from(pChunk);}else{tmpDataBuffer=Buffer.
|
|
|
4558
4651
|
{
|
|
4559
4652
|
tmpOptions.headers['Content-Type'] = 'application/json';
|
|
4560
4653
|
}
|
|
4561
|
-
*/tmpOptions.RequestStartTime=this.fable.log.getTimeStamp();if(this.TraceLog){this.fable.log.debug(`Beginning ${tmpOptions.method} JSON request to ${tmpOptions.url} at ${tmpOptions.RequestStartTime}`);}return libSimpleGet(tmpOptions,(pError,pResponse)=>{if(pError){return fCallback(pError,pResponse);}if(this.TraceLog){let tmpConnectTime=this.fable.log.getTimeStamp();this.fable.log.debug(`--> JSON ${tmpOptions.method} connected in ${this.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpConnectTime)}ms code ${pResponse.statusCode}`);}let tmpJSONData='';pResponse.on('data',pChunk=>{if(this.TraceLog){let tmpChunkTime=this.fable.log.getTimeStamp();this.fable.log.debug(`--> JSON ${tmpOptions.method} data chunk size ${pChunk.length}b received in ${this.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime)}ms`);}tmpJSONData+=pChunk;});pResponse.on('end',()=>{if(this.TraceLog){let tmpCompletionTime=this.fable.log.getTimeStamp();this.fable.log.debug(`==> JSON ${tmpOptions.method} completed - received in ${this.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime)}ms`);}return fCallback(pError,pResponse,JSON.parse(tmpJSONData));});});}getJSON(pOptionsOrURL,fCallback){let tmpRequestOptions=typeof pOptionsOrURL=='object'?pOptionsOrURL:{};if(typeof pOptionsOrURL=='string'){tmpRequestOptions.url=pOptionsOrURL;}tmpRequestOptions.method='GET';return this.executeJSONRequest(tmpRequestOptions,fCallback);}putJSON(pOptions,fCallback){if(typeof pOptions.body!='object'){return fCallback(new Error(`PUT JSON Error Invalid options object`));}pOptions.method='PUT';return this.executeJSONRequest(pOptions,fCallback);}postJSON(pOptions,fCallback){if(typeof pOptions.body!='object'){return fCallback(new Error(`POST JSON Error Invalid options object`));}pOptions.method='POST';return this.executeJSONRequest(pOptions,fCallback);}patchJSON(pOptions,fCallback){if(typeof pOptions.body!='object'){return fCallback(new Error(`PATCH JSON Error Invalid options object`));}pOptions.method='PATCH';return this.executeJSONRequest(pOptions,fCallback);}headJSON(pOptions,fCallback){if(typeof pOptions.body!='object'){return fCallback(new Error(`HEAD JSON Error Invalid options object`));}pOptions.method='HEAD';return this.executeJSONRequest(pOptions,fCallback);}delJSON(pOptions,fCallback){pOptions.method='DELETE';return this.executeJSONRequest(pOptions,fCallback);}getRawText(pOptionsOrURL,fCallback){let tmpRequestOptions=typeof pOptionsOrURL=='object'?pOptionsOrURL:{};if(typeof pOptionsOrURL=='string'){tmpRequestOptions.url=pOptionsOrURL;}tmpRequestOptions.method='GET';return this.executeChunkedRequest(tmpRequestOptions,fCallback);}}module.exports=FableServiceRestClient;}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":20,"cookie":
|
|
4654
|
+
*/tmpOptions.RequestStartTime=this.fable.log.getTimeStamp();if(this.TraceLog){this.fable.log.debug(`Beginning ${tmpOptions.method} JSON request to ${tmpOptions.url} at ${tmpOptions.RequestStartTime}`);}return libSimpleGet(tmpOptions,(pError,pResponse)=>{if(pError){return fCallback(pError,pResponse);}if(this.TraceLog){let tmpConnectTime=this.fable.log.getTimeStamp();this.fable.log.debug(`--> JSON ${tmpOptions.method} connected in ${this.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpConnectTime)}ms code ${pResponse.statusCode}`);}let tmpJSONData='';pResponse.on('data',pChunk=>{if(this.TraceLog){let tmpChunkTime=this.fable.log.getTimeStamp();this.fable.log.debug(`--> JSON ${tmpOptions.method} data chunk size ${pChunk.length}b received in ${this.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime)}ms`);}tmpJSONData+=pChunk;});pResponse.on('end',()=>{if(this.TraceLog){let tmpCompletionTime=this.fable.log.getTimeStamp();this.fable.log.debug(`==> JSON ${tmpOptions.method} completed - received in ${this.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime)}ms`);}return fCallback(pError,pResponse,JSON.parse(tmpJSONData));});});}getJSON(pOptionsOrURL,fCallback){let tmpRequestOptions=typeof pOptionsOrURL=='object'?pOptionsOrURL:{};if(typeof pOptionsOrURL=='string'){tmpRequestOptions.url=pOptionsOrURL;}tmpRequestOptions.method='GET';return this.executeJSONRequest(tmpRequestOptions,fCallback);}putJSON(pOptions,fCallback){if(typeof pOptions.body!='object'){return fCallback(new Error(`PUT JSON Error Invalid options object`));}pOptions.method='PUT';return this.executeJSONRequest(pOptions,fCallback);}postJSON(pOptions,fCallback){if(typeof pOptions.body!='object'){return fCallback(new Error(`POST JSON Error Invalid options object`));}pOptions.method='POST';return this.executeJSONRequest(pOptions,fCallback);}patchJSON(pOptions,fCallback){if(typeof pOptions.body!='object'){return fCallback(new Error(`PATCH JSON Error Invalid options object`));}pOptions.method='PATCH';return this.executeJSONRequest(pOptions,fCallback);}headJSON(pOptions,fCallback){if(typeof pOptions.body!='object'){return fCallback(new Error(`HEAD JSON Error Invalid options object`));}pOptions.method='HEAD';return this.executeJSONRequest(pOptions,fCallback);}delJSON(pOptions,fCallback){pOptions.method='DELETE';return this.executeJSONRequest(pOptions,fCallback);}getRawText(pOptionsOrURL,fCallback){let tmpRequestOptions=typeof pOptionsOrURL=='object'?pOptionsOrURL:{};if(typeof pOptionsOrURL=='string'){tmpRequestOptions.url=pOptionsOrURL;}tmpRequestOptions.method='GET';return this.executeChunkedRequest(tmpRequestOptions,fCallback);}}module.exports=FableServiceRestClient;}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":20,"cookie":31,"fable-serviceproviderbase":59,"simple-get":123}],181:[function(require,module,exports){const libFableServiceBase=require('fable-serviceproviderbase');class FableServiceTemplate extends libFableServiceBase{// Underscore and lodash have a behavior, _.template, which compiles a
|
|
4562
4655
|
// string-based template with code snippets into simple executable pieces,
|
|
4563
4656
|
// with the added twist of returning a precompiled function ready to go.
|
|
4564
4657
|
//
|
|
@@ -4578,7 +4671,7 @@ this.renderFunction=false;this.templateString=false;}renderTemplate(pData){retur
|
|
|
4578
4671
|
// underscore code until this is rewritten using precedent.
|
|
4579
4672
|
this.TemplateSource="__p+='"+pTemplateText.replace(this.Matchers.Escaper,pMatch=>{return`\\${this.templateEscapes[pMatch]}`;}).replace(this.Matchers.Interpolate||this.Matchers.GuaranteedNonMatch,(pMatch,pCode)=>{return`'+\n(${decodeURIComponent(pCode)})+\n'`;}).replace(this.Matchers.Evaluate||this.Matchers.GuaranteedNonMatch,(pMatch,pCode)=>{return`';\n${decodeURIComponent(pCode)}\n;__p+='`;})+`';\n`;this.TemplateSource=`with(pTemplateDataObject||{}){\n${this.TemplateSource}}\n`;this.TemplateSource=`var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n${this.TemplateSource}return __p;\n`;this.renderFunction=new Function('pTemplateDataObject',this.TemplateSource);if(typeof pData!='undefined'){return this.renderFunction(pData);}// Provide the compiled function source as a convenience for build time
|
|
4580
4673
|
// precompilation.
|
|
4581
|
-
this.TemplateSourceCompiled='function(obj){\n'+this.TemplateSource+'}';return this.templateFunction();}}module.exports=FableServiceTemplate;},{"fable-serviceproviderbase":
|
|
4674
|
+
this.TemplateSourceCompiled='function(obj){\n'+this.TemplateSource+'}';return this.templateFunction();}}module.exports=FableServiceTemplate;},{"fable-serviceproviderbase":59}],182:[function(require,module,exports){const libFableServiceBase=require('fable-serviceproviderbase');// TODO: These are still pretty big -- consider the smaller polyfills
|
|
4582
4675
|
const libAsyncWaterfall=require('async.waterfall');const libAsyncEachLimit=require('async.eachlimit');const libBigNumber=require('big.js');class FableServiceUtility extends libFableServiceBase{// Underscore and lodash have a behavior, _.template, which compiles a
|
|
4583
4676
|
// string-based template with code snippets into simple executable pieces,
|
|
4584
4677
|
// with the added twist of returning a precompiled function ready to go.
|
|
@@ -4662,7 +4755,7 @@ if(!this.manifest){this.manifest=this.fable.newManyfest();}// If it doesn't exis
|
|
|
4662
4755
|
if(!this.manifest.checkAddressExists(pObject,pValueAddress)){return true;}// Get the value from the internal manifest and return it
|
|
4663
4756
|
let tmpValue=this.manifest.getValueByHash(pObject,pValueAddress);if(tmpValue===null||tmpValue===''){return true;}return false;}// Convert objects to arrays of labels or values for solvers
|
|
4664
4757
|
objectKeysToArray(pObject){return Object.keys(pObject);}// Convert object values to an array of values
|
|
4665
|
-
objectValuesToArray(pObject){let tmpKeys=Object.keys(pObject);let tmpValues=[];for(let i=0;i<tmpKeys.length;i++){tmpValues.push(pObject[tmpKeys[i]]);}return tmpValues;}objectValuesSortByExternalArray(pArray,pObjectArray,pDescending,pSearchAddress){let tmpDescending=typeof pDescending=='boolean'?pDescending:typeof pDescending=='number'&&pDescending==1?true:typeof pDescending=='string'&&pDescending=='1'?true:false;let tmpManifest=this.fable.newManyfest();let tmpSearchAddresses=pSearchAddress;if(typeof tmpSearchAddresses!='string'){// Defaulting to "label"...
|
|
4758
|
+
objectValuesToArray(pObject){if(typeof pObject!=='object'||pObject===null){return[];}let tmpKeys=Object.keys(pObject);let tmpValues=[];for(let i=0;i<tmpKeys.length;i++){tmpValues.push(pObject[tmpKeys[i]]);}return tmpValues;}objectValuesSortByExternalArray(pArray,pObjectArray,pDescending,pSearchAddress){let tmpDescending=typeof pDescending=='boolean'?pDescending:typeof pDescending=='number'&&pDescending==1?true:typeof pDescending=='string'&&pDescending=='1'?true:false;let tmpManifest=this.fable.newManyfest();let tmpSearchAddresses=pSearchAddress;if(typeof tmpSearchAddresses!='string'){// Defaulting to "label"...
|
|
4666
4759
|
tmpSearchAddresses='label';}let tmpSortHelperArray=[];for(let i=0;i<pArray.length;i++){tmpSortHelperArray.push({Value:pArray[i],SortValue:tmpManifest.getValueByHash(pObjectArray[i],tmpSearchAddresses),SortObject:pObjectArray[i]});}let tmpSortedArray=tmpSortHelperArray.sort((pLeft,pRight)=>{if(pLeft.SortValue<pRight.SortValue){return tmpDescending?1:-1;}if(pLeft.SortValue>pRight.SortValue){return tmpDescending?-1:1;}return 0;}).map(pSortHelperArrayObject=>{return pSortHelperArrayObject.Value;});return tmpSortedArray;}// Convert an ISO string to a javascript date object
|
|
4667
4760
|
// Adapted from https://stackoverflow.com/a/54751179
|
|
4668
4761
|
//
|
|
@@ -4712,11 +4805,14 @@ if(!this.manifest){this.manifest=this.fable.newManyfest();}if(typeof pFableAddre
|
|
|
4712
4805
|
* @param {Array<any>} pInputArray - The array of inputs to flatten
|
|
4713
4806
|
* @return {Array<any>} - The flattened array
|
|
4714
4807
|
*/flattenArrayOfSolverInputs(pInputArray){if(!Array.isArray(pInputArray)){if(typeof pInputArray==='object'){pInputArray=Object.values(pInputArray);}if(!pInputArray){return[];}}const tmpArrayFlattener=p=>{if(Array.isArray(p)){return p;// .flatMap(tmpArrayFlattener);
|
|
4715
|
-
}if(typeof p==='object'){return Object.values(p);}return[p];};return pInputArray.flatMap(tmpArrayFlattener);}
|
|
4808
|
+
}if(typeof p==='object'){return Object.values(p);}return[p];};return pInputArray.flatMap(tmpArrayFlattener);}generateArrayOfObjectsFromSets(){// For each argument pair, map data to an array of objects with the first parameter of the pairs as the property name and the second parameter as the array of values
|
|
4809
|
+
let tmpResultArray=[];if(arguments.length%2!=0){// Must be pairs
|
|
4810
|
+
return tmpResultArray;}let tmpPropertyNames=[];let tmpValueArrays=[];for(let i=0;i<arguments.length;i+=2){tmpPropertyNames.push(arguments[i]);tmpValueArrays.push(this.objectValuesToArray(arguments[i+1]));}for(let h=0;h<tmpValueArrays.length;h++){let tmpValueArray=tmpValueArrays[h];let tmpPropertyName=tmpPropertyNames[h];if(!Array.isArray(tmpValueArray)){continue;}for(let i=0;i<tmpValueArray.length;i++){if(tmpResultArray.length<=i){tmpResultArray.push({});}let tmpObject=tmpResultArray[i];if(!tmpObject){// This shouldn't be possible
|
|
4811
|
+
continue;}tmpObject[tmpPropertyName]=tmpValueArray[i];}}return tmpResultArray;}/**
|
|
4716
4812
|
* Take a set of arbitrary parameters and build an array from them
|
|
4717
4813
|
* @returns {Array} - An array built from the absolute values of the parameters
|
|
4718
|
-
*/createArrayFromAbsoluteValues(){let tmpArray=[];for(let i=0;i<arguments.length;i++){tmpArray.push(arguments[i]);}return tmpArray;}}module.exports=FableServiceUtility;},{"async.eachlimit":1,"async.waterfall":15,"big.js":17,"fable-serviceproviderbase":
|
|
4814
|
+
*/createArrayFromAbsoluteValues(){let tmpArray=[];for(let i=0;i<arguments.length;i++){tmpArray.push(arguments[i]);}return tmpArray;}}module.exports=FableServiceUtility;},{"async.eachlimit":1,"async.waterfall":15,"big.js":17,"fable-serviceproviderbase":59}],183:[function(require,module,exports){class SetConcatArray{/**
|
|
4719
4815
|
* @param {Array<any>|SetConcatArray} pLeftValue - The left value to concatenate.
|
|
4720
4816
|
* @param {Array<any>|SetConcatArray} pRightValue - The right value to concatenate.
|
|
4721
|
-
*/constructor(pLeftValue,pRightValue){if(pLeftValue instanceof SetConcatArray){this.values=pLeftValue.values.concat([pRightValue]);}else if(pRightValue instanceof SetConcatArray){this.values=[pLeftValue].concat(pRightValue.values);}else{this.values=[pLeftValue,pRightValue];}}}module.exports=SetConcatArray;},{}]},{},[
|
|
4817
|
+
*/constructor(pLeftValue,pRightValue){if(pLeftValue instanceof SetConcatArray){this.values=pLeftValue.values.concat([pRightValue]);}else if(pRightValue instanceof SetConcatArray){this.values=[pLeftValue].concat(pRightValue.values);}else{this.values=[pLeftValue,pRightValue];}}}module.exports=SetConcatArray;},{}]},{},[150])(150);});
|
|
4722
4818
|
//# sourceMappingURL=fable.js.map
|