diff --git a/modules/database/database.go b/modules/database/database.go index 1c8d757..76f91e8 100644 --- a/modules/database/database.go +++ b/modules/database/database.go @@ -46,4 +46,5 @@ func InitDatabase() { db.AutoMigrate(&structs.Notification{}) db.AutoMigrate(&structs.LogManagerServerConnection{}) db.AutoMigrate(&structs.CrmCustomer{}) + db.AutoMigrate(&structs.CrmCallProtocol{}) } diff --git a/modules/structs/crm.go b/modules/structs/crm.go index e305657..0b0af01 100644 --- a/modules/structs/crm.go +++ b/modules/structs/crm.go @@ -72,3 +72,38 @@ type CrmTypeCustomerRequest struct { type CrmGetCustomerRequest struct { Id string } + +// swagger:model CrmCallProtocol +type CrmCallProtocol struct { + Id string + CustomerId string + CallType uint8 + Telephone string + Notes string + ResultReached uint8 + ResultWhoPickedUp uint8 + ResultExpressedInterest uint8 + ResultScheduled uint8 + CalledAt time.Time + CreatedBy string + CreatedAt time.Time +} + +// swagger:model CrmCallProtocolRequest +type CrmCallProtocolRequest struct { + CustomerId string + CallType uint8 + Telephone string + Notes string + ResultReached uint8 + ResultWhoPickedUp uint8 + ResultExpressedInterest uint8 + ResultScheduled uint8 + CalledAt time.Time +} + +// swagger:model CrmGetCustomerResponse +type CrmGetCustomerResponse struct { + Customer CrmCustomer + CallProtocols []CrmCallProtocol +} diff --git a/modules/utils/globals.go b/modules/utils/globals.go index 8510d76..8a19a7e 100644 --- a/modules/utils/globals.go +++ b/modules/utils/globals.go @@ -102,6 +102,8 @@ const ( SentCmdAdminAreaManageLogManagerServerConnectionRemoved = 46 SentCmdCrmCustomerUpdated = 47 SentCmdCrmCustomerCreated = 48 + SentCmdCrmCallProtocolCreated = 49 + SentCmdCrmCallProtocolDeleted = 50 ) // commands received from web clients @@ -216,12 +218,15 @@ const ( PermissionsRoboticsRobotsAuthorizeDenyUnauthorizedRobots = "robotics.robots.authorize_deny_unauthorized_robots" PermissionsRoboticsRobotsViewSwaggerDocumentation = "robotics.robots.view_swagger_documentation" - _crm = "crm." - PermissionCrmCustomersView = _crm + "customers.view" - PermissionCrmCustomersEdit = _crm + "customers.edit" - PermissionCrmCustomersCreate = _crm + "customers.create" - PermissionCrmDmcPipelineView = _crm + "dmc_pipeline.view" - PermissionCrmSetterCloserView = _crm + "setter_closer.view" + _crm = "crm." + PermissionCrmCustomersView = _crm + "customers.view" + PermissionCrmCustomersEdit = _crm + "customers.edit" + PermissionCrmCustomersCreate = _crm + "customers.create" + PermissionCrmDmcPipelineView = _crm + "dmc_pipeline.view" + PermissionCrmSetterCloserView = _crm + "setter_closer.view" + PermissionCrmCallProtocolCreate = _crm + "call_protocol.create" + PermissionCrmCallProtocolView = _crm + "call_protocol.view" + PermissionCrmCallProtocolDelete = _crm + "call_protocol.delete" ) var SystemPermissions = []string{ @@ -258,6 +263,9 @@ var SystemPermissions = []string{ PermissionCrmCustomersCreate, PermissionCrmDmcPipelineView, PermissionCrmSetterCloserView, + PermissionCrmCallProtocolCreate, + PermissionCrmCallProtocolView, + PermissionCrmCallProtocolDelete, } var DynamicGroupTasksPermissions = []string{ diff --git a/node_modules/.bin/loose-envify b/node_modules/.bin/loose-envify new file mode 120000 index 0000000..ed9009c --- /dev/null +++ b/node_modules/.bin/loose-envify @@ -0,0 +1 @@ +../loose-envify/cli.js \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 0000000..37b8715 --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,81 @@ +{ + "name": "admin-dashboard-backend", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/highlight-words-core": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/highlight-words-core/-/highlight-words-core-1.2.2.tgz", + "integrity": "sha512-BXUKIkUuh6cmmxzi5OIbUJxrG8OAk2MqoL1DtO3Wo9D2faJg2ph5ntyuQeLqaHJmzER6H5tllCDA9ZnNe9BVGg==" + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/memoize-one": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-4.0.3.tgz", + "integrity": "sha512-QmpUu4KqDmX0plH4u+tf0riMc1KHE1+lw95cMrLlXQAFOx/xnBtwhZ52XJxd9X2O6kwKBqX32kmhbhlobD0cuw==" + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "node_modules/react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-highlight-words": { + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/react-highlight-words/-/react-highlight-words-0.20.0.tgz", + "integrity": "sha512-asCxy+jCehDVhusNmCBoxDf2mm1AJ//D+EzDx1m5K7EqsMBIHdZ5G4LdwbSEXqZq1Ros0G0UySWmAtntSph7XA==", + "dependencies": { + "highlight-words-core": "^1.2.0", + "memoize-one": "^4.0.0", + "prop-types": "^15.5.8" + }, + "peerDependencies": { + "react": "^0.14.0 || ^15.0.0 || ^16.0.0-0 || ^17.0.0-0 || ^18.0.0-0" + } + }, + "node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" + } + } +} diff --git a/node_modules/highlight-words-core/LICENSE b/node_modules/highlight-words-core/LICENSE new file mode 100644 index 0000000..134b4c3 --- /dev/null +++ b/node_modules/highlight-words-core/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Treasure Data + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/node_modules/highlight-words-core/README.md b/node_modules/highlight-words-core/README.md new file mode 100644 index 0000000..0c017d9 --- /dev/null +++ b/node_modules/highlight-words-core/README.md @@ -0,0 +1,50 @@ +Utility functions shared by [`react-highlight-words`](https://github.com/bvaughn/react-highlight-words) and [`react-native-highlight-words`](https://github.com/clauderic/react-native-highlight-words). + +## API + +The primary API for this package is a function exported as `findAll`. This method searches a string of text for a set of search terms and returns an array of "chunks" that describe the matches found. + +Each "chunk" is an object consisting of a pair of indices (`chunk.start` and `chunk.end`) and a boolean specfifying whether the chunk is a match (`chunk.highlight`). For example: + +```js +import { findAll } from "highlight-words-core"; + +const textToHighlight = "This is some text to highlight."; +const searchWords = ["This", "i"]; + +const chunks = findAll({ + searchWords, + textToHighlight +}); + +const highlightedText = chunks + .map(chunk => { + const { end, highlight, start } = chunk; + const text = textToHighlight.substr(start, end - start); + if (highlight) { + return `${text}`; + } else { + return text; + } + }) + .join(""); +``` + +[Run this example on Code Sandbox.](https://codesandbox.io/s/ykwrzrl6wx) + +### `findAll` + +The `findAll` function accepts several parameters, although only the `searchWords` array and `textToHighlight` string are required. + +| Parameter | Required? | Type | Description | +| --- | :---: | --- | --- | +| autoEscape | | `boolean` | Escape special regular expression characters | +| caseSensitive | | `boolean` | Search should be case sensitive | +| findChunks | | `Function` | Custom find function (advanced) | +| sanitize | | `Function` | Custom sanitize function (advanced) | +| searchWords | ✅ | `Array` | Array of words to search for | +| textToHighlight | ✅ | `string` | Text to search and highlight | + + +## License +MIT License - fork, modify and use however you want. diff --git a/node_modules/highlight-words-core/dist/index.js b/node_modules/highlight-words-core/dist/index.js new file mode 100644 index 0000000..01767d7 --- /dev/null +++ b/node_modules/highlight-words-core/dist/index.js @@ -0,0 +1,256 @@ +module.exports = +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; +/******/ +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(1); + + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _utils = __webpack_require__(2); + + Object.defineProperty(exports, 'combineChunks', { + enumerable: true, + get: function get() { + return _utils.combineChunks; + } + }); + Object.defineProperty(exports, 'fillInChunks', { + enumerable: true, + get: function get() { + return _utils.fillInChunks; + } + }); + Object.defineProperty(exports, 'findAll', { + enumerable: true, + get: function get() { + return _utils.findAll; + } + }); + Object.defineProperty(exports, 'findChunks', { + enumerable: true, + get: function get() { + return _utils.findChunks; + } + }); + +/***/ }), +/* 2 */ +/***/ (function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + + /** + * Creates an array of chunk objects representing both higlightable and non highlightable pieces of text that match each search word. + * @return Array of "chunks" (where a Chunk is { start:number, end:number, highlight:boolean }) + */ + var findAll = exports.findAll = function findAll(_ref) { + var autoEscape = _ref.autoEscape, + _ref$caseSensitive = _ref.caseSensitive, + caseSensitive = _ref$caseSensitive === undefined ? false : _ref$caseSensitive, + _ref$findChunks = _ref.findChunks, + findChunks = _ref$findChunks === undefined ? defaultFindChunks : _ref$findChunks, + sanitize = _ref.sanitize, + searchWords = _ref.searchWords, + textToHighlight = _ref.textToHighlight; + return fillInChunks({ + chunksToHighlight: combineChunks({ + chunks: findChunks({ + autoEscape: autoEscape, + caseSensitive: caseSensitive, + sanitize: sanitize, + searchWords: searchWords, + textToHighlight: textToHighlight + }) + }), + totalLength: textToHighlight ? textToHighlight.length : 0 + }); + }; + + /** + * Takes an array of {start:number, end:number} objects and combines chunks that overlap into single chunks. + * @return {start:number, end:number}[] + */ + + + var combineChunks = exports.combineChunks = function combineChunks(_ref2) { + var chunks = _ref2.chunks; + + chunks = chunks.sort(function (first, second) { + return first.start - second.start; + }).reduce(function (processedChunks, nextChunk) { + // First chunk just goes straight in the array... + if (processedChunks.length === 0) { + return [nextChunk]; + } else { + // ... subsequent chunks get checked to see if they overlap... + var prevChunk = processedChunks.pop(); + if (nextChunk.start <= prevChunk.end) { + // It may be the case that prevChunk completely surrounds nextChunk, so take the + // largest of the end indeces. + var endIndex = Math.max(prevChunk.end, nextChunk.end); + processedChunks.push({ highlight: false, start: prevChunk.start, end: endIndex }); + } else { + processedChunks.push(prevChunk, nextChunk); + } + return processedChunks; + } + }, []); + + return chunks; + }; + + /** + * Examine text for any matches. + * If we find matches, add them to the returned array as a "chunk" object ({start:number, end:number}). + * @return {start:number, end:number}[] + */ + var defaultFindChunks = function defaultFindChunks(_ref3) { + var autoEscape = _ref3.autoEscape, + caseSensitive = _ref3.caseSensitive, + _ref3$sanitize = _ref3.sanitize, + sanitize = _ref3$sanitize === undefined ? defaultSanitize : _ref3$sanitize, + searchWords = _ref3.searchWords, + textToHighlight = _ref3.textToHighlight; + + textToHighlight = sanitize(textToHighlight); + + return searchWords.filter(function (searchWord) { + return searchWord; + }) // Remove empty words + .reduce(function (chunks, searchWord) { + searchWord = sanitize(searchWord); + + if (autoEscape) { + searchWord = escapeRegExpFn(searchWord); + } + + var regex = new RegExp(searchWord, caseSensitive ? 'g' : 'gi'); + + var match = void 0; + while (match = regex.exec(textToHighlight)) { + var _start = match.index; + var _end = regex.lastIndex; + // We do not return zero-length matches + if (_end > _start) { + chunks.push({ highlight: false, start: _start, end: _end }); + } + + // Prevent browsers like Firefox from getting stuck in an infinite loop + // See http://www.regexguru.com/2008/04/watch-out-for-zero-length-matches/ + if (match.index === regex.lastIndex) { + regex.lastIndex++; + } + } + + return chunks; + }, []); + }; + // Allow the findChunks to be overridden in findAll, + // but for backwards compatibility we export as the old name + exports.findChunks = defaultFindChunks; + + /** + * Given a set of chunks to highlight, create an additional set of chunks + * to represent the bits of text between the highlighted text. + * @param chunksToHighlight {start:number, end:number}[] + * @param totalLength number + * @return {start:number, end:number, highlight:boolean}[] + */ + + var fillInChunks = exports.fillInChunks = function fillInChunks(_ref4) { + var chunksToHighlight = _ref4.chunksToHighlight, + totalLength = _ref4.totalLength; + + var allChunks = []; + var append = function append(start, end, highlight) { + if (end - start > 0) { + allChunks.push({ + start: start, + end: end, + highlight: highlight + }); + } + }; + + if (chunksToHighlight.length === 0) { + append(0, totalLength, false); + } else { + var lastIndex = 0; + chunksToHighlight.forEach(function (chunk) { + append(lastIndex, chunk.start, false); + append(chunk.start, chunk.end, true); + lastIndex = chunk.end; + }); + append(lastIndex, totalLength, false); + } + return allChunks; + }; + + function defaultSanitize(string) { + return string; + } + + function escapeRegExpFn(string) { + return string.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); + } + +/***/ }) +/******/ ]); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/highlight-words-core/dist/index.js.flow b/node_modules/highlight-words-core/dist/index.js.flow new file mode 100644 index 0000000..5457261 --- /dev/null +++ b/node_modules/highlight-words-core/dist/index.js.flow @@ -0,0 +1,3 @@ +// @flow + +export * from '../src'; \ No newline at end of file diff --git a/node_modules/highlight-words-core/dist/index.js.map b/node_modules/highlight-words-core/dist/index.js.map new file mode 100644 index 0000000..2f24be3 --- /dev/null +++ b/node_modules/highlight-words-core/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/bootstrap 2a95070affdf3c0054f1","webpack:///./src/index.js","webpack:///./src/utils.js"],"names":["combineChunks","fillInChunks","findAll","findChunks","autoEscape","caseSensitive","defaultFindChunks","sanitize","searchWords","textToHighlight","chunksToHighlight","chunks","totalLength","length","sort","first","second","start","reduce","processedChunks","nextChunk","prevChunk","pop","end","endIndex","Math","max","push","highlight","defaultSanitize","filter","searchWord","escapeRegExpFn","regex","RegExp","match","exec","index","lastIndex","allChunks","append","forEach","chunk","string","replace"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;mBCpCSA,a;;;;;;mBAAeC,Y;;;;;;mBAAcC,O;;;;;;mBAASC,U;;;;;;;;;;;;;;;ACM/C;;;;AAIO,KAAMD,4BAAU,SAAVA,OAAU;AAAA,OACrBE,UADqB,QACrBA,UADqB;AAAA,iCAErBC,aAFqB;AAAA,OAErBA,aAFqB,sCAEL,KAFK;AAAA,8BAGrBF,UAHqB;AAAA,OAGrBA,UAHqB,mCAGRG,iBAHQ;AAAA,OAIrBC,QAJqB,QAIrBA,QAJqB;AAAA,OAKrBC,WALqB,QAKrBA,WALqB;AAAA,OAMrBC,eANqB,QAMrBA,eANqB;AAAA,UAerBR,aAAa;AACXS,wBAAmBV,cAAc;AAC/BW,eAAQR,WAAW;AACjBC,+BADiB;AAEjBC,qCAFiB;AAGjBE,2BAHiB;AAIjBC,iCAJiB;AAKjBC;AALiB,QAAX;AADuB,MAAd,CADR;AAUXG,kBAAaH,kBAAkBA,gBAAgBI,MAAlC,GAA2C;AAV7C,IAAb,CAfqB;AAAA,EAAhB;;AA6BP;;;;;;AAIO,KAAMb,wCAAgB,SAAhBA,aAAgB,QAIT;AAAA,OAHlBW,MAGkB,SAHlBA,MAGkB;;AAClBA,YAASA,OACNG,IADM,CACD,UAACC,KAAD,EAAQC,MAAR;AAAA,YAAmBD,MAAME,KAAN,GAAcD,OAAOC,KAAxC;AAAA,IADC,EAENC,MAFM,CAEC,UAACC,eAAD,EAAkBC,SAAlB,EAAgC;AACtC;AACA,SAAID,gBAAgBN,MAAhB,KAA2B,CAA/B,EAAkC;AAChC,cAAO,CAACO,SAAD,CAAP;AACD,MAFD,MAEO;AACL;AACA,WAAMC,YAAYF,gBAAgBG,GAAhB,EAAlB;AACA,WAAIF,UAAUH,KAAV,IAAmBI,UAAUE,GAAjC,EAAsC;AACpC;AACA;AACA,aAAMC,WAAWC,KAAKC,GAAL,CAASL,UAAUE,GAAnB,EAAwBH,UAAUG,GAAlC,CAAjB;AACAJ,yBAAgBQ,IAAhB,CAAqB,EAACC,WAAW,KAAZ,EAAmBX,OAAOI,UAAUJ,KAApC,EAA2CM,KAAKC,QAAhD,EAArB;AACD,QALD,MAKO;AACLL,yBAAgBQ,IAAhB,CAAqBN,SAArB,EAAgCD,SAAhC;AACD;AACD,cAAOD,eAAP;AACD;AACF,IAnBM,EAmBJ,EAnBI,CAAT;;AAqBA,UAAOR,MAAP;AACD,EA3BM;;AA6BP;;;;;AAKA,KAAML,oBAAoB,SAApBA,iBAAoB,QAYN;AAAA,OAXlBF,UAWkB,SAXlBA,UAWkB;AAAA,OAVlBC,aAUkB,SAVlBA,aAUkB;AAAA,8BATlBE,QASkB;AAAA,OATlBA,QASkB,kCATPsB,eASO;AAAA,OARlBrB,WAQkB,SARlBA,WAQkB;AAAA,OAPlBC,eAOkB,SAPlBA,eAOkB;;AAClBA,qBAAkBF,SAASE,eAAT,CAAlB;;AAEA,UAAOD,YACJsB,MADI,CACG;AAAA,YAAcC,UAAd;AAAA,IADH,EAC6B;AAD7B,IAEJb,MAFI,CAEG,UAACP,MAAD,EAASoB,UAAT,EAAwB;AAC9BA,kBAAaxB,SAASwB,UAAT,CAAb;;AAEA,SAAI3B,UAAJ,EAAgB;AACd2B,oBAAaC,eAAeD,UAAf,CAAb;AACD;;AAED,SAAME,QAAQ,IAAIC,MAAJ,CAAWH,UAAX,EAAuB1B,gBAAgB,GAAhB,GAAsB,IAA7C,CAAd;;AAEA,SAAI8B,cAAJ;AACA,YAAQA,QAAQF,MAAMG,IAAN,CAAW3B,eAAX,CAAhB,EAA8C;AAC5C,WAAIQ,SAAQkB,MAAME,KAAlB;AACA,WAAId,OAAMU,MAAMK,SAAhB;AACA;AACA,WAAIf,OAAMN,MAAV,EAAiB;AACfN,gBAAOgB,IAAP,CAAY,EAACC,WAAW,KAAZ,EAAmBX,aAAnB,EAA0BM,SAA1B,EAAZ;AACD;;AAED;AACA;AACA,WAAIY,MAAME,KAAN,KAAgBJ,MAAMK,SAA1B,EAAqC;AACnCL,eAAMK,SAAN;AACD;AACF;;AAED,YAAO3B,MAAP;AACD,IA5BI,EA4BF,EA5BE,CAAP;AA6BD,EA5CD;AA6CA;AACA;SAC6BR,U,GAArBG,iB;;AAER;;;;;;;;AAOO,KAAML,sCAAe,SAAfA,YAAe,QAMR;AAAA,OALlBS,iBAKkB,SALlBA,iBAKkB;AAAA,OAJlBE,WAIkB,SAJlBA,WAIkB;;AAClB,OAAM2B,YAAY,EAAlB;AACA,OAAMC,SAAS,SAATA,MAAS,CAACvB,KAAD,EAAQM,GAAR,EAAaK,SAAb,EAA2B;AACxC,SAAIL,MAAMN,KAAN,GAAc,CAAlB,EAAqB;AACnBsB,iBAAUZ,IAAV,CAAe;AACbV,qBADa;AAEbM,iBAFa;AAGbK;AAHa,QAAf;AAKD;AACF,IARD;;AAUA,OAAIlB,kBAAkBG,MAAlB,KAA6B,CAAjC,EAAoC;AAClC2B,YAAO,CAAP,EAAU5B,WAAV,EAAuB,KAAvB;AACD,IAFD,MAEO;AACL,SAAI0B,YAAY,CAAhB;AACA5B,uBAAkB+B,OAAlB,CAA0B,UAACC,KAAD,EAAW;AACnCF,cAAOF,SAAP,EAAkBI,MAAMzB,KAAxB,EAA+B,KAA/B;AACAuB,cAAOE,MAAMzB,KAAb,EAAoByB,MAAMnB,GAA1B,EAA+B,IAA/B;AACAe,mBAAYI,MAAMnB,GAAlB;AACD,MAJD;AAKAiB,YAAOF,SAAP,EAAkB1B,WAAlB,EAA+B,KAA/B;AACD;AACD,UAAO2B,SAAP;AACD,EA9BM;;AAgCP,UAASV,eAAT,CAA0Bc,MAA1B,EAAkD;AAChD,UAAOA,MAAP;AACD;;AAED,UAASX,cAAT,CAAyBW,MAAzB,EAAiD;AAC/C,UAAOA,OAAOC,OAAP,CAAe,qCAAf,EAAsD,MAAtD,CAAP;AACD,E","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 2a95070affdf3c0054f1","// @flow\n\nexport { combineChunks, fillInChunks, findAll, findChunks } from './utils'\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","// @flow\n\nexport type Chunk = {|\n highlight: boolean,\n start: number,\n end: number,\n|};\n\n/**\n * Creates an array of chunk objects representing both higlightable and non highlightable pieces of text that match each search word.\n * @return Array of \"chunks\" (where a Chunk is { start:number, end:number, highlight:boolean })\n */\nexport const findAll = ({\n autoEscape,\n caseSensitive = false,\n findChunks = defaultFindChunks,\n sanitize,\n searchWords,\n textToHighlight\n}: {\n autoEscape?: boolean,\n caseSensitive?: boolean,\n findChunks?: typeof defaultFindChunks,\n sanitize?: typeof defaultSanitize,\n searchWords: Array,\n textToHighlight: string,\n}): Array => (\n fillInChunks({\n chunksToHighlight: combineChunks({\n chunks: findChunks({\n autoEscape,\n caseSensitive,\n sanitize,\n searchWords,\n textToHighlight\n })\n }),\n totalLength: textToHighlight ? textToHighlight.length : 0\n })\n)\n\n/**\n * Takes an array of {start:number, end:number} objects and combines chunks that overlap into single chunks.\n * @return {start:number, end:number}[]\n */\nexport const combineChunks = ({\n chunks\n}: {\n chunks: Array,\n}): Array => {\n chunks = chunks\n .sort((first, second) => first.start - second.start)\n .reduce((processedChunks, nextChunk) => {\n // First chunk just goes straight in the array...\n if (processedChunks.length === 0) {\n return [nextChunk]\n } else {\n // ... subsequent chunks get checked to see if they overlap...\n const prevChunk = processedChunks.pop()\n if (nextChunk.start <= prevChunk.end) {\n // It may be the case that prevChunk completely surrounds nextChunk, so take the\n // largest of the end indeces.\n const endIndex = Math.max(prevChunk.end, nextChunk.end)\n processedChunks.push({highlight: false, start: prevChunk.start, end: endIndex})\n } else {\n processedChunks.push(prevChunk, nextChunk)\n }\n return processedChunks\n }\n }, [])\n\n return chunks\n}\n\n/**\n * Examine text for any matches.\n * If we find matches, add them to the returned array as a \"chunk\" object ({start:number, end:number}).\n * @return {start:number, end:number}[]\n */\nconst defaultFindChunks = ({\n autoEscape,\n caseSensitive,\n sanitize = defaultSanitize,\n searchWords,\n textToHighlight\n}: {\n autoEscape?: boolean,\n caseSensitive?: boolean,\n sanitize?: typeof defaultSanitize,\n searchWords: Array,\n textToHighlight: string,\n}): Array => {\n textToHighlight = sanitize(textToHighlight)\n\n return searchWords\n .filter(searchWord => searchWord) // Remove empty words\n .reduce((chunks, searchWord) => {\n searchWord = sanitize(searchWord)\n\n if (autoEscape) {\n searchWord = escapeRegExpFn(searchWord)\n }\n\n const regex = new RegExp(searchWord, caseSensitive ? 'g' : 'gi')\n\n let match\n while ((match = regex.exec(textToHighlight))) {\n let start = match.index\n let end = regex.lastIndex\n // We do not return zero-length matches\n if (end > start) {\n chunks.push({highlight: false, start, end})\n }\n\n // Prevent browsers like Firefox from getting stuck in an infinite loop\n // See http://www.regexguru.com/2008/04/watch-out-for-zero-length-matches/\n if (match.index === regex.lastIndex) {\n regex.lastIndex++\n }\n }\n\n return chunks\n }, [])\n}\n// Allow the findChunks to be overridden in findAll,\n// but for backwards compatibility we export as the old name\nexport {defaultFindChunks as findChunks}\n\n/**\n * Given a set of chunks to highlight, create an additional set of chunks\n * to represent the bits of text between the highlighted text.\n * @param chunksToHighlight {start:number, end:number}[]\n * @param totalLength number\n * @return {start:number, end:number, highlight:boolean}[]\n */\nexport const fillInChunks = ({\n chunksToHighlight,\n totalLength\n}: {\n chunksToHighlight: Array,\n totalLength: number,\n}): Array => {\n const allChunks = []\n const append = (start, end, highlight) => {\n if (end - start > 0) {\n allChunks.push({\n start,\n end,\n highlight\n })\n }\n }\n\n if (chunksToHighlight.length === 0) {\n append(0, totalLength, false)\n } else {\n let lastIndex = 0\n chunksToHighlight.forEach((chunk) => {\n append(lastIndex, chunk.start, false)\n append(chunk.start, chunk.end, true)\n lastIndex = chunk.end\n })\n append(lastIndex, totalLength, false)\n }\n return allChunks\n}\n\nfunction defaultSanitize (string: string): string {\n return string\n}\n\nfunction escapeRegExpFn (string: string): string {\n return string.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, '\\\\$&')\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/utils.js"],"sourceRoot":""} \ No newline at end of file diff --git a/node_modules/highlight-words-core/package.json b/node_modules/highlight-words-core/package.json new file mode 100644 index 0000000..fcb789f --- /dev/null +++ b/node_modules/highlight-words-core/package.json @@ -0,0 +1,66 @@ +{ + "name": "highlight-words-core", + "description": "Utility functions shared by react-highlight-words and react-native-highlight-words", + "version": "1.2.2", + "author": "Brian Vaughn ", + "license": "MIT", + "main": "dist/index.js", + "scripts": { + "build": "yarn build:source && yarn build:flow", + "build:flow": "cp flow-template dist/index.js.flow", + "build:source": "webpack --config webpack.config.dist.js --bail", + "lint": "standard", + "prebuild": "rimraf dist", + "prepublish": "npm run build", + "test": "mocha --compilers js:babel-register \"src/**/*.test.js\"" + }, + "files": [ + "dist", + "src/*.js" + ], + "keywords": [ + "highlighter", + "highlight", + "text", + "words", + "matches", + "substring", + "occurrences", + "search" + ], + "repository": { + "type": "git", + "url": "github.com/bvaughn/highlight-words-core.git" + }, + "standard": { + "parser": "babel-eslint", + "ignore": [ + "build", + "dist", + "node_modules" + ], + "global": [ + "afterAll", + "afterEach", + "beforeAll", + "beforeEach", + "describe", + "it" + ] + }, + "devDependencies": { + "babel-cli": "6.8.0", + "babel-core": "^6.5.1", + "babel-eslint": "^6.0.4", + "babel-loader": "^6.2.3", + "babel-preset-es2015": "^6.14.0", + "babel-preset-flow": "^6", + "cross-env": "^1.0.7", + "expect.js": "^0.3.1", + "latinize": "^0.3.0", + "mocha": "^3.0.2", + "rimraf": "^2.4.3", + "standard": "^7.0.1", + "webpack": "^1.9.6" + } +} diff --git a/node_modules/highlight-words-core/src/index.js b/node_modules/highlight-words-core/src/index.js new file mode 100644 index 0000000..a026957 --- /dev/null +++ b/node_modules/highlight-words-core/src/index.js @@ -0,0 +1,3 @@ +// @flow + +export { combineChunks, fillInChunks, findAll, findChunks } from './utils' diff --git a/node_modules/highlight-words-core/src/utils.js b/node_modules/highlight-words-core/src/utils.js new file mode 100644 index 0000000..8ef0530 --- /dev/null +++ b/node_modules/highlight-words-core/src/utils.js @@ -0,0 +1,174 @@ +// @flow + +export type Chunk = {| + highlight: boolean, + start: number, + end: number, +|}; + +/** + * Creates an array of chunk objects representing both higlightable and non highlightable pieces of text that match each search word. + * @return Array of "chunks" (where a Chunk is { start:number, end:number, highlight:boolean }) + */ +export const findAll = ({ + autoEscape, + caseSensitive = false, + findChunks = defaultFindChunks, + sanitize, + searchWords, + textToHighlight +}: { + autoEscape?: boolean, + caseSensitive?: boolean, + findChunks?: typeof defaultFindChunks, + sanitize?: typeof defaultSanitize, + searchWords: Array, + textToHighlight: string, +}): Array => ( + fillInChunks({ + chunksToHighlight: combineChunks({ + chunks: findChunks({ + autoEscape, + caseSensitive, + sanitize, + searchWords, + textToHighlight + }) + }), + totalLength: textToHighlight ? textToHighlight.length : 0 + }) +) + +/** + * Takes an array of {start:number, end:number} objects and combines chunks that overlap into single chunks. + * @return {start:number, end:number}[] + */ +export const combineChunks = ({ + chunks +}: { + chunks: Array, +}): Array => { + chunks = chunks + .sort((first, second) => first.start - second.start) + .reduce((processedChunks, nextChunk) => { + // First chunk just goes straight in the array... + if (processedChunks.length === 0) { + return [nextChunk] + } else { + // ... subsequent chunks get checked to see if they overlap... + const prevChunk = processedChunks.pop() + if (nextChunk.start <= prevChunk.end) { + // It may be the case that prevChunk completely surrounds nextChunk, so take the + // largest of the end indeces. + const endIndex = Math.max(prevChunk.end, nextChunk.end) + processedChunks.push({highlight: false, start: prevChunk.start, end: endIndex}) + } else { + processedChunks.push(prevChunk, nextChunk) + } + return processedChunks + } + }, []) + + return chunks +} + +/** + * Examine text for any matches. + * If we find matches, add them to the returned array as a "chunk" object ({start:number, end:number}). + * @return {start:number, end:number}[] + */ +const defaultFindChunks = ({ + autoEscape, + caseSensitive, + sanitize = defaultSanitize, + searchWords, + textToHighlight +}: { + autoEscape?: boolean, + caseSensitive?: boolean, + sanitize?: typeof defaultSanitize, + searchWords: Array, + textToHighlight: string, +}): Array => { + textToHighlight = sanitize(textToHighlight) + + return searchWords + .filter(searchWord => searchWord) // Remove empty words + .reduce((chunks, searchWord) => { + searchWord = sanitize(searchWord) + + if (autoEscape) { + searchWord = escapeRegExpFn(searchWord) + } + + const regex = new RegExp(searchWord, caseSensitive ? 'g' : 'gi') + + let match + while ((match = regex.exec(textToHighlight))) { + let start = match.index + let end = regex.lastIndex + // We do not return zero-length matches + if (end > start) { + chunks.push({highlight: false, start, end}) + } + + // Prevent browsers like Firefox from getting stuck in an infinite loop + // See http://www.regexguru.com/2008/04/watch-out-for-zero-length-matches/ + if (match.index === regex.lastIndex) { + regex.lastIndex++ + } + } + + return chunks + }, []) +} +// Allow the findChunks to be overridden in findAll, +// but for backwards compatibility we export as the old name +export {defaultFindChunks as findChunks} + +/** + * Given a set of chunks to highlight, create an additional set of chunks + * to represent the bits of text between the highlighted text. + * @param chunksToHighlight {start:number, end:number}[] + * @param totalLength number + * @return {start:number, end:number, highlight:boolean}[] + */ +export const fillInChunks = ({ + chunksToHighlight, + totalLength +}: { + chunksToHighlight: Array, + totalLength: number, +}): Array => { + const allChunks = [] + const append = (start, end, highlight) => { + if (end - start > 0) { + allChunks.push({ + start, + end, + highlight + }) + } + } + + if (chunksToHighlight.length === 0) { + append(0, totalLength, false) + } else { + let lastIndex = 0 + chunksToHighlight.forEach((chunk) => { + append(lastIndex, chunk.start, false) + append(chunk.start, chunk.end, true) + lastIndex = chunk.end + }) + append(lastIndex, totalLength, false) + } + return allChunks +} + +function defaultSanitize (string: string): string { + return string +} + +function escapeRegExpFn (string: string): string { + return string.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&') +} diff --git a/node_modules/highlight-words-core/src/utils.test.js b/node_modules/highlight-words-core/src/utils.test.js new file mode 100644 index 0000000..e7b52a8 --- /dev/null +++ b/node_modules/highlight-words-core/src/utils.test.js @@ -0,0 +1,149 @@ +import * as Chunks from './utils.js' +import expect from 'expect.js' +import latinize from 'latinize' + +describe('utils', () => { + // Positions: 01234567890123456789012345678901234567 + const TEXT = 'This is a string with words to search.' + + it('should handle empty or null textToHighlight', () => { + let result = Chunks.findAll({ + searchWords: ['search'], + textToHighlight: '' + }) + expect(result.length).to.equal(0) + + result = Chunks.findAll({ + searchWords: ['search'] + }) + expect(result.length).to.equal(0) + }) + + it('should highlight all occurrences of a word, regardless of capitalization', () => { + const rawChunks = Chunks.findChunks({ + searchWords: ['th'], + textToHighlight: TEXT + }) + expect(rawChunks).to.eql([ + {start: 0, end: 2, highlight: false}, + {start: 19, end: 21, highlight: false} + ]) + }) + + it('should highlight words that partially overlap', () => { + const combinedChunks = Chunks.combineChunks({ + chunks: Chunks.findChunks({ + searchWords: ['thi', 'is'], + textToHighlight: TEXT + }) + }) + expect(combinedChunks).to.eql([ + {start: 0, end: 4, highlight: false}, + {start: 5, end: 7, highlight: false} + ]) + }) + + it('should combine into the minimum number of marked and unmarked chunks', () => { + const filledInChunks = Chunks.findAll({ + searchWords: ['thi', 'is'], + textToHighlight: TEXT + }) + expect(filledInChunks).to.eql([ + {start: 0, end: 4, highlight: true}, + {start: 4, end: 5, highlight: false}, + {start: 5, end: 7, highlight: true}, + {start: 7, end: 38, highlight: false} + ]) + }) + + it('should handle unclosed parentheses when autoEscape prop is truthy', () => { + const rawChunks = Chunks.findChunks({ + autoEscape: true, + searchWords: ['text)'], + textToHighlight: '(This is text)' + }) + expect(rawChunks).to.eql([ + {start: 9, end: 14, highlight: false} + ]) + }) + + it('should match terms without accents against text with accents', () => { + const rawChunks = Chunks.findChunks({ + sanitize: latinize, + searchWords: ['example'], + textToHighlight: 'ỆᶍǍᶆṔƚÉ' + }) + expect(rawChunks).to.eql([ + {start: 0, end: 7, highlight: false} + ]) + }) + + it('should support case sensitive matches', () => { + let rawChunks = Chunks.findChunks({ + caseSensitive: true, + searchWords: ['t'], + textToHighlight: TEXT + }) + expect(rawChunks).to.eql([ + {start: 11, end: 12, highlight: false}, + {start: 19, end: 20, highlight: false}, + {start: 28, end: 29, highlight: false} + ]) + + rawChunks = Chunks.findChunks({ + caseSensitive: true, + searchWords: ['T'], + textToHighlight: TEXT + }) + expect(rawChunks).to.eql([ + {start: 0, end: 1, highlight: false} + ]) + }) + + it('should handle zero-length matches correctly', () => { + let rawChunks = Chunks.findChunks({ + caseSensitive: true, + searchWords: ['.*'], + textToHighlight: TEXT + }) + expect(rawChunks).to.eql([ + {start: 0, end: 38, highlight: false} + ]) + + rawChunks = Chunks.findChunks({ + caseSensitive: true, + searchWords: ['w?'], + textToHighlight: TEXT + }) + expect(rawChunks).to.eql([ + {start: 17, end: 18, highlight: false}, + {start: 22, end: 23, highlight: false} + ]) + }) + + it('should use custom findChunks', () => { + let filledInChunks = Chunks.findAll({ + findChunks: () => ( + [{start: 1, end: 3}] + ), + searchWords: ['xxx'], + textToHighlight: TEXT + }) + expect(filledInChunks).to.eql([ + {start: 0, end: 1, highlight: false}, + {start: 1, end: 3, highlight: true}, + {start: 3, end: 38, highlight: false} + ]) + + filledInChunks = Chunks.findAll({ + findChunks: () => ( + [] + ), + searchWords: ['This'], + textToHighlight: TEXT + }) + expect(filledInChunks).to.eql([ + {start: 0, end: 38, highlight: false} + ]) + }) +}) diff --git a/node_modules/js-tokens/CHANGELOG.md b/node_modules/js-tokens/CHANGELOG.md new file mode 100644 index 0000000..755e6f6 --- /dev/null +++ b/node_modules/js-tokens/CHANGELOG.md @@ -0,0 +1,151 @@ +### Version 4.0.0 (2018-01-28) ### + +- Added: Support for ES2018. The only change needed was recognizing the `s` + regex flag. +- Changed: _All_ tokens returned by the `matchToToken` function now have a + `closed` property. It is set to `undefined` for the tokens where “closed” + doesn’t make sense. This means that all tokens objects have the same shape, + which might improve performance. + +These are the breaking changes: + +- `'/a/s'.match(jsTokens)` no longer returns `['/', 'a', '/', 's']`, but + `['/a/s']`. (There are of course other variations of this.) +- Code that rely on some token objects not having the `closed` property could + now behave differently. + + +### Version 3.0.2 (2017-06-28) ### + +- No code changes. Just updates to the readme. + + +### Version 3.0.1 (2017-01-30) ### + +- Fixed: ES2015 unicode escapes with more than 6 hex digits are now matched + correctly. + + +### Version 3.0.0 (2017-01-11) ### + +This release contains one breaking change, that should [improve performance in +V8][v8-perf]: + +> So how can you, as a JavaScript developer, ensure that your RegExps are fast? +> If you are not interested in hooking into RegExp internals, make sure that +> neither the RegExp instance, nor its prototype is modified in order to get the +> best performance: +> +> ```js +> var re = /./g; +> re.exec(''); // Fast path. +> re.new_property = 'slow'; +> ``` + +This module used to export a single regex, with `.matchToToken` bolted +on, just like in the above example. This release changes the exports of +the module to avoid this issue. + +Before: + +```js +import jsTokens from "js-tokens" +// or: +var jsTokens = require("js-tokens") +var matchToToken = jsTokens.matchToToken +``` + +After: + +```js +import jsTokens, {matchToToken} from "js-tokens" +// or: +var jsTokens = require("js-tokens").default +var matchToToken = require("js-tokens").matchToToken +``` + +[v8-perf]: http://v8project.blogspot.se/2017/01/speeding-up-v8-regular-expressions.html + + +### Version 2.0.0 (2016-06-19) ### + +- Added: Support for ES2016. In other words, support for the `**` exponentiation + operator. + +These are the breaking changes: + +- `'**'.match(jsTokens)` no longer returns `['*', '*']`, but `['**']`. +- `'**='.match(jsTokens)` no longer returns `['*', '*=']`, but `['**=']`. + + +### Version 1.0.3 (2016-03-27) ### + +- Improved: Made the regex ever so slightly smaller. +- Updated: The readme. + + +### Version 1.0.2 (2015-10-18) ### + +- Improved: Limited npm package contents for a smaller download. Thanks to + @zertosh! + + +### Version 1.0.1 (2015-06-20) ### + +- Fixed: Declared an undeclared variable. + + +### Version 1.0.0 (2015-02-26) ### + +- Changed: Merged the 'operator' and 'punctuation' types into 'punctuator'. That + type is now equivalent to the Punctuator token in the ECMAScript + specification. (Backwards-incompatible change.) +- Fixed: A `-` followed by a number is now correctly matched as a punctuator + followed by a number. It used to be matched as just a number, but there is no + such thing as negative number literals. (Possibly backwards-incompatible + change.) + + +### Version 0.4.1 (2015-02-21) ### + +- Added: Support for the regex `u` flag. + + +### Version 0.4.0 (2015-02-21) ### + +- Improved: `jsTokens.matchToToken` performance. +- Added: Support for octal and binary number literals. +- Added: Support for template strings. + + +### Version 0.3.1 (2015-01-06) ### + +- Fixed: Support for unicode spaces. They used to be allowed in names (which is + very confusing), and some unicode newlines were wrongly allowed in strings and + regexes. + + +### Version 0.3.0 (2014-12-19) ### + +- Changed: The `jsTokens.names` array has been replaced with the + `jsTokens.matchToToken` function. The capturing groups of `jsTokens` are no + longer part of the public API; instead use said function. See this [gist] for + an example. (Backwards-incompatible change.) +- Changed: The empty string is now considered an “invalid” token, instead an + “empty” token (its own group). (Backwards-incompatible change.) +- Removed: component support. (Backwards-incompatible change.) + +[gist]: https://gist.github.com/lydell/be49dbf80c382c473004 + + +### Version 0.2.0 (2014-06-19) ### + +- Changed: Match ES6 function arrows (`=>`) as an operator, instead of its own + category (“functionArrow”), for simplicity. (Backwards-incompatible change.) +- Added: ES6 splats (`...`) are now matched as an operator (instead of three + punctuations). (Backwards-incompatible change.) + + +### Version 0.1.0 (2014-03-08) ### + +- Initial release. diff --git a/node_modules/js-tokens/LICENSE b/node_modules/js-tokens/LICENSE new file mode 100644 index 0000000..54aef52 --- /dev/null +++ b/node_modules/js-tokens/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014, 2015, 2016, 2017, 2018 Simon Lydell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/js-tokens/README.md b/node_modules/js-tokens/README.md new file mode 100644 index 0000000..00cdf16 --- /dev/null +++ b/node_modules/js-tokens/README.md @@ -0,0 +1,240 @@ +Overview [![Build Status](https://travis-ci.org/lydell/js-tokens.svg?branch=master)](https://travis-ci.org/lydell/js-tokens) +======== + +A regex that tokenizes JavaScript. + +```js +var jsTokens = require("js-tokens").default + +var jsString = "var foo=opts.foo;\n..." + +jsString.match(jsTokens) +// ["var", " ", "foo", "=", "opts", ".", "foo", ";", "\n", ...] +``` + + +Installation +============ + +`npm install js-tokens` + +```js +import jsTokens from "js-tokens" +// or: +var jsTokens = require("js-tokens").default +``` + + +Usage +===== + +### `jsTokens` ### + +A regex with the `g` flag that matches JavaScript tokens. + +The regex _always_ matches, even invalid JavaScript and the empty string. + +The next match is always directly after the previous. + +### `var token = matchToToken(match)` ### + +```js +import {matchToToken} from "js-tokens" +// or: +var matchToToken = require("js-tokens").matchToToken +``` + +Takes a `match` returned by `jsTokens.exec(string)`, and returns a `{type: +String, value: String}` object. The following types are available: + +- string +- comment +- regex +- number +- name +- punctuator +- whitespace +- invalid + +Multi-line comments and strings also have a `closed` property indicating if the +token was closed or not (see below). + +Comments and strings both come in several flavors. To distinguish them, check if +the token starts with `//`, `/*`, `'`, `"` or `` ` ``. + +Names are ECMAScript IdentifierNames, that is, including both identifiers and +keywords. You may use [is-keyword-js] to tell them apart. + +Whitespace includes both line terminators and other whitespace. + +[is-keyword-js]: https://github.com/crissdev/is-keyword-js + + +ECMAScript support +================== + +The intention is to always support the latest ECMAScript version whose feature +set has been finalized. + +If adding support for a newer version requires changes, a new version with a +major verion bump will be released. + +Currently, ECMAScript 2018 is supported. + + +Invalid code handling +===================== + +Unterminated strings are still matched as strings. JavaScript strings cannot +contain (unescaped) newlines, so unterminated strings simply end at the end of +the line. Unterminated template strings can contain unescaped newlines, though, +so they go on to the end of input. + +Unterminated multi-line comments are also still matched as comments. They +simply go on to the end of the input. + +Unterminated regex literals are likely matched as division and whatever is +inside the regex. + +Invalid ASCII characters have their own capturing group. + +Invalid non-ASCII characters are treated as names, to simplify the matching of +names (except unicode spaces which are treated as whitespace). Note: See also +the [ES2018](#es2018) section. + +Regex literals may contain invalid regex syntax. They are still matched as +regex literals. They may also contain repeated regex flags, to keep the regex +simple. + +Strings may contain invalid escape sequences. + + +Limitations +=========== + +Tokenizing JavaScript using regexes—in fact, _one single regex_—won’t be +perfect. But that’s not the point either. + +You may compare jsTokens with [esprima] by using `esprima-compare.js`. +See `npm run esprima-compare`! + +[esprima]: http://esprima.org/ + +### Template string interpolation ### + +Template strings are matched as single tokens, from the starting `` ` `` to the +ending `` ` ``, including interpolations (whose tokens are not matched +individually). + +Matching template string interpolations requires recursive balancing of `{` and +`}`—something that JavaScript regexes cannot do. Only one level of nesting is +supported. + +### Division and regex literals collision ### + +Consider this example: + +```js +var g = 9.82 +var number = bar / 2/g + +var regex = / 2/g +``` + +A human can easily understand that in the `number` line we’re dealing with +division, and in the `regex` line we’re dealing with a regex literal. How come? +Because humans can look at the whole code to put the `/` characters in context. +A JavaScript regex cannot. It only sees forwards. (Well, ES2018 regexes can also +look backwards. See the [ES2018](#es2018) section). + +When the `jsTokens` regex scans throught the above, it will see the following +at the end of both the `number` and `regex` rows: + +```js +/ 2/g +``` + +It is then impossible to know if that is a regex literal, or part of an +expression dealing with division. + +Here is a similar case: + +```js +foo /= 2/g +foo(/= 2/g) +``` + +The first line divides the `foo` variable with `2/g`. The second line calls the +`foo` function with the regex literal `/= 2/g`. Again, since `jsTokens` only +sees forwards, it cannot tell the two cases apart. + +There are some cases where we _can_ tell division and regex literals apart, +though. + +First off, we have the simple cases where there’s only one slash in the line: + +```js +var foo = 2/g +foo /= 2 +``` + +Regex literals cannot contain newlines, so the above cases are correctly +identified as division. Things are only problematic when there are more than +one non-comment slash in a single line. + +Secondly, not every character is a valid regex flag. + +```js +var number = bar / 2/e +``` + +The above example is also correctly identified as division, because `e` is not a +valid regex flag. I initially wanted to future-proof by allowing `[a-zA-Z]*` +(any letter) as flags, but it is not worth it since it increases the amount of +ambigous cases. So only the standard `g`, `m`, `i`, `y` and `u` flags are +allowed. This means that the above example will be identified as division as +long as you don’t rename the `e` variable to some permutation of `gmiyus` 1 to 6 +characters long. + +Lastly, we can look _forward_ for information. + +- If the token following what looks like a regex literal is not valid after a + regex literal, but is valid in a division expression, then the regex literal + is treated as division instead. For example, a flagless regex cannot be + followed by a string, number or name, but all of those three can be the + denominator of a division. +- Generally, if what looks like a regex literal is followed by an operator, the + regex literal is treated as division instead. This is because regexes are + seldomly used with operators (such as `+`, `*`, `&&` and `==`), but division + could likely be part of such an expression. + +Please consult the regex source and the test cases for precise information on +when regex or division is matched (should you need to know). In short, you +could sum it up as: + +If the end of a statement looks like a regex literal (even if it isn’t), it +will be treated as one. Otherwise it should work as expected (if you write sane +code). + +### ES2018 ### + +ES2018 added some nice regex improvements to the language. + +- [Unicode property escapes] should allow telling names and invalid non-ASCII + characters apart without blowing up the regex size. +- [Lookbehind assertions] should allow matching telling division and regex + literals apart in more cases. +- [Named capture groups] might simplify some things. + +These things would be nice to do, but are not critical. They probably have to +wait until the oldest maintained Node.js LTS release supports those features. + +[Unicode property escapes]: http://2ality.com/2017/07/regexp-unicode-property-escapes.html +[Lookbehind assertions]: http://2ality.com/2017/05/regexp-lookbehind-assertions.html +[Named capture groups]: http://2ality.com/2017/05/regexp-named-capture-groups.html + + +License +======= + +[MIT](LICENSE). diff --git a/node_modules/js-tokens/index.js b/node_modules/js-tokens/index.js new file mode 100644 index 0000000..b23a4a0 --- /dev/null +++ b/node_modules/js-tokens/index.js @@ -0,0 +1,23 @@ +// Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell +// License: MIT. (See LICENSE.) + +Object.defineProperty(exports, "__esModule", { + value: true +}) + +// This regex comes from regex.coffee, and is inserted here by generate-index.js +// (run `npm run build`). +exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g + +exports.matchToToken = function(match) { + var token = {type: "invalid", value: match[0], closed: undefined} + if (match[ 1]) token.type = "string" , token.closed = !!(match[3] || match[4]) + else if (match[ 5]) token.type = "comment" + else if (match[ 6]) token.type = "comment", token.closed = !!match[7] + else if (match[ 8]) token.type = "regex" + else if (match[ 9]) token.type = "number" + else if (match[10]) token.type = "name" + else if (match[11]) token.type = "punctuator" + else if (match[12]) token.type = "whitespace" + return token +} diff --git a/node_modules/js-tokens/package.json b/node_modules/js-tokens/package.json new file mode 100644 index 0000000..66752fa --- /dev/null +++ b/node_modules/js-tokens/package.json @@ -0,0 +1,30 @@ +{ + "name": "js-tokens", + "version": "4.0.0", + "author": "Simon Lydell", + "license": "MIT", + "description": "A regex that tokenizes JavaScript.", + "keywords": [ + "JavaScript", + "js", + "token", + "tokenize", + "regex" + ], + "files": [ + "index.js" + ], + "repository": "lydell/js-tokens", + "scripts": { + "test": "mocha --ui tdd", + "esprima-compare": "node esprima-compare ./index.js everything.js/es5.js", + "build": "node generate-index.js", + "dev": "npm run build && npm test" + }, + "devDependencies": { + "coffeescript": "2.1.1", + "esprima": "4.0.0", + "everything.js": "1.0.3", + "mocha": "5.0.0" + } +} diff --git a/node_modules/loose-envify/LICENSE b/node_modules/loose-envify/LICENSE new file mode 100644 index 0000000..fbafb48 --- /dev/null +++ b/node_modules/loose-envify/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Andres Suarez + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/loose-envify/README.md b/node_modules/loose-envify/README.md new file mode 100644 index 0000000..7f4e07b --- /dev/null +++ b/node_modules/loose-envify/README.md @@ -0,0 +1,45 @@ +# loose-envify + +[![Build Status](https://travis-ci.org/zertosh/loose-envify.svg?branch=master)](https://travis-ci.org/zertosh/loose-envify) + +Fast (and loose) selective `process.env` replacer using [js-tokens](https://github.com/lydell/js-tokens) instead of an AST. Works just like [envify](https://github.com/hughsk/envify) but much faster. + +## Gotchas + +* Doesn't handle broken syntax. +* Doesn't look inside embedded expressions in template strings. + - **this won't work:** + ```js + console.log(`the current env is ${process.env.NODE_ENV}`); + ``` +* Doesn't replace oddly-spaced or oddly-commented expressions. + - **this won't work:** + ```js + console.log(process./*won't*/env./*work*/NODE_ENV); + ``` + +## Usage/Options + +loose-envify has the exact same interface as [envify](https://github.com/hughsk/envify), including the CLI. + +## Benchmark + +``` +envify: + + $ for i in {1..5}; do node bench/bench.js 'envify'; done + 708ms + 727ms + 791ms + 719ms + 720ms + +loose-envify: + + $ for i in {1..5}; do node bench/bench.js '../'; done + 51ms + 52ms + 52ms + 52ms + 52ms +``` diff --git a/node_modules/loose-envify/cli.js b/node_modules/loose-envify/cli.js new file mode 100755 index 0000000..c0b63cb --- /dev/null +++ b/node_modules/loose-envify/cli.js @@ -0,0 +1,16 @@ +#!/usr/bin/env node +'use strict'; + +var looseEnvify = require('./'); +var fs = require('fs'); + +if (process.argv[2]) { + fs.createReadStream(process.argv[2], {encoding: 'utf8'}) + .pipe(looseEnvify(process.argv[2])) + .pipe(process.stdout); +} else { + process.stdin.resume() + process.stdin + .pipe(looseEnvify(__filename)) + .pipe(process.stdout); +} diff --git a/node_modules/loose-envify/custom.js b/node_modules/loose-envify/custom.js new file mode 100644 index 0000000..6389bfa --- /dev/null +++ b/node_modules/loose-envify/custom.js @@ -0,0 +1,4 @@ +// envify compatibility +'use strict'; + +module.exports = require('./loose-envify'); diff --git a/node_modules/loose-envify/index.js b/node_modules/loose-envify/index.js new file mode 100644 index 0000000..8cd8305 --- /dev/null +++ b/node_modules/loose-envify/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./loose-envify')(process.env); diff --git a/node_modules/loose-envify/loose-envify.js b/node_modules/loose-envify/loose-envify.js new file mode 100644 index 0000000..b5a5be2 --- /dev/null +++ b/node_modules/loose-envify/loose-envify.js @@ -0,0 +1,36 @@ +'use strict'; + +var stream = require('stream'); +var util = require('util'); +var replace = require('./replace'); + +var jsonExtRe = /\.json$/; + +module.exports = function(rootEnv) { + rootEnv = rootEnv || process.env; + return function (file, trOpts) { + if (jsonExtRe.test(file)) { + return stream.PassThrough(); + } + var envs = trOpts ? [rootEnv, trOpts] : [rootEnv]; + return new LooseEnvify(envs); + }; +}; + +function LooseEnvify(envs) { + stream.Transform.call(this); + this._data = ''; + this._envs = envs; +} +util.inherits(LooseEnvify, stream.Transform); + +LooseEnvify.prototype._transform = function(buf, enc, cb) { + this._data += buf; + cb(); +}; + +LooseEnvify.prototype._flush = function(cb) { + var replaced = replace(this._data, this._envs); + this.push(replaced); + cb(); +}; diff --git a/node_modules/loose-envify/package.json b/node_modules/loose-envify/package.json new file mode 100644 index 0000000..5e3d0e2 --- /dev/null +++ b/node_modules/loose-envify/package.json @@ -0,0 +1,36 @@ +{ + "name": "loose-envify", + "version": "1.4.0", + "description": "Fast (and loose) selective `process.env` replacer using js-tokens instead of an AST", + "keywords": [ + "environment", + "variables", + "browserify", + "browserify-transform", + "transform", + "source", + "configuration" + ], + "homepage": "https://github.com/zertosh/loose-envify", + "license": "MIT", + "author": "Andres Suarez ", + "main": "index.js", + "bin": { + "loose-envify": "cli.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/zertosh/loose-envify.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "devDependencies": { + "browserify": "^13.1.1", + "envify": "^3.4.0", + "tap": "^8.0.0" + } +} diff --git a/node_modules/loose-envify/replace.js b/node_modules/loose-envify/replace.js new file mode 100644 index 0000000..ec15e81 --- /dev/null +++ b/node_modules/loose-envify/replace.js @@ -0,0 +1,65 @@ +'use strict'; + +var jsTokens = require('js-tokens').default; + +var processEnvRe = /\bprocess\.env\.[_$a-zA-Z][$\w]+\b/; +var spaceOrCommentRe = /^(?:\s|\/[/*])/; + +function replace(src, envs) { + if (!processEnvRe.test(src)) { + return src; + } + + var out = []; + var purge = envs.some(function(env) { + return env._ && env._.indexOf('purge') !== -1; + }); + + jsTokens.lastIndex = 0 + var parts = src.match(jsTokens); + + for (var i = 0; i < parts.length; i++) { + if (parts[i ] === 'process' && + parts[i + 1] === '.' && + parts[i + 2] === 'env' && + parts[i + 3] === '.') { + var prevCodeToken = getAdjacentCodeToken(-1, parts, i); + var nextCodeToken = getAdjacentCodeToken(1, parts, i + 4); + var replacement = getReplacementString(envs, parts[i + 4], purge); + if (prevCodeToken !== '.' && + nextCodeToken !== '.' && + nextCodeToken !== '=' && + typeof replacement === 'string') { + out.push(replacement); + i += 4; + continue; + } + } + out.push(parts[i]); + } + + return out.join(''); +} + +function getAdjacentCodeToken(dir, parts, i) { + while (true) { + var part = parts[i += dir]; + if (!spaceOrCommentRe.test(part)) { + return part; + } + } +} + +function getReplacementString(envs, name, purge) { + for (var j = 0; j < envs.length; j++) { + var env = envs[j]; + if (typeof env[name] !== 'undefined') { + return JSON.stringify(env[name]); + } + } + if (purge) { + return 'undefined'; + } +} + +module.exports = replace; diff --git a/node_modules/memoize-one/LICENSE b/node_modules/memoize-one/LICENSE new file mode 100644 index 0000000..c7856e2 --- /dev/null +++ b/node_modules/memoize-one/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Alexander Reardon + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/node_modules/memoize-one/README.md b/node_modules/memoize-one/README.md new file mode 100644 index 0000000..79a4489 --- /dev/null +++ b/node_modules/memoize-one/README.md @@ -0,0 +1,252 @@ +# memoize-one + +A memoization library that only caches the result of the most recent arguments. + +[![Build Status](https://travis-ci.org/alexreardon/memoize-one.svg?branch=master)](https://travis-ci.org/alexreardon/memoize-one) +[![npm](https://img.shields.io/npm/v/memoize-one.svg)](https://www.npmjs.com/package/memoize-one) +[![dependencies](https://david-dm.org/alexreardon/memoize-one.svg)](https://david-dm.org/alexreardon/memoize-one) +[![Downloads per month](https://img.shields.io/npm/dm/memoize-one.svg)](https://www.npmjs.com/package/memoize-one) +[![min](https://img.shields.io/bundlephobia/min/memoize-one.svg)](https://www.npmjs.com/package/memoize-one) +[![minzip](https://img.shields.io/bundlephobia/minzip/memoize-one.svg)](https://www.npmjs.com/package/memoize-one) + +## Rationale + +Cache invalidation is hard: + +> There are only two hard things in Computer Science: cache invalidation and naming things. +> +> *Phil Karlton* + +So keep things simple and just use a cache size of one! + +Unlike other memoization libraries, `memoize-one` only remembers the latest arguments and result. No need to worry about cache busting mechanisms such as `maxAge`, `maxSize`, `exclusions` and so on which can be prone to memory leaks. `memoize-one` simply remembers the last arguments, and if the function is next called with the same arguments then it returns the previous result. + +## Usage + +### Standard usage + +```js +import memoizeOne from 'memoize-one'; + +const add = (a, b) => a + b; +const memoizedAdd = memoizeOne(add); + +memoizedAdd(1, 2); // 3 + +memoizedAdd(1, 2); // 3 +// Add function is not executed: previous result is returned + +memoizedAdd(2, 3); // 5 +// Add function is called to get new value + +memoizedAdd(2, 3); // 5 +// Add function is not executed: previous result is returned + +memoizedAdd(1, 2); // 3 +// Add function is called to get new value. +// While this was previously cached, +// it is not the latest so the cached result is lost +``` + +### Custom equality function + +You can also pass in a custom function for checking the equality of two items. + +```js +import memoizeOne from 'memoize-one'; +import deepEqual from 'lodash.isEqual'; + +const identity = x => x; + +const defaultMemoization = memoizeOne(identity); +const customMemoization = memoizeOne(identity, deepEqual); + +const result1 = defaultMemoization({foo: 'bar'}); +const result2 = defaultMemoization({foo: 'bar'}); + +result1 === result2 // false - difference reference + +const result3 = customMemoization({foo: 'bar'}); +const result4 = customMemoization({foo: 'bar'}); + +result3 === result4 // true - arguments are deep equal +``` + +#### Equality function type signature + +Here is the expected [flow](http://flowtype.org) type signature for a custom equality function: + +```js +type EqualityFn = (a: mixed, b: mixed) => boolean; +``` + +#### Custom equality function with multiple arguments + +If the function you want to memoize takes multiple arguments, your custom equality function will be called once for each argument and will be passed each argument's new value and last value. + +```js +import memoizeOne from 'memoize-one'; + +const makeCountObj = (first, second, third) => ({ + first: first.count, + second: second.count, + third: third.count, +}); + +const areCountPropertiesEqual = (newArg, lastArg) => newArg.count === lastArg.count; +// runs once for first's new and last values, once for second's, etc. + +const memoizedMakeCountObj = memoizeOne(makeCountObj, areCountPropertiesEqual); + +const result1 = memoizedMakeCountObj( + {a: '?', count: 1}, + {a: '$', count: 2}, + {a: '#', count: 3} +); +const result2 = memoizedMakeCountObj( + {b: null, count: 1}, + {b: null, count: 2}, + {b: null, count: 3} +); + +result1 === result2; // true - same reference +``` + +## Installation + +```bash +# yarn +yarn add memoize-one + +# npm +npm install memoize-one --save +``` + +## Module usage + +### ES6 module + +```js +import memoizeOne from 'memoize-one'; +``` + +### CommonJS + +If you are in a CommonJS environment (eg [Node](https://nodejs.org)), then **you will need to add `.default` to your import**: + +```js +const memoizeOne = require('memoize-one').default; +``` + +## `this` + +### `memoize-one` correctly respects `this` control + +This library takes special care to maintain, and allow control over the the `this` context for **both** the original function being memoized as well as the returned memoized function. Both the original function and the memoized function's `this` context respect [all the `this` controlling techniques](https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%20object%20prototypes/ch2.md): + +- new bindings (`new`) +- explicit binding (`call`, `apply`, `bind`); +- implicit binding (call site: `obj.foo()`); +- default binding (`window` or `undefined` in `strict mode`); +- fat arrow binding (binding to lexical `this`) +- ignored this (pass `null` as `this` to explicit binding) + +### Changes to `this` is considered an argument change + +Changes to the running context (`this`) of a function can result in the function returning a different value even though its arguments have stayed the same: + +```js +function getA() { + return this.a; +} + +const temp1 = { + a: 20, +}; +const temp2 = { + a: 30, +} + +getA.call(temp1); // 20 +getA.call(temp2); // 30 +``` + +Therefore, in order to prevent against unexpected results, `memoize-one` takes into account the current execution context (`this`) of the memoized function. If `this` is different to the previous invocation then it is considered a change in argument. [further discussion](https://github.com/alexreardon/memoize-one/issues/3). + +Generally this will be of no impact if you are not explicity controlling the `this` context of functions you want to memoize with [explicit binding](https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%20object%20prototypes/ch2.md#explicit-binding) or [implicit binding](https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%20object%20prototypes/ch2.md#implicit-binding). `memoize-One` will detect when you are manipulating `this` and will then consider the `this` context as an argument. If `this` changes, it will re-execute the original function even if the arguments have not changed. + +## When your result function `throw`s + +> There is no caching when your result function throws + +If your result function `throw`s then the memoized function will also throw. The throw will not break the memoized functions existing argument cache. It means the memoized function will pretend like it was never called with arguments that made it `throw`. + +```js +const canThrow = (name: string) => { + console.log('called'); + if(name === 'throw') { + throw new Error(name); + } + return { name }; +} + +const memoized = memoizeOne(canThrow); + +const value1 = memoized('Alex'); +// console.log => 'called' +const value2 = memoized('Alex'); +// result function not called + +console.log(value1 === value2); +// console.log => true + +try { + memoized('throw'); + // console.log => 'called' +} catch(e) { + firstError = e; +} + +try { + memoized('throw'); + // console.log => 'called' + // the result function was called again even though it was called twice + // with the 'throw' string +} catch(e) { + secondError = e; +} + +console.log(firstError !== secondError); + + +const value3 = memoized('Alex'); +// result function not called as the original memoization cache has not been busted +console.log(value1 === value3); +// console.log => true +``` + +## Performance :rocket: + +### Tiny + +`memoize-one` is super lightweight at [![min](https://img.shields.io/bundlephobia/min/memoize-one.svg?label=)](https://www.npmjs.com/package/memoize-one) minified and [![minzip](https://img.shields.io/bundlephobia/minzip/memoize-one.svg?label=)](https://www.npmjs.com/package/memoize-one) gzipped. (`1KB` = `1,024 Bytes`) + +### Extremely fast + +`memoize-one` performs better or on par with than other popular memoization libraries for the purpose of remembering the latest invocation. + +**Results** + +- [simple arguments](https://www.measurethat.net/Benchmarks/ShowResult/4452) +- [complex arguments](https://www.measurethat.net/Benchmarks/ShowResult/4488) + +The comparisions are not exhaustive and are primiarly to show that `memoize-one` accomplishes remembering the latest invocation really fast. The benchmarks do not take into account the differences in feature sets, library sizes, parse time, and so on. + +## Code health :thumbsup: + +- Tested with all built in [JavaScript types](https://github.com/getify/You-Dont-Know-JS/blob/master/types%20%26%20grammar/ch1.md). +- 100% code coverage +- [Continuous integration](https://travis-ci.org/alexreardon/memoize-one) to run tests and type checks. +- [`Flow` types](http://flowtype.org) for safer internal execution and external consumption. Also allows for editor autocompletion. +- Follows [Semantic versioning (2.0)](http://semver.org/) for safer consumption. +- No dependencies diff --git a/node_modules/memoize-one/dist/memoize-one.cjs.js b/node_modules/memoize-one/dist/memoize-one.cjs.js new file mode 100644 index 0000000..601deb6 --- /dev/null +++ b/node_modules/memoize-one/dist/memoize-one.cjs.js @@ -0,0 +1,40 @@ +'use strict'; + +var simpleIsEqual = function simpleIsEqual(a, b) { + return a === b; +}; + +function index (resultFn, isEqual) { + if (isEqual === void 0) { + isEqual = simpleIsEqual; + } + + var lastThis; + var lastArgs = []; + var lastResult; + var calledOnce = false; + + var isNewArgEqualToLast = function isNewArgEqualToLast(newArg, index) { + return isEqual(newArg, lastArgs[index]); + }; + + var result = function result() { + for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) { + newArgs[_key] = arguments[_key]; + } + + if (calledOnce && lastThis === this && newArgs.length === lastArgs.length && newArgs.every(isNewArgEqualToLast)) { + return lastResult; + } + + lastResult = resultFn.apply(this, newArgs); + calledOnce = true; + lastThis = this; + lastArgs = newArgs; + return lastResult; + }; + + return result; +} + +module.exports = index; diff --git a/node_modules/memoize-one/dist/memoize-one.cjs.js.flow b/node_modules/memoize-one/dist/memoize-one.cjs.js.flow new file mode 100644 index 0000000..6a6528b --- /dev/null +++ b/node_modules/memoize-one/dist/memoize-one.cjs.js.flow @@ -0,0 +1,3 @@ +// @flow + +export * from '../src'; diff --git a/node_modules/memoize-one/dist/memoize-one.esm.js b/node_modules/memoize-one/dist/memoize-one.esm.js new file mode 100644 index 0000000..7bd06fc --- /dev/null +++ b/node_modules/memoize-one/dist/memoize-one.esm.js @@ -0,0 +1,38 @@ +var simpleIsEqual = function simpleIsEqual(a, b) { + return a === b; +}; + +function index (resultFn, isEqual) { + if (isEqual === void 0) { + isEqual = simpleIsEqual; + } + + var lastThis; + var lastArgs = []; + var lastResult; + var calledOnce = false; + + var isNewArgEqualToLast = function isNewArgEqualToLast(newArg, index) { + return isEqual(newArg, lastArgs[index]); + }; + + var result = function result() { + for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) { + newArgs[_key] = arguments[_key]; + } + + if (calledOnce && lastThis === this && newArgs.length === lastArgs.length && newArgs.every(isNewArgEqualToLast)) { + return lastResult; + } + + lastResult = resultFn.apply(this, newArgs); + calledOnce = true; + lastThis = this; + lastArgs = newArgs; + return lastResult; + }; + + return result; +} + +export default index; diff --git a/node_modules/memoize-one/dist/memoize-one.js b/node_modules/memoize-one/dist/memoize-one.js new file mode 100644 index 0000000..080dd2e --- /dev/null +++ b/node_modules/memoize-one/dist/memoize-one.js @@ -0,0 +1,46 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.memoizeOne = factory()); +}(this, (function () { 'use strict'; + + var simpleIsEqual = function simpleIsEqual(a, b) { + return a === b; + }; + + function index (resultFn, isEqual) { + if (isEqual === void 0) { + isEqual = simpleIsEqual; + } + + var lastThis; + var lastArgs = []; + var lastResult; + var calledOnce = false; + + var isNewArgEqualToLast = function isNewArgEqualToLast(newArg, index) { + return isEqual(newArg, lastArgs[index]); + }; + + var result = function result() { + for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) { + newArgs[_key] = arguments[_key]; + } + + if (calledOnce && lastThis === this && newArgs.length === lastArgs.length && newArgs.every(isNewArgEqualToLast)) { + return lastResult; + } + + lastResult = resultFn.apply(this, newArgs); + calledOnce = true; + lastThis = this; + lastArgs = newArgs; + return lastResult; + }; + + return result; + } + + return index; + +}))); diff --git a/node_modules/memoize-one/dist/memoize-one.min.js b/node_modules/memoize-one/dist/memoize-one.min.js new file mode 100644 index 0000000..25feb32 --- /dev/null +++ b/node_modules/memoize-one/dist/memoize-one.min.js @@ -0,0 +1 @@ +!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.memoizeOne=n()}(this,function(){"use strict";var e=function(e,n){return e===n};return function(r,t){var i;void 0===t&&(t=e);var o,u=[],f=!1,c=function(e,n){return t(e,u[n])};return function(){for(var e=arguments.length,n=new Array(e),t=0;t", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/alexreardon/memoize-one.git" + }, + "files": [ + "/dist", + "/src" + ], + "keywords": [ + "memoize", + "memoization", + "cache", + "performance" + ], + "dependencies": {}, + "devDependencies": { + "@babel/core": "^7.1.5", + "@babel/preset-env": "^7.1.5", + "@babel/preset-flow": "^7.0.0", + "babel-core": "^7.0.0-bridge.0", + "babel-eslint": "10.0.1", + "babel-jest": "^23.6.0", + "cross-env": "^5.2.0", + "eslint": "5.8.0", + "eslint-plugin-flowtype": "^3.2.0", + "eslint-plugin-jest": "^21.27.2", + "flow-bin": "0.85.0", + "jest": "^23.6.0", + "rimraf": "2.6.2", + "rollup": "^0.67.0", + "rollup-plugin-babel": "^4.0.3", + "rollup-plugin-commonjs": "^9.1.6", + "rollup-plugin-replace": "^2.0.0", + "rollup-plugin-uglify": "^6.0.0" + }, + "scripts": { + "validate": "yarn run lint && yarn run typecheck", + "test": "cross-env NODE_ENV=test jest", + "typecheck": "flow check", + "lint": "eslint src test", + "build": "yarn run build:clean && yarn run build:dist && yarn run build:flow", + "build:clean": "rimraf dist", + "build:dist": "rollup -c", + "build:flow": "echo \"// @flow\n\nexport * from '../src';\" > dist/memoize-one.cjs.js.flow", + "prepublish": "yarn run build" + } +} diff --git a/node_modules/memoize-one/src/index.js b/node_modules/memoize-one/src/index.js new file mode 100644 index 0000000..f0f64d4 --- /dev/null +++ b/node_modules/memoize-one/src/index.js @@ -0,0 +1,41 @@ +// @flow +type EqualityFn = (a: mixed, b: mixed) => boolean; + +const simpleIsEqual: EqualityFn = (a: mixed, b: mixed): boolean => a === b; + +// ) => mixed> +// The purpose of this typing is to ensure that the returned memoized +// function has the same type as the provided function (`resultFn`). +// ResultFn: Generic type (which is the same as the resultFn). +// (...Array): Accepts any length of arguments - and they are not checked +// mixed: The result can be anything but needs to be checked before usage +export default function ) => mixed>(resultFn: ResultFn, isEqual?: EqualityFn = simpleIsEqual): ResultFn { + let lastThis: mixed; + let lastArgs: Array = []; + let lastResult: mixed; + let calledOnce: boolean = false; + + const isNewArgEqualToLast = (newArg: mixed, index: number): boolean => isEqual(newArg, lastArgs[index]); + + // breaking cache when context (this) or arguments change + const result = function (...newArgs: Array) { + if (calledOnce && + lastThis === this && + newArgs.length === lastArgs.length && + newArgs.every(isNewArgEqualToLast)) { + return lastResult; + } + + // Throwing during an assignment aborts the assignment: https://codepen.io/alexreardon/pen/RYKoaz + // Doing the lastResult assignment first so that if it throws + // nothing will be overwritten + lastResult = resultFn.apply(this, newArgs); + calledOnce = true; + lastThis = this; + lastArgs = newArgs; + return lastResult; + }; + + // telling flow to ignore the type of `result` as we know it is `ResultFn` + return (result: any); +} \ No newline at end of file diff --git a/node_modules/object-assign/index.js b/node_modules/object-assign/index.js new file mode 100644 index 0000000..0930cf8 --- /dev/null +++ b/node_modules/object-assign/index.js @@ -0,0 +1,90 @@ +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ + +'use strict'; +/* eslint-disable no-unused-vars */ +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var propIsEnumerable = Object.prototype.propertyIsEnumerable; + +function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); +} + +function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } +} + +module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; +}; diff --git a/node_modules/object-assign/license b/node_modules/object-assign/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/object-assign/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/object-assign/package.json b/node_modules/object-assign/package.json new file mode 100644 index 0000000..503eb1e --- /dev/null +++ b/node_modules/object-assign/package.json @@ -0,0 +1,42 @@ +{ + "name": "object-assign", + "version": "4.1.1", + "description": "ES2015 `Object.assign()` ponyfill", + "license": "MIT", + "repository": "sindresorhus/object-assign", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava", + "bench": "matcha bench.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "object", + "assign", + "extend", + "properties", + "es2015", + "ecmascript", + "harmony", + "ponyfill", + "prollyfill", + "polyfill", + "shim", + "browser" + ], + "devDependencies": { + "ava": "^0.16.0", + "lodash": "^4.16.4", + "matcha": "^0.7.0", + "xo": "^0.16.0" + } +} diff --git a/node_modules/object-assign/readme.md b/node_modules/object-assign/readme.md new file mode 100644 index 0000000..1be09d3 --- /dev/null +++ b/node_modules/object-assign/readme.md @@ -0,0 +1,61 @@ +# object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign) + +> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) [ponyfill](https://ponyfill.com) + + +## Use the built-in + +Node.js 4 and up, as well as every evergreen browser (Chrome, Edge, Firefox, Opera, Safari), +support `Object.assign()` :tada:. If you target only those environments, then by all +means, use `Object.assign()` instead of this package. + + +## Install + +``` +$ npm install --save object-assign +``` + + +## Usage + +```js +const objectAssign = require('object-assign'); + +objectAssign({foo: 0}, {bar: 1}); +//=> {foo: 0, bar: 1} + +// multiple sources +objectAssign({foo: 0}, {bar: 1}, {baz: 2}); +//=> {foo: 0, bar: 1, baz: 2} + +// overwrites equal keys +objectAssign({foo: 0}, {foo: 1}, {foo: 2}); +//=> {foo: 2} + +// ignores null and undefined sources +objectAssign({foo: 0}, null, {bar: 1}, undefined); +//=> {foo: 0, bar: 1} +``` + + +## API + +### objectAssign(target, [source, ...]) + +Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones. + + +## Resources + +- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign) + + +## Related + +- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/prop-types/LICENSE b/node_modules/prop-types/LICENSE new file mode 100644 index 0000000..188fb2b --- /dev/null +++ b/node_modules/prop-types/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013-present, Facebook, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/prop-types/README.md b/node_modules/prop-types/README.md new file mode 100644 index 0000000..e54d435 --- /dev/null +++ b/node_modules/prop-types/README.md @@ -0,0 +1,302 @@ +# prop-types [![Build Status](https://travis-ci.com/facebook/prop-types.svg?branch=main)](https://travis-ci.org/facebook/prop-types) + +Runtime type checking for React props and similar objects. + +You can use prop-types to document the intended types of properties passed to +components. React (and potentially other libraries—see the `checkPropTypes()` +reference below) will check props passed to your components against those +definitions, and warn in development if they don’t match. + +## Installation + +```shell +npm install --save prop-types +``` + +## Importing + +```js +import PropTypes from 'prop-types'; // ES6 +var PropTypes = require('prop-types'); // ES5 with npm +``` + +### CDN + +If you prefer to exclude `prop-types` from your application and use it +globally via `window.PropTypes`, the `prop-types` package provides +single-file distributions, which are hosted on the following CDNs: + +* [**unpkg**](https://unpkg.com/prop-types/) +```html + + + + + +``` + +* [**cdnjs**](https://cdnjs.com/libraries/prop-types) +```html + + + + + +``` + +To load a specific version of `prop-types` replace `15.6.0` with the version number. + +## Usage + +PropTypes was originally exposed as part of the React core module, and is +commonly used with React components. +Here is an example of using PropTypes with a React component, which also +documents the different validators provided: + +```js +import React from 'react'; +import PropTypes from 'prop-types'; + +class MyComponent extends React.Component { + render() { + // ... do things with the props + } +} + +MyComponent.propTypes = { + // You can declare that a prop is a specific JS primitive. By default, these + // are all optional. + optionalArray: PropTypes.array, + optionalBigInt: PropTypes.bigint, + optionalBool: PropTypes.bool, + optionalFunc: PropTypes.func, + optionalNumber: PropTypes.number, + optionalObject: PropTypes.object, + optionalString: PropTypes.string, + optionalSymbol: PropTypes.symbol, + + // Anything that can be rendered: numbers, strings, elements or an array + // (or fragment) containing these types. + // see https://reactjs.org/docs/rendering-elements.html for more info + optionalNode: PropTypes.node, + + // A React element (ie. ). + optionalElement: PropTypes.element, + + // A React element type (eg. MyComponent). + // a function, string, or "element-like" object (eg. React.Fragment, Suspense, etc.) + // see https://github.com/facebook/react/blob/HEAD/packages/shared/isValidElementType.js + optionalElementType: PropTypes.elementType, + + // You can also declare that a prop is an instance of a class. This uses + // JS's instanceof operator. + optionalMessage: PropTypes.instanceOf(Message), + + // You can ensure that your prop is limited to specific values by treating + // it as an enum. + optionalEnum: PropTypes.oneOf(['News', 'Photos']), + + // An object that could be one of many types + optionalUnion: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.number, + PropTypes.instanceOf(Message) + ]), + + // An array of a certain type + optionalArrayOf: PropTypes.arrayOf(PropTypes.number), + + // An object with property values of a certain type + optionalObjectOf: PropTypes.objectOf(PropTypes.number), + + // You can chain any of the above with `isRequired` to make sure a warning + // is shown if the prop isn't provided. + + // An object taking on a particular shape + optionalObjectWithShape: PropTypes.shape({ + optionalProperty: PropTypes.string, + requiredProperty: PropTypes.number.isRequired + }), + + // An object with warnings on extra properties + optionalObjectWithStrictShape: PropTypes.exact({ + optionalProperty: PropTypes.string, + requiredProperty: PropTypes.number.isRequired + }), + + requiredFunc: PropTypes.func.isRequired, + + // A value of any data type + requiredAny: PropTypes.any.isRequired, + + // You can also specify a custom validator. It should return an Error + // object if the validation fails. Don't `console.warn` or throw, as this + // won't work inside `oneOfType`. + customProp: function(props, propName, componentName) { + if (!/matchme/.test(props[propName])) { + return new Error( + 'Invalid prop `' + propName + '` supplied to' + + ' `' + componentName + '`. Validation failed.' + ); + } + }, + + // You can also supply a custom validator to `arrayOf` and `objectOf`. + // It should return an Error object if the validation fails. The validator + // will be called for each key in the array or object. The first two + // arguments of the validator are the array or object itself, and the + // current item's key. + customArrayProp: PropTypes.arrayOf(function(propValue, key, componentName, location, propFullName) { + if (!/matchme/.test(propValue[key])) { + return new Error( + 'Invalid prop `' + propFullName + '` supplied to' + + ' `' + componentName + '`. Validation failed.' + ); + } + }) +}; +``` + +Refer to the [React documentation](https://facebook.github.io/react/docs/typechecking-with-proptypes.html) for more information. + +## Migrating from React.PropTypes + +Check out [Migrating from React.PropTypes](https://facebook.github.io/react/blog/2017/04/07/react-v15.5.0.html#migrating-from-react.proptypes) for details on how to migrate to `prop-types` from `React.PropTypes`. + +Note that this blog posts **mentions a codemod script that performs the conversion automatically**. + +There are also important notes below. + +## How to Depend on This Package? + +For apps, we recommend putting it in `dependencies` with a caret range. +For example: + +```js + "dependencies": { + "prop-types": "^15.5.7" + } +``` + +For libraries, we *also* recommend leaving it in `dependencies`: + +```js + "dependencies": { + "prop-types": "^15.5.7" + }, + "peerDependencies": { + "react": "^15.5.0" + } +``` + +**Note:** there are known issues in versions before 15.5.7 so we recommend using it as the minimal version. + +Make sure that the version range uses a caret (`^`) and thus is broad enough for npm to efficiently deduplicate packages. + +For UMD bundles of your components, make sure you **don’t** include `PropTypes` in the build. Usually this is done by marking it as an external (the specifics depend on your bundler), just like you do with React. + +## Compatibility + +### React 0.14 + +This package is compatible with **React 0.14.9**. Compared to 0.14.8 (which was released in March of 2016), there are no other changes in 0.14.9, so it should be a painless upgrade. + +```shell +# ATTENTION: Only run this if you still use React 0.14! +npm install --save react@^0.14.9 react-dom@^0.14.9 +``` + +### React 15+ + +This package is compatible with **React 15.3.0** and higher. + +``` +npm install --save react@^15.3.0 react-dom@^15.3.0 +``` + +### What happens on other React versions? + +It outputs warnings with the message below even though the developer doesn’t do anything wrong. Unfortunately there is no solution for this other than updating React to either 15.3.0 or higher, or 0.14.9 if you’re using React 0.14. + +## Difference from `React.PropTypes`: Don’t Call Validator Functions + +First of all, **which version of React are you using**? You might be seeing this message because a component library has updated to use `prop-types` package, but your version of React is incompatible with it. See the [above section](#compatibility) for more details. + +Are you using either React 0.14.9 or a version higher than React 15.3.0? Read on. + +When you migrate components to use the standalone `prop-types`, **all validator functions will start throwing an error if you call them directly**. This makes sure that nobody relies on them in production code, and it is safe to strip their implementations to optimize the bundle size. + +Code like this is still fine: + +```js +MyComponent.propTypes = { + myProp: PropTypes.bool +}; +``` + +However, code like this will not work with the `prop-types` package: + +```js +// Will not work with `prop-types` package! +var errorOrNull = PropTypes.bool(42, 'myProp', 'MyComponent', 'prop'); +``` + +It will throw an error: + +``` +Calling PropTypes validators directly is not supported by the `prop-types` package. +Use PropTypes.checkPropTypes() to call them. +``` + +(If you see **a warning** rather than an error with this message, please check the [above section about compatibility](#compatibility).) + +This is new behavior, and you will only encounter it when you migrate from `React.PropTypes` to the `prop-types` package. For the vast majority of components, this doesn’t matter, and if you didn’t see [this warning](https://facebook.github.io/react/warnings/dont-call-proptypes.html) in your components, your code is safe to migrate. This is not a breaking change in React because you are only opting into this change for a component by explicitly changing your imports to use `prop-types`. If you temporarily need the old behavior, you can keep using `React.PropTypes` until React 16. + +**If you absolutely need to trigger the validation manually**, call `PropTypes.checkPropTypes()`. Unlike the validators themselves, this function is safe to call in production, as it will be replaced by an empty function: + +```js +// Works with standalone PropTypes +PropTypes.checkPropTypes(MyComponent.propTypes, props, 'prop', 'MyComponent'); +``` +See below for more info. + +**If you DO want to use validation in production**, you can choose to use the **development version** by importing/requiring `prop-types/prop-types` instead of `prop-types`. + +**You might also see this error** if you’re calling a `PropTypes` validator from your own custom `PropTypes` validator. In this case, the fix is to make sure that you are passing *all* of the arguments to the inner function. There is a more in-depth explanation of how to fix it [on this page](https://facebook.github.io/react/warnings/dont-call-proptypes.html#fixing-the-false-positive-in-third-party-proptypes). Alternatively, you can temporarily keep using `React.PropTypes` until React 16, as it would still only warn in this case. + +If you use a bundler like Browserify or Webpack, don’t forget to [follow these instructions](https://reactjs.org/docs/optimizing-performance.html#use-the-production-build) to correctly bundle your application in development or production mode. Otherwise you’ll ship unnecessary code to your users. + +## PropTypes.checkPropTypes + +React will automatically check the propTypes you set on the component, but if +you are using PropTypes without React then you may want to manually call +`PropTypes.checkPropTypes`, like so: + +```js +const myPropTypes = { + name: PropTypes.string, + age: PropTypes.number, + // ... define your prop validations +}; + +const props = { + name: 'hello', // is valid + age: 'world', // not valid +}; + +// Let's say your component is called 'MyComponent' + +// Works with standalone PropTypes +PropTypes.checkPropTypes(myPropTypes, props, 'prop', 'MyComponent'); +// This will warn as follows: +// Warning: Failed prop type: Invalid prop `age` of type `string` supplied to +// `MyComponent`, expected `number`. +``` + +## PropTypes.resetWarningCache() + +`PropTypes.checkPropTypes(...)` only `console.error`s a given message once. To reset the error warning cache in tests, call `PropTypes.resetWarningCache()` + +### License + +prop-types is [MIT licensed](./LICENSE). diff --git a/node_modules/prop-types/checkPropTypes.js b/node_modules/prop-types/checkPropTypes.js new file mode 100644 index 0000000..481f2cf --- /dev/null +++ b/node_modules/prop-types/checkPropTypes.js @@ -0,0 +1,103 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var printWarning = function() {}; + +if (process.env.NODE_ENV !== 'production') { + var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); + var loggedTypeFailures = {}; + var has = require('./lib/has'); + + printWarning = function(text) { + var message = 'Warning: ' + text; + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) { /**/ } + }; +} + +/** + * Assert that the values match with the type specs. + * Error messages are memorized and will only be shown once. + * + * @param {object} typeSpecs Map of name to a ReactPropType + * @param {object} values Runtime values that need to be type-checked + * @param {string} location e.g. "prop", "context", "child context" + * @param {string} componentName Name of the component for error messages. + * @param {?Function} getStack Returns the component stack. + * @private + */ +function checkPropTypes(typeSpecs, values, location, componentName, getStack) { + if (process.env.NODE_ENV !== 'production') { + for (var typeSpecName in typeSpecs) { + if (has(typeSpecs, typeSpecName)) { + var error; + // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + if (typeof typeSpecs[typeSpecName] !== 'function') { + var err = Error( + (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.' + ); + err.name = 'Invariant Violation'; + throw err; + } + error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); + } catch (ex) { + error = ex; + } + if (error && !(error instanceof Error)) { + printWarning( + (componentName || 'React class') + ': type specification of ' + + location + ' `' + typeSpecName + '` is invalid; the type checker ' + + 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + + 'You may have forgotten to pass an argument to the type checker ' + + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + + 'shape all require an argument).' + ); + } + if (error instanceof Error && !(error.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error.message] = true; + + var stack = getStack ? getStack() : ''; + + printWarning( + 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '') + ); + } + } + } + } +} + +/** + * Resets warning cache when testing. + * + * @private + */ +checkPropTypes.resetWarningCache = function() { + if (process.env.NODE_ENV !== 'production') { + loggedTypeFailures = {}; + } +} + +module.exports = checkPropTypes; diff --git a/node_modules/prop-types/factory.js b/node_modules/prop-types/factory.js new file mode 100644 index 0000000..abdf8e6 --- /dev/null +++ b/node_modules/prop-types/factory.js @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +// React 15.5 references this module, and assumes PropTypes are still callable in production. +// Therefore we re-export development-only version with all the PropTypes checks here. +// However if one is migrating to the `prop-types` npm library, they will go through the +// `index.js` entry point, and it will branch depending on the environment. +var factory = require('./factoryWithTypeCheckers'); +module.exports = function(isValidElement) { + // It is still allowed in 15.5. + var throwOnDirectAccess = false; + return factory(isValidElement, throwOnDirectAccess); +}; diff --git a/node_modules/prop-types/factoryWithThrowingShims.js b/node_modules/prop-types/factoryWithThrowingShims.js new file mode 100644 index 0000000..ac88267 --- /dev/null +++ b/node_modules/prop-types/factoryWithThrowingShims.js @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); + +function emptyFunction() {} +function emptyFunctionWithReset() {} +emptyFunctionWithReset.resetWarningCache = emptyFunction; + +module.exports = function() { + function shim(props, propName, componentName, location, propFullName, secret) { + if (secret === ReactPropTypesSecret) { + // It is still safe when called from React. + return; + } + var err = new Error( + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use PropTypes.checkPropTypes() to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + err.name = 'Invariant Violation'; + throw err; + }; + shim.isRequired = shim; + function getShim() { + return shim; + }; + // Important! + // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. + var ReactPropTypes = { + array: shim, + bigint: shim, + bool: shim, + func: shim, + number: shim, + object: shim, + string: shim, + symbol: shim, + + any: shim, + arrayOf: getShim, + element: shim, + elementType: shim, + instanceOf: getShim, + node: shim, + objectOf: getShim, + oneOf: getShim, + oneOfType: getShim, + shape: getShim, + exact: getShim, + + checkPropTypes: emptyFunctionWithReset, + resetWarningCache: emptyFunction + }; + + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; diff --git a/node_modules/prop-types/factoryWithTypeCheckers.js b/node_modules/prop-types/factoryWithTypeCheckers.js new file mode 100644 index 0000000..a88068e --- /dev/null +++ b/node_modules/prop-types/factoryWithTypeCheckers.js @@ -0,0 +1,610 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var ReactIs = require('react-is'); +var assign = require('object-assign'); + +var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); +var has = require('./lib/has'); +var checkPropTypes = require('./checkPropTypes'); + +var printWarning = function() {}; + +if (process.env.NODE_ENV !== 'production') { + printWarning = function(text) { + var message = 'Warning: ' + text; + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; +} + +function emptyFunctionThatReturnsNull() { + return null; +} + +module.exports = function(isValidElement, throwOnDirectAccess) { + /* global Symbol */ + var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; + var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. + + /** + * Returns the iterator method function contained on the iterable object. + * + * Be sure to invoke the function with the iterable as context: + * + * var iteratorFn = getIteratorFn(myIterable); + * if (iteratorFn) { + * var iterator = iteratorFn.call(myIterable); + * ... + * } + * + * @param {?object} maybeIterable + * @return {?function} + */ + function getIteratorFn(maybeIterable) { + var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); + if (typeof iteratorFn === 'function') { + return iteratorFn; + } + } + + /** + * Collection of methods that allow declaration and validation of props that are + * supplied to React components. Example usage: + * + * var Props = require('ReactPropTypes'); + * var MyArticle = React.createClass({ + * propTypes: { + * // An optional string prop named "description". + * description: Props.string, + * + * // A required enum prop named "category". + * category: Props.oneOf(['News','Photos']).isRequired, + * + * // A prop named "dialog" that requires an instance of Dialog. + * dialog: Props.instanceOf(Dialog).isRequired + * }, + * render: function() { ... } + * }); + * + * A more formal specification of how these methods are used: + * + * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) + * decl := ReactPropTypes.{type}(.isRequired)? + * + * Each and every declaration produces a function with the same signature. This + * allows the creation of custom validation functions. For example: + * + * var MyLink = React.createClass({ + * propTypes: { + * // An optional string or URI prop named "href". + * href: function(props, propName, componentName) { + * var propValue = props[propName]; + * if (propValue != null && typeof propValue !== 'string' && + * !(propValue instanceof URI)) { + * return new Error( + * 'Expected a string or an URI for ' + propName + ' in ' + + * componentName + * ); + * } + * } + * }, + * render: function() {...} + * }); + * + * @internal + */ + + var ANONYMOUS = '<>'; + + // Important! + // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. + var ReactPropTypes = { + array: createPrimitiveTypeChecker('array'), + bigint: createPrimitiveTypeChecker('bigint'), + bool: createPrimitiveTypeChecker('boolean'), + func: createPrimitiveTypeChecker('function'), + number: createPrimitiveTypeChecker('number'), + object: createPrimitiveTypeChecker('object'), + string: createPrimitiveTypeChecker('string'), + symbol: createPrimitiveTypeChecker('symbol'), + + any: createAnyTypeChecker(), + arrayOf: createArrayOfTypeChecker, + element: createElementTypeChecker(), + elementType: createElementTypeTypeChecker(), + instanceOf: createInstanceTypeChecker, + node: createNodeChecker(), + objectOf: createObjectOfTypeChecker, + oneOf: createEnumTypeChecker, + oneOfType: createUnionTypeChecker, + shape: createShapeTypeChecker, + exact: createStrictShapeTypeChecker, + }; + + /** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ + /*eslint-disable no-self-compare*/ + function is(x, y) { + // SameValue algorithm + if (x === y) { + // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + return x !== 0 || 1 / x === 1 / y; + } else { + // Step 6.a: NaN == NaN + return x !== x && y !== y; + } + } + /*eslint-enable no-self-compare*/ + + /** + * We use an Error-like object for backward compatibility as people may call + * PropTypes directly and inspect their output. However, we don't use real + * Errors anymore. We don't inspect their stack anyway, and creating them + * is prohibitively expensive if they are created too often, such as what + * happens in oneOfType() for any type before the one that matched. + */ + function PropTypeError(message, data) { + this.message = message; + this.data = data && typeof data === 'object' ? data: {}; + this.stack = ''; + } + // Make `instanceof Error` still work for returned errors. + PropTypeError.prototype = Error.prototype; + + function createChainableTypeChecker(validate) { + if (process.env.NODE_ENV !== 'production') { + var manualPropTypeCallCache = {}; + var manualPropTypeWarningCount = 0; + } + function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { + componentName = componentName || ANONYMOUS; + propFullName = propFullName || propName; + + if (secret !== ReactPropTypesSecret) { + if (throwOnDirectAccess) { + // New behavior only for users of `prop-types` package + var err = new Error( + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use `PropTypes.checkPropTypes()` to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + err.name = 'Invariant Violation'; + throw err; + } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { + // Old behavior for people using React.PropTypes + var cacheKey = componentName + ':' + propName; + if ( + !manualPropTypeCallCache[cacheKey] && + // Avoid spamming the console because they are often not actionable except for lib authors + manualPropTypeWarningCount < 3 + ) { + printWarning( + 'You are manually calling a React.PropTypes validation ' + + 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + + 'and will throw in the standalone `prop-types` package. ' + + 'You may be seeing this warning due to a third-party PropTypes ' + + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.' + ); + manualPropTypeCallCache[cacheKey] = true; + manualPropTypeWarningCount++; + } + } + } + if (props[propName] == null) { + if (isRequired) { + if (props[propName] === null) { + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); + } + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); + } + return null; + } else { + return validate(props, propName, componentName, location, propFullName); + } + } + + var chainedCheckType = checkType.bind(null, false); + chainedCheckType.isRequired = checkType.bind(null, true); + + return chainedCheckType; + } + + function createPrimitiveTypeChecker(expectedType) { + function validate(props, propName, componentName, location, propFullName, secret) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== expectedType) { + // `propValue` being instance of, say, date/regexp, pass the 'object' + // check, but we can offer a more precise error message here rather than + // 'of type `object`'. + var preciseType = getPreciseType(propValue); + + return new PropTypeError( + 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'), + {expectedType: expectedType} + ); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createAnyTypeChecker() { + return createChainableTypeChecker(emptyFunctionThatReturnsNull); + } + + function createArrayOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); + } + var propValue = props[propName]; + if (!Array.isArray(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); + } + for (var i = 0; i < propValue.length; i++) { + var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createElementTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!isValidElement(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createElementTypeTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!ReactIs.isValidElementType(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createInstanceTypeChecker(expectedClass) { + function validate(props, propName, componentName, location, propFullName) { + if (!(props[propName] instanceof expectedClass)) { + var expectedClassName = expectedClass.name || ANONYMOUS; + var actualClassName = getClassName(props[propName]); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createEnumTypeChecker(expectedValues) { + if (!Array.isArray(expectedValues)) { + if (process.env.NODE_ENV !== 'production') { + if (arguments.length > 1) { + printWarning( + 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + + 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).' + ); + } else { + printWarning('Invalid argument supplied to oneOf, expected an array.'); + } + } + return emptyFunctionThatReturnsNull; + } + + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + for (var i = 0; i < expectedValues.length; i++) { + if (is(propValue, expectedValues[i])) { + return null; + } + } + + var valuesString = JSON.stringify(expectedValues, function replacer(key, value) { + var type = getPreciseType(value); + if (type === 'symbol') { + return String(value); + } + return value; + }); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); + } + return createChainableTypeChecker(validate); + } + + function createObjectOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); + } + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); + } + for (var key in propValue) { + if (has(propValue, key)) { + var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createUnionTypeChecker(arrayOfTypeCheckers) { + if (!Array.isArray(arrayOfTypeCheckers)) { + process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; + return emptyFunctionThatReturnsNull; + } + + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (typeof checker !== 'function') { + printWarning( + 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' + ); + return emptyFunctionThatReturnsNull; + } + } + + function validate(props, propName, componentName, location, propFullName) { + var expectedTypes = []; + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret); + if (checkerResult == null) { + return null; + } + if (checkerResult.data && has(checkerResult.data, 'expectedType')) { + expectedTypes.push(checkerResult.data.expectedType); + } + } + var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': ''; + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.')); + } + return createChainableTypeChecker(validate); + } + + function createNodeChecker() { + function validate(props, propName, componentName, location, propFullName) { + if (!isNode(props[propName])) { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function invalidValidatorError(componentName, location, propFullName, key, type) { + return new PropTypeError( + (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' + + 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.' + ); + } + + function createShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + for (var key in shapeTypes) { + var checker = shapeTypes[key]; + if (typeof checker !== 'function') { + return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createStrictShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + // We need to check all keys in case some are required but missing from props. + var allKeys = assign({}, props[propName], shapeTypes); + for (var key in allKeys) { + var checker = shapeTypes[key]; + if (has(shapeTypes, key) && typeof checker !== 'function') { + return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); + } + if (!checker) { + return new PropTypeError( + 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') + ); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + + return createChainableTypeChecker(validate); + } + + function isNode(propValue) { + switch (typeof propValue) { + case 'number': + case 'string': + case 'undefined': + return true; + case 'boolean': + return !propValue; + case 'object': + if (Array.isArray(propValue)) { + return propValue.every(isNode); + } + if (propValue === null || isValidElement(propValue)) { + return true; + } + + var iteratorFn = getIteratorFn(propValue); + if (iteratorFn) { + var iterator = iteratorFn.call(propValue); + var step; + if (iteratorFn !== propValue.entries) { + while (!(step = iterator.next()).done) { + if (!isNode(step.value)) { + return false; + } + } + } else { + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + if (!isNode(entry[1])) { + return false; + } + } + } + } + } else { + return false; + } + + return true; + default: + return false; + } + } + + function isSymbol(propType, propValue) { + // Native Symbol. + if (propType === 'symbol') { + return true; + } + + // falsy value can't be a Symbol + if (!propValue) { + return false; + } + + // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' + if (propValue['@@toStringTag'] === 'Symbol') { + return true; + } + + // Fallback for non-spec compliant Symbols which are polyfilled. + if (typeof Symbol === 'function' && propValue instanceof Symbol) { + return true; + } + + return false; + } + + // Equivalent of `typeof` but with special handling for array and regexp. + function getPropType(propValue) { + var propType = typeof propValue; + if (Array.isArray(propValue)) { + return 'array'; + } + if (propValue instanceof RegExp) { + // Old webkits (at least until Android 4.0) return 'function' rather than + // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ + // passes PropTypes.object. + return 'object'; + } + if (isSymbol(propType, propValue)) { + return 'symbol'; + } + return propType; + } + + // This handles more types than `getPropType`. Only used for error messages. + // See `createPrimitiveTypeChecker`. + function getPreciseType(propValue) { + if (typeof propValue === 'undefined' || propValue === null) { + return '' + propValue; + } + var propType = getPropType(propValue); + if (propType === 'object') { + if (propValue instanceof Date) { + return 'date'; + } else if (propValue instanceof RegExp) { + return 'regexp'; + } + } + return propType; + } + + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch (type) { + case 'array': + case 'object': + return 'an ' + type; + case 'boolean': + case 'date': + case 'regexp': + return 'a ' + type; + default: + return type; + } + } + + // Returns class name of the object, if any. + function getClassName(propValue) { + if (!propValue.constructor || !propValue.constructor.name) { + return ANONYMOUS; + } + return propValue.constructor.name; + } + + ReactPropTypes.checkPropTypes = checkPropTypes; + ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache; + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; diff --git a/node_modules/prop-types/index.js b/node_modules/prop-types/index.js new file mode 100644 index 0000000..e9ef51d --- /dev/null +++ b/node_modules/prop-types/index.js @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +if (process.env.NODE_ENV !== 'production') { + var ReactIs = require('react-is'); + + // By explicitly using `prop-types` you are opting into new development behavior. + // http://fb.me/prop-types-in-prod + var throwOnDirectAccess = true; + module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess); +} else { + // By explicitly using `prop-types` you are opting into new production behavior. + // http://fb.me/prop-types-in-prod + module.exports = require('./factoryWithThrowingShims')(); +} diff --git a/node_modules/prop-types/lib/ReactPropTypesSecret.js b/node_modules/prop-types/lib/ReactPropTypesSecret.js new file mode 100644 index 0000000..f54525e --- /dev/null +++ b/node_modules/prop-types/lib/ReactPropTypesSecret.js @@ -0,0 +1,12 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + +module.exports = ReactPropTypesSecret; diff --git a/node_modules/prop-types/lib/has.js b/node_modules/prop-types/lib/has.js new file mode 100644 index 0000000..007bae3 --- /dev/null +++ b/node_modules/prop-types/lib/has.js @@ -0,0 +1 @@ +module.exports = Function.call.bind(Object.prototype.hasOwnProperty); diff --git a/node_modules/prop-types/package.json b/node_modules/prop-types/package.json new file mode 100644 index 0000000..63daf70 --- /dev/null +++ b/node_modules/prop-types/package.json @@ -0,0 +1,60 @@ +{ + "name": "prop-types", + "version": "15.8.1", + "description": "Runtime type checking for React props and similar objects.", + "sideEffects": false, + "main": "index.js", + "license": "MIT", + "files": [ + "LICENSE", + "README.md", + "checkPropTypes.js", + "factory.js", + "factoryWithThrowingShims.js", + "factoryWithTypeCheckers.js", + "index.js", + "prop-types.js", + "prop-types.min.js", + "lib" + ], + "repository": "facebook/prop-types", + "keywords": [ + "react" + ], + "bugs": { + "url": "https://github.com/facebook/prop-types/issues" + }, + "homepage": "https://facebook.github.io/react/", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + }, + "scripts": { + "pretest": "npm run lint", + "lint": "eslint .", + "test": "npm run tests-only", + "tests-only": "jest", + "umd": "NODE_ENV=development browserify index.js -t loose-envify --standalone PropTypes -o prop-types.js", + "umd-min": "NODE_ENV=production browserify index.js -t loose-envify -t uglifyify --standalone PropTypes -p bundle-collapser/plugin -o | uglifyjs --compress unused,dead_code -o prop-types.min.js", + "build": "yarn umd && yarn umd-min", + "prepublish": "not-in-publish || yarn build" + }, + "devDependencies": { + "babel-jest": "^19.0.0", + "babel-preset-react": "^6.24.1", + "browserify": "^16.5.0", + "bundle-collapser": "^1.4.0", + "eslint": "^8.6.0", + "in-publish": "^2.0.1", + "jest": "^19.0.2", + "react": "^15.7.0", + "uglifyify": "^5.0.2", + "uglifyjs": "^2.4.11" + }, + "browserify": { + "transform": [ + "loose-envify" + ] + } +} diff --git a/node_modules/prop-types/prop-types.js b/node_modules/prop-types/prop-types.js new file mode 100644 index 0000000..a5a15dd --- /dev/null +++ b/node_modules/prop-types/prop-types.js @@ -0,0 +1,1315 @@ +(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.PropTypes = 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 1) { + printWarning( + 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + + 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).' + ); + } else { + printWarning('Invalid argument supplied to oneOf, expected an array.'); + } + } + return emptyFunctionThatReturnsNull; + } + + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + for (var i = 0; i < expectedValues.length; i++) { + if (is(propValue, expectedValues[i])) { + return null; + } + } + + var valuesString = JSON.stringify(expectedValues, function replacer(key, value) { + var type = getPreciseType(value); + if (type === 'symbol') { + return String(value); + } + return value; + }); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); + } + return createChainableTypeChecker(validate); + } + + function createObjectOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); + } + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); + } + for (var key in propValue) { + if (has(propValue, key)) { + var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createUnionTypeChecker(arrayOfTypeCheckers) { + if (!Array.isArray(arrayOfTypeCheckers)) { + "development" !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; + return emptyFunctionThatReturnsNull; + } + + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (typeof checker !== 'function') { + printWarning( + 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' + ); + return emptyFunctionThatReturnsNull; + } + } + + function validate(props, propName, componentName, location, propFullName) { + var expectedTypes = []; + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret); + if (checkerResult == null) { + return null; + } + if (checkerResult.data.hasOwnProperty('expectedType')) { + expectedTypes.push(checkerResult.data.expectedType); + } + } + var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': ''; + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.')); + } + return createChainableTypeChecker(validate); + } + + function createNodeChecker() { + function validate(props, propName, componentName, location, propFullName) { + if (!isNode(props[propName])) { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function invalidValidatorError(componentName, location, propFullName, key, type) { + return new PropTypeError( + (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' + + 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.' + ); + } + + function createShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + for (var key in shapeTypes) { + var checker = shapeTypes[key]; + if (typeof checker !== 'function') { + return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createStrictShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + // We need to check all keys in case some are required but missing from props. + var allKeys = assign({}, props[propName], shapeTypes); + for (var key in allKeys) { + var checker = shapeTypes[key]; + if (has(shapeTypes, key) && typeof checker !== 'function') { + return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); + } + if (!checker) { + return new PropTypeError( + 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') + ); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + + return createChainableTypeChecker(validate); + } + + function isNode(propValue) { + switch (typeof propValue) { + case 'number': + case 'string': + case 'undefined': + return true; + case 'boolean': + return !propValue; + case 'object': + if (Array.isArray(propValue)) { + return propValue.every(isNode); + } + if (propValue === null || isValidElement(propValue)) { + return true; + } + + var iteratorFn = getIteratorFn(propValue); + if (iteratorFn) { + var iterator = iteratorFn.call(propValue); + var step; + if (iteratorFn !== propValue.entries) { + while (!(step = iterator.next()).done) { + if (!isNode(step.value)) { + return false; + } + } + } else { + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + if (!isNode(entry[1])) { + return false; + } + } + } + } + } else { + return false; + } + + return true; + default: + return false; + } + } + + function isSymbol(propType, propValue) { + // Native Symbol. + if (propType === 'symbol') { + return true; + } + + // falsy value can't be a Symbol + if (!propValue) { + return false; + } + + // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' + if (propValue['@@toStringTag'] === 'Symbol') { + return true; + } + + // Fallback for non-spec compliant Symbols which are polyfilled. + if (typeof Symbol === 'function' && propValue instanceof Symbol) { + return true; + } + + return false; + } + + // Equivalent of `typeof` but with special handling for array and regexp. + function getPropType(propValue) { + var propType = typeof propValue; + if (Array.isArray(propValue)) { + return 'array'; + } + if (propValue instanceof RegExp) { + // Old webkits (at least until Android 4.0) return 'function' rather than + // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ + // passes PropTypes.object. + return 'object'; + } + if (isSymbol(propType, propValue)) { + return 'symbol'; + } + return propType; + } + + // This handles more types than `getPropType`. Only used for error messages. + // See `createPrimitiveTypeChecker`. + function getPreciseType(propValue) { + if (typeof propValue === 'undefined' || propValue === null) { + return '' + propValue; + } + var propType = getPropType(propValue); + if (propType === 'object') { + if (propValue instanceof Date) { + return 'date'; + } else if (propValue instanceof RegExp) { + return 'regexp'; + } + } + return propType; + } + + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch (type) { + case 'array': + case 'object': + return 'an ' + type; + case 'boolean': + case 'date': + case 'regexp': + return 'a ' + type; + default: + return type; + } + } + + // Returns class name of the object, if any. + function getClassName(propValue) { + if (!propValue.constructor || !propValue.constructor.name) { + return ANONYMOUS; + } + return propValue.constructor.name; + } + + ReactPropTypes.checkPropTypes = checkPropTypes; + ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache; + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; + +},{"./checkPropTypes":1,"./lib/ReactPropTypesSecret":5,"./lib/has":6,"object-assign":7,"react-is":11}],4:[function(require,module,exports){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +if ("development" !== 'production') { + var ReactIs = require('react-is'); + + // By explicitly using `prop-types` you are opting into new development behavior. + // http://fb.me/prop-types-in-prod + var throwOnDirectAccess = true; + module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess); +} else { + // By explicitly using `prop-types` you are opting into new production behavior. + // http://fb.me/prop-types-in-prod + module.exports = require('./factoryWithThrowingShims')(); +} + +},{"./factoryWithThrowingShims":2,"./factoryWithTypeCheckers":3,"react-is":11}],5:[function(require,module,exports){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + +module.exports = ReactPropTypesSecret; + +},{}],6:[function(require,module,exports){ +module.exports = Function.call.bind(Object.prototype.hasOwnProperty); + +},{}],7:[function(require,module,exports){ +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ + +'use strict'; +/* eslint-disable no-unused-vars */ +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var propIsEnumerable = Object.prototype.propertyIsEnumerable; + +function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); +} + +function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } +} + +module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; +}; + +},{}],8:[function(require,module,exports){ +// shim for using process in browser +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + 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 +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 +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; }; + +},{}],9:[function(require,module,exports){ +(function (process){(function (){ +/** @license React v16.13.1 + * react-is.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + + + +if (process.env.NODE_ENV !== "production") { + (function() { +'use strict'; + +// The Symbol used to tag the ReactElement-like types. If there is no native Symbol +// nor polyfill, then a plain number is used for performance. +var hasSymbol = typeof Symbol === 'function' && Symbol.for; +var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; +var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; +var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; +var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; +var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; +var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; +var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary +// (unstable) APIs that have been removed. Can we remove the symbols? + +var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; +var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; +var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; +var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; +var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; +var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; +var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; +var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; +var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; +var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; +var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; + +function isValidElementType(type) { + return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. + type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); +} + +function typeOf(object) { + if (typeof object === 'object' && object !== null) { + var $$typeof = object.$$typeof; + + switch ($$typeof) { + case REACT_ELEMENT_TYPE: + var type = object.type; + + switch (type) { + case REACT_ASYNC_MODE_TYPE: + case REACT_CONCURRENT_MODE_TYPE: + case REACT_FRAGMENT_TYPE: + case REACT_PROFILER_TYPE: + case REACT_STRICT_MODE_TYPE: + case REACT_SUSPENSE_TYPE: + return type; + + default: + var $$typeofType = type && type.$$typeof; + + switch ($$typeofType) { + case REACT_CONTEXT_TYPE: + case REACT_FORWARD_REF_TYPE: + case REACT_LAZY_TYPE: + case REACT_MEMO_TYPE: + case REACT_PROVIDER_TYPE: + return $$typeofType; + + default: + return $$typeof; + } + + } + + case REACT_PORTAL_TYPE: + return $$typeof; + } + } + + return undefined; +} // AsyncMode is deprecated along with isAsyncMode + +var AsyncMode = REACT_ASYNC_MODE_TYPE; +var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; +var ContextConsumer = REACT_CONTEXT_TYPE; +var ContextProvider = REACT_PROVIDER_TYPE; +var Element = REACT_ELEMENT_TYPE; +var ForwardRef = REACT_FORWARD_REF_TYPE; +var Fragment = REACT_FRAGMENT_TYPE; +var Lazy = REACT_LAZY_TYPE; +var Memo = REACT_MEMO_TYPE; +var Portal = REACT_PORTAL_TYPE; +var Profiler = REACT_PROFILER_TYPE; +var StrictMode = REACT_STRICT_MODE_TYPE; +var Suspense = REACT_SUSPENSE_TYPE; +var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated + +function isAsyncMode(object) { + { + if (!hasWarnedAboutDeprecatedIsAsyncMode) { + hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint + + console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); + } + } + + return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; +} +function isConcurrentMode(object) { + return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; +} +function isContextConsumer(object) { + return typeOf(object) === REACT_CONTEXT_TYPE; +} +function isContextProvider(object) { + return typeOf(object) === REACT_PROVIDER_TYPE; +} +function isElement(object) { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; +} +function isForwardRef(object) { + return typeOf(object) === REACT_FORWARD_REF_TYPE; +} +function isFragment(object) { + return typeOf(object) === REACT_FRAGMENT_TYPE; +} +function isLazy(object) { + return typeOf(object) === REACT_LAZY_TYPE; +} +function isMemo(object) { + return typeOf(object) === REACT_MEMO_TYPE; +} +function isPortal(object) { + return typeOf(object) === REACT_PORTAL_TYPE; +} +function isProfiler(object) { + return typeOf(object) === REACT_PROFILER_TYPE; +} +function isStrictMode(object) { + return typeOf(object) === REACT_STRICT_MODE_TYPE; +} +function isSuspense(object) { + return typeOf(object) === REACT_SUSPENSE_TYPE; +} + +exports.AsyncMode = AsyncMode; +exports.ConcurrentMode = ConcurrentMode; +exports.ContextConsumer = ContextConsumer; +exports.ContextProvider = ContextProvider; +exports.Element = Element; +exports.ForwardRef = ForwardRef; +exports.Fragment = Fragment; +exports.Lazy = Lazy; +exports.Memo = Memo; +exports.Portal = Portal; +exports.Profiler = Profiler; +exports.StrictMode = StrictMode; +exports.Suspense = Suspense; +exports.isAsyncMode = isAsyncMode; +exports.isConcurrentMode = isConcurrentMode; +exports.isContextConsumer = isContextConsumer; +exports.isContextProvider = isContextProvider; +exports.isElement = isElement; +exports.isForwardRef = isForwardRef; +exports.isFragment = isFragment; +exports.isLazy = isLazy; +exports.isMemo = isMemo; +exports.isPortal = isPortal; +exports.isProfiler = isProfiler; +exports.isStrictMode = isStrictMode; +exports.isSuspense = isSuspense; +exports.isValidElementType = isValidElementType; +exports.typeOf = typeOf; + })(); +} + +}).call(this)}).call(this,require('_process')) +},{"_process":8}],10:[function(require,module,exports){ +/** @license React v16.13.1 + * react-is.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict';var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b? +Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119; +function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d; +exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t}; +exports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p}; +exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z; + +},{}],11:[function(require,module,exports){ +(function (process){(function (){ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react-is.production.min.js'); +} else { + module.exports = require('./cjs/react-is.development.js'); +} + +}).call(this)}).call(this,require('_process')) +},{"./cjs/react-is.development.js":9,"./cjs/react-is.production.min.js":10,"_process":8}]},{},[4])(4) +}); diff --git a/node_modules/prop-types/prop-types.min.js b/node_modules/prop-types/prop-types.min.js new file mode 100644 index 0000000..7a746e1 --- /dev/null +++ b/node_modules/prop-types/prop-types.min.js @@ -0,0 +1 @@ +!function(f){"object"==typeof exports&&"undefined"!=typeof module?module.exports=f():"function"==typeof define&&define.amd?define([],f):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).PropTypes=f()}(function(){return function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var p="function"==typeof require&&require;if(!f&&p)return p(i,!0);if(u)return u(i,!0);throw(p=new Error("Cannot find module '"+i+"'")).code="MODULE_NOT_FOUND",p}p=n[i]={exports:{}},e[i][0].call(p.exports,function(r){return o(e[i][1][r]||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i + +React component to highlight words within a larger body of text. + +Check out a demo [here](https://bvaughn.github.io/react-highlight-words). + +## Usage + +To use it, just provide it with an array of search terms and a body of text to highlight. + +[Try this example in Code Sandbox.](https://codesandbox.io/s/5v8yqoxv7k) + +```jsx +import React from "react"; +import { createRoot } from "react-dom/client"; +import Highlighter from "react-highlight-words"; + +const root = createRoot(document.getElementById("root")); +root.render( + +); +``` + +And the `Highlighter` will mark all occurrences of search terms within the text: + +screen shot 2015-12-19 at 8 23 43 am + +## Props + +| Property | Type | Required? | Description | +|:---|:---|:---:|:---| +| activeClassName | String | | The class name to be applied to an active match. Use along with `activeIndex` | +| activeIndex | Number | | Specify the match index that should be actively highlighted. Use along with `activeClassName` | +| activeStyle | Object | | The inline style to be applied to an active match. Use along with `activeIndex` | +| autoEscape | Boolean | | Escape characters in `searchWords` which are meaningful in regular expressions | +| className | String | | CSS class name applied to the outer/wrapper `` | +| caseSensitive | Boolean | | Search should be case sensitive; defaults to `false` | +| findChunks | Function | | Use a custom function to search for matching chunks. This makes it possible to use arbitrary logic when looking for matches. See the default `findChunks` function in [highlight-words-core](https://github.com/bvaughn/highlight-words-core) for signature. Have a look at the [custom findChunks example](https://codesandbox.io/s/k20x3ox31o) on how to use it. | +| highlightClassName | String or Object | | CSS class name applied to highlighted text or object mapping search term matches to class names. | +| highlightStyle | Object | | Inline styles applied to highlighted text | +| highlightTag | Node or String | | Type of tag to wrap around highlighted matches. Defaults to `mark` but can also be a React element (class or functional) | +| sanitize | Function | | Process each search word and text to highlight before comparing (eg remove accents); signature `(text: string): string` | +| searchWords | Array | ✓ | Array of search words. String search terms are automatically cast to RegExps unless `autoEscape` is true. | +| textToHighlight | String | ✓ | Text to highlight matches in | +| unhighlightClassName | String | | CSS class name applied to unhighlighted text | +| unhighlightStyle | Object | | Inline styles applied to unhighlighted text | +| unhighlightTag | Node or String | | Type of tag applied to unhighlighted parts. Defaults to `span` but can also be a React element (class or functional) | +| * | any | | Any other props (such as `title` or `data-*`) are applied to the outer/wrapper `` | + +## Custom highlight tag + +By default this component uses an HTML Mark Text element (``) to wrap matched text, but you can inject a custom +tag using the `highlightTag` property. This tag should be a React component that accepts the following properties: + +| Property | Type | Description | +|:---|:---|:---| +| children | String | Text to be highlighted | +| highlightIndex | Number | Index of matched text | + +For example: + +```js +const Highlight = ({ children, highlightIndex }) => ( + {children} +); +``` + +## Installation + +``` +yarn add react-highlight-words +``` + +``` +npm i --save react-highlight-words +``` + +## License + +MIT License - fork, modify and use however you want. diff --git a/node_modules/react-highlight-words/build/index.html b/node_modules/react-highlight-words/build/index.html new file mode 100644 index 0000000..684c67c --- /dev/null +++ b/node_modules/react-highlight-words/build/index.html @@ -0,0 +1,11 @@ + + + + react-highlight-words + + + +
+ + + diff --git a/node_modules/react-highlight-words/build/static/main.js b/node_modules/react-highlight-words/build/static/main.js new file mode 100644 index 0000000..1a3a763 --- /dev/null +++ b/node_modules/react-highlight-words/build/static/main.js @@ -0,0 +1,35 @@ +!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){n(83),e.exports=n(82)},function(e,t,n){var r=n(6),o=n(18),a=n(16),i=n(12),l=n(14),u="prototype",c=function(e,t,n){var s,f,d,p,h=e&c.F,v=e&c.G,g=e&c.S,m=e&c.P,y=e&c.B,b=v?r:g?r[t]||(r[t]={}):(r[t]||{})[u],w=v?o:o[t]||(o[t]={}),k=w[u]||(w[u]={});v&&(n=t);for(s in n)f=!h&&b&&s in b,d=(f?b:n)[s],p=y&&f?l(d,r):m&&"function"==typeof d?l(Function.call,d):d,b&&!f&&i(b,s,d),w[s]!=d&&a(w,s,p),m&&k[s]!=d&&(k[s]=d)};r.core=o,c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,e.exports=c},function(e,t){var n=Object;e.exports={create:n.create,getProto:n.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:n.getOwnPropertyDescriptor,setDesc:n.defineProperty,setDescs:n.defineProperties,getKeys:n.keys,getNames:n.getOwnPropertyNames,getSymbols:n.getOwnPropertySymbols,each:[].forEach}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){var r=n(3);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){var r=n(70)("wks"),o=n(23),a=n(6).Symbol;e.exports=function(e){return r[e]||(r[e]=a&&a[e]||(a||o)("Symbol."+e))}},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(28),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){e.exports=!n(7)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){var r=n(1),o=n(18),a=n(7);e.exports=function(e,t){var n=(o.Object||{})[e]||Object[e],i={};i[e]=t(n),r(r.S+r.F*a(function(){n(1)}),"Object",i)}},function(e,t,n){var r=n(6),o=n(16),a=n(23)("src"),i="toString",l=Function[i],u=(""+l).split(i);n(18).inspectSource=function(e){return l.call(e)},(e.exports=function(e,t,n,i){"function"==typeof n&&(n.hasOwnProperty(a)||o(n,a,e[t]?""+e[t]:u.join(String(t))),n.hasOwnProperty("name")||o(n,"name",t)),e===r?e[t]=n:(i||delete e[t],o(e,t,n))})(Function.prototype,i,function(){return"function"==typeof this&&this[a]||l.call(this)})},function(e,t,n){var r=n(35),o=n(15);e.exports=function(e){return r(o(e))}},function(e,t,n){var r=n(21);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(2),o=n(20);e.exports=n(10)?function(e,t,n){return r.setDesc(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t){var n=e.exports={version:"1.2.6"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(15);e.exports=function(e){return Object(r(e))}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var r=n(5)("unscopables"),o=Array.prototype;void 0==o[r]&&n(16)(o,r,{}),e.exports=function(e){o[r][e]=!0}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){var r=n(14),o=n(63),a=n(60),i=n(4),l=n(9),u=n(74);e.exports=function(e,t,n,c){var s,f,d,p=u(e),h=r(n,c,t?2:1),v=0;if("function"!=typeof p)throw TypeError(e+" is not iterable!");if(a(p))for(s=l(e.length);s>v;v++)t?h(i(f=e[v])[0],f[1]):h(e[v]);else for(d=p.call(e);!(f=d.next()).done;)o(d,h,f.value,t)}},function(e,t){e.exports={}},function(e,t,n){var r=n(2).setDesc,o=n(8),a=n(5)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,a)&&r(e,a,{configurable:!0,value:t})}},function(e,t,n){var r=n(28),o=Math.max,a=Math.min;e.exports=function(e,t){return e=r(e),e<0?o(e+t,0):a(e,t)}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,n){"use strict";e.exports=n(213)},function(e,t,n){var r=n(14),o=n(35),a=n(19),i=n(9),l=n(86);e.exports=function(e){var t=1==e,n=2==e,u=3==e,c=4==e,s=6==e,f=5==e||s;return function(d,p,h){for(var v,g,m=a(d),y=o(m),b=r(p,h,3),w=i(y.length),k=0,S=t?l(d,w):n?l(d,0):void 0;w>k;k++)if((f||k in y)&&(v=y[k],g=b(v,k,m),e))if(t)S[k]=g;else if(g)switch(e){case 3:return!0;case 5:return v;case 6:return k;case 2:S.push(v)}else if(c)return!1;return s?-1:u||c?c:S}}},function(e,t,n){var r=n(17),o=n(5)("toStringTag"),a="Arguments"==r(function(){return arguments}());e.exports=function(e){var t,n,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=(t=Object(e))[o])?n:a?r(t):"Object"==(i=r(t))&&"function"==typeof t.callee?"Arguments":i}},function(e,t,n){"use strict";var r=n(6),o=n(1),a=n(12),i=n(36),l=n(24),u=n(38),c=n(3),s=n(7),f=n(43),d=n(26);e.exports=function(e,t,n,p,h,v){var g=r[e],m=g,y=h?"set":"add",b=m&&m.prototype,w={},k=function(e){var t=b[e];a(b,e,"delete"==e?function(e){return!(v&&!c(e))&&t.call(this,0===e?0:e)}:"has"==e?function(e){return!(v&&!c(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return v&&!c(e)?void 0:t.call(this,0===e?0:e)}:"add"==e?function(e){return t.call(this,0===e?0:e),this}:function(e,n){return t.call(this,0===e?0:e,n),this})};if("function"==typeof m&&(v||b.forEach&&!s(function(){(new m).entries().next()}))){var S,x=new m,E=x[y](v?{}:-0,1)!=x,_=s(function(){x.has(1)}),C=f(function(e){new m(e)});C||(m=t(function(t,n){u(t,m,e);var r=new g;return void 0!=n&&l(n,h,r[y],r),r}),m.prototype=b,b.constructor=m),v||x.forEach(function(e,t){S=1/t===-(1/0)}),(_||S)&&(k("delete"),k("has"),h&&k("get")),(S||E)&&k(y),v&&b.clear&&delete b.clear}else m=p.getConstructor(t,e,h,y),i(m.prototype,n);return d(m,e),w[e]=m,o(o.G+o.W+o.F*(m!=g),w),v||p.setStrong(m,e,h),m}},function(e,t,n){"use strict";var r=n(16),o=n(12),a=n(7),i=n(15),l=n(5);e.exports=function(e,t,n){var u=l(e),c=""[e];a(function(){var t={};return t[u]=function(){return 7},7!=""[e](t)})&&(o(String.prototype,e,n(i,u,c)),r(RegExp.prototype,u,2==t?function(e,t){return c.call(e,this,t)}:function(e){return c.call(e,this)}))}},function(e,t){e.exports=function(e,t,n){var r=void 0===n;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){var r=n(17);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){var r=n(12);e.exports=function(e,t){for(var n in t)r(e,n,t[n]);return e}},function(e,t,n){"use strict";var r=n(6),o=n(2),a=n(10),i=n(5)("species");e.exports=function(e){var t=r[e];a&&t&&!t[i]&&o.setDesc(t,i,{configurable:!0,get:function(){return this}})}},function(e,t){e.exports=function(e,t,n){if(!(e instanceof t))throw TypeError(n+": use the 'new' operator!");return e}},function(e,t,n){var r=n(1),o=n(15),a=n(7),i="\t\n\v\f\r   ᠎              \u2028\u2029\ufeff",l="["+i+"]",u="​…",c=RegExp("^"+l+l+"*"),s=RegExp(l+l+"*$"),f=function(e,t){var n={};n[e]=t(d),r(r.P+r.F*a(function(){return!!i[e]()||u[e]()!=u}),"String",n)},d=f.trim=function(e,t){return e=String(o(e)),1&t&&(e=e.replace(c,"")),2&t&&(e=e.replace(s,"")),e};e.exports=f},function(e,t,n){var r=n(5)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[r]=!1,!"/./"[e](t)}catch(e){}}return!0}},function(e,t,n){var r=n(17);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){"use strict";var r=n(44),o=n(1),a=n(12),i=n(16),l=n(8),u=n(25),c=n(64),s=n(26),f=n(2).getProto,d=n(5)("iterator"),p=!([].keys&&"next"in[].keys()),h="@@iterator",v="keys",g="values",m=function(){return this};e.exports=function(e,t,n,y,b,w,k){c(n,t,y);var S,x,E=function(e){if(!p&&e in O)return O[e];switch(e){case v:return function(){return new n(this,e)};case g:return function(){return new n(this,e)}}return function(){return new n(this,e)}},_=t+" Iterator",C=b==g,N=!1,O=e.prototype,P=O[d]||O[h]||b&&O[b],T=P||E(b);if(P){var L=f(T.call(new e));s(L,_,!0),!r&&l(O,h)&&i(L,d,m),C&&P.name!==g&&(N=!0,T=function(){return P.call(this)})}if(r&&!k||!p&&!N&&O[d]||i(O,d,T),u[t]=T,u[_]=m,b)if(S={values:C?T:E(g),keys:w?T:E(v),entries:C?E("entries"):T},k)for(x in S)x in O||a(O,x,S[x]);else o(o.P+o.F*(p||N),t,S);return S}},function(e,t,n){var r=n(5)("iterator"),o=!1;try{var a=[7][r]();a.return=function(){o=!0},Array.from(a,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!o)return!1;var n=!1;try{var a=[7],i=a[r]();i.next=function(){return{done:n=!0}},a[r]=function(){return i},e(a)}catch(e){}return n}},function(e,t){e.exports=!1},function(e,t){e.exports=Math.expm1||function(e){return 0==(e=+e)?e:e>-1e-6&&e<1e-6?e+e*e/2:Math.exp(e)-1}},function(e,t){e.exports=Math.sign||function(e){return 0==(e=+e)||e!=e?e:e<0?-1:1}},function(e,t,n){var r=n(2).getDesc,o=n(3),a=n(4),i=function(e,t){if(a(e),!o(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,o){try{o=n(14)(Function.call,r(Object.prototype,"__proto__").set,2),o(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,n){return i(e,n),t?e.__proto__=n:o(e,n),e}}({},!1):void 0),check:i}},function(e,t,n){var r=n(28),o=n(15);e.exports=function(e){return function(t,n){var a,i,l=String(o(t)),u=r(n),c=l.length;return u<0||u>=c?e?"":void 0:(a=l.charCodeAt(u),a<55296||a>56319||u+1===c||(i=l.charCodeAt(u+1))<56320||i>57343?e?l.charAt(u):a:e?l.slice(u,u+2):(a-55296<<10)+(i-56320)+65536)}}},function(e,t,n){var r=n(62),o=n(15);e.exports=function(e,t,n){if(r(t))throw TypeError("String#"+n+" doesn't accept regex!");return String(o(e))}},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t=0&&b.splice(t,1)}function l(e){var t=document.createElement("style");return t.type="text/css",a(e,t),t}function u(e){var t=document.createElement("link");return t.rel="stylesheet",a(e,t),t}function c(e,t){var n,r,o;if(t.singleton){var a=y++;n=m||(m=l(t)),r=s.bind(null,n,a,!1),o=s.bind(null,n,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=u(t),r=d.bind(null,n),o=function(){i(n),n.href&&URL.revokeObjectURL(n.href)}):(n=l(t),r=f.bind(null,n),o=function(){i(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}function s(e,t,n,r){var o=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=w(t,o);else{var a=document.createTextNode(o),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(a,i[t]):e.appendChild(a)}}function f(e,t){var n=t.css,r=t.media;if(r&&e.setAttribute("media",r),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function d(e,t){var n=t.css,r=t.sourceMap;r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var o=new Blob([n],{type:"text/css"}),a=e.href;e.href=URL.createObjectURL(o),a&&URL.revokeObjectURL(a)}var p={},h=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},v=h(function(){return/msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase())}),g=h(function(){return document.head||document.getElementsByTagName("head")[0]}),m=null,y=0,b=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=v()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var n=o(e);return r(n,t),function(e){for(var a=[],i=0;is;)if(l=u[s++],l!=l)return!0}else for(;c>s;s++)if((e||s in u)&&u[s]===n)return e||s;return!e&&-1}}},function(e,t,n){"use strict";var r=n(2),o=n(16),a=n(36),i=n(14),l=n(38),u=n(15),c=n(24),s=n(42),f=n(65),d=n(23)("id"),p=n(8),h=n(3),v=n(37),g=n(10),m=Object.isExtensible||h,y=g?"_s":"size",b=0,w=function(e,t){if(!h(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!p(e,d)){if(!m(e))return"F";if(!t)return"E";o(e,d,++b)}return"O"+e[d]},k=function(e,t){var n,r=w(t);if("F"!==r)return e._i[r];for(n=e._f;n;n=n.n)if(n.k==t)return n};e.exports={getConstructor:function(e,t,n,o){var s=e(function(e,a){l(e,s,t),e._i=r.create(null),e._f=void 0,e._l=void 0,e[y]=0,void 0!=a&&c(a,n,e[o],e)});return a(s.prototype,{clear:function(){for(var e=this,t=e._i,n=e._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete t[n.i];e._f=e._l=void 0,e[y]=0},delete:function(e){var t=this,n=k(t,e);if(n){var r=n.n,o=n.p;delete t._i[n.i],n.r=!0,o&&(o.n=r),r&&(r.p=o),t._f==n&&(t._f=r),t._l==n&&(t._l=o),t[y]--}return!!n},forEach:function(e){for(var t,n=i(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.n:this._f;)for(n(t.v,t.k,this);t&&t.r;)t=t.p},has:function(e){return!!k(this,e)}}),g&&r.setDesc(s.prototype,"size",{get:function(){return u(this[y])}}),s},def:function(e,t,n){var r,o,a=k(e,t);return a?a.v=n:(e._l=a={i:o=w(t,!0),k:t,v:n,p:r=e._l,n:void 0,r:!1},e._f||(e._f=a),r&&(r.n=a),e[y]++,"F"!==o&&(e._i[o]=a)),e},getEntry:k,setStrong:function(e,t,n){s(e,t,function(e,t){this._t=e,this._k=t,this._l=void 0},function(){for(var e=this,t=e._k,n=e._l;n&&n.r;)n=n.p;return e._t&&(e._l=n=n?n.n:e._t._f)?"keys"==t?f(0,n.k):"values"==t?f(0,n.v):f(0,[n.k,n.v]):(e._t=void 0,f(1))},n?"entries":"values",!n,!0),v(t)}}},function(e,t,n){var r=n(24),o=n(31);e.exports=function(e){return function(){if(o(this)!=e)throw TypeError(e+"#toJSON isn't generic");var t=[];return r(this,!1,t.push,t),t}}},function(e,t,n){"use strict";var r=n(16),o=n(36),a=n(4),i=n(3),l=n(38),u=n(24),c=n(30),s=n(8),f=n(23)("weak"),d=Object.isExtensible||i,p=c(5),h=c(6),v=0,g=function(e){return e._l||(e._l=new m)},m=function(){this.a=[]},y=function(e,t){return p(e.a,function(e){return e[0]===t})};m.prototype={get:function(e){var t=y(this,e);if(t)return t[1]},has:function(e){return!!y(this,e)},set:function(e,t){var n=y(this,e);n?n[1]=t:this.a.push([e,t])},delete:function(e){var t=h(this.a,function(t){return t[0]===e});return~t&&this.a.splice(t,1),!!~t}},e.exports={getConstructor:function(e,t,n,r){var a=e(function(e,o){l(e,a,t),e._i=v++,e._l=void 0,void 0!=o&&u(o,n,e[r],e)});return o(a.prototype,{delete:function(e){return!!i(e)&&(d(e)?s(e,f)&&s(e[f],this._i)&&delete e[f][this._i]:g(this).delete(e))},has:function(e){return!!i(e)&&(d(e)?s(e,f)&&s(e[f],this._i):g(this).has(e))}}),a},def:function(e,t,n){return d(a(t))?(s(t,f)||r(t,f,{}),t[f][e._i]=n):g(e).set(t,n),e},frozenStore:g,WEAK:f}},function(e,t,n){var r=n(3),o=n(6).document,a=r(o)&&r(o.createElement);e.exports=function(e){return a?o.createElement(e):{}}},function(e,t,n){"use strict";var r=n(4);e.exports=function(){var e=r(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},function(e,t,n){var r=n(13),o=n(2).getNames,a={}.toString,i="object"==typeof window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],l=function(e){try{return o(e)}catch(e){return i.slice()}};e.exports.get=function(e){return i&&"[object Window]"==a.call(e)?l(e):o(r(e))}},function(e,t,n){e.exports=n(6).document&&document.documentElement},function(e,t,n){var r=n(25),o=n(5)("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||a[o]===e)}},function(e,t,n){var r=n(3),o=Math.floor;e.exports=function(e){return!r(e)&&isFinite(e)&&o(e)===e}},function(e,t,n){var r=n(3),o=n(17),a=n(5)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[a])?!!t:"RegExp"==o(e))}},function(e,t,n){var r=n(4);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){var a=e.return;throw void 0!==a&&r(a.call(e)),t}}},function(e,t,n){"use strict";var r=n(2),o=n(20),a=n(26),i={};n(16)(i,n(5)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=r.create(i,{next:o(1,n)}),a(e,t+" Iterator")}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t){e.exports=Math.log1p||function(e){return(e=+e)>-1e-8&&e<1e-8?e-e*e/2:Math.log(1+e)}},function(e,t,n){var r=n(2),o=n(13),a=r.isEnum;e.exports=function(e){return function(t){for(var n,i=o(t),l=r.getKeys(i),u=l.length,c=0,s=[];u>c;)a.call(i,n=l[c++])&&s.push(e?[n,i[n]]:i[n]);return s}}},function(e,t,n){var r=n(2),o=n(4),a=n(6).Reflect;e.exports=a&&a.ownKeys||function(e){var t=r.getNames(o(e)),n=r.getSymbols;return n?t.concat(n(e)):t}},function(e,t){e.exports=Object.is||function(e,t){return e===t?0!==e||1/e===1/t:e!=e&&t!=t}},function(e,t,n){var r=n(6),o="__core-js_shared__",a=r[o]||(r[o]={});e.exports=function(e){return a[e]||(a[e]={})}},function(e,t,n){var r=n(9),o=n(72),a=n(15);e.exports=function(e,t,n,i){var l=String(a(e)),u=l.length,c=void 0===n?" ":String(n),s=r(t);if(s<=u)return l;""==c&&(c=" ");var f=s-u,d=o.call(c,Math.ceil(f/c.length));return d.length>f&&(d=d.slice(0,f)),i?d+l:l+d}},function(e,t,n){"use strict";var r=n(28),o=n(15);e.exports=function(e){var t=String(o(this)),n="",a=r(e);if(a<0||a==1/0)throw RangeError("Count can't be negative");for(;a>0;(a>>>=1)&&(t+=t))1&a&&(n+=t);return n}},function(e,t,n){var r,o,a,i=n(14),l=n(34),u=n(59),c=n(56),s=n(6),f=s.process,d=s.setImmediate,p=s.clearImmediate,h=s.MessageChannel,v=0,g={},m="onreadystatechange",y=function(){var e=+this;if(g.hasOwnProperty(e)){var t=g[e];delete g[e],t()}},b=function(e){y.call(e.data)};d&&p||(d=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return g[++v]=function(){l("function"==typeof e?e:Function(e),t)},r(v),v},p=function(e){delete g[e]},"process"==n(17)(f)?r=function(e){f.nextTick(i(y,e,1))}:h?(o=new h,a=o.port2,o.port1.onmessage=b,r=i(a.postMessage,a,1)):s.addEventListener&&"function"==typeof postMessage&&!s.importScripts?(r=function(e){s.postMessage(e+"","*")},s.addEventListener("message",b,!1)):r=m in c("script")?function(e){u.appendChild(c("script"))[m]=function(){u.removeChild(this),y.call(e)}}:function(e){setTimeout(i(y,e,1),0)}),e.exports={set:d,clear:p}},function(e,t,n){var r=n(31),o=n(5)("iterator"),a=n(25);e.exports=n(18).getIteratorMethod=function(e){if(void 0!=e)return e[o]||e["@@iterator"]||a[r(e)]}},function(e,t,n){"use strict";var r=n(22),o=n(65),a=n(25),i=n(13);e.exports=n(42)(Array,"Array",function(e,t){this._t=i(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,o(1)):"keys"==t?o(0,n):"values"==t?o(0,e[n]):o(0,[n,e[n]])},"values"),a.Arguments=a.Array,r("keys"),r("values"),r("entries")},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(s===setTimeout)return setTimeout(e,0);if((s===n||!s)&&setTimeout)return s=setTimeout,setTimeout(e,0);try{return s(e,0)}catch(t){try{return s.call(null,e,0)}catch(t){return s.call(this,e,0)}}}function a(e){if(f===clearTimeout)return clearTimeout(e);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function i(){v&&p&&(v=!1,p.length?h=p.concat(h):g=-1,h.length&&l())}function l(){if(!v){var e=o(i);v=!0;for(var t=h.length;t;){for(p=h,h=[];++g1)for(var n=1;n=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e){var t=e.activeClassName,n=void 0===t?"":t,r=e.activeIndex,a=void 0===r?-1:r,u=e.activeStyle,c=e.autoEscape,f=e.caseSensitive,p=void 0!==f&&f,h=e.className,v=e.findChunks,g=e.highlightClassName,m=void 0===g?"":g,y=e.highlightStyle,b=void 0===y?{}:y,w=e.highlightTag,k=void 0===w?"mark":w,S=e.sanitize,x=e.searchWords,E=e.textToHighlight,_=e.unhighlightTag,C=void 0===_?"span":_,N=e.unhighlightClassName,O=void 0===N?"":N,P=e.unhighlightStyle,T=o(e,["activeClassName","activeIndex","activeStyle","autoEscape","caseSensitive","className","findChunks","highlightClassName","highlightStyle","highlightTag","sanitize","searchWords","textToHighlight","unhighlightTag","unhighlightClassName","unhighlightStyle"]),L=(0,l.findAll)({autoEscape:c,caseSensitive:p,findChunks:v,sanitize:S,searchWords:x,textToHighlight:E}),M=k,z=-1,I="",R=void 0,F=function(e){var t={};for(var n in e)t[n.toLowerCase()]=e[n];return t},D=(0,d.default)(F);return(0,s.createElement)("span",i({className:h},T,{children:L.map(function(e,t){var r=E.substr(e.start,e.end-e.start);if(e.highlight){z++;var o=void 0;"object"==typeof m?p?o=m[r]:(m=D(m),o=m[r.toLowerCase()]):o=m;var i=z===+a;I=o+" "+(i?n:""),R=i===!0&&null!=u?Object.assign({},b,u):b;var l={children:r,className:I,key:t,style:R};return"string"!=typeof M&&(l.highlightIndex=z),(0,s.createElement)(M,l)}return(0,s.createElement)(C,{children:r,className:O,key:t,style:P})})}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t2?c[2]:void 0,f=Math.min((void 0===s?i:o(s,i))-u,i-l),d=1;for(u0;)u in n?n[l]=n[u]:delete n[l],l+=d,u+=d;return n}},function(e,t,n){"use strict";var r=n(19),o=n(27),a=n(9);e.exports=[].fill||function(e){for(var t=r(this),n=a(t.length),i=arguments,l=i.length,u=o(l>1?i[1]:void 0,n),c=l>2?i[2]:void 0,s=void 0===c?n:o(c,n);s>u;)t[u++]=e;return t}},function(e,t,n){var r=n(3),o=n(41),a=n(5)("species");e.exports=function(e,t){var n;return o(e)&&(n=e.constructor,"function"!=typeof n||n!==Array&&!o(n.prototype)||(n=void 0),r(n)&&(n=n[a],null===n&&(n=void 0))),new(void 0===n?Array:n)(t)}},function(e,t,n){var r=n(2);e.exports=function(e){var t=r.getKeys(e),n=r.getSymbols;if(n)for(var o,a=n(e),i=r.isEnum,l=0;a.length>l;)i.call(e,o=a[l++])&&t.push(o);return t}},function(e,t,n){var r=n(2),o=n(13);e.exports=function(e,t){for(var n,a=o(e),i=r.getKeys(a),l=i.length,u=0;l>u;)if(a[n=i[u++]]===t)return n}},function(e,t,n){var r,o,a,i=n(6),l=n(73).set,u=i.MutationObserver||i.WebKitMutationObserver,c=i.process,s=i.Promise,f="process"==n(17)(c),d=function(){var e,t,n;for(f&&(e=c.domain)&&(c.domain=null,e.exit());r;)t=r.domain,n=r.fn,t&&t.enter(),n(),t&&t.exit(),r=r.next;o=void 0,e&&e.enter()};if(f)a=function(){c.nextTick(d)};else if(u){var p=1,h=document.createTextNode("");new u(d).observe(h,{characterData:!0}),a=function(){h.data=p=-p}}else a=s&&s.resolve?function(){s.resolve().then(d)}:function(){l.call(i,d)};e.exports=function(e){var t={fn:e,next:void 0,domain:f&&c.domain};o&&(o.next=t),r||(r=t,a()),o=t}},function(e,t,n){ +var r=n(2),o=n(19),a=n(35);e.exports=n(7)(function(){var e=Object.assign,t={},n={},r=Symbol(),o="abcdefghijklmnopqrst";return t[r]=7,o.split("").forEach(function(e){n[e]=e}),7!=e({},t)[r]||Object.keys(e({},n)).join("")!=o})?function(e,t){for(var n=o(e),i=arguments,l=i.length,u=1,c=r.getKeys,s=r.getSymbols,f=r.isEnum;l>u;)for(var d,p=a(i[u++]),h=s?c(p).concat(s(p)):c(p),v=h.length,g=0;v>g;)f.call(p,d=h[g++])&&(n[d]=p[d]);return n}:Object.assign},function(e,t,n){"use strict";var r=n(92),o=n(34),a=n(21);e.exports=function(){for(var e=a(this),t=arguments.length,n=Array(t),i=0,l=r._,u=!1;t>i;)(n[i]=arguments[i++])===l&&(u=!0);return function(){var r,a=this,i=arguments,c=i.length,s=0,f=0;if(!u&&!c)return o(e,n,a);if(r=n.slice(),u)for(;t>s;s++)r[s]===l&&(r[s]=i[f++]);for(;c>f;)r.push(i[f++]);return o(e,r,a)}}},function(e,t,n){e.exports=n(6)},function(e,t){e.exports=function(e,t){var n=t===Object(t)?function(e){return t[e]}:t;return function(t){return String(t).replace(e,n)}}},function(e,t,n){var r=n(4),o=n(21),a=n(5)("species");e.exports=function(e,t){var n,i=r(e).constructor;return void 0===i||void 0==(n=r(i)[a])?t:o(n)}},function(e,t,n){var r=n(3);e.exports=function(e,t){if(!r(e))return e;var n,o;if(t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;if("function"==typeof(n=e.valueOf)&&!r(o=n.call(e)))return o;if(!t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){"use strict";var r,o=n(2),a=n(1),i=n(10),l=n(20),u=n(59),c=n(56),s=n(8),f=n(17),d=n(34),p=n(7),h=n(4),v=n(21),g=n(3),m=n(19),y=n(13),b=n(28),w=n(27),k=n(9),S=n(35),x=n(23)("__proto__"),E=n(30),_=n(52)(!1),C=Object.prototype,N=Array.prototype,O=N.slice,P=N.join,T=o.setDesc,L=o.getDesc,M=o.setDescs,z={};i||(r=!p(function(){return 7!=T(c("div"),"a",{get:function(){return 7}}).a}),o.setDesc=function(e,t,n){if(r)try{return T(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(h(e)[t]=n.value),e},o.getDesc=function(e,t){if(r)try{return L(e,t)}catch(e){}if(s(e,t))return l(!C.propertyIsEnumerable.call(e,t),e[t])},o.setDescs=M=function(e,t){h(e);for(var n,r=o.getKeys(t),a=r.length,i=0;a>i;)o.setDesc(e,n=r[i++],t[n]);return e}),a(a.S+a.F*!i,"Object",{getOwnPropertyDescriptor:o.getDesc,defineProperty:o.setDesc,defineProperties:M});var I="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),R=I.concat("length","prototype"),F=I.length,D=function(){var e,t=c("iframe"),n=F,r=">";for(t.style.display="none",u.appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("",e=e.removeChild(e.firstChild)):"string"==typeof o.is?e=l.createElement(n,{is:o.is}):(e=l.createElement(n),"select"===n&&(l=e,o.multiple?l.multiple=!0:o.size&&(l.size=o.size))):e=l.createElementNS(e,n),e[Lu]=t,e[Mu]=o,gu(e,t,!1,!1),t.stateNode=e;e:{switch(l=V(n,o),n){case"dialog":pt("cancel",e),pt("close",e),a=o;break;case"iframe":case"object":case"embed":pt("load",e),a=o;break;case"video":case"audio":for(a=0;ass&&(t.flags|=128,o=!0,Cr(i,!1),t.lanes=4194304)}else{if(!o)if(e=In(l),null!==e){if(t.flags|=128,o=!0,n=e.updateQueue,null!==n&&(t.updateQueue=n,t.flags|=4),Cr(i,!0),null===i.tail&&"hidden"===i.tailMode&&!l.alternate&&!dc)return Nr(t),null}else 2*Mi()-i.renderingStartTime>ss&&1073741824!==n&&(t.flags|=128,o=!0,Cr(i,!1),t.lanes=4194304);i.isBackwards?(l.sibling=t.child,t.child=l):(n=i.last,null!==n?n.sibling=l:t.child=l,i.last=l)}return null!==i.tail?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Mi(),t.sibling=null,n=wc.current,Ft(wc,o?1&n|2:1&n),t):(Nr(t),null);case 22:case 23:return Io(),o=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==o&&(t.flags|=8192),o&&0!==(1&t.mode)?0!==(1073741824&es)&&(Nr(t),6&t.subtreeFlags&&(t.flags|=8192)):Nr(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function Pr(e,t,n,r){t.child=null===e?vc(t,null,n,r):hc(t,e.child,n,r)}function Tr(e,t,n,r,o){n=n.render;var a=t.ref;return Zt(t,o),r=An(e,t,n,r,a,o),n=jn(),null===e||jc?(dc&&n&&vn(t),t.flags|=1,Pr(e,t,r,o),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Kr(e,t,o))}function Lr(e,t,n,r,o){if(null===e){var a=n.type;return"function"!=typeof a||na(a)||void 0!==a.defaultProps||null!==n.compare||void 0!==n.defaultProps?(e=aa(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=a,Mr(e,t,a,r,o))}if(a=e.child,0===(e.lanes&o)){var i=a.memoizedProps;if(n=n.compare,n=null!==n?n:et,n(i,r)&&e.ref===t.ref)return Kr(e,t,o)}return t.flags|=1,e=oa(a,r),e.ref=t.ref,e.return=t,t.child=e}function Mr(e,t,n,r,o){if(null!==e&&et(e.memoizedProps,r)&&e.ref===t.ref){ +if(jc=!1,0===(e.lanes&o))return t.lanes=e.lanes,Kr(e,t,o);0!==(131072&e.flags)&&(jc=!0)}return Rr(e,t,n,r,o)}function zr(e,t,n){var r=t.pendingProps,o=r.children,a=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(0===(1&t.mode))t.memoizedState={baseLanes:0,cachePool:null},Ft(ts,es),es|=n;else{if(0===(1073741824&n))return e=null!==a?a.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null},t.updateQueue=null,Ft(ts,es),es|=e,null;t.memoizedState={baseLanes:0,cachePool:null},r=null!==a?a.baseLanes:n,Ft(ts,es),es|=r}else null!==a?(r=a.baseLanes|n,t.memoizedState=null):r=n,Ft(ts,es),es|=r;return Pr(e,t,o,n),t.child}function Ir(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Rr(e,t,n,r,o){var a=At(n)?Wu:Uu.current;return a=Dt(t,a),Zt(t,o),n=An(e,t,n,r,a,o),r=jn(),null===e||jc?(dc&&r&&vn(t),t.flags|=1,Pr(e,t,n,o),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Kr(e,t,o))}function Fr(e,t,n,r,o){if(At(n)){var a=!0;Wt(t)}else a=!1;if(Zt(t,o),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),sn(t,n,r),dn(t,n,r,o),r=!0;else if(null===e){var i=t.stateNode,l=t.memoizedProps;i.props=l;var u=i.context,c=n.contextType;"object"==typeof c&&null!==c?c=Xt(c):(c=At(n)?Wu:Uu.current,c=Dt(t,c));var s=n.getDerivedStateFromProps,f="function"==typeof s||"function"==typeof i.getSnapshotBeforeUpdate;f||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(l!==r||u!==c)&&fn(t,i,r,c),Xu=!1;var d=t.memoizedState;i.state=d,an(t,r,i,o),u=t.memoizedState,l!==r||d!==u||Vu.current||Xu?("function"==typeof s&&(un(t,n,s,r),u=t.memoizedState),(l=Xu||cn(t,n,l,r,d,u,c))?(f||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||("function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount()),"function"==typeof i.componentDidMount&&(t.flags|=4194308)):("function"==typeof i.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),i.props=r,i.state=u,i.context=c,r=l):("function"==typeof i.componentDidMount&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,en(e,t),l=t.memoizedProps,c=t.type===t.elementType?l:qt(t.type,l),i.props=c,f=t.pendingProps,d=i.context,u=n.contextType,"object"==typeof u&&null!==u?u=Xt(u):(u=At(n)?Wu:Uu.current,u=Dt(t,u));var p=n.getDerivedStateFromProps;(s="function"==typeof p||"function"==typeof i.getSnapshotBeforeUpdate)||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(l!==f||d!==u)&&fn(t,i,r,u),Xu=!1,d=t.memoizedState,i.state=d,an(t,r,i,o);var h=t.memoizedState;l!==f||d!==h||Vu.current||Xu?("function"==typeof p&&(un(t,n,p,r),h=t.memoizedState),(c=Xu||cn(t,n,c,r,d,h,u)||!1)?(s||"function"!=typeof i.UNSAFE_componentWillUpdate&&"function"!=typeof i.componentWillUpdate||("function"==typeof i.componentWillUpdate&&i.componentWillUpdate(r,h,u),"function"==typeof i.UNSAFE_componentWillUpdate&&i.UNSAFE_componentWillUpdate(r,h,u)),"function"==typeof i.componentDidUpdate&&(t.flags|=4),"function"==typeof i.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof i.componentDidUpdate||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=h),i.props=r,i.state=h,i.context=u,r=c):("function"!=typeof i.componentDidUpdate||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),r=!1)}return Dr(e,t,n,r,a,o)}function Dr(e,t,n,r,o,a){Ir(e,t);var i=0!==(128&t.flags);if(!r&&!i)return o&&Ht(t,n,!1),Kr(e,t,a);r=t.stateNode,Ac.current=t;var l=i&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&i?(t.child=hc(t,e.child,null,a),t.child=hc(t,null,l,a)):Pr(e,t,l,a),t.memoizedState=r.state,o&&Ht(t,n,!0),t.child}function Ar(e){var t=e.stateNode;t.pendingContext?Ut(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Ut(e,t.context,!1),Tn(e,t.containerInfo)}function jr(e,t,n,r,o){return xn(),En(o),t.flags|=256,Pr(e,t,n,r),t.child}function Ur(e){return{baseLanes:e,cachePool:null}}function Vr(e,t,n){var o,a=t.pendingProps,i=wc.current,l=!1,u=0!==(128&t.flags);if((o=u)||(o=(null===e||null!==e.memoizedState)&&0!==(2&i)),o?(l=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(i|=1),Ft(wc,1&i),null===e)return wn(t),e=t.memoizedState,null!==e&&(e=e.dehydrated,null!==e)?(0===(1&t.mode)?t.lanes=1:"$!"===e.data?t.lanes=8:t.lanes=1073741824,null):(i=a.children,e=a.fallback,l?(a=t.mode,l=t.child,i={mode:"hidden",children:i},0===(1&a)&&null!==l?(l.childLanes=0,l.pendingProps=i):l=la(i,a,0,null),e=ia(e,a,n,null),l.return=t,e.return=t,l.sibling=e,t.child=l,t.child.memoizedState=Ur(n),t.memoizedState=Uc,e):Wr(t,i));if(i=e.memoizedState,null!==i){if(o=i.dehydrated,null!==o){if(u)return 256&t.flags?(t.flags&=-257,$r(e,t,n,Error(r(422)))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(l=a.fallback,i=t.mode,a=la({mode:"visible",children:a.children},i,0,null),l=ia(l,i,n,null),l.flags|=2,a.return=t,l.return=t,a.sibling=l,t.child=a,0!==(1&t.mode)&&hc(t,e.child,null,n),t.child.memoizedState=Ur(n),t.memoizedState=Uc,l);if(0===(1&t.mode))t=$r(e,t,n,null);else if("$!"===o.data)t=$r(e,t,n,Error(r(419)));else if(a=0!==(n&e.childLanes),jc||a){if(a=Zc,null!==a){switch(n&-n){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}a=0!==(l&(a.suspendedLanes|n))?0:l,0!==a&&a!==i.retryLane&&(i.retryLane=a,xo(e,a,-1))}Ao(),t=$r(e,t,n,Error(r(421)))}else"$?"===o.data?(t.flags|=128,t.child=e.child,t=Zo.bind(null,e),o._reactRetry=t,t=null):(n=i.treeContext,fc=Ot(o.nextSibling),sc=t,dc=!0,pc=null,null!==n&&(ac[ic++]=uc,ac[ic++]=cc,ac[ic++]=lc,uc=n.id,cc=n.overflow,lc=t),t=Wr(t,t.pendingProps.children),t.flags|=4096);return t}return l?(a=Br(e,t,a.children,a.fallback,n),l=t.child,i=e.child.memoizedState,l.memoizedState=null===i?Ur(n):{baseLanes:i.baseLanes|n,cachePool:null},l.childLanes=e.childLanes&~n,t.memoizedState=Uc,a):(n=Hr(e,t,a.children,n),t.memoizedState=null,n)}return l?(a=Br(e,t,a.children,a.fallback,n),l=t.child,i=e.child.memoizedState,l.memoizedState=null===i?Ur(n):{baseLanes:i.baseLanes|n,cachePool:null},l.childLanes=e.childLanes&~n,t.memoizedState=Uc,a):(n=Hr(e,t,a.children,n),t.memoizedState=null,n)}function Wr(e,t){return t=la({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Hr(e,t,n,r){var o=e.child;return e=o.sibling,n=oa(o,{mode:"visible",children:n}),0===(1&t.mode)&&(n.lanes=r),n.return=t,n.sibling=null,null!==e&&(r=t.deletions,null===r?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n}function Br(e,t,n,r,o){var a=t.mode;e=e.child;var i=e.sibling,l={mode:"hidden",children:n};return 0===(1&a)&&t.child!==e?(n=t.child,n.childLanes=0,n.pendingProps=l,t.deletions=null):(n=oa(e,l),n.subtreeFlags=14680064&e.subtreeFlags),null!==i?r=oa(i,r):(r=ia(r,a,o,null),r.flags|=2),r.return=t,n.return=t,n.sibling=r,t.child=n,r}function $r(e,t,n,r){return null!==r&&En(r),hc(t,e.child,null,n),e=Wr(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Qr(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),Yt(e.return,t,n)}function qr(e,t,n,r,o){var a=e.memoizedState;null===a?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=o)}function Gr(e,t,n){var r=t.pendingProps,o=r.revealOrder,a=r.tail;if(Pr(e,t,r.children,n),r=wc.current,0!==(2&r))r=1&r|2,t.flags|=128;else{if(null!==e&&0!==(128&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Qr(e,n,t);else if(19===e.tag)Qr(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Ft(wc,r),0===(1&t.mode))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;null!==n;)e=n.alternate,null!==e&&null===In(e)&&(o=n),n=n.sibling;n=o,null===n?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),qr(t,!1,o,n,a);break;case"backwards":for(n=null,o=t.child,t.child=null;null!==o;){if(e=o.alternate,null!==e&&null===In(e)){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}qr(t,!0,n,null,a);break;case"together":qr(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Kr(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),os|=t.lanes,0===(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(r(153));if(null!==t.child){for(e=t.child,n=oa(e,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,n=n.sibling=oa(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Yr(e,t,n){switch(t.tag){case 3:Ar(t),xn();break;case 5:Mn(t);break;case 1:At(t.type)&&Wt(t);break;case 4:Tn(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;Ft(qu,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,null!==r)return null!==r.dehydrated?(Ft(wc,1&wc.current),t.flags|=128,null):0!==(n&t.child.childLanes)?Vr(e,t,n):(Ft(wc,1&wc.current),e=Kr(e,t,n),null!==e?e.sibling:null);Ft(wc,1&wc.current);break;case 19:if(r=0!==(n&t.childLanes),0!==(128&e.flags)){if(r)return Gr(e,t,n);t.flags|=128}if(o=t.memoizedState,null!==o&&(o.rendering=null,o.tail=null,o.lastEffect=null),Ft(wc,wc.current),r)break;return null;case 22:case 23:return t.lanes=0,zr(e,t,n)}return Kr(e,t,n)}function Zr(e,t){switch(gn(t),t.tag){case 1:return At(t.type)&&jt(),e=t.flags,65536&e?(t.flags=e&-65537|128,t):null;case 3:return Ln(),Rt(Vu),Rt(Uu),Rn(),e=t.flags,0!==(65536&e)&&0===(128&e)?(t.flags=e&-65537|128,t):null;case 5:return zn(t),null;case 13:if(Rt(wc),e=t.memoizedState,null!==e&&null!==e.dehydrated){if(null===t.alternate)throw Error(r(340));xn()}return e=t.flags,65536&e?(t.flags=e&-65537|128,t):null;case 19:return Rt(wc),null;case 4:return Ln(),null;case 10:return Kt(t.type._context),null;case 22:case 23:return Io(),null;case 24:return null;default:return null}}function Xr(e,t){var n=e.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(n){Go(e,t,n)}else n.current=null}function Jr(e,t,n){try{n()}catch(n){Go(e,t,n)}}function eo(e,t){if(e=ot(),at(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var o=n.getSelection&&n.getSelection();if(o&&0!==o.rangeCount){n=o.anchorNode;var a=o.anchorOffset,i=o.focusNode;o=o.focusOffset;try{n.nodeType,i.nodeType}catch(e){n=null;break e}var l=0,u=-1,c=-1,s=0,f=0,d=e,p=null;t:for(;;){for(var h;d!==n||0!==a&&3!==d.nodeType||(u=l+a),d!==i||0!==o&&3!==d.nodeType||(c=l+o),3===d.nodeType&&(l+=d.nodeValue.length),null!==(h=d.firstChild);)p=d,d=h;for(;;){if(d===e)break t;if(p===n&&++s===a&&(u=l),p===i&&++f===o&&(c=l),null!==(h=d.nextSibling))break;d=p,p=d.parentNode}d=h}n=-1===u||-1===c?null:{start:u,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(_u={focusedElem:e,selectionRange:n},Bc=t;null!==Bc;)if(t=Bc,e=t.child,0!==(1028&t.subtreeFlags)&&null!==e)e.return=t,Bc=e;else for(;null!==Bc;){t=Bc;try{var v=t.alternate;if(0!==(1024&t.flags))switch(t.tag){case 0:case 11:case 15:break;case 1:if(null!==v){var g=v.memoizedProps,m=v.memoizedState,y=t.stateNode,b=y.getSnapshotBeforeUpdate(t.elementType===t.type?g:qt(t.type,g),m);y.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;if(1===w.nodeType)w.textContent="";else if(9===w.nodeType){var k=w.body;null!=k&&(k.textContent="")}break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Go(t,t.return,e)}if(e=t.sibling,null!==e){e.return=t.return,Bc=e;break}Bc=t.return}return v=$c,$c=!1,v}function to(e,t,n){var r=t.updateQueue;if(r=null!==r?r.lastEffect:null,null!==r){var o=r=r.next;do{if((o.tag&e)===e){var a=o.destroy;o.destroy=void 0,void 0!==a&&Jr(t,n,a)}o=o.next}while(o!==r)}}function no(e,t){if(t=t.updateQueue,t=null!==t?t.lastEffect:null,null!==t){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ro(e){var t=e.ref;if(null!==t){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}"function"==typeof t?t(e):t.current=e}}function oo(e,t,n){if(Ui&&"function"==typeof Ui.onCommitFiberUnmount)try{Ui.onCommitFiberUnmount(ji,t)}catch(e){}switch(t.tag){case 0:case 11:case 14:case 15:if(e=t.updateQueue,null!==e&&(e=e.lastEffect,null!==e)){var r=e=e.next;do{var o=r,a=o.destroy;o=o.tag,void 0!==a&&(0!==(2&o)?Jr(t,n,a):0!==(4&o)&&Jr(t,n,a)),r=r.next}while(r!==e)}break;case 1:if(Xr(t,n),e=t.stateNode,"function"==typeof e.componentWillUnmount)try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(e){Go(t,n,e)}break;case 5:Xr(t,n);break;case 4:fo(e,t,n)}}function ao(e){var t=e.alternate;null!==t&&(e.alternate=null,ao(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(t=e.stateNode,null!==t&&(delete t[Lu],delete t[Mu],delete t[Iu],delete t[Ru],delete t[Fu])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function io(e){return 5===e.tag||3===e.tag||4===e.tag}function lo(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||io(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function uo(e){e:{for(var t=e.return;null!==t;){if(io(t))break e;t=t.return}throw Error(r(160))}var n=t;switch(n.tag){case 5:t=n.stateNode,32&n.flags&&(D(t,""),n.flags&=-33),n=lo(e),so(e,n,t);break;case 3:case 4:t=n.stateNode.containerInfo,n=lo(e),co(e,n,t);break;default:throw Error(r(161))}}function co(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,null!==n&&void 0!==n||null!==t.onclick||(t.onclick=Et));else if(4!==r&&(e=e.child,null!==e))for(co(e,t,n),e=e.sibling;null!==e;)co(e,t,n),e=e.sibling}function so(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&(e=e.child,null!==e))for(so(e,t,n),e=e.sibling;null!==e;)so(e,t,n),e=e.sibling}function fo(e,t,n){for(var o,a,i=t,l=!1;;){if(!l){l=i.return;e:for(;;){if(null===l)throw Error(r(160));switch(o=l.stateNode,l.tag){case 5:a=!1;break e;case 3:o=o.containerInfo,a=!0;break e;case 4:o=o.containerInfo,a=!0;break e}l=l.return}l=!0}if(5===i.tag||6===i.tag){e:for(var u=e,c=i,s=n,f=c;;)if(oo(u,f,s),null!==f.child&&4!==f.tag)f.child.return=f,f=f.child;else{if(f===c)break e;for(;null===f.sibling;){if(null===f.return||f.return===c)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}a?(u=o,c=i.stateNode,8===u.nodeType?u.parentNode.removeChild(c):u.removeChild(c)):o.removeChild(i.stateNode)}else if(18===i.tag)a?(u=o,c=i.stateNode,8===u.nodeType?Nt(u.parentNode,c):1===u.nodeType&&Nt(u,c),_e(u)):Nt(o,i.stateNode);else if(4===i.tag){if(null!==i.child){o=i.stateNode.containerInfo,a=!0,i.child.return=i,i=i.child;continue}}else if(oo(e,i,n),null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;i=i.return,4===i.tag&&(l=!1)}i.sibling.return=i.return,i=i.sibling}}function po(e,t){switch(t.tag){case 0:case 11:case 14:case 15:return to(3,t,t.return),no(3,t),void to(5,t,t.return);case 1:return;case 5:var n=t.stateNode;if(null!=n){var o=t.memoizedProps,a=null!==e?e.memoizedProps:o;e=t.type;var i=t.updateQueue;if(t.updateQueue=null,null!==i){for("input"===e&&"radio"===o.type&&null!=o.name&&C(n,o),V(e,a),t=V(e,o),a=0;aa&&(a=l),o&=~i}if(o=a,o=Mi()-o,o=(120>o?120:480>o?480:1080>o?1080:1920>o?1920:3e3>o?3e3:4320>o?4320:1960*Qc(o/1960))-o,10e?16:e,null===vs)var o=!1;else{if(e=vs,vs=null,gs=0,0!==(6&Yc))throw Error(r(331));var a=Yc;for(Yc|=4,Bc=e.current;null!==Bc;){var i=Bc,l=i.child;if(0!==(16&Bc.flags)){var u=i.deletions;if(null!==u){for(var c=0;cMi()-cs?Ro(e,0):is|=n),_o(e,t)}function Yo(e,t){0===t&&(0===(1&e.mode)?t=1:(t=$i,$i<<=1,0===(130023424&$i)&&($i=4194304)));var n=ko();e=Eo(e,t),null!==e&&(pe(e,t,n),_o(e,n))}function Zo(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),Yo(e,n)}function Xo(e,t){var n=0; +switch(e.tag){case 13:var o=e.stateNode,a=e.memoizedState;null!==a&&(n=a.retryLane);break;case 19:o=e.stateNode;break;default:throw Error(r(314))}null!==o&&o.delete(t),Yo(e,n)}function Jo(e,t){return Oi(e,t)}function ea(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ta(e,t,n,r){return new ea(e,t,n,r)}function na(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ra(e){if("function"==typeof e)return na(e)?1:0;if(void 0!==e&&null!==e){if(e=e.$$typeof,e===Qa)return 11;if(e===Ka)return 14}return 2}function oa(e,t){var n=e.alternate;return null===n?(n=ta(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function aa(e,t,n,o,a,i){var l=2;if(o=e,"function"==typeof e)na(e)&&(l=1);else if("string"==typeof e)l=5;else e:switch(e){case Va:return ia(n.children,a,i,t);case Wa:l=8,a|=8;break;case Ha:return e=ta(12,n,t,2|a),e.elementType=Ha,e.lanes=i,e;case qa:return e=ta(13,n,t,a),e.elementType=qa,e.lanes=i,e;case Ga:return e=ta(19,n,t,a),e.elementType=Ga,e.lanes=i,e;case Za:return la(n,a,i,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case Ba:l=10;break e;case $a:l=9;break e;case Qa:l=11;break e;case Ka:l=14;break e;case Ya:l=16,o=null;break e}throw Error(r(130,null==e?e:typeof e,""))}return t=ta(l,n,t,a),t.elementType=e,t.type=o,t.lanes=i,t}function ia(e,t,n,r){return e=ta(7,e,r,t),e.lanes=n,e}function la(e,t,n,r){return e=ta(22,e,r,t),e.elementType=Za,e.lanes=n,e.stateNode={},e}function ua(e,t,n){return e=ta(6,e,null,t),e.lanes=n,e}function ca(e,t,n){return t=ta(4,null!==e.children?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function sa(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=de(0),this.expirationTimes=de(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=de(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function fa(e,t,n,r,o,a,i,l,u){return e=new sa(e,t,n,l,u),1===t?(t=1,!0===a&&(t|=8)):t=0,a=ta(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null},Jt(a),e}function da(e,t,n){var r=3