UNPKG

@yashkk3640/expression-evaluation

Version:
1,459 lines (1,352 loc) 69.7 kB
/*! * * @yashkk3640/expression-evaluation v0.0.3 * https://github.com/yashkk3640/expression-evaluation * * Copyright (c) Yash Khatri (https://github.com/yashkk3640) and project contributors. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["ExpressionEvaluation"] = factory(); else root["ExpressionEvaluation"] = factory(); })(self, function() { return /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 16: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "TIME_ZONE": () => (/* binding */ TIME_ZONE), /* harmony export */ "DEFAULT_DATE_FORMAT": () => (/* binding */ DEFAULT_DATE_FORMAT) /* harmony export */ }); var TIME_ZONE = "America/New_York"; var DEFAULT_DATE_FORMAT = "YYYY-MM-DDTHH:mm:ss"; /***/ }), /***/ 310: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "EXPRESSION_TABLE": () => (/* binding */ EXPRESSION_TABLE) /* harmony export */ }); var dayjs = __webpack_require__(484); var _require = __webpack_require__(16), TIME_ZONE = _require.TIME_ZONE; var EXPRESSION_TABLE = [{ key: "arithmetic", data: { call: "Arithmetic Functions" }, children: [{ key: "ADD", data: { call: "ADD(Number1,Number2)", desc: "Summation of two input numbers", example: "ADD(3,2) => 5", noOfArgs: 2 } }, { key: "SUB", data: { call: "SUB(Number1,Number2)", desc: "Subtraction of two input numbers", example: "SUB(3,2) => 1", noOfArgs: 2 } }, { key: "MUL", data: { call: "MUL(Number1,Number2)", desc: "Multiplication of two input numbers", example: "MUL(3,2) => 6", noOfArgs: 2 } }, { key: "DIV", data: { call: "DIV(Number1,Number2)", desc: "Division of two input numbers", example: "DIV(10,2) => 5", noOfArgs: 2 } }] }, { key: "relational", data: { call: "Relational Functions" }, children: [{ key: "EQ", data: { call: "EQ(Input1,Input2)", desc: "Returns TRUE if Input 1 is equal to Input 2, else returns FALSE", example: "EQ(3,3) => true", noOfArgs: 2 } }, { key: "NEQ", data: { call: "NEQ(Input1,Input2)", desc: "Returns TRUE if Input 1 is not equal to Input 2, else returns FALSE", example: "NEQ(3,3) => false", noOfArgs: 2 } }, { key: "GT", data: { call: "GT(Input1,Input2)", desc: "Returns TRUE if Input 1 is greater than Input 2, else returns FALSE", example: "GT(3,2) => true", noOfArgs: 2 } }, { key: "GTE", data: { call: "GTE(Input1,Input2)", desc: "Returns TRUE if Input 1 is greater than or equal to Input 2, else returns FALSE", example: "GTE(3,2) => true", noOfArgs: 2 } }, { key: "LT", data: { call: "LT(Input1,Input2)", desc: "Returns TRUE if Input 1 is less than Input 2, else returns FALSE", example: "LT(3,2) => false", noOfArgs: 2 } }, { key: "LTE", data: { call: "LTE(Input1,Input2)", desc: "Returns TRUE if Input 1 is less than or equal to Input 2, else returns FALSE", example: "LTE(3,2) => false", noOfArgs: 2 } }] }, { key: "logical", data: { call: "Logical Functions" }, children: [{ key: "AND", data: { call: "AND(Condition1,Condition2)", desc: "Returns TRUE if Condition1 and Condition2 are TRUE, else returns FALSE", example: "AND(true,false) => false", noOfArgs: 2 } }, { key: "OR", data: { call: "OR(Condition1,Condition2)", desc: "Returns TRUE if Condition1 or Condition2 is TRUE, else returns FALSE", example: "OR(true,false) => true", noOfArgs: 2 } }, { key: "NOT", data: { call: "NOT(Condition)", desc: "Returns the Opposite of provided Condition", example: "NOT(true) => false", noOfArgs: 1 } }, { key: "TRUE", data: { call: "TRUE()", desc: "Returns TRUE always (Has no inputs)", example: "TRUE() => true", noOfArgs: 0 } }] }, { key: "date", data: { call: "Date Functions" }, children: [{ key: "DATE_GT", data: { call: "DATE_GT(Date1,Date2)", desc: "Returns TRUE if Is Date1 greater than Date2, else returns FALSE", example: "DATE_GT(today,today) => false", noOfArgs: 2 } }, { key: "DATE_GTE", data: { call: "DATE_GTE(Date1,Date2)", desc: "Returns TRUE if Is Date1 greater than or equal to Date2, else returns FALSE", example: "DATE_GTE(today,yesterday) => true", noOfArgs: 2 } }, { key: "DATE_LT", data: { call: "DATE_LT(Date1,Date2)", desc: "Returns TRUE if Is Date1 less than Date2, else returns FALSE", example: "DATE_LT(yesterday,yesterday) => false", noOfArgs: 2 } }, { key: "DATE_LTE", data: { call: "DATE_LTE(Date1,Date2)", desc: "Returns TRUE if Is Date1 less than or equal to Date2, else returns FALSE", example: "DATE_LTE(yesterday,yesterday) => true", noOfArgs: 2 } }, { key: "ADD_IN_DATE", data: { call: "ADD_IN_DATE(InputDate,Number,UnitType)", desc: "Returns a Date that is the result of InputDate + Number of Units (you can use years, quarters, months, weeks, days, hours and minutes)", example: "ADD_IN_DATE(yesterday,1,days) => today", noOfArgs: 3 } }, { key: "NOW", data: { call: "NOW()", desc: "Returns a Current Datetime", example: "NOW() => ".concat(dayjs().tz(TIME_ZONE).format()), noOfArgs: 0 } }, { key: "DATE_FORMAT", data: { call: "DATE_FORMAT(InputDate,Format)", desc: "Return Date in specified format", example: "DATE_FORMAT(02-12-2021,MM/DD/YYYY) => 02/12/2021", noOfArgs: 2 } }] }, { key: "condition", data: { call: "Condition Function" }, children: [{ key: "IF_ELSE", data: { call: "IF_ELSE(Condition1,True_Result,False_Result)", desc: "Returns True_Result if Condition1 is TRUE, else returns False_Result. Condition1 must result in a Boolean and True_Result and False_Result values can be boolean,numeric, or text", example: "IF_ELSE(true,4,3) => 4", noOfArgs: 3 } }, { key: "NOT_EMPTY", data: { call: "NOT_EMPTY(variable)", desc: "Returns TRUE if variable is not null (not empty)", example: "NOT_EMPTY(varWithoutValue) => false", noOfArgs: 1 } }, { key: "EMPTY", data: { call: "EMPTY(variable)", desc: "Returns TRUE if variable is null (empty)", example: "EMPTY(varWithoutValue) => true", noOfArgs: 1 } }] }, { key: "string", data: { call: "String Function" }, children: [{ key: "CONCAT", data: { call: "CONCAT(String1,String2)", desc: "Results in a string that is a combination of String1 and String2", example: "CONCAT(fname,lname) => fnamelname", noOfArgs: 2 } }, { key: "UPPERCASE", data: { call: "UPPERCASE(String)", desc: "Results in a string that is all uppercase letters", example: "UPPERCASE(ticketNumber) => TICKETNUMBER", noOfArgs: 1 } }, { key: "LOWERCASE", data: { call: "LOWERCASE(String)", desc: "Results in a string that is all lowercase letters", example: "LOWERCASE(ticketNumber) => ticketnumber", noOfArgs: 1 } }, { key: "CONTAINS", data: { call: "CONTAINS(String1,String2)", desc: "Returns TRUE if String2 is present in String1, or else FALSE", example: "CONTAINS(ticket number,ticket) => true", noOfArgs: 2 } }, { key: "CAMEL_TO_TITLE", data: { call: "CAMEL_TO_TITLE(String)", desc: "Results in a string that in Title Case", example: "CAMEL_TO_TITLE(ticketNumber) => Ticket Number", noOfArgs: 1 } }] }, { key: "push", data: { call: "PUSH", desc: "Add element in Array", example: "PUSH(array,3) => [(all element array),3]", noOfArgs: 2 } }, { key: "special", data: { call: "Special Function" }, children: [{ key: "sum", data: { call: "SUM", desc: "Sum of Elements separated by ':' or Sum of property from Array by '::'", example: "SUM($$array$$::propertyName)", noOfArgs: 1 } }] }]; // const Documentation = () => ( // <table className="expression-table"> // <thead> // <th style={{ width: "20%" }}>Function</th> // <th style={{ width: "40%" }}>Description</th> // <th style={{ width: "20%" }}>Example</th> // <th style={{ width: "8%" }}>No of Arguments</th> // </thead> // <tbody> // {EXPRESSION_TABLE.map(({ key, data, children }) => ( // <React.Fragment key={key}> // <tr key={key}> // <th style={{ textAlign: "left", paddingLeft: "50px" }} colSpan={4}> // {data.call} // </th> // </tr> // {children.map(({ key, data }) => ( // <tr key={key}> // <td>{data.call}</td> // <td>{data.desc}</td> // <td>{data.example}</td> // <td>{data.noOfArgs}</td> // </tr> // ))} // </React.Fragment> // ))} // </tbody> // </table> // ); // export default Documentation; /***/ }), /***/ 332: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "ADD": () => (/* binding */ ADD), /* harmony export */ "SUB": () => (/* binding */ SUB), /* harmony export */ "MUL": () => (/* binding */ MUL), /* harmony export */ "DIV": () => (/* binding */ DIV), /* harmony export */ "EQ": () => (/* binding */ EQ), /* harmony export */ "NEQ": () => (/* binding */ NEQ), /* harmony export */ "GT": () => (/* binding */ GT), /* harmony export */ "GTE": () => (/* binding */ GTE), /* harmony export */ "LT": () => (/* binding */ LT), /* harmony export */ "LTE": () => (/* binding */ LTE), /* harmony export */ "CONTAINS": () => (/* binding */ CONTAINS), /* harmony export */ "AND": () => (/* binding */ AND), /* harmony export */ "OR": () => (/* binding */ OR), /* harmony export */ "NOT": () => (/* binding */ NOT), /* harmony export */ "TRUE": () => (/* binding */ TRUE), /* harmony export */ "IF_ELSE": () => (/* binding */ IF_ELSE), /* harmony export */ "CONCAT": () => (/* binding */ CONCAT), /* harmony export */ "UPPERCASE": () => (/* binding */ UPPERCASE), /* harmony export */ "LOWERCASE": () => (/* binding */ LOWERCASE), /* harmony export */ "CAMEL_TO_TITLE": () => (/* binding */ CAMEL_TO_TITLE), /* harmony export */ "DATE_GT": () => (/* binding */ DATE_GT), /* harmony export */ "DATE_GTE": () => (/* binding */ DATE_GTE), /* harmony export */ "DATE_LT": () => (/* binding */ DATE_LT), /* harmony export */ "DATE_LTE": () => (/* binding */ DATE_LTE), /* harmony export */ "ADD_IN_DATE": () => (/* binding */ ADD_IN_DATE), /* harmony export */ "NOW": () => (/* binding */ NOW), /* harmony export */ "DATE_FORMAT": () => (/* binding */ DATE_FORMAT), /* harmony export */ "NOT_EMPTY": () => (/* binding */ NOT_EMPTY), /* harmony export */ "EMPTY": () => (/* binding */ EMPTY), /* harmony export */ "PUSH": () => (/* binding */ PUSH), /* harmony export */ "SUM": () => (/* binding */ SUM) /* harmony export */ }); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } var dayjs = __webpack_require__(484); var _require = __webpack_require__(16), DEFAULT_DATE_FORMAT = _require.DEFAULT_DATE_FORMAT, TIME_ZONE = _require.TIME_ZONE; var getBoolean = function getBoolean(strBool) { return strBool.trim().toLowerCase() === "true" ? true : strBool.trim().toLowerCase() === "false" ? false : undefined; }; var CHECK_ARRAY = function CHECK_ARRAY(arr) { return Array.isArray(arr) && arr.length > 0 && !arr.some(function (a) { return a == null || typeof a === "string" && a === "" || _typeof(a) === "object" && JSON.stringify(a) === JSON.stringify({}); }); }; var ADD = { compute: function compute(args1, args2) { return Number(args1) + Number(args2); }, name: "Addition", noOfArgs: 2 }; var SUB = { compute: function compute(args1, args2) { return Number(args1) - Number(args2); }, name: "Subtraction", noOfArgs: 2 }; var MUL = { compute: function compute(args1, args2) { return Number(args1) * Number(args2); }, name: "Multiplication", noOfArgs: 2 }; var DIV = { compute: function compute(args1, args2) { return Number(args1) / Number(args2); }, name: "Division", noOfArgs: 2 }; var EQ = { compute: function compute(args1, args2) { return args1 === args2; }, name: "Equal", noOfArgs: 2 }; var NEQ = { compute: function compute(args1, args2) { return args1 !== args2; }, name: "Not Equal", noOfArgs: 2 }; var GT = { compute: function compute(args1, args2) { return Number(args1) > Number(args2); }, name: "Greater Than", noOfArgs: 2 }; var GTE = { compute: function compute(args1, args2) { return Number(args1) >= Number(args2); }, name: "Greater Than or Equal", noOfArgs: 2 }; var LT = { compute: function compute(args1, args2) { return Number(args1) < Number(args2); }, name: "Less Than", noOfArgs: 2 }; var LTE = { compute: function compute(args1, args2) { return Number(args1) <= Number(args2); }, name: "Less Than or Equal", noOfArgs: 2 }; var CONTAINS = { compute: function compute() { var args1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; var args2 = arguments.length > 1 ? arguments[1] : undefined; return args2 && String(args1).includes(String(args2)); }, name: "Contains", noOfArgs: 2 }; var AND = { compute: function compute(args1, args2) { return getBoolean(args1) && getBoolean(args2); }, name: "Logical AND (&&)", noOfArgs: 2 }; var OR = { compute: function compute(args1, args2) { return getBoolean(args1) || getBoolean(args2); }, name: "Logical OR (||)", noOfArgs: 2 }; var NOT = { compute: function compute(args1) { return !getBoolean(args1); }, name: "Logical NOT (!)", noOfArgs: 1 }; var TRUE = { compute: function compute() { return true; }, name: "Always Returns True", noOfArgs: 0 }; var IF_ELSE = { compute: function compute(args1, args2, args3) { return getBoolean(args1) ? args2 : args3; }, name: "If Else", noOfArgs: 3 }; var CONCAT = { compute: function compute(args1, args2) { return args1 + args2; }, name: "Concatenation", noOfArgs: 2 }; var UPPERCASE = { compute: function compute(arg) { return arg.toUpperCase(); }, name: "Uppercase", noOfArgs: 1 }; var LOWERCASE = { compute: function compute(arg) { return arg.toLowerCase(); }, name: "Lowercase", noOfArgs: 1 }; var CAMEL_TO_TITLE = { compute: function compute(arg) { return arg.replace(/(?!^[A-Z])([A-Z])/g, function (match) { return " ".concat(match); }) // ([A-Z]) .replace(/^./, function (match) { return match.toUpperCase(); }); }, noOfArgs: 1 }; var DATE_GT = { compute: function compute(args1, args2) { return dayjs(args1).isAfter(dayjs(args2)); }, name: "Date Greater Than", noOfArgs: 2 }; var DATE_GTE = { compute: function compute(args1, args2) { return dayjs(args1).isSameOrAfter(dayjs(args2)); }, name: "Date Greater Than or Equal", noOfArgs: 2 }; var DATE_LT = { compute: function compute(args1, args2) { return dayjs(args1).isBefore(dayjs(args2)); }, name: "Date Less Than", noOfArgs: 2 }; var DATE_LTE = { compute: function compute(args1, args2) { return dayjs(args1).isSameOrBefore(dayjs(args2)); }, name: "Date Less Than or Equal", noOfArgs: 2 }; var ADD_IN_DATE = { compute: function compute(args1, args2, args3) { return dayjs.tz(args1, TIME_ZONE).add(Number(args2), args3).clone().format(DEFAULT_DATE_FORMAT); }, name: "Add days in Date", noOfArgs: 3 }; var NOW = { compute: function compute() { return dayjs().tz(TIME_ZONE).format(DEFAULT_DATE_FORMAT); }, name: "Current Date time", noOfArgs: 0 }; var DATE_FORMAT = { compute: function compute(dt, format) { return dt ? dayjs.tz(dt, TIME_ZONE).format(format) : dt; }, noOfArgs: 2 }; var NOT_EMPTY = { compute: function compute(arg) { return arg != null ? arg.includes("[") ? CHECK_ARRAY(JSON.parse(arg)) : arg !== "" : false; }, name: "Not Empty", noOfArgs: 1 }; var EMPTY = { compute: function compute(arg) { return !NOT_EMPTY.compute(arg); }, name: "Empty", noOfArgs: 1 }; var PUSH = { compute: function compute(arg1, arg2) { var value = arg2; try { value = JSON.parse(arg2); } catch (e) { console.warn("skipping JSON parsing as got invalid JSON"); } return arg1 == null || arg1 === "" ? [value] : JSON.parse(arg1).concat(value); }, noOfArgs: 2 }; var SUM = { compute: function compute(arg) { // data should be loaded for :: (state of array) if (typeof arg === "string" && arg.includes(":")) { var indexOfDC = arg.indexOf("::"); // string should have "::" sequentially and it should be starts with "[{" as it's array call var isArrayCall = indexOfDC > -1 && arg.startsWith("[{"); var propName = isArrayCall ? arg.slice(indexOfDC + 2) : ""; var jsonArray = isArrayCall && JSON.parse(arg.substring(0, indexOfDC)); var array = Array.isArray(jsonArray) ? jsonArray : arg.split(":"); var sum = array.reduce(function (acc, a) { return acc + (isArrayCall ? Number(a[propName] || 0) : Number(a || 0)); }, 0); return +sum.toFixed(4); } return 0; }, name: "Sum of Column", // name: 'Sum or Column or Array prop', noOfArgs: 1 }; /***/ }), /***/ 484: /***/ (function(module) { !function(t,e){ true?module.exports=e():0}(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})); /***/ }), /***/ 212: /***/ (function(module) { !function(e,t){ true?module.exports=t():0}(this,(function(){"use strict";return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)}}})); /***/ }), /***/ 412: /***/ (function(module) { !function(e,i){ true?module.exports=i():0}(this,(function(){"use strict";return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)}}})); /***/ }), /***/ 387: /***/ (function(module) { !function(t,e){ true?module.exports=e():0}(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}}})); /***/ }), /***/ 178: /***/ (function(module) { !function(t,i){ true?module.exports=i():0}(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 o=u.parse;u.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),o.call(this,t)};var r=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 r.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,o=this;if(f)return o.$offset=u,o.$u=0===s,o;if(0!==s){var r=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(o=this.local().add(u+r,t)).$offset=u,o.$x.$localOffset=r}else o=this.utc();return o};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)}}})); /***/ }), /***/ 208: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * lodash (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors <https://jquery.org/> * Released under MIT license <https://lodash.com/license> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ /** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; /** `Object#toString` result references. */ var funcTag = '[object Function]', genTag = '[object GeneratorFunction]', symbolTag = '[object Symbol]'; /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, reLeadingDot = /^\./, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; /** * Used to match `RegExp` * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; /** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; /** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Detect free variable `global` from Node.js. */ var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g; /** Detect free variable `self`. */ var freeSelf = typeof self == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); /** * Gets the value at `key` of `object`. * * @private * @param {Object} [object] The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function getValue(object, key) { return object == null ? undefined : object[key]; } /** * Checks if `value` is a host object in IE < 9. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a host object, else `false`. */ function isHostObject(value) { // Many host objects are `Object` objects that can coerce to strings // despite having improperly defined `toString` methods. var result = false; if (value != null && typeof value.toString != 'function') { try { result = !!(value + ''); } catch (e) {} } return result; } /** Used for built-in method references. */ var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ var coreJsData = root['__core-js_shared__']; /** Used to detect methods masquerading as native. */ var maskSrcKey = (function() { var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); return uid ? ('Symbol(src)_1.' + uid) : ''; }()); /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ var Symbol = root.Symbol, splice = arrayProto.splice; /* Built-in method references that are verified to be native. */ var Map = getNative(root, 'Map'), nativeCreate = getNative(Object, 'create'); /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined; /** * Creates a hash object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Hash(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the hash. * * @private * @name clear * @memberOf Hash */ function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; } /** * Removes `key` and its value from the hash. * * @private * @name delete * @memberOf Hash * @param {Object} hash The hash to modify. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function hashDelete(key) { return this.has(key) && delete this.__data__[key]; } /** * Gets the hash value for `key`. * * @private * @name get * @memberOf Hash * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function hashGet(key) { var data = this.__data__; if (nativeCreate) { var result = data[key]; return result === HASH_UNDEFINED ? undefined : result; } return hasOwnProperty.call(data, key) ? data[key] : undefined; } /** * Checks if a hash value for `key` exists. * * @private * @name has * @memberOf Hash * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function hashHas(key) { var data = this.__data__; return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); } /** * Sets the hash `key` to `value`. * * @private * @name set * @memberOf Hash * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the hash instance. */ function hashSet(key, value) { var data = this.__data__; data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; return this; } // Add methods to `Hash`. Hash.prototype.clear = hashClear; Hash.prototype['delete'] = hashDelete; Hash.prototype.get = hashGet; Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; /** * Creates an list cache object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function ListCache(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the list cache. * * @private * @name clear * @memberOf ListCache */ function listCacheClear() { this.__data__ = []; } /** * Removes `key` and its value from the list cache. * * @private * @name delete * @memberOf ListCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function listCacheDelete(key) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { return false; } var lastIndex = data.length - 1; if (index == lastIndex) { data.pop(); } else { splice.call(data, index, 1); } return true; } /** * Gets the list cache value for `key`. * * @private * @name get * @memberOf ListCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function listCacheGet(key) { var data = this.__data__, index = assocIndexOf(data, key); return index < 0 ? undefined : data[index][1]; } /** * Checks if a list cache value for `key` exists. * * @private * @name has * @memberOf ListCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function listCacheHas(key) { return assocIndexOf(this.__data__, key) > -1; } /** * Sets the list cache `key` to `value`. * * @private * @name set * @memberOf ListCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the list cache instance. */ function listCacheSet(key, value) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { data.push([key, value]); } else { data[index][1] = value; } return this; } // Add methods to `ListCache`. ListCache.prototype.clear = listCacheClear; ListCache.prototype['delete'] = listCacheDelete; ListCache.prototype.get = listCacheGet; ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; /** * Creates a map cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function MapCache(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the map. * * @private * @name clear * @memberOf MapCache */ function mapCacheClear() { this.__data__ = { 'hash': new Hash, 'map': new (Map || ListCache), 'string': new Hash }; } /** * Removes `key` and its value from the map. * * @private * @name delete * @memberOf MapCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function mapCacheDelete(key) { return getMapData(this, key)['delete'](key); } /** * Gets the map value for `key`. * * @private * @name get * @memberOf MapCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function mapCacheGet(key) { return getMapData(this, key).get(key); } /** * Checks if a map value for `key` exists. * * @private * @name has * @memberOf MapCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function mapCacheHas(key) { return getMapData(this, key).has(key); } /** * Sets the map `key` to `value`. * * @private * @name set * @memberOf MapCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the map cache instance. */ function mapCacheSet(key, value) { getMapData(this, key).set(key, value); return this; } // Add methods to `MapCache`. MapCache.prototype.clear = mapCacheClear; MapCache.prototype['delete'] = mapCacheDelete; MapCache.prototype.get = mapCacheGet; MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; /** * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ function assocIndexOf(array, key) { var length = array.length; while (length--) { if (eq(array[length][0], key)) { return length; } } return -1; } /** * The base implementation of `_.get` without support for default values. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @returns {*} Returns the resolved value. */ function baseGet(object, path) { path = isKey(path, object) ? [path] : castPath(path); var index = 0, length = path.length; while (object != null && index < length) { object = object[toKey(path[index++])]; } return (index && index == length) ? object : undefined; } /** * The base implementation of `_.isNative` without bad shim checks. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, * else `false`. */ function baseIsNative(value) { if (!isObject(value) || isMasked(value)) { return false; } var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } /** * The base implementation of `_.toString` which doesn't convert nullish * values to empty strings. * * @private * @param {*} value The value to process. * @returns {string} Returns the string. */ function baseToString(value) { // Exit early for strings to avoid a performance hit in some environments. if (typeof value == 'string') { return value; } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /** * Casts `value` to a path array if it's not one. * * @private * @param {*} value The value to inspect. * @returns {Array} Returns the cast property path array. */ function castPath(value) { return isArray(value) ? value : stringToPath(value); } /** * Gets the data for `map`. * * @private * @param {Object} map The map to query. * @param {string} key The reference key. * @returns {*} Returns the map data. */ function getMapData(map, key) { var data = map.__data__; return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; } /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : undefined; } /** * Checks if `value` is a property name and not a property path. * * @private * @param {*} value The value to check. * @param {Object} [object] The object to query keys on. * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { if (isArray(value)) { return false; } var type = typeof value; if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object)); } /** * Checks if `value` is suitable for use as unique object key. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is suitable, else `false`. */ function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') ? (value !== '__proto__') : (value === null); } /** * Checks if `func` has its source masked. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` is masked, else `false`. */ function isMasked(func) { return !!maskSrcKey && (maskSrcKey in func); } /** * Converts `string` to a property path array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the property path array. */ var stringToPath = memoize(function(string) { string = toString(string); var result = []; if (reLeadingDot.test(string)) { result.push(''); } string.replace(rePropName, function(match, number, quote, string) { result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); }); return result; }); /** * Converts `value` to a string key if it's not a string or symbol. * * @private * @param {*} value The value to inspect. * @returns {string|symbol} Returns the key. */ function toKey(value) { if (typeof value == 'string' || isSymbol(value)) { return value; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /** * Converts `func` to its source code. * * @private * @param {Function} func The function to process. * @returns {string} Returns the source code. */ function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e) {} try { return (func + ''); } catch (e) {} } return ''; } /** * Creates a function that memoizes the result of `func`. If `resolver` is * provided, it determines the cache key for storing the result based on the * arguments provided to the memoized function. By default, the first argument * provided to the memoized function is used as the map cache key. The `func` * is invoked with the `this` binding of the memoized function. * * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) * method interface of `delete`, `get`, `has`, and `set`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to have its output memoized. * @param {Function} [resolver] The function to resolve the cache key. * @returns {Function} Returns the new memoized function. * @example * * var object = { 'a': 1, 'b': 2 }; * var other = { 'c': 3, 'd': 4 }; * * var values = _.memoize(_.values); * values(object); * // => [1, 2] * * values(other); * // => [3, 4] * * object.a = 2; * values(object); * // => [1, 2] * * // Modify the result cache. * values.cache.set(object, ['a', 'b']); * values(object); * // => ['a', 'b'] * * // Replace `_.memoize.Cache`. * _.memoize.Cache = WeakMap; */ function memoize(func, resolver) { if (typeof func != 'function' || (resolver && typeof resolver != 'function')) { throw new TypeError(FUNC_ERROR_TEXT); } var memoized = function() { var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; if (cache.has(key)) { return cache.get(key); } var result = func.apply(this, args); memoized.cache = cache.set(key, result); return result; }; memoized.cache = new (memoize.Cache || MapCache); return memoized; } // Assign cache to `_.memoize`. memoize.Cache = MapCache; /** * Performs a * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.eq(object, object); * // => true * * _.eq(object, other); * // => false * * _.eq('a', 'a'); * // => true * * _.eq('a', Object('a')); * // => false * * _.eq(NaN, NaN); * // => true */ function eq(value, other) { ret