UNPKG

uppy

Version:

Extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:

4 lines 2.1 MB
{ "version": 3, "sources": ["../../../node_modules/@transloadit/prettier-bytes/src/prettierBytes.ts", "../../../node_modules/mime-match/node_modules/wildcard/index.js", "../../../node_modules/mime-match/index.js", "../../../node_modules/lodash/isObject.js", "../../../node_modules/lodash/_freeGlobal.js", "../../../node_modules/lodash/_root.js", "../../../node_modules/lodash/now.js", "../../../node_modules/lodash/_trimmedEndIndex.js", "../../../node_modules/lodash/_baseTrim.js", "../../../node_modules/lodash/_Symbol.js", "../../../node_modules/lodash/_getRawTag.js", "../../../node_modules/lodash/_objectToString.js", "../../../node_modules/lodash/_baseGetTag.js", "../../../node_modules/lodash/isObjectLike.js", "../../../node_modules/lodash/isSymbol.js", "../../../node_modules/lodash/toNumber.js", "../../../node_modules/lodash/debounce.js", "../../../node_modules/lodash/throttle.js", "../../../node_modules/namespace-emitter/index.js", "../../../node_modules/p-retry/node_modules/retry/lib/retry_operation.js", "../../../node_modules/p-retry/node_modules/retry/lib/retry.js", "../../../node_modules/p-retry/node_modules/retry/index.js", "../../../node_modules/classnames/index.js", "../../../node_modules/eventemitter3/index.js", "../../../node_modules/compressorjs/dist/compressor.js", "../../../node_modules/cropperjs/dist/cropper.js", "../../../node_modules/requires-port/index.js", "../../../node_modules/querystringify/index.js", "../../../node_modules/url-parse/index.js", "../../../node_modules/component-emitter/index.js", "../../../node_modules/is-mobile/index.js", "../../@uppy/utils/lib/hasProperty.js", "../../@uppy/utils/lib/AbortController.js", "../../@uppy/utils/lib/canvasToBlob.js", "../../@uppy/utils/lib/dataURItoBlob.js", "../../@uppy/utils/lib/ErrorWithCause.js", "../../@uppy/utils/lib/emaFilter.js", "../../@uppy/utils/lib/FOCUSABLE_ELEMENTS.js", "../../@uppy/utils/lib/NetworkError.js", "../../@uppy/utils/lib/ProgressTimeout.js", "../../@uppy/utils/lib/fetcher.js", "../../@uppy/utils/lib/fetchWithNetworkError.js", "../../@uppy/utils/lib/fileFilters.js", "../../@uppy/utils/lib/isDOMElement.js", "../../@uppy/utils/lib/findAllDOMElements.js", "../../@uppy/utils/lib/findDOMElement.js", "../../@uppy/utils/lib/getFileNameAndExtension.js", "../../@uppy/utils/lib/mimeTypes.js", "../../@uppy/utils/lib/getFileType.js", "../../@uppy/utils/lib/generateFileID.js", "../../@uppy/utils/lib/getAllowedMetaFields.js", "../../@uppy/utils/lib/toArray.js", "../../@uppy/utils/lib/getDroppedFiles/utils/fallbackApi.js", "../../@uppy/utils/lib/getDroppedFiles/utils/webkitGetAsEntryApi/getFilesAndDirectoriesFromDirectory.js", "../../@uppy/utils/lib/getDroppedFiles/utils/webkitGetAsEntryApi/index.js", "../../@uppy/utils/lib/getDroppedFiles/index.js", "../../@uppy/utils/lib/getFileTypeExtension.js", "../../@uppy/utils/lib/getSocketHost.js", "../../@uppy/utils/lib/getTextDirection.js", "../../@uppy/utils/lib/getTimeStamp.js", "../../@uppy/utils/lib/isDragDropSupported.js", "../../@uppy/utils/lib/isNetworkError.js", "../../@uppy/utils/lib/isObjectURL.js", "../../@uppy/utils/lib/isPreviewSupported.js", "../../@uppy/utils/lib/secondsToTime.js", "../../@uppy/utils/lib/prettyETA.js", "../../@uppy/utils/lib/RateLimitedQueue.js", "../../@uppy/utils/lib/remoteFileObjToLocal.js", "../../@uppy/utils/lib/TaskQueue.js", "../../@uppy/utils/lib/Translator.js", "../../@uppy/utils/lib/truncateString.js", "../../@uppy/utils/lib/UserFacingApiError.js", "../../../node_modules/preact/src/constants.js", "../../../node_modules/preact/src/util.js", "../../../node_modules/preact/src/options.js", "../../../node_modules/preact/src/create-element.js", "../../../node_modules/preact/src/component.js", "../../../node_modules/preact/src/diff/props.js", "../../../node_modules/preact/src/create-context.js", "../../../node_modules/preact/src/diff/children.js", "../../../node_modules/preact/src/diff/index.js", "../../../node_modules/preact/src/render.js", "../../../node_modules/preact/src/clone-element.js", "../../../node_modules/preact/src/diff/catch-error.js", "../../../node_modules/preact/jsx-runtime/src/utils.js", "../../../node_modules/preact/src/constants.js", "../../../node_modules/preact/jsx-runtime/src/index.js", "../../../node_modules/preact/hooks/src/index.js", "../../@uppy/utils/lib/VirtualList.js", "../../@uppy/core/lib/BasePlugin.js", "../../@uppy/core/lib/EventManager.js", "../../@uppy/core/lib/loggers.js", "../../@uppy/core/lib/Restricter.js", "../../@uppy/core/lib/UIPlugin.js", "../../@uppy/store-default/package.json", "../../@uppy/store-default/lib/index.js", "../../@uppy/core/lib/Uppy.js", "../../../node_modules/nanoid/non-secure/index.js", "../../@uppy/core/package.json", "../../@uppy/core/lib/getFileName.js", "../../@uppy/core/lib/locale.js", "../../@uppy/core/lib/supportsUploadProgress.js", "../../@uppy/companion-client/lib/index.js", "../../@uppy/companion-client/lib/getAllowedHosts.js", "../../../node_modules/p-retry/index.js", "../../../node_modules/is-network-error/index.js", "../../@uppy/companion-client/package.json", "../../@uppy/companion-client/lib/AuthError.js", "../../@uppy/companion-client/lib/RequestClient.js", "../../@uppy/companion-client/lib/Provider.js", "../../@uppy/companion-client/lib/SearchProvider.js", "../../@uppy/companion-client/lib/tokenStorage.js", "../../@uppy/provider-views/lib/index.js", "../../@uppy/provider-views/lib/useSearchForm.js", "../../@uppy/provider-views/lib/FilterInput.js", "../../@uppy/provider-views/lib/ProviderView/AuthView.js", "../../@uppy/provider-views/lib/GooglePicker/googlePicker.js", "../../@uppy/provider-views/lib/GooglePicker/icons.js", "../../@uppy/provider-views/lib/GooglePicker/GooglePickerView.js", "../../@uppy/provider-views/lib/ProviderView/ProviderView.js", "../../@uppy/provider-views/package.json", "../../@uppy/provider-views/lib/Item/index.js", "../../@uppy/provider-views/lib/Item/components/ItemIcon.js", "../../@uppy/provider-views/lib/Item/components/GridItem.js", "../../@uppy/provider-views/lib/Item/components/ListItem.js", "../../@uppy/provider-views/lib/Browser.js", "../../@uppy/provider-views/lib/FooterActions.js", "../../@uppy/provider-views/lib/utils/PartialTreeUtils/getNumberOfSelectedFiles.js", "../../@uppy/provider-views/lib/utils/companionFileToUppyFile.js", "../../@uppy/provider-views/lib/utils/addFiles.js", "../../@uppy/provider-views/lib/utils/getClickedRange.js", "../../@uppy/provider-views/lib/utils/handleError.js", "../../@uppy/provider-views/lib/utils/PartialTreeUtils/getBreadcrumbs.js", "../../@uppy/provider-views/lib/utils/PartialTreeUtils/getCheckedFilesWithPaths.js", "../../../node_modules/eventemitter3/index.mjs", "../../../node_modules/p-timeout/index.js", "../../../node_modules/p-queue/dist/lower-bound.js", "../../../node_modules/p-queue/dist/priority-queue.js", "../../../node_modules/p-queue/dist/index.js", "../../@uppy/provider-views/lib/utils/PartialTreeUtils/shallowClone.js", "../../@uppy/provider-views/lib/utils/PartialTreeUtils/afterFill.js", "../../@uppy/provider-views/lib/utils/PartialTreeUtils/afterOpenFolder.js", "../../@uppy/provider-views/lib/utils/PartialTreeUtils/afterScrollFolder.js", "../../@uppy/provider-views/lib/utils/PartialTreeUtils/afterToggleCheckbox.js", "../../@uppy/provider-views/lib/utils/PartialTreeUtils/index.js", "../../@uppy/provider-views/lib/utils/shouldHandleScroll.js", "../../@uppy/provider-views/lib/Item/components/SearchResultItem.js", "../../@uppy/provider-views/lib/ProviderView/GlobalSearchView.js", "../../@uppy/provider-views/lib/ProviderView/Header.js", "../../@uppy/provider-views/lib/Breadcrumbs.js", "../../@uppy/provider-views/lib/ProviderView/User.js", "../../@uppy/provider-views/lib/SearchProviderView/SearchProviderView.js", "../../@uppy/provider-views/lib/SearchView.js", "../../@uppy/audio/package.json", "../../@uppy/audio/lib/locale.js", "../../@uppy/audio/lib/PermissionsScreen.js", "../../@uppy/audio/lib/AudioSourceSelect.js", "../../@uppy/audio/lib/audio-oscilloscope/index.js", "../../@uppy/audio/lib/DiscardButton.js", "../../@uppy/audio/lib/RecordButton.js", "../../@uppy/audio/lib/formatSeconds.js", "../../@uppy/audio/lib/RecordingLength.js", "../../@uppy/audio/lib/SubmitButton.js", "../../@uppy/audio/lib/RecordingScreen.js", "../../@uppy/audio/lib/supportsMediaRecorder.js", "../../@uppy/audio/lib/Audio.js", "../../@uppy/aws-s3/package.json", "../../@uppy/aws-s3/lib/createSignedURL.js", "../../@uppy/aws-s3/lib/MultipartUploader.js", "../../@uppy/aws-s3/lib/utils.js", "../../@uppy/aws-s3/lib/HTTPCommunicationQueue.js", "../../@uppy/aws-s3/lib/index.js", "../../@uppy/box/package.json", "../../@uppy/box/lib/locale.js", "../../@uppy/box/lib/Box.js", "../../@uppy/compressor/lib/index.js", "../../@uppy/compressor/lib/locale.js", "../../../node_modules/exifr/dist/mini.esm.mjs", "../../@uppy/thumbnail-generator/package.json", "../../@uppy/thumbnail-generator/lib/locale.js", "../../@uppy/thumbnail-generator/lib/index.js", "../../@uppy/dashboard/package.json", "../../@uppy/dashboard/lib/components/Dashboard.js", "../../@uppy/dashboard/lib/components/AddFiles.js", "../../@uppy/dashboard/lib/components/AddFilesPanel.js", "../../@uppy/dashboard/lib/components/EditorPanel.js", "../../@uppy/dashboard/lib/components/FileCard/index.js", "../../@uppy/dashboard/lib/utils/getFileTypeIcon.js", "../../@uppy/dashboard/lib/utils/ignoreEvent.js", "../../@uppy/dashboard/lib/components/FilePreview.js", "../../@uppy/dashboard/lib/components/FileCard/RenderMetaFields.js", "../../@uppy/dashboard/lib/components/FileItem/index.js", "../../../node_modules/shallow-equal/src/arrays.ts", "../../../node_modules/shallow-equal/src/objects.ts", "../../../node_modules/shallow-equal/src/index.ts", "../../@uppy/dashboard/lib/utils/copyToClipboard.js", "../../@uppy/dashboard/lib/components/FileItem/Buttons/index.js", "../../@uppy/dashboard/lib/components/FileItem/FileInfo/index.js", "../../@uppy/dashboard/lib/components/FileItem/MetaErrorMessage.js", "../../@uppy/dashboard/lib/components/FileItem/FilePreviewAndLink/index.js", "../../@uppy/dashboard/lib/components/FileItem/FileProgress/index.js", "../../@uppy/dashboard/lib/components/FileList.js", "../../@uppy/dashboard/lib/components/Informer/FadeIn.js", "../../@uppy/dashboard/lib/components/Informer/TransitionGroup.js", "../../@uppy/dashboard/lib/components/Informer/Informer.js", "../../@uppy/dashboard/lib/components/PickerPanelContent.js", "../../@uppy/dashboard/lib/components/PickerPanelTopBar.js", "../../@uppy/dashboard/lib/components/Slide.js", "../../@uppy/dashboard/lib/components/StatusBar/StatusBarStates.js", "../../@uppy/dashboard/lib/components/StatusBar/StatusBarUI.js", "../../@uppy/dashboard/lib/components/StatusBar/Components.js", "../../@uppy/dashboard/lib/components/StatusBar/calculateProcessingProgress.js", "../../@uppy/dashboard/lib/components/StatusBar/StatusBar.js", "../../@uppy/dashboard/lib/locale.js", "../../@uppy/dashboard/lib/utils/createSuperFocus.js", "../../@uppy/dashboard/lib/utils/getActiveOverlayEl.js", "../../@uppy/dashboard/lib/utils/trapFocus.js", "../../@uppy/dashboard/lib/Dashboard.js", "../../@uppy/drag-drop/package.json", "../../@uppy/drag-drop/lib/locale.js", "../../@uppy/drag-drop/lib/DragDrop.js", "../../@uppy/drop-target/package.json", "../../@uppy/drop-target/lib/index.js", "../../@uppy/dropbox/package.json", "../../@uppy/dropbox/lib/locale.js", "../../@uppy/dropbox/lib/Dropbox.js", "../../@uppy/facebook/package.json", "../../@uppy/facebook/lib/locale.js", "../../@uppy/facebook/lib/Facebook.js", "../../../node_modules/get-form-data/es/index.js", "../../@uppy/form/package.json", "../../@uppy/form/lib/index.js", "../../@uppy/golden-retriever/package.json", "../../@uppy/golden-retriever/lib/IndexedDBStore.js", "../../@uppy/golden-retriever/lib/MetaDataStore.js", "../../@uppy/golden-retriever/lib/ServiceWorkerStore.js", "../../@uppy/golden-retriever/lib/index.js", "../../@uppy/google-drive/package.json", "../../@uppy/google-drive/lib/DriveProviderViews.js", "../../@uppy/google-drive/lib/locale.js", "../../@uppy/google-drive/lib/GoogleDrive.js", "../../@uppy/google-drive-picker/package.json", "../../@uppy/google-drive-picker/lib/locale.js", "../../@uppy/google-drive-picker/lib/GoogleDrivePicker.js", "../../@uppy/google-photos-picker/package.json", "../../@uppy/google-photos-picker/lib/locale.js", "../../@uppy/google-photos-picker/lib/GooglePhotosPicker.js", "../../@uppy/image-editor/lib/ImageEditor.js", "../../@uppy/image-editor/package.json", "../../@uppy/image-editor/lib/Editor.js", "../../@uppy/image-editor/lib/locale.js", "../../@uppy/image-editor/lib/utils/getCanvasDataThatFitsPerfectlyIntoContainer.js", "../../@uppy/image-editor/lib/utils/getScaleFactorThatRemovesDarkCorners.js", "../../@uppy/image-editor/lib/utils/limitCropboxMovementOnMove.js", "../../@uppy/image-editor/lib/utils/limitCropboxMovementOnResize.js", "../../@uppy/instagram/package.json", "../../@uppy/instagram/lib/locale.js", "../../@uppy/instagram/lib/Instagram.js", "../../@uppy/onedrive/package.json", "../../@uppy/onedrive/lib/locale.js", "../../@uppy/onedrive/lib/OneDrive.js", "../../@uppy/unsplash/package.json", "../../@uppy/unsplash/lib/locale.js", "../../@uppy/unsplash/lib/Unsplash.js", "../../@uppy/url/package.json", "../../@uppy/url/lib/locale.js", "../../@uppy/url/lib/UrlUI.js", "../../@uppy/url/lib/utils/forEachDroppedOrPastedUrl.js", "../../@uppy/url/lib/Url.js", "../../@uppy/zoom/package.json", "../../@uppy/zoom/lib/locale.js", "../../@uppy/zoom/lib/Zoom.js", "../../@uppy/remote-sources/package.json", "../../@uppy/remote-sources/lib/index.js", "../../@uppy/screen-capture/package.json", "../../@uppy/screen-capture/lib/locale.js", "../../@uppy/screen-capture/lib/DiscardButton.js", "../../@uppy/screen-capture/lib/RecordButton.js", "../../@uppy/screen-capture/lib/ScreenshotButton.js", "../../@uppy/screen-capture/lib/StopWatch.js", "../../@uppy/screen-capture/lib/StreamStatus.js", "../../@uppy/screen-capture/lib/SubmitButton.js", "../../@uppy/screen-capture/lib/RecorderScreen.js", "../../@uppy/screen-capture/lib/ScreenRecIcon.js", "../../@uppy/screen-capture/lib/ScreenCapture.js", "../../@uppy/status-bar/package.json", "../../@uppy/status-bar/lib/locale.js", "../../@uppy/status-bar/lib/StatusBarStates.js", "../../@uppy/status-bar/lib/StatusBarUI.js", "../../@uppy/status-bar/lib/Components.js", "../../@uppy/status-bar/lib/calculateProcessingProgress.js", "../../@uppy/status-bar/lib/StatusBar.js", "../../../node_modules/tus-js-client/lib.esm/error.js", "../../../node_modules/tus-js-client/lib.esm/logger.js", "../../../node_modules/tus-js-client/lib.esm/noopUrlStorage.js", "../../../node_modules/js-base64/base64.mjs", "../../../node_modules/tus-js-client/lib.esm/upload.js", "../../../node_modules/tus-js-client/lib.esm/uuid.js", "../../../node_modules/tus-js-client/lib.esm/browser/isReactNative.js", "../../../node_modules/tus-js-client/lib.esm/browser/uriToBlob.js", "../../../node_modules/tus-js-client/lib.esm/browser/sources/isCordova.js", "../../../node_modules/tus-js-client/lib.esm/browser/sources/readAsByteArray.js", "../../../node_modules/tus-js-client/lib.esm/browser/sources/FileSource.js", "../../../node_modules/tus-js-client/lib.esm/browser/sources/StreamSource.js", "../../../node_modules/tus-js-client/lib.esm/browser/fileReader.js", "../../../node_modules/tus-js-client/lib.esm/browser/fileSignature.js", "../../../node_modules/tus-js-client/lib.esm/browser/httpStack.js", "../../../node_modules/tus-js-client/lib.esm/browser/urlStorage.js", "../../../node_modules/tus-js-client/lib.esm/browser/index.js", "../../@uppy/tus/package.json", "../../@uppy/tus/lib/getFingerprint.js", "../../@uppy/tus/lib/index.js", "../../@uppy/transloadit/package.json", "../../@uppy/transloadit/lib/Assembly.js", "../../@uppy/transloadit/lib/AssemblyWatcher.js", "../../@uppy/transloadit/lib/Client.js", "../../@uppy/transloadit/lib/locale.js", "../../@uppy/transloadit/lib/index.js", "../../@uppy/webcam/lib/Webcam.js", "../../@uppy/webcam/package.json", "../../@uppy/webcam/lib/CameraIcon.js", "../../@uppy/webcam/lib/DiscardButton.js", "../../@uppy/webcam/lib/RecordButton.js", "../../@uppy/webcam/lib/formatSeconds.js", "../../@uppy/webcam/lib/RecordingLength.js", "../../@uppy/webcam/lib/SnapshotButton.js", "../../@uppy/webcam/lib/SubmitButton.js", "../../@uppy/webcam/lib/VideoSourceSelect.js", "../../@uppy/webcam/lib/CameraScreen.js", "../../@uppy/webcam/lib/locale.js", "../../@uppy/webcam/lib/PermissionsScreen.js", "../../@uppy/webcam/lib/supportsMediaRecorder.js", "../../@uppy/xhr-upload/package.json", "../../@uppy/xhr-upload/lib/locale.js", "../../@uppy/xhr-upload/lib/index.js", "../src/bundle.ts"], "sourcesContent": ["// Adapted from https://github.com/Flet/prettier-bytes/\n// Changing 1000 bytes to 1024, so we can keep uppercase KB vs kB\n// ISC License (c) Dan Flettre https://github.com/Flet/prettier-bytes/blob/master/LICENSE\nexport = function prettierBytes(num: number): string {\n if (typeof num !== 'number' || Number.isNaN(num)) {\n throw new TypeError(`Expected a number, got ${typeof num}`)\n }\n\n const neg = num < 0\n const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']\n\n if (neg) {\n num = -num\n }\n\n if (num < 1) {\n return `${(neg ? '-' : '') + num} B`\n }\n\n const exponent = Math.min(Math.floor(Math.log(num) / Math.log(1024)), units.length - 1)\n num = Number(num / 1024 ** exponent)\n const unit = units[exponent]\n\n if (num >= 10 || num % 1 === 0) {\n // Do not show decimals when the number is two-digit, or if the number has no\n // decimal component.\n return `${(neg ? '-' : '') + num.toFixed(0)} ${unit}`\n }\n\n return `${(neg ? '-' : '') + num.toFixed(1)} ${unit}`\n}\n", "/* jshint node: true */\n'use strict';\n\n/**\n # wildcard\n\n Very simple wildcard matching, which is designed to provide the same\n functionality that is found in the\n [eve](https://github.com/adobe-webplatform/eve) eventing library.\n\n ## Usage\n\n It works with strings:\n\n <<< examples/strings.js\n\n Arrays:\n\n <<< examples/arrays.js\n\n Objects (matching against keys):\n\n <<< examples/objects.js\n\n While the library works in Node, if you are are looking for file-based\n wildcard matching then you should have a look at:\n\n <https://github.com/isaacs/node-glob>\n**/\n\nfunction WildcardMatcher(text, separator) {\n this.text = text = text || '';\n this.hasWild = ~text.indexOf('*');\n this.separator = separator;\n this.parts = text.split(separator);\n}\n\nWildcardMatcher.prototype.match = function(input) {\n var matches = true;\n var parts = this.parts;\n var ii;\n var partsCount = parts.length;\n var testParts;\n\n if (typeof input == 'string' || input instanceof String) {\n if (!this.hasWild && this.text != input) {\n matches = false;\n } else {\n testParts = (input || '').split(this.separator);\n for (ii = 0; matches && ii < partsCount; ii++) {\n if (parts[ii] === '*') {\n continue;\n } else if (ii < testParts.length) {\n matches = parts[ii] === testParts[ii];\n } else {\n matches = false;\n }\n }\n\n // If matches, then return the component parts\n matches = matches && testParts;\n }\n }\n else if (typeof input.splice == 'function') {\n matches = [];\n\n for (ii = input.length; ii--; ) {\n if (this.match(input[ii])) {\n matches[matches.length] = input[ii];\n }\n }\n }\n else if (typeof input == 'object') {\n matches = {};\n\n for (var key in input) {\n if (this.match(key)) {\n matches[key] = input[key];\n }\n }\n }\n\n return matches;\n};\n\nmodule.exports = function(text, test, separator) {\n var matcher = new WildcardMatcher(text, separator || /[\\/\\.]/);\n if (typeof test != 'undefined') {\n return matcher.match(test);\n }\n\n return matcher;\n};\n", "var wildcard = require('wildcard');\nvar reMimePartSplit = /[\\/\\+\\.]/;\n\n/**\n # mime-match\n\n A simple function to checker whether a target mime type matches a mime-type\n pattern (e.g. image/jpeg matches image/jpeg OR image/*).\n\n ## Example Usage\n\n <<< example.js\n\n**/\nmodule.exports = function(target, pattern) {\n function test(pattern) {\n var result = wildcard(pattern, target, reMimePartSplit);\n\n // ensure that we have a valid mime type (should have two parts)\n return result && result.length >= 2;\n }\n\n return pattern ? test(pattern.split(';')[0]) : test;\n};\n", "/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n", "/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n", "var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n", "var root = require('./_root');\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nmodule.exports = now;\n", "/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nmodule.exports = trimmedEndIndex;\n", "var trimmedEndIndex = require('./_trimmedEndIndex');\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nmodule.exports = baseTrim;\n", "var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n", "var Symbol = require('./_Symbol');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n", "var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n", "/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n", "var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nmodule.exports = isSymbol;\n", "var baseTrim = require('./_baseTrim'),\n isObject = require('./isObject'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = toNumber;\n", "var isObject = require('./isObject'),\n now = require('./now'),\n toNumber = require('./toNumber');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nmodule.exports = debounce;\n", "var debounce = require('./debounce'),\n isObject = require('./isObject');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\nmodule.exports = throttle;\n", "/**\n* Create an event emitter with namespaces\n* @name createNamespaceEmitter\n* @example\n* var emitter = require('./index')()\n*\n* emitter.on('*', function () {\n* console.log('all events emitted', this.event)\n* })\n*\n* emitter.on('example', function () {\n* console.log('example event emitted')\n* })\n*/\nmodule.exports = function createNamespaceEmitter () {\n var emitter = {}\n var _fns = emitter._fns = {}\n\n /**\n * Emit an event. Optionally namespace the event. Handlers are fired in the order in which they were added with exact matches taking precedence. Separate the namespace and event with a `:`\n * @name emit\n * @param {String} event \u2013 the name of the event, with optional namespace\n * @param {...*} data \u2013 up to 6 arguments that are passed to the event listener\n * @example\n * emitter.emit('example')\n * emitter.emit('demo:test')\n * emitter.emit('data', { example: true}, 'a string', 1)\n */\n emitter.emit = function emit (event, arg1, arg2, arg3, arg4, arg5, arg6) {\n var toEmit = getListeners(event)\n\n if (toEmit.length) {\n emitAll(event, toEmit, [arg1, arg2, arg3, arg4, arg5, arg6])\n }\n }\n\n /**\n * Create en event listener.\n * @name on\n * @param {String} event\n * @param {Function} fn\n * @example\n * emitter.on('example', function () {})\n * emitter.on('demo', function () {})\n */\n emitter.on = function on (event, fn) {\n if (!_fns[event]) {\n _fns[event] = []\n }\n\n _fns[event].push(fn)\n }\n\n /**\n * Create en event listener that fires once.\n * @name once\n * @param {String} event\n * @param {Function} fn\n * @example\n * emitter.once('example', function () {})\n * emitter.once('demo', function () {})\n */\n emitter.once = function once (event, fn) {\n function one () {\n fn.apply(this, arguments)\n emitter.off(event, one)\n }\n this.on(event, one)\n }\n\n /**\n * Stop listening to an event. Stop all listeners on an event by only passing the event name. Stop a single listener by passing that event handler as a callback.\n * You must be explicit about what will be unsubscribed: `emitter.off('demo')` will unsubscribe an `emitter.on('demo')` listener,\n * `emitter.off('demo:example')` will unsubscribe an `emitter.on('demo:example')` listener\n * @name off\n * @param {String} event\n * @param {Function} [fn] \u2013 the specific handler\n * @example\n * emitter.off('example')\n * emitter.off('demo', function () {})\n */\n emitter.off = function off (event, fn) {\n var keep = []\n\n if (event && fn) {\n var fns = this._fns[event]\n var i = 0\n var l = fns ? fns.length : 0\n\n for (i; i < l; i++) {\n if (fns[i] !== fn) {\n keep.push(fns[i])\n }\n }\n }\n\n keep.length ? this._fns[event] = keep : delete this._fns[event]\n }\n\n function getListeners (e) {\n var out = _fns[e] ? _fns[e] : []\n var idx = e.indexOf(':')\n var args = (idx === -1) ? [e] : [e.substring(0, idx), e.substring(idx + 1)]\n\n var keys = Object.keys(_fns)\n var i = 0\n var l = keys.length\n\n for (i; i < l; i++) {\n var key = keys[i]\n if (key === '*') {\n out = out.concat(_fns[key])\n }\n\n if (args.length === 2 && args[0] === key) {\n out = out.concat(_fns[key])\n break\n }\n }\n\n return out\n }\n\n function emitAll (e, fns, args) {\n var i = 0\n var l = fns.length\n\n for (i; i < l; i++) {\n if (!fns[i]) break\n fns[i].event = e\n fns[i].apply(fns[i], args)\n }\n }\n\n return emitter\n}\n", "function RetryOperation(timeouts, options) {\n // Compatibility for the old (timeouts, retryForever) signature\n if (typeof options === 'boolean') {\n options = { forever: options };\n }\n\n this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));\n this._timeouts = timeouts;\n this._options = options || {};\n this._maxRetryTime = options && options.maxRetryTime || Infinity;\n this._fn = null;\n this._errors = [];\n this._attempts = 1;\n this._operationTimeout = null;\n this._operationTimeoutCb = null;\n this._timeout = null;\n this._operationStart = null;\n this._timer = null;\n\n if (this._options.forever) {\n this._cachedTimeouts = this._timeouts.slice(0);\n }\n}\nmodule.exports = RetryOperation;\n\nRetryOperation.prototype.reset = function() {\n this._attempts = 1;\n this._timeouts = this._originalTimeouts.slice(0);\n}\n\nRetryOperation.prototype.stop = function() {\n if (this._timeout) {\n clearTimeout(this._timeout);\n }\n if (this._timer) {\n clearTimeout(this._timer);\n }\n\n this._timeouts = [];\n this._cachedTimeouts = null;\n};\n\nRetryOperation.prototype.retry = function(err) {\n if (this._timeout) {\n clearTimeout(this._timeout);\n }\n\n if (!err) {\n return false;\n }\n var currentTime = new Date().getTime();\n if (err && currentTime - this._operationStart >= this._maxRetryTime) {\n this._errors.push(err);\n this._errors.unshift(new Error('RetryOperation timeout occurred'));\n return false;\n }\n\n this._errors.push(err);\n\n var timeout = this._timeouts.shift();\n if (timeout === undefined) {\n if (this._cachedTimeouts) {\n // retry forever, only keep last error\n this._errors.splice(0, this._errors.length - 1);\n timeout = this._cachedTimeouts.slice(-1);\n } else {\n return false;\n }\n }\n\n var self = this;\n this._timer = setTimeout(function() {\n self._attempts++;\n\n if (self._operationTimeoutCb) {\n self._timeout = setTimeout(function() {\n self._operationTimeoutCb(self._attempts);\n }, self._operationTimeout);\n\n if (self._options.unref) {\n self._timeout.unref();\n }\n }\n\n self._fn(self._attempts);\n }, timeout);\n\n if (this._options.unref) {\n this._timer.unref();\n }\n\n return true;\n};\n\nRetryOperation.prototype.attempt = function(fn, timeoutOps) {\n this._fn = fn;\n\n if (timeoutOps) {\n if (timeoutOps.timeout) {\n this._operationTimeout = timeoutOps.timeout;\n }\n if (timeoutOps.cb) {\n this._operationTimeoutCb = timeoutOps.cb;\n }\n }\n\n var self = this;\n if (this._operationTimeoutCb) {\n this._timeout = setTimeout(function() {\n self._operationTimeoutCb();\n }, self._operationTimeout);\n }\n\n this._operationStart = new Date().getTime();\n\n this._fn(this._attempts);\n};\n\nRetryOperation.prototype.try = function(fn) {\n console.log('Using RetryOperation.try() is deprecated');\n this.attempt(fn);\n};\n\nRetryOperation.prototype.start = function(fn) {\n console.log('Using RetryOperation.start() is deprecated');\n this.attempt(fn);\n};\n\nRetryOperation.prototype.start = RetryOperation.prototype.try;\n\nRetryOperation.prototype.errors = function() {\n return this._errors;\n};\n\nRetryOperation.prototype.attempts = function() {\n return this._attempts;\n};\n\nRetryOperation.prototype.mainError = function() {\n if (this._errors.length === 0) {\n return null;\n }\n\n var counts = {};\n var mainError = null;\n var mainErrorCount = 0;\n\n for (var i = 0; i < this._errors.length; i++) {\n var error = this._errors[i];\n var message = error.message;\n var count = (counts[message] || 0) + 1;\n\n counts[message] = count;\n\n if (count >= mainErrorCount) {\n mainError = error;\n mainErrorCount = count;\n }\n }\n\n return mainError;\n};\n", "var RetryOperation = require('./retry_operation');\n\nexports.operation = function(options) {\n var timeouts = exports.timeouts(options);\n return new RetryOperation(timeouts, {\n forever: options && (options.forever || options.retries === Infinity),\n unref: options && options.unref,\n maxRetryTime: options && options.maxRetryTime\n });\n};\n\nexports.timeouts = function(options) {\n if (options instanceof Array) {\n return [].concat(options);\n }\n\n var opts = {\n retries: 10,\n factor: 2,\n minTimeout: 1 * 1000,\n maxTimeout: Infinity,\n randomize: false\n };\n for (var key in options) {\n opts[key] = options[key];\n }\n\n if (opts.minTimeout > opts.maxTimeout) {\n throw new Error('minTimeout is greater than maxTimeout');\n }\n\n var timeouts = [];\n for (var i = 0; i < opts.retries; i++) {\n timeouts.push(this.createTimeout(i, opts));\n }\n\n if (options && options.forever && !timeouts.length) {\n timeouts.push(this.createTimeout(i, opts));\n }\n\n // sort the array numerically ascending\n timeouts.sort(function(a,b) {\n return a - b;\n });\n\n return timeouts;\n};\n\nexports.createTimeout = function(attempt, opts) {\n var random = (opts.randomize)\n ? (Math.random() + 1)\n : 1;\n\n var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));\n timeout = Math.min(timeout, opts.maxTimeout);\n\n return timeout;\n};\n\nexports.wrap = function(obj, options, methods) {\n if (options instanceof Array) {\n methods = options;\n options = null;\n }\n\n if (!methods) {\n methods = [];\n for (var key in obj) {\n if (typeof obj[key] === 'function') {\n methods.push(key);\n }\n }\n }\n\n for (var i = 0; i < methods.length; i++) {\n var method = methods[i];\n var original = obj[method];\n\n obj[method] = function retryWrapper(original) {\n var op = exports.operation(options);\n var args = Array.prototype.slice.call(arguments, 1);\n var callback = args.pop();\n\n args.push(function(err) {\n if (op.retry(err)) {\n return;\n }\n if (err) {\n arguments[0] = op.mainError();\n }\n callback.apply(this, arguments);\n });\n\n op.attempt(function() {\n original.apply(obj, args);\n });\n }.bind(obj, original);\n obj[method].options = options;\n }\n};\n", "module.exports = require('./lib/retry');", "/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n", "'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage f